@objectstack/console 5.1.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/LICENSE.apache +202 -0
  2. package/README.md +33 -50
  3. package/dist/assets/AiPendingActionsPage-DLWrcsds.js +1 -0
  4. package/dist/assets/ApiConsolePage-BIBykAYj.js +1 -0
  5. package/dist/assets/AppManagementPage-BKE0rv8B.js +1 -0
  6. package/dist/assets/ApprovalsInboxPage-D7gF2CM8.js +1 -0
  7. package/dist/assets/AuditLogPage-Bqlhi2ko.js +1 -0
  8. package/dist/assets/ComponentNavView-DBMxrUvH.js +1 -0
  9. package/dist/assets/ConsoleFloatingChatbot-CBIXkoNS.js +1 -0
  10. package/dist/assets/DeveloperHubPage-C3Ooh2Gg.js +1 -0
  11. package/dist/assets/FlowRunsPage-NjEPPv_e.js +1 -0
  12. package/dist/assets/MonacoImpl-CKoKq1tG.js +11 -0
  13. package/dist/assets/ObjectManagerListPage-DEPokJwV.js +1 -0
  14. package/dist/assets/ProfilePage-zYSeu2-d.js +1 -0
  15. package/dist/assets/PublicFormsPage-BrLPiHf1.js +1 -0
  16. package/dist/assets/SettingsHub-BTNCNbjZ.js +1 -0
  17. package/dist/assets/SettingsView-BLXf7B7b.js +1 -0
  18. package/dist/assets/SystemHubPage-CgN-8VKO.js +1 -0
  19. package/dist/assets/abap-CLvhMVsD.js +1 -0
  20. package/dist/assets/actionscript-3--17pq3dv.js +1 -0
  21. package/dist/assets/ada-C5qYipkI.js +1 -0
  22. package/dist/assets/andromeeda-vGVdxbeo.js +1 -0
  23. package/dist/assets/angular-html-B9s24XBK.js +1 -0
  24. package/dist/assets/angular-ts-C7DCn4N7.js +1 -0
  25. package/dist/assets/apache-U0d_L8uA.js +1 -0
  26. package/dist/assets/apex-VAyPSnFM.js +1 -0
  27. package/dist/assets/apl-BFSpAsVe.js +1 -0
  28. package/dist/assets/applescript-CCn79oCD.js +1 -0
  29. package/dist/assets/ara-4CJ0cIlV.js +1 -0
  30. package/dist/assets/asciidoc-DE70LPWp.js +1 -0
  31. package/dist/assets/asm-Cmm7eHzH.js +1 -0
  32. package/dist/assets/astro-By5nmri_.js +1 -0
  33. package/dist/assets/aurora-x-CDeNXAV0.js +1 -0
  34. package/dist/assets/awk-BWXHIvNe.js +1 -0
  35. package/dist/assets/ayu-dark-DluEY0Gj.js +1 -0
  36. package/dist/assets/ayu-light-C3h-C4tm.js +1 -0
  37. package/dist/assets/ayu-mirage-Bqwy1Gya.js +1 -0
  38. package/dist/assets/ballerina-B7ZEbQpA.js +1 -0
  39. package/dist/assets/bat-Bo4NYOV-.js +1 -0
  40. package/dist/assets/beancount-D-usSTwE.js +1 -0
  41. package/dist/assets/berry-DKpUyyne.js +1 -0
  42. package/dist/assets/bibtex-Ci_nEsc7.js +1 -0
  43. package/dist/assets/bicep-CUHmPFLl.js +1 -0
  44. package/dist/assets/bird2-C6vDhewU.js +1 -0
  45. package/dist/assets/blade-BEsyb4Es.js +1 -0
  46. package/dist/assets/bsl-BkkzgIyY.js +1 -0
  47. package/dist/assets/c-CwKsiqWD.js +1 -0
  48. package/dist/assets/c3-BFHwR3_K.js +1 -0
  49. package/dist/assets/cadence-CQ2zXKGN.js +1 -0
  50. package/dist/assets/cairo-DLTphjLi.js +1 -0
  51. package/dist/assets/catppuccin-frappe-3VR1Za6u.js +1 -0
  52. package/dist/assets/catppuccin-latte-DwIHMF0Q.js +1 -0
  53. package/dist/assets/catppuccin-macchiato-DYnBP6_5.js +1 -0
  54. package/dist/assets/catppuccin-mocha-DYhrFGRu.js +1 -0
  55. package/dist/assets/clarity-SemFz856.js +1 -0
  56. package/dist/assets/clojure-DqKBuwfJ.js +1 -0
  57. package/dist/assets/cmake-Bj61d0ZC.js +1 -0
  58. package/dist/assets/cobol-AtgRrYrD.js +1 -0
  59. package/dist/assets/codeowners-C8r90Shi.js +1 -0
  60. package/dist/assets/codeql-oeQT6MSM.js +1 -0
  61. package/dist/assets/coffee-Dx9BrBX9.js +1 -0
  62. package/dist/assets/common-lisp-Cv5bFMCO.js +1 -0
  63. package/dist/assets/coq-BrsZFFmf.js +1 -0
  64. package/dist/assets/cpp-DNQ-Fj9i.js +1 -0
  65. package/dist/assets/crystal-BFAqiLnY.js +1 -0
  66. package/dist/assets/csharp-oqKa8noW.js +1 -0
  67. package/dist/assets/css-76WQuunA.js +1 -0
  68. package/dist/assets/csv-Dx-8-gkx.js +1 -0
  69. package/dist/assets/cue-CE9AQfxI.js +1 -0
  70. package/dist/assets/cypher-ClKdZ_lG.js +1 -0
  71. package/dist/assets/d-qD-0Kul2.js +1 -0
  72. package/dist/assets/dark-plus-Cs2F2srj.js +1 -0
  73. package/dist/assets/dart-CnvKMtbv.js +1 -0
  74. package/dist/assets/data-adapter-Dn6-L_yI.js +1 -0
  75. package/dist/assets/dax-BkyTk9wS.js +1 -0
  76. package/dist/assets/desktop-Dlh5hvp9.js +1 -0
  77. package/dist/assets/diff-woXpYk--.js +1 -0
  78. package/dist/assets/docker-IyjqRm3v.js +1 -0
  79. package/dist/assets/dotenv-_5a1GRtc.js +1 -0
  80. package/dist/assets/dracula-BHWKrbxM.js +1 -0
  81. package/dist/assets/dracula-soft-5eyTD99u.js +1 -0
  82. package/dist/assets/dream-maker-DW3nJb8Q.js +1 -0
  83. package/dist/assets/edge-BEfBxc5h.js +1 -0
  84. package/dist/assets/elixir-Bi1LyDCo.js +1 -0
  85. package/dist/assets/elm-BMPZeG5i.js +1 -0
  86. package/dist/assets/emacs-lisp-B4R74twV.js +1 -0
  87. package/dist/assets/erb-Pmcx6TTx.js +1 -0
  88. package/dist/assets/erlang-Cphh6RMH.js +1 -0
  89. package/dist/assets/everforest-dark-sB-x3p7T.js +1 -0
  90. package/dist/assets/everforest-light-Df2xbC6M.js +1 -0
  91. package/dist/assets/fennel-DQxkIbk2.js +1 -0
  92. package/dist/assets/fish-BJitypiv.js +1 -0
  93. package/dist/assets/fluent-C03EYrpw.js +1 -0
  94. package/dist/assets/fortran-fixed-form-DEKoE2YW.js +1 -0
  95. package/dist/assets/fortran-free-form-CYNrtFtB.js +1 -0
  96. package/dist/assets/framework-ClI3DbWX.js +34 -0
  97. package/dist/assets/fsharp-D13ZGOAj.js +1 -0
  98. package/dist/assets/gdresource-C0sCabJj.js +1 -0
  99. package/dist/assets/gdscript-Cp2uCuqX.js +1 -0
  100. package/dist/assets/gdshader-CBce3t8t.js +1 -0
  101. package/dist/assets/genie-CV2tkWYe.js +1 -0
  102. package/dist/assets/gherkin-DExj1W_8.js +1 -0
  103. package/dist/assets/git-commit-BSykSTBG.js +1 -0
  104. package/dist/assets/git-rebase-Dj7t0bix.js +1 -0
  105. package/dist/assets/github-dark-C-LZuMrd.js +1 -0
  106. package/dist/assets/github-dark-default-DXG-b-1a.js +1 -0
  107. package/dist/assets/github-dark-dimmed-Bx1FflLF.js +1 -0
  108. package/dist/assets/github-dark-high-contrast-B_tTalzw.js +1 -0
  109. package/dist/assets/github-light-EUqPIrTm.js +1 -0
  110. package/dist/assets/github-light-default-BXViO-2h.js +1 -0
  111. package/dist/assets/github-light-high-contrast-B68TUdTA.js +1 -0
  112. package/dist/assets/gleam-CSRkHgEL.js +1 -0
  113. package/dist/assets/glimmer-js-DTpMHWUo.js +1 -0
  114. package/dist/assets/glimmer-ts-BKOVQU61.js +1 -0
  115. package/dist/assets/glsl-DDNdYp2B.js +1 -0
  116. package/dist/assets/gn-ilITqXS6.js +1 -0
  117. package/dist/assets/gnuplot-7GGW24-e.js +1 -0
  118. package/dist/assets/go-rLFTqkRN.js +1 -0
  119. package/dist/assets/graphql-C-akFyqE.js +1 -0
  120. package/dist/assets/groovy-CacY0gHj.js +1 -0
  121. package/dist/assets/gruvbox-dark-hard-C820rvS2.js +1 -0
  122. package/dist/assets/gruvbox-dark-medium-BPjhmG05.js +1 -0
  123. package/dist/assets/gruvbox-dark-soft-MrdJrrXF.js +1 -0
  124. package/dist/assets/gruvbox-light-hard-BC_s9l72.js +1 -0
  125. package/dist/assets/gruvbox-light-medium-BAWPOn9u.js +1 -0
  126. package/dist/assets/gruvbox-light-soft-BSMLrYjP.js +1 -0
  127. package/dist/assets/hack-Z382E4IB.js +1 -0
  128. package/dist/assets/haml-DCWQJgln.js +1 -0
  129. package/dist/assets/handlebars-D_RRtkV5.js +1 -0
  130. package/dist/assets/haskell-D8IpX4py.js +1 -0
  131. package/dist/assets/haxe-OTjmBuCE.js +1 -0
  132. package/dist/assets/hcl-Dh228itO.js +1 -0
  133. package/dist/assets/highlighted-body-OFNGDK62-Dua_6VJ2.js +1 -0
  134. package/dist/assets/hjson-CxZEssPk.js +1 -0
  135. package/dist/assets/hlsl-Cvrh5tZx.js +1 -0
  136. package/dist/assets/horizon-CE9ld1lL.js +1 -0
  137. package/dist/assets/horizon-bright-DSNQnXHK.js +1 -0
  138. package/dist/assets/houston-CsvMBhTu.js +1 -0
  139. package/dist/assets/html-BqDo3pKb.js +1 -0
  140. package/dist/assets/html-derivative-DncxUXSH.js +1 -0
  141. package/dist/assets/http-CrTHj6_t.js +1 -0
  142. package/dist/assets/hurl-BdeVL_ga.js +1 -0
  143. package/dist/assets/hxml-B0Qn7Nwc.js +1 -0
  144. package/dist/assets/hy-CZbG8q4J.js +1 -0
  145. package/dist/assets/imba-DsUTQ-LC.js +1 -0
  146. package/dist/assets/index-Ca4KaljM.js +23 -0
  147. package/dist/assets/index-DsQwZDFr.css +2 -0
  148. package/dist/assets/infrastructure-ezj3FgNE.js +3 -0
  149. package/dist/assets/ini-B5eOa1yu.js +1 -0
  150. package/dist/assets/java-DKFHmTAg.js +1 -0
  151. package/dist/assets/javascript-Jx16aUBb.js +1 -0
  152. package/dist/assets/jinja-CQEVrK23.js +1 -0
  153. package/dist/assets/jison-BJRgvE0A.js +1 -0
  154. package/dist/assets/json-DlFP2GYa.js +1 -0
  155. package/dist/assets/json5-BR5RXkoi.js +1 -0
  156. package/dist/assets/jsonc-CYpm1nAK.js +1 -0
  157. package/dist/assets/jsonl-CmCQp5Yx.js +1 -0
  158. package/dist/assets/jsonnet-CJTPZ8u_.js +1 -0
  159. package/dist/assets/jssm-DXw9l8Rf.js +1 -0
  160. package/dist/assets/jsx-CIwpwN-u.js +1 -0
  161. package/dist/assets/julia-D4zLZb0D.js +1 -0
  162. package/dist/assets/just-BbmgE3ZP.js +1 -0
  163. package/dist/assets/kanagawa-dragon-CXtmUGW6.js +1 -0
  164. package/dist/assets/kanagawa-lotus-BN08jTvb.js +1 -0
  165. package/dist/assets/kanagawa-wave-CTweb8Dz.js +1 -0
  166. package/dist/assets/kdl-CsD5j6eV.js +1 -0
  167. package/dist/assets/kotlin-DhhofPvG.js +1 -0
  168. package/dist/assets/kusto-C7mF5XQf.js +1 -0
  169. package/dist/assets/laserwave-C_8bwKvT.js +1 -0
  170. package/dist/assets/latex-BUDs7Dcl.js +1 -0
  171. package/dist/assets/lean-CewbzKMR.js +1 -0
  172. package/dist/assets/less-DVTAwKKz.js +1 -0
  173. package/dist/assets/light-plus-DVQuIRkW.js +1 -0
  174. package/dist/assets/liquid-Bc0s0G9S.js +1 -0
  175. package/dist/assets/llvm-Cm23YOpf.js +1 -0
  176. package/dist/assets/log-BNLmms1o.js +1 -0
  177. package/dist/assets/logo-Cluzi2Zq.js +1 -0
  178. package/dist/assets/lua-dQaszIi_.js +1 -0
  179. package/dist/assets/luau-FMPmPwt6.js +1 -0
  180. package/dist/assets/make-Dixweg8N.js +1 -0
  181. package/dist/assets/{maplibre-gl-fFz1l9Ly.js → maplibre-gl-CoREonuK.js} +1 -1
  182. package/dist/assets/markdown-BYOwaDjH.js +1 -0
  183. package/dist/assets/marko-B5Uea28G.js +1 -0
  184. package/dist/assets/material-theme-Bm3Qr25_.js +1 -0
  185. package/dist/assets/material-theme-darker-2IIEA8gg.js +1 -0
  186. package/dist/assets/material-theme-lighter-uhdI0v04.js +1 -0
  187. package/dist/assets/material-theme-ocean-CHQ94UKr.js +1 -0
  188. package/dist/assets/material-theme-palenight-B5W6OYN7.js +1 -0
  189. package/dist/assets/matlab-D7qyCx1q.js +1 -0
  190. package/dist/assets/mdc-CwQcy7BI.js +1 -0
  191. package/dist/assets/mdx-DQZ5AkYe.js +1 -0
  192. package/dist/assets/mermaid-Bk4SNUv9.js +1 -0
  193. package/dist/assets/mermaid-GHXKKRXX-BvEKnLTo.js +1 -0
  194. package/dist/assets/min-dark-BSWPekZh.js +1 -0
  195. package/dist/assets/min-light-DDpmG2fV.js +1 -0
  196. package/dist/assets/mipsasm-BMqwQI7S.js +1 -0
  197. package/dist/assets/mojo-BgCJLMeH.js +1 -0
  198. package/dist/assets/monokai-CdkpiU2Y.js +1 -0
  199. package/dist/assets/moonbit-CaWjb8XO.js +1 -0
  200. package/dist/assets/move-B1IS1UjX.js +1 -0
  201. package/dist/assets/narrat-_X_XdTYD.js +1 -0
  202. package/dist/assets/nextflow-BJtWHP5T.js +1 -0
  203. package/dist/assets/nextflow-groovy-DJMQeKeT.js +1 -0
  204. package/dist/assets/nginx-SzmDaWuK.js +1 -0
  205. package/dist/assets/night-owl-DhmEMT88.js +1 -0
  206. package/dist/assets/night-owl-light-eJ-hLW7d.js +1 -0
  207. package/dist/assets/nim-CO_A6I25.js +1 -0
  208. package/dist/assets/nix-IvuFDN5E.js +1 -0
  209. package/dist/assets/nord-Cb4Vim4T.js +1 -0
  210. package/dist/assets/nushell-DcLAeLz5.js +1 -0
  211. package/dist/assets/objective-c-D1A_Heim.js +1 -0
  212. package/dist/assets/objective-cpp-BsSzOQcm.js +1 -0
  213. package/dist/assets/ocaml-O90oeIOV.js +1 -0
  214. package/dist/assets/odin-B1RWQWA5.js +1 -0
  215. package/dist/assets/one-dark-pro-CLwyXe_n.js +1 -0
  216. package/dist/assets/one-light-D7Lr4KcI.js +1 -0
  217. package/dist/assets/openscad-BUDT5pXO.js +1 -0
  218. package/dist/assets/pascal-4ZHwLPI5.js +1 -0
  219. package/dist/assets/perl-DXgLsVg8.js +1 -0
  220. package/dist/assets/php-C4KCWpl8.js +1 -0
  221. package/dist/assets/pkl-ot-7Btpt.js +1 -0
  222. package/dist/assets/plastic-DQwYfKfQ.js +1 -0
  223. package/dist/assets/plsql-DGHpHOYJ.js +1 -0
  224. package/dist/assets/plugin-calendar-Dnr7itgk.js +1 -0
  225. package/dist/assets/plugin-charts-C11LxM1X.js +7 -0
  226. package/dist/assets/plugin-chatbot-COnH_NZC.js +120 -0
  227. package/dist/assets/plugin-dashboard-DvBectcr.js +3 -0
  228. package/dist/assets/plugin-form-f39dp3V2.js +1 -0
  229. package/dist/assets/plugin-gantt-7ui7uiVc.js +1 -0
  230. package/dist/assets/plugin-grid-DtceFt_J.js +6 -0
  231. package/dist/assets/plugin-kanban-q2UT5MlD.js +1 -0
  232. package/dist/assets/plugin-map-C6vgk2bJ.js +1 -0
  233. package/dist/assets/plugin-map-CsMXqW6n.css +1 -0
  234. package/dist/assets/plugin-markdown-DPzm2nVd.js +7 -0
  235. package/dist/assets/plugin-report-BJM4LH87.js +59 -0
  236. package/dist/assets/plugin-timeline-lCaTr_4i.js +1 -0
  237. package/dist/assets/plugin-view-b7gS6gIn.js +1 -0
  238. package/dist/assets/plugins-views-Dvl7pQvR.js +4 -0
  239. package/dist/assets/po-BiJDBrnU.js +1 -0
  240. package/dist/assets/poimandres-DRFjx7u4.js +1 -0
  241. package/dist/assets/polar-C7UOKdEL.js +1 -0
  242. package/dist/assets/postcss-BXeXVLqQ.js +1 -0
  243. package/dist/assets/powerquery-DNMTfnFr.js +1 -0
  244. package/dist/assets/powershell-DshXNtvi.js +1 -0
  245. package/dist/assets/prisma-BsRQq5mF.js +1 -0
  246. package/dist/assets/prolog-iXnhIJG7.js +1 -0
  247. package/dist/assets/proto-DB4EqR-F.js +1 -0
  248. package/dist/assets/pug-bpEG1CVZ.js +1 -0
  249. package/dist/assets/puppet-CDv2pdJW.js +1 -0
  250. package/dist/assets/purescript-9MfHhQsQ.js +1 -0
  251. package/dist/assets/python-gzcpVVnB.js +1 -0
  252. package/dist/assets/qml-DGJzHzg9.js +1 -0
  253. package/dist/assets/qmldir-DCQb3MpD.js +1 -0
  254. package/dist/assets/qss-Fe1Jh2GI.js +1 -0
  255. package/dist/assets/r-CZt9UGEb.js +1 -0
  256. package/dist/assets/racket-DcIDlBhZ.js +1 -0
  257. package/dist/assets/raku-B3gFvitq.js +1 -0
  258. package/dist/assets/razor-mTLK-dma.js +1 -0
  259. package/dist/assets/red-CJ3rzSJv.js +1 -0
  260. package/dist/assets/reg-CRGYupPL.js +1 -0
  261. package/dist/assets/regexp-DX5QhPdx.js +1 -0
  262. package/dist/assets/rel-BtDbiS_P.js +1 -0
  263. package/dist/assets/riscv-Ckw8ddFX.js +1 -0
  264. package/dist/assets/rolldown-runtime-CMxvf4Kt.js +1 -0
  265. package/dist/assets/ron-VUp2lXgN.js +1 -0
  266. package/dist/assets/rose-pine-BthvhNj6.js +1 -0
  267. package/dist/assets/rose-pine-dawn-Dg85fqjY.js +1 -0
  268. package/dist/assets/rose-pine-moon-hon4tzzS.js +1 -0
  269. package/dist/assets/rosmsg-CAekHB0j.js +1 -0
  270. package/dist/assets/rst-t-F-oATV.js +1 -0
  271. package/dist/assets/ruby-D9DDGNv3.js +1 -0
  272. package/dist/assets/rust-Cfkwpbl8.js +1 -0
  273. package/dist/assets/sas-BAEs8TsV.js +1 -0
  274. package/dist/assets/sass-DXrisJhu.js +1 -0
  275. package/dist/assets/scala-DKOlJaKm.js +1 -0
  276. package/dist/assets/scheme-DQCgrYNe.js +1 -0
  277. package/dist/assets/scss-B6B5DSWC.js +1 -0
  278. package/dist/assets/sdbl-bTVj8UrX.js +1 -0
  279. package/dist/assets/shaderlab-TOUzSsQk.js +1 -0
  280. package/dist/assets/shellscript-DXt7nqYk.js +1 -0
  281. package/dist/assets/shellsession-DQ4guRhR.js +1 -0
  282. package/dist/assets/slack-dark-DnToyrRv.js +1 -0
  283. package/dist/assets/slack-ochin-B2OO5cIa.js +1 -0
  284. package/dist/assets/smalltalk-B16xEiuN.js +1 -0
  285. package/dist/assets/snazzy-light-4G7pJPwS.js +1 -0
  286. package/dist/assets/solarized-dark-DV17i1UV.js +1 -0
  287. package/dist/assets/solarized-light-DSh2HLQt.js +1 -0
  288. package/dist/assets/solidity-CKzVLygQ.js +1 -0
  289. package/dist/assets/soy-DtwGS8Y2.js +1 -0
  290. package/dist/assets/sparql-D_iOobhT.js +1 -0
  291. package/dist/assets/splunk-BC2Px7Mm.js +1 -0
  292. package/dist/assets/sql-ArzG0FT1.js +1 -0
  293. package/dist/assets/src-Con14F4e.js +2 -0
  294. package/dist/assets/ssh-config-BgfXC-Er.js +1 -0
  295. package/dist/assets/stata-CdQ318yb.js +1 -0
  296. package/dist/assets/stylus-B6D30XZt.js +1 -0
  297. package/dist/assets/surrealql-RyXJ8VfM.js +1 -0
  298. package/dist/assets/svelte-CXkGIk7i.js +1 -0
  299. package/dist/assets/swift-DonLKvLd.js +1 -0
  300. package/dist/assets/synthwave-84-nFMaYfgc.js +1 -0
  301. package/dist/assets/system-verilog-DJ5XKQeo.js +1 -0
  302. package/dist/assets/systemd-BxMlprV5.js +1 -0
  303. package/dist/assets/talonscript-CohzipZa.js +1 -0
  304. package/dist/assets/tasl-DMoTqEGO.js +1 -0
  305. package/dist/assets/tcl-CZd0xW_V.js +1 -0
  306. package/dist/assets/templ-CJz86NIj.js +1 -0
  307. package/dist/assets/terraform-DswuEJGm.js +1 -0
  308. package/dist/assets/tex-C71esTKh.js +1 -0
  309. package/dist/assets/tokyo-night-oM2G3aXe.js +1 -0
  310. package/dist/assets/toml-CcmNWLt0.js +1 -0
  311. package/dist/assets/ts-tags-Qszjvpax.js +1 -0
  312. package/dist/assets/tsv-sltzmVWM.js +1 -0
  313. package/dist/assets/tsx-BEhriTf8.js +1 -0
  314. package/dist/assets/turtle-ByJddavk.js +1 -0
  315. package/dist/assets/twig-CbaWuFm3.js +1 -0
  316. package/dist/assets/types-CuyLcCWX.js +1 -0
  317. package/dist/assets/typescript-CBu4i5lG.js +1 -0
  318. package/dist/assets/typespec-BRdr0IET.js +1 -0
  319. package/dist/assets/typst-DI99ib-x.js +1 -0
  320. package/dist/assets/ui-components-BL3SEdAz.css +1 -0
  321. package/dist/assets/ui-components-ZN8XdmwJ.js +41 -0
  322. package/dist/assets/ui-layout-HiDSueut.js +1 -0
  323. package/dist/assets/v-DETTlOr0.js +1 -0
  324. package/dist/assets/vala-zf12oZj6.js +1 -0
  325. package/dist/assets/vb-Djn5o6TS.js +1 -0
  326. package/dist/assets/vendor-charts-vh1WJI0j.js +36 -0
  327. package/dist/assets/vendor-dndkit-0jp7h5ty.js +5 -0
  328. package/dist/assets/vendor-i18n-CnFu8bdi.js +1 -0
  329. package/dist/assets/vendor-icons-core-D5MicM14.js +1 -0
  330. package/dist/assets/vendor-markdown-CvMSBmgq.js +38 -0
  331. package/dist/assets/vendor-objectstack-CwZ3saTl.js +65 -0
  332. package/dist/assets/vendor-radix-BNWIlSsV.js +56 -0
  333. package/dist/assets/vendor-react-CIpZOxG3.js +13 -0
  334. package/dist/assets/vendor-sentry-D5yZpZ5X.js +484 -0
  335. package/dist/assets/vendor-ui-utils-D3GsyZyi.js +1 -0
  336. package/dist/assets/vendor-zod-BzP-Jkm3.js +1 -0
  337. package/dist/assets/verilog-CiiDBU1e.js +1 -0
  338. package/dist/assets/vesper-DdrHHSXu.js +1 -0
  339. package/dist/assets/vhdl-BroJfC0k.js +1 -0
  340. package/dist/assets/viml-DvXPmvsu.js +1 -0
  341. package/dist/assets/vitesse-black-fwtXNY1n.js +1 -0
  342. package/dist/assets/vitesse-dark-BZCL-v6S.js +1 -0
  343. package/dist/assets/vitesse-light-VbXTXTou.js +1 -0
  344. package/dist/assets/vue-Bruwzb-A.js +1 -0
  345. package/dist/assets/vue-html-C-3Ma2tD.js +1 -0
  346. package/dist/assets/vue-vine-DQAt9DTg.js +1 -0
  347. package/dist/assets/vyper-CgoNMtux.js +1 -0
  348. package/dist/assets/wasm-BnjxR4X6.js +1 -0
  349. package/dist/assets/wasm-ByWQv1Qj.js +1 -0
  350. package/dist/assets/wenyan-C8pVoKbM.js +1 -0
  351. package/dist/assets/wgsl-BsKzXJz4.js +1 -0
  352. package/dist/assets/wikitext-ClFFjSW2.js +1 -0
  353. package/dist/assets/wit-DdvCle-K.js +1 -0
  354. package/dist/assets/wolfram-DLL8P-h_.js +1 -0
  355. package/dist/assets/xml-BS2GSQw_.js +1 -0
  356. package/dist/assets/xsl-CCmfIdf4.js +1 -0
  357. package/dist/assets/yaml-C1LY7x4K.js +1 -0
  358. package/dist/assets/zenscript-BnlCZFoB.js +1 -0
  359. package/dist/assets/zig-CMLA9XwU.js +1 -0
  360. package/dist/index.html +24 -5
  361. package/dist/manifest.json +19 -0
  362. package/dist/vite.svg +25 -0
  363. package/package.json +18 -59
  364. package/dist/assets/app-shell-CaJU0zqc.js +0 -263
  365. package/dist/assets/dist-DxiImE7o.js +0 -1
  366. package/dist/assets/framework-CT7trS8g.js +0 -1
  367. package/dist/assets/index-DRq36Jb9.js +0 -1
  368. package/dist/assets/index-sNORrJSP.css +0 -1
  369. package/dist/assets/plugin-calendar-N01daPoe.js +0 -1
  370. package/dist/assets/plugin-charts-BxPL3e--.js +0 -9
  371. package/dist/assets/plugin-kanban-Cy0iBS_w.js +0 -0
  372. package/dist/assets/plugins-views-CIpa21Ck.js +0 -58
  373. package/dist/assets/rolldown-runtime-aKtaBQYM.js +0 -1
  374. package/dist/assets/vendor-react-BnXfQgq5.js +0 -9
  375. /package/dist/assets/{app-shell-DnNKJB60.css → plugin-dashboard-DnNKJB60.css} +0 -0
@@ -1,4 +1,4 @@
1
- import{t as e}from"./rolldown-runtime-aKtaBQYM.js";var t=e(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.maplibregl=r())})(e,(function(){var e={},t={};function n(n,r,i){if(t[n]=i,n===`index`){var a=`var sharedModule = {}; (`+t.shared+`)(sharedModule); (`+t.worker+`)(sharedModule);`,o={};return t.shared(o),t.index(e,o),typeof window<`u`&&e.setWorkerUrl(window.URL.createObjectURL(new Blob([a],{type:`text/javascript`}))),e}}return n(`shared`,[`exports`],(function(e){function t(e,t,n,r){return new(n||=Promise)((function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((r=r.apply(e,t||[])).next())}))}function n(e,t){this.x=e,this.y=t}function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var i,a;n.prototype={clone(){return new n(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){let t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){let t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){let e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){let t=Math.cos(e),n=Math.sin(e),r=n*this.x+t*this.y;return this.x=t*this.x-n*this.y,this.y=r,this},_rotateAround(e,t){let n=Math.cos(e),r=Math.sin(e),i=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=t.x+n*(this.x-t.x)-r*(this.y-t.y),this.y=i,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:n},n.convert=function(e){if(e instanceof n)return e;if(Array.isArray(e))return new n(+e[0],+e[1]);if(e.x!==void 0&&e.y!==void 0)return new n(+e.x,+e.y);throw Error(`Expected [x, y] or {x, y} point format`)};var o=r(function(){if(a)return i;function e(e,t,n,r){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=r}return a=1,i=e,e.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,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,r=0;r<8;r++){var i=this.sampleCurveX(n)-e;if(Math.abs(i)<t)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n-=i/a}var o=0,s=1;for(n=e,r=0;r<20&&(i=this.sampleCurveX(n),!(Math.abs(i-e)<t));r++)e>i?o=n:s=n,n=.5*(s-o)+o;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},i}());let s,c;function l(){return s??=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)&&typeof createImageBitmap==`function`,s}function u(){if(c==null&&(c=!1,l())){let e=new OffscreenCanvas(5,5).getContext(`2d`,{willReadFrequently:!0});if(e){for(let t=0;t<25;t++){let n=4*t;e.fillStyle=`rgb(${n},${n+1},${n+2})`,e.fillRect(t%5,Math.floor(t/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let e=0;e<100;e++)if(e%4!=3&&t[e]!==e){c=!0;break}}}return c||!1}var d=1e-6,f=typeof Float32Array<`u`?Float32Array:Array;function p(){var e=new f(9);return f!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function m(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function h(){var e=new f(3);return f!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function g(e){var t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function _(e,t,n){var r=new f(3);return r[0]=e,r[1]=t,r[2]=n,r}function v(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function y(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function b(e,t,n){var r=t[0],i=t[1],a=t[2],o=n[0],s=n[1],c=n[2];return e[0]=i*c-a*s,e[1]=a*o-r*c,e[2]=r*s-i*o,e}var x,S=g;function C(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3];return e[0]=n[0]*r+n[4]*i+n[8]*a+n[12]*o,e[1]=n[1]*r+n[5]*i+n[9]*a+n[13]*o,e[2]=n[2]*r+n[6]*i+n[10]*a+n[14]*o,e[3]=n[3]*r+n[7]*i+n[11]*a+n[15]*o,e}function w(){var e=new f(4);return f!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function T(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:`zyx`,a=Math.PI/360;t*=a,r*=a,n*=a;var o=Math.sin(t),s=Math.cos(t),c=Math.sin(n),l=Math.cos(n),u=Math.sin(r),d=Math.cos(r);switch(i){case`xyz`:e[0]=o*l*d+s*c*u,e[1]=s*c*d-o*l*u,e[2]=s*l*u+o*c*d,e[3]=s*l*d-o*c*u;break;case`xzy`:e[0]=o*l*d-s*c*u,e[1]=s*c*d-o*l*u,e[2]=s*l*u+o*c*d,e[3]=s*l*d+o*c*u;break;case`yxz`:e[0]=o*l*d+s*c*u,e[1]=s*c*d-o*l*u,e[2]=s*l*u-o*c*d,e[3]=s*l*d+o*c*u;break;case`yzx`:e[0]=o*l*d+s*c*u,e[1]=s*c*d+o*l*u,e[2]=s*l*u-o*c*d,e[3]=s*l*d-o*c*u;break;case`zxy`:e[0]=o*l*d-s*c*u,e[1]=s*c*d+o*l*u,e[2]=s*l*u+o*c*d,e[3]=s*l*d-o*c*u;break;case`zyx`:e[0]=o*l*d-s*c*u,e[1]=s*c*d+o*l*u,e[2]=s*l*u-o*c*d,e[3]=s*l*d+o*c*u;break;default:throw Error(`Unknown angle order `+i)}return e}function E(){var e=new f(2);return f!=Float32Array&&(e[0]=0,e[1]=0),e}function D(e,t){var n=new f(2);return n[0]=e,n[1]=t,n}h(),x=new f(4),f!=Float32Array&&(x[0]=0,x[1]=0,x[2]=0,x[3]=0),h(),_(1,0,0),_(0,1,0),w(),w(),p(),E();let O=8192;function k(e,t,n){return t*(O/(e.tileSize*2**(n-e.tileID.overscaledZ)))}function A(e){return e instanceof Error?e:Error(typeof e==`string`?e:String(e))}function ee(e,t){return(e%t+t)%t}function te(e,t,n){return e*(1-n)+t*n}function j(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}function ne(e,t,n,r){let i=new o(e,t,n,r);return e=>i.solve(e)}let re=ne(.25,.1,.25,1);function ie(e,t,n){return Math.min(n,Math.max(t,e))}function ae(e,t,n){let r=n-t,i=((e-t)%r+r)%r+t;return i===t?n:i}function oe(e,...t){for(let n of t)for(let t in n)e[t]=n[t];return e}let se=1;function ce(e,t,n){let r={};for(let n in e)r[n]=t.call(this,e[n],n,e);return r}function le(e,t,n){let r={};for(let n in e)t.call(this,e[n],n,e)&&(r[n]=e[n]);return r}function M(e){return Array.isArray(e)?e.map(M):typeof e==`object`&&e?ce(e,M):e}let ue={};function de(e){ue[e]||(typeof console<`u`&&console.warn(e),ue[e]=!0)}function fe(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}function pe(e){return typeof WorkerGlobalScope<`u`&&e!==void 0&&e instanceof WorkerGlobalScope}let me=null;function he(e){return typeof ImageBitmap<`u`&&e instanceof ImageBitmap}let ge=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=`;function _e(e,n,r,i,a){return t(this,void 0,void 0,(function*(){if(typeof VideoFrame>`u`)throw Error(`VideoFrame not supported`);let t=new VideoFrame(e,{timestamp:0});try{let o=t?.format;if(!o||!o.startsWith(`BGR`)&&!o.startsWith(`RGB`))throw Error(`Unrecognized format ${o}`);let s=o.startsWith(`BGR`),c=new Uint8ClampedArray(i*a*4);if(yield t.copyTo(c,function(e,t,n,r,i){let a=4*Math.max(-t,0),o=(Math.max(0,n)-n)*r*4+a,s=4*r,c=Math.max(0,t),l=Math.max(0,n);return{rect:{x:c,y:l,width:Math.min(e.width,t+r)-c,height:Math.min(e.height,n+i)-l},layout:[{offset:o,stride:s}]}}(e,n,r,i,a)),s)for(let e=0;e<c.length;e+=4){let t=c[e];c[e]=c[e+2],c[e+2]=t}return c}finally{t.close()}}))}let ve,ye;function be(e,t,n,r){return e.addEventListener(t,n,r),{unsubscribe:()=>{e.removeEventListener(t,n,r)}}}function xe(e){return e*Math.PI/180}function Se(e){return e/Math.PI*180}let Ce={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},we={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},Te=`AbortError`;class Ee extends Error{constructor(e=Te){super(e instanceof Error?e.message:e),this.name=Te,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function De(e){return e instanceof Error&&e.name===Te}function Oe(e){if(e.aborted)throw new Ee(e.reason)}let ke={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:``};function Ae(e){return ke.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf(`://`))]}let je=`global-dispatcher`;class Me extends Error{constructor(e,t,n,r){super(`AJAXError: ${t} (${e}): ${n}`),this.status=e,this.statusText=t,this.url=n,this.body=r}}let Ne=()=>pe(self)?self.worker?.referrer:(window.location.protocol===`blob:`?window.parent:window).location.href,Pe=function(e,n){return t(this,void 0,void 0,(function*(){if(e.url.includes(`://`)&&!/^https?:|^file:/.test(e.url)){let t=Ae(e.url);if(t){let r=yield t(e,n);return r.data||e.type!==`arrayBuffer`?r:oe(r,{data:new ArrayBuffer(0)})}if(pe(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:`GR`,data:e,targetMapId:je},n)}if(!(e=>e.startsWith(`file:`)||Ne()?.startsWith(`file:`)&&!/^\w+:/.test(e))(e.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,`signal`))return function(e,n){return t(this,void 0,void 0,(function*(){let t=new Request(e.url,{method:e.method||`GET`,body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:Ne(),referrerPolicy:e.referrerPolicy,signal:n.signal}),r,i;e.type!==`json`||t.headers.has(`Accept`)||t.headers.set(`Accept`,`application/json`);try{r=yield fetch(t)}catch(t){throw De(t)?t:new Me(0,A(t).message,e.url,new Blob)}if(!r.ok){let t=yield r.blob();throw new Me(r.status,r.statusText,e.url,t)}i=e.type===`arrayBuffer`||e.type===`image`?r.arrayBuffer():e.type===`json`?r.json():r.text();let a=yield i;return Oe(n.signal),{data:a,cacheControl:r.headers.get(`Cache-Control`),expires:r.headers.get(`Expires`),etag:r.headers.get(`ETag`)}}))}(e,n);if(pe(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:`GR`,data:e,mustQueue:!0,targetMapId:je},n)}return function(e,t){return new Promise(((n,r)=>{var i;let a=new XMLHttpRequest;a.open(e.method||`GET`,e.url,!0),e.type!==`arrayBuffer`&&e.type!==`image`||(a.responseType=`arraybuffer`);for(let t in e.headers)a.setRequestHeader(t,e.headers[t]);e.type===`json`&&(a.responseType=`text`,(i=e.headers)!=null&&i.Accept||a.setRequestHeader(`Accept`,`application/json`)),a.withCredentials=e.credentials===`include`,a.onerror=()=>{r(Error(a.statusText))},a.onload=()=>{if(!t.signal.aborted)if((a.status>=200&&a.status<300||a.status===0)&&a.response!==null){let t=a.response;if(e.type===`json`)try{t=JSON.parse(a.response)}catch(e){r(e);return}n({data:t,cacheControl:a.getResponseHeader(`Cache-Control`),expires:a.getResponseHeader(`Expires`),etag:a.getResponseHeader(`ETag`)})}else{let t=new Blob([a.response],{type:a.getResponseHeader(`Content-Type`)});r(new Me(a.status,a.statusText,e.url,t))}},t.signal.addEventListener(`abort`,(()=>{a.abort(),r(new Ee(t.signal.reason))})),a.send(e.body)}))}(e,n)}))};function Fe(e){if(!e||e.indexOf(`://`)<=0||e.startsWith(`data:image/`)||e.startsWith(`blob:`))return!0;let t=new URL(e),n=window.location;return t.protocol===n.protocol&&t.host===n.host}function Ie(e,t,n){var r;(r=n[e])!=null&&r.includes(t)||(n[e]||(n[e]=[]),n[e].push(t))}function Le(e,t,n){if(n?.[e]){let r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}class Re{constructor(e,t={}){oe(this,t),this.type=e}}class ze extends Re{constructor(e,t={}){super(`error`,oe({error:e},t))}}class Be{on(e,t){return this._listeners||={},Ie(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return Le(e,t,this._listeners),Le(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners||={},Ie(e,t,this._oneTimeListeners),this):new Promise((t=>this.once(e,t)))}fire(e,t){typeof e==`string`&&(e=new Re(e,t||{}));let n=e.type;if(this.listens(n)){e.target=this;let t=this._listeners?.[n]?this._listeners[n].slice():[];for(let n of t)n.call(this,e);let r=this._oneTimeListeners?.[n]?this._oneTimeListeners[n].slice():[];for(let t of r)Le(n,t,this._oneTimeListeners),t.call(this,e);let i=this._eventedParent;i&&(oe(e,typeof this._eventedParentData==`function`?this._eventedParentData():this._eventedParentData),i.fire(e))}else e instanceof ze&&console.error(e.error);return this}listens(e){return this._listeners?.[e]?.length>0||this._oneTimeListeners?.[e]?.length>0||this._eventedParent?.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var N={$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:.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:.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:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},"horizon-fog-blend":{type:`number`,"property-type":`data-constant`,default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},"sky-horizon-blend":{type:`number`,"property-type":`data-constant`,default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},"atmosphere-blend":{type:`number`,"property-type":`data-constant`,default:.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)`,.1,`royalblue`,.3,`cyan`,.5,`lime`,.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:.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 Ve=[`type`,`source`,`source-layer`,`minzoom`,`maxzoom`,`filter`,`layout`];function He(e,t){let n={};for(let t in e)t!==`ref`&&(n[t]=e[t]);return Ve.forEach((e=>{e in t&&(n[e]=t[e])})),n}function P(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!P(e[n],t[n]))return!1;return!0}if(typeof e==`object`&&e&&t!==null){if(typeof t!=`object`||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(!P(e[n],t[n]))return!1;return!0}return e===t}function Ue(e,t){e.push(t)}function We(e,t,n){Ue(n,{command:`addSource`,args:[e,t[e]]})}function Ge(e,t,n){Ue(t,{command:`removeSource`,args:[e]}),n[e]=!0}function Ke(e,t,n,r){Ge(e,n,r),We(e,t,n)}function qe(e,t,n){let r;for(r in e[n])if(Object.prototype.hasOwnProperty.call(e[n],r)&&r!==`data`&&!P(e[n][r],t[n][r]))return!1;for(r in t[n])if(Object.prototype.hasOwnProperty.call(t[n],r)&&r!==`data`&&!P(e[n][r],t[n][r]))return!1;return!0}function Je(e,t,n,r,i,a){e||={},t||={};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(P(e[o],t[o])||n.push({command:a,args:[r,o,t[o],i]}));for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&!Object.prototype.hasOwnProperty.call(e,o)&&(P(e[o],t[o])||n.push({command:a,args:[r,o,t[o],i]}))}function Ye(e){return e.id}function Xe(e,t){return e[t.id]=t,e}class F{constructor(e,t,n,r){this.message=(e?`${e}: `:``)+n,r&&(this.identifier=r),t!=null&&t.__line__&&(this.line=t.__line__)}}function Ze(e,...t){for(let n of t)for(let t in n)e[t]=n[t];return e}class Qe extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class $e{constructor(e,t=[]){this.parent=e,this.bindings={};for(let[e,n]of t)this.bindings[e]=n}concat(e){return new $e(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}let et={kind:`null`},I={kind:`number`},L={kind:`string`},R={kind:`boolean`},tt={kind:`color`},nt={kind:`projectionDefinition`},rt={kind:`object`},z={kind:`value`},it={kind:`collator`},at={kind:`formatted`},ot={kind:`padding`},st={kind:`colorArray`},ct={kind:`numberArray`},lt={kind:`resolvedImage`},ut={kind:`variableAnchorOffsetCollection`};function dt(e,t){return{kind:`array`,itemType:e,N:t}}function B(e){if(e.kind===`array`){let t=B(e.itemType);return typeof e.N==`number`?`array<${t}, ${e.N}>`:e.itemType.kind===`value`?`array`:`array<${t}>`}return e.kind}let ft=[et,I,L,R,tt,nt,at,rt,dt(z),ot,ct,st,lt,ut];function pt(e,t){if(t.kind===`error`)return null;if(e.kind===`array`){if(t.kind===`array`&&(t.N===0&&t.itemType.kind===`value`||!pt(e.itemType,t.itemType))&&(typeof e.N!=`number`||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if(e.kind===`value`){for(let e of ft)if(!pt(e,t))return null}}return`Expected ${B(e)} but found ${B(t)} instead.`}function mt(e,t){return t.some((t=>t.kind===e.kind))}function ht(e,t){return t.some((t=>t===`null`?e===null:t===`array`?Array.isArray(e):t===`object`?e&&!Array.isArray(e)&&typeof e==`object`:t===typeof e))}function gt(e,t){return e.kind===`array`&&t.kind===`array`?e.itemType.kind===t.itemType.kind&&typeof e.N==`number`:e.kind===t.kind}let _t=.96422,vt=.82521,yt=4/29,bt=6/29,xt=3*bt*bt,St=Math.PI/180,Ct=180/Math.PI;function wt(e){return(e%=360)<0&&(e+=360),e}function Tt([e,t,n,r]){let i,a,o=Dt((.2225045*(e=Et(e))+.7168786*(t=Et(t))+.0606169*(n=Et(n)))/1);e===t&&t===n?i=a=o:(i=Dt((.4360747*e+.3850649*t+.1430804*n)/_t),a=Dt((.0139322*e+.0971045*t+.7141733*n)/vt));let s=116*o-16;return[s<0?0:s,500*(i-o),200*(o-a),r]}function Et(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Dt(e){return e>.008856451679035631?e**(1/3):e/xt+yt}function Ot([e,t,n,r]){let i=(e+16)/116,a=isNaN(t)?i:i+t/500,o=isNaN(n)?i:i-n/200;return i=1*At(i),a=_t*At(a),o=vt*At(o),[kt(3.1338561*a-1.6168667*i-.4906146*o),kt(-.9787684*a+1.9161415*i+.033454*o),kt(.0719453*a-.2289914*i+1.4052427*o),r]}function kt(e){return(e=e<=.00304?12.92*e:1.055*e**(1/2.4)-.055)<0?0:e>1?1:e}function At(e){return e>bt?e*e*e:xt*(e-yt)}let jt=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function Mt(e,t){return jt(e,t)?e[t]:void 0}function Nt(e){return parseInt(e.padEnd(2,e),16)/255}function Pt(e,t){return Ft(t?e/100:e,0,1)}function Ft(e,t,n){return Math.min(Math.max(t,e),n)}function It(e){return!e.some(Number.isNaN)}let Lt={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 Rt(e,t,n){return e+n*(t-e)}function zt(e,t,n){return e.map(((e,r)=>Rt(e,t[r],n)))}class V{constructor(e,t,n,r=1,i=!0){this.r=e,this.g=t,this.b=n,this.a=r,i||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter(`rgb`,[e,t,n,r]))}static parse(e){if(e instanceof V)return e;if(typeof e!=`string`)return;let t=function(e){if((e=e.toLowerCase().trim())===`transparent`)return[0,0,0,0];let t=Mt(Lt,e);if(t){let[e,n,r]=t;return[e/255,n/255,r/255,1]}if(e.startsWith(`#`)&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let t=e.length<6?1:2,n=1;return[Nt(e.slice(n,n+=t)),Nt(e.slice(n,n+=t)),Nt(e.slice(n,n+=t)),Nt(e.slice(n,n+t)||`ff`)]}if(e.startsWith(`rgb`)){let t=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){let[e,n,r,i,a,o,s,c,l,u,d,f]=t,p=[i||` `,s||` `,u].join(``);if(p===` `||p===` /`||p===`,,`||p===`,,,`){let e=[r,o,l].join(``),t=e===`%%%`?100:e===``?255:0;if(t){let e=[Ft(+n/t,0,1),Ft(+a/t,0,1),Ft(+c/t,0,1),d?Pt(+d,f):1];if(It(e))return e}}return}}let n=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){let[e,t,r,i,a,o,s,c,l]=n,u=[r||` `,a||` `,s].join(``);if(u===` `||u===` /`||u===`,,`||u===`,,,`){let e=[+t,Ft(+i,0,100),Ft(+o,0,100),c?Pt(+c,l):1];if(It(e))return function([e,t,n,r]){function i(r){let i=(r+e/30)%12,a=t*Math.min(n,1-n);return n-a*Math.max(-1,Math.min(i-3,9-i,1))}return e=wt(e),t/=100,n/=100,[i(0),i(8),i(4),r]}(e)}}}(e);return t?new V(...t,!1):void 0}get rgb(){let{r:e,g:t,b:n,a:r}=this,i=r||1/0;return this.overwriteGetter(`rgb`,[e/i,t/i,n/i,r])}get hcl(){return this.overwriteGetter(`hcl`,function(e){let[t,n,r,i]=Tt(e),a=Math.sqrt(n*n+r*r);return[Math.round(1e4*a)?wt(Math.atan2(r,n)*Ct):NaN,a,t,i]}(this.rgb))}get lab(){return this.overwriteGetter(`lab`,Tt(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){let[e,t,n,r]=this.rgb;return`rgba(${[e,t,n].map((e=>Math.round(255*e))).join(`,`)},${r})`}static interpolate(e,t,n,r=`rgb`){switch(r){case`rgb`:{let[r,i,a,o]=zt(e.rgb,t.rgb,n);return new V(r,i,a,o,!1)}case`hcl`:{let[r,i,a,o]=e.hcl,[s,c,l,u]=t.hcl,d,f;if(isNaN(r)||isNaN(s))isNaN(r)?isNaN(s)?d=NaN:(d=s,a!==1&&a!==0||(f=c)):(d=r,l!==1&&l!==0||(f=i));else{let e=s-r;s>r&&e>180?e-=360:s<r&&r-s>180&&(e+=360),d=r+n*e}let[p,m,h,g]=function([e,t,n,r]){return e=isNaN(e)?0:e*St,Ot([n,Math.cos(e)*t,Math.sin(e)*t,r])}([d,f??Rt(i,c,n),Rt(a,l,n),Rt(o,u,n)]);return new V(p,m,h,g,!1)}case`lab`:{let[r,i,a,o]=Ot(zt(e.lab,t.lab,n));return new V(r,i,a,o,!1)}}}}V.black=new V(0,0,0,1),V.white=new V(1,1,1,1),V.transparent=new V(0,0,0,0),V.red=new V(1,0,0,1);class Bt{constructor(e,t,n){this.sensitivity=e?t?`variant`:`case`:t?`accent`:`base`,this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:`search`})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}let Vt=[`bottom`,`center`,`top`];class Ht{constructor(e,t,n,r,i,a){this.text=e,this.image=t,this.scale=n,this.fontStack=r,this.textColor=i,this.verticalAlign=a}}class H{constructor(e){this.sections=e}static fromString(e){return new H([new Ht(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((e=>e.text.length!==0||e.image&&e.image.name.length!==0))}static factory(e){return e instanceof H?e:H.fromString(e)}toString(){return this.sections.length===0?``:this.sections.map((e=>e.text)).join(``)}}class Ut{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ut)return e;if(typeof e==`number`)return new Ut([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let t of e)if(typeof t!=`number`)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Ut(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new Ut(zt(e.values,t.values,n))}}class Wt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Wt)return e;if(typeof e==`number`)return new Wt([e]);if(Array.isArray(e)){for(let t of e)if(typeof t!=`number`)return;return new Wt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new Wt(zt(e.values,t.values,n))}}class Gt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Gt)return e;if(typeof e==`string`){let t=V.parse(e);return t?new Gt([t]):void 0}if(!Array.isArray(e))return;let t=[];for(let n of e){if(typeof n!=`string`)return;let e=V.parse(n);if(!e)return;t.push(e)}return new Gt(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n,r=`rgb`){let i=[];if(e.values.length!=t.values.length)throw Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let a=0;a<e.values.length;a++)i.push(V.interpolate(e.values[a],t.values[a],n,r));return new Gt(i)}}class Kt extends Error{constructor(e){super(e),this.name=`RuntimeError`}toJSON(){return this.message}}let qt=new Set([`center`,`left`,`right`,`top`,`bottom`,`top-left`,`top-right`,`bottom-left`,`bottom-right`]);class Jt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Jt)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t<e.length;t+=2){let n=e[t],r=e[t+1];if(typeof n!=`string`||!qt.has(n)||!Array.isArray(r)||r.length!==2||typeof r[0]!=`number`||typeof r[1]!=`number`)return}return new Jt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){let r=e.values,i=t.values;if(r.length!==i.length)throw new Kt(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);let a=[];for(let e=0;e<r.length;e+=2){if(r[e]!==i[e])throw new Kt(`Cannot interpolate values containing mismatched anchors. from[${e}]: ${r[e]}, to[${e}]: ${i[e]}`);a.push(r[e]);let[t,o]=r[e+1],[s,c]=i[e+1];a.push([Rt(t,s,n),Rt(o,c,n)])}return new Jt(a)}}class Yt{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Yt({name:e,available:!1}):null}}class Xt{constructor(e,t,n){this.from=e,this.to=t,this.transition=n}static interpolate(e,t,n){return new Xt(e,t,n)}static parse(e){return e instanceof Xt?e:Array.isArray(e)&&e.length===3&&typeof e[0]==`string`&&typeof e[1]==`string`&&typeof e[2]==`number`?new Xt(e[0],e[1],e[2]):typeof e==`object`&&typeof e.from==`string`&&typeof e.to==`string`&&typeof e.transition==`number`?new Xt(e.from,e.to,e.transition):typeof e==`string`?new Xt(e,e,1):void 0}}function Zt(e,t,n,r){return typeof e==`number`&&e>=0&&e<=255&&typeof t==`number`&&t>=0&&t<=255&&typeof n==`number`&&n>=0&&n<=255?r===void 0||typeof r==`number`&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,n,r].join(`, `)}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof r==`number`?[e,t,n,r]:[e,t,n]).join(`, `)}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Qt(e){if(e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`||e instanceof Xt||e instanceof V||e instanceof Bt||e instanceof H||e instanceof Ut||e instanceof Wt||e instanceof Gt||e instanceof Jt||e instanceof Yt)return!0;if(Array.isArray(e)){for(let t of e)if(!Qt(t))return!1;return!0}if(typeof e==`object`){for(let t in e)if(!Qt(e[t]))return!1;return!0}return!1}function $t(e){if(e===null)return et;if(typeof e==`string`)return L;if(typeof e==`boolean`)return R;if(typeof e==`number`)return I;if(e instanceof V)return tt;if(e instanceof Xt)return nt;if(e instanceof Bt)return it;if(e instanceof H)return at;if(e instanceof Ut)return ot;if(e instanceof Wt)return ct;if(e instanceof Gt)return st;if(e instanceof Jt)return ut;if(e instanceof Yt)return lt;if(Array.isArray(e)){let t=e.length,n;for(let t of e){let e=$t(t);if(n){if(n===e)continue;n=z;break}n=e}return dt(n||z,t)}return rt}function en(e){let t=typeof e;return e===null?``:t===`string`||t===`number`||t===`boolean`?String(e):e instanceof V||e instanceof Xt||e instanceof H||e instanceof Ut||e instanceof Wt||e instanceof Gt||e instanceof Jt||e instanceof Yt?e.toString():JSON.stringify(e)}class tn{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Qt(e[1]))return t.error(`invalid value`);let n=e[1],r=$t(n),i=t.expectedType;return r.kind!==`array`||r.N!==0||!i||i.kind!==`array`||typeof i.N==`number`&&i.N!==0||(r=i),new tn(r,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}let nn={string:L,number:I,boolean:R,object:rt};class rn{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n,r=1,i=e[0];if(i===`array`){let i,a;if(e.length>2){let n=e[1];if(typeof n!=`string`||!(n in nn)||n===`object`)return t.error(`The item type argument of "array" must be one of string, number, boolean`,1);i=nn[n],r++}else i=z;if(e.length>3){if(e[2]!==null&&(typeof e[2]!=`number`||e[2]<0||e[2]!==Math.floor(e[2])))return t.error(`The length argument to "array" must be a positive integer literal`,2);a=e[2],r++}n=dt(i,a)}else{if(!nn[i])throw Error(`Types doesn't contain name = ${i}`);n=nn[i]}let a=[];for(;r<e.length;r++){let n=t.parse(e[r],r,z);if(!n)return null;a.push(n)}return new rn(n,a)}evaluate(e){for(let t=0;t<this.args.length;t++){let n=this.args[t].evaluate(e);if(!pt(this.type,$t(n)))return n;if(t===this.args.length-1)throw new Kt(`Expected value to be of type ${B(this.type)}, but found ${B($t(n))} instead.`)}throw Error()}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}let an={"to-boolean":R,"to-color":tt,"to-number":I,"to-string":L};class on{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n=e[0];if(!an[n])throw Error(`Can't parse ${n} as it is not part of the known types`);if((n===`to-boolean`||n===`to-string`)&&e.length!==2)return t.error(`Expected one argument.`);let r=an[n],i=[];for(let n=1;n<e.length;n++){let r=t.parse(e[n],n,z);if(!r)return null;i.push(r)}return new on(r,i)}evaluate(e){switch(this.type.kind){case`boolean`:return!!this.args[0].evaluate(e);case`color`:{let t,n;for(let r of this.args){if(t=r.evaluate(e),n=null,t instanceof V)return t;if(typeof t==`string`){let n=e.parseColor(t);if(n)return n}else if(Array.isArray(t)&&(n=t.length<3||t.length>4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Zt(t[0],t[1],t[2],t[3]),!n))return new V(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Kt(n||`Could not parse color from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`padding`:{let t;for(let n of this.args){t=n.evaluate(e);let r=Ut.parse(t);if(r)return r}throw new Kt(`Could not parse padding from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`numberArray`:{let t;for(let n of this.args){t=n.evaluate(e);let r=Wt.parse(t);if(r)return r}throw new Kt(`Could not parse numberArray from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`colorArray`:{let t;for(let n of this.args){t=n.evaluate(e);let r=Gt.parse(t);if(r)return r}throw new Kt(`Could not parse colorArray from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`variableAnchorOffsetCollection`:{let t;for(let n of this.args){t=n.evaluate(e);let r=Jt.parse(t);if(r)return r}throw new Kt(`Could not parse variableAnchorOffsetCollection from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`number`:{let t=null;for(let n of this.args){if(t=n.evaluate(e),t===null)return 0;let r=Number(t);if(!isNaN(r))return r}throw new Kt(`Could not convert ${JSON.stringify(t)} to number.`)}case`formatted`:return H.fromString(en(this.args[0].evaluate(e)));case`resolvedImage`:return Yt.fromString(en(this.args[0].evaluate(e)));case`projectionDefinition`:return this.args[0].evaluate(e);default:return en(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}let sn=[`Unknown`,`Point`,`LineString`,`Polygon`];class cn{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`?sn[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(e){let t=this._parseColorCache.get(e);return t||(t=V.parse(e),this._parseColorCache.set(e,t)),t}}class U{constructor(e,t,n=[],r,i=new $e,a=[]){this.registry=e,this.path=n,this.key=n.map((e=>`[${e}]`)).join(``),this.scope=i,this.errors=a,this.expectedType=r,this._isConstant=t}parse(e,t,n,r,i={}){return t?this.concat(t,n,r)._parse(e,i):this._parse(e,i)}_parse(e,t){function n(e,t,n){return n===`assert`?new rn(t,[e]):n===`coerce`?new on(t,[e]):e}if(e!==null&&typeof e!=`string`&&typeof e!=`boolean`&&typeof e!=`number`||(e=[`literal`,e]),Array.isArray(e)){if(e.length===0)return this.error(`Expected an array with at least one element. If you wanted a literal array, use ["literal", []].`);let r=e[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 i=this.registry[r];if(i){let r=i.parse(e,this);if(!r)return null;if(this.expectedType){let e=this.expectedType,i=r.type;if(e.kind!==`string`&&e.kind!==`number`&&e.kind!==`boolean`&&e.kind!==`object`&&e.kind!==`array`||i.kind!==`value`){if(e.kind===`projectionDefinition`&&[`string`,`array`].includes(i.kind)||[`color`,`formatted`,`resolvedImage`].includes(e.kind)&&[`value`,`string`].includes(i.kind)||[`padding`,`numberArray`].includes(e.kind)&&[`value`,`number`,`array`].includes(i.kind)||e.kind===`colorArray`&&[`value`,`string`,`array`].includes(i.kind)||e.kind===`variableAnchorOffsetCollection`&&[`value`,`array`].includes(i.kind))r=n(r,e,t.typeAnnotation||`coerce`);else if(this.checkSubtype(e,i))return null}else r=n(r,e,t.typeAnnotation||`assert`)}if(!(r instanceof tn)&&r.type.kind!==`resolvedImage`&&this._isConstant(r)){let e=new cn;try{r=new tn(r.type,r.evaluate(e))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?`'undefined' value invalid. Use null instead.`:typeof e==`object`?`Bare objects invalid. Use ["literal", {...}] instead.`:`Expected an array, but found ${typeof e} instead.`)}concat(e,t,n){let r=typeof e==`number`?this.path.concat(e):this.path,i=n?this.scope.concat(n):this.scope;return new U(this.registry,this._isConstant,r,t||null,i,this.errors)}error(e,...t){let n=`${this.key}${t.map((e=>`[${e}]`)).join(``)}`;this.errors.push(new Qe(n,e))}checkSubtype(e,t){let n=pt(e,t);return n&&this.error(n),n}}class W{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let n=[];for(let r=1;r<e.length-1;r+=2){let i=e[r];if(typeof i!=`string`)return t.error(`Expected string, but found ${typeof i} instead.`,r);if(/[^a-zA-Z0-9_]/.test(i))return t.error(`Variable names must contain only alphanumeric characters or '_'.`,r);let a=t.parse(e[r+1],r+1);if(!a)return null;n.push([i,a])}let r=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return r?new W(n,r):null}outputDefined(){return this.result.outputDefined()}}class ln{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!=`string`)return t.error(`'var' expression requires exactly one string literal argument.`);let n=e[1];return t.scope.has(n)?new ln(n,t.scope.get(n)):t.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class G{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,I),r=t.parse(e[2],2,dt(t.expectedType||z));return n&&r?new G(r.type.itemType,n,r):null}evaluate(e){let t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new Kt(`Array index out of bounds: ${t} < 0.`);if(t>=n.length)throw new Kt(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new Kt(`Array index must be an integer, but found ${t} instead.`);return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class un{constructor(e,t){this.type=R,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,z),r=t.parse(e[2],2,z);return n&&r?mt(n.type,[R,L,I,et,z])?new un(n,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${B(n.type)} instead`):null}evaluate(e){let t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!ht(t,[`boolean`,`string`,`number`,`null`]))throw new Kt(`Expected first argument to be of type boolean, string, number or null, but found ${B($t(t))} instead.`);if(!ht(n,[`string`,`array`]))throw new Kt(`Expected second argument to be of type array or string, but found ${B($t(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class dn{constructor(e,t,n){this.type=I,this.needle=e,this.haystack=t,this.fromIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,z),r=t.parse(e[2],2,z);if(!n||!r)return null;if(!mt(n.type,[R,L,I,et,z]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${B(n.type)} instead`);if(e.length===4){let i=t.parse(e[3],3,I);return i?new dn(n,r,i):null}return new dn(n,r)}evaluate(e){let t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!ht(t,[`boolean`,`string`,`number`,`null`]))throw new Kt(`Expected first argument to be of type boolean, string, number or null, but found ${B($t(t))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(e)),ht(n,[`string`])){let e=n.indexOf(t,r);return e===-1?-1:[...n.slice(0,e)].length}if(ht(n,[`array`]))return n.indexOf(t,r);throw new Kt(`Expected second argument to be of type array or string, but found ${B($t(n))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class fn{constructor(e,t,n,r,i,a){this.inputType=e,this.type=t,this.input=n,this.cases=r,this.outputs=i,this.otherwise=a}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error(`Expected an even number of arguments.`);let n,r;t.expectedType&&t.expectedType.kind!==`value`&&(r=t.expectedType);let i={},a=[];for(let o=2;o<e.length-1;o+=2){let s=e[o],c=e[o+1];Array.isArray(s)||(s=[s]);let l=t.concat(o);if(s.length===0)return l.error(`Expected at least one branch label.`);for(let e of s){if(typeof e!=`number`&&typeof e!=`string`)return l.error(`Branch labels must be numbers or strings.`);if(typeof e==`number`&&Math.abs(e)>2**53-1)return l.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof e==`number`&&Math.floor(e)!==e)return l.error(`Numeric branch labels must be integer values.`);if(n){if(l.checkSubtype(n,$t(e)))return null}else n=$t(e);if(i[String(e)]!==void 0)return l.error(`Branch labels must be unique.`);i[String(e)]=a.length}let u=t.parse(c,o,r);if(!u)return null;r||=u.type,a.push(u)}let o=t.parse(e[1],1,z);if(!o)return null;let s=t.parse(e[e.length-1],e.length-1,r);return s?o.type.kind!==`value`&&t.concat(1).checkSubtype(n,o.type)?null:new fn(n,r,o,i,a,s):null}evaluate(e){let t=this.input.evaluate(e);return($t(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}}class pn{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error(`Expected an odd number of arguments.`);let n;t.expectedType&&t.expectedType.kind!==`value`&&(n=t.expectedType);let r=[];for(let i=1;i<e.length-1;i+=2){let a=t.parse(e[i],i,R);if(!a)return null;let o=t.parse(e[i+1],i+1,n);if(!o)return null;r.push([a,o]),n||=o.type}let i=t.parse(e[e.length-1],e.length-1,n);if(!i)return null;if(!n)throw Error(`Can't infer output type`);return new pn(n,r,i)}evaluate(e){for(let[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every((([e,t])=>t.outputDefined()))&&this.otherwise.outputDefined()}}class mn{constructor(e,t,n,r){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,z),r=t.parse(e[2],2,I);if(!n||!r)return null;if(!mt(n.type,[dt(z),L,z]))return t.error(`Expected first argument to be of type array or string, but found ${B(n.type)} instead`);if(e.length===4){let i=t.parse(e[3],3,I);return i?new mn(n.type,n,r,i):null}return new mn(n.type,n,r)}evaluate(e){let t=this.input.evaluate(e),n=this.beginIndex.evaluate(e),r;if(this.endIndex&&(r=this.endIndex.evaluate(e)),ht(t,[`string`]))return[...t].slice(n,r).join(``);if(ht(t,[`array`]))return t.slice(n,r);throw new Kt(`Expected first argument to be of type array or string, but found ${B($t(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function hn(e,t){let n=e.length-1,r,i,a=0,o=n,s=0;for(;a<=o;)if(s=Math.floor((a+o)/2),r=e[s],i=e[s+1],r<=t){if(s===n||t<i)return s;a=s+1}else{if(!(r>t))throw new Kt(`Input is not a number.`);o=s-1}return 0}class gn{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(let[e,t]of n)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error(`Expected an even number of arguments.`);let n=t.parse(e[1],1,I);if(!n)return null;let r=[],i=null;t.expectedType&&t.expectedType.kind!==`value`&&(i=t.expectedType);for(let n=1;n<e.length;n+=2){let a=n===1?-1/0:e[n],o=e[n+1],s=n,c=n+1;if(typeof a!=`number`)return t.error(`Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.`,s);if(r.length&&r[r.length-1][0]>=a)return t.error(`Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.`,s);let l=t.parse(o,c,i);if(!l)return null;i||=l.type,r.push([a,l])}return new gn(i,n,r)}evaluate(e){let t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);let r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);let i=t.length;return r>=t[i-1]?n[i-1].evaluate(e):n[hn(t,r)].evaluate(e)}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function _n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var vn,yn,bn=_n(function(){if(yn)return vn;function e(e,t,n,r){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=r}return yn=1,vn=e,e.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,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,r=0;r<8;r++){var i=this.sampleCurveX(n)-e;if(Math.abs(i)<t)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n-=i/a}var o=0,s=1;for(n=e,r=0;r<20&&(i=this.sampleCurveX(n),!(Math.abs(i-e)<t));r++)e>i?o=n:s=n,n=.5*(s-o)+o;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},vn}());class xn{constructor(e,t,n,r,i){this.type=e,this.operator=t,this.interpolation=n,this.input=r,this.labels=[],this.outputs=[];for(let[e,t]of i)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,n,r){let i=0;if(e.name===`exponential`)i=Sn(t,e.base,n,r);else if(e.name===`linear`)i=Sn(t,1,n,r);else if(e.name===`cubic-bezier`){let a=e.controlPoints;i=new bn(a[0],a[1],a[2],a[3]).solve(Sn(t,1,n,r))}return i}static parse(e,t){let[n,r,i,...a]=e;if(!Array.isArray(r)||r.length===0)return t.error(`Expected an interpolation type expression.`,1);if(r[0]===`linear`)r={name:`linear`};else if(r[0]===`exponential`){let e=r[1];if(typeof e!=`number`)return t.error(`Exponential interpolation requires a numeric base.`,1,1);r={name:`exponential`,base:e}}else{if(r[0]!==`cubic-bezier`)return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{let e=r.slice(1);if(e.length!==4||e.some((e=>typeof e!=`number`||e<0||e>1)))return t.error(`Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.`,1);r={name:`cubic-bezier`,controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error(`Expected an even number of arguments.`);if(i=t.parse(i,2,I),!i)return null;let o=[],s=null;n!==`interpolate-hcl`&&n!==`interpolate-lab`||t.expectedType==st?t.expectedType&&t.expectedType.kind!==`value`&&(s=t.expectedType):s=tt;for(let e=0;e<a.length;e+=2){let n=a[e],r=a[e+1],i=e+3,c=e+4;if(typeof n!=`number`)return t.error(`Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.`,i);if(o.length&&o[o.length-1][0]>=n)return t.error(`Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.`,i);let l=t.parse(r,c,s);if(!l)return null;s||=l.type,o.push([n,l])}return gt(s,I)||gt(s,nt)||gt(s,tt)||gt(s,ot)||gt(s,ct)||gt(s,st)||gt(s,ut)||gt(s,dt(I))?new xn(s,n,r,i,o):t.error(`Type ${B(s)} is not interpolatable.`)}evaluate(e){let t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);let r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);let i=t.length;if(r>=t[i-1])return n[i-1].evaluate(e);let a=hn(t,r),o=xn.interpolationFactor(this.interpolation,r,t[a],t[a+1]),s=n[a].evaluate(e),c=n[a+1].evaluate(e);switch(this.operator){case`interpolate`:switch(this.type.kind){case`number`:return Rt(s,c,o);case`color`:return V.interpolate(s,c,o);case`padding`:return Ut.interpolate(s,c,o);case`colorArray`:return Gt.interpolate(s,c,o);case`numberArray`:return Wt.interpolate(s,c,o);case`variableAnchorOffsetCollection`:return Jt.interpolate(s,c,o);case`array`:return zt(s,c,o);case`projectionDefinition`:return Xt.interpolate(s,c,o)}case`interpolate-hcl`:switch(this.type.kind){case`color`:return V.interpolate(s,c,o,`hcl`);case`colorArray`:return Gt.interpolate(s,c,o,`hcl`)}case`interpolate-lab`:switch(this.type.kind){case`color`:return V.interpolate(s,c,o,`lab`);case`colorArray`:return Gt.interpolate(s,c,o,`lab`)}}}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Sn(e,t,n,r){let i=r-n,a=e-n;return i===0?0:t===1?a/i:(t**+a-1)/(t**+i-1)}let Cn={color:V.interpolate,number:Rt,padding:Ut.interpolate,numberArray:Wt.interpolate,colorArray:Gt.interpolate,variableAnchorOffsetCollection:Jt.interpolate,array:zt};class wn{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n=null,r=t.expectedType;r&&r.kind!==`value`&&(n=r);let i=[];for(let r of e.slice(1)){let e=t.parse(r,1+i.length,n,void 0,{typeAnnotation:`omit`});if(!e)return null;n||=e.type,i.push(e)}if(!n)throw Error(`No output type`);return new wn(r&&i.some((e=>pt(r,e.type)))?z:n,i)}evaluate(e){let t,n=null,r=0;for(let i of this.args)if(r++,n=i.evaluate(e),n&&n instanceof Yt&&!n.available&&(t||=n.name,n=null,r===this.args.length&&(n=t)),n!==null)break;return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function Tn(e,t){return e===`==`||e===`!=`?t.kind===`boolean`||t.kind===`string`||t.kind===`number`||t.kind===`null`||t.kind===`value`:t.kind===`string`||t.kind===`number`||t.kind===`value`}function En(e,t,n,r){return r.compare(t,n)===0}function Dn(e,t,n){let r=e!==`==`&&e!==`!=`;return class i{constructor(e,t,n){this.type=R,this.lhs=e,this.rhs=t,this.collator=n,this.hasUntypedArgument=e.type.kind===`value`||t.type.kind===`value`}static parse(e,t){if(e.length!==3&&e.length!==4)return t.error(`Expected two or three arguments.`);let n=e[0],a=t.parse(e[1],1,z);if(!a)return null;if(!Tn(n,a.type))return t.concat(1).error(`"${n}" comparisons are not supported for type '${B(a.type)}'.`);let o=t.parse(e[2],2,z);if(!o)return null;if(!Tn(n,o.type))return t.concat(2).error(`"${n}" comparisons are not supported for type '${B(o.type)}'.`);if(a.type.kind!==o.type.kind&&a.type.kind!==`value`&&o.type.kind!==`value`)return t.error(`Cannot compare types '${B(a.type)}' and '${B(o.type)}'.`);r&&(a.type.kind===`value`&&o.type.kind!==`value`?a=new rn(o.type,[a]):a.type.kind!==`value`&&o.type.kind===`value`&&(o=new rn(a.type,[o])));let s=null;if(e.length===4){if(a.type.kind!==`string`&&o.type.kind!==`string`&&a.type.kind!==`value`&&o.type.kind!==`value`)return t.error(`Cannot use collator to compare non-string types.`);if(s=t.parse(e[3],3,it),!s)return null}return new i(a,o,s)}evaluate(i){let a=this.lhs.evaluate(i),o=this.rhs.evaluate(i);if(r&&this.hasUntypedArgument){let t=$t(a),n=$t(o);if(t.kind!==n.kind||t.kind!==`string`&&t.kind!==`number`)throw new Kt(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${n.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){let e=$t(a),n=$t(o);if(e.kind!==`string`||n.kind!==`string`)return t(i,a,o)}return this.collator?n(i,a,o,this.collator.evaluate(i)):t(i,a,o)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}let On=Dn(`==`,(function(e,t,n){return t===n}),En),kn=Dn(`!=`,(function(e,t,n){return t!==n}),(function(e,t,n,r){return!En(0,t,n,r)})),An=Dn(`<`,(function(e,t,n){return t<n}),(function(e,t,n,r){return r.compare(t,n)<0})),jn=Dn(`>`,(function(e,t,n){return t>n}),(function(e,t,n,r){return r.compare(t,n)>0})),Mn=Dn(`<=`,(function(e,t,n){return t<=n}),(function(e,t,n,r){return r.compare(t,n)<=0})),Nn=Dn(`>=`,(function(e,t,n){return t>=n}),(function(e,t,n,r){return r.compare(t,n)>=0}));class Pn{constructor(e,t,n){this.type=it,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error(`Expected one argument.`);let n=e[1];if(typeof n!=`object`||Array.isArray(n))return t.error(`Collator options argument must be an object.`);let r=t.parse(n[`case-sensitive`]!==void 0&&n[`case-sensitive`],1,R);if(!r)return null;let i=t.parse(n[`diacritic-sensitive`]!==void 0&&n[`diacritic-sensitive`],1,R);if(!i)return null;let a=null;return n.locale&&(a=t.parse(n.locale,1,L),!a)?null:new Pn(r,i,a)}evaluate(e){return new Bt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class Fn{constructor(e,t,n,r,i,a){this.type=L,this.number=e,this.locale=t,this.currency=n,this.unit=r,this.minFractionDigits=i,this.maxFractionDigits=a}static parse(e,t){if(e.length!==3)return t.error(`Expected two arguments.`);let n=t.parse(e[1],1,I);if(!n)return null;let r=e[2];if(typeof r!=`object`||Array.isArray(r))return t.error(`NumberFormat options argument must be an object.`);let i=null;if(r.locale&&(i=t.parse(r.locale,1,L),!i))return null;let a=null;if(r.currency&&(a=t.parse(r.currency,1,L),!a))return null;let o=null;if(r.unit&&(o=t.parse(r.unit,1,L),!o))return null;if(a&&o)return t.error("NumberFormat options `currency` and `unit` are mutually exclusive");let s=null;if(r[`min-fraction-digits`]&&(s=t.parse(r[`min-fraction-digits`],1,I),!s))return null;let c=null;return r[`max-fraction-digits`]&&(c=t.parse(r[`max-fraction-digits`],1,I),!c)?null:new Fn(n,i,a,o,s,c)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?`currency`:this.unit?`unit`:`decimal`,currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class In{constructor(e){this.type=at,this.sections=e}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n=e[1];if(!Array.isArray(n)&&typeof n==`object`)return t.error(`First argument must be an image or text section.`);let r=[],i=!1;for(let n=1;n<=e.length-1;++n){let a=e[n];if(i&&typeof a==`object`&&!Array.isArray(a)){i=!1;let e=null;if(a[`font-scale`]&&(e=t.parse(a[`font-scale`],1,I),!e))return null;let n=null;if(a[`text-font`]&&(n=t.parse(a[`text-font`],1,dt(L)),!n))return null;let o=null;if(a[`text-color`]&&(o=t.parse(a[`text-color`],1,tt),!o))return null;let s=null;if(a[`vertical-align`]){if(typeof a[`vertical-align`]==`string`&&!Vt.includes(a[`vertical-align`]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${a[`vertical-align`]}' instead.`);if(s=t.parse(a[`vertical-align`],1,L),!s)return null}let c=r[r.length-1];c.scale=e,c.font=n,c.textColor=o,c.verticalAlign=s}else{let a=t.parse(e[n],1,z);if(!a)return null;let o=a.type.kind;if(o!==`string`&&o!==`value`&&o!==`null`&&o!==`resolvedImage`)return t.error(`Formatted text type must be 'string', 'value', 'image' or 'null'.`);i=!0,r.push({content:a,scale:null,font:null,textColor:null,verticalAlign:null})}}return new In(r)}evaluate(e){return new H(this.sections.map((t=>{let n=t.content.evaluate(e);return $t(n)===lt?new Ht(``,n,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new Ht(en(n),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(`,`):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.evaluate(e):null)})))}eachChild(e){for(let t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class Ln{constructor(e){this.type=lt,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected two arguments.`);let n=t.parse(e[1],1,L);return n?new Ln(n):t.error(`No image name provided.`)}evaluate(e){let t=this.input.evaluate(e),n=Yt.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}}class Rn{constructor(e){this.type=I,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=t.parse(e[1],1);return n?n.type.kind!==`array`&&n.type.kind!==`string`&&n.type.kind!==`value`?t.error(`Expected argument of type string or array, but found ${B(n.type)} instead.`):new Rn(n):null}evaluate(e){let t=this.input.evaluate(e);if(typeof t==`string`)return[...t].length;if(Array.isArray(t))return t.length;throw new Kt(`Expected value to be of type string or array, but found ${B($t(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}let zn=8192;function Bn(e,t){let n=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,i=2**t.z;return[Math.round(n*i*zn),Math.round(r*i*zn)]}function Vn(e,t){let n=2**t.z;return[(i=(e[0]/zn+t.x)/n,360*i-180),(r=(e[1]/zn+t.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,i}function Hn(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Un(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Wn(e,t,n){let r=e[0]-t[0],i=e[1]-t[1],a=e[0]-n[0],o=e[1]-n[1];return r*o-a*i==0&&r*a<=0&&i*o<=0}function Gn(e,t,n,r){return(i=[r[0]-n[0],r[1]-n[1]])[0]*(a=[t[0]-e[0],t[1]-e[1]])[1]-i[1]*a[0]!=0&&!(!Zn(e,t,n,r)||!Zn(n,r,e,t));var i,a}function Kn(e,t,n){for(let r of n)for(let n=0;n<r.length-1;++n)if(Gn(e,t,r[n],r[n+1]))return!0;return!1}function qn(e,t,n=!1){let r=!1;for(let s of t)for(let t=0;t<s.length-1;t++){if(Wn(e,s[t],s[t+1]))return n;(a=s[t])[1]>(i=e)[1]!=(o=s[t+1])[1]>i[1]&&i[0]<(o[0]-a[0])*(i[1]-a[1])/(o[1]-a[1])+a[0]&&(r=!r)}var i,a,o;return r}function Jn(e,t){for(let n of t)if(qn(e,n))return!0;return!1}function Yn(e,t){for(let n of e)if(!qn(n,t))return!1;for(let n=0;n<e.length-1;++n)if(Kn(e[n],e[n+1],t))return!1;return!0}function Xn(e,t){for(let n of t)if(Yn(e,n))return!0;return!1}function Zn(e,t,n,r){let i=r[0]-n[0],a=r[1]-n[1],o=(e[0]-n[0])*a-i*(e[1]-n[1]),s=(t[0]-n[0])*a-i*(t[1]-n[1]);return o>0&&s<0||o<0&&s>0}function Qn(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=[];for(let r=0;r<e[i].length;r++){let o=Bn(e[i][r],n);Hn(t,o),a.push(o)}r.push(a)}return r}function $n(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=Qn(e[i],t,n);r.push(a)}return r}function er(e,t,n,r){if(e[0]<n[0]||e[0]>n[2]){let t=.5*r,i=e[0]-n[0]>t?-r:n[0]-e[0]>t?r:0;i===0&&(i=e[0]-n[2]>t?-r:n[2]-e[0]>t?r:0),e[0]+=i}Hn(t,e)}function tr(e,t,n,r){let i=2**r.z*zn,a=[r.x*zn,r.y*zn],o=[];for(let r of e)for(let e of r){let r=[e.x+a[0],e.y+a[1]];er(r,t,n,i),o.push(r)}return o}function nr(e,t,n,r){let i=2**r.z*zn,a=[r.x*zn,r.y*zn],o=[];for(let n of e){let e=[];for(let r of n){let n=[r.x+a[0],r.y+a[1]];Hn(t,n),e.push(n)}o.push(e)}if(t[2]-t[0]<=i/2){(s=t)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(let e of o)for(let r of e)er(r,t,n,i)}var s;return o}class rr{constructor(e,t){this.type=R,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Qt(e[1])){let t=e[1];if(t.type===`FeatureCollection`){let e=[];for(let n of t.features){let{type:t,coordinates:r}=n.geometry;t===`Polygon`&&e.push(r),t===`MultiPolygon`&&e.push(...r)}if(e.length)return new rr(t,{type:`MultiPolygon`,coordinates:e})}else if(t.type===`Feature`){let e=t.geometry.type;if(e===`Polygon`||e===`MultiPolygon`)return new rr(t,t.geometry)}else if(t.type===`Polygon`||t.type===`MultiPolygon`)return new rr(t,t)}return t.error(`'within' expression requires valid geojson object that contains polygon geometry type.`)}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()===`Point`)return function(e,t){let n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if(t.type===`Polygon`){let a=Qn(t.coordinates,r,i),o=tr(e.geometry(),n,r,i);if(!Un(n,r))return!1;for(let e of o)if(!qn(e,a))return!1}if(t.type===`MultiPolygon`){let a=$n(t.coordinates,r,i),o=tr(e.geometry(),n,r,i);if(!Un(n,r))return!1;for(let e of o)if(!Jn(e,a))return!1}return!0}(e,this.geometries);if(e.geometryType()===`LineString`)return function(e,t){let n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if(t.type===`Polygon`){let a=Qn(t.coordinates,r,i),o=nr(e.geometry(),n,r,i);if(!Un(n,r))return!1;for(let e of o)if(!Yn(e,a))return!1}if(t.type===`MultiPolygon`){let a=$n(t.coordinates,r,i),o=nr(e.geometry(),n,r,i);if(!Un(n,r))return!1;for(let e of o)if(!Xn(e,a))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let ir=class{constructor(e=[],t=(e,t)=>e<t?-1:+(e>t)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:n}=this,r=t[e];for(;e>0;){let i=e-1>>1,a=t[i];if(n(r,a)>=0)break;t[e]=a,e=i}t[e]=r}_down(e){let{data:t,compare:n}=this,r=this.length>>1,i=t[e];for(;e<r;){let r=1+(e<<1),a=r+1;if(a<this.length&&n(t[a],t[r])<0&&(r=a),n(t[r],i)>=0)break;t[e]=t[r],e=r}t[e]=i}};function ar(e,t,n=0,r=e.length-1,i=sr){for(;r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1);ar(e,t,Math.max(n,Math.floor(t-o*c/a+l)),Math.min(r,Math.floor(t+(a-o)*c/a+l)),i)}let a=e[t],o=n,s=r;for(or(e,n,t),i(e[r],a)>0&&or(e,n,r);o<s;){for(or(e,o,s),o++,s--;i(e[o],a)<0;)o++;for(;i(e[s],a)>0;)s--}i(e[n],a)===0?or(e,n,s):(s++,or(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}}function or(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function sr(e,t){return e<t?-1:+(e>t)}function cr(e,t){if(e.length<=1)return[e];let n=[],r,i;for(let t of e){let e=ur(t);e!==0&&(t.area=Math.abs(e),i===void 0&&(i=e<0),i===e<0?(r&&n.push(r),r=[t]):r.push(t))}if(r&&n.push(r),t>1)for(let e=0;e<n.length;e++)n[e].length<=t||(ar(n[e],t,1,n[e].length-1,lr),n[e]=n[e].slice(0,t));return n}function lr(e,t){return t.area-e.area}function ur(e){let t=0;for(let n,r,i=0,a=e.length,o=a-1;i<a;o=i++)n=e[i],r=e[o],t+=(r.x-n.x)*(n.y+r.y);return t}let dr=1/298.257223563,fr=dr*(2-dr),pr=Math.PI/180;class mr{constructor(e){let t=6378.137*pr*1e3,n=Math.cos(e*pr),r=1/(1-fr*(1-n*n)),i=Math.sqrt(r);this.kx=t*i*n,this.ky=t*i*r*(1-fr)}distance(e,t){let n=this.wrap(e[0]-t[0])*this.kx,r=(e[1]-t[1])*this.ky;return Math.sqrt(n*n+r*r)}pointOnLine(e,t){let n,r,i,a,o=1/0;for(let s=0;s<e.length-1;s++){let c=e[s][0],l=e[s][1],u=this.wrap(e[s+1][0]-c)*this.kx,d=(e[s+1][1]-l)*this.ky,f=0;u===0&&d===0||(f=(this.wrap(t[0]-c)*this.kx*u+(t[1]-l)*this.ky*d)/(u*u+d*d),f>1?(c=e[s+1][0],l=e[s+1][1]):f>0&&(c+=u/this.kx*f,l+=d/this.ky*f)),u=this.wrap(t[0]-c)*this.kx,d=(t[1]-l)*this.ky;let p=u*u+d*d;p<o&&(o=p,n=c,r=l,i=s,a=f)}return{point:[n,r],index:i,t:Math.max(0,Math.min(1,a))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function hr(e,t){return t[0]-e[0]}function gr(e){return e[1]-e[0]+1}function _r(e,t){return e[1]>=e[0]&&e[1]<t}function vr(e,t){if(e[0]>e[1])return[null,null];let n=gr(e);if(t){if(n===2)return[e,null];let t=Math.floor(n/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(n===1)return[e,null];let r=Math.floor(n/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function yr(e,t){if(!_r(t,e.length))return[1/0,1/0,-1/0,-1/0];let n=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)Hn(n,e[r]);return n}function br(e){let t=[1/0,1/0,-1/0,-1/0];for(let n of e)for(let e of n)Hn(t,e);return t}function xr(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function Sr(e,t,n){if(!xr(e)||!xr(t))return NaN;let r=0,i=0;return e[2]<t[0]&&(r=t[0]-e[2]),e[0]>t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(i=e[1]-t[3]),e[3]<t[1]&&(i=t[1]-e[3]),n.distance([0,0],[r,i])}function Cr(e,t,n){let r=n.pointOnLine(t,e);return n.distance(e,r.point)}function wr(e,t,n,r,i){let a=Math.min(Cr(e,[n,r],i),Cr(t,[n,r],i)),o=Math.min(Cr(n,[e,t],i),Cr(r,[e,t],i));return Math.min(a,o)}function Tr(e,t,n,r,i){if(!_r(t,e.length)||!_r(r,n.length))return 1/0;let a=1/0;for(let o=t[0];o<t[1];++o){let t=e[o],s=e[o+1];for(let e=r[0];e<r[1];++e){let r=n[e],o=n[e+1];if(Gn(t,s,r,o))return 0;a=Math.min(a,wr(t,s,r,o,i))}}return a}function Er(e,t,n,r,i){if(!_r(t,e.length)||!_r(r,n.length))return NaN;let a=1/0;for(let o=t[0];o<=t[1];++o)for(let t=r[0];t<=r[1];++t)if(a=Math.min(a,i.distance(e[o],n[t])),a===0)return a;return a}function Dr(e,t,n){if(qn(e,t,!0))return 0;let r=1/0;for(let i of t){let t=i[0],a=i[i.length-1];if(t!==a&&(r=Math.min(r,Cr(e,[a,t],n)),r===0))return r;let o=n.pointOnLine(i,e);if(r=Math.min(r,n.distance(e,o.point)),r===0)return r}return r}function K(e,t,n,r){if(!_r(t,e.length))return NaN;for(let r=t[0];r<=t[1];++r)if(qn(e[r],n,!0))return 0;let i=1/0;for(let a=t[0];a<t[1];++a){let t=e[a],o=e[a+1];for(let e of n)for(let n=0,a=e.length,s=a-1;n<a;s=n++){let a=e[s],c=e[n];if(Gn(t,o,a,c))return 0;i=Math.min(i,wr(t,o,a,c,r))}}return i}function Or(e,t){for(let n of e)for(let e of n)if(qn(e,t,!0))return!0;return!1}function kr(e,t,n,r=1/0){let i=br(e),a=br(t);if(r!==1/0&&Sr(i,a,n)>=r)return r;if(Un(i,a)){if(Or(e,t))return 0}else if(Or(t,e))return 0;let o=1/0;for(let r of e)for(let e=0,i=r.length,a=i-1;e<i;a=e++){let i=r[a],s=r[e];for(let e of t)for(let t=0,r=e.length,a=r-1;t<r;a=t++){let r=e[a],c=e[t];if(Gn(i,s,r,c))return 0;o=Math.min(o,wr(i,s,r,c,n))}}return o}function Ar(e,t,n,r,i,a){if(!a)return;let o=Sr(yr(r,a),i,n);o<t&&e.push([o,a,[0,0]])}function jr(e,t,n,r,i,a,o){if(!a||!o)return;let s=Sr(yr(r,a),yr(i,o),n);s<t&&e.push([s,a,o])}function Mr(e,t,n,r,i=1/0){let a=Math.min(r.distance(e[0],n[0][0]),i);if(a===0)return a;let o=new ir([[0,[0,e.length-1],[0,0]]],hr),s=br(n);for(;o.length>0;){let i=o.pop();if(i[0]>=a)continue;let c=i[1],l=t?50:100;if(gr(c)<=l){if(!_r(c,e.length))return NaN;if(t){let t=K(e,c,n,r);if(isNaN(t)||t===0)return t;a=Math.min(a,t)}else for(let t=c[0];t<=c[1];++t){let i=Dr(e[t],n,r);if(a=Math.min(a,i),a===0)return 0}}else{let n=vr(c,t);Ar(o,a,r,e,s,n[0]),Ar(o,a,r,e,s,n[1])}}return a}function Nr(e,t,n,r,i,a=1/0){let o=Math.min(a,i.distance(e[0],n[0]));if(o===0)return o;let s=new ir([[0,[0,e.length-1],[0,n.length-1]]],hr);for(;s.length>0;){let a=s.pop();if(a[0]>=o)continue;let c=a[1],l=a[2],u=t?50:100,d=r?50:100;if(gr(c)<=u&&gr(l)<=d){if(!_r(c,e.length)&&_r(l,n.length))return NaN;let a;if(t&&r)a=Tr(e,c,n,l,i),o=Math.min(o,a);else if(t&&!r){let t=e.slice(c[0],c[1]+1);for(let e=l[0];e<=l[1];++e)if(a=Cr(n[e],t,i),o=Math.min(o,a),o===0)return o}else if(!t&&r){let t=n.slice(l[0],l[1]+1);for(let n=c[0];n<=c[1];++n)if(a=Cr(e[n],t,i),o=Math.min(o,a),o===0)return o}else a=Er(e,c,n,l,i),o=Math.min(o,a)}else{let a=vr(c,t),u=vr(l,r);jr(s,o,i,e,n,a[0],u[0]),jr(s,o,i,e,n,a[0],u[1]),jr(s,o,i,e,n,a[1],u[0]),jr(s,o,i,e,n,a[1],u[1])}}return o}function Pr(e){return e.type===`MultiPolygon`?e.coordinates.map((e=>({type:`Polygon`,coordinates:e}))):e.type===`MultiLineString`?e.coordinates.map((e=>({type:`LineString`,coordinates:e}))):e.type===`MultiPoint`?e.coordinates.map((e=>({type:`Point`,coordinates:e}))):[e]}class Fr{constructor(e,t){this.type=I,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Qt(e[1])){let t=e[1];if(t.type===`FeatureCollection`)return new Fr(t,t.features.map((e=>Pr(e.geometry))).flat());if(t.type===`Feature`)return new Fr(t,Pr(t.geometry));if(`type`in t&&`coordinates`in t)return new Fr(t,Pr(t))}return t.error(`'distance' expression requires valid geojson object that contains polygon geometry type.`)}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()===`Point`)return function(e,t){let n=e.geometry(),r=n.flat().map((t=>Vn([t.x,t.y],e.canonical)));if(n.length===0)return NaN;let i=new mr(r[0][1]),a=1/0;for(let e of t){switch(e.type){case`Point`:a=Math.min(a,Nr(r,!1,[e.coordinates],!1,i,a));break;case`LineString`:a=Math.min(a,Nr(r,!1,e.coordinates,!0,i,a));break;case`Polygon`:a=Math.min(a,Mr(r,!1,e.coordinates,i,a))}if(a===0)return a}return a}(e,this.geometries);if(e.geometryType()===`LineString`)return function(e,t){let n=e.geometry(),r=n.flat().map((t=>Vn([t.x,t.y],e.canonical)));if(n.length===0)return NaN;let i=new mr(r[0][1]),a=1/0;for(let e of t){switch(e.type){case`Point`:a=Math.min(a,Nr(r,!0,[e.coordinates],!1,i,a));break;case`LineString`:a=Math.min(a,Nr(r,!0,e.coordinates,!0,i,a));break;case`Polygon`:a=Math.min(a,Mr(r,!0,e.coordinates,i,a))}if(a===0)return a}return a}(e,this.geometries);if(e.geometryType()===`Polygon`)return function(e,t){let n=e.geometry();if(n.length===0||n[0].length===0)return NaN;let r=cr(n,0).map((t=>t.map((t=>t.map((t=>Vn([t.x,t.y],e.canonical))))))),i=new mr(r[0][0][0][1]),a=1/0;for(let e of t)for(let t of r){switch(e.type){case`Point`:a=Math.min(a,Mr([e.coordinates],!1,t,i,a));break;case`LineString`:a=Math.min(a,Mr(e.coordinates,!0,t,i,a));break;case`Polygon`:a=Math.min(a,kr(t,e.coordinates,i,a))}if(a===0)return a}return a}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Ir{constructor(e){this.type=z,this.key=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=e[1];return n==null?t.error(`Global state property must be defined.`):typeof n==`string`?new Ir(n):t.error(`Global state property must be string, but found ${typeof e[1]} instead.`)}evaluate(e){let t=e.globals?.globalState;return t&&Object.keys(t).length!==0?Mt(t,this.key):null}eachChild(){}outputDefined(){return!1}}let Lr={"==":On,"!=":kn,">":jn,"<":An,">=":Nn,"<=":Mn,array:rn,at:G,boolean:rn,case:pn,coalesce:wn,collator:Pn,format:In,image:Ln,in:un,"index-of":dn,interpolate:xn,"interpolate-hcl":xn,"interpolate-lab":xn,length:Rn,let:W,literal:tn,match:fn,number:rn,"number-format":Fn,object:rn,slice:mn,step:gn,string:rn,"to-boolean":on,"to-color":on,"to-number":on,"to-string":on,var:ln,within:rr,distance:Fr,"global-state":Ir};class Rr{constructor(e,t,n,r){this.name=e,this.type=t,this._evaluate=n,this.args=r}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){let n=e[0],r=Rr.definitions[n];if(!r)return t.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);let i=Array.isArray(r)?r[0]:r.type,a=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,o=a.filter((([t])=>!Array.isArray(t)||t.length===e.length-1)),s=null;for(let[r,a]of o){s=new U(t.registry,Ur,t.path,null,t.scope);let o=[],c=!1;for(let t=1;t<e.length;t++){let n=e[t],i=Array.isArray(r)?r[t-1]:r.type,a=s.parse(n,1+o.length,i);if(!a){c=!0;break}o.push(a)}if(!c)if(Array.isArray(r)&&r.length!==o.length)s.error(`Expected ${r.length} arguments, but found ${o.length} instead.`);else{for(let e=0;e<o.length;e++){let t=Array.isArray(r)?r[e]:r.type,n=o[e];s.concat(e+1).checkSubtype(t,n.type)}if(s.errors.length===0)return new Rr(n,i,a,o)}}if(o.length===1)t.errors.push(...s.errors);else{let n=(o.length?o:a).map((([e])=>{return t=e,Array.isArray(t)?`(${t.map(B).join(`, `)})`:`(${B(t.type)}...)`;var t})).join(` | `),r=[];for(let n=1;n<e.length;n++){let i=t.parse(e[n],1+r.length);if(!i)return null;r.push(B(i.type))}t.error(`Expected arguments of type ${n}, but found (${r.join(`, `)}) instead.`)}return null}static register(e,t){Rr.definitions=t;for(let n in t)e[n]=Rr}}function zr(e,[t,n,r,i]){t=t.evaluate(e),n=n.evaluate(e),r=r.evaluate(e);let a=i?i.evaluate(e):1,o=Zt(t,n,r,a);if(o)throw new Kt(o);return new V(t/255,n/255,r/255,a,!1)}function Br(e,t){return e in t}function Vr(e,t){let n=t[e];return n===void 0?null:n}function Hr(e){return{type:e}}function Ur(e){if(e instanceof ln)return Ur(e.boundExpression);if(e instanceof Rr&&e.name===`error`||e instanceof Pn||e instanceof rr||e instanceof Fr||e instanceof Ir)return!1;let t=e instanceof on||e instanceof rn,n=!0;return e.eachChild((e=>{n=t?n&&Ur(e):n&&e instanceof tn})),!!n&&Wr(e)&&Kr(e,[`zoom`,`heatmap-density`,`elevation`,`line-progress`,`accumulated`,`is-supported-script`])}function Wr(e){if(e instanceof Rr&&(e.name===`get`&&e.args.length===1||e.name===`feature-state`||e.name===`has`&&e.args.length===1||e.name===`properties`||e.name===`geometry-type`||e.name===`id`||/^filter-/.test(e.name))||e instanceof rr||e instanceof Fr)return!1;let t=!0;return e.eachChild((e=>{t&&!Wr(e)&&(t=!1)})),t}function Gr(e){if(e instanceof Rr&&e.name===`feature-state`)return!1;let t=!0;return e.eachChild((e=>{t&&!Gr(e)&&(t=!1)})),t}function Kr(e,t){if(e instanceof Rr&&t.indexOf(e.name)>=0)return!1;let n=!0;return e.eachChild((e=>{n&&!Kr(e,t)&&(n=!1)})),n}function qr(e){return{result:`success`,value:e}}function Jr(e){return{result:`error`,value:e}}function Yr(e){return e[`property-type`]===`data-driven`||e[`property-type`]===`cross-faded-data-driven`}function Xr(e){return!!e.expression&&e.expression.parameters.indexOf(`zoom`)>-1}function Zr(e){return!!e.expression&&e.expression.interpolated}function q(e){return e instanceof Number?`number`:e instanceof String?`string`:e instanceof Boolean?`boolean`:Array.isArray(e)?`array`:e===null?`null`:typeof e}function Qr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&$t(e)===rt}function $r(e){return e}function ei(e,t){let n=e.stops&&typeof e.stops[0][0]==`object`,r=n||!(n||e.property!==void 0),i=e.type||(Zr(t)?`exponential`:`interval`),a=function(e){switch(e.type){case`color`:return V.parse;case`padding`:return Ut.parse;case`numberArray`:return Wt.parse;case`colorArray`:return Gt.parse;default:return null}}(t);if(a&&((e=Ze({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],a(e[1])]))),e.default=a(e.default?e.default:t.default)),e.colorSpace&&(o=e.colorSpace)!==`rgb`&&o!==`hcl`&&o!==`lab`)throw Error(`Unknown color space: "${e.colorSpace}"`);var o;let s=function(e){switch(e){case`exponential`:return ii;case`interval`:return ri;case`categorical`:return ni;case`identity`:return ai;default:throw Error(`Unknown function type "${e}"`)}}(i),c,l;if(i===`categorical`){c=Object.create(null);for(let t of e.stops)c[t[0]]=t[1];l=typeof e.stops[0][0]}if(n){let n={},r=[];for(let t=0;t<e.stops.length;t++){let i=e.stops[t],a=i[0].zoom;n[a]===void 0&&(n[a]={zoom:a,type:e.type,property:e.property,default:e.default,stops:[]},r.push(a)),n[a].stops.push([i[0].value,i[1]])}let i=[];for(let e of r)i.push([n[e].zoom,ei(n[e],t)]);let a={name:`linear`};return{kind:`composite`,interpolationType:a,interpolationFactor:xn.interpolationFactor.bind(void 0,a),zoomStops:i.map((e=>e[0])),evaluate:({zoom:n},r)=>ii({stops:i,base:e.base},t,n).evaluate(n,r)}}if(r){let n=i===`exponential`?{name:`exponential`,base:e.base===void 0?1:e.base}:null;return{kind:`camera`,interpolationType:n,interpolationFactor:xn.interpolationFactor.bind(void 0,n),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:n})=>s(e,t,n,c,l)}}return{kind:`source`,evaluate(n,r){let i=r&&r.properties?r.properties[e.property]:void 0;return i===void 0?ti(e.default,t.default):s(e,t,i,c,l)}}}function ti(e,t,n){return e===void 0?t===void 0?n===void 0?void 0:n:t:e}function ni(e,t,n,r,i){return ti(typeof n===i?r[n]:void 0,e.default,t.default)}function ri(e,t,n){if(q(n)!==`number`)return ti(e.default,t.default);let r=e.stops.length;if(r===1||n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[r-1][0])return e.stops[r-1][1];let i=hn(e.stops.map((e=>e[0])),n);return e.stops[i][1]}function ii(e,t,n){let r=e.base===void 0?1:e.base;if(q(n)!==`number`)return ti(e.default,t.default);let i=e.stops.length;if(i===1||n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[i-1][0])return e.stops[i-1][1];let a=hn(e.stops.map((e=>e[0])),n),o=function(e,t,n,r){let i=r-n,a=e-n;return i===0?0:t===1?a/i:(t**+a-1)/(t**+i-1)}(n,r,e.stops[a][0],e.stops[a+1][0]),s=e.stops[a][1],c=e.stops[a+1][1],l=Cn[t.type]||$r;return typeof s.evaluate==`function`?{evaluate(...t){let n=s.evaluate.apply(void 0,t),r=c.evaluate.apply(void 0,t);if(n!==void 0&&r!==void 0)return l(n,r,o,e.colorSpace)}}:l(s,c,o,e.colorSpace)}function ai(e,t,n){switch(t.type){case`color`:n=V.parse(n);break;case`formatted`:n=H.fromString(n.toString());break;case`resolvedImage`:n=Yt.fromString(n.toString());break;case`padding`:n=Ut.parse(n);break;case`colorArray`:n=Gt.parse(n);break;case`numberArray`:n=Wt.parse(n);break;default:q(n)===t.type||t.type===`enum`&&t.values[n]||(n=void 0)}return ti(n,e.default,t.default)}Rr.register(Lr,{error:[{kind:`error`},[L],(e,[t])=>{throw new Kt(t.evaluate(e))}],typeof:[L,[z],(e,[t])=>B($t(t.evaluate(e)))],"to-rgba":[dt(I,4),[tt],(e,[t])=>{let[n,r,i,a]=t.evaluate(e).rgb;return[255*n,255*r,255*i,a]}],rgb:[tt,[I,I,I],zr],rgba:[tt,[I,I,I,I],zr],has:{type:R,overloads:[[[L],(e,[t])=>Br(t.evaluate(e),e.properties())],[[L,rt],(e,[t,n])=>Br(t.evaluate(e),n.evaluate(e))]]},get:{type:z,overloads:[[[L],(e,[t])=>Vr(t.evaluate(e),e.properties())],[[L,rt],(e,[t,n])=>Vr(t.evaluate(e),n.evaluate(e))]]},"feature-state":[z,[L],(e,[t])=>Vr(t.evaluate(e),e.featureState||{})],properties:[rt,[],e=>e.properties()],"geometry-type":[L,[],e=>e.geometryType()],id:[z,[],e=>e.id()],zoom:[I,[],e=>e.globals.zoom],"heatmap-density":[I,[],e=>e.globals.heatmapDensity||0],elevation:[I,[],e=>e.globals.elevation||0],"line-progress":[I,[],e=>e.globals.lineProgress||0],accumulated:[z,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[I,Hr(I),(e,t)=>{let n=0;for(let r of t)n+=r.evaluate(e);return n}],"*":[I,Hr(I),(e,t)=>{let n=1;for(let r of t)n*=r.evaluate(e);return n}],"-":{type:I,overloads:[[[I,I],(e,[t,n])=>t.evaluate(e)-n.evaluate(e)],[[I],(e,[t])=>-t.evaluate(e)]]},"/":[I,[I,I],(e,[t,n])=>t.evaluate(e)/n.evaluate(e)],"%":[I,[I,I],(e,[t,n])=>t.evaluate(e)%n.evaluate(e)],ln2:[I,[],()=>Math.LN2],pi:[I,[],()=>Math.PI],e:[I,[],()=>Math.E],"^":[I,[I,I],(e,[t,n])=>t.evaluate(e)**+n.evaluate(e)],sqrt:[I,[I],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[I,[I],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[I,[I],(e,[t])=>Math.log(t.evaluate(e))],log2:[I,[I],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[I,[I],(e,[t])=>Math.sin(t.evaluate(e))],cos:[I,[I],(e,[t])=>Math.cos(t.evaluate(e))],tan:[I,[I],(e,[t])=>Math.tan(t.evaluate(e))],asin:[I,[I],(e,[t])=>Math.asin(t.evaluate(e))],acos:[I,[I],(e,[t])=>Math.acos(t.evaluate(e))],atan:[I,[I],(e,[t])=>Math.atan(t.evaluate(e))],min:[I,Hr(I),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[I,Hr(I),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[I,[I],(e,[t])=>Math.abs(t.evaluate(e))],round:[I,[I],(e,[t])=>{let n=t.evaluate(e);return n<0?-Math.round(-n):Math.round(n)}],floor:[I,[I],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[I,[I],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[R,[L,z],(e,[t,n])=>e.properties()[t.value]===n.value],"filter-id-==":[R,[z],(e,[t])=>e.id()===t.value],"filter-type-==":[R,[L],(e,[t])=>e.geometryType()===t.value],"filter-<":[R,[L,z],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r<i}],"filter-id-<":[R,[z],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n<r}],"filter->":[R,[L,z],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r>i}],"filter-id->":[R,[z],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n>r}],"filter-<=":[R,[L,z],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r<=i}],"filter-id-<=":[R,[z],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n<=r}],"filter->=":[R,[L,z],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r>=i}],"filter-id->=":[R,[z],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n>=r}],"filter-has":[R,[z],(e,[t])=>t.value in e.properties()],"filter-has-id":[R,[],e=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[R,[dt(L)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[R,[dt(z)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[R,[L,dt(z)],(e,[t,n])=>n.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[R,[L,dt(z)],(e,[t,n])=>function(e,t,n,r){for(;n<=r;){let i=n+r>>1;if(t[i]===e)return!0;t[i]>e?r=i-1:n=i+1}return!1}(e.properties()[t.value],n.value,0,n.value.length-1)],all:{type:R,overloads:[[[R,R],(e,[t,n])=>t.evaluate(e)&&n.evaluate(e)],[Hr(R),(e,t)=>{for(let n of t)if(!n.evaluate(e))return!1;return!0}]]},any:{type:R,overloads:[[[R,R],(e,[t,n])=>t.evaluate(e)||n.evaluate(e)],[Hr(R),(e,t)=>{for(let n of t)if(n.evaluate(e))return!0;return!1}]]},"!":[R,[R],(e,[t])=>!t.evaluate(e)],"is-supported-script":[R,[L],(e,[t])=>{let n=e.globals&&e.globals.isSupportedScript;return!n||n(t.evaluate(e))}],upcase:[L,[L],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[L,[L],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[L,Hr(z),(e,t)=>t.map((t=>en(t.evaluate(e)))).join(``)],split:[dt(L),[L,L],(e,[t,n])=>t.evaluate(e).split(n.evaluate(e))],join:[L,[dt(L),L],(e,[t,n])=>t.evaluate(e).join(n.evaluate(e))],"resolved-locale":[L,[it],(e,[t])=>t.evaluate(e).resolvedLocale()]});class oi{constructor(e,t,n){this.expression=e,this._warningHistory={},this._evaluator=new cn,this._defaultValue=t?function(e){if(e.type===`color`&&Qr(e.default))return new V(0,0,0,0);switch(e.type){case`color`:return V.parse(e.default)||null;case`padding`:return Ut.parse(e.default)||null;case`numberArray`:return Wt.parse(e.default)||null;case`colorArray`:return Gt.parse(e.default)||null;case`variableAnchorOffsetCollection`:return Jt.parse(e.default)||null;case`projectionDefinition`:return Xt.parse(e.default)||null;default:return e.default===void 0?null:e.default}}(t):null,this._enumValues=t&&t.type===`enum`?t.values:null,this._globalState=n}evaluateWithoutErrorHandling(e,t,n,r,i,a){return this._globalState&&(e=hi(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,r,i,a){this._globalState&&(e=hi(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=n||null,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a||null;try{let e=this.expression.evaluate(this._evaluator);if(e==null||typeof e==`number`&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new Kt(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(`, `)}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,typeof console<`u`&&console.warn(e.message)),this._defaultValue}}}function si(e){return Array.isArray(e)&&e.length>0&&typeof e[0]==`string`&&e[0]in Lr}function ci(e,t,n){let r=new U(Lr,Ur,[],t?function(e){let t={color:tt,string:L,number:I,enum:L,boolean:R,formatted:at,padding:ot,numberArray:ct,colorArray:st,projectionDefinition:nt,resolvedImage:lt,variableAnchorOffsetCollection:ut};return e.type===`array`?dt(t[e.value]||z,e.length):t[e.type]}(t):void 0),i=r.parse(e,void 0,void 0,void 0,t&&t.type===`string`?{typeAnnotation:`coerce`}:void 0);return i?qr(new oi(i,t,n)):Jr(r.errors)}class li{constructor(e,t,n){this.kind=e,this._styleExpression=t,this.isStateDependent=e!==`constant`&&!Gr(t.expression),this.globalStateRefs=mi(t.expression),this._globalState=n}evaluateWithoutErrorHandling(e,t,n,r,i,a){return this._globalState&&(e=hi(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,i,a)}evaluate(e,t,n,r,i,a){return this._globalState&&(e=hi(e,this._globalState)),this._styleExpression.evaluate(e,t,n,r,i,a)}}class ui{constructor(e,t,n,r,i){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent=e!==`camera`&&!Gr(t.expression),this.globalStateRefs=mi(t.expression),this.interpolationType=r,this._globalState=i}evaluateWithoutErrorHandling(e,t,n,r,i,a){return this._globalState&&(e=hi(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,i,a)}evaluate(e,t,n,r,i,a){return this._globalState&&(e=hi(e,this._globalState)),this._styleExpression.evaluate(e,t,n,r,i,a)}interpolationFactor(e,t,n){return this.interpolationType?xn.interpolationFactor(this.interpolationType,e,t,n):0}}function di(e,t,n){let r=ci(e,t,n);if(r.result===`error`)return r;let i=r.value.expression,a=Wr(i);if(!a&&!Yr(t))return Jr([new Qe(``,`data expressions not supported`)]);let o=Kr(i,[`zoom`]);if(!o&&!Xr(t))return Jr([new Qe(``,`zoom expressions not supported`)]);let s=pi(i);return s||o?s instanceof Qe?Jr([s]):s instanceof xn&&!Zr(t)?Jr([new Qe(``,`"interpolate" expressions cannot be used with this property`)]):qr(s?new ui(a?`camera`:`composite`,r.value,s.labels,s instanceof xn?s.interpolation:void 0,n):new li(a?`constant`:`source`,r.value,n)):Jr([new Qe(``,`"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.`)])}class fi{constructor(e,t){this._parameters=e,this._specification=t,Ze(this,ei(this._parameters,this._specification))}static deserialize(e){return new fi(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function pi(e){let t=null;if(e instanceof W)t=pi(e.result);else if(e instanceof wn){for(let n of e.args)if(t=pi(n),t)break}else (e instanceof gn||e instanceof xn)&&e.input instanceof Rr&&e.input.name===`zoom`&&(t=e);return t instanceof Qe||e.eachChild((e=>{let n=pi(e);n instanceof Qe?t=n:!t&&n?t=new Qe(``,`"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.`):t&&n&&t!==n&&(t=new Qe(``,`Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.`))})),t}function mi(e,t=new Set){return e instanceof Ir&&t.add(e.key),e.eachChild((e=>{mi(e,t)})),t}function hi(e,t){let{zoom:n,heatmapDensity:r,elevation:i,lineProgress:a,isSupportedScript:o,accumulated:s}=e??{};return{zoom:n,heatmapDensity:r,elevation:i,lineProgress:a,isSupportedScript:o,accumulated:s,globalState:t}}function gi(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||e.length===0)return!1;switch(e[0]){case`has`:return e.length>=2&&e[1]!==`$id`&&e[1]!==`$type`;case`in`:return e.length>=3&&(typeof e[1]!=`string`||Array.isArray(e[2]));case`!in`:case`!has`:case`none`:return!1;case`==`:case`!=`:case`>`:case`>=`:case`<`:case`<=`:return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2]);case`any`:case`all`:for(let t of e.slice(1))if(!gi(t)&&typeof t!=`boolean`)return!1;return!0;default:return!0}}let _i={type:`boolean`,default:!1,transition:!1,"property-type":`data-driven`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]}};function vi(e,t){if(e==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};gi(e)||(e=xi(e));let n=ci(e,_i,t);if(n.result===`error`)throw Error(n.value.map((e=>`${e.key}: ${e.message}`)).join(`, `));return{filter:(e,t,r)=>n.value.evaluate(e,t,{},r),needGeometry:bi(e),getGlobalStateRefs:()=>mi(n.value.expression)}}function yi(e,t){return e<t?-1:+(e>t)}function bi(e){if(!Array.isArray(e))return!1;if(e[0]===`within`||e[0]===`distance`)return!0;for(let t=1;t<e.length;t++)if(bi(e[t]))return!0;return!1}function xi(e){if(!e)return!0;let t=e[0];return e.length<=1?t!==`any`:t===`==`?Si(e[1],e[2],`==`):t===`!=`?Ti(Si(e[1],e[2],`==`)):t===`<`||t===`>`||t===`<=`||t===`>=`?Si(e[1],e[2],t):t===`any`?(n=e.slice(1),[`any`].concat(n.map(xi))):t===`all`?[`all`].concat(e.slice(1).map(xi)):t===`none`?[`all`].concat(e.slice(1).map(xi).map(Ti)):t===`in`?Ci(e[1],e.slice(2)):t===`!in`?Ti(Ci(e[1],e.slice(2))):t===`has`?wi(e[1]):t!==`!has`||Ti(wi(e[1]));var n}function Si(e,t,n){switch(e){case`$type`:return[`filter-type-${n}`,t];case`$id`:return[`filter-id-${n}`,t];default:return[`filter-${n}`,e,t]}}function Ci(e,t){if(t.length===0)return!1;switch(e){case`$type`:return[`filter-type-in`,[`literal`,t]];case`$id`:return[`filter-id-in`,[`literal`,t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?[`filter-in-large`,e,[`literal`,t.sort(yi)]]:[`filter-in-small`,e,[`literal`,t]]}}function wi(e){switch(e){case`$type`:return!0;case`$id`:return[`filter-has-id`];default:return[`filter-has`,e]}}function Ti(e){return[`!`,e]}function Ei(e){let t=typeof e;if(t===`number`||t===`boolean`||t===`string`||e==null)return JSON.stringify(e);if(Array.isArray(e)){let t=`[`;for(let n of e)t+=`${Ei(n)},`;return`${t}]`}let n=Object.keys(e).sort(),r=`{`;for(let t=0;t<n.length;t++)r+=`${JSON.stringify(n[t])}:${Ei(e[n[t]])},`;return`${r}}`}function Di(e){let t=``;for(let n of Ve)t+=`/${Ei(e[n])}`;return t}function Oi(e){let t=e.value;return t?[new F(e.key,t,`constants have been deprecated as of v8`)]:[]}function ki(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Ai(e){if(Array.isArray(e))return e.map(Ai);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let n in e)t[n]=Ai(e[n]);return t}return ki(e)}function ji(e){let t=e.key,n=e.value,r=e.valueSpec||{},i=e.objectElementValidators||{},a=e.style,o=e.styleSpec,s=e.validateSpec,c=[],l=q(n);if(l!==`object`)return[new F(t,n,`object expected, ${l} found`)];for(let e in n){let l=e.split(`.`)[0],u=Mt(r,l)||r[`*`],d;if(Mt(i,l))d=i[l];else if(Mt(r,l)){if(n[e]===void 0)continue;d=s}else if(i[`*`])d=i[`*`];else{if(!r[`*`]){c.push(new F(t,n[e],`unknown property "${e}"`));continue}d=s}c=c.concat(d({key:(t&&`${t}.`)+e,value:n[e],valueSpec:u,style:a,styleSpec:o,object:n,objectKey:e,validateSpec:s},n))}for(let e in r)i[e]||r[e].required&&r[e].default===void 0&&n[e]===void 0&&c.push(new F(t,n,`missing required property "${e}"`));return c}function Mi(e){let t=e.value,n=e.valueSpec,r=e.style,i=e.styleSpec,a=e.key,o=e.arrayElementValidator||e.validateSpec;if(q(t)!==`array`)return[new F(a,t,`array expected, ${q(t)} found`)];if(n.length&&t.length!==n.length)return[new F(a,t,`array length ${n.length} expected, length ${t.length} found`)];let s={type:n.value,values:n.values};i.$version<7&&(s.function=n.function),q(n.value)===`object`&&(s=n.value);let c=[];for(let n=0;n<t.length;n++)c=c.concat(o({array:t,arrayIndex:n,value:t[n],valueSpec:s,validateSpec:e.validateSpec,style:r,styleSpec:i,key:`${a}[${n}]`}));return c}function Ni(e){let t=e.key,n=e.value,r=e.valueSpec,i=q(n);return i===`number`&&n!=n&&(i=`NaN`),i===`number`?`minimum`in r&&n<r.minimum?[new F(t,n,`${n} is less than the minimum value ${r.minimum}`)]:`maximum`in r&&n>r.maximum?[new F(t,n,`${n} is greater than the maximum value ${r.maximum}`)]:[]:[new F(t,n,`number expected, ${i} found`)]}function Pi(e){let t=e.valueSpec,n=ki(e.value.type),r,i,a,o={},s=n!==`categorical`&&e.value.property===void 0,c=!s,l=q(e.value.stops)===`array`&&q(e.value.stops[0])===`array`&&q(e.value.stops[0][0])===`object`,u=ji({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if(n===`identity`)return[new F(e.key,e.value,`identity function may not have a "stops" property`)];let t=[],r=e.value;return t=t.concat(Mi({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:d})),q(r)===`array`&&r.length===0&&t.push(new F(e.key,r,`array must have at least one stop`)),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return n===`identity`&&s&&u.push(new F(e.key,e.value,`missing required property "property"`)),n===`identity`||e.value.stops||u.push(new F(e.key,e.value,`missing required property "stops"`)),n===`exponential`&&e.valueSpec.expression&&!Zr(e.valueSpec)&&u.push(new F(e.key,e.value,`exponential functions not supported`)),e.styleSpec.$version>=8&&(c&&!Yr(e.valueSpec)?u.push(new F(e.key,e.value,`property functions not supported`)):s&&!Xr(e.valueSpec)&&u.push(new F(e.key,e.value,`zoom functions not supported`))),n!==`categorical`&&!l||e.value.property!==void 0||u.push(new F(e.key,e.value,`"property" property is required`)),u;function d(e){let n=[],r=e.value,s=e.key;if(q(r)!==`array`)return[new F(s,r,`array expected, ${q(r)} found`)];if(r.length!==2)return[new F(s,r,`array length 2 expected, length ${r.length} found`)];if(l){if(q(r[0])!==`object`)return[new F(s,r,`object expected, ${q(r[0])} found`)];if(r[0].zoom===void 0)return[new F(s,r,`object stop key must have zoom`)];if(r[0].value===void 0)return[new F(s,r,`object stop key must have value`)];if(a&&a>ki(r[0].zoom))return[new F(s,r[0].zoom,`stop zoom values must appear in ascending order`)];ki(r[0].zoom)!==a&&(a=ki(r[0].zoom),i=void 0,o={}),n=n.concat(ji({key:`${s}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:Ni,value:f}}))}else n=n.concat(f({key:`${s}[0]`,value:r[0],validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},r));return si(Ai(r[1]))?n.concat([new F(`${s}[1]`,r[1],`expressions are not allowed in function stops.`)]):n.concat(e.validateSpec({key:`${s}[1]`,value:r[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function f(e,a){let s=q(e.value),c=ki(e.value),l=e.value===null?a:e.value;if(r){if(s!==r)return[new F(e.key,l,`${s} stop domain type must match previous stop domain type ${r}`)]}else r=s;if(s!==`number`&&s!==`string`&&s!==`boolean`)return[new F(e.key,l,`stop domain value must be a number, string, or boolean`)];if(s!==`number`&&n!==`categorical`){let r=`number expected, ${s} found`;return Yr(t)&&n===void 0&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new F(e.key,l,r)]}return n!==`categorical`||s!==`number`||isFinite(c)&&Math.floor(c)===c?n!==`categorical`&&s===`number`&&i!==void 0&&c<i?[new F(e.key,l,`stop domain values must appear in ascending order`)]:(i=c,n===`categorical`&&c in o?[new F(e.key,l,`stop domain values must be unique`)]:(o[c]=!0,[])):[new F(e.key,l,`integer expected, found ${c}`)]}}function Fi(e){let t=(e.expressionContext===`property`?di:ci)(Ai(e.value),e.valueSpec);if(t.result===`error`)return t.value.map((t=>new F(`${e.key}${t.key}`,e.value,t.message)));let n=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext===`property`&&e.propertyKey===`text-font`&&!n.outputDefined())return[new F(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if(e.expressionContext===`property`&&e.propertyType===`layout`&&!Gr(n))return[new F(e.key,e.value,`"feature-state" data expressions are not supported with layout properties.`)];if(e.expressionContext===`filter`&&!Gr(n))return[new F(e.key,e.value,`"feature-state" data expressions are not supported with filters.`)];if(e.expressionContext&&e.expressionContext.indexOf(`cluster`)===0){if(!Kr(n,[`zoom`,`feature-state`]))return[new F(e.key,e.value,`"zoom" and "feature-state" expressions are not supported with cluster properties.`)];if(e.expressionContext===`cluster-initial`&&!Wr(n))return[new F(e.key,e.value,`Feature data expressions are not supported with initial expression part of cluster properties.`)]}return[]}function Ii(e){let t=e.key,n=e.value,r=q(n);return r===`string`?V.parse(String(n))?[]:[new F(t,n,`color expected, "${n}" found`)]:[new F(t,n,`color expected, ${r} found`)]}function Li(e){let t=e.key,n=e.value,r=e.valueSpec,i=[];return Array.isArray(r.values)?r.values.indexOf(ki(n))===-1&&i.push(new F(t,n,`expected one of [${r.values.join(`, `)}], ${JSON.stringify(n)} found`)):Object.keys(r.values).indexOf(ki(n))===-1&&i.push(new F(t,n,`expected one of [${Object.keys(r.values).join(`, `)}], ${JSON.stringify(n)} found`)),i}function Ri(e){return gi(Ai(e.value))?Fi(Ze({},e,{expressionContext:`filter`,valueSpec:{value:`boolean`}})):zi(e)}function zi(e){let t=e.value,n=e.key;if(q(t)!==`array`)return[new F(n,t,`array expected, ${q(t)} found`)];let r=e.styleSpec,i,a=[];if(t.length<1)return[new F(n,t,`filter array must have at least 1 element`)];switch(a=a.concat(Li({key:`${n}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),ki(t[0])){case`<`:case`<=`:case`>`:case`>=`:t.length>=2&&ki(t[1])===`$type`&&a.push(new F(n,t,`"$type" cannot be use with operator "${t[0]}"`));case`==`:case`!=`:t.length!==3&&a.push(new F(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case`in`:case`!in`:t.length>=2&&(i=q(t[1]),i!==`string`&&a.push(new F(`${n}[1]`,t[1],`string expected, ${i} found`)));for(let o=2;o<t.length;o++)i=q(t[o]),ki(t[1])===`$type`?a=a.concat(Li({key:`${n}[${o}]`,value:t[o],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):i!==`string`&&i!==`number`&&i!==`boolean`&&a.push(new F(`${n}[${o}]`,t[o],`string, number, or boolean expected, ${i} found`));break;case`any`:case`all`:case`none`:for(let r=1;r<t.length;r++)a=a.concat(zi({key:`${n}[${r}]`,value:t[r],style:e.style,styleSpec:e.styleSpec}));break;case`has`:case`!has`:i=q(t[1]),t.length===2?i!==`string`&&a.push(new F(`${n}[1]`,t[1],`string expected, ${i} found`)):a.push(new F(n,t,`filter array for "${t[0]}" operator must have 2 elements`))}return a}function Bi(e,t){let n=e.key,r=e.validateSpec,i=e.style,a=e.styleSpec,o=e.value,s=e.objectKey,c=a[`${t}_${e.layerType}`];if(!c)return[];let l=s.match(/^(.*)-transition$/);if(t===`paint`&&l&&c[l[1]]&&c[l[1]].transition)return r({key:n,value:o,valueSpec:a.transition,style:i,styleSpec:a});let u=e.valueSpec||c[s];if(!u)return[new F(n,o,`unknown property "${s}"`)];let d;if(q(o)===`string`&&Yr(u)&&!u.tokens&&(d=/^{([^}]+)}$/.exec(o)))return[new F(n,o,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(d[1])} }\`.`)];let f=[];return e.layerType===`symbol`&&s===`text-font`&&Qr(Ai(o))&&ki(o.type)===`identity`&&f.push(new F(n,o,`"text-font" does not support identity functions`)),f.concat(r({key:e.key,value:o,valueSpec:u,style:i,styleSpec:a,expressionContext:`property`,propertyType:t,propertyKey:s}))}function Vi(e){return Bi(e,`paint`)}function Hi(e){return Bi(e,`layout`)}function Ui(e){var t,n;let r=[],i=e.value,a=e.key,o=e.style,s=e.styleSpec;if(q(i)!==`object`)return[new F(a,i,`object expected, ${q(i)} found`)];i.type||i.ref||r.push(new F(a,i,`either "type" or "ref" is required`));let c=ki(i.type),l=ki(i.ref);if(i.id){let t=ki(i.id);for(let n=0;n<e.arrayIndex;n++){let e=o.layers[n];ki(e.id)===t&&r.push(new F(a,i.id,`duplicate layer id "${i.id}", previously used at line ${e.id.__line__}`))}}if(`ref`in i){let e;[`type`,`source`,`source-layer`,`filter`,`layout`].forEach((e=>{e in i&&r.push(new F(a,i[e],`"${e}" is prohibited for ref layers`))})),o.layers.forEach((t=>{ki(t.id)===l&&(e=t)})),e?e.ref?r.push(new F(a,i.ref,`ref cannot reference another ref layer`)):c=ki(e.type):r.push(new F(a,i.ref,`ref layer "${l}" not found`))}else if(c!==`background`)if(i.source){let e=o.sources&&o.sources[i.source],t=e&&ki(e.type);e?t===`vector`&&c===`raster`?r.push(new F(a,i.source,`layer "${i.id}" requires a raster source`)):t!==`raster-dem`&&c===`hillshade`||t!==`raster-dem`&&c===`color-relief`?r.push(new F(a,i.source,`layer "${i.id}" requires a raster-dem source`)):t===`raster`&&c!==`raster`?r.push(new F(a,i.source,`layer "${i.id}" requires a vector source`)):t!==`vector`||i[`source-layer`]?t===`raster-dem`&&c!==`hillshade`&&c!==`color-relief`?r.push(new F(a,i.source,`raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.`)):c!==`line`||!i.paint||!i.paint[`line-gradient`]||t===`geojson`&&e.lineMetrics||r.push(new F(a,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new F(a,i,`layer "${i.id}" must specify a "source-layer"`)):r.push(new F(a,i.source,`source "${i.source}" not found`))}else r.push(new F(a,i,`missing required property "source"`));return c===`raster`&&(t=i.paint)!=null&&t.resampling&&(n=i.paint)!=null&&n[`raster-resampling`]&&r.push(new F(a,i.paint,`layer "${i.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),r=r.concat(ji({key:a,value:i,valueSpec:s.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${a}.type`,value:i.type,valueSpec:s.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:i,objectKey:`type`}),filter:Ri,layout:e=>ji({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Hi(Ze({layerType:c},e))}}),paint:e=>ji({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Vi(Ze({layerType:c},e))}})}})),r}function Wi(e){let t=e.value,n=e.key,r=q(t);return r===`string`?[]:[new F(n,t,`string expected, ${r} found`)]}let Gi={promoteId:function({key:e,value:t}){if(q(t)===`string`)return Wi({key:e,value:t});{let n=[];for(let r in t)n.push(...Wi({key:`${e}.${r}`,value:t[r]}));return n}}};function Ki(e){let t=e.value,n=e.key,r=e.styleSpec,i=e.style,a=e.validateSpec;if(!t.type)return[new F(n,t,`"type" is required`)];let o=ki(t.type),s;switch(o){case`vector`:case`raster`:return s=ji({key:n,value:t,valueSpec:r[`source_${o.replace(`-`,`_`)}`],style:e.style,styleSpec:r,objectElementValidators:Gi,validateSpec:a}),s;case`raster-dem`:return s=function(e){let t=e.sourceName??``,n=e.value,r=e.styleSpec,i=r.source_raster_dem,a=e.style,o=[],s=q(n);if(n===void 0)return o;if(s!==`object`)return o.push(new F(`source_raster_dem`,n,`object expected, ${s} found`)),o;let c=ki(n.encoding)===`custom`,l=[`redFactor`,`greenFactor`,`blueFactor`,`baseShift`],u=e.value.encoding?`"${e.value.encoding}"`:`Default`;for(let s in n)!c&&l.includes(s)?o.push(new F(s,n[s],`In "${t}": "${s}" is only valid when "encoding" is set to "custom". ${u} encoding found`)):i[s]?o=o.concat(e.validateSpec({key:s,value:n[s],valueSpec:i[s],validateSpec:e.validateSpec,style:a,styleSpec:r})):o.push(new F(s,n[s],`unknown property "${s}"`));return o}({sourceName:n,value:t,style:e.style,styleSpec:r,validateSpec:a}),s;case`geojson`:if(s=ji({key:n,value:t,valueSpec:r.source_geojson,style:i,styleSpec:r,validateSpec:a,objectElementValidators:Gi}),t.cluster)for(let e in t.clusterProperties){let[r,i]=t.clusterProperties[e],a=typeof r==`string`?[r,[`accumulated`],[`get`,e]]:r;s.push(...Fi({key:`${n}.${e}.map`,value:i,expressionContext:`cluster-map`})),s.push(...Fi({key:`${n}.${e}.reduce`,value:a,expressionContext:`cluster-reduce`}))}return s;case`video`:return ji({key:n,value:t,valueSpec:r.source_video,style:i,validateSpec:a,styleSpec:r});case`image`:return ji({key:n,value:t,valueSpec:r.source_image,style:i,validateSpec:a,styleSpec:r});case`canvas`:return[new F(n,null,`Please use runtime APIs to add canvas sources, rather than including them in stylesheets.`,`source.canvas`)];default:return Li({key:`${n}.type`,value:t.type,valueSpec:{values:[`vector`,`raster`,`raster-dem`,`geojson`,`video`,`image`]}})}}function qi(e){let t=e.value,n=e.styleSpec,r=n.light,i=e.style,a=[],o=q(t);if(t===void 0)return a;if(o!==`object`)return a=a.concat([new F(`light`,t,`object expected, ${o} found`)]),a;for(let o in t){let s=o.match(/^(.*)-transition$/);a=a.concat(s&&r[s[1]]&&r[s[1]].transition?e.validateSpec({key:o,value:t[o],valueSpec:n.transition,validateSpec:e.validateSpec,style:i,styleSpec:n}):r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],validateSpec:e.validateSpec,style:i,styleSpec:n}):[new F(o,t[o],`unknown property "${o}"`)])}return a}function Ji(e){let t=e.value,n=e.styleSpec,r=n.sky,i=e.style,a=q(t);if(t===void 0)return[];if(a!==`object`)return[new F(`sky`,t,`object expected, ${a} found`)];let o=[];for(let a in t)o=o.concat(r[a]?e.validateSpec({key:a,value:t[a],valueSpec:r[a],style:i,styleSpec:n}):[new F(a,t[a],`unknown property "${a}"`)]);return o}function Yi(e){let t=e.value,n=e.styleSpec,r=n.terrain,i=e.style,a=[],o=q(t);if(t===void 0)return a;if(o!==`object`)return a=a.concat([new F(`terrain`,t,`object expected, ${o} found`)]),a;for(let o in t)a=a.concat(r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],validateSpec:e.validateSpec,style:i,styleSpec:n}):[new F(o,t[o],`unknown property "${o}"`)]);return a}function Xi(e){let t=[],n=e.value,r=e.key;if(Array.isArray(n)){let i=[],a=[];for(let o in n)n[o].id&&i.includes(n[o].id)&&t.push(new F(r,n,`all the sprites' ids must be unique, but ${n[o].id} is duplicated`)),i.push(n[o].id),n[o].url&&a.includes(n[o].url)&&t.push(new F(r,n,`all the sprites' URLs must be unique, but ${n[o].url} is duplicated`)),a.push(n[o].url),t=t.concat(ji({key:`${r}[${o}]`,value:n[o],valueSpec:{id:{type:`string`,required:!0},url:{type:`string`,required:!0}},validateSpec:e.validateSpec}));return t}return Wi({key:r,value:n})}function Zi(e){return!!e&&e.constructor===Object}function Qi(e){return Zi(e.value)?[]:[new F(e.key,e.value,`object expected, ${q(e.value)} found`)]}let $i={"*":()=>[],array:Mi,boolean:function(e){let t=e.value,n=e.key,r=q(t);return r===`boolean`?[]:[new F(n,t,`boolean expected, ${r} found`)]},number:Ni,color:Ii,constants:Oi,enum:Li,filter:Ri,function:Pi,layer:Ui,object:ji,source:Ki,light:qi,sky:Ji,terrain:Yi,projection:function(e){let t=e.value,n=e.styleSpec,r=n.projection,i=e.style,a=q(t);if(t===void 0)return[];if(a!==`object`)return[new F(`projection`,t,`object expected, ${a} found`)];let o=[];for(let a in t)o=o.concat(r[a]?e.validateSpec({key:a,value:t[a],valueSpec:r[a],style:i,styleSpec:n}):[new F(a,t[a],`unknown property "${a}"`)]);return o},projectionDefinition:function(e){let t=e.key,n=e.value;n=n instanceof String?n.valueOf():n;let r=q(n);return r!==`array`||function(e){return Array.isArray(e)&&e.length===3&&typeof e[0]==`string`&&typeof e[1]==`string`&&typeof e[2]==`number`}(n)||function(e){return!![`interpolate`,`step`,`literal`].includes(e[0])}(n)?[`array`,`string`].includes(r)?[]:[new F(t,n,`projection expected, invalid type "${r}" found`)]:[new F(t,n,`projection expected, invalid array ${JSON.stringify(n)} found`)]},string:Wi,formatted:function(e){return Wi(e).length===0?[]:Fi(e)},resolvedImage:function(e){return Wi(e).length===0?[]:Fi(e)},padding:function(e){let t=e.key,n=e.value;if(q(n)===`array`){if(n.length<1||n.length>4)return[new F(t,n,`padding requires 1 to 4 values; ${n.length} values found`)];let r={type:`number`},i=[];for(let a=0;a<n.length;a++)i=i.concat(e.validateSpec({key:`${t}[${a}]`,value:n[a],validateSpec:e.validateSpec,valueSpec:r}));return i}return Ni({key:t,value:n,valueSpec:{}})},numberArray:function(e){let t=e.key,n=e.value;if(q(n)===`array`){let r={type:`number`};if(n.length<1)return[new F(t,n,`array length at least 1 expected, length 0 found`)];let i=[];for(let a=0;a<n.length;a++)i=i.concat(e.validateSpec({key:`${t}[${a}]`,value:n[a],validateSpec:e.validateSpec,valueSpec:r}));return i}return Ni({key:t,value:n,valueSpec:{}})},colorArray:function(e){let t=e.key,n=e.value;if(q(n)===`array`){if(n.length<1)return[new F(t,n,`array length at least 1 expected, length 0 found`)];let e=[];for(let r=0;r<n.length;r++)e=e.concat(Ii({key:`${t}[${r}]`,value:n[r]}));return e}return Ii({key:t,value:n})},variableAnchorOffsetCollection:function(e){let t=e.key,n=e.value,r=q(n),i=e.styleSpec;if(r!==`array`||n.length<1||n.length%2!=0)return[new F(t,n,`variableAnchorOffsetCollection requires a non-empty array of even length`)];let a=[];for(let r=0;r<n.length;r+=2)a=a.concat(Li({key:`${t}[${r}]`,value:n[r],valueSpec:i.layout_symbol[`text-anchor`]})),a=a.concat(Mi({key:`${t}[${r+1}]`,value:n[r+1],valueSpec:{length:2,value:`number`},validateSpec:e.validateSpec,style:e.style,styleSpec:i}));return a},sprite:Xi,state:Qi,fontFaces:function(e){let t=e.key,n=e.value,r=e.validateSpec,i=e.styleSpec,a=e.style;if(!Zi(n))return[new F(t,n,`object expected, ${q(n)} found`)];let o=[];for(let e in n){let s=n[e],c=q(s);if(c===`string`)o.push(...Wi({key:`${t}.${e}`,value:s}));else if(c===`array`){let n={url:{type:`string`,required:!0},"unicode-range":{type:`array`,value:`string`}};for(let[c,l]of s.entries())o.push(...ji({key:`${t}.${e}[${c}]`,value:l,valueSpec:n,styleSpec:i,style:a,validateSpec:r}))}else o.push(new F(`${t}.${e}`,s,`string or array expected, ${c} found`))}return o}};function ea(e){let t=e.value,n=e.valueSpec,r=e.styleSpec;return e.validateSpec=ea,n.expression&&Qr(ki(t))?Pi(e):n.expression&&si(Ai(t))?Fi(e):n.type&&$i[n.type]?$i[n.type](e):ji(Ze({},e,{valueSpec:n.type?r[n.type]:n}))}function ta(e){let t=e.value,n=e.key,r=Wi(e);return r.length||(t.indexOf(`{fontstack}`)===-1&&r.push(new F(n,t,`"glyphs" url must include a "{fontstack}" token`)),t.indexOf(`{range}`)===-1&&r.push(new F(n,t,`"glyphs" url must include a "{range}" token`))),r}function na(e,t=N){let n=[];return n=n.concat(ea({key:``,value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:ea,objectElementValidators:{glyphs:ta,"*":()=>[]}})),e.constants&&(n=n.concat(Oi({key:`constants`,value:e.constants}))),ia(n)}function ra(e){return function(t){return e(Object.assign({},t,{validateSpec:ea}))}}function ia(e){return[].concat(e).sort(((e,t)=>e.line-t.line))}function aa(e){return function(...t){return ia(e.apply(this,t))}}na.source=aa(ra(Ki)),na.sprite=aa(ra(Xi)),na.glyphs=aa(ra(ta)),na.light=aa(ra(qi)),na.sky=aa(ra(Ji)),na.terrain=aa(ra(Yi)),na.state=aa(ra(Qi)),na.layer=aa(ra(Ui)),na.filter=aa(ra(Ri)),na.paintProperty=aa(ra(Vi)),na.layoutProperty=aa(ra(Hi));let oa={type:`enum`,"property-type":`data-constant`,expression:{interpolated:!1,parameters:[`global-state`]},values:{visible:{},none:{}},transition:!1,default:`visible`};class sa{constructor(e,t){this._globalState=t,this.setValue(e)}evaluate(){return this._literalValue??this._compiledValue.evaluate({})}setValue(e){if(e==null||e===`visible`||e===`none`)return this._literalValue=e===`none`?`none`:`visible`,this._compiledValue=void 0,void(this._globalStateRefs=new Set);let t=ci(e,oa,this._globalState);if(t.result===`error`)throw this._literalValue=`visible`,this._compiledValue=void 0,Error(t.value.map((e=>`${e.key}: ${e.message}`)).join(`, `));this._literalValue=void 0,this._compiledValue=t.value,this._globalStateRefs=mi(t.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}let ca=N,la=na,ua=la.light,da=la.sky,fa=la.paintProperty,pa=la.layoutProperty;function ma(e,t){let n=!1;if(t?.length)for(let r of t)e.fire(new ze(Error(r.message))),n=!0;return n}class ha{constructor(e,t,n){let r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let i=new Int32Array(this.arrayBuffer);e=i[0],this.d=(t=i[1])+2*(n=i[2]);for(let e=0;e<this.d*this.d;e++){let t=i[3+e],n=i[3+e+1];r.push(t===n?null:i.subarray(t,n))}let a=i[3+r.length+1];this.keys=i.subarray(i[3+r.length],a),this.bboxes=i.subarray(a),this.insert=this._insertReadonly}else{this.d=t+2*n;for(let e=0;e<this.d*this.d;e++)r.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=n,this.scale=t/e,this.uid=0;let i=n/t*e;this.min=-i,this.max=e+i}insert(e,t,n,r,i){this._forEachCell(t,n,r,i,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(i)}_insertReadonly(){throw Error(`Cannot insert into a GridIndex created from an ArrayBuffer.`)}_insertCell(e,t,n,r,i,a){this.cells[i].push(a)}query(e,t,n,r,i){let a=this.min,o=this.max;if(e<=a&&t<=a&&o<=n&&o<=r&&!i)return[...this.keys];{let a=[];return this._forEachCell(e,t,n,r,this._queryCell,a,{},i),a}}_queryCell(e,t,n,r,i,a,o,s){let c=this.cells[i];if(c!==null){let i=this.keys,l=this.bboxes;for(let u of c)if(o[u]===void 0){let c=4*u;(s?s(l[c+0],l[c+1],l[c+2],l[c+3]):e<=l[c+2]&&t<=l[c+3]&&n>=l[c+0]&&r>=l[c+1])?(o[u]=!0,a.push(i[u])):o[u]=!1}}}_forEachCell(e,t,n,r,i,a,o,s){let c=this._convertToCellCoord(e),l=this._convertToCellCoord(t),u=this._convertToCellCoord(n),d=this._convertToCellCoord(r);for(let f=c;f<=u;f++)for(let c=l;c<=d;c++){let l=this.d*c+f;if((!s||s(this._convertFromCellCoord(f),this._convertFromCellCoord(c),this._convertFromCellCoord(f+1),this._convertFromCellCoord(c+1)))&&i.call(this,e,t,n,r,l,a,o,s))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,t=3+this.cells.length+1+1,n=0;for(let e of this.cells)n+=e.length;let r=new Int32Array(t+n+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let i=t;for(let t=0;t<e.length;t++){let n=e[t];r[3+t]=i,r.set(n,i),i+=n.length}return r[3+e.length]=i,r.set(this.keys,i),i+=this.keys.length,r[3+e.length+1]=i,r.set(this.bboxes,i),i+=this.bboxes.length,r.buffer}static serialize(e,t){let n=e.toArrayBuffer();return t&&t.push(n),{buffer:n}}static deserialize(e){return new ha(e.buffer)}}let ga={};function J(e,t,n={}){if(ga[e])throw Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),ga[e]={klass:t,omit:n.omit||[],shallow:n.shallow||[]}}J(`Object`,Object),J(`Set`,Set),J(`TransferableGridIndex`,ha),J(`Color`,V),J(`Error`,Error),J(`AJAXError`,Me),J(`ResolvedImage`,Yt),J(`StylePropertyFunction`,fi),J(`StyleExpression`,oi,{omit:[`_evaluator`]}),J(`ZoomDependentExpression`,ui),J(`ZoomConstantExpression`,li),J(`CompoundExpression`,Rr,{omit:[`_evaluate`]});for(let e in Lr)Lr[e]._classRegistryKey||J(`Expression_${e}`,Lr[e]);function _a(e){return e&&typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||e.constructor?.name===`ArrayBuffer`)}function va(e){return e.$name||e.constructor._classRegistryKey}function ya(e){return!function(e){if(typeof e!=`object`||!e)return!1;let t=va(e);return t&&t!==`Object`}(e)&&(e==null||typeof e==`boolean`||typeof e==`number`||typeof e==`string`||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||_a(e)||he(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function ba(e,t){if(ya(e))return(_a(e)||he(e))&&t&&t.push(e),ArrayBuffer.isView(e)&&t&&t.push(e.buffer),e instanceof ImageData&&t&&t.push(e.data.buffer),e;if(Array.isArray(e)){let n=[];for(let r of e)n.push(ba(r,t));return n}if(typeof e!=`object`)throw Error(`can't serialize object of type `+typeof e);let n=va(e);if(!n)throw Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!ga[n])throw Error(`${n} is not registered.`);let{klass:r}=ga[n],i=r.serialize?r.serialize(e,t):{};if(r.serialize){if(i===t?.[t.length-1])throw Error(`statically serialized object won't survive transfer of $name property`)}else{for(let r in e){if(!e.hasOwnProperty(r)||ga[n].omit.includes(r))continue;let a=e[r];i[r]=ga[n].shallow.includes(r)?a:ba(a,t)}e instanceof Error&&(i.message=e.message)}if(i.$name)throw Error(`$name property is reserved for worker serialization logic.`);return n!==`Object`&&(i.$name=n),i}function xa(e){if(ya(e))return e;if(Array.isArray(e))return e.map(xa);if(typeof e!=`object`)throw Error(`can't deserialize object of type `+typeof e);let t=va(e)||`Object`;if(!ga[t])throw Error(`can't deserialize unregistered class ${t}`);let{klass:n}=ga[t];if(!n)throw Error(`can't deserialize unregistered class ${t}`);if(n.deserialize)return n.deserialize(e);let r=Object.create(n.prototype);for(let n of Object.keys(e)){if(n===`$name`)continue;let i=e[n];r[n]=ga[t].shallow.includes(n)?i:xa(i)}return r}class Sa{constructor(){this.first=!0}update(e,t){let n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=n,!0))}}function Ca(e){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\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(e))}function wa(e){return/[\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))}function Ta(e){return/\s/u.test(String.fromCodePoint(e))}function Ea(e){for(let t of e)if(wa(t.codePointAt(0)))return!0;return!1}function Da(e){for(let t of e)if(!Aa(t.codePointAt(0)))return!1;return!0}function Oa(e){let t=e.map((e=>{try{return RegExp(`\\p{sc=${e}}`,`u`).source}catch{return null}})).filter((e=>e));return new RegExp(t.join(`|`),`u`)}let ka=Oa([`Arab`,`Dupl`,`Mong`,`Ougr`,`Syrc`]);function Aa(e){return!ka.test(String.fromCodePoint(e))}function ja(e){return!(wa(e)||(t=e,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(t))));var t}let Ma=Oa(`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`.split(`.`));function Na(e){return Ma.test(String.fromCodePoint(e))}function Pa(e,t){return!(!t&&Na(e)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(e)))}function Fa(e){for(let t of e)if(Na(t.codePointAt(0)))return!0;return!1}let Ia=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus=`unavailable`,this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(Ia.isParsed())throw Error(`RTL text plugin already registered.`);this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(e,n){return t(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if(e.pluginStatus!==`loading`)return this.setState(e),e;let t=e.pluginURL,r=new Promise((e=>{this.loadScriptResolve=e}));n(t);let i=new Promise((e=>setTimeout((()=>e()),this.TIMEOUT)));if(yield Promise.race([r,i]),this.isParsed()){let e={pluginStatus:`loaded`,pluginURL:t};return this.setState(e),e}throw this.setState({pluginStatus:`error`,pluginURL:``}),Error(`RTL Text Plugin failed to import scripts from ${t}`)}))}};class Y{constructor(e,t){this.isSupportedScript=La,this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new Sa,this.transition=t.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Sa,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*t}}}function La(e){return function(e,t){for(let n of e)if(!Pa(n.codePointAt(0),t))return!1;return!0}(e,Ia.getRTLTextPluginStatus()===`loaded`)}let Ra=`-transition`;class za{constructor(e,t,n){this.property=e,this.value=t,this.expression=function(e,t,n){if(Qr(e))return new fi(e,t);if(si(e)){let r=di(e,t,n);if(r.result===`error`)throw Error(r.value.map((e=>`${e.key}: ${e.message}`)).join(`, `));return r.value}{let n=e;return t.type===`color`&&typeof e==`string`?n=V.parse(e):t.type!==`padding`||typeof e!=`number`&&!Array.isArray(e)?t.type!==`numberArray`||typeof e!=`number`&&!Array.isArray(e)?t.type!==`colorArray`||typeof e!=`string`&&!Array.isArray(e)?t.type===`variableAnchorOffsetCollection`&&Array.isArray(e)?n=Jt.parse(e):t.type===`projectionDefinition`&&typeof e==`string`&&(n=Xt.parse(e)):n=Gt.parse(e):n=Wt.parse(e):n=Ut.parse(e),{globalStateRefs:new Set,_globalState:null,kind:`constant`,evaluate:()=>n}}}(t===void 0?e.specification.default:t,e.specification,n)}isDataDriven(){return this.expression.kind===`source`||this.expression.kind===`composite`}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,t,n){return this.property.possiblyEvaluate(this,e,t,n)}}class Ba{constructor(e,t){this.property=e,this.value=new za(e,void 0,t)}transitioned(e,t){return new Ha(this.property,this.value,t,oe({},e.transition,this.transition),e.now)}untransitioned(){return new Ha(this.property,this.value,null,{},0)}}class Va{constructor(e,t){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=t}hasProperty(e){return e in this._properties.defaultTransitionablePropertyValues}getValue(e){return M(this._values[e].value.value)}setValue(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new Ba(this._values[e].property,this._globalState)),this._values[e].value=new za(this._values[e].property,t===null?void 0:M(t),this._globalState)}getTransition(e){return M(this._values[e].transition)}setTransition(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new Ba(this._values[e].property,this._globalState)),this._values[e].transition=M(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let n=this.getValue(t);n!==void 0&&(e[t]=n);let r=this.getTransition(t);r!==void 0&&(e[`${t}${Ra}`]=r)}return e}transitioned(e,t){let n=new Ua(this._properties);for(let r of Object.keys(this._values))n._values[r]=this._values[r].transitioned(e,t._values[r]);return n}untransitioned(){let e=new Ua(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class Ha{constructor(e,t,n,r,i){this.property=e,this.value=t,this.begin=i+r.delay||0,this.end=this.begin+r.duration||0,e.specification.transition&&(r.delay||r.duration)&&(this.prior=n)}possiblyEvaluate(e,t,n){let r=e.now||0,i=this.value.possiblyEvaluate(e,t,n),a=this.prior;if(a){if(r>this.end||this.value.isDataDriven())return this.prior=null,i;if(r<this.begin)return a.possiblyEvaluate(e,t,n);{let o=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,n),i,j(o))}}return i}}class Ua{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,n){let r=new Ka(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].possiblyEvaluate(e,t,n);return r}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Wa{constructor(e,t){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=t}hasValue(e){return this._values[e].value!==void 0}hasProperty(e){return e in this._properties.defaultPropertyValues}getValue(e){return M(this._values[e].value)}setValue(e,t){this._values[e]=new za(this._values[e].property,t===null?void 0:M(t),this._globalState)}serialize(){let e={};for(let t of Object.keys(this._values)){let n=this.getValue(t);n!==void 0&&(e[t]=n)}return e}possiblyEvaluate(e,t,n){let r=new Ka(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].possiblyEvaluate(e,t,n);return r}}class Ga{constructor(e,t,n){this.property=e,this.value=t,this.parameters=n}isConstant(){return this.value.kind===`constant`}constantOr(e){return this.value.kind===`constant`?this.value.value:e}evaluate(e,t,n,r){return this.property.evaluate(this.value,this.parameters,e,t,n,r)}}class Ka{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class X{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw Error(`Value should not be data driven`);return e.expression.evaluate(t)}interpolate(e,t,n){let r=Cn[this.specification.type];return r?r(e,t,n):e}}class Z{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,n,r){return new Ga(this,e.expression.kind===`constant`||e.expression.kind===`camera`?{kind:`constant`,value:e.expression.evaluate(t,null,{},n,r)}:e.expression,t)}interpolate(e,t,n){if(e.value.kind!==`constant`||t.value.kind!==`constant`)return e;if(e.value.value===void 0||t.value.value===void 0)return new Ga(this,{kind:`constant`,value:void 0},e.parameters);let r=Cn[this.specification.type];if(r){let i=r(e.value.value,t.value.value,n);return new Ga(this,{kind:`constant`,value:i},e.parameters)}return e}evaluate(e,t,n,r,i,a){return e.kind===`constant`?e.value:e.evaluate(t,n,r,i,a)}}class qa extends Z{possiblyEvaluate(e,t,n,r){if(e.value===void 0)return new Ga(this,{kind:`constant`,value:void 0},t);if(e.expression.kind===`constant`){let i=e.expression.evaluate(t,null,{},n,r),a=e.property.specification.type===`resolvedImage`&&typeof i!=`string`?i.name:i,o=this._calculate(a,a,a,t);return new Ga(this,{kind:`constant`,value:o},t)}if(e.expression.kind===`camera`){let n=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new Ga(this,{kind:`constant`,value:n},t)}return new Ga(this,e.expression,t)}evaluate(e,t,n,r,i,a){if(e.kind===`source`){let o=e.evaluate(t,n,r,i,a);return this._calculate(o,o,o,t)}return e.kind===`composite`?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},n,r),e.evaluate({zoom:Math.floor(t.zoom)},n,r),e.evaluate({zoom:Math.floor(t.zoom)+1},n,r),t):e.value}_calculate(e,t,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class Ja{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,r){if(e.value!==void 0){if(e.expression.kind===`constant`){let i=e.expression.evaluate(t,null,{},n,r);return this._calculate(i,i,i,t)}return this._calculate(e.expression.evaluate(new Y(Math.floor(t.zoom-1),t)),e.expression.evaluate(new Y(Math.floor(t.zoom),t)),e.expression.evaluate(new Y(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class Ya{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,r){return!!e.expression.evaluate(t,null,{},n,r)}interpolate(){return!1}}class Xa{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let n=e[t];n.specification.overridable&&this.overridableProperties.push(t);let r=this.defaultPropertyValues[t]=new za(n,void 0,void 0),i=this.defaultTransitionablePropertyValues[t]=new Ba(n,void 0);this.defaultTransitioningPropertyValues[t]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}}J(`DataDrivenProperty`,Z),J(`DataConstantProperty`,X),J(`CrossFadedDataDrivenProperty`,qa),J(`CrossFadedProperty`,Ja),J(`ColorRampProperty`,Ya);let Za=` is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?`,Qa=` is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?`;class $a extends Be{constructor(e,t,n){if(super(),this.id=e.id,this.type=e.type,this._globalState=n,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=function(e,t){return new sa(e,t)}(this.visibility,n),e.type!==`custom`&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!==`background`&&(this.source=e.source,this.sourceLayer=e[`source-layer`],this.filter=e.filter,this._featureFilter=vi(e.filter,n)),t.layout&&(this._unevaluatedLayout=new Wa(t.layout,n)),t.paint)){this._transitionablePaint=new Va(t.paint,n);for(let t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(let t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ka(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=vi(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){if(e===`visibility`)return this.visibility;if(this._transitionablePaint?.hasProperty(e))throw Error(e+Za);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${e}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;for(let t of this._visibilityExpression.getGlobalStateRefs())e.add(t);if(this._unevaluatedLayout)for(let t in this._unevaluatedLayout._values){let n=this._unevaluatedLayout._values[t];for(let t of n.getGlobalStateRefs())e.add(t)}for(let t of this._featureFilter.getGlobalStateRefs())e.add(t);return e}getPaintAffectingGlobalStateRefs(){let e=new globalThis.Map;if(this._transitionablePaint)for(let t in this._transitionablePaint._values){let n=this._transitionablePaint._values[t].value;for(let r of n.getGlobalStateRefs()){let i=e.get(r)??[];i.push({name:t,value:n.value}),e.set(r,i)}}return e}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,t,n={}){if(e===`visibility`)return this.visibility=t,this._visibilityExpression.setValue(t),void this.recalculateVisibility();this._transitionablePaint?.hasProperty(e)?this.fire(new ze(Error(e+Za))):t!=null&&this._validate(pa,`layers.${this.id}.layout.${e}`,e,t,n)||this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){if(e.endsWith(Ra)){let t=e.slice(0,-11);if(t===`visibility`||this._unevaluatedLayout?.hasProperty(t))throw Error(e+Qa);return this._transitionablePaint.getTransition(t)}if(e===`visibility`||this._unevaluatedLayout?.hasProperty(e))throw Error(e+Qa);return this._transitionablePaint.getValue(e)}setPaintProperty(e,t,n={}){if(e===`visibility`||this._unevaluatedLayout?.hasProperty(e))return this.fire(new ze(Error(e+Qa))),!1;if(t!=null&&this._validate(fa,`layers.${this.id}.paint.${e}`,e,t,n))return!1;if(e.endsWith(Ra))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{let n=this._transitionablePaint._values[e],r=n.property.specification[`property-type`]===`cross-faded-data-driven`,i=n.value.isDataDriven(),a=n.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let o=this._transitionablePaint._values[e].value;return o.isDataDriven()||i||r||this._handleOverridablePaintPropertyUpdate(e,a,o)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,n){return!1}isHidden(e=this.minzoom,t=!1){return!!(this.minzoom&&e<(t?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&e>=this.maxzoom)||this._evaluatedVisibility===`none`}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){let e={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:this._unevaluatedLayout?.serialize(),paint:this._transitionablePaint?.serialize()};return this.visibility&&(e.layout||={},e.layout.visibility=this.visibility),le(e,((e,t)=>!(e===void 0||t===`layout`&&!Object.keys(e).length||t===`paint`&&!Object.keys(e).length)))}_validate(e,t,n,r,i={}){return!1!==i?.validate&&ma(this,e.call(la,{key:t,layerType:this.type,objectKey:n,value:r,styleSpec:N,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let t=this.paint.get(e);if(t instanceof Ga&&Yr(t.property.specification)&&(t.value.kind===`source`||t.value.kind===`composite`)&&t.value.isStateDependent)return!0}return!1}}let eo;var to={get paint(){return eo||=new Xa({"raster-opacity":new X(N.paint_raster[`raster-opacity`]),"raster-hue-rotate":new X(N.paint_raster[`raster-hue-rotate`]),"raster-brightness-min":new X(N.paint_raster[`raster-brightness-min`]),"raster-brightness-max":new X(N.paint_raster[`raster-brightness-max`]),"raster-saturation":new X(N.paint_raster[`raster-saturation`]),"raster-contrast":new X(N.paint_raster[`raster-contrast`]),resampling:new X(N.paint_raster.resampling),"raster-resampling":new X(N.paint_raster[`raster-resampling`]),"raster-fade-duration":new X(N.paint_raster[`raster-fade-duration`])})}};class no extends $a{constructor(e,t){super(e,to,t)}}let ro={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class io{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ao{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw Error(`_refreshViews() must be implemented by each concrete StructArray layout`)}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}}function oo(e,t=1){let n=0,r=0;return{members:e.map((e=>{let i=ro[e.type].BYTES_PER_ELEMENT,a=n=so(n,Math.max(t,i)),o=e.components||1;return r=Math.max(r,i),n+=i*o,{name:e.name,type:e.type,components:o,offset:a}})),size:so(n,Math.max(r,t)),alignment:t}}function so(e,t){return Math.ceil(e/t)*t}class co extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let r=2*e;return this.int16[r+0]=t,this.int16[r+1]=n,e}}co.prototype.bytesPerElement=4,J(`StructArrayLayout2i4`,co);class lo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.int16[i+0]=t,this.int16[i+1]=n,this.int16[i+2]=r,e}}lo.prototype.bytesPerElement=6,J(`StructArrayLayout3i6`,lo);class uo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r)}emplace(e,t,n,r,i){let a=4*e;return this.int16[a+0]=t,this.int16[a+1]=n,this.int16[a+2]=r,this.int16[a+3]=i,e}}uo.prototype.bytesPerElement=8,J(`StructArrayLayout4i8`,uo);class fo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,e}}fo.prototype.bytesPerElement=12,J(`StructArrayLayout2i4i12`,fo);class po extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=4*e,c=8*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.uint8[c+4]=r,this.uint8[c+5]=i,this.uint8[c+6]=a,this.uint8[c+7]=o,e}}po.prototype.bytesPerElement=8,J(`StructArrayLayout2i4ub8`,po);class mo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let r=2*e;return this.float32[r+0]=t,this.float32[r+1]=n,e}}mo.prototype.bytesPerElement=8,J(`StructArrayLayout2f8`,mo);class ho extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c,l){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,n,r,i,a,o,s,c,l)}emplace(e,t,n,r,i,a,o,s,c,l,u){let d=10*e;return this.uint16[d+0]=t,this.uint16[d+1]=n,this.uint16[d+2]=r,this.uint16[d+3]=i,this.uint16[d+4]=a,this.uint16[d+5]=o,this.uint16[d+6]=s,this.uint16[d+7]=c,this.uint16[d+8]=l,this.uint16[d+9]=u,e}}ho.prototype.bytesPerElement=20,J(`StructArrayLayout10ui20`,ho);class go extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s){let c=this.length;return this.resize(c+1),this.emplace(c,e,t,n,r,i,a,o,s)}emplace(e,t,n,r,i,a,o,s,c){let l=8*e;return this.uint16[l+0]=t,this.uint16[l+1]=n,this.uint16[l+2]=r,this.uint16[l+3]=i,this.uint16[l+4]=a,this.uint16[l+5]=o,this.uint16[l+6]=s,this.uint16[l+7]=c,e}}go.prototype.bytesPerElement=16,J(`StructArrayLayout8ui16`,go);class _o extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c,l,u,d){let f=this.length;return this.resize(f+1),this.emplace(f,e,t,n,r,i,a,o,s,c,l,u,d)}emplace(e,t,n,r,i,a,o,s,c,l,u,d,f){let p=12*e;return this.int16[p+0]=t,this.int16[p+1]=n,this.int16[p+2]=r,this.int16[p+3]=i,this.uint16[p+4]=a,this.uint16[p+5]=o,this.uint16[p+6]=s,this.uint16[p+7]=c,this.int16[p+8]=l,this.int16[p+9]=u,this.int16[p+10]=d,this.int16[p+11]=f,e}}_o.prototype.bytesPerElement=24,J(`StructArrayLayout4i4ui4i24`,_o);class vo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.float32[i+0]=t,this.float32[i+1]=n,this.float32[i+2]=r,e}}vo.prototype.bytesPerElement=12,J(`StructArrayLayout3f12`,vo);class yo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}yo.prototype.bytesPerElement=4,J(`StructArrayLayout1ul4`,yo);class bo extends ao{_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(e,t,n,r,i,a,o,s,c){let l=this.length;return this.resize(l+1),this.emplace(l,e,t,n,r,i,a,o,s,c)}emplace(e,t,n,r,i,a,o,s,c,l){let u=10*e,d=5*e;return this.int16[u+0]=t,this.int16[u+1]=n,this.int16[u+2]=r,this.int16[u+3]=i,this.int16[u+4]=a,this.int16[u+5]=o,this.uint32[d+3]=s,this.uint16[u+8]=c,this.uint16[u+9]=l,e}}bo.prototype.bytesPerElement=20,J(`StructArrayLayout6i1ul2ui20`,bo);class xo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,e}}xo.prototype.bytesPerElement=12,J(`StructArrayLayout2i2i2i12`,xo);class So extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,r,i)}emplace(e,t,n,r,i,a){let o=4*e,s=8*e;return this.float32[o+0]=t,this.float32[o+1]=n,this.float32[o+2]=r,this.int16[s+6]=i,this.int16[s+7]=a,e}}So.prototype.bytesPerElement=16,J(`StructArrayLayout2f1f2i16`,So);class Co extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=16*e,c=4*e,l=8*e;return this.uint8[s+0]=t,this.uint8[s+1]=n,this.float32[c+1]=r,this.float32[c+2]=i,this.int16[l+6]=a,this.int16[l+7]=o,e}}Co.prototype.bytesPerElement=16,J(`StructArrayLayout2ub2f2i16`,Co);class wo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.uint16[i+0]=t,this.uint16[i+1]=n,this.uint16[i+2]=r,e}}wo.prototype.bytesPerElement=6,J(`StructArrayLayout3ui6`,wo);class To extends ao{_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(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){let _=this.length;return this.resize(_+1),this.emplace(_,e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}emplace(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){let v=24*e,y=12*e,b=48*e;return this.int16[v+0]=t,this.int16[v+1]=n,this.uint16[v+2]=r,this.uint16[v+3]=i,this.uint32[y+2]=a,this.uint32[y+3]=o,this.uint32[y+4]=s,this.uint16[v+10]=c,this.uint16[v+11]=l,this.uint16[v+12]=u,this.float32[y+7]=d,this.float32[y+8]=f,this.uint8[b+36]=p,this.uint8[b+37]=m,this.uint8[b+38]=h,this.uint32[y+10]=g,this.int16[v+22]=_,e}}To.prototype.bytesPerElement=48,J(`StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48`,To);class Eo extends ao{_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(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D){let O=this.length;return this.resize(O+1),this.emplace(O,e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D)}emplace(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O){let k=32*e,A=16*e;return this.int16[k+0]=t,this.int16[k+1]=n,this.int16[k+2]=r,this.int16[k+3]=i,this.int16[k+4]=a,this.int16[k+5]=o,this.int16[k+6]=s,this.int16[k+7]=c,this.uint16[k+8]=l,this.uint16[k+9]=u,this.uint16[k+10]=d,this.uint16[k+11]=f,this.uint16[k+12]=p,this.uint16[k+13]=m,this.uint16[k+14]=h,this.uint16[k+15]=g,this.uint16[k+16]=_,this.uint16[k+17]=v,this.uint16[k+18]=y,this.uint16[k+19]=b,this.uint16[k+20]=x,this.uint16[k+21]=S,this.uint16[k+22]=C,this.uint32[A+12]=w,this.float32[A+13]=T,this.float32[A+14]=E,this.uint16[k+30]=D,this.uint16[k+31]=O,e}}Eo.prototype.bytesPerElement=64,J(`StructArrayLayout8i15ui1ul2f2ui64`,Eo);class Do extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}Do.prototype.bytesPerElement=4,J(`StructArrayLayout1f4`,Do);class Oo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.uint16[6*e+0]=t,this.float32[i+1]=n,this.float32[i+2]=r,e}}Oo.prototype.bytesPerElement=12,J(`StructArrayLayout1ui2f12`,Oo);class ko extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=4*e;return this.uint32[2*e+0]=t,this.uint16[i+2]=n,this.uint16[i+3]=r,e}}ko.prototype.bytesPerElement=8,J(`StructArrayLayout1ul2ui8`,ko);class Ao extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=n,e}}Ao.prototype.bytesPerElement=4,J(`StructArrayLayout2ui4`,Ao);class jo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}jo.prototype.bytesPerElement=2,J(`StructArrayLayout1ui2`,jo);class Mo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r)}emplace(e,t,n,r,i){let a=4*e;return this.float32[a+0]=t,this.float32[a+1]=n,this.float32[a+2]=r,this.float32[a+3]=i,e}}Mo.prototype.bytesPerElement=16,J(`StructArrayLayout4f16`,Mo);class No extends io{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 n(this.anchorPointX,this.anchorPointY)}}No.prototype.size=20;class Po extends bo{get(e){return new No(this,e)}}J(`CollisionBoxArray`,Po);class Fo extends io{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Fo.prototype.size=48;class Io extends To{get(e){return new Fo(this,e)}}J(`PlacedSymbolArray`,Io);class Lo extends io{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(e){this._structArray.uint32[this._pos4+12]=e}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]}}Lo.prototype.size=64;class Ro extends Eo{get(e){return new Lo(this,e)}}J(`SymbolInstanceArray`,Ro);class zo extends Do{getoffsetX(e){return this.float32[1*e+0]}}J(`GlyphOffsetArray`,zo);class Bo extends lo{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}J(`SymbolLineVertexArray`,Bo);class Vo extends io{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]}}Vo.prototype.size=12;class Ho extends Oo{get(e){return new Vo(this,e)}}J(`TextAnchorOffsetArray`,Ho);class Uo extends io{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]}}Uo.prototype.size=8;class Wo extends ko{get(e){return new Uo(this,e)}}J(`FeatureIndexArray`,Wo);class Go extends co{}class Ko extends co{}class qo extends co{}class Jo extends fo{}class Yo extends po{}class Xo extends mo{}class Zo extends ho{}class Qo extends go{}class $o extends _o{}class es extends vo{}class ts extends yo{}class ns extends xo{}class rs extends Co{}class is extends wo{}class as extends Ao{}let{members:os}=oo([{name:`a_pos`,components:2,type:`Int16`}],4);class ss{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,t,n,r){let i=this.segments[this.segments.length-1];return e>ss.MAX_VERTEX_ARRAY_LENGTH&&de(`Max vertices per segment is ${ss.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${ss.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!i||i.vertexLength+e>ss.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==r?this.createNewSegment(t,n,r):i}createNewSegment(e,t,n){let r={vertexOffset:e.length,primitiveOffset:t.length,vertexLength:0,primitiveLength:0,vaos:{}};return n!==void 0&&(r.sortKey=n),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(r),r}getOrCreateLatestSegment(e,t,n){return this.prepareSegment(0,e,t,n)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,n,r){return new ss([{vertexOffset:e,primitiveOffset:t,vertexLength:n,primitiveLength:r,vaos:{},sortKey:0}])}}function cs(e,t){return 256*(e=ie(Math.floor(e),0,255))+ie(Math.floor(t),0,255)}ss.MAX_VERTEX_ARRAY_LENGTH=2**16-1,J(`SegmentVector`,ss);let ls=oo([{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`}]),us=oo([{name:`a_dasharray_from`,components:4,type:`Uint16`},{name:`a_dasharray_to`,components:4,type:`Uint16`}]);var ds,fs,ps,ms={exports:{}},hs={exports:{}},gs={exports:{}},_s=r(function(){if(ps)return ms.exports;ps=1;var e=(ds||(ds=1,hs.exports=function(e,t){var n,r,i,a,o,s,c,l;for(r=e.length-(n=3&e.length),i=t,o=3432918353,s=461845907,l=0;l<r;)c=255&e.charCodeAt(l)|(255&e.charCodeAt(++l))<<8|(255&e.charCodeAt(++l))<<16|(255&e.charCodeAt(++l))<<24,++l,i=27492+(65535&(a=5*(65535&(i=(i^=c=(65535&(c=(c=(65535&c)*o+(((c>>>16)*o&65535)<<16)&4294967295)<<15|c>>>17))*s+(((c>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(c=0,n){case 3:c^=(255&e.charCodeAt(l+2))<<16;case 2:c^=(255&e.charCodeAt(l+1))<<8;case 1:i^=c=(65535&(c=(c=(65535&(c^=255&e.charCodeAt(l)))*o+(((c>>>16)*o&65535)<<16)&4294967295)<<15|c>>>17))*s+(((c>>>16)*s&65535)<<16)&4294967295}return i^=e.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}),hs.exports),t=(fs||(fs=1,gs.exports=function(e,t){for(var n,r=e.length,i=t^r,a=0;r>=4;)n=1540483477*(65535&(n=255&e.charCodeAt(a)|(255&e.charCodeAt(++a))<<8|(255&e.charCodeAt(++a))<<16|(255&e.charCodeAt(++a))<<24))+((1540483477*(n>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),r-=4,++a;switch(r){case 3:i^=(255&e.charCodeAt(a+2))<<16;case 2:i^=(255&e.charCodeAt(a+1))<<8;case 1:i=1540483477*(65535&(i^=255&e.charCodeAt(a)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}),gs.exports);return ms.exports=e,ms.exports.murmur3=e,ms.exports.murmur2=t,ms.exports}());class vs{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,n,r){this.ids.push(ys(e)),this.positions.push(t,n,r)}getPositions(e){if(!this.indexed)throw Error(`Trying to get index, but feature positions are not indexed`);let t=ys(e),n=0,r=this.ids.length-1;for(;n<r;){let e=n+r>>1;this.ids[e]>=t?r=e:n=e+1}let i=[];for(;this.ids[n]===t;)i.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return i}static serialize(e,t){let n=new Float64Array(e.ids),r=new Uint32Array(e.positions);return bs(n,r,0,n.length-1),t&&t.push(n.buffer,r.buffer),{ids:n,positions:r}}static deserialize(e){let t=new vs;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function ys(e){let t=+e;return!isNaN(t)&&t<=2**53-1?t:_s(String(e))}function bs(e,t,n,r){for(;n<r;){let i=e[n+r>>1],a=n-1,o=r+1;for(;;){do a++;while(e[a]<i);do o--;while(e[o]>i);if(a>=o)break;xs(e,a,o),xs(t,3*a,3*o),xs(t,3*a+1,3*o+1),xs(t,3*a+2,3*o+2)}o-n<r-o?(bs(e,t,n,o),n=o+1):(bs(e,t,o+1,r),r=o)}}function xs(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}J(`FeaturePositionMap`,vs);class Ss{constructor(e,t){this.gl=e.gl,this.location=t}}class Cs extends Ss{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class ws extends Ss{constructor(e,t){super(e,t),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class Ts extends Ss{constructor(e,t){super(e,t),this.current=V.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}let Es=new Float32Array(16);function Ds(e){return[cs(255*e.r,255*e.g),cs(255*e.b,255*e.a)]}class Os{constructor(e,t,n){this.value=e,this.uniformNames=t.map((e=>`u_${e}`)),this.type=n}setUniform(e,t,n){e.set(n.constantOr(this.value))}getBinding(e,t,n){return this.type===`color`?new Ts(e,t):new Cs(e,t)}}class ks{constructor(e,t){this.uniformNames=t.map((e=>`u_${e}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,t){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,t.y,t.height,t.width]}setUniform(e,t,n,r){let i=null;r===`u_pattern_to`?i=this.patternTo:r===`u_pattern_from`?i=this.patternFrom:r===`u_dasharray_to`?i=this.dashTo:r===`u_dasharray_from`?i=this.dashFrom:r===`u_pixel_ratio_to`?i=this.pixelRatioTo:r===`u_pixel_ratio_from`&&(i=this.pixelRatioFrom),i!==null&&e.set(i)}getBinding(e,t,n){return n.startsWith(`u_pattern`)||n.startsWith(`u_dasharray_`)?new ws(e,t):new Cs(e,t)}}class As{constructor(e,t,n,r){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:`Float32`,components:n===`color`?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(e,t,n){let r=this.paintVertexArray.length,i=this.expression.evaluate(new Y(0,n),t,{},n.canonical,[],n.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(r,e,i)}updatePaintArray(e,t,n,r,i){let a=this.expression.evaluate(new Y(0,i),n,r);this._setPaintValue(e,t,a)}_setPaintValue(e,t,n){if(this.type===`color`){let r=Ds(n);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r[0],r[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){var t;(t=this.paintVertexArray)!=null&&t.arrayBuffer.byteLength&&(this.paintVertexBuffer?.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class js{constructor(e,t,n,r,i,a){this.expression=e,this.uniformNames=t.map((e=>`u_${e}_t`)),this.type=n,this.useIntegerZoom=r,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:`Float32`,components:n===`color`?4:2,offset:0}))),this.paintVertexArray=new a}populatePaintArray(e,t,n){let r=this.expression.evaluate(new Y(this.zoom,n),t,{},n.canonical,[],n.formattedSection),i=this.expression.evaluate(new Y(this.zoom+1,n),t,{},n.canonical,[],n.formattedSection),a=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(a,e,r,i)}updatePaintArray(e,t,n,r,i){let a=this.expression.evaluate(new Y(this.zoom,i),n,r),o=this.expression.evaluate(new Y(this.zoom+1,i),n,r);this._setPaintValue(e,t,a,o)}_setPaintValue(e,t,n,r){if(this.type===`color`){let i=Ds(n),a=Ds(r);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i[0],i[1],a[0],a[1])}else{for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,n,r);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(r))}}upload(e){var t;(t=this.paintVertexArray)!=null&&t.arrayBuffer.byteLength&&(this.paintVertexBuffer?.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){let n=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,r=ie(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(r)}getBinding(e,t,n){return new Cs(e,t)}}class Ms{constructor(e,t,n,r,i,a){this.expression=e,this.type=t,this.useIntegerZoom=n,this.zoom=r,this.layerId=a,this.zoomInPaintVertexArray=new i,this.zoomOutPaintVertexArray=new i}populatePaintArray(e,t,n){let r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(r,e,this.getPositionIds(t),n)}updatePaintArray(e,t,n,r,i){this._setPaintValues(e,t,this.getPositionIds(n),i)}_setPaintValues(e,t,n,r){let i=this.getPositions(r);if(!i||!n)return;let a=i[n.min],o=i[n.mid],s=i[n.max];if(a&&o&&s)for(let n=e;n<t;n++)this.emplace(this.zoomInPaintVertexArray,n,o,a),this.emplace(this.zoomOutPaintVertexArray,n,o,s)}upload(e){if(this.zoomInPaintVertexArray?.arrayBuffer.byteLength&&this.zoomOutPaintVertexArray?.arrayBuffer.byteLength){let t=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,t,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,t,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Ns extends Ms{getPositions(e){return e.imagePositions}getPositionIds(e){return e.patterns?.[this.layerId]}getVertexAttributes(){return ls.members}emplace(e,t,n,r){e.emplace(t,n.tlbr[0],n.tlbr[1],n.tlbr[2],n.tlbr[3],r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],n.pixelRatio,r.pixelRatio)}}class Ps extends Ms{getPositions(e){return e.dashPositions}getPositionIds(e){return e.dashes?.[this.layerId]}getVertexAttributes(){return us.members}emplace(e,t,n,r){e.emplace(t,0,n.y,n.height,n.width,0,r.y,r.height,r.width)}}class Fs{constructor(e,t,n){this.binders={},this._buffers=[];let r=[];for(let i in e.paint._values){if(!n(i))continue;let a=e.paint.get(i);if(!(a instanceof Ga&&Yr(a.property.specification)))continue;let o=Ls(i,e.type),s=a.value,c=a.property.specification.type,l=a.property.useIntegerZoom,u=a.property.specification[`property-type`],d=u===`cross-faded`||u===`cross-faded-data-driven`;if(s.kind===`constant`)this.binders[i]=d?new ks(s.value,o):new Os(s.value,o,c),r.push(`/u_${i}`);else if(s.kind===`source`||d){let n=Rs(i,c,`source`);this.binders[i]=d?i===`line-dasharray`?new Ps(s,c,l,t,n,e.id):new Ns(s,c,l,t,n,e.id):new As(s,o,c,n),r.push(`/a_${i}`)}else{let e=Rs(i,c,`composite`);this.binders[i]=new js(s,o,c,l,t,e),r.push(`/z_${i}`)}}this.cacheKey=r.sort().join(``)}getMaxValue(e){let t=this.binders[e];return t instanceof As||t instanceof js?t.maxValue:0}populatePaintArrays(e,t,n){for(let r in this.binders){let i=this.binders[r];(i instanceof As||i instanceof js||i instanceof Ms)&&i.populatePaintArray(e,t,n)}}setConstantPatternPositions(e,t){for(let n in this.binders){let r=this.binders[n];r instanceof ks&&r.setConstantPatternPositions(e,t)}}setConstantDashPositions(e,t){for(let n in this.binders){let r=this.binders[n];r instanceof ks&&r.setConstantDashPositions(e,t)}}updatePaintArrays(e,t,n,r,i){let a=!1;for(let o in e){let s=t.getPositions(o);for(let t of s){let s=n.feature(t.index);for(let n in this.binders){let c=this.binders[n];(c instanceof As||c instanceof js||c instanceof Ms)&&!0===c.expression.isStateDependent&&(c.expression=r.paint.get(n).value,c.updatePaintArray(t.start,t.end,s,e[o],i),a=!0)}}}return a}defines(){let e=[];for(let t in this.binders){let n=this.binders[t];(n instanceof Os||n instanceof ks)&&e.push(...n.uniformNames.map((e=>`#define HAS_UNIFORM_${e}`)))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let n=this.binders[t];if(n instanceof As||n instanceof js)for(let t of n.paintVertexAttributes)e.push(t.name);else if(n instanceof Ms){let t=n.getVertexAttributes();for(let n of t)e.push(n.name)}}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let n=this.binders[t];if(n instanceof Os||n instanceof ks||n instanceof js)for(let t of n.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let n=[];for(let r in this.binders){let i=this.binders[r];if(i instanceof Os||i instanceof ks||i instanceof js){for(let a of i.uniformNames)if(t[a]){let o=i.getBinding(e,t[a],a);n.push({name:a,property:r,binding:o})}}}return n}setUniforms(e,t,n,r){for(let{name:e,property:i,binding:a}of t)this.binders[i].setUniform(a,r,n.get(i),e)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let n=this.binders[t];if(e&&n instanceof Ms){let t=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else (n instanceof As||n instanceof js)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(let t in this.binders){let n=this.binders[t];(n instanceof As||n instanceof js||n instanceof Ms)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof As||t instanceof js||t instanceof Ms)&&t.destroy()}}}class Is{constructor(e,t,n=()=>!0){this.programConfigurations={};for(let r of e)this.programConfigurations[r.id]=new Fs(r,t,n);this.needsUpload=!1,this._featureMap=new vs,this._bufferOffset=0}populatePaintArrays(e,t,n,r){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(e,t,r);t.id!==void 0&&this._featureMap.add(t.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,n,r){for(let i of n)this.needsUpload=this.programConfigurations[i.id].updatePaintArrays(e,this._featureMap,t,i,r)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Ls(e,t){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`]}[e]||[e.replace(`${t}-`,``).replace(/-/g,`_`)]}function Rs(e,t,n){let r={color:{source:mo,composite:Mo},number:{source:Do,composite:mo}};return function(e){return{"line-pattern":{source:Zo,composite:Zo},"fill-pattern":{source:Zo,composite:Zo},"fill-extrusion-pattern":{source:Zo,composite:Zo},"line-dasharray":{source:Qo,composite:Qo}}[e]}(e)?.[n]||r[t][n]}J(`ConstantBinder`,Os),J(`CrossFadedConstantBinder`,ks),J(`SourceExpressionBinder`,As),J(`CrossFadedPatternBinder`,Ns),J(`CrossFadedDasharrayBinder`,Ps),J(`CompositeExpressionBinder`,js),J(`ProgramConfiguration`,Fs,{omit:[`_buffers`]}),J(`ProgramConfigurationSet`,Is);let zs=2**14-1,Bs=-zs-1;function Vs(e){let t=O/e.extent,n=e.loadGeometry();for(let e of n)for(let n of e){let e=Math.round(n.x*t),r=Math.round(n.y*t);n.x=ie(e,Bs,zs),n.y=ie(r,Bs,zs),(e<n.x||e>n.x+1||r<n.y||r>n.y+1)&&de(`Geometry exceeds allowed extent, reduce your vector tile buffer size`)}return n}function Hs(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Vs(e):[]}}let Us=-32768;function Ws(e,t,n,r,i){e.emplaceBack(Us+8*t+r,Us+8*n+i)}class Gs{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Ko,this.indexArray=new is,this.segments=new ss,this.programConfigurations=new Is(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){let r=this.layers[0],i=[],a=null,o=!1,s=r.type===`heatmap`;if(r.type===`circle`){let e=r;a=e.layout.get(`circle-sort-key`),o=!a.isConstant(),s||=e.paint.get(`circle-pitch-alignment`)===`map`}let c=s?t.subdivisionGranularity.circle:1;for(let{feature:t,id:r,index:s,sourceLayerIndex:c}of e){let e=this.layers[0]._featureFilter.needGeometry,l=Hs(t,e);if(!this.layers[0]._featureFilter.filter(new Y(this.zoom),l,n))continue;let u=o?a.evaluate(l,{},n):void 0,d={id:r,properties:t.properties,type:t.type,sourceLayerIndex:c,index:s,geometry:e?l.geometry:Vs(t),patterns:{},sortKey:u};i.push(d)}o&&i.sort(((e,t)=>e.sortKey-t.sortKey));for(let r of i){let{geometry:i,index:a,sourceLayerIndex:o}=r,s=e[a].feature;this.addFeature(r,i,a,n,c),t.featureIndex.insert(s,i,a,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:n})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,os),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,n,r,i=1){let a;switch(i){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${i}; valid values are 1, 3, 5, 7.`)}let o=a.length;for(let n of t)for(let t of n){let n=t.x,r=t.y;if(n<0||n>=O||r<0||r>=O)continue;let i=this.segments.prepareSegment(o*o,this.layoutVertexArray,this.indexArray,e.sortKey),s=i.vertexLength;for(let e=0;e<o;e++)for(let t=0;t<o;t++)Ws(this.layoutVertexArray,n,r,a[t],a[e]);for(let e=0;e<o-1;e++)for(let t=0;t<o-1;t++){let n=s+e*o+t,r=s+(e+1)*o+t;this.indexArray.emplaceBack(n,r+1,n+1),this.indexArray.emplaceBack(n,r,r+1)}i.vertexLength+=o*o,i.primitiveLength+=(o-1)*(o-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{imagePositions:{},canonical:r})}}function Ks(e,t){for(let n of e)if(tc(t,n))return!0;for(let n of t)if(tc(e,n))return!0;return Xs(e,t)}function qs(e,t,n){return!!tc(e,t)||Qs(t,e,n)}function Js(e,t){if(e.length===1)return ec(t,e[0]);for(let n of t)for(let t of n)if(tc(e,t))return!0;for(let n of e)if(ec(t,n))return!0;for(let n of t)if(Xs(e,n))return!0;return!1}function Ys(e,t,n){if(e.length>1){if(Xs(e,t))return!0;for(let r of t)if(Qs(r,e,n))return!0}for(let r of e)if(Qs(r,t,n))return!0;return!1}function Xs(e,t){if(e.length===0||t.length===0)return!1;for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1];for(let e=0;e<t.length-1;e++)if(Zs(r,i,t[e],t[e+1]))return!0}return!1}function Zs(e,t,n,r){return fe(e,n,r)!==fe(t,n,r)&&fe(e,t,n)!==fe(e,t,r)}function Qs(e,t,n){let r=n*n;if(t.length===1)return e.distSqr(t[0])<r;for(let n=1;n<t.length;n++)if($s(e,t[n-1],t[n])<r)return!0;return!1}function $s(e,t,n){let r=t.distSqr(n);if(r===0)return e.distSqr(t);let i=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/r;return e.distSqr(i<0?t:i>1?n:n.sub(t)._mult(i)._add(t))}function ec(e,t){let n,r,i,a=!1;for(let o of e){n=o;for(let e=0,o=n.length-1;e<n.length;o=e++)r=n[e],i=n[o],r.y>t.y!=i.y>t.y&&t.x<(i.x-r.x)*(t.y-r.y)/(i.y-r.y)+r.x&&(a=!a)}return a}function tc(e,t){let n=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let a=e[r],o=e[i];a.y>t.y!=o.y>t.y&&t.x<(o.x-a.x)*(t.y-a.y)/(o.y-a.y)+a.x&&(n=!n)}return n}function nc(e,t,n){let r=n[0],i=n[2];if(e.x<r.x&&t.x<r.x||e.x>i.x&&t.x>i.x||e.y<r.y&&t.y<r.y||e.y>i.y&&t.y>i.y)return!1;let a=fe(e,t,n[0]);return a!==fe(e,t,n[1])||a!==fe(e,t,n[2])||a!==fe(e,t,n[3])}function rc(e,t,n){let r=t.paint.get(e).value;return r.kind===`constant`?r.value:n.programConfigurations.get(t.id).getMaxValue(e)}function ic(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function ac(e,t,r,i,a){if(!t[0]&&!t[1])return e;let o=n.convert(t)._mult(a);r===`viewport`&&o._rotate(-i);let s=[];for(let t of e)s.push(t.sub(o));return s}function oc(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],i=t.at(-1);(n===0||i&&!r.equals(i))&&t.push(r)}return t}function sc({queryGeometry:e,size:t},n){return qs(e,n,t)}function cc({queryGeometry:e,size:t,transform:n,unwrappedTileID:r,getElevation:i},a){return qs(e,a,t*(n.projectTileCoordinates(a.x,a.y,r,i).signedDistanceFromCamera/n.cameraToCenterDistance))}function lc({queryGeometry:e,size:t,transform:n,unwrappedTileID:r,getElevation:i},a){let o=n.projectTileCoordinates(a.x,a.y,r,i).signedDistanceFromCamera,s=t*(n.cameraToCenterDistance/o);return qs(e,fc(a,n,r,i),s)}function uc({queryGeometry:e,size:t,transform:n,unwrappedTileID:r,getElevation:i},a){return qs(e,fc(a,n,r,i),t)}function dc({queryGeometry:e,size:t,transform:n,unwrappedTileID:r,getElevation:i,pitchAlignment:a=`map`,pitchScale:o=`map`},s){let c=a===`map`?o===`map`?sc:cc:o===`map`?lc:uc,l={queryGeometry:e,size:t,transform:n,unwrappedTileID:r,getElevation:i};for(let e of s)for(let t of e)if(c(l,t))return!0;return!1}function fc(e,t,r,i){let a=t.projectTileCoordinates(e.x,e.y,r,i).point;return new n((.5*a.x+.5)*t.width,(.5*-a.y+.5)*t.height)}let pc,mc;J(`CircleBucket`,Gs,{omit:[`layers`]});var hc={get paint(){return mc||=new Xa({"circle-radius":new Z(N.paint_circle[`circle-radius`]),"circle-color":new Z(N.paint_circle[`circle-color`]),"circle-blur":new Z(N.paint_circle[`circle-blur`]),"circle-opacity":new Z(N.paint_circle[`circle-opacity`]),"circle-translate":new X(N.paint_circle[`circle-translate`]),"circle-translate-anchor":new X(N.paint_circle[`circle-translate-anchor`]),"circle-pitch-scale":new X(N.paint_circle[`circle-pitch-scale`]),"circle-pitch-alignment":new X(N.paint_circle[`circle-pitch-alignment`]),"circle-stroke-width":new Z(N.paint_circle[`circle-stroke-width`]),"circle-stroke-color":new Z(N.paint_circle[`circle-stroke-color`]),"circle-stroke-opacity":new Z(N.paint_circle[`circle-stroke-opacity`])})},get layout(){return pc||=new Xa({"circle-sort-key":new Z(N.layout_circle[`circle-sort-key`])})}};class gc extends $a{constructor(e,t){super(e,hc,t)}createBucket(e){return new Gs(e)}queryRadius(e){let t=e;return rc(`circle-radius`,this,t)+rc(`circle-stroke-width`,this,t)+ic(this.paint.get(`circle-translate`))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:n,geometry:r,transform:i,pixelsToTileUnits:a,unwrappedTileID:o,getElevation:s}){let c=ac(e,this.paint.get(`circle-translate`),this.paint.get(`circle-translate-anchor`),-i.bearingInRadians,a),l=this.paint.get(`circle-radius`).evaluate(t,n)+this.paint.get(`circle-stroke-width`).evaluate(t,n),u=this.paint.get(`circle-pitch-scale`),d=this.paint.get(`circle-pitch-alignment`),f,p;return d===`map`?(f=c,p=l*a):(f=function(e,t,n,r){return e.map((e=>fc(e,t,n,r)))}(c,i,o,s),p=l),dc({queryGeometry:f,size:p,transform:i,unwrappedTileID:o,getElevation:s,pitchAlignment:d,pitchScale:u},r)}}class _c extends Gs{}let vc;J(`HeatmapBucket`,_c,{omit:[`layers`]});var yc={get paint(){return vc||=new Xa({"heatmap-radius":new Z(N.paint_heatmap[`heatmap-radius`]),"heatmap-weight":new Z(N.paint_heatmap[`heatmap-weight`]),"heatmap-intensity":new X(N.paint_heatmap[`heatmap-intensity`]),"heatmap-color":new Ya(N.paint_heatmap[`heatmap-color`]),"heatmap-opacity":new X(N.paint_heatmap[`heatmap-opacity`])})}};function bc(e,{width:t,height:n},r,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==t*n*r)throw RangeError(`mismatched image size. expected: ${i.length} but got: ${t*n*r}`)}else i=new Uint8Array(t*n*r);return e.width=t,e.height=n,e.data=i,e}function xc(e,{width:t,height:n},r){if(t===e.width&&n===e.height)return;let i=bc({},{width:t,height:n},r);Sc(e,i,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,n)},r),e.width=t,e.height=n,e.data=i.data}function Sc(e,t,n,r,i,a){if(i.width===0||i.height===0)return t;if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw RangeError(`out of range source coordinates for image copy`);if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw RangeError(`out of range destination coordinates for image copy`);let o=e.data,s=t.data;if(o===s)throw Error(`srcData equals dstData, so image is already copied`);for(let c=0;c<i.height;c++){let l=((n.y+c)*e.width+n.x)*a,u=((r.y+c)*t.width+r.x)*a;for(let e=0;e<i.width*a;e++)s[u+e]=o[l+e]}return t}class Cc{constructor(e,t){bc(this,e,1,t)}resize(e){xc(this,e,1)}clone(){return new Cc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,r,i){Sc(e,t,n,r,i,1)}}class wc{constructor(e,t){bc(this,e,4,t)}resize(e){xc(this,e,4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new wc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,r,i){Sc(e,t,n,r,i,4)}setPixel(e,t,n){let r=4*(e*this.width+t);this.data[r+0]=Math.round(255*n.r/n.a),this.data[r+1]=Math.round(255*n.g/n.a),this.data[r+2]=Math.round(255*n.b/n.a),this.data[r+3]=Math.round(255*n.a)}}function Tc(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n+=4){let r=e[n+3];t[n+0]=Math.round(e[n+0]*r/255),t[n+1]=Math.round(e[n+1]*r/255),t[n+2]=Math.round(e[n+2]*r/255),t[n+3]=r}return t}function Ec(e){let t={},n=e.resolution||256,r=e.clips?e.clips.length:1,i=e.image||new wc({width:n,height:r});if(Math.log(n)/Math.LN2%1!=0)throw Error(`width is not a power of 2 - ${n}`);let a=(r,a,o)=>{t[e.evaluationKey]=o;let s=e.expression.evaluate(t);i.setPixel(r/4/n,a/4,s)};if(e.clips)for(let t=0,i=0;t<r;++t,i+=4*n)for(let r=0,o=0;r<n;r++,o+=4){let s=r/(n-1),{start:c,end:l}=e.clips[t];a(i,o,c*(1-s)+l*s)}else for(let e=0,t=0;e<n;e++,t+=4)a(0,t,e/(n-1));return i}J(`AlphaImage`,Cc),J(`RGBAImage`,wc);let Dc=`big-fb`;class Oc extends $a{createBucket(e){return new _c(e)}constructor(e,t){super(e,yc,t),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e===`heatmap-color`&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Ec({expression:this._transitionablePaint._values[`heatmap-color`].value.expression,evaluationKey:`heatmapDensity`,image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Dc)&&this.heatmapFbos.delete(Dc)}queryRadius(e){return rc(`heatmap-radius`,this,e)}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:n,geometry:r,transform:i,pixelsToTileUnits:a,unwrappedTileID:o,getElevation:s}){return dc({queryGeometry:e,size:this.paint.get(`heatmap-radius`).evaluate(t,n)*a,transform:i,unwrappedTileID:o,getElevation:s},r)}hasOffscreenPass(){return this.paint.get(`heatmap-opacity`)!==0&&!this.isHidden()}}let kc;var Ac={get paint(){return kc||=new Xa({"hillshade-illumination-direction":new X(N.paint_hillshade[`hillshade-illumination-direction`]),"hillshade-illumination-altitude":new X(N.paint_hillshade[`hillshade-illumination-altitude`]),"hillshade-illumination-anchor":new X(N.paint_hillshade[`hillshade-illumination-anchor`]),"hillshade-exaggeration":new X(N.paint_hillshade[`hillshade-exaggeration`]),"hillshade-shadow-color":new X(N.paint_hillshade[`hillshade-shadow-color`]),"hillshade-highlight-color":new X(N.paint_hillshade[`hillshade-highlight-color`]),"hillshade-accent-color":new X(N.paint_hillshade[`hillshade-accent-color`]),"hillshade-method":new X(N.paint_hillshade[`hillshade-method`]),resampling:new X(N.paint_hillshade.resampling)})}};class jc extends $a{constructor(e,t){super(e,Ac,t),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get(`hillshade-illumination-direction`).values,t=this.paint.get(`hillshade-illumination-altitude`).values,n=this.paint.get(`hillshade-highlight-color`).values,r=this.paint.get(`hillshade-shadow-color`).values,i=Math.max(e.length,t.length,n.length,r.length);e=e.concat(Array(i-e.length).fill(e.at(-1))),t=t.concat(Array(i-t.length).fill(t.at(-1))),n=n.concat(Array(i-n.length).fill(n.at(-1))),r=r.concat(Array(i-r.length).fill(r.at(-1)));let a=t.map(xe);return{directionRadians:e.map(xe),altitudeRadians:a,shadowColor:r,highlightColor:n}}hasOffscreenPass(){return this.paint.get(`hillshade-exaggeration`)!==0&&!this.isHidden()}}let Mc;var Nc={get paint(){return Mc||=new Xa({"color-relief-opacity":new X(N[`paint_color-relief`][`color-relief-opacity`]),"color-relief-color":new Ya(N[`paint_color-relief`][`color-relief-color`]),resampling:new X(N[`paint_color-relief`].resampling)})}};function Pc(e){return`data`in e}class Fc{constructor(e,t,n,r){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this._ownedHandle=this.texture,this.update(t,r)}update(e,t,n){let{width:r,height:i}=e,a=(this.size?.[0]!==r||this.size[1]!==i)&&!n,{context:o}=this,{gl:s}=o;this.useMipmap=!!t?.useMipmap,s.bindTexture(s.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1);let c=this.format===s.RGBA&&!1!==t?.premultiply;if(a)this.size=[r,i],Pc(e)?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(e,c,r,i,s)):(o.pixelStoreUnpackPremultiplyAlpha.set(c),this._uploadDomImage(e,s));else{let{x:t,y:a}=n||{x:0,y:0};Pc(e)?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(e,c,t,a,r,i,s)):(o.pixelStoreUnpackPremultiplyAlpha.set(c),this._updateDomImage(e,t,a,s))}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D),o.pixelStoreUnpackFlipY.setDefault(),o.pixelStoreUnpack.setDefault(),o.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(e,t){t.texImage2D(t.TEXTURE_2D,0,this.format,this.format,t.UNSIGNED_BYTE,e)}_uploadRawData(e,t,n,r,i){let{data:a}=e;t&&a&&(a=Tc(a)),i.texImage2D(i.TEXTURE_2D,0,this.format,n,r,0,this.format,i.UNSIGNED_BYTE,a)}_updateDomImage(e,t,n,r){r.texSubImage2D(r.TEXTURE_2D,0,t,n,r.RGBA,r.UNSIGNED_BYTE,e)}_updateRawData(e,t,n,r,i,a,o){let{data:s}=e;t&&s&&(s=Tc(s)),o.texSubImage2D(o.TEXTURE_2D,0,n,r,i,a,o.RGBA,o.UNSIGNED_BYTE,s)}bind(e,t,n){let{context:r}=this,{gl:i}=r;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),i.bindTexture(i.TEXTURE_2D,this.texture),n!==i.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(n=i.LINEAR),e!==this.filter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,n||e),this.filter=e),t!==this.wrap&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}}class Ic{constructor(e,t,n,r=1,i=1,a=1,o=0){if(this.uid=e,t.height!==t.width)throw RangeError(`DEM tiles must be square`);if(n&&![`mapbox`,`terrarium`,`custom`].includes(n))return void de(`"${n}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=t.height;let s=this.dim=t.height-2;switch(this.data=new Uint32Array(t.data.buffer),n){case`terrarium`:this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case`custom`:this.redFactor=r,this.greenFactor=i,this.blueFactor=a,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let e=0;e<s;e++)this.data[this._idx(-1,e)]=this.data[this._idx(0,e)],this.data[this._idx(s,e)]=this.data[this._idx(s-1,e)],this.data[this._idx(e,-1)]=this.data[this._idx(e,0)],this.data[this._idx(e,s)]=this.data[this._idx(e,s-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(s,-1)]=this.data[this._idx(s-1,0)],this.data[this._idx(-1,s)]=this.data[this._idx(0,s-1)],this.data[this._idx(s,s)]=this.data[this._idx(s-1,s-1)],this.min=2**53-1,this.max=-(2**53-1);for(let e=0;e<s;e++)for(let t=0;t<s;t++){let n=this.get(e,t);n>this.max&&(this.max=n),n<this.min&&(this.min=n)}}get(e,t){let n=new Uint8Array(this.data.buffer),r=4*this._idx(e,t);return this.unpack(n[r],n[r+1],n[r+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${t}, dim: ${this.dim}`);return(t+1)*this.stride+(e+1)}unpack(e,t,n){return e*this.redFactor+t*this.greenFactor+n*this.blueFactor-this.baseShift}pack(e){return Lc(e,this.getUnpackVector())}getPixels(){return new wc({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,n){if(this.dim!==e.dim)throw Error(`dem dimension mismatch`);let r=t*this.dim,i=t*this.dim+this.dim,a=n*this.dim,o=n*this.dim+this.dim;switch(t){case-1:r=i-1;break;case 1:i=r+1}switch(n){case-1:a=o-1;break;case 1:o=a+1}let s=-t*this.dim,c=-n*this.dim;for(let t=a;t<o;t++)for(let n=r;n<i;n++)this.data[this._idx(n,t)]=e.data[this._idx(n+s,t+c)]}}function Lc(e,t){let n=t[0],r=t[1],i=t[2],a=t[3],o=Math.min(n,r,i),s=Math.round((e+a)/o);return{r:Math.floor(s*o/n)%256,g:Math.floor(s*o/r)%256,b:Math.floor(s*o/i)%256}}J(`DEMData`,Ic);class Rc extends $a{constructor(e,t){super(e,Nc,t)}_createColorRamp(e){let t={elevationStops:[],colorStops:[]},n=this._transitionablePaint._values[`color-relief-color`].value.expression;if(n instanceof li&&n._styleExpression.expression instanceof xn){this.colorRampExpression=n;let e=n._styleExpression.expression;t.elevationStops=e.labels,t.colorStops=[];for(let n of t.elevationStops)t.colorStops.push(e.evaluate({globals:{elevation:n}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[V.transparent]),t.elevationStops.length<2&&(t.elevationStops.push(t.elevationStops[0]+1),t.colorStops.push(t.colorStops[0])),t.elevationStops.length<=e)return t;let r={elevationStops:[],colorStops:[]},i=(t.elevationStops.length-1)/(e-1);for(let e=0;e<t.elevationStops.length-.5;e+=i)r.elevationStops.push(t.elevationStops[Math.round(e)]),r.colorStops.push(t.colorStops[Math.round(e)]);return de(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${t.elevationStops.length}`),r}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values[`color-relief-color`].value.expression}getColorRampTextures(e,t,n){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let r=this._createColorRamp(t),i=new wc({width:r.colorStops.length,height:1}),a=new wc({width:r.colorStops.length,height:1});for(let e=0;e<r.elevationStops.length;e++){let t=Lc(r.elevationStops[e],n);a.setPixel(0,e,new V(t.r/255,t.g/255,t.b/255,1)),i.setPixel(0,e,r.colorStops[e])}return this.colorRampTextures={elevationTexture:new Fc(e,a,e.gl.RGBA),colorTexture:new Fc(e,i,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}let{members:zc}=oo([{name:`a_pos`,components:2,type:`Int16`}],4);function Bc(e,t,n){let r=n.patternDependencies,i=!1;for(let n of t){let t=n.paint.get(`${e}-pattern`);t.isConstant()||(i=!0);let a=t.constantOr(null);a&&(i=!0,r[a.to]=!0,r[a.from]=!0)}return i}function Vc(e,t,n,r,i){let{zoom:a}=r,o=i.patternDependencies;for(let r of t){let t=r.paint.get(`${e}-pattern`).value;if(t.kind!==`constant`){let e=t.evaluate({zoom:a-1},n,{},i.availableImages),s=t.evaluate({zoom:a},n,{},i.availableImages),c=t.evaluate({zoom:a+1},n,{},i.availableImages);e=e?.name?e.name:e,s=s?.name?s.name:s,c=c?.name?c.name:c,o[e]=!0,o[s]=!0,o[c]=!0,n.patterns[r.id]={min:e,mid:s,max:c}}}return n}function Hc(e,t,n,r,i){let a;if(i===function(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=ul(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=ul(i/r|0,e[i],e[i+1],a);return a&&il(a,a.next)&&(dl(a),a=a.next),a}function Uc(e,t){if(!e)return e;t||=e;let n,r=e;do if(n=!1,r.steiner||!il(r,r.next)&&rl(r.prev,r,r.next)!==0)r=r.next;else{if(dl(r),r=t=r.prev,r===r.next)break;n=!0}while(n||r!==t);return t}function Wc(e,t,n,r,i,a,o){if(!e)return;!o&&a&&function(e,t,n,r){let i=e;do i.z===0&&(i.z=Qc(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){let t,n=1;do{let r,i=e;e=null;let a=null;for(t=0;i;){t++;let o=i,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||i.z<=o.z)?(r=i,i=i.nextZ,s--):(r=o,o=o.nextZ,c--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;i=o}a.nextZ=null,n*=2}while(t>1)}(i)}(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?Kc(e,r,i,a):Gc(e))t.push(c.i,e.i,l.i),dl(e),e=l.next,s=l.next;else if((e=l)===s){o?o===1?Wc(e=qc(Uc(e),t),t,n,r,i,a,2):o===2&&Jc(e,t,n,r,i,a):Wc(Uc(e),t,n,r,i,a,1);break}}}function Gc(e){let t=e.prev,n=e,r=e.next;if(rl(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&tl(i,s,a,c,o,l,m.x,m.y)&&rl(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Kc(e,t,n,r){let i=e.prev,a=e,o=e.next;if(rl(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=Qc(p,m,t,n,r),v=Qc(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&tl(s,u,c,d,l,f,y.x,y.y)&&rl(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&tl(s,u,c,d,l,f,b.x,b.y)&&rl(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&tl(s,u,c,d,l,f,y.x,y.y)&&rl(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&tl(s,u,c,d,l,f,b.x,b.y)&&rl(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function qc(e,t){let n=e;do{let r=n.prev,i=n.next.next;!il(r,i)&&al(r,n,n.next,i)&&cl(r,i)&&cl(i,r)&&(t.push(r.i,n.i,i.i),dl(n),dl(n.next),n=e=i),n=n.next}while(n!==e);return Uc(n)}function Jc(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&nl(o,e)){let s=ll(o,e);o=Uc(o,o.next),s=Uc(s,s.next),Wc(o,t,n,r,i,a,0),Wc(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function Yc(e,t){let n=e.x-t.x;return n===0&&(n=e.y-t.y,n===0)&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),n}function Xc(e,t){let n=function(e,t){let n=t,r=e.x,i=e.y,a,o=-1/0;if(il(e,n))return n;do{if(il(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>o&&(o=e,a=n.x<n.next.x?n:n.next,e===r))return a}n=n.next}while(n!==t);if(!a)return null;let s=a,c=a.x,l=a.y,u=1/0;n=a;do{if(r>=n.x&&n.x>=c&&r!==n.x&&el(i<l?r:o,i,c,l,i<l?o:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);cl(n,e)&&(t<u||t===u&&(n.x>a.x||n.x===a.x&&Zc(a,n)))&&(a=n,u=t)}n=n.next}while(n!==s);return a}(e,t);if(!n)return t;let r=ll(n,e);return Uc(r,r.next),Uc(n,n.next)}function Zc(e,t){return rl(e.prev,e,t.prev)<0&&rl(t.next,e,e.next)<0}function Qc(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function $c(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function el(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function tl(e,t,n,r,i,a,o,s){return!(e===o&&t===s)&&el(e,t,n,r,i,a,o,s)}function nl(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&al(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(cl(e,t)&&cl(t,e)&&function(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}(e,t)&&(rl(e.prev,e,t.prev)||rl(e,t.prev,t))||il(e,t)&&rl(e.prev,e,e.next)>0&&rl(t.prev,t,t.next)>0)}function rl(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function il(e,t){return e.x===t.x&&e.y===t.y}function al(e,t,n,r){let i=sl(rl(e,t,n)),a=sl(rl(e,t,r)),o=sl(rl(n,r,e)),s=sl(rl(n,r,t));return i!==a&&o!==s||!(i!==0||!ol(e,n,t))||!(a!==0||!ol(e,r,t))||!(o!==0||!ol(n,e,r))||!(s!==0||!ol(n,t,r))}function ol(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function sl(e){return e>0?1:e<0?-1:0}function cl(e,t){return rl(e.prev,e,e.next)<0?rl(e,t,e.next)>=0&&rl(e,e.prev,t)>=0:rl(e,t,e.prev)<0||rl(e,e.next,t)<0}function ll(e,t){let n=fl(e.i,e.x,e.y),r=fl(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function ul(e,t,n,r){let i=fl(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function dl(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function fl(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class pl{constructor(e,t){if(t>e)throw Error(`Min granularity must not be greater than base granularity.`);this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class ml{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}ml.noSubdivision=new ml({fill:new pl(0,0),line:new pl(0,0),tile:new pl(0,0),stencil:new pl(0,0),circle:1}),J(`SubdivisionGranularityExpression`,pl),J(`SubdivisionGranularitySetting`,ml);let hl=-32768,gl=32767;class _l{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=O/e,this._canonical=t}_getKey(e,t){return(e+=32768)<<16|t+32768}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw Error(`Vertex coordinates are out of signed 16 bit integer range.`);let n=0|Math.round(e),r=0|Math.round(t),i=this._getKey(n,r);if(this._vertexDictionary.has(i))return this._vertexDictionary.get(i);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(i,a),this._vertexBuffer.push(n,r),a}_subdivideTrianglesScanline(e){if(this._granularity<2)return function(e,t){let n=[];for(let r=0;r<t.length;r+=3){let i=t[r],a=t[r+1],o=t[r+2],s=e[2*i],c=e[2*i+1];(e[2*a]-s)*(e[2*o+1]-c)-(e[2*a+1]-c)*(e[2*o]-s)>0?(n.push(i),n.push(o),n.push(a)):(n.push(i),n.push(a),n.push(o))}return n}(this._vertexBuffer,e);let t=[],n=e.length;for(let r=0;r<n;r+=3){let n=[e[r+0],e[r+1],e[r+2]],i=[this._vertexBuffer[2*e[r+0]+0],this._vertexBuffer[2*e[r+0]+1],this._vertexBuffer[2*e[r+1]+0],this._vertexBuffer[2*e[r+1]+1],this._vertexBuffer[2*e[r+2]+0],this._vertexBuffer[2*e[r+2]+1]],a=1/0,o=1/0,s=-1/0,c=-1/0;for(let e=0;e<3;e++){let t=i[2*e],n=i[2*e+1];a=Math.min(a,t),s=Math.max(s,t),o=Math.min(o,n),c=Math.max(c,n)}if(a===s||o===c)continue;let l=Math.floor(a/this._granularityCellSize),u=Math.ceil(s/this._granularityCellSize),d=Math.floor(o/this._granularityCellSize),f=Math.ceil(c/this._granularityCellSize);if(l!==u||d!==f)for(let e=d;e<f;e++){let r=this._scanlineGenerateVertexRingForCellRow(e,i,n);bl(this._vertexBuffer,r,t)}else t.push(...n)}return t}_scanlineGenerateVertexRingForCellRow(e,t,n){let r=e*this._granularityCellSize,i=r+this._granularityCellSize,a=[];for(let e=0;e<3;e++){let o=t[2*e],s=t[2*e+1],c=t[2*(e+1)%6],l=t[(2*(e+1)+1)%6],u=t[2*(e+2)%6],d=t[(2*(e+2)+1)%6],f=c-o,p=l-s,m=f===0,h=p===0,g=(r-s)/p,_=(i-s)/p,v=Math.min(g,_),y=Math.max(g,_);if(!h&&(v>=1||y<=0)||h&&(s<r||s>i)){l>=r&&l<=i&&a.push(n[(e+1)%3]);continue}!h&&v>0&&a.push(this._vertexToIndex(o+f*v,s+p*v));let b=o+f*Math.max(v,0),x=o+f*Math.min(y,1);m||this._generateIntraEdgeVertices(a,o,s,c,l,b,x),!h&&y<1&&a.push(this._vertexToIndex(o+f*y,s+p*y)),(h||l>=r&&l<=i)&&a.push(n[(e+1)%3]),!h&&(l<=r||l>=i)&&this._generateInterEdgeVertices(a,o,s,c,l,u,d,x,r,i)}return a}_generateIntraEdgeVertices(e,t,n,r,i,a,o){let s=r-t,c=i-n,l=c===0,u=l?Math.min(t,r):Math.min(a,o),d=l?Math.max(t,r):Math.max(a,o),f=Math.floor(u/this._granularityCellSize)+1,p=Math.ceil(d/this._granularityCellSize)-1;if(l?t<r:a<o)for(let r=f;r<=p;r++){let i=r*this._granularityCellSize;e.push(this._vertexToIndex(i,n+c*(i-t)/s))}else for(let r=p;r>=f;r--){let i=r*this._granularityCellSize;e.push(this._vertexToIndex(i,n+c*(i-t)/s))}}_generateInterEdgeVertices(e,t,n,r,i,a,o,s,c,l){let u=i-n,d=a-r,f=o-i,p=(c-i)/f,m=(l-i)/f,h=Math.min(p,m),g=Math.max(p,m),_=r+d*h,v=Math.floor(Math.min(_,s)/this._granularityCellSize)+1,y=Math.ceil(Math.max(_,s)/this._granularityCellSize)-1,b=s<_,x=f===0;if(x&&(o===c||o===l))return;if(x||h>=1||g<=0){let e=n-o,r=a+(t-a)*Math.min((c-o)/e,(l-o)/e);v=Math.floor(Math.min(r,s)/this._granularityCellSize)+1,y=Math.ceil(Math.max(r,s)/this._granularityCellSize)-1,b=s<r}let S=u>0?l:c;if(b)for(let t=v;t<=y;t++)e.push(this._vertexToIndex(t*this._granularityCellSize,S));else for(let t=y;t>=v;t--)e.push(this._vertexToIndex(t*this._granularityCellSize,S))}_generateOutline(e){let t=[];for(let n of e){let e=yl(n,this._granularity,!0),r=this._pointArrayToIndices(e),i=[];for(let e=1;e<r.length;e++)i.push(r[e-1]),i.push(r[e]);t.push(i)}return t}_handlePoles(e){let t=!1,n=!1;this._canonical&&(this._canonical.y===0&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(n=!0)),(t||n)&&this._fillPoles(e,t,n)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){let n=e[t+1];n===hl&&(e[t+1]=-32767),n===gl&&(e[t+1]=32766)}}_generatePoleQuad(e,t,n,r,i,a){r>i==(a===hl)?(e.push(n),e.push(t),e.push(this._vertexToIndex(r,a)),e.push(this._vertexToIndex(i,a)),e.push(n),e.push(this._vertexToIndex(r,a))):(e.push(t),e.push(n),e.push(this._vertexToIndex(r,a)),e.push(n),e.push(this._vertexToIndex(i,a)),e.push(this._vertexToIndex(r,a)))}_fillPoles(e,t,n){let r=this._vertexBuffer,i=O,a=e.length;for(let o=2;o<a;o+=3){let a=e[o-2],s=e[o-1],c=e[o],l=r[2*a],u=r[2*a+1],d=r[2*s],f=r[2*s+1],p=r[2*c],m=r[2*c+1];t&&(u===0&&f===0&&this._generatePoleQuad(e,a,s,l,d,hl),f===0&&m===0&&this._generatePoleQuad(e,s,c,d,p,hl),m===0&&u===0&&this._generatePoleQuad(e,c,a,p,l,hl)),n&&(u===i&&f===i&&this._generatePoleQuad(e,a,s,l,d,gl),f===i&&m===i&&this._generatePoleQuad(e,s,c,d,p,gl),m===i&&u===i&&this._generatePoleQuad(e,c,a,p,l,gl))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw Error(`Subdivision: multiple use not allowed.`);this._used=!0;let{flattened:n,holeIndices:r}=function(e){let t=[],n=[];for(let r of e)if(r.length!==0){r!==e[0]&&t.push(n.length/2);for(let e of r)n.push(e.x),n.push(e.y)}return{flattened:n,holeIndices:t}}(e),i;this._initializeVertices(n);try{let e=function(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=Hc(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=function(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=Hc(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push($c(o))}i.sort(Yc);for(let e=0;e<i.length;e++)n=Xc(i[e],n);return n}(e,t,a,n)),e.length>80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return Wc(a,o,n,s,c,l,0),o}(n,r),t=this._convertIndices(n,e);i=this._subdivideTrianglesScanline(t)}catch(e){console.error(e)}let a=[];return t&&(a=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(i),{verticesFlattened:this._vertexBuffer,indicesTriangles:i,indicesLineList:a}}_convertIndices(e,t){let n=[];for(let r of t)n.push(this._vertexToIndex(e[2*r],e[2*r+1]));return n}_pointArrayToIndices(e){let t=[];for(let n of e)t.push(this._vertexToIndex(n.x,n.y));return t}}function vl(e,t,n,r=!0){return new _l(n,t).subdividePolygonInternal(e,r)}function yl(e,t,r=!1){if(!e||e.length<1||e.length<2)return[];let i=e[0],a=e[e.length-1],o=r&&(i.x!==a.x||i.y!==a.y);if(t<2)return o?[...e,e[0]]:[...e];let s=Math.floor(O/t),c=[];c.push(new n(e[0].x,e[0].y));let l=e.length,u=o?l:l-1;for(let t=0;t<u;t++){let r=e[t],i=t<l-1?e[t+1]:e[0],a=r.x,o=r.y,u=i.x,d=i.y,f=a!==u,p=o!==d;if(!f&&!p)continue;let m=u-a,h=d-o,g=Math.abs(m),_=Math.abs(h),v=a,y=o;for(;;){let e=m>0?(Math.floor(v/s)+1)*s:(Math.ceil(v/s)-1)*s,t=h>0?(Math.floor(y/s)+1)*s:(Math.ceil(y/s)-1)*s,r=Math.abs(v-e),i=Math.abs(y-t),a=Math.abs(v-u),o=Math.abs(y-d),l=f?r/g:1/0,b=p?i/_:1/0;if((a<=r||!f)&&(o<=i||!p))break;if(l<b&&f||!p){v=e,y+=h*l;let t=new n(v,Math.round(y));c[c.length-1].x===t.x&&c[c.length-1].y===t.y||c.push(t)}else{v+=m*b,y=t;let e=new n(Math.round(v),y);c[c.length-1].x===e.x&&c[c.length-1].y===e.y||c.push(e)}}let b=new n(u,d);c[c.length-1].x===b.x&&c[c.length-1].y===b.y||c.push(b)}return c}function bl(e,t,n){if(t.length===0)throw Error(`Subdivision vertex ring is empty.`);let r=0,i=e[2*t[0]];for(let n=1;n<t.length;n++){let a=e[2*t[n]];a<i&&(i=a,r=n)}let a=t.length,o=r,s=(o+1)%a;for(;;){let r=o-1>=0?o-1:a-1,i=(s+1)%a,c=e[2*t[r]],l=e[2*t[i]],u=e[2*t[o]],d=e[2*t[o]+1],f=e[2*t[s]+1],p=!1;if(c<l)p=!0;else if(c>l)p=!1;else{let n=f-d,a=-(e[2*t[s]]-u),o=d<f?1:-1;((c-u)*n+(e[2*t[r]+1]-d)*a)*o>((l-u)*n+(e[2*t[i]+1]-d)*a)*o&&(p=!0)}if(p){let e=t[r],i=t[o],c=t[s];e!==i&&e!==c&&i!==c&&n.push(c,i,e),o--,o<0&&(o=a-1)}else{let e=t[i],r=t[o],c=t[s];e!==r&&e!==c&&r!==c&&n.push(c,r,e),s++,s>=a&&(s=0)}if(r===i)break}}function xl(e,t,n,r,i,a,o,s,c){let l=i.length/2,u=o&&s&&c;if(l<ss.MAX_VERTEX_ARRAY_LENGTH){let d=t.prepareSegment(l,n,r),f=d.vertexLength;for(let e=0;e<a.length;e+=3)r.emplaceBack(f+a[e],f+a[e+1],f+a[e+2]);let p,m;d.vertexLength+=l,d.primitiveLength+=a.length/3,u&&(m=o.prepareSegment(l,n,s),p=m.vertexLength,m.vertexLength+=l);for(let t=0;t<i.length;t+=2)e(i[t],i[t+1]);if(u)for(let e of c){for(let t=1;t<e.length;t+=2)s.emplaceBack(p+e[t-1],p+e[t]);m.primitiveLength+=e.length/2}}else (function(e,t,n,r,i,a){let o=[];for(let e=0;e<r.length/2;e++)o.push(-1);let s={count:0},c=0,l=e.getOrCreateLatestSegment(t,n),u=l.vertexLength;for(let d=2;d<i.length;d+=3){let f=i[d-2],p=i[d-1],m=i[d],h=o[f]<c,g=o[p]<c,_=o[m]<c;l.vertexLength+(+!!h+ +!!g+ +!!_)>ss.MAX_VERTEX_ARRAY_LENGTH&&(l=e.createNewSegment(t,n),c=s.count,h=!0,g=!0,_=!0,u=0);let v=Sl(o,r,a,s,f,h,l),y=Sl(o,r,a,s,p,g,l),b=Sl(o,r,a,s,m,_,l);n.emplaceBack(u+v-c,u+y-c,u+b-c),l.primitiveLength++}})(t,n,r,i,a,e),u&&function(e,t,n,r,i,a){let o=[];for(let e=0;e<r.length/2;e++)o.push(-1);let s={count:0},c=0,l=e.getOrCreateLatestSegment(t,n),u=l.vertexLength;for(let d of i)for(let i=1;i<d.length;i+=2){let f=d[i-1],p=d[i],m=o[f]<c,h=o[p]<c;l.vertexLength+(+!!m+ +!!h)>ss.MAX_VERTEX_ARRAY_LENGTH&&(l=e.createNewSegment(t,n),c=s.count,m=!0,h=!0,u=0);let g=Sl(o,r,a,s,f,m,l),_=Sl(o,r,a,s,p,h,l);n.emplaceBack(u+g-c,u+_-c),l.primitiveLength++}}(o,n,s,i,c,e),t.forceNewSegmentOnNextPrepare(),o?.forceNewSegmentOnNextPrepare()}function Sl(e,t,n,r,i,a,o){if(a){let a=r.count;return n(t[2*i],t[2*i+1]),e[i]=r.count,r.count++,o.vertexLength++,a}return e[i]}class Cl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new qo,this.indexArray=new is,this.indexArray2=new as,this.programConfigurations=new Is(e.layers,e.zoom),this.segments=new ss,this.segments2=new ss,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){this.hasDependencies=Bc(`fill`,this.layers,t);let r=this.layers[0].layout.get(`fill-sort-key`),i=!r.isConstant(),a=[];for(let{feature:o,id:s,index:c,sourceLayerIndex:l}of e){let e=this.layers[0]._featureFilter.needGeometry,u=Hs(o,e);if(!this.layers[0]._featureFilter.filter(new Y(this.zoom),u,n))continue;let d=i?r.evaluate(u,{},n,t.availableImages):void 0,f={id:s,properties:o.properties,type:o.type,sourceLayerIndex:l,index:c,geometry:e?u.geometry:Vs(o),patterns:{},sortKey:d};a.push(f)}i&&a.sort(((e,t)=>e.sortKey-t.sortKey));for(let r of a){let{geometry:i,index:a,sourceLayerIndex:o}=r;if(this.hasDependencies){let e=Vc(`fill`,this.layers,r,{zoom:this.zoom},t);this.patternFeatures.push(e)}else this.addFeature(r,i,a,n,{},t.subdivisionGranularity);t.featureIndex.insert(e[a].feature,i,a,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:n})}addFeatures(e,t,n){for(let r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,n,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,zc),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,t,n,r,i,a){for(let e of cr(t,500)){let t=vl(e,r,a.fill.getGranularityForZoomLevel(r.z)),n=this.layoutVertexArray;xl(((e,t)=>{n.emplaceBack(e,t)}),this.segments,this.layoutVertexArray,this.indexArray,t.verticesFlattened,t.indicesTriangles,this.segments2,this.indexArray2,t.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{imagePositions:i,canonical:r})}}let wl,Tl;J(`FillBucket`,Cl,{omit:[`layers`,`patternFeatures`]});var El={get paint(){return Tl||=new Xa({"fill-antialias":new X(N.paint_fill[`fill-antialias`]),"fill-opacity":new Z(N.paint_fill[`fill-opacity`]),"fill-color":new Z(N.paint_fill[`fill-color`]),"fill-outline-color":new Z(N.paint_fill[`fill-outline-color`]),"fill-translate":new X(N.paint_fill[`fill-translate`]),"fill-translate-anchor":new X(N.paint_fill[`fill-translate-anchor`]),"fill-pattern":new qa(N.paint_fill[`fill-pattern`])})},get layout(){return wl||=new Xa({"fill-sort-key":new Z(N.layout_fill[`fill-sort-key`])})}};class Dl extends $a{constructor(e,t){super(e,El,t)}recalculate(e,t){super.recalculate(e,t);let n=this.paint._values[`fill-outline-color`];n.value.kind===`constant`&&n.value.value===void 0&&(this.paint._values[`fill-outline-color`]=this.paint._values[`fill-color`])}createBucket(e){return new Cl(e)}queryRadius(){return ic(this.paint.get(`fill-translate`))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:n,pixelsToTileUnits:r}){return Js(ac(e,this.paint.get(`fill-translate`),this.paint.get(`fill-translate-anchor`),-n.bearingInRadians,r),t)}isTileClipped(){return!0}}let Ol=oo([{name:`a_pos`,components:2,type:`Int16`},{name:`a_normal_ed`,components:4,type:`Int16`}],4),kl=oo([{name:`a_centroid`,components:2,type:`Int16`}],4),{members:Al}=Ol;class jl{constructor(e,t,n,r,i){this.properties={},this.extent=n,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=i,e.readFields(Ml,this,t)}loadGeometry(){let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,r=[],i,a=1,o=0,s=0,c=0;for(;e.pos<t;){if(o<=0){let t=e.readVarint();a=7&t,o=t>>3}if(o--,a===1||a===2)s+=e.readSVarint(),c+=e.readSVarint(),a===1&&(i&&r.push(i),i=[]),i&&i.push(new n(s,c));else{if(a!==7)throw Error(`unknown command ${a}`);i&&i.push(i[0].clone())}}return i&&r.push(i),r}bbox(){let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,n=1,r=0,i=0,a=0,o=1/0,s=-1/0,c=1/0,l=-1/0;for(;e.pos<t;){if(r<=0){let t=e.readVarint();n=7&t,r=t>>3}if(r--,n===1||n===2)i+=e.readSVarint(),a+=e.readSVarint(),i<o&&(o=i),i>s&&(s=i),a<c&&(c=a),a>l&&(l=a);else if(n!==7)throw Error(`unknown command ${n}`)}return[o,c,s,l]}toGeoJSON(e,t,n){let r=this.extent*2**n,i=this.extent*e,a=this.extent*t,o=this.loadGeometry();function s(e){return[360*(e.x+i)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+a)/r)*Math.PI))-90]}function c(e){return e.map(s)}let l;if(this.type===1){let e=[];for(let t of o)e.push(t[0]);let t=c(e);l=e.length===1?{type:`Point`,coordinates:t[0]}:{type:`MultiPoint`,coordinates:t}}else if(this.type===2){let e=o.map(c);l=e.length===1?{type:`LineString`,coordinates:e[0]}:{type:`MultiLineString`,coordinates:e}}else{if(this.type!==3)throw Error(`unknown feature type`);{let e=Nl(o),t=[];for(let n of e)t.push(n.map(c));l=t.length===1?{type:`Polygon`,coordinates:t[0]}:{type:`MultiPolygon`,coordinates:t}}}let u={type:`Feature`,geometry:l,properties:this.properties};return this.id!=null&&(u.id=this.id),u}}function Ml(e,t,n){e===1?t.id=n.readVarint():e===2?function(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let n=t._keys[e.readVarint()],r=t._values[e.readVarint()];t.properties[n]=r}}(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos)}function Nl(e){let t=e.length;if(t<=1)return[e];let n=[],r,i;for(let a=0;a<t;a++){let t=Pl(e[a]);t!==0&&(i===void 0&&(i=t<0),i===t<0?(r&&n.push(r),r=[e[a]]):r&&r.push(e[a]))}return r&&n.push(r),n}function Pl(e){let t=0;for(let n,r,i=0,a=e.length,o=a-1;i<a;o=i++)n=e[i],r=e[o],t+=(r.x-n.x)*(n.y+r.y);return t}jl.types=[`Unknown`,`Point`,`LineString`,`Polygon`];class Fl{constructor(e,t){this.version=1,this.name=``,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Il,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw Error(`feature index out of bounds`);this._pbf.pos=this._features[e];let t=this._pbf.readVarint()+this._pbf.pos;return new jl(this._pbf,t,this.extent,this._keys,this._values)}}function Il(e,t,n){e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(function(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let n=e.readVarint()>>3;t=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null}if(t==null)throw Error(`unknown feature value`);return t}(n))}class Ll{constructor(e,t){this.layers=e.readFields(Rl,{},t)}}function Rl(e,t,n){if(e===3){let e=new Fl(n,n.readVarint()+n.pos);e.length&&(t[e.name]=e)}}let zl=2**13;function Bl(e,t,n,r,i,a,o,s){e.emplaceBack(t,n,2*Math.floor(r*zl)+o,i*zl*2,a*zl*2,Math.round(s))}class Vl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Jo,this.centroidVertexArray=new Go,this.indexArray=new is,this.programConfigurations=new Is(e.layers,e.zoom),this.segments=new ss,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){this.features=[],this.hasDependencies=Bc(`fill-extrusion`,this.layers,t);for(let{feature:r,id:i,index:a,sourceLayerIndex:o}of e){let e=this.layers[0]._featureFilter.needGeometry,s=Hs(r,e);if(!this.layers[0]._featureFilter.filter(new Y(this.zoom),s,n))continue;let c={id:i,sourceLayerIndex:o,index:a,geometry:e?s.geometry:Vs(r),properties:r.properties,type:r.type,patterns:{}};this.hasDependencies?this.features.push(Vc(`fill-extrusion`,this.layers,c,{zoom:this.zoom},t)):this.addFeature(c,c.geometry,a,n,{},t.subdivisionGranularity),t.featureIndex.insert(r,c.geometry,a,o,this.index,!0)}}addFeatures(e,t,n){for(let r of this.features){let{geometry:i}=r;this.addFeature(r,i,r.index,t,n,e.subdivisionGranularity)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:n})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Al),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,kl.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,n,r,i,a){for(let n of cr(t,500)){let t={x:0,y:0,sampleCount:0},i=this.layoutVertexArray.length;this.processPolygon(t,r,e,n,a);let o=this.layoutVertexArray.length-i,s=Math.floor(t.x/t.sampleCount),c=Math.floor(t.y/t.sampleCount);for(let e=0;e<o;e++)this.centroidVertexArray.emplaceBack(s,c)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{imagePositions:i,canonical:r})}processPolygon(e,t,n,r,i){if(r.length<1||Wl(r[0]))return;for(let t of r)t.length!==0&&Hl(e,t);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},o=i.fill.getGranularityForZoomLevel(t.z),s=jl.types[n.type]===`Polygon`;for(let e of r){if(e.length===0||Wl(e))continue;let t=yl(e,o,s);this._generateSideFaces(t,a)}if(!s)return;let c=vl(r,t,o,!1),l=this.layoutVertexArray;xl(((e,t)=>{Bl(l,e,t,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,c.verticesFlattened,c.indicesTriangles)}_generateSideFaces(e,t){let n=0;for(let r=1;r<e.length;r++){let i=e[r],a=e[r-1];if(Ul(i,a))continue;t.segment.vertexLength+4>ss.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let o=i.sub(a)._perp()._unit(),s=a.dist(i);n+s>32768&&(n=0),Bl(this.layoutVertexArray,i.x,i.y,o.x,o.y,0,0,n),Bl(this.layoutVertexArray,i.x,i.y,o.x,o.y,0,1,n),n+=s,Bl(this.layoutVertexArray,a.x,a.y,o.x,o.y,0,0,n),Bl(this.layoutVertexArray,a.x,a.y,o.x,o.y,0,1,n);let c=t.segment.vertexLength;this.indexArray.emplaceBack(c,c+2,c+1),this.indexArray.emplaceBack(c+1,c+2,c+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}}function Hl(e,t){for(let n=0;n<t.length;n++){let r=t[n];n===t.length-1&&t[0].x===r.x&&t[0].y===r.y||(e.x+=r.x,e.y+=r.y,e.sampleCount++)}}function Ul(e,t){return e.x===t.x&&(e.x<0||e.x>O)||e.y===t.y&&(e.y<0||e.y>O)}function Wl(e){return e.every((e=>e.x<0))||e.every((e=>e.x>O))||e.every((e=>e.y<0))||e.every((e=>e.y>O))}let Gl;J(`FillExtrusionBucket`,Vl,{omit:[`layers`,`features`]});var Kl={get paint(){return Gl||=new Xa({"fill-extrusion-opacity":new X(N[`paint_fill-extrusion`][`fill-extrusion-opacity`]),"fill-extrusion-color":new Z(N[`paint_fill-extrusion`][`fill-extrusion-color`]),"fill-extrusion-translate":new X(N[`paint_fill-extrusion`][`fill-extrusion-translate`]),"fill-extrusion-translate-anchor":new X(N[`paint_fill-extrusion`][`fill-extrusion-translate-anchor`]),"fill-extrusion-pattern":new qa(N[`paint_fill-extrusion`][`fill-extrusion-pattern`]),"fill-extrusion-height":new Z(N[`paint_fill-extrusion`][`fill-extrusion-height`]),"fill-extrusion-base":new Z(N[`paint_fill-extrusion`][`fill-extrusion-base`]),"fill-extrusion-vertical-gradient":new X(N[`paint_fill-extrusion`][`fill-extrusion-vertical-gradient`])})}};class ql extends $a{constructor(e,t){super(e,Kl,t)}createBucket(e){return new Vl(e)}queryRadius(){return ic(this.paint.get(`fill-extrusion-translate`))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:a,pixelsToTileUnits:o,pixelPosMatrix:s}){let c=ac(e,this.paint.get(`fill-extrusion-translate`),this.paint.get(`fill-extrusion-translate-anchor`),-a.bearingInRadians,o),l=this.paint.get(`fill-extrusion-height`).evaluate(t,r),u=this.paint.get(`fill-extrusion-base`).evaluate(t,r),d=function(e,t){let r=[];for(let i of e){let e=[i.x,i.y,0,1];C(e,e,t),r.push(new n(e[0]/e[3],e[1]/e[3]))}return r}(c,s),f=function(e,t,r,i){let a=[],o=[],s=i[8]*t,c=i[9]*t,l=i[10]*t,u=i[11]*t,d=i[8]*r,f=i[9]*r,p=i[10]*r,m=i[11]*r;for(let t of e){let e=[],r=[];for(let a of t){let t=a.x,o=a.y,h=i[0]*t+i[4]*o+i[12],g=i[1]*t+i[5]*o+i[13],_=i[2]*t+i[6]*o+i[14],v=i[3]*t+i[7]*o+i[15],y=_+l,b=v+u,x=h+d,S=g+f,C=_+p,w=v+m,T=new n((h+s)/b,(g+c)/b);T.z=y/b,e.push(T);let E=new n(x/w,S/w);E.z=C/w,r.push(E)}a.push(e),o.push(r)}return[a,o]}(i,u,l,s);return function(e,t,n){let r=1/0;Js(n,t)&&(r=Yl(n,t[0]));for(let i=0;i<t.length;i++){let a=t[i],o=e[i];for(let e=0;e<a.length-1;e++){let t=a[e],i=[t,a[e+1],o[e+1],o[e],t];Ks(n,i)&&(r=Math.min(r,Yl(n,i)))}}return r!==1/0&&r}(f[0],f[1],d)}}function Jl(e,t){return e.x*t.x+e.y*t.y}function Yl(e,t){if(e.length===1){let n=0,r=t[n++],i;for(;!i||r.equals(i);)if(i=t[n++],!i)return 1/0;for(;n<t.length;n++){let a=t[n],o=e[0],s=i.sub(r),c=a.sub(r),l=o.sub(r),u=Jl(s,s),d=Jl(s,c),f=Jl(c,c),p=Jl(l,s),m=Jl(l,c),h=u*f-d*d,g=(f*p-d*m)/h,_=(u*m-d*p)/h,v=r.z*(1-g-_)+i.z*g+a.z*_;if(isFinite(v))return v}return 1/0}{let e=1/0;for(let n of t)e=Math.min(e,n.z);return e}}let Xl=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Zl{static from(e){if(!(e instanceof ArrayBuffer))throw Error(`Data must be an instance of ArrayBuffer.`);let[t,n]=new Uint8Array(e,0,2);if(t!==219)throw Error(`Data does not appear to be in a KDBush format.`);let r=n>>4;if(r!==1)throw Error(`Got v${r} data when expected v1.`);let i=Xl[15&n];if(!i)throw Error(`Unrecognized array type.`);let[a]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new Zl(o,a,i,e)}constructor(e,t=64,n=Float64Array,r){if(isNaN(e)||e<0)throw Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let i=Xl.indexOf(this.ArrayType),a=2*e*this.ArrayType.BYTES_PER_ELEMENT,o=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-o%8)%8;if(i<0)throw Error(`Unexpected typed array class: ${n}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+s,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+a+o+s),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+s,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return Ql(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this,s=[0,i.length-1,0],c=[];for(;s.length;){let l=s.pop()||0,u=s.pop()||0,d=s.pop()||0;if(u-d<=o){for(let o=d;o<=u;o++){let s=a[2*o],l=a[2*o+1];s>=e&&s<=n&&l>=t&&l<=r&&c.push(i[o])}continue}let f=d+u>>1,p=a[2*f],m=a[2*f+1];p>=e&&p<=n&&m>=t&&m<=r&&c.push(i[f]),(l===0?e<=p:t<=m)&&(s.push(d),s.push(f-1),s.push(1-l)),(l===0?n>=p:r>=m)&&(s.push(f+1),s.push(u),s.push(1-l))}return c}within(e,t,n){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:r,coords:i,nodeSize:a}=this,o=[0,r.length-1,0],s=[],c=n*n;for(;o.length;){let l=o.pop()||0,u=o.pop()||0,d=o.pop()||0;if(u-d<=a){for(let n=d;n<=u;n++)nu(i[2*n],i[2*n+1],e,t)<=c&&s.push(r[n]);continue}let f=d+u>>1,p=i[2*f],m=i[2*f+1];nu(p,m,e,t)<=c&&s.push(r[f]),(l===0?e-n<=p:t-n<=m)&&(o.push(d),o.push(f-1),o.push(1-l)),(l===0?e+n>=p:t+n>=m)&&(o.push(f+1),o.push(u),o.push(1-l))}return s}}function Ql(e,t,n,r,i,a){if(i-r<=n)return;let o=r+i>>1;$l(e,t,o,r,i,a),Ql(e,t,n,r,o-1,1-a),Ql(e,t,n,o+1,i,1-a)}function $l(e,t,n,r,i,a){for(;i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,c=Math.log(o),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(o-l)/o)*(s-o/2<0?-1:1);$l(e,t,n,Math.max(r,Math.floor(n-s*l/o+u)),Math.min(i,Math.floor(n+(o-s)*l/o+u)),a)}let o=t[2*n+a],s=r,c=i;for(eu(e,t,r,n),t[2*i+a]>o&&eu(e,t,r,i);s<c;){for(eu(e,t,s,c),s++,c--;t[2*s+a]<o;)s++;for(;t[2*c+a]>o;)c--}t[2*r+a]===o?eu(e,t,r,c):(c++,eu(e,t,c,i)),c<=n&&(r=c+1),n<=c&&(i=c-1)}}function eu(e,t,n,r){tu(e,n,r),tu(t,2*n,2*r),tu(t,2*n+1,2*r+1)}function tu(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function nu(e,t,n,r){let i=e-n,a=t-r;return i*i+a*a}function ru(e,t,n,r){let i=r,a=t+(n-t>>1),o,s=n-t,c=e[t],l=e[t+1],u=e[n],d=e[n+1];for(let r=t+3;r<n;r+=3){let t=iu(e[r],e[r+1],c,l,u,d);if(t>i)o=r,i=t;else if(t===i){let e=Math.abs(r-a);e<s&&(o=r,s=e)}}i>r&&(o-t>3&&ru(e,t,o,r),e[o+2]=i,n-o>3&&ru(e,o,n,r))}function iu(e,t,n,r,i,a){let o=i-n,s=a-r;if(o!==0||s!==0){let c=((e-n)*o+(t-r)*s)/(o*o+s*s);c>1?(n=i,r=a):c>0&&(n+=o*c,r+=s*c)}return o=e-n,s=t-r,o*o+s*s}function au(e,t,n,r){let i={type:t,geom:n},a={id:e??null,type:i.type,geometry:i.geom,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(i.type){case`Point`:case`MultiPoint`:su(a,i.geom);break;case`LineString`:su(a,i.geom.points);break;case`Polygon`:su(a,i.geom[0].points);break;case`MultiLineString`:for(let e of i.geom)su(a,e.points);break;case`MultiPolygon`:for(let e of i.geom)su(a,e[0].points)}return a}function ou(e){e.points.length>64&&(e.points=new Float64Array(e.points))}function su(e,t){for(let n=0;n<t.length;n+=3)e.minX=Math.min(e.minX,t[n]),e.minY=Math.min(e.minY,t[n+1]),e.maxX=Math.max(e.maxX,t[n]),e.maxY=Math.max(e.maxY,t[n+1])}function cu(e,t){let n=[];switch(e.type){case`FeatureCollection`:for(let r=0;r<e.features.length;r++)lu(n,e.features[r],t,r);break;case`Feature`:lu(n,e,t);break;default:lu(n,{geometry:e,properties:void 0},t)}return n}function lu(e,t,n,r){if(!t.geometry)return;if(t.geometry.type===`GeometryCollection`)return void function(e,t,n,r,i){for(let a of n.geometries)lu(e,{id:t.id,geometry:a,properties:t.properties},r,i)}(e,t,t.geometry,n,r);if(!t.geometry.coordinates?.length)return;let i=function(e,t,n){return t.promoteId?e.properties?.[t.promoteId]:t.generateId?n||0:e.id}(t,n,r),a=(n.tolerance/((1<<n.maxZoom)*n.extent))**2;switch(t.geometry.type){case`Point`:(function(e,t,n,r){let i=[];i.push(fu(n.coordinates[0]),pu(n.coordinates[1]),0),e.push(au(t,`Point`,i,r))})(e,i,t.geometry,t.properties);return;case`MultiPoint`:(function(e,t,n,r){let i=[];for(let e of n.coordinates)i.push(fu(e[0]),pu(e[1]),0);e.push(au(t,`MultiPoint`,i,r))})(e,i,t.geometry,t.properties);return;case`LineString`:(function(e,t,n,r,i){let a={points:[]};uu(n.coordinates,a,r,!1),e.push(au(t,`LineString`,a,i))})(e,i,t.geometry,a,t.properties);return;case`MultiLineString`:(function(e,t,n,r,i,a){if(i.lineMetrics)for(let i of n.coordinates){let n={points:[]};uu(i,n,r,!1),e.push(au(t,`LineString`,n,a))}else{let i=[];du(n.coordinates,i,r,!1),e.push(au(t,`MultiLineString`,i,a))}})(e,i,t.geometry,a,n,t.properties);return;case`Polygon`:(function(e,t,n,r,i){let a=[];du(n.coordinates,a,r,!0),e.push(au(t,`Polygon`,a,i))})(e,i,t.geometry,a,t.properties);return;case`MultiPolygon`:(function(e,t,n,r,i){let a=[];for(let e of n.coordinates){let t=[];du(e,t,r,!0),a.push(t)}e.push(au(t,`MultiPolygon`,a,i))})(e,i,t.geometry,a,t.properties);return;default:throw Error(`Input data is not a valid GeoJSON object.`)}}function uu(e,t,n,r){let i,a,o=0;for(let n=0;n<e.length;n++){let s=fu(e[n][0]),c=pu(e[n][1]);t.points.push(s,c,0),n>0&&(o+=r?(i*c-s*a)/2:Math.sqrt((s-i)**2+(c-a)**2)),i=s,a=c}let s=t.points.length-3;t.points[2]=1,n>0&&ru(t.points,0,s,n),t.points[s+2]=1,ou(t),t.size=Math.abs(o),t.start=0,t.end=t.size}function du(e,t,n,r){for(let i=0;i<e.length;i++){let a={points:[]};uu(e[i],a,n,r),t.push(a)}}function fu(e){return e/360+.5}function pu(e){let t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function mu(e){let t={type:`Feature`,geometry:hu(e),properties:e.tags};return e.id!=null&&(t.id=e.id),t}function hu(e){let{type:t,geometry:n}=e;switch(t){case`Point`:return{type:t,coordinates:_u(n[0],n[1])};case`MultiPoint`:return{type:t,coordinates:gu(n)};case`LineString`:return{type:t,coordinates:gu(n.points)};case`MultiLineString`:case`Polygon`:return{type:t,coordinates:n.map((e=>gu(e.points)))};case`MultiPolygon`:return{type:t,coordinates:n.map((e=>e.map((e=>gu(e.points)))))}}}function gu(e){let t=[];for(let n=0;n<e.length;n+=3)t.push(_u(e[n],e[n+1]));return t}function _u(e,t){return[vu(e),yu(t)]}function vu(e){return 360*(e-.5)}function yu(e){let t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}var bu;function xu(e,t,n,r,i,a,o,s){if(r/=t,a>=(n/=t)&&o<r)return e;if(o<n||a>=r)return null;let c=[];for(let t of e){let e=i===bu.X?t.minX:t.minY,a=i===bu.X?t.maxX:t.maxY;if(e>=n&&a<r)c.push(t);else if(!(a<n||e>=r))switch(t.type){case`Point`:case`MultiPoint`:Su(t,c,n,r,i);continue;case`LineString`:Cu(t,c,n,r,i,s);continue;case`MultiLineString`:wu(t,c,n,r,i);continue;case`Polygon`:Tu(t,c,n,r,i);continue;case`MultiPolygon`:Eu(t,c,n,r,i);continue}}return c.length?c:null}function Su(e,t,n,r,i){let a=[];(function(e,t,n,r,i){for(let a=0;a<e.length;a+=3){let o=e[a+i];o>=n&&o<=r&&Au(t,e[a],e[a+1],e[a+2])}})(e.geometry,a,n,r,i),a.length&&t.push(au(e.id,a.length===3?`Point`:`MultiPoint`,a,e.tags))}function Cu(e,t,n,r,i,a){let o=[];if(Du(e.geometry,o,n,r,i,!1,a.lineMetrics),o.length)if(a.lineMetrics)for(let n of o)t.push(au(e.id,`LineString`,n,e.tags));else t.push(o.length>1?au(e.id,`MultiLineString`,o,e.tags):au(e.id,`LineString`,o[0],e.tags))}function wu(e,t,n,r,i){let a=[];ku(e.geometry,a,n,r,i,!1),a.length&&t.push(a.length===1?au(e.id,`LineString`,a[0],e.tags):au(e.id,`MultiLineString`,a,e.tags))}function Tu(e,t,n,r,i){let a=[];ku(e.geometry,a,n,r,i,!0),a.length&&t.push(au(e.id,`Polygon`,a,e.tags))}function Eu(e,t,n,r,i){let a=[];for(let t of e.geometry){let e=[];ku(t,e,n,r,i,!0),e.length&&a.push(e)}a.length&&t.push(au(e.id,`MultiPolygon`,a,e.tags))}function Du(e,t,n,r,i,a,o){let s=Ou(e),c=i===bu.X?ju:Mu,l,u,d=e.start;for(let f=0;f<e.points.length-3;f+=3){let p=e.points[f],m=e.points[f+1],h=e.points[f+2],g=e.points[f+3],_=e.points[f+4],v=i===bu.X?p:m,y=i===bu.X?g:_,b=!1;o&&(l=Math.sqrt((p-g)**2+(m-_)**2)),v<n?y>n&&(u=c(s,p,m,g,_,n),o&&(s.start=d+l*u)):v>r?y<r&&(u=c(s,p,m,g,_,r),o&&(s.start=d+l*u)):Au(s.points,p,m,h),y<n&&v>=n&&(u=c(s,p,m,g,_,n),b=!0),y>r&&v<=r&&(u=c(s,p,m,g,_,r),b=!0),!a&&b&&(o&&(s.end=d+l*u),t.push(s),s=Ou(e)),o&&(d+=l)}let f=e.points.length-3,p=e.points[f],m=e.points[f+1],h=i===bu.X?p:m;h>=n&&h<=r&&Au(s.points,p,m,e.points[f+2]),f=s.points.length-3,a&&f>=3&&(s.points[f]!==s.points[0]||s.points[f+1]!==s.points[1])&&Au(s.points,s.points[0],s.points[1],s.points[2]),s.points.length&&(ou(s),t.push(s))}function Ou(e){return{points:[],size:e.size,start:e.start,end:e.end}}function ku(e,t,n,r,i,a){for(let o of e)Du(o,t,n,r,i,a,!1)}function Au(e,t,n,r){e.push(t,n,r)}function ju(e,t,n,r,i,a){let o=(a-t)/(r-t);return Au(e.points,a,n+(i-n)*o,1),o}function Mu(e,t,n,r,i,a){let o=(a-n)/(i-n);return Au(e.points,t+(r-t)*o,a,1),o}function Nu(e,t){let n=t.buffer/t.extent,r=e,i=xu(e,1,-1-n,n,bu.X,-1,2,t),a=xu(e,1,1-n,2+n,bu.X,-1,2,t);return i||a?(r=xu(e,1,-n,1+n,bu.X,-1,2,t)||[],i&&(r=Pu(i,1).concat(r)),a&&(r=r.concat(Pu(a,-1))),r):r}function Pu(e,t){let n=[];for(let r of e)switch(r.type){case`Point`:case`MultiPoint`:{let e=Fu(r.geometry,t);n.push(au(r.id,r.type,e,r.tags));continue}case`LineString`:{let e=Iu(r.geometry,t);n.push(au(r.id,r.type,e,r.tags));continue}case`MultiLineString`:case`Polygon`:{let e=[];for(let n of r.geometry)e.push(Iu(n,t));n.push(au(r.id,r.type,e,r.tags));continue}case`MultiPolygon`:{let e=[];for(let n of r.geometry){let r=[];for(let e of n)r.push(Iu(e,t));e.push(r)}n.push(au(r.id,r.type,e,r.tags));continue}}return n}function Fu(e,t){let n=[];for(let r=0;r<e.length;r+=3)n.push(e[r]+t,e[r+1],e[r+2]);return n}function Iu(e,t){let n={points:[],size:e.size};e.start!==void 0&&(n.start=e.start,n.end=e.end);for(let r=0;r<e.points.length;r+=3)n.points.push(e.points[r]+t,e.points[r+1],e.points[r+2]);return ou(n),n}function Lu(e,t,n){let r=!!t.newGeometry,i=t.removeAllProperties||t.removeProperties?.length>0||t.addOrUpdateProperties?.length>0;if(r){let r=e[0],a=cu({type:`FeatureCollection`,features:[{type:`Feature`,id:r.id,geometry:t.newGeometry,properties:i?Ru(r.tags,t):r.tags}]},n);return a=Nu(a,n),a}if(i){let n=[];for(let r of e){let e={...r};e.tags=Ru(e.tags,t),n.push(e)}return n}return e}function Ru(e,t){if(t.removeAllProperties)return{};let n={...e||{}};if(t.removeProperties)for(let e of t.removeProperties)delete n[e];if(t.addOrUpdateProperties)for(let{key:e,value:r}of t.addOrUpdateProperties)n[e]=r;return n}(function(e){e[e.X=0]=`X`,e[e.Y=1]=`Y`})(bu||={});let zu={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e};class Bu{constructor(e){this.options=Object.assign(Object.create(zu),e),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(e){let t=[];for(let n of e){if(!n.geometry)continue;let[e,r]=n.geometry.coordinates,[i,a]=[fu(e),pu(r)];t.push({id:n.id,type:`Point`,geometry:[i,a],tags:n.properties})}this.createIndex(t)}initialize(e){let t=[];for(let n of e)n.type===`Point`&&t.push(n);this.createIndex(t)}updateIndex(e,t,n){this.options=Object.assign(Object.create(zu),n.clusterOptions),this.initialize(e)}createIndex(e){let{log:t,minZoom:n,maxZoom:r}=this.options;t&&console.time(`total time`);let i=`prepare ${e.length} points`;t&&console.time(i),this.points=e;let a=[];for(let t=0;t<e.length;t++){let n=e[t];if(!n?.geometry)continue;let[r,i]=n.geometry;r=Math.fround(r),i=Math.fround(i),a.push(r,i,1/0,t,-1,1),this.options.reduce&&a.push(0)}let o=this.trees[r+1]=this.createTree(a);t&&console.timeEnd(i);for(let e=r;e>=n;e--){let n=Date.now();o=this.trees[e]=this.createTree(this.cluster(o,e)),t&&console.log(`z%d: %d clusters in %dms`,e,o.numItems,Date.now()-n)}t&&console.timeEnd(`total time`)}getClusters(e,t){return this.getClustersInternal(e,t).map((e=>mu(e)))}getClustersInternal(e,t){let n=((e[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,e[1])),i=e[2]===180?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,i=180;else if(n>i){let e=this.getClustersInternal([n,r,180,a],t),o=this.getClustersInternal([-180,r,i,a],t);return e.concat(o)}let o=this.trees[this.limitZoom(t)],s=o.range(fu(n),pu(a),fu(i),pu(r)),c=o.flatData,l=[];for(let e of s){let t=this.stride*e;l.push(c[t+5]>1?Vu(c,t,this.clusterProps):this.points[c[t+3]])}return l}getChildren(e){let t=this.getOriginId(e),n=this.getOriginZoom(e),r=Error(`No cluster with the specified id: `+e),i=this.trees[n];if(!i)throw r;let a=i.flatData;if(t*this.stride>=a.length)throw r;let o=this.options.radius/(this.options.extent*2**(n-1)),s=i.within(a[t*this.stride],a[t*this.stride+1],o),c=[];for(let t of s){let n=t*this.stride;a[n+4]===e&&c.push(a[n+5]>1?Hu(a,n,this.clusterProps):mu(this.points[a[n+3]]))}if(c.length===0)throw r;return c}getLeaves(e,t,n){let r=[];return this.appendLeaves(r,e,t||=10,n||=0,0),r}getTile(e,t,n){let r=this.trees[this.limitZoom(e)];if(!r)return null;let i=2**e,{extent:a,radius:o}=this.options,s=o/a,c=(n-s)/i,l=(n+1+s)/i,u={transformed:!0,features:[],source:null,x:t,y:n,z:e};return this.addTileFeatures(r.range((t-s)/i,c,(t+1+s)/i,l),r.flatData,t,n,i,u),t===0&&this.addTileFeatures(r.range(1-s/i,c,1,l),r.flatData,i,n,i,u),t===i-1&&this.addTileFeatures(r.range(0,c,s/i,l),r.flatData,-1,n,i,u),u}getClusterExpansionZoom(e){return this.getOriginZoom(e)}appendLeaves(e,t,n,r,i){let a=this.getChildren(t);for(let t of a){let a=t.properties;if(a?.cluster?i+a.point_count<=r?i+=a.point_count:i=this.appendLeaves(e,a.cluster_id,n,r,i):i<r?i++:e.push(t),e.length===n)break}return i}createTree(e){let t=new Zl(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let n=0;n<e.length;n+=this.stride)t.add(e[n],e[n+1]);return t.finish(),t.flatData=e,t.data=null,t}addTileFeatures(e,t,n,r,i,a){for(let o of e){let e=o*this.stride,s=t[e+5]>1,c,l,u;if(s)c=Uu(t,e,this.clusterProps),l=t[e],u=t[e+1];else{let n=this.points[t[e+3]];c=n.tags,[l,u]=n.geometry}let d={type:1,geometry:[[Math.round(this.options.extent*(l*i-n)),Math.round(this.options.extent*(u*i-r))]],tags:c},f;f=s||this.options.generateId?t[e+3]:this.points[t[e+3]].id,f!==void 0&&(d.id=f),a.features.push(d)}}limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}cluster(e,t){let{radius:n,extent:r,reduce:i,minPoints:a}=this.options,o=n/(r*2**t),s=e.flatData,c=[],l=this.stride;for(let n=0;n<s.length;n+=l){if(s[n+2]<=t)continue;s[n+2]=t;let r=s[n],u=s[n+1],d=e.within(s[n],s[n+1],o),f=s[n+5],p=f;for(let e of d){let n=e*l;s[n+2]>t&&(p+=s[n+5])}if(p>f&&p>=a){let e,a=r*f,o=u*f,m=-1,h=(n/l<<5)+(t+1)+this.points.length;for(let r of d){let c=r*l;if(s[c+2]<=t)continue;s[c+2]=t;let u=s[c+5];a+=s[c]*u,o+=s[c+1]*u,s[c+4]=h,i&&(e||(e=this.map(s,n,!0),m=this.clusterProps.length,this.clusterProps.push(e)),i(e,this.map(s,c)))}s[n+4]=h,c.push(a/p,o/p,1/0,h,-1,p),i&&c.push(m)}else{for(let e=0;e<l;e++)c.push(s[n+e]);if(p>1)for(let e of d){let n=e*l;if(!(s[n+2]<=t)){s[n+2]=t;for(let e=0;e<l;e++)c.push(s[n+e])}}}}return c}getOriginId(e){return e-this.points.length>>5}getOriginZoom(e){return(e-this.points.length)%32}map(e,t,n){if(e[t+5]>1){let r=this.clusterProps[e[t+6]];return n?Object.assign({},r):r}let r=this.points[e[t+3]].tags,i=this.options.map(r);return n&&i===r?Object.assign({},i):i}}function Vu(e,t,n){return{id:e[t+3],type:`Point`,tags:Uu(e,t,n),geometry:[e[t],e[t+1]]}}function Hu(e,t,n){return{type:`Feature`,id:e[t+3],properties:Uu(e,t,n),geometry:{type:`Point`,coordinates:[vu(e[t]),yu(e[t+1])]}}}function Uu(e,t,n){let r=e[t+5],i=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+`k`:r,a=e[t+6],o=a===-1?{}:Object.assign({},n[a]);return Object.assign(o,{cluster:!0,cluster_id:e[t+3],point_count:r,point_count_abbreviated:i})}let Wu=`geojsonvt_clip_start`,Gu=`geojsonvt_clip_end`;function Ku(e,t,n,r,i){let a=t===i.maxZoom?0:i.tolerance/((1<<t)*i.extent),o={transformed:!1,features:[],source:null,x:n,y:r,z:t,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:e.length};for(let t of e)qu(o,t,a,i);return o}function qu(e,t,n,r){switch(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),t.type){case`Point`:case`MultiPoint`:(function(e,t){let n=[];for(let r=0;r<t.geometry.length;r+=3)n.push(t.geometry[r],t.geometry[r+1]),e.numPoints++,e.numSimplified++;if(!n.length)return;let r={type:1,tags:t.tags||null,geometry:n};t.id!==null&&(r.id=t.id),e.features.push(r)})(e,t);return;case`LineString`:(function(e,t,n,r){let i=[];if(Ju(i,t.geometry,e,n,!1,!1),!i.length)return;let a=t.tags||null;if(r.lineMetrics){a={};for(let e in t.tags)a[e]=t.tags[e];a[Wu]=t.geometry.start/t.geometry.size,a[Gu]=t.geometry.end/t.geometry.size}let o={type:2,tags:a,geometry:i};t.id!==null&&(o.id=t.id),e.features.push(o)})(e,t,n,r);return;case`MultiLineString`:case`Polygon`:(function(e,t,n){let r=[];for(let i=0;i<t.geometry.length;i++)Ju(r,t.geometry[i],e,n,t.type===`Polygon`,i===0);if(!r.length)return;let i={type:t.type===`Polygon`?3:2,tags:t.tags||null,geometry:r};t.id!==null&&(i.id=t.id),e.features.push(i)})(e,t,n);return;case`MultiPolygon`:(function(e,t,n){let r=[];for(let i=0;i<t.geometry.length;i++){let a=t.geometry[i];for(let t=0;t<a.length;t++)Ju(r,a[t],e,n,!0,t===0)}if(!r.length)return;let i={type:3,tags:t.tags||null,geometry:r};t.id!==null&&(i.id=t.id),e.features.push(i)})(e,t,n);return}}function Ju(e,t,n,r,i,a){let o=r*r;if(r>0&&t.size<(i?o:r))return void(n.numPoints+=t.points.length/3);let s=[];for(let e=0;e<t.points.length;e+=3)(r===0||t.points[e+2]>o)&&(n.numSimplified++,s.push(t.points[e],t.points[e+1])),n.numPoints++;i&&function(e,t){let n=0;for(let t=0,r=e.length,i=r-2;t<r;i=t,t+=2)n+=(e[t]-e[i])*(e[t+1]+e[i+1]);if(n>0===t)for(let t=0,n=e.length;t<n/2;t+=2){let r=e[t],i=e[t+1];e[t]=e[n-2-t],e[t+1]=e[n-1-t],e[n-2-t]=r,e[n-1-t]=i}}(s,a),e.push(s)}function Yu(e,t){if(e.transformed)return e;let n=1<<e.z,r=e.x,i=e.y;for(let a of e.features)a.type===1?Xu(a,t,n,r,i):Zu(a,t,n,r,i);return e.transformed=!0,e}function Xu(e,t,n,r,i){let a=e,o=e.geometry,s=[];for(let e=0;e<o.length;e+=2)s.push(Qu(o[e],o[e+1],t,n,r,i));return a.geometry=s,a}function Zu(e,t,n,r,i){let a=e,o=e.geometry,s=[];for(let e of o){let a=[];for(let o=0;o<e.length;o+=2)a.push(Qu(e[o],e[o+1],t,n,r,i));s.push(a)}return a.geometry=s,a}function Qu(e,t,n,r,i,a){return[Math.round(n*(e*r-i)),Math.round(n*(t*r-a))]}class $u{constructor(e){this.options=e,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(e){this.splitTile(e,0,0,0),this.options.debug&&(e.length&&console.log(`features: %d, points: %d`,this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd(`generate tiles`),console.log(`tiles generated:`,this.total,JSON.stringify(this.stats)))}updateIndex(e,t,n){n.debug>1&&(console.log(`invalidating tiles`),console.time(`invalidating`)),this.invalidateTiles(t),n.debug>1&&console.timeEnd(`invalidating`);let[r,i,a]=[0,0,0],o=Ku(e,r,i,a,n);o.source=e;let s=ed(r,i,a);if(this.tiles[s]=o,this.tileCoords.push({z:r,x:i,y:a,id:s}),n.debug){let e=`z${r}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}}getClusterExpansionZoom(e){return null}getChildren(e){return null}getLeaves(e,t,n){return null}getTile(e,t,n){let{extent:r,debug:i}=this.options,a=1<<e,o=ed(e,t=t+a&a-1,n);if(this.tiles[o])return Yu(this.tiles[o],r);i>1&&console.log(`drilling down to z%d-%d-%d`,e,t,n);let s,c=e,l=t,u=n;for(;!s&&c>0;)c--,l>>=1,u>>=1,s=this.tiles[ed(c,l,u)];return s?.source?(i>1&&(console.log(`found parent tile z%d-%d-%d`,c,l,u),console.time(`drilling down`)),this.splitTile(s.source,c,l,u,e,t,n),i>1&&console.timeEnd(`drilling down`),this.tiles[o]?Yu(this.tiles[o],r):null):null}splitTile(e,t,n,r,i,a,o){let s=[e,t,n,r],c=this.options,l=c.debug;for(;s.length;){r=s.pop(),n=s.pop(),t=s.pop(),e=s.pop();let u=1<<t,d=ed(t,n,r),f=this.tiles[d];if(!f&&(l>1&&console.time(`creation`),f=this.tiles[d]=Ku(e,t,n,r,c),this.tileCoords.push({z:t,x:n,y:r,id:d}),l)){l>1&&(console.log(`tile z%d-%d-%d (features: %d, points: %d, simplified: %d)`,t,n,r,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd(`creation`));let e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(f.source=e,i==null){if(t===c.indexMaxZoom||f.numPoints<=c.indexMaxPoints)continue}else{if(t===c.maxZoom||t===i)continue;if(i!=null){let e=i-t;if(n!==a>>e||r!==o>>e)continue}}if(f.source=null,!e.length)continue;l>1&&console.time(`clipping`);let p=.5*c.buffer/c.extent,m=.5-p,h=.5+p,g=1+p,_=null,v=null,y=null,b=null,x=xu(e,u,n-p,n+h,bu.X,f.minX,f.maxX,c),S=xu(e,u,n+m,n+g,bu.X,f.minX,f.maxX,c);x&&(_=xu(x,u,r-p,r+h,bu.Y,f.minY,f.maxY,c),v=xu(x,u,r+m,r+g,bu.Y,f.minY,f.maxY,c)),S&&(y=xu(S,u,r-p,r+h,bu.Y,f.minY,f.maxY,c),b=xu(S,u,r+m,r+g,bu.Y,f.minY,f.maxY,c)),l>1&&console.timeEnd(`clipping`),s.push(_||[],t+1,2*n,2*r),s.push(v||[],t+1,2*n,2*r+1),s.push(y||[],t+1,2*n+1,2*r),s.push(b||[],t+1,2*n+1,2*r+1)}}invalidateTiles(e){if(!e.length)return;let t=this.options,{debug:n}=t,r=1/0,i=-1/0,a=1/0,o=-1/0;for(let t of e)r=Math.min(r,t.minX),i=Math.max(i,t.maxX),a=Math.min(a,t.minY),o=Math.max(o,t.maxY);let s=t.buffer/t.extent,c=new Set;for(let t in this.tiles){let l=this.tiles[t],u=1<<l.z,d=(l.x-s)/u,f=(l.x+1+s)/u,p=(l.y-s)/u,m=(l.y+1+s)/u;if(i<d||r>=f||o<p||a>=m)continue;let h=!1;for(let t of e)if(t.maxX>=d&&t.minX<f&&t.maxY>=p&&t.minY<m){h=!0;break}if(h){if(n){n>1&&console.log(`invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)`,l.z,l.x,l.y,l.numFeatures,l.numPoints,l.numSimplified);let e=`z${l.z}`;this.stats[e]=(this.stats[e]||0)-1,this.total--}delete this.tiles[t],c.add(t)}}c.size&&(this.tileCoords=this.tileCoords.filter((e=>!c.has(e.id))))}}function ed(e,t,n){return 32*((1<<e)*n+t)+e}let td={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:zu,debug:0},{members:nd}=oo([{name:`a_pos_normal`,components:2,type:`Int16`},{name:`a_data`,components:4,type:`Uint8`}],4),{members:rd}=oo([{name:`a_uv_x`,components:1,type:`Float32`},{name:`a_split_index`,components:1,type:`Float32`}]),id=Math.cos(Math.PI/180*37.5),ad=2**14/.5;class od{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let e of this.layers)this.gradients[e.id]={};this.layoutVertexArray=new Yo,this.layoutVertexArray2=new Xo,this.indexArray=new is,this.programConfigurations=new Is(e.layers,e.zoom),this.segments=new ss,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){this.hasDependencies=Bc(`line`,this.layers,t)||this.hasLineDasharray(this.layers);let r=this.layers[0].layout.get(`line-sort-key`),i=!r.isConstant(),a=[];for(let{feature:t,id:o,index:s,sourceLayerIndex:c}of e){let e=this.layers[0]._featureFilter.needGeometry,l=Hs(t,e);if(!this.layers[0]._featureFilter.filter(new Y(this.zoom),l,n))continue;let u=i?r.evaluate(l,{},n):void 0,d={id:o,properties:t.properties,type:t.type,sourceLayerIndex:c,index:s,geometry:e?l.geometry:Vs(t),patterns:{},dashes:{},sortKey:u};a.push(d)}i&&a.sort(((e,t)=>e.sortKey-t.sortKey));for(let r of a){let{geometry:i,index:a,sourceLayerIndex:o}=r;this.hasDependencies?(Bc(`line`,this.layers,t)?Vc(`line`,this.layers,r,{zoom:this.zoom},t):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,r,this.zoom,t),this.patternFeatures.push(r)):this.addFeature(r,i,a,n,{},{},t.subdivisionGranularity),t.featureIndex.insert(e[a].feature,i,a,o,this.index)}}update(e,t,n,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:n,dashPositions:r})}addFeatures(e,t,n,r){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,t,n,r,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,rd)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,nd),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.hasOwn(e.properties,Wu)&&Object.hasOwn(e.properties,Gu))return{start:+e.properties[Wu],end:+e.properties[Gu]}}addFeature(e,t,n,r,i,a,o){let s=this.layers[0].layout,c=s.get(`line-join`).evaluate(e,{}),l=s.get(`line-cap`).evaluate(e,{}),u=s.get(`line-miter-limit`).evaluate(e,{}),d=s.get(`line-round-limit`).evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(let n of t)this.addLine(n,e,c,l,u,d,r,o);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{imagePositions:i,dashPositions:a,canonical:r})}addLine(e,t,n,r,i,a,o,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=yl(e,o?s.line.getGranularityForZoomLevel(o.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let c=jl.types[t.type]===`Polygon`,l=e.length;for(;l>=2&&e[l-1].equals(e[l-2]);)l--;let u=0;for(;u<l-1&&e[u].equals(e[u+1]);)u++;if(l<(c?3:2))return;n===`bevel`&&(i=1.05);let d=this.overscaling<=16?122880/(512*this.overscaling):0,f=this.segments.prepareSegment(10*l,this.layoutVertexArray,this.indexArray),p,m,h,g,_;this.e1=this.e2=-1,c&&(p=e[l-2],_=e[u].sub(p)._unit()._perp());for(let t=u;t<l;t++){if(h=t===l-1?c?e[u+1]:void 0:e[t+1],h&&e[t].equals(h))continue;_&&(g=_),p&&(m=p),p=e[t],_=h?h.sub(p)._unit()._perp():g,g||=_;let o=g.add(_);o.x===0&&o.y===0||o._unit();let s=g.x*_.x+g.y*_.y,v=o.x*_.x+o.y*_.y,y=v===0?1/0:1/v,b=2*Math.sqrt(2-2*v),x=v<id&&m&&h,S=g.x*_.y-g.y*_.x>0;if(x&&t>u){let e=p.dist(m);if(e>2*d){let t=p.sub(p.sub(m)._mult(d/e)._round());this.updateDistance(m,t),this.addCurrentVertex(t,g,0,0,f),m=t}}let C=m&&h,w=C?n:c?`butt`:r;if(C&&w===`round`&&(y<a?w=`miter`:y<=2&&(w=`fakeround`)),w===`miter`&&y>i&&(w=`bevel`),w===`bevel`&&(y>2&&(w=`flipbevel`),y<i&&(w=`miter`)),m&&this.updateDistance(m,p),w===`miter`)o._mult(y),this.addCurrentVertex(p,o,0,0,f);else if(w===`flipbevel`){if(y>100)o=_.mult(-1);else{let e=y*g.add(_).mag()/g.sub(_).mag();o._perp()._mult(e*(S?-1:1))}this.addCurrentVertex(p,o,0,0,f),this.addCurrentVertex(p,o.mult(-1),0,0,f)}else if(w===`bevel`||w===`fakeround`){let e=-Math.sqrt(y*y-1),t=S?e:0,n=S?0:e;if(m&&this.addCurrentVertex(p,g,t,n,f),w===`fakeround`){let e=Math.round(180*b/Math.PI/20);for(let t=1;t<e;t++){let n=t/e;if(n!==.5){let e=n-.5;n+=n*e*(n-1)*((1.0904+s*(s*(3.55645-1.43519*s)-3.2452))*e*e+(.848013+s*(.215638*s-1.06021)))}let r=_.sub(g)._mult(n)._add(g)._unit()._mult(S?-1:1);this.addHalfVertex(p,r.x,r.y,!1,S,0,f)}}h&&this.addCurrentVertex(p,_,-t,-n,f)}else if(w===`butt`)this.addCurrentVertex(p,o,0,0,f);else if(w===`square`){let e=m?1:-1;this.addCurrentVertex(p,o,e,e,f)}else w===`round`&&(m&&(this.addCurrentVertex(p,g,0,0,f),this.addCurrentVertex(p,g,1,1,f,!0)),h&&(this.addCurrentVertex(p,_,-1,-1,f,!0),this.addCurrentVertex(p,_,0,0,f)));if(x&&t<l-1){let e=p.dist(h);if(e>2*d){let t=p.add(h.sub(p)._mult(d/e)._round());this.updateDistance(p,t),this.addCurrentVertex(t,_,0,0,f),p=t}}}}addCurrentVertex(e,t,n,r,i,a=!1){let o=t.y*r-t.x,s=-t.y-t.x*r;this.addHalfVertex(e,t.x+t.y*n,t.y-t.x*n,a,!1,n,i),this.addHalfVertex(e,o,s,a,!0,-r,i),this.distance>ad/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,n,r,i,a))}addHalfVertex({x:e,y:t},n,r,i,a,o,s){let c=.5*(this.lineClips?this.scaledDistance*(ad-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+ +!!i,(t<<1)+ +!!a,Math.round(63*n)+128,Math.round(63*r)+128,1+(o===0?0:o<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=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,l,this.e2),s.primitiveLength++),a?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(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}hasLineDasharray(e){for(let t of e){let e=t.paint.get(`line-dasharray`);if(e&&!e.isConstant())return!0}return!1}addLineDashDependencies(e,t,n,r){for(let i of e){let e=i.paint.get(`line-dasharray`);if(!e||e.value.kind===`constant`)continue;let a=i.layout.get(`line-cap`).evaluate(t,{})===`round`,o={dasharray:e.value.evaluate({zoom:n-1},t,{}),round:a},s={dasharray:e.value.evaluate({zoom:n},t,{}),round:a},c={dasharray:e.value.evaluate({zoom:n+1},t,{}),round:a},l=`${o.dasharray.join(`,`)},${o.round}`,u=`${s.dasharray.join(`,`)},${s.round}`,d=`${c.dasharray.join(`,`)},${c.round}`;r.dashDependencies[l]=o,r.dashDependencies[u]=s,r.dashDependencies[d]=c,t.dashes[i.id]={min:l,mid:u,max:d}}}}let sd,cd;J(`LineBucket`,od,{omit:[`layers`,`patternFeatures`]});var ld={get paint(){return cd||=new Xa({"line-opacity":new Z(N.paint_line[`line-opacity`]),"line-color":new Z(N.paint_line[`line-color`]),"line-translate":new X(N.paint_line[`line-translate`]),"line-translate-anchor":new X(N.paint_line[`line-translate-anchor`]),"line-width":new Z(N.paint_line[`line-width`]),"line-gap-width":new Z(N.paint_line[`line-gap-width`]),"line-offset":new Z(N.paint_line[`line-offset`]),"line-blur":new Z(N.paint_line[`line-blur`]),"line-dasharray":new qa(N.paint_line[`line-dasharray`]),"line-pattern":new qa(N.paint_line[`line-pattern`]),"line-gradient":new Ya(N.paint_line[`line-gradient`])})},get layout(){return sd||=new Xa({"line-cap":new Z(N.layout_line[`line-cap`]),"line-join":new Z(N.layout_line[`line-join`]),"line-miter-limit":new Z(N.layout_line[`line-miter-limit`]),"line-round-limit":new Z(N.layout_line[`line-round-limit`]),"line-sort-key":new Z(N.layout_line[`line-sort-key`])})}};class ud extends Z{possiblyEvaluate(e,t){return t=new Y(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,n,r){return t=oe({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,n,r)}}let dd;class fd extends $a{constructor(e,t){super(e,ld,t),this.gradientVersion=0,dd||(dd=new ud(ld.paint.properties[`line-width`].specification),dd.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e===`line-gradient`){let e=this.gradientExpression();this.stepInterpolant=!!function(e){return e._styleExpression!==void 0}(e)&&e._styleExpression.expression instanceof gn,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values[`line-gradient`].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values[`line-floorwidth`]=dd.possiblyEvaluate(this._transitioningPaint._values[`line-width`].value,e)}createBucket(e){return new od(e)}queryRadius(e){let t=e,n=pd(rc(`line-width`,this,t),rc(`line-gap-width`,this,t)),r=rc(`line-offset`,this,t);return n/2+Math.abs(r)+ic(this.paint.get(`line-translate`))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:a,pixelsToTileUnits:o}){let s=ac(e,this.paint.get(`line-translate`),this.paint.get(`line-translate-anchor`),-a.bearingInRadians,o),c=o/2*pd(this.paint.get(`line-width`).evaluate(t,r),this.paint.get(`line-gap-width`).evaluate(t,r)),l=this.paint.get(`line-offset`).evaluate(t,r);return l&&(i=function(e,t){let r=[];for(let i of e){let e=oc(i),a=[];for(let r=0;r<e.length;r++){let i=e[r],o=e[r-1],s=e[r+1],c=r===0?new n(0,0):i.sub(o)._unit()._perp(),l=r===e.length-1?new n(0,0):s.sub(i)._unit()._perp(),u=c._add(l)._unit(),d=u.x*l.x+u.y*l.y;d!==0&&u._mult(1/d),a.push(u._mult(t)._add(i))}r.push(a)}return r}(i,l*o)),function(e,t,n){for(let r of t){if(e.length>=3){for(let t of r)if(tc(e,t))return!0}if(Ys(e,r,n))return!0}return!1}(s,i,c)}isTileClipped(){return!0}}function pd(e,t){return t>0?t+2*e:e}let md=oo([{name:`a_pos_offset`,components:4,type:`Int16`},{name:`a_data`,components:4,type:`Uint16`},{name:`a_pixeloffset`,components:4,type:`Int16`}],4),hd=oo([{name:`a_projected_pos`,components:3,type:`Float32`}],4);oo([{name:`a_fade_opacity`,components:1,type:`Uint32`}],4);let gd=oo([{name:`a_placed`,components:2,type:`Uint8`},{name:`a_shift`,components:2,type:`Float32`},{name:`a_box_real`,components:2,type:`Int16`}]);oo([{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 _d=oo([{name:`a_pos`,components:2,type:`Int16`},{name:`a_anchor_pos`,components:2,type:`Int16`},{name:`a_extrude`,components:2,type:`Int16`}],4),vd=oo([{name:`a_pos`,components:2,type:`Float32`},{name:`a_radius`,components:1,type:`Float32`},{name:`a_flags`,components:2,type:`Int16`}],4);function yd(e,t,n){let r=t.layout.get(`text-transform`).evaluate(n,{});return r===`uppercase`?e=e.toLocaleUpperCase():r===`lowercase`&&(e=e.toLocaleLowerCase()),Ia.applyArabicShaping&&(e=Ia.applyArabicShaping(e)),e}function bd(e,t,n){for(let r of e.sections)r.text=yd(r.text,t,n);return e}oo([{name:`triangle`,components:3,type:`Uint16`}]),oo([{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`}]),oo([{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`}]),oo([{type:`Float32`,name:`offsetX`}]),oo([{type:`Int16`,name:`x`},{type:`Int16`,name:`y`},{type:`Int16`,name:`tileUnitDistanceFromAnchor`}]),oo([{type:`Uint16`,name:`textAnchor`},{type:`Float32`,components:2,name:`textOffset`}]);var xd=24;let Sd={"!":`︕`,"#":`#`,$:`$`,"%":`%`,"&":`&`,"(":`︵`,")":`︶`,"*":`*`,"+":`+`,",":`︐`,"-":`︲`,".":`・`,"/":`/`,":":`︓`,";":`︔`,"<":`︿`,"=":`=`,">":`﹀`,"?":`︖`,"@":`@`,"[":`﹇`,"\\":`\`,"]":`﹈`,"^":`^`,_:`︳`,"`":```,"{":`︷`,"|":`―`,"}":`︸`,"~":`~`,"¢":`¢`,"£":`£`,"¥":`¥`,"¦":`¦`,"¬":`¬`,"¯":` ̄`,"–":`︲`,"—":`︱`,"‘":`﹃`,"’":`﹄`,"“":`﹁`,"”":`﹂`,"…":`︙`,"⋯":`︙`,"‧":`・`,"₩":`₩`,"、":`︑`,"。":`︒`,"〈":`︿`,"〉":`﹀`,"《":`︽`,"》":`︾`,"「":`﹁`,"」":`﹂`,"『":`﹃`,"』":`﹄`,"【":`︻`,"】":`︼`,"〔":`︹`,"〕":`︺`,"〖":`︗`,"〗":`︘`,"!":`︕`,"(":`︵`,")":`︶`,",":`︐`,"-":`︲`,".":`・`,":":`︓`,";":`︔`,"<":`︿`,">":`﹀`,"?":`︖`,"[":`﹇`,"]":`﹈`,"_":`︳`,"{":`︷`,"|":`―`,"}":`︸`,"⦅":`︵`,"⦆":`︶`,"。":`︒`,"「":`﹁`,"」":`﹂`},Cd={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},wd={40:!0};function Td(e,t,n,r,i,a){if(`fontStack`in t){let r=n[t.fontStack]?.[e];return r?r.metrics.advance*t.scale+i:0}{let e=r[t.imageName];return e?e.displaySize[0]*t.scale*xd/a+i:0}}function Ed(e,t,n,r){let i=(e-t)**2;return r?e<t?i/2:2*i:i+Math.abs(n)*n}function Dd(e,t,n){let r=0;return e===10&&(r-=1e4),n&&(r+=150),e!==40&&e!==65288||(r+=50),t!==41&&t!==65289||(r+=50),r}function Od(e,t,n,r,i,a){let o=null,s=Ed(t,n,i,a);for(let e of r){let r=Ed(t-e.x,n,i,a)+e.badness;r<=s&&(o=e,s=r)}return{index:e,x:t,priorBreak:o,badness:s}}function kd(e){return e?kd(e.priorBreak).concat(e.index):[]}class Ad{constructor(e=``,t=[],n=[]){this.text=e,this.sections=t,this.sectionIndex=n,this.imageSectionID=null}static fromFeature(e,t){let n=new Ad;for(let r of e.sections)r.image?n.addImageSection(r):n.addTextSection(r,t);return n}length(){return[...this.text].length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=function(e){let t=``,n={premature:!0,value:void 0},r=e[Symbol.iterator](),i=r.next(),a=e[Symbol.iterator]();a.next();let o=a.next();for(;!i.done;)t+=!o.done&&ja(o.value.codePointAt(0))&&!Sd[o.value]||!n.premature&&ja(n.value.codePointAt(0))&&!Sd[n.value]||!Sd[i.value]?i.value:Sd[i.value],n={value:i.value,premature:!1},i=r.next(),o=a.next();return t}(this.text)}hasZeroWidthSpaces(){return this.text.includes(`​`)}trim(){let e=this.text.match(/^\s*/),t=e?e[0].length:0,n=this.text.match(/\S\s*$/),r=n?n[0].length-1:0;this.text=this.text.substring(t,this.text.length-r),this.sectionIndex=this.sectionIndex.slice(t,this.sectionIndex.length-r)}substring(e,t){let n=[...this.text].slice(e,t).join(``),r=this.sectionIndex.slice(e,t);return new Ad(n,this.sections,r)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join(``).length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,t)=>Math.max(e,this.sections[t].scale)),0)}getMaxImageSize(e){let t=0,n=0;for(let r=0;r<this.length();r++){let i=this.getSection(r);if(`imageName`in i){let r=e[i.imageName];if(!r)continue;let a=r.displaySize;t=Math.max(t,a[0]),n=Math.max(n,a[1])}}return{maxImageWidth:t,maxImageHeight:n}}addTextSection(e,t){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||`bottom`,fontStack:e.fontStack||t});let n=this.sections.length-1;this.sectionIndex.push(...[...e.text].map((()=>n)))}addImageSection(e){let t=e.image?e.image.name:``;if(t.length===0)return void de(`Can't add FormattedSection with an empty image.`);let n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCharCode(n),this.sections.push({scale:1,verticalAlign:e.verticalAlign||`bottom`,imageName:t}),this.sectionIndex.push(this.sections.length-1)):de(`Reached maximum number of images 6401`)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,t,n,r,i){let a=[],o=this.determineAverageLineWidth(e,t,n,r,i),s=this.hasZeroWidthSpaces(),c=0,l=0,u=this.text[Symbol.iterator](),d=u.next(),f=this.text[Symbol.iterator]();f.next();let p=f.next(),m=this.text[Symbol.iterator]();m.next(),m.next();let h=m.next();for(;!d.done;){let t=this.getSection(l),g=d.value.codePointAt(0);if(Ta(g)||(c+=Td(g,t,n,r,e,i)),!p.done){let e=Ca(g),n=p.value.codePointAt(0);(Cd[g]||e||`imageName`in t||!h.done&&wd[n])&&a.push(Od(l+1,c,o,a,Dd(g,n,e&&s),!1))}l++,d=u.next(),p=f.next(),h=m.next()}return kd(Od(this.length(),c,o,a,0,!0))}determineAverageLineWidth(e,t,n,r,i){let a=0,o=0;for(let t of this.text){let s=this.getSection(o);a+=Td(t.codePointAt(0),s,n,r,e,i),o++}return a/Math.max(1,Math.ceil(a/t))}}let jd=4294967296,Md=1/jd,Nd=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`);class Pd{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,n=this.length){for(;this.pos<n;){let n=this.readVarint(),r=n>>3,i=this.pos;this.type=7&n,e(r,t,this),this.pos===i&&this.skip(n)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){let e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){let e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*jd;return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*jd;return this.pos+=8,e}readFloat(){let e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){let e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){let t=this.buf,n,r;return r=t[this.pos++],n=127&r,r<128?n:(r=t[this.pos++],n|=(127&r)<<7,r<128?n:(r=t[this.pos++],n|=(127&r)<<14,r<128?n:(r=t[this.pos++],n|=(127&r)<<21,r<128?n:(r=t[this.pos],n|=(15&r)<<28,function(e,t,n){let r=n.buf,i,a;if(a=r[n.pos++],i=(112&a)>>4,a<128||(a=r[n.pos++],i|=(127&a)<<3,a<128)||(a=r[n.pos++],i|=(127&a)<<10,a<128)||(a=r[n.pos++],i|=(127&a)<<17,a<128)||(a=r[n.pos++],i|=(127&a)<<24,a<128)||(a=r[n.pos++],i|=(1&a)<<31,a<128))return Fd(e,i,t);throw Error(`Expected varint not more than 10 bytes`)}(n,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){let e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){let e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&Nd?Nd.decode(this.buf.subarray(t,e)):function(e,t,n){let r=``,i=t;for(;i<n;){let t=e[i],a,o,s,c=null,l=t>239?4:t>223?3:t>191?2:1;if(i+l>n)break;l===1?t<128&&(c=t):l===2?(a=e[i+1],(192&a)==128&&(c=(31&t)<<6|63&a,c<=127&&(c=null))):l===3?(a=e[i+1],o=e[i+2],(192&a)==128&&(192&o)==128&&(c=(15&t)<<12|(63&a)<<6|63&o,(c<=2047||c>=55296&&c<=57343)&&(c=null))):l===4&&(a=e[i+1],o=e[i+2],s=e[i+3],(192&a)==128&&(192&o)==128&&(192&s)==128&&(c=(15&t)<<18|(63&a)<<12|(63&o)<<6|63&s,(c<=65535||c>=1114112)&&(c=null))),c===null?(c=65533,l=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),i+=l}return r}(this.buf,t,e)}readBytes(){let e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(e){let t=7&e;if(t===0)for(;this.buf[this.pos++]>127;);else if(t===2)this.pos=this.readVarint()+this.pos;else if(t===5)this.pos+=4;else{if(t!==1)throw Error(`Unimplemented type: ${t}`);this.pos+=8}}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){let e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.dataView=new DataView(e.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Md),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Md),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?function(e,t){let n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(n=~(-e%4294967296),r=~(-e/4294967296),4294967295^n?n=n+1|0:(n=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw Error(`Given varint doesn't fit into 10 bytes`);t.realloc(10),function(e,t,n){n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,n.buf[n.pos]=127&(e>>>=7)}(n,0,t),function(e,t){let n=(7&e)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;let t=this.pos;this.pos=function(e,t,n){for(let r,i,a=0;a<t.length;a++){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!i){r>56319||a+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=r;continue}if(r<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&=(e[n++]=239,e[n++]=191,e[n++]=189,null);r<128?e[n++]=r:(r<2048?e[n++]=r>>6|192:(r<65536?e[n++]=r>>12|224:(e[n++]=r>>18|240,e[n++]=r>>12&63|128),e[n++]=r>>6&63|128),e[n++]=63&r|128)}return n}(this.buf,e,this.pos);let n=this.pos-t;n>=128&&Id(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){let t=e.length;this.writeVarint(t),this.realloc(t);for(let n=0;n<t;n++)this.buf[this.pos++]=e[n]}writeRawMessage(e,t){this.pos++;let n=this.pos;e(t,this);let r=this.pos-n;r>=128&&Id(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r}writeMessage(e,t,n){this.writeTag(e,2),this.writeRawMessage(t,n)}writePackedVarint(e,t){t.length&&this.writeMessage(e,Ld,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,Rd,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,Vd,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,zd,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,Bd,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,Hd,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,Ud,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,Wd,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,Gd,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function Fd(e,t,n){return n?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function Id(e,t,n){let r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));n.realloc(r);for(let t=n.pos-1;t>=e;t--)n.buf[t+r]=n.buf[t]}function Ld(e,t){for(let n=0;n<e.length;n++)t.writeVarint(e[n])}function Rd(e,t){for(let n=0;n<e.length;n++)t.writeSVarint(e[n])}function zd(e,t){for(let n=0;n<e.length;n++)t.writeFloat(e[n])}function Bd(e,t){for(let n=0;n<e.length;n++)t.writeDouble(e[n])}function Vd(e,t){for(let n=0;n<e.length;n++)t.writeBoolean(e[n])}function Hd(e,t){for(let n=0;n<e.length;n++)t.writeFixed32(e[n])}function Ud(e,t){for(let n=0;n<e.length;n++)t.writeSFixed32(e[n])}function Wd(e,t){for(let n=0;n<e.length;n++)t.writeFixed64(e[n])}function Gd(e,t){for(let n=0;n<e.length;n++)t.writeSFixed64(e[n])}function Kd(e,t,n){e===1&&n.readMessage(qd,t)}function qd(e,t,n){if(e===3){let{id:e,bitmap:r,width:i,height:a,left:o,top:s,advance:c}=n.readMessage(Jd,{});t.push({id:e,bitmap:new Cc({width:i+6,height:a+6},r),metrics:{width:i,height:a,left:o,top:s,advance:c}})}}function Jd(e,t,n){e===1?t.id=n.readVarint():e===2?t.bitmap=n.readBytes():e===3?t.width=n.readVarint():e===4?t.height=n.readVarint():e===5?t.left=n.readSVarint():e===6?t.top=n.readSVarint():e===7&&(t.advance=n.readVarint())}function Yd(e){let t=0,n=0;for(let r of e)t+=r.w*r.h,n=Math.max(n,r.w);e.sort(((e,t)=>t.h-e.h));let r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),n),h:1/0}],i=0,a=0;for(let t of e)for(let e=r.length-1;e>=0;e--){let n=r[e];if(!(t.w>n.w||t.h>n.h)){if(t.x=n.x,t.y=n.y,a=Math.max(a,t.y+t.h),i=Math.max(i,t.x+t.w),t.w===n.w&&t.h===n.h){let t=r.pop();t&&e<r.length&&(r[e]=t)}else t.h===n.h?(n.x+=t.w,n.w-=t.w):t.w===n.w?(n.y+=t.h,n.h-=t.h):(r.push({x:n.x+t.w,y:n.y,w:n.w-t.w,h:t.h}),n.y+=t.h,n.h-=t.h);break}}return{w:i,h:a,fill:t/(i*a)||0}}class Xd{constructor(e,{pixelRatio:t,version:n,stretchX:r,stretchY:i,content:a,textFitWidth:o,textFitHeight:s}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=r,this.stretchY=i,this.content=a,this.version=n,this.textFitWidth=o,this.textFitHeight=s}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]}}class Zd{constructor(e,t){let n={},r={};this.haveRenderCallbacks=[];let i=[];this.addImages(e,n,i),this.addImages(t,r,i);let{w:a,h:o}=Yd(i),s=new wc({width:a||1,height:o||1});for(let t in e){let r=e[t],i=n[t].paddedRect;wc.copy(r.data,s,{x:0,y:0},{x:i.x+1,y:i.y+1},r.data)}for(let e in t){let n=t[e],i=r[e].paddedRect,a=i.x+1,o=i.y+1,c=n.data.width,l=n.data.height;wc.copy(n.data,s,{x:0,y:0},{x:a,y:o},n.data),wc.copy(n.data,s,{x:0,y:l-1},{x:a,y:o-1},{width:c,height:1}),wc.copy(n.data,s,{x:0,y:0},{x:a,y:o+l},{width:c,height:1}),wc.copy(n.data,s,{x:c-1,y:0},{x:a-1,y:o},{width:1,height:l}),wc.copy(n.data,s,{x:0,y:0},{x:a+c,y:o},{width:1,height:l})}this.image=s,this.iconPositions=n,this.patternPositions=r}addImages(e,t,n){for(let r in e){let i=e[r],a={x:0,y:0,w:i.data.width+2,h:i.data.height+2};n.push(a),t[r]=new Xd(a,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),t),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),t)}patchUpdatedImage(e,t,n){if(!e||!t||e.version===t.version)return;e.version=t.version;let[r,i]=e.tl;n.update(t.data,void 0,{x:r,y:i})}}var Qd;function $d(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=Ad.fromFeature(t,a),_;f===e.ax.vertical&&g.verticalizePunctuation();let v=g.determineLineBreaks(u,o,n,i,m),{processBidirectionalText:y,processStyledBidirectionalText:b}=Ia;if(y&&g.sections.length===1){_=[],v=v.map((e=>g.toCodeUnitIndex(e)));let e=y(g.toString(),v);for(let t of e){let e=[...t].map((()=>0));_.push(new Ad(t,g.sections,e))}}else if(b){_=[],v=v.map((e=>g.toCodeUnitIndex(e)));let e=0,t=[];for(let n of g.text)t.push(...Array(n.length).fill(g.sectionIndex[e])),e++;let n=b(g.text,t,v);for(let e of n){let t=[],n=``;for(let r of e[0])t.push(e[1][n.length]),n+=r;_.push(new Ad(e[0],g.sections,t))}}else _=function(e,t){let n=[],r=0;for(let i of t)n.push(e.substring(r,i)),r=i;return r<e.length()&&n.push(e.substring(r,e.length())),n}(g,v);let x=[],S={positionedLines:x,text:g.toString(),top:d[1],bottom:d[1],left:d[0],right:d[0],writingMode:f,iconsInText:!1,verticalizable:!1};return function(e,t,n,r,i,a,o,s,c,l,u,d){let f=0,p=0,m=0,h=0,g=s===`right`?1:s===`left`?0:.5,_=xd/d,v=0;for(let o of i){o.trim();let i=o.getMaxScale(),s={positionedGlyphs:[],lineOffset:0};e.positionedLines[v]=s;let d=s.positionedGlyphs,y=0;if(!o.length()){p+=a,++v;continue}let b=tf(r,o,_),x=0;for(let a of o.text){let s=o.getSection(x),m=a.codePointAt(0),h=rf(c,u,m),g={glyph:m,imageName:null,x:f,y:p+-17,vertical:h,scale:1,fontStack:``,sectionIndex:o.getSectionIndex(x),metrics:null,rect:null},v;if(`fontStack`in s){if(v=af(s,m,h,b,t,n),!v)continue;g.fontStack=s.fontStack}else{if(e.iconsInText=!0,s.scale*=_,v=of(s,h,i,b,r),!v)continue;y=Math.max(y,v.imageOffset),g.imageName=s.imageName}let{rect:S,metrics:C,baselineOffset:w}=v;g.y+=w,g.scale=s.scale,g.metrics=C,g.rect=S,d.push(g),h?(e.verticalizable=!0,f+=(`imageName`in s?C.advance:xd)*s.scale+l):f+=C.advance*s.scale+l,x++}d.length!==0&&(m=Math.max(f-l,m),sf(d,0,d.length-1,g)),f=0,s.lineOffset=Math.max(y,(i-1)*xd);let S=a*i+y;p+=S,h=Math.max(S,h),++v}let{horizontalAlign:y,verticalAlign:b}=ef(o);(function(e,t,n,r,i,a,o,s,c){let l=(t-n)*i,u=0;u=a===o?-r*c*o+.5*o:-s*r- -17;for(let t of e)for(let e of t.positionedGlyphs)e.x+=l,e.y+=u})(e.positionedLines,g,y,b,m,h,a,p,i.length),e.top+=-b*p,e.bottom=e.top+p,e.left+=-y*m,e.right=e.left+m}(S,n,r,i,_,s,c,l,f,u,p,h),!function(e){for(let t of e)if(t.positionedGlyphs.length!==0)return!1;return!0}(x)&&S}function ef(e){let t=.5,n=.5;switch(e){case`right`:case`top-right`:case`bottom-right`:t=1;break;case`left`:case`top-left`:case`bottom-left`:t=0}switch(e){case`bottom`:case`bottom-right`:case`bottom-left`:n=1;break;case`top`:case`top-right`:case`top-left`:n=0}return{horizontalAlign:t,verticalAlign:n}}function tf(e,t,n){let r=t.getMaxScale()*xd,{maxImageWidth:i,maxImageHeight:a}=t.getMaxImageSize(e),o=Math.max(r,a*n);return{verticalLineContentWidth:Math.max(r,i*n),horizontalLineContentHeight:o}}function nf(e){switch(e){case`top`:return 0;case`center`:return .5;default:return 1}}function rf(t,n,r){return!(t===e.ax.horizontal||!n&&!wa(r)||n&&(Ta(r)||(i=r,/\p{sc=Arab}/u.test(String.fromCodePoint(i)))));var i}function af(e,t,n,r,i,a){let o=function(e,t,n,r){if(e?.rect)return e;let i=t[n.fontStack]?.[r];return i?{rect:null,metrics:i.metrics}:null}(a[e.fontStack]?.[t],i,e,t);if(o===null)return null;let s;if(n)s=r.verticalLineContentWidth-e.scale*xd;else{let t=nf(e.verticalAlign);s=(r.horizontalLineContentHeight-e.scale*xd)*t}return{rect:o.rect,metrics:o.metrics,baselineOffset:s}}function of(e,t,n,r,i){let a=i[e.imageName];if(!a)return null;let o=a.paddedRect,s=a.displaySize,c={width:s[0],height:s[1],left:1,top:-3,advance:t?s[1]:s[0]},l;if(t)l=r.verticalLineContentWidth-s[1]*e.scale;else{let t=nf(e.verticalAlign);l=(r.horizontalLineContentHeight-s[1]*e.scale)*t}return{rect:o,metrics:c,baselineOffset:l,imageOffset:(t?s[0]:s[1])*e.scale-xd*n}}function sf(e,t,n,r){if(r===0)return;let i=e[n],a=(e[n].x+i.metrics.advance*i.scale)*r;for(let r=t;r<=n;r++)e[r].x-=a}function cf(e,t,n){let{horizontalAlign:r,verticalAlign:i}=ef(n),a=t[0]-e.displaySize[0]*r,o=t[1]-e.displaySize[1]*i;return{image:e,top:o,bottom:o+e.displaySize[1],left:a,right:a+e.displaySize[0]}}function lf(e){let t=e.left,n=e.top,r=e.right-t,i=e.bottom-n,a=e.image.textFitWidth??`stretchOrShrink`,o=e.image.textFitHeight??`stretchOrShrink`,s=(e.image.content[2]-e.image.content[0])/(e.image.content[3]-e.image.content[1]);if(o===`proportional`){if(a===`stretchOnly`&&r/i<s||a===`proportional`){let e=Math.ceil(i*s);t*=e/r,r=e}}else if(a===`proportional`&&o===`stretchOnly`&&s!==0&&r/i>s){let e=Math.ceil(r/s);n*=e/i,i=e}return{x1:t,y1:n,x2:t+r,y2:n+i}}function uf(e,t,n,r,i,a){let o=e.image,s;if(o.content){let e=o.content,t=o.pixelRatio||1;s=[e[0]/t,e[1]/t,o.displaySize[0]-e[2]/t,o.displaySize[1]-e[3]/t]}let c=t.left*a,l=t.right*a,u,d,f,p;n===`width`||n===`both`?(p=i[0]+c-r[3],d=i[0]+l+r[1]):(p=i[0]+(c+l-o.displaySize[0])/2,d=p+o.displaySize[0]);let m=t.top*a,h=t.bottom*a;return n===`height`||n===`both`?(u=i[1]+m-r[0],f=i[1]+h+r[2]):(u=i[1]+(m+h-o.displaySize[1])/2,f=u+o.displaySize[1]),{image:o,top:u,right:d,bottom:f,left:p,collisionPadding:s}}J(`ImagePosition`,Xd),J(`ImageAtlas`,Zd),e.ax=void 0,(Qd=e.ax||={})[Qd.none=0]=`none`,Qd[Qd.horizontal=1]=`horizontal`,Qd[Qd.vertical=2]=`vertical`,Qd[Qd.horizontalOnly=3]=`horizontalOnly`;let df=32640;function ff(e,t){let{expression:n}=t;if(n.kind===`constant`)return{kind:`constant`,layoutSize:n.evaluate(new Y(e+1))};if(n.kind===`source`)return{kind:`source`};{let{zoomStops:t,interpolationType:r}=n,i=0;for(;i<t.length&&t[i]<=e;)i++;i=Math.max(0,i-1);let a=i;for(;a<t.length&&t[a]<e+1;)a++;a=Math.min(t.length-1,a);let o=t[i],s=t[a];return n.kind===`composite`?{kind:`composite`,minZoom:o,maxZoom:s,interpolationType:r}:{kind:`camera`,minZoom:o,maxZoom:s,minSize:n.evaluate(new Y(o)),maxSize:n.evaluate(new Y(s)),interpolationType:r}}}function pf(e,t,n){let r=`never`,i=e.get(t);return i?r=i:e.get(n)&&(r=`always`),r}let mf=[{name:`a_fade_opacity`,components:1,type:`Uint8`,offset:0}];function hf(e,t,n,r,i,a,o,s,c,l,u,d,f){let p=s?Math.min(df,Math.round(s[0])):0,m=s?Math.min(df,Math.round(s[1])):0;e.emplaceBack(t,n,Math.round(32*r),Math.round(32*i),a,o,(p<<1)+ +!!c,m,16*l,16*u,256*d,256*f)}function gf(e,t,n){e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n)}function _f(e){for(let t of e.sections)if(Fa(t.text))return!0;return!1}class vf{constructor(e){this.layoutVertexArray=new $o,this.indexArray=new is,this.programConfigurations=e,this.segments=new ss,this.dynamicLayoutVertexArray=new es,this.opacityVertexArray=new ts,this.hasVisibleVertices=!1,this.placedSymbolArray=new Io}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t,n,r){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,md.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,hd.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,mf,!0),this.opacityVertexBuffer.itemSize=1),(n||r)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}J(`SymbolBuffers`,vf);class yf{constructor(e,t,n){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new n,this.segments=new ss,this.collisionVertexArray=new rs}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,gd.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}J(`CollisionBuffers`,yf);class bf{constructor(t){this.collisionBoxArray=t.collisionBoxArray,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.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ff(this.zoom,n[`text-size`]),this.iconSizeData=ff(this.zoom,n[`icon-size`]);let r=this.layers[0].layout,i=r.get(`symbol-sort-key`),a=r.get(`symbol-z-order`);this.canOverlap=pf(r,`text-overlap`,`text-allow-overlap`)!==`never`||pf(r,`icon-overlap`,`icon-allow-overlap`)!==`never`||r.get(`text-ignore-placement`)||r.get(`icon-ignore-placement`),this.sortFeaturesByKey=a!==`viewport-y`&&!i.isConstant(),this.sortFeaturesByY=(a===`viewport-y`||a===`auto`&&!this.sortFeaturesByKey)&&this.canOverlap,r.get(`symbol-placement`)===`point`&&(this.writingModes=r.get(`text-writing-mode`).map((t=>e.ax[t]))),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=t.sourceID}createArrays(){this.text=new vf(new Is(this.layers,this.zoom,(e=>e.startsWith(`text`)))),this.icon=new vf(new Is(this.layers,this.zoom,(e=>e.startsWith(`icon`)))),this.glyphOffsetArray=new zo,this.lineVertexArray=new Bo,this.symbolInstances=new Ro,this.textAnchorOffsets=new Ho}calculateGlyphDependencies(e,t,n,r,i){for(let a of e)if(t[a.codePointAt(0)]=!0,(n||r)&&i){let e=Sd[a];e&&(t[e.codePointAt(0)]=!0)}}populate(t,n,r){let i=this.layers[0],a=i.layout,o=a.get(`text-font`),s=a.get(`text-field`),c=a.get(`icon-image`),l=(s.value.kind!==`constant`||s.value.value instanceof H&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(o.value.kind!==`constant`||o.value.value.length>0),u=c.value.kind!==`constant`||!!c.value.value||Object.keys(c.parameters).length>0,d=a.get(`symbol-sort-key`);if(this.features=[],!l&&!u)return;let f=n.iconDependencies,p=n.glyphDependencies,m=n.availableImages,h=new Y(this.zoom);for(let{feature:n,id:s,index:c,sourceLayerIndex:g}of t){let t=i._featureFilter.needGeometry,_=Hs(n,t);if(!i._featureFilter.filter(h,_,r))continue;let v,y;if(t||(_.geometry=Vs(n)),l){let e=i.getValueAndResolveTokens(`text-field`,_,r,m),t=H.factory(e);this.hasRTLText||=_f(t),(!this.hasRTLText||Ia.getRTLTextPluginStatus()===`unavailable`||this.hasRTLText&&Ia.isParsed())&&(v=bd(t,i,_))}if(u){let e=i.getValueAndResolveTokens(`icon-image`,_,r,m);y=e instanceof Yt?e:Yt.fromString(e)}if(!v&&!y)continue;let b=this.sortFeaturesByKey?d.evaluate(_,{},r):void 0;if(this.features.push({id:s,text:v,icon:y,index:c,sourceLayerIndex:g,geometry:_.geometry,properties:n.properties,type:jl.types[n.type],sortKey:b}),y&&(f[y.name]=!0),v){let t=o.evaluate(_,{},r).join(`,`),n=a.get(`text-rotation-alignment`)!==`viewport`&&a.get(`symbol-placement`)!==`point`;this.allowVerticalPlacement=this.writingModes?.includes(e.ax.vertical);for(let e of v.sections)if(e.image)f[e.image.name]=!0;else{let r=Ea(v.toString()),i=e.fontStack||t;p[i]||(p[i]={}),this.calculateGlyphDependencies(e.text,p[i],n,this.allowVerticalPlacement,r)}}}a.get(`symbol-placement`)===`line`&&(this.features=function(e){let t={},n={},r=[],i=0;function a(t){r.push(e[t]),i++}function o(e,t,i){let a=n[e];return delete n[e],n[t]=a,r[a].geometry[0].pop(),r[a].geometry[0]=r[a].geometry[0].concat(i[0]),a}function s(e,n,i){let a=t[n];return delete t[n],t[e]=a,r[a].geometry[0].shift(),r[a].geometry[0]=i[0].concat(r[a].geometry[0]),a}function c(e,t,n){let r=n?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.y}`}for(let l=0;l<e.length;l++){let u=e[l],d=u.geometry,f=u.text?u.text.toString():null;if(!f){a(l);continue}let p=c(f,d),m=c(f,d,!0);if(p in n&&m in t&&n[p]!==t[m]){let e=s(p,m,d),i=o(p,m,r[e].geometry);delete t[p],delete n[m],n[c(f,r[i].geometry,!0)]=i,r[e].geometry=null}else p in n?o(p,m,d):m in t?s(p,m,d):(a(l),t[p]=i-1,n[m]=i-1)}return r.filter((e=>e.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:n}),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:n}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,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(e,t){let n=this.lineVertexArray.length;if(e.segment!==void 0){let n=e.dist(t[e.segment+1]),r=e.dist(t[e.segment]),i={};for(let r=e.segment+1;r<t.length;r++)i[r]={x:t[r].x,y:t[r].y,tileUnitDistanceFromAnchor:n},r<t.length-1&&(n+=t[r+1].dist(t[r]));for(let n=e.segment||0;n>=0;n--)i[n]={x:t[n].x,y:t[n].y,tileUnitDistanceFromAnchor:r},n>0&&(r+=t[n-1].dist(t[n]));for(let e=0;e<t.length;e++){let t=i[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(t,n,r,i,a,o,s,c,l,u,d,f){let p=t.indexArray,m=t.layoutVertexArray,h=t.segments.prepareSegment(4*n.length,m,p,this.canOverlap?o.sortKey:void 0),g=this.glyphOffsetArray.length,_=h.vertexLength,v=this.allowVerticalPlacement&&s===e.ax.vertical?Math.PI/2:0,y=o.text&&o.text.sections;for(let e=0;e<n.length;e++){let{tl:i,tr:a,bl:s,br:l,tex:u,pixelOffsetTL:d,pixelOffsetBR:g,minFontScaleX:_,minFontScaleY:b,glyphOffset:x,isSDF:S,sectionIndex:C}=n[e],w=h.vertexLength,T=x[1];hf(m,c.x,c.y,i.x,T+i.y,u.x,u.y,r,S,d.x,d.y,_,b),hf(m,c.x,c.y,a.x,T+a.y,u.x+u.w,u.y,r,S,g.x,d.y,_,b),hf(m,c.x,c.y,s.x,T+s.y,u.x,u.y+u.h,r,S,d.x,g.y,_,b),hf(m,c.x,c.y,l.x,T+l.y,u.x+u.w,u.y+u.h,r,S,g.x,g.y,_,b),gf(t.dynamicLayoutVertexArray,c,v),p.emplaceBack(w,w+2,w+1),p.emplaceBack(w+1,w+2,w+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(x[0]),e!==n.length-1&&C===n[e+1].sectionIndex||t.programConfigurations.populatePaintArrays(m.length,o,o.index,{imagePositions:{},canonical:f,formattedSection:y?.[C]})}t.placedSymbolArray.emplaceBack(c.x,c.y,g,this.glyphOffsetArray.length-g,_,l,u,c.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],s,0,!1,0,d)}_addCollisionDebugVertex(e,t,n,r,i,a){return t.emplaceBack(0,0),e.emplaceBack(n.x,n.y,r,i,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,t,r,i,a,o,s){let c=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),l=c.vertexLength,u=a.layoutVertexArray,d=a.collisionVertexArray,f=s.anchorX,p=s.anchorY;this._addCollisionDebugVertex(u,d,o,f,p,new n(e,t)),this._addCollisionDebugVertex(u,d,o,f,p,new n(r,t)),this._addCollisionDebugVertex(u,d,o,f,p,new n(r,i)),this._addCollisionDebugVertex(u,d,o,f,p,new n(e,i)),c.vertexLength+=4;let m=a.indexArray;m.emplaceBack(l,l+1),m.emplaceBack(l+1,l+2),m.emplaceBack(l+2,l+3),m.emplaceBack(l+3,l),c.primitiveLength+=4}addDebugCollisionBoxes(e,t,n,r){for(let i=e;i<t;i++){let e=this.collisionBoxArray.get(i);this.addCollisionDebugVertices(e.x1,e.y1,e.x2,e.y2,r?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new yf(ns,_d.members,as),this.iconCollisionBox=new yf(ns,_d.members,as);for(let e=0;e<this.symbolInstances.length;e++){let t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,n,r,i,a,o,s,c){let l={};for(let r=t;r<n;r++){let t=e.get(r);l.textBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},l.textFeatureIndex=t.featureIndex;break}for(let t=r;t<i;t++){let n=e.get(t);l.verticalTextBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},l.verticalTextFeatureIndex=n.featureIndex;break}for(let t=a;t<o;t++){let n=e.get(t);l.iconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},l.iconFeatureIndex=n.featureIndex;break}for(let t=s;t<c;t++){let n=e.get(t);l.verticalIconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},l.verticalIconFeatureIndex=n.featureIndex;break}return l}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let n=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.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(e,t){let n=e.placedSymbolArray.get(t),r=n.vertexStartIndex+4*n.numGlyphs;for(let t=n.vertexStartIndex;t<r;t+=4)e.indexArray.emplaceBack(t,t+2,t+1),e.indexArray.emplaceBack(t+1,t+2,t+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let t=Math.sin(e),n=Math.cos(e),r=[],i=[],a=[];for(let e=0;e<this.symbolInstances.length;++e){a.push(e);let o=this.symbolInstances.get(e);r.push(0|Math.round(t*o.anchorX+n*o.anchorY)),i.push(o.featureIndex)}return a.sort(((e,t)=>r[e]-r[t]||i[t]-i[e])),a}addToSortKeyRanges(e,t){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n?.sortKey===t?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);let n=[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex];for(let e=0;e<n.length;e++){let t=n[e];t>=0&&n.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)}t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let xf,Sf;J(`SymbolBucket`,bf,{omit:[`layers`,`collisionBoxArray`,`features`,`compareText`]}),bf.MAX_GLYPHS=65535,bf.addDynamicAttributes=gf;var Cf={get paint(){return Sf||=new Xa({"icon-opacity":new Z(N.paint_symbol[`icon-opacity`]),"icon-color":new Z(N.paint_symbol[`icon-color`]),"icon-halo-color":new Z(N.paint_symbol[`icon-halo-color`]),"icon-halo-width":new Z(N.paint_symbol[`icon-halo-width`]),"icon-halo-blur":new Z(N.paint_symbol[`icon-halo-blur`]),"icon-translate":new X(N.paint_symbol[`icon-translate`]),"icon-translate-anchor":new X(N.paint_symbol[`icon-translate-anchor`]),"text-opacity":new Z(N.paint_symbol[`text-opacity`]),"text-color":new Z(N.paint_symbol[`text-color`],{runtimeType:tt,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Z(N.paint_symbol[`text-halo-color`]),"text-halo-width":new Z(N.paint_symbol[`text-halo-width`]),"text-halo-blur":new Z(N.paint_symbol[`text-halo-blur`]),"text-translate":new X(N.paint_symbol[`text-translate`]),"text-translate-anchor":new X(N.paint_symbol[`text-translate-anchor`])})},get layout(){return xf||=new Xa({"symbol-placement":new X(N.layout_symbol[`symbol-placement`]),"symbol-spacing":new X(N.layout_symbol[`symbol-spacing`]),"symbol-avoid-edges":new X(N.layout_symbol[`symbol-avoid-edges`]),"symbol-sort-key":new Z(N.layout_symbol[`symbol-sort-key`]),"symbol-z-order":new X(N.layout_symbol[`symbol-z-order`]),"icon-allow-overlap":new X(N.layout_symbol[`icon-allow-overlap`]),"icon-overlap":new X(N.layout_symbol[`icon-overlap`]),"icon-ignore-placement":new X(N.layout_symbol[`icon-ignore-placement`]),"icon-optional":new X(N.layout_symbol[`icon-optional`]),"icon-rotation-alignment":new X(N.layout_symbol[`icon-rotation-alignment`]),"icon-size":new Z(N.layout_symbol[`icon-size`]),"icon-text-fit":new X(N.layout_symbol[`icon-text-fit`]),"icon-text-fit-padding":new X(N.layout_symbol[`icon-text-fit-padding`]),"icon-image":new Z(N.layout_symbol[`icon-image`]),"icon-rotate":new Z(N.layout_symbol[`icon-rotate`]),"icon-padding":new Z(N.layout_symbol[`icon-padding`]),"icon-keep-upright":new X(N.layout_symbol[`icon-keep-upright`]),"icon-offset":new Z(N.layout_symbol[`icon-offset`]),"icon-anchor":new Z(N.layout_symbol[`icon-anchor`]),"icon-pitch-alignment":new X(N.layout_symbol[`icon-pitch-alignment`]),"text-pitch-alignment":new X(N.layout_symbol[`text-pitch-alignment`]),"text-rotation-alignment":new X(N.layout_symbol[`text-rotation-alignment`]),"text-field":new Z(N.layout_symbol[`text-field`]),"text-font":new Z(N.layout_symbol[`text-font`]),"text-size":new Z(N.layout_symbol[`text-size`]),"text-max-width":new Z(N.layout_symbol[`text-max-width`]),"text-line-height":new X(N.layout_symbol[`text-line-height`]),"text-letter-spacing":new Z(N.layout_symbol[`text-letter-spacing`]),"text-justify":new Z(N.layout_symbol[`text-justify`]),"text-radial-offset":new Z(N.layout_symbol[`text-radial-offset`]),"text-variable-anchor":new X(N.layout_symbol[`text-variable-anchor`]),"text-variable-anchor-offset":new Z(N.layout_symbol[`text-variable-anchor-offset`]),"text-anchor":new Z(N.layout_symbol[`text-anchor`]),"text-max-angle":new X(N.layout_symbol[`text-max-angle`]),"text-writing-mode":new X(N.layout_symbol[`text-writing-mode`]),"text-rotate":new Z(N.layout_symbol[`text-rotate`]),"text-padding":new X(N.layout_symbol[`text-padding`]),"text-keep-upright":new X(N.layout_symbol[`text-keep-upright`]),"text-transform":new Z(N.layout_symbol[`text-transform`]),"text-offset":new Z(N.layout_symbol[`text-offset`]),"text-allow-overlap":new X(N.layout_symbol[`text-allow-overlap`]),"text-overlap":new X(N.layout_symbol[`text-overlap`]),"text-ignore-placement":new X(N.layout_symbol[`text-ignore-placement`]),"text-optional":new X(N.layout_symbol[`text-optional`])})}};class wf{constructor(e){if(e.property.overrides===void 0)throw Error(`overrides must be provided to instantiate FormatSectionOverride class`);this.type=e.property.overrides?e.property.overrides.runtimeType:et,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t?.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}J(`FormatSectionOverride`,wf,{omit:[`defaultValue`]});class Tf extends $a{constructor(e,t){super(e,Cf,t)}recalculate(e,t){if(super.recalculate(e,t),this.layout.get(`icon-rotation-alignment`)===`auto`&&(this.layout._values[`icon-rotation-alignment`]=this.layout.get(`symbol-placement`)===`point`?`viewport`:`map`),this.layout.get(`text-rotation-alignment`)===`auto`&&(this.layout._values[`text-rotation-alignment`]=this.layout.get(`symbol-placement`)===`point`?`viewport`:`map`),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 e=this.layout.get(`text-writing-mode`);if(e){let t=[];for(let n of e)t.includes(n)||t.push(n);this.layout._values[`text-writing-mode`]=t}else this.layout._values[`text-writing-mode`]=[`horizontal`]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,n,r){let i=this.layout.get(e).evaluate(t,{},n,r),a=this._unevaluatedLayout._values[e];return a.isDataDriven()||si(a.value)||!i?i:function(e,t){return t.replace(/{([^{}]+)}/g,((t,n)=>e&&n in e?String(e[n]):``))}(t.properties,i)}createBucket(e){return new bf(e)}queryRadius(){return 0}queryIntersectsFeature(){throw Error(`Should take a different path in FeatureIndex`)}_setPaintOverrides(){for(let e of Cf.paint.overridableProperties){if(!Tf.hasPaintOverride(this.layout,e))continue;let t=this.paint.get(e),n=new oi(new wf(t),t.property.specification),r=null;r=t.value.kind===`constant`||t.value.kind===`source`?new li(`source`,n):new ui(`composite`,n,t.value.zoomStops),this.paint._values[e]=new Ga(t.property,r,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,n){return!(!this.layout||t.isDataDriven()||n.isDataDriven())&&Tf.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){let n=e.get(`text-field`),r=Cf.paint.properties[t],i=!1,a=e=>{for(let t of e)if(r.overrides?.hasOverride(t))return void(i=!0)};if(n.value.kind===`constant`&&n.value.value instanceof H)a(n.value.value.sections);else if(n.value.kind===`source`||n.value.kind===`composite`){let e=t=>{i||(t instanceof tn&&$t(t.value)===at?a(t.value.sections):t instanceof In?a(t.sections):t.eachChild(e))},t=n.value;t._styleExpression&&e(t._styleExpression.expression)}return i}}let Ef;var Df={get paint(){return Ef||=new Xa({"background-color":new X(N.paint_background[`background-color`]),"background-pattern":new Ja(N.paint_background[`background-pattern`]),"background-opacity":new X(N.paint_background[`background-opacity`])})}};class Of extends $a{constructor(e,t){super(e,Df,t)}}class kf extends $a{constructor(e,t){super(e,{},t),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}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`)}}class Af{constructor(e){this._methodToThrottle=e,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var e;this._triggered||(this._triggered=!0,(e=this._channel)==null||e.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let jf={once:!0},Mf=6371008.8;class Nf{constructor(e,t){if(isNaN(e)||isNaN(t))throw Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw Error(`Invalid LngLat latitude value: must be between -90 and 90`)}wrap(){return new Nf(ae(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let t=Math.PI/180,n=this.lat*t,r=e.lat*t,i=Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return Mf*Math.acos(Math.min(i,1))}static convert(e){if(e instanceof Nf)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Nf(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e==`object`&&e)return new Nf(Number(`lng`in e?e.lng:e.lon),Number(e.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>]")}}let Pf=2*Math.PI*Mf;function Ff(e){return Pf*Math.cos(e*Math.PI/180)}function If(e){return(180+e)/360}function Lf(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Rf(e,t){return e/Ff(t)}function zf(e){return 360*e-180}function Bf(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function Vf(e,t){return e*Ff(Bf(t))}class Hf{constructor(e,t,n=0){this.x=+e,this.y=+t,this.z=+n}static fromLngLat(e,t=0){let n=Nf.convert(e);return new Hf(If(n.lng),Lf(n.lat),Rf(t,n.lat))}toLngLat(){return new Nf(zf(this.x),Bf(this.y))}toAltitude(){return Vf(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Pf*(e=Bf(this.y),1/Math.cos(e*Math.PI/180));var e}}function Uf(e,t,n){var r=2*Math.PI*6378137/256/2**n;return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}class Wf{constructor(e,t,n){if(!function(e,t,n){return!(e<0||e>25||n<0||n>=2**e||t<0||t>=2**e)}(e,t,n))throw Error(`x=${t}, y=${n}, z=${e} outside of bounds. 0<=x<${2**e}, 0<=y<${2**e} 0<=z<=25 `);this.z=e,this.x=t,this.y=n,this.key=qf(0,e,e,t,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,n){let r=(a=this.y,o=this.z,s=Uf(256*(i=this.x),256*(a=2**o-a-1),o),c=Uf(256*(i+1),256*(a+1),o),s[0]+`,`+s[1]+`,`+c[0]+`,`+c[1]);var i,a,o,s,c;let l=function(e,t,n){let r=``;for(let i=e;i>0;i--){let e=1<<i-1;r+=(t&e?1:0)+(n&e?2:0)}return r}(this.z,this.x,this.y);return e[(this.x+this.y)%e.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(n===`tms`?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,t>1?`@2x`:``).replace(/{quadkey}/g,l).replace(/{bbox-epsg-3857}/g,r)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=2**this.z;return new n((e.x*t-this.x)*O,(e.y*t-this.y)*O)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Gf{constructor(e,t){this.wrap=e,this.canonical=t,this.key=qf(e,t.z,t.z,t.x,t.y)}}class Kf{constructor(e,t,n,r,i){if(this.terrainRttPosMatrix32f=null,e<n)throw Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=t,this.canonical=new Wf(n,+r,+i),this.key=qf(t,e,n,r,i)}clone(){return new Kf(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let t=this.canonical.z-e;return e>this.canonical.z?new Kf(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Kf(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,t){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let n=this.canonical.z-e;return e>this.canonical.z?qf(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):qf(this.wrap*+t,e,e,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;let t=this.canonical.z-e.canonical.z;return!(t<0)&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new Kf(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let t=this.canonical.z+1,n=2*this.canonical.x,r=2*this.canonical.y;return[new Kf(t,this.wrap,t,n,r),new Kf(t,this.wrap,t,n+1,r),new Kf(t,this.wrap,t,n,r+1),new Kf(t,this.wrap,t,n+1,r+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Kf(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Kf(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Gf(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Hf(e.x-this.wrap,e.y))}normalizeCoordinates(e,t,n=8192){if(e>=0&&e<n&&t>=0&&t<n)return{tileID:this,x:e,y:t};let r=Math.floor(e/n),i=Math.floor(t/n),a=e-r*n,o=t-i*n,s=this.canonical.z,c=1<<s,l=this.canonical.y+i;if(l<0||l>=c)return null;let u=this.canonical.x+r,d=this.wrap;return u<0?(d-=Math.ceil(-u/c),u=(u%c+c)%c):u>=c&&(d+=Math.floor(u/c),u%=c),{tileID:new Kf(this.overscaledZ,d,s,u,l),x:a,y:o}}}function qf(e,t,n,r,i){(e*=2)<0&&(e=-1*e-1);let a=1<<n;return(a*a*e+a*i+r).toString(36)+n.toString(36)+t.toString(36)}J(`CanonicalTileID`,Wf),J(`OverscaledTileID`,Kf,{omit:[`terrainRttPosMatrix32f`]});class Jf{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(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(e){return this.expandBy(-e)}map(e){let t=new Jf;return t.extend(e(new n(this.minX,this.minY))),t.extend(e(new n(this.maxX,this.minY))),t.extend(e(new n(this.minX,this.maxY))),t.extend(e(new n(this.maxX,this.maxY))),t}static fromPoints(e){let t=new Jf;for(let n of e)t.extend(n);return t}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}}class Yf{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let n=e[t];this._stringToNumber[n]=t,this._numberToString[t]=n}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Xf{constructor(e,t,n,r,i){this.type=`Feature`,this._vectorTileFeature=e,this._x=n,this._y=r,this._z=t,this.properties=e.properties,this.id=i}projectPoint(e,t,n,r){return[360*(e.x+t)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+n)/r)*Math.PI))-90]}projectLine(e,t,n,r){return e.map((e=>this.projectPoint(e,t,n,r)))}get geometry(){if(this._geometry)return this._geometry;let e=this._vectorTileFeature,t=e.extent*2**this._z,n=e.extent*this._x,r=e.extent*this._y,i=e.loadGeometry();switch(e.type){case 1:{let e=[];for(let t of i)e.push(t[0]);let a=this.projectLine(e,n,r,t);this._geometry=e.length===1?{type:`Point`,coordinates:a[0]}:{type:`MultiPoint`,coordinates:a};break}case 2:{let e=i.map((e=>this.projectLine(e,n,r,t)));this._geometry=e.length===1?{type:`LineString`,coordinates:e[0]}:{type:`MultiLineString`,coordinates:e};break}case 3:{let e=Nl(i),a=[];for(let i of e)a.push(i.map((e=>this.projectLine(e,n,r,t))));this._geometry=a.length===1?{type:`Polygon`,coordinates:a[0]}:{type:`MultiPolygon`,coordinates:a};break}default:throw Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)t!==`_geometry`&&t!==`_vectorTileFeature`&&t!==`_x`&&t!==`_y`&&t!==`_z`&&(e[t]=this[t]);return e}}class Zf{constructor(e,t,n){this._name=e,this.dataBuffer=t,typeof n==`number`?this._size=n:(this.nullabilityBuffer=n,this._size=n.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer?.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Qf extends Zf{}class $f extends Qf{getValueFromBuffer(e){return this.dataBuffer[e]}}class ep extends Qf{getValueFromBuffer(e){return this.dataBuffer[e]}}class tp extends Zf{constructor(e,t,n,r){super(e,t,r),this.delta=n}}class np extends tp{constructor(e,t,n,r){super(e,Int32Array.of(t),n,r)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class rp extends Zf{constructor(e,t,n,r){super(e,r?Int32Array.of(t):Uint32Array.of(t),n)}getValueFromBuffer(e){return this.dataBuffer[0]}}class ip{constructor(e,t,n,r,i=4096){this._name=e,this._geometryVector=t,this._idVector=n,this._propertyVectors=r,this._extent=i}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||=new Map(this._propertyVectors.map((e=>[e.name,e]))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let e=[],t=this.geometryVector.getGeometries();for(let n=0;n<this.numFeatures;n++){let r;if(this.idVector){let e=this.idVector.getValue(n);r=this.containsMaxSafeIntegerValues(this.idVector)&&e!==null?Number(e):e}let i={coordinates:t[n],type:this.geometryVector.geometryType(n)},a={};for(let e of this.propertyVectors){if(!e)continue;let t=e.name,r=e.getValue(n);r!==null&&(a[t]=r)}e.push({id:r,geometry:i,properties:a})}return e}containsMaxSafeIntegerValues(e){return e instanceof $f||e instanceof rp||e instanceof np||e instanceof ep}}class ap{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var Q,op;(function(e){e.NONE=`NONE`,e.DELTA=`DELTA`,e.COMPONENTWISE_DELTA=`COMPONENTWISE_DELTA`,e.RLE=`RLE`,e.MORTON=`MORTON`,e.PDE=`PDE`})(Q||={}),function(e){e.NONE=`NONE`,e.FAST_PFOR=`FAST_PFOR`,e.VARINT=`VARINT`,e.ALP=`ALP`}(op||={});let sp=new Uint32Array(33);sp[0]=0;for(let e=1;e<=32;e++)sp[e]=e===32?4294967295:4294967295>>>32-e;let cp=sp;function lp(e,t){return e-e%t}function up(e){let t=e>>>0;return((255&t)<<24|(65280&t)<<8|t>>>8&65280|t>>>24&255)>>>0}let dp=function(){let e=lp(65536,256);return e===0?256:e}(),fp=3*dp/256+dp|0;function pp(){let e=new Uint8Array(fp);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:e,byteContainerI32:new Int32Array(e.buffer,e.byteOffset,e.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function mp(e,t,n,r,i){switch(i){case 1:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0;n[i++]=t>>>0&1,n[i++]=t>>>1&1,n[i++]=t>>>2&1,n[i++]=t>>>3&1,n[i++]=t>>>4&1,n[i++]=t>>>5&1,n[i++]=t>>>6&1,n[i++]=t>>>7&1,n[i++]=t>>>8&1,n[i++]=t>>>9&1,n[i++]=t>>>10&1,n[i++]=t>>>11&1,n[i++]=t>>>12&1,n[i++]=t>>>13&1,n[i++]=t>>>14&1,n[i++]=t>>>15&1,n[i++]=t>>>16&1,n[i++]=t>>>17&1,n[i++]=t>>>18&1,n[i++]=t>>>19&1,n[i++]=t>>>20&1,n[i++]=t>>>21&1,n[i++]=t>>>22&1,n[i++]=t>>>23&1,n[i++]=t>>>24&1,n[i++]=t>>>25&1,n[i++]=t>>>26&1,n[i++]=t>>>27&1,n[i++]=t>>>28&1,n[i++]=t>>>29&1,n[i++]=t>>>30&1,n[i++]=t>>>31&1}})(e,t,n,r);break;case 2:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0;n[i++]=t>>>0&3,n[i++]=t>>>2&3,n[i++]=t>>>4&3,n[i++]=t>>>6&3,n[i++]=t>>>8&3,n[i++]=t>>>10&3,n[i++]=t>>>12&3,n[i++]=t>>>14&3,n[i++]=t>>>16&3,n[i++]=t>>>18&3,n[i++]=t>>>20&3,n[i++]=t>>>22&3,n[i++]=t>>>24&3,n[i++]=t>>>26&3,n[i++]=t>>>28&3,n[i++]=t>>>30&3,n[i++]=r>>>0&3,n[i++]=r>>>2&3,n[i++]=r>>>4&3,n[i++]=r>>>6&3,n[i++]=r>>>8&3,n[i++]=r>>>10&3,n[i++]=r>>>12&3,n[i++]=r>>>14&3,n[i++]=r>>>16&3,n[i++]=r>>>18&3,n[i++]=r>>>20&3,n[i++]=r>>>22&3,n[i++]=r>>>24&3,n[i++]=r>>>26&3,n[i++]=r>>>28&3,n[i++]=r>>>30&3}})(e,t,n,r);break;case 3:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,o=e[a++]>>>0;n[i++]=t>>>0&7,n[i++]=t>>>3&7,n[i++]=t>>>6&7,n[i++]=t>>>9&7,n[i++]=t>>>12&7,n[i++]=t>>>15&7,n[i++]=t>>>18&7,n[i++]=t>>>21&7,n[i++]=t>>>24&7,n[i++]=t>>>27&7,n[i++]=7&(t>>>30|(1&r)<<2),n[i++]=r>>>1&7,n[i++]=r>>>4&7,n[i++]=r>>>7&7,n[i++]=r>>>10&7,n[i++]=r>>>13&7,n[i++]=r>>>16&7,n[i++]=r>>>19&7,n[i++]=r>>>22&7,n[i++]=r>>>25&7,n[i++]=r>>>28&7,n[i++]=7&(r>>>31|(3&o)<<1),n[i++]=o>>>2&7,n[i++]=o>>>5&7,n[i++]=o>>>8&7,n[i++]=o>>>11&7,n[i++]=o>>>14&7,n[i++]=o>>>17&7,n[i++]=o>>>20&7,n[i++]=o>>>23&7,n[i++]=o>>>26&7,n[i++]=o>>>29&7}})(e,t,n,r);break;case 4:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0;n[i++]=t>>>0&15,n[i++]=t>>>4&15,n[i++]=t>>>8&15,n[i++]=t>>>12&15,n[i++]=t>>>16&15,n[i++]=t>>>20&15,n[i++]=t>>>24&15,n[i++]=t>>>28&15,n[i++]=r>>>0&15,n[i++]=r>>>4&15,n[i++]=r>>>8&15,n[i++]=r>>>12&15,n[i++]=r>>>16&15,n[i++]=r>>>20&15,n[i++]=r>>>24&15,n[i++]=r>>>28&15,n[i++]=o>>>0&15,n[i++]=o>>>4&15,n[i++]=o>>>8&15,n[i++]=o>>>12&15,n[i++]=o>>>16&15,n[i++]=o>>>20&15,n[i++]=o>>>24&15,n[i++]=o>>>28&15,n[i++]=s>>>0&15,n[i++]=s>>>4&15,n[i++]=s>>>8&15,n[i++]=s>>>12&15,n[i++]=s>>>16&15,n[i++]=s>>>20&15,n[i++]=s>>>24&15,n[i++]=s>>>28&15}})(e,t,n,r);break;case 5:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0,c=e[a++]>>>0;n[i++]=t>>>0&31,n[i++]=t>>>5&31,n[i++]=t>>>10&31,n[i++]=t>>>15&31,n[i++]=t>>>20&31,n[i++]=t>>>25&31,n[i++]=31&(t>>>30|(7&r)<<2),n[i++]=r>>>3&31,n[i++]=r>>>8&31,n[i++]=r>>>13&31,n[i++]=r>>>18&31,n[i++]=r>>>23&31,n[i++]=31&(r>>>28|(1&o)<<4),n[i++]=o>>>1&31,n[i++]=o>>>6&31,n[i++]=o>>>11&31,n[i++]=o>>>16&31,n[i++]=o>>>21&31,n[i++]=o>>>26&31,n[i++]=31&(o>>>31|(15&s)<<1),n[i++]=s>>>4&31,n[i++]=s>>>9&31,n[i++]=s>>>14&31,n[i++]=s>>>19&31,n[i++]=s>>>24&31,n[i++]=31&(s>>>29|(3&c)<<3),n[i++]=c>>>2&31,n[i++]=c>>>7&31,n[i++]=c>>>12&31,n[i++]=c>>>17&31,n[i++]=c>>>22&31,n[i++]=c>>>27&31}})(e,t,n,r);break;case 6:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0,c=e[a++]>>>0,l=e[a++]>>>0;n[i++]=t>>>0&63,n[i++]=t>>>6&63,n[i++]=t>>>12&63,n[i++]=t>>>18&63,n[i++]=t>>>24&63,n[i++]=63&(t>>>30|(15&r)<<2),n[i++]=r>>>4&63,n[i++]=r>>>10&63,n[i++]=r>>>16&63,n[i++]=r>>>22&63,n[i++]=63&(r>>>28|(3&o)<<4),n[i++]=o>>>2&63,n[i++]=o>>>8&63,n[i++]=o>>>14&63,n[i++]=o>>>20&63,n[i++]=o>>>26&63,n[i++]=s>>>0&63,n[i++]=s>>>6&63,n[i++]=s>>>12&63,n[i++]=s>>>18&63,n[i++]=s>>>24&63,n[i++]=63&(s>>>30|(15&c)<<2),n[i++]=c>>>4&63,n[i++]=c>>>10&63,n[i++]=c>>>16&63,n[i++]=c>>>22&63,n[i++]=63&(c>>>28|(3&l)<<4),n[i++]=l>>>2&63,n[i++]=l>>>8&63,n[i++]=l>>>14&63,n[i++]=l>>>20&63,n[i++]=l>>>26&63}})(e,t,n,r);break;case 7:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0,c=e[a++]>>>0,l=e[a++]>>>0,u=e[a++]>>>0;n[i++]=t>>>0&127,n[i++]=t>>>7&127,n[i++]=t>>>14&127,n[i++]=t>>>21&127,n[i++]=127&(t>>>28|(7&r)<<4),n[i++]=r>>>3&127,n[i++]=r>>>10&127,n[i++]=r>>>17&127,n[i++]=r>>>24&127,n[i++]=127&(r>>>31|(63&o)<<1),n[i++]=o>>>6&127,n[i++]=o>>>13&127,n[i++]=o>>>20&127,n[i++]=127&(o>>>27|(3&s)<<5),n[i++]=s>>>2&127,n[i++]=s>>>9&127,n[i++]=s>>>16&127,n[i++]=s>>>23&127,n[i++]=127&(s>>>30|(31&c)<<2),n[i++]=c>>>5&127,n[i++]=c>>>12&127,n[i++]=c>>>19&127,n[i++]=127&(c>>>26|(1&l)<<6),n[i++]=l>>>1&127,n[i++]=l>>>8&127,n[i++]=l>>>15&127,n[i++]=l>>>22&127,n[i++]=127&(l>>>29|(15&u)<<3),n[i++]=u>>>4&127,n[i++]=u>>>11&127,n[i++]=u>>>18&127,n[i++]=u>>>25&127}})(e,t,n,r);break;case 8:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0,c=e[a++]>>>0,l=e[a++]>>>0,u=e[a++]>>>0,d=e[a++]>>>0;n[i++]=t>>>0&255,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=r>>>0&255,n[i++]=r>>>8&255,n[i++]=r>>>16&255,n[i++]=r>>>24&255,n[i++]=o>>>0&255,n[i++]=o>>>8&255,n[i++]=o>>>16&255,n[i++]=o>>>24&255,n[i++]=s>>>0&255,n[i++]=s>>>8&255,n[i++]=s>>>16&255,n[i++]=s>>>24&255,n[i++]=c>>>0&255,n[i++]=c>>>8&255,n[i++]=c>>>16&255,n[i++]=c>>>24&255,n[i++]=l>>>0&255,n[i++]=l>>>8&255,n[i++]=l>>>16&255,n[i++]=l>>>24&255,n[i++]=u>>>0&255,n[i++]=u>>>8&255,n[i++]=u>>>16&255,n[i++]=u>>>24&255,n[i++]=d>>>0&255,n[i++]=d>>>8&255,n[i++]=d>>>16&255,n[i++]=d>>>24&255}})(e,t,n,r);break;case 16:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<128;t++){let t=e[a++]>>>0;n[i++]=65535&t,n[i++]=t>>>16&65535}})(e,t,n,r);break;default:(function(e,t,n,r,i){let a=cp[i]>>>0,o=t,s=0,c=e[o]>>>0,l=r;for(let t=0;t<8;t++){for(let t=0;t<32;t++)if(s+i<=32)n[l+t]=c>>>s&a,s+=i,s===32&&(s=0,o++,t!==31&&(c=e[o]>>>0));else{let r=32-s,u=c>>>s;o++,c=e[o]>>>0;let d=i-r;n[l+t]=(u|(c&-1>>>32-d>>>0)<<r)&a,s=d}l+=32,s=0,t<7&&(c=e[o]>>>0)}})(e,t,n,r,i)}return t+(i<<3)|0}function hp(e,t,n,r){if(n+2>t)throw Error(`FastPFOR decode: byteContainer underflow at block=${r} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${n}, byteSize=${t})`);let i=e[n++],a=e[n++];if(i>32)throw Error(`FastPFOR decode: invalid bitWidth=${i} at block=${r} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:i,exceptionCount:a,bytePosIn:n}}function gp(e,t,n,r,i,a,o,s,c){let{maxBits:l,exceptionBitWidth:u,bytePosIn:d}=function(e,t,n,r,i,a){if(n+1>t)throw Error(`FastPFOR decode: exception header underflow at block=${a} (need 1 byte for maxBits, bytePos=${n}, byteSize=${t})`);let o=e[n++];if(o<r||o>32)throw Error(`FastPFOR decode: invalid maxBits=${o} at block=${a} (bitWidth=${r}, expected ${r}..32)`);let s=o-r|0;if(s<1||s>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${s} at block=${a} (bitWidth=${r}, maxBits=${o})`);if(n+i>t)throw Error(`FastPFOR decode: exception positions underflow at block=${a} (need=${i}, have=${t-n})`);return{maxBits:o,exceptionBitWidth:s,bytePosIn:n}}(i,a,o,n,r,c);if(o=d,u===1){let a=1<<n;for(let n=0;n<r;n=n+1|0)e[i[o++]+t|0]|=a;return o}let f=s.dataToBePacked[u];if(!f)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${u} (bitWidth=${n}, maxBits=${l}) at block ${c}`);let p=s.dataPointers,m=0|p[u],h=0|s.exceptionSizes[u];if(m+r>h)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${u} (ptr=${m}, need ${r}, size=${h}) at block ${c}`);for(let a=0;a<r;a=a+1|0){let r=i[o++],a=0|f[m++];e[r+t|0]|=a<<n}return p[u]=m,o}function _p(e,t,n,r,i,a){let o=0|n,s=0|e[o];if(s<=0||o+s>e.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${s} at pageStart=${o} (expected > 0 and pageStart+whereMeta < encoded.length=${e.length})`);let c=o+1|0,l=o+s|0,u=e[l]>>>0,d=u+3>>>2,f=l+1,p=f+d;if(p>=e.length)throw Error(`FastPFOR decode: invalid byteSize=${u} (metaInts=${d}, pageStart=${o}, packedEnd=${l}, byteContainerStart=${f}) causes bitmapPos=${p} out of bounds (encoded.length=${e.length})`);let m=function(e,t,n,r){r.byteContainer.length<n&&(r.byteContainer=new Uint8Array(2*n),r.byteContainerI32=void 0);let i=r.byteContainer,a=n>>>2;if(3&i.byteOffset)for(let n=0;n<a;n=n+1|0){let r=0|e[t+n|0],a=n<<2;i[a]=255&r,i[a+1|0]=r>>>8&255,i[a+2|0]=r>>>16&255,i[a+3|0]=r>>>24&255}else{let n=r.byteContainerI32;(!n||n.buffer!==i.buffer||n.byteOffset!==i.byteOffset||n.length<a)&&(n=r.byteContainerI32=new Int32Array(i.buffer,i.byteOffset,i.byteLength>>>2)),n.set(e.subarray(t,t+a))}let o=3&n;if(o>0){let n=0|e[t+a|0],r=a<<2;for(let e=0;e<o;e=e+1|0)i[r+e|0]=n>>>(e<<3)&255}return i}(e,f,u,a),h=u,g=function(e,t,n){let r=0|e[t++],i=n.dataToBePacked;for(let a=2;a<=32;a=a+1|0){if(!(r>>>a-1&1))continue;if(t>=e.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${a}, streamWordIndex=${t}, needWords=1, availableWords=${e.length-t}, encodedWords=${e.length})`);let o=e[t++]>>>0,s=lp(o+31,32),c=o*a+31>>>5;if(t+c>e.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${a}, size=${o}, streamWordIndex=${t}, needWords=${c}, availableWords=${e.length-t}, encodedWords=${e.length})`);let l=i[a];(!l||l.length<s)&&(l=i[a]=new Uint32Array(s));let u=0;for(;u<o;u=u+32|0)vp(e,t,l,u,a),t=t+a|0;t=t-((u-o|0)*a>>>5)|0,n.exceptionSizes[a]=o}return t}(e,p,a);return a.dataPointers.fill(0),function(e,t,n,r,i,a,o,s,c,l){let u=0|n,d=0;for(let t=0;t<o;t=t+1|0){let n=hp(s,c,d,t);d=n.bytePosIn;let r=n.bitWidth,o=n.exceptionCount,f=a+t*256|0;switch(r){case 0:i.fill(0,f,f+256);break;case 32:for(let t=0;t<256;t=t+1|0)i[f+t|0]=0|e[u+t|0];u=u+256|0;break;default:u=mp(e,u,i,f,r)}o>0&&(d=gp(i,f,r,o,s,c,d,l,t))}if(u!==r)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${t}, packedStart=${n}, consumedPackedEnd=${u}, expectedPackedEnd=${r}, packedWords=${r-n}, encoded.length=${e.length})`)}(e,o,c,l,t,0|r,i/256|0,m,h,a),g}function vp(e,t,n,r,i){switch(i){case 2:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0;n[i++]=a>>>0&3,n[i++]=a>>>2&3,n[i++]=a>>>4&3,n[i++]=a>>>6&3,n[i++]=a>>>8&3,n[i++]=a>>>10&3,n[i++]=a>>>12&3,n[i++]=a>>>14&3,n[i++]=a>>>16&3,n[i++]=a>>>18&3,n[i++]=a>>>20&3,n[i++]=a>>>22&3,n[i++]=a>>>24&3,n[i++]=a>>>26&3,n[i++]=a>>>28&3,n[i++]=a>>>30&3,n[i++]=o>>>0&3,n[i++]=o>>>2&3,n[i++]=o>>>4&3,n[i++]=o>>>6&3,n[i++]=o>>>8&3,n[i++]=o>>>10&3,n[i++]=o>>>12&3,n[i++]=o>>>14&3,n[i++]=o>>>16&3,n[i++]=o>>>18&3,n[i++]=o>>>20&3,n[i++]=o>>>22&3,n[i++]=o>>>24&3,n[i++]=o>>>26&3,n[i++]=o>>>28&3,n[i]=o>>>30&3})(e,t,n,r);return;case 3:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0;n[i++]=a>>>0&7,n[i++]=a>>>3&7,n[i++]=a>>>6&7,n[i++]=a>>>9&7,n[i++]=a>>>12&7,n[i++]=a>>>15&7,n[i++]=a>>>18&7,n[i++]=a>>>21&7,n[i++]=a>>>24&7,n[i++]=a>>>27&7,n[i++]=7&(a>>>30|(1&o)<<2),n[i++]=o>>>1&7,n[i++]=o>>>4&7,n[i++]=o>>>7&7,n[i++]=o>>>10&7,n[i++]=o>>>13&7,n[i++]=o>>>16&7,n[i++]=o>>>19&7,n[i++]=o>>>22&7,n[i++]=o>>>25&7,n[i++]=o>>>28&7,n[i++]=7&(o>>>31|(3&s)<<1),n[i++]=s>>>2&7,n[i++]=s>>>5&7,n[i++]=s>>>8&7,n[i++]=s>>>11&7,n[i++]=s>>>14&7,n[i++]=s>>>17&7,n[i++]=s>>>20&7,n[i++]=s>>>23&7,n[i++]=s>>>26&7,n[i]=s>>>29&7})(e,t,n,r);return;case 4:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0;n[i++]=a>>>0&15,n[i++]=a>>>4&15,n[i++]=a>>>8&15,n[i++]=a>>>12&15,n[i++]=a>>>16&15,n[i++]=a>>>20&15,n[i++]=a>>>24&15,n[i++]=a>>>28&15,n[i++]=o>>>0&15,n[i++]=o>>>4&15,n[i++]=o>>>8&15,n[i++]=o>>>12&15,n[i++]=o>>>16&15,n[i++]=o>>>20&15,n[i++]=o>>>24&15,n[i++]=o>>>28&15,n[i++]=s>>>0&15,n[i++]=s>>>4&15,n[i++]=s>>>8&15,n[i++]=s>>>12&15,n[i++]=s>>>16&15,n[i++]=s>>>20&15,n[i++]=s>>>24&15,n[i++]=s>>>28&15,n[i++]=c>>>0&15,n[i++]=c>>>4&15,n[i++]=c>>>8&15,n[i++]=c>>>12&15,n[i++]=c>>>16&15,n[i++]=c>>>20&15,n[i++]=c>>>24&15,n[i]=c>>>28&15})(e,t,n,r);return;case 5:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0;n[i++]=a>>>0&31,n[i++]=a>>>5&31,n[i++]=a>>>10&31,n[i++]=a>>>15&31,n[i++]=a>>>20&31,n[i++]=a>>>25&31,n[i++]=31&(a>>>30|(7&o)<<2),n[i++]=o>>>3&31,n[i++]=o>>>8&31,n[i++]=o>>>13&31,n[i++]=o>>>18&31,n[i++]=o>>>23&31,n[i++]=31&(o>>>28|(1&s)<<4),n[i++]=s>>>1&31,n[i++]=s>>>6&31,n[i++]=s>>>11&31,n[i++]=s>>>16&31,n[i++]=s>>>21&31,n[i++]=s>>>26&31,n[i++]=31&(s>>>31|(15&c)<<1),n[i++]=c>>>4&31,n[i++]=c>>>9&31,n[i++]=c>>>14&31,n[i++]=c>>>19&31,n[i++]=c>>>24&31,n[i++]=31&(c>>>29|(3&l)<<3),n[i++]=l>>>2&31,n[i++]=l>>>7&31,n[i++]=l>>>12&31,n[i++]=l>>>17&31,n[i++]=l>>>22&31,n[i]=l>>>27&31})(e,t,n,r);return;case 6:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0;n[i++]=a>>>0&63,n[i++]=a>>>6&63,n[i++]=a>>>12&63,n[i++]=a>>>18&63,n[i++]=a>>>24&63,n[i++]=63&(a>>>30|(15&o)<<2),n[i++]=o>>>4&63,n[i++]=o>>>10&63,n[i++]=o>>>16&63,n[i++]=o>>>22&63,n[i++]=63&(o>>>28|(3&s)<<4),n[i++]=s>>>2&63,n[i++]=s>>>8&63,n[i++]=s>>>14&63,n[i++]=s>>>20&63,n[i++]=s>>>26&63,n[i++]=c>>>0&63,n[i++]=c>>>6&63,n[i++]=c>>>12&63,n[i++]=c>>>18&63,n[i++]=c>>>24&63,n[i++]=63&(c>>>30|(15&l)<<2),n[i++]=l>>>4&63,n[i++]=l>>>10&63,n[i++]=l>>>16&63,n[i++]=l>>>22&63,n[i++]=63&(l>>>28|(3&u)<<4),n[i++]=u>>>2&63,n[i++]=u>>>8&63,n[i++]=u>>>14&63,n[i++]=u>>>20&63,n[i]=u>>>26&63})(e,t,n,r);return;case 7:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0;n[i++]=a>>>0&127,n[i++]=a>>>7&127,n[i++]=a>>>14&127,n[i++]=a>>>21&127,n[i++]=127&(a>>>28|(7&o)<<4),n[i++]=o>>>3&127,n[i++]=o>>>10&127,n[i++]=o>>>17&127,n[i++]=o>>>24&127,n[i++]=127&(o>>>31|(63&s)<<1),n[i++]=s>>>6&127,n[i++]=s>>>13&127,n[i++]=s>>>20&127,n[i++]=127&(s>>>27|(3&c)<<5),n[i++]=c>>>2&127,n[i++]=c>>>9&127,n[i++]=c>>>16&127,n[i++]=c>>>23&127,n[i++]=127&(c>>>30|(31&l)<<2),n[i++]=l>>>5&127,n[i++]=l>>>12&127,n[i++]=l>>>19&127,n[i++]=127&(l>>>26|(1&u)<<6),n[i++]=u>>>1&127,n[i++]=u>>>8&127,n[i++]=u>>>15&127,n[i++]=u>>>22&127,n[i++]=127&(u>>>29|(15&d)<<3),n[i++]=d>>>4&127,n[i++]=d>>>11&127,n[i++]=d>>>18&127,n[i]=d>>>25&127})(e,t,n,r);return;case 8:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0,f=e[t+7]>>>0;n[i++]=a>>>0&255,n[i++]=a>>>8&255,n[i++]=a>>>16&255,n[i++]=a>>>24&255,n[i++]=o>>>0&255,n[i++]=o>>>8&255,n[i++]=o>>>16&255,n[i++]=o>>>24&255,n[i++]=s>>>0&255,n[i++]=s>>>8&255,n[i++]=s>>>16&255,n[i++]=s>>>24&255,n[i++]=c>>>0&255,n[i++]=c>>>8&255,n[i++]=c>>>16&255,n[i++]=c>>>24&255,n[i++]=l>>>0&255,n[i++]=l>>>8&255,n[i++]=l>>>16&255,n[i++]=l>>>24&255,n[i++]=u>>>0&255,n[i++]=u>>>8&255,n[i++]=u>>>16&255,n[i++]=u>>>24&255,n[i++]=d>>>0&255,n[i++]=d>>>8&255,n[i++]=d>>>16&255,n[i++]=d>>>24&255,n[i++]=f>>>0&255,n[i++]=f>>>8&255,n[i++]=f>>>16&255,n[i]=f>>>24&255})(e,t,n,r);return;case 9:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0,f=e[t+7]>>>0,p=e[t+8]>>>0;n[i++]=a>>>0&511,n[i++]=a>>>9&511,n[i++]=a>>>18&511,n[i++]=511&(a>>>27|(15&o)<<5),n[i++]=o>>>4&511,n[i++]=o>>>13&511,n[i++]=o>>>22&511,n[i++]=511&(o>>>31|(255&s)<<1),n[i++]=s>>>8&511,n[i++]=s>>>17&511,n[i++]=511&(s>>>26|(7&c)<<6),n[i++]=c>>>3&511,n[i++]=c>>>12&511,n[i++]=c>>>21&511,n[i++]=511&(c>>>30|(127&l)<<2),n[i++]=l>>>7&511,n[i++]=l>>>16&511,n[i++]=511&(l>>>25|(3&u)<<7),n[i++]=u>>>2&511,n[i++]=u>>>11&511,n[i++]=u>>>20&511,n[i++]=511&(u>>>29|(63&d)<<3),n[i++]=d>>>6&511,n[i++]=d>>>15&511,n[i++]=511&(d>>>24|(1&f)<<8),n[i++]=f>>>1&511,n[i++]=f>>>10&511,n[i++]=f>>>19&511,n[i++]=511&(f>>>28|(31&p)<<4),n[i++]=p>>>5&511,n[i++]=p>>>14&511,n[i]=p>>>23&511})(e,t,n,r);return;case 10:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0,f=e[t+7]>>>0,p=e[t+8]>>>0,m=e[t+9]>>>0;n[i++]=a>>>0&1023,n[i++]=a>>>10&1023,n[i++]=a>>>20&1023,n[i++]=1023&(a>>>30|(255&o)<<2),n[i++]=o>>>8&1023,n[i++]=o>>>18&1023,n[i++]=1023&(o>>>28|(63&s)<<4),n[i++]=s>>>6&1023,n[i++]=s>>>16&1023,n[i++]=1023&(s>>>26|(15&c)<<6),n[i++]=c>>>4&1023,n[i++]=c>>>14&1023,n[i++]=1023&(c>>>24|(3&l)<<8),n[i++]=l>>>2&1023,n[i++]=l>>>12&1023,n[i++]=l>>>22&1023,n[i++]=u>>>0&1023,n[i++]=u>>>10&1023,n[i++]=u>>>20&1023,n[i++]=1023&(u>>>30|(255&d)<<2),n[i++]=d>>>8&1023,n[i++]=d>>>18&1023,n[i++]=1023&(d>>>28|(63&f)<<4),n[i++]=f>>>6&1023,n[i++]=f>>>16&1023,n[i++]=1023&(f>>>26|(15&p)<<6),n[i++]=p>>>4&1023,n[i++]=p>>>14&1023,n[i++]=1023&(p>>>24|(3&m)<<8),n[i++]=m>>>2&1023,n[i++]=m>>>12&1023,n[i]=m>>>22&1023})(e,t,n,r);return;case 11:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0,f=e[t+7]>>>0,p=e[t+8]>>>0,m=e[t+9]>>>0,h=e[t+10]>>>0;n[i++]=a>>>0&2047,n[i++]=a>>>11&2047,n[i++]=2047&(a>>>22|(1&o)<<10),n[i++]=o>>>1&2047,n[i++]=o>>>12&2047,n[i++]=2047&(o>>>23|(3&s)<<9),n[i++]=s>>>2&2047,n[i++]=s>>>13&2047,n[i++]=2047&(s>>>24|(7&c)<<8),n[i++]=c>>>3&2047,n[i++]=c>>>14&2047,n[i++]=2047&(c>>>25|(15&l)<<7),n[i++]=l>>>4&2047,n[i++]=l>>>15&2047,n[i++]=2047&(l>>>26|(31&u)<<6),n[i++]=u>>>5&2047,n[i++]=u>>>16&2047,n[i++]=2047&(u>>>27|(63&d)<<5),n[i++]=d>>>6&2047,n[i++]=d>>>17&2047,n[i++]=2047&(d>>>28|(127&f)<<4),n[i++]=f>>>7&2047,n[i++]=f>>>18&2047,n[i++]=2047&(f>>>29|(255&p)<<3),n[i++]=p>>>8&2047,n[i++]=p>>>19&2047,n[i++]=2047&(p>>>30|(511&m)<<2),n[i++]=m>>>9&2047,n[i++]=m>>>20&2047,n[i++]=2047&(m>>>31|(1023&h)<<1),n[i++]=h>>>10&2047,n[i]=h>>>21&2047})(e,t,n,r);return;case 12:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0,f=e[t+7]>>>0,p=e[t+8]>>>0,m=e[t+9]>>>0,h=e[t+10]>>>0,g=e[t+11]>>>0;n[i++]=a>>>0&4095,n[i++]=a>>>12&4095,n[i++]=4095&(a>>>24|(15&o)<<8),n[i++]=o>>>4&4095,n[i++]=o>>>16&4095,n[i++]=4095&(o>>>28|(255&s)<<4),n[i++]=s>>>8&4095,n[i++]=s>>>20&4095,n[i++]=c>>>0&4095,n[i++]=c>>>12&4095,n[i++]=4095&(c>>>24|(15&l)<<8),n[i++]=l>>>4&4095,n[i++]=l>>>16&4095,n[i++]=4095&(l>>>28|(255&u)<<4),n[i++]=u>>>8&4095,n[i++]=u>>>20&4095,n[i++]=d>>>0&4095,n[i++]=d>>>12&4095,n[i++]=4095&(d>>>24|(15&f)<<8),n[i++]=f>>>4&4095,n[i++]=f>>>16&4095,n[i++]=4095&(f>>>28|(255&p)<<4),n[i++]=p>>>8&4095,n[i++]=p>>>20&4095,n[i++]=m>>>0&4095,n[i++]=m>>>12&4095,n[i++]=4095&(m>>>24|(15&h)<<8),n[i++]=h>>>4&4095,n[i++]=h>>>16&4095,n[i++]=4095&(h>>>28|(255&g)<<4),n[i++]=g>>>8&4095,n[i]=g>>>20&4095})(e,t,n,r);return;case 16:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0,f=e[t+7]>>>0,p=e[t+8]>>>0,m=e[t+9]>>>0,h=e[t+10]>>>0,g=e[t+11]>>>0,_=e[t+12]>>>0,v=e[t+13]>>>0,y=e[t+14]>>>0,b=e[t+15]>>>0;n[i++]=a>>>0&65535,n[i++]=a>>>16&65535,n[i++]=o>>>0&65535,n[i++]=o>>>16&65535,n[i++]=s>>>0&65535,n[i++]=s>>>16&65535,n[i++]=c>>>0&65535,n[i++]=c>>>16&65535,n[i++]=l>>>0&65535,n[i++]=l>>>16&65535,n[i++]=u>>>0&65535,n[i++]=u>>>16&65535,n[i++]=d>>>0&65535,n[i++]=d>>>16&65535,n[i++]=f>>>0&65535,n[i++]=f>>>16&65535,n[i++]=p>>>0&65535,n[i++]=p>>>16&65535,n[i++]=m>>>0&65535,n[i++]=m>>>16&65535,n[i++]=h>>>0&65535,n[i++]=h>>>16&65535,n[i++]=g>>>0&65535,n[i++]=g>>>16&65535,n[i++]=_>>>0&65535,n[i++]=_>>>16&65535,n[i++]=v>>>0&65535,n[i++]=v>>>16&65535,n[i++]=y>>>0&65535,n[i++]=y>>>16&65535,n[i++]=b>>>0&65535,n[i]=b>>>16&65535})(e,t,n,r);return;case 32:for(let i=0;i<32;i=i+1|0)n[r+i|0]=0|e[t+i|0];return}let a=cp[i]>>>0,o=t,s=0,c=e[o]>>>0;for(let t=0;t<32;t++)if(s+i<=32)n[r+t]=c>>>s&a,s+=i,s===32&&(s=0,o++,t!==31&&(c=e[o]>>>0));else{let l=32-s,u=c>>>s;o++,c=e[o]>>>0,n[r+t]=(u|(c&cp[i-l]>>>0)<<l)&a,s=i-l}}function yp(e,t,n){let r=new Uint32Array(n),i=0,a=t.get();for(let t=0;t<r.length;t++){let t=e[a++],n=127&t;t<128||(t=e[a++],n|=(127&t)<<7,t<128||(t=e[a++],n|=(127&t)<<14,t<128||(t=e[a++],n|=(127&t)<<21,t<128||(t=e[a++],n|=(15&t)<<28)))),r[i++]=n}return t.set(a),r}function bp(e,t,n){let r=new BigUint64Array(n);for(let n=0;n<r.length;n++)r[n]=xp(e,t);return r}function xp(e,t){let n=0n,r=0,i=t.get();for(;i<e.length;){let t=e[i++];if(n|=BigInt(127&t)<<BigInt(r),!(128&t))break;if(r+=7,r>=64)throw Error(`Varint too long`)}return t.set(i),n}function Sp(e,t){let n,r;return r=e[t.get()],t.increment(),n=127&r,r<128?n:(r=e[t.get()],t.increment(),n|=(127&r)<<7,r<128?n:(r=e[t.get()],t.increment(),n|=(127&r)<<14,r<128?n:(r=e[t.get()],t.increment(),n|=(127&r)<<21,r<128?n:(r=e[t.get()],n|=(15&r)<<28,function(e,t,n){let r,i;if(i=t[n.get()],n.increment(),r=(112&i)>>4,i<128||(i=t[n.get()],n.increment(),r|=(127&i)<<3,i<128)||(i=t[n.get()],n.increment(),r|=(127&i)<<10,i<128)||(i=t[n.get()],n.increment(),r|=(127&i)<<17,i<128)||(i=t[n.get()],n.increment(),r|=(127&i)<<24,i<128)||(i=t[n.get()],n.increment(),r|=(1&i)<<31,i<128))return 4294967296*r+(e>>>0);throw Error(`Expected varint not more than 10 bytes`)}(n,e,t)))))}function $(e){return e>>>1^-(1&e)}function Cp(e){return e>>1n^-(1n&e)}function wp(e){return e%2==1?(e+1)/-2:e/2}function Tp(e,t,n){if(n===void 0){n=0;for(let r=0;r<t;r++)n+=e[r]}let r=new Uint32Array(n),i=0;for(let n=0;n<t;n++){let a=e[n];r.fill(e[n+t],i,i+a),i+=a}return r}function Ep(e,t,n){if(n===void 0){n=0;for(let r=0;r<t;r++)n+=Number(e[r])}let r=new BigUint64Array(n),i=0;for(let n=0;n<t;n++){let a=Number(e[n]);r.fill(e[n+t],i,i+a),i+=a}return r}function Dp(e,t,n){let r=new Float64Array(n),i=0;for(let n=0;n<t;n++){let a=e[n];r.fill(e[n+t],i,i+a),i+=a}return r}function Op(e){let t=new Int32Array(e.length);t[0]=$(e[0]);let n=e.length/4*4,r=1;if(n>=4)for(;r<n-4;r+=4){let n=e[r+1],i=e[r+2],a=e[r+3];t[r]=$(e[r])+t[r-1],t[r+1]=$(n)+t[r],t[r+2]=$(i)+t[r+1],t[r+3]=$(a)+t[r+2]}for(;r!==e.length;++r)t[r]=$(e[r])+t[r-1];return t}function kp(e){let t=new BigInt64Array(e.length);t[0]=Cp(e[0]);let n=e.length/4*4,r=1;if(n>=4)for(;r<n-4;r+=4){let n=e[r+1],i=e[r+2],a=e[r+3];t[r]=Cp(e[r])+t[r-1],t[r+1]=Cp(n)+t[r],t[r+2]=Cp(i)+t[r+1],t[r+3]=Cp(a)+t[r+2]}for(;r!==t.length;++r)t[r]=Cp(e[r])+t[r-1];return t}function Ap(e){let t=e.length/4*4,n=1;if(t>=4)for(let r=e[0];n<t-4;n+=4)r=e[n]+=r,r=e[n+1]+=r,r=e[n+2]+=r,r=e[n+3]+=r;for(;n!==e.length;)e[n]+=e[n-1],++n}var jp,Mp,Np,Pp,Fp,Ip,Lp,Rp;function zp(e,t){let n=function(e,t){let n=e[t.get()],r=Object.values(jp)[n>>4],i=null;switch(r){case jp.DATA:i={dictionaryType:Object.values(Mp)[15&n]};break;case jp.OFFSET:i={offsetType:Object.values(Np)[15&n]};break;case jp.LENGTH:i={lengthType:Object.values(Pp)[15&n]}}t.increment();let a=e[t.get()],o=Object.values(Q)[a>>5],s=Object.values(Q)[a>>2&7],c=Object.values(op)[3&a];t.increment();let l=yp(e,t,2),u=l[0];return{physicalStreamType:r,logicalStreamType:i,logicalLevelTechnique1:o,logicalLevelTechnique2:s,physicalLevelTechnique:c,numValues:u,byteLength:l[1],decompressedCount:u}}(e,t);return n.logicalLevelTechnique1===Q.MORTON?function(e,t,n){let r=yp(t,n,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:e.decompressedCount,numBits:r[0],coordinateShift:r[1]}}(n,e,t):Q.RLE!==n.logicalLevelTechnique1&&Q.RLE!==n.logicalLevelTechnique2||op.NONE===n.physicalLevelTechnique?n:function(e,t,n){let r=yp(t,n,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:r[1],runs:r[0],numRleValues:r[1]}}(n,e,t)}(function(e){e.PRESENT=`PRESENT`,e.DATA=`DATA`,e.OFFSET=`OFFSET`,e.LENGTH=`LENGTH`})(jp||={}),function(e){e.NONE=`NONE`,e.SINGLE=`SINGLE`,e.SHARED=`SHARED`,e.VERTEX=`VERTEX`,e.MORTON=`MORTON`,e.FSST=`FSST`}(Mp||={}),function(e){e.VERTEX=`VERTEX`,e.INDEX=`INDEX`,e.STRING=`STRING`,e.KEY=`KEY`}(Np||={}),function(e){e.VAR_BINARY=`VAR_BINARY`,e.GEOMETRIES=`GEOMETRIES`,e.PARTS=`PARTS`,e.RINGS=`RINGS`,e.TRIANGLES=`TRIANGLES`,e.SYMBOL=`SYMBOL`,e.DICTIONARY=`DICTIONARY`}(Pp||={}),function(e){e[e.FLAT=0]=`FLAT`,e[e.CONST=1]=`CONST`,e[e.SEQUENCE=2]=`SEQUENCE`,e[e.DICTIONARY=3]=`DICTIONARY`,e[e.FSST_DICTIONARY=4]=`FSST_DICTIONARY`}(Fp||={});class Bp{constructor(e,t){this.values=e,this._size=t}get(e){let t=Math.floor(e/8);return(this.values[t]>>e%8&1)==1}set(e,t){let n=Math.floor(e/8);this.values[n]=this.values[n]|!!t<<e%8}getInt(e){let t=Math.floor(e/8);return this.values[t]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}function Vp(e,t,n){if(!t)return e;let r=t.size(),i=new e.constructor(r),a=0;for(let o=0;o<r;o++)i[o]=t.get(o)?e[a++]:n;return i}function Hp(e,t,n,r,i){return function(e,t,n,r){let i;switch(t.logicalLevelTechnique1){case Q.DELTA:if(t.logicalLevelTechnique2===Q.RLE){let n=t;if(!r)return function(e,t,n){let r=new Int32Array(n),i=0,a=0;for(let n=0;n<t;n++){let o=e[n],s=$(e[n+t]);for(let e=0;e<o;e++)a+=s,r[i++]=a}return r}(e,n.runs,n.numRleValues);i=Op(e=Tp(e,n.runs,n.numRleValues))}else i=Op(e);break;case Q.RLE:i=function(e,t,n){if(n===void 0){n=0;for(let r=0;r<t;r++)n+=e[r]}let r=new Int32Array(n),i=0;for(let n=0;n<t;n++){let a=e[n],o=e[n+t];o=$(o),r.fill(o,i,i+a),i+=a}return r}(e,t.runs,t.numRleValues);break;case Q.MORTON:Ap(e),i=new Int32Array(e);break;case Q.COMPONENTWISE_DELTA:i=function(e){if(e.length<2)return new Int32Array(e);let t=new Int32Array(e.length);t[0]=$(e[0]),t[1]=$(e[1]);let n=e.length/4*4,r=2;if(n>=4)for(;r<n-4;r+=4){let n=e[r+1],i=e[r+2],a=e[r+3];t[r]=$(e[r])+t[r-2],t[r+1]=$(n)+t[r-1],t[r+2]=$(i)+t[r],t[r+3]=$(a)+t[r+1]}for(;r!==e.length;r+=2)t[r]=$(e[r])+t[r-2],t[r+1]=$(e[r+1])+t[r-1];return t}(e);break;case Q.NONE:i=function(e){let t=new Int32Array(e.length);for(let n=0;n<e.length;n++)t[n]=$(e[n]);return t}(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?Vp(i,r,0):i}(Gp(e,t,n),n,0,i)}function Up(e,t,n,r,i){return function(e,t,n,r){let i;switch(t.logicalLevelTechnique1){case Q.DELTA:i=function(e){let t=new Uint32Array(e.length);t[0]=$(e[0])>>>0;for(let n=1;n<e.length;n++)t[n]=t[n-1]+$(e[n])>>>0;return t}(t.logicalLevelTechnique2===Q.RLE?Tp(e,t.runs,t.numRleValues):e);break;case Q.RLE:i=Tp(e,t.runs,t.numRleValues);break;case Q.MORTON:Ap(e),i=e;break;case Q.COMPONENTWISE_DELTA:i=function(e){if(e.length<2)return new Uint32Array(e);let t=new Uint32Array(e.length);t[0]=$(e[0])>>>0,t[1]=$(e[1])>>>0;for(let n=2;n<e.length;n+=2)t[n]=t[n-2]+$(e[n])>>>0,t[n+1]=t[n-1]+$(e[n+1])>>>0;return t}(e);break;case Q.NONE:i=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?Vp(i,r,0):i}(Gp(e,t,n),n,0,i)}function Wp(e,t,n){return function(e,t){if(t.logicalLevelTechnique1===Q.DELTA&&t.logicalLevelTechnique2===Q.NONE)return function(e){let t=new Int32Array(e.length+1);t[0]=0,t[1]=$(e[0]);let n=t[1];for(let r=2;r!==t.length;++r)n+=$(e[r-1]),t[r]=t[r-1]+n;return new Uint32Array(t)}(e);if(t.logicalLevelTechnique1===Q.RLE&&t.logicalLevelTechnique2===Q.NONE)return function(e,t,n){let r=new Uint32Array(n+1);r[0]=0;let i=1,a=r[0];for(let n=0;n<t;n++){let o=e[n],s=e[n+t];for(let e=i;e<i+o;e++)r[e]=s+a,a=r[e];i+=o}return r}(e,t.runs,t.numRleValues);if(t.logicalLevelTechnique1===Q.NONE&&t.logicalLevelTechnique2===Q.NONE){(function(e){let t=0;for(let n=0;n<e.length;n++)e[n]+=t,t=e[n]})(e);let n=new Uint32Array(t.numValues+1);return n[0]=0,n.set(e,1),n}if(t.logicalLevelTechnique1===Q.DELTA&&t.logicalLevelTechnique2===Q.RLE){let n=function(e,t,n){let r=new Int32Array(n+1);r[0]=0;let i=1,a=r[0];for(let n=0;n<t;n++){let o=e[n],s=e[n+t];s=$(s);for(let e=i;e<i+o;e++)r[e]=s+a,a=r[e];i+=o}return r}(e,t.runs,t.numRleValues);return Ap(n),new Uint32Array(n)}throw Error(`Only delta encoding is supported for transforming length to offset streams yet.`)}(Gp(e,t,n),n)}function Gp(e,t,n){let r=n.physicalLevelTechnique;switch(r){case op.FAST_PFOR:return function(e,t,n,r){return function(e,t,n,r,i){let a=r.get();if(3&n)throw Error(`FastPFOR: invalid encodedByteLength=${n} at offset=${a} (encodedBytes.length=${e.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let o=n>>>2,s=function(e,t){if(t<=e.encodedWords.length)return e.encodedWords;let n=new Uint32Array(Math.max(16,2*t));return e.encodedWords=n,n}(i,o);(function(e,t,n,r){if(t<0||n<0||t+n>e.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${t}, byteLength=${n}, bytes.length=${e.length})`);let i=Math.floor(n/4),a=n%4!=0,o=a?i+1:i;if(r.length<o)throw RangeError(`decodeBigEndianInt32sInto: out.length=${r.length} < ${o}`);if(i>0){let n=e.byteOffset+t;if(3&n)for(let n=0;n<i;n++){let i=t+4*n;r[n]=e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3]}else{let t=new Uint32Array(e.buffer,n,i);for(let e=0;e<i;e++)r[e]=0|up(t[e])}}if(a){let a=t+4*i,o=n-4*i,s=0;for(let t=0;t<o;t++)s|=e[a+t]<<24-8*t;r[i]=0|s}})(e,a,n,s);let c=function(e,t,n){let r=0,i=0,a=new Uint32Array(t),o=n??pp();if(e.length>0){let t=0|e[r];if(r=r+1|0,255&t)throw Error(`FastPFOR decode: invalid alignedLength=${t} (expected multiple of 256)`);if(i+t>a.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${i}, alignedLength=${t}, out.length=${a.length})`);r=function(e,t,n,r,i,a){let o=r+lp(i,256),s=r,c=n;for(;s!==o;){let n=Math.min(dp,o-s);c=_p(e,t,c,s,n,a),s=s+n|0}return c}(e,a,r,i,t,o),i=i+t|0}return function(e,t,n,r,i,a){if(a===0)return t;let o=0,s=t,c=t+n,l=i,u=i,d=i+a,f=0,p=0;for(;s<c&&u<d;){let t=e[s]>>>o&255;if(o+=8,s+=o>>>5,o&=31,f|=(127&t)<<p,128&t)r[u++]=0|f,f=0,p=0;else if(p+=7,p>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${p}, partial=${f}, decoded=${u-l}/${a}, inPos=${s}, inEnd=${c})`)}if(u!==d)throw Error(`FastPFOR VByte: truncated stream (decoded=${u-l}, expected=${a}, consumedWords=${s-t}/${n}, vbyteStart=${t}, vbyteEnd=${c})`)}(e,r,e.length-r|0,a,i,t-i|0),a}(s.subarray(0,o),t,i.decoderWorkspace);return r.add(n),c}(e,t,n,r,function(e=16){if(e<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${e}`);let t=Math.max(16,0|e);return{encodedWords:new Uint32Array(t),decoderWorkspace:pp()}}(n>>>2))}(e,n.numValues,n.byteLength,t);case op.VARINT:return yp(e,t,n.numValues);case op.NONE:{let r=t.get();t.add(n.byteLength);let i=e.subarray(r,t.get());return new Uint32Array(i)}default:throw Error(`Specified physicalLevelTechnique ${r} is not supported (yet).`)}}function Kp(e,t,n){let r=Gp(e,t,n);return r.length===1?r[0]:function(e){return e[1]}(r)}function qp(e,t,n){return function(e){if(e.length===2){let t=$(e[1]);return[t,t]}return[$(e[2]),$(e[3])]}(Gp(e,t,n))}function Jp(e,t,n){return function(e){if(e.length===2){let t=Cp(e[1]);return[t,t]}return[Cp(e[2]),Cp(e[3])]}(bp(e,t,n.numValues))}function Yp(e,t,n,r){return function(e,t,n){let r;switch(t.logicalLevelTechnique1){case Q.DELTA:r=function(e){let t=new BigUint64Array(e.length);t[0]=BigInt.asUintN(64,Cp(e[0]));for(let n=1;n<e.length;n++)t[n]=BigInt.asUintN(64,t[n-1]+Cp(e[n]));return t}(t.logicalLevelTechnique2===Q.RLE?Ep(e,t.runs,t.numRleValues):e);break;case Q.RLE:r=Ep(e,t.runs,t.numRleValues);break;case Q.NONE:r=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return n?Vp(r,n,0n):r}(bp(e,t,n.numValues),n,r)}function Xp(e,t,n){let r=bp(e,t,n.numValues);return r.length===1?r[0]:function(e){return e[1]}(r)}function Zp(e,t,n,r,i=`int32`){let a=e.logicalLevelTechnique1;if(a===Q.RLE)return e.runs===1?Fp.CONST:Fp.FLAT;if(a!==Q.DELTA||e.logicalLevelTechnique2!==Q.RLE)return e.numValues===1?Fp.CONST:Fp.FLAT;let o=t instanceof Bp?t.size():t;if(e.numRleValues!==o)return Fp.FLAT;if(e.runs===1)return Fp.SEQUENCE;if(e.runs!==2)return e.numValues===1?Fp.CONST:Fp.FLAT;let s=r.get();if(e.physicalLevelTechnique===op.VARINT)return function(e,t,n){let r=new ap(t.get());if(n===`int64`){let t=bp(e,r,4);return t[2]===2n&&t[3]===2n}let i=yp(e,r,4);return i[2]===2&&i[3]===2}(n,r,i)?Fp.SEQUENCE:e.numValues===1?Fp.CONST:Fp.FLAT;let c=r.get(),l=new Int32Array(n.buffer,n.byteOffset+c,4);return r.set(s),l[2]===2&&l[3]===2?Fp.SEQUENCE:e.numValues===1?Fp.CONST:Fp.FLAT}class Qp extends Qf{getValueFromBuffer(e){return this.dataBuffer[e]}}class $p extends tp{constructor(e,t,n,r){super(e,BigInt64Array.of(t),n,r)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}function em(e,t,n){return{x:tm(e,t)-n,y:tm(e>>1,t)-n}}function tm(e,t){let n=0;for(let r=0;r<t;r++)n|=(e&1<<2*r)>>r;return n}function nm(e,t,r,i,a,o,s){return e===Rp.MORTON?function(e,t,r,i,a,o){let s=Array(a?i+1:i);for(let a=0;a<i;a++){let i=em(e[t[r+a]],o.numBits,o.coordinateShift);s[a]=new n(i.x,i.y)}return a&&(s[s.length-1]=s[0]),s}(t,r,i,a,o,s):function(e,t,r,i,a){let o=Array(a?i+1:i);for(let a=0;a<2*i;a+=2){let i=2*t[r+a/2];o[a/2]=new n(e[i],e[i+1])}return a&&(o[o.length-1]=o[0]),o}(t,r,i,a,o)}function rm(e,t,r,i){let a=Array(i?r+1:r);for(let i=0;i<2*r;i+=2)a[i/2]=new n(e[t+i],e[t+i+1]);return i&&(a[a.length-1]=a[0]),a}(function(e){e[e.POINT=0]=`POINT`,e[e.LINESTRING=1]=`LINESTRING`,e[e.POLYGON=2]=`POLYGON`,e[e.MULTIPOINT=3]=`MULTIPOINT`,e[e.MULTILINESTRING=4]=`MULTILINESTRING`,e[e.MULTIPOLYGON=5]=`MULTIPOLYGON`})(Ip||={}),function(e){e[e.POINT=0]=`POINT`,e[e.LINESTRING=1]=`LINESTRING`,e[e.POLYGON=2]=`POLYGON`}(Lp||={}),function(e){e[e.MORTON=0]=`MORTON`,e[e.VEC_2=1]=`VEC_2`,e[e.VEC_3=2]=`VEC_3`}(Rp||={});class im{constructor(e,t,n,r,i){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=n,this._vertexBuffer=r,this._mortonSettings=i}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){let t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){let t=em(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[t.x,t.y]}let t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getGeometries(){return function(e){let t=Array(e.numGeometries),r=1,i=1,a=1,o=0,s=0,c=0,l=e.mortonSettings,u=e.topologyVector,d=u.geometryOffsets,f=u.partOffsets,p=u.ringOffsets,m=e.vertexOffsets,h=!m||m.length===0,g=e.containsPolygonGeometry(),_=e.vertexBuffer;for(let u=0;u<e.numGeometries;u++)switch(e.geometryType(u)){case Ip.POINT:{let u,g;if(h)u=_[s++],g=_[s++];else if(e.vertexBufferType===Rp.MORTON){let e=em(_[m[c++]],l.numBits,l.coordinateShift);u=e.x,g=e.y}else{let e=2*m[c++];u=_[e],g=_[e+1]}t[o++]=[[new n(u,g)]],d&&a++,f&&r++,p&&i++}break;case Ip.MULTIPOINT:{let e=d[a]-d[a-1];a++;let l=Array(e);if(h)for(let t=0;t<e;t++){let e=_[s++],r=_[s++];l[t]=new n(e,r)}else for(let t=0;t<e;t++){let e=2*m[c++];l[t]=new n(_[e],_[e+1])}t[o++]=l.map((e=>[e])),r+=e,i+=e}break;case Ip.LINESTRING:{let n,u;g?(n=p[i]-p[i-1],i++):n=f[r]-f[r-1],r++,h?(u=rm(_,s,n,!1),s+=2*n):(u=nm(e.vertexBufferType,_,m,c,n,!1,l),c+=n),t[o++]=[u],d&&a++}break;case Ip.POLYGON:{let n=f[r]-f[r-1];r++;let u=Array(n-1),g,v=p[i]-p[i-1];if(i++,h){g=rm(_,s,v,!0),s+=2*v;for(let e=0;e<u.length;e++)v=p[i]-p[i-1],i++,u[e]=rm(_,s,v,!0),s+=2*v}else{g=nm(e.vertexBufferType,_,m,c,v,!0,l),c+=v;for(let t=0;t<u.length;t++)v=p[i]-p[i-1],i++,u[t]=nm(e.vertexBufferType,_,m,c,v,!0,l),c+=v}t[o++]=[g].concat(u),d&&a++}break;case Ip.MULTILINESTRING:{let n=d[a]-d[a-1];a++;let u=Array(n);for(let t=0;t<n;t++){let n;g?(n=p[i]-p[i-1],i++):n=f[r]-f[r-1],r++,h?(u[t]=rm(_,s,n,!1),s+=2*n):(u[t]=nm(e.vertexBufferType,_,m,c,n,!1,l),c+=n)}t[o++]=u}break;case Ip.MULTIPOLYGON:{let n=d[a]-d[a-1];a++;let u=Array(n);for(let t=0;t<n;t++){let n=f[r]-f[r-1],a;r++;let o=Array(n-1),d=p[i]-p[i-1];i++,h?(a=rm(_,s,d,!0),s+=2*d):(a=nm(e.vertexBufferType,_,m,c,d,!0,l),c+=d);for(let t=0;t<o.length;t++){let n=p[i]-p[i-1];i++,h?(o[t]=rm(_,s,n,!0),s+=2*n):(o[t]=nm(e.vertexBufferType,_,m,c,n,!0,l),c+=n)}u[t]=[a].concat(o)}t[o++]=u.flat()}break;default:throw Error(`The specified geometry type is currently not supported.`)}return t}(this)}get mortonSettings(){return this._mortonSettings}}class am extends im{constructor(e,t,n,r,i,a,o){super(n,r,i,a,o),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===Ip.POLYGON||this._geometryType===Ip.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class om extends im{constructor(e,t,n,r,i,a){super(e,n,r,i,a),this._geometryTypes=t}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===Ip.POLYGON||this.geometryType(e)===Ip.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class sm{constructor(e,t,n,r){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=n,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 e=Array(this.numGeometries),t=this._topologyVector,r=t.partOffsets,i=t.ringOffsets,a=t.geometryOffsets,o=0,s=1,c=1,l=1;for(let t=0;t<this.numGeometries;t++)switch(this.geometryType(t)){case Ip.POLYGON:{let u=r[s]-r[s-1];s++;let d=[];for(let e=0;e<u;e++){let e=i[c]-i[c-1];c++;let t=[];for(let r=0;r<e;r++){let e=this._vertexBuffer[o++],r=this._vertexBuffer[o++];t.push(new n(e,r))}t.length>0&&t.push(t[0]),d.push(t)}e[t]=d,a&&l++}break;case Ip.MULTIPOLYGON:{let u=a[l]-a[l-1];l++;let d=[];for(let e=0;e<u;e++){let e=r[s]-r[s-1];s++;for(let t=0;t<e;t++){let e=i[c]-i[c-1];c++;let t=[];for(let r=0;r<e;r++){let e=this._vertexBuffer[o++],r=this._vertexBuffer[o++];t.push(new n(e,r))}t.length>0&&t.push(t[0]),d.push(t)}}e[t]=d}}return e}[Symbol.iterator](){return null}}function cm(e,t,n,r,i,a){return new lm(e,t,n,r,i,a)}class lm extends sm{constructor(e,t,n,r,i,a){super(n,r,i,a),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function um(e,t,n,r,i){return new dm(e,t,n,r,i)}class dm extends sm{constructor(e,t,n,r,i){super(t,n,r,i),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function fm(e,t,n,r,i){let a=zp(e,n),o,s,c,l;if(Zp(a,r,e,n)===Fp.CONST){let i=Kp(e,n,a),u,d,f,p;for(let r=0;r<t-1;r++){let t=zp(e,n);switch(t.physicalStreamType){case jp.LENGTH:switch(t.logicalStreamType.lengthType){case Pp.GEOMETRIES:u=Wp(e,n,t);break;case Pp.PARTS:d=Wp(e,n,t);break;case Pp.RINGS:f=Wp(e,n,t);break;case Pp.TRIANGLES:p=Wp(e,n,t)}break;case jp.OFFSET:switch(t.logicalStreamType.offsetType){case Np.VERTEX:o=Up(e,n,t);break;case Np.INDEX:l=Up(e,n,t)}break;case jp.DATA:Mp.VERTEX===t.logicalStreamType.dictionaryType?s=Hp(e,n,t):(c={numBits:t.numBits,coordinateShift:t.coordinateShift},s=Up(e,n,t))}}return l?u!==void 0||d!==void 0?cm(r,i,p,l,s,{geometryOffsets:u,partOffsets:d,ringOffsets:f}):cm(r,i,p,l,s):c===void 0?function(e,t,n,r,i){return new am(e,t,Rp.VEC_2,n,r,i)}(r,i,{geometryOffsets:u,partOffsets:d,ringOffsets:f},o,s):function(e,t,n,r,i,a){return new am(e,t,Rp.MORTON,n,r,i,a)}(r,i,{geometryOffsets:u,partOffsets:d,ringOffsets:f},o,s,c)}let u=Up(e,n,a),d,f,p,m,h,g,_;for(let r=0;r<t-1;r++){let t=zp(e,n);switch(t.physicalStreamType){case jp.LENGTH:switch(t.logicalStreamType.lengthType){case Pp.GEOMETRIES:d=Up(e,n,t);break;case Pp.PARTS:f=Up(e,n,t);break;case Pp.RINGS:p=Up(e,n,t);break;case Pp.TRIANGLES:m=Wp(e,n,t)}break;case jp.OFFSET:switch(t.logicalStreamType.offsetType){case Np.VERTEX:o=Up(e,n,t);break;case Np.INDEX:l=Up(e,n,t)}break;case jp.DATA:Mp.VERTEX===t.logicalStreamType.dictionaryType?s=Hp(e,n,t):(c={numBits:t.numBits,coordinateShift:t.coordinateShift},s=Up(e,n,t))}}return d?(h=pm(u,d,2),f&&p?(g=mm(u,h,f,!1),_=function(e,t,n,r){let i=new Uint32Array(n[n.length-1]+1),a=0;i[0]=a;let o=1,s=1,c=0;for(let l=0;l<e.length;l++){let u=e[l],d=t[l+1]-t[l];if(u!==0&&u!==3)for(let e=0;e<d;e++){let e=n[o]-n[o-1];o++;for(let t=0;t<e;t++)a=i[s++]=a+r[c++]}else for(let e=0;e<d;e++)i[s++]=++a,o++}return i}(u,h,g,p)):f&&(g=function(e,t,n){let r=new Uint32Array(t[t.length-1]+1),i=0;r[0]=i;let a=1,o=0;for(let s=0;s<e.length;s++){let c=e[s],l=t[s+1]-t[s];if(c===4||c===1)for(let e=0;e<l;e++)i=r[a++]=i+n[o++];else for(let e=0;e<l;e++)r[a++]=++i}return r}(u,h,f))):f&&p?(g=pm(u,f,1),_=mm(u,g,p,!0)):f&&(g=pm(u,f,0)),l&&!g?um(u,m,l,s):l?um(u,m,l,s,{geometryOffsets:h,partOffsets:g,ringOffsets:_}):c===void 0?function(e,t,n,r){return new om(Rp.VEC_2,e,t,n,r)}(u,{geometryOffsets:h,partOffsets:g,ringOffsets:_},o,s):function(e,t,n,r,i){return new om(Rp.MORTON,e,t,n,r,i)}(u,{geometryOffsets:h,partOffsets:g,ringOffsets:_},o,s,c)}function pm(e,t,n){let r=new Uint32Array(e.length+1),i=0;r[0]=i;let a=0;for(let o=0;o<e.length;o++)i=r[o+1]=i+(e[o]>n?t[a++]:1);return r}function mm(e,t,n,r){let i=new Uint32Array(t[t.length-1]+1),a=0;i[0]=a;let o=1,s=0;for(let c=0;c<e.length;c++){let l=e[c],u=t[c+1]-t[c];if(l===5||l===2||r&&(l===4||l===1))for(let e=0;e<u;e++)a=i[o++]=a+n[s++];else for(let e=0;e<u;e++)i[o++]=++a}return i}class hm extends Zf{constructor(e,t,n){super(e,t.getBuffer(),n),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}}class gm extends Qf{getValueFromBuffer(e){return this.dataBuffer[e]}}class _m extends Zf{constructor(e,t,n,r){super(e,r?BigInt64Array.of(t):BigUint64Array.of(t),n)}getValueFromBuffer(e){return this.dataBuffer[0]}}function vm(e,t,n,r,i){let a=function(e,t,n,r){let i=new Uint8Array(t),a=0,o=r.get()+n;for(;a<t&&!(r.get()>=o);){let n=e[r.increment()];if(n<=127){let o=n+3,s=e[r.increment()],c=Math.min(a+o,t);i.fill(s,a,c),a=c}else{let o=256-n;for(let n=0;n<o&&a<t;n++)i[a++]=e[r.increment()]}}return r.set(o),i}(e,Math.ceil(t/8),n,r);return i?function(e,t,n){if(!n)return e;let r=n.size(),i=new Bp(e,t),a=new Bp(new Uint8Array(Math.ceil(r/8)),r),o=0;for(let e=0;e<r;e++){let t=!!n.get(e)&&i.get(o++);a.set(e,t)}return a.getBuffer()}(a,t,i):a}let ym=new TextDecoder;function bm(e,t,n){return n-t>=12?ym.decode(e.subarray(t,n)):function(e,t,n){let r=``,i=t;for(;i<n;){let t=e[i],a,o,s,c=null,l=t>239?4:t>223?3:t>191?2:1;if(i+l>n)break;l===1?t<128&&(c=t):l===2?(a=e[i+1],(192&a)==128&&(c=(31&t)<<6|63&a,c<=127&&(c=null))):l===3?(a=e[i+1],o=e[i+2],(192&a)==128&&(192&o)==128&&(c=(15&t)<<12|(63&a)<<6|63&o,(c<=2047||c>=55296&&c<=57343)&&(c=null))):l===4&&(a=e[i+1],o=e[i+2],s=e[i+3],(192&a)==128&&(192&o)==128&&(192&s)==128&&(c=(15&t)<<18|(63&a)<<12|(63&o)<<6|63&s,(c<=65535||c>=1114112)&&(c=null))),c===null?(c=65533,l=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),i+=l}return r}(e,t,n)}class xm extends Zf{constructor(e,t,n,r){super(e,n,r),this.offsetBuffer=t}}class Sm extends xm{constructor(e,t,n,r){super(e,t,n,r??t.length-1)}getValueFromBuffer(e){return bm(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class Cm extends xm{constructor(e,t,n,r,i){super(e,n,r,i??t.length),this.indexBuffer=t,this.indexBuffer=t}getValueFromBuffer(e){let t=this.indexBuffer[e];return bm(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}}class wm extends xm{constructor(e,t,n,r,i,a,o){super(e,n,r,o),this.indexBuffer=t,this.symbolOffsetBuffer=i,this.symbolTableBuffer=a}getValueFromBuffer(e){this.decodedDictionary??=(this.symbolLengthBuffer??=this.offsetToLengthBuffer(this.symbolOffsetBuffer),function(e,t,n){let r=[],i=Array(t.length).fill(0);for(let e=1;e<t.length;e++)i[e]=i[e-1]+t[e-1];for(let a=0;a<n.length;a++)if(n[a]===255)r.push(n[++a]);else{let o=t[n[a]],s=i[n[a]];for(let t=0;t<o;t++)r.push(e[s+t])}return new Uint8Array(r)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));let t=this.indexBuffer[e];return bm(this.decodedDictionary,this.offsetBuffer[t],this.offsetBuffer[t+1])}offsetToLengthBuffer(e){let t=new Uint32Array(e.length-1),n=e[0];for(let r=1;r<e.length;r++){let i=e[r];t[r-1]=i-n,n=i}return t}}function Tm(e,t,n,r,i,a){return n.type===`scalarType`?function(e,t,n,r,i,a){let o=null;if(e===0)return null;if(a.nullable){let e=zp(t,n),r=e.numValues,i=n.get(),a=vm(t,r,e.byteLength,n);n.set(i+e.byteLength),o=new Bp(a,e.numValues)}let s=o??r;switch(i.physicalType){case 4:case 3:return function(e,t,n,r,i){let a=zp(e,t),o=Zp(a,i,e,t),s=r.physicalType===3;if(o===Fp.FLAT){let r=Em(i)?i:void 0,o=s?Hp(e,t,a,0,r):Up(e,t,a,0,r);return new $f(n.name,o,i)}if(o===Fp.SEQUENCE){let r=qp(e,t,a);return new np(n.name,r[0],r[1],a.numRleValues)}let c=s?function(e,t,n){let r=Gp(e,t,n);return r.length===1?$(r[0]):function(e){return $(e[1])}(r)}(e,t,a):Kp(e,t,a);return new rp(n.name,c,i,s)}(t,n,a,i,s);case 9:return function(e,t,n,r,i){let a=null,o=null,s=null,c=null,l=null,u=i??null,d=null,f=null;for(let e=0;e<r;e++){let e=zp(t,n);switch(e.physicalStreamType){case jp.PRESENT:{let r=new Bp(vm(t,e.numValues,e.byteLength,n),e.numValues);u=i??r;break}case jp.OFFSET:o=Up(t,n,e,0,u);break;case jp.LENGTH:{let r=Wp(t,n,e);Pp.DICTIONARY===e.logicalStreamType.lengthType?a=r:Pp.SYMBOL===e.logicalStreamType.lengthType?c=r:d=r;break}case jp.DATA:{let r=t.subarray(n.get(),n.get()+e.byteLength);n.add(e.byteLength);let i=e.logicalStreamType.dictionaryType;Mp.FSST===i?l=r:Mp.SINGLE===i||Mp.SHARED===i?s=r:Mp.NONE===i&&(f=r);break}}}return function(e,t,n,r,i,a,o){return t?new wm(e,n,r,i,a,t,o):null}(e,l,o,a,s,c,u)??function(e,t,n,r,i){return t?i?new Cm(e,n,r,t,i):new Cm(e,n,r,t):null}(e,s,o,a,u)??function(e,t,n,r,i){if(!t||!n)return null;if(r)return i?new Cm(e,r,t,n,i):new Cm(e,r,t,n);if(i&&i.size()!==t.length-1){let r=new Uint32Array(i.size()),a=0;for(let e=0;e<i.size();e++)r[e]=i.get(e)?a++:0;return new Cm(e,r,t,n,i)}return i?new Sm(e,t,n,i):new Sm(e,t,n)}(e,d,f,o,u)}(a.name,t,n,a.nullable?e-1:e,o);case 0:return function(e,t,n,r,i){let a=zp(e,t),o=a.numValues,s=t.get(),c=Em(i)?i:void 0,l=vm(e,o,a.byteLength,t,c);t.set(s+a.byteLength);let u=new Bp(l,o);return new hm(n.name,u,i)}(t,n,a,0,s);case 6:case 5:return function(e,t,n,r,i){let a=zp(e,t),o=Zp(a,r,e,t,`int64`),s=i.physicalType===5;if(o===Fp.FLAT){let i=Em(r)?r:void 0,o=s?function(e,t,n,r){return function(e,t,n){let r;switch(t.logicalLevelTechnique1){case Q.DELTA:if(t.logicalLevelTechnique2===Q.RLE){let i=t;if(!n)return function(e,t,n){let r=new BigInt64Array(n),i=0,a=0n;for(let n=0;n<t;n++){let o=Number(e[n]),s=Cp(e[n+t]);for(let e=0;e<o;e++)a+=s,r[i++]=a}return r}(e,i.runs,i.numRleValues);r=kp(e=Ep(e,i.runs,i.numRleValues))}else r=kp(e);break;case Q.RLE:r=function(e,t,n){if(n===void 0){n=0;for(let r=0;r<t;r++)n+=Number(e[r])}let r=new BigInt64Array(n),i=0;for(let n=0;n<t;n++){let a=Number(e[n]),o=e[n+t];o=Cp(o),r.fill(o,i,i+a),i+=a}return r}(e,t.runs,t.numRleValues);break;case Q.NONE:r=function(e){let t=new BigInt64Array(e.length);for(let n=0;n<e.length;n++)t[n]=Cp(e[n]);return t}(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return n?Vp(r,n,0n):r}(bp(e,t,n.numValues),n,r)}(e,t,a,i):Yp(e,t,a,i);return new Qp(n.name,o,r)}if(o===Fp.SEQUENCE){let r=Jp(e,t,a);return new $p(n.name,r[0],r[1],a.numRleValues)}let c=s?function(e,t,n){let r=bp(e,t,n.numValues);return r.length===1?Cp(r[0]):function(e){return Cp(e[1])}(r)}(e,t,a):Xp(e,t,a);return new _m(n.name,c,r,s)}(t,n,a,s,i);case 7:return function(e,t,n,r){let i=zp(e,t),a=Em(r)?r:void 0,o=function(e,t,n,r){let i=t.get(),a=i+n*Float32Array.BYTES_PER_ELEMENT,o=new Uint8Array(e.subarray(i,a)).buffer,s=new Float32Array(o);return t.set(a),r?Vp(s,r,0):s}(e,t,i.numValues,a);return new gm(n.name,o,r)}(t,n,a,s);case 8:return function(e,t,n,r){let i=zp(e,t),a=Em(r)?r:void 0,o=function(e,t,n,r){let i=t.get(),a=i+n*Float64Array.BYTES_PER_ELEMENT,o=new Uint8Array(e.subarray(i,a)).buffer,s=new Float64Array(o);return t.set(a),r?Vp(s,r,0):s}(e,t,i.numValues,a);return new ep(n.name,o,r)}(t,n,a,s);default:throw Error(`The specified data type for the field is currently not supported: ${i}`)}}(r,e,t,i,n.scalarType,n):r===0?null:function(e,t,n,r){let i=null,a=null,o=null,s=null,c=!1;for(;!c;){let n=zp(e,t);switch(n.physicalStreamType){case jp.LENGTH:Pp.DICTIONARY===n.logicalStreamType.lengthType?i=Wp(e,t,n):o=Wp(e,t,n);break;case jp.DATA:Mp.SINGLE===n.logicalStreamType.dictionaryType||Mp.SHARED===n.logicalStreamType.dictionaryType?(a=e.subarray(t.get(),t.get()+n.byteLength),c=!0):s=e.subarray(t.get(),t.get()+n.byteLength),t.add(n.byteLength)}}let l=n.complexType.children,u=[],d=0;for(let c of l){let l=yp(e,t,1)[0];if(l===0)continue;let f=c.name?`${n.name}${c.name}`:n.name;if(l!==2||c.type!==`scalarField`||c.scalarField.physicalType!==9)throw Error(`Currently only optional string fields are implemented for a struct.`);let p=zp(e,t),m=vm(e,p.numValues,p.byteLength,t),h=zp(e,t),g=Up(e,t,h,0,h.decompressedCount===r?void 0:new Bp(m,p.numValues));u[d++]=s?new wm(f,g,i,a,o,s,new Bp(m,p.numValues)):new Cm(f,g,i,a,new Bp(m,p.numValues))}return u}(e,t,n,i)}function Em(e){return e instanceof Bp}function Dm(e){switch(e){case 0:case 1:case 2:case 3:{let t={};t.nullable=!!(1&e),t.columnScope=0;let n={type:`logicalType`,logicalType:0};return n.longID=!!(2&e),t.scalarType=n,t.type=`scalarType`,t}case 4:{let e={nullable:!1,columnScope:0};return e.type=`complexType`,e.complexType={type:`physicalType`,physicalType:0},e}case 30:{let e={nullable:!1,columnScope:0};return e.type=`complexType`,e.complexType={type:`physicalType`,physicalType:1},e}default:return function(e){let t;switch(e){case 10:case 11:t=0;break;case 12:case 13:t=1;break;case 14:case 15:t=2;break;case 16:case 17:t=3;break;case 18:case 19:t=4;break;case 20:case 21:t=5;break;case 22:case 23:t=6;break;case 24:case 25:t=7;break;case 26:case 27:t=8;break;case 28:case 29:t=9;break;default:return null}let n={};n.nullable=!!(1&e),n.columnScope=0;let r={type:`physicalType`};return r.physicalType=t,n.type=`scalarType`,n.scalarType=r,n}(e)}}function Om(e){return e>=10}function km(e){return e===30}function Am(e){if(e.type===`scalarType`){let t=e.scalarType;if(t.type===`physicalType`)switch(t.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(t.type===`logicalType`)return!1}else if(e.type===`complexType`){let t=e.complexType;if(t.type===`physicalType`)switch(t.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn(`Unexpected column type in hasStreamCount`,e),!1}function jm(e){return e.type===`complexType`&&e.complexType?.type===`physicalType`&&e.complexType.physicalType===0}let Mm=new TextDecoder;function Nm(e,t){let n=yp(e,t,1)[0];if(n===0)return``;let r=t.get(),i=e.subarray(r,r+n);return t.add(n),Mm.decode(i)}function Pm(e,t){let n=yp(e,t,1)[0]>>>0;if(n<10||n>30)throw Error(`Unsupported field type code ${n}. Supported: 10-29(scalars), 30(STRUCT)`);let r=Dm(n);if(Om(n)&&(r.name=Nm(e,t)),km(n)){let n=yp(e,t,1)[0]>>>0;r.complexType.children=Array(n);for(let i=0;i<n;i++)r.complexType.children[i]=Pm(e,t)}return function(e){return{name:e.name,nullable:e.nullable,scalarField:e.scalarType,complexField:e.complexType,type:e.type===`scalarType`?`scalarField`:`complexField`}}(r)}function Fm(e,t){let n=yp(e,t,1)[0]>>>0,r=Dm(n);if(!r)throw Error(`Unsupported column type code ${n}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(Om(n)?r.name=Nm(e,t):n>=0&&n<=3?r.name=`id`:n===4&&(r.name=`geometry`),km(n)){let n=yp(e,t,1)[0]>>>0,i=r.complexType;i.children=Array(n);for(let r=0;r<n;r++)i.children[r]=Pm(e,t)}return r}function Im(e,t){let n={featureTables:[]},r={};r.name=Nm(e,t);let i=yp(e,t,1)[0]>>>0,a=yp(e,t,1)[0]>>>0;r.columns=Array(a);for(let n=0;n<a;n++)r.columns[n]=Fm(e,t);return n.featureTables.push(r),[n,i]}function Lm(e,t,n,r,i,a,o=!1){let s=t.scalarType;if(!s||s.type!==`logicalType`||s.logicalType!==0)throw Error(`ID column must be a logical ID scalar type: ${r}`);let c=s.longID?6:4,l=typeof a==`number`?void 0:a,u=Zp(i,a,e,n,c===6?`int64`:`int32`);if(c===4)switch(u){case Fp.FLAT:return new $f(r,Up(e,n,i,0,l),a);case Fp.SEQUENCE:{let t=qp(e,n,i);return new np(r,t[0],t[1],i.numRleValues)}case Fp.CONST:return new rp(r,Kp(e,n,i),a,!1)}switch(u){case Fp.FLAT:return o?new ep(r,function(e,t,n){return function(e,t){switch(t.logicalLevelTechnique1){case Q.DELTA:return t.logicalLevelTechnique2===Q.RLE&&(e=Dp(e,t.runs,t.numRleValues)),function(e){e[0]=wp(e[0]);let t=e.length/4*4,n=1;if(t>=4)for(;n<t-4;n+=4){let t=e[n+1],r=e[n+2],i=e[n+3];e[n]=wp(e[n])+e[n-1],e[n+1]=wp(t)+e[n],e[n+2]=wp(r)+e[n+1],e[n+3]=wp(i)+e[n+2]}for(;n!==e.length;++n)e[n]=wp(e[n])+e[n-1]}(e),e;case Q.RLE:return function(e,t){return Dp(e,t.runs,t.numRleValues)}(e,t);case Q.NONE:return e;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}}(function(e,t,n){let r=new Float64Array(n);for(let i=0;i<n;i++)r[i]=Sp(e,t);return r}(e,t,n.numValues),n)}(e,n,i),a):new Qp(r,Yp(e,n,i,l),a);case Fp.SEQUENCE:{let t=Jp(e,n,i);return new $p(r,t[0],t[1],i.numRleValues)}case Fp.CONST:return new _m(r,Xp(e,n,i),a,!1)}throw Error(`Vector type not supported for id column.`)}class Rm{constructor(e,t){switch(this._featureData=e,this.properties=this._featureData.properties||{},this._featureData.geometry?.type){case Ip.POINT:case Ip.MULTIPOINT:this.type=1;break;case Ip.LINESTRING:case Ip.MULTILINESTRING:this.type=2;break;case Ip.POLYGON:case Ip.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}loadGeometry(){let e=[];for(let t of this._featureData.geometry.coordinates){let r=[];for(let e of t)r.push(new n(e.x,e.y));e.push(r)}return e}}class zm{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new Rm(this.features[e],this.extent)}}class Bm{constructor(e){this.layers={};let t=function(e,t,n=!0){let r=new ap(0),i=[];for(;r.get()<e.length;){let t=yp(e,r,1)[0]>>>0,o=r.get()+t;if(o>e.length)throw Error(`Block overruns tile: ${o} > ${e.length}`);if(yp(e,r,1)[0]>>>0!=1){r.set(o);continue}let[s,c]=Im(e,r),l=s.featureTables[0],u=null,d=null,f=[],p=0;for(let t of l.columns){let i=t.name;if((a=t).type===`scalarType`&&a.scalarType?.type===`logicalType`&&a.scalarType.logicalType===0){let a=null;if(t.nullable){let t=zp(e,r),n=r.get(),i=vm(e,t.numValues,t.byteLength,r);r.set(n+t.byteLength),a=new Bp(i,t.numValues)}let o=zp(e,r);p=a?a.size():o.decompressedCount,u=Lm(e,t,r,i,o,a??p,n)}else if(jm(t)){let t=yp(e,r,1)[0];if(p===0){let t=r.get();p=zp(e,r).decompressedCount,r.set(t)}d=fm(e,t,r,p)}else{let n=Am(t)?yp(e,r,1)[0]:1;if(n===0)continue;let i=Tm(e,r,t,n,p);if(i)if(Array.isArray(i))for(let e of i)f.push(e);else f.push(i)}}let m=new ip(l.name,d,u,f,c);i.push(m),r.set(o)}var a;return i}(new Uint8Array(e));this.layers=t.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.name]:new zm(t)})),{})}}class Vm{constructor(e,t){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=t,`id`in e&&(typeof e.id==`string`?this.id=parseInt(e.id,10):typeof e.id!=`number`||isNaN(e.id)||(this.id=e.id))}loadGeometry(){let e=[],t=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(let r of t){let t=[];for(let e of r)t.push(new n(e[0],e[1]));e.push(t)}return e}}let Hm=`_geojsonTileLayer`;function Um(e,t,n=``){t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||``),t.writeVarintField(5,e.extent||4096);let r={jsonPrefix:n,keys:[],values:[],keycache:{},valuecache:{}};for(let n=0;n<e.length;n++)r.feature=e.feature(n),t.writeMessage(2,Wm,r);let i=r.keys;for(let e of i)t.writeStringField(3,e);let a=r.values;for(let e of a)t.writeMessage(4,Ym,e)}function Wm(e,t){if(!e.feature)return;let n=e.feature;n.id!==void 0&&t.writeVarintField(1,n.id),t.writeMessage(2,Gm,e),t.writeVarintField(3,n.type),t.writeMessage(4,Jm,n)}function Gm(e,t){for(let n in e.feature?.properties){let r=e.feature.properties[n],i=e.keycache[n];if(r==null)continue;i===void 0&&(e.keys.push(n),i=e.keys.length-1,e.keycache[n]=i),t.writeVarint(i),typeof r!=`string`&&typeof r!=`boolean`&&typeof r!=`number`&&(r=e.jsonPrefix+JSON.stringify(r));let a=typeof r+`:`+r,o=e.valuecache[a];o===void 0&&(e.values.push(r),o=e.values.length-1,e.valuecache[a]=o),t.writeVarint(o)}}function Km(e,t){return(t<<3)+(7&e)}function qm(e){return e<<1^e>>31}function Jm(e,t){let n=e.loadGeometry(),r=e.type,i=0,a=0;for(let o of n){let n=1;r===1&&(n=o.length),t.writeVarint(Km(1,n));let s=r===3?o.length-1:o.length;for(let e=0;e<s;e++){e===1&&r!==1&&t.writeVarint(Km(2,s-1));let n=o[e].x-i,c=o[e].y-a;t.writeVarint(qm(n)),t.writeVarint(qm(c)),i+=n,a+=c}e.type===3&&t.writeVarint(Km(7,1))}}function Ym(e,t){let n=typeof e;n===`string`?t.writeStringField(1,e):n===`boolean`?t.writeBooleanField(7,e):n===`number`&&(e%1==0?e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e):t.writeDoubleField(3,e))}class Xm{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ha(O,16,0),this.grid3D=new ha(O,16,0),this.featureIndexArray=new Wo,this.promoteId=t}insert(e,t,n,r,i,a){let o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,r,i);let s=a?this.grid3D:this.grid;for(let e of t){let t=[1/0,1/0,-1/0,-1/0];for(let n of e)t[0]=Math.min(t[0],n.x),t[1]=Math.min(t[1],n.y),t[2]=Math.max(t[2],n.x),t[3]=Math.max(t[3],n.y);t[0]<O&&t[1]<O&&t[2]>=0&&t[3]>=0&&s.insert(o,t[0],t[1],t[2],t[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=this.encoding===`mlt`?new Bm(this.rawTileData).layers:new Ll(new Pd(this.rawTileData)).layers,this.sourceLayerCoder=new Yf(this.vtLayers?Object.keys(this.vtLayers).sort():[Hm])),this.vtLayers}query(e,t,r,i){this.loadVTLayers();let a=e.params,o=O/e.tileSize/e.scale,s=vi(a.filter,a.globalState),c=e.queryGeometry,l=e.queryPadding*o,u=Jf.fromPoints(c),d=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),f=Jf.fromPoints(e.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(f.minX,f.minY,f.maxX,f.maxY,((t,r,i,a)=>function(e,t,r,i,a){for(let n of e)if(t<=n.x&&r<=n.y&&i>=n.x&&a>=n.y)return!0;let o=[new n(t,r),new n(t,a),new n(i,a),new n(i,r)];if(e.length>2){for(let t of o)if(tc(e,t))return!0}for(let t=0;t<e.length-1;t++)if(nc(e[t],e[t+1],o))return!0;return!1}(e.cameraQueryGeometry,t-l,r-l,i+l,a+l)));for(let e of p)d.push(e);d.sort(Qm);let m={},h;for(let n of d){if(n===h)continue;h=n;let l=this.featureIndexArray.get(n),u=null;this.loadMatchingFeature(m,l.bucketIndex,l.sourceLayerIndex,l.featureIndex,s,a.layers,a.availableImages,t,r,i,((t,n,r)=>(u||=Vs(t),n.queryIntersectsFeature({queryGeometry:c,feature:t,featureState:r,geometry:u,zoom:this.z,transform:e.transform,pixelsToTileUnits:o,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return m}loadMatchingFeature(e,t,n,r,i,a,o,s,c,l,u){let d=this.bucketLayerIDs[t];if(a&&!d.some((e=>a.has(e))))return;let f=this.sourceLayerCoder.decode(n),p=this.vtLayers[f].feature(r);if(i.needGeometry){let e=Hs(p,!0);if(!i.filter(new Y(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!i.filter(new Y(this.tileID.overscaledZ),p))return;let m=this.getId(p,f);for(let t of d){if(a&&!a.has(t))continue;let n=s[t];if(!n)continue;let i={};m&&l&&(i=l.getState(n.sourceLayer||Hm,m));let d=oe({},c[t]);d.paint=Zm(d.paint,n.paint,p,i,o),d.layout=Zm(d.layout,n.layout,p,i,o);let f=!u||u(p,n,i);if(!f)continue;let h=new Xf(p,this.z,this.x,this.y,m);h.layer=d;let g=e[t];g===void 0&&(g=e[t]=[]),g.push({featureIndex:r,feature:h,intersectionZ:f})}}lookupSymbolFeatures(e,t,n,r,i,a,o,s){let c={};this.loadVTLayers();let l=vi(i.filterSpec,i.globalState);for(let i of e)this.loadMatchingFeature(c,n,r,i,l,a,o,s,t);return c}hasLayer(e){for(let t of this.bucketLayerIDs)for(let n of t)if(e===n)return!0;return!1}getId(e,t){var n;let r=e.id;return this.promoteId&&(r=e.properties[typeof this.promoteId==`string`?this.promoteId:this.promoteId[t]],typeof r==`boolean`&&(r=Number(r)),r===void 0&&(n=e.properties)!=null&&n.cluster&&this.promoteId&&(r=Number(e.properties.cluster_id))),r}}function Zm(e,t,n,r,i){return ce(e,((e,a)=>{let o=t instanceof Ka?t.get(a):null;return o?.evaluate?o.evaluate(n,r,i):o}))}function Qm(e,t){return t-e}function $m(e,t,r,i,a){let o=[];for(let s of e){let e;for(let c=0;c<s.length-1;c++){let l=s[c],u=s[c+1];l.x<t&&u.x<t||(l.x<t?l=new n(t,l.y+(t-l.x)/(u.x-l.x)*(u.y-l.y))._round():u.x<t&&(u=new n(t,l.y+(t-l.x)/(u.x-l.x)*(u.y-l.y))._round()),l.y<r&&u.y<r||(l.y<r?l=new n(l.x+(r-l.y)/(u.y-l.y)*(u.x-l.x),r)._round():u.y<r&&(u=new n(l.x+(r-l.y)/(u.y-l.y)*(u.x-l.x),r)._round()),l.x>=i&&u.x>=i||(l.x>=i?l=new n(i,l.y+(i-l.x)/(u.x-l.x)*(u.y-l.y))._round():u.x>=i&&(u=new n(i,l.y+(i-l.x)/(u.x-l.x)*(u.y-l.y))._round()),l.y>=a&&u.y>=a||(l.y>=a?l=new n(l.x+(a-l.y)/(u.y-l.y)*(u.x-l.x),a)._round():u.y>=a&&(u=new n(l.x+(a-l.y)/(u.y-l.y)*(u.x-l.x),a)._round()),e&&l.equals(e[e.length-1])||(e=[l],o.push(e)),e.push(u)))))}}return o}function eh(e,t,n,r,i){switch(t){case 1:return function(e,t,n,r){let i=[];for(let a of e)for(let e of a){let a=r===0?e.x:e.y;a>=t&&a<=n&&i.push([e])}return i}(e,n,r,i);case 2:return nh(e,n,r,i,!1);case 3:return nh(e,n,r,i,!0)}return[]}function th(e,t,r,i,a){let o=i===0?rh:ih,s=[],c=[];for(let n=0;n<e.length-1;n++){let l=e[n],u=e[n+1],d=i===0?l.x:l.y,f=i===0?u.x:u.y,p=!1;d<t?f>t&&s.push(o(l,u,t)):d>r?f<r&&s.push(o(l,u,r)):s.push(l),f<t&&d>=t&&(s.push(o(l,u,t)),p=!0),f>r&&d<=r&&(s.push(o(l,u,r)),p=!0),!a&&p&&(c.push(s),s=[])}let l=e.length-1,u=i===0?e[l].x:e[l].y;return u>=t&&u<=r&&s.push(e[l]),a&&s.length>0&&!s[0].equals(s[s.length-1])&&s.push(new n(s[0].x,s[0].y)),s.length>0&&c.push(s),c}function nh(e,t,n,r,i){let a=[];for(let o of e){let e=th(o,t,n,r,i);e.length>0&&a.push(...e)}return a}function rh(e,t,r){return new n(r,e.y+(r-e.x)/(t.x-e.x)*(t.y-e.y))}function ih(e,t,r){return new n(e.x+(r-e.y)/(t.y-e.y)*(t.x-e.x),r)}J(`FeatureIndex`,Xm,{omit:[`rawTileData`,`sourceLayerCoder`]});class ah extends n{constructor(e,t,n,r){super(e,t),this.angle=n,r!==void 0&&(this.segment=r)}clone(){return new ah(this.x,this.y,this.angle,this.segment)}}function oh(e,t,n,r,i){if(t.segment===void 0||n===0)return!0;let a=t,o=t.segment+1,s=0;for(;s>-n/2;){if(o--,o<0)return!1;s-=e[o].dist(a),a=e[o]}s+=e[o].dist(e[o+1]),o++;let c=[],l=0;for(;s<n/2;){let t=e[o],n=e[o+1];if(!n)return!1;let a=e[o-1].angleTo(t)-t.angleTo(n);for(a=Math.abs((a+3*Math.PI)%(2*Math.PI)-Math.PI),c.push({distance:s,angleDelta:a}),l+=a;s-c[0].distance>r;)l-=c.shift().angleDelta;if(l>i)return!1;o++,s+=t.dist(n)}return!0}function sh(e){let t=0;for(let n=0;n<e.length-1;n++)t+=e[n].dist(e[n+1]);return t}function ch(e,t,n){return e?.6*t*n:0}function lh(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function uh(e,t,n,r,i,a){let o=ch(n,i,a),s=lh(n,r)*a,c=0,l=sh(e)/2;for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1],a=r.dist(i);if(c+a>l){let u=(l-c)/a,d=new ah(Cn.number(r.x,i.x,u),Cn.number(r.y,i.y,u),i.angleTo(r),n);return d._round(),!o||oh(e,d,s,o,t)?d:void 0}c+=a}}function dh(e,t,n,r,i,a,o,s,c){let l=ch(r,a,o),u=lh(r,i),d=u*o,f=e[0].x===0||e[0].x===c||e[0].y===0||e[0].y===c;return t-d<t/4&&(t=d+t/4),fh(e,f?t/2*s%t:(u/2+2*a)*o*s%t,t,l,n,d,f,!1,c)}function fh(e,t,n,r,i,a,o,s,c){let l=a/2,u=sh(e),d=0,f=t-n,p=[];for(let t=0;t<e.length-1;t++){let o=e[t],s=e[t+1],m=o.dist(s),h=s.angleTo(o);for(;f+n<d+m;){f+=n;let g=(f-d)/m,_=Cn.number(o.x,s.x,g),v=Cn.number(o.y,s.y,g);if(_>=0&&_<c&&v>=0&&v<c&&f-l>=0&&f+l<=u){let n=new ah(_,v,h,t);n._round(),r&&!oh(e,n,a,r,i)||p.push(n)}}d+=m}return s||p.length||o||(p=fh(e,d/2,n,r,i,a,o,!0,c)),p}function ph(e,t,r,i){let a=[],o=e.image,s=o.pixelRatio,c=o.paddedRect.w-2,l=o.paddedRect.h-2,u={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom},d=o.stretchX||[[0,c]],f=o.stretchY||[[0,l]],p=(e,t)=>e+t[1]-t[0],m=d.reduce(p,0),h=f.reduce(p,0),g=c-m,_=l-h,v=0,y=m,b=0,x=h,S=0,C=g,w=0,T=_;if(o.content&&i){let t=o.content,n=t[2]-t[0],r=t[3]-t[1];(o.textFitWidth||o.textFitHeight)&&(u=lf(e)),v=mh(d,0,t[0]),b=mh(f,0,t[1]),y=mh(d,t[0],t[2]),x=mh(f,t[1],t[3]),S=t[0]-v,w=t[1]-b,C=n-y,T=r-x}let E=u.x1,D=u.y1,O=u.x2-E,k=u.y2-D,A=(e,i,a,c)=>{let l=gh(e.stretch-v,y,O,E),u=_h(e.fixed-S,C,e.stretch,m),d=gh(i.stretch-b,x,k,D),f=_h(i.fixed-w,T,i.stretch,h),p=gh(a.stretch-v,y,O,E),g=_h(a.fixed-S,C,a.stretch,m),_=gh(c.stretch-b,x,k,D),A=_h(c.fixed-w,T,c.stretch,h),ee=new n(l,d),te=new n(p,d),j=new n(p,_),ne=new n(l,_),re=new n(u/s,f/s),ie=new n(g/s,A/s),ae=t*Math.PI/180;if(ae){let e=Math.sin(ae),t=Math.cos(ae),n=[t,-e,e,t];ee._matMult(n),te._matMult(n),ne._matMult(n),j._matMult(n)}let oe=e.stretch+e.fixed,se=i.stretch+i.fixed;return{tl:ee,tr:te,bl:ne,br:j,tex:{x:o.paddedRect.x+1+oe,y:o.paddedRect.y+1+se,w:a.stretch+a.fixed-oe,h:c.stretch+c.fixed-se},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:re,pixelOffsetBR:ie,minFontScaleX:C/s/O,minFontScaleY:T/s/k,isSDF:r}};if(i&&(o.stretchX||o.stretchY)){let e=hh(d,g,m),t=hh(f,_,h);for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1];for(let e=0;e<t.length-1;e++)a.push(A(r,t[e],i,t[e+1]))}}else a.push(A({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:c+1},{fixed:0,stretch:l+1}));return a}function mh(e,t,n){let r=0;for(let i of e)r+=Math.max(t,Math.min(n,i[1]))-Math.max(t,Math.min(n,i[0]));return r}function hh(e,t,n){let r=[{fixed:-1,stretch:0}];for(let[t,n]of e){let e=r[r.length-1];r.push({fixed:t-e.stretch,stretch:e.stretch}),r.push({fixed:t-e.stretch,stretch:e.stretch+(n-t)})}return r.push({fixed:t+1,stretch:n}),r}function gh(e,t,n,r){return e/t*n+r}function _h(e,t,n,r){return e-t*n/r}J(`Anchor`,ah);class vh{constructor(e,t,r,i,a,o,s,c,l,u){if(this.boxStartIndex=e.length,l){let e=o.top,t=o.bottom,n=o.collisionPadding;n&&(e-=n[1],t+=n[3]);let r=t-e;r>0&&(r=Math.max(10,r),this.circleDiameter=r)}else{let l=o.image?.content&&(o.image.textFitWidth||o.image.textFitHeight)?lf(o):{x1:o.left,y1:o.top,x2:o.right,y2:o.bottom};l.y1=l.y1*s-c[0],l.y2=l.y2*s+c[2],l.x1=l.x1*s-c[3],l.x2=l.x2*s+c[1];let d=o.collisionPadding;if(d&&(l.x1-=d[0]*s,l.y1-=d[1]*s,l.x2+=d[2]*s,l.y2+=d[3]*s),u){let e=new n(l.x1,l.y1),t=new n(l.x2,l.y1),r=new n(l.x1,l.y2),i=new n(l.x2,l.y2),a=u*Math.PI/180;e._rotate(a),t._rotate(a),r._rotate(a),i._rotate(a),l.x1=Math.min(e.x,t.x,r.x,i.x),l.x2=Math.max(e.x,t.x,r.x,i.x),l.y1=Math.min(e.y,t.y,r.y,i.y),l.y2=Math.max(e.y,t.y,r.y,i.y)}e.emplaceBack(t.x,t.y,l.x1,l.y1,l.x2,l.y2,r,i,a)}this.boxEndIndex=e.length}}class yh{constructor(e=[],t=(e,t)=>e<t?-1:+(e>t)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:n}=this,r=t[e];for(;e>0;){let i=e-1>>1,a=t[i];if(n(r,a)>=0)break;t[e]=a,e=i}t[e]=r}_down(e){let{data:t,compare:n}=this,r=this.length>>1,i=t[e];for(;e<r;){let r=1+(e<<1),a=r+1;if(a<this.length&&n(t[a],t[r])<0&&(r=a),n(t[r],i)>=0)break;t[e]=t[r],e=r}t[e]=i}}function bh(e,t=1){let r=Jf.fromPoints(e[0]),i=Math.min(r.width(),r.height()),a=i/2,o=new yh([],xh),{minX:s,minY:c,maxX:l,maxY:u}=r;if(i===0)return new n(s,c);for(let t=s;t<l;t+=i)for(let n=c;n<u;n+=i)o.push(new Sh(t+a,n+a,a,e));let d=function(e){let t=0,n=0,r=0,i=e[0];for(let e=0,a=i.length,o=a-1;e<a;o=e++){let a=i[e],s=i[o],c=a.x*s.y-s.x*a.y;n+=(a.x+s.x)*c,r+=(a.y+s.y)*c,t+=3*c}return new Sh(n/t,r/t,0,e)}(e),f=d;for(;o.length;){let n=o.pop();(n.d>f.d||!f.d)&&(f=n),n.max-f.d<=t||(a=n.h/2,o.push(new Sh(n.p.x-a,n.p.y-a,a,e)),o.push(new Sh(n.p.x+a,n.p.y-a,a,e)),o.push(new Sh(n.p.x-a,n.p.y+a,a,e)),o.push(new Sh(n.p.x+a,n.p.y+a,a,e)))}return d.d>0&&f.d-d.d<=t?d.p:f.p}function xh(e,t){return t.max-e.max}class Sh{constructor(e,t,r,i){this.p=new n(e,t),this.h=r,this.d=function(e,t){let n=!1,r=1/0;for(let i of t)for(let t=0,a=i.length,o=a-1;t<a;o=t++){let a=i[t],s=i[o];a.y>e.y!=s.y>e.y&&e.x<(s.x-a.x)*(e.y-a.y)/(s.y-a.y)+a.x&&(n=!n),r=Math.min(r,$s(e,a,s))}return(n?1:-1)*Math.sqrt(r)}(this.p,i),this.max=this.d+this.h*Math.SQRT2}}var Ch;e.aM=void 0,(Ch=e.aM||={})[Ch.center=1]=`center`,Ch[Ch.left=2]=`left`,Ch[Ch.right=3]=`right`,Ch[Ch.top=4]=`top`,Ch[Ch.bottom=5]=`bottom`,Ch[Ch[`top-left`]=6]=`top-left`,Ch[Ch[`top-right`]=7]=`top-right`,Ch[Ch[`bottom-left`]=8]=`bottom-left`,Ch[Ch[`bottom-right`]=9]=`bottom-right`;let wh=1/0;function Th(e,t){return t[1]===wh?function(e,t){let n=0,r=0;t<0&&(t=0);let i=t/Math.SQRT2;switch(e){case`top-right`:case`top-left`:r=i-7;break;case`bottom-right`:case`bottom-left`:r=7-i;break;case`bottom`:r=7-t;break;case`top`:r=t-7}switch(e){case`top-right`:case`bottom-right`:n=-i;break;case`top-left`:case`bottom-left`:n=i;break;case`left`:n=t;break;case`right`:n=-t}return[n,r]}(e,t[0]):function(e,t,n){let r=0,i=0;switch(t=Math.abs(t),n=Math.abs(n),e){case`top-right`:case`top-left`:case`top`:i=n-7;break;case`bottom-right`:case`bottom-left`:case`bottom`:i=7-n}switch(e){case`top-right`:case`bottom-right`:case`right`:r=-t;break;case`top-left`:case`bottom-left`:case`left`:r=t}return[r,i]}(e,t[0],t[1])}function Eh(e,t,n){let r=e.layout,i=r.get(`text-variable-anchor-offset`)?.evaluate(t,{},n);if(i){let e=i.values,t=[];for(let n=0;n<e.length;n+=2){let r=t[n]=e[n],i=e[n+1].map((e=>e*xd));r.startsWith(`top`)?i[1]-=7:r.startsWith(`bottom`)&&(i[1]+=7),t[n+1]=i}return new Jt(t)}let a=r.get(`text-variable-anchor`);if(a){let i;i=e._unevaluatedLayout.getValue(`text-radial-offset`)===void 0?r.get(`text-offset`).evaluate(t,{},n).map((e=>e*xd)):[r.get(`text-radial-offset`).evaluate(t,{},n)*xd,wh];let o=[];for(let e of a)o.push(e,Th(e,i));return new Jt(o)}return null}function Dh(e){switch(e){case`right`:case`top-right`:case`bottom-right`:return`right`;case`left`:case`top-left`:case`bottom-left`:return`left`}return`center`}function Oh(t,n,r,i,a,o,s,c,l,u,d,f){let p=o.textMaxSize.evaluate(n,{});p===void 0&&(p=s);let m=t.layers[0].layout,h=m.get(`icon-offset`).evaluate(n,{},d),g=Ah(r.horizontal),_=s/24,v=t.tilePixelRatio*_,y=t.tilePixelRatio*p/24,b=t.tilePixelRatio*c,x=t.tilePixelRatio*m.get(`symbol-spacing`),S=m.get(`text-padding`)*t.tilePixelRatio,C=function(e,t,n,r=1){let i=e.get(`icon-padding`).evaluate(t,{},n)?.values;return[i[0]*r,i[1]*r,i[2]*r,i[3]*r]}(m,n,d,t.tilePixelRatio),w=m.get(`text-max-angle`)/180*Math.PI,T=m.get(`text-rotation-alignment`)!==`viewport`&&m.get(`symbol-placement`)!==`point`,E=m.get(`icon-rotation-alignment`)===`map`&&m.get(`symbol-placement`)!==`point`,D=m.get(`symbol-placement`),k=x/2,A=m.get(`icon-text-fit`),ee;i&&A!==`none`&&(t.allowVerticalPlacement&&r.vertical&&(ee=uf(i,r.vertical,A,m.get(`icon-text-fit-padding`),h,_)),g&&(i=uf(i,g,A,m.get(`icon-text-fit-padding`),h,_)));let te=d?f.line.getGranularityForZoomLevel(d.z):1,j=(c,f)=>{f.x<0||f.x>=O||f.y<0||f.y>=O||function(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T){let E=t.addToLineVertexArray(n,r),D,O,k,A,ee=0,te=0,j=0,ne=0,re=-1,ie=-1,ae={},oe=_s(``);if(t.allowVerticalPlacement&&i.vertical){let e=c.layout.get(`text-rotate`).evaluate(x,{},w)+90;k=new vh(l,n,u,d,f,i.vertical,p,m,h,e),s&&(A=new vh(l,n,u,d,f,s,_,v,h,e))}if(a){let r=c.layout.get(`icon-rotate`).evaluate(x,{}),i=c.layout.get(`icon-text-fit`)!==`none`,o=ph(a,r,C,i),p=s?ph(s,r,C,i):void 0;O=new vh(l,n,u,d,f,a,_,v,!1,r),ee=4*o.length;let m=t.iconSizeData,h=null;m.kind===`source`?(h=[128*c.layout.get(`icon-size`).evaluate(x,{})],h[0]>df&&de(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):m.kind===`composite`&&(h=[128*S.compositeIconSizes[0].evaluate(x,{},w),128*S.compositeIconSizes[1].evaluate(x,{},w)],(h[0]>df||h[1]>df)&&de(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,o,h,b,y,x,e.ax.none,n,E.lineStartIndex,E.lineLength,-1,w),re=t.icon.placedSymbolArray.length-1,p&&(te=4*p.length,t.addSymbols(t.icon,p,h,b,y,x,e.ax.vertical,n,E.lineStartIndex,E.lineLength,-1,w),ie=t.icon.placedSymbolArray.length-1)}let se=Object.keys(i.horizontal);for(let r of se){let a=i.horizontal[r];D||=(oe=_s(a.text),new vh(l,n,u,d,f,a,p,m,h,c.layout.get(`text-rotate`).evaluate(x,{},w)));let s=a.positionedLines.length===1;if(j+=kh(t,n,a,o,c,h,x,g,E,i.vertical?e.ax.horizontal:e.ax.horizontalOnly,s?se:[r],ae,re,S,w),s)break}i.vertical&&(ne+=kh(t,n,i.vertical,o,c,h,x,g,E,e.ax.vertical,[`vertical`],ae,ie,S,w));let ce=D?D.boxStartIndex:t.collisionBoxArray.length,le=D?D.boxEndIndex:t.collisionBoxArray.length,M=k?k.boxStartIndex:t.collisionBoxArray.length,ue=k?k.boxEndIndex:t.collisionBoxArray.length,fe=O?O.boxStartIndex:t.collisionBoxArray.length,pe=O?O.boxEndIndex:t.collisionBoxArray.length,me=A?A.boxStartIndex:t.collisionBoxArray.length,he=A?A.boxEndIndex:t.collisionBoxArray.length,ge=-1,_e=(e,t)=>e?.circleDiameter?Math.max(e.circleDiameter,t):t;ge=_e(D,ge),ge=_e(k,ge),ge=_e(O,ge),ge=_e(A,ge);let ve=+(ge>-1);ve&&(ge*=T/xd),t.glyphOffsetArray.length>=bf.MAX_GLYPHS&&de(`Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907`),x.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey);let ye=Eh(c,x,w),[be,xe]=function(t,n){let r=t.length,i=n?.values;if(i?.length>0)for(let n=0;n<i.length;n+=2){let r=i[n+1];t.emplaceBack(e.aM[i[n]],r[0],r[1])}return[r,t.length]}(t.textAnchorOffsets,ye);t.symbolInstances.emplaceBack(n.x,n.y,ae.right>=0?ae.right:-1,ae.center>=0?ae.center:-1,ae.left>=0?ae.left:-1,ae.vertical||-1,re,ie,oe,ce,le,M,ue,fe,pe,me,he,u,j,ne,ee,te,ve,0,p,ge,be,xe)}(t,f,c,r,i,a,ee,t.layers[0],t.collisionBoxArray,n.index,n.sourceLayerIndex,t.index,v,[S,S,S,S],T,l,b,C,E,h,n,o,u,d,s)};if(D===`line`)for(let e of $m(n.geometry,0,0,O,O)){let n=yl(e,te),a=dh(n,x,w,r.vertical||g,i,24,y,t.overscaling,O);for(let e of a)g&&jh(t,g.text,k,e)||j(n,e)}else if(D===`line-center`){for(let e of n.geometry)if(e.length>1){let t=yl(e,te),n=uh(t,w,r.vertical||g,i,24,y);n&&j(t,n)}}else if(n.type===`Polygon`)for(let e of cr(n.geometry,0)){let t=bh(e,16);j(yl(e[0],te,!0),new ah(t.x,t.y,0))}else if(n.type===`LineString`)for(let e of n.geometry){let t=yl(e,te);j(t,new ah(t[0].x,t[0].y,0))}else if(n.type===`Point`)for(let e of n.geometry)for(let t of e)j([t],new ah(t.x,t.y,0))}function kh(e,t,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=function(e,t,r,i,a,o,s,c){let l=i.layout.get(`text-rotate`).evaluate(o,{})*Math.PI/180,u=[];for(let e of t.positionedLines)for(let i of e.positionedGlyphs){if(!i.rect)continue;let o=i.rect||{},d=4,f=!0,p=1,m=0,h=(a||c)&&i.vertical,g=i.metrics.advance*i.scale/2;if(c&&t.verticalizable&&(m=e.lineOffset/2-(i.imageName?-(xd-i.metrics.width*i.scale)/2:(i.scale-1)*xd)),i.imageName){let e=s[i.imageName];f=e.sdf,p=e.pixelRatio,d=1/p}let _=a?[i.x+g,i.y]:[0,0],v=a?[0,0]:[i.x+g+r[0],i.y+r[1]-m],y=[0,0];h&&(y=v,v=[0,0]);let b=i.metrics.isDoubleResolution?2:1,x=(i.metrics.left-d)*i.scale-g+v[0],S=(-i.metrics.top-d)*i.scale+v[1],C=x+o.w/b*i.scale/p,w=S+o.h/b*i.scale/p,T=new n(x,S),E=new n(C,S),D=new n(x,w),O=new n(C,w);if(h){let e=new n(-g,g- -17),t=-Math.PI/2,r=12-g,a=new n(22-r,-(i.imageName?r:0)),o=new n(...y);T._rotateAround(t,e)._add(a)._add(o),E._rotateAround(t,e)._add(a)._add(o),D._rotateAround(t,e)._add(a)._add(o),O._rotateAround(t,e)._add(a)._add(o)}if(l){let e=Math.sin(l),t=Math.cos(l),n=[t,-e,e,t];T._matMult(n),E._matMult(n),D._matMult(n),O._matMult(n)}let k=new n(0,0),A=new n(0,0);u.push({tl:T,tr:E,bl:D,br:O,tex:o,writingMode:t.writingMode,glyphOffset:_,sectionIndex:i.sectionIndex,isSDF:f,pixelOffsetTL:k,pixelOffsetBR:A,minFontScaleX:0,minFontScaleY:0})}return u}(0,r,c,a,o,s,i,e.allowVerticalPlacement),_=e.textSizeData,v=null;_.kind===`source`?(v=[128*a.layout.get(`text-size`).evaluate(s,{})],v[0]>df&&de(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):_.kind===`composite`&&(v=[128*m.compositeTextSizes[0].evaluate(s,{},h),128*m.compositeTextSizes[1].evaluate(s,{},h)],(v[0]>df||v[1]>df)&&de(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,g,v,c,o,s,u,t,l.lineStartIndex,l.lineLength,p,h);for(let t of d)f[t]=e.text.placedSymbolArray.length-1;return 4*g.length}function Ah(e){for(let t in e)return e[t];return null}function jh(e,t,n,r){let i=e.compareText;if(t in i){let e=i[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])<n)return!0}else i[t]=[];return i[t].push(r),!1}e.$=De,e.A=f,e.B=Ra,e.C=ma,e.D=X,e.E=Be,e.F=la,e.G=function([e,t,n]){return t+=90,t*=Math.PI/180,n*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(n),y:e*Math.sin(t)*Math.sin(n),z:e*Math.cos(n)}},e.H=Cn,e.I=Xd,e.J=Y,e.K=da,e.L=function(e){if(me==null){let t=e.navigator?e.navigator.userAgent:null;me=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match(`Safari`)&&!t.match(`Chrome`)))}return me},e.M=je,e.N=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Af((()=>this.process())),this.subscription=be(this.target,`message`,(e=>this.receive(e)),!1),this.globalScope=pe(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}unregisterMessageHandler(e){delete this.messageHandlers[e]}sendAsync(e,t){return new Promise(((n,r)=>{let i=Math.round(0xde0b6b3a7640000*Math.random()).toString(36).substring(0,10),a=t?be(t.signal,`abort`,(()=>{a?.unsubscribe(),delete this.resolveRejects[i];let t={id:i,type:`<cancel>`,origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(t)}),jf):null;this.resolveRejects[i]={resolve:e=>{a?.unsubscribe(),n(e)},reject:e=>{a?.unsubscribe(),r(e)}};let o=[],s=Object.assign(Object.assign({},e),{id:i,sourceMapId:this.mapId,origin:location.origin,data:ba(e.data,o)});this.target.postMessage(s,{transfer:o})}))}receive(e){let t=e.data,n=t.id,r=[`file://`,`resource://android`,`null`],i=[t.origin,location.origin],a=t.origin===location.origin,o=i.some((e=>r.includes(e)));if((a||o)&&(!t.targetMapId||this.mapId===t.targetMapId)){if(t.type===`<cancel>`){delete this.tasks[n];let e=this.abortControllers[n];delete this.abortControllers[n],e&&e.abort();return}if(pe(self)||t.mustQueue)return this.tasks[n]=t,this.taskQueue.push(n),void this.invoker.trigger();this.processTask(n,t)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}processTask(e,n){return t(this,void 0,void 0,(function*(){if(n.type===`<response>`){let t=this.resolveRejects[e];if(delete this.resolveRejects[e],!t)return;n.error?t.reject(A(xa(n.error))):t.resolve(xa(n.data));return}if(!this.messageHandlers[n.type])return void this.completeTask(e,Error(`Could not find a registered handler for ${n.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(`, `)}`));let t=xa(n.data),r=new AbortController;this.abortControllers[e]=r;try{let i=yield this.messageHandlers[n.type](n.sourceMapId,t,r);this.completeTask(e,null,i)}catch(t){this.completeTask(e,A(t))}}))}completeTask(e,t,n){let r=[];delete this.abortControllers[e];let i={id:e,type:`<response>`,sourceMapId:this.mapId,origin:location.origin,error:t?ba(t):null,data:ba(n,r)};this.target.postMessage(i,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},e.O=function(){var e=new f(16);return f!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.P=n,e.Q=function(e,t,n){var r,i,a,o,s,c,l,u,d,f,p,m,h=n[0],g=n[1],_=n[2];return t===e?(e[12]=t[0]*h+t[4]*g+t[8]*_+t[12],e[13]=t[1]*h+t[5]*g+t[9]*_+t[13],e[14]=t[2]*h+t[6]*g+t[10]*_+t[14],e[15]=t[3]*h+t[7]*g+t[11]*_+t[15]):(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],e[0]=r=t[0],e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=c,e[6]=l,e[7]=u,e[8]=d,e[9]=f,e[10]=p,e[11]=m,e[12]=r*h+s*g+d*_+t[12],e[13]=i*h+c*g+f*_+t[13],e[14]=a*h+l*g+p*_+t[14],e[15]=o*h+u*g+m*_+t[15]),e},e.R=wc,e.S=function(e,t,n){var r=n[0],i=n[1],a=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.T=Fc,e.U=function(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=n[0],b=n[1],x=n[2],S=n[3];return e[0]=y*r+b*s+x*d+S*h,e[1]=y*i+b*c+x*f+S*g,e[2]=y*a+b*l+x*p+S*_,e[3]=y*o+b*u+x*m+S*v,e[4]=(y=n[4])*r+(b=n[5])*s+(x=n[6])*d+(S=n[7])*h,e[5]=y*i+b*c+x*f+S*g,e[6]=y*a+b*l+x*p+S*_,e[7]=y*o+b*u+x*m+S*v,e[8]=(y=n[8])*r+(b=n[9])*s+(x=n[10])*d+(S=n[11])*h,e[9]=y*i+b*c+x*f+S*g,e[10]=y*a+b*l+x*p+S*_,e[11]=y*o+b*u+x*m+S*v,e[12]=(y=n[12])*r+(b=n[13])*s+(x=n[14])*d+(S=n[15])*h,e[13]=y*i+b*c+x*f+S*g,e[14]=y*a+b*l+x*p+S*_,e[15]=y*o+b*u+x*m+S*v,e},e.V=function(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n},e.W=Nf,e.X=ae,e.Y=Lf,e.Z=If,e._=t,e.a=Ee,e.a$=function(e){var t=new f(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},e.a0=l,e.a1=u,e.a2=_e,e.a3=Kf,e.a4=zf,e.a5=Bf,e.a6=O,e.a7=Hf,e.a8=Jf,e.a9=25,e.aA=function(e){var t=e[0],n=e[1];return Math.sqrt(t*t+n*n)},e.aB=function(e){return e[0]=0,e[1]=0,e},e.aC=function(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e},e.aD=gf,e.aE=C,e.aF=function(e,t,r,i){let a=t.y-e.y,o=t.x-e.x,s=i.y-r.y,c=i.x-r.x,l=s*o-c*a;if(l===0)return null;let u=(c*(e.y-r.y)-s*(e.x-r.x))/l;return new n(e.x+u*o,e.y+u*a)},e.aG=$m,e.aH=Ks,e.aI=function(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x),i=Math.max(i,a.y);return[t,n,r,i]},e.aJ=xd,e.aK=k,e.aL=function(e,t,n,r,i=!1){if(!n[0]&&!n[1])return[0,0];let a=i?r===`map`?-e.bearingInRadians:0:r===`viewport`?e.bearingInRadians:0;if(a){let e=Math.sin(a),t=Math.cos(a);n=[n[0]*t-n[1]*e,n[0]*e+n[1]*t]}return[i?n[0]:k(t,n[0],e.zoom),i?n[1]:k(t,n[1],e.zoom)]},e.aN=pf,e.aO=Dh,e.aP=ef,e.aQ=e=>e.type===`symbol`,e.aR=Zl,e.aS=oo,e.aT=ml,e.aU=Go,e.aV=ss,e.aW=is,e.aX=Se,e.aY=Vf,e.aZ=y,e.a_=v,e.aa=Wf,e.ab=e=>{let t=window.document.createElement(`video`);return t.muted=!0,new Promise((n=>{t.onloadstart=()=>{n(t)};for(let n of e){let e=window.document.createElement(`source`);Fe(n)||(t.crossOrigin=`Anonymous`),e.src=n,t.appendChild(e)}}))},e.ac=F,e.ad=function(){return se++},e.ae=Po,e.af=bf,e.ag=Hm,e.ah=vi,e.ai=Hs,e.aj=Xf,e.ak=function(e){let t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,n,r,i)=>{let a=r||i;return t[n]=!a||a.toLowerCase(),``})),t[`max-age`]){let e=parseInt(t[`max-age`],10);isNaN(e)?delete t[`max-age`]:t[`max-age`]=e}return t},e.al=ie,e.am=85.051129,e.an=xe,e.ao=function(e){return 2**e},e.ap=m,e.aq=Rf,e.ar=function(e){return Math.log(e)/Math.LN2},e.as=function(e){var t=e[0],n=e[1];return t*t+n*n},e.at=function(e){if(!e.length)return new Set;let t=Math.max(...e.map((e=>e.canonical.z))),n=1/0,r=-1/0,i=1/0,a=-1/0,o=[];for(let s of e){let{x:e,y:c,z:l}=s.canonical,u=2**(t-l),d=e*u,f=c*u;o.push({id:s,x:d,y:f}),d<n&&(n=d),d>r&&(r=d),f<i&&(i=f),f>a&&(a=f)}let s=new Set;for(let e of o)e.x!==n&&e.x!==r&&e.y!==i&&e.y!==a||s.add(e.id);return s},e.au=function(e,t){let n=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-n||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x},e.av=class{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(let e in this.data)for(let t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,n){let r=e.wrapped().key;this.data[r]===void 0&&(this.data[r]=[]);let i={value:t,timeout:void 0};if(n!==void 0&&(i.timeout=setTimeout((()=>{this.remove(e,i)}),n)),this.data[r].push(i),this.order.push(r),this.order.length>this.max){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let n=e.wrapped().key,r=t===void 0?0:this.data[n].indexOf(t),i=this.data[n][r];return this.data[n].splice(r,1),i.timeout&&clearTimeout(i.timeout),this.data[n].length===0&&delete this.data[n],this.onRemove(i.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){let t=[];for(let n in this.data)for(let r of this.data[n])e(r.value)||t.push(r);for(let e of t)this.remove(e.value.tileID,e)}},e.aw=function(e,t){let n=0,r=0;if(e.kind===`constant`)r=e.layoutSize;else if(e.kind!==`source`){let{interpolationType:i,minZoom:a,maxZoom:o}=e,s=i?ie(xn.interpolationFactor(i,t,a,o),0,1):0;e.kind===`camera`?r=Cn.number(e.minSize,e.maxSize,s):n=s}return{uSizeT:n,uSize:r}},e.ay=function(e,{uSize:t,uSizeT:n},{lowerSize:r,upperSize:i}){return e.kind===`source`?r/128:e.kind===`composite`?Cn.number(r/128,i/128,n):t},e.az=E,e.b=he,e.b$=Ts,e.b0=function(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e},e.b1=function(e,t){var n=t[0],r=t[1],i=t[2],a=n*n+r*r+i*i;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e},e.b2=b,e.b3=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.b4=function(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e[3]=t[3]*n[3],e},e.b5=g,e.b6=function(e,t,n){let r=t[0]*n[0]+t[1]*n[1]+t[2]*n[2];return r===0?null:(-(e[0]*n[0]+e[1]*n[1]+e[2]*n[2])-n[3])/r},e.b7=S,e.b8=function(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e},e.b9=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]},e.bA=T,e.bB=function(e,t,n){var r=n[0],i=n[1],a=n[2],o=n[3],s=t[0],c=t[1],l=t[2],u=i*l-a*c,d=a*s-r*l,f=r*c-i*s;return e[0]=s+o*(u+=u)+i*(f+=f)-a*(d+=d),e[1]=c+o*d+a*u-r*f,e[2]=l+o*f+r*d-i*u,e},e.bC=function(e,t,n){let r=(i=[e[0],e[1],e[2],t[0],t[1],t[2],n[0],n[1],n[2]])[0]*((u=i[8])*(o=i[4])-(s=i[5])*(l=i[7]))+i[1]*(-u*(a=i[3])+s*(c=i[6]))+i[2]*(l*a-o*c);var i,a,o,s,c,l,u;if(r===0)return null;let d=b([],[t[0],t[1],t[2]],[n[0],n[1],n[2]]),f=b([],[n[0],n[1],n[2]],[e[0],e[1],e[2]]),p=b([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),m=y([],d,-e[3]);return v(m,m,y([],f,-t[3])),v(m,m,y([],p,-n[3])),y(m,m,1/r),m},e.bD=Mf,e.bE=function(){return new Float64Array(4)},e.bF=function(e,t,n,r){var i=[],a=[];return i[0]=t[0]-n[0],i[1]=t[1]-n[1],i[2]=t[2]-n[2],a[0]=i[0]*Math.cos(r)-i[1]*Math.sin(r),a[1]=i[0]*Math.sin(r)+i[1]*Math.cos(r),a[2]=i[2],e[0]=a[0]+n[0],e[1]=a[1]+n[1],e[2]=a[2]+n[2],e},e.bG=function(e,t,n,r){var i=[],a=[];return i[0]=t[0]-n[0],i[1]=t[1]-n[1],i[2]=t[2]-n[2],a[0]=i[0],a[1]=i[1]*Math.cos(r)-i[2]*Math.sin(r),a[2]=i[1]*Math.sin(r)+i[2]*Math.cos(r),e[0]=a[0]+n[0],e[1]=a[1]+n[1],e[2]=a[2]+n[2],e},e.bH=function(e,t,n,r){var i=[],a=[];return i[0]=t[0]-n[0],i[1]=t[1]-n[1],i[2]=t[2]-n[2],a[0]=i[2]*Math.sin(r)+i[0]*Math.cos(r),a[1]=i[1],a[2]=i[2]*Math.cos(r)-i[0]*Math.sin(r),e[0]=a[0]+n[0],e[1]=a[1]+n[1],e[2]=a[2]+n[2],e},e.bI=function(e,t,n){var r=Math.sin(n),i=Math.cos(n),a=t[0],o=t[1],s=t[2],c=t[3],l=t[8],u=t[9],d=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*i-l*r,e[1]=o*i-u*r,e[2]=s*i-d*r,e[3]=c*i-f*r,e[8]=a*r+l*i,e[9]=o*r+u*i,e[10]=s*r+d*i,e[11]=c*r+f*i,e},e.bJ=function(e,t){let n=ee(e,360),r=ee(t,360),i=r-n,a=r>n?i-360:i+360;return Math.abs(i)<Math.abs(a)?i:a},e.bK=function(e){return e[0]=0,e[1]=0,e[2]=0,e},e.bL=function(e,t,n,r){let i=Math.sqrt(e*e+t*t),a=Math.sqrt(n*n+r*r);e/=i,t/=i,n/=a,r/=a;let o=Math.acos(e*n+t*r);return-t*n+e*r>0?o:-o},e.bM=function(e,t){let n=ee(e,2*Math.PI),r=ee(t,2*Math.PI);return Math.min(Math.abs(n-r),Math.abs(n-r+2*Math.PI),Math.abs(n-r-2*Math.PI))},e.bN=function(){let e={},t=N.$version;for(let n in N.$root){let r=N.$root[n];if(r.required){let i=null;i=n===`version`?t:r.type===`array`?[]:{},i!=null&&(e[n]=i)}}return e},e.bO=Ne,e.bP=Sa,e.bQ=function e(t,n){if(Array.isArray(t)){if(!Array.isArray(n)||t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0}if(typeof t==`object`&&t&&n!==null){if(typeof n!=`object`||Object.keys(t).length!==Object.keys(n).length)return!1;for(let r in t)if(!e(t[r],n[r]))return!1;return!0}return t===n},e.bR=Oe,e.bS=function(e){e=e.slice();let t=Object.create(null);for(let n=0;n<e.length;n++)t[e[n].id]=e[n];for(let n=0;n<e.length;n++)`ref`in e[n]&&(e[n]=He(e[n],t[e[n].ref]));return e},e.bT=function(e,t){if(e.type===`custom`)return new kf(e,t);switch(e.type){case`background`:return new Of(e,t);case`circle`:return new gc(e,t);case`color-relief`:return new Rc(e,t);case`fill`:return new Dl(e,t);case`fill-extrusion`:return new ql(e,t);case`heatmap`:return new Oc(e,t);case`hillshade`:return new jc(e,t);case`line`:return new fd(e,t);case`raster`:return new no(e,t);case`symbol`:return new Tf(e,t)}},e.bU=e=>e.type===`raster`,e.bV=M,e.bW=function(e,t){if(!e)return[{command:`setStyle`,args:[t]}];let n=[];try{if(!P(e.version,t.version))return[{command:`setStyle`,args:[t]}];P(e.center,t.center)||n.push({command:`setCenter`,args:[t.center]}),P(e.state,t.state)||n.push({command:`setGlobalState`,args:[t.state]}),P(e.centerAltitude,t.centerAltitude)||n.push({command:`setCenterAltitude`,args:[t.centerAltitude]}),P(e.zoom,t.zoom)||n.push({command:`setZoom`,args:[t.zoom]}),P(e.bearing,t.bearing)||n.push({command:`setBearing`,args:[t.bearing]}),P(e.pitch,t.pitch)||n.push({command:`setPitch`,args:[t.pitch]}),P(e.roll,t.roll)||n.push({command:`setRoll`,args:[t.roll]}),P(e.sprite,t.sprite)||n.push({command:`setSprite`,args:[t.sprite]}),P(e.glyphs,t.glyphs)||n.push({command:`setGlyphs`,args:[t.glyphs]}),P(e.transition,t.transition)||n.push({command:`setTransition`,args:[t.transition]}),P(e.light,t.light)||n.push({command:`setLight`,args:[t.light]}),P(e.terrain,t.terrain)||n.push({command:`setTerrain`,args:[t.terrain]}),P(e.sky,t.sky)||n.push({command:`setSky`,args:[t.sky]}),P(e.projection,t.projection)||n.push({command:`setProjection`,args:[t.projection]});let r={},i=[];(function(e,t,n,r){let i;for(i in t||={},e||={})Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)||Ge(i,n,r));for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)?P(e[i],t[i])||(e[i].type===`geojson`&&t[i].type===`geojson`&&qe(e,t,i)?Ue(n,{command:`setGeoJSONSourceData`,args:[i,t[i].data]}):Ke(i,t,n,r)):We(i,t,n))})(e.sources,t.sources,i,r);let a=[];e.layers&&e.layers.forEach((e=>{`source`in e&&r[e.source]?n.push({command:`removeLayer`,args:[e.id]}):a.push(e)})),n=n.concat(i),function(e,t,n){t||=[];let r=(e||=[]).map(Ye),i=t.map(Ye),a=e.reduce(Xe,{}),o=t.reduce(Xe,{}),s=r.slice(),c=Object.create(null),l,u,d,f,p;for(let e=0,t=0;e<r.length;e++)l=r[e],Object.prototype.hasOwnProperty.call(o,l)?t++:(Ue(n,{command:`removeLayer`,args:[l]}),s.splice(s.indexOf(l,t),1));for(let e=0,t=0;e<i.length;e++)l=i[i.length-1-e],s[s.length-1-e]!==l&&(Object.prototype.hasOwnProperty.call(a,l)?(Ue(n,{command:`removeLayer`,args:[l]}),s.splice(s.lastIndexOf(l,s.length-t),1)):t++,f=s[s.length-e],Ue(n,{command:`addLayer`,args:[o[l],f]}),s.splice(s.length-e,0,l),c[l]=!0);for(let e=0;e<i.length;e++)if(l=i[e],u=a[l],d=o[l],!c[l]&&!P(u,d))if(P(u.source,d.source)&&P(u[`source-layer`],d[`source-layer`])&&P(u.type,d.type)){for(p in Je(u.layout,d.layout,n,l,null,`setLayoutProperty`),Je(u.paint,d.paint,n,l,null,`setPaintProperty`),P(u.filter,d.filter)||Ue(n,{command:`setFilter`,args:[l,d.filter]}),P(u.minzoom,d.minzoom)&&P(u.maxzoom,d.maxzoom)||Ue(n,{command:`setLayerZoomRange`,args:[l,d.minzoom,d.maxzoom]}),u)Object.prototype.hasOwnProperty.call(u,p)&&p!==`layout`&&p!==`paint`&&p!==`filter`&&p!==`metadata`&&p!==`minzoom`&&p!==`maxzoom`&&(p.indexOf(`paint.`)===0?Je(u[p],d[p],n,l,p.slice(6),`setPaintProperty`):P(u[p],d[p])||Ue(n,{command:`setLayerProperty`,args:[l,p,d[p]]}));for(p in d)Object.prototype.hasOwnProperty.call(d,p)&&!Object.prototype.hasOwnProperty.call(u,p)&&p!==`layout`&&p!==`paint`&&p!==`filter`&&p!==`metadata`&&p!==`minzoom`&&p!==`maxzoom`&&(p.indexOf(`paint.`)===0?Je(u[p],d[p],n,l,p.slice(6),`setPaintProperty`):P(u[p],d[p])||Ue(n,{command:`setLayerProperty`,args:[l,p,d[p]]}))}else Ue(n,{command:`removeLayer`,args:[l]}),f=s[s.lastIndexOf(l)+1],Ue(n,{command:`addLayer`,args:[d,f]})}(a,t.layers,n)}catch(e){console.warn(`Unable to compute style diff:`,e),n=[{command:`setStyle`,args:[t]}]}return n},e.bX=function(e){let t=[],n=e.id;return n===void 0&&t.push({message:`layers.${n}: missing required property "id"`}),e.render===void 0&&t.push({message:`layers.${n}: missing required method "render"`}),e.renderingMode&&e.renderingMode!==`2d`&&e.renderingMode!==`3d`&&t.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),t},e.bY=ce,e.bZ=le,e.b_=class extends Ss{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},e.ba=Gf,e.bb=qf,e.bc=function(e,t,n,r,i){var a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){var o=1/(r-i);e[10]=(i+r)*o,e[14]=2*i*r*o}else e[10]=-1,e[14]=-2*r;return e},e.bd=function(e){var t=new f(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],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},e.be=function(e,t,n){var r=Math.sin(n),i=Math.cos(n),a=t[0],o=t[1],s=t[2],c=t[3],l=t[4],u=t[5],d=t[6],f=t[7];return t!==e&&(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[0]=a*i+l*r,e[1]=o*i+u*r,e[2]=s*i+d*r,e[3]=c*i+f*r,e[4]=l*i-a*r,e[5]=u*i-o*r,e[6]=d*i-s*r,e[7]=f*i-c*r,e},e.bf=function(e,t,n){var r=Math.sin(n),i=Math.cos(n),a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*i+l*r,e[5]=o*i+u*r,e[6]=s*i+d*r,e[7]=c*i+f*r,e[8]=l*i-a*r,e[9]=u*i-o*r,e[10]=d*i-s*r,e[11]=f*i-c*r,e},e.bg=function(e,t){var n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=n*s-r*o,y=n*c-i*o,b=n*l-a*o,x=r*c-i*s,S=r*l-a*s,C=i*l-a*c,w=u*h-d*m,T=u*g-f*m,E=u*_-p*m,D=d*g-f*h,O=d*_-p*h,k=f*_-p*g,A=v*k-y*O+b*D+x*E-S*T+C*w;return A?(e[0]=(s*k-c*O+l*D)*(A=1/A),e[1]=(i*O-r*k-a*D)*A,e[2]=(h*C-g*S+_*x)*A,e[3]=(f*S-d*C-p*x)*A,e[4]=(c*E-o*k-l*T)*A,e[5]=(n*k-i*E+a*T)*A,e[6]=(g*b-m*C-_*y)*A,e[7]=(u*C-f*b+p*y)*A,e[8]=(o*O-s*E+l*w)*A,e[9]=(r*E-n*O-a*w)*A,e[10]=(m*S-h*b+_*v)*A,e[11]=(d*b-u*S-p*v)*A,e[12]=(s*T-o*D-c*w)*A,e[13]=(n*D-r*T+i*w)*A,e[14]=(h*y-m*x-g*v)*A,e[15]=(u*x-d*y+f*v)*A,e):null},e.bh=function(){let e=new Float32Array(16);return m(e),e},e.bi=function(){let e=new Float64Array(16);return m(e),e},e.bj=function(){return new Float64Array(16)},e.bk=function(e,t,n){let r=new Float64Array(4);return T(r,e,t-90,n),r},e.bl=function(e,t,n,r){var i,a,o,s,c,l=t[0],u=t[1],f=t[2],p=t[3],m=n[0],h=n[1],g=n[2],_=n[3];return(a=l*m+u*h+f*g+p*_)<0&&(a=-a,m=-m,h=-h,g=-g,_=-_),1-a>d?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-r)*i)/o,c=Math.sin(r*i)/o):(s=1-r,c=r),e[0]=s*l+c*m,e[1]=s*u+c*h,e[2]=s*f+c*g,e[3]=s*p+c*_,e},e.bm=function(e){let t=new Float64Array(9);var n,r,i,a,o,s,c,l,u,d=(i=(r=e)[0])*(c=i+i),f=(a=r[1])*c,p,m=(o=r[2])*c,h=o*(l=a+a),g,_=(s=r[3])*c,v=s*l,y=s*(u=o+o);(n=t)[0]=1-(p=a*l)-(g=o*u),n[3]=f-y,n[6]=m+v,n[1]=f+y,n[4]=1-d-g,n[7]=h-_,n[2]=m-v,n[5]=h+_,n[8]=1-d-p;let b=Se(-Math.asin(ie(t[2],-1,1))),x,S;return Math.hypot(t[5],t[8])<.001?(x=0,S=-Se(Math.atan2(t[3],t[4]))):(x=Se(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),S=Se(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:x,pitch:b+90,bearing:S}},e.bn=function(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing},e.bo=V,e.bp=Cs,e.bq=hl,e.br=gl,e.bs=pl,e.bt=te,e.bu=j,e.bv=Xt,e.bw=function(e,t,n,r,i){return te(r,i,ie((e-t)/(n-t),0,1))},e.bx=function(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e},e.by=ee,e.bz=function(){return new Float64Array(3)},e.c=ke,e.c$=ci,e.c0=class extends Ss{constructor(e,t){super(e,t),this.current=Es}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])return this.current=e,void this.gl.uniformMatrix4fv(this.location,!1,e);for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}},e.c1=ws,e.c2=class extends Ss{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]||(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}},e.c3=class extends Ss{constructor(e,t){super(e,t),this.current=[0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]||(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}},e.c4=p,e.c5=function(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=-n,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},e.c6=function(e,t,n){var r=t[0],i=t[1],a=t[2];return e[0]=r*n[0]+i*n[3]+a*n[6],e[1]=r*n[1]+i*n[4]+a*n[7],e[2]=r*n[2]+i*n[5]+a*n[8],e},e.c7=function(e,t,n,r,i,a,o){var s=1/(t-n),c=1/(r-i),l=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+n)*s,e[13]=(i+r)*c,e[14]=(o+a)*l,e[15]=1,e},e.c8=class extends Ss{constructor(e,t){super(e,t),this.current=[]}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(4*e.length);for(let n=0;n<e.length;n++)t[4*n]=e[n].r,t[4*n+1]=e[n].g,t[4*n+2]=e[n].b,t[4*n+3]=e[n].a;this.gl.uniform4fv(this.location,t)}}},e.c9=class extends Ss{constructor(e,t){super(e,t),this.current=[]}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e);this.gl.uniform1fv(this.location,t)}}},e.cA=function(e,t){return Ce[t]&&`touches`in e},e.cB=function(e){return Ce[e]||we[e]},e.cC=function(e,t,n){var r=t[0],i=t[1];return e[0]=n[0]*r+n[4]*i+n[12],e[1]=n[1]*r+n[5]*i+n[13],e},e.cD=function(e,t){let{x:n,y:r}=Hf.fromLngLat(t);return!(e<0||e>25||r<0||r>=1||n<0||n>=1)},e.cE=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.cF=class extends lo{},e.cG=Me,e.cH=function(e,t){ke.REGISTERED_PROTOCOLS[e]=t},e.cI=function(e){delete ke.REGISTERED_PROTOCOLS[e]},e.cJ=function(e,t){let n={};for(let r=0;r<e.length;r++){let i=t&&t[e[r].id]||Di(e[r]);t&&(t[e[r].id]=i);let a=n[i];a||=n[i]=[],a.push(e[r])}let r=[];for(let e in n)r.push(n[e]);return r},e.cK=J,e.cL=Yf,e.cM=Xm,e.cN=Zd,e.cO=function(t){var n;t.bucket.createArrays(),t.bucket.tilePixelRatio=O/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0],i=r.layout,a=r._unevaluatedLayout._values,o={layoutIconSize:a[`icon-size`].possiblyEvaluate(new Y(t.bucket.zoom+1),t.canonical),layoutTextSize:a[`text-size`].possiblyEvaluate(new Y(t.bucket.zoom+1),t.canonical),textMaxSize:a[`text-size`].possiblyEvaluate(new Y(18))};if(t.bucket.textSizeData.kind===`composite`){let{minZoom:e,maxZoom:n}=t.bucket.textSizeData;o.compositeTextSizes=[a[`text-size`].possiblyEvaluate(new Y(e),t.canonical),a[`text-size`].possiblyEvaluate(new Y(n),t.canonical)]}if(t.bucket.iconSizeData.kind===`composite`){let{minZoom:e,maxZoom:n}=t.bucket.iconSizeData;o.compositeIconSizes=[a[`icon-size`].possiblyEvaluate(new Y(e),t.canonical),a[`icon-size`].possiblyEvaluate(new Y(n),t.canonical)]}let s=i.get(`text-line-height`)*xd,c=i.get(`text-rotation-alignment`)!==`viewport`&&i.get(`symbol-placement`)!==`point`,l=i.get(`text-keep-upright`),u=i.get(`text-size`);for(let a of t.bucket.features){let d=i.get(`text-font`).evaluate(a,{},t.canonical).join(`,`),f=u.evaluate(a,{},t.canonical),p=o.layoutTextSize.evaluate(a,{},t.canonical),m=o.layoutIconSize.evaluate(a,{},t.canonical),h={horizontal:{},vertical:void 0},g=a.text,_,v=[0,0];if(g){let n=g.toString(),o=i.get(`text-letter-spacing`).evaluate(a,{},t.canonical)*xd,u=Da(n)?o:0,m=i.get(`text-anchor`).evaluate(a,{},t.canonical),_=Eh(r,a,t.canonical);if(!_){let e=i.get(`text-radial-offset`).evaluate(a,{},t.canonical);v=e?Th(m,[e*xd,wh]):i.get(`text-offset`).evaluate(a,{},t.canonical).map((e=>e*xd))}let y=c?`center`:i.get(`text-justify`).evaluate(a,{},t.canonical),b=i.get(`symbol-placement`)===`point`?i.get(`text-max-width`).evaluate(a,{},t.canonical)*xd:1/0,x=()=>{t.bucket.allowVerticalPlacement&&Ea(n)&&(h.vertical=$d(g,t.glyphMap,t.glyphPositions,t.imagePositions,d,b,s,m,`left`,u,v,e.ax.vertical,!0,p,f))};if(!c&&_){let n=new Set;if(y===`auto`)for(let e=0;e<_.values.length;e+=2)n.add(Dh(_.values[e]));else n.add(y);let r=!1;for(let i of n)if(!h.horizontal[i])if(r)h.horizontal[i]=h.horizontal[0];else{let n=$d(g,t.glyphMap,t.glyphPositions,t.imagePositions,d,b,s,`center`,i,u,v,e.ax.horizontal,!1,p,f);n&&(h.horizontal[i]=n,r=n.positionedLines.length===1)}x()}else{y===`auto`&&(y=Dh(m));let r=$d(g,t.glyphMap,t.glyphPositions,t.imagePositions,d,b,s,m,y,u,v,e.ax.horizontal,!1,p,f);r&&(h.horizontal[y]=r),x(),Ea(n)&&c&&l&&(h.vertical=$d(g,t.glyphMap,t.glyphPositions,t.imagePositions,d,b,s,m,y,u,v,e.ax.vertical,!1,p,f))}}let y=!1;if(a.icon?.name){let e=t.imageMap[a.icon.name];e&&(_=cf(t.imagePositions[a.icon.name],i.get(`icon-offset`).evaluate(a,{},t.canonical),i.get(`icon-anchor`).evaluate(a,{},t.canonical)),y=!!e.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=y:t.bucket.sdfIcons!==y&&de(`Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer`),(e.pixelRatio!==t.bucket.pixelRatio||i.get(`icon-rotate`).constantOr(1)!==0)&&(t.bucket.iconsNeedLinear=!0))}let b=Ah(h.horizontal)||h.vertical;(n=t.bucket).iconsInText||(n.iconsInText=!!b&&b.iconsInText),(b||_)&&Oh(t.bucket,a,h,_,t.imageMap,o,p,m,v,y,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.cP=Cl,e.cQ=Vl,e.cR=od,e.cS=function(e,t=``){let n=new Pd;return function(e,t,n=``){for(let r in e.layers)t.writeMessage(3,((e,t)=>Um(e,t,n)),e.layers[r])}(e,n,t),n.finish()},e.cT=function(e,t,n,r,i,a){let o=eh(e,t,n,i,0);return o=eh(o,t,r,a,1),o},e.cU=class{constructor(e){this.maxEntries=e,this.map=new Map}get(e){let t=this.map.get(e);return t!==void 0&&(this.map.delete(e),this.map.set(e,t)),t}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.maxEntries){let e=this.map.keys().next().value;this.map.delete(e)}this.map.set(e,t)}clear(){this.map.clear()}},e.cV=Ll,e.cW=Pd,e.cX=Bm,e.cY=function(e,n,r,i,a){return t(this,void 0,void 0,(function*(){if(u())try{return yield _e(e,n,r,i,a)}catch{}return function(e,t,n,r,i){let a=e.width,o=e.height;ve&&ye||(ve=new OffscreenCanvas(a,o),ye=ve.getContext(`2d`,{willReadFrequently:!0})),ve.width=a,ve.height=o,ye.drawImage(e,0,0,a,o);let s=ye.getImageData(t,n,r,i);return ye.clearRect(0,0,a,o),s.data}(e,n,r,i,a)}))},e.cZ=Ic,e.c_=class{constructor(e,t){this.layers={[Hm]:this},this.name=Hm,this.version=t?t.version:1,this.extent=t?t.extent:4096,this.length=e.length,this.features=e}feature(e){return new Vm(this.features[e],this.extent)}},e.ca=class extends So{},e.cb=vd,e.cc=class extends wo{},e.cd=Dc,e.ce=function(e){return e<=1?1:2**Math.ceil(Math.log(e)/Math.LN2)},e.cf=Ec,e.cg=function(e,t,n){var r=t[0],i=t[1],a=t[2],o=n[3]*r+n[7]*i+n[11]*a+n[15];return e[0]=(n[0]*r+n[4]*i+n[8]*a+n[12])/(o||=1),e[1]=(n[1]*r+n[5]*i+n[9]*a+n[13])/o,e[2]=(n[2]*r+n[6]*i+n[10]*a+n[14])/o,e},e.ch=class extends uo{},e.ci=class extends jo{},e.cj=function(e,t){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.ck=function(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7],u=e[8],f=e[9],p=e[10],m=e[11],h=e[12],g=e[13],_=e[14],v=e[15],y=t[0],b=t[1],x=t[2],S=t[3],C=t[4],w=t[5],T=t[6],E=t[7],D=t[8],O=t[9],k=t[10],A=t[11],ee=t[12],te=t[13],j=t[14],ne=t[15];return Math.abs(n-y)<=d*Math.max(1,Math.abs(n),Math.abs(y))&&Math.abs(r-b)<=d*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(i-x)<=d*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(a-S)<=d*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(o-C)<=d*Math.max(1,Math.abs(o),Math.abs(C))&&Math.abs(s-w)<=d*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(c-T)<=d*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(l-E)<=d*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(u-D)<=d*Math.max(1,Math.abs(u),Math.abs(D))&&Math.abs(f-O)<=d*Math.max(1,Math.abs(f),Math.abs(O))&&Math.abs(p-k)<=d*Math.max(1,Math.abs(p),Math.abs(k))&&Math.abs(m-A)<=d*Math.max(1,Math.abs(m),Math.abs(A))&&Math.abs(h-ee)<=d*Math.max(1,Math.abs(h),Math.abs(ee))&&Math.abs(g-te)<=d*Math.max(1,Math.abs(g),Math.abs(te))&&Math.abs(_-j)<=d*Math.max(1,Math.abs(_),Math.abs(j))&&Math.abs(v-ne)<=d*Math.max(1,Math.abs(v),Math.abs(ne))},e.cl=function(e,t){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},e.cm=e=>e.type===`circle`,e.cn=e=>e.type===`heatmap`,e.co=e=>e.type===`line`,e.cp=e=>e.type===`fill`,e.cq=e=>e.type===`fill-extrusion`,e.cr=e=>e.type===`hillshade`,e.cs=e=>e.type===`color-relief`,e.ct=e=>e.type===`background`,e.cu=e=>e.type===`custom`,e.cv=ne,e.cw=function(e,t,n){if(t<=0)return e;let r=1/t;return n===void 0||Math.abs(n)<1e-10?Math.round(e*r)/r:(n>0?Math.ceil(e*r-1e-9):Math.floor(e*r+1e-10))/r},e.cx=function(e,t,n){let r=D(t.x-n.x,t.y-n.y),i=D(e.x-n.x,e.y-n.y);var a,o;return Se(Math.atan2(r[0]*i[1]-r[1]*i[0],(a=r)[0]*(o=i)[0]+a[1]*o[1]))},e.cy=re,e.cz=function(e,t){if(!we[t])return!1;let n=(e?.target)?.ownerDocument?.defaultView||window;return e instanceof n.MouseEvent||e instanceof n.WheelEvent},e.d=A,e.d0=class{constructor(e,t){let n=(t=this.options=Object.assign({},td,t)).debug;if(n&&console.time(`preprocess data`),t.maxZoom<0||t.maxZoom>24)throw Error(`maxZoom should be in the 0-24 range`);if(t.promoteId&&t.generateId)throw Error(`promoteId and generateId cannot be used together.`);let r=cu(e,t);n&&(console.timeEnd(`preprocess data`),console.log(`index: maxZoom: %d, maxPoints: %d`,t.indexMaxZoom,t.indexMaxPoints),console.time(`generate tiles`)),r=Nu(r,t),t.updateable&&(this.source=r),this.initializeIndex(r,t)}initializeIndex(e,t){this.tileIndex=t.cluster?new Bu(t.clusterOptions):new $u(t),e.length&&this.tileIndex.initialize(e)}getTile(e,t,n){return t=+t,n=+n,(e=+e)<0||e>24?null:this.tileIndex.getTile(e,t,n)}updateData(e,t){let n=this.options;if(!n.updateable)throw Error("to update tile geojson `updateable` option must be set to true");let{affected:r,source:i}=function(e,t,n){let r=function(e,t){return e?{removeAll:e.removeAll,remove:new Set(e.remove||[]),add:new Map(e.add?.map((e=>[t.promoteId?e.properties[t.promoteId]:e.id,e]))),update:new Map(e.update?.map((e=>[e.id,e])))}:{remove:new Set,add:new Map,update:new Map}}(t,n),i=[];if(r.removeAll&&(i=e,e=[]),r.remove.size||r.add.size){let t=[];for(let n of e)(r.remove.has(n.id)||r.add.has(n.id))&&t.push(n);if(t.length){i.push(...t);let n=new Set(t.map((e=>e.id)));e=e.filter((e=>!n.has(e.id)))}if(r.add.size){let t=cu({type:`FeatureCollection`,features:Array.from(r.add.values())},n);t=Nu(t,n),i.push(...t),e.push(...t)}}if(r.update.size){let t=new Map,a=[];for(let n of e)r.update.has(n.id)?t.set(n.id,[...t.get(n.id)||[],n]):a.push(n);for(let[e,o]of r.update){let r=t.get(e);if(!r||r.length===0)continue;let s=Lu(r,o,n);i.push(...r,...s),a.push(...s)}e=a}return{affected:i,source:e}}(this.source,e,n);t&&({affected:r,source:i}=this.filterUpdate(i,r,t)),r.length&&(this.source=i,this.tileIndex.updateIndex(i,r,n))}filterUpdate(e,t,n){let r=new Set;for(let i of e)i.id!=null&&(n(mu(i))||(t.push(i),r.add(i.id)));return{affected:t,source:e=e.filter((e=>!r.has(e.id)))}}getData(){if(!this.options.updateable)throw Error("to retrieve data the `updateable` option must be set to true");return{type:`FeatureCollection`,features:this.source.map((e=>mu(e)))}}updateClusterOptions(e,t){let n=this.options.cluster;this.options.cluster=e,this.options.clusterOptions=t,n==e?this.tileIndex.updateIndex(this.source,[],this.options):this.initializeIndex(this.source,this.options)}getClusterExpansionZoom(e){return this.tileIndex.getClusterExpansionZoom(e)}getClusterChildren(e){return this.tileIndex.getChildren(e)}getClusterLeaves(e,t,n){return this.tileIndex.getLeaves(e,t,n)}},e.d1=Ia,e.e=oe,e.f=Fe,e.g=Ae,e.h=e=>t(void 0,void 0,void 0,(function*(){if(e.byteLength===0)return createImageBitmap(new ImageData(1,1));let t=new Blob([new Uint8Array(e)],{type:`image/png`});try{return createImageBitmap(t)}catch(e){throw Error(`Could not load image because of ${A(e).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),e.i=pe,e.j=e=>new Promise(((t,n)=>{let r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame((()=>r.src=ge))},r.onerror=()=>n(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 i=new Blob([new Uint8Array(e)],{type:`image/png`});r.src=e.byteLength?URL.createObjectURL(i):ge})),e.k=(e,t)=>Pe(oe(e,{type:`json`}),t),e.l=ze,e.m=Pe,e.n=Re,e.o=(e,t)=>Pe(oe(e,{type:`arrayBuffer`}),t),e.p=Yd,e.q=function(e){return new Pd(e).readFields(Kd,[])},e.r=function(e){return/[\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(e))},e.s=be,e.t=Cc,e.u=Xa,e.v=ca,e.w=de,e.x=N,e.y=Va,e.z=ua})),n(`worker`,[`./shared`],(function(e){class t{constructor(e,t){this.keyCache={},e&&this.replace(e,t)}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t)}update(t,n,r){for(let n of t){this._layerConfigs[n.id]=n;let t=this._layers[n.id]=e.bT(n,r);t._featureFilter=e.ah(t.filter,r),this.keyCache[n.id]&&delete this.keyCache[n.id]}for(let e of n)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};let i=e.cJ(Object.values(this._layerConfigs),this.keyCache);for(let t of i){let n=t.map((e=>this._layers[e.id])),r=n[0];if(r.isHidden())continue;let i=r.source||``,a=this.familiesBySource[i];a||=this.familiesBySource[i]={};let o=r.sourceLayer||e.ag,s=a[o];s||=a[o]=[],s.push(n)}}}class n{constructor(t){let n={},r=[];for(let e in t){let i=t[e],a=n[e]={};for(let e in i){let t=i[+e];if(!t||t.bitmap.width===0||t.bitmap.height===0)continue;let n={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};r.push(n),a[e]={rect:n,metrics:t.metrics}}}let{w:i,h:a}=e.p(r),o=new e.t({width:i||1,height:a||1});for(let r in t){let i=t[r];for(let t in i){let a=i[+t];if(!a||a.bitmap.width===0||a.bitmap.height===0)continue;let s=n[r][t].rect;e.t.copy(a.bitmap,o,{x:0,y:0},{x:s.x+1,y:s.y+1},a.bitmap)}}this.image=o,this.positions=n}}e.cK(`GlyphAtlas`,n);class r{constructor(t){this.tileID=new e.a3(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}parse(t,r,a,o,s){return e._(this,void 0,void 0,(function*(){this.status=`parsing`,this.data=t,this.collisionBoxArray=new e.ae;let c=new e.cL(Object.keys(t.layers).sort()),l=new e.cM(this.tileID,this.promoteId);l.bucketLayerIDs=[];let u={},d={featureIndex:l,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:a,subdivisionGranularity:s},f=r.familiesBySource[this.source];for(let n in f){let r=t.layers[n];if(!r)continue;r.version===1&&e.w(`Vector tile source "${this.source}" layer "${n}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let o=c.encode(n),s=[];for(let e=0;e<r.length;e++){let t=r.feature(e),i=l.getId(t,n);s.push({feature:t,id:i,index:e,sourceLayerIndex:o})}for(let t of f[n]){let n=t[0];n.source!==this.source&&e.w(`layer.source = ${n.source} does not equal this.source = ${this.source}`),n.isHidden(this.zoom,!0)||(i(t,this.zoom,a),(u[n.id]=n.createBucket({index:l.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:o,sourceID:this.source})).populate(s,d,this.tileID.canonical),l.bucketLayerIDs.push(t.map((e=>e.id))))}}let p=e.bY(d.glyphDependencies,(e=>Object.keys(e).map(Number)));for(let e of this.inFlightDependencies)e?.abort();this.inFlightDependencies=[];let m=Promise.resolve({});if(Object.keys(p).length){let e=new AbortController;this.inFlightDependencies.push(e),m=o.sendAsync({type:`GG`,data:{stacks:p,source:this.source,tileID:this.tileID,type:`glyphs`}},e)}let h=Object.keys(d.iconDependencies),g=Promise.resolve({});if(h.length){let e=new AbortController;this.inFlightDependencies.push(e),g=o.sendAsync({type:`GI`,data:{icons:h,source:this.source,tileID:this.tileID,type:`icons`}},e)}let _=Object.keys(d.patternDependencies),v=Promise.resolve({});if(_.length){let e=new AbortController;this.inFlightDependencies.push(e),v=o.sendAsync({type:`GI`,data:{icons:_,source:this.source,tileID:this.tileID,type:`patterns`}},e)}let y=d.dashDependencies,b=Promise.resolve({});if(Object.keys(y).length){let e=new AbortController;this.inFlightDependencies.push(e),b=o.sendAsync({type:`GDA`,data:{dashes:y}},e)}let[x,S,C,w]=yield Promise.all([m,g,v,b]),T=new n(x),E=new e.cN(S,C);for(let t in u){let n=u[t];n instanceof e.af?(i(n.layers,this.zoom,a),e.cO({bucket:n,glyphMap:x,glyphPositions:T.positions,imageMap:S,imagePositions:E.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:d.subdivisionGranularity})):n.hasDependencies&&(n instanceof e.cP||n instanceof e.cQ||n instanceof e.cR)&&(i(n.layers,this.zoom,a),n.addFeatures(d,this.tileID.canonical,E.patternPositions,w))}return this.status=`done`,{buckets:Object.values(u).filter((e=>!e.isEmpty())),featureIndex:l,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:T.image,imageAtlas:E,dashPositions:w,glyphMap:this.returnDependencies?x:null,iconMap:this.returnDependencies?S:null,glyphPositions:this.returnDependencies?T.positions:null}}))}}function i(t,n,r){let i=new e.J(n);for(let e of t)e.recalculate(i,r)}class a{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(e,t){this.loading[e]=t}finishLoading(e){delete this.loading[e]}abort(e){let t=this.loading[e];t!=null&&t.abort&&(t.abort.abort(),delete this.loading[e])}setParsing(e,t){this.parsing[e]=t}consumeParsing(e){let t=this.parsing[e];if(t)return delete this.parsing[e],t}clearParsing(e){delete this.parsing[e]}markLoaded(e,t){this.loaded[e]=t}getLoaded(e){let t=this.loaded[e];if(t)return t}removeLoaded(e){delete this.loaded[e]}clearLoaded(){this.loaded={}}}class o{constructor(e){this.start=`${e}#start`,this.end=`${e}#end`,this.measure=e,performance.mark(this.start)}finish(){performance.mark(this.end);let e=performance.getEntriesByName(this.measure);return e.length===0&&(performance.measure(this.measure,this.start,this.end),e=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),e}}class s{constructor(e,t,n,r,i){this.type=e,this.properties=n||{},this.extent=i,this.pointsArray=t,this.id=r}loadGeometry(){return this.pointsArray.map((t=>t.map((t=>new e.P(t.x,t.y)))))}}class c{constructor(e,t,n){this.version=2,this._myFeatures=e,this.name=t,this.length=e.length,this.extent=n}feature(e){return this._myFeatures[e]}}class l{constructor(){this.layers={}}addLayer(e){this.layers[e.name]=e}}function u(t){let n=e.cS(t);return n.byteOffset===0&&n.byteLength===n.buffer.byteLength||(n=new Uint8Array(n)),{vectorTile:t,rawData:n.buffer}}function d(t,n,r){let{extent:i}=t,a=2**(r.z-n.z),o=(r.x-n.x*a)*i,l=(r.y-n.y*a)*i,u=[];for(let n=0;n<t.length;n++){let r=t.feature(n),c=r.loadGeometry();for(let e of c)for(let t of e)t.x=t.x*a-o,t.y=t.y*a-l;c=e.cT(c,r.type,-128,-128,i+128,i+128),c.length!==0&&u.push(new s(r.type,c,r.properties,r.id,i))}return new c(u,t.name,i)}class f{constructor(t,n,r){this.actor=t,this.layerIndex=n,this.availableImages=r,this.tileState=new a,this.overzoomedTileResultCache=new e.cU(1e3)}loadVectorTile(t,n){try{return{vectorTile:t.encoding===`mlt`?new e.cX(n):new e.cV(new e.cW(n)),rawData:n}}catch(r){let i=new Uint8Array(n),a=`Unable to parse the tile at ${t.request.url}, `;throw a+=i[0]===31&&i[1]===139?`please make sure the data is not gzipped and that you have configured the relevant header in the server`:`got error: ${e.d(r).message}`,Error(a)}}loadTile(t){return e._(this,void 0,void 0,(function*(){let{uid:n,overzoomParameters:i}=t;i&&(t.request=i.overzoomRequest);let a=this._startRequestTiming(t),o=new r(t);this.tileState.startLoading(n,o);let s=new AbortController;o.abort=s;try{let r=yield e.o(t.request,s);if(t.etag&&t.etag===r.etag)return this.tileState.finishLoading(n),this._getEtagUnmodifiedResult(r,a);let c=this.loadVectorTile(t,r.data);if(this.tileState.finishLoading(n),!c)return null;let{vectorTile:l,rawData:u}=c;i&&({vectorTile:l,rawData:u}=this._getOverzoomTile(t,l));let d=this._getExpiryData(r),f=this._finishRequestTiming(a);o.vectorTile=l,this.tileState.markLoaded(n,o);let p={rawData:u,cacheControl:d,resourceTiming:f};this.tileState.setParsing(n,p);try{return yield this._parseWorkerTile(o,t,p)}finally{this.tileState.clearParsing(n)}}catch(e){throw this.tileState.finishLoading(n),o.status=`done`,this.tileState.markLoaded(n,o),e}}))}_getEtagUnmodifiedResult(t,n){let r=this._getExpiryData(t),i=this._finishRequestTiming(n);return e.e({etagUnmodified:!0},r,i)}_parseWorkerTile(t,n,r){return e._(this,void 0,void 0,(function*(){let i=yield t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,n.subdivisionGranularity);if(r){let{rawData:t,cacheControl:a,resourceTiming:o}=r;i=e.e({rawTileData:t.slice(0),encoding:n.encoding},i,a,o)}return i}))}_getExpiryData({expires:e,cacheControl:t,etag:n}){let r={};return e&&(r.expires=e),t&&(r.cacheControl=t),n&&(r.etag=n),r}_startRequestTiming(e){if(e.request?.collectResourceTiming)return new o(e.request.url)}_finishRequestTiming(e){let t=e?.finish();return t?{resourceTiming:JSON.parse(JSON.stringify(t))}:{}}_getOverzoomTile(e,t){let{tileID:n,source:r,overzoomParameters:i}=e,{maxZoomTileID:a}=i,o=`${a.key}_${n.key}_${e.request?.url}`,s=this.overzoomedTileResultCache.get(o);if(s)return s;let c=new l,f=this.layerIndex.familiesBySource[r];for(let e in f){let r=t.layers[e];if(!r)continue;let i=d(r,a,n.canonical);i.length>0&&c.addLayer(i)}let p=u(c);return this.overzoomedTileResultCache.set(o,p),p}reloadTile(t){return e._(this,void 0,void 0,(function*(){let e=t.uid,n=this.tileState.getLoaded(e);if(!n)throw Error(`Should not be trying to reload a tile that was never loaded or has been removed`);if(n.showCollisionBoxes=t.showCollisionBoxes,n.status===`parsing`){let r=this.tileState.consumeParsing(e);return yield this._parseWorkerTile(n,t,r)}if(n.status===`done`&&n.vectorTile)return yield this._parseWorkerTile(n,t)}))}abortTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.abort(t.uid)}))}removeTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(t.uid)}))}}class p{constructor(){this.loaded={}}loadTile(t){return e._(this,void 0,void 0,(function*(){let{uid:n,encoding:r,rawImageData:i,redFactor:a,greenFactor:o,blueFactor:s,baseShift:c}=t,l=i.width+2,u=i.height+2,d=e.b(i)?new e.R({width:l,height:u},yield e.cY(i,-1,-1,l,u)):i,f=new e.cZ(n,d,r,a,o,s,c);return this.loaded||={},this.loaded[n]=f,f}))}removeTile(e){let t=this.loaded,n=e.uid;t!=null&&t[n]&&delete t[n]}}class m{constructor(e,t,n,r=h){this.actor=e,this.layerIndex=t,this.availableImages=n,this.tileState=new a,this._createGeoJSONIndex=r}loadVectorTile(t){if(!this._geoJSONIndex)throw Error(`Unable to parse the data into a cluster or geojson`);let{z:n,x:r,y:i}=t.tileID.canonical,a=this._geoJSONIndex.getTile(n,r,i);return a?u(new e.c_(a.features,{version:2,extent:e.a6})):null}loadTile(t){return e._(this,void 0,void 0,(function*(){let{uid:e}=t,n=new r(t);n.abort=new AbortController;try{let r=this.loadVectorTile(t);if(!r)return null;let{vectorTile:i,rawData:a}=r;n.vectorTile=i,this.tileState.markLoaded(e,n);let o={rawData:a};this.tileState.setParsing(e,o);try{return yield this._parseWorkerTile(n,t,o)}finally{this.tileState.clearParsing(e)}}catch(t){throw n.status=`done`,this.tileState.markLoaded(e,n),t}}))}_reloadLoadedTile(t){return e._(this,void 0,void 0,(function*(){let e=t.uid,n=this.tileState.getLoaded(e);if(!n)throw Error(`Should not be trying to reload a tile that was never loaded or has been removed`);if(n.showCollisionBoxes=t.showCollisionBoxes,n.status===`parsing`){let r=this.tileState.consumeParsing(e);return yield this._parseWorkerTile(n,t,r)}if(n.status===`done`&&n.vectorTile)return yield this._parseWorkerTile(n,t)}))}_parseWorkerTile(t,n,r){return e._(this,void 0,void 0,(function*(){let i=yield t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,n.subdivisionGranularity);if(r){let{rawData:t}=r;i=e.e({rawTileData:t.slice(0),encoding:`mvt`},i)}return i}))}abortTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.abort(t.uid)}))}removeTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(t.uid)}))}loadData(t){return e._(this,void 0,void 0,(function*(){var n;(n=this._pendingRequest)==null||n.abort();let r=this._startRequestTiming(t);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(t,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();let e={};return t.request&&(e.data=t.data),this._finishRequestTiming(r,t,e),e}catch(t){if(delete this._pendingRequest,!e.$(t))throw t;return{abandoned:!0}}}))}_startRequestTiming(e){if(e.request?.collectResourceTiming)return new o(e.request.url)}_finishRequestTiming(e,t,n){let r=e?.finish();r&&(n.resourceTiming={[t.source]:JSON.parse(JSON.stringify(r))})}reloadTile(e){return this.tileState.getLoaded(e.uid)?this._reloadLoadedTile(e):this.loadTile(e)}loadAndProcessGeoJSON(t,n){return e._(this,void 0,void 0,(function*(){if(t.request&&(t.data=(yield e.k(t.request,n)).data),t.data)return t.data=this._filterGeoJSON(t.data,t.filter),void(this._geoJSONIndex=this._createGeoJSONIndex(t.data,t));if(t.dataDiff)return this._geoJSONIndex??=this._createGeoJSONIndex({type:`FeatureCollection`,features:[]},t),void this._geoJSONIndex.updateData(t.dataDiff,this._getFilterPredicate(t.filter));if(t.updateCluster&&this._geoJSONIndex.updateClusterOptions(t.geojsonVtOptions.cluster,g(t)),this._geoJSONIndex==null)throw Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`)}))}_filterGeoJSON(e,t){if(e.type!==`FeatureCollection`)return e;let n=this._getFilterPredicate(t);return n?{type:`FeatureCollection`,features:e.features.filter((e=>n(e)))}:e}_getFilterPredicate(t){if(typeof t!=`boolean`&&!t?.length)return;let n=e.c$(t,{type:`boolean`,"property-type":`data-driven`,overridable:!1,transition:!1});if(n.result===`error`)throw Error(n.value.map((e=>`${e.key}: ${e.message}`)).join(`, `));return e=>n.value.evaluate({zoom:0},e)}removeSource(t){return e._(this,void 0,void 0,(function*(){var e;(e=this._pendingRequest)==null||e.abort()}))}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getClusterChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getClusterLeaves(e.clusterId,e.limit,e.offset)}}function h(t,n){let r=e.e(n.geojsonVtOptions||{},{updateable:!0,clusterOptions:g(n)});return new e.d0(t,r)}function g({geojsonVtOptions:t,clusterProperties:n}){if(!n||!t.clusterOptions)return t.clusterOptions;let r={},i={},a={accumulated:null,zoom:0},o={properties:null},s=Object.keys(n);for(let t of s){let[a,o]=n[t],s=e.c$(o),c=e.c$(typeof a==`string`?[a,[`accumulated`],[`get`,t]]:a);r[t]=s.value,i[t]=c.value}return t.clusterOptions.map=e=>{o.properties=e;let t={};for(let e of s)t[e]=r[e].evaluate(a,o);return t},t.clusterOptions.reduce=(e,t)=>{o.properties=t;for(let t of s)a.accumulated=e[t],e[t]=i[t].evaluate(a,o)},t.clusterOptions}class _{constructor(t){this.self=t,this.actor=new e.N(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(e,t)=>{if(this.externalWorkerSourceTypes[e])throw Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=t},this.self.addProtocol=e.cH,this.self.removeProtocol=e.cI,this.self.registerRTLTextPlugin=t=>{e.d1.setMethods(t)},this.self.makeRequest=e.m,this.actor.registerMessageHandler(`LDT`,((e,t)=>this._getDEMWorkerSource(e,t.source).loadTile(t))),this.actor.registerMessageHandler(`RDT`,((t,n)=>e._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(t,n.source).removeTile(n)})))),this.actor.registerMessageHandler(`GCEZ`,((t,n)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,n.type,n.source).getClusterExpansionZoom(n)})))),this.actor.registerMessageHandler(`GCC`,((t,n)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,n.type,n.source).getClusterChildren(n)})))),this.actor.registerMessageHandler(`GCL`,((t,n)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,n.type,n.source).getClusterLeaves(n)})))),this.actor.registerMessageHandler(`LD`,((e,t)=>this._getWorkerSource(e,t.type,t.source).loadData(t))),this.actor.registerMessageHandler(`LT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).loadTile(t))),this.actor.registerMessageHandler(`RT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).reloadTile(t))),this.actor.registerMessageHandler(`AT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).abortTile(t))),this.actor.registerMessageHandler(`RMT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).removeTile(t))),this.actor.registerMessageHandler(`RS`,((t,n)=>e._(this,void 0,void 0,(function*(){if(!this.workerSources[t]?.[n.type]?.[n.source])return;let e=this.workerSources[t][n.type][n.source];delete this.workerSources[t][n.type][n.source],e.removeSource!==void 0&&e.removeSource(n)})))),this.actor.registerMessageHandler(`RM`,(t=>e._(this,void 0,void 0,(function*(){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t],this.globalStates.delete(t)})))),this.actor.registerMessageHandler(`SR`,((t,n)=>e._(this,void 0,void 0,(function*(){this.referrer=n})))),this.actor.registerMessageHandler(`SRPS`,((e,t)=>this._syncRTLPluginState(e,t))),this.actor.registerMessageHandler(`IS`,((t,n)=>e._(this,void 0,void 0,(function*(){this.self.importScripts(n)})))),this.actor.registerMessageHandler(`SI`,((e,t)=>this._setImages(e,t))),this.actor.registerMessageHandler(`UL`,((t,n)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).update(n.layers,n.removedIds,this._getGlobalState(t))})))),this.actor.registerMessageHandler(`UGS`,((t,n)=>e._(this,void 0,void 0,(function*(){let e=this._getGlobalState(t);for(let t in n)e[t]=n[t]})))),this.actor.registerMessageHandler(`SL`,((t,n)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).replace(n,this._getGlobalState(t))}))))}_getGlobalState(e){let t=this.globalStates.get(e);return t||(t={},this.globalStates.set(e,t)),t}_setImages(t,n){return e._(this,void 0,void 0,(function*(){this.availableImages[t]=n;for(let e in this.workerSources[t]){let r=this.workerSources[t][e];for(let e in r)r[e].availableImages=n}}))}_syncRTLPluginState(t,n){return e._(this,void 0,void 0,(function*(){return yield e.d1.syncState(n,this.self.importScripts)}))}_getAvailableImages(e){let t=this.availableImages[e];return t||=[],t}_getLayerIndex(e){let n=this.layerIndexes[e];return n||=this.layerIndexes[e]=new t,n}_getWorkerSource(e,t,n){var r,i;if((r=this.workerSources)[e]||(r[e]={}),(i=this.workerSources[e])[t]||(i[t]={}),!this.workerSources[e][t][n]){let r={sendAsync:(t,n)=>(t.targetMapId=e,this.actor.sendAsync(t,n))};switch(t){case`vector`:this.workerSources[e][t][n]=new f(r,this._getLayerIndex(e),this._getAvailableImages(e));break;case`geojson`:this.workerSources[e][t][n]=new m(r,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][t][n]=new this.externalWorkerSourceTypes[t](r,this._getLayerIndex(e),this._getAvailableImages(e))}}return this.workerSources[e][t][n]}_getDEMWorkerSource(e,t){var n,r;return(n=this.demWorkerSources)[e]||(n[e]={}),(r=this.demWorkerSources[e])[t]||(r[t]=new p),this.demWorkerSources[e][t]}}return e.i(self)&&(self.worker=new _(self)),_})),n(`index`,[`exports`,`./shared`],(function(e,t){var n=`5.24.0`;function r(){var e=new t.A(4);return t.A!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}let i,a,o,s={frame(e,n,r,i){let a=i||window,o=a.requestAnimationFrame((e=>{s(),n(e)})),{unsubscribe:s}=t.s(e.signal,`abort`,(()=>{s(),a.cancelAnimationFrame(o),r(new t.a(e.signal.reason))}),!1)},frameAsync(e,t){return new Promise(((n,r)=>{this.frame(e,n,r,t)}))},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t=window.document.createElement(`canvas`),n=t.getContext(`2d`,{willReadFrequently:!0});if(!n)throw Error(`failed to create canvas 2d context`);return t.width=e.width,t.height=e.height,n.drawImage(e,0,0,e.width,e.height),n},resolveURL:e=>(i||=document.createElement(`a`),i.href=e,i.href),hardwareConcurrency:typeof navigator<`u`&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return o===void 0?!!matchMedia&&(a??=matchMedia(`(prefers-reduced-motion: reduce)`),a.matches):o},set prefersReducedMotion(e){o=e}},c=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt===null?performance.now():this._frozenAt}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function l(){return c.getCurrentTime()}var u;class d{static create(e,t,n){let r=window.document.createElement(e);return t!==void 0&&(r.className=t),n&&n.appendChild(r),r}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){d.docStyle&&d.selectProp&&(d.userSelect=d.docStyle[d.selectProp],d.docStyle[d.selectProp]=`none`)}static enableDrag(){d.docStyle&&d.selectProp&&(d.docStyle[d.selectProp]=d.userSelect)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener(`click`,d.suppressClickInternal,!0)}static suppressClick(){window.addEventListener(`click`,d.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener(`click`,d.suppressClickInternal,!0)}),0)}static getScale(e){let t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,n,r){let i=n.boundingClientRect;return new t.P((r.clientX-i.left)/n.x-e.clientLeft,(r.clientY-i.top)/n.y-e.clientTop)}static mousePos(e,t){let n=d.getScale(e);return d.getPoint(e,n,t)}static touchPos(e,t){let n=[],r=d.getScale(e);for(let i of t)n.push(d.getPoint(e,r,i));return n}static sanitize(e){let t=new DOMParser().parseFromString(e,`text/html`).body||document.createElement(`body`),n=t.querySelectorAll(`script`);for(let e of n)e.remove();return d.clean(t),t.innerHTML}static isPossiblyDangerous(e,t){let n=t.replace(/\s+/g,``).toLowerCase();return!(![`src`,`href`,`xlink:href`].includes(e)||!n.includes(`javascript:`)&&!n.includes(`data:`))||!!e.startsWith(`on`)||void 0}static clean(e){let t=e.children;for(let e of t)d.removeAttributes(e),d.clean(e)}static removeAttributes(e){for(let{name:t,value:n}of e.attributes)d.isPossiblyDangerous(t,n)&&e.removeAttribute(t)}}d.docStyle=typeof window<`u`&&window.document?.documentElement.style,d.selectProp=!d.docStyle||`userSelect`in d.docStyle?`userSelect`:`webkitUserSelect`,function(e){let n,r,i,a;e.resetRequestQueue=()=>{n=[],r=0,i=0,a={}},e.addThrottleControl=e=>{let t=i++;return a[t]=e,t},e.removeThrottleControl=e=>{delete a[e],s()},e.getImage=(e,r,i=!0)=>new Promise(((a,o)=>{e.headers||={},e.headers.accept=`image/webp,*/*`,t.e(e,{type:`image`}),n.push({abortController:r,requestParameters:e,supportImageRefresh:i,state:`queued`,onError:e=>{o(e)},onSuccess:e=>{a(e)}}),s()}));let o=e=>t._(this,void 0,void 0,(function*(){e.state=`running`;let{requestParameters:n,supportImageRefresh:i,onError:a,onSuccess:o,abortController:l}=e,u=!1===i&&!t.i(self)&&!t.g(n.url)&&(!n.headers||Object.keys(n.headers).reduce(((e,t)=>e&&t===`accept`),!0));r++;let d=u?c(n,l):t.m(n,l);try{let n=yield d;delete e.abortController,e.state=`completed`,n.data instanceof HTMLImageElement||t.b(n.data)?o(n):n.data&&o({data:yield(f=n.data,typeof createImageBitmap==`function`?t.h(f):t.j(f)),cacheControl:n.cacheControl,expires:n.expires})}catch(n){delete e.abortController,a(t.d(n))}finally{r--,s()}var f})),s=()=>{let e=(()=>{for(let e of Object.keys(a))if(a[e]())return!0;return!1})()?t.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=r;t<e&&n.length>0;t++){let e=n.shift();e.abortController.signal.aborted?t--:o(e)}},c=(e,n)=>new Promise(((r,i)=>{let a=new Image,o=e.url,s=e.credentials;s&&s===`include`?a.crossOrigin=`use-credentials`:(s&&s===`same-origin`||!t.f(o))&&(a.crossOrigin=`anonymous`),n.signal.addEventListener(`abort`,(()=>{a.src=``,i(new t.a(n.signal.reason))})),a.fetchPriority=`high`,a.onload=()=>{a.onerror=a.onload=null,r({data:a})},a.onerror=()=>{a.onerror=a.onload=null,n.signal.aborted||i(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.`))},a.src=o}))}(u||={}),u.resetRequestQueue();class f{constructor(e){this._transformRequestFn=e??null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function p(e){let t=[];if(typeof e==`string`)t.push({id:`default`,url:e});else if(e&&e.length>0){let n=[];for(let{id:r,url:i}of e){let e=`${r}${i}`;n.includes(e)||(n.push(e),t.push({id:r,url:i}))}}return t}function m(e,t,n){try{let r=new URL(e);return r.pathname+=`${t}${n}`,r.toString()}catch{throw Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function h(e){let{userImage:t}=e;return!(!t?.render||!t.render()||(e.data.replace(new Uint8Array(t.data.buffer)),0))}class g extends t.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&=(this.atlasTexture.destroy(),null);for(let e of Object.keys(this.images))this.removeImage(e);this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:e,promiseResolve:t}of this.requestors)t(this._getImagesForIds(e));this.requestors=[]}}getImage(e){let n=this.images[e];if(n&&!n.data&&n.spriteData){let e=n.spriteData;n.data=new t.R({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),n.spriteData=null}return n}addImage(e,t){if(this.images[e])throw Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t)}_validate(e,n){let r=!0,i=n.data||n.spriteData;return this._validateStretch(n.stretchX,i?.width)||(this.fire(new t.l(Error(`Image "${e}" has invalid "stretchX" value`))),r=!1),this._validateStretch(n.stretchY,i?.height)||(this.fire(new t.l(Error(`Image "${e}" has invalid "stretchY" value`))),r=!1),this._validateContent(n.content,n)||(this.fire(new t.l(Error(`Image "${e}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let n=0;for(let r of e){if(r[0]<n||r[1]<r[0]||t<r[1])return!1;n=r[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let n=t.spriteData,r=n?.width||t.data.width,i=n?.height||t.data.height;return!(e[0]<0||r<e[0]||e[1]<0||i<e[1]||e[2]<0||r<e[2]||e[3]<0||i<e[3]||e[2]<e[0]||!(e[3]>=e[1]))}updateImage(e,t,n=!0){let r=this.getImage(e);if(n&&(r.data.width!==t.data.width||r.data.height!==t.data.height))throw Error(`size mismatch between old image (${r.data.width}x${r.data.height}) and new image (${t.data.width}x${t.data.height}).`);t.version=r.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){var t;let n=this.images[e];delete this.images[e],delete this.patterns[e],(t=n.userImage)!=null&&t.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise(((t,n)=>{let r=!0;if(!this.isLoaded())for(let t of e)this.images[t]||(r=!1);this.isLoaded()||r?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})}))}_getImagesForIds(e){let n={};for(let r of e){let e=this.getImage(r);e||=(this.fire(new t.n(`styleimagemissing`,{id:r})),this.getImage(r)),e?n[r]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:!!e.userImage?.render}:t.w(`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 n}getPixelSize(){let{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){let n=this.patterns[e],r=this.getImage(e);if(!r)return null;if(n&&n.position.version===r.version)return n.position;if(n)n.position.version=r.version;else{let n={w:r.data.width+2,h:r.data.height+2,x:0,y:0},i=new t.I(n,r);this.patterns[e]={bin:n,position:i}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let n=e.gl;this.atlasTexture?this.dirty&&=(this.atlasTexture.update(this.atlasImage),!1):this.atlasTexture=new t.T(e,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let t in this.patterns)e.push(this.patterns[t].bin);let{w:n,h:r}=t.p(e),i=this.atlasImage;i.resize({width:n||1,height:r||1});for(let e in this.patterns){let{bin:n}=this.patterns[e],r=n.x+1,a=n.y+1,o=this.getImage(e).data,s=o.width,c=o.height;t.R.copy(o,i,{x:0,y:0},{x:r,y:a},{width:s,height:c}),t.R.copy(o,i,{x:0,y:c-1},{x:r,y:a-1},{width:s,height:1}),t.R.copy(o,i,{x:0,y:0},{x:r,y:a+c},{width:s,height:1}),t.R.copy(o,i,{x:s-1,y:0},{x:r-1,y:a},{width:1,height:c}),t.R.copy(o,i,{x:0,y:0},{x:r+s,y:a},{width:1,height:c})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let n of e){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;let e=this.getImage(n);e||t.w(`Image with ID: "${n}" was not found`),h(e)&&this.updateImage(n,e)}}cloneImages(){let e={};for(let t in this.images){let n=this.images[t];e[t]=Object.assign(Object.assign({},n),{data:n.data?n.data.clone():null})}return e}}let _=0x56bc75e2d63100000,v=new Float64Array(256);for(let e=0;e<256;e++){let t=.5-(e/255)**(1/2.2);v[e]=t*Math.abs(t)}function y(e,t,n,r,i,a,o,s,c){for(let l=t;l<t+r;l++)b(e,n*a+l,a,i,o,s,c);for(let l=n;l<n+i;l++)b(e,l*a+t,1,r,o,s,c)}function b(e,t,n,r,i,a,o){a[0]=0,o[0]=-0x56bc75e2d63100000,o[1]=_,i[0]=e[t];for(let s=1,c=0,l=0;s<r;s++){i[s]=e[t+s*n];let r=s*s;do{let e=a[c];l=(i[s]-i[e]+r-e*e)/(s-e)/2}while(l<=o[c]&&--c>-1);c++,a[c]=s,o[c]=l,o[c+1]=_}for(let s=0,c=0;s<r;s++){for(;o[c+1]<s;)c++;let r=a[c],l=s-r;e[t+s*n]=i[r]+l*l}}v[255]=-0x56bc75e2d63100000;let x=t.v.layout_symbol[`text-font`].default.join(`,`);class S{constructor(e,t,n){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={},this.lang=n}setURL(e){this.url=e}getGlyphs(e){return t._(this,void 0,void 0,(function*(){let t=[];for(let n in e)for(let r of e[n])t.push(this._getAndCacheGlyphsPromise(n,r));let n=yield Promise.all(t),r={};for(let{stack:e,id:t,glyph:i}of n)r[e]||(r[e]={}),r[e][t]=i&&{id:i.id,bitmap:i.bitmap.clone(),metrics:i.metrics};return r}))}_getAndCacheGlyphsPromise(e,n){return t._(this,void 0,void 0,(function*(){var t;(t=this.entries)[e]??(t[e]={glyphs:{},requests:{},ranges:{}});let r=this.entries[e],i=r.glyphs[n];return i===void 0?!this.url||this._charUsesLocalIdeographFontFamily(n)?(i=r.glyphs[n]=this._drawGlyph(r,e,n),{stack:e,id:n,glyph:i}):yield this._downloadAndCacheRangePromise(e,n):{stack:e,id:n,glyph:i}}))}_downloadAndCacheRangePromise(e,n){return t._(this,void 0,void 0,(function*(){var r;let i=this.entries[e],a=Math.floor(n/256);if(i.ranges[a])return{stack:e,id:n,glyph:null};(r=i.requests)[a]||(r[a]=S.loadGlyphRange(e,a,this.url,this.requestManager));try{let t=yield i.requests[a];for(let e in t)i.glyphs[+e]=t[+e];return i.ranges[a]=!0,{stack:e,id:n,glyph:t[n]||null}}catch(r){let o=i.glyphs[n]=this._drawGlyph(i,e,n);return this._warnOnMissingGlyphRange(o,a,n,t.d(r)),{stack:e,id:n,glyph:o}}}))}_warnOnMissingGlyphRange(e,n,r,i){let a=256*n,o=a+255,s=r.toString(16).padStart(4,`0`).toUpperCase();t.w(`Unable to load glyph range ${n}, ${a}-${o}. Rendering codepoint U+${s} locally instead. ${i}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&t.r(e)}_drawGlyph(e,n,r){let i=n===x&&this.localIdeographFontFamily!==``&&this._charUsesLocalIdeographFontFamily(r),a=i?`ideographTinySDF`:`tinySDF`;e[a]||(e[a]=this._createTinySDF(i?this.localIdeographFontFamily:n));let o=e[a].draw(String.fromCodePoint(r)),s=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(r));return{id:r,bitmap:new t.t({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+.5||0,top:o.glyphTop/2-27.5||-8,advance:s?0:o.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(e){let t=e?e.split(`,`):[];t.push(`sans-serif`);let n=t.map((e=>/[-\w]+/.test(e)?e:`'${CSS.escape(e)}'`)).join(`,`);return new S.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:n,fontWeight:this._fontWeight(t[0]),fontStyle:this._fontStyle(t[0]),lang:this.lang})}_fontStyle(e){return/italic/i.test(e)?`italic`:/oblique/i.test(e)?`oblique`:`normal`}_fontWeight(e){let t={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},n;for(let[r,i]of Object.entries(t))RegExp(`\\b${r}\\b`,`i`).test(e)&&(n=`${i}`);return n}destroy(){for(let e in this.entries){let t=this.entries[e];t.tinySDF=null,t.ideographTinySDF=null,t.glyphs={},t.requests={},t.ranges={}}this.entries={}}}S.loadGlyphRange=function(e,n,r,i){return t._(this,void 0,void 0,(function*(){let a=256*n,o=a+255,s=yield i.transformRequest(r.replace(`{fontstack}`,e).replace(`{range}`,`${a}-${o}`),`Glyphs`),c=yield t.o(s,new AbortController);if(!c?.data)throw Error(`Could not load glyph range. range: ${n}, ${a}-${o}`);let l={};for(let e of t.q(c.data))l[e.id]=e;return l}))},S.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:n=8,cutoff:r=.25,fontFamily:i=`sans-serif`,fontWeight:a=`normal`,fontStyle:o=`normal`,lang:s=null}={}){this.buffer=t,this.radius=n,this.cutoff=r,this.lang=s;let c=this.size=e+4*t,l=this._createCanvas(c),u=this.ctx=l.getContext(`2d`,{willReadFrequently:!0});u.font=`${o} ${a} ${e}px ${i}`,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(e){if(typeof OffscreenCanvas<`u`)return new OffscreenCanvas(e,e);let t=document.createElement(`canvas`);return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:r,actualBoundingBoxLeft:i,actualBoundingBoxRight:a}=this.ctx.measureText(e),o=Math.ceil(n),s=Math.floor(i),c=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a)-s)),l=Math.max(0,Math.min(this.size-this.buffer,o+Math.ceil(r))),u=c+2*this.buffer,d=l+2*this.buffer,f=Math.max(u*d,0),p=new Uint8ClampedArray(f),m={data:p,width:u,height:d,glyphWidth:c,glyphHeight:l,glyphTop:o,glyphLeft:s,glyphAdvance:t};if(c===0||l===0)return m;let{ctx:h,buffer:g,gridInner:b,gridOuter:x}=this;this.lang&&(h.lang=this.lang),h.clearRect(g,g,c,l),h.fillText(e,g-s,g+o);let S=h.getImageData(g,g,c,l);x.fill(_,0,f),b.fill(0,0,f);let C=3;for(let e=0;e<l;e++){let t=(e+g)*u+g;for(let e=0;e<c;e++,C+=4,t++){let e=S.data[C];if(e===0)continue;let n=v[e];x[t]=Math.max(0,n),b[t]=Math.max(0,-n)}}y(x,0,0,u,d,u,this.f,this.v,this.z),y(b,g,g,c,l,u,this.f,this.v,this.z);let w=255/this.radius,T=255*(1-this.cutoff);for(let e=0;e<f;e++){let t=Math.sqrt(x[e])-Math.sqrt(b[e]);p[e]=Math.round(T-w*t)}return m}};class C{constructor(){this.specification=t.x.light.position}possiblyEvaluate(e,n){return t.G(e.expression.evaluate(n))}interpolate(e,n,r){return{x:t.H.number(e.x,n.x,r),y:t.H.number(e.y,n.y,r),z:t.H.number(e.z,n.z,r)}}}let w;class T extends t.E{constructor(e){super(),w||=new t.u({anchor:new t.D(t.x.light.anchor),position:new C,color:new t.D(t.x.light.color),intensity:new t.D(t.x.light.intensity)}),this._transitionable=new t.y(w,void 0),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,n={}){if(!this._validate(t.z,e,n))for(let n in e){let r=e[n];n.endsWith(t.B)?this._transitionable.setTransition(n.slice(0,-t.B.length),r):this._transitionable.setValue(n,r)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,r){return!1!==r?.validate&&t.C(this,e.call(t.F,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:t.x}))}}let E=new t.u({"sky-color":new t.D(t.x.sky[`sky-color`]),"horizon-color":new t.D(t.x.sky[`horizon-color`]),"fog-color":new t.D(t.x.sky[`fog-color`]),"fog-ground-blend":new t.D(t.x.sky[`fog-ground-blend`]),"horizon-fog-blend":new t.D(t.x.sky[`horizon-fog-blend`]),"sky-horizon-blend":new t.D(t.x.sky[`sky-horizon-blend`]),"atmosphere-blend":new t.D(t.x.sky[`atmosphere-blend`])});class D extends t.E{constructor(e){super(),this._transitionable=new t.y(E,void 0),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.J(0))}setSky(e,n={}){if(!this._validate(t.K,e,n)){e||={"sky-color":`transparent`,"horizon-color":`transparent`,"fog-color":`transparent`,"fog-ground-blend":1,"atmosphere-blend":0};for(let n in e){let r=e[n];n.endsWith(t.B)?this._transitionable.setTransition(n.slice(0,-t.B.length),r):this._transitionable.setValue(n,r)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,r={}){return!1!==r?.validate&&t.C(this,e.call(t.F,t.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:t.x})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class O{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){var n;let r=e.join(`,`)+String(t);return(n=this.dashEntry)[r]||(n[r]=this.addDash(e,t)),this.dashEntry[r]}getDashRanges(e,t,n){let r=[],i=e.length%2==1?-e[e.length-1]*n:0,a=e[0]*n,o=!0;r.push({left:i,right:a,isDash:o,zeroLength:e[0]===0});let s=e[0];for(let t=1;t<e.length;t++){o=!o;let c=e[t];i=s*n,s+=c,a=s*n,r.push({left:i,right:a,isDash:o,zeroLength:c===0})}return r}addRoundDash(e,t,n){let r=t/2;for(let t=-n;t<=n;t++){let i=this.width*(this.nextRow+n+t),a=0,o=e[a];for(let s=0;s<this.width;s++){s/o.right>1&&(o=e[++a]);let c=Math.abs(s-o.left),l=Math.abs(s-o.right),u=Math.min(c,l),d,f=t/n*(r+1);if(o.isDash){let e=r-Math.abs(f);d=Math.sqrt(u*u+e*e)}else d=r-Math.sqrt(u*u+f*f);this.data[i+s]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){let n=e[t],r=e[t+1];n.zeroLength?e.splice(t,1):r&&r.isDash===n.isDash&&(r.left=n.left,e.splice(t,1))}let t=e[0],n=e[e.length-1];t.isDash===n.isDash&&(t.left=n.left-this.width,n.right=t.right+this.width);let r=this.width*this.nextRow,i=0,a=e[i];for(let t=0;t<this.width;t++){t/a.right>1&&(a=e[++i]);let n=Math.abs(t-a.left),o=Math.abs(t-a.right),s=Math.min(n,o);this.data[r+t]=Math.max(0,Math.min(255,(a.isDash?s:-s)+128))}}addDash(e,n){let r=n?7:0,i=2*r+1;if(this.nextRow+i>this.height)return t.w(`LineAtlas out of space`),null;let a=0;for(let t of e)a+=t;if(a!==0){let t=this.width/a,i=this.getDashRanges(e,this.width,t);n?this.addRoundDash(i,t,r):this.addRegularDash(i)}let o={y:this.nextRow+r,height:2*r,width:a};return this.nextRow+=i,this.dirty=!0,o}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}}let k=`maplibre_preloaded_worker_pool`;class A{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<A.workerCount;)this.workers.push(new Worker(t.c.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){if(delete this.active[e],this.numActive()===0){for(let e of this.workers)e.terminate();this.workers=null}}isPreloaded(){return!!this.active[k]}numActive(){return Object.keys(this.active).length}}let ee=Math.floor(s.hardwareConcurrency/2),te,j;function ne(){return te||=new A,te}A.workerCount=t.L(globalThis)?Math.max(Math.min(ee,3),1):1;class re{constructor(e,n){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=n;let r=this.workerPool.acquire(n);for(let e=0;e<r.length;e++){let i=new t.N(r[e],n);i.name=`Worker ${e}`,this.actors.push(i)}if(!this.actors.length)throw Error(`No actors found`)}broadcast(e,t){let n=[];for(let r of this.actors)n.push(r.sendAsync({type:e,data:t}));return Promise.all(n)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){for(let e of this.actors)e.remove();this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(let n of this.actors)n.registerMessageHandler(e,t)}unregisterMessageHandler(e){for(let t of this.actors)t.unregisterMessageHandler(e)}}function ie(){return j||(j=new re(ne(),t.M),j.registerMessageHandler(`GR`,((e,n,r)=>t.m(n,r)))),j}function ae(e,n){let r=t.O();return t.Q(r,r,[1,1,0]),t.S(r,r,[.5*e.width,.5*e.height,1]),e.calculatePosMatrix?t.U(r,r,e.calculatePosMatrix(n.toUnwrapped())):r}function oe(e,t,n,r,i,a,o){let s=function(e,t,n){if(e)for(let r of e){let e=t[r];if(e?.source===n&&e.type===`fill-extrusion`)return!0}else for(let e in t){let r=t[e];if(r.source===n&&r.type===`fill-extrusion`)return!0}return!1}(i?.layers??null,t,e.id),c=a.maxPitchScaleFactor(),l=e.tilesIn(r,c,s);l.sort(se);let u=[];for(let r of l)u.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(t,n,e.getState(),r.queryGeometry,r.cameraQueryGeometry,r.scale,i,a,c,ae(a,r.tileID),o?(e,t)=>o(r.tileID,e,t):void 0)});return function(e,t){for(let n in e)for(let r of e[n])ce(r,t);return e}(function(e){let t={},n={};for(let{queryResults:r,wrappedTileID:i}of e){n[i]||(n[i]={});let e=n[i];for(let n in r){let i=r[n];e[n]||(e[n]={});let a=e[n];t[n]||(t[n]=[]);for(let e of i)a[e.featureIndex]||(a[e.featureIndex]=!0,t[n].push(e))}}return t}(u),e)}function se(e,t){let n=e.tileID,r=t.tileID;return n.overscaledZ-r.overscaledZ||n.canonical.y-r.canonical.y||n.wrap-r.wrap||n.canonical.x-r.canonical.x}function ce(e,t){let n=e.feature,r=t.getFeatureState(n.layer[`source-layer`],n.id);n.source=n.layer.source,n.layer[`source-layer`]&&(n.sourceLayer=n.layer[`source-layer`]),n.state=r}function le(e,n,r,i){return t._(this,void 0,void 0,(function*(){let a=e;if(e.url?a=(yield t.k(yield n.transformRequest(e.url,`Source`),r)).data:yield s.frameAsync(r,i),!a)return null;let o=t.V(t.e(a,e),[`tiles`,`minzoom`,`maxzoom`,`attribution`,`bounds`,`scheme`,`tileSize`,`encoding`]);return`vector_layers`in a&&a.vector_layers&&(o.vectorLayerIds=a.vector_layers.map((e=>e.id))),o}))}class M{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof t.W?new t.W(e.lng,e.lat):t.W.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.W?new t.W(e.lng,e.lat):t.W.convert(e),this}extend(e){let n=this._sw,r=this._ne,i,a;if(e instanceof t.W)i=e,a=e;else{if(!(e instanceof M))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(M.convert(e)):this.extend(t.W.convert(e)):e&&(`lng`in e||`lon`in e)&&`lat`in e?this.extend(t.W.convert(e)):this;if(i=e._sw,a=e._ne,!i||!a)return this}return n||r?(n.lng=Math.min(i.lng,n.lng),n.lat=Math.min(i.lat,n.lat),r.lng=Math.max(a.lng,r.lng),r.lat=Math.max(a.lat,r.lat)):(this._sw=new t.W(i.lng,i.lat),this._ne=new t.W(a.lng,a.lat)),this}getCenter(){return new t.W((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 t.W(this.getWest(),this.getNorth())}getSouthEast(){return new t.W(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(e){let{lng:n,lat:r}=t.W.convert(e),i=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&i}intersects(e){if(!((e=M.convert(e)).getNorth()>=this.getSouth()&&e.getSouth()<=this.getNorth()))return!1;let n=Math.abs(this.getEast()-this.getWest()),r=Math.abs(e.getEast()-e.getWest());if(n>=360||r>=360)return!0;let i=t.X(this.getWest(),-180,180),a=t.X(this.getEast(),-180,180),o=t.X(e.getWest(),-180,180),s=t.X(e.getEast(),-180,180),c=i>a,l=o>s;return!(!c||!l)||(c?s>=i||o<=a:l?a>=o||i<=s:o<=a&&s>=i)}static convert(e){return e instanceof M?e:e&&new M(e)}static fromLngLat(e,n=0){let r=360*n/40075017,i=r/Math.cos(Math.PI/180*e.lat);return new M(new t.W(e.lng-i,e.lat-r),new t.W(e.lng+i,e.lat+r))}adjustAntiMeridian(){let e=new t.W(this._sw.lng,this._sw.lat),n=new t.W(this._ne.lng,this._ne.lat);return new M(e,e.lng>n.lng?new t.W(n.lng+360,n.lat):n)}}class ue{constructor(e,t,n){this.bounds=M.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=n||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let n=2**e.z,r=Math.floor(t.Z(this.bounds.getWest())*n),i=Math.floor(t.Y(this.bounds.getNorth())*n),a=Math.ceil(t.Z(this.bounds.getEast())*n),o=Math.ceil(t.Y(this.bounds.getSouth())*n);return e.x>=r&&e.x<a&&e.y>=i&&e.y<o}}class de extends t.E{constructor(e,n,r,i){if(super(),this.id=e,this.dispatcher=r,this.type=`vector`,this.minzoom=0,this.maxzoom=22,this.scheme=`xyz`,this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.e(this,t.V(n,[`url`,`scheme`,`tileSize`,`promoteId`,`encoding`])),this._options=t.e({type:`vector`},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw Error(`vector tile sources must have a tileSize of 512`);this.setEventedParent(i)}load(){return t._(this,arguments,void 0,(function*(e=!1){this._loaded=!1,this.fire(new t.n(`dataloading`,{dataType:`source`})),this._tileJSONRequest=new AbortController;try{let n=yield le(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,n&&(t.e(this,n),n.bounds&&(this.tileBounds=new ue(n.bounds,this.minzoom,this.maxzoom)),this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`metadata`})),this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`content`,sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,t.$(e)||this.fire(new t.l(t.d(e)))}}))}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load(!0)}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}serialize(){return t.e({},this._options)}loadTile(e){return t._(this,void 0,void 0,(function*(){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n={request:yield this.map._requestManager.transformRequest(t,`Tile`),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.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(e),etag:e.etag};n.request.collectResourceTiming=this._collectResourceTiming;let r=`RT`;if(e.actor&&e.state!==`expired`){if(e.state===`loading`)return new Promise(((t,n)=>{e.reloadPromise={resolve:t,reject:n}}))}else e.actor=this.dispatcher.getActor(),r=`LT`;e.abortController=new AbortController;try{let t=yield e.actor.sendAsync({type:r,data:n},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,t);let i={};return t!=null&&t.etagUnmodified&&(i.unmodified=!0),i}catch(t){if(delete e.abortController,e.aborted)return;if(t&&t.status!==404)throw t;this._afterTileLoadWorkerResponse(e,null)}}))}_getOverzoomParameters(e){return t._(this,void 0,void 0,(function*(){if(e.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;let t=e.tileID.scaledTo(this.maxzoom).canonical,n=t.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:t,overzoomRequest:yield this.map._requestManager.transformRequest(n,`Tile`)}}))}_afterTileLoadWorkerResponse(e,t){if(t!=null&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.etag=t?.etag,e.loadVectorData(t,this.map.painter),e.reloadPromise){let t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.reject)}}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:`AT`,data:{uid:e.uid,type:this.type,source:this.id}}))}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:`RMT`,data:{uid:e.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class fe extends t.E{constructor(e,n,r,i){super(),this.id=e,this.dispatcher=r,this.setEventedParent(i),this.type=`raster`,this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme=`xyz`,this.tileSize=512,this._loaded=!1,this._options=t.e({type:`raster`},n),t.e(this,t.V(n,[`url`,`scheme`,`tileSize`]))}load(){return t._(this,arguments,void 0,(function*(e=!1){this._loaded=!1,this.fire(new t.n(`dataloading`,{dataType:`source`})),this._tileJSONRequest=new AbortController;try{let n=yield le(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,n&&(t.e(this,n),n.bounds&&(this.tileBounds=new ue(n.bounds,this.minzoom,this.maxzoom)),this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`metadata`})),this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`content`,sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,t.$(e)||this.fire(new t.l(t.d(e)))}}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}setSourceProperty(e){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}serialize(){return t.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return t._(this,void 0,void 0,(function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let r=yield u.getImage(yield this.map._requestManager.transformRequest(n,`Tile`),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state=`unloaded`);if(r?.data){this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&e.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});let n=this.map.painter.context,i=n.gl,a=r.data;e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0}):(e.texture=new t.T(n,a,i.RGBA,{useMipmap:!0}),e.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_NEAREST)),e.state=`loaded`}}catch(t){if(delete e.abortController,e.aborted)e.state=`unloaded`;else if(t)throw e.state=`errored`,t}}))}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)}))}hasTransition(){return!1}}class pe extends fe{constructor(e,n,r,i){super(e,n,r,i),this.type=`raster-dem`,this.maxzoom=22,this._options=t.e({type:`raster-dem`},n),this.encoding=n.encoding||`mapbox`,this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(e){return t._(this,void 0,void 0,(function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=yield this.map._requestManager.transformRequest(n,`Tile`);e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let n=yield u.getImage(r,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state=`unloaded`);if(n?.data){let r=n.data;this.map._refreshExpiredTiles&&(n.cacheControl||n.expires)&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires});let i=t.b(r)&&t.a0()?r:yield this.readImageNow(r),a={type:this.type,uid:e.uid,source:this.id,rawImageData:i,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(e.actor&&e.state!==`expired`&&e.state!==`reloading`)return;e.actor&&e.state!==`expired`||(e.actor=this.dispatcher.getActor()),e.dem=yield e.actor.sendAsync({type:`LDT`,data:a}),e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state=`loaded`}}catch(t){if(delete e.abortController,e.aborted)e.state=`unloaded`;else if(t)throw e.state=`errored`,t}}))}readImageNow(e){return t._(this,void 0,void 0,(function*(){if(typeof VideoFrame<`u`&&t.a1()){let n=e.width+2,r=e.height+2;try{return new t.R({width:n,height:r},yield t.a2(e,-1,-1,n,r))}catch{}}return s.getImageData(e,1)}))}_getNeighboringTiles(e){let n=e.canonical,r=2**n.z,i=(n.x-1+r)%r,a=n.x===0?e.wrap-1:e.wrap,o=(n.x+1+r)%r,s=n.x+1===r?e.wrap+1:e.wrap,c={};return c[new t.a3(e.overscaledZ,a,n.z,i,n.y).key]={backfilled:!1},c[new t.a3(e.overscaledZ,s,n.z,o,n.y).key]={backfilled:!1},n.y>0&&(c[new t.a3(e.overscaledZ,a,n.z,i,n.y-1).key]={backfilled:!1},c[new t.a3(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},c[new t.a3(e.overscaledZ,s,n.z,o,n.y-1).key]={backfilled:!1}),n.y+1<r&&(c[new t.a3(e.overscaledZ,a,n.z,i,n.y+1).key]={backfilled:!1},c[new t.a3(e.overscaledZ,e.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},c[new t.a3(e.overscaledZ,s,n.z,o,n.y+1).key]={backfilled:!1}),c}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state=`unloaded`,e.actor&&(yield e.actor.sendAsync({type:`RDT`,data:{type:this.type,uid:e.uid,source:this.id}}))}))}}function me(e,t){return t?e.properties[t]:e.id}function he(e,t){let n={id:e.id};if(t.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(let n of t.removeProperties){let t=e.addOrUpdateProperties.findIndex((e=>e.key===n));t>-1&&e.addOrUpdateProperties.splice(t,1)}return(e.removeAllProperties||t.removeAllProperties)&&(n.removeAllProperties=!0),(e.removeProperties||t.removeProperties)&&(n.removeProperties=[...e.removeProperties||[],...t.removeProperties||[]]),(e.addOrUpdateProperties||t.addOrUpdateProperties)&&(n.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(e.newGeometry||t.newGeometry)&&(n.newGeometry=t.newGeometry||e.newGeometry),n}function ge(e){if(!e)return{};let t={};return t.removeAll=e.removeAll,t.remove=new Set(e.remove||[]),t.add=new Map(e.add?.map((e=>[e.id,e]))),t.update=new Map(e.update?.map((e=>[e.id,e]))),t}function _e(e){return e&&e.length!==0?typeof e[0]==`number`?[e]:e.flatMap((e=>_e(e))):[]}function ve(e){return e.type===`GeometryCollection`?e.geometries.flatMap((e=>ve(e))):_e(e.coordinates)}function ye(e){let t=new M,n;switch(e.type){case`FeatureCollection`:n=e.features.flatMap((e=>ve(e.geometry)));break;case`Feature`:n=ve(e.geometry);break;default:n=ve(e)}if(n.length===0)return t;for(let e of n){let[n,r]=e;t.extend([n,r])}return t}class be extends t.E{constructor(e,n,r,i){super(),this.id=e,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:n.data},this.actor=r.getActor(),this.setEventedParent(i),this._data=typeof n.data==`string`?{url:n.data}:{geojson:n.data},this._options=t.e({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId,n.clusterMaxZoom!==void 0&&this.maxzoom<=n.clusterMaxZoom&&t.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${n.clusterMaxZoom}".`),this.workerOptions=t.e({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(n.buffer===void 0?128:n.buffer),tolerance:this._pixelsToTileUnits(n.tolerance===void 0?.375:n.tolerance),extent:t.a6,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1,promoteId:typeof n.promoteId==`string`?n.promoteId:void 0,cluster:n.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(n.clusterMaxZoom),minPoints:Math.max(2,n.clusterMinPoints||2),extent:t.a6,radius:this._pixelsToTileUnits(n.clusterRadius||50),log:!1,generateId:n.generateId||!1}},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(e){return e*(t.a6/this.tileSize)}_getClusterMaxZoom(e){let n=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||t.w(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${n}"`),n}load(){return t._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(e){this.map=e,this.load()}setData(e,t){this._data=typeof e==`string`?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e};let n=this._updateWorkerData();return t?n:this}updateData(e,t){this._pendingWorkerUpdate.diff=function(e,t){if(!e)return t||{};if(!t)return e||{};let n=ge(e),r=ge(t);(function(e,t){t.removeAll&&(e.add.clear(),e.update.clear(),e.remove.clear(),t.remove.clear());for(let n of t.remove)e.add.delete(n),e.update.delete(n);for(let[n,r]of t.update){let i=e.update.get(n);i&&(t.update.set(n,he(i,r)),e.update.delete(n))}})(n,r);let i={};if((n.removeAll||r.removeAll)&&(i.removeAll=!0),i.remove=new Set([...n.remove,...r.remove]),i.add=new Map([...n.add,...r.add]),i.update=new Map([...n.update,...r.update]),i.remove.size&&i.add.size)for(let e of i.add.keys())i.remove.delete(e);return function(e){let t={};return e.removeAll&&(t.removeAll=e.removeAll),e.remove&&(t.remove=Array.from(e.remove)),e.add&&(t.add=Array.from(e.add.values())),e.update&&(t.update=Array.from(e.update.values())),t}(i)}(this._pendingWorkerUpdate.diff,e);let n=this._updateWorkerData();return t?n:this}getData(){return t._(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 t._(this,void 0,void 0,(function*(){return ye(yield this.getData())}))}setClusterOptions(e){return this.workerOptions.geojsonVtOptions.cluster=e.cluster,e.clusterRadius!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:`GCEZ`,data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:`GCC`,data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,t,n){return this.actor.sendAsync({type:`GCL`,data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:n}})}_updateWorkerData(){return t._(this,void 0,void 0,(function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void t.w(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:e,diff:n,updateCluster:r}=this._pendingWorkerUpdate,i=this._getLoadGeoJSONParameters(e,n,r);e===void 0?n?this._pendingWorkerUpdate.diff=void 0:r&&(this._pendingWorkerUpdate.updateCluster=void 0):this._pendingWorkerUpdate.data=void 0,yield this._dispatchWorkerUpdate(i)}))}_getLoadGeoJSONParameters(e,n,r){return t._(this,void 0,void 0,(function*(){let i=t.e({type:this.type},this.workerOptions);return typeof e==`string`?(i.request=yield this.map._requestManager.transformRequest(s.resolveURL(e),`Source`),i.request.collectResourceTiming=this._collectResourceTiming,i):e===void 0?n?(i.dataDiff=n,i):r?(i.updateCluster=!0,i):void 0:(i.data=e,i)}))}_dispatchWorkerUpdate(e){return t._(this,void 0,void 0,(function*(){this._isUpdatingWorker=!0,this.fire(new t.n(`dataloading`,{dataType:`source`}));try{let n=yield e,r=yield this.actor.sendAsync({type:`LD`,data:n});if(this._isUpdatingWorker=!1,this._removed||r.abandoned)return void this.fire(new t.n(`dataabort`,{dataType:`source`}));r.data&&(this._data={geojson:r.data});let i=this._applyDiffToSource(n.dataDiff),a=this._getShouldReloadTileOptions(i),o={dataType:`source`};this._applyResourceTiming(o,r),this.fire(new t.n(`data`,Object.assign(Object.assign({},o),{sourceDataType:`metadata`}))),this.fire(new t.n(`data`,Object.assign(Object.assign({},o),{sourceDataType:`content`,shouldReloadTileOptions:a})))}catch(e){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new t.n(`dataabort`,{dataType:`source`}));this.fire(new t.l(t.d(e)))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}}))}_applyResourceTiming(e,n){if(!this._collectResourceTiming)return;let r=n.resourceTiming?.[this.id];if(!r)return;let i=r.slice(0);i!=null&&i.length&&t.e(e,{resourceTiming:i})}_applyDiffToSource(e){if(!e)return;let t=typeof this.promoteId==`string`?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let e=function(e,t){let n=new Map;if(e==null||e.type==null)return n;if(e.type===`Feature`){let r=me(e,t);return r==null?void 0:(n.set(r,e),n)}if(e.type===`FeatureCollection`){let r=new Set;for(let i of e.features){let e=me(i,t);if(e==null||r.has(e))return;r.add(e),n.set(e,i)}return n}}(this._data.geojson,t);if(!e)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:e}}if(!this._data.updateable)return;let n=function(e,t,n){let r=[];if(t.removeAll)e.clear();else if(t.remove)for(let n of t.remove){let t=e.get(n);t&&(r.push(t.geometry),e.delete(n))}if(t.add)for(let i of t.add){let t=me(i,n);if(t==null)continue;let a=e.get(t);a&&r.push(a.geometry),r.push(i.geometry),e.set(t,i)}if(t.update)for(let n of t.update){let t=e.get(n.id);if(!t)continue;let i=!!n.newGeometry,a=n.removeAllProperties||n.removeProperties?.length>0||n.addOrUpdateProperties?.length>0;if(!i&&!a)continue;r.push(t.geometry);let o=Object.assign({},t);if(e.set(n.id,o),i&&(r.push(n.newGeometry),o.geometry=n.newGeometry),a){if(o.properties=n.removeAllProperties?{}:Object.assign({},o.properties||{}),n.removeProperties)for(let e of n.removeProperties)delete o.properties[e];if(n.addOrUpdateProperties)for(let{key:e,value:t}of n.addOrUpdateProperties)o.properties[e]=t}}return r}(this._data.updateable,e,t);return e.removeAll||this._options.cluster?void 0:n}_getShouldReloadTileOptions(e){if(e)return{affectedBounds:e.filter(Boolean).map((e=>ye(e)))}}shouldReloadTile(e,{affectedBounds:n}){if(e.state===`loading`)return!0;if(e.state===`unloaded`)return!1;let{buffer:r,extent:i}=this.workerOptions.geojsonVtOptions,a=function({x:e,y:n,z:r},i=0){let a=t.a4((e-i)/2**r),o=t.a5((n+1+i)/2**r),s=t.a4((e+1+i)/2**r),c=t.a5((n-i)/2**r);return new M([a,o],[s,c])}(e.tileID.canonical,r/i);for(let e of n)if(a.intersects(e))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(e){return t._(this,void 0,void 0,(function*(){let t=e.actor?`RT`:`LT`;e.actor=this.actor;let n={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.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};e.abortController=new AbortController;let r=yield this.actor.sendAsync({type:t,data:n},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.painter,t===`RT`)}))}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:`RMT`,data:{uid:e.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 t.e({},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 xe extends t.E{constructor(e,t,n,r){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=n,this.coordinates=t.coordinates,this.type=`image`,this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=t}load(e){return t._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new t.n(`dataloading`,{dataType:`source`})),this.url=this.options.url,this._request=new AbortController;try{let t=yield u.getImage(yield this.map._requestManager.transformRequest(this.url,`Image`),this._request);this._request=null,this._loaded=!0,t!=null&&t.data&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(e){this._request=null,this._loaded=!0,t.$(e)||this.fire(new t.l(t.d(e)))}}))}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&=(this._request.abort(),null),this.options.url=e.url,this.load(e.coordinates).finally((()=>this.texture=null)),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`metadata`})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&=(this._request.abort(),null)}setCoordinates(e){this.coordinates=e;let n=e.map(t.a7.fromLngLat);var r;return this.tileID=function(e){let n=t.a8.fromPoints(e),r=n.width(),i=n.height(),a=Math.max(0,Math.floor(-Math.log(Math.max(r,i))/Math.LN2)),o=2**a;return new t.aa(a,Math.floor((n.minX+n.maxX)/2*o),Math.floor((n.minY+n.maxY)/2*o))}(n),this.terrainTileRanges=this._getOverlappingTileRanges(n),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=n.map((e=>this.tileID.getTilePoint(e)._round())),this.flippedWindingOrder=((r=this.tileCoords)[1].x-r[0].x)*(r[2].y-r[0].y)-(r[1].y-r[0].y)*(r[2].x-r[0].x)<0,this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`content`})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,n=e.gl;this.texture||(this.texture=new t.T(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,r=!0)}r&&this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`idle`,sourceId:this.id}))}loadTile(e){return t._(this,void 0,void 0,(function*(){this.tileID?.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state=`errored`}))}serialize(){return{type:`image`,url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){let{minX:n,minY:r,maxX:i,maxY:a}=t.a8.fromPoints(e),o={};for(let e=0;e<=t.a9;e++){let t=2**e,s=Math.floor(n*t),c=Math.floor(r*t),l=Math.floor(i*t),u=Math.floor(a*t),d=(s%t+t)%t,f=l%t;o[e]={minWrap:Math.floor(s/t),maxWrap:Math.floor(l/t),minTileXWrapped:d,maxTileXWrapped:f,minTileY:c,maxTileY:u}}return o}}class Se extends xe{constructor(e,t,n,r){super(e,t,n,r),this._onPlayingHandler=()=>{var e;(e=this.map)==null||e.triggerRepaint()},this.roundZoom=!0,this.type=`video`,this.options=t}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push((yield this.map._requestManager.transformRequest(t,`Source`)).url);try{let e=yield t.ab(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 t.l(t.d(e)))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let n=this.video.seekable;e<n.start(0)||e>n.end(0)?this.fire(new t.l(new t.ac(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,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 e=this.map.painter.context,n=e.gl;this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new t.T(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,r=!0)}r&&this.fire(new t.n(`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 Ce extends xe{constructor(e,n,r,i){super(e,n,r,i),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some((e=>!Array.isArray(e)||e.length!==2||e.some((e=>typeof e!=`number`))))||this.fire(new t.l(new t.ac(`sources.${e}`,null,`"coordinates" property must be an array of 4 longitude/latitude array pairs`))):this.fire(new t.l(new t.ac(`sources.${e}`,null,`missing required property "coordinates"`))),n.animate&&typeof n.animate!=`boolean`&&this.fire(new t.l(new t.ac(`sources.${e}`,null,`optional "animate" property must be a boolean value`))),n.canvas?typeof n.canvas==`string`||n.canvas instanceof HTMLCanvasElement||this.fire(new t.l(new t.ac(`sources.${e}`,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 t.l(new t.ac(`sources.${e}`,null,`missing required property "canvas"`))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!0,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 t.l(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(),!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let n=this.map.painter.context,r=n.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new t.T(n,this.canvas,r.RGBA,{premultiply:!0}),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,i=!0)}i&&this.fire(new t.n(`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 e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}let we={},Te=e=>{switch(e){case`geojson`:return be;case`image`:return xe;case`raster`:return fe;case`raster-dem`:return pe;case`vector`:return de;case`video`:return Se;case`canvas`:return Ce}return we[e]},Ee=`RTLPluginLoaded`;class De extends t.E{constructor(){super(...arguments),this.status=`unavailable`,this.url=null,this.dispatcher=ie()}_syncState(e){return this.status=e,this.dispatcher.broadcast(`SRPS`,{pluginStatus:e,pluginURL:this.url}).catch((e=>{throw this.status=`error`,e}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status=`unavailable`,this.url=null}setRTLTextPlugin(e){return t._(this,arguments,void 0,(function*(e,t=!1){if(this.url)throw Error(`setRTLTextPlugin cannot be called multiple times.`);if(this.url=s.resolveURL(e),!this.url)throw Error(`requested url ${e} is invalid`);if(this.status===`unavailable`){if(!t)return this._requestImport();this.status=`deferred`,this._syncState(this.status)}else if(this.status===`requested`)return this._requestImport()}))}_requestImport(){return t._(this,void 0,void 0,(function*(){yield this._syncState(`loading`),this.status=`loaded`,this.fire(new t.n(Ee))}))}lazyLoad(){this.status===`unavailable`?this.status=`requested`:this.status===`deferred`&&this._requestImport()}}let Oe=null;function ke(){return Oe||=new De,Oe}var Ae,je;(function(e){e[e.Base=0]=`Base`,e[e.Parent=1]=`Parent`})(Ae||={}),function(e){e[e.Departing=0]=`Departing`,e[e.Incoming=1]=`Incoming`}(je||={});class Me{constructor(e,n){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=t.ad(),this.uses=0,this.tileSize=n,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(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t,fadingParentID:n,fadeEndTime:r}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t,this.fadingParentID=n,this.fadeEndTime=r}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=l(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state===`errored`||this.state===`loaded`||this.state===`reloading`}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,n,r){if(!0!==e?.etagUnmodified)if(this.hasData()&&this.unloadVectorData(),this.state=`loaded`,e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestEncoding=e.encoding,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,t){let n={};if(!t)return n;for(let r of e){let e=r.layerIds.map((e=>t.getLayer(e))).filter(Boolean);if(e.length!==0){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(let t of e)n[t.id]=r}}return n}(e.buckets,n?.style),this.hasSymbolBuckets=!1;for(let e in this.buckets){let n=this.buckets[e];if(n instanceof t.af){if(this.hasSymbolBuckets=!0,!r)break;n.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let e in this.buckets){let n=this.buckets[e];if(n instanceof t.af&&n.hasRTLText){this.hasRTLText=!0,ke().lazyLoad();break}}this.queryPadding=0;for(let e in this.buckets){let t=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(e).queryRadius(t))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}else this.collisionBoxArray=new t.ae;else this.state=`loaded`}unloadVectorData(){for(let e in this.buckets)this.buckets[e].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(e){return this.buckets[e.id]}upload(e){for(let t in this.buckets){let n=this.buckets[t];n.uploadPending()&&n.upload(e)}let n=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new t.T(e,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&=(this.glyphAtlasTexture=new t.T(e,this.glyphAtlasImage,n.ALPHA),null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,n,r,i,a,o,s,c,l,u){return this.latestFeatureIndex?.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:i,scale:a,tileSize:this.tileSize,pixelPosMatrix:l,transform:s,params:o,queryPadding:this.queryPadding*c,getElevation:u},e,t,n):{}}querySourceFeatures(e,n){let r=this.latestFeatureIndex;if(!r?.rawTileData)return;let i=r.loadVTLayers(),a=n?.sourceLayer?n.sourceLayer:``,o=i[t.ag]||i[a];if(!o)return;let s=t.ah(n?.filter,n?.globalState),{z:c,x:l,y:u}=this.tileID.canonical,d={z:c,x:l,y:u};for(let n=0;n<o.length;n++){let i=o.feature(n);if(s.needGeometry){let e=t.ai(i,!0);if(!s.filter(new t.J(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!s.filter(new t.J(this.tileID.overscaledZ),i))continue;let f=r.getId(i,a),p=new t.aj(i,c,l,u,f);p.tile=d,e.push(p)}}hasData(){return this.state===`loaded`||this.state===`reloading`||this.state===`expired`}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let n=this.expirationTime;if(e.cacheControl){let n=t.ak(e.cacheControl);n[`max-age`]&&(this.expirationTime=Date.now()+1e3*n[`max-age`])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let e=Date.now(),t=!1;if(this.expirationTime>e)t=!1;else if(n)if(this.expirationTime<n)t=!0;else{let r=this.expirationTime-n;r?this.expirationTime=e+Math.max(r,3e4):t=!0}else t=!0;t?(this.expiredRequestCount++,this.state=`expired`):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),2**31-1)}setFeatureState(e,n){if(!this.latestFeatureIndex?.rawTileData||Object.keys(e).length===0)return;let r=this.latestFeatureIndex.loadVTLayers();for(let i in this.buckets){if(!n.style.hasLayer(i))continue;let a=this.buckets[i],o=a.layers[0].sourceLayer||t.ag,s=r[o],c=e[o];if(!s||!c||Object.keys(c).length===0)continue;a.update(c,s,this.imageAtlas?.patternPositions||{},this.dashPositions||{});let l=(n?.style)?.getLayer(i);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(a)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<l()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=l()+e}setDependencies(e,t){let n={};for(let e of t)n[e]=!0;this.dependencies[e]=n}hasDependency(e,t){for(let n of e){let e=this.dependencies[n];if(e){for(let n of t)if(e[n])return!0}}return!1}}class Ne{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(e,n,r){var i,a;let o=String(n);if((i=this.stateChanges)[e]||(i[e]={}),(a=this.stateChanges[e])[o]||(a[o]={}),t.e(this.stateChanges[e][o],r),this.deletedStates[e]===null){this.deletedStates[e]={};for(let t in this.state[e])t!==o&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]?.[o]===null){this.deletedStates[e][o]={};for(let t in this.state[e][o])r[t]||(this.deletedStates[e][o][t]=null)}else for(let t in r)this.deletedStates[e]?.[o]?.[t]===null&&delete this.deletedStates[e][o][t]}removeFeatureState(e,t,n){var r,i;if(this.deletedStates[e]===null)return;let a=String(t);if((r=this.deletedStates)[e]||(r[e]={}),n&&t!==void 0)this.deletedStates[e][a]!==null&&((i=this.deletedStates[e])[a]||(i[a]={}),this.deletedStates[e][a][n]=null);else if(t!==void 0)if(this.stateChanges[e]?.[a])for(n in this.deletedStates[e][a]={},this.stateChanges[e][a])this.deletedStates[e][a][n]=null;else this.deletedStates[e][a]=null;else this.deletedStates[e]=null}getState(e,n){let r=String(n),i=t.e({},(this.state[e]||{})[r],(this.stateChanges[e]||{})[r]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let t=this.deletedStates[e][n];if(t===null)return{};for(let e in t)delete i[e]}return i}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,n){var r,i,a;let o={};for(let e in this.stateChanges){(r=this.state)[e]||(r[e]={});let n={};for(let r in this.stateChanges[e])(i=this.state[e])[r]||(i[r]={}),t.e(this.state[e][r],this.stateChanges[e][r]),n[r]=this.state[e][r];o[e]=n}for(let e in this.deletedStates){(a=this.state)[e]||(a[e]={});let n={};if(this.deletedStates[e]===null)for(let t in this.state[e])n[t]={},this.state[e][t]={};else for(let t in this.deletedStates[e]){if(this.deletedStates[e][t]===null)this.state[e][t]={};else for(let n of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][n];n[t]=this.state[e][t]}o[e]||(o[e]={}),t.e(o[e],n)}this.stateChanges={},this.deletedStates={},Object.keys(o).length!==0&&(this.revision++,e.setFeatureState(o,n))}}let Pe=89.25;function Fe(e,n){let r=t.al(n.lat,-t.am,t.am);return new t.P(t.Z(n.lng)*e,t.Y(r)*e)}function Ie(e,n){return new t.a7(n.x/e,n.y/e).toLngLat()}function Le(e){return e.cameraToCenterDistance*Math.min(.85*Math.tan(t.an(90-e.pitch)),Math.tan(t.an(Pe-e.pitch)))}function Re(e,n){let r=e.canonical,i=n/t.ao(r.z),a=r.x+2**r.z*e.wrap,o=t.ap(new Float64Array(16));return t.Q(o,o,[a*i,r.y*i,0]),t.S(o,o,[i/t.a6,i/t.a6,1]),o}function ze(e,n,r,i,a){let o=t.a7.fromLngLat(e,n),s=a*t.aq(1,e.lat),{x:c,y:l,z:u}=Be(r,i);return new t.a7(o.x+s*-c,o.y+s*-l,o.z+s*-u)}function Be(e,n){let r=t.an(e),i=t.an(n),a=Math.cos(-r),o=Math.sin(r);return{x:o*Math.sin(i),y:-o*Math.cos(i),z:a}}function N(e,t,n){let r=t.intersectsFrustum(e);if(!n||r===0)return r;let i=t.intersectsPlane(n);return i===0?0:r===2&&i===2?2:1}function Ve(e,t,n){let r=0,i=(n-t)/10;for(let a=0;a<10;a++)r+=i*Math.cos(t+(a+.5)/10*(n-t))**+e;return r}function He(e,n){return function(r,i,a,o,s){let c=2*((e-1)/t.ar(Math.cos(t.an(Pe-s))/Math.cos(t.an(Pe)))-1),l=Math.acos(a/o),u=2*Ve(c-1,0,t.an(s/2)),d=Math.min(t.an(Pe),l+t.an(s/2)),f=Ve(c-1,Math.min(d,l-t.an(s/2)),d),p=Math.atan(i/a),m=Math.hypot(i,a),h=r;return h+=t.ar(o/m/Math.max(.5,Math.cos(t.an(s/2)))),h+=c*t.ar(Math.cos(p))/2,h-=t.ar(Math.max(1,f/u/n))/2,h}}let P=He(9.314,3);function Ue(e,n){let r=(n.roundZoom?Math.round:Math.floor)(e.zoom+t.ar(e.tileSize/n.tileSize));return Math.max(0,r)}function We(e,n){let r=e.getCameraFrustum(),i=e.getClippingPlane(),a=e.screenPointToMercatorCoordinate(e.getCameraPoint()),o=t.a7.fromLngLat(e.center,e.elevation);a.z=o.z+Math.cos(e.pitchInRadians)*e.cameraToCenterDistance/e.worldSize;let s=e.getCoveringTilesDetailsProvider(),c=s.allowVariableZoom(e,n),l=Ue(e,n),u=n.minzoom||0,d=n.maxzoom===void 0?e.maxZoom:n.maxzoom,f=Math.min(Math.max(0,l),d),p=2**f,m=[p*a.x,p*a.y,0],h=[p*o.x,p*o.y,0],g=Math.hypot(o.x-a.x,o.y-a.y),_=Math.abs(o.z-a.z),v=Math.hypot(g,_),y=e=>({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),b=[],x=[];if(e.renderWorldCopies&&s.allowWorldCopies())for(let e=1;e<=3;e++)b.push(y(-e)),b.push(y(e));for(b.push(y(0));b.length>0;){let p=b.pop(),g=p.x,y=p.y,S=p.fullyVisible,C={x:g,y,z:p.zoom},w=s.getTileBoundingVolume(C,p.wrap,e.elevation,n);if(!S){let e=N(r,w,i);if(e===0)continue;S=e===2}let T=s.distanceToTile2d(a.x,a.y,C,w),E=l;c&&(E=(n.calculateTileZoom||P)(e.zoom+t.ar(e.tileSize/n.tileSize),T,_,v,e.fov)),E=(n.roundZoom?Math.round:Math.floor)(E),E=Math.max(0,E);let D=Math.min(E,d);if(p.wrap=s.getWrap(o,C,p.wrap),p.zoom>=D){if(p.zoom<u)continue;let e=f-p.zoom,r=m[0]-.5-(g<<e),i=m[1]-.5-(y<<e),a=n.reparseOverscaled?Math.max(p.zoom,E):p.zoom;x.push({tileID:new t.a3(p.zoom===d?a:p.zoom,p.wrap,p.zoom,g,y),distanceSq:t.as([h[0]-.5-g,h[1]-.5-y]),tileDistanceToCamera:Math.sqrt(r*r+i*i)})}else for(let e=0;e<4;e++)b.push({zoom:p.zoom+1,x:(g<<1)+e%2,y:(y<<1)+(e>>1),wrap:p.wrap,fullyVisible:S})}return x.sort(((e,t)=>e.distanceSq-t.distanceSq)).map((e=>e.tileID))}let Ge=t.a8.fromPoints([new t.P(0,0),new t.P(t.a6,t.a6)]);function Ke(e){return e===`raster`||e===`image`||e===`video`}function qe(e,t,n,r,i,a,o){if(!t.hasData())return!1;let{tileID:s,fadingRole:c,fadingDirection:l,fadingParentID:u}=t;if(c===Ae.Base&&l===je.Incoming&&u)return n[u.key]=u,!0;let d=Math.max(s.overscaledZ-i,a);for(let i=s.overscaledZ-1;i>=d;i--){let a=s.scaledTo(i),c=e.getLoadedTile(a);if(c)return t.setCrossFadeLogic({fadingRole:Ae.Base,fadingDirection:je.Incoming,fadingParentID:c.tileID,fadeEndTime:r+o}),c.setCrossFadeLogic({fadingRole:Ae.Parent,fadingDirection:je.Departing,fadeEndTime:r+o}),n[a.key]=a,!0}return!1}function Je(e,t,n,r,i,a){if(!t.hasData())return!1;let o=t.tileID.children(i),s=Ye(e,t,o,n,r,i,a);if(s)return!0;for(let c of o)Ye(e,t,c.children(i),n,r,i,a)&&(s=!0);return s}function Ye(e,t,n,r,i,a,o){if(n[0].overscaledZ>=a)return!1;let s=!1;for(let a of n){let n=e.getLoadedTile(a);if(!n)continue;let{fadingRole:c,fadingDirection:l,fadingParentID:u}=n;c===Ae.Base&&l===je.Departing&&u||(n.setCrossFadeLogic({fadingRole:Ae.Base,fadingDirection:je.Departing,fadingParentID:t.tileID,fadeEndTime:i+o}),t.setCrossFadeLogic({fadingRole:Ae.Parent,fadingDirection:je.Incoming,fadeEndTime:i+o})),r[a.key]=a,s=!0}return s}function Xe(e,t,n,r){let i=e.tileID;return!!e.selfFading||!e.hasData()&&!!t.has(i)&&(e.setSelfFadeLogic(n+r),!0)}function F(e,t){var n;e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0;let r=t.tileID.canonical.x-e.tileID.canonical.x,i=t.tileID.canonical.y-e.tileID.canonical.y,a=2**e.tileID.canonical.z,o=t.tileID.key;r===0&&i===0||Math.abs(i)>1||(Math.abs(r)>1&&(Math.abs(r+a)===1?r+=a:Math.abs(r-a)===1&&(r-=a)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,r,i),(n=e.neighboringTiles)!=null&&n[o]&&(e.neighboringTiles[o].backfilled=!0)))}class Ze{constructor(){this._tiles={}}handleWrapJump(e){let t={};for(let n in this._tiles){let r=this._tiles[n];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t[r.tileID.key]=r}this._tiles=t}setFeatureState(e,t){for(let n in this._tiles)this._tiles[n].setFeatureState(e,t)}getAllTiles(){return Object.values(this._tiles)}getAllIds(e=!1){return e?Object.values(this._tiles).map((e=>e.tileID)).sort(t.au).map((e=>e.key)):Object.keys(this._tiles)}getTileById(e){return this._tiles[e]}setTile(e,t){this._tiles[e]=t}deleteTileById(e){delete this._tiles[e]}getLoadedTile(e){let t=this.getTileById(e.key);return t?.hasData()?t:null}isIdRenderable(e,t=!1){return this.getTileById(e)?.isRenderable(t)}getRenderableIds(e=0,n){let r=[];for(let e of this.getAllIds())this.isIdRenderable(e,n)&&r.push(this.getTileById(e));return n?r.sort(((n,r)=>{let i=n.tileID,a=r.tileID,o=new t.P(i.canonical.x,i.canonical.y)._rotate(-e),s=new t.P(a.canonical.x,a.canonical.y)._rotate(-e);return i.overscaledZ-a.overscaledZ||s.y-o.y||s.x-o.x})).map((e=>e.tileID.key)):r.map((e=>e.tileID)).sort(t.au).map((e=>e.key))}}class Qe extends t.E{constructor(e,n,r){super(),this.id=e,this.dispatcher=r,this.on(`data`,(e=>{this._dataHandler(e)})),this.on(`dataloading`,(()=>{this._sourceErrored=!1})),this.on(`error`,(()=>{this._sourceErrored=this._source.loaded()})),this._source=((e,t,n,r)=>{let i=new(Te(t.type))(e,t,n,r);if(i.id!==e)throw Error(`Expected Source id to be ${e} instead of ${i.id}`);return i})(e,n,r,this),this._inViewTiles=new Ze,this._outOfViewCache=new t.av(0,(e=>this._unloadTile(e))),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new Ne,this._didEmitContent=!1,this._updated=!1}onAdd(e){var t;this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,(t=this._source)!=null&&t.onAdd&&this._source.onAdd(e)}onRemove(e){var t;for(let e of this._inViewTiles.getAllTiles())e.unloadVectorData();this.clearTiles(),(t=this._source)!=null&&t.onRemove&&this._source.onRemove(e),this._inViewTiles=new Ze}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!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 e of this._inViewTiles.getAllTiles())if(e.state!==`loaded`&&e.state!==`errored`)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,n,r){return t._(this,void 0,void 0,(function*(){try{let t=yield this._source.loadTile(e);this._tileLoaded(e,n,r,t)}catch(n){e.state=`errored`,n.status===404?this.update(this.transform,this.terrain):this._source.fire(new t.l(t.d(n),{tile:e}))}}))}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new t.n(`dataabort`,{tile:e,coord:e.tileID,dataType:`source`}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(let t of this._inViewTiles.getAllTiles())t.upload(e),t.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(e){return this._inViewTiles.getRenderableIds(this.transform?.bearingInRadians,e)}hasRenderableParent(e){let t=e.overscaledZ-1;if(t>=this._source.minzoom){let n=this.getLoadedTile(e.scaledTo(t));if(n)return this._inViewTiles.isIdRenderable(n.tileID.key)}return!1}reload(e,t=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(let n of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(n);t&&!this._source.shouldReloadTile(r,t)||(e?this._reloadTile(n,`expired`):r.state!==`errored`&&this._reloadTile(n,`reloading`))}}}_reloadTile(e,n){return t._(this,void 0,void 0,(function*(){let t=this._inViewTiles.getTileById(e);t&&(t.state!==`loading`&&(t.state=n),yield this._loadTile(t,e,n))}))}_tileLoaded(e,n,r,i){e.timeAdded=l(),e.selfFading&&(e.fadeEndTime=e.timeAdded+this._rasterFadeDuration),r===`expired`&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(n,e),i!=null&&i.unmodified||(this.getSource().type===`raster-dem`&&e.dem&&function(e,t){var n;let r=t.getRenderableIds();for(let i of r){if(!e.neighboringTiles?.[i])continue;let r=t.getTileById(i);e.neighboringTiles[i].backfilled||F(e,r),(n=r.neighboringTiles?.[e.tileID.key])!=null&&n.backfilled||F(r,e)}}(e,this._inViewTiles),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.n(`data`,{dataType:`source`,tile:e,coord:e.tileID})))}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._inViewTiles.getTileById(e)}_retainLoadedChildren(e,t){let n=this._getLoadedDescendents(t),r=new Set;for(let i of t){let t=n[i.key];if(!t?.length){r.add(i);continue}let a=i.overscaledZ+Qe.maxOverzooming,o=t.filter((e=>e.tileID.overscaledZ<=a));if(!o.length){r.add(i);continue}let s=Math.min(...o.map((e=>e.tileID.overscaledZ))),c=o.filter((e=>e.tileID.overscaledZ===s)).map((e=>e.tileID));for(let t of c)e[t.key]=t;this._areDescendentsComplete(c,s,i.overscaledZ)||r.add(i)}return r}_getLoadedDescendents(e){var t;let n={};for(let r of this._inViewTiles.getAllTiles().filter((e=>e.hasData())))for(let i of e)r.tileID.isChildOf(i)&&(n[t=i.key]||(n[t]=[]),n[i.key].push(r));return n}_areDescendentsComplete(e,t,n){return e.length===1&&e[0].isOverscaled()?e[0].overscaledZ===t:4**(t-n)===e.length}getLoadedTile(e){return this._inViewTiles.getLoadedTile(e)}updateCacheSize(e){let n=Math.ceil(e.width/this._source.tileSize)+1,r=Math.ceil(e.height/this._source.tileSize)+1,i=Math.floor(n*r*(this._maxTileCacheZoomLevels===null?t.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),a=typeof this._maxTileCacheSize==`number`?Math.min(this._maxTileCacheSize,i):i;this._outOfViewCache.setMaxSize(a)}handleWrapJump(e){let t=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);this._prevLng=e,t&&(this._inViewTiles.handleWrapJump(t),this._resetTileReloadTimers())}update(e,n){if(!this._sourceLoaded||this._paused)return;let r;this.transform=e,this.terrain=n,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.a3(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(r=We(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type===`vector`&&this.map._zoomLevelsToOverscale!==void 0?e.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(r=r.filter((e=>this._source.hasTile(e))))):r=[],this.usedForTerrain&&(r=this._addTerrainIdealTiles(r));let i=r.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,i&&this.fire(new t.n(`data`,{sourceDataType:`idle`,dataType:`source`,sourceId:this.id}));let a=Ue(e,this._source),o=this._updateRetainedTiles(r,a),s=Ke(this._source.type);s&&this._rasterFadeDuration>0&&!n&&function(e,n,r,i,a,o,s){let c=l(),u=t.at(n);for(let t of n){let n=e.getTileById(t.key);n.fadingDirection!==je.Departing&&n.fadeOpacity!==0||n.resetFadeLogic(),qe(e,n,r,c,i,a,s)||Je(e,n,r,c,o,s)||Xe(n,u,c,s)||n.resetFadeLogic()}}(this._inViewTiles,r,o,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),s?this._cleanUpRasterTiles(o):this._cleanUpVectorTiles(o)}_cleanUpRasterTiles(e){for(let t of this._inViewTiles.getAllIds())e[t]||this._removeTile(t)}_cleanUpVectorTiles(e){for(let t of this._inViewTiles.getAllIds()){let n=this._inViewTiles.getTileById(t);e[t]?n.clearSymbolFadeHold():n.hasSymbolBuckets?n.holdingForSymbolFade()?n.symbolFadeFinished()&&this._removeTile(t):n.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(t)}}_addTerrainIdealTiles(e){let t=[];for(let n of e)if(n.canonical.z>this._source.minzoom){let e=n.scaledTo(n.canonical.z-1);t.push(e);let r=n.scaledTo(Math.max(this._source.minzoom,Math.min(n.canonical.z,5)));t.push(r)}return e.concat(t)}releaseSymbolFadeTiles(){for(let e of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(e).holdingForSymbolFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){let n=new Set;for(let t of e)this._addTile(t).hasData()||n.add(t);let r=e.reduce(((e,t)=>(e[t.key]=t,e)),{}),i=this._retainLoadedChildren(r,n),a={},o=Math.max(t-Qe.maxUnderzooming,this._source.minzoom);for(let e of i){let t=this._inViewTiles.getTileById(e.key),n=t?.wasRequested();for(let i=e.overscaledZ-1;i>=o;--i){let o=e.scaledTo(i);if(a[o.key])break;if(a[o.key]=!0,t=this.getTile(o),!t&&n&&(t=this._addTile(o)),t){let e=t.hasData();if((e||!this.map?.cancelPendingTileRequestsWhileZooming||n)&&(r[o.key]=o),n=t.wasRequested(),e)break}}}return r}_addTile(e){let n=this._inViewTiles.getTileById(e.key);if(n)return n;n=this._outOfViewCache.getAndRemove(e),n&&(n.resetFadeLogic(),this._setTileReloadTimer(e.key,n),n.tileID=e,this._state.initializeTileState(n,this.map?this.map.painter:null));let r=n;return n||(n=new Me(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(n,e.key,n.state)),n.uses++,this._inViewTiles.setTile(e.key,n),r||this._source.fire(new t.n(`dataloading`,{tile:n,coord:n.tileID,dataType:`source`})),n}_setTileReloadTimer(e,t){this._clearTileReloadTimer(e);let n=t.getExpiryTimeout();n&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,`expired`),delete this._timers[e]}),n))}_clearTileReloadTimer(e){let t=this._timers[e];t&&(clearTimeout(t),delete this._timers[e])}_resetTileReloadTimers(){for(let e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(let e of this._inViewTiles.getAllIds()){let t=this._inViewTiles.getTileById(e);this._setTileReloadTimer(e,t)}}refreshTiles(e){for(let t of this._inViewTiles.getAllIds()){let n=this._inViewTiles.getTileById(t);(this._inViewTiles.isIdRenderable(t)||n.state==`errored`)&&e.some((e=>e.equals(n.tileID.canonical)))&&this._reloadTile(t,`expired`)}}_removeTile(e){let t=this._inViewTiles.getTileById(e);t&&(t.uses--,this._inViewTiles.deleteTileById(e),this._clearTileReloadTimer(e),t.uses>0||(t.hasData()&&t.state!==`reloading`?this._outOfViewCache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){e.dataType===`source`&&(e.sourceDataType===`metadata`?this._sourceLoaded=!0:e.sourceDataType===`content`&&this._sourceLoaded&&!this._paused&&(this.reload(e.sourceDataChanged,e.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e of this._inViewTiles.getAllIds())this._removeTile(e);this._outOfViewCache.reset()}tilesIn(e,n,r){let i=[],a=this.transform;if(!a)return i;let o=a.getCoveringTilesDetailsProvider().allowWorldCopies(),s=r?a.getCameraQueryGeometry(e):e,c=e=>a.screenPointToMercatorCoordinate(e,this.terrain),l=this.transformBbox(e,c,!o),u=this.transformBbox(s,c,!o),d=this.getIds(),f=t.a8.fromPoints(u);for(let e of d){let r=this._inViewTiles.getTileById(e);if(r.holdingForSymbolFade())continue;let s=o?[r.tileID]:[r.tileID.unwrapTo(-1),r.tileID.unwrapTo(0)],c=2**(a.zoom-r.tileID.overscaledZ),d=n*r.queryPadding*t.a6/r.tileSize/c;for(let e of s){let n=f.map((n=>e.getTilePoint(new t.a7(n.x,n.y))));if(n.expandBy(d),n.intersects(Ge)){let t=l.map((t=>e.getTilePoint(t))),n=u.map((t=>e.getTilePoint(t)));i.push({tile:r,tileID:o?e:e.unwrapTo(0),queryGeometry:t,cameraQueryGeometry:n,scale:c})}}}return i}transformBbox(e,n,r){let i=e.map(n);if(r){let r=t.a8.fromPoints(e);r.shrinkBy(.001*Math.min(r.width(),r.height()));let a=r.map(n);t.a8.fromPoints(i).covers(a)||(i=i.map((e=>e.x>.5?new t.a7(e.x-1,e.y,e.z):e)))}return i}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map((e=>this._inViewTiles.getTileById(e).tileID));return this.transform&&this.transform.populateCache(t),t}hasTransition(){return!!this._source.hasTransition()||Ke(this._source.type)&&function(e,t){if(t<=0)return!1;let n=l();for(let t of e.getAllTiles())if(t.fadeEndTime>=n)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(e){this._rasterFadeDuration=e}setFeatureState(e,n,r){e||=t.ag,this._state.updateState(e,n,r)}removeFeatureState(e,n,r){e||=t.ag,this._state.removeFeatureState(e,n,r)}getFeatureState(e,n){return e||=t.ag,this._state.getState(e,n)}setDependencies(e,t,n){let r=this._inViewTiles.getTileById(e);r&&r.setDependencies(t,n)}reloadTilesForDependencies(e,t){for(let n of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(n).hasDependency(e,t)&&this._reloadTile(n,`reloading`);this._outOfViewCache.filter((n=>!n.hasDependency(e,t)))}areTilesLoaded(){for(let e of this._inViewTiles.getAllTiles())if(e.state!==`loaded`&&e.state!==`errored`)return!1;return!0}}Qe.maxUnderzooming=10,Qe.maxOverzooming=3;class $e{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=t.al(e,0,1);let n=1,r=this._distances[n],i=e*this.paddedLength+this.padding;for(;r<i&&n<this._distances.length;)r=this._distances[++n];let a=n-1,o=this._distances[a],s=r-o,c=s>0?(i-o)/s:0;return this.points[a].mult(1-c).add(this.points[n].mult(c))}}function et(e,t){let n=!0;return e===`always`||e!==`never`&&t!==`never`||(n=!1),n}class I{constructor(e,t,n){let r=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);for(let e=0;e<this.xCellCount*this.yCellCount;e++)r.push([]),i.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,n,r,i){this._forEachCell(t,n,r,i,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(i)}insertCircle(e,t,n,r){this._forEachCell(t-r,n-r,t+r,n+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(n),this.circles.push(r)}_insertBoxCell(e,t,n,r,i,a){this.boxCells[i].push(a)}_insertCircleCell(e,t,n,r,i,a){this.circleCells[i].push(a)}_query(e,t,n,r,i,a,o){if(n<0||e>this.width||r<0||t>this.height)return[];let s=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=r){if(i)return[{key:null,x1:e,y1:t,x2:n,y2:r}];for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){let t=this.circles[3*e],n=this.circles[3*e+1],r=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:t-r,y1:n-r,x2:t+r,y2:n+r})}}else this._forEachCell(e,t,n,r,this._queryCell,s,{hitTest:i,overlapMode:a,seenUids:{box:{},circle:{}}},o);return s}query(e,t,n,r){return this._query(e,t,n,r,!1,null)}hitTest(e,t,n,r,i,a){return this._query(e,t,n,r,!0,i,a).length>0}hitTestCircle(e,t,n,r,i){let a=e-n,o=e+n,s=t-n,c=t+n;if(o<0||a>this.width||c<0||s>this.height)return!1;let l=[];return this._forEachCell(a,s,o,c,this._queryCellCircle,l,{hitTest:!0,overlapMode:r,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}},i),l.length>0}_queryCell(e,t,n,r,i,a,o,s){let{seenUids:c,hitTest:l,overlapMode:u}=o,d=this.boxCells[i],f=1e-6;if(d!==null){let i=this.bboxes;for(let o of d)if(!c.box[o]){c.box[o]=!0;let d=4*o,p=this.boxKeys[o];if(e<=i[d+2]+f&&t<=i[d+3]+f&&n>=i[d+0]-f&&r>=i[d+1]-f&&(!s||s(p))&&(!l||!et(u,p.overlapMode))&&(a.push({key:p,x1:i[d],y1:i[d+1],x2:i[d+2],y2:i[d+3]}),l))return!0}}let p=this.circleCells[i];if(p!==null){let i=this.circles;for(let o of p)if(!c.circle[o]){c.circle[o]=!0;let d=3*o,f=this.circleKeys[o];if(this._circleAndRectCollide(i[d],i[d+1],i[d+2],e,t,n,r)&&(!s||s(f))&&(!l||!et(u,f.overlapMode))){let e=i[d],t=i[d+1],n=i[d+2];if(a.push({key:f,x1:e-n,y1:t-n,x2:e+n,y2:t+n}),l)return!0}}}return!1}_queryCellCircle(e,t,n,r,i,a,o,s){let{circle:c,seenUids:l,overlapMode:u}=o,d=this.boxCells[i];if(d!==null){let e=this.bboxes;for(let t of d)if(!l.box[t]){l.box[t]=!0;let n=4*t,r=this.boxKeys[t];if(this._circleAndRectCollide(c.x,c.y,c.radius,e[n+0],e[n+1],e[n+2],e[n+3])&&(!s||s(r))&&!et(u,r.overlapMode))return a.push(!0),!0}}let f=this.circleCells[i];if(f!==null){let e=this.circles;for(let t of f)if(!l.circle[t]){l.circle[t]=!0;let n=3*t,r=this.circleKeys[t];if(this._circlesCollide(e[n],e[n+1],e[n+2],c.x,c.y,c.radius)&&(!s||s(r))&&!et(u,r.overlapMode))return a.push(!0),!0}}}_forEachCell(e,t,n,r,i,a,o,s){let c=this._convertToXCellCoord(e),l=this._convertToYCellCoord(t),u=this._convertToXCellCoord(n),d=this._convertToYCellCoord(r);for(let f=c;f<=u;f++)for(let c=l;c<=d;c++)if(i.call(this,e,t,n,r,this.xCellCount*c+f,a,o,s))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,n,r,i,a){let o=r-e,s=i-t,c=n+a;return c*c>o*o+s*s}_circleAndRectCollide(e,t,n,r,i,a,o){let s=(a-r)/2,c=Math.abs(e-(r+s));if(c>s+n)return!1;let l=(o-i)/2,u=Math.abs(t-(i+l));if(u>l+n)return!1;if(c<=s||u<=l)return!0;let d=c-s,f=u-l;return d*d+f*f<=n*n}}function L(e,t){let n=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),r=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),i=t[0]*n,a=t[4]*n,o=t[8]*r,s=t[1]*n,c=t[5]*n,l=t[9]*r,u=t[2]*n,d=t[6]*n,f=t[10]*r;e[0]=i,e[1]=a,e[2]=o,e[4]=s,e[5]=c,e[6]=l,e[8]=u,e[9]=d,e[10]=f;let p=t[12],m=t[13],h=t[14];return e[12]=-i*p-s*m-u*h,e[13]=-a*p-c*m-d*h,e[14]=-o*p-l*m-f*h,e[3]=0,e[7]=0,e[11]=0,e[15]=1,e}let R=t.O();function tt(e,n,i){let a=t.O();if(!e){let{vecSouth:e,vecEast:t}=rt(n),i=r();i[0]=t[0],i[1]=t[1],i[2]=e[0],i[3]=e[1],o=i,(f=(c=(s=i)[0])*(d=s[3])-(u=s[2])*(l=s[1]))&&(o[0]=d*(f=1/f),o[1]=-l*f,o[2]=-u*f,o[3]=c*f),a[0]=i[0],a[1]=i[1],a[4]=i[2],a[5]=i[3]}var o,s,c,l,u,d,f;return t.S(a,a,[1/i,1/i,1]),a}function nt(e,n,r,i){if(e){let e=t.O();if(!n){let{vecSouth:t,vecEast:n}=rt(r);e[0]=n[0],e[1]=n[1],e[4]=t[0],e[5]=t[1]}return t.S(e,e,[i,i,1]),e}return r.pixelsToClipSpaceMatrix}function rt(e){let n=Math.cos(e.rollInRadians),r=Math.sin(e.rollInRadians),i=Math.cos(e.pitchInRadians),a=Math.cos(e.bearingInRadians),o=Math.sin(e.bearingInRadians),s=t.az();s[0]=-a*i*r-o*n,s[1]=-o*i*r+a*n;let c=t.aA(s);c<1e-9?t.aB(s):t.aC(s,s,1/c);let l=t.az();l[0]=a*i*n-o*r,l[1]=o*i*n+a*r;let u=t.aA(l);return u<1e-9?t.aB(l):t.aC(l,l,1/u),{vecEast:l,vecSouth:s}}function z(e,n,r,i){let a;i?(a=[e,n,i(e,n),1],t.aE(a,a,r)):(a=[e,n,0,1],yt(a,a,r));let o=a[3];return{point:new t.P(a[0]/o,a[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}function it(e,t){return .5+e/t*.5}function at(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function ot(e,n,r,i,a,o,s,c,l,u,d,f,p){let m=r?e.textSizeData:e.iconSizeData,h=t.aw(m,n.transform.zoom),g=[256/n.width*2+1,256/n.height*2+1],_=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;_.clear();let v=e.lineVertexArray,y=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,b=n.transform.width/n.transform.height,x=!1;for(let r=0;r<y.length;r++){let S=y.get(r);if(S.hidden||S.writingMode===t.ax.vertical&&!x){vt(S.numGlyphs,_);continue}x=!1;let C=new t.P(S.anchorX,S.anchorY),w={getElevation:p,pitchedLabelPlaneMatrix:i,lineVertexArray:v,pitchWithMap:o,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:n.transform,tileAnchorPoint:C,unwrappedTileID:l,width:u,height:d,translation:f},T=pt(S.anchorX,S.anchorY,w);if(!at(T.point,g)){vt(S.numGlyphs,_);continue}let E=it(n.transform.cameraToCenterDistance,T.signedDistanceFromCamera),D=t.ay(m,h,S),O=o?D*n.transform.getPitchedTextCorrection(S.anchorX,S.anchorY,l)/E:D*E,k=lt({projectionContext:w,pitchedLabelPlaneMatrixInverse:a,symbol:S,fontSize:O,flip:!1,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:b,rotateToLine:c});x=k.useVertical,(k.notEnoughRoom||x||k.needsFlipping&&lt({projectionContext:w,pitchedLabelPlaneMatrixInverse:a,symbol:S,fontSize:O,flip:!0,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:b,rotateToLine:c}).notEnoughRoom)&&vt(S.numGlyphs,_)}r?e.text.dynamicLayoutVertexBuffer.updateData(_):e.icon.dynamicLayoutVertexBuffer.updateData(_)}function st(e,t,n,r,i,a,o,s){let c=a.glyphStartIndex+a.numGlyphs,l=a.lineStartIndex,u=a.lineStartIndex+a.lineLength,d=t.getoffsetX(a.glyphStartIndex),f=t.getoffsetX(c-1),p=gt(e*d,n,r,i,a.segment,l,u,s,o);if(!p)return null;let m=gt(e*f,n,r,i,a.segment,l,u,s,o);return m?s.projectionCache.anyProjectionOccluded?null:{first:p,last:m}:null}function ct(e,n,r,i){return e===t.ax.horizontal&&Math.abs(r.y-n.y)>Math.abs(r.x-n.x)*i?{useVertical:!0}:(e===t.ax.vertical?n.y<r.y:n.x>r.x)?{needsFlipping:!0}:null}function lt(e){let{projectionContext:n,pitchedLabelPlaneMatrixInverse:r,symbol:i,fontSize:a,flip:o,keepUpright:s,glyphOffsetArray:c,dynamicLayoutVertexArray:l,aspectRatio:u,rotateToLine:d}=e,f=a/24,p=i.lineOffsetX*f,m=i.lineOffsetY*f,h;if(i.numGlyphs>1){let e=i.glyphStartIndex+i.numGlyphs,t=i.lineStartIndex,a=i.lineStartIndex+i.lineLength,l=st(f,c,p,m,o,i,d,n);if(!l)return{notEnoughRoom:!0};let g=ft(l.first.point.x,l.first.point.y,n,r),_=ft(l.last.point.x,l.last.point.y,n,r);if(s&&!o){let e=ct(i.writingMode,g,_,u);if(e)return e}h=[l.first];for(let r=i.glyphStartIndex+1;r<e-1;r++){let e=gt(f*c.getoffsetX(r),p,m,o,i.segment,t,a,n,d);if(!e)return{notEnoughRoom:!0};h.push(e)}h.push(l.last)}else{if(s&&!o){let e=B(n.tileAnchorPoint.x,n.tileAnchorPoint.y,n).point,a=i.lineStartIndex+i.segment+1,o=new t.P(n.lineVertexArray.getx(a),n.lineVertexArray.gety(a)),s=B(o.x,o.y,n),c=s.signedDistanceFromCamera>0?s.point:ut(n.tileAnchorPoint,o,e,1,n),l=ft(e.x,e.y,n,r),d=ft(c.x,c.y,n,r),f=ct(i.writingMode,l,d,u);if(f)return f}let e=gt(f*c.getoffsetX(i.glyphStartIndex),p,m,o,i.segment,i.lineStartIndex,i.lineStartIndex+i.lineLength,n,d);if(!e||n.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};h=[e]}for(let e of h)t.aD(l,e.point,e.angle);return{}}function ut(e,t,n,r,i){let a=e.add(e.sub(t)._unit()),o=B(a.x,a.y,i).point,s=n.sub(o);return n.add(s._mult(r/s.mag()))}function dt(e,n,r){let i=n.projectionCache;if(i.projections[e])return i.projections[e];let a=new t.P(n.lineVertexArray.getx(e),n.lineVertexArray.gety(e)),o=B(a.x,a.y,n);if(o.signedDistanceFromCamera>0)return i.projections[e]=o.point,i.anyProjectionOccluded||=o.isOccluded,o.point;let s=e-r.direction;return ut(r.distanceFromAnchor===0?n.tileAnchorPoint:new t.P(n.lineVertexArray.getx(s),n.lineVertexArray.gety(s)),a,r.previousVertex,r.absOffsetX-r.distanceFromAnchor+1,n)}function B(e,t,n){let r=e+n.translation[0],i=t+n.translation[1],a;return n.pitchWithMap?(a=z(r,i,n.pitchedLabelPlaneMatrix,n.getElevation),a.isOccluded=!1):(a=n.transform.projectTileCoordinates(r,i,n.unwrappedTileID,n.getElevation),a.point.x=(.5*a.point.x+.5)*n.width,a.point.y=(.5*-a.point.y+.5)*n.height),a}function ft(e,n,r,i){if(r.pitchWithMap){let a=[e,n,0,1];return t.aE(a,a,i),r.transform.projectTileCoordinates(a[0]/a[3],a[1]/a[3],r.unwrappedTileID,r.getElevation).point}return{x:e/r.width*2-1,y:1-n/r.height*2}}function pt(e,t,n){return n.transform.projectTileCoordinates(e,t,n.unwrappedTileID,n.getElevation)}function mt(e,t,n){return e._unit()._perp()._mult(t*n)}function ht(e,n,r,i,a,o,s,c,l){if(c.projectionCache.offsets[e])return c.projectionCache.offsets[e];let u=r.add(n);if(e+l.direction<i||e+l.direction>=a)return c.projectionCache.offsets[e]=u,u;let d=dt(e+l.direction,c,l),f=mt(d.sub(r),s,l.direction),p=r.add(f),m=d.add(f);return c.projectionCache.offsets[e]=t.aF(o,u,p,m)||u,c.projectionCache.offsets[e]}function gt(e,t,n,r,i,a,o,s,c){let l=r?e-t:e+t,u=l>0?1:-1,d=0;r&&(u*=-1,d=Math.PI),u<0&&(d+=Math.PI);let f,p=u>0?a+i:a+i+1;s.projectionCache.cachedAnchorPoint?f=s.projectionCache.cachedAnchorPoint:(f=B(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=f);let m,h,g=f,_=f,v=0,y=0,b=Math.abs(l),x=[],S;for(;v+y<=b;){if(p+=u,p<a||p>=o)return null;v+=y,_=g,h=m;let e={absOffsetX:b,direction:u,distanceFromAnchor:v,previousVertex:_};if(g=dt(p,s,e),n===0)x.push(_),S=g.sub(_);else{let t,r=g.sub(_);t=r.mag()===0?mt(dt(p+u,s,e).sub(g),n,u):mt(r,n,u),h||=_.add(t),m=ht(p,t,g,a,o,h,n,s,e),x.push(h),S=m.sub(h)}y=S.mag()}let C=S._mult((b-v)/y)._add(h||_),w=d+Math.atan2(g.y-_.y,g.x-_.x);return x.push(C),{point:C,angle:c?w:0,path:x}}let _t=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function vt(e,t){for(let n=0;n<e;n++){let e=t.length;t.resize(e+4),t.float32.set(_t,3*e)}}function yt(e,t,n){let r=t[0],i=t[1];return e[0]=n[0]*r+n[4]*i+n[12],e[1]=n[1]*r+n[5]*i+n[13],e[3]=n[3]*r+n[7]*i+n[15],e}class bt{constructor(e,t=new I(e.width+200,e.height+200,25),n=new I(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=n,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.height+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,n,r,i,a,o,s,c,l,u,d){let f=this.projectAndGetPerspectiveRatio(e.anchorPointX+s[0],e.anchorPointY+s[1],i,l,d),p=n*f.perspectiveRatio,m;if(a||o)m=this._projectCollisionBox(e,p,r,i,a,o,s,f,l,u,d);else{let t=f.x+(u?u.x*p:0),n=f.y+(u?u.y*p:0);m={allPointsOccluded:!1,box:[t+e.x1*p,n+e.y1*p,t+e.x2*p,n+e.y2*p]}}let[h,g,_,v]=m.box,y=a?m.allPointsOccluded:f.isOccluded,b=y;return b||=f.perspectiveRatio<this.perspectiveRatioCutoff,b||=!this.isInsideGrid(h,g,_,v),b||t!==`always`&&this.grid.hitTest(h,g,_,v,t,c)?{box:[h,g,_,v],placeable:!1,offscreen:!1,occluded:y}:{box:[h,g,_,v],placeable:!0,offscreen:this.isOffscreen(h,g,_,v),occluded:y}}placeCollisionCircles(e,n,r,i,a,o,s,c,l,u,d,f,p,m){let h=[],g=new t.P(n.anchorX,n.anchorY),_=this.getPerspectiveRatio(g.x,g.y,o,m),v=(l?a*this.transform.getPitchedTextCorrection(n.anchorX,n.anchorY,o)/_:a*_)/t.aJ,y={getElevation:m,pitchedLabelPlaneMatrix:s,lineVertexArray:r,pitchWithMap:l,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:g,unwrappedTileID:o,width:this.transform.width,height:this.transform.height,translation:p},b=st(v,i,n.lineOffsetX*v,n.lineOffsetY*v,!1,n,!1,y),x=!1,S=!1,C=!0;if(b){let n=.5*d*_+f,r=new t.P(-100,-100),i=new t.P(this.screenRightBoundary,this.screenBottomBoundary),a=new $e,o=b.first,s=b.last,p=[];for(let e=o.path.length-1;e>=1;e--)p.push(o.path[e]);for(let e=1;e<s.path.length;e++)p.push(s.path[e]);let m=2.5*n;if(l){let e=this.projectPathToScreenSpace(p,y);p=e.some((e=>e.signedDistanceFromCamera<=0))?[]:e.map((e=>e.point))}let g=[];if(p.length>0){let e=p[0].clone(),n=p[0].clone();for(let t=1;t<p.length;t++)e.x=Math.min(e.x,p[t].x),e.y=Math.min(e.y,p[t].y),n.x=Math.max(n.x,p[t].x),n.y=Math.max(n.y,p[t].y);g=e.x>=r.x&&n.x<=i.x&&e.y>=r.y&&n.y<=i.y?[p]:n.x<r.x||e.x>i.x||n.y<r.y||e.y>i.y?[]:t.aG([p],r.x,r.y,i.x,i.y)}for(let t of g){a.reset(t,.25*n);let r=0;r=a.length<=.5*n?1:Math.ceil(a.paddedLength/m)+1;for(let t=0;t<r;t++){let i=t/Math.max(r-1,1),o=a.lerp(i),s=o.x+100,l=o.y+100;h.push(s,l,n,0);let d=s-n,f=l-n,p=s+n,m=l+n;if(C&&=this.isOffscreen(d,f,p,m),S||=this.isInsideGrid(d,f,p,m),e!==`always`&&this.grid.hitTestCircle(s,l,n,e,u)&&(x=!0,!c))return{circles:[],offscreen:!1,collisionDetected:x}}}}return{circles:!c&&x||!S||_<this.perspectiveRatioCutoff?[]:h,offscreen:C,collisionDetected:x}}projectPathToScreenSpace(e,t){return function(e){let t=0,n=0,r=0,i=0;for(let a=0;a<e.length;a++)e[a].isOccluded?(r=a+1,i=0):(i++,i>n&&(n=i,t=r));return e.slice(t,t+n)}(function(e,t){let n=R;return function(e,t){let n=1/(t[0]*t[5]-t[1]*t[4]);e[0]=t[5]*n,e[1]=-t[1]*n,e[2]=0,e[3]=0,e[4]=-t[4]*n,e[5]=t[0]*n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1/t[10],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1/t[15]}(n,t.pitchedLabelPlaneMatrix),e.map((e=>{let r=z(e.x,e.y,n,t.getElevation),i=t.transform.projectTileCoordinates(r.point.x,r.point.y,t.unwrappedTileID,t.getElevation);return i.point.x=(.5*i.point.x+.5)*t.width,i.point.y=(.5*-i.point.y+.5)*t.height,i}))}(e,t))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let n=[],r=new t.a8;for(let i of e){let e=new t.P(i.x+100,i.y+100);r.extend(e),n.push(e)}let{minX:i,minY:a,maxX:o,maxY:s}=r,c=this.grid.query(i,a,o,s).concat(this.ignoredGrid.query(i,a,o,s)),l={},u={};for(let e of c){let r=e.key;if(l[r.bucketInstanceId]===void 0&&(l[r.bucketInstanceId]={}),l[r.bucketInstanceId][r.featureIndex])continue;let i=[new t.P(e.x1,e.y1),new t.P(e.x2,e.y1),new t.P(e.x2,e.y2),new t.P(e.x1,e.y2)];t.aH(n,i)&&(l[r.bucketInstanceId][r.featureIndex]=!0,u[r.bucketInstanceId]===void 0&&(u[r.bucketInstanceId]=[]),u[r.bucketInstanceId].push(r.featureIndex))}return u}insertCollisionBox(e,t,n,r,i,a){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:i,collisionGroupID:a,overlapMode:t},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,n,r,i,a){let o=n?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:i,collisionGroupID:a,overlapMode:t};for(let t=0;t<e.length;t+=4)o.insertCircle(s,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(e,n,r,i,a){if(a){let r;i?(r=[e,n,i(e,n),1],t.aE(r,r,a)):(r=[e,n,0,1],yt(r,r,a));let o=r[3];return{x:(r[0]/o+1)/2*this.transform.width+100,y:(-r[1]/o+1)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/o*.5,isOccluded:!1,signedDistanceFromCamera:o}}{let t=this.transform.projectTileCoordinates(e,n,r,i);return{x:(t.point.x+1)/2*this.transform.width+100,y:(1-t.point.y)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/t.signedDistanceFromCamera*.5,isOccluded:t.isOccluded,signedDistanceFromCamera:t.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,n,r){let i=this.transform.projectTileCoordinates(e,t,n,r);return .5+this.transform.cameraToCenterDistance/i.signedDistanceFromCamera*.5}isOffscreen(e,t,n,r){return n<100||e>=this.screenRightBoundary||r<100||t>this.screenBottomBoundary}isInsideGrid(e,t,n,r){return n>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=t.ap([]);return t.Q(e,e,[-100,-100,0]),e}_projectCollisionBox(e,n,r,i,a,o,s,c,l,u,d){let f=1,p=0,m=0,h=1,g=e.anchorPointX+s[0],_=e.anchorPointY+s[1];if(o&&!a){let e=this.projectAndGetPerspectiveRatio(g+1,_,i,l,d),t=e.x-c.x,n=Math.atan((e.y-c.y)/t)+(t<0?Math.PI:0),r=Math.sin(n),a=Math.cos(n);f=a,p=r,m=-r,h=a}else if(!o&&a){let e=rt(this.transform);f=e.vecEast[0],p=e.vecEast[1],m=e.vecSouth[0],h=e.vecSouth[1]}let v=c.x,y=c.y,b=n;a&&(v=g,y=_,b=2**-(this.transform.zoom-r.overscaledZ),b*=this.transform.getPitchedTextCorrection(g,_,i),u||(b*=t.al(.5+c.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),u&&(v+=f*u.x*b+m*u.y*b,y+=p*u.x*b+h*u.y*b);let x=e.x1*b,S=e.x2*b,C=(x+S)/2,w=e.y1*b,T=e.y2*b,E=(w+T)/2,D=[{offsetX:x,offsetY:w},{offsetX:C,offsetY:w},{offsetX:S,offsetY:w},{offsetX:S,offsetY:E},{offsetX:S,offsetY:T},{offsetX:C,offsetY:T},{offsetX:x,offsetY:T},{offsetX:x,offsetY:E}],O=[];for(let{offsetX:e,offsetY:n}of D)O.push(new t.P(v+f*e+m*n,y+p*e+h*n));let k=!1;if(a){let e=O.map((e=>this.projectAndGetPerspectiveRatio(e.x,e.y,i,l,d)));k=e.some((e=>!e.isOccluded)),O=e.map((e=>new t.P(e.x,e.y)))}else k=!0;return{box:t.aI(O),allPointsOccluded:!k}}}class xt{constructor(e,t,n,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&n?1:0,this.placed=n}isHidden(){return this.opacity===0&&!this.placed}}class St{constructor(e,t,n,r,i){this.text=new xt(e?e.text:null,t,n,i),this.icon=new xt(e?e.icon:null,t,r,i)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Ct{constructor(e,t,n){this.text=e,this.icon=t,this.skipFade=n}}class wt{constructor(e,t,n,r,i){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=n,this.bucketIndex=r,this.tileID=i}}class Tt{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function Et(e,n,r,i,a){let{horizontalAlign:o,verticalAlign:s}=t.aP(e);return new t.P(-(o-.5)*n+i[0]*a,-(s-.5)*r+i[1]*a)}class Dt{constructor(e,t,n,r,i){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new bt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new Tt(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=i,i&&(i.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;return t?(n,r)=>t.getElevation(e,n,r):null}getBucketParts(e,n,r,i){let a=r.getBucket(n),o=r.latestFeatureIndex;if(!a||!o||n.id!==a.layerIds[0])return;let s=r.collisionBoxArray,c=a.layers[0].layout,l=a.layers[0].paint,u=2**(this.transform.zoom-r.tileID.overscaledZ),d=r.tileSize/t.a6,f=r.tileID.toUnwrapped(),p=c.get(`text-rotation-alignment`)===`map`,m=t.aK(r,1,this.transform.zoom),h=t.aL(this.collisionIndex.transform,r,l.get(`text-translate`),l.get(`text-translate-anchor`)),g=t.aL(this.collisionIndex.transform,r,l.get(`icon-translate`),l.get(`icon-translate-anchor`)),_=tt(p,this.transform,m);this.retainedQueryData[a.bucketInstanceId]=new wt(a.bucketInstanceId,o,a.sourceLayerIndex,a.index,r.tileID);let v={bucket:a,layout:c,translationText:h,translationIcon:g,unwrappedTileID:f,pitchedLabelPlaneMatrix:_,scale:u,textPixelRatio:d,holdingForFade:r.holdingForSymbolFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.aw(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(i)for(let t of a.sortKeyRanges){let{sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i}=t;e.push({sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i,parameters:v})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:v})}attemptAnchorPlacement(e,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b){var x,S;let C=t.aM[e.textAnchor],w=[e.textOffset0,e.textOffset1],T=Et(C,r,i,w,a),E=this.collisionIndex.placeCollisionBox(n,f,c,l,u,s,o,g,d.predicate,y,T,b);if((!v||this.collisionIndex.placeCollisionBox(v,f,c,l,u,s,o,_,d.predicate,y,T,b).placeable)&&E.placeable){let e;if((x=this.prevPlacement)!=null&&x.variableOffsets[p.crossTileID]&&(S=this.prevPlacement?.placements[p.crossTileID])!=null&&S.text&&(e=this.prevPlacement.variableOffsets[p.crossTileID].anchor),p.crossTileID===0)throw Error(`symbolInstance.crossTileID can't be 0`);return this.variableOffsets[p.crossTileID]={textOffset:w,width:r,height:i,anchor:C,textBoxScale:a,prevAnchor:e},this.markUsedJustification(m,C,p,h),m.allowVerticalPlacement&&(this.markUsedOrientation(m,h,p),this.placedOrientations[p.crossTileID]=h),{shift:T,placedGlyphBoxes:E}}}placeLayerBucketPart(e,n,r){let{bucket:i,layout:a,translationText:o,translationIcon:s,unwrappedTileID:c,pitchedLabelPlaneMatrix:l,textPixelRatio:u,holdingForFade:d,collisionBoxArray:f,partiallyEvaluatedTextSize:p,collisionGroup:m}=e.parameters,h=a.get(`text-optional`),g=a.get(`icon-optional`),_=t.aN(a,`text-overlap`,`text-allow-overlap`),v=_===`always`,y=t.aN(a,`icon-overlap`,`icon-allow-overlap`),b=y===`always`,x=a.get(`text-rotation-alignment`)===`map`,S=a.get(`text-pitch-alignment`)===`map`,C=a.get(`icon-text-fit`)!==`none`,w=a.get(`symbol-z-order`)===`viewport-y`,T=v&&(b||!i.hasIconData()||g),E=b&&(v||!i.hasTextData()||h);!i.collisionArrays&&f&&i.deserializeCollisionBoxes(f);let D=this.retainedQueryData[i.bucketInstanceId].tileID,O=this._getTerrainElevationFunc(D),k=this.transform.getFastPathSimpleProjectionMatrix(D),A=(e,f,b)=>{if(n[e.crossTileID])return;if(d)return void(this.placements[e.crossTileID]=new Ct(!1,!1,!1));let w=!1,A=!1,ee=!0,te=null,j={box:null,placeable:!1,offscreen:null,occluded:!1},ne={placeable:!1},re=null,ie=null,ae=null,oe=0,se=0,ce=0;f.textFeatureIndex?oe=f.textFeatureIndex:e.useRuntimeCollisionCircles&&(oe=e.featureIndex),f.verticalTextFeatureIndex&&(se=f.verticalTextFeatureIndex);let le=f.textBox;if(le){let n=n=>{let r=t.ax.horizontal;if(i.allowVerticalPlacement&&!n&&this.prevPlacement){let t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,r=t,this.markUsedOrientation(i,r,e))}return r},a=(n,r)=>{if(i.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&f.verticalTextBox){for(let e of i.writingModes)if(e===t.ax.vertical?(j=r(),ne=j):j=n(),j?.placeable)break}else j=n()},l=e.textAnchorOffsetStartIndex,d=e.textAnchorOffsetEndIndex;if(d===l){let r=(t,n)=>{let r=this.collisionIndex.placeCollisionBox(t,_,u,D,c,S,x,o,m.predicate,O,void 0,k);return r!=null&&r.placeable&&(this.markUsedOrientation(i,n,e),this.placedOrientations[e.crossTileID]=n),r};a((()=>r(le,t.ax.horizontal)),(()=>{let n=f.verticalTextBox;return i.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&n?r(n,t.ax.vertical):{box:null,offscreen:null}})),n(j?.placeable)}else{let p=t.aM[this.prevPlacement?.variableOffsets[e.crossTileID]?.anchor],h=(t,n,a)=>{let f=t.x2-t.x1,h=t.y2-t.y1,g=e.textBoxScale,v=C&&y===`never`?n:null,b=null,T=_===`never`?1:2,E=`never`;p&&T++;for(let n=0;n<T;n++){for(let n=l;n<d;n++){let r=i.textAnchorOffsets.get(n);if(p&&r.textAnchor!==p)continue;let l=this.attemptAnchorPlacement(r,t,f,h,g,x,S,u,D,c,m,E,e,i,a,o,s,v,O);if(l&&(b=l.placedGlyphBoxes,b?.placeable))return w=!0,te=l.shift,b}p?p=null:E=_}return r&&!b&&(b={box:this.collisionIndex.placeCollisionBox(le,`always`,u,D,c,S,x,o,m.predicate,O,void 0,k).box,offscreen:!1,placeable:!1,occluded:!1}),b};a((()=>h(le,f.iconBox,t.ax.horizontal)),(()=>{let n=f.verticalTextBox;return i.allowVerticalPlacement&&!j?.placeable&&e.numVerticalGlyphVertices>0&&n?h(n,f.verticalIconBox,t.ax.vertical):{box:null,occluded:!0,offscreen:null}})),j&&(w=j.placeable,ee=j.offscreen);let g=n(j?.placeable);if(!w&&this.prevPlacement){let t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(i,t.anchor,e,g))}}}if(re=j,w=re?.placeable,ee=re?.offscreen,e.useRuntimeCollisionCircles&&e.centerJustifiedTextSymbolIndex>=0){let n=i.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),s=t.ay(i.textSizeData,p,n),u=a.get(`text-padding`);ie=this.collisionIndex.placeCollisionCircles(_,n,i.lineVertexArray,i.glyphOffsetArray,s,c,l,r,S,m.predicate,e.collisionCircleDiameter,u,o,O),ie.circles.length&&ie.collisionDetected&&!r&&t.w(`Collisions detected, but collision boxes are not shown`),w=v||ie.circles.length>0&&!ie.collisionDetected,ee&&=ie.offscreen}if(f.iconFeatureIndex&&(ce=f.iconFeatureIndex),f.iconBox){let e=e=>this.collisionIndex.placeCollisionBox(e,y,u,D,c,S,x,s,m.predicate,O,C&&te?te:void 0,k);ne&&ne.placeable&&f.verticalIconBox?(ae=e(f.verticalIconBox),A=ae.placeable):(ae=e(f.iconBox),A=ae.placeable),ee&&=ae.offscreen}let M=h||e.numHorizontalGlyphVertices===0&&e.numVerticalGlyphVertices===0,ue=g||e.numIconVertices===0;M||ue?ue?M||(A&&=w):w=A&&w:A=w=A&&w;let de=A&&ae.placeable;if(w&&re.placeable&&this.collisionIndex.insertCollisionBox(re.box,_,a.get(`text-ignore-placement`),i.bucketInstanceId,ne&&ne.placeable&&se?se:oe,m.ID),de&&this.collisionIndex.insertCollisionBox(ae.box,y,a.get(`icon-ignore-placement`),i.bucketInstanceId,ce,m.ID),ie&&w&&this.collisionIndex.insertCollisionCircles(ie.circles,_,a.get(`text-ignore-placement`),i.bucketInstanceId,oe,m.ID),r&&this.storeCollisionData(i.bucketInstanceId,b,f,re,ae,ie),e.crossTileID===0)throw Error(`symbolInstance.crossTileID can't be 0`);if(i.bucketInstanceId===0)throw Error(`bucket.bucketInstanceId can't be 0`);this.placements[e.crossTileID]=new Ct((w||T)&&!re?.occluded,(A||E)&&!ae?.occluded,ee||i.justReloaded),n[e.crossTileID]=!0};if(w){if(e.symbolInstanceStart!==0)throw Error(`bucket.bucketInstanceId should be 0`);let t=i.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let e=t.length-1;e>=0;--e){let n=t[e];A(i.symbolInstances.get(n),i.collisionArrays[n],n)}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)A(i.symbolInstances.get(t),i.collisionArrays[t],t);i.justReloaded=!1}storeCollisionData(e,t,n,r,i,a){if(n.textBox||n.iconBox){let a,o;this.collisionBoxArrays.has(e)?a=this.collisionBoxArrays.get(e):(a=new Map,this.collisionBoxArrays.set(e,a)),a.has(t)?o=a.get(t):(o={text:null,icon:null},a.set(t,o)),n.textBox&&(o.text=r.box),n.iconBox&&(o.icon=i.box)}if(a){let t=this.collisionCircleArrays[e];t===void 0&&(t=this.collisionCircleArrays[e]=[]);for(let e=0;e<a.circles.length;e+=4)t.push(a.circles[e+0]-100),t.push(a.circles[e+1]-100),t.push(a.circles[e+2]),t.push(+!!a.collisionDetected)}}markUsedJustification(e,n,r,i){let a;a=i===t.ax.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[t.aO(n)];let o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(let t of o)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=a>=0&&t!==a?0:r.crossTileID)}markUsedOrientation(e,n,r){let i=n===t.ax.horizontal||n===t.ax.horizontalOnly?n:0,a=n===t.ax.vertical?n:0,o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(let t of o)e.text.placedSymbolArray.get(t).placedOrientation=i;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,n=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let r=t?t.symbolFadeChange(e):1,i=t?t.opacities:{},a=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(let e in this.placements){let t=this.placements[e],a=i[e];a?(this.opacities[e]=new St(a,r,t.text,t.icon),n||=t.text!==a.text.placed,n||=t.icon!==a.icon.placed):(this.opacities[e]=new St(null,r,t.text,t.icon,t.skipFade),n||=t.text||t.icon)}for(let e in i){let t=i[e];if(!this.opacities[e]){let i=new St(t,r,!1,!1);i.isHidden()||(this.opacities[e]=i,n||=t.text.placed,n||=t.icon.placed)}}for(let e in a)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=a[e]);for(let e in o)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=o[e]);if(t&&t.lastPlacementChangeTime===void 0)throw Error(`Last placement time for previous placement is not defined`);n?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!=`number`&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let n={};for(let r of t){let t=r.getBucket(e);t&&r.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,r.tileID,n,r.collisionBoxArray)}}updateBucketOpacities(e,n,r,i){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let a=e.layers[0],o=a.layout,s=new St(null,0,!1,!1,!0),c=o.get(`text-allow-overlap`),l=o.get(`icon-allow-overlap`),u=a._unevaluatedLayout.hasValue(`text-variable-anchor`)||a._unevaluatedLayout.hasValue(`text-variable-anchor-offset`),d=o.get(`text-rotation-alignment`)===`map`,f=o.get(`text-pitch-alignment`)===`map`,p=o.get(`icon-text-fit`)!==`none`,m=new St(null,0,c&&(l||!e.hasIconData()||o.get(`icon-optional`)),l&&(c||!e.hasTextData()||o.get(`text-optional`)),!0);!e.collisionArrays&&i&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(i);let h=(e,t,n)=>{for(let r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(n);e.hasVisibleVertices||=n!==Pt},g=this.collisionBoxArrays.get(e.bucketInstanceId);for(let n=0;n<e.symbolInstances.length;n++){let i=e.symbolInstances.get(n),{numHorizontalGlyphVertices:a,numVerticalGlyphVertices:o,crossTileID:c}=i,l=this.opacities[c];r[c]?l=s:l||(l=m,this.opacities[c]=l),r[c]=!0;let _=i.numIconVertices>0,v=this.placedOrientations[i.crossTileID],y=v===t.ax.vertical,b=v===t.ax.horizontal||v===t.ax.horizontalOnly;if(a>0||o>0){let t=Nt(l.text);h(e.text,a,y?Pt:t),h(e.text,o,b?Pt:t);let n=l.text.isHidden(),r=[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex];for(let t of r)t>=0&&(e.text.placedSymbolArray.get(t).hidden=n||y?1:0);i.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).hidden=n||b?1:0);let s=this.variableOffsets[i.crossTileID];s&&this.markUsedJustification(e,s.anchor,i,v);let c=this.placedOrientations[i.crossTileID];c&&(this.markUsedJustification(e,`left`,i,c),this.markUsedOrientation(e,c,i))}if(_){let t=Nt(l.icon),n=!(p&&i.verticalPlacedIconSymbolIndex&&y);i.placedIconSymbolIndex>=0&&(h(e.icon,i.numIconVertices,n?t:Pt),e.icon.placedSymbolArray.get(i.placedIconSymbolIndex).hidden=l.icon.isHidden()),i.verticalPlacedIconSymbolIndex>=0&&(h(e.icon,i.numVerticalIconVertices,n?Pt:t),e.icon.placedSymbolArray.get(i.verticalPlacedIconSymbolIndex).hidden=l.icon.isHidden())}let x=g?.has(n)?g.get(n):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let r=e.collisionArrays[n];if(r){let n=new t.P(0,0);if(r.textBox||r.verticalTextBox){let t=!0;if(u){let e=this.variableOffsets[c];e?(n=Et(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),d&&n._rotate(f?-this.transform.bearingInRadians:this.transform.bearingInRadians)):t=!1}if(r.textBox||r.verticalTextBox){let i;r.textBox&&(i=y),r.verticalTextBox&&(i=b),Ot(e.textCollisionBox.collisionVertexArray,l.text.placed,!t||i,x.text,n.x,n.y)}}if(r.iconBox||r.verticalIconBox){let t=!!(!b&&r.verticalIconBox),i;r.iconBox&&(i=t),r.verticalIconBox&&(i=!t),Ot(e.iconCollisionBox.collisionVertexArray,l.icon.placed,i,x.icon,p?n.x:0,p?n.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let n=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*n>e}setStale(){this.stale=!0}}function Ot(e,t,n,r,i,a){r&&r.length!==0||(r=[0,0,0,0]);let o=r[0]-100,s=r[1]-100,c=r[2]-100,l=r[3]-100;e.emplaceBack(+!!t,+!!n,i||0,a||0,o,s),e.emplaceBack(+!!t,+!!n,i||0,a||0,c,s),e.emplaceBack(+!!t,+!!n,i||0,a||0,c,l),e.emplaceBack(+!!t,+!!n,i||0,a||0,o,l)}let kt=2**25,At=2**24,jt=2**17,Mt=2**16;function Nt(e){if(e.opacity===0&&!e.placed)return 0;if(e.opacity===1&&e.placed)return 4294967295;let t=+!!e.placed,n=Math.floor(127*e.opacity);return n*kt+t*At+n*jt+t*Mt+n*512+t*256+n*2+t}let Pt=0;class Ft{constructor(e){this._sortAcrossTiles=e.layout.get(`symbol-z-order`)!==`viewport-y`&&!e.layout.get(`symbol-sort-key`).isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,n,r,i){let a=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(a,r,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,i())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort(((e,t)=>e.sortKey-t.sortKey)));this._currentPartIndex<a.length;)if(t.placeLayerBucketPart(a[this._currentPartIndex],this._seenCrossTileIDs,n),this._currentPartIndex++,i())return!0;return!1}}class It{constructor(e,t,n,r,i,a,o,s){this.placement=new Dt(e,t,a,o,s),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=i,this._done=!1}isDone(){return this._done}continuePlacement(e,n,r){let i=l(),a=()=>!this._forceFullPlacement&&l()-i>2;for(;this._currentPlacementIndex>=0;){let i=n[e[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if(t.aQ(i)&&i.layout&&(!i.minzoom||i.minzoom<=o)&&(!i.maxzoom||i.maxzoom>o)){if(this._inProgressLayer||=new Ft(i),this._inProgressLayer.continuePlacement(r[i.source],this.placement,this._showCollisionBoxes,i,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let Lt=512/t.a6/2;class Rt{constructor(e,n,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};let i=new Map;for(let e=0;e<n.length;e++){let t=n.get(e),r=t.key,a=i.get(r);a?a.push(t):i.set(r,[t])}for(let[e,n]of i){let r={positions:n.map((e=>({x:Math.floor(e.anchorX*Lt),y:Math.floor(e.anchorY*Lt)}))),crossTileIDs:n.map((e=>e.crossTileID))};if(r.positions.length>128){let e=new t.aR(r.positions.length,16,Uint16Array);for(let{x:t,y:n}of r.positions)e.add(t,n);e.finish(),delete r.positions,r.index=e}this._symbolsByKey[e]=r}}getScaledCoordinates(e,n){let{x:r,y:i,z:a}=this.tileID.canonical,{x:o,y:s,z:c}=n.canonical,l=Lt/2**(c-a),u=(s*t.a6+e.anchorY)*l,d=i*t.a6*Lt;return{x:Math.floor((o*t.a6+e.anchorX)*l-r*t.a6*Lt),y:Math.floor(u-d)}}findMatches(e,t,n){let r=this.tileID.canonical.z<t.canonical.z?1:2**(this.tileID.canonical.z-t.canonical.z);for(let i=0;i<e.length;i++){let a=e.get(i);if(a.crossTileID)continue;let o=this._symbolsByKey[a.key];if(!o)continue;let s=this.getScaledCoordinates(a,t);if(o.index){let e=o.index.range(s.x-r,s.y-r,s.x+r,s.y+r).sort();for(let t of e){let e=o.crossTileIDs[t];if(!n[e]){n[e]=!0,a.crossTileID=e;break}}}else if(o.positions)for(let e=0;e<o.positions.length;e++){let t=o.positions[e],i=o.crossTileIDs[e];if(Math.abs(t.x-s.x)<=r&&Math.abs(t.y-s.y)<=r&&!n[i]){n[i]=!0,a.crossTileID=i;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:e})=>e))}}class zt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class V{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(t!==0)for(let e in this.indexes){let n=this.indexes[e],r={};for(let e in n){let i=n[e];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+t),r[i.tileID.key]=i}this.indexes[e]=r}this.lng=e}addBucket(e,t,n){var r,i;if(this.indexes[e.overscaledZ]?.[e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++)t.symbolInstances.get(e).crossTileID=0;(r=this.usedCrossTileIDs)[i=e.overscaledZ]||(r[i]={});let a=this.usedCrossTileIDs[e.overscaledZ];for(let n in this.indexes){let r=this.indexes[n];if(Number(n)>e.overscaledZ)for(let n in r){let i=r[n];i.tileID.isChildOf(e)&&i.findMatches(t.symbolInstances,e,a)}else{let i=r[e.scaledTo(Number(n)).key];i&&i.findMatches(t.symbolInstances,e,a)}}for(let e=0;e<t.symbolInstances.length;e++){let r=t.symbolInstances.get(e);r.crossTileID||(r.crossTileID=n.generate(),a[r.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Rt(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let n of t.getCrossTileIDsLists())for(let t of n)delete this.usedCrossTileIDs[e][t]}removeStaleBuckets(e){let t=!1;for(let n in this.indexes){let r=this.indexes[n];for(let i in r)e[r[i].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,r[i]),delete r[i],t=!0)}return t}}class Bt{constructor(){this.layerIndexes={},this.crossTileIDs=new zt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,n){let r=this.layerIndexes[e.id];r===void 0&&(r=this.layerIndexes[e.id]=new V);let i=!1,a={};r.handleWrapJump(n);for(let n of t){let t=n.getBucket(e);e.id===t?.layerIds[0]&&(t.bucketInstanceId||=(this.maxBucketInstanceId+=1,this.maxBucketInstanceId),r.addBucket(n.tileID,t,this.crossTileIDs)&&(i=!0),a[t.bucketInstanceId]=!0)}return r.removeStaleBuckets(a)&&(i=!0),i}pruneUnusedLayers(e){let t={};for(let n of e)t[n]=!0;for(let e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}var Vt=`void main() {fragColor=vec4(1.0);}`;let Ht={prelude:H(`#ifdef GL_ES
1
+ import{t as e}from"./rolldown-runtime-CMxvf4Kt.js";var t=e(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.maplibregl=r())})(e,(function(){var e={},t={};function n(n,r,i){if(t[n]=i,n===`index`){var a=`var sharedModule = {}; (`+t.shared+`)(sharedModule); (`+t.worker+`)(sharedModule);`,o={};return t.shared(o),t.index(e,o),typeof window<`u`&&e.setWorkerUrl(window.URL.createObjectURL(new Blob([a],{type:`text/javascript`}))),e}}return n(`shared`,[`exports`],(function(e){function t(e,t,n,r){return new(n||=Promise)((function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((r=r.apply(e,t||[])).next())}))}function n(e,t){this.x=e,this.y=t}function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var i,a;n.prototype={clone(){return new n(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){let t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){let t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){let e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){let t=Math.cos(e),n=Math.sin(e),r=n*this.x+t*this.y;return this.x=t*this.x-n*this.y,this.y=r,this},_rotateAround(e,t){let n=Math.cos(e),r=Math.sin(e),i=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=t.x+n*(this.x-t.x)-r*(this.y-t.y),this.y=i,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:n},n.convert=function(e){if(e instanceof n)return e;if(Array.isArray(e))return new n(+e[0],+e[1]);if(e.x!==void 0&&e.y!==void 0)return new n(+e.x,+e.y);throw Error(`Expected [x, y] or {x, y} point format`)};var o=r(function(){if(a)return i;function e(e,t,n,r){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=r}return a=1,i=e,e.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,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,r=0;r<8;r++){var i=this.sampleCurveX(n)-e;if(Math.abs(i)<t)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n-=i/a}var o=0,s=1;for(n=e,r=0;r<20&&(i=this.sampleCurveX(n),!(Math.abs(i-e)<t));r++)e>i?o=n:s=n,n=.5*(s-o)+o;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},i}());let s,c;function l(){return s??=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)&&typeof createImageBitmap==`function`,s}function u(){if(c==null&&(c=!1,l())){let e=new OffscreenCanvas(5,5).getContext(`2d`,{willReadFrequently:!0});if(e){for(let t=0;t<25;t++){let n=4*t;e.fillStyle=`rgb(${n},${n+1},${n+2})`,e.fillRect(t%5,Math.floor(t/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let e=0;e<100;e++)if(e%4!=3&&t[e]!==e){c=!0;break}}}return c||!1}var d=1e-6,f=typeof Float32Array<`u`?Float32Array:Array;function p(){var e=new f(9);return f!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function m(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function h(){var e=new f(3);return f!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function g(e){var t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function _(e,t,n){var r=new f(3);return r[0]=e,r[1]=t,r[2]=n,r}function v(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function y(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function b(e,t,n){var r=t[0],i=t[1],a=t[2],o=n[0],s=n[1],c=n[2];return e[0]=i*c-a*s,e[1]=a*o-r*c,e[2]=r*s-i*o,e}var x,S=g;function C(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3];return e[0]=n[0]*r+n[4]*i+n[8]*a+n[12]*o,e[1]=n[1]*r+n[5]*i+n[9]*a+n[13]*o,e[2]=n[2]*r+n[6]*i+n[10]*a+n[14]*o,e[3]=n[3]*r+n[7]*i+n[11]*a+n[15]*o,e}function w(){var e=new f(4);return f!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function T(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:`zyx`,a=Math.PI/360;t*=a,r*=a,n*=a;var o=Math.sin(t),s=Math.cos(t),c=Math.sin(n),l=Math.cos(n),u=Math.sin(r),d=Math.cos(r);switch(i){case`xyz`:e[0]=o*l*d+s*c*u,e[1]=s*c*d-o*l*u,e[2]=s*l*u+o*c*d,e[3]=s*l*d-o*c*u;break;case`xzy`:e[0]=o*l*d-s*c*u,e[1]=s*c*d-o*l*u,e[2]=s*l*u+o*c*d,e[3]=s*l*d+o*c*u;break;case`yxz`:e[0]=o*l*d+s*c*u,e[1]=s*c*d-o*l*u,e[2]=s*l*u-o*c*d,e[3]=s*l*d+o*c*u;break;case`yzx`:e[0]=o*l*d+s*c*u,e[1]=s*c*d+o*l*u,e[2]=s*l*u-o*c*d,e[3]=s*l*d-o*c*u;break;case`zxy`:e[0]=o*l*d-s*c*u,e[1]=s*c*d+o*l*u,e[2]=s*l*u+o*c*d,e[3]=s*l*d-o*c*u;break;case`zyx`:e[0]=o*l*d-s*c*u,e[1]=s*c*d+o*l*u,e[2]=s*l*u-o*c*d,e[3]=s*l*d+o*c*u;break;default:throw Error(`Unknown angle order `+i)}return e}function E(){var e=new f(2);return f!=Float32Array&&(e[0]=0,e[1]=0),e}function D(e,t){var n=new f(2);return n[0]=e,n[1]=t,n}h(),x=new f(4),f!=Float32Array&&(x[0]=0,x[1]=0,x[2]=0,x[3]=0),h(),_(1,0,0),_(0,1,0),w(),w(),p(),E();let O=8192;function k(e,t,n){return t*(O/(e.tileSize*2**(n-e.tileID.overscaledZ)))}function A(e){return e instanceof Error?e:Error(typeof e==`string`?e:String(e))}function ee(e,t){return(e%t+t)%t}function te(e,t,n){return e*(1-n)+t*n}function j(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}function ne(e,t,n,r){let i=new o(e,t,n,r);return e=>i.solve(e)}let re=ne(.25,.1,.25,1);function ie(e,t,n){return Math.min(n,Math.max(t,e))}function ae(e,t,n){let r=n-t,i=((e-t)%r+r)%r+t;return i===t?n:i}function oe(e,...t){for(let n of t)for(let t in n)e[t]=n[t];return e}let se=1;function ce(e,t,n){let r={};for(let n in e)r[n]=t.call(this,e[n],n,e);return r}function le(e,t,n){let r={};for(let n in e)t.call(this,e[n],n,e)&&(r[n]=e[n]);return r}function M(e){return Array.isArray(e)?e.map(M):typeof e==`object`&&e?ce(e,M):e}let ue={};function de(e){ue[e]||(typeof console<`u`&&console.warn(e),ue[e]=!0)}function fe(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}function pe(e){return typeof WorkerGlobalScope<`u`&&e!==void 0&&e instanceof WorkerGlobalScope}let me=null;function he(e){return typeof ImageBitmap<`u`&&e instanceof ImageBitmap}let ge=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=`;function _e(e,n,r,i,a){return t(this,void 0,void 0,(function*(){if(typeof VideoFrame>`u`)throw Error(`VideoFrame not supported`);let t=new VideoFrame(e,{timestamp:0});try{let o=t?.format;if(!o||!o.startsWith(`BGR`)&&!o.startsWith(`RGB`))throw Error(`Unrecognized format ${o}`);let s=o.startsWith(`BGR`),c=new Uint8ClampedArray(i*a*4);if(yield t.copyTo(c,function(e,t,n,r,i){let a=4*Math.max(-t,0),o=(Math.max(0,n)-n)*r*4+a,s=4*r,c=Math.max(0,t),l=Math.max(0,n);return{rect:{x:c,y:l,width:Math.min(e.width,t+r)-c,height:Math.min(e.height,n+i)-l},layout:[{offset:o,stride:s}]}}(e,n,r,i,a)),s)for(let e=0;e<c.length;e+=4){let t=c[e];c[e]=c[e+2],c[e+2]=t}return c}finally{t.close()}}))}let ve,ye;function be(e,t,n,r){return e.addEventListener(t,n,r),{unsubscribe:()=>{e.removeEventListener(t,n,r)}}}function xe(e){return e*Math.PI/180}function Se(e){return e/Math.PI*180}let Ce={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},we={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},Te=`AbortError`;class Ee extends Error{constructor(e=Te){super(e instanceof Error?e.message:e),this.name=Te,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function De(e){return e instanceof Error&&e.name===Te}function Oe(e){if(e.aborted)throw new Ee(e.reason)}let ke={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:``};function Ae(e){return ke.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf(`://`))]}let je=`global-dispatcher`;class Me extends Error{constructor(e,t,n,r){super(`AJAXError: ${t} (${e}): ${n}`),this.status=e,this.statusText=t,this.url=n,this.body=r}}let Ne=()=>pe(self)?self.worker?.referrer:(window.location.protocol===`blob:`?window.parent:window).location.href,Pe=function(e,n){return t(this,void 0,void 0,(function*(){if(e.url.includes(`://`)&&!/^https?:|^file:/.test(e.url)){let t=Ae(e.url);if(t){let r=yield t(e,n);return r.data||e.type!==`arrayBuffer`?r:oe(r,{data:new ArrayBuffer(0)})}if(pe(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:`GR`,data:e,targetMapId:je},n)}if(!(e=>e.startsWith(`file:`)||Ne()?.startsWith(`file:`)&&!/^\w+:/.test(e))(e.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,`signal`))return function(e,n){return t(this,void 0,void 0,(function*(){let t=new Request(e.url,{method:e.method||`GET`,body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:Ne(),referrerPolicy:e.referrerPolicy,signal:n.signal}),r,i;e.type!==`json`||t.headers.has(`Accept`)||t.headers.set(`Accept`,`application/json`);try{r=yield fetch(t)}catch(t){throw De(t)?t:new Me(0,A(t).message,e.url,new Blob)}if(!r.ok){let t=yield r.blob();throw new Me(r.status,r.statusText,e.url,t)}i=e.type===`arrayBuffer`||e.type===`image`?r.arrayBuffer():e.type===`json`?r.json():r.text();let a=yield i;return Oe(n.signal),{data:a,cacheControl:r.headers.get(`Cache-Control`),expires:r.headers.get(`Expires`),etag:r.headers.get(`ETag`)}}))}(e,n);if(pe(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:`GR`,data:e,mustQueue:!0,targetMapId:je},n)}return function(e,t){return new Promise(((n,r)=>{var i;let a=new XMLHttpRequest;a.open(e.method||`GET`,e.url,!0),e.type!==`arrayBuffer`&&e.type!==`image`||(a.responseType=`arraybuffer`);for(let t in e.headers)a.setRequestHeader(t,e.headers[t]);e.type===`json`&&(a.responseType=`text`,(i=e.headers)!=null&&i.Accept||a.setRequestHeader(`Accept`,`application/json`)),a.withCredentials=e.credentials===`include`,a.onerror=()=>{r(Error(a.statusText))},a.onload=()=>{if(!t.signal.aborted)if((a.status>=200&&a.status<300||a.status===0)&&a.response!==null){let t=a.response;if(e.type===`json`)try{t=JSON.parse(a.response)}catch(e){r(e);return}n({data:t,cacheControl:a.getResponseHeader(`Cache-Control`),expires:a.getResponseHeader(`Expires`),etag:a.getResponseHeader(`ETag`)})}else{let t=new Blob([a.response],{type:a.getResponseHeader(`Content-Type`)});r(new Me(a.status,a.statusText,e.url,t))}},t.signal.addEventListener(`abort`,(()=>{a.abort(),r(new Ee(t.signal.reason))})),a.send(e.body)}))}(e,n)}))};function Fe(e){if(!e||e.indexOf(`://`)<=0||e.startsWith(`data:image/`)||e.startsWith(`blob:`))return!0;let t=new URL(e),n=window.location;return t.protocol===n.protocol&&t.host===n.host}function Ie(e,t,n){var r;(r=n[e])!=null&&r.includes(t)||(n[e]||(n[e]=[]),n[e].push(t))}function Le(e,t,n){if(n?.[e]){let r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}class Re{constructor(e,t={}){oe(this,t),this.type=e}}class ze extends Re{constructor(e,t={}){super(`error`,oe({error:e},t))}}class Be{on(e,t){return this._listeners||={},Ie(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return Le(e,t,this._listeners),Le(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners||={},Ie(e,t,this._oneTimeListeners),this):new Promise((t=>this.once(e,t)))}fire(e,t){typeof e==`string`&&(e=new Re(e,t||{}));let n=e.type;if(this.listens(n)){e.target=this;let t=this._listeners?.[n]?this._listeners[n].slice():[];for(let n of t)n.call(this,e);let r=this._oneTimeListeners?.[n]?this._oneTimeListeners[n].slice():[];for(let t of r)Le(n,t,this._oneTimeListeners),t.call(this,e);let i=this._eventedParent;i&&(oe(e,typeof this._eventedParentData==`function`?this._eventedParentData():this._eventedParentData),i.fire(e))}else e instanceof ze&&console.error(e.error);return this}listens(e){return this._listeners?.[e]?.length>0||this._oneTimeListeners?.[e]?.length>0||this._eventedParent?.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var N={$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:.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:.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:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},"horizon-fog-blend":{type:`number`,"property-type":`data-constant`,default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},"sky-horizon-blend":{type:`number`,"property-type":`data-constant`,default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[`zoom`]},transition:!0},"atmosphere-blend":{type:`number`,"property-type":`data-constant`,default:.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)`,.1,`royalblue`,.3,`cyan`,.5,`lime`,.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:.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 Ve=[`type`,`source`,`source-layer`,`minzoom`,`maxzoom`,`filter`,`layout`];function He(e,t){let n={};for(let t in e)t!==`ref`&&(n[t]=e[t]);return Ve.forEach((e=>{e in t&&(n[e]=t[e])})),n}function P(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!P(e[n],t[n]))return!1;return!0}if(typeof e==`object`&&e&&t!==null){if(typeof t!=`object`||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(!P(e[n],t[n]))return!1;return!0}return e===t}function Ue(e,t){e.push(t)}function We(e,t,n){Ue(n,{command:`addSource`,args:[e,t[e]]})}function Ge(e,t,n){Ue(t,{command:`removeSource`,args:[e]}),n[e]=!0}function Ke(e,t,n,r){Ge(e,n,r),We(e,t,n)}function qe(e,t,n){let r;for(r in e[n])if(Object.prototype.hasOwnProperty.call(e[n],r)&&r!==`data`&&!P(e[n][r],t[n][r]))return!1;for(r in t[n])if(Object.prototype.hasOwnProperty.call(t[n],r)&&r!==`data`&&!P(e[n][r],t[n][r]))return!1;return!0}function Je(e,t,n,r,i,a){e||={},t||={};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(P(e[o],t[o])||n.push({command:a,args:[r,o,t[o],i]}));for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&!Object.prototype.hasOwnProperty.call(e,o)&&(P(e[o],t[o])||n.push({command:a,args:[r,o,t[o],i]}))}function Ye(e){return e.id}function Xe(e,t){return e[t.id]=t,e}class F{constructor(e,t,n,r){this.message=(e?`${e}: `:``)+n,r&&(this.identifier=r),t!=null&&t.__line__&&(this.line=t.__line__)}}function Ze(e,...t){for(let n of t)for(let t in n)e[t]=n[t];return e}class Qe extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class $e{constructor(e,t=[]){this.parent=e,this.bindings={};for(let[e,n]of t)this.bindings[e]=n}concat(e){return new $e(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}let et={kind:`null`},I={kind:`number`},L={kind:`string`},R={kind:`boolean`},tt={kind:`color`},nt={kind:`projectionDefinition`},rt={kind:`object`},z={kind:`value`},it={kind:`collator`},at={kind:`formatted`},ot={kind:`padding`},st={kind:`colorArray`},ct={kind:`numberArray`},lt={kind:`resolvedImage`},ut={kind:`variableAnchorOffsetCollection`};function dt(e,t){return{kind:`array`,itemType:e,N:t}}function B(e){if(e.kind===`array`){let t=B(e.itemType);return typeof e.N==`number`?`array<${t}, ${e.N}>`:e.itemType.kind===`value`?`array`:`array<${t}>`}return e.kind}let ft=[et,I,L,R,tt,nt,at,rt,dt(z),ot,ct,st,lt,ut];function pt(e,t){if(t.kind===`error`)return null;if(e.kind===`array`){if(t.kind===`array`&&(t.N===0&&t.itemType.kind===`value`||!pt(e.itemType,t.itemType))&&(typeof e.N!=`number`||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if(e.kind===`value`){for(let e of ft)if(!pt(e,t))return null}}return`Expected ${B(e)} but found ${B(t)} instead.`}function mt(e,t){return t.some((t=>t.kind===e.kind))}function ht(e,t){return t.some((t=>t===`null`?e===null:t===`array`?Array.isArray(e):t===`object`?e&&!Array.isArray(e)&&typeof e==`object`:t===typeof e))}function gt(e,t){return e.kind===`array`&&t.kind===`array`?e.itemType.kind===t.itemType.kind&&typeof e.N==`number`:e.kind===t.kind}let _t=.96422,vt=.82521,yt=4/29,bt=6/29,xt=3*bt*bt,St=Math.PI/180,Ct=180/Math.PI;function wt(e){return(e%=360)<0&&(e+=360),e}function Tt([e,t,n,r]){let i,a,o=Dt((.2225045*(e=Et(e))+.7168786*(t=Et(t))+.0606169*(n=Et(n)))/1);e===t&&t===n?i=a=o:(i=Dt((.4360747*e+.3850649*t+.1430804*n)/_t),a=Dt((.0139322*e+.0971045*t+.7141733*n)/vt));let s=116*o-16;return[s<0?0:s,500*(i-o),200*(o-a),r]}function Et(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Dt(e){return e>.008856451679035631?e**(1/3):e/xt+yt}function Ot([e,t,n,r]){let i=(e+16)/116,a=isNaN(t)?i:i+t/500,o=isNaN(n)?i:i-n/200;return i=1*At(i),a=_t*At(a),o=vt*At(o),[kt(3.1338561*a-1.6168667*i-.4906146*o),kt(-.9787684*a+1.9161415*i+.033454*o),kt(.0719453*a-.2289914*i+1.4052427*o),r]}function kt(e){return(e=e<=.00304?12.92*e:1.055*e**(1/2.4)-.055)<0?0:e>1?1:e}function At(e){return e>bt?e*e*e:xt*(e-yt)}let jt=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function Mt(e,t){return jt(e,t)?e[t]:void 0}function Nt(e){return parseInt(e.padEnd(2,e),16)/255}function Pt(e,t){return Ft(t?e/100:e,0,1)}function Ft(e,t,n){return Math.min(Math.max(t,e),n)}function It(e){return!e.some(Number.isNaN)}let Lt={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 Rt(e,t,n){return e+n*(t-e)}function zt(e,t,n){return e.map(((e,r)=>Rt(e,t[r],n)))}class V{constructor(e,t,n,r=1,i=!0){this.r=e,this.g=t,this.b=n,this.a=r,i||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter(`rgb`,[e,t,n,r]))}static parse(e){if(e instanceof V)return e;if(typeof e!=`string`)return;let t=function(e){if((e=e.toLowerCase().trim())===`transparent`)return[0,0,0,0];let t=Mt(Lt,e);if(t){let[e,n,r]=t;return[e/255,n/255,r/255,1]}if(e.startsWith(`#`)&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let t=e.length<6?1:2,n=1;return[Nt(e.slice(n,n+=t)),Nt(e.slice(n,n+=t)),Nt(e.slice(n,n+=t)),Nt(e.slice(n,n+t)||`ff`)]}if(e.startsWith(`rgb`)){let t=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){let[e,n,r,i,a,o,s,c,l,u,d,f]=t,p=[i||` `,s||` `,u].join(``);if(p===` `||p===` /`||p===`,,`||p===`,,,`){let e=[r,o,l].join(``),t=e===`%%%`?100:e===``?255:0;if(t){let e=[Ft(+n/t,0,1),Ft(+a/t,0,1),Ft(+c/t,0,1),d?Pt(+d,f):1];if(It(e))return e}}return}}let n=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){let[e,t,r,i,a,o,s,c,l]=n,u=[r||` `,a||` `,s].join(``);if(u===` `||u===` /`||u===`,,`||u===`,,,`){let e=[+t,Ft(+i,0,100),Ft(+o,0,100),c?Pt(+c,l):1];if(It(e))return function([e,t,n,r]){function i(r){let i=(r+e/30)%12,a=t*Math.min(n,1-n);return n-a*Math.max(-1,Math.min(i-3,9-i,1))}return e=wt(e),t/=100,n/=100,[i(0),i(8),i(4),r]}(e)}}}(e);return t?new V(...t,!1):void 0}get rgb(){let{r:e,g:t,b:n,a:r}=this,i=r||1/0;return this.overwriteGetter(`rgb`,[e/i,t/i,n/i,r])}get hcl(){return this.overwriteGetter(`hcl`,function(e){let[t,n,r,i]=Tt(e),a=Math.sqrt(n*n+r*r);return[Math.round(1e4*a)?wt(Math.atan2(r,n)*Ct):NaN,a,t,i]}(this.rgb))}get lab(){return this.overwriteGetter(`lab`,Tt(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){let[e,t,n,r]=this.rgb;return`rgba(${[e,t,n].map((e=>Math.round(255*e))).join(`,`)},${r})`}static interpolate(e,t,n,r=`rgb`){switch(r){case`rgb`:{let[r,i,a,o]=zt(e.rgb,t.rgb,n);return new V(r,i,a,o,!1)}case`hcl`:{let[r,i,a,o]=e.hcl,[s,c,l,u]=t.hcl,d,f;if(isNaN(r)||isNaN(s))isNaN(r)?isNaN(s)?d=NaN:(d=s,a!==1&&a!==0||(f=c)):(d=r,l!==1&&l!==0||(f=i));else{let e=s-r;s>r&&e>180?e-=360:s<r&&r-s>180&&(e+=360),d=r+n*e}let[p,m,h,g]=function([e,t,n,r]){return e=isNaN(e)?0:e*St,Ot([n,Math.cos(e)*t,Math.sin(e)*t,r])}([d,f??Rt(i,c,n),Rt(a,l,n),Rt(o,u,n)]);return new V(p,m,h,g,!1)}case`lab`:{let[r,i,a,o]=Ot(zt(e.lab,t.lab,n));return new V(r,i,a,o,!1)}}}}V.black=new V(0,0,0,1),V.white=new V(1,1,1,1),V.transparent=new V(0,0,0,0),V.red=new V(1,0,0,1);class Bt{constructor(e,t,n){this.sensitivity=e?t?`variant`:`case`:t?`accent`:`base`,this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:`search`})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}let Vt=[`bottom`,`center`,`top`];class Ht{constructor(e,t,n,r,i,a){this.text=e,this.image=t,this.scale=n,this.fontStack=r,this.textColor=i,this.verticalAlign=a}}class H{constructor(e){this.sections=e}static fromString(e){return new H([new Ht(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((e=>e.text.length!==0||e.image&&e.image.name.length!==0))}static factory(e){return e instanceof H?e:H.fromString(e)}toString(){return this.sections.length===0?``:this.sections.map((e=>e.text)).join(``)}}class Ut{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ut)return e;if(typeof e==`number`)return new Ut([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let t of e)if(typeof t!=`number`)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Ut(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new Ut(zt(e.values,t.values,n))}}class Wt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Wt)return e;if(typeof e==`number`)return new Wt([e]);if(Array.isArray(e)){for(let t of e)if(typeof t!=`number`)return;return new Wt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new Wt(zt(e.values,t.values,n))}}class Gt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Gt)return e;if(typeof e==`string`){let t=V.parse(e);return t?new Gt([t]):void 0}if(!Array.isArray(e))return;let t=[];for(let n of e){if(typeof n!=`string`)return;let e=V.parse(n);if(!e)return;t.push(e)}return new Gt(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n,r=`rgb`){let i=[];if(e.values.length!=t.values.length)throw Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let a=0;a<e.values.length;a++)i.push(V.interpolate(e.values[a],t.values[a],n,r));return new Gt(i)}}class Kt extends Error{constructor(e){super(e),this.name=`RuntimeError`}toJSON(){return this.message}}let qt=new Set([`center`,`left`,`right`,`top`,`bottom`,`top-left`,`top-right`,`bottom-left`,`bottom-right`]);class Jt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Jt)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t<e.length;t+=2){let n=e[t],r=e[t+1];if(typeof n!=`string`||!qt.has(n)||!Array.isArray(r)||r.length!==2||typeof r[0]!=`number`||typeof r[1]!=`number`)return}return new Jt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){let r=e.values,i=t.values;if(r.length!==i.length)throw new Kt(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);let a=[];for(let e=0;e<r.length;e+=2){if(r[e]!==i[e])throw new Kt(`Cannot interpolate values containing mismatched anchors. from[${e}]: ${r[e]}, to[${e}]: ${i[e]}`);a.push(r[e]);let[t,o]=r[e+1],[s,c]=i[e+1];a.push([Rt(t,s,n),Rt(o,c,n)])}return new Jt(a)}}class Yt{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Yt({name:e,available:!1}):null}}class Xt{constructor(e,t,n){this.from=e,this.to=t,this.transition=n}static interpolate(e,t,n){return new Xt(e,t,n)}static parse(e){return e instanceof Xt?e:Array.isArray(e)&&e.length===3&&typeof e[0]==`string`&&typeof e[1]==`string`&&typeof e[2]==`number`?new Xt(e[0],e[1],e[2]):typeof e==`object`&&typeof e.from==`string`&&typeof e.to==`string`&&typeof e.transition==`number`?new Xt(e.from,e.to,e.transition):typeof e==`string`?new Xt(e,e,1):void 0}}function Zt(e,t,n,r){return typeof e==`number`&&e>=0&&e<=255&&typeof t==`number`&&t>=0&&t<=255&&typeof n==`number`&&n>=0&&n<=255?r===void 0||typeof r==`number`&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,n,r].join(`, `)}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof r==`number`?[e,t,n,r]:[e,t,n]).join(`, `)}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Qt(e){if(e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`||e instanceof Xt||e instanceof V||e instanceof Bt||e instanceof H||e instanceof Ut||e instanceof Wt||e instanceof Gt||e instanceof Jt||e instanceof Yt)return!0;if(Array.isArray(e)){for(let t of e)if(!Qt(t))return!1;return!0}if(typeof e==`object`){for(let t in e)if(!Qt(e[t]))return!1;return!0}return!1}function $t(e){if(e===null)return et;if(typeof e==`string`)return L;if(typeof e==`boolean`)return R;if(typeof e==`number`)return I;if(e instanceof V)return tt;if(e instanceof Xt)return nt;if(e instanceof Bt)return it;if(e instanceof H)return at;if(e instanceof Ut)return ot;if(e instanceof Wt)return ct;if(e instanceof Gt)return st;if(e instanceof Jt)return ut;if(e instanceof Yt)return lt;if(Array.isArray(e)){let t=e.length,n;for(let t of e){let e=$t(t);if(n){if(n===e)continue;n=z;break}n=e}return dt(n||z,t)}return rt}function en(e){let t=typeof e;return e===null?``:t===`string`||t===`number`||t===`boolean`?String(e):e instanceof V||e instanceof Xt||e instanceof H||e instanceof Ut||e instanceof Wt||e instanceof Gt||e instanceof Jt||e instanceof Yt?e.toString():JSON.stringify(e)}class tn{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Qt(e[1]))return t.error(`invalid value`);let n=e[1],r=$t(n),i=t.expectedType;return r.kind!==`array`||r.N!==0||!i||i.kind!==`array`||typeof i.N==`number`&&i.N!==0||(r=i),new tn(r,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}let nn={string:L,number:I,boolean:R,object:rt};class rn{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n,r=1,i=e[0];if(i===`array`){let i,a;if(e.length>2){let n=e[1];if(typeof n!=`string`||!(n in nn)||n===`object`)return t.error(`The item type argument of "array" must be one of string, number, boolean`,1);i=nn[n],r++}else i=z;if(e.length>3){if(e[2]!==null&&(typeof e[2]!=`number`||e[2]<0||e[2]!==Math.floor(e[2])))return t.error(`The length argument to "array" must be a positive integer literal`,2);a=e[2],r++}n=dt(i,a)}else{if(!nn[i])throw Error(`Types doesn't contain name = ${i}`);n=nn[i]}let a=[];for(;r<e.length;r++){let n=t.parse(e[r],r,z);if(!n)return null;a.push(n)}return new rn(n,a)}evaluate(e){for(let t=0;t<this.args.length;t++){let n=this.args[t].evaluate(e);if(!pt(this.type,$t(n)))return n;if(t===this.args.length-1)throw new Kt(`Expected value to be of type ${B(this.type)}, but found ${B($t(n))} instead.`)}throw Error()}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}let an={"to-boolean":R,"to-color":tt,"to-number":I,"to-string":L};class on{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n=e[0];if(!an[n])throw Error(`Can't parse ${n} as it is not part of the known types`);if((n===`to-boolean`||n===`to-string`)&&e.length!==2)return t.error(`Expected one argument.`);let r=an[n],i=[];for(let n=1;n<e.length;n++){let r=t.parse(e[n],n,z);if(!r)return null;i.push(r)}return new on(r,i)}evaluate(e){switch(this.type.kind){case`boolean`:return!!this.args[0].evaluate(e);case`color`:{let t,n;for(let r of this.args){if(t=r.evaluate(e),n=null,t instanceof V)return t;if(typeof t==`string`){let n=e.parseColor(t);if(n)return n}else if(Array.isArray(t)&&(n=t.length<3||t.length>4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Zt(t[0],t[1],t[2],t[3]),!n))return new V(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Kt(n||`Could not parse color from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`padding`:{let t;for(let n of this.args){t=n.evaluate(e);let r=Ut.parse(t);if(r)return r}throw new Kt(`Could not parse padding from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`numberArray`:{let t;for(let n of this.args){t=n.evaluate(e);let r=Wt.parse(t);if(r)return r}throw new Kt(`Could not parse numberArray from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`colorArray`:{let t;for(let n of this.args){t=n.evaluate(e);let r=Gt.parse(t);if(r)return r}throw new Kt(`Could not parse colorArray from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`variableAnchorOffsetCollection`:{let t;for(let n of this.args){t=n.evaluate(e);let r=Jt.parse(t);if(r)return r}throw new Kt(`Could not parse variableAnchorOffsetCollection from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`number`:{let t=null;for(let n of this.args){if(t=n.evaluate(e),t===null)return 0;let r=Number(t);if(!isNaN(r))return r}throw new Kt(`Could not convert ${JSON.stringify(t)} to number.`)}case`formatted`:return H.fromString(en(this.args[0].evaluate(e)));case`resolvedImage`:return Yt.fromString(en(this.args[0].evaluate(e)));case`projectionDefinition`:return this.args[0].evaluate(e);default:return en(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}let sn=[`Unknown`,`Point`,`LineString`,`Polygon`];class cn{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`?sn[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(e){let t=this._parseColorCache.get(e);return t||(t=V.parse(e),this._parseColorCache.set(e,t)),t}}class U{constructor(e,t,n=[],r,i=new $e,a=[]){this.registry=e,this.path=n,this.key=n.map((e=>`[${e}]`)).join(``),this.scope=i,this.errors=a,this.expectedType=r,this._isConstant=t}parse(e,t,n,r,i={}){return t?this.concat(t,n,r)._parse(e,i):this._parse(e,i)}_parse(e,t){function n(e,t,n){return n===`assert`?new rn(t,[e]):n===`coerce`?new on(t,[e]):e}if(e!==null&&typeof e!=`string`&&typeof e!=`boolean`&&typeof e!=`number`||(e=[`literal`,e]),Array.isArray(e)){if(e.length===0)return this.error(`Expected an array with at least one element. If you wanted a literal array, use ["literal", []].`);let r=e[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 i=this.registry[r];if(i){let r=i.parse(e,this);if(!r)return null;if(this.expectedType){let e=this.expectedType,i=r.type;if(e.kind!==`string`&&e.kind!==`number`&&e.kind!==`boolean`&&e.kind!==`object`&&e.kind!==`array`||i.kind!==`value`){if(e.kind===`projectionDefinition`&&[`string`,`array`].includes(i.kind)||[`color`,`formatted`,`resolvedImage`].includes(e.kind)&&[`value`,`string`].includes(i.kind)||[`padding`,`numberArray`].includes(e.kind)&&[`value`,`number`,`array`].includes(i.kind)||e.kind===`colorArray`&&[`value`,`string`,`array`].includes(i.kind)||e.kind===`variableAnchorOffsetCollection`&&[`value`,`array`].includes(i.kind))r=n(r,e,t.typeAnnotation||`coerce`);else if(this.checkSubtype(e,i))return null}else r=n(r,e,t.typeAnnotation||`assert`)}if(!(r instanceof tn)&&r.type.kind!==`resolvedImage`&&this._isConstant(r)){let e=new cn;try{r=new tn(r.type,r.evaluate(e))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?`'undefined' value invalid. Use null instead.`:typeof e==`object`?`Bare objects invalid. Use ["literal", {...}] instead.`:`Expected an array, but found ${typeof e} instead.`)}concat(e,t,n){let r=typeof e==`number`?this.path.concat(e):this.path,i=n?this.scope.concat(n):this.scope;return new U(this.registry,this._isConstant,r,t||null,i,this.errors)}error(e,...t){let n=`${this.key}${t.map((e=>`[${e}]`)).join(``)}`;this.errors.push(new Qe(n,e))}checkSubtype(e,t){let n=pt(e,t);return n&&this.error(n),n}}class W{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let n=[];for(let r=1;r<e.length-1;r+=2){let i=e[r];if(typeof i!=`string`)return t.error(`Expected string, but found ${typeof i} instead.`,r);if(/[^a-zA-Z0-9_]/.test(i))return t.error(`Variable names must contain only alphanumeric characters or '_'.`,r);let a=t.parse(e[r+1],r+1);if(!a)return null;n.push([i,a])}let r=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return r?new W(n,r):null}outputDefined(){return this.result.outputDefined()}}class ln{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!=`string`)return t.error(`'var' expression requires exactly one string literal argument.`);let n=e[1];return t.scope.has(n)?new ln(n,t.scope.get(n)):t.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class G{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,I),r=t.parse(e[2],2,dt(t.expectedType||z));return n&&r?new G(r.type.itemType,n,r):null}evaluate(e){let t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new Kt(`Array index out of bounds: ${t} < 0.`);if(t>=n.length)throw new Kt(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new Kt(`Array index must be an integer, but found ${t} instead.`);return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class un{constructor(e,t){this.type=R,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,z),r=t.parse(e[2],2,z);return n&&r?mt(n.type,[R,L,I,et,z])?new un(n,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${B(n.type)} instead`):null}evaluate(e){let t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!ht(t,[`boolean`,`string`,`number`,`null`]))throw new Kt(`Expected first argument to be of type boolean, string, number or null, but found ${B($t(t))} instead.`);if(!ht(n,[`string`,`array`]))throw new Kt(`Expected second argument to be of type array or string, but found ${B($t(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class dn{constructor(e,t,n){this.type=I,this.needle=e,this.haystack=t,this.fromIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,z),r=t.parse(e[2],2,z);if(!n||!r)return null;if(!mt(n.type,[R,L,I,et,z]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${B(n.type)} instead`);if(e.length===4){let i=t.parse(e[3],3,I);return i?new dn(n,r,i):null}return new dn(n,r)}evaluate(e){let t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!ht(t,[`boolean`,`string`,`number`,`null`]))throw new Kt(`Expected first argument to be of type boolean, string, number or null, but found ${B($t(t))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(e)),ht(n,[`string`])){let e=n.indexOf(t,r);return e===-1?-1:[...n.slice(0,e)].length}if(ht(n,[`array`]))return n.indexOf(t,r);throw new Kt(`Expected second argument to be of type array or string, but found ${B($t(n))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class fn{constructor(e,t,n,r,i,a){this.inputType=e,this.type=t,this.input=n,this.cases=r,this.outputs=i,this.otherwise=a}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error(`Expected an even number of arguments.`);let n,r;t.expectedType&&t.expectedType.kind!==`value`&&(r=t.expectedType);let i={},a=[];for(let o=2;o<e.length-1;o+=2){let s=e[o],c=e[o+1];Array.isArray(s)||(s=[s]);let l=t.concat(o);if(s.length===0)return l.error(`Expected at least one branch label.`);for(let e of s){if(typeof e!=`number`&&typeof e!=`string`)return l.error(`Branch labels must be numbers or strings.`);if(typeof e==`number`&&Math.abs(e)>2**53-1)return l.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof e==`number`&&Math.floor(e)!==e)return l.error(`Numeric branch labels must be integer values.`);if(n){if(l.checkSubtype(n,$t(e)))return null}else n=$t(e);if(i[String(e)]!==void 0)return l.error(`Branch labels must be unique.`);i[String(e)]=a.length}let u=t.parse(c,o,r);if(!u)return null;r||=u.type,a.push(u)}let o=t.parse(e[1],1,z);if(!o)return null;let s=t.parse(e[e.length-1],e.length-1,r);return s?o.type.kind!==`value`&&t.concat(1).checkSubtype(n,o.type)?null:new fn(n,r,o,i,a,s):null}evaluate(e){let t=this.input.evaluate(e);return($t(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}}class pn{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error(`Expected an odd number of arguments.`);let n;t.expectedType&&t.expectedType.kind!==`value`&&(n=t.expectedType);let r=[];for(let i=1;i<e.length-1;i+=2){let a=t.parse(e[i],i,R);if(!a)return null;let o=t.parse(e[i+1],i+1,n);if(!o)return null;r.push([a,o]),n||=o.type}let i=t.parse(e[e.length-1],e.length-1,n);if(!i)return null;if(!n)throw Error(`Can't infer output type`);return new pn(n,r,i)}evaluate(e){for(let[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every((([e,t])=>t.outputDefined()))&&this.otherwise.outputDefined()}}class mn{constructor(e,t,n,r){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,z),r=t.parse(e[2],2,I);if(!n||!r)return null;if(!mt(n.type,[dt(z),L,z]))return t.error(`Expected first argument to be of type array or string, but found ${B(n.type)} instead`);if(e.length===4){let i=t.parse(e[3],3,I);return i?new mn(n.type,n,r,i):null}return new mn(n.type,n,r)}evaluate(e){let t=this.input.evaluate(e),n=this.beginIndex.evaluate(e),r;if(this.endIndex&&(r=this.endIndex.evaluate(e)),ht(t,[`string`]))return[...t].slice(n,r).join(``);if(ht(t,[`array`]))return t.slice(n,r);throw new Kt(`Expected first argument to be of type array or string, but found ${B($t(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function hn(e,t){let n=e.length-1,r,i,a=0,o=n,s=0;for(;a<=o;)if(s=Math.floor((a+o)/2),r=e[s],i=e[s+1],r<=t){if(s===n||t<i)return s;a=s+1}else{if(!(r>t))throw new Kt(`Input is not a number.`);o=s-1}return 0}class gn{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(let[e,t]of n)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error(`Expected an even number of arguments.`);let n=t.parse(e[1],1,I);if(!n)return null;let r=[],i=null;t.expectedType&&t.expectedType.kind!==`value`&&(i=t.expectedType);for(let n=1;n<e.length;n+=2){let a=n===1?-1/0:e[n],o=e[n+1],s=n,c=n+1;if(typeof a!=`number`)return t.error(`Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.`,s);if(r.length&&r[r.length-1][0]>=a)return t.error(`Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.`,s);let l=t.parse(o,c,i);if(!l)return null;i||=l.type,r.push([a,l])}return new gn(i,n,r)}evaluate(e){let t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);let r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);let i=t.length;return r>=t[i-1]?n[i-1].evaluate(e):n[hn(t,r)].evaluate(e)}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function _n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var vn,yn,bn=_n(function(){if(yn)return vn;function e(e,t,n,r){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=r}return yn=1,vn=e,e.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,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,r=0;r<8;r++){var i=this.sampleCurveX(n)-e;if(Math.abs(i)<t)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n-=i/a}var o=0,s=1;for(n=e,r=0;r<20&&(i=this.sampleCurveX(n),!(Math.abs(i-e)<t));r++)e>i?o=n:s=n,n=.5*(s-o)+o;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},vn}());class xn{constructor(e,t,n,r,i){this.type=e,this.operator=t,this.interpolation=n,this.input=r,this.labels=[],this.outputs=[];for(let[e,t]of i)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,n,r){let i=0;if(e.name===`exponential`)i=Sn(t,e.base,n,r);else if(e.name===`linear`)i=Sn(t,1,n,r);else if(e.name===`cubic-bezier`){let a=e.controlPoints;i=new bn(a[0],a[1],a[2],a[3]).solve(Sn(t,1,n,r))}return i}static parse(e,t){let[n,r,i,...a]=e;if(!Array.isArray(r)||r.length===0)return t.error(`Expected an interpolation type expression.`,1);if(r[0]===`linear`)r={name:`linear`};else if(r[0]===`exponential`){let e=r[1];if(typeof e!=`number`)return t.error(`Exponential interpolation requires a numeric base.`,1,1);r={name:`exponential`,base:e}}else{if(r[0]!==`cubic-bezier`)return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{let e=r.slice(1);if(e.length!==4||e.some((e=>typeof e!=`number`||e<0||e>1)))return t.error(`Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.`,1);r={name:`cubic-bezier`,controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error(`Expected an even number of arguments.`);if(i=t.parse(i,2,I),!i)return null;let o=[],s=null;n!==`interpolate-hcl`&&n!==`interpolate-lab`||t.expectedType==st?t.expectedType&&t.expectedType.kind!==`value`&&(s=t.expectedType):s=tt;for(let e=0;e<a.length;e+=2){let n=a[e],r=a[e+1],i=e+3,c=e+4;if(typeof n!=`number`)return t.error(`Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.`,i);if(o.length&&o[o.length-1][0]>=n)return t.error(`Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.`,i);let l=t.parse(r,c,s);if(!l)return null;s||=l.type,o.push([n,l])}return gt(s,I)||gt(s,nt)||gt(s,tt)||gt(s,ot)||gt(s,ct)||gt(s,st)||gt(s,ut)||gt(s,dt(I))?new xn(s,n,r,i,o):t.error(`Type ${B(s)} is not interpolatable.`)}evaluate(e){let t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);let r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);let i=t.length;if(r>=t[i-1])return n[i-1].evaluate(e);let a=hn(t,r),o=xn.interpolationFactor(this.interpolation,r,t[a],t[a+1]),s=n[a].evaluate(e),c=n[a+1].evaluate(e);switch(this.operator){case`interpolate`:switch(this.type.kind){case`number`:return Rt(s,c,o);case`color`:return V.interpolate(s,c,o);case`padding`:return Ut.interpolate(s,c,o);case`colorArray`:return Gt.interpolate(s,c,o);case`numberArray`:return Wt.interpolate(s,c,o);case`variableAnchorOffsetCollection`:return Jt.interpolate(s,c,o);case`array`:return zt(s,c,o);case`projectionDefinition`:return Xt.interpolate(s,c,o)}case`interpolate-hcl`:switch(this.type.kind){case`color`:return V.interpolate(s,c,o,`hcl`);case`colorArray`:return Gt.interpolate(s,c,o,`hcl`)}case`interpolate-lab`:switch(this.type.kind){case`color`:return V.interpolate(s,c,o,`lab`);case`colorArray`:return Gt.interpolate(s,c,o,`lab`)}}}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Sn(e,t,n,r){let i=r-n,a=e-n;return i===0?0:t===1?a/i:(t**+a-1)/(t**+i-1)}let Cn={color:V.interpolate,number:Rt,padding:Ut.interpolate,numberArray:Wt.interpolate,colorArray:Gt.interpolate,variableAnchorOffsetCollection:Jt.interpolate,array:zt};class wn{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n=null,r=t.expectedType;r&&r.kind!==`value`&&(n=r);let i=[];for(let r of e.slice(1)){let e=t.parse(r,1+i.length,n,void 0,{typeAnnotation:`omit`});if(!e)return null;n||=e.type,i.push(e)}if(!n)throw Error(`No output type`);return new wn(r&&i.some((e=>pt(r,e.type)))?z:n,i)}evaluate(e){let t,n=null,r=0;for(let i of this.args)if(r++,n=i.evaluate(e),n&&n instanceof Yt&&!n.available&&(t||=n.name,n=null,r===this.args.length&&(n=t)),n!==null)break;return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function Tn(e,t){return e===`==`||e===`!=`?t.kind===`boolean`||t.kind===`string`||t.kind===`number`||t.kind===`null`||t.kind===`value`:t.kind===`string`||t.kind===`number`||t.kind===`value`}function En(e,t,n,r){return r.compare(t,n)===0}function Dn(e,t,n){let r=e!==`==`&&e!==`!=`;return class i{constructor(e,t,n){this.type=R,this.lhs=e,this.rhs=t,this.collator=n,this.hasUntypedArgument=e.type.kind===`value`||t.type.kind===`value`}static parse(e,t){if(e.length!==3&&e.length!==4)return t.error(`Expected two or three arguments.`);let n=e[0],a=t.parse(e[1],1,z);if(!a)return null;if(!Tn(n,a.type))return t.concat(1).error(`"${n}" comparisons are not supported for type '${B(a.type)}'.`);let o=t.parse(e[2],2,z);if(!o)return null;if(!Tn(n,o.type))return t.concat(2).error(`"${n}" comparisons are not supported for type '${B(o.type)}'.`);if(a.type.kind!==o.type.kind&&a.type.kind!==`value`&&o.type.kind!==`value`)return t.error(`Cannot compare types '${B(a.type)}' and '${B(o.type)}'.`);r&&(a.type.kind===`value`&&o.type.kind!==`value`?a=new rn(o.type,[a]):a.type.kind!==`value`&&o.type.kind===`value`&&(o=new rn(a.type,[o])));let s=null;if(e.length===4){if(a.type.kind!==`string`&&o.type.kind!==`string`&&a.type.kind!==`value`&&o.type.kind!==`value`)return t.error(`Cannot use collator to compare non-string types.`);if(s=t.parse(e[3],3,it),!s)return null}return new i(a,o,s)}evaluate(i){let a=this.lhs.evaluate(i),o=this.rhs.evaluate(i);if(r&&this.hasUntypedArgument){let t=$t(a),n=$t(o);if(t.kind!==n.kind||t.kind!==`string`&&t.kind!==`number`)throw new Kt(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${n.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){let e=$t(a),n=$t(o);if(e.kind!==`string`||n.kind!==`string`)return t(i,a,o)}return this.collator?n(i,a,o,this.collator.evaluate(i)):t(i,a,o)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}let On=Dn(`==`,(function(e,t,n){return t===n}),En),kn=Dn(`!=`,(function(e,t,n){return t!==n}),(function(e,t,n,r){return!En(0,t,n,r)})),An=Dn(`<`,(function(e,t,n){return t<n}),(function(e,t,n,r){return r.compare(t,n)<0})),jn=Dn(`>`,(function(e,t,n){return t>n}),(function(e,t,n,r){return r.compare(t,n)>0})),Mn=Dn(`<=`,(function(e,t,n){return t<=n}),(function(e,t,n,r){return r.compare(t,n)<=0})),Nn=Dn(`>=`,(function(e,t,n){return t>=n}),(function(e,t,n,r){return r.compare(t,n)>=0}));class Pn{constructor(e,t,n){this.type=it,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error(`Expected one argument.`);let n=e[1];if(typeof n!=`object`||Array.isArray(n))return t.error(`Collator options argument must be an object.`);let r=t.parse(n[`case-sensitive`]!==void 0&&n[`case-sensitive`],1,R);if(!r)return null;let i=t.parse(n[`diacritic-sensitive`]!==void 0&&n[`diacritic-sensitive`],1,R);if(!i)return null;let a=null;return n.locale&&(a=t.parse(n.locale,1,L),!a)?null:new Pn(r,i,a)}evaluate(e){return new Bt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class Fn{constructor(e,t,n,r,i,a){this.type=L,this.number=e,this.locale=t,this.currency=n,this.unit=r,this.minFractionDigits=i,this.maxFractionDigits=a}static parse(e,t){if(e.length!==3)return t.error(`Expected two arguments.`);let n=t.parse(e[1],1,I);if(!n)return null;let r=e[2];if(typeof r!=`object`||Array.isArray(r))return t.error(`NumberFormat options argument must be an object.`);let i=null;if(r.locale&&(i=t.parse(r.locale,1,L),!i))return null;let a=null;if(r.currency&&(a=t.parse(r.currency,1,L),!a))return null;let o=null;if(r.unit&&(o=t.parse(r.unit,1,L),!o))return null;if(a&&o)return t.error("NumberFormat options `currency` and `unit` are mutually exclusive");let s=null;if(r[`min-fraction-digits`]&&(s=t.parse(r[`min-fraction-digits`],1,I),!s))return null;let c=null;return r[`max-fraction-digits`]&&(c=t.parse(r[`max-fraction-digits`],1,I),!c)?null:new Fn(n,i,a,o,s,c)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?`currency`:this.unit?`unit`:`decimal`,currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class In{constructor(e){this.type=at,this.sections=e}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n=e[1];if(!Array.isArray(n)&&typeof n==`object`)return t.error(`First argument must be an image or text section.`);let r=[],i=!1;for(let n=1;n<=e.length-1;++n){let a=e[n];if(i&&typeof a==`object`&&!Array.isArray(a)){i=!1;let e=null;if(a[`font-scale`]&&(e=t.parse(a[`font-scale`],1,I),!e))return null;let n=null;if(a[`text-font`]&&(n=t.parse(a[`text-font`],1,dt(L)),!n))return null;let o=null;if(a[`text-color`]&&(o=t.parse(a[`text-color`],1,tt),!o))return null;let s=null;if(a[`vertical-align`]){if(typeof a[`vertical-align`]==`string`&&!Vt.includes(a[`vertical-align`]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${a[`vertical-align`]}' instead.`);if(s=t.parse(a[`vertical-align`],1,L),!s)return null}let c=r[r.length-1];c.scale=e,c.font=n,c.textColor=o,c.verticalAlign=s}else{let a=t.parse(e[n],1,z);if(!a)return null;let o=a.type.kind;if(o!==`string`&&o!==`value`&&o!==`null`&&o!==`resolvedImage`)return t.error(`Formatted text type must be 'string', 'value', 'image' or 'null'.`);i=!0,r.push({content:a,scale:null,font:null,textColor:null,verticalAlign:null})}}return new In(r)}evaluate(e){return new H(this.sections.map((t=>{let n=t.content.evaluate(e);return $t(n)===lt?new Ht(``,n,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new Ht(en(n),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(`,`):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.evaluate(e):null)})))}eachChild(e){for(let t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class Ln{constructor(e){this.type=lt,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected two arguments.`);let n=t.parse(e[1],1,L);return n?new Ln(n):t.error(`No image name provided.`)}evaluate(e){let t=this.input.evaluate(e),n=Yt.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}}class Rn{constructor(e){this.type=I,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=t.parse(e[1],1);return n?n.type.kind!==`array`&&n.type.kind!==`string`&&n.type.kind!==`value`?t.error(`Expected argument of type string or array, but found ${B(n.type)} instead.`):new Rn(n):null}evaluate(e){let t=this.input.evaluate(e);if(typeof t==`string`)return[...t].length;if(Array.isArray(t))return t.length;throw new Kt(`Expected value to be of type string or array, but found ${B($t(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}let zn=8192;function Bn(e,t){let n=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,i=2**t.z;return[Math.round(n*i*zn),Math.round(r*i*zn)]}function Vn(e,t){let n=2**t.z;return[(i=(e[0]/zn+t.x)/n,360*i-180),(r=(e[1]/zn+t.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,i}function Hn(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Un(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Wn(e,t,n){let r=e[0]-t[0],i=e[1]-t[1],a=e[0]-n[0],o=e[1]-n[1];return r*o-a*i==0&&r*a<=0&&i*o<=0}function Gn(e,t,n,r){return(i=[r[0]-n[0],r[1]-n[1]])[0]*(a=[t[0]-e[0],t[1]-e[1]])[1]-i[1]*a[0]!=0&&!(!Zn(e,t,n,r)||!Zn(n,r,e,t));var i,a}function Kn(e,t,n){for(let r of n)for(let n=0;n<r.length-1;++n)if(Gn(e,t,r[n],r[n+1]))return!0;return!1}function qn(e,t,n=!1){let r=!1;for(let s of t)for(let t=0;t<s.length-1;t++){if(Wn(e,s[t],s[t+1]))return n;(a=s[t])[1]>(i=e)[1]!=(o=s[t+1])[1]>i[1]&&i[0]<(o[0]-a[0])*(i[1]-a[1])/(o[1]-a[1])+a[0]&&(r=!r)}var i,a,o;return r}function Jn(e,t){for(let n of t)if(qn(e,n))return!0;return!1}function Yn(e,t){for(let n of e)if(!qn(n,t))return!1;for(let n=0;n<e.length-1;++n)if(Kn(e[n],e[n+1],t))return!1;return!0}function Xn(e,t){for(let n of t)if(Yn(e,n))return!0;return!1}function Zn(e,t,n,r){let i=r[0]-n[0],a=r[1]-n[1],o=(e[0]-n[0])*a-i*(e[1]-n[1]),s=(t[0]-n[0])*a-i*(t[1]-n[1]);return o>0&&s<0||o<0&&s>0}function Qn(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=[];for(let r=0;r<e[i].length;r++){let o=Bn(e[i][r],n);Hn(t,o),a.push(o)}r.push(a)}return r}function $n(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=Qn(e[i],t,n);r.push(a)}return r}function er(e,t,n,r){if(e[0]<n[0]||e[0]>n[2]){let t=.5*r,i=e[0]-n[0]>t?-r:n[0]-e[0]>t?r:0;i===0&&(i=e[0]-n[2]>t?-r:n[2]-e[0]>t?r:0),e[0]+=i}Hn(t,e)}function tr(e,t,n,r){let i=2**r.z*zn,a=[r.x*zn,r.y*zn],o=[];for(let r of e)for(let e of r){let r=[e.x+a[0],e.y+a[1]];er(r,t,n,i),o.push(r)}return o}function nr(e,t,n,r){let i=2**r.z*zn,a=[r.x*zn,r.y*zn],o=[];for(let n of e){let e=[];for(let r of n){let n=[r.x+a[0],r.y+a[1]];Hn(t,n),e.push(n)}o.push(e)}if(t[2]-t[0]<=i/2){(s=t)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(let e of o)for(let r of e)er(r,t,n,i)}var s;return o}class rr{constructor(e,t){this.type=R,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Qt(e[1])){let t=e[1];if(t.type===`FeatureCollection`){let e=[];for(let n of t.features){let{type:t,coordinates:r}=n.geometry;t===`Polygon`&&e.push(r),t===`MultiPolygon`&&e.push(...r)}if(e.length)return new rr(t,{type:`MultiPolygon`,coordinates:e})}else if(t.type===`Feature`){let e=t.geometry.type;if(e===`Polygon`||e===`MultiPolygon`)return new rr(t,t.geometry)}else if(t.type===`Polygon`||t.type===`MultiPolygon`)return new rr(t,t)}return t.error(`'within' expression requires valid geojson object that contains polygon geometry type.`)}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()===`Point`)return function(e,t){let n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if(t.type===`Polygon`){let a=Qn(t.coordinates,r,i),o=tr(e.geometry(),n,r,i);if(!Un(n,r))return!1;for(let e of o)if(!qn(e,a))return!1}if(t.type===`MultiPolygon`){let a=$n(t.coordinates,r,i),o=tr(e.geometry(),n,r,i);if(!Un(n,r))return!1;for(let e of o)if(!Jn(e,a))return!1}return!0}(e,this.geometries);if(e.geometryType()===`LineString`)return function(e,t){let n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if(t.type===`Polygon`){let a=Qn(t.coordinates,r,i),o=nr(e.geometry(),n,r,i);if(!Un(n,r))return!1;for(let e of o)if(!Yn(e,a))return!1}if(t.type===`MultiPolygon`){let a=$n(t.coordinates,r,i),o=nr(e.geometry(),n,r,i);if(!Un(n,r))return!1;for(let e of o)if(!Xn(e,a))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let ir=class{constructor(e=[],t=(e,t)=>e<t?-1:+(e>t)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:n}=this,r=t[e];for(;e>0;){let i=e-1>>1,a=t[i];if(n(r,a)>=0)break;t[e]=a,e=i}t[e]=r}_down(e){let{data:t,compare:n}=this,r=this.length>>1,i=t[e];for(;e<r;){let r=1+(e<<1),a=r+1;if(a<this.length&&n(t[a],t[r])<0&&(r=a),n(t[r],i)>=0)break;t[e]=t[r],e=r}t[e]=i}};function ar(e,t,n=0,r=e.length-1,i=sr){for(;r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1);ar(e,t,Math.max(n,Math.floor(t-o*c/a+l)),Math.min(r,Math.floor(t+(a-o)*c/a+l)),i)}let a=e[t],o=n,s=r;for(or(e,n,t),i(e[r],a)>0&&or(e,n,r);o<s;){for(or(e,o,s),o++,s--;i(e[o],a)<0;)o++;for(;i(e[s],a)>0;)s--}i(e[n],a)===0?or(e,n,s):(s++,or(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}}function or(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function sr(e,t){return e<t?-1:+(e>t)}function cr(e,t){if(e.length<=1)return[e];let n=[],r,i;for(let t of e){let e=ur(t);e!==0&&(t.area=Math.abs(e),i===void 0&&(i=e<0),i===e<0?(r&&n.push(r),r=[t]):r.push(t))}if(r&&n.push(r),t>1)for(let e=0;e<n.length;e++)n[e].length<=t||(ar(n[e],t,1,n[e].length-1,lr),n[e]=n[e].slice(0,t));return n}function lr(e,t){return t.area-e.area}function ur(e){let t=0;for(let n,r,i=0,a=e.length,o=a-1;i<a;o=i++)n=e[i],r=e[o],t+=(r.x-n.x)*(n.y+r.y);return t}let dr=1/298.257223563,fr=dr*(2-dr),pr=Math.PI/180;class mr{constructor(e){let t=6378.137*pr*1e3,n=Math.cos(e*pr),r=1/(1-fr*(1-n*n)),i=Math.sqrt(r);this.kx=t*i*n,this.ky=t*i*r*(1-fr)}distance(e,t){let n=this.wrap(e[0]-t[0])*this.kx,r=(e[1]-t[1])*this.ky;return Math.sqrt(n*n+r*r)}pointOnLine(e,t){let n,r,i,a,o=1/0;for(let s=0;s<e.length-1;s++){let c=e[s][0],l=e[s][1],u=this.wrap(e[s+1][0]-c)*this.kx,d=(e[s+1][1]-l)*this.ky,f=0;u===0&&d===0||(f=(this.wrap(t[0]-c)*this.kx*u+(t[1]-l)*this.ky*d)/(u*u+d*d),f>1?(c=e[s+1][0],l=e[s+1][1]):f>0&&(c+=u/this.kx*f,l+=d/this.ky*f)),u=this.wrap(t[0]-c)*this.kx,d=(t[1]-l)*this.ky;let p=u*u+d*d;p<o&&(o=p,n=c,r=l,i=s,a=f)}return{point:[n,r],index:i,t:Math.max(0,Math.min(1,a))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function hr(e,t){return t[0]-e[0]}function gr(e){return e[1]-e[0]+1}function _r(e,t){return e[1]>=e[0]&&e[1]<t}function vr(e,t){if(e[0]>e[1])return[null,null];let n=gr(e);if(t){if(n===2)return[e,null];let t=Math.floor(n/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(n===1)return[e,null];let r=Math.floor(n/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function yr(e,t){if(!_r(t,e.length))return[1/0,1/0,-1/0,-1/0];let n=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)Hn(n,e[r]);return n}function br(e){let t=[1/0,1/0,-1/0,-1/0];for(let n of e)for(let e of n)Hn(t,e);return t}function xr(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function Sr(e,t,n){if(!xr(e)||!xr(t))return NaN;let r=0,i=0;return e[2]<t[0]&&(r=t[0]-e[2]),e[0]>t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(i=e[1]-t[3]),e[3]<t[1]&&(i=t[1]-e[3]),n.distance([0,0],[r,i])}function Cr(e,t,n){let r=n.pointOnLine(t,e);return n.distance(e,r.point)}function wr(e,t,n,r,i){let a=Math.min(Cr(e,[n,r],i),Cr(t,[n,r],i)),o=Math.min(Cr(n,[e,t],i),Cr(r,[e,t],i));return Math.min(a,o)}function Tr(e,t,n,r,i){if(!_r(t,e.length)||!_r(r,n.length))return 1/0;let a=1/0;for(let o=t[0];o<t[1];++o){let t=e[o],s=e[o+1];for(let e=r[0];e<r[1];++e){let r=n[e],o=n[e+1];if(Gn(t,s,r,o))return 0;a=Math.min(a,wr(t,s,r,o,i))}}return a}function Er(e,t,n,r,i){if(!_r(t,e.length)||!_r(r,n.length))return NaN;let a=1/0;for(let o=t[0];o<=t[1];++o)for(let t=r[0];t<=r[1];++t)if(a=Math.min(a,i.distance(e[o],n[t])),a===0)return a;return a}function Dr(e,t,n){if(qn(e,t,!0))return 0;let r=1/0;for(let i of t){let t=i[0],a=i[i.length-1];if(t!==a&&(r=Math.min(r,Cr(e,[a,t],n)),r===0))return r;let o=n.pointOnLine(i,e);if(r=Math.min(r,n.distance(e,o.point)),r===0)return r}return r}function K(e,t,n,r){if(!_r(t,e.length))return NaN;for(let r=t[0];r<=t[1];++r)if(qn(e[r],n,!0))return 0;let i=1/0;for(let a=t[0];a<t[1];++a){let t=e[a],o=e[a+1];for(let e of n)for(let n=0,a=e.length,s=a-1;n<a;s=n++){let a=e[s],c=e[n];if(Gn(t,o,a,c))return 0;i=Math.min(i,wr(t,o,a,c,r))}}return i}function Or(e,t){for(let n of e)for(let e of n)if(qn(e,t,!0))return!0;return!1}function kr(e,t,n,r=1/0){let i=br(e),a=br(t);if(r!==1/0&&Sr(i,a,n)>=r)return r;if(Un(i,a)){if(Or(e,t))return 0}else if(Or(t,e))return 0;let o=1/0;for(let r of e)for(let e=0,i=r.length,a=i-1;e<i;a=e++){let i=r[a],s=r[e];for(let e of t)for(let t=0,r=e.length,a=r-1;t<r;a=t++){let r=e[a],c=e[t];if(Gn(i,s,r,c))return 0;o=Math.min(o,wr(i,s,r,c,n))}}return o}function Ar(e,t,n,r,i,a){if(!a)return;let o=Sr(yr(r,a),i,n);o<t&&e.push([o,a,[0,0]])}function jr(e,t,n,r,i,a,o){if(!a||!o)return;let s=Sr(yr(r,a),yr(i,o),n);s<t&&e.push([s,a,o])}function Mr(e,t,n,r,i=1/0){let a=Math.min(r.distance(e[0],n[0][0]),i);if(a===0)return a;let o=new ir([[0,[0,e.length-1],[0,0]]],hr),s=br(n);for(;o.length>0;){let i=o.pop();if(i[0]>=a)continue;let c=i[1],l=t?50:100;if(gr(c)<=l){if(!_r(c,e.length))return NaN;if(t){let t=K(e,c,n,r);if(isNaN(t)||t===0)return t;a=Math.min(a,t)}else for(let t=c[0];t<=c[1];++t){let i=Dr(e[t],n,r);if(a=Math.min(a,i),a===0)return 0}}else{let n=vr(c,t);Ar(o,a,r,e,s,n[0]),Ar(o,a,r,e,s,n[1])}}return a}function Nr(e,t,n,r,i,a=1/0){let o=Math.min(a,i.distance(e[0],n[0]));if(o===0)return o;let s=new ir([[0,[0,e.length-1],[0,n.length-1]]],hr);for(;s.length>0;){let a=s.pop();if(a[0]>=o)continue;let c=a[1],l=a[2],u=t?50:100,d=r?50:100;if(gr(c)<=u&&gr(l)<=d){if(!_r(c,e.length)&&_r(l,n.length))return NaN;let a;if(t&&r)a=Tr(e,c,n,l,i),o=Math.min(o,a);else if(t&&!r){let t=e.slice(c[0],c[1]+1);for(let e=l[0];e<=l[1];++e)if(a=Cr(n[e],t,i),o=Math.min(o,a),o===0)return o}else if(!t&&r){let t=n.slice(l[0],l[1]+1);for(let n=c[0];n<=c[1];++n)if(a=Cr(e[n],t,i),o=Math.min(o,a),o===0)return o}else a=Er(e,c,n,l,i),o=Math.min(o,a)}else{let a=vr(c,t),u=vr(l,r);jr(s,o,i,e,n,a[0],u[0]),jr(s,o,i,e,n,a[0],u[1]),jr(s,o,i,e,n,a[1],u[0]),jr(s,o,i,e,n,a[1],u[1])}}return o}function Pr(e){return e.type===`MultiPolygon`?e.coordinates.map((e=>({type:`Polygon`,coordinates:e}))):e.type===`MultiLineString`?e.coordinates.map((e=>({type:`LineString`,coordinates:e}))):e.type===`MultiPoint`?e.coordinates.map((e=>({type:`Point`,coordinates:e}))):[e]}class Fr{constructor(e,t){this.type=I,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Qt(e[1])){let t=e[1];if(t.type===`FeatureCollection`)return new Fr(t,t.features.map((e=>Pr(e.geometry))).flat());if(t.type===`Feature`)return new Fr(t,Pr(t.geometry));if(`type`in t&&`coordinates`in t)return new Fr(t,Pr(t))}return t.error(`'distance' expression requires valid geojson object that contains polygon geometry type.`)}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()===`Point`)return function(e,t){let n=e.geometry(),r=n.flat().map((t=>Vn([t.x,t.y],e.canonical)));if(n.length===0)return NaN;let i=new mr(r[0][1]),a=1/0;for(let e of t){switch(e.type){case`Point`:a=Math.min(a,Nr(r,!1,[e.coordinates],!1,i,a));break;case`LineString`:a=Math.min(a,Nr(r,!1,e.coordinates,!0,i,a));break;case`Polygon`:a=Math.min(a,Mr(r,!1,e.coordinates,i,a))}if(a===0)return a}return a}(e,this.geometries);if(e.geometryType()===`LineString`)return function(e,t){let n=e.geometry(),r=n.flat().map((t=>Vn([t.x,t.y],e.canonical)));if(n.length===0)return NaN;let i=new mr(r[0][1]),a=1/0;for(let e of t){switch(e.type){case`Point`:a=Math.min(a,Nr(r,!0,[e.coordinates],!1,i,a));break;case`LineString`:a=Math.min(a,Nr(r,!0,e.coordinates,!0,i,a));break;case`Polygon`:a=Math.min(a,Mr(r,!0,e.coordinates,i,a))}if(a===0)return a}return a}(e,this.geometries);if(e.geometryType()===`Polygon`)return function(e,t){let n=e.geometry();if(n.length===0||n[0].length===0)return NaN;let r=cr(n,0).map((t=>t.map((t=>t.map((t=>Vn([t.x,t.y],e.canonical))))))),i=new mr(r[0][0][0][1]),a=1/0;for(let e of t)for(let t of r){switch(e.type){case`Point`:a=Math.min(a,Mr([e.coordinates],!1,t,i,a));break;case`LineString`:a=Math.min(a,Mr(e.coordinates,!0,t,i,a));break;case`Polygon`:a=Math.min(a,kr(t,e.coordinates,i,a))}if(a===0)return a}return a}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Ir{constructor(e){this.type=z,this.key=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=e[1];return n==null?t.error(`Global state property must be defined.`):typeof n==`string`?new Ir(n):t.error(`Global state property must be string, but found ${typeof e[1]} instead.`)}evaluate(e){let t=e.globals?.globalState;return t&&Object.keys(t).length!==0?Mt(t,this.key):null}eachChild(){}outputDefined(){return!1}}let Lr={"==":On,"!=":kn,">":jn,"<":An,">=":Nn,"<=":Mn,array:rn,at:G,boolean:rn,case:pn,coalesce:wn,collator:Pn,format:In,image:Ln,in:un,"index-of":dn,interpolate:xn,"interpolate-hcl":xn,"interpolate-lab":xn,length:Rn,let:W,literal:tn,match:fn,number:rn,"number-format":Fn,object:rn,slice:mn,step:gn,string:rn,"to-boolean":on,"to-color":on,"to-number":on,"to-string":on,var:ln,within:rr,distance:Fr,"global-state":Ir};class Rr{constructor(e,t,n,r){this.name=e,this.type=t,this._evaluate=n,this.args=r}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){let n=e[0],r=Rr.definitions[n];if(!r)return t.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);let i=Array.isArray(r)?r[0]:r.type,a=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,o=a.filter((([t])=>!Array.isArray(t)||t.length===e.length-1)),s=null;for(let[r,a]of o){s=new U(t.registry,Ur,t.path,null,t.scope);let o=[],c=!1;for(let t=1;t<e.length;t++){let n=e[t],i=Array.isArray(r)?r[t-1]:r.type,a=s.parse(n,1+o.length,i);if(!a){c=!0;break}o.push(a)}if(!c)if(Array.isArray(r)&&r.length!==o.length)s.error(`Expected ${r.length} arguments, but found ${o.length} instead.`);else{for(let e=0;e<o.length;e++){let t=Array.isArray(r)?r[e]:r.type,n=o[e];s.concat(e+1).checkSubtype(t,n.type)}if(s.errors.length===0)return new Rr(n,i,a,o)}}if(o.length===1)t.errors.push(...s.errors);else{let n=(o.length?o:a).map((([e])=>{return t=e,Array.isArray(t)?`(${t.map(B).join(`, `)})`:`(${B(t.type)}...)`;var t})).join(` | `),r=[];for(let n=1;n<e.length;n++){let i=t.parse(e[n],1+r.length);if(!i)return null;r.push(B(i.type))}t.error(`Expected arguments of type ${n}, but found (${r.join(`, `)}) instead.`)}return null}static register(e,t){Rr.definitions=t;for(let n in t)e[n]=Rr}}function zr(e,[t,n,r,i]){t=t.evaluate(e),n=n.evaluate(e),r=r.evaluate(e);let a=i?i.evaluate(e):1,o=Zt(t,n,r,a);if(o)throw new Kt(o);return new V(t/255,n/255,r/255,a,!1)}function Br(e,t){return e in t}function Vr(e,t){let n=t[e];return n===void 0?null:n}function Hr(e){return{type:e}}function Ur(e){if(e instanceof ln)return Ur(e.boundExpression);if(e instanceof Rr&&e.name===`error`||e instanceof Pn||e instanceof rr||e instanceof Fr||e instanceof Ir)return!1;let t=e instanceof on||e instanceof rn,n=!0;return e.eachChild((e=>{n=t?n&&Ur(e):n&&e instanceof tn})),!!n&&Wr(e)&&Kr(e,[`zoom`,`heatmap-density`,`elevation`,`line-progress`,`accumulated`,`is-supported-script`])}function Wr(e){if(e instanceof Rr&&(e.name===`get`&&e.args.length===1||e.name===`feature-state`||e.name===`has`&&e.args.length===1||e.name===`properties`||e.name===`geometry-type`||e.name===`id`||/^filter-/.test(e.name))||e instanceof rr||e instanceof Fr)return!1;let t=!0;return e.eachChild((e=>{t&&!Wr(e)&&(t=!1)})),t}function Gr(e){if(e instanceof Rr&&e.name===`feature-state`)return!1;let t=!0;return e.eachChild((e=>{t&&!Gr(e)&&(t=!1)})),t}function Kr(e,t){if(e instanceof Rr&&t.indexOf(e.name)>=0)return!1;let n=!0;return e.eachChild((e=>{n&&!Kr(e,t)&&(n=!1)})),n}function qr(e){return{result:`success`,value:e}}function Jr(e){return{result:`error`,value:e}}function Yr(e){return e[`property-type`]===`data-driven`||e[`property-type`]===`cross-faded-data-driven`}function Xr(e){return!!e.expression&&e.expression.parameters.indexOf(`zoom`)>-1}function Zr(e){return!!e.expression&&e.expression.interpolated}function q(e){return e instanceof Number?`number`:e instanceof String?`string`:e instanceof Boolean?`boolean`:Array.isArray(e)?`array`:e===null?`null`:typeof e}function Qr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&$t(e)===rt}function $r(e){return e}function ei(e,t){let n=e.stops&&typeof e.stops[0][0]==`object`,r=n||!(n||e.property!==void 0),i=e.type||(Zr(t)?`exponential`:`interval`),a=function(e){switch(e.type){case`color`:return V.parse;case`padding`:return Ut.parse;case`numberArray`:return Wt.parse;case`colorArray`:return Gt.parse;default:return null}}(t);if(a&&((e=Ze({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],a(e[1])]))),e.default=a(e.default?e.default:t.default)),e.colorSpace&&(o=e.colorSpace)!==`rgb`&&o!==`hcl`&&o!==`lab`)throw Error(`Unknown color space: "${e.colorSpace}"`);var o;let s=function(e){switch(e){case`exponential`:return ii;case`interval`:return ri;case`categorical`:return ni;case`identity`:return ai;default:throw Error(`Unknown function type "${e}"`)}}(i),c,l;if(i===`categorical`){c=Object.create(null);for(let t of e.stops)c[t[0]]=t[1];l=typeof e.stops[0][0]}if(n){let n={},r=[];for(let t=0;t<e.stops.length;t++){let i=e.stops[t],a=i[0].zoom;n[a]===void 0&&(n[a]={zoom:a,type:e.type,property:e.property,default:e.default,stops:[]},r.push(a)),n[a].stops.push([i[0].value,i[1]])}let i=[];for(let e of r)i.push([n[e].zoom,ei(n[e],t)]);let a={name:`linear`};return{kind:`composite`,interpolationType:a,interpolationFactor:xn.interpolationFactor.bind(void 0,a),zoomStops:i.map((e=>e[0])),evaluate:({zoom:n},r)=>ii({stops:i,base:e.base},t,n).evaluate(n,r)}}if(r){let n=i===`exponential`?{name:`exponential`,base:e.base===void 0?1:e.base}:null;return{kind:`camera`,interpolationType:n,interpolationFactor:xn.interpolationFactor.bind(void 0,n),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:n})=>s(e,t,n,c,l)}}return{kind:`source`,evaluate(n,r){let i=r&&r.properties?r.properties[e.property]:void 0;return i===void 0?ti(e.default,t.default):s(e,t,i,c,l)}}}function ti(e,t,n){return e===void 0?t===void 0?n===void 0?void 0:n:t:e}function ni(e,t,n,r,i){return ti(typeof n===i?r[n]:void 0,e.default,t.default)}function ri(e,t,n){if(q(n)!==`number`)return ti(e.default,t.default);let r=e.stops.length;if(r===1||n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[r-1][0])return e.stops[r-1][1];let i=hn(e.stops.map((e=>e[0])),n);return e.stops[i][1]}function ii(e,t,n){let r=e.base===void 0?1:e.base;if(q(n)!==`number`)return ti(e.default,t.default);let i=e.stops.length;if(i===1||n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[i-1][0])return e.stops[i-1][1];let a=hn(e.stops.map((e=>e[0])),n),o=function(e,t,n,r){let i=r-n,a=e-n;return i===0?0:t===1?a/i:(t**+a-1)/(t**+i-1)}(n,r,e.stops[a][0],e.stops[a+1][0]),s=e.stops[a][1],c=e.stops[a+1][1],l=Cn[t.type]||$r;return typeof s.evaluate==`function`?{evaluate(...t){let n=s.evaluate.apply(void 0,t),r=c.evaluate.apply(void 0,t);if(n!==void 0&&r!==void 0)return l(n,r,o,e.colorSpace)}}:l(s,c,o,e.colorSpace)}function ai(e,t,n){switch(t.type){case`color`:n=V.parse(n);break;case`formatted`:n=H.fromString(n.toString());break;case`resolvedImage`:n=Yt.fromString(n.toString());break;case`padding`:n=Ut.parse(n);break;case`colorArray`:n=Gt.parse(n);break;case`numberArray`:n=Wt.parse(n);break;default:q(n)===t.type||t.type===`enum`&&t.values[n]||(n=void 0)}return ti(n,e.default,t.default)}Rr.register(Lr,{error:[{kind:`error`},[L],(e,[t])=>{throw new Kt(t.evaluate(e))}],typeof:[L,[z],(e,[t])=>B($t(t.evaluate(e)))],"to-rgba":[dt(I,4),[tt],(e,[t])=>{let[n,r,i,a]=t.evaluate(e).rgb;return[255*n,255*r,255*i,a]}],rgb:[tt,[I,I,I],zr],rgba:[tt,[I,I,I,I],zr],has:{type:R,overloads:[[[L],(e,[t])=>Br(t.evaluate(e),e.properties())],[[L,rt],(e,[t,n])=>Br(t.evaluate(e),n.evaluate(e))]]},get:{type:z,overloads:[[[L],(e,[t])=>Vr(t.evaluate(e),e.properties())],[[L,rt],(e,[t,n])=>Vr(t.evaluate(e),n.evaluate(e))]]},"feature-state":[z,[L],(e,[t])=>Vr(t.evaluate(e),e.featureState||{})],properties:[rt,[],e=>e.properties()],"geometry-type":[L,[],e=>e.geometryType()],id:[z,[],e=>e.id()],zoom:[I,[],e=>e.globals.zoom],"heatmap-density":[I,[],e=>e.globals.heatmapDensity||0],elevation:[I,[],e=>e.globals.elevation||0],"line-progress":[I,[],e=>e.globals.lineProgress||0],accumulated:[z,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[I,Hr(I),(e,t)=>{let n=0;for(let r of t)n+=r.evaluate(e);return n}],"*":[I,Hr(I),(e,t)=>{let n=1;for(let r of t)n*=r.evaluate(e);return n}],"-":{type:I,overloads:[[[I,I],(e,[t,n])=>t.evaluate(e)-n.evaluate(e)],[[I],(e,[t])=>-t.evaluate(e)]]},"/":[I,[I,I],(e,[t,n])=>t.evaluate(e)/n.evaluate(e)],"%":[I,[I,I],(e,[t,n])=>t.evaluate(e)%n.evaluate(e)],ln2:[I,[],()=>Math.LN2],pi:[I,[],()=>Math.PI],e:[I,[],()=>Math.E],"^":[I,[I,I],(e,[t,n])=>t.evaluate(e)**+n.evaluate(e)],sqrt:[I,[I],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[I,[I],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[I,[I],(e,[t])=>Math.log(t.evaluate(e))],log2:[I,[I],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[I,[I],(e,[t])=>Math.sin(t.evaluate(e))],cos:[I,[I],(e,[t])=>Math.cos(t.evaluate(e))],tan:[I,[I],(e,[t])=>Math.tan(t.evaluate(e))],asin:[I,[I],(e,[t])=>Math.asin(t.evaluate(e))],acos:[I,[I],(e,[t])=>Math.acos(t.evaluate(e))],atan:[I,[I],(e,[t])=>Math.atan(t.evaluate(e))],min:[I,Hr(I),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[I,Hr(I),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[I,[I],(e,[t])=>Math.abs(t.evaluate(e))],round:[I,[I],(e,[t])=>{let n=t.evaluate(e);return n<0?-Math.round(-n):Math.round(n)}],floor:[I,[I],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[I,[I],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[R,[L,z],(e,[t,n])=>e.properties()[t.value]===n.value],"filter-id-==":[R,[z],(e,[t])=>e.id()===t.value],"filter-type-==":[R,[L],(e,[t])=>e.geometryType()===t.value],"filter-<":[R,[L,z],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r<i}],"filter-id-<":[R,[z],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n<r}],"filter->":[R,[L,z],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r>i}],"filter-id->":[R,[z],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n>r}],"filter-<=":[R,[L,z],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r<=i}],"filter-id-<=":[R,[z],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n<=r}],"filter->=":[R,[L,z],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r>=i}],"filter-id->=":[R,[z],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n>=r}],"filter-has":[R,[z],(e,[t])=>t.value in e.properties()],"filter-has-id":[R,[],e=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[R,[dt(L)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[R,[dt(z)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[R,[L,dt(z)],(e,[t,n])=>n.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[R,[L,dt(z)],(e,[t,n])=>function(e,t,n,r){for(;n<=r;){let i=n+r>>1;if(t[i]===e)return!0;t[i]>e?r=i-1:n=i+1}return!1}(e.properties()[t.value],n.value,0,n.value.length-1)],all:{type:R,overloads:[[[R,R],(e,[t,n])=>t.evaluate(e)&&n.evaluate(e)],[Hr(R),(e,t)=>{for(let n of t)if(!n.evaluate(e))return!1;return!0}]]},any:{type:R,overloads:[[[R,R],(e,[t,n])=>t.evaluate(e)||n.evaluate(e)],[Hr(R),(e,t)=>{for(let n of t)if(n.evaluate(e))return!0;return!1}]]},"!":[R,[R],(e,[t])=>!t.evaluate(e)],"is-supported-script":[R,[L],(e,[t])=>{let n=e.globals&&e.globals.isSupportedScript;return!n||n(t.evaluate(e))}],upcase:[L,[L],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[L,[L],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[L,Hr(z),(e,t)=>t.map((t=>en(t.evaluate(e)))).join(``)],split:[dt(L),[L,L],(e,[t,n])=>t.evaluate(e).split(n.evaluate(e))],join:[L,[dt(L),L],(e,[t,n])=>t.evaluate(e).join(n.evaluate(e))],"resolved-locale":[L,[it],(e,[t])=>t.evaluate(e).resolvedLocale()]});class oi{constructor(e,t,n){this.expression=e,this._warningHistory={},this._evaluator=new cn,this._defaultValue=t?function(e){if(e.type===`color`&&Qr(e.default))return new V(0,0,0,0);switch(e.type){case`color`:return V.parse(e.default)||null;case`padding`:return Ut.parse(e.default)||null;case`numberArray`:return Wt.parse(e.default)||null;case`colorArray`:return Gt.parse(e.default)||null;case`variableAnchorOffsetCollection`:return Jt.parse(e.default)||null;case`projectionDefinition`:return Xt.parse(e.default)||null;default:return e.default===void 0?null:e.default}}(t):null,this._enumValues=t&&t.type===`enum`?t.values:null,this._globalState=n}evaluateWithoutErrorHandling(e,t,n,r,i,a){return this._globalState&&(e=hi(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,r,i,a){this._globalState&&(e=hi(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=n||null,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a||null;try{let e=this.expression.evaluate(this._evaluator);if(e==null||typeof e==`number`&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new Kt(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(`, `)}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,typeof console<`u`&&console.warn(e.message)),this._defaultValue}}}function si(e){return Array.isArray(e)&&e.length>0&&typeof e[0]==`string`&&e[0]in Lr}function ci(e,t,n){let r=new U(Lr,Ur,[],t?function(e){let t={color:tt,string:L,number:I,enum:L,boolean:R,formatted:at,padding:ot,numberArray:ct,colorArray:st,projectionDefinition:nt,resolvedImage:lt,variableAnchorOffsetCollection:ut};return e.type===`array`?dt(t[e.value]||z,e.length):t[e.type]}(t):void 0),i=r.parse(e,void 0,void 0,void 0,t&&t.type===`string`?{typeAnnotation:`coerce`}:void 0);return i?qr(new oi(i,t,n)):Jr(r.errors)}class li{constructor(e,t,n){this.kind=e,this._styleExpression=t,this.isStateDependent=e!==`constant`&&!Gr(t.expression),this.globalStateRefs=mi(t.expression),this._globalState=n}evaluateWithoutErrorHandling(e,t,n,r,i,a){return this._globalState&&(e=hi(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,i,a)}evaluate(e,t,n,r,i,a){return this._globalState&&(e=hi(e,this._globalState)),this._styleExpression.evaluate(e,t,n,r,i,a)}}class ui{constructor(e,t,n,r,i){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent=e!==`camera`&&!Gr(t.expression),this.globalStateRefs=mi(t.expression),this.interpolationType=r,this._globalState=i}evaluateWithoutErrorHandling(e,t,n,r,i,a){return this._globalState&&(e=hi(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,i,a)}evaluate(e,t,n,r,i,a){return this._globalState&&(e=hi(e,this._globalState)),this._styleExpression.evaluate(e,t,n,r,i,a)}interpolationFactor(e,t,n){return this.interpolationType?xn.interpolationFactor(this.interpolationType,e,t,n):0}}function di(e,t,n){let r=ci(e,t,n);if(r.result===`error`)return r;let i=r.value.expression,a=Wr(i);if(!a&&!Yr(t))return Jr([new Qe(``,`data expressions not supported`)]);let o=Kr(i,[`zoom`]);if(!o&&!Xr(t))return Jr([new Qe(``,`zoom expressions not supported`)]);let s=pi(i);return s||o?s instanceof Qe?Jr([s]):s instanceof xn&&!Zr(t)?Jr([new Qe(``,`"interpolate" expressions cannot be used with this property`)]):qr(s?new ui(a?`camera`:`composite`,r.value,s.labels,s instanceof xn?s.interpolation:void 0,n):new li(a?`constant`:`source`,r.value,n)):Jr([new Qe(``,`"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.`)])}class fi{constructor(e,t){this._parameters=e,this._specification=t,Ze(this,ei(this._parameters,this._specification))}static deserialize(e){return new fi(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function pi(e){let t=null;if(e instanceof W)t=pi(e.result);else if(e instanceof wn){for(let n of e.args)if(t=pi(n),t)break}else (e instanceof gn||e instanceof xn)&&e.input instanceof Rr&&e.input.name===`zoom`&&(t=e);return t instanceof Qe||e.eachChild((e=>{let n=pi(e);n instanceof Qe?t=n:!t&&n?t=new Qe(``,`"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.`):t&&n&&t!==n&&(t=new Qe(``,`Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.`))})),t}function mi(e,t=new Set){return e instanceof Ir&&t.add(e.key),e.eachChild((e=>{mi(e,t)})),t}function hi(e,t){let{zoom:n,heatmapDensity:r,elevation:i,lineProgress:a,isSupportedScript:o,accumulated:s}=e??{};return{zoom:n,heatmapDensity:r,elevation:i,lineProgress:a,isSupportedScript:o,accumulated:s,globalState:t}}function gi(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||e.length===0)return!1;switch(e[0]){case`has`:return e.length>=2&&e[1]!==`$id`&&e[1]!==`$type`;case`in`:return e.length>=3&&(typeof e[1]!=`string`||Array.isArray(e[2]));case`!in`:case`!has`:case`none`:return!1;case`==`:case`!=`:case`>`:case`>=`:case`<`:case`<=`:return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2]);case`any`:case`all`:for(let t of e.slice(1))if(!gi(t)&&typeof t!=`boolean`)return!1;return!0;default:return!0}}let _i={type:`boolean`,default:!1,transition:!1,"property-type":`data-driven`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]}};function vi(e,t){if(e==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};gi(e)||(e=xi(e));let n=ci(e,_i,t);if(n.result===`error`)throw Error(n.value.map((e=>`${e.key}: ${e.message}`)).join(`, `));return{filter:(e,t,r)=>n.value.evaluate(e,t,{},r),needGeometry:bi(e),getGlobalStateRefs:()=>mi(n.value.expression)}}function yi(e,t){return e<t?-1:+(e>t)}function bi(e){if(!Array.isArray(e))return!1;if(e[0]===`within`||e[0]===`distance`)return!0;for(let t=1;t<e.length;t++)if(bi(e[t]))return!0;return!1}function xi(e){if(!e)return!0;let t=e[0];return e.length<=1?t!==`any`:t===`==`?Si(e[1],e[2],`==`):t===`!=`?Ti(Si(e[1],e[2],`==`)):t===`<`||t===`>`||t===`<=`||t===`>=`?Si(e[1],e[2],t):t===`any`?(n=e.slice(1),[`any`].concat(n.map(xi))):t===`all`?[`all`].concat(e.slice(1).map(xi)):t===`none`?[`all`].concat(e.slice(1).map(xi).map(Ti)):t===`in`?Ci(e[1],e.slice(2)):t===`!in`?Ti(Ci(e[1],e.slice(2))):t===`has`?wi(e[1]):t!==`!has`||Ti(wi(e[1]));var n}function Si(e,t,n){switch(e){case`$type`:return[`filter-type-${n}`,t];case`$id`:return[`filter-id-${n}`,t];default:return[`filter-${n}`,e,t]}}function Ci(e,t){if(t.length===0)return!1;switch(e){case`$type`:return[`filter-type-in`,[`literal`,t]];case`$id`:return[`filter-id-in`,[`literal`,t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?[`filter-in-large`,e,[`literal`,t.sort(yi)]]:[`filter-in-small`,e,[`literal`,t]]}}function wi(e){switch(e){case`$type`:return!0;case`$id`:return[`filter-has-id`];default:return[`filter-has`,e]}}function Ti(e){return[`!`,e]}function Ei(e){let t=typeof e;if(t===`number`||t===`boolean`||t===`string`||e==null)return JSON.stringify(e);if(Array.isArray(e)){let t=`[`;for(let n of e)t+=`${Ei(n)},`;return`${t}]`}let n=Object.keys(e).sort(),r=`{`;for(let t=0;t<n.length;t++)r+=`${JSON.stringify(n[t])}:${Ei(e[n[t]])},`;return`${r}}`}function Di(e){let t=``;for(let n of Ve)t+=`/${Ei(e[n])}`;return t}function Oi(e){let t=e.value;return t?[new F(e.key,t,`constants have been deprecated as of v8`)]:[]}function ki(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Ai(e){if(Array.isArray(e))return e.map(Ai);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let n in e)t[n]=Ai(e[n]);return t}return ki(e)}function ji(e){let t=e.key,n=e.value,r=e.valueSpec||{},i=e.objectElementValidators||{},a=e.style,o=e.styleSpec,s=e.validateSpec,c=[],l=q(n);if(l!==`object`)return[new F(t,n,`object expected, ${l} found`)];for(let e in n){let l=e.split(`.`)[0],u=Mt(r,l)||r[`*`],d;if(Mt(i,l))d=i[l];else if(Mt(r,l)){if(n[e]===void 0)continue;d=s}else if(i[`*`])d=i[`*`];else{if(!r[`*`]){c.push(new F(t,n[e],`unknown property "${e}"`));continue}d=s}c=c.concat(d({key:(t&&`${t}.`)+e,value:n[e],valueSpec:u,style:a,styleSpec:o,object:n,objectKey:e,validateSpec:s},n))}for(let e in r)i[e]||r[e].required&&r[e].default===void 0&&n[e]===void 0&&c.push(new F(t,n,`missing required property "${e}"`));return c}function Mi(e){let t=e.value,n=e.valueSpec,r=e.style,i=e.styleSpec,a=e.key,o=e.arrayElementValidator||e.validateSpec;if(q(t)!==`array`)return[new F(a,t,`array expected, ${q(t)} found`)];if(n.length&&t.length!==n.length)return[new F(a,t,`array length ${n.length} expected, length ${t.length} found`)];let s={type:n.value,values:n.values};i.$version<7&&(s.function=n.function),q(n.value)===`object`&&(s=n.value);let c=[];for(let n=0;n<t.length;n++)c=c.concat(o({array:t,arrayIndex:n,value:t[n],valueSpec:s,validateSpec:e.validateSpec,style:r,styleSpec:i,key:`${a}[${n}]`}));return c}function Ni(e){let t=e.key,n=e.value,r=e.valueSpec,i=q(n);return i===`number`&&n!=n&&(i=`NaN`),i===`number`?`minimum`in r&&n<r.minimum?[new F(t,n,`${n} is less than the minimum value ${r.minimum}`)]:`maximum`in r&&n>r.maximum?[new F(t,n,`${n} is greater than the maximum value ${r.maximum}`)]:[]:[new F(t,n,`number expected, ${i} found`)]}function Pi(e){let t=e.valueSpec,n=ki(e.value.type),r,i,a,o={},s=n!==`categorical`&&e.value.property===void 0,c=!s,l=q(e.value.stops)===`array`&&q(e.value.stops[0])===`array`&&q(e.value.stops[0][0])===`object`,u=ji({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if(n===`identity`)return[new F(e.key,e.value,`identity function may not have a "stops" property`)];let t=[],r=e.value;return t=t.concat(Mi({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:d})),q(r)===`array`&&r.length===0&&t.push(new F(e.key,r,`array must have at least one stop`)),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return n===`identity`&&s&&u.push(new F(e.key,e.value,`missing required property "property"`)),n===`identity`||e.value.stops||u.push(new F(e.key,e.value,`missing required property "stops"`)),n===`exponential`&&e.valueSpec.expression&&!Zr(e.valueSpec)&&u.push(new F(e.key,e.value,`exponential functions not supported`)),e.styleSpec.$version>=8&&(c&&!Yr(e.valueSpec)?u.push(new F(e.key,e.value,`property functions not supported`)):s&&!Xr(e.valueSpec)&&u.push(new F(e.key,e.value,`zoom functions not supported`))),n!==`categorical`&&!l||e.value.property!==void 0||u.push(new F(e.key,e.value,`"property" property is required`)),u;function d(e){let n=[],r=e.value,s=e.key;if(q(r)!==`array`)return[new F(s,r,`array expected, ${q(r)} found`)];if(r.length!==2)return[new F(s,r,`array length 2 expected, length ${r.length} found`)];if(l){if(q(r[0])!==`object`)return[new F(s,r,`object expected, ${q(r[0])} found`)];if(r[0].zoom===void 0)return[new F(s,r,`object stop key must have zoom`)];if(r[0].value===void 0)return[new F(s,r,`object stop key must have value`)];if(a&&a>ki(r[0].zoom))return[new F(s,r[0].zoom,`stop zoom values must appear in ascending order`)];ki(r[0].zoom)!==a&&(a=ki(r[0].zoom),i=void 0,o={}),n=n.concat(ji({key:`${s}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:Ni,value:f}}))}else n=n.concat(f({key:`${s}[0]`,value:r[0],validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},r));return si(Ai(r[1]))?n.concat([new F(`${s}[1]`,r[1],`expressions are not allowed in function stops.`)]):n.concat(e.validateSpec({key:`${s}[1]`,value:r[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function f(e,a){let s=q(e.value),c=ki(e.value),l=e.value===null?a:e.value;if(r){if(s!==r)return[new F(e.key,l,`${s} stop domain type must match previous stop domain type ${r}`)]}else r=s;if(s!==`number`&&s!==`string`&&s!==`boolean`)return[new F(e.key,l,`stop domain value must be a number, string, or boolean`)];if(s!==`number`&&n!==`categorical`){let r=`number expected, ${s} found`;return Yr(t)&&n===void 0&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new F(e.key,l,r)]}return n!==`categorical`||s!==`number`||isFinite(c)&&Math.floor(c)===c?n!==`categorical`&&s===`number`&&i!==void 0&&c<i?[new F(e.key,l,`stop domain values must appear in ascending order`)]:(i=c,n===`categorical`&&c in o?[new F(e.key,l,`stop domain values must be unique`)]:(o[c]=!0,[])):[new F(e.key,l,`integer expected, found ${c}`)]}}function Fi(e){let t=(e.expressionContext===`property`?di:ci)(Ai(e.value),e.valueSpec);if(t.result===`error`)return t.value.map((t=>new F(`${e.key}${t.key}`,e.value,t.message)));let n=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext===`property`&&e.propertyKey===`text-font`&&!n.outputDefined())return[new F(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if(e.expressionContext===`property`&&e.propertyType===`layout`&&!Gr(n))return[new F(e.key,e.value,`"feature-state" data expressions are not supported with layout properties.`)];if(e.expressionContext===`filter`&&!Gr(n))return[new F(e.key,e.value,`"feature-state" data expressions are not supported with filters.`)];if(e.expressionContext&&e.expressionContext.indexOf(`cluster`)===0){if(!Kr(n,[`zoom`,`feature-state`]))return[new F(e.key,e.value,`"zoom" and "feature-state" expressions are not supported with cluster properties.`)];if(e.expressionContext===`cluster-initial`&&!Wr(n))return[new F(e.key,e.value,`Feature data expressions are not supported with initial expression part of cluster properties.`)]}return[]}function Ii(e){let t=e.key,n=e.value,r=q(n);return r===`string`?V.parse(String(n))?[]:[new F(t,n,`color expected, "${n}" found`)]:[new F(t,n,`color expected, ${r} found`)]}function Li(e){let t=e.key,n=e.value,r=e.valueSpec,i=[];return Array.isArray(r.values)?r.values.indexOf(ki(n))===-1&&i.push(new F(t,n,`expected one of [${r.values.join(`, `)}], ${JSON.stringify(n)} found`)):Object.keys(r.values).indexOf(ki(n))===-1&&i.push(new F(t,n,`expected one of [${Object.keys(r.values).join(`, `)}], ${JSON.stringify(n)} found`)),i}function Ri(e){return gi(Ai(e.value))?Fi(Ze({},e,{expressionContext:`filter`,valueSpec:{value:`boolean`}})):zi(e)}function zi(e){let t=e.value,n=e.key;if(q(t)!==`array`)return[new F(n,t,`array expected, ${q(t)} found`)];let r=e.styleSpec,i,a=[];if(t.length<1)return[new F(n,t,`filter array must have at least 1 element`)];switch(a=a.concat(Li({key:`${n}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),ki(t[0])){case`<`:case`<=`:case`>`:case`>=`:t.length>=2&&ki(t[1])===`$type`&&a.push(new F(n,t,`"$type" cannot be use with operator "${t[0]}"`));case`==`:case`!=`:t.length!==3&&a.push(new F(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case`in`:case`!in`:t.length>=2&&(i=q(t[1]),i!==`string`&&a.push(new F(`${n}[1]`,t[1],`string expected, ${i} found`)));for(let o=2;o<t.length;o++)i=q(t[o]),ki(t[1])===`$type`?a=a.concat(Li({key:`${n}[${o}]`,value:t[o],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):i!==`string`&&i!==`number`&&i!==`boolean`&&a.push(new F(`${n}[${o}]`,t[o],`string, number, or boolean expected, ${i} found`));break;case`any`:case`all`:case`none`:for(let r=1;r<t.length;r++)a=a.concat(zi({key:`${n}[${r}]`,value:t[r],style:e.style,styleSpec:e.styleSpec}));break;case`has`:case`!has`:i=q(t[1]),t.length===2?i!==`string`&&a.push(new F(`${n}[1]`,t[1],`string expected, ${i} found`)):a.push(new F(n,t,`filter array for "${t[0]}" operator must have 2 elements`))}return a}function Bi(e,t){let n=e.key,r=e.validateSpec,i=e.style,a=e.styleSpec,o=e.value,s=e.objectKey,c=a[`${t}_${e.layerType}`];if(!c)return[];let l=s.match(/^(.*)-transition$/);if(t===`paint`&&l&&c[l[1]]&&c[l[1]].transition)return r({key:n,value:o,valueSpec:a.transition,style:i,styleSpec:a});let u=e.valueSpec||c[s];if(!u)return[new F(n,o,`unknown property "${s}"`)];let d;if(q(o)===`string`&&Yr(u)&&!u.tokens&&(d=/^{([^}]+)}$/.exec(o)))return[new F(n,o,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(d[1])} }\`.`)];let f=[];return e.layerType===`symbol`&&s===`text-font`&&Qr(Ai(o))&&ki(o.type)===`identity`&&f.push(new F(n,o,`"text-font" does not support identity functions`)),f.concat(r({key:e.key,value:o,valueSpec:u,style:i,styleSpec:a,expressionContext:`property`,propertyType:t,propertyKey:s}))}function Vi(e){return Bi(e,`paint`)}function Hi(e){return Bi(e,`layout`)}function Ui(e){var t,n;let r=[],i=e.value,a=e.key,o=e.style,s=e.styleSpec;if(q(i)!==`object`)return[new F(a,i,`object expected, ${q(i)} found`)];i.type||i.ref||r.push(new F(a,i,`either "type" or "ref" is required`));let c=ki(i.type),l=ki(i.ref);if(i.id){let t=ki(i.id);for(let n=0;n<e.arrayIndex;n++){let e=o.layers[n];ki(e.id)===t&&r.push(new F(a,i.id,`duplicate layer id "${i.id}", previously used at line ${e.id.__line__}`))}}if(`ref`in i){let e;[`type`,`source`,`source-layer`,`filter`,`layout`].forEach((e=>{e in i&&r.push(new F(a,i[e],`"${e}" is prohibited for ref layers`))})),o.layers.forEach((t=>{ki(t.id)===l&&(e=t)})),e?e.ref?r.push(new F(a,i.ref,`ref cannot reference another ref layer`)):c=ki(e.type):r.push(new F(a,i.ref,`ref layer "${l}" not found`))}else if(c!==`background`)if(i.source){let e=o.sources&&o.sources[i.source],t=e&&ki(e.type);e?t===`vector`&&c===`raster`?r.push(new F(a,i.source,`layer "${i.id}" requires a raster source`)):t!==`raster-dem`&&c===`hillshade`||t!==`raster-dem`&&c===`color-relief`?r.push(new F(a,i.source,`layer "${i.id}" requires a raster-dem source`)):t===`raster`&&c!==`raster`?r.push(new F(a,i.source,`layer "${i.id}" requires a vector source`)):t!==`vector`||i[`source-layer`]?t===`raster-dem`&&c!==`hillshade`&&c!==`color-relief`?r.push(new F(a,i.source,`raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.`)):c!==`line`||!i.paint||!i.paint[`line-gradient`]||t===`geojson`&&e.lineMetrics||r.push(new F(a,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new F(a,i,`layer "${i.id}" must specify a "source-layer"`)):r.push(new F(a,i.source,`source "${i.source}" not found`))}else r.push(new F(a,i,`missing required property "source"`));return c===`raster`&&(t=i.paint)!=null&&t.resampling&&(n=i.paint)!=null&&n[`raster-resampling`]&&r.push(new F(a,i.paint,`layer "${i.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),r=r.concat(ji({key:a,value:i,valueSpec:s.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${a}.type`,value:i.type,valueSpec:s.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:i,objectKey:`type`}),filter:Ri,layout:e=>ji({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Hi(Ze({layerType:c},e))}}),paint:e=>ji({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Vi(Ze({layerType:c},e))}})}})),r}function Wi(e){let t=e.value,n=e.key,r=q(t);return r===`string`?[]:[new F(n,t,`string expected, ${r} found`)]}let Gi={promoteId:function({key:e,value:t}){if(q(t)===`string`)return Wi({key:e,value:t});{let n=[];for(let r in t)n.push(...Wi({key:`${e}.${r}`,value:t[r]}));return n}}};function Ki(e){let t=e.value,n=e.key,r=e.styleSpec,i=e.style,a=e.validateSpec;if(!t.type)return[new F(n,t,`"type" is required`)];let o=ki(t.type),s;switch(o){case`vector`:case`raster`:return s=ji({key:n,value:t,valueSpec:r[`source_${o.replace(`-`,`_`)}`],style:e.style,styleSpec:r,objectElementValidators:Gi,validateSpec:a}),s;case`raster-dem`:return s=function(e){let t=e.sourceName??``,n=e.value,r=e.styleSpec,i=r.source_raster_dem,a=e.style,o=[],s=q(n);if(n===void 0)return o;if(s!==`object`)return o.push(new F(`source_raster_dem`,n,`object expected, ${s} found`)),o;let c=ki(n.encoding)===`custom`,l=[`redFactor`,`greenFactor`,`blueFactor`,`baseShift`],u=e.value.encoding?`"${e.value.encoding}"`:`Default`;for(let s in n)!c&&l.includes(s)?o.push(new F(s,n[s],`In "${t}": "${s}" is only valid when "encoding" is set to "custom". ${u} encoding found`)):i[s]?o=o.concat(e.validateSpec({key:s,value:n[s],valueSpec:i[s],validateSpec:e.validateSpec,style:a,styleSpec:r})):o.push(new F(s,n[s],`unknown property "${s}"`));return o}({sourceName:n,value:t,style:e.style,styleSpec:r,validateSpec:a}),s;case`geojson`:if(s=ji({key:n,value:t,valueSpec:r.source_geojson,style:i,styleSpec:r,validateSpec:a,objectElementValidators:Gi}),t.cluster)for(let e in t.clusterProperties){let[r,i]=t.clusterProperties[e],a=typeof r==`string`?[r,[`accumulated`],[`get`,e]]:r;s.push(...Fi({key:`${n}.${e}.map`,value:i,expressionContext:`cluster-map`})),s.push(...Fi({key:`${n}.${e}.reduce`,value:a,expressionContext:`cluster-reduce`}))}return s;case`video`:return ji({key:n,value:t,valueSpec:r.source_video,style:i,validateSpec:a,styleSpec:r});case`image`:return ji({key:n,value:t,valueSpec:r.source_image,style:i,validateSpec:a,styleSpec:r});case`canvas`:return[new F(n,null,`Please use runtime APIs to add canvas sources, rather than including them in stylesheets.`,`source.canvas`)];default:return Li({key:`${n}.type`,value:t.type,valueSpec:{values:[`vector`,`raster`,`raster-dem`,`geojson`,`video`,`image`]}})}}function qi(e){let t=e.value,n=e.styleSpec,r=n.light,i=e.style,a=[],o=q(t);if(t===void 0)return a;if(o!==`object`)return a=a.concat([new F(`light`,t,`object expected, ${o} found`)]),a;for(let o in t){let s=o.match(/^(.*)-transition$/);a=a.concat(s&&r[s[1]]&&r[s[1]].transition?e.validateSpec({key:o,value:t[o],valueSpec:n.transition,validateSpec:e.validateSpec,style:i,styleSpec:n}):r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],validateSpec:e.validateSpec,style:i,styleSpec:n}):[new F(o,t[o],`unknown property "${o}"`)])}return a}function Ji(e){let t=e.value,n=e.styleSpec,r=n.sky,i=e.style,a=q(t);if(t===void 0)return[];if(a!==`object`)return[new F(`sky`,t,`object expected, ${a} found`)];let o=[];for(let a in t)o=o.concat(r[a]?e.validateSpec({key:a,value:t[a],valueSpec:r[a],style:i,styleSpec:n}):[new F(a,t[a],`unknown property "${a}"`)]);return o}function Yi(e){let t=e.value,n=e.styleSpec,r=n.terrain,i=e.style,a=[],o=q(t);if(t===void 0)return a;if(o!==`object`)return a=a.concat([new F(`terrain`,t,`object expected, ${o} found`)]),a;for(let o in t)a=a.concat(r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],validateSpec:e.validateSpec,style:i,styleSpec:n}):[new F(o,t[o],`unknown property "${o}"`)]);return a}function Xi(e){let t=[],n=e.value,r=e.key;if(Array.isArray(n)){let i=[],a=[];for(let o in n)n[o].id&&i.includes(n[o].id)&&t.push(new F(r,n,`all the sprites' ids must be unique, but ${n[o].id} is duplicated`)),i.push(n[o].id),n[o].url&&a.includes(n[o].url)&&t.push(new F(r,n,`all the sprites' URLs must be unique, but ${n[o].url} is duplicated`)),a.push(n[o].url),t=t.concat(ji({key:`${r}[${o}]`,value:n[o],valueSpec:{id:{type:`string`,required:!0},url:{type:`string`,required:!0}},validateSpec:e.validateSpec}));return t}return Wi({key:r,value:n})}function Zi(e){return!!e&&e.constructor===Object}function Qi(e){return Zi(e.value)?[]:[new F(e.key,e.value,`object expected, ${q(e.value)} found`)]}let $i={"*":()=>[],array:Mi,boolean:function(e){let t=e.value,n=e.key,r=q(t);return r===`boolean`?[]:[new F(n,t,`boolean expected, ${r} found`)]},number:Ni,color:Ii,constants:Oi,enum:Li,filter:Ri,function:Pi,layer:Ui,object:ji,source:Ki,light:qi,sky:Ji,terrain:Yi,projection:function(e){let t=e.value,n=e.styleSpec,r=n.projection,i=e.style,a=q(t);if(t===void 0)return[];if(a!==`object`)return[new F(`projection`,t,`object expected, ${a} found`)];let o=[];for(let a in t)o=o.concat(r[a]?e.validateSpec({key:a,value:t[a],valueSpec:r[a],style:i,styleSpec:n}):[new F(a,t[a],`unknown property "${a}"`)]);return o},projectionDefinition:function(e){let t=e.key,n=e.value;n=n instanceof String?n.valueOf():n;let r=q(n);return r!==`array`||function(e){return Array.isArray(e)&&e.length===3&&typeof e[0]==`string`&&typeof e[1]==`string`&&typeof e[2]==`number`}(n)||function(e){return!![`interpolate`,`step`,`literal`].includes(e[0])}(n)?[`array`,`string`].includes(r)?[]:[new F(t,n,`projection expected, invalid type "${r}" found`)]:[new F(t,n,`projection expected, invalid array ${JSON.stringify(n)} found`)]},string:Wi,formatted:function(e){return Wi(e).length===0?[]:Fi(e)},resolvedImage:function(e){return Wi(e).length===0?[]:Fi(e)},padding:function(e){let t=e.key,n=e.value;if(q(n)===`array`){if(n.length<1||n.length>4)return[new F(t,n,`padding requires 1 to 4 values; ${n.length} values found`)];let r={type:`number`},i=[];for(let a=0;a<n.length;a++)i=i.concat(e.validateSpec({key:`${t}[${a}]`,value:n[a],validateSpec:e.validateSpec,valueSpec:r}));return i}return Ni({key:t,value:n,valueSpec:{}})},numberArray:function(e){let t=e.key,n=e.value;if(q(n)===`array`){let r={type:`number`};if(n.length<1)return[new F(t,n,`array length at least 1 expected, length 0 found`)];let i=[];for(let a=0;a<n.length;a++)i=i.concat(e.validateSpec({key:`${t}[${a}]`,value:n[a],validateSpec:e.validateSpec,valueSpec:r}));return i}return Ni({key:t,value:n,valueSpec:{}})},colorArray:function(e){let t=e.key,n=e.value;if(q(n)===`array`){if(n.length<1)return[new F(t,n,`array length at least 1 expected, length 0 found`)];let e=[];for(let r=0;r<n.length;r++)e=e.concat(Ii({key:`${t}[${r}]`,value:n[r]}));return e}return Ii({key:t,value:n})},variableAnchorOffsetCollection:function(e){let t=e.key,n=e.value,r=q(n),i=e.styleSpec;if(r!==`array`||n.length<1||n.length%2!=0)return[new F(t,n,`variableAnchorOffsetCollection requires a non-empty array of even length`)];let a=[];for(let r=0;r<n.length;r+=2)a=a.concat(Li({key:`${t}[${r}]`,value:n[r],valueSpec:i.layout_symbol[`text-anchor`]})),a=a.concat(Mi({key:`${t}[${r+1}]`,value:n[r+1],valueSpec:{length:2,value:`number`},validateSpec:e.validateSpec,style:e.style,styleSpec:i}));return a},sprite:Xi,state:Qi,fontFaces:function(e){let t=e.key,n=e.value,r=e.validateSpec,i=e.styleSpec,a=e.style;if(!Zi(n))return[new F(t,n,`object expected, ${q(n)} found`)];let o=[];for(let e in n){let s=n[e],c=q(s);if(c===`string`)o.push(...Wi({key:`${t}.${e}`,value:s}));else if(c===`array`){let n={url:{type:`string`,required:!0},"unicode-range":{type:`array`,value:`string`}};for(let[c,l]of s.entries())o.push(...ji({key:`${t}.${e}[${c}]`,value:l,valueSpec:n,styleSpec:i,style:a,validateSpec:r}))}else o.push(new F(`${t}.${e}`,s,`string or array expected, ${c} found`))}return o}};function ea(e){let t=e.value,n=e.valueSpec,r=e.styleSpec;return e.validateSpec=ea,n.expression&&Qr(ki(t))?Pi(e):n.expression&&si(Ai(t))?Fi(e):n.type&&$i[n.type]?$i[n.type](e):ji(Ze({},e,{valueSpec:n.type?r[n.type]:n}))}function ta(e){let t=e.value,n=e.key,r=Wi(e);return r.length||(t.indexOf(`{fontstack}`)===-1&&r.push(new F(n,t,`"glyphs" url must include a "{fontstack}" token`)),t.indexOf(`{range}`)===-1&&r.push(new F(n,t,`"glyphs" url must include a "{range}" token`))),r}function na(e,t=N){let n=[];return n=n.concat(ea({key:``,value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:ea,objectElementValidators:{glyphs:ta,"*":()=>[]}})),e.constants&&(n=n.concat(Oi({key:`constants`,value:e.constants}))),ia(n)}function ra(e){return function(t){return e(Object.assign({},t,{validateSpec:ea}))}}function ia(e){return[].concat(e).sort(((e,t)=>e.line-t.line))}function aa(e){return function(...t){return ia(e.apply(this,t))}}na.source=aa(ra(Ki)),na.sprite=aa(ra(Xi)),na.glyphs=aa(ra(ta)),na.light=aa(ra(qi)),na.sky=aa(ra(Ji)),na.terrain=aa(ra(Yi)),na.state=aa(ra(Qi)),na.layer=aa(ra(Ui)),na.filter=aa(ra(Ri)),na.paintProperty=aa(ra(Vi)),na.layoutProperty=aa(ra(Hi));let oa={type:`enum`,"property-type":`data-constant`,expression:{interpolated:!1,parameters:[`global-state`]},values:{visible:{},none:{}},transition:!1,default:`visible`};class sa{constructor(e,t){this._globalState=t,this.setValue(e)}evaluate(){return this._literalValue??this._compiledValue.evaluate({})}setValue(e){if(e==null||e===`visible`||e===`none`)return this._literalValue=e===`none`?`none`:`visible`,this._compiledValue=void 0,void(this._globalStateRefs=new Set);let t=ci(e,oa,this._globalState);if(t.result===`error`)throw this._literalValue=`visible`,this._compiledValue=void 0,Error(t.value.map((e=>`${e.key}: ${e.message}`)).join(`, `));this._literalValue=void 0,this._compiledValue=t.value,this._globalStateRefs=mi(t.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}let ca=N,la=na,ua=la.light,da=la.sky,fa=la.paintProperty,pa=la.layoutProperty;function ma(e,t){let n=!1;if(t?.length)for(let r of t)e.fire(new ze(Error(r.message))),n=!0;return n}class ha{constructor(e,t,n){let r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let i=new Int32Array(this.arrayBuffer);e=i[0],this.d=(t=i[1])+2*(n=i[2]);for(let e=0;e<this.d*this.d;e++){let t=i[3+e],n=i[3+e+1];r.push(t===n?null:i.subarray(t,n))}let a=i[3+r.length+1];this.keys=i.subarray(i[3+r.length],a),this.bboxes=i.subarray(a),this.insert=this._insertReadonly}else{this.d=t+2*n;for(let e=0;e<this.d*this.d;e++)r.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=n,this.scale=t/e,this.uid=0;let i=n/t*e;this.min=-i,this.max=e+i}insert(e,t,n,r,i){this._forEachCell(t,n,r,i,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(i)}_insertReadonly(){throw Error(`Cannot insert into a GridIndex created from an ArrayBuffer.`)}_insertCell(e,t,n,r,i,a){this.cells[i].push(a)}query(e,t,n,r,i){let a=this.min,o=this.max;if(e<=a&&t<=a&&o<=n&&o<=r&&!i)return[...this.keys];{let a=[];return this._forEachCell(e,t,n,r,this._queryCell,a,{},i),a}}_queryCell(e,t,n,r,i,a,o,s){let c=this.cells[i];if(c!==null){let i=this.keys,l=this.bboxes;for(let u of c)if(o[u]===void 0){let c=4*u;(s?s(l[c+0],l[c+1],l[c+2],l[c+3]):e<=l[c+2]&&t<=l[c+3]&&n>=l[c+0]&&r>=l[c+1])?(o[u]=!0,a.push(i[u])):o[u]=!1}}}_forEachCell(e,t,n,r,i,a,o,s){let c=this._convertToCellCoord(e),l=this._convertToCellCoord(t),u=this._convertToCellCoord(n),d=this._convertToCellCoord(r);for(let f=c;f<=u;f++)for(let c=l;c<=d;c++){let l=this.d*c+f;if((!s||s(this._convertFromCellCoord(f),this._convertFromCellCoord(c),this._convertFromCellCoord(f+1),this._convertFromCellCoord(c+1)))&&i.call(this,e,t,n,r,l,a,o,s))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,t=3+this.cells.length+1+1,n=0;for(let e of this.cells)n+=e.length;let r=new Int32Array(t+n+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let i=t;for(let t=0;t<e.length;t++){let n=e[t];r[3+t]=i,r.set(n,i),i+=n.length}return r[3+e.length]=i,r.set(this.keys,i),i+=this.keys.length,r[3+e.length+1]=i,r.set(this.bboxes,i),i+=this.bboxes.length,r.buffer}static serialize(e,t){let n=e.toArrayBuffer();return t&&t.push(n),{buffer:n}}static deserialize(e){return new ha(e.buffer)}}let ga={};function J(e,t,n={}){if(ga[e])throw Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),ga[e]={klass:t,omit:n.omit||[],shallow:n.shallow||[]}}J(`Object`,Object),J(`Set`,Set),J(`TransferableGridIndex`,ha),J(`Color`,V),J(`Error`,Error),J(`AJAXError`,Me),J(`ResolvedImage`,Yt),J(`StylePropertyFunction`,fi),J(`StyleExpression`,oi,{omit:[`_evaluator`]}),J(`ZoomDependentExpression`,ui),J(`ZoomConstantExpression`,li),J(`CompoundExpression`,Rr,{omit:[`_evaluate`]});for(let e in Lr)Lr[e]._classRegistryKey||J(`Expression_${e}`,Lr[e]);function _a(e){return e&&typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||e.constructor?.name===`ArrayBuffer`)}function va(e){return e.$name||e.constructor._classRegistryKey}function ya(e){return!function(e){if(typeof e!=`object`||!e)return!1;let t=va(e);return t&&t!==`Object`}(e)&&(e==null||typeof e==`boolean`||typeof e==`number`||typeof e==`string`||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||_a(e)||he(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function ba(e,t){if(ya(e))return(_a(e)||he(e))&&t&&t.push(e),ArrayBuffer.isView(e)&&t&&t.push(e.buffer),e instanceof ImageData&&t&&t.push(e.data.buffer),e;if(Array.isArray(e)){let n=[];for(let r of e)n.push(ba(r,t));return n}if(typeof e!=`object`)throw Error(`can't serialize object of type `+typeof e);let n=va(e);if(!n)throw Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!ga[n])throw Error(`${n} is not registered.`);let{klass:r}=ga[n],i=r.serialize?r.serialize(e,t):{};if(r.serialize){if(i===t?.[t.length-1])throw Error(`statically serialized object won't survive transfer of $name property`)}else{for(let r in e){if(!e.hasOwnProperty(r)||ga[n].omit.includes(r))continue;let a=e[r];i[r]=ga[n].shallow.includes(r)?a:ba(a,t)}e instanceof Error&&(i.message=e.message)}if(i.$name)throw Error(`$name property is reserved for worker serialization logic.`);return n!==`Object`&&(i.$name=n),i}function xa(e){if(ya(e))return e;if(Array.isArray(e))return e.map(xa);if(typeof e!=`object`)throw Error(`can't deserialize object of type `+typeof e);let t=va(e)||`Object`;if(!ga[t])throw Error(`can't deserialize unregistered class ${t}`);let{klass:n}=ga[t];if(!n)throw Error(`can't deserialize unregistered class ${t}`);if(n.deserialize)return n.deserialize(e);let r=Object.create(n.prototype);for(let n of Object.keys(e)){if(n===`$name`)continue;let i=e[n];r[n]=ga[t].shallow.includes(n)?i:xa(i)}return r}class Sa{constructor(){this.first=!0}update(e,t){let n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=n,!0))}}function Ca(e){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\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(e))}function wa(e){return/[\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))}function Ta(e){return/\s/u.test(String.fromCodePoint(e))}function Ea(e){for(let t of e)if(wa(t.codePointAt(0)))return!0;return!1}function Da(e){for(let t of e)if(!Aa(t.codePointAt(0)))return!1;return!0}function Oa(e){let t=e.map((e=>{try{return RegExp(`\\p{sc=${e}}`,`u`).source}catch{return null}})).filter((e=>e));return new RegExp(t.join(`|`),`u`)}let ka=Oa([`Arab`,`Dupl`,`Mong`,`Ougr`,`Syrc`]);function Aa(e){return!ka.test(String.fromCodePoint(e))}function ja(e){return!(wa(e)||(t=e,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(t))));var t}let Ma=Oa(`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`.split(`.`));function Na(e){return Ma.test(String.fromCodePoint(e))}function Pa(e,t){return!(!t&&Na(e)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(e)))}function Fa(e){for(let t of e)if(Na(t.codePointAt(0)))return!0;return!1}let Ia=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus=`unavailable`,this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(Ia.isParsed())throw Error(`RTL text plugin already registered.`);this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(e,n){return t(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if(e.pluginStatus!==`loading`)return this.setState(e),e;let t=e.pluginURL,r=new Promise((e=>{this.loadScriptResolve=e}));n(t);let i=new Promise((e=>setTimeout((()=>e()),this.TIMEOUT)));if(yield Promise.race([r,i]),this.isParsed()){let e={pluginStatus:`loaded`,pluginURL:t};return this.setState(e),e}throw this.setState({pluginStatus:`error`,pluginURL:``}),Error(`RTL Text Plugin failed to import scripts from ${t}`)}))}};class Y{constructor(e,t){this.isSupportedScript=La,this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new Sa,this.transition=t.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Sa,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*t}}}function La(e){return function(e,t){for(let n of e)if(!Pa(n.codePointAt(0),t))return!1;return!0}(e,Ia.getRTLTextPluginStatus()===`loaded`)}let Ra=`-transition`;class za{constructor(e,t,n){this.property=e,this.value=t,this.expression=function(e,t,n){if(Qr(e))return new fi(e,t);if(si(e)){let r=di(e,t,n);if(r.result===`error`)throw Error(r.value.map((e=>`${e.key}: ${e.message}`)).join(`, `));return r.value}{let n=e;return t.type===`color`&&typeof e==`string`?n=V.parse(e):t.type!==`padding`||typeof e!=`number`&&!Array.isArray(e)?t.type!==`numberArray`||typeof e!=`number`&&!Array.isArray(e)?t.type!==`colorArray`||typeof e!=`string`&&!Array.isArray(e)?t.type===`variableAnchorOffsetCollection`&&Array.isArray(e)?n=Jt.parse(e):t.type===`projectionDefinition`&&typeof e==`string`&&(n=Xt.parse(e)):n=Gt.parse(e):n=Wt.parse(e):n=Ut.parse(e),{globalStateRefs:new Set,_globalState:null,kind:`constant`,evaluate:()=>n}}}(t===void 0?e.specification.default:t,e.specification,n)}isDataDriven(){return this.expression.kind===`source`||this.expression.kind===`composite`}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,t,n){return this.property.possiblyEvaluate(this,e,t,n)}}class Ba{constructor(e,t){this.property=e,this.value=new za(e,void 0,t)}transitioned(e,t){return new Ha(this.property,this.value,t,oe({},e.transition,this.transition),e.now)}untransitioned(){return new Ha(this.property,this.value,null,{},0)}}class Va{constructor(e,t){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=t}hasProperty(e){return e in this._properties.defaultTransitionablePropertyValues}getValue(e){return M(this._values[e].value.value)}setValue(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new Ba(this._values[e].property,this._globalState)),this._values[e].value=new za(this._values[e].property,t===null?void 0:M(t),this._globalState)}getTransition(e){return M(this._values[e].transition)}setTransition(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new Ba(this._values[e].property,this._globalState)),this._values[e].transition=M(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let n=this.getValue(t);n!==void 0&&(e[t]=n);let r=this.getTransition(t);r!==void 0&&(e[`${t}${Ra}`]=r)}return e}transitioned(e,t){let n=new Ua(this._properties);for(let r of Object.keys(this._values))n._values[r]=this._values[r].transitioned(e,t._values[r]);return n}untransitioned(){let e=new Ua(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class Ha{constructor(e,t,n,r,i){this.property=e,this.value=t,this.begin=i+r.delay||0,this.end=this.begin+r.duration||0,e.specification.transition&&(r.delay||r.duration)&&(this.prior=n)}possiblyEvaluate(e,t,n){let r=e.now||0,i=this.value.possiblyEvaluate(e,t,n),a=this.prior;if(a){if(r>this.end||this.value.isDataDriven())return this.prior=null,i;if(r<this.begin)return a.possiblyEvaluate(e,t,n);{let o=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,n),i,j(o))}}return i}}class Ua{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,n){let r=new Ka(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].possiblyEvaluate(e,t,n);return r}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Wa{constructor(e,t){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=t}hasValue(e){return this._values[e].value!==void 0}hasProperty(e){return e in this._properties.defaultPropertyValues}getValue(e){return M(this._values[e].value)}setValue(e,t){this._values[e]=new za(this._values[e].property,t===null?void 0:M(t),this._globalState)}serialize(){let e={};for(let t of Object.keys(this._values)){let n=this.getValue(t);n!==void 0&&(e[t]=n)}return e}possiblyEvaluate(e,t,n){let r=new Ka(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].possiblyEvaluate(e,t,n);return r}}class Ga{constructor(e,t,n){this.property=e,this.value=t,this.parameters=n}isConstant(){return this.value.kind===`constant`}constantOr(e){return this.value.kind===`constant`?this.value.value:e}evaluate(e,t,n,r){return this.property.evaluate(this.value,this.parameters,e,t,n,r)}}class Ka{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class X{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw Error(`Value should not be data driven`);return e.expression.evaluate(t)}interpolate(e,t,n){let r=Cn[this.specification.type];return r?r(e,t,n):e}}class Z{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,n,r){return new Ga(this,e.expression.kind===`constant`||e.expression.kind===`camera`?{kind:`constant`,value:e.expression.evaluate(t,null,{},n,r)}:e.expression,t)}interpolate(e,t,n){if(e.value.kind!==`constant`||t.value.kind!==`constant`)return e;if(e.value.value===void 0||t.value.value===void 0)return new Ga(this,{kind:`constant`,value:void 0},e.parameters);let r=Cn[this.specification.type];if(r){let i=r(e.value.value,t.value.value,n);return new Ga(this,{kind:`constant`,value:i},e.parameters)}return e}evaluate(e,t,n,r,i,a){return e.kind===`constant`?e.value:e.evaluate(t,n,r,i,a)}}class qa extends Z{possiblyEvaluate(e,t,n,r){if(e.value===void 0)return new Ga(this,{kind:`constant`,value:void 0},t);if(e.expression.kind===`constant`){let i=e.expression.evaluate(t,null,{},n,r),a=e.property.specification.type===`resolvedImage`&&typeof i!=`string`?i.name:i,o=this._calculate(a,a,a,t);return new Ga(this,{kind:`constant`,value:o},t)}if(e.expression.kind===`camera`){let n=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new Ga(this,{kind:`constant`,value:n},t)}return new Ga(this,e.expression,t)}evaluate(e,t,n,r,i,a){if(e.kind===`source`){let o=e.evaluate(t,n,r,i,a);return this._calculate(o,o,o,t)}return e.kind===`composite`?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},n,r),e.evaluate({zoom:Math.floor(t.zoom)},n,r),e.evaluate({zoom:Math.floor(t.zoom)+1},n,r),t):e.value}_calculate(e,t,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class Ja{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,r){if(e.value!==void 0){if(e.expression.kind===`constant`){let i=e.expression.evaluate(t,null,{},n,r);return this._calculate(i,i,i,t)}return this._calculate(e.expression.evaluate(new Y(Math.floor(t.zoom-1),t)),e.expression.evaluate(new Y(Math.floor(t.zoom),t)),e.expression.evaluate(new Y(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class Ya{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,r){return!!e.expression.evaluate(t,null,{},n,r)}interpolate(){return!1}}class Xa{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let n=e[t];n.specification.overridable&&this.overridableProperties.push(t);let r=this.defaultPropertyValues[t]=new za(n,void 0,void 0),i=this.defaultTransitionablePropertyValues[t]=new Ba(n,void 0);this.defaultTransitioningPropertyValues[t]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}}J(`DataDrivenProperty`,Z),J(`DataConstantProperty`,X),J(`CrossFadedDataDrivenProperty`,qa),J(`CrossFadedProperty`,Ja),J(`ColorRampProperty`,Ya);let Za=` is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?`,Qa=` is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?`;class $a extends Be{constructor(e,t,n){if(super(),this.id=e.id,this.type=e.type,this._globalState=n,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=function(e,t){return new sa(e,t)}(this.visibility,n),e.type!==`custom`&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!==`background`&&(this.source=e.source,this.sourceLayer=e[`source-layer`],this.filter=e.filter,this._featureFilter=vi(e.filter,n)),t.layout&&(this._unevaluatedLayout=new Wa(t.layout,n)),t.paint)){this._transitionablePaint=new Va(t.paint,n);for(let t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(let t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ka(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=vi(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){if(e===`visibility`)return this.visibility;if(this._transitionablePaint?.hasProperty(e))throw Error(e+Za);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${e}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;for(let t of this._visibilityExpression.getGlobalStateRefs())e.add(t);if(this._unevaluatedLayout)for(let t in this._unevaluatedLayout._values){let n=this._unevaluatedLayout._values[t];for(let t of n.getGlobalStateRefs())e.add(t)}for(let t of this._featureFilter.getGlobalStateRefs())e.add(t);return e}getPaintAffectingGlobalStateRefs(){let e=new globalThis.Map;if(this._transitionablePaint)for(let t in this._transitionablePaint._values){let n=this._transitionablePaint._values[t].value;for(let r of n.getGlobalStateRefs()){let i=e.get(r)??[];i.push({name:t,value:n.value}),e.set(r,i)}}return e}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,t,n={}){if(e===`visibility`)return this.visibility=t,this._visibilityExpression.setValue(t),void this.recalculateVisibility();this._transitionablePaint?.hasProperty(e)?this.fire(new ze(Error(e+Za))):t!=null&&this._validate(pa,`layers.${this.id}.layout.${e}`,e,t,n)||this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){if(e.endsWith(Ra)){let t=e.slice(0,-11);if(t===`visibility`||this._unevaluatedLayout?.hasProperty(t))throw Error(e+Qa);return this._transitionablePaint.getTransition(t)}if(e===`visibility`||this._unevaluatedLayout?.hasProperty(e))throw Error(e+Qa);return this._transitionablePaint.getValue(e)}setPaintProperty(e,t,n={}){if(e===`visibility`||this._unevaluatedLayout?.hasProperty(e))return this.fire(new ze(Error(e+Qa))),!1;if(t!=null&&this._validate(fa,`layers.${this.id}.paint.${e}`,e,t,n))return!1;if(e.endsWith(Ra))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{let n=this._transitionablePaint._values[e],r=n.property.specification[`property-type`]===`cross-faded-data-driven`,i=n.value.isDataDriven(),a=n.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let o=this._transitionablePaint._values[e].value;return o.isDataDriven()||i||r||this._handleOverridablePaintPropertyUpdate(e,a,o)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,n){return!1}isHidden(e=this.minzoom,t=!1){return!!(this.minzoom&&e<(t?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&e>=this.maxzoom)||this._evaluatedVisibility===`none`}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){let e={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:this._unevaluatedLayout?.serialize(),paint:this._transitionablePaint?.serialize()};return this.visibility&&(e.layout||={},e.layout.visibility=this.visibility),le(e,((e,t)=>!(e===void 0||t===`layout`&&!Object.keys(e).length||t===`paint`&&!Object.keys(e).length)))}_validate(e,t,n,r,i={}){return!1!==i?.validate&&ma(this,e.call(la,{key:t,layerType:this.type,objectKey:n,value:r,styleSpec:N,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let t=this.paint.get(e);if(t instanceof Ga&&Yr(t.property.specification)&&(t.value.kind===`source`||t.value.kind===`composite`)&&t.value.isStateDependent)return!0}return!1}}let eo;var to={get paint(){return eo||=new Xa({"raster-opacity":new X(N.paint_raster[`raster-opacity`]),"raster-hue-rotate":new X(N.paint_raster[`raster-hue-rotate`]),"raster-brightness-min":new X(N.paint_raster[`raster-brightness-min`]),"raster-brightness-max":new X(N.paint_raster[`raster-brightness-max`]),"raster-saturation":new X(N.paint_raster[`raster-saturation`]),"raster-contrast":new X(N.paint_raster[`raster-contrast`]),resampling:new X(N.paint_raster.resampling),"raster-resampling":new X(N.paint_raster[`raster-resampling`]),"raster-fade-duration":new X(N.paint_raster[`raster-fade-duration`])})}};class no extends $a{constructor(e,t){super(e,to,t)}}let ro={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class io{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ao{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw Error(`_refreshViews() must be implemented by each concrete StructArray layout`)}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}}function oo(e,t=1){let n=0,r=0;return{members:e.map((e=>{let i=ro[e.type].BYTES_PER_ELEMENT,a=n=so(n,Math.max(t,i)),o=e.components||1;return r=Math.max(r,i),n+=i*o,{name:e.name,type:e.type,components:o,offset:a}})),size:so(n,Math.max(r,t)),alignment:t}}function so(e,t){return Math.ceil(e/t)*t}class co extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let r=2*e;return this.int16[r+0]=t,this.int16[r+1]=n,e}}co.prototype.bytesPerElement=4,J(`StructArrayLayout2i4`,co);class lo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.int16[i+0]=t,this.int16[i+1]=n,this.int16[i+2]=r,e}}lo.prototype.bytesPerElement=6,J(`StructArrayLayout3i6`,lo);class uo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r)}emplace(e,t,n,r,i){let a=4*e;return this.int16[a+0]=t,this.int16[a+1]=n,this.int16[a+2]=r,this.int16[a+3]=i,e}}uo.prototype.bytesPerElement=8,J(`StructArrayLayout4i8`,uo);class fo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,e}}fo.prototype.bytesPerElement=12,J(`StructArrayLayout2i4i12`,fo);class po extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=4*e,c=8*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.uint8[c+4]=r,this.uint8[c+5]=i,this.uint8[c+6]=a,this.uint8[c+7]=o,e}}po.prototype.bytesPerElement=8,J(`StructArrayLayout2i4ub8`,po);class mo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let r=2*e;return this.float32[r+0]=t,this.float32[r+1]=n,e}}mo.prototype.bytesPerElement=8,J(`StructArrayLayout2f8`,mo);class ho extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c,l){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,n,r,i,a,o,s,c,l)}emplace(e,t,n,r,i,a,o,s,c,l,u){let d=10*e;return this.uint16[d+0]=t,this.uint16[d+1]=n,this.uint16[d+2]=r,this.uint16[d+3]=i,this.uint16[d+4]=a,this.uint16[d+5]=o,this.uint16[d+6]=s,this.uint16[d+7]=c,this.uint16[d+8]=l,this.uint16[d+9]=u,e}}ho.prototype.bytesPerElement=20,J(`StructArrayLayout10ui20`,ho);class go extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s){let c=this.length;return this.resize(c+1),this.emplace(c,e,t,n,r,i,a,o,s)}emplace(e,t,n,r,i,a,o,s,c){let l=8*e;return this.uint16[l+0]=t,this.uint16[l+1]=n,this.uint16[l+2]=r,this.uint16[l+3]=i,this.uint16[l+4]=a,this.uint16[l+5]=o,this.uint16[l+6]=s,this.uint16[l+7]=c,e}}go.prototype.bytesPerElement=16,J(`StructArrayLayout8ui16`,go);class _o extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c,l,u,d){let f=this.length;return this.resize(f+1),this.emplace(f,e,t,n,r,i,a,o,s,c,l,u,d)}emplace(e,t,n,r,i,a,o,s,c,l,u,d,f){let p=12*e;return this.int16[p+0]=t,this.int16[p+1]=n,this.int16[p+2]=r,this.int16[p+3]=i,this.uint16[p+4]=a,this.uint16[p+5]=o,this.uint16[p+6]=s,this.uint16[p+7]=c,this.int16[p+8]=l,this.int16[p+9]=u,this.int16[p+10]=d,this.int16[p+11]=f,e}}_o.prototype.bytesPerElement=24,J(`StructArrayLayout4i4ui4i24`,_o);class vo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.float32[i+0]=t,this.float32[i+1]=n,this.float32[i+2]=r,e}}vo.prototype.bytesPerElement=12,J(`StructArrayLayout3f12`,vo);class yo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}yo.prototype.bytesPerElement=4,J(`StructArrayLayout1ul4`,yo);class bo extends ao{_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(e,t,n,r,i,a,o,s,c){let l=this.length;return this.resize(l+1),this.emplace(l,e,t,n,r,i,a,o,s,c)}emplace(e,t,n,r,i,a,o,s,c,l){let u=10*e,d=5*e;return this.int16[u+0]=t,this.int16[u+1]=n,this.int16[u+2]=r,this.int16[u+3]=i,this.int16[u+4]=a,this.int16[u+5]=o,this.uint32[d+3]=s,this.uint16[u+8]=c,this.uint16[u+9]=l,e}}bo.prototype.bytesPerElement=20,J(`StructArrayLayout6i1ul2ui20`,bo);class xo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,e}}xo.prototype.bytesPerElement=12,J(`StructArrayLayout2i2i2i12`,xo);class So extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,r,i)}emplace(e,t,n,r,i,a){let o=4*e,s=8*e;return this.float32[o+0]=t,this.float32[o+1]=n,this.float32[o+2]=r,this.int16[s+6]=i,this.int16[s+7]=a,e}}So.prototype.bytesPerElement=16,J(`StructArrayLayout2f1f2i16`,So);class Co extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=16*e,c=4*e,l=8*e;return this.uint8[s+0]=t,this.uint8[s+1]=n,this.float32[c+1]=r,this.float32[c+2]=i,this.int16[l+6]=a,this.int16[l+7]=o,e}}Co.prototype.bytesPerElement=16,J(`StructArrayLayout2ub2f2i16`,Co);class wo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.uint16[i+0]=t,this.uint16[i+1]=n,this.uint16[i+2]=r,e}}wo.prototype.bytesPerElement=6,J(`StructArrayLayout3ui6`,wo);class To extends ao{_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(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){let _=this.length;return this.resize(_+1),this.emplace(_,e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}emplace(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){let v=24*e,y=12*e,b=48*e;return this.int16[v+0]=t,this.int16[v+1]=n,this.uint16[v+2]=r,this.uint16[v+3]=i,this.uint32[y+2]=a,this.uint32[y+3]=o,this.uint32[y+4]=s,this.uint16[v+10]=c,this.uint16[v+11]=l,this.uint16[v+12]=u,this.float32[y+7]=d,this.float32[y+8]=f,this.uint8[b+36]=p,this.uint8[b+37]=m,this.uint8[b+38]=h,this.uint32[y+10]=g,this.int16[v+22]=_,e}}To.prototype.bytesPerElement=48,J(`StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48`,To);class Eo extends ao{_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(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D){let O=this.length;return this.resize(O+1),this.emplace(O,e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D)}emplace(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O){let k=32*e,A=16*e;return this.int16[k+0]=t,this.int16[k+1]=n,this.int16[k+2]=r,this.int16[k+3]=i,this.int16[k+4]=a,this.int16[k+5]=o,this.int16[k+6]=s,this.int16[k+7]=c,this.uint16[k+8]=l,this.uint16[k+9]=u,this.uint16[k+10]=d,this.uint16[k+11]=f,this.uint16[k+12]=p,this.uint16[k+13]=m,this.uint16[k+14]=h,this.uint16[k+15]=g,this.uint16[k+16]=_,this.uint16[k+17]=v,this.uint16[k+18]=y,this.uint16[k+19]=b,this.uint16[k+20]=x,this.uint16[k+21]=S,this.uint16[k+22]=C,this.uint32[A+12]=w,this.float32[A+13]=T,this.float32[A+14]=E,this.uint16[k+30]=D,this.uint16[k+31]=O,e}}Eo.prototype.bytesPerElement=64,J(`StructArrayLayout8i15ui1ul2f2ui64`,Eo);class Do extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}Do.prototype.bytesPerElement=4,J(`StructArrayLayout1f4`,Do);class Oo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.uint16[6*e+0]=t,this.float32[i+1]=n,this.float32[i+2]=r,e}}Oo.prototype.bytesPerElement=12,J(`StructArrayLayout1ui2f12`,Oo);class ko extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=4*e;return this.uint32[2*e+0]=t,this.uint16[i+2]=n,this.uint16[i+3]=r,e}}ko.prototype.bytesPerElement=8,J(`StructArrayLayout1ul2ui8`,ko);class Ao extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=n,e}}Ao.prototype.bytesPerElement=4,J(`StructArrayLayout2ui4`,Ao);class jo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}jo.prototype.bytesPerElement=2,J(`StructArrayLayout1ui2`,jo);class Mo extends ao{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r)}emplace(e,t,n,r,i){let a=4*e;return this.float32[a+0]=t,this.float32[a+1]=n,this.float32[a+2]=r,this.float32[a+3]=i,e}}Mo.prototype.bytesPerElement=16,J(`StructArrayLayout4f16`,Mo);class No extends io{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 n(this.anchorPointX,this.anchorPointY)}}No.prototype.size=20;class Po extends bo{get(e){return new No(this,e)}}J(`CollisionBoxArray`,Po);class Fo extends io{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Fo.prototype.size=48;class Io extends To{get(e){return new Fo(this,e)}}J(`PlacedSymbolArray`,Io);class Lo extends io{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(e){this._structArray.uint32[this._pos4+12]=e}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]}}Lo.prototype.size=64;class Ro extends Eo{get(e){return new Lo(this,e)}}J(`SymbolInstanceArray`,Ro);class zo extends Do{getoffsetX(e){return this.float32[1*e+0]}}J(`GlyphOffsetArray`,zo);class Bo extends lo{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}J(`SymbolLineVertexArray`,Bo);class Vo extends io{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]}}Vo.prototype.size=12;class Ho extends Oo{get(e){return new Vo(this,e)}}J(`TextAnchorOffsetArray`,Ho);class Uo extends io{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]}}Uo.prototype.size=8;class Wo extends ko{get(e){return new Uo(this,e)}}J(`FeatureIndexArray`,Wo);class Go extends co{}class Ko extends co{}class qo extends co{}class Jo extends fo{}class Yo extends po{}class Xo extends mo{}class Zo extends ho{}class Qo extends go{}class $o extends _o{}class es extends vo{}class ts extends yo{}class ns extends xo{}class rs extends Co{}class is extends wo{}class as extends Ao{}let{members:os}=oo([{name:`a_pos`,components:2,type:`Int16`}],4);class ss{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,t,n,r){let i=this.segments[this.segments.length-1];return e>ss.MAX_VERTEX_ARRAY_LENGTH&&de(`Max vertices per segment is ${ss.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${ss.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!i||i.vertexLength+e>ss.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==r?this.createNewSegment(t,n,r):i}createNewSegment(e,t,n){let r={vertexOffset:e.length,primitiveOffset:t.length,vertexLength:0,primitiveLength:0,vaos:{}};return n!==void 0&&(r.sortKey=n),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(r),r}getOrCreateLatestSegment(e,t,n){return this.prepareSegment(0,e,t,n)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,n,r){return new ss([{vertexOffset:e,primitiveOffset:t,vertexLength:n,primitiveLength:r,vaos:{},sortKey:0}])}}function cs(e,t){return 256*(e=ie(Math.floor(e),0,255))+ie(Math.floor(t),0,255)}ss.MAX_VERTEX_ARRAY_LENGTH=2**16-1,J(`SegmentVector`,ss);let ls=oo([{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`}]),us=oo([{name:`a_dasharray_from`,components:4,type:`Uint16`},{name:`a_dasharray_to`,components:4,type:`Uint16`}]);var ds,fs,ps,ms={exports:{}},hs={exports:{}},gs={exports:{}},_s=r(function(){if(ps)return ms.exports;ps=1;var e=(ds||(ds=1,hs.exports=function(e,t){var n,r,i,a,o,s,c,l;for(r=e.length-(n=3&e.length),i=t,o=3432918353,s=461845907,l=0;l<r;)c=255&e.charCodeAt(l)|(255&e.charCodeAt(++l))<<8|(255&e.charCodeAt(++l))<<16|(255&e.charCodeAt(++l))<<24,++l,i=27492+(65535&(a=5*(65535&(i=(i^=c=(65535&(c=(c=(65535&c)*o+(((c>>>16)*o&65535)<<16)&4294967295)<<15|c>>>17))*s+(((c>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(c=0,n){case 3:c^=(255&e.charCodeAt(l+2))<<16;case 2:c^=(255&e.charCodeAt(l+1))<<8;case 1:i^=c=(65535&(c=(c=(65535&(c^=255&e.charCodeAt(l)))*o+(((c>>>16)*o&65535)<<16)&4294967295)<<15|c>>>17))*s+(((c>>>16)*s&65535)<<16)&4294967295}return i^=e.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}),hs.exports),t=(fs||(fs=1,gs.exports=function(e,t){for(var n,r=e.length,i=t^r,a=0;r>=4;)n=1540483477*(65535&(n=255&e.charCodeAt(a)|(255&e.charCodeAt(++a))<<8|(255&e.charCodeAt(++a))<<16|(255&e.charCodeAt(++a))<<24))+((1540483477*(n>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),r-=4,++a;switch(r){case 3:i^=(255&e.charCodeAt(a+2))<<16;case 2:i^=(255&e.charCodeAt(a+1))<<8;case 1:i=1540483477*(65535&(i^=255&e.charCodeAt(a)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}),gs.exports);return ms.exports=e,ms.exports.murmur3=e,ms.exports.murmur2=t,ms.exports}());class vs{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,n,r){this.ids.push(ys(e)),this.positions.push(t,n,r)}getPositions(e){if(!this.indexed)throw Error(`Trying to get index, but feature positions are not indexed`);let t=ys(e),n=0,r=this.ids.length-1;for(;n<r;){let e=n+r>>1;this.ids[e]>=t?r=e:n=e+1}let i=[];for(;this.ids[n]===t;)i.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return i}static serialize(e,t){let n=new Float64Array(e.ids),r=new Uint32Array(e.positions);return bs(n,r,0,n.length-1),t&&t.push(n.buffer,r.buffer),{ids:n,positions:r}}static deserialize(e){let t=new vs;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function ys(e){let t=+e;return!isNaN(t)&&t<=2**53-1?t:_s(String(e))}function bs(e,t,n,r){for(;n<r;){let i=e[n+r>>1],a=n-1,o=r+1;for(;;){do a++;while(e[a]<i);do o--;while(e[o]>i);if(a>=o)break;xs(e,a,o),xs(t,3*a,3*o),xs(t,3*a+1,3*o+1),xs(t,3*a+2,3*o+2)}o-n<r-o?(bs(e,t,n,o),n=o+1):(bs(e,t,o+1,r),r=o)}}function xs(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}J(`FeaturePositionMap`,vs);class Ss{constructor(e,t){this.gl=e.gl,this.location=t}}class Cs extends Ss{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class ws extends Ss{constructor(e,t){super(e,t),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class Ts extends Ss{constructor(e,t){super(e,t),this.current=V.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}let Es=new Float32Array(16);function Ds(e){return[cs(255*e.r,255*e.g),cs(255*e.b,255*e.a)]}class Os{constructor(e,t,n){this.value=e,this.uniformNames=t.map((e=>`u_${e}`)),this.type=n}setUniform(e,t,n){e.set(n.constantOr(this.value))}getBinding(e,t,n){return this.type===`color`?new Ts(e,t):new Cs(e,t)}}class ks{constructor(e,t){this.uniformNames=t.map((e=>`u_${e}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,t){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,t.y,t.height,t.width]}setUniform(e,t,n,r){let i=null;r===`u_pattern_to`?i=this.patternTo:r===`u_pattern_from`?i=this.patternFrom:r===`u_dasharray_to`?i=this.dashTo:r===`u_dasharray_from`?i=this.dashFrom:r===`u_pixel_ratio_to`?i=this.pixelRatioTo:r===`u_pixel_ratio_from`&&(i=this.pixelRatioFrom),i!==null&&e.set(i)}getBinding(e,t,n){return n.startsWith(`u_pattern`)||n.startsWith(`u_dasharray_`)?new ws(e,t):new Cs(e,t)}}class As{constructor(e,t,n,r){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:`Float32`,components:n===`color`?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(e,t,n){let r=this.paintVertexArray.length,i=this.expression.evaluate(new Y(0,n),t,{},n.canonical,[],n.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(r,e,i)}updatePaintArray(e,t,n,r,i){let a=this.expression.evaluate(new Y(0,i),n,r);this._setPaintValue(e,t,a)}_setPaintValue(e,t,n){if(this.type===`color`){let r=Ds(n);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r[0],r[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){var t;(t=this.paintVertexArray)!=null&&t.arrayBuffer.byteLength&&(this.paintVertexBuffer?.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class js{constructor(e,t,n,r,i,a){this.expression=e,this.uniformNames=t.map((e=>`u_${e}_t`)),this.type=n,this.useIntegerZoom=r,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:`Float32`,components:n===`color`?4:2,offset:0}))),this.paintVertexArray=new a}populatePaintArray(e,t,n){let r=this.expression.evaluate(new Y(this.zoom,n),t,{},n.canonical,[],n.formattedSection),i=this.expression.evaluate(new Y(this.zoom+1,n),t,{},n.canonical,[],n.formattedSection),a=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(a,e,r,i)}updatePaintArray(e,t,n,r,i){let a=this.expression.evaluate(new Y(this.zoom,i),n,r),o=this.expression.evaluate(new Y(this.zoom+1,i),n,r);this._setPaintValue(e,t,a,o)}_setPaintValue(e,t,n,r){if(this.type===`color`){let i=Ds(n),a=Ds(r);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i[0],i[1],a[0],a[1])}else{for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,n,r);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(r))}}upload(e){var t;(t=this.paintVertexArray)!=null&&t.arrayBuffer.byteLength&&(this.paintVertexBuffer?.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){let n=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,r=ie(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(r)}getBinding(e,t,n){return new Cs(e,t)}}class Ms{constructor(e,t,n,r,i,a){this.expression=e,this.type=t,this.useIntegerZoom=n,this.zoom=r,this.layerId=a,this.zoomInPaintVertexArray=new i,this.zoomOutPaintVertexArray=new i}populatePaintArray(e,t,n){let r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(r,e,this.getPositionIds(t),n)}updatePaintArray(e,t,n,r,i){this._setPaintValues(e,t,this.getPositionIds(n),i)}_setPaintValues(e,t,n,r){let i=this.getPositions(r);if(!i||!n)return;let a=i[n.min],o=i[n.mid],s=i[n.max];if(a&&o&&s)for(let n=e;n<t;n++)this.emplace(this.zoomInPaintVertexArray,n,o,a),this.emplace(this.zoomOutPaintVertexArray,n,o,s)}upload(e){if(this.zoomInPaintVertexArray?.arrayBuffer.byteLength&&this.zoomOutPaintVertexArray?.arrayBuffer.byteLength){let t=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,t,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,t,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Ns extends Ms{getPositions(e){return e.imagePositions}getPositionIds(e){return e.patterns?.[this.layerId]}getVertexAttributes(){return ls.members}emplace(e,t,n,r){e.emplace(t,n.tlbr[0],n.tlbr[1],n.tlbr[2],n.tlbr[3],r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],n.pixelRatio,r.pixelRatio)}}class Ps extends Ms{getPositions(e){return e.dashPositions}getPositionIds(e){return e.dashes?.[this.layerId]}getVertexAttributes(){return us.members}emplace(e,t,n,r){e.emplace(t,0,n.y,n.height,n.width,0,r.y,r.height,r.width)}}class Fs{constructor(e,t,n){this.binders={},this._buffers=[];let r=[];for(let i in e.paint._values){if(!n(i))continue;let a=e.paint.get(i);if(!(a instanceof Ga&&Yr(a.property.specification)))continue;let o=Ls(i,e.type),s=a.value,c=a.property.specification.type,l=a.property.useIntegerZoom,u=a.property.specification[`property-type`],d=u===`cross-faded`||u===`cross-faded-data-driven`;if(s.kind===`constant`)this.binders[i]=d?new ks(s.value,o):new Os(s.value,o,c),r.push(`/u_${i}`);else if(s.kind===`source`||d){let n=Rs(i,c,`source`);this.binders[i]=d?i===`line-dasharray`?new Ps(s,c,l,t,n,e.id):new Ns(s,c,l,t,n,e.id):new As(s,o,c,n),r.push(`/a_${i}`)}else{let e=Rs(i,c,`composite`);this.binders[i]=new js(s,o,c,l,t,e),r.push(`/z_${i}`)}}this.cacheKey=r.sort().join(``)}getMaxValue(e){let t=this.binders[e];return t instanceof As||t instanceof js?t.maxValue:0}populatePaintArrays(e,t,n){for(let r in this.binders){let i=this.binders[r];(i instanceof As||i instanceof js||i instanceof Ms)&&i.populatePaintArray(e,t,n)}}setConstantPatternPositions(e,t){for(let n in this.binders){let r=this.binders[n];r instanceof ks&&r.setConstantPatternPositions(e,t)}}setConstantDashPositions(e,t){for(let n in this.binders){let r=this.binders[n];r instanceof ks&&r.setConstantDashPositions(e,t)}}updatePaintArrays(e,t,n,r,i){let a=!1;for(let o in e){let s=t.getPositions(o);for(let t of s){let s=n.feature(t.index);for(let n in this.binders){let c=this.binders[n];(c instanceof As||c instanceof js||c instanceof Ms)&&!0===c.expression.isStateDependent&&(c.expression=r.paint.get(n).value,c.updatePaintArray(t.start,t.end,s,e[o],i),a=!0)}}}return a}defines(){let e=[];for(let t in this.binders){let n=this.binders[t];(n instanceof Os||n instanceof ks)&&e.push(...n.uniformNames.map((e=>`#define HAS_UNIFORM_${e}`)))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let n=this.binders[t];if(n instanceof As||n instanceof js)for(let t of n.paintVertexAttributes)e.push(t.name);else if(n instanceof Ms){let t=n.getVertexAttributes();for(let n of t)e.push(n.name)}}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let n=this.binders[t];if(n instanceof Os||n instanceof ks||n instanceof js)for(let t of n.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let n=[];for(let r in this.binders){let i=this.binders[r];if(i instanceof Os||i instanceof ks||i instanceof js){for(let a of i.uniformNames)if(t[a]){let o=i.getBinding(e,t[a],a);n.push({name:a,property:r,binding:o})}}}return n}setUniforms(e,t,n,r){for(let{name:e,property:i,binding:a}of t)this.binders[i].setUniform(a,r,n.get(i),e)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let n=this.binders[t];if(e&&n instanceof Ms){let t=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else (n instanceof As||n instanceof js)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(let t in this.binders){let n=this.binders[t];(n instanceof As||n instanceof js||n instanceof Ms)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof As||t instanceof js||t instanceof Ms)&&t.destroy()}}}class Is{constructor(e,t,n=()=>!0){this.programConfigurations={};for(let r of e)this.programConfigurations[r.id]=new Fs(r,t,n);this.needsUpload=!1,this._featureMap=new vs,this._bufferOffset=0}populatePaintArrays(e,t,n,r){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(e,t,r);t.id!==void 0&&this._featureMap.add(t.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,n,r){for(let i of n)this.needsUpload=this.programConfigurations[i.id].updatePaintArrays(e,this._featureMap,t,i,r)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Ls(e,t){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`]}[e]||[e.replace(`${t}-`,``).replace(/-/g,`_`)]}function Rs(e,t,n){let r={color:{source:mo,composite:Mo},number:{source:Do,composite:mo}};return function(e){return{"line-pattern":{source:Zo,composite:Zo},"fill-pattern":{source:Zo,composite:Zo},"fill-extrusion-pattern":{source:Zo,composite:Zo},"line-dasharray":{source:Qo,composite:Qo}}[e]}(e)?.[n]||r[t][n]}J(`ConstantBinder`,Os),J(`CrossFadedConstantBinder`,ks),J(`SourceExpressionBinder`,As),J(`CrossFadedPatternBinder`,Ns),J(`CrossFadedDasharrayBinder`,Ps),J(`CompositeExpressionBinder`,js),J(`ProgramConfiguration`,Fs,{omit:[`_buffers`]}),J(`ProgramConfigurationSet`,Is);let zs=2**14-1,Bs=-zs-1;function Vs(e){let t=O/e.extent,n=e.loadGeometry();for(let e of n)for(let n of e){let e=Math.round(n.x*t),r=Math.round(n.y*t);n.x=ie(e,Bs,zs),n.y=ie(r,Bs,zs),(e<n.x||e>n.x+1||r<n.y||r>n.y+1)&&de(`Geometry exceeds allowed extent, reduce your vector tile buffer size`)}return n}function Hs(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Vs(e):[]}}let Us=-32768;function Ws(e,t,n,r,i){e.emplaceBack(Us+8*t+r,Us+8*n+i)}class Gs{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Ko,this.indexArray=new is,this.segments=new ss,this.programConfigurations=new Is(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){let r=this.layers[0],i=[],a=null,o=!1,s=r.type===`heatmap`;if(r.type===`circle`){let e=r;a=e.layout.get(`circle-sort-key`),o=!a.isConstant(),s||=e.paint.get(`circle-pitch-alignment`)===`map`}let c=s?t.subdivisionGranularity.circle:1;for(let{feature:t,id:r,index:s,sourceLayerIndex:c}of e){let e=this.layers[0]._featureFilter.needGeometry,l=Hs(t,e);if(!this.layers[0]._featureFilter.filter(new Y(this.zoom),l,n))continue;let u=o?a.evaluate(l,{},n):void 0,d={id:r,properties:t.properties,type:t.type,sourceLayerIndex:c,index:s,geometry:e?l.geometry:Vs(t),patterns:{},sortKey:u};i.push(d)}o&&i.sort(((e,t)=>e.sortKey-t.sortKey));for(let r of i){let{geometry:i,index:a,sourceLayerIndex:o}=r,s=e[a].feature;this.addFeature(r,i,a,n,c),t.featureIndex.insert(s,i,a,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:n})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,os),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,n,r,i=1){let a;switch(i){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${i}; valid values are 1, 3, 5, 7.`)}let o=a.length;for(let n of t)for(let t of n){let n=t.x,r=t.y;if(n<0||n>=O||r<0||r>=O)continue;let i=this.segments.prepareSegment(o*o,this.layoutVertexArray,this.indexArray,e.sortKey),s=i.vertexLength;for(let e=0;e<o;e++)for(let t=0;t<o;t++)Ws(this.layoutVertexArray,n,r,a[t],a[e]);for(let e=0;e<o-1;e++)for(let t=0;t<o-1;t++){let n=s+e*o+t,r=s+(e+1)*o+t;this.indexArray.emplaceBack(n,r+1,n+1),this.indexArray.emplaceBack(n,r,r+1)}i.vertexLength+=o*o,i.primitiveLength+=(o-1)*(o-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{imagePositions:{},canonical:r})}}function Ks(e,t){for(let n of e)if(tc(t,n))return!0;for(let n of t)if(tc(e,n))return!0;return Xs(e,t)}function qs(e,t,n){return!!tc(e,t)||Qs(t,e,n)}function Js(e,t){if(e.length===1)return ec(t,e[0]);for(let n of t)for(let t of n)if(tc(e,t))return!0;for(let n of e)if(ec(t,n))return!0;for(let n of t)if(Xs(e,n))return!0;return!1}function Ys(e,t,n){if(e.length>1){if(Xs(e,t))return!0;for(let r of t)if(Qs(r,e,n))return!0}for(let r of e)if(Qs(r,t,n))return!0;return!1}function Xs(e,t){if(e.length===0||t.length===0)return!1;for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1];for(let e=0;e<t.length-1;e++)if(Zs(r,i,t[e],t[e+1]))return!0}return!1}function Zs(e,t,n,r){return fe(e,n,r)!==fe(t,n,r)&&fe(e,t,n)!==fe(e,t,r)}function Qs(e,t,n){let r=n*n;if(t.length===1)return e.distSqr(t[0])<r;for(let n=1;n<t.length;n++)if($s(e,t[n-1],t[n])<r)return!0;return!1}function $s(e,t,n){let r=t.distSqr(n);if(r===0)return e.distSqr(t);let i=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/r;return e.distSqr(i<0?t:i>1?n:n.sub(t)._mult(i)._add(t))}function ec(e,t){let n,r,i,a=!1;for(let o of e){n=o;for(let e=0,o=n.length-1;e<n.length;o=e++)r=n[e],i=n[o],r.y>t.y!=i.y>t.y&&t.x<(i.x-r.x)*(t.y-r.y)/(i.y-r.y)+r.x&&(a=!a)}return a}function tc(e,t){let n=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let a=e[r],o=e[i];a.y>t.y!=o.y>t.y&&t.x<(o.x-a.x)*(t.y-a.y)/(o.y-a.y)+a.x&&(n=!n)}return n}function nc(e,t,n){let r=n[0],i=n[2];if(e.x<r.x&&t.x<r.x||e.x>i.x&&t.x>i.x||e.y<r.y&&t.y<r.y||e.y>i.y&&t.y>i.y)return!1;let a=fe(e,t,n[0]);return a!==fe(e,t,n[1])||a!==fe(e,t,n[2])||a!==fe(e,t,n[3])}function rc(e,t,n){let r=t.paint.get(e).value;return r.kind===`constant`?r.value:n.programConfigurations.get(t.id).getMaxValue(e)}function ic(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function ac(e,t,r,i,a){if(!t[0]&&!t[1])return e;let o=n.convert(t)._mult(a);r===`viewport`&&o._rotate(-i);let s=[];for(let t of e)s.push(t.sub(o));return s}function oc(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],i=t.at(-1);(n===0||i&&!r.equals(i))&&t.push(r)}return t}function sc({queryGeometry:e,size:t},n){return qs(e,n,t)}function cc({queryGeometry:e,size:t,transform:n,unwrappedTileID:r,getElevation:i},a){return qs(e,a,t*(n.projectTileCoordinates(a.x,a.y,r,i).signedDistanceFromCamera/n.cameraToCenterDistance))}function lc({queryGeometry:e,size:t,transform:n,unwrappedTileID:r,getElevation:i},a){let o=n.projectTileCoordinates(a.x,a.y,r,i).signedDistanceFromCamera,s=t*(n.cameraToCenterDistance/o);return qs(e,fc(a,n,r,i),s)}function uc({queryGeometry:e,size:t,transform:n,unwrappedTileID:r,getElevation:i},a){return qs(e,fc(a,n,r,i),t)}function dc({queryGeometry:e,size:t,transform:n,unwrappedTileID:r,getElevation:i,pitchAlignment:a=`map`,pitchScale:o=`map`},s){let c=a===`map`?o===`map`?sc:cc:o===`map`?lc:uc,l={queryGeometry:e,size:t,transform:n,unwrappedTileID:r,getElevation:i};for(let e of s)for(let t of e)if(c(l,t))return!0;return!1}function fc(e,t,r,i){let a=t.projectTileCoordinates(e.x,e.y,r,i).point;return new n((.5*a.x+.5)*t.width,(.5*-a.y+.5)*t.height)}let pc,mc;J(`CircleBucket`,Gs,{omit:[`layers`]});var hc={get paint(){return mc||=new Xa({"circle-radius":new Z(N.paint_circle[`circle-radius`]),"circle-color":new Z(N.paint_circle[`circle-color`]),"circle-blur":new Z(N.paint_circle[`circle-blur`]),"circle-opacity":new Z(N.paint_circle[`circle-opacity`]),"circle-translate":new X(N.paint_circle[`circle-translate`]),"circle-translate-anchor":new X(N.paint_circle[`circle-translate-anchor`]),"circle-pitch-scale":new X(N.paint_circle[`circle-pitch-scale`]),"circle-pitch-alignment":new X(N.paint_circle[`circle-pitch-alignment`]),"circle-stroke-width":new Z(N.paint_circle[`circle-stroke-width`]),"circle-stroke-color":new Z(N.paint_circle[`circle-stroke-color`]),"circle-stroke-opacity":new Z(N.paint_circle[`circle-stroke-opacity`])})},get layout(){return pc||=new Xa({"circle-sort-key":new Z(N.layout_circle[`circle-sort-key`])})}};class gc extends $a{constructor(e,t){super(e,hc,t)}createBucket(e){return new Gs(e)}queryRadius(e){let t=e;return rc(`circle-radius`,this,t)+rc(`circle-stroke-width`,this,t)+ic(this.paint.get(`circle-translate`))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:n,geometry:r,transform:i,pixelsToTileUnits:a,unwrappedTileID:o,getElevation:s}){let c=ac(e,this.paint.get(`circle-translate`),this.paint.get(`circle-translate-anchor`),-i.bearingInRadians,a),l=this.paint.get(`circle-radius`).evaluate(t,n)+this.paint.get(`circle-stroke-width`).evaluate(t,n),u=this.paint.get(`circle-pitch-scale`),d=this.paint.get(`circle-pitch-alignment`),f,p;return d===`map`?(f=c,p=l*a):(f=function(e,t,n,r){return e.map((e=>fc(e,t,n,r)))}(c,i,o,s),p=l),dc({queryGeometry:f,size:p,transform:i,unwrappedTileID:o,getElevation:s,pitchAlignment:d,pitchScale:u},r)}}class _c extends Gs{}let vc;J(`HeatmapBucket`,_c,{omit:[`layers`]});var yc={get paint(){return vc||=new Xa({"heatmap-radius":new Z(N.paint_heatmap[`heatmap-radius`]),"heatmap-weight":new Z(N.paint_heatmap[`heatmap-weight`]),"heatmap-intensity":new X(N.paint_heatmap[`heatmap-intensity`]),"heatmap-color":new Ya(N.paint_heatmap[`heatmap-color`]),"heatmap-opacity":new X(N.paint_heatmap[`heatmap-opacity`])})}};function bc(e,{width:t,height:n},r,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==t*n*r)throw RangeError(`mismatched image size. expected: ${i.length} but got: ${t*n*r}`)}else i=new Uint8Array(t*n*r);return e.width=t,e.height=n,e.data=i,e}function xc(e,{width:t,height:n},r){if(t===e.width&&n===e.height)return;let i=bc({},{width:t,height:n},r);Sc(e,i,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,n)},r),e.width=t,e.height=n,e.data=i.data}function Sc(e,t,n,r,i,a){if(i.width===0||i.height===0)return t;if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw RangeError(`out of range source coordinates for image copy`);if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw RangeError(`out of range destination coordinates for image copy`);let o=e.data,s=t.data;if(o===s)throw Error(`srcData equals dstData, so image is already copied`);for(let c=0;c<i.height;c++){let l=((n.y+c)*e.width+n.x)*a,u=((r.y+c)*t.width+r.x)*a;for(let e=0;e<i.width*a;e++)s[u+e]=o[l+e]}return t}class Cc{constructor(e,t){bc(this,e,1,t)}resize(e){xc(this,e,1)}clone(){return new Cc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,r,i){Sc(e,t,n,r,i,1)}}class wc{constructor(e,t){bc(this,e,4,t)}resize(e){xc(this,e,4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new wc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,r,i){Sc(e,t,n,r,i,4)}setPixel(e,t,n){let r=4*(e*this.width+t);this.data[r+0]=Math.round(255*n.r/n.a),this.data[r+1]=Math.round(255*n.g/n.a),this.data[r+2]=Math.round(255*n.b/n.a),this.data[r+3]=Math.round(255*n.a)}}function Tc(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n+=4){let r=e[n+3];t[n+0]=Math.round(e[n+0]*r/255),t[n+1]=Math.round(e[n+1]*r/255),t[n+2]=Math.round(e[n+2]*r/255),t[n+3]=r}return t}function Ec(e){let t={},n=e.resolution||256,r=e.clips?e.clips.length:1,i=e.image||new wc({width:n,height:r});if(Math.log(n)/Math.LN2%1!=0)throw Error(`width is not a power of 2 - ${n}`);let a=(r,a,o)=>{t[e.evaluationKey]=o;let s=e.expression.evaluate(t);i.setPixel(r/4/n,a/4,s)};if(e.clips)for(let t=0,i=0;t<r;++t,i+=4*n)for(let r=0,o=0;r<n;r++,o+=4){let s=r/(n-1),{start:c,end:l}=e.clips[t];a(i,o,c*(1-s)+l*s)}else for(let e=0,t=0;e<n;e++,t+=4)a(0,t,e/(n-1));return i}J(`AlphaImage`,Cc),J(`RGBAImage`,wc);let Dc=`big-fb`;class Oc extends $a{createBucket(e){return new _c(e)}constructor(e,t){super(e,yc,t),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e===`heatmap-color`&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Ec({expression:this._transitionablePaint._values[`heatmap-color`].value.expression,evaluationKey:`heatmapDensity`,image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Dc)&&this.heatmapFbos.delete(Dc)}queryRadius(e){return rc(`heatmap-radius`,this,e)}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:n,geometry:r,transform:i,pixelsToTileUnits:a,unwrappedTileID:o,getElevation:s}){return dc({queryGeometry:e,size:this.paint.get(`heatmap-radius`).evaluate(t,n)*a,transform:i,unwrappedTileID:o,getElevation:s},r)}hasOffscreenPass(){return this.paint.get(`heatmap-opacity`)!==0&&!this.isHidden()}}let kc;var Ac={get paint(){return kc||=new Xa({"hillshade-illumination-direction":new X(N.paint_hillshade[`hillshade-illumination-direction`]),"hillshade-illumination-altitude":new X(N.paint_hillshade[`hillshade-illumination-altitude`]),"hillshade-illumination-anchor":new X(N.paint_hillshade[`hillshade-illumination-anchor`]),"hillshade-exaggeration":new X(N.paint_hillshade[`hillshade-exaggeration`]),"hillshade-shadow-color":new X(N.paint_hillshade[`hillshade-shadow-color`]),"hillshade-highlight-color":new X(N.paint_hillshade[`hillshade-highlight-color`]),"hillshade-accent-color":new X(N.paint_hillshade[`hillshade-accent-color`]),"hillshade-method":new X(N.paint_hillshade[`hillshade-method`]),resampling:new X(N.paint_hillshade.resampling)})}};class jc extends $a{constructor(e,t){super(e,Ac,t),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get(`hillshade-illumination-direction`).values,t=this.paint.get(`hillshade-illumination-altitude`).values,n=this.paint.get(`hillshade-highlight-color`).values,r=this.paint.get(`hillshade-shadow-color`).values,i=Math.max(e.length,t.length,n.length,r.length);e=e.concat(Array(i-e.length).fill(e.at(-1))),t=t.concat(Array(i-t.length).fill(t.at(-1))),n=n.concat(Array(i-n.length).fill(n.at(-1))),r=r.concat(Array(i-r.length).fill(r.at(-1)));let a=t.map(xe);return{directionRadians:e.map(xe),altitudeRadians:a,shadowColor:r,highlightColor:n}}hasOffscreenPass(){return this.paint.get(`hillshade-exaggeration`)!==0&&!this.isHidden()}}let Mc;var Nc={get paint(){return Mc||=new Xa({"color-relief-opacity":new X(N[`paint_color-relief`][`color-relief-opacity`]),"color-relief-color":new Ya(N[`paint_color-relief`][`color-relief-color`]),resampling:new X(N[`paint_color-relief`].resampling)})}};function Pc(e){return`data`in e}class Fc{constructor(e,t,n,r){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this._ownedHandle=this.texture,this.update(t,r)}update(e,t,n){let{width:r,height:i}=e,a=(this.size?.[0]!==r||this.size[1]!==i)&&!n,{context:o}=this,{gl:s}=o;this.useMipmap=!!t?.useMipmap,s.bindTexture(s.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1);let c=this.format===s.RGBA&&!1!==t?.premultiply;if(a)this.size=[r,i],Pc(e)?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(e,c,r,i,s)):(o.pixelStoreUnpackPremultiplyAlpha.set(c),this._uploadDomImage(e,s));else{let{x:t,y:a}=n||{x:0,y:0};Pc(e)?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(e,c,t,a,r,i,s)):(o.pixelStoreUnpackPremultiplyAlpha.set(c),this._updateDomImage(e,t,a,s))}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D),o.pixelStoreUnpackFlipY.setDefault(),o.pixelStoreUnpack.setDefault(),o.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(e,t){t.texImage2D(t.TEXTURE_2D,0,this.format,this.format,t.UNSIGNED_BYTE,e)}_uploadRawData(e,t,n,r,i){let{data:a}=e;t&&a&&(a=Tc(a)),i.texImage2D(i.TEXTURE_2D,0,this.format,n,r,0,this.format,i.UNSIGNED_BYTE,a)}_updateDomImage(e,t,n,r){r.texSubImage2D(r.TEXTURE_2D,0,t,n,r.RGBA,r.UNSIGNED_BYTE,e)}_updateRawData(e,t,n,r,i,a,o){let{data:s}=e;t&&s&&(s=Tc(s)),o.texSubImage2D(o.TEXTURE_2D,0,n,r,i,a,o.RGBA,o.UNSIGNED_BYTE,s)}bind(e,t,n){let{context:r}=this,{gl:i}=r;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),i.bindTexture(i.TEXTURE_2D,this.texture),n!==i.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(n=i.LINEAR),e!==this.filter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,n||e),this.filter=e),t!==this.wrap&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}}class Ic{constructor(e,t,n,r=1,i=1,a=1,o=0){if(this.uid=e,t.height!==t.width)throw RangeError(`DEM tiles must be square`);if(n&&![`mapbox`,`terrarium`,`custom`].includes(n))return void de(`"${n}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=t.height;let s=this.dim=t.height-2;switch(this.data=new Uint32Array(t.data.buffer),n){case`terrarium`:this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case`custom`:this.redFactor=r,this.greenFactor=i,this.blueFactor=a,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let e=0;e<s;e++)this.data[this._idx(-1,e)]=this.data[this._idx(0,e)],this.data[this._idx(s,e)]=this.data[this._idx(s-1,e)],this.data[this._idx(e,-1)]=this.data[this._idx(e,0)],this.data[this._idx(e,s)]=this.data[this._idx(e,s-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(s,-1)]=this.data[this._idx(s-1,0)],this.data[this._idx(-1,s)]=this.data[this._idx(0,s-1)],this.data[this._idx(s,s)]=this.data[this._idx(s-1,s-1)],this.min=2**53-1,this.max=-(2**53-1);for(let e=0;e<s;e++)for(let t=0;t<s;t++){let n=this.get(e,t);n>this.max&&(this.max=n),n<this.min&&(this.min=n)}}get(e,t){let n=new Uint8Array(this.data.buffer),r=4*this._idx(e,t);return this.unpack(n[r],n[r+1],n[r+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${t}, dim: ${this.dim}`);return(t+1)*this.stride+(e+1)}unpack(e,t,n){return e*this.redFactor+t*this.greenFactor+n*this.blueFactor-this.baseShift}pack(e){return Lc(e,this.getUnpackVector())}getPixels(){return new wc({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,n){if(this.dim!==e.dim)throw Error(`dem dimension mismatch`);let r=t*this.dim,i=t*this.dim+this.dim,a=n*this.dim,o=n*this.dim+this.dim;switch(t){case-1:r=i-1;break;case 1:i=r+1}switch(n){case-1:a=o-1;break;case 1:o=a+1}let s=-t*this.dim,c=-n*this.dim;for(let t=a;t<o;t++)for(let n=r;n<i;n++)this.data[this._idx(n,t)]=e.data[this._idx(n+s,t+c)]}}function Lc(e,t){let n=t[0],r=t[1],i=t[2],a=t[3],o=Math.min(n,r,i),s=Math.round((e+a)/o);return{r:Math.floor(s*o/n)%256,g:Math.floor(s*o/r)%256,b:Math.floor(s*o/i)%256}}J(`DEMData`,Ic);class Rc extends $a{constructor(e,t){super(e,Nc,t)}_createColorRamp(e){let t={elevationStops:[],colorStops:[]},n=this._transitionablePaint._values[`color-relief-color`].value.expression;if(n instanceof li&&n._styleExpression.expression instanceof xn){this.colorRampExpression=n;let e=n._styleExpression.expression;t.elevationStops=e.labels,t.colorStops=[];for(let n of t.elevationStops)t.colorStops.push(e.evaluate({globals:{elevation:n}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[V.transparent]),t.elevationStops.length<2&&(t.elevationStops.push(t.elevationStops[0]+1),t.colorStops.push(t.colorStops[0])),t.elevationStops.length<=e)return t;let r={elevationStops:[],colorStops:[]},i=(t.elevationStops.length-1)/(e-1);for(let e=0;e<t.elevationStops.length-.5;e+=i)r.elevationStops.push(t.elevationStops[Math.round(e)]),r.colorStops.push(t.colorStops[Math.round(e)]);return de(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${t.elevationStops.length}`),r}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values[`color-relief-color`].value.expression}getColorRampTextures(e,t,n){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let r=this._createColorRamp(t),i=new wc({width:r.colorStops.length,height:1}),a=new wc({width:r.colorStops.length,height:1});for(let e=0;e<r.elevationStops.length;e++){let t=Lc(r.elevationStops[e],n);a.setPixel(0,e,new V(t.r/255,t.g/255,t.b/255,1)),i.setPixel(0,e,r.colorStops[e])}return this.colorRampTextures={elevationTexture:new Fc(e,a,e.gl.RGBA),colorTexture:new Fc(e,i,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}let{members:zc}=oo([{name:`a_pos`,components:2,type:`Int16`}],4);function Bc(e,t,n){let r=n.patternDependencies,i=!1;for(let n of t){let t=n.paint.get(`${e}-pattern`);t.isConstant()||(i=!0);let a=t.constantOr(null);a&&(i=!0,r[a.to]=!0,r[a.from]=!0)}return i}function Vc(e,t,n,r,i){let{zoom:a}=r,o=i.patternDependencies;for(let r of t){let t=r.paint.get(`${e}-pattern`).value;if(t.kind!==`constant`){let e=t.evaluate({zoom:a-1},n,{},i.availableImages),s=t.evaluate({zoom:a},n,{},i.availableImages),c=t.evaluate({zoom:a+1},n,{},i.availableImages);e=e?.name?e.name:e,s=s?.name?s.name:s,c=c?.name?c.name:c,o[e]=!0,o[s]=!0,o[c]=!0,n.patterns[r.id]={min:e,mid:s,max:c}}}return n}function Hc(e,t,n,r,i){let a;if(i===function(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=ul(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=ul(i/r|0,e[i],e[i+1],a);return a&&il(a,a.next)&&(dl(a),a=a.next),a}function Uc(e,t){if(!e)return e;t||=e;let n,r=e;do if(n=!1,r.steiner||!il(r,r.next)&&rl(r.prev,r,r.next)!==0)r=r.next;else{if(dl(r),r=t=r.prev,r===r.next)break;n=!0}while(n||r!==t);return t}function Wc(e,t,n,r,i,a,o){if(!e)return;!o&&a&&function(e,t,n,r){let i=e;do i.z===0&&(i.z=Qc(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){let t,n=1;do{let r,i=e;e=null;let a=null;for(t=0;i;){t++;let o=i,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||i.z<=o.z)?(r=i,i=i.nextZ,s--):(r=o,o=o.nextZ,c--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;i=o}a.nextZ=null,n*=2}while(t>1)}(i)}(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?Kc(e,r,i,a):Gc(e))t.push(c.i,e.i,l.i),dl(e),e=l.next,s=l.next;else if((e=l)===s){o?o===1?Wc(e=qc(Uc(e),t),t,n,r,i,a,2):o===2&&Jc(e,t,n,r,i,a):Wc(Uc(e),t,n,r,i,a,1);break}}}function Gc(e){let t=e.prev,n=e,r=e.next;if(rl(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&tl(i,s,a,c,o,l,m.x,m.y)&&rl(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Kc(e,t,n,r){let i=e.prev,a=e,o=e.next;if(rl(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=Qc(p,m,t,n,r),v=Qc(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&tl(s,u,c,d,l,f,y.x,y.y)&&rl(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&tl(s,u,c,d,l,f,b.x,b.y)&&rl(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&tl(s,u,c,d,l,f,y.x,y.y)&&rl(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&tl(s,u,c,d,l,f,b.x,b.y)&&rl(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function qc(e,t){let n=e;do{let r=n.prev,i=n.next.next;!il(r,i)&&al(r,n,n.next,i)&&cl(r,i)&&cl(i,r)&&(t.push(r.i,n.i,i.i),dl(n),dl(n.next),n=e=i),n=n.next}while(n!==e);return Uc(n)}function Jc(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&nl(o,e)){let s=ll(o,e);o=Uc(o,o.next),s=Uc(s,s.next),Wc(o,t,n,r,i,a,0),Wc(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function Yc(e,t){let n=e.x-t.x;return n===0&&(n=e.y-t.y,n===0)&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),n}function Xc(e,t){let n=function(e,t){let n=t,r=e.x,i=e.y,a,o=-1/0;if(il(e,n))return n;do{if(il(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>o&&(o=e,a=n.x<n.next.x?n:n.next,e===r))return a}n=n.next}while(n!==t);if(!a)return null;let s=a,c=a.x,l=a.y,u=1/0;n=a;do{if(r>=n.x&&n.x>=c&&r!==n.x&&el(i<l?r:o,i,c,l,i<l?o:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);cl(n,e)&&(t<u||t===u&&(n.x>a.x||n.x===a.x&&Zc(a,n)))&&(a=n,u=t)}n=n.next}while(n!==s);return a}(e,t);if(!n)return t;let r=ll(n,e);return Uc(r,r.next),Uc(n,n.next)}function Zc(e,t){return rl(e.prev,e,t.prev)<0&&rl(t.next,e,e.next)<0}function Qc(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function $c(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function el(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function tl(e,t,n,r,i,a,o,s){return!(e===o&&t===s)&&el(e,t,n,r,i,a,o,s)}function nl(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&al(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(cl(e,t)&&cl(t,e)&&function(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}(e,t)&&(rl(e.prev,e,t.prev)||rl(e,t.prev,t))||il(e,t)&&rl(e.prev,e,e.next)>0&&rl(t.prev,t,t.next)>0)}function rl(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function il(e,t){return e.x===t.x&&e.y===t.y}function al(e,t,n,r){let i=sl(rl(e,t,n)),a=sl(rl(e,t,r)),o=sl(rl(n,r,e)),s=sl(rl(n,r,t));return i!==a&&o!==s||!(i!==0||!ol(e,n,t))||!(a!==0||!ol(e,r,t))||!(o!==0||!ol(n,e,r))||!(s!==0||!ol(n,t,r))}function ol(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function sl(e){return e>0?1:e<0?-1:0}function cl(e,t){return rl(e.prev,e,e.next)<0?rl(e,t,e.next)>=0&&rl(e,e.prev,t)>=0:rl(e,t,e.prev)<0||rl(e,e.next,t)<0}function ll(e,t){let n=fl(e.i,e.x,e.y),r=fl(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function ul(e,t,n,r){let i=fl(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function dl(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function fl(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class pl{constructor(e,t){if(t>e)throw Error(`Min granularity must not be greater than base granularity.`);this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class ml{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}ml.noSubdivision=new ml({fill:new pl(0,0),line:new pl(0,0),tile:new pl(0,0),stencil:new pl(0,0),circle:1}),J(`SubdivisionGranularityExpression`,pl),J(`SubdivisionGranularitySetting`,ml);let hl=-32768,gl=32767;class _l{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=O/e,this._canonical=t}_getKey(e,t){return(e+=32768)<<16|t+32768}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw Error(`Vertex coordinates are out of signed 16 bit integer range.`);let n=0|Math.round(e),r=0|Math.round(t),i=this._getKey(n,r);if(this._vertexDictionary.has(i))return this._vertexDictionary.get(i);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(i,a),this._vertexBuffer.push(n,r),a}_subdivideTrianglesScanline(e){if(this._granularity<2)return function(e,t){let n=[];for(let r=0;r<t.length;r+=3){let i=t[r],a=t[r+1],o=t[r+2],s=e[2*i],c=e[2*i+1];(e[2*a]-s)*(e[2*o+1]-c)-(e[2*a+1]-c)*(e[2*o]-s)>0?(n.push(i),n.push(o),n.push(a)):(n.push(i),n.push(a),n.push(o))}return n}(this._vertexBuffer,e);let t=[],n=e.length;for(let r=0;r<n;r+=3){let n=[e[r+0],e[r+1],e[r+2]],i=[this._vertexBuffer[2*e[r+0]+0],this._vertexBuffer[2*e[r+0]+1],this._vertexBuffer[2*e[r+1]+0],this._vertexBuffer[2*e[r+1]+1],this._vertexBuffer[2*e[r+2]+0],this._vertexBuffer[2*e[r+2]+1]],a=1/0,o=1/0,s=-1/0,c=-1/0;for(let e=0;e<3;e++){let t=i[2*e],n=i[2*e+1];a=Math.min(a,t),s=Math.max(s,t),o=Math.min(o,n),c=Math.max(c,n)}if(a===s||o===c)continue;let l=Math.floor(a/this._granularityCellSize),u=Math.ceil(s/this._granularityCellSize),d=Math.floor(o/this._granularityCellSize),f=Math.ceil(c/this._granularityCellSize);if(l!==u||d!==f)for(let e=d;e<f;e++){let r=this._scanlineGenerateVertexRingForCellRow(e,i,n);bl(this._vertexBuffer,r,t)}else t.push(...n)}return t}_scanlineGenerateVertexRingForCellRow(e,t,n){let r=e*this._granularityCellSize,i=r+this._granularityCellSize,a=[];for(let e=0;e<3;e++){let o=t[2*e],s=t[2*e+1],c=t[2*(e+1)%6],l=t[(2*(e+1)+1)%6],u=t[2*(e+2)%6],d=t[(2*(e+2)+1)%6],f=c-o,p=l-s,m=f===0,h=p===0,g=(r-s)/p,_=(i-s)/p,v=Math.min(g,_),y=Math.max(g,_);if(!h&&(v>=1||y<=0)||h&&(s<r||s>i)){l>=r&&l<=i&&a.push(n[(e+1)%3]);continue}!h&&v>0&&a.push(this._vertexToIndex(o+f*v,s+p*v));let b=o+f*Math.max(v,0),x=o+f*Math.min(y,1);m||this._generateIntraEdgeVertices(a,o,s,c,l,b,x),!h&&y<1&&a.push(this._vertexToIndex(o+f*y,s+p*y)),(h||l>=r&&l<=i)&&a.push(n[(e+1)%3]),!h&&(l<=r||l>=i)&&this._generateInterEdgeVertices(a,o,s,c,l,u,d,x,r,i)}return a}_generateIntraEdgeVertices(e,t,n,r,i,a,o){let s=r-t,c=i-n,l=c===0,u=l?Math.min(t,r):Math.min(a,o),d=l?Math.max(t,r):Math.max(a,o),f=Math.floor(u/this._granularityCellSize)+1,p=Math.ceil(d/this._granularityCellSize)-1;if(l?t<r:a<o)for(let r=f;r<=p;r++){let i=r*this._granularityCellSize;e.push(this._vertexToIndex(i,n+c*(i-t)/s))}else for(let r=p;r>=f;r--){let i=r*this._granularityCellSize;e.push(this._vertexToIndex(i,n+c*(i-t)/s))}}_generateInterEdgeVertices(e,t,n,r,i,a,o,s,c,l){let u=i-n,d=a-r,f=o-i,p=(c-i)/f,m=(l-i)/f,h=Math.min(p,m),g=Math.max(p,m),_=r+d*h,v=Math.floor(Math.min(_,s)/this._granularityCellSize)+1,y=Math.ceil(Math.max(_,s)/this._granularityCellSize)-1,b=s<_,x=f===0;if(x&&(o===c||o===l))return;if(x||h>=1||g<=0){let e=n-o,r=a+(t-a)*Math.min((c-o)/e,(l-o)/e);v=Math.floor(Math.min(r,s)/this._granularityCellSize)+1,y=Math.ceil(Math.max(r,s)/this._granularityCellSize)-1,b=s<r}let S=u>0?l:c;if(b)for(let t=v;t<=y;t++)e.push(this._vertexToIndex(t*this._granularityCellSize,S));else for(let t=y;t>=v;t--)e.push(this._vertexToIndex(t*this._granularityCellSize,S))}_generateOutline(e){let t=[];for(let n of e){let e=yl(n,this._granularity,!0),r=this._pointArrayToIndices(e),i=[];for(let e=1;e<r.length;e++)i.push(r[e-1]),i.push(r[e]);t.push(i)}return t}_handlePoles(e){let t=!1,n=!1;this._canonical&&(this._canonical.y===0&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(n=!0)),(t||n)&&this._fillPoles(e,t,n)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){let n=e[t+1];n===hl&&(e[t+1]=-32767),n===gl&&(e[t+1]=32766)}}_generatePoleQuad(e,t,n,r,i,a){r>i==(a===hl)?(e.push(n),e.push(t),e.push(this._vertexToIndex(r,a)),e.push(this._vertexToIndex(i,a)),e.push(n),e.push(this._vertexToIndex(r,a))):(e.push(t),e.push(n),e.push(this._vertexToIndex(r,a)),e.push(n),e.push(this._vertexToIndex(i,a)),e.push(this._vertexToIndex(r,a)))}_fillPoles(e,t,n){let r=this._vertexBuffer,i=O,a=e.length;for(let o=2;o<a;o+=3){let a=e[o-2],s=e[o-1],c=e[o],l=r[2*a],u=r[2*a+1],d=r[2*s],f=r[2*s+1],p=r[2*c],m=r[2*c+1];t&&(u===0&&f===0&&this._generatePoleQuad(e,a,s,l,d,hl),f===0&&m===0&&this._generatePoleQuad(e,s,c,d,p,hl),m===0&&u===0&&this._generatePoleQuad(e,c,a,p,l,hl)),n&&(u===i&&f===i&&this._generatePoleQuad(e,a,s,l,d,gl),f===i&&m===i&&this._generatePoleQuad(e,s,c,d,p,gl),m===i&&u===i&&this._generatePoleQuad(e,c,a,p,l,gl))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw Error(`Subdivision: multiple use not allowed.`);this._used=!0;let{flattened:n,holeIndices:r}=function(e){let t=[],n=[];for(let r of e)if(r.length!==0){r!==e[0]&&t.push(n.length/2);for(let e of r)n.push(e.x),n.push(e.y)}return{flattened:n,holeIndices:t}}(e),i;this._initializeVertices(n);try{let e=function(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=Hc(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=function(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=Hc(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push($c(o))}i.sort(Yc);for(let e=0;e<i.length;e++)n=Xc(i[e],n);return n}(e,t,a,n)),e.length>80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return Wc(a,o,n,s,c,l,0),o}(n,r),t=this._convertIndices(n,e);i=this._subdivideTrianglesScanline(t)}catch(e){console.error(e)}let a=[];return t&&(a=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(i),{verticesFlattened:this._vertexBuffer,indicesTriangles:i,indicesLineList:a}}_convertIndices(e,t){let n=[];for(let r of t)n.push(this._vertexToIndex(e[2*r],e[2*r+1]));return n}_pointArrayToIndices(e){let t=[];for(let n of e)t.push(this._vertexToIndex(n.x,n.y));return t}}function vl(e,t,n,r=!0){return new _l(n,t).subdividePolygonInternal(e,r)}function yl(e,t,r=!1){if(!e||e.length<1||e.length<2)return[];let i=e[0],a=e[e.length-1],o=r&&(i.x!==a.x||i.y!==a.y);if(t<2)return o?[...e,e[0]]:[...e];let s=Math.floor(O/t),c=[];c.push(new n(e[0].x,e[0].y));let l=e.length,u=o?l:l-1;for(let t=0;t<u;t++){let r=e[t],i=t<l-1?e[t+1]:e[0],a=r.x,o=r.y,u=i.x,d=i.y,f=a!==u,p=o!==d;if(!f&&!p)continue;let m=u-a,h=d-o,g=Math.abs(m),_=Math.abs(h),v=a,y=o;for(;;){let e=m>0?(Math.floor(v/s)+1)*s:(Math.ceil(v/s)-1)*s,t=h>0?(Math.floor(y/s)+1)*s:(Math.ceil(y/s)-1)*s,r=Math.abs(v-e),i=Math.abs(y-t),a=Math.abs(v-u),o=Math.abs(y-d),l=f?r/g:1/0,b=p?i/_:1/0;if((a<=r||!f)&&(o<=i||!p))break;if(l<b&&f||!p){v=e,y+=h*l;let t=new n(v,Math.round(y));c[c.length-1].x===t.x&&c[c.length-1].y===t.y||c.push(t)}else{v+=m*b,y=t;let e=new n(Math.round(v),y);c[c.length-1].x===e.x&&c[c.length-1].y===e.y||c.push(e)}}let b=new n(u,d);c[c.length-1].x===b.x&&c[c.length-1].y===b.y||c.push(b)}return c}function bl(e,t,n){if(t.length===0)throw Error(`Subdivision vertex ring is empty.`);let r=0,i=e[2*t[0]];for(let n=1;n<t.length;n++){let a=e[2*t[n]];a<i&&(i=a,r=n)}let a=t.length,o=r,s=(o+1)%a;for(;;){let r=o-1>=0?o-1:a-1,i=(s+1)%a,c=e[2*t[r]],l=e[2*t[i]],u=e[2*t[o]],d=e[2*t[o]+1],f=e[2*t[s]+1],p=!1;if(c<l)p=!0;else if(c>l)p=!1;else{let n=f-d,a=-(e[2*t[s]]-u),o=d<f?1:-1;((c-u)*n+(e[2*t[r]+1]-d)*a)*o>((l-u)*n+(e[2*t[i]+1]-d)*a)*o&&(p=!0)}if(p){let e=t[r],i=t[o],c=t[s];e!==i&&e!==c&&i!==c&&n.push(c,i,e),o--,o<0&&(o=a-1)}else{let e=t[i],r=t[o],c=t[s];e!==r&&e!==c&&r!==c&&n.push(c,r,e),s++,s>=a&&(s=0)}if(r===i)break}}function xl(e,t,n,r,i,a,o,s,c){let l=i.length/2,u=o&&s&&c;if(l<ss.MAX_VERTEX_ARRAY_LENGTH){let d=t.prepareSegment(l,n,r),f=d.vertexLength;for(let e=0;e<a.length;e+=3)r.emplaceBack(f+a[e],f+a[e+1],f+a[e+2]);let p,m;d.vertexLength+=l,d.primitiveLength+=a.length/3,u&&(m=o.prepareSegment(l,n,s),p=m.vertexLength,m.vertexLength+=l);for(let t=0;t<i.length;t+=2)e(i[t],i[t+1]);if(u)for(let e of c){for(let t=1;t<e.length;t+=2)s.emplaceBack(p+e[t-1],p+e[t]);m.primitiveLength+=e.length/2}}else (function(e,t,n,r,i,a){let o=[];for(let e=0;e<r.length/2;e++)o.push(-1);let s={count:0},c=0,l=e.getOrCreateLatestSegment(t,n),u=l.vertexLength;for(let d=2;d<i.length;d+=3){let f=i[d-2],p=i[d-1],m=i[d],h=o[f]<c,g=o[p]<c,_=o[m]<c;l.vertexLength+(+!!h+ +!!g+ +!!_)>ss.MAX_VERTEX_ARRAY_LENGTH&&(l=e.createNewSegment(t,n),c=s.count,h=!0,g=!0,_=!0,u=0);let v=Sl(o,r,a,s,f,h,l),y=Sl(o,r,a,s,p,g,l),b=Sl(o,r,a,s,m,_,l);n.emplaceBack(u+v-c,u+y-c,u+b-c),l.primitiveLength++}})(t,n,r,i,a,e),u&&function(e,t,n,r,i,a){let o=[];for(let e=0;e<r.length/2;e++)o.push(-1);let s={count:0},c=0,l=e.getOrCreateLatestSegment(t,n),u=l.vertexLength;for(let d of i)for(let i=1;i<d.length;i+=2){let f=d[i-1],p=d[i],m=o[f]<c,h=o[p]<c;l.vertexLength+(+!!m+ +!!h)>ss.MAX_VERTEX_ARRAY_LENGTH&&(l=e.createNewSegment(t,n),c=s.count,m=!0,h=!0,u=0);let g=Sl(o,r,a,s,f,m,l),_=Sl(o,r,a,s,p,h,l);n.emplaceBack(u+g-c,u+_-c),l.primitiveLength++}}(o,n,s,i,c,e),t.forceNewSegmentOnNextPrepare(),o?.forceNewSegmentOnNextPrepare()}function Sl(e,t,n,r,i,a,o){if(a){let a=r.count;return n(t[2*i],t[2*i+1]),e[i]=r.count,r.count++,o.vertexLength++,a}return e[i]}class Cl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new qo,this.indexArray=new is,this.indexArray2=new as,this.programConfigurations=new Is(e.layers,e.zoom),this.segments=new ss,this.segments2=new ss,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){this.hasDependencies=Bc(`fill`,this.layers,t);let r=this.layers[0].layout.get(`fill-sort-key`),i=!r.isConstant(),a=[];for(let{feature:o,id:s,index:c,sourceLayerIndex:l}of e){let e=this.layers[0]._featureFilter.needGeometry,u=Hs(o,e);if(!this.layers[0]._featureFilter.filter(new Y(this.zoom),u,n))continue;let d=i?r.evaluate(u,{},n,t.availableImages):void 0,f={id:s,properties:o.properties,type:o.type,sourceLayerIndex:l,index:c,geometry:e?u.geometry:Vs(o),patterns:{},sortKey:d};a.push(f)}i&&a.sort(((e,t)=>e.sortKey-t.sortKey));for(let r of a){let{geometry:i,index:a,sourceLayerIndex:o}=r;if(this.hasDependencies){let e=Vc(`fill`,this.layers,r,{zoom:this.zoom},t);this.patternFeatures.push(e)}else this.addFeature(r,i,a,n,{},t.subdivisionGranularity);t.featureIndex.insert(e[a].feature,i,a,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:n})}addFeatures(e,t,n){for(let r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,n,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,zc),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,t,n,r,i,a){for(let e of cr(t,500)){let t=vl(e,r,a.fill.getGranularityForZoomLevel(r.z)),n=this.layoutVertexArray;xl(((e,t)=>{n.emplaceBack(e,t)}),this.segments,this.layoutVertexArray,this.indexArray,t.verticesFlattened,t.indicesTriangles,this.segments2,this.indexArray2,t.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{imagePositions:i,canonical:r})}}let wl,Tl;J(`FillBucket`,Cl,{omit:[`layers`,`patternFeatures`]});var El={get paint(){return Tl||=new Xa({"fill-antialias":new X(N.paint_fill[`fill-antialias`]),"fill-opacity":new Z(N.paint_fill[`fill-opacity`]),"fill-color":new Z(N.paint_fill[`fill-color`]),"fill-outline-color":new Z(N.paint_fill[`fill-outline-color`]),"fill-translate":new X(N.paint_fill[`fill-translate`]),"fill-translate-anchor":new X(N.paint_fill[`fill-translate-anchor`]),"fill-pattern":new qa(N.paint_fill[`fill-pattern`])})},get layout(){return wl||=new Xa({"fill-sort-key":new Z(N.layout_fill[`fill-sort-key`])})}};class Dl extends $a{constructor(e,t){super(e,El,t)}recalculate(e,t){super.recalculate(e,t);let n=this.paint._values[`fill-outline-color`];n.value.kind===`constant`&&n.value.value===void 0&&(this.paint._values[`fill-outline-color`]=this.paint._values[`fill-color`])}createBucket(e){return new Cl(e)}queryRadius(){return ic(this.paint.get(`fill-translate`))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:n,pixelsToTileUnits:r}){return Js(ac(e,this.paint.get(`fill-translate`),this.paint.get(`fill-translate-anchor`),-n.bearingInRadians,r),t)}isTileClipped(){return!0}}let Ol=oo([{name:`a_pos`,components:2,type:`Int16`},{name:`a_normal_ed`,components:4,type:`Int16`}],4),kl=oo([{name:`a_centroid`,components:2,type:`Int16`}],4),{members:Al}=Ol;class jl{constructor(e,t,n,r,i){this.properties={},this.extent=n,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=i,e.readFields(Ml,this,t)}loadGeometry(){let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,r=[],i,a=1,o=0,s=0,c=0;for(;e.pos<t;){if(o<=0){let t=e.readVarint();a=7&t,o=t>>3}if(o--,a===1||a===2)s+=e.readSVarint(),c+=e.readSVarint(),a===1&&(i&&r.push(i),i=[]),i&&i.push(new n(s,c));else{if(a!==7)throw Error(`unknown command ${a}`);i&&i.push(i[0].clone())}}return i&&r.push(i),r}bbox(){let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,n=1,r=0,i=0,a=0,o=1/0,s=-1/0,c=1/0,l=-1/0;for(;e.pos<t;){if(r<=0){let t=e.readVarint();n=7&t,r=t>>3}if(r--,n===1||n===2)i+=e.readSVarint(),a+=e.readSVarint(),i<o&&(o=i),i>s&&(s=i),a<c&&(c=a),a>l&&(l=a);else if(n!==7)throw Error(`unknown command ${n}`)}return[o,c,s,l]}toGeoJSON(e,t,n){let r=this.extent*2**n,i=this.extent*e,a=this.extent*t,o=this.loadGeometry();function s(e){return[360*(e.x+i)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+a)/r)*Math.PI))-90]}function c(e){return e.map(s)}let l;if(this.type===1){let e=[];for(let t of o)e.push(t[0]);let t=c(e);l=e.length===1?{type:`Point`,coordinates:t[0]}:{type:`MultiPoint`,coordinates:t}}else if(this.type===2){let e=o.map(c);l=e.length===1?{type:`LineString`,coordinates:e[0]}:{type:`MultiLineString`,coordinates:e}}else{if(this.type!==3)throw Error(`unknown feature type`);{let e=Nl(o),t=[];for(let n of e)t.push(n.map(c));l=t.length===1?{type:`Polygon`,coordinates:t[0]}:{type:`MultiPolygon`,coordinates:t}}}let u={type:`Feature`,geometry:l,properties:this.properties};return this.id!=null&&(u.id=this.id),u}}function Ml(e,t,n){e===1?t.id=n.readVarint():e===2?function(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let n=t._keys[e.readVarint()],r=t._values[e.readVarint()];t.properties[n]=r}}(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos)}function Nl(e){let t=e.length;if(t<=1)return[e];let n=[],r,i;for(let a=0;a<t;a++){let t=Pl(e[a]);t!==0&&(i===void 0&&(i=t<0),i===t<0?(r&&n.push(r),r=[e[a]]):r&&r.push(e[a]))}return r&&n.push(r),n}function Pl(e){let t=0;for(let n,r,i=0,a=e.length,o=a-1;i<a;o=i++)n=e[i],r=e[o],t+=(r.x-n.x)*(n.y+r.y);return t}jl.types=[`Unknown`,`Point`,`LineString`,`Polygon`];class Fl{constructor(e,t){this.version=1,this.name=``,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Il,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw Error(`feature index out of bounds`);this._pbf.pos=this._features[e];let t=this._pbf.readVarint()+this._pbf.pos;return new jl(this._pbf,t,this.extent,this._keys,this._values)}}function Il(e,t,n){e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(function(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let n=e.readVarint()>>3;t=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null}if(t==null)throw Error(`unknown feature value`);return t}(n))}class Ll{constructor(e,t){this.layers=e.readFields(Rl,{},t)}}function Rl(e,t,n){if(e===3){let e=new Fl(n,n.readVarint()+n.pos);e.length&&(t[e.name]=e)}}let zl=2**13;function Bl(e,t,n,r,i,a,o,s){e.emplaceBack(t,n,2*Math.floor(r*zl)+o,i*zl*2,a*zl*2,Math.round(s))}class Vl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Jo,this.centroidVertexArray=new Go,this.indexArray=new is,this.programConfigurations=new Is(e.layers,e.zoom),this.segments=new ss,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){this.features=[],this.hasDependencies=Bc(`fill-extrusion`,this.layers,t);for(let{feature:r,id:i,index:a,sourceLayerIndex:o}of e){let e=this.layers[0]._featureFilter.needGeometry,s=Hs(r,e);if(!this.layers[0]._featureFilter.filter(new Y(this.zoom),s,n))continue;let c={id:i,sourceLayerIndex:o,index:a,geometry:e?s.geometry:Vs(r),properties:r.properties,type:r.type,patterns:{}};this.hasDependencies?this.features.push(Vc(`fill-extrusion`,this.layers,c,{zoom:this.zoom},t)):this.addFeature(c,c.geometry,a,n,{},t.subdivisionGranularity),t.featureIndex.insert(r,c.geometry,a,o,this.index,!0)}}addFeatures(e,t,n){for(let r of this.features){let{geometry:i}=r;this.addFeature(r,i,r.index,t,n,e.subdivisionGranularity)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:n})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Al),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,kl.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,n,r,i,a){for(let n of cr(t,500)){let t={x:0,y:0,sampleCount:0},i=this.layoutVertexArray.length;this.processPolygon(t,r,e,n,a);let o=this.layoutVertexArray.length-i,s=Math.floor(t.x/t.sampleCount),c=Math.floor(t.y/t.sampleCount);for(let e=0;e<o;e++)this.centroidVertexArray.emplaceBack(s,c)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{imagePositions:i,canonical:r})}processPolygon(e,t,n,r,i){if(r.length<1||Wl(r[0]))return;for(let t of r)t.length!==0&&Hl(e,t);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},o=i.fill.getGranularityForZoomLevel(t.z),s=jl.types[n.type]===`Polygon`;for(let e of r){if(e.length===0||Wl(e))continue;let t=yl(e,o,s);this._generateSideFaces(t,a)}if(!s)return;let c=vl(r,t,o,!1),l=this.layoutVertexArray;xl(((e,t)=>{Bl(l,e,t,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,c.verticesFlattened,c.indicesTriangles)}_generateSideFaces(e,t){let n=0;for(let r=1;r<e.length;r++){let i=e[r],a=e[r-1];if(Ul(i,a))continue;t.segment.vertexLength+4>ss.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let o=i.sub(a)._perp()._unit(),s=a.dist(i);n+s>32768&&(n=0),Bl(this.layoutVertexArray,i.x,i.y,o.x,o.y,0,0,n),Bl(this.layoutVertexArray,i.x,i.y,o.x,o.y,0,1,n),n+=s,Bl(this.layoutVertexArray,a.x,a.y,o.x,o.y,0,0,n),Bl(this.layoutVertexArray,a.x,a.y,o.x,o.y,0,1,n);let c=t.segment.vertexLength;this.indexArray.emplaceBack(c,c+2,c+1),this.indexArray.emplaceBack(c+1,c+2,c+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}}function Hl(e,t){for(let n=0;n<t.length;n++){let r=t[n];n===t.length-1&&t[0].x===r.x&&t[0].y===r.y||(e.x+=r.x,e.y+=r.y,e.sampleCount++)}}function Ul(e,t){return e.x===t.x&&(e.x<0||e.x>O)||e.y===t.y&&(e.y<0||e.y>O)}function Wl(e){return e.every((e=>e.x<0))||e.every((e=>e.x>O))||e.every((e=>e.y<0))||e.every((e=>e.y>O))}let Gl;J(`FillExtrusionBucket`,Vl,{omit:[`layers`,`features`]});var Kl={get paint(){return Gl||=new Xa({"fill-extrusion-opacity":new X(N[`paint_fill-extrusion`][`fill-extrusion-opacity`]),"fill-extrusion-color":new Z(N[`paint_fill-extrusion`][`fill-extrusion-color`]),"fill-extrusion-translate":new X(N[`paint_fill-extrusion`][`fill-extrusion-translate`]),"fill-extrusion-translate-anchor":new X(N[`paint_fill-extrusion`][`fill-extrusion-translate-anchor`]),"fill-extrusion-pattern":new qa(N[`paint_fill-extrusion`][`fill-extrusion-pattern`]),"fill-extrusion-height":new Z(N[`paint_fill-extrusion`][`fill-extrusion-height`]),"fill-extrusion-base":new Z(N[`paint_fill-extrusion`][`fill-extrusion-base`]),"fill-extrusion-vertical-gradient":new X(N[`paint_fill-extrusion`][`fill-extrusion-vertical-gradient`])})}};class ql extends $a{constructor(e,t){super(e,Kl,t)}createBucket(e){return new Vl(e)}queryRadius(){return ic(this.paint.get(`fill-extrusion-translate`))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:a,pixelsToTileUnits:o,pixelPosMatrix:s}){let c=ac(e,this.paint.get(`fill-extrusion-translate`),this.paint.get(`fill-extrusion-translate-anchor`),-a.bearingInRadians,o),l=this.paint.get(`fill-extrusion-height`).evaluate(t,r),u=this.paint.get(`fill-extrusion-base`).evaluate(t,r),d=function(e,t){let r=[];for(let i of e){let e=[i.x,i.y,0,1];C(e,e,t),r.push(new n(e[0]/e[3],e[1]/e[3]))}return r}(c,s),f=function(e,t,r,i){let a=[],o=[],s=i[8]*t,c=i[9]*t,l=i[10]*t,u=i[11]*t,d=i[8]*r,f=i[9]*r,p=i[10]*r,m=i[11]*r;for(let t of e){let e=[],r=[];for(let a of t){let t=a.x,o=a.y,h=i[0]*t+i[4]*o+i[12],g=i[1]*t+i[5]*o+i[13],_=i[2]*t+i[6]*o+i[14],v=i[3]*t+i[7]*o+i[15],y=_+l,b=v+u,x=h+d,S=g+f,C=_+p,w=v+m,T=new n((h+s)/b,(g+c)/b);T.z=y/b,e.push(T);let E=new n(x/w,S/w);E.z=C/w,r.push(E)}a.push(e),o.push(r)}return[a,o]}(i,u,l,s);return function(e,t,n){let r=1/0;Js(n,t)&&(r=Yl(n,t[0]));for(let i=0;i<t.length;i++){let a=t[i],o=e[i];for(let e=0;e<a.length-1;e++){let t=a[e],i=[t,a[e+1],o[e+1],o[e],t];Ks(n,i)&&(r=Math.min(r,Yl(n,i)))}}return r!==1/0&&r}(f[0],f[1],d)}}function Jl(e,t){return e.x*t.x+e.y*t.y}function Yl(e,t){if(e.length===1){let n=0,r=t[n++],i;for(;!i||r.equals(i);)if(i=t[n++],!i)return 1/0;for(;n<t.length;n++){let a=t[n],o=e[0],s=i.sub(r),c=a.sub(r),l=o.sub(r),u=Jl(s,s),d=Jl(s,c),f=Jl(c,c),p=Jl(l,s),m=Jl(l,c),h=u*f-d*d,g=(f*p-d*m)/h,_=(u*m-d*p)/h,v=r.z*(1-g-_)+i.z*g+a.z*_;if(isFinite(v))return v}return 1/0}{let e=1/0;for(let n of t)e=Math.min(e,n.z);return e}}let Xl=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Zl{static from(e){if(!(e instanceof ArrayBuffer))throw Error(`Data must be an instance of ArrayBuffer.`);let[t,n]=new Uint8Array(e,0,2);if(t!==219)throw Error(`Data does not appear to be in a KDBush format.`);let r=n>>4;if(r!==1)throw Error(`Got v${r} data when expected v1.`);let i=Xl[15&n];if(!i)throw Error(`Unrecognized array type.`);let[a]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new Zl(o,a,i,e)}constructor(e,t=64,n=Float64Array,r){if(isNaN(e)||e<0)throw Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let i=Xl.indexOf(this.ArrayType),a=2*e*this.ArrayType.BYTES_PER_ELEMENT,o=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-o%8)%8;if(i<0)throw Error(`Unexpected typed array class: ${n}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+s,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+a+o+s),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+s,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return Ql(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this,s=[0,i.length-1,0],c=[];for(;s.length;){let l=s.pop()||0,u=s.pop()||0,d=s.pop()||0;if(u-d<=o){for(let o=d;o<=u;o++){let s=a[2*o],l=a[2*o+1];s>=e&&s<=n&&l>=t&&l<=r&&c.push(i[o])}continue}let f=d+u>>1,p=a[2*f],m=a[2*f+1];p>=e&&p<=n&&m>=t&&m<=r&&c.push(i[f]),(l===0?e<=p:t<=m)&&(s.push(d),s.push(f-1),s.push(1-l)),(l===0?n>=p:r>=m)&&(s.push(f+1),s.push(u),s.push(1-l))}return c}within(e,t,n){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:r,coords:i,nodeSize:a}=this,o=[0,r.length-1,0],s=[],c=n*n;for(;o.length;){let l=o.pop()||0,u=o.pop()||0,d=o.pop()||0;if(u-d<=a){for(let n=d;n<=u;n++)nu(i[2*n],i[2*n+1],e,t)<=c&&s.push(r[n]);continue}let f=d+u>>1,p=i[2*f],m=i[2*f+1];nu(p,m,e,t)<=c&&s.push(r[f]),(l===0?e-n<=p:t-n<=m)&&(o.push(d),o.push(f-1),o.push(1-l)),(l===0?e+n>=p:t+n>=m)&&(o.push(f+1),o.push(u),o.push(1-l))}return s}}function Ql(e,t,n,r,i,a){if(i-r<=n)return;let o=r+i>>1;$l(e,t,o,r,i,a),Ql(e,t,n,r,o-1,1-a),Ql(e,t,n,o+1,i,1-a)}function $l(e,t,n,r,i,a){for(;i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,c=Math.log(o),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(o-l)/o)*(s-o/2<0?-1:1);$l(e,t,n,Math.max(r,Math.floor(n-s*l/o+u)),Math.min(i,Math.floor(n+(o-s)*l/o+u)),a)}let o=t[2*n+a],s=r,c=i;for(eu(e,t,r,n),t[2*i+a]>o&&eu(e,t,r,i);s<c;){for(eu(e,t,s,c),s++,c--;t[2*s+a]<o;)s++;for(;t[2*c+a]>o;)c--}t[2*r+a]===o?eu(e,t,r,c):(c++,eu(e,t,c,i)),c<=n&&(r=c+1),n<=c&&(i=c-1)}}function eu(e,t,n,r){tu(e,n,r),tu(t,2*n,2*r),tu(t,2*n+1,2*r+1)}function tu(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function nu(e,t,n,r){let i=e-n,a=t-r;return i*i+a*a}function ru(e,t,n,r){let i=r,a=t+(n-t>>1),o,s=n-t,c=e[t],l=e[t+1],u=e[n],d=e[n+1];for(let r=t+3;r<n;r+=3){let t=iu(e[r],e[r+1],c,l,u,d);if(t>i)o=r,i=t;else if(t===i){let e=Math.abs(r-a);e<s&&(o=r,s=e)}}i>r&&(o-t>3&&ru(e,t,o,r),e[o+2]=i,n-o>3&&ru(e,o,n,r))}function iu(e,t,n,r,i,a){let o=i-n,s=a-r;if(o!==0||s!==0){let c=((e-n)*o+(t-r)*s)/(o*o+s*s);c>1?(n=i,r=a):c>0&&(n+=o*c,r+=s*c)}return o=e-n,s=t-r,o*o+s*s}function au(e,t,n,r){let i={type:t,geom:n},a={id:e??null,type:i.type,geometry:i.geom,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(i.type){case`Point`:case`MultiPoint`:su(a,i.geom);break;case`LineString`:su(a,i.geom.points);break;case`Polygon`:su(a,i.geom[0].points);break;case`MultiLineString`:for(let e of i.geom)su(a,e.points);break;case`MultiPolygon`:for(let e of i.geom)su(a,e[0].points)}return a}function ou(e){e.points.length>64&&(e.points=new Float64Array(e.points))}function su(e,t){for(let n=0;n<t.length;n+=3)e.minX=Math.min(e.minX,t[n]),e.minY=Math.min(e.minY,t[n+1]),e.maxX=Math.max(e.maxX,t[n]),e.maxY=Math.max(e.maxY,t[n+1])}function cu(e,t){let n=[];switch(e.type){case`FeatureCollection`:for(let r=0;r<e.features.length;r++)lu(n,e.features[r],t,r);break;case`Feature`:lu(n,e,t);break;default:lu(n,{geometry:e,properties:void 0},t)}return n}function lu(e,t,n,r){if(!t.geometry)return;if(t.geometry.type===`GeometryCollection`)return void function(e,t,n,r,i){for(let a of n.geometries)lu(e,{id:t.id,geometry:a,properties:t.properties},r,i)}(e,t,t.geometry,n,r);if(!t.geometry.coordinates?.length)return;let i=function(e,t,n){return t.promoteId?e.properties?.[t.promoteId]:t.generateId?n||0:e.id}(t,n,r),a=(n.tolerance/((1<<n.maxZoom)*n.extent))**2;switch(t.geometry.type){case`Point`:(function(e,t,n,r){let i=[];i.push(fu(n.coordinates[0]),pu(n.coordinates[1]),0),e.push(au(t,`Point`,i,r))})(e,i,t.geometry,t.properties);return;case`MultiPoint`:(function(e,t,n,r){let i=[];for(let e of n.coordinates)i.push(fu(e[0]),pu(e[1]),0);e.push(au(t,`MultiPoint`,i,r))})(e,i,t.geometry,t.properties);return;case`LineString`:(function(e,t,n,r,i){let a={points:[]};uu(n.coordinates,a,r,!1),e.push(au(t,`LineString`,a,i))})(e,i,t.geometry,a,t.properties);return;case`MultiLineString`:(function(e,t,n,r,i,a){if(i.lineMetrics)for(let i of n.coordinates){let n={points:[]};uu(i,n,r,!1),e.push(au(t,`LineString`,n,a))}else{let i=[];du(n.coordinates,i,r,!1),e.push(au(t,`MultiLineString`,i,a))}})(e,i,t.geometry,a,n,t.properties);return;case`Polygon`:(function(e,t,n,r,i){let a=[];du(n.coordinates,a,r,!0),e.push(au(t,`Polygon`,a,i))})(e,i,t.geometry,a,t.properties);return;case`MultiPolygon`:(function(e,t,n,r,i){let a=[];for(let e of n.coordinates){let t=[];du(e,t,r,!0),a.push(t)}e.push(au(t,`MultiPolygon`,a,i))})(e,i,t.geometry,a,t.properties);return;default:throw Error(`Input data is not a valid GeoJSON object.`)}}function uu(e,t,n,r){let i,a,o=0;for(let n=0;n<e.length;n++){let s=fu(e[n][0]),c=pu(e[n][1]);t.points.push(s,c,0),n>0&&(o+=r?(i*c-s*a)/2:Math.sqrt((s-i)**2+(c-a)**2)),i=s,a=c}let s=t.points.length-3;t.points[2]=1,n>0&&ru(t.points,0,s,n),t.points[s+2]=1,ou(t),t.size=Math.abs(o),t.start=0,t.end=t.size}function du(e,t,n,r){for(let i=0;i<e.length;i++){let a={points:[]};uu(e[i],a,n,r),t.push(a)}}function fu(e){return e/360+.5}function pu(e){let t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function mu(e){let t={type:`Feature`,geometry:hu(e),properties:e.tags};return e.id!=null&&(t.id=e.id),t}function hu(e){let{type:t,geometry:n}=e;switch(t){case`Point`:return{type:t,coordinates:_u(n[0],n[1])};case`MultiPoint`:return{type:t,coordinates:gu(n)};case`LineString`:return{type:t,coordinates:gu(n.points)};case`MultiLineString`:case`Polygon`:return{type:t,coordinates:n.map((e=>gu(e.points)))};case`MultiPolygon`:return{type:t,coordinates:n.map((e=>e.map((e=>gu(e.points)))))}}}function gu(e){let t=[];for(let n=0;n<e.length;n+=3)t.push(_u(e[n],e[n+1]));return t}function _u(e,t){return[vu(e),yu(t)]}function vu(e){return 360*(e-.5)}function yu(e){let t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}var bu;function xu(e,t,n,r,i,a,o,s){if(r/=t,a>=(n/=t)&&o<r)return e;if(o<n||a>=r)return null;let c=[];for(let t of e){let e=i===bu.X?t.minX:t.minY,a=i===bu.X?t.maxX:t.maxY;if(e>=n&&a<r)c.push(t);else if(!(a<n||e>=r))switch(t.type){case`Point`:case`MultiPoint`:Su(t,c,n,r,i);continue;case`LineString`:Cu(t,c,n,r,i,s);continue;case`MultiLineString`:wu(t,c,n,r,i);continue;case`Polygon`:Tu(t,c,n,r,i);continue;case`MultiPolygon`:Eu(t,c,n,r,i);continue}}return c.length?c:null}function Su(e,t,n,r,i){let a=[];(function(e,t,n,r,i){for(let a=0;a<e.length;a+=3){let o=e[a+i];o>=n&&o<=r&&Au(t,e[a],e[a+1],e[a+2])}})(e.geometry,a,n,r,i),a.length&&t.push(au(e.id,a.length===3?`Point`:`MultiPoint`,a,e.tags))}function Cu(e,t,n,r,i,a){let o=[];if(Du(e.geometry,o,n,r,i,!1,a.lineMetrics),o.length)if(a.lineMetrics)for(let n of o)t.push(au(e.id,`LineString`,n,e.tags));else t.push(o.length>1?au(e.id,`MultiLineString`,o,e.tags):au(e.id,`LineString`,o[0],e.tags))}function wu(e,t,n,r,i){let a=[];ku(e.geometry,a,n,r,i,!1),a.length&&t.push(a.length===1?au(e.id,`LineString`,a[0],e.tags):au(e.id,`MultiLineString`,a,e.tags))}function Tu(e,t,n,r,i){let a=[];ku(e.geometry,a,n,r,i,!0),a.length&&t.push(au(e.id,`Polygon`,a,e.tags))}function Eu(e,t,n,r,i){let a=[];for(let t of e.geometry){let e=[];ku(t,e,n,r,i,!0),e.length&&a.push(e)}a.length&&t.push(au(e.id,`MultiPolygon`,a,e.tags))}function Du(e,t,n,r,i,a,o){let s=Ou(e),c=i===bu.X?ju:Mu,l,u,d=e.start;for(let f=0;f<e.points.length-3;f+=3){let p=e.points[f],m=e.points[f+1],h=e.points[f+2],g=e.points[f+3],_=e.points[f+4],v=i===bu.X?p:m,y=i===bu.X?g:_,b=!1;o&&(l=Math.sqrt((p-g)**2+(m-_)**2)),v<n?y>n&&(u=c(s,p,m,g,_,n),o&&(s.start=d+l*u)):v>r?y<r&&(u=c(s,p,m,g,_,r),o&&(s.start=d+l*u)):Au(s.points,p,m,h),y<n&&v>=n&&(u=c(s,p,m,g,_,n),b=!0),y>r&&v<=r&&(u=c(s,p,m,g,_,r),b=!0),!a&&b&&(o&&(s.end=d+l*u),t.push(s),s=Ou(e)),o&&(d+=l)}let f=e.points.length-3,p=e.points[f],m=e.points[f+1],h=i===bu.X?p:m;h>=n&&h<=r&&Au(s.points,p,m,e.points[f+2]),f=s.points.length-3,a&&f>=3&&(s.points[f]!==s.points[0]||s.points[f+1]!==s.points[1])&&Au(s.points,s.points[0],s.points[1],s.points[2]),s.points.length&&(ou(s),t.push(s))}function Ou(e){return{points:[],size:e.size,start:e.start,end:e.end}}function ku(e,t,n,r,i,a){for(let o of e)Du(o,t,n,r,i,a,!1)}function Au(e,t,n,r){e.push(t,n,r)}function ju(e,t,n,r,i,a){let o=(a-t)/(r-t);return Au(e.points,a,n+(i-n)*o,1),o}function Mu(e,t,n,r,i,a){let o=(a-n)/(i-n);return Au(e.points,t+(r-t)*o,a,1),o}function Nu(e,t){let n=t.buffer/t.extent,r=e,i=xu(e,1,-1-n,n,bu.X,-1,2,t),a=xu(e,1,1-n,2+n,bu.X,-1,2,t);return i||a?(r=xu(e,1,-n,1+n,bu.X,-1,2,t)||[],i&&(r=Pu(i,1).concat(r)),a&&(r=r.concat(Pu(a,-1))),r):r}function Pu(e,t){let n=[];for(let r of e)switch(r.type){case`Point`:case`MultiPoint`:{let e=Fu(r.geometry,t);n.push(au(r.id,r.type,e,r.tags));continue}case`LineString`:{let e=Iu(r.geometry,t);n.push(au(r.id,r.type,e,r.tags));continue}case`MultiLineString`:case`Polygon`:{let e=[];for(let n of r.geometry)e.push(Iu(n,t));n.push(au(r.id,r.type,e,r.tags));continue}case`MultiPolygon`:{let e=[];for(let n of r.geometry){let r=[];for(let e of n)r.push(Iu(e,t));e.push(r)}n.push(au(r.id,r.type,e,r.tags));continue}}return n}function Fu(e,t){let n=[];for(let r=0;r<e.length;r+=3)n.push(e[r]+t,e[r+1],e[r+2]);return n}function Iu(e,t){let n={points:[],size:e.size};e.start!==void 0&&(n.start=e.start,n.end=e.end);for(let r=0;r<e.points.length;r+=3)n.points.push(e.points[r]+t,e.points[r+1],e.points[r+2]);return ou(n),n}function Lu(e,t,n){let r=!!t.newGeometry,i=t.removeAllProperties||t.removeProperties?.length>0||t.addOrUpdateProperties?.length>0;if(r){let r=e[0],a=cu({type:`FeatureCollection`,features:[{type:`Feature`,id:r.id,geometry:t.newGeometry,properties:i?Ru(r.tags,t):r.tags}]},n);return a=Nu(a,n),a}if(i){let n=[];for(let r of e){let e={...r};e.tags=Ru(e.tags,t),n.push(e)}return n}return e}function Ru(e,t){if(t.removeAllProperties)return{};let n={...e||{}};if(t.removeProperties)for(let e of t.removeProperties)delete n[e];if(t.addOrUpdateProperties)for(let{key:e,value:r}of t.addOrUpdateProperties)n[e]=r;return n}(function(e){e[e.X=0]=`X`,e[e.Y=1]=`Y`})(bu||={});let zu={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e};class Bu{constructor(e){this.options=Object.assign(Object.create(zu),e),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(e){let t=[];for(let n of e){if(!n.geometry)continue;let[e,r]=n.geometry.coordinates,[i,a]=[fu(e),pu(r)];t.push({id:n.id,type:`Point`,geometry:[i,a],tags:n.properties})}this.createIndex(t)}initialize(e){let t=[];for(let n of e)n.type===`Point`&&t.push(n);this.createIndex(t)}updateIndex(e,t,n){this.options=Object.assign(Object.create(zu),n.clusterOptions),this.initialize(e)}createIndex(e){let{log:t,minZoom:n,maxZoom:r}=this.options;t&&console.time(`total time`);let i=`prepare ${e.length} points`;t&&console.time(i),this.points=e;let a=[];for(let t=0;t<e.length;t++){let n=e[t];if(!n?.geometry)continue;let[r,i]=n.geometry;r=Math.fround(r),i=Math.fround(i),a.push(r,i,1/0,t,-1,1),this.options.reduce&&a.push(0)}let o=this.trees[r+1]=this.createTree(a);t&&console.timeEnd(i);for(let e=r;e>=n;e--){let n=Date.now();o=this.trees[e]=this.createTree(this.cluster(o,e)),t&&console.log(`z%d: %d clusters in %dms`,e,o.numItems,Date.now()-n)}t&&console.timeEnd(`total time`)}getClusters(e,t){return this.getClustersInternal(e,t).map((e=>mu(e)))}getClustersInternal(e,t){let n=((e[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,e[1])),i=e[2]===180?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,i=180;else if(n>i){let e=this.getClustersInternal([n,r,180,a],t),o=this.getClustersInternal([-180,r,i,a],t);return e.concat(o)}let o=this.trees[this.limitZoom(t)],s=o.range(fu(n),pu(a),fu(i),pu(r)),c=o.flatData,l=[];for(let e of s){let t=this.stride*e;l.push(c[t+5]>1?Vu(c,t,this.clusterProps):this.points[c[t+3]])}return l}getChildren(e){let t=this.getOriginId(e),n=this.getOriginZoom(e),r=Error(`No cluster with the specified id: `+e),i=this.trees[n];if(!i)throw r;let a=i.flatData;if(t*this.stride>=a.length)throw r;let o=this.options.radius/(this.options.extent*2**(n-1)),s=i.within(a[t*this.stride],a[t*this.stride+1],o),c=[];for(let t of s){let n=t*this.stride;a[n+4]===e&&c.push(a[n+5]>1?Hu(a,n,this.clusterProps):mu(this.points[a[n+3]]))}if(c.length===0)throw r;return c}getLeaves(e,t,n){let r=[];return this.appendLeaves(r,e,t||=10,n||=0,0),r}getTile(e,t,n){let r=this.trees[this.limitZoom(e)];if(!r)return null;let i=2**e,{extent:a,radius:o}=this.options,s=o/a,c=(n-s)/i,l=(n+1+s)/i,u={transformed:!0,features:[],source:null,x:t,y:n,z:e};return this.addTileFeatures(r.range((t-s)/i,c,(t+1+s)/i,l),r.flatData,t,n,i,u),t===0&&this.addTileFeatures(r.range(1-s/i,c,1,l),r.flatData,i,n,i,u),t===i-1&&this.addTileFeatures(r.range(0,c,s/i,l),r.flatData,-1,n,i,u),u}getClusterExpansionZoom(e){return this.getOriginZoom(e)}appendLeaves(e,t,n,r,i){let a=this.getChildren(t);for(let t of a){let a=t.properties;if(a?.cluster?i+a.point_count<=r?i+=a.point_count:i=this.appendLeaves(e,a.cluster_id,n,r,i):i<r?i++:e.push(t),e.length===n)break}return i}createTree(e){let t=new Zl(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let n=0;n<e.length;n+=this.stride)t.add(e[n],e[n+1]);return t.finish(),t.flatData=e,t.data=null,t}addTileFeatures(e,t,n,r,i,a){for(let o of e){let e=o*this.stride,s=t[e+5]>1,c,l,u;if(s)c=Uu(t,e,this.clusterProps),l=t[e],u=t[e+1];else{let n=this.points[t[e+3]];c=n.tags,[l,u]=n.geometry}let d={type:1,geometry:[[Math.round(this.options.extent*(l*i-n)),Math.round(this.options.extent*(u*i-r))]],tags:c},f;f=s||this.options.generateId?t[e+3]:this.points[t[e+3]].id,f!==void 0&&(d.id=f),a.features.push(d)}}limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}cluster(e,t){let{radius:n,extent:r,reduce:i,minPoints:a}=this.options,o=n/(r*2**t),s=e.flatData,c=[],l=this.stride;for(let n=0;n<s.length;n+=l){if(s[n+2]<=t)continue;s[n+2]=t;let r=s[n],u=s[n+1],d=e.within(s[n],s[n+1],o),f=s[n+5],p=f;for(let e of d){let n=e*l;s[n+2]>t&&(p+=s[n+5])}if(p>f&&p>=a){let e,a=r*f,o=u*f,m=-1,h=(n/l<<5)+(t+1)+this.points.length;for(let r of d){let c=r*l;if(s[c+2]<=t)continue;s[c+2]=t;let u=s[c+5];a+=s[c]*u,o+=s[c+1]*u,s[c+4]=h,i&&(e||(e=this.map(s,n,!0),m=this.clusterProps.length,this.clusterProps.push(e)),i(e,this.map(s,c)))}s[n+4]=h,c.push(a/p,o/p,1/0,h,-1,p),i&&c.push(m)}else{for(let e=0;e<l;e++)c.push(s[n+e]);if(p>1)for(let e of d){let n=e*l;if(!(s[n+2]<=t)){s[n+2]=t;for(let e=0;e<l;e++)c.push(s[n+e])}}}}return c}getOriginId(e){return e-this.points.length>>5}getOriginZoom(e){return(e-this.points.length)%32}map(e,t,n){if(e[t+5]>1){let r=this.clusterProps[e[t+6]];return n?Object.assign({},r):r}let r=this.points[e[t+3]].tags,i=this.options.map(r);return n&&i===r?Object.assign({},i):i}}function Vu(e,t,n){return{id:e[t+3],type:`Point`,tags:Uu(e,t,n),geometry:[e[t],e[t+1]]}}function Hu(e,t,n){return{type:`Feature`,id:e[t+3],properties:Uu(e,t,n),geometry:{type:`Point`,coordinates:[vu(e[t]),yu(e[t+1])]}}}function Uu(e,t,n){let r=e[t+5],i=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+`k`:r,a=e[t+6],o=a===-1?{}:Object.assign({},n[a]);return Object.assign(o,{cluster:!0,cluster_id:e[t+3],point_count:r,point_count_abbreviated:i})}let Wu=`geojsonvt_clip_start`,Gu=`geojsonvt_clip_end`;function Ku(e,t,n,r,i){let a=t===i.maxZoom?0:i.tolerance/((1<<t)*i.extent),o={transformed:!1,features:[],source:null,x:n,y:r,z:t,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:e.length};for(let t of e)qu(o,t,a,i);return o}function qu(e,t,n,r){switch(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),t.type){case`Point`:case`MultiPoint`:(function(e,t){let n=[];for(let r=0;r<t.geometry.length;r+=3)n.push(t.geometry[r],t.geometry[r+1]),e.numPoints++,e.numSimplified++;if(!n.length)return;let r={type:1,tags:t.tags||null,geometry:n};t.id!==null&&(r.id=t.id),e.features.push(r)})(e,t);return;case`LineString`:(function(e,t,n,r){let i=[];if(Ju(i,t.geometry,e,n,!1,!1),!i.length)return;let a=t.tags||null;if(r.lineMetrics){a={};for(let e in t.tags)a[e]=t.tags[e];a[Wu]=t.geometry.start/t.geometry.size,a[Gu]=t.geometry.end/t.geometry.size}let o={type:2,tags:a,geometry:i};t.id!==null&&(o.id=t.id),e.features.push(o)})(e,t,n,r);return;case`MultiLineString`:case`Polygon`:(function(e,t,n){let r=[];for(let i=0;i<t.geometry.length;i++)Ju(r,t.geometry[i],e,n,t.type===`Polygon`,i===0);if(!r.length)return;let i={type:t.type===`Polygon`?3:2,tags:t.tags||null,geometry:r};t.id!==null&&(i.id=t.id),e.features.push(i)})(e,t,n);return;case`MultiPolygon`:(function(e,t,n){let r=[];for(let i=0;i<t.geometry.length;i++){let a=t.geometry[i];for(let t=0;t<a.length;t++)Ju(r,a[t],e,n,!0,t===0)}if(!r.length)return;let i={type:3,tags:t.tags||null,geometry:r};t.id!==null&&(i.id=t.id),e.features.push(i)})(e,t,n);return}}function Ju(e,t,n,r,i,a){let o=r*r;if(r>0&&t.size<(i?o:r))return void(n.numPoints+=t.points.length/3);let s=[];for(let e=0;e<t.points.length;e+=3)(r===0||t.points[e+2]>o)&&(n.numSimplified++,s.push(t.points[e],t.points[e+1])),n.numPoints++;i&&function(e,t){let n=0;for(let t=0,r=e.length,i=r-2;t<r;i=t,t+=2)n+=(e[t]-e[i])*(e[t+1]+e[i+1]);if(n>0===t)for(let t=0,n=e.length;t<n/2;t+=2){let r=e[t],i=e[t+1];e[t]=e[n-2-t],e[t+1]=e[n-1-t],e[n-2-t]=r,e[n-1-t]=i}}(s,a),e.push(s)}function Yu(e,t){if(e.transformed)return e;let n=1<<e.z,r=e.x,i=e.y;for(let a of e.features)a.type===1?Xu(a,t,n,r,i):Zu(a,t,n,r,i);return e.transformed=!0,e}function Xu(e,t,n,r,i){let a=e,o=e.geometry,s=[];for(let e=0;e<o.length;e+=2)s.push(Qu(o[e],o[e+1],t,n,r,i));return a.geometry=s,a}function Zu(e,t,n,r,i){let a=e,o=e.geometry,s=[];for(let e of o){let a=[];for(let o=0;o<e.length;o+=2)a.push(Qu(e[o],e[o+1],t,n,r,i));s.push(a)}return a.geometry=s,a}function Qu(e,t,n,r,i,a){return[Math.round(n*(e*r-i)),Math.round(n*(t*r-a))]}class $u{constructor(e){this.options=e,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(e){this.splitTile(e,0,0,0),this.options.debug&&(e.length&&console.log(`features: %d, points: %d`,this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd(`generate tiles`),console.log(`tiles generated:`,this.total,JSON.stringify(this.stats)))}updateIndex(e,t,n){n.debug>1&&(console.log(`invalidating tiles`),console.time(`invalidating`)),this.invalidateTiles(t),n.debug>1&&console.timeEnd(`invalidating`);let[r,i,a]=[0,0,0],o=Ku(e,r,i,a,n);o.source=e;let s=ed(r,i,a);if(this.tiles[s]=o,this.tileCoords.push({z:r,x:i,y:a,id:s}),n.debug){let e=`z${r}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}}getClusterExpansionZoom(e){return null}getChildren(e){return null}getLeaves(e,t,n){return null}getTile(e,t,n){let{extent:r,debug:i}=this.options,a=1<<e,o=ed(e,t=t+a&a-1,n);if(this.tiles[o])return Yu(this.tiles[o],r);i>1&&console.log(`drilling down to z%d-%d-%d`,e,t,n);let s,c=e,l=t,u=n;for(;!s&&c>0;)c--,l>>=1,u>>=1,s=this.tiles[ed(c,l,u)];return s?.source?(i>1&&(console.log(`found parent tile z%d-%d-%d`,c,l,u),console.time(`drilling down`)),this.splitTile(s.source,c,l,u,e,t,n),i>1&&console.timeEnd(`drilling down`),this.tiles[o]?Yu(this.tiles[o],r):null):null}splitTile(e,t,n,r,i,a,o){let s=[e,t,n,r],c=this.options,l=c.debug;for(;s.length;){r=s.pop(),n=s.pop(),t=s.pop(),e=s.pop();let u=1<<t,d=ed(t,n,r),f=this.tiles[d];if(!f&&(l>1&&console.time(`creation`),f=this.tiles[d]=Ku(e,t,n,r,c),this.tileCoords.push({z:t,x:n,y:r,id:d}),l)){l>1&&(console.log(`tile z%d-%d-%d (features: %d, points: %d, simplified: %d)`,t,n,r,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd(`creation`));let e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(f.source=e,i==null){if(t===c.indexMaxZoom||f.numPoints<=c.indexMaxPoints)continue}else{if(t===c.maxZoom||t===i)continue;if(i!=null){let e=i-t;if(n!==a>>e||r!==o>>e)continue}}if(f.source=null,!e.length)continue;l>1&&console.time(`clipping`);let p=.5*c.buffer/c.extent,m=.5-p,h=.5+p,g=1+p,_=null,v=null,y=null,b=null,x=xu(e,u,n-p,n+h,bu.X,f.minX,f.maxX,c),S=xu(e,u,n+m,n+g,bu.X,f.minX,f.maxX,c);x&&(_=xu(x,u,r-p,r+h,bu.Y,f.minY,f.maxY,c),v=xu(x,u,r+m,r+g,bu.Y,f.minY,f.maxY,c)),S&&(y=xu(S,u,r-p,r+h,bu.Y,f.minY,f.maxY,c),b=xu(S,u,r+m,r+g,bu.Y,f.minY,f.maxY,c)),l>1&&console.timeEnd(`clipping`),s.push(_||[],t+1,2*n,2*r),s.push(v||[],t+1,2*n,2*r+1),s.push(y||[],t+1,2*n+1,2*r),s.push(b||[],t+1,2*n+1,2*r+1)}}invalidateTiles(e){if(!e.length)return;let t=this.options,{debug:n}=t,r=1/0,i=-1/0,a=1/0,o=-1/0;for(let t of e)r=Math.min(r,t.minX),i=Math.max(i,t.maxX),a=Math.min(a,t.minY),o=Math.max(o,t.maxY);let s=t.buffer/t.extent,c=new Set;for(let t in this.tiles){let l=this.tiles[t],u=1<<l.z,d=(l.x-s)/u,f=(l.x+1+s)/u,p=(l.y-s)/u,m=(l.y+1+s)/u;if(i<d||r>=f||o<p||a>=m)continue;let h=!1;for(let t of e)if(t.maxX>=d&&t.minX<f&&t.maxY>=p&&t.minY<m){h=!0;break}if(h){if(n){n>1&&console.log(`invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)`,l.z,l.x,l.y,l.numFeatures,l.numPoints,l.numSimplified);let e=`z${l.z}`;this.stats[e]=(this.stats[e]||0)-1,this.total--}delete this.tiles[t],c.add(t)}}c.size&&(this.tileCoords=this.tileCoords.filter((e=>!c.has(e.id))))}}function ed(e,t,n){return 32*((1<<e)*n+t)+e}let td={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:zu,debug:0},{members:nd}=oo([{name:`a_pos_normal`,components:2,type:`Int16`},{name:`a_data`,components:4,type:`Uint8`}],4),{members:rd}=oo([{name:`a_uv_x`,components:1,type:`Float32`},{name:`a_split_index`,components:1,type:`Float32`}]),id=Math.cos(Math.PI/180*37.5),ad=2**14/.5;class od{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let e of this.layers)this.gradients[e.id]={};this.layoutVertexArray=new Yo,this.layoutVertexArray2=new Xo,this.indexArray=new is,this.programConfigurations=new Is(e.layers,e.zoom),this.segments=new ss,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){this.hasDependencies=Bc(`line`,this.layers,t)||this.hasLineDasharray(this.layers);let r=this.layers[0].layout.get(`line-sort-key`),i=!r.isConstant(),a=[];for(let{feature:t,id:o,index:s,sourceLayerIndex:c}of e){let e=this.layers[0]._featureFilter.needGeometry,l=Hs(t,e);if(!this.layers[0]._featureFilter.filter(new Y(this.zoom),l,n))continue;let u=i?r.evaluate(l,{},n):void 0,d={id:o,properties:t.properties,type:t.type,sourceLayerIndex:c,index:s,geometry:e?l.geometry:Vs(t),patterns:{},dashes:{},sortKey:u};a.push(d)}i&&a.sort(((e,t)=>e.sortKey-t.sortKey));for(let r of a){let{geometry:i,index:a,sourceLayerIndex:o}=r;this.hasDependencies?(Bc(`line`,this.layers,t)?Vc(`line`,this.layers,r,{zoom:this.zoom},t):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,r,this.zoom,t),this.patternFeatures.push(r)):this.addFeature(r,i,a,n,{},{},t.subdivisionGranularity),t.featureIndex.insert(e[a].feature,i,a,o,this.index)}}update(e,t,n,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:n,dashPositions:r})}addFeatures(e,t,n,r){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,t,n,r,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,rd)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,nd),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.hasOwn(e.properties,Wu)&&Object.hasOwn(e.properties,Gu))return{start:+e.properties[Wu],end:+e.properties[Gu]}}addFeature(e,t,n,r,i,a,o){let s=this.layers[0].layout,c=s.get(`line-join`).evaluate(e,{}),l=s.get(`line-cap`).evaluate(e,{}),u=s.get(`line-miter-limit`).evaluate(e,{}),d=s.get(`line-round-limit`).evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(let n of t)this.addLine(n,e,c,l,u,d,r,o);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{imagePositions:i,dashPositions:a,canonical:r})}addLine(e,t,n,r,i,a,o,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=yl(e,o?s.line.getGranularityForZoomLevel(o.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let c=jl.types[t.type]===`Polygon`,l=e.length;for(;l>=2&&e[l-1].equals(e[l-2]);)l--;let u=0;for(;u<l-1&&e[u].equals(e[u+1]);)u++;if(l<(c?3:2))return;n===`bevel`&&(i=1.05);let d=this.overscaling<=16?122880/(512*this.overscaling):0,f=this.segments.prepareSegment(10*l,this.layoutVertexArray,this.indexArray),p,m,h,g,_;this.e1=this.e2=-1,c&&(p=e[l-2],_=e[u].sub(p)._unit()._perp());for(let t=u;t<l;t++){if(h=t===l-1?c?e[u+1]:void 0:e[t+1],h&&e[t].equals(h))continue;_&&(g=_),p&&(m=p),p=e[t],_=h?h.sub(p)._unit()._perp():g,g||=_;let o=g.add(_);o.x===0&&o.y===0||o._unit();let s=g.x*_.x+g.y*_.y,v=o.x*_.x+o.y*_.y,y=v===0?1/0:1/v,b=2*Math.sqrt(2-2*v),x=v<id&&m&&h,S=g.x*_.y-g.y*_.x>0;if(x&&t>u){let e=p.dist(m);if(e>2*d){let t=p.sub(p.sub(m)._mult(d/e)._round());this.updateDistance(m,t),this.addCurrentVertex(t,g,0,0,f),m=t}}let C=m&&h,w=C?n:c?`butt`:r;if(C&&w===`round`&&(y<a?w=`miter`:y<=2&&(w=`fakeround`)),w===`miter`&&y>i&&(w=`bevel`),w===`bevel`&&(y>2&&(w=`flipbevel`),y<i&&(w=`miter`)),m&&this.updateDistance(m,p),w===`miter`)o._mult(y),this.addCurrentVertex(p,o,0,0,f);else if(w===`flipbevel`){if(y>100)o=_.mult(-1);else{let e=y*g.add(_).mag()/g.sub(_).mag();o._perp()._mult(e*(S?-1:1))}this.addCurrentVertex(p,o,0,0,f),this.addCurrentVertex(p,o.mult(-1),0,0,f)}else if(w===`bevel`||w===`fakeround`){let e=-Math.sqrt(y*y-1),t=S?e:0,n=S?0:e;if(m&&this.addCurrentVertex(p,g,t,n,f),w===`fakeround`){let e=Math.round(180*b/Math.PI/20);for(let t=1;t<e;t++){let n=t/e;if(n!==.5){let e=n-.5;n+=n*e*(n-1)*((1.0904+s*(s*(3.55645-1.43519*s)-3.2452))*e*e+(.848013+s*(.215638*s-1.06021)))}let r=_.sub(g)._mult(n)._add(g)._unit()._mult(S?-1:1);this.addHalfVertex(p,r.x,r.y,!1,S,0,f)}}h&&this.addCurrentVertex(p,_,-t,-n,f)}else if(w===`butt`)this.addCurrentVertex(p,o,0,0,f);else if(w===`square`){let e=m?1:-1;this.addCurrentVertex(p,o,e,e,f)}else w===`round`&&(m&&(this.addCurrentVertex(p,g,0,0,f),this.addCurrentVertex(p,g,1,1,f,!0)),h&&(this.addCurrentVertex(p,_,-1,-1,f,!0),this.addCurrentVertex(p,_,0,0,f)));if(x&&t<l-1){let e=p.dist(h);if(e>2*d){let t=p.add(h.sub(p)._mult(d/e)._round());this.updateDistance(p,t),this.addCurrentVertex(t,_,0,0,f),p=t}}}}addCurrentVertex(e,t,n,r,i,a=!1){let o=t.y*r-t.x,s=-t.y-t.x*r;this.addHalfVertex(e,t.x+t.y*n,t.y-t.x*n,a,!1,n,i),this.addHalfVertex(e,o,s,a,!0,-r,i),this.distance>ad/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,n,r,i,a))}addHalfVertex({x:e,y:t},n,r,i,a,o,s){let c=.5*(this.lineClips?this.scaledDistance*(ad-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+ +!!i,(t<<1)+ +!!a,Math.round(63*n)+128,Math.round(63*r)+128,1+(o===0?0:o<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=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,l,this.e2),s.primitiveLength++),a?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(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}hasLineDasharray(e){for(let t of e){let e=t.paint.get(`line-dasharray`);if(e&&!e.isConstant())return!0}return!1}addLineDashDependencies(e,t,n,r){for(let i of e){let e=i.paint.get(`line-dasharray`);if(!e||e.value.kind===`constant`)continue;let a=i.layout.get(`line-cap`).evaluate(t,{})===`round`,o={dasharray:e.value.evaluate({zoom:n-1},t,{}),round:a},s={dasharray:e.value.evaluate({zoom:n},t,{}),round:a},c={dasharray:e.value.evaluate({zoom:n+1},t,{}),round:a},l=`${o.dasharray.join(`,`)},${o.round}`,u=`${s.dasharray.join(`,`)},${s.round}`,d=`${c.dasharray.join(`,`)},${c.round}`;r.dashDependencies[l]=o,r.dashDependencies[u]=s,r.dashDependencies[d]=c,t.dashes[i.id]={min:l,mid:u,max:d}}}}let sd,cd;J(`LineBucket`,od,{omit:[`layers`,`patternFeatures`]});var ld={get paint(){return cd||=new Xa({"line-opacity":new Z(N.paint_line[`line-opacity`]),"line-color":new Z(N.paint_line[`line-color`]),"line-translate":new X(N.paint_line[`line-translate`]),"line-translate-anchor":new X(N.paint_line[`line-translate-anchor`]),"line-width":new Z(N.paint_line[`line-width`]),"line-gap-width":new Z(N.paint_line[`line-gap-width`]),"line-offset":new Z(N.paint_line[`line-offset`]),"line-blur":new Z(N.paint_line[`line-blur`]),"line-dasharray":new qa(N.paint_line[`line-dasharray`]),"line-pattern":new qa(N.paint_line[`line-pattern`]),"line-gradient":new Ya(N.paint_line[`line-gradient`])})},get layout(){return sd||=new Xa({"line-cap":new Z(N.layout_line[`line-cap`]),"line-join":new Z(N.layout_line[`line-join`]),"line-miter-limit":new Z(N.layout_line[`line-miter-limit`]),"line-round-limit":new Z(N.layout_line[`line-round-limit`]),"line-sort-key":new Z(N.layout_line[`line-sort-key`])})}};class ud extends Z{possiblyEvaluate(e,t){return t=new Y(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,n,r){return t=oe({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,n,r)}}let dd;class fd extends $a{constructor(e,t){super(e,ld,t),this.gradientVersion=0,dd||(dd=new ud(ld.paint.properties[`line-width`].specification),dd.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e===`line-gradient`){let e=this.gradientExpression();this.stepInterpolant=!!function(e){return e._styleExpression!==void 0}(e)&&e._styleExpression.expression instanceof gn,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values[`line-gradient`].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values[`line-floorwidth`]=dd.possiblyEvaluate(this._transitioningPaint._values[`line-width`].value,e)}createBucket(e){return new od(e)}queryRadius(e){let t=e,n=pd(rc(`line-width`,this,t),rc(`line-gap-width`,this,t)),r=rc(`line-offset`,this,t);return n/2+Math.abs(r)+ic(this.paint.get(`line-translate`))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:a,pixelsToTileUnits:o}){let s=ac(e,this.paint.get(`line-translate`),this.paint.get(`line-translate-anchor`),-a.bearingInRadians,o),c=o/2*pd(this.paint.get(`line-width`).evaluate(t,r),this.paint.get(`line-gap-width`).evaluate(t,r)),l=this.paint.get(`line-offset`).evaluate(t,r);return l&&(i=function(e,t){let r=[];for(let i of e){let e=oc(i),a=[];for(let r=0;r<e.length;r++){let i=e[r],o=e[r-1],s=e[r+1],c=r===0?new n(0,0):i.sub(o)._unit()._perp(),l=r===e.length-1?new n(0,0):s.sub(i)._unit()._perp(),u=c._add(l)._unit(),d=u.x*l.x+u.y*l.y;d!==0&&u._mult(1/d),a.push(u._mult(t)._add(i))}r.push(a)}return r}(i,l*o)),function(e,t,n){for(let r of t){if(e.length>=3){for(let t of r)if(tc(e,t))return!0}if(Ys(e,r,n))return!0}return!1}(s,i,c)}isTileClipped(){return!0}}function pd(e,t){return t>0?t+2*e:e}let md=oo([{name:`a_pos_offset`,components:4,type:`Int16`},{name:`a_data`,components:4,type:`Uint16`},{name:`a_pixeloffset`,components:4,type:`Int16`}],4),hd=oo([{name:`a_projected_pos`,components:3,type:`Float32`}],4);oo([{name:`a_fade_opacity`,components:1,type:`Uint32`}],4);let gd=oo([{name:`a_placed`,components:2,type:`Uint8`},{name:`a_shift`,components:2,type:`Float32`},{name:`a_box_real`,components:2,type:`Int16`}]);oo([{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 _d=oo([{name:`a_pos`,components:2,type:`Int16`},{name:`a_anchor_pos`,components:2,type:`Int16`},{name:`a_extrude`,components:2,type:`Int16`}],4),vd=oo([{name:`a_pos`,components:2,type:`Float32`},{name:`a_radius`,components:1,type:`Float32`},{name:`a_flags`,components:2,type:`Int16`}],4);function yd(e,t,n){let r=t.layout.get(`text-transform`).evaluate(n,{});return r===`uppercase`?e=e.toLocaleUpperCase():r===`lowercase`&&(e=e.toLocaleLowerCase()),Ia.applyArabicShaping&&(e=Ia.applyArabicShaping(e)),e}function bd(e,t,n){for(let r of e.sections)r.text=yd(r.text,t,n);return e}oo([{name:`triangle`,components:3,type:`Uint16`}]),oo([{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`}]),oo([{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`}]),oo([{type:`Float32`,name:`offsetX`}]),oo([{type:`Int16`,name:`x`},{type:`Int16`,name:`y`},{type:`Int16`,name:`tileUnitDistanceFromAnchor`}]),oo([{type:`Uint16`,name:`textAnchor`},{type:`Float32`,components:2,name:`textOffset`}]);var xd=24;let Sd={"!":`︕`,"#":`#`,$:`$`,"%":`%`,"&":`&`,"(":`︵`,")":`︶`,"*":`*`,"+":`+`,",":`︐`,"-":`︲`,".":`・`,"/":`/`,":":`︓`,";":`︔`,"<":`︿`,"=":`=`,">":`﹀`,"?":`︖`,"@":`@`,"[":`﹇`,"\\":`\`,"]":`﹈`,"^":`^`,_:`︳`,"`":```,"{":`︷`,"|":`―`,"}":`︸`,"~":`~`,"¢":`¢`,"£":`£`,"¥":`¥`,"¦":`¦`,"¬":`¬`,"¯":` ̄`,"–":`︲`,"—":`︱`,"‘":`﹃`,"’":`﹄`,"“":`﹁`,"”":`﹂`,"…":`︙`,"⋯":`︙`,"‧":`・`,"₩":`₩`,"、":`︑`,"。":`︒`,"〈":`︿`,"〉":`﹀`,"《":`︽`,"》":`︾`,"「":`﹁`,"」":`﹂`,"『":`﹃`,"』":`﹄`,"【":`︻`,"】":`︼`,"〔":`︹`,"〕":`︺`,"〖":`︗`,"〗":`︘`,"!":`︕`,"(":`︵`,")":`︶`,",":`︐`,"-":`︲`,".":`・`,":":`︓`,";":`︔`,"<":`︿`,">":`﹀`,"?":`︖`,"[":`﹇`,"]":`﹈`,"_":`︳`,"{":`︷`,"|":`―`,"}":`︸`,"⦅":`︵`,"⦆":`︶`,"。":`︒`,"「":`﹁`,"」":`﹂`},Cd={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},wd={40:!0};function Td(e,t,n,r,i,a){if(`fontStack`in t){let r=n[t.fontStack]?.[e];return r?r.metrics.advance*t.scale+i:0}{let e=r[t.imageName];return e?e.displaySize[0]*t.scale*xd/a+i:0}}function Ed(e,t,n,r){let i=(e-t)**2;return r?e<t?i/2:2*i:i+Math.abs(n)*n}function Dd(e,t,n){let r=0;return e===10&&(r-=1e4),n&&(r+=150),e!==40&&e!==65288||(r+=50),t!==41&&t!==65289||(r+=50),r}function Od(e,t,n,r,i,a){let o=null,s=Ed(t,n,i,a);for(let e of r){let r=Ed(t-e.x,n,i,a)+e.badness;r<=s&&(o=e,s=r)}return{index:e,x:t,priorBreak:o,badness:s}}function kd(e){return e?kd(e.priorBreak).concat(e.index):[]}class Ad{constructor(e=``,t=[],n=[]){this.text=e,this.sections=t,this.sectionIndex=n,this.imageSectionID=null}static fromFeature(e,t){let n=new Ad;for(let r of e.sections)r.image?n.addImageSection(r):n.addTextSection(r,t);return n}length(){return[...this.text].length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=function(e){let t=``,n={premature:!0,value:void 0},r=e[Symbol.iterator](),i=r.next(),a=e[Symbol.iterator]();a.next();let o=a.next();for(;!i.done;)t+=!o.done&&ja(o.value.codePointAt(0))&&!Sd[o.value]||!n.premature&&ja(n.value.codePointAt(0))&&!Sd[n.value]||!Sd[i.value]?i.value:Sd[i.value],n={value:i.value,premature:!1},i=r.next(),o=a.next();return t}(this.text)}hasZeroWidthSpaces(){return this.text.includes(`​`)}trim(){let e=this.text.match(/^\s*/),t=e?e[0].length:0,n=this.text.match(/\S\s*$/),r=n?n[0].length-1:0;this.text=this.text.substring(t,this.text.length-r),this.sectionIndex=this.sectionIndex.slice(t,this.sectionIndex.length-r)}substring(e,t){let n=[...this.text].slice(e,t).join(``),r=this.sectionIndex.slice(e,t);return new Ad(n,this.sections,r)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join(``).length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,t)=>Math.max(e,this.sections[t].scale)),0)}getMaxImageSize(e){let t=0,n=0;for(let r=0;r<this.length();r++){let i=this.getSection(r);if(`imageName`in i){let r=e[i.imageName];if(!r)continue;let a=r.displaySize;t=Math.max(t,a[0]),n=Math.max(n,a[1])}}return{maxImageWidth:t,maxImageHeight:n}}addTextSection(e,t){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||`bottom`,fontStack:e.fontStack||t});let n=this.sections.length-1;this.sectionIndex.push(...[...e.text].map((()=>n)))}addImageSection(e){let t=e.image?e.image.name:``;if(t.length===0)return void de(`Can't add FormattedSection with an empty image.`);let n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCharCode(n),this.sections.push({scale:1,verticalAlign:e.verticalAlign||`bottom`,imageName:t}),this.sectionIndex.push(this.sections.length-1)):de(`Reached maximum number of images 6401`)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,t,n,r,i){let a=[],o=this.determineAverageLineWidth(e,t,n,r,i),s=this.hasZeroWidthSpaces(),c=0,l=0,u=this.text[Symbol.iterator](),d=u.next(),f=this.text[Symbol.iterator]();f.next();let p=f.next(),m=this.text[Symbol.iterator]();m.next(),m.next();let h=m.next();for(;!d.done;){let t=this.getSection(l),g=d.value.codePointAt(0);if(Ta(g)||(c+=Td(g,t,n,r,e,i)),!p.done){let e=Ca(g),n=p.value.codePointAt(0);(Cd[g]||e||`imageName`in t||!h.done&&wd[n])&&a.push(Od(l+1,c,o,a,Dd(g,n,e&&s),!1))}l++,d=u.next(),p=f.next(),h=m.next()}return kd(Od(this.length(),c,o,a,0,!0))}determineAverageLineWidth(e,t,n,r,i){let a=0,o=0;for(let t of this.text){let s=this.getSection(o);a+=Td(t.codePointAt(0),s,n,r,e,i),o++}return a/Math.max(1,Math.ceil(a/t))}}let jd=4294967296,Md=1/jd,Nd=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`);class Pd{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,n=this.length){for(;this.pos<n;){let n=this.readVarint(),r=n>>3,i=this.pos;this.type=7&n,e(r,t,this),this.pos===i&&this.skip(n)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){let e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){let e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*jd;return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*jd;return this.pos+=8,e}readFloat(){let e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){let e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){let t=this.buf,n,r;return r=t[this.pos++],n=127&r,r<128?n:(r=t[this.pos++],n|=(127&r)<<7,r<128?n:(r=t[this.pos++],n|=(127&r)<<14,r<128?n:(r=t[this.pos++],n|=(127&r)<<21,r<128?n:(r=t[this.pos],n|=(15&r)<<28,function(e,t,n){let r=n.buf,i,a;if(a=r[n.pos++],i=(112&a)>>4,a<128||(a=r[n.pos++],i|=(127&a)<<3,a<128)||(a=r[n.pos++],i|=(127&a)<<10,a<128)||(a=r[n.pos++],i|=(127&a)<<17,a<128)||(a=r[n.pos++],i|=(127&a)<<24,a<128)||(a=r[n.pos++],i|=(1&a)<<31,a<128))return Fd(e,i,t);throw Error(`Expected varint not more than 10 bytes`)}(n,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){let e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){let e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&Nd?Nd.decode(this.buf.subarray(t,e)):function(e,t,n){let r=``,i=t;for(;i<n;){let t=e[i],a,o,s,c=null,l=t>239?4:t>223?3:t>191?2:1;if(i+l>n)break;l===1?t<128&&(c=t):l===2?(a=e[i+1],(192&a)==128&&(c=(31&t)<<6|63&a,c<=127&&(c=null))):l===3?(a=e[i+1],o=e[i+2],(192&a)==128&&(192&o)==128&&(c=(15&t)<<12|(63&a)<<6|63&o,(c<=2047||c>=55296&&c<=57343)&&(c=null))):l===4&&(a=e[i+1],o=e[i+2],s=e[i+3],(192&a)==128&&(192&o)==128&&(192&s)==128&&(c=(15&t)<<18|(63&a)<<12|(63&o)<<6|63&s,(c<=65535||c>=1114112)&&(c=null))),c===null?(c=65533,l=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),i+=l}return r}(this.buf,t,e)}readBytes(){let e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(e){let t=7&e;if(t===0)for(;this.buf[this.pos++]>127;);else if(t===2)this.pos=this.readVarint()+this.pos;else if(t===5)this.pos+=4;else{if(t!==1)throw Error(`Unimplemented type: ${t}`);this.pos+=8}}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){let e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.dataView=new DataView(e.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Md),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Md),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?function(e,t){let n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(n=~(-e%4294967296),r=~(-e/4294967296),4294967295^n?n=n+1|0:(n=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw Error(`Given varint doesn't fit into 10 bytes`);t.realloc(10),function(e,t,n){n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,n.buf[n.pos]=127&(e>>>=7)}(n,0,t),function(e,t){let n=(7&e)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;let t=this.pos;this.pos=function(e,t,n){for(let r,i,a=0;a<t.length;a++){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!i){r>56319||a+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=r;continue}if(r<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&=(e[n++]=239,e[n++]=191,e[n++]=189,null);r<128?e[n++]=r:(r<2048?e[n++]=r>>6|192:(r<65536?e[n++]=r>>12|224:(e[n++]=r>>18|240,e[n++]=r>>12&63|128),e[n++]=r>>6&63|128),e[n++]=63&r|128)}return n}(this.buf,e,this.pos);let n=this.pos-t;n>=128&&Id(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){let t=e.length;this.writeVarint(t),this.realloc(t);for(let n=0;n<t;n++)this.buf[this.pos++]=e[n]}writeRawMessage(e,t){this.pos++;let n=this.pos;e(t,this);let r=this.pos-n;r>=128&&Id(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r}writeMessage(e,t,n){this.writeTag(e,2),this.writeRawMessage(t,n)}writePackedVarint(e,t){t.length&&this.writeMessage(e,Ld,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,Rd,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,Vd,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,zd,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,Bd,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,Hd,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,Ud,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,Wd,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,Gd,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function Fd(e,t,n){return n?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function Id(e,t,n){let r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));n.realloc(r);for(let t=n.pos-1;t>=e;t--)n.buf[t+r]=n.buf[t]}function Ld(e,t){for(let n=0;n<e.length;n++)t.writeVarint(e[n])}function Rd(e,t){for(let n=0;n<e.length;n++)t.writeSVarint(e[n])}function zd(e,t){for(let n=0;n<e.length;n++)t.writeFloat(e[n])}function Bd(e,t){for(let n=0;n<e.length;n++)t.writeDouble(e[n])}function Vd(e,t){for(let n=0;n<e.length;n++)t.writeBoolean(e[n])}function Hd(e,t){for(let n=0;n<e.length;n++)t.writeFixed32(e[n])}function Ud(e,t){for(let n=0;n<e.length;n++)t.writeSFixed32(e[n])}function Wd(e,t){for(let n=0;n<e.length;n++)t.writeFixed64(e[n])}function Gd(e,t){for(let n=0;n<e.length;n++)t.writeSFixed64(e[n])}function Kd(e,t,n){e===1&&n.readMessage(qd,t)}function qd(e,t,n){if(e===3){let{id:e,bitmap:r,width:i,height:a,left:o,top:s,advance:c}=n.readMessage(Jd,{});t.push({id:e,bitmap:new Cc({width:i+6,height:a+6},r),metrics:{width:i,height:a,left:o,top:s,advance:c}})}}function Jd(e,t,n){e===1?t.id=n.readVarint():e===2?t.bitmap=n.readBytes():e===3?t.width=n.readVarint():e===4?t.height=n.readVarint():e===5?t.left=n.readSVarint():e===6?t.top=n.readSVarint():e===7&&(t.advance=n.readVarint())}function Yd(e){let t=0,n=0;for(let r of e)t+=r.w*r.h,n=Math.max(n,r.w);e.sort(((e,t)=>t.h-e.h));let r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),n),h:1/0}],i=0,a=0;for(let t of e)for(let e=r.length-1;e>=0;e--){let n=r[e];if(!(t.w>n.w||t.h>n.h)){if(t.x=n.x,t.y=n.y,a=Math.max(a,t.y+t.h),i=Math.max(i,t.x+t.w),t.w===n.w&&t.h===n.h){let t=r.pop();t&&e<r.length&&(r[e]=t)}else t.h===n.h?(n.x+=t.w,n.w-=t.w):t.w===n.w?(n.y+=t.h,n.h-=t.h):(r.push({x:n.x+t.w,y:n.y,w:n.w-t.w,h:t.h}),n.y+=t.h,n.h-=t.h);break}}return{w:i,h:a,fill:t/(i*a)||0}}class Xd{constructor(e,{pixelRatio:t,version:n,stretchX:r,stretchY:i,content:a,textFitWidth:o,textFitHeight:s}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=r,this.stretchY=i,this.content=a,this.version=n,this.textFitWidth=o,this.textFitHeight=s}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]}}class Zd{constructor(e,t){let n={},r={};this.haveRenderCallbacks=[];let i=[];this.addImages(e,n,i),this.addImages(t,r,i);let{w:a,h:o}=Yd(i),s=new wc({width:a||1,height:o||1});for(let t in e){let r=e[t],i=n[t].paddedRect;wc.copy(r.data,s,{x:0,y:0},{x:i.x+1,y:i.y+1},r.data)}for(let e in t){let n=t[e],i=r[e].paddedRect,a=i.x+1,o=i.y+1,c=n.data.width,l=n.data.height;wc.copy(n.data,s,{x:0,y:0},{x:a,y:o},n.data),wc.copy(n.data,s,{x:0,y:l-1},{x:a,y:o-1},{width:c,height:1}),wc.copy(n.data,s,{x:0,y:0},{x:a,y:o+l},{width:c,height:1}),wc.copy(n.data,s,{x:c-1,y:0},{x:a-1,y:o},{width:1,height:l}),wc.copy(n.data,s,{x:0,y:0},{x:a+c,y:o},{width:1,height:l})}this.image=s,this.iconPositions=n,this.patternPositions=r}addImages(e,t,n){for(let r in e){let i=e[r],a={x:0,y:0,w:i.data.width+2,h:i.data.height+2};n.push(a),t[r]=new Xd(a,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),t),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),t)}patchUpdatedImage(e,t,n){if(!e||!t||e.version===t.version)return;e.version=t.version;let[r,i]=e.tl;n.update(t.data,void 0,{x:r,y:i})}}var Qd;function $d(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=Ad.fromFeature(t,a),_;f===e.ax.vertical&&g.verticalizePunctuation();let v=g.determineLineBreaks(u,o,n,i,m),{processBidirectionalText:y,processStyledBidirectionalText:b}=Ia;if(y&&g.sections.length===1){_=[],v=v.map((e=>g.toCodeUnitIndex(e)));let e=y(g.toString(),v);for(let t of e){let e=[...t].map((()=>0));_.push(new Ad(t,g.sections,e))}}else if(b){_=[],v=v.map((e=>g.toCodeUnitIndex(e)));let e=0,t=[];for(let n of g.text)t.push(...Array(n.length).fill(g.sectionIndex[e])),e++;let n=b(g.text,t,v);for(let e of n){let t=[],n=``;for(let r of e[0])t.push(e[1][n.length]),n+=r;_.push(new Ad(e[0],g.sections,t))}}else _=function(e,t){let n=[],r=0;for(let i of t)n.push(e.substring(r,i)),r=i;return r<e.length()&&n.push(e.substring(r,e.length())),n}(g,v);let x=[],S={positionedLines:x,text:g.toString(),top:d[1],bottom:d[1],left:d[0],right:d[0],writingMode:f,iconsInText:!1,verticalizable:!1};return function(e,t,n,r,i,a,o,s,c,l,u,d){let f=0,p=0,m=0,h=0,g=s===`right`?1:s===`left`?0:.5,_=xd/d,v=0;for(let o of i){o.trim();let i=o.getMaxScale(),s={positionedGlyphs:[],lineOffset:0};e.positionedLines[v]=s;let d=s.positionedGlyphs,y=0;if(!o.length()){p+=a,++v;continue}let b=tf(r,o,_),x=0;for(let a of o.text){let s=o.getSection(x),m=a.codePointAt(0),h=rf(c,u,m),g={glyph:m,imageName:null,x:f,y:p+-17,vertical:h,scale:1,fontStack:``,sectionIndex:o.getSectionIndex(x),metrics:null,rect:null},v;if(`fontStack`in s){if(v=af(s,m,h,b,t,n),!v)continue;g.fontStack=s.fontStack}else{if(e.iconsInText=!0,s.scale*=_,v=of(s,h,i,b,r),!v)continue;y=Math.max(y,v.imageOffset),g.imageName=s.imageName}let{rect:S,metrics:C,baselineOffset:w}=v;g.y+=w,g.scale=s.scale,g.metrics=C,g.rect=S,d.push(g),h?(e.verticalizable=!0,f+=(`imageName`in s?C.advance:xd)*s.scale+l):f+=C.advance*s.scale+l,x++}d.length!==0&&(m=Math.max(f-l,m),sf(d,0,d.length-1,g)),f=0,s.lineOffset=Math.max(y,(i-1)*xd);let S=a*i+y;p+=S,h=Math.max(S,h),++v}let{horizontalAlign:y,verticalAlign:b}=ef(o);(function(e,t,n,r,i,a,o,s,c){let l=(t-n)*i,u=0;u=a===o?-r*c*o+.5*o:-s*r- -17;for(let t of e)for(let e of t.positionedGlyphs)e.x+=l,e.y+=u})(e.positionedLines,g,y,b,m,h,a,p,i.length),e.top+=-b*p,e.bottom=e.top+p,e.left+=-y*m,e.right=e.left+m}(S,n,r,i,_,s,c,l,f,u,p,h),!function(e){for(let t of e)if(t.positionedGlyphs.length!==0)return!1;return!0}(x)&&S}function ef(e){let t=.5,n=.5;switch(e){case`right`:case`top-right`:case`bottom-right`:t=1;break;case`left`:case`top-left`:case`bottom-left`:t=0}switch(e){case`bottom`:case`bottom-right`:case`bottom-left`:n=1;break;case`top`:case`top-right`:case`top-left`:n=0}return{horizontalAlign:t,verticalAlign:n}}function tf(e,t,n){let r=t.getMaxScale()*xd,{maxImageWidth:i,maxImageHeight:a}=t.getMaxImageSize(e),o=Math.max(r,a*n);return{verticalLineContentWidth:Math.max(r,i*n),horizontalLineContentHeight:o}}function nf(e){switch(e){case`top`:return 0;case`center`:return .5;default:return 1}}function rf(t,n,r){return!(t===e.ax.horizontal||!n&&!wa(r)||n&&(Ta(r)||(i=r,/\p{sc=Arab}/u.test(String.fromCodePoint(i)))));var i}function af(e,t,n,r,i,a){let o=function(e,t,n,r){if(e?.rect)return e;let i=t[n.fontStack]?.[r];return i?{rect:null,metrics:i.metrics}:null}(a[e.fontStack]?.[t],i,e,t);if(o===null)return null;let s;if(n)s=r.verticalLineContentWidth-e.scale*xd;else{let t=nf(e.verticalAlign);s=(r.horizontalLineContentHeight-e.scale*xd)*t}return{rect:o.rect,metrics:o.metrics,baselineOffset:s}}function of(e,t,n,r,i){let a=i[e.imageName];if(!a)return null;let o=a.paddedRect,s=a.displaySize,c={width:s[0],height:s[1],left:1,top:-3,advance:t?s[1]:s[0]},l;if(t)l=r.verticalLineContentWidth-s[1]*e.scale;else{let t=nf(e.verticalAlign);l=(r.horizontalLineContentHeight-s[1]*e.scale)*t}return{rect:o,metrics:c,baselineOffset:l,imageOffset:(t?s[0]:s[1])*e.scale-xd*n}}function sf(e,t,n,r){if(r===0)return;let i=e[n],a=(e[n].x+i.metrics.advance*i.scale)*r;for(let r=t;r<=n;r++)e[r].x-=a}function cf(e,t,n){let{horizontalAlign:r,verticalAlign:i}=ef(n),a=t[0]-e.displaySize[0]*r,o=t[1]-e.displaySize[1]*i;return{image:e,top:o,bottom:o+e.displaySize[1],left:a,right:a+e.displaySize[0]}}function lf(e){let t=e.left,n=e.top,r=e.right-t,i=e.bottom-n,a=e.image.textFitWidth??`stretchOrShrink`,o=e.image.textFitHeight??`stretchOrShrink`,s=(e.image.content[2]-e.image.content[0])/(e.image.content[3]-e.image.content[1]);if(o===`proportional`){if(a===`stretchOnly`&&r/i<s||a===`proportional`){let e=Math.ceil(i*s);t*=e/r,r=e}}else if(a===`proportional`&&o===`stretchOnly`&&s!==0&&r/i>s){let e=Math.ceil(r/s);n*=e/i,i=e}return{x1:t,y1:n,x2:t+r,y2:n+i}}function uf(e,t,n,r,i,a){let o=e.image,s;if(o.content){let e=o.content,t=o.pixelRatio||1;s=[e[0]/t,e[1]/t,o.displaySize[0]-e[2]/t,o.displaySize[1]-e[3]/t]}let c=t.left*a,l=t.right*a,u,d,f,p;n===`width`||n===`both`?(p=i[0]+c-r[3],d=i[0]+l+r[1]):(p=i[0]+(c+l-o.displaySize[0])/2,d=p+o.displaySize[0]);let m=t.top*a,h=t.bottom*a;return n===`height`||n===`both`?(u=i[1]+m-r[0],f=i[1]+h+r[2]):(u=i[1]+(m+h-o.displaySize[1])/2,f=u+o.displaySize[1]),{image:o,top:u,right:d,bottom:f,left:p,collisionPadding:s}}J(`ImagePosition`,Xd),J(`ImageAtlas`,Zd),e.ax=void 0,(Qd=e.ax||={})[Qd.none=0]=`none`,Qd[Qd.horizontal=1]=`horizontal`,Qd[Qd.vertical=2]=`vertical`,Qd[Qd.horizontalOnly=3]=`horizontalOnly`;let df=32640;function ff(e,t){let{expression:n}=t;if(n.kind===`constant`)return{kind:`constant`,layoutSize:n.evaluate(new Y(e+1))};if(n.kind===`source`)return{kind:`source`};{let{zoomStops:t,interpolationType:r}=n,i=0;for(;i<t.length&&t[i]<=e;)i++;i=Math.max(0,i-1);let a=i;for(;a<t.length&&t[a]<e+1;)a++;a=Math.min(t.length-1,a);let o=t[i],s=t[a];return n.kind===`composite`?{kind:`composite`,minZoom:o,maxZoom:s,interpolationType:r}:{kind:`camera`,minZoom:o,maxZoom:s,minSize:n.evaluate(new Y(o)),maxSize:n.evaluate(new Y(s)),interpolationType:r}}}function pf(e,t,n){let r=`never`,i=e.get(t);return i?r=i:e.get(n)&&(r=`always`),r}let mf=[{name:`a_fade_opacity`,components:1,type:`Uint8`,offset:0}];function hf(e,t,n,r,i,a,o,s,c,l,u,d,f){let p=s?Math.min(df,Math.round(s[0])):0,m=s?Math.min(df,Math.round(s[1])):0;e.emplaceBack(t,n,Math.round(32*r),Math.round(32*i),a,o,(p<<1)+ +!!c,m,16*l,16*u,256*d,256*f)}function gf(e,t,n){e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n)}function _f(e){for(let t of e.sections)if(Fa(t.text))return!0;return!1}class vf{constructor(e){this.layoutVertexArray=new $o,this.indexArray=new is,this.programConfigurations=e,this.segments=new ss,this.dynamicLayoutVertexArray=new es,this.opacityVertexArray=new ts,this.hasVisibleVertices=!1,this.placedSymbolArray=new Io}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t,n,r){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,md.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,hd.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,mf,!0),this.opacityVertexBuffer.itemSize=1),(n||r)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}J(`SymbolBuffers`,vf);class yf{constructor(e,t,n){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new n,this.segments=new ss,this.collisionVertexArray=new rs}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,gd.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}J(`CollisionBuffers`,yf);class bf{constructor(t){this.collisionBoxArray=t.collisionBoxArray,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.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ff(this.zoom,n[`text-size`]),this.iconSizeData=ff(this.zoom,n[`icon-size`]);let r=this.layers[0].layout,i=r.get(`symbol-sort-key`),a=r.get(`symbol-z-order`);this.canOverlap=pf(r,`text-overlap`,`text-allow-overlap`)!==`never`||pf(r,`icon-overlap`,`icon-allow-overlap`)!==`never`||r.get(`text-ignore-placement`)||r.get(`icon-ignore-placement`),this.sortFeaturesByKey=a!==`viewport-y`&&!i.isConstant(),this.sortFeaturesByY=(a===`viewport-y`||a===`auto`&&!this.sortFeaturesByKey)&&this.canOverlap,r.get(`symbol-placement`)===`point`&&(this.writingModes=r.get(`text-writing-mode`).map((t=>e.ax[t]))),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=t.sourceID}createArrays(){this.text=new vf(new Is(this.layers,this.zoom,(e=>e.startsWith(`text`)))),this.icon=new vf(new Is(this.layers,this.zoom,(e=>e.startsWith(`icon`)))),this.glyphOffsetArray=new zo,this.lineVertexArray=new Bo,this.symbolInstances=new Ro,this.textAnchorOffsets=new Ho}calculateGlyphDependencies(e,t,n,r,i){for(let a of e)if(t[a.codePointAt(0)]=!0,(n||r)&&i){let e=Sd[a];e&&(t[e.codePointAt(0)]=!0)}}populate(t,n,r){let i=this.layers[0],a=i.layout,o=a.get(`text-font`),s=a.get(`text-field`),c=a.get(`icon-image`),l=(s.value.kind!==`constant`||s.value.value instanceof H&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(o.value.kind!==`constant`||o.value.value.length>0),u=c.value.kind!==`constant`||!!c.value.value||Object.keys(c.parameters).length>0,d=a.get(`symbol-sort-key`);if(this.features=[],!l&&!u)return;let f=n.iconDependencies,p=n.glyphDependencies,m=n.availableImages,h=new Y(this.zoom);for(let{feature:n,id:s,index:c,sourceLayerIndex:g}of t){let t=i._featureFilter.needGeometry,_=Hs(n,t);if(!i._featureFilter.filter(h,_,r))continue;let v,y;if(t||(_.geometry=Vs(n)),l){let e=i.getValueAndResolveTokens(`text-field`,_,r,m),t=H.factory(e);this.hasRTLText||=_f(t),(!this.hasRTLText||Ia.getRTLTextPluginStatus()===`unavailable`||this.hasRTLText&&Ia.isParsed())&&(v=bd(t,i,_))}if(u){let e=i.getValueAndResolveTokens(`icon-image`,_,r,m);y=e instanceof Yt?e:Yt.fromString(e)}if(!v&&!y)continue;let b=this.sortFeaturesByKey?d.evaluate(_,{},r):void 0;if(this.features.push({id:s,text:v,icon:y,index:c,sourceLayerIndex:g,geometry:_.geometry,properties:n.properties,type:jl.types[n.type],sortKey:b}),y&&(f[y.name]=!0),v){let t=o.evaluate(_,{},r).join(`,`),n=a.get(`text-rotation-alignment`)!==`viewport`&&a.get(`symbol-placement`)!==`point`;this.allowVerticalPlacement=this.writingModes?.includes(e.ax.vertical);for(let e of v.sections)if(e.image)f[e.image.name]=!0;else{let r=Ea(v.toString()),i=e.fontStack||t;p[i]||(p[i]={}),this.calculateGlyphDependencies(e.text,p[i],n,this.allowVerticalPlacement,r)}}}a.get(`symbol-placement`)===`line`&&(this.features=function(e){let t={},n={},r=[],i=0;function a(t){r.push(e[t]),i++}function o(e,t,i){let a=n[e];return delete n[e],n[t]=a,r[a].geometry[0].pop(),r[a].geometry[0]=r[a].geometry[0].concat(i[0]),a}function s(e,n,i){let a=t[n];return delete t[n],t[e]=a,r[a].geometry[0].shift(),r[a].geometry[0]=i[0].concat(r[a].geometry[0]),a}function c(e,t,n){let r=n?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.y}`}for(let l=0;l<e.length;l++){let u=e[l],d=u.geometry,f=u.text?u.text.toString():null;if(!f){a(l);continue}let p=c(f,d),m=c(f,d,!0);if(p in n&&m in t&&n[p]!==t[m]){let e=s(p,m,d),i=o(p,m,r[e].geometry);delete t[p],delete n[m],n[c(f,r[i].geometry,!0)]=i,r[e].geometry=null}else p in n?o(p,m,d):m in t?s(p,m,d):(a(l),t[p]=i-1,n[m]=i-1)}return r.filter((e=>e.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:n}),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:n}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,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(e,t){let n=this.lineVertexArray.length;if(e.segment!==void 0){let n=e.dist(t[e.segment+1]),r=e.dist(t[e.segment]),i={};for(let r=e.segment+1;r<t.length;r++)i[r]={x:t[r].x,y:t[r].y,tileUnitDistanceFromAnchor:n},r<t.length-1&&(n+=t[r+1].dist(t[r]));for(let n=e.segment||0;n>=0;n--)i[n]={x:t[n].x,y:t[n].y,tileUnitDistanceFromAnchor:r},n>0&&(r+=t[n-1].dist(t[n]));for(let e=0;e<t.length;e++){let t=i[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(t,n,r,i,a,o,s,c,l,u,d,f){let p=t.indexArray,m=t.layoutVertexArray,h=t.segments.prepareSegment(4*n.length,m,p,this.canOverlap?o.sortKey:void 0),g=this.glyphOffsetArray.length,_=h.vertexLength,v=this.allowVerticalPlacement&&s===e.ax.vertical?Math.PI/2:0,y=o.text&&o.text.sections;for(let e=0;e<n.length;e++){let{tl:i,tr:a,bl:s,br:l,tex:u,pixelOffsetTL:d,pixelOffsetBR:g,minFontScaleX:_,minFontScaleY:b,glyphOffset:x,isSDF:S,sectionIndex:C}=n[e],w=h.vertexLength,T=x[1];hf(m,c.x,c.y,i.x,T+i.y,u.x,u.y,r,S,d.x,d.y,_,b),hf(m,c.x,c.y,a.x,T+a.y,u.x+u.w,u.y,r,S,g.x,d.y,_,b),hf(m,c.x,c.y,s.x,T+s.y,u.x,u.y+u.h,r,S,d.x,g.y,_,b),hf(m,c.x,c.y,l.x,T+l.y,u.x+u.w,u.y+u.h,r,S,g.x,g.y,_,b),gf(t.dynamicLayoutVertexArray,c,v),p.emplaceBack(w,w+2,w+1),p.emplaceBack(w+1,w+2,w+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(x[0]),e!==n.length-1&&C===n[e+1].sectionIndex||t.programConfigurations.populatePaintArrays(m.length,o,o.index,{imagePositions:{},canonical:f,formattedSection:y?.[C]})}t.placedSymbolArray.emplaceBack(c.x,c.y,g,this.glyphOffsetArray.length-g,_,l,u,c.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],s,0,!1,0,d)}_addCollisionDebugVertex(e,t,n,r,i,a){return t.emplaceBack(0,0),e.emplaceBack(n.x,n.y,r,i,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,t,r,i,a,o,s){let c=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),l=c.vertexLength,u=a.layoutVertexArray,d=a.collisionVertexArray,f=s.anchorX,p=s.anchorY;this._addCollisionDebugVertex(u,d,o,f,p,new n(e,t)),this._addCollisionDebugVertex(u,d,o,f,p,new n(r,t)),this._addCollisionDebugVertex(u,d,o,f,p,new n(r,i)),this._addCollisionDebugVertex(u,d,o,f,p,new n(e,i)),c.vertexLength+=4;let m=a.indexArray;m.emplaceBack(l,l+1),m.emplaceBack(l+1,l+2),m.emplaceBack(l+2,l+3),m.emplaceBack(l+3,l),c.primitiveLength+=4}addDebugCollisionBoxes(e,t,n,r){for(let i=e;i<t;i++){let e=this.collisionBoxArray.get(i);this.addCollisionDebugVertices(e.x1,e.y1,e.x2,e.y2,r?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new yf(ns,_d.members,as),this.iconCollisionBox=new yf(ns,_d.members,as);for(let e=0;e<this.symbolInstances.length;e++){let t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,n,r,i,a,o,s,c){let l={};for(let r=t;r<n;r++){let t=e.get(r);l.textBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},l.textFeatureIndex=t.featureIndex;break}for(let t=r;t<i;t++){let n=e.get(t);l.verticalTextBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},l.verticalTextFeatureIndex=n.featureIndex;break}for(let t=a;t<o;t++){let n=e.get(t);l.iconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},l.iconFeatureIndex=n.featureIndex;break}for(let t=s;t<c;t++){let n=e.get(t);l.verticalIconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},l.verticalIconFeatureIndex=n.featureIndex;break}return l}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let n=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.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(e,t){let n=e.placedSymbolArray.get(t),r=n.vertexStartIndex+4*n.numGlyphs;for(let t=n.vertexStartIndex;t<r;t+=4)e.indexArray.emplaceBack(t,t+2,t+1),e.indexArray.emplaceBack(t+1,t+2,t+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let t=Math.sin(e),n=Math.cos(e),r=[],i=[],a=[];for(let e=0;e<this.symbolInstances.length;++e){a.push(e);let o=this.symbolInstances.get(e);r.push(0|Math.round(t*o.anchorX+n*o.anchorY)),i.push(o.featureIndex)}return a.sort(((e,t)=>r[e]-r[t]||i[t]-i[e])),a}addToSortKeyRanges(e,t){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n?.sortKey===t?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);let n=[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex];for(let e=0;e<n.length;e++){let t=n[e];t>=0&&n.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)}t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let xf,Sf;J(`SymbolBucket`,bf,{omit:[`layers`,`collisionBoxArray`,`features`,`compareText`]}),bf.MAX_GLYPHS=65535,bf.addDynamicAttributes=gf;var Cf={get paint(){return Sf||=new Xa({"icon-opacity":new Z(N.paint_symbol[`icon-opacity`]),"icon-color":new Z(N.paint_symbol[`icon-color`]),"icon-halo-color":new Z(N.paint_symbol[`icon-halo-color`]),"icon-halo-width":new Z(N.paint_symbol[`icon-halo-width`]),"icon-halo-blur":new Z(N.paint_symbol[`icon-halo-blur`]),"icon-translate":new X(N.paint_symbol[`icon-translate`]),"icon-translate-anchor":new X(N.paint_symbol[`icon-translate-anchor`]),"text-opacity":new Z(N.paint_symbol[`text-opacity`]),"text-color":new Z(N.paint_symbol[`text-color`],{runtimeType:tt,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Z(N.paint_symbol[`text-halo-color`]),"text-halo-width":new Z(N.paint_symbol[`text-halo-width`]),"text-halo-blur":new Z(N.paint_symbol[`text-halo-blur`]),"text-translate":new X(N.paint_symbol[`text-translate`]),"text-translate-anchor":new X(N.paint_symbol[`text-translate-anchor`])})},get layout(){return xf||=new Xa({"symbol-placement":new X(N.layout_symbol[`symbol-placement`]),"symbol-spacing":new X(N.layout_symbol[`symbol-spacing`]),"symbol-avoid-edges":new X(N.layout_symbol[`symbol-avoid-edges`]),"symbol-sort-key":new Z(N.layout_symbol[`symbol-sort-key`]),"symbol-z-order":new X(N.layout_symbol[`symbol-z-order`]),"icon-allow-overlap":new X(N.layout_symbol[`icon-allow-overlap`]),"icon-overlap":new X(N.layout_symbol[`icon-overlap`]),"icon-ignore-placement":new X(N.layout_symbol[`icon-ignore-placement`]),"icon-optional":new X(N.layout_symbol[`icon-optional`]),"icon-rotation-alignment":new X(N.layout_symbol[`icon-rotation-alignment`]),"icon-size":new Z(N.layout_symbol[`icon-size`]),"icon-text-fit":new X(N.layout_symbol[`icon-text-fit`]),"icon-text-fit-padding":new X(N.layout_symbol[`icon-text-fit-padding`]),"icon-image":new Z(N.layout_symbol[`icon-image`]),"icon-rotate":new Z(N.layout_symbol[`icon-rotate`]),"icon-padding":new Z(N.layout_symbol[`icon-padding`]),"icon-keep-upright":new X(N.layout_symbol[`icon-keep-upright`]),"icon-offset":new Z(N.layout_symbol[`icon-offset`]),"icon-anchor":new Z(N.layout_symbol[`icon-anchor`]),"icon-pitch-alignment":new X(N.layout_symbol[`icon-pitch-alignment`]),"text-pitch-alignment":new X(N.layout_symbol[`text-pitch-alignment`]),"text-rotation-alignment":new X(N.layout_symbol[`text-rotation-alignment`]),"text-field":new Z(N.layout_symbol[`text-field`]),"text-font":new Z(N.layout_symbol[`text-font`]),"text-size":new Z(N.layout_symbol[`text-size`]),"text-max-width":new Z(N.layout_symbol[`text-max-width`]),"text-line-height":new X(N.layout_symbol[`text-line-height`]),"text-letter-spacing":new Z(N.layout_symbol[`text-letter-spacing`]),"text-justify":new Z(N.layout_symbol[`text-justify`]),"text-radial-offset":new Z(N.layout_symbol[`text-radial-offset`]),"text-variable-anchor":new X(N.layout_symbol[`text-variable-anchor`]),"text-variable-anchor-offset":new Z(N.layout_symbol[`text-variable-anchor-offset`]),"text-anchor":new Z(N.layout_symbol[`text-anchor`]),"text-max-angle":new X(N.layout_symbol[`text-max-angle`]),"text-writing-mode":new X(N.layout_symbol[`text-writing-mode`]),"text-rotate":new Z(N.layout_symbol[`text-rotate`]),"text-padding":new X(N.layout_symbol[`text-padding`]),"text-keep-upright":new X(N.layout_symbol[`text-keep-upright`]),"text-transform":new Z(N.layout_symbol[`text-transform`]),"text-offset":new Z(N.layout_symbol[`text-offset`]),"text-allow-overlap":new X(N.layout_symbol[`text-allow-overlap`]),"text-overlap":new X(N.layout_symbol[`text-overlap`]),"text-ignore-placement":new X(N.layout_symbol[`text-ignore-placement`]),"text-optional":new X(N.layout_symbol[`text-optional`])})}};class wf{constructor(e){if(e.property.overrides===void 0)throw Error(`overrides must be provided to instantiate FormatSectionOverride class`);this.type=e.property.overrides?e.property.overrides.runtimeType:et,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t?.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}J(`FormatSectionOverride`,wf,{omit:[`defaultValue`]});class Tf extends $a{constructor(e,t){super(e,Cf,t)}recalculate(e,t){if(super.recalculate(e,t),this.layout.get(`icon-rotation-alignment`)===`auto`&&(this.layout._values[`icon-rotation-alignment`]=this.layout.get(`symbol-placement`)===`point`?`viewport`:`map`),this.layout.get(`text-rotation-alignment`)===`auto`&&(this.layout._values[`text-rotation-alignment`]=this.layout.get(`symbol-placement`)===`point`?`viewport`:`map`),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 e=this.layout.get(`text-writing-mode`);if(e){let t=[];for(let n of e)t.includes(n)||t.push(n);this.layout._values[`text-writing-mode`]=t}else this.layout._values[`text-writing-mode`]=[`horizontal`]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,n,r){let i=this.layout.get(e).evaluate(t,{},n,r),a=this._unevaluatedLayout._values[e];return a.isDataDriven()||si(a.value)||!i?i:function(e,t){return t.replace(/{([^{}]+)}/g,((t,n)=>e&&n in e?String(e[n]):``))}(t.properties,i)}createBucket(e){return new bf(e)}queryRadius(){return 0}queryIntersectsFeature(){throw Error(`Should take a different path in FeatureIndex`)}_setPaintOverrides(){for(let e of Cf.paint.overridableProperties){if(!Tf.hasPaintOverride(this.layout,e))continue;let t=this.paint.get(e),n=new oi(new wf(t),t.property.specification),r=null;r=t.value.kind===`constant`||t.value.kind===`source`?new li(`source`,n):new ui(`composite`,n,t.value.zoomStops),this.paint._values[e]=new Ga(t.property,r,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,n){return!(!this.layout||t.isDataDriven()||n.isDataDriven())&&Tf.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){let n=e.get(`text-field`),r=Cf.paint.properties[t],i=!1,a=e=>{for(let t of e)if(r.overrides?.hasOverride(t))return void(i=!0)};if(n.value.kind===`constant`&&n.value.value instanceof H)a(n.value.value.sections);else if(n.value.kind===`source`||n.value.kind===`composite`){let e=t=>{i||(t instanceof tn&&$t(t.value)===at?a(t.value.sections):t instanceof In?a(t.sections):t.eachChild(e))},t=n.value;t._styleExpression&&e(t._styleExpression.expression)}return i}}let Ef;var Df={get paint(){return Ef||=new Xa({"background-color":new X(N.paint_background[`background-color`]),"background-pattern":new Ja(N.paint_background[`background-pattern`]),"background-opacity":new X(N.paint_background[`background-opacity`])})}};class Of extends $a{constructor(e,t){super(e,Df,t)}}class kf extends $a{constructor(e,t){super(e,{},t),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}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`)}}class Af{constructor(e){this._methodToThrottle=e,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var e;this._triggered||(this._triggered=!0,(e=this._channel)==null||e.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let jf={once:!0},Mf=6371008.8;class Nf{constructor(e,t){if(isNaN(e)||isNaN(t))throw Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw Error(`Invalid LngLat latitude value: must be between -90 and 90`)}wrap(){return new Nf(ae(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let t=Math.PI/180,n=this.lat*t,r=e.lat*t,i=Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return Mf*Math.acos(Math.min(i,1))}static convert(e){if(e instanceof Nf)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Nf(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e==`object`&&e)return new Nf(Number(`lng`in e?e.lng:e.lon),Number(e.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>]")}}let Pf=2*Math.PI*Mf;function Ff(e){return Pf*Math.cos(e*Math.PI/180)}function If(e){return(180+e)/360}function Lf(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Rf(e,t){return e/Ff(t)}function zf(e){return 360*e-180}function Bf(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function Vf(e,t){return e*Ff(Bf(t))}class Hf{constructor(e,t,n=0){this.x=+e,this.y=+t,this.z=+n}static fromLngLat(e,t=0){let n=Nf.convert(e);return new Hf(If(n.lng),Lf(n.lat),Rf(t,n.lat))}toLngLat(){return new Nf(zf(this.x),Bf(this.y))}toAltitude(){return Vf(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Pf*(e=Bf(this.y),1/Math.cos(e*Math.PI/180));var e}}function Uf(e,t,n){var r=2*Math.PI*6378137/256/2**n;return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}class Wf{constructor(e,t,n){if(!function(e,t,n){return!(e<0||e>25||n<0||n>=2**e||t<0||t>=2**e)}(e,t,n))throw Error(`x=${t}, y=${n}, z=${e} outside of bounds. 0<=x<${2**e}, 0<=y<${2**e} 0<=z<=25 `);this.z=e,this.x=t,this.y=n,this.key=qf(0,e,e,t,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,n){let r=(a=this.y,o=this.z,s=Uf(256*(i=this.x),256*(a=2**o-a-1),o),c=Uf(256*(i+1),256*(a+1),o),s[0]+`,`+s[1]+`,`+c[0]+`,`+c[1]);var i,a,o,s,c;let l=function(e,t,n){let r=``;for(let i=e;i>0;i--){let e=1<<i-1;r+=(t&e?1:0)+(n&e?2:0)}return r}(this.z,this.x,this.y);return e[(this.x+this.y)%e.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(n===`tms`?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,t>1?`@2x`:``).replace(/{quadkey}/g,l).replace(/{bbox-epsg-3857}/g,r)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=2**this.z;return new n((e.x*t-this.x)*O,(e.y*t-this.y)*O)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Gf{constructor(e,t){this.wrap=e,this.canonical=t,this.key=qf(e,t.z,t.z,t.x,t.y)}}class Kf{constructor(e,t,n,r,i){if(this.terrainRttPosMatrix32f=null,e<n)throw Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=t,this.canonical=new Wf(n,+r,+i),this.key=qf(t,e,n,r,i)}clone(){return new Kf(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let t=this.canonical.z-e;return e>this.canonical.z?new Kf(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Kf(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,t){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let n=this.canonical.z-e;return e>this.canonical.z?qf(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):qf(this.wrap*+t,e,e,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;let t=this.canonical.z-e.canonical.z;return!(t<0)&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new Kf(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let t=this.canonical.z+1,n=2*this.canonical.x,r=2*this.canonical.y;return[new Kf(t,this.wrap,t,n,r),new Kf(t,this.wrap,t,n+1,r),new Kf(t,this.wrap,t,n,r+1),new Kf(t,this.wrap,t,n+1,r+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Kf(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Kf(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Gf(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Hf(e.x-this.wrap,e.y))}normalizeCoordinates(e,t,n=8192){if(e>=0&&e<n&&t>=0&&t<n)return{tileID:this,x:e,y:t};let r=Math.floor(e/n),i=Math.floor(t/n),a=e-r*n,o=t-i*n,s=this.canonical.z,c=1<<s,l=this.canonical.y+i;if(l<0||l>=c)return null;let u=this.canonical.x+r,d=this.wrap;return u<0?(d-=Math.ceil(-u/c),u=(u%c+c)%c):u>=c&&(d+=Math.floor(u/c),u%=c),{tileID:new Kf(this.overscaledZ,d,s,u,l),x:a,y:o}}}function qf(e,t,n,r,i){(e*=2)<0&&(e=-1*e-1);let a=1<<n;return(a*a*e+a*i+r).toString(36)+n.toString(36)+t.toString(36)}J(`CanonicalTileID`,Wf),J(`OverscaledTileID`,Kf,{omit:[`terrainRttPosMatrix32f`]});class Jf{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(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(e){return this.expandBy(-e)}map(e){let t=new Jf;return t.extend(e(new n(this.minX,this.minY))),t.extend(e(new n(this.maxX,this.minY))),t.extend(e(new n(this.minX,this.maxY))),t.extend(e(new n(this.maxX,this.maxY))),t}static fromPoints(e){let t=new Jf;for(let n of e)t.extend(n);return t}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}}class Yf{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let n=e[t];this._stringToNumber[n]=t,this._numberToString[t]=n}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Xf{constructor(e,t,n,r,i){this.type=`Feature`,this._vectorTileFeature=e,this._x=n,this._y=r,this._z=t,this.properties=e.properties,this.id=i}projectPoint(e,t,n,r){return[360*(e.x+t)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+n)/r)*Math.PI))-90]}projectLine(e,t,n,r){return e.map((e=>this.projectPoint(e,t,n,r)))}get geometry(){if(this._geometry)return this._geometry;let e=this._vectorTileFeature,t=e.extent*2**this._z,n=e.extent*this._x,r=e.extent*this._y,i=e.loadGeometry();switch(e.type){case 1:{let e=[];for(let t of i)e.push(t[0]);let a=this.projectLine(e,n,r,t);this._geometry=e.length===1?{type:`Point`,coordinates:a[0]}:{type:`MultiPoint`,coordinates:a};break}case 2:{let e=i.map((e=>this.projectLine(e,n,r,t)));this._geometry=e.length===1?{type:`LineString`,coordinates:e[0]}:{type:`MultiLineString`,coordinates:e};break}case 3:{let e=Nl(i),a=[];for(let i of e)a.push(i.map((e=>this.projectLine(e,n,r,t))));this._geometry=a.length===1?{type:`Polygon`,coordinates:a[0]}:{type:`MultiPolygon`,coordinates:a};break}default:throw Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)t!==`_geometry`&&t!==`_vectorTileFeature`&&t!==`_x`&&t!==`_y`&&t!==`_z`&&(e[t]=this[t]);return e}}class Zf{constructor(e,t,n){this._name=e,this.dataBuffer=t,typeof n==`number`?this._size=n:(this.nullabilityBuffer=n,this._size=n.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer?.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Qf extends Zf{}class $f extends Qf{getValueFromBuffer(e){return this.dataBuffer[e]}}class ep extends Qf{getValueFromBuffer(e){return this.dataBuffer[e]}}class tp extends Zf{constructor(e,t,n,r){super(e,t,r),this.delta=n}}class np extends tp{constructor(e,t,n,r){super(e,Int32Array.of(t),n,r)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class rp extends Zf{constructor(e,t,n,r){super(e,r?Int32Array.of(t):Uint32Array.of(t),n)}getValueFromBuffer(e){return this.dataBuffer[0]}}class ip{constructor(e,t,n,r,i=4096){this._name=e,this._geometryVector=t,this._idVector=n,this._propertyVectors=r,this._extent=i}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||=new Map(this._propertyVectors.map((e=>[e.name,e]))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let e=[],t=this.geometryVector.getGeometries();for(let n=0;n<this.numFeatures;n++){let r;if(this.idVector){let e=this.idVector.getValue(n);r=this.containsMaxSafeIntegerValues(this.idVector)&&e!==null?Number(e):e}let i={coordinates:t[n],type:this.geometryVector.geometryType(n)},a={};for(let e of this.propertyVectors){if(!e)continue;let t=e.name,r=e.getValue(n);r!==null&&(a[t]=r)}e.push({id:r,geometry:i,properties:a})}return e}containsMaxSafeIntegerValues(e){return e instanceof $f||e instanceof rp||e instanceof np||e instanceof ep}}class ap{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var Q,op;(function(e){e.NONE=`NONE`,e.DELTA=`DELTA`,e.COMPONENTWISE_DELTA=`COMPONENTWISE_DELTA`,e.RLE=`RLE`,e.MORTON=`MORTON`,e.PDE=`PDE`})(Q||={}),function(e){e.NONE=`NONE`,e.FAST_PFOR=`FAST_PFOR`,e.VARINT=`VARINT`,e.ALP=`ALP`}(op||={});let sp=new Uint32Array(33);sp[0]=0;for(let e=1;e<=32;e++)sp[e]=e===32?4294967295:4294967295>>>32-e;let cp=sp;function lp(e,t){return e-e%t}function up(e){let t=e>>>0;return((255&t)<<24|(65280&t)<<8|t>>>8&65280|t>>>24&255)>>>0}let dp=function(){let e=lp(65536,256);return e===0?256:e}(),fp=3*dp/256+dp|0;function pp(){let e=new Uint8Array(fp);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:e,byteContainerI32:new Int32Array(e.buffer,e.byteOffset,e.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function mp(e,t,n,r,i){switch(i){case 1:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0;n[i++]=t>>>0&1,n[i++]=t>>>1&1,n[i++]=t>>>2&1,n[i++]=t>>>3&1,n[i++]=t>>>4&1,n[i++]=t>>>5&1,n[i++]=t>>>6&1,n[i++]=t>>>7&1,n[i++]=t>>>8&1,n[i++]=t>>>9&1,n[i++]=t>>>10&1,n[i++]=t>>>11&1,n[i++]=t>>>12&1,n[i++]=t>>>13&1,n[i++]=t>>>14&1,n[i++]=t>>>15&1,n[i++]=t>>>16&1,n[i++]=t>>>17&1,n[i++]=t>>>18&1,n[i++]=t>>>19&1,n[i++]=t>>>20&1,n[i++]=t>>>21&1,n[i++]=t>>>22&1,n[i++]=t>>>23&1,n[i++]=t>>>24&1,n[i++]=t>>>25&1,n[i++]=t>>>26&1,n[i++]=t>>>27&1,n[i++]=t>>>28&1,n[i++]=t>>>29&1,n[i++]=t>>>30&1,n[i++]=t>>>31&1}})(e,t,n,r);break;case 2:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0;n[i++]=t>>>0&3,n[i++]=t>>>2&3,n[i++]=t>>>4&3,n[i++]=t>>>6&3,n[i++]=t>>>8&3,n[i++]=t>>>10&3,n[i++]=t>>>12&3,n[i++]=t>>>14&3,n[i++]=t>>>16&3,n[i++]=t>>>18&3,n[i++]=t>>>20&3,n[i++]=t>>>22&3,n[i++]=t>>>24&3,n[i++]=t>>>26&3,n[i++]=t>>>28&3,n[i++]=t>>>30&3,n[i++]=r>>>0&3,n[i++]=r>>>2&3,n[i++]=r>>>4&3,n[i++]=r>>>6&3,n[i++]=r>>>8&3,n[i++]=r>>>10&3,n[i++]=r>>>12&3,n[i++]=r>>>14&3,n[i++]=r>>>16&3,n[i++]=r>>>18&3,n[i++]=r>>>20&3,n[i++]=r>>>22&3,n[i++]=r>>>24&3,n[i++]=r>>>26&3,n[i++]=r>>>28&3,n[i++]=r>>>30&3}})(e,t,n,r);break;case 3:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,o=e[a++]>>>0;n[i++]=t>>>0&7,n[i++]=t>>>3&7,n[i++]=t>>>6&7,n[i++]=t>>>9&7,n[i++]=t>>>12&7,n[i++]=t>>>15&7,n[i++]=t>>>18&7,n[i++]=t>>>21&7,n[i++]=t>>>24&7,n[i++]=t>>>27&7,n[i++]=7&(t>>>30|(1&r)<<2),n[i++]=r>>>1&7,n[i++]=r>>>4&7,n[i++]=r>>>7&7,n[i++]=r>>>10&7,n[i++]=r>>>13&7,n[i++]=r>>>16&7,n[i++]=r>>>19&7,n[i++]=r>>>22&7,n[i++]=r>>>25&7,n[i++]=r>>>28&7,n[i++]=7&(r>>>31|(3&o)<<1),n[i++]=o>>>2&7,n[i++]=o>>>5&7,n[i++]=o>>>8&7,n[i++]=o>>>11&7,n[i++]=o>>>14&7,n[i++]=o>>>17&7,n[i++]=o>>>20&7,n[i++]=o>>>23&7,n[i++]=o>>>26&7,n[i++]=o>>>29&7}})(e,t,n,r);break;case 4:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0;n[i++]=t>>>0&15,n[i++]=t>>>4&15,n[i++]=t>>>8&15,n[i++]=t>>>12&15,n[i++]=t>>>16&15,n[i++]=t>>>20&15,n[i++]=t>>>24&15,n[i++]=t>>>28&15,n[i++]=r>>>0&15,n[i++]=r>>>4&15,n[i++]=r>>>8&15,n[i++]=r>>>12&15,n[i++]=r>>>16&15,n[i++]=r>>>20&15,n[i++]=r>>>24&15,n[i++]=r>>>28&15,n[i++]=o>>>0&15,n[i++]=o>>>4&15,n[i++]=o>>>8&15,n[i++]=o>>>12&15,n[i++]=o>>>16&15,n[i++]=o>>>20&15,n[i++]=o>>>24&15,n[i++]=o>>>28&15,n[i++]=s>>>0&15,n[i++]=s>>>4&15,n[i++]=s>>>8&15,n[i++]=s>>>12&15,n[i++]=s>>>16&15,n[i++]=s>>>20&15,n[i++]=s>>>24&15,n[i++]=s>>>28&15}})(e,t,n,r);break;case 5:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0,c=e[a++]>>>0;n[i++]=t>>>0&31,n[i++]=t>>>5&31,n[i++]=t>>>10&31,n[i++]=t>>>15&31,n[i++]=t>>>20&31,n[i++]=t>>>25&31,n[i++]=31&(t>>>30|(7&r)<<2),n[i++]=r>>>3&31,n[i++]=r>>>8&31,n[i++]=r>>>13&31,n[i++]=r>>>18&31,n[i++]=r>>>23&31,n[i++]=31&(r>>>28|(1&o)<<4),n[i++]=o>>>1&31,n[i++]=o>>>6&31,n[i++]=o>>>11&31,n[i++]=o>>>16&31,n[i++]=o>>>21&31,n[i++]=o>>>26&31,n[i++]=31&(o>>>31|(15&s)<<1),n[i++]=s>>>4&31,n[i++]=s>>>9&31,n[i++]=s>>>14&31,n[i++]=s>>>19&31,n[i++]=s>>>24&31,n[i++]=31&(s>>>29|(3&c)<<3),n[i++]=c>>>2&31,n[i++]=c>>>7&31,n[i++]=c>>>12&31,n[i++]=c>>>17&31,n[i++]=c>>>22&31,n[i++]=c>>>27&31}})(e,t,n,r);break;case 6:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0,c=e[a++]>>>0,l=e[a++]>>>0;n[i++]=t>>>0&63,n[i++]=t>>>6&63,n[i++]=t>>>12&63,n[i++]=t>>>18&63,n[i++]=t>>>24&63,n[i++]=63&(t>>>30|(15&r)<<2),n[i++]=r>>>4&63,n[i++]=r>>>10&63,n[i++]=r>>>16&63,n[i++]=r>>>22&63,n[i++]=63&(r>>>28|(3&o)<<4),n[i++]=o>>>2&63,n[i++]=o>>>8&63,n[i++]=o>>>14&63,n[i++]=o>>>20&63,n[i++]=o>>>26&63,n[i++]=s>>>0&63,n[i++]=s>>>6&63,n[i++]=s>>>12&63,n[i++]=s>>>18&63,n[i++]=s>>>24&63,n[i++]=63&(s>>>30|(15&c)<<2),n[i++]=c>>>4&63,n[i++]=c>>>10&63,n[i++]=c>>>16&63,n[i++]=c>>>22&63,n[i++]=63&(c>>>28|(3&l)<<4),n[i++]=l>>>2&63,n[i++]=l>>>8&63,n[i++]=l>>>14&63,n[i++]=l>>>20&63,n[i++]=l>>>26&63}})(e,t,n,r);break;case 7:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0,c=e[a++]>>>0,l=e[a++]>>>0,u=e[a++]>>>0;n[i++]=t>>>0&127,n[i++]=t>>>7&127,n[i++]=t>>>14&127,n[i++]=t>>>21&127,n[i++]=127&(t>>>28|(7&r)<<4),n[i++]=r>>>3&127,n[i++]=r>>>10&127,n[i++]=r>>>17&127,n[i++]=r>>>24&127,n[i++]=127&(r>>>31|(63&o)<<1),n[i++]=o>>>6&127,n[i++]=o>>>13&127,n[i++]=o>>>20&127,n[i++]=127&(o>>>27|(3&s)<<5),n[i++]=s>>>2&127,n[i++]=s>>>9&127,n[i++]=s>>>16&127,n[i++]=s>>>23&127,n[i++]=127&(s>>>30|(31&c)<<2),n[i++]=c>>>5&127,n[i++]=c>>>12&127,n[i++]=c>>>19&127,n[i++]=127&(c>>>26|(1&l)<<6),n[i++]=l>>>1&127,n[i++]=l>>>8&127,n[i++]=l>>>15&127,n[i++]=l>>>22&127,n[i++]=127&(l>>>29|(15&u)<<3),n[i++]=u>>>4&127,n[i++]=u>>>11&127,n[i++]=u>>>18&127,n[i++]=u>>>25&127}})(e,t,n,r);break;case 8:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0,c=e[a++]>>>0,l=e[a++]>>>0,u=e[a++]>>>0,d=e[a++]>>>0;n[i++]=t>>>0&255,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=r>>>0&255,n[i++]=r>>>8&255,n[i++]=r>>>16&255,n[i++]=r>>>24&255,n[i++]=o>>>0&255,n[i++]=o>>>8&255,n[i++]=o>>>16&255,n[i++]=o>>>24&255,n[i++]=s>>>0&255,n[i++]=s>>>8&255,n[i++]=s>>>16&255,n[i++]=s>>>24&255,n[i++]=c>>>0&255,n[i++]=c>>>8&255,n[i++]=c>>>16&255,n[i++]=c>>>24&255,n[i++]=l>>>0&255,n[i++]=l>>>8&255,n[i++]=l>>>16&255,n[i++]=l>>>24&255,n[i++]=u>>>0&255,n[i++]=u>>>8&255,n[i++]=u>>>16&255,n[i++]=u>>>24&255,n[i++]=d>>>0&255,n[i++]=d>>>8&255,n[i++]=d>>>16&255,n[i++]=d>>>24&255}})(e,t,n,r);break;case 16:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<128;t++){let t=e[a++]>>>0;n[i++]=65535&t,n[i++]=t>>>16&65535}})(e,t,n,r);break;default:(function(e,t,n,r,i){let a=cp[i]>>>0,o=t,s=0,c=e[o]>>>0,l=r;for(let t=0;t<8;t++){for(let t=0;t<32;t++)if(s+i<=32)n[l+t]=c>>>s&a,s+=i,s===32&&(s=0,o++,t!==31&&(c=e[o]>>>0));else{let r=32-s,u=c>>>s;o++,c=e[o]>>>0;let d=i-r;n[l+t]=(u|(c&-1>>>32-d>>>0)<<r)&a,s=d}l+=32,s=0,t<7&&(c=e[o]>>>0)}})(e,t,n,r,i)}return t+(i<<3)|0}function hp(e,t,n,r){if(n+2>t)throw Error(`FastPFOR decode: byteContainer underflow at block=${r} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${n}, byteSize=${t})`);let i=e[n++],a=e[n++];if(i>32)throw Error(`FastPFOR decode: invalid bitWidth=${i} at block=${r} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:i,exceptionCount:a,bytePosIn:n}}function gp(e,t,n,r,i,a,o,s,c){let{maxBits:l,exceptionBitWidth:u,bytePosIn:d}=function(e,t,n,r,i,a){if(n+1>t)throw Error(`FastPFOR decode: exception header underflow at block=${a} (need 1 byte for maxBits, bytePos=${n}, byteSize=${t})`);let o=e[n++];if(o<r||o>32)throw Error(`FastPFOR decode: invalid maxBits=${o} at block=${a} (bitWidth=${r}, expected ${r}..32)`);let s=o-r|0;if(s<1||s>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${s} at block=${a} (bitWidth=${r}, maxBits=${o})`);if(n+i>t)throw Error(`FastPFOR decode: exception positions underflow at block=${a} (need=${i}, have=${t-n})`);return{maxBits:o,exceptionBitWidth:s,bytePosIn:n}}(i,a,o,n,r,c);if(o=d,u===1){let a=1<<n;for(let n=0;n<r;n=n+1|0)e[i[o++]+t|0]|=a;return o}let f=s.dataToBePacked[u];if(!f)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${u} (bitWidth=${n}, maxBits=${l}) at block ${c}`);let p=s.dataPointers,m=0|p[u],h=0|s.exceptionSizes[u];if(m+r>h)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${u} (ptr=${m}, need ${r}, size=${h}) at block ${c}`);for(let a=0;a<r;a=a+1|0){let r=i[o++],a=0|f[m++];e[r+t|0]|=a<<n}return p[u]=m,o}function _p(e,t,n,r,i,a){let o=0|n,s=0|e[o];if(s<=0||o+s>e.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${s} at pageStart=${o} (expected > 0 and pageStart+whereMeta < encoded.length=${e.length})`);let c=o+1|0,l=o+s|0,u=e[l]>>>0,d=u+3>>>2,f=l+1,p=f+d;if(p>=e.length)throw Error(`FastPFOR decode: invalid byteSize=${u} (metaInts=${d}, pageStart=${o}, packedEnd=${l}, byteContainerStart=${f}) causes bitmapPos=${p} out of bounds (encoded.length=${e.length})`);let m=function(e,t,n,r){r.byteContainer.length<n&&(r.byteContainer=new Uint8Array(2*n),r.byteContainerI32=void 0);let i=r.byteContainer,a=n>>>2;if(3&i.byteOffset)for(let n=0;n<a;n=n+1|0){let r=0|e[t+n|0],a=n<<2;i[a]=255&r,i[a+1|0]=r>>>8&255,i[a+2|0]=r>>>16&255,i[a+3|0]=r>>>24&255}else{let n=r.byteContainerI32;(!n||n.buffer!==i.buffer||n.byteOffset!==i.byteOffset||n.length<a)&&(n=r.byteContainerI32=new Int32Array(i.buffer,i.byteOffset,i.byteLength>>>2)),n.set(e.subarray(t,t+a))}let o=3&n;if(o>0){let n=0|e[t+a|0],r=a<<2;for(let e=0;e<o;e=e+1|0)i[r+e|0]=n>>>(e<<3)&255}return i}(e,f,u,a),h=u,g=function(e,t,n){let r=0|e[t++],i=n.dataToBePacked;for(let a=2;a<=32;a=a+1|0){if(!(r>>>a-1&1))continue;if(t>=e.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${a}, streamWordIndex=${t}, needWords=1, availableWords=${e.length-t}, encodedWords=${e.length})`);let o=e[t++]>>>0,s=lp(o+31,32),c=o*a+31>>>5;if(t+c>e.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${a}, size=${o}, streamWordIndex=${t}, needWords=${c}, availableWords=${e.length-t}, encodedWords=${e.length})`);let l=i[a];(!l||l.length<s)&&(l=i[a]=new Uint32Array(s));let u=0;for(;u<o;u=u+32|0)vp(e,t,l,u,a),t=t+a|0;t=t-((u-o|0)*a>>>5)|0,n.exceptionSizes[a]=o}return t}(e,p,a);return a.dataPointers.fill(0),function(e,t,n,r,i,a,o,s,c,l){let u=0|n,d=0;for(let t=0;t<o;t=t+1|0){let n=hp(s,c,d,t);d=n.bytePosIn;let r=n.bitWidth,o=n.exceptionCount,f=a+t*256|0;switch(r){case 0:i.fill(0,f,f+256);break;case 32:for(let t=0;t<256;t=t+1|0)i[f+t|0]=0|e[u+t|0];u=u+256|0;break;default:u=mp(e,u,i,f,r)}o>0&&(d=gp(i,f,r,o,s,c,d,l,t))}if(u!==r)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${t}, packedStart=${n}, consumedPackedEnd=${u}, expectedPackedEnd=${r}, packedWords=${r-n}, encoded.length=${e.length})`)}(e,o,c,l,t,0|r,i/256|0,m,h,a),g}function vp(e,t,n,r,i){switch(i){case 2:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0;n[i++]=a>>>0&3,n[i++]=a>>>2&3,n[i++]=a>>>4&3,n[i++]=a>>>6&3,n[i++]=a>>>8&3,n[i++]=a>>>10&3,n[i++]=a>>>12&3,n[i++]=a>>>14&3,n[i++]=a>>>16&3,n[i++]=a>>>18&3,n[i++]=a>>>20&3,n[i++]=a>>>22&3,n[i++]=a>>>24&3,n[i++]=a>>>26&3,n[i++]=a>>>28&3,n[i++]=a>>>30&3,n[i++]=o>>>0&3,n[i++]=o>>>2&3,n[i++]=o>>>4&3,n[i++]=o>>>6&3,n[i++]=o>>>8&3,n[i++]=o>>>10&3,n[i++]=o>>>12&3,n[i++]=o>>>14&3,n[i++]=o>>>16&3,n[i++]=o>>>18&3,n[i++]=o>>>20&3,n[i++]=o>>>22&3,n[i++]=o>>>24&3,n[i++]=o>>>26&3,n[i++]=o>>>28&3,n[i]=o>>>30&3})(e,t,n,r);return;case 3:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0;n[i++]=a>>>0&7,n[i++]=a>>>3&7,n[i++]=a>>>6&7,n[i++]=a>>>9&7,n[i++]=a>>>12&7,n[i++]=a>>>15&7,n[i++]=a>>>18&7,n[i++]=a>>>21&7,n[i++]=a>>>24&7,n[i++]=a>>>27&7,n[i++]=7&(a>>>30|(1&o)<<2),n[i++]=o>>>1&7,n[i++]=o>>>4&7,n[i++]=o>>>7&7,n[i++]=o>>>10&7,n[i++]=o>>>13&7,n[i++]=o>>>16&7,n[i++]=o>>>19&7,n[i++]=o>>>22&7,n[i++]=o>>>25&7,n[i++]=o>>>28&7,n[i++]=7&(o>>>31|(3&s)<<1),n[i++]=s>>>2&7,n[i++]=s>>>5&7,n[i++]=s>>>8&7,n[i++]=s>>>11&7,n[i++]=s>>>14&7,n[i++]=s>>>17&7,n[i++]=s>>>20&7,n[i++]=s>>>23&7,n[i++]=s>>>26&7,n[i]=s>>>29&7})(e,t,n,r);return;case 4:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0;n[i++]=a>>>0&15,n[i++]=a>>>4&15,n[i++]=a>>>8&15,n[i++]=a>>>12&15,n[i++]=a>>>16&15,n[i++]=a>>>20&15,n[i++]=a>>>24&15,n[i++]=a>>>28&15,n[i++]=o>>>0&15,n[i++]=o>>>4&15,n[i++]=o>>>8&15,n[i++]=o>>>12&15,n[i++]=o>>>16&15,n[i++]=o>>>20&15,n[i++]=o>>>24&15,n[i++]=o>>>28&15,n[i++]=s>>>0&15,n[i++]=s>>>4&15,n[i++]=s>>>8&15,n[i++]=s>>>12&15,n[i++]=s>>>16&15,n[i++]=s>>>20&15,n[i++]=s>>>24&15,n[i++]=s>>>28&15,n[i++]=c>>>0&15,n[i++]=c>>>4&15,n[i++]=c>>>8&15,n[i++]=c>>>12&15,n[i++]=c>>>16&15,n[i++]=c>>>20&15,n[i++]=c>>>24&15,n[i]=c>>>28&15})(e,t,n,r);return;case 5:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0;n[i++]=a>>>0&31,n[i++]=a>>>5&31,n[i++]=a>>>10&31,n[i++]=a>>>15&31,n[i++]=a>>>20&31,n[i++]=a>>>25&31,n[i++]=31&(a>>>30|(7&o)<<2),n[i++]=o>>>3&31,n[i++]=o>>>8&31,n[i++]=o>>>13&31,n[i++]=o>>>18&31,n[i++]=o>>>23&31,n[i++]=31&(o>>>28|(1&s)<<4),n[i++]=s>>>1&31,n[i++]=s>>>6&31,n[i++]=s>>>11&31,n[i++]=s>>>16&31,n[i++]=s>>>21&31,n[i++]=s>>>26&31,n[i++]=31&(s>>>31|(15&c)<<1),n[i++]=c>>>4&31,n[i++]=c>>>9&31,n[i++]=c>>>14&31,n[i++]=c>>>19&31,n[i++]=c>>>24&31,n[i++]=31&(c>>>29|(3&l)<<3),n[i++]=l>>>2&31,n[i++]=l>>>7&31,n[i++]=l>>>12&31,n[i++]=l>>>17&31,n[i++]=l>>>22&31,n[i]=l>>>27&31})(e,t,n,r);return;case 6:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0;n[i++]=a>>>0&63,n[i++]=a>>>6&63,n[i++]=a>>>12&63,n[i++]=a>>>18&63,n[i++]=a>>>24&63,n[i++]=63&(a>>>30|(15&o)<<2),n[i++]=o>>>4&63,n[i++]=o>>>10&63,n[i++]=o>>>16&63,n[i++]=o>>>22&63,n[i++]=63&(o>>>28|(3&s)<<4),n[i++]=s>>>2&63,n[i++]=s>>>8&63,n[i++]=s>>>14&63,n[i++]=s>>>20&63,n[i++]=s>>>26&63,n[i++]=c>>>0&63,n[i++]=c>>>6&63,n[i++]=c>>>12&63,n[i++]=c>>>18&63,n[i++]=c>>>24&63,n[i++]=63&(c>>>30|(15&l)<<2),n[i++]=l>>>4&63,n[i++]=l>>>10&63,n[i++]=l>>>16&63,n[i++]=l>>>22&63,n[i++]=63&(l>>>28|(3&u)<<4),n[i++]=u>>>2&63,n[i++]=u>>>8&63,n[i++]=u>>>14&63,n[i++]=u>>>20&63,n[i]=u>>>26&63})(e,t,n,r);return;case 7:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0;n[i++]=a>>>0&127,n[i++]=a>>>7&127,n[i++]=a>>>14&127,n[i++]=a>>>21&127,n[i++]=127&(a>>>28|(7&o)<<4),n[i++]=o>>>3&127,n[i++]=o>>>10&127,n[i++]=o>>>17&127,n[i++]=o>>>24&127,n[i++]=127&(o>>>31|(63&s)<<1),n[i++]=s>>>6&127,n[i++]=s>>>13&127,n[i++]=s>>>20&127,n[i++]=127&(s>>>27|(3&c)<<5),n[i++]=c>>>2&127,n[i++]=c>>>9&127,n[i++]=c>>>16&127,n[i++]=c>>>23&127,n[i++]=127&(c>>>30|(31&l)<<2),n[i++]=l>>>5&127,n[i++]=l>>>12&127,n[i++]=l>>>19&127,n[i++]=127&(l>>>26|(1&u)<<6),n[i++]=u>>>1&127,n[i++]=u>>>8&127,n[i++]=u>>>15&127,n[i++]=u>>>22&127,n[i++]=127&(u>>>29|(15&d)<<3),n[i++]=d>>>4&127,n[i++]=d>>>11&127,n[i++]=d>>>18&127,n[i]=d>>>25&127})(e,t,n,r);return;case 8:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0,f=e[t+7]>>>0;n[i++]=a>>>0&255,n[i++]=a>>>8&255,n[i++]=a>>>16&255,n[i++]=a>>>24&255,n[i++]=o>>>0&255,n[i++]=o>>>8&255,n[i++]=o>>>16&255,n[i++]=o>>>24&255,n[i++]=s>>>0&255,n[i++]=s>>>8&255,n[i++]=s>>>16&255,n[i++]=s>>>24&255,n[i++]=c>>>0&255,n[i++]=c>>>8&255,n[i++]=c>>>16&255,n[i++]=c>>>24&255,n[i++]=l>>>0&255,n[i++]=l>>>8&255,n[i++]=l>>>16&255,n[i++]=l>>>24&255,n[i++]=u>>>0&255,n[i++]=u>>>8&255,n[i++]=u>>>16&255,n[i++]=u>>>24&255,n[i++]=d>>>0&255,n[i++]=d>>>8&255,n[i++]=d>>>16&255,n[i++]=d>>>24&255,n[i++]=f>>>0&255,n[i++]=f>>>8&255,n[i++]=f>>>16&255,n[i]=f>>>24&255})(e,t,n,r);return;case 9:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0,f=e[t+7]>>>0,p=e[t+8]>>>0;n[i++]=a>>>0&511,n[i++]=a>>>9&511,n[i++]=a>>>18&511,n[i++]=511&(a>>>27|(15&o)<<5),n[i++]=o>>>4&511,n[i++]=o>>>13&511,n[i++]=o>>>22&511,n[i++]=511&(o>>>31|(255&s)<<1),n[i++]=s>>>8&511,n[i++]=s>>>17&511,n[i++]=511&(s>>>26|(7&c)<<6),n[i++]=c>>>3&511,n[i++]=c>>>12&511,n[i++]=c>>>21&511,n[i++]=511&(c>>>30|(127&l)<<2),n[i++]=l>>>7&511,n[i++]=l>>>16&511,n[i++]=511&(l>>>25|(3&u)<<7),n[i++]=u>>>2&511,n[i++]=u>>>11&511,n[i++]=u>>>20&511,n[i++]=511&(u>>>29|(63&d)<<3),n[i++]=d>>>6&511,n[i++]=d>>>15&511,n[i++]=511&(d>>>24|(1&f)<<8),n[i++]=f>>>1&511,n[i++]=f>>>10&511,n[i++]=f>>>19&511,n[i++]=511&(f>>>28|(31&p)<<4),n[i++]=p>>>5&511,n[i++]=p>>>14&511,n[i]=p>>>23&511})(e,t,n,r);return;case 10:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0,f=e[t+7]>>>0,p=e[t+8]>>>0,m=e[t+9]>>>0;n[i++]=a>>>0&1023,n[i++]=a>>>10&1023,n[i++]=a>>>20&1023,n[i++]=1023&(a>>>30|(255&o)<<2),n[i++]=o>>>8&1023,n[i++]=o>>>18&1023,n[i++]=1023&(o>>>28|(63&s)<<4),n[i++]=s>>>6&1023,n[i++]=s>>>16&1023,n[i++]=1023&(s>>>26|(15&c)<<6),n[i++]=c>>>4&1023,n[i++]=c>>>14&1023,n[i++]=1023&(c>>>24|(3&l)<<8),n[i++]=l>>>2&1023,n[i++]=l>>>12&1023,n[i++]=l>>>22&1023,n[i++]=u>>>0&1023,n[i++]=u>>>10&1023,n[i++]=u>>>20&1023,n[i++]=1023&(u>>>30|(255&d)<<2),n[i++]=d>>>8&1023,n[i++]=d>>>18&1023,n[i++]=1023&(d>>>28|(63&f)<<4),n[i++]=f>>>6&1023,n[i++]=f>>>16&1023,n[i++]=1023&(f>>>26|(15&p)<<6),n[i++]=p>>>4&1023,n[i++]=p>>>14&1023,n[i++]=1023&(p>>>24|(3&m)<<8),n[i++]=m>>>2&1023,n[i++]=m>>>12&1023,n[i]=m>>>22&1023})(e,t,n,r);return;case 11:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0,f=e[t+7]>>>0,p=e[t+8]>>>0,m=e[t+9]>>>0,h=e[t+10]>>>0;n[i++]=a>>>0&2047,n[i++]=a>>>11&2047,n[i++]=2047&(a>>>22|(1&o)<<10),n[i++]=o>>>1&2047,n[i++]=o>>>12&2047,n[i++]=2047&(o>>>23|(3&s)<<9),n[i++]=s>>>2&2047,n[i++]=s>>>13&2047,n[i++]=2047&(s>>>24|(7&c)<<8),n[i++]=c>>>3&2047,n[i++]=c>>>14&2047,n[i++]=2047&(c>>>25|(15&l)<<7),n[i++]=l>>>4&2047,n[i++]=l>>>15&2047,n[i++]=2047&(l>>>26|(31&u)<<6),n[i++]=u>>>5&2047,n[i++]=u>>>16&2047,n[i++]=2047&(u>>>27|(63&d)<<5),n[i++]=d>>>6&2047,n[i++]=d>>>17&2047,n[i++]=2047&(d>>>28|(127&f)<<4),n[i++]=f>>>7&2047,n[i++]=f>>>18&2047,n[i++]=2047&(f>>>29|(255&p)<<3),n[i++]=p>>>8&2047,n[i++]=p>>>19&2047,n[i++]=2047&(p>>>30|(511&m)<<2),n[i++]=m>>>9&2047,n[i++]=m>>>20&2047,n[i++]=2047&(m>>>31|(1023&h)<<1),n[i++]=h>>>10&2047,n[i]=h>>>21&2047})(e,t,n,r);return;case 12:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0,f=e[t+7]>>>0,p=e[t+8]>>>0,m=e[t+9]>>>0,h=e[t+10]>>>0,g=e[t+11]>>>0;n[i++]=a>>>0&4095,n[i++]=a>>>12&4095,n[i++]=4095&(a>>>24|(15&o)<<8),n[i++]=o>>>4&4095,n[i++]=o>>>16&4095,n[i++]=4095&(o>>>28|(255&s)<<4),n[i++]=s>>>8&4095,n[i++]=s>>>20&4095,n[i++]=c>>>0&4095,n[i++]=c>>>12&4095,n[i++]=4095&(c>>>24|(15&l)<<8),n[i++]=l>>>4&4095,n[i++]=l>>>16&4095,n[i++]=4095&(l>>>28|(255&u)<<4),n[i++]=u>>>8&4095,n[i++]=u>>>20&4095,n[i++]=d>>>0&4095,n[i++]=d>>>12&4095,n[i++]=4095&(d>>>24|(15&f)<<8),n[i++]=f>>>4&4095,n[i++]=f>>>16&4095,n[i++]=4095&(f>>>28|(255&p)<<4),n[i++]=p>>>8&4095,n[i++]=p>>>20&4095,n[i++]=m>>>0&4095,n[i++]=m>>>12&4095,n[i++]=4095&(m>>>24|(15&h)<<8),n[i++]=h>>>4&4095,n[i++]=h>>>16&4095,n[i++]=4095&(h>>>28|(255&g)<<4),n[i++]=g>>>8&4095,n[i]=g>>>20&4095})(e,t,n,r);return;case 16:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0,f=e[t+7]>>>0,p=e[t+8]>>>0,m=e[t+9]>>>0,h=e[t+10]>>>0,g=e[t+11]>>>0,_=e[t+12]>>>0,v=e[t+13]>>>0,y=e[t+14]>>>0,b=e[t+15]>>>0;n[i++]=a>>>0&65535,n[i++]=a>>>16&65535,n[i++]=o>>>0&65535,n[i++]=o>>>16&65535,n[i++]=s>>>0&65535,n[i++]=s>>>16&65535,n[i++]=c>>>0&65535,n[i++]=c>>>16&65535,n[i++]=l>>>0&65535,n[i++]=l>>>16&65535,n[i++]=u>>>0&65535,n[i++]=u>>>16&65535,n[i++]=d>>>0&65535,n[i++]=d>>>16&65535,n[i++]=f>>>0&65535,n[i++]=f>>>16&65535,n[i++]=p>>>0&65535,n[i++]=p>>>16&65535,n[i++]=m>>>0&65535,n[i++]=m>>>16&65535,n[i++]=h>>>0&65535,n[i++]=h>>>16&65535,n[i++]=g>>>0&65535,n[i++]=g>>>16&65535,n[i++]=_>>>0&65535,n[i++]=_>>>16&65535,n[i++]=v>>>0&65535,n[i++]=v>>>16&65535,n[i++]=y>>>0&65535,n[i++]=y>>>16&65535,n[i++]=b>>>0&65535,n[i]=b>>>16&65535})(e,t,n,r);return;case 32:for(let i=0;i<32;i=i+1|0)n[r+i|0]=0|e[t+i|0];return}let a=cp[i]>>>0,o=t,s=0,c=e[o]>>>0;for(let t=0;t<32;t++)if(s+i<=32)n[r+t]=c>>>s&a,s+=i,s===32&&(s=0,o++,t!==31&&(c=e[o]>>>0));else{let l=32-s,u=c>>>s;o++,c=e[o]>>>0,n[r+t]=(u|(c&cp[i-l]>>>0)<<l)&a,s=i-l}}function yp(e,t,n){let r=new Uint32Array(n),i=0,a=t.get();for(let t=0;t<r.length;t++){let t=e[a++],n=127&t;t<128||(t=e[a++],n|=(127&t)<<7,t<128||(t=e[a++],n|=(127&t)<<14,t<128||(t=e[a++],n|=(127&t)<<21,t<128||(t=e[a++],n|=(15&t)<<28)))),r[i++]=n}return t.set(a),r}function bp(e,t,n){let r=new BigUint64Array(n);for(let n=0;n<r.length;n++)r[n]=xp(e,t);return r}function xp(e,t){let n=0n,r=0,i=t.get();for(;i<e.length;){let t=e[i++];if(n|=BigInt(127&t)<<BigInt(r),!(128&t))break;if(r+=7,r>=64)throw Error(`Varint too long`)}return t.set(i),n}function Sp(e,t){let n,r;return r=e[t.get()],t.increment(),n=127&r,r<128?n:(r=e[t.get()],t.increment(),n|=(127&r)<<7,r<128?n:(r=e[t.get()],t.increment(),n|=(127&r)<<14,r<128?n:(r=e[t.get()],t.increment(),n|=(127&r)<<21,r<128?n:(r=e[t.get()],n|=(15&r)<<28,function(e,t,n){let r,i;if(i=t[n.get()],n.increment(),r=(112&i)>>4,i<128||(i=t[n.get()],n.increment(),r|=(127&i)<<3,i<128)||(i=t[n.get()],n.increment(),r|=(127&i)<<10,i<128)||(i=t[n.get()],n.increment(),r|=(127&i)<<17,i<128)||(i=t[n.get()],n.increment(),r|=(127&i)<<24,i<128)||(i=t[n.get()],n.increment(),r|=(1&i)<<31,i<128))return 4294967296*r+(e>>>0);throw Error(`Expected varint not more than 10 bytes`)}(n,e,t)))))}function $(e){return e>>>1^-(1&e)}function Cp(e){return e>>1n^-(1n&e)}function wp(e){return e%2==1?(e+1)/-2:e/2}function Tp(e,t,n){if(n===void 0){n=0;for(let r=0;r<t;r++)n+=e[r]}let r=new Uint32Array(n),i=0;for(let n=0;n<t;n++){let a=e[n];r.fill(e[n+t],i,i+a),i+=a}return r}function Ep(e,t,n){if(n===void 0){n=0;for(let r=0;r<t;r++)n+=Number(e[r])}let r=new BigUint64Array(n),i=0;for(let n=0;n<t;n++){let a=Number(e[n]);r.fill(e[n+t],i,i+a),i+=a}return r}function Dp(e,t,n){let r=new Float64Array(n),i=0;for(let n=0;n<t;n++){let a=e[n];r.fill(e[n+t],i,i+a),i+=a}return r}function Op(e){let t=new Int32Array(e.length);t[0]=$(e[0]);let n=e.length/4*4,r=1;if(n>=4)for(;r<n-4;r+=4){let n=e[r+1],i=e[r+2],a=e[r+3];t[r]=$(e[r])+t[r-1],t[r+1]=$(n)+t[r],t[r+2]=$(i)+t[r+1],t[r+3]=$(a)+t[r+2]}for(;r!==e.length;++r)t[r]=$(e[r])+t[r-1];return t}function kp(e){let t=new BigInt64Array(e.length);t[0]=Cp(e[0]);let n=e.length/4*4,r=1;if(n>=4)for(;r<n-4;r+=4){let n=e[r+1],i=e[r+2],a=e[r+3];t[r]=Cp(e[r])+t[r-1],t[r+1]=Cp(n)+t[r],t[r+2]=Cp(i)+t[r+1],t[r+3]=Cp(a)+t[r+2]}for(;r!==t.length;++r)t[r]=Cp(e[r])+t[r-1];return t}function Ap(e){let t=e.length/4*4,n=1;if(t>=4)for(let r=e[0];n<t-4;n+=4)r=e[n]+=r,r=e[n+1]+=r,r=e[n+2]+=r,r=e[n+3]+=r;for(;n!==e.length;)e[n]+=e[n-1],++n}var jp,Mp,Np,Pp,Fp,Ip,Lp,Rp;function zp(e,t){let n=function(e,t){let n=e[t.get()],r=Object.values(jp)[n>>4],i=null;switch(r){case jp.DATA:i={dictionaryType:Object.values(Mp)[15&n]};break;case jp.OFFSET:i={offsetType:Object.values(Np)[15&n]};break;case jp.LENGTH:i={lengthType:Object.values(Pp)[15&n]}}t.increment();let a=e[t.get()],o=Object.values(Q)[a>>5],s=Object.values(Q)[a>>2&7],c=Object.values(op)[3&a];t.increment();let l=yp(e,t,2),u=l[0];return{physicalStreamType:r,logicalStreamType:i,logicalLevelTechnique1:o,logicalLevelTechnique2:s,physicalLevelTechnique:c,numValues:u,byteLength:l[1],decompressedCount:u}}(e,t);return n.logicalLevelTechnique1===Q.MORTON?function(e,t,n){let r=yp(t,n,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:e.decompressedCount,numBits:r[0],coordinateShift:r[1]}}(n,e,t):Q.RLE!==n.logicalLevelTechnique1&&Q.RLE!==n.logicalLevelTechnique2||op.NONE===n.physicalLevelTechnique?n:function(e,t,n){let r=yp(t,n,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:r[1],runs:r[0],numRleValues:r[1]}}(n,e,t)}(function(e){e.PRESENT=`PRESENT`,e.DATA=`DATA`,e.OFFSET=`OFFSET`,e.LENGTH=`LENGTH`})(jp||={}),function(e){e.NONE=`NONE`,e.SINGLE=`SINGLE`,e.SHARED=`SHARED`,e.VERTEX=`VERTEX`,e.MORTON=`MORTON`,e.FSST=`FSST`}(Mp||={}),function(e){e.VERTEX=`VERTEX`,e.INDEX=`INDEX`,e.STRING=`STRING`,e.KEY=`KEY`}(Np||={}),function(e){e.VAR_BINARY=`VAR_BINARY`,e.GEOMETRIES=`GEOMETRIES`,e.PARTS=`PARTS`,e.RINGS=`RINGS`,e.TRIANGLES=`TRIANGLES`,e.SYMBOL=`SYMBOL`,e.DICTIONARY=`DICTIONARY`}(Pp||={}),function(e){e[e.FLAT=0]=`FLAT`,e[e.CONST=1]=`CONST`,e[e.SEQUENCE=2]=`SEQUENCE`,e[e.DICTIONARY=3]=`DICTIONARY`,e[e.FSST_DICTIONARY=4]=`FSST_DICTIONARY`}(Fp||={});class Bp{constructor(e,t){this.values=e,this._size=t}get(e){let t=Math.floor(e/8);return(this.values[t]>>e%8&1)==1}set(e,t){let n=Math.floor(e/8);this.values[n]=this.values[n]|!!t<<e%8}getInt(e){let t=Math.floor(e/8);return this.values[t]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}function Vp(e,t,n){if(!t)return e;let r=t.size(),i=new e.constructor(r),a=0;for(let o=0;o<r;o++)i[o]=t.get(o)?e[a++]:n;return i}function Hp(e,t,n,r,i){return function(e,t,n,r){let i;switch(t.logicalLevelTechnique1){case Q.DELTA:if(t.logicalLevelTechnique2===Q.RLE){let n=t;if(!r)return function(e,t,n){let r=new Int32Array(n),i=0,a=0;for(let n=0;n<t;n++){let o=e[n],s=$(e[n+t]);for(let e=0;e<o;e++)a+=s,r[i++]=a}return r}(e,n.runs,n.numRleValues);i=Op(e=Tp(e,n.runs,n.numRleValues))}else i=Op(e);break;case Q.RLE:i=function(e,t,n){if(n===void 0){n=0;for(let r=0;r<t;r++)n+=e[r]}let r=new Int32Array(n),i=0;for(let n=0;n<t;n++){let a=e[n],o=e[n+t];o=$(o),r.fill(o,i,i+a),i+=a}return r}(e,t.runs,t.numRleValues);break;case Q.MORTON:Ap(e),i=new Int32Array(e);break;case Q.COMPONENTWISE_DELTA:i=function(e){if(e.length<2)return new Int32Array(e);let t=new Int32Array(e.length);t[0]=$(e[0]),t[1]=$(e[1]);let n=e.length/4*4,r=2;if(n>=4)for(;r<n-4;r+=4){let n=e[r+1],i=e[r+2],a=e[r+3];t[r]=$(e[r])+t[r-2],t[r+1]=$(n)+t[r-1],t[r+2]=$(i)+t[r],t[r+3]=$(a)+t[r+1]}for(;r!==e.length;r+=2)t[r]=$(e[r])+t[r-2],t[r+1]=$(e[r+1])+t[r-1];return t}(e);break;case Q.NONE:i=function(e){let t=new Int32Array(e.length);for(let n=0;n<e.length;n++)t[n]=$(e[n]);return t}(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?Vp(i,r,0):i}(Gp(e,t,n),n,0,i)}function Up(e,t,n,r,i){return function(e,t,n,r){let i;switch(t.logicalLevelTechnique1){case Q.DELTA:i=function(e){let t=new Uint32Array(e.length);t[0]=$(e[0])>>>0;for(let n=1;n<e.length;n++)t[n]=t[n-1]+$(e[n])>>>0;return t}(t.logicalLevelTechnique2===Q.RLE?Tp(e,t.runs,t.numRleValues):e);break;case Q.RLE:i=Tp(e,t.runs,t.numRleValues);break;case Q.MORTON:Ap(e),i=e;break;case Q.COMPONENTWISE_DELTA:i=function(e){if(e.length<2)return new Uint32Array(e);let t=new Uint32Array(e.length);t[0]=$(e[0])>>>0,t[1]=$(e[1])>>>0;for(let n=2;n<e.length;n+=2)t[n]=t[n-2]+$(e[n])>>>0,t[n+1]=t[n-1]+$(e[n+1])>>>0;return t}(e);break;case Q.NONE:i=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?Vp(i,r,0):i}(Gp(e,t,n),n,0,i)}function Wp(e,t,n){return function(e,t){if(t.logicalLevelTechnique1===Q.DELTA&&t.logicalLevelTechnique2===Q.NONE)return function(e){let t=new Int32Array(e.length+1);t[0]=0,t[1]=$(e[0]);let n=t[1];for(let r=2;r!==t.length;++r)n+=$(e[r-1]),t[r]=t[r-1]+n;return new Uint32Array(t)}(e);if(t.logicalLevelTechnique1===Q.RLE&&t.logicalLevelTechnique2===Q.NONE)return function(e,t,n){let r=new Uint32Array(n+1);r[0]=0;let i=1,a=r[0];for(let n=0;n<t;n++){let o=e[n],s=e[n+t];for(let e=i;e<i+o;e++)r[e]=s+a,a=r[e];i+=o}return r}(e,t.runs,t.numRleValues);if(t.logicalLevelTechnique1===Q.NONE&&t.logicalLevelTechnique2===Q.NONE){(function(e){let t=0;for(let n=0;n<e.length;n++)e[n]+=t,t=e[n]})(e);let n=new Uint32Array(t.numValues+1);return n[0]=0,n.set(e,1),n}if(t.logicalLevelTechnique1===Q.DELTA&&t.logicalLevelTechnique2===Q.RLE){let n=function(e,t,n){let r=new Int32Array(n+1);r[0]=0;let i=1,a=r[0];for(let n=0;n<t;n++){let o=e[n],s=e[n+t];s=$(s);for(let e=i;e<i+o;e++)r[e]=s+a,a=r[e];i+=o}return r}(e,t.runs,t.numRleValues);return Ap(n),new Uint32Array(n)}throw Error(`Only delta encoding is supported for transforming length to offset streams yet.`)}(Gp(e,t,n),n)}function Gp(e,t,n){let r=n.physicalLevelTechnique;switch(r){case op.FAST_PFOR:return function(e,t,n,r){return function(e,t,n,r,i){let a=r.get();if(3&n)throw Error(`FastPFOR: invalid encodedByteLength=${n} at offset=${a} (encodedBytes.length=${e.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let o=n>>>2,s=function(e,t){if(t<=e.encodedWords.length)return e.encodedWords;let n=new Uint32Array(Math.max(16,2*t));return e.encodedWords=n,n}(i,o);(function(e,t,n,r){if(t<0||n<0||t+n>e.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${t}, byteLength=${n}, bytes.length=${e.length})`);let i=Math.floor(n/4),a=n%4!=0,o=a?i+1:i;if(r.length<o)throw RangeError(`decodeBigEndianInt32sInto: out.length=${r.length} < ${o}`);if(i>0){let n=e.byteOffset+t;if(3&n)for(let n=0;n<i;n++){let i=t+4*n;r[n]=e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3]}else{let t=new Uint32Array(e.buffer,n,i);for(let e=0;e<i;e++)r[e]=0|up(t[e])}}if(a){let a=t+4*i,o=n-4*i,s=0;for(let t=0;t<o;t++)s|=e[a+t]<<24-8*t;r[i]=0|s}})(e,a,n,s);let c=function(e,t,n){let r=0,i=0,a=new Uint32Array(t),o=n??pp();if(e.length>0){let t=0|e[r];if(r=r+1|0,255&t)throw Error(`FastPFOR decode: invalid alignedLength=${t} (expected multiple of 256)`);if(i+t>a.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${i}, alignedLength=${t}, out.length=${a.length})`);r=function(e,t,n,r,i,a){let o=r+lp(i,256),s=r,c=n;for(;s!==o;){let n=Math.min(dp,o-s);c=_p(e,t,c,s,n,a),s=s+n|0}return c}(e,a,r,i,t,o),i=i+t|0}return function(e,t,n,r,i,a){if(a===0)return t;let o=0,s=t,c=t+n,l=i,u=i,d=i+a,f=0,p=0;for(;s<c&&u<d;){let t=e[s]>>>o&255;if(o+=8,s+=o>>>5,o&=31,f|=(127&t)<<p,128&t)r[u++]=0|f,f=0,p=0;else if(p+=7,p>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${p}, partial=${f}, decoded=${u-l}/${a}, inPos=${s}, inEnd=${c})`)}if(u!==d)throw Error(`FastPFOR VByte: truncated stream (decoded=${u-l}, expected=${a}, consumedWords=${s-t}/${n}, vbyteStart=${t}, vbyteEnd=${c})`)}(e,r,e.length-r|0,a,i,t-i|0),a}(s.subarray(0,o),t,i.decoderWorkspace);return r.add(n),c}(e,t,n,r,function(e=16){if(e<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${e}`);let t=Math.max(16,0|e);return{encodedWords:new Uint32Array(t),decoderWorkspace:pp()}}(n>>>2))}(e,n.numValues,n.byteLength,t);case op.VARINT:return yp(e,t,n.numValues);case op.NONE:{let r=t.get();t.add(n.byteLength);let i=e.subarray(r,t.get());return new Uint32Array(i)}default:throw Error(`Specified physicalLevelTechnique ${r} is not supported (yet).`)}}function Kp(e,t,n){let r=Gp(e,t,n);return r.length===1?r[0]:function(e){return e[1]}(r)}function qp(e,t,n){return function(e){if(e.length===2){let t=$(e[1]);return[t,t]}return[$(e[2]),$(e[3])]}(Gp(e,t,n))}function Jp(e,t,n){return function(e){if(e.length===2){let t=Cp(e[1]);return[t,t]}return[Cp(e[2]),Cp(e[3])]}(bp(e,t,n.numValues))}function Yp(e,t,n,r){return function(e,t,n){let r;switch(t.logicalLevelTechnique1){case Q.DELTA:r=function(e){let t=new BigUint64Array(e.length);t[0]=BigInt.asUintN(64,Cp(e[0]));for(let n=1;n<e.length;n++)t[n]=BigInt.asUintN(64,t[n-1]+Cp(e[n]));return t}(t.logicalLevelTechnique2===Q.RLE?Ep(e,t.runs,t.numRleValues):e);break;case Q.RLE:r=Ep(e,t.runs,t.numRleValues);break;case Q.NONE:r=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return n?Vp(r,n,0n):r}(bp(e,t,n.numValues),n,r)}function Xp(e,t,n){let r=bp(e,t,n.numValues);return r.length===1?r[0]:function(e){return e[1]}(r)}function Zp(e,t,n,r,i=`int32`){let a=e.logicalLevelTechnique1;if(a===Q.RLE)return e.runs===1?Fp.CONST:Fp.FLAT;if(a!==Q.DELTA||e.logicalLevelTechnique2!==Q.RLE)return e.numValues===1?Fp.CONST:Fp.FLAT;let o=t instanceof Bp?t.size():t;if(e.numRleValues!==o)return Fp.FLAT;if(e.runs===1)return Fp.SEQUENCE;if(e.runs!==2)return e.numValues===1?Fp.CONST:Fp.FLAT;let s=r.get();if(e.physicalLevelTechnique===op.VARINT)return function(e,t,n){let r=new ap(t.get());if(n===`int64`){let t=bp(e,r,4);return t[2]===2n&&t[3]===2n}let i=yp(e,r,4);return i[2]===2&&i[3]===2}(n,r,i)?Fp.SEQUENCE:e.numValues===1?Fp.CONST:Fp.FLAT;let c=r.get(),l=new Int32Array(n.buffer,n.byteOffset+c,4);return r.set(s),l[2]===2&&l[3]===2?Fp.SEQUENCE:e.numValues===1?Fp.CONST:Fp.FLAT}class Qp extends Qf{getValueFromBuffer(e){return this.dataBuffer[e]}}class $p extends tp{constructor(e,t,n,r){super(e,BigInt64Array.of(t),n,r)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}function em(e,t,n){return{x:tm(e,t)-n,y:tm(e>>1,t)-n}}function tm(e,t){let n=0;for(let r=0;r<t;r++)n|=(e&1<<2*r)>>r;return n}function nm(e,t,r,i,a,o,s){return e===Rp.MORTON?function(e,t,r,i,a,o){let s=Array(a?i+1:i);for(let a=0;a<i;a++){let i=em(e[t[r+a]],o.numBits,o.coordinateShift);s[a]=new n(i.x,i.y)}return a&&(s[s.length-1]=s[0]),s}(t,r,i,a,o,s):function(e,t,r,i,a){let o=Array(a?i+1:i);for(let a=0;a<2*i;a+=2){let i=2*t[r+a/2];o[a/2]=new n(e[i],e[i+1])}return a&&(o[o.length-1]=o[0]),o}(t,r,i,a,o)}function rm(e,t,r,i){let a=Array(i?r+1:r);for(let i=0;i<2*r;i+=2)a[i/2]=new n(e[t+i],e[t+i+1]);return i&&(a[a.length-1]=a[0]),a}(function(e){e[e.POINT=0]=`POINT`,e[e.LINESTRING=1]=`LINESTRING`,e[e.POLYGON=2]=`POLYGON`,e[e.MULTIPOINT=3]=`MULTIPOINT`,e[e.MULTILINESTRING=4]=`MULTILINESTRING`,e[e.MULTIPOLYGON=5]=`MULTIPOLYGON`})(Ip||={}),function(e){e[e.POINT=0]=`POINT`,e[e.LINESTRING=1]=`LINESTRING`,e[e.POLYGON=2]=`POLYGON`}(Lp||={}),function(e){e[e.MORTON=0]=`MORTON`,e[e.VEC_2=1]=`VEC_2`,e[e.VEC_3=2]=`VEC_3`}(Rp||={});class im{constructor(e,t,n,r,i){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=n,this._vertexBuffer=r,this._mortonSettings=i}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){let t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){let t=em(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[t.x,t.y]}let t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getGeometries(){return function(e){let t=Array(e.numGeometries),r=1,i=1,a=1,o=0,s=0,c=0,l=e.mortonSettings,u=e.topologyVector,d=u.geometryOffsets,f=u.partOffsets,p=u.ringOffsets,m=e.vertexOffsets,h=!m||m.length===0,g=e.containsPolygonGeometry(),_=e.vertexBuffer;for(let u=0;u<e.numGeometries;u++)switch(e.geometryType(u)){case Ip.POINT:{let u,g;if(h)u=_[s++],g=_[s++];else if(e.vertexBufferType===Rp.MORTON){let e=em(_[m[c++]],l.numBits,l.coordinateShift);u=e.x,g=e.y}else{let e=2*m[c++];u=_[e],g=_[e+1]}t[o++]=[[new n(u,g)]],d&&a++,f&&r++,p&&i++}break;case Ip.MULTIPOINT:{let e=d[a]-d[a-1];a++;let l=Array(e);if(h)for(let t=0;t<e;t++){let e=_[s++],r=_[s++];l[t]=new n(e,r)}else for(let t=0;t<e;t++){let e=2*m[c++];l[t]=new n(_[e],_[e+1])}t[o++]=l.map((e=>[e])),r+=e,i+=e}break;case Ip.LINESTRING:{let n,u;g?(n=p[i]-p[i-1],i++):n=f[r]-f[r-1],r++,h?(u=rm(_,s,n,!1),s+=2*n):(u=nm(e.vertexBufferType,_,m,c,n,!1,l),c+=n),t[o++]=[u],d&&a++}break;case Ip.POLYGON:{let n=f[r]-f[r-1];r++;let u=Array(n-1),g,v=p[i]-p[i-1];if(i++,h){g=rm(_,s,v,!0),s+=2*v;for(let e=0;e<u.length;e++)v=p[i]-p[i-1],i++,u[e]=rm(_,s,v,!0),s+=2*v}else{g=nm(e.vertexBufferType,_,m,c,v,!0,l),c+=v;for(let t=0;t<u.length;t++)v=p[i]-p[i-1],i++,u[t]=nm(e.vertexBufferType,_,m,c,v,!0,l),c+=v}t[o++]=[g].concat(u),d&&a++}break;case Ip.MULTILINESTRING:{let n=d[a]-d[a-1];a++;let u=Array(n);for(let t=0;t<n;t++){let n;g?(n=p[i]-p[i-1],i++):n=f[r]-f[r-1],r++,h?(u[t]=rm(_,s,n,!1),s+=2*n):(u[t]=nm(e.vertexBufferType,_,m,c,n,!1,l),c+=n)}t[o++]=u}break;case Ip.MULTIPOLYGON:{let n=d[a]-d[a-1];a++;let u=Array(n);for(let t=0;t<n;t++){let n=f[r]-f[r-1],a;r++;let o=Array(n-1),d=p[i]-p[i-1];i++,h?(a=rm(_,s,d,!0),s+=2*d):(a=nm(e.vertexBufferType,_,m,c,d,!0,l),c+=d);for(let t=0;t<o.length;t++){let n=p[i]-p[i-1];i++,h?(o[t]=rm(_,s,n,!0),s+=2*n):(o[t]=nm(e.vertexBufferType,_,m,c,n,!0,l),c+=n)}u[t]=[a].concat(o)}t[o++]=u.flat()}break;default:throw Error(`The specified geometry type is currently not supported.`)}return t}(this)}get mortonSettings(){return this._mortonSettings}}class am extends im{constructor(e,t,n,r,i,a,o){super(n,r,i,a,o),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===Ip.POLYGON||this._geometryType===Ip.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class om extends im{constructor(e,t,n,r,i,a){super(e,n,r,i,a),this._geometryTypes=t}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===Ip.POLYGON||this.geometryType(e)===Ip.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class sm{constructor(e,t,n,r){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=n,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 e=Array(this.numGeometries),t=this._topologyVector,r=t.partOffsets,i=t.ringOffsets,a=t.geometryOffsets,o=0,s=1,c=1,l=1;for(let t=0;t<this.numGeometries;t++)switch(this.geometryType(t)){case Ip.POLYGON:{let u=r[s]-r[s-1];s++;let d=[];for(let e=0;e<u;e++){let e=i[c]-i[c-1];c++;let t=[];for(let r=0;r<e;r++){let e=this._vertexBuffer[o++],r=this._vertexBuffer[o++];t.push(new n(e,r))}t.length>0&&t.push(t[0]),d.push(t)}e[t]=d,a&&l++}break;case Ip.MULTIPOLYGON:{let u=a[l]-a[l-1];l++;let d=[];for(let e=0;e<u;e++){let e=r[s]-r[s-1];s++;for(let t=0;t<e;t++){let e=i[c]-i[c-1];c++;let t=[];for(let r=0;r<e;r++){let e=this._vertexBuffer[o++],r=this._vertexBuffer[o++];t.push(new n(e,r))}t.length>0&&t.push(t[0]),d.push(t)}}e[t]=d}}return e}[Symbol.iterator](){return null}}function cm(e,t,n,r,i,a){return new lm(e,t,n,r,i,a)}class lm extends sm{constructor(e,t,n,r,i,a){super(n,r,i,a),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function um(e,t,n,r,i){return new dm(e,t,n,r,i)}class dm extends sm{constructor(e,t,n,r,i){super(t,n,r,i),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function fm(e,t,n,r,i){let a=zp(e,n),o,s,c,l;if(Zp(a,r,e,n)===Fp.CONST){let i=Kp(e,n,a),u,d,f,p;for(let r=0;r<t-1;r++){let t=zp(e,n);switch(t.physicalStreamType){case jp.LENGTH:switch(t.logicalStreamType.lengthType){case Pp.GEOMETRIES:u=Wp(e,n,t);break;case Pp.PARTS:d=Wp(e,n,t);break;case Pp.RINGS:f=Wp(e,n,t);break;case Pp.TRIANGLES:p=Wp(e,n,t)}break;case jp.OFFSET:switch(t.logicalStreamType.offsetType){case Np.VERTEX:o=Up(e,n,t);break;case Np.INDEX:l=Up(e,n,t)}break;case jp.DATA:Mp.VERTEX===t.logicalStreamType.dictionaryType?s=Hp(e,n,t):(c={numBits:t.numBits,coordinateShift:t.coordinateShift},s=Up(e,n,t))}}return l?u!==void 0||d!==void 0?cm(r,i,p,l,s,{geometryOffsets:u,partOffsets:d,ringOffsets:f}):cm(r,i,p,l,s):c===void 0?function(e,t,n,r,i){return new am(e,t,Rp.VEC_2,n,r,i)}(r,i,{geometryOffsets:u,partOffsets:d,ringOffsets:f},o,s):function(e,t,n,r,i,a){return new am(e,t,Rp.MORTON,n,r,i,a)}(r,i,{geometryOffsets:u,partOffsets:d,ringOffsets:f},o,s,c)}let u=Up(e,n,a),d,f,p,m,h,g,_;for(let r=0;r<t-1;r++){let t=zp(e,n);switch(t.physicalStreamType){case jp.LENGTH:switch(t.logicalStreamType.lengthType){case Pp.GEOMETRIES:d=Up(e,n,t);break;case Pp.PARTS:f=Up(e,n,t);break;case Pp.RINGS:p=Up(e,n,t);break;case Pp.TRIANGLES:m=Wp(e,n,t)}break;case jp.OFFSET:switch(t.logicalStreamType.offsetType){case Np.VERTEX:o=Up(e,n,t);break;case Np.INDEX:l=Up(e,n,t)}break;case jp.DATA:Mp.VERTEX===t.logicalStreamType.dictionaryType?s=Hp(e,n,t):(c={numBits:t.numBits,coordinateShift:t.coordinateShift},s=Up(e,n,t))}}return d?(h=pm(u,d,2),f&&p?(g=mm(u,h,f,!1),_=function(e,t,n,r){let i=new Uint32Array(n[n.length-1]+1),a=0;i[0]=a;let o=1,s=1,c=0;for(let l=0;l<e.length;l++){let u=e[l],d=t[l+1]-t[l];if(u!==0&&u!==3)for(let e=0;e<d;e++){let e=n[o]-n[o-1];o++;for(let t=0;t<e;t++)a=i[s++]=a+r[c++]}else for(let e=0;e<d;e++)i[s++]=++a,o++}return i}(u,h,g,p)):f&&(g=function(e,t,n){let r=new Uint32Array(t[t.length-1]+1),i=0;r[0]=i;let a=1,o=0;for(let s=0;s<e.length;s++){let c=e[s],l=t[s+1]-t[s];if(c===4||c===1)for(let e=0;e<l;e++)i=r[a++]=i+n[o++];else for(let e=0;e<l;e++)r[a++]=++i}return r}(u,h,f))):f&&p?(g=pm(u,f,1),_=mm(u,g,p,!0)):f&&(g=pm(u,f,0)),l&&!g?um(u,m,l,s):l?um(u,m,l,s,{geometryOffsets:h,partOffsets:g,ringOffsets:_}):c===void 0?function(e,t,n,r){return new om(Rp.VEC_2,e,t,n,r)}(u,{geometryOffsets:h,partOffsets:g,ringOffsets:_},o,s):function(e,t,n,r,i){return new om(Rp.MORTON,e,t,n,r,i)}(u,{geometryOffsets:h,partOffsets:g,ringOffsets:_},o,s,c)}function pm(e,t,n){let r=new Uint32Array(e.length+1),i=0;r[0]=i;let a=0;for(let o=0;o<e.length;o++)i=r[o+1]=i+(e[o]>n?t[a++]:1);return r}function mm(e,t,n,r){let i=new Uint32Array(t[t.length-1]+1),a=0;i[0]=a;let o=1,s=0;for(let c=0;c<e.length;c++){let l=e[c],u=t[c+1]-t[c];if(l===5||l===2||r&&(l===4||l===1))for(let e=0;e<u;e++)a=i[o++]=a+n[s++];else for(let e=0;e<u;e++)i[o++]=++a}return i}class hm extends Zf{constructor(e,t,n){super(e,t.getBuffer(),n),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}}class gm extends Qf{getValueFromBuffer(e){return this.dataBuffer[e]}}class _m extends Zf{constructor(e,t,n,r){super(e,r?BigInt64Array.of(t):BigUint64Array.of(t),n)}getValueFromBuffer(e){return this.dataBuffer[0]}}function vm(e,t,n,r,i){let a=function(e,t,n,r){let i=new Uint8Array(t),a=0,o=r.get()+n;for(;a<t&&!(r.get()>=o);){let n=e[r.increment()];if(n<=127){let o=n+3,s=e[r.increment()],c=Math.min(a+o,t);i.fill(s,a,c),a=c}else{let o=256-n;for(let n=0;n<o&&a<t;n++)i[a++]=e[r.increment()]}}return r.set(o),i}(e,Math.ceil(t/8),n,r);return i?function(e,t,n){if(!n)return e;let r=n.size(),i=new Bp(e,t),a=new Bp(new Uint8Array(Math.ceil(r/8)),r),o=0;for(let e=0;e<r;e++){let t=!!n.get(e)&&i.get(o++);a.set(e,t)}return a.getBuffer()}(a,t,i):a}let ym=new TextDecoder;function bm(e,t,n){return n-t>=12?ym.decode(e.subarray(t,n)):function(e,t,n){let r=``,i=t;for(;i<n;){let t=e[i],a,o,s,c=null,l=t>239?4:t>223?3:t>191?2:1;if(i+l>n)break;l===1?t<128&&(c=t):l===2?(a=e[i+1],(192&a)==128&&(c=(31&t)<<6|63&a,c<=127&&(c=null))):l===3?(a=e[i+1],o=e[i+2],(192&a)==128&&(192&o)==128&&(c=(15&t)<<12|(63&a)<<6|63&o,(c<=2047||c>=55296&&c<=57343)&&(c=null))):l===4&&(a=e[i+1],o=e[i+2],s=e[i+3],(192&a)==128&&(192&o)==128&&(192&s)==128&&(c=(15&t)<<18|(63&a)<<12|(63&o)<<6|63&s,(c<=65535||c>=1114112)&&(c=null))),c===null?(c=65533,l=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),i+=l}return r}(e,t,n)}class xm extends Zf{constructor(e,t,n,r){super(e,n,r),this.offsetBuffer=t}}class Sm extends xm{constructor(e,t,n,r){super(e,t,n,r??t.length-1)}getValueFromBuffer(e){return bm(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class Cm extends xm{constructor(e,t,n,r,i){super(e,n,r,i??t.length),this.indexBuffer=t,this.indexBuffer=t}getValueFromBuffer(e){let t=this.indexBuffer[e];return bm(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}}class wm extends xm{constructor(e,t,n,r,i,a,o){super(e,n,r,o),this.indexBuffer=t,this.symbolOffsetBuffer=i,this.symbolTableBuffer=a}getValueFromBuffer(e){this.decodedDictionary??=(this.symbolLengthBuffer??=this.offsetToLengthBuffer(this.symbolOffsetBuffer),function(e,t,n){let r=[],i=Array(t.length).fill(0);for(let e=1;e<t.length;e++)i[e]=i[e-1]+t[e-1];for(let a=0;a<n.length;a++)if(n[a]===255)r.push(n[++a]);else{let o=t[n[a]],s=i[n[a]];for(let t=0;t<o;t++)r.push(e[s+t])}return new Uint8Array(r)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));let t=this.indexBuffer[e];return bm(this.decodedDictionary,this.offsetBuffer[t],this.offsetBuffer[t+1])}offsetToLengthBuffer(e){let t=new Uint32Array(e.length-1),n=e[0];for(let r=1;r<e.length;r++){let i=e[r];t[r-1]=i-n,n=i}return t}}function Tm(e,t,n,r,i,a){return n.type===`scalarType`?function(e,t,n,r,i,a){let o=null;if(e===0)return null;if(a.nullable){let e=zp(t,n),r=e.numValues,i=n.get(),a=vm(t,r,e.byteLength,n);n.set(i+e.byteLength),o=new Bp(a,e.numValues)}let s=o??r;switch(i.physicalType){case 4:case 3:return function(e,t,n,r,i){let a=zp(e,t),o=Zp(a,i,e,t),s=r.physicalType===3;if(o===Fp.FLAT){let r=Em(i)?i:void 0,o=s?Hp(e,t,a,0,r):Up(e,t,a,0,r);return new $f(n.name,o,i)}if(o===Fp.SEQUENCE){let r=qp(e,t,a);return new np(n.name,r[0],r[1],a.numRleValues)}let c=s?function(e,t,n){let r=Gp(e,t,n);return r.length===1?$(r[0]):function(e){return $(e[1])}(r)}(e,t,a):Kp(e,t,a);return new rp(n.name,c,i,s)}(t,n,a,i,s);case 9:return function(e,t,n,r,i){let a=null,o=null,s=null,c=null,l=null,u=i??null,d=null,f=null;for(let e=0;e<r;e++){let e=zp(t,n);switch(e.physicalStreamType){case jp.PRESENT:{let r=new Bp(vm(t,e.numValues,e.byteLength,n),e.numValues);u=i??r;break}case jp.OFFSET:o=Up(t,n,e,0,u);break;case jp.LENGTH:{let r=Wp(t,n,e);Pp.DICTIONARY===e.logicalStreamType.lengthType?a=r:Pp.SYMBOL===e.logicalStreamType.lengthType?c=r:d=r;break}case jp.DATA:{let r=t.subarray(n.get(),n.get()+e.byteLength);n.add(e.byteLength);let i=e.logicalStreamType.dictionaryType;Mp.FSST===i?l=r:Mp.SINGLE===i||Mp.SHARED===i?s=r:Mp.NONE===i&&(f=r);break}}}return function(e,t,n,r,i,a,o){return t?new wm(e,n,r,i,a,t,o):null}(e,l,o,a,s,c,u)??function(e,t,n,r,i){return t?i?new Cm(e,n,r,t,i):new Cm(e,n,r,t):null}(e,s,o,a,u)??function(e,t,n,r,i){if(!t||!n)return null;if(r)return i?new Cm(e,r,t,n,i):new Cm(e,r,t,n);if(i&&i.size()!==t.length-1){let r=new Uint32Array(i.size()),a=0;for(let e=0;e<i.size();e++)r[e]=i.get(e)?a++:0;return new Cm(e,r,t,n,i)}return i?new Sm(e,t,n,i):new Sm(e,t,n)}(e,d,f,o,u)}(a.name,t,n,a.nullable?e-1:e,o);case 0:return function(e,t,n,r,i){let a=zp(e,t),o=a.numValues,s=t.get(),c=Em(i)?i:void 0,l=vm(e,o,a.byteLength,t,c);t.set(s+a.byteLength);let u=new Bp(l,o);return new hm(n.name,u,i)}(t,n,a,0,s);case 6:case 5:return function(e,t,n,r,i){let a=zp(e,t),o=Zp(a,r,e,t,`int64`),s=i.physicalType===5;if(o===Fp.FLAT){let i=Em(r)?r:void 0,o=s?function(e,t,n,r){return function(e,t,n){let r;switch(t.logicalLevelTechnique1){case Q.DELTA:if(t.logicalLevelTechnique2===Q.RLE){let i=t;if(!n)return function(e,t,n){let r=new BigInt64Array(n),i=0,a=0n;for(let n=0;n<t;n++){let o=Number(e[n]),s=Cp(e[n+t]);for(let e=0;e<o;e++)a+=s,r[i++]=a}return r}(e,i.runs,i.numRleValues);r=kp(e=Ep(e,i.runs,i.numRleValues))}else r=kp(e);break;case Q.RLE:r=function(e,t,n){if(n===void 0){n=0;for(let r=0;r<t;r++)n+=Number(e[r])}let r=new BigInt64Array(n),i=0;for(let n=0;n<t;n++){let a=Number(e[n]),o=e[n+t];o=Cp(o),r.fill(o,i,i+a),i+=a}return r}(e,t.runs,t.numRleValues);break;case Q.NONE:r=function(e){let t=new BigInt64Array(e.length);for(let n=0;n<e.length;n++)t[n]=Cp(e[n]);return t}(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return n?Vp(r,n,0n):r}(bp(e,t,n.numValues),n,r)}(e,t,a,i):Yp(e,t,a,i);return new Qp(n.name,o,r)}if(o===Fp.SEQUENCE){let r=Jp(e,t,a);return new $p(n.name,r[0],r[1],a.numRleValues)}let c=s?function(e,t,n){let r=bp(e,t,n.numValues);return r.length===1?Cp(r[0]):function(e){return Cp(e[1])}(r)}(e,t,a):Xp(e,t,a);return new _m(n.name,c,r,s)}(t,n,a,s,i);case 7:return function(e,t,n,r){let i=zp(e,t),a=Em(r)?r:void 0,o=function(e,t,n,r){let i=t.get(),a=i+n*Float32Array.BYTES_PER_ELEMENT,o=new Uint8Array(e.subarray(i,a)).buffer,s=new Float32Array(o);return t.set(a),r?Vp(s,r,0):s}(e,t,i.numValues,a);return new gm(n.name,o,r)}(t,n,a,s);case 8:return function(e,t,n,r){let i=zp(e,t),a=Em(r)?r:void 0,o=function(e,t,n,r){let i=t.get(),a=i+n*Float64Array.BYTES_PER_ELEMENT,o=new Uint8Array(e.subarray(i,a)).buffer,s=new Float64Array(o);return t.set(a),r?Vp(s,r,0):s}(e,t,i.numValues,a);return new ep(n.name,o,r)}(t,n,a,s);default:throw Error(`The specified data type for the field is currently not supported: ${i}`)}}(r,e,t,i,n.scalarType,n):r===0?null:function(e,t,n,r){let i=null,a=null,o=null,s=null,c=!1;for(;!c;){let n=zp(e,t);switch(n.physicalStreamType){case jp.LENGTH:Pp.DICTIONARY===n.logicalStreamType.lengthType?i=Wp(e,t,n):o=Wp(e,t,n);break;case jp.DATA:Mp.SINGLE===n.logicalStreamType.dictionaryType||Mp.SHARED===n.logicalStreamType.dictionaryType?(a=e.subarray(t.get(),t.get()+n.byteLength),c=!0):s=e.subarray(t.get(),t.get()+n.byteLength),t.add(n.byteLength)}}let l=n.complexType.children,u=[],d=0;for(let c of l){let l=yp(e,t,1)[0];if(l===0)continue;let f=c.name?`${n.name}${c.name}`:n.name;if(l!==2||c.type!==`scalarField`||c.scalarField.physicalType!==9)throw Error(`Currently only optional string fields are implemented for a struct.`);let p=zp(e,t),m=vm(e,p.numValues,p.byteLength,t),h=zp(e,t),g=Up(e,t,h,0,h.decompressedCount===r?void 0:new Bp(m,p.numValues));u[d++]=s?new wm(f,g,i,a,o,s,new Bp(m,p.numValues)):new Cm(f,g,i,a,new Bp(m,p.numValues))}return u}(e,t,n,i)}function Em(e){return e instanceof Bp}function Dm(e){switch(e){case 0:case 1:case 2:case 3:{let t={};t.nullable=!!(1&e),t.columnScope=0;let n={type:`logicalType`,logicalType:0};return n.longID=!!(2&e),t.scalarType=n,t.type=`scalarType`,t}case 4:{let e={nullable:!1,columnScope:0};return e.type=`complexType`,e.complexType={type:`physicalType`,physicalType:0},e}case 30:{let e={nullable:!1,columnScope:0};return e.type=`complexType`,e.complexType={type:`physicalType`,physicalType:1},e}default:return function(e){let t;switch(e){case 10:case 11:t=0;break;case 12:case 13:t=1;break;case 14:case 15:t=2;break;case 16:case 17:t=3;break;case 18:case 19:t=4;break;case 20:case 21:t=5;break;case 22:case 23:t=6;break;case 24:case 25:t=7;break;case 26:case 27:t=8;break;case 28:case 29:t=9;break;default:return null}let n={};n.nullable=!!(1&e),n.columnScope=0;let r={type:`physicalType`};return r.physicalType=t,n.type=`scalarType`,n.scalarType=r,n}(e)}}function Om(e){return e>=10}function km(e){return e===30}function Am(e){if(e.type===`scalarType`){let t=e.scalarType;if(t.type===`physicalType`)switch(t.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(t.type===`logicalType`)return!1}else if(e.type===`complexType`){let t=e.complexType;if(t.type===`physicalType`)switch(t.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn(`Unexpected column type in hasStreamCount`,e),!1}function jm(e){return e.type===`complexType`&&e.complexType?.type===`physicalType`&&e.complexType.physicalType===0}let Mm=new TextDecoder;function Nm(e,t){let n=yp(e,t,1)[0];if(n===0)return``;let r=t.get(),i=e.subarray(r,r+n);return t.add(n),Mm.decode(i)}function Pm(e,t){let n=yp(e,t,1)[0]>>>0;if(n<10||n>30)throw Error(`Unsupported field type code ${n}. Supported: 10-29(scalars), 30(STRUCT)`);let r=Dm(n);if(Om(n)&&(r.name=Nm(e,t)),km(n)){let n=yp(e,t,1)[0]>>>0;r.complexType.children=Array(n);for(let i=0;i<n;i++)r.complexType.children[i]=Pm(e,t)}return function(e){return{name:e.name,nullable:e.nullable,scalarField:e.scalarType,complexField:e.complexType,type:e.type===`scalarType`?`scalarField`:`complexField`}}(r)}function Fm(e,t){let n=yp(e,t,1)[0]>>>0,r=Dm(n);if(!r)throw Error(`Unsupported column type code ${n}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(Om(n)?r.name=Nm(e,t):n>=0&&n<=3?r.name=`id`:n===4&&(r.name=`geometry`),km(n)){let n=yp(e,t,1)[0]>>>0,i=r.complexType;i.children=Array(n);for(let r=0;r<n;r++)i.children[r]=Pm(e,t)}return r}function Im(e,t){let n={featureTables:[]},r={};r.name=Nm(e,t);let i=yp(e,t,1)[0]>>>0,a=yp(e,t,1)[0]>>>0;r.columns=Array(a);for(let n=0;n<a;n++)r.columns[n]=Fm(e,t);return n.featureTables.push(r),[n,i]}function Lm(e,t,n,r,i,a,o=!1){let s=t.scalarType;if(!s||s.type!==`logicalType`||s.logicalType!==0)throw Error(`ID column must be a logical ID scalar type: ${r}`);let c=s.longID?6:4,l=typeof a==`number`?void 0:a,u=Zp(i,a,e,n,c===6?`int64`:`int32`);if(c===4)switch(u){case Fp.FLAT:return new $f(r,Up(e,n,i,0,l),a);case Fp.SEQUENCE:{let t=qp(e,n,i);return new np(r,t[0],t[1],i.numRleValues)}case Fp.CONST:return new rp(r,Kp(e,n,i),a,!1)}switch(u){case Fp.FLAT:return o?new ep(r,function(e,t,n){return function(e,t){switch(t.logicalLevelTechnique1){case Q.DELTA:return t.logicalLevelTechnique2===Q.RLE&&(e=Dp(e,t.runs,t.numRleValues)),function(e){e[0]=wp(e[0]);let t=e.length/4*4,n=1;if(t>=4)for(;n<t-4;n+=4){let t=e[n+1],r=e[n+2],i=e[n+3];e[n]=wp(e[n])+e[n-1],e[n+1]=wp(t)+e[n],e[n+2]=wp(r)+e[n+1],e[n+3]=wp(i)+e[n+2]}for(;n!==e.length;++n)e[n]=wp(e[n])+e[n-1]}(e),e;case Q.RLE:return function(e,t){return Dp(e,t.runs,t.numRleValues)}(e,t);case Q.NONE:return e;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}}(function(e,t,n){let r=new Float64Array(n);for(let i=0;i<n;i++)r[i]=Sp(e,t);return r}(e,t,n.numValues),n)}(e,n,i),a):new Qp(r,Yp(e,n,i,l),a);case Fp.SEQUENCE:{let t=Jp(e,n,i);return new $p(r,t[0],t[1],i.numRleValues)}case Fp.CONST:return new _m(r,Xp(e,n,i),a,!1)}throw Error(`Vector type not supported for id column.`)}class Rm{constructor(e,t){switch(this._featureData=e,this.properties=this._featureData.properties||{},this._featureData.geometry?.type){case Ip.POINT:case Ip.MULTIPOINT:this.type=1;break;case Ip.LINESTRING:case Ip.MULTILINESTRING:this.type=2;break;case Ip.POLYGON:case Ip.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}loadGeometry(){let e=[];for(let t of this._featureData.geometry.coordinates){let r=[];for(let e of t)r.push(new n(e.x,e.y));e.push(r)}return e}}class zm{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new Rm(this.features[e],this.extent)}}class Bm{constructor(e){this.layers={};let t=function(e,t,n=!0){let r=new ap(0),i=[];for(;r.get()<e.length;){let t=yp(e,r,1)[0]>>>0,o=r.get()+t;if(o>e.length)throw Error(`Block overruns tile: ${o} > ${e.length}`);if(yp(e,r,1)[0]>>>0!=1){r.set(o);continue}let[s,c]=Im(e,r),l=s.featureTables[0],u=null,d=null,f=[],p=0;for(let t of l.columns){let i=t.name;if((a=t).type===`scalarType`&&a.scalarType?.type===`logicalType`&&a.scalarType.logicalType===0){let a=null;if(t.nullable){let t=zp(e,r),n=r.get(),i=vm(e,t.numValues,t.byteLength,r);r.set(n+t.byteLength),a=new Bp(i,t.numValues)}let o=zp(e,r);p=a?a.size():o.decompressedCount,u=Lm(e,t,r,i,o,a??p,n)}else if(jm(t)){let t=yp(e,r,1)[0];if(p===0){let t=r.get();p=zp(e,r).decompressedCount,r.set(t)}d=fm(e,t,r,p)}else{let n=Am(t)?yp(e,r,1)[0]:1;if(n===0)continue;let i=Tm(e,r,t,n,p);if(i)if(Array.isArray(i))for(let e of i)f.push(e);else f.push(i)}}let m=new ip(l.name,d,u,f,c);i.push(m),r.set(o)}var a;return i}(new Uint8Array(e));this.layers=t.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.name]:new zm(t)})),{})}}class Vm{constructor(e,t){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=t,`id`in e&&(typeof e.id==`string`?this.id=parseInt(e.id,10):typeof e.id!=`number`||isNaN(e.id)||(this.id=e.id))}loadGeometry(){let e=[],t=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(let r of t){let t=[];for(let e of r)t.push(new n(e[0],e[1]));e.push(t)}return e}}let Hm=`_geojsonTileLayer`;function Um(e,t,n=``){t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||``),t.writeVarintField(5,e.extent||4096);let r={jsonPrefix:n,keys:[],values:[],keycache:{},valuecache:{}};for(let n=0;n<e.length;n++)r.feature=e.feature(n),t.writeMessage(2,Wm,r);let i=r.keys;for(let e of i)t.writeStringField(3,e);let a=r.values;for(let e of a)t.writeMessage(4,Ym,e)}function Wm(e,t){if(!e.feature)return;let n=e.feature;n.id!==void 0&&t.writeVarintField(1,n.id),t.writeMessage(2,Gm,e),t.writeVarintField(3,n.type),t.writeMessage(4,Jm,n)}function Gm(e,t){for(let n in e.feature?.properties){let r=e.feature.properties[n],i=e.keycache[n];if(r==null)continue;i===void 0&&(e.keys.push(n),i=e.keys.length-1,e.keycache[n]=i),t.writeVarint(i),typeof r!=`string`&&typeof r!=`boolean`&&typeof r!=`number`&&(r=e.jsonPrefix+JSON.stringify(r));let a=typeof r+`:`+r,o=e.valuecache[a];o===void 0&&(e.values.push(r),o=e.values.length-1,e.valuecache[a]=o),t.writeVarint(o)}}function Km(e,t){return(t<<3)+(7&e)}function qm(e){return e<<1^e>>31}function Jm(e,t){let n=e.loadGeometry(),r=e.type,i=0,a=0;for(let o of n){let n=1;r===1&&(n=o.length),t.writeVarint(Km(1,n));let s=r===3?o.length-1:o.length;for(let e=0;e<s;e++){e===1&&r!==1&&t.writeVarint(Km(2,s-1));let n=o[e].x-i,c=o[e].y-a;t.writeVarint(qm(n)),t.writeVarint(qm(c)),i+=n,a+=c}e.type===3&&t.writeVarint(Km(7,1))}}function Ym(e,t){let n=typeof e;n===`string`?t.writeStringField(1,e):n===`boolean`?t.writeBooleanField(7,e):n===`number`&&(e%1==0?e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e):t.writeDoubleField(3,e))}class Xm{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ha(O,16,0),this.grid3D=new ha(O,16,0),this.featureIndexArray=new Wo,this.promoteId=t}insert(e,t,n,r,i,a){let o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,r,i);let s=a?this.grid3D:this.grid;for(let e of t){let t=[1/0,1/0,-1/0,-1/0];for(let n of e)t[0]=Math.min(t[0],n.x),t[1]=Math.min(t[1],n.y),t[2]=Math.max(t[2],n.x),t[3]=Math.max(t[3],n.y);t[0]<O&&t[1]<O&&t[2]>=0&&t[3]>=0&&s.insert(o,t[0],t[1],t[2],t[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=this.encoding===`mlt`?new Bm(this.rawTileData).layers:new Ll(new Pd(this.rawTileData)).layers,this.sourceLayerCoder=new Yf(this.vtLayers?Object.keys(this.vtLayers).sort():[Hm])),this.vtLayers}query(e,t,r,i){this.loadVTLayers();let a=e.params,o=O/e.tileSize/e.scale,s=vi(a.filter,a.globalState),c=e.queryGeometry,l=e.queryPadding*o,u=Jf.fromPoints(c),d=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),f=Jf.fromPoints(e.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(f.minX,f.minY,f.maxX,f.maxY,((t,r,i,a)=>function(e,t,r,i,a){for(let n of e)if(t<=n.x&&r<=n.y&&i>=n.x&&a>=n.y)return!0;let o=[new n(t,r),new n(t,a),new n(i,a),new n(i,r)];if(e.length>2){for(let t of o)if(tc(e,t))return!0}for(let t=0;t<e.length-1;t++)if(nc(e[t],e[t+1],o))return!0;return!1}(e.cameraQueryGeometry,t-l,r-l,i+l,a+l)));for(let e of p)d.push(e);d.sort(Qm);let m={},h;for(let n of d){if(n===h)continue;h=n;let l=this.featureIndexArray.get(n),u=null;this.loadMatchingFeature(m,l.bucketIndex,l.sourceLayerIndex,l.featureIndex,s,a.layers,a.availableImages,t,r,i,((t,n,r)=>(u||=Vs(t),n.queryIntersectsFeature({queryGeometry:c,feature:t,featureState:r,geometry:u,zoom:this.z,transform:e.transform,pixelsToTileUnits:o,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return m}loadMatchingFeature(e,t,n,r,i,a,o,s,c,l,u){let d=this.bucketLayerIDs[t];if(a&&!d.some((e=>a.has(e))))return;let f=this.sourceLayerCoder.decode(n),p=this.vtLayers[f].feature(r);if(i.needGeometry){let e=Hs(p,!0);if(!i.filter(new Y(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!i.filter(new Y(this.tileID.overscaledZ),p))return;let m=this.getId(p,f);for(let t of d){if(a&&!a.has(t))continue;let n=s[t];if(!n)continue;let i={};m&&l&&(i=l.getState(n.sourceLayer||Hm,m));let d=oe({},c[t]);d.paint=Zm(d.paint,n.paint,p,i,o),d.layout=Zm(d.layout,n.layout,p,i,o);let f=!u||u(p,n,i);if(!f)continue;let h=new Xf(p,this.z,this.x,this.y,m);h.layer=d;let g=e[t];g===void 0&&(g=e[t]=[]),g.push({featureIndex:r,feature:h,intersectionZ:f})}}lookupSymbolFeatures(e,t,n,r,i,a,o,s){let c={};this.loadVTLayers();let l=vi(i.filterSpec,i.globalState);for(let i of e)this.loadMatchingFeature(c,n,r,i,l,a,o,s,t);return c}hasLayer(e){for(let t of this.bucketLayerIDs)for(let n of t)if(e===n)return!0;return!1}getId(e,t){var n;let r=e.id;return this.promoteId&&(r=e.properties[typeof this.promoteId==`string`?this.promoteId:this.promoteId[t]],typeof r==`boolean`&&(r=Number(r)),r===void 0&&(n=e.properties)!=null&&n.cluster&&this.promoteId&&(r=Number(e.properties.cluster_id))),r}}function Zm(e,t,n,r,i){return ce(e,((e,a)=>{let o=t instanceof Ka?t.get(a):null;return o?.evaluate?o.evaluate(n,r,i):o}))}function Qm(e,t){return t-e}function $m(e,t,r,i,a){let o=[];for(let s of e){let e;for(let c=0;c<s.length-1;c++){let l=s[c],u=s[c+1];l.x<t&&u.x<t||(l.x<t?l=new n(t,l.y+(t-l.x)/(u.x-l.x)*(u.y-l.y))._round():u.x<t&&(u=new n(t,l.y+(t-l.x)/(u.x-l.x)*(u.y-l.y))._round()),l.y<r&&u.y<r||(l.y<r?l=new n(l.x+(r-l.y)/(u.y-l.y)*(u.x-l.x),r)._round():u.y<r&&(u=new n(l.x+(r-l.y)/(u.y-l.y)*(u.x-l.x),r)._round()),l.x>=i&&u.x>=i||(l.x>=i?l=new n(i,l.y+(i-l.x)/(u.x-l.x)*(u.y-l.y))._round():u.x>=i&&(u=new n(i,l.y+(i-l.x)/(u.x-l.x)*(u.y-l.y))._round()),l.y>=a&&u.y>=a||(l.y>=a?l=new n(l.x+(a-l.y)/(u.y-l.y)*(u.x-l.x),a)._round():u.y>=a&&(u=new n(l.x+(a-l.y)/(u.y-l.y)*(u.x-l.x),a)._round()),e&&l.equals(e[e.length-1])||(e=[l],o.push(e)),e.push(u)))))}}return o}function eh(e,t,n,r,i){switch(t){case 1:return function(e,t,n,r){let i=[];for(let a of e)for(let e of a){let a=r===0?e.x:e.y;a>=t&&a<=n&&i.push([e])}return i}(e,n,r,i);case 2:return nh(e,n,r,i,!1);case 3:return nh(e,n,r,i,!0)}return[]}function th(e,t,r,i,a){let o=i===0?rh:ih,s=[],c=[];for(let n=0;n<e.length-1;n++){let l=e[n],u=e[n+1],d=i===0?l.x:l.y,f=i===0?u.x:u.y,p=!1;d<t?f>t&&s.push(o(l,u,t)):d>r?f<r&&s.push(o(l,u,r)):s.push(l),f<t&&d>=t&&(s.push(o(l,u,t)),p=!0),f>r&&d<=r&&(s.push(o(l,u,r)),p=!0),!a&&p&&(c.push(s),s=[])}let l=e.length-1,u=i===0?e[l].x:e[l].y;return u>=t&&u<=r&&s.push(e[l]),a&&s.length>0&&!s[0].equals(s[s.length-1])&&s.push(new n(s[0].x,s[0].y)),s.length>0&&c.push(s),c}function nh(e,t,n,r,i){let a=[];for(let o of e){let e=th(o,t,n,r,i);e.length>0&&a.push(...e)}return a}function rh(e,t,r){return new n(r,e.y+(r-e.x)/(t.x-e.x)*(t.y-e.y))}function ih(e,t,r){return new n(e.x+(r-e.y)/(t.y-e.y)*(t.x-e.x),r)}J(`FeatureIndex`,Xm,{omit:[`rawTileData`,`sourceLayerCoder`]});class ah extends n{constructor(e,t,n,r){super(e,t),this.angle=n,r!==void 0&&(this.segment=r)}clone(){return new ah(this.x,this.y,this.angle,this.segment)}}function oh(e,t,n,r,i){if(t.segment===void 0||n===0)return!0;let a=t,o=t.segment+1,s=0;for(;s>-n/2;){if(o--,o<0)return!1;s-=e[o].dist(a),a=e[o]}s+=e[o].dist(e[o+1]),o++;let c=[],l=0;for(;s<n/2;){let t=e[o],n=e[o+1];if(!n)return!1;let a=e[o-1].angleTo(t)-t.angleTo(n);for(a=Math.abs((a+3*Math.PI)%(2*Math.PI)-Math.PI),c.push({distance:s,angleDelta:a}),l+=a;s-c[0].distance>r;)l-=c.shift().angleDelta;if(l>i)return!1;o++,s+=t.dist(n)}return!0}function sh(e){let t=0;for(let n=0;n<e.length-1;n++)t+=e[n].dist(e[n+1]);return t}function ch(e,t,n){return e?.6*t*n:0}function lh(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function uh(e,t,n,r,i,a){let o=ch(n,i,a),s=lh(n,r)*a,c=0,l=sh(e)/2;for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1],a=r.dist(i);if(c+a>l){let u=(l-c)/a,d=new ah(Cn.number(r.x,i.x,u),Cn.number(r.y,i.y,u),i.angleTo(r),n);return d._round(),!o||oh(e,d,s,o,t)?d:void 0}c+=a}}function dh(e,t,n,r,i,a,o,s,c){let l=ch(r,a,o),u=lh(r,i),d=u*o,f=e[0].x===0||e[0].x===c||e[0].y===0||e[0].y===c;return t-d<t/4&&(t=d+t/4),fh(e,f?t/2*s%t:(u/2+2*a)*o*s%t,t,l,n,d,f,!1,c)}function fh(e,t,n,r,i,a,o,s,c){let l=a/2,u=sh(e),d=0,f=t-n,p=[];for(let t=0;t<e.length-1;t++){let o=e[t],s=e[t+1],m=o.dist(s),h=s.angleTo(o);for(;f+n<d+m;){f+=n;let g=(f-d)/m,_=Cn.number(o.x,s.x,g),v=Cn.number(o.y,s.y,g);if(_>=0&&_<c&&v>=0&&v<c&&f-l>=0&&f+l<=u){let n=new ah(_,v,h,t);n._round(),r&&!oh(e,n,a,r,i)||p.push(n)}}d+=m}return s||p.length||o||(p=fh(e,d/2,n,r,i,a,o,!0,c)),p}function ph(e,t,r,i){let a=[],o=e.image,s=o.pixelRatio,c=o.paddedRect.w-2,l=o.paddedRect.h-2,u={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom},d=o.stretchX||[[0,c]],f=o.stretchY||[[0,l]],p=(e,t)=>e+t[1]-t[0],m=d.reduce(p,0),h=f.reduce(p,0),g=c-m,_=l-h,v=0,y=m,b=0,x=h,S=0,C=g,w=0,T=_;if(o.content&&i){let t=o.content,n=t[2]-t[0],r=t[3]-t[1];(o.textFitWidth||o.textFitHeight)&&(u=lf(e)),v=mh(d,0,t[0]),b=mh(f,0,t[1]),y=mh(d,t[0],t[2]),x=mh(f,t[1],t[3]),S=t[0]-v,w=t[1]-b,C=n-y,T=r-x}let E=u.x1,D=u.y1,O=u.x2-E,k=u.y2-D,A=(e,i,a,c)=>{let l=gh(e.stretch-v,y,O,E),u=_h(e.fixed-S,C,e.stretch,m),d=gh(i.stretch-b,x,k,D),f=_h(i.fixed-w,T,i.stretch,h),p=gh(a.stretch-v,y,O,E),g=_h(a.fixed-S,C,a.stretch,m),_=gh(c.stretch-b,x,k,D),A=_h(c.fixed-w,T,c.stretch,h),ee=new n(l,d),te=new n(p,d),j=new n(p,_),ne=new n(l,_),re=new n(u/s,f/s),ie=new n(g/s,A/s),ae=t*Math.PI/180;if(ae){let e=Math.sin(ae),t=Math.cos(ae),n=[t,-e,e,t];ee._matMult(n),te._matMult(n),ne._matMult(n),j._matMult(n)}let oe=e.stretch+e.fixed,se=i.stretch+i.fixed;return{tl:ee,tr:te,bl:ne,br:j,tex:{x:o.paddedRect.x+1+oe,y:o.paddedRect.y+1+se,w:a.stretch+a.fixed-oe,h:c.stretch+c.fixed-se},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:re,pixelOffsetBR:ie,minFontScaleX:C/s/O,minFontScaleY:T/s/k,isSDF:r}};if(i&&(o.stretchX||o.stretchY)){let e=hh(d,g,m),t=hh(f,_,h);for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1];for(let e=0;e<t.length-1;e++)a.push(A(r,t[e],i,t[e+1]))}}else a.push(A({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:c+1},{fixed:0,stretch:l+1}));return a}function mh(e,t,n){let r=0;for(let i of e)r+=Math.max(t,Math.min(n,i[1]))-Math.max(t,Math.min(n,i[0]));return r}function hh(e,t,n){let r=[{fixed:-1,stretch:0}];for(let[t,n]of e){let e=r[r.length-1];r.push({fixed:t-e.stretch,stretch:e.stretch}),r.push({fixed:t-e.stretch,stretch:e.stretch+(n-t)})}return r.push({fixed:t+1,stretch:n}),r}function gh(e,t,n,r){return e/t*n+r}function _h(e,t,n,r){return e-t*n/r}J(`Anchor`,ah);class vh{constructor(e,t,r,i,a,o,s,c,l,u){if(this.boxStartIndex=e.length,l){let e=o.top,t=o.bottom,n=o.collisionPadding;n&&(e-=n[1],t+=n[3]);let r=t-e;r>0&&(r=Math.max(10,r),this.circleDiameter=r)}else{let l=o.image?.content&&(o.image.textFitWidth||o.image.textFitHeight)?lf(o):{x1:o.left,y1:o.top,x2:o.right,y2:o.bottom};l.y1=l.y1*s-c[0],l.y2=l.y2*s+c[2],l.x1=l.x1*s-c[3],l.x2=l.x2*s+c[1];let d=o.collisionPadding;if(d&&(l.x1-=d[0]*s,l.y1-=d[1]*s,l.x2+=d[2]*s,l.y2+=d[3]*s),u){let e=new n(l.x1,l.y1),t=new n(l.x2,l.y1),r=new n(l.x1,l.y2),i=new n(l.x2,l.y2),a=u*Math.PI/180;e._rotate(a),t._rotate(a),r._rotate(a),i._rotate(a),l.x1=Math.min(e.x,t.x,r.x,i.x),l.x2=Math.max(e.x,t.x,r.x,i.x),l.y1=Math.min(e.y,t.y,r.y,i.y),l.y2=Math.max(e.y,t.y,r.y,i.y)}e.emplaceBack(t.x,t.y,l.x1,l.y1,l.x2,l.y2,r,i,a)}this.boxEndIndex=e.length}}class yh{constructor(e=[],t=(e,t)=>e<t?-1:+(e>t)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:n}=this,r=t[e];for(;e>0;){let i=e-1>>1,a=t[i];if(n(r,a)>=0)break;t[e]=a,e=i}t[e]=r}_down(e){let{data:t,compare:n}=this,r=this.length>>1,i=t[e];for(;e<r;){let r=1+(e<<1),a=r+1;if(a<this.length&&n(t[a],t[r])<0&&(r=a),n(t[r],i)>=0)break;t[e]=t[r],e=r}t[e]=i}}function bh(e,t=1){let r=Jf.fromPoints(e[0]),i=Math.min(r.width(),r.height()),a=i/2,o=new yh([],xh),{minX:s,minY:c,maxX:l,maxY:u}=r;if(i===0)return new n(s,c);for(let t=s;t<l;t+=i)for(let n=c;n<u;n+=i)o.push(new Sh(t+a,n+a,a,e));let d=function(e){let t=0,n=0,r=0,i=e[0];for(let e=0,a=i.length,o=a-1;e<a;o=e++){let a=i[e],s=i[o],c=a.x*s.y-s.x*a.y;n+=(a.x+s.x)*c,r+=(a.y+s.y)*c,t+=3*c}return new Sh(n/t,r/t,0,e)}(e),f=d;for(;o.length;){let n=o.pop();(n.d>f.d||!f.d)&&(f=n),n.max-f.d<=t||(a=n.h/2,o.push(new Sh(n.p.x-a,n.p.y-a,a,e)),o.push(new Sh(n.p.x+a,n.p.y-a,a,e)),o.push(new Sh(n.p.x-a,n.p.y+a,a,e)),o.push(new Sh(n.p.x+a,n.p.y+a,a,e)))}return d.d>0&&f.d-d.d<=t?d.p:f.p}function xh(e,t){return t.max-e.max}class Sh{constructor(e,t,r,i){this.p=new n(e,t),this.h=r,this.d=function(e,t){let n=!1,r=1/0;for(let i of t)for(let t=0,a=i.length,o=a-1;t<a;o=t++){let a=i[t],s=i[o];a.y>e.y!=s.y>e.y&&e.x<(s.x-a.x)*(e.y-a.y)/(s.y-a.y)+a.x&&(n=!n),r=Math.min(r,$s(e,a,s))}return(n?1:-1)*Math.sqrt(r)}(this.p,i),this.max=this.d+this.h*Math.SQRT2}}var Ch;e.aM=void 0,(Ch=e.aM||={})[Ch.center=1]=`center`,Ch[Ch.left=2]=`left`,Ch[Ch.right=3]=`right`,Ch[Ch.top=4]=`top`,Ch[Ch.bottom=5]=`bottom`,Ch[Ch[`top-left`]=6]=`top-left`,Ch[Ch[`top-right`]=7]=`top-right`,Ch[Ch[`bottom-left`]=8]=`bottom-left`,Ch[Ch[`bottom-right`]=9]=`bottom-right`;let wh=1/0;function Th(e,t){return t[1]===wh?function(e,t){let n=0,r=0;t<0&&(t=0);let i=t/Math.SQRT2;switch(e){case`top-right`:case`top-left`:r=i-7;break;case`bottom-right`:case`bottom-left`:r=7-i;break;case`bottom`:r=7-t;break;case`top`:r=t-7}switch(e){case`top-right`:case`bottom-right`:n=-i;break;case`top-left`:case`bottom-left`:n=i;break;case`left`:n=t;break;case`right`:n=-t}return[n,r]}(e,t[0]):function(e,t,n){let r=0,i=0;switch(t=Math.abs(t),n=Math.abs(n),e){case`top-right`:case`top-left`:case`top`:i=n-7;break;case`bottom-right`:case`bottom-left`:case`bottom`:i=7-n}switch(e){case`top-right`:case`bottom-right`:case`right`:r=-t;break;case`top-left`:case`bottom-left`:case`left`:r=t}return[r,i]}(e,t[0],t[1])}function Eh(e,t,n){let r=e.layout,i=r.get(`text-variable-anchor-offset`)?.evaluate(t,{},n);if(i){let e=i.values,t=[];for(let n=0;n<e.length;n+=2){let r=t[n]=e[n],i=e[n+1].map((e=>e*xd));r.startsWith(`top`)?i[1]-=7:r.startsWith(`bottom`)&&(i[1]+=7),t[n+1]=i}return new Jt(t)}let a=r.get(`text-variable-anchor`);if(a){let i;i=e._unevaluatedLayout.getValue(`text-radial-offset`)===void 0?r.get(`text-offset`).evaluate(t,{},n).map((e=>e*xd)):[r.get(`text-radial-offset`).evaluate(t,{},n)*xd,wh];let o=[];for(let e of a)o.push(e,Th(e,i));return new Jt(o)}return null}function Dh(e){switch(e){case`right`:case`top-right`:case`bottom-right`:return`right`;case`left`:case`top-left`:case`bottom-left`:return`left`}return`center`}function Oh(t,n,r,i,a,o,s,c,l,u,d,f){let p=o.textMaxSize.evaluate(n,{});p===void 0&&(p=s);let m=t.layers[0].layout,h=m.get(`icon-offset`).evaluate(n,{},d),g=Ah(r.horizontal),_=s/24,v=t.tilePixelRatio*_,y=t.tilePixelRatio*p/24,b=t.tilePixelRatio*c,x=t.tilePixelRatio*m.get(`symbol-spacing`),S=m.get(`text-padding`)*t.tilePixelRatio,C=function(e,t,n,r=1){let i=e.get(`icon-padding`).evaluate(t,{},n)?.values;return[i[0]*r,i[1]*r,i[2]*r,i[3]*r]}(m,n,d,t.tilePixelRatio),w=m.get(`text-max-angle`)/180*Math.PI,T=m.get(`text-rotation-alignment`)!==`viewport`&&m.get(`symbol-placement`)!==`point`,E=m.get(`icon-rotation-alignment`)===`map`&&m.get(`symbol-placement`)!==`point`,D=m.get(`symbol-placement`),k=x/2,A=m.get(`icon-text-fit`),ee;i&&A!==`none`&&(t.allowVerticalPlacement&&r.vertical&&(ee=uf(i,r.vertical,A,m.get(`icon-text-fit-padding`),h,_)),g&&(i=uf(i,g,A,m.get(`icon-text-fit-padding`),h,_)));let te=d?f.line.getGranularityForZoomLevel(d.z):1,j=(c,f)=>{f.x<0||f.x>=O||f.y<0||f.y>=O||function(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T){let E=t.addToLineVertexArray(n,r),D,O,k,A,ee=0,te=0,j=0,ne=0,re=-1,ie=-1,ae={},oe=_s(``);if(t.allowVerticalPlacement&&i.vertical){let e=c.layout.get(`text-rotate`).evaluate(x,{},w)+90;k=new vh(l,n,u,d,f,i.vertical,p,m,h,e),s&&(A=new vh(l,n,u,d,f,s,_,v,h,e))}if(a){let r=c.layout.get(`icon-rotate`).evaluate(x,{}),i=c.layout.get(`icon-text-fit`)!==`none`,o=ph(a,r,C,i),p=s?ph(s,r,C,i):void 0;O=new vh(l,n,u,d,f,a,_,v,!1,r),ee=4*o.length;let m=t.iconSizeData,h=null;m.kind===`source`?(h=[128*c.layout.get(`icon-size`).evaluate(x,{})],h[0]>df&&de(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):m.kind===`composite`&&(h=[128*S.compositeIconSizes[0].evaluate(x,{},w),128*S.compositeIconSizes[1].evaluate(x,{},w)],(h[0]>df||h[1]>df)&&de(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,o,h,b,y,x,e.ax.none,n,E.lineStartIndex,E.lineLength,-1,w),re=t.icon.placedSymbolArray.length-1,p&&(te=4*p.length,t.addSymbols(t.icon,p,h,b,y,x,e.ax.vertical,n,E.lineStartIndex,E.lineLength,-1,w),ie=t.icon.placedSymbolArray.length-1)}let se=Object.keys(i.horizontal);for(let r of se){let a=i.horizontal[r];D||=(oe=_s(a.text),new vh(l,n,u,d,f,a,p,m,h,c.layout.get(`text-rotate`).evaluate(x,{},w)));let s=a.positionedLines.length===1;if(j+=kh(t,n,a,o,c,h,x,g,E,i.vertical?e.ax.horizontal:e.ax.horizontalOnly,s?se:[r],ae,re,S,w),s)break}i.vertical&&(ne+=kh(t,n,i.vertical,o,c,h,x,g,E,e.ax.vertical,[`vertical`],ae,ie,S,w));let ce=D?D.boxStartIndex:t.collisionBoxArray.length,le=D?D.boxEndIndex:t.collisionBoxArray.length,M=k?k.boxStartIndex:t.collisionBoxArray.length,ue=k?k.boxEndIndex:t.collisionBoxArray.length,fe=O?O.boxStartIndex:t.collisionBoxArray.length,pe=O?O.boxEndIndex:t.collisionBoxArray.length,me=A?A.boxStartIndex:t.collisionBoxArray.length,he=A?A.boxEndIndex:t.collisionBoxArray.length,ge=-1,_e=(e,t)=>e?.circleDiameter?Math.max(e.circleDiameter,t):t;ge=_e(D,ge),ge=_e(k,ge),ge=_e(O,ge),ge=_e(A,ge);let ve=+(ge>-1);ve&&(ge*=T/xd),t.glyphOffsetArray.length>=bf.MAX_GLYPHS&&de(`Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907`),x.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey);let ye=Eh(c,x,w),[be,xe]=function(t,n){let r=t.length,i=n?.values;if(i?.length>0)for(let n=0;n<i.length;n+=2){let r=i[n+1];t.emplaceBack(e.aM[i[n]],r[0],r[1])}return[r,t.length]}(t.textAnchorOffsets,ye);t.symbolInstances.emplaceBack(n.x,n.y,ae.right>=0?ae.right:-1,ae.center>=0?ae.center:-1,ae.left>=0?ae.left:-1,ae.vertical||-1,re,ie,oe,ce,le,M,ue,fe,pe,me,he,u,j,ne,ee,te,ve,0,p,ge,be,xe)}(t,f,c,r,i,a,ee,t.layers[0],t.collisionBoxArray,n.index,n.sourceLayerIndex,t.index,v,[S,S,S,S],T,l,b,C,E,h,n,o,u,d,s)};if(D===`line`)for(let e of $m(n.geometry,0,0,O,O)){let n=yl(e,te),a=dh(n,x,w,r.vertical||g,i,24,y,t.overscaling,O);for(let e of a)g&&jh(t,g.text,k,e)||j(n,e)}else if(D===`line-center`){for(let e of n.geometry)if(e.length>1){let t=yl(e,te),n=uh(t,w,r.vertical||g,i,24,y);n&&j(t,n)}}else if(n.type===`Polygon`)for(let e of cr(n.geometry,0)){let t=bh(e,16);j(yl(e[0],te,!0),new ah(t.x,t.y,0))}else if(n.type===`LineString`)for(let e of n.geometry){let t=yl(e,te);j(t,new ah(t[0].x,t[0].y,0))}else if(n.type===`Point`)for(let e of n.geometry)for(let t of e)j([t],new ah(t.x,t.y,0))}function kh(e,t,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=function(e,t,r,i,a,o,s,c){let l=i.layout.get(`text-rotate`).evaluate(o,{})*Math.PI/180,u=[];for(let e of t.positionedLines)for(let i of e.positionedGlyphs){if(!i.rect)continue;let o=i.rect||{},d=4,f=!0,p=1,m=0,h=(a||c)&&i.vertical,g=i.metrics.advance*i.scale/2;if(c&&t.verticalizable&&(m=e.lineOffset/2-(i.imageName?-(xd-i.metrics.width*i.scale)/2:(i.scale-1)*xd)),i.imageName){let e=s[i.imageName];f=e.sdf,p=e.pixelRatio,d=1/p}let _=a?[i.x+g,i.y]:[0,0],v=a?[0,0]:[i.x+g+r[0],i.y+r[1]-m],y=[0,0];h&&(y=v,v=[0,0]);let b=i.metrics.isDoubleResolution?2:1,x=(i.metrics.left-d)*i.scale-g+v[0],S=(-i.metrics.top-d)*i.scale+v[1],C=x+o.w/b*i.scale/p,w=S+o.h/b*i.scale/p,T=new n(x,S),E=new n(C,S),D=new n(x,w),O=new n(C,w);if(h){let e=new n(-g,g- -17),t=-Math.PI/2,r=12-g,a=new n(22-r,-(i.imageName?r:0)),o=new n(...y);T._rotateAround(t,e)._add(a)._add(o),E._rotateAround(t,e)._add(a)._add(o),D._rotateAround(t,e)._add(a)._add(o),O._rotateAround(t,e)._add(a)._add(o)}if(l){let e=Math.sin(l),t=Math.cos(l),n=[t,-e,e,t];T._matMult(n),E._matMult(n),D._matMult(n),O._matMult(n)}let k=new n(0,0),A=new n(0,0);u.push({tl:T,tr:E,bl:D,br:O,tex:o,writingMode:t.writingMode,glyphOffset:_,sectionIndex:i.sectionIndex,isSDF:f,pixelOffsetTL:k,pixelOffsetBR:A,minFontScaleX:0,minFontScaleY:0})}return u}(0,r,c,a,o,s,i,e.allowVerticalPlacement),_=e.textSizeData,v=null;_.kind===`source`?(v=[128*a.layout.get(`text-size`).evaluate(s,{})],v[0]>df&&de(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):_.kind===`composite`&&(v=[128*m.compositeTextSizes[0].evaluate(s,{},h),128*m.compositeTextSizes[1].evaluate(s,{},h)],(v[0]>df||v[1]>df)&&de(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,g,v,c,o,s,u,t,l.lineStartIndex,l.lineLength,p,h);for(let t of d)f[t]=e.text.placedSymbolArray.length-1;return 4*g.length}function Ah(e){for(let t in e)return e[t];return null}function jh(e,t,n,r){let i=e.compareText;if(t in i){let e=i[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])<n)return!0}else i[t]=[];return i[t].push(r),!1}e.$=De,e.A=f,e.B=Ra,e.C=ma,e.D=X,e.E=Be,e.F=la,e.G=function([e,t,n]){return t+=90,t*=Math.PI/180,n*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(n),y:e*Math.sin(t)*Math.sin(n),z:e*Math.cos(n)}},e.H=Cn,e.I=Xd,e.J=Y,e.K=da,e.L=function(e){if(me==null){let t=e.navigator?e.navigator.userAgent:null;me=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match(`Safari`)&&!t.match(`Chrome`)))}return me},e.M=je,e.N=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Af((()=>this.process())),this.subscription=be(this.target,`message`,(e=>this.receive(e)),!1),this.globalScope=pe(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}unregisterMessageHandler(e){delete this.messageHandlers[e]}sendAsync(e,t){return new Promise(((n,r)=>{let i=Math.round(0xde0b6b3a7640000*Math.random()).toString(36).substring(0,10),a=t?be(t.signal,`abort`,(()=>{a?.unsubscribe(),delete this.resolveRejects[i];let t={id:i,type:`<cancel>`,origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(t)}),jf):null;this.resolveRejects[i]={resolve:e=>{a?.unsubscribe(),n(e)},reject:e=>{a?.unsubscribe(),r(e)}};let o=[],s=Object.assign(Object.assign({},e),{id:i,sourceMapId:this.mapId,origin:location.origin,data:ba(e.data,o)});this.target.postMessage(s,{transfer:o})}))}receive(e){let t=e.data,n=t.id,r=[`file://`,`resource://android`,`null`],i=[t.origin,location.origin],a=t.origin===location.origin,o=i.some((e=>r.includes(e)));if((a||o)&&(!t.targetMapId||this.mapId===t.targetMapId)){if(t.type===`<cancel>`){delete this.tasks[n];let e=this.abortControllers[n];delete this.abortControllers[n],e&&e.abort();return}if(pe(self)||t.mustQueue)return this.tasks[n]=t,this.taskQueue.push(n),void this.invoker.trigger();this.processTask(n,t)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}processTask(e,n){return t(this,void 0,void 0,(function*(){if(n.type===`<response>`){let t=this.resolveRejects[e];if(delete this.resolveRejects[e],!t)return;n.error?t.reject(A(xa(n.error))):t.resolve(xa(n.data));return}if(!this.messageHandlers[n.type])return void this.completeTask(e,Error(`Could not find a registered handler for ${n.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(`, `)}`));let t=xa(n.data),r=new AbortController;this.abortControllers[e]=r;try{let i=yield this.messageHandlers[n.type](n.sourceMapId,t,r);this.completeTask(e,null,i)}catch(t){this.completeTask(e,A(t))}}))}completeTask(e,t,n){let r=[];delete this.abortControllers[e];let i={id:e,type:`<response>`,sourceMapId:this.mapId,origin:location.origin,error:t?ba(t):null,data:ba(n,r)};this.target.postMessage(i,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},e.O=function(){var e=new f(16);return f!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.P=n,e.Q=function(e,t,n){var r,i,a,o,s,c,l,u,d,f,p,m,h=n[0],g=n[1],_=n[2];return t===e?(e[12]=t[0]*h+t[4]*g+t[8]*_+t[12],e[13]=t[1]*h+t[5]*g+t[9]*_+t[13],e[14]=t[2]*h+t[6]*g+t[10]*_+t[14],e[15]=t[3]*h+t[7]*g+t[11]*_+t[15]):(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],e[0]=r=t[0],e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=c,e[6]=l,e[7]=u,e[8]=d,e[9]=f,e[10]=p,e[11]=m,e[12]=r*h+s*g+d*_+t[12],e[13]=i*h+c*g+f*_+t[13],e[14]=a*h+l*g+p*_+t[14],e[15]=o*h+u*g+m*_+t[15]),e},e.R=wc,e.S=function(e,t,n){var r=n[0],i=n[1],a=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.T=Fc,e.U=function(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=n[0],b=n[1],x=n[2],S=n[3];return e[0]=y*r+b*s+x*d+S*h,e[1]=y*i+b*c+x*f+S*g,e[2]=y*a+b*l+x*p+S*_,e[3]=y*o+b*u+x*m+S*v,e[4]=(y=n[4])*r+(b=n[5])*s+(x=n[6])*d+(S=n[7])*h,e[5]=y*i+b*c+x*f+S*g,e[6]=y*a+b*l+x*p+S*_,e[7]=y*o+b*u+x*m+S*v,e[8]=(y=n[8])*r+(b=n[9])*s+(x=n[10])*d+(S=n[11])*h,e[9]=y*i+b*c+x*f+S*g,e[10]=y*a+b*l+x*p+S*_,e[11]=y*o+b*u+x*m+S*v,e[12]=(y=n[12])*r+(b=n[13])*s+(x=n[14])*d+(S=n[15])*h,e[13]=y*i+b*c+x*f+S*g,e[14]=y*a+b*l+x*p+S*_,e[15]=y*o+b*u+x*m+S*v,e},e.V=function(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n},e.W=Nf,e.X=ae,e.Y=Lf,e.Z=If,e._=t,e.a=Ee,e.a$=function(e){var t=new f(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},e.a0=l,e.a1=u,e.a2=_e,e.a3=Kf,e.a4=zf,e.a5=Bf,e.a6=O,e.a7=Hf,e.a8=Jf,e.a9=25,e.aA=function(e){var t=e[0],n=e[1];return Math.sqrt(t*t+n*n)},e.aB=function(e){return e[0]=0,e[1]=0,e},e.aC=function(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e},e.aD=gf,e.aE=C,e.aF=function(e,t,r,i){let a=t.y-e.y,o=t.x-e.x,s=i.y-r.y,c=i.x-r.x,l=s*o-c*a;if(l===0)return null;let u=(c*(e.y-r.y)-s*(e.x-r.x))/l;return new n(e.x+u*o,e.y+u*a)},e.aG=$m,e.aH=Ks,e.aI=function(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x),i=Math.max(i,a.y);return[t,n,r,i]},e.aJ=xd,e.aK=k,e.aL=function(e,t,n,r,i=!1){if(!n[0]&&!n[1])return[0,0];let a=i?r===`map`?-e.bearingInRadians:0:r===`viewport`?e.bearingInRadians:0;if(a){let e=Math.sin(a),t=Math.cos(a);n=[n[0]*t-n[1]*e,n[0]*e+n[1]*t]}return[i?n[0]:k(t,n[0],e.zoom),i?n[1]:k(t,n[1],e.zoom)]},e.aN=pf,e.aO=Dh,e.aP=ef,e.aQ=e=>e.type===`symbol`,e.aR=Zl,e.aS=oo,e.aT=ml,e.aU=Go,e.aV=ss,e.aW=is,e.aX=Se,e.aY=Vf,e.aZ=y,e.a_=v,e.aa=Wf,e.ab=e=>{let t=window.document.createElement(`video`);return t.muted=!0,new Promise((n=>{t.onloadstart=()=>{n(t)};for(let n of e){let e=window.document.createElement(`source`);Fe(n)||(t.crossOrigin=`Anonymous`),e.src=n,t.appendChild(e)}}))},e.ac=F,e.ad=function(){return se++},e.ae=Po,e.af=bf,e.ag=Hm,e.ah=vi,e.ai=Hs,e.aj=Xf,e.ak=function(e){let t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,n,r,i)=>{let a=r||i;return t[n]=!a||a.toLowerCase(),``})),t[`max-age`]){let e=parseInt(t[`max-age`],10);isNaN(e)?delete t[`max-age`]:t[`max-age`]=e}return t},e.al=ie,e.am=85.051129,e.an=xe,e.ao=function(e){return 2**e},e.ap=m,e.aq=Rf,e.ar=function(e){return Math.log(e)/Math.LN2},e.as=function(e){var t=e[0],n=e[1];return t*t+n*n},e.at=function(e){if(!e.length)return new Set;let t=Math.max(...e.map((e=>e.canonical.z))),n=1/0,r=-1/0,i=1/0,a=-1/0,o=[];for(let s of e){let{x:e,y:c,z:l}=s.canonical,u=2**(t-l),d=e*u,f=c*u;o.push({id:s,x:d,y:f}),d<n&&(n=d),d>r&&(r=d),f<i&&(i=f),f>a&&(a=f)}let s=new Set;for(let e of o)e.x!==n&&e.x!==r&&e.y!==i&&e.y!==a||s.add(e.id);return s},e.au=function(e,t){let n=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-n||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x},e.av=class{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(let e in this.data)for(let t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,n){let r=e.wrapped().key;this.data[r]===void 0&&(this.data[r]=[]);let i={value:t,timeout:void 0};if(n!==void 0&&(i.timeout=setTimeout((()=>{this.remove(e,i)}),n)),this.data[r].push(i),this.order.push(r),this.order.length>this.max){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let n=e.wrapped().key,r=t===void 0?0:this.data[n].indexOf(t),i=this.data[n][r];return this.data[n].splice(r,1),i.timeout&&clearTimeout(i.timeout),this.data[n].length===0&&delete this.data[n],this.onRemove(i.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){let t=[];for(let n in this.data)for(let r of this.data[n])e(r.value)||t.push(r);for(let e of t)this.remove(e.value.tileID,e)}},e.aw=function(e,t){let n=0,r=0;if(e.kind===`constant`)r=e.layoutSize;else if(e.kind!==`source`){let{interpolationType:i,minZoom:a,maxZoom:o}=e,s=i?ie(xn.interpolationFactor(i,t,a,o),0,1):0;e.kind===`camera`?r=Cn.number(e.minSize,e.maxSize,s):n=s}return{uSizeT:n,uSize:r}},e.ay=function(e,{uSize:t,uSizeT:n},{lowerSize:r,upperSize:i}){return e.kind===`source`?r/128:e.kind===`composite`?Cn.number(r/128,i/128,n):t},e.az=E,e.b=he,e.b$=Ts,e.b0=function(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e},e.b1=function(e,t){var n=t[0],r=t[1],i=t[2],a=n*n+r*r+i*i;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e},e.b2=b,e.b3=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.b4=function(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e[3]=t[3]*n[3],e},e.b5=g,e.b6=function(e,t,n){let r=t[0]*n[0]+t[1]*n[1]+t[2]*n[2];return r===0?null:(-(e[0]*n[0]+e[1]*n[1]+e[2]*n[2])-n[3])/r},e.b7=S,e.b8=function(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e},e.b9=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]},e.bA=T,e.bB=function(e,t,n){var r=n[0],i=n[1],a=n[2],o=n[3],s=t[0],c=t[1],l=t[2],u=i*l-a*c,d=a*s-r*l,f=r*c-i*s;return e[0]=s+o*(u+=u)+i*(f+=f)-a*(d+=d),e[1]=c+o*d+a*u-r*f,e[2]=l+o*f+r*d-i*u,e},e.bC=function(e,t,n){let r=(i=[e[0],e[1],e[2],t[0],t[1],t[2],n[0],n[1],n[2]])[0]*((u=i[8])*(o=i[4])-(s=i[5])*(l=i[7]))+i[1]*(-u*(a=i[3])+s*(c=i[6]))+i[2]*(l*a-o*c);var i,a,o,s,c,l,u;if(r===0)return null;let d=b([],[t[0],t[1],t[2]],[n[0],n[1],n[2]]),f=b([],[n[0],n[1],n[2]],[e[0],e[1],e[2]]),p=b([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),m=y([],d,-e[3]);return v(m,m,y([],f,-t[3])),v(m,m,y([],p,-n[3])),y(m,m,1/r),m},e.bD=Mf,e.bE=function(){return new Float64Array(4)},e.bF=function(e,t,n,r){var i=[],a=[];return i[0]=t[0]-n[0],i[1]=t[1]-n[1],i[2]=t[2]-n[2],a[0]=i[0]*Math.cos(r)-i[1]*Math.sin(r),a[1]=i[0]*Math.sin(r)+i[1]*Math.cos(r),a[2]=i[2],e[0]=a[0]+n[0],e[1]=a[1]+n[1],e[2]=a[2]+n[2],e},e.bG=function(e,t,n,r){var i=[],a=[];return i[0]=t[0]-n[0],i[1]=t[1]-n[1],i[2]=t[2]-n[2],a[0]=i[0],a[1]=i[1]*Math.cos(r)-i[2]*Math.sin(r),a[2]=i[1]*Math.sin(r)+i[2]*Math.cos(r),e[0]=a[0]+n[0],e[1]=a[1]+n[1],e[2]=a[2]+n[2],e},e.bH=function(e,t,n,r){var i=[],a=[];return i[0]=t[0]-n[0],i[1]=t[1]-n[1],i[2]=t[2]-n[2],a[0]=i[2]*Math.sin(r)+i[0]*Math.cos(r),a[1]=i[1],a[2]=i[2]*Math.cos(r)-i[0]*Math.sin(r),e[0]=a[0]+n[0],e[1]=a[1]+n[1],e[2]=a[2]+n[2],e},e.bI=function(e,t,n){var r=Math.sin(n),i=Math.cos(n),a=t[0],o=t[1],s=t[2],c=t[3],l=t[8],u=t[9],d=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*i-l*r,e[1]=o*i-u*r,e[2]=s*i-d*r,e[3]=c*i-f*r,e[8]=a*r+l*i,e[9]=o*r+u*i,e[10]=s*r+d*i,e[11]=c*r+f*i,e},e.bJ=function(e,t){let n=ee(e,360),r=ee(t,360),i=r-n,a=r>n?i-360:i+360;return Math.abs(i)<Math.abs(a)?i:a},e.bK=function(e){return e[0]=0,e[1]=0,e[2]=0,e},e.bL=function(e,t,n,r){let i=Math.sqrt(e*e+t*t),a=Math.sqrt(n*n+r*r);e/=i,t/=i,n/=a,r/=a;let o=Math.acos(e*n+t*r);return-t*n+e*r>0?o:-o},e.bM=function(e,t){let n=ee(e,2*Math.PI),r=ee(t,2*Math.PI);return Math.min(Math.abs(n-r),Math.abs(n-r+2*Math.PI),Math.abs(n-r-2*Math.PI))},e.bN=function(){let e={},t=N.$version;for(let n in N.$root){let r=N.$root[n];if(r.required){let i=null;i=n===`version`?t:r.type===`array`?[]:{},i!=null&&(e[n]=i)}}return e},e.bO=Ne,e.bP=Sa,e.bQ=function e(t,n){if(Array.isArray(t)){if(!Array.isArray(n)||t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0}if(typeof t==`object`&&t&&n!==null){if(typeof n!=`object`||Object.keys(t).length!==Object.keys(n).length)return!1;for(let r in t)if(!e(t[r],n[r]))return!1;return!0}return t===n},e.bR=Oe,e.bS=function(e){e=e.slice();let t=Object.create(null);for(let n=0;n<e.length;n++)t[e[n].id]=e[n];for(let n=0;n<e.length;n++)`ref`in e[n]&&(e[n]=He(e[n],t[e[n].ref]));return e},e.bT=function(e,t){if(e.type===`custom`)return new kf(e,t);switch(e.type){case`background`:return new Of(e,t);case`circle`:return new gc(e,t);case`color-relief`:return new Rc(e,t);case`fill`:return new Dl(e,t);case`fill-extrusion`:return new ql(e,t);case`heatmap`:return new Oc(e,t);case`hillshade`:return new jc(e,t);case`line`:return new fd(e,t);case`raster`:return new no(e,t);case`symbol`:return new Tf(e,t)}},e.bU=e=>e.type===`raster`,e.bV=M,e.bW=function(e,t){if(!e)return[{command:`setStyle`,args:[t]}];let n=[];try{if(!P(e.version,t.version))return[{command:`setStyle`,args:[t]}];P(e.center,t.center)||n.push({command:`setCenter`,args:[t.center]}),P(e.state,t.state)||n.push({command:`setGlobalState`,args:[t.state]}),P(e.centerAltitude,t.centerAltitude)||n.push({command:`setCenterAltitude`,args:[t.centerAltitude]}),P(e.zoom,t.zoom)||n.push({command:`setZoom`,args:[t.zoom]}),P(e.bearing,t.bearing)||n.push({command:`setBearing`,args:[t.bearing]}),P(e.pitch,t.pitch)||n.push({command:`setPitch`,args:[t.pitch]}),P(e.roll,t.roll)||n.push({command:`setRoll`,args:[t.roll]}),P(e.sprite,t.sprite)||n.push({command:`setSprite`,args:[t.sprite]}),P(e.glyphs,t.glyphs)||n.push({command:`setGlyphs`,args:[t.glyphs]}),P(e.transition,t.transition)||n.push({command:`setTransition`,args:[t.transition]}),P(e.light,t.light)||n.push({command:`setLight`,args:[t.light]}),P(e.terrain,t.terrain)||n.push({command:`setTerrain`,args:[t.terrain]}),P(e.sky,t.sky)||n.push({command:`setSky`,args:[t.sky]}),P(e.projection,t.projection)||n.push({command:`setProjection`,args:[t.projection]});let r={},i=[];(function(e,t,n,r){let i;for(i in t||={},e||={})Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)||Ge(i,n,r));for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)?P(e[i],t[i])||(e[i].type===`geojson`&&t[i].type===`geojson`&&qe(e,t,i)?Ue(n,{command:`setGeoJSONSourceData`,args:[i,t[i].data]}):Ke(i,t,n,r)):We(i,t,n))})(e.sources,t.sources,i,r);let a=[];e.layers&&e.layers.forEach((e=>{`source`in e&&r[e.source]?n.push({command:`removeLayer`,args:[e.id]}):a.push(e)})),n=n.concat(i),function(e,t,n){t||=[];let r=(e||=[]).map(Ye),i=t.map(Ye),a=e.reduce(Xe,{}),o=t.reduce(Xe,{}),s=r.slice(),c=Object.create(null),l,u,d,f,p;for(let e=0,t=0;e<r.length;e++)l=r[e],Object.prototype.hasOwnProperty.call(o,l)?t++:(Ue(n,{command:`removeLayer`,args:[l]}),s.splice(s.indexOf(l,t),1));for(let e=0,t=0;e<i.length;e++)l=i[i.length-1-e],s[s.length-1-e]!==l&&(Object.prototype.hasOwnProperty.call(a,l)?(Ue(n,{command:`removeLayer`,args:[l]}),s.splice(s.lastIndexOf(l,s.length-t),1)):t++,f=s[s.length-e],Ue(n,{command:`addLayer`,args:[o[l],f]}),s.splice(s.length-e,0,l),c[l]=!0);for(let e=0;e<i.length;e++)if(l=i[e],u=a[l],d=o[l],!c[l]&&!P(u,d))if(P(u.source,d.source)&&P(u[`source-layer`],d[`source-layer`])&&P(u.type,d.type)){for(p in Je(u.layout,d.layout,n,l,null,`setLayoutProperty`),Je(u.paint,d.paint,n,l,null,`setPaintProperty`),P(u.filter,d.filter)||Ue(n,{command:`setFilter`,args:[l,d.filter]}),P(u.minzoom,d.minzoom)&&P(u.maxzoom,d.maxzoom)||Ue(n,{command:`setLayerZoomRange`,args:[l,d.minzoom,d.maxzoom]}),u)Object.prototype.hasOwnProperty.call(u,p)&&p!==`layout`&&p!==`paint`&&p!==`filter`&&p!==`metadata`&&p!==`minzoom`&&p!==`maxzoom`&&(p.indexOf(`paint.`)===0?Je(u[p],d[p],n,l,p.slice(6),`setPaintProperty`):P(u[p],d[p])||Ue(n,{command:`setLayerProperty`,args:[l,p,d[p]]}));for(p in d)Object.prototype.hasOwnProperty.call(d,p)&&!Object.prototype.hasOwnProperty.call(u,p)&&p!==`layout`&&p!==`paint`&&p!==`filter`&&p!==`metadata`&&p!==`minzoom`&&p!==`maxzoom`&&(p.indexOf(`paint.`)===0?Je(u[p],d[p],n,l,p.slice(6),`setPaintProperty`):P(u[p],d[p])||Ue(n,{command:`setLayerProperty`,args:[l,p,d[p]]}))}else Ue(n,{command:`removeLayer`,args:[l]}),f=s[s.lastIndexOf(l)+1],Ue(n,{command:`addLayer`,args:[d,f]})}(a,t.layers,n)}catch(e){console.warn(`Unable to compute style diff:`,e),n=[{command:`setStyle`,args:[t]}]}return n},e.bX=function(e){let t=[],n=e.id;return n===void 0&&t.push({message:`layers.${n}: missing required property "id"`}),e.render===void 0&&t.push({message:`layers.${n}: missing required method "render"`}),e.renderingMode&&e.renderingMode!==`2d`&&e.renderingMode!==`3d`&&t.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),t},e.bY=ce,e.bZ=le,e.b_=class extends Ss{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},e.ba=Gf,e.bb=qf,e.bc=function(e,t,n,r,i){var a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){var o=1/(r-i);e[10]=(i+r)*o,e[14]=2*i*r*o}else e[10]=-1,e[14]=-2*r;return e},e.bd=function(e){var t=new f(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],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},e.be=function(e,t,n){var r=Math.sin(n),i=Math.cos(n),a=t[0],o=t[1],s=t[2],c=t[3],l=t[4],u=t[5],d=t[6],f=t[7];return t!==e&&(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[0]=a*i+l*r,e[1]=o*i+u*r,e[2]=s*i+d*r,e[3]=c*i+f*r,e[4]=l*i-a*r,e[5]=u*i-o*r,e[6]=d*i-s*r,e[7]=f*i-c*r,e},e.bf=function(e,t,n){var r=Math.sin(n),i=Math.cos(n),a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*i+l*r,e[5]=o*i+u*r,e[6]=s*i+d*r,e[7]=c*i+f*r,e[8]=l*i-a*r,e[9]=u*i-o*r,e[10]=d*i-s*r,e[11]=f*i-c*r,e},e.bg=function(e,t){var n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=n*s-r*o,y=n*c-i*o,b=n*l-a*o,x=r*c-i*s,S=r*l-a*s,C=i*l-a*c,w=u*h-d*m,T=u*g-f*m,E=u*_-p*m,D=d*g-f*h,O=d*_-p*h,k=f*_-p*g,A=v*k-y*O+b*D+x*E-S*T+C*w;return A?(e[0]=(s*k-c*O+l*D)*(A=1/A),e[1]=(i*O-r*k-a*D)*A,e[2]=(h*C-g*S+_*x)*A,e[3]=(f*S-d*C-p*x)*A,e[4]=(c*E-o*k-l*T)*A,e[5]=(n*k-i*E+a*T)*A,e[6]=(g*b-m*C-_*y)*A,e[7]=(u*C-f*b+p*y)*A,e[8]=(o*O-s*E+l*w)*A,e[9]=(r*E-n*O-a*w)*A,e[10]=(m*S-h*b+_*v)*A,e[11]=(d*b-u*S-p*v)*A,e[12]=(s*T-o*D-c*w)*A,e[13]=(n*D-r*T+i*w)*A,e[14]=(h*y-m*x-g*v)*A,e[15]=(u*x-d*y+f*v)*A,e):null},e.bh=function(){let e=new Float32Array(16);return m(e),e},e.bi=function(){let e=new Float64Array(16);return m(e),e},e.bj=function(){return new Float64Array(16)},e.bk=function(e,t,n){let r=new Float64Array(4);return T(r,e,t-90,n),r},e.bl=function(e,t,n,r){var i,a,o,s,c,l=t[0],u=t[1],f=t[2],p=t[3],m=n[0],h=n[1],g=n[2],_=n[3];return(a=l*m+u*h+f*g+p*_)<0&&(a=-a,m=-m,h=-h,g=-g,_=-_),1-a>d?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-r)*i)/o,c=Math.sin(r*i)/o):(s=1-r,c=r),e[0]=s*l+c*m,e[1]=s*u+c*h,e[2]=s*f+c*g,e[3]=s*p+c*_,e},e.bm=function(e){let t=new Float64Array(9);var n,r,i,a,o,s,c,l,u,d=(i=(r=e)[0])*(c=i+i),f=(a=r[1])*c,p,m=(o=r[2])*c,h=o*(l=a+a),g,_=(s=r[3])*c,v=s*l,y=s*(u=o+o);(n=t)[0]=1-(p=a*l)-(g=o*u),n[3]=f-y,n[6]=m+v,n[1]=f+y,n[4]=1-d-g,n[7]=h-_,n[2]=m-v,n[5]=h+_,n[8]=1-d-p;let b=Se(-Math.asin(ie(t[2],-1,1))),x,S;return Math.hypot(t[5],t[8])<.001?(x=0,S=-Se(Math.atan2(t[3],t[4]))):(x=Se(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),S=Se(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:x,pitch:b+90,bearing:S}},e.bn=function(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing},e.bo=V,e.bp=Cs,e.bq=hl,e.br=gl,e.bs=pl,e.bt=te,e.bu=j,e.bv=Xt,e.bw=function(e,t,n,r,i){return te(r,i,ie((e-t)/(n-t),0,1))},e.bx=function(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e},e.by=ee,e.bz=function(){return new Float64Array(3)},e.c=ke,e.c$=ci,e.c0=class extends Ss{constructor(e,t){super(e,t),this.current=Es}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])return this.current=e,void this.gl.uniformMatrix4fv(this.location,!1,e);for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}},e.c1=ws,e.c2=class extends Ss{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]||(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}},e.c3=class extends Ss{constructor(e,t){super(e,t),this.current=[0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]||(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}},e.c4=p,e.c5=function(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=-n,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},e.c6=function(e,t,n){var r=t[0],i=t[1],a=t[2];return e[0]=r*n[0]+i*n[3]+a*n[6],e[1]=r*n[1]+i*n[4]+a*n[7],e[2]=r*n[2]+i*n[5]+a*n[8],e},e.c7=function(e,t,n,r,i,a,o){var s=1/(t-n),c=1/(r-i),l=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+n)*s,e[13]=(i+r)*c,e[14]=(o+a)*l,e[15]=1,e},e.c8=class extends Ss{constructor(e,t){super(e,t),this.current=[]}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(4*e.length);for(let n=0;n<e.length;n++)t[4*n]=e[n].r,t[4*n+1]=e[n].g,t[4*n+2]=e[n].b,t[4*n+3]=e[n].a;this.gl.uniform4fv(this.location,t)}}},e.c9=class extends Ss{constructor(e,t){super(e,t),this.current=[]}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e);this.gl.uniform1fv(this.location,t)}}},e.cA=function(e,t){return Ce[t]&&`touches`in e},e.cB=function(e){return Ce[e]||we[e]},e.cC=function(e,t,n){var r=t[0],i=t[1];return e[0]=n[0]*r+n[4]*i+n[12],e[1]=n[1]*r+n[5]*i+n[13],e},e.cD=function(e,t){let{x:n,y:r}=Hf.fromLngLat(t);return!(e<0||e>25||r<0||r>=1||n<0||n>=1)},e.cE=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.cF=class extends lo{},e.cG=Me,e.cH=function(e,t){ke.REGISTERED_PROTOCOLS[e]=t},e.cI=function(e){delete ke.REGISTERED_PROTOCOLS[e]},e.cJ=function(e,t){let n={};for(let r=0;r<e.length;r++){let i=t&&t[e[r].id]||Di(e[r]);t&&(t[e[r].id]=i);let a=n[i];a||=n[i]=[],a.push(e[r])}let r=[];for(let e in n)r.push(n[e]);return r},e.cK=J,e.cL=Yf,e.cM=Xm,e.cN=Zd,e.cO=function(t){var n;t.bucket.createArrays(),t.bucket.tilePixelRatio=O/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0],i=r.layout,a=r._unevaluatedLayout._values,o={layoutIconSize:a[`icon-size`].possiblyEvaluate(new Y(t.bucket.zoom+1),t.canonical),layoutTextSize:a[`text-size`].possiblyEvaluate(new Y(t.bucket.zoom+1),t.canonical),textMaxSize:a[`text-size`].possiblyEvaluate(new Y(18))};if(t.bucket.textSizeData.kind===`composite`){let{minZoom:e,maxZoom:n}=t.bucket.textSizeData;o.compositeTextSizes=[a[`text-size`].possiblyEvaluate(new Y(e),t.canonical),a[`text-size`].possiblyEvaluate(new Y(n),t.canonical)]}if(t.bucket.iconSizeData.kind===`composite`){let{minZoom:e,maxZoom:n}=t.bucket.iconSizeData;o.compositeIconSizes=[a[`icon-size`].possiblyEvaluate(new Y(e),t.canonical),a[`icon-size`].possiblyEvaluate(new Y(n),t.canonical)]}let s=i.get(`text-line-height`)*xd,c=i.get(`text-rotation-alignment`)!==`viewport`&&i.get(`symbol-placement`)!==`point`,l=i.get(`text-keep-upright`),u=i.get(`text-size`);for(let a of t.bucket.features){let d=i.get(`text-font`).evaluate(a,{},t.canonical).join(`,`),f=u.evaluate(a,{},t.canonical),p=o.layoutTextSize.evaluate(a,{},t.canonical),m=o.layoutIconSize.evaluate(a,{},t.canonical),h={horizontal:{},vertical:void 0},g=a.text,_,v=[0,0];if(g){let n=g.toString(),o=i.get(`text-letter-spacing`).evaluate(a,{},t.canonical)*xd,u=Da(n)?o:0,m=i.get(`text-anchor`).evaluate(a,{},t.canonical),_=Eh(r,a,t.canonical);if(!_){let e=i.get(`text-radial-offset`).evaluate(a,{},t.canonical);v=e?Th(m,[e*xd,wh]):i.get(`text-offset`).evaluate(a,{},t.canonical).map((e=>e*xd))}let y=c?`center`:i.get(`text-justify`).evaluate(a,{},t.canonical),b=i.get(`symbol-placement`)===`point`?i.get(`text-max-width`).evaluate(a,{},t.canonical)*xd:1/0,x=()=>{t.bucket.allowVerticalPlacement&&Ea(n)&&(h.vertical=$d(g,t.glyphMap,t.glyphPositions,t.imagePositions,d,b,s,m,`left`,u,v,e.ax.vertical,!0,p,f))};if(!c&&_){let n=new Set;if(y===`auto`)for(let e=0;e<_.values.length;e+=2)n.add(Dh(_.values[e]));else n.add(y);let r=!1;for(let i of n)if(!h.horizontal[i])if(r)h.horizontal[i]=h.horizontal[0];else{let n=$d(g,t.glyphMap,t.glyphPositions,t.imagePositions,d,b,s,`center`,i,u,v,e.ax.horizontal,!1,p,f);n&&(h.horizontal[i]=n,r=n.positionedLines.length===1)}x()}else{y===`auto`&&(y=Dh(m));let r=$d(g,t.glyphMap,t.glyphPositions,t.imagePositions,d,b,s,m,y,u,v,e.ax.horizontal,!1,p,f);r&&(h.horizontal[y]=r),x(),Ea(n)&&c&&l&&(h.vertical=$d(g,t.glyphMap,t.glyphPositions,t.imagePositions,d,b,s,m,y,u,v,e.ax.vertical,!1,p,f))}}let y=!1;if(a.icon?.name){let e=t.imageMap[a.icon.name];e&&(_=cf(t.imagePositions[a.icon.name],i.get(`icon-offset`).evaluate(a,{},t.canonical),i.get(`icon-anchor`).evaluate(a,{},t.canonical)),y=!!e.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=y:t.bucket.sdfIcons!==y&&de(`Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer`),(e.pixelRatio!==t.bucket.pixelRatio||i.get(`icon-rotate`).constantOr(1)!==0)&&(t.bucket.iconsNeedLinear=!0))}let b=Ah(h.horizontal)||h.vertical;(n=t.bucket).iconsInText||(n.iconsInText=!!b&&b.iconsInText),(b||_)&&Oh(t.bucket,a,h,_,t.imageMap,o,p,m,v,y,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.cP=Cl,e.cQ=Vl,e.cR=od,e.cS=function(e,t=``){let n=new Pd;return function(e,t,n=``){for(let r in e.layers)t.writeMessage(3,((e,t)=>Um(e,t,n)),e.layers[r])}(e,n,t),n.finish()},e.cT=function(e,t,n,r,i,a){let o=eh(e,t,n,i,0);return o=eh(o,t,r,a,1),o},e.cU=class{constructor(e){this.maxEntries=e,this.map=new Map}get(e){let t=this.map.get(e);return t!==void 0&&(this.map.delete(e),this.map.set(e,t)),t}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.maxEntries){let e=this.map.keys().next().value;this.map.delete(e)}this.map.set(e,t)}clear(){this.map.clear()}},e.cV=Ll,e.cW=Pd,e.cX=Bm,e.cY=function(e,n,r,i,a){return t(this,void 0,void 0,(function*(){if(u())try{return yield _e(e,n,r,i,a)}catch{}return function(e,t,n,r,i){let a=e.width,o=e.height;ve&&ye||(ve=new OffscreenCanvas(a,o),ye=ve.getContext(`2d`,{willReadFrequently:!0})),ve.width=a,ve.height=o,ye.drawImage(e,0,0,a,o);let s=ye.getImageData(t,n,r,i);return ye.clearRect(0,0,a,o),s.data}(e,n,r,i,a)}))},e.cZ=Ic,e.c_=class{constructor(e,t){this.layers={[Hm]:this},this.name=Hm,this.version=t?t.version:1,this.extent=t?t.extent:4096,this.length=e.length,this.features=e}feature(e){return new Vm(this.features[e],this.extent)}},e.ca=class extends So{},e.cb=vd,e.cc=class extends wo{},e.cd=Dc,e.ce=function(e){return e<=1?1:2**Math.ceil(Math.log(e)/Math.LN2)},e.cf=Ec,e.cg=function(e,t,n){var r=t[0],i=t[1],a=t[2],o=n[3]*r+n[7]*i+n[11]*a+n[15];return e[0]=(n[0]*r+n[4]*i+n[8]*a+n[12])/(o||=1),e[1]=(n[1]*r+n[5]*i+n[9]*a+n[13])/o,e[2]=(n[2]*r+n[6]*i+n[10]*a+n[14])/o,e},e.ch=class extends uo{},e.ci=class extends jo{},e.cj=function(e,t){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.ck=function(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7],u=e[8],f=e[9],p=e[10],m=e[11],h=e[12],g=e[13],_=e[14],v=e[15],y=t[0],b=t[1],x=t[2],S=t[3],C=t[4],w=t[5],T=t[6],E=t[7],D=t[8],O=t[9],k=t[10],A=t[11],ee=t[12],te=t[13],j=t[14],ne=t[15];return Math.abs(n-y)<=d*Math.max(1,Math.abs(n),Math.abs(y))&&Math.abs(r-b)<=d*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(i-x)<=d*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(a-S)<=d*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(o-C)<=d*Math.max(1,Math.abs(o),Math.abs(C))&&Math.abs(s-w)<=d*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(c-T)<=d*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(l-E)<=d*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(u-D)<=d*Math.max(1,Math.abs(u),Math.abs(D))&&Math.abs(f-O)<=d*Math.max(1,Math.abs(f),Math.abs(O))&&Math.abs(p-k)<=d*Math.max(1,Math.abs(p),Math.abs(k))&&Math.abs(m-A)<=d*Math.max(1,Math.abs(m),Math.abs(A))&&Math.abs(h-ee)<=d*Math.max(1,Math.abs(h),Math.abs(ee))&&Math.abs(g-te)<=d*Math.max(1,Math.abs(g),Math.abs(te))&&Math.abs(_-j)<=d*Math.max(1,Math.abs(_),Math.abs(j))&&Math.abs(v-ne)<=d*Math.max(1,Math.abs(v),Math.abs(ne))},e.cl=function(e,t){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},e.cm=e=>e.type===`circle`,e.cn=e=>e.type===`heatmap`,e.co=e=>e.type===`line`,e.cp=e=>e.type===`fill`,e.cq=e=>e.type===`fill-extrusion`,e.cr=e=>e.type===`hillshade`,e.cs=e=>e.type===`color-relief`,e.ct=e=>e.type===`background`,e.cu=e=>e.type===`custom`,e.cv=ne,e.cw=function(e,t,n){if(t<=0)return e;let r=1/t;return n===void 0||Math.abs(n)<1e-10?Math.round(e*r)/r:(n>0?Math.ceil(e*r-1e-9):Math.floor(e*r+1e-10))/r},e.cx=function(e,t,n){let r=D(t.x-n.x,t.y-n.y),i=D(e.x-n.x,e.y-n.y);var a,o;return Se(Math.atan2(r[0]*i[1]-r[1]*i[0],(a=r)[0]*(o=i)[0]+a[1]*o[1]))},e.cy=re,e.cz=function(e,t){if(!we[t])return!1;let n=(e?.target)?.ownerDocument?.defaultView||window;return e instanceof n.MouseEvent||e instanceof n.WheelEvent},e.d=A,e.d0=class{constructor(e,t){let n=(t=this.options=Object.assign({},td,t)).debug;if(n&&console.time(`preprocess data`),t.maxZoom<0||t.maxZoom>24)throw Error(`maxZoom should be in the 0-24 range`);if(t.promoteId&&t.generateId)throw Error(`promoteId and generateId cannot be used together.`);let r=cu(e,t);n&&(console.timeEnd(`preprocess data`),console.log(`index: maxZoom: %d, maxPoints: %d`,t.indexMaxZoom,t.indexMaxPoints),console.time(`generate tiles`)),r=Nu(r,t),t.updateable&&(this.source=r),this.initializeIndex(r,t)}initializeIndex(e,t){this.tileIndex=t.cluster?new Bu(t.clusterOptions):new $u(t),e.length&&this.tileIndex.initialize(e)}getTile(e,t,n){return t=+t,n=+n,(e=+e)<0||e>24?null:this.tileIndex.getTile(e,t,n)}updateData(e,t){let n=this.options;if(!n.updateable)throw Error("to update tile geojson `updateable` option must be set to true");let{affected:r,source:i}=function(e,t,n){let r=function(e,t){return e?{removeAll:e.removeAll,remove:new Set(e.remove||[]),add:new Map(e.add?.map((e=>[t.promoteId?e.properties[t.promoteId]:e.id,e]))),update:new Map(e.update?.map((e=>[e.id,e])))}:{remove:new Set,add:new Map,update:new Map}}(t,n),i=[];if(r.removeAll&&(i=e,e=[]),r.remove.size||r.add.size){let t=[];for(let n of e)(r.remove.has(n.id)||r.add.has(n.id))&&t.push(n);if(t.length){i.push(...t);let n=new Set(t.map((e=>e.id)));e=e.filter((e=>!n.has(e.id)))}if(r.add.size){let t=cu({type:`FeatureCollection`,features:Array.from(r.add.values())},n);t=Nu(t,n),i.push(...t),e.push(...t)}}if(r.update.size){let t=new Map,a=[];for(let n of e)r.update.has(n.id)?t.set(n.id,[...t.get(n.id)||[],n]):a.push(n);for(let[e,o]of r.update){let r=t.get(e);if(!r||r.length===0)continue;let s=Lu(r,o,n);i.push(...r,...s),a.push(...s)}e=a}return{affected:i,source:e}}(this.source,e,n);t&&({affected:r,source:i}=this.filterUpdate(i,r,t)),r.length&&(this.source=i,this.tileIndex.updateIndex(i,r,n))}filterUpdate(e,t,n){let r=new Set;for(let i of e)i.id!=null&&(n(mu(i))||(t.push(i),r.add(i.id)));return{affected:t,source:e=e.filter((e=>!r.has(e.id)))}}getData(){if(!this.options.updateable)throw Error("to retrieve data the `updateable` option must be set to true");return{type:`FeatureCollection`,features:this.source.map((e=>mu(e)))}}updateClusterOptions(e,t){let n=this.options.cluster;this.options.cluster=e,this.options.clusterOptions=t,n==e?this.tileIndex.updateIndex(this.source,[],this.options):this.initializeIndex(this.source,this.options)}getClusterExpansionZoom(e){return this.tileIndex.getClusterExpansionZoom(e)}getClusterChildren(e){return this.tileIndex.getChildren(e)}getClusterLeaves(e,t,n){return this.tileIndex.getLeaves(e,t,n)}},e.d1=Ia,e.e=oe,e.f=Fe,e.g=Ae,e.h=e=>t(void 0,void 0,void 0,(function*(){if(e.byteLength===0)return createImageBitmap(new ImageData(1,1));let t=new Blob([new Uint8Array(e)],{type:`image/png`});try{return createImageBitmap(t)}catch(e){throw Error(`Could not load image because of ${A(e).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),e.i=pe,e.j=e=>new Promise(((t,n)=>{let r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame((()=>r.src=ge))},r.onerror=()=>n(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 i=new Blob([new Uint8Array(e)],{type:`image/png`});r.src=e.byteLength?URL.createObjectURL(i):ge})),e.k=(e,t)=>Pe(oe(e,{type:`json`}),t),e.l=ze,e.m=Pe,e.n=Re,e.o=(e,t)=>Pe(oe(e,{type:`arrayBuffer`}),t),e.p=Yd,e.q=function(e){return new Pd(e).readFields(Kd,[])},e.r=function(e){return/[\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(e))},e.s=be,e.t=Cc,e.u=Xa,e.v=ca,e.w=de,e.x=N,e.y=Va,e.z=ua})),n(`worker`,[`./shared`],(function(e){class t{constructor(e,t){this.keyCache={},e&&this.replace(e,t)}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t)}update(t,n,r){for(let n of t){this._layerConfigs[n.id]=n;let t=this._layers[n.id]=e.bT(n,r);t._featureFilter=e.ah(t.filter,r),this.keyCache[n.id]&&delete this.keyCache[n.id]}for(let e of n)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};let i=e.cJ(Object.values(this._layerConfigs),this.keyCache);for(let t of i){let n=t.map((e=>this._layers[e.id])),r=n[0];if(r.isHidden())continue;let i=r.source||``,a=this.familiesBySource[i];a||=this.familiesBySource[i]={};let o=r.sourceLayer||e.ag,s=a[o];s||=a[o]=[],s.push(n)}}}class n{constructor(t){let n={},r=[];for(let e in t){let i=t[e],a=n[e]={};for(let e in i){let t=i[+e];if(!t||t.bitmap.width===0||t.bitmap.height===0)continue;let n={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};r.push(n),a[e]={rect:n,metrics:t.metrics}}}let{w:i,h:a}=e.p(r),o=new e.t({width:i||1,height:a||1});for(let r in t){let i=t[r];for(let t in i){let a=i[+t];if(!a||a.bitmap.width===0||a.bitmap.height===0)continue;let s=n[r][t].rect;e.t.copy(a.bitmap,o,{x:0,y:0},{x:s.x+1,y:s.y+1},a.bitmap)}}this.image=o,this.positions=n}}e.cK(`GlyphAtlas`,n);class r{constructor(t){this.tileID=new e.a3(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}parse(t,r,a,o,s){return e._(this,void 0,void 0,(function*(){this.status=`parsing`,this.data=t,this.collisionBoxArray=new e.ae;let c=new e.cL(Object.keys(t.layers).sort()),l=new e.cM(this.tileID,this.promoteId);l.bucketLayerIDs=[];let u={},d={featureIndex:l,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:a,subdivisionGranularity:s},f=r.familiesBySource[this.source];for(let n in f){let r=t.layers[n];if(!r)continue;r.version===1&&e.w(`Vector tile source "${this.source}" layer "${n}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let o=c.encode(n),s=[];for(let e=0;e<r.length;e++){let t=r.feature(e),i=l.getId(t,n);s.push({feature:t,id:i,index:e,sourceLayerIndex:o})}for(let t of f[n]){let n=t[0];n.source!==this.source&&e.w(`layer.source = ${n.source} does not equal this.source = ${this.source}`),n.isHidden(this.zoom,!0)||(i(t,this.zoom,a),(u[n.id]=n.createBucket({index:l.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:o,sourceID:this.source})).populate(s,d,this.tileID.canonical),l.bucketLayerIDs.push(t.map((e=>e.id))))}}let p=e.bY(d.glyphDependencies,(e=>Object.keys(e).map(Number)));for(let e of this.inFlightDependencies)e?.abort();this.inFlightDependencies=[];let m=Promise.resolve({});if(Object.keys(p).length){let e=new AbortController;this.inFlightDependencies.push(e),m=o.sendAsync({type:`GG`,data:{stacks:p,source:this.source,tileID:this.tileID,type:`glyphs`}},e)}let h=Object.keys(d.iconDependencies),g=Promise.resolve({});if(h.length){let e=new AbortController;this.inFlightDependencies.push(e),g=o.sendAsync({type:`GI`,data:{icons:h,source:this.source,tileID:this.tileID,type:`icons`}},e)}let _=Object.keys(d.patternDependencies),v=Promise.resolve({});if(_.length){let e=new AbortController;this.inFlightDependencies.push(e),v=o.sendAsync({type:`GI`,data:{icons:_,source:this.source,tileID:this.tileID,type:`patterns`}},e)}let y=d.dashDependencies,b=Promise.resolve({});if(Object.keys(y).length){let e=new AbortController;this.inFlightDependencies.push(e),b=o.sendAsync({type:`GDA`,data:{dashes:y}},e)}let[x,S,C,w]=yield Promise.all([m,g,v,b]),T=new n(x),E=new e.cN(S,C);for(let t in u){let n=u[t];n instanceof e.af?(i(n.layers,this.zoom,a),e.cO({bucket:n,glyphMap:x,glyphPositions:T.positions,imageMap:S,imagePositions:E.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:d.subdivisionGranularity})):n.hasDependencies&&(n instanceof e.cP||n instanceof e.cQ||n instanceof e.cR)&&(i(n.layers,this.zoom,a),n.addFeatures(d,this.tileID.canonical,E.patternPositions,w))}return this.status=`done`,{buckets:Object.values(u).filter((e=>!e.isEmpty())),featureIndex:l,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:T.image,imageAtlas:E,dashPositions:w,glyphMap:this.returnDependencies?x:null,iconMap:this.returnDependencies?S:null,glyphPositions:this.returnDependencies?T.positions:null}}))}}function i(t,n,r){let i=new e.J(n);for(let e of t)e.recalculate(i,r)}class a{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(e,t){this.loading[e]=t}finishLoading(e){delete this.loading[e]}abort(e){let t=this.loading[e];t!=null&&t.abort&&(t.abort.abort(),delete this.loading[e])}setParsing(e,t){this.parsing[e]=t}consumeParsing(e){let t=this.parsing[e];if(t)return delete this.parsing[e],t}clearParsing(e){delete this.parsing[e]}markLoaded(e,t){this.loaded[e]=t}getLoaded(e){let t=this.loaded[e];if(t)return t}removeLoaded(e){delete this.loaded[e]}clearLoaded(){this.loaded={}}}class o{constructor(e){this.start=`${e}#start`,this.end=`${e}#end`,this.measure=e,performance.mark(this.start)}finish(){performance.mark(this.end);let e=performance.getEntriesByName(this.measure);return e.length===0&&(performance.measure(this.measure,this.start,this.end),e=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),e}}class s{constructor(e,t,n,r,i){this.type=e,this.properties=n||{},this.extent=i,this.pointsArray=t,this.id=r}loadGeometry(){return this.pointsArray.map((t=>t.map((t=>new e.P(t.x,t.y)))))}}class c{constructor(e,t,n){this.version=2,this._myFeatures=e,this.name=t,this.length=e.length,this.extent=n}feature(e){return this._myFeatures[e]}}class l{constructor(){this.layers={}}addLayer(e){this.layers[e.name]=e}}function u(t){let n=e.cS(t);return n.byteOffset===0&&n.byteLength===n.buffer.byteLength||(n=new Uint8Array(n)),{vectorTile:t,rawData:n.buffer}}function d(t,n,r){let{extent:i}=t,a=2**(r.z-n.z),o=(r.x-n.x*a)*i,l=(r.y-n.y*a)*i,u=[];for(let n=0;n<t.length;n++){let r=t.feature(n),c=r.loadGeometry();for(let e of c)for(let t of e)t.x=t.x*a-o,t.y=t.y*a-l;c=e.cT(c,r.type,-128,-128,i+128,i+128),c.length!==0&&u.push(new s(r.type,c,r.properties,r.id,i))}return new c(u,t.name,i)}class f{constructor(t,n,r){this.actor=t,this.layerIndex=n,this.availableImages=r,this.tileState=new a,this.overzoomedTileResultCache=new e.cU(1e3)}loadVectorTile(t,n){try{return{vectorTile:t.encoding===`mlt`?new e.cX(n):new e.cV(new e.cW(n)),rawData:n}}catch(r){let i=new Uint8Array(n),a=`Unable to parse the tile at ${t.request.url}, `;throw a+=i[0]===31&&i[1]===139?`please make sure the data is not gzipped and that you have configured the relevant header in the server`:`got error: ${e.d(r).message}`,Error(a)}}loadTile(t){return e._(this,void 0,void 0,(function*(){let{uid:n,overzoomParameters:i}=t;i&&(t.request=i.overzoomRequest);let a=this._startRequestTiming(t),o=new r(t);this.tileState.startLoading(n,o);let s=new AbortController;o.abort=s;try{let r=yield e.o(t.request,s);if(t.etag&&t.etag===r.etag)return this.tileState.finishLoading(n),this._getEtagUnmodifiedResult(r,a);let c=this.loadVectorTile(t,r.data);if(this.tileState.finishLoading(n),!c)return null;let{vectorTile:l,rawData:u}=c;i&&({vectorTile:l,rawData:u}=this._getOverzoomTile(t,l));let d=this._getExpiryData(r),f=this._finishRequestTiming(a);o.vectorTile=l,this.tileState.markLoaded(n,o);let p={rawData:u,cacheControl:d,resourceTiming:f};this.tileState.setParsing(n,p);try{return yield this._parseWorkerTile(o,t,p)}finally{this.tileState.clearParsing(n)}}catch(e){throw this.tileState.finishLoading(n),o.status=`done`,this.tileState.markLoaded(n,o),e}}))}_getEtagUnmodifiedResult(t,n){let r=this._getExpiryData(t),i=this._finishRequestTiming(n);return e.e({etagUnmodified:!0},r,i)}_parseWorkerTile(t,n,r){return e._(this,void 0,void 0,(function*(){let i=yield t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,n.subdivisionGranularity);if(r){let{rawData:t,cacheControl:a,resourceTiming:o}=r;i=e.e({rawTileData:t.slice(0),encoding:n.encoding},i,a,o)}return i}))}_getExpiryData({expires:e,cacheControl:t,etag:n}){let r={};return e&&(r.expires=e),t&&(r.cacheControl=t),n&&(r.etag=n),r}_startRequestTiming(e){if(e.request?.collectResourceTiming)return new o(e.request.url)}_finishRequestTiming(e){let t=e?.finish();return t?{resourceTiming:JSON.parse(JSON.stringify(t))}:{}}_getOverzoomTile(e,t){let{tileID:n,source:r,overzoomParameters:i}=e,{maxZoomTileID:a}=i,o=`${a.key}_${n.key}_${e.request?.url}`,s=this.overzoomedTileResultCache.get(o);if(s)return s;let c=new l,f=this.layerIndex.familiesBySource[r];for(let e in f){let r=t.layers[e];if(!r)continue;let i=d(r,a,n.canonical);i.length>0&&c.addLayer(i)}let p=u(c);return this.overzoomedTileResultCache.set(o,p),p}reloadTile(t){return e._(this,void 0,void 0,(function*(){let e=t.uid,n=this.tileState.getLoaded(e);if(!n)throw Error(`Should not be trying to reload a tile that was never loaded or has been removed`);if(n.showCollisionBoxes=t.showCollisionBoxes,n.status===`parsing`){let r=this.tileState.consumeParsing(e);return yield this._parseWorkerTile(n,t,r)}if(n.status===`done`&&n.vectorTile)return yield this._parseWorkerTile(n,t)}))}abortTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.abort(t.uid)}))}removeTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(t.uid)}))}}class p{constructor(){this.loaded={}}loadTile(t){return e._(this,void 0,void 0,(function*(){let{uid:n,encoding:r,rawImageData:i,redFactor:a,greenFactor:o,blueFactor:s,baseShift:c}=t,l=i.width+2,u=i.height+2,d=e.b(i)?new e.R({width:l,height:u},yield e.cY(i,-1,-1,l,u)):i,f=new e.cZ(n,d,r,a,o,s,c);return this.loaded||={},this.loaded[n]=f,f}))}removeTile(e){let t=this.loaded,n=e.uid;t!=null&&t[n]&&delete t[n]}}class m{constructor(e,t,n,r=h){this.actor=e,this.layerIndex=t,this.availableImages=n,this.tileState=new a,this._createGeoJSONIndex=r}loadVectorTile(t){if(!this._geoJSONIndex)throw Error(`Unable to parse the data into a cluster or geojson`);let{z:n,x:r,y:i}=t.tileID.canonical,a=this._geoJSONIndex.getTile(n,r,i);return a?u(new e.c_(a.features,{version:2,extent:e.a6})):null}loadTile(t){return e._(this,void 0,void 0,(function*(){let{uid:e}=t,n=new r(t);n.abort=new AbortController;try{let r=this.loadVectorTile(t);if(!r)return null;let{vectorTile:i,rawData:a}=r;n.vectorTile=i,this.tileState.markLoaded(e,n);let o={rawData:a};this.tileState.setParsing(e,o);try{return yield this._parseWorkerTile(n,t,o)}finally{this.tileState.clearParsing(e)}}catch(t){throw n.status=`done`,this.tileState.markLoaded(e,n),t}}))}_reloadLoadedTile(t){return e._(this,void 0,void 0,(function*(){let e=t.uid,n=this.tileState.getLoaded(e);if(!n)throw Error(`Should not be trying to reload a tile that was never loaded or has been removed`);if(n.showCollisionBoxes=t.showCollisionBoxes,n.status===`parsing`){let r=this.tileState.consumeParsing(e);return yield this._parseWorkerTile(n,t,r)}if(n.status===`done`&&n.vectorTile)return yield this._parseWorkerTile(n,t)}))}_parseWorkerTile(t,n,r){return e._(this,void 0,void 0,(function*(){let i=yield t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,n.subdivisionGranularity);if(r){let{rawData:t}=r;i=e.e({rawTileData:t.slice(0),encoding:`mvt`},i)}return i}))}abortTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.abort(t.uid)}))}removeTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(t.uid)}))}loadData(t){return e._(this,void 0,void 0,(function*(){var n;(n=this._pendingRequest)==null||n.abort();let r=this._startRequestTiming(t);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(t,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();let e={};return t.request&&(e.data=t.data),this._finishRequestTiming(r,t,e),e}catch(t){if(delete this._pendingRequest,!e.$(t))throw t;return{abandoned:!0}}}))}_startRequestTiming(e){if(e.request?.collectResourceTiming)return new o(e.request.url)}_finishRequestTiming(e,t,n){let r=e?.finish();r&&(n.resourceTiming={[t.source]:JSON.parse(JSON.stringify(r))})}reloadTile(e){return this.tileState.getLoaded(e.uid)?this._reloadLoadedTile(e):this.loadTile(e)}loadAndProcessGeoJSON(t,n){return e._(this,void 0,void 0,(function*(){if(t.request&&(t.data=(yield e.k(t.request,n)).data),t.data)return t.data=this._filterGeoJSON(t.data,t.filter),void(this._geoJSONIndex=this._createGeoJSONIndex(t.data,t));if(t.dataDiff)return this._geoJSONIndex??=this._createGeoJSONIndex({type:`FeatureCollection`,features:[]},t),void this._geoJSONIndex.updateData(t.dataDiff,this._getFilterPredicate(t.filter));if(t.updateCluster&&this._geoJSONIndex.updateClusterOptions(t.geojsonVtOptions.cluster,g(t)),this._geoJSONIndex==null)throw Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`)}))}_filterGeoJSON(e,t){if(e.type!==`FeatureCollection`)return e;let n=this._getFilterPredicate(t);return n?{type:`FeatureCollection`,features:e.features.filter((e=>n(e)))}:e}_getFilterPredicate(t){if(typeof t!=`boolean`&&!t?.length)return;let n=e.c$(t,{type:`boolean`,"property-type":`data-driven`,overridable:!1,transition:!1});if(n.result===`error`)throw Error(n.value.map((e=>`${e.key}: ${e.message}`)).join(`, `));return e=>n.value.evaluate({zoom:0},e)}removeSource(t){return e._(this,void 0,void 0,(function*(){var e;(e=this._pendingRequest)==null||e.abort()}))}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getClusterChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getClusterLeaves(e.clusterId,e.limit,e.offset)}}function h(t,n){let r=e.e(n.geojsonVtOptions||{},{updateable:!0,clusterOptions:g(n)});return new e.d0(t,r)}function g({geojsonVtOptions:t,clusterProperties:n}){if(!n||!t.clusterOptions)return t.clusterOptions;let r={},i={},a={accumulated:null,zoom:0},o={properties:null},s=Object.keys(n);for(let t of s){let[a,o]=n[t],s=e.c$(o),c=e.c$(typeof a==`string`?[a,[`accumulated`],[`get`,t]]:a);r[t]=s.value,i[t]=c.value}return t.clusterOptions.map=e=>{o.properties=e;let t={};for(let e of s)t[e]=r[e].evaluate(a,o);return t},t.clusterOptions.reduce=(e,t)=>{o.properties=t;for(let t of s)a.accumulated=e[t],e[t]=i[t].evaluate(a,o)},t.clusterOptions}class _{constructor(t){this.self=t,this.actor=new e.N(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(e,t)=>{if(this.externalWorkerSourceTypes[e])throw Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=t},this.self.addProtocol=e.cH,this.self.removeProtocol=e.cI,this.self.registerRTLTextPlugin=t=>{e.d1.setMethods(t)},this.self.makeRequest=e.m,this.actor.registerMessageHandler(`LDT`,((e,t)=>this._getDEMWorkerSource(e,t.source).loadTile(t))),this.actor.registerMessageHandler(`RDT`,((t,n)=>e._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(t,n.source).removeTile(n)})))),this.actor.registerMessageHandler(`GCEZ`,((t,n)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,n.type,n.source).getClusterExpansionZoom(n)})))),this.actor.registerMessageHandler(`GCC`,((t,n)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,n.type,n.source).getClusterChildren(n)})))),this.actor.registerMessageHandler(`GCL`,((t,n)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,n.type,n.source).getClusterLeaves(n)})))),this.actor.registerMessageHandler(`LD`,((e,t)=>this._getWorkerSource(e,t.type,t.source).loadData(t))),this.actor.registerMessageHandler(`LT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).loadTile(t))),this.actor.registerMessageHandler(`RT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).reloadTile(t))),this.actor.registerMessageHandler(`AT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).abortTile(t))),this.actor.registerMessageHandler(`RMT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).removeTile(t))),this.actor.registerMessageHandler(`RS`,((t,n)=>e._(this,void 0,void 0,(function*(){if(!this.workerSources[t]?.[n.type]?.[n.source])return;let e=this.workerSources[t][n.type][n.source];delete this.workerSources[t][n.type][n.source],e.removeSource!==void 0&&e.removeSource(n)})))),this.actor.registerMessageHandler(`RM`,(t=>e._(this,void 0,void 0,(function*(){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t],this.globalStates.delete(t)})))),this.actor.registerMessageHandler(`SR`,((t,n)=>e._(this,void 0,void 0,(function*(){this.referrer=n})))),this.actor.registerMessageHandler(`SRPS`,((e,t)=>this._syncRTLPluginState(e,t))),this.actor.registerMessageHandler(`IS`,((t,n)=>e._(this,void 0,void 0,(function*(){this.self.importScripts(n)})))),this.actor.registerMessageHandler(`SI`,((e,t)=>this._setImages(e,t))),this.actor.registerMessageHandler(`UL`,((t,n)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).update(n.layers,n.removedIds,this._getGlobalState(t))})))),this.actor.registerMessageHandler(`UGS`,((t,n)=>e._(this,void 0,void 0,(function*(){let e=this._getGlobalState(t);for(let t in n)e[t]=n[t]})))),this.actor.registerMessageHandler(`SL`,((t,n)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).replace(n,this._getGlobalState(t))}))))}_getGlobalState(e){let t=this.globalStates.get(e);return t||(t={},this.globalStates.set(e,t)),t}_setImages(t,n){return e._(this,void 0,void 0,(function*(){this.availableImages[t]=n;for(let e in this.workerSources[t]){let r=this.workerSources[t][e];for(let e in r)r[e].availableImages=n}}))}_syncRTLPluginState(t,n){return e._(this,void 0,void 0,(function*(){return yield e.d1.syncState(n,this.self.importScripts)}))}_getAvailableImages(e){let t=this.availableImages[e];return t||=[],t}_getLayerIndex(e){let n=this.layerIndexes[e];return n||=this.layerIndexes[e]=new t,n}_getWorkerSource(e,t,n){var r,i;if((r=this.workerSources)[e]||(r[e]={}),(i=this.workerSources[e])[t]||(i[t]={}),!this.workerSources[e][t][n]){let r={sendAsync:(t,n)=>(t.targetMapId=e,this.actor.sendAsync(t,n))};switch(t){case`vector`:this.workerSources[e][t][n]=new f(r,this._getLayerIndex(e),this._getAvailableImages(e));break;case`geojson`:this.workerSources[e][t][n]=new m(r,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][t][n]=new this.externalWorkerSourceTypes[t](r,this._getLayerIndex(e),this._getAvailableImages(e))}}return this.workerSources[e][t][n]}_getDEMWorkerSource(e,t){var n,r;return(n=this.demWorkerSources)[e]||(n[e]={}),(r=this.demWorkerSources[e])[t]||(r[t]=new p),this.demWorkerSources[e][t]}}return e.i(self)&&(self.worker=new _(self)),_})),n(`index`,[`exports`,`./shared`],(function(e,t){var n=`5.24.0`;function r(){var e=new t.A(4);return t.A!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}let i,a,o,s={frame(e,n,r,i){let a=i||window,o=a.requestAnimationFrame((e=>{s(),n(e)})),{unsubscribe:s}=t.s(e.signal,`abort`,(()=>{s(),a.cancelAnimationFrame(o),r(new t.a(e.signal.reason))}),!1)},frameAsync(e,t){return new Promise(((n,r)=>{this.frame(e,n,r,t)}))},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t=window.document.createElement(`canvas`),n=t.getContext(`2d`,{willReadFrequently:!0});if(!n)throw Error(`failed to create canvas 2d context`);return t.width=e.width,t.height=e.height,n.drawImage(e,0,0,e.width,e.height),n},resolveURL:e=>(i||=document.createElement(`a`),i.href=e,i.href),hardwareConcurrency:typeof navigator<`u`&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return o===void 0?!!matchMedia&&(a??=matchMedia(`(prefers-reduced-motion: reduce)`),a.matches):o},set prefersReducedMotion(e){o=e}},c=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt===null?performance.now():this._frozenAt}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function l(){return c.getCurrentTime()}var u;class d{static create(e,t,n){let r=window.document.createElement(e);return t!==void 0&&(r.className=t),n&&n.appendChild(r),r}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){d.docStyle&&d.selectProp&&(d.userSelect=d.docStyle[d.selectProp],d.docStyle[d.selectProp]=`none`)}static enableDrag(){d.docStyle&&d.selectProp&&(d.docStyle[d.selectProp]=d.userSelect)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener(`click`,d.suppressClickInternal,!0)}static suppressClick(){window.addEventListener(`click`,d.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener(`click`,d.suppressClickInternal,!0)}),0)}static getScale(e){let t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,n,r){let i=n.boundingClientRect;return new t.P((r.clientX-i.left)/n.x-e.clientLeft,(r.clientY-i.top)/n.y-e.clientTop)}static mousePos(e,t){let n=d.getScale(e);return d.getPoint(e,n,t)}static touchPos(e,t){let n=[],r=d.getScale(e);for(let i of t)n.push(d.getPoint(e,r,i));return n}static sanitize(e){let t=new DOMParser().parseFromString(e,`text/html`).body||document.createElement(`body`),n=t.querySelectorAll(`script`);for(let e of n)e.remove();return d.clean(t),t.innerHTML}static isPossiblyDangerous(e,t){let n=t.replace(/\s+/g,``).toLowerCase();return!(![`src`,`href`,`xlink:href`].includes(e)||!n.includes(`javascript:`)&&!n.includes(`data:`))||!!e.startsWith(`on`)||void 0}static clean(e){let t=e.children;for(let e of t)d.removeAttributes(e),d.clean(e)}static removeAttributes(e){for(let{name:t,value:n}of e.attributes)d.isPossiblyDangerous(t,n)&&e.removeAttribute(t)}}d.docStyle=typeof window<`u`&&window.document?.documentElement.style,d.selectProp=!d.docStyle||`userSelect`in d.docStyle?`userSelect`:`webkitUserSelect`,function(e){let n,r,i,a;e.resetRequestQueue=()=>{n=[],r=0,i=0,a={}},e.addThrottleControl=e=>{let t=i++;return a[t]=e,t},e.removeThrottleControl=e=>{delete a[e],s()},e.getImage=(e,r,i=!0)=>new Promise(((a,o)=>{e.headers||={},e.headers.accept=`image/webp,*/*`,t.e(e,{type:`image`}),n.push({abortController:r,requestParameters:e,supportImageRefresh:i,state:`queued`,onError:e=>{o(e)},onSuccess:e=>{a(e)}}),s()}));let o=e=>t._(this,void 0,void 0,(function*(){e.state=`running`;let{requestParameters:n,supportImageRefresh:i,onError:a,onSuccess:o,abortController:l}=e,u=!1===i&&!t.i(self)&&!t.g(n.url)&&(!n.headers||Object.keys(n.headers).reduce(((e,t)=>e&&t===`accept`),!0));r++;let d=u?c(n,l):t.m(n,l);try{let n=yield d;delete e.abortController,e.state=`completed`,n.data instanceof HTMLImageElement||t.b(n.data)?o(n):n.data&&o({data:yield(f=n.data,typeof createImageBitmap==`function`?t.h(f):t.j(f)),cacheControl:n.cacheControl,expires:n.expires})}catch(n){delete e.abortController,a(t.d(n))}finally{r--,s()}var f})),s=()=>{let e=(()=>{for(let e of Object.keys(a))if(a[e]())return!0;return!1})()?t.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=r;t<e&&n.length>0;t++){let e=n.shift();e.abortController.signal.aborted?t--:o(e)}},c=(e,n)=>new Promise(((r,i)=>{let a=new Image,o=e.url,s=e.credentials;s&&s===`include`?a.crossOrigin=`use-credentials`:(s&&s===`same-origin`||!t.f(o))&&(a.crossOrigin=`anonymous`),n.signal.addEventListener(`abort`,(()=>{a.src=``,i(new t.a(n.signal.reason))})),a.fetchPriority=`high`,a.onload=()=>{a.onerror=a.onload=null,r({data:a})},a.onerror=()=>{a.onerror=a.onload=null,n.signal.aborted||i(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.`))},a.src=o}))}(u||={}),u.resetRequestQueue();class f{constructor(e){this._transformRequestFn=e??null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function p(e){let t=[];if(typeof e==`string`)t.push({id:`default`,url:e});else if(e&&e.length>0){let n=[];for(let{id:r,url:i}of e){let e=`${r}${i}`;n.includes(e)||(n.push(e),t.push({id:r,url:i}))}}return t}function m(e,t,n){try{let r=new URL(e);return r.pathname+=`${t}${n}`,r.toString()}catch{throw Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function h(e){let{userImage:t}=e;return!(!t?.render||!t.render()||(e.data.replace(new Uint8Array(t.data.buffer)),0))}class g extends t.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&=(this.atlasTexture.destroy(),null);for(let e of Object.keys(this.images))this.removeImage(e);this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:e,promiseResolve:t}of this.requestors)t(this._getImagesForIds(e));this.requestors=[]}}getImage(e){let n=this.images[e];if(n&&!n.data&&n.spriteData){let e=n.spriteData;n.data=new t.R({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),n.spriteData=null}return n}addImage(e,t){if(this.images[e])throw Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t)}_validate(e,n){let r=!0,i=n.data||n.spriteData;return this._validateStretch(n.stretchX,i?.width)||(this.fire(new t.l(Error(`Image "${e}" has invalid "stretchX" value`))),r=!1),this._validateStretch(n.stretchY,i?.height)||(this.fire(new t.l(Error(`Image "${e}" has invalid "stretchY" value`))),r=!1),this._validateContent(n.content,n)||(this.fire(new t.l(Error(`Image "${e}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let n=0;for(let r of e){if(r[0]<n||r[1]<r[0]||t<r[1])return!1;n=r[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let n=t.spriteData,r=n?.width||t.data.width,i=n?.height||t.data.height;return!(e[0]<0||r<e[0]||e[1]<0||i<e[1]||e[2]<0||r<e[2]||e[3]<0||i<e[3]||e[2]<e[0]||!(e[3]>=e[1]))}updateImage(e,t,n=!0){let r=this.getImage(e);if(n&&(r.data.width!==t.data.width||r.data.height!==t.data.height))throw Error(`size mismatch between old image (${r.data.width}x${r.data.height}) and new image (${t.data.width}x${t.data.height}).`);t.version=r.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){var t;let n=this.images[e];delete this.images[e],delete this.patterns[e],(t=n.userImage)!=null&&t.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise(((t,n)=>{let r=!0;if(!this.isLoaded())for(let t of e)this.images[t]||(r=!1);this.isLoaded()||r?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})}))}_getImagesForIds(e){let n={};for(let r of e){let e=this.getImage(r);e||=(this.fire(new t.n(`styleimagemissing`,{id:r})),this.getImage(r)),e?n[r]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:!!e.userImage?.render}:t.w(`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 n}getPixelSize(){let{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){let n=this.patterns[e],r=this.getImage(e);if(!r)return null;if(n&&n.position.version===r.version)return n.position;if(n)n.position.version=r.version;else{let n={w:r.data.width+2,h:r.data.height+2,x:0,y:0},i=new t.I(n,r);this.patterns[e]={bin:n,position:i}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let n=e.gl;this.atlasTexture?this.dirty&&=(this.atlasTexture.update(this.atlasImage),!1):this.atlasTexture=new t.T(e,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let t in this.patterns)e.push(this.patterns[t].bin);let{w:n,h:r}=t.p(e),i=this.atlasImage;i.resize({width:n||1,height:r||1});for(let e in this.patterns){let{bin:n}=this.patterns[e],r=n.x+1,a=n.y+1,o=this.getImage(e).data,s=o.width,c=o.height;t.R.copy(o,i,{x:0,y:0},{x:r,y:a},{width:s,height:c}),t.R.copy(o,i,{x:0,y:c-1},{x:r,y:a-1},{width:s,height:1}),t.R.copy(o,i,{x:0,y:0},{x:r,y:a+c},{width:s,height:1}),t.R.copy(o,i,{x:s-1,y:0},{x:r-1,y:a},{width:1,height:c}),t.R.copy(o,i,{x:0,y:0},{x:r+s,y:a},{width:1,height:c})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let n of e){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;let e=this.getImage(n);e||t.w(`Image with ID: "${n}" was not found`),h(e)&&this.updateImage(n,e)}}cloneImages(){let e={};for(let t in this.images){let n=this.images[t];e[t]=Object.assign(Object.assign({},n),{data:n.data?n.data.clone():null})}return e}}let _=0x56bc75e2d63100000,v=new Float64Array(256);for(let e=0;e<256;e++){let t=.5-(e/255)**(1/2.2);v[e]=t*Math.abs(t)}function y(e,t,n,r,i,a,o,s,c){for(let l=t;l<t+r;l++)b(e,n*a+l,a,i,o,s,c);for(let l=n;l<n+i;l++)b(e,l*a+t,1,r,o,s,c)}function b(e,t,n,r,i,a,o){a[0]=0,o[0]=-0x56bc75e2d63100000,o[1]=_,i[0]=e[t];for(let s=1,c=0,l=0;s<r;s++){i[s]=e[t+s*n];let r=s*s;do{let e=a[c];l=(i[s]-i[e]+r-e*e)/(s-e)/2}while(l<=o[c]&&--c>-1);c++,a[c]=s,o[c]=l,o[c+1]=_}for(let s=0,c=0;s<r;s++){for(;o[c+1]<s;)c++;let r=a[c],l=s-r;e[t+s*n]=i[r]+l*l}}v[255]=-0x56bc75e2d63100000;let x=t.v.layout_symbol[`text-font`].default.join(`,`);class S{constructor(e,t,n){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={},this.lang=n}setURL(e){this.url=e}getGlyphs(e){return t._(this,void 0,void 0,(function*(){let t=[];for(let n in e)for(let r of e[n])t.push(this._getAndCacheGlyphsPromise(n,r));let n=yield Promise.all(t),r={};for(let{stack:e,id:t,glyph:i}of n)r[e]||(r[e]={}),r[e][t]=i&&{id:i.id,bitmap:i.bitmap.clone(),metrics:i.metrics};return r}))}_getAndCacheGlyphsPromise(e,n){return t._(this,void 0,void 0,(function*(){var t;(t=this.entries)[e]??(t[e]={glyphs:{},requests:{},ranges:{}});let r=this.entries[e],i=r.glyphs[n];return i===void 0?!this.url||this._charUsesLocalIdeographFontFamily(n)?(i=r.glyphs[n]=this._drawGlyph(r,e,n),{stack:e,id:n,glyph:i}):yield this._downloadAndCacheRangePromise(e,n):{stack:e,id:n,glyph:i}}))}_downloadAndCacheRangePromise(e,n){return t._(this,void 0,void 0,(function*(){var r;let i=this.entries[e],a=Math.floor(n/256);if(i.ranges[a])return{stack:e,id:n,glyph:null};(r=i.requests)[a]||(r[a]=S.loadGlyphRange(e,a,this.url,this.requestManager));try{let t=yield i.requests[a];for(let e in t)i.glyphs[+e]=t[+e];return i.ranges[a]=!0,{stack:e,id:n,glyph:t[n]||null}}catch(r){let o=i.glyphs[n]=this._drawGlyph(i,e,n);return this._warnOnMissingGlyphRange(o,a,n,t.d(r)),{stack:e,id:n,glyph:o}}}))}_warnOnMissingGlyphRange(e,n,r,i){let a=256*n,o=a+255,s=r.toString(16).padStart(4,`0`).toUpperCase();t.w(`Unable to load glyph range ${n}, ${a}-${o}. Rendering codepoint U+${s} locally instead. ${i}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&t.r(e)}_drawGlyph(e,n,r){let i=n===x&&this.localIdeographFontFamily!==``&&this._charUsesLocalIdeographFontFamily(r),a=i?`ideographTinySDF`:`tinySDF`;e[a]||(e[a]=this._createTinySDF(i?this.localIdeographFontFamily:n));let o=e[a].draw(String.fromCodePoint(r)),s=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(r));return{id:r,bitmap:new t.t({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+.5||0,top:o.glyphTop/2-27.5||-8,advance:s?0:o.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(e){let t=e?e.split(`,`):[];t.push(`sans-serif`);let n=t.map((e=>/[-\w]+/.test(e)?e:`'${CSS.escape(e)}'`)).join(`,`);return new S.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:n,fontWeight:this._fontWeight(t[0]),fontStyle:this._fontStyle(t[0]),lang:this.lang})}_fontStyle(e){return/italic/i.test(e)?`italic`:/oblique/i.test(e)?`oblique`:`normal`}_fontWeight(e){let t={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},n;for(let[r,i]of Object.entries(t))RegExp(`\\b${r}\\b`,`i`).test(e)&&(n=`${i}`);return n}destroy(){for(let e in this.entries){let t=this.entries[e];t.tinySDF=null,t.ideographTinySDF=null,t.glyphs={},t.requests={},t.ranges={}}this.entries={}}}S.loadGlyphRange=function(e,n,r,i){return t._(this,void 0,void 0,(function*(){let a=256*n,o=a+255,s=yield i.transformRequest(r.replace(`{fontstack}`,e).replace(`{range}`,`${a}-${o}`),`Glyphs`),c=yield t.o(s,new AbortController);if(!c?.data)throw Error(`Could not load glyph range. range: ${n}, ${a}-${o}`);let l={};for(let e of t.q(c.data))l[e.id]=e;return l}))},S.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:n=8,cutoff:r=.25,fontFamily:i=`sans-serif`,fontWeight:a=`normal`,fontStyle:o=`normal`,lang:s=null}={}){this.buffer=t,this.radius=n,this.cutoff=r,this.lang=s;let c=this.size=e+4*t,l=this._createCanvas(c),u=this.ctx=l.getContext(`2d`,{willReadFrequently:!0});u.font=`${o} ${a} ${e}px ${i}`,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(e){if(typeof OffscreenCanvas<`u`)return new OffscreenCanvas(e,e);let t=document.createElement(`canvas`);return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:r,actualBoundingBoxLeft:i,actualBoundingBoxRight:a}=this.ctx.measureText(e),o=Math.ceil(n),s=Math.floor(i),c=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a)-s)),l=Math.max(0,Math.min(this.size-this.buffer,o+Math.ceil(r))),u=c+2*this.buffer,d=l+2*this.buffer,f=Math.max(u*d,0),p=new Uint8ClampedArray(f),m={data:p,width:u,height:d,glyphWidth:c,glyphHeight:l,glyphTop:o,glyphLeft:s,glyphAdvance:t};if(c===0||l===0)return m;let{ctx:h,buffer:g,gridInner:b,gridOuter:x}=this;this.lang&&(h.lang=this.lang),h.clearRect(g,g,c,l),h.fillText(e,g-s,g+o);let S=h.getImageData(g,g,c,l);x.fill(_,0,f),b.fill(0,0,f);let C=3;for(let e=0;e<l;e++){let t=(e+g)*u+g;for(let e=0;e<c;e++,C+=4,t++){let e=S.data[C];if(e===0)continue;let n=v[e];x[t]=Math.max(0,n),b[t]=Math.max(0,-n)}}y(x,0,0,u,d,u,this.f,this.v,this.z),y(b,g,g,c,l,u,this.f,this.v,this.z);let w=255/this.radius,T=255*(1-this.cutoff);for(let e=0;e<f;e++){let t=Math.sqrt(x[e])-Math.sqrt(b[e]);p[e]=Math.round(T-w*t)}return m}};class C{constructor(){this.specification=t.x.light.position}possiblyEvaluate(e,n){return t.G(e.expression.evaluate(n))}interpolate(e,n,r){return{x:t.H.number(e.x,n.x,r),y:t.H.number(e.y,n.y,r),z:t.H.number(e.z,n.z,r)}}}let w;class T extends t.E{constructor(e){super(),w||=new t.u({anchor:new t.D(t.x.light.anchor),position:new C,color:new t.D(t.x.light.color),intensity:new t.D(t.x.light.intensity)}),this._transitionable=new t.y(w,void 0),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,n={}){if(!this._validate(t.z,e,n))for(let n in e){let r=e[n];n.endsWith(t.B)?this._transitionable.setTransition(n.slice(0,-t.B.length),r):this._transitionable.setValue(n,r)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,r){return!1!==r?.validate&&t.C(this,e.call(t.F,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:t.x}))}}let E=new t.u({"sky-color":new t.D(t.x.sky[`sky-color`]),"horizon-color":new t.D(t.x.sky[`horizon-color`]),"fog-color":new t.D(t.x.sky[`fog-color`]),"fog-ground-blend":new t.D(t.x.sky[`fog-ground-blend`]),"horizon-fog-blend":new t.D(t.x.sky[`horizon-fog-blend`]),"sky-horizon-blend":new t.D(t.x.sky[`sky-horizon-blend`]),"atmosphere-blend":new t.D(t.x.sky[`atmosphere-blend`])});class D extends t.E{constructor(e){super(),this._transitionable=new t.y(E,void 0),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.J(0))}setSky(e,n={}){if(!this._validate(t.K,e,n)){e||={"sky-color":`transparent`,"horizon-color":`transparent`,"fog-color":`transparent`,"fog-ground-blend":1,"atmosphere-blend":0};for(let n in e){let r=e[n];n.endsWith(t.B)?this._transitionable.setTransition(n.slice(0,-t.B.length),r):this._transitionable.setValue(n,r)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,r={}){return!1!==r?.validate&&t.C(this,e.call(t.F,t.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:t.x})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class O{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){var n;let r=e.join(`,`)+String(t);return(n=this.dashEntry)[r]||(n[r]=this.addDash(e,t)),this.dashEntry[r]}getDashRanges(e,t,n){let r=[],i=e.length%2==1?-e[e.length-1]*n:0,a=e[0]*n,o=!0;r.push({left:i,right:a,isDash:o,zeroLength:e[0]===0});let s=e[0];for(let t=1;t<e.length;t++){o=!o;let c=e[t];i=s*n,s+=c,a=s*n,r.push({left:i,right:a,isDash:o,zeroLength:c===0})}return r}addRoundDash(e,t,n){let r=t/2;for(let t=-n;t<=n;t++){let i=this.width*(this.nextRow+n+t),a=0,o=e[a];for(let s=0;s<this.width;s++){s/o.right>1&&(o=e[++a]);let c=Math.abs(s-o.left),l=Math.abs(s-o.right),u=Math.min(c,l),d,f=t/n*(r+1);if(o.isDash){let e=r-Math.abs(f);d=Math.sqrt(u*u+e*e)}else d=r-Math.sqrt(u*u+f*f);this.data[i+s]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){let n=e[t],r=e[t+1];n.zeroLength?e.splice(t,1):r&&r.isDash===n.isDash&&(r.left=n.left,e.splice(t,1))}let t=e[0],n=e[e.length-1];t.isDash===n.isDash&&(t.left=n.left-this.width,n.right=t.right+this.width);let r=this.width*this.nextRow,i=0,a=e[i];for(let t=0;t<this.width;t++){t/a.right>1&&(a=e[++i]);let n=Math.abs(t-a.left),o=Math.abs(t-a.right),s=Math.min(n,o);this.data[r+t]=Math.max(0,Math.min(255,(a.isDash?s:-s)+128))}}addDash(e,n){let r=n?7:0,i=2*r+1;if(this.nextRow+i>this.height)return t.w(`LineAtlas out of space`),null;let a=0;for(let t of e)a+=t;if(a!==0){let t=this.width/a,i=this.getDashRanges(e,this.width,t);n?this.addRoundDash(i,t,r):this.addRegularDash(i)}let o={y:this.nextRow+r,height:2*r,width:a};return this.nextRow+=i,this.dirty=!0,o}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}}let k=`maplibre_preloaded_worker_pool`;class A{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<A.workerCount;)this.workers.push(new Worker(t.c.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){if(delete this.active[e],this.numActive()===0){for(let e of this.workers)e.terminate();this.workers=null}}isPreloaded(){return!!this.active[k]}numActive(){return Object.keys(this.active).length}}let ee=Math.floor(s.hardwareConcurrency/2),te,j;function ne(){return te||=new A,te}A.workerCount=t.L(globalThis)?Math.max(Math.min(ee,3),1):1;class re{constructor(e,n){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=n;let r=this.workerPool.acquire(n);for(let e=0;e<r.length;e++){let i=new t.N(r[e],n);i.name=`Worker ${e}`,this.actors.push(i)}if(!this.actors.length)throw Error(`No actors found`)}broadcast(e,t){let n=[];for(let r of this.actors)n.push(r.sendAsync({type:e,data:t}));return Promise.all(n)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){for(let e of this.actors)e.remove();this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(let n of this.actors)n.registerMessageHandler(e,t)}unregisterMessageHandler(e){for(let t of this.actors)t.unregisterMessageHandler(e)}}function ie(){return j||(j=new re(ne(),t.M),j.registerMessageHandler(`GR`,((e,n,r)=>t.m(n,r)))),j}function ae(e,n){let r=t.O();return t.Q(r,r,[1,1,0]),t.S(r,r,[.5*e.width,.5*e.height,1]),e.calculatePosMatrix?t.U(r,r,e.calculatePosMatrix(n.toUnwrapped())):r}function oe(e,t,n,r,i,a,o){let s=function(e,t,n){if(e)for(let r of e){let e=t[r];if(e?.source===n&&e.type===`fill-extrusion`)return!0}else for(let e in t){let r=t[e];if(r.source===n&&r.type===`fill-extrusion`)return!0}return!1}(i?.layers??null,t,e.id),c=a.maxPitchScaleFactor(),l=e.tilesIn(r,c,s);l.sort(se);let u=[];for(let r of l)u.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(t,n,e.getState(),r.queryGeometry,r.cameraQueryGeometry,r.scale,i,a,c,ae(a,r.tileID),o?(e,t)=>o(r.tileID,e,t):void 0)});return function(e,t){for(let n in e)for(let r of e[n])ce(r,t);return e}(function(e){let t={},n={};for(let{queryResults:r,wrappedTileID:i}of e){n[i]||(n[i]={});let e=n[i];for(let n in r){let i=r[n];e[n]||(e[n]={});let a=e[n];t[n]||(t[n]=[]);for(let e of i)a[e.featureIndex]||(a[e.featureIndex]=!0,t[n].push(e))}}return t}(u),e)}function se(e,t){let n=e.tileID,r=t.tileID;return n.overscaledZ-r.overscaledZ||n.canonical.y-r.canonical.y||n.wrap-r.wrap||n.canonical.x-r.canonical.x}function ce(e,t){let n=e.feature,r=t.getFeatureState(n.layer[`source-layer`],n.id);n.source=n.layer.source,n.layer[`source-layer`]&&(n.sourceLayer=n.layer[`source-layer`]),n.state=r}function le(e,n,r,i){return t._(this,void 0,void 0,(function*(){let a=e;if(e.url?a=(yield t.k(yield n.transformRequest(e.url,`Source`),r)).data:yield s.frameAsync(r,i),!a)return null;let o=t.V(t.e(a,e),[`tiles`,`minzoom`,`maxzoom`,`attribution`,`bounds`,`scheme`,`tileSize`,`encoding`]);return`vector_layers`in a&&a.vector_layers&&(o.vectorLayerIds=a.vector_layers.map((e=>e.id))),o}))}class M{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof t.W?new t.W(e.lng,e.lat):t.W.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.W?new t.W(e.lng,e.lat):t.W.convert(e),this}extend(e){let n=this._sw,r=this._ne,i,a;if(e instanceof t.W)i=e,a=e;else{if(!(e instanceof M))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(M.convert(e)):this.extend(t.W.convert(e)):e&&(`lng`in e||`lon`in e)&&`lat`in e?this.extend(t.W.convert(e)):this;if(i=e._sw,a=e._ne,!i||!a)return this}return n||r?(n.lng=Math.min(i.lng,n.lng),n.lat=Math.min(i.lat,n.lat),r.lng=Math.max(a.lng,r.lng),r.lat=Math.max(a.lat,r.lat)):(this._sw=new t.W(i.lng,i.lat),this._ne=new t.W(a.lng,a.lat)),this}getCenter(){return new t.W((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 t.W(this.getWest(),this.getNorth())}getSouthEast(){return new t.W(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(e){let{lng:n,lat:r}=t.W.convert(e),i=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&i}intersects(e){if(!((e=M.convert(e)).getNorth()>=this.getSouth()&&e.getSouth()<=this.getNorth()))return!1;let n=Math.abs(this.getEast()-this.getWest()),r=Math.abs(e.getEast()-e.getWest());if(n>=360||r>=360)return!0;let i=t.X(this.getWest(),-180,180),a=t.X(this.getEast(),-180,180),o=t.X(e.getWest(),-180,180),s=t.X(e.getEast(),-180,180),c=i>a,l=o>s;return!(!c||!l)||(c?s>=i||o<=a:l?a>=o||i<=s:o<=a&&s>=i)}static convert(e){return e instanceof M?e:e&&new M(e)}static fromLngLat(e,n=0){let r=360*n/40075017,i=r/Math.cos(Math.PI/180*e.lat);return new M(new t.W(e.lng-i,e.lat-r),new t.W(e.lng+i,e.lat+r))}adjustAntiMeridian(){let e=new t.W(this._sw.lng,this._sw.lat),n=new t.W(this._ne.lng,this._ne.lat);return new M(e,e.lng>n.lng?new t.W(n.lng+360,n.lat):n)}}class ue{constructor(e,t,n){this.bounds=M.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=n||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let n=2**e.z,r=Math.floor(t.Z(this.bounds.getWest())*n),i=Math.floor(t.Y(this.bounds.getNorth())*n),a=Math.ceil(t.Z(this.bounds.getEast())*n),o=Math.ceil(t.Y(this.bounds.getSouth())*n);return e.x>=r&&e.x<a&&e.y>=i&&e.y<o}}class de extends t.E{constructor(e,n,r,i){if(super(),this.id=e,this.dispatcher=r,this.type=`vector`,this.minzoom=0,this.maxzoom=22,this.scheme=`xyz`,this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.e(this,t.V(n,[`url`,`scheme`,`tileSize`,`promoteId`,`encoding`])),this._options=t.e({type:`vector`},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw Error(`vector tile sources must have a tileSize of 512`);this.setEventedParent(i)}load(){return t._(this,arguments,void 0,(function*(e=!1){this._loaded=!1,this.fire(new t.n(`dataloading`,{dataType:`source`})),this._tileJSONRequest=new AbortController;try{let n=yield le(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,n&&(t.e(this,n),n.bounds&&(this.tileBounds=new ue(n.bounds,this.minzoom,this.maxzoom)),this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`metadata`})),this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`content`,sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,t.$(e)||this.fire(new t.l(t.d(e)))}}))}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load(!0)}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}serialize(){return t.e({},this._options)}loadTile(e){return t._(this,void 0,void 0,(function*(){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n={request:yield this.map._requestManager.transformRequest(t,`Tile`),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.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(e),etag:e.etag};n.request.collectResourceTiming=this._collectResourceTiming;let r=`RT`;if(e.actor&&e.state!==`expired`){if(e.state===`loading`)return new Promise(((t,n)=>{e.reloadPromise={resolve:t,reject:n}}))}else e.actor=this.dispatcher.getActor(),r=`LT`;e.abortController=new AbortController;try{let t=yield e.actor.sendAsync({type:r,data:n},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,t);let i={};return t!=null&&t.etagUnmodified&&(i.unmodified=!0),i}catch(t){if(delete e.abortController,e.aborted)return;if(t&&t.status!==404)throw t;this._afterTileLoadWorkerResponse(e,null)}}))}_getOverzoomParameters(e){return t._(this,void 0,void 0,(function*(){if(e.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;let t=e.tileID.scaledTo(this.maxzoom).canonical,n=t.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:t,overzoomRequest:yield this.map._requestManager.transformRequest(n,`Tile`)}}))}_afterTileLoadWorkerResponse(e,t){if(t!=null&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.etag=t?.etag,e.loadVectorData(t,this.map.painter),e.reloadPromise){let t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.reject)}}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:`AT`,data:{uid:e.uid,type:this.type,source:this.id}}))}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:`RMT`,data:{uid:e.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class fe extends t.E{constructor(e,n,r,i){super(),this.id=e,this.dispatcher=r,this.setEventedParent(i),this.type=`raster`,this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme=`xyz`,this.tileSize=512,this._loaded=!1,this._options=t.e({type:`raster`},n),t.e(this,t.V(n,[`url`,`scheme`,`tileSize`]))}load(){return t._(this,arguments,void 0,(function*(e=!1){this._loaded=!1,this.fire(new t.n(`dataloading`,{dataType:`source`})),this._tileJSONRequest=new AbortController;try{let n=yield le(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,n&&(t.e(this,n),n.bounds&&(this.tileBounds=new ue(n.bounds,this.minzoom,this.maxzoom)),this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`metadata`})),this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`content`,sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,t.$(e)||this.fire(new t.l(t.d(e)))}}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}setSourceProperty(e){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}serialize(){return t.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return t._(this,void 0,void 0,(function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let r=yield u.getImage(yield this.map._requestManager.transformRequest(n,`Tile`),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state=`unloaded`);if(r?.data){this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&e.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});let n=this.map.painter.context,i=n.gl,a=r.data;e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0}):(e.texture=new t.T(n,a,i.RGBA,{useMipmap:!0}),e.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_NEAREST)),e.state=`loaded`}}catch(t){if(delete e.abortController,e.aborted)e.state=`unloaded`;else if(t)throw e.state=`errored`,t}}))}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)}))}hasTransition(){return!1}}class pe extends fe{constructor(e,n,r,i){super(e,n,r,i),this.type=`raster-dem`,this.maxzoom=22,this._options=t.e({type:`raster-dem`},n),this.encoding=n.encoding||`mapbox`,this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(e){return t._(this,void 0,void 0,(function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=yield this.map._requestManager.transformRequest(n,`Tile`);e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let n=yield u.getImage(r,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state=`unloaded`);if(n?.data){let r=n.data;this.map._refreshExpiredTiles&&(n.cacheControl||n.expires)&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires});let i=t.b(r)&&t.a0()?r:yield this.readImageNow(r),a={type:this.type,uid:e.uid,source:this.id,rawImageData:i,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(e.actor&&e.state!==`expired`&&e.state!==`reloading`)return;e.actor&&e.state!==`expired`||(e.actor=this.dispatcher.getActor()),e.dem=yield e.actor.sendAsync({type:`LDT`,data:a}),e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state=`loaded`}}catch(t){if(delete e.abortController,e.aborted)e.state=`unloaded`;else if(t)throw e.state=`errored`,t}}))}readImageNow(e){return t._(this,void 0,void 0,(function*(){if(typeof VideoFrame<`u`&&t.a1()){let n=e.width+2,r=e.height+2;try{return new t.R({width:n,height:r},yield t.a2(e,-1,-1,n,r))}catch{}}return s.getImageData(e,1)}))}_getNeighboringTiles(e){let n=e.canonical,r=2**n.z,i=(n.x-1+r)%r,a=n.x===0?e.wrap-1:e.wrap,o=(n.x+1+r)%r,s=n.x+1===r?e.wrap+1:e.wrap,c={};return c[new t.a3(e.overscaledZ,a,n.z,i,n.y).key]={backfilled:!1},c[new t.a3(e.overscaledZ,s,n.z,o,n.y).key]={backfilled:!1},n.y>0&&(c[new t.a3(e.overscaledZ,a,n.z,i,n.y-1).key]={backfilled:!1},c[new t.a3(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},c[new t.a3(e.overscaledZ,s,n.z,o,n.y-1).key]={backfilled:!1}),n.y+1<r&&(c[new t.a3(e.overscaledZ,a,n.z,i,n.y+1).key]={backfilled:!1},c[new t.a3(e.overscaledZ,e.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},c[new t.a3(e.overscaledZ,s,n.z,o,n.y+1).key]={backfilled:!1}),c}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state=`unloaded`,e.actor&&(yield e.actor.sendAsync({type:`RDT`,data:{type:this.type,uid:e.uid,source:this.id}}))}))}}function me(e,t){return t?e.properties[t]:e.id}function he(e,t){let n={id:e.id};if(t.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(let n of t.removeProperties){let t=e.addOrUpdateProperties.findIndex((e=>e.key===n));t>-1&&e.addOrUpdateProperties.splice(t,1)}return(e.removeAllProperties||t.removeAllProperties)&&(n.removeAllProperties=!0),(e.removeProperties||t.removeProperties)&&(n.removeProperties=[...e.removeProperties||[],...t.removeProperties||[]]),(e.addOrUpdateProperties||t.addOrUpdateProperties)&&(n.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(e.newGeometry||t.newGeometry)&&(n.newGeometry=t.newGeometry||e.newGeometry),n}function ge(e){if(!e)return{};let t={};return t.removeAll=e.removeAll,t.remove=new Set(e.remove||[]),t.add=new Map(e.add?.map((e=>[e.id,e]))),t.update=new Map(e.update?.map((e=>[e.id,e]))),t}function _e(e){return e&&e.length!==0?typeof e[0]==`number`?[e]:e.flatMap((e=>_e(e))):[]}function ve(e){return e.type===`GeometryCollection`?e.geometries.flatMap((e=>ve(e))):_e(e.coordinates)}function ye(e){let t=new M,n;switch(e.type){case`FeatureCollection`:n=e.features.flatMap((e=>ve(e.geometry)));break;case`Feature`:n=ve(e.geometry);break;default:n=ve(e)}if(n.length===0)return t;for(let e of n){let[n,r]=e;t.extend([n,r])}return t}class be extends t.E{constructor(e,n,r,i){super(),this.id=e,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:n.data},this.actor=r.getActor(),this.setEventedParent(i),this._data=typeof n.data==`string`?{url:n.data}:{geojson:n.data},this._options=t.e({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId,n.clusterMaxZoom!==void 0&&this.maxzoom<=n.clusterMaxZoom&&t.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${n.clusterMaxZoom}".`),this.workerOptions=t.e({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(n.buffer===void 0?128:n.buffer),tolerance:this._pixelsToTileUnits(n.tolerance===void 0?.375:n.tolerance),extent:t.a6,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1,promoteId:typeof n.promoteId==`string`?n.promoteId:void 0,cluster:n.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(n.clusterMaxZoom),minPoints:Math.max(2,n.clusterMinPoints||2),extent:t.a6,radius:this._pixelsToTileUnits(n.clusterRadius||50),log:!1,generateId:n.generateId||!1}},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(e){return e*(t.a6/this.tileSize)}_getClusterMaxZoom(e){let n=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||t.w(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${n}"`),n}load(){return t._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(e){this.map=e,this.load()}setData(e,t){this._data=typeof e==`string`?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e};let n=this._updateWorkerData();return t?n:this}updateData(e,t){this._pendingWorkerUpdate.diff=function(e,t){if(!e)return t||{};if(!t)return e||{};let n=ge(e),r=ge(t);(function(e,t){t.removeAll&&(e.add.clear(),e.update.clear(),e.remove.clear(),t.remove.clear());for(let n of t.remove)e.add.delete(n),e.update.delete(n);for(let[n,r]of t.update){let i=e.update.get(n);i&&(t.update.set(n,he(i,r)),e.update.delete(n))}})(n,r);let i={};if((n.removeAll||r.removeAll)&&(i.removeAll=!0),i.remove=new Set([...n.remove,...r.remove]),i.add=new Map([...n.add,...r.add]),i.update=new Map([...n.update,...r.update]),i.remove.size&&i.add.size)for(let e of i.add.keys())i.remove.delete(e);return function(e){let t={};return e.removeAll&&(t.removeAll=e.removeAll),e.remove&&(t.remove=Array.from(e.remove)),e.add&&(t.add=Array.from(e.add.values())),e.update&&(t.update=Array.from(e.update.values())),t}(i)}(this._pendingWorkerUpdate.diff,e);let n=this._updateWorkerData();return t?n:this}getData(){return t._(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 t._(this,void 0,void 0,(function*(){return ye(yield this.getData())}))}setClusterOptions(e){return this.workerOptions.geojsonVtOptions.cluster=e.cluster,e.clusterRadius!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:`GCEZ`,data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:`GCC`,data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,t,n){return this.actor.sendAsync({type:`GCL`,data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:n}})}_updateWorkerData(){return t._(this,void 0,void 0,(function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void t.w(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:e,diff:n,updateCluster:r}=this._pendingWorkerUpdate,i=this._getLoadGeoJSONParameters(e,n,r);e===void 0?n?this._pendingWorkerUpdate.diff=void 0:r&&(this._pendingWorkerUpdate.updateCluster=void 0):this._pendingWorkerUpdate.data=void 0,yield this._dispatchWorkerUpdate(i)}))}_getLoadGeoJSONParameters(e,n,r){return t._(this,void 0,void 0,(function*(){let i=t.e({type:this.type},this.workerOptions);return typeof e==`string`?(i.request=yield this.map._requestManager.transformRequest(s.resolveURL(e),`Source`),i.request.collectResourceTiming=this._collectResourceTiming,i):e===void 0?n?(i.dataDiff=n,i):r?(i.updateCluster=!0,i):void 0:(i.data=e,i)}))}_dispatchWorkerUpdate(e){return t._(this,void 0,void 0,(function*(){this._isUpdatingWorker=!0,this.fire(new t.n(`dataloading`,{dataType:`source`}));try{let n=yield e,r=yield this.actor.sendAsync({type:`LD`,data:n});if(this._isUpdatingWorker=!1,this._removed||r.abandoned)return void this.fire(new t.n(`dataabort`,{dataType:`source`}));r.data&&(this._data={geojson:r.data});let i=this._applyDiffToSource(n.dataDiff),a=this._getShouldReloadTileOptions(i),o={dataType:`source`};this._applyResourceTiming(o,r),this.fire(new t.n(`data`,Object.assign(Object.assign({},o),{sourceDataType:`metadata`}))),this.fire(new t.n(`data`,Object.assign(Object.assign({},o),{sourceDataType:`content`,shouldReloadTileOptions:a})))}catch(e){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new t.n(`dataabort`,{dataType:`source`}));this.fire(new t.l(t.d(e)))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}}))}_applyResourceTiming(e,n){if(!this._collectResourceTiming)return;let r=n.resourceTiming?.[this.id];if(!r)return;let i=r.slice(0);i!=null&&i.length&&t.e(e,{resourceTiming:i})}_applyDiffToSource(e){if(!e)return;let t=typeof this.promoteId==`string`?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let e=function(e,t){let n=new Map;if(e==null||e.type==null)return n;if(e.type===`Feature`){let r=me(e,t);return r==null?void 0:(n.set(r,e),n)}if(e.type===`FeatureCollection`){let r=new Set;for(let i of e.features){let e=me(i,t);if(e==null||r.has(e))return;r.add(e),n.set(e,i)}return n}}(this._data.geojson,t);if(!e)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:e}}if(!this._data.updateable)return;let n=function(e,t,n){let r=[];if(t.removeAll)e.clear();else if(t.remove)for(let n of t.remove){let t=e.get(n);t&&(r.push(t.geometry),e.delete(n))}if(t.add)for(let i of t.add){let t=me(i,n);if(t==null)continue;let a=e.get(t);a&&r.push(a.geometry),r.push(i.geometry),e.set(t,i)}if(t.update)for(let n of t.update){let t=e.get(n.id);if(!t)continue;let i=!!n.newGeometry,a=n.removeAllProperties||n.removeProperties?.length>0||n.addOrUpdateProperties?.length>0;if(!i&&!a)continue;r.push(t.geometry);let o=Object.assign({},t);if(e.set(n.id,o),i&&(r.push(n.newGeometry),o.geometry=n.newGeometry),a){if(o.properties=n.removeAllProperties?{}:Object.assign({},o.properties||{}),n.removeProperties)for(let e of n.removeProperties)delete o.properties[e];if(n.addOrUpdateProperties)for(let{key:e,value:t}of n.addOrUpdateProperties)o.properties[e]=t}}return r}(this._data.updateable,e,t);return e.removeAll||this._options.cluster?void 0:n}_getShouldReloadTileOptions(e){if(e)return{affectedBounds:e.filter(Boolean).map((e=>ye(e)))}}shouldReloadTile(e,{affectedBounds:n}){if(e.state===`loading`)return!0;if(e.state===`unloaded`)return!1;let{buffer:r,extent:i}=this.workerOptions.geojsonVtOptions,a=function({x:e,y:n,z:r},i=0){let a=t.a4((e-i)/2**r),o=t.a5((n+1+i)/2**r),s=t.a4((e+1+i)/2**r),c=t.a5((n-i)/2**r);return new M([a,o],[s,c])}(e.tileID.canonical,r/i);for(let e of n)if(a.intersects(e))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(e){return t._(this,void 0,void 0,(function*(){let t=e.actor?`RT`:`LT`;e.actor=this.actor;let n={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.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};e.abortController=new AbortController;let r=yield this.actor.sendAsync({type:t,data:n},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.painter,t===`RT`)}))}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:`RMT`,data:{uid:e.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 t.e({},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 xe extends t.E{constructor(e,t,n,r){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=n,this.coordinates=t.coordinates,this.type=`image`,this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=t}load(e){return t._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new t.n(`dataloading`,{dataType:`source`})),this.url=this.options.url,this._request=new AbortController;try{let t=yield u.getImage(yield this.map._requestManager.transformRequest(this.url,`Image`),this._request);this._request=null,this._loaded=!0,t!=null&&t.data&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(e){this._request=null,this._loaded=!0,t.$(e)||this.fire(new t.l(t.d(e)))}}))}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&=(this._request.abort(),null),this.options.url=e.url,this.load(e.coordinates).finally((()=>this.texture=null)),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`metadata`})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&=(this._request.abort(),null)}setCoordinates(e){this.coordinates=e;let n=e.map(t.a7.fromLngLat);var r;return this.tileID=function(e){let n=t.a8.fromPoints(e),r=n.width(),i=n.height(),a=Math.max(0,Math.floor(-Math.log(Math.max(r,i))/Math.LN2)),o=2**a;return new t.aa(a,Math.floor((n.minX+n.maxX)/2*o),Math.floor((n.minY+n.maxY)/2*o))}(n),this.terrainTileRanges=this._getOverlappingTileRanges(n),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=n.map((e=>this.tileID.getTilePoint(e)._round())),this.flippedWindingOrder=((r=this.tileCoords)[1].x-r[0].x)*(r[2].y-r[0].y)-(r[1].y-r[0].y)*(r[2].x-r[0].x)<0,this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`content`})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,n=e.gl;this.texture||(this.texture=new t.T(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,r=!0)}r&&this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`idle`,sourceId:this.id}))}loadTile(e){return t._(this,void 0,void 0,(function*(){this.tileID?.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state=`errored`}))}serialize(){return{type:`image`,url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){let{minX:n,minY:r,maxX:i,maxY:a}=t.a8.fromPoints(e),o={};for(let e=0;e<=t.a9;e++){let t=2**e,s=Math.floor(n*t),c=Math.floor(r*t),l=Math.floor(i*t),u=Math.floor(a*t),d=(s%t+t)%t,f=l%t;o[e]={minWrap:Math.floor(s/t),maxWrap:Math.floor(l/t),minTileXWrapped:d,maxTileXWrapped:f,minTileY:c,maxTileY:u}}return o}}class Se extends xe{constructor(e,t,n,r){super(e,t,n,r),this._onPlayingHandler=()=>{var e;(e=this.map)==null||e.triggerRepaint()},this.roundZoom=!0,this.type=`video`,this.options=t}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push((yield this.map._requestManager.transformRequest(t,`Source`)).url);try{let e=yield t.ab(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 t.l(t.d(e)))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let n=this.video.seekable;e<n.start(0)||e>n.end(0)?this.fire(new t.l(new t.ac(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,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 e=this.map.painter.context,n=e.gl;this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new t.T(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,r=!0)}r&&this.fire(new t.n(`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 Ce extends xe{constructor(e,n,r,i){super(e,n,r,i),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some((e=>!Array.isArray(e)||e.length!==2||e.some((e=>typeof e!=`number`))))||this.fire(new t.l(new t.ac(`sources.${e}`,null,`"coordinates" property must be an array of 4 longitude/latitude array pairs`))):this.fire(new t.l(new t.ac(`sources.${e}`,null,`missing required property "coordinates"`))),n.animate&&typeof n.animate!=`boolean`&&this.fire(new t.l(new t.ac(`sources.${e}`,null,`optional "animate" property must be a boolean value`))),n.canvas?typeof n.canvas==`string`||n.canvas instanceof HTMLCanvasElement||this.fire(new t.l(new t.ac(`sources.${e}`,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 t.l(new t.ac(`sources.${e}`,null,`missing required property "canvas"`))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!0,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 t.l(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(),!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let n=this.map.painter.context,r=n.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new t.T(n,this.canvas,r.RGBA,{premultiply:!0}),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,i=!0)}i&&this.fire(new t.n(`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 e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}let we={},Te=e=>{switch(e){case`geojson`:return be;case`image`:return xe;case`raster`:return fe;case`raster-dem`:return pe;case`vector`:return de;case`video`:return Se;case`canvas`:return Ce}return we[e]},Ee=`RTLPluginLoaded`;class De extends t.E{constructor(){super(...arguments),this.status=`unavailable`,this.url=null,this.dispatcher=ie()}_syncState(e){return this.status=e,this.dispatcher.broadcast(`SRPS`,{pluginStatus:e,pluginURL:this.url}).catch((e=>{throw this.status=`error`,e}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status=`unavailable`,this.url=null}setRTLTextPlugin(e){return t._(this,arguments,void 0,(function*(e,t=!1){if(this.url)throw Error(`setRTLTextPlugin cannot be called multiple times.`);if(this.url=s.resolveURL(e),!this.url)throw Error(`requested url ${e} is invalid`);if(this.status===`unavailable`){if(!t)return this._requestImport();this.status=`deferred`,this._syncState(this.status)}else if(this.status===`requested`)return this._requestImport()}))}_requestImport(){return t._(this,void 0,void 0,(function*(){yield this._syncState(`loading`),this.status=`loaded`,this.fire(new t.n(Ee))}))}lazyLoad(){this.status===`unavailable`?this.status=`requested`:this.status===`deferred`&&this._requestImport()}}let Oe=null;function ke(){return Oe||=new De,Oe}var Ae,je;(function(e){e[e.Base=0]=`Base`,e[e.Parent=1]=`Parent`})(Ae||={}),function(e){e[e.Departing=0]=`Departing`,e[e.Incoming=1]=`Incoming`}(je||={});class Me{constructor(e,n){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=t.ad(),this.uses=0,this.tileSize=n,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(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t,fadingParentID:n,fadeEndTime:r}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t,this.fadingParentID=n,this.fadeEndTime=r}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=l(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state===`errored`||this.state===`loaded`||this.state===`reloading`}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,n,r){if(!0!==e?.etagUnmodified)if(this.hasData()&&this.unloadVectorData(),this.state=`loaded`,e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestEncoding=e.encoding,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,t){let n={};if(!t)return n;for(let r of e){let e=r.layerIds.map((e=>t.getLayer(e))).filter(Boolean);if(e.length!==0){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(let t of e)n[t.id]=r}}return n}(e.buckets,n?.style),this.hasSymbolBuckets=!1;for(let e in this.buckets){let n=this.buckets[e];if(n instanceof t.af){if(this.hasSymbolBuckets=!0,!r)break;n.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let e in this.buckets){let n=this.buckets[e];if(n instanceof t.af&&n.hasRTLText){this.hasRTLText=!0,ke().lazyLoad();break}}this.queryPadding=0;for(let e in this.buckets){let t=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(e).queryRadius(t))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}else this.collisionBoxArray=new t.ae;else this.state=`loaded`}unloadVectorData(){for(let e in this.buckets)this.buckets[e].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(e){return this.buckets[e.id]}upload(e){for(let t in this.buckets){let n=this.buckets[t];n.uploadPending()&&n.upload(e)}let n=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new t.T(e,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&=(this.glyphAtlasTexture=new t.T(e,this.glyphAtlasImage,n.ALPHA),null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,n,r,i,a,o,s,c,l,u){return this.latestFeatureIndex?.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:i,scale:a,tileSize:this.tileSize,pixelPosMatrix:l,transform:s,params:o,queryPadding:this.queryPadding*c,getElevation:u},e,t,n):{}}querySourceFeatures(e,n){let r=this.latestFeatureIndex;if(!r?.rawTileData)return;let i=r.loadVTLayers(),a=n?.sourceLayer?n.sourceLayer:``,o=i[t.ag]||i[a];if(!o)return;let s=t.ah(n?.filter,n?.globalState),{z:c,x:l,y:u}=this.tileID.canonical,d={z:c,x:l,y:u};for(let n=0;n<o.length;n++){let i=o.feature(n);if(s.needGeometry){let e=t.ai(i,!0);if(!s.filter(new t.J(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!s.filter(new t.J(this.tileID.overscaledZ),i))continue;let f=r.getId(i,a),p=new t.aj(i,c,l,u,f);p.tile=d,e.push(p)}}hasData(){return this.state===`loaded`||this.state===`reloading`||this.state===`expired`}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let n=this.expirationTime;if(e.cacheControl){let n=t.ak(e.cacheControl);n[`max-age`]&&(this.expirationTime=Date.now()+1e3*n[`max-age`])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let e=Date.now(),t=!1;if(this.expirationTime>e)t=!1;else if(n)if(this.expirationTime<n)t=!0;else{let r=this.expirationTime-n;r?this.expirationTime=e+Math.max(r,3e4):t=!0}else t=!0;t?(this.expiredRequestCount++,this.state=`expired`):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),2**31-1)}setFeatureState(e,n){if(!this.latestFeatureIndex?.rawTileData||Object.keys(e).length===0)return;let r=this.latestFeatureIndex.loadVTLayers();for(let i in this.buckets){if(!n.style.hasLayer(i))continue;let a=this.buckets[i],o=a.layers[0].sourceLayer||t.ag,s=r[o],c=e[o];if(!s||!c||Object.keys(c).length===0)continue;a.update(c,s,this.imageAtlas?.patternPositions||{},this.dashPositions||{});let l=(n?.style)?.getLayer(i);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(a)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<l()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=l()+e}setDependencies(e,t){let n={};for(let e of t)n[e]=!0;this.dependencies[e]=n}hasDependency(e,t){for(let n of e){let e=this.dependencies[n];if(e){for(let n of t)if(e[n])return!0}}return!1}}class Ne{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(e,n,r){var i,a;let o=String(n);if((i=this.stateChanges)[e]||(i[e]={}),(a=this.stateChanges[e])[o]||(a[o]={}),t.e(this.stateChanges[e][o],r),this.deletedStates[e]===null){this.deletedStates[e]={};for(let t in this.state[e])t!==o&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]?.[o]===null){this.deletedStates[e][o]={};for(let t in this.state[e][o])r[t]||(this.deletedStates[e][o][t]=null)}else for(let t in r)this.deletedStates[e]?.[o]?.[t]===null&&delete this.deletedStates[e][o][t]}removeFeatureState(e,t,n){var r,i;if(this.deletedStates[e]===null)return;let a=String(t);if((r=this.deletedStates)[e]||(r[e]={}),n&&t!==void 0)this.deletedStates[e][a]!==null&&((i=this.deletedStates[e])[a]||(i[a]={}),this.deletedStates[e][a][n]=null);else if(t!==void 0)if(this.stateChanges[e]?.[a])for(n in this.deletedStates[e][a]={},this.stateChanges[e][a])this.deletedStates[e][a][n]=null;else this.deletedStates[e][a]=null;else this.deletedStates[e]=null}getState(e,n){let r=String(n),i=t.e({},(this.state[e]||{})[r],(this.stateChanges[e]||{})[r]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let t=this.deletedStates[e][n];if(t===null)return{};for(let e in t)delete i[e]}return i}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,n){var r,i,a;let o={};for(let e in this.stateChanges){(r=this.state)[e]||(r[e]={});let n={};for(let r in this.stateChanges[e])(i=this.state[e])[r]||(i[r]={}),t.e(this.state[e][r],this.stateChanges[e][r]),n[r]=this.state[e][r];o[e]=n}for(let e in this.deletedStates){(a=this.state)[e]||(a[e]={});let n={};if(this.deletedStates[e]===null)for(let t in this.state[e])n[t]={},this.state[e][t]={};else for(let t in this.deletedStates[e]){if(this.deletedStates[e][t]===null)this.state[e][t]={};else for(let n of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][n];n[t]=this.state[e][t]}o[e]||(o[e]={}),t.e(o[e],n)}this.stateChanges={},this.deletedStates={},Object.keys(o).length!==0&&(this.revision++,e.setFeatureState(o,n))}}let Pe=89.25;function Fe(e,n){let r=t.al(n.lat,-t.am,t.am);return new t.P(t.Z(n.lng)*e,t.Y(r)*e)}function Ie(e,n){return new t.a7(n.x/e,n.y/e).toLngLat()}function Le(e){return e.cameraToCenterDistance*Math.min(.85*Math.tan(t.an(90-e.pitch)),Math.tan(t.an(Pe-e.pitch)))}function Re(e,n){let r=e.canonical,i=n/t.ao(r.z),a=r.x+2**r.z*e.wrap,o=t.ap(new Float64Array(16));return t.Q(o,o,[a*i,r.y*i,0]),t.S(o,o,[i/t.a6,i/t.a6,1]),o}function ze(e,n,r,i,a){let o=t.a7.fromLngLat(e,n),s=a*t.aq(1,e.lat),{x:c,y:l,z:u}=Be(r,i);return new t.a7(o.x+s*-c,o.y+s*-l,o.z+s*-u)}function Be(e,n){let r=t.an(e),i=t.an(n),a=Math.cos(-r),o=Math.sin(r);return{x:o*Math.sin(i),y:-o*Math.cos(i),z:a}}function N(e,t,n){let r=t.intersectsFrustum(e);if(!n||r===0)return r;let i=t.intersectsPlane(n);return i===0?0:r===2&&i===2?2:1}function Ve(e,t,n){let r=0,i=(n-t)/10;for(let a=0;a<10;a++)r+=i*Math.cos(t+(a+.5)/10*(n-t))**+e;return r}function He(e,n){return function(r,i,a,o,s){let c=2*((e-1)/t.ar(Math.cos(t.an(Pe-s))/Math.cos(t.an(Pe)))-1),l=Math.acos(a/o),u=2*Ve(c-1,0,t.an(s/2)),d=Math.min(t.an(Pe),l+t.an(s/2)),f=Ve(c-1,Math.min(d,l-t.an(s/2)),d),p=Math.atan(i/a),m=Math.hypot(i,a),h=r;return h+=t.ar(o/m/Math.max(.5,Math.cos(t.an(s/2)))),h+=c*t.ar(Math.cos(p))/2,h-=t.ar(Math.max(1,f/u/n))/2,h}}let P=He(9.314,3);function Ue(e,n){let r=(n.roundZoom?Math.round:Math.floor)(e.zoom+t.ar(e.tileSize/n.tileSize));return Math.max(0,r)}function We(e,n){let r=e.getCameraFrustum(),i=e.getClippingPlane(),a=e.screenPointToMercatorCoordinate(e.getCameraPoint()),o=t.a7.fromLngLat(e.center,e.elevation);a.z=o.z+Math.cos(e.pitchInRadians)*e.cameraToCenterDistance/e.worldSize;let s=e.getCoveringTilesDetailsProvider(),c=s.allowVariableZoom(e,n),l=Ue(e,n),u=n.minzoom||0,d=n.maxzoom===void 0?e.maxZoom:n.maxzoom,f=Math.min(Math.max(0,l),d),p=2**f,m=[p*a.x,p*a.y,0],h=[p*o.x,p*o.y,0],g=Math.hypot(o.x-a.x,o.y-a.y),_=Math.abs(o.z-a.z),v=Math.hypot(g,_),y=e=>({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),b=[],x=[];if(e.renderWorldCopies&&s.allowWorldCopies())for(let e=1;e<=3;e++)b.push(y(-e)),b.push(y(e));for(b.push(y(0));b.length>0;){let p=b.pop(),g=p.x,y=p.y,S=p.fullyVisible,C={x:g,y,z:p.zoom},w=s.getTileBoundingVolume(C,p.wrap,e.elevation,n);if(!S){let e=N(r,w,i);if(e===0)continue;S=e===2}let T=s.distanceToTile2d(a.x,a.y,C,w),E=l;c&&(E=(n.calculateTileZoom||P)(e.zoom+t.ar(e.tileSize/n.tileSize),T,_,v,e.fov)),E=(n.roundZoom?Math.round:Math.floor)(E),E=Math.max(0,E);let D=Math.min(E,d);if(p.wrap=s.getWrap(o,C,p.wrap),p.zoom>=D){if(p.zoom<u)continue;let e=f-p.zoom,r=m[0]-.5-(g<<e),i=m[1]-.5-(y<<e),a=n.reparseOverscaled?Math.max(p.zoom,E):p.zoom;x.push({tileID:new t.a3(p.zoom===d?a:p.zoom,p.wrap,p.zoom,g,y),distanceSq:t.as([h[0]-.5-g,h[1]-.5-y]),tileDistanceToCamera:Math.sqrt(r*r+i*i)})}else for(let e=0;e<4;e++)b.push({zoom:p.zoom+1,x:(g<<1)+e%2,y:(y<<1)+(e>>1),wrap:p.wrap,fullyVisible:S})}return x.sort(((e,t)=>e.distanceSq-t.distanceSq)).map((e=>e.tileID))}let Ge=t.a8.fromPoints([new t.P(0,0),new t.P(t.a6,t.a6)]);function Ke(e){return e===`raster`||e===`image`||e===`video`}function qe(e,t,n,r,i,a,o){if(!t.hasData())return!1;let{tileID:s,fadingRole:c,fadingDirection:l,fadingParentID:u}=t;if(c===Ae.Base&&l===je.Incoming&&u)return n[u.key]=u,!0;let d=Math.max(s.overscaledZ-i,a);for(let i=s.overscaledZ-1;i>=d;i--){let a=s.scaledTo(i),c=e.getLoadedTile(a);if(c)return t.setCrossFadeLogic({fadingRole:Ae.Base,fadingDirection:je.Incoming,fadingParentID:c.tileID,fadeEndTime:r+o}),c.setCrossFadeLogic({fadingRole:Ae.Parent,fadingDirection:je.Departing,fadeEndTime:r+o}),n[a.key]=a,!0}return!1}function Je(e,t,n,r,i,a){if(!t.hasData())return!1;let o=t.tileID.children(i),s=Ye(e,t,o,n,r,i,a);if(s)return!0;for(let c of o)Ye(e,t,c.children(i),n,r,i,a)&&(s=!0);return s}function Ye(e,t,n,r,i,a,o){if(n[0].overscaledZ>=a)return!1;let s=!1;for(let a of n){let n=e.getLoadedTile(a);if(!n)continue;let{fadingRole:c,fadingDirection:l,fadingParentID:u}=n;c===Ae.Base&&l===je.Departing&&u||(n.setCrossFadeLogic({fadingRole:Ae.Base,fadingDirection:je.Departing,fadingParentID:t.tileID,fadeEndTime:i+o}),t.setCrossFadeLogic({fadingRole:Ae.Parent,fadingDirection:je.Incoming,fadeEndTime:i+o})),r[a.key]=a,s=!0}return s}function Xe(e,t,n,r){let i=e.tileID;return!!e.selfFading||!e.hasData()&&!!t.has(i)&&(e.setSelfFadeLogic(n+r),!0)}function F(e,t){var n;e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0;let r=t.tileID.canonical.x-e.tileID.canonical.x,i=t.tileID.canonical.y-e.tileID.canonical.y,a=2**e.tileID.canonical.z,o=t.tileID.key;r===0&&i===0||Math.abs(i)>1||(Math.abs(r)>1&&(Math.abs(r+a)===1?r+=a:Math.abs(r-a)===1&&(r-=a)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,r,i),(n=e.neighboringTiles)!=null&&n[o]&&(e.neighboringTiles[o].backfilled=!0)))}class Ze{constructor(){this._tiles={}}handleWrapJump(e){let t={};for(let n in this._tiles){let r=this._tiles[n];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t[r.tileID.key]=r}this._tiles=t}setFeatureState(e,t){for(let n in this._tiles)this._tiles[n].setFeatureState(e,t)}getAllTiles(){return Object.values(this._tiles)}getAllIds(e=!1){return e?Object.values(this._tiles).map((e=>e.tileID)).sort(t.au).map((e=>e.key)):Object.keys(this._tiles)}getTileById(e){return this._tiles[e]}setTile(e,t){this._tiles[e]=t}deleteTileById(e){delete this._tiles[e]}getLoadedTile(e){let t=this.getTileById(e.key);return t?.hasData()?t:null}isIdRenderable(e,t=!1){return this.getTileById(e)?.isRenderable(t)}getRenderableIds(e=0,n){let r=[];for(let e of this.getAllIds())this.isIdRenderable(e,n)&&r.push(this.getTileById(e));return n?r.sort(((n,r)=>{let i=n.tileID,a=r.tileID,o=new t.P(i.canonical.x,i.canonical.y)._rotate(-e),s=new t.P(a.canonical.x,a.canonical.y)._rotate(-e);return i.overscaledZ-a.overscaledZ||s.y-o.y||s.x-o.x})).map((e=>e.tileID.key)):r.map((e=>e.tileID)).sort(t.au).map((e=>e.key))}}class Qe extends t.E{constructor(e,n,r){super(),this.id=e,this.dispatcher=r,this.on(`data`,(e=>{this._dataHandler(e)})),this.on(`dataloading`,(()=>{this._sourceErrored=!1})),this.on(`error`,(()=>{this._sourceErrored=this._source.loaded()})),this._source=((e,t,n,r)=>{let i=new(Te(t.type))(e,t,n,r);if(i.id!==e)throw Error(`Expected Source id to be ${e} instead of ${i.id}`);return i})(e,n,r,this),this._inViewTiles=new Ze,this._outOfViewCache=new t.av(0,(e=>this._unloadTile(e))),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new Ne,this._didEmitContent=!1,this._updated=!1}onAdd(e){var t;this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,(t=this._source)!=null&&t.onAdd&&this._source.onAdd(e)}onRemove(e){var t;for(let e of this._inViewTiles.getAllTiles())e.unloadVectorData();this.clearTiles(),(t=this._source)!=null&&t.onRemove&&this._source.onRemove(e),this._inViewTiles=new Ze}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!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 e of this._inViewTiles.getAllTiles())if(e.state!==`loaded`&&e.state!==`errored`)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,n,r){return t._(this,void 0,void 0,(function*(){try{let t=yield this._source.loadTile(e);this._tileLoaded(e,n,r,t)}catch(n){e.state=`errored`,n.status===404?this.update(this.transform,this.terrain):this._source.fire(new t.l(t.d(n),{tile:e}))}}))}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new t.n(`dataabort`,{tile:e,coord:e.tileID,dataType:`source`}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(let t of this._inViewTiles.getAllTiles())t.upload(e),t.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(e){return this._inViewTiles.getRenderableIds(this.transform?.bearingInRadians,e)}hasRenderableParent(e){let t=e.overscaledZ-1;if(t>=this._source.minzoom){let n=this.getLoadedTile(e.scaledTo(t));if(n)return this._inViewTiles.isIdRenderable(n.tileID.key)}return!1}reload(e,t=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(let n of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(n);t&&!this._source.shouldReloadTile(r,t)||(e?this._reloadTile(n,`expired`):r.state!==`errored`&&this._reloadTile(n,`reloading`))}}}_reloadTile(e,n){return t._(this,void 0,void 0,(function*(){let t=this._inViewTiles.getTileById(e);t&&(t.state!==`loading`&&(t.state=n),yield this._loadTile(t,e,n))}))}_tileLoaded(e,n,r,i){e.timeAdded=l(),e.selfFading&&(e.fadeEndTime=e.timeAdded+this._rasterFadeDuration),r===`expired`&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(n,e),i!=null&&i.unmodified||(this.getSource().type===`raster-dem`&&e.dem&&function(e,t){var n;let r=t.getRenderableIds();for(let i of r){if(!e.neighboringTiles?.[i])continue;let r=t.getTileById(i);e.neighboringTiles[i].backfilled||F(e,r),(n=r.neighboringTiles?.[e.tileID.key])!=null&&n.backfilled||F(r,e)}}(e,this._inViewTiles),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.n(`data`,{dataType:`source`,tile:e,coord:e.tileID})))}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._inViewTiles.getTileById(e)}_retainLoadedChildren(e,t){let n=this._getLoadedDescendents(t),r=new Set;for(let i of t){let t=n[i.key];if(!t?.length){r.add(i);continue}let a=i.overscaledZ+Qe.maxOverzooming,o=t.filter((e=>e.tileID.overscaledZ<=a));if(!o.length){r.add(i);continue}let s=Math.min(...o.map((e=>e.tileID.overscaledZ))),c=o.filter((e=>e.tileID.overscaledZ===s)).map((e=>e.tileID));for(let t of c)e[t.key]=t;this._areDescendentsComplete(c,s,i.overscaledZ)||r.add(i)}return r}_getLoadedDescendents(e){var t;let n={};for(let r of this._inViewTiles.getAllTiles().filter((e=>e.hasData())))for(let i of e)r.tileID.isChildOf(i)&&(n[t=i.key]||(n[t]=[]),n[i.key].push(r));return n}_areDescendentsComplete(e,t,n){return e.length===1&&e[0].isOverscaled()?e[0].overscaledZ===t:4**(t-n)===e.length}getLoadedTile(e){return this._inViewTiles.getLoadedTile(e)}updateCacheSize(e){let n=Math.ceil(e.width/this._source.tileSize)+1,r=Math.ceil(e.height/this._source.tileSize)+1,i=Math.floor(n*r*(this._maxTileCacheZoomLevels===null?t.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),a=typeof this._maxTileCacheSize==`number`?Math.min(this._maxTileCacheSize,i):i;this._outOfViewCache.setMaxSize(a)}handleWrapJump(e){let t=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);this._prevLng=e,t&&(this._inViewTiles.handleWrapJump(t),this._resetTileReloadTimers())}update(e,n){if(!this._sourceLoaded||this._paused)return;let r;this.transform=e,this.terrain=n,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.a3(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(r=We(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type===`vector`&&this.map._zoomLevelsToOverscale!==void 0?e.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(r=r.filter((e=>this._source.hasTile(e))))):r=[],this.usedForTerrain&&(r=this._addTerrainIdealTiles(r));let i=r.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,i&&this.fire(new t.n(`data`,{sourceDataType:`idle`,dataType:`source`,sourceId:this.id}));let a=Ue(e,this._source),o=this._updateRetainedTiles(r,a),s=Ke(this._source.type);s&&this._rasterFadeDuration>0&&!n&&function(e,n,r,i,a,o,s){let c=l(),u=t.at(n);for(let t of n){let n=e.getTileById(t.key);n.fadingDirection!==je.Departing&&n.fadeOpacity!==0||n.resetFadeLogic(),qe(e,n,r,c,i,a,s)||Je(e,n,r,c,o,s)||Xe(n,u,c,s)||n.resetFadeLogic()}}(this._inViewTiles,r,o,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),s?this._cleanUpRasterTiles(o):this._cleanUpVectorTiles(o)}_cleanUpRasterTiles(e){for(let t of this._inViewTiles.getAllIds())e[t]||this._removeTile(t)}_cleanUpVectorTiles(e){for(let t of this._inViewTiles.getAllIds()){let n=this._inViewTiles.getTileById(t);e[t]?n.clearSymbolFadeHold():n.hasSymbolBuckets?n.holdingForSymbolFade()?n.symbolFadeFinished()&&this._removeTile(t):n.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(t)}}_addTerrainIdealTiles(e){let t=[];for(let n of e)if(n.canonical.z>this._source.minzoom){let e=n.scaledTo(n.canonical.z-1);t.push(e);let r=n.scaledTo(Math.max(this._source.minzoom,Math.min(n.canonical.z,5)));t.push(r)}return e.concat(t)}releaseSymbolFadeTiles(){for(let e of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(e).holdingForSymbolFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){let n=new Set;for(let t of e)this._addTile(t).hasData()||n.add(t);let r=e.reduce(((e,t)=>(e[t.key]=t,e)),{}),i=this._retainLoadedChildren(r,n),a={},o=Math.max(t-Qe.maxUnderzooming,this._source.minzoom);for(let e of i){let t=this._inViewTiles.getTileById(e.key),n=t?.wasRequested();for(let i=e.overscaledZ-1;i>=o;--i){let o=e.scaledTo(i);if(a[o.key])break;if(a[o.key]=!0,t=this.getTile(o),!t&&n&&(t=this._addTile(o)),t){let e=t.hasData();if((e||!this.map?.cancelPendingTileRequestsWhileZooming||n)&&(r[o.key]=o),n=t.wasRequested(),e)break}}}return r}_addTile(e){let n=this._inViewTiles.getTileById(e.key);if(n)return n;n=this._outOfViewCache.getAndRemove(e),n&&(n.resetFadeLogic(),this._setTileReloadTimer(e.key,n),n.tileID=e,this._state.initializeTileState(n,this.map?this.map.painter:null));let r=n;return n||(n=new Me(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(n,e.key,n.state)),n.uses++,this._inViewTiles.setTile(e.key,n),r||this._source.fire(new t.n(`dataloading`,{tile:n,coord:n.tileID,dataType:`source`})),n}_setTileReloadTimer(e,t){this._clearTileReloadTimer(e);let n=t.getExpiryTimeout();n&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,`expired`),delete this._timers[e]}),n))}_clearTileReloadTimer(e){let t=this._timers[e];t&&(clearTimeout(t),delete this._timers[e])}_resetTileReloadTimers(){for(let e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(let e of this._inViewTiles.getAllIds()){let t=this._inViewTiles.getTileById(e);this._setTileReloadTimer(e,t)}}refreshTiles(e){for(let t of this._inViewTiles.getAllIds()){let n=this._inViewTiles.getTileById(t);(this._inViewTiles.isIdRenderable(t)||n.state==`errored`)&&e.some((e=>e.equals(n.tileID.canonical)))&&this._reloadTile(t,`expired`)}}_removeTile(e){let t=this._inViewTiles.getTileById(e);t&&(t.uses--,this._inViewTiles.deleteTileById(e),this._clearTileReloadTimer(e),t.uses>0||(t.hasData()&&t.state!==`reloading`?this._outOfViewCache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){e.dataType===`source`&&(e.sourceDataType===`metadata`?this._sourceLoaded=!0:e.sourceDataType===`content`&&this._sourceLoaded&&!this._paused&&(this.reload(e.sourceDataChanged,e.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e of this._inViewTiles.getAllIds())this._removeTile(e);this._outOfViewCache.reset()}tilesIn(e,n,r){let i=[],a=this.transform;if(!a)return i;let o=a.getCoveringTilesDetailsProvider().allowWorldCopies(),s=r?a.getCameraQueryGeometry(e):e,c=e=>a.screenPointToMercatorCoordinate(e,this.terrain),l=this.transformBbox(e,c,!o),u=this.transformBbox(s,c,!o),d=this.getIds(),f=t.a8.fromPoints(u);for(let e of d){let r=this._inViewTiles.getTileById(e);if(r.holdingForSymbolFade())continue;let s=o?[r.tileID]:[r.tileID.unwrapTo(-1),r.tileID.unwrapTo(0)],c=2**(a.zoom-r.tileID.overscaledZ),d=n*r.queryPadding*t.a6/r.tileSize/c;for(let e of s){let n=f.map((n=>e.getTilePoint(new t.a7(n.x,n.y))));if(n.expandBy(d),n.intersects(Ge)){let t=l.map((t=>e.getTilePoint(t))),n=u.map((t=>e.getTilePoint(t)));i.push({tile:r,tileID:o?e:e.unwrapTo(0),queryGeometry:t,cameraQueryGeometry:n,scale:c})}}}return i}transformBbox(e,n,r){let i=e.map(n);if(r){let r=t.a8.fromPoints(e);r.shrinkBy(.001*Math.min(r.width(),r.height()));let a=r.map(n);t.a8.fromPoints(i).covers(a)||(i=i.map((e=>e.x>.5?new t.a7(e.x-1,e.y,e.z):e)))}return i}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map((e=>this._inViewTiles.getTileById(e).tileID));return this.transform&&this.transform.populateCache(t),t}hasTransition(){return!!this._source.hasTransition()||Ke(this._source.type)&&function(e,t){if(t<=0)return!1;let n=l();for(let t of e.getAllTiles())if(t.fadeEndTime>=n)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(e){this._rasterFadeDuration=e}setFeatureState(e,n,r){e||=t.ag,this._state.updateState(e,n,r)}removeFeatureState(e,n,r){e||=t.ag,this._state.removeFeatureState(e,n,r)}getFeatureState(e,n){return e||=t.ag,this._state.getState(e,n)}setDependencies(e,t,n){let r=this._inViewTiles.getTileById(e);r&&r.setDependencies(t,n)}reloadTilesForDependencies(e,t){for(let n of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(n).hasDependency(e,t)&&this._reloadTile(n,`reloading`);this._outOfViewCache.filter((n=>!n.hasDependency(e,t)))}areTilesLoaded(){for(let e of this._inViewTiles.getAllTiles())if(e.state!==`loaded`&&e.state!==`errored`)return!1;return!0}}Qe.maxUnderzooming=10,Qe.maxOverzooming=3;class $e{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=t.al(e,0,1);let n=1,r=this._distances[n],i=e*this.paddedLength+this.padding;for(;r<i&&n<this._distances.length;)r=this._distances[++n];let a=n-1,o=this._distances[a],s=r-o,c=s>0?(i-o)/s:0;return this.points[a].mult(1-c).add(this.points[n].mult(c))}}function et(e,t){let n=!0;return e===`always`||e!==`never`&&t!==`never`||(n=!1),n}class I{constructor(e,t,n){let r=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);for(let e=0;e<this.xCellCount*this.yCellCount;e++)r.push([]),i.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,n,r,i){this._forEachCell(t,n,r,i,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(i)}insertCircle(e,t,n,r){this._forEachCell(t-r,n-r,t+r,n+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(n),this.circles.push(r)}_insertBoxCell(e,t,n,r,i,a){this.boxCells[i].push(a)}_insertCircleCell(e,t,n,r,i,a){this.circleCells[i].push(a)}_query(e,t,n,r,i,a,o){if(n<0||e>this.width||r<0||t>this.height)return[];let s=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=r){if(i)return[{key:null,x1:e,y1:t,x2:n,y2:r}];for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){let t=this.circles[3*e],n=this.circles[3*e+1],r=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:t-r,y1:n-r,x2:t+r,y2:n+r})}}else this._forEachCell(e,t,n,r,this._queryCell,s,{hitTest:i,overlapMode:a,seenUids:{box:{},circle:{}}},o);return s}query(e,t,n,r){return this._query(e,t,n,r,!1,null)}hitTest(e,t,n,r,i,a){return this._query(e,t,n,r,!0,i,a).length>0}hitTestCircle(e,t,n,r,i){let a=e-n,o=e+n,s=t-n,c=t+n;if(o<0||a>this.width||c<0||s>this.height)return!1;let l=[];return this._forEachCell(a,s,o,c,this._queryCellCircle,l,{hitTest:!0,overlapMode:r,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}},i),l.length>0}_queryCell(e,t,n,r,i,a,o,s){let{seenUids:c,hitTest:l,overlapMode:u}=o,d=this.boxCells[i],f=1e-6;if(d!==null){let i=this.bboxes;for(let o of d)if(!c.box[o]){c.box[o]=!0;let d=4*o,p=this.boxKeys[o];if(e<=i[d+2]+f&&t<=i[d+3]+f&&n>=i[d+0]-f&&r>=i[d+1]-f&&(!s||s(p))&&(!l||!et(u,p.overlapMode))&&(a.push({key:p,x1:i[d],y1:i[d+1],x2:i[d+2],y2:i[d+3]}),l))return!0}}let p=this.circleCells[i];if(p!==null){let i=this.circles;for(let o of p)if(!c.circle[o]){c.circle[o]=!0;let d=3*o,f=this.circleKeys[o];if(this._circleAndRectCollide(i[d],i[d+1],i[d+2],e,t,n,r)&&(!s||s(f))&&(!l||!et(u,f.overlapMode))){let e=i[d],t=i[d+1],n=i[d+2];if(a.push({key:f,x1:e-n,y1:t-n,x2:e+n,y2:t+n}),l)return!0}}}return!1}_queryCellCircle(e,t,n,r,i,a,o,s){let{circle:c,seenUids:l,overlapMode:u}=o,d=this.boxCells[i];if(d!==null){let e=this.bboxes;for(let t of d)if(!l.box[t]){l.box[t]=!0;let n=4*t,r=this.boxKeys[t];if(this._circleAndRectCollide(c.x,c.y,c.radius,e[n+0],e[n+1],e[n+2],e[n+3])&&(!s||s(r))&&!et(u,r.overlapMode))return a.push(!0),!0}}let f=this.circleCells[i];if(f!==null){let e=this.circles;for(let t of f)if(!l.circle[t]){l.circle[t]=!0;let n=3*t,r=this.circleKeys[t];if(this._circlesCollide(e[n],e[n+1],e[n+2],c.x,c.y,c.radius)&&(!s||s(r))&&!et(u,r.overlapMode))return a.push(!0),!0}}}_forEachCell(e,t,n,r,i,a,o,s){let c=this._convertToXCellCoord(e),l=this._convertToYCellCoord(t),u=this._convertToXCellCoord(n),d=this._convertToYCellCoord(r);for(let f=c;f<=u;f++)for(let c=l;c<=d;c++)if(i.call(this,e,t,n,r,this.xCellCount*c+f,a,o,s))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,n,r,i,a){let o=r-e,s=i-t,c=n+a;return c*c>o*o+s*s}_circleAndRectCollide(e,t,n,r,i,a,o){let s=(a-r)/2,c=Math.abs(e-(r+s));if(c>s+n)return!1;let l=(o-i)/2,u=Math.abs(t-(i+l));if(u>l+n)return!1;if(c<=s||u<=l)return!0;let d=c-s,f=u-l;return d*d+f*f<=n*n}}function L(e,t){let n=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),r=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),i=t[0]*n,a=t[4]*n,o=t[8]*r,s=t[1]*n,c=t[5]*n,l=t[9]*r,u=t[2]*n,d=t[6]*n,f=t[10]*r;e[0]=i,e[1]=a,e[2]=o,e[4]=s,e[5]=c,e[6]=l,e[8]=u,e[9]=d,e[10]=f;let p=t[12],m=t[13],h=t[14];return e[12]=-i*p-s*m-u*h,e[13]=-a*p-c*m-d*h,e[14]=-o*p-l*m-f*h,e[3]=0,e[7]=0,e[11]=0,e[15]=1,e}let R=t.O();function tt(e,n,i){let a=t.O();if(!e){let{vecSouth:e,vecEast:t}=rt(n),i=r();i[0]=t[0],i[1]=t[1],i[2]=e[0],i[3]=e[1],o=i,(f=(c=(s=i)[0])*(d=s[3])-(u=s[2])*(l=s[1]))&&(o[0]=d*(f=1/f),o[1]=-l*f,o[2]=-u*f,o[3]=c*f),a[0]=i[0],a[1]=i[1],a[4]=i[2],a[5]=i[3]}var o,s,c,l,u,d,f;return t.S(a,a,[1/i,1/i,1]),a}function nt(e,n,r,i){if(e){let e=t.O();if(!n){let{vecSouth:t,vecEast:n}=rt(r);e[0]=n[0],e[1]=n[1],e[4]=t[0],e[5]=t[1]}return t.S(e,e,[i,i,1]),e}return r.pixelsToClipSpaceMatrix}function rt(e){let n=Math.cos(e.rollInRadians),r=Math.sin(e.rollInRadians),i=Math.cos(e.pitchInRadians),a=Math.cos(e.bearingInRadians),o=Math.sin(e.bearingInRadians),s=t.az();s[0]=-a*i*r-o*n,s[1]=-o*i*r+a*n;let c=t.aA(s);c<1e-9?t.aB(s):t.aC(s,s,1/c);let l=t.az();l[0]=a*i*n-o*r,l[1]=o*i*n+a*r;let u=t.aA(l);return u<1e-9?t.aB(l):t.aC(l,l,1/u),{vecEast:l,vecSouth:s}}function z(e,n,r,i){let a;i?(a=[e,n,i(e,n),1],t.aE(a,a,r)):(a=[e,n,0,1],yt(a,a,r));let o=a[3];return{point:new t.P(a[0]/o,a[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}function it(e,t){return .5+e/t*.5}function at(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function ot(e,n,r,i,a,o,s,c,l,u,d,f,p){let m=r?e.textSizeData:e.iconSizeData,h=t.aw(m,n.transform.zoom),g=[256/n.width*2+1,256/n.height*2+1],_=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;_.clear();let v=e.lineVertexArray,y=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,b=n.transform.width/n.transform.height,x=!1;for(let r=0;r<y.length;r++){let S=y.get(r);if(S.hidden||S.writingMode===t.ax.vertical&&!x){vt(S.numGlyphs,_);continue}x=!1;let C=new t.P(S.anchorX,S.anchorY),w={getElevation:p,pitchedLabelPlaneMatrix:i,lineVertexArray:v,pitchWithMap:o,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:n.transform,tileAnchorPoint:C,unwrappedTileID:l,width:u,height:d,translation:f},T=pt(S.anchorX,S.anchorY,w);if(!at(T.point,g)){vt(S.numGlyphs,_);continue}let E=it(n.transform.cameraToCenterDistance,T.signedDistanceFromCamera),D=t.ay(m,h,S),O=o?D*n.transform.getPitchedTextCorrection(S.anchorX,S.anchorY,l)/E:D*E,k=lt({projectionContext:w,pitchedLabelPlaneMatrixInverse:a,symbol:S,fontSize:O,flip:!1,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:b,rotateToLine:c});x=k.useVertical,(k.notEnoughRoom||x||k.needsFlipping&&lt({projectionContext:w,pitchedLabelPlaneMatrixInverse:a,symbol:S,fontSize:O,flip:!0,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:b,rotateToLine:c}).notEnoughRoom)&&vt(S.numGlyphs,_)}r?e.text.dynamicLayoutVertexBuffer.updateData(_):e.icon.dynamicLayoutVertexBuffer.updateData(_)}function st(e,t,n,r,i,a,o,s){let c=a.glyphStartIndex+a.numGlyphs,l=a.lineStartIndex,u=a.lineStartIndex+a.lineLength,d=t.getoffsetX(a.glyphStartIndex),f=t.getoffsetX(c-1),p=gt(e*d,n,r,i,a.segment,l,u,s,o);if(!p)return null;let m=gt(e*f,n,r,i,a.segment,l,u,s,o);return m?s.projectionCache.anyProjectionOccluded?null:{first:p,last:m}:null}function ct(e,n,r,i){return e===t.ax.horizontal&&Math.abs(r.y-n.y)>Math.abs(r.x-n.x)*i?{useVertical:!0}:(e===t.ax.vertical?n.y<r.y:n.x>r.x)?{needsFlipping:!0}:null}function lt(e){let{projectionContext:n,pitchedLabelPlaneMatrixInverse:r,symbol:i,fontSize:a,flip:o,keepUpright:s,glyphOffsetArray:c,dynamicLayoutVertexArray:l,aspectRatio:u,rotateToLine:d}=e,f=a/24,p=i.lineOffsetX*f,m=i.lineOffsetY*f,h;if(i.numGlyphs>1){let e=i.glyphStartIndex+i.numGlyphs,t=i.lineStartIndex,a=i.lineStartIndex+i.lineLength,l=st(f,c,p,m,o,i,d,n);if(!l)return{notEnoughRoom:!0};let g=ft(l.first.point.x,l.first.point.y,n,r),_=ft(l.last.point.x,l.last.point.y,n,r);if(s&&!o){let e=ct(i.writingMode,g,_,u);if(e)return e}h=[l.first];for(let r=i.glyphStartIndex+1;r<e-1;r++){let e=gt(f*c.getoffsetX(r),p,m,o,i.segment,t,a,n,d);if(!e)return{notEnoughRoom:!0};h.push(e)}h.push(l.last)}else{if(s&&!o){let e=B(n.tileAnchorPoint.x,n.tileAnchorPoint.y,n).point,a=i.lineStartIndex+i.segment+1,o=new t.P(n.lineVertexArray.getx(a),n.lineVertexArray.gety(a)),s=B(o.x,o.y,n),c=s.signedDistanceFromCamera>0?s.point:ut(n.tileAnchorPoint,o,e,1,n),l=ft(e.x,e.y,n,r),d=ft(c.x,c.y,n,r),f=ct(i.writingMode,l,d,u);if(f)return f}let e=gt(f*c.getoffsetX(i.glyphStartIndex),p,m,o,i.segment,i.lineStartIndex,i.lineStartIndex+i.lineLength,n,d);if(!e||n.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};h=[e]}for(let e of h)t.aD(l,e.point,e.angle);return{}}function ut(e,t,n,r,i){let a=e.add(e.sub(t)._unit()),o=B(a.x,a.y,i).point,s=n.sub(o);return n.add(s._mult(r/s.mag()))}function dt(e,n,r){let i=n.projectionCache;if(i.projections[e])return i.projections[e];let a=new t.P(n.lineVertexArray.getx(e),n.lineVertexArray.gety(e)),o=B(a.x,a.y,n);if(o.signedDistanceFromCamera>0)return i.projections[e]=o.point,i.anyProjectionOccluded||=o.isOccluded,o.point;let s=e-r.direction;return ut(r.distanceFromAnchor===0?n.tileAnchorPoint:new t.P(n.lineVertexArray.getx(s),n.lineVertexArray.gety(s)),a,r.previousVertex,r.absOffsetX-r.distanceFromAnchor+1,n)}function B(e,t,n){let r=e+n.translation[0],i=t+n.translation[1],a;return n.pitchWithMap?(a=z(r,i,n.pitchedLabelPlaneMatrix,n.getElevation),a.isOccluded=!1):(a=n.transform.projectTileCoordinates(r,i,n.unwrappedTileID,n.getElevation),a.point.x=(.5*a.point.x+.5)*n.width,a.point.y=(.5*-a.point.y+.5)*n.height),a}function ft(e,n,r,i){if(r.pitchWithMap){let a=[e,n,0,1];return t.aE(a,a,i),r.transform.projectTileCoordinates(a[0]/a[3],a[1]/a[3],r.unwrappedTileID,r.getElevation).point}return{x:e/r.width*2-1,y:1-n/r.height*2}}function pt(e,t,n){return n.transform.projectTileCoordinates(e,t,n.unwrappedTileID,n.getElevation)}function mt(e,t,n){return e._unit()._perp()._mult(t*n)}function ht(e,n,r,i,a,o,s,c,l){if(c.projectionCache.offsets[e])return c.projectionCache.offsets[e];let u=r.add(n);if(e+l.direction<i||e+l.direction>=a)return c.projectionCache.offsets[e]=u,u;let d=dt(e+l.direction,c,l),f=mt(d.sub(r),s,l.direction),p=r.add(f),m=d.add(f);return c.projectionCache.offsets[e]=t.aF(o,u,p,m)||u,c.projectionCache.offsets[e]}function gt(e,t,n,r,i,a,o,s,c){let l=r?e-t:e+t,u=l>0?1:-1,d=0;r&&(u*=-1,d=Math.PI),u<0&&(d+=Math.PI);let f,p=u>0?a+i:a+i+1;s.projectionCache.cachedAnchorPoint?f=s.projectionCache.cachedAnchorPoint:(f=B(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=f);let m,h,g=f,_=f,v=0,y=0,b=Math.abs(l),x=[],S;for(;v+y<=b;){if(p+=u,p<a||p>=o)return null;v+=y,_=g,h=m;let e={absOffsetX:b,direction:u,distanceFromAnchor:v,previousVertex:_};if(g=dt(p,s,e),n===0)x.push(_),S=g.sub(_);else{let t,r=g.sub(_);t=r.mag()===0?mt(dt(p+u,s,e).sub(g),n,u):mt(r,n,u),h||=_.add(t),m=ht(p,t,g,a,o,h,n,s,e),x.push(h),S=m.sub(h)}y=S.mag()}let C=S._mult((b-v)/y)._add(h||_),w=d+Math.atan2(g.y-_.y,g.x-_.x);return x.push(C),{point:C,angle:c?w:0,path:x}}let _t=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function vt(e,t){for(let n=0;n<e;n++){let e=t.length;t.resize(e+4),t.float32.set(_t,3*e)}}function yt(e,t,n){let r=t[0],i=t[1];return e[0]=n[0]*r+n[4]*i+n[12],e[1]=n[1]*r+n[5]*i+n[13],e[3]=n[3]*r+n[7]*i+n[15],e}class bt{constructor(e,t=new I(e.width+200,e.height+200,25),n=new I(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=n,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.height+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,n,r,i,a,o,s,c,l,u,d){let f=this.projectAndGetPerspectiveRatio(e.anchorPointX+s[0],e.anchorPointY+s[1],i,l,d),p=n*f.perspectiveRatio,m;if(a||o)m=this._projectCollisionBox(e,p,r,i,a,o,s,f,l,u,d);else{let t=f.x+(u?u.x*p:0),n=f.y+(u?u.y*p:0);m={allPointsOccluded:!1,box:[t+e.x1*p,n+e.y1*p,t+e.x2*p,n+e.y2*p]}}let[h,g,_,v]=m.box,y=a?m.allPointsOccluded:f.isOccluded,b=y;return b||=f.perspectiveRatio<this.perspectiveRatioCutoff,b||=!this.isInsideGrid(h,g,_,v),b||t!==`always`&&this.grid.hitTest(h,g,_,v,t,c)?{box:[h,g,_,v],placeable:!1,offscreen:!1,occluded:y}:{box:[h,g,_,v],placeable:!0,offscreen:this.isOffscreen(h,g,_,v),occluded:y}}placeCollisionCircles(e,n,r,i,a,o,s,c,l,u,d,f,p,m){let h=[],g=new t.P(n.anchorX,n.anchorY),_=this.getPerspectiveRatio(g.x,g.y,o,m),v=(l?a*this.transform.getPitchedTextCorrection(n.anchorX,n.anchorY,o)/_:a*_)/t.aJ,y={getElevation:m,pitchedLabelPlaneMatrix:s,lineVertexArray:r,pitchWithMap:l,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:g,unwrappedTileID:o,width:this.transform.width,height:this.transform.height,translation:p},b=st(v,i,n.lineOffsetX*v,n.lineOffsetY*v,!1,n,!1,y),x=!1,S=!1,C=!0;if(b){let n=.5*d*_+f,r=new t.P(-100,-100),i=new t.P(this.screenRightBoundary,this.screenBottomBoundary),a=new $e,o=b.first,s=b.last,p=[];for(let e=o.path.length-1;e>=1;e--)p.push(o.path[e]);for(let e=1;e<s.path.length;e++)p.push(s.path[e]);let m=2.5*n;if(l){let e=this.projectPathToScreenSpace(p,y);p=e.some((e=>e.signedDistanceFromCamera<=0))?[]:e.map((e=>e.point))}let g=[];if(p.length>0){let e=p[0].clone(),n=p[0].clone();for(let t=1;t<p.length;t++)e.x=Math.min(e.x,p[t].x),e.y=Math.min(e.y,p[t].y),n.x=Math.max(n.x,p[t].x),n.y=Math.max(n.y,p[t].y);g=e.x>=r.x&&n.x<=i.x&&e.y>=r.y&&n.y<=i.y?[p]:n.x<r.x||e.x>i.x||n.y<r.y||e.y>i.y?[]:t.aG([p],r.x,r.y,i.x,i.y)}for(let t of g){a.reset(t,.25*n);let r=0;r=a.length<=.5*n?1:Math.ceil(a.paddedLength/m)+1;for(let t=0;t<r;t++){let i=t/Math.max(r-1,1),o=a.lerp(i),s=o.x+100,l=o.y+100;h.push(s,l,n,0);let d=s-n,f=l-n,p=s+n,m=l+n;if(C&&=this.isOffscreen(d,f,p,m),S||=this.isInsideGrid(d,f,p,m),e!==`always`&&this.grid.hitTestCircle(s,l,n,e,u)&&(x=!0,!c))return{circles:[],offscreen:!1,collisionDetected:x}}}}return{circles:!c&&x||!S||_<this.perspectiveRatioCutoff?[]:h,offscreen:C,collisionDetected:x}}projectPathToScreenSpace(e,t){return function(e){let t=0,n=0,r=0,i=0;for(let a=0;a<e.length;a++)e[a].isOccluded?(r=a+1,i=0):(i++,i>n&&(n=i,t=r));return e.slice(t,t+n)}(function(e,t){let n=R;return function(e,t){let n=1/(t[0]*t[5]-t[1]*t[4]);e[0]=t[5]*n,e[1]=-t[1]*n,e[2]=0,e[3]=0,e[4]=-t[4]*n,e[5]=t[0]*n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1/t[10],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1/t[15]}(n,t.pitchedLabelPlaneMatrix),e.map((e=>{let r=z(e.x,e.y,n,t.getElevation),i=t.transform.projectTileCoordinates(r.point.x,r.point.y,t.unwrappedTileID,t.getElevation);return i.point.x=(.5*i.point.x+.5)*t.width,i.point.y=(.5*-i.point.y+.5)*t.height,i}))}(e,t))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let n=[],r=new t.a8;for(let i of e){let e=new t.P(i.x+100,i.y+100);r.extend(e),n.push(e)}let{minX:i,minY:a,maxX:o,maxY:s}=r,c=this.grid.query(i,a,o,s).concat(this.ignoredGrid.query(i,a,o,s)),l={},u={};for(let e of c){let r=e.key;if(l[r.bucketInstanceId]===void 0&&(l[r.bucketInstanceId]={}),l[r.bucketInstanceId][r.featureIndex])continue;let i=[new t.P(e.x1,e.y1),new t.P(e.x2,e.y1),new t.P(e.x2,e.y2),new t.P(e.x1,e.y2)];t.aH(n,i)&&(l[r.bucketInstanceId][r.featureIndex]=!0,u[r.bucketInstanceId]===void 0&&(u[r.bucketInstanceId]=[]),u[r.bucketInstanceId].push(r.featureIndex))}return u}insertCollisionBox(e,t,n,r,i,a){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:i,collisionGroupID:a,overlapMode:t},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,n,r,i,a){let o=n?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:i,collisionGroupID:a,overlapMode:t};for(let t=0;t<e.length;t+=4)o.insertCircle(s,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(e,n,r,i,a){if(a){let r;i?(r=[e,n,i(e,n),1],t.aE(r,r,a)):(r=[e,n,0,1],yt(r,r,a));let o=r[3];return{x:(r[0]/o+1)/2*this.transform.width+100,y:(-r[1]/o+1)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/o*.5,isOccluded:!1,signedDistanceFromCamera:o}}{let t=this.transform.projectTileCoordinates(e,n,r,i);return{x:(t.point.x+1)/2*this.transform.width+100,y:(1-t.point.y)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/t.signedDistanceFromCamera*.5,isOccluded:t.isOccluded,signedDistanceFromCamera:t.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,n,r){let i=this.transform.projectTileCoordinates(e,t,n,r);return .5+this.transform.cameraToCenterDistance/i.signedDistanceFromCamera*.5}isOffscreen(e,t,n,r){return n<100||e>=this.screenRightBoundary||r<100||t>this.screenBottomBoundary}isInsideGrid(e,t,n,r){return n>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=t.ap([]);return t.Q(e,e,[-100,-100,0]),e}_projectCollisionBox(e,n,r,i,a,o,s,c,l,u,d){let f=1,p=0,m=0,h=1,g=e.anchorPointX+s[0],_=e.anchorPointY+s[1];if(o&&!a){let e=this.projectAndGetPerspectiveRatio(g+1,_,i,l,d),t=e.x-c.x,n=Math.atan((e.y-c.y)/t)+(t<0?Math.PI:0),r=Math.sin(n),a=Math.cos(n);f=a,p=r,m=-r,h=a}else if(!o&&a){let e=rt(this.transform);f=e.vecEast[0],p=e.vecEast[1],m=e.vecSouth[0],h=e.vecSouth[1]}let v=c.x,y=c.y,b=n;a&&(v=g,y=_,b=2**-(this.transform.zoom-r.overscaledZ),b*=this.transform.getPitchedTextCorrection(g,_,i),u||(b*=t.al(.5+c.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),u&&(v+=f*u.x*b+m*u.y*b,y+=p*u.x*b+h*u.y*b);let x=e.x1*b,S=e.x2*b,C=(x+S)/2,w=e.y1*b,T=e.y2*b,E=(w+T)/2,D=[{offsetX:x,offsetY:w},{offsetX:C,offsetY:w},{offsetX:S,offsetY:w},{offsetX:S,offsetY:E},{offsetX:S,offsetY:T},{offsetX:C,offsetY:T},{offsetX:x,offsetY:T},{offsetX:x,offsetY:E}],O=[];for(let{offsetX:e,offsetY:n}of D)O.push(new t.P(v+f*e+m*n,y+p*e+h*n));let k=!1;if(a){let e=O.map((e=>this.projectAndGetPerspectiveRatio(e.x,e.y,i,l,d)));k=e.some((e=>!e.isOccluded)),O=e.map((e=>new t.P(e.x,e.y)))}else k=!0;return{box:t.aI(O),allPointsOccluded:!k}}}class xt{constructor(e,t,n,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&n?1:0,this.placed=n}isHidden(){return this.opacity===0&&!this.placed}}class St{constructor(e,t,n,r,i){this.text=new xt(e?e.text:null,t,n,i),this.icon=new xt(e?e.icon:null,t,r,i)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Ct{constructor(e,t,n){this.text=e,this.icon=t,this.skipFade=n}}class wt{constructor(e,t,n,r,i){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=n,this.bucketIndex=r,this.tileID=i}}class Tt{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function Et(e,n,r,i,a){let{horizontalAlign:o,verticalAlign:s}=t.aP(e);return new t.P(-(o-.5)*n+i[0]*a,-(s-.5)*r+i[1]*a)}class Dt{constructor(e,t,n,r,i){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new bt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new Tt(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=i,i&&(i.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;return t?(n,r)=>t.getElevation(e,n,r):null}getBucketParts(e,n,r,i){let a=r.getBucket(n),o=r.latestFeatureIndex;if(!a||!o||n.id!==a.layerIds[0])return;let s=r.collisionBoxArray,c=a.layers[0].layout,l=a.layers[0].paint,u=2**(this.transform.zoom-r.tileID.overscaledZ),d=r.tileSize/t.a6,f=r.tileID.toUnwrapped(),p=c.get(`text-rotation-alignment`)===`map`,m=t.aK(r,1,this.transform.zoom),h=t.aL(this.collisionIndex.transform,r,l.get(`text-translate`),l.get(`text-translate-anchor`)),g=t.aL(this.collisionIndex.transform,r,l.get(`icon-translate`),l.get(`icon-translate-anchor`)),_=tt(p,this.transform,m);this.retainedQueryData[a.bucketInstanceId]=new wt(a.bucketInstanceId,o,a.sourceLayerIndex,a.index,r.tileID);let v={bucket:a,layout:c,translationText:h,translationIcon:g,unwrappedTileID:f,pitchedLabelPlaneMatrix:_,scale:u,textPixelRatio:d,holdingForFade:r.holdingForSymbolFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.aw(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(i)for(let t of a.sortKeyRanges){let{sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i}=t;e.push({sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i,parameters:v})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:v})}attemptAnchorPlacement(e,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b){var x,S;let C=t.aM[e.textAnchor],w=[e.textOffset0,e.textOffset1],T=Et(C,r,i,w,a),E=this.collisionIndex.placeCollisionBox(n,f,c,l,u,s,o,g,d.predicate,y,T,b);if((!v||this.collisionIndex.placeCollisionBox(v,f,c,l,u,s,o,_,d.predicate,y,T,b).placeable)&&E.placeable){let e;if((x=this.prevPlacement)!=null&&x.variableOffsets[p.crossTileID]&&(S=this.prevPlacement?.placements[p.crossTileID])!=null&&S.text&&(e=this.prevPlacement.variableOffsets[p.crossTileID].anchor),p.crossTileID===0)throw Error(`symbolInstance.crossTileID can't be 0`);return this.variableOffsets[p.crossTileID]={textOffset:w,width:r,height:i,anchor:C,textBoxScale:a,prevAnchor:e},this.markUsedJustification(m,C,p,h),m.allowVerticalPlacement&&(this.markUsedOrientation(m,h,p),this.placedOrientations[p.crossTileID]=h),{shift:T,placedGlyphBoxes:E}}}placeLayerBucketPart(e,n,r){let{bucket:i,layout:a,translationText:o,translationIcon:s,unwrappedTileID:c,pitchedLabelPlaneMatrix:l,textPixelRatio:u,holdingForFade:d,collisionBoxArray:f,partiallyEvaluatedTextSize:p,collisionGroup:m}=e.parameters,h=a.get(`text-optional`),g=a.get(`icon-optional`),_=t.aN(a,`text-overlap`,`text-allow-overlap`),v=_===`always`,y=t.aN(a,`icon-overlap`,`icon-allow-overlap`),b=y===`always`,x=a.get(`text-rotation-alignment`)===`map`,S=a.get(`text-pitch-alignment`)===`map`,C=a.get(`icon-text-fit`)!==`none`,w=a.get(`symbol-z-order`)===`viewport-y`,T=v&&(b||!i.hasIconData()||g),E=b&&(v||!i.hasTextData()||h);!i.collisionArrays&&f&&i.deserializeCollisionBoxes(f);let D=this.retainedQueryData[i.bucketInstanceId].tileID,O=this._getTerrainElevationFunc(D),k=this.transform.getFastPathSimpleProjectionMatrix(D),A=(e,f,b)=>{if(n[e.crossTileID])return;if(d)return void(this.placements[e.crossTileID]=new Ct(!1,!1,!1));let w=!1,A=!1,ee=!0,te=null,j={box:null,placeable:!1,offscreen:null,occluded:!1},ne={placeable:!1},re=null,ie=null,ae=null,oe=0,se=0,ce=0;f.textFeatureIndex?oe=f.textFeatureIndex:e.useRuntimeCollisionCircles&&(oe=e.featureIndex),f.verticalTextFeatureIndex&&(se=f.verticalTextFeatureIndex);let le=f.textBox;if(le){let n=n=>{let r=t.ax.horizontal;if(i.allowVerticalPlacement&&!n&&this.prevPlacement){let t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,r=t,this.markUsedOrientation(i,r,e))}return r},a=(n,r)=>{if(i.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&f.verticalTextBox){for(let e of i.writingModes)if(e===t.ax.vertical?(j=r(),ne=j):j=n(),j?.placeable)break}else j=n()},l=e.textAnchorOffsetStartIndex,d=e.textAnchorOffsetEndIndex;if(d===l){let r=(t,n)=>{let r=this.collisionIndex.placeCollisionBox(t,_,u,D,c,S,x,o,m.predicate,O,void 0,k);return r!=null&&r.placeable&&(this.markUsedOrientation(i,n,e),this.placedOrientations[e.crossTileID]=n),r};a((()=>r(le,t.ax.horizontal)),(()=>{let n=f.verticalTextBox;return i.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&n?r(n,t.ax.vertical):{box:null,offscreen:null}})),n(j?.placeable)}else{let p=t.aM[this.prevPlacement?.variableOffsets[e.crossTileID]?.anchor],h=(t,n,a)=>{let f=t.x2-t.x1,h=t.y2-t.y1,g=e.textBoxScale,v=C&&y===`never`?n:null,b=null,T=_===`never`?1:2,E=`never`;p&&T++;for(let n=0;n<T;n++){for(let n=l;n<d;n++){let r=i.textAnchorOffsets.get(n);if(p&&r.textAnchor!==p)continue;let l=this.attemptAnchorPlacement(r,t,f,h,g,x,S,u,D,c,m,E,e,i,a,o,s,v,O);if(l&&(b=l.placedGlyphBoxes,b?.placeable))return w=!0,te=l.shift,b}p?p=null:E=_}return r&&!b&&(b={box:this.collisionIndex.placeCollisionBox(le,`always`,u,D,c,S,x,o,m.predicate,O,void 0,k).box,offscreen:!1,placeable:!1,occluded:!1}),b};a((()=>h(le,f.iconBox,t.ax.horizontal)),(()=>{let n=f.verticalTextBox;return i.allowVerticalPlacement&&!j?.placeable&&e.numVerticalGlyphVertices>0&&n?h(n,f.verticalIconBox,t.ax.vertical):{box:null,occluded:!0,offscreen:null}})),j&&(w=j.placeable,ee=j.offscreen);let g=n(j?.placeable);if(!w&&this.prevPlacement){let t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(i,t.anchor,e,g))}}}if(re=j,w=re?.placeable,ee=re?.offscreen,e.useRuntimeCollisionCircles&&e.centerJustifiedTextSymbolIndex>=0){let n=i.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),s=t.ay(i.textSizeData,p,n),u=a.get(`text-padding`);ie=this.collisionIndex.placeCollisionCircles(_,n,i.lineVertexArray,i.glyphOffsetArray,s,c,l,r,S,m.predicate,e.collisionCircleDiameter,u,o,O),ie.circles.length&&ie.collisionDetected&&!r&&t.w(`Collisions detected, but collision boxes are not shown`),w=v||ie.circles.length>0&&!ie.collisionDetected,ee&&=ie.offscreen}if(f.iconFeatureIndex&&(ce=f.iconFeatureIndex),f.iconBox){let e=e=>this.collisionIndex.placeCollisionBox(e,y,u,D,c,S,x,s,m.predicate,O,C&&te?te:void 0,k);ne&&ne.placeable&&f.verticalIconBox?(ae=e(f.verticalIconBox),A=ae.placeable):(ae=e(f.iconBox),A=ae.placeable),ee&&=ae.offscreen}let M=h||e.numHorizontalGlyphVertices===0&&e.numVerticalGlyphVertices===0,ue=g||e.numIconVertices===0;M||ue?ue?M||(A&&=w):w=A&&w:A=w=A&&w;let de=A&&ae.placeable;if(w&&re.placeable&&this.collisionIndex.insertCollisionBox(re.box,_,a.get(`text-ignore-placement`),i.bucketInstanceId,ne&&ne.placeable&&se?se:oe,m.ID),de&&this.collisionIndex.insertCollisionBox(ae.box,y,a.get(`icon-ignore-placement`),i.bucketInstanceId,ce,m.ID),ie&&w&&this.collisionIndex.insertCollisionCircles(ie.circles,_,a.get(`text-ignore-placement`),i.bucketInstanceId,oe,m.ID),r&&this.storeCollisionData(i.bucketInstanceId,b,f,re,ae,ie),e.crossTileID===0)throw Error(`symbolInstance.crossTileID can't be 0`);if(i.bucketInstanceId===0)throw Error(`bucket.bucketInstanceId can't be 0`);this.placements[e.crossTileID]=new Ct((w||T)&&!re?.occluded,(A||E)&&!ae?.occluded,ee||i.justReloaded),n[e.crossTileID]=!0};if(w){if(e.symbolInstanceStart!==0)throw Error(`bucket.bucketInstanceId should be 0`);let t=i.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let e=t.length-1;e>=0;--e){let n=t[e];A(i.symbolInstances.get(n),i.collisionArrays[n],n)}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)A(i.symbolInstances.get(t),i.collisionArrays[t],t);i.justReloaded=!1}storeCollisionData(e,t,n,r,i,a){if(n.textBox||n.iconBox){let a,o;this.collisionBoxArrays.has(e)?a=this.collisionBoxArrays.get(e):(a=new Map,this.collisionBoxArrays.set(e,a)),a.has(t)?o=a.get(t):(o={text:null,icon:null},a.set(t,o)),n.textBox&&(o.text=r.box),n.iconBox&&(o.icon=i.box)}if(a){let t=this.collisionCircleArrays[e];t===void 0&&(t=this.collisionCircleArrays[e]=[]);for(let e=0;e<a.circles.length;e+=4)t.push(a.circles[e+0]-100),t.push(a.circles[e+1]-100),t.push(a.circles[e+2]),t.push(+!!a.collisionDetected)}}markUsedJustification(e,n,r,i){let a;a=i===t.ax.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[t.aO(n)];let o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(let t of o)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=a>=0&&t!==a?0:r.crossTileID)}markUsedOrientation(e,n,r){let i=n===t.ax.horizontal||n===t.ax.horizontalOnly?n:0,a=n===t.ax.vertical?n:0,o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(let t of o)e.text.placedSymbolArray.get(t).placedOrientation=i;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,n=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let r=t?t.symbolFadeChange(e):1,i=t?t.opacities:{},a=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(let e in this.placements){let t=this.placements[e],a=i[e];a?(this.opacities[e]=new St(a,r,t.text,t.icon),n||=t.text!==a.text.placed,n||=t.icon!==a.icon.placed):(this.opacities[e]=new St(null,r,t.text,t.icon,t.skipFade),n||=t.text||t.icon)}for(let e in i){let t=i[e];if(!this.opacities[e]){let i=new St(t,r,!1,!1);i.isHidden()||(this.opacities[e]=i,n||=t.text.placed,n||=t.icon.placed)}}for(let e in a)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=a[e]);for(let e in o)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=o[e]);if(t&&t.lastPlacementChangeTime===void 0)throw Error(`Last placement time for previous placement is not defined`);n?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!=`number`&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let n={};for(let r of t){let t=r.getBucket(e);t&&r.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,r.tileID,n,r.collisionBoxArray)}}updateBucketOpacities(e,n,r,i){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let a=e.layers[0],o=a.layout,s=new St(null,0,!1,!1,!0),c=o.get(`text-allow-overlap`),l=o.get(`icon-allow-overlap`),u=a._unevaluatedLayout.hasValue(`text-variable-anchor`)||a._unevaluatedLayout.hasValue(`text-variable-anchor-offset`),d=o.get(`text-rotation-alignment`)===`map`,f=o.get(`text-pitch-alignment`)===`map`,p=o.get(`icon-text-fit`)!==`none`,m=new St(null,0,c&&(l||!e.hasIconData()||o.get(`icon-optional`)),l&&(c||!e.hasTextData()||o.get(`text-optional`)),!0);!e.collisionArrays&&i&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(i);let h=(e,t,n)=>{for(let r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(n);e.hasVisibleVertices||=n!==Pt},g=this.collisionBoxArrays.get(e.bucketInstanceId);for(let n=0;n<e.symbolInstances.length;n++){let i=e.symbolInstances.get(n),{numHorizontalGlyphVertices:a,numVerticalGlyphVertices:o,crossTileID:c}=i,l=this.opacities[c];r[c]?l=s:l||(l=m,this.opacities[c]=l),r[c]=!0;let _=i.numIconVertices>0,v=this.placedOrientations[i.crossTileID],y=v===t.ax.vertical,b=v===t.ax.horizontal||v===t.ax.horizontalOnly;if(a>0||o>0){let t=Nt(l.text);h(e.text,a,y?Pt:t),h(e.text,o,b?Pt:t);let n=l.text.isHidden(),r=[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex];for(let t of r)t>=0&&(e.text.placedSymbolArray.get(t).hidden=n||y?1:0);i.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).hidden=n||b?1:0);let s=this.variableOffsets[i.crossTileID];s&&this.markUsedJustification(e,s.anchor,i,v);let c=this.placedOrientations[i.crossTileID];c&&(this.markUsedJustification(e,`left`,i,c),this.markUsedOrientation(e,c,i))}if(_){let t=Nt(l.icon),n=!(p&&i.verticalPlacedIconSymbolIndex&&y);i.placedIconSymbolIndex>=0&&(h(e.icon,i.numIconVertices,n?t:Pt),e.icon.placedSymbolArray.get(i.placedIconSymbolIndex).hidden=l.icon.isHidden()),i.verticalPlacedIconSymbolIndex>=0&&(h(e.icon,i.numVerticalIconVertices,n?Pt:t),e.icon.placedSymbolArray.get(i.verticalPlacedIconSymbolIndex).hidden=l.icon.isHidden())}let x=g?.has(n)?g.get(n):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let r=e.collisionArrays[n];if(r){let n=new t.P(0,0);if(r.textBox||r.verticalTextBox){let t=!0;if(u){let e=this.variableOffsets[c];e?(n=Et(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),d&&n._rotate(f?-this.transform.bearingInRadians:this.transform.bearingInRadians)):t=!1}if(r.textBox||r.verticalTextBox){let i;r.textBox&&(i=y),r.verticalTextBox&&(i=b),Ot(e.textCollisionBox.collisionVertexArray,l.text.placed,!t||i,x.text,n.x,n.y)}}if(r.iconBox||r.verticalIconBox){let t=!!(!b&&r.verticalIconBox),i;r.iconBox&&(i=t),r.verticalIconBox&&(i=!t),Ot(e.iconCollisionBox.collisionVertexArray,l.icon.placed,i,x.icon,p?n.x:0,p?n.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let n=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*n>e}setStale(){this.stale=!0}}function Ot(e,t,n,r,i,a){r&&r.length!==0||(r=[0,0,0,0]);let o=r[0]-100,s=r[1]-100,c=r[2]-100,l=r[3]-100;e.emplaceBack(+!!t,+!!n,i||0,a||0,o,s),e.emplaceBack(+!!t,+!!n,i||0,a||0,c,s),e.emplaceBack(+!!t,+!!n,i||0,a||0,c,l),e.emplaceBack(+!!t,+!!n,i||0,a||0,o,l)}let kt=2**25,At=2**24,jt=2**17,Mt=2**16;function Nt(e){if(e.opacity===0&&!e.placed)return 0;if(e.opacity===1&&e.placed)return 4294967295;let t=+!!e.placed,n=Math.floor(127*e.opacity);return n*kt+t*At+n*jt+t*Mt+n*512+t*256+n*2+t}let Pt=0;class Ft{constructor(e){this._sortAcrossTiles=e.layout.get(`symbol-z-order`)!==`viewport-y`&&!e.layout.get(`symbol-sort-key`).isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,n,r,i){let a=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(a,r,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,i())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort(((e,t)=>e.sortKey-t.sortKey)));this._currentPartIndex<a.length;)if(t.placeLayerBucketPart(a[this._currentPartIndex],this._seenCrossTileIDs,n),this._currentPartIndex++,i())return!0;return!1}}class It{constructor(e,t,n,r,i,a,o,s){this.placement=new Dt(e,t,a,o,s),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=i,this._done=!1}isDone(){return this._done}continuePlacement(e,n,r){let i=l(),a=()=>!this._forceFullPlacement&&l()-i>2;for(;this._currentPlacementIndex>=0;){let i=n[e[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if(t.aQ(i)&&i.layout&&(!i.minzoom||i.minzoom<=o)&&(!i.maxzoom||i.maxzoom>o)){if(this._inProgressLayer||=new Ft(i),this._inProgressLayer.continuePlacement(r[i.source],this.placement,this._showCollisionBoxes,i,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let Lt=512/t.a6/2;class Rt{constructor(e,n,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};let i=new Map;for(let e=0;e<n.length;e++){let t=n.get(e),r=t.key,a=i.get(r);a?a.push(t):i.set(r,[t])}for(let[e,n]of i){let r={positions:n.map((e=>({x:Math.floor(e.anchorX*Lt),y:Math.floor(e.anchorY*Lt)}))),crossTileIDs:n.map((e=>e.crossTileID))};if(r.positions.length>128){let e=new t.aR(r.positions.length,16,Uint16Array);for(let{x:t,y:n}of r.positions)e.add(t,n);e.finish(),delete r.positions,r.index=e}this._symbolsByKey[e]=r}}getScaledCoordinates(e,n){let{x:r,y:i,z:a}=this.tileID.canonical,{x:o,y:s,z:c}=n.canonical,l=Lt/2**(c-a),u=(s*t.a6+e.anchorY)*l,d=i*t.a6*Lt;return{x:Math.floor((o*t.a6+e.anchorX)*l-r*t.a6*Lt),y:Math.floor(u-d)}}findMatches(e,t,n){let r=this.tileID.canonical.z<t.canonical.z?1:2**(this.tileID.canonical.z-t.canonical.z);for(let i=0;i<e.length;i++){let a=e.get(i);if(a.crossTileID)continue;let o=this._symbolsByKey[a.key];if(!o)continue;let s=this.getScaledCoordinates(a,t);if(o.index){let e=o.index.range(s.x-r,s.y-r,s.x+r,s.y+r).sort();for(let t of e){let e=o.crossTileIDs[t];if(!n[e]){n[e]=!0,a.crossTileID=e;break}}}else if(o.positions)for(let e=0;e<o.positions.length;e++){let t=o.positions[e],i=o.crossTileIDs[e];if(Math.abs(t.x-s.x)<=r&&Math.abs(t.y-s.y)<=r&&!n[i]){n[i]=!0,a.crossTileID=i;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:e})=>e))}}class zt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class V{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(t!==0)for(let e in this.indexes){let n=this.indexes[e],r={};for(let e in n){let i=n[e];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+t),r[i.tileID.key]=i}this.indexes[e]=r}this.lng=e}addBucket(e,t,n){var r,i;if(this.indexes[e.overscaledZ]?.[e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++)t.symbolInstances.get(e).crossTileID=0;(r=this.usedCrossTileIDs)[i=e.overscaledZ]||(r[i]={});let a=this.usedCrossTileIDs[e.overscaledZ];for(let n in this.indexes){let r=this.indexes[n];if(Number(n)>e.overscaledZ)for(let n in r){let i=r[n];i.tileID.isChildOf(e)&&i.findMatches(t.symbolInstances,e,a)}else{let i=r[e.scaledTo(Number(n)).key];i&&i.findMatches(t.symbolInstances,e,a)}}for(let e=0;e<t.symbolInstances.length;e++){let r=t.symbolInstances.get(e);r.crossTileID||(r.crossTileID=n.generate(),a[r.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Rt(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let n of t.getCrossTileIDsLists())for(let t of n)delete this.usedCrossTileIDs[e][t]}removeStaleBuckets(e){let t=!1;for(let n in this.indexes){let r=this.indexes[n];for(let i in r)e[r[i].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,r[i]),delete r[i],t=!0)}return t}}class Bt{constructor(){this.layerIndexes={},this.crossTileIDs=new zt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,n){let r=this.layerIndexes[e.id];r===void 0&&(r=this.layerIndexes[e.id]=new V);let i=!1,a={};r.handleWrapJump(n);for(let n of t){let t=n.getBucket(e);e.id===t?.layerIds[0]&&(t.bucketInstanceId||=(this.maxBucketInstanceId+=1,this.maxBucketInstanceId),r.addBucket(n.tileID,t,this.crossTileIDs)&&(i=!0),a[t.bucketInstanceId]=!0)}return r.removeStaleBuckets(a)&&(i=!0),i}pruneUnusedLayers(e){let t={};for(let n of e)t[n]=!0;for(let e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}var Vt=`void main() {fragColor=vec4(1.0);}`;let Ht={prelude:H(`#ifdef GL_ES
2
2
  precision mediump float;
3
3
  #else
4
4
  #if !defined(lowp)