@ifc-lite/viewer 1.22.0 → 1.22.1

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 (564) hide show
  1. package/.turbo/turbo-build.log +71 -44
  2. package/CHANGELOG.md +23 -0
  3. package/dist/assets/__vite-browser-external-B1O5LaIO.js +1 -0
  4. package/dist/assets/{arrow-fie-E7fe.js → arrow-CXWhTnNT.js} +1 -1
  5. package/dist/assets/{basketViewActivator-EHAhHlwN.js → basketViewActivator--cFpU2Q9.js} +10 -10
  6. package/dist/assets/{bcf-Bhx-K17f.js → bcf-Ba2CjHib.js} +2 -2
  7. package/dist/assets/browser-DXS29_v9.js +695 -0
  8. package/dist/assets/{cesium-B4ZIU9jS.js → cesium-BoVuJvTC.js} +5838 -5730
  9. package/dist/assets/{decode-worker-CYqSjk1n.js → decode-worker-CgM1iNSK.js} +1 -1
  10. package/dist/assets/deflate-DCLbV4UE.js +1 -0
  11. package/dist/assets/{drawing-2d-Bjy8YPrg.js → drawing-2d-C71b8Ugx.js} +1 -1
  12. package/dist/assets/emscripten-module-B1g2L2eS.wasm +0 -0
  13. package/dist/assets/emscripten-module-DHbYPfAp.wasm +0 -0
  14. package/dist/assets/emscripten-module-ZrHFMo7O.wasm +0 -0
  15. package/dist/assets/emscripten-module-uFzwHH0Y.wasm +0 -0
  16. package/dist/assets/emscripten-module.browser-BLJD5hhE.js +1 -0
  17. package/dist/assets/{esbuild-Cpd5nU_H.wasm → esbuild-CzsZLPr0.wasm} +0 -0
  18. package/dist/assets/esbuild-FgU11_Eg.js +1 -0
  19. package/dist/assets/event-B0kAzHa-.js +1 -0
  20. package/dist/assets/{exporters-KTio0Tdm.js → exporters-Bf6PTtdW.js} +1011 -1011
  21. package/dist/assets/ffi-Boa1QuFa.js +1 -0
  22. package/dist/assets/{geometry-controller.worker-Cm2P_EJr.js → geometry-controller.worker-CEr00X3X.js} +2 -2
  23. package/dist/assets/{geometry.worker-DchLBqZ8.js → geometry.worker-B4VPDkmL.js} +1 -1
  24. package/dist/assets/geotiff-BN4J8Vt9.js +3354 -0
  25. package/dist/assets/{ids-CS7VCFin.js → ids-XwxE1tK3.js} +6 -6
  26. package/dist/assets/{ifc-lite-C6wEhXa6.js → ifc-lite-DNzkEkIb.js} +2 -2
  27. package/dist/assets/ifc-lite_bg-1IiJN0Zg.wasm +0 -0
  28. package/dist/assets/ifc-lite_bg-B_eUD1Wy.wasm +0 -0
  29. package/dist/assets/index-DMho-JA0.js +6 -0
  30. package/dist/assets/index-DS_xJQfP.css +1 -0
  31. package/dist/assets/{index-8k9h-ANq.js → index-j2x5R7fb.js} +66047 -55202
  32. package/dist/assets/jpeg-BUTmr0Bp.js +1 -0
  33. package/dist/assets/{laz-perf-DnSyzVYH.wasm → laz-perf-CFJp03W6.wasm} +0 -0
  34. package/dist/assets/laz-perf-DgUOSLeU.js +1 -0
  35. package/dist/assets/{laz-source-jj3xI5Y4.js → laz-source-BWjza0Iw.js} +2 -2
  36. package/dist/assets/{lens-CSASnhAL.js → lens-CpjUdqpw.js} +1 -1
  37. package/dist/assets/lerc-DmzRHXn3.js +1 -0
  38. package/dist/assets/lzw-CgyIIzii.js +1 -0
  39. package/dist/assets/maplibre-gl-Do6O5tDc.js +800 -0
  40. package/dist/assets/{native-bridge-DNrEhx2R.js → native-bridge-Q5ACp4QY.js} +3 -3
  41. package/dist/assets/packbits-C1r4AzHj.js +1 -0
  42. package/dist/assets/pako.esm-Cram60i4.js +1 -0
  43. package/dist/assets/parquet_wasm_bg-DcKVfvto.wasm +0 -0
  44. package/dist/assets/{parser.worker-BcjkIo89.js → parser.worker-Cl6XQcXA.js} +2 -2
  45. package/dist/assets/raw-ZqLh7kVQ.js +1 -0
  46. package/dist/assets/{sandbox-BSn5MyEJ.js → sandbox-Bju6ZKJK.js} +1664 -1542
  47. package/dist/assets/{server-client-D-kU2XAF.js → server-client-B8wi3CGx.js} +4 -4
  48. package/dist/assets/three-CQBzFWY2.js +4104 -0
  49. package/dist/assets/wasm-bridge-X-mWRA9Z.js +1 -0
  50. package/dist/assets/webimage-D0MbRMkU.js +1 -0
  51. package/dist/assets/{workerHelpers-pUUnk9Wc.js → workerHelpers-DnNedVRr.js} +1 -1
  52. package/dist/assets/zstd-DA4VQ-ji.js +1 -0
  53. package/dist/cesium/{Workers/chunk-V7QEYVP3.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-236YIEYT.js} +2 -2
  54. package/dist/cesium/{Workers/chunk-5TJMAQVL.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-2ZYB3DYT.js} +2 -2
  55. package/dist/cesium/{Workers/chunk-UBOGZS7F.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-4M56RRIL.js} +2 -2
  56. package/dist/cesium/{Workers/chunk-OCWJRAXS.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-5BC2Q3QW.js} +2 -2
  57. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-5XHUDY37.js +26 -0
  58. package/dist/cesium/{Workers/chunk-Z3QF2EHT.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-6WMLAJJP.js} +2 -2
  59. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-72KUXMWU.js +26 -0
  60. package/dist/cesium/{Workers/chunk-EQ4YRVWL.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-7NQYTTAU.js} +2 -2
  61. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-A35GG5WJ.js +26 -0
  62. package/dist/cesium/{Workers/chunk-FC4ZZ65J.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-AXNBHUAG.js} +2 -2
  63. package/dist/cesium/{Workers/chunk-BTSYJ5XU.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-DC3K7YTH.js} +2 -2
  64. package/dist/cesium/{Workers/chunk-SLT4J352.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-DRBPXGI7.js} +2 -2
  65. package/dist/cesium/{Workers/chunk-2MJIIVP4.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-EARRZPMO.js} +2 -2
  66. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-EHC3BDVP.js +26 -0
  67. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-EYZUSGKM.js +26 -0
  68. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-EZSKHVA2.js +26 -0
  69. package/dist/cesium/{Workers/chunk-ICALLYLG.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-F3WJIFOO.js} +2 -2
  70. package/dist/cesium/{Workers/chunk-LSLE2RL4.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-FB7UV5BI.js} +2 -2
  71. package/dist/cesium/{Workers/chunk-CUUSNIVQ.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-FC6IYMYF.js} +2 -2
  72. package/dist/cesium/{Workers/chunk-TNSUQXWK.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-GF67PEXE.js} +2 -2
  73. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-GXEQRH2R.js +26 -0
  74. package/dist/cesium/{Workers/chunk-M4HLDBCG.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-I5NKQIWE.js} +2 -2
  75. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-IH7GXIUB.js +26 -0
  76. package/dist/cesium/{Workers/chunk-OIT7J4IC.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-IPP3UFGH.js} +2 -2
  77. package/dist/cesium/{Workers/chunk-WWWZVEEH.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-IYRGNBSH.js} +2 -2
  78. package/dist/cesium/{Workers/chunk-WPMZLB3Y.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-J6BM74AD.js} +2 -2
  79. package/dist/cesium/{Workers/chunk-QFM5DCMQ.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-KG2GJUJT.js} +1 -1
  80. package/dist/cesium/{Workers/chunk-XQHLGIO7.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-L7UE5MMF.js} +2 -2
  81. package/dist/cesium/{Workers/chunk-EFBN7QNX.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-LBZ34MHQ.js} +2 -2
  82. package/dist/cesium/{Workers/chunk-YP7I5QBZ.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-LOQDTQMX.js} +2 -2
  83. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-LYLRYC4L.js +29 -0
  84. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-MGPRMLLW.js +26 -0
  85. package/dist/cesium/{Workers/chunk-LI2ZSORM.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-NP26LKQA.js} +2 -2
  86. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-OMUAZ3NM.js +26 -0
  87. package/dist/cesium/{Workers/chunk-S44JILQT.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-PPFUDJN4.js} +2 -2
  88. package/dist/cesium/{Workers/chunk-EDVBB7SS.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-PQ3V63XF.js} +2 -2
  89. package/dist/cesium/{Workers/chunk-Q5BPHJQF.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-PWBQN4GK.js} +2 -2
  90. package/dist/cesium/{Workers/chunk-E7KYDCM5.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-QOTMLO2T.js} +2 -2
  91. package/dist/cesium/{Workers/chunk-XUSCFAVF.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-SP35IT73.js} +2 -2
  92. package/dist/cesium/{Workers/chunk-6BD4U3VO.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-T3ZGSZKA.js} +2 -2
  93. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-TM6SYYHO.js +28 -0
  94. package/dist/cesium/{Workers/chunk-VUKYSU4H.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-TSGIJVWH.js} +2 -2
  95. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-U3YGOX3C.js +63 -0
  96. package/dist/cesium/{Workers/chunk-7TVGLKQF.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-VBYOXOSM.js} +2 -2
  97. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-VCOHJNKB.js +26 -0
  98. package/dist/cesium/{Workers/chunk-WBOV35NL.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-VXAZXMUX.js} +2 -2
  99. package/dist/cesium/{Workers/chunk-IX4VMHEV.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-VXCJOT4W.js} +2 -2
  100. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-WPD3MB6X.js +26 -0
  101. package/dist/cesium/{Workers/chunk-V3OSTMM6.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-X4D5KUN5.js} +2 -2
  102. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-XEC656IT.js +26 -0
  103. package/dist/cesium/{Workers/chunk-MJHHSGEH.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-XR53QRQS.js} +2 -2
  104. package/dist/cesium/{Workers/chunk-XFIQ5DEQ.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-XR7MN4PJ.js} +2 -2
  105. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-XU6O4MRS.js +26 -0
  106. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-XZBHEBLF.js +29 -0
  107. package/dist/cesium/{Workers/chunk-OLZ3FYUM.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-Z2M4BF4E.js} +2 -2
  108. package/dist/cesium/{Workers/chunk-2ZBHLJST.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-Z4ERBZFB.js} +2 -2
  109. package/dist/cesium/{Workers/chunk-W37FE5GR.js → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/chunk-ZY2KCIWI.js} +2 -2
  110. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/combineGeometry.js +2 -2
  111. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createBoxGeometry.js +2 -2
  112. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createBoxOutlineGeometry.js +2 -2
  113. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createCircleGeometry.js +2 -2
  114. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createCircleOutlineGeometry.js +2 -2
  115. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createCoplanarPolygonGeometry.js +2 -2
  116. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/createCoplanarPolygonOutlineGeometry.js +26 -0
  117. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createCorridorGeometry.js +2 -2
  118. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createCorridorOutlineGeometry.js +2 -2
  119. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createCylinderGeometry.js +2 -2
  120. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createCylinderOutlineGeometry.js +2 -2
  121. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createEllipseGeometry.js +2 -2
  122. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createEllipseOutlineGeometry.js +2 -2
  123. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createEllipsoidGeometry.js +2 -2
  124. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createEllipsoidOutlineGeometry.js +2 -2
  125. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createFrustumGeometry.js +2 -2
  126. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createFrustumOutlineGeometry.js +2 -2
  127. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createGeometry.js +2 -2
  128. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/createGroundPolylineGeometry.js +26 -0
  129. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createPlaneGeometry.js +2 -2
  130. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createPlaneOutlineGeometry.js +2 -2
  131. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createPolygonGeometry.js +2 -2
  132. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createPolygonOutlineGeometry.js +2 -2
  133. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createPolylineGeometry.js +2 -2
  134. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createPolylineVolumeGeometry.js +2 -2
  135. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createPolylineVolumeOutlineGeometry.js +2 -2
  136. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createRectangleGeometry.js +2 -2
  137. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createRectangleOutlineGeometry.js +2 -2
  138. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createSimplePolylineGeometry.js +2 -2
  139. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createSphereGeometry.js +2 -2
  140. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createSphereOutlineGeometry.js +2 -2
  141. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createTaskProcessorWorker.js +2 -2
  142. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createVectorTileClampedPolylines.js +2 -2
  143. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createVectorTileGeometries.js +2 -2
  144. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createVectorTilePoints.js +2 -2
  145. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createVectorTilePolygons.js +2 -2
  146. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createVectorTilePolylines.js +2 -2
  147. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createVerticesFromCesium3DTilesTerrain.js +2 -2
  148. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createVerticesFromGoogleEarthEnterpriseBuffer.js +2 -2
  149. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createVerticesFromHeightmap.js +2 -2
  150. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createVerticesFromQuantizedTerrainMesh.js +2 -2
  151. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createWallGeometry.js +2 -2
  152. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/createWallOutlineGeometry.js +2 -2
  153. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/decodeDraco.js +2 -2
  154. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/decodeGoogleEarthEnterprisePacket.js +2 -2
  155. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/decodeI3S.js +2 -2
  156. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/gaussianSplatSorter.js +2 -2
  157. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/gaussianSplatTextureGenerator.js +2 -2
  158. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/incrementallyBuildTerrainPicker.js +2 -2
  159. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/transcodeKTX2.js +56 -0
  160. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/transferTypedArrayTest.js +1 -1
  161. package/dist/cesium/node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers/upsampleQuantizedTerrainMesh.js +26 -0
  162. package/dist/cesium/{Workers → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Workers}/upsampleVerticesFromCesium3DTilesTerrain.js +2 -2
  163. package/dist/index.html +11 -11
  164. package/package.json +52 -45
  165. package/src/components/mcp/McpLanding.tsx +1 -1
  166. package/src/components/mcp/McpPlayground.tsx +1 -1
  167. package/src/components/viewer/AddElementPanel.tsx +2 -2
  168. package/src/components/viewer/BasepointOverlay.tsx +239 -0
  169. package/src/components/viewer/CesiumOverlay.tsx +15 -59
  170. package/src/components/viewer/CesiumPlacementEditor.tsx +16 -1
  171. package/src/components/viewer/CommandPalette.tsx +25 -0
  172. package/src/components/viewer/GeometryAxisRow.tsx +54 -0
  173. package/src/components/viewer/GeometryEditCard.tsx +392 -0
  174. package/src/components/viewer/HierarchyPanel.tsx +2 -2
  175. package/src/components/viewer/IDSAuditSummary.tsx +2 -2
  176. package/src/components/viewer/KeyboardShortcutsDialog.tsx +58 -4
  177. package/src/components/viewer/MainToolbar.tsx +275 -4
  178. package/src/components/viewer/PropertiesPanel.tsx +28 -31
  179. package/src/components/viewer/StatusBar.tsx +12 -0
  180. package/src/components/viewer/ToolOverlays.tsx +36 -0
  181. package/src/components/viewer/ViewerLayout.tsx +27 -0
  182. package/src/components/viewer/Viewport.tsx +49 -4
  183. package/src/components/viewer/ViewportContainer.tsx +88 -17
  184. package/src/components/viewer/ViewportOverlays.tsx +50 -11
  185. package/src/components/viewer/chat/ByokKeyModal.tsx +1 -1
  186. package/src/components/viewer/properties/FederationAlignmentControls.tsx +180 -0
  187. package/src/components/viewer/properties/GeoreferencingPanel.tsx +6 -0
  188. package/src/components/viewer/properties/PrecisionGridBadge.tsx +125 -0
  189. package/src/components/viewer/properties/raw-step-format.ts +5 -3
  190. package/src/components/viewer/selectionHandlers.ts +301 -10
  191. package/src/components/viewer/tools/GizmoOverlay.tsx +322 -0
  192. package/src/components/viewer/tools/SplitNumericInput.tsx +225 -0
  193. package/src/components/viewer/tools/SplitOverlay.tsx +242 -0
  194. package/src/components/viewer/tools/WallEndpointOverlay.tsx +252 -0
  195. package/src/components/viewer/useGeometryStreaming.ts +100 -1
  196. package/src/components/viewer/useMouseControls.ts +8 -1
  197. package/src/hooks/useBCF.ts +6 -6
  198. package/src/hooks/useCameraTickSubscription.ts +62 -0
  199. package/src/hooks/useIfc.ts +4 -0
  200. package/src/hooks/useIfcFederation.ts +368 -20
  201. package/src/hooks/useKeyboardShortcuts.ts +86 -0
  202. package/src/hooks/useLevelDisplayEffect.ts +160 -0
  203. package/src/hooks/useViewerSelectors.ts +8 -0
  204. package/src/lib/__test__/stubs.ts +110 -0
  205. package/src/lib/geo/cesium-bridge.ts +3 -3
  206. package/src/lib/geo/cesium-placement.test.ts +28 -12
  207. package/src/lib/geo/cesium-placement.ts +16 -10
  208. package/src/lib/geo/effective-georef.test.ts +23 -7
  209. package/src/lib/geo/geo-scale.ts +58 -2
  210. package/src/lib/geo/ifc-origin.test.ts +176 -0
  211. package/src/lib/geo/ifc-origin.ts +144 -0
  212. package/src/lib/geo/precision-grids.ts +444 -0
  213. package/src/lib/geo/reproject.test.ts +88 -0
  214. package/src/lib/geo/reproject.ts +168 -36
  215. package/src/lib/level-offsets.test.ts +153 -0
  216. package/src/lib/level-offsets.ts +140 -0
  217. package/src/lib/linear-element-edit.test.ts +220 -0
  218. package/src/lib/linear-element-edit.ts +327 -0
  219. package/src/lib/metadata-clone.test.ts +173 -0
  220. package/src/lib/metadata-clone.ts +124 -0
  221. package/src/lib/placement-core.ts +340 -0
  222. package/src/lib/placement-edit.boot.ts +21 -0
  223. package/src/lib/placement-edit.test.ts +464 -0
  224. package/src/lib/placement-edit.ts +47 -0
  225. package/src/lib/polygon-clip.test.ts +193 -0
  226. package/src/lib/polygon-clip.ts +199 -0
  227. package/src/lib/slab-edit.test.ts +169 -0
  228. package/src/lib/slab-edit.ts +312 -0
  229. package/src/lib/wall-edit.ts +342 -0
  230. package/src/lib/wall-opening-reassign.test.ts +291 -0
  231. package/src/lib/wall-opening-reassign.ts +241 -0
  232. package/src/main.tsx +4 -0
  233. package/src/store/index.ts +7 -0
  234. package/src/store/slices/cesiumSlice.ts +61 -8
  235. package/src/store/slices/dataSlice.ts +80 -0
  236. package/src/store/slices/levelDisplaySlice.ts +105 -0
  237. package/src/store/slices/modelSlice.test.ts +19 -0
  238. package/src/store/slices/mutationSlice.ts +1138 -1
  239. package/src/store/slices/splitToolSlice.ts +165 -0
  240. package/src/store/slices/uiSlice.edit-mode.test.ts +210 -0
  241. package/src/store/slices/uiSlice.ts +78 -1
  242. package/src/store/types.ts +57 -2
  243. package/src/utils/createBlankIfc.ts +37 -0
  244. package/tsconfig.json +1 -0
  245. package/.turbo/turbo-typecheck.log +0 -4
  246. package/dist/assets/arrow2_bg-BoXCojjR.wasm +0 -0
  247. package/dist/assets/browser-CVf8ATeW.js +0 -694
  248. package/dist/assets/emscripten-module-BTRCZGcB.wasm +0 -0
  249. package/dist/assets/emscripten-module-CGIn_cMh.wasm +0 -0
  250. package/dist/assets/emscripten-module-DYvzWiHh.wasm +0 -0
  251. package/dist/assets/emscripten-module-NWak2PoB.wasm +0 -0
  252. package/dist/assets/emscripten-module.browser-DcFZLAUx.js +0 -1
  253. package/dist/assets/esbuild-COv63sf-.js +0 -1
  254. package/dist/assets/event-DIOks52T.js +0 -1
  255. package/dist/assets/ffi-DlhRHxHv.js +0 -1
  256. package/dist/assets/ifc-lite_bg-CSeT3fNI.wasm +0 -0
  257. package/dist/assets/ifc-lite_bg-ns4cSnX2.wasm +0 -0
  258. package/dist/assets/index-BZC2YaOP.css +0 -1
  259. package/dist/assets/index-HqAIQkr6.js +0 -22
  260. package/dist/assets/laz-perf-Cvr_Lepg.js +0 -1
  261. package/dist/assets/maplibre-gl-C4LXKM6c.js +0 -808
  262. package/dist/assets/three-DwNDHx9-.js +0 -4049
  263. package/dist/assets/wasm-bridge-Cha08LdC.js +0 -1
  264. package/dist/cesium/Workers/chunk-23ZQ2IVV.js +0 -29
  265. package/dist/cesium/Workers/chunk-2EQO3Q56.js +0 -26
  266. package/dist/cesium/Workers/chunk-2TE5NTVD.js +0 -26
  267. package/dist/cesium/Workers/chunk-BXMEEOCS.js +0 -63
  268. package/dist/cesium/Workers/chunk-BYLCY7GP.js +0 -29
  269. package/dist/cesium/Workers/chunk-CTHM3W6I.js +0 -26
  270. package/dist/cesium/Workers/chunk-E3JOOS3S.js +0 -26
  271. package/dist/cesium/Workers/chunk-F6PRE7D6.js +0 -26
  272. package/dist/cesium/Workers/chunk-FFBVWF2L.js +0 -26
  273. package/dist/cesium/Workers/chunk-GBAA6GVX.js +0 -26
  274. package/dist/cesium/Workers/chunk-ILRYTWTP.js +0 -26
  275. package/dist/cesium/Workers/chunk-IRNLBSEJ.js +0 -26
  276. package/dist/cesium/Workers/chunk-L6QHHACZ.js +0 -26
  277. package/dist/cesium/Workers/chunk-NMVKML6W.js +0 -26
  278. package/dist/cesium/Workers/chunk-OIRKANTH.js +0 -26
  279. package/dist/cesium/Workers/chunk-QKUIYMGC.js +0 -28
  280. package/dist/cesium/Workers/chunk-SQMIIXB7.js +0 -26
  281. package/dist/cesium/Workers/chunk-TJ4XLGBQ.js +0 -26
  282. package/dist/cesium/Workers/createCoplanarPolygonOutlineGeometry.js +0 -26
  283. package/dist/cesium/Workers/createGroundPolylineGeometry.js +0 -26
  284. package/dist/cesium/Workers/transcodeKTX2.js +0 -56
  285. package/dist/cesium/Workers/upsampleQuantizedTerrainMesh.js +0 -26
  286. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_0.json +0 -0
  287. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_1.json +0 -0
  288. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_10.json +0 -0
  289. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_11.json +0 -0
  290. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_12.json +0 -0
  291. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_13.json +0 -0
  292. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_14.json +0 -0
  293. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_15.json +0 -0
  294. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_16.json +0 -0
  295. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_17.json +0 -0
  296. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_18.json +0 -0
  297. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_19.json +0 -0
  298. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_2.json +0 -0
  299. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_20.json +0 -0
  300. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_21.json +0 -0
  301. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_22.json +0 -0
  302. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_23.json +0 -0
  303. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_24.json +0 -0
  304. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_25.json +0 -0
  305. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_26.json +0 -0
  306. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_27.json +0 -0
  307. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_3.json +0 -0
  308. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_4.json +0 -0
  309. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_5.json +0 -0
  310. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_6.json +0 -0
  311. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_7.json +0 -0
  312. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_8.json +0 -0
  313. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/IAU2006_XYS/IAU2006_XYS_9.json +0 -0
  314. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Images/bing_maps_credit.png +0 -0
  315. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Images/cesium_credit.png +0 -0
  316. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Images/google_earth_credit.png +0 -0
  317. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Images/ion-credit.png +0 -0
  318. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/LensFlare/DirtMask.jpg +0 -0
  319. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/LensFlare/StarBurst.jpg +0 -0
  320. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/0/0/0.jpg +0 -0
  321. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/0/1/0.jpg +0 -0
  322. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/1/0/0.jpg +0 -0
  323. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/1/0/1.jpg +0 -0
  324. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/1/1/0.jpg +0 -0
  325. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/1/1/1.jpg +0 -0
  326. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/1/2/0.jpg +0 -0
  327. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/1/2/1.jpg +0 -0
  328. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/1/3/0.jpg +0 -0
  329. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/1/3/1.jpg +0 -0
  330. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/0/0.jpg +0 -0
  331. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/0/1.jpg +0 -0
  332. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/0/2.jpg +0 -0
  333. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/0/3.jpg +0 -0
  334. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/1/0.jpg +0 -0
  335. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/1/1.jpg +0 -0
  336. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/1/2.jpg +0 -0
  337. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/1/3.jpg +0 -0
  338. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/2/0.jpg +0 -0
  339. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/2/1.jpg +0 -0
  340. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/2/2.jpg +0 -0
  341. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/2/3.jpg +0 -0
  342. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/3/0.jpg +0 -0
  343. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/3/1.jpg +0 -0
  344. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/3/2.jpg +0 -0
  345. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/3/3.jpg +0 -0
  346. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/4/0.jpg +0 -0
  347. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/4/1.jpg +0 -0
  348. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/4/2.jpg +0 -0
  349. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/4/3.jpg +0 -0
  350. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/5/0.jpg +0 -0
  351. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/5/1.jpg +0 -0
  352. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/5/2.jpg +0 -0
  353. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/5/3.jpg +0 -0
  354. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/6/0.jpg +0 -0
  355. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/6/1.jpg +0 -0
  356. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/6/2.jpg +0 -0
  357. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/6/3.jpg +0 -0
  358. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/7/0.jpg +0 -0
  359. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/7/1.jpg +0 -0
  360. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/7/2.jpg +0 -0
  361. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/2/7/3.jpg +0 -0
  362. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/NaturalEarthII/tilemapresource.xml +0 -0
  363. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/SkyBox/tycho2t3_80_mx.jpg +0 -0
  364. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/SkyBox/tycho2t3_80_my.jpg +0 -0
  365. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/SkyBox/tycho2t3_80_mz.jpg +0 -0
  366. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/SkyBox/tycho2t3_80_px.jpg +0 -0
  367. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/SkyBox/tycho2t3_80_py.jpg +0 -0
  368. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/SkyBox/tycho2t3_80_pz.jpg +0 -0
  369. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/airfield.png +0 -0
  370. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/airport.png +0 -0
  371. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/alcohol-shop.png +0 -0
  372. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/america-football.png +0 -0
  373. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/art-gallery.png +0 -0
  374. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/bakery.png +0 -0
  375. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/bank.png +0 -0
  376. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/bar.png +0 -0
  377. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/baseball.png +0 -0
  378. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/basketball.png +0 -0
  379. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/beer.png +0 -0
  380. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/bicycle.png +0 -0
  381. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/building.png +0 -0
  382. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/bus.png +0 -0
  383. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/cafe.png +0 -0
  384. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/camera.png +0 -0
  385. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/campsite.png +0 -0
  386. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/car.png +0 -0
  387. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/cemetery.png +0 -0
  388. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/cesium.png +0 -0
  389. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/chemist.png +0 -0
  390. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/cinema.png +0 -0
  391. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/circle-stroked.png +0 -0
  392. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/circle.png +0 -0
  393. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/city.png +0 -0
  394. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/clothing-store.png +0 -0
  395. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/college.png +0 -0
  396. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/commercial.png +0 -0
  397. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/cricket.png +0 -0
  398. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/cross.png +0 -0
  399. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/dam.png +0 -0
  400. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/danger.png +0 -0
  401. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/disability.png +0 -0
  402. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/dog-park.png +0 -0
  403. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/embassy.png +0 -0
  404. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/emergency-telephone.png +0 -0
  405. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/entrance.png +0 -0
  406. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/farm.png +0 -0
  407. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/fast-food.png +0 -0
  408. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/ferry.png +0 -0
  409. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/fire-station.png +0 -0
  410. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/fuel.png +0 -0
  411. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/garden.png +0 -0
  412. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/gift.png +0 -0
  413. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/golf.png +0 -0
  414. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/grocery.png +0 -0
  415. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/hairdresser.png +0 -0
  416. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/harbor.png +0 -0
  417. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/heart.png +0 -0
  418. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/heliport.png +0 -0
  419. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/hospital.png +0 -0
  420. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/ice-cream.png +0 -0
  421. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/industrial.png +0 -0
  422. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/land-use.png +0 -0
  423. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/laundry.png +0 -0
  424. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/library.png +0 -0
  425. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/lighthouse.png +0 -0
  426. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/lodging.png +0 -0
  427. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/logging.png +0 -0
  428. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/london-underground.png +0 -0
  429. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/marker-stroked.png +0 -0
  430. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/marker.png +0 -0
  431. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/minefield.png +0 -0
  432. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/mobilephone.png +0 -0
  433. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/monument.png +0 -0
  434. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/museum.png +0 -0
  435. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/music.png +0 -0
  436. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/oil-well.png +0 -0
  437. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/park.png +0 -0
  438. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/park2.png +0 -0
  439. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/parking-garage.png +0 -0
  440. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/parking.png +0 -0
  441. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/pharmacy.png +0 -0
  442. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/pitch.png +0 -0
  443. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/place-of-worship.png +0 -0
  444. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/playground.png +0 -0
  445. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/police.png +0 -0
  446. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/polling-place.png +0 -0
  447. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/post.png +0 -0
  448. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/prison.png +0 -0
  449. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/rail-above.png +0 -0
  450. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/rail-light.png +0 -0
  451. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/rail-metro.png +0 -0
  452. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/rail-underground.png +0 -0
  453. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/rail.png +0 -0
  454. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/religious-christian.png +0 -0
  455. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/religious-jewish.png +0 -0
  456. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/religious-muslim.png +0 -0
  457. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/restaurant.png +0 -0
  458. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/roadblock.png +0 -0
  459. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/rocket.png +0 -0
  460. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/school.png +0 -0
  461. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/scooter.png +0 -0
  462. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/shop.png +0 -0
  463. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/skiing.png +0 -0
  464. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/slaughterhouse.png +0 -0
  465. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/soccer.png +0 -0
  466. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/square-stroked.png +0 -0
  467. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/square.png +0 -0
  468. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/star-stroked.png +0 -0
  469. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/star.png +0 -0
  470. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/suitcase.png +0 -0
  471. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/swimming.png +0 -0
  472. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/telephone.png +0 -0
  473. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/tennis.png +0 -0
  474. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/theatre.png +0 -0
  475. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/toilets.png +0 -0
  476. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/town-hall.png +0 -0
  477. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/town.png +0 -0
  478. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/triangle-stroked.png +0 -0
  479. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/triangle.png +0 -0
  480. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/village.png +0 -0
  481. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/warehouse.png +0 -0
  482. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/waste-basket.png +0 -0
  483. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/water.png +0 -0
  484. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/wetland.png +0 -0
  485. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/maki/zoo.png +0 -0
  486. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/moonSmall.jpg +0 -0
  487. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/pin.svg +0 -0
  488. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/waterNormals.jpg +0 -0
  489. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/Textures/waterNormalsSmall.jpg +0 -0
  490. /package/dist/cesium/{Assets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Assets}/approximateTerrainHeights.json +0 -0
  491. /package/dist/cesium/{ThirdParty → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/ThirdParty}/Workers/package.json +0 -0
  492. /package/dist/cesium/{ThirdParty → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/ThirdParty}/Workers/zip-web-worker.js +0 -0
  493. /package/dist/cesium/{ThirdParty → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/ThirdParty}/basis_transcoder.wasm +0 -0
  494. /package/dist/cesium/{ThirdParty → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/ThirdParty}/draco_decoder.wasm +0 -0
  495. /package/dist/cesium/{ThirdParty → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/ThirdParty}/google-earth-dbroot-parser.js +0 -0
  496. /package/dist/cesium/{ThirdParty → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/ThirdParty}/wasm_splats_bg.wasm +0 -0
  497. /package/dist/cesium/{ThirdParty → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/ThirdParty}/zip-module.wasm +0 -0
  498. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Animation/Animation.css +0 -0
  499. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Animation/lighter.css +0 -0
  500. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/BaseLayerPicker/BaseLayerPicker.css +0 -0
  501. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/BaseLayerPicker/lighter.css +0 -0
  502. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Cesium3DTilesInspector/Cesium3DTilesInspector.css +0 -0
  503. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/CesiumInspector/CesiumInspector.css +0 -0
  504. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/CesiumWidget/CesiumWidget.css +0 -0
  505. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/CesiumWidget/lighter.css +0 -0
  506. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/FullscreenButton/FullscreenButton.css +0 -0
  507. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Geocoder/Geocoder.css +0 -0
  508. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Geocoder/lighter.css +0 -0
  509. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/I3SBuildingSceneLayerExplorer/I3SBuildingSceneLayerExplorer.css +0 -0
  510. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/ArcGisMapServiceWorldHillshade.png +0 -0
  511. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/ArcGisMapServiceWorldImagery.png +0 -0
  512. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/ArcGisMapServiceWorldOcean.png +0 -0
  513. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/azureAerial.png +0 -0
  514. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/azureRoads.png +0 -0
  515. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/bingAerial.png +0 -0
  516. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/bingAerialLabels.png +0 -0
  517. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/bingRoads.png +0 -0
  518. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/blueMarble.png +0 -0
  519. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/earthAtNight.png +0 -0
  520. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/googleContour.png +0 -0
  521. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/googleRoadmap.png +0 -0
  522. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/googleSatellite.png +0 -0
  523. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/googleSatelliteLabels.png +0 -0
  524. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/mapQuestOpenStreetMap.png +0 -0
  525. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/mapboxSatellite.png +0 -0
  526. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/mapboxStreets.png +0 -0
  527. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/mapboxTerrain.png +0 -0
  528. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/naturalEarthII.png +0 -0
  529. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/openStreetMap.png +0 -0
  530. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/sentinel-2.png +0 -0
  531. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/stadiaAlidadeSmooth.png +0 -0
  532. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/stadiaAlidadeSmoothDark.png +0 -0
  533. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/stamenToner.png +0 -0
  534. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/ImageryProviders/stamenWatercolor.png +0 -0
  535. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/NavigationHelp/Mouse.svg +0 -0
  536. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/NavigationHelp/MouseLeft.svg +0 -0
  537. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/NavigationHelp/MouseMiddle.svg +0 -0
  538. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/NavigationHelp/MouseRight.svg +0 -0
  539. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/NavigationHelp/Touch.svg +0 -0
  540. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/NavigationHelp/TouchDrag.svg +0 -0
  541. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/NavigationHelp/TouchRotate.svg +0 -0
  542. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/NavigationHelp/TouchTilt.svg +0 -0
  543. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/NavigationHelp/TouchZoom.svg +0 -0
  544. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/TerrainProviders/CesiumWorldTerrain.png +0 -0
  545. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/TerrainProviders/Ellipsoid.png +0 -0
  546. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/TimelineIcons.png +0 -0
  547. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Images/info-loading.gif +0 -0
  548. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/InfoBox/InfoBox.css +0 -0
  549. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/InfoBox/InfoBoxDescription.css +0 -0
  550. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/NavigationHelpButton/NavigationHelpButton.css +0 -0
  551. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/NavigationHelpButton/lighter.css +0 -0
  552. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/PerformanceWatchdog/PerformanceWatchdog.css +0 -0
  553. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/ProjectionPicker/ProjectionPicker.css +0 -0
  554. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/SceneModePicker/SceneModePicker.css +0 -0
  555. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/SelectionIndicator/SelectionIndicator.css +0 -0
  556. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Timeline/Timeline.css +0 -0
  557. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Timeline/lighter.css +0 -0
  558. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/VRButton/VRButton.css +0 -0
  559. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/Viewer/Viewer.css +0 -0
  560. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/VoxelInspector/VoxelInspector.css +0 -0
  561. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/lighter.css +0 -0
  562. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/lighterShared.css +0 -0
  563. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/shared.css +0 -0
  564. /package/dist/cesium/{Widgets → node_modules/.pnpm/cesium@1.141.0/node_modules/cesium/Build/Cesium/Widgets}/widgets.css +0 -0
@@ -1,808 +0,0 @@
1
- import{g as B_}from"./zip-BJqVbRkU.js";function O_(bo,Mu){for(var $r=0;$r<Mu.length;$r++){const Wi=Mu[$r];if(typeof Wi!="string"&&!Array.isArray(Wi)){for(const Zr in Wi)if(Zr!=="default"&&!(Zr in bo)){const wo=Object.getOwnPropertyDescriptor(Wi,Zr);wo&&Object.defineProperty(bo,Zr,wo.get?wo:{enumerable:!0,get:()=>Wi[Zr]})}}}return Object.freeze(Object.defineProperty(bo,Symbol.toStringTag,{value:"Module"}))}var Iu={exports:{}};var V_=Iu.exports,Nf;function j_(){return Nf||(Nf=1,(function(bo,Mu){(function($r,Wi){bo.exports=Wi()})(V_,(function(){var $r={},Wi={};function Zr(R,d,we){if(Wi[R]=we,R==="index"){var Tr="var sharedModule = {}; ("+Wi.shared+")(sharedModule); ("+Wi.worker+")(sharedModule);",wi={};return Wi.shared(wi),Wi.index($r,wi),typeof window<"u"&&$r.setWorkerUrl(window.URL.createObjectURL(new Blob([Tr],{type:"text/javascript"}))),$r}}Zr("shared",["exports"],(function(R){function d(r,e,i,s){return new(i||(i=Promise))((function(a,l){function u(m){try{g(s.next(m))}catch(x){l(x)}}function h(m){try{g(s.throw(m))}catch(x){l(x)}}function g(m){var x;m.done?a(m.value):(x=m.value,x instanceof i?x:new i((function(_){_(x)}))).then(u,h)}g((s=s.apply(r,e||[])).next())}))}function we(r,e){this.x=r,this.y=e}function Tr(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var wi,qr;typeof SuppressedError=="function"&&SuppressedError,we.prototype={clone(){return new we(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)},rotateAround(r,e){return this.clone()._rotateAround(r,e)},matMult(r){return this.clone()._matMult(r)},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(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){const e=r.x-this.x,i=r.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult(r){const e=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=e,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){const r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){const e=Math.cos(r),i=Math.sin(r),s=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=s,this},_rotateAround(r,e){const i=Math.cos(r),s=Math.sin(r),a=e.y+s*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-s*(this.y-e.y),this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:we},we.convert=function(r){if(r instanceof we)return r;if(Array.isArray(r))return new we(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new we(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};var as=(function(){if(qr)return wi;function r(e,i,s,a){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=s,this.p2y=a}return qr=1,wi=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,a=0;a<8;a++){var l=this.sampleCurveX(s)-e;if(Math.abs(l)<i)return s;var u=this.sampleCurveDerivativeX(s);if(Math.abs(u)<1e-6)break;s-=l/u}var h=0,g=1;for(s=e,a=0;a<20&&(l=this.sampleCurveX(s),!(Math.abs(l-e)<i));a++)e>l?h=s:g=s,s=.5*(g-h)+h;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},wi})(),Kt=Tr(as);let Sr,Ze;function ge(){return Sr==null&&(Sr=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Sr}function Ti(){if(Ze==null&&(Ze=!1,ge())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let s=0;s<25;s++){const a=4*s;e.fillStyle=`rgb(${a},${a+1},${a+2})`,e.fillRect(s%5,Math.floor(s/5),1,1)}const i=e.getImageData(0,0,5,5).data;for(let s=0;s<100;s++)if(s%4!=3&&i[s]!==s){Ze=!0;break}}}return Ze||!1}var Bt=1e-6,It=typeof Float32Array<"u"?Float32Array:Array;function os(){var r=new It(9);return It!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function Tn(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function ls(){var r=new It(3);return It!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function We(r){var e=r[0],i=r[1],s=r[2];return Math.sqrt(e*e+i*i+s*s)}function X(r,e,i){var s=new It(3);return s[0]=r,s[1]=e,s[2]=i,s}function K(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function te(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function _e(r,e,i){var s=e[0],a=e[1],l=e[2],u=i[0],h=i[1],g=i[2];return r[0]=a*g-l*h,r[1]=l*u-s*g,r[2]=s*h-a*u,r}var Ee,Ye=We;function ze(r,e,i){var s=e[0],a=e[1],l=e[2],u=e[3];return r[0]=i[0]*s+i[4]*a+i[8]*l+i[12]*u,r[1]=i[1]*s+i[5]*a+i[9]*l+i[13]*u,r[2]=i[2]*s+i[6]*a+i[10]*l+i[14]*u,r[3]=i[3]*s+i[7]*a+i[11]*l+i[15]*u,r}function Ge(){var r=new It(4);return It!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Le(r,e,i,s){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",l=Math.PI/360;e*=l,s*=l,i*=l;var u=Math.sin(e),h=Math.cos(e),g=Math.sin(i),m=Math.cos(i),x=Math.sin(s),_=Math.cos(s);switch(a){case"xyz":r[0]=u*m*_+h*g*x,r[1]=h*g*_-u*m*x,r[2]=h*m*x+u*g*_,r[3]=h*m*_-u*g*x;break;case"xzy":r[0]=u*m*_-h*g*x,r[1]=h*g*_-u*m*x,r[2]=h*m*x+u*g*_,r[3]=h*m*_+u*g*x;break;case"yxz":r[0]=u*m*_+h*g*x,r[1]=h*g*_-u*m*x,r[2]=h*m*x-u*g*_,r[3]=h*m*_+u*g*x;break;case"yzx":r[0]=u*m*_+h*g*x,r[1]=h*g*_+u*m*x,r[2]=h*m*x-u*g*_,r[3]=h*m*_-u*g*x;break;case"zxy":r[0]=u*m*_-h*g*x,r[1]=h*g*_+u*m*x,r[2]=h*m*x+u*g*_,r[3]=h*m*_-u*g*x;break;case"zyx":r[0]=u*m*_-h*g*x,r[1]=h*g*_+u*m*x,r[2]=h*m*x-u*g*_,r[3]=h*m*_+u*g*x;break;default:throw new Error("Unknown angle order "+a)}return r}function Ke(){var r=new It(2);return It!=Float32Array&&(r[0]=0,r[1]=0),r}function Xe(r,e){var i=new It(2);return i[0]=r,i[1]=e,i}ls(),Ee=new It(4),It!=Float32Array&&(Ee[0]=0,Ee[1]=0,Ee[2]=0,Ee[3]=0),ls(),X(1,0,0),X(0,1,0),Ge(),Ge(),os(),Ke();const Re=8192;function Jt(r,e,i){return e*(Re/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}function hi(r,e){return(r%e+e)%e}function Pr(r,e,i){return r*(1-i)+e*i}function Wr(r){if(r<=0)return 0;if(r>=1)return 1;const e=r*r,i=e*r;return 4*(r<.5?i:3*(r-e)+i-.75)}function Sn(r,e,i,s){const a=new Kt(r,e,i,s);return l=>a.solve(l)}const cs=Sn(.25,.1,.25,1);function Si(r,e,i){return Math.min(i,Math.max(e,r))}function Pn(r,e,i){const s=i-e,a=((r-e)%s+s)%s+e;return a===e?i:a}function Ri(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}let us=1;function Ir(r,e,i){const s={};for(const a in r)s[a]=e.call(this,r[a],a,r);return s}function xt(r,e,i){const s={};for(const a in r)e.call(this,r[a],a,r)&&(s[a]=r[a]);return s}function $e(r){return Array.isArray(r)?r.map($e):typeof r=="object"&&r?Ir(r,$e):r}const Nt={};function Ut(r){Nt[r]||(typeof console<"u"&&console.warn(r),Nt[r]=!0)}function Fi(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function Gt(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let Li=null;function Mr(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const To="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function hs(r,e,i,s,a){return d(this,void 0,void 0,(function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const l=new VideoFrame(r,{timestamp:0});try{const u=l?.format;if(!u||!u.startsWith("BGR")&&!u.startsWith("RGB"))throw new Error(`Unrecognized format ${u}`);const h=u.startsWith("BGR"),g=new Uint8ClampedArray(s*a*4);if(yield l.copyTo(g,(function(m,x,_,T,v){const I=4*Math.max(-x,0),M=(Math.max(0,_)-_)*T*4+I,A=4*T,D=Math.max(0,x),L=Math.max(0,_);return{rect:{x:D,y:L,width:Math.min(m.width,x+T)-D,height:Math.min(m.height,_+v)-L},layout:[{offset:M,stride:A}]}})(r,e,i,s,a)),h)for(let m=0;m<g.length;m+=4){const x=g[m];g[m]=g[m+2],g[m+2]=x}return g}finally{l.close()}}))}let In,Mn;function Er(r,e,i,s){return r.addEventListener(e,i,s),{unsubscribe:()=>{r.removeEventListener(e,i,s)}}}function ha(r){return r*Math.PI/180}function Xr(r){return r/Math.PI*180}const So={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Po={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},ds="AbortError";class Kl extends Error{constructor(e=ds){super(e instanceof Error?e.message:e),this.name=ds,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function da(r){return r.name===ds}const Cr={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function or(r){return Cr.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const Bi="global-dispatcher";class En extends Error{constructor(e,i,s,a){super(`AJAXError: ${i} (${e}): ${s}`),this.status=e,this.statusText=i,this.url=s,this.body=a}}const Io=()=>Gt(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Hr=function(r,e){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){const s=or(r.url);if(s)return s(r,e);if(Gt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:Bi},e)}if(!(/^file:/.test(i=r.url)||/^file:/.test(Io())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return(function(s,a){return d(this,void 0,void 0,(function*(){const l=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,cache:s.cache,referrer:Io(),referrerPolicy:s.referrerPolicy,signal:a.signal});let u,h;s.type!=="json"||l.headers.has("Accept")||l.headers.set("Accept","application/json");try{u=yield fetch(l)}catch(m){throw da(m)?m:new En(0,m.message,s.url,new Blob)}if(!u.ok){const m=yield u.blob();throw new En(u.status,u.statusText,s.url,m)}h=s.type==="arrayBuffer"||s.type==="image"?u.arrayBuffer():s.type==="json"?u.json():u.text();const g=yield h;return a.signal.throwIfAborted(),{data:g,cacheControl:u.headers.get("Cache-Control"),expires:u.headers.get("Expires"),etag:u.headers.get("ETag")}}))})(r,e);if(Gt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:Bi},e)}var i;return(function(s,a){return new Promise(((l,u)=>{var h;const g=new XMLHttpRequest;g.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(g.responseType="arraybuffer");for(const m in s.headers)g.setRequestHeader(m,s.headers[m]);s.type==="json"&&(g.responseType="text",!((h=s.headers)===null||h===void 0)&&h.Accept||g.setRequestHeader("Accept","application/json")),g.withCredentials=s.credentials==="include",g.onerror=()=>{u(new Error(g.statusText))},g.onload=()=>{if(!a.signal.aborted)if((g.status>=200&&g.status<300||g.status===0)&&g.response!==null){let m=g.response;if(s.type==="json")try{m=JSON.parse(g.response)}catch(x){return void u(x)}l({data:m,cacheControl:g.getResponseHeader("Cache-Control"),expires:g.getResponseHeader("Expires"),etag:g.getResponseHeader("ETag")})}else{const m=new Blob([g.response],{type:g.getResponseHeader("Content-Type")});u(new En(g.status,g.statusText,s.url,m))}},a.signal.addEventListener("abort",(()=>{g.abort(),u(new Kl(a.signal.reason))})),g.send(s.body)}))})(r,e)};function Xi(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;const e=new URL(r),i=window.location;return e.protocol===i.protocol&&e.host===i.host}function Cn(r,e,i){i[r]&&i[r].indexOf(e)!==-1||(i[r]=i[r]||[],i[r].push(e))}function Yr(r,e,i){if(i&&i[r]){const s=i[r].indexOf(e);s!==-1&&i[r].splice(s,1)}}class ps{constructor(e,i={}){Ri(this,i),this.type=e}}class pa extends ps{constructor(e,i={}){super("error",Ri({error:e},i))}}class fa{on(e,i){return this._listeners=this._listeners||{},Cn(e,i,this._listeners),{unsubscribe:()=>{this.off(e,i)}}}off(e,i){return Yr(e,i,this._listeners),Yr(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},Cn(e,i,this._oneTimeListeners),this):new Promise((s=>this.once(e,s)))}fire(e,i){typeof e=="string"&&(e=new ps(e,i||{}));const s=e.type;if(this.listens(s)){e.target=this;const a=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const h of a)h.call(this,e);const l=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const h of l)Yr(s,h,this._oneTimeListeners),h.call(this,e);const u=this._eventedParent;u&&(Ri(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),u.fire(e))}else e instanceof pa&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}var he={$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"]},"property-type":"data-constant"},"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"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"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"}]}}}}};const Mo=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Eo(r,e){const i={};for(const s in r)s!=="ref"&&(i[s]=r[s]);return Mo.forEach((s=>{s in e&&(i[s]=e[s])})),i}function tt(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(!tt(r[i],e[i]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(const i in r)if(!tt(r[i],e[i]))return!1;return!0}return r===e}function yi(r,e){r.push(e)}function Kr(r,e,i){yi(i,{command:"addSource",args:[r,e[r]]})}function Jl(r,e,i){yi(e,{command:"removeSource",args:[r]}),i[r]=!0}function Ql(r,e,i,s){Jl(r,i,s),Kr(r,e,i)}function Eu(r,e,i){let s;for(s in r[i])if(Object.prototype.hasOwnProperty.call(r[i],s)&&s!=="data"&&!tt(r[i][s],e[i][s]))return!1;for(s in e[i])if(Object.prototype.hasOwnProperty.call(e[i],s)&&s!=="data"&&!tt(r[i][s],e[i][s]))return!1;return!0}function ma(r,e,i,s,a,l){r=r||{},e=e||{};for(const u in r)Object.prototype.hasOwnProperty.call(r,u)&&(tt(r[u],e[u])||i.push({command:l,args:[s,u,e[u],a]}));for(const u in e)Object.prototype.hasOwnProperty.call(e,u)&&!Object.prototype.hasOwnProperty.call(r,u)&&(tt(r[u],e[u])||i.push({command:l,args:[s,u,e[u],a]}))}function Co(r){return r.id}function ec(r,e){return r[e.id]=e,r}class xe{constructor(e,i,s,a){this.message=(e?`${e}: `:"")+s,a&&(this.identifier=a),i!=null&&i.__line__&&(this.line=i.__line__)}}function Jr(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}class Qt extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class Ao{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[s,a]of i)this.bindings[s]=a}concat(e){return new Ao(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Ar={kind:"null"},ve={kind:"number"},ke={kind:"string"},Oe={kind:"boolean"},Pi={kind:"color"},An={kind:"projectionDefinition"},Dr={kind:"object"},Be={kind:"value"},ga={kind:"collator"},Dn={kind:"formatted"},fs={kind:"padding"},zn={kind:"colorArray"},ms={kind:"numberArray"},Qr={kind:"resolvedImage"},ir={kind:"variableAnchorOffsetCollection"};function $t(r,e){return{kind:"array",itemType:r,N:e}}function pt(r){if(r.kind==="array"){const e=pt(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const Do=[Ar,ve,ke,Oe,Pi,An,Dn,Dr,$t(Be),fs,ms,zn,Qr,ir];function gs(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!gs(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(const i of Do)if(!gs(i,e))return null}}return`Expected ${pt(r)} but found ${pt(e)} instead.`}function kn(r,e){return e.some((i=>i.kind===r.kind))}function en(r,e){return e.some((i=>i==="null"?r===null:i==="array"?Array.isArray(r):i==="object"?r&&!Array.isArray(r)&&typeof r=="object":i===typeof r))}function Ii(r,e){return r.kind==="array"&&e.kind==="array"?r.itemType.kind===e.itemType.kind&&typeof r.N=="number":r.kind===e.kind}const _a=.96422,Ot=.82521,tc=4/29,tn=6/29,Rn=3*tn*tn,ic=tn*tn*tn,Cu=Math.PI/180,Au=180/Math.PI;function zo(r){return(r%=360)<0&&(r+=360),r}function rc([r,e,i,s]){let a,l;const u=ko((.2225045*(r=ya(r))+.7168786*(e=ya(e))+.0606169*(i=ya(i)))/1);r===e&&e===i?a=l=u:(a=ko((.4360747*r+.3850649*e+.1430804*i)/_a),l=ko((.0139322*r+.0971045*e+.7141733*i)/Ot));const h=116*u-16;return[h<0?0:h,500*(a-u),200*(u-l),s]}function ya(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function ko(r){return r>ic?Math.pow(r,1/3):r/Rn+tc}function nc([r,e,i,s]){let a=(r+16)/116,l=isNaN(e)?a:a+e/500,u=isNaN(i)?a:a-i/200;return a=1*Fo(a),l=_a*Fo(l),u=Ot*Fo(u),[Ro(3.1338561*l-1.6168667*a-.4906146*u),Ro(-.9787684*l+1.9161415*a+.033454*u),Ro(.0719453*l-.2289914*a+1.4052427*u),s]}function Ro(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function Fo(r){return r>tn?r*r*r:Rn*(r-tc)}const Du=Object.hasOwn||function(r,e){return Object.prototype.hasOwnProperty.call(r,e)};function _s(r,e){return Du(r,e)?r[e]:void 0}function xa(r){return parseInt(r.padEnd(2,r),16)/255}function Lo(r,e){return rr(e?r/100:r,0,1)}function rr(r,e,i){return Math.min(Math.max(e,r),i)}function sc(r){return!r.some(Number.isNaN)}const zu={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 Oi(r,e,i){return r+i*(e-r)}function Fn(r,e,i){return r.map(((s,a)=>Oi(s,e[a],i)))}class Ne{constructor(e,i,s,a=1,l=!0){this.r=e,this.g=i,this.b=s,this.a=a,l||(this.r*=a,this.g*=a,this.b*=a,a||this.overwriteGetter("rgb",[e,i,s,a]))}static parse(e){if(e instanceof Ne)return e;if(typeof e!="string")return;const i=(function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];const a=_s(zu,s);if(a){const[u,h,g]=a;return[u/255,h/255,g/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const u=s.length<6?1:2;let h=1;return[xa(s.slice(h,h+=u)),xa(s.slice(h,h+=u)),xa(s.slice(h,h+=u)),xa(s.slice(h,h+u)||"ff")]}if(s.startsWith("rgb")){const u=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[h,g,m,x,_,T,v,I,M,A,D,L]=u,k=[x||" ",v||" ",A].join("");if(k===" "||k===" /"||k===",,"||k===",,,"){const B=[m,T,M].join(""),O=B==="%%%"?100:B===""?255:0;if(O){const U=[rr(+g/O,0,1),rr(+_/O,0,1),rr(+I/O,0,1),D?Lo(+D,L):1];if(sc(U))return U}}return}}const l=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(l){const[u,h,g,m,x,_,T,v,I]=l,M=[g||" ",x||" ",T].join("");if(M===" "||M===" /"||M===",,"||M===",,,"){const A=[+h,rr(+m,0,100),rr(+_,0,100),v?Lo(+v,I):1];if(sc(A))return(function([D,L,k,B]){function O(U){const H=(U+D/30)%12,J=L*Math.min(k,1-k);return k-J*Math.max(-1,Math.min(H-3,9-H,1))}return D=zo(D),L/=100,k/=100,[O(0),O(8),O(4),B]})(A)}}})(e);return i?new Ne(...i,!1):void 0}get rgb(){const{r:e,g:i,b:s,a}=this,l=a||1/0;return this.overwriteGetter("rgb",[e/l,i/l,s/l,a])}get hcl(){return this.overwriteGetter("hcl",(function(e){const[i,s,a,l]=rc(e),u=Math.sqrt(s*s+a*a);return[Math.round(1e4*u)?zo(Math.atan2(a,s)*Au):NaN,u,i,l]})(this.rgb))}get lab(){return this.overwriteGetter("lab",rc(this.rgb))}overwriteGetter(e,i){return Object.defineProperty(this,e,{value:i}),i}toString(){const[e,i,s,a]=this.rgb;return`rgba(${[e,i,s].map((l=>Math.round(255*l))).join(",")},${a})`}static interpolate(e,i,s,a="rgb"){switch(a){case"rgb":{const[l,u,h,g]=Fn(e.rgb,i.rgb,s);return new Ne(l,u,h,g,!1)}case"hcl":{const[l,u,h,g]=e.hcl,[m,x,_,T]=i.hcl;let v,I;if(isNaN(l)||isNaN(m))isNaN(l)?isNaN(m)?v=NaN:(v=m,h!==1&&h!==0||(I=x)):(v=l,_!==1&&_!==0||(I=u));else{let k=m-l;m>l&&k>180?k-=360:m<l&&l-m>180&&(k+=360),v=l+s*k}const[M,A,D,L]=(function([k,B,O,U]){return k=isNaN(k)?0:k*Cu,nc([O,Math.cos(k)*B,Math.sin(k)*B,U])})([v,I??Oi(u,x,s),Oi(h,_,s),Oi(g,T,s)]);return new Ne(M,A,D,L,!1)}case"lab":{const[l,u,h,g]=nc(Fn(e.lab,i.lab,s));return new Ne(l,u,h,g,!1)}}}}Ne.black=new Ne(0,0,0,1),Ne.white=new Ne(1,1,1,1),Ne.transparent=new Ne(0,0,0,0),Ne.red=new Ne(1,0,0,1);class Bo{constructor(e,i,s){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const ac=["bottom","center","top"];class va{constructor(e,i,s,a,l,u){this.text=e,this.image=i,this.scale=s,this.fontStack=a,this.textColor=l,this.verticalAlign=u}}class Mt{constructor(e){this.sections=e}static fromString(e){return new Mt([new va(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 Mt?e:Mt.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map((e=>e.text)).join("")}}class De{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof De)return e;if(typeof e=="number")return new De([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const i of e)if(typeof i!="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 De(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){return new De(Fn(e.values,i.values,s))}}class kt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof kt)return e;if(typeof e=="number")return new kt([e]);if(Array.isArray(e)){for(const i of e)if(typeof i!="number")return;return new kt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){return new kt(Fn(e.values,i.values,s))}}class vt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof vt)return e;if(typeof e=="string"){const s=Ne.parse(e);return s?new vt([s]):void 0}if(!Array.isArray(e))return;const i=[];for(const s of e){if(typeof s!="string")return;const a=Ne.parse(s);if(!a)return;i.push(a)}return new vt(i)}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s,a="rgb"){const l=[];if(e.values.length!=i.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${i.values.length}), cannot interpolate.`);for(let u=0;u<e.values.length;u++)l.push(Ne.interpolate(e.values[u],i.values[u],s,a));return new vt(l)}}class bt extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const oc=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class ti{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ti)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let i=0;i<e.length;i+=2){const s=e[i],a=e[i+1];if(typeof s!="string"||!oc.has(s)||!Array.isArray(a)||a.length!==2||typeof a[0]!="number"||typeof a[1]!="number")return}return new ti(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){const a=e.values,l=i.values;if(a.length!==l.length)throw new bt(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${i.toString()}`);const u=[];for(let h=0;h<a.length;h+=2){if(a[h]!==l[h])throw new bt(`Cannot interpolate values containing mismatched anchors. from[${h}]: ${a[h]}, to[${h}]: ${l[h]}`);u.push(a[h]);const[g,m]=a[h+1],[x,_]=l[h+1];u.push([Oi(g,x,s),Oi(m,_,s)])}return new ti(u)}}class ii{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new ii({name:e,available:!1}):null}}class ri{constructor(e,i,s){this.from=e,this.to=i,this.transition=s}static interpolate(e,i,s){return new ri(e,i,s)}static parse(e){return e instanceof ri?e:Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"?new ri(e[0],e[1],e[2]):typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number"?new ri(e.from,e.to,e.transition):typeof e=="string"?new ri(e,e,1):void 0}}function Oo(r,e,i,s){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[r,e,i,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[r,e,i,s]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function rn(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof ri||r instanceof Ne||r instanceof Bo||r instanceof Mt||r instanceof De||r instanceof kt||r instanceof vt||r instanceof ti||r instanceof ii)return!0;if(Array.isArray(r)){for(const e of r)if(!rn(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!rn(r[e]))return!1;return!0}return!1}function wt(r){if(r===null)return Ar;if(typeof r=="string")return ke;if(typeof r=="boolean")return Oe;if(typeof r=="number")return ve;if(r instanceof Ne)return Pi;if(r instanceof ri)return An;if(r instanceof Bo)return ga;if(r instanceof Mt)return Dn;if(r instanceof De)return fs;if(r instanceof kt)return ms;if(r instanceof vt)return zn;if(r instanceof ti)return ir;if(r instanceof ii)return Qr;if(Array.isArray(r)){const e=r.length;let i;for(const s of r){const a=wt(s);if(i){if(i===a)continue;i=Be;break}i=a}return $t(i||Be,e)}return Dr}function ys(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof Ne||r instanceof ri||r instanceof Mt||r instanceof De||r instanceof kt||r instanceof vt||r instanceof ti||r instanceof ii?r.toString():JSON.stringify(r)}class nr{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!rn(e[1]))return i.error("invalid value");const s=e[1];let a=wt(s);const l=i.expectedType;return a.kind!=="array"||a.N!==0||!l||l.kind!=="array"||typeof l.N=="number"&&l.N!==0||(a=l),new nr(a,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const lr={string:ke,number:ve,boolean:Oe,object:Dr};class Vi{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let s,a=1;const l=e[0];if(l==="array"){let h,g;if(e.length>2){const m=e[1];if(typeof m!="string"||!(m in lr)||m==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);h=lr[m],a++}else h=Be;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);g=e[2],a++}s=$t(h,g)}else{if(!lr[l])throw new Error(`Types doesn't contain name = ${l}`);s=lr[l]}const u=[];for(;a<e.length;a++){const h=i.parse(e[a],a,Be);if(!h)return null;u.push(h)}return new Vi(s,u)}evaluate(e){for(let i=0;i<this.args.length;i++){const s=this.args[i].evaluate(e);if(!gs(this.type,wt(s)))return s;if(i===this.args.length-1)throw new bt(`Expected value to be of type ${pt(this.type)}, but found ${pt(wt(s))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const Vo={"to-boolean":Oe,"to-color":Pi,"to-number":ve,"to-string":ke};class cr{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[0];if(!Vo[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return i.error("Expected one argument.");const a=Vo[s],l=[];for(let u=1;u<e.length;u++){const h=i.parse(e[u],u,Be);if(!h)return null;l.push(h)}return new cr(a,l)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let i,s;for(const a of this.args){if(i=a.evaluate(e),s=null,i instanceof Ne)return i;if(typeof i=="string"){const l=e.parseColor(i);if(l)return l}else if(Array.isArray(i)&&(s=i.length<3||i.length>4?`Invalid rgba value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:Oo(i[0],i[1],i[2],i[3]),!s))return new Ne(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new bt(s||`Could not parse color from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"padding":{let i;for(const s of this.args){i=s.evaluate(e);const a=De.parse(i);if(a)return a}throw new bt(`Could not parse padding from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"numberArray":{let i;for(const s of this.args){i=s.evaluate(e);const a=kt.parse(i);if(a)return a}throw new bt(`Could not parse numberArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"colorArray":{let i;for(const s of this.args){i=s.evaluate(e);const a=vt.parse(i);if(a)return a}throw new bt(`Could not parse colorArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"variableAnchorOffsetCollection":{let i;for(const s of this.args){i=s.evaluate(e);const a=ti.parse(i);if(a)return a}throw new bt(`Could not parse variableAnchorOffsetCollection from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"number":{let i=null;for(const s of this.args){if(i=s.evaluate(e),i===null)return 0;const a=Number(i);if(!isNaN(a))return a}throw new bt(`Could not convert ${JSON.stringify(i)} to number.`)}case"formatted":return Mt.fromString(ys(this.args[0].evaluate(e)));case"resolvedImage":return ii.fromString(ys(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return ys(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const ba=["Unknown","Point","LineString","Polygon"];class ut{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"?ba[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 i=this._parseColorCache.get(e);return i||(i=Ne.parse(e),this._parseColorCache.set(e,i)),i}}class Ln{constructor(e,i,s=[],a,l=new Ao,u=[]){this.registry=e,this.path=s,this.key=s.map((h=>`[${h}]`)).join(""),this.scope=l,this.errors=u,this.expectedType=a,this._isConstant=i}parse(e,i,s,a,l={}){return i?this.concat(i,s,a)._parse(e,l):this._parse(e,l)}_parse(e,i){function s(a,l,u){return u==="assert"?new Vi(l,[a]):u==="coerce"?new cr(l,[a]):a}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", []].');const a=e[0];if(typeof a!="string")return this.error(`Expression name must be a string, but found ${typeof a} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const l=this.registry[a];if(l){let u=l.parse(e,this);if(!u)return null;if(this.expectedType){const h=this.expectedType,g=u.type;if(h.kind!=="string"&&h.kind!=="number"&&h.kind!=="boolean"&&h.kind!=="object"&&h.kind!=="array"||g.kind!=="value"){if(h.kind==="projectionDefinition"&&["string","array"].includes(g.kind)||["color","formatted","resolvedImage"].includes(h.kind)&&["value","string"].includes(g.kind)||["padding","numberArray"].includes(h.kind)&&["value","number","array"].includes(g.kind)||h.kind==="colorArray"&&["value","string","array"].includes(g.kind)||h.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(g.kind))u=s(u,h,i.typeAnnotation||"coerce");else if(this.checkSubtype(h,g))return null}else u=s(u,h,i.typeAnnotation||"assert")}if(!(u instanceof nr)&&u.type.kind!=="resolvedImage"&&this._isConstant(u)){const h=new ut;try{u=new nr(u.type,u.evaluate(h))}catch(g){return this.error(g.message),null}}return u}return this.error(`Unknown expression "${a}". 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,i,s){const a=typeof e=="number"?this.path.concat(e):this.path,l=s?this.scope.concat(s):this.scope;return new Ln(this.registry,this._isConstant,a,i||null,l,this.errors)}error(e,...i){const s=`${this.key}${i.map((a=>`[${a}]`)).join("")}`;this.errors.push(new Qt(s,e))}checkSubtype(e,i){const s=gs(e,i);return s&&this.error(s),s}}class Ue{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let l=1;l<e.length-1;l+=2){const u=e[l];if(typeof u!="string")return i.error(`Expected string, but found ${typeof u} instead.`,l);if(/[^a-zA-Z0-9_]/.test(u))return i.error("Variable names must contain only alphanumeric characters or '_'.",l);const h=i.parse(e[l+1],l+1);if(!h)return null;s.push([u,h])}const a=i.parse(e[e.length-1],e.length-1,i.expectedType,s);return a?new Ue(s,a):null}outputDefined(){return this.result.outputDefined()}}class Fe{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const s=e[1];return i.scope.has(s)?new Fe(s,i.scope.get(s)):i.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class xs{constructor(e,i,s){this.type=e,this.index=i,this.input=s}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,ve),a=i.parse(e[2],2,$t(i.expectedType||Be));return s&&a?new xs(a.type.itemType,s,a):null}evaluate(e){const i=this.index.evaluate(e),s=this.input.evaluate(e);if(i<0)throw new bt(`Array index out of bounds: ${i} < 0.`);if(i>=s.length)throw new bt(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i!==Math.floor(i))throw new bt(`Array index must be an integer, but found ${i} instead.`);return s[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class qe{constructor(e,i){this.type=Oe,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,Be),a=i.parse(e[2],2,Be);return s&&a?kn(s.type,[Oe,ke,ve,Ar,Be])?new qe(s,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${pt(s.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!en(i,["boolean","string","number","null"]))throw new bt(`Expected first argument to be of type boolean, string, number or null, but found ${pt(wt(i))} instead.`);if(!en(s,["string","array"]))throw new bt(`Expected second argument to be of type array or string, but found ${pt(wt(s))} instead.`);return s.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Bn{constructor(e,i,s){this.type=ve,this.needle=e,this.haystack=i,this.fromIndex=s}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,Be),a=i.parse(e[2],2,Be);if(!s||!a)return null;if(!kn(s.type,[Oe,ke,ve,Ar,Be]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${pt(s.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,ve);return l?new Bn(s,a,l):null}return new Bn(s,a)}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!en(i,["boolean","string","number","null"]))throw new bt(`Expected first argument to be of type boolean, string, number or null, but found ${pt(wt(i))} instead.`);let a;if(this.fromIndex&&(a=this.fromIndex.evaluate(e)),en(s,["string"])){const l=s.indexOf(i,a);return l===-1?-1:[...s.slice(0,l)].length}if(en(s,["array"]))return s.indexOf(i,a);throw new bt(`Expected second argument to be of type array or string, but found ${pt(wt(s))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Hi{constructor(e,i,s,a,l,u){this.inputType=e,this.type=i,this.input=s,this.cases=a,this.outputs=l,this.otherwise=u}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let s,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);const l={},u=[];for(let m=2;m<e.length-1;m+=2){let x=e[m];const _=e[m+1];Array.isArray(x)||(x=[x]);const T=i.concat(m);if(x.length===0)return T.error("Expected at least one branch label.");for(const I of x){if(typeof I!="number"&&typeof I!="string")return T.error("Branch labels must be numbers or strings.");if(typeof I=="number"&&Math.abs(I)>Number.MAX_SAFE_INTEGER)return T.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof I=="number"&&Math.floor(I)!==I)return T.error("Numeric branch labels must be integer values.");if(s){if(T.checkSubtype(s,wt(I)))return null}else s=wt(I);if(l[String(I)]!==void 0)return T.error("Branch labels must be unique.");l[String(I)]=u.length}const v=i.parse(_,m,a);if(!v)return null;a=a||v.type,u.push(v)}const h=i.parse(e[1],1,Be);if(!h)return null;const g=i.parse(e[e.length-1],e.length-1,a);return g?h.type.kind!=="value"&&i.concat(1).checkSubtype(s,h.type)?null:new Hi(s,a,h,l,u,g):null}evaluate(e){const i=this.input.evaluate(e);return(wt(i)===this.inputType&&this.outputs[this.cases[i]]||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 vs{constructor(e,i,s){this.type=e,this.branches=i,this.otherwise=s}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let s;i.expectedType&&i.expectedType.kind!=="value"&&(s=i.expectedType);const a=[];for(let u=1;u<e.length-1;u+=2){const h=i.parse(e[u],u,Oe);if(!h)return null;const g=i.parse(e[u+1],u+1,s);if(!g)return null;a.push([h,g]),s=s||g.type}const l=i.parse(e[e.length-1],e.length-1,s);if(!l)return null;if(!s)throw new Error("Can't infer output type");return new vs(s,a,l)}evaluate(e){for(const[i,s]of this.branches)if(i.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,s]of this.branches)e(i),e(s);e(this.otherwise)}outputDefined(){return this.branches.every((([e,i])=>i.outputDefined()))&&this.otherwise.outputDefined()}}class nn{constructor(e,i,s,a){this.type=e,this.input=i,this.beginIndex=s,this.endIndex=a}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,Be),a=i.parse(e[2],2,ve);if(!s||!a)return null;if(!kn(s.type,[$t(Be),ke,Be]))return i.error(`Expected first argument to be of type array or string, but found ${pt(s.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,ve);return l?new nn(s.type,s,a,l):null}return new nn(s.type,s,a)}evaluate(e){const i=this.input.evaluate(e),s=this.beginIndex.evaluate(e);let a;if(this.endIndex&&(a=this.endIndex.evaluate(e)),en(i,["string"]))return[...i].slice(s,a).join("");if(en(i,["array"]))return i.slice(s,a);throw new bt(`Expected first argument to be of type array or string, but found ${pt(wt(i))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function bs(r,e){const i=r.length-1;let s,a,l=0,u=i,h=0;for(;l<=u;)if(h=Math.floor((l+u)/2),s=r[h],a=r[h+1],s<=e){if(h===i||e<a)return h;l=h+1}else{if(!(s>e))throw new bt("Input is not a number.");u=h-1}return 0}class sn{constructor(e,i,s){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[a,l]of s)this.labels.push(a),this.outputs.push(l)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const s=i.parse(e[1],1,ve);if(!s)return null;const a=[];let l=null;i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let u=1;u<e.length;u+=2){const h=u===1?-1/0:e[u],g=e[u+1],m=u,x=u+1;if(typeof h!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',m);if(a.length&&a[a.length-1][0]>=h)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',m);const _=i.parse(g,x,l);if(!_)return null;l=l||_.type,a.push([h,_])}return new sn(l,s,a)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return s[0].evaluate(e);const l=i.length;return a>=i[l-1]?s[l-1].evaluate(e):s[bs(i,a)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function lc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var jo,No,cc=(function(){if(No)return jo;function r(e,i,s,a){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=s,this.p2y=a}return No=1,jo=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,a=0;a<8;a++){var l=this.sampleCurveX(s)-e;if(Math.abs(l)<i)return s;var u=this.sampleCurveDerivativeX(s);if(Math.abs(u)<1e-6)break;s-=l/u}var h=0,g=1;for(s=e,a=0;a<20&&(l=this.sampleCurveX(s),!(Math.abs(l-e)<i));a++)e>l?h=s:g=s,s=.5*(g-h)+h;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},jo})(),zr=lc(cc);class rt{constructor(e,i,s,a,l){this.type=e,this.operator=i,this.interpolation=s,this.input=a,this.labels=[],this.outputs=[];for(const[u,h]of l)this.labels.push(u),this.outputs.push(h)}static interpolationFactor(e,i,s,a){let l=0;if(e.name==="exponential")l=On(i,e.base,s,a);else if(e.name==="linear")l=On(i,1,s,a);else if(e.name==="cubic-bezier"){const u=e.controlPoints;l=new zr(u[0],u[1],u[2],u[3]).solve(On(i,1,s,a))}return l}static parse(e,i){let[s,a,l,...u]=e;if(!Array.isArray(a)||a.length===0)return i.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){const m=a[1];if(typeof m!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:m}}else{if(a[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{const m=a.slice(1);if(m.length!==4||m.some((x=>typeof x!="number"||x<0||x>1)))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:m}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(l=i.parse(l,2,ve),!l)return null;const h=[];let g=null;s!=="interpolate-hcl"&&s!=="interpolate-lab"||i.expectedType==zn?i.expectedType&&i.expectedType.kind!=="value"&&(g=i.expectedType):g=Pi;for(let m=0;m<u.length;m+=2){const x=u[m],_=u[m+1],T=m+3,v=m+4;if(typeof x!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',T);if(h.length&&h[h.length-1][0]>=x)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',T);const I=i.parse(_,v,g);if(!I)return null;g=g||I.type,h.push([x,I])}return Ii(g,ve)||Ii(g,An)||Ii(g,Pi)||Ii(g,fs)||Ii(g,ms)||Ii(g,zn)||Ii(g,ir)||Ii(g,$t(ve))?new rt(g,s,a,l,h):i.error(`Type ${pt(g)} is not interpolatable.`)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return s[0].evaluate(e);const l=i.length;if(a>=i[l-1])return s[l-1].evaluate(e);const u=bs(i,a),h=rt.interpolationFactor(this.interpolation,a,i[u],i[u+1]),g=s[u].evaluate(e),m=s[u+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Oi(g,m,h);case"color":return Ne.interpolate(g,m,h);case"padding":return De.interpolate(g,m,h);case"colorArray":return vt.interpolate(g,m,h);case"numberArray":return kt.interpolate(g,m,h);case"variableAnchorOffsetCollection":return ti.interpolate(g,m,h);case"array":return Fn(g,m,h);case"projectionDefinition":return ri.interpolate(g,m,h)}case"interpolate-hcl":switch(this.type.kind){case"color":return Ne.interpolate(g,m,h,"hcl");case"colorArray":return vt.interpolate(g,m,h,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Ne.interpolate(g,m,h,"lab");case"colorArray":return vt.interpolate(g,m,h,"lab")}}}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function On(r,e,i,s){const a=s-i,l=r-i;return a===0?0:e===1?l/a:(Math.pow(e,l)-1)/(Math.pow(e,a)-1)}const Yi={color:Ne.interpolate,number:Oi,padding:De.interpolate,numberArray:kt.interpolate,colorArray:vt.interpolate,variableAnchorOffsetCollection:ti.interpolate,array:Fn};class an{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let s=null;const a=i.expectedType;a&&a.kind!=="value"&&(s=a);const l=[];for(const h of e.slice(1)){const g=i.parse(h,1+l.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,l.push(g)}if(!s)throw new Error("No output type");const u=a&&l.some((h=>gs(a,h.type)));return new an(u?Be:s,l)}evaluate(e){let i,s=null,a=0;for(const l of this.args)if(a++,s=l.evaluate(e),s&&s instanceof ii&&!s.available&&(i||(i=s.name),s=null,a===this.args.length&&(s=i)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function Vt(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Uo(r,e,i,s){return s.compare(e,i)===0}function kr(r,e,i){const s=r!=="=="&&r!=="!=";return class Uf{constructor(l,u,h){this.type=Oe,this.lhs=l,this.rhs=u,this.collator=h,this.hasUntypedArgument=l.type.kind==="value"||u.type.kind==="value"}static parse(l,u){if(l.length!==3&&l.length!==4)return u.error("Expected two or three arguments.");const h=l[0];let g=u.parse(l[1],1,Be);if(!g)return null;if(!Vt(h,g.type))return u.concat(1).error(`"${h}" comparisons are not supported for type '${pt(g.type)}'.`);let m=u.parse(l[2],2,Be);if(!m)return null;if(!Vt(h,m.type))return u.concat(2).error(`"${h}" comparisons are not supported for type '${pt(m.type)}'.`);if(g.type.kind!==m.type.kind&&g.type.kind!=="value"&&m.type.kind!=="value")return u.error(`Cannot compare types '${pt(g.type)}' and '${pt(m.type)}'.`);s&&(g.type.kind==="value"&&m.type.kind!=="value"?g=new Vi(m.type,[g]):g.type.kind!=="value"&&m.type.kind==="value"&&(m=new Vi(g.type,[m])));let x=null;if(l.length===4){if(g.type.kind!=="string"&&m.type.kind!=="string"&&g.type.kind!=="value"&&m.type.kind!=="value")return u.error("Cannot use collator to compare non-string types.");if(x=u.parse(l[3],3,ga),!x)return null}return new Uf(g,m,x)}evaluate(l){const u=this.lhs.evaluate(l),h=this.rhs.evaluate(l);if(s&&this.hasUntypedArgument){const g=wt(u),m=wt(h);if(g.kind!==m.kind||g.kind!=="string"&&g.kind!=="number")throw new bt(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${g.kind}, ${m.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=wt(u),m=wt(h);if(g.kind!=="string"||m.kind!=="string")return e(l,u,h)}return this.collator?i(l,u,h,this.collator.evaluate(l)):e(l,u,h)}eachChild(l){l(this.lhs),l(this.rhs),this.collator&&l(this.collator)}outputDefined(){return!0}}}const uc=kr("==",(function(r,e,i){return e===i}),Uo),ku=kr("!=",(function(r,e,i){return e!==i}),(function(r,e,i,s){return!Uo(0,e,i,s)})),Vn=kr("<",(function(r,e,i){return e<i}),(function(r,e,i,s){return s.compare(e,i)<0})),wa=kr(">",(function(r,e,i){return e>i}),(function(r,e,i,s){return s.compare(e,i)>0})),Go=kr("<=",(function(r,e,i){return e<=i}),(function(r,e,i,s){return s.compare(e,i)<=0})),Ru=kr(">=",(function(r,e,i){return e>=i}),(function(r,e,i,s){return s.compare(e,i)>=0}));class ws{constructor(e,i,s){this.type=ga,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return i.error("Collator options argument must be an object.");const a=i.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,Oe);if(!a)return null;const l=i.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,Oe);if(!l)return null;let u=null;return s.locale&&(u=i.parse(s.locale,1,ke),!u)?null:new ws(a,l,u)}evaluate(e){return new Bo(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 jn{constructor(e,i,s,a,l,u){this.type=ke,this.number=e,this.locale=i,this.currency=s,this.unit=a,this.minFractionDigits=l,this.maxFractionDigits=u}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const s=i.parse(e[1],1,ve);if(!s)return null;const a=e[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let l=null;if(a.locale&&(l=i.parse(a.locale,1,ke),!l))return null;let u=null;if(a.currency&&(u=i.parse(a.currency,1,ke),!u))return null;let h=null;if(a.unit&&(h=i.parse(a.unit,1,ke),!h))return null;if(u&&h)return i.error("NumberFormat options `currency` and `unit` are mutually exclusive");let g=null;if(a["min-fraction-digits"]&&(g=i.parse(a["min-fraction-digits"],1,ve),!g))return null;let m=null;return a["max-fraction-digits"]&&(m=i.parse(a["max-fraction-digits"],1,ve),!m)?null:new jn(s,l,u,h,g,m)}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 on{constructor(e){this.type=Dn,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return i.error("First argument must be an image or text section.");const a=[];let l=!1;for(let u=1;u<=e.length-1;++u){const h=e[u];if(l&&typeof h=="object"&&!Array.isArray(h)){l=!1;let g=null;if(h["font-scale"]&&(g=i.parse(h["font-scale"],1,ve),!g))return null;let m=null;if(h["text-font"]&&(m=i.parse(h["text-font"],1,$t(ke)),!m))return null;let x=null;if(h["text-color"]&&(x=i.parse(h["text-color"],1,Pi),!x))return null;let _=null;if(h["vertical-align"]){if(typeof h["vertical-align"]=="string"&&!ac.includes(h["vertical-align"]))return i.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${h["vertical-align"]}' instead.`);if(_=i.parse(h["vertical-align"],1,ke),!_)return null}const T=a[a.length-1];T.scale=g,T.font=m,T.textColor=x,T.verticalAlign=_}else{const g=i.parse(e[u],1,Be);if(!g)return null;const m=g.type.kind;if(m!=="string"&&m!=="value"&&m!=="null"&&m!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");l=!0,a.push({content:g,scale:null,font:null,textColor:null,verticalAlign:null})}}return new on(a)}evaluate(e){return new Mt(this.sections.map((i=>{const s=i.content.evaluate(e);return wt(s)===Qr?new va("",s,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(e):null):new va(ys(s),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null,i.verticalAlign?i.verticalAlign.evaluate(e):null)})))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor),i.verticalAlign&&e(i.verticalAlign)}outputDefined(){return!1}}class Mi{constructor(e){this.type=Qr,this.input=e}static parse(e,i){if(e.length!==2)return i.error("Expected two arguments.");const s=i.parse(e[1],1,ke);return s?new Mi(s):i.error("No image name provided.")}evaluate(e){const i=this.input.evaluate(e),s=ii.fromString(i);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(i)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class Ta{constructor(e){this.type=ve,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=i.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${pt(s.type)} instead.`):new Ta(s):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string")return[...i].length;if(Array.isArray(i))return i.length;throw new bt(`Expected value to be of type string or array, but found ${pt(wt(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Ei=8192;function Fu(r,e){const i=(180+r[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,a=Math.pow(2,e.z);return[Math.round(i*a*Ei),Math.round(s*a*Ei)]}function Ts(r,e){const i=Math.pow(2,e.z);return[(a=(r[0]/Ei+e.x)/i,360*a-180),(s=(r[1]/Ei+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,a}function Ss(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function Ps(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function Lu(r,e,i){const s=r[0]-e[0],a=r[1]-e[1],l=r[0]-i[0],u=r[1]-i[1];return s*u-l*a==0&&s*l<=0&&a*u<=0}function Sa(r,e,i,s){return(a=[s[0]-i[0],s[1]-i[1]])[0]*(l=[e[0]-r[0],e[1]-r[1]])[1]-a[1]*l[0]!=0&&!(!Zo(r,e,i,s)||!Zo(i,s,r,e));var a,l}function Pa(r,e,i){for(const s of i)for(let a=0;a<s.length-1;++a)if(Sa(r,e,s[a],s[a+1]))return!0;return!1}function Nn(r,e,i=!1){let s=!1;for(const h of e)for(let g=0;g<h.length-1;g++){if(Lu(r,h[g],h[g+1]))return i;(l=h[g])[1]>(a=r)[1]!=(u=h[g+1])[1]>a[1]&&a[0]<(u[0]-l[0])*(a[1]-l[1])/(u[1]-l[1])+l[0]&&(s=!s)}var a,l,u;return s}function hc(r,e){for(const i of e)if(Nn(r,i))return!0;return!1}function $o(r,e){for(const i of r)if(!Nn(i,e))return!1;for(let i=0;i<r.length-1;++i)if(Pa(r[i],r[i+1],e))return!1;return!0}function Bu(r,e){for(const i of e)if($o(r,i))return!0;return!1}function Zo(r,e,i,s){const a=s[0]-i[0],l=s[1]-i[1],u=(r[0]-i[0])*l-a*(r[1]-i[1]),h=(e[0]-i[0])*l-a*(e[1]-i[1]);return u>0&&h<0||u<0&&h>0}function qo(r,e,i){const s=[];for(let a=0;a<r.length;a++){const l=[];for(let u=0;u<r[a].length;u++){const h=Fu(r[a][u],i);Ss(e,h),l.push(h)}s.push(l)}return s}function dc(r,e,i){const s=[];for(let a=0;a<r.length;a++){const l=qo(r[a],e,i);s.push(l)}return s}function pc(r,e,i,s){if(r[0]<i[0]||r[0]>i[2]){const a=.5*s;let l=r[0]-i[0]>a?-s:i[0]-r[0]>a?s:0;l===0&&(l=r[0]-i[2]>a?-s:i[2]-r[0]>a?s:0),r[0]+=l}Ss(e,r)}function fc(r,e,i,s){const a=Math.pow(2,s.z)*Ei,l=[s.x*Ei,s.y*Ei],u=[];for(const h of r)for(const g of h){const m=[g.x+l[0],g.y+l[1]];pc(m,e,i,a),u.push(m)}return u}function mc(r,e,i,s){const a=Math.pow(2,s.z)*Ei,l=[s.x*Ei,s.y*Ei],u=[];for(const g of r){const m=[];for(const x of g){const _=[x.x+l[0],x.y+l[1]];Ss(e,_),m.push(_)}u.push(m)}if(e[2]-e[0]<=a/2){(h=e)[0]=h[1]=1/0,h[2]=h[3]=-1/0;for(const g of u)for(const m of g)pc(m,e,i,a)}var h;return u}class Rr{constructor(e,i){this.type=Oe,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(rn(e[1])){const s=e[1];if(s.type==="FeatureCollection"){const a=[];for(const l of s.features){const{type:u,coordinates:h}=l.geometry;u==="Polygon"&&a.push(h),u==="MultiPolygon"&&a.push(...h)}if(a.length)return new Rr(s,{type:"MultiPolygon",coordinates:a})}else if(s.type==="Feature"){const a=s.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new Rr(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new Rr(s,s)}return i.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(i,s){const a=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],u=i.canonicalID();if(s.type==="Polygon"){const h=qo(s.coordinates,l,u),g=fc(i.geometry(),a,l,u);if(!Ps(a,l))return!1;for(const m of g)if(!Nn(m,h))return!1}if(s.type==="MultiPolygon"){const h=dc(s.coordinates,l,u),g=fc(i.geometry(),a,l,u);if(!Ps(a,l))return!1;for(const m of g)if(!hc(m,h))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,s){const a=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],u=i.canonicalID();if(s.type==="Polygon"){const h=qo(s.coordinates,l,u),g=mc(i.geometry(),a,l,u);if(!Ps(a,l))return!1;for(const m of g)if(!$o(m,h))return!1}if(s.type==="MultiPolygon"){const h=dc(s.coordinates,l,u),g=mc(i.geometry(),a,l,u);if(!Ps(a,l))return!1;for(const m of g)if(!Bu(m,h))return!1}return!0})(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Wo=class{constructor(r=[],e=(i,s)=>i<s?-1:i>s?1:0){if(this.data=r,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;const r=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:e,compare:i}=this,s=e[r];for(;r>0;){const a=r-1>>1,l=e[a];if(i(s,l)>=0)break;e[r]=l,r=a}e[r]=s}_down(r){const{data:e,compare:i}=this,s=this.length>>1,a=e[r];for(;r<s;){let l=1+(r<<1);const u=l+1;if(u<this.length&&i(e[u],e[l])<0&&(l=u),i(e[l],a)>=0)break;e[r]=e[l],r=l}e[r]=a}};function Xo(r,e,i=0,s=r.length-1,a=Ou){for(;s>i;){if(s-i>600){const g=s-i+1,m=e-i+1,x=Math.log(g),_=.5*Math.exp(2*x/3),T=.5*Math.sqrt(x*_*(g-_)/g)*(m-g/2<0?-1:1);Xo(r,e,Math.max(i,Math.floor(e-m*_/g+T)),Math.min(s,Math.floor(e+(g-m)*_/g+T)),a)}const l=r[e];let u=i,h=s;for(Is(r,i,e),a(r[s],l)>0&&Is(r,i,s);u<h;){for(Is(r,u,h),u++,h--;a(r[u],l)<0;)u++;for(;a(r[h],l)>0;)h--}a(r[i],l)===0?Is(r,i,h):(h++,Is(r,h,s)),h<=e&&(i=h+1),e<=h&&(s=h-1)}}function Is(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function Ou(r,e){return r<e?-1:r>e?1:0}function Ia(r,e){if(r.length<=1)return[r];const i=[];let s,a;for(const l of r){const u=Ma(l);u!==0&&(l.area=Math.abs(u),a===void 0&&(a=u<0),a===u<0?(s&&i.push(s),s=[l]):s.push(l))}if(s&&i.push(s),e>1)for(let l=0;l<i.length;l++)i[l].length<=e||(Xo(i[l],e,1,i[l].length-1,Vu),i[l]=i[l].slice(0,e));return i}function Vu(r,e){return e.area-r.area}function Ma(r){let e=0;for(let i,s,a=0,l=r.length,u=l-1;a<l;u=a++)i=r[a],s=r[u],e+=(s.x-i.x)*(i.y+s.y);return e}const gc=1/298.257223563,_c=gc*(2-gc),yc=Math.PI/180;class Ho{constructor(e){const i=6378.137*yc*1e3,s=Math.cos(e*yc),a=1/(1-_c*(1-s*s)),l=Math.sqrt(a);this.kx=i*l*s,this.ky=i*l*a*(1-_c)}distance(e,i){const s=this.wrap(e[0]-i[0])*this.kx,a=(e[1]-i[1])*this.ky;return Math.sqrt(s*s+a*a)}pointOnLine(e,i){let s,a,l,u,h=1/0;for(let g=0;g<e.length-1;g++){let m=e[g][0],x=e[g][1],_=this.wrap(e[g+1][0]-m)*this.kx,T=(e[g+1][1]-x)*this.ky,v=0;_===0&&T===0||(v=(this.wrap(i[0]-m)*this.kx*_+(i[1]-x)*this.ky*T)/(_*_+T*T),v>1?(m=e[g+1][0],x=e[g+1][1]):v>0&&(m+=_/this.kx*v,x+=T/this.ky*v)),_=this.wrap(i[0]-m)*this.kx,T=(i[1]-x)*this.ky;const I=_*_+T*T;I<h&&(h=I,s=m,a=x,l=g,u=v)}return{point:[s,a],index:l,t:Math.max(0,Math.min(1,u))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function Ea(r,e){return e[0]-r[0]}function Ms(r){return r[1]-r[0]+1}function ur(r,e){return r[1]>=r[0]&&r[1]<e}function Yo(r,e){if(r[0]>r[1])return[null,null];const i=Ms(r);if(e){if(i===2)return[r,null];const a=Math.floor(i/2);return[[r[0],r[0]+a],[r[0]+a,r[1]]]}if(i===1)return[r,null];const s=Math.floor(i/2)-1;return[[r[0],r[0]+s],[r[0]+s+1,r[1]]]}function Ca(r,e){if(!ur(e,r.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let s=e[0];s<=e[1];++s)Ss(i,r[s]);return i}function Aa(r){const e=[1/0,1/0,-1/0,-1/0];for(const i of r)for(const s of i)Ss(e,s);return e}function xc(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function Ko(r,e,i){if(!xc(r)||!xc(e))return NaN;let s=0,a=0;return r[2]<e[0]&&(s=e[0]-r[2]),r[0]>e[2]&&(s=r[0]-e[2]),r[1]>e[3]&&(a=r[1]-e[3]),r[3]<e[1]&&(a=e[1]-r[3]),i.distance([0,0],[s,a])}function ln(r,e,i){const s=i.pointOnLine(e,r);return i.distance(r,s.point)}function Da(r,e,i,s,a){const l=Math.min(ln(r,[i,s],a),ln(e,[i,s],a)),u=Math.min(ln(i,[r,e],a),ln(s,[r,e],a));return Math.min(l,u)}function ju(r,e,i,s,a){if(!ur(e,r.length)||!ur(s,i.length))return 1/0;let l=1/0;for(let u=e[0];u<e[1];++u){const h=r[u],g=r[u+1];for(let m=s[0];m<s[1];++m){const x=i[m],_=i[m+1];if(Sa(h,g,x,_))return 0;l=Math.min(l,Da(h,g,x,_,a))}}return l}function Nu(r,e,i,s,a){if(!ur(e,r.length)||!ur(s,i.length))return NaN;let l=1/0;for(let u=e[0];u<=e[1];++u)for(let h=s[0];h<=s[1];++h)if(l=Math.min(l,a.distance(r[u],i[h])),l===0)return l;return l}function Uu(r,e,i){if(Nn(r,e,!0))return 0;let s=1/0;for(const a of e){const l=a[0],u=a[a.length-1];if(l!==u&&(s=Math.min(s,ln(r,[u,l],i)),s===0))return s;const h=i.pointOnLine(a,r);if(s=Math.min(s,i.distance(r,h.point)),s===0)return s}return s}function Gu(r,e,i,s){if(!ur(e,r.length))return NaN;for(let l=e[0];l<=e[1];++l)if(Nn(r[l],i,!0))return 0;let a=1/0;for(let l=e[0];l<e[1];++l){const u=r[l],h=r[l+1];for(const g of i)for(let m=0,x=g.length,_=x-1;m<x;_=m++){const T=g[_],v=g[m];if(Sa(u,h,T,v))return 0;a=Math.min(a,Da(u,h,T,v,s))}}return a}function Je(r,e){for(const i of r)for(const s of i)if(Nn(s,e,!0))return!0;return!1}function $u(r,e,i,s=1/0){const a=Aa(r),l=Aa(e);if(s!==1/0&&Ko(a,l,i)>=s)return s;if(Ps(a,l)){if(Je(r,e))return 0}else if(Je(e,r))return 0;let u=1/0;for(const h of r)for(let g=0,m=h.length,x=m-1;g<m;x=g++){const _=h[x],T=h[g];for(const v of e)for(let I=0,M=v.length,A=M-1;I<M;A=I++){const D=v[A],L=v[I];if(Sa(_,T,D,L))return 0;u=Math.min(u,Da(_,T,D,L,i))}}return u}function vc(r,e,i,s,a,l){if(!l)return;const u=Ko(Ca(s,l),a,i);u<e&&r.push([u,l,[0,0]])}function za(r,e,i,s,a,l,u){if(!l||!u)return;const h=Ko(Ca(s,l),Ca(a,u),i);h<e&&r.push([h,l,u])}function ka(r,e,i,s,a=1/0){let l=Math.min(s.distance(r[0],i[0][0]),a);if(l===0)return l;const u=new Wo([[0,[0,r.length-1],[0,0]]],Ea),h=Aa(i);for(;u.length>0;){const g=u.pop();if(g[0]>=l)continue;const m=g[1],x=e?50:100;if(Ms(m)<=x){if(!ur(m,r.length))return NaN;if(e){const _=Gu(r,m,i,s);if(isNaN(_)||_===0)return _;l=Math.min(l,_)}else for(let _=m[0];_<=m[1];++_){const T=Uu(r[_],i,s);if(l=Math.min(l,T),l===0)return 0}}else{const _=Yo(m,e);vc(u,l,s,r,h,_[0]),vc(u,l,s,r,h,_[1])}}return l}function Ra(r,e,i,s,a,l=1/0){let u=Math.min(l,a.distance(r[0],i[0]));if(u===0)return u;const h=new Wo([[0,[0,r.length-1],[0,i.length-1]]],Ea);for(;h.length>0;){const g=h.pop();if(g[0]>=u)continue;const m=g[1],x=g[2],_=e?50:100,T=s?50:100;if(Ms(m)<=_&&Ms(x)<=T){if(!ur(m,r.length)&&ur(x,i.length))return NaN;let v;if(e&&s)v=ju(r,m,i,x,a),u=Math.min(u,v);else if(e&&!s){const I=r.slice(m[0],m[1]+1);for(let M=x[0];M<=x[1];++M)if(v=ln(i[M],I,a),u=Math.min(u,v),u===0)return u}else if(!e&&s){const I=i.slice(x[0],x[1]+1);for(let M=m[0];M<=m[1];++M)if(v=ln(r[M],I,a),u=Math.min(u,v),u===0)return u}else v=Nu(r,m,i,x,a),u=Math.min(u,v)}else{const v=Yo(m,e),I=Yo(x,s);za(h,u,a,r,i,v[0],I[0]),za(h,u,a,r,i,v[0],I[1]),za(h,u,a,r,i,v[1],I[0]),za(h,u,a,r,i,v[1],I[1])}}return u}function Jo(r){return r.type==="MultiPolygon"?r.coordinates.map((e=>({type:"Polygon",coordinates:e}))):r.type==="MultiLineString"?r.coordinates.map((e=>({type:"LineString",coordinates:e}))):r.type==="MultiPoint"?r.coordinates.map((e=>({type:"Point",coordinates:e}))):[r]}class cn{constructor(e,i){this.type=ve,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(rn(e[1])){const s=e[1];if(s.type==="FeatureCollection")return new cn(s,s.features.map((a=>Jo(a.geometry))).flat());if(s.type==="Feature")return new cn(s,Jo(s.geometry));if("type"in s&&"coordinates"in s)return new cn(s,Jo(s))}return i.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(i,s){const a=i.geometry(),l=a.flat().map((g=>Ts([g.x,g.y],i.canonical)));if(a.length===0)return NaN;const u=new Ho(l[0][1]);let h=1/0;for(const g of s){switch(g.type){case"Point":h=Math.min(h,Ra(l,!1,[g.coordinates],!1,u,h));break;case"LineString":h=Math.min(h,Ra(l,!1,g.coordinates,!0,u,h));break;case"Polygon":h=Math.min(h,ka(l,!1,g.coordinates,u,h))}if(h===0)return h}return h})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,s){const a=i.geometry(),l=a.flat().map((g=>Ts([g.x,g.y],i.canonical)));if(a.length===0)return NaN;const u=new Ho(l[0][1]);let h=1/0;for(const g of s){switch(g.type){case"Point":h=Math.min(h,Ra(l,!0,[g.coordinates],!1,u,h));break;case"LineString":h=Math.min(h,Ra(l,!0,g.coordinates,!0,u,h));break;case"Polygon":h=Math.min(h,ka(l,!0,g.coordinates,u,h))}if(h===0)return h}return h})(e,this.geometries);if(e.geometryType()==="Polygon")return(function(i,s){const a=i.geometry();if(a.length===0||a[0].length===0)return NaN;const l=Ia(a,0).map((g=>g.map((m=>m.map((x=>Ts([x.x,x.y],i.canonical))))))),u=new Ho(l[0][0][0][1]);let h=1/0;for(const g of s)for(const m of l){switch(g.type){case"Point":h=Math.min(h,ka([g.coordinates],!1,m,u,h));break;case"LineString":h=Math.min(h,ka(g.coordinates,!0,m,u,h));break;case"Polygon":h=Math.min(h,$u(m,g.coordinates,u,h))}if(h===0)return h}return h})(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Es{constructor(e){this.type=Be,this.key=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=e[1];return s==null?i.error("Global state property must be defined."):typeof s!="string"?i.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new Es(s)}evaluate(e){var i;const s=(i=e.globals)===null||i===void 0?void 0:i.globalState;return s&&Object.keys(s).length!==0?_s(s,this.key):null}eachChild(){}outputDefined(){return!1}}const Un={"==":uc,"!=":ku,">":wa,"<":Vn,">=":Ru,"<=":Go,array:Vi,at:xs,boolean:Vi,case:vs,coalesce:an,collator:ws,format:on,image:Mi,in:qe,"index-of":Bn,interpolate:rt,"interpolate-hcl":rt,"interpolate-lab":rt,length:Ta,let:Ue,literal:nr,match:Hi,number:Vi,"number-format":jn,object:Vi,slice:nn,step:sn,string:Vi,"to-boolean":cr,"to-color":cr,"to-number":cr,"to-string":cr,var:Fe,within:Rr,distance:cn,"global-state":Es};class ji{constructor(e,i,s,a){this.name=e,this.type=i,this._evaluate=s,this.args=a}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,i){const s=e[0],a=ji.definitions[s];if(!a)return i.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const l=Array.isArray(a)?a[0]:a.type,u=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,h=u.filter((([m])=>!Array.isArray(m)||m.length===e.length-1));let g=null;for(const[m,x]of h){g=new Ln(i.registry,Fa,i.path,null,i.scope);const _=[];let T=!1;for(let v=1;v<e.length;v++){const I=e[v],M=Array.isArray(m)?m[v-1]:m.type,A=g.parse(I,1+_.length,M);if(!A){T=!0;break}_.push(A)}if(!T)if(Array.isArray(m)&&m.length!==_.length)g.error(`Expected ${m.length} arguments, but found ${_.length} instead.`);else{for(let v=0;v<_.length;v++){const I=Array.isArray(m)?m[v]:m.type,M=_[v];g.concat(v+1).checkSubtype(I,M.type)}if(g.errors.length===0)return new ji(s,l,x,_)}}if(h.length===1)i.errors.push(...g.errors);else{const m=(h.length?h:u).map((([_])=>{return T=_,Array.isArray(T)?`(${T.map(pt).join(", ")})`:`(${pt(T.type)}...)`;var T})).join(" | "),x=[];for(let _=1;_<e.length;_++){const T=i.parse(e[_],1+x.length);if(!T)return null;x.push(pt(T.type))}i.error(`Expected arguments of type ${m}, but found (${x.join(", ")}) instead.`)}return null}static register(e,i){ji.definitions=i;for(const s in i)e[s]=ji}}function bc(r,[e,i,s,a]){e=e.evaluate(r),i=i.evaluate(r),s=s.evaluate(r);const l=a?a.evaluate(r):1,u=Oo(e,i,s,l);if(u)throw new bt(u);return new Ne(e/255,i/255,s/255,l,!1)}function wc(r,e){return r in e}function Qo(r,e){const i=e[r];return i===void 0?null:i}function un(r){return{type:r}}function Fa(r){if(r instanceof Fe)return Fa(r.boundExpression);if(r instanceof ji&&r.name==="error"||r instanceof ws||r instanceof Rr||r instanceof cn||r instanceof Es)return!1;const e=r instanceof cr||r instanceof Vi;let i=!0;return r.eachChild((s=>{i=e?i&&Fa(s):i&&s instanceof nr})),!!i&&La(r)&&Ba(r,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function La(r){if(r instanceof ji&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof Rr||r instanceof cn)return!1;let e=!0;return r.eachChild((i=>{e&&!La(i)&&(e=!1)})),e}function Cs(r){if(r instanceof ji&&r.name==="feature-state")return!1;let e=!0;return r.eachChild((i=>{e&&!Cs(i)&&(e=!1)})),e}function Ba(r,e){if(r instanceof ji&&e.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild((s=>{i&&!Ba(s,e)&&(i=!1)})),i}function Tc(r){return{result:"success",value:r}}function Gn(r){return{result:"error",value:r}}function $n(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function Sc(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function el(r){return!!r.expression&&r.expression.interpolated}function Ve(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function Oa(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&wt(r)===Dr}function Zu(r){return r}function Pc(r,e){const i=r.stops&&typeof r.stops[0][0]=="object",s=i||!(i||r.property!==void 0),a=r.type||(el(e)?"exponential":"interval"),l=(function(x){switch(x.type){case"color":return Ne.parse;case"padding":return De.parse;case"numberArray":return kt.parse;case"colorArray":return vt.parse;default:return null}})(e);if(l&&((r=Jr({},r)).stops&&(r.stops=r.stops.map((x=>[x[0],l(x[1])]))),r.default=l(r.default?r.default:e.default)),r.colorSpace&&(u=r.colorSpace)!=="rgb"&&u!=="hcl"&&u!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var u;const h=(function(x){switch(x){case"exponential":return Ic;case"interval":return Wu;case"categorical":return qu;case"identity":return tl;default:throw new Error(`Unknown function type "${x}"`)}})(a);let g,m;if(a==="categorical"){g=Object.create(null);for(const x of r.stops)g[x[0]]=x[1];m=typeof r.stops[0][0]}if(i){const x={},_=[];for(let I=0;I<r.stops.length;I++){const M=r.stops[I],A=M[0].zoom;x[A]===void 0&&(x[A]={zoom:A,type:r.type,property:r.property,default:r.default,stops:[]},_.push(A)),x[A].stops.push([M[0].value,M[1]])}const T=[];for(const I of _)T.push([x[I].zoom,Pc(x[I],e)]);const v={name:"linear"};return{kind:"composite",interpolationType:v,interpolationFactor:rt.interpolationFactor.bind(void 0,v),zoomStops:T.map((I=>I[0])),evaluate:({zoom:I},M)=>Ic({stops:T,base:r.base},e,I).evaluate(I,M)}}if(s){const x=a==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:rt.interpolationFactor.bind(void 0,x),zoomStops:r.stops.map((_=>_[0])),evaluate:({zoom:_})=>h(r,e,_,g,m)}}return{kind:"source",evaluate(x,_){const T=_&&_.properties?_.properties[r.property]:void 0;return T===void 0?As(r.default,e.default):h(r,e,T,g,m)}}}function As(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function qu(r,e,i,s,a){return As(typeof i===a?s[i]:void 0,r.default,e.default)}function Wu(r,e,i){if(Ve(i)!=="number")return As(r.default,e.default);const s=r.stops.length;if(s===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[s-1][0])return r.stops[s-1][1];const a=bs(r.stops.map((l=>l[0])),i);return r.stops[a][1]}function Ic(r,e,i){const s=r.base!==void 0?r.base:1;if(Ve(i)!=="number")return As(r.default,e.default);const a=r.stops.length;if(a===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[a-1][0])return r.stops[a-1][1];const l=bs(r.stops.map((x=>x[0])),i),u=(function(x,_,T,v){const I=v-T,M=x-T;return I===0?0:_===1?M/I:(Math.pow(_,M)-1)/(Math.pow(_,I)-1)})(i,s,r.stops[l][0],r.stops[l+1][0]),h=r.stops[l][1],g=r.stops[l+1][1],m=Yi[e.type]||Zu;return typeof h.evaluate=="function"?{evaluate(...x){const _=h.evaluate.apply(void 0,x),T=g.evaluate.apply(void 0,x);if(_!==void 0&&T!==void 0)return m(_,T,u,r.colorSpace)}}:m(h,g,u,r.colorSpace)}function tl(r,e,i){switch(e.type){case"color":i=Ne.parse(i);break;case"formatted":i=Mt.fromString(i.toString());break;case"resolvedImage":i=ii.fromString(i.toString());break;case"padding":i=De.parse(i);break;case"colorArray":i=vt.parse(i);break;case"numberArray":i=kt.parse(i);break;default:Ve(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0)}return As(i,r.default,e.default)}ji.register(Un,{error:[{kind:"error"},[ke],(r,[e])=>{throw new bt(e.evaluate(r))}],typeof:[ke,[Be],(r,[e])=>pt(wt(e.evaluate(r)))],"to-rgba":[$t(ve,4),[Pi],(r,[e])=>{const[i,s,a,l]=e.evaluate(r).rgb;return[255*i,255*s,255*a,l]}],rgb:[Pi,[ve,ve,ve],bc],rgba:[Pi,[ve,ve,ve,ve],bc],has:{type:Oe,overloads:[[[ke],(r,[e])=>wc(e.evaluate(r),r.properties())],[[ke,Dr],(r,[e,i])=>wc(e.evaluate(r),i.evaluate(r))]]},get:{type:Be,overloads:[[[ke],(r,[e])=>Qo(e.evaluate(r),r.properties())],[[ke,Dr],(r,[e,i])=>Qo(e.evaluate(r),i.evaluate(r))]]},"feature-state":[Be,[ke],(r,[e])=>Qo(e.evaluate(r),r.featureState||{})],properties:[Dr,[],r=>r.properties()],"geometry-type":[ke,[],r=>r.geometryType()],id:[Be,[],r=>r.id()],zoom:[ve,[],r=>r.globals.zoom],"heatmap-density":[ve,[],r=>r.globals.heatmapDensity||0],elevation:[ve,[],r=>r.globals.elevation||0],"line-progress":[ve,[],r=>r.globals.lineProgress||0],accumulated:[Be,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[ve,un(ve),(r,e)=>{let i=0;for(const s of e)i+=s.evaluate(r);return i}],"*":[ve,un(ve),(r,e)=>{let i=1;for(const s of e)i*=s.evaluate(r);return i}],"-":{type:ve,overloads:[[[ve,ve],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[ve],(r,[e])=>-e.evaluate(r)]]},"/":[ve,[ve,ve],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[ve,[ve,ve],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[ve,[],()=>Math.LN2],pi:[ve,[],()=>Math.PI],e:[ve,[],()=>Math.E],"^":[ve,[ve,ve],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[ve,[ve],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[ve,[ve],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[ve,[ve],(r,[e])=>Math.log(e.evaluate(r))],log2:[ve,[ve],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[ve,[ve],(r,[e])=>Math.sin(e.evaluate(r))],cos:[ve,[ve],(r,[e])=>Math.cos(e.evaluate(r))],tan:[ve,[ve],(r,[e])=>Math.tan(e.evaluate(r))],asin:[ve,[ve],(r,[e])=>Math.asin(e.evaluate(r))],acos:[ve,[ve],(r,[e])=>Math.acos(e.evaluate(r))],atan:[ve,[ve],(r,[e])=>Math.atan(e.evaluate(r))],min:[ve,un(ve),(r,e)=>Math.min(...e.map((i=>i.evaluate(r))))],max:[ve,un(ve),(r,e)=>Math.max(...e.map((i=>i.evaluate(r))))],abs:[ve,[ve],(r,[e])=>Math.abs(e.evaluate(r))],round:[ve,[ve],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[ve,[ve],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[ve,[ve],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[Oe,[ke,Be],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[Oe,[Be],(r,[e])=>r.id()===e.value],"filter-type-==":[Oe,[ke],(r,[e])=>r.geometryType()===e.value],"filter-<":[Oe,[ke,Be],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s<a}],"filter-id-<":[Oe,[Be],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<s}],"filter->":[Oe,[ke,Be],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s>a}],"filter-id->":[Oe,[Be],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>s}],"filter-<=":[Oe,[ke,Be],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s<=a}],"filter-id-<=":[Oe,[Be],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<=s}],"filter->=":[Oe,[ke,Be],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s>=a}],"filter-id->=":[Oe,[Be],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>=s}],"filter-has":[Oe,[Be],(r,[e])=>e.value in r.properties()],"filter-has-id":[Oe,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[Oe,[$t(ke)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[Oe,[$t(Be)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[Oe,[ke,$t(Be)],(r,[e,i])=>i.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[Oe,[ke,$t(Be)],(r,[e,i])=>(function(s,a,l,u){for(;l<=u;){const h=l+u>>1;if(a[h]===s)return!0;a[h]>s?u=h-1:l=h+1}return!1})(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:Oe,overloads:[[[Oe,Oe],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[un(Oe),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:Oe,overloads:[[[Oe,Oe],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[un(Oe),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[Oe,[Oe],(r,[e])=>!e.evaluate(r)],"is-supported-script":[Oe,[ke],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[ke,[ke],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[ke,[ke],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[ke,un(Be),(r,e)=>e.map((i=>ys(i.evaluate(r)))).join("")],split:[$t(ke),[ke,ke],(r,[e,i])=>e.evaluate(r).split(i.evaluate(r))],join:[ke,[$t(ke),ke],(r,[e,i])=>e.value.join(i.evaluate(r))],"resolved-locale":[ke,[ga],(r,[e])=>e.evaluate(r).resolvedLocale()]});class il{constructor(e,i,s){this.expression=e,this._warningHistory={},this._evaluator=new ut,this._defaultValue=i?(function(a){if(a.type==="color"&&Oa(a.default))return new Ne(0,0,0,0);switch(a.type){case"color":return Ne.parse(a.default)||null;case"padding":return De.parse(a.default)||null;case"numberArray":return kt.parse(a.default)||null;case"colorArray":return vt.parse(a.default)||null;case"variableAnchorOffsetCollection":return ti.parse(a.default)||null;case"projectionDefinition":return ri.parse(a.default)||null;default:return a.default===void 0?null:a.default}})(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this._globalState=s}evaluateWithoutErrorHandling(e,i,s,a,l,u){return this._globalState&&(e=Zn(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=s,this._evaluator.canonical=a,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=u,this.expression.evaluate(this._evaluator)}evaluate(e,i,s,a,l,u){this._globalState&&(e=Zn(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=s||null,this._evaluator.canonical=a,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=u||null;try{const h=this.expression.evaluate(this._evaluator);if(h==null||typeof h=="number"&&h!=h)return this._defaultValue;if(this._enumValues&&!(h in this._enumValues))throw new bt(`Expected value to be one of ${Object.keys(this._enumValues).map((g=>JSON.stringify(g))).join(", ")}, but found ${JSON.stringify(h)} instead.`);return h}catch(h){return this._warningHistory[h.message]||(this._warningHistory[h.message]=!0,typeof console<"u"&&console.warn(h.message)),this._defaultValue}}}function Va(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Un}function Ds(r,e,i){const s=new Ln(Un,Fa,[],e?(function(l){const u={color:Pi,string:ke,number:ve,enum:ke,boolean:Oe,formatted:Dn,padding:fs,numberArray:ms,colorArray:zn,projectionDefinition:An,resolvedImage:Qr,variableAnchorOffsetCollection:ir};return l.type==="array"?$t(u[l.value]||Be,l.length):u[l.type]})(e):void 0),a=s.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?Tc(new il(a,e,i)):Gn(s.errors)}class zs{constructor(e,i,s){this.kind=e,this._styleExpression=i,this.isStateDependent=e!=="constant"&&!Cs(i.expression),this.globalStateRefs=Rs(i.expression),this._globalState=s}evaluateWithoutErrorHandling(e,i,s,a,l,u){return this._globalState&&(e=Zn(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,i,s,a,l,u)}evaluate(e,i,s,a,l,u){return this._globalState&&(e=Zn(e,this._globalState)),this._styleExpression.evaluate(e,i,s,a,l,u)}}class rl{constructor(e,i,s,a,l){this.kind=e,this.zoomStops=s,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!Cs(i.expression),this.globalStateRefs=Rs(i.expression),this.interpolationType=a,this._globalState=l}evaluateWithoutErrorHandling(e,i,s,a,l,u){return this._globalState&&(e=Zn(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,i,s,a,l,u)}evaluate(e,i,s,a,l,u){return this._globalState&&(e=Zn(e,this._globalState)),this._styleExpression.evaluate(e,i,s,a,l,u)}interpolationFactor(e,i,s){return this.interpolationType?rt.interpolationFactor(this.interpolationType,e,i,s):0}}function Mc(r,e,i){const s=Ds(r,e,i);if(s.result==="error")return s;const a=s.value.expression,l=La(a);if(!l&&!$n(e))return Gn([new Qt("","data expressions not supported")]);const u=Ba(a,["zoom"]);if(!u&&!Sc(e))return Gn([new Qt("","zoom expressions not supported")]);const h=ks(a);return h||u?h instanceof Qt?Gn([h]):h instanceof rt&&!el(e)?Gn([new Qt("",'"interpolate" expressions cannot be used with this property')]):Tc(h?new rl(l?"camera":"composite",s.value,h.labels,h instanceof rt?h.interpolation:void 0,i):new zs(l?"constant":"source",s.value,i)):Gn([new Qt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class hn{constructor(e,i){this._parameters=e,this._specification=i,Jr(this,Pc(this._parameters,this._specification))}static deserialize(e){return new hn(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ks(r){let e=null;if(r instanceof Ue)e=ks(r.result);else if(r instanceof an){for(const i of r.args)if(e=ks(i),e)break}else(r instanceof sn||r instanceof rt)&&r.input instanceof ji&&r.input.name==="zoom"&&(e=r);return e instanceof Qt||r.eachChild((i=>{const s=ks(i);s instanceof Qt?e=s:!e&&s?e=new Qt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new Qt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Rs(r,e=new Set){return r instanceof Es&&e.add(r.key),r.eachChild((i=>{Rs(i,e)})),e}function Zn(r,e){const{zoom:i,heatmapDensity:s,elevation:a,lineProgress:l,isSupportedScript:u,accumulated:h}=r??{};return{zoom:i,heatmapDensity:s,elevation:a,lineProgress:l,isSupportedScript:u,accumulated:h,globalState:e}}function nl(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const e of r.slice(1))if(!nl(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Xu={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Fs(r,e){if(r==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};nl(r)||(r=ja(r));const i=Ds(r,Xu,e);if(i.result==="error")throw new Error(i.value.map((s=>`${s.key}: ${s.message}`)).join(", "));return{filter:(s,a,l)=>i.value.evaluate(s,a,{},l),needGeometry:sl(r),getGlobalStateRefs:()=>Rs(i.value.expression)}}function Ec(r,e){return r<e?-1:r>e?1:0}function sl(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(sl(r[e]))return!0;return!1}function ja(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?al(r[1],r[2],"=="):e==="!="?Ls(al(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?al(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(ja))):e==="all"?["all"].concat(r.slice(1).map(ja)):e==="none"?["all"].concat(r.slice(1).map(ja).map(Ls)):e==="in"?ol(r[1],r.slice(2)):e==="!in"?Ls(ol(r[1],r.slice(2))):e==="has"?ll(r[1]):e!=="!has"||Ls(ll(r[1]));var i}function al(r,e,i){switch(r){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,r,e]}}function ol(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((i=>typeof i!=typeof e[0]))?["filter-in-large",r,["literal",e.sort(Ec)]]:["filter-in-small",r,["literal",e]]}}function ll(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function Ls(r){return["!",r]}function cl(r){const e=typeof r;if(e==="number"||e==="boolean"||e==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let a="[";for(const l of r)a+=`${cl(l)},`;return`${a}]`}const i=Object.keys(r).sort();let s="{";for(let a=0;a<i.length;a++)s+=`${JSON.stringify(i[a])}:${cl(r[i[a]])},`;return`${s}}`}function Hu(r){let e="";for(const i of Mo)e+=`/${cl(r[i])}`;return e}function Cc(r){const e=r.value;return e?[new xe(r.key,e,"constants have been deprecated as of v8")]:[]}function Et(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function Fr(r){if(Array.isArray(r))return r.map(Fr);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=Fr(r[i]);return e}return Et(r)}function xi(r){const e=r.key,i=r.value,s=r.valueSpec||{},a=r.objectElementValidators||{},l=r.style,u=r.styleSpec,h=r.validateSpec;let g=[];const m=Ve(i);if(m!=="object")return[new xe(e,i,`object expected, ${m} found`)];for(const x in i){const _=x.split(".")[0],T=_s(s,_)||s["*"];let v;if(_s(a,_))v=a[_];else if(_s(s,_)){if(i[x]===void 0)continue;v=h}else if(a["*"])v=a["*"];else{if(!s["*"]){g.push(new xe(e,i[x],`unknown property "${x}"`));continue}v=h}g=g.concat(v({key:(e&&`${e}.`)+x,value:i[x],valueSpec:T,style:l,styleSpec:u,object:i,objectKey:x,validateSpec:h},i))}for(const x in s)a[x]||s[x].required&&s[x].default===void 0&&i[x]===void 0&&g.push(new xe(e,i,`missing required property "${x}"`));return g}function Bs(r){const e=r.value,i=r.valueSpec,s=r.style,a=r.styleSpec,l=r.key,u=r.arrayElementValidator||r.validateSpec;if(Ve(e)!=="array")return[new xe(l,e,`array expected, ${Ve(e)} found`)];if(i.length&&e.length!==i.length)return[new xe(l,e,`array length ${i.length} expected, length ${e.length} found`)];let h={type:i.value,values:i.values};a.$version<7&&(h.function=i.function),Ve(i.value)==="object"&&(h=i.value);let g=[];for(let m=0;m<e.length;m++)g=g.concat(u({array:e,arrayIndex:m,value:e[m],valueSpec:h,validateSpec:r.validateSpec,style:s,styleSpec:a,key:`${l}[${m}]`}));return g}function qn(r){const e=r.key,i=r.value,s=r.valueSpec;let a=Ve(i);return a==="number"&&i!=i&&(a="NaN"),a!=="number"?[new xe(e,i,`number expected, ${a} found`)]:"minimum"in s&&i<s.minimum?[new xe(e,i,`${i} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&i>s.maximum?[new xe(e,i,`${i} is greater than the maximum value ${s.maximum}`)]:[]}function Na(r){const e=r.valueSpec,i=Et(r.value.type);let s,a,l,u={};const h=i!=="categorical"&&r.value.property===void 0,g=!h,m=Ve(r.value.stops)==="array"&&Ve(r.value.stops[0])==="array"&&Ve(r.value.stops[0][0])==="object",x=xi({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(v){if(i==="identity")return[new xe(v.key,v.value,'identity function may not have a "stops" property')];let I=[];const M=v.value;return I=I.concat(Bs({key:v.key,value:M,valueSpec:v.valueSpec,validateSpec:v.validateSpec,style:v.style,styleSpec:v.styleSpec,arrayElementValidator:_})),Ve(M)==="array"&&M.length===0&&I.push(new xe(v.key,M,"array must have at least one stop")),I},default:function(v){return v.validateSpec({key:v.key,value:v.value,valueSpec:e,validateSpec:v.validateSpec,style:v.style,styleSpec:v.styleSpec})}}});return i==="identity"&&h&&x.push(new xe(r.key,r.value,'missing required property "property"')),i==="identity"||r.value.stops||x.push(new xe(r.key,r.value,'missing required property "stops"')),i==="exponential"&&r.valueSpec.expression&&!el(r.valueSpec)&&x.push(new xe(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(g&&!$n(r.valueSpec)?x.push(new xe(r.key,r.value,"property functions not supported")):h&&!Sc(r.valueSpec)&&x.push(new xe(r.key,r.value,"zoom functions not supported"))),i!=="categorical"&&!m||r.value.property!==void 0||x.push(new xe(r.key,r.value,'"property" property is required')),x;function _(v){let I=[];const M=v.value,A=v.key;if(Ve(M)!=="array")return[new xe(A,M,`array expected, ${Ve(M)} found`)];if(M.length!==2)return[new xe(A,M,`array length 2 expected, length ${M.length} found`)];if(m){if(Ve(M[0])!=="object")return[new xe(A,M,`object expected, ${Ve(M[0])} found`)];if(M[0].zoom===void 0)return[new xe(A,M,"object stop key must have zoom")];if(M[0].value===void 0)return[new xe(A,M,"object stop key must have value")];if(l&&l>Et(M[0].zoom))return[new xe(A,M[0].zoom,"stop zoom values must appear in ascending order")];Et(M[0].zoom)!==l&&(l=Et(M[0].zoom),a=void 0,u={}),I=I.concat(xi({key:`${A}[0]`,value:M[0],valueSpec:{zoom:{}},validateSpec:v.validateSpec,style:v.style,styleSpec:v.styleSpec,objectElementValidators:{zoom:qn,value:T}}))}else I=I.concat(T({key:`${A}[0]`,value:M[0],validateSpec:v.validateSpec,style:v.style,styleSpec:v.styleSpec},M));return Va(Fr(M[1]))?I.concat([new xe(`${A}[1]`,M[1],"expressions are not allowed in function stops.")]):I.concat(v.validateSpec({key:`${A}[1]`,value:M[1],valueSpec:e,validateSpec:v.validateSpec,style:v.style,styleSpec:v.styleSpec}))}function T(v,I){const M=Ve(v.value),A=Et(v.value),D=v.value!==null?v.value:I;if(s){if(M!==s)return[new xe(v.key,D,`${M} stop domain type must match previous stop domain type ${s}`)]}else s=M;if(M!=="number"&&M!=="string"&&M!=="boolean")return[new xe(v.key,D,"stop domain value must be a number, string, or boolean")];if(M!=="number"&&i!=="categorical"){let L=`number expected, ${M} found`;return $n(e)&&i===void 0&&(L+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new xe(v.key,D,L)]}return i!=="categorical"||M!=="number"||isFinite(A)&&Math.floor(A)===A?i!=="categorical"&&M==="number"&&a!==void 0&&A<a?[new xe(v.key,D,"stop domain values must appear in ascending order")]:(a=A,i==="categorical"&&A in u?[new xe(v.key,D,"stop domain values must be unique")]:(u[A]=!0,[])):[new xe(v.key,D,`integer expected, found ${A}`)]}}function Lr(r){const e=(r.expressionContext==="property"?Mc:Ds)(Fr(r.value),r.valueSpec);if(e.result==="error")return e.value.map((s=>new xe(`${r.key}${s.key}`,r.value,s.message)));const i=e.value.expression||e.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!i.outputDefined())return[new xe(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!Cs(i))return[new xe(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!Cs(i))return[new xe(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!Ba(i,["zoom","feature-state"]))return[new xe(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!La(i))return[new xe(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Wn(r){const e=r.key,i=r.value,s=Ve(i);return s!=="string"?[new xe(e,i,`color expected, ${s} found`)]:Ne.parse(String(i))?[]:[new xe(e,i,`color expected, "${i}" found`)]}function Os(r){const e=r.key,i=r.value,s=r.valueSpec,a=[];return Array.isArray(s.values)?s.values.indexOf(Et(i))===-1&&a.push(new xe(e,i,`expected one of [${s.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(s.values).indexOf(Et(i))===-1&&a.push(new xe(e,i,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(i)} found`)),a}function ul(r){return nl(Fr(r.value))?Lr(Jr({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ac(r)}function Ac(r){const e=r.value,i=r.key;if(Ve(e)!=="array")return[new xe(i,e,`array expected, ${Ve(e)} found`)];const s=r.styleSpec;let a,l=[];if(e.length<1)return[new xe(i,e,"filter array must have at least 1 element")];switch(l=l.concat(Os({key:`${i}[0]`,value:e[0],valueSpec:s.filter_operator,style:r.style,styleSpec:r.styleSpec})),Et(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Et(e[1])==="$type"&&l.push(new xe(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&l.push(new xe(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(a=Ve(e[1]),a!=="string"&&l.push(new xe(`${i}[1]`,e[1],`string expected, ${a} found`)));for(let u=2;u<e.length;u++)a=Ve(e[u]),Et(e[1])==="$type"?l=l.concat(Os({key:`${i}[${u}]`,value:e[u],valueSpec:s.geometry_type,style:r.style,styleSpec:r.styleSpec})):a!=="string"&&a!=="number"&&a!=="boolean"&&l.push(new xe(`${i}[${u}]`,e[u],`string, number, or boolean expected, ${a} found`));break;case"any":case"all":case"none":for(let u=1;u<e.length;u++)l=l.concat(Ac({key:`${i}[${u}]`,value:e[u],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":a=Ve(e[1]),e.length!==2?l.push(new xe(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):a!=="string"&&l.push(new xe(`${i}[1]`,e[1],`string expected, ${a} found`))}return l}function Dc(r,e){const i=r.key,s=r.validateSpec,a=r.style,l=r.styleSpec,u=r.value,h=r.objectKey,g=l[`${e}_${r.layerType}`];if(!g)return[];const m=h.match(/^(.*)-transition$/);if(e==="paint"&&m&&g[m[1]]&&g[m[1]].transition)return s({key:i,value:u,valueSpec:l.transition,style:a,styleSpec:l});const x=r.valueSpec||g[h];if(!x)return[new xe(i,u,`unknown property "${h}"`)];let _;if(Ve(u)==="string"&&$n(x)&&!x.tokens&&(_=/^{([^}]+)}$/.exec(u)))return[new xe(i,u,`"${h}" does not support interpolation syntax
2
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(_[1])} }\`.`)];const T=[];return r.layerType==="symbol"&&h==="text-font"&&Oa(Fr(u))&&Et(u.type)==="identity"&&T.push(new xe(i,u,'"text-font" does not support identity functions')),T.concat(s({key:r.key,value:u,valueSpec:x,style:a,styleSpec:l,expressionContext:"property",propertyType:e,propertyKey:h}))}function zc(r){return Dc(r,"paint")}function kc(r){return Dc(r,"layout")}function hl(r){var e,i;let s=[];const a=r.value,l=r.key,u=r.style,h=r.styleSpec;if(Ve(a)!=="object")return[new xe(l,a,`object expected, ${Ve(a)} found`)];a.type||a.ref||s.push(new xe(l,a,'either "type" or "ref" is required'));let g=Et(a.type);const m=Et(a.ref);if(a.id){const x=Et(a.id);for(let _=0;_<r.arrayIndex;_++){const T=u.layers[_];Et(T.id)===x&&s.push(new xe(l,a.id,`duplicate layer id "${a.id}", previously used at line ${T.id.__line__}`))}}if("ref"in a){let x;["type","source","source-layer","filter","layout"].forEach((_=>{_ in a&&s.push(new xe(l,a[_],`"${_}" is prohibited for ref layers`))})),u.layers.forEach((_=>{Et(_.id)===m&&(x=_)})),x?x.ref?s.push(new xe(l,a.ref,"ref cannot reference another ref layer")):g=Et(x.type):s.push(new xe(l,a.ref,`ref layer "${m}" not found`))}else if(g!=="background")if(a.source){const x=u.sources&&u.sources[a.source],_=x&&Et(x.type);x?_==="vector"&&g==="raster"?s.push(new xe(l,a.source,`layer "${a.id}" requires a raster source`)):_!=="raster-dem"&&g==="hillshade"||_!=="raster-dem"&&g==="color-relief"?s.push(new xe(l,a.source,`layer "${a.id}" requires a raster-dem source`)):_==="raster"&&g!=="raster"?s.push(new xe(l,a.source,`layer "${a.id}" requires a vector source`)):_!=="vector"||a["source-layer"]?_==="raster-dem"&&g!=="hillshade"&&g!=="color-relief"?s.push(new xe(l,a.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):g!=="line"||!a.paint||!a.paint["line-gradient"]||_==="geojson"&&x.lineMetrics||s.push(new xe(l,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):s.push(new xe(l,a,`layer "${a.id}" must specify a "source-layer"`)):s.push(new xe(l,a.source,`source "${a.source}" not found`))}else s.push(new xe(l,a,'missing required property "source"'));return g==="raster"&&(!((e=a.paint)===null||e===void 0)&&e.resampling)&&(!((i=a.paint)===null||i===void 0)&&i["raster-resampling"])&&s.push(new xe(l,a.paint,`layer "${a.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),s=s.concat(xi({key:l,value:a,valueSpec:h.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${l}.type`,value:a.type,valueSpec:h.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:a,objectKey:"type"}),filter:ul,layout:x=>xi({layer:a,key:x.key,value:x.value,style:x.style,styleSpec:x.styleSpec,validateSpec:x.validateSpec,objectElementValidators:{"*":_=>kc(Jr({layerType:g},_))}}),paint:x=>xi({layer:a,key:x.key,value:x.value,style:x.style,styleSpec:x.styleSpec,validateSpec:x.validateSpec,objectElementValidators:{"*":_=>zc(Jr({layerType:g},_))}})}})),s}function hr(r){const e=r.value,i=r.key,s=Ve(e);return s!=="string"?[new xe(i,e,`string expected, ${s} found`)]:[]}const Vs={promoteId:function({key:r,value:e}){if(Ve(e)==="string")return hr({key:r,value:e});{const i=[];for(const s in e)i.push(...hr({key:`${r}.${s}`,value:e[s]}));return i}}};function Rc(r){const e=r.value,i=r.key,s=r.styleSpec,a=r.style,l=r.validateSpec;if(!e.type)return[new xe(i,e,'"type" is required')];const u=Et(e.type);let h;switch(u){case"vector":case"raster":return h=xi({key:i,value:e,valueSpec:s[`source_${u.replace("-","_")}`],style:r.style,styleSpec:s,objectElementValidators:Vs,validateSpec:l}),h;case"raster-dem":return h=(function(g){var m;const x=(m=g.sourceName)!==null&&m!==void 0?m:"",_=g.value,T=g.styleSpec,v=T.source_raster_dem,I=g.style;let M=[];const A=Ve(_);if(_===void 0)return M;if(A!=="object")return M.push(new xe("source_raster_dem",_,`object expected, ${A} found`)),M;const D=Et(_.encoding)==="custom",L=["redFactor","greenFactor","blueFactor","baseShift"],k=g.value.encoding?`"${g.value.encoding}"`:"Default";for(const B in _)!D&&L.includes(B)?M.push(new xe(B,_[B],`In "${x}": "${B}" is only valid when "encoding" is set to "custom". ${k} encoding found`)):v[B]?M=M.concat(g.validateSpec({key:B,value:_[B],valueSpec:v[B],validateSpec:g.validateSpec,style:I,styleSpec:T})):M.push(new xe(B,_[B],`unknown property "${B}"`));return M})({sourceName:i,value:e,style:r.style,styleSpec:s,validateSpec:l}),h;case"geojson":if(h=xi({key:i,value:e,valueSpec:s.source_geojson,style:a,styleSpec:s,validateSpec:l,objectElementValidators:Vs}),e.cluster)for(const g in e.clusterProperties){const[m,x]=e.clusterProperties[g],_=typeof m=="string"?[m,["accumulated"],["get",g]]:m;h.push(...Lr({key:`${i}.${g}.map`,value:x,expressionContext:"cluster-map"})),h.push(...Lr({key:`${i}.${g}.reduce`,value:_,expressionContext:"cluster-reduce"}))}return h;case"video":return xi({key:i,value:e,valueSpec:s.source_video,style:a,validateSpec:l,styleSpec:s});case"image":return xi({key:i,value:e,valueSpec:s.source_image,style:a,validateSpec:l,styleSpec:s});case"canvas":return[new xe(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Os({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function dl(r){const e=r.value,i=r.styleSpec,s=i.light,a=r.style;let l=[];const u=Ve(e);if(e===void 0)return l;if(u!=="object")return l=l.concat([new xe("light",e,`object expected, ${u} found`)]),l;for(const h in e){const g=h.match(/^(.*)-transition$/);l=l.concat(g&&s[g[1]]&&s[g[1]].transition?r.validateSpec({key:h,value:e[h],valueSpec:i.transition,validateSpec:r.validateSpec,style:a,styleSpec:i}):s[h]?r.validateSpec({key:h,value:e[h],valueSpec:s[h],validateSpec:r.validateSpec,style:a,styleSpec:i}):[new xe(h,e[h],`unknown property "${h}"`)])}return l}function pl(r){const e=r.value,i=r.styleSpec,s=i.sky,a=r.style,l=Ve(e);if(e===void 0)return[];if(l!=="object")return[new xe("sky",e,`object expected, ${l} found`)];let u=[];for(const h in e)u=u.concat(s[h]?r.validateSpec({key:h,value:e[h],valueSpec:s[h],style:a,styleSpec:i}):[new xe(h,e[h],`unknown property "${h}"`)]);return u}function js(r){const e=r.value,i=r.styleSpec,s=i.terrain,a=r.style;let l=[];const u=Ve(e);if(e===void 0)return l;if(u!=="object")return l=l.concat([new xe("terrain",e,`object expected, ${u} found`)]),l;for(const h in e)l=l.concat(s[h]?r.validateSpec({key:h,value:e[h],valueSpec:s[h],validateSpec:r.validateSpec,style:a,styleSpec:i}):[new xe(h,e[h],`unknown property "${h}"`)]);return l}function fl(r){let e=[];const i=r.value,s=r.key;if(Array.isArray(i)){const a=[],l=[];for(const u in i)i[u].id&&a.includes(i[u].id)&&e.push(new xe(s,i,`all the sprites' ids must be unique, but ${i[u].id} is duplicated`)),a.push(i[u].id),i[u].url&&l.includes(i[u].url)&&e.push(new xe(s,i,`all the sprites' URLs must be unique, but ${i[u].url} is duplicated`)),l.push(i[u].url),e=e.concat(xi({key:`${s}[${u}]`,value:i[u],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return e}return hr({key:s,value:i})}function ml(r){return!!r&&r.constructor===Object}function Xn(r){return ml(r.value)?[]:[new xe(r.key,r.value,`object expected, ${Ve(r.value)} found`)]}const Fc={"*":()=>[],array:Bs,boolean:function(r){const e=r.value,i=r.key,s=Ve(e);return s!=="boolean"?[new xe(i,e,`boolean expected, ${s} found`)]:[]},number:qn,color:Wn,constants:Cc,enum:Os,filter:ul,function:Na,layer:hl,object:xi,source:Rc,light:dl,sky:pl,terrain:js,projection:function(r){const e=r.value,i=r.styleSpec,s=i.projection,a=r.style,l=Ve(e);if(e===void 0)return[];if(l!=="object")return[new xe("projection",e,`object expected, ${l} found`)];let u=[];for(const h in e)u=u.concat(s[h]?r.validateSpec({key:h,value:e[h],valueSpec:s[h],style:a,styleSpec:i}):[new xe(h,e[h],`unknown property "${h}"`)]);return u},projectionDefinition:function(r){const e=r.key;let i=r.value;i=i instanceof String?i.valueOf():i;const s=Ve(i);return s!=="array"||(function(a){return Array.isArray(a)&&a.length===3&&typeof a[0]=="string"&&typeof a[1]=="string"&&typeof a[2]=="number"})(i)||(function(a){return!!["interpolate","step","literal"].includes(a[0])})(i)?["array","string"].includes(s)?[]:[new xe(e,i,`projection expected, invalid type "${s}" found`)]:[new xe(e,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:hr,formatted:function(r){return hr(r).length===0?[]:Lr(r)},resolvedImage:function(r){return hr(r).length===0?[]:Lr(r)},padding:function(r){const e=r.key,i=r.value;if(Ve(i)==="array"){if(i.length<1||i.length>4)return[new xe(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const s={type:"number"};let a=[];for(let l=0;l<i.length;l++)a=a.concat(r.validateSpec({key:`${e}[${l}]`,value:i[l],validateSpec:r.validateSpec,valueSpec:s}));return a}return qn({key:e,value:i,valueSpec:{}})},numberArray:function(r){const e=r.key,i=r.value;if(Ve(i)==="array"){const s={type:"number"};if(i.length<1)return[new xe(e,i,"array length at least 1 expected, length 0 found")];let a=[];for(let l=0;l<i.length;l++)a=a.concat(r.validateSpec({key:`${e}[${l}]`,value:i[l],validateSpec:r.validateSpec,valueSpec:s}));return a}return qn({key:e,value:i,valueSpec:{}})},colorArray:function(r){const e=r.key,i=r.value;if(Ve(i)==="array"){if(i.length<1)return[new xe(e,i,"array length at least 1 expected, length 0 found")];let s=[];for(let a=0;a<i.length;a++)s=s.concat(Wn({key:`${e}[${a}]`,value:i[a]}));return s}return Wn({key:e,value:i})},variableAnchorOffsetCollection:function(r){const e=r.key,i=r.value,s=Ve(i),a=r.styleSpec;if(s!=="array"||i.length<1||i.length%2!=0)return[new xe(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let l=[];for(let u=0;u<i.length;u+=2)l=l.concat(Os({key:`${e}[${u}]`,value:i[u],valueSpec:a.layout_symbol["text-anchor"]})),l=l.concat(Bs({key:`${e}[${u+1}]`,value:i[u+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:a}));return l},sprite:fl,state:Xn,fontFaces:function(r){const e=r.key,i=r.value,s=r.validateSpec,a=r.styleSpec,l=r.style;if(!ml(i))return[new xe(e,i,`object expected, ${Ve(i)} found`)];const u=[];for(const h in i){const g=i[h],m=Ve(g);if(m==="string")u.push(...hr({key:`${e}.${h}`,value:g}));else if(m==="array"){const x={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[_,T]of g.entries())u.push(...xi({key:`${e}.${h}[${_}]`,value:T,valueSpec:x,styleSpec:a,style:l,validateSpec:s}))}else u.push(new xe(`${e}.${h}`,g,`string or array expected, ${m} found`))}return u}};function Ua(r){const e=r.value,i=r.valueSpec,s=r.styleSpec;return r.validateSpec=Ua,i.expression&&Oa(Et(e))?Na(r):i.expression&&Va(Fr(e))?Lr(r):i.type&&Fc[i.type]?Fc[i.type](r):xi(Jr({},r,{valueSpec:i.type?s[i.type]:i}))}function Lc(r){const e=r.value,i=r.key,s=hr(r);return s.length||(e.indexOf("{fontstack}")===-1&&s.push(new xe(i,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&s.push(new xe(i,e,'"glyphs" url must include a "{range}" token'))),s}function Ni(r,e=he){let i=[];return i=i.concat(Ua({key:"",value:r,valueSpec:e.$root,styleSpec:e,style:r,validateSpec:Ua,objectElementValidators:{glyphs:Lc,"*":()=>[]}})),r.constants&&(i=i.concat(Cc({key:"constants",value:r.constants}))),Bc(i)}function Ki(r){return function(e){return r(Object.assign({},e,{validateSpec:Ua}))}}function Bc(r){return[].concat(r).sort(((e,i)=>e.line-i.line))}function di(r){return function(...e){return Bc(r.apply(this,e))}}Ni.source=di(Ki(Rc)),Ni.sprite=di(Ki(fl)),Ni.glyphs=di(Ki(Lc)),Ni.light=di(Ki(dl)),Ni.sky=di(Ki(pl)),Ni.terrain=di(Ki(js)),Ni.state=di(Ki(Xn)),Ni.layer=di(Ki(hl)),Ni.filter=di(Ki(ul)),Ni.paintProperty=di(Ki(zc)),Ni.layoutProperty=di(Ki(kc));const Ns={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class Ci{constructor(e,i){this._globalState=i,this.setValue(e)}evaluate(){var e;return(e=this._literalValue)!==null&&e!==void 0?e: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);const i=Ds(e,Ns,this._globalState);if(i.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,new Error(i.value.map((s=>`${s.key}: ${s.message}`)).join(", "));this._literalValue=void 0,this._compiledValue=i.value,this._globalStateRefs=Rs(i.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}const Us=he,dn=Ni,Yu=dn.light,Ku=dn.sky,Gs=dn.paintProperty,Oc=dn.layoutProperty;function Ga(r,e){let i=!1;if(e&&e.length)for(const s of e)r.fire(new pa(new Error(s.message))),i=!0;return i}class $s{constructor(e,i,s){const a=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const u=new Int32Array(this.arrayBuffer);e=u[0],this.d=(i=u[1])+2*(s=u[2]);for(let g=0;g<this.d*this.d;g++){const m=u[3+g],x=u[3+g+1];a.push(m===x?null:u.subarray(m,x))}const h=u[3+a.length+1];this.keys=u.subarray(u[3+a.length],h),this.bboxes=u.subarray(h),this.insert=this._insertReadonly}else{this.d=i+2*s;for(let u=0;u<this.d*this.d;u++)a.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=e,this.padding=s,this.scale=i/e,this.uid=0;const l=s/i*e;this.min=-l,this.max=e+l}insert(e,i,s,a,l){this._forEachCell(i,s,a,l,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(i),this.bboxes.push(s),this.bboxes.push(a),this.bboxes.push(l)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,i,s,a,l,u){this.cells[l].push(u)}query(e,i,s,a,l){const u=this.min,h=this.max;if(e<=u&&i<=u&&h<=s&&h<=a&&!l)return[...this.keys];{const g=[];return this._forEachCell(e,i,s,a,this._queryCell,g,{},l),g}}_queryCell(e,i,s,a,l,u,h,g){const m=this.cells[l];if(m!==null){const x=this.keys,_=this.bboxes;for(let T=0;T<m.length;T++){const v=m[T];if(h[v]===void 0){const I=4*v;(g?g(_[I+0],_[I+1],_[I+2],_[I+3]):e<=_[I+2]&&i<=_[I+3]&&s>=_[I+0]&&a>=_[I+1])?(h[v]=!0,u.push(x[v])):h[v]=!1}}}}_forEachCell(e,i,s,a,l,u,h,g){const m=this._convertToCellCoord(e),x=this._convertToCellCoord(i),_=this._convertToCellCoord(s),T=this._convertToCellCoord(a);for(let v=m;v<=_;v++)for(let I=x;I<=T;I++){const M=this.d*I+v;if((!g||g(this._convertFromCellCoord(v),this._convertFromCellCoord(I),this._convertFromCellCoord(v+1),this._convertFromCellCoord(I+1)))&&l.call(this,e,i,s,a,M,u,h,g))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;const e=this.cells,i=3+this.cells.length+1+1;let s=0;for(let u=0;u<this.cells.length;u++)s+=this.cells[u].length;const a=new Int32Array(i+s+this.keys.length+this.bboxes.length);a[0]=this.extent,a[1]=this.n,a[2]=this.padding;let l=i;for(let u=0;u<e.length;u++){const h=e[u];a[3+u]=l,a.set(h,l),l+=h.length}return a[3+e.length]=l,a.set(this.keys,l),l+=this.keys.length,a[3+e.length+1]=l,a.set(this.bboxes,l),l+=this.bboxes.length,a.buffer}static serialize(e,i){const s=e.toArrayBuffer();return i&&i.push(s),{buffer:s}}static deserialize(e){return new $s(e.buffer)}}const Ji={};function Se(r,e,i={}){if(Ji[r])throw new Error(`${r} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:r,writeable:!1}),Ji[r]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}Se("Object",Object),Se("Set",Set),Se("TransferableGridIndex",$s),Se("Color",Ne),Se("Error",Error),Se("AJAXError",En),Se("ResolvedImage",ii),Se("StylePropertyFunction",hn),Se("StyleExpression",il,{omit:["_evaluator"]}),Se("ZoomDependentExpression",rl),Se("ZoomConstantExpression",zs),Se("CompoundExpression",ji,{omit:["_evaluate"]});for(const r in Un)Un[r]._classRegistryKey||Se(`Expression_${r}`,Un[r]);function Hn(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function gl(r){return r.$name||r.constructor._classRegistryKey}function Vc(r){return!(function(e){if(e===null||typeof e!="object")return!1;const i=gl(e);return!(!i||i==="Object")})(r)&&(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error||Hn(r)||Mr(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function Zs(r,e){if(Vc(r))return(Hn(r)||Mr(r))&&e&&e.push(r),ArrayBuffer.isView(r)&&e&&e.push(r.buffer),r instanceof ImageData&&e&&e.push(r.data.buffer),r;if(Array.isArray(r)){const l=[];for(const u of r)l.push(Zs(u,e));return l}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const i=gl(r);if(!i)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!Ji[i])throw new Error(`${i} is not registered.`);const{klass:s}=Ji[i],a=s.serialize?s.serialize(r,e):{};if(s.serialize){if(e&&a===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const l in r){if(!r.hasOwnProperty(l)||Ji[i].omit.indexOf(l)>=0)continue;const u=r[l];a[l]=Ji[i].shallow.indexOf(l)>=0?u:Zs(u,e)}r instanceof Error&&(a.message=r.message)}if(a.$name)throw new Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(a.$name=i),a}function dr(r){if(Vc(r))return r;if(Array.isArray(r))return r.map(dr);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const e=gl(r)||"Object";if(!Ji[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=Ji[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(r);const s=Object.create(i.prototype);for(const a of Object.keys(r)){if(a==="$name")continue;const l=r[a];s[a]=Ji[e].shallow.indexOf(a)>=0?l:dr(l)}return s}class _l{constructor(){this.first=!0}update(e,i){const s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=i):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=i),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=s,!0))}}function Ju(r){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(r))}function Yn(r){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(r))}function jc(r){return/\s/u.test(String.fromCodePoint(r))}function qs(r){for(const e of r)if(Yn(e.codePointAt(0)))return!0;return!1}function $a(r){for(const e of r)if(!Uc(e.codePointAt(0)))return!1;return!0}function yl(r){const e=r.map((i=>{try{return new RegExp(`\\p{sc=${i}}`,"u").source}catch{return null}})).filter((i=>i));return new RegExp(e.join("|"),"u")}const Nc=yl(["Arab","Dupl","Mong","Ougr","Syrc"]);function Uc(r){return!Nc.test(String.fromCodePoint(r))}function xl(r){return!(Yn(r)||(e=r,/[\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(e))));var e}const vl=yl(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function bl(r){return vl.test(String.fromCodePoint(r))}function Qu(r,e){return!(!e&&bl(r)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(r)))}function Gc(r){for(const e of r)if(bl(e.codePointAt(0)))return!0;return!1}const Br=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(r){this.pluginStatus=r.pluginStatus,this.pluginURL=r.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(r){if(Br.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=r.applyArabicShaping,this.processBidirectionalText=r.processBidirectionalText,this.processStyledBidirectionalText=r.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(r,e){return d(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if(r.pluginStatus!=="loading")return this.setState(r),r;const i=r.pluginURL,s=new Promise((l=>{this.loadScriptResolve=l}));e(i);const a=new Promise((l=>setTimeout((()=>l()),this.TIMEOUT)));if(yield Promise.race([s,a]),this.isParsed()){const l={pluginStatus:"loaded",pluginURL:i};return this.setState(l),l}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${i}`)}))}};class nt{constructor(e,i){this.isSupportedScript=eh,this.zoom=e,i?(this.now=i.now||0,this.fadeDuration=i.fadeDuration||0,this.zoomHistory=i.zoomHistory||new _l,this.transition=i.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new _l,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,i=e-Math.floor(e),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:i+(1-i)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*i}}}function eh(r){return(function(e,i){for(const s of e)if(!Qu(s.codePointAt(0),i))return!1;return!0})(r,Br.getRTLTextPluginStatus()==="loaded")}const Ws="-transition";class Xs{constructor(e,i,s){this.property=e,this.value=i,this.expression=(function(a,l,u){if(Oa(a))return new hn(a,l);if(Va(a)){const h=Mc(a,l,u);if(h.result==="error")throw new Error(h.value.map((g=>`${g.key}: ${g.message}`)).join(", "));return h.value}{let h=a;return l.type==="color"&&typeof a=="string"?h=Ne.parse(a):l.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?l.type!=="numberArray"||typeof a!="number"&&!Array.isArray(a)?l.type!=="colorArray"||typeof a!="string"&&!Array.isArray(a)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(a)?h=ti.parse(a):l.type==="projectionDefinition"&&typeof a=="string"&&(h=ri.parse(a)):h=vt.parse(a):h=kt.parse(a):h=De.parse(a),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>h}}})(i===void 0?e.specification.default:i,e.specification,s)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,i,s){return this.property.possiblyEvaluate(this,e,i,s)}}class wl{constructor(e,i){this.property=e,this.value=new Xs(e,void 0,i)}transitioned(e,i){return new Tl(this.property,this.value,i,Ri({},e.transition,this.transition),e.now)}untransitioned(){return new Tl(this.property,this.value,null,{},0)}}class $c{constructor(e,i){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=i}getValue(e){return $e(this._values[e].value.value)}setValue(e,i){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new wl(this._values[e].property,this._globalState)),this._values[e].value=new Xs(this._values[e].property,i===null?void 0:$e(i),this._globalState)}getTransition(e){return $e(this._values[e].transition)}setTransition(e,i){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new wl(this._values[e].property,this._globalState)),this._values[e].transition=$e(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s);const a=this.getTransition(i);a!==void 0&&(e[`${i}${Ws}`]=a)}return e}transitioned(e,i){const s=new Sl(this._properties);for(const a of Object.keys(this._values))s._values[a]=this._values[a].transitioned(e,i._values[a]);return s}untransitioned(){const e=new Sl(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class Tl{constructor(e,i,s,a,l){this.property=e,this.value=i,this.begin=l+a.delay||0,this.end=this.begin+a.duration||0,e.specification.transition&&(a.delay||a.duration)&&(this.prior=s)}possiblyEvaluate(e,i,s){const a=e.now||0,l=this.value.possiblyEvaluate(e,i,s),u=this.prior;if(u){if(a>this.end)return this.prior=null,l;if(this.value.isDataDriven())return this.prior=null,l;if(a<this.begin)return u.possiblyEvaluate(e,i,s);{const h=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(u.possiblyEvaluate(e,i,s),l,Wr(h))}}return l}}class Sl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,s){const a=new pn(this._properties);for(const l of Object.keys(this._values))a._values[l]=this._values[l].possiblyEvaluate(e,i,s);return a}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Zc{constructor(e,i){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=i}hasValue(e){return this._values[e].value!==void 0}getValue(e){return $e(this._values[e].value)}setValue(e,i){this._values[e]=new Xs(this._values[e].property,i===null?void 0:$e(i),this._globalState)}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s)}return e}possiblyEvaluate(e,i,s){const a=new pn(this._properties);for(const l of Object.keys(this._values))a._values[l]=this._values[l].possiblyEvaluate(e,i,s);return a}}class Qi{constructor(e,i,s){this.property=e,this.value=i,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,s,a){return this.property.evaluate(this.value,this.parameters,e,i,s,a)}}class pn{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ie{constructor(e){this.specification=e}possiblyEvaluate(e,i){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(i)}interpolate(e,i,s){const a=Yi[this.specification.type];return a?a(e,i,s):e}}class Ce{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,s,a){return new Qi(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(i,null,{},s,a)}:e.expression,i)}interpolate(e,i,s){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new Qi(this,{kind:"constant",value:void 0},e.parameters);const a=Yi[this.specification.type];if(a){const l=a(e.value.value,i.value.value,s);return new Qi(this,{kind:"constant",value:l},e.parameters)}return e}evaluate(e,i,s,a,l,u){return e.kind==="constant"?e.value:e.evaluate(i,s,a,l,u)}}class Hs extends Ce{possiblyEvaluate(e,i,s,a){if(e.value===void 0)return new Qi(this,{kind:"constant",value:void 0},i);if(e.expression.kind==="constant"){const l=e.expression.evaluate(i,null,{},s,a),u=e.property.specification.type==="resolvedImage"&&typeof l!="string"?l.name:l,h=this._calculate(u,u,u,i);return new Qi(this,{kind:"constant",value:h},i)}if(e.expression.kind==="camera"){const l=this._calculate(e.expression.evaluate({zoom:i.zoom-1}),e.expression.evaluate({zoom:i.zoom}),e.expression.evaluate({zoom:i.zoom+1}),i);return new Qi(this,{kind:"constant",value:l},i)}return new Qi(this,e.expression,i)}evaluate(e,i,s,a,l,u){if(e.kind==="source"){const h=e.evaluate(i,s,a,l,u);return this._calculate(h,h,h,i)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(i.zoom)-1},s,a),e.evaluate({zoom:Math.floor(i.zoom)},s,a),e.evaluate({zoom:Math.floor(i.zoom)+1},s,a),i):e.value}_calculate(e,i,s,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:e,to:i}:{from:s,to:i}}interpolate(e){return e}}class qc{constructor(e){this.specification=e}possiblyEvaluate(e,i,s,a){if(e.value!==void 0){if(e.expression.kind==="constant"){const l=e.expression.evaluate(i,null,{},s,a);return this._calculate(l,l,l,i)}return this._calculate(e.expression.evaluate(new nt(Math.floor(i.zoom-1),i)),e.expression.evaluate(new nt(Math.floor(i.zoom),i)),e.expression.evaluate(new nt(Math.floor(i.zoom+1),i)),i)}}_calculate(e,i,s,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:e,to:i}:{from:s,to:i}}interpolate(e){return e}}class Ys{constructor(e){this.specification=e}possiblyEvaluate(e,i,s,a){return!!e.expression.evaluate(i,null,{},s,a)}interpolate(){return!1}}class ni{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const i in e){const s=e[i];s.specification.overridable&&this.overridableProperties.push(i);const a=this.defaultPropertyValues[i]=new Xs(s,void 0,void 0),l=this.defaultTransitionablePropertyValues[i]=new wl(s,void 0);this.defaultTransitioningPropertyValues[i]=l.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=a.possiblyEvaluate({})}}}Se("DataDrivenProperty",Ce),Se("DataConstantProperty",Ie),Se("CrossFadedDataDrivenProperty",Hs),Se("CrossFadedProperty",qc),Se("ColorRampProperty",Ys);class Ui extends fa{constructor(e,i,s){if(super(),this.id=e.id,this.type=e.type,this._globalState=s,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=(function(a,l){return new Ci(a,l)})(this.visibility,s),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=Fs(e.filter,s)),i.layout&&(this._unevaluatedLayout=new Zc(i.layout,s)),i.paint)){this._transitionablePaint=new $c(i.paint,s);for(const a in e.paint)this.setPaintProperty(a,e.paint[a],{validate:!1});for(const a in e.layout)this.setLayoutProperty(a,e.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new pn(i.paint)}}setFilter(e){this.filter=e,this._featureFilter=Fs(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){const e=new Set;for(const i of this._visibilityExpression.getGlobalStateRefs())e.add(i);if(this._unevaluatedLayout)for(const i in this._unevaluatedLayout._values){const s=this._unevaluatedLayout._values[i];for(const a of s.getGlobalStateRefs())e.add(a)}for(const i of this._featureFilter.getGlobalStateRefs())e.add(i);return e}getPaintAffectingGlobalStateRefs(){var e;const i=new globalThis.Map;if(this._transitionablePaint)for(const s in this._transitionablePaint._values){const a=this._transitionablePaint._values[s].value;for(const l of a.getGlobalStateRefs()){const u=(e=i.get(l))!==null&&e!==void 0?e:[];u.push({name:s,value:a.value}),i.set(l,u)}}return i}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,i,s={}){if(i==null||!this._validate(Oc,`layers.${this.id}.layout.${e}`,e,i,s))return e==="visibility"?(this.visibility=i,this._visibilityExpression.setValue(i),void this.recalculateVisibility()):void this._unevaluatedLayout.setValue(e,i)}getPaintProperty(e){return e.endsWith(Ws)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i,s={}){if(i!=null&&this._validate(Gs,`layers.${this.id}.paint.${e}`,e,i,s))return!1;if(e.endsWith(Ws))return this._transitionablePaint.setTransition(e.slice(0,-11),i||void 0),!1;{const a=this._transitionablePaint._values[e],l=a.property.specification["property-type"]==="cross-faded-data-driven",u=a.value.isDataDriven(),h=a.value;this._transitionablePaint.setValue(e,i),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||u||l||this._handleOverridablePaintPropertyUpdate(e,h,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,i,s){return!1}isHidden(e=this.minzoom,i=!1){return!!(this.minzoom&&e<(i?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,i){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){const 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&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),xt(e,((i,s)=>!(i===void 0||s==="layout"&&!Object.keys(i).length||s==="paint"&&!Object.keys(i).length)))}_validate(e,i,s,a,l={}){return(!l||l.validate!==!1)&&Ga(this,e.call(dn,{key:i,layerType:this.type,objectKey:s,value:a,styleSpec:he,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof Qi&&$n(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}}let Wc;var th={get paint(){return Wc=Wc||new ni({"raster-opacity":new Ie(he.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ie(he.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ie(he.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ie(he.paint_raster["raster-brightness-max"]),"raster-saturation":new Ie(he.paint_raster["raster-saturation"]),"raster-contrast":new Ie(he.paint_raster["raster-contrast"]),resampling:new Ie(he.paint_raster.resampling),"raster-resampling":new Ie(he.paint_raster["raster-resampling"]),"raster-fade-duration":new Ie(he.paint_raster["raster-fade-duration"])})}};class ih extends Ui{constructor(e,i){super(e,th,i)}}const rh={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ks{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class st{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_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);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}}function Ct(r,e=1){let i=0,s=0;return{members:r.map((a=>{const l=rh[a.type].BYTES_PER_ELEMENT,u=i=Xc(i,Math.max(e,l)),h=a.components||1;return s=Math.max(s,l),i+=l*h,{name:a.name,type:a.type,components:h,offset:u}})),size:Xc(i,Math.max(s,e)),alignment:e}}function Xc(r,e){return Math.ceil(r/e)*e}class Js extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const a=2*e;return this.int16[a+0]=i,this.int16[a+1]=s,e}}Js.prototype.bytesPerElement=4,Se("StructArrayLayout2i4",Js);class Qs extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const l=3*e;return this.int16[l+0]=i,this.int16[l+1]=s,this.int16[l+2]=a,e}}Qs.prototype.bytesPerElement=6,Se("StructArrayLayout3i6",Qs);class Za extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,s,a)}emplace(e,i,s,a,l){const u=4*e;return this.int16[u+0]=i,this.int16[u+1]=s,this.int16[u+2]=a,this.int16[u+3]=l,e}}Za.prototype.bytesPerElement=8,Se("StructArrayLayout4i8",Za);class Pl extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,l,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a,l,u)}emplace(e,i,s,a,l,u,h){const g=6*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=a,this.int16[g+3]=l,this.int16[g+4]=u,this.int16[g+5]=h,e}}Pl.prototype.bytesPerElement=12,Se("StructArrayLayout2i4i12",Pl);class Il extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,l,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a,l,u)}emplace(e,i,s,a,l,u,h){const g=4*e,m=8*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.uint8[m+4]=a,this.uint8[m+5]=l,this.uint8[m+6]=u,this.uint8[m+7]=h,e}}Il.prototype.bytesPerElement=8,Se("StructArrayLayout2i4ub8",Il);class er extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const a=2*e;return this.float32[a+0]=i,this.float32[a+1]=s,e}}er.prototype.bytesPerElement=8,Se("StructArrayLayout2f8",er);class qa extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,l,u,h,g,m,x){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,s,a,l,u,h,g,m,x)}emplace(e,i,s,a,l,u,h,g,m,x,_){const T=10*e;return this.uint16[T+0]=i,this.uint16[T+1]=s,this.uint16[T+2]=a,this.uint16[T+3]=l,this.uint16[T+4]=u,this.uint16[T+5]=h,this.uint16[T+6]=g,this.uint16[T+7]=m,this.uint16[T+8]=x,this.uint16[T+9]=_,e}}qa.prototype.bytesPerElement=20,Se("StructArrayLayout10ui20",qa);class ea extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,l,u,h,g){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,s,a,l,u,h,g)}emplace(e,i,s,a,l,u,h,g,m){const x=8*e;return this.uint16[x+0]=i,this.uint16[x+1]=s,this.uint16[x+2]=a,this.uint16[x+3]=l,this.uint16[x+4]=u,this.uint16[x+5]=h,this.uint16[x+6]=g,this.uint16[x+7]=m,e}}ea.prototype.bytesPerElement=16,Se("StructArrayLayout8ui16",ea);class Wa extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,l,u,h,g,m,x,_,T){const v=this.length;return this.resize(v+1),this.emplace(v,e,i,s,a,l,u,h,g,m,x,_,T)}emplace(e,i,s,a,l,u,h,g,m,x,_,T,v){const I=12*e;return this.int16[I+0]=i,this.int16[I+1]=s,this.int16[I+2]=a,this.int16[I+3]=l,this.uint16[I+4]=u,this.uint16[I+5]=h,this.uint16[I+6]=g,this.uint16[I+7]=m,this.int16[I+8]=x,this.int16[I+9]=_,this.int16[I+10]=T,this.int16[I+11]=v,e}}Wa.prototype.bytesPerElement=24,Se("StructArrayLayout4i4ui4i24",Wa);class ta extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const l=3*e;return this.float32[l+0]=i,this.float32[l+1]=s,this.float32[l+2]=a,e}}ta.prototype.bytesPerElement=12,Se("StructArrayLayout3f12",ta);class Ml extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}Ml.prototype.bytesPerElement=4,Se("StructArrayLayout1ul4",Ml);class Kn extends st{_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,i,s,a,l,u,h,g,m){const x=this.length;return this.resize(x+1),this.emplace(x,e,i,s,a,l,u,h,g,m)}emplace(e,i,s,a,l,u,h,g,m,x){const _=10*e,T=5*e;return this.int16[_+0]=i,this.int16[_+1]=s,this.int16[_+2]=a,this.int16[_+3]=l,this.int16[_+4]=u,this.int16[_+5]=h,this.uint32[T+3]=g,this.uint16[_+8]=m,this.uint16[_+9]=x,e}}Kn.prototype.bytesPerElement=20,Se("StructArrayLayout6i1ul2ui20",Kn);class fn extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,l,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a,l,u)}emplace(e,i,s,a,l,u,h){const g=6*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=a,this.int16[g+3]=l,this.int16[g+4]=u,this.int16[g+5]=h,e}}fn.prototype.bytesPerElement=12,Se("StructArrayLayout2i2i2i12",fn);class El extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a,l)}emplace(e,i,s,a,l,u){const h=4*e,g=8*e;return this.float32[h+0]=i,this.float32[h+1]=s,this.float32[h+2]=a,this.int16[g+6]=l,this.int16[g+7]=u,e}}El.prototype.bytesPerElement=16,Se("StructArrayLayout2f1f2i16",El);class Xa extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,l,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a,l,u)}emplace(e,i,s,a,l,u,h){const g=16*e,m=4*e,x=8*e;return this.uint8[g+0]=i,this.uint8[g+1]=s,this.float32[m+1]=a,this.float32[m+2]=l,this.int16[x+6]=u,this.int16[x+7]=h,e}}Xa.prototype.bytesPerElement=16,Se("StructArrayLayout2ub2f2i16",Xa);class Or extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const l=3*e;return this.uint16[l+0]=i,this.uint16[l+1]=s,this.uint16[l+2]=a,e}}Or.prototype.bytesPerElement=6,Se("StructArrayLayout3ui6",Or);class Cl extends st{_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,i,s,a,l,u,h,g,m,x,_,T,v,I,M,A,D){const L=this.length;return this.resize(L+1),this.emplace(L,e,i,s,a,l,u,h,g,m,x,_,T,v,I,M,A,D)}emplace(e,i,s,a,l,u,h,g,m,x,_,T,v,I,M,A,D,L){const k=24*e,B=12*e,O=48*e;return this.int16[k+0]=i,this.int16[k+1]=s,this.uint16[k+2]=a,this.uint16[k+3]=l,this.uint32[B+2]=u,this.uint32[B+3]=h,this.uint32[B+4]=g,this.uint16[k+10]=m,this.uint16[k+11]=x,this.uint16[k+12]=_,this.float32[B+7]=T,this.float32[B+8]=v,this.uint8[O+36]=I,this.uint8[O+37]=M,this.uint8[O+38]=A,this.uint32[B+10]=D,this.int16[k+22]=L,e}}Cl.prototype.bytesPerElement=48,Se("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Cl);class Al extends st{_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,i,s,a,l,u,h,g,m,x,_,T,v,I,M,A,D,L,k,B,O,U,H,J,ee,re,ue,le){const ce=this.length;return this.resize(ce+1),this.emplace(ce,e,i,s,a,l,u,h,g,m,x,_,T,v,I,M,A,D,L,k,B,O,U,H,J,ee,re,ue,le)}emplace(e,i,s,a,l,u,h,g,m,x,_,T,v,I,M,A,D,L,k,B,O,U,H,J,ee,re,ue,le,ce){const se=32*e,ye=16*e;return this.int16[se+0]=i,this.int16[se+1]=s,this.int16[se+2]=a,this.int16[se+3]=l,this.int16[se+4]=u,this.int16[se+5]=h,this.int16[se+6]=g,this.int16[se+7]=m,this.uint16[se+8]=x,this.uint16[se+9]=_,this.uint16[se+10]=T,this.uint16[se+11]=v,this.uint16[se+12]=I,this.uint16[se+13]=M,this.uint16[se+14]=A,this.uint16[se+15]=D,this.uint16[se+16]=L,this.uint16[se+17]=k,this.uint16[se+18]=B,this.uint16[se+19]=O,this.uint16[se+20]=U,this.uint16[se+21]=H,this.uint16[se+22]=J,this.uint32[ye+12]=ee,this.float32[ye+13]=re,this.float32[ye+14]=ue,this.uint16[se+30]=le,this.uint16[se+31]=ce,e}}Al.prototype.bytesPerElement=64,Se("StructArrayLayout8i15ui1ul2f2ui64",Al);class ia extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}ia.prototype.bytesPerElement=4,Se("StructArrayLayout1f4",ia);class Dl extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const l=3*e;return this.uint16[6*e+0]=i,this.float32[l+1]=s,this.float32[l+2]=a,e}}Dl.prototype.bytesPerElement=12,Se("StructArrayLayout1ui2f12",Dl);class p extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const l=4*e;return this.uint32[2*e+0]=i,this.uint16[l+2]=s,this.uint16[l+3]=a,e}}p.prototype.bytesPerElement=8,Se("StructArrayLayout1ul2ui8",p);class t extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=s,e}}t.prototype.bytesPerElement=4,Se("StructArrayLayout2ui4",t);class n extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}n.prototype.bytesPerElement=2,Se("StructArrayLayout1ui2",n);class o extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,s,a)}emplace(e,i,s,a,l){const u=4*e;return this.float32[u+0]=i,this.float32[u+1]=s,this.float32[u+2]=a,this.float32[u+3]=l,e}}o.prototype.bytesPerElement=16,Se("StructArrayLayout4f16",o);class c extends Ks{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 we(this.anchorPointX,this.anchorPointY)}}c.prototype.size=20;class f extends Kn{get(e){return new c(this,e)}}Se("CollisionBoxArray",f);class y extends Ks{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]}}y.prototype.size=48;class b extends Cl{get(e){return new y(this,e)}}Se("PlacedSymbolArray",b);class w extends Ks{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]}}w.prototype.size=64;class S extends Al{get(e){return new w(this,e)}}Se("SymbolInstanceArray",S);class P extends ia{getoffsetX(e){return this.float32[1*e+0]}}Se("GlyphOffsetArray",P);class E extends Qs{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Se("SymbolLineVertexArray",E);class C extends Ks{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]}}C.prototype.size=12;class z extends Dl{get(e){return new C(this,e)}}Se("TextAnchorOffsetArray",z);class F extends Ks{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]}}F.prototype.size=8;class V extends p{get(e){return new F(this,e)}}Se("FeatureIndexArray",V);class j extends Js{}class N extends Js{}class $ extends Js{}class W extends Pl{}class G extends Il{}class q extends er{}class Y extends qa{}class Z extends ea{}class Q extends Wa{}class ae extends ta{}class oe extends Ml{}class ie extends fn{}class ne extends Xa{}class pe extends Or{}class fe extends t{}const de=Ct([{name:"a_pos",components:2,type:"Int16"}],4),{members:Pe}=de;class Me{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,i,s,a){const l=this.segments[this.segments.length-1];return e>Me.MAX_VERTEX_ARRAY_LENGTH&&Ut(`Max vertices per segment is ${Me.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Me.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!l||l.vertexLength+e>Me.MAX_VERTEX_ARRAY_LENGTH||l.sortKey!==a?this.createNewSegment(i,s,a):l}createNewSegment(e,i,s){const a={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0,vaos:{}};return s!==void 0&&(a.sortKey=s),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(a),a}getOrCreateLatestSegment(e,i,s){return this.prepareSegment(0,e,i,s)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,s,a){return new Me([{vertexOffset:e,primitiveOffset:i,vertexLength:s,primitiveLength:a,vaos:{},sortKey:0}])}}function et(r,e){return 256*(r=Si(Math.floor(r),0,255))+Si(Math.floor(e),0,255)}Me.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Se("SegmentVector",Me);const ht=Ct([{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"}]),ct=Ct([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var ft,ot,Rt,lt={exports:{}},Zt={exports:{}},At={exports:{}},Ft=(function(){if(Rt)return lt.exports;Rt=1;var r=(ft||(ft=1,Zt.exports=function(i,s){var a,l,u,h,g,m,x,_;for(l=i.length-(a=3&i.length),u=s,g=3432918353,m=461845907,_=0;_<l;)x=255&i.charCodeAt(_)|(255&i.charCodeAt(++_))<<8|(255&i.charCodeAt(++_))<<16|(255&i.charCodeAt(++_))<<24,++_,u=27492+(65535&(h=5*(65535&(u=(u^=x=(65535&(x=(x=(65535&x)*g+(((x>>>16)*g&65535)<<16)&4294967295)<<15|x>>>17))*m+(((x>>>16)*m&65535)<<16)&4294967295)<<13|u>>>19))+((5*(u>>>16)&65535)<<16)&4294967295))+((58964+(h>>>16)&65535)<<16);switch(x=0,a){case 3:x^=(255&i.charCodeAt(_+2))<<16;case 2:x^=(255&i.charCodeAt(_+1))<<8;case 1:u^=x=(65535&(x=(x=(65535&(x^=255&i.charCodeAt(_)))*g+(((x>>>16)*g&65535)<<16)&4294967295)<<15|x>>>17))*m+(((x>>>16)*m&65535)<<16)&4294967295}return u^=i.length,u=2246822507*(65535&(u^=u>>>16))+((2246822507*(u>>>16)&65535)<<16)&4294967295,u=3266489909*(65535&(u^=u>>>13))+((3266489909*(u>>>16)&65535)<<16)&4294967295,(u^=u>>>16)>>>0}),Zt.exports),e=(ot||(ot=1,At.exports=function(i,s){for(var a,l=i.length,u=s^l,h=0;l>=4;)a=1540483477*(65535&(a=255&i.charCodeAt(h)|(255&i.charCodeAt(++h))<<8|(255&i.charCodeAt(++h))<<16|(255&i.charCodeAt(++h))<<24))+((1540483477*(a>>>16)&65535)<<16),u=1540483477*(65535&u)+((1540483477*(u>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),l-=4,++h;switch(l){case 3:u^=(255&i.charCodeAt(h+2))<<16;case 2:u^=(255&i.charCodeAt(h+1))<<8;case 1:u=1540483477*(65535&(u^=255&i.charCodeAt(h)))+((1540483477*(u>>>16)&65535)<<16)}return u=1540483477*(65535&(u^=u>>>13))+((1540483477*(u>>>16)&65535)<<16),(u^=u>>>15)>>>0}),At.exports);return lt.exports=r,lt.exports.murmur3=r,lt.exports.murmur2=e,lt.exports})(),si=Tr(Ft);class sr{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,i,s,a){this.ids.push(Vr(e)),this.positions.push(i,s,a)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const i=Vr(e);let s=0,a=this.ids.length-1;for(;s<a;){const u=s+a>>1;this.ids[u]>=i?a=u:s=u+1}const l=[];for(;this.ids[s]===i;)l.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return l}static serialize(e,i){const s=new Float64Array(e.ids),a=new Uint32Array(e.positions);return pr(s,a,0,s.length-1),i&&i.push(s.buffer,a.buffer),{ids:s,positions:a}}static deserialize(e){const i=new sr;return i.ids=e.ids,i.positions=e.positions,i.indexed=!0,i}}function Vr(r){const e=+r;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:si(String(r))}function pr(r,e,i,s){for(;i<s;){const a=r[i+s>>1];let l=i-1,u=s+1;for(;;){do l++;while(r[l]<a);do u--;while(r[u]>a);if(l>=u)break;fr(r,l,u),fr(e,3*l,3*u),fr(e,3*l+1,3*u+1),fr(e,3*l+2,3*u+2)}u-i<s-u?(pr(r,e,i,u),i=u+1):(pr(r,e,u+1,s),s=u)}}function fr(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}Se("FeaturePositionMap",sr);class Gi{constructor(e,i){this.gl=e.gl,this.location=i}}class mn extends Gi{constructor(e,i){super(e,i),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class gn extends Gi{constructor(e,i){super(e,i),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 Ai extends Gi{constructor(e,i){super(e,i),this.current=Ne.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))}}const jr=new Float32Array(16);function mr(r){return[et(255*r.r,255*r.g),et(255*r.b,255*r.a)]}class gr{constructor(e,i,s){this.value=e,this.uniformNames=i.map((a=>`u_${a}`)),this.type=s}setUniform(e,i,s){e.set(s.constantOr(this.value))}getBinding(e,i,s){return this.type==="color"?new Ai(e,i):new mn(e,i)}}class mt{constructor(e,i){this.uniformNames=i.map((s=>`u_${s}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,i){this.pixelRatioFrom=i.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=i.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,i){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,i.y,i.height,i.width]}setUniform(e,i,s,a){let l=null;a==="u_pattern_to"?l=this.patternTo:a==="u_pattern_from"?l=this.patternFrom:a==="u_dasharray_to"?l=this.dashTo:a==="u_dasharray_from"?l=this.dashFrom:a==="u_pixel_ratio_to"?l=this.pixelRatioTo:a==="u_pixel_ratio_from"&&(l=this.pixelRatioFrom),l!==null&&e.set(l)}getBinding(e,i,s){return s.startsWith("u_pattern")||s.startsWith("u_dasharray_")?new gn(e,i):new mn(e,i)}}class dt{constructor(e,i,s,a){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=i.map((l=>({name:`a_${l}`,type:"Float32",components:s==="color"?2:1,offset:0}))),this.paintVertexArray=new a}populatePaintArray(e,i,s){const a=this.paintVertexArray.length,l=this.expression.evaluate(new nt(0,s),i,{},s.canonical,[],s.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(a,e,l)}updatePaintArray(e,i,s,a,l){const u=this.expression.evaluate(new nt(0,l),s,a);this._setPaintValue(e,i,u)}_setPaintValue(e,i,s){if(this.type==="color"){const a=mr(s);for(let l=e;l<i;l++)this.paintVertexArray.emplace(l,a[0],a[1])}else{for(let a=e;a<i;a++)this.paintVertexArray.emplace(a,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(e){var i;!((i=this.paintVertexArray)===null||i===void 0)&&i.arrayBuffer.byteLength&&(this.paintVertexBuffer&&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 Dt{constructor(e,i,s,a,l,u){this.expression=e,this.uniformNames=i.map((h=>`u_${h}_t`)),this.type=s,this.useIntegerZoom=a,this.zoom=l,this.maxValue=0,this.paintVertexAttributes=i.map((h=>({name:`a_${h}`,type:"Float32",components:s==="color"?4:2,offset:0}))),this.paintVertexArray=new u}populatePaintArray(e,i,s){const a=this.expression.evaluate(new nt(this.zoom,s),i,{},s.canonical,[],s.formattedSection),l=this.expression.evaluate(new nt(this.zoom+1,s),i,{},s.canonical,[],s.formattedSection),u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(u,e,a,l)}updatePaintArray(e,i,s,a,l){const u=this.expression.evaluate(new nt(this.zoom,l),s,a),h=this.expression.evaluate(new nt(this.zoom+1,l),s,a);this._setPaintValue(e,i,u,h)}_setPaintValue(e,i,s,a){if(this.type==="color"){const l=mr(s),u=mr(a);for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,l[0],l[1],u[0],u[1])}else{for(let l=e;l<i;l++)this.paintVertexArray.emplace(l,s,a);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(a))}}upload(e){var i;!((i=this.paintVertexArray)===null||i===void 0)&&i.arrayBuffer.byteLength&&(this.paintVertexBuffer&&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,i){const s=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,a=Si(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(a)}getBinding(e,i,s){return new mn(e,i)}}class gt{constructor(e,i,s,a,l,u){this.expression=e,this.type=i,this.useIntegerZoom=s,this.zoom=a,this.layerId=u,this.zoomInPaintVertexArray=new l,this.zoomOutPaintVertexArray=new l}populatePaintArray(e,i,s){const a=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(a,e,this.getPositionIds(i),s)}updatePaintArray(e,i,s,a,l){this._setPaintValues(e,i,this.getPositionIds(s),l)}_setPaintValues(e,i,s,a){const l=this.getPositions(a);if(!l||!s)return;const u=l[s.min],h=l[s.mid],g=l[s.max];if(u&&h&&g)for(let m=e;m<i;m++)this.emplace(this.zoomInPaintVertexArray,m,h,u),this.emplace(this.zoomOutPaintVertexArray,m,h,g)}upload(e){var i,s;if(!((i=this.zoomInPaintVertexArray)===null||i===void 0)&&i.arrayBuffer.byteLength&&(!((s=this.zoomOutPaintVertexArray)===null||s===void 0)&&s.arrayBuffer.byteLength)){const a=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,a,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,a,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Hc extends gt{getPositions(e){return e.imagePositions}getPositionIds(e){return e.patterns&&e.patterns[this.layerId]}getVertexAttributes(){return ht.members}emplace(e,i,s,a){e.emplace(i,s.tlbr[0],s.tlbr[1],s.tlbr[2],s.tlbr[3],a.tlbr[0],a.tlbr[1],a.tlbr[2],a.tlbr[3],s.pixelRatio,a.pixelRatio)}}class Yc extends gt{getPositions(e){return e.dashPositions}getPositionIds(e){return e.dashes&&e.dashes[this.layerId]}getVertexAttributes(){return ct.members}emplace(e,i,s,a){e.emplace(i,0,s.y,s.height,s.width,0,a.y,a.height,a.width)}}class Kc{constructor(e,i,s){this.binders={},this._buffers=[];const a=[];for(const l in e.paint._values){if(!s(l))continue;const u=e.paint.get(l);if(!(u instanceof Qi&&$n(u.property.specification)))continue;const h=nh(l,e.type),g=u.value,m=u.property.specification.type,x=u.property.useIntegerZoom,_=u.property.specification["property-type"],T=_==="cross-faded"||_==="cross-faded-data-driven";if(g.kind==="constant")this.binders[l]=T?new mt(g.value,h):new gr(g.value,h,m),a.push(`/u_${l}`);else if(g.kind==="source"||T){const v=Jc(l,m,"source");this.binders[l]=T?l==="line-dasharray"?new Yc(g,m,x,i,v,e.id):new Hc(g,m,x,i,v,e.id):new dt(g,h,m,v),a.push(`/a_${l}`)}else{const v=Jc(l,m,"composite");this.binders[l]=new Dt(g,h,m,x,i,v),a.push(`/z_${l}`)}}this.cacheKey=a.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof dt||i instanceof Dt?i.maxValue:0}populatePaintArrays(e,i,s){for(const a in this.binders){const l=this.binders[a];(l instanceof dt||l instanceof Dt||l instanceof gt)&&l.populatePaintArray(e,i,s)}}setConstantPatternPositions(e,i){for(const s in this.binders){const a=this.binders[s];a instanceof mt&&a.setConstantPatternPositions(e,i)}}setConstantDashPositions(e,i){for(const s in this.binders){const a=this.binders[s];a instanceof mt&&a.setConstantDashPositions(e,i)}}updatePaintArrays(e,i,s,a,l){let u=!1;for(const h in e){const g=i.getPositions(h);for(const m of g){const x=s.feature(m.index);for(const _ in this.binders){const T=this.binders[_];if((T instanceof dt||T instanceof Dt||T instanceof gt)&&T.expression.isStateDependent===!0){const v=a.paint.get(_);T.expression=v.value,T.updatePaintArray(m.start,m.end,x,e[h],l),u=!0}}}}return u}defines(){const e=[];for(const i in this.binders){const s=this.binders[i];(s instanceof gr||s instanceof mt)&&e.push(...s.uniformNames.map((a=>`#define HAS_UNIFORM_${a}`)))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof dt||s instanceof Dt)for(let a=0;a<s.paintVertexAttributes.length;a++)e.push(s.paintVertexAttributes[a].name);else if(s instanceof gt){const a=s.getVertexAttributes();for(const l of a)e.push(l.name)}}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof gr||s instanceof mt||s instanceof Dt)for(const a of s.uniformNames)e.push(a)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,i){const s=[];for(const a in this.binders){const l=this.binders[a];if(l instanceof gr||l instanceof mt||l instanceof Dt){for(const u of l.uniformNames)if(i[u]){const h=l.getBinding(e,i[u],u);s.push({name:u,property:a,binding:h})}}}return s}setUniforms(e,i,s,a){for(const{name:l,property:u,binding:h}of i)this.binders[u].setUniform(h,a,s.get(u),l)}updatePaintBuffers(e){this._buffers=[];for(const i in this.binders){const s=this.binders[i];if(e&&s instanceof gt){const a=e.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;a&&this._buffers.push(a)}else(s instanceof dt||s instanceof Dt)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(e){for(const i in this.binders){const s=this.binders[i];(s instanceof dt||s instanceof Dt||s instanceof gt)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof dt||i instanceof Dt||i instanceof gt)&&i.destroy()}}}class _n{constructor(e,i,s=()=>!0){this.programConfigurations={};for(const a of e)this.programConfigurations[a.id]=new Kc(a,i,s);this.needsUpload=!1,this._featureMap=new sr,this._bufferOffset=0}populatePaintArrays(e,i,s,a){for(const l in this.programConfigurations)this.programConfigurations[l].populatePaintArrays(e,i,a);i.id!==void 0&&this._featureMap.add(i.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,s,a){for(const l of s)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(e,this._featureMap,i,l,a)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function nh(r,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}function Jc(r,e,i){const s={color:{source:er,composite:o},number:{source:ia,composite:er}},a=(function(l){return{"line-pattern":{source:Y,composite:Y},"fill-pattern":{source:Y,composite:Y},"fill-extrusion-pattern":{source:Y,composite:Y},"line-dasharray":{source:Z,composite:Z}}[l]})(r);return a&&a[i]||s[e][i]}Se("ConstantBinder",gr),Se("CrossFadedConstantBinder",mt),Se("SourceExpressionBinder",dt),Se("CrossFadedPatternBinder",Hc),Se("CrossFadedDasharrayBinder",Yc),Se("CompositeExpressionBinder",Dt),Se("ProgramConfiguration",Kc,{omit:["_buffers"]}),Se("ProgramConfigurationSet",_n);const _r=Math.pow(2,14)-1,zl=-_r-1;function Nr(r){const e=Re/r.extent,i=r.loadGeometry();for(let s=0;s<i.length;s++){const a=i[s];for(let l=0;l<a.length;l++){const u=a[l],h=Math.round(u.x*e),g=Math.round(u.y*e);u.x=Si(h,zl,_r),u.y=Si(g,zl,_r),(h<u.x||h>u.x+1||g<u.y||g>u.y+1)&&Ut("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function Ur(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?Nr(r):[]}}const Ha=-32768;function Qc(r,e,i,s,a){r.emplaceBack(Ha+8*e+s,Ha+8*i+a)}class ra{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new N,this.indexArray=new pe,this.segments=new Me,this.programConfigurations=new _n(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){const a=this.layers[0],l=[];let u=null,h=!1,g=a.type==="heatmap";if(a.type==="circle"){const x=a;u=x.layout.get("circle-sort-key"),h=!u.isConstant(),g=g||x.paint.get("circle-pitch-alignment")==="map"}const m=g?i.subdivisionGranularity.circle:1;for(const{feature:x,id:_,index:T,sourceLayerIndex:v}of e){const I=this.layers[0]._featureFilter.needGeometry,M=Ur(x,I);if(!this.layers[0]._featureFilter.filter(new nt(this.zoom),M,s))continue;const A=h?u.evaluate(M,{},s):void 0,D={id:_,properties:x.properties,type:x.type,sourceLayerIndex:v,index:T,geometry:I?M.geometry:Nr(x),patterns:{},sortKey:A};l.push(D)}h&&l.sort(((x,_)=>x.sortKey-_.sortKey));for(const x of l){const{geometry:_,index:T,sourceLayerIndex:v}=x,I=e[T].feature;this.addFeature(x,_,T,s,m),i.featureIndex.insert(I,_,T,v,this.index)}}update(e,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Pe),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,i,s,a,l=1){let u;switch(l){case 1:u=[0,7];break;case 3:u=[0,2,5,7];break;case 5:u=[0,1,3,4,6,7];break;case 7:u=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${l}; valid values are 1, 3, 5, 7.`)}const h=u.length;for(const g of i)for(const m of g){const x=m.x,_=m.y;if(x<0||x>=Re||_<0||_>=Re)continue;const T=this.segments.prepareSegment(h*h,this.layoutVertexArray,this.indexArray,e.sortKey),v=T.vertexLength;for(let I=0;I<h;I++)for(let M=0;M<h;M++)Qc(this.layoutVertexArray,x,_,u[M],u[I]);for(let I=0;I<h-1;I++)for(let M=0;M<h-1;M++){const A=v+I*h+M,D=v+(I+1)*h+M;this.indexArray.emplaceBack(A,D+1,A+1),this.indexArray.emplaceBack(A,D,D+1)}T.vertexLength+=h*h,T.primitiveLength+=(h-1)*(h-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:{},canonical:a})}}function _d(r,e){for(let i=0;i<r.length;i++)if(Ya(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Ya(r,e[i]))return!0;return!!sh(r,e)}function eu(r,e,i){return!!Ya(r,e)||!!ah(e,r,i)}function yd(r,e){if(r.length===1)return vd(e,r[0]);for(let i=0;i<e.length;i++){const s=e[i];for(let a=0;a<s.length;a++)if(Ya(r,s[a]))return!0}for(let i=0;i<r.length;i++)if(vd(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(sh(r,e[i]))return!0;return!1}function $f(r,e,i){if(r.length>1){if(sh(r,e))return!0;for(let s=0;s<e.length;s++)if(ah(e[s],r,i))return!0}for(let s=0;s<r.length;s++)if(ah(r[s],e,i))return!0;return!1}function sh(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const s=r[i],a=r[i+1];for(let l=0;l<e.length-1;l++)if(Zf(s,a,e[l],e[l+1]))return!0}return!1}function Zf(r,e,i,s){return Fi(r,i,s)!==Fi(e,i,s)&&Fi(r,e,i)!==Fi(r,e,s)}function ah(r,e,i){const s=i*i;if(e.length===1)return r.distSqr(e[0])<s;for(let a=1;a<e.length;a++)if(xd(r,e[a-1],e[a])<s)return!0;return!1}function xd(r,e,i){const s=e.distSqr(i);if(s===0)return r.distSqr(e);const a=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/s;return r.distSqr(a<0?e:a>1?i:i.sub(e)._mult(a)._add(e))}function vd(r,e){let i,s,a,l=!1;for(let u=0;u<r.length;u++){i=r[u];for(let h=0,g=i.length-1;h<i.length;g=h++)s=i[h],a=i[g],s.y>e.y!=a.y>e.y&&e.x<(a.x-s.x)*(e.y-s.y)/(a.y-s.y)+s.x&&(l=!l)}return l}function Ya(r,e){let i=!1;for(let s=0,a=r.length-1;s<r.length;a=s++){const l=r[s],u=r[a];l.y>e.y!=u.y>e.y&&e.x<(u.x-l.x)*(e.y-l.y)/(u.y-l.y)+l.x&&(i=!i)}return i}function qf(r,e,i){const s=i[0],a=i[2];if(r.x<s.x&&e.x<s.x||r.x>a.x&&e.x>a.x||r.y<s.y&&e.y<s.y||r.y>a.y&&e.y>a.y)return!1;const l=Fi(r,e,i[0]);return l!==Fi(r,e,i[1])||l!==Fi(r,e,i[2])||l!==Fi(r,e,i[3])}function Ka(r,e,i){const s=e.paint.get(r).value;return s.kind==="constant"?s.value:i.programConfigurations.get(e.id).getMaxValue(r)}function tu(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function iu(r,e,i,s,a){if(!e[0]&&!e[1])return r;const l=we.convert(e)._mult(a);i==="viewport"&&l._rotate(-s);const u=[];for(let h=0;h<r.length;h++)u.push(r[h].sub(l));return u}function Wf(r){const e=[];for(let i=0;i<r.length;i++){const s=r[i],a=e.at(-1);(i===0||a&&!s.equals(a))&&e.push(s)}return e}function Xf({queryGeometry:r,size:e},i){return eu(r,i,e)}function Hf({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:a},l){return eu(r,l,e*(i.projectTileCoordinates(l.x,l.y,s,a).signedDistanceFromCamera/i.cameraToCenterDistance))}function Yf({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:a},l){const u=i.projectTileCoordinates(l.x,l.y,s,a).signedDistanceFromCamera,h=e*(i.cameraToCenterDistance/u);return eu(r,oh(l,i,s,a),h)}function Kf({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:a},l){return eu(r,oh(l,i,s,a),e)}function bd({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:a,pitchAlignment:l="map",pitchScale:u="map"},h){const g=l==="map"?u==="map"?Xf:Hf:u==="map"?Yf:Kf,m={queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:a};for(const x of h)for(const _ of x)if(g(m,_))return!0;return!1}function oh(r,e,i,s){const a=e.projectTileCoordinates(r.x,r.y,i,s).point;return new we((.5*a.x+.5)*e.width,(.5*-a.y+.5)*e.height)}let wd,Td;Se("CircleBucket",ra,{omit:["layers"]});var Jf={get paint(){return Td=Td||new ni({"circle-radius":new Ce(he.paint_circle["circle-radius"]),"circle-color":new Ce(he.paint_circle["circle-color"]),"circle-blur":new Ce(he.paint_circle["circle-blur"]),"circle-opacity":new Ce(he.paint_circle["circle-opacity"]),"circle-translate":new Ie(he.paint_circle["circle-translate"]),"circle-translate-anchor":new Ie(he.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ie(he.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ie(he.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ce(he.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ce(he.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ce(he.paint_circle["circle-stroke-opacity"])})},get layout(){return wd=wd||new ni({"circle-sort-key":new Ce(he.layout_circle["circle-sort-key"])})}};class Qf extends Ui{constructor(e,i){super(e,Jf,i)}createBucket(e){return new ra(e)}queryRadius(e){const i=e;return Ka("circle-radius",this,i)+Ka("circle-stroke-width",this,i)+tu(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:a,transform:l,pixelsToTileUnits:u,unwrappedTileID:h,getElevation:g}){const m=iu(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-l.bearingInRadians,u),x=this.paint.get("circle-radius").evaluate(i,s)+this.paint.get("circle-stroke-width").evaluate(i,s),_=this.paint.get("circle-pitch-scale"),T=this.paint.get("circle-pitch-alignment");let v,I;return T==="map"?(v=m,I=x*u):(v=(function(M,A,D,L){return M.map((k=>oh(k,A,D,L)))})(m,l,h,g),I=x),bd({queryGeometry:v,size:I,transform:l,unwrappedTileID:h,getElevation:g,pitchAlignment:T,pitchScale:_},a)}}class Sd extends ra{}let Pd;Se("HeatmapBucket",Sd,{omit:["layers"]});var em={get paint(){return Pd=Pd||new ni({"heatmap-radius":new Ce(he.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ce(he.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ie(he.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ys(he.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ie(he.paint_heatmap["heatmap-opacity"])})}};function lh(r,{width:e,height:i},s,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==e*i*s)throw new RangeError(`mismatched image size. expected: ${a.length} but got: ${e*i*s}`)}else a=new Uint8Array(e*i*s);return r.width=e,r.height=i,r.data=a,r}function Id(r,{width:e,height:i},s){if(e===r.width&&i===r.height)return;const a=lh({},{width:e,height:i},s);ch(r,a,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,e),height:Math.min(r.height,i)},s),r.width=e,r.height=i,r.data=a.data}function ch(r,e,i,s,a,l){if(a.width===0||a.height===0)return e;if(a.width>r.width||a.height>r.height||i.x>r.width-a.width||i.y>r.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>e.width||a.height>e.height||s.x>e.width-a.width||s.y>e.height-a.height)throw new RangeError("out of range destination coordinates for image copy");const u=r.data,h=e.data;if(u===h)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<a.height;g++){const m=((i.y+g)*r.width+i.x)*l,x=((s.y+g)*e.width+s.x)*l;for(let _=0;_<a.width*l;_++)h[x+_]=u[m+_]}return e}class kl{constructor(e,i){lh(this,e,1,i)}resize(e){Id(this,e,1)}clone(){return new kl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,a,l){ch(e,i,s,a,l,1)}}class Di{constructor(e,i){lh(this,e,4,i)}resize(e){Id(this,e,4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Di({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,a,l){ch(e,i,s,a,l,4)}setPixel(e,i,s){const a=4*(e*this.width+i);this.data[a+0]=Math.round(255*s.r/s.a),this.data[a+1]=Math.round(255*s.g/s.a),this.data[a+2]=Math.round(255*s.b/s.a),this.data[a+3]=Math.round(255*s.a)}}function Md(r){const e=new Uint8Array(r.length);for(let i=0;i<r.length;i+=4){const s=r[i+3];e[i+0]=Math.round(r[i+0]*s/255),e[i+1]=Math.round(r[i+1]*s/255),e[i+2]=Math.round(r[i+2]*s/255),e[i+3]=s}return e}function Ed(r){const e={},i=r.resolution||256,s=r.clips?r.clips.length:1,a=r.image||new Di({width:i,height:s});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const l=(u,h,g)=>{e[r.evaluationKey]=g;const m=r.expression.evaluate(e);a.setPixel(u/4/i,h/4,m)};if(r.clips)for(let u=0,h=0;u<s;++u,h+=4*i)for(let g=0,m=0;g<i;g++,m+=4){const x=g/(i-1),{start:_,end:T}=r.clips[u];l(h,m,_*(1-x)+T*x)}else for(let u=0,h=0;u<i;u++,h+=4)l(0,h,u/(i-1));return a}Se("AlphaImage",kl),Se("RGBAImage",Di);const uh="big-fb";class tm extends Ui{createBucket(e){return new Sd(e)}constructor(e,i){super(e,em,i),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Ed({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(uh)&&this.heatmapFbos.delete(uh)}queryRadius(e){return Ka("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:a,transform:l,pixelsToTileUnits:u,unwrappedTileID:h,getElevation:g}){return bd({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(i,s)*u,transform:l,unwrappedTileID:h,getElevation:g},a)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}}let Cd;var im={get paint(){return Cd=Cd||new ni({"hillshade-illumination-direction":new Ie(he.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Ie(he.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Ie(he.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ie(he.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ie(he.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ie(he.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ie(he.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Ie(he.paint_hillshade["hillshade-method"]),resampling:new Ie(he.paint_hillshade.resampling)})}};class rm extends Ui{constructor(e,i){super(e,im,i),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,i=this.paint.get("hillshade-illumination-altitude").values,s=this.paint.get("hillshade-highlight-color").values,a=this.paint.get("hillshade-shadow-color").values;const l=Math.max(e.length,i.length,s.length,a.length);e=e.concat(Array(l-e.length).fill(e.at(-1))),i=i.concat(Array(l-i.length).fill(i.at(-1))),s=s.concat(Array(l-s.length).fill(s.at(-1))),a=a.concat(Array(l-a.length).fill(a.at(-1)));const u=i.map(ha);return{directionRadians:e.map(ha),altitudeRadians:u,shadowColor:a,highlightColor:s}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}}let Ad;var nm={get paint(){return Ad=Ad||new ni({"color-relief-opacity":new Ie(he["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Ys(he["paint_color-relief"]["color-relief-color"]),resampling:new Ie(he["paint_color-relief"].resampling)})}};function Dd(r){return"data"in r}class hh{constructor(e,i,s,a){this.context=e,this.format=s,this.texture=e.gl.createTexture(),this._ownedHandle=this.texture,this.update(i,a)}update(e,i,s){const{width:a,height:l}=e,u=!(this.size&&this.size[0]===a&&this.size[1]===l||s),{context:h}=this,{gl:g}=h;this.useMipmap=!!(i&&i.useMipmap),g.bindTexture(g.TEXTURE_2D,this.texture),h.pixelStoreUnpackFlipY.set(!1),h.pixelStoreUnpack.set(1);const m=this.format===g.RGBA&&(!i||i.premultiply!==!1);if(u)this.size=[a,l],Dd(e)?(h.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(e,m,a,l,g)):(h.pixelStoreUnpackPremultiplyAlpha.set(m),this._uploadDomImage(e,g));else{const{x,y:_}=s||{x:0,y:0};Dd(e)?(h.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(e,m,x,_,a,l,g)):(h.pixelStoreUnpackPremultiplyAlpha.set(m),this._updateDomImage(e,x,_,g))}this.useMipmap&&this.isSizePowerOfTwo()&&g.generateMipmap(g.TEXTURE_2D),h.pixelStoreUnpackFlipY.setDefault(),h.pixelStoreUnpack.setDefault(),h.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(e,i){i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,i.UNSIGNED_BYTE,e)}_uploadRawData(e,i,s,a,l){let{data:u}=e;i&&u&&(u=Md(u)),l.texImage2D(l.TEXTURE_2D,0,this.format,s,a,0,this.format,l.UNSIGNED_BYTE,u)}_updateDomImage(e,i,s,a){a.texSubImage2D(a.TEXTURE_2D,0,i,s,a.RGBA,a.UNSIGNED_BYTE,e)}_updateRawData(e,i,s,a,l,u,h){let{data:g}=e;i&&g&&(g=Md(g)),h.texSubImage2D(h.TEXTURE_2D,0,s,a,l,u,h.RGBA,h.UNSIGNED_BYTE,g)}bind(e,i,s){const{context:a}=this,{gl:l}=a;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),l.bindTexture(l.TEXTURE_2D,this.texture),s!==l.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=l.LINEAR),e!==this.filter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,e),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,s||e),this.filter=e),i!==this.wrap&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,i),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,i),this.wrap=i)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}}class zd{constructor(e,i,s,a=1,l=1,u=1,h=0){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(s&&!["mapbox","terrarium","custom"].includes(s))return void Ut(`"${s}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=i.height;const g=this.dim=i.height-2;switch(this.data=new Uint32Array(i.data.buffer),s){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=a,this.greenFactor=l,this.blueFactor=u,this.baseShift=h;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let m=0;m<g;m++)this.data[this._idx(-1,m)]=this.data[this._idx(0,m)],this.data[this._idx(g,m)]=this.data[this._idx(g-1,m)],this.data[this._idx(m,-1)]=this.data[this._idx(m,0)],this.data[this._idx(m,g)]=this.data[this._idx(m,g-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(g,-1)]=this.data[this._idx(g-1,0)],this.data[this._idx(-1,g)]=this.data[this._idx(0,g-1)],this.data[this._idx(g,g)]=this.data[this._idx(g-1,g-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let m=0;m<g;m++)for(let x=0;x<g;x++){const _=this.get(m,x);_>this.max&&(this.max=_),_<this.min&&(this.min=_)}}get(e,i){const s=new Uint8Array(this.data.buffer),a=4*this._idx(e,i);return this.unpack(s[a],s[a+1],s[a+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${i}, dim: ${this.dim}`);return(i+1)*this.stride+(e+1)}unpack(e,i,s){return e*this.redFactor+i*this.greenFactor+s*this.blueFactor-this.baseShift}pack(e){return kd(e,this.getUnpackVector())}getPixels(){return new Di({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,i,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let a=i*this.dim,l=i*this.dim+this.dim,u=s*this.dim,h=s*this.dim+this.dim;switch(i){case-1:a=l-1;break;case 1:l=a+1}switch(s){case-1:u=h-1;break;case 1:h=u+1}const g=-i*this.dim,m=-s*this.dim;for(let x=u;x<h;x++)for(let _=a;_<l;_++)this.data[this._idx(_,x)]=e.data[this._idx(_+g,x+m)]}}function kd(r,e){const i=e[0],s=e[1],a=e[2],l=e[3],u=Math.min(i,s,a),h=Math.round((r+l)/u);return{r:Math.floor(h*u/i)%256,g:Math.floor(h*u/s)%256,b:Math.floor(h*u/a)%256}}Se("DEMData",zd);class sm extends Ui{constructor(e,i){super(e,nm,i)}_createColorRamp(e){const i={elevationStops:[],colorStops:[]},s=this._transitionablePaint._values["color-relief-color"].value.expression;if(s instanceof zs&&s._styleExpression.expression instanceof rt){this.colorRampExpression=s;const u=s._styleExpression.expression;i.elevationStops=u.labels,i.colorStops=[];for(const h of i.elevationStops)i.colorStops.push(u.evaluate({globals:{elevation:h}}))}if(i.elevationStops.length<1&&(i.elevationStops=[0],i.colorStops=[Ne.transparent]),i.elevationStops.length<2&&(i.elevationStops.push(i.elevationStops[0]+1),i.colorStops.push(i.colorStops[0])),i.elevationStops.length<=e)return i;const a={elevationStops:[],colorStops:[]},l=(i.elevationStops.length-1)/(e-1);for(let u=0;u<i.elevationStops.length-.5;u+=l)a.elevationStops.push(i.elevationStops[Math.round(u)]),a.colorStops.push(i.colorStops[Math.round(u)]);return Ut(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${i.elevationStops.length}`),a}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,i,s){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const a=this._createColorRamp(i),l=new Di({width:a.colorStops.length,height:1}),u=new Di({width:a.colorStops.length,height:1});for(let h=0;h<a.elevationStops.length;h++){const g=kd(a.elevationStops[h],s);u.setPixel(0,h,new Ne(g.r/255,g.g/255,g.b/255,1)),l.setPixel(0,h,a.colorStops[h])}return this.colorRampTextures={elevationTexture:new hh(e,u,e.gl.RGBA),colorTexture:new hh(e,l,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}const am=Ct([{name:"a_pos",components:2,type:"Int16"}],4),{members:om}=am;function ru(r,e,i){const s=i.patternDependencies;let a=!1;for(const l of e){const u=l.paint.get(`${r}-pattern`);u.isConstant()||(a=!0);const h=u.constantOr(null);h&&(a=!0,s[h.to]=!0,s[h.from]=!0)}return a}function dh(r,e,i,s,a){const{zoom:l}=s,u=a.patternDependencies;for(const h of e){const g=h.paint.get(`${r}-pattern`).value;if(g.kind!=="constant"){let m=g.evaluate({zoom:l-1},i,{},a.availableImages),x=g.evaluate({zoom:l},i,{},a.availableImages),_=g.evaluate({zoom:l+1},i,{},a.availableImages);m=m&&m.name?m.name:m,x=x&&x.name?x.name:x,_=_&&_.name?_.name:_,u[m]=!0,u[x]=!0,u[_]=!0,i.patterns[h.id]={min:m,mid:x,max:_}}}return i}function Rd(r,e,i,s,a){let l;if(a===(function(u,h,g,m){let x=0;for(let _=h,T=g-m;_<g;_+=m)x+=(u[T]-u[_])*(u[_+1]+u[T+1]),T=_;return x})(r,e,i,s)>0)for(let u=e;u<i;u+=s)l=Od(u/s|0,r[u],r[u+1],l);else for(let u=i-s;u>=e;u-=s)l=Od(u/s|0,r[u],r[u+1],l);return l&&Ja(l,l.next)&&(Bl(l),l=l.next),l}function na(r,e){if(!r)return r;e||(e=r);let i,s=r;do if(i=!1,s.steiner||!Ja(s,s.next)&&zt(s.prev,s,s.next)!==0)s=s.next;else{if(Bl(s),s=e=s.prev,s===s.next)break;i=!0}while(i||s!==e);return e}function Rl(r,e,i,s,a,l,u){if(!r)return;!u&&l&&(function(g,m,x,_){let T=g;do T.z===0&&(T.z=ph(T.x,T.y,m,x,_)),T.prevZ=T.prev,T.nextZ=T.next,T=T.next;while(T!==g);T.prevZ.nextZ=null,T.prevZ=null,(function(v){let I,M=1;do{let A,D=v;v=null;let L=null;for(I=0;D;){I++;let k=D,B=0;for(let U=0;U<M&&(B++,k=k.nextZ,k);U++);let O=M;for(;B>0||O>0&&k;)B!==0&&(O===0||!k||D.z<=k.z)?(A=D,D=D.nextZ,B--):(A=k,k=k.nextZ,O--),L?L.nextZ=A:v=A,A.prevZ=L,L=A;D=k}L.nextZ=null,M*=2}while(I>1)})(T)})(r,s,a,l);let h=r;for(;r.prev!==r.next;){const g=r.prev,m=r.next;if(l?cm(r,s,a,l):lm(r))e.push(g.i,r.i,m.i),Bl(r),r=m.next,h=m.next;else if((r=m)===h){u?u===1?Rl(r=um(na(r),e),e,i,s,a,l,2):u===2&&hm(r,e,i,s,a,l):Rl(na(r),e,i,s,a,l,1);break}}}function lm(r){const e=r.prev,i=r,s=r.next;if(zt(e,i,s)>=0)return!1;const a=e.x,l=i.x,u=s.x,h=e.y,g=i.y,m=s.y,x=Math.min(a,l,u),_=Math.min(h,g,m),T=Math.max(a,l,u),v=Math.max(h,g,m);let I=s.next;for(;I!==e;){if(I.x>=x&&I.x<=T&&I.y>=_&&I.y<=v&&Fl(a,h,l,g,u,m,I.x,I.y)&&zt(I.prev,I,I.next)>=0)return!1;I=I.next}return!0}function cm(r,e,i,s){const a=r.prev,l=r,u=r.next;if(zt(a,l,u)>=0)return!1;const h=a.x,g=l.x,m=u.x,x=a.y,_=l.y,T=u.y,v=Math.min(h,g,m),I=Math.min(x,_,T),M=Math.max(h,g,m),A=Math.max(x,_,T),D=ph(v,I,e,i,s),L=ph(M,A,e,i,s);let k=r.prevZ,B=r.nextZ;for(;k&&k.z>=D&&B&&B.z<=L;){if(k.x>=v&&k.x<=M&&k.y>=I&&k.y<=A&&k!==a&&k!==u&&Fl(h,x,g,_,m,T,k.x,k.y)&&zt(k.prev,k,k.next)>=0||(k=k.prevZ,B.x>=v&&B.x<=M&&B.y>=I&&B.y<=A&&B!==a&&B!==u&&Fl(h,x,g,_,m,T,B.x,B.y)&&zt(B.prev,B,B.next)>=0))return!1;B=B.nextZ}for(;k&&k.z>=D;){if(k.x>=v&&k.x<=M&&k.y>=I&&k.y<=A&&k!==a&&k!==u&&Fl(h,x,g,_,m,T,k.x,k.y)&&zt(k.prev,k,k.next)>=0)return!1;k=k.prevZ}for(;B&&B.z<=L;){if(B.x>=v&&B.x<=M&&B.y>=I&&B.y<=A&&B!==a&&B!==u&&Fl(h,x,g,_,m,T,B.x,B.y)&&zt(B.prev,B,B.next)>=0)return!1;B=B.nextZ}return!0}function um(r,e){let i=r;do{const s=i.prev,a=i.next.next;!Ja(s,a)&&Ld(s,i,i.next,a)&&Ll(s,a)&&Ll(a,s)&&(e.push(s.i,i.i,a.i),Bl(i),Bl(i.next),i=r=a),i=i.next}while(i!==r);return na(i)}function hm(r,e,i,s,a,l){let u=r;do{let h=u.next.next;for(;h!==u.prev;){if(u.i!==h.i&&gm(u,h)){let g=Bd(u,h);return u=na(u,u.next),g=na(g,g.next),Rl(u,e,i,s,a,l,0),void Rl(g,e,i,s,a,l,0)}h=h.next}u=u.next}while(u!==r)}function dm(r,e){let i=r.x-e.x;return i===0&&(i=r.y-e.y,i===0)&&(i=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function pm(r,e){const i=(function(a,l){let u=l;const h=a.x,g=a.y;let m,x=-1/0;if(Ja(a,u))return u;do{if(Ja(a,u.next))return u.next;if(g<=u.y&&g>=u.next.y&&u.next.y!==u.y){const M=u.x+(g-u.y)*(u.next.x-u.x)/(u.next.y-u.y);if(M<=h&&M>x&&(x=M,m=u.x<u.next.x?u:u.next,M===h))return m}u=u.next}while(u!==l);if(!m)return null;const _=m,T=m.x,v=m.y;let I=1/0;u=m;do{if(h>=u.x&&u.x>=T&&h!==u.x&&Fd(g<v?h:x,g,T,v,g<v?x:h,g,u.x,u.y)){const M=Math.abs(g-u.y)/(h-u.x);Ll(u,a)&&(M<I||M===I&&(u.x>m.x||u.x===m.x&&fm(m,u)))&&(m=u,I=M)}u=u.next}while(u!==_);return m})(r,e);if(!i)return e;const s=Bd(i,r);return na(s,s.next),na(i,i.next)}function fm(r,e){return zt(r.prev,r,e.prev)<0&&zt(e.next,r,r.next)<0}function ph(r,e,i,s,a){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*a|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function mm(r){let e=r,i=r;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==r);return i}function Fd(r,e,i,s,a,l,u,h){return(a-u)*(e-h)>=(r-u)*(l-h)&&(r-u)*(s-h)>=(i-u)*(e-h)&&(i-u)*(l-h)>=(a-u)*(s-h)}function Fl(r,e,i,s,a,l,u,h){return!(r===u&&e===h)&&Fd(r,e,i,s,a,l,u,h)}function gm(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!(function(i,s){let a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==s.i&&a.next.i!==s.i&&Ld(a,a.next,i,s))return!0;a=a.next}while(a!==i);return!1})(r,e)&&(Ll(r,e)&&Ll(e,r)&&(function(i,s){let a=i,l=!1;const u=(i.x+s.x)/2,h=(i.y+s.y)/2;do a.y>h!=a.next.y>h&&a.next.y!==a.y&&u<(a.next.x-a.x)*(h-a.y)/(a.next.y-a.y)+a.x&&(l=!l),a=a.next;while(a!==i);return l})(r,e)&&(zt(r.prev,r,e.prev)||zt(r,e.prev,e))||Ja(r,e)&&zt(r.prev,r,r.next)>0&&zt(e.prev,e,e.next)>0)}function zt(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function Ja(r,e){return r.x===e.x&&r.y===e.y}function Ld(r,e,i,s){const a=su(zt(r,e,i)),l=su(zt(r,e,s)),u=su(zt(i,s,r)),h=su(zt(i,s,e));return a!==l&&u!==h||!(a!==0||!nu(r,i,e))||!(l!==0||!nu(r,s,e))||!(u!==0||!nu(i,r,s))||!(h!==0||!nu(i,e,s))}function nu(r,e,i){return e.x<=Math.max(r.x,i.x)&&e.x>=Math.min(r.x,i.x)&&e.y<=Math.max(r.y,i.y)&&e.y>=Math.min(r.y,i.y)}function su(r){return r>0?1:r<0?-1:0}function Ll(r,e){return zt(r.prev,r,r.next)<0?zt(r,e,r.next)>=0&&zt(r,r.prev,e)>=0:zt(r,e,r.prev)<0||zt(r,r.next,e)<0}function Bd(r,e){const i=fh(r.i,r.x,r.y),s=fh(e.i,e.x,e.y),a=r.next,l=e.prev;return r.next=e,e.prev=r,i.next=a,a.prev=i,s.next=i,i.prev=s,l.next=s,s.prev=l,s}function Od(r,e,i,s){const a=fh(r,e,i);return s?(a.next=s.next,a.prev=s,s.next.prev=a,s.next=a):(a.prev=a,a.next=a),a}function Bl(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function fh(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Qa{constructor(e,i){if(i>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=i}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class au{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}au.noSubdivision=new au({fill:new Qa(0,0),line:new Qa(0,0),tile:new Qa(0,0),stencil:new Qa(0,0),circle:1}),Se("SubdivisionGranularityExpression",Qa),Se("SubdivisionGranularitySetting",au);const eo=-32768,Ol=32767;class _m{constructor(e,i){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=Re/e,this._canonical=i}_getKey(e,i){return(e+=32768)<<16|i+32768}_vertexToIndex(e,i){if(e<-32768||i<-32768||e>32767||i>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const s=0|Math.round(e),a=0|Math.round(i),l=this._getKey(s,a);if(this._vertexDictionary.has(l))return this._vertexDictionary.get(l);const u=this._vertexBuffer.length/2;return this._vertexDictionary.set(l,u),this._vertexBuffer.push(s,a),u}_subdivideTrianglesScanline(e){if(this._granularity<2)return(function(a,l){const u=[];for(let h=0;h<l.length;h+=3){const g=l[h],m=l[h+1],x=l[h+2],_=a[2*g],T=a[2*g+1];(a[2*m]-_)*(a[2*x+1]-T)-(a[2*m+1]-T)*(a[2*x]-_)>0?(u.push(g),u.push(x),u.push(m)):(u.push(g),u.push(m),u.push(x))}return u})(this._vertexBuffer,e);const i=[],s=e.length;for(let a=0;a<s;a+=3){const l=[e[a+0],e[a+1],e[a+2]],u=[this._vertexBuffer[2*e[a+0]+0],this._vertexBuffer[2*e[a+0]+1],this._vertexBuffer[2*e[a+1]+0],this._vertexBuffer[2*e[a+1]+1],this._vertexBuffer[2*e[a+2]+0],this._vertexBuffer[2*e[a+2]+1]];let h=1/0,g=1/0,m=-1/0,x=-1/0;for(let M=0;M<3;M++){const A=u[2*M],D=u[2*M+1];h=Math.min(h,A),m=Math.max(m,A),g=Math.min(g,D),x=Math.max(x,D)}if(h===m||g===x)continue;const _=Math.floor(h/this._granularityCellSize),T=Math.ceil(m/this._granularityCellSize),v=Math.floor(g/this._granularityCellSize),I=Math.ceil(x/this._granularityCellSize);if(_!==T||v!==I)for(let M=v;M<I;M++){const A=this._scanlineGenerateVertexRingForCellRow(M,u,l);ym(this._vertexBuffer,A,i)}else i.push(...l)}return i}_scanlineGenerateVertexRingForCellRow(e,i,s){const a=e*this._granularityCellSize,l=a+this._granularityCellSize,u=[];for(let h=0;h<3;h++){const g=i[2*h],m=i[2*h+1],x=i[2*(h+1)%6],_=i[(2*(h+1)+1)%6],T=i[2*(h+2)%6],v=i[(2*(h+2)+1)%6],I=x-g,M=_-m,A=I===0,D=M===0,L=(a-m)/M,k=(l-m)/M,B=Math.min(L,k),O=Math.max(L,k);if(!D&&(B>=1||O<=0)||D&&(m<a||m>l)){_>=a&&_<=l&&u.push(s[(h+1)%3]);continue}!D&&B>0&&u.push(this._vertexToIndex(g+I*B,m+M*B));const U=g+I*Math.max(B,0),H=g+I*Math.min(O,1);A||this._generateIntraEdgeVertices(u,g,m,x,_,U,H),!D&&O<1&&u.push(this._vertexToIndex(g+I*O,m+M*O)),(D||_>=a&&_<=l)&&u.push(s[(h+1)%3]),!D&&(_<=a||_>=l)&&this._generateInterEdgeVertices(u,g,m,x,_,T,v,H,a,l)}return u}_generateIntraEdgeVertices(e,i,s,a,l,u,h){const g=a-i,m=l-s,x=m===0,_=x?Math.min(i,a):Math.min(u,h),T=x?Math.max(i,a):Math.max(u,h),v=Math.floor(_/this._granularityCellSize)+1,I=Math.ceil(T/this._granularityCellSize)-1;if(x?i<a:u<h)for(let M=v;M<=I;M++){const A=M*this._granularityCellSize;e.push(this._vertexToIndex(A,s+m*(A-i)/g))}else for(let M=I;M>=v;M--){const A=M*this._granularityCellSize;e.push(this._vertexToIndex(A,s+m*(A-i)/g))}}_generateInterEdgeVertices(e,i,s,a,l,u,h,g,m,x){const _=l-s,T=u-a,v=h-l,I=(m-l)/v,M=(x-l)/v,A=Math.min(I,M),D=Math.max(I,M),L=a+T*A;let k=Math.floor(Math.min(L,g)/this._granularityCellSize)+1,B=Math.ceil(Math.max(L,g)/this._granularityCellSize)-1,O=g<L;const U=v===0;if(U&&(h===m||h===x))return;if(U||A>=1||D<=0){const J=s-h,ee=u+(i-u)*Math.min((m-h)/J,(x-h)/J);k=Math.floor(Math.min(ee,g)/this._granularityCellSize)+1,B=Math.ceil(Math.max(ee,g)/this._granularityCellSize)-1,O=g<ee}const H=_>0?x:m;if(O)for(let J=k;J<=B;J++)e.push(this._vertexToIndex(J*this._granularityCellSize,H));else for(let J=B;J>=k;J--)e.push(this._vertexToIndex(J*this._granularityCellSize,H))}_generateOutline(e){const i=[];for(const s of e){const a=sa(s,this._granularity,!0),l=this._pointArrayToIndices(a),u=[];for(let h=1;h<l.length;h++)u.push(l[h-1]),u.push(l[h]);i.push(u)}return i}_handlePoles(e){let i=!1,s=!1;this._canonical&&(this._canonical.y===0&&(i=!0),this._canonical.y===(1<<this._canonical.z)-1&&(s=!0)),(i||s)&&this._fillPoles(e,i,s)}_ensureNoPoleVertices(){const e=this._vertexBuffer;for(let i=0;i<e.length;i+=2){const s=e[i+1];s===eo&&(e[i+1]=-32767),s===Ol&&(e[i+1]=32766)}}_generatePoleQuad(e,i,s,a,l,u){a>l!=(u===eo)?(e.push(i),e.push(s),e.push(this._vertexToIndex(a,u)),e.push(s),e.push(this._vertexToIndex(l,u)),e.push(this._vertexToIndex(a,u))):(e.push(s),e.push(i),e.push(this._vertexToIndex(a,u)),e.push(this._vertexToIndex(l,u)),e.push(s),e.push(this._vertexToIndex(a,u)))}_fillPoles(e,i,s){const a=this._vertexBuffer,l=Re,u=e.length;for(let h=2;h<u;h+=3){const g=e[h-2],m=e[h-1],x=e[h],_=a[2*g],T=a[2*g+1],v=a[2*m],I=a[2*m+1],M=a[2*x],A=a[2*x+1];i&&(T===0&&I===0&&this._generatePoleQuad(e,g,m,_,v,eo),I===0&&A===0&&this._generatePoleQuad(e,m,x,v,M,eo),A===0&&T===0&&this._generatePoleQuad(e,x,g,M,_,eo)),s&&(T===l&&I===l&&this._generatePoleQuad(e,g,m,_,v,Ol),I===l&&A===l&&this._generatePoleQuad(e,m,x,v,M,Ol),A===l&&T===l&&this._generatePoleQuad(e,x,g,M,_,Ol))}}_initializeVertices(e){for(let i=0;i<e.length;i+=2)this._vertexToIndex(e[i],e[i+1])}subdividePolygonInternal(e,i){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:s,holeIndices:a}=(function(h){const g=[],m=[];for(const x of h)if(x.length!==0){x!==h[0]&&g.push(m.length/2);for(let _=0;_<x.length;_++)m.push(x[_].x),m.push(x[_].y)}return{flattened:m,holeIndices:g}})(e);let l;this._initializeVertices(s);try{const h=(function(m,x,_=2){const T=x&&x.length,v=T?x[0]*_:m.length;let I=Rd(m,0,v,_,!0);const M=[];if(!I||I.next===I.prev)return M;let A,D,L;if(T&&(I=(function(k,B,O,U){const H=[];for(let J=0,ee=B.length;J<ee;J++){const re=Rd(k,B[J]*U,J<ee-1?B[J+1]*U:k.length,U,!1);re===re.next&&(re.steiner=!0),H.push(mm(re))}H.sort(dm);for(let J=0;J<H.length;J++)O=pm(H[J],O);return O})(m,x,I,_)),m.length>80*_){A=m[0],D=m[1];let k=A,B=D;for(let O=_;O<v;O+=_){const U=m[O],H=m[O+1];U<A&&(A=U),H<D&&(D=H),U>k&&(k=U),H>B&&(B=H)}L=Math.max(k-A,B-D),L=L!==0?32767/L:0}return Rl(I,M,_,A,D,L,0),M})(s,a),g=this._convertIndices(s,h);l=this._subdivideTrianglesScanline(g)}catch(h){console.error(h)}let u=[];return i&&(u=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(l),{verticesFlattened:this._vertexBuffer,indicesTriangles:l,indicesLineList:u}}_convertIndices(e,i){const s=[];for(let a=0;a<i.length;a++)s.push(this._vertexToIndex(e[2*i[a]],e[2*i[a]+1]));return s}_pointArrayToIndices(e){const i=[];for(let s=0;s<e.length;s++){const a=e[s];i.push(this._vertexToIndex(a.x,a.y))}return i}}function Vd(r,e,i,s=!0){return new _m(i,e).subdividePolygonInternal(r,s)}function sa(r,e,i=!1){if(!r||r.length<1)return[];if(r.length<2)return[];const s=r[0],a=r[r.length-1],l=i&&(s.x!==a.x||s.y!==a.y);if(e<2)return l?[...r,r[0]]:[...r];const u=Math.floor(Re/e),h=[];h.push(new we(r[0].x,r[0].y));const g=r.length,m=l?g:g-1;for(let x=0;x<m;x++){const _=r[x],T=x<g-1?r[x+1]:r[0],v=_.x,I=_.y,M=T.x,A=T.y,D=v!==M,L=I!==A;if(!D&&!L)continue;const k=M-v,B=A-I,O=Math.abs(k),U=Math.abs(B);let H=v,J=I;for(;;){const re=k>0?(Math.floor(H/u)+1)*u:(Math.ceil(H/u)-1)*u,ue=B>0?(Math.floor(J/u)+1)*u:(Math.ceil(J/u)-1)*u,le=Math.abs(H-re),ce=Math.abs(J-ue),se=Math.abs(H-M),ye=Math.abs(J-A),Te=D?le/O:Number.POSITIVE_INFINITY,be=L?ce/U:Number.POSITIVE_INFINITY;if((se<=le||!D)&&(ye<=ce||!L))break;if(Te<be&&D||!L){H=re,J+=B*Te;const me=new we(H,Math.round(J));h[h.length-1].x===me.x&&h[h.length-1].y===me.y||h.push(me)}else{H+=k*be,J=ue;const me=new we(Math.round(H),J);h[h.length-1].x===me.x&&h[h.length-1].y===me.y||h.push(me)}}const ee=new we(M,A);h[h.length-1].x===ee.x&&h[h.length-1].y===ee.y||h.push(ee)}return h}function ym(r,e,i){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let s=0,a=r[2*e[0]];for(let g=1;g<e.length;g++){const m=r[2*e[g]];m<a&&(a=m,s=g)}const l=e.length;let u=s,h=(u+1)%l;for(;;){const g=u-1>=0?u-1:l-1,m=(h+1)%l,x=r[2*e[g]],_=r[2*e[m]],T=r[2*e[u]],v=r[2*e[u]+1],I=r[2*e[h]+1];let M=!1;if(x<_)M=!0;else if(x>_)M=!1;else{const A=I-v,D=-(r[2*e[h]]-T),L=v<I?1:-1;((x-T)*A+(r[2*e[g]+1]-v)*D)*L>((_-T)*A+(r[2*e[m]+1]-v)*D)*L&&(M=!0)}if(M){const A=e[g],D=e[u],L=e[h];A!==D&&A!==L&&D!==L&&i.push(L,D,A),u--,u<0&&(u=l-1)}else{const A=e[m],D=e[u],L=e[h];A!==D&&A!==L&&D!==L&&i.push(L,D,A),h++,h>=l&&(h=0)}if(g===m)break}}function jd(r,e,i,s,a,l,u,h,g){const m=a.length/2,x=u&&h&&g;if(m<Me.MAX_VERTEX_ARRAY_LENGTH){const _=e.prepareSegment(m,i,s),T=_.vertexLength;for(let M=0;M<l.length;M+=3)s.emplaceBack(T+l[M],T+l[M+1],T+l[M+2]);let v,I;_.vertexLength+=m,_.primitiveLength+=l.length/3,x&&(I=u.prepareSegment(m,i,h),v=I.vertexLength,I.vertexLength+=m);for(let M=0;M<a.length;M+=2)r(a[M],a[M+1]);if(x)for(let M=0;M<g.length;M++){const A=g[M];for(let D=1;D<A.length;D+=2)h.emplaceBack(v+A[D-1],v+A[D]);I.primitiveLength+=A.length/2}}else(function(_,T,v,I,M,A){const D=[];for(let U=0;U<I.length/2;U++)D.push(-1);const L={count:0};let k=0,B=_.getOrCreateLatestSegment(T,v),O=B.vertexLength;for(let U=2;U<M.length;U+=3){const H=M[U-2],J=M[U-1],ee=M[U];let re=D[H]<k,ue=D[J]<k,le=D[ee]<k;B.vertexLength+((re?1:0)+(ue?1:0)+(le?1:0))>Me.MAX_VERTEX_ARRAY_LENGTH&&(B=_.createNewSegment(T,v),k=L.count,re=!0,ue=!0,le=!0,O=0);const ce=Vl(D,I,A,L,H,re,B),se=Vl(D,I,A,L,J,ue,B),ye=Vl(D,I,A,L,ee,le,B);v.emplaceBack(O+ce-k,O+se-k,O+ye-k),B.primitiveLength++}})(e,i,s,a,l,r),x&&(function(_,T,v,I,M,A){const D=[];for(let U=0;U<I.length/2;U++)D.push(-1);const L={count:0};let k=0,B=_.getOrCreateLatestSegment(T,v),O=B.vertexLength;for(let U=0;U<M.length;U++){const H=M[U];for(let J=1;J<M[U].length;J+=2){const ee=H[J-1],re=H[J];let ue=D[ee]<k,le=D[re]<k;B.vertexLength+((ue?1:0)+(le?1:0))>Me.MAX_VERTEX_ARRAY_LENGTH&&(B=_.createNewSegment(T,v),k=L.count,ue=!0,le=!0,O=0);const ce=Vl(D,I,A,L,ee,ue,B),se=Vl(D,I,A,L,re,le,B);v.emplaceBack(O+ce-k,O+se-k),B.primitiveLength++}}})(u,i,h,a,g,r),e.forceNewSegmentOnNextPrepare(),u?.forceNewSegmentOnNextPrepare()}function Vl(r,e,i,s,a,l,u){if(l){const h=s.count;return i(e[2*a],e[2*a+1]),r[a]=s.count,s.count++,u.vertexLength++,h}return r[a]}class mh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new $,this.indexArray=new pe,this.indexArray2=new fe,this.programConfigurations=new _n(e.layers,e.zoom),this.segments=new Me,this.segments2=new Me,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){this.hasDependencies=ru("fill",this.layers,i);const a=this.layers[0].layout.get("fill-sort-key"),l=!a.isConstant(),u=[];for(const{feature:h,id:g,index:m,sourceLayerIndex:x}of e){const _=this.layers[0]._featureFilter.needGeometry,T=Ur(h,_);if(!this.layers[0]._featureFilter.filter(new nt(this.zoom),T,s))continue;const v=l?a.evaluate(T,{},s,i.availableImages):void 0,I={id:g,properties:h.properties,type:h.type,sourceLayerIndex:x,index:m,geometry:_?T.geometry:Nr(h),patterns:{},sortKey:v};u.push(I)}l&&u.sort(((h,g)=>h.sortKey-g.sortKey));for(const h of u){const{geometry:g,index:m,sourceLayerIndex:x}=h;if(this.hasDependencies){const _=dh("fill",this.layers,h,{zoom:this.zoom},i);this.patternFeatures.push(_)}else this.addFeature(h,g,m,s,{},i.subdivisionGranularity);i.featureIndex.insert(e[m].feature,g,m,x,this.index)}}update(e,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s})}addFeatures(e,i,s){for(const a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,i,s,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,om),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,i,s,a,l,u){for(const h of Ia(i,500)){const g=Vd(h,a,u.fill.getGranularityForZoomLevel(a.z)),m=this.layoutVertexArray;jd(((x,_)=>{m.emplaceBack(x,_)}),this.segments,this.layoutVertexArray,this.indexArray,g.verticesFlattened,g.indicesTriangles,this.segments2,this.indexArray2,g.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:l,canonical:a})}}let Nd,Ud;Se("FillBucket",mh,{omit:["layers","patternFeatures"]});var xm={get paint(){return Ud=Ud||new ni({"fill-antialias":new Ie(he.paint_fill["fill-antialias"]),"fill-opacity":new Ce(he.paint_fill["fill-opacity"]),"fill-color":new Ce(he.paint_fill["fill-color"]),"fill-outline-color":new Ce(he.paint_fill["fill-outline-color"]),"fill-translate":new Ie(he.paint_fill["fill-translate"]),"fill-translate-anchor":new Ie(he.paint_fill["fill-translate-anchor"]),"fill-pattern":new Hs(he.paint_fill["fill-pattern"])})},get layout(){return Nd=Nd||new ni({"fill-sort-key":new Ce(he.layout_fill["fill-sort-key"])})}};class vm extends Ui{constructor(e,i){super(e,xm,i)}recalculate(e,i){super.recalculate(e,i);const s=this.paint._values["fill-outline-color"];s.value.kind==="constant"&&s.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new mh(e)}queryRadius(){return tu(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:i,transform:s,pixelsToTileUnits:a}){return yd(iu(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-s.bearingInRadians,a),i)}isTileClipped(){return!0}}const bm=Ct([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),wm=Ct([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Tm}=bm;class jl{constructor(e,i,s,a,l){this.properties={},this.extent=s,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=a,this._values=l,e.readFields(Sm,this,i)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,s=[];let a,l=1,u=0,h=0,g=0;for(;e.pos<i;){if(u<=0){const m=e.readVarint();l=7&m,u=m>>3}if(u--,l===1||l===2)h+=e.readSVarint(),g+=e.readSVarint(),l===1&&(a&&s.push(a),a=[]),a&&a.push(new we(h,g));else{if(l!==7)throw new Error(`unknown command ${l}`);a&&a.push(a[0].clone())}}return a&&s.push(a),s}bbox(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let s=1,a=0,l=0,u=0,h=1/0,g=-1/0,m=1/0,x=-1/0;for(;e.pos<i;){if(a<=0){const _=e.readVarint();s=7&_,a=_>>3}if(a--,s===1||s===2)l+=e.readSVarint(),u+=e.readSVarint(),l<h&&(h=l),l>g&&(g=l),u<m&&(m=u),u>x&&(x=u);else if(s!==7)throw new Error(`unknown command ${s}`)}return[h,m,g,x]}toGeoJSON(e,i,s){const a=this.extent*Math.pow(2,s),l=this.extent*e,u=this.extent*i,h=this.loadGeometry();function g(T){return[360*(T.x+l)/a-180,360/Math.PI*Math.atan(Math.exp((1-2*(T.y+u)/a)*Math.PI))-90]}function m(T){return T.map(g)}let x;if(this.type===1){const T=[];for(const I of h)T.push(I[0]);const v=m(T);x=T.length===1?{type:"Point",coordinates:v[0]}:{type:"MultiPoint",coordinates:v}}else if(this.type===2){const T=h.map(m);x=T.length===1?{type:"LineString",coordinates:T[0]}:{type:"MultiLineString",coordinates:T}}else{if(this.type!==3)throw new Error("unknown feature type");{const T=Gd(h),v=[];for(const I of T)v.push(I.map(m));x=v.length===1?{type:"Polygon",coordinates:v[0]}:{type:"MultiPolygon",coordinates:v}}}const _={type:"Feature",geometry:x,properties:this.properties};return this.id!=null&&(_.id=this.id),_}}function Sm(r,e,i){r===1?e.id=i.readVarint():r===2?(function(s,a){const l=s.readVarint()+s.pos;for(;s.pos<l;){const u=a._keys[s.readVarint()],h=a._values[s.readVarint()];a.properties[u]=h}})(i,e):r===3?e.type=i.readVarint():r===4&&(e._geometry=i.pos)}function Gd(r){const e=r.length;if(e<=1)return[r];const i=[];let s,a;for(let l=0;l<e;l++){const u=Pm(r[l]);u!==0&&(a===void 0&&(a=u<0),a===u<0?(s&&i.push(s),s=[r[l]]):s&&s.push(r[l]))}return s&&i.push(s),i}function Pm(r){let e=0;for(let i,s,a=0,l=r.length,u=l-1;a<l;u=a++)i=r[a],s=r[u],e+=(s.x-i.x)*(i.y+s.y);return e}jl.types=["Unknown","Point","LineString","Polygon"];class Im{constructor(e,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Mm,this,i),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const i=this._pbf.readVarint()+this._pbf.pos;return new jl(this._pbf,i,this.extent,this._keys,this._values)}}function Mm(r,e,i){r===15?e.version=i.readVarint():r===1?e.name=i.readString():r===5?e.extent=i.readVarint():r===2?e._features.push(i.pos):r===3?e._keys.push(i.readString()):r===4&&e._values.push((function(s){let a=null;const l=s.readVarint()+s.pos;for(;s.pos<l;){const u=s.readVarint()>>3;a=u===1?s.readString():u===2?s.readFloat():u===3?s.readDouble():u===4?s.readVarint64():u===5?s.readVarint():u===6?s.readSVarint():u===7?s.readBoolean():null}if(a==null)throw new Error("unknown feature value");return a})(i))}class $d{constructor(e,i){this.layers=e.readFields(Em,{},i)}}function Em(r,e,i){if(r===3){const s=new Im(i,i.readVarint()+i.pos);s.length&&(e[s.name]=s)}}const gh=Math.pow(2,13);function Nl(r,e,i,s,a,l,u,h){r.emplaceBack(e,i,2*Math.floor(s*gh)+u,a*gh*2,l*gh*2,Math.round(h))}class _h{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new W,this.centroidVertexArray=new j,this.indexArray=new pe,this.programConfigurations=new _n(e.layers,e.zoom),this.segments=new Me,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){this.features=[],this.hasDependencies=ru("fill-extrusion",this.layers,i);for(const{feature:a,id:l,index:u,sourceLayerIndex:h}of e){const g=this.layers[0]._featureFilter.needGeometry,m=Ur(a,g);if(!this.layers[0]._featureFilter.filter(new nt(this.zoom),m,s))continue;const x={id:l,sourceLayerIndex:h,index:u,geometry:g?m.geometry:Nr(a),properties:a.properties,type:a.type,patterns:{}};this.hasDependencies?this.features.push(dh("fill-extrusion",this.layers,x,{zoom:this.zoom},i)):this.addFeature(x,x.geometry,u,s,{},i.subdivisionGranularity),i.featureIndex.insert(a,x.geometry,u,h,this.index,!0)}}addFeatures(e,i,s){for(const a of this.features){const{geometry:l}=a;this.addFeature(a,l,a.index,i,s,e.subdivisionGranularity)}}update(e,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s})}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,Tm),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,wm.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,i,s,a,l,u){for(const h of Ia(i,500)){const g={x:0,y:0,sampleCount:0},m=this.layoutVertexArray.length;this.processPolygon(g,a,e,h,u);const x=this.layoutVertexArray.length-m,_=Math.floor(g.x/g.sampleCount),T=Math.floor(g.y/g.sampleCount);for(let v=0;v<x;v++)this.centroidVertexArray.emplaceBack(_,T)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:l,canonical:a})}processPolygon(e,i,s,a,l){if(a.length<1||Zd(a[0]))return;for(const _ of a)_.length!==0&&Cm(e,_);const u={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},h=l.fill.getGranularityForZoomLevel(i.z),g=jl.types[s.type]==="Polygon";for(const _ of a){if(_.length===0||Zd(_))continue;const T=sa(_,h,g);this._generateSideFaces(T,u)}if(!g)return;const m=Vd(a,i,h,!1),x=this.layoutVertexArray;jd(((_,T)=>{Nl(x,_,T,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,m.verticesFlattened,m.indicesTriangles)}_generateSideFaces(e,i){let s=0;for(let a=1;a<e.length;a++){const l=e[a],u=e[a-1];if(Am(l,u))continue;i.segment.vertexLength+4>Me.MAX_VERTEX_ARRAY_LENGTH&&(i.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const h=l.sub(u)._perp()._unit(),g=u.dist(l);s+g>32768&&(s=0),Nl(this.layoutVertexArray,l.x,l.y,h.x,h.y,0,0,s),Nl(this.layoutVertexArray,l.x,l.y,h.x,h.y,0,1,s),s+=g,Nl(this.layoutVertexArray,u.x,u.y,h.x,h.y,0,0,s),Nl(this.layoutVertexArray,u.x,u.y,h.x,h.y,0,1,s);const m=i.segment.vertexLength;this.indexArray.emplaceBack(m,m+2,m+1),this.indexArray.emplaceBack(m+1,m+2,m+3),i.segment.vertexLength+=4,i.segment.primitiveLength+=2}}}function Cm(r,e){for(let i=0;i<e.length;i++){const s=e[i];i===e.length-1&&e[0].x===s.x&&e[0].y===s.y||(r.x+=s.x,r.y+=s.y,r.sampleCount++)}}function Am(r,e){return r.x===e.x&&(r.x<0||r.x>Re)||r.y===e.y&&(r.y<0||r.y>Re)}function Zd(r){return r.every((e=>e.x<0))||r.every((e=>e.x>Re))||r.every((e=>e.y<0))||r.every((e=>e.y>Re))}let qd;Se("FillExtrusionBucket",_h,{omit:["layers","features"]});var Dm={get paint(){return qd=qd||new ni({"fill-extrusion-opacity":new Ie(he["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ce(he["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ie(he["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ie(he["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Hs(he["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ce(he["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ce(he["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ie(he["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class zm extends Ui{constructor(e,i){super(e,Dm,i)}createBucket(e){return new _h(e)}queryRadius(){return tu(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:a,transform:l,pixelsToTileUnits:u,pixelPosMatrix:h}){const g=iu(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-l.bearingInRadians,u),m=this.paint.get("fill-extrusion-height").evaluate(i,s),x=this.paint.get("fill-extrusion-base").evaluate(i,s),_=(function(v,I){const M=[];for(const A of v){const D=[A.x,A.y,0,1];ze(D,D,I),M.push(new we(D[0]/D[3],D[1]/D[3]))}return M})(g,h),T=(function(v,I,M,A){const D=[],L=[],k=A[8]*I,B=A[9]*I,O=A[10]*I,U=A[11]*I,H=A[8]*M,J=A[9]*M,ee=A[10]*M,re=A[11]*M;for(const ue of v){const le=[],ce=[];for(const se of ue){const ye=se.x,Te=se.y,be=A[0]*ye+A[4]*Te+A[12],me=A[1]*ye+A[5]*Te+A[13],Ae=A[2]*ye+A[6]*Te+A[14],He=A[3]*ye+A[7]*Te+A[15],Qe=Ae+O,it=He+U,ci=be+H,St=me+J,jt=Ae+ee,Xt=He+re,yt=new we((be+k)/it,(me+B)/it);yt.z=Qe/it,le.push(yt);const ei=new we(ci/Xt,St/Xt);ei.z=jt/Xt,ce.push(ei)}D.push(le),L.push(ce)}return[D,L]})(a,x,m,h);return(function(v,I,M){let A=1/0;yd(M,I)&&(A=Wd(M,I[0]));for(let D=0;D<I.length;D++){const L=I[D],k=v[D];for(let B=0;B<L.length-1;B++){const O=L[B],U=[O,L[B+1],k[B+1],k[B],O];_d(M,U)&&(A=Math.min(A,Wd(M,U)))}}return A!==1/0&&A})(T[0],T[1],_)}}function Ul(r,e){return r.x*e.x+r.y*e.y}function Wd(r,e){if(r.length===1){let i=0;const s=e[i++];let a;for(;!a||s.equals(a);)if(a=e[i++],!a)return 1/0;for(;i<e.length;i++){const l=e[i],u=r[0],h=a.sub(s),g=l.sub(s),m=u.sub(s),x=Ul(h,h),_=Ul(h,g),T=Ul(g,g),v=Ul(m,h),I=Ul(m,g),M=x*T-_*_,A=(T*v-_*I)/M,D=(x*I-_*v)/M,L=s.z*(1-A-D)+a.z*A+l.z*D;if(isFinite(L))return L}return 1/0}{let i=1/0;for(const s of e)i=Math.min(i,s.z);return i}}const Xd=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class ou{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,s]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const a=s>>4;if(a!==1)throw new Error(`Got v${a} data when expected v1.`);const l=Xd[15&s];if(!l)throw new Error("Unrecognized array type.");const[u]=new Uint16Array(e,2,1),[h]=new Uint32Array(e,4,1);return new ou(h,u,l,e)}constructor(e,i=64,s=Float64Array,a){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const l=Xd.indexOf(this.ArrayType),u=2*e*this.ArrayType.BYTES_PER_ELEMENT,h=e*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-h%8)%8;if(l<0)throw new Error(`Unexpected typed array class: ${s}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+h+g,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+u+h+g),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+h+g,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+l]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=i,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return yh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,s,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:u,nodeSize:h}=this,g=[0,l.length-1,0],m=[];for(;g.length;){const x=g.pop()||0,_=g.pop()||0,T=g.pop()||0;if(_-T<=h){for(let A=T;A<=_;A++){const D=u[2*A],L=u[2*A+1];D>=e&&D<=s&&L>=i&&L<=a&&m.push(l[A])}continue}const v=T+_>>1,I=u[2*v],M=u[2*v+1];I>=e&&I<=s&&M>=i&&M<=a&&m.push(l[v]),(x===0?e<=I:i<=M)&&(g.push(T),g.push(v-1),g.push(1-x)),(x===0?s>=I:a>=M)&&(g.push(v+1),g.push(_),g.push(1-x))}return m}within(e,i,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:l,nodeSize:u}=this,h=[0,a.length-1,0],g=[],m=s*s;for(;h.length;){const x=h.pop()||0,_=h.pop()||0,T=h.pop()||0;if(_-T<=u){for(let A=T;A<=_;A++)Yd(l[2*A],l[2*A+1],e,i)<=m&&g.push(a[A]);continue}const v=T+_>>1,I=l[2*v],M=l[2*v+1];Yd(I,M,e,i)<=m&&g.push(a[v]),(x===0?e-s<=I:i-s<=M)&&(h.push(T),h.push(v-1),h.push(1-x)),(x===0?e+s>=I:i+s>=M)&&(h.push(v+1),h.push(_),h.push(1-x))}return g}}function yh(r,e,i,s,a,l){if(a-s<=i)return;const u=s+a>>1;Hd(r,e,u,s,a,l),yh(r,e,i,s,u-1,1-l),yh(r,e,i,u+1,a,1-l)}function Hd(r,e,i,s,a,l){for(;a>s;){if(a-s>600){const m=a-s+1,x=i-s+1,_=Math.log(m),T=.5*Math.exp(2*_/3),v=.5*Math.sqrt(_*T*(m-T)/m)*(x-m/2<0?-1:1);Hd(r,e,i,Math.max(s,Math.floor(i-x*T/m+v)),Math.min(a,Math.floor(i+(m-x)*T/m+v)),l)}const u=e[2*i+l];let h=s,g=a;for(Gl(r,e,s,i),e[2*a+l]>u&&Gl(r,e,s,a);h<g;){for(Gl(r,e,h,g),h++,g--;e[2*h+l]<u;)h++;for(;e[2*g+l]>u;)g--}e[2*s+l]===u?Gl(r,e,s,g):(g++,Gl(r,e,g,a)),g<=i&&(s=g+1),i<=g&&(a=g-1)}}function Gl(r,e,i,s){xh(r,i,s),xh(e,2*i,2*s),xh(e,2*i+1,2*s+1)}function xh(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function Yd(r,e,i,s){const a=r-i,l=e-s;return a*a+l*l}function vh(r,e,i,s){let a=s;const l=e+(i-e>>1);let u,h=i-e;const g=r[e],m=r[e+1],x=r[i],_=r[i+1];for(let T=e+3;T<i;T+=3){const v=km(r[T],r[T+1],g,m,x,_);if(v>a)u=T,a=v;else if(v===a){const I=Math.abs(T-l);I<h&&(u=T,h=I)}}a>s&&(u-e>3&&vh(r,e,u,s),r[u+2]=a,i-u>3&&vh(r,u,i,s))}function km(r,e,i,s,a,l){let u=a-i,h=l-s;if(u!==0||h!==0){const g=((r-i)*u+(e-s)*h)/(u*u+h*h);g>1?(i=a,s=l):g>0&&(i+=u*g,s+=h*g)}return u=r-i,h=e-s,u*u+h*h}function ai(r,e,i,s){const a={type:e,geom:i},l={id:r??null,type:a.type,geometry:a.geom,tags:s,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(a.type){case"Point":case"MultiPoint":case"LineString":lu(l,a.geom);break;case"Polygon":lu(l,a.geom[0]);break;case"MultiLineString":for(const u of a.geom)lu(l,u);break;case"MultiPolygon":for(const u of a.geom)lu(l,u[0])}return l}function lu(r,e){for(let i=0;i<e.length;i+=3)r.minX=Math.min(r.minX,e[i]),r.minY=Math.min(r.minY,e[i+1]),r.maxX=Math.max(r.maxX,e[i]),r.maxY=Math.max(r.maxY,e[i+1])}function bh(r,e){const i=[];switch(r.type){case"FeatureCollection":for(let s=0;s<r.features.length;s++)cu(i,r.features[s],e,s);break;case"Feature":cu(i,r,e);break;default:cu(i,{geometry:r,properties:void 0},e)}return i}function cu(r,e,i,s){if(!e.geometry)return;if(e.geometry.type==="GeometryCollection")return void(function(h,g,m,x,_){for(const T of m.geometries)cu(h,{id:g.id,geometry:T,properties:g.properties},x,_)})(r,e,e.geometry,i,s);if(!e.geometry.coordinates?.length)return;const l=(function(h,g,m){return g.promoteId?h.properties?.[g.promoteId]:g.generateId?m||0:h.id})(e,i,s),u=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2);switch(e.geometry.type){case"Point":return void(function(h,g,m,x){const _=[];_.push(to(m.coordinates[0]),io(m.coordinates[1]),0),h.push(ai(g,"Point",_,x))})(r,l,e.geometry,e.properties);case"MultiPoint":return void(function(h,g,m,x){const _=[];for(const T of m.coordinates)_.push(to(T[0]),io(T[1]),0);h.push(ai(g,"MultiPoint",_,x))})(r,l,e.geometry,e.properties);case"LineString":return void(function(h,g,m,x,_){const T=[];wh(m.coordinates,T,x,!1),h.push(ai(g,"LineString",T,_))})(r,l,e.geometry,u,e.properties);case"MultiLineString":return void(function(h,g,m,x,_,T){if(_.lineMetrics)for(const v of m.coordinates){const I=[];wh(v,I,x,!1),h.push(ai(g,"LineString",I,T))}else{const v=[];Th(m.coordinates,v,x,!1),h.push(ai(g,"MultiLineString",v,T))}})(r,l,e.geometry,u,i,e.properties);case"Polygon":return void(function(h,g,m,x,_){const T=[];Th(m.coordinates,T,x,!0),h.push(ai(g,"Polygon",T,_))})(r,l,e.geometry,u,e.properties);case"MultiPolygon":return void(function(h,g,m,x,_){const T=[];for(const v of m.coordinates){const I=[];Th(v,I,x,!0),T.push(I)}h.push(ai(g,"MultiPolygon",T,_))})(r,l,e.geometry,u,e.properties);default:throw new Error("Input data is not a valid GeoJSON object.")}}function wh(r,e,i,s){let a,l,u=0;for(let g=0;g<r.length;g++){const m=to(r[g][0]),x=io(r[g][1]);e.push(m,x,0),g>0&&(u+=s?(a*x-m*l)/2:Math.sqrt(Math.pow(m-a,2)+Math.pow(x-l,2))),a=m,l=x}const h=e.length-3;e[2]=1,i>0&&vh(e,0,h,i),e[h+2]=1,e.size=Math.abs(u),e.start=0,e.end=e.size}function Th(r,e,i,s){for(let a=0;a<r.length;a++){const l=[];wh(r[a],l,i,s),e.push(l)}}function to(r){return r/360+.5}function io(r){const e=Math.sin(r*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function uu(r){const e={type:"Feature",geometry:Rm(r),properties:r.tags};return r.id!=null&&(e.id=r.id),e}function Rm(r){const{type:e,geometry:i}=r;switch(e){case"Point":return{type:e,coordinates:Kd(i[0],i[1])};case"MultiPoint":case"LineString":return{type:e,coordinates:Sh(i)};case"MultiLineString":case"Polygon":return{type:e,coordinates:i.map((s=>Sh(s)))};case"MultiPolygon":return{type:e,coordinates:i.map((s=>s.map((a=>Sh(a)))))}}}function Sh(r){const e=[];for(let i=0;i<r.length;i+=3)e.push(Kd(r[i],r[i+1]));return e}function Kd(r,e){return[Jd(r),Qd(e)]}function Jd(r){return 360*(r-.5)}function Qd(r){const e=(180-360*r)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}var pi;function yn(r,e,i,s,a,l,u,h){if(s/=e,l>=(i/=e)&&u<s)return r;if(u<i||l>=s)return null;const g=[];for(const m of r){const x=a===pi.X?m.minX:m.minY,_=a===pi.X?m.maxX:m.maxY;if(x>=i&&_<s)g.push(m);else if(!(_<i||x>=s))switch(m.type){case"Point":case"MultiPoint":Fm(m,g,i,s,a);continue;case"LineString":Lm(m,g,i,s,a,h);continue;case"MultiLineString":Bm(m,g,i,s,a);continue;case"Polygon":Om(m,g,i,s,a);continue;case"MultiPolygon":Vm(m,g,i,s,a);continue}}return g.length?g:null}function Fm(r,e,i,s,a){const l=[];(function(u,h,g,m,x){for(let _=0;_<u.length;_+=3){const T=u[_+x];T>=g&&T<=m&&ro(h,u[_],u[_+1],u[_+2])}})(r.geometry,l,i,s,a),l.length&&e.push(ai(r.id,l.length===3?"Point":"MultiPoint",l,r.tags))}function Lm(r,e,i,s,a,l){const u=[];if(ep(r.geometry,u,i,s,a,!1,l.lineMetrics),u.length)if(l.lineMetrics)for(const h of u)e.push(ai(r.id,"LineString",h,r.tags));else e.push(u.length>1?ai(r.id,"MultiLineString",u,r.tags):ai(r.id,"LineString",u[0],r.tags))}function Bm(r,e,i,s,a){const l=[];Ph(r.geometry,l,i,s,a,!1),l.length&&e.push(l.length!==1?ai(r.id,"MultiLineString",l,r.tags):ai(r.id,"LineString",l[0],r.tags))}function Om(r,e,i,s,a){const l=[];Ph(r.geometry,l,i,s,a,!0),l.length&&e.push(ai(r.id,"Polygon",l,r.tags))}function Vm(r,e,i,s,a){const l=[];for(const u of r.geometry){const h=[];Ph(u,h,i,s,a,!0),h.length&&l.push(h)}l.length&&e.push(ai(r.id,"MultiPolygon",l,r.tags))}function ep(r,e,i,s,a,l,u){let h=tp(r);const g=a===pi.X?jm:Nm;let m,x,_=r.start;for(let A=0;A<r.length-3;A+=3){const D=r[A],L=r[A+1],k=r[A+2],B=r[A+3],O=r[A+4],U=a===pi.X?D:L,H=a===pi.X?B:O;let J=!1;u&&(m=Math.sqrt(Math.pow(D-B,2)+Math.pow(L-O,2))),U<i?H>i&&(x=g(h,D,L,B,O,i),u&&(h.start=_+m*x)):U>s?H<s&&(x=g(h,D,L,B,O,s),u&&(h.start=_+m*x)):ro(h,D,L,k),H<i&&U>=i&&(x=g(h,D,L,B,O,i),J=!0),H>s&&U<=s&&(x=g(h,D,L,B,O,s),J=!0),!l&&J&&(u&&(h.end=_+m*x),e.push(h),h=tp(r)),u&&(_+=m)}let T=r.length-3;const v=r[T],I=r[T+1],M=a===pi.X?v:I;M>=i&&M<=s&&ro(h,v,I,r[T+2]),T=h.length-3,l&&T>=3&&(h[T]!==h[0]||h[T+1]!==h[1])&&ro(h,h[0],h[1],h[2]),h.length&&e.push(h)}function tp(r){const e=[];return e.size=r.size,e.start=r.start,e.end=r.end,e}function Ph(r,e,i,s,a,l){for(const u of r)ep(u,e,i,s,a,l,!1)}function ro(r,e,i,s){r.push(e,i,s)}function jm(r,e,i,s,a,l){const u=(l-e)/(s-e);return ro(r,l,i+(a-i)*u,1),u}function Nm(r,e,i,s,a,l){const u=(l-i)/(a-i);return ro(r,e+(s-e)*u,l,1),u}function Ih(r,e){const i=e.buffer/e.extent;let s=r;const a=yn(r,1,-1-i,i,pi.X,-1,2,e),l=yn(r,1,1-i,2+i,pi.X,-1,2,e);return(a||l)&&(s=yn(r,1,-i,1+i,pi.X,-1,2,e)||[],a&&(s=ip(a,1).concat(s)),l&&(s=s.concat(ip(l,-1)))),s}function ip(r,e){const i=[];for(const s of r)switch(s.type){case"Point":case"MultiPoint":case"LineString":{const a=Mh(s.geometry,e);i.push(ai(s.id,s.type,a,s.tags));continue}case"MultiLineString":case"Polygon":{const a=[];for(const l of s.geometry)a.push(Mh(l,e));i.push(ai(s.id,s.type,a,s.tags));continue}case"MultiPolygon":{const a=[];for(const l of s.geometry){const u=[];for(const h of l)u.push(Mh(h,e));a.push(u)}i.push(ai(s.id,s.type,a,s.tags));continue}}return i}function Mh(r,e){const i=[];i.size=r.size,r.start!==void 0&&(i.start=r.start,i.end=r.end);for(let s=0;s<r.length;s+=3)i.push(r[s]+e,r[s+1],r[s+2]);return i}function Um(r,e,i){const s=!!e.newGeometry,a=e.removeAllProperties||e.removeProperties?.length>0||e.addOrUpdateProperties?.length>0;if(s){const l=r[0];let u=bh({type:"FeatureCollection",features:[{type:"Feature",id:l.id,geometry:e.newGeometry,properties:a?rp(l.tags,e):l.tags}]},i);return u=Ih(u,i),u}if(a){const l=[];for(const u of r){const h={...u};h.tags=rp(h.tags,e),l.push(h)}return l}return[]}function rp(r,e){if(e.removeAllProperties)return{};const i={...r||{}};if(e.removeProperties)for(const s of e.removeProperties)delete i[s];if(e.addOrUpdateProperties)for(const{key:s,value:a}of e.addOrUpdateProperties)i[s]=a;return i}(function(r){r[r.X=0]="X",r[r.Y=1]="Y"})(pi||(pi={}));const Eh={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:r=>r};class Gm{constructor(e){this.options=Object.assign(Object.create(Eh),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(e){const i=[];for(const s of e){if(!s.geometry)continue;const[a,l]=s.geometry.coordinates,[u,h]=[to(a),io(l)];i.push({id:s.id,type:"Point",geometry:[u,h],tags:s.properties})}this.createIndex(i)}initialize(e){const i=[];for(const s of e)s.type==="Point"&&i.push(s);this.createIndex(i)}updateIndex(e,i,s){this.options=Object.assign(Object.create(Eh),s.clusterOptions),this.initialize(e)}createIndex(e){const{log:i,minZoom:s,maxZoom:a}=this.options;i&&console.time("total time");const l=`prepare ${e.length} points`;i&&console.time(l),this.points=e;const u=[];for(let g=0;g<e.length;g++){const m=e[g];if(!m?.geometry)continue;let[x,_]=m.geometry;x=Math.fround(x),_=Math.fround(_),u.push(x,_,1/0,g,-1,1),this.options.reduce&&u.push(0)}let h=this.trees[a+1]=this.createTree(u);i&&console.timeEnd(l);for(let g=a;g>=s;g--){const m=Date.now();h=this.trees[g]=this.createTree(this.cluster(h,g)),i&&console.log("z%d: %d clusters in %dms",g,h.numItems,Date.now()-m)}i&&console.timeEnd("total time")}getClusters(e,i){return this.getClustersInternal(e,i).map((s=>uu(s)))}getClustersInternal(e,i){let s=((e[0]+180)%360+360)%360-180;const a=Math.max(-90,Math.min(90,e[1]));let l=e[2]===180?180:((e[2]+180)%360+360)%360-180;const u=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)s=-180,l=180;else if(s>l){const _=this.getClustersInternal([s,a,180,u],i),T=this.getClustersInternal([-180,a,l,u],i);return _.concat(T)}const h=this.trees[this.limitZoom(i)],g=h.range(to(s),io(u),to(l),io(a)),m=h.flatData,x=[];for(const _ of g){const T=this.stride*_;x.push(m[T+5]>1?$m(m,T,this.clusterProps):this.points[m[T+3]])}return x}getChildren(e){const i=this.getOriginId(e),s=this.getOriginZoom(e),a=new Error("No cluster with the specified id: "+e),l=this.trees[s];if(!l)throw a;const u=l.flatData;if(i*this.stride>=u.length)throw a;const h=this.options.radius/(this.options.extent*Math.pow(2,s-1)),g=l.within(u[i*this.stride],u[i*this.stride+1],h),m=[];for(const x of g){const _=x*this.stride;u[_+4]===e&&m.push(u[_+5]>1?Zm(u,_,this.clusterProps):uu(this.points[u[_+3]]))}if(m.length===0)throw a;return m}getLeaves(e,i,s){const a=[];return this.appendLeaves(a,e,i=i||10,s=s||0,0),a}getTile(e,i,s){const a=this.trees[this.limitZoom(e)];if(!a)return null;const l=Math.pow(2,e),{extent:u,radius:h}=this.options,g=h/u,m=(s-g)/l,x=(s+1+g)/l,_={transformed:!0,features:[],source:null,x:i,y:s,z:e};return this.addTileFeatures(a.range((i-g)/l,m,(i+1+g)/l,x),a.flatData,i,s,l,_),i===0&&this.addTileFeatures(a.range(1-g/l,m,1,x),a.flatData,l,s,l,_),i===l-1&&this.addTileFeatures(a.range(0,m,g/l,x),a.flatData,-1,s,l,_),_}getClusterExpansionZoom(e){return this.getOriginZoom(e)}appendLeaves(e,i,s,a,l){const u=this.getChildren(i);for(const h of u){const g=h.properties;if(g?.cluster?l+g.point_count<=a?l+=g.point_count:l=this.appendLeaves(e,g.cluster_id,s,a,l):l<a?l++:e.push(h),e.length===s)break}return l}createTree(e){const i=new ou(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let s=0;s<e.length;s+=this.stride)i.add(e[s],e[s+1]);return i.finish(),i.flatData=e,i.data=null,i}addTileFeatures(e,i,s,a,l,u){for(const h of e){const g=h*this.stride,m=i[g+5]>1;let x,_,T;if(m)x=Ch(i,g,this.clusterProps),_=i[g],T=i[g+1];else{const M=this.points[i[g+3]];x=M.tags,[_,T]=M.geometry}const v={type:1,geometry:[[Math.round(this.options.extent*(_*l-s)),Math.round(this.options.extent*(T*l-a))]],tags:x};let I;I=m||this.options.generateId?i[g+3]:this.points[i[g+3]].id,I!==void 0&&(v.id=I),u.features.push(v)}}limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}cluster(e,i){const{radius:s,extent:a,reduce:l,minPoints:u}=this.options,h=s/(a*Math.pow(2,i)),g=e.flatData,m=[],x=this.stride;for(let _=0;_<g.length;_+=x){if(g[_+2]<=i)continue;g[_+2]=i;const T=g[_],v=g[_+1],I=e.within(g[_],g[_+1],h),M=g[_+5];let A=M;for(const D of I){const L=D*x;g[L+2]>i&&(A+=g[L+5])}if(A>M&&A>=u){let D,L=T*M,k=v*M,B=-1;const O=(_/x<<5)+(i+1)+this.points.length;for(const U of I){const H=U*x;if(g[H+2]<=i)continue;g[H+2]=i;const J=g[H+5];L+=g[H]*J,k+=g[H+1]*J,g[H+4]=O,l&&(D||(D=this.map(g,_,!0),B=this.clusterProps.length,this.clusterProps.push(D)),l(D,this.map(g,H)))}g[_+4]=O,m.push(L/A,k/A,1/0,O,-1,A),l&&m.push(B)}else{for(let D=0;D<x;D++)m.push(g[_+D]);if(A>1)for(const D of I){const L=D*x;if(!(g[L+2]<=i)){g[L+2]=i;for(let k=0;k<x;k++)m.push(g[L+k])}}}}return m}getOriginId(e){return e-this.points.length>>5}getOriginZoom(e){return(e-this.points.length)%32}map(e,i,s){if(e[i+5]>1){const u=this.clusterProps[e[i+6]];return s?Object.assign({},u):u}const a=this.points[e[i+3]].tags,l=this.options.map(a);return s&&l===a?Object.assign({},l):l}}function $m(r,e,i){return{id:r[e+3],type:"Point",tags:Ch(r,e,i),geometry:[r[e],r[e+1]]}}function Zm(r,e,i){return{type:"Feature",id:r[e+3],properties:Ch(r,e,i),geometry:{type:"Point",coordinates:[Jd(r[e]),Qd(r[e+1])]}}}function Ch(r,e,i){const s=r[e+5],a=s>=1e4?`${Math.round(s/1e3)}k`:s>=1e3?Math.round(s/100)/10+"k":s,l=r[e+6],u=l===-1?{}:Object.assign({},i[l]);return Object.assign(u,{cluster:!0,cluster_id:r[e+3],point_count:s,point_count_abbreviated:a})}const Ah="geojsonvt_clip_start",Dh="geojsonvt_clip_end";function np(r,e,i,s,a){const l=e===a.maxZoom?0:a.tolerance/((1<<e)*a.extent),u={transformed:!1,features:[],source:null,x:i,y:s,z:e,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:r.length};for(const h of r)qm(u,h,l,a);return u}function qm(r,e,i,s){switch(r.minX=Math.min(r.minX,e.minX),r.minY=Math.min(r.minY,e.minY),r.maxX=Math.max(r.maxX,e.maxX),r.maxY=Math.max(r.maxY,e.maxY),e.type){case"Point":case"MultiPoint":return void(function(a,l){const u=[];for(let g=0;g<l.geometry.length;g+=3)u.push(l.geometry[g],l.geometry[g+1]),a.numPoints++,a.numSimplified++;if(!u.length)return;const h={type:1,tags:l.tags||null,geometry:u};l.id!==null&&(h.id=l.id),a.features.push(h)})(r,e);case"LineString":return void(function(a,l,u,h){const g=[];if(zh(g,l.geometry,a,u,!1,!1),!g.length)return;let m=l.tags||null;if(h.lineMetrics){m={};for(const _ in l.tags)m[_]=l.tags[_];m[Ah]=l.geometry.start/l.geometry.size,m[Dh]=l.geometry.end/l.geometry.size}const x={type:2,tags:m,geometry:g};l.id!==null&&(x.id=l.id),a.features.push(x)})(r,e,i,s);case"MultiLineString":case"Polygon":return void(function(a,l,u){const h=[];for(let m=0;m<l.geometry.length;m++)zh(h,l.geometry[m],a,u,l.type==="Polygon",m===0);if(!h.length)return;const g={type:l.type==="Polygon"?3:2,tags:l.tags||null,geometry:h};l.id!==null&&(g.id=l.id),a.features.push(g)})(r,e,i);case"MultiPolygon":return void(function(a,l,u){const h=[];for(let m=0;m<l.geometry.length;m++){const x=l.geometry[m];for(let _=0;_<x.length;_++)zh(h,x[_],a,u,!0,_===0)}if(!h.length)return;const g={type:3,tags:l.tags||null,geometry:h};l.id!==null&&(g.id=l.id),a.features.push(g)})(r,e,i)}}function zh(r,e,i,s,a,l){const u=s*s;if(s>0&&e.size<(a?u:s))return void(i.numPoints+=e.length/3);const h=[];for(let g=0;g<e.length;g+=3)(s===0||e[g+2]>u)&&(i.numSimplified++,h.push(e[g],e[g+1])),i.numPoints++;a&&(function(g,m){let x=0;for(let _=0,T=g.length,v=T-2;_<T;v=_,_+=2)x+=(g[_]-g[v])*(g[_+1]+g[v+1]);if(x>0===m)for(let _=0,T=g.length;_<T/2;_+=2){const v=g[_],I=g[_+1];g[_]=g[T-2-_],g[_+1]=g[T-1-_],g[T-2-_]=v,g[T-1-_]=I}})(h,l),r.push(h)}function sp(r,e){if(r.transformed)return r;const i=1<<r.z,s=r.x,a=r.y;for(const l of r.features)l.type===1?Wm(l,e,i,s,a):Xm(l,e,i,s,a);return r.transformed=!0,r}function Wm(r,e,i,s,a){const l=r,u=r.geometry,h=[];for(let g=0;g<u.length;g+=2)h.push(ap(u[g],u[g+1],e,i,s,a));return l.geometry=h,l}function Xm(r,e,i,s,a){const l=r,u=r.geometry,h=[];for(const g of u){const m=[];for(let x=0;x<g.length;x+=2)m.push(ap(g[x],g[x+1],e,i,s,a));h.push(m)}return l.geometry=h,l}function ap(r,e,i,s,a,l){return[Math.round(i*(r*s-a)),Math.round(i*(e*s-l))]}class Hm{constructor(e){this.options=e,this.stats={},this.total=0,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,i,s){s.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(i),s.debug>1&&console.timeEnd("invalidating");const[a,l,u]=[0,0,0],h=np(e,a,l,u,s);h.source=e;const g=hu(a,l,u);if(this.tiles[g]=h,this.tileCoords.push({z:a,x:l,y:u,id:g}),s.debug){const m=`z${a}`;this.stats[m]=(this.stats[m]||0)+1,this.total++}}getClusterExpansionZoom(e){return null}getChildren(e){return null}getLeaves(e,i,s){return null}getTile(e,i,s){const{extent:a,debug:l}=this.options,u=1<<e,h=hu(e,i=i+u&u-1,s);if(this.tiles[h])return sp(this.tiles[h],a);l>1&&console.log("drilling down to z%d-%d-%d",e,i,s);let g,m=e,x=i,_=s;for(;!g&&m>0;)m--,x>>=1,_>>=1,g=this.tiles[hu(m,x,_)];return g?.source?(l>1&&(console.log("found parent tile z%d-%d-%d",m,x,_),console.time("drilling down")),this.splitTile(g.source,m,x,_,e,i,s),l>1&&console.timeEnd("drilling down"),this.tiles[h]?sp(this.tiles[h],a):null):null}splitTile(e,i,s,a,l,u,h){const g=[e,i,s,a],m=this.options,x=m.debug;for(;g.length;){a=g.pop(),s=g.pop(),i=g.pop(),e=g.pop();const _=1<<i,T=hu(i,s,a);let v=this.tiles[T];if(!v&&(x>1&&console.time("creation"),v=this.tiles[T]=np(e,i,s,a,m),this.tileCoords.push({z:i,x:s,y:a,id:T}),x)){x>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",i,s,a,v.numFeatures,v.numPoints,v.numSimplified),console.timeEnd("creation"));const J=`z${i}`;this.stats[J]=(this.stats[J]||0)+1,this.total++}if(v.source=e,l==null){if(i===m.indexMaxZoom||v.numPoints<=m.indexMaxPoints)continue}else{if(i===m.maxZoom||i===l)continue;if(l!=null){const J=l-i;if(s!==u>>J||a!==h>>J)continue}}if(v.source=null,!e.length)continue;x>1&&console.time("clipping");const I=.5*m.buffer/m.extent,M=.5-I,A=.5+I,D=1+I;let L=null,k=null,B=null,O=null;const U=yn(e,_,s-I,s+A,pi.X,v.minX,v.maxX,m),H=yn(e,_,s+M,s+D,pi.X,v.minX,v.maxX,m);U&&(L=yn(U,_,a-I,a+A,pi.Y,v.minY,v.maxY,m),k=yn(U,_,a+M,a+D,pi.Y,v.minY,v.maxY,m)),H&&(B=yn(H,_,a-I,a+A,pi.Y,v.minY,v.maxY,m),O=yn(H,_,a+M,a+D,pi.Y,v.minY,v.maxY,m)),x>1&&console.timeEnd("clipping"),g.push(L||[],i+1,2*s,2*a),g.push(k||[],i+1,2*s,2*a+1),g.push(B||[],i+1,2*s+1,2*a),g.push(O||[],i+1,2*s+1,2*a+1)}}invalidateTiles(e){if(!e.length)return;const i=this.options,{debug:s}=i;let a=1/0,l=-1/0,u=1/0,h=-1/0;for(const x of e)a=Math.min(a,x.minX),l=Math.max(l,x.maxX),u=Math.min(u,x.minY),h=Math.max(h,x.maxY);const g=i.buffer/i.extent,m=new Set;for(const x in this.tiles){const _=this.tiles[x],T=1<<_.z,v=(_.x-g)/T,I=(_.x+1+g)/T,M=(_.y-g)/T,A=(_.y+1+g)/T;if(l<v||a>=I||h<M||u>=A)continue;let D=!1;for(const L of e)if(L.maxX>=v&&L.minX<I&&L.maxY>=M&&L.minY<A){D=!0;break}if(D){if(s){s>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",_.z,_.x,_.y,_.numFeatures,_.numPoints,_.numSimplified);const L=`z${_.z}`;this.stats[L]=(this.stats[L]||0)-1,this.total--}delete this.tiles[x],m.add(x)}}m.size&&(this.tileCoords=this.tileCoords.filter((x=>!m.has(x.id))))}}function hu(r,e,i){return 32*((1<<r)*i+e)+r}const Ym={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:Eh,debug:0},Km=Ct([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Jm}=Km,Qm=Ct([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:eg}=Qm,tg=Math.cos(Math.PI/180*37.5),op=Math.pow(2,14)/.5;class kh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((i=>{this.gradients[i.id]={}})),this.layoutVertexArray=new G,this.layoutVertexArray2=new q,this.indexArray=new pe,this.programConfigurations=new _n(e.layers,e.zoom),this.segments=new Me,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){this.hasDependencies=ru("line",this.layers,i)||this.hasLineDasharray(this.layers);const a=this.layers[0].layout.get("line-sort-key"),l=!a.isConstant(),u=[];for(const{feature:h,id:g,index:m,sourceLayerIndex:x}of e){const _=this.layers[0]._featureFilter.needGeometry,T=Ur(h,_);if(!this.layers[0]._featureFilter.filter(new nt(this.zoom),T,s))continue;const v=l?a.evaluate(T,{},s):void 0,I={id:g,properties:h.properties,type:h.type,sourceLayerIndex:x,index:m,geometry:_?T.geometry:Nr(h),patterns:{},dashes:{},sortKey:v};u.push(I)}l&&u.sort(((h,g)=>h.sortKey-g.sortKey));for(const h of u){const{geometry:g,index:m,sourceLayerIndex:x}=h;this.hasDependencies?(ru("line",this.layers,i)?dh("line",this.layers,h,{zoom:this.zoom},i):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,h,this.zoom,i),this.patternFeatures.push(h)):this.addFeature(h,g,m,s,{},{},i.subdivisionGranularity),i.featureIndex.insert(e[m].feature,g,m,x,this.index)}}update(e,i,s,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s,dashPositions:a})}addFeatures(e,i,s,a){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,i,s,a,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,eg)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Jm),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.prototype.hasOwnProperty.call(e.properties,Ah)&&Object.prototype.hasOwnProperty.call(e.properties,Dh))return{start:+e.properties[Ah],end:+e.properties[Dh]}}addFeature(e,i,s,a,l,u,h){const g=this.layers[0].layout,m=g.get("line-join").evaluate(e,{}),x=g.get("line-cap"),_=g.get("line-miter-limit"),T=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const v of i)this.addLine(v,e,m,x,_,T,a,h);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:l,dashPositions:u,canonical:a})}addLine(e,i,s,a,l,u,h,g){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=sa(e,h?g.line.getGranularityForZoomLevel(h.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let k=0;k<e.length-1;k++)this.totalDistance+=e[k].dist(e[k+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=jl.types[i.type]==="Polygon";let x=e.length;for(;x>=2&&e[x-1].equals(e[x-2]);)x--;let _=0;for(;_<x-1&&e[_].equals(e[_+1]);)_++;if(x<(m?3:2))return;s==="bevel"&&(l=1.05);const T=this.overscaling<=16?122880/(512*this.overscaling):0,v=this.segments.prepareSegment(10*x,this.layoutVertexArray,this.indexArray);let I,M,A,D,L;this.e1=this.e2=-1,m&&(I=e[x-2],L=e[_].sub(I)._unit()._perp());for(let k=_;k<x;k++){if(A=k===x-1?m?e[_+1]:void 0:e[k+1],A&&e[k].equals(A))continue;L&&(D=L),I&&(M=I),I=e[k],L=A?A.sub(I)._unit()._perp():D,D=D||L;let B=D.add(L);B.x===0&&B.y===0||B._unit();const O=D.x*L.x+D.y*L.y,U=B.x*L.x+B.y*L.y,H=U!==0?1/U:1/0,J=2*Math.sqrt(2-2*U),ee=U<tg&&M&&A,re=D.x*L.y-D.y*L.x>0;if(ee&&k>_){const ce=I.dist(M);if(ce>2*T){const se=I.sub(I.sub(M)._mult(T/ce)._round());this.updateDistance(M,se),this.addCurrentVertex(se,D,0,0,v),M=se}}const ue=M&&A;let le=ue?s:m?"butt":a;if(ue&&le==="round"&&(H<u?le="miter":H<=2&&(le="fakeround")),le==="miter"&&H>l&&(le="bevel"),le==="bevel"&&(H>2&&(le="flipbevel"),H<l&&(le="miter")),M&&this.updateDistance(M,I),le==="miter")B._mult(H),this.addCurrentVertex(I,B,0,0,v);else if(le==="flipbevel"){if(H>100)B=L.mult(-1);else{const ce=H*D.add(L).mag()/D.sub(L).mag();B._perp()._mult(ce*(re?-1:1))}this.addCurrentVertex(I,B,0,0,v),this.addCurrentVertex(I,B.mult(-1),0,0,v)}else if(le==="bevel"||le==="fakeround"){const ce=-Math.sqrt(H*H-1),se=re?ce:0,ye=re?0:ce;if(M&&this.addCurrentVertex(I,D,se,ye,v),le==="fakeround"){const Te=Math.round(180*J/Math.PI/20);for(let be=1;be<Te;be++){let me=be/Te;if(me!==.5){const He=me-.5;me+=me*He*(me-1)*((1.0904+O*(O*(3.55645-1.43519*O)-3.2452))*He*He+(.848013+O*(.215638*O-1.06021)))}const Ae=L.sub(D)._mult(me)._add(D)._unit()._mult(re?-1:1);this.addHalfVertex(I,Ae.x,Ae.y,!1,re,0,v)}}A&&this.addCurrentVertex(I,L,-se,-ye,v)}else if(le==="butt")this.addCurrentVertex(I,B,0,0,v);else if(le==="square"){const ce=M?1:-1;this.addCurrentVertex(I,B,ce,ce,v)}else le==="round"&&(M&&(this.addCurrentVertex(I,D,0,0,v),this.addCurrentVertex(I,D,1,1,v,!0)),A&&(this.addCurrentVertex(I,L,-1,-1,v,!0),this.addCurrentVertex(I,L,0,0,v)));if(ee&&k<x-1){const ce=I.dist(A);if(ce>2*T){const se=I.add(A.sub(I)._mult(T/ce)._round());this.updateDistance(I,se),this.addCurrentVertex(se,L,0,0,v),I=se}}}}addCurrentVertex(e,i,s,a,l,u=!1){const h=i.y*a-i.x,g=-i.y-i.x*a;this.addHalfVertex(e,i.x+i.y*s,i.y-i.x*s,u,!1,s,l),this.addHalfVertex(e,h,g,u,!0,-a,l),this.distance>op/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,i,s,a,l,u))}addHalfVertex({x:e,y:i},s,a,l,u,h,g){const m=.5*(this.lineClips?this.scaledDistance*(op-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(l?1:0),(i<<1)+(u?1:0),Math.round(63*s)+128,Math.round(63*a)+128,1+(h===0?0:h<0?-1:1)|(63&m)<<2,m>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const x=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,x,this.e2),g.primitiveLength++),u?this.e2=x:this.e1=x}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,i){this.distance+=e.dist(i),this.updateScaledDistance()}hasLineDasharray(e){for(const i of e){const s=i.paint.get("line-dasharray");if(s&&!s.isConstant())return!0}return!1}addLineDashDependencies(e,i,s,a){for(const l of e){const u=l.paint.get("line-dasharray");if(!u||u.value.kind==="constant")continue;const h=l.layout.get("line-cap")==="round",g={dasharray:u.value.evaluate({zoom:s-1},i,{}),round:h},m={dasharray:u.value.evaluate({zoom:s},i,{}),round:h},x={dasharray:u.value.evaluate({zoom:s+1},i,{}),round:h},_=`${g.dasharray.join(",")},${g.round}`,T=`${m.dasharray.join(",")},${m.round}`,v=`${x.dasharray.join(",")},${x.round}`;a.dashDependencies[_]=g,a.dashDependencies[T]=m,a.dashDependencies[v]=x,i.dashes[l.id]={min:_,mid:T,max:v}}}}let lp,cp;Se("LineBucket",kh,{omit:["layers","patternFeatures"]});var up={get paint(){return cp=cp||new ni({"line-opacity":new Ce(he.paint_line["line-opacity"]),"line-color":new Ce(he.paint_line["line-color"]),"line-translate":new Ie(he.paint_line["line-translate"]),"line-translate-anchor":new Ie(he.paint_line["line-translate-anchor"]),"line-width":new Ce(he.paint_line["line-width"]),"line-gap-width":new Ce(he.paint_line["line-gap-width"]),"line-offset":new Ce(he.paint_line["line-offset"]),"line-blur":new Ce(he.paint_line["line-blur"]),"line-dasharray":new Hs(he.paint_line["line-dasharray"]),"line-pattern":new Hs(he.paint_line["line-pattern"]),"line-gradient":new Ys(he.paint_line["line-gradient"])})},get layout(){return lp=lp||new ni({"line-cap":new Ie(he.layout_line["line-cap"]),"line-join":new Ce(he.layout_line["line-join"]),"line-miter-limit":new Ie(he.layout_line["line-miter-limit"]),"line-round-limit":new Ie(he.layout_line["line-round-limit"]),"line-sort-key":new Ce(he.layout_line["line-sort-key"])})}};class ig extends Ce{possiblyEvaluate(e,i){return i=new nt(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,zoomHistory:i.zoomHistory,transition:i.transition}),super.possiblyEvaluate(e,i)}evaluate(e,i,s,a){return i=Ri({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,s,a)}}let du;class rg extends Ui{constructor(e,i){super(e,up,i),this.gradientVersion=0,du||(du=new ig(up.paint.properties["line-width"].specification),du.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const i=this.gradientExpression();this.stepInterpolant=!!(function(s){return s._styleExpression!==void 0})(i)&&i._styleExpression.expression instanceof sn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,i){super.recalculate(e,i),this.paint._values["line-floorwidth"]=du.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new kh(e)}queryRadius(e){const i=e,s=hp(Ka("line-width",this,i),Ka("line-gap-width",this,i)),a=Ka("line-offset",this,i);return s/2+Math.abs(a)+tu(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:a,transform:l,pixelsToTileUnits:u}){const h=iu(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-l.bearingInRadians,u),g=u/2*hp(this.paint.get("line-width").evaluate(i,s),this.paint.get("line-gap-width").evaluate(i,s)),m=this.paint.get("line-offset").evaluate(i,s);return m&&(a=(function(x,_){const T=[];for(let v=0;v<x.length;v++){const I=Wf(x[v]),M=[];for(let A=0;A<I.length;A++){const D=I[A],L=I[A-1],k=I[A+1],B=A===0?new we(0,0):D.sub(L)._unit()._perp(),O=A===I.length-1?new we(0,0):k.sub(D)._unit()._perp(),U=B._add(O)._unit(),H=U.x*O.x+U.y*O.y;H!==0&&U._mult(1/H),M.push(U._mult(_)._add(D))}T.push(M)}return T})(a,m*u)),(function(x,_,T){for(let v=0;v<_.length;v++){const I=_[v];if(x.length>=3){for(let M=0;M<I.length;M++)if(Ya(x,I[M]))return!0}if($f(x,I,T))return!0}return!1})(h,a,g)}isTileClipped(){return!0}}function hp(r,e){return e>0?e+2*r:r}const ng=Ct([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),sg=Ct([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ct([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const ag=Ct([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Ct([{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"}]);const dp=Ct([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),og=Ct([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function lg(r,e,i){return r.sections.forEach((s=>{s.text=(function(a,l,u){const h=l.layout.get("text-transform").evaluate(u,{});return h==="uppercase"?a=a.toLocaleUpperCase():h==="lowercase"&&(a=a.toLocaleLowerCase()),Br.applyArabicShaping&&(a=Br.applyArabicShaping(a)),a})(s.text,e,i)})),r}Ct([{name:"triangle",components:3,type:"Uint16"}]),Ct([{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"}]),Ct([{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"}]),Ct([{type:"Float32",name:"offsetX"}]),Ct([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Ct([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var qt=24;const $l={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},cg={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},ug={40:!0};function pp(r,e,i,s,a,l){if("fontStack"in e){const u=i[e.fontStack],h=u&&u[r];return h?h.metrics.advance*e.scale+a:0}{const u=s[e.imageName];return u?u.displaySize[0]*e.scale*qt/l+a:0}}function fp(r,e,i,s){const a=Math.pow(r-e,2);return s?r<e?a/2:2*a:a+Math.abs(i)*i}function hg(r,e,i){let s=0;return r===10&&(s-=1e4),i&&(s+=150),r!==40&&r!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function mp(r,e,i,s,a,l){let u=null,h=fp(e,i,a,l);for(const g of s){const m=fp(e-g.x,i,a,l)+g.badness;m<=h&&(u=g,h=m)}return{index:r,x:e,priorBreak:u,badness:h}}function gp(r){return r?gp(r.priorBreak).concat(r.index):[]}class no{constructor(e="",i=[],s=[]){this.text=e,this.sections=i,this.sectionIndex=s,this.imageSectionID=null}static fromFeature(e,i){const s=new no;for(let a=0;a<e.sections.length;a++){const l=e.sections[a];l.image?s.addImageSection(l):s.addTextSection(l,i)}return s}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 i="",s={premature:!0,value:void 0};const a=e[Symbol.iterator]();let l=a.next();const u=e[Symbol.iterator]();u.next();let h=u.next();for(;!l.done;)i+=!h.done&&xl(h.value.codePointAt(0))&&!$l[h.value]||!s.premature&&xl(s.value.codePointAt(0))&&!$l[s.value]||!$l[l.value]?l.value:$l[l.value],s={value:l.value,premature:!1},l=a.next(),h=u.next();return i})(this.text)}hasZeroWidthSpaces(){return this.text.includes("​")}trim(){const e=this.text.match(/^\s*/),i=e?e[0].length:0,s=this.text.match(/\S\s*$/),a=s?s[0].length-1:0;this.text=this.text.substring(i,this.text.length-a),this.sectionIndex=this.sectionIndex.slice(i,this.sectionIndex.length-a)}substring(e,i){const s=[...this.text].slice(e,i).join(""),a=this.sectionIndex.slice(e,i);return new no(s,this.sections,a)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,i)=>Math.max(e,this.sections[i].scale)),0)}getMaxImageSize(e){let i=0,s=0;for(let a=0;a<this.length();a++){const l=this.getSection(a);if("imageName"in l){const u=e[l.imageName];if(!u)continue;const h=u.displaySize;i=Math.max(i,h[0]),s=Math.max(s,h[1])}}return{maxImageWidth:i,maxImageHeight:s}}addTextSection(e,i){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||i});const s=this.sections.length-1;this.sectionIndex.push(...[...e.text].map((()=>s)))}addImageSection(e){const i=e.image?e.image.name:"";if(i.length===0)return void Ut("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:i}),this.sectionIndex.push(this.sections.length-1)):Ut("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,i,s,a,l){const u=[],h=this.determineAverageLineWidth(e,i,s,a,l),g=this.hasZeroWidthSpaces();let m=0,x=0;const _=this.text[Symbol.iterator]();let T=_.next();const v=this.text[Symbol.iterator]();v.next();let I=v.next();const M=this.text[Symbol.iterator]();M.next(),M.next();let A=M.next();for(;!T.done;){const D=this.getSection(x),L=T.value.codePointAt(0);if(jc(L)||(m+=pp(L,D,s,a,e,l)),!I.done){const k=Ju(L),B=I.value.codePointAt(0);(cg[L]||k||"imageName"in D||!A.done&&ug[B])&&u.push(mp(x+1,m,h,u,hg(L,B,k&&g),!1))}x++,T=_.next(),I=v.next(),A=M.next()}return gp(mp(this.length(),m,h,u,0,!0))}determineAverageLineWidth(e,i,s,a,l){let u=0,h=0;for(const g of this.text){const m=this.getSection(h);u+=pp(g.codePointAt(0),m,s,a,e,l),h++}return u/Math.max(1,Math.ceil(u/i))}}const Rh=4294967296,_p=1/Rh,yp=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class pu{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,i,s=this.length){for(;this.pos<s;){const a=this.readVarint(),l=a>>3,u=this.pos;this.type=7&a,e(l,i,this),this.pos===u&&this.skip(a)}return i}readMessage(e,i){return this.readFields(e,i,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Rh;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Rh;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const i=this.buf;let s,a;return a=i[this.pos++],s=127&a,a<128?s:(a=i[this.pos++],s|=(127&a)<<7,a<128?s:(a=i[this.pos++],s|=(127&a)<<14,a<128?s:(a=i[this.pos++],s|=(127&a)<<21,a<128?s:(a=i[this.pos],s|=(15&a)<<28,(function(l,u,h){const g=h.buf;let m,x;if(x=g[h.pos++],m=(112&x)>>4,x<128||(x=g[h.pos++],m|=(127&x)<<3,x<128)||(x=g[h.pos++],m|=(127&x)<<10,x<128)||(x=g[h.pos++],m|=(127&x)<<17,x<128)||(x=g[h.pos++],m|=(127&x)<<24,x<128)||(x=g[h.pos++],m|=(1&x)<<31,x<128))return so(l,m,u);throw new Error("Expected varint not more than 10 bytes")})(s,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,i=this.pos;return this.pos=e,e-i>=12&&yp?yp.decode(this.buf.subarray(i,e)):(function(s,a,l){let u="",h=a;for(;h<l;){const g=s[h];let m,x,_,T=null,v=g>239?4:g>223?3:g>191?2:1;if(h+v>l)break;v===1?g<128&&(T=g):v===2?(m=s[h+1],(192&m)==128&&(T=(31&g)<<6|63&m,T<=127&&(T=null))):v===3?(m=s[h+1],x=s[h+2],(192&m)==128&&(192&x)==128&&(T=(15&g)<<12|(63&m)<<6|63&x,(T<=2047||T>=55296&&T<=57343)&&(T=null))):v===4&&(m=s[h+1],x=s[h+2],_=s[h+3],(192&m)==128&&(192&x)==128&&(192&_)==128&&(T=(15&g)<<18|(63&m)<<12|(63&x)<<6|63&_,(T<=65535||T>=1114112)&&(T=null))),T===null?(T=65533,v=1):T>65535&&(T-=65536,u+=String.fromCharCode(T>>>10&1023|55296),T=56320|1023&T),u+=String.fromCharCode(T),h+=v}return u})(this.buf,i,e)}readBytes(){const e=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,e);return this.pos=e,i}readPackedVarint(e=[],i){const s=this.readPackedEnd();for(;this.pos<s;)e.push(this.readVarint(i));return e}readPackedSVarint(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(e){const i=7&e;if(i===0)for(;this.buf[this.pos++]>127;);else if(i===2)this.pos=this.readVarint()+this.pos;else if(i===5)this.pos+=4;else{if(i!==1)throw new Error(`Unimplemented type: ${i}`);this.pos+=8}}writeTag(e,i){this.writeVarint(e<<3|i)}realloc(e){let i=this.length||16;for(;i<this.pos+e;)i*=2;if(i!==this.length){const s=new Uint8Array(i);s.set(this.buf),this.buf=s,this.dataView=new DataView(s.buffer),this.length=i}}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*_p),!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*_p),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?(function(i,s){let a,l;if(i>=0?(a=i%4294967296|0,l=i/4294967296|0):(a=~(-i%4294967296),l=~(-i/4294967296),4294967295^a?a=a+1|0:(a=0,l=l+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");s.realloc(10),(function(u,h,g){g.buf[g.pos++]=127&u|128,u>>>=7,g.buf[g.pos++]=127&u|128,u>>>=7,g.buf[g.pos++]=127&u|128,u>>>=7,g.buf[g.pos++]=127&u|128,g.buf[g.pos]=127&(u>>>=7)})(a,0,s),(function(u,h){const g=(7&u)<<4;h.buf[h.pos++]|=g|((u>>>=3)?128:0),u&&(h.buf[h.pos++]=127&u|((u>>>=7)?128:0),u&&(h.buf[h.pos++]=127&u|((u>>>=7)?128:0),u&&(h.buf[h.pos++]=127&u|((u>>>=7)?128:0),u&&(h.buf[h.pos++]=127&u|((u>>>=7)?128:0),u&&(h.buf[h.pos++]=127&u)))))})(l,s)})(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++;const i=this.pos;this.pos=(function(a,l,u){for(let h,g,m=0;m<l.length;m++){if(h=l.charCodeAt(m),h>55295&&h<57344){if(!g){h>56319||m+1===l.length?(a[u++]=239,a[u++]=191,a[u++]=189):g=h;continue}if(h<56320){a[u++]=239,a[u++]=191,a[u++]=189,g=h;continue}h=g-55296<<10|h-56320|65536,g=null}else g&&(a[u++]=239,a[u++]=191,a[u++]=189,g=null);h<128?a[u++]=h:(h<2048?a[u++]=h>>6|192:(h<65536?a[u++]=h>>12|224:(a[u++]=h>>18|240,a[u++]=h>>12&63|128),a[u++]=h>>6&63|128),a[u++]=63&h|128)}return u})(this.buf,e,this.pos);const s=this.pos-i;s>=128&&xp(i,s,this),this.pos=i-1,this.writeVarint(s),this.pos+=s}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){const i=e.length;this.writeVarint(i),this.realloc(i);for(let s=0;s<i;s++)this.buf[this.pos++]=e[s]}writeRawMessage(e,i){this.pos++;const s=this.pos;e(i,this);const a=this.pos-s;a>=128&&xp(s,a,this),this.pos=s-1,this.writeVarint(a),this.pos+=a}writeMessage(e,i,s){this.writeTag(e,2),this.writeRawMessage(i,s)}writePackedVarint(e,i){i.length&&this.writeMessage(e,dg,i)}writePackedSVarint(e,i){i.length&&this.writeMessage(e,pg,i)}writePackedBoolean(e,i){i.length&&this.writeMessage(e,gg,i)}writePackedFloat(e,i){i.length&&this.writeMessage(e,fg,i)}writePackedDouble(e,i){i.length&&this.writeMessage(e,mg,i)}writePackedFixed32(e,i){i.length&&this.writeMessage(e,_g,i)}writePackedSFixed32(e,i){i.length&&this.writeMessage(e,yg,i)}writePackedFixed64(e,i){i.length&&this.writeMessage(e,xg,i)}writePackedSFixed64(e,i){i.length&&this.writeMessage(e,vg,i)}writeBytesField(e,i){this.writeTag(e,2),this.writeBytes(i)}writeFixed32Field(e,i){this.writeTag(e,5),this.writeFixed32(i)}writeSFixed32Field(e,i){this.writeTag(e,5),this.writeSFixed32(i)}writeFixed64Field(e,i){this.writeTag(e,1),this.writeFixed64(i)}writeSFixed64Field(e,i){this.writeTag(e,1),this.writeSFixed64(i)}writeVarintField(e,i){this.writeTag(e,0),this.writeVarint(i)}writeSVarintField(e,i){this.writeTag(e,0),this.writeSVarint(i)}writeStringField(e,i){this.writeTag(e,2),this.writeString(i)}writeFloatField(e,i){this.writeTag(e,5),this.writeFloat(i)}writeDoubleField(e,i){this.writeTag(e,1),this.writeDouble(i)}writeBooleanField(e,i){this.writeVarintField(e,+i)}}function so(r,e,i){return i?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function xp(r,e,i){const s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(s);for(let a=i.pos-1;a>=r;a--)i.buf[a+s]=i.buf[a]}function dg(r,e){for(let i=0;i<r.length;i++)e.writeVarint(r[i])}function pg(r,e){for(let i=0;i<r.length;i++)e.writeSVarint(r[i])}function fg(r,e){for(let i=0;i<r.length;i++)e.writeFloat(r[i])}function mg(r,e){for(let i=0;i<r.length;i++)e.writeDouble(r[i])}function gg(r,e){for(let i=0;i<r.length;i++)e.writeBoolean(r[i])}function _g(r,e){for(let i=0;i<r.length;i++)e.writeFixed32(r[i])}function yg(r,e){for(let i=0;i<r.length;i++)e.writeSFixed32(r[i])}function xg(r,e){for(let i=0;i<r.length;i++)e.writeFixed64(r[i])}function vg(r,e){for(let i=0;i<r.length;i++)e.writeSFixed64(r[i])}function bg(r,e,i){r===1&&i.readMessage(wg,e)}function wg(r,e,i){if(r===3){const{id:s,bitmap:a,width:l,height:u,left:h,top:g,advance:m}=i.readMessage(Tg,{});e.push({id:s,bitmap:new kl({width:l+6,height:u+6},a),metrics:{width:l,height:u,left:h,top:g,advance:m}})}}function Tg(r,e,i){r===1?e.id=i.readVarint():r===2?e.bitmap=i.readBytes():r===3?e.width=i.readVarint():r===4?e.height=i.readVarint():r===5?e.left=i.readSVarint():r===6?e.top=i.readSVarint():r===7&&(e.advance=i.readVarint())}function vp(r){let e=0,i=0;for(const u of r)e+=u.w*u.h,i=Math.max(i,u.w);r.sort(((u,h)=>h.h-u.h));const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let a=0,l=0;for(const u of r)for(let h=s.length-1;h>=0;h--){const g=s[h];if(!(u.w>g.w||u.h>g.h)){if(u.x=g.x,u.y=g.y,l=Math.max(l,u.y+u.h),a=Math.max(a,u.x+u.w),u.w===g.w&&u.h===g.h){const m=s.pop();m&&h<s.length&&(s[h]=m)}else u.h===g.h?(g.x+=u.w,g.w-=u.w):u.w===g.w?(g.y+=u.h,g.h-=u.h):(s.push({x:g.x+u.w,y:g.y,w:g.w-u.w,h:u.h}),g.y+=u.h,g.h-=u.h);break}}return{w:a,h:l,fill:e/(a*l)||0}}class Fh{constructor(e,{pixelRatio:i,version:s,stretchX:a,stretchY:l,content:u,textFitWidth:h,textFitHeight:g}){this.paddedRect=e,this.pixelRatio=i,this.stretchX=a,this.stretchY=l,this.content=u,this.version=s,this.textFitWidth=h,this.textFitHeight=g}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 bp{constructor(e,i){const s={},a={};this.haveRenderCallbacks=[];const l=[];this.addImages(e,s,l),this.addImages(i,a,l);const{w:u,h}=vp(l),g=new Di({width:u||1,height:h||1});for(const m in e){const x=e[m],_=s[m].paddedRect;Di.copy(x.data,g,{x:0,y:0},{x:_.x+1,y:_.y+1},x.data)}for(const m in i){const x=i[m],_=a[m].paddedRect,T=_.x+1,v=_.y+1,I=x.data.width,M=x.data.height;Di.copy(x.data,g,{x:0,y:0},{x:T,y:v},x.data),Di.copy(x.data,g,{x:0,y:M-1},{x:T,y:v-1},{width:I,height:1}),Di.copy(x.data,g,{x:0,y:0},{x:T,y:v+M},{width:I,height:1}),Di.copy(x.data,g,{x:I-1,y:0},{x:T-1,y:v},{width:1,height:M}),Di.copy(x.data,g,{x:0,y:0},{x:T+I,y:v},{width:1,height:M})}this.image=g,this.iconPositions=s,this.patternPositions=a}addImages(e,i,s){for(const a in e){const l=e[a],u={x:0,y:0,w:l.data.width+2,h:l.data.height+2};s.push(u),i[a]=new Fh(u,l),l.hasRenderCallback&&this.haveRenderCallbacks.push(a)}}patchUpdatedImages(e,i){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const s in e.updatedImages)this.patchUpdatedImage(this.iconPositions[s],e.getImage(s),i),this.patchUpdatedImage(this.patternPositions[s],e.getImage(s),i)}patchUpdatedImage(e,i,s){if(!e||!i||e.version===i.version)return;e.version=i.version;const[a,l]=e.tl;s.update(i.data,void 0,{x:a,y:l})}}var Jn;function fu(r,e,i,s,a,l,u,h,g,m,x,_,T,v,I){const M=no.fromFeature(r,a);let A;_===R.aw.vertical&&M.verticalizePunctuation();let D=M.determineLineBreaks(m,l,e,s,v);const{processBidirectionalText:L,processStyledBidirectionalText:k}=Br;if(L&&M.sections.length===1){A=[],D=D.map((H=>M.toCodeUnitIndex(H)));const U=L(M.toString(),D);for(const H of U){const J=[...H].map((()=>0));A.push(new no(H,M.sections,J))}}else if(k){A=[],D=D.map((ee=>M.toCodeUnitIndex(ee)));let U=0;const H=[];for(const ee of M.text)H.push(...Array(ee.length).fill(M.sectionIndex[U])),U++;const J=k(M.text,H,D);for(const ee of J){const re=[];let ue="";for(const le of ee[0])re.push(ee[1][ue.length]),ue+=le;A.push(new no(ee[0],M.sections,re))}}else A=(function(U,H){const J=[];let ee=0;for(const re of H)J.push(U.substring(ee,re)),ee=re;return ee<U.length()&&J.push(U.substring(ee,U.length())),J})(M,D);const B=[],O={positionedLines:B,text:M.toString(),top:x[1],bottom:x[1],left:x[0],right:x[0],writingMode:_,iconsInText:!1,verticalizable:!1};return(function(U,H,J,ee,re,ue,le,ce,se,ye,Te,be){let me=0,Ae=0,He=0,Qe=0;const it=ce==="right"?1:ce==="left"?0:.5,ci=qt/be;let St=0;for(const yt of re){yt.trim();const ei=yt.getMaxScale(),mi={positionedGlyphs:[],lineOffset:0};U.positionedLines[St]=mi;const gi=mi.positionedGlyphs;let zi=0;if(!yt.length()){Ae+=ue,++St;continue}const ui=Sg(ee,yt,ci);let ki=0;for(const Ht of yt.text){const Tt=yt.getSection(ki),Lt=Ht.codePointAt(0),Pt=Pg(se,Te,Lt),Yt={glyph:Lt,imageName:null,x:me,y:Ae+-17,vertical:Pt,scale:1,fontStack:"",sectionIndex:yt.getSectionIndex(ki),metrics:null,rect:null};let bn;if("fontStack"in Tt){if(bn=Ig(Tt,Lt,Pt,ui,H,J),!bn)continue;Yt.fontStack=Tt.fontStack}else{if(U.iconsInText=!0,Tt.scale*=ci,bn=Mg(Tt,Pt,ei,ui,ee),!bn)continue;zi=Math.max(zi,bn.imageOffset),Yt.imageName=Tt.imageName}const{rect:vr,metrics:Yl,baselineOffset:ss}=bn;Yt.y+=ss,Yt.scale=Tt.scale,Yt.metrics=Yl,Yt.rect=vr,gi.push(Yt),Pt?(U.verticalizable=!0,me+=("imageName"in Tt?Yl.advance:qt)*Tt.scale+ye):me+=Yl.advance*Tt.scale+ye,ki++}gi.length!==0&&(He=Math.max(me-ye,He),Eg(gi,0,gi.length-1,it)),me=0,mi.lineOffset=Math.max(zi,(ei-1)*qt);const ar=ue*ei+zi;Ae+=ar,Qe=Math.max(ar,Qe),++St}const{horizontalAlign:jt,verticalAlign:Xt}=Lh(le);(function(yt,ei,mi,gi,zi,ui,ki,ar,Ht){const Tt=(ei-mi)*zi;let Lt=0;Lt=ui!==ki?-ar*gi- -17:-gi*Ht*ki+.5*ki;for(const Pt of yt)for(const Yt of Pt.positionedGlyphs)Yt.x+=Tt,Yt.y+=Lt})(U.positionedLines,it,jt,Xt,He,Qe,ue,Ae,re.length),U.top+=-Xt*Ae,U.bottom=U.top+Ae,U.left+=-jt*He,U.right=U.left+He})(O,e,i,s,A,u,h,g,_,m,T,I),!(function(U){for(const H of U)if(H.positionedGlyphs.length!==0)return!1;return!0})(B)&&O}function Lh(r){let e=.5,i=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function Sg(r,e,i){const s=e.getMaxScale()*qt,{maxImageWidth:a,maxImageHeight:l}=e.getMaxImageSize(r),u=Math.max(s,l*i);return{verticalLineContentWidth:Math.max(s,a*i),horizontalLineContentHeight:u}}function wp(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function Pg(r,e,i){return!(r===R.aw.horizontal||!e&&!Yn(i)||e&&(jc(i)||(s=i,/\p{sc=Arab}/u.test(String.fromCodePoint(s)))));var s}function Ig(r,e,i,s,a,l){const u=l[r.fontStack],h=(function(m,x,_,T){if(m&&m.rect)return m;const v=x[_.fontStack],I=v&&v[T];return I?{rect:null,metrics:I.metrics}:null})(u&&u[e],a,r,e);if(h===null)return null;let g;if(i)g=s.verticalLineContentWidth-r.scale*qt;else{const m=wp(r.verticalAlign);g=(s.horizontalLineContentHeight-r.scale*qt)*m}return{rect:h.rect,metrics:h.metrics,baselineOffset:g}}function Mg(r,e,i,s,a){const l=a[r.imageName];if(!l)return null;const u=l.paddedRect,h=l.displaySize,g={width:h[0],height:h[1],left:1,top:-3,advance:e?h[1]:h[0]};let m;if(e)m=s.verticalLineContentWidth-h[1]*r.scale;else{const x=wp(r.verticalAlign);m=(s.horizontalLineContentHeight-h[1]*r.scale)*x}return{rect:u,metrics:g,baselineOffset:m,imageOffset:(e?h[0]:h[1])*r.scale-qt*i}}function Eg(r,e,i,s){if(s===0)return;const a=r[i],l=(r[i].x+a.metrics.advance*a.scale)*s;for(let u=e;u<=i;u++)r[u].x-=l}function Cg(r,e,i){const{horizontalAlign:s,verticalAlign:a}=Lh(i),l=e[0]-r.displaySize[0]*s,u=e[1]-r.displaySize[1]*a;return{image:r,top:u,bottom:u+r.displaySize[1],left:l,right:l+r.displaySize[0]}}function Tp(r){var e,i;let s=r.left,a=r.top,l=r.right-s,u=r.bottom-a;const h=(e=r.image.textFitWidth)!==null&&e!==void 0?e:"stretchOrShrink",g=(i=r.image.textFitHeight)!==null&&i!==void 0?i:"stretchOrShrink",m=(r.image.content[2]-r.image.content[0])/(r.image.content[3]-r.image.content[1]);if(g==="proportional"){if(h==="stretchOnly"&&l/u<m||h==="proportional"){const x=Math.ceil(u*m);s*=x/l,l=x}}else if(h==="proportional"&&g==="stretchOnly"&&m!==0&&l/u>m){const x=Math.ceil(l/m);a*=x/u,u=x}return{x1:s,y1:a,x2:s+l,y2:a+u}}function Sp(r,e,i,s,a,l){const u=r.image;let h;if(u.content){const A=u.content,D=u.pixelRatio||1;h=[A[0]/D,A[1]/D,u.displaySize[0]-A[2]/D,u.displaySize[1]-A[3]/D]}const g=e.left*l,m=e.right*l;let x,_,T,v;i==="width"||i==="both"?(v=a[0]+g-s[3],_=a[0]+m+s[1]):(v=a[0]+(g+m-u.displaySize[0])/2,_=v+u.displaySize[0]);const I=e.top*l,M=e.bottom*l;return i==="height"||i==="both"?(x=a[1]+I-s[0],T=a[1]+M+s[2]):(x=a[1]+(I+M-u.displaySize[1])/2,T=x+u.displaySize[1]),{image:u,top:x,right:_,bottom:T,left:v,collisionPadding:h}}Se("ImagePosition",Fh),Se("ImageAtlas",bp),R.aw=void 0,(Jn=R.aw||(R.aw={}))[Jn.none=0]="none",Jn[Jn.horizontal=1]="horizontal",Jn[Jn.vertical=2]="vertical",Jn[Jn.horizontalOnly=3]="horizontalOnly";const xn=128,Qn=32640;function Pp(r,e){const{expression:i}=e;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new nt(r+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:a}=i;let l=0;for(;l<s.length&&s[l]<=r;)l++;l=Math.max(0,l-1);let u=l;for(;u<s.length&&s[u]<r+1;)u++;u=Math.min(s.length-1,u);const h=s[l],g=s[u];return i.kind==="composite"?{kind:"composite",minZoom:h,maxZoom:g,interpolationType:a}:{kind:"camera",minZoom:h,maxZoom:g,minSize:i.evaluate(new nt(h)),maxSize:i.evaluate(new nt(g)),interpolationType:a}}}function Bh(r,e,i){let s="never";const a=r.get(e);return a?s=a:r.get(i)&&(s="always"),s}const Ag=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function mu(r,e,i,s,a,l,u,h,g,m,x,_,T){const v=h?Math.min(Qn,Math.round(h[0])):0,I=h?Math.min(Qn,Math.round(h[1])):0;r.emplaceBack(e,i,Math.round(32*s),Math.round(32*a),l,u,(v<<1)+(g?1:0),I,16*m,16*x,256*_,256*T)}function Oh(r,e,i){r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i)}function Dg(r){for(const e of r.sections)if(Gc(e.text))return!0;return!1}class Vh{constructor(e){this.layoutVertexArray=new Q,this.indexArray=new pe,this.programConfigurations=e,this.segments=new Me,this.dynamicLayoutVertexArray=new ae,this.opacityVertexArray=new oe,this.hasVisibleVertices=!1,this.placedSymbolArray=new b}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,i,s,a){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ng.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,sg.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Ag,!0),this.opacityVertexBuffer.itemSize=1),(s||a)&&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())}}Se("SymbolBuffers",Vh);class jh{constructor(e,i,s){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new s,this.segments=new Me,this.collisionVertexArray=new ne}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,ag.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Se("CollisionBuffers",jh);class ao{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((u=>u.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Pp(this.zoom,i["text-size"]),this.iconSizeData=Pp(this.zoom,i["icon-size"]);const s=this.layers[0].layout,a=s.get("symbol-sort-key"),l=s.get("symbol-z-order");this.canOverlap=Bh(s,"text-overlap","text-allow-overlap")!=="never"||Bh(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=l!=="viewport-y"&&!a.isConstant(),this.sortFeaturesByY=(l==="viewport-y"||l==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map((u=>R.aw[u]))),this.stateDependentLayerIds=this.layers.filter((u=>u.isStateDependent())).map((u=>u.id)),this.sourceID=e.sourceID}createArrays(){this.text=new Vh(new _n(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new Vh(new _n(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new P,this.lineVertexArray=new E,this.symbolInstances=new S,this.textAnchorOffsets=new z}calculateGlyphDependencies(e,i,s,a,l){for(const u of e)if(i[u.codePointAt(0)]=!0,(s||a)&&l){const h=$l[u];h&&(i[h.codePointAt(0)]=!0)}}populate(e,i,s){const a=this.layers[0],l=a.layout,u=l.get("text-font"),h=l.get("text-field"),g=l.get("icon-image"),m=(h.value.kind!=="constant"||h.value.value instanceof Mt&&!h.value.value.isEmpty()||h.value.value.toString().length>0)&&(u.value.kind!=="constant"||u.value.value.length>0),x=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,_=l.get("symbol-sort-key");if(this.features=[],!m&&!x)return;const T=i.iconDependencies,v=i.glyphDependencies,I=i.availableImages,M=new nt(this.zoom);for(const{feature:A,id:D,index:L,sourceLayerIndex:k}of e){const B=a._featureFilter.needGeometry,O=Ur(A,B);if(!a._featureFilter.filter(M,O,s))continue;let U,H;if(B||(O.geometry=Nr(A)),m){const ee=a.getValueAndResolveTokens("text-field",O,s,I),re=Mt.factory(ee),ue=this.hasRTLText=this.hasRTLText||Dg(re);(!ue||Br.getRTLTextPluginStatus()==="unavailable"||ue&&Br.isParsed())&&(U=lg(re,a,O))}if(x){const ee=a.getValueAndResolveTokens("icon-image",O,s,I);H=ee instanceof ii?ee:ii.fromString(ee)}if(!U&&!H)continue;const J=this.sortFeaturesByKey?_.evaluate(O,{},s):void 0;if(this.features.push({id:D,text:U,icon:H,index:L,sourceLayerIndex:k,geometry:O.geometry,properties:A.properties,type:jl.types[A.type],sortKey:J}),H&&(T[H.name]=!0),U){const ee=u.evaluate(O,{},s).join(","),re=l.get("text-rotation-alignment")!=="viewport"&&l.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(R.aw.vertical)>=0;for(const ue of U.sections)if(ue.image)T[ue.image.name]=!0;else{const le=qs(U.toString()),ce=ue.fontStack||ee,se=v[ce]=v[ce]||{};this.calculateGlyphDependencies(ue.text,se,re,this.allowVerticalPlacement,le)}}}l.get("symbol-placement")==="line"&&(this.features=(function(A){const D={},L={},k=[];let B=0;function O(ee){k.push(A[ee]),B++}function U(ee,re,ue){const le=L[ee];return delete L[ee],L[re]=le,k[le].geometry[0].pop(),k[le].geometry[0]=k[le].geometry[0].concat(ue[0]),le}function H(ee,re,ue){const le=D[re];return delete D[re],D[ee]=le,k[le].geometry[0].shift(),k[le].geometry[0]=ue[0].concat(k[le].geometry[0]),le}function J(ee,re,ue){const le=ue?re[0][re[0].length-1]:re[0][0];return`${ee}:${le.x}:${le.y}`}for(let ee=0;ee<A.length;ee++){const re=A[ee],ue=re.geometry,le=re.text?re.text.toString():null;if(!le){O(ee);continue}const ce=J(le,ue),se=J(le,ue,!0);if(ce in L&&se in D&&L[ce]!==D[se]){const ye=H(ce,se,ue),Te=U(ce,se,k[ye].geometry);delete D[ce],delete L[se],L[J(le,k[Te].geometry,!0)]=Te,k[ye].geometry=null}else ce in L?U(ce,se,ue):se in D?H(ce,se,ue):(O(ee),D[ce]=B-1,L[se]=B-1)}return k.filter((ee=>ee.geometry))})(this.features)),this.sortFeaturesByKey&&this.features.sort(((A,D)=>A.sortKey-D.sortKey))}update(e,i,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,i,this.layers,{imagePositions:s}),this.icon.programConfigurations.updatePaintArrays(e,i,this.layers,{imagePositions:s}))}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,i){const s=this.lineVertexArray.length;if(e.segment!==void 0){let a=e.dist(i[e.segment+1]),l=e.dist(i[e.segment]);const u={};for(let h=e.segment+1;h<i.length;h++)u[h]={x:i[h].x,y:i[h].y,tileUnitDistanceFromAnchor:a},h<i.length-1&&(a+=i[h+1].dist(i[h]));for(let h=e.segment||0;h>=0;h--)u[h]={x:i[h].x,y:i[h].y,tileUnitDistanceFromAnchor:l},h>0&&(l+=i[h-1].dist(i[h]));for(let h=0;h<i.length;h++){const g=u[h];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,i,s,a,l,u,h,g,m,x,_,T){const v=e.indexArray,I=e.layoutVertexArray,M=e.segments.prepareSegment(4*i.length,I,v,this.canOverlap?u.sortKey:void 0),A=this.glyphOffsetArray.length,D=M.vertexLength,L=this.allowVerticalPlacement&&h===R.aw.vertical?Math.PI/2:0,k=u.text&&u.text.sections;for(let B=0;B<i.length;B++){const{tl:O,tr:U,bl:H,br:J,tex:ee,pixelOffsetTL:re,pixelOffsetBR:ue,minFontScaleX:le,minFontScaleY:ce,glyphOffset:se,isSDF:ye,sectionIndex:Te}=i[B],be=M.vertexLength,me=se[1];mu(I,g.x,g.y,O.x,me+O.y,ee.x,ee.y,s,ye,re.x,re.y,le,ce),mu(I,g.x,g.y,U.x,me+U.y,ee.x+ee.w,ee.y,s,ye,ue.x,re.y,le,ce),mu(I,g.x,g.y,H.x,me+H.y,ee.x,ee.y+ee.h,s,ye,re.x,ue.y,le,ce),mu(I,g.x,g.y,J.x,me+J.y,ee.x+ee.w,ee.y+ee.h,s,ye,ue.x,ue.y,le,ce),Oh(e.dynamicLayoutVertexArray,g,L),v.emplaceBack(be,be+2,be+1),v.emplaceBack(be+1,be+2,be+3),M.vertexLength+=4,M.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(se[0]),B!==i.length-1&&Te===i[B+1].sectionIndex||e.programConfigurations.populatePaintArrays(I.length,u,u.index,{imagePositions:{},canonical:T,formattedSection:k&&k[Te]})}e.placedSymbolArray.emplaceBack(g.x,g.y,A,this.glyphOffsetArray.length-A,D,m,x,g.segment,s?s[0]:0,s?s[1]:0,a[0],a[1],h,0,!1,0,_)}_addCollisionDebugVertex(e,i,s,a,l,u){return i.emplaceBack(0,0),e.emplaceBack(s.x,s.y,a,l,Math.round(u.x),Math.round(u.y))}addCollisionDebugVertices(e,i,s,a,l,u,h){const g=l.segments.prepareSegment(4,l.layoutVertexArray,l.indexArray),m=g.vertexLength,x=l.layoutVertexArray,_=l.collisionVertexArray,T=h.anchorX,v=h.anchorY;this._addCollisionDebugVertex(x,_,u,T,v,new we(e,i)),this._addCollisionDebugVertex(x,_,u,T,v,new we(s,i)),this._addCollisionDebugVertex(x,_,u,T,v,new we(s,a)),this._addCollisionDebugVertex(x,_,u,T,v,new we(e,a)),g.vertexLength+=4;const I=l.indexArray;I.emplaceBack(m,m+1),I.emplaceBack(m+1,m+2),I.emplaceBack(m+2,m+3),I.emplaceBack(m+3,m),g.primitiveLength+=4}addDebugCollisionBoxes(e,i,s,a){for(let l=e;l<i;l++){const u=this.collisionBoxArray.get(l);this.addCollisionDebugVertices(u.x1,u.y1,u.x2,u.y2,a?this.textCollisionBox:this.iconCollisionBox,u.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new jh(ie,dp.members,fe),this.iconCollisionBox=new jh(ie,dp.members,fe);for(let e=0;e<this.symbolInstances.length;e++){const i=this.symbolInstances.get(e);this.addDebugCollisionBoxes(i.textBoxStartIndex,i.textBoxEndIndex,i,!0),this.addDebugCollisionBoxes(i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i,!0),this.addDebugCollisionBoxes(i.iconBoxStartIndex,i.iconBoxEndIndex,i,!1),this.addDebugCollisionBoxes(i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex,i,!1)}}_deserializeCollisionBoxesForSymbol(e,i,s,a,l,u,h,g,m){const x={};for(let _=i;_<s;_++){const T=e.get(_);x.textBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},x.textFeatureIndex=T.featureIndex;break}for(let _=a;_<l;_++){const T=e.get(_);x.verticalTextBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},x.verticalTextFeatureIndex=T.featureIndex;break}for(let _=u;_<h;_++){const T=e.get(_);x.iconBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},x.iconFeatureIndex=T.featureIndex;break}for(let _=g;_<m;_++){const T=e.get(_);x.verticalIconBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},x.verticalIconFeatureIndex=T.featureIndex;break}return x}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.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,i){const s=e.placedSymbolArray.get(i),a=s.vertexStartIndex+4*s.numGlyphs;for(let l=s.vertexStartIndex;l<a;l+=4)e.indexArray.emplaceBack(l,l+2,l+1),e.indexArray.emplaceBack(l+1,l+2,l+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),s=Math.cos(e),a=[],l=[],u=[];for(let h=0;h<this.symbolInstances.length;++h){u.push(h);const g=this.symbolInstances.get(h);a.push(0|Math.round(i*g.anchorX+s*g.anchorY)),l.push(g.featureIndex)}return u.sort(((h,g)=>a[h]-a[g]||l[g]-l[h])),u}addToSortKeyRanges(e,i){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===i?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,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(const i of this.symbolInstanceIndexes){const s=this.symbolInstances.get(i);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach(((a,l,u)=>{a>=0&&u.indexOf(a)===l&&this.addIndicesForPlacedSymbol(this.text,a)})),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Ip,Mp;Se("SymbolBucket",ao,{omit:["layers","collisionBoxArray","features","compareText"]}),ao.MAX_GLYPHS=65535,ao.addDynamicAttributes=Oh;var Nh={get paint(){return Mp=Mp||new ni({"icon-opacity":new Ce(he.paint_symbol["icon-opacity"]),"icon-color":new Ce(he.paint_symbol["icon-color"]),"icon-halo-color":new Ce(he.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ce(he.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ce(he.paint_symbol["icon-halo-blur"]),"icon-translate":new Ie(he.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ie(he.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ce(he.paint_symbol["text-opacity"]),"text-color":new Ce(he.paint_symbol["text-color"],{runtimeType:Pi,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new Ce(he.paint_symbol["text-halo-color"]),"text-halo-width":new Ce(he.paint_symbol["text-halo-width"]),"text-halo-blur":new Ce(he.paint_symbol["text-halo-blur"]),"text-translate":new Ie(he.paint_symbol["text-translate"]),"text-translate-anchor":new Ie(he.paint_symbol["text-translate-anchor"])})},get layout(){return Ip=Ip||new ni({"symbol-placement":new Ie(he.layout_symbol["symbol-placement"]),"symbol-spacing":new Ie(he.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ie(he.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ce(he.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ie(he.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ie(he.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ie(he.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ie(he.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ie(he.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ie(he.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ce(he.layout_symbol["icon-size"]),"icon-text-fit":new Ie(he.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ie(he.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ce(he.layout_symbol["icon-image"]),"icon-rotate":new Ce(he.layout_symbol["icon-rotate"]),"icon-padding":new Ce(he.layout_symbol["icon-padding"]),"icon-keep-upright":new Ie(he.layout_symbol["icon-keep-upright"]),"icon-offset":new Ce(he.layout_symbol["icon-offset"]),"icon-anchor":new Ce(he.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ie(he.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ie(he.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ie(he.layout_symbol["text-rotation-alignment"]),"text-field":new Ce(he.layout_symbol["text-field"]),"text-font":new Ce(he.layout_symbol["text-font"]),"text-size":new Ce(he.layout_symbol["text-size"]),"text-max-width":new Ce(he.layout_symbol["text-max-width"]),"text-line-height":new Ie(he.layout_symbol["text-line-height"]),"text-letter-spacing":new Ce(he.layout_symbol["text-letter-spacing"]),"text-justify":new Ce(he.layout_symbol["text-justify"]),"text-radial-offset":new Ce(he.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ie(he.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Ce(he.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Ce(he.layout_symbol["text-anchor"]),"text-max-angle":new Ie(he.layout_symbol["text-max-angle"]),"text-writing-mode":new Ie(he.layout_symbol["text-writing-mode"]),"text-rotate":new Ce(he.layout_symbol["text-rotate"]),"text-padding":new Ie(he.layout_symbol["text-padding"]),"text-keep-upright":new Ie(he.layout_symbol["text-keep-upright"]),"text-transform":new Ce(he.layout_symbol["text-transform"]),"text-offset":new Ce(he.layout_symbol["text-offset"]),"text-allow-overlap":new Ie(he.layout_symbol["text-allow-overlap"]),"text-overlap":new Ie(he.layout_symbol["text-overlap"]),"text-ignore-placement":new Ie(he.layout_symbol["text-ignore-placement"]),"text-optional":new Ie(he.layout_symbol["text-optional"])})}};class Ep{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Ar,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.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}}Se("FormatSectionOverride",Ep,{omit:["defaultValue"]});class gu extends Ui{constructor(e,i){super(e,Nh,i)}recalculate(e,i){if(super.recalculate(e,i),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const s=this.layout.get("text-writing-mode");if(s){const a=[];for(const l of s)a.indexOf(l)<0&&a.push(l);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,i,s,a){const l=this.layout.get(e).evaluate(i,{},s,a),u=this._unevaluatedLayout._values[e];return u.isDataDriven()||Va(u.value)||!l?l:(function(h,g){return g.replace(/{([^{}]+)}/g,((m,x)=>h&&x in h?String(h[x]):""))})(i.properties,l)}createBucket(e){return new ao(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Nh.paint.overridableProperties){if(!gu.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),s=new Ep(i),a=new il(s,i.property.specification);let l=null;l=i.value.kind==="constant"||i.value.kind==="source"?new zs("source",a):new rl("composite",a,i.value.zoomStops),this.paint._values[e]=new Qi(i.property,l,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,s){return!(!this.layout||i.isDataDriven()||s.isDataDriven())&&gu.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const s=e.get("text-field"),a=Nh.paint.properties[i];let l=!1;const u=h=>{for(const g of h)if(a.overrides&&a.overrides.hasOverride(g))return void(l=!0)};if(s.value.kind==="constant"&&s.value.value instanceof Mt)u(s.value.value.sections);else if(s.value.kind==="source"||s.value.kind==="composite"){const h=m=>{l||(m instanceof nr&&wt(m.value)===Dn?u(m.value.sections):m instanceof on?u(m.sections):m.eachChild(h))},g=s.value;g._styleExpression&&h(g._styleExpression.expression)}return l}}let Cp;var zg={get paint(){return Cp=Cp||new ni({"background-color":new Ie(he.paint_background["background-color"]),"background-pattern":new qc(he.paint_background["background-pattern"]),"background-opacity":new Ie(he.paint_background["background-opacity"])})}};class kg extends Ui{constructor(e,i){super(e,zg,i)}}class Rg extends Ui{constructor(e,i){super(e,{},i),this.onAdd=s=>{this.implementation.onAdd&&this.implementation.onAdd(s,s.painter.context.gl)},this.onRemove=s=>{this.implementation.onRemove&&this.implementation.onRemove(s,s.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 new Error("Custom layers cannot be serialized")}}class Fg{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===void 0||e.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Lg={once:!0},Uh=63710088e-1;class es{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new es(Pn(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,s=this.lat*i,a=e.lat*i,l=Math.sin(s)*Math.sin(a)+Math.cos(s)*Math.cos(a)*Math.cos((e.lng-this.lng)*i);return Uh*Math.acos(Math.min(l,1))}static convert(e){if(e instanceof es)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new es(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new es(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new 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>]")}}const Ap=2*Math.PI*Uh;function Dp(r){return Ap*Math.cos(r*Math.PI/180)}function zp(r){return(180+r)/360}function kp(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function Rp(r,e){return r/Dp(e)}function Fp(r){return 360*r-180}function _u(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Lp(r,e){return r*Dp(_u(e))}class Zl{constructor(e,i,s=0){this.x=+e,this.y=+i,this.z=+s}static fromLngLat(e,i=0){const s=es.convert(e);return new Zl(zp(s.lng),kp(s.lat),Rp(i,s.lat))}toLngLat(){return new es(Fp(this.x),_u(this.y))}toAltitude(){return Lp(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Ap*(e=_u(this.y),1/Math.cos(e*Math.PI/180));var e}}function Bp(r,e,i){var s=2*Math.PI*6378137/256/Math.pow(2,i);return[r*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class Gh{constructor(e,i,s){if(!(function(a,l,u){return!(a<0||a>25||u<0||u>=Math.pow(2,a)||l<0||l>=Math.pow(2,a))})(e,i,s))throw new Error(`x=${i}, y=${s}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=i,this.y=s,this.key=oo(0,e,e,i,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i,s){const a=(u=this.y,h=this.z,g=Bp(256*(l=this.x),256*(u=Math.pow(2,h)-u-1),h),m=Bp(256*(l+1),256*(u+1),h),g[0]+","+g[1]+","+m[0]+","+m[1]);var l,u,h,g,m;const x=(function(_,T,v){let I,M="";for(let A=_;A>0;A--)I=1<<A-1,M+=(T&I?1:0)+(v&I?2:0);return M})(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(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,i>1?"@2x":"").replace(/{quadkey}/g,x).replace(/{bbox-epsg-3857}/g,a)}isChildOf(e){const i=this.z-e.z;return i>0&&e.x===this.x>>i&&e.y===this.y>>i}getTilePoint(e){const i=Math.pow(2,this.z);return new we((e.x*i-this.x)*Re,(e.y*i-this.y)*Re)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Op{constructor(e,i){this.wrap=e,this.canonical=i,this.key=oo(e,i.z,i.z,i.x,i.y)}}class $i{constructor(e,i,s,a,l){if(this.terrainRttPosMatrix32f=null,e<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=i,this.canonical=new Gh(s,+a,+l),this.key=oo(i,e,s,a,l)}clone(){return new $i(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 new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-e;return e>this.canonical.z?new $i(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new $i(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,i){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-e;return e>this.canonical.z?oo(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y):oo(this.wrap*+i,e,e,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;const i=this.canonical.z-e.canonical.z;return!(i<0)&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new $i(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,s=2*this.canonical.x,a=2*this.canonical.y;return[new $i(i,this.wrap,i,s,a),new $i(i,this.wrap,i,s+1,a),new $i(i,this.wrap,i,s,a+1),new $i(i,this.wrap,i,s+1,a+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 $i(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new $i(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Op(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Zl(e.x-this.wrap,e.y))}normalizeCoordinates(e,i,s=8192){if(e>=0&&e<s&&i>=0&&i<s)return{tileID:this,x:e,y:i};const a=Math.floor(e/s),l=Math.floor(i/s),u=e-a*s,h=i-l*s,g=this.canonical.z,m=1<<g,x=this.canonical.y+l;if(x<0||x>=m)return null;let _=this.canonical.x+a,T=this.wrap;return _<0?(T-=Math.ceil(-_/m),_=(_%m+m)%m):_>=m&&(T+=Math.floor(_/m),_%=m),{tileID:new $i(this.overscaledZ,T,g,_,x),x:u,y:h}}}function oo(r,e,i,s,a){(r*=2)<0&&(r=-1*r-1);const l=1<<i;return(l*l*r+l*a+s).toString(36)+i.toString(36)+e.toString(36)}Se("CanonicalTileID",Gh),Se("OverscaledTileID",$i,{omit:["terrainRttPosMatrix32f"]});class aa{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){const i=new aa;return i.extend(e(new we(this.minX,this.minY))),i.extend(e(new we(this.maxX,this.minY))),i.extend(e(new we(this.minX,this.maxY))),i.extend(e(new we(this.maxX,this.maxY))),i}static fromPoints(e){const i=new aa;for(const s of e)i.extend(s);return i}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 Vp{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const s=e[i];this._stringToNumber[s]=i,this._numberToString[i]=s}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class jp{constructor(e,i,s,a,l){this.type="Feature",this._vectorTileFeature=e,this._x=s,this._y=a,this._z=i,this.properties=e.properties,this.id=l}projectPoint(e,i,s,a){return[360*(e.x+i)/a-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+s)/a)*Math.PI))-90]}projectLine(e,i,s,a){return e.map((l=>this.projectPoint(l,i,s,a)))}get geometry(){if(this._geometry)return this._geometry;const e=this._vectorTileFeature,i=e.extent*Math.pow(2,this._z),s=e.extent*this._x,a=e.extent*this._y,l=e.loadGeometry();switch(e.type){case 1:{const u=[];for(const g of l)u.push(g[0]);const h=this.projectLine(u,s,a,i);this._geometry=u.length===1?{type:"Point",coordinates:h[0]}:{type:"MultiPoint",coordinates:h};break}case 2:{const u=l.map((h=>this.projectLine(h,s,a,i)));this._geometry=u.length===1?{type:"LineString",coordinates:u[0]}:{type:"MultiLineString",coordinates:u};break}case 3:{const u=Gd(l),h=[];for(const g of u)h.push(g.map((m=>this.projectLine(m,s,a,i))));this._geometry=h.length===1?{type:"Polygon",coordinates:h[0]}:{type:"MultiPolygon",coordinates:h};break}default:throw new Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const i in this)i!=="_geometry"&&i!=="_vectorTileFeature"&&i!=="_x"&&i!=="_y"&&i!=="_z"&&(e[i]=this[i]);return e}}class lo{constructor(e,i,s){this._name=e,this.dataBuffer=i,typeof s=="number"?this._size=s:(this.nullabilityBuffer=s,this._size=s.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 yu extends lo{}class $h extends yu{getValueFromBuffer(e){return this.dataBuffer[e]}}class Zh extends yu{getValueFromBuffer(e){return this.dataBuffer[e]}}class Np extends lo{constructor(e,i,s,a){super(e,i,a),this.delta=s}}class qh extends Np{constructor(e,i,s,a){super(e,Int32Array.of(i),s,a)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class Wh extends lo{constructor(e,i,s,a){super(e,a?Int32Array.of(i):Uint32Array.of(i),s)}getValueFromBuffer(e){return this.dataBuffer[0]}}class Bg{constructor(e,i,s,a,l=4096){this._name=e,this._geometryVector=i,this._idVector=s,this._propertyVectors=a,this._extent=l}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||(this.propertyVectorsMap=new Map(this._propertyVectors.map((i=>[i.name,i])))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const e=[],i=this.geometryVector.getGeometries();for(let s=0;s<this.numFeatures;s++){let a;if(this.idVector){const h=this.idVector.getValue(s);a=this.containsMaxSafeIntegerValues(this.idVector)&&h!==null?Number(h):h}const l={coordinates:i[s],type:this.geometryVector.geometryType(s)},u={};for(const h of this.propertyVectors){if(!h)continue;const g=h.name,m=h.getValue(s);m!==null&&(u[g]=m)}e.push({id:a,geometry:l,properties:u})}return e}containsMaxSafeIntegerValues(e){return e instanceof $h||e instanceof Wh||e instanceof qh||e instanceof Zh}}class Up{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var je,ts;(function(r){r.NONE="NONE",r.DELTA="DELTA",r.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",r.RLE="RLE",r.MORTON="MORTON",r.PDE="PDE"})(je||(je={})),(function(r){r.NONE="NONE",r.FAST_PFOR="FAST_PFOR",r.VARINT="VARINT",r.ALP="ALP"})(ts||(ts={}));const Xh=new Uint32Array(33);Xh[0]=0;for(let r=1;r<=32;r++)Xh[r]=r===32?4294967295:4294967295>>>32-r;const Hh=Xh,vn=256;function Yh(r,e){return r-r%e}function Og(r){const e=r>>>0;return((255&e)<<24|(65280&e)<<8|e>>>8&65280|e>>>24&255)>>>0}const Kh=(function(){if(!Number.isFinite(65536))return 65536;const r=Yh(Math.floor(65536),vn);return r===0?vn:r})(),Vg=3*Kh/vn+Kh|0;function Gp(){const r=new Uint8Array(Vg);return{dataToBePacked:new Array(33),dataPointers:new Int32Array(33),byteContainer:r,byteContainerI32:new Int32Array(r.buffer,r.byteOffset,r.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function jg(r,e,i,s,a){switch(a){case 1:(function(l,u,h,g){let m=g,x=u;for(let _=0;_<8;_++){const T=l[x++]>>>0;h[m++]=T>>>0&1,h[m++]=T>>>1&1,h[m++]=T>>>2&1,h[m++]=T>>>3&1,h[m++]=T>>>4&1,h[m++]=T>>>5&1,h[m++]=T>>>6&1,h[m++]=T>>>7&1,h[m++]=T>>>8&1,h[m++]=T>>>9&1,h[m++]=T>>>10&1,h[m++]=T>>>11&1,h[m++]=T>>>12&1,h[m++]=T>>>13&1,h[m++]=T>>>14&1,h[m++]=T>>>15&1,h[m++]=T>>>16&1,h[m++]=T>>>17&1,h[m++]=T>>>18&1,h[m++]=T>>>19&1,h[m++]=T>>>20&1,h[m++]=T>>>21&1,h[m++]=T>>>22&1,h[m++]=T>>>23&1,h[m++]=T>>>24&1,h[m++]=T>>>25&1,h[m++]=T>>>26&1,h[m++]=T>>>27&1,h[m++]=T>>>28&1,h[m++]=T>>>29&1,h[m++]=T>>>30&1,h[m++]=T>>>31&1}})(r,e,i,s);break;case 2:(function(l,u,h,g){let m=g,x=u;for(let _=0;_<8;_++){const T=l[x++]>>>0,v=l[x++]>>>0;h[m++]=T>>>0&3,h[m++]=T>>>2&3,h[m++]=T>>>4&3,h[m++]=T>>>6&3,h[m++]=T>>>8&3,h[m++]=T>>>10&3,h[m++]=T>>>12&3,h[m++]=T>>>14&3,h[m++]=T>>>16&3,h[m++]=T>>>18&3,h[m++]=T>>>20&3,h[m++]=T>>>22&3,h[m++]=T>>>24&3,h[m++]=T>>>26&3,h[m++]=T>>>28&3,h[m++]=T>>>30&3,h[m++]=v>>>0&3,h[m++]=v>>>2&3,h[m++]=v>>>4&3,h[m++]=v>>>6&3,h[m++]=v>>>8&3,h[m++]=v>>>10&3,h[m++]=v>>>12&3,h[m++]=v>>>14&3,h[m++]=v>>>16&3,h[m++]=v>>>18&3,h[m++]=v>>>20&3,h[m++]=v>>>22&3,h[m++]=v>>>24&3,h[m++]=v>>>26&3,h[m++]=v>>>28&3,h[m++]=v>>>30&3}})(r,e,i,s);break;case 3:(function(l,u,h,g){let m=g,x=u;for(let _=0;_<8;_++){const T=l[x++]>>>0,v=l[x++]>>>0,I=l[x++]>>>0;h[m++]=T>>>0&7,h[m++]=T>>>3&7,h[m++]=T>>>6&7,h[m++]=T>>>9&7,h[m++]=T>>>12&7,h[m++]=T>>>15&7,h[m++]=T>>>18&7,h[m++]=T>>>21&7,h[m++]=T>>>24&7,h[m++]=T>>>27&7,h[m++]=7&(T>>>30|(1&v)<<2),h[m++]=v>>>1&7,h[m++]=v>>>4&7,h[m++]=v>>>7&7,h[m++]=v>>>10&7,h[m++]=v>>>13&7,h[m++]=v>>>16&7,h[m++]=v>>>19&7,h[m++]=v>>>22&7,h[m++]=v>>>25&7,h[m++]=v>>>28&7,h[m++]=7&(v>>>31|(3&I)<<1),h[m++]=I>>>2&7,h[m++]=I>>>5&7,h[m++]=I>>>8&7,h[m++]=I>>>11&7,h[m++]=I>>>14&7,h[m++]=I>>>17&7,h[m++]=I>>>20&7,h[m++]=I>>>23&7,h[m++]=I>>>26&7,h[m++]=I>>>29&7}})(r,e,i,s);break;case 4:(function(l,u,h,g){let m=g,x=u;for(let _=0;_<8;_++){const T=l[x++]>>>0,v=l[x++]>>>0,I=l[x++]>>>0,M=l[x++]>>>0;h[m++]=T>>>0&15,h[m++]=T>>>4&15,h[m++]=T>>>8&15,h[m++]=T>>>12&15,h[m++]=T>>>16&15,h[m++]=T>>>20&15,h[m++]=T>>>24&15,h[m++]=T>>>28&15,h[m++]=v>>>0&15,h[m++]=v>>>4&15,h[m++]=v>>>8&15,h[m++]=v>>>12&15,h[m++]=v>>>16&15,h[m++]=v>>>20&15,h[m++]=v>>>24&15,h[m++]=v>>>28&15,h[m++]=I>>>0&15,h[m++]=I>>>4&15,h[m++]=I>>>8&15,h[m++]=I>>>12&15,h[m++]=I>>>16&15,h[m++]=I>>>20&15,h[m++]=I>>>24&15,h[m++]=I>>>28&15,h[m++]=M>>>0&15,h[m++]=M>>>4&15,h[m++]=M>>>8&15,h[m++]=M>>>12&15,h[m++]=M>>>16&15,h[m++]=M>>>20&15,h[m++]=M>>>24&15,h[m++]=M>>>28&15}})(r,e,i,s);break;case 5:(function(l,u,h,g){let m=g,x=u;for(let _=0;_<8;_++){const T=l[x++]>>>0,v=l[x++]>>>0,I=l[x++]>>>0,M=l[x++]>>>0,A=l[x++]>>>0;h[m++]=T>>>0&31,h[m++]=T>>>5&31,h[m++]=T>>>10&31,h[m++]=T>>>15&31,h[m++]=T>>>20&31,h[m++]=T>>>25&31,h[m++]=31&(T>>>30|(7&v)<<2),h[m++]=v>>>3&31,h[m++]=v>>>8&31,h[m++]=v>>>13&31,h[m++]=v>>>18&31,h[m++]=v>>>23&31,h[m++]=31&(v>>>28|(1&I)<<4),h[m++]=I>>>1&31,h[m++]=I>>>6&31,h[m++]=I>>>11&31,h[m++]=I>>>16&31,h[m++]=I>>>21&31,h[m++]=I>>>26&31,h[m++]=31&(I>>>31|(15&M)<<1),h[m++]=M>>>4&31,h[m++]=M>>>9&31,h[m++]=M>>>14&31,h[m++]=M>>>19&31,h[m++]=M>>>24&31,h[m++]=31&(M>>>29|(3&A)<<3),h[m++]=A>>>2&31,h[m++]=A>>>7&31,h[m++]=A>>>12&31,h[m++]=A>>>17&31,h[m++]=A>>>22&31,h[m++]=A>>>27&31}})(r,e,i,s);break;case 6:(function(l,u,h,g){let m=g,x=u;for(let _=0;_<8;_++){const T=l[x++]>>>0,v=l[x++]>>>0,I=l[x++]>>>0,M=l[x++]>>>0,A=l[x++]>>>0,D=l[x++]>>>0;h[m++]=T>>>0&63,h[m++]=T>>>6&63,h[m++]=T>>>12&63,h[m++]=T>>>18&63,h[m++]=T>>>24&63,h[m++]=63&(T>>>30|(15&v)<<2),h[m++]=v>>>4&63,h[m++]=v>>>10&63,h[m++]=v>>>16&63,h[m++]=v>>>22&63,h[m++]=63&(v>>>28|(3&I)<<4),h[m++]=I>>>2&63,h[m++]=I>>>8&63,h[m++]=I>>>14&63,h[m++]=I>>>20&63,h[m++]=I>>>26&63,h[m++]=M>>>0&63,h[m++]=M>>>6&63,h[m++]=M>>>12&63,h[m++]=M>>>18&63,h[m++]=M>>>24&63,h[m++]=63&(M>>>30|(15&A)<<2),h[m++]=A>>>4&63,h[m++]=A>>>10&63,h[m++]=A>>>16&63,h[m++]=A>>>22&63,h[m++]=63&(A>>>28|(3&D)<<4),h[m++]=D>>>2&63,h[m++]=D>>>8&63,h[m++]=D>>>14&63,h[m++]=D>>>20&63,h[m++]=D>>>26&63}})(r,e,i,s);break;case 7:(function(l,u,h,g){let m=g,x=u;for(let _=0;_<8;_++){const T=l[x++]>>>0,v=l[x++]>>>0,I=l[x++]>>>0,M=l[x++]>>>0,A=l[x++]>>>0,D=l[x++]>>>0,L=l[x++]>>>0;h[m++]=T>>>0&127,h[m++]=T>>>7&127,h[m++]=T>>>14&127,h[m++]=T>>>21&127,h[m++]=127&(T>>>28|(7&v)<<4),h[m++]=v>>>3&127,h[m++]=v>>>10&127,h[m++]=v>>>17&127,h[m++]=v>>>24&127,h[m++]=127&(v>>>31|(63&I)<<1),h[m++]=I>>>6&127,h[m++]=I>>>13&127,h[m++]=I>>>20&127,h[m++]=127&(I>>>27|(3&M)<<5),h[m++]=M>>>2&127,h[m++]=M>>>9&127,h[m++]=M>>>16&127,h[m++]=M>>>23&127,h[m++]=127&(M>>>30|(31&A)<<2),h[m++]=A>>>5&127,h[m++]=A>>>12&127,h[m++]=A>>>19&127,h[m++]=127&(A>>>26|(1&D)<<6),h[m++]=D>>>1&127,h[m++]=D>>>8&127,h[m++]=D>>>15&127,h[m++]=D>>>22&127,h[m++]=127&(D>>>29|(15&L)<<3),h[m++]=L>>>4&127,h[m++]=L>>>11&127,h[m++]=L>>>18&127,h[m++]=L>>>25&127}})(r,e,i,s);break;case 8:(function(l,u,h,g){let m=g,x=u;for(let _=0;_<8;_++){const T=l[x++]>>>0,v=l[x++]>>>0,I=l[x++]>>>0,M=l[x++]>>>0,A=l[x++]>>>0,D=l[x++]>>>0,L=l[x++]>>>0,k=l[x++]>>>0;h[m++]=T>>>0&255,h[m++]=T>>>8&255,h[m++]=T>>>16&255,h[m++]=T>>>24&255,h[m++]=v>>>0&255,h[m++]=v>>>8&255,h[m++]=v>>>16&255,h[m++]=v>>>24&255,h[m++]=I>>>0&255,h[m++]=I>>>8&255,h[m++]=I>>>16&255,h[m++]=I>>>24&255,h[m++]=M>>>0&255,h[m++]=M>>>8&255,h[m++]=M>>>16&255,h[m++]=M>>>24&255,h[m++]=A>>>0&255,h[m++]=A>>>8&255,h[m++]=A>>>16&255,h[m++]=A>>>24&255,h[m++]=D>>>0&255,h[m++]=D>>>8&255,h[m++]=D>>>16&255,h[m++]=D>>>24&255,h[m++]=L>>>0&255,h[m++]=L>>>8&255,h[m++]=L>>>16&255,h[m++]=L>>>24&255,h[m++]=k>>>0&255,h[m++]=k>>>8&255,h[m++]=k>>>16&255,h[m++]=k>>>24&255}})(r,e,i,s);break;case 16:(function(l,u,h,g){let m=g,x=u;for(let _=0;_<128;_++){const T=l[x++]>>>0;h[m++]=65535&T,h[m++]=T>>>16&65535}})(r,e,i,s);break;default:(function(l,u,h,g,m){const x=Hh[m]>>>0;let _=u,T=0,v=l[_]>>>0,I=g;for(let M=0;M<8;M++){for(let A=0;A<32;A++)if(T+m<=32)h[I+A]=v>>>T&x,T+=m,T===32&&(T=0,_++,A!==31&&(v=l[_]>>>0));else{const D=32-T,L=v>>>T;_++,v=l[_]>>>0;const k=m-D;h[I+A]=(L|(v&-1>>>32-k>>>0)<<D)&x,T=k}I+=32,T=0,M<7&&(v=l[_]>>>0)}})(r,e,i,s,a)}return e+(a<<3)|0}function Ng(r,e,i,s){if(i+2>e)throw new Error(`FastPFOR decode: byteContainer underflow at block=${s} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${i}, byteSize=${e})`);const a=r[i++],l=r[i++];if(a>32)throw new Error(`FastPFOR decode: invalid bitWidth=${a} at block=${s} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:a,exceptionCount:l,bytePosIn:i}}function Ug(r,e,i,s,a,l,u,h,g){const{maxBits:m,exceptionBitWidth:x,bytePosIn:_}=(function(A,D,L,k,B,O){if(L+1>D)throw new Error(`FastPFOR decode: exception header underflow at block=${O} (need 1 byte for maxBits, bytePos=${L}, byteSize=${D})`);const U=A[L++];if(U<k||U>32)throw new Error(`FastPFOR decode: invalid maxBits=${U} at block=${O} (bitWidth=${k}, expected ${k}..32)`);const H=U-k|0;if(H<1||H>32)throw new Error(`FastPFOR decode: invalid exceptionBitWidth=${H} at block=${O} (bitWidth=${k}, maxBits=${U})`);if(L+B>D)throw new Error(`FastPFOR decode: exception positions underflow at block=${O} (need=${B}, have=${D-L})`);return{maxBits:U,exceptionBitWidth:H,bytePosIn:L}})(a,l,u,i,s,g);if(u=_,x===1){const A=1<<i;for(let D=0;D<s;D=D+1|0)r[a[u++]+e|0]|=A;return u}const T=h.dataToBePacked[x];if(!T)throw new Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${x} (bitWidth=${i}, maxBits=${m}) at block ${g}`);const v=h.dataPointers;let I=0|v[x];const M=0|h.exceptionSizes[x];if(I+s>M)throw new Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${x} (ptr=${I}, need ${s}, size=${M}) at block ${g}`);for(let A=0;A<s;A=A+1|0){const D=a[u++],L=0|T[I++];r[D+e|0]|=L<<i}return v[x]=I,u}function Gg(r,e,i,s,a,l){const u=0|i,h=0|r[u];if(h<=0||u+h>r.length-1)throw new Error(`FastPFOR decode: invalid whereMeta=${h} at pageStart=${u} (expected > 0 and pageStart+whereMeta < encoded.length=${r.length})`);const g=u+1|0,m=u+h|0,x=r[m]>>>0,_=x+3>>>2,T=m+1,v=T+_;if(v>=r.length)throw new Error(`FastPFOR decode: invalid byteSize=${x} (metaInts=${_}, pageStart=${u}, packedEnd=${m}, byteContainerStart=${T}) causes bitmapPos=${v} out of bounds (encoded.length=${r.length})`);const I=(function(D,L,k,B){B.byteContainer.length<k&&(B.byteContainer=new Uint8Array(2*k),B.byteContainerI32=void 0);const O=B.byteContainer,U=k>>>2;if(3&O.byteOffset)for(let J=0;J<U;J=J+1|0){const ee=0|D[L+J|0],re=J<<2;O[re]=255&ee,O[re+1|0]=ee>>>8&255,O[re+2|0]=ee>>>16&255,O[re+3|0]=ee>>>24&255}else{let J=B.byteContainerI32;(!J||J.buffer!==O.buffer||J.byteOffset!==O.byteOffset||J.length<U)&&(J=B.byteContainerI32=new Int32Array(O.buffer,O.byteOffset,O.byteLength>>>2)),J.set(D.subarray(L,L+U))}const H=3&k;if(H>0){const J=0|D[L+U|0],ee=U<<2;for(let re=0;re<H;re=re+1|0)O[ee+re|0]=J>>>(re<<3)&255}return O})(r,T,x,l),M=x,A=(function(D,L,k){const B=0|D[L++],O=k.dataToBePacked;for(let U=2;U<=32;U=U+1|0){if(!(B>>>U-1&1))continue;if(L>=D.length)throw new Error(`FastPFOR decode: truncated exception stream header (bitWidth=${U}, streamWordIndex=${L}, needWords=1, availableWords=${D.length-L}, encodedWords=${D.length})`);const H=D[L++]>>>0,J=Yh(H+31,32),ee=H*U+31>>>5;if(L+ee>D.length)throw new Error(`FastPFOR decode: truncated exception stream (bitWidth=${U}, size=${H}, streamWordIndex=${L}, needWords=${ee}, availableWords=${D.length-L}, encodedWords=${D.length})`);let re=O[U];(!re||re.length<J)&&(re=O[U]=new Uint32Array(J));let ue=0;for(;ue<H;ue=ue+32|0)$g(D,L,re,ue,U),L=L+U|0;L=L-((ue-H|0)*U>>>5)|0,k.exceptionSizes[U]=H}return L})(r,v,l);return l.dataPointers.fill(0),(function(D,L,k,B,O,U,H,J,ee,re){let ue=0|k,le=0;for(let ce=0;ce<H;ce=ce+1|0){const se=Ng(J,ee,le,ce);le=se.bytePosIn;const ye=se.bitWidth,Te=se.exceptionCount,be=U+ce*vn|0;switch(ye){case 0:O.fill(0,be,be+vn);break;case 32:for(let me=0;me<vn;me=me+1|0)O[be+me|0]=0|D[ue+me|0];ue=ue+vn|0;break;default:ue=jg(D,ue,O,be,ye)}Te>0&&(le=Ug(O,be,ye,Te,J,ee,le,re,ce))}if(ue!==B)throw new Error(`FastPFOR decode: packed region mismatch (pageStart=${L}, packedStart=${k}, consumedPackedEnd=${ue}, expectedPackedEnd=${B}, packedWords=${B-k}, encoded.length=${D.length})`)})(r,u,g,m,e,0|s,a/vn|0,I,M,l),A}function $g(r,e,i,s,a){switch(a){case 2:return void(function(m,x,_,T){let v=T;const I=m[x]>>>0,M=m[x+1]>>>0;_[v++]=I>>>0&3,_[v++]=I>>>2&3,_[v++]=I>>>4&3,_[v++]=I>>>6&3,_[v++]=I>>>8&3,_[v++]=I>>>10&3,_[v++]=I>>>12&3,_[v++]=I>>>14&3,_[v++]=I>>>16&3,_[v++]=I>>>18&3,_[v++]=I>>>20&3,_[v++]=I>>>22&3,_[v++]=I>>>24&3,_[v++]=I>>>26&3,_[v++]=I>>>28&3,_[v++]=I>>>30&3,_[v++]=M>>>0&3,_[v++]=M>>>2&3,_[v++]=M>>>4&3,_[v++]=M>>>6&3,_[v++]=M>>>8&3,_[v++]=M>>>10&3,_[v++]=M>>>12&3,_[v++]=M>>>14&3,_[v++]=M>>>16&3,_[v++]=M>>>18&3,_[v++]=M>>>20&3,_[v++]=M>>>22&3,_[v++]=M>>>24&3,_[v++]=M>>>26&3,_[v++]=M>>>28&3,_[v]=M>>>30&3})(r,e,i,s);case 3:return void(function(m,x,_,T){let v=T;const I=m[x]>>>0,M=m[x+1]>>>0,A=m[x+2]>>>0;_[v++]=I>>>0&7,_[v++]=I>>>3&7,_[v++]=I>>>6&7,_[v++]=I>>>9&7,_[v++]=I>>>12&7,_[v++]=I>>>15&7,_[v++]=I>>>18&7,_[v++]=I>>>21&7,_[v++]=I>>>24&7,_[v++]=I>>>27&7,_[v++]=7&(I>>>30|(1&M)<<2),_[v++]=M>>>1&7,_[v++]=M>>>4&7,_[v++]=M>>>7&7,_[v++]=M>>>10&7,_[v++]=M>>>13&7,_[v++]=M>>>16&7,_[v++]=M>>>19&7,_[v++]=M>>>22&7,_[v++]=M>>>25&7,_[v++]=M>>>28&7,_[v++]=7&(M>>>31|(3&A)<<1),_[v++]=A>>>2&7,_[v++]=A>>>5&7,_[v++]=A>>>8&7,_[v++]=A>>>11&7,_[v++]=A>>>14&7,_[v++]=A>>>17&7,_[v++]=A>>>20&7,_[v++]=A>>>23&7,_[v++]=A>>>26&7,_[v]=A>>>29&7})(r,e,i,s);case 4:return void(function(m,x,_,T){let v=T;const I=m[x]>>>0,M=m[x+1]>>>0,A=m[x+2]>>>0,D=m[x+3]>>>0;_[v++]=I>>>0&15,_[v++]=I>>>4&15,_[v++]=I>>>8&15,_[v++]=I>>>12&15,_[v++]=I>>>16&15,_[v++]=I>>>20&15,_[v++]=I>>>24&15,_[v++]=I>>>28&15,_[v++]=M>>>0&15,_[v++]=M>>>4&15,_[v++]=M>>>8&15,_[v++]=M>>>12&15,_[v++]=M>>>16&15,_[v++]=M>>>20&15,_[v++]=M>>>24&15,_[v++]=M>>>28&15,_[v++]=A>>>0&15,_[v++]=A>>>4&15,_[v++]=A>>>8&15,_[v++]=A>>>12&15,_[v++]=A>>>16&15,_[v++]=A>>>20&15,_[v++]=A>>>24&15,_[v++]=A>>>28&15,_[v++]=D>>>0&15,_[v++]=D>>>4&15,_[v++]=D>>>8&15,_[v++]=D>>>12&15,_[v++]=D>>>16&15,_[v++]=D>>>20&15,_[v++]=D>>>24&15,_[v]=D>>>28&15})(r,e,i,s);case 5:return void(function(m,x,_,T){let v=T;const I=m[x]>>>0,M=m[x+1]>>>0,A=m[x+2]>>>0,D=m[x+3]>>>0,L=m[x+4]>>>0;_[v++]=I>>>0&31,_[v++]=I>>>5&31,_[v++]=I>>>10&31,_[v++]=I>>>15&31,_[v++]=I>>>20&31,_[v++]=I>>>25&31,_[v++]=31&(I>>>30|(7&M)<<2),_[v++]=M>>>3&31,_[v++]=M>>>8&31,_[v++]=M>>>13&31,_[v++]=M>>>18&31,_[v++]=M>>>23&31,_[v++]=31&(M>>>28|(1&A)<<4),_[v++]=A>>>1&31,_[v++]=A>>>6&31,_[v++]=A>>>11&31,_[v++]=A>>>16&31,_[v++]=A>>>21&31,_[v++]=A>>>26&31,_[v++]=31&(A>>>31|(15&D)<<1),_[v++]=D>>>4&31,_[v++]=D>>>9&31,_[v++]=D>>>14&31,_[v++]=D>>>19&31,_[v++]=D>>>24&31,_[v++]=31&(D>>>29|(3&L)<<3),_[v++]=L>>>2&31,_[v++]=L>>>7&31,_[v++]=L>>>12&31,_[v++]=L>>>17&31,_[v++]=L>>>22&31,_[v]=L>>>27&31})(r,e,i,s);case 6:return void(function(m,x,_,T){let v=T;const I=m[x]>>>0,M=m[x+1]>>>0,A=m[x+2]>>>0,D=m[x+3]>>>0,L=m[x+4]>>>0,k=m[x+5]>>>0;_[v++]=I>>>0&63,_[v++]=I>>>6&63,_[v++]=I>>>12&63,_[v++]=I>>>18&63,_[v++]=I>>>24&63,_[v++]=63&(I>>>30|(15&M)<<2),_[v++]=M>>>4&63,_[v++]=M>>>10&63,_[v++]=M>>>16&63,_[v++]=M>>>22&63,_[v++]=63&(M>>>28|(3&A)<<4),_[v++]=A>>>2&63,_[v++]=A>>>8&63,_[v++]=A>>>14&63,_[v++]=A>>>20&63,_[v++]=A>>>26&63,_[v++]=D>>>0&63,_[v++]=D>>>6&63,_[v++]=D>>>12&63,_[v++]=D>>>18&63,_[v++]=D>>>24&63,_[v++]=63&(D>>>30|(15&L)<<2),_[v++]=L>>>4&63,_[v++]=L>>>10&63,_[v++]=L>>>16&63,_[v++]=L>>>22&63,_[v++]=63&(L>>>28|(3&k)<<4),_[v++]=k>>>2&63,_[v++]=k>>>8&63,_[v++]=k>>>14&63,_[v++]=k>>>20&63,_[v]=k>>>26&63})(r,e,i,s);case 7:return void(function(m,x,_,T){let v=T;const I=m[x]>>>0,M=m[x+1]>>>0,A=m[x+2]>>>0,D=m[x+3]>>>0,L=m[x+4]>>>0,k=m[x+5]>>>0,B=m[x+6]>>>0;_[v++]=I>>>0&127,_[v++]=I>>>7&127,_[v++]=I>>>14&127,_[v++]=I>>>21&127,_[v++]=127&(I>>>28|(7&M)<<4),_[v++]=M>>>3&127,_[v++]=M>>>10&127,_[v++]=M>>>17&127,_[v++]=M>>>24&127,_[v++]=127&(M>>>31|(63&A)<<1),_[v++]=A>>>6&127,_[v++]=A>>>13&127,_[v++]=A>>>20&127,_[v++]=127&(A>>>27|(3&D)<<5),_[v++]=D>>>2&127,_[v++]=D>>>9&127,_[v++]=D>>>16&127,_[v++]=D>>>23&127,_[v++]=127&(D>>>30|(31&L)<<2),_[v++]=L>>>5&127,_[v++]=L>>>12&127,_[v++]=L>>>19&127,_[v++]=127&(L>>>26|(1&k)<<6),_[v++]=k>>>1&127,_[v++]=k>>>8&127,_[v++]=k>>>15&127,_[v++]=k>>>22&127,_[v++]=127&(k>>>29|(15&B)<<3),_[v++]=B>>>4&127,_[v++]=B>>>11&127,_[v++]=B>>>18&127,_[v]=B>>>25&127})(r,e,i,s);case 8:return void(function(m,x,_,T){let v=T;const I=m[x]>>>0,M=m[x+1]>>>0,A=m[x+2]>>>0,D=m[x+3]>>>0,L=m[x+4]>>>0,k=m[x+5]>>>0,B=m[x+6]>>>0,O=m[x+7]>>>0;_[v++]=I>>>0&255,_[v++]=I>>>8&255,_[v++]=I>>>16&255,_[v++]=I>>>24&255,_[v++]=M>>>0&255,_[v++]=M>>>8&255,_[v++]=M>>>16&255,_[v++]=M>>>24&255,_[v++]=A>>>0&255,_[v++]=A>>>8&255,_[v++]=A>>>16&255,_[v++]=A>>>24&255,_[v++]=D>>>0&255,_[v++]=D>>>8&255,_[v++]=D>>>16&255,_[v++]=D>>>24&255,_[v++]=L>>>0&255,_[v++]=L>>>8&255,_[v++]=L>>>16&255,_[v++]=L>>>24&255,_[v++]=k>>>0&255,_[v++]=k>>>8&255,_[v++]=k>>>16&255,_[v++]=k>>>24&255,_[v++]=B>>>0&255,_[v++]=B>>>8&255,_[v++]=B>>>16&255,_[v++]=B>>>24&255,_[v++]=O>>>0&255,_[v++]=O>>>8&255,_[v++]=O>>>16&255,_[v]=O>>>24&255})(r,e,i,s);case 9:return void(function(m,x,_,T){let v=T;const I=m[x]>>>0,M=m[x+1]>>>0,A=m[x+2]>>>0,D=m[x+3]>>>0,L=m[x+4]>>>0,k=m[x+5]>>>0,B=m[x+6]>>>0,O=m[x+7]>>>0,U=m[x+8]>>>0;_[v++]=I>>>0&511,_[v++]=I>>>9&511,_[v++]=I>>>18&511,_[v++]=511&(I>>>27|(15&M)<<5),_[v++]=M>>>4&511,_[v++]=M>>>13&511,_[v++]=M>>>22&511,_[v++]=511&(M>>>31|(255&A)<<1),_[v++]=A>>>8&511,_[v++]=A>>>17&511,_[v++]=511&(A>>>26|(7&D)<<6),_[v++]=D>>>3&511,_[v++]=D>>>12&511,_[v++]=D>>>21&511,_[v++]=511&(D>>>30|(127&L)<<2),_[v++]=L>>>7&511,_[v++]=L>>>16&511,_[v++]=511&(L>>>25|(3&k)<<7),_[v++]=k>>>2&511,_[v++]=k>>>11&511,_[v++]=k>>>20&511,_[v++]=511&(k>>>29|(63&B)<<3),_[v++]=B>>>6&511,_[v++]=B>>>15&511,_[v++]=511&(B>>>24|(1&O)<<8),_[v++]=O>>>1&511,_[v++]=O>>>10&511,_[v++]=O>>>19&511,_[v++]=511&(O>>>28|(31&U)<<4),_[v++]=U>>>5&511,_[v++]=U>>>14&511,_[v]=U>>>23&511})(r,e,i,s);case 10:return void(function(m,x,_,T){let v=T;const I=m[x]>>>0,M=m[x+1]>>>0,A=m[x+2]>>>0,D=m[x+3]>>>0,L=m[x+4]>>>0,k=m[x+5]>>>0,B=m[x+6]>>>0,O=m[x+7]>>>0,U=m[x+8]>>>0,H=m[x+9]>>>0;_[v++]=I>>>0&1023,_[v++]=I>>>10&1023,_[v++]=I>>>20&1023,_[v++]=1023&(I>>>30|(255&M)<<2),_[v++]=M>>>8&1023,_[v++]=M>>>18&1023,_[v++]=1023&(M>>>28|(63&A)<<4),_[v++]=A>>>6&1023,_[v++]=A>>>16&1023,_[v++]=1023&(A>>>26|(15&D)<<6),_[v++]=D>>>4&1023,_[v++]=D>>>14&1023,_[v++]=1023&(D>>>24|(3&L)<<8),_[v++]=L>>>2&1023,_[v++]=L>>>12&1023,_[v++]=L>>>22&1023,_[v++]=k>>>0&1023,_[v++]=k>>>10&1023,_[v++]=k>>>20&1023,_[v++]=1023&(k>>>30|(255&B)<<2),_[v++]=B>>>8&1023,_[v++]=B>>>18&1023,_[v++]=1023&(B>>>28|(63&O)<<4),_[v++]=O>>>6&1023,_[v++]=O>>>16&1023,_[v++]=1023&(O>>>26|(15&U)<<6),_[v++]=U>>>4&1023,_[v++]=U>>>14&1023,_[v++]=1023&(U>>>24|(3&H)<<8),_[v++]=H>>>2&1023,_[v++]=H>>>12&1023,_[v]=H>>>22&1023})(r,e,i,s);case 11:return void(function(m,x,_,T){let v=T;const I=m[x]>>>0,M=m[x+1]>>>0,A=m[x+2]>>>0,D=m[x+3]>>>0,L=m[x+4]>>>0,k=m[x+5]>>>0,B=m[x+6]>>>0,O=m[x+7]>>>0,U=m[x+8]>>>0,H=m[x+9]>>>0,J=m[x+10]>>>0;_[v++]=I>>>0&2047,_[v++]=I>>>11&2047,_[v++]=2047&(I>>>22|(1&M)<<10),_[v++]=M>>>1&2047,_[v++]=M>>>12&2047,_[v++]=2047&(M>>>23|(3&A)<<9),_[v++]=A>>>2&2047,_[v++]=A>>>13&2047,_[v++]=2047&(A>>>24|(7&D)<<8),_[v++]=D>>>3&2047,_[v++]=D>>>14&2047,_[v++]=2047&(D>>>25|(15&L)<<7),_[v++]=L>>>4&2047,_[v++]=L>>>15&2047,_[v++]=2047&(L>>>26|(31&k)<<6),_[v++]=k>>>5&2047,_[v++]=k>>>16&2047,_[v++]=2047&(k>>>27|(63&B)<<5),_[v++]=B>>>6&2047,_[v++]=B>>>17&2047,_[v++]=2047&(B>>>28|(127&O)<<4),_[v++]=O>>>7&2047,_[v++]=O>>>18&2047,_[v++]=2047&(O>>>29|(255&U)<<3),_[v++]=U>>>8&2047,_[v++]=U>>>19&2047,_[v++]=2047&(U>>>30|(511&H)<<2),_[v++]=H>>>9&2047,_[v++]=H>>>20&2047,_[v++]=2047&(H>>>31|(1023&J)<<1),_[v++]=J>>>10&2047,_[v]=J>>>21&2047})(r,e,i,s);case 12:return void(function(m,x,_,T){let v=T;const I=m[x]>>>0,M=m[x+1]>>>0,A=m[x+2]>>>0,D=m[x+3]>>>0,L=m[x+4]>>>0,k=m[x+5]>>>0,B=m[x+6]>>>0,O=m[x+7]>>>0,U=m[x+8]>>>0,H=m[x+9]>>>0,J=m[x+10]>>>0,ee=m[x+11]>>>0;_[v++]=I>>>0&4095,_[v++]=I>>>12&4095,_[v++]=4095&(I>>>24|(15&M)<<8),_[v++]=M>>>4&4095,_[v++]=M>>>16&4095,_[v++]=4095&(M>>>28|(255&A)<<4),_[v++]=A>>>8&4095,_[v++]=A>>>20&4095,_[v++]=D>>>0&4095,_[v++]=D>>>12&4095,_[v++]=4095&(D>>>24|(15&L)<<8),_[v++]=L>>>4&4095,_[v++]=L>>>16&4095,_[v++]=4095&(L>>>28|(255&k)<<4),_[v++]=k>>>8&4095,_[v++]=k>>>20&4095,_[v++]=B>>>0&4095,_[v++]=B>>>12&4095,_[v++]=4095&(B>>>24|(15&O)<<8),_[v++]=O>>>4&4095,_[v++]=O>>>16&4095,_[v++]=4095&(O>>>28|(255&U)<<4),_[v++]=U>>>8&4095,_[v++]=U>>>20&4095,_[v++]=H>>>0&4095,_[v++]=H>>>12&4095,_[v++]=4095&(H>>>24|(15&J)<<8),_[v++]=J>>>4&4095,_[v++]=J>>>16&4095,_[v++]=4095&(J>>>28|(255&ee)<<4),_[v++]=ee>>>8&4095,_[v]=ee>>>20&4095})(r,e,i,s);case 16:return void(function(m,x,_,T){let v=T;const I=m[x]>>>0,M=m[x+1]>>>0,A=m[x+2]>>>0,D=m[x+3]>>>0,L=m[x+4]>>>0,k=m[x+5]>>>0,B=m[x+6]>>>0,O=m[x+7]>>>0,U=m[x+8]>>>0,H=m[x+9]>>>0,J=m[x+10]>>>0,ee=m[x+11]>>>0,re=m[x+12]>>>0,ue=m[x+13]>>>0,le=m[x+14]>>>0,ce=m[x+15]>>>0;_[v++]=I>>>0&65535,_[v++]=I>>>16&65535,_[v++]=M>>>0&65535,_[v++]=M>>>16&65535,_[v++]=A>>>0&65535,_[v++]=A>>>16&65535,_[v++]=D>>>0&65535,_[v++]=D>>>16&65535,_[v++]=L>>>0&65535,_[v++]=L>>>16&65535,_[v++]=k>>>0&65535,_[v++]=k>>>16&65535,_[v++]=B>>>0&65535,_[v++]=B>>>16&65535,_[v++]=O>>>0&65535,_[v++]=O>>>16&65535,_[v++]=U>>>0&65535,_[v++]=U>>>16&65535,_[v++]=H>>>0&65535,_[v++]=H>>>16&65535,_[v++]=J>>>0&65535,_[v++]=J>>>16&65535,_[v++]=ee>>>0&65535,_[v++]=ee>>>16&65535,_[v++]=re>>>0&65535,_[v++]=re>>>16&65535,_[v++]=ue>>>0&65535,_[v++]=ue>>>16&65535,_[v++]=le>>>0&65535,_[v++]=le>>>16&65535,_[v++]=ce>>>0&65535,_[v]=ce>>>16&65535})(r,e,i,s);case 32:for(let m=0;m<32;m=m+1|0)i[s+m|0]=0|r[e+m|0];return}const l=Hh[a]>>>0;let u=e,h=0,g=r[u]>>>0;for(let m=0;m<32;m++)if(h+a<=32)i[s+m]=g>>>h&l,h+=a,h===32&&(h=0,u++,m!==31&&(g=r[u]>>>0));else{const x=32-h,_=g>>>h;u++,g=r[u]>>>0,i[s+m]=(_|(g&Hh[a-x]>>>0)<<x)&l,h=a-x}}function fi(r,e,i){const s=new Uint32Array(i);let a=0,l=e.get();for(let u=0;u<s.length;u++){let h=r[l++],g=127&h;h<128||(h=r[l++],g|=(127&h)<<7,h<128||(h=r[l++],g|=(127&h)<<14,h<128||(h=r[l++],g|=(127&h)<<21,h<128||(h=r[l++],g|=(15&h)<<28)))),s[a++]=g}return e.set(l),s}function co(r,e,i){const s=new BigUint64Array(i);for(let a=0;a<s.length;a++)s[a]=Zg(r,e);return s}function Zg(r,e){let i=0n,s=0,a=e.get();for(;a<r.length;){const l=r[a++];if(i|=BigInt(127&l)<<BigInt(s),!(128&l))break;if(s+=7,s>=64)throw new Error("Varint too long")}return e.set(a),i}function qg(r,e){let i,s;return s=r[e.get()],e.increment(),i=127&s,s<128?i:(s=r[e.get()],e.increment(),i|=(127&s)<<7,s<128?i:(s=r[e.get()],e.increment(),i|=(127&s)<<14,s<128?i:(s=r[e.get()],e.increment(),i|=(127&s)<<21,s<128?i:(s=r[e.get()],i|=(15&s)<<28,(function(a,l,u){let h,g;if(g=l[u.get()],u.increment(),h=(112&g)>>4,g<128||(g=l[u.get()],u.increment(),h|=(127&g)<<3,g<128)||(g=l[u.get()],u.increment(),h|=(127&g)<<10,g<128)||(g=l[u.get()],u.increment(),h|=(127&g)<<17,g<128)||(g=l[u.get()],u.increment(),h|=(127&g)<<24,g<128)||(g=l[u.get()],u.increment(),h|=(1&g)<<31,g<128))return 4294967296*h+(a>>>0);throw new Error("Expected varint not more than 10 bytes")})(i,r,e)))))}function at(r){return r>>>1^-(1&r)}function vi(r){return r>>1n^-(1n&r)}function uo(r){return r%2==1?(r+1)/-2:r/2}function Jh(r,e,i){if(i===void 0){i=0;for(let l=0;l<e;l++)i+=r[l]}const s=new Uint32Array(i);let a=0;for(let l=0;l<e;l++){const u=r[l];s.fill(r[l+e],a,a+u),a+=u}return s}function Qh(r,e,i){if(i===void 0){i=0;for(let l=0;l<e;l++)i+=Number(r[l])}const s=new BigUint64Array(i);let a=0;for(let l=0;l<e;l++){const u=Number(r[l]);s.fill(r[l+e],a,a+u),a+=u}return s}function $p(r,e,i){const s=new Float64Array(i);let a=0;for(let l=0;l<e;l++){const u=r[l];s.fill(r[l+e],a,a+u),a+=u}return s}function Zp(r){const e=new Int32Array(r.length);e[0]=at(r[0]);const i=r.length/4*4;let s=1;if(i>=4)for(;s<i-4;s+=4){const a=r[s+1],l=r[s+2],u=r[s+3];e[s]=at(r[s])+e[s-1],e[s+1]=at(a)+e[s],e[s+2]=at(l)+e[s+1],e[s+3]=at(u)+e[s+2]}for(;s!==r.length;++s)e[s]=at(r[s])+e[s-1];return e}function qp(r){const e=new BigInt64Array(r.length);e[0]=vi(r[0]);const i=r.length/4*4;let s=1;if(i>=4)for(;s<i-4;s+=4){const a=r[s+1],l=r[s+2],u=r[s+3];e[s]=vi(r[s])+e[s-1],e[s+1]=vi(a)+e[s],e[s+2]=vi(l)+e[s+1],e[s+3]=vi(u)+e[s+2]}for(;s!==e.length;++s)e[s]=vi(r[s])+e[s-1];return e}function ed(r){const e=r.length/4*4;let i=1;if(e>=4)for(let s=r[0];i<e-4;i+=4)s=r[i]+=s,s=r[i+1]+=s,s=r[i+2]+=s,s=r[i+3]+=s;for(;i!==r.length;)r[i]+=r[i-1],++i}var oi,yr,oa,Zi,_t,Wt,Wp,is;function bi(r,e){const i=(function(s,a){const l=s[a.get()],u=Object.values(oi)[l>>4];let h=null;switch(u){case oi.DATA:h={dictionaryType:Object.values(yr)[15&l]};break;case oi.OFFSET:h={offsetType:Object.values(oa)[15&l]};break;case oi.LENGTH:h={lengthType:Object.values(Zi)[15&l]}}a.increment();const g=s[a.get()],m=Object.values(je)[g>>5],x=Object.values(je)[g>>2&7],_=Object.values(ts)[3&g];a.increment();const T=fi(s,a,2),v=T[0];return{physicalStreamType:u,logicalStreamType:h,logicalLevelTechnique1:m,logicalLevelTechnique2:x,physicalLevelTechnique:_,numValues:v,byteLength:T[1],decompressedCount:v}})(r,e);return i.logicalLevelTechnique1===je.MORTON?(function(s,a,l){const u=fi(a,l,2);return{physicalStreamType:s.physicalStreamType,logicalStreamType:s.logicalStreamType,logicalLevelTechnique1:s.logicalLevelTechnique1,logicalLevelTechnique2:s.logicalLevelTechnique2,physicalLevelTechnique:s.physicalLevelTechnique,numValues:s.numValues,byteLength:s.byteLength,decompressedCount:s.decompressedCount,numBits:u[0],coordinateShift:u[1]}})(i,r,e):je.RLE!==i.logicalLevelTechnique1&&je.RLE!==i.logicalLevelTechnique2||ts.NONE===i.physicalLevelTechnique?i:(function(s,a,l){const u=fi(a,l,2);return{physicalStreamType:s.physicalStreamType,logicalStreamType:s.logicalStreamType,logicalLevelTechnique1:s.logicalLevelTechnique1,logicalLevelTechnique2:s.logicalLevelTechnique2,physicalLevelTechnique:s.physicalLevelTechnique,numValues:s.numValues,byteLength:s.byteLength,decompressedCount:u[1],runs:u[0],numRleValues:u[1]}})(i,r,e)}(function(r){r.PRESENT="PRESENT",r.DATA="DATA",r.OFFSET="OFFSET",r.LENGTH="LENGTH"})(oi||(oi={})),(function(r){r.NONE="NONE",r.SINGLE="SINGLE",r.SHARED="SHARED",r.VERTEX="VERTEX",r.MORTON="MORTON",r.FSST="FSST"})(yr||(yr={})),(function(r){r.VERTEX="VERTEX",r.INDEX="INDEX",r.STRING="STRING",r.KEY="KEY"})(oa||(oa={})),(function(r){r.VAR_BINARY="VAR_BINARY",r.GEOMETRIES="GEOMETRIES",r.PARTS="PARTS",r.RINGS="RINGS",r.TRIANGLES="TRIANGLES",r.SYMBOL="SYMBOL",r.DICTIONARY="DICTIONARY"})(Zi||(Zi={})),(function(r){r[r.FLAT=0]="FLAT",r[r.CONST=1]="CONST",r[r.SEQUENCE=2]="SEQUENCE",r[r.DICTIONARY=3]="DICTIONARY",r[r.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(_t||(_t={}));class xr{constructor(e,i){this.values=e,this._size=i}get(e){const i=Math.floor(e/8);return(this.values[i]>>e%8&1)==1}set(e,i){const s=Math.floor(e/8);this.values[s]=this.values[s]|(i?1:0)<<e%8}getInt(e){const i=Math.floor(e/8);return this.values[i]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}function ho(r,e,i){if(!e)return r;const s=e.size(),a=new r.constructor(s);let l=0;for(let u=0;u<s;u++)a[u]=e.get(u)?r[l++]:i;return a}function td(r,e,i,s,a){return(function(l,u,h,g){let m;switch(u.logicalLevelTechnique1){case je.DELTA:if(u.logicalLevelTechnique2===je.RLE){const x=u;if(!g)return(function(_,T,v){const I=new Int32Array(v);let M=0,A=0;for(let D=0;D<T;D++){const L=_[D],k=at(_[D+T]);for(let B=0;B<L;B++)A+=k,I[M++]=A}return I})(l,x.runs,x.numRleValues);m=Zp(l=Jh(l,x.runs,x.numRleValues))}else m=Zp(l);break;case je.RLE:m=(function(x,_,T){if(T===void 0){T=0;for(let M=0;M<_;M++)T+=x[M]}const v=new Int32Array(T);let I=0;for(let M=0;M<_;M++){const A=x[M];let D=x[M+_];D=at(D),v.fill(D,I,I+A),I+=A}return v})(l,u.runs,u.numRleValues);break;case je.MORTON:ed(l),m=new Int32Array(l);break;case je.COMPONENTWISE_DELTA:m=(function(x){if(x.length<2)return new Int32Array(x);const _=new Int32Array(x.length);_[0]=at(x[0]),_[1]=at(x[1]);const T=x.length/4*4;let v=2;if(T>=4)for(;v<T-4;v+=4){const I=x[v+1],M=x[v+2],A=x[v+3];_[v]=at(x[v])+_[v-2],_[v+1]=at(I)+_[v-1],_[v+2]=at(M)+_[v],_[v+3]=at(A)+_[v+1]}for(;v!==x.length;v+=2)_[v]=at(x[v])+_[v-2],_[v+1]=at(x[v+1])+_[v-1];return _})(l);break;case je.NONE:m=(function(x){const _=new Int32Array(x.length);for(let T=0;T<x.length;T++)_[T]=at(x[T]);return _})(l);break;default:throw new Error(`The specified Logical level technique is not supported: ${u.logicalLevelTechnique1}`)}return g?ho(m,g,0):m})(po(r,e,i),i,0,a)}function qi(r,e,i,s,a){return(function(l,u,h,g){let m;switch(u.logicalLevelTechnique1){case je.DELTA:m=(function(x){const _=new Uint32Array(x.length);_[0]=at(x[0])>>>0;for(let T=1;T<x.length;T++)_[T]=_[T-1]+at(x[T])>>>0;return _})(u.logicalLevelTechnique2===je.RLE?Jh(l,u.runs,u.numRleValues):l);break;case je.RLE:m=Jh(l,u.runs,u.numRleValues);break;case je.MORTON:ed(l),m=l;break;case je.COMPONENTWISE_DELTA:m=(function(x){if(x.length<2)return new Uint32Array(x);const _=new Uint32Array(x.length);_[0]=at(x[0])>>>0,_[1]=at(x[1])>>>0;for(let T=2;T<x.length;T+=2)_[T]=_[T-2]+at(x[T])>>>0,_[T+1]=_[T-1]+at(x[T+1])>>>0;return _})(l);break;case je.NONE:m=l;break;default:throw new Error(`The specified Logical level technique is not supported: ${u.logicalLevelTechnique1}`)}return g?ho(m,g,0):m})(po(r,e,i),i,0,a)}function rs(r,e,i){return(function(s,a){if(a.logicalLevelTechnique1===je.DELTA&&a.logicalLevelTechnique2===je.NONE)return(function(l){const u=new Int32Array(l.length+1);u[0]=0,u[1]=at(l[0]);let h=u[1];for(let g=2;g!==u.length;++g)h+=at(l[g-1]),u[g]=u[g-1]+h;return new Uint32Array(u)})(s);if(a.logicalLevelTechnique1===je.RLE&&a.logicalLevelTechnique2===je.NONE)return(function(l,u,h){const g=new Uint32Array(h+1);g[0]=0;let m=1,x=g[0];for(let _=0;_<u;_++){const T=l[_],v=l[_+u];for(let I=m;I<m+T;I++)g[I]=v+x,x=g[I];m+=T}return g})(s,a.runs,a.numRleValues);if(a.logicalLevelTechnique1===je.NONE&&a.logicalLevelTechnique2===je.NONE){(function(u){let h=0;for(let g=0;g<u.length;g++)u[g]+=h,h=u[g]})(s);const l=new Uint32Array(a.numValues+1);return l[0]=0,l.set(s,1),l}if(a.logicalLevelTechnique1===je.DELTA&&a.logicalLevelTechnique2===je.RLE){const l=(function(u,h,g){const m=new Int32Array(g+1);m[0]=0;let x=1,_=m[0];for(let T=0;T<h;T++){const v=u[T];let I=u[T+h];I=at(I);for(let M=x;M<x+v;M++)m[M]=I+_,_=m[M];x+=v}return m})(s,a.runs,a.numRleValues);return ed(l),new Uint32Array(l)}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")})(po(r,e,i),i)}function po(r,e,i){const s=i.physicalLevelTechnique;switch(s){case ts.FAST_PFOR:return(function(a,l,u,h){return(function(g,m,x,_,T){const v=_.get();if(3&x)throw new Error(`FastPFOR: invalid encodedByteLength=${x} at offset=${v} (encodedBytes.length=${g.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);const I=x>>>2,M=(function(D,L){if(L<=D.encodedWords.length)return D.encodedWords;const k=new Uint32Array(Math.max(16,2*L));return D.encodedWords=k,k})(T,I);(function(D,L,k,B){if(L<0||k<0||L+k>D.length)throw new RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${L}, byteLength=${k}, bytes.length=${D.length})`);const O=Math.floor(k/4),U=k%4!=0,H=U?O+1:O;if(B.length<H)throw new RangeError(`decodeBigEndianInt32sInto: out.length=${B.length} < ${H}`);if(O>0){const J=D.byteOffset+L;if(3&J)for(let ee=0;ee<O;ee++){const re=L+4*ee;B[ee]=D[re]<<24|D[re+1]<<16|D[re+2]<<8|D[re+3]}else{const ee=new Uint32Array(D.buffer,J,O);for(let re=0;re<O;re++)B[re]=0|Og(ee[re])}}if(U){const J=L+4*O,ee=k-4*O;let re=0;for(let ue=0;ue<ee;ue++)re|=D[J+ue]<<24-8*ue;B[O]=0|re}})(g,v,x,M);const A=(function(D,L,k){let B=0,O=0;const U=new Uint32Array(L),H=k??Gp();if(D.length>0){const J=0|D[B];if(B=B+1|0,255&J)throw new Error(`FastPFOR decode: invalid alignedLength=${J} (expected multiple of 256)`);if(O+J>U.length)throw new Error(`FastPFOR decode: output buffer too small (outPos=${O}, alignedLength=${J}, out.length=${U.length})`);B=(function(ee,re,ue,le,ce,se){const ye=le+Yh(ce,vn);let Te=le,be=ue;for(;Te!==ye;){const me=Math.min(Kh,ye-Te);be=Gg(ee,re,be,Te,me,se),Te=Te+me|0}return be})(D,U,B,O,J,H),O=O+J|0}return(function(J,ee,re,ue,le,ce){if(ce===0)return ee;let se=0,ye=ee;const Te=ee+re,be=le;let me=le;const Ae=le+ce;let He=0,Qe=0;for(;ye<Te&&me<Ae;){const it=J[ye]>>>se&255;if(se+=8,ye+=se>>>5,se&=31,He|=(127&it)<<Qe,128&it)ue[me++]=0|He,He=0,Qe=0;else if(Qe+=7,Qe>28)throw new Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${Qe}, partial=${He}, decoded=${me-be}/${ce}, inPos=${ye}, inEnd=${Te})`)}if(me!==Ae)throw new Error(`FastPFOR VByte: truncated stream (decoded=${me-be}, expected=${ce}, consumedWords=${ye-ee}/${re}, vbyteStart=${ee}, vbyteEnd=${Te})`)})(D,B,D.length-B|0,U,O,L-O|0),U})(M.subarray(0,I),m,T.decoderWorkspace);return _.add(x),A})(a,l,u,h,(function(g=16){if(g<0)throw new RangeError(`initialEncodedWordCapacity must be >= 0, got ${g}`);const m=Math.max(16,0|g);return{encodedWords:new Uint32Array(m),decoderWorkspace:Gp()}})(u>>>2))})(r,i.numValues,i.byteLength,e);case ts.VARINT:return fi(r,e,i.numValues);case ts.NONE:{const a=e.get();e.add(i.byteLength);const l=r.subarray(a,e.get());return new Uint32Array(l)}default:throw new Error(`Specified physicalLevelTechnique ${s} is not supported (yet).`)}}function id(r,e,i){const s=po(r,e,i);return s.length===1?s[0]:(function(a){return a[1]})(s)}function Xp(r,e,i){return(function(s){if(s.length===2){const a=at(s[1]);return[a,a]}return[at(s[2]),at(s[3])]})(po(r,e,i))}function Hp(r,e,i){return(function(s){if(s.length===2){const a=vi(s[1]);return[a,a]}return[vi(s[2]),vi(s[3])]})(co(r,e,i.numValues))}function Yp(r,e,i,s){return(function(a,l,u){let h;switch(l.logicalLevelTechnique1){case je.DELTA:h=(function(g){const m=new BigUint64Array(g.length);m[0]=BigInt.asUintN(64,vi(g[0]));for(let x=1;x<g.length;x++)m[x]=BigInt.asUintN(64,m[x-1]+vi(g[x]));return m})(l.logicalLevelTechnique2===je.RLE?Qh(a,l.runs,l.numRleValues):a);break;case je.RLE:h=Qh(a,l.runs,l.numRleValues);break;case je.NONE:h=a;break;default:throw new Error(`The specified Logical level technique is not supported: ${l.logicalLevelTechnique1}`)}return u?ho(h,u,0n):h})(co(r,e,i.numValues),i,s)}function Kp(r,e,i){const s=co(r,e,i.numValues);return s.length===1?s[0]:(function(a){return a[1]})(s)}function xu(r,e,i,s,a="int32"){const l=r.logicalLevelTechnique1;if(l===je.RLE)return r.runs===1?_t.CONST:_t.FLAT;if(l!==je.DELTA||r.logicalLevelTechnique2!==je.RLE)return r.numValues===1?_t.CONST:_t.FLAT;const u=e instanceof xr?e.size():e;if(r.numRleValues!==u)return _t.FLAT;if(r.runs===1)return _t.SEQUENCE;if(r.runs!==2)return r.numValues===1?_t.CONST:_t.FLAT;const h=s.get();if(r.physicalLevelTechnique===ts.VARINT)return(function(x,_,T){const v=new Up(_.get());if(T==="int64"){const M=co(x,v,4);return M[2]===2n&&M[3]===2n}const I=fi(x,v,4);return I[2]===2&&I[3]===2})(i,s,a)?_t.SEQUENCE:r.numValues===1?_t.CONST:_t.FLAT;const g=s.get(),m=new Int32Array(i.buffer,i.byteOffset+g,4);return s.set(h),m[2]===2&&m[3]===2?_t.SEQUENCE:r.numValues===1?_t.CONST:_t.FLAT}class Jp extends yu{getValueFromBuffer(e){return this.dataBuffer[e]}}class Qp extends Np{constructor(e,i,s,a){super(e,BigInt64Array.of(i),s,a)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}function rd(r,e,i){return{x:ef(r,e)-i,y:ef(r>>1,e)-i}}function ef(r,e){let i=0;for(let s=0;s<e;s++)i|=(r&1<<2*s)>>s;return i}function fo(r,e,i,s,a,l,u){return r===is.MORTON?(function(h,g,m,x,_,T){const v=new Array(_?x+1:x);for(let I=0;I<x;I++){const M=rd(h[g[m+I]],T.numBits,T.coordinateShift);v[I]=new we(M.x,M.y)}return _&&(v[v.length-1]=v[0]),v})(e,i,s,a,l,u):(function(h,g,m,x,_){const T=new Array(_?x+1:x);for(let v=0;v<2*x;v+=2){const I=2*g[m+v/2];T[v/2]=new we(h[I],h[I+1])}return _&&(T[T.length-1]=T[0]),T})(e,i,s,a,l)}function mo(r,e,i,s){const a=new Array(s?i+1:i);for(let l=0;l<2*i;l+=2)a[l/2]=new we(r[e+l],r[e+l+1]);return s&&(a[a.length-1]=a[0]),a}(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON",r[r.MULTIPOINT=3]="MULTIPOINT",r[r.MULTILINESTRING=4]="MULTILINESTRING",r[r.MULTIPOLYGON=5]="MULTIPOLYGON"})(Wt||(Wt={})),(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON"})(Wp||(Wp={})),(function(r){r[r.MORTON=0]="MORTON",r[r.VEC_2=1]="VEC_2",r[r.VEC_3=2]="VEC_3"})(is||(is={}));class tf{constructor(e,i,s,a,l){this._vertexBufferType=e,this._topologyVector=i,this._vertexOffsets=s,this._vertexBuffer=a,this._mortonSettings=l}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){const i=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){const s=rd(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[s.x,s.y]}const i=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getGeometries(){return(function(e){const i=new Array(e.numGeometries);let s=1,a=1,l=1,u=0,h=0,g=0;const m=e.mortonSettings,x=e.topologyVector,_=x.geometryOffsets,T=x.partOffsets,v=x.ringOffsets,I=e.vertexOffsets,M=!I||I.length===0,A=e.containsPolygonGeometry(),D=e.vertexBuffer;for(let L=0;L<e.numGeometries;L++)switch(e.geometryType(L)){case Wt.POINT:{let k,B;if(M)k=D[h++],B=D[h++];else if(e.vertexBufferType===is.MORTON){const O=rd(D[I[g++]],m.numBits,m.coordinateShift);k=O.x,B=O.y}else{const O=2*I[g++];k=D[O],B=D[O+1]}i[u++]=[[new we(k,B)]],_&&l++,T&&s++,v&&a++}break;case Wt.MULTIPOINT:{const k=_[l]-_[l-1];l++;const B=new Array(k);if(M)for(let O=0;O<k;O++){const U=D[h++],H=D[h++];B[O]=new we(U,H)}else for(let O=0;O<k;O++){const U=2*I[g++];B[O]=new we(D[U],D[U+1])}i[u++]=B.map((O=>[O])),s+=k,a+=k}break;case Wt.LINESTRING:{let k,B;A?(k=v[a]-v[a-1],a++):k=T[s]-T[s-1],s++,M?(B=mo(D,h,k,!1),h+=2*k):(B=fo(e.vertexBufferType,D,I,g,k,!1,m),g+=k),i[u++]=[B],_&&l++}break;case Wt.POLYGON:{const k=T[s]-T[s-1];s++;const B=new Array(k-1);let O,U=v[a]-v[a-1];if(a++,M){O=mo(D,h,U,!0),h+=2*U;for(let H=0;H<B.length;H++)U=v[a]-v[a-1],a++,B[H]=mo(D,h,U,!0),h+=2*U}else{O=fo(e.vertexBufferType,D,I,g,U,!0,m),g+=U;for(let H=0;H<B.length;H++)U=v[a]-v[a-1],a++,B[H]=fo(e.vertexBufferType,D,I,g,U,!0,m),g+=U}i[u++]=[O].concat(B),_&&l++}break;case Wt.MULTILINESTRING:{const k=_[l]-_[l-1];l++;const B=new Array(k);for(let O=0;O<k;O++){let U;if(A?(U=v[a]-v[a-1],a++):U=T[s]-T[s-1],s++,M)B[O]=mo(D,h,U,!1),h+=2*U;else{const H=fo(e.vertexBufferType,D,I,g,U,!1,m);B[O]=H,g+=U}}i[u++]=B}break;case Wt.MULTIPOLYGON:{const k=_[l]-_[l-1];l++;const B=new Array(k);for(let O=0;O<k;O++){const U=T[s]-T[s-1];let H;s++;const J=new Array(U-1),ee=v[a]-v[a-1];a++,M?(H=mo(D,h,ee,!0),h+=2*ee):(H=fo(e.vertexBufferType,D,I,g,ee,!0,m),g+=ee);for(let re=0;re<J.length;re++){const ue=v[a]-v[a-1];a++,M?(J[re]=mo(D,h,ue,!0),h+=2*ue):(J[re]=fo(e.vertexBufferType,D,I,g,ue,!0,m),g+=ue)}B[O]=[H].concat(J)}i[u++]=B.flat()}break;default:throw new Error("The specified geometry type is currently not supported.")}return i})(this)}get mortonSettings(){return this._mortonSettings}}class rf extends tf{constructor(e,i,s,a,l,u,h){super(s,a,l,u,h),this._numGeometries=e,this._geometryType=i}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===Wt.POLYGON||this._geometryType===Wt.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class nf extends tf{constructor(e,i,s,a,l,u){super(e,s,a,l,u),this._geometryTypes=i}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)===Wt.POLYGON||this.geometryType(e)===Wt.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class sf{constructor(e,i,s,a){this._triangleOffsets=e,this._indexBuffer=i,this._vertexBuffer=s,this._topologyVector=a}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 new Error("Cannot convert GpuVector to coordinates without topology information");const e=new Array(this.numGeometries),i=this._topologyVector,s=i.partOffsets,a=i.ringOffsets,l=i.geometryOffsets;let u=0,h=1,g=1,m=1;for(let x=0;x<this.numGeometries;x++)switch(this.geometryType(x)){case Wt.POLYGON:{const _=s[h]-s[h-1];h++;const T=[];for(let v=0;v<_;v++){const I=a[g]-a[g-1];g++;const M=[];for(let A=0;A<I;A++){const D=this._vertexBuffer[u++],L=this._vertexBuffer[u++];M.push(new we(D,L))}M.length>0&&M.push(M[0]),T.push(M)}e[x]=T,l&&m++}break;case Wt.MULTIPOLYGON:{const _=l[m]-l[m-1];m++;const T=[];for(let v=0;v<_;v++){const I=s[h]-s[h-1];h++;for(let M=0;M<I;M++){const A=a[g]-a[g-1];g++;const D=[];for(let L=0;L<A;L++){const k=this._vertexBuffer[u++],B=this._vertexBuffer[u++];D.push(new we(k,B))}D.length>0&&D.push(D[0]),T.push(D)}}e[x]=T}}return e}[Symbol.iterator](){return null}}function af(r,e,i,s,a,l){return new Wg(r,e,i,s,a,l)}class Wg extends sf{constructor(e,i,s,a,l,u){super(s,a,l,u),this._numGeometries=e,this._geometryType=i}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function of(r,e,i,s,a){return new Xg(r,e,i,s,a)}class Xg extends sf{constructor(e,i,s,a,l){super(i,s,a,l),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function Hg(r,e,i,s,a){const l=bi(r,i);let u,h,g,m;if(xu(l,s,r,i)===_t.CONST){const L=id(r,i,l);let k,B,O,U;for(let H=0;H<e-1;H++){const J=bi(r,i);switch(J.physicalStreamType){case oi.LENGTH:switch(J.logicalStreamType.lengthType){case Zi.GEOMETRIES:k=rs(r,i,J);break;case Zi.PARTS:B=rs(r,i,J);break;case Zi.RINGS:O=rs(r,i,J);break;case Zi.TRIANGLES:U=rs(r,i,J)}break;case oi.OFFSET:switch(J.logicalStreamType.offsetType){case oa.VERTEX:u=qi(r,i,J);break;case oa.INDEX:m=qi(r,i,J)}break;case oi.DATA:yr.VERTEX===J.logicalStreamType.dictionaryType?h=td(r,i,J):(g={numBits:J.numBits,coordinateShift:J.coordinateShift},h=qi(r,i,J))}}return m?k!==void 0||B!==void 0?af(s,L,U,m,h,{geometryOffsets:k,partOffsets:B,ringOffsets:O}):af(s,L,U,m,h):g===void 0?(function(H,J,ee,re,ue){return new rf(H,J,is.VEC_2,ee,re,ue)})(s,L,{geometryOffsets:k,partOffsets:B,ringOffsets:O},u,h):(function(H,J,ee,re,ue,le){return new rf(H,J,is.MORTON,ee,re,ue,le)})(s,L,{geometryOffsets:k,partOffsets:B,ringOffsets:O},u,h,g)}const x=qi(r,i,l);let _,T,v,I,M,A,D;for(let L=0;L<e-1;L++){const k=bi(r,i);switch(k.physicalStreamType){case oi.LENGTH:switch(k.logicalStreamType.lengthType){case Zi.GEOMETRIES:_=qi(r,i,k);break;case Zi.PARTS:T=qi(r,i,k);break;case Zi.RINGS:v=qi(r,i,k);break;case Zi.TRIANGLES:I=rs(r,i,k)}break;case oi.OFFSET:switch(k.logicalStreamType.offsetType){case oa.VERTEX:u=qi(r,i,k);break;case oa.INDEX:m=qi(r,i,k)}break;case oi.DATA:yr.VERTEX===k.logicalStreamType.dictionaryType?h=td(r,i,k):(g={numBits:k.numBits,coordinateShift:k.coordinateShift},h=qi(r,i,k))}}return _?(M=nd(x,_,2),T&&v?(A=lf(x,M,T,!1),D=(function(L,k,B,O){const U=new Uint32Array(B[B.length-1]+1);let H=0;U[0]=H;let J=1,ee=1,re=0;for(let ue=0;ue<L.length;ue++){const le=L[ue],ce=k[ue+1]-k[ue];if(le!==0&&le!==3)for(let se=0;se<ce;se++){const ye=B[J]-B[J-1];J++;for(let Te=0;Te<ye;Te++)H=U[ee++]=H+O[re++]}else for(let se=0;se<ce;se++)U[ee++]=++H,J++}return U})(x,M,A,v)):T&&(A=(function(L,k,B){const O=new Uint32Array(k[k.length-1]+1);let U=0;O[0]=U;let H=1,J=0;for(let ee=0;ee<L.length;ee++){const re=L[ee],ue=k[ee+1]-k[ee];if(re===4||re===1)for(let le=0;le<ue;le++)U=O[H++]=U+B[J++];else for(let le=0;le<ue;le++)O[H++]=++U}return O})(x,M,T))):T&&v?(A=nd(x,T,1),D=lf(x,A,v,!0)):T&&(A=nd(x,T,0)),m&&!A?of(x,I,m,h):m?of(x,I,m,h,{geometryOffsets:M,partOffsets:A,ringOffsets:D}):g===void 0?(function(L,k,B,O){return new nf(is.VEC_2,L,k,B,O)})(x,{geometryOffsets:M,partOffsets:A,ringOffsets:D},u,h):(function(L,k,B,O,U){return new nf(is.MORTON,L,k,B,O,U)})(x,{geometryOffsets:M,partOffsets:A,ringOffsets:D},u,h,g)}function nd(r,e,i){const s=new Uint32Array(r.length+1);let a=0;s[0]=a;let l=0;for(let u=0;u<r.length;u++)a=s[u+1]=a+(r[u]>i?e[l++]:1);return s}function lf(r,e,i,s){const a=new Uint32Array(e[e.length-1]+1);let l=0;a[0]=l;let u=1,h=0;for(let g=0;g<r.length;g++){const m=r[g],x=e[g+1]-e[g];if(m===5||m===2||s&&(m===4||m===1))for(let _=0;_<x;_++)l=a[u++]=l+i[h++];else for(let _=0;_<x;_++)a[u++]=++l}return a}class Yg extends lo{constructor(e,i,s){super(e,i.getBuffer(),s),this.dataVector=i}getValueFromBuffer(e){return this.dataVector.get(e)}}class Kg extends yu{getValueFromBuffer(e){return this.dataBuffer[e]}}class cf extends lo{constructor(e,i,s,a){super(e,a?BigInt64Array.of(i):BigUint64Array.of(i),s)}getValueFromBuffer(e){return this.dataBuffer[0]}}function ql(r,e,i,s,a){const l=(function(u,h,g,m){const x=new Uint8Array(h);let _=0;const T=m.get()+g;for(;_<h&&!(m.get()>=T);){const v=u[m.increment()];if(v<=127){const I=v+3,M=u[m.increment()],A=Math.min(_+I,h);x.fill(M,_,A),_=A}else{const I=256-v;for(let M=0;M<I&&_<h;M++)x[_++]=u[m.increment()]}}return m.set(T),x})(r,Math.ceil(e/8),i,s);return a?(function(u,h,g){if(!g)return u;const m=g.size(),x=new xr(u,h),_=new xr(new Uint8Array(Math.ceil(m/8)),m);let T=0;for(let v=0;v<m;v++){const I=!!g.get(v)&&x.get(T++);_.set(v,I)}return _.getBuffer()})(l,e,a):l}const Jg=new TextDecoder;function sd(r,e,i){return i-e>=12?Jg.decode(r.subarray(e,i)):(function(s,a,l){let u="",h=a;for(;h<l;){const g=s[h];let m,x,_,T=null,v=g>239?4:g>223?3:g>191?2:1;if(h+v>l)break;v===1?g<128&&(T=g):v===2?(m=s[h+1],(192&m)==128&&(T=(31&g)<<6|63&m,T<=127&&(T=null))):v===3?(m=s[h+1],x=s[h+2],(192&m)==128&&(192&x)==128&&(T=(15&g)<<12|(63&m)<<6|63&x,(T<=2047||T>=55296&&T<=57343)&&(T=null))):v===4&&(m=s[h+1],x=s[h+2],_=s[h+3],(192&m)==128&&(192&x)==128&&(192&_)==128&&(T=(15&g)<<18|(63&m)<<12|(63&x)<<6|63&_,(T<=65535||T>=1114112)&&(T=null))),T===null?(T=65533,v=1):T>65535&&(T-=65536,u+=String.fromCharCode(T>>>10&1023|55296),T=56320|1023&T),u+=String.fromCharCode(T),h+=v}return u})(r,e,i)}class ad extends lo{constructor(e,i,s,a){super(e,s,a),this.offsetBuffer=i}}class uf extends ad{constructor(e,i,s,a){super(e,i,s,a??i.length-1)}getValueFromBuffer(e){return sd(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class go extends ad{constructor(e,i,s,a,l){super(e,s,a,l??i.length),this.indexBuffer=i,this.indexBuffer=i}getValueFromBuffer(e){const i=this.indexBuffer[e];return sd(this.dataBuffer,this.offsetBuffer[i],this.offsetBuffer[i+1])}}class hf extends ad{constructor(e,i,s,a,l,u,h){super(e,s,a,h),this.indexBuffer=i,this.symbolOffsetBuffer=l,this.symbolTableBuffer=u}getValueFromBuffer(e){this.decodedDictionary==null&&(this.symbolLengthBuffer==null&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),this.decodedDictionary=(function(s,a,l){const u=[],h=new Array(a.length).fill(0);for(let g=1;g<a.length;g++)h[g]=h[g-1]+a[g-1];for(let g=0;g<l.length;g++)if(l[g]===255)u.push(l[++g]);else{const m=a[l[g]],x=h[l[g]];for(let _=0;_<m;_++)u.push(s[x+_])}return new Uint8Array(u)})(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const i=this.indexBuffer[e];return sd(this.decodedDictionary,this.offsetBuffer[i],this.offsetBuffer[i+1])}offsetToLengthBuffer(e){const i=new Uint32Array(e.length-1);let s=e[0];for(let a=1;a<e.length;a++){const l=e[a];i[a-1]=l-s,s=l}return i}}function Qg(r,e,i,s,a,l){return i.type==="scalarType"?(function(u,h,g,m,x,_){let T=null;if(u===0)return null;if(_.nullable){const I=bi(h,g),M=I.numValues,A=g.get(),D=ql(h,M,I.byteLength,g);g.set(A+I.byteLength),T=new xr(D,I.numValues)}const v=T??m;switch(x.physicalType){case 4:case 3:return(function(I,M,A,D,L){const k=bi(I,M),B=xu(k,L,I,M),O=D.physicalType===3;if(B===_t.FLAT){const H=Wl(L)?L:void 0,J=O?td(I,M,k,0,H):qi(I,M,k,0,H);return new $h(A.name,J,L)}if(B===_t.SEQUENCE){const H=Xp(I,M,k);return new qh(A.name,H[0],H[1],k.numRleValues)}const U=O?(function(H,J,ee){const re=po(H,J,ee);return re.length===1?at(re[0]):(function(ue){return at(ue[1])})(re)})(I,M,k):id(I,M,k);return new Wh(A.name,U,L,O)})(h,g,_,x,v);case 9:return(function(I,M,A,D,L){let k=null,B=null,O=null,U=null,H=null,J=L??null,ee=null,re=null;for(let ue=0;ue<D;ue++){const le=bi(M,A);switch(le.physicalStreamType){case oi.PRESENT:{const ce=ql(M,le.numValues,le.byteLength,A),se=new xr(ce,le.numValues);J=L??se;break}case oi.OFFSET:B=qi(M,A,le,0,J);break;case oi.LENGTH:{const ce=rs(M,A,le);Zi.DICTIONARY===le.logicalStreamType.lengthType?k=ce:Zi.SYMBOL===le.logicalStreamType.lengthType?U=ce:ee=ce;break}case oi.DATA:{const ce=M.subarray(A.get(),A.get()+le.byteLength);A.add(le.byteLength);const se=le.logicalStreamType.dictionaryType;yr.FSST===se?H=ce:yr.SINGLE===se||yr.SHARED===se?O=ce:yr.NONE===se&&(re=ce);break}}}return(function(ue,le,ce,se,ye,Te,be){return le?new hf(ue,ce,se,ye,Te,le,be):null})(I,H,B,k,O,U,J)??(function(ue,le,ce,se,ye){return le?ye?new go(ue,ce,se,le,ye):new go(ue,ce,se,le):null})(I,O,B,k,J)??(function(ue,le,ce,se,ye){if(!le||!ce)return null;if(se)return ye?new go(ue,se,le,ce,ye):new go(ue,se,le,ce);if(ye&&ye.size()!==le.length-1){const Te=new Uint32Array(ye.size());let be=0;for(let me=0;me<ye.size();me++)Te[me]=ye.get(me)?be++:0;return new go(ue,Te,le,ce,ye)}return ye?new uf(ue,le,ce,ye):new uf(ue,le,ce)})(I,ee,re,B,J)})(_.name,h,g,_.nullable?u-1:u,T);case 0:return(function(I,M,A,D,L){const k=bi(I,M),B=k.numValues,O=M.get(),U=Wl(L)?L:void 0,H=ql(I,B,k.byteLength,M,U);M.set(O+k.byteLength);const J=new xr(H,B);return new Yg(A.name,J,L)})(h,g,_,0,v);case 6:case 5:return(function(I,M,A,D,L){const k=bi(I,M),B=xu(k,D,I,M,"int64"),O=L.physicalType===5;if(B===_t.FLAT){const H=Wl(D)?D:void 0,J=O?(function(ee,re,ue,le){return(function(ce,se,ye){let Te;switch(se.logicalLevelTechnique1){case je.DELTA:if(se.logicalLevelTechnique2===je.RLE){const be=se;if(!ye)return(function(me,Ae,He){const Qe=new BigInt64Array(He);let it=0,ci=0n;for(let St=0;St<Ae;St++){const jt=Number(me[St]),Xt=vi(me[St+Ae]);for(let yt=0;yt<jt;yt++)ci+=Xt,Qe[it++]=ci}return Qe})(ce,be.runs,be.numRleValues);Te=qp(ce=Qh(ce,be.runs,be.numRleValues))}else Te=qp(ce);break;case je.RLE:Te=(function(be,me,Ae){if(Ae===void 0){Ae=0;for(let it=0;it<me;it++)Ae+=Number(be[it])}const He=new BigInt64Array(Ae);let Qe=0;for(let it=0;it<me;it++){const ci=Number(be[it]);let St=be[it+me];St=vi(St),He.fill(St,Qe,Qe+ci),Qe+=ci}return He})(ce,se.runs,se.numRleValues);break;case je.NONE:Te=(function(be){const me=new BigInt64Array(be.length);for(let Ae=0;Ae<be.length;Ae++)me[Ae]=vi(be[Ae]);return me})(ce);break;default:throw new Error(`The specified Logical level technique is not supported: ${se.logicalLevelTechnique1}`)}return ye?ho(Te,ye,0n):Te})(co(ee,re,ue.numValues),ue,le)})(I,M,k,H):Yp(I,M,k,H);return new Jp(A.name,J,D)}if(B===_t.SEQUENCE){const H=Hp(I,M,k);return new Qp(A.name,H[0],H[1],k.numRleValues)}const U=O?(function(H,J,ee){const re=co(H,J,ee.numValues);return re.length===1?vi(re[0]):(function(ue){return vi(ue[1])})(re)})(I,M,k):Kp(I,M,k);return new cf(A.name,U,D,O)})(h,g,_,v,x);case 7:return(function(I,M,A,D){const L=bi(I,M),k=Wl(D)?D:void 0,B=(function(O,U,H,J){const ee=U.get(),re=ee+H*Float32Array.BYTES_PER_ELEMENT,ue=new Uint8Array(O.subarray(ee,re)).buffer,le=new Float32Array(ue);return U.set(re),J?ho(le,J,0):le})(I,M,L.numValues,k);return new Kg(A.name,B,D)})(h,g,_,v);case 8:return(function(I,M,A,D){const L=bi(I,M),k=Wl(D)?D:void 0,B=(function(O,U,H,J){const ee=U.get(),re=ee+H*Float64Array.BYTES_PER_ELEMENT,ue=new Uint8Array(O.subarray(ee,re)).buffer,le=new Float64Array(ue);return U.set(re),J?ho(le,J,0):le})(I,M,L.numValues,k);return new Zh(A.name,B,D)})(h,g,_,v);default:throw new Error(`The specified data type for the field is currently not supported: ${x}`)}})(s,r,e,a,i.scalarType,i):s===0?null:(function(u,h,g,m){let x=null,_=null,T=null,v=null,I=!1;for(;!I;){const L=bi(u,h);switch(L.physicalStreamType){case oi.LENGTH:Zi.DICTIONARY===L.logicalStreamType.lengthType?x=rs(u,h,L):T=rs(u,h,L);break;case oi.DATA:yr.SINGLE===L.logicalStreamType.dictionaryType||yr.SHARED===L.logicalStreamType.dictionaryType?(_=u.subarray(h.get(),h.get()+L.byteLength),I=!0):v=u.subarray(h.get(),h.get()+L.byteLength),h.add(L.byteLength)}}const M=g.complexType.children,A=[];let D=0;for(const L of M){const k=fi(u,h,1)[0];if(k===0)continue;const B=L.name?`${g.name}${L.name}`:g.name;if(k!==2||L.type!=="scalarField"||L.scalarField.physicalType!==9)throw new Error("Currently only optional string fields are implemented for a struct.");const O=bi(u,h),U=ql(u,O.numValues,O.byteLength,h),H=bi(u,h),J=qi(u,h,H,0,H.decompressedCount!==m?new xr(U,O.numValues):void 0);A[D++]=v?new hf(B,J,x,_,T,v,new xr(U,O.numValues)):new go(B,J,x,_,new xr(U,O.numValues))}return A})(r,e,i,a)}function Wl(r){return r instanceof xr}function df(r){switch(r){case 0:case 1:case 2:case 3:{const e={};e.nullable=!!(1&r),e.columnScope=0;const i={type:"logicalType",logicalType:0};return i.longID=!!(2&r),e.scalarType=i,e.type="scalarType",e}case 4:{const e={nullable:!1,columnScope:0},i={type:"physicalType",physicalType:0};return e.type="complexType",e.complexType=i,e}case 30:{const e={nullable:!1,columnScope:0},i={type:"physicalType",physicalType:1};return e.type="complexType",e.complexType=i,e}default:return(function(e){let i;switch(e){case 10:case 11:i=0;break;case 12:case 13:i=1;break;case 14:case 15:i=2;break;case 16:case 17:i=3;break;case 18:case 19:i=4;break;case 20:case 21:i=5;break;case 22:case 23:i=6;break;case 24:case 25:i=7;break;case 26:case 27:i=8;break;case 28:case 29:i=9;break;default:return null}const s={};s.nullable=!!(1&e),s.columnScope=0;const a={type:"physicalType"};return a.physicalType=i,s.type="scalarType",s.scalarType=a,s})(r)}}function pf(r){return r>=10}function ff(r){return r===30}function e_(r){if(r.type==="scalarType"){const e=r.scalarType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}if(e.type==="logicalType")return!1}else if(r.type==="complexType"){const e=r.complexType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",r),!1}function t_(r){return r.type==="complexType"&&r.complexType?.type==="physicalType"&&r.complexType.physicalType===0}const i_=new TextDecoder;function od(r,e){const i=fi(r,e,1)[0];if(i===0)return"";const s=e.get(),a=r.subarray(s,s+i);return e.add(i),i_.decode(a)}function mf(r,e){const i=fi(r,e,1)[0]>>>0;if(i<10||i>30)throw new Error(`Unsupported field type code ${i}. Supported: 10-29(scalars), 30(STRUCT)`);const s=df(i);if(pf(i)&&(s.name=od(r,e)),ff(i)){const a=fi(r,e,1)[0]>>>0;s.complexType.children=new Array(a);for(let l=0;l<a;l++)s.complexType.children[l]=mf(r,e)}return(function(a){return{name:a.name,nullable:a.nullable,scalarField:a.scalarType,complexField:a.complexType,type:a.type==="scalarType"?"scalarField":"complexField"}})(s)}function r_(r,e){const i=fi(r,e,1)[0]>>>0,s=df(i);if(!s)throw new Error(`Unsupported column type code ${i}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(pf(i)?s.name=od(r,e):i>=0&&i<=3?s.name="id":i===4&&(s.name="geometry"),ff(i)){const a=fi(r,e,1)[0]>>>0,l=s.complexType;l.children=new Array(a);for(let u=0;u<a;u++)l.children[u]=mf(r,e)}return s}function n_(r,e){const i={featureTables:[]},s={};s.name=od(r,e);const a=fi(r,e,1)[0]>>>0,l=fi(r,e,1)[0]>>>0;s.columns=new Array(l);for(let u=0;u<l;u++)s.columns[u]=r_(r,e);return i.featureTables.push(s),[i,a]}function s_(r,e,i,s,a,l,u=!1){const h=e.scalarType;if(!h||h.type!=="logicalType"||h.logicalType!==0)throw new Error(`ID column must be a logical ID scalar type: ${s}`);const g=h.longID?6:4,m=typeof l=="number"?void 0:l,x=xu(a,l,r,i,g===6?"int64":"int32");if(g===4)switch(x){case _t.FLAT:{const _=qi(r,i,a,0,m);return new $h(s,_,l)}case _t.SEQUENCE:{const _=Xp(r,i,a);return new qh(s,_[0],_[1],a.numRleValues)}case _t.CONST:{const _=id(r,i,a);return new Wh(s,_,l,!1)}}switch(x){case _t.FLAT:{if(u){const T=(function(v,I,M){const A=(function(D,L,k){const B=new Float64Array(k);for(let O=0;O<k;O++)B[O]=qg(D,L);return B})(v,I,M.numValues);return(function(D,L){switch(L.logicalLevelTechnique1){case je.DELTA:return L.logicalLevelTechnique2===je.RLE&&(D=$p(D,L.runs,L.numRleValues)),(function(k){k[0]=uo(k[0]);const B=k.length/4*4;let O=1;if(B>=4)for(;O<B-4;O+=4){const U=k[O+1],H=k[O+2],J=k[O+3];k[O]=uo(k[O])+k[O-1],k[O+1]=uo(U)+k[O],k[O+2]=uo(H)+k[O+1],k[O+3]=uo(J)+k[O+2]}for(;O!==k.length;++O)k[O]=uo(k[O])+k[O-1]})(D),D;case je.RLE:return(function(k,B){return $p(k,B.runs,B.numRleValues)})(D,L);case je.NONE:return D;default:throw new Error(`The specified Logical level technique is not supported: ${L.logicalLevelTechnique1}`)}})(A,M)})(r,i,a);return new Zh(s,T,l)}const _=Yp(r,i,a,m);return new Jp(s,_,l)}case _t.SEQUENCE:{const _=Hp(r,i,a);return new Qp(s,_[0],_[1],a.numRleValues)}case _t.CONST:{const _=Kp(r,i,a);return new cf(s,_,l,!1)}}throw new Error("Vector type not supported for id column.")}class a_{constructor(e,i){var s;switch(this._featureData=e,this.properties=this._featureData.properties||{},(s=this._featureData.geometry)===null||s===void 0?void 0:s.type){case Wt.POINT:case Wt.MULTIPOINT:this.type=1;break;case Wt.LINESTRING:case Wt.MULTILINESTRING:this.type=2;break;case Wt.POLYGON:case Wt.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=i,this.id=Number(this._featureData.id)}loadGeometry(){const e=[];for(const i of this._featureData.geometry.coordinates){const s=[];for(const a of i)s.push(new we(a.x,a.y));e.push(s)}return e}}class o_{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 a_(this.features[e],this.extent)}}class gf{constructor(e){this.layers={};const i=(function(s,a,l=!0){const u=new Up(0),h=[];for(;u.get()<s.length;){const m=fi(s,u,1)[0]>>>0,x=u.get()+m;if(x>s.length)throw new Error(`Block overruns tile: ${x} > ${s.length}`);if(fi(s,u,1)[0]>>>0!=1){u.set(x);continue}const[_,T]=n_(s,u),v=_.featureTables[0];let I=null,M=null;const A=[];let D=0;for(const k of v.columns){const B=k.name;if((g=k).type==="scalarType"&&g.scalarType?.type==="logicalType"&&g.scalarType.logicalType===0){let O=null;if(k.nullable){const H=bi(s,u),J=u.get(),ee=ql(s,H.numValues,H.byteLength,u);u.set(J+H.byteLength),O=new xr(ee,H.numValues)}const U=bi(s,u);D=O?O.size():U.decompressedCount,I=s_(s,k,u,B,U,O??D,l)}else if(t_(k)){const O=fi(s,u,1)[0];if(D===0){const U=u.get();D=bi(s,u).decompressedCount,u.set(U)}M=Hg(s,O,u,D)}else{const O=e_(k)?fi(s,u,1)[0]:1;if(O===0)continue;const U=Qg(s,u,k,O,D);if(U)if(Array.isArray(U))for(const H of U)A.push(H);else A.push(U)}}const L=new Bg(v.name,M,I,A,T);h.push(L),u.set(x)}var g;return h})(new Uint8Array(e));this.layers=i.reduce(((s,a)=>Object.assign(Object.assign({},s),{[a.name]:new o_(a)})),{})}}class l_{constructor(e,i){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=i,"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(){const e=[],i=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(const s of i){const a=[];for(const l of s)a.push(new we(l[0],l[1]));e.push(a)}return e}}const Xl="_geojsonTileLayer";function c_(r,e,i=""){e.writeVarintField(15,r.version||1),e.writeStringField(1,r.name||""),e.writeVarintField(5,r.extent||4096);const s={jsonPrefix:i,keys:[],values:[],keycache:{},valuecache:{}};for(let u=0;u<r.length;u++)s.feature=r.feature(u),e.writeMessage(2,u_,s);const a=s.keys;for(const u of a)e.writeStringField(3,u);const l=s.values;for(const u of l)e.writeMessage(4,p_,u)}function u_(r,e){if(!r.feature)return;const i=r.feature;i.id!==void 0&&e.writeVarintField(1,i.id),e.writeMessage(2,h_,r),e.writeVarintField(3,i.type),e.writeMessage(4,d_,i)}function h_(r,e){for(const i in r.feature?.properties){let s=r.feature.properties[i],a=r.keycache[i];if(s==null)continue;a===void 0&&(r.keys.push(i),a=r.keys.length-1,r.keycache[i]=a),e.writeVarint(a),typeof s!="string"&&typeof s!="boolean"&&typeof s!="number"&&(s=r.jsonPrefix+JSON.stringify(s));const l=typeof s+":"+s;let u=r.valuecache[l];u===void 0&&(r.values.push(s),u=r.values.length-1,r.valuecache[l]=u),e.writeVarint(u)}}function ld(r,e){return(e<<3)+(7&r)}function _f(r){return r<<1^r>>31}function d_(r,e){const i=r.loadGeometry(),s=r.type;let a=0,l=0;for(const u of i){let h=1;s===1&&(h=u.length),e.writeVarint(ld(1,h));const g=s===3?u.length-1:u.length;for(let m=0;m<g;m++){m===1&&s!==1&&e.writeVarint(ld(2,g-1));const x=u[m].x-a,_=u[m].y-l;e.writeVarint(_f(x)),e.writeVarint(_f(_)),a+=x,l+=_}r.type===3&&e.writeVarint(ld(7,1))}}function p_(r,e){const i=typeof r;i==="string"?e.writeStringField(1,r):i==="boolean"?e.writeBooleanField(7,r):i==="number"&&(r%1!=0?e.writeDoubleField(3,r):r<0?e.writeSVarintField(6,r):e.writeVarintField(5,r))}class yf{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new $s(Re,16,0),this.grid3D=new $s(Re,16,0),this.featureIndexArray=new V,this.promoteId=i}insert(e,i,s,a,l,u){const h=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,a,l);const g=u?this.grid3D:this.grid;for(let m=0;m<i.length;m++){const x=i[m],_=[1/0,1/0,-1/0,-1/0];for(let T=0;T<x.length;T++){const v=x[T];_[0]=Math.min(_[0],v.x),_[1]=Math.min(_[1],v.y),_[2]=Math.max(_[2],v.x),_[3]=Math.max(_[3],v.y)}_[0]<Re&&_[1]<Re&&_[2]>=0&&_[3]>=0&&g.insert(h,_[0],_[1],_[2],_[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=this.encoding!=="mlt"?new $d(new pu(this.rawTileData)).layers:new gf(this.rawTileData).layers,this.sourceLayerCoder=new Vp(this.vtLayers?Object.keys(this.vtLayers).sort():[Xl])),this.vtLayers}query(e,i,s,a){this.loadVTLayers();const l=e.params,u=Re/e.tileSize/e.scale,h=Fs(l.filter,l.globalState),g=e.queryGeometry,m=e.queryPadding*u,x=aa.fromPoints(g),_=this.grid.query(x.minX-m,x.minY-m,x.maxX+m,x.maxY+m),T=aa.fromPoints(e.cameraQueryGeometry).expandBy(m),v=this.grid3D.query(T.minX,T.minY,T.maxX,T.maxY,((A,D,L,k)=>(function(B,O,U,H,J){for(const re of B)if(O<=re.x&&U<=re.y&&H>=re.x&&J>=re.y)return!0;const ee=[new we(O,U),new we(O,J),new we(H,J),new we(H,U)];if(B.length>2){for(const re of ee)if(Ya(B,re))return!0}for(let re=0;re<B.length-1;re++)if(qf(B[re],B[re+1],ee))return!0;return!1})(e.cameraQueryGeometry,A-m,D-m,L+m,k+m)));for(const A of v)_.push(A);_.sort(f_);const I={};let M;for(let A=0;A<_.length;A++){const D=_[A];if(D===M)continue;M=D;const L=this.featureIndexArray.get(D);let k=null;this.loadMatchingFeature(I,L.bucketIndex,L.sourceLayerIndex,L.featureIndex,h,l.layers,l.availableImages,i,s,a,((B,O,U)=>(k||(k=Nr(B)),O.queryIntersectsFeature({queryGeometry:g,feature:B,featureState:U,geometry:k,zoom:this.z,transform:e.transform,pixelsToTileUnits:u,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return I}loadMatchingFeature(e,i,s,a,l,u,h,g,m,x,_){const T=this.bucketLayerIDs[i];if(u&&!T.some((A=>u.has(A))))return;const v=this.sourceLayerCoder.decode(s),I=this.vtLayers[v].feature(a);if(l.needGeometry){const A=Ur(I,!0);if(!l.filter(new nt(this.tileID.overscaledZ),A,this.tileID.canonical))return}else if(!l.filter(new nt(this.tileID.overscaledZ),I))return;const M=this.getId(I,v);for(let A=0;A<T.length;A++){const D=T[A];if(u&&!u.has(D))continue;const L=g[D];if(!L)continue;let k={};M&&x&&(k=x.getState(L.sourceLayer||Xl,M));const B=Ri({},m[D]);B.paint=xf(B.paint,L.paint,I,k,h),B.layout=xf(B.layout,L.layout,I,k,h);const O=!_||_(I,L,k);if(!O)continue;const U=new jp(I,this.z,this.x,this.y,M);U.layer=B;let H=e[D];H===void 0&&(H=e[D]=[]),H.push({featureIndex:a,feature:U,intersectionZ:O})}}lookupSymbolFeatures(e,i,s,a,l,u,h,g){const m={};this.loadVTLayers();const x=Fs(l.filterSpec,l.globalState);for(const _ of e)this.loadMatchingFeature(m,s,a,_,x,u,h,g,i);return m}hasLayer(e){for(const i of this.bucketLayerIDs)for(const s of i)if(e===s)return!0;return!1}getId(e,i){var s;let a=e.id;return this.promoteId&&(a=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[i]],typeof a=="boolean"&&(a=Number(a)),a===void 0&&(!((s=e.properties)===null||s===void 0)&&s.cluster)&&this.promoteId&&(a=Number(e.properties.cluster_id))),a}}function xf(r,e,i,s,a){return Ir(r,((l,u)=>{const h=e instanceof pn?e.get(u):null;return h&&h.evaluate?h.evaluate(i,s,a):h}))}function f_(r,e){return e-r}function vf(r,e,i,s,a){const l=[];for(let u=0;u<r.length;u++){const h=r[u];let g;for(let m=0;m<h.length-1;m++){let x=h[m],_=h[m+1];x.x<e&&_.x<e||(x.x<e?x=new we(e,x.y+(e-x.x)/(_.x-x.x)*(_.y-x.y))._round():_.x<e&&(_=new we(e,x.y+(e-x.x)/(_.x-x.x)*(_.y-x.y))._round()),x.y<i&&_.y<i||(x.y<i?x=new we(x.x+(i-x.y)/(_.y-x.y)*(_.x-x.x),i)._round():_.y<i&&(_=new we(x.x+(i-x.y)/(_.y-x.y)*(_.x-x.x),i)._round()),x.x>=s&&_.x>=s||(x.x>=s?x=new we(s,x.y+(s-x.x)/(_.x-x.x)*(_.y-x.y))._round():_.x>=s&&(_=new we(s,x.y+(s-x.x)/(_.x-x.x)*(_.y-x.y))._round()),x.y>=a&&_.y>=a||(x.y>=a?x=new we(x.x+(a-x.y)/(_.y-x.y)*(_.x-x.x),a)._round():_.y>=a&&(_=new we(x.x+(a-x.y)/(_.y-x.y)*(_.x-x.x),a)._round()),g&&x.equals(g[g.length-1])||(g=[x],l.push(g)),g.push(_)))))}}return l}function bf(r,e,i,s,a){switch(e){case 1:return(function(l,u,h,g){const m=[];for(const x of l)for(const _ of x){const T=g===0?_.x:_.y;T>=u&&T<=h&&m.push([_])}return m})(r,i,s,a);case 2:return wf(r,i,s,a,!1);case 3:return wf(r,i,s,a,!0)}return[]}function m_(r,e,i,s,a){const l=s===0?g_:__;let u=[];const h=[];for(let x=0;x<r.length-1;x++){const _=r[x],T=r[x+1],v=s===0?_.x:_.y,I=s===0?T.x:T.y;let M=!1;v<e?I>e&&u.push(l(_,T,e)):v>i?I<i&&u.push(l(_,T,i)):u.push(_),I<e&&v>=e&&(u.push(l(_,T,e)),M=!0),I>i&&v<=i&&(u.push(l(_,T,i)),M=!0),!a&&M&&(h.push(u),u=[])}const g=r.length-1,m=s===0?r[g].x:r[g].y;return m>=e&&m<=i&&u.push(r[g]),a&&u.length>0&&!u[0].equals(u[u.length-1])&&u.push(new we(u[0].x,u[0].y)),u.length>0&&h.push(u),h}function wf(r,e,i,s,a){const l=[];for(const u of r){const h=m_(u,e,i,s,a);h.length>0&&l.push(...h)}return l}function g_(r,e,i){return new we(i,r.y+(i-r.x)/(e.x-r.x)*(e.y-r.y))}function __(r,e,i){return new we(r.x+(i-r.y)/(e.y-r.y)*(e.x-r.x),i)}Se("FeatureIndex",yf,{omit:["rawTileData","sourceLayerCoder"]});class ns extends we{constructor(e,i,s,a){super(e,i),this.angle=s,a!==void 0&&(this.segment=a)}clone(){return new ns(this.x,this.y,this.angle,this.segment)}}function Tf(r,e,i,s,a){if(e.segment===void 0||i===0)return!0;let l=e,u=e.segment+1,h=0;for(;h>-i/2;){if(u--,u<0)return!1;h-=r[u].dist(l),l=r[u]}h+=r[u].dist(r[u+1]),u++;const g=[];let m=0;for(;h<i/2;){const x=r[u],_=r[u+1];if(!_)return!1;let T=r[u-1].angleTo(x)-x.angleTo(_);for(T=Math.abs((T+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:h,angleDelta:T}),m+=T;h-g[0].distance>s;)m-=g.shift().angleDelta;if(m>a)return!1;u++,h+=x.dist(_)}return!0}function Sf(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function Pf(r,e,i){return r?.6*e*i:0}function If(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function y_(r,e,i,s,a,l){const u=Pf(i,a,l),h=If(i,s)*l;let g=0;const m=Sf(r)/2;for(let x=0;x<r.length-1;x++){const _=r[x],T=r[x+1],v=_.dist(T);if(g+v>m){const I=(m-g)/v,M=Yi.number(_.x,T.x,I),A=Yi.number(_.y,T.y,I),D=new ns(M,A,T.angleTo(_),x);return D._round(),!u||Tf(r,D,h,u,e)?D:void 0}g+=v}}function x_(r,e,i,s,a,l,u,h,g){const m=Pf(s,l,u),x=If(s,a),_=x*u,T=r[0].x===0||r[0].x===g||r[0].y===0||r[0].y===g;return e-_<e/4&&(e=_+e/4),Mf(r,T?e/2*h%e:(x/2+2*l)*u*h%e,e,m,i,_,T,!1,g)}function Mf(r,e,i,s,a,l,u,h,g){const m=l/2,x=Sf(r);let _=0,T=e-i,v=[];for(let I=0;I<r.length-1;I++){const M=r[I],A=r[I+1],D=M.dist(A),L=A.angleTo(M);for(;T+i<_+D;){T+=i;const k=(T-_)/D,B=Yi.number(M.x,A.x,k),O=Yi.number(M.y,A.y,k);if(B>=0&&B<g&&O>=0&&O<g&&T-m>=0&&T+m<=x){const U=new ns(B,O,L,I);U._round(),s&&!Tf(r,U,l,s,a)||v.push(U)}}_+=D}return h||v.length||u||(v=Mf(r,_/2,i,s,a,l,u,!0,g)),v}function Ef(r,e,i,s){const a=[],l=r.image,u=l.pixelRatio,h=l.paddedRect.w-2,g=l.paddedRect.h-2;let m={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const x=l.stretchX||[[0,h]],_=l.stretchY||[[0,g]],T=(se,ye)=>se+ye[1]-ye[0],v=x.reduce(T,0),I=_.reduce(T,0),M=h-v,A=g-I;let D=0,L=v,k=0,B=I,O=0,U=M,H=0,J=A;if(l.content&&s){const se=l.content,ye=se[2]-se[0],Te=se[3]-se[1];(l.textFitWidth||l.textFitHeight)&&(m=Tp(r)),D=vu(x,0,se[0]),k=vu(_,0,se[1]),L=vu(x,se[0],se[2]),B=vu(_,se[1],se[3]),O=se[0]-D,H=se[1]-k,U=ye-L,J=Te-B}const ee=m.x1,re=m.y1,ue=m.x2-ee,le=m.y2-re,ce=(se,ye,Te,be)=>{const me=bu(se.stretch-D,L,ue,ee),Ae=wu(se.fixed-O,U,se.stretch,v),He=bu(ye.stretch-k,B,le,re),Qe=wu(ye.fixed-H,J,ye.stretch,I),it=bu(Te.stretch-D,L,ue,ee),ci=wu(Te.fixed-O,U,Te.stretch,v),St=bu(be.stretch-k,B,le,re),jt=wu(be.fixed-H,J,be.stretch,I),Xt=new we(me,He),yt=new we(it,He),ei=new we(it,St),mi=new we(me,St),gi=new we(Ae/u,Qe/u),zi=new we(ci/u,jt/u),ui=e*Math.PI/180;if(ui){const Ht=Math.sin(ui),Tt=Math.cos(ui),Lt=[Tt,-Ht,Ht,Tt];Xt._matMult(Lt),yt._matMult(Lt),mi._matMult(Lt),ei._matMult(Lt)}const ki=se.stretch+se.fixed,ar=ye.stretch+ye.fixed;return{tl:Xt,tr:yt,bl:mi,br:ei,tex:{x:l.paddedRect.x+1+ki,y:l.paddedRect.y+1+ar,w:Te.stretch+Te.fixed-ki,h:be.stretch+be.fixed-ar},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:gi,pixelOffsetBR:zi,minFontScaleX:U/u/ue,minFontScaleY:J/u/le,isSDF:i}};if(s&&(l.stretchX||l.stretchY)){const se=Cf(x,M,v),ye=Cf(_,A,I);for(let Te=0;Te<se.length-1;Te++){const be=se[Te],me=se[Te+1];for(let Ae=0;Ae<ye.length-1;Ae++)a.push(ce(be,ye[Ae],me,ye[Ae+1]))}}else a.push(ce({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:h+1},{fixed:0,stretch:g+1}));return a}function vu(r,e,i){let s=0;for(const a of r)s+=Math.max(e,Math.min(i,a[1]))-Math.max(e,Math.min(i,a[0]));return s}function Cf(r,e,i){const s=[{fixed:-1,stretch:0}];for(const[a,l]of r){const u=s[s.length-1];s.push({fixed:a-u.stretch,stretch:u.stretch}),s.push({fixed:a-u.stretch,stretch:u.stretch+(l-a)})}return s.push({fixed:e+1,stretch:i}),s}function bu(r,e,i,s){return r/e*i+s}function wu(r,e,i,s){return r-e*i/s}Se("Anchor",ns);class Tu{constructor(e,i,s,a,l,u,h,g,m,x){var _;if(this.boxStartIndex=e.length,m){let T=u.top,v=u.bottom;const I=u.collisionPadding;I&&(T-=I[1],v+=I[3]);let M=v-T;M>0&&(M=Math.max(10,M),this.circleDiameter=M)}else{const T=!((_=u.image)===null||_===void 0)&&_.content&&(u.image.textFitWidth||u.image.textFitHeight)?Tp(u):{x1:u.left,y1:u.top,x2:u.right,y2:u.bottom};T.y1=T.y1*h-g[0],T.y2=T.y2*h+g[2],T.x1=T.x1*h-g[3],T.x2=T.x2*h+g[1];const v=u.collisionPadding;if(v&&(T.x1-=v[0]*h,T.y1-=v[1]*h,T.x2+=v[2]*h,T.y2+=v[3]*h),x){const I=new we(T.x1,T.y1),M=new we(T.x2,T.y1),A=new we(T.x1,T.y2),D=new we(T.x2,T.y2),L=x*Math.PI/180;I._rotate(L),M._rotate(L),A._rotate(L),D._rotate(L),T.x1=Math.min(I.x,M.x,A.x,D.x),T.x2=Math.max(I.x,M.x,A.x,D.x),T.y1=Math.min(I.y,M.y,A.y,D.y),T.y2=Math.max(I.y,M.y,A.y,D.y)}e.emplaceBack(i.x,i.y,T.x1,T.y1,T.x2,T.y2,s,a,l)}this.boxEndIndex=e.length}}class v_{constructor(e=[],i=(s,a)=>s<a?-1:s>a?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:s}=this,a=i[e];for(;e>0;){const l=e-1>>1,u=i[l];if(s(a,u)>=0)break;i[e]=u,e=l}i[e]=a}_down(e){const{data:i,compare:s}=this,a=this.length>>1,l=i[e];for(;e<a;){let u=1+(e<<1);const h=u+1;if(h<this.length&&s(i[h],i[u])<0&&(u=h),s(i[u],l)>=0)break;i[e]=i[u],e=u}i[e]=l}}function b_(r,e=1,i=!1){const s=aa.fromPoints(r[0]),a=Math.min(s.width(),s.height());let l=a/2;const u=new v_([],w_),{minX:h,minY:g,maxX:m,maxY:x}=s;if(a===0)return new we(h,g);for(let v=h;v<m;v+=a)for(let I=g;I<x;I+=a)u.push(new _o(v+l,I+l,l,r));let _=(function(v){let I=0,M=0,A=0;const D=v[0];for(let L=0,k=D.length,B=k-1;L<k;B=L++){const O=D[L],U=D[B],H=O.x*U.y-U.x*O.y;M+=(O.x+U.x)*H,A+=(O.y+U.y)*H,I+=3*H}return new _o(M/I,A/I,0,v)})(r),T=u.length;for(;u.length;){const v=u.pop();(v.d>_.d||!_.d)&&(_=v,i&&console.log("found best %d after %d probes",Math.round(1e4*v.d)/1e4,T)),v.max-_.d<=e||(l=v.h/2,u.push(new _o(v.p.x-l,v.p.y-l,l,r)),u.push(new _o(v.p.x+l,v.p.y-l,l,r)),u.push(new _o(v.p.x-l,v.p.y+l,l,r)),u.push(new _o(v.p.x+l,v.p.y+l,l,r)),T+=4)}return i&&(console.log(`num probes: ${T}`),console.log(`best distance: ${_.d}`)),_.p}function w_(r,e){return e.max-r.max}function _o(r,e,i,s){this.p=new we(r,e),this.h=i,this.d=(function(a,l){let u=!1,h=1/0;for(let g=0;g<l.length;g++){const m=l[g];for(let x=0,_=m.length,T=_-1;x<_;T=x++){const v=m[x],I=m[T];v.y>a.y!=I.y>a.y&&a.x<(I.x-v.x)*(a.y-v.y)/(I.y-v.y)+v.x&&(u=!u),h=Math.min(h,xd(a,v,I))}}return(u?1:-1)*Math.sqrt(h)})(this.p,s),this.max=this.d+this.h*Math.SQRT2}var li;R.aM=void 0,(li=R.aM||(R.aM={}))[li.center=1]="center",li[li.left=2]="left",li[li.right=3]="right",li[li.top=4]="top",li[li.bottom=5]="bottom",li[li["top-left"]=6]="top-left",li[li["top-right"]=7]="top-right",li[li["bottom-left"]=8]="bottom-left",li[li["bottom-right"]=9]="bottom-right";const cd=Number.POSITIVE_INFINITY;function Af(r,e){return e[1]!==cd?(function(i,s,a){let l=0,u=0;switch(s=Math.abs(s),a=Math.abs(a),i){case"top-right":case"top-left":case"top":u=a-7;break;case"bottom-right":case"bottom-left":case"bottom":u=7-a}switch(i){case"top-right":case"bottom-right":case"right":l=-s;break;case"top-left":case"bottom-left":case"left":l=s}return[l,u]})(r,e[0],e[1]):(function(i,s){let a=0,l=0;s<0&&(s=0);const u=s/Math.SQRT2;switch(i){case"top-right":case"top-left":l=u-7;break;case"bottom-right":case"bottom-left":l=7-u;break;case"bottom":l=7-s;break;case"top":l=s-7}switch(i){case"top-right":case"bottom-right":a=-u;break;case"top-left":case"bottom-left":a=u;break;case"left":a=s;break;case"right":a=-s}return[a,l]})(r,e[0])}function Df(r,e,i){var s;const a=r.layout,l=(s=a.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(e,{},i);if(l){const h=l.values,g=[];for(let m=0;m<h.length;m+=2){const x=g[m]=h[m],_=h[m+1].map((T=>T*qt));x.startsWith("top")?_[1]-=7:x.startsWith("bottom")&&(_[1]+=7),g[m+1]=_}return new ti(g)}const u=a.get("text-variable-anchor");if(u){let h;h=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[a.get("text-radial-offset").evaluate(e,{},i)*qt,cd]:a.get("text-offset").evaluate(e,{},i).map((m=>m*qt));const g=[];for(const m of u)g.push(m,Af(m,h));return new ti(g)}return null}function ud(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function T_(r,e,i,s,a,l,u,h,g,m,x,_){let T=l.textMaxSize.evaluate(e,{});T===void 0&&(T=u);const v=r.layers[0].layout,I=v.get("icon-offset").evaluate(e,{},x),M=kf(i.horizontal),A=u/24,D=r.tilePixelRatio*A,L=r.tilePixelRatio*T/24,k=r.tilePixelRatio*h,B=r.tilePixelRatio*v.get("symbol-spacing"),O=v.get("text-padding")*r.tilePixelRatio,U=(function(Te,be,me,Ae=1){const He=Te.get("icon-padding").evaluate(be,{},me),Qe=He&&He.values;return[Qe[0]*Ae,Qe[1]*Ae,Qe[2]*Ae,Qe[3]*Ae]})(v,e,x,r.tilePixelRatio),H=v.get("text-max-angle")/180*Math.PI,J=v.get("text-rotation-alignment")!=="viewport"&&v.get("symbol-placement")!=="point",ee=v.get("icon-rotation-alignment")==="map"&&v.get("symbol-placement")!=="point",re=v.get("symbol-placement"),ue=B/2,le=v.get("icon-text-fit");let ce;s&&le!=="none"&&(r.allowVerticalPlacement&&i.vertical&&(ce=Sp(s,i.vertical,le,v.get("icon-text-fit-padding"),I,A)),M&&(s=Sp(s,M,le,v.get("icon-text-fit-padding"),I,A)));const se=x?_.line.getGranularityForZoomLevel(x.z):1,ye=(Te,be)=>{be.x<0||be.x>=Re||be.y<0||be.y>=Re||(function(me,Ae,He,Qe,it,ci,St,jt,Xt,yt,ei,mi,gi,zi,ui,ki,ar,Ht,Tt,Lt,Pt,Yt,bn,vr,Yl){const ss=me.addToLineVertexArray(Ae,He);let la,yo,xo,vo,Rf=0,Ff=0,Lf=0,Bf=0,md=-1,gd=-1;const wn={};let Of=si("");if(me.allowVerticalPlacement&&Qe.vertical){const _i=jt.layout.get("text-rotate").evaluate(Pt,{},vr)+90;xo=new Tu(Xt,Ae,yt,ei,mi,Qe.vertical,gi,zi,ui,_i),St&&(vo=new Tu(Xt,Ae,yt,ei,mi,St,ar,Ht,ui,_i))}if(it){const _i=jt.layout.get("icon-rotate").evaluate(Pt,{}),tr=jt.layout.get("icon-text-fit")!=="none",ca=Ef(it,_i,bn,tr),wr=St?Ef(St,_i,bn,tr):void 0;yo=new Tu(Xt,Ae,yt,ei,mi,it,ar,Ht,!1,_i),Rf=4*ca.length;const ua=me.iconSizeData;let Gr=null;ua.kind==="source"?(Gr=[xn*jt.layout.get("icon-size").evaluate(Pt,{})],Gr[0]>Qn&&Ut(`${me.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):ua.kind==="composite"&&(Gr=[xn*Yt.compositeIconSizes[0].evaluate(Pt,{},vr),xn*Yt.compositeIconSizes[1].evaluate(Pt,{},vr)],(Gr[0]>Qn||Gr[1]>Qn)&&Ut(`${me.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),me.addSymbols(me.icon,ca,Gr,Lt,Tt,Pt,R.aw.none,Ae,ss.lineStartIndex,ss.lineLength,-1,vr),md=me.icon.placedSymbolArray.length-1,wr&&(Ff=4*wr.length,me.addSymbols(me.icon,wr,Gr,Lt,Tt,Pt,R.aw.vertical,Ae,ss.lineStartIndex,ss.lineLength,-1,vr),gd=me.icon.placedSymbolArray.length-1)}const Vf=Object.keys(Qe.horizontal);for(const _i of Vf){const tr=Qe.horizontal[_i];if(!la){Of=si(tr.text);const wr=jt.layout.get("text-rotate").evaluate(Pt,{},vr);la=new Tu(Xt,Ae,yt,ei,mi,tr,gi,zi,ui,wr)}const ca=tr.positionedLines.length===1;if(Lf+=zf(me,Ae,tr,ci,jt,ui,Pt,ki,ss,Qe.vertical?R.aw.horizontal:R.aw.horizontalOnly,ca?Vf:[_i],wn,md,Yt,vr),ca)break}Qe.vertical&&(Bf+=zf(me,Ae,Qe.vertical,ci,jt,ui,Pt,ki,ss,R.aw.vertical,["vertical"],wn,gd,Yt,vr));const I_=la?la.boxStartIndex:me.collisionBoxArray.length,M_=la?la.boxEndIndex:me.collisionBoxArray.length,E_=xo?xo.boxStartIndex:me.collisionBoxArray.length,C_=xo?xo.boxEndIndex:me.collisionBoxArray.length,A_=yo?yo.boxStartIndex:me.collisionBoxArray.length,D_=yo?yo.boxEndIndex:me.collisionBoxArray.length,z_=vo?vo.boxStartIndex:me.collisionBoxArray.length,k_=vo?vo.boxEndIndex:me.collisionBoxArray.length;let br=-1;const Pu=(_i,tr)=>_i&&_i.circleDiameter?Math.max(_i.circleDiameter,tr):tr;br=Pu(la,br),br=Pu(xo,br),br=Pu(yo,br),br=Pu(vo,br);const jf=br>-1?1:0;jf&&(br*=Yl/qt),me.glyphOffsetArray.length>=ao.MAX_GLYPHS&&Ut("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Pt.sortKey!==void 0&&me.addToSortKeyRanges(me.symbolInstances.length,Pt.sortKey);const R_=Df(jt,Pt,vr),[F_,L_]=(function(_i,tr){const ca=_i.length,wr=tr?.values;if(wr?.length>0)for(let ua=0;ua<wr.length;ua+=2){const Gr=wr[ua+1];_i.emplaceBack(R.aM[wr[ua]],Gr[0],Gr[1])}return[ca,_i.length]})(me.textAnchorOffsets,R_);me.symbolInstances.emplaceBack(Ae.x,Ae.y,wn.right>=0?wn.right:-1,wn.center>=0?wn.center:-1,wn.left>=0?wn.left:-1,wn.vertical||-1,md,gd,Of,I_,M_,E_,C_,A_,D_,z_,k_,yt,Lf,Bf,Rf,Ff,jf,0,gi,br,F_,L_)})(r,be,Te,i,s,a,ce,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,D,[O,O,O,O],J,g,k,U,ee,I,e,l,m,x,u)};if(re==="line")for(const Te of vf(e.geometry,0,0,Re,Re)){const be=sa(Te,se),me=x_(be,B,H,i.vertical||M,s,24,L,r.overscaling,Re);for(const Ae of me)M&&S_(r,M.text,ue,Ae)||ye(be,Ae)}else if(re==="line-center"){for(const Te of e.geometry)if(Te.length>1){const be=sa(Te,se),me=y_(be,H,i.vertical||M,s,24,L);me&&ye(be,me)}}else if(e.type==="Polygon")for(const Te of Ia(e.geometry,0)){const be=b_(Te,16);ye(sa(Te[0],se,!0),new ns(be.x,be.y,0))}else if(e.type==="LineString")for(const Te of e.geometry){const be=sa(Te,se);ye(be,new ns(be[0].x,be[0].y,0))}else if(e.type==="Point")for(const Te of e.geometry)for(const be of Te)ye([be],new ns(be.x,be.y,0))}function zf(r,e,i,s,a,l,u,h,g,m,x,_,T,v,I){const M=(function(L,k,B,O,U,H,J,ee){const re=O.layout.get("text-rotate").evaluate(H,{})*Math.PI/180,ue=[];for(const le of k.positionedLines)for(const ce of le.positionedGlyphs){if(!ce.rect)continue;const se=ce.rect||{};let ye=4,Te=!0,be=1,me=0;const Ae=(U||ee)&&ce.vertical,He=ce.metrics.advance*ce.scale/2;if(ee&&k.verticalizable&&(me=le.lineOffset/2-(ce.imageName?-(qt-ce.metrics.width*ce.scale)/2:(ce.scale-1)*qt)),ce.imageName){const Ht=J[ce.imageName];Te=Ht.sdf,be=Ht.pixelRatio,ye=1/be}const Qe=U?[ce.x+He,ce.y]:[0,0];let it=U?[0,0]:[ce.x+He+B[0],ce.y+B[1]-me],ci=[0,0];Ae&&(ci=it,it=[0,0]);const St=ce.metrics.isDoubleResolution?2:1,jt=(ce.metrics.left-ye)*ce.scale-He+it[0],Xt=(-ce.metrics.top-ye)*ce.scale+it[1],yt=jt+se.w/St*ce.scale/be,ei=Xt+se.h/St*ce.scale/be,mi=new we(jt,Xt),gi=new we(yt,Xt),zi=new we(jt,ei),ui=new we(yt,ei);if(Ae){const Ht=new we(-He,He- -17),Tt=-Math.PI/2,Lt=12-He,Pt=new we(22-Lt,-(ce.imageName?Lt:0)),Yt=new we(...ci);mi._rotateAround(Tt,Ht)._add(Pt)._add(Yt),gi._rotateAround(Tt,Ht)._add(Pt)._add(Yt),zi._rotateAround(Tt,Ht)._add(Pt)._add(Yt),ui._rotateAround(Tt,Ht)._add(Pt)._add(Yt)}if(re){const Ht=Math.sin(re),Tt=Math.cos(re),Lt=[Tt,-Ht,Ht,Tt];mi._matMult(Lt),gi._matMult(Lt),zi._matMult(Lt),ui._matMult(Lt)}const ki=new we(0,0),ar=new we(0,0);ue.push({tl:mi,tr:gi,bl:zi,br:ui,tex:se,writingMode:k.writingMode,glyphOffset:Qe,sectionIndex:ce.sectionIndex,isSDF:Te,pixelOffsetTL:ki,pixelOffsetBR:ar,minFontScaleX:0,minFontScaleY:0})}return ue})(0,i,h,a,l,u,s,r.allowVerticalPlacement),A=r.textSizeData;let D=null;A.kind==="source"?(D=[xn*a.layout.get("text-size").evaluate(u,{})],D[0]>Qn&&Ut(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):A.kind==="composite"&&(D=[xn*v.compositeTextSizes[0].evaluate(u,{},I),xn*v.compositeTextSizes[1].evaluate(u,{},I)],(D[0]>Qn||D[1]>Qn)&&Ut(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),r.addSymbols(r.text,M,D,h,l,u,m,e,g.lineStartIndex,g.lineLength,T,I);for(const L of x)_[L]=r.text.placedSymbolArray.length-1;return 4*M.length}function kf(r){for(const e in r)return r[e];return null}function S_(r,e,i,s){const a=r.compareText;if(e in a){const l=a[e];for(let u=l.length-1;u>=0;u--)if(s.dist(l[u])<i)return!0}else a[e]=[];return a[e].push(s),!1}var hd;R.cF=void 0,(hd=R.cF||(R.cF={})).create="create",hd.load="load",hd.fullLoad="fullLoad";let Su=null,Hl=[];const dd=1e3/60,pd="loadTime",fd="fullLoadTime",P_={mark(r){performance.mark(r)},recordStartOfFrameAt(r){Su!=null&&Hl.push(r-Su),Su=r},resetRuntimeMetrics(){Su=null,Hl=[]},clearInitializationMetrics(){performance.clearMeasures(pd),performance.clearMeasures(fd);for(const r in R.cF)performance.clearMarks(R.cF[r])},remove(){this.resetRuntimeMetrics(),this.clearInitializationMetrics()},getPerformanceMetrics(){performance.measure(pd,R.cF.create,R.cF.load),performance.measure(fd,R.cF.create,R.cF.fullLoad);const r=performance.getEntriesByName(pd)[0].duration,e=performance.getEntriesByName(fd)[0].duration,i=Hl.length;return{loadTimeMs:r,fullLoadTimeMs:e,averageFramesPerSecond:1/(Hl.reduce(((s,a)=>s+a),0)/i/1e3),virtualDroppedFramesCount:Hl.filter((s=>s>dd)).reduce(((s,a)=>s+(a-dd)/dd),0),totalFramesCount:i}}};R.$=ge,R.A=It,R.B=Ga,R.C=dn,R.D=Ie,R.E=fa,R.F=function([r,e,i]){return e+=90,e*=Math.PI/180,i*=Math.PI/180,{x:r*Math.cos(e)*Math.sin(i),y:r*Math.sin(e)*Math.sin(i),z:r*Math.cos(i)}},R.G=Yi,R.H=nt,R.I=Fh,R.J=Ku,R.K=function(r){if(Li==null){const e=r.navigator?r.navigator.userAgent:null;Li=!!r.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Li},R.L=class{constructor(r,e){this.target=r,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Fg((()=>this.process())),this.subscription=Er(this.target,"message",(i=>this.receive(i)),!1),this.globalScope=Gt(self)?r:window}registerMessageHandler(r,e){this.messageHandlers[r]=e}unregisterMessageHandler(r){delete this.messageHandlers[r]}sendAsync(r,e){return new Promise(((i,s)=>{const a=Math.round(1e18*Math.random()).toString(36).substring(0,10),l=e?Er(e.signal,"abort",(()=>{l?.unsubscribe(),delete this.resolveRejects[a];const g={id:a,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(g)}),Lg):null;this.resolveRejects[a]={resolve:g=>{l?.unsubscribe(),i(g)},reject:g=>{l?.unsubscribe(),s(g)}};const u=[],h=Object.assign(Object.assign({},r),{id:a,sourceMapId:this.mapId,origin:location.origin,data:Zs(r.data,u)});this.target.postMessage(h,{transfer:u})}))}receive(r){const e=r.data,i=e.id,s=["file://","resource://android","null"],a=[e.origin,location.origin],l=e.origin===location.origin,u=a.some((h=>s.includes(h)));if((l||u)&&(!e.targetMapId||this.mapId===e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[i];const h=this.abortControllers[i];return delete this.abortControllers[i],void(h&&h.abort())}if(Gt(self)||e.mustQueue)return this.tasks[i]=e,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,e)}}process(){if(this.taskQueue.length===0)return;const r=this.taskQueue.shift(),e=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(r,e)}processTask(r,e){return d(this,void 0,void 0,(function*(){if(e.type==="<response>"){const a=this.resolveRejects[r];return delete this.resolveRejects[r],a?void(e.error?a.reject(dr(e.error)):a.resolve(dr(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(r,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const i=dr(e.data),s=new AbortController;this.abortControllers[r]=s;try{const a=yield this.messageHandlers[e.type](e.sourceMapId,i,s);this.completeTask(r,null,a)}catch(a){this.completeTask(r,a)}}))}completeTask(r,e,i){const s=[];delete this.abortControllers[r];const a={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?Zs(e):null,data:Zs(i,s)};this.target.postMessage(a,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},R.M=Bi,R.N=function(){var r=new It(16);return It!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r},R.O=function(r,e,i){var s,a,l,u,h,g,m,x,_,T,v,I,M=i[0],A=i[1],D=i[2];return e===r?(r[12]=e[0]*M+e[4]*A+e[8]*D+e[12],r[13]=e[1]*M+e[5]*A+e[9]*D+e[13],r[14]=e[2]*M+e[6]*A+e[10]*D+e[14],r[15]=e[3]*M+e[7]*A+e[11]*D+e[15]):(a=e[1],l=e[2],u=e[3],h=e[4],g=e[5],m=e[6],x=e[7],_=e[8],T=e[9],v=e[10],I=e[11],r[0]=s=e[0],r[1]=a,r[2]=l,r[3]=u,r[4]=h,r[5]=g,r[6]=m,r[7]=x,r[8]=_,r[9]=T,r[10]=v,r[11]=I,r[12]=s*M+h*A+_*D+e[12],r[13]=a*M+g*A+T*D+e[13],r[14]=l*M+m*A+v*D+e[14],r[15]=u*M+x*A+I*D+e[15]),r},R.P=we,R.Q=function(r,e,i){var s=i[0],a=i[1],l=i[2];return r[0]=e[0]*s,r[1]=e[1]*s,r[2]=e[2]*s,r[3]=e[3]*s,r[4]=e[4]*a,r[5]=e[5]*a,r[6]=e[6]*a,r[7]=e[7]*a,r[8]=e[8]*l,r[9]=e[9]*l,r[10]=e[10]*l,r[11]=e[11]*l,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},R.R=Di,R.S=function(r,e,i){var s=e[0],a=e[1],l=e[2],u=e[3],h=e[4],g=e[5],m=e[6],x=e[7],_=e[8],T=e[9],v=e[10],I=e[11],M=e[12],A=e[13],D=e[14],L=e[15],k=i[0],B=i[1],O=i[2],U=i[3];return r[0]=k*s+B*h+O*_+U*M,r[1]=k*a+B*g+O*T+U*A,r[2]=k*l+B*m+O*v+U*D,r[3]=k*u+B*x+O*I+U*L,r[4]=(k=i[4])*s+(B=i[5])*h+(O=i[6])*_+(U=i[7])*M,r[5]=k*a+B*g+O*T+U*A,r[6]=k*l+B*m+O*v+U*D,r[7]=k*u+B*x+O*I+U*L,r[8]=(k=i[8])*s+(B=i[9])*h+(O=i[10])*_+(U=i[11])*M,r[9]=k*a+B*g+O*T+U*A,r[10]=k*l+B*m+O*v+U*D,r[11]=k*u+B*x+O*I+U*L,r[12]=(k=i[12])*s+(B=i[13])*h+(O=i[14])*_+(U=i[15])*M,r[13]=k*a+B*g+O*T+U*A,r[14]=k*l+B*m+O*v+U*D,r[15]=k*u+B*x+O*I+U*L,r},R.T=hh,R.U=function(r,e){const i={};for(let s=0;s<e.length;s++){const a=e[s];a in r&&(i[a]=r[a])}return i},R.V=es,R.W=Pn,R.X=kp,R.Y=zp,R.Z=da,R._=d,R.a=Kl,R.a$=function(r){var e=new It(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e},R.a0=Ti,R.a1=hs,R.a2=$i,R.a3=Fp,R.a4=_u,R.a5=Re,R.a6=Zl,R.a7=aa,R.a8=25,R.a9=Gh,R.aA=function(r){var e=r[0],i=r[1];return Math.sqrt(e*e+i*i)},R.aB=function(r){return r[0]=0,r[1]=0,r},R.aC=function(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r},R.aD=Oh,R.aE=ze,R.aF=function(r,e,i,s){const a=e.y-r.y,l=e.x-r.x,u=s.y-i.y,h=s.x-i.x,g=u*l-h*a;if(g===0)return null;const m=(h*(r.y-i.y)-u*(r.x-i.x))/g;return new we(r.x+m*l,r.y+m*a)},R.aG=vf,R.aH=_d,R.aI=function(r){let e=1/0,i=1/0,s=-1/0,a=-1/0;for(const l of r)e=Math.min(e,l.x),i=Math.min(i,l.y),s=Math.max(s,l.x),a=Math.max(a,l.y);return[e,i,s,a]},R.aJ=qt,R.aK=Jt,R.aL=function(r,e,i,s,a=!1){if(!i[0]&&!i[1])return[0,0];const l=a?s==="map"?-r.bearingInRadians:0:s==="viewport"?r.bearingInRadians:0;if(l){const u=Math.sin(l),h=Math.cos(l);i=[i[0]*h-i[1]*u,i[0]*u+i[1]*h]}return[a?i[0]:Jt(e,i[0],r.zoom),a?i[1]:Jt(e,i[1],r.zoom)]},R.aN=Bh,R.aO=ud,R.aP=Lh,R.aQ=r=>r.type==="symbol",R.aR=ou,R.aS=Ct,R.aT=au,R.aU=j,R.aV=Me,R.aW=pe,R.aX=Xr,R.aY=Lp,R.aZ=te,R.a_=K,R.aa=r=>{const e=window.document.createElement("video");return e.muted=!0,new Promise((i=>{e.onloadstart=()=>{i(e)};for(const s of r){const a=window.document.createElement("source");Xi(s)||(e.crossOrigin="Anonymous"),a.src=s,e.appendChild(a)}}))},R.ab=xe,R.ac=function(){return us++},R.ad=f,R.ae=ao,R.af=Xl,R.ag=Fs,R.ah=Ur,R.ai=jp,R.aj=function(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((i,s,a,l)=>{const u=a||l;return e[s]=!u||u.toLowerCase(),""})),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e},R.ak=Si,R.al=85.051129,R.am=ha,R.an=function(r){return Math.pow(2,r)},R.ao=Tn,R.ap=Rp,R.aq=function(r){return Math.log(r)/Math.LN2},R.ar=function(r){var e=r[0],i=r[1];return e*e+i*i},R.as=function(r){if(!r.length)return new Set;const e=Math.max(...r.map((g=>g.canonical.z)));let i=1/0,s=-1/0,a=1/0,l=-1/0;const u=[];for(const g of r){const{x:m,y:x,z:_}=g.canonical,T=Math.pow(2,e-_),v=m*T,I=x*T;u.push({id:g,x:v,y:I}),v<i&&(i=v),v>s&&(s=v),I<a&&(a=I),I>l&&(l=I)}const h=new Set;for(const g of u)g.x!==i&&g.x!==s&&g.y!==a&&g.y!==l||h.add(g.id);return h},R.at=function(r,e){const i=Math.abs(2*r.wrap)-+(r.wrap<0),s=Math.abs(2*e.wrap)-+(e.wrap<0);return r.overscaledZ-e.overscaledZ||s-i||e.canonical.y-r.canonical.y||e.canonical.x-r.canonical.x},R.au=class{constructor(r,e){this.max=r,this.onRemove=e,this.reset()}reset(){for(const r in this.data)for(const e of this.data[r])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(r,e,i){const s=r.wrapped().key;this.data[s]===void 0&&(this.data[s]=[]);const a={value:e,timeout:void 0};if(i!==void 0&&(a.timeout=setTimeout((()=>{this.remove(r,a)}),i)),this.data[s].push(a),this.order.push(s),this.order.length>this.max){const l=this._getAndRemoveByKey(this.order[0]);l&&this.onRemove(l)}return this}has(r){return r.wrapped().key in this.data}getAndRemove(r){return this.has(r)?this._getAndRemoveByKey(r.wrapped().key):null}_getAndRemoveByKey(r){const e=this.data[r].shift();return e.timeout&&clearTimeout(e.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),e.value}getByKey(r){const e=this.data[r];return e?e[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,e){if(!this.has(r))return this;const i=r.wrapped().key,s=e===void 0?0:this.data[i].indexOf(e),a=this.data[i][s];return this.data[i].splice(s,1),a.timeout&&clearTimeout(a.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(a.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(r){const e=[];for(const i in this.data)for(const s of this.data[i])r(s.value)||e.push(s);for(const i of e)this.remove(i.value.tileID,i)}},R.av=function(r,e){let i=0,s=0;if(r.kind==="constant")s=r.layoutSize;else if(r.kind!=="source"){const{interpolationType:a,minZoom:l,maxZoom:u}=r,h=a?Si(rt.interpolationFactor(a,e,l,u),0,1):0;r.kind==="camera"?s=Yi.number(r.minSize,r.maxSize,h):i=h}return{uSizeT:i,uSize:s}},R.ax=function(r,{uSize:e,uSizeT:i},{lowerSize:s,upperSize:a}){return r.kind==="source"?s/xn:r.kind==="composite"?Yi.number(s/xn,a/xn,i):e},R.ay=function(r,e){var i=e[0],s=e[1],a=e[2],l=e[3],u=e[4],h=e[5],g=e[6],m=e[7],x=e[8],_=e[9],T=e[10],v=e[11],I=e[12],M=e[13],A=e[14],D=e[15],L=i*h-s*u,k=i*g-a*u,B=i*m-l*u,O=s*g-a*h,U=s*m-l*h,H=a*m-l*g,J=x*M-_*I,ee=x*A-T*I,re=x*D-v*I,ue=_*A-T*M,le=_*D-v*M,ce=T*D-v*A,se=L*ce-k*le+B*ue+O*re-U*ee+H*J;return se?(r[0]=(h*ce-g*le+m*ue)*(se=1/se),r[1]=(a*le-s*ce-l*ue)*se,r[2]=(M*H-A*U+D*O)*se,r[3]=(T*U-_*H-v*O)*se,r[4]=(g*re-u*ce-m*ee)*se,r[5]=(i*ce-a*re+l*ee)*se,r[6]=(A*B-I*H-D*k)*se,r[7]=(x*H-T*B+v*k)*se,r[8]=(u*le-h*re+m*J)*se,r[9]=(s*re-i*le-l*J)*se,r[10]=(I*U-M*B+D*L)*se,r[11]=(_*B-x*U-v*L)*se,r[12]=(h*ee-u*ue-g*J)*se,r[13]=(i*ue-s*ee+a*J)*se,r[14]=(M*k-I*O-A*L)*se,r[15]=(x*O-_*k+T*L)*se,r):null},R.az=Ke,R.b=Mr,R.b$=gn,R.b0=function(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],r},R.b1=function(r,e){var i=e[0],s=e[1],a=e[2],l=i*i+s*s+a*a;return l>0&&(l=1/Math.sqrt(l)),r[0]=e[0]*l,r[1]=e[1]*l,r[2]=e[2]*l,r},R.b2=_e,R.b3=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]},R.b4=function(r,e,i){return r[0]=e[0]*i[0],r[1]=e[1]*i[1],r[2]=e[2]*i[2],r[3]=e[3]*i[3],r},R.b5=We,R.b6=function(r,e,i){const s=e[0]*i[0]+e[1]*i[1]+e[2]*i[2];return s===0?null:(-(r[0]*i[0]+r[1]*i[1]+r[2]*i[2])-i[3])/s},R.b7=Ye,R.b8=function(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[3]=e[3]*i,r},R.b9=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]},R.bA=function(r,e,i){var s=i[0],a=i[1],l=i[2],u=i[3],h=e[0],g=e[1],m=e[2],x=a*m-l*g,_=l*h-s*m,T=s*g-a*h;return r[0]=h+u*(x+=x)+a*(T+=T)-l*(_+=_),r[1]=g+u*_+l*x-s*T,r[2]=m+u*T+s*_-a*x,r},R.bB=function(r,e,i){const s=(a=[r[0],r[1],r[2],e[0],e[1],e[2],i[0],i[1],i[2]])[0]*((x=a[8])*(u=a[4])-(h=a[5])*(m=a[7]))+a[1]*(-x*(l=a[3])+h*(g=a[6]))+a[2]*(m*l-u*g);var a,l,u,h,g,m,x;if(s===0)return null;const _=_e([],[e[0],e[1],e[2]],[i[0],i[1],i[2]]),T=_e([],[i[0],i[1],i[2]],[r[0],r[1],r[2]]),v=_e([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),I=te([],_,-r[3]);return K(I,I,te([],T,-e[3])),K(I,I,te([],v,-i[3])),te(I,I,1/s),I},R.bC=Uh,R.bD=function(){return new Float64Array(4)},R.bE=function(r,e,i,s){var a=[],l=[];return a[0]=e[0]-i[0],a[1]=e[1]-i[1],a[2]=e[2]-i[2],l[0]=a[0]*Math.cos(s)-a[1]*Math.sin(s),l[1]=a[0]*Math.sin(s)+a[1]*Math.cos(s),l[2]=a[2],r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},R.bF=function(r,e,i,s){var a=[],l=[];return a[0]=e[0]-i[0],a[1]=e[1]-i[1],a[2]=e[2]-i[2],l[0]=a[0],l[1]=a[1]*Math.cos(s)-a[2]*Math.sin(s),l[2]=a[1]*Math.sin(s)+a[2]*Math.cos(s),r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},R.bG=function(r,e,i,s){var a=[],l=[];return a[0]=e[0]-i[0],a[1]=e[1]-i[1],a[2]=e[2]-i[2],l[0]=a[2]*Math.sin(s)+a[0]*Math.cos(s),l[1]=a[1],l[2]=a[2]*Math.cos(s)-a[0]*Math.sin(s),r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},R.bH=function(r,e,i){var s=Math.sin(i),a=Math.cos(i),l=e[0],u=e[1],h=e[2],g=e[3],m=e[8],x=e[9],_=e[10],T=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=l*a-m*s,r[1]=u*a-x*s,r[2]=h*a-_*s,r[3]=g*a-T*s,r[8]=l*s+m*a,r[9]=u*s+x*a,r[10]=h*s+_*a,r[11]=g*s+T*a,r},R.bI=function(r,e){const i=hi(r,360),s=hi(e,360),a=s-i,l=s>i?a-360:a+360;return Math.abs(a)<Math.abs(l)?a:l},R.bJ=function(r){return r[0]=0,r[1]=0,r[2]=0,r},R.bK=function(r,e,i,s){const a=Math.sqrt(r*r+e*e),l=Math.sqrt(i*i+s*s);r/=a,e/=a,i/=l,s/=l;const u=Math.acos(r*i+e*s);return-e*i+r*s>0?u:-u},R.bL=function(r,e){const i=hi(r,2*Math.PI),s=hi(e,2*Math.PI);return Math.min(Math.abs(i-s),Math.abs(i-s+2*Math.PI),Math.abs(i-s-2*Math.PI))},R.bM=function(){const r={},e=he.$version;for(const i in he.$root){const s=he.$root[i];if(s.required){let a=null;a=i==="version"?e:s.type==="array"?[]:{},a!=null&&(r[i]=a)}}return r},R.bN=Io,R.bO=_l,R.bP=function r(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let s=0;s<e.length;s++)if(!r(e[s],i[s]))return!1;return!0}if(typeof e=="object"&&e!==null&&i!==null){if(typeof i!="object"||Object.keys(e).length!==Object.keys(i).length)return!1;for(const s in e)if(!r(e[s],i[s]))return!1;return!0}return e===i},R.bQ=function(r){r=r.slice();const e=Object.create(null);for(let i=0;i<r.length;i++)e[r[i].id]=r[i];for(let i=0;i<r.length;i++)"ref"in r[i]&&(r[i]=Eo(r[i],e[r[i].ref]));return r},R.bR=function(r,e){if(r.type==="custom")return new Rg(r,e);switch(r.type){case"background":return new kg(r,e);case"circle":return new Qf(r,e);case"color-relief":return new sm(r,e);case"fill":return new vm(r,e);case"fill-extrusion":return new zm(r,e);case"heatmap":return new tm(r,e);case"hillshade":return new rm(r,e);case"line":return new rg(r,e);case"raster":return new ih(r,e);case"symbol":return new gu(r,e)}},R.bS=r=>r.type==="raster",R.bT=$e,R.bU=function(r,e){if(!r)return[{command:"setStyle",args:[e]}];let i=[];try{if(!tt(r.version,e.version))return[{command:"setStyle",args:[e]}];tt(r.center,e.center)||i.push({command:"setCenter",args:[e.center]}),tt(r.state,e.state)||i.push({command:"setGlobalState",args:[e.state]}),tt(r.centerAltitude,e.centerAltitude)||i.push({command:"setCenterAltitude",args:[e.centerAltitude]}),tt(r.zoom,e.zoom)||i.push({command:"setZoom",args:[e.zoom]}),tt(r.bearing,e.bearing)||i.push({command:"setBearing",args:[e.bearing]}),tt(r.pitch,e.pitch)||i.push({command:"setPitch",args:[e.pitch]}),tt(r.roll,e.roll)||i.push({command:"setRoll",args:[e.roll]}),tt(r.sprite,e.sprite)||i.push({command:"setSprite",args:[e.sprite]}),tt(r.glyphs,e.glyphs)||i.push({command:"setGlyphs",args:[e.glyphs]}),tt(r.transition,e.transition)||i.push({command:"setTransition",args:[e.transition]}),tt(r.light,e.light)||i.push({command:"setLight",args:[e.light]}),tt(r.terrain,e.terrain)||i.push({command:"setTerrain",args:[e.terrain]}),tt(r.sky,e.sky)||i.push({command:"setSky",args:[e.sky]}),tt(r.projection,e.projection)||i.push({command:"setProjection",args:[e.projection]});const s={},a=[];(function(u,h,g,m){let x;for(x in h=h||{},u=u||{})Object.prototype.hasOwnProperty.call(u,x)&&(Object.prototype.hasOwnProperty.call(h,x)||Jl(x,g,m));for(x in h)Object.prototype.hasOwnProperty.call(h,x)&&(Object.prototype.hasOwnProperty.call(u,x)?tt(u[x],h[x])||(u[x].type==="geojson"&&h[x].type==="geojson"&&Eu(u,h,x)?yi(g,{command:"setGeoJSONSourceData",args:[x,h[x].data]}):Ql(x,h,g,m)):Kr(x,h,g))})(r.sources,e.sources,a,s);const l=[];r.layers&&r.layers.forEach((u=>{"source"in u&&s[u.source]?i.push({command:"removeLayer",args:[u.id]}):l.push(u)})),i=i.concat(a),(function(u,h,g){h=h||[];const m=(u=u||[]).map(Co),x=h.map(Co),_=u.reduce(ec,{}),T=h.reduce(ec,{}),v=m.slice(),I=Object.create(null);let M,A,D,L,k;for(let B=0,O=0;B<m.length;B++)M=m[B],Object.prototype.hasOwnProperty.call(T,M)?O++:(yi(g,{command:"removeLayer",args:[M]}),v.splice(v.indexOf(M,O),1));for(let B=0,O=0;B<x.length;B++)M=x[x.length-1-B],v[v.length-1-B]!==M&&(Object.prototype.hasOwnProperty.call(_,M)?(yi(g,{command:"removeLayer",args:[M]}),v.splice(v.lastIndexOf(M,v.length-O),1)):O++,L=v[v.length-B],yi(g,{command:"addLayer",args:[T[M],L]}),v.splice(v.length-B,0,M),I[M]=!0);for(let B=0;B<x.length;B++)if(M=x[B],A=_[M],D=T[M],!I[M]&&!tt(A,D))if(tt(A.source,D.source)&&tt(A["source-layer"],D["source-layer"])&&tt(A.type,D.type)){for(k in ma(A.layout,D.layout,g,M,null,"setLayoutProperty"),ma(A.paint,D.paint,g,M,null,"setPaintProperty"),tt(A.filter,D.filter)||yi(g,{command:"setFilter",args:[M,D.filter]}),tt(A.minzoom,D.minzoom)&&tt(A.maxzoom,D.maxzoom)||yi(g,{command:"setLayerZoomRange",args:[M,D.minzoom,D.maxzoom]}),A)Object.prototype.hasOwnProperty.call(A,k)&&k!=="layout"&&k!=="paint"&&k!=="filter"&&k!=="metadata"&&k!=="minzoom"&&k!=="maxzoom"&&(k.indexOf("paint.")===0?ma(A[k],D[k],g,M,k.slice(6),"setPaintProperty"):tt(A[k],D[k])||yi(g,{command:"setLayerProperty",args:[M,k,D[k]]}));for(k in D)Object.prototype.hasOwnProperty.call(D,k)&&!Object.prototype.hasOwnProperty.call(A,k)&&k!=="layout"&&k!=="paint"&&k!=="filter"&&k!=="metadata"&&k!=="minzoom"&&k!=="maxzoom"&&(k.indexOf("paint.")===0?ma(A[k],D[k],g,M,k.slice(6),"setPaintProperty"):tt(A[k],D[k])||yi(g,{command:"setLayerProperty",args:[M,k,D[k]]}))}else yi(g,{command:"removeLayer",args:[M]}),L=v[v.lastIndexOf(M)+1],yi(g,{command:"addLayer",args:[D,L]})})(l,e.layers,i)}catch(s){console.warn("Unable to compute style diff:",s),i=[{command:"setStyle",args:[e]}]}return i},R.bV=function(r){const e=[],i=r.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},R.bW=Ir,R.bX=xt,R.bY=class extends Gi{constructor(r,e){super(r,e),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},R.bZ=Ai,R.b_=class extends Gi{constructor(r,e){super(r,e),this.current=jr}set(r){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let e=1;e<16;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},R.ba=Op,R.bb=oo,R.bc=function(r,e,i,s,a){var l=1/Math.tan(e/2);if(r[0]=l/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,a!=null&&a!==1/0){var u=1/(s-a);r[10]=(a+s)*u,r[14]=2*a*s*u}else r[10]=-1,r[14]=-2*s;return r},R.bd=function(r){var e=new It(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e},R.be=function(r,e,i){var s=Math.sin(i),a=Math.cos(i),l=e[0],u=e[1],h=e[2],g=e[3],m=e[4],x=e[5],_=e[6],T=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=l*a+m*s,r[1]=u*a+x*s,r[2]=h*a+_*s,r[3]=g*a+T*s,r[4]=m*a-l*s,r[5]=x*a-u*s,r[6]=_*a-h*s,r[7]=T*a-g*s,r},R.bf=function(r,e,i){var s=Math.sin(i),a=Math.cos(i),l=e[4],u=e[5],h=e[6],g=e[7],m=e[8],x=e[9],_=e[10],T=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=l*a+m*s,r[5]=u*a+x*s,r[6]=h*a+_*s,r[7]=g*a+T*s,r[8]=m*a-l*s,r[9]=x*a-u*s,r[10]=_*a-h*s,r[11]=T*a-g*s,r},R.bg=function(){const r=new Float32Array(16);return Tn(r),r},R.bh=function(){const r=new Float64Array(16);return Tn(r),r},R.bi=function(){return new Float64Array(16)},R.bj=function(r,e,i){const s=new Float64Array(4);return Le(s,r,e-90,i),s},R.bk=function(r,e,i,s){var a,l,u,h,g,m=e[0],x=e[1],_=e[2],T=e[3],v=i[0],I=i[1],M=i[2],A=i[3];return(l=m*v+x*I+_*M+T*A)<0&&(l=-l,v=-v,I=-I,M=-M,A=-A),1-l>Bt?(a=Math.acos(l),u=Math.sin(a),h=Math.sin((1-s)*a)/u,g=Math.sin(s*a)/u):(h=1-s,g=s),r[0]=h*m+g*v,r[1]=h*x+g*I,r[2]=h*_+g*M,r[3]=h*T+g*A,r},R.bl=function(r){const e=new Float64Array(9);var i,s,a,l,u,h,g,m,x,_,T,v,I,M,A,D,L,k;_=(a=(s=r)[0])*(g=a+a),T=(l=s[1])*g,I=(u=s[2])*g,M=u*(m=l+l),D=(h=s[3])*g,L=h*m,k=h*(x=u+u),(i=e)[0]=1-(v=l*m)-(A=u*x),i[3]=T-k,i[6]=I+L,i[1]=T+k,i[4]=1-_-A,i[7]=M-D,i[2]=I-L,i[5]=M+D,i[8]=1-_-v;const B=Xr(-Math.asin(Si(e[2],-1,1)));let O,U;return Math.hypot(e[5],e[8])<.001?(O=0,U=-Xr(Math.atan2(e[3],e[4]))):(O=Xr(e[5]===0&&e[8]===0?0:Math.atan2(e[5],e[8])),U=Xr(e[1]===0&&e[0]===0?0:Math.atan2(e[1],e[0]))),{roll:O,pitch:B+90,bearing:U}},R.bm=function(r,e){return r.roll==e.roll&&r.pitch==e.pitch&&r.bearing==e.bearing},R.bn=Ne,R.bo=mn,R.bp=eo,R.bq=Ol,R.br=Qa,R.bs=Pr,R.bt=Wr,R.bu=ri,R.bv=function(r,e,i,s,a){return Pr(s,a,Si((r-e)/(i-e),0,1))},R.bw=function(r,e,i,s){return r[0]=e[0]+i[0]*s,r[1]=e[1]+i[1]*s,r[2]=e[2]+i[2]*s,r},R.bx=hi,R.by=function(){return new Float64Array(3)},R.bz=Le,R.c=Cr,R.c$=class{constructor(r,e){this.layers={[Xl]:this},this.name=Xl,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=r.length,this.features=r}feature(r){return new l_(this.features[r],this.extent)}},R.c0=class extends Gi{constructor(r,e){super(r,e),this.current=[0,0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2]))}},R.c1=class extends Gi{constructor(r,e){super(r,e),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},R.c2=os,R.c3=function(r,e){var i=Math.sin(e),s=Math.cos(e);return r[0]=s,r[1]=i,r[2]=0,r[3]=-i,r[4]=s,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},R.c4=function(r,e,i){var s=e[0],a=e[1],l=e[2];return r[0]=s*i[0]+a*i[3]+l*i[6],r[1]=s*i[1]+a*i[4]+l*i[7],r[2]=s*i[2]+a*i[5]+l*i[8],r},R.c5=function(r,e,i,s,a,l,u){var h=1/(e-i),g=1/(s-a),m=1/(l-u);return r[0]=-2*h,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*g,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*m,r[11]=0,r[12]=(e+i)*h,r[13]=(a+s)*g,r[14]=(u+l)*m,r[15]=1,r},R.c6=class extends Gi{constructor(r,e){super(r,e),this.current=new Array}set(r){if(r!=this.current){this.current=r;const e=new Float32Array(4*r.length);for(let i=0;i<r.length;i++)e[4*i]=r[i].r,e[4*i+1]=r[i].g,e[4*i+2]=r[i].b,e[4*i+3]=r[i].a;this.gl.uniform4fv(this.location,e)}}},R.c7=class extends Gi{constructor(r,e){super(r,e),this.current=new Array}set(r){if(r!=this.current){this.current=r;const e=new Float32Array(r);this.gl.uniform1fv(this.location,e)}}},R.c8=class extends El{},R.c9=og,R.cA=function(r,e,i){var s=e[0],a=e[1];return r[0]=i[0]*s+i[4]*a+i[12],r[1]=i[1]*s+i[5]*a+i[13],r},R.cB=function(r,e){const{x:i,y:s}=Zl.fromLngLat(e);return!(r<0||r>25||s<0||s>=1||i<0||i>=1)},R.cC=function(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},R.cD=class extends Qs{},R.cE=P_,R.cG=En,R.cH=function(r,e){Cr.REGISTERED_PROTOCOLS[r]=e},R.cI=function(r){delete Cr.REGISTERED_PROTOCOLS[r]},R.cJ=function(r,e){const i={};for(let a=0;a<r.length;a++){const l=e&&e[r[a].id]||Hu(r[a]);e&&(e[r[a].id]=l);let u=i[l];u||(u=i[l]=[]),u.push(r[a])}const s=[];for(const a in i)s.push(i[a]);return s},R.cK=Se,R.cL=Vp,R.cM=yf,R.cN=bp,R.cO=function(r){var e;r.bucket.createArrays(),r.bucket.tilePixelRatio=Re/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const i=r.bucket.layers[0],s=i.layout,a=i._unevaluatedLayout._values,l={layoutIconSize:a["icon-size"].possiblyEvaluate(new nt(r.bucket.zoom+1),r.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new nt(r.bucket.zoom+1),r.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new nt(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:x,maxZoom:_}=r.bucket.textSizeData;l.compositeTextSizes=[a["text-size"].possiblyEvaluate(new nt(x),r.canonical),a["text-size"].possiblyEvaluate(new nt(_),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:x,maxZoom:_}=r.bucket.iconSizeData;l.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new nt(x),r.canonical),a["icon-size"].possiblyEvaluate(new nt(_),r.canonical)]}const u=s.get("text-line-height")*qt,h=s.get("text-rotation-alignment")!=="viewport"&&s.get("symbol-placement")!=="point",g=s.get("text-keep-upright"),m=s.get("text-size");for(const x of r.bucket.features){const _=s.get("text-font").evaluate(x,{},r.canonical).join(","),T=m.evaluate(x,{},r.canonical),v=l.layoutTextSize.evaluate(x,{},r.canonical),I=l.layoutIconSize.evaluate(x,{},r.canonical),M={horizontal:{},vertical:void 0},A=x.text;let D,L=[0,0];if(A){const O=A.toString(),U=s.get("text-letter-spacing").evaluate(x,{},r.canonical)*qt,H=$a(O)?U:0,J=s.get("text-anchor").evaluate(x,{},r.canonical),ee=Df(i,x,r.canonical);if(!ee){const ce=s.get("text-radial-offset").evaluate(x,{},r.canonical);L=ce?Af(J,[ce*qt,cd]):s.get("text-offset").evaluate(x,{},r.canonical).map((se=>se*qt))}let re=h?"center":s.get("text-justify").evaluate(x,{},r.canonical);const ue=s.get("symbol-placement")==="point"?s.get("text-max-width").evaluate(x,{},r.canonical)*qt:1/0,le=()=>{r.bucket.allowVerticalPlacement&&qs(O)&&(M.vertical=fu(A,r.glyphMap,r.glyphPositions,r.imagePositions,_,ue,u,J,"left",H,L,R.aw.vertical,!0,v,T))};if(!h&&ee){const ce=new Set;if(re==="auto")for(let ye=0;ye<ee.values.length;ye+=2)ce.add(ud(ee.values[ye]));else ce.add(re);let se=!1;for(const ye of ce)if(!M.horizontal[ye])if(se)M.horizontal[ye]=M.horizontal[0];else{const Te=fu(A,r.glyphMap,r.glyphPositions,r.imagePositions,_,ue,u,"center",ye,H,L,R.aw.horizontal,!1,v,T);Te&&(M.horizontal[ye]=Te,se=Te.positionedLines.length===1)}le()}else{re==="auto"&&(re=ud(J));const ce=fu(A,r.glyphMap,r.glyphPositions,r.imagePositions,_,ue,u,J,re,H,L,R.aw.horizontal,!1,v,T);ce&&(M.horizontal[re]=ce),le(),qs(O)&&h&&g&&(M.vertical=fu(A,r.glyphMap,r.glyphPositions,r.imagePositions,_,ue,u,J,re,H,L,R.aw.vertical,!1,v,T))}}let k=!1;if(x.icon&&x.icon.name){const O=r.imageMap[x.icon.name];O&&(D=Cg(r.imagePositions[x.icon.name],s.get("icon-offset").evaluate(x,{},r.canonical),s.get("icon-anchor").evaluate(x,{},r.canonical)),k=!!O.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=k:r.bucket.sdfIcons!==k&&Ut("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(O.pixelRatio!==r.bucket.pixelRatio||s.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}const B=kf(M.horizontal)||M.vertical;(e=r.bucket).iconsInText||(e.iconsInText=!!B&&B.iconsInText),(B||D)&&T_(r.bucket,x,M,D,r.imageMap,l,v,I,L,k,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},R.cP=mh,R.cQ=_h,R.cR=kh,R.cS=function(r,e=""){const i=new pu;return(function(s,a,l=""){for(const u in s.layers)a.writeMessage(3,((h,g)=>c_(h,g,l)),s.layers[u])})(r,i,e),i.finish()},R.cT=function(r,e,i,s,a,l){let u=bf(r,e,i,a,0);return u=bf(u,e,s,l,1),u},R.cU=class{constructor(r){this.maxEntries=r,this.map=new Map}get(r){const e=this.map.get(r);return e!==void 0&&(this.map.delete(r),this.map.set(r,e)),e}set(r,e){if(this.map.has(r))this.map.delete(r);else if(this.map.size>=this.maxEntries){const i=this.map.keys().next().value;this.map.delete(i)}this.map.set(r,e)}clear(){this.map.clear()}},R.cV=$d,R.cW=pu,R.cX=gf,R.cY=class{constructor(r){this.start=`${r}#start`,this.end=`${r}#end`,this.measure=r,performance.mark(this.start)}finish(){performance.mark(this.end);let r=performance.getEntriesByName(this.measure);return r.length===0&&(performance.measure(this.measure,this.start,this.end),r=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),r}},R.cZ=function(r,e,i,s,a){return d(this,void 0,void 0,(function*(){if(Ti())try{return yield hs(r,e,i,s,a)}catch{}return(function(l,u,h,g,m){const x=l.width,_=l.height;In&&Mn||(In=new OffscreenCanvas(x,_),Mn=In.getContext("2d",{willReadFrequently:!0})),In.width=x,In.height=_,Mn.drawImage(l,0,0,x,_);const T=Mn.getImageData(u,h,g,m);return Mn.clearRect(0,0,x,_),T.data})(r,e,i,s,a)}))},R.c_=zd,R.ca=class extends Or{},R.cb=uh,R.cc=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},R.cd=Ed,R.ce=function(r,e,i){var s=e[0],a=e[1],l=e[2],u=i[3]*s+i[7]*a+i[11]*l+i[15];return r[0]=(i[0]*s+i[4]*a+i[8]*l+i[12])/(u=u||1),r[1]=(i[1]*s+i[5]*a+i[9]*l+i[13])/u,r[2]=(i[2]*s+i[6]*a+i[10]*l+i[14])/u,r},R.cf=class extends Za{},R.cg=class extends n{},R.ch=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]&&r[9]===e[9]&&r[10]===e[10]&&r[11]===e[11]&&r[12]===e[12]&&r[13]===e[13]&&r[14]===e[14]&&r[15]===e[15]},R.ci=function(r,e){var i=r[0],s=r[1],a=r[2],l=r[3],u=r[4],h=r[5],g=r[6],m=r[7],x=r[8],_=r[9],T=r[10],v=r[11],I=r[12],M=r[13],A=r[14],D=r[15],L=e[0],k=e[1],B=e[2],O=e[3],U=e[4],H=e[5],J=e[6],ee=e[7],re=e[8],ue=e[9],le=e[10],ce=e[11],se=e[12],ye=e[13],Te=e[14],be=e[15];return Math.abs(i-L)<=Bt*Math.max(1,Math.abs(i),Math.abs(L))&&Math.abs(s-k)<=Bt*Math.max(1,Math.abs(s),Math.abs(k))&&Math.abs(a-B)<=Bt*Math.max(1,Math.abs(a),Math.abs(B))&&Math.abs(l-O)<=Bt*Math.max(1,Math.abs(l),Math.abs(O))&&Math.abs(u-U)<=Bt*Math.max(1,Math.abs(u),Math.abs(U))&&Math.abs(h-H)<=Bt*Math.max(1,Math.abs(h),Math.abs(H))&&Math.abs(g-J)<=Bt*Math.max(1,Math.abs(g),Math.abs(J))&&Math.abs(m-ee)<=Bt*Math.max(1,Math.abs(m),Math.abs(ee))&&Math.abs(x-re)<=Bt*Math.max(1,Math.abs(x),Math.abs(re))&&Math.abs(_-ue)<=Bt*Math.max(1,Math.abs(_),Math.abs(ue))&&Math.abs(T-le)<=Bt*Math.max(1,Math.abs(T),Math.abs(le))&&Math.abs(v-ce)<=Bt*Math.max(1,Math.abs(v),Math.abs(ce))&&Math.abs(I-se)<=Bt*Math.max(1,Math.abs(I),Math.abs(se))&&Math.abs(M-ye)<=Bt*Math.max(1,Math.abs(M),Math.abs(ye))&&Math.abs(A-Te)<=Bt*Math.max(1,Math.abs(A),Math.abs(Te))&&Math.abs(D-be)<=Bt*Math.max(1,Math.abs(D),Math.abs(be))},R.cj=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},R.ck=r=>r.type==="circle",R.cl=r=>r.type==="heatmap",R.cm=r=>r.type==="line",R.cn=r=>r.type==="fill",R.co=r=>r.type==="fill-extrusion",R.cp=r=>r.type==="hillshade",R.cq=r=>r.type==="color-relief",R.cr=r=>r.type==="background",R.cs=r=>r.type==="custom",R.ct=Sn,R.cu=function(r,e,i){if(e<=0)return r;const s=1/e;return i===void 0||Math.abs(i)<1e-10?Math.round(r*s)/s:(i>0?Math.ceil(r*s-1e-9):Math.floor(r*s+1e-10))/s},R.cv=function(r,e,i){const s=Xe(e.x-i.x,e.y-i.y),a=Xe(r.x-i.x,r.y-i.y);var l,u;return Xr(Math.atan2(s[0]*a[1]-s[1]*a[0],(l=s)[0]*(u=a)[0]+l[1]*u[1]))},R.cw=cs,R.cx=function(r,e){var i;if(!Po[e])return!1;const s=r?.target,a=((i=s?.ownerDocument)===null||i===void 0?void 0:i.defaultView)||window;return r instanceof a.MouseEvent||r instanceof a.WheelEvent},R.cy=function(r,e){return So[e]&&"touches"in r},R.cz=function(r){return So[r]||Po[r]},R.d=Xi,R.d0=Ds,R.d1=class{get tiles(){return this.tileIndex?.tiles??{}}get stats(){return this.tileIndex.stats}get total(){return this.tileIndex.total}constructor(r,e){const i=(e=this.options=Object.assign({},Ym,e)).debug;if(i&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");let s=bh(r,e);i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles")),s=Ih(s,e),e.updateable&&(this.source=s),this.initializeIndex(s,e)}initializeIndex(r,e){this.tileIndex=e.cluster?new Gm(e.clusterOptions):new Hm(e),r.length&&this.tileIndex.initialize(r)}getTile(r,e,i){return e=+e,i=+i,(r=+r)<0||r>24?null:this.tileIndex.getTile(r,e,i)}updateData(r,e){const i=this.options;if(!i.updateable)throw new Error("to update tile geojson `updateable` option must be set to true");let{affected:s,source:a}=(function(l,u,h){const g=(function(x){return x?{removeAll:x.removeAll,remove:new Set(x.remove||[]),add:new Map(x.add?.map((_=>[_.id,_]))),update:new Map(x.update?.map((_=>[_.id,_])))}:{remove:new Set,add:new Map,update:new Map}})(u);let m=[];if(g.removeAll&&(m=l,l=[]),g.remove.size||g.add.size){const x=[];for(const _ of l)(g.remove.has(_.id)||g.add.has(_.id))&&x.push(_);if(x.length){m.push(...x);const _=new Set(x.map((T=>T.id)));l=l.filter((T=>!_.has(T.id)))}if(g.add.size){let _=bh({type:"FeatureCollection",features:Array.from(g.add.values())},h);_=Ih(_,h),m.push(..._),l.push(..._)}}if(g.update.size)for(const[x,_]of g.update){const T=[],v=[];for(const M of l)M.id===x?T.push(M):v.push(M);if(!T.length)continue;const I=Um(T,_,h);I.length&&(m.push(...T,...I),v.push(...I),l=v)}return{affected:m,source:l}})(this.source,r,i);e&&({affected:s,source:a}=this.filterUpdate(a,s,e)),s.length&&(this.source=a,this.tileIndex.updateIndex(a,s,i))}filterUpdate(r,e,i){const s=new Set;for(const a of r)a.id!=null&&(i(uu(a))||(e.push(a),s.add(a.id)));return{affected:e,source:r=r.filter((a=>!s.has(a.id)))}}getData(){if(!this.options.updateable)throw new Error("to retrieve data the `updateable` option must be set to true");return{type:"FeatureCollection",features:this.source.map((r=>uu(r)))}}updateClusterOptions(r,e){const i=this.options.cluster;this.options.cluster=r,this.options.clusterOptions=e,i!=r?this.initializeIndex(this.source,this.options):this.tileIndex.updateIndex(this.source,[],this.options)}getClusterExpansionZoom(r){return this.tileIndex.getClusterExpansionZoom(r)}getClusterChildren(r){return this.tileIndex.getChildren(r)}getClusterLeaves(r,e,i){return this.tileIndex.getLeaves(r,e,i)}},R.d2=Br,R.e=Ri,R.f=r=>d(void 0,void 0,void 0,(function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(e)}catch(i){throw new Error(`Could not load image because of ${i.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),R.g=or,R.h=r=>new Promise(((e,i)=>{const s=new Image;s.onload=()=>{e(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame((()=>{s.src=To}))},s.onerror=()=>i(new 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."));const a=new Blob([new Uint8Array(r)],{type:"image/png"});s.src=r.byteLength?URL.createObjectURL(a):To})),R.i=Gt,R.j=(r,e)=>Hr(Ri(r,{type:"json"}),e),R.k=pa,R.l=ps,R.m=Hr,R.n=(r,e)=>Hr(Ri(r,{type:"arrayBuffer"}),e),R.o=function(r){return new pu(r).readFields(bg,[])},R.p=vp,R.q=function(r){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(r))},R.r=kl,R.s=Er,R.t=ni,R.u=he,R.v=Us,R.w=Ut,R.x=$c,R.y=Yu,R.z=Ws})),Zr("worker",["./shared"],(function(R){class d{constructor(X,K){this.keyCache={},X&&this.replace(X,K)}replace(X,K){this._layerConfigs={},this._layers={},this.update(X,[],K)}update(X,K,te){for(const Ee of X){this._layerConfigs[Ee.id]=Ee;const Ye=this._layers[Ee.id]=R.bR(Ee,te);Ye._featureFilter=R.ag(Ye.filter,te),this.keyCache[Ee.id]&&delete this.keyCache[Ee.id]}for(const Ee of K)delete this.keyCache[Ee],delete this._layerConfigs[Ee],delete this._layers[Ee];this.familiesBySource={};const _e=R.cJ(Object.values(this._layerConfigs),this.keyCache);for(const Ee of _e){const Ye=Ee.map((Re=>this._layers[Re.id])),ze=Ye[0];if(ze.isHidden())continue;const Ge=ze.source||"";let Le=this.familiesBySource[Ge];Le||(Le=this.familiesBySource[Ge]={});const Ke=ze.sourceLayer||R.af;let Xe=Le[Ke];Xe||(Xe=Le[Ke]=[]),Xe.push(Ye)}}}class we{constructor(X){const K={},te=[];for(const ze in X){const Ge=X[ze],Le=K[ze]={};for(const Ke in Ge){const Xe=Ge[+Ke];if(!Xe||Xe.bitmap.width===0||Xe.bitmap.height===0)continue;const Re={x:0,y:0,w:Xe.bitmap.width+2,h:Xe.bitmap.height+2};te.push(Re),Le[Ke]={rect:Re,metrics:Xe.metrics}}}const{w:_e,h:Ee}=R.p(te),Ye=new R.r({width:_e||1,height:Ee||1});for(const ze in X){const Ge=X[ze];for(const Le in Ge){const Ke=Ge[+Le];if(!Ke||Ke.bitmap.width===0||Ke.bitmap.height===0)continue;const Xe=K[ze][Le].rect;R.r.copy(Ke.bitmap,Ye,{x:0,y:0},{x:Xe.x+1,y:Xe.y+1},Ke.bitmap)}}this.image=Ye,this.positions=K}}R.cK("GlyphAtlas",we);class Tr{constructor(X){this.tileID=new R.a2(X.tileID.overscaledZ,X.tileID.wrap,X.tileID.canonical.z,X.tileID.canonical.x,X.tileID.canonical.y),this.uid=X.uid,this.zoom=X.zoom,this.pixelRatio=X.pixelRatio,this.tileSize=X.tileSize,this.source=X.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=X.showCollisionBoxes,this.collectResourceTiming=!!X.collectResourceTiming,this.returnDependencies=!!X.returnDependencies,this.promoteId=X.promoteId,this.inFlightDependencies=[]}parse(X,K,te,_e,Ee){return R._(this,void 0,void 0,(function*(){this.status="parsing",this.data=X,this.collisionBoxArray=new R.ad;const Ye=new R.cL(Object.keys(X.layers).sort()),ze=new R.cM(this.tileID,this.promoteId);ze.bucketLayerIDs=[];const Ge={},Le={featureIndex:ze,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:te,subdivisionGranularity:Ee},Ke=K.familiesBySource[this.source];for(const $e in Ke){const Nt=X.layers[$e];if(!Nt)continue;Nt.version===1&&R.w(`Vector tile source "${this.source}" layer "${$e}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ut=Ye.encode($e),Fi=[];for(let Gt=0;Gt<Nt.length;Gt++){const Li=Nt.feature(Gt),Mr=ze.getId(Li,$e);Fi.push({feature:Li,id:Mr,index:Gt,sourceLayerIndex:Ut})}for(const Gt of Ke[$e]){const Li=Gt[0];Li.source!==this.source&&R.w(`layer.source = ${Li.source} does not equal this.source = ${this.source}`),Li.isHidden(this.zoom,!0)||(wi(Gt,this.zoom,te),(Ge[Li.id]=Li.createBucket({index:ze.bucketLayerIDs.length,layers:Gt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ut,sourceID:this.source})).populate(Fi,Le,this.tileID.canonical),ze.bucketLayerIDs.push(Gt.map((Mr=>Mr.id))))}}const Xe=R.bW(Le.glyphDependencies,($e=>Object.keys($e).map(Number)));this.inFlightDependencies.forEach(($e=>$e?.abort())),this.inFlightDependencies=[];let Re=Promise.resolve({});if(Object.keys(Xe).length){const $e=new AbortController;this.inFlightDependencies.push($e),Re=_e.sendAsync({type:"GG",data:{stacks:Xe,source:this.source,tileID:this.tileID,type:"glyphs"}},$e)}const Jt=Object.keys(Le.iconDependencies);let hi=Promise.resolve({});if(Jt.length){const $e=new AbortController;this.inFlightDependencies.push($e),hi=_e.sendAsync({type:"GI",data:{icons:Jt,source:this.source,tileID:this.tileID,type:"icons"}},$e)}const Pr=Object.keys(Le.patternDependencies);let Wr=Promise.resolve({});if(Pr.length){const $e=new AbortController;this.inFlightDependencies.push($e),Wr=_e.sendAsync({type:"GI",data:{icons:Pr,source:this.source,tileID:this.tileID,type:"patterns"}},$e)}const Sn=Le.dashDependencies;let cs=Promise.resolve({});if(Object.keys(Sn).length){const $e=new AbortController;this.inFlightDependencies.push($e),cs=_e.sendAsync({type:"GDA",data:{dashes:Sn}},$e)}const[Si,Pn,Ri,us]=yield Promise.all([Re,hi,Wr,cs]),Ir=new we(Si),xt=new R.cN(Pn,Ri);for(const $e in Ge){const Nt=Ge[$e];Nt instanceof R.ae?(wi(Nt.layers,this.zoom,te),R.cO({bucket:Nt,glyphMap:Si,glyphPositions:Ir.positions,imageMap:Pn,imagePositions:xt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:Le.subdivisionGranularity})):Nt.hasDependencies&&(Nt instanceof R.cP||Nt instanceof R.cQ||Nt instanceof R.cR)&&(wi(Nt.layers,this.zoom,te),Nt.addFeatures(Le,this.tileID.canonical,xt.patternPositions,us))}return this.status="done",{buckets:Object.values(Ge).filter(($e=>!$e.isEmpty())),featureIndex:ze,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Ir.image,imageAtlas:xt,dashPositions:us,glyphMap:this.returnDependencies?Si:null,iconMap:this.returnDependencies?Pn:null,glyphPositions:this.returnDependencies?Ir.positions:null}}))}}function wi(We,X,K){const te=new R.H(X);for(const _e of We)_e.recalculate(te,K)}class qr{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(X,K){this.loading[X]=K}finishLoading(X){delete this.loading[X]}abort(X){const K=this.loading[X];K?.abort&&(K.abort.abort(),delete this.loading[X])}setParsing(X,K){this.parsing[X]=K}consumeParsing(X){const K=this.parsing[X];if(K)return delete this.parsing[X],K}clearParsing(X){delete this.parsing[X]}markLoaded(X,K){this.loaded[X]=K}getLoaded(X){const K=this.loaded[X];if(K)return K}removeLoaded(X){delete this.loaded[X]}clearLoaded(){this.loaded={}}}class as{constructor(X,K,te,_e,Ee){this.type=X,this.properties=te||{},this.extent=Ee,this.pointsArray=K,this.id=_e}loadGeometry(){return this.pointsArray.map((X=>X.map((K=>new R.P(K.x,K.y)))))}}class Kt{constructor(X,K,te){this.version=2,this._myFeatures=X,this.name=K,this.length=X.length,this.extent=te}feature(X){return this._myFeatures[X]}}class Sr{constructor(){this.layers={}}addLayer(X){this.layers[X.name]=X}}function Ze(We){let X=R.cS(We);return X.byteOffset===0&&X.byteLength===X.buffer.byteLength||(X=new Uint8Array(X)),{vectorTile:We,rawData:X.buffer}}function ge(We,X,K){const{extent:te}=We,_e=Math.pow(2,K.z-X.z),Ee=(K.x-X.x*_e)*te,Ye=(K.y-X.y*_e)*te,ze=[];for(let Ge=0;Ge<We.length;Ge++){const Le=We.feature(Ge);let Ke=Le.loadGeometry();for(const Re of Ke)for(const Jt of Re)Jt.x=Jt.x*_e-Ee,Jt.y=Jt.y*_e-Ye;const Xe=128;Ke=R.cT(Ke,Le.type,-Xe,-Xe,te+Xe,te+Xe),Ke.length!==0&&ze.push(new as(Le.type,Ke,Le.properties,Le.id,te))}return new Kt(ze,We.name,te)}class Ti{constructor(X,K,te){this.actor=X,this.layerIndex=K,this.availableImages=te,this.tileState=new qr,this.overzoomedTileResultCache=new R.cU(1e3)}loadVectorTile(X,K){try{return{vectorTile:X.encoding!=="mlt"?new R.cV(new R.cW(K)):new R.cX(K),rawData:K}}catch(te){const _e=new Uint8Array(K);let Ee=`Unable to parse the tile at ${X.request.url}, `;throw Ee+=_e[0]===31&&_e[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${te.message}`,new Error(Ee)}}loadTile(X){return R._(this,void 0,void 0,(function*(){const{uid:K,overzoomParameters:te}=X;te&&(X.request=te.overzoomRequest);const _e=this._startRequestTiming(X),Ee=new Tr(X);this.tileState.startLoading(K,Ee);const Ye=new AbortController;Ee.abort=Ye;try{const ze=yield R.n(X.request,Ye);if(X.etag&&X.etag===ze.etag)return this.tileState.finishLoading(K),this._getEtagUnmodifiedResult(ze,_e);const Ge=this.loadVectorTile(X,ze.data);if(this.tileState.finishLoading(K),!Ge)return null;let{vectorTile:Le,rawData:Ke}=Ge;te&&({vectorTile:Le,rawData:Ke}=this._getOverzoomTile(X,Le));const Xe=this._getExpiryData(ze),Re=this._finishRequestTiming(_e);Ee.vectorTile=Le,this.tileState.markLoaded(K,Ee);const Jt={rawData:Ke,cacheControl:Xe,resourceTiming:Re};this.tileState.setParsing(K,Jt);try{return yield this._parseWorkerTile(Ee,X,Jt)}finally{this.tileState.clearParsing(K)}}catch(ze){throw this.tileState.finishLoading(K),Ee.status="done",this.tileState.markLoaded(K,Ee),ze}}))}_getEtagUnmodifiedResult(X,K){const te=this._getExpiryData(X),_e=this._finishRequestTiming(K);return R.e({etagUnmodified:!0},te,_e)}_parseWorkerTile(X,K,te){return R._(this,void 0,void 0,(function*(){let _e=yield X.parse(X.vectorTile,this.layerIndex,this.availableImages,this.actor,K.subdivisionGranularity);if(te){const{rawData:Ee,cacheControl:Ye,resourceTiming:ze}=te;_e=R.e({rawTileData:Ee.slice(0),encoding:K.encoding},_e,Ye,ze)}return _e}))}_getExpiryData({expires:X,cacheControl:K,etag:te}){const _e={};return X&&(_e.expires=X),K&&(_e.cacheControl=K),te&&(_e.etag=te),_e}_startRequestTiming(X){var K;if(!((K=X.request)===null||K===void 0)&&K.collectResourceTiming)return new R.cY(X.request.url)}_finishRequestTiming(X){const K=X?.finish();return K?{resourceTiming:JSON.parse(JSON.stringify(K))}:{}}_getOverzoomTile(X,K){const{tileID:te,source:_e,overzoomParameters:Ee}=X,{maxZoomTileID:Ye}=Ee,ze=`${Ye.key}_${te.key}`,Ge=this.overzoomedTileResultCache.get(ze);if(Ge)return Ge;const Le=new Sr,Ke=this.layerIndex.familiesBySource[_e];for(const Re in Ke){const Jt=K.layers[Re];if(!Jt)continue;const hi=ge(Jt,Ye,te.canonical);hi.length>0&&Le.addLayer(hi)}const Xe=Ze(Le);return this.overzoomedTileResultCache.set(ze,Xe),Xe}reloadTile(X){return R._(this,void 0,void 0,(function*(){const K=X.uid,te=this.tileState.getLoaded(K);if(!te)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(te.showCollisionBoxes=X.showCollisionBoxes,te.status==="parsing"){const _e=this.tileState.consumeParsing(K);return yield this._parseWorkerTile(te,X,_e)}if(te.status==="done"&&te.vectorTile)return yield this._parseWorkerTile(te,X)}))}abortTile(X){return R._(this,void 0,void 0,(function*(){this.tileState.abort(X.uid)}))}removeTile(X){return R._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(X.uid)}))}}class Bt{constructor(){this.loaded={}}loadTile(X){return R._(this,void 0,void 0,(function*(){const{uid:K,encoding:te,rawImageData:_e,redFactor:Ee,greenFactor:Ye,blueFactor:ze,baseShift:Ge}=X,Le=_e.width+2,Ke=_e.height+2,Xe=R.b(_e)?new R.R({width:Le,height:Ke},yield R.cZ(_e,-1,-1,Le,Ke)):_e,Re=new R.c_(K,Xe,te,Ee,Ye,ze,Ge);return this.loaded=this.loaded||{},this.loaded[K]=Re,Re}))}removeTile(X){const K=this.loaded,te=X.uid;K&&K[te]&&delete K[te]}}class It{constructor(X,K,te,_e=os){this.actor=X,this.layerIndex=K,this.availableImages=te,this.tileState=new qr,this._createGeoJSONIndex=_e}loadVectorTile(X){if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const{z:K,x:te,y:_e}=X.tileID.canonical,Ee=this._geoJSONIndex.getTile(K,te,_e);return Ee?Ze(new R.c$(Ee.features,{version:2,extent:R.a5})):null}loadTile(X){return R._(this,void 0,void 0,(function*(){const{uid:K}=X,te=new Tr(X);te.abort=new AbortController;try{const _e=this.loadVectorTile(X);if(!_e)return null;const{vectorTile:Ee,rawData:Ye}=_e;te.vectorTile=Ee,this.tileState.markLoaded(K,te);const ze={rawData:Ye};this.tileState.setParsing(K,ze);try{return yield this._parseWorkerTile(te,X,ze)}finally{this.tileState.clearParsing(K)}}catch(_e){throw te.status="done",this.tileState.markLoaded(K,te),_e}}))}_reloadLoadedTile(X){return R._(this,void 0,void 0,(function*(){const K=X.uid,te=this.tileState.getLoaded(K);if(!te)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(te.showCollisionBoxes=X.showCollisionBoxes,te.status==="parsing"){const _e=this.tileState.consumeParsing(K);return yield this._parseWorkerTile(te,X,_e)}if(te.status==="done"&&te.vectorTile)return yield this._parseWorkerTile(te,X)}))}_parseWorkerTile(X,K,te){return R._(this,void 0,void 0,(function*(){let _e=yield X.parse(X.vectorTile,this.layerIndex,this.availableImages,this.actor,K.subdivisionGranularity);if(te){const{rawData:Ee}=te;_e=R.e({rawTileData:Ee.slice(0),encoding:"mvt"},_e)}return _e}))}abortTile(X){return R._(this,void 0,void 0,(function*(){this.tileState.abort(X.uid)}))}removeTile(X){return R._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(X.uid)}))}loadData(X){return R._(this,void 0,void 0,(function*(){var K;(K=this._pendingRequest)===null||K===void 0||K.abort();const te=this._startRequestTiming(X);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(X,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();const _e={};return X.request&&(_e.data=X.data),this._finishRequestTiming(te,X,_e),_e}catch(_e){if(delete this._pendingRequest,!R.Z(_e))throw _e;return{abandoned:!0}}}))}_startRequestTiming(X){var K;if(!((K=X.request)===null||K===void 0)&&K.collectResourceTiming)return new R.cY(X.request.url)}_finishRequestTiming(X,K,te){const _e=X?.finish();_e&&(te.resourceTiming={[K.source]:JSON.parse(JSON.stringify(_e))})}reloadTile(X){return this.tileState.getLoaded(X.uid)?this._reloadLoadedTile(X):this.loadTile(X)}loadAndProcessGeoJSON(X,K){return R._(this,void 0,void 0,(function*(){var te;if(X.request&&(X.data=(yield R.j(X.request,K)).data),X.data)return X.data=this._filterGeoJSON(X.data,X.filter),void(this._geoJSONIndex=this._createGeoJSONIndex(X.data,X));if(X.dataDiff)return(te=this._geoJSONIndex)!==null&&te!==void 0||(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},X)),void this._geoJSONIndex.updateData(X.dataDiff,this._getFilterPredicate(X.filter));if(X.updateCluster&&this._geoJSONIndex.updateClusterOptions(X.geojsonVtOptions.cluster,Tn(X)),this._geoJSONIndex==null)throw new Error(`Input data given to '${X.source}' is not a valid GeoJSON object.`)}))}_filterGeoJSON(X,K){if(X.type!=="FeatureCollection")return X;const te=this._getFilterPredicate(K);return te?{type:"FeatureCollection",features:X.features.filter((_e=>te(_e)))}:X}_getFilterPredicate(X){if(typeof X!="boolean"&&!X?.length)return;const K=R.d0(X,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(K.result==="error")throw new Error(K.value.map((te=>`${te.key}: ${te.message}`)).join(", "));return te=>K.value.evaluate({zoom:0},te)}removeSource(X){return R._(this,void 0,void 0,(function*(){var K;(K=this._pendingRequest)===null||K===void 0||K.abort()}))}getClusterExpansionZoom(X){return this._geoJSONIndex.getClusterExpansionZoom(X.clusterId)}getClusterChildren(X){return this._geoJSONIndex.getClusterChildren(X.clusterId)}getClusterLeaves(X){return this._geoJSONIndex.getClusterLeaves(X.clusterId,X.limit,X.offset)}}function os(We,X){const K=R.e(X.geojsonVtOptions||{},{updateable:!0,clusterOptions:Tn(X)});return new R.d1(We,K)}function Tn({geojsonVtOptions:We,clusterProperties:X}){if(!X||!We.clusterOptions)return We.clusterOptions;const K={},te={},_e={accumulated:null,zoom:0},Ee={properties:null},Ye=Object.keys(X);for(const ze of Ye){const[Ge,Le]=X[ze],Ke=R.d0(Le),Xe=R.d0(typeof Ge=="string"?[Ge,["accumulated"],["get",ze]]:Ge);K[ze]=Ke.value,te[ze]=Xe.value}return We.clusterOptions.map=ze=>{Ee.properties=ze;const Ge={};for(const Le of Ye)Ge[Le]=K[Le].evaluate(_e,Ee);return Ge},We.clusterOptions.reduce=(ze,Ge)=>{Ee.properties=Ge;for(const Le of Ye)_e.accumulated=ze[Le],ze[Le]=te[Le].evaluate(_e,Ee)},We.clusterOptions}class ls{constructor(X){this.self=X,this.actor=new R.L(X),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(K,te)=>{if(this.externalWorkerSourceTypes[K])throw new Error(`Worker source with name "${K}" already registered.`);this.externalWorkerSourceTypes[K]=te},this.self.addProtocol=R.cH,this.self.removeProtocol=R.cI,this.self.registerRTLTextPlugin=K=>{R.d2.setMethods(K)},this.actor.registerMessageHandler("LDT",((K,te)=>this._getDEMWorkerSource(K,te.source).loadTile(te))),this.actor.registerMessageHandler("RDT",((K,te)=>R._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(K,te.source).removeTile(te)})))),this.actor.registerMessageHandler("GCEZ",((K,te)=>R._(this,void 0,void 0,(function*(){return this._getWorkerSource(K,te.type,te.source).getClusterExpansionZoom(te)})))),this.actor.registerMessageHandler("GCC",((K,te)=>R._(this,void 0,void 0,(function*(){return this._getWorkerSource(K,te.type,te.source).getClusterChildren(te)})))),this.actor.registerMessageHandler("GCL",((K,te)=>R._(this,void 0,void 0,(function*(){return this._getWorkerSource(K,te.type,te.source).getClusterLeaves(te)})))),this.actor.registerMessageHandler("LD",((K,te)=>this._getWorkerSource(K,te.type,te.source).loadData(te))),this.actor.registerMessageHandler("LT",((K,te)=>this._getWorkerSource(K,te.type,te.source).loadTile(te))),this.actor.registerMessageHandler("RT",((K,te)=>this._getWorkerSource(K,te.type,te.source).reloadTile(te))),this.actor.registerMessageHandler("AT",((K,te)=>this._getWorkerSource(K,te.type,te.source).abortTile(te))),this.actor.registerMessageHandler("RMT",((K,te)=>this._getWorkerSource(K,te.type,te.source).removeTile(te))),this.actor.registerMessageHandler("RS",((K,te)=>R._(this,void 0,void 0,(function*(){if(!this.workerSources[K]||!this.workerSources[K][te.type]||!this.workerSources[K][te.type][te.source])return;const _e=this.workerSources[K][te.type][te.source];delete this.workerSources[K][te.type][te.source],_e.removeSource!==void 0&&_e.removeSource(te)})))),this.actor.registerMessageHandler("RM",(K=>R._(this,void 0,void 0,(function*(){delete this.layerIndexes[K],delete this.availableImages[K],delete this.workerSources[K],delete this.demWorkerSources[K],this.globalStates.delete(K)})))),this.actor.registerMessageHandler("SR",((K,te)=>R._(this,void 0,void 0,(function*(){this.referrer=te})))),this.actor.registerMessageHandler("SRPS",((K,te)=>this._syncRTLPluginState(K,te))),this.actor.registerMessageHandler("IS",((K,te)=>R._(this,void 0,void 0,(function*(){this.self.importScripts(te)})))),this.actor.registerMessageHandler("SI",((K,te)=>this._setImages(K,te))),this.actor.registerMessageHandler("UL",((K,te)=>R._(this,void 0,void 0,(function*(){this._getLayerIndex(K).update(te.layers,te.removedIds,this._getGlobalState(K))})))),this.actor.registerMessageHandler("UGS",((K,te)=>R._(this,void 0,void 0,(function*(){const _e=this._getGlobalState(K);for(const Ee in te)_e[Ee]=te[Ee]})))),this.actor.registerMessageHandler("SL",((K,te)=>R._(this,void 0,void 0,(function*(){this._getLayerIndex(K).replace(te,this._getGlobalState(K))}))))}_getGlobalState(X){let K=this.globalStates.get(X);return K||(K={},this.globalStates.set(X,K)),K}_setImages(X,K){return R._(this,void 0,void 0,(function*(){this.availableImages[X]=K;for(const te in this.workerSources[X]){const _e=this.workerSources[X][te];for(const Ee in _e)_e[Ee].availableImages=K}}))}_syncRTLPluginState(X,K){return R._(this,void 0,void 0,(function*(){return yield R.d2.syncState(K,this.self.importScripts)}))}_getAvailableImages(X){let K=this.availableImages[X];return K||(K=[]),K}_getLayerIndex(X){let K=this.layerIndexes[X];return K||(K=this.layerIndexes[X]=new d),K}_getWorkerSource(X,K,te){if(this.workerSources[X]||(this.workerSources[X]={}),this.workerSources[X][K]||(this.workerSources[X][K]={}),!this.workerSources[X][K][te]){const _e={sendAsync:(Ee,Ye)=>(Ee.targetMapId=X,this.actor.sendAsync(Ee,Ye))};switch(K){case"vector":this.workerSources[X][K][te]=new Ti(_e,this._getLayerIndex(X),this._getAvailableImages(X));break;case"geojson":this.workerSources[X][K][te]=new It(_e,this._getLayerIndex(X),this._getAvailableImages(X));break;default:this.workerSources[X][K][te]=new this.externalWorkerSourceTypes[K](_e,this._getLayerIndex(X),this._getAvailableImages(X))}}return this.workerSources[X][K][te]}_getDEMWorkerSource(X,K){return this.demWorkerSources[X]||(this.demWorkerSources[X]={}),this.demWorkerSources[X][K]||(this.demWorkerSources[X][K]=new Bt),this.demWorkerSources[X][K]}}return R.i(self)&&(self.worker=new ls(self)),ls})),Zr("index",["exports","./shared"],(function(R,d){var we="5.21.1";function Tr(){var p=new d.A(4);return d.A!=Float32Array&&(p[1]=0,p[2]=0),p[0]=1,p[3]=1,p}let wi,qr,as;const Kt={frame(p,t,n,o){const c=o||window,f=c.requestAnimationFrame((b=>{y(),t(b)})),{unsubscribe:y}=d.s(p.signal,"abort",(()=>{y(),c.cancelAnimationFrame(f),n(new d.a(p.signal.reason))}),!1)},frameAsync(p,t){return new Promise(((n,o)=>{this.frame(p,n,o,t)}))},getImageData(p,t=0){return this.getImageCanvasContext(p).getImageData(-t,-t,p.width+2*t,p.height+2*t)},getImageCanvasContext(p){const t=window.document.createElement("canvas"),n=t.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return t.width=p.width,t.height=p.height,n.drawImage(p,0,0,p.width,p.height),n},resolveURL:p=>(wi||(wi=document.createElement("a")),wi.href=p,wi.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return as!==void 0?as:!!matchMedia&&(qr==null&&(qr=matchMedia("(prefers-reduced-motion: reduce)")),qr.matches)},set prefersReducedMotion(p){as=p}},Sr=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt!==null?this._frozenAt:performance.now()}setNow(p){this._frozenAt=p}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function Ze(){return Sr.getCurrentTime()}class ge{static create(t,n,o){const c=window.document.createElement(t);return n!==void 0&&(c.className=n),o&&o.appendChild(c),c}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){ge.docStyle&&ge.selectProp&&(ge.userSelect=ge.docStyle[ge.selectProp],ge.docStyle[ge.selectProp]="none")}static enableDrag(){ge.docStyle&&ge.selectProp&&(ge.docStyle[ge.selectProp]=ge.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",ge.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ge.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",ge.suppressClickInternal,!0)}),0)}static getScale(t){const n=t.getBoundingClientRect();return{x:n.width/t.offsetWidth||1,y:n.height/t.offsetHeight||1,boundingClientRect:n}}static getPoint(t,n,o){const c=n.boundingClientRect;return new d.P((o.clientX-c.left)/n.x-t.clientLeft,(o.clientY-c.top)/n.y-t.clientTop)}static mousePos(t,n){const o=ge.getScale(t);return ge.getPoint(t,o,n)}static touchPos(t,n){const o=[],c=ge.getScale(t);for(let f=0;f<n.length;f++)o.push(ge.getPoint(t,c,n[f]));return o}static sanitize(t){const n=new DOMParser().parseFromString(t,"text/html").body||document.createElement("body"),o=n.querySelectorAll("script");for(const c of o)c.remove();return ge.clean(n),n.innerHTML}static isPossiblyDangerous(t,n){const o=n.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(t)||!o.includes("javascript:")&&!o.includes("data:"))||!!t.startsWith("on")||void 0}static clean(t){const n=t.children;for(const o of n)ge.removeAttributes(o),ge.clean(o)}static removeAttributes(t){for(const{name:n,value:o}of t.attributes)ge.isPossiblyDangerous(n,o)&&t.removeAttribute(n)}}var Ti;ge.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,ge.selectProp=!ge.docStyle||"userSelect"in ge.docStyle?"userSelect":"webkitUserSelect",(function(p){let t,n,o,c;p.resetRequestQueue=()=>{t=[],n=0,o=0,c={}},p.addThrottleControl=w=>{const S=o++;return c[S]=w,S},p.removeThrottleControl=w=>{delete c[w],y()},p.getImage=(w,S,P=!0)=>new Promise(((E,C)=>{w.headers||(w.headers={}),w.headers.accept="image/webp,*/*",d.e(w,{type:"image"}),t.push({abortController:S,requestParameters:w,supportImageRefresh:P,state:"queued",onError:z=>{C(z)},onSuccess:z=>{E(z)}}),y()}));const f=w=>d._(this,void 0,void 0,(function*(){w.state="running";const{requestParameters:S,supportImageRefresh:P,onError:E,onSuccess:C,abortController:z}=w,F=P===!1&&!d.i(self)&&!d.g(S.url)&&(!S.headers||Object.keys(S.headers).reduce(((N,$)=>N&&$==="accept"),!0));n++;const V=F?b(S,z):d.m(S,z);try{const N=yield V;delete w.abortController,w.state="completed",N.data instanceof HTMLImageElement||d.b(N.data)?C(N):N.data&&C({data:yield(j=N.data,typeof createImageBitmap=="function"?d.f(j):d.h(j)),cacheControl:N.cacheControl,expires:N.expires})}catch(N){delete w.abortController,E(N)}finally{n--,y()}var j})),y=()=>{const w=(()=>{for(const S of Object.keys(c))if(c[S]())return!0;return!1})()?d.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:d.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let S=n;S<w&&t.length>0;S++){const P=t.shift();P.abortController.signal.aborted?S--:f(P)}},b=(w,S)=>new Promise(((P,E)=>{const C=new Image,z=w.url,F=w.credentials;F&&F==="include"?C.crossOrigin="use-credentials":(F&&F==="same-origin"||!d.d(z))&&(C.crossOrigin="anonymous"),S.signal.addEventListener("abort",(()=>{C.src="",E(new d.a(S.signal.reason))})),C.fetchPriority="high",C.onload=()=>{C.onerror=C.onload=null,P({data:C})},C.onerror=()=>{C.onerror=C.onload=null,S.signal.aborted||E(new 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."))},C.src=z}))})(Ti||(Ti={})),Ti.resetRequestQueue();class Bt{constructor(t){this._transformRequestFn=t??null}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function It(p){const t=[];if(typeof p=="string")t.push({id:"default",url:p});else if(p&&p.length>0){const n=[];for(const{id:o,url:c}of p){const f=`${o}${c}`;n.indexOf(f)===-1&&(n.push(f),t.push({id:o,url:c}))}}return t}function os(p,t,n){try{const o=new URL(p);return o.pathname+=`${t}${n}`,o.toString()}catch{throw new Error(`Invalid sprite URL "${p}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function Tn(p){const{userImage:t}=p;return!!(t&&t.render&&t.render())&&(p.data.replace(new Uint8Array(t.data.buffer)),!0)}class ls extends d.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new d.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(const t of Object.keys(this.images))this.removeImage(t);this.patterns={},this.atlasImage=new d.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,promiseResolve:o}of this.requestors)o(this._getImagesForIds(n));this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const o=n.spriteData;n.data=new d.R({width:o.width,height:o.height},o.context.getImageData(o.x,o.y,o.width,o.height).data),n.spriteData=null}return n}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let o=!0;const c=n.data||n.spriteData;return this._validateStretch(n.stretchX,c&&c.width)||(this.fire(new d.k(new Error(`Image "${t}" has invalid "stretchX" value`))),o=!1),this._validateStretch(n.stretchY,c&&c.height)||(this.fire(new d.k(new Error(`Image "${t}" has invalid "stretchY" value`))),o=!1),this._validateContent(n.content,n)||(this.fire(new d.k(new Error(`Image "${t}" has invalid "content" value`))),o=!1),o}_validateStretch(t,n){if(!t)return!0;let o=0;for(const c of t){if(c[0]<o||c[1]<c[0]||n<c[1])return!1;o=c[1]}return!0}_validateContent(t,n){if(!t)return!0;if(t.length!==4)return!1;const o=n.spriteData,c=o&&o.width||n.data.width,f=o&&o.height||n.data.height;return!(t[0]<0||c<t[0]||t[1]<0||f<t[1]||t[2]<0||c<t[2]||t[3]<0||f<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,n,o=!0){const c=this.getImage(t);if(o&&(c.data.width!==n.data.width||c.data.height!==n.data.height))throw new Error(`size mismatch between old image (${c.data.width}x${c.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=c.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise(((n,o)=>{let c=!0;if(!this.isLoaded())for(const f of t)this.images[f]||(c=!1);this.isLoaded()||c?n(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:n})}))}_getImagesForIds(t){const n={};for(const o of t){let c=this.getImage(o);c||(this.fire(new d.l("styleimagemissing",{id:o})),c=this.getImage(o)),c?n[o]={data:c.data.clone(),pixelRatio:c.pixelRatio,sdf:c.sdf,version:c.version,stretchX:c.stretchX,stretchY:c.stretchY,content:c.content,textFitWidth:c.textFitWidth,textFitHeight:c.textFitHeight,hasRenderCallback:!!(c.userImage&&c.userImage.render)}:d.w(`Image "${o}" 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(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],o=this.getImage(t);if(!o)return null;if(n&&n.position.version===o.version)return n.position;if(n)n.position.version=o.version;else{const c={w:o.data.width+2,h:o.data.height+2,x:0,y:0},f=new d.I(c,o);this.patterns[t]={bin:c,position:f}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new d.T(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const f in this.patterns)t.push(this.patterns[f].bin);const{w:n,h:o}=d.p(t),c=this.atlasImage;c.resize({width:n||1,height:o||1});for(const f in this.patterns){const{bin:y}=this.patterns[f],b=y.x+1,w=y.y+1,S=this.getImage(f).data,P=S.width,E=S.height;d.R.copy(S,c,{x:0,y:0},{x:b,y:w},{width:P,height:E}),d.R.copy(S,c,{x:0,y:E-1},{x:b,y:w-1},{width:P,height:1}),d.R.copy(S,c,{x:0,y:0},{x:b,y:w+E},{width:P,height:1}),d.R.copy(S,c,{x:P-1,y:0},{x:b-1,y:w},{width:1,height:E}),d.R.copy(S,c,{x:0,y:0},{x:b+P,y:w},{width:1,height:E})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const o=this.getImage(n);o||d.w(`Image with ID: "${n}" was not found`),Tn(o)&&this.updateImage(n,o)}}cloneImages(){const t={};for(const n in this.images){const o=this.images[n];t[n]=Object.assign(Object.assign({},o),{data:o.data?o.data.clone():null})}return t}}const We=1e20;function X(p,t,n,o,c,f,y,b,w){for(let S=t;S<t+o;S++)K(p,n*f+S,f,c,y,b,w);for(let S=n;S<n+c;S++)K(p,S*f+t,1,o,y,b,w)}function K(p,t,n,o,c,f,y){f[0]=0,y[0]=-We,y[1]=We,c[0]=p[t];for(let b=1,w=0,S=0;b<o;b++){c[b]=p[t+b*n];const P=b*b;do{const E=f[w];S=(c[b]-c[E]+P-E*E)/(b-E)/2}while(S<=y[w]&&--w>-1);w++,f[w]=b,y[w]=S,y[w+1]=We}for(let b=0,w=0;b<o;b++){for(;y[w+1]<b;)w++;const S=f[w],P=b-S;p[t+b*n]=c[S]+P*P}}const te=d.v.layout_symbol["text-font"].default.join(",");class _e{constructor(t,n,o){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={},this.lang=o}setURL(t){this.url=t}getGlyphs(t){return d._(this,void 0,void 0,(function*(){const n=[];for(const f in t)for(const y of t[f])n.push(this._getAndCacheGlyphsPromise(f,y));const o=yield Promise.all(n),c={};for(const{stack:f,id:y,glyph:b}of o)c[f]||(c[f]={}),c[f][y]=b&&{id:b.id,bitmap:b.bitmap.clone(),metrics:b.metrics};return c}))}_getAndCacheGlyphsPromise(t,n){return d._(this,void 0,void 0,(function*(){let o=this.entries[t];o||(o=this.entries[t]={glyphs:{},requests:{},ranges:{}});let c=o.glyphs[n];return c!==void 0?{stack:t,id:n,glyph:c}:!this.url||this._charUsesLocalIdeographFontFamily(n)?(c=o.glyphs[n]=this._drawGlyph(o,t,n),{stack:t,id:n,glyph:c}):yield this._downloadAndCacheRangePromise(t,n)}))}_downloadAndCacheRangePromise(t,n){return d._(this,void 0,void 0,(function*(){const o=this.entries[t],c=Math.floor(n/256);if(o.ranges[c])return{stack:t,id:n,glyph:null};if(!o.requests[c]){const f=_e.loadGlyphRange(t,c,this.url,this.requestManager);o.requests[c]=f}try{const f=yield o.requests[c];for(const y in f)o.glyphs[+y]=f[+y];return o.ranges[c]=!0,{stack:t,id:n,glyph:f[n]||null}}catch(f){const y=o.glyphs[n]=this._drawGlyph(o,t,n);return this._warnOnMissingGlyphRange(y,c,n,f),{stack:t,id:n,glyph:y}}}))}_warnOnMissingGlyphRange(t,n,o,c){const f=256*n,y=f+255,b=o.toString(16).padStart(4,"0").toUpperCase();d.w(`Unable to load glyph range ${n}, ${f}-${y}. Rendering codepoint U+${b} locally instead. ${c}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&d.q(t)}_drawGlyph(t,n,o){const c=n===te&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(o),f=c?"ideographTinySDF":"tinySDF";t[f]||(t[f]=this._createTinySDF(c?this.localIdeographFontFamily:n));const y=t[f].draw(String.fromCodePoint(o)),b=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(o));return{id:o,bitmap:new d.r({width:y.width||60,height:y.height||60},y.data),metrics:{width:b?0:y.glyphWidth/2||24,height:y.glyphHeight/2||24,left:y.glyphLeft/2+.5||0,top:y.glyphTop/2-27.5||-8,advance:b?0:y.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(t){const n=t?t.split(","):[];n.push("sans-serif");const o=n.map((c=>/[-\w]+/.test(c)?c:`'${CSS.escape(c)}'`)).join(",");return new _e.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:o,fontWeight:this._fontWeight(n[0]),fontStyle:this._fontStyle(n[0]),lang:this.lang})}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){const n={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};let o;for(const[c,f]of Object.entries(n))new RegExp(`\\b${c}\\b`,"i").test(t)&&(o=`${f}`);return o}destroy(){for(const t in this.entries){const n=this.entries[t];n.tinySDF&&(n.tinySDF=null),n.ideographTinySDF&&(n.ideographTinySDF=null),n.glyphs={},n.requests={},n.ranges={}}this.entries={}}}_e.loadGlyphRange=function(p,t,n,o){return d._(this,void 0,void 0,(function*(){const c=256*t,f=c+255,y=yield o.transformRequest(n.replace("{fontstack}",p).replace("{range}",`${c}-${f}`),"Glyphs"),b=yield d.n(y,new AbortController);if(!b||!b.data)throw new Error(`Could not load glyph range. range: ${t}, ${c}-${f}`);const w={};for(const S of d.o(b.data))w[S.id]=S;return w}))},_e.TinySDF=class{constructor({fontSize:p=24,buffer:t=3,radius:n=8,cutoff:o=.25,fontFamily:c="sans-serif",fontWeight:f="normal",fontStyle:y="normal",lang:b=null}={}){this.buffer=t,this.cutoff=o,this.radius=n,this.lang=b;const w=this.size=p+4*t,S=this._createCanvas(w),P=this.ctx=S.getContext("2d",{willReadFrequently:!0});P.font=`${y} ${f} ${p}px ${c}`,P.textBaseline="alphabetic",P.textAlign="left",P.fillStyle="black",this.gridOuter=new Float64Array(w*w),this.gridInner=new Float64Array(w*w),this.f=new Float64Array(w),this.z=new Float64Array(w+1),this.v=new Uint16Array(w)}_createCanvas(p){const t=document.createElement("canvas");return t.width=t.height=p,t}draw(p){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:o,actualBoundingBoxLeft:c,actualBoundingBoxRight:f}=this.ctx.measureText(p),y=Math.ceil(n),b=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(f-c))),w=Math.min(this.size-this.buffer,y+Math.ceil(o)),S=b+2*this.buffer,P=w+2*this.buffer,E=Math.max(S*P,0),C=new Uint8ClampedArray(E),z={data:C,width:S,height:P,glyphWidth:b,glyphHeight:w,glyphTop:y,glyphLeft:0,glyphAdvance:t};if(b===0||w===0)return z;const{ctx:F,buffer:V,gridInner:j,gridOuter:N}=this;this.lang&&(F.lang=this.lang),F.clearRect(V,V,b,w),F.fillText(p,V,V+y);const $=F.getImageData(V,V,b,w);N.fill(We,0,E),j.fill(0,0,E);for(let W=0;W<w;W++)for(let G=0;G<b;G++){const q=$.data[4*(W*b+G)+3]/255;if(q===0)continue;const Y=(W+V)*S+G+V;if(q===1)N[Y]=0,j[Y]=We;else{const Z=.5-q;N[Y]=Z>0?Z*Z:0,j[Y]=Z<0?Z*Z:0}}X(N,0,0,S,P,S,this.f,this.v,this.z),X(j,V,V,b,w,S,this.f,this.v,this.z);for(let W=0;W<E;W++){const G=Math.sqrt(N[W])-Math.sqrt(j[W]);C[W]=Math.round(255-255*(G/this.radius+this.cutoff))}return z}};class Ee{constructor(){this.specification=d.u.light.position}possiblyEvaluate(t,n){return d.F(t.expression.evaluate(n))}interpolate(t,n,o){return{x:d.G.number(t.x,n.x,o),y:d.G.number(t.y,n.y,o),z:d.G.number(t.z,n.z,o)}}}let Ye;class ze extends d.E{constructor(t){super(),Ye=Ye||new d.t({anchor:new d.D(d.u.light.anchor),position:new Ee,color:new d.D(d.u.light.color),intensity:new d.D(d.u.light.intensity)}),this._transitionable=new d.x(Ye,void 0),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(d.y,t,n))for(const o in t){const c=t[o];o.endsWith(d.z)?this._transitionable.setTransition(o.slice(0,-d.z.length),c):this._transitionable.setValue(o,c)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,o){return(!o||o.validate!==!1)&&d.B(this,t.call(d.C,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:d.u}))}}const Ge=new d.t({"sky-color":new d.D(d.u.sky["sky-color"]),"horizon-color":new d.D(d.u.sky["horizon-color"]),"fog-color":new d.D(d.u.sky["fog-color"]),"fog-ground-blend":new d.D(d.u.sky["fog-ground-blend"]),"horizon-fog-blend":new d.D(d.u.sky["horizon-fog-blend"]),"sky-horizon-blend":new d.D(d.u.sky["sky-horizon-blend"]),"atmosphere-blend":new d.D(d.u.sky["atmosphere-blend"])});class Le extends d.E{constructor(t){super(),this._transitionable=new d.x(Ge,void 0),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new d.H(0))}setSky(t,n={}){if(!this._validate(d.J,t,n)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const o in t){const c=t[o];o.endsWith(d.z)?this._transitionable.setTransition(o.slice(0,-d.z.length),c):this._transitionable.setValue(o,c)}}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,o={}){return o?.validate!==!1&&d.B(this,t.call(d.C,d.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:d.u})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class Ke{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const o=t.join(",")+String(n);return this.dashEntry[o]||(this.dashEntry[o]=this.addDash(t,n)),this.dashEntry[o]}getDashRanges(t,n,o){const c=[];let f=t.length%2==1?-t[t.length-1]*o:0,y=t[0]*o,b=!0;c.push({left:f,right:y,isDash:b,zeroLength:t[0]===0});let w=t[0];for(let S=1;S<t.length;S++){b=!b;const P=t[S];f=w*o,w+=P,y=w*o,c.push({left:f,right:y,isDash:b,zeroLength:P===0})}return c}addRoundDash(t,n,o){const c=n/2;for(let f=-o;f<=o;f++){const y=this.width*(this.nextRow+o+f);let b=0,w=t[b];for(let S=0;S<this.width;S++){S/w.right>1&&(w=t[++b]);const P=Math.abs(S-w.left),E=Math.abs(S-w.right),C=Math.min(P,E);let z;const F=f/o*(c+1);if(w.isDash){const V=c-Math.abs(F);z=Math.sqrt(C*C+V*V)}else z=c-Math.sqrt(C*C+F*F);this.data[y+S]=Math.max(0,Math.min(255,z+128))}}}addRegularDash(t){for(let b=t.length-1;b>=0;--b){const w=t[b],S=t[b+1];w.zeroLength?t.splice(b,1):S&&S.isDash===w.isDash&&(S.left=w.left,t.splice(b,1))}const n=t[0],o=t[t.length-1];n.isDash===o.isDash&&(n.left=o.left-this.width,o.right=n.right+this.width);const c=this.width*this.nextRow;let f=0,y=t[f];for(let b=0;b<this.width;b++){b/y.right>1&&(y=t[++f]);const w=Math.abs(b-y.left),S=Math.abs(b-y.right),P=Math.min(w,S);this.data[c+b]=Math.max(0,Math.min(255,(y.isDash?P:-P)+128))}}addDash(t,n){const o=n?7:0,c=2*o+1;if(this.nextRow+c>this.height)return d.w("LineAtlas out of space"),null;let f=0;for(let b=0;b<t.length;b++)f+=t[b];if(f!==0){const b=this.width/f,w=this.getDashRanges(t,this.width,b);n?this.addRoundDash(w,b,o):this.addRegularDash(w)}const y={y:this.nextRow+o,height:2*o,width:f};return this.nextRow+=c,this.dirty=!0,y}bind(t){const n=t.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}const Xe="maplibre_preloaded_worker_pool";class Re{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Re.workerCount;)this.workers.push(new Worker(d.c.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach((n=>{n.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Xe]}numActive(){return Object.keys(this.active).length}}const Jt=Math.floor(Kt.hardwareConcurrency/2);let hi,Pr;function Wr(){return hi||(hi=new Re),hi}Re.workerCount=d.K(globalThis)?Math.max(Math.min(Jt,3),1):1;class Sn{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=n;const o=this.workerPool.acquire(n);for(let c=0;c<o.length;c++){const f=new d.L(o[c],n);f.name=`Worker ${c}`,this.actors.push(f)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n){const o=[];for(const c of this.actors)o.push(c.sendAsync({type:t,data:n}));return Promise.all(o)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach((n=>{n.remove()})),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,n){for(const o of this.actors)o.registerMessageHandler(t,n)}unregisterMessageHandler(t){for(const n of this.actors)n.unregisterMessageHandler(t)}}function cs(){return Pr||(Pr=new Sn(Wr(),d.M),Pr.registerMessageHandler("GR",((p,t,n)=>d.m(t,n)))),Pr}function Si(p,t){const n=d.N();return d.O(n,n,[1,1,0]),d.Q(n,n,[.5*p.width,.5*p.height,1]),p.calculatePosMatrix?d.S(n,n,p.calculatePosMatrix(t.toUnwrapped())):n}function Pn(p,t,n,o,c,f,y){var b;const w=(function(C,z,F){if(C)for(const V of C){const j=z[V];if(j&&j.source===F&&j.type==="fill-extrusion")return!0}else for(const V in z){const j=z[V];if(j.source===F&&j.type==="fill-extrusion")return!0}return!1})((b=c?.layers)!==null&&b!==void 0?b:null,t,p.id),S=f.maxPitchScaleFactor(),P=p.tilesIn(o,S,w);P.sort(Ri);const E=[];for(const C of P)E.push({wrappedTileID:C.tileID.wrapped().key,queryResults:C.tile.queryRenderedFeatures(t,n,p.getState(),C.queryGeometry,C.cameraQueryGeometry,C.scale,c,f,S,Si(f,C.tileID),y?(z,F)=>y(C.tileID,z,F):void 0)});return(function(C,z){for(const F in C)for(const V of C[F])us(V,z);return C})((function(C){const z={},F={};for(const V of C){const j=V.queryResults,N=V.wrappedTileID,$=F[N]=F[N]||{};for(const W in j){const G=j[W],q=$[W]=$[W]||{},Y=z[W]=z[W]||[];for(const Z of G)q[Z.featureIndex]||(q[Z.featureIndex]=!0,Y.push(Z))}}return z})(E),p)}function Ri(p,t){const n=p.tileID,o=t.tileID;return n.overscaledZ-o.overscaledZ||n.canonical.y-o.canonical.y||n.wrap-o.wrap||n.canonical.x-o.canonical.x}function us(p,t){const n=p.feature,o=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=o}function Ir(p,t,n,o){return d._(this,void 0,void 0,(function*(){let c=p;if(p.url?c=(yield d.j(yield t.transformRequest(p.url,"Source"),n)).data:yield Kt.frameAsync(n,o),!c)return null;const f=d.U(d.e(c,p),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in c&&c.vector_layers&&(f.vectorLayerIds=c.vector_layers.map((y=>y.id))),f}))}class xt{constructor(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof d.V?new d.V(t.lng,t.lat):d.V.convert(t),this}setSouthWest(t){return this._sw=t instanceof d.V?new d.V(t.lng,t.lat):d.V.convert(t),this}extend(t){const n=this._sw,o=this._ne;let c,f;if(t instanceof d.V)c=t,f=t;else{if(!(t instanceof xt))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(xt.convert(t)):this.extend(d.V.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(d.V.convert(t)):this;if(c=t._sw,f=t._ne,!c||!f)return this}return n||o?(n.lng=Math.min(c.lng,n.lng),n.lat=Math.min(c.lat,n.lat),o.lng=Math.max(f.lng,o.lng),o.lat=Math.max(f.lat,o.lat)):(this._sw=new d.V(c.lng,c.lat),this._ne=new d.V(f.lng,f.lat)),this}getCenter(){return new d.V((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 d.V(this.getWest(),this.getNorth())}getSouthEast(){return new d.V(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:n,lat:o}=d.V.convert(t);let c=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&c}intersects(t){if(!((t=xt.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;const n=Math.abs(this.getEast()-this.getWest()),o=Math.abs(t.getEast()-t.getWest());if(n>=360||o>=360)return!0;const c=d.W(this.getWest(),-180,180),f=d.W(this.getEast(),-180,180),y=d.W(t.getWest(),-180,180),b=d.W(t.getEast(),-180,180),w=c>f,S=y>b;return!(!w||!S)||(w?b>=c||y<=f:S?f>=y||c<=b:y<=f&&b>=c)}static convert(t){return t instanceof xt?t:t&&new xt(t)}static fromLngLat(t,n=0){const o=360*n/40075017,c=o/Math.cos(Math.PI/180*t.lat);return new xt(new d.V(t.lng-c,t.lat-o),new d.V(t.lng+c,t.lat+o))}adjustAntiMeridian(){const t=new d.V(this._sw.lng,this._sw.lat),n=new d.V(this._ne.lng,this._ne.lat);return new xt(t,t.lng>n.lng?new d.V(n.lng+360,n.lat):n)}}class $e{constructor(t,n,o){this.bounds=xt.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=o||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),o=Math.floor(d.Y(this.bounds.getWest())*n),c=Math.floor(d.X(this.bounds.getNorth())*n),f=Math.ceil(d.Y(this.bounds.getEast())*n),y=Math.ceil(d.X(this.bounds.getSouth())*n);return t.x>=o&&t.x<f&&t.y>=c&&t.y<y}}class Nt extends d.E{constructor(t,n,o,c){if(super(),this.id=t,this.dispatcher=o,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,d.e(this,d.U(n,["url","scheme","tileSize","promoteId","encoding"])),this._options=d.e({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(c)}load(){return d._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new d.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const n=yield Ir(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,n&&(d.e(this,n),n.bounds&&(this.tileBounds=new $e(n.bounds,this.minzoom,this.maxzoom)),this.fire(new d.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new d.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(n){this._tileJSONRequest=null,this._loaded=!0,d.Z(n)||this.fire(new d.k(n))}}))}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return d.e({},this._options)}loadTile(t){return d._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o={request:yield this.map._requestManager.transformRequest(n,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:yield this._getOverzoomParameters(t),etag:t.etag};o.request.collectResourceTiming=this._collectResourceTiming;let c="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise(((f,y)=>{t.reloadPromise={resolve:f,reject:y}}))}else t.actor=this.dispatcher.getActor(),c="LT";t.abortController=new AbortController;try{const f=yield t.actor.sendAsync({type:c,data:o},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,f);const y={};return f?.etagUnmodified&&(y.unmodified=!0),y}catch(f){if(delete t.abortController,t.aborted)return;if(f&&f.status!==404)throw f;this._afterTileLoadWorkerResponse(t,null)}}))}_getOverzoomParameters(t){return d._(this,void 0,void 0,(function*(){if(t.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;const n=t.tileID.scaledTo(this.maxzoom).canonical,o=n.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:n,overzoomRequest:yield this.map._requestManager.transformRequest(o,"Tile")}}))}_afterTileLoadWorkerResponse(t,n){if(n?.resourceTiming&&(t.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&t.setExpiryData(n),t.etag=n?.etag,t.loadVectorData(n,this.map.painter),t.reloadPromise){const o=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(o.resolve).catch(o.reject)}}abortTile(t){return d._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}unloadTile(t){return d._(this,void 0,void 0,(function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class Ut extends d.E{constructor(t,n,o,c){super(),this.id=t,this.dispatcher=o,this.setEventedParent(c),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=d.e({type:"raster"},n),d.e(this,d.U(n,["url","scheme","tileSize"]))}load(){return d._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new d.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const n=yield Ir(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,n&&(d.e(this,n),n.bounds&&(this.tileBounds=new $e(n.bounds,this.minzoom,this.maxzoom)),this.fire(new d.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new d.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(n){this._tileJSONRequest=null,this._loaded=!0,d.Z(n)||this.fire(new d.k(n))}}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}serialize(){return d.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return d._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const o=yield Ti.getImage(yield this.map._requestManager.transformRequest(n,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(o&&o.data){this.map._refreshExpiredTiles&&(o.cacheControl||o.expires)&&t.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});const c=this.map.painter.context,f=c.gl,y=o.data;t.texture=this.map.painter.getTileTexture(y.width),t.texture?t.texture.update(y,{useMipmap:!0}):(t.texture=new d.T(c,y,f.RGBA,{useMipmap:!0}),t.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(o){if(delete t.abortController,t.aborted)t.state="unloaded";else if(o)throw t.state="errored",o}}))}abortTile(t){return d._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)}))}unloadTile(t){return d._(this,void 0,void 0,(function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)}))}hasTransition(){return!1}}class Fi extends Ut{constructor(t,n,o,c){super(t,n,o,c),this.type="raster-dem",this.maxzoom=22,this._options=d.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(t){return d._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o=yield this.map._requestManager.transformRequest(n,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const c=yield Ti.getImage(o,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(c&&c.data){const f=c.data;this.map._refreshExpiredTiles&&(c.cacheControl||c.expires)&&t.setExpiryData({cacheControl:c.cacheControl,expires:c.expires});const y=d.b(f)&&d.$()?f:yield this.readImageNow(f),b={type:this.type,uid:t.uid,source:this.id,rawImageData:y,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(t.actor&&t.state!=="expired"&&t.state!=="reloading")return;t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor());const w=yield t.actor.sendAsync({type:"LDT",data:b});t.dem=w,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}catch(c){if(delete t.abortController,t.aborted)t.state="unloaded";else if(c)throw t.state="errored",c}}))}readImageNow(t){return d._(this,void 0,void 0,(function*(){if(typeof VideoFrame<"u"&&d.a0()){const n=t.width+2,o=t.height+2;try{return new d.R({width:n,height:o},yield d.a1(t,-1,-1,n,o))}catch{}}return Kt.getImageData(t,1)}))}_getNeighboringTiles(t){const n=t.canonical,o=Math.pow(2,n.z),c=(n.x-1+o)%o,f=n.x===0?t.wrap-1:t.wrap,y=(n.x+1+o)%o,b=n.x+1===o?t.wrap+1:t.wrap,w={};return w[new d.a2(t.overscaledZ,f,n.z,c,n.y).key]={backfilled:!1},w[new d.a2(t.overscaledZ,b,n.z,y,n.y).key]={backfilled:!1},n.y>0&&(w[new d.a2(t.overscaledZ,f,n.z,c,n.y-1).key]={backfilled:!1},w[new d.a2(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},w[new d.a2(t.overscaledZ,b,n.z,y,n.y-1).key]={backfilled:!1}),n.y+1<o&&(w[new d.a2(t.overscaledZ,f,n.z,c,n.y+1).key]={backfilled:!1},w[new d.a2(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},w[new d.a2(t.overscaledZ,b,n.z,y,n.y+1).key]={backfilled:!1}),w}unloadTile(t){return d._(this,void 0,void 0,(function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))}))}}function Gt(p,t){return t?p.properties[t]:p.id}function Li(p,t){const n={id:p.id};if(t.removeAllProperties&&(delete p.removeProperties,delete p.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(const o of t.removeProperties){const c=p.addOrUpdateProperties.findIndex((f=>f.key===o));c>-1&&p.addOrUpdateProperties.splice(c,1)}return(p.removeAllProperties||t.removeAllProperties)&&(n.removeAllProperties=!0),(p.removeProperties||t.removeProperties)&&(n.removeProperties=[...p.removeProperties||[],...t.removeProperties||[]]),(p.addOrUpdateProperties||t.addOrUpdateProperties)&&(n.addOrUpdateProperties=[...p.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(p.newGeometry||t.newGeometry)&&(n.newGeometry=t.newGeometry||p.newGeometry),n}function Mr(p){var t,n;if(!p)return{};const o={};return o.removeAll=p.removeAll,o.remove=new Set(p.remove||[]),o.add=new Map((t=p.add)===null||t===void 0?void 0:t.map((c=>[c.id,c]))),o.update=new Map((n=p.update)===null||n===void 0?void 0:n.map((c=>[c.id,c]))),o}function To(p){return p&&p.length!==0?typeof p[0]=="number"?[p]:p.flatMap((t=>To(t))):[]}function hs(p){return p.type==="GeometryCollection"?p.geometries.flatMap((t=>hs(t))):To(p.coordinates)}function In(p){const t=new xt;let n;switch(p.type){case"FeatureCollection":n=p.features.flatMap((o=>hs(o.geometry)));break;case"Feature":n=hs(p.geometry);break;default:n=hs(p)}if(n.length===0)return t;for(let o=0;o<n.length;o++){const[c,f]=n[o];t.extend([c,f])}return t}class Mn extends d.E{constructor(t,n,o,c){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:n.data},this.actor=o.getActor(),this.setEventedParent(c),this._data=typeof n.data=="string"?{url:n.data}:{geojson:n.data},this._options=d.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&&d.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${n.clusterMaxZoom}".`),this.workerOptions=d.e({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(n.buffer!==void 0?n.buffer:128),tolerance:this._pixelsToTileUnits(n.tolerance!==void 0?n.tolerance:.375),extent:d.a5,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:d.a5,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(t){return t*(d.a5/this.tileSize)}_getClusterMaxZoom(t){const n=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||t===void 0||d.w(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${n}"`),n}load(){return d._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(t){this.map=t,this.load()}setData(t,n){this._data=typeof t=="string"?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t};const o=this._updateWorkerData();return n?o:this}updateData(t,n){this._pendingWorkerUpdate.diff=(function(c,f){if(!c)return f||{};if(!f)return c||{};const y=Mr(c),b=Mr(f);(function(S,P){P.removeAll&&(S.add.clear(),S.update.clear(),S.remove.clear(),P.remove.clear());for(const E of P.remove)S.add.delete(E),S.update.delete(E);for(const[E,C]of P.update){const z=S.update.get(E);z&&(P.update.set(E,Li(z,C)),S.update.delete(E))}})(y,b);const w={};if((y.removeAll||b.removeAll)&&(w.removeAll=!0),w.remove=new Set([...y.remove,...b.remove]),w.add=new Map([...y.add,...b.add]),w.update=new Map([...y.update,...b.update]),w.remove.size&&w.add.size)for(const S of w.add.keys())w.remove.delete(S);return(function(S){const P={};return S.removeAll&&(P.removeAll=S.removeAll),S.remove&&(P.remove=Array.from(S.remove)),S.add&&(P.add=Array.from(S.add.values())),S.update&&(P.update=Array.from(S.update.values())),P})(w)})(this._pendingWorkerUpdate.diff,t);const o=this._updateWorkerData();return n?o:this}getData(){return d._(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 d._(this,void 0,void 0,(function*(){return In(yield this.getData())}))}setClusterOptions(t){return this.workerOptions.geojsonVtOptions.cluster=t.cluster,t.clusterRadius!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),t.clusterMaxZoom!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,n,o){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:n,offset:o}})}_updateWorkerData(){return d._(this,void 0,void 0,(function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void d.w(`No pending worker updates for GeoJSONSource ${this.id}.`);const{data:t,diff:n,updateCluster:o}=this._pendingWorkerUpdate,c=this._getLoadGeoJSONParameters(t,n,o);t!==void 0?this._pendingWorkerUpdate.data=void 0:n?this._pendingWorkerUpdate.diff=void 0:o&&(this._pendingWorkerUpdate.updateCluster=void 0),yield this._dispatchWorkerUpdate(c)}))}_getLoadGeoJSONParameters(t,n,o){return d._(this,void 0,void 0,(function*(){const c=d.e({type:this.type},this.workerOptions);return typeof t=="string"?(c.request=yield this.map._requestManager.transformRequest(Kt.resolveURL(t),"Source"),c.request.collectResourceTiming=this._collectResourceTiming,c):t!==void 0?(c.data=t,c):n?(c.dataDiff=n,c):o?(c.updateCluster=!0,c):void 0}))}_dispatchWorkerUpdate(t){return d._(this,void 0,void 0,(function*(){this._isUpdatingWorker=!0,this.fire(new d.l("dataloading",{dataType:"source"}));try{const n=yield t,o=yield this.actor.sendAsync({type:"LD",data:n});if(this._isUpdatingWorker=!1,this._removed||o.abandoned)return void this.fire(new d.l("dataabort",{dataType:"source"}));o.data&&(this._data={geojson:o.data});const c=this._applyDiffToSource(n.dataDiff),f=this._getShouldReloadTileOptions(c),y={dataType:"source"};this._applyResourceTiming(y,o),this.fire(new d.l("data",Object.assign(Object.assign({},y),{sourceDataType:"metadata"}))),this.fire(new d.l("data",Object.assign(Object.assign({},y),{sourceDataType:"content",shouldReloadTileOptions:f})))}catch(n){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new d.l("dataabort",{dataType:"source"}));this.fire(new d.k(n))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}}))}_applyResourceTiming(t,n){var o;if(!this._collectResourceTiming)return;const c=(o=n.resourceTiming)===null||o===void 0?void 0:o[this.id];if(!c)return;const f=c.slice(0);f?.length&&d.e(t,{resourceTiming:f})}_applyDiffToSource(t){if(!t)return;const n=typeof this.promoteId=="string"?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){const c=(function(f,y){const b=new Map;if(f==null||f.type==null)return b;if(f.type==="Feature"){const w=Gt(f,y);return w==null?void 0:(b.set(w,f),b)}if(f.type==="FeatureCollection"){const w=new Set;for(const S of f.features){const P=Gt(S,y);if(P==null||w.has(P))return;w.add(P),b.set(P,S)}return b}})(this._data.geojson,n);if(!c)throw new Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:c}}if(!this._data.updateable)return;const o=(function(c,f,y){var b,w;const S=[];if(f.removeAll)c.clear();else if(f.remove)for(const P of f.remove){const E=c.get(P);E&&(S.push(E.geometry),c.delete(P))}if(f.add)for(const P of f.add){const E=Gt(P,y);if(E==null)continue;const C=c.get(E);C&&S.push(C.geometry),S.push(P.geometry),c.set(E,P)}if(f.update)for(const P of f.update){const E=c.get(P.id);if(!E)continue;const C=!!P.newGeometry,z=P.removeAllProperties||((b=P.removeProperties)===null||b===void 0?void 0:b.length)>0||((w=P.addOrUpdateProperties)===null||w===void 0?void 0:w.length)>0;if(!C&&!z)continue;S.push(E.geometry);const F=Object.assign({},E);if(c.set(P.id,F),C&&(S.push(P.newGeometry),F.geometry=P.newGeometry),z){if(F.properties=P.removeAllProperties?{}:Object.assign({},F.properties||{}),P.removeProperties)for(const V of P.removeProperties)delete F.properties[V];if(P.addOrUpdateProperties)for(const{key:V,value:j}of P.addOrUpdateProperties)F.properties[V]=j}}return S})(this._data.updateable,t,n);return t.removeAll||this._options.cluster?void 0:o}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map((n=>In(n)))}}shouldReloadTile(t,{affectedBounds:n}){if(t.state==="loading")return!0;if(t.state==="unloaded")return!1;const{buffer:o,extent:c}=this.workerOptions.geojsonVtOptions,f=(function({x:y,y:b,z:w},S=0){const P=d.a3((y-S)/Math.pow(2,w)),E=d.a4((b+1+S)/Math.pow(2,w)),C=d.a3((y+1+S)/Math.pow(2,w)),z=d.a4((b-S)/Math.pow(2,w));return new xt([P,E],[C,z])})(t.tileID.canonical,o/c);for(const y of n)if(f.intersects(y))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(t){return d._(this,void 0,void 0,(function*(){const n=t.actor?"RT":"LT";t.actor=this.actor;const o={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};t.abortController=new AbortController;const c=yield this.actor.sendAsync({type:n,data:o},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(c,this.map.painter,n==="RT")}))}abortTile(t){return d._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}))}unloadTile(t){return d._(this,void 0,void 0,(function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return d.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 Er extends d.E{constructor(t,n,o,c){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=o,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(c),this.options=n}load(t){return d._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new d.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const n=yield Ti.getImage(yield this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,t&&(this.coordinates=t),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,d.Z(n)||this.fire(new d.k(n))}}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new d.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(d.a6.fromLngLat);var o;return this.tileID=(function(c){const f=d.a7.fromPoints(c),y=f.width(),b=f.height(),w=Math.max(y,b),S=Math.max(0,Math.floor(-Math.log(w)/Math.LN2)),P=Math.pow(2,S);return new d.a9(S,Math.floor((f.minX+f.maxX)/2*P),Math.floor((f.minY+f.maxY)/2*P))})(n),this.terrainTileRanges=this._getOverlappingTileRanges(n),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=n.map((c=>this.tileID.getTilePoint(c)._round())),this.flippedWindingOrder=((o=this.tileCoords)[1].x-o[0].x)*(o[2].y-o[0].y)-(o[1].y-o[0].y)*(o[2].x-o[0].x)<0,this.fire(new d.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.texture||(this.texture=new d.T(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let o=!1;for(const c in this.tiles){const f=this.tiles[c];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,o=!0)}o&&this.fire(new d.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return d._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){const{minX:n,minY:o,maxX:c,maxY:f}=d.a7.fromPoints(t),y={};for(let b=0;b<=d.a8;b++){const w=Math.pow(2,b),S=Math.floor(n*w),P=Math.floor(o*w),E=Math.floor(c*w),C=Math.floor(f*w),z=(S%w+w)%w,F=E%w,V=Math.floor(S/w),j=Math.floor(E/w);y[b]={minWrap:V,maxWrap:j,minTileXWrapped:z,maxTileXWrapped:F,minTileY:P,maxTileY:C}}return y}}class ha extends Er{constructor(t,n,o,c){super(t,n,o,c),this._onPlayingHandler=()=>{var f;(f=this.map)===null||f===void 0||f.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=n}load(){return d._(this,void 0,void 0,(function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push((yield this.map._requestManager.transformRequest(n,"Source")).url);try{const n=yield d.aa(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new d.k(n))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new d.k(new d.ab(`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=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,n=t.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 d.T(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let o=!1;for(const c in this.tiles){const f=this.tiles[c];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,o=!0)}o&&this.fire(new d.l("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 Xr extends Er{constructor(t,n,o,c){super(t,n,o,c),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some((f=>!Array.isArray(f)||f.length!==2||f.some((y=>typeof y!="number"))))||this.fire(new d.k(new d.ab(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new d.k(new d.ab(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new d.k(new d.ab(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new d.k(new d.ab(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new d.k(new d.ab(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return d._(this,void 0,void 0,(function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new d.k(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,o=n.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new d.T(n,this.canvas,o.RGBA,{premultiply:!0}),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE));let c=!1;for(const f in this.tiles){const y=this.tiles[f];y.state!=="loaded"&&(y.state="loaded",y.texture=this.texture,c=!0)}c&&this.fire(new d.l("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(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const So={},Po=p=>{switch(p){case"geojson":return Mn;case"image":return Er;case"raster":return Ut;case"raster-dem":return Fi;case"vector":return Nt;case"video":return ha;case"canvas":return Xr}return So[p]},ds="RTLPluginLoaded";class Kl extends d.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=cs()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch((n=>{throw this.status="error",n}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return d._(this,arguments,void 0,(function*(n,o=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=Kt.resolveURL(n),!this.url)throw new Error(`requested url ${n} is invalid`);if(this.status==="unavailable"){if(!o)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()}))}_requestImport(){return d._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new d.l(ds))}))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let da=null;function Cr(){return da||(da=new Kl),da}var or,Bi;(function(p){p[p.Base=0]="Base",p[p.Parent=1]="Parent"})(or||(or={})),(function(p){p[p.Departing=0]="Departing",p[p.Incoming=1]="Incoming"})(Bi||(Bi={}));class En{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=d.ac(),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(t){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:n,fadingParentID:o,fadeEndTime:c}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=n,this.fadingParentID=o,this.fadeEndTime=c}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=Ze(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,n,o){if(t?.etagUnmodified!==!0)if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestEncoding=t.encoding,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=(function(c,f){const y={};if(!f)return y;for(const b of c){const w=b.layerIds.map((S=>f.getLayer(S))).filter(Boolean);if(w.length!==0){b.layers=w,b.stateDependentLayerIds&&(b.stateDependentLayers=b.stateDependentLayerIds.map((S=>w.filter((P=>P.id===S))[0])));for(const S of w)y[S.id]=b}}return y})(t.buckets,n?.style),this.hasSymbolBuckets=!1;for(const c in this.buckets){const f=this.buckets[c];if(f instanceof d.ae){if(this.hasSymbolBuckets=!0,!o)break;f.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const c in this.buckets){const f=this.buckets[c];if(f instanceof d.ae&&f.hasRTLText){this.hasRTLText=!0,Cr().lazyLoad();break}}this.queryPadding=0;for(const c in this.buckets){const f=this.buckets[c];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(c).queryRadius(f))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}else this.collisionBoxArray=new d.ad;else this.state="loaded"}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.dashPositions&&(this.dashPositions=null),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const o in this.buckets){const c=this.buckets[o];c.uploadPending()&&c.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new d.T(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new d.T(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,o,c,f,y,b,w,S,P,E){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:c,cameraQueryGeometry:f,scale:y,tileSize:this.tileSize,pixelPosMatrix:P,transform:w,params:b,queryPadding:this.queryPadding*S,getElevation:E},t,n,o):{}}querySourceFeatures(t,n){const o=this.latestFeatureIndex;if(!o||!o.rawTileData)return;const c=o.loadVTLayers(),f=n&&n.sourceLayer?n.sourceLayer:"",y=c[d.af]||c[f];if(!y)return;const b=d.ag(n?.filter,n?.globalState),{z:w,x:S,y:P}=this.tileID.canonical,E={z:w,x:S,y:P};for(let C=0;C<y.length;C++){const z=y.feature(C);if(b.needGeometry){const j=d.ah(z,!0);if(!b.filter(new d.H(this.tileID.overscaledZ),j,this.tileID.canonical))continue}else if(!b.filter(new d.H(this.tileID.overscaledZ),z))continue;const F=o.getId(z,f),V=new d.ai(z,w,S,P,F);V.tile=E,t.push(V)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const o=d.aj(t.cacheControl);o["max-age"]&&(this.expirationTime=Date.now()+1e3*o["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const o=Date.now();let c=!1;if(this.expirationTime>o)c=!1;else if(n)if(this.expirationTime<n)c=!0;else{const f=this.expirationTime-n;f?this.expirationTime=o+Math.max(f,3e4):c=!0}else c=!0;c?(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(),Math.pow(2,31)-1)}setFeatureState(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const o=this.latestFeatureIndex.loadVTLayers();for(const c in this.buckets){if(!n.style.hasLayer(c))continue;const f=this.buckets[c],y=f.layers[0].sourceLayer||d.af,b=o[y],w=t[y];if(!b||!w||Object.keys(w).length===0)continue;f.update(w,b,this.imageAtlas&&this.imageAtlas.patternPositions||{},this.dashPositions||{});const S=n&&n.style&&n.style.getLayer(c);S&&(this.queryPadding=Math.max(this.queryPadding,S.queryRadius(f)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Ze()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=Ze()+t}setDependencies(t,n){const o={};for(const c of n)o[c]=!0;this.dependencies[t]=o}hasDependency(t,n){for(const o of t){const c=this.dependencies[o];if(c){for(const f of n)if(c[f])return!0}}return!1}}class Io{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(t,n,o){const c=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][c]=this.stateChanges[t][c]||{},d.e(this.stateChanges[t][c],o),this.deletedStates[t]===null){this.deletedStates[t]={};for(const f in this.state[t])f!==c&&(this.deletedStates[t][f]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][c]===null){this.deletedStates[t][c]={};for(const f in this.state[t][c])o[f]||(this.deletedStates[t][c][f]=null)}else for(const f in o)this.deletedStates[t]&&this.deletedStates[t][c]&&this.deletedStates[t][c][f]===null&&delete this.deletedStates[t][c][f]}removeFeatureState(t,n,o){if(this.deletedStates[t]===null)return;const c=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},o&&n!==void 0)this.deletedStates[t][c]!==null&&(this.deletedStates[t][c]=this.deletedStates[t][c]||{},this.deletedStates[t][c][o]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][c])for(o in this.deletedStates[t][c]={},this.stateChanges[t][c])this.deletedStates[t][c][o]=null;else this.deletedStates[t][c]=null;else this.deletedStates[t]=null}getState(t,n){const o=String(n),c=d.e({},(this.state[t]||{})[o],(this.stateChanges[t]||{})[o]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const f=this.deletedStates[t][n];if(f===null)return{};for(const y in f)delete c[y]}return c}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const o={};for(const c in this.stateChanges){this.state[c]=this.state[c]||{};const f={};for(const y in this.stateChanges[c])this.state[c][y]||(this.state[c][y]={}),d.e(this.state[c][y],this.stateChanges[c][y]),f[y]=this.state[c][y];o[c]=f}for(const c in this.deletedStates){this.state[c]=this.state[c]||{};const f={};if(this.deletedStates[c]===null)for(const y in this.state[c])f[y]={},this.state[c][y]={};else for(const y in this.deletedStates[c]){if(this.deletedStates[c][y]===null)this.state[c][y]={};else for(const b of Object.keys(this.deletedStates[c][y]))delete this.state[c][y][b];f[y]=this.state[c][y]}o[c]=o[c]||{},d.e(o[c],f)}this.stateChanges={},this.deletedStates={},Object.keys(o).length!==0&&(this.revision++,t.setFeatureState(o,n))}}const Hr=89.25;function Xi(p,t){const n=d.ak(t.lat,-d.al,d.al);return new d.P(d.Y(t.lng)*p,d.X(n)*p)}function Cn(p,t){return new d.a6(t.x/p,t.y/p).toLngLat()}function Yr(p){return p.cameraToCenterDistance*Math.min(.85*Math.tan(d.am(90-p.pitch)),Math.tan(d.am(Hr-p.pitch)))}function ps(p,t){const n=p.canonical,o=t/d.an(n.z),c=n.x+Math.pow(2,n.z)*p.wrap,f=d.ao(new Float64Array(16));return d.O(f,f,[c*o,n.y*o,0]),d.Q(f,f,[o/d.a5,o/d.a5,1]),f}function pa(p,t,n,o,c){const f=d.a6.fromLngLat(p,t),y=c*d.ap(1,p.lat),{x:b,y:w,z:S}=fa(n,o);return new d.a6(f.x+y*-b,f.y+y*-w,f.z+y*-S)}function fa(p,t){const n=d.am(p),o=d.am(t),c=Math.cos(-n),f=Math.sin(n);return{x:f*Math.sin(o),y:-f*Math.cos(o),z:c}}function he(p,t,n){const o=t.intersectsFrustum(p);if(!n||o===0)return o;const c=t.intersectsPlane(n);return c===0?0:o===2&&c===2?2:1}function Mo(p,t,n){let o=0;const c=(n-t)/10;for(let f=0;f<10;f++)o+=c*Math.pow(Math.cos(t+(f+.5)/10*(n-t)),p);return o}function Eo(p,t){return function(n,o,c,f,y){const b=2*((p-1)/d.aq(Math.cos(d.am(Hr-y))/Math.cos(d.am(Hr)))-1),w=Math.acos(c/f),S=2*Mo(b-1,0,d.am(y/2)),P=Math.min(d.am(Hr),w+d.am(y/2)),E=Mo(b-1,Math.min(P,w-d.am(y/2)),P),C=Math.atan(o/c),z=Math.hypot(o,c);let F=n;return F+=d.aq(f/z/Math.max(.5,Math.cos(d.am(y/2)))),F+=b*d.aq(Math.cos(C))/2,F-=d.aq(Math.max(1,E/S/t))/2,F}}const tt=Eo(9.314,3);function yi(p,t){const n=(t.roundZoom?Math.round:Math.floor)(p.zoom+d.aq(p.tileSize/t.tileSize));return Math.max(0,n)}function Kr(p,t){const n=p.getCameraFrustum(),o=p.getClippingPlane(),c=p.screenPointToMercatorCoordinate(p.getCameraPoint()),f=d.a6.fromLngLat(p.center,p.elevation);c.z=f.z+Math.cos(p.pitchInRadians)*p.cameraToCenterDistance/p.worldSize;const y=p.getCoveringTilesDetailsProvider(),b=y.allowVariableZoom(p,t),w=yi(p,t),S=t.minzoom||0,P=t.maxzoom!==void 0?t.maxzoom:p.maxZoom,E=Math.min(Math.max(0,w),P),C=Math.pow(2,E),z=[C*c.x,C*c.y,0],F=[C*f.x,C*f.y,0],V=Math.hypot(f.x-c.x,f.y-c.y),j=Math.abs(f.z-c.z),N=Math.hypot(V,j),$=q=>({zoom:0,x:0,y:0,wrap:q,fullyVisible:!1}),W=[],G=[];if(p.renderWorldCopies&&y.allowWorldCopies())for(let q=1;q<=3;q++)W.push($(-q)),W.push($(q));for(W.push($(0));W.length>0;){const q=W.pop(),Y=q.x,Z=q.y;let Q=q.fullyVisible;const ae={x:Y,y:Z,z:q.zoom},oe=y.getTileBoundingVolume(ae,q.wrap,p.elevation,t);if(!Q){const fe=he(n,oe,o);if(fe===0)continue;Q=fe===2}const ie=y.distanceToTile2d(c.x,c.y,ae,oe);let ne=w;b&&(ne=(t.calculateTileZoom||tt)(p.zoom+d.aq(p.tileSize/t.tileSize),ie,j,N,p.fov)),ne=(t.roundZoom?Math.round:Math.floor)(ne),ne=Math.max(0,ne);const pe=Math.min(ne,P);if(q.wrap=y.getWrap(f,ae,q.wrap),q.zoom>=pe){if(q.zoom<S)continue;const fe=E-q.zoom,de=z[0]-.5-(Y<<fe),Pe=z[1]-.5-(Z<<fe),Me=t.reparseOverscaled?Math.max(q.zoom,ne):q.zoom;G.push({tileID:new d.a2(q.zoom===P?Me:q.zoom,q.wrap,q.zoom,Y,Z),distanceSq:d.ar([F[0]-.5-Y,F[1]-.5-Z]),tileDistanceToCamera:Math.sqrt(de*de+Pe*Pe)})}else for(let fe=0;fe<4;fe++)W.push({zoom:q.zoom+1,x:(Y<<1)+fe%2,y:(Z<<1)+(fe>>1),wrap:q.wrap,fullyVisible:Q})}return G.sort(((q,Y)=>q.distanceSq-Y.distanceSq)).map((q=>q.tileID))}const Jl=d.a7.fromPoints([new d.P(0,0),new d.P(d.a5,d.a5)]);function Ql(p){return p==="raster"||p==="image"||p==="video"}function Eu(p,t,n,o,c,f,y){if(!t.hasData())return!1;const{tileID:b,fadingRole:w,fadingDirection:S,fadingParentID:P}=t;if(w===or.Base&&S===Bi.Incoming&&P)return n[P.key]=P,!0;const E=Math.max(b.overscaledZ-c,f);for(let C=b.overscaledZ-1;C>=E;C--){const z=b.scaledTo(C),F=p.getLoadedTile(z);if(F)return t.setCrossFadeLogic({fadingRole:or.Base,fadingDirection:Bi.Incoming,fadingParentID:F.tileID,fadeEndTime:o+y}),F.setCrossFadeLogic({fadingRole:or.Parent,fadingDirection:Bi.Departing,fadeEndTime:o+y}),n[z.key]=z,!0}return!1}function ma(p,t,n,o,c,f){if(!t.hasData())return!1;const y=t.tileID.children(c);let b=Co(p,t,y,n,o,c,f);if(b)return!0;for(const w of y)Co(p,t,w.children(c),n,o,c,f)&&(b=!0);return b}function Co(p,t,n,o,c,f,y){if(n[0].overscaledZ>=f)return!1;let b=!1;for(const w of n){const S=p.getLoadedTile(w);if(!S)continue;const{fadingRole:P,fadingDirection:E,fadingParentID:C}=S;P===or.Base&&E===Bi.Departing&&C||(S.setCrossFadeLogic({fadingRole:or.Base,fadingDirection:Bi.Departing,fadingParentID:t.tileID,fadeEndTime:c+y}),t.setCrossFadeLogic({fadingRole:or.Parent,fadingDirection:Bi.Incoming,fadeEndTime:c+y})),o[w.key]=w,b=!0}return b}function ec(p,t,n,o){const c=p.tileID;return!!p.selfFading||!p.hasData()&&!!t.has(c)&&(p.setSelfFadeLogic(n+o),!0)}function xe(p,t){var n;p.needsHillshadePrepare=!0,p.needsTerrainPrepare=!0;let o=t.tileID.canonical.x-p.tileID.canonical.x;const c=t.tileID.canonical.y-p.tileID.canonical.y,f=Math.pow(2,p.tileID.canonical.z),y=t.tileID.key;o===0&&c===0||Math.abs(c)>1||(Math.abs(o)>1&&(Math.abs(o+f)===1?o+=f:Math.abs(o-f)===1&&(o-=f)),t.dem&&p.dem&&(p.dem.backfillBorder(t.dem,o,c),!((n=p.neighboringTiles)===null||n===void 0)&&n[y]&&(p.neighboringTiles[y].backfilled=!0)))}class Jr{constructor(){this._tiles={}}handleWrapJump(t){const n={};for(const o in this._tiles){const c=this._tiles[o];c.tileID=c.tileID.unwrapTo(c.tileID.wrap+t),n[c.tileID.key]=c}this._tiles=n}setFeatureState(t,n){for(const o in this._tiles)this._tiles[o].setFeatureState(t,n)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map((n=>n.tileID)).sort(d.at).map((n=>n.key)):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,n){this._tiles[t]=n}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){const n=this.getTileById(t.key);return n?.hasData()?n:null}isIdRenderable(t,n=!1){var o;return(o=this.getTileById(t))===null||o===void 0?void 0:o.isRenderable(n)}getRenderableIds(t=0,n){const o=[];for(const c of this.getAllIds())this.isIdRenderable(c,n)&&o.push(this.getTileById(c));return n?o.sort(((c,f)=>{const y=c.tileID,b=f.tileID,w=new d.P(y.canonical.x,y.canonical.y)._rotate(-t),S=new d.P(b.canonical.x,b.canonical.y)._rotate(-t);return y.overscaledZ-b.overscaledZ||S.y-w.y||S.x-w.x})).map((c=>c.tileID.key)):o.map((c=>c.tileID)).sort(d.at).map((c=>c.key))}}class Qt extends d.E{constructor(t,n,o){super(),this.id=t,this.dispatcher=o,this.on("data",(c=>this._dataHandler(c))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((c,f,y,b)=>{const w=new(Po(f.type))(c,f,y,b);if(w.id!==c)throw new Error(`Expected Source id to be ${c} instead of ${w.id}`);return w})(t,n,o,this),this._inViewTiles=new Jr,this._outOfViewCache=new d.au(0,(c=>this._unloadTile(c))),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new Io,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){for(const n of this._inViewTiles.getAllTiles())n.unloadVectorData();this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t),this._inViewTiles=new Jr}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(const t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n,o){return d._(this,void 0,void 0,(function*(){try{const c=yield this._source.loadTile(t);this._tileLoaded(t,n,o,c)}catch(c){t.state="errored",c.status!==404?this._source.fire(new d.k(c,{tile:t})):this.update(this.transform,this.terrain)}}))}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new d.l("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(const n of this._inViewTiles.getAllTiles())n.upload(t),n.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){var n;return this._inViewTiles.getRenderableIds((n=this.transform)===null||n===void 0?void 0:n.bearingInRadians,t)}hasRenderableParent(t){const n=t.overscaledZ-1;if(n>=this._source.minzoom){const o=this.getLoadedTile(t.scaledTo(n));if(o)return this._inViewTiles.isIdRenderable(o.tileID.key)}return!1}reload(t,n=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(const o of this._inViewTiles.getAllIds()){const c=this._inViewTiles.getTileById(o);n&&!this._source.shouldReloadTile(c,n)||(t?this._reloadTile(o,"expired"):c.state!=="errored"&&this._reloadTile(o,"reloading"))}}}_reloadTile(t,n){return d._(this,void 0,void 0,(function*(){const o=this._inViewTiles.getTileById(t);o&&(o.state!=="loading"&&(o.state=n),yield this._loadTile(o,t,n))}))}_tileLoaded(t,n,o,c){t.timeAdded=Ze(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration),o==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),c?.unmodified||(this.getSource().type==="raster-dem"&&t.dem&&(function(f,y){var b,w;const S=y.getRenderableIds();for(const P of S){if(!f.neighboringTiles||!f.neighboringTiles[P])continue;const E=y.getTileById(P);f.neighboringTiles[P].backfilled||xe(f,E),!((w=(b=E.neighboringTiles)===null||b===void 0?void 0:b[f.tileID.key])===null||w===void 0)&&w.backfilled||xe(E,f)}})(t,this._inViewTiles),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new d.l("data",{dataType:"source",tile:t,coord:t.tileID})))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,n){const o=this._getLoadedDescendents(n),c=new Set;for(const f of n){const y=o[f.key];if(!y?.length){c.add(f);continue}const b=f.overscaledZ+Qt.maxOverzooming,w=y.filter((E=>E.tileID.overscaledZ<=b));if(!w.length){c.add(f);continue}const S=Math.min(...w.map((E=>E.tileID.overscaledZ))),P=w.filter((E=>E.tileID.overscaledZ===S)).map((E=>E.tileID));for(const E of P)t[E.key]=E;this._areDescendentsComplete(P,S,f.overscaledZ)||c.add(f)}return c}_getLoadedDescendents(t){var n;const o={};for(const c of this._inViewTiles.getAllTiles().filter((f=>f.hasData())))for(const f of t)c.tileID.isChildOf(f)&&(o[n=f.key]||(o[n]=[])).push(c);return o}_areDescendentsComplete(t,n,o){return t.length===1&&t[0].isOverscaled()?t[0].overscaledZ===n:Math.pow(4,n-o)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,o=Math.ceil(t.height/this._source.tileSize)+1,c=Math.floor(n*o*(this._maxTileCacheZoomLevels===null?d.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),f=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,c):c;this._outOfViewCache.setMaxSize(f)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);this._prevLng=t,n&&(this._inViewTiles.handleWrapJump(n),this._resetTileReloadTimers())}update(t,n){if(!this._sourceLoaded||this._paused)return;let o;this.transform=t,this.terrain=n,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?o=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((w=>new d.a2(w.canonical.z,w.wrap,w.canonical.z,w.canonical.x,w.canonical.y))):(o=Kr(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type==="vector"&&this.map._zoomLevelsToOverscale!==void 0?t.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(o=o.filter((w=>this._source.hasTile(w))))):o=[],this.usedForTerrain&&(o=this._addTerrainIdealTiles(o));const c=o.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,c&&this.fire(new d.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const f=yi(t,this._source),y=this._updateRetainedTiles(o,f),b=Ql(this._source.type);b&&this._rasterFadeDuration>0&&!n&&(function(w,S,P,E,C,z,F){const V=Ze(),j=d.as(S);for(const N of S){const $=w.getTileById(N.key);$.fadingDirection!==Bi.Departing&&$.fadeOpacity!==0||$.resetFadeLogic(),Eu(w,$,P,V,E,C,F)||ma(w,$,P,V,z,F)||ec($,j,V,F)||$.resetFadeLogic()}})(this._inViewTiles,o,y,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),b?this._cleanUpRasterTiles(y):this._cleanUpVectorTiles(y)}_cleanUpRasterTiles(t){for(const n of this._inViewTiles.getAllIds())t[n]||this._removeTile(n)}_cleanUpVectorTiles(t){for(const n of this._inViewTiles.getAllIds()){const o=this._inViewTiles.getTileById(n);t[n]?o.clearSymbolFadeHold():o.hasSymbolBuckets?o.holdingForSymbolFade()?o.symbolFadeFinished()&&this._removeTile(n):o.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(n)}}_addTerrainIdealTiles(t){const n=[];for(const o of t)if(o.canonical.z>this._source.minzoom){const c=o.scaledTo(o.canonical.z-1);n.push(c);const f=o.scaledTo(Math.max(this._source.minzoom,Math.min(o.canonical.z,5)));n.push(f)}return t.concat(n)}releaseSymbolFadeTiles(){for(const t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){var o;const c=new Set;for(const S of t)this._addTile(S).hasData()||c.add(S);const f=t.reduce(((S,P)=>(S[P.key]=P,S)),{}),y=this._retainLoadedChildren(f,c),b={},w=Math.max(n-Qt.maxUnderzooming,this._source.minzoom);for(const S of y){let P=this._inViewTiles.getTileById(S.key),E=P?.wasRequested();for(let C=S.overscaledZ-1;C>=w;--C){const z=S.scaledTo(C);if(b[z.key])break;if(b[z.key]=!0,P=this.getTile(z),!P&&E&&(P=this._addTile(z)),P){const F=P.hasData();if((F||!(!((o=this.map)===null||o===void 0)&&o.cancelPendingTileRequestsWhileZooming)||E)&&(f[z.key]=z),E=P.wasRequested(),F)break}}}return f}_addTile(t){let n=this._inViewTiles.getTileById(t.key);if(n)return n;n=this._outOfViewCache.getAndRemove(t),n&&(n.resetFadeLogic(),this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null));const o=n;return n||(n=new En(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,t.key,n.state)),n.uses++,this._inViewTiles.setTile(t.key,n),o||this._source.fire(new d.l("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){this._clearTileReloadTimer(t);const o=n.getExpiryTimeout();o&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),o))}_clearTileReloadTimer(t){const n=this._timers[t];n&&(clearTimeout(n),delete this._timers[t])}_resetTileReloadTimers(){for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t of this._inViewTiles.getAllIds()){const n=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,n)}}refreshTiles(t){for(const n of this._inViewTiles.getAllIds()){const o=this._inViewTiles.getTileById(n);(this._inViewTiles.isIdRenderable(n)||o.state=="errored")&&t.some((c=>c.equals(o.tileID.canonical)))&&this._reloadTile(n,"expired")}}_removeTile(t){const n=this._inViewTiles.getTileById(t);n&&(n.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._outOfViewCache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}_dataHandler(t){t.dataType==="source"&&(t.sourceDataType!=="metadata"?t.sourceDataType==="content"&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,n,o){const c=[],f=this.transform;if(!f)return c;const y=f.getCoveringTilesDetailsProvider().allowWorldCopies(),b=o?f.getCameraQueryGeometry(t):t,w=z=>f.screenPointToMercatorCoordinate(z,this.terrain),S=this.transformBbox(t,w,!y),P=this.transformBbox(b,w,!y),E=this.getIds(),C=d.a7.fromPoints(P);for(let z=0;z<E.length;z++){const F=this._inViewTiles.getTileById(E[z]);if(F.holdingForSymbolFade())continue;const V=y?[F.tileID]:[F.tileID.unwrapTo(-1),F.tileID.unwrapTo(0)],j=Math.pow(2,f.zoom-F.tileID.overscaledZ),N=n*F.queryPadding*d.a5/F.tileSize/j;for(const $ of V){const W=C.map((G=>$.getTilePoint(new d.a6(G.x,G.y))));if(W.expandBy(N),W.intersects(Jl)){const G=S.map((Y=>$.getTilePoint(Y))),q=P.map((Y=>$.getTilePoint(Y)));c.push({tile:F,tileID:y?$:$.unwrapTo(0),queryGeometry:G,cameraQueryGeometry:q,scale:j})}}}return c}transformBbox(t,n,o){let c=t.map(n);if(o){const f=d.a7.fromPoints(t);f.shrinkBy(.001*Math.min(f.width(),f.height()));const y=f.map(n);d.a7.fromPoints(c).covers(y)||(c=c.map((b=>b.x>.5?new d.a6(b.x-1,b.y,b.z):b)))}return c}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map((o=>this._inViewTiles.getTileById(o).tileID));return this.transform&&this.transform.populateCache(n),n}hasTransition(){return!!this._source.hasTransition()||!(!Ql(this._source.type)||!(function(t,n){if(n<=0)return!1;const o=Ze();for(const c of t.getAllTiles())if(c.fadeEndTime>=o)return!0;return!1})(this._inViewTiles,this._rasterFadeDuration))}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,n,o){this._state.updateState(t=t||d.af,n,o)}removeFeatureState(t,n,o){this._state.removeFeatureState(t=t||d.af,n,o)}getFeatureState(t,n){return this._state.getState(t=t||d.af,n)}setDependencies(t,n,o){const c=this._inViewTiles.getTileById(t);c&&c.setDependencies(n,o)}reloadTilesForDependencies(t,n){for(const o of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(o).hasDependency(t,n)&&this._reloadTile(o,"reloading");this._outOfViewCache.filter((o=>!o.hasDependency(t,n)))}areTilesLoaded(){for(const t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}}Qt.maxUnderzooming=10,Qt.maxOverzooming=3;class Ao{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let o=1;o<this.points.length;o++)this._distances[o]=this._distances[o-1]+this.points[o].dist(this.points[o-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=d.ak(t,0,1);let n=1,o=this._distances[n];const c=t*this.paddedLength+this.padding;for(;o<c&&n<this._distances.length;)o=this._distances[++n];const f=n-1,y=this._distances[f],b=o-y,w=b>0?(c-y)/b:0;return this.points[f].mult(1-w).add(this.points[n].mult(w))}}function Ar(p,t){let n=!0;return p==="always"||p!=="never"&&t!=="never"||(n=!1),n}class ve{constructor(t,n,o){const c=this.boxCells=[],f=this.circleCells=[];this.xCellCount=Math.ceil(t/o),this.yCellCount=Math.ceil(n/o);for(let y=0;y<this.xCellCount*this.yCellCount;y++)c.push([]),f.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,o,c,f){this._forEachCell(n,o,c,f,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(o),this.bboxes.push(c),this.bboxes.push(f)}insertCircle(t,n,o,c){this._forEachCell(n-c,o-c,n+c,o+c,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(o),this.circles.push(c)}_insertBoxCell(t,n,o,c,f,y){this.boxCells[f].push(y)}_insertCircleCell(t,n,o,c,f,y){this.circleCells[f].push(y)}_query(t,n,o,c,f,y,b){if(o<0||t>this.width||c<0||n>this.height)return[];const w=[];if(t<=0&&n<=0&&this.width<=o&&this.height<=c){if(f)return[{key:null,x1:t,y1:n,x2:o,y2:c}];for(let S=0;S<this.boxKeys.length;S++)w.push({key:this.boxKeys[S],x1:this.bboxes[4*S],y1:this.bboxes[4*S+1],x2:this.bboxes[4*S+2],y2:this.bboxes[4*S+3]});for(let S=0;S<this.circleKeys.length;S++){const P=this.circles[3*S],E=this.circles[3*S+1],C=this.circles[3*S+2];w.push({key:this.circleKeys[S],x1:P-C,y1:E-C,x2:P+C,y2:E+C})}}else this._forEachCell(t,n,o,c,this._queryCell,w,{hitTest:f,overlapMode:y,seenUids:{box:{},circle:{}}},b);return w}query(t,n,o,c){return this._query(t,n,o,c,!1,null)}hitTest(t,n,o,c,f,y){return this._query(t,n,o,c,!0,f,y).length>0}hitTestCircle(t,n,o,c,f){const y=t-o,b=t+o,w=n-o,S=n+o;if(b<0||y>this.width||S<0||w>this.height)return!1;const P=[];return this._forEachCell(y,w,b,S,this._queryCellCircle,P,{hitTest:!0,overlapMode:c,circle:{x:t,y:n,radius:o},seenUids:{box:{},circle:{}}},f),P.length>0}_queryCell(t,n,o,c,f,y,b,w){const{seenUids:S,hitTest:P,overlapMode:E}=b,C=this.boxCells[f];if(C!==null){const F=this.bboxes;for(const V of C)if(!S.box[V]){S.box[V]=!0;const j=4*V,N=this.boxKeys[V];if(t<=F[j+2]&&n<=F[j+3]&&o>=F[j+0]&&c>=F[j+1]&&(!w||w(N))&&(!P||!Ar(E,N.overlapMode))&&(y.push({key:N,x1:F[j],y1:F[j+1],x2:F[j+2],y2:F[j+3]}),P))return!0}}const z=this.circleCells[f];if(z!==null){const F=this.circles;for(const V of z)if(!S.circle[V]){S.circle[V]=!0;const j=3*V,N=this.circleKeys[V];if(this._circleAndRectCollide(F[j],F[j+1],F[j+2],t,n,o,c)&&(!w||w(N))&&(!P||!Ar(E,N.overlapMode))){const $=F[j],W=F[j+1],G=F[j+2];if(y.push({key:N,x1:$-G,y1:W-G,x2:$+G,y2:W+G}),P)return!0}}}return!1}_queryCellCircle(t,n,o,c,f,y,b,w){const{circle:S,seenUids:P,overlapMode:E}=b,C=this.boxCells[f];if(C!==null){const F=this.bboxes;for(const V of C)if(!P.box[V]){P.box[V]=!0;const j=4*V,N=this.boxKeys[V];if(this._circleAndRectCollide(S.x,S.y,S.radius,F[j+0],F[j+1],F[j+2],F[j+3])&&(!w||w(N))&&!Ar(E,N.overlapMode))return y.push(!0),!0}}const z=this.circleCells[f];if(z!==null){const F=this.circles;for(const V of z)if(!P.circle[V]){P.circle[V]=!0;const j=3*V,N=this.circleKeys[V];if(this._circlesCollide(F[j],F[j+1],F[j+2],S.x,S.y,S.radius)&&(!w||w(N))&&!Ar(E,N.overlapMode))return y.push(!0),!0}}}_forEachCell(t,n,o,c,f,y,b,w){const S=this._convertToXCellCoord(t),P=this._convertToYCellCoord(n),E=this._convertToXCellCoord(o),C=this._convertToYCellCoord(c);for(let z=S;z<=E;z++)for(let F=P;F<=C;F++)if(f.call(this,t,n,o,c,this.xCellCount*F+z,y,b,w))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,o,c,f,y){const b=c-t,w=f-n,S=o+y;return S*S>b*b+w*w}_circleAndRectCollide(t,n,o,c,f,y,b){const w=(y-c)/2,S=Math.abs(t-(c+w));if(S>w+o)return!1;const P=(b-f)/2,E=Math.abs(n-(f+P));if(E>P+o)return!1;if(S<=w||E<=P)return!0;const C=S-w,z=E-P;return C*C+z*z<=o*o}}function ke(p,t,n){const o=d.N();if(!p){const{vecSouth:E,vecEast:C}=Pi(t),z=Tr();z[0]=C[0],z[1]=C[1],z[2]=E[0],z[3]=E[1],c=z,(P=(y=(f=z)[0])*(S=f[3])-(w=f[2])*(b=f[1]))&&(c[0]=S*(P=1/P),c[1]=-b*P,c[2]=-w*P,c[3]=y*P),o[0]=z[0],o[1]=z[1],o[4]=z[2],o[5]=z[3]}var c,f,y,b,w,S,P;return d.Q(o,o,[1/n,1/n,1]),o}function Oe(p,t,n,o){if(p){const c=d.N();if(!t){const{vecSouth:f,vecEast:y}=Pi(n);c[0]=y[0],c[1]=y[1],c[4]=f[0],c[5]=f[1]}return d.Q(c,c,[o,o,1]),c}return n.pixelsToClipSpaceMatrix}function Pi(p){const t=Math.cos(p.rollInRadians),n=Math.sin(p.rollInRadians),o=Math.cos(p.pitchInRadians),c=Math.cos(p.bearingInRadians),f=Math.sin(p.bearingInRadians),y=d.az();y[0]=-c*o*n-f*t,y[1]=-f*o*n+c*t;const b=d.aA(y);b<1e-9?d.aB(y):d.aC(y,y,1/b);const w=d.az();w[0]=c*o*t-f*n,w[1]=f*o*t+c*n;const S=d.aA(w);return S<1e-9?d.aB(w):d.aC(w,w,1/S),{vecEast:w,vecSouth:y}}function An(p,t,n,o){let c;o?(c=[p,t,o(p,t),1],d.aE(c,c,n)):(c=[p,t,0,1],_a(c,c,n));const f=c[3];return{point:new d.P(c[0]/f,c[1]/f),signedDistanceFromCamera:f,isOccluded:!1}}function Dr(p,t){return .5+p/t*.5}function Be(p,t){return p.x>=-t[0]&&p.x<=t[0]&&p.y>=-t[1]&&p.y<=t[1]}function ga(p,t,n,o,c,f,y,b,w,S,P,E,C){const z=n?p.textSizeData:p.iconSizeData,F=d.av(z,t.transform.zoom),V=[256/t.width*2+1,256/t.height*2+1],j=n?p.text.dynamicLayoutVertexArray:p.icon.dynamicLayoutVertexArray;j.clear();const N=p.lineVertexArray,$=n?p.text.placedSymbolArray:p.icon.placedSymbolArray,W=t.transform.width/t.transform.height;let G=!1;for(let q=0;q<$.length;q++){const Y=$.get(q);if(Y.hidden||Y.writingMode===d.aw.vertical&&!G){Ii(Y.numGlyphs,j);continue}G=!1;const Z=new d.P(Y.anchorX,Y.anchorY),Q={getElevation:C,pitchedLabelPlaneMatrix:o,lineVertexArray:N,pitchWithMap:f,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:Z,unwrappedTileID:w,width:S,height:P,translation:E},ae=pt(Y.anchorX,Y.anchorY,Q);if(!Be(ae.point,V)){Ii(Y.numGlyphs,j);continue}const oe=Dr(t.transform.cameraToCenterDistance,ae.signedDistanceFromCamera),ie=d.ax(z,F,Y),ne=f?ie*t.transform.getPitchedTextCorrection(Y.anchorX,Y.anchorY,w)/oe:ie*oe,pe=zn({projectionContext:Q,pitchedLabelPlaneMatrixInverse:c,symbol:Y,fontSize:ne,flip:!1,keepUpright:y,glyphOffsetArray:p.glyphOffsetArray,dynamicLayoutVertexArray:j,aspectRatio:W,rotateToLine:b});G=pe.useVertical,(pe.notEnoughRoom||G||pe.needsFlipping&&zn({projectionContext:Q,pitchedLabelPlaneMatrixInverse:c,symbol:Y,fontSize:ne,flip:!0,keepUpright:y,glyphOffsetArray:p.glyphOffsetArray,dynamicLayoutVertexArray:j,aspectRatio:W,rotateToLine:b}).notEnoughRoom)&&Ii(Y.numGlyphs,j)}n?p.text.dynamicLayoutVertexBuffer.updateData(j):p.icon.dynamicLayoutVertexBuffer.updateData(j)}function Dn(p,t,n,o,c,f,y,b){const w=f.glyphStartIndex+f.numGlyphs,S=f.lineStartIndex,P=f.lineStartIndex+f.lineLength,E=t.getoffsetX(f.glyphStartIndex),C=t.getoffsetX(w-1),z=kn(p*E,n,o,c,f.segment,S,P,b,y);if(!z)return null;const F=kn(p*C,n,o,c,f.segment,S,P,b,y);return F?b.projectionCache.anyProjectionOccluded?null:{first:z,last:F}:null}function fs(p,t,n,o){return p===d.aw.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*o?{useVertical:!0}:(p===d.aw.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function zn(p){const{projectionContext:t,pitchedLabelPlaneMatrixInverse:n,symbol:o,fontSize:c,flip:f,keepUpright:y,glyphOffsetArray:b,dynamicLayoutVertexArray:w,aspectRatio:S,rotateToLine:P}=p,E=c/24,C=o.lineOffsetX*E,z=o.lineOffsetY*E;let F;if(o.numGlyphs>1){const V=o.glyphStartIndex+o.numGlyphs,j=o.lineStartIndex,N=o.lineStartIndex+o.lineLength,$=Dn(E,b,C,z,f,o,P,t);if(!$)return{notEnoughRoom:!0};const W=$t($.first.point.x,$.first.point.y,t,n),G=$t($.last.point.x,$.last.point.y,t,n);if(y&&!f){const q=fs(o.writingMode,W,G,S);if(q)return q}F=[$.first];for(let q=o.glyphStartIndex+1;q<V-1;q++){const Y=kn(E*b.getoffsetX(q),C,z,f,o.segment,j,N,t,P);if(!Y)return{notEnoughRoom:!0};F.push(Y)}F.push($.last)}else{if(y&&!f){const j=ir(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,N=o.lineStartIndex+o.segment+1,$=new d.P(t.lineVertexArray.getx(N),t.lineVertexArray.gety(N)),W=ir($.x,$.y,t),G=W.signedDistanceFromCamera>0?W.point:ms(t.tileAnchorPoint,$,j,1,t),q=$t(j.x,j.y,t,n),Y=$t(G.x,G.y,t,n),Z=fs(o.writingMode,q,Y,S);if(Z)return Z}const V=kn(E*b.getoffsetX(o.glyphStartIndex),C,z,f,o.segment,o.lineStartIndex,o.lineStartIndex+o.lineLength,t,P);if(!V||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};F=[V]}for(const V of F)d.aD(w,V.point,V.angle);return{}}function ms(p,t,n,o,c){const f=p.add(p.sub(t)._unit()),y=ir(f.x,f.y,c).point,b=n.sub(y);return n.add(b._mult(o/b.mag()))}function Qr(p,t,n){const o=t.projectionCache;if(o.projections[p])return o.projections[p];const c=new d.P(t.lineVertexArray.getx(p),t.lineVertexArray.gety(p)),f=ir(c.x,c.y,t);if(f.signedDistanceFromCamera>0)return o.projections[p]=f.point,o.anyProjectionOccluded=o.anyProjectionOccluded||f.isOccluded,f.point;const y=p-n.direction;return ms(n.distanceFromAnchor===0?t.tileAnchorPoint:new d.P(t.lineVertexArray.getx(y),t.lineVertexArray.gety(y)),c,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,t)}function ir(p,t,n){const o=p+n.translation[0],c=t+n.translation[1];let f;return n.pitchWithMap?(f=An(o,c,n.pitchedLabelPlaneMatrix,n.getElevation),f.isOccluded=!1):(f=n.transform.projectTileCoordinates(o,c,n.unwrappedTileID,n.getElevation),f.point.x=(.5*f.point.x+.5)*n.width,f.point.y=(.5*-f.point.y+.5)*n.height),f}function $t(p,t,n,o){if(n.pitchWithMap){const c=[p,t,0,1];return d.aE(c,c,o),n.transform.projectTileCoordinates(c[0]/c[3],c[1]/c[3],n.unwrappedTileID,n.getElevation).point}return{x:p/n.width*2-1,y:1-t/n.height*2}}function pt(p,t,n){return n.transform.projectTileCoordinates(p,t,n.unwrappedTileID,n.getElevation)}function Do(p,t,n){return p._unit()._perp()._mult(t*n)}function gs(p,t,n,o,c,f,y,b,w){if(b.projectionCache.offsets[p])return b.projectionCache.offsets[p];const S=n.add(t);if(p+w.direction<o||p+w.direction>=c)return b.projectionCache.offsets[p]=S,S;const P=Qr(p+w.direction,b,w),E=Do(P.sub(n),y,w.direction),C=n.add(E),z=P.add(E);return b.projectionCache.offsets[p]=d.aF(f,S,C,z)||S,b.projectionCache.offsets[p]}function kn(p,t,n,o,c,f,y,b,w){const S=o?p-t:p+t;let P=S>0?1:-1,E=0;o&&(P*=-1,E=Math.PI),P<0&&(E+=Math.PI);let C,z=P>0?f+c:f+c+1;b.projectionCache.cachedAnchorPoint?C=b.projectionCache.cachedAnchorPoint:(C=ir(b.tileAnchorPoint.x,b.tileAnchorPoint.y,b).point,b.projectionCache.cachedAnchorPoint=C);let F,V,j=C,N=C,$=0,W=0;const G=Math.abs(S),q=[];let Y;for(;$+W<=G;){if(z+=P,z<f||z>=y)return null;$+=W,N=j,V=F;const ae={absOffsetX:G,direction:P,distanceFromAnchor:$,previousVertex:N};if(j=Qr(z,b,ae),n===0)q.push(N),Y=j.sub(N);else{let oe;const ie=j.sub(N);oe=ie.mag()===0?Do(Qr(z+P,b,ae).sub(j),n,P):Do(ie,n,P),V||(V=N.add(oe)),F=gs(z,oe,j,f,y,V,n,b,ae),q.push(V),Y=F.sub(V)}W=Y.mag()}const Z=Y._mult((G-$)/W)._add(V||N),Q=E+Math.atan2(j.y-N.y,j.x-N.x);return q.push(Z),{point:Z,angle:w?Q:0,path:q}}const en=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ii(p,t){for(let n=0;n<p;n++){const o=t.length;t.resize(o+4),t.float32.set(en,3*o)}}function _a(p,t,n){const o=t[0],c=t[1];return p[0]=n[0]*o+n[4]*c+n[12],p[1]=n[1]*o+n[5]*c+n[13],p[3]=n[3]*o+n[7]*c+n[15],p}const Ot=100;class tc{constructor(t,n=new ve(t.width+200,t.height+200,25),o=new ve(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=o,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Ot,this.screenBottomBoundary=t.height+Ot,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,o,c,f,y,b,w,S,P,E,C){const z=this.projectAndGetPerspectiveRatio(t.anchorPointX+w[0],t.anchorPointY+w[1],f,P,C),F=o*z.perspectiveRatio;let V;if(y||b)V=this._projectCollisionBox(t,F,c,f,y,b,w,z,P,E,C);else{const Y=z.x+(E?E.x*F:0),Z=z.y+(E?E.y*F:0);V={allPointsOccluded:!1,box:[Y+t.x1*F,Z+t.y1*F,Y+t.x2*F,Z+t.y2*F]}}const[j,N,$,W]=V.box,G=y?V.allPointsOccluded:z.isOccluded;let q=G;return q||(q=z.perspectiveRatio<this.perspectiveRatioCutoff),q||(q=!this.isInsideGrid(j,N,$,W)),q||n!=="always"&&this.grid.hitTest(j,N,$,W,n,S)?{box:[j,N,$,W],placeable:!1,offscreen:!1,occluded:G}:{box:[j,N,$,W],placeable:!0,offscreen:this.isOffscreen(j,N,$,W),occluded:G}}placeCollisionCircles(t,n,o,c,f,y,b,w,S,P,E,C,z,F){const V=[],j=new d.P(n.anchorX,n.anchorY),N=this.getPerspectiveRatio(j.x,j.y,y,F),$=(S?f*this.transform.getPitchedTextCorrection(n.anchorX,n.anchorY,y)/N:f*N)/d.aJ,W={getElevation:F,pitchedLabelPlaneMatrix:b,lineVertexArray:o,pitchWithMap:S,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:j,unwrappedTileID:y,width:this.transform.width,height:this.transform.height,translation:z},G=Dn($,c,n.lineOffsetX*$,n.lineOffsetY*$,!1,n,!1,W);let q=!1,Y=!1,Z=!0;if(G){const Q=.5*E*N+C,ae=new d.P(-100,-100),oe=new d.P(this.screenRightBoundary,this.screenBottomBoundary),ie=new Ao,ne=G.first,pe=G.last;let fe=[];for(let Me=ne.path.length-1;Me>=1;Me--)fe.push(ne.path[Me]);for(let Me=1;Me<pe.path.length;Me++)fe.push(pe.path[Me]);const de=2.5*Q;if(S){const Me=this.projectPathToScreenSpace(fe,W);fe=Me.some((et=>et.signedDistanceFromCamera<=0))?[]:Me.map((et=>et.point))}let Pe=[];if(fe.length>0){const Me=fe[0].clone(),et=fe[0].clone();for(let ht=1;ht<fe.length;ht++)Me.x=Math.min(Me.x,fe[ht].x),Me.y=Math.min(Me.y,fe[ht].y),et.x=Math.max(et.x,fe[ht].x),et.y=Math.max(et.y,fe[ht].y);Pe=Me.x>=ae.x&&et.x<=oe.x&&Me.y>=ae.y&&et.y<=oe.y?[fe]:et.x<ae.x||Me.x>oe.x||et.y<ae.y||Me.y>oe.y?[]:d.aG([fe],ae.x,ae.y,oe.x,oe.y)}for(const Me of Pe){ie.reset(Me,.25*Q);let et=0;et=ie.length<=.5*Q?1:Math.ceil(ie.paddedLength/de)+1;for(let ht=0;ht<et;ht++){const ct=ht/Math.max(et-1,1),ft=ie.lerp(ct),ot=ft.x+Ot,Rt=ft.y+Ot;V.push(ot,Rt,Q,0);const lt=ot-Q,Zt=Rt-Q,At=ot+Q,Ft=Rt+Q;if(Z=Z&&this.isOffscreen(lt,Zt,At,Ft),Y=Y||this.isInsideGrid(lt,Zt,At,Ft),t!=="always"&&this.grid.hitTestCircle(ot,Rt,Q,t,P)&&(q=!0,!w))return{circles:[],offscreen:!1,collisionDetected:q}}}}return{circles:!w&&q||!Y||N<this.perspectiveRatioCutoff?[]:V,offscreen:Z,collisionDetected:q}}projectPathToScreenSpace(t,n){const o=(function(c,f){const y=d.N();return d.ay(y,f.pitchedLabelPlaneMatrix),c.map((b=>{const w=An(b.x,b.y,y,f.getElevation),S=f.transform.projectTileCoordinates(w.point.x,w.point.y,f.unwrappedTileID,f.getElevation);return S.point.x=(.5*S.point.x+.5)*f.width,S.point.y=(.5*-S.point.y+.5)*f.height,S}))})(t,n);return(function(c){let f=0,y=0,b=0,w=0;for(let S=0;S<c.length;S++)c[S].isOccluded?(b=S+1,w=0):(w++,w>y&&(y=w,f=b));return c.slice(f,f+y)})(o)}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[],o=new d.a7;for(const E of t){const C=new d.P(E.x+Ot,E.y+Ot);o.extend(C),n.push(C)}const{minX:c,minY:f,maxX:y,maxY:b}=o,w=this.grid.query(c,f,y,b).concat(this.ignoredGrid.query(c,f,y,b)),S={},P={};for(const E of w){const C=E.key;if(S[C.bucketInstanceId]===void 0&&(S[C.bucketInstanceId]={}),S[C.bucketInstanceId][C.featureIndex])continue;const z=[new d.P(E.x1,E.y1),new d.P(E.x2,E.y1),new d.P(E.x2,E.y2),new d.P(E.x1,E.y2)];d.aH(n,z)&&(S[C.bucketInstanceId][C.featureIndex]=!0,P[C.bucketInstanceId]===void 0&&(P[C.bucketInstanceId]=[]),P[C.bucketInstanceId].push(C.featureIndex))}return P}insertCollisionBox(t,n,o,c,f,y){(o?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:f,collisionGroupID:y,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,o,c,f,y){const b=o?this.ignoredGrid:this.grid,w={bucketInstanceId:c,featureIndex:f,collisionGroupID:y,overlapMode:n};for(let S=0;S<t.length;S+=4)b.insertCircle(w,t[S],t[S+1],t[S+2])}projectAndGetPerspectiveRatio(t,n,o,c,f){if(f){let y;c?(y=[t,n,c(t,n),1],d.aE(y,y,f)):(y=[t,n,0,1],_a(y,y,f));const b=y[3];return{x:(y[0]/b+1)/2*this.transform.width+Ot,y:(-y[1]/b+1)/2*this.transform.height+Ot,perspectiveRatio:.5+this.transform.cameraToCenterDistance/b*.5,isOccluded:!1,signedDistanceFromCamera:b}}{const y=this.transform.projectTileCoordinates(t,n,o,c);return{x:(y.point.x+1)/2*this.transform.width+Ot,y:(1-y.point.y)/2*this.transform.height+Ot,perspectiveRatio:.5+this.transform.cameraToCenterDistance/y.signedDistanceFromCamera*.5,isOccluded:y.isOccluded,signedDistanceFromCamera:y.signedDistanceFromCamera}}}getPerspectiveRatio(t,n,o,c){const f=this.transform.projectTileCoordinates(t,n,o,c);return .5+this.transform.cameraToCenterDistance/f.signedDistanceFromCamera*.5}isOffscreen(t,n,o,c){return o<Ot||t>=this.screenRightBoundary||c<Ot||n>this.screenBottomBoundary}isInsideGrid(t,n,o,c){return o>=0&&t<this.gridRightBoundary&&c>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=d.ao([]);return d.O(t,t,[-100,-100,0]),t}_projectCollisionBox(t,n,o,c,f,y,b,w,S,P,E){let C=1,z=0,F=0,V=1;const j=t.anchorPointX+b[0],N=t.anchorPointY+b[1];if(y&&!f){const fe=this.projectAndGetPerspectiveRatio(j+1,N,c,S,E),de=fe.x-w.x,Pe=Math.atan((fe.y-w.y)/de)+(de<0?Math.PI:0),Me=Math.sin(Pe),et=Math.cos(Pe);C=et,z=Me,F=-Me,V=et}else if(!y&&f){const fe=Pi(this.transform);C=fe.vecEast[0],z=fe.vecEast[1],F=fe.vecSouth[0],V=fe.vecSouth[1]}let $=w.x,W=w.y,G=n;f&&($=j,W=N,G=Math.pow(2,-(this.transform.zoom-o.overscaledZ)),G*=this.transform.getPitchedTextCorrection(j,N,c),P||(G*=d.ak(.5+w.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),P&&($+=C*P.x*G+F*P.y*G,W+=z*P.x*G+V*P.y*G);const q=t.x1*G,Y=t.x2*G,Z=(q+Y)/2,Q=t.y1*G,ae=t.y2*G,oe=(Q+ae)/2,ie=[{offsetX:q,offsetY:Q},{offsetX:Z,offsetY:Q},{offsetX:Y,offsetY:Q},{offsetX:Y,offsetY:oe},{offsetX:Y,offsetY:ae},{offsetX:Z,offsetY:ae},{offsetX:q,offsetY:ae},{offsetX:q,offsetY:oe}];let ne=[];for(const{offsetX:fe,offsetY:de}of ie)ne.push(new d.P($+C*fe+F*de,W+z*fe+V*de));let pe=!1;if(f){const fe=ne.map((de=>this.projectAndGetPerspectiveRatio(de.x,de.y,c,S,E)));pe=fe.some((de=>!de.isOccluded)),ne=fe.map((de=>new d.P(de.x,de.y)))}else pe=!0;return{box:d.aI(ne),allPointsOccluded:!pe}}}class tn{constructor(t,n,o,c){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):c&&o?1:0,this.placed=o}isHidden(){return this.opacity===0&&!this.placed}}class Rn{constructor(t,n,o,c,f){this.text=new tn(t?t.text:null,n,o,f),this.icon=new tn(t?t.icon:null,n,c,f)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ic{constructor(t,n,o){this.text=t,this.icon=n,this.skipFade=o}}class Cu{constructor(t,n,o,c,f){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=o,this.bucketIndex=c,this.tileID=f}}class Au{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:o=>o.collisionGroupID===n}}return this.collisionGroups[t]}}function zo(p,t,n,o,c){const{horizontalAlign:f,verticalAlign:y}=d.aP(p);return new d.P(-(f-.5)*t+o[0]*c,-(y-.5)*n+o[1]*c)}class rc{constructor(t,n,o,c,f){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new tc(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new Au(c),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=f,f&&(f.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const n=this.terrain;return n?(o,c)=>n.getElevation(t,o,c):null}getBucketParts(t,n,o,c){const f=o.getBucket(n),y=o.latestFeatureIndex;if(!f||!y||n.id!==f.layerIds[0])return;const b=o.collisionBoxArray,w=f.layers[0].layout,S=f.layers[0].paint,P=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),E=o.tileSize/d.a5,C=o.tileID.toUnwrapped(),z=w.get("text-rotation-alignment")==="map",F=d.aK(o,1,this.transform.zoom),V=d.aL(this.collisionIndex.transform,o,S.get("text-translate"),S.get("text-translate-anchor")),j=d.aL(this.collisionIndex.transform,o,S.get("icon-translate"),S.get("icon-translate-anchor")),N=ke(z,this.transform,F);this.retainedQueryData[f.bucketInstanceId]=new Cu(f.bucketInstanceId,y,f.sourceLayerIndex,f.index,o.tileID);const $={bucket:f,layout:w,translationText:V,translationIcon:j,unwrappedTileID:C,pitchedLabelPlaneMatrix:N,scale:P,textPixelRatio:E,holdingForFade:o.holdingForSymbolFade(),collisionBoxArray:b,partiallyEvaluatedTextSize:d.av(f.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(f.sourceID)};if(c)for(const W of f.sortKeyRanges){const{sortKey:G,symbolInstanceStart:q,symbolInstanceEnd:Y}=W;t.push({sortKey:G,symbolInstanceStart:q,symbolInstanceEnd:Y,parameters:$})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:f.symbolInstances.length,parameters:$})}attemptAnchorPlacement(t,n,o,c,f,y,b,w,S,P,E,C,z,F,V,j,N,$,W,G){const q=d.aM[t.textAnchor],Y=[t.textOffset0,t.textOffset1],Z=zo(q,o,c,Y,f),Q=this.collisionIndex.placeCollisionBox(n,C,w,S,P,b,y,j,E.predicate,W,Z,G);if((!$||this.collisionIndex.placeCollisionBox($,C,w,S,P,b,y,N,E.predicate,W,Z,G).placeable)&&Q.placeable){let ae;if(this.prevPlacement&&this.prevPlacement.variableOffsets[z.crossTileID]&&this.prevPlacement.placements[z.crossTileID]&&this.prevPlacement.placements[z.crossTileID].text&&(ae=this.prevPlacement.variableOffsets[z.crossTileID].anchor),z.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[z.crossTileID]={textOffset:Y,width:o,height:c,anchor:q,textBoxScale:f,prevAnchor:ae},this.markUsedJustification(F,q,z,V),F.allowVerticalPlacement&&(this.markUsedOrientation(F,V,z),this.placedOrientations[z.crossTileID]=V),{shift:Z,placedGlyphBoxes:Q}}}placeLayerBucketPart(t,n,o){const{bucket:c,layout:f,translationText:y,translationIcon:b,unwrappedTileID:w,pitchedLabelPlaneMatrix:S,textPixelRatio:P,holdingForFade:E,collisionBoxArray:C,partiallyEvaluatedTextSize:z,collisionGroup:F}=t.parameters,V=f.get("text-optional"),j=f.get("icon-optional"),N=d.aN(f,"text-overlap","text-allow-overlap"),$=N==="always",W=d.aN(f,"icon-overlap","icon-allow-overlap"),G=W==="always",q=f.get("text-rotation-alignment")==="map",Y=f.get("text-pitch-alignment")==="map",Z=f.get("icon-text-fit")!=="none",Q=f.get("symbol-z-order")==="viewport-y",ae=$&&(G||!c.hasIconData()||j),oe=G&&($||!c.hasTextData()||V);!c.collisionArrays&&C&&c.deserializeCollisionBoxes(C);const ie=this.retainedQueryData[c.bucketInstanceId].tileID,ne=this._getTerrainElevationFunc(ie),pe=this.transform.getFastPathSimpleProjectionMatrix(ie),fe=(de,Pe,Me)=>{var et,ht;if(n[de.crossTileID])return;if(E)return void(this.placements[de.crossTileID]=new ic(!1,!1,!1));let ct=!1,ft=!1,ot=!0,Rt=null,lt={box:null,placeable:!1,offscreen:null,occluded:!1},Zt={placeable:!1},At=null,Ft=null,si=null,sr=0,Vr=0,pr=0;Pe.textFeatureIndex?sr=Pe.textFeatureIndex:de.useRuntimeCollisionCircles&&(sr=de.featureIndex),Pe.verticalTextFeatureIndex&&(Vr=Pe.verticalTextFeatureIndex);const fr=Pe.textBox;if(fr){const Ai=mt=>{let dt=d.aw.horizontal;if(c.allowVerticalPlacement&&!mt&&this.prevPlacement){const Dt=this.prevPlacement.placedOrientations[de.crossTileID];Dt&&(this.placedOrientations[de.crossTileID]=Dt,dt=Dt,this.markUsedOrientation(c,dt,de))}return dt},jr=(mt,dt)=>{if(c.allowVerticalPlacement&&de.numVerticalGlyphVertices>0&&Pe.verticalTextBox){for(const Dt of c.writingModes)if(Dt===d.aw.vertical?(lt=dt(),Zt=lt):lt=mt(),lt&&lt.placeable)break}else lt=mt()},mr=de.textAnchorOffsetStartIndex,gr=de.textAnchorOffsetEndIndex;if(gr===mr){const mt=(dt,Dt)=>{const gt=this.collisionIndex.placeCollisionBox(dt,N,P,ie,w,Y,q,y,F.predicate,ne,void 0,pe);return gt&&gt.placeable&&(this.markUsedOrientation(c,Dt,de),this.placedOrientations[de.crossTileID]=Dt),gt};jr((()=>mt(fr,d.aw.horizontal)),(()=>{const dt=Pe.verticalTextBox;return c.allowVerticalPlacement&&de.numVerticalGlyphVertices>0&&dt?mt(dt,d.aw.vertical):{box:null,offscreen:null}})),Ai(lt&&lt.placeable)}else{let mt=d.aM[(ht=(et=this.prevPlacement)===null||et===void 0?void 0:et.variableOffsets[de.crossTileID])===null||ht===void 0?void 0:ht.anchor];const dt=(gt,Hc,Yc)=>{const Kc=gt.x2-gt.x1,_n=gt.y2-gt.y1,nh=de.textBoxScale,Jc=Z&&W==="never"?Hc:null;let _r=null,zl=N==="never"?1:2,Nr="never";mt&&zl++;for(let Ur=0;Ur<zl;Ur++){for(let Ha=mr;Ha<gr;Ha++){const Qc=c.textAnchorOffsets.get(Ha);if(mt&&Qc.textAnchor!==mt)continue;const ra=this.attemptAnchorPlacement(Qc,gt,Kc,_n,nh,q,Y,P,ie,w,F,Nr,de,c,Yc,y,b,Jc,ne);if(ra&&(_r=ra.placedGlyphBoxes,_r&&_r.placeable))return ct=!0,Rt=ra.shift,_r}mt?mt=null:Nr=N}return o&&!_r&&(_r={box:this.collisionIndex.placeCollisionBox(fr,"always",P,ie,w,Y,q,y,F.predicate,ne,void 0,pe).box,offscreen:!1,placeable:!1,occluded:!1}),_r};jr((()=>dt(fr,Pe.iconBox,d.aw.horizontal)),(()=>{const gt=Pe.verticalTextBox;return c.allowVerticalPlacement&&(!lt||!lt.placeable)&&de.numVerticalGlyphVertices>0&&gt?dt(gt,Pe.verticalIconBox,d.aw.vertical):{box:null,occluded:!0,offscreen:null}})),lt&&(ct=lt.placeable,ot=lt.offscreen);const Dt=Ai(lt&&lt.placeable);if(!ct&&this.prevPlacement){const gt=this.prevPlacement.variableOffsets[de.crossTileID];gt&&(this.variableOffsets[de.crossTileID]=gt,this.markUsedJustification(c,gt.anchor,de,Dt))}}}if(At=lt,ct=At&&At.placeable,ot=At&&At.offscreen,de.useRuntimeCollisionCircles&&de.centerJustifiedTextSymbolIndex>=0){const Ai=c.text.placedSymbolArray.get(de.centerJustifiedTextSymbolIndex),jr=d.ax(c.textSizeData,z,Ai),mr=f.get("text-padding");Ft=this.collisionIndex.placeCollisionCircles(N,Ai,c.lineVertexArray,c.glyphOffsetArray,jr,w,S,o,Y,F.predicate,de.collisionCircleDiameter,mr,y,ne),Ft.circles.length&&Ft.collisionDetected&&!o&&d.w("Collisions detected, but collision boxes are not shown"),ct=$||Ft.circles.length>0&&!Ft.collisionDetected,ot=ot&&Ft.offscreen}if(Pe.iconFeatureIndex&&(pr=Pe.iconFeatureIndex),Pe.iconBox){const Ai=jr=>this.collisionIndex.placeCollisionBox(jr,W,P,ie,w,Y,q,b,F.predicate,ne,Z&&Rt?Rt:void 0,pe);Zt&&Zt.placeable&&Pe.verticalIconBox?(si=Ai(Pe.verticalIconBox),ft=si.placeable):(si=Ai(Pe.iconBox),ft=si.placeable),ot=ot&&si.offscreen}const Gi=V||de.numHorizontalGlyphVertices===0&&de.numVerticalGlyphVertices===0,mn=j||de.numIconVertices===0;Gi||mn?mn?Gi||(ft=ft&&ct):ct=ft&&ct:ft=ct=ft&&ct;const gn=ft&&si.placeable;if(ct&&At.placeable&&this.collisionIndex.insertCollisionBox(At.box,N,f.get("text-ignore-placement"),c.bucketInstanceId,Zt&&Zt.placeable&&Vr?Vr:sr,F.ID),gn&&this.collisionIndex.insertCollisionBox(si.box,W,f.get("icon-ignore-placement"),c.bucketInstanceId,pr,F.ID),Ft&&ct&&this.collisionIndex.insertCollisionCircles(Ft.circles,N,f.get("text-ignore-placement"),c.bucketInstanceId,sr,F.ID),o&&this.storeCollisionData(c.bucketInstanceId,Me,Pe,At,si,Ft),de.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(c.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[de.crossTileID]=new ic((ct||ae)&&!At?.occluded,(ft||oe)&&!si?.occluded,ot||c.justReloaded),n[de.crossTileID]=!0};if(Q){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const de=c.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let Pe=de.length-1;Pe>=0;--Pe){const Me=de[Pe];fe(c.symbolInstances.get(Me),c.collisionArrays[Me],Me)}}else for(let de=t.symbolInstanceStart;de<t.symbolInstanceEnd;de++)fe(c.symbolInstances.get(de),c.collisionArrays[de],de);c.justReloaded=!1}storeCollisionData(t,n,o,c,f,y){if(o.textBox||o.iconBox){let b,w;this.collisionBoxArrays.has(t)?b=this.collisionBoxArrays.get(t):(b=new Map,this.collisionBoxArrays.set(t,b)),b.has(n)?w=b.get(n):(w={text:null,icon:null},b.set(n,w)),o.textBox&&(w.text=c.box),o.iconBox&&(w.icon=f.box)}if(y){let b=this.collisionCircleArrays[t];b===void 0&&(b=this.collisionCircleArrays[t]=[]);for(let w=0;w<y.circles.length;w+=4)b.push(y.circles[w+0]-Ot),b.push(y.circles[w+1]-Ot),b.push(y.circles[w+2]),b.push(y.collisionDetected?1:0)}}markUsedJustification(t,n,o,c){let f;f=c===d.aw.vertical?o.verticalPlacedTextSymbolIndex:{left:o.leftJustifiedTextSymbolIndex,center:o.centerJustifiedTextSymbolIndex,right:o.rightJustifiedTextSymbolIndex}[d.aO(n)];const y=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex,o.verticalPlacedTextSymbolIndex];for(const b of y)b>=0&&(t.text.placedSymbolArray.get(b).crossTileID=f>=0&&b!==f?0:o.crossTileID)}markUsedOrientation(t,n,o){const c=n===d.aw.horizontal||n===d.aw.horizontalOnly?n:0,f=n===d.aw.vertical?n:0,y=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex];for(const b of y)t.text.placedSymbolArray.get(b).placedOrientation=c;o.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).placedOrientation=f)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let o=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const c=n?n.symbolFadeChange(t):1,f=n?n.opacities:{},y=n?n.variableOffsets:{},b=n?n.placedOrientations:{};for(const w in this.placements){const S=this.placements[w],P=f[w];P?(this.opacities[w]=new Rn(P,c,S.text,S.icon),o=o||S.text!==P.text.placed||S.icon!==P.icon.placed):(this.opacities[w]=new Rn(null,c,S.text,S.icon,S.skipFade),o=o||S.text||S.icon)}for(const w in f){const S=f[w];if(!this.opacities[w]){const P=new Rn(S,c,!1,!1);P.isHidden()||(this.opacities[w]=P,o=o||S.text.placed||S.icon.placed)}}for(const w in y)this.variableOffsets[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.variableOffsets[w]=y[w]);for(const w in b)this.placedOrientations[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.placedOrientations[w]=b[w]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");o?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const o={};for(const c of n){const f=c.getBucket(t);f&&c.latestFeatureIndex&&t.id===f.layerIds[0]&&this.updateBucketOpacities(f,c.tileID,o,c.collisionBoxArray)}}updateBucketOpacities(t,n,o,c){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const f=t.layers[0],y=f.layout,b=new Rn(null,0,!1,!1,!0),w=y.get("text-allow-overlap"),S=y.get("icon-allow-overlap"),P=f._unevaluatedLayout.hasValue("text-variable-anchor")||f._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=y.get("text-rotation-alignment")==="map",C=y.get("text-pitch-alignment")==="map",z=y.get("icon-text-fit")!=="none",F=new Rn(null,0,w&&(S||!t.hasIconData()||y.get("icon-optional")),S&&(w||!t.hasTextData()||y.get("text-optional")),!0);!t.collisionArrays&&c&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(c);const V=(N,$,W)=>{for(let G=0;G<$/4;G++)N.opacityVertexArray.emplaceBack(W);N.hasVisibleVertices=N.hasVisibleVertices||W!==rr},j=this.collisionBoxArrays.get(t.bucketInstanceId);for(let N=0;N<t.symbolInstances.length;N++){const $=t.symbolInstances.get(N),{numHorizontalGlyphVertices:W,numVerticalGlyphVertices:G,crossTileID:q}=$;let Y=this.opacities[q];o[q]?Y=b:Y||(Y=F,this.opacities[q]=Y),o[q]=!0;const Z=$.numIconVertices>0,Q=this.placedOrientations[$.crossTileID],ae=Q===d.aw.vertical,oe=Q===d.aw.horizontal||Q===d.aw.horizontalOnly;if(W>0||G>0){const ne=Lo(Y.text);V(t.text,W,ae?rr:ne),V(t.text,G,oe?rr:ne);const pe=Y.text.isHidden();[$.rightJustifiedTextSymbolIndex,$.centerJustifiedTextSymbolIndex,$.leftJustifiedTextSymbolIndex].forEach((Pe=>{Pe>=0&&(t.text.placedSymbolArray.get(Pe).hidden=pe||ae?1:0)})),$.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get($.verticalPlacedTextSymbolIndex).hidden=pe||oe?1:0);const fe=this.variableOffsets[$.crossTileID];fe&&this.markUsedJustification(t,fe.anchor,$,Q);const de=this.placedOrientations[$.crossTileID];de&&(this.markUsedJustification(t,"left",$,de),this.markUsedOrientation(t,de,$))}if(Z){const ne=Lo(Y.icon),pe=!(z&&$.verticalPlacedIconSymbolIndex&&ae);$.placedIconSymbolIndex>=0&&(V(t.icon,$.numIconVertices,pe?ne:rr),t.icon.placedSymbolArray.get($.placedIconSymbolIndex).hidden=Y.icon.isHidden()),$.verticalPlacedIconSymbolIndex>=0&&(V(t.icon,$.numVerticalIconVertices,pe?rr:ne),t.icon.placedSymbolArray.get($.verticalPlacedIconSymbolIndex).hidden=Y.icon.isHidden())}const ie=j&&j.has(N)?j.get(N):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const ne=t.collisionArrays[N];if(ne){let pe=new d.P(0,0);if(ne.textBox||ne.verticalTextBox){let fe=!0;if(P){const de=this.variableOffsets[q];de?(pe=zo(de.anchor,de.width,de.height,de.textOffset,de.textBoxScale),E&&pe._rotate(C?-this.transform.bearingInRadians:this.transform.bearingInRadians)):fe=!1}if(ne.textBox||ne.verticalTextBox){let de;ne.textBox&&(de=ae),ne.verticalTextBox&&(de=oe),ya(t.textCollisionBox.collisionVertexArray,Y.text.placed,!fe||de,ie.text,pe.x,pe.y)}}if(ne.iconBox||ne.verticalIconBox){const fe=!!(!oe&&ne.verticalIconBox);let de;ne.iconBox&&(de=fe),ne.verticalIconBox&&(de=!fe),ya(t.iconCollisionBox.collisionVertexArray,Y.icon.placed,de,ie.icon,z?pe.x:0,z?pe.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const o=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*o>t}setStale(){this.stale=!0}}function ya(p,t,n,o,c,f){o&&o.length!==0||(o=[0,0,0,0]);const y=o[0]-Ot,b=o[1]-Ot,w=o[2]-Ot,S=o[3]-Ot;p.emplaceBack(t?1:0,n?1:0,c||0,f||0,y,b),p.emplaceBack(t?1:0,n?1:0,c||0,f||0,w,b),p.emplaceBack(t?1:0,n?1:0,c||0,f||0,w,S),p.emplaceBack(t?1:0,n?1:0,c||0,f||0,y,S)}const ko=Math.pow(2,25),nc=Math.pow(2,24),Ro=Math.pow(2,17),Fo=Math.pow(2,16),Du=Math.pow(2,9),_s=Math.pow(2,8),xa=Math.pow(2,1);function Lo(p){if(p.opacity===0&&!p.placed)return 0;if(p.opacity===1&&p.placed)return 4294967295;const t=p.placed?1:0,n=Math.floor(127*p.opacity);return n*ko+t*nc+n*Ro+t*Fo+n*Du+t*_s+n*xa+t}const rr=0;class sc{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,o,c,f){const y=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(y,c,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,f())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,y.sort(((b,w)=>b.sortKey-w.sortKey)));this._currentPartIndex<y.length;)if(n.placeLayerBucketPart(y[this._currentPartIndex],this._seenCrossTileIDs,o),this._currentPartIndex++,f())return!0;return!1}}class zu{constructor(t,n,o,c,f,y,b,w){this.placement=new rc(t,n,y,b,w),this._currentPlacementIndex=o.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=f,this._done=!1}isDone(){return this._done}continuePlacement(t,n,o){const c=Ze(),f=()=>!this._forceFullPlacement&&Ze()-c>2;for(;this._currentPlacementIndex>=0;){const y=n[t[this._currentPlacementIndex]],b=this.placement.collisionIndex.transform.zoom;if(d.aQ(y)&&y.layout&&(!y.minzoom||y.minzoom<=b)&&(!y.maxzoom||y.maxzoom>b)){if(this._inProgressLayer||(this._inProgressLayer=new sc(y)),this._inProgressLayer.continuePlacement(o[y.source],this.placement,this._showCollisionBoxes,y,f))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Oi=512/d.a5/2;class Fn{constructor(t,n,o){this.tileID=t,this.bucketInstanceId=o,this._symbolsByKey={};const c=new Map;for(let f=0;f<n.length;f++){const y=n.get(f),b=y.key,w=c.get(b);w?w.push(y):c.set(b,[y])}for(const[f,y]of c){const b={positions:y.map((w=>({x:Math.floor(w.anchorX*Oi),y:Math.floor(w.anchorY*Oi)}))),crossTileIDs:y.map((w=>w.crossTileID))};if(b.positions.length>128){const w=new d.aR(b.positions.length,16,Uint16Array);for(const{x:S,y:P}of b.positions)w.add(S,P);w.finish(),delete b.positions,b.index=w}this._symbolsByKey[f]=b}}getScaledCoordinates(t,n){const{x:o,y:c,z:f}=this.tileID.canonical,{x:y,y:b,z:w}=n.canonical,S=Oi/Math.pow(2,w-f),P=(b*d.a5+t.anchorY)*S,E=c*d.a5*Oi;return{x:Math.floor((y*d.a5+t.anchorX)*S-o*d.a5*Oi),y:Math.floor(P-E)}}findMatches(t,n,o){const c=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let f=0;f<t.length;f++){const y=t.get(f);if(y.crossTileID)continue;const b=this._symbolsByKey[y.key];if(!b)continue;const w=this.getScaledCoordinates(y,n);if(b.index){const S=b.index.range(w.x-c,w.y-c,w.x+c,w.y+c).sort();for(const P of S){const E=b.crossTileIDs[P];if(!o[E]){o[E]=!0,y.crossTileID=E;break}}}else if(b.positions)for(let S=0;S<b.positions.length;S++){const P=b.positions[S],E=b.crossTileIDs[S];if(Math.abs(P.x-w.x)<=c&&Math.abs(P.y-w.y)<=c&&!o[E]){o[E]=!0,y.crossTileID=E;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class Ne{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Bo{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const o in this.indexes){const c=this.indexes[o],f={};for(const y in c){const b=c[y];b.tileID=b.tileID.unwrapTo(b.tileID.wrap+n),f[b.tileID.key]=b}this.indexes[o]=f}this.lng=t}addBucket(t,n,o){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let f=0;f<n.symbolInstances.length;f++)n.symbolInstances.get(f).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const c=this.usedCrossTileIDs[t.overscaledZ];for(const f in this.indexes){const y=this.indexes[f];if(Number(f)>t.overscaledZ)for(const b in y){const w=y[b];w.tileID.isChildOf(t)&&w.findMatches(n.symbolInstances,t,c)}else{const b=y[t.scaledTo(Number(f)).key];b&&b.findMatches(n.symbolInstances,t,c)}}for(let f=0;f<n.symbolInstances.length;f++){const y=n.symbolInstances.get(f);y.crossTileID||(y.crossTileID=o.generate(),c[y.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Fn(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const o of n.getCrossTileIDsLists())for(const c of o)delete this.usedCrossTileIDs[t][c]}removeStaleBuckets(t){let n=!1;for(const o in this.indexes){const c=this.indexes[o];for(const f in c)t[c[f].bucketInstanceId]||(this.removeBucketCrossTileIDs(o,c[f]),delete c[f],n=!0)}return n}}class ac{constructor(){this.layerIndexes={},this.crossTileIDs=new Ne,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,o){let c=this.layerIndexes[t.id];c===void 0&&(c=this.layerIndexes[t.id]=new Bo);let f=!1;const y={};c.handleWrapJump(o);for(const b of n){const w=b.getBucket(t);w&&t.id===w.layerIds[0]&&(w.bucketInstanceId||(w.bucketInstanceId=++this.maxBucketInstanceId),c.addBucket(b.tileID,w,this.crossTileIDs)&&(f=!0),y[w.bucketInstanceId]=!0)}return c.removeStaleBuckets(y)&&(f=!0),f}pruneUnusedLayers(t){const n={};t.forEach((o=>{n[o]=!0}));for(const o in this.layerIndexes)n[o]||delete this.layerIndexes[o]}}var va="void main() {fragColor=vec4(1.0);}";const Mt={prelude:De(`#ifdef GL_ES
3
- precision mediump float;
4
- #else
5
- #if !defined(lowp)
6
- #define lowp
7
- #endif
8
- #if !defined(mediump)
9
- #define mediump
10
- #endif
11
- #if !defined(highp)
12
- #define highp
13
- #endif
14
- #endif
15
- out highp vec4 fragColor;`,`#ifdef GL_ES
16
- precision highp float;
17
- #else
18
- #if !defined(lowp)
19
- #define lowp
20
- #endif
21
- #if !defined(mediump)
22
- #define mediump
23
- #endif
24
- #if !defined(highp)
25
- #define highp
26
- #endif
27
- #endif
28
- vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
29
- );}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c
30
- );}
31
- #ifdef TERRAIN3D
32
- uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
33
- #endif
34
- const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
35
- #ifdef TERRAIN3D
36
- highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
37
- #else
38
- return 1.0;
39
- #endif
40
- }float calculate_visibility(vec4 pos) {
41
- #ifdef TERRAIN3D
42
- vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
43
- #else
44
- return 1.0;
45
- #endif
46
- }float ele(vec2 pos) {
47
- #ifdef TERRAIN3D
48
- vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
49
- #else
50
- return 0.0;
51
- #endif
52
- }float get_elevation(vec2 pos) {
53
- #ifdef TERRAIN3D
54
- #ifdef GLOBE
55
- if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
56
- #endif
57
- vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
58
- #else
59
- return 0.0;
60
- #endif
61
- }const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:De("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:De("",`#define GLOBE_RADIUS 6371008.8
62
- uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos
63
- );}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);
64
- if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len
65
- );if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:De(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
66
- #ifdef OVERDRAW_INSPECTOR
67
- fragColor=vec4(1.0);
68
- #endif
69
- }`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:De(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;
70
- #ifdef OVERDRAW_INSPECTOR
71
- fragColor=vec4(1.0);
72
- #endif
73
- }`,"uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:De(`in vec3 v_data;in float v_visibility;
74
- #pragma mapbox: define highp vec4 color
75
- #pragma mapbox: define mediump float radius
76
- #pragma mapbox: define lowp float blur
77
- #pragma mapbox: define lowp float opacity
78
- #pragma mapbox: define highp vec4 stroke_color
79
- #pragma mapbox: define mediump float stroke_width
80
- #pragma mapbox: define lowp float stroke_opacity
81
- void main() {
82
- #pragma mapbox: initialize highp vec4 color
83
- #pragma mapbox: initialize mediump float radius
84
- #pragma mapbox: initialize lowp float blur
85
- #pragma mapbox: initialize lowp float opacity
86
- #pragma mapbox: initialize highp vec4 stroke_color
87
- #pragma mapbox: initialize mediump float stroke_width
88
- #pragma mapbox: initialize lowp float stroke_opacity
89
- vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}
90
- #ifdef OVERDRAW_INSPECTOR
91
- fragColor=vec4(1.0);
92
- #endif
93
- }`,`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;
94
- #pragma mapbox: define highp vec4 color
95
- #pragma mapbox: define mediump float radius
96
- #pragma mapbox: define lowp float blur
97
- #pragma mapbox: define lowp float opacity
98
- #pragma mapbox: define highp vec4 stroke_color
99
- #pragma mapbox: define mediump float stroke_width
100
- #pragma mapbox: define lowp float stroke_opacity
101
- void main(void) {
102
- #pragma mapbox: initialize highp vec4 color
103
- #pragma mapbox: initialize mediump float radius
104
- #pragma mapbox: initialize lowp float blur
105
- #pragma mapbox: initialize lowp float opacity
106
- #pragma mapbox: initialize highp vec4 stroke_color
107
- #pragma mapbox: initialize mediump float stroke_width
108
- #pragma mapbox: initialize lowp float stroke_opacity
109
- vec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {
110
- #ifdef GLOBE
111
- vec3 center_vector=projectToSphere(circle_center);
112
- #endif
113
- float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {
114
- #ifdef GLOBE
115
- vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
116
- #else
117
- vec4 projected_center=projectTileWithElevation(circle_center,ele);
118
- #endif
119
- corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}
120
- #ifdef GLOBE
121
- vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
122
- #else
123
- gl_Position=projectTileWithElevation(corner_position,ele);
124
- #endif
125
- } else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:De(va,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:De(`uniform highp float u_intensity;in vec2 v_extrude;
126
- #pragma mapbox: define highp float weight
127
- #define GAUSS_COEF 0.3989422804014327
128
- void main() {
129
- #pragma mapbox: initialize highp float weight
130
- float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);
131
- #ifdef OVERDRAW_INSPECTOR
132
- fragColor=vec4(1.0);
133
- #endif
134
- }`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;
135
- #pragma mapbox: define highp float weight
136
- #pragma mapbox: define mediump float radius
137
- const highp float ZERO=1.0/255.0/16.0;
138
- #define GAUSS_COEF 0.3989422804014327
139
- void main(void) {
140
- #pragma mapbox: initialize highp float weight
141
- #pragma mapbox: initialize mediump float radius
142
- vec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);
143
- #ifdef GLOBE
144
- vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);
145
- #else
146
- gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
147
- #endif
148
- }`),heatmapTexture:De(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;
149
- #ifdef OVERDRAW_INSPECTOR
150
- fragColor=vec4(0.0);
151
- #endif
152
- }`,"uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:De("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:De("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:De(`#ifdef GL_ES
153
- precision highp float;
154
- #endif
155
- uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else
156
- {l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));
157
- #ifdef OVERDRAW_INSPECTOR
158
- fragColor=vec4(1.0);
159
- #endif
160
- }`,"uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:De("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:De(va,`in vec2 a_pos;void main() {
161
- #ifdef GLOBE
162
- gl_Position=projectTileFor3D(a_pos,0.0);
163
- #else
164
- gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
165
- #endif
166
- }`),fill:De(`#pragma mapbox: define highp vec4 color
167
- #pragma mapbox: define lowp float opacity
168
- void main() {
169
- #pragma mapbox: initialize highp vec4 color
170
- #pragma mapbox: initialize lowp float opacity
171
- fragColor=color*opacity;
172
- #ifdef OVERDRAW_INSPECTOR
173
- fragColor=vec4(1.0);
174
- #endif
175
- }`,`uniform vec2 u_fill_translate;in vec2 a_pos;
176
- #pragma mapbox: define highp vec4 color
177
- #pragma mapbox: define lowp float opacity
178
- void main() {
179
- #pragma mapbox: initialize highp vec4 color
180
- #pragma mapbox: initialize lowp float opacity
181
- gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:De(`in vec2 v_pos;
182
- #ifdef GLOBE
183
- in float v_depth;
184
- #endif
185
- #pragma mapbox: define highp vec4 outline_color
186
- #pragma mapbox: define lowp float opacity
187
- void main() {
188
- #pragma mapbox: initialize highp vec4 outline_color
189
- #pragma mapbox: initialize lowp float opacity
190
- float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
191
- #ifdef GLOBE
192
- if (v_depth > 1.0) {discard;}
193
- #endif
194
- #ifdef OVERDRAW_INSPECTOR
195
- fragColor=vec4(1.0);
196
- #endif
197
- }`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
198
- #ifdef GLOBE
199
- out float v_depth;
200
- #endif
201
- #pragma mapbox: define highp vec4 outline_color
202
- #pragma mapbox: define lowp float opacity
203
- void main() {
204
- #pragma mapbox: initialize highp vec4 outline_color
205
- #pragma mapbox: initialize lowp float opacity
206
- gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
207
- #ifdef GLOBE
208
- v_depth=gl_Position.z/gl_Position.w;
209
- #endif
210
- }`),fillOutlinePattern:De(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;
211
- #ifdef GLOBE
212
- in float v_depth;
213
- #endif
214
- #pragma mapbox: define lowp float opacity
215
- #pragma mapbox: define lowp vec4 pattern_from
216
- #pragma mapbox: define lowp vec4 pattern_to
217
- void main() {
218
- #pragma mapbox: initialize lowp float opacity
219
- #pragma mapbox: initialize mediump vec4 pattern_from
220
- #pragma mapbox: initialize mediump vec4 pattern_to
221
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;
222
- #ifdef GLOBE
223
- if (v_depth > 1.0) {discard;}
224
- #endif
225
- #ifdef OVERDRAW_INSPECTOR
226
- fragColor=vec4(1.0);
227
- #endif
228
- }`,`uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;
229
- #ifdef GLOBE
230
- out float v_depth;
231
- #endif
232
- #pragma mapbox: define lowp float opacity
233
- #pragma mapbox: define lowp vec4 pattern_from
234
- #pragma mapbox: define lowp vec4 pattern_to
235
- #pragma mapbox: define lowp float pixel_ratio_from
236
- #pragma mapbox: define lowp float pixel_ratio_to
237
- void main() {
238
- #pragma mapbox: initialize lowp float opacity
239
- #pragma mapbox: initialize mediump vec4 pattern_from
240
- #pragma mapbox: initialize mediump vec4 pattern_to
241
- #pragma mapbox: initialize lowp float pixel_ratio_from
242
- #pragma mapbox: initialize lowp float pixel_ratio_to
243
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
244
- #ifdef GLOBE
245
- v_depth=gl_Position.z/gl_Position.w;
246
- #endif
247
- }`),fillPattern:De(`#ifdef GL_ES
248
- precision highp float;
249
- #endif
250
- uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
251
- #pragma mapbox: define lowp float opacity
252
- #pragma mapbox: define lowp vec4 pattern_from
253
- #pragma mapbox: define lowp vec4 pattern_to
254
- void main() {
255
- #pragma mapbox: initialize lowp float opacity
256
- #pragma mapbox: initialize mediump vec4 pattern_from
257
- #pragma mapbox: initialize mediump vec4 pattern_to
258
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;
259
- #ifdef OVERDRAW_INSPECTOR
260
- fragColor=vec4(1.0);
261
- #endif
262
- }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;
263
- #pragma mapbox: define lowp float opacity
264
- #pragma mapbox: define lowp vec4 pattern_from
265
- #pragma mapbox: define lowp vec4 pattern_to
266
- #pragma mapbox: define lowp float pixel_ratio_from
267
- #pragma mapbox: define lowp float pixel_ratio_to
268
- void main() {
269
- #pragma mapbox: initialize lowp float opacity
270
- #pragma mapbox: initialize mediump vec4 pattern_from
271
- #pragma mapbox: initialize mediump vec4 pattern_to
272
- #pragma mapbox: initialize lowp float pixel_ratio_from
273
- #pragma mapbox: initialize lowp float pixel_ratio_to
274
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:De(`in vec4 v_color;void main() {fragColor=v_color;
275
- #ifdef OVERDRAW_INSPECTOR
276
- fragColor=vec4(1.0);
277
- #endif
278
- }`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;
279
- #ifdef TERRAIN3D
280
- in vec2 a_centroid;
281
- #endif
282
- out vec4 v_color;
283
- #pragma mapbox: define highp float base
284
- #pragma mapbox: define highp float height
285
- #pragma mapbox: define highp vec4 color
286
- void main() {
287
- #pragma mapbox: initialize highp float base
288
- #pragma mapbox: initialize highp float height
289
- #pragma mapbox: initialize highp vec4 color
290
- vec3 normal=a_normal_ed.xyz;
291
- #ifdef TERRAIN3D
292
- float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
293
- #else
294
- float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
295
- #endif
296
- base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
297
- #ifdef GLOBE
298
- vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
299
- #else
300
- gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
301
- #endif
302
- float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);
303
- #ifdef GLOBE
304
- mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
305
- #endif
306
- directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:De(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;
307
- #pragma mapbox: define lowp float base
308
- #pragma mapbox: define lowp float height
309
- #pragma mapbox: define lowp vec4 pattern_from
310
- #pragma mapbox: define lowp vec4 pattern_to
311
- #pragma mapbox: define lowp float pixel_ratio_from
312
- #pragma mapbox: define lowp float pixel_ratio_to
313
- void main() {
314
- #pragma mapbox: initialize lowp float base
315
- #pragma mapbox: initialize lowp float height
316
- #pragma mapbox: initialize mediump vec4 pattern_from
317
- #pragma mapbox: initialize mediump vec4 pattern_to
318
- #pragma mapbox: initialize lowp float pixel_ratio_from
319
- #pragma mapbox: initialize lowp float pixel_ratio_to
320
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;
321
- #ifdef OVERDRAW_INSPECTOR
322
- fragColor=vec4(1.0);
323
- #endif
324
- }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;
325
- #ifdef TERRAIN3D
326
- in vec2 a_centroid;
327
- #endif
328
- #ifdef GLOBE
329
- out vec3 v_sphere_pos;
330
- #endif
331
- out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
332
- #pragma mapbox: define lowp float base
333
- #pragma mapbox: define lowp float height
334
- #pragma mapbox: define lowp vec4 pattern_from
335
- #pragma mapbox: define lowp vec4 pattern_to
336
- #pragma mapbox: define lowp float pixel_ratio_from
337
- #pragma mapbox: define lowp float pixel_ratio_to
338
- void main() {
339
- #pragma mapbox: initialize lowp float base
340
- #pragma mapbox: initialize lowp float height
341
- #pragma mapbox: initialize mediump vec4 pattern_from
342
- #pragma mapbox: initialize mediump vec4 pattern_to
343
- #pragma mapbox: initialize lowp float pixel_ratio_from
344
- #pragma mapbox: initialize lowp float pixel_ratio_to
345
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
346
- #ifdef TERRAIN3D
347
- float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
348
- #else
349
- float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
350
- #endif
351
- base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
352
- #ifdef GLOBE
353
- vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
354
- #else
355
- gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
356
- #endif
357
- vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
358
- ? a_pos
359
- : vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:De(`#ifdef GL_ES
360
- precision highp float;
361
- #endif
362
- uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);
363
- #ifdef OVERDRAW_INSPECTOR
364
- fragColor=vec4(1.0);
365
- #endif
366
- }`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:De(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];
367
- #define PI 3.141592653589793
368
- #define STANDARD 0
369
- #define COMBINED 1
370
- #define IGOR 2
371
- #define MULTIDIRECTIONAL 3
372
- #define BASIC 4
373
- float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else
374
- {fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else
375
- {fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}
376
- #ifdef OVERDRAW_INSPECTOR
377
- fragColor=vec4(1.0);
378
- #endif
379
- }`,"uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:De(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
380
- #ifdef GLOBE
381
- in float v_depth;
382
- #endif
383
- #pragma mapbox: define highp vec4 color
384
- #pragma mapbox: define lowp float blur
385
- #pragma mapbox: define lowp float opacity
386
- void main() {
387
- #pragma mapbox: initialize highp vec4 color
388
- #pragma mapbox: initialize lowp float blur
389
- #pragma mapbox: initialize lowp float opacity
390
- float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);
391
- #ifdef GLOBE
392
- if (v_depth > 1.0) {discard;}
393
- #endif
394
- #ifdef OVERDRAW_INSPECTOR
395
- fragColor=vec4(1.0);
396
- #endif
397
- }`,`
398
- #define scale 0.015873016
399
- in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
400
- #ifdef GLOBE
401
- out float v_depth;
402
- #endif
403
- #pragma mapbox: define highp vec4 color
404
- #pragma mapbox: define lowp float blur
405
- #pragma mapbox: define lowp float opacity
406
- #pragma mapbox: define mediump float gapwidth
407
- #pragma mapbox: define lowp float offset
408
- #pragma mapbox: define mediump float width
409
- void main() {
410
- #pragma mapbox: initialize highp vec4 color
411
- #pragma mapbox: initialize lowp float blur
412
- #pragma mapbox: initialize lowp float opacity
413
- #pragma mapbox: initialize mediump float gapwidth
414
- #pragma mapbox: initialize lowp float offset
415
- #pragma mapbox: initialize mediump float width
416
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
417
- #ifdef GLOBE
418
- v_depth=gl_Position.z/gl_Position.w;
419
- #endif
420
- #ifdef TERRAIN3D
421
- v_gamma_scale=1.0;
422
- #else
423
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
424
- #endif
425
- v_width2=vec2(outset,inset);}`),lineGradient:De(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
426
- #ifdef GLOBE
427
- in float v_depth;
428
- #endif
429
- #pragma mapbox: define lowp float blur
430
- #pragma mapbox: define lowp float opacity
431
- void main() {
432
- #pragma mapbox: initialize lowp float blur
433
- #pragma mapbox: initialize lowp float opacity
434
- float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);
435
- #ifdef GLOBE
436
- if (v_depth > 1.0) {discard;}
437
- #endif
438
- #ifdef OVERDRAW_INSPECTOR
439
- fragColor=vec4(1.0);
440
- #endif
441
- }`,`
442
- #define scale 0.015873016
443
- in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
444
- #ifdef GLOBE
445
- out float v_depth;
446
- #endif
447
- #pragma mapbox: define lowp float blur
448
- #pragma mapbox: define lowp float opacity
449
- #pragma mapbox: define mediump float gapwidth
450
- #pragma mapbox: define lowp float offset
451
- #pragma mapbox: define mediump float width
452
- void main() {
453
- #pragma mapbox: initialize lowp float blur
454
- #pragma mapbox: initialize lowp float opacity
455
- #pragma mapbox: initialize mediump float gapwidth
456
- #pragma mapbox: initialize lowp float offset
457
- #pragma mapbox: initialize mediump float width
458
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
459
- #ifdef GLOBE
460
- v_depth=gl_Position.z/gl_Position.w;
461
- #endif
462
- #ifdef TERRAIN3D
463
- v_gamma_scale=1.0;
464
- #else
465
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
466
- #endif
467
- v_width2=vec2(outset,inset);}`),linePattern:De(`#ifdef GL_ES
468
- precision highp float;
469
- #endif
470
- uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;
471
- #ifdef GLOBE
472
- in float v_depth;
473
- #endif
474
- #pragma mapbox: define lowp vec4 pattern_from
475
- #pragma mapbox: define lowp vec4 pattern_to
476
- #pragma mapbox: define lowp float pixel_ratio_from
477
- #pragma mapbox: define lowp float pixel_ratio_to
478
- #pragma mapbox: define lowp float blur
479
- #pragma mapbox: define lowp float opacity
480
- void main() {
481
- #pragma mapbox: initialize mediump vec4 pattern_from
482
- #pragma mapbox: initialize mediump vec4 pattern_to
483
- #pragma mapbox: initialize lowp float pixel_ratio_from
484
- #pragma mapbox: initialize lowp float pixel_ratio_to
485
- #pragma mapbox: initialize lowp float blur
486
- #pragma mapbox: initialize lowp float opacity
487
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;
488
- #ifdef GLOBE
489
- if (v_depth > 1.0) {discard;}
490
- #endif
491
- #ifdef OVERDRAW_INSPECTOR
492
- fragColor=vec4(1.0);
493
- #endif
494
- }`,`
495
- #define scale 0.015873016
496
- #define LINE_DISTANCE_SCALE 2.0
497
- in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;
498
- #ifdef GLOBE
499
- out float v_depth;
500
- #endif
501
- #pragma mapbox: define lowp float blur
502
- #pragma mapbox: define lowp float opacity
503
- #pragma mapbox: define lowp float offset
504
- #pragma mapbox: define mediump float gapwidth
505
- #pragma mapbox: define mediump float width
506
- #pragma mapbox: define lowp float floorwidth
507
- #pragma mapbox: define lowp vec4 pattern_from
508
- #pragma mapbox: define lowp vec4 pattern_to
509
- #pragma mapbox: define lowp float pixel_ratio_from
510
- #pragma mapbox: define lowp float pixel_ratio_to
511
- void main() {
512
- #pragma mapbox: initialize lowp float blur
513
- #pragma mapbox: initialize lowp float opacity
514
- #pragma mapbox: initialize lowp float offset
515
- #pragma mapbox: initialize mediump float gapwidth
516
- #pragma mapbox: initialize mediump float width
517
- #pragma mapbox: initialize lowp float floorwidth
518
- #pragma mapbox: initialize mediump vec4 pattern_from
519
- #pragma mapbox: initialize mediump vec4 pattern_to
520
- #pragma mapbox: initialize lowp float pixel_ratio_from
521
- #pragma mapbox: initialize lowp float pixel_ratio_to
522
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
523
- #ifdef GLOBE
524
- v_depth=gl_Position.z/gl_Position.w;
525
- #endif
526
- #ifdef TERRAIN3D
527
- v_gamma_scale=1.0;
528
- #else
529
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
530
- #endif
531
- v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:De(`uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;
532
- #ifdef GLOBE
533
- in float v_depth;
534
- #endif
535
- #pragma mapbox: define highp vec4 color
536
- #pragma mapbox: define lowp float blur
537
- #pragma mapbox: define lowp float opacity
538
- #pragma mapbox: define mediump float width
539
- #pragma mapbox: define lowp float floorwidth
540
- #pragma mapbox: define mediump vec4 dasharray_from
541
- #pragma mapbox: define mediump vec4 dasharray_to
542
- void main() {
543
- #pragma mapbox: initialize highp vec4 color
544
- #pragma mapbox: initialize lowp float blur
545
- #pragma mapbox: initialize lowp float opacity
546
- #pragma mapbox: initialize mediump float width
547
- #pragma mapbox: initialize lowp float floorwidth
548
- #pragma mapbox: initialize mediump vec4 dasharray_from
549
- #pragma mapbox: initialize mediump vec4 dasharray_to
550
- float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);
551
- #ifdef GLOBE
552
- if (v_depth > 1.0) {discard;}
553
- #endif
554
- #ifdef OVERDRAW_INSPECTOR
555
- fragColor=vec4(1.0);
556
- #endif
557
- }`,`
558
- #define scale 0.015873016
559
- #define LINE_DISTANCE_SCALE 2.0
560
- in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
561
- #ifdef GLOBE
562
- out float v_depth;
563
- #endif
564
- #pragma mapbox: define highp vec4 color
565
- #pragma mapbox: define lowp float blur
566
- #pragma mapbox: define lowp float opacity
567
- #pragma mapbox: define mediump float gapwidth
568
- #pragma mapbox: define lowp float offset
569
- #pragma mapbox: define mediump float width
570
- #pragma mapbox: define lowp float floorwidth
571
- #pragma mapbox: define mediump vec4 dasharray_from
572
- #pragma mapbox: define mediump vec4 dasharray_to
573
- void main() {
574
- #pragma mapbox: initialize highp vec4 color
575
- #pragma mapbox: initialize lowp float blur
576
- #pragma mapbox: initialize lowp float opacity
577
- #pragma mapbox: initialize mediump float gapwidth
578
- #pragma mapbox: initialize lowp float offset
579
- #pragma mapbox: initialize mediump float width
580
- #pragma mapbox: initialize lowp float floorwidth
581
- #pragma mapbox: initialize mediump vec4 dasharray_from
582
- #pragma mapbox: initialize mediump vec4 dasharray_to
583
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
584
- #ifdef GLOBE
585
- v_depth=gl_Position.z/gl_Position.w;
586
- #endif
587
- #ifdef TERRAIN3D
588
- v_gamma_scale=1.0;
589
- #else
590
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
591
- #endif
592
- float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),lineGradientSDF:De(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;
593
- #ifdef GLOBE
594
- in float v_depth;
595
- #endif
596
- #pragma mapbox: define lowp float blur
597
- #pragma mapbox: define lowp float opacity
598
- #pragma mapbox: define mediump float width
599
- #pragma mapbox: define lowp float floorwidth
600
- #pragma mapbox: define mediump vec4 dasharray_from
601
- #pragma mapbox: define mediump vec4 dasharray_to
602
- void main() {
603
- #pragma mapbox: initialize lowp float blur
604
- #pragma mapbox: initialize lowp float opacity
605
- #pragma mapbox: initialize mediump float width
606
- #pragma mapbox: initialize lowp float floorwidth
607
- #pragma mapbox: initialize mediump vec4 dasharray_from
608
- #pragma mapbox: initialize mediump vec4 dasharray_to
609
- float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);
610
- #ifdef GLOBE
611
- if (v_depth > 1.0) {discard;}
612
- #endif
613
- #ifdef OVERDRAW_INSPECTOR
614
- fragColor=vec4(1.0);
615
- #endif
616
- }`,`
617
- #define scale 0.015873016
618
- #define LINE_DISTANCE_SCALE 2.0
619
- in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;
620
- #ifdef GLOBE
621
- out float v_depth;
622
- #endif
623
- #pragma mapbox: define lowp float blur
624
- #pragma mapbox: define lowp float opacity
625
- #pragma mapbox: define mediump float gapwidth
626
- #pragma mapbox: define lowp float offset
627
- #pragma mapbox: define mediump float width
628
- #pragma mapbox: define lowp float floorwidth
629
- #pragma mapbox: define mediump vec4 dasharray_from
630
- #pragma mapbox: define mediump vec4 dasharray_to
631
- void main() {
632
- #pragma mapbox: initialize lowp float blur
633
- #pragma mapbox: initialize lowp float opacity
634
- #pragma mapbox: initialize mediump float gapwidth
635
- #pragma mapbox: initialize lowp float offset
636
- #pragma mapbox: initialize mediump float width
637
- #pragma mapbox: initialize lowp float floorwidth
638
- #pragma mapbox: initialize mediump vec4 dasharray_from
639
- #pragma mapbox: initialize mediump vec4 dasharray_to
640
- float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
641
- #ifdef GLOBE
642
- v_depth=gl_Position.z/gl_Position.w;
643
- #endif
644
- #ifdef TERRAIN3D
645
- v_gamma_scale=1.0;
646
- #else
647
- float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
648
- #endif
649
- float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),raster:De(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
650
- #ifdef OVERDRAW_INSPECTOR
651
- fragColor=vec4(1.0);
652
- #endif
653
- }`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;
654
- #ifdef GLOBE
655
- if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
656
- #endif
657
- v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:De(`uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;
658
- #pragma mapbox: define lowp float opacity
659
- void main() {
660
- #pragma mapbox: initialize lowp float opacity
661
- lowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;
662
- #ifdef OVERDRAW_INSPECTOR
663
- fragColor=vec4(1.0);
664
- #endif
665
- }`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity;
666
- #pragma mapbox: define lowp float opacity
667
- void main() {
668
- #pragma mapbox: initialize lowp float opacity
669
- vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
670
- camera_to_anchor_distance/u_camera_to_center_distance :
671
- u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
672
- #ifdef GLOBE
673
- if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
674
- #endif
675
- vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:De(`#define SDF_PX 8.0
676
- uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;
677
- #pragma mapbox: define highp vec4 fill_color
678
- #pragma mapbox: define highp vec4 halo_color
679
- #pragma mapbox: define lowp float opacity
680
- #pragma mapbox: define lowp float halo_width
681
- #pragma mapbox: define lowp float halo_blur
682
- void main() {
683
- #pragma mapbox: initialize highp vec4 fill_color
684
- #pragma mapbox: initialize highp vec4 halo_color
685
- #pragma mapbox: initialize lowp float opacity
686
- #pragma mapbox: initialize lowp float halo_width
687
- #pragma mapbox: initialize lowp float halo_blur
688
- float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity);
689
- #ifdef OVERDRAW_INSPECTOR
690
- fragColor=vec4(1.0);
691
- #endif
692
- }`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;
693
- #pragma mapbox: define highp vec4 fill_color
694
- #pragma mapbox: define highp vec4 halo_color
695
- #pragma mapbox: define lowp float opacity
696
- #pragma mapbox: define lowp float halo_width
697
- #pragma mapbox: define lowp float halo_blur
698
- void main() {
699
- #pragma mapbox: initialize highp vec4 fill_color
700
- #pragma mapbox: initialize highp vec4 halo_color
701
- #pragma mapbox: initialize lowp float opacity
702
- #pragma mapbox: initialize lowp float halo_width
703
- #pragma mapbox: initialize lowp float halo_blur
704
- vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
705
- camera_to_anchor_distance/u_camera_to_center_distance :
706
- u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
707
- #ifdef GLOBE
708
- if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
709
- #endif
710
- vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:De(`#define SDF_PX 8.0
711
- #define SDF 1.0
712
- #define ICON 0.0
713
- uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;
714
- #pragma mapbox: define highp vec4 fill_color
715
- #pragma mapbox: define highp vec4 halo_color
716
- #pragma mapbox: define lowp float opacity
717
- #pragma mapbox: define lowp float halo_width
718
- #pragma mapbox: define lowp float halo_blur
719
- void main() {
720
- #pragma mapbox: initialize highp vec4 fill_color
721
- #pragma mapbox: initialize highp vec4 halo_color
722
- #pragma mapbox: initialize lowp float opacity
723
- #pragma mapbox: initialize lowp float halo_width
724
- #pragma mapbox: initialize lowp float halo_blur
725
- float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha;
726
- #ifdef OVERDRAW_INSPECTOR
727
- fragColor=vec4(1.0);
728
- #endif
729
- return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);
730
- #ifdef OVERDRAW_INSPECTOR
731
- fragColor=vec4(1.0);
732
- #endif
733
- }`,`in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;
734
- #pragma mapbox: define highp vec4 fill_color
735
- #pragma mapbox: define highp vec4 halo_color
736
- #pragma mapbox: define lowp float opacity
737
- #pragma mapbox: define lowp float halo_width
738
- #pragma mapbox: define lowp float halo_blur
739
- void main() {
740
- #pragma mapbox: initialize highp vec4 fill_color
741
- #pragma mapbox: initialize highp vec4 halo_color
742
- #pragma mapbox: initialize lowp float opacity
743
- #pragma mapbox: initialize lowp float halo_width
744
- #pragma mapbox: initialize lowp float halo_blur
745
- vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
746
- camera_to_anchor_distance/u_camera_to_center_distance :
747
- u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
748
- #ifdef GLOBE
749
- if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
750
- #endif
751
- vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:De("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:De("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:De("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:De("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:De(`#ifdef GL_ES
752
- precision highp float;
753
- #endif
754
- in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758
755
- );color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:De("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function De(p,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,o=t.match(/in ([\w]+) ([\w]+)/g),c=p.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),y=f?f.concat(c):c,b={};return{fragmentSource:p=p.replace(n,((w,S,P,E,C)=>(b[C]=!0,S==="define"?`
756
- #ifndef HAS_UNIFORM_u_${C}
757
- in ${P} ${E} ${C};
758
- #else
759
- uniform ${P} ${E} u_${C};
760
- #endif
761
- `:`
762
- #ifdef HAS_UNIFORM_u_${C}
763
- ${P} ${E} ${C} = u_${C};
764
- #endif
765
- `))),vertexSource:t=t.replace(n,((w,S,P,E,C)=>{const z=E==="float"?"vec2":"vec4",F=C.match(/color/)?"color":z;return b[C]?S==="define"?`
766
- #ifndef HAS_UNIFORM_u_${C}
767
- uniform lowp float u_${C}_t;
768
- in ${P} ${z} a_${C};
769
- out ${P} ${E} ${C};
770
- #else
771
- uniform ${P} ${E} u_${C};
772
- #endif
773
- `:F==="vec4"?`
774
- #ifndef HAS_UNIFORM_u_${C}
775
- ${C} = a_${C};
776
- #else
777
- ${P} ${E} ${C} = u_${C};
778
- #endif
779
- `:`
780
- #ifndef HAS_UNIFORM_u_${C}
781
- ${C} = unpack_mix_${F}(a_${C}, u_${C}_t);
782
- #else
783
- ${P} ${E} ${C} = u_${C};
784
- #endif
785
- `:S==="define"?`
786
- #ifndef HAS_UNIFORM_u_${C}
787
- uniform lowp float u_${C}_t;
788
- in ${P} ${z} a_${C};
789
- #else
790
- uniform ${P} ${E} u_${C};
791
- #endif
792
- `:F==="vec4"?`
793
- #ifndef HAS_UNIFORM_u_${C}
794
- ${P} ${E} ${C} = a_${C};
795
- #else
796
- ${P} ${E} ${C} = u_${C};
797
- #endif
798
- `:`
799
- #ifndef HAS_UNIFORM_u_${C}
800
- ${P} ${E} ${C} = unpack_mix_${F}(a_${C}, u_${C}_t);
801
- #else
802
- ${P} ${E} ${C} = u_${C};
803
- #endif
804
- `})),staticAttributes:o,staticUniforms:y}}class kt{constructor(t,n,o){this.vertexBuffer=t,this.indexBuffer=n,this.segments=o}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var vt=d.aS([{name:"a_pos",type:"Int16",components:2}]);const bt="#define PROJECTION_MERCATOR",oc="mercator";class ti{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return oc}get shaderDefine(){return bt}get shaderPreludeCode(){return Mt.projectionMercator}get vertexShaderPreludeCode(){return Mt.projectionMercator.vertexSource}get subdivisionGranularity(){return d.aT.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,n,o,c,f){if(this._cachedMesh)return this._cachedMesh;const y=new d.aU;y.emplaceBack(0,0),y.emplaceBack(d.a5,0),y.emplaceBack(0,d.a5),y.emplaceBack(d.a5,d.a5);const b=t.createVertexBuffer(y,vt.members),w=d.aV.simpleSegment(0,0,4,2),S=new d.aW;S.emplaceBack(1,0,2),S.emplaceBack(1,2,3);const P=t.createIndexBuffer(S);return this._cachedMesh=new kt(b,P,w),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(t){}}class ii{constructor(t=0,n=0,o=0,c=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(o)||o<0||isNaN(c)||c<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=o,this.right=c}interpolate(t,n,o){return n.top!=null&&t.top!=null&&(this.top=d.G.number(t.top,n.top,o)),n.bottom!=null&&t.bottom!=null&&(this.bottom=d.G.number(t.bottom,n.bottom,o)),n.left!=null&&t.left!=null&&(this.left=d.G.number(t.left,n.left,o)),n.right!=null&&t.right!=null&&(this.right=d.G.number(t.right,n.right,o)),this}getCenter(t,n){const o=d.ak((this.left+t-this.right)/2,0,t),c=d.ak((this.top+n-this.bottom)/2,0,n);return new d.P(o,c)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new ii(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function ri(p,t){if(!p.renderWorldCopies||p.lngRange)return;const n=t.lng-p.center.lng;t.lng+=n>180?-360:n<-180?360:0}function Oo(p){return Math.max(0,Math.floor(p))}class rn{constructor(t,n){var o;this.applyConstrain=(c,f)=>this._constrainOverride!==null?this._constrainOverride(c,f):this._callbacks.defaultConstrain(c,f),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=n?.renderWorldCopies===void 0||!!n?.renderWorldCopies,this._minZoom=n?.minZoom||0,this._maxZoom=n?.maxZoom||22,this._minPitch=n?.minPitch==null?0:n?.minPitch,this._maxPitch=n?.maxPitch==null?60:n?.maxPitch,this._constrainOverride=(o=n?.constrainOverride)!==null&&o!==void 0?o:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new d.V(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Oo(this._zoom),this._scale=d.an(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new ii,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,n,o){this._constrainOverride=t.constrainOverride,this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=Oo(this._zoom),this._scale=d.an(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new ii(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=!o&&t.autoCalculateNearFarZ,n&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(t){this._minZoom!==t&&(this._minZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(t){this._minPitch!==t&&(this._minPitch=t,this.setPitch(Math.max(this.pitch,t)))}get maxPitch(){return this._maxPitch}setMaxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.setPitch(Math.min(this.pitch,t)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){t===void 0&&(t=null),this._constrainOverride!==t&&(this._constrainOverride=t,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new d.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){const n=d.W(t,-180,180)*Math.PI/180;var o,c,f,y,b,w,S,P,E;this._bearingInRadians!==n&&(this._unmodified=!1,this._bearingInRadians=n,this._calcMatrices(),this._rotationMatrix=Tr(),o=this._rotationMatrix,f=-this._bearingInRadians,y=(c=this._rotationMatrix)[0],b=c[1],w=c[2],S=c[3],P=Math.sin(f),E=Math.cos(f),o[0]=y*E+w*P,o[1]=b*E+S*P,o[2]=y*-P+w*E,o[3]=b*-P+S*E)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){const n=d.ak(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==n&&(this._unmodified=!1,this._pitchInRadians=n,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){const n=t/180*Math.PI;this._rollInRadians!==n&&(this._unmodified=!1,this._rollInRadians=n,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return d.aX(this._fovInRadians)}setFov(t){t=d.ak(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=d.am(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){const n=this.applyConstrain(this._center,t).zoom;this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this._tileZoom=Math.max(0,Math.floor(n)),this._scale=d.an(n),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(t,n){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=n,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,o){this._unmodified=!1,this._edgeInsets.interpolate(t,n,o),this.constrainInternal(),this._calcMatrices()}resize(t,n,o=!0){this._width=t,this._height=n,o&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange&&this._latRange.length===2&&this._lngRange&&this._lngRange.length===2?new xt([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-d.al,d.al])}getCameraQueryGeometry(t,n){if(n.length===1)return[n[0],t];{const{minX:o,minY:c,maxX:f,maxY:y}=d.a7.fromPoints(n).extend(t);return[new d.P(o,c),new d.P(f,c),new d.P(f,y),new d.P(o,y),new d.P(o,c)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:n,zoom:o}=this.applyConstrain(this.center,this.zoom);this.setCenter(n),this.setZoom(o),this._unmodified=t,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=d.ao(new Float64Array(16));d.Q(t,t,[this._width/2,-this._height/2,1]),d.O(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=d.ao(new Float64Array(16)),d.Q(t,t,[1,-1,1]),d.O(t,t,[-1,-1,0]),d.Q(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,n,o,c){const f=o!==void 0?o:this.bearing,y=c=c!==void 0?c:this.pitch,{distanceToCenter:b,clampedElevation:w}=this._distanceToCenterFromAltElevationPitch(n,this.elevation,y),{x:S,y:P}=fa(y,f),E=d.a6.fromLngLat(t,n);let C,z,F=d.aY(1,E.y),V=0;do{if(V+=1,V>10)break;z=b/F,C=new d.a6(E.x+S*z,E.y+P*z),F=1/C.meterInMercatorCoordinateUnits()}while(Math.abs(b-z*F)>1e-12);return{center:C.toLngLat(),elevation:w,zoom:d.aq(this.height/2/Math.tan(this.fovInRadians/2)/z/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;const n=1/this.worldSize,o=d.ap(1,this.center.lat)*this.worldSize,c=d.a6.fromLngLat(this.center,this.elevation),f=c.x/n,y=c.y/n,b=c.z/n,w=this.pitch,S=this.bearing,{x:P,y:E,z:C}=fa(w,S),z=this.cameraToCenterDistance,F=f+z*-P,V=y+z*-E,j=b+z*C,{distanceToCenter:N,clampedElevation:$}=this._distanceToCenterFromAltElevationPitch(j/o,t,w),W=N*o,G=new d.a6((F+P*W)*n,(V+E*W)*n,0).toLngLat(),q=d.ap(1,G.lat),Y=d.aq(this.height/2/Math.tan(this.fovInRadians/2)/N/q/this.tileSize);this._elevation=$,this._center=G,this.setZoom(Y)}_distanceToCenterFromAltElevationPitch(t,n,o){const c=-Math.cos(d.am(o)),f=t-n;let y,b=n;return c*f>=0||Math.abs(c)<.1?(y=1e4,b=t+y*c):y=-f/c,{distanceToCenter:y,clampedElevation:b}}getCameraPoint(){const t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new d.P(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const t=d.ap(1,this.center.lat)*this.worldSize;return pa(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/t).toLngLat()}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];const n=t.canonical.z>=0?1<<t.canonical.z:Math.pow(2,t.canonical.z);return[t.canonical.x/n,t.canonical.y/n,1/n/d.a5,1/n/d.a5]}}class wt{constructor(t,n){this.min=t,this.max=n,this.center=d.aZ([],d.a_([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],o=d.a$(this.min),c=d.a$(this.max);for(let f=0;f<n.length;f++)o[f]=n[f]?this.min[f]:this.center[f],c[f]=n[f]?this.center[f]:this.max[f];return c[2]=this.max[2],new wt(o,c)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let n=!0;for(let o=0;o<t.planes.length;o++){const c=this.intersectsPlane(t.planes[o]);if(c===0)return 0;c===1&&(n=!1)}return n?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let n=t[3],o=t[3];for(let c=0;c<3;c++)t[c]>0?(n+=t[c]*this.min[c],o+=t[c]*this.max[c]):(o+=t[c]*this.min[c],n+=t[c]*this.max[c]);return n>=0?2:o<0?0:1}}class ys{distanceToTile2d(t,n,o,c){const f=c.distanceX([t,n]),y=c.distanceY([t,n]);return Math.hypot(f,y)}getWrap(t,n,o){return o}getTileBoundingVolume(t,n,o,c){var f,y;let b=0,w=0;if(c?.terrain){const P=new d.a2(t.z,n,t.z,t.x,t.y),E=c.terrain.getMinMaxElevation(P);b=(f=E.minElevation)!==null&&f!==void 0?f:Math.min(0,o),w=(y=E.maxElevation)!==null&&y!==void 0?y:Math.max(0,o)}const S=1<<t.z;return new wt([n+t.x/S,t.y/S,b],[n+(t.x+1)/S,(t.y+1)/S,w])}allowVariableZoom(t,n){const o=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,c=d.ak(78.5-o/2,0,60);return!!n.terrain||t.pitch>c}allowWorldCopies(){return!0}prepareNextFrame(){}}class nr{constructor(t,n,o){this.points=t,this.planes=n,this.aabb=o}static fromInvProjectionMatrix(t,n=1,o=0,c,f){const y=f?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],b=Math.pow(2,o),w=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((C=>(function(z,F,V,j){const N=d.aE([],z,F),$=1/N[3]/V*j;return d.b4(N,N,[$,$,1/N[3],$])})(C,t,n,b)));c&&(function(C,z,F,V){const j=V?4:0,N=V?0:4;let $=0;const W=[],G=[];for(let Z=0;Z<4;Z++){const Q=d.b0([],C[Z+N],C[Z+j]),ae=d.b5(Q);d.aZ(Q,Q,1/ae),W.push(ae),G.push(Q)}for(let Z=0;Z<4;Z++){const Q=d.b6(C[Z+j],G[Z],F);$=Q!==null&&Q>=0?Math.max($,Q):Math.max($,W[Z])}const q=(function(Z,Q){const ae=d.b0([],Z[Q[0]],Z[Q[1]]),oe=d.b0([],Z[Q[2]],Z[Q[1]]),ie=[0,0,0,0];return d.b1(ie,d.b2([],ae,oe)),ie[3]=-d.b3(ie,Z[Q[0]]),ie})(C,z),Y=(function(Z,Q){const ae=d.b7(Z),oe=d.b8([],Z,1/ae),ie=d.b0([],Q,d.aZ([],oe,d.b3(Q,oe))),ne=d.b7(ie);if(ne>0){const pe=Math.sqrt(1-oe[3]*oe[3]),fe=d.aZ([],oe,-oe[3]),de=d.a_([],fe,d.aZ([],ie,pe/ne));return d.b9(Q,de)}return null})(F,q);if(Y!==null){const Z=Y/d.b3(G[0],q);$=Math.min($,Z)}for(let Z=0;Z<4;Z++){const Q=Math.min($,W[Z]);C[Z+N]=[C[Z+j][0]+G[Z][0]*Q,C[Z+j][1]+G[Z][1]*Q,C[Z+j][2]+G[Z][2]*Q,1]}})(w,y[0],c,f);const S=y.map((C=>{const z=d.b0([],w[C[0]],w[C[1]]),F=d.b0([],w[C[2]],w[C[1]]),V=d.b1([],d.b2([],z,F)),j=-d.b3(V,w[C[1]]);return V.concat(j)})),P=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],E=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const C of w)for(let z=0;z<3;z++)P[z]=Math.min(P[z],C[z]),E[z]=Math.max(E[z],C[z]);return new nr(w,S,new wt(P,E))}}class lr{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,n,o){return this._helper.interpolatePadding(t,n,o)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n,o=!0){this._helper.resize(t,n,o)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,n){this._helper.overrideNearFarZ(t,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,n){}constructor(t){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(n,o)=>{o=d.ak(+o,this.minZoom,this.maxZoom);const c={center:new d.V(n.lng,n.lat),zoom:o};let f=this._helper._lngRange;if(!this._helper._renderWorldCopies&&f===null){const G=179.9999999999;f=[-G,G]}const y=this.tileSize*d.an(c.zoom);let b=0,w=y,S=0,P=y,E=0,C=0;const{x:z,y:F}=this.size;if(this._helper._latRange){const G=this._helper._latRange;b=d.X(G[1])*y,w=d.X(G[0])*y,w-b<F&&(E=F/(w-b))}f&&(S=d.W(d.Y(f[0])*y,0,y),P=d.W(d.Y(f[1])*y,0,y),P<S&&(P+=y),P-S<z&&(C=z/(P-S)));const{x:V,y:j}=Xi(y,n);let N,$;const W=Math.max(C||0,E||0);if(W){const G=new d.P(C?(P+S)/2:V,E?(w+b)/2:j);return c.center=Cn(y,G).wrap(),c.zoom+=d.aq(W),c}if(this._helper._latRange){const G=F/2;j-G<b&&($=b+G),j+G>w&&($=w-G)}if(f){const G=(S+P)/2;let q=V;this._helper._renderWorldCopies&&(q=d.W(V,G-y/2,G+y/2));const Y=z/2;q-Y<S&&(N=S+Y),q+Y>P&&(N=P-Y)}if(N!==void 0||$!==void 0){const G=new d.P(N??V,$??j);c.center=Cn(y,G).wrap()}return c},this.applyConstrain=(n,o)=>this._helper.applyConstrain(n,o),this._helper=new rn({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,o)=>this.defaultConstrain(n,o)},t),this._coveringTilesDetailsProvider=new ys}clone(){const t=new lr;return t.apply(this,!1),t}apply(t,n,o){this._helper.apply(t,n,o)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){const n=[new d.ba(0,t)];if(this._helper._renderWorldCopies){const o=this.screenPointToMercatorCoordinate(new d.P(0,0)),c=this.screenPointToMercatorCoordinate(new d.P(this._helper._width,0)),f=this.screenPointToMercatorCoordinate(new d.P(this._helper._width,this._helper._height)),y=this.screenPointToMercatorCoordinate(new d.P(0,this._helper._height)),b=Math.floor(Math.min(o.x,c.x,f.x,y.x)),w=Math.floor(Math.max(o.x,c.x,f.x,y.x)),S=1;for(let P=b-S;P<=w+S;P++)P!==0&&n.push(new d.ba(P,t))}return n}getCameraFrustum(){return nr.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){const n=this.screenPointToLocation(this.centerPoint,t),o=t?t.getElevationForLngLatZoom(n,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(o)}setLocationAtPoint(t,n){const o=d.ap(this.elevation,this.center.lat),c=this.screenPointToMercatorCoordinateAtZ(n,o),f=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,o),y=d.a6.fromLngLat(t),b=new d.a6(y.x-(c.x-f.x),y.y-(c.y-f.y));this.setCenter(b?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,n){return n?this.coordinatePoint(d.a6.fromLngLat(t),n.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(d.a6.fromLngLat(t))}screenPointToLocation(t,n){var o;return(o=this.screenPointToMercatorCoordinate(t,n))===null||o===void 0?void 0:o.toLngLat()}screenPointToMercatorCoordinate(t,n){if(n){const o=n.pointCoordinate(t);if(o!=null)return o}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,n){const o=n||0,c=[t.x,t.y,0,1],f=[t.x,t.y,1,1];d.aE(c,c,this._pixelMatrixInverse),d.aE(f,f,this._pixelMatrixInverse);const y=c[3],b=f[3],w=c[1]/y,S=f[1]/b,P=c[2]/y,E=f[2]/b,C=P===E?0:(o-P)/(E-P);return new d.a6(d.G.number(c[0]/y,f[0]/b,C)/this.worldSize,d.G.number(w,S,C)/this.worldSize,o)}coordinatePoint(t,n=0,o=this._pixelMatrix){const c=[t.x*this.worldSize,t.y*this.worldSize,n,1];return d.aE(c,c,o),new d.P(c[0]/c[3],c[1]/c[3])}getBounds(){const t=Math.max(0,this._helper._height/2-Yr(this));return new xt().extend(this.screenPointToLocation(new d.P(0,t))).extend(this.screenPointToLocation(new d.P(this._helper._width,t))).extend(this.screenPointToLocation(new d.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new d.P(0,this._helper._height)))}isPointOnMapSurface(t,n){return n?n.pointCoordinate(t)!=null:t.y>this.height/2-Yr(this)}calculatePosMatrix(t,n=!1,o){var c;const f=(c=t.key)!==null&&c!==void 0?c:d.bb(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),y=n?this._alignedPosMatrixCache:this._posMatrixCache;if(y.has(f)){const S=y.get(f);return o?S.f32:S.f64}const b=ps(t,this.worldSize);d.S(b,n?this._alignedProjMatrix:this._viewProjMatrix,b);const w={f64:b,f32:new Float32Array(b)};return y.set(f,w),o?w.f32:w.f64}calculateFogMatrix(t){const n=t.key,o=this._fogMatrixCacheF32;if(o.has(n))return o.get(n);const c=ps(t,this.worldSize);return d.S(c,this._fogMatrix,c),o.set(n,new Float32Array(c)),o.get(n)}calculateCenterFromCameraLngLatAlt(t,n,o,c){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,o,c)}_calculateNearFarZIfNeeded(t,n,o){if(!this._helper.autoCalculateNearFarZ)return;const c=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),f=t-c*this._helper._pixelPerMeter/Math.cos(n),y=c<0?f:t,b=Math.PI/2+this.pitchInRadians,w=d.am(this.fov)*(Math.abs(Math.cos(d.am(this.roll)))*this.height+Math.abs(Math.sin(d.am(this.roll)))*this.width)/this.height*(.5+o.y/this.height),S=Math.sin(w)*y/Math.sin(d.ak(Math.PI-b-w,.01,Math.PI-.01)),P=Yr(this),E=Math.atan(P/this._helper.cameraToCenterDistance),C=d.am(.75),z=E>C?2*E*(.5+o.y/(2*P)):C,F=Math.sin(z)*y/Math.sin(d.ak(Math.PI-b-z,.01,Math.PI-.01)),V=Math.min(S,F);this._helper._farZ=1.01*(Math.cos(Math.PI/2-n)*V+y),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const t=this.centerOffset,n=Xi(this.worldSize,this.center),o=n.x,c=n.y;this._helper._pixelPerMeter=d.ap(1,this.center.lat)*this.worldSize;const f=d.am(Math.min(this.pitch,Hr)),y=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(f));let b;this._calculateNearFarZIfNeeded(y,f,t),b=new Float64Array(16),d.bc(b,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),d.ay(this._invProjMatrix,b),b[8]=2*-t.x/this._helper._width,b[9]=2*t.y/this._helper._height,this._projectionMatrix=d.bd(b),d.Q(b,b,[1,-1,1]),d.O(b,b,[0,0,-this._helper.cameraToCenterDistance]),d.be(b,b,-this.rollInRadians),d.bf(b,b,this.pitchInRadians),d.be(b,b,-this.bearingInRadians),d.O(b,b,[-o,-c,0]),this._mercatorMatrix=d.Q([],b,[this.worldSize,this.worldSize,this.worldSize]),d.Q(b,b,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=d.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,b),d.O(b,b,[0,0,-this.elevation]),this._viewProjMatrix=b,this._invViewProjMatrix=d.ay([],b);const w=[0,0,-1,1];d.aE(w,w,this._invViewProjMatrix),this._cameraPosition=[w[0]/w[3],w[1]/w[3],w[2]/w[3]],this._fogMatrix=new Float64Array(16),d.bc(this._fogMatrix,this.fovInRadians,this.width/this.height,y,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,d.Q(this._fogMatrix,this._fogMatrix,[1,-1,1]),d.O(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),d.be(this._fogMatrix,this._fogMatrix,-this.rollInRadians),d.bf(this._fogMatrix,this._fogMatrix,this.pitchInRadians),d.be(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),d.O(this._fogMatrix,this._fogMatrix,[-o,-c,0]),d.Q(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),d.O(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=d.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,b);const S=this._helper._width%2/2,P=this._helper._height%2/2,E=Math.cos(this.bearingInRadians),C=Math.sin(-this.bearingInRadians),z=o-Math.round(o)+E*S+C*P,F=c-Math.round(c)+E*P+C*S,V=new Float64Array(b);if(d.O(V,V,[z>.5?z-1:z,F>.5?F-1:F,0]),this._alignedProjMatrix=V,b=d.ay(new Float64Array(16),this._pixelMatrix),!b)throw new Error("failed to invert matrix");this._pixelMatrixInverse=b,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const t=this.screenPointToMercatorCoordinate(new d.P(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return d.aE(n,n,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const t=d.ap(1,this.center.lat)*this.worldSize;return pa(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,n){const o=d.a6.fromLngLat(t),c=[o.x*this.worldSize,o.y*this.worldSize,n,1];return d.aE(c,c,this._viewProjMatrix),c[2]/c[3]}getProjectionData(t){const{overscaledTileID:n,aligned:o,applyTerrainMatrix:c}=t,f=this._helper.getMercatorTileCoordinates(n),y=n?this.calculatePosMatrix(n,o,!0):null;let b;return b=n&&n.terrainRttPosMatrix32f&&c?n.terrainRttPosMatrix32f:y||d.bg(),{mainMatrix:b,tileMercatorCoords:f,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:b}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,n,o){return 1}transformLightDirection(t){return d.a$(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,n,o,c){const f=this.calculatePosMatrix(o);let y;c?(y=[t,n,c(t,n),1],d.aE(y,y,f)):(y=[t,n,0,1],_a(y,y,f));const b=y[3];return{point:new d.P(y[0]/b,y[1]/b),signedDistanceFromCamera:b,isOccluded:!1}}populateCache(t){for(const n of t)this.calculatePosMatrix(n)}getMatrixForModel(t,n){const o=d.a6.fromLngLat(t,n),c=o.meterInMercatorCoordinateUnits(),f=d.bh();return d.O(f,f,[o.x,o.y,o.z]),d.be(f,f,Math.PI),d.bf(f,f,Math.PI/2),d.Q(f,f,[-c,c,c]),f}getProjectionDataForCustomLayer(t=!0){const n=new d.a2(0,0,0,0,0),o=this.getProjectionData({overscaledTileID:n,applyGlobeMatrix:t}),c=ps(n,this.worldSize);d.S(c,this._viewProjMatrix,c),o.tileMercatorCoords=[0,0,1,1];const f=[d.a5,d.a5,this.worldSize/this._helper.pixelsPerMeter],y=d.bi();return d.Q(y,c,f),o.fallbackMatrix=y,o.mainMatrix=y,o}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function Vi(){d.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Vo(p){if(p.useSlerp)if(p.k<1){const t=d.bj(p.startEulerAngles.roll,p.startEulerAngles.pitch,p.startEulerAngles.bearing),n=d.bj(p.endEulerAngles.roll,p.endEulerAngles.pitch,p.endEulerAngles.bearing),o=new Float64Array(4);d.bk(o,t,n,p.k);const c=d.bl(o);p.tr.setRoll(c.roll),p.tr.setPitch(c.pitch),p.tr.setBearing(c.bearing)}else p.tr.setRoll(p.endEulerAngles.roll),p.tr.setPitch(p.endEulerAngles.pitch),p.tr.setBearing(p.endEulerAngles.bearing);else p.tr.setRoll(d.G.number(p.startEulerAngles.roll,p.endEulerAngles.roll,p.k)),p.tr.setPitch(d.G.number(p.startEulerAngles.pitch,p.endEulerAngles.pitch,p.k)),p.tr.setBearing(d.G.number(p.startEulerAngles.bearing,p.endEulerAngles.bearing,p.k))}function cr(p,t,n,o,c){const f=c.padding,y=Xi(c.worldSize,n.getNorthWest()),b=Xi(c.worldSize,n.getNorthEast()),w=Xi(c.worldSize,n.getSouthEast()),S=Xi(c.worldSize,n.getSouthWest()),P=d.am(-o),E=y.rotate(P),C=b.rotate(P),z=w.rotate(P),F=S.rotate(P),V=new d.P(Math.max(E.x,C.x,F.x,z.x),Math.max(E.y,C.y,F.y,z.y)),j=new d.P(Math.min(E.x,C.x,F.x,z.x),Math.min(E.y,C.y,F.y,z.y)),N=V.sub(j),$=(c.width-(f.left+f.right+t.left+t.right))/N.x,W=(c.height-(f.top+f.bottom+t.top+t.bottom))/N.y;if(W<0||$<0)return void Vi();const G=Math.min(d.aq(c.scale*Math.min($,W)),p.maxZoom),q=d.P.convert(p.offset),Y=new d.P((t.left-t.right)/2,(t.top-t.bottom)/2).rotate(d.am(o)),Z=q.add(Y).mult(c.scale/d.an(G));return{center:Cn(c.worldSize,y.add(w).div(2).sub(Z)),zoom:G,bearing:o}}class ba{get useGlobeControls(){return!1}handlePanInertia(t,n){const o=t.mag(),c=Math.abs(Yr(n));return{easingOffset:t.mult(Math.min(.75*c/o,1)),easingCenter:n.center}}handleMapControlsRollPitchBearingZoom(t,n){t.bearingDelta&&n.setBearing(n.bearing+t.bearingDelta),t.pitchDelta&&n.setPitch(n.pitch+t.pitchDelta),t.rollDelta&&n.setRoll(n.roll+t.rollDelta),t.zoomDelta&&n.setZoom(n.zoom+t.zoomDelta)}handleMapControlsPan(t,n,o){t.around.distSqr(n.centerPoint)<.01||n.setLocationAtPoint(o,t.around)}cameraForBoxAndBearing(t,n,o,c,f){return cr(t,n,o,c,f)}handleJumpToCenterZoom(t,n){t.zoom!==(n.zoom!==void 0?+n.zoom:t.zoom)&&t.setZoom(+n.zoom),n.center!==void 0&&t.setCenter(d.V.convert(n.center))}handleEaseTo(t,n){const o=t.zoom,c=t.padding,f={roll:t.roll,pitch:t.pitch,bearing:t.bearing},y={roll:n.roll===void 0?t.roll:n.roll,pitch:n.pitch===void 0?t.pitch:n.pitch,bearing:n.bearing===void 0?t.bearing:n.bearing},b=n.zoom!==void 0,w=!t.isPaddingEqual(n.padding);let S=!1;const P=b?+n.zoom:t.zoom;let E=t.centerPoint.add(n.offsetAsPoint);const C=t.screenPointToLocation(E),{center:z,zoom:F}=t.applyConstrain(d.V.convert(n.center||C),P??o);ri(t,z);const V=Xi(t.worldSize,C),j=Xi(t.worldSize,z).sub(V),N=d.an(F-o);return S=F!==o,{easeFunc:$=>{if(S&&t.setZoom(d.G.number(o,F,$)),d.bm(f,y)||Vo({startEulerAngles:f,endEulerAngles:y,tr:t,k:$,useSlerp:f.roll!=y.roll}),w&&(t.interpolatePadding(c,n.padding,$),E=t.centerPoint.add(n.offsetAsPoint)),n.around)t.setLocationAtPoint(n.around,n.aroundPoint);else{const W=d.an(t.zoom-o),G=F>o?Math.min(2,N):Math.max(.5,N),q=Math.pow(G,1-$),Y=Cn(t.worldSize,V.add(j.mult($*q)).mult(W));t.setLocationAtPoint(t.renderWorldCopies?Y.wrap():Y,E)}},isZooming:S,elevationCenter:z}}handleFlyTo(t,n){const o=n.zoom!==void 0,c=t.zoom,f=t.applyConstrain(d.V.convert(n.center||n.locationAtOffset),o?+n.zoom:c),y=f.center,b=f.zoom;ri(t,y);const w=Xi(t.worldSize,n.locationAtOffset),S=Xi(t.worldSize,y).sub(w),P=S.mag(),E=d.an(b-c);let C;if(n.minZoom!==void 0){const z=Math.min(+n.minZoom,c,b),F=t.applyConstrain(y,z).zoom;C=d.an(F-c)}return{easeFunc:(z,F,V,j)=>{t.setZoom(z===1?b:c+d.aq(F));const N=z===1?y:Cn(t.worldSize,w.add(S.mult(V)).mult(F));t.setLocationAtPoint(t.renderWorldCopies?N.wrap():N,j)},scaleOfZoom:E,targetCenter:y,scaleOfMinZoom:C,pixelPathLength:P}}}class ut{constructor(t,n,o){this.blendFunction=t,this.blendColor=n,this.mask=o}}ut.Replace=[1,0],ut.disabled=new ut(ut.Replace,d.bn.transparent,[!1,!1,!1,!1]),ut.unblended=new ut(ut.Replace,d.bn.transparent,[!0,!0,!0,!0]),ut.alphaBlended=new ut([1,771],d.bn.transparent,[!0,!0,!0,!0]);const Ln=2305;class Ue{constructor(t,n,o){this.enable=t,this.mode=n,this.frontFace=o}}Ue.disabled=new Ue(!1,1029,Ln),Ue.backCCW=new Ue(!0,1029,Ln),Ue.frontCCW=new Ue(!0,1028,Ln);class Fe{constructor(t,n,o){this.func=t,this.mask=n,this.range=o}}Fe.ReadOnly=!1,Fe.ReadWrite=!0,Fe.disabled=new Fe(519,Fe.ReadOnly,[0,1]);const xs=7680;class qe{constructor(t,n,o,c,f,y){this.test=t,this.ref=n,this.mask=o,this.fail=c,this.depthFail=f,this.pass=y}}qe.disabled=new qe({func:519,mask:0},0,0,xs,xs,xs);const Bn=new WeakMap;function Hi(p){var t;if(Bn.has(p))return Bn.get(p);{const n=(t=p.getParameter(p.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return Bn.set(p,n),n}}class vs{get awaitingQuery(){return!!this._readbackQueue}constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=t;const n=t.context,o=n.gl;this._texFormat=o.RGBA,this._texType=o.UNSIGNED_BYTE;const c=new d.aU;c.emplaceBack(-1,-1),c.emplaceBack(2,-1),c.emplaceBack(-1,2);const f=new d.aW;f.emplaceBack(0,1,2),this._fullscreenTriangle=new kt(n.createVertexBuffer(c,vt.members),n.createIndexBuffer(f),d.aV.simpleSegment(0,0,c.length,f.length)),this._resultBuffer=new Uint8Array(4),n.activeTexture.set(o.TEXTURE1);const y=o.createTexture();o.bindTexture(o.TEXTURE_2D,y),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.NEAREST),o.texImage2D(o.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=n.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(y),Hi(o)&&(this._pbo=o.createBuffer(),o.bindBuffer(o.PIXEL_PACK_BUFFER,this._pbo),o.bufferData(o.PIXEL_PACK_BUFFER,4,o.STREAM_READ),o.bindBuffer(o.PIXEL_PACK_BUFFER,null))}destroy(){const t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,n){const o=this._updateCount;return this._readbackQueue?o>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():o>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,n),this._updateCount++,this._measuredError}_bindFramebuffer(){const t=this._cachedRenderContext.context,n=t.gl;t.activeTexture.set(n.TEXTURE1),n.bindTexture(n.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,n){const o=this._cachedRenderContext.context,c=o.gl;if(this._bindFramebuffer(),o.viewport.set([0,0,this._texWidth,this._texHeight]),o.clear({color:d.bn.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(o,c.TRIANGLES,Fe.disabled,qe.disabled,ut.unblended,Ue.disabled,((f,y)=>({u_input:f,u_output_expected:y}))(t,n),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&Hi(c)){c.bindBuffer(c.PIXEL_PACK_BUFFER,this._pbo),c.readBuffer(c.COLOR_ATTACHMENT0),c.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),c.bindBuffer(c.PIXEL_PACK_BUFFER,null);const f=c.fenceSync(c.SYNC_GPU_COMMANDS_COMPLETE,0);c.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:f}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&Hi(t)){const n=t.clientWaitSync(this._readbackQueue.sync,0,0);if(n===t.WAIT_FAILED)return d.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(n===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=vs._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let n=0;return n+=t[0]/256,n+=t[1]/65536,n+=t[2]/16777216,t[3]<127&&(n=-n),n/128}}const nn=d.a5/128;function bs(p,t){const n=p.granularity!==void 0?Math.max(p.granularity,1):1,o=n+(p.generateBorders?2:0),c=n+(p.extendToNorthPole||p.generateBorders?1:0)+(p.extendToSouthPole||p.generateBorders?1:0),f=o+1,y=c+1,b=p.generateBorders?-1:0,w=p.generateBorders||p.extendToNorthPole?-1:0,S=n+(p.generateBorders?1:0),P=n+(p.generateBorders||p.extendToSouthPole?1:0),E=f*y,C=o*c*6,z=f*y>65536;if(z&&t==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const F=z||t==="32bit",V=new Int16Array(2*E);let j=0;for(let W=w;W<=P;W++)for(let G=b;G<=S;G++){let q=G/n*d.a5;G===-1&&(q=-nn),G===n+1&&(q=d.a5+nn);let Y=W/n*d.a5;W===-1&&(Y=p.extendToNorthPole?d.bp:-nn),W===n+1&&(Y=p.extendToSouthPole?d.bq:d.a5+nn),V[j++]=q,V[j++]=Y}const N=F?new Uint32Array(C):new Uint16Array(C);let $=0;for(let W=0;W<c;W++)for(let G=0;G<o;G++){const q=G+1+W*f,Y=G+(W+1)*f,Z=G+1+(W+1)*f;N[$++]=G+W*f,N[$++]=Y,N[$++]=q,N[$++]=q,N[$++]=Y,N[$++]=Z}return{vertices:V.buffer.slice(0),indices:N.buffer.slice(0),uses32bitIndices:F}}const sn=new d.aT({fill:new d.br(128,2),line:new d.br(512,0),tile:new d.br(128,32),stencil:new d.br(128,1),circle:3});class lc{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return Mt.projectionGlobe}get vertexShaderPreludeCode(){return Mt.projectionMercator.vertexSource}get subdivisionGranularity(){return sn}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new vs(t));const n=d.X(this._errorQueryLatitudeDegrees),o=2*Math.atan(Math.exp(Math.PI-n*Math.PI*2))-.5*Math.PI,c=this._errorMeasurement.updateErrorLoop(n,o),f=Ze();c!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=c,this._errorMeasurementLastChangeTime=f);const y=Math.min(Math.max((f-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=d.bs(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,d.bt(y))}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,n,o,c,f){const y=(f==="stencil"?sn.stencil:sn.tile).getGranularityForZoomLevel(n.z);return this._getMesh(t,{granularity:y,generateBorders:o,extendToNorthPole:n.y===0&&c,extendToSouthPole:n.y===(1<<n.z)-1&&c})}_getMesh(t,n){const o=this._getMeshKey(n);if(o in this._tileMeshCache)return this._tileMeshCache[o];const c=(function(f,y){const b=bs(y,"16bit"),w=d.aU.deserialize({arrayBuffer:b.vertices,length:b.vertices.byteLength/2/2}),S=d.aW.deserialize({arrayBuffer:b.indices,length:b.indices.byteLength/2/3});return new kt(f.createVertexBuffer(w,vt.members),f.createIndexBuffer(S),d.aV.simpleSegment(0,0,w.length,S.length))})(t,n);return this._tileMeshCache[o]=c,c}recalculate(t){}hasTransition(){const t=Ze();let n=!1;return n=n||(t-this._errorMeasurementLastChangeTime)/1e3<.7,n=n||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,n}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t}}const jo=new d.t({type:new d.D(d.u.projection.type)});class No extends d.E{constructor(t){super(),this._transitionable=new d.x(jo,void 0),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new d.H(0)),this._mercatorProjection=new ti,this._verticalPerspectiveProjection=new lc}get transitionState(){const t=this.properties.get("type");if(typeof t=="string"&&t==="mercator")return 0;if(typeof t=="string"&&t==="vertical-perspective")return 1;if(t instanceof d.bu){if(t.from==="vertical-perspective"&&t.to==="mercator")return 1-t.transition;if(t.from==="mercator"&&t.to==="vertical-perspective")return t.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(t){this._mercatorProjection.updateGPUdependent(t),this._verticalPerspectiveProjection.updateGPUdependent(t)}getMeshFromTileID(t,n,o,c,f){return this.currentProjection.getMeshFromTileID(t,n,o,c,f)}setProjection(t){this._transitionable.setValue("type",t?.type||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}setErrorQueryLatitudeDegrees(t){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(t),this._mercatorProjection.setErrorQueryLatitudeDegrees(t)}}function cc(p){const t=On(p.worldSize,p.center.lat);return 2*Math.PI*t}function zr(p,t,n,o,c){const f=1/(1<<c),y=t/d.a5*f+o*f,b=d.bx((p/d.a5*f+n*f)*Math.PI*2+Math.PI,2*Math.PI),w=2*Math.atan(Math.exp(Math.PI-y*Math.PI*2))-.5*Math.PI,S=Math.cos(w),P=new Float64Array(3);return P[0]=Math.sin(b)*S,P[1]=Math.sin(w),P[2]=Math.cos(b)*S,P}function rt(p){return(function(t,n){const o=Math.cos(n),c=new Float64Array(3);return c[0]=Math.sin(t)*o,c[1]=Math.sin(n),c[2]=Math.cos(t)*o,c})(p.lng*Math.PI/180,p.lat*Math.PI/180)}function On(p,t){return p/(2*Math.PI)/Math.cos(t*Math.PI/180)}function Yi(p){const t=Math.asin(p[1])/Math.PI*180,n=Math.sqrt(p[0]*p[0]+p[2]*p[2]);if(n>1e-6){const o=p[0]/n,c=Math.acos(p[2]/n),f=(o>0?c:-c)/Math.PI*180;return new d.V(d.W(f,-180,180),t)}return new d.V(0,t)}function an(p){return Math.cos(p*Math.PI/180)}function Vt(p,t){const n=an(p),o=an(t);return d.aq(o/n)}function Uo(p,t){const n=p.rotate(t.bearingInRadians),o=t.zoom+Vt(t.center.lat,0),c=d.bs(1/an(t.center.lat),1/an(Math.min(Math.abs(t.center.lat),60)),d.bv(o,7,3,0,1)),f=360/cc({worldSize:t.worldSize,center:{lat:t.center.lat}});return new d.V(t.center.lng-n.x*f*c,d.ak(t.center.lat+n.y*f,-d.al,d.al))}function kr(p){const t=.5*p,n=Math.sin(t),o=Math.cos(t);return Math.log(n+o)-Math.log(o-n)}function uc(p,t,n,o){const c=p.lat+n*o;if(Math.abs(n)>1){const f=(Math.sign(p.lat+n)!==Math.sign(p.lat)?-Math.abs(p.lat):Math.abs(p.lat))*Math.PI/180,y=Math.abs(p.lat+n)*Math.PI/180,b=kr(f+o*(y-f)),w=kr(f),S=kr(y);return new d.V(p.lng+t*((b-w)/(S-w)),c)}return new d.V(p.lng+t*o,c)}class ku{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;const t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,n,o,c){const f=`${t.z}_${t.x}_${t.y}_${c?.terrain?"t":""}`,y=this._cache.get(f);if(y)return y;const b=this._cachePrevious.get(f);if(b)return this._cache.set(f,b),b;const w=this._boundingVolumeFactory(t,n,o,c);return this._cache.set(f,w),this._hadAnyChanges=!0,w}}class Vn{constructor(t,n,o,c){this.min=o,this.max=c,this.points=t,this.planes=n}static fromAabb(t,n){const o=[];for(let c=0;c<8;c++)o.push([1&~c?t[0]:n[0],(c>>1&1)==1?n[1]:t[1],(c>>2&1)==1?n[2]:t[2]]);return new Vn(o,[[-1,0,0,n[0]],[1,0,0,-t[0]],[0,-1,0,n[1]],[0,1,0,-t[1]],[0,0,-1,n[2]],[0,0,1,-t[2]]],t,n)}static fromCenterSizeAngles(t,n,o){const c=d.bz([],o[0],o[1],o[2]),f=d.bA([],[n[0],0,0],c),y=d.bA([],[0,n[1],0],c),b=d.bA([],[0,0,n[2]],c),w=[...t],S=[...t];for(let E=0;E<8;E++)for(let C=0;C<3;C++){const z=t[C]+f[C]*(1&~E?-1:1)+y[C]*((E>>1&1)==1?1:-1)+b[C]*((E>>2&1)==1?1:-1);w[C]=Math.min(w[C],z),S[C]=Math.max(S[C],z)}const P=[];for(let E=0;E<8;E++){const C=[...t];d.a_(C,C,d.aZ([],f,1&~E?-1:1)),d.a_(C,C,d.aZ([],y,(E>>1&1)==1?1:-1)),d.a_(C,C,d.aZ([],b,(E>>2&1)==1?1:-1)),P.push(C)}return new Vn(P,[[...f,-d.b3(f,P[0])],[...y,-d.b3(y,P[0])],[...b,-d.b3(b,P[0])],[-f[0],-f[1],-f[2],-d.b3(f,P[7])],[-y[0],-y[1],-y[2],-d.b3(y,P[7])],[-b[0],-b[1],-b[2],-d.b3(b,P[7])]],w,S)}intersectsFrustum(t){let n=!0;const o=this.points.length,c=this.planes.length,f=t.planes.length,y=t.points.length;for(let b=0;b<f;b++){const w=t.planes[b];let S=0;for(let P=0;P<o;P++){const E=this.points[P];w[0]*E[0]+w[1]*E[1]+w[2]*E[2]+w[3]>=0&&S++}if(S===0)return 0;S<o&&(n=!1)}if(n)return 2;for(let b=0;b<c;b++){const w=this.planes[b];let S=0;for(let P=0;P<y;P++){const E=t.points[P];w[0]*E[0]+w[1]*E[1]+w[2]*E[2]+w[3]>=0&&S++}if(S===0)return 0}return 1}intersectsPlane(t){const n=this.points.length;let o=0;for(let c=0;c<n;c++){const f=this.points[c];t[0]*f[0]+t[1]*f[1]+t[2]*f[2]+t[3]>=0&&o++}return o===n?2:o===0?0:1}}function wa(p,t,n){const o=p-t;return o<0?-o:Math.max(0,o-n)}function Go(p,t,n,o,c){const f=p-n;let y;return y=f<0?Math.min(-f,1+f-c):f>c?Math.min(Math.max(f-c,0),1-f):0,Math.max(y,wa(t,o,c))}class Ru{constructor(){this._boundingVolumeCache=new ku(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,n,o,c){const f=1<<o.z,y=1/f,b=o.x/f,w=o.y/f;let S=2;return S=Math.min(S,Go(t,n,b,w,y)),S=Math.min(S,Go(t,n,b+.5,-w-y,y)),S=Math.min(S,Go(t,n,b+.5,2-w-y,y)),S}getWrap(t,n,o){const c=1<<n.z,f=1/c,y=n.x/c,b=wa(t.x,y,f),w=wa(t.x,y-1,f),S=wa(t.x,y+1,f),P=Math.min(b,w,S);return P===S?1:P===w?-1:0}allowVariableZoom(t,n){return yi(t,n)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,n,o,c){return this._boundingVolumeCache.getTileBoundingVolume(t,n,o,c)}_computeTileBoundingVolume(t,n,o,c){var f,y;let b=0,w=0;if(c?.terrain){const S=new d.a2(t.z,n,t.z,t.x,t.y),P=c.terrain.getMinMaxElevation(S);b=(f=P.minElevation)!==null&&f!==void 0?f:Math.min(0,o),w=(y=P.maxElevation)!==null&&y!==void 0?y:Math.max(0,o)}if(b/=d.bC,w/=d.bC,b+=1,w+=1,t.z<=0)return Vn.fromAabb([-w,-w,-w],[w,w,w]);if(t.z===1)return Vn.fromAabb([t.x===0?-w:0,t.y===0?0:-w,-w],[t.x===0?0:w,t.y===0?w:0,w]);{const S=[zr(0,0,t.x,t.y,t.z),zr(d.a5,0,t.x,t.y,t.z),zr(d.a5,d.a5,t.x,t.y,t.z),zr(0,d.a5,t.x,t.y,t.z)],P=[];for(const ie of S)P.push(d.aZ([],ie,w));if(w!==b)for(const ie of S)P.push(d.aZ([],ie,b));t.y===0&&P.push([0,1,0]),t.y===(1<<t.z)-1&&P.push([0,-1,0]);const E=[1,1,1],C=[-1,-1,-1];for(const ie of P)for(let ne=0;ne<3;ne++)E[ne]=Math.min(E[ne],ie[ne]),C[ne]=Math.max(C[ne],ie[ne]);const z=zr(d.a5/2,d.a5/2,t.x,t.y,t.z),F=d.b2([],[0,1,0],z);d.b1(F,F);const V=d.b2([],z,F);d.b1(V,V);const j=d.b2([],S[2],S[1]);d.b1(j,j);const N=d.b2([],S[0],S[3]);d.b1(N,N),P.push(d.aZ([],z,w)),t.y>=(1<<t.z)/2&&P.push(d.aZ([],zr(d.a5/2,0,t.x,t.y,t.z),w)),t.y<(1<<t.z)/2&&P.push(d.aZ([],zr(d.a5/2,d.a5,t.x,t.y,t.z),w));const $=ws(z,P),W=ws(V,P),G=[-z[0],-z[1],-z[2],$.max],q=[z[0],z[1],z[2],-$.min],Y=[-V[0],-V[1],-V[2],W.max],Z=[V[0],V[1],V[2],-W.min],Q=[...j,0],ae=[...N,0],oe=[];return t.y===0?oe.push(d.bB(ae,Q,G),d.bB(ae,Q,q)):oe.push(d.bB(Y,Q,G),d.bB(Y,Q,q),d.bB(Y,ae,G),d.bB(Y,ae,q)),t.y===(1<<t.z)-1?oe.push(d.bB(ae,Q,G),d.bB(ae,Q,q)):oe.push(d.bB(Z,Q,G),d.bB(Z,Q,q),d.bB(Z,ae,G),d.bB(Z,ae,q)),new Vn(oe,[G,q,Y,Z,Q,ae],E,C)}}}function ws(p,t){let n=1/0,o=-1/0;for(const c of t){const f=d.b3(p,c);n=Math.min(n,f),o=Math.max(o,f)}return{min:n,max:o}}class jn{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,n,o){return this._helper.interpolatePadding(t,n,o)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n){this._helper.resize(t,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,n){this._helper.overrideNearFarZ(t,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t){this._cachedClippingPlane=d.bD(),this._projectionMatrix=d.bh(),this._globeViewProjMatrix32f=d.bg(),this._globeViewProjMatrixNoCorrection=d.bh(),this._globeViewProjMatrixNoCorrectionInverted=d.bh(),this._globeProjMatrixInverted=d.bh(),this._cameraPosition=d.by(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(n,o)=>{const c=d.ak(n.lat,-d.al,d.al),f=d.ak(+o,this.minZoom+Vt(0,c),this.maxZoom);return{center:new d.V(n.lng,c),zoom:f}},this.applyConstrain=(n,o)=>this._helper.applyConstrain(n,o),this._helper=new rn({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,o)=>this.defaultConstrain(n,o)},t),this._coveringTilesDetailsProvider=new Ru}clone(){const t=new jn;return t.apply(this,!1),t}apply(t,n,o){this._globeLatitudeErrorCorrectionRadians=o||0,this._helper.apply(t,n)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const t=d.by();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){const{overscaledTileID:n,applyGlobeMatrix:o}=t,c=this._helper.getMercatorTileCoordinates(n);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:c,clippingPlane:this._cachedClippingPlane,projectionTransition:o?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){const n=this.pitchInRadians,o=this.cameraToCenterDistance/t,c=Math.sin(n)*o,f=Math.cos(n)*o+1,y=1/Math.sqrt(c*c+f*f)*1;let b=-c,w=f;const S=Math.sqrt(b*b+w*w);b/=S,w/=S;const P=[0,b,w];d.bE(P,P,[0,0,0],-this.bearingInRadians),d.bF(P,P,[0,0,0],-1*this.center.lat*Math.PI/180),d.bG(P,P,[0,0,0],this.center.lng*Math.PI/180);const E=1/d.b5(P);return d.aZ(P,P,E),[...P,-y*E]}isLocationOccluded(t){return!this.isSurfacePointVisible(rt(t))}transformLightDirection(t){const n=this._helper._center.lng*Math.PI/180,o=this._helper._center.lat*Math.PI/180,c=Math.cos(o),f=[Math.sin(n)*c,Math.sin(o),Math.cos(n)*c],y=[f[2],0,-f[0]],b=[0,0,0];d.b2(b,y,f),d.b1(y,y),d.b1(b,b);const w=[0,0,0];return d.b1(w,[y[0]*t[0]+b[0]*t[1]+f[0]*t[2],y[1]*t[0]+b[1]*t[1]+f[1]*t[2],y[2]*t[0]+b[2]*t[1]+f[2]*t[2]]),w}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,n,o){const c=(function(b,w,S){const P=1/(1<<S.z);return new d.a6(b/d.a5*P+S.x*P,w/d.a5*P+S.y*P)})(t,n,o.canonical),f=(y=c.y,[d.bx(c.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-y*Math.PI*2))-.5*Math.PI]);var y;return this.getCircleRadiusCorrection()/Math.cos(f[1])}projectTileCoordinates(t,n,o,c){const f=o.canonical,y=zr(t,n,f.x,f.y,f.z),b=1+(c?c(t,n):0)/d.bC,w=[y[0]*b,y[1]*b,y[2]*b,1];d.aE(w,w,this._globeViewProjMatrixNoCorrection);const S=this._cachedClippingPlane,P=S[0]*y[0]+S[1]*y[1]+S[2]*y[2]+S[3]<0;return{point:new d.P(w[0]/w[3],w[1]/w[3]),signedDistanceFromCamera:w[3],isOccluded:P}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const t=On(this.worldSize,this.center.lat),n=d.bi(),o=d.bi();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),d.bc(n,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const c=this.centerOffset;n[8]=2*-c.x/this._helper._width,n[9]=2*c.y/this._helper._height,this._projectionMatrix=d.bd(n),this._globeProjMatrixInverted=d.bi(),d.ay(this._globeProjMatrixInverted,n),d.O(n,n,[0,0,-this.cameraToCenterDistance]),d.be(n,n,this.rollInRadians),d.bf(n,n,-this.pitchInRadians),d.be(n,n,this.bearingInRadians),d.O(n,n,[0,0,-t]);const f=d.by();f[0]=t,f[1]=t,f[2]=t,d.bf(o,n,this.center.lat*Math.PI/180),d.bH(o,o,-this.center.lng*Math.PI/180),d.Q(o,o,f),this._globeViewProjMatrixNoCorrection=o,d.bf(n,n,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),d.bH(n,n,-this.center.lng*Math.PI/180),d.Q(n,n,f),this._globeViewProjMatrix32f=new Float32Array(n),this._globeViewProjMatrixNoCorrectionInverted=d.bi(),d.ay(this._globeViewProjMatrixNoCorrectionInverted,o);const y=d.by();this._cameraPosition=d.by(),this._cameraPosition[2]=this.cameraToCenterDistance/t,d.bE(this._cameraPosition,this._cameraPosition,y,-this.rollInRadians),d.bF(this._cameraPosition,this._cameraPosition,y,this.pitchInRadians),d.bE(this._cameraPosition,this._cameraPosition,y,-this.bearingInRadians),d.a_(this._cameraPosition,this._cameraPosition,[0,0,1]),d.bF(this._cameraPosition,this._cameraPosition,y,-this.center.lat*Math.PI/180),d.bG(this._cameraPosition,this._cameraPosition,y,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);const b=d.bd(this._globeViewProjMatrixNoCorrectionInverted);d.Q(b,b,[1,1,-1]),this._cachedFrustum=nr.fromInvProjectionMatrix(b,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){d.w("calculateFogMatrix is not supported on globe projection.");const n=d.bi();return d.ao(n),n}getVisibleUnwrappedCoordinates(t){return[new d.ba(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&d.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,n){if(!this._globeViewProjMatrixNoCorrection)return 1;const o=rt(t);d.aZ(o,o,1+n/d.bC);const c=d.bD();return d.aE(c,[o[0],o[1],o[2],1],this._globeViewProjMatrixNoCorrection),c[2]/c[3]}populateCache(t){}getBounds(){const t=.5*this.width,n=.5*this.height,o=[new d.P(0,0),new d.P(t,0),new d.P(this.width,0),new d.P(this.width,n),new d.P(this.width,this.height),new d.P(t,this.height),new d.P(0,this.height),new d.P(0,n)],c=[];for(const E of o)c.push(this.unprojectScreenPoint(E));let f=0,y=0,b=0,w=0;const S=this.center;for(const E of c){const C=d.bI(S.lng,E.lng),z=d.bI(S.lat,E.lat);C<y&&(y=C),C>f&&(f=C),z<w&&(w=z),z>b&&(b=z)}const P=[S.lng+y,S.lat+w,S.lng+f,S.lat+b];return this.isSurfacePointOnScreen([0,1,0])&&(P[3]=90,P[0]=-180,P[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(P[1]=-90,P[0]=-180,P[2]=180),new xt(P)}calculateCenterFromCameraLngLatAlt(t,n,o,c){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,o,c)}setLocationAtPoint(t,n){const o=rt(this.unprojectScreenPoint(n)),c=rt(t),f=d.by();d.bJ(f);const y=d.by();d.bG(y,o,f,-this.center.lng*Math.PI/180),d.bF(y,y,f,this.center.lat*Math.PI/180);const b=c[0]*c[0]+c[2]*c[2],w=y[0]*y[0];if(b<w)return;const S=Math.sqrt(b-w),P=-S,E=d.bK(c[0],c[2],y[0],S),C=d.bK(c[0],c[2],y[0],P),z=d.by();d.bG(z,c,f,-E);const F=d.bK(z[1],z[2],y[1],y[2]),V=d.by();d.bG(V,c,f,-C);const j=d.bK(V[1],V[2],y[1],y[2]),N=.5*Math.PI,$=F>=-N&&F<=N,W=j>=-N&&j<=N;let G,q;if($&&W){const ae=this.center.lng*Math.PI/180,oe=this.center.lat*Math.PI/180;d.bL(E,ae)+d.bL(F,oe)<d.bL(C,ae)+d.bL(j,oe)?(G=E,q=F):(G=C,q=j)}else if($)G=E,q=F;else{if(!W)return;G=C,q=j}const Y=G/Math.PI*180,Z=q/Math.PI*180,Q=this.center.lat;this.setCenter(new d.V(Y,d.ak(Z,-90,90))),this.setZoom(this.zoom+Vt(Q,this.center.lat))}locationToScreenPoint(t,n){const o=rt(t);if(n){const c=n.getElevationForLngLatZoom(t,this._helper._tileZoom);d.aZ(o,o,1+c/d.bC)}return this._projectSurfacePointToScreen(o)}_projectSurfacePointToScreen(t){const n=d.bD();return d.aE(n,[...t,1],this._globeViewProjMatrixNoCorrection),n[0]/=n[3],n[1]/=n[3],new d.P((.5*n[0]+.5)*this.width,(.5*-n[1]+.5)*this.height)}screenPointToMercatorCoordinate(t,n){if(n){const o=n.pointCoordinate(t);if(o)return o}return d.a6.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,n){var o;return(o=this.screenPointToMercatorCoordinate(t,n))===null||o===void 0?void 0:o.toLngLat()}isPointOnMapSurface(t,n){const o=this._cameraPosition,c=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(o,c)}getRayDirectionFromPixel(t){const n=d.bD();n[0]=t.x/this.width*2-1,n[1]=-1*(t.y/this.height*2-1),n[2]=1,n[3]=1,d.aE(n,n,this._globeViewProjMatrixNoCorrectionInverted),n[0]/=n[3],n[1]/=n[3],n[2]/=n[3];const o=d.by();o[0]=n[0]-this._cameraPosition[0],o[1]=n[1]-this._cameraPosition[1],o[2]=n[2]-this._cameraPosition[2];const c=d.by();return d.b1(c,o),c}isSurfacePointVisible(t){const n=this._cachedClippingPlane;return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;const n=d.bD();return d.aE(n,[...t,1],this._globeViewProjMatrixNoCorrection),n[0]/=n[3],n[1]/=n[3],n[2]/=n[3],n[0]>-1&&n[0]<1&&n[1]>-1&&n[1]<1&&n[2]>-1&&n[2]<1}rayPlanetIntersection(t,n){const o=d.b3(t,n),c=d.by(),f=d.by();d.aZ(f,n,o),d.b0(c,t,f);const y=1-d.b3(c,c);if(y<0)return null;const b=d.b3(t,t)-1,w=-o+(o<0?1:-1)*Math.sqrt(y),S=b/w,P=w;return{tMin:Math.min(S,P),tMax:Math.max(S,P)}}unprojectScreenPoint(t){const n=this._cameraPosition,o=this.getRayDirectionFromPixel(t),c=this.rayPlanetIntersection(n,o);if(c){const P=d.by();d.a_(P,n,[o[0]*c.tMin,o[1]*c.tMin,o[2]*c.tMin]);const E=d.by();return d.b1(E,P),Yi(E)}const f=this._cachedClippingPlane,y=f[0]*o[0]+f[1]*o[1]+f[2]*o[2],b=-d.b9(f,n)/y,w=d.by();if(b>0)d.a_(w,n,[o[0]*b,o[1]*b,o[2]*b]);else{const P=d.by();d.a_(P,n,[2*o[0],2*o[1],2*o[2]]);const E=d.b9(this._cachedClippingPlane,P);d.b0(w,P,[this._cachedClippingPlane[0]*E,this._cachedClippingPlane[1]*E,this._cachedClippingPlane[2]*E])}const S=(function(P){const E=d.by();return E[0]=P[0]*-P[3],E[1]=P[1]*-P[3],E[2]=P[2]*-P[3],{center:E,radius:Math.sqrt(1-P[3]*P[3])}})(f);return Yi((function(P,E,C){const z=d.by();d.b0(z,C,P);const F=d.by();return d.bw(F,P,z,E/d.b7(z)),F})(S.center,S.radius,w))}getMatrixForModel(t,n){const o=d.V.convert(t),c=1/d.bC,f=d.bh();return d.bH(f,f,o.lng/180*Math.PI),d.bf(f,f,-o.lat/180*Math.PI),d.O(f,f,[0,0,1+n/d.bC]),d.bf(f,f,.5*Math.PI),d.Q(f,f,[c,c,c]),f}getProjectionDataForCustomLayer(t=!0){const n=this.getProjectionData({overscaledTileID:new d.a2(0,0,0,0,0),applyGlobeMatrix:t});return n.tileMercatorCoords=[0,0,1,1],n}getFastPathSimpleProjectionMatrix(t){}}class on{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,n,o){return this._helper.interpolatePadding(t,n,o)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n,o=!0){this._helper.resize(t,n,o)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,n){this._helper.overrideNearFarZ(t,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t,n){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=n,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(n,o)=>this.currentTransform.defaultConstrain(n,o),this.applyConstrain=(n,o)=>this._helper.applyConstrain(n,o),this._helper=new rn({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,o)=>this.defaultConstrain(n,o)},t),this._globeness=1,this._mercatorTransform=new lr,this._verticalPerspectiveTransform=new jn}clone(){const t=new on;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this,!1),t}apply(t,n){this._helper.apply(t,n),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){const n=this._mercatorTransform.getProjectionData(t),o=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?o.mainMatrix:n.mainMatrix,clippingPlane:o.clippingPlane,tileMercatorCoords:o.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:n.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return d.bs(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return d.bs(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,n,o){const c=this._mercatorTransform.getPitchedTextCorrection(t,n,o),f=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,n,o);return d.bs(c,f,this._globeness)}projectTileCoordinates(t,n,o,c){return this.currentTransform.projectTileCoordinates(t,n,o,c)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,n){return this.currentTransform.lngLatToCameraDepth(t,n)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,n,o,c){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,o,c)}setLocationAtPoint(t,n){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(t,n),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(t,n),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(t,n){return this.currentTransform.locationToScreenPoint(t,n)}screenPointToMercatorCoordinate(t,n){return this.currentTransform.screenPointToMercatorCoordinate(t,n)}screenPointToLocation(t,n){return this.currentTransform.screenPointToLocation(t,n)}isPointOnMapSurface(t,n){return this.currentTransform.isPointOnMapSurface(t,n)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,n){return this.currentTransform.getMatrixForModel(t,n)}getProjectionDataForCustomLayer(t=!0){const n=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return n;const o=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return o.fallbackMatrix=n.mainMatrix,o}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class Mi{get useGlobeControls(){return!0}handlePanInertia(t,n){const o=Uo(t,n);return Math.abs(o.lng-n.center.lng)>180&&(o.lng=n.center.lng+179.5*Math.sign(o.lng-n.center.lng)),{easingCenter:o,easingOffset:new d.P(0,0)}}handleMapControlsRollPitchBearingZoom(t,n){const o=t.around,c=n.screenPointToLocation(o);t.bearingDelta&&n.setBearing(n.bearing+t.bearingDelta),t.pitchDelta&&n.setPitch(n.pitch+t.pitchDelta),t.rollDelta&&n.setRoll(n.roll+t.rollDelta);const f=n.zoom;t.zoomDelta&&n.setZoom(n.zoom+t.zoomDelta);const y=n.zoom-f;if(y===0)return;const b=d.bI(n.center.lng,c.lng),w=b/(Math.abs(b/180)+1),S=d.bI(n.center.lat,c.lat),P=n.getRayDirectionFromPixel(o),E=n.cameraPosition,C=-1*d.b3(E,P),z=d.by();d.a_(z,E,[P[0]*C,P[1]*C,P[2]*C]);const F=d.b5(z)-1,V=Math.exp(.5*-Math.max(F-.3,0)),j=On(n.worldSize,n.center.lat)/Math.min(n.width,n.height),N=d.bv(j,.9,.5,1,.25),$=(1-d.an(-y))*Math.min(V,N),W=n.center.lat,G=n.zoom,q=new d.V(n.center.lng+w*$,d.ak(n.center.lat+S*$,-d.al,d.al));n.setLocationAtPoint(c,o);const Y=n.center,Z=d.bv(Math.abs(b),45,85,0,1),Q=d.bv(j,.75,.35,0,1),ae=Math.pow(Math.max(Z,Q),.25),oe=d.bI(Y.lng,q.lng),ie=d.bI(Y.lat,q.lat);n.setCenter(new d.V(Y.lng+oe*ae,Y.lat+ie*ae).wrap()),n.setZoom(G+Vt(W,n.center.lat))}handleMapControlsPan(t,n,o){if(!t.panDelta)return;const c=n.center.lat,f=n.zoom;n.setCenter(Uo(t.panDelta,n).wrap()),n.setZoom(f+Vt(c,n.center.lat))}cameraForBoxAndBearing(t,n,o,c,f){const y=cr(t,n,o,c,f),b=n.left/f.width*2-1,w=(f.width-n.right)/f.width*2-1,S=n.top/f.height*-2+1,P=(f.height-n.bottom)/f.height*-2+1,E=d.bI(o.getWest(),o.getEast())<0,C=E?o.getEast():o.getWest(),z=E?o.getWest():o.getEast(),F=Math.max(o.getNorth(),o.getSouth()),V=Math.min(o.getNorth(),o.getSouth()),j=C+.5*d.bI(C,z),N=F+.5*d.bI(F,V),$=f.clone();$.setCenter(y.center),$.setBearing(y.bearing),$.setPitch(0),$.setRoll(0),$.setZoom(y.zoom);const W=$.modelViewProjectionMatrix,G=[rt(o.getNorthWest()),rt(o.getNorthEast()),rt(o.getSouthWest()),rt(o.getSouthEast()),rt(new d.V(z,N)),rt(new d.V(C,N)),rt(new d.V(j,F)),rt(new d.V(j,V))],q=rt(y.center);let Y=Number.POSITIVE_INFINITY;for(const Z of G)b<0&&(Y=Mi.getLesserNonNegativeNonNull(Y,Mi.solveVectorScale(Z,q,W,"x",b))),w>0&&(Y=Mi.getLesserNonNegativeNonNull(Y,Mi.solveVectorScale(Z,q,W,"x",w))),S>0&&(Y=Mi.getLesserNonNegativeNonNull(Y,Mi.solveVectorScale(Z,q,W,"y",S))),P<0&&(Y=Mi.getLesserNonNegativeNonNull(Y,Mi.solveVectorScale(Z,q,W,"y",P)));if(Number.isFinite(Y)&&Y!==0)return y.zoom=$.zoom+d.aq(Y),y;Vi()}handleJumpToCenterZoom(t,n){const o=t.center.lat,c=t.applyConstrain(n.center?d.V.convert(n.center):t.center,t.zoom).center;t.setCenter(c.wrap());const f=n.zoom!==void 0?+n.zoom:t.zoom+Vt(o,c.lat);t.zoom!==f&&t.setZoom(f)}handleEaseTo(t,n){const o=t.zoom,c=t.center,f=t.padding,y={roll:t.roll,pitch:t.pitch,bearing:t.bearing},b={roll:n.roll===void 0?t.roll:n.roll,pitch:n.pitch===void 0?t.pitch:n.pitch,bearing:n.bearing===void 0?t.bearing:n.bearing},w=n.zoom!==void 0,S=!t.isPaddingEqual(n.padding);let P=!1;const E=n.center?d.V.convert(n.center):c,C=t.applyConstrain(E,o).center;ri(t,C);const z=t.clone();z.setCenter(C),z.setZoom(w?+n.zoom:o+Vt(c.lat,E.lat)),z.setBearing(n.bearing);const F=new d.P(d.ak(t.centerPoint.x+n.offsetAsPoint.x,0,t.width),d.ak(t.centerPoint.y+n.offsetAsPoint.y,0,t.height));z.setLocationAtPoint(C,F);const V=(n.offset&&n.offsetAsPoint.mag())>0?z.center:C,j=w?+n.zoom:o+Vt(c.lat,V.lat),N=o+Vt(c.lat,0),$=j+Vt(V.lat,0),W=d.bI(c.lng,V.lng),G=d.bI(c.lat,V.lat),q=d.an($-N);return P=j!==o,{easeFunc:Y=>{if(d.bm(y,b)||Vo({startEulerAngles:y,endEulerAngles:b,tr:t,k:Y,useSlerp:y.roll!=b.roll}),S&&t.interpolatePadding(f,n.padding,Y),n.around)d.w("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(n.around,n.aroundPoint);else{const Z=$>N?Math.min(2,q):Math.max(.5,q),Q=Math.pow(Z,1-Y),ae=uc(c,W,G,Y*Q);t.setCenter(ae.wrap())}if(P){const Z=d.G.number(N,$,Y)+Vt(0,t.center.lat);t.setZoom(Z)}},isZooming:P,elevationCenter:V}}handleFlyTo(t,n){const o=n.zoom!==void 0,c=t.center,f=t.zoom,y=t.padding,b=!t.isPaddingEqual(n.padding),w=t.applyConstrain(d.V.convert(n.center||n.locationAtOffset),f).center,S=o?+n.zoom:t.zoom+Vt(t.center.lat,w.lat),P=t.clone();P.setCenter(w),P.setZoom(S),P.setBearing(n.bearing);const E=new d.P(d.ak(t.centerPoint.x+n.offsetAsPoint.x,0,t.width),d.ak(t.centerPoint.y+n.offsetAsPoint.y,0,t.height));P.setLocationAtPoint(w,E);const C=P.center;ri(t,C);const z=(function(G,q,Y){const Z=rt(q),Q=rt(Y),ae=d.b3(Z,Q),oe=Math.acos(ae),ie=cc(G);return oe/(2*Math.PI)*ie})(t,c,C),F=f+Vt(c.lat,0),V=S+Vt(C.lat,0),j=d.an(V-F);let N;if(typeof n.minZoom=="number"){const G=+n.minZoom+Vt(C.lat,0),q=Math.min(G,F,V)+Vt(0,C.lat),Y=t.applyConstrain(C,q).zoom+Vt(C.lat,0);N=d.an(Y-F)}const $=d.bI(c.lng,C.lng),W=d.bI(c.lat,C.lat);return{easeFunc:(G,q,Y,Z)=>{const Q=uc(c,$,W,Y);b&&t.interpolatePadding(y,n.padding,G);const ae=G===1?C:Q;t.setCenter(ae.wrap());const oe=F+d.aq(q);t.setZoom(G===1?S:oe+Vt(0,ae.lat))},scaleOfZoom:j,targetCenter:C,scaleOfMinZoom:N,pixelPathLength:z}}static solveVectorScale(t,n,o,c,f){const y=c==="x"?[o[0],o[4],o[8],o[12]]:[o[1],o[5],o[9],o[13]],b=[o[3],o[7],o[11],o[15]],w=t[0]*y[0]+t[1]*y[1]+t[2]*y[2],S=t[0]*b[0]+t[1]*b[1]+t[2]*b[2],P=n[0]*y[0]+n[1]*y[1]+n[2]*y[2],E=n[0]*b[0]+n[1]*b[1]+n[2]*b[2];return P+f*S===w+f*E||b[3]*(w-P)+y[3]*(E-S)+w*E==P*S?null:(P+y[3]-f*E-f*b[3])/(P-w-f*E+f*S)}static getLesserNonNegativeNonNull(t,n){return n!==null&&n>=0&&n<t?n:t}}class Ta{constructor(t){this._globe=t,this._mercatorCameraHelper=new ba,this._verticalPerspectiveCameraHelper=new Mi}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,n){return this.currentHelper.handlePanInertia(t,n)}handleMapControlsRollPitchBearingZoom(t,n){return this.currentHelper.handleMapControlsRollPitchBearingZoom(t,n)}handleMapControlsPan(t,n,o){this.currentHelper.handleMapControlsPan(t,n,o)}cameraForBoxAndBearing(t,n,o,c,f){return this.currentHelper.cameraForBoxAndBearing(t,n,o,c,f)}handleJumpToCenterZoom(t,n){this.currentHelper.handleJumpToCenterZoom(t,n)}handleEaseTo(t,n){return this.currentHelper.handleEaseTo(t,n)}handleFlyTo(t,n){return this.currentHelper.handleFlyTo(t,n)}}const Ei=(p,t)=>d.B(p,t&&t.filter((n=>n.identifier!=="source.canvas"))),Fu=d.bM();class Ts extends d.E{constructor(t,n={}){var o,c;super(),this._rtlPluginLoaded=()=>{for(const y in this.tileManagers){const b=this.tileManagers[y].getSource().type;b!=="vector"&&b!=="geojson"||this.tileManagers[y].reload()}},this.map=t,this.dispatcher=new Sn(Wr(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",((y,b)=>this.getGlyphs(y,b))),this.dispatcher.registerMessageHandler("GI",((y,b)=>this.getImages(y,b))),this.dispatcher.registerMessageHandler("GDA",((y,b)=>this.getDashes(y,b))),this.imageManager=new ls,this.imageManager.setEventedParent(this);const f=((o=t._container)===null||o===void 0?void 0:o.lang)||typeof document<"u"&&((c=document.documentElement)===null||c===void 0?void 0:c.lang)||void 0;this.glyphManager=new _e(t._requestManager,n.localIdeographFontFamily,f),this.lineAtlas=new Ke(256,512),this.crossTileSymbolIndex=new ac,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",d.bN()),Cr().on(ds,this._rtlPluginLoaded),this.on("data",(y=>{if(y.dataType!=="source"||y.sourceDataType!=="metadata")return;const b=this.tileManagers[y.sourceId];if(!b)return;const w=b.getSource();if(w&&w.vectorLayerIds)for(const S in this._layers){const P=this._layers[S];P.source===w.id&&this._validateLayer(P)}}))}_setInitialValues(){var t;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new d.bO,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new(((t=this.crossTileSymbolIndex)===null||t===void 0?void 0:t.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(t,n){var o,c,f;this._checkLoaded();const y=n===null?(f=(c=(o=this.stylesheet.state)===null||o===void 0?void 0:o[t])===null||c===void 0?void 0:c.default)!==null&&f!==void 0?f:null:n;if(d.bP(y,this._globalState[t]))return this;this._globalState[t]=y,this._applyGlobalStateChanges([t])}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();const n=[];for(const o in t)!d.bP(this._globalState[o],t[o].default)&&(n.push(o),this._globalState[o]=t[o].default);this._applyGlobalStateChanges(n)}_applyGlobalStateChanges(t){if(t.length===0)return;const n=new Set,o={};for(const c of t){o[c]=this._globalState[c];for(const f in this._layers){const y=this._layers[f],b=y.getLayoutAffectingGlobalStateRefs(),w=y.getPaintAffectingGlobalStateRefs(),S=y.getVisibilityAffectingGlobalStateRefs();if(b.has(c)&&n.add(y.source),w.has(c))for(const{name:P,value:E}of w.get(c))this._updatePaintProperty(y,P,E);S?.has(c)&&(y.recalculateVisibility(),this._updateLayer(y))}}this.dispatcher.broadcast("UGS",o);for(const c in this.tileManagers)n.has(c)&&(this._reloadSource(c),this._changed=!0)}loadURL(t){return d._(this,arguments,void 0,(function*(n,o={},c){this.fire(new d.l("dataloading",{dataType:"style"})),o.validate=typeof o.validate!="boolean"||o.validate;const f=yield this.map._requestManager.transformRequest(n,"Style");this._loadStyleRequest=new AbortController;const y=this._loadStyleRequest;try{const b=yield d.j(f,this._loadStyleRequest);this._loadStyleRequest=null,this._load(b.data,o,c)}catch(b){this._loadStyleRequest=null,b&&!y.signal.aborted&&this.fire(new d.k(b))}}))}loadJSON(t,n={},o){this.fire(new d.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,Kt.frameAsync(this._frameRequest,this.map._ownerWindow).then((()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(t,n,o)})).catch((()=>{}))}loadEmpty(){this.fire(new d.l("dataloading",{dataType:"style"})),this._load(Fu,{validate:!1})}_load(t,n,o){var c,f;let y=n.transformStyle?n.transformStyle(o,t):t;if(!n.validate||!Ei(this,d.C(y))){y=Object.assign({},y),this._loaded=!0,this.stylesheet=y;for(const b in y.sources)this.addSource(b,y.sources[b],{validate:!1});y.sprite?this._loadSprite(y.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(y.glyphs),this._createLayers(),this.light=new ze(this.stylesheet.light),this._setProjectionInternal(((c=this.stylesheet.projection)===null||c===void 0?void 0:c.type)||"mercator"),this.sky=new Le(this.stylesheet.sky),this.map.setTerrain((f=this.stylesheet.terrain)!==null&&f!==void 0?f:null),this.fire(new d.l("data",{dataType:"style"})),this.fire(new d.l("style.load"))}}_createLayers(){var t,n,o;const c=d.bQ(this.stylesheet.layers);this.setGlobalState((t=this.stylesheet.state)!==null&&t!==void 0?t:null),this.dispatcher.broadcast("SL",c),this._order=c.map((f=>f.id)),this._layers={},this._serializedLayers=null;for(const f of c){const y=d.bR(f,this._globalState);if(y.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=y,d.bS(y)&&this.tileManagers[y.source]){const b=(o=(n=f.paint)===null||n===void 0?void 0:n["raster-fade-duration"])!==null&&o!==void 0?o:y.paint.get("raster-fade-duration");this.tileManagers[y.source].setRasterFadeDuration(b)}}}_loadSprite(t,n=!1,o=void 0){this.imageManager.setLoaded(!1);const c=new AbortController;let f;this._spriteRequest=c,(function(y,b,w,S){return d._(this,void 0,void 0,(function*(){const P=It(y),E=w>1?"@2x":"",C={},z={};for(const{id:F,url:V}of P){const j=yield b.transformRequest(os(V,E,".json"),"SpriteJSON");C[F]=d.j(j,S);const N=yield b.transformRequest(os(V,E,".png"),"SpriteImage");z[F]=Ti.getImage(N,S)}return yield Promise.all([...Object.values(C),...Object.values(z)]),(function(F,V){return d._(this,void 0,void 0,(function*(){const j={};for(const N in F){j[N]={};const $=Kt.getImageCanvasContext((yield V[N]).data),W=(yield F[N]).data;for(const G in W){const{width:q,height:Y,x:Z,y:Q,sdf:ae,pixelRatio:oe,stretchX:ie,stretchY:ne,content:pe,textFitWidth:fe,textFitHeight:de}=W[G];j[N][G]={data:null,pixelRatio:oe,sdf:ae,stretchX:ie,stretchY:ne,content:pe,textFitWidth:fe,textFitHeight:de,spriteData:{width:q,height:Y,x:Z,y:Q,context:$}}}}return j}))})(C,z)}))})(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((y=>{if(this._spriteRequest=null,y)for(const b in y){this._spritesImagesIds[b]=[];const w=this._spritesImagesIds[b]?this._spritesImagesIds[b].filter((S=>!(S in y))):[];for(const S of w)this.imageManager.removeImage(S),this._changedImages[S]=!0;for(const S in y[b]){const P=b==="default"?S:`${b}:${S}`;this._spritesImagesIds[b].push(P),P in this.imageManager.images?this.imageManager.updateImage(P,y[b][S],!1):this.imageManager.addImage(P,y[b][S]),n&&(this._changedImages[P]=!0)}}})).catch((y=>{this._spriteRequest=null,f=y,c.signal.aborted||this.fire(new d.k(f))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new d.l("data",{dataType:"style"})),o&&o(f)}))}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new d.l("data",{dataType:"style"}))}_validateLayer(t){const n=this.tileManagers[t.source];if(!n)return;const o=t.sourceLayer;if(!o)return;const c=n.getSource();(c.type==="geojson"||c.vectorLayerIds&&c.vectorLayerIds.indexOf(o)===-1)&&this.fire(new d.k(new Error(`Source layer "${o}" does not exist on source "${c.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.tileManagers)if(!this.tileManagers[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t,n=!1){const o=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n?d.bT(o):o);const c=[];for(const f of t)if(o[f]){const y=n?d.bT(o[f]):o[f];c.push(y)}return c}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const o of n){const c=this._layers[o];c.type!=="custom"&&(t[o]=c.serialize())}return t}hasTransitions(){var t,n,o;if(!((t=this.light)===null||t===void 0)&&t.hasTransition()||!((n=this.sky)===null||n===void 0)&&n.hasTransition()||!((o=this.projection)===null||o===void 0)&&o.hasTransition())return!0;for(const c in this.tileManagers)if(this.tileManagers[c].hasTransition())return!0;for(const c in this._layers)if(this._layers[c].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(n){const c=Object.keys(this._updatedLayers),f=Object.keys(this._removedLayers);(c.length||f.length)&&this._updateWorkerLayers(c,f);for(const y in this._updatedSources){const b=this._updatedSources[y];if(b==="reload")this._reloadSource(y);else{if(b!=="clear")throw new Error(`Invalid action ${b}`);this._clearSource(y)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const y in this._updatedPaintProps)this._layers[y].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const o={};for(const c in this.tileManagers){const f=this.tileManagers[c];o[c]=f.used,f.used=!1}for(const c of this._order){const f=this._layers[c];f.recalculate(t,this._availableImages),!f.isHidden(t.zoom)&&f.source&&(this.tileManagers[f.source].used=!0)}for(const c in o){const f=this.tileManagers[c];!!o[c]!=!!f.used&&f.fire(new d.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:c}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,n&&this.fire(new d.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.tileManagers)this.tileManagers[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){var o;this._checkLoaded();const c=this.serialize();if(t=n.transformStyle?n.transformStyle(c,t):t,((o=n.validate)===null||o===void 0||o)&&Ei(this,d.C(t)))return!1;(t=d.bT(t)).layers=d.bQ(t.layers);const f=d.bU(c,t),y=this._getOperationsToPerform(f);if(y.unimplemented.length>0)throw new Error(`Unimplemented: ${y.unimplemented.join(", ")}.`);if(y.operations.length===0)return!1;for(const b of y.operations)b();return this.stylesheet=t,this._serializedLayers=null,this.fire(new d.l("style.load",{style:this})),!0}_getOperationsToPerform(t){const n=[],o=[];for(const c of t)switch(c.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":n.push((()=>this.addLayer.apply(this,c.args)));break;case"removeLayer":n.push((()=>this.removeLayer.apply(this,c.args)));break;case"setPaintProperty":n.push((()=>this.setPaintProperty.apply(this,c.args)));break;case"setLayoutProperty":n.push((()=>this.setLayoutProperty.apply(this,c.args)));break;case"setFilter":n.push((()=>this.setFilter.apply(this,c.args)));break;case"addSource":n.push((()=>this.addSource.apply(this,c.args)));break;case"removeSource":n.push((()=>this.removeSource.apply(this,c.args)));break;case"setLayerZoomRange":n.push((()=>this.setLayerZoomRange.apply(this,c.args)));break;case"setLight":n.push((()=>this.setLight.apply(this,c.args)));break;case"setGeoJSONSourceData":n.push((()=>this.setGeoJSONSourceData.apply(this,c.args)));break;case"setGlyphs":n.push((()=>this.setGlyphs.apply(this,c.args)));break;case"setSprite":n.push((()=>this.setSprite.apply(this,c.args)));break;case"setTerrain":n.push((()=>this.map.setTerrain.apply(this,c.args)));break;case"setSky":n.push((()=>this.setSky.apply(this,c.args)));break;case"setProjection":this.setProjection.apply(this,c.args);break;case"setGlobalState":n.push((()=>this.setGlobalState.apply(this,c.args)));break;case"setTransition":n.push((()=>{}));break;default:o.push(c.command)}return{operations:n,unimplemented:o}}addImage(t,n){if(this.getImage(t))return this.fire(new d.k(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new d.k(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new d.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,o={}){if(this._checkLoaded(),this.tileManagers[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(d.C.source,`sources.${t}`,n,null,o))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const c=this.tileManagers[t]=new Qt(t,n,this.dispatcher);c.style=this,c.setEventedParent(this,(()=>({isSourceLoaded:c.loaded(),source:c.serialize(),sourceId:t}))),c.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw new Error(`There is no source with this ID=${t}`);for(const o in this._layers)if(this._layers[o].source===t)return this.fire(new d.k(new Error(`Source "${t}" cannot be removed while layer "${o}" is using it.`)));const n=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],n.fire(new d.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const o=this.tileManagers[t].getSource();if(o.type!=="geojson")throw new Error(`geojsonSource.type is ${o.type}, which is !== 'geojson`);o.setData(n),this._changed=!0}getSource(t){return this.tileManagers[t]&&this.tileManagers[t].getSource()}addLayer(t,n,o={}){this._checkLoaded();const c=t.id;if(this.getLayer(c))return void this.fire(new d.k(new Error(`Layer "${c}" already exists on this map.`)));let f;if(t.type==="custom"){if(Ei(this,d.bV(t)))return;f=d.bR(t,this._globalState)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(c,t.source),t=d.bT(t),t=d.e(t,{source:c})),this._validate(d.C.layer,`layers.${c}`,t,{arrayIndex:-1},o))return;f=d.bR(t,this._globalState),this._validateLayer(f),f.setEventedParent(this,{layer:{id:c}})}const y=n?this._order.indexOf(n):this._order.length;if(n&&y===-1)this.fire(new d.k(new Error(`Cannot add layer "${c}" before non-existing layer "${n}".`)));else{if(this._order.splice(y,0,c),this._layerOrderChanged=!0,this._layers[c]=f,this._removedLayers[c]&&f.source&&f.type!=="custom"){const b=this._removedLayers[c];delete this._removedLayers[c],b.type!==f.type?this._updatedSources[f.source]="clear":(this._updatedSources[f.source]="reload",this.tileManagers[f.source].pause())}this._updateLayer(f),f.onAdd&&f.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new d.k(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const o=this._order.indexOf(t);this._order.splice(o,1);const c=n?this._order.indexOf(n):this._order.length;n&&c===-1?this.fire(new d.k(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(c,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new d.k(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const o=this._order.indexOf(t);this._order.splice(o,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,o){this._checkLoaded();const c=this.getLayer(t);c?c.minzoom===n&&c.maxzoom===o||(n!=null&&(c.minzoom=n),o!=null&&(c.maxzoom=o),this._updateLayer(c)):this.fire(new d.k(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,o={}){this._checkLoaded();const c=this.getLayer(t);if(c){if(!d.bP(c.filter,n))return n==null?(c.setFilter(void 0),void this._updateLayer(c)):void(this._validate(d.C.filter,`layers.${c.id}.filter`,n,null,o)||(c.setFilter(d.bT(n)),this._updateLayer(c)))}else this.fire(new d.k(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return d.bT(this.getLayer(t).filter)}setLayoutProperty(t,n,o,c={}){this._checkLoaded();const f=this.getLayer(t);f?d.bP(f.getLayoutProperty(n),o)||(f.setLayoutProperty(n,o,c),this._updateLayer(f)):this.fire(new d.k(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const o=this.getLayer(t);if(o)return o.getLayoutProperty(n);this.fire(new d.k(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,o,c={}){this._checkLoaded();const f=this.getLayer(t);f?d.bP(f.getPaintProperty(n),o)||this._updatePaintProperty(f,n,o,c):this.fire(new d.k(new Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,n,o,c={}){t.setPaintProperty(n,o,c)&&this._updateLayer(t),d.bS(t)&&n==="raster-fade-duration"&&this.tileManagers[t.source].setRasterFadeDuration(o),this._changed=!0,this._updatedPaintProps[t.id]=!0,this._serializedLayers=null}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const o=t.source,c=t.sourceLayer,f=this.tileManagers[o];if(f===void 0)return void this.fire(new d.k(new Error(`The source '${o}' does not exist in the map's style.`)));const y=f.getSource().type;y==="geojson"&&c?this.fire(new d.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):y!=="vector"||c?(t.id===void 0&&this.fire(new d.k(new Error("The feature id parameter must be provided."))),f.setFeatureState(c,t.id,n)):this.fire(new d.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const o=t.source,c=this.tileManagers[o];if(c===void 0)return void this.fire(new d.k(new Error(`The source '${o}' does not exist in the map's style.`)));const f=c.getSource().type,y=f==="vector"?t.sourceLayer:void 0;f!=="vector"||y?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new d.k(new Error("A feature id is required to remove its specific state property."))):c.removeFeatureState(y,t.id,n):this.fire(new d.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,o=t.sourceLayer,c=this.tileManagers[n];if(c!==void 0)return c.getSource().type!=="vector"||o?(t.id===void 0&&this.fire(new d.k(new Error("The feature id parameter must be provided."))),c.getFeatureState(o,t.id)):void this.fire(new d.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new d.k(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return d.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=d.bW(this.tileManagers,(f=>f.serialize())),n=this._serializeByIds(this._order,!0),o=this.map.getTerrain()||void 0,c=this.stylesheet;return d.bX({version:c.version,name:c.name,metadata:c.metadata,light:c.light,sky:c.sky,center:c.center,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch,sprite:c.sprite,glyphs:c.glyphs,transition:c.transition,projection:c.projection,sources:t,layers:n,terrain:o},(f=>f!==void 0))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.tileManagers[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=y=>this._layers[y].type==="fill-extrusion",o={},c=[];for(let y=this._order.length-1;y>=0;y--){const b=this._order[y];if(n(b)){o[b]=y;for(const w of t){const S=w[b];if(S)for(const P of S)c.push(P)}}}c.sort(((y,b)=>b.intersectionZ-y.intersectionZ));const f=[];for(let y=this._order.length-1;y>=0;y--){const b=this._order[y];if(n(b))for(let w=c.length-1;w>=0;w--){const S=c[w].feature;if(o[S.layer.id]<y)break;f.push(S),c.pop()}else for(const w of t){const S=w[b];if(S)for(const P of S)f.push(P.feature)}}return f}queryRenderedFeatures(t,n,o){n&&n.filter&&this._validate(d.C.filter,"queryRenderedFeatures.filter",n.filter,null,n);const c={};if(n&&n.layers){if(!(Array.isArray(n.layers)||n.layers instanceof Set))return this.fire(new d.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const S of n.layers){const P=this._layers[S];if(!P)return this.fire(new d.k(new Error(`The layer '${S}' does not exist in the map's style and cannot be queried for features.`))),[];c[P.source]=!0}}const f=[];n.availableImages=this._availableImages;const y=this._serializedAllLayers(),b=n.layers instanceof Set?n.layers:Array.isArray(n.layers)?new Set(n.layers):null,w=Object.assign(Object.assign({},n),{layers:b,globalState:this._globalState});for(const S in this.tileManagers)n.layers&&!c[S]||f.push(Pn(this.tileManagers[S],this._layers,y,t,w,o,this.map.terrain?(P,E,C)=>this.map.terrain.getElevation(P,E,C):void 0));return this.placement&&f.push((function(S,P,E,C,z,F,V){const j={},N=F.queryRenderedSymbols(C),$=[];for(const W of Object.keys(N).map(Number))$.push(V[W]);$.sort(Ri);for(const W of $){const G=W.featureIndex.lookupSymbolFeatures(N[W.bucketInstanceId],P,W.bucketIndex,W.sourceLayerIndex,{filterSpec:z.filter,globalState:z.globalState},z.layers,z.availableImages,S);for(const q in G){const Y=j[q]=j[q]||[],Z=G[q];Z.sort(((Q,ae)=>{const oe=W.featureSortOrder;if(oe){const ie=oe.indexOf(Q.featureIndex);return oe.indexOf(ae.featureIndex)-ie}return ae.featureIndex-Q.featureIndex}));for(const Q of Z)Y.push(Q)}}return(function(W,G,q){for(const Y in W)for(const Z of W[Y])us(Z,q[G[Y].source]);return W})(j,S,E)})(this._layers,y,this.tileManagers,t,w,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(f)}querySourceFeatures(t,n){n?.filter&&this._validate(d.C.filter,"querySourceFeatures.filter",n.filter,null,n);const o=this.tileManagers[t];return o?(function(c,f){const y=c.getRenderableIds().map((S=>c.getTileByID(S))),b=[],w={};for(let S=0;S<y.length;S++){const P=y[S],E=P.tileID.canonical.key;w[E]||(w[E]=!0,P.querySourceFeatures(b,f))}return b})(o,n?Object.assign(Object.assign({},n),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const o=this.light.getLight();let c=!1;for(const y in t)if(!d.bP(t[y],o[y])){c=!0;break}if(!c)return;const f={now:Ze(),transition:d.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(f)}getProjection(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.projection}setProjection(t){if(this._checkLoaded(),this.stylesheet.projection=t,this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(t.type)}getSky(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.sky}setSky(t,n={}){this._checkLoaded();const o=this.getSky();let c=!1;if(!t&&!o)return;if(t&&!o)c=!0;else if(!t&&o)c=!0;else for(const y in t)if(!d.bP(t[y],o[y])){c=!0;break}if(!c)return;const f={now:Ze(),transition:d.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,n),this.sky.updateTransitions(f)}_setProjectionInternal(t){const n=(function(o,c){const f={constrainOverride:c};if(Array.isArray(o)){const y=new No({type:o});return{projection:y,transform:new on(f),cameraHelper:new Ta(y)}}switch(o){case"mercator":return{projection:new ti,transform:new lr(f),cameraHelper:new ba};case"globe":{const y=new No({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:y,transform:new on(f),cameraHelper:new Ta(y)}}case"vertical-perspective":return{projection:new lc,transform:new jn(f),cameraHelper:new Mi};default:return d.w(`Unknown projection name: ${o}. Falling back to mercator projection.`),{projection:new ti,transform:new lr(f),cameraHelper:new ba}}})(t,this.map.transformConstrain);this.projection=n.projection,this.map.migrateProjection(n.transform,n.cameraHelper);for(const o in this.tileManagers)this.tileManagers[o].reload()}_validate(t,n,o,c,f={}){return(!f||f.validate!==!1)&&Ei(this,t.call(d.C,d.e({key:n,style:this.serialize(),value:o,styleSpec:d.u},c)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),Cr().off(ds,this._rtlPluginLoaded);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.tileManagers){const o=this.tileManagers[n];o.setEventedParent(null),o.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.tileManagers[t].clearTiles()}_reloadSource(t){this.tileManagers[t].resume(),this.tileManagers[t].reload()}_updateSources(t){for(const n in this.tileManagers)this.tileManagers[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.tileManagers)this._reloadSource(t)}_updatePlacement(t,n,o,c,f=!1){let y=!1,b=!1;const w={};for(const S of this._order){const P=this._layers[S];if(P.type!=="symbol")continue;if(!w[P.source]){const C=this.tileManagers[P.source];w[P.source]=C.getRenderableIds(!0).map((z=>C.getTileByID(z))).sort(((z,F)=>F.tileID.overscaledZ-z.tileID.overscaledZ||(z.tileID.isLessThan(F.tileID)?-1:1)))}const E=this.crossTileSymbolIndex.addLayer(P,w[P.source],t.center.lng);y=y||E}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((f=f||this._layerOrderChanged||o===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(Ze(),t.zoom))&&(this.pauseablePlacement=new zu(t,this.map.terrain,this._order,f,n,o,c,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,w),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(Ze()),b=!0),y&&this.pauseablePlacement.placement.setStale()),b||y)for(const S of this._order){const P=this._layers[S];P.type==="symbol"&&this.placement.updateLayerOpacities(P,w[P.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(Ze())}_releaseSymbolFadeTiles(){for(const t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}getImages(t,n){return d._(this,void 0,void 0,(function*(){const o=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();const c=this.tileManagers[n.source];return c&&c.setDependencies(n.tileID.key,n.type,n.icons),o}))}getGlyphs(t,n){return d._(this,void 0,void 0,(function*(){const o=yield this.glyphManager.getGlyphs(n.stacks),c=this.tileManagers[n.source];return c&&c.setDependencies(n.tileID.key,n.type,[""]),o}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(d.C.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}getDashes(t,n){return d._(this,void 0,void 0,(function*(){const o={};for(const[c,f]of Object.entries(n.dashes))o[c]=this.lineAtlas.getDash(f.dasharray,f.round);return o}))}addSprite(t,n,o={},c){this._checkLoaded();const f=[{id:t,url:n}],y=[...It(this.stylesheet.sprite),...f];this._validate(d.C.sprite,"sprite",y,null,o)||(this.stylesheet.sprite=y,this._loadSprite(f,!0,c))}removeSprite(t){this._checkLoaded();const n=It(this.stylesheet.sprite);if(n.find((o=>o.id===t))){if(this._spritesImagesIds[t])for(const o of this._spritesImagesIds[t])this.imageManager.removeImage(o),this._changedImages[o]=!0;n.splice(n.findIndex((o=>o.id===t)),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new d.l("data",{dataType:"style"}))}else this.fire(new d.k(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return It(this.stylesheet.sprite)}setSprite(t,n={},o){this._checkLoaded(),t&&this._validate(d.C.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,o):(this._unloadSprite(),o&&o(null)))}destroy(){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null);for(const t in this.tileManagers){const n=this.tileManagers[t];n.setEventedParent(null),n.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(const t in this._layers){const n=this._layers[t];n.setEventedParent(null),n.onRemove&&n.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var Ss=d.aS([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ps{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,o,c,f,y,b,w,S){this.context=t;let P=this.boundPaintVertexBuffers.length!==c.length;for(let E=0;!P&&E<c.length;E++)this.boundPaintVertexBuffers[E]!==c[E]&&(P=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==o||P||this.boundIndexBuffer!==f||this.boundVertexOffset!==y||this.boundDynamicVertexBuffer!==b||this.boundDynamicVertexBuffer2!==w||this.boundDynamicVertexBuffer3!==S?this.freshBind(n,o,c,f,y,b,w,S):(t.bindVertexArray.set(this.vao),b&&b.bind(),f&&f.dynamicDraw&&f.bind(),w&&w.bind(),S&&S.bind())}freshBind(t,n,o,c,f,y,b,w){const S=t.numAttributes,P=this.context,E=P.gl;this.vao&&this.destroy(),this.vao=P.createVertexArray(),P.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=o,this.boundIndexBuffer=c,this.boundVertexOffset=f,this.boundDynamicVertexBuffer=y,this.boundDynamicVertexBuffer2=b,this.boundDynamicVertexBuffer3=w,n.enableAttributes(E,t);for(const C of o)C.enableAttributes(E,t);y&&y.enableAttributes(E,t),b&&b.enableAttributes(E,t),w&&w.enableAttributes(E,t),n.bind(),n.setVertexAttribPointers(E,t,f);for(const C of o)C.bind(),C.setVertexAttribPointers(E,t,f);y&&(y.bind(),y.setVertexAttribPointers(E,t,f)),c&&c.bind(),b&&(b.bind(),b.setVertexAttribPointers(E,t,f)),w&&(w.bind(),w.setVertexAttribPointers(E,t,f)),P.currentNumAttributes=S}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const Lu=(p,t,n,o,c)=>({u_texture:0,u_ele_delta:p,u_fog_matrix:t,u_fog_color:n?n.properties.get("fog-color"):d.bn.white,u_fog_ground_blend:n?n.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:c?0:n?n.calculateFogBlendOpacity(o):0,u_horizon_color:n?n.properties.get("horizon-color"):d.bn.white,u_horizon_fog_blend:n?n.properties.get("horizon-fog-blend"):1,u_is_globe_mode:c?1:0}),Sa={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function Pa(p){const t=[];for(let n=0;n<p.length;n++){if(p[n]===null)continue;const o=p[n].split(" ");t.push(o.pop())}return t}class Nn{constructor(t,n,o,c,f,y,b,w,S=[]){const P=t.gl;this.program=P.createProgram();const E=Pa(n.staticAttributes),C=o?o.getBinderAttributes():[],z=E.concat(C),F=Mt.prelude.staticUniforms?Pa(Mt.prelude.staticUniforms):[],V=b.staticUniforms?Pa(b.staticUniforms):[],j=n.staticUniforms?Pa(n.staticUniforms):[],N=o?o.getBinderUniforms():[],$=F.concat(V).concat(j).concat(N),W=[];for(const oe of $)W.indexOf(oe)<0&&W.push(oe);const G=o?o.defines():[];Hi(P)&&G.unshift("#version 300 es"),f&&G.push("#define OVERDRAW_INSPECTOR;"),y&&G.push("#define TERRAIN3D;"),w&&G.push(w),S&&G.push(...S);let q=G.concat(Mt.prelude.fragmentSource,b.fragmentSource,n.fragmentSource).join(`
805
- `),Y=G.concat(Mt.prelude.vertexSource,b.vertexSource,n.vertexSource).join(`
806
- `);Hi(P)||(q=(function(oe){return oe.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")})(q),Y=(function(oe){return oe.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")})(Y));const Z=P.createShader(P.FRAGMENT_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(Z,q),P.compileShader(Z),!P.getShaderParameter(Z,P.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${P.getShaderInfoLog(Z)}`);P.attachShader(this.program,Z);const Q=P.createShader(P.VERTEX_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(Q,Y),P.compileShader(Q),!P.getShaderParameter(Q,P.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${P.getShaderInfoLog(Q)}`);P.attachShader(this.program,Q),this.attributes={};const ae={};this.numAttributes=z.length;for(let oe=0;oe<this.numAttributes;oe++)z[oe]&&(P.bindAttribLocation(this.program,oe,z[oe]),this.attributes[z[oe]]=oe);if(P.linkProgram(this.program),!P.getProgramParameter(this.program,P.LINK_STATUS))throw new Error(`Program failed to link: ${P.getProgramInfoLog(this.program)}`);P.deleteShader(Q),P.deleteShader(Z);for(let oe=0;oe<W.length;oe++){const ie=W[oe];if(ie&&!ae[ie]){const ne=P.getUniformLocation(this.program,ie);ne&&(ae[ie]=ne)}}this.fixedUniforms=c(t,ae),this.terrainUniforms=((oe,ie)=>({u_depth:new d.bY(oe,ie.u_depth),u_terrain:new d.bY(oe,ie.u_terrain),u_terrain_dim:new d.bo(oe,ie.u_terrain_dim),u_terrain_matrix:new d.b_(oe,ie.u_terrain_matrix),u_terrain_unpack:new d.b$(oe,ie.u_terrain_unpack),u_terrain_exaggeration:new d.bo(oe,ie.u_terrain_exaggeration)}))(t,ae),this.projectionUniforms=((oe,ie)=>({u_projection_matrix:new d.b_(oe,ie.u_projection_matrix),u_projection_tile_mercator_coords:new d.b$(oe,ie.u_projection_tile_mercator_coords),u_projection_clipping_plane:new d.b$(oe,ie.u_projection_clipping_plane),u_projection_transition:new d.bo(oe,ie.u_projection_transition),u_projection_fallback_matrix:new d.b_(oe,ie.u_projection_fallback_matrix)}))(t,ae),this.binderUniforms=o?o.getUniforms(t,ae):[]}draw(t,n,o,c,f,y,b,w,S,P,E,C,z,F,V,j,N,$,W){const G=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(o),t.setStencilMode(c),t.setColorMode(f),t.setCullFace(y),w){t.activeTexture.set(G.TEXTURE2),G.bindTexture(G.TEXTURE_2D,w.depthTexture),t.activeTexture.set(G.TEXTURE3),G.bindTexture(G.TEXTURE_2D,w.texture);for(const Y in this.terrainUniforms)this.terrainUniforms[Y].set(w[Y])}if(S)for(const Y in S)this.projectionUniforms[Sa[Y]].set(S[Y]);if(b)for(const Y in this.fixedUniforms)this.fixedUniforms[Y].set(b[Y]);j&&j.setUniforms(t,this.binderUniforms,F,{zoom:V});let q=0;switch(n){case G.LINES:q=2;break;case G.TRIANGLES:q=3;break;case G.LINE_STRIP:q=1}for(const Y of z.get()){const Z=Y.vaos||(Y.vaos={});(Z[P]||(Z[P]=new Ps)).bind(t,this,E,j?j.getPaintVertexBuffers():[],C,Y.vertexOffset,N,$,W),G.drawElements(n,Y.primitiveLength*q,G.UNSIGNED_SHORT,Y.primitiveOffset*q*2)}}}function hc(p,t,n){const o=1/d.aK(n,1,t.transform.tileZoom),c=Math.pow(2,n.tileID.overscaledZ),f=n.tileSize*Math.pow(2,t.transform.tileZoom)/c,y=f*(n.tileID.canonical.x+n.tileID.wrap*c),b=f*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[o,p.fromScale,p.toScale],u_fade:p.t,u_pixel_coord_upper:[y>>16,b>>16],u_pixel_coord_lower:[65535&y,65535&b]}}const $o=(p,t,n,o)=>{const c=p.style.light,f=c.properties.get("position"),y=[f.x,f.y,f.z],b=d.c2();c.properties.get("anchor")==="viewport"&&d.c3(b,p.transform.bearingInRadians),d.c4(y,y,b);const w=p.transform.transformLightDirection(y),S=c.properties.get("color");return{u_lightpos:y,u_lightpos_globe:w,u_lightintensity:c.properties.get("intensity"),u_lightcolor:[S.r,S.g,S.b],u_vertical_gradient:+t,u_opacity:n,u_fill_translate:o}},Bu=(p,t,n,o,c,f,y)=>d.e($o(p,t,n,o),hc(f,p,y),{u_height_factor:-Math.pow(2,c.overscaledZ)/y.tileSize/8}),Zo=(p,t,n,o)=>d.e(hc(t,p,n),{u_fill_translate:o}),qo=(p,t)=>({u_world:p,u_fill_translate:t}),dc=(p,t,n,o,c)=>d.e(Zo(p,t,n,c),{u_world:o}),pc=(p,t,n,o,c)=>{const f=p.transform;let y,b,w=0;if(n.paint.get("circle-pitch-alignment")==="map"){const S=d.aK(t,1,f.zoom);y=!0,b=[S,S],w=S/(d.a5*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*c}else y=!1,b=f.pixelsToGLUnits;return{u_camera_to_center_distance:f.cameraToCenterDistance,u_scale_with_map:+(n.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+y,u_device_pixel_ratio:p.pixelRatio,u_extrude_scale:b,u_globe_extrude_scale:w,u_translate:o}},fc=p=>({u_pixel_extrude_scale:[1/p.width,1/p.height]}),mc=p=>({u_viewport_size:[p.width,p.height]}),Rr=(p,t=1)=>({u_color:p,u_overlay:0,u_overlay_scale:t}),Wo=(p,t,n,o)=>{const c=d.aK(p,1,t)/(d.a5*Math.pow(2,p.tileID.overscaledZ))*2*Math.PI*o;return{u_extrude_scale:d.aK(p,1,t),u_intensity:n,u_globe_extrude_scale:c}},Xo=(p,t,n,o)=>{const c=d.N();d.c5(c,0,p.width,p.height,0,0,1);const f=p.context.gl;return{u_matrix:c,u_world:[f.drawingBufferWidth,f.drawingBufferHeight],u_image:n,u_color_ramp:o,u_opacity:t.paint.get("heatmap-opacity")}},Is=(p,t,n)=>{const o=n.paint.get("hillshade-accent-color");let c;switch(n.paint.get("hillshade-method")){case"basic":c=4;break;case"combined":c=1;break;case"igor":c=2;break;case"multidirectional":c=3;break;default:c=0}const f=n.getIlluminationProperties();for(let y=0;y<f.directionRadians.length;y++)n.paint.get("hillshade-illumination-anchor")==="viewport"&&(f.directionRadians[y]+=p.transform.bearingInRadians);return{u_image:0,u_latrange:Ia(0,t.tileID),u_exaggeration:n.paint.get("hillshade-exaggeration"),u_altitudes:f.altitudeRadians,u_azimuths:f.directionRadians,u_accent:o,u_method:c,u_highlights:f.highlightColor,u_shadows:f.shadowColor}},Ou=(p,t)=>{const n=t.stride,o=d.N();return d.c5(o,0,d.a5,-d.a5,0,0,1),d.O(o,o,[0,-d.a5,0]),{u_matrix:o,u_image:1,u_dimension:[n,n],u_zoom:p.overscaledZ,u_unpack:t.getUnpackVector()}};function Ia(p,t){const n=Math.pow(2,t.canonical.z),o=t.canonical.y;return[new d.a6(0,o/n).toLngLat().lat,new d.a6(0,(o+1)/n).toLngLat().lat]}const Vu=(p,t,n=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:n,u_opacity:p.paint.get("color-relief-opacity")}),Ma=(p,t,n,o)=>{const c=p.transform;return{u_translation:Ms(p,t,n),u_ratio:o/d.aK(t,1,c.zoom),u_device_pixel_ratio:p.pixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},gc=(p,t,n,o,c)=>d.e(Ma(p,t,n,o),{u_image:0,u_image_height:c}),_c=(p,t,n,o,c)=>{const f=p.transform,y=Ea(t,f);return{u_translation:Ms(p,t,n),u_texsize:t.imageAtlasTexture.size,u_ratio:o/d.aK(t,1,f.zoom),u_device_pixel_ratio:p.pixelRatio,u_image:0,u_scale:[y,c.fromScale,c.toScale],u_fade:c.t,u_units_to_pixels:[1/f.pixelsToGLUnits[0],1/f.pixelsToGLUnits[1]]}},yc=(p,t,n,o,c)=>{const f=Ea(t,p.transform);return d.e(Ma(p,t,n,o),{u_tileratio:f,u_crossfade_from:c.fromScale,u_crossfade_to:c.toScale,u_image:0,u_mix:c.t,u_lineatlas_width:p.lineAtlas.width,u_lineatlas_height:p.lineAtlas.height})},Ho=(p,t,n,o,c,f)=>{const y=Ea(t,p.transform);return d.e(Ma(p,t,n,o),{u_image:0,u_image_height:f,u_tileratio:y,u_crossfade_from:c.fromScale,u_crossfade_to:c.toScale,u_image_dash:1,u_mix:c.t,u_lineatlas_width:p.lineAtlas.width,u_lineatlas_height:p.lineAtlas.height})};function Ea(p,t){return 1/d.aK(p,1,t.tileZoom)}function Ms(p,t,n){return d.aL(p.transform,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const ur=(p,t,n,o,c)=>{return{u_tl_parent:p,u_scale_parent:t,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*o.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:o.paint.get("raster-brightness-min"),u_brightness_high:o.paint.get("raster-brightness-max"),u_saturation_factor:(y=o.paint.get("raster-saturation"),y>0?1-1/(1.001-y):-y),u_contrast_factor:(f=o.paint.get("raster-contrast"),f>0?1/(1-f):1+f),u_spin_weights:Yo(o.paint.get("raster-hue-rotate")),u_coords_top:[c[0].x,c[0].y,c[1].x,c[1].y],u_coords_bottom:[c[3].x,c[3].y,c[2].x,c[2].y]};var f,y};function Yo(p){p*=Math.PI/180;const t=Math.sin(p),n=Math.cos(p);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const Ca=(p,t,n,o,c,f,y,b,w,S,P,E,C)=>{const z=y.transform;return{u_is_size_zoom_constant:+(p==="constant"||p==="source"),u_is_size_feature_constant:+(p==="constant"||p==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:z.cameraToCenterDistance,u_pitch:z.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:z.width/z.height,u_fade_change:y.options.fadeDuration?y.symbolFadeChange:1,u_label_plane_matrix:b,u_coord_matrix:w,u_is_text:+P,u_pitch_with_map:+o,u_is_along_line:c,u_is_variable_anchor:f,u_texsize:E,u_texture:0,u_translation:S,u_pitched_scale:C}},Aa=(p,t,n,o,c,f,y,b,w,S,P,E,C,z)=>{const F=y.transform;return d.e(Ca(p,t,n,o,c,f,y,b,w,S,P,E,z),{u_gamma_scale:o?Math.cos(F.pitch*Math.PI/180)*F.cameraToCenterDistance:1,u_device_pixel_ratio:y.pixelRatio,u_is_halo:1})},xc=(p,t,n,o,c,f,y,b,w,S,P,E,C)=>d.e(Aa(p,t,n,o,c,f,y,b,w,S,!0,P,0,C),{u_texsize_icon:E,u_texture_icon:1}),Ko=(p,t)=>({u_opacity:p,u_color:t}),ln=(p,t,n,o,c)=>d.e((function(f,y,b,w){const S=b.imageManager.getPattern(f.from.toString()),P=b.imageManager.getPattern(f.to.toString()),{width:E,height:C}=b.imageManager.getPixelSize(),z=Math.pow(2,w.tileID.overscaledZ),F=w.tileSize*Math.pow(2,b.transform.tileZoom)/z,V=F*(w.tileID.canonical.x+w.tileID.wrap*z),j=F*w.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:S.tl,u_pattern_br_a:S.br,u_pattern_tl_b:P.tl,u_pattern_br_b:P.br,u_texsize:[E,C],u_mix:y.t,u_pattern_size_a:S.displaySize,u_pattern_size_b:P.displaySize,u_scale_a:y.fromScale,u_scale_b:y.toScale,u_tile_units_to_pixels:1/d.aK(w,1,b.transform.tileZoom),u_pixel_coord_upper:[V>>16,j>>16],u_pixel_coord_lower:[65535&V,65535&j]}})(n,c,t,o),{u_opacity:p}),Da=(p,t)=>{},ju={fillExtrusion:(p,t)=>({u_lightpos:new d.c0(p,t.u_lightpos),u_lightpos_globe:new d.c0(p,t.u_lightpos_globe),u_lightintensity:new d.bo(p,t.u_lightintensity),u_lightcolor:new d.c0(p,t.u_lightcolor),u_vertical_gradient:new d.bo(p,t.u_vertical_gradient),u_opacity:new d.bo(p,t.u_opacity),u_fill_translate:new d.c1(p,t.u_fill_translate)}),fillExtrusionPattern:(p,t)=>({u_lightpos:new d.c0(p,t.u_lightpos),u_lightpos_globe:new d.c0(p,t.u_lightpos_globe),u_lightintensity:new d.bo(p,t.u_lightintensity),u_lightcolor:new d.c0(p,t.u_lightcolor),u_vertical_gradient:new d.bo(p,t.u_vertical_gradient),u_height_factor:new d.bo(p,t.u_height_factor),u_opacity:new d.bo(p,t.u_opacity),u_fill_translate:new d.c1(p,t.u_fill_translate),u_image:new d.bY(p,t.u_image),u_texsize:new d.c1(p,t.u_texsize),u_pixel_coord_upper:new d.c1(p,t.u_pixel_coord_upper),u_pixel_coord_lower:new d.c1(p,t.u_pixel_coord_lower),u_scale:new d.c0(p,t.u_scale),u_fade:new d.bo(p,t.u_fade)}),fill:(p,t)=>({u_fill_translate:new d.c1(p,t.u_fill_translate)}),fillPattern:(p,t)=>({u_image:new d.bY(p,t.u_image),u_texsize:new d.c1(p,t.u_texsize),u_pixel_coord_upper:new d.c1(p,t.u_pixel_coord_upper),u_pixel_coord_lower:new d.c1(p,t.u_pixel_coord_lower),u_scale:new d.c0(p,t.u_scale),u_fade:new d.bo(p,t.u_fade),u_fill_translate:new d.c1(p,t.u_fill_translate)}),fillOutline:(p,t)=>({u_world:new d.c1(p,t.u_world),u_fill_translate:new d.c1(p,t.u_fill_translate)}),fillOutlinePattern:(p,t)=>({u_world:new d.c1(p,t.u_world),u_image:new d.bY(p,t.u_image),u_texsize:new d.c1(p,t.u_texsize),u_pixel_coord_upper:new d.c1(p,t.u_pixel_coord_upper),u_pixel_coord_lower:new d.c1(p,t.u_pixel_coord_lower),u_scale:new d.c0(p,t.u_scale),u_fade:new d.bo(p,t.u_fade),u_fill_translate:new d.c1(p,t.u_fill_translate)}),circle:(p,t)=>({u_camera_to_center_distance:new d.bo(p,t.u_camera_to_center_distance),u_scale_with_map:new d.bY(p,t.u_scale_with_map),u_pitch_with_map:new d.bY(p,t.u_pitch_with_map),u_extrude_scale:new d.c1(p,t.u_extrude_scale),u_device_pixel_ratio:new d.bo(p,t.u_device_pixel_ratio),u_globe_extrude_scale:new d.bo(p,t.u_globe_extrude_scale),u_translate:new d.c1(p,t.u_translate)}),collisionBox:(p,t)=>({u_pixel_extrude_scale:new d.c1(p,t.u_pixel_extrude_scale)}),collisionCircle:(p,t)=>({u_viewport_size:new d.c1(p,t.u_viewport_size)}),debug:(p,t)=>({u_color:new d.bZ(p,t.u_color),u_overlay:new d.bY(p,t.u_overlay),u_overlay_scale:new d.bo(p,t.u_overlay_scale)}),depth:Da,clippingMask:Da,heatmap:(p,t)=>({u_extrude_scale:new d.bo(p,t.u_extrude_scale),u_intensity:new d.bo(p,t.u_intensity),u_globe_extrude_scale:new d.bo(p,t.u_globe_extrude_scale)}),heatmapTexture:(p,t)=>({u_matrix:new d.b_(p,t.u_matrix),u_world:new d.c1(p,t.u_world),u_image:new d.bY(p,t.u_image),u_color_ramp:new d.bY(p,t.u_color_ramp),u_opacity:new d.bo(p,t.u_opacity)}),hillshade:(p,t)=>({u_image:new d.bY(p,t.u_image),u_latrange:new d.c1(p,t.u_latrange),u_exaggeration:new d.bo(p,t.u_exaggeration),u_altitudes:new d.c7(p,t.u_altitudes),u_azimuths:new d.c7(p,t.u_azimuths),u_accent:new d.bZ(p,t.u_accent),u_method:new d.bY(p,t.u_method),u_shadows:new d.c6(p,t.u_shadows),u_highlights:new d.c6(p,t.u_highlights)}),hillshadePrepare:(p,t)=>({u_matrix:new d.b_(p,t.u_matrix),u_image:new d.bY(p,t.u_image),u_dimension:new d.c1(p,t.u_dimension),u_zoom:new d.bo(p,t.u_zoom),u_unpack:new d.b$(p,t.u_unpack)}),colorRelief:(p,t)=>({u_image:new d.bY(p,t.u_image),u_unpack:new d.b$(p,t.u_unpack),u_dimension:new d.c1(p,t.u_dimension),u_elevation_stops:new d.bY(p,t.u_elevation_stops),u_color_stops:new d.bY(p,t.u_color_stops),u_color_ramp_size:new d.bY(p,t.u_color_ramp_size),u_opacity:new d.bo(p,t.u_opacity)}),line:(p,t)=>({u_translation:new d.c1(p,t.u_translation),u_ratio:new d.bo(p,t.u_ratio),u_device_pixel_ratio:new d.bo(p,t.u_device_pixel_ratio),u_units_to_pixels:new d.c1(p,t.u_units_to_pixels)}),lineGradient:(p,t)=>({u_translation:new d.c1(p,t.u_translation),u_ratio:new d.bo(p,t.u_ratio),u_device_pixel_ratio:new d.bo(p,t.u_device_pixel_ratio),u_units_to_pixels:new d.c1(p,t.u_units_to_pixels),u_image:new d.bY(p,t.u_image),u_image_height:new d.bo(p,t.u_image_height)}),linePattern:(p,t)=>({u_translation:new d.c1(p,t.u_translation),u_texsize:new d.c1(p,t.u_texsize),u_ratio:new d.bo(p,t.u_ratio),u_device_pixel_ratio:new d.bo(p,t.u_device_pixel_ratio),u_image:new d.bY(p,t.u_image),u_units_to_pixels:new d.c1(p,t.u_units_to_pixels),u_scale:new d.c0(p,t.u_scale),u_fade:new d.bo(p,t.u_fade)}),lineSDF:(p,t)=>({u_translation:new d.c1(p,t.u_translation),u_ratio:new d.bo(p,t.u_ratio),u_device_pixel_ratio:new d.bo(p,t.u_device_pixel_ratio),u_units_to_pixels:new d.c1(p,t.u_units_to_pixels),u_image:new d.bY(p,t.u_image),u_mix:new d.bo(p,t.u_mix),u_tileratio:new d.bo(p,t.u_tileratio),u_crossfade_from:new d.bo(p,t.u_crossfade_from),u_crossfade_to:new d.bo(p,t.u_crossfade_to),u_lineatlas_width:new d.bo(p,t.u_lineatlas_width),u_lineatlas_height:new d.bo(p,t.u_lineatlas_height)}),lineGradientSDF:(p,t)=>({u_translation:new d.c1(p,t.u_translation),u_ratio:new d.bo(p,t.u_ratio),u_device_pixel_ratio:new d.bo(p,t.u_device_pixel_ratio),u_units_to_pixels:new d.c1(p,t.u_units_to_pixels),u_image:new d.bY(p,t.u_image),u_image_height:new d.bo(p,t.u_image_height),u_tileratio:new d.bo(p,t.u_tileratio),u_crossfade_from:new d.bo(p,t.u_crossfade_from),u_crossfade_to:new d.bo(p,t.u_crossfade_to),u_image_dash:new d.bY(p,t.u_image_dash),u_mix:new d.bo(p,t.u_mix),u_lineatlas_width:new d.bo(p,t.u_lineatlas_width),u_lineatlas_height:new d.bo(p,t.u_lineatlas_height)}),raster:(p,t)=>({u_tl_parent:new d.c1(p,t.u_tl_parent),u_scale_parent:new d.bo(p,t.u_scale_parent),u_buffer_scale:new d.bo(p,t.u_buffer_scale),u_fade_t:new d.bo(p,t.u_fade_t),u_opacity:new d.bo(p,t.u_opacity),u_image0:new d.bY(p,t.u_image0),u_image1:new d.bY(p,t.u_image1),u_brightness_low:new d.bo(p,t.u_brightness_low),u_brightness_high:new d.bo(p,t.u_brightness_high),u_saturation_factor:new d.bo(p,t.u_saturation_factor),u_contrast_factor:new d.bo(p,t.u_contrast_factor),u_spin_weights:new d.c0(p,t.u_spin_weights),u_coords_top:new d.b$(p,t.u_coords_top),u_coords_bottom:new d.b$(p,t.u_coords_bottom)}),symbolIcon:(p,t)=>({u_is_size_zoom_constant:new d.bY(p,t.u_is_size_zoom_constant),u_is_size_feature_constant:new d.bY(p,t.u_is_size_feature_constant),u_size_t:new d.bo(p,t.u_size_t),u_size:new d.bo(p,t.u_size),u_camera_to_center_distance:new d.bo(p,t.u_camera_to_center_distance),u_pitch:new d.bo(p,t.u_pitch),u_rotate_symbol:new d.bY(p,t.u_rotate_symbol),u_aspect_ratio:new d.bo(p,t.u_aspect_ratio),u_fade_change:new d.bo(p,t.u_fade_change),u_label_plane_matrix:new d.b_(p,t.u_label_plane_matrix),u_coord_matrix:new d.b_(p,t.u_coord_matrix),u_is_text:new d.bY(p,t.u_is_text),u_pitch_with_map:new d.bY(p,t.u_pitch_with_map),u_is_along_line:new d.bY(p,t.u_is_along_line),u_is_variable_anchor:new d.bY(p,t.u_is_variable_anchor),u_texsize:new d.c1(p,t.u_texsize),u_texture:new d.bY(p,t.u_texture),u_translation:new d.c1(p,t.u_translation),u_pitched_scale:new d.bo(p,t.u_pitched_scale)}),symbolSDF:(p,t)=>({u_is_size_zoom_constant:new d.bY(p,t.u_is_size_zoom_constant),u_is_size_feature_constant:new d.bY(p,t.u_is_size_feature_constant),u_size_t:new d.bo(p,t.u_size_t),u_size:new d.bo(p,t.u_size),u_camera_to_center_distance:new d.bo(p,t.u_camera_to_center_distance),u_pitch:new d.bo(p,t.u_pitch),u_rotate_symbol:new d.bY(p,t.u_rotate_symbol),u_aspect_ratio:new d.bo(p,t.u_aspect_ratio),u_fade_change:new d.bo(p,t.u_fade_change),u_label_plane_matrix:new d.b_(p,t.u_label_plane_matrix),u_coord_matrix:new d.b_(p,t.u_coord_matrix),u_is_text:new d.bY(p,t.u_is_text),u_pitch_with_map:new d.bY(p,t.u_pitch_with_map),u_is_along_line:new d.bY(p,t.u_is_along_line),u_is_variable_anchor:new d.bY(p,t.u_is_variable_anchor),u_texsize:new d.c1(p,t.u_texsize),u_texture:new d.bY(p,t.u_texture),u_gamma_scale:new d.bo(p,t.u_gamma_scale),u_device_pixel_ratio:new d.bo(p,t.u_device_pixel_ratio),u_is_halo:new d.bY(p,t.u_is_halo),u_translation:new d.c1(p,t.u_translation),u_pitched_scale:new d.bo(p,t.u_pitched_scale)}),symbolTextAndIcon:(p,t)=>({u_is_size_zoom_constant:new d.bY(p,t.u_is_size_zoom_constant),u_is_size_feature_constant:new d.bY(p,t.u_is_size_feature_constant),u_size_t:new d.bo(p,t.u_size_t),u_size:new d.bo(p,t.u_size),u_camera_to_center_distance:new d.bo(p,t.u_camera_to_center_distance),u_pitch:new d.bo(p,t.u_pitch),u_rotate_symbol:new d.bY(p,t.u_rotate_symbol),u_aspect_ratio:new d.bo(p,t.u_aspect_ratio),u_fade_change:new d.bo(p,t.u_fade_change),u_label_plane_matrix:new d.b_(p,t.u_label_plane_matrix),u_coord_matrix:new d.b_(p,t.u_coord_matrix),u_is_text:new d.bY(p,t.u_is_text),u_pitch_with_map:new d.bY(p,t.u_pitch_with_map),u_is_along_line:new d.bY(p,t.u_is_along_line),u_is_variable_anchor:new d.bY(p,t.u_is_variable_anchor),u_texsize:new d.c1(p,t.u_texsize),u_texsize_icon:new d.c1(p,t.u_texsize_icon),u_texture:new d.bY(p,t.u_texture),u_texture_icon:new d.bY(p,t.u_texture_icon),u_gamma_scale:new d.bo(p,t.u_gamma_scale),u_device_pixel_ratio:new d.bo(p,t.u_device_pixel_ratio),u_is_halo:new d.bY(p,t.u_is_halo),u_translation:new d.c1(p,t.u_translation),u_pitched_scale:new d.bo(p,t.u_pitched_scale)}),background:(p,t)=>({u_opacity:new d.bo(p,t.u_opacity),u_color:new d.bZ(p,t.u_color)}),backgroundPattern:(p,t)=>({u_opacity:new d.bo(p,t.u_opacity),u_image:new d.bY(p,t.u_image),u_pattern_tl_a:new d.c1(p,t.u_pattern_tl_a),u_pattern_br_a:new d.c1(p,t.u_pattern_br_a),u_pattern_tl_b:new d.c1(p,t.u_pattern_tl_b),u_pattern_br_b:new d.c1(p,t.u_pattern_br_b),u_texsize:new d.c1(p,t.u_texsize),u_mix:new d.bo(p,t.u_mix),u_pattern_size_a:new d.c1(p,t.u_pattern_size_a),u_pattern_size_b:new d.c1(p,t.u_pattern_size_b),u_scale_a:new d.bo(p,t.u_scale_a),u_scale_b:new d.bo(p,t.u_scale_b),u_pixel_coord_upper:new d.c1(p,t.u_pixel_coord_upper),u_pixel_coord_lower:new d.c1(p,t.u_pixel_coord_lower),u_tile_units_to_pixels:new d.bo(p,t.u_tile_units_to_pixels)}),terrain:(p,t)=>({u_texture:new d.bY(p,t.u_texture),u_ele_delta:new d.bo(p,t.u_ele_delta),u_fog_matrix:new d.b_(p,t.u_fog_matrix),u_fog_color:new d.bZ(p,t.u_fog_color),u_fog_ground_blend:new d.bo(p,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new d.bo(p,t.u_fog_ground_blend_opacity),u_horizon_color:new d.bZ(p,t.u_horizon_color),u_horizon_fog_blend:new d.bo(p,t.u_horizon_fog_blend),u_is_globe_mode:new d.bo(p,t.u_is_globe_mode)}),terrainDepth:(p,t)=>({u_ele_delta:new d.bo(p,t.u_ele_delta)}),terrainCoords:(p,t)=>({u_texture:new d.bY(p,t.u_texture),u_terrain_coords_id:new d.bo(p,t.u_terrain_coords_id),u_ele_delta:new d.bo(p,t.u_ele_delta)}),projectionErrorMeasurement:(p,t)=>({u_input:new d.bo(p,t.u_input),u_output_expected:new d.bo(p,t.u_output_expected)}),atmosphere:(p,t)=>({u_sun_pos:new d.c0(p,t.u_sun_pos),u_atmosphere_blend:new d.bo(p,t.u_atmosphere_blend),u_globe_position:new d.c0(p,t.u_globe_position),u_globe_radius:new d.bo(p,t.u_globe_radius),u_inv_proj_matrix:new d.b_(p,t.u_inv_proj_matrix)}),sky:(p,t)=>({u_sky_color:new d.bZ(p,t.u_sky_color),u_horizon_color:new d.bZ(p,t.u_horizon_color),u_horizon:new d.c1(p,t.u_horizon),u_horizon_normal:new d.c1(p,t.u_horizon_normal),u_sky_horizon_blend:new d.bo(p,t.u_sky_horizon_blend),u_sky_blend:new d.bo(p,t.u_sky_blend)})};class Nu{constructor(t,n,o){this.context=t;const c=t.gl;this.buffer=c.createBuffer(),this.dynamicDraw=!!o,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?c.DYNAMIC_DRAW:c.STATIC_DRAW),this.dynamicDraw||n.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Uu={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Gu{constructor(t,n,o,c){this.length=n.length,this.attributes=o,this.itemSize=n.bytesPerElement,this.dynamicDraw=c,this.context=t;const f=t.gl;this.buffer=f.createBuffer(),t.bindVertexBuffer.set(this.buffer),f.bufferData(f.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?f.DYNAMIC_DRAW:f.STATIC_DRAW),this.dynamicDraw||n.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let o=0;o<this.attributes.length;o++){const c=n.attributes[this.attributes[o].name];c!==void 0&&t.enableVertexAttribArray(c)}}setVertexAttribPointers(t,n,o){for(let c=0;c<this.attributes.length;c++){const f=this.attributes[c],y=n.attributes[f.name];y!==void 0&&t.vertexAttribPointer(y,f.components,t[Uu[f.type]],!1,this.itemSize,f.offset+this.itemSize*(o||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Je{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class $u extends Je{getDefault(){return d.bn.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class vc extends Je{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class za extends Je{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class ka extends Je{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Ra extends Je{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Jo extends Je{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class cn extends Je{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Es extends Je{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Un extends Je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class ji extends Je{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class bc extends Je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class wc extends Je{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Qo extends Je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class un extends Je{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class Fa extends Je{getDefault(){return d.bn.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class La extends Je{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Cs extends Je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class Ba extends Je{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Tc extends Je{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Gn extends Je{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class $n extends Je{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Sc extends Je{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class el extends Je{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Ve extends Je{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Oa extends Je{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Zu extends Je{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Pc extends Je{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class As extends Je{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const o=this.gl;Hi(o)?o.bindVertexArray(t):(n=o.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class qu extends Je{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Wu extends Je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Ic extends Je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class tl extends Je{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class il extends tl{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Va extends tl{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Ds extends tl{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}const zs="Framebuffer is not complete";class rl{constructor(t,n,o,c,f){this.context=t,this.width=n,this.height=o;const y=t.gl,b=this.framebuffer=y.createFramebuffer();if(this.colorAttachment=new il(t,b),c)this.depthAttachment=f?new Ds(t,b):new Va(t,b);else if(f)throw new Error("Stencil cannot be set without depth");if(y.checkFramebufferStatus(y.FRAMEBUFFER)!==y.FRAMEBUFFER_COMPLETE)throw new Error(zs)}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const o=this.depthAttachment.get();o&&t.deleteRenderbuffer(o)}t.deleteFramebuffer(this.framebuffer)}}class Mc{constructor(t){var n,o;if(this.gl=t,this.clearColor=new $u(this),this.clearDepth=new vc(this),this.clearStencil=new za(this),this.colorMask=new ka(this),this.depthMask=new Ra(this),this.stencilMask=new Jo(this),this.stencilFunc=new cn(this),this.stencilOp=new Es(this),this.stencilTest=new Un(this),this.depthRange=new ji(this),this.depthTest=new bc(this),this.depthFunc=new wc(this),this.blend=new Qo(this),this.blendFunc=new un(this),this.blendColor=new Fa(this),this.blendEquation=new La(this),this.cullFace=new Cs(this),this.cullFaceSide=new Ba(this),this.frontFace=new Tc(this),this.program=new Gn(this),this.activeTexture=new $n(this),this.viewport=new Sc(this),this.bindFramebuffer=new el(this),this.bindRenderbuffer=new Ve(this),this.bindTexture=new Oa(this),this.bindVertexBuffer=new Zu(this),this.bindElementBuffer=new Pc(this),this.bindVertexArray=new As(this),this.pixelStoreUnpack=new qu(this),this.pixelStoreUnpackPremultiplyAlpha=new Wu(this),this.pixelStoreUnpackFlipY=new Ic(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),Hi(t)){this.HALF_FLOAT=t.HALF_FLOAT;const c=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=t.RGBA16F)!==null&&n!==void 0?n:c?.RGBA16F_EXT,this.RGB16F=(o=t.RGB16F)!==null&&o!==void 0?o:c?.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const c=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=c?.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n){return new Nu(this,t,n)}createVertexBuffer(t,n,o){return new Gu(this,t,n,o)}createRenderbuffer(t,n,o){const c=this.gl,f=c.createRenderbuffer();return this.bindRenderbuffer.set(f),c.renderbufferStorage(c.RENDERBUFFER,t,n,o),this.bindRenderbuffer.set(null),f}createFramebuffer(t,n,o,c){return new rl(this,t,n,o,c)}clear({color:t,depth:n,stencil:o}){const c=this.gl;let f=0;t&&(f|=c.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(f|=c.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),o!==void 0&&(f|=c.STENCIL_BUFFER_BIT,this.clearStencil.set(o),this.stencilMask.set(255)),c.clear(f)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){d.bP(t.blendFunction,ut.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return Hi(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var n;return Hi(this.gl)?this.gl.deleteVertexArray(t):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0?void 0:n.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}let hn;function ks(p,t,n,o,c){const f=p.context,y=p.transform,b=f.gl,w=p.useProgram("collisionBox"),S=[];let P=0,E=0;for(let N=0;N<o.length;N++){const $=o[N],W=t.getTile($).getBucket(n);if(!W)continue;const G=c?W.textCollisionBox:W.iconCollisionBox,q=W.collisionCircleArray;q.length>0&&(S.push({circleArray:q,circleOffset:E,coord:$}),P+=q.length/4,E=P),G&&w.draw(f,b.LINES,Fe.disabled,qe.disabled,p.colorModeForRenderPass(),Ue.disabled,fc(p.transform),p.style.map.terrain&&p.style.map.terrain.getTerrainData($),y.getProjectionData({overscaledTileID:$,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),n.id,G.layoutVertexBuffer,G.indexBuffer,G.segments,null,p.transform.zoom,null,null,G.collisionVertexBuffer)}if(!c||!S.length)return;const C=p.useProgram("collisionCircle"),z=new d.c8;z.resize(4*P),z._trim();let F=0;for(const N of S)for(let $=0;$<N.circleArray.length/4;$++){const W=4*$,G=N.circleArray[W+0],q=N.circleArray[W+1],Y=N.circleArray[W+2],Z=N.circleArray[W+3];z.emplace(F++,G,q,Y,Z,0),z.emplace(F++,G,q,Y,Z,1),z.emplace(F++,G,q,Y,Z,2),z.emplace(F++,G,q,Y,Z,3)}(!hn||hn.length<2*P)&&(hn=(function(N){const $=2*N,W=new d.ca;W.resize($),W._trim();for(let G=0;G<$;G++){const q=6*G;W.uint16[q+0]=4*G+0,W.uint16[q+1]=4*G+1,W.uint16[q+2]=4*G+2,W.uint16[q+3]=4*G+2,W.uint16[q+4]=4*G+3,W.uint16[q+5]=4*G+0}return W})(P));const V=f.createIndexBuffer(hn,!0),j=f.createVertexBuffer(z,d.c9.members,!0);for(const N of S){const $=mc(p.transform);C.draw(f,b.TRIANGLES,Fe.disabled,qe.disabled,p.colorModeForRenderPass(),Ue.disabled,$,p.style.map.terrain&&p.style.map.terrain.getTerrainData(N.coord),null,n.id,j,V,d.aV.simpleSegment(0,2*N.circleOffset,N.circleArray.length,N.circleArray.length/2),null,p.transform.zoom,null,null,null)}j.destroy(),V.destroy()}const Rs=d.ao(new Float32Array(16));function Zn(p,t,n,o,c,f){const{horizontalAlign:y,verticalAlign:b}=d.aP(p);return new d.P((-(y-.5)*t/c+o[0])*f,(-(b-.5)*n/c+o[1])*f)}function nl(p,t,n,o,c,f){const y=t.tileAnchorPoint.add(new d.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let b=o.mult(f);n||(b=b.rotate(-c));const w=y.add(b);return An(w.x,w.y,t.pitchedLabelPlaneMatrix,t.getElevation).point}if(n){const b=ir(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(p),w=Math.atan(b.y/b.x)+(b.x<0?Math.PI:0);return p.add(o.rotate(w))}return p.add(o)}function Xu(p,t,n,o,c,f,y,b,w,S,P,E){const C=p.text.placedSymbolArray,z=p.text.dynamicLayoutVertexArray,F=p.icon.dynamicLayoutVertexArray,V={};z.clear();for(let j=0;j<C.length;j++){const N=C.get(j),$=N.hidden||!N.crossTileID||p.allowVerticalPlacement&&!N.placedOrientation?null:o[N.crossTileID];if($){const W=new d.P(N.anchorX,N.anchorY),G={getElevation:E,width:c.width,height:c.height,pitchedLabelPlaneMatrix:f,pitchWithMap:n,transform:c,tileAnchorPoint:W,translation:S,unwrappedTileID:P},q=n?pt(W.x,W.y,G):ir(W.x,W.y,G),Y=Dr(c.cameraToCenterDistance,q.signedDistanceFromCamera);let Z=d.ax(p.textSizeData,b,N)*Y/d.aJ;n&&(Z*=p.tilePixelRatio/y);const{width:Q,height:ae,anchor:oe,textOffset:ie,textBoxScale:ne}=$,pe=Zn(oe,Q,ae,ie,ne,Z),fe=c.getPitchedTextCorrection(W.x+S[0],W.y+S[1],P),de=nl(q.point,G,t,pe,-c.bearingInRadians,fe),Pe=p.allowVerticalPlacement&&N.placedOrientation===d.aw.vertical?Math.PI/2:0;for(let Me=0;Me<N.numGlyphs;Me++)d.aD(z,de,Pe);w&&N.associatedIconIndex>=0&&(V[N.associatedIconIndex]={shiftedAnchor:de,angle:Pe})}else Ii(N.numGlyphs,z)}if(w){F.clear();const j=p.icon.placedSymbolArray;for(let N=0;N<j.length;N++){const $=j.get(N);if($.hidden)Ii($.numGlyphs,F);else{const W=V[N];if(W)for(let G=0;G<$.numGlyphs;G++)d.aD(F,W.shiftedAnchor,W.angle);else Ii($.numGlyphs,F)}}p.icon.dynamicLayoutVertexBuffer.updateData(F)}p.text.dynamicLayoutVertexBuffer.updateData(z)}function Fs(p,t,n){return n.iconsInText&&t?"symbolTextAndIcon":p?"symbolSDF":"symbolIcon"}function Ec(p,t,n,o,c,f,y,b,w,S,P,E,C){const z=p.context,F=z.gl,V=p.transform,j=b==="map",N=w==="map",$=b!=="viewport"&&n.layout.get("symbol-placement")!=="point",W=j&&!N&&!$,G=!n.layout.get("symbol-sort-key").isConstant();let q=!1;const Y=p.getDepthModeForSublayer(0,Fe.ReadOnly),Z=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Q=[],ae=V.getCircleRadiusCorrection();for(const oe of o){const ie=t.getTile(oe),ne=ie.getBucket(n);if(!ne)continue;const pe=c?ne.text:ne.icon;if(!pe||!pe.segments.get().length||!pe.hasVisibleVertices)continue;const fe=pe.programConfigurations.get(n.id),de=c||ne.sdfIcons,Pe=c?ne.textSizeData:ne.iconSizeData,Me=N||V.pitch!==0,et=p.useProgram(Fs(de,c,ne),fe),ht=d.av(Pe,V.zoom),ct=p.style.map.terrain&&p.style.map.terrain.getTerrainData(oe);let ft,ot,Rt,lt,Zt=[0,0],At=null;if(c)ot=ie.glyphAtlasTexture,Rt=F.LINEAR,ft=ie.glyphAtlasTexture.size,ne.iconsInText&&(Zt=ie.imageAtlasTexture.size,At=ie.imageAtlasTexture,lt=Me||p.options.rotating||p.options.zooming||Pe.kind==="composite"||Pe.kind==="camera"?F.LINEAR:F.NEAREST);else{const mt=n.layout.get("icon-size").constantOr(0)!==1||ne.iconsNeedLinear;ot=ie.imageAtlasTexture,Rt=de||p.options.rotating||p.options.zooming||mt||Me?F.LINEAR:F.NEAREST,ft=ie.imageAtlasTexture.size}const Ft=d.aK(ie,1,p.transform.zoom),si=ke(j,p.transform,Ft),sr=d.N();d.ay(sr,si);const Vr=Oe(N,j,p.transform,Ft),pr=d.aL(V,ie,f,y),fr=V.getProjectionData({overscaledTileID:oe,applyGlobeMatrix:!C,applyTerrainMatrix:!0}),Gi=Z&&ne.hasTextData(),mn=n.layout.get("icon-text-fit")!=="none"&&Gi&&ne.hasIconData();if($){const mt=p.style.map.terrain?(Dt,gt)=>p.style.map.terrain.getElevation(oe,Dt,gt):null,dt=n.layout.get("text-rotation-alignment")==="map";ga(ne,p,c,si,sr,N,S,dt,oe.toUnwrapped(),V.width,V.height,pr,mt)}const gn=c&&Z||mn,Ai=$||gn?Rs:N?si:p.transform.clipSpaceToPixelsMatrix,jr=de&&n.paint.get(c?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let mr;mr=de?ne.iconsInText?xc(Pe.kind,ht,W,N,$,gn,p,Ai,Vr,pr,ft,Zt,ae):Aa(Pe.kind,ht,W,N,$,gn,p,Ai,Vr,pr,c,ft,0,ae):Ca(Pe.kind,ht,W,N,$,gn,p,Ai,Vr,pr,c,ft,ae);const gr={program:et,buffers:pe,uniformValues:mr,projectionData:fr,atlasTexture:ot,atlasTextureIcon:At,atlasInterpolation:Rt,atlasInterpolationIcon:lt,isSDF:de,hasHalo:jr};if(G&&ne.canOverlap){q=!0;const mt=pe.segments.get();for(const dt of mt)Q.push({segments:new d.aV([dt]),sortKey:dt.sortKey,state:gr,terrainData:ct})}else Q.push({segments:pe.segments,sortKey:0,state:gr,terrainData:ct})}q&&Q.sort(((oe,ie)=>oe.sortKey-ie.sortKey));for(const oe of Q){const ie=oe.state;if(z.activeTexture.set(F.TEXTURE0),ie.atlasTexture.bind(ie.atlasInterpolation,F.CLAMP_TO_EDGE),ie.atlasTextureIcon&&(z.activeTexture.set(F.TEXTURE1),ie.atlasTextureIcon&&ie.atlasTextureIcon.bind(ie.atlasInterpolationIcon,F.CLAMP_TO_EDGE)),ie.isSDF){const ne=ie.uniformValues;ie.hasHalo&&(ne.u_is_halo=1,sl(ie.buffers,oe.segments,n,p,ie.program,Y,P,E,ne,ie.projectionData,oe.terrainData)),ne.u_is_halo=0}sl(ie.buffers,oe.segments,n,p,ie.program,Y,P,E,ie.uniformValues,ie.projectionData,oe.terrainData)}}function sl(p,t,n,o,c,f,y,b,w,S,P){const E=o.context;c.draw(E,E.gl.TRIANGLES,f,y,b,Ue.backCCW,w,P,S,n.id,p.layoutVertexBuffer,p.indexBuffer,t,n.paint,o.transform.zoom,p.programConfigurations.get(n.id),p.dynamicLayoutVertexBuffer,p.opacityVertexBuffer)}function ja(p,t,n,o,c){const f=p.context,y=f.gl,b=qe.disabled,w=new ut([y.ONE,y.ONE],d.bn.transparent,[!0,!0,!0,!0]),S=t.getBucket(n);if(!S)return;const P=o.key;let E=n.heatmapFbos.get(P);E||(E=ol(f,t.tileSize,t.tileSize),n.heatmapFbos.set(P,E)),f.bindFramebuffer.set(E.framebuffer),f.viewport.set([0,0,t.tileSize,t.tileSize]),f.clear({color:d.bn.transparent});const C=S.programConfigurations.get(n.id),z=p.useProgram("heatmap",C,!c),F=p.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),V=p.style.map.terrain.getTerrainData(o);z.draw(f,y.TRIANGLES,Fe.disabled,b,w,Ue.disabled,Wo(t,p.transform.zoom,n.paint.get("heatmap-intensity"),1),V,F,n.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,n.paint,p.transform.zoom,C)}function al(p,t,n,o,c){const f=p.context,y=f.gl,b=p.transform;f.setColorMode(p.colorModeForRenderPass());const w=ll(f,t),S=n.key,P=t.heatmapFbos.get(S);if(!P)return;f.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,P.colorAttachment.get()),f.activeTexture.set(y.TEXTURE1),w.bind(y.LINEAR,y.CLAMP_TO_EDGE);const E=b.getProjectionData({overscaledTileID:n,applyTerrainMatrix:c,applyGlobeMatrix:!o});p.useProgram("heatmapTexture").draw(f,y.TRIANGLES,Fe.disabled,qe.disabled,p.colorModeForRenderPass(),Ue.disabled,Xo(p,t,0,1),null,E,t.id,p.rasterBoundsBuffer,p.quadTriangleIndexBuffer,p.rasterBoundsSegments,t.paint,b.zoom),P.destroy(),t.heatmapFbos.delete(S)}function ol(p,t,n){var o,c;const f=p.gl,y=f.createTexture();f.bindTexture(f.TEXTURE_2D,y),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.LINEAR),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.LINEAR);const b=(o=p.HALF_FLOAT)!==null&&o!==void 0?o:f.UNSIGNED_BYTE,w=(c=p.RGBA16F)!==null&&c!==void 0?c:f.RGBA;f.texImage2D(f.TEXTURE_2D,0,w,t,n,0,f.RGBA,b,null);const S=p.createFramebuffer(t,n,!1,!1);return S.colorAttachment.set(y),S}function ll(p,t){return t.colorRampTexture||(t.colorRampTexture=new d.T(p,t.colorRamp,p.gl.RGBA)),t.colorRampTexture}function Ls(p,t,n,o,c,f,y,b){let w=256;if(c.stepInterpolant){const S=t.getSource().maxzoom,P=y.canonical.z===S?Math.ceil(1<<p.transform.maxZoom-y.canonical.z):1;w=d.ak(d.cc(f.maxLineLength/d.a5*1024*P),256,n.maxTextureSize)}return b.gradient=d.cd({expression:c.gradientExpression(),evaluationKey:"lineProgress",resolution:w,image:b.gradient||void 0,clips:f.lineClipsArray}),b.texture?b.texture.update(b.gradient):b.texture=new d.T(n,b.gradient,o.RGBA),b.version=c.gradientVersion,b.texture}function cl(p,t,n,o,c){p.activeTexture.set(t.TEXTURE0),n.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),o.updatePaintBuffers(c)}function Hu(p,t,n,o,c,f){(c||p.lineAtlas.dirty)&&(t.activeTexture.set(n.TEXTURE0),p.lineAtlas.bind(t)),o.updatePaintBuffers(f)}function Cc(p,t,n,o,c,f,y){const b=f.gradients[c.id];let w=b.texture;c.gradientVersion!==b.version&&(w=Ls(p,t,n,o,c,f,y,b)),n.activeTexture.set(o.TEXTURE0),w.bind(c.stepInterpolant?o.NEAREST:o.LINEAR,o.CLAMP_TO_EDGE)}function Et(p,t,n,o,c,f,y,b,w){const S=f.gradients[c.id];let P=S.texture;c.gradientVersion!==S.version&&(P=Ls(p,t,n,o,c,f,y,S)),n.activeTexture.set(o.TEXTURE0),P.bind(c.stepInterpolant?o.NEAREST:o.LINEAR,o.CLAMP_TO_EDGE),n.activeTexture.set(o.TEXTURE1),p.lineAtlas.bind(n),b.updatePaintBuffers(w)}function Fr(p,t,n,o,c){if(!n||!o||!o.imageAtlas)return;const f=o.imageAtlas.patternPositions;let y=f[n.to.toString()],b=f[n.from.toString()];if(!y&&b&&(y=b),!b&&y&&(b=y),!y||!b){const w=c.getPaintProperty(t);y=f[w],b=f[w]}y&&b&&p.setConstantPatternPositions(y,b)}function xi(p,t,n,o,c,f,y,b){const w=p.context.gl,S="fill-pattern",P=n.paint.get(S),E=P&&P.constantOr(1),C=n.getCrossfadeParameters();let z,F,V,j,N;const $=p.transform,W=n.paint.get("fill-translate"),G=n.paint.get("fill-translate-anchor");y?(F=E&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",z=w.LINES):(F=E?"fillPattern":"fill",z=w.TRIANGLES);const q=P.constantOr(null);for(const Y of o){const Z=t.getTile(Y);if(E&&!Z.patternsLoaded())continue;const Q=Z.getBucket(n);if(!Q)continue;const ae=Q.programConfigurations.get(n.id),oe=p.useProgram(F,ae),ie=p.style.map.terrain&&p.style.map.terrain.getTerrainData(Y);E&&(p.context.activeTexture.set(w.TEXTURE0),Z.imageAtlasTexture.bind(w.LINEAR,w.CLAMP_TO_EDGE),ae.updatePaintBuffers(C)),Fr(ae,S,q,Z,n);const ne=$.getProjectionData({overscaledTileID:Y,applyGlobeMatrix:!b,applyTerrainMatrix:!0}),pe=d.aL($,Z,W,G);if(y){j=Q.indexBuffer2,N=Q.segments2;const de=[w.drawingBufferWidth,w.drawingBufferHeight];V=F==="fillOutlinePattern"&&E?dc(p,C,Z,de,pe):qo(de,pe)}else j=Q.indexBuffer,N=Q.segments,V=E?Zo(p,C,Z,pe):{u_fill_translate:pe};const fe=p.stencilModeForClipping(Y);oe.draw(p.context,z,c,fe,f,Ue.backCCW,V,ie,ne,n.id,Q.layoutVertexBuffer,j,N,n.paint,p.transform.zoom,ae)}}function Bs(p,t,n,o,c,f,y,b){const w=p.context,S=w.gl,P="fill-extrusion-pattern",E=n.paint.get(P),C=E.constantOr(1),z=n.getCrossfadeParameters(),F=n.paint.get("fill-extrusion-opacity"),V=E.constantOr(null),j=p.transform;for(const N of o){const $=t.getTile(N),W=$.getBucket(n);if(!W)continue;const G=p.style.map.terrain&&p.style.map.terrain.getTerrainData(N),q=W.programConfigurations.get(n.id),Y=p.useProgram(C?"fillExtrusionPattern":"fillExtrusion",q);C&&(p.context.activeTexture.set(S.TEXTURE0),$.imageAtlasTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE),q.updatePaintBuffers(z));const Z=j.getProjectionData({overscaledTileID:N,applyGlobeMatrix:!b,applyTerrainMatrix:!0});Fr(q,P,V,$,n);const Q=d.aL(j,$,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ae=n.paint.get("fill-extrusion-vertical-gradient"),oe=C?Bu(p,ae,F,Q,N,z,$):$o(p,ae,F,Q);Y.draw(w,w.gl.TRIANGLES,c,f,y,Ue.backCCW,oe,G,Z,n.id,W.layoutVertexBuffer,W.indexBuffer,W.segments,n.paint,p.transform.zoom,q,p.style.map.terrain&&W.centroidVertexBuffer)}}function qn(p,t,n,o,c,f,y,b,w){var S;const P=p.style.projection,E=p.context,C=p.transform,z=E.gl,F=[`#define NUM_ILLUMINATION_SOURCES ${n.paint.get("hillshade-highlight-color").values.length}`],V=p.useProgram("hillshade",null,!1,F),j=!p.options.moving;for(const N of o){const $=t.getTile(N),W=$.fbo;if(!W)continue;const G=P.getMeshFromTileID(E,N.canonical,b,!0,"raster"),q=(S=p.style.map.terrain)===null||S===void 0?void 0:S.getTerrainData(N);E.activeTexture.set(z.TEXTURE0),z.bindTexture(z.TEXTURE_2D,W.colorAttachment.get());const Y=C.getProjectionData({overscaledTileID:N,aligned:j,applyGlobeMatrix:!w,applyTerrainMatrix:!0});V.draw(E,z.TRIANGLES,f,c[N.overscaledZ],y,Ue.backCCW,Is(p,$,n),q,Y,n.id,G.vertexBuffer,G.indexBuffer,G.segments)}}function Na(p,t,n,o,c,f,y,b,w){var S;const P=p.style.projection,E=p.context,C=p.transform,z=E.gl,F=p.useProgram("colorRelief"),V=!p.options.moving,j=n.paint.get("resampling")==="nearest"?z.NEAREST:z.LINEAR;let N=!0,$=0;for(const W of o){const G=t.getTile(W),q=G.dem;if(N){const ie=z.getParameter(z.MAX_TEXTURE_SIZE),{elevationTexture:ne,colorTexture:pe}=n.getColorRampTextures(E,ie,q.getUnpackVector());E.activeTexture.set(z.TEXTURE1),ne.bind(z.NEAREST,z.CLAMP_TO_EDGE),E.activeTexture.set(z.TEXTURE4),pe.bind(z.LINEAR,z.CLAMP_TO_EDGE),N=!1,$=ne.size[0]}if(!q||!q.data)continue;const Y=q.stride,Z=q.getPixels();if(E.activeTexture.set(z.TEXTURE0),E.pixelStoreUnpackPremultiplyAlpha.set(!1),G.demTexture=G.demTexture||p.getTileTexture(Y),G.demTexture){const ie=G.demTexture;ie.update(Z,{premultiply:!1}),ie.bind(j,z.CLAMP_TO_EDGE)}else G.demTexture=new d.T(E,Z,z.RGBA,{premultiply:!1}),G.demTexture.bind(j,z.CLAMP_TO_EDGE);const Q=P.getMeshFromTileID(E,W.canonical,b,!0,"raster"),ae=(S=p.style.map.terrain)===null||S===void 0?void 0:S.getTerrainData(W),oe=C.getProjectionData({overscaledTileID:W,aligned:V,applyGlobeMatrix:!w,applyTerrainMatrix:!0});F.draw(E,z.TRIANGLES,f,c[W.overscaledZ],y,Ue.backCCW,Vu(n,G.dem,$),ae,oe,n.id,Q.vertexBuffer,Q.indexBuffer,Q.segments)}}const Lr=[new d.P(0,0),new d.P(d.a5,0),new d.P(d.a5,d.a5),new d.P(0,d.a5)];function Wn(p,t,n,o,c,f,y,b,w=!1,S=!1){const P=o[o.length-1].overscaledZ,E=p.context,C=E.gl,z=p.useProgram("raster"),F=p.transform,V=p.style.projection,j=p.colorModeForRenderPass(),N=!p.options.moving,$=n.paint.get("raster-opacity"),W=n.paint.get("resampling")==="nearest"||n.paint.get("raster-resampling")==="nearest"?C.NEAREST:C.LINEAR,G=n.paint.get("raster-fade-duration"),q=!!p.style.map.terrain;for(const Y of o){const Z=p.getDepthModeForSublayer(Y.overscaledZ-P,$===1?Fe.ReadWrite:Fe.ReadOnly,C.LESS),Q=t.getTile(Y);E.activeTexture.set(C.TEXTURE0),Q.texture.bind(W,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),E.activeTexture.set(C.TEXTURE1);const{parentTile:ae,parentScaleBy:oe,parentTopLeft:ie,fadeValues:ne}=Os(Q,t,G,q);Q.fadeOpacity=ne.tileOpacity,ae?(ae.fadeOpacity=ne.parentTileOpacity,ae.texture.bind(W,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST)):Q.texture.bind(W,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),Q.texture.useMipmap&&E.extTextureFilterAnisotropic&&p.transform.pitch>p.options.anisotropicFilterPitch&&C.texParameterf(C.TEXTURE_2D,E.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,E.extTextureFilterAnisotropicMax);const pe=p.style.map.terrain&&p.style.map.terrain.getTerrainData(Y),fe=F.getProjectionData({overscaledTileID:Y,aligned:N,applyGlobeMatrix:!S,applyTerrainMatrix:!0}),de=ur(ie,oe,ne.fadeMix,n,b),Pe=V.getMeshFromTileID(E,Y.canonical,f,y,"raster");z.draw(E,C.TRIANGLES,Z,c?c[Y.overscaledZ]:qe.disabled,j,w?Ue.frontCCW:Ue.backCCW,de,pe,fe,n.id,Pe.vertexBuffer,Pe.indexBuffer,Pe.segments)}}function Os(p,t,n,o){const c={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(n===0||o)return c;if(p.fadingParentID){const f=t.getLoadedTile(p.fadingParentID);if(!f)return c;const y=Math.pow(2,f.tileID.overscaledZ-p.tileID.overscaledZ),b=[p.tileID.canonical.x*y%1,p.tileID.canonical.y*y%1],w=(function(S,P,E){const C=Ze(),z=(C-P.timeAdded)/E,F=S.fadingDirection===Bi.Incoming,V=d.ak((C-S.timeAdded)/E,0,1),j=d.ak(1-z,0,1),N=F?V:j;return{tileOpacity:N,parentTileOpacity:F?j:V,fadeMix:{opacity:1,mix:1-N}}})(p,f,n);return{parentTile:f,parentScaleBy:y,parentTopLeft:b,fadeValues:w}}if(p.selfFading){const f=(function(y,b){const w=(Ze()-y.timeAdded)/b,S=d.ak(w,0,1);return{tileOpacity:S,fadeMix:{opacity:S,mix:0}}})(p,n);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:f}}return c}const ul=new d.bn(1,0,0,1),Ac=new d.bn(0,1,0,1),Dc=new d.bn(0,0,1,1),zc=new d.bn(1,0,1,1),kc=new d.bn(0,1,1,1);function hl(p,t,n,o){Vs(p,0,t+n/2,p.transform.width,n,o)}function hr(p,t,n,o){Vs(p,t-n/2,0,n,p.transform.height,o)}function Vs(p,t,n,o,c,f){const y=p.context,b=y.gl;b.enable(b.SCISSOR_TEST),b.scissor(t*p.pixelRatio,n*p.pixelRatio,o*p.pixelRatio,c*p.pixelRatio),y.clear({color:f}),b.disable(b.SCISSOR_TEST)}function Rc(p,t,n){const o=p.context,c=o.gl,f=p.useProgram("debug"),y=Fe.disabled,b=qe.disabled,w=p.colorModeForRenderPass(),S="$debug",P=p.style.map.terrain&&p.style.map.terrain.getTerrainData(n);o.activeTexture.set(c.TEXTURE0);const E=t.getTileByID(n.key).latestRawTileData,C=Math.floor((E&&E.byteLength||0)/1024),z=t.getTile(n).tileSize,F=512/Math.min(z,512)*(n.overscaledZ/p.transform.zoom)*.5;let V=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(V+=` => ${n.overscaledZ}`),(function(N,$){N.initDebugOverlayCanvas();const W=N.debugOverlayCanvas,G=N.context.gl,q=N.debugOverlayCanvas.getContext("2d");q.clearRect(0,0,W.width,W.height),q.shadowColor="white",q.shadowBlur=2,q.lineWidth=1.5,q.strokeStyle="white",q.textBaseline="top",q.font="bold 36px Open Sans, sans-serif",q.fillText($,5,5),q.strokeText($,5,5),N.debugOverlayTexture.update(W),N.debugOverlayTexture.bind(G.LINEAR,G.CLAMP_TO_EDGE)})(p,`${V} ${C}kB`);const j=p.transform.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!0,applyTerrainMatrix:!0});f.draw(o,c.TRIANGLES,y,b,ut.alphaBlended,Ue.disabled,Rr(d.bn.transparent,F),null,j,S,p.debugBuffer,p.quadTriangleIndexBuffer,p.debugSegments),f.draw(o,c.LINE_STRIP,y,b,w,Ue.disabled,Rr(d.bn.red),P,j,S,p.debugBuffer,p.tileBorderIndexBuffer,p.debugSegments)}function dl(p,t,n,o){const{isRenderingGlobe:c}=o,f=p.context,y=f.gl,b=p.transform,w=p.colorModeForRenderPass(),S=p.getDepthModeFor3D(),P=p.useProgram("terrain");f.bindFramebuffer.set(null),f.viewport.set([0,0,p.width,p.height]);for(const E of n){const C=t.getTerrainMesh(E.tileID),z=p.renderToTexture.getTexture(E),F=t.getTerrainData(E.tileID);f.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,z.texture);const V=t.getMeshFrameDelta(b.zoom),j=b.calculateFogMatrix(E.tileID.toUnwrapped()),N=Lu(V,j,p.style.sky,b.pitch,c),$=b.getProjectionData({overscaledTileID:E.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});P.draw(f,y.TRIANGLES,S,qe.disabled,w,Ue.backCCW,N,F,$,"terrain",C.vertexBuffer,C.indexBuffer,C.segments)}}function pl(p,t){if(!t.mesh){const n=new d.aU;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(1,1),n.emplaceBack(-1,1);const o=new d.aW;o.emplaceBack(0,1,2),o.emplaceBack(0,2,3),t.mesh=new kt(p.createVertexBuffer(n,vt.members),p.createIndexBuffer(o),d.aV.simpleSegment(0,0,n.length,o.length))}return t.mesh}class js{constructor(t,n){this.context=new Mc(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:d.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Qt.maxOverzooming+Qt.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ac}resize(t,n,o){if(this.width=Math.floor(t*o),this.height=Math.floor(n*o),this.pixelRatio=o,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const c of this.style._order)this.style._layers[c].resize()}setup(){const t=this.context,n=new d.aU;n.emplaceBack(0,0),n.emplaceBack(d.a5,0),n.emplaceBack(0,d.a5),n.emplaceBack(d.a5,d.a5),this.tileExtentBuffer=t.createVertexBuffer(n,vt.members),this.tileExtentSegments=d.aV.simpleSegment(0,0,4,2);const o=new d.aU;o.emplaceBack(0,0),o.emplaceBack(d.a5,0),o.emplaceBack(0,d.a5),o.emplaceBack(d.a5,d.a5),this.debugBuffer=t.createVertexBuffer(o,vt.members),this.debugSegments=d.aV.simpleSegment(0,0,4,5);const c=new d.cf;c.emplaceBack(0,0,0,0),c.emplaceBack(d.a5,0,d.a5,0),c.emplaceBack(0,d.a5,0,d.a5),c.emplaceBack(d.a5,d.a5,d.a5,d.a5),this.rasterBoundsBuffer=t.createVertexBuffer(c,Ss.members),this.rasterBoundsSegments=d.aV.simpleSegment(0,0,4,2);const f=new d.aU;f.emplaceBack(0,0),f.emplaceBack(d.a5,0),f.emplaceBack(0,d.a5),f.emplaceBack(d.a5,d.a5),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(f,vt.members),this.rasterBoundsSegmentsPosOnly=d.aV.simpleSegment(0,0,4,5);const y=new d.aU;y.emplaceBack(0,0),y.emplaceBack(1,0),y.emplaceBack(0,1),y.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(y,vt.members),this.viewportSegments=d.aV.simpleSegment(0,0,4,2);const b=new d.cg;b.emplaceBack(0),b.emplaceBack(1),b.emplaceBack(3),b.emplaceBack(2),b.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(b);const w=new d.aW;w.emplaceBack(1,0,2),w.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(w);const S=this.context.gl;this.stencilClearMode=new qe({func:S.ALWAYS,mask:0},0,255,S.ZERO,S.ZERO,S.ZERO),this.tileExtentMesh=new kt(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const o=d.N();d.c5(o,0,this.width,this.height,0,0,1),d.Q(o,o,[n.drawingBufferWidth,n.drawingBufferHeight,0]);const c={mainMatrix:o,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:o};this.useProgram("clippingMask",null,!0).draw(t,n.TRIANGLES,Fe.disabled,this.stencilClearMode,ut.disabled,Ue.disabled,null,null,c,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n,o){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source,this.nextStencilID+n.length>256&&this.clearStencil();const c=this.context;c.setColorMode(ut.disabled),c.setDepthMode(Fe.disabled);const f={};for(const y of n)f[y.key]=this.nextStencilID++;this._renderTileMasks(f,n,o,!0),this._renderTileMasks(f,n,o,!1),this._tileClippingMaskIDs=f}_renderTileMasks(t,n,o,c){const f=this.context,y=f.gl,b=this.style.projection,w=this.transform,S=this.useProgram("clippingMask");for(const P of n){const E=t[P.key],C=this.style.map.terrain&&this.style.map.terrain.getTerrainData(P),z=b.getMeshFromTileID(this.context,P.canonical,c,!0,"stencil"),F=w.getProjectionData({overscaledTileID:P,applyGlobeMatrix:!o,applyTerrainMatrix:!0});S.draw(f,y.TRIANGLES,Fe.disabled,new qe({func:y.ALWAYS,mask:0},E,255,y.KEEP,y.KEEP,y.REPLACE),ut.disabled,o?Ue.disabled:Ue.backCCW,null,C,F,"$clipping",z.vertexBuffer,z.indexBuffer,z.segments)}}_renderTilesDepthBuffer(){const t=this.context,n=t.gl,o=this.style.projection,c=this.transform,f=this.useProgram("depth"),y=this.getDepthModeFor3D(),b=Kr(c,{tileSize:c.tileSize});for(const w of b){const S=this.style.map.terrain&&this.style.map.terrain.getTerrainData(w),P=o.getMeshFromTileID(this.context,w.canonical,!0,!0,"raster"),E=c.getProjectionData({overscaledTileID:w,applyGlobeMatrix:!0,applyTerrainMatrix:!0});f.draw(t,n.TRIANGLES,y,qe.disabled,ut.disabled,Ue.backCCW,null,S,E,"$clipping",P.vertexBuffer,P.indexBuffer,P.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new qe({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new qe({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){const n=this.context.gl,o=t.sort(((y,b)=>b.overscaledZ-y.overscaledZ)),c=o[o.length-1].overscaledZ,f=o[0].overscaledZ-c+1;if(f>1){this.currentStencilSource=void 0,this.nextStencilID+f>256&&this.clearStencil();const y={};for(let b=0;b<f;b++)y[b+c]=new qe({func:n.GEQUAL,mask:255},b+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=f,[y,o]}return[{[c]:qe.disabled},o]}stencilConfigForOverlapTwoPass(t){const n=this.context.gl,o=t.sort(((y,b)=>b.overscaledZ-y.overscaledZ)),c=o[o.length-1].overscaledZ,f=o[0].overscaledZ-c+1;if(this.clearStencil(),f>1){const y={},b={};for(let w=0;w<f;w++)y[w+c]=new qe({func:n.GREATER,mask:255},f+1+w,255,n.KEEP,n.KEEP,n.REPLACE),b[w+c]=new qe({func:n.GREATER,mask:255},1+w,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID=2*f+1,[y,b,o]}return this.nextStencilID=3,[{[c]:new qe({func:n.GREATER,mask:255},2,255,n.KEEP,n.KEEP,n.REPLACE)},{[c]:new qe({func:n.GREATER,mask:255},1,255,n.KEEP,n.KEEP,n.REPLACE)},o]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new ut([t.CONSTANT_COLOR,t.ONE],new d.bn(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?ut.unblended:ut.alphaBlended}getDepthModeForSublayer(t,n,o){if(!this.opaquePassEnabledForLayer())return Fe.disabled;const c=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Fe(o||this.context.gl.LEQUAL,n,[c,c])}getDepthModeFor3D(){return new Fe(this.context.gl.LEQUAL,Fe.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){var o,c;this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(Ze()),this.imageManager.beginFrame();const f=this.style._order,y=this.style.tileManagers,b={},w={},S={},P={isRenderingToTexture:!1,isRenderingGlobe:((o=t.projection)===null||o===void 0?void 0:o.transitionState)>0};for(const C in y){const z=y[C];z.used&&z.prepare(this.context),b[C]=z.getVisibleCoordinates(!1),w[C]=b[C].slice().reverse(),S[C]=z.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let C=0;C<f.length;C++)if(this.style._layers[f[C]].is3D()){this.opaquePassCutoff=C;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const C of f){const z=this.style._layers[C];if(!z.hasOffscreenPass()||z.isHidden(this.transform.zoom))continue;const F=w[z.source];(z.type==="custom"||F.length)&&this.renderLayer(this,y[z.source],z,F,P)}if((c=this.style.projection)===null||c===void 0||c.updateGPUdependent({context:this.context,useProgram:C=>this.useProgram(C)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?d.bn.black:d.bn.transparent,depth:1}),this.clearStencil(),this.style.sky&&(function(C,z){const F=C.context,V=F.gl,j=((Y,Z,Q)=>{const ae=Math.cos(Z.rollInRadians),oe=Math.sin(Z.rollInRadians),ie=Yr(Z),ne=Z.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:Y.properties.get("sky-color"),u_horizon_color:Y.properties.get("horizon-color"),u_horizon:[(Z.width/2-ie*oe)*Q,(Z.height/2+ie*ae)*Q],u_horizon_normal:[-oe,ae],u_sky_horizon_blend:Y.properties.get("sky-horizon-blend")*Z.height/2*Q,u_sky_blend:ne}})(z,C.style.map.transform,C.pixelRatio),N=new Fe(V.LEQUAL,Fe.ReadWrite,[0,1]),$=qe.disabled,W=C.colorModeForRenderPass(),G=C.useProgram("sky"),q=pl(F,z);G.draw(F,V.TRIANGLES,N,$,W,Ue.disabled,j,null,void 0,"sky",q.vertexBuffer,q.indexBuffer,q.segments)})(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=f.length-1;this.currentLayer>=0;this.currentLayer--){const C=this.style._layers[f[this.currentLayer]],z=y[C.source],F=b[C.source];this._renderTileClippingMasks(C,F,!1),this.renderLayer(this,z,C,F,P)}this.renderPass="translucent";let E=!1;for(this.currentLayer=0;this.currentLayer<f.length;this.currentLayer++){const C=this.style._layers[f[this.currentLayer]],z=y[C.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(C,P))continue;this.opaquePassEnabledForLayer()||E||(E=!0,P.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const F=(C.type==="symbol"?S:w)[C.source];this._renderTileClippingMasks(C,b[C.source],!!this.renderToTexture),this.renderLayer(this,z,C,F,P)}if(P.isRenderingGlobe&&(function(C,z,F){const V=C.context,j=V.gl,N=C.useProgram("atmosphere"),$=new Fe(j.LEQUAL,Fe.ReadOnly,[0,1]),W=C.transform,G=(function(ne,pe){const fe=ne.properties.get("position"),de=[-fe.x,-fe.y,-fe.z],Pe=d.ao(new Float64Array(16));return ne.properties.get("anchor")==="map"&&(d.be(Pe,Pe,pe.rollInRadians),d.bf(Pe,Pe,-pe.pitchInRadians),d.be(Pe,Pe,pe.bearingInRadians),d.bf(Pe,Pe,pe.center.lat*Math.PI/180),d.bH(Pe,Pe,-pe.center.lng*Math.PI/180)),d.ce(de,de,Pe),de})(F,C.transform),q=W.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),Y=z.properties.get("atmosphere-blend")*q.projectionTransition;if(Y===0)return;const Z=On(W.worldSize,W.center.lat),Q=W.inverseProjectionMatrix,ae=new Float64Array(4);ae[3]=1,d.aE(ae,ae,W.modelViewProjectionMatrix),ae[0]/=ae[3],ae[1]/=ae[3],ae[2]/=ae[3],ae[3]=1,d.aE(ae,ae,Q),ae[0]/=ae[3],ae[1]/=ae[3],ae[2]/=ae[3],ae[3]=1;const oe=((ne,pe,fe,de,Pe)=>({u_sun_pos:ne,u_atmosphere_blend:pe,u_globe_position:fe,u_globe_radius:de,u_inv_proj_matrix:Pe}))(G,Y,[ae[0],ae[1],ae[2]],Z,Q),ie=pl(V,z);N.draw(V,j.TRIANGLES,$,qe.disabled,ut.alphaBlended,Ue.disabled,oe,null,null,"atmosphere",ie.vertexBuffer,ie.indexBuffer,ie.segments)})(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const C=(function(z,F){let V=null;const j=Object.values(z._layers).flatMap((G=>G.source&&!G.isHidden(F)?[z.tileManagers[G.source]]:[])),N=j.filter((G=>G.getSource().type==="vector")),$=j.filter((G=>G.getSource().type!=="vector")),W=G=>{(!V||V.getSource().maxzoom<G.getSource().maxzoom)&&(V=G)};return N.forEach((G=>W(G))),V||$.forEach((G=>W(G))),V})(this.style,this.transform.zoom);C&&(function(z,F,V){for(let j=0;j<V.length;j++)Rc(z,F,V[j])})(this,C,C.getVisibleCoordinates())}this.options.showPadding&&(function(C){const z=C.transform.padding;hl(C,C.transform.height-(z.top||0),3,ul),hl(C,z.bottom||0,3,Ac),hr(C,z.left||0,3,Dc),hr(C,C.transform.width-(z.right||0),3,zc);const F=C.transform.centerPoint;(function(V,j,N,$){Vs(V,j-1,N-10,2,20,$),Vs(V,j-10,N-1,20,2,$)})(C,F.x,C.transform.height-F.y,kc)})(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const n=this.terrainFacilitator.matrix,o=this.transform.modelViewProjectionMatrix;let c=this.terrainFacilitator.dirty;c||(c=t?!d.ch(n,o):!d.ci(n,o)),c||(c=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),c&&(d.cj(n,o),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,(function(f,y){const b=f.context,w=b.gl,S=f.transform,P=ut.unblended,E=new Fe(w.LEQUAL,Fe.ReadWrite,[0,1]),C=y.tileManager.getRenderableTiles(),z=f.useProgram("terrainDepth");b.bindFramebuffer.set(y.getFramebuffer("depth").framebuffer),b.viewport.set([0,0,f.width/devicePixelRatio,f.height/devicePixelRatio]),b.clear({color:d.bn.transparent,depth:1});for(const F of C){const V=y.getTerrainMesh(F.tileID),j=y.getTerrainData(F.tileID),N=S.getProjectionData({overscaledTileID:F.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),$={u_ele_delta:y.getMeshFrameDelta(S.zoom)};z.draw(b,w.TRIANGLES,E,qe.disabled,P,Ue.backCCW,$,j,N,"terrain",V.vertexBuffer,V.indexBuffer,V.segments)}b.bindFramebuffer.set(null),b.viewport.set([0,0,f.width,f.height])})(this,this.style.map.terrain),(function(f,y){const b=f.context,w=b.gl,S=f.transform,P=ut.unblended,E=new Fe(w.LEQUAL,Fe.ReadWrite,[0,1]),C=y.getCoordsTexture(),z=y.tileManager.getRenderableTiles(),F=f.useProgram("terrainCoords");b.bindFramebuffer.set(y.getFramebuffer("coords").framebuffer),b.viewport.set([0,0,f.width/devicePixelRatio,f.height/devicePixelRatio]),b.clear({color:d.bn.transparent,depth:1}),y.coordsIndex=[];for(const V of z){const j=y.getTerrainMesh(V.tileID),N=y.getTerrainData(V.tileID);b.activeTexture.set(w.TEXTURE0),w.bindTexture(w.TEXTURE_2D,C.texture);const $={u_terrain_coords_id:(255-y.coordsIndex.length)/255,u_texture:0,u_ele_delta:y.getMeshFrameDelta(S.zoom)},W=S.getProjectionData({overscaledTileID:V.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});F.draw(b,w.TRIANGLES,E,qe.disabled,P,Ue.backCCW,$,N,W,"terrain",j.vertexBuffer,j.indexBuffer,j.segments),y.coordsIndex.push(V.tileID.key)}b.bindFramebuffer.set(null),b.viewport.set([0,0,f.width,f.height])})(this,this.style.map.terrain))}renderLayer(t,n,o,c,f){o.isHidden(this.transform.zoom)||(o.type==="background"||o.type==="custom"||(c||[]).length)&&(this.id=o.id,d.aQ(o)?(function(y,b,w,S,P,E){if(y.renderPass!=="translucent")return;const{isRenderingToTexture:C}=E,z=qe.disabled,F=y.colorModeForRenderPass();(w._unevaluatedLayout.hasValue("text-variable-anchor")||w._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&(function(V,j,N,$,W,G,q,Y,Z){const Q=j.transform,ae=j.style.map.terrain,oe=W==="map",ie=G==="map";for(const ne of V){const pe=$.getTile(ne),fe=pe.getBucket(N);if(!fe||!fe.text||!fe.text.segments.get().length)continue;const de=d.av(fe.textSizeData,Q.zoom),Pe=d.aK(pe,1,j.transform.zoom),Me=ke(oe,j.transform,Pe),et=N.layout.get("icon-text-fit")!=="none"&&fe.hasIconData();if(de){const ht=Math.pow(2,Q.zoom-pe.tileID.overscaledZ),ct=ae?(ft,ot)=>ae.getElevation(ne,ft,ot):null;Xu(fe,oe,ie,Z,Q,Me,ht,de,et,d.aL(Q,pe,q,Y),ne.toUnwrapped(),ct)}}})(S,y,w,b,w.layout.get("text-rotation-alignment"),w.layout.get("text-pitch-alignment"),w.paint.get("text-translate"),w.paint.get("text-translate-anchor"),P),w.paint.get("icon-opacity").constantOr(1)!==0&&Ec(y,b,w,S,!1,w.paint.get("icon-translate"),w.paint.get("icon-translate-anchor"),w.layout.get("icon-rotation-alignment"),w.layout.get("icon-pitch-alignment"),w.layout.get("icon-keep-upright"),z,F,C),w.paint.get("text-opacity").constantOr(1)!==0&&Ec(y,b,w,S,!0,w.paint.get("text-translate"),w.paint.get("text-translate-anchor"),w.layout.get("text-rotation-alignment"),w.layout.get("text-pitch-alignment"),w.layout.get("text-keep-upright"),z,F,C),b.map.showCollisionBoxes&&(ks(y,b,w,S,!0),ks(y,b,w,S,!1))})(t,n,o,c,this.style.placement.variableOffsets,f):d.ck(o)?(function(y,b,w,S,P){if(y.renderPass!=="translucent")return;const{isRenderingToTexture:E}=P,C=w.paint.get("circle-opacity"),z=w.paint.get("circle-stroke-width"),F=w.paint.get("circle-stroke-opacity"),V=!w.layout.get("circle-sort-key").isConstant();if(C.constantOr(1)===0&&(z.constantOr(1)===0||F.constantOr(1)===0))return;const j=y.context,N=j.gl,$=y.transform,W=y.getDepthModeForSublayer(0,Fe.ReadOnly),G=qe.disabled,q=y.colorModeForRenderPass(),Y=[],Z=$.getCircleRadiusCorrection();for(let Q=0;Q<S.length;Q++){const ae=S[Q],oe=b.getTile(ae),ie=oe.getBucket(w);if(!ie)continue;const ne=w.paint.get("circle-translate"),pe=w.paint.get("circle-translate-anchor"),fe=d.aL($,oe,ne,pe),de=ie.programConfigurations.get(w.id),Pe=y.useProgram("circle",de),Me=ie.layoutVertexBuffer,et=ie.indexBuffer,ht=y.style.map.terrain&&y.style.map.terrain.getTerrainData(ae),ct={programConfiguration:de,program:Pe,layoutVertexBuffer:Me,indexBuffer:et,uniformValues:pc(y,oe,w,fe,Z),terrainData:ht,projectionData:$.getProjectionData({overscaledTileID:ae,applyGlobeMatrix:!E,applyTerrainMatrix:!0})};if(V){const ft=ie.segments.get();for(const ot of ft)Y.push({segments:new d.aV([ot]),sortKey:ot.sortKey,state:ct})}else Y.push({segments:ie.segments,sortKey:0,state:ct})}V&&Y.sort(((Q,ae)=>Q.sortKey-ae.sortKey));for(const Q of Y){const{programConfiguration:ae,program:oe,layoutVertexBuffer:ie,indexBuffer:ne,uniformValues:pe,terrainData:fe,projectionData:de}=Q.state;oe.draw(j,N.TRIANGLES,W,G,q,Ue.backCCW,pe,fe,de,w.id,ie,ne,Q.segments,w.paint,y.transform.zoom,ae)}})(t,n,o,c,f):d.cl(o)?(function(y,b,w,S,P){if(w.paint.get("heatmap-opacity")===0)return;const E=y.context,{isRenderingToTexture:C,isRenderingGlobe:z}=P;if(y.style.map.terrain){for(const F of S){const V=b.getTile(F);b.hasRenderableParent(F)||(y.renderPass==="offscreen"?ja(y,V,w,F,z):y.renderPass==="translucent"&&al(y,w,F,C,z))}E.viewport.set([0,0,y.width,y.height])}else y.renderPass==="offscreen"?(function(F,V,j,N){const $=F.context,W=$.gl,G=F.transform,q=qe.disabled,Y=new ut([W.ONE,W.ONE],d.bn.transparent,[!0,!0,!0,!0]);(function(Z,Q,ae){const oe=Z.gl;Z.activeTexture.set(oe.TEXTURE1),Z.viewport.set([0,0,Q.width/4,Q.height/4]);let ie=ae.heatmapFbos.get(d.cb);ie?(oe.bindTexture(oe.TEXTURE_2D,ie.colorAttachment.get()),Z.bindFramebuffer.set(ie.framebuffer)):(ie=ol(Z,Q.width/4,Q.height/4),ae.heatmapFbos.set(d.cb,ie))})($,F,j),$.clear({color:d.bn.transparent});for(let Z=0;Z<N.length;Z++){const Q=N[Z];if(V.hasRenderableParent(Q))continue;const ae=V.getTile(Q),oe=ae.getBucket(j);if(!oe)continue;const ie=oe.programConfigurations.get(j.id),ne=F.useProgram("heatmap",ie),pe=G.getProjectionData({overscaledTileID:Q,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),fe=G.getCircleRadiusCorrection();ne.draw($,W.TRIANGLES,Fe.disabled,q,Y,Ue.backCCW,Wo(ae,G.zoom,j.paint.get("heatmap-intensity"),fe),null,pe,j.id,oe.layoutVertexBuffer,oe.indexBuffer,oe.segments,j.paint,G.zoom,ie)}$.viewport.set([0,0,F.width,F.height])})(y,b,w,S):y.renderPass==="translucent"&&(function(F,V){const j=F.context,N=j.gl;j.setColorMode(F.colorModeForRenderPass());const $=V.heatmapFbos.get(d.cb);$&&(j.activeTexture.set(N.TEXTURE0),N.bindTexture(N.TEXTURE_2D,$.colorAttachment.get()),j.activeTexture.set(N.TEXTURE1),ll(j,V).bind(N.LINEAR,N.CLAMP_TO_EDGE),F.useProgram("heatmapTexture").draw(j,N.TRIANGLES,Fe.disabled,qe.disabled,F.colorModeForRenderPass(),Ue.disabled,Xo(F,V,0,1),null,null,V.id,F.viewportBuffer,F.quadTriangleIndexBuffer,F.viewportSegments,V.paint,F.transform.zoom))})(y,w)})(t,n,o,c,f):d.cm(o)?(function(y,b,w,S,P){if(y.renderPass!=="translucent")return;const{isRenderingToTexture:E}=P,C=w.paint.get("line-opacity"),z=w.paint.get("line-width");if(C.constantOr(1)===0||z.constantOr(1)===0)return;const F=y.getDepthModeForSublayer(0,Fe.ReadOnly),V=y.colorModeForRenderPass(),j=w.paint.get("line-dasharray"),N=j.constantOr(1),$=w.paint.get("line-pattern"),W=$.constantOr(1),G=w.paint.get("line-gradient"),q=w.getCrossfadeParameters();let Y;Y=W?"linePattern":N&&G?"lineGradientSDF":N?"lineSDF":G?"lineGradient":"line";const Z=y.context,Q=Z.gl,ae=y.transform;let oe=!0;for(const ie of S){const ne=b.getTile(ie);if(W&&!ne.patternsLoaded())continue;const pe=ne.getBucket(w);if(!pe)continue;const fe=pe.programConfigurations.get(w.id),de=y.context.program.get(),Pe=y.useProgram(Y,fe),Me=oe||Pe.program!==de,et=y.style.map.terrain&&y.style.map.terrain.getTerrainData(ie),ht=$.constantOr(null),ct=j&&j.constantOr(null);if(ht&&ne.imageAtlas){const Zt=ne.imageAtlas,At=Zt.patternPositions[ht.to.toString()],Ft=Zt.patternPositions[ht.from.toString()];At&&Ft&&fe.setConstantPatternPositions(At,Ft)}else if(ct){const Zt=w.layout.get("line-cap")==="round",At=y.lineAtlas.getDash(ct.to,Zt),Ft=y.lineAtlas.getDash(ct.from,Zt);fe.setConstantDashPositions(At,Ft)}const ft=ae.getProjectionData({overscaledTileID:ie,applyGlobeMatrix:!E,applyTerrainMatrix:!0}),ot=ae.getPixelScale();let Rt;W?(Rt=_c(y,ne,w,ot,q),cl(Z,Q,ne,fe,q)):N&&G?(Rt=Ho(y,ne,w,ot,q,pe.lineClipsArray.length),Et(y,b,Z,Q,w,pe,ie,fe,q)):N?(Rt=yc(y,ne,w,ot,q),Hu(y,Z,Q,fe,Me,q)):G?(Rt=gc(y,ne,w,ot,pe.lineClipsArray.length),Cc(y,b,Z,Q,w,pe,ie)):Rt=Ma(y,ne,w,ot);const lt=y.stencilModeForClipping(ie);Pe.draw(Z,Q.TRIANGLES,F,lt,V,Ue.disabled,Rt,et,ft,w.id,pe.layoutVertexBuffer,pe.indexBuffer,pe.segments,w.paint,y.transform.zoom,fe,pe.layoutVertexBuffer2),oe=!1}})(t,n,o,c,f):d.cn(o)?(function(y,b,w,S,P){const E=w.paint.get("fill-color"),C=w.paint.get("fill-opacity");if(C.constantOr(1)===0)return;const{isRenderingToTexture:z}=P,F=y.colorModeForRenderPass(),V=w.paint.get("fill-pattern"),j=y.opaquePassEnabledForLayer()&&!V.constantOr(1)&&E.constantOr(d.bn.transparent).a===1&&C.constantOr(0)===1?"opaque":"translucent";if(y.renderPass===j){const N=y.getDepthModeForSublayer(1,y.renderPass==="opaque"?Fe.ReadWrite:Fe.ReadOnly);xi(y,b,w,S,N,F,!1,z)}if(y.renderPass==="translucent"&&w.paint.get("fill-antialias")){const N=y.getDepthModeForSublayer(w.getPaintProperty("fill-outline-color")?2:0,Fe.ReadOnly);xi(y,b,w,S,N,F,!0,z)}})(t,n,o,c,f):d.co(o)?(function(y,b,w,S,P){const E=w.paint.get("fill-extrusion-opacity");if(E===0)return;const{isRenderingToTexture:C}=P;if(y.renderPass==="translucent"){const z=new Fe(y.context.gl.LEQUAL,Fe.ReadWrite,y.depthRangeFor3D);if(E!==1||w.paint.get("fill-extrusion-pattern").constantOr(1))Bs(y,b,w,S,z,qe.disabled,ut.disabled,C),Bs(y,b,w,S,z,y.stencilModeFor3D(),y.colorModeForRenderPass(),C);else{const F=y.colorModeForRenderPass();Bs(y,b,w,S,z,qe.disabled,F,C)}}})(t,n,o,c,f):d.cp(o)?(function(y,b,w,S,P){if(y.renderPass!=="offscreen"&&y.renderPass!=="translucent")return;const{isRenderingToTexture:E}=P,C=y.context,z=y.style.projection.useSubdivision,F=y.getDepthModeForSublayer(0,Fe.ReadOnly),V=y.colorModeForRenderPass();if(y.renderPass==="offscreen")(function(j,N,$,W,G,q,Y){const Z=j.context,Q=Z.gl,ae=W.paint.get("resampling")==="nearest"?Q.NEAREST:Q.LINEAR;for(const oe of $){const ie=N.getTile(oe),ne=ie.dem;if(!ne||!ne.data||!ie.needsHillshadePrepare)continue;const pe=ne.dim,fe=ne.stride,de=ne.getPixels();if(Z.activeTexture.set(Q.TEXTURE1),Z.pixelStoreUnpackPremultiplyAlpha.set(!1),ie.demTexture=ie.demTexture||j.getTileTexture(fe),ie.demTexture){const Me=ie.demTexture;Me.update(de,{premultiply:!1}),Me.bind(Q.NEAREST,Q.CLAMP_TO_EDGE)}else ie.demTexture=new d.T(Z,de,Q.RGBA,{premultiply:!1}),ie.demTexture.bind(Q.NEAREST,Q.CLAMP_TO_EDGE);Z.activeTexture.set(Q.TEXTURE0);let Pe=ie.fbo;if(!Pe){const Me=new d.T(Z,{width:pe,height:pe,data:null},Q.RGBA);Me.bind(ae,Q.CLAMP_TO_EDGE),Pe=ie.fbo=Z.createFramebuffer(pe,pe,!0,!1),Pe.colorAttachment.set(Me.texture)}Z.bindFramebuffer.set(Pe.framebuffer),Z.viewport.set([0,0,pe,pe]),j.useProgram("hillshadePrepare").draw(Z,Q.TRIANGLES,G,q,Y,Ue.disabled,Ou(ie.tileID,ne),null,null,W.id,j.rasterBoundsBuffer,j.quadTriangleIndexBuffer,j.rasterBoundsSegments),ie.needsHillshadePrepare=!1}})(y,b,S,w,F,qe.disabled,V),C.viewport.set([0,0,y.width,y.height]);else if(y.renderPass==="translucent")if(z){const[j,N,$]=y.stencilConfigForOverlapTwoPass(S);qn(y,b,w,$,j,F,V,!1,E),qn(y,b,w,$,N,F,V,!0,E)}else{const[j,N]=y.getStencilConfigForOverlapAndUpdateStencilID(S);qn(y,b,w,N,j,F,V,!1,E)}})(t,n,o,c,f):d.cq(o)?(function(y,b,w,S,P){if(y.renderPass!=="translucent"||!S.length)return;const{isRenderingToTexture:E}=P,C=y.style.projection.useSubdivision,z=y.getDepthModeForSublayer(0,Fe.ReadOnly),F=y.colorModeForRenderPass();if(C){const[V,j,N]=y.stencilConfigForOverlapTwoPass(S);Na(y,b,w,N,V,z,F,!1,E),Na(y,b,w,N,j,z,F,!0,E)}else{const[V,j]=y.getStencilConfigForOverlapAndUpdateStencilID(S);Na(y,b,w,j,V,z,F,!1,E)}})(t,n,o,c,f):d.bS(o)?(function(y,b,w,S,P){if(y.renderPass!=="translucent"||w.paint.get("raster-opacity")===0||!S.length)return;const{isRenderingToTexture:E}=P,C=b.getSource(),z=y.style.projection.useSubdivision;if(C instanceof Er)Wn(y,b,w,S,null,!1,!1,C.tileCoords,C.flippedWindingOrder,E);else if(z){const[F,V,j]=y.stencilConfigForOverlapTwoPass(S);Wn(y,b,w,j,F,!1,!0,Lr,!1,E),Wn(y,b,w,j,V,!0,!0,Lr,!1,E)}else{const[F,V]=y.getStencilConfigForOverlapAndUpdateStencilID(S);Wn(y,b,w,V,F,!1,!0,Lr,!1,E)}})(t,n,o,c,f):d.cr(o)?(function(y,b,w,S,P){const E=w.paint.get("background-color"),C=w.paint.get("background-opacity");if(C===0)return;const{isRenderingToTexture:z}=P,F=y.context,V=F.gl,j=y.style.projection,N=y.transform,$=N.tileSize,W=w.paint.get("background-pattern");if(y.isPatternMissing(W))return;const G=!W&&E.a===1&&C===1&&y.opaquePassEnabledForLayer()?"opaque":"translucent";if(y.renderPass!==G)return;const q=qe.disabled,Y=y.getDepthModeForSublayer(0,G==="opaque"?Fe.ReadWrite:Fe.ReadOnly),Z=y.colorModeForRenderPass(),Q=y.useProgram(W?"backgroundPattern":"background"),ae=S||Kr(N,{tileSize:$,terrain:y.style.map.terrain});W&&(F.activeTexture.set(V.TEXTURE0),y.imageManager.bind(y.context));const oe=w.getCrossfadeParameters();for(const ie of ae){const ne=N.getProjectionData({overscaledTileID:ie,applyGlobeMatrix:!z,applyTerrainMatrix:!0}),pe=W?ln(C,y,W,{tileID:ie,tileSize:$},oe):Ko(C,E),fe=y.style.map.terrain&&y.style.map.terrain.getTerrainData(ie),de=j.getMeshFromTileID(F,ie.canonical,!1,!0,"raster");Q.draw(F,V.TRIANGLES,Y,q,Z,Ue.backCCW,pe,fe,ne,w.id,de.vertexBuffer,de.indexBuffer,de.segments)}})(t,0,o,c,f):d.cs(o)&&(function(y,b,w,S){const{isRenderingGlobe:P}=S,E=y.context,C=w.implementation,z=y.style.projection,F=y.transform,V=F.getProjectionDataForCustomLayer(P),j={farZ:F.farZ,nearZ:F.nearZ,fov:F.fov*Math.PI/180,modelViewProjectionMatrix:F.modelViewProjectionMatrix,projectionMatrix:F.projectionMatrix,shaderData:{variantName:z.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
807
- uniform mat4 u_projection_matrix;
808
- ${z.shaderPreludeCode.vertexSource}`,define:z.shaderDefine},defaultProjectionData:V},N=C.renderingMode?C.renderingMode:"2d";if(y.renderPass==="offscreen"){const $=C.prerender;$&&(y.setCustomLayerDefaults(),E.setColorMode(y.colorModeForRenderPass()),$.call(C,E.gl,j),E.setDirty(),y.setBaseState())}else if(y.renderPass==="translucent"){y.setCustomLayerDefaults(),E.setColorMode(y.colorModeForRenderPass()),E.setStencilMode(qe.disabled);const $=N==="3d"?y.getDepthModeFor3D():y.getDepthModeForSublayer(0,Fe.ReadOnly);E.setDepthMode($),C.render(E.gl,j),E.setDirty(),y.setBaseState(),E.bindFramebuffer.set(null)}})(t,0,o,f))}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.length<js.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?n.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),o=this.imageManager.getPattern(t.to.toString());return!n||!o}useProgram(t,n,o=!1,c=[]){this.cache=this.cache||{};const f=!!this.style.map.terrain,y=this.style.projection,b=o?Mt.projectionMercator:y.shaderPreludeCode,w=o?bt:y.shaderDefine,S=t+(n?n.cacheKey:"")+`/${o?oc:y.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(f?"/terrain":"")+(c?`/${c.join("/")}`:"");return this.cache[S]||(this.cache[S]=new Nn(this.context,Mt[t],n,ju[t],this._showOverdrawInspector,f,b,w,c)),this.cache[S]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new d.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var t,n;if(this._tileTextures){for(const o in this._tileTextures){const c=this._tileTextures[o];if(c)for(const f of c)f.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&((t=this.tileExtentMesh.vertexBuffer)===null||t===void 0||t.destroy()),this.tileExtentMesh&&((n=this.tileExtentMesh.indexBuffer)===null||n===void 0||n.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(const o in this.cache){const c=this.cache[o];c&&c.program&&this.context.gl.deleteProgram(c.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}function fl(p,t){let n,o=!1,c=null,f=null;const y=()=>{c=null,o&&(p.apply(f,n),c=setTimeout(y,t),o=!1)};return(...b)=>(o=!0,f=this,n=b,c||y(),c)}js.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50;class ml{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let o;return n.split("&").map((c=>c.split("="))).forEach((c=>{c[0]===this._hashName&&(o=c)})),(o&&o[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(!this._isValidHash(n))return!1;const o=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:o,pitch:+(n[4]||0)}),!0},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{const n=this._getCurrentHash();if(n.length===0)return;const o=n.join("/");let c=o;c.split("&").length>0&&(c=c.split("&")[0]),this._hashName&&(c=`${this._hashName}=${o}`);let f=window.location.hash.replace(c,"");f.startsWith("#&")?f=f.slice(0,1)+f.slice(2):f==="#"&&(f="");let y=window.location.href.replace(/(#.+)?$/,f);y=y.replace("&&","&"),window.history.replaceState(window.history.state,null,y)},this._updateHash=fl(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){const n=this._map.getCenter(),o=Math.round(100*this._map.getZoom())/100,c=Math.ceil((o*Math.LN2+Math.log(512/360/.5))/Math.LN10),f=Math.pow(10,c),y=Math.round(n.lng*f)/f,b=Math.round(n.lat*f)/f,w=this._map.getBearing(),S=this._map.getPitch();let P="";if(P+=t?`/${y}/${b}/${o}`:`${o}/${b}/${y}`,(w||S)&&(P+="/"+Math.round(10*w)/10),S&&(P+=`/${Math.round(S)}`),this._hashName){const E=this._hashName;let C=!1;const z=window.location.hash.slice(1).split("&").map((F=>{const V=F.split("=")[0];return V===E?(C=!0,`${V}=${P}`):F})).filter((F=>F));return C||z.push(`${E}=${P}`),`#${z.join("&")}`}return`#${P}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new d.V(+t[2],+t[1])}catch{return!1}const n=+t[0],o=+(t[3]||0),c=+(t[4]||0);return n>=this._map.getMinZoom()&&n<=this._map.getMaxZoom()&&o>=-180&&o<=180&&c>=this._map.getMinPitch()&&c<=this._map.getMaxPitch()}}const Xn={linearity:.3,easing:d.ct(0,0,.3,1)},Fc=d.e({deceleration:2500,maxSpeed:1400},Xn),Ua=d.e({deceleration:20,maxSpeed:1400},Xn),Lc=d.e({deceleration:1e3,maxSpeed:360},Xn),Ni=d.e({deceleration:1e3,maxSpeed:90},Xn),Ki=d.e({deceleration:1e3,maxSpeed:360},Xn);class Bc{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Ze(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=Ze();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,roll:0,pan:new d.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:f}of this._inertiaBuffer)n.zoom+=f.zoomDelta||0,n.bearing+=f.bearingDelta||0,n.pitch+=f.pitchDelta||0,n.roll+=f.rollDelta||0,f.panDelta&&n.pan._add(f.panDelta),f.around&&(n.around=f.around),f.pinchAround&&(n.pinchAround=f.pinchAround);const o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,c={};if(n.pan.mag()){const f=Ns(n.pan.mag(),o,d.e({},Fc,t||{})),y=n.pan.mult(f.amount/n.pan.mag()),b=this._map.cameraHelper.handlePanInertia(y,this._map.transform);c.center=b.easingCenter,c.offset=b.easingOffset,di(c,f)}if(n.zoom){const f=Ns(n.zoom,o,Ua),y=d.cu(this._map.transform.zoom+f.amount,this._map.getZoomSnap(),f.amount);c.zoom=y,di(c,f)}if(n.bearing){const f=Ns(n.bearing,o,Lc);c.bearing=this._map.transform.bearing+d.ak(f.amount,-179,179),di(c,f)}if(n.pitch){const f=Ns(n.pitch,o,Ni);c.pitch=this._map.transform.pitch+f.amount,di(c,f)}if(n.roll){const f=Ns(n.roll,o,Ki);c.roll=this._map.transform.roll+d.ak(f.amount,-179,179),di(c,f)}if(c.zoom||c.bearing){const f=n.pinchAround===void 0?n.around:n.pinchAround;c.around=f?this._map.unproject(f):this._map.getCenter()}return this.clear(),d.e(c,{noMoveStart:!0})}}function di(p,t){(!p.duration||p.duration<t.duration)&&(p.duration=t.duration,p.easing=t.easing)}function Ns(p,t,n){const{maxSpeed:o,linearity:c,deceleration:f}=n,y=d.ak(p*c/(t/1e3),-o,o),b=Math.abs(y)/(f*c);return{easing:n.easing,duration:1e3*b,amount:y*(b/2)}}class Ci extends d.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o,c={}){o=o instanceof MouseEvent?o:new MouseEvent(t,o);const f=ge.mousePos(n.getCanvas(),o),y=n.unproject(f);super(t,d.e({point:f,lngLat:y,originalEvent:o},c)),this._defaultPrevented=!1,this.target=n}}class Us extends d.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){const c=t==="touchend"?o.changedTouches:o.touches,f=ge.touchPos(n.getCanvasContainer(),c),y=f.map((w=>n.unproject(w))),b=f.reduce(((w,S,P,E)=>w.add(S.div(E.length))),new d.P(0,0));super(t,{points:f,point:b,lngLats:y,lngLat:n.unproject(b),originalEvent:o}),this._defaultPrevented=!1}}class dn extends d.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){super(t,{originalEvent:o}),this._defaultPrevented=!1}}class Yu{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new dn(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Ci(t.type,this._map,t))}mouseup(t){this._map.fire(new Ci(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Ci(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ci(t.type,this._map,t))}mouseover(t){this._map.fire(new Ci(t.type,this._map,t))}mouseout(t){this._map.fire(new Ci(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Us(t.type,this._map,t))}touchmove(t){this._map.fire(new Us(t.type,this._map,t))}touchend(t){this._map.fire(new Us(t.type,this._map,t))}touchcancel(t){this._map.fire(new Us(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ku{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ci(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ci("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ci(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Gs{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.screenPointToLocation(d.P.convert(t),this._map.terrain)}}class Oc{constructor(t,n){this._map=t,this._tr=new Gs(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1,n.boxZoom&&typeof n.boxZoom=="object"&&(this._boxZoomEnd=n.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(ge.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const o=n;if(this._lastPos.equals(o)||!this._box&&o.dist(this._startPos)<this._clickTolerance)return;const c=this._startPos;this._lastPos=o,this._box||(this._box=ge.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const f=Math.min(c.x,o.x),y=Math.max(c.x,o.x),b=Math.min(c.y,o.y),w=Math.max(c.y,o.y);this._box.style.transform=`translate(${f}px,${b}px)`,this._box.style.width=y-f+"px",this._box.style.height=w-b+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const o=this._startPos,c=n;if(this.reset(),ge.suppressClick(),o.x!==c.x||o.y!==c.y)return this._map.fire(new d.l("boxzoomend",{originalEvent:t})),this._boxZoomEnd?void this._boxZoomEnd(this._map,o,c,t):{cameraAnimation:f=>f.fitScreenCoordinates(o,c,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box.remove(),this._box=null),ge.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new d.l(t,{originalEvent:n}))}}function Ga(p,t){if(p.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${p.length}, points ${t.length}`);const n={};for(let o=0;o<p.length;o++)n[p[o].identifier]=t[o];return n}class $s{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,o){(this.centroid||o.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),o.length===this.numTouches&&(this.centroid=(function(c){const f=new d.P(0,0);for(const y of c)f._add(y);return f.div(c.length)})(n),this.touches=Ga(o,n)))}touchmove(t,n,o){if(this.aborted||!this.centroid)return;const c=Ga(o,n);for(const f in this.touches){const y=c[f];(!y||y.dist(this.touches[f])>30)&&(this.aborted=!0)}}touchend(t,n,o){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),o.length===0){const c=!this.aborted&&this.centroid;if(this.reset(),c)return c}}}class Ji{constructor(t){this.singleTap=new $s(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,o){this.singleTap.touchstart(t,n,o)}touchmove(t,n,o){this.singleTap.touchmove(t,n,o)}touchend(t,n,o){const c=this.singleTap.touchend(t,n,o);if(c){const f=t.timeStamp-this.lastTime<500,y=!this.lastTap||this.lastTap.dist(c)<30;if(f&&y||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=c,this.count===this.numTaps)return this.reset(),c}}}class Se{constructor(t){this._tr=new Gs(t),this._zoomIn=new Ji({numTouches:1,numTaps:2}),this._zoomOut=new Ji({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,o){this._zoomIn.touchstart(t,n,o),this._zoomOut.touchstart(t,n,o)}touchmove(t,n,o){this._zoomIn.touchmove(t,n,o),this._zoomOut.touchmove(t,n,o)}touchend(t,n,o){const c=this._zoomIn.touchend(t,n,o),f=this._zoomOut.touchend(t,n,o),y=this._tr;return c?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:b=>b.easeTo({duration:300,zoom:d.cu(y.zoom+1,b.getZoomSnap()),around:y.unproject(c)},{originalEvent:t})}):f?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:b=>b.easeTo({duration:300,zoom:d.cu(y.zoom-1,b.getZoomSnap()),around:y.unproject(f)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Hn{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.rollDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(n)?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const o=this._lastPoint;if(!o)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const c=Array.isArray(n)?n[0]:n;return!this._moved&&c.dist(o)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=c,this._move(o,c))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&ge.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const gl=0,Vc=2,Zs={[gl]:1,[Vc]:2};class dr{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){this._eventButton=t.button}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!(function(n,o){const c=Zs[o];return n.buttons===void 0||(n.buttons&c)!==c})(t,this._eventButton)}isValidEndEvent(t){return t.button===this._eventButton}}class _l{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}class Ju{constructor(t=new dr({checkCorrectEvent:()=>!0}),n=new _l){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=n}_executeRelevantHandler(t,n,o){return t instanceof MouseEvent?n(t):typeof TouchEvent<"u"&&t instanceof TouchEvent?o(t):void 0}startMove(t){this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.startMove(n)),(n=>this.oneFingerTouchMoveStateManager.startMove(n)))}endMove(t){this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.endMove(n)),(n=>this.oneFingerTouchMoveStateManager.endMove(n)))}isValidStartEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidStartEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidStartEvent(n)))}isValidMoveEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidMoveEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(n)))}isValidEndEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidEndEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidEndEvent(n)))}}const Yn=p=>{p.mousedown=p.dragStart,p.mousemoveWindow=p.dragMove,p.mouseup=p.dragEnd,p.contextmenu=t=>{t.preventDefault()}};class jc{constructor(t,n){this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new d.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,n,o){return this._calculateTransform(t,n,o)}touchmove(t,n,o){if(this._active){if(!this._shouldBePrevented(o.length))return t.preventDefault(),this._calculateTransform(t,n,o);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,n,o){this._calculateTransform(t,n,o),this._active&&this._shouldBePrevented(o.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,o){o.length>0&&(this._active=!0);const c=Ga(o,n),f=new d.P(0,0),y=new d.P(0,0);let b=0;for(const S in c){const P=c[S],E=this._touches[S];E&&(f._add(P),y._add(P.sub(E)),b++,c[S]=P)}if(this._touches=c,this._shouldBePrevented(b)||!y.mag())return;const w=y.div(b);return this._sum._add(w),this._sum.mag()<this._clickTolerance?void 0:{around:f.div(b),panDelta:w}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qs{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,n,o){this._firstTwoTouches||o.length<2||(this._firstTwoTouches=[o[0].identifier,o[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,o){if(!this._firstTwoTouches)return;t.preventDefault();const[c,f]=this._firstTwoTouches,y=$a(o,n,c),b=$a(o,n,f);if(!y||!b)return;const w=this._aroundCenter?null:y.add(b).div(2);return this._move([y,b],w,t)}touchend(t,n,o){if(!this._firstTwoTouches)return;const[c,f]=this._firstTwoTouches,y=$a(o,n,c),b=$a(o,n,f);y&&b||(this._active&&ge.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function $a(p,t,n){for(let o=0;o<p.length;o++)if(p[o].identifier===n)return t[o]}function yl(p,t){return Math.log(p/t)/Math.LN2}class Nc extends qs{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const o=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(yl(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:yl(this._distance,o),pinchAround:n}}}function Uc(p,t){return 180*p.angleWith(t)/Math.PI}class xl extends qs{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n,o){const c=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Uc(this._vector,c),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,o=Uc(t,this._startVector);return Math.abs(o)<n}}function vl(p){return Math.abs(p.y)>Math.abs(p.x)}class bl extends qs{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,o){super.touchstart(t,n,o),this._currentTouchCount=o.length}_start(t){this._lastPoints=t,vl(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,o){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const c=t[0].sub(this._lastPoints[0]),f=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(c,f,o.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(c.y+f.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,o){if(this._valid!==void 0)return this._valid;const c=t.mag()>=2,f=n.mag()>=2;if(!c&&!f)return;if(!c||!f)return this._firstMove===void 0&&(this._firstMove=o),o-this._firstMove<100&&void 0;const y=t.y>0==n.y>0;return vl(t)&&vl(n)&&y}}const Qu={panStep:100,bearingStep:15,pitchStep:10};class Gc{constructor(t){this._tr=new Gs(t);const n=Qu;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,o=0,c=0,f=0,y=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?o=-1:(t.preventDefault(),f=-1);break;case 39:t.shiftKey?o=1:(t.preventDefault(),f=1);break;case 38:t.shiftKey?c=1:(t.preventDefault(),y=-1);break;case 40:t.shiftKey?c=-1:(t.preventDefault(),y=1);break;default:return}return this._rotationDisabled&&(o=0,c=0),{cameraAnimation:b=>{const w=this._tr;b.easeTo({duration:300,easeId:"keyboardHandler",easing:Br,zoom:n?d.cu(w.zoom+n*(t.shiftKey?2:1),b.getZoomSnap()):w.zoom,bearing:w.bearing+o*this._bearingStep,pitch:w.pitch+c*this._pitchStep,offset:[-f*this._panStep,-y*this._panStep],center:w.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Br(p){return p*(2-p)}const nt=4.000244140625,eh=1/450;class Ws{constructor(t,n){this._onTimeout=o=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(o)},this._map=t,this._tr=new Gs(t),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=eh}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const o=Ze(),c=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,n!==0&&n%nt==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":c>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(c*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=ge.mousePos(this._map.getCanvas(),t),o=this._tr;this._aroundPoint=this._aroundCenter?o.transform.locationToScreenPoint(d.V.convert(o.center)):n,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const b=t.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=b),typeof this._targetZoom=="number"&&(this._targetZoom+=b)}if(this._delta!==0){const b=this._type==="wheel"&&Math.abs(this._delta)>nt?this._wheelZoomRate:this._defaultZoomRate;let w=2/(1+Math.exp(-Math.abs(this._delta*b)));this._delta<0&&w!==0&&(w=1/w);const S=typeof this._targetZoom!="number"?t.scale:d.an(this._targetZoom),P=t.applyConstrain(t.getCameraLngLat(),d.aq(S*w)).zoom,E=this._map.getZoomSnap();if(this._type==="wheel"&&E>0){const C=d.cu(t.zoom,E);this._targetZoom=d.cu(P,E,P-C)}else this._targetZoom=P;this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom!="number"?t.zoom:this._targetZoom,o=this._startZoom,c=this._easing;let f,y=!1;if(this._type==="wheel"&&o&&c){const b=Ze()-this._lastWheelEventTime,w=Math.min((b+5)/200,1),S=c(w);f=d.G.number(o,n,S),w<1?this._frameId||(this._frameId=!0):y=!0}else f=n,y=!0;return this._active=!0,y&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=f,{noInertia:!0,needsRenderFrame:!y,zoomDelta:f-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=d.cw;if(this._prevEase){const o=this._prevEase,c=(Ze()-o.start)/o.duration,f=o.easing(c+.01)-o.easing(c),y=.27/Math.sqrt(f*f+1e-4)*.01,b=Math.sqrt(.0729-y*y);n=d.ct(y,b,.25,1)}return this._prevEase={start:Ze(),duration:t,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Xs{constructor(t,n){this._clickZoom=t,this._tapZoom=n}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class wl{constructor(t){this._tr=new Gs(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:o=>{o.easeTo({duration:300,zoom:d.cu(this._tr.zoom+(t.shiftKey?-1:1),o.getZoomSnap()),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $c{constructor(){this._tap=new Ji({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,o){if(!this._swipePoint)if(this._tapTime){const c=n[0],f=t.timeStamp-this._tapTime<500,y=this._tapPoint.dist(c)<30;f&&y?o.length>0&&(this._swipePoint=c,this._swipeTouch=o[0].identifier):this.reset()}else this._tap.touchstart(t,n,o)}touchmove(t,n,o){if(this._tapTime){if(this._swipePoint){if(o[0].identifier!==this._swipeTouch)return;const c=n[0],f=c.y-this._swipePoint.y;return this._swipePoint=c,t.preventDefault(),this._active=!0,{zoomDelta:f/128}}}else this._tap.touchmove(t,n,o)}touchend(t,n,o){if(this._tapTime)this._swipePoint&&o.length===0&&this.reset();else{const c=this._tap.touchend(t,n,o);c&&(this._tapTime=t.timeStamp,this._tapPoint=c)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Tl{constructor(t,n,o){this._el=t,this._mousePan=n,this._touchPan=o}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Sl{constructor(t,n,o,c){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=n,this._mousePitch=o,this._mouseRoll=c}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Zc{constructor(t,n,o,c){this._el=t,this._touchZoom=n,this._touchRotate=o,this._tapDragZoom=c,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Qi{constructor(t,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=t,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=ge.create("div","maplibregl-cooperative-gesture-screen",t);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const o=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),c=document.createElement("div");c.className="maplibregl-desktop-message",c.textContent=n,this._container.appendChild(c);const f=document.createElement("div");f.className="maplibregl-mobile-message",f.textContent=o,this._container.appendChild(f),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,n){this._enabled&&(this._map.fire(new d.l("cooperativegestureprevented",{gestureType:t,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const pn=p=>p.zoom||p.drag||p.roll||p.pitch||p.rotate;class Ie extends d.l{}function Ce(p){return p.panDelta&&p.panDelta.mag()||p.zoomDelta||p.bearingDelta||p.pitchDelta||p.rollDelta}class Hs{get _ownerDocument(){var t;return((t=this._el)===null||t===void 0?void 0:t.ownerDocument)||document}get _ownerWindow(){var t,n;return((n=(t=this._el)===null||t===void 0?void 0:t.ownerDocument)===null||n===void 0?void 0:n.defaultView)||window}constructor(t,n){this.handleWindowEvent=c=>{this.handleEvent(c,`${c.type}Window`)},this.handleEvent=(c,f)=>{if(c.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const y=c.type==="renderFrame"?void 0:c,b={needsRenderFrame:!1},w={},S={};for(const{handlerName:C,handler:z,allowed:F}of this._handlers){if(!z.isEnabled())continue;let V;if(this._blockedByActive(S,F,C))z.reset();else if(z[f||c.type]){if(d.cx(c,f||c.type)){const j=ge.mousePos(this._map.getCanvas(),c);V=z[f||c.type](c,j)}else if(d.cy(c,f||c.type)){const j=this._getMapTouches(c.touches),N=ge.touchPos(this._map.getCanvas(),j);V=z[f||c.type](c,N,j)}else d.cz(f||c.type)||(V=z[f||c.type](c));this.mergeHandlerResult(b,w,V,C,y),V&&V.needsRenderFrame&&this._triggerRenderFrame()}(V||z.isActive())&&(S[C]=z)}const P={};for(const C in this._previousActiveHandlers)S[C]||(P[C]=y);this._previousActiveHandlers=S,(Object.keys(P).length||Ce(b))&&(this._changes.push([b,w,P]),this._triggerRenderFrame()),(Object.keys(S).length||Ce(b))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:E}=b;E&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],E(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Bc(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const o=this._el;this._listeners=[[o,"touchstart",{passive:!0}],[o,"touchmove",{passive:!1}],[o,"touchend",void 0],[o,"touchcancel",void 0],[o,"mousedown",void 0],[o,"mousemove",void 0],[o,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[o,"mouseover",void 0],[o,"mouseout",void 0],[o,"dblclick",void 0],[o,"click",void 0],[o,"keydown",{capture:!1}],[o,"keyup",void 0],[o,"wheel",{passive:!1}],[o,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(const[c,f,y]of this._listeners)c.addEventListener(f,c===this._ownerDocument?this.handleWindowEvent:this.handleEvent,y)}destroy(){for(const[t,n,o]of this._listeners)t.removeEventListener(n,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,o)}_addDefaultHandlers(t){const n=this._map,o=n.getCanvasContainer();this._add("mapEvent",new Yu(n,t));const c=n.boxZoom=new Oc(n,t);this._add("boxZoom",c),t.interactive&&t.boxZoom&&c.enable();const f=n.cooperativeGestures=new Qi(n,t.cooperativeGestures);this._add("cooperativeGestures",f),t.cooperativeGestures&&f.enable();const y=new Se(n),b=new wl(n);n.doubleClickZoom=new Xs(b,y),this._add("tapZoom",y),this._add("clickZoom",b),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const w=new $c;this._add("tapDragZoom",w);const S=n.touchPitch=new bl(n);this._add("touchPitch",S),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const P=()=>n.project(n.getCenter()),E=(function({enable:G,clickTolerance:q,aroundCenter:Y=!0,minPixelCenterThreshold:Z=100,rotateDegreesPerPixelMoved:Q=.8},ae){const oe=new dr({checkCorrectEvent:ie=>ie.button===0&&ie.ctrlKey||ie.button===2&&!ie.ctrlKey});return new Hn({clickTolerance:q,move:(ie,ne)=>{const pe=ae();if(Y&&Math.abs(pe.y-ie.y)>Z)return{bearingDelta:d.cv(new d.P(ie.x,ne.y),ne,pe)};let fe=(ne.x-ie.x)*Q;return Y&&ne.y<pe.y&&(fe=-fe),{bearingDelta:fe}},moveStateManager:oe,enable:G,assignEvents:Yn})})(t,P),C=(function({enable:G,clickTolerance:q,pitchDegreesPerPixelMoved:Y=-.5}){const Z=new dr({checkCorrectEvent:Q=>Q.button===0&&Q.ctrlKey||Q.button===2});return new Hn({clickTolerance:q,move:(Q,ae)=>({pitchDelta:(ae.y-Q.y)*Y}),moveStateManager:Z,enable:G,assignEvents:Yn})})(t),z=(function({enable:G,clickTolerance:q,rollDegreesPerPixelMoved:Y=.3},Z){const Q=new dr({checkCorrectEvent:ae=>ae.button===2&&ae.ctrlKey});return new Hn({clickTolerance:q,move:(ae,oe)=>{const ie=Z();let ne=(oe.x-ae.x)*Y;return oe.y<ie.y&&(ne=-ne),{rollDelta:ne}},moveStateManager:Q,enable:G,assignEvents:Yn})})(t,P);n.dragRotate=new Sl(t,E,C,z),this._add("mouseRotate",E,["mousePitch"]),this._add("mousePitch",C,["mouseRotate","mouseRoll"]),this._add("mouseRoll",z,["mousePitch"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const F=(function({enable:G,clickTolerance:q}){const Y=new dr({checkCorrectEvent:Z=>Z.button===0&&!Z.ctrlKey});return new Hn({clickTolerance:q,move:(Z,Q)=>({around:Q,panDelta:Q.sub(Z)}),activateOnStart:!0,moveStateManager:Y,enable:G,assignEvents:Yn})})(t),V=new jc(t,n);n.dragPan=new Tl(o,F,V),this._add("mousePan",F),this._add("touchPan",V,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const j=new xl,N=new Nc;n.touchZoomRotate=new Zc(o,N,j,w),this._add("touchRotate",j,["touchPan","touchZoom"]),this._add("touchZoom",N,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new Ku(n));const $=n.scrollZoom=new Ws(n,(()=>this._triggerRenderFrame()));this._add("scrollZoom",$,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const W=n.keyboard=new Gc(n);this._add("keyboard",W),t.interactive&&t.keyboard&&n.keyboard.enable()}_add(t,n,o){this._handlers.push({handlerName:t,handler:n,allowed:o}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!pn(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,o){for(const c in t)if(c!==o&&(!n||n.indexOf(c)<0))return!0;return!1}_getMapTouches(t){const n=[];for(const o of t)this._el.contains(o.target)&&n.push(o);return n}mergeHandlerResult(t,n,o,c,f){if(!o)return;d.e(t,o);const y={handlerName:c,originalEvent:o.originalEvent||f};o.zoomDelta!==void 0&&(n.zoom=y),o.panDelta!==void 0&&(n.drag=y),o.rollDelta!==void 0&&(n.roll=y),o.pitchDelta!==void 0&&(n.pitch=y),o.bearingDelta!==void 0&&(n.rotate=y)}_applyChanges(){const t={},n={},o={};for(const[c,f,y]of this._changes)c.panDelta&&(t.panDelta=(t.panDelta||new d.P(0,0))._add(c.panDelta)),c.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+c.zoomDelta),c.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+c.bearingDelta),c.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+c.pitchDelta),c.rollDelta&&(t.rollDelta=(t.rollDelta||0)+c.rollDelta),c.around!==void 0&&(t.around=c.around),c.pinchAround!==void 0&&(t.pinchAround=c.pinchAround),c.noInertia&&(t.noInertia=c.noInertia),d.e(n,f),d.e(o,y);this._updateMapTransform(t,n,o),this._changes=[]}_updateMapTransform(t,n,o){const c=this._map,f=c._getTransformForUpdate(),y=c.terrain;if(!(Ce(t)||y&&this._terrainMovement))return this._fireEvents(n,o,!0);c._stop(!0);let{panDelta:b,zoomDelta:w,bearingDelta:S,pitchDelta:P,rollDelta:E,around:C,pinchAround:z}=t;z!==void 0&&(C=z),C=C||c.transform.centerPoint,y&&!f.isPointOnMapSurface(C)&&(C=f.centerPoint);const F={panDelta:b,zoomDelta:w,rollDelta:E,pitchDelta:P,bearingDelta:S,around:C};this._map.cameraHelper.useGlobeControls&&!f.isPointOnMapSurface(C)&&(C=f.centerPoint);const V=C.distSqr(f.centerPoint)<.01?f.center:f.screenPointToLocation(b?C.sub(b):C);this._handleMapControls({terrain:y,tr:f,deltasForHelper:F,preZoomAroundLoc:V,combinedEventsInProgress:n,panDelta:b}),c._applyUpdatedTransform(f),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,o,!0)}_handleMapControls({terrain:t,tr:n,deltasForHelper:o,preZoomAroundLoc:c,combinedEventsInProgress:f,panDelta:y}){const b=this._map.cameraHelper;if(b.handleMapControlsRollPitchBearingZoom(o,n),t)return b.useGlobeControls?(this._terrainMovement||!f.drag&&!f.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void b.handleMapControlsPan(o,n,c)):this._terrainMovement||!f.drag&&!f.zoom?void(f.drag&&this._terrainMovement&&y?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(y))):b.handleMapControlsPan(o,n,c)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void b.handleMapControlsPan(o,n,c));b.handleMapControlsPan(o,n,c)}_fireEvents(t,n,o){const c=pn(this._eventsInProgress),f=pn(t),y={};for(const E in t){const{originalEvent:C}=t[E];this._eventsInProgress[E]||(y[`${E}start`]=C),this._eventsInProgress[E]=t[E]}!c&&f&&this._fireEvent("movestart",f.originalEvent);for(const E in y)this._fireEvent(E,y[E]);f&&this._fireEvent("move",f.originalEvent);for(const E in t){const{originalEvent:C}=t[E];this._fireEvent(E,C)}const b={};let w;for(const E in this._eventsInProgress){const{handlerName:C,originalEvent:z}=this._eventsInProgress[E];this._handlersById[C].isActive()||(delete this._eventsInProgress[E],w=n[C]||z,b[`${E}end`]=w)}for(const E in b)this._fireEvent(E,b[E]);const S=pn(this._eventsInProgress),P=(c||f)&&!S;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const E=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&E.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(E)}if(o&&P){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),C=z=>z!==0&&-this._bearingSnap<z&&z<this._bearingSnap;!E||!E.essential&&Kt.prefersReducedMotion?(this._map.fire(new d.l("moveend",{originalEvent:w})),C(this._map.getBearing())&&this._map.resetNorth()):(C(E.bearing||this._map.getBearing())&&(E.bearing=0),E.freezeElevation=!0,this._map.easeTo(E,{originalEvent:w})),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new d.l(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new Ie("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class qc extends d.E{constructor(t,n,o){super(),this._renderFrameCallback=()=>{const c=Math.min((Ze()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(c)),c<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=o.bearingSnap,this._zoomSnap=o.zoomSnap,this.cameraHelper=n,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(t,n){t.apply(this.transform,!0),this.transform=t,this.cameraHelper=n}getCenter(){return new d.V(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,n){return this.jumpTo({elevation:t},n),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,n,o){return t=d.P.convert(t).mult(-1),this.panTo(this.transform.center,d.e({offset:t},n),o)}panTo(t,n,o){return this.easeTo(d.e({center:t},n),o)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,o){return this.easeTo(d.e({zoom:t},n),o)}zoomIn(t,n){return this.zoomTo(d.cu(this.getZoom()+1,this._zoomSnap),t,n),this}zoomOut(t,n){return this.zoomTo(d.cu(this.getZoom()-1,this._zoomSnap),t,n),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,n){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new d.l("movestart",n)).fire(new d.l("move",n)).fire(new d.l("moveend",n))),this}getBearing(){return this.transform.bearing}setZoomSnap(t){return this._zoomSnap=t,this}getZoomSnap(){return this._zoomSnap}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,o){return this.easeTo(d.e({bearing:t},n),o)}resetNorth(t,n){return this.rotateTo(0,d.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(d.e({bearing:0,pitch:0,roll:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}getRoll(){return this.transform.roll}setRoll(t,n){return this.jumpTo({roll:t},n),this}cameraForBounds(t,n){t=xt.convert(t).adjustAntiMeridian();const o=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),o,n)}_cameraForBoxAndBearing(t,n,o,c){const f={top:0,bottom:0,right:0,left:0};if(typeof(c=d.e({padding:f,offset:[0,0],maxZoom:this.transform.maxZoom},c)).padding=="number"){const S=c.padding;c.padding={top:S,bottom:S,right:S,left:S}}const y=d.e(f,c.padding);c.padding=y;const b=this.transform,w=new xt(t,n);return this.cameraHelper.cameraForBoxAndBearing(c,y,w,o,b)}fitBounds(t,n,o){return this._fitInternal(this.cameraForBounds(t,n),n,o)}fitScreenCoordinates(t,n,o,c,f){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(d.P.convert(t)),this.transform.screenPointToLocation(d.P.convert(n)),o,c),c,f)}_fitInternal(t,n,o){return t?(delete(n=d.e(t,n)).padding,n.linear?this.easeTo(n,o):this.flyTo(n,o)):this}jumpTo(t,n){this.stop();const o=this._getTransformForUpdate();let c=!1,f=!1,y=!1;const b=o.zoom;this.terrain&&o.setElevation(this.terrain.getElevationForLngLatZoom(t.center?d.V.convert(t.center):o.center,t.zoom||o.tileZoom)),this.cameraHelper.handleJumpToCenterZoom(o,t);const w=o.zoom!==b;return"elevation"in t&&o.elevation!==+t.elevation&&o.setElevation(+t.elevation),"bearing"in t&&o.bearing!==+t.bearing&&(c=!0,o.setBearing(+t.bearing)),"pitch"in t&&o.pitch!==+t.pitch&&(f=!0,o.setPitch(+t.pitch)),"roll"in t&&o.roll!==+t.roll&&(y=!0,o.setRoll(+t.roll)),t.padding==null||o.isPaddingEqual(t.padding)||o.setPadding(t.padding),this._applyUpdatedTransform(o),this.fire(new d.l("movestart",n)).fire(new d.l("move",n)),w&&this.fire(new d.l("zoomstart",n)).fire(new d.l("zoom",n)).fire(new d.l("zoomend",n)),c&&this.fire(new d.l("rotatestart",n)).fire(new d.l("rotate",n)).fire(new d.l("rotateend",n)),f&&this.fire(new d.l("pitchstart",n)).fire(new d.l("pitch",n)).fire(new d.l("pitchend",n)),y&&this.fire(new d.l("rollstart",n)).fire(new d.l("roll",n)).fire(new d.l("rollend",n)),this.fire(new d.l("moveend",n))}calculateCameraOptionsFromTo(t,n,o,c=0){const f=d.a6.fromLngLat(t,n),y=d.a6.fromLngLat(o,c),b=y.x-f.x,w=y.y-f.y,S=y.z-f.z,P=Math.hypot(b,w,S);if(P===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(b,w),C=d.aq(this.transform.cameraToCenterDistance/P/this.transform.tileSize),z=180*Math.atan2(b,-w)/Math.PI;let F=180*Math.acos(E/P)/Math.PI;return F=S<0?90-F:90+F,{center:y.toLngLat(),elevation:c,zoom:C,pitch:F,bearing:z}}calculateCameraOptionsFromCameraLngLatAltRotation(t,n,o,c,f){const y=this.transform.calculateCenterFromCameraLngLatAlt(t,n,o,c);return{center:y.center,elevation:y.elevation,zoom:y.zoom,bearing:o,pitch:c,roll:f}}easeTo(t,n){this._stop(!1,t.easeId),((t=d.e({offset:[0,0],duration:500,easing:d.cw},t)).animate===!1||!t.essential&&Kt.prefersReducedMotion)&&(t.duration=0);const o=this._getTransformForUpdate(),c=this.getBearing(),f=o.pitch,y=o.roll,b="bearing"in t?this._normalizeBearing(t.bearing,c):c,w="pitch"in t?+t.pitch:f,S="roll"in t?this._normalizeBearing(t.roll,y):y,P="padding"in t?t.padding:o.padding,E=d.P.convert(t.offset);let C,z;t.around&&(C=d.V.convert(t.around),z=o.locationToScreenPoint(C));const F={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},V=this.cameraHelper.handleEaseTo(o,{bearing:b,pitch:w,roll:S,padding:P,around:C,aroundPoint:z,offsetAsPoint:E,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating=this._rotating||c!==b,this._pitching=this._pitching||w!==f,this._rolling=this._rolling||S!==y,this._padding=!o.isPaddingEqual(P),this._zooming=this._zooming||V.isZooming,this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,F),this.terrain&&this._prepareElevation(V.elevationCenter),this._ease((j=>{V.easeFunc(j),this.terrain&&!t.freezeElevation&&this._updateElevation(j),this._applyUpdatedTransform(o),this._fireMoveEvents(n)}),(j=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,j)}),t),this}_prepareEase(t,n,o={}){this._moving=!0,n||o.moving||this.fire(new d.l("movestart",t)),this._zooming&&!o.zooming&&this.fire(new d.l("zoomstart",t)),this._rotating&&!o.rotating&&this.fire(new d.l("rotatestart",t)),this._pitching&&!o.pitching&&this.fire(new d.l("pitchstart",t)),this._rolling&&!o.rolling&&this.fire(new d.l("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this._elevationStart!==void 0&&this._elevationCenter!==void 0||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){const o=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(o-(n-(o*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.setElevation(d.G.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};const n=t.getCameraLngLat(),o=t.getCameraAltitude(),c=this.terrain?this.terrain.getElevationForLngLatZoom(n,t.zoom):0;if(o<c){const f=this.calculateCameraOptionsFromTo(n,c,t.center,t.elevation);return{pitch:f.pitch,zoom:f.zoom}}return{}}_applyUpdatedTransform(t){const n=[];if(n.push((c=>this._elevateCameraIfInsideTerrain(c))),this.transformCameraUpdate&&n.push((c=>this.transformCameraUpdate(c))),!n.length)return;const o=t.clone();for(const c of n){const f=o.clone(),{center:y,zoom:b,roll:w,pitch:S,bearing:P,elevation:E}=c(f);y&&f.setCenter(y),E!==void 0&&f.setElevation(E),b!==void 0&&f.setZoom(b),w!==void 0&&f.setRoll(w),S!==void 0&&f.setPitch(S),P!==void 0&&f.setBearing(P),o.apply(f,!1)}this.transform.apply(o,!1)}_fireMoveEvents(t){this.fire(new d.l("move",t)),this._zooming&&this.fire(new d.l("zoom",t)),this._rotating&&this.fire(new d.l("rotate",t)),this._pitching&&this.fire(new d.l("pitch",t)),this._rolling&&this.fire(new d.l("roll",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const o=this._zooming,c=this._rotating,f=this._pitching,y=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,o&&this.fire(new d.l("zoomend",t)),c&&this.fire(new d.l("rotateend",t)),f&&this.fire(new d.l("pitchend",t)),y&&this.fire(new d.l("rollend",t)),this.fire(new d.l("moveend",t))}flyTo(t,n){if(!t.essential&&Kt.prefersReducedMotion){const ne=d.U(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(ne,n)}this.stop(),t=d.e({offset:[0,0],speed:1.2,curve:1.42,easing:d.cw},t);const o=this._getTransformForUpdate(),c=o.bearing,f=o.pitch,y=o.roll,b=o.padding,w="bearing"in t?this._normalizeBearing(t.bearing,c):c,S="pitch"in t?+t.pitch:f,P="roll"in t?this._normalizeBearing(t.roll,y):y,E="padding"in t?t.padding:o.padding,C=d.P.convert(t.offset);let z=o.centerPoint.add(C);const F=o.screenPointToLocation(z),V=this.cameraHelper.handleFlyTo(o,{bearing:w,pitch:S,roll:P,padding:E,locationAtOffset:F,offsetAsPoint:C,center:t.center,minZoom:t.minZoom,zoom:t.zoom});let j=t.curve;const N=Math.max(o.width,o.height),$=N/V.scaleOfZoom,W=V.pixelPathLength;typeof V.scaleOfMinZoom=="number"&&(j=Math.sqrt(N/V.scaleOfMinZoom/W*2));const G=j*j;function q(ne){const pe=($*$-N*N+(ne?-1:1)*G*G*W*W)/(2*(ne?$:N)*G*W);return Math.log(Math.sqrt(pe*pe+1)-pe)}function Y(ne){return(Math.exp(ne)-Math.exp(-ne))/2}function Z(ne){return(Math.exp(ne)+Math.exp(-ne))/2}const Q=q(!1);let ae=function(ne){return Z(Q)/Z(Q+j*ne)},oe=function(ne){return N*((Z(Q)*(Y(pe=Q+j*ne)/Z(pe))-Y(Q))/G)/W;var pe},ie=(q(!0)-Q)/j;if(Math.abs(W)<2e-6||!isFinite(ie)){if(Math.abs(N-$)<1e-6)return this.easeTo(t,n);const ne=$<N?-1:1;ie=Math.abs(Math.log($/N))/j,oe=()=>0,ae=pe=>Math.exp(ne*j*pe)}return t.duration="duration"in t?+t.duration:1e3*ie/("screenSpeed"in t?+t.screenSpeed/j:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=c!==w,this._pitching=S!==f,this._rolling=P!==y,this._padding=!o.isPaddingEqual(E),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(V.targetCenter),this._ease((ne=>{const pe=ne*ie,fe=1/ae(pe),de=oe(pe);this._rotating&&o.setBearing(d.G.number(c,w,ne)),this._pitching&&o.setPitch(d.G.number(f,S,ne)),this._rolling&&o.setRoll(d.G.number(y,P,ne)),this._padding&&(o.interpolatePadding(b,E,ne),z=o.centerPoint.add(C)),V.easeFunc(ne,fe,de,z),this.terrain&&!t.freezeElevation&&this._updateElevation(ne),this._applyUpdatedTransform(o),this._fireMoveEvents(n)}),(()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n)}),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){var o;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const c=this._onEaseEnd;delete this._onEaseEnd,c.call(this,n)}return t||(o=this.handlers)===null||o===void 0||o.stop(!1),this}_ease(t,n,o){o.animate===!1||o.duration===0?(t(1),n()):(this._easeStart=Ze(),this._easeOptions=o,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=d.W(t,-180,180);const o=Math.abs(t-n);return Math.abs(t-360-n)<o&&(t-=360),Math.abs(t+360-n)<o&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(d.V.convert(t),this.transform):null}}const Ys={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class ni{constructor(t=Ys){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=ge.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ge.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ge.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,n){const o=this._map._getUIString(`AttributionControl.${n}`);t.title=o,t.setAttribute("aria-label",o)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((c=>typeof c!="string"?"":c))):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const c=this._map.style.stylesheet;this.styleOwner=c.owner,this.styleId=c.id}const n=this._map.style.tileManagers;for(const c in n){const f=n[c];if(f.used||f.usedForTerrain){const y=f.getSource();y.attribution&&t.indexOf(y.attribution)<0&&t.push(y.attribution)}}t=t.filter((c=>String(c).trim())),t.sort(((c,f)=>c.length-f.length)),t=t.filter(((c,f)=>{for(let y=f+1;y<t.length;y++)if(t[y].indexOf(c)>=0)return!1;return!0}));const o=t.join(" | ");o!==this._attribHTML&&(this._attribHTML=o,t.length?(this._innerContainer.innerHTML=ge.sanitize(o),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Ui{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const o=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&o.classList.add("maplibregl-compact"):o.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=ge.create("div","maplibregl-ctrl");const n=ge.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Wc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,o=n?this._queue.concat(n):this._queue;for(const c of o)if(c.id===t)return void(c.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const o of n)if(!o.cancelled&&(o.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var th=d.aS([{name:"a_pos3d",type:"Int16",components:3}]);class ih extends d.E{constructor(t){super(),this._lastTilesetChange=Ze(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(t,n){this.tileManager.update(t,n),this._renderableTilesKeys=[];const o={};for(const c of Kr(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n,calculateTileZoom:this.tileManager._source.calculateTileZoom}))o[c.key]=!0,this._renderableTilesKeys.push(c.key),this._tiles[c.key]||(c.terrainRttPosMatrix32f=new Float64Array(16),d.c5(c.terrainRttPosMatrix32f,0,d.a5,d.a5,0,0,1),this._tiles[c.key]=new En(c,this.tileSize),this._lastTilesetChange=Ze());for(const c in this._tiles)o[c]||delete this._tiles[c]}freeRtt(t){for(const n in this._tiles){const o=this._tiles[n];(!t||o.tileID.equals(t)||o.tileID.isChildOf(t)||t.isChildOf(o.tileID))&&(o.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,n){return n?this._getTerrainCoordsForTileRanges(t,n):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){const n={};for(const o of this._renderableTilesKeys){const c=this._tiles[o].tileID,f=t.clone(),y=d.bi();if(c.canonical.equals(t.canonical))d.c5(y,0,d.a5,d.a5,0,0,1);else if(c.canonical.isChildOf(t.canonical)){const b=c.canonical.z-t.canonical.z,w=c.canonical.x-(c.canonical.x>>b<<b),S=c.canonical.y-(c.canonical.y>>b<<b),P=d.a5>>b;d.c5(y,0,P,P,0,0,1),d.O(y,y,[-w*P,-S*P,0])}else{if(!t.canonical.isChildOf(c.canonical))continue;{const b=t.canonical.z-c.canonical.z,w=t.canonical.x-(t.canonical.x>>b<<b),S=t.canonical.y-(t.canonical.y>>b<<b),P=d.a5>>b;d.c5(y,0,d.a5,d.a5,0,0,1),d.O(y,y,[w*P,S*P,0]),d.Q(y,y,[1/2**b,1/2**b,0])}}f.terrainRttPosMatrix32f=new Float32Array(y),n[o]=f}return n}_getTerrainCoordsForTileRanges(t,n){const o={};for(const c of this._renderableTilesKeys){const f=this._tiles[c].tileID;if(!this._isWithinTileRanges(f,n))continue;const y=t.clone(),b=d.bi();if(f.canonical.z===t.canonical.z){const w=t.canonical.x-f.canonical.x+t.wrap*(1<<t.canonical.z),S=t.canonical.y-f.canonical.y;d.c5(b,0,d.a5,d.a5,0,0,1),d.O(b,b,[w*d.a5,S*d.a5,0])}else if(f.canonical.z>t.canonical.z){const w=f.canonical.z-t.canonical.z,S=f.canonical.x-(f.canonical.x>>w<<w)+t.wrap*(1<<f.canonical.z),P=f.canonical.y-(f.canonical.y>>w<<w),E=t.canonical.x-(f.canonical.x>>w),C=t.canonical.y-(f.canonical.y>>w),z=d.a5>>w;d.c5(b,0,z,z,0,0,1),d.O(b,b,[-S*z+E*d.a5,-P*z+C*d.a5,0])}else{const w=t.canonical.z-f.canonical.z,S=t.canonical.x-(t.canonical.x>>w<<w)+t.wrap*(1<<t.canonical.z),P=t.canonical.y-(t.canonical.y>>w<<w),E=(t.canonical.x>>w)-f.canonical.x,C=(t.canonical.y>>w)-f.canonical.y,z=d.a5<<w;d.c5(b,0,z,z,0,0,1),d.O(b,b,[S*d.a5+E*z,P*d.a5+C*z,0])}y.terrainRttPosMatrix32f=new Float32Array(b),o[c]=y}return o}getSourceTile(t,n){const o=this.tileManager._source;let c=t.overscaledZ-this.deltaZoom;if(c>o.maxzoom&&(c=o.maxzoom),c<o.minzoom)return;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(c).key);let f=this.findTileInCaches(this._sourceTileCache[t.key]);if(!f?.dem&&n)for(;c>=o.minzoom&&!f?.dem;)f=this.findTileInCaches(t.scaledTo(c--).key);return f}findTileInCaches(t){let n=this.tileManager.getTileByID(t);return n||(n=this.tileManager._outOfViewCache.getByKey(t),n)}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,n){const o=n[t.canonical.z];return!!o&&(t.wrap>o.minWrap||t.wrap<o.maxWrap||t.canonical.x>=o.minTileXWrapped&&t.canonical.x<=o.maxTileXWrapped&&t.canonical.y>=o.minTileY&&t.canonical.y<=o.maxTileY)}}class rh{constructor(t,n,o){this._meshCache={},this.painter=t,this.tileManager=new ih(n),this.options=o,this.exaggeration=typeof o.exaggeration=="number"?o.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}destroy(){this._fbo&&(this._fbo.destroy(),this._fbo=null),this._fboCoordsTexture&&(this._fboCoordsTexture.destroy(),this._fboCoordsTexture=null),this._fboDepthTexture&&(this._fboDepthTexture.destroy(),this._fboDepthTexture=null),this._emptyDemTexture&&(this._emptyDemTexture.destroy(),this._emptyDemTexture=null),this._emptyDepthTexture&&(this._emptyDepthTexture.destroy(),this._emptyDepthTexture=null),this._coordsTexture&&(this._coordsTexture.destroy(),this._coordsTexture=null);for(const t in this._meshCache)this._meshCache[t].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(t,n,o,c=d.a5){var f;const y=t.normalizeCoordinates(n,o,c);if(!y)return 0;const b=this.getTerrainData(y.tileID),w=(f=b.tile)===null||f===void 0?void 0:f.dem;if(!w)return 0;const S=d.cA([],[y.x/c*d.a5,y.y/c*d.a5],b.u_terrain_matrix),P=[S[0]*w.dim,S[1]*w.dim],E=Math.floor(P[0]),C=Math.floor(P[1]),z=P[0]-E,F=P[1]-C;return w.get(E,C)*(1-z)*(1-F)+w.get(E+1,C)*z*(1-F)+w.get(E,C+1)*(1-z)*F+w.get(E+1,C+1)*z*F}getElevationForLngLatZoom(t,n){if(!d.cB(n,t.wrap()))return 0;const{tileID:o,mercatorX:c,mercatorY:f}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(o,c%d.a5,f%d.a5,d.a5)}getElevationForLngLat(t,n){const o=Kr(n,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this});let c=0;for(const f of o)f.canonical.z>c&&(c=Math.min(f.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,c)}getElevation(t,n,o,c=d.a5){return this.getDEMElevation(t,n,o,c)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const c=this.painter.context,f=new d.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new d.T(c,f,c.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new d.T(c,new d.R({width:1,height:1}),c.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(c.gl.NEAREST,c.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=d.ao([])}const n=this.tileManager.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const c=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new d.T(c,n.dem.getPixels(),c.gl.RGBA,{premultiply:!1}),n.demTexture.bind(c.gl.NEAREST,c.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const o=n&&n.toString()+n.tileID.key+t.key;if(o&&!this._demMatrixCache[o]){const c=this.tileManager.getSource().maxzoom;let f=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=c?f=t.canonical.z-c:d.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const y=t.canonical.x-(t.canonical.x>>f<<f),b=t.canonical.y-(t.canonical.y>>f<<f),w=d.cC(new Float64Array(16),[1/(d.a5<<f),1/(d.a5<<f),0]);d.O(w,w,[y*d.a5,b*d.a5,0]),this._demMatrixCache[t.key]={matrix:w,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:o?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(t){const n=this.painter,o=n.width/devicePixelRatio,c=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===o&&this._fbo.height===c||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new d.T(n.context,{width:o,height:c,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new d.T(n.context,{width:o,height:c,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(o,c,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,o,c))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let f=0,y=0;f<this._coordsTextureSize;f++)for(let b=0;b<this._coordsTextureSize;b++,y+=4)n[y+0]=255&b,n[y+1]=255&f,n[y+2]=b>>8<<4|f>>8,n[y+3]=0;const o=new d.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),c=new d.T(t,o,t.gl.RGBA,{premultiply:!1});return c.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=c,c}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const n=new Uint8Array(4),o=this.painter.context,c=o.gl,f=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),y=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),b=Math.round(this.painter.height/devicePixelRatio);o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),c.readPixels(f,b-y-1,1,1,c.RGBA,c.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null);const w=n[0]+(n[2]>>4<<8),S=n[1]+((15&n[2])<<8),P=this.coordsIndex[255-n[3]],E=P&&this.tileManager.getTileByID(P);if(!E)return null;const C=this._coordsTextureSize,z=(1<<E.tileID.canonical.z)*C;return new d.a6((E.tileID.canonical.x*C+w)/z+E.tileID.wrap,(E.tileID.canonical.y*C+S)/z,this.getElevation(E.tileID,w,S,C))}depthAtPoint(t){const n=new Uint8Array(4),o=this.painter.context,c=o.gl;return o.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),c.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,c.RGBA,c.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(t){var n;const o=((n=this.painter.style.projection)===null||n===void 0?void 0:n.transitionState)>0,c=o&&t.canonical.y===0,f=o&&t.canonical.y===(1<<t.canonical.z)-1,y=`m_${c?"n":""}_${f?"s":""}`;if(this._meshCache[y])return this._meshCache[y];const b=this.painter.context,w=new d.cD,S=new d.aW,P=this.meshSize,E=d.a5/P,C=P*P;for(let Z=0;Z<=P;Z++)for(let Q=0;Q<=P;Q++)w.emplaceBack(Q*E,Z*E,0);for(let Z=0;Z<C;Z+=P+1)for(let Q=0;Q<P;Q++)S.emplaceBack(Q+Z,P+Q+Z+1,P+Q+Z+2),S.emplaceBack(Q+Z,P+Q+Z+2,Q+Z+1);const z=w.length,F=z+(P+1),V=(P+1)*P,j=c?d.bp:0,N=c?0:1,$=f?d.bq:d.a5,W=f?0:1;for(let Z=0;Z<=P;Z++)w.emplaceBack(Z*E,j,N);for(let Z=0;Z<=P;Z++)w.emplaceBack(Z*E,$,W);for(let Z=0;Z<P;Z++)S.emplaceBack(V+Z,F+Z,F+Z+1),S.emplaceBack(V+Z,F+Z+1,V+Z+1),S.emplaceBack(0+Z,z+Z+1,z+Z),S.emplaceBack(0+Z,0+Z+1,z+Z+1);const G=w.length,q=G+2*(P+1);for(const Z of[0,1])for(let Q=0;Q<=P;Q++)for(const ae of[0,1])w.emplaceBack(Z*d.a5,Q*E,ae);for(let Z=0;Z<2*P;Z+=2)S.emplaceBack(G+Z,G+Z+1,G+Z+3),S.emplaceBack(G+Z,G+Z+3,G+Z+2),S.emplaceBack(q+Z,q+Z+3,q+Z+1),S.emplaceBack(q+Z,q+Z+2,q+Z+3);const Y=new kt(b.createVertexBuffer(w,th.members),b.createIndexBuffer(S),d.aV.simpleSegment(0,0,w.length,S.length));return this._meshCache[y]=Y,Y}getMeshFrameDelta(t){return 2*Math.PI*d.bC/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,n){var o;if(!d.cB(n,t.wrap()))return 0;const{tileID:c}=this._getOverscaledTileIDFromLngLatZoom(t,n);return(o=this.getMinMaxElevation(c).minElevation)!==null&&o!==void 0?o:0}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,o={minElevation:null,maxElevation:null};return n&&n.dem&&(o.minElevation=n.dem.min*this.exaggeration,o.maxElevation=n.dem.max*this.exaggeration),o}_getOverscaledTileIDFromLngLatZoom(t,n){const o=d.a6.fromLngLat(t.wrap()),c=(1<<n)*d.a5,f=o.x*c,y=o.y*c,b=Math.floor(f/d.a5),w=Math.floor(y/d.a5);return{tileID:new d.a2(n,0,n,b,w),mercatorX:f,mercatorY:y}}}class Ks{constructor(t,n,o){this._context=t,this._size=n,this._tileSize=o,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),o=new d.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return o.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(o.texture),{id:t,fbo:n,texture:o,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((n=>t.id!==n)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some((t=>!t.inUse))===!1}}const st={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class Ct{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new Ks(t.context,30,n.tileManager.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){var o,c;this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter((f=>!t._layers[f].isHidden(n))),this._coordsAscending={};for(const f in t.tileManagers){this._coordsAscending[f]={};const y=t.tileManagers[f].getVisibleCoordinates(),b=t.tileManagers[f].getSource(),w=b instanceof Er?b.terrainTileRanges:null;for(const S of y){const P=this.terrain.tileManager.getTerrainCoords(S,w);for(const E in P)this._coordsAscending[f][E]||(this._coordsAscending[f][E]=[]),this._coordsAscending[f][E].push(P[E])}}this._rttFingerprints={};for(const f of t._order){const y=t._layers[f],b=y.source;if(st[y.type]&&!this._rttFingerprints[b]){this._rttFingerprints[b]={};const w=(c=(o=t.tileManagers[b])===null||o===void 0?void 0:o.getState().revision)!==null&&c!==void 0?c:0;for(const S in this._coordsAscending[b])this._rttFingerprints[b][S]=`${this._coordsAscending[b][S].map((P=>P.key)).sort().join()}#${w}`}}for(const f of this._renderableTiles)for(const y in this._rttFingerprints){const b=this._rttFingerprints[y][f.tileID.key];b&&b!==f.rttFingerprint[y]&&(f.rtt=[])}}renderLayer(t,n){if(t.isHidden(this.painter.transform.zoom))return!1;const o=Object.assign(Object.assign({},n),{isRenderingToTexture:!0}),c=t.type,f=this.painter,y=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(st[c]&&(this._prevType&&st[this._prevType]||this._stacks.push([]),this._prevType=c,this._stacks[this._stacks.length-1].push(t.id),!y))return!0;if(st[this._prevType]||st[c]&&y){this._prevType=c;const b=this._stacks.length-1,w=this._stacks[b]||[];for(const S of this._renderableTiles){if(this.pool.isFull()&&(dl(this.painter,this.terrain,this._rttTiles,o),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(S),S.rtt[b]){const E=this.pool.getObjectForId(S.rtt[b].id);if(E.stamp===S.rtt[b].stamp){this.pool.useObject(E);continue}}const P=this.pool.getOrCreateFreeObject();this.pool.useObject(P),this.pool.stampObject(P),S.rtt[b]={id:P.id,stamp:P.stamp},f.context.bindFramebuffer.set(P.fbo.framebuffer),f.context.clear({color:d.bn.transparent,stencil:0}),f.currentStencilSource=void 0;for(let E=0;E<w.length;E++){const C=f.style._layers[w[E]],z=C.source?this._coordsAscending[C.source][S.tileID.key]:[S.tileID];f.context.viewport.set([0,0,P.fbo.width,P.fbo.height]),f._renderTileClippingMasks(C,z,!0),f.renderLayer(f,f.style.tileManagers[C.source],C,z,o),C.source&&(S.rttFingerprint[C.source]=this._rttFingerprints[C.source][S.tileID.key])}}return dl(this.painter,this.terrain,this._rttTiles,o),this._rttTiles=[],this.pool.freeAllObjects(),st[c]}return!1}}const Xc={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Js=we,Qs={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:Ys,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:d.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0,anisotropicFilterPitch:20};let Za=class extends qc{get _ownerWindow(){var p,t;return((t=(p=this._container)===null||p===void 0?void 0:p.ownerDocument)===null||t===void 0?void 0:t.defaultView)||window}constructor(p){var t,n;d.cE.mark(d.cF.create);const o=Object.assign(Object.assign(Object.assign({},Qs),p),{canvasContextAttributes:Object.assign(Object.assign({},Qs.canvasContextAttributes),p.canvasContextAttributes)});if(o.minZoom!=null&&o.maxZoom!=null&&o.minZoom>o.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(o.minPitch!=null&&o.maxPitch!=null&&o.minPitch>o.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(o.minPitch!=null&&o.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(o.maxPitch!=null&&o.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const c=new lr,f=new ba;o.minZoom!==void 0&&c.setMinZoom(o.minZoom),o.maxZoom!==void 0&&c.setMaxZoom(o.maxZoom),o.minPitch!==void 0&&c.setMinPitch(o.minPitch),o.maxPitch!==void 0&&c.setMaxPitch(o.maxPitch),o.renderWorldCopies!==void 0&&c.setRenderWorldCopies(o.renderWorldCopies),o.transformConstrain!==null&&c.setConstrainOverride(o.transformConstrain),super(c,f,{bearingSnap:o.bearingSnap,zoomSnap:o.zoomSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Wc,this._controls=[],this._mapId=d.ac(),this._lostContextStyle={style:null,images:null},this._contextLost=b=>{if(b.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(const w of Object.values(this.style._layers))if(w.type==="custom"&&console.warn(`Custom layer with id '${w.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),w._listeners)for(const[S]of Object.entries(w._listeners))console.warn(`Custom layer with id '${w.id}' had event listeners for event '${S}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new d.l("webglcontextlost",{originalEvent:b}))}else this.fire(new d.l("webglcontextlost",{originalEvent:b}))},this._contextRestored=b=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new d.l("webglcontextrestored",{originalEvent:b}))},this._onMapScroll=b=>{if(b.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=o.interactive,this._maxTileCacheSize=o.maxTileCacheSize,this._maxTileCacheZoomLevels=o.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},o.canvasContextAttributes),this._trackResize=o.trackResize===!0,this._bearingSnap=o.bearingSnap,this._zoomSnap=o.zoomSnap,this._centerClampedToGround=o.centerClampedToGround,this._refreshExpiredTiles=o.refreshExpiredTiles===!0,this._fadeDuration=o.fadeDuration,this._crossSourceCollisions=o.crossSourceCollisions===!0,this._collectResourceTiming=o.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Xc),o.locale),this._clickTolerance=o.clickTolerance,this._overridePixelRatio=o.pixelRatio,this._maxCanvasSize=o.maxCanvasSize,this._zoomLevelsToOverscale=o.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=o.transformCameraUpdate,this.transformConstrain=o.transformConstrain,this.cancelPendingTileRequestsWhileZooming=o.cancelPendingTileRequestsWhileZooming===!0,this.setAnisotropicFilterPitch(o.anisotropicFilterPitch),o.reduceMotion!==void 0&&(Kt.prefersReducedMotion=o.reduceMotion),this._imageQueueHandle=Ti.addThrottleControl((()=>this.isMoving())),this._requestManager=new Bt(o.transformRequest),this._container=this._resolveContainer(o.container),o.maxBounds&&this.setMaxBounds(o.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})),this.once("idle",(()=>{this._idleTriggered=!0})),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver()),this.handlers=new Hs(this,o),this._hash=o.hash&&new ml(typeof o.hash=="string"&&o.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:o.center,elevation:o.elevation,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,roll:o.roll}),o.bounds&&(this.resize(),this.fitBounds(o.bounds,d.e({},o.fitBoundsOptions,{duration:0}))));const y=typeof o.style=="string"||((n=(t=o.style)===null||t===void 0?void 0:t.projection)===null||n===void 0?void 0:n.type)!=="globe";this.resize(null,y),this._localIdeographFontFamily=o.localIdeographFontFamily,this._validateStyle=o.validateStyle,o.style&&this.setStyle(o.style,{localIdeographFontFamily:o.localIdeographFontFamily}),o.attributionControl&&this.addControl(new ni(typeof o.attributionControl=="boolean"?void 0:o.attributionControl)),o.maplibreLogo&&this.addControl(new Ui,o.logoPosition),this.on("style.load",(()=>{if(y||this._resizeTransform(),this.transform.unmodified){const b=d.U(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(b)}})),this.on("data",(b=>{this._update(b.dataType==="style"),this.fire(new d.l(`${b.dataType}data`,b))})),this.on("dataloading",(b=>{this.fire(new d.l(`${b.dataType}dataloading`,b))})),this.on("dataabort",(b=>{this.fire(new d.l("sourcedataabort",b))}))}_getMapId(){return this._mapId}setGlobalStateProperty(p,t){return this.style.setGlobalStateProperty(p,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(p,t){if(t===void 0&&(t=p.getDefaultPosition?p.getDefaultPosition():"top-right"),!p||!p.onAdd)return this.fire(new d.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=p.onAdd(this);this._controls.push(p);const o=this._controlPositions[t];return t.indexOf("bottom")!==-1?o.insertBefore(n,o.firstChild):o.appendChild(n),this}removeControl(p){if(!p||!p.onRemove)return this.fire(new d.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(p);return t>-1&&this._controls.splice(t,1),p.onRemove(this),this}hasControl(p){return this._controls.indexOf(p)>-1}coveringTiles(p){return Kr(this.transform,p)}calculateCameraOptionsFromTo(p,t,n,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLat(n,this.transform)),super.calculateCameraOptionsFromTo(p,t,n,o)}resize(p,t=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t);const n=!this._moving;return n&&(this.stop(),this.fire(new d.l("movestart",p)).fire(new d.l("move",p))),this.fire(new d.l("resize",p)),n&&this.fire(new d.l("moveend",p)),this}_resizeInternal(p=!0){const[t,n]=this._containerDimensions(),o=this._getClampedPixelRatio(t,n);if(this._resizeCanvas(t,n,o),this.painter.resize(t,n,o),this.painter.overLimit()){const c=this.painter.context.gl;this._maxCanvasSize=[c.drawingBufferWidth,c.drawingBufferHeight];const f=this._getClampedPixelRatio(t,n);this._resizeCanvas(t,n,f),this.painter.resize(t,n,f)}this._resizeTransform(p)}_resizeTransform(p=!0){var t;const[n,o]=this._containerDimensions();this.transform.resize(n,o,p),(t=this._requestedCameraState)===null||t===void 0||t.resize(n,o,p)}_getClampedPixelRatio(p,t){const{0:n,1:o}=this._maxCanvasSize,c=this.getPixelRatio(),f=p*c,y=t*c;return Math.min(f>n?n/f:1,y>o?o/y:1)*c}getPixelRatio(){var p;return(p=this._overridePixelRatio)!==null&&p!==void 0?p:devicePixelRatio}setPixelRatio(p){this._overridePixelRatio=p,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(p){return this.transform.setMaxBounds(xt.convert(p)),this._update()}setMinZoom(p){if((p=p??-2)>=-2&&p<=this.transform.maxZoom){const t=this.transform.zoom,n=this._getTransformForUpdate();return n.setMinZoom(p),this._applyUpdatedTransform(n),this._update(),t!==this.transform.zoom&&this.fire(new d.l("zoomstart")).fire(new d.l("zoom")).fire(new d.l("zoomend")).fire(new d.l("movestart")).fire(new d.l("move")).fire(new d.l("moveend")),this}throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(p){if((p=p??22)>=this.transform.minZoom){const t=this.transform.zoom,n=this._getTransformForUpdate();return n.setMaxZoom(p),this._applyUpdatedTransform(n),this._update(),t!==this.transform.zoom&&this.fire(new d.l("zoomstart")).fire(new d.l("zoom")).fire(new d.l("zoomend")).fire(new d.l("movestart")).fire(new d.l("move")).fire(new d.l("moveend")),this}throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(p){if((p=p??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(p>=0&&p<=this.transform.maxPitch){const t=this.transform.pitch,n=this._getTransformForUpdate();return n.setMinPitch(p),this._applyUpdatedTransform(n),this._update(),t!==this.transform.pitch&&this.fire(new d.l("pitchstart")).fire(new d.l("pitch")).fire(new d.l("pitchend")).fire(new d.l("movestart")).fire(new d.l("move")).fire(new d.l("moveend")),this}throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(p){if((p=p??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(p>=this.transform.minPitch){const t=this.transform.pitch,n=this._getTransformForUpdate();return n.setMaxPitch(p),this._applyUpdatedTransform(n),this._update(),t!==this.transform.pitch&&this.fire(new d.l("pitchstart")).fire(new d.l("pitch")).fire(new d.l("pitchend")).fire(new d.l("movestart")).fire(new d.l("move")).fire(new d.l("moveend")),this}throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(p){if((p=p??20)>180)throw new Error("anisotropicFilterPitch must be less than or equal to 180");if(p<0)throw new Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=p,this._update()}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(p){return this.transform.setRenderWorldCopies(p),this._update()}setTransformConstrain(p){return this.transform.setConstrainOverride(p),this._update()}project(p){return this.transform.locationToScreenPoint(d.V.convert(p),this.style&&this.terrain)}unproject(p){return this.transform.screenPointToLocation(d.P.convert(p),this.terrain)}isMoving(){var p;return this._moving||((p=this.handlers)===null||p===void 0?void 0:p.isMoving())}isZooming(){var p;return this._zooming||((p=this.handlers)===null||p===void 0?void 0:p.isZooming())}isRotating(){var p;return this._rotating||((p=this.handlers)===null||p===void 0?void 0:p.isRotating())}_createDelegatedListener(p,t,n){if(p==="mouseenter"||p==="mouseover"){let o=!1;return{layers:t,listener:n,delegates:{mousemove:f=>{const y=t.filter((w=>this.getLayer(w))),b=y.length!==0?this.queryRenderedFeatures(f.point,{layers:y}):[];b.length?o||(o=!0,n.call(this,new Ci(p,this,f.originalEvent,{features:b}))):o=!1},mouseout:()=>{o=!1}}}}if(p==="mouseleave"||p==="mouseout"){let o=!1;return{layers:t,listener:n,delegates:{mousemove:y=>{const b=t.filter((w=>this.getLayer(w)));(b.length!==0?this.queryRenderedFeatures(y.point,{layers:b}):[]).length?o=!0:o&&(o=!1,n.call(this,new Ci(p,this,y.originalEvent)))},mouseout:y=>{o&&(o=!1,n.call(this,new Ci(p,this,y.originalEvent)))}}}}{const o=c=>{const f=t.filter((b=>this.getLayer(b))),y=f.length!==0?this.queryRenderedFeatures(c.point,{layers:f}):[];y.length&&(c.features=y,n.call(this,c),delete c.features)};return{layers:t,listener:n,delegates:{[p]:o}}}}_saveDelegatedListener(p,t){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[p]=this._delegatedListeners[p]||[],this._delegatedListeners[p].push(t)}_removeDelegatedListener(p,t,n){if(!this._delegatedListeners||!this._delegatedListeners[p])return;const o=this._delegatedListeners[p];for(let c=0;c<o.length;c++){const f=o[c];if(f.listener===n&&f.layers.length===t.length&&f.layers.every((y=>t.includes(y)))){for(const y in f.delegates)this.off(y,f.delegates[y]);return void o.splice(c,1)}}}on(p,t,n){if(n===void 0)return super.on(p,t);const o=typeof t=="string"?[t]:t,c=this._createDelegatedListener(p,o,n);this._saveDelegatedListener(p,c);for(const f in c.delegates)this.on(f,c.delegates[f]);return{unsubscribe:()=>{this._removeDelegatedListener(p,o,n)}}}once(p,t,n){if(n===void 0)return super.once(p,t);const o=typeof t=="string"?[t]:t,c=this._createDelegatedListener(p,o,n);for(const f in c.delegates){const y=c.delegates[f];c.delegates[f]=(...b)=>{this._removeDelegatedListener(p,o,n),y(...b)}}this._saveDelegatedListener(p,c);for(const f in c.delegates)this.once(f,c.delegates[f]);return this}off(p,t,n){return n===void 0?super.off(p,t):(this._removeDelegatedListener(p,typeof t=="string"?[t]:t,n),this)}queryRenderedFeatures(p,t){if(!this.style)return[];let n;const o=p instanceof d.P||Array.isArray(p),c=o?p:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(o?{}:p)||{},c instanceof d.P||typeof c[0]=="number")n=[d.P.convert(c)];else{const f=d.P.convert(c[0]),y=d.P.convert(c[1]);n=[f,new d.P(y.x,f.y),y,new d.P(f.x,y.y),f]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(p,t){return this.style.querySourceFeatures(p,t)}setStyle(p,t){return(t=d.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&p?(this._diffStyle(p,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(p,t))}setTransformRequest(p){return this._requestManager.setTransformRequest(p),this}_getUIString(p){const t=this._locale[p];if(t==null)throw new Error(`Missing UI string '${p}'`);return t}_updateStyle(p,t){var n,o;if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(p,t)));const c=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!p)),p?(this.style=new Ts(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof p=="string"?this.style.loadURL(p,t,c):this.style.loadJSON(p,t,c),this):((o=(n=this.style)===null||n===void 0?void 0:n.projection)===null||o===void 0||o.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Ts(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(p,t){return d._(this,void 0,void 0,(function*(){if(typeof p=="string"){const n=p,o=yield this._requestManager.transformRequest(n,"Style");try{const c=yield d.j(o,new AbortController);this._updateDiff(c.data,t)}catch(c){c&&this.fire(new d.k(c))}}else typeof p=="object"&&this._updateDiff(p,t)}))}_updateDiff(p,t){try{this.style.setState(p,t)&&this._update(!0)}catch(n){d.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(p,t)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){return this.style?this.style.loaded():d.w("There is no style added to the map.")}addSource(p,t){return this._lazyInitEmptyStyle(),this.style.addSource(p,t),this._update(!0)}isSourceLoaded(p){const t=this.style&&this.style.tileManagers[p];if(t!==void 0)return t.loaded();this.fire(new d.k(new Error(`There is no tile manager with ID '${p}'`)))}setTerrain(p){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),p){const t=this.style.tileManagers[p.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${p.source}`);this.terrain===null&&t.reload();for(const n in this.style._layers){const o=this.style._layers[n];o.type==="hillshade"&&o.source===p.source&&d.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),o.type==="color-relief"&&o.source===p.source&&d.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new rh(this.painter,t,p),this.painter.renderToTexture=new Ct(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=n=>{var o;n.dataType==="style"?this.terrain.tileManager.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==p.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((o=n.source)===null||o===void 0?void 0:o.type)==="image"?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new d.l("terrain",{terrain:p})),this}getTerrain(){var p,t;return(t=(p=this.terrain)===null||p===void 0?void 0:p.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const p=this.style&&this.style.tileManagers;for(const t of Object.values(p))if(!t.areTilesLoaded())return!1;return!0}removeSource(p){return this.style.removeSource(p),this._update(!0)}getSource(p){return this.style.getSource(p)}setSourceTileLodParams(p,t,n){if(n){const o=this.getSource(n);if(!o)throw new Error(`There is no source with ID "${n}", cannot set LOD parameters`);o.calculateTileZoom=Eo(Math.max(1,p),Math.max(1,t))}else for(const o in this.style.tileManagers)this.style.tileManagers[o].getSource().calculateTileZoom=Eo(Math.max(1,p),Math.max(1,t));return this._update(!0),this}refreshTiles(p,t){const n=this.style.tileManagers[p];if(!n)throw new Error(`There is no tile manager with ID "${p}", cannot refresh tile`);t===void 0?n.reload(!0):n.refreshTiles(t.map((o=>new d.a9(o.z,o.x,o.y))))}addImage(p,t,n={}){const{pixelRatio:o=1,sdf:c=!1,stretchX:f,stretchY:y,content:b,textFitWidth:w,textFitHeight:S}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||d.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new d.k(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:P,height:E,data:C}=t,z=t;return this.style.addImage(p,{data:new d.R({width:P,height:E},new Uint8Array(C)),pixelRatio:o,stretchX:f,stretchY:y,content:b,textFitWidth:w,textFitHeight:S,sdf:c,version:0,userImage:z}),z.onAdd&&z.onAdd(this,p),this}}{const{width:P,height:E,data:C}=Kt.getImageData(t);this.style.addImage(p,{data:new d.R({width:P,height:E},C),pixelRatio:o,stretchX:f,stretchY:y,content:b,textFitWidth:w,textFitHeight:S,sdf:c,version:0})}}updateImage(p,t){const n=this.style.getImage(p);if(!n)return this.fire(new d.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const o=t instanceof HTMLImageElement||d.b(t)?Kt.getImageData(t):t,{width:c,height:f,data:y}=o;if(c===void 0||f===void 0)return this.fire(new d.k(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(c!==n.data.width||f!==n.data.height)return this.fire(new d.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const b=!(t instanceof HTMLImageElement||d.b(t));return n.data.replace(y,b),this.style.updateImage(p,n),this}getImage(p){return this.style.getImage(p)}hasImage(p){return p?!!this.style.getImage(p):(this.fire(new d.k(new Error("Missing required image id"))),!1)}removeImage(p){this.style.removeImage(p)}loadImage(p){return d._(this,void 0,void 0,(function*(){return Ti.getImage(yield this._requestManager.transformRequest(p,"Image"),new AbortController)}))}listImages(){return this.style.listImages()}addLayer(p,t){return this._lazyInitEmptyStyle(),this.style.addLayer(p,t),this._update(!0)}moveLayer(p,t){return this.style.moveLayer(p,t),this._update(!0)}removeLayer(p){return this.style.removeLayer(p),this._update(!0)}getLayer(p){return this.style.getLayer(p)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(p,t,n){return this.style.setLayerZoomRange(p,t,n),this._update(!0)}setFilter(p,t,n={}){return this.style.setFilter(p,t,n),this._update(!0)}getFilter(p){return this.style.getFilter(p)}setPaintProperty(p,t,n,o={}){return this.style.setPaintProperty(p,t,n,o),this._update(!0)}getPaintProperty(p,t){return this.style.getPaintProperty(p,t)}setLayoutProperty(p,t,n,o={}){return this.style.setLayoutProperty(p,t,n,o),this._update(!0)}getLayoutProperty(p,t){return this.style.getLayoutProperty(p,t)}setGlyphs(p,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(p,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(p,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(p,t,n,(o=>{o||this._update(!0)})),this}removeSprite(p){return this._lazyInitEmptyStyle(),this.style.removeSprite(p),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(p,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(p,t,(n=>{n||this._update(!0)})),this}setLight(p,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(p,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(p,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(p,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(p,t){return this.style.setFeatureState(p,t),this._update()}removeFeatureState(p,t){return this.style.removeFeatureState(p,t),this._update()}getFeatureState(p){return this.style.getFeatureState(p)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let p=0,t=0;return this._container&&(p=this._container.clientWidth||400,t=this._container.clientHeight||300),[p,t]}_setupResizeObserver(){var p;let t=!1;const n=fl((c=>{this._trackResize&&!this._removed&&(this.resize(c),this.redraw())}),50),o=(p=this._ownerWindow.ResizeObserver)!==null&&p!==void 0?p:ResizeObserver;this._resizeObserver=new o((c=>{t?n(c):t=!0})),this._resizeObserver.observe(this._container)}_resolveContainer(p){if(typeof p=="string"){const t=document.getElementById(p);if(!t)throw new Error(`Container '${p}' not found.`);return t}if(p instanceof HTMLElement||p&&typeof p=="object"&&p.nodeType===1)return p;throw new Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){const p=this._container;p.classList.add("maplibregl-map");const t=this._canvasContainer=ge.create("div","maplibregl-canvas-container",p);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=ge.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const n=this._containerDimensions(),o=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],o);const c=this._controlContainer=ge.create("div","maplibregl-control-container",p),f=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((y=>{f[y]=ge.create("div",`maplibregl-ctrl-${y} `,c)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(p,t,n){this._canvas.width=Math.floor(n*p),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${p}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const p=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let t=null;this._canvas.addEventListener("webglcontextcreationerror",(o=>{t={requestedAttributes:p},o&&(t.statusMessage=o.statusMessage,t.type=o.type)}),{once:!0});let n=null;if(n=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,p):this._canvas.getContext("webgl2",p)||this._canvas.getContext("webgl",p),!n){const o="Failed to initialize WebGL";throw t?(t.message=o,new Error(JSON.stringify(t))):new Error(o)}this.painter=new js(n,this.transform)}migrateProjection(p,t){super.migrateProjection(p,t),this.painter.transform=p,this.fire(new d.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(p){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||p,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(p){return this._update(),this._renderTaskQueue.add(p)}_cancelRenderFrame(p){this._renderTaskQueue.remove(p)}_render(p){var t,n,o,c,f;const y=this._idleTriggered?this._fadeDuration:0,b=((t=this.style.projection)===null||t===void 0?void 0:t.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(p),this._removed)return;let w=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const E=this.transform.zoom,C=Ze();this.style.zoomHistory.update(E,C);const z=new d.H(E,{now:C,fadeDuration:y,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),F=z.crossFadingFactor();F===1&&F===this._crossFadingFactor||(w=!0,this._crossFadingFactor=F),this.style.update(z)}const S=((n=this.style.projection)===null||n===void 0?void 0:n.transitionState)>0!==b;(o=this.style.projection)===null||o===void 0||o.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((c=this.style.projection)===null||c===void 0?void 0:c.transitionState,(f=this.style.projection)===null||f===void 0?void 0:f.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||S)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,y,this._crossSourceCollisions,S),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:y,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new d.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,d.cE.mark(d.cF.load),this.fire(new d.l("load"))),this.style&&(this.style.hasTransitions()||w)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const P=this._sourcesDirty||this._styleDirty||this._placementDirty;return P||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new d.l("idle")),!this._loaded||this._fullyLoaded||P||(this._fullyLoaded=!0,d.cE.mark(d.cF.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var p;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),Ti.removeThrottleControl(this._imageQueueHandle),(p=this._resizeObserver)===null||p===void 0||p.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t?.loseContext&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),d.cE.remove(),this._removed=!0,this.fire(new d.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Kt.frame(this._frameRequest,(p=>{d.cE.recordStartOfFrameAt(p),this._frameRequest=null;try{this._render(p)}catch(t){if(!d.Z(t)&&!(function(n){return n.message===zs})(t))throw t}}),(()=>{}),this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(p){this._showTileBoundaries!==p&&(this._showTileBoundaries=p,this._update())}get showPadding(){return!!this._showPadding}set showPadding(p){this._showPadding!==p&&(this._showPadding=p,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(p){this._showCollisionBoxes!==p&&(this._showCollisionBoxes=p,p?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(p){this._showOverdrawInspector!==p&&(this._showOverdrawInspector=p,this._update())}get repaint(){return!!this._repaint}set repaint(p){this._repaint!==p&&(this._repaint=p,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(p){this._vertices=p,this._update()}get version(){return Js}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(p){return this._lazyInitEmptyStyle(),this.style.setProjection(p),this._update(!0)}};const Pl={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Il{constructor(t,n,o=!1){this.mousedown=f=>{this.startMove(f,ge.mousePos(this.element,f)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=f=>{this.move(f,ge.mousePos(this.element,f))},this.mouseup=f=>{this._rotatePitchHandler.dragEnd(f),this.offTemp()},this.touchstart=f=>{f.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ge.touchPos(this.element,f.targetTouches)[0],this.startMove(f,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend))},this.touchmove=f=>{f.targetTouches.length!==1?this.reset():(this._lastPos=ge.touchPos(this.element,f.targetTouches)[0],this.move(f,this._lastPos))},this.touchend=f=>{f.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=n;const c=new Ju;this._rotatePitchHandler=new Hn({clickTolerance:3,move:(f,y)=>{const b=n.getBoundingClientRect(),w=new d.P((b.bottom-b.top)/2,(b.right-b.left)/2);return{bearingDelta:d.cv(new d.P(f.x,y.y),y,w),pitchDelta:o?-.5*(y.y-f.y):void 0}},moveStateManager:c,enable:!0,assignEvents:()=>{}}),this.map=t,n.addEventListener("mousedown",this.mousedown),n.addEventListener("touchstart",this.touchstart,{passive:!1}),n.addEventListener("touchcancel",this.reset)}startMove(t,n){this._rotatePitchHandler.dragStart(t,n),ge.disableDrag()}move(t,n){const o=this.map,{bearingDelta:c,pitchDelta:f}=this._rotatePitchHandler.dragMove(t,n)||{};c&&o.setBearing(o.getBearing()+c),f&&o.setPitch(o.getPitch()+f)}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){ge.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}}let er;function qa(p,t,n,o=!1){if(o||!n.getCoveringTilesDetailsProvider().allowWorldCopies())return p?.wrap();const c=new d.V(p.lng,p.lat);if(p=new d.V(p.lng,p.lat),t){const f=new d.V(p.lng-360,p.lat),y=new d.V(p.lng+360,p.lat),b=n.locationToScreenPoint(p).distSqr(t);n.locationToScreenPoint(f).distSqr(t)<b?p=f:n.locationToScreenPoint(y).distSqr(t)<b&&(p=y)}for(;Math.abs(p.lng-n.center.lng)>180;){const f=n.locationToScreenPoint(p);if(f.x>=0&&f.y>=0&&f.x<=n.width&&f.y<=n.height)break;p.lng>n.center.lng?p.lng-=360:p.lng+=360}return p.lng!==c.lng&&n.isPointOnMapSurface(n.locationToScreenPoint(p))?p:c}const ea={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Wa(p,t,n){const o=p.classList;for(const c in ea)o.remove(`maplibregl-${n}-anchor-${c}`);o.add(`maplibregl-${n}-anchor-${t}`)}class ta extends d.E{constructor(t){if(super(),this._onClick=n=>{this.fire(new d.l("click",{originalEvent:n}))},this._onKeyPress=n=>{n.code!=="Space"&&n.code!=="Enter"||this.togglePopup()},this._onMapClick=n=>{const o=n.originalEvent.target,c=this._element;this._popup&&(o===c||c.contains(o))&&this.togglePopup()},this._update=n=>{if(!this._map)return;const o=this._map.loaded()&&!this._map.isMoving();(n?.type==="terrain"||n?.type==="render"&&!o)&&this._map.once("render",this._update),this._lngLat=qa(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let c="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?c=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(c=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let f="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?f="rotateX(0deg)":this._pitchAlignment==="map"&&(f=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),this._element.style.transform=`${ea[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${f} ${c}`,Kt.frameAsync(new AbortController,this._map._ownerWindow).then((()=>{this._updateOpacity(n&&n.type==="moveend")})).catch((()=>{}))},this._onMove=n=>{if(!this._isDragging){const o=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=o}this._isDragging&&(this._pos=n.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new d.l("dragstart"))),this.fire(new d.l("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new d.l("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t?.opacity,t?.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=d.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=ge.create("div");const n=ge.createNS("http://www.w3.org/2000/svg","svg"),o=41,c=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${o}px`),n.setAttributeNS(null,"width",`${c}px`),n.setAttributeNS(null,"viewBox",`0 0 ${c} ${o}`);const f=ge.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"stroke","none"),f.setAttributeNS(null,"stroke-width","1"),f.setAttributeNS(null,"fill","none"),f.setAttributeNS(null,"fill-rule","evenodd");const y=ge.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"fill-rule","nonzero");const b=ge.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"transform","translate(3.0, 29.0)"),b.setAttributeNS(null,"fill","#000000");const w=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const N of w){const $=ge.createNS("http://www.w3.org/2000/svg","ellipse");$.setAttributeNS(null,"opacity","0.04"),$.setAttributeNS(null,"cx","10.5"),$.setAttributeNS(null,"cy","5.80029008"),$.setAttributeNS(null,"rx",N.rx),$.setAttributeNS(null,"ry",N.ry),b.appendChild($)}const S=ge.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"fill",this._color);const P=ge.createNS("http://www.w3.org/2000/svg","path");P.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),S.appendChild(P);const E=ge.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const C=ge.createNS("http://www.w3.org/2000/svg","path");C.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),E.appendChild(C);const z=ge.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"transform","translate(6.0, 7.0)"),z.setAttributeNS(null,"fill","#FFFFFF");const F=ge.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(8.0, 8.0)");const V=ge.createNS("http://www.w3.org/2000/svg","circle");V.setAttributeNS(null,"fill","#000000"),V.setAttributeNS(null,"opacity","0.25"),V.setAttributeNS(null,"cx","5.5"),V.setAttributeNS(null,"cy","5.5"),V.setAttributeNS(null,"r","5.4999962");const j=ge.createNS("http://www.w3.org/2000/svg","circle");j.setAttributeNS(null,"fill","#FFFFFF"),j.setAttributeNS(null,"cx","5.5"),j.setAttributeNS(null,"cy","5.5"),j.setAttributeNS(null,"r","5.4999962"),F.appendChild(V),F.appendChild(j),y.appendChild(b),y.appendChild(S),y.appendChild(E),y.appendChild(z),y.appendChild(F),n.appendChild(y),n.setAttributeNS(null,"height",o*this._scale+"px"),n.setAttributeNS(null,"width",c*this._scale+"px"),this._element.appendChild(n),this._offset=d.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(n=>{n.preventDefault()})),this._element.addEventListener("mousedown",(n=>{n.preventDefault()})),Wa(this._element,this._anchor,"marker"),t&&t.className)for(const n of t.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=d.V.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const c=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[c,-1*(38.1-13.5+c)],"bottom-right":[-c,-1*(38.1-13.5+c)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var n,o;const c=(n=this._map)===null||n===void 0?void 0:n.terrain,f=this._map.transform.isLocationOccluded(this._lngLat);if(!c||f){const z=f?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==z&&(this._element.style.opacity=z))}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const y=this._map,b=y.terrain.depthAtPoint(this._pos),w=y.terrain.getElevationForLngLat(this._lngLat,y.transform);if(y.transform.lngLatToCameraDepth(this._lngLat,w)-b<.006)return void(this._element.style.opacity=this._opacity);const S=-this._offset.y/y.transform.pixelsPerMeter,P=Math.sin(y.getPitch()*Math.PI/180)*S,E=y.terrain.depthAtPoint(new d.P(this._pos.x,this._pos.y-this._offset.y)),C=y.transform.lngLatToCameraDepth(this._lngLat,w+P)-E>.006;!((o=this._popup)===null||o===void 0)&&o.isOpen()&&C&&this._popup.remove(),this._element.style.opacity=C?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=d.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,n){return(this._opacity===void 0||t===void 0&&n===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}const Ml={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Kn=0,fn=!1;const El={maxWidth:100,unit:"metric"};function Xa(p,t,n){const o=n&&n.maxWidth||100,c=p._container.clientHeight/2,f=p._container.clientWidth/2,y=p.unproject([f-o/2,c]),b=p.unproject([f+o/2,c]),w=Math.round(p.project(b).x-p.project(y).x),S=Math.min(o,w,p._container.clientWidth),P=y.distanceTo(b);if(n&&n.unit==="imperial"){const E=3.2808*P;E>5280?Or(t,S,E/5280,p._getUIString("ScaleControl.Miles")):Or(t,S,E,p._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Or(t,S,P/1852,p._getUIString("ScaleControl.NauticalMiles")):P>=1e3?Or(t,S,P/1e3,p._getUIString("ScaleControl.Kilometers")):Or(t,S,P,p._getUIString("ScaleControl.Meters"))}function Or(p,t,n,o){const c=(function(f){const y=Math.pow(10,`${Math.floor(f)}`.length-1);let b=f/y;return b=b>=10?10:b>=5?5:b>=3?3:b>=2?2:b>=1?1:(function(w){const S=Math.pow(10,Math.ceil(-Math.log(w)/Math.LN10));return Math.round(w*S)/S})(b),y*b})(n);p.style.width=t*(c/n)+"px",p.innerHTML=`${c}&nbsp;${o}`}const Cl={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},Al=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ia(p){if(p){if(typeof p=="number"){const t=Math.round(Math.abs(p)/Math.SQRT2);return{center:new d.P(0,0),top:new d.P(0,p),"top-left":new d.P(t,t),"top-right":new d.P(-t,t),bottom:new d.P(0,-p),"bottom-left":new d.P(t,-t),"bottom-right":new d.P(-t,-t),left:new d.P(p,0),right:new d.P(-p,0)}}if(p instanceof d.P||Array.isArray(p)){const t=d.P.convert(p);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:d.P.convert(p.center||[0,0]),top:d.P.convert(p.top||[0,0]),"top-left":d.P.convert(p["top-left"]||[0,0]),"top-right":d.P.convert(p["top-right"]||[0,0]),bottom:d.P.convert(p.bottom||[0,0]),"bottom-left":d.P.convert(p["bottom-left"]||[0,0]),"bottom-right":d.P.convert(p["bottom-right"]||[0,0]),left:d.P.convert(p.left||[0,0]),right:d.P.convert(p.right||[0,0])}}return ia(new d.P(0,0))}const Dl=we;R.AJAXError=d.cG,R.EXTENT=d.a5,R.Event=d.l,R.Evented=d.E,R.LngLat=d.V,R.MercatorCoordinate=d.a6,R.Point=d.P,R.addProtocol=d.cH,R.config=d.c,R.removeProtocol=d.cI,R.AttributionControl=ni,R.BoxZoomHandler=Oc,R.CanvasSource=Xr,R.CooperativeGesturesHandler=Qi,R.DoubleClickZoomHandler=Xs,R.DragPanHandler=Tl,R.DragRotateHandler=Sl,R.EdgeInsets=ii,R.FullscreenControl=class extends d.E{constructor(p={}){var t;super(),this._onFullscreenChange=()=>{var n;let o=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;!((n=o?.shadowRoot)===null||n===void 0)&&n.fullscreenElement;)o=o.shadowRoot.fullscreenElement;o===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=(t=p.pseudo)!==null&&t!==void 0&&t,p&&p.container&&(p.container instanceof HTMLElement?this._container=p.container:d.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(p){return this._map=p,this._container||(this._container=this._map.getContainer()),this._controlContainer=ge.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const p=this._fullscreenButton=ge.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ge.create("span","maplibregl-ctrl-icon",p).setAttribute("aria-hidden","true"),p.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const p=this._getTitle();this._fullscreenButton.setAttribute("aria-label",p),this._fullscreenButton.title=p}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new d.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new d.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},R.GeoJSONSource=Mn,R.GeolocateControl=class extends d.E{constructor(p){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new d.l("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new d.l("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new d.V(t.coords.longitude,t.coords.latitude),o=t.coords.accuracy,c=this._map.getBearing(),f=d.e({bearing:c},this.options.fitBoundsOptions),y=xt.fromLngLat(n,o);this._map.fitBounds(y,f,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new d.V(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=t=>{if(this._map){if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&fn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new d.l("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=t=>{if(!this._map)return;const n=t?.[0]instanceof ResizeObserverEntry;t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new d.l("trackuserlocationend")),this.fire(new d.l("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=ge.create("button","maplibregl-ctrl-geolocate",this._container),ge.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(t===!1){d.w("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ge.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ta({element:this._dotElement}),this._circleElement=ge.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ta({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=d.e({},Ml,p)}onAdd(p){return this._map=p,this._container=ge.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return d._(this,arguments,void 0,(function*(t=!1){if(er!==void 0&&!t)return er;if(window.navigator.permissions===void 0)return er=!!window.navigator.geolocation,er;try{er=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{er=!!window.navigator.geolocation}return er}))})().then((t=>this._finishSetupUI(t))),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,Kn=0,fn=!1}_isOutOfMapMaxBounds(p){const t=this._map.getMaxBounds(),n=p.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){const p=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&p))return;const t=this._map.project(p),n=this._map.unproject([t.x+100,t.y]),o=p.distanceTo(n)/100,c=2*this._accuracy/o;this._circleElement.style.width=`${c.toFixed(2)}px`,this._circleElement.style.height=`${c.toFixed(2)}px`}trigger(){if(!this._setup)return d.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new d.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Kn--,fn=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new d.l("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new d.l("trackuserlocationstart")),this.fire(new d.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let p;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Kn++,Kn>1?(p={maximumAge:6e5,timeout:0},fn=!0):(p=this.options.positionOptions,fn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,p)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},R.GlobeControl=class{constructor(){this._toggleProjection=()=>{var p;const t=(p=this._map.getProjection())===null||p===void 0?void 0:p.type;this._map.setProjection(t!=="mercator"&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var p;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((p=this._map.getProjection())===null||p===void 0?void 0:p.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(p){return this._map=p,this._container=ge.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=ge.create("button","maplibregl-ctrl-globe",this._container),ge.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},R.Hash=ml,R.ImageSource=Er,R.KeyboardHandler=Gc,R.LngLatBounds=xt,R.LogoControl=Ui,R.Map=Za,R.MapLibreMap=Za,R.MapMouseEvent=Ci,R.MapTouchEvent=Us,R.MapWheelEvent=dn,R.Marker=ta,R.NavigationControl=class{constructor(p){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),o=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=o,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",o.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(t,n)=>{const o=this._map._getUIString(`NavigationControl.${n}`);t.title=o,t.setAttribute("aria-label",o)},this.options=d.e({},Pl,p),this._container=ge.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),ge.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),ge.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=ge.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(p){return this._map=p,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Il(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(p,t){const n=ge.create("button",p,this._container);return n.type="button",n.addEventListener("click",t),n}},R.Popup=class extends d.E{constructor(p){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new d.l("close"))),this),this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ge.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ge.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const b of this.options.className.split(" "))this._container.classList.add(b);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}let n;if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=qa(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),t&&"point"in t&&t.point&&(n=t.point),this._trackPointer&&!n)return;const o=this._flatPos=this._pos=this._trackPointer&&n?n:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&n?n:this._map.transform.locationToScreenPoint(this._lngLat));let c=this.options.anchor;const f=ia(this.options.offset);if(!c){const b=this._container.offsetWidth,w=this._container.offsetHeight,S=(function(E){var C,z,F,V;return E?{top:(C=E.top)!==null&&C!==void 0?C:0,right:(z=E.right)!==null&&z!==void 0?z:0,bottom:(F=E.bottom)!==null&&F!==void 0?F:0,left:(V=E.left)!==null&&V!==void 0?V:0}:{top:0,right:0,bottom:0,left:0}})(this.options.padding);let P;P=o.y+f.bottom.y<w+S.top?["top"]:o.y>this._map.transform.height-w-S.bottom?["bottom"]:[],o.x<b/2+S.left?P.push("left"):o.x>this._map.transform.width-b/2-S.right&&P.push("right"),c=P.length===0?"bottom":P.join("-")}let y=o.add(f[c]);this.options.subpixelPositioning||(y=y.round()),this._container.style.transform=`${ea[c]} translate(${y.x}px,${y.y}px)`,Wa(this._container,c,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=d.e(Object.create(Cl),p)}addTo(p){return this._map&&this.remove(),this._map=p,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new d.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(p){return this._lngLat=d.V.convert(p),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(p){return this.setDOMContent(document.createTextNode(p))}setHTML(p){const t=document.createDocumentFragment(),n=document.createElement("body");let o;for(n.innerHTML=p;o=n.firstChild,o;)t.appendChild(o);return this.setDOMContent(t)}getMaxWidth(){var p;return(p=this._container)===null||p===void 0?void 0:p.style.maxWidth}setMaxWidth(p){return this.options.maxWidth=p,this._update(),this}setDOMContent(p){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ge.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(p),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(p){return this._container&&this._container.classList.add(p),this}removeClassName(p){return this._container&&this._container.classList.remove(p),this}setOffset(p){return this.options.offset=p,this._update(),this}toggleClassName(p){if(this._container)return this._container.classList.toggle(p)}setSubpixelPositioning(p){this.options.subpixelPositioning=p}setPadding(p){this.options.padding=p,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=ge.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const p=this._container.querySelector(Al);p&&p.focus()}},R.RasterDEMTileSource=Fi,R.RasterTileSource=Ut,R.ScaleControl=class{constructor(p){this._onMove=()=>{Xa(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Xa(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},El),p)}getDefaultPosition(){return"bottom-left"}onAdd(p){return this._map=p,this._container=ge.create("div","maplibregl-ctrl maplibregl-ctrl-scale",p.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}},R.ScrollZoomHandler=Ws,R.Style=Ts,R.TerrainControl=class{constructor(p){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=p}onAdd(p){return this._map=p,this._container=ge.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ge.create("button","maplibregl-ctrl-terrain",this._container),ge.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},R.TwoFingersTouchPitchHandler=bl,R.TwoFingersTouchRotateHandler=xl,R.TwoFingersTouchZoomHandler=Nc,R.TwoFingersTouchZoomRotateHandler=Zc,R.VectorTileSource=Nt,R.VideoSource=ha,R.addSourceType=(p,t)=>d._(void 0,void 0,void 0,(function*(){if(Po(p))throw new Error(`A source type called "${p}" already exists.`);((n,o)=>{So[n]=o})(p,t)})),R.clearPrewarmedResources=function(){const p=hi;p&&(p.isPreloaded()&&p.numActive()===1?(p.release(Xe),hi=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},R.createTileMesh=bs,R.getMaxParallelImageRequests=function(){return d.c.MAX_PARALLEL_IMAGE_REQUESTS},R.getRTLTextPluginStatus=function(){return Cr().getRTLTextPluginStatus()},R.getVersion=function(){return Dl},R.getWorkerCount=function(){return Re.workerCount},R.getWorkerUrl=function(){return d.c.WORKER_URL},R.importScriptInWorkers=function(p){return cs().broadcast("IS",p)},R.isTimeFrozen=function(){return Sr.isFrozen()},R.now=Ze,R.prewarm=function(){Wr().acquire(Xe)},R.restoreNow=function(){Sr.restoreNow()},R.setMaxParallelImageRequests=function(p){d.c.MAX_PARALLEL_IMAGE_REQUESTS=p},R.setNow=function(p){Sr.setNow(p)},R.setRTLTextPlugin=function(p,t){return Cr().setRTLTextPlugin(p,t)},R.setWorkerCount=function(p){Re.workerCount=p},R.setWorkerUrl=function(p){d.c.WORKER_URL=p}}));var wo=$r;return wo}))})(Iu)),Iu.exports}var Gf=j_();const N_=B_(Gf),G_=O_({__proto__:null,default:N_},[Gf]);export{G_ as m};