@datalayer/agent-runtimes 1.6.95 → 1.6.96

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 (362) hide show
  1. package/dist-embed/chunks/{AgentDetails-BvfdY3uO.js → AgentDetails-Ddc6d7Vb.js} +1 -1
  2. package/dist-embed/chunks/{AgentDetailsDialog-fQMt4AfV.js → AgentDetailsDialog-BqYyyNpE.js} +1 -1
  3. package/dist-embed/chunks/{AgentInspector-Bk_6hnzQ.js → AgentInspector-Dwh_YetA.js} +1 -1
  4. package/dist-embed/chunks/{AgentInspectorDialog-COpHclrh.js → AgentInspectorDialog-Cau9xrvM.js} +1 -1
  5. package/dist-embed/chunks/{CellSidebarExtension-BSomRlJ-.js → CellSidebarExtension-DSNmntUX.js} +7 -7
  6. package/dist-embed/chunks/{ChatView-C8fvqoAH.js → ChatView-Dzy1KRzJ.js} +4 -4
  7. package/dist-embed/chunks/{CollapsiblePlugin-BcCRY7vG.js → CollapsiblePlugin-DmoruakD.js} +1 -1
  8. package/dist-embed/chunks/{ContextPie-BHsXiDRO.js → ContextPie-x_xvOUQW.js} +1 -1
  9. package/dist-embed/chunks/{DeckComponent-DGJwaGWE.js → DeckComponent-B2pu-8Gg.js} +1 -1
  10. package/dist-embed/chunks/{DeckRenderer-B8PqIWaS.js → DeckRenderer-BitpK9Co.js} +2 -2
  11. package/dist-embed/chunks/{DeckStage-b6WCYIrt.js → DeckStage-D4emgALl.js} +3 -3
  12. package/dist-embed/chunks/{DocumentView-2NxPEuqp.js → DocumentView-GCdq20sR.js} +1 -1
  13. package/dist-embed/chunks/{EphemeralDocument-GaUco3ov.js → EphemeralDocument-BxEBdArS.js} +1 -1
  14. package/dist-embed/chunks/{EphemeralNotebook-DBs08R5-.js → EphemeralNotebook-iWR0tOaY.js} +1 -1
  15. package/dist-embed/chunks/{ExcalidrawComponent-vHJ6t4Sx.js → ExcalidrawComponent-BNE0rUus.js} +1 -1
  16. package/dist-embed/chunks/{ExcalidrawModal-DwWGmnRQ.js → ExcalidrawModal-B0d7EMm1.js} +1 -1
  17. package/dist-embed/chunks/{FormulaBar-CPCjPhlD.js → FormulaBar-BBm1JXuS.js} +1 -1
  18. package/dist-embed/chunks/{JupyterLexicalExtension-Df6IrbR-.js → JupyterLexicalExtension-DEiuU9XK.js} +29 -29
  19. package/dist-embed/chunks/{KernelVariables-oNW3cYs4.js → KernelVariables-BehGjCby.js} +1 -1
  20. package/dist-embed/chunks/{LexicalToolRegistry-CxE-muFM.js → LexicalToolRegistry-CjiooYJz.js} +1 -1
  21. package/dist-embed/chunks/{NotebookToolSurfaces-B3MY-vYT.js → NotebookToolSurfaces-D2niRSgN.js} +1 -1
  22. package/dist-embed/chunks/{NotebookView-B84bIB_s.js → NotebookView--XqCYFyy.js} +1 -1
  23. package/dist-embed/chunks/{Output-DbuS5mTW.js → Output-DIp_tlWH.js} +6 -6
  24. package/dist-embed/chunks/{SandboxDetailsDialog-DxyOgkVN.js → SandboxDetailsDialog-DXoy-U_w.js} +1 -1
  25. package/dist-embed/chunks/{SchemaForm-BpQuFPdH.js → SchemaForm-Cmv4n0Os.js} +1 -1
  26. package/dist-embed/chunks/{SheetStage-C6XKe73k.js → SheetStage-CPrhxiEk.js} +1 -1
  27. package/dist-embed/chunks/{SheetTabs-L2YN86GJ.js → SheetTabs-CIoATuqe.js} +1 -1
  28. package/dist-embed/chunks/SpreadsheetPreviewView-DA_p2PVw.js +1 -0
  29. package/dist-embed/chunks/{SpreadsheetView-DCMl89-H.js → SpreadsheetView-D6J2ll9x.js} +1 -1
  30. package/dist-embed/chunks/TripMapView-Chu4CxoP.js +800 -0
  31. package/dist-embed/chunks/{WidgetVariableView-tHluwrGK.js → WidgetVariableView-pK_kA46x.js} +1 -1
  32. package/dist-embed/chunks/{YouTubePlugin-C-3vxmlQ.js → YouTubePlugin-DkAnyShg.js} +1 -1
  33. package/dist-embed/chunks/{abnfDiagram-VCTEODGH-Bhd2l8QD.js → abnfDiagram-VCTEODGH-CX9mMYXT.js} +1 -1
  34. package/dist-embed/chunks/{abnfDiagram-VCTEODGH-kVHfIAbZ.js → abnfDiagram-VCTEODGH-D1af2ghA.js} +1 -1
  35. package/dist-embed/chunks/{abnfDiagram-VCTEODGH-BCGK5XKK.js → abnfDiagram-VCTEODGH-Ri346RDd.js} +1 -1
  36. package/dist-embed/chunks/{ar-SA-G6X2FPQ2-UWUqTy-K.js → ar-SA-G6X2FPQ2-CXTKdzGs.js} +1 -1
  37. package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-DXEtcMhi.js → architectureDiagram-5GKGNRK7-2OGYSHGz.js} +1 -1
  38. package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-BV0c57bp.js → architectureDiagram-5GKGNRK7-C0-0iqdj.js} +1 -1
  39. package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-Fw3FuyyK.js → architectureDiagram-5GKGNRK7-CsLrz5V8.js} +1 -1
  40. package/dist-embed/chunks/{az-AZ-76LH7QW2-DWmo_K9N.js → az-AZ-76LH7QW2-C2FVIwGa.js} +1 -1
  41. package/dist-embed/chunks/{bg-BG-XCXSNQG7-DEIS8jN8.js → bg-BG-XCXSNQG7-Do7qP3y5.js} +1 -1
  42. package/dist-embed/chunks/{blockDiagram-868be97b-atYMh58B.js → blockDiagram-868be97b-CCPwkNQD.js} +1 -1
  43. package/dist-embed/chunks/{blockDiagram-I7D4REHJ-B5YMuboC.js → blockDiagram-I7D4REHJ-BwtxKaHd.js} +1 -1
  44. package/dist-embed/chunks/{blockDiagram-I7D4REHJ-c2uxRyEL.js → blockDiagram-I7D4REHJ-Dkac8pDH.js} +1 -1
  45. package/dist-embed/chunks/{blockDiagram-I7D4REHJ-2Nx-2jmD.js → blockDiagram-I7D4REHJ-DuFs7Ehc.js} +1 -1
  46. package/dist-embed/chunks/{bn-BD-2XOGV67Q-CdGydfQA.js → bn-BD-2XOGV67Q-CncsPSj6.js} +1 -1
  47. package/dist-embed/chunks/browser-CjxI_vdc.js +1 -0
  48. package/dist-embed/chunks/{c4Diagram-3f4bdde3-DrAykr_M.js → c4Diagram-3f4bdde3-BLw1hbRS.js} +1 -1
  49. package/dist-embed/chunks/{c4Diagram-7LVT6UL2-CxQfmxDp.js → c4Diagram-7LVT6UL2-COW8SWY8.js} +1 -1
  50. package/dist-embed/chunks/{c4Diagram-7LVT6UL2-D9KYeQdn.js → c4Diagram-7LVT6UL2-Cvhvycsr.js} +1 -1
  51. package/dist-embed/chunks/{c4Diagram-7LVT6UL2-CCUWeXWN.js → c4Diagram-7LVT6UL2-Db67ewBM.js} +1 -1
  52. package/dist-embed/chunks/{ca-ES-6MX7JW3Y-Cmxh4hHb.js → ca-ES-6MX7JW3Y-C0yxvCPt.js} +1 -1
  53. package/dist-embed/chunks/{celltoolbartracker-6bzTgI7x.js → celltoolbartracker-BEMovM_S.js} +1 -1
  54. package/dist-embed/chunks/{chunk-2Q5K7J3B-BlidW8Ew.js → chunk-2Q5K7J3B-Ct-A4CCZ.js} +1 -1
  55. package/dist-embed/chunks/{chunk-2Q5K7J3B-C81BMfQj.js → chunk-2Q5K7J3B-Dth1v10p.js} +1 -1
  56. package/dist-embed/chunks/{chunk-2Q5K7J3B-pB9xAJMI.js → chunk-2Q5K7J3B-TussmrZx.js} +1 -1
  57. package/dist-embed/chunks/{chunk-5VM5RSS4-1bQxgqop.js → chunk-5VM5RSS4--_g5ThPK.js} +1 -1
  58. package/dist-embed/chunks/{chunk-5VM5RSS4-BLaN6vZP.js → chunk-5VM5RSS4-EV3_59Fj.js} +1 -1
  59. package/dist-embed/chunks/{chunk-5VM5RSS4-BTk_puBE.js → chunk-5VM5RSS4-PCyW8e7X.js} +1 -1
  60. package/dist-embed/chunks/{chunk-F27PBJKO-Ccv2Z4Dk.js → chunk-F27PBJKO-BEGqbZOG.js} +1 -1
  61. package/dist-embed/chunks/{chunk-F27PBJKO-V8QZRvNX.js → chunk-F27PBJKO-BElpQlek.js} +1 -1
  62. package/dist-embed/chunks/{chunk-F27PBJKO-DIaRuD6P.js → chunk-F27PBJKO-D_dK9KO0.js} +1 -1
  63. package/dist-embed/chunks/{chunk-IMKFNOWR-ChFGHsmA.js → chunk-IMKFNOWR-63rCyYBN.js} +1 -1
  64. package/dist-embed/chunks/{chunk-IMKFNOWR-C6EghkRl.js → chunk-IMKFNOWR-CXlJYg5e.js} +1 -1
  65. package/dist-embed/chunks/{chunk-IMKFNOWR-eUuKtHwj.js → chunk-IMKFNOWR-CvHJsrEQ.js} +1 -1
  66. package/dist-embed/chunks/{chunk-JWPE2WC7-DaXZnYxt.js → chunk-JWPE2WC7-DjRqg4Bs.js} +1 -1
  67. package/dist-embed/chunks/{chunk-JWPE2WC7-C_--LD31.js → chunk-JWPE2WC7-KjfHmyaP.js} +1 -1
  68. package/dist-embed/chunks/{chunk-JWPE2WC7-TEJpnjgJ.js → chunk-JWPE2WC7-i03aNExK.js} +1 -1
  69. package/dist-embed/chunks/{chunk-POPQ4Y6H-C2h36Rd-.js → chunk-POPQ4Y6H-8SJD7Lj6.js} +1 -1
  70. package/dist-embed/chunks/{chunk-POPQ4Y6H-DFDiDT07.js → chunk-POPQ4Y6H-CTgPwukU.js} +1 -1
  71. package/dist-embed/chunks/{chunk-POPQ4Y6H-DE45RGQz.js → chunk-POPQ4Y6H-DD_FZOBG.js} +1 -1
  72. package/dist-embed/chunks/{chunk-SVP7TREG-NHZa_Cm7.js → chunk-SVP7TREG-Be_dVsBv.js} +1 -1
  73. package/dist-embed/chunks/{chunk-SVP7TREG-DuvZnJuX.js → chunk-SVP7TREG-BmKcdcZf.js} +1 -1
  74. package/dist-embed/chunks/{chunk-SVP7TREG-CguX5xuV.js → chunk-SVP7TREG-oWMhd7-x.js} +1 -1
  75. package/dist-embed/chunks/{chunk-TICWLB2K-DZSn1hoa.js → chunk-TICWLB2K-BWrWaYZh.js} +1 -1
  76. package/dist-embed/chunks/{chunk-TICWLB2K-C6yeHtH-.js → chunk-TICWLB2K-DPw0Zd3X.js} +1 -1
  77. package/dist-embed/chunks/{chunk-TICWLB2K-CdnwBh6S.js → chunk-TICWLB2K-oYX1pnTC.js} +1 -1
  78. package/dist-embed/chunks/{chunk-XXDRQBXY-CkHqIglg.js → chunk-XXDRQBXY-B_8mfvZs.js} +1 -1
  79. package/dist-embed/chunks/{chunk-XXDRQBXY-BfS84YmJ.js → chunk-XXDRQBXY-ClhwppX9.js} +1 -1
  80. package/dist-embed/chunks/{chunk-XXDRQBXY-DgalMoCT.js → chunk-XXDRQBXY-DFqSJS_V.js} +1 -1
  81. package/dist-embed/chunks/{classDiagram-ZZMXUADV-3ejDnz-R.js → classDiagram-ZZMXUADV--KG2C8h5.js} +1 -1
  82. package/dist-embed/chunks/{classDiagram-ZZMXUADV-BBfLN17b.js → classDiagram-ZZMXUADV-B7xDgsRr.js} +1 -1
  83. package/dist-embed/chunks/{classDiagram-ZZMXUADV-ClDeAawy.js → classDiagram-ZZMXUADV-DE4to6sK.js} +1 -1
  84. package/dist-embed/chunks/{classDiagram-f62afe4f-BkVbm46G.js → classDiagram-f62afe4f-Dc6e8Her.js} +1 -1
  85. package/dist-embed/chunks/{classDiagram-v2-604399ef-CHjLgl6H.js → classDiagram-v2-604399ef-C495Aipq.js} +1 -1
  86. package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-3ejDnz-R.js → classDiagram-v2-VYDZK3BY--KG2C8h5.js} +1 -1
  87. package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-BBfLN17b.js → classDiagram-v2-VYDZK3BY-B7xDgsRr.js} +1 -1
  88. package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-ClDeAawy.js → classDiagram-v2-VYDZK3BY-DE4to6sK.js} +1 -1
  89. package/dist-embed/chunks/{code-block-IT6T5CEO-Wkpbh9X2.js → code-block-IT6T5CEO-iJrkFsOH.js} +1 -1
  90. package/dist-embed/chunks/{component-CyKYadVm.js → component-DrP6jrik.js} +1 -1
  91. package/dist-embed/chunks/{core-COPCyO2o.js → core-BGGgYrZ9.js} +1 -1
  92. package/dist-embed/chunks/{cose-bilkent-JH36ORCC-5e8DCgyb.js → cose-bilkent-JH36ORCC-Bsk4YY80.js} +1 -1
  93. package/dist-embed/chunks/{cose-bilkent-JH36ORCC-Bi-L9aFT.js → cose-bilkent-JH36ORCC-MSc1rEXR.js} +1 -1
  94. package/dist-embed/chunks/{cose-bilkent-JH36ORCC-CG1KcI5m.js → cose-bilkent-JH36ORCC-tnzM7MrS.js} +1 -1
  95. package/dist-embed/chunks/{createText-aed3d8b3-dWIlVV-C.js → createText-aed3d8b3-PiG8oTtZ.js} +1 -1
  96. package/dist-embed/chunks/{cs-CZ-2BRQDIVT-B1CoQCS8.js → cs-CZ-2BRQDIVT-BlipVn6W.js} +1 -1
  97. package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-DsvgMVdR.js → cynefinDiagram-5FMLGOSQ-BJSLWLpL.js} +1 -1
  98. package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-CMqYhCCV.js → cynefinDiagram-5FMLGOSQ-CBkkpqSz.js} +1 -1
  99. package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-BVOqZUM5.js → cynefinDiagram-5FMLGOSQ-Cxd4hJ0P.js} +1 -1
  100. package/dist-embed/chunks/{da-DK-5WZEPLOC-cOefviqg.js → da-DK-5WZEPLOC-Bw6Ix-Y_.js} +1 -1
  101. package/dist-embed/chunks/{dagre-GXQ25YYZ-Dv7BBqJM.js → dagre-GXQ25YYZ-CkLWQcoy.js} +1 -1
  102. package/dist-embed/chunks/{dagre-GXQ25YYZ-DB5hgFOJ.js → dagre-GXQ25YYZ-DmOK599e.js} +1 -1
  103. package/dist-embed/chunks/{dagre-GXQ25YYZ-DbL89rL1.js → dagre-GXQ25YYZ-u0MmbdNG.js} +1 -1
  104. package/dist-embed/chunks/{de-DE-XR44H4JA-B8A_EIdX.js → de-DE-XR44H4JA-hT0iw9Bo.js} +1 -1
  105. package/dist-embed/chunks/{diagram-S7CK7UJ4-DH-JGQ3O.js → diagram-S7CK7UJ4--1SOVzNY.js} +1 -1
  106. package/dist-embed/chunks/{diagram-S7CK7UJ4-Djh1lnDY.js → diagram-S7CK7UJ4-B7IcrsxK.js} +1 -1
  107. package/dist-embed/chunks/{diagram-S7CK7UJ4-_oQjxS8J.js → diagram-S7CK7UJ4-D0ZMd2cK.js} +1 -1
  108. package/dist-embed/chunks/{diagram-UQ7AKVKN-DrVhyvuK.js → diagram-UQ7AKVKN-CR9r4bhp.js} +1 -1
  109. package/dist-embed/chunks/{diagram-UQ7AKVKN-CkvISpbc.js → diagram-UQ7AKVKN-CZAZODO9.js} +1 -1
  110. package/dist-embed/chunks/{diagram-UQ7AKVKN-rAdoD-XE.js → diagram-UQ7AKVKN-DGk1jOrN.js} +1 -1
  111. package/dist-embed/chunks/{diagram-VSXAHHWV-6xNoFc1e.js → diagram-VSXAHHWV-BGuGdwAu.js} +1 -1
  112. package/dist-embed/chunks/{diagram-VSXAHHWV-BWRulDaN.js → diagram-VSXAHHWV-CPR3SHv_.js} +1 -1
  113. package/dist-embed/chunks/{diagram-VSXAHHWV-Kq0WyfDW.js → diagram-VSXAHHWV-DO0L5yoE.js} +1 -1
  114. package/dist-embed/chunks/{diagram-VX7I27RA-BSENIJml.js → diagram-VX7I27RA-BOMRUaLY.js} +1 -1
  115. package/dist-embed/chunks/{diagram-VX7I27RA-pBVtEscQ.js → diagram-VX7I27RA-BfmIQLZX.js} +1 -1
  116. package/dist-embed/chunks/{diagram-VX7I27RA-B5e3Qv0x.js → diagram-VX7I27RA-DMRKeXbI.js} +1 -1
  117. package/dist-embed/chunks/{diagram-Z3DM3KII-DkTW7b_d.js → diagram-Z3DM3KII-B2OiuH_C.js} +1 -1
  118. package/dist-embed/chunks/{diagram-Z3DM3KII-dQNfxGJA.js → diagram-Z3DM3KII-DAiKcNEv.js} +1 -1
  119. package/dist-embed/chunks/{diagram-Z3DM3KII-CCtO4ivG.js → diagram-Z3DM3KII-DKDeEH1W.js} +1 -1
  120. package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-fRVaHZix.js → ebnfDiagram-PWID7BFC-Cru7ooRB.js} +1 -1
  121. package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-DFo1owyO.js → ebnfDiagram-PWID7BFC-DRjyqxcH.js} +1 -1
  122. package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-DhashMjX.js → ebnfDiagram-PWID7BFC-uMVSPDOp.js} +1 -1
  123. package/dist-embed/chunks/{edges-b2856ca0-CxR_AYFU.js → edges-b2856ca0-Cggl2xrH.js} +1 -1
  124. package/dist-embed/chunks/{el-GR-BZB4AONW-r6OOggAo.js → el-GR-BZB4AONW-BmNYPiJK.js} +1 -1
  125. package/dist-embed/chunks/{erDiagram-5d81789a-pWCuXn86.js → erDiagram-5d81789a-CGBXBycw.js} +1 -1
  126. package/dist-embed/chunks/{erDiagram-RLTQ6QDP-qBMO3ODf.js → erDiagram-RLTQ6QDP-CN1X55A5.js} +1 -1
  127. package/dist-embed/chunks/{erDiagram-RLTQ6QDP-Cn71QFng.js → erDiagram-RLTQ6QDP-CSpJrmyr.js} +1 -1
  128. package/dist-embed/chunks/{erDiagram-RLTQ6QDP-C1-L32ui.js → erDiagram-RLTQ6QDP-DIFLAmTe.js} +1 -1
  129. package/dist-embed/chunks/{es-ES-U4NZUMDT-B_e9d454.js → es-ES-U4NZUMDT-CE7hUJnw.js} +1 -1
  130. package/dist-embed/chunks/{esm-BBkfzxv_.js → esm-Bs-8Cbf_.js} +1 -1
  131. package/dist-embed/chunks/{esm-DEiQo7YS.js → esm-CsO1ipmZ.js} +1 -1
  132. package/dist-embed/chunks/{eu-ES-A7QVB2H4-Blt0C5Cr.js → eu-ES-A7QVB2H4-BUk5broy.js} +1 -1
  133. package/dist-embed/chunks/{fa-IR-HGAKTJCU-CTozxxBD.js → fa-IR-HGAKTJCU-DvlFAlYH.js} +1 -1
  134. package/dist-embed/chunks/{fi-FI-Z5N7JZ37-CyAB-y-D.js → fi-FI-Z5N7JZ37-DzF1j0vM.js} +1 -1
  135. package/dist-embed/chunks/{flowDb-185abca5-mGOFN4Rm.js → flowDb-185abca5-CR_eNtea.js} +1 -1
  136. package/dist-embed/chunks/{flowDiagram-1629c991-BpFY8YdN.js → flowDiagram-1629c991-BUCdGiy7.js} +1 -1
  137. package/dist-embed/chunks/{flowDiagram-HODETNUW-Bid_pFDK.js → flowDiagram-HODETNUW-40v2AZyg.js} +1 -1
  138. package/dist-embed/chunks/{flowDiagram-HODETNUW-luWVHeDm.js → flowDiagram-HODETNUW-Ehnca2ni.js} +1 -1
  139. package/dist-embed/chunks/{flowDiagram-HODETNUW-DK6nfPXm.js → flowDiagram-HODETNUW-rrCrE8ag.js} +1 -1
  140. package/dist-embed/chunks/{flowDiagram-v2-1d953310-D6OBW8Rm.js → flowDiagram-v2-1d953310-C-mQVR3d.js} +1 -1
  141. package/dist-embed/chunks/{flowchart-elk-definition-6df44142-BVaCKHm8.js → flowchart-elk-definition-6df44142-BUjCU9MT.js} +1 -1
  142. package/dist-embed/chunks/{fr-FR-RHASNOE6-DqQdDGJI.js → fr-FR-RHASNOE6-DGF_Vyig.js} +1 -1
  143. package/dist-embed/chunks/{ganttDiagram-3b0b3873-Cv_0V3zO.js → ganttDiagram-3b0b3873-CU1sjzSg.js} +1 -1
  144. package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY-m6mZe7W0.js → ganttDiagram-EL5Y4UJY-B2NVsC-C.js} +1 -1
  145. package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY-DZHrkG45.js → ganttDiagram-EL5Y4UJY-BHLbHQvv.js} +1 -1
  146. package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY--60tKSM9.js → ganttDiagram-EL5Y4UJY-CL_uGZmq.js} +1 -1
  147. package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-aZuraF8j.js → gitGraphDiagram-WWUBYQGX-C9dQonfW.js} +1 -1
  148. package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-DQGRL7uj.js → gitGraphDiagram-WWUBYQGX-CCUBvn_Y.js} +1 -1
  149. package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-BNb2xhKp.js → gitGraphDiagram-WWUBYQGX-DtuCNBUK.js} +1 -1
  150. package/dist-embed/chunks/{gitGraphDiagram-f01e8bc2-C14H7TVH.js → gitGraphDiagram-f01e8bc2-BbkFL6o9.js} +1 -1
  151. package/dist-embed/chunks/{gl-ES-HMX3MZ6V-DqEBlLxz.js → gl-ES-HMX3MZ6V-xM5HzxAU.js} +1 -1
  152. package/dist-embed/chunks/{he-IL-6SHJWFNN-BvhQ--Ic.js → he-IL-6SHJWFNN-nbUgZbH-.js} +1 -1
  153. package/dist-embed/chunks/{hi-IN-IWLTKZ5I-DYH2l25d.js → hi-IN-IWLTKZ5I-Cdlzp28w.js} +1 -1
  154. package/dist-embed/chunks/{hu-HU-A5ZG7DT2-DQgUyc8H.js → hu-HU-A5ZG7DT2-CMH5lTGq.js} +1 -1
  155. package/dist-embed/chunks/{id-ID-SAP4L64H-pbXSdQ7E.js → id-ID-SAP4L64H-Bi5Ltt4D.js} +1 -1
  156. package/dist-embed/chunks/{index-9bae90f3-FAkVZI_I.js → index-9bae90f3-C-MowVD8.js} +1 -1
  157. package/dist-embed/chunks/{index-Bc6gicqV.js → index-BNjq7TZD.js} +1 -1
  158. package/dist-embed/chunks/{index-B6Qu-Ldt.js → index-BQEJgzm9.js} +4 -4
  159. package/dist-embed/chunks/{index-BXARqQ-K.js → index-BjMNv4qG.js} +1 -1
  160. package/dist-embed/chunks/{index-CnpOaqg6.js → index-CUjcBn1v.js} +3 -3
  161. package/dist-embed/chunks/{index-BQ5muxLJ.js → index-Ch2yqELA.js} +15 -15
  162. package/dist-embed/chunks/{index-BIUfp2AH.js → index-DF5urV1Q.js} +1 -1
  163. package/dist-embed/chunks/{index-UqDGAeD4.js → index-D_112S5W.js} +1 -1
  164. package/dist-embed/chunks/{index-C8Ip0RIO.js → index-PwNNIVgK.js} +1 -1
  165. package/dist-embed/chunks/{index-UMhfKl2p.js → index-tO6w-mHa.js} +2 -2
  166. package/dist-embed/chunks/{index-vGRALwj6.js → index-yjEWxzbP.js} +4 -4
  167. package/dist-embed/chunks/{index.esm-zVCHVwV3.js → index.esm-B7H9qIsG.js} +1 -1
  168. package/dist-embed/chunks/{index.esm-DGPDabeX.js → index.esm-CS_7aH6j.js} +1 -1
  169. package/dist-embed/chunks/{infoDiagram-27XIBGKW-B6XclB9A.js → infoDiagram-27XIBGKW-11rIl0SX.js} +1 -1
  170. package/dist-embed/chunks/{infoDiagram-27XIBGKW-BnvfNhoo.js → infoDiagram-27XIBGKW-B7vKfShh.js} +1 -1
  171. package/dist-embed/chunks/{infoDiagram-27XIBGKW-BSmA5qBE.js → infoDiagram-27XIBGKW-DJuz15cI.js} +1 -1
  172. package/dist-embed/chunks/{infoDiagram-a29d40f1-CaObtgvQ.js → infoDiagram-a29d40f1-DY20od-W.js} +1 -1
  173. package/dist-embed/chunks/{isEqual-BybBNsZK.js → isEqual-niFNV5MZ.js} +1 -1
  174. package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-CoYeuvtz.js → ishikawaDiagram-5VMMS53U-BxF1LxPw.js} +1 -1
  175. package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-BjZ55y3a.js → ishikawaDiagram-5VMMS53U-CAgZHNJ1.js} +1 -1
  176. package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-DZof4mVq.js → ishikawaDiagram-5VMMS53U-CGhkG9xO.js} +1 -1
  177. package/dist-embed/chunks/{it-IT-JPQ66NNP-Dfqt8qws.js → it-IT-JPQ66NNP-CQG7I-7I.js} +1 -1
  178. package/dist-embed/chunks/{ja-JP-DBVTYXUO-CJl2BGZ0.js → ja-JP-DBVTYXUO-N1Fy__-x.js} +1 -1
  179. package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-BQbXSJPZ.js → journeyDiagram-3NMN7TZE-BWry4eJr.js} +1 -1
  180. package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-DUk5noZ3.js → journeyDiagram-3NMN7TZE-PMSgj3LU.js} +1 -1
  181. package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-lMh4QSWD.js → journeyDiagram-3NMN7TZE-ymHKbZWG.js} +1 -1
  182. package/dist-embed/chunks/{journeyDiagram-95396277-B-wKHrA2.js → journeyDiagram-95396277-D8JFKSEp.js} +1 -1
  183. package/dist-embed/chunks/{kaa-6HZHGXH3-CkuYTE9k.js → kaa-6HZHGXH3-CV61GofE.js} +1 -1
  184. package/dist-embed/chunks/{kab-KAB-ZGHBKWFO-DwGUYmYz.js → kab-KAB-ZGHBKWFO-pu8Ov9No.js} +1 -1
  185. package/dist-embed/chunks/{kanban-definition-UXKFOSKX-Dfptc1fl.js → kanban-definition-UXKFOSKX-BnOah8Nd.js} +1 -1
  186. package/dist-embed/chunks/{kanban-definition-UXKFOSKX-DsS5AFXs.js → kanban-definition-UXKFOSKX-C_KPxfzn.js} +1 -1
  187. package/dist-embed/chunks/{kanban-definition-UXKFOSKX-D6Efkxin.js → kanban-definition-UXKFOSKX-UuVYvKiH.js} +1 -1
  188. package/dist-embed/chunks/{kk-KZ-P5N5QNE5-hKF6fBok.js → kk-KZ-P5N5QNE5-B8voVV7U.js} +1 -1
  189. package/dist-embed/chunks/{km-KH-HSX4SM5Z-CZBBU2M1.js → km-KH-HSX4SM5Z-C0VX4oEM.js} +1 -1
  190. package/dist-embed/chunks/{ko-KR-MTYHY66A-C-cMpFID.js → ko-KR-MTYHY66A-CcmFHDM1.js} +1 -1
  191. package/dist-embed/chunks/{ku-TR-6OUDTVRD-BhT89N8u.js → ku-TR-6OUDTVRD-CMFEX55_.js} +1 -1
  192. package/dist-embed/chunks/{layout-DwxE-zZ9.js → layout-CFVjfoYF.js} +1 -1
  193. package/dist-embed/chunks/{layout-3P_7xyJi.js → layout-CkB5JWAM.js} +1 -1
  194. package/dist-embed/chunks/{layout-NgpwW7nA.js → layout-oj4w4R5j.js} +1 -1
  195. package/dist-embed/chunks/{lexicalHooks-CVBA8Kup.js → lexicalHooks-Bh9Bp3P-.js} +1 -1
  196. package/dist-embed/chunks/{lib-DdQRcxuM.js → lib-5rtxMXPk.js} +1 -1
  197. package/dist-embed/chunks/{lib-D3T0Aw2k.js → lib-B8dqehoH.js} +1 -1
  198. package/dist-embed/chunks/{lib-BMrXwoDK.js → lib-BCnNB350.js} +1 -1
  199. package/dist-embed/chunks/{lib-USWrkybh.js → lib-BEADLX2g.js} +1 -1
  200. package/dist-embed/chunks/{lib-qTRu1lKk.js → lib-BPAFvW23.js} +1 -1
  201. package/dist-embed/chunks/{lib-HxF1xu1E.js → lib-BQZeV_uH.js} +1 -1
  202. package/dist-embed/chunks/{lib-BkcHzjVY.js → lib-BewlLHfg.js} +1 -1
  203. package/dist-embed/chunks/{lib-ClNhs2cv.js → lib-Bj-F8WWr.js} +1 -1
  204. package/dist-embed/chunks/{lib-DHt04E5T.js → lib-C-Ggs4iB.js} +1 -1
  205. package/dist-embed/chunks/{lib-DlFNTFJX.js → lib-CBSRQHoK.js} +1 -1
  206. package/dist-embed/chunks/{lib-C553WOkt.js → lib-CXZrbtJ9.js} +1 -1
  207. package/dist-embed/chunks/{lib-CfkV3N1c.js → lib-CiFgHF6H.js} +1 -1
  208. package/dist-embed/chunks/{lib-BkgDQr4b.js → lib-Cs68pT1f.js} +5 -5
  209. package/dist-embed/chunks/{lib-K8ZzEBaR.js → lib-D8Qc-bJh.js} +1 -1
  210. package/dist-embed/chunks/{lib-ClnZlQTa.js → lib-D8bmwG1Q.js} +1 -1
  211. package/dist-embed/chunks/{lib-DNqisZNg.js → lib-DDBakXc_.js} +1 -1
  212. package/dist-embed/chunks/{lib-DjYu7LUh.js → lib-DdHOeWKF.js} +1 -1
  213. package/dist-embed/chunks/{lib-CUuelUb1.js → lib-DtwAoDYT.js} +1 -1
  214. package/dist-embed/chunks/{lib-CSYbEQXY.js → lib-bSDF86bC.js} +1 -1
  215. package/dist-embed/chunks/{lib-CcQ1AdFH.js → lib-euir_64d.js} +1 -1
  216. package/dist-embed/chunks/{lt-LT-XHIRWOB4-DAnwG3pL.js → lt-LT-XHIRWOB4-CSs-cwk2.js} +1 -1
  217. package/dist-embed/chunks/{lv-LV-5QDEKY6T-DKutSEbv.js → lv-LV-5QDEKY6T-DBBrXhCL.js} +1 -1
  218. package/dist-embed/chunks/{mermaid.core-BKpjbvr4.js → mermaid.core-59YcUgz5.js} +3 -3
  219. package/dist-embed/chunks/{mermaid.core-BsYC7G_m.js → mermaid.core-BQpV-itu.js} +5 -5
  220. package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-CHG6GkTy.js → mindmap-definition-YA3MSWOX-CDtT_DYs.js} +1 -1
  221. package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-Cpij5zvN.js → mindmap-definition-YA3MSWOX-Cv6GXhbx.js} +1 -1
  222. package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-BVjt4l-I.js → mindmap-definition-YA3MSWOX-Dpx3iQ9G.js} +1 -1
  223. package/dist-embed/chunks/{mindmap-definition-e4c1d938--68TxVLH.js → mindmap-definition-e4c1d938-BAEXTTXT.js} +1 -1
  224. package/dist-embed/chunks/{model-C6vyI0zW.js → model-BUkhfry_.js} +1 -1
  225. package/dist-embed/chunks/{mr-IN-CRQNXWMA-BHnTqpR5.js → mr-IN-CRQNXWMA-BoxiDYTQ.js} +1 -1
  226. package/dist-embed/chunks/{my-MM-5M5IBNSE-D7B2cCpQ.js → my-MM-5M5IBNSE-O2vgzfJi.js} +1 -1
  227. package/dist-embed/chunks/{nb-NO-T6EIAALU-CcZKsAQj.js → nb-NO-T6EIAALU-t_ME7jfF.js} +1 -1
  228. package/dist-embed/chunks/{nl-NL-IS3SIHDZ-Bg4B5s14.js → nl-NL-IS3SIHDZ-CJOgjJen.js} +1 -1
  229. package/dist-embed/chunks/{nn-NO-6E72VCQL-g7xBg2p-.js → nn-NO-6E72VCQL-CKJROtf6.js} +1 -1
  230. package/dist-embed/chunks/{oc-FR-POXYY2M6-Dhbf2zJv.js → oc-FR-POXYY2M6-hekTJXBh.js} +1 -1
  231. package/dist-embed/chunks/{pa-IN-N4M65BXN-KR1yA3_P.js → pa-IN-N4M65BXN-C0nR_lWW.js} +1 -1
  232. package/dist-embed/chunks/{pegDiagram-XKGWAZYB-BIkw8nt9.js → pegDiagram-XKGWAZYB-6GkUf1Ix.js} +1 -1
  233. package/dist-embed/chunks/{pegDiagram-XKGWAZYB-FCAU3TOo.js → pegDiagram-XKGWAZYB-BLi2ATBT.js} +1 -1
  234. package/dist-embed/chunks/{pegDiagram-XKGWAZYB-CE26qzAb.js → pegDiagram-XKGWAZYB-BxHZsnZc.js} +1 -1
  235. package/dist-embed/chunks/{percentages-BXMCSKIN-NdFZNkF5.js → percentages-BXMCSKIN-aDx1Abuj.js} +5 -5
  236. package/dist-embed/chunks/{pieDiagram-E7YTZNPT-7IUSm4Cd.js → pieDiagram-E7YTZNPT-0y9vHfxN.js} +1 -1
  237. package/dist-embed/chunks/{pieDiagram-E7YTZNPT-CmRfYSUK.js → pieDiagram-E7YTZNPT-BuSxz3f3.js} +1 -1
  238. package/dist-embed/chunks/{pieDiagram-E7YTZNPT-DnfolJly.js → pieDiagram-E7YTZNPT-CdMa7Tp_.js} +1 -1
  239. package/dist-embed/chunks/{pieDiagram-c941bede-BOM0hWZE.js → pieDiagram-c941bede-B4wYxQiG.js} +1 -1
  240. package/dist-embed/chunks/{pl-PL-T2D74RX3-BFMj2kIn.js → pl-PL-T2D74RX3-Bz6-nRIX.js} +1 -1
  241. package/dist-embed/chunks/{plugin-L-k9onR1.js → plugin-BeYApBgc.js} +1 -1
  242. package/dist-embed/chunks/{pt-BR-5N22H2LF-QBjImZeD.js → pt-BR-5N22H2LF-CIsrl0RF.js} +1 -1
  243. package/dist-embed/chunks/{pt-PT-UZXXM6DQ-BOajnzhW.js → pt-PT-UZXXM6DQ-Cm5V6d4j.js} +1 -1
  244. package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-CBuCLTK0.js → quadrantDiagram-AXDQQJYC-C3pbnXL8.js} +1 -1
  245. package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-D_YPReS-.js → quadrantDiagram-AXDQQJYC-CR6z5DUd.js} +1 -1
  246. package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-CAX9oQAl.js → quadrantDiagram-AXDQQJYC-CeT_Rjti.js} +1 -1
  247. package/dist-embed/chunks/{quadrantDiagram-cf8b8fe0-r_4FwxxN.js → quadrantDiagram-cf8b8fe0-CkBzFHkI.js} +1 -1
  248. package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-CtOU0UiI.js → railroadDiagram-O6MQD6OU-BdfroHrK.js} +1 -1
  249. package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-Dyq4RidU.js → railroadDiagram-O6MQD6OU-CqW4kNU7.js} +1 -1
  250. package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-CFRdBxSp.js → railroadDiagram-O6MQD6OU-D4k0ckwJ.js} +1 -1
  251. package/dist-embed/chunks/{renderer-DQzulrO-.js → renderer-BTUDFH3O.js} +1 -1
  252. package/dist-embed/chunks/{requirementDiagram-53bda41b-YrNRNVqN.js → requirementDiagram-53bda41b-CGcKbmSY.js} +1 -1
  253. package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-DW6fqUb-.js → requirementDiagram-BXWQKSXE-BZv3TS5_.js} +1 -1
  254. package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-2Tq7Hgrr.js → requirementDiagram-BXWQKSXE-Bx-qNrGP.js} +1 -1
  255. package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-6gtvqQ6g.js → requirementDiagram-BXWQKSXE-Dv-n3Ik2.js} +1 -1
  256. package/dist-embed/chunks/{ro-RO-JPDTUUEW-BicyuCgI.js → ro-RO-JPDTUUEW-BhCiwtAd.js} +1 -1
  257. package/dist-embed/chunks/{ru-RU-B4JR7IUQ-D5Lzo4K2.js → ru-RU-B4JR7IUQ-1R8PROIW.js} +1 -1
  258. package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-DBQ1HZxe.js → sankeyDiagram-P5KCCOFB-B1hPyVOc.js} +1 -1
  259. package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-ywB-7Sh8.js → sankeyDiagram-P5KCCOFB-B23f7m-H.js} +1 -1
  260. package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-Cjqnuiax.js → sankeyDiagram-P5KCCOFB-BK_3FXbs.js} +1 -1
  261. package/dist-embed/chunks/{sankeyDiagram-c3ef121a-BdHUFbke.js → sankeyDiagram-c3ef121a-B7rPgNOw.js} +1 -1
  262. package/dist-embed/chunks/{sequenceDiagram-82a5b84f-BsYsnScA.js → sequenceDiagram-82a5b84f-C_EzuSFh.js} +1 -1
  263. package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-C9wu6JeV.js → sequenceDiagram-WJ2MYXX4-CqoMFij0.js} +1 -1
  264. package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-BIU2Cbmw.js → sequenceDiagram-WJ2MYXX4-DiB7s_Dn.js} +1 -1
  265. package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-tkRuJaD1.js → sequenceDiagram-WJ2MYXX4-f-0nVisj.js} +1 -1
  266. package/dist-embed/chunks/{server-extension-CwZK4t_R.js → server-extension-BjSjt875.js} +1 -1
  267. package/dist-embed/chunks/{sessions-B7ox-mRM.js → sessions-B0EUsrzs.js} +1 -1
  268. package/dist-embed/chunks/{sheet-BRqBiQwD.js → sheet-Do4NLOO5.js} +1 -1
  269. package/dist-embed/chunks/{si-LK-N5RQ5JYF-DFJ2FmYp.js → si-LK-N5RQ5JYF-V5ENer19.js} +1 -1
  270. package/dist-embed/chunks/{sizeCapture-INFHLROL-o5EsXBaa.js → sizeCapture-INFHLROL-Dn38jHtH.js} +1 -1
  271. package/dist-embed/chunks/{sizeCapture-INFHLROL-Cf65oZaf.js → sizeCapture-INFHLROL-_Af6e7vY.js} +1 -1
  272. package/dist-embed/chunks/{sizeCapture-INFHLROL-vFYFzq10.js → sizeCapture-INFHLROL-iClobhK8.js} +1 -1
  273. package/dist-embed/chunks/{sk-SK-C5VTKIMK-8LPB4Lnr.js → sk-SK-C5VTKIMK-CDbew_Lj.js} +1 -1
  274. package/dist-embed/chunks/{sl-SI-NN7IZMDC-B2BOaojE.js → sl-SI-NN7IZMDC-CYGDd2fT.js} +1 -1
  275. package/dist-embed/chunks/{state-CmWU_Gvx.js → state-DOjezY4E.js} +1 -1
  276. package/dist-embed/chunks/{stateDiagram-43e79a5f-BM8vNgoJ.js → stateDiagram-43e79a5f-CGkwABTG.js} +1 -1
  277. package/dist-embed/chunks/{stateDiagram-D77RDMKH-C900iM9W.js → stateDiagram-D77RDMKH-BYf5AFsH.js} +1 -1
  278. package/dist-embed/chunks/{stateDiagram-D77RDMKH-CuPDKatL.js → stateDiagram-D77RDMKH-DL2pkKsX.js} +1 -1
  279. package/dist-embed/chunks/{stateDiagram-D77RDMKH-LWwb-5tB.js → stateDiagram-D77RDMKH-TNAdn7Fw.js} +1 -1
  280. package/dist-embed/chunks/{stateDiagram-v2-2041ed4f-CyS6v5HY.js → stateDiagram-v2-2041ed4f-DOi2jMsy.js} +1 -1
  281. package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-B9nNH36K.js → stateDiagram-v2-MP3YSRHH-BcOB4zh_.js} +1 -1
  282. package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-D0oidLuM.js → stateDiagram-v2-MP3YSRHH-COkC2cKQ.js} +1 -1
  283. package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-CCTFOmE7.js → stateDiagram-v2-MP3YSRHH-Dkn5bUd0.js} +1 -1
  284. package/dist-embed/chunks/{styles-455b33cd-D9VLOwJ1.js → styles-455b33cd-CLktXgUm.js} +1 -1
  285. package/dist-embed/chunks/{styles-f932cba9-Cd5ppA9M.js → styles-f932cba9-BwPvHxRQ.js} +1 -1
  286. package/dist-embed/chunks/{styles-fcc2142b-wYbY1ne5.js → styles-fcc2142b-CAXdEfcj.js} +1 -1
  287. package/dist-embed/chunks/{subset-shared.chunk-BGJYDNE3.js → subset-shared.chunk-C5GbluZS.js} +1 -1
  288. package/dist-embed/chunks/{subset-worker.chunk-DS6Y9CCK.js → subset-worker.chunk-DdgsqZkc.js} +1 -1
  289. package/dist-embed/chunks/{substates-qiB0bt2l.js → substates-DOXz-cie.js} +1 -1
  290. package/dist-embed/chunks/{sv-SE-XGPEYMSR-UPdAYYSP.js → sv-SE-XGPEYMSR-DC1SNPJE.js} +1 -1
  291. package/dist-embed/chunks/{svgDrawCommon-148a3cd9-Fa5fqeh3.js → svgDrawCommon-148a3cd9-CaQ5vpEO.js} +1 -1
  292. package/dist-embed/chunks/{swimlanes-42K2YHIH-BgvIcpoF.js → swimlanes-42K2YHIH-2IxujMpF.js} +1 -1
  293. package/dist-embed/chunks/{swimlanes-42K2YHIH-BBMKjjkW.js → swimlanes-42K2YHIH-BpCz-Rn6.js} +1 -1
  294. package/dist-embed/chunks/{swimlanes-42K2YHIH-Cq7pR56Q.js → swimlanes-42K2YHIH-DU9K-vT0.js} +1 -1
  295. package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-wHfu_rwu.js → swimlanesDiagram-VR7AAH4N-BrV6X3P_.js} +1 -1
  296. package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-gjt8K12P.js → swimlanesDiagram-VR7AAH4N-DXze4cE-.js} +1 -1
  297. package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-BrssO_ZI.js → swimlanesDiagram-VR7AAH4N-wBxLzBji.js} +1 -1
  298. package/dist-embed/chunks/{ta-IN-2NMHFXQM-BA2NukSS.js → ta-IN-2NMHFXQM-DKSKwTtf.js} +1 -1
  299. package/dist-embed/chunks/{th-TH-HPSO5L25-LUayWo7x.js → th-TH-HPSO5L25-Dr1iFJp8.js} +1 -1
  300. package/dist-embed/chunks/{timeline-definition-24CTP7MA-CFvNBz_D.js → timeline-definition-24CTP7MA-BwZDNvPa.js} +1 -1
  301. package/dist-embed/chunks/{timeline-definition-24CTP7MA-Nut54L6A.js → timeline-definition-24CTP7MA-CVfYW-Nc.js} +1 -1
  302. package/dist-embed/chunks/{timeline-definition-24CTP7MA-BKyvL5dI.js → timeline-definition-24CTP7MA-DfMsrwKw.js} +1 -1
  303. package/dist-embed/chunks/{timeline-definition-7545f45a-RSfH6FTC.js → timeline-definition-7545f45a-DWcYkVIi.js} +1 -1
  304. package/dist-embed/chunks/{tr-TR-DEFEU3FU-BwLe2i48.js → tr-TR-DEFEU3FU-A_BYNcri.js} +1 -1
  305. package/dist-embed/chunks/{uk-UA-QMV73CPH-wjLkWFtn.js → uk-UA-QMV73CPH-lmL1fri3.js} +1 -1
  306. package/dist-embed/chunks/{vennDiagram-4TSXK5OY-CfkoE6en.js → vennDiagram-4TSXK5OY-C8_HpFyJ.js} +1 -1
  307. package/dist-embed/chunks/{vennDiagram-4TSXK5OY-iZRiPWDS.js → vennDiagram-4TSXK5OY-CsoLlfBZ.js} +1 -1
  308. package/dist-embed/chunks/{vennDiagram-4TSXK5OY-DcrhwQNy.js → vennDiagram-4TSXK5OY-MUcXUckP.js} +1 -1
  309. package/dist-embed/chunks/{vi-VN-M7AON7JQ-CVJrQXTE.js → vi-VN-M7AON7JQ-mMTEvrN2.js} +1 -1
  310. package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-C5LGiOpU.js → wardleyDiagram-VM6X3IG4-BKVSHBPg.js} +1 -1
  311. package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-CZLSTdrG.js → wardleyDiagram-VM6X3IG4-BksuirOR.js} +1 -1
  312. package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-W6fZ-zLj.js → wardleyDiagram-VM6X3IG4-CoFe_0Hs.js} +1 -1
  313. package/dist-embed/chunks/workbook-sMECd4Jk.js +1 -0
  314. package/dist-embed/chunks/{write-BPEehXmk.js → write-Q_DIQOWJ.js} +1 -1
  315. package/dist-embed/chunks/{xychartDiagram-3f383b91-DgGr7hwA.js → xychartDiagram-3f383b91-BB4yqnEL.js} +1 -1
  316. package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-DLQ3Wwtq.js → xychartDiagram-S5SC5T6Z-B6-P99h2.js} +1 -1
  317. package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-BlXuP2jM.js → xychartDiagram-S5SC5T6Z-BLIy7IJR.js} +1 -1
  318. package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-CsfBzeiF.js → xychartDiagram-S5SC5T6Z-BQlsBmbt.js} +1 -1
  319. package/dist-embed/chunks/{zh-CN-LNUGB5OW-DHFaH2P8.js → zh-CN-LNUGB5OW-DkgLfOH-.js} +1 -1
  320. package/dist-embed/chunks/{zh-HK-E62DVLB3-DKCAFB1q.js → zh-HK-E62DVLB3-bphdQsyC.js} +1 -1
  321. package/dist-embed/chunks/{zh-TW-RAJ6MFWO-D6WATM0Q.js → zh-TW-RAJ6MFWO-f8qOFFzB.js} +1 -1
  322. package/dist-embed/datalayer-app-main.js +32 -31
  323. package/dist-embed/datalayer-app.css +1 -1
  324. package/lib/apps/Application.d.ts +1 -1
  325. package/lib/apps/Application.js +1 -1
  326. package/lib/apps/agentUiPlugins.js +2 -0
  327. package/lib/apps/embed/AppEmbed.d.ts +1 -1
  328. package/lib/apps/embed/visitorApp.d.ts +4 -4
  329. package/lib/apps/embed/visitorApp.js +10 -10
  330. package/lib/apps/plugins/agents/DatalayerAgentBridge.js +1 -1
  331. package/lib/apps/plugins/agents/plugin.d.ts +1 -1
  332. package/lib/apps/plugins/trip-map/TripMapView.d.ts +18 -0
  333. package/lib/apps/plugins/trip-map/TripMapView.js +138 -0
  334. package/lib/apps/plugins/trip-map/index.d.ts +29 -0
  335. package/lib/apps/plugins/trip-map/index.js +75 -0
  336. package/lib/apps/plugins/trip-map/read.d.ts +47 -0
  337. package/lib/apps/plugins/trip-map/read.js +93 -0
  338. package/lib/apps/plugins/trip-map/style.d.ts +46 -0
  339. package/lib/apps/plugins/trip-map/style.js +249 -0
  340. package/lib/apps/presets.d.ts +1 -1
  341. package/lib/portable/hosts/agentClient.d.ts +1 -1
  342. package/lib/portable/hosts/agentClient.js +8 -8
  343. package/lib/portable/hosts/client.d.ts +2 -2
  344. package/lib/portable/hosts/client.js +2 -2
  345. package/lib/portable/hosts/contracts.d.ts +1 -1
  346. package/lib/portable/hosts/contracts.js +1 -1
  347. package/lib/portable/hosts/contracts.json +1 -1
  348. package/lib/specs/actions.js +18 -0
  349. package/lib/specs/agentPresentations.js +1 -1
  350. package/lib/specs/agents/agents.js +10 -4
  351. package/lib/specs/apps.d.ts +1 -1
  352. package/lib/specs/apps.js +35 -17
  353. package/lib/specs/backendTools.d.ts +1 -0
  354. package/lib/specs/backendTools.js +20 -0
  355. package/lib/specs/mcpServers.d.ts +1 -0
  356. package/lib/specs/mcpServers.js +41 -1
  357. package/lib/specs/ui.d.ts +1 -0
  358. package/lib/specs/ui.js +22 -0
  359. package/package.json +3 -1
  360. package/scripts/codegen/generate_mcp_servers.py +3 -1
  361. package/dist-embed/chunks/SpreadsheetPreviewView-BcPYoRJU.js +0 -1
  362. package/dist-embed/chunks/workbook-4v5EV9v6.js +0 -1
@@ -0,0 +1,800 @@
1
+ import{r as En,fe as gy,j as Cd,B as sm,T as _y}from"../datalayer-app-main.js";import{d as yy}from"./browser-CjxI_vdc.js";var Zu={exports:{}};var vy=Zu.exports,om;function xy(){return om||(om=1,(function(ge,se){(function(te,he){ge.exports=he()})(vy,(function(){var te={},he={};function ve(k,h,fe){if(he[k]=fe,k==="index"){var $e="var sharedModule = {}; ("+he.shared+")(sharedModule); ("+he.worker+")(sharedModule);",He={};return he.shared(He),he.index(te,He),typeof window<"u"&&te.setWorkerUrl(window.URL.createObjectURL(new Blob([$e],{type:"text/javascript"}))),te}}ve("shared",["exports"],(function(k){function h(r,e,i,s){return new(i||(i=Promise))((function(o,l){function u(m){try{g(s.next(m))}catch(v){l(v)}}function p(m){try{g(s.throw(m))}catch(v){l(v)}}function g(m){var v;m.done?o(m.value):(v=m.value,v instanceof i?v:new i((function(_){_(v)}))).then(u,p)}g((s=s.apply(r,e||[])).next())}))}function fe(r,e){this.x=r,this.y=e}function $e(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var He,dt;typeof SuppressedError=="function"&&SuppressedError,fe.prototype={clone(){return new fe(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),o=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=o,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:fe},fe.convert=function(r){if(r instanceof fe)return r;if(Array.isArray(r))return new fe(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new fe(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};var st=(function(){if(dt)return He;function r(e,i,s,o){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*(o-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=s,this.p2y=o}return dt=1,He=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,o=0;o<8;o++){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 p=0,g=1;for(s=e,o=0;o<20&&(l=this.sampleCurveX(s),!(Math.abs(l-e)<i));o++)e>l?p=s:g=s,s=.5*(g-p)+p;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},He})(),Ze=$e(st);let Yt,je;function Tr(){return Yt!=null||(Yt=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Yt}function _o(){if(je==null&&(je=!1,Tr())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let s=0;s<25;s++){const o=4*s;e.fillStyle=`rgb(${o},${o+1},${o+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){je=!0;break}}}return je||!1}var $t=1e-6,Zt=typeof Float32Array<"u"?Float32Array:Array;function yo(){var r=new Zt(9);return Zt!=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 en(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 tn(){var r=new Zt(3);return Zt!=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 Ye(r,e,i){var s=new Zt(3);return s[0]=r,s[1]=e,s[2]=i,s}function H(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function J(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function ie(r,e,i){var s=e[0],o=e[1],l=e[2],u=i[0],p=i[1],g=i[2];return r[0]=o*g-l*p,r[1]=l*u-s*g,r[2]=s*p-o*u,r}var Te,Le=we;function Ke(r,e,i){var s=e[0],o=e[1],l=e[2],u=e[3];return r[0]=i[0]*s+i[4]*o+i[8]*l+i[12]*u,r[1]=i[1]*s+i[5]*o+i[9]*l+i[13]*u,r[2]=i[2]*s+i[6]*o+i[10]*l+i[14]*u,r[3]=i[3]*s+i[7]*o+i[11]*l+i[15]*u,r}function Ve(){var r=new Zt(4);return Zt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Je(r,e,i,s){var o=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),p=Math.cos(e),g=Math.sin(i),m=Math.cos(i),v=Math.sin(s),_=Math.cos(s);switch(o){case"xyz":r[0]=u*m*_+p*g*v,r[1]=p*g*_-u*m*v,r[2]=p*m*v+u*g*_,r[3]=p*m*_-u*g*v;break;case"xzy":r[0]=u*m*_-p*g*v,r[1]=p*g*_-u*m*v,r[2]=p*m*v+u*g*_,r[3]=p*m*_+u*g*v;break;case"yxz":r[0]=u*m*_+p*g*v,r[1]=p*g*_-u*m*v,r[2]=p*m*v-u*g*_,r[3]=p*m*_+u*g*v;break;case"yzx":r[0]=u*m*_+p*g*v,r[1]=p*g*_+u*m*v,r[2]=p*m*v-u*g*_,r[3]=p*m*_-u*g*v;break;case"zxy":r[0]=u*m*_-p*g*v,r[1]=p*g*_+u*m*v,r[2]=p*m*v+u*g*_,r[3]=p*m*_-u*g*v;break;case"zyx":r[0]=u*m*_-p*g*v,r[1]=p*g*_+u*m*v,r[2]=p*m*v-u*g*_,r[3]=p*m*_+u*g*v;break;default:throw new Error("Unknown angle order "+o)}return r}function Ge(){var r=new Zt(2);return Zt!=Float32Array&&(r[0]=0,r[1]=0),r}function lt(r,e){var i=new Zt(2);return i[0]=r,i[1]=e,i}tn(),Te=new Zt(4),Zt!=Float32Array&&(Te[0]=0,Te[1]=0,Te[2]=0,Te[3]=0),tn(),Ye(1,0,0),Ye(0,1,0),Ve(),Ve(),yo(),Ge();const Be=8192;function Vt(r,e,i){return e*(Be/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}function Ut(r){return r instanceof Error?r:new Error(typeof r=="string"?r:String(r))}function ar(r,e){return(r%e+e)%e}function Vr(r,e,i){return r*(1-i)+e*i}function _s(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 ys(r,e,i,s){const o=new Ze(r,e,i,s);return l=>o.solve(l)}const Cn=ys(.25,.1,.25,1);function Kt(r,e,i){return Math.min(i,Math.max(e,r))}function An(r,e,i){const s=i-e,o=((r-e)%s+s)%s+e;return o===e?i:o}function di(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}let rn=1;function Sr(r,e,i){const s={};for(const o in r)s[o]=e.call(this,r[o],o,r);return s}function nn(r,e,i){const s={};for(const o in r)e.call(this,r[o],o,r)&&(s[o]=r[o]);return s}function tt(r){return Array.isArray(r)?r.map(tt):typeof r=="object"&&r?Sr(r,tt):r}const si={};function pi(r){si[r]||(typeof console<"u"&&console.warn(r),si[r]=!0)}function Yi(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function oi(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let Vi=null;function xt(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const Ya="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Ka(r,e,i,s,o){return h(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 p=u.startsWith("BGR"),g=new Uint8ClampedArray(s*o*4);if(yield l.copyTo(g,(function(m,v,_,T,b){const I=4*Math.max(-v,0),M=(Math.max(0,_)-_)*T*4+I,A=4*T,D=Math.max(0,v),F=Math.max(0,_);return{rect:{x:D,y:F,width:Math.min(m.width,v+T)-D,height:Math.min(m.height,_+b)-F},layout:[{offset:M,stride:A}]}})(r,e,i,s,o)),p)for(let m=0;m<g.length;m+=4){const v=g[m];g[m]=g[m+2],g[m+2]=v}return g}finally{l.close()}}))}let sn,Dn;function vs(r,e,i,s){return r.addEventListener(e,i,s),{unsubscribe:()=>{r.removeEventListener(e,i,s)}}}function Ja(r){return r*Math.PI/180}function on(r){return r/Math.PI*180}const Qa={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},xs={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},vo="AbortError";class xo extends Error{constructor(e=vo){super(e instanceof Error?e.message:e),this.name=vo,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function an(r){return r instanceof Error&&r.name===vo}function el(r){if(r.aborted)throw new xo(r.reason)}const bs={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function tl(r){return bs.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const bo="global-dispatcher";class ln extends Error{constructor(e,i,s,o){super(`AJAXError: ${i} (${e}): ${s}`),this.status=e,this.statusText=i,this.url=s,this.body=o}}const il=()=>{var r;return oi(self)?(r=self.worker)===null||r===void 0?void 0:r.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href},ws=function(r,e){return h(this,void 0,void 0,(function*(){var i,s;if(r.url.includes("://")&&!/^https?:|^file:/.test(r.url)){const o=tl(r.url);if(o){const l=yield o(r,e);return l.data||r.type!=="arrayBuffer"?l:di(l,{data:new ArrayBuffer(0)})}if(oi(self)&&(!((i=self.worker)===null||i===void 0)&&i.actor))return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:bo},e)}if(!(o=>{var l;return o.startsWith("file:")||((l=il())===null||l===void 0?void 0:l.startsWith("file:"))&&!/^\w+:/.test(o)})(r.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return(function(o,l){return h(this,void 0,void 0,(function*(){const u=new Request(o.url,{method:o.method||"GET",body:o.body,credentials:o.credentials,headers:o.headers,cache:o.cache,referrer:il(),referrerPolicy:o.referrerPolicy,signal:l.signal});let p,g;o.type!=="json"||u.headers.has("Accept")||u.headers.set("Accept","application/json");try{p=yield fetch(u)}catch(v){throw an(v)?v:new ln(0,Ut(v).message,o.url,new Blob)}if(!p.ok){const v=yield p.blob();throw new ln(p.status,p.statusText,o.url,v)}g=o.type==="arrayBuffer"||o.type==="image"?p.arrayBuffer():o.type==="json"?p.json():p.text();const m=yield g;return el(l.signal),{data:m,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires"),etag:p.headers.get("ETag")}}))})(r,e);if(oi(self)&&(!((s=self.worker)===null||s===void 0)&&s.actor))return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:bo},e)}return(function(o,l){return new Promise(((u,p)=>{var g;const m=new XMLHttpRequest;m.open(o.method||"GET",o.url,!0),o.type!=="arrayBuffer"&&o.type!=="image"||(m.responseType="arraybuffer");for(const v in o.headers)m.setRequestHeader(v,o.headers[v]);o.type==="json"&&(m.responseType="text",!((g=o.headers)===null||g===void 0)&&g.Accept||m.setRequestHeader("Accept","application/json")),m.withCredentials=o.credentials==="include",m.onerror=()=>{p(new Error(m.statusText))},m.onload=()=>{if(!l.signal.aborted)if((m.status>=200&&m.status<300||m.status===0)&&m.response!==null){let v=m.response;if(o.type==="json")try{v=JSON.parse(m.response)}catch(_){return void p(_)}u({data:v,cacheControl:m.getResponseHeader("Cache-Control"),expires:m.getResponseHeader("Expires"),etag:m.getResponseHeader("ETag")})}else{const v=new Blob([m.response],{type:m.getResponseHeader("Content-Type")});p(new ln(m.status,m.statusText,o.url,v))}},l.signal.addEventListener("abort",(()=>{m.abort(),p(new xo(l.signal.reason))})),m.send(o.body)}))})(r,e)}))};function zn(r){if(!r||r.indexOf("://")<=0||r.startsWith("data:image/")||r.startsWith("blob:"))return!0;const e=new URL(r),i=window.location;return e.protocol===i.protocol&&e.host===i.host}function Pr(r,e,i){var s;!((s=i[r])===null||s===void 0)&&s.includes(e)||(i[r]||(i[r]=[]),i[r].push(e))}function Ki(r,e,i){if(i?.[r]){const s=i[r].indexOf(e);s!==-1&&i[r].splice(s,1)}}class wo{constructor(e,i={}){di(this,i),this.type=e}}class Ts extends wo{constructor(e,i={}){super("error",di({error:e},i))}}class kn{on(e,i){return this._listeners||(this._listeners={}),Pr(e,i,this._listeners),{unsubscribe:()=>{this.off(e,i)}}}off(e,i){return Ki(e,i,this._listeners),Ki(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners||(this._oneTimeListeners={}),Pr(e,i,this._oneTimeListeners),this):new Promise((s=>this.once(e,s)))}fire(e,i){var s,o;typeof e=="string"&&(e=new wo(e,i||{}));const l=e.type;if(this.listens(l)){e.target=this;const u=!((s=this._listeners)===null||s===void 0)&&s[l]?this._listeners[l].slice():[];for(const m of u)m.call(this,e);const p=!((o=this._oneTimeListeners)===null||o===void 0)&&o[l]?this._oneTimeListeners[l].slice():[];for(const m of p)Ki(l,m,this._oneTimeListeners),m.call(this,e);const g=this._eventedParent;g&&(di(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),g.fire(e))}else e instanceof Ts&&console.error(e.error);return this}listens(e){var i,s,o,l,u;return((s=(i=this._listeners)===null||i===void 0?void 0:i[e])===null||s===void 0?void 0:s.length)>0||((l=(o=this._oneTimeListeners)===null||o===void 0?void 0:o[e])===null||l===void 0?void 0:l.length)>0||((u=this._eventedParent)===null||u===void 0?void 0:u.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}var ce={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const Rn=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Ss(r,e){const i={};for(const s in r)s!=="ref"&&(i[s]=r[s]);return Rn.forEach((s=>{s in e&&(i[s]=e[s])})),i}function ct(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(!ct(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(!ct(r[i],e[i]))return!1;return!0}return r===e}function ji(r,e){r.push(e)}function To(r,e,i){ji(i,{command:"addSource",args:[r,e[r]]})}function Tc(r,e,i){ji(e,{command:"removeSource",args:[r]}),i[r]=!0}function Sc(r,e,i,s){Tc(r,i,s),To(r,e,i)}function rl(r,e,i){let s;for(s in r[i])if(Object.prototype.hasOwnProperty.call(r[i],s)&&s!=="data"&&!ct(r[i][s],e[i][s]))return!1;for(s in e[i])if(Object.prototype.hasOwnProperty.call(e[i],s)&&s!=="data"&&!ct(r[i][s],e[i][s]))return!1;return!0}function So(r,e,i,s,o,l){r=r||{},e=e||{};for(const u in r)Object.prototype.hasOwnProperty.call(r,u)&&(ct(r[u],e[u])||i.push({command:l,args:[s,u,e[u],o]}));for(const u in e)Object.prototype.hasOwnProperty.call(e,u)&&!Object.prototype.hasOwnProperty.call(r,u)&&(ct(r[u],e[u])||i.push({command:l,args:[s,u,e[u],o]}))}function Po(r){return r.id}function cn(r,e){return r[e.id]=e,r}class Se{constructor(e,i,s,o){this.message=(e?`${e}: `:"")+s,o&&(this.identifier=o),i!=null&&i.__line__&&(this.line=i.__line__)}}function un(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}class mr extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class nl{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[s,o]of i)this.bindings[s]=o}concat(e){return new nl(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 Ln={kind:"null"},Ce={kind:"number"},Ne={kind:"string"},We={kind:"boolean"},Jt={kind:"color"},Io={kind:"projectionDefinition"},gr={kind:"object"},qe={kind:"value"},Mo={kind:"collator"},Ps={kind:"formatted"},Fn={kind:"padding"},Is={kind:"colorArray"},Bn={kind:"numberArray"},hn={kind:"resolvedImage"},Ms={kind:"variableAnchorOffsetCollection"};function wi(r,e){return{kind:"array",itemType:r,N:e}}function It(r){if(r.kind==="array"){const e=It(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const Pc=[Ln,Ce,Ne,We,Jt,Io,Ps,gr,wi(qe),Fn,Bn,Is,hn,Ms];function On(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!On(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 Pc)if(!On(i,e))return null}}return`Expected ${It(r)} but found ${It(e)} instead.`}function Eo(r,e){return e.some((i=>i.kind===r.kind))}function jr(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 _r(r,e){return r.kind==="array"&&e.kind==="array"?r.itemType.kind===e.itemType.kind&&typeof r.N=="number":r.kind===e.kind}const Nr=.96422,Es=.82521,sl=4/29,Ur=6/29,Ic=3*Ur*Ur,Co=Ur*Ur*Ur,Wu=Math.PI/180,Vn=180/Math.PI;function Ao(r){return(r%=360)<0&&(r+=360),r}function qt([r,e,i,s]){let o,l;const u=Do((.2225045*(r=ol(r))+.7168786*(e=ol(e))+.0606169*(i=ol(i)))/1);r===e&&e===i?o=l=u:(o=Do((.4360747*r+.3850649*e+.1430804*i)/Nr),l=Do((.0139322*r+.0971045*e+.7141733*i)/Es));const p=116*u-16;return[p<0?0:p,500*(o-u),200*(u-l),s]}function ol(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Do(r){return r>Co?Math.pow(r,1/3):r/Ic+sl}function jn([r,e,i,s]){let o=(r+16)/116,l=isNaN(e)?o:o+e/500,u=isNaN(i)?o:o-i/200;return o=1*al(o),l=Nr*al(l),u=Es*al(u),[zo(3.1338561*l-1.6168667*o-.4906146*u),zo(-.9787684*l+1.9161415*o+.033454*u),zo(.0719453*l-.2289914*o+1.4052427*u),s]}function zo(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function al(r){return r>Ur?r*r*r:Ic*(r-sl)}const Hu=Object.hasOwn||function(r,e){return Object.prototype.hasOwnProperty.call(r,e)};function Nn(r,e){return Hu(r,e)?r[e]:void 0}function ko(r){return parseInt(r.padEnd(2,r),16)/255}function ll(r,e){return Un(e?r/100:r,0,1)}function Un(r,e,i){return Math.min(Math.max(e,r),i)}function Mc(r){return!r.some(Number.isNaN)}const Xu={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 Gr(r,e,i){return r+i*(e-r)}function Gn(r,e,i){return r.map(((s,o)=>Gr(s,e[o],i)))}class et{constructor(e,i,s,o=1,l=!0){this.r=e,this.g=i,this.b=s,this.a=o,l||(this.r*=o,this.g*=o,this.b*=o,o||this.overwriteGetter("rgb",[e,i,s,o]))}static parse(e){if(e instanceof et)return e;if(typeof e!="string")return;const i=(function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];const o=Nn(Xu,s);if(o){const[u,p,g]=o;return[u/255,p/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 p=1;return[ko(s.slice(p,p+=u)),ko(s.slice(p,p+=u)),ko(s.slice(p,p+=u)),ko(s.slice(p,p+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[p,g,m,v,_,T,b,I,M,A,D,F]=u,R=[v||" ",b||" ",A].join("");if(R===" "||R===" /"||R===",,"||R===",,,"){const B=[m,T,M].join(""),V=B==="%%%"?100:B===""?255:0;if(V){const N=[Un(+g/V,0,1),Un(+_/V,0,1),Un(+I/V,0,1),D?ll(+D,F):1];if(Mc(N))return N}}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,p,g,m,v,_,T,b,I]=l,M=[g||" ",v||" ",T].join("");if(M===" "||M===" /"||M===",,"||M===",,,"){const A=[+p,Un(+m,0,100),Un(+_,0,100),b?ll(+b,I):1];if(Mc(A))return(function([D,F,R,B]){function V(N){const K=(N+D/30)%12,Q=F*Math.min(R,1-R);return R-Q*Math.max(-1,Math.min(K-3,9-K,1))}return D=Ao(D),F/=100,R/=100,[V(0),V(8),V(4),B]})(A)}}})(e);return i?new et(...i,!1):void 0}get rgb(){const{r:e,g:i,b:s,a:o}=this,l=o||1/0;return this.overwriteGetter("rgb",[e/l,i/l,s/l,o])}get hcl(){return this.overwriteGetter("hcl",(function(e){const[i,s,o,l]=qt(e),u=Math.sqrt(s*s+o*o);return[Math.round(1e4*u)?Ao(Math.atan2(o,s)*Vn):NaN,u,i,l]})(this.rgb))}get lab(){return this.overwriteGetter("lab",qt(this.rgb))}overwriteGetter(e,i){return Object.defineProperty(this,e,{value:i}),i}toString(){const[e,i,s,o]=this.rgb;return`rgba(${[e,i,s].map((l=>Math.round(255*l))).join(",")},${o})`}static interpolate(e,i,s,o="rgb"){switch(o){case"rgb":{const[l,u,p,g]=Gn(e.rgb,i.rgb,s);return new et(l,u,p,g,!1)}case"hcl":{const[l,u,p,g]=e.hcl,[m,v,_,T]=i.hcl;let b,I;if(isNaN(l)||isNaN(m))isNaN(l)?isNaN(m)?b=NaN:(b=m,p!==1&&p!==0||(I=v)):(b=l,_!==1&&_!==0||(I=u));else{let R=m-l;m>l&&R>180?R-=360:m<l&&l-m>180&&(R+=360),b=l+s*R}const[M,A,D,F]=(function([R,B,V,N]){return R=isNaN(R)?0:R*Wu,jn([V,Math.cos(R)*B,Math.sin(R)*B,N])})([b,I??Gr(u,v,s),Gr(p,_,s),Gr(g,T,s)]);return new et(M,A,D,F,!1)}case"lab":{const[l,u,p,g]=jn(Gn(e.lab,i.lab,s));return new et(l,u,p,g,!1)}}}}et.black=new et(0,0,0,1),et.white=new et(1,1,1,1),et.transparent=new et(0,0,0,0),et.red=new et(1,0,0,1);class cl{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 Ec=["bottom","center","top"];class dn{constructor(e,i,s,o,l,u){this.text=e,this.image=i,this.scale=s,this.fontStack=o,this.textColor=l,this.verticalAlign=u}}class Ni{constructor(e){this.sections=e}static fromString(e){return new Ni([new dn(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 Ni?e:Ni.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map((e=>e.text)).join("")}}class Ti{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ti)return e;if(typeof e=="number")return new Ti([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 Ti(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){return new Ti(Gn(e.values,i.values,s))}}class Wt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Wt)return e;if(typeof e=="number")return new Wt([e]);if(Array.isArray(e)){for(const i of e)if(typeof i!="number")return;return new Wt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){return new Wt(Gn(e.values,i.values,s))}}class ai{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ai)return e;if(typeof e=="string"){const s=et.parse(e);return s?new ai([s]):void 0}if(!Array.isArray(e))return;const i=[];for(const s of e){if(typeof s!="string")return;const o=et.parse(s);if(!o)return;i.push(o)}return new ai(i)}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s,o="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(et.interpolate(e.values[u],i.values[u],s,o));return new ai(l)}}class Ct extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const Yu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Si{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Si)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],o=e[i+1];if(typeof s!="string"||!Yu.has(s)||!Array.isArray(o)||o.length!==2||typeof o[0]!="number"||typeof o[1]!="number")return}return new Si(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){const o=e.values,l=i.values;if(o.length!==l.length)throw new Ct(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${i.toString()}`);const u=[];for(let p=0;p<o.length;p+=2){if(o[p]!==l[p])throw new Ct(`Cannot interpolate values containing mismatched anchors. from[${p}]: ${o[p]}, to[${p}]: ${l[p]}`);u.push(o[p]);const[g,m]=o[p+1],[v,_]=l[p+1];u.push([Gr(g,v,s),Gr(m,_,s)])}return new Si(u)}}class Ui{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Ui({name:e,available:!1}):null}}class Rt{constructor(e,i,s){this.from=e,this.to=i,this.transition=s}static interpolate(e,i,s){return new Rt(e,i,s)}static parse(e){return e instanceof Rt?e:Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"?new Rt(e[0],e[1],e[2]):typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number"?new Rt(e.from,e.to,e.transition):typeof e=="string"?new Rt(e,e,1):void 0}}function it(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 yr(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof Rt||r instanceof et||r instanceof cl||r instanceof Ni||r instanceof Ti||r instanceof Wt||r instanceof ai||r instanceof Si||r instanceof Ui)return!0;if(Array.isArray(r)){for(const e of r)if(!yr(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!yr(r[e]))return!1;return!0}return!1}function gt(r){if(r===null)return Ln;if(typeof r=="string")return Ne;if(typeof r=="boolean")return We;if(typeof r=="number")return Ce;if(r instanceof et)return Jt;if(r instanceof Rt)return Io;if(r instanceof cl)return Mo;if(r instanceof Ni)return Ps;if(r instanceof Ti)return Fn;if(r instanceof Wt)return Bn;if(r instanceof ai)return Is;if(r instanceof Si)return Ms;if(r instanceof Ui)return hn;if(Array.isArray(r)){const e=r.length;let i;for(const s of r){const o=gt(s);if(i){if(i===o)continue;i=qe;break}i=o}return wi(i||qe,e)}return gr}function $n(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof et||r instanceof Rt||r instanceof Ni||r instanceof Ti||r instanceof Wt||r instanceof ai||r instanceof Si||r instanceof Ui?r.toString():JSON.stringify(r)}class $r{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(!yr(e[1]))return i.error("invalid value");const s=e[1];let o=gt(s);const l=i.expectedType;return o.kind!=="array"||o.N!==0||!l||l.kind!=="array"||typeof l.N=="number"&&l.N!==0||(o=l),new $r(o,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Zn={string:Ne,number:Ce,boolean:We,object:gr};class Pi{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,o=1;const l=e[0];if(l==="array"){let p,g;if(e.length>2){const m=e[1];if(typeof m!="string"||!(m in Zn)||m==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);p=Zn[m],o++}else p=qe;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],o++}s=wi(p,g)}else{if(!Zn[l])throw new Error(`Types doesn't contain name = ${l}`);s=Zn[l]}const u=[];for(;o<e.length;o++){const p=i.parse(e[o],o,qe);if(!p)return null;u.push(p)}return new Pi(s,u)}evaluate(e){for(let i=0;i<this.args.length;i++){const s=this.args[i].evaluate(e);if(!On(this.type,gt(s)))return s;if(i===this.args.length-1)throw new Ct(`Expected value to be of type ${It(this.type)}, but found ${It(gt(s))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const Cs={"to-boolean":We,"to-color":Jt,"to-number":Ce,"to-string":Ne};class Ir{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(!Cs[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 o=Cs[s],l=[];for(let u=1;u<e.length;u++){const p=i.parse(e[u],u,qe);if(!p)return null;l.push(p)}return new Ir(o,l)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let i,s;for(const o of this.args){if(i=o.evaluate(e),s=null,i instanceof et)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.`:it(i[0],i[1],i[2],i[3]),!s))return new et(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Ct(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 o=Ti.parse(i);if(o)return o}throw new Ct(`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 o=Wt.parse(i);if(o)return o}throw new Ct(`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 o=ai.parse(i);if(o)return o}throw new Ct(`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 o=Si.parse(i);if(o)return o}throw new Ct(`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 o=Number(i);if(!isNaN(o))return o}throw new Ct(`Could not convert ${JSON.stringify(i)} to number.`)}case"formatted":return Ni.fromString($n(this.args[0].evaluate(e)));case"resolvedImage":return Ui.fromString($n(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return $n(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const ul=["Unknown","Point","LineString","Polygon"];class As{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"?ul[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=et.parse(e),this._parseColorCache.set(e,i)),i}}class Ro{constructor(e,i,s=[],o,l=new nl,u=[]){this.registry=e,this.path=s,this.key=s.map((p=>`[${p}]`)).join(""),this.scope=l,this.errors=u,this.expectedType=o,this._isConstant=i}parse(e,i,s,o,l={}){return i?this.concat(i,s,o)._parse(e,l):this._parse(e,l)}_parse(e,i){function s(o,l,u){return u==="assert"?new Pi(l,[o]):u==="coerce"?new Ir(l,[o]):o}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 o=e[0];if(typeof o!="string")return this.error(`Expression name must be a string, but found ${typeof o} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const l=this.registry[o];if(l){let u=l.parse(e,this);if(!u)return null;if(this.expectedType){const p=this.expectedType,g=u.type;if(p.kind!=="string"&&p.kind!=="number"&&p.kind!=="boolean"&&p.kind!=="object"&&p.kind!=="array"||g.kind!=="value"){if(p.kind==="projectionDefinition"&&["string","array"].includes(g.kind)||["color","formatted","resolvedImage"].includes(p.kind)&&["value","string"].includes(g.kind)||["padding","numberArray"].includes(p.kind)&&["value","number","array"].includes(g.kind)||p.kind==="colorArray"&&["value","string","array"].includes(g.kind)||p.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(g.kind))u=s(u,p,i.typeAnnotation||"coerce");else if(this.checkSubtype(p,g))return null}else u=s(u,p,i.typeAnnotation||"assert")}if(!(u instanceof $r)&&u.type.kind!=="resolvedImage"&&this._isConstant(u)){const p=new As;try{u=new $r(u.type,u.evaluate(p))}catch(g){return this.error(g.message),null}}return u}return this.error(`Unknown expression "${o}". 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 o=typeof e=="number"?this.path.concat(e):this.path,l=s?this.scope.concat(s):this.scope;return new Ro(this.registry,this._isConstant,o,i||null,l,this.errors)}error(e,...i){const s=`${this.key}${i.map((o=>`[${o}]`)).join("")}`;this.errors.push(new mr(s,e))}checkSubtype(e,i){const s=On(e,i);return s&&this.error(s),s}}class pn{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 p=i.parse(e[l+1],l+1);if(!p)return null;s.push([u,p])}const o=i.parse(e[e.length-1],e.length-1,i.expectedType,s);return o?new pn(s,o):null}outputDefined(){return this.result.outputDefined()}}class Mr{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 Mr(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 Lo{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,Ce),o=i.parse(e[2],2,wi(i.expectedType||qe));return s&&o?new Lo(o.type.itemType,s,o):null}evaluate(e){const i=this.index.evaluate(e),s=this.input.evaluate(e);if(i<0)throw new Ct(`Array index out of bounds: ${i} < 0.`);if(i>=s.length)throw new Ct(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i!==Math.floor(i))throw new Ct(`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 Fo{constructor(e,i){this.type=We,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,qe),o=i.parse(e[2],2,qe);return s&&o?Eo(s.type,[We,Ne,Ce,Ln,qe])?new Fo(s,o):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${It(s.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!jr(i,["boolean","string","number","null"]))throw new Ct(`Expected first argument to be of type boolean, string, number or null, but found ${It(gt(i))} instead.`);if(!jr(s,["string","array"]))throw new Ct(`Expected second argument to be of type array or string, but found ${It(gt(s))} instead.`);return s.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Ds{constructor(e,i,s){this.type=Ce,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,qe),o=i.parse(e[2],2,qe);if(!s||!o)return null;if(!Eo(s.type,[We,Ne,Ce,Ln,qe]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${It(s.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,Ce);return l?new Ds(s,o,l):null}return new Ds(s,o)}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!jr(i,["boolean","string","number","null"]))throw new Ct(`Expected first argument to be of type boolean, string, number or null, but found ${It(gt(i))} instead.`);let o;if(this.fromIndex&&(o=this.fromIndex.evaluate(e)),jr(s,["string"])){const l=s.indexOf(i,o);return l===-1?-1:[...s.slice(0,l)].length}if(jr(s,["array"]))return s.indexOf(i,o);throw new Ct(`Expected second argument to be of type array or string, but found ${It(gt(s))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class qn{constructor(e,i,s,o,l,u){this.inputType=e,this.type=i,this.input=s,this.cases=o,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,o;i.expectedType&&i.expectedType.kind!=="value"&&(o=i.expectedType);const l={},u=[];for(let m=2;m<e.length-1;m+=2){let v=e[m];const _=e[m+1];Array.isArray(v)||(v=[v]);const T=i.concat(m);if(v.length===0)return T.error("Expected at least one branch label.");for(const I of v){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,gt(I)))return null}else s=gt(I);if(l[String(I)]!==void 0)return T.error("Branch labels must be unique.");l[String(I)]=u.length}const b=i.parse(_,m,o);if(!b)return null;o=o||b.type,u.push(b)}const p=i.parse(e[1],1,qe);if(!p)return null;const g=i.parse(e[e.length-1],e.length-1,o);return g?p.type.kind!=="value"&&i.concat(1).checkSubtype(s,p.type)?null:new qn(s,o,p,l,u,g):null}evaluate(e){const i=this.input.evaluate(e);return(gt(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 yt{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 o=[];for(let u=1;u<e.length-1;u+=2){const p=i.parse(e[u],u,We);if(!p)return null;const g=i.parse(e[u+1],u+1,s);if(!g)return null;o.push([p,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 yt(s,o,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 Wn{constructor(e,i,s,o){this.type=e,this.input=i,this.beginIndex=s,this.endIndex=o}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,qe),o=i.parse(e[2],2,Ce);if(!s||!o)return null;if(!Eo(s.type,[wi(qe),Ne,qe]))return i.error(`Expected first argument to be of type array or string, but found ${It(s.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,Ce);return l?new Wn(s.type,s,o,l):null}return new Wn(s.type,s,o)}evaluate(e){const i=this.input.evaluate(e),s=this.beginIndex.evaluate(e);let o;if(this.endIndex&&(o=this.endIndex.evaluate(e)),jr(i,["string"]))return[...i].slice(s,o).join("");if(jr(i,["array"]))return i.slice(s,o);throw new Ct(`Expected first argument to be of type array or string, but found ${It(gt(i))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function rt(r,e){const i=r.length-1;let s,o,l=0,u=i,p=0;for(;l<=u;)if(p=Math.floor((l+u)/2),s=r[p],o=r[p+1],s<=e){if(p===i||e<o)return p;l=p+1}else{if(!(s>e))throw new Ct("Input is not a number.");u=p-1}return 0}class Ue{constructor(e,i,s){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[o,l]of s)this.labels.push(o),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,Ce);if(!s)return null;const o=[];let l=null;i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let u=1;u<e.length;u+=2){const p=u===1?-1/0:e[u],g=e[u+1],m=u,v=u+1;if(typeof p!="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(o.length&&o[o.length-1][0]>=p)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',m);const _=i.parse(g,v,l);if(!_)return null;l=l||_.type,o.push([p,_])}return new Ue(l,s,o)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const o=this.input.evaluate(e);if(o<=i[0])return s[0].evaluate(e);const l=i.length;return o>=i[l-1]?s[l-1].evaluate(e):s[rt(i,o)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function hl(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ot,vr,dl=(function(){if(vr)return ot;function r(e,i,s,o){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*(o-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=s,this.p2y=o}return vr=1,ot=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,o=0;o<8;o++){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 p=0,g=1;for(s=e,o=0;o<20&&(l=this.sampleCurveX(s),!(Math.abs(l-e)<i));o++)e>l?p=s:g=s,s=.5*(g-p)+p;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},ot})(),Bo=hl(dl);class Ii{constructor(e,i,s,o,l){this.type=e,this.operator=i,this.interpolation=s,this.input=o,this.labels=[],this.outputs=[];for(const[u,p]of l)this.labels.push(u),this.outputs.push(p)}static interpolationFactor(e,i,s,o){let l=0;if(e.name==="exponential")l=zs(i,e.base,s,o);else if(e.name==="linear")l=zs(i,1,s,o);else if(e.name==="cubic-bezier"){const u=e.controlPoints;l=new Bo(u[0],u[1],u[2],u[3]).solve(zs(i,1,s,o))}return l}static parse(e,i){let[s,o,l,...u]=e;if(!Array.isArray(o)||o.length===0)return i.error("Expected an interpolation type expression.",1);if(o[0]==="linear")o={name:"linear"};else if(o[0]==="exponential"){const m=o[1];if(typeof m!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);o={name:"exponential",base:m}}else{if(o[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(o[0])}`,1,0);{const m=o.slice(1);if(m.length!==4||m.some((v=>typeof v!="number"||v<0||v>1)))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);o={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,Ce),!l)return null;const p=[];let g=null;s!=="interpolate-hcl"&&s!=="interpolate-lab"||i.expectedType==Is?i.expectedType&&i.expectedType.kind!=="value"&&(g=i.expectedType):g=Jt;for(let m=0;m<u.length;m+=2){const v=u[m],_=u[m+1],T=m+3,b=m+4;if(typeof v!="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(p.length&&p[p.length-1][0]>=v)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',T);const I=i.parse(_,b,g);if(!I)return null;g=g||I.type,p.push([v,I])}return _r(g,Ce)||_r(g,Io)||_r(g,Jt)||_r(g,Fn)||_r(g,Bn)||_r(g,Is)||_r(g,Ms)||_r(g,wi(Ce))?new Ii(g,s,o,l,p):i.error(`Type ${It(g)} is not interpolatable.`)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const o=this.input.evaluate(e);if(o<=i[0])return s[0].evaluate(e);const l=i.length;if(o>=i[l-1])return s[l-1].evaluate(e);const u=rt(i,o),p=Ii.interpolationFactor(this.interpolation,o,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 Gr(g,m,p);case"color":return et.interpolate(g,m,p);case"padding":return Ti.interpolate(g,m,p);case"colorArray":return ai.interpolate(g,m,p);case"numberArray":return Wt.interpolate(g,m,p);case"variableAnchorOffsetCollection":return Si.interpolate(g,m,p);case"array":return Gn(g,m,p);case"projectionDefinition":return Rt.interpolate(g,m,p)}case"interpolate-hcl":switch(this.type.kind){case"color":return et.interpolate(g,m,p,"hcl");case"colorArray":return ai.interpolate(g,m,p,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return et.interpolate(g,m,p,"lab");case"colorArray":return ai.interpolate(g,m,p,"lab")}}}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function zs(r,e,i,s){const o=s-i,l=r-i;return o===0?0:e===1?l/o:(Math.pow(e,l)-1)/(Math.pow(e,o)-1)}const lr={color:et.interpolate,number:Gr,padding:Ti.interpolate,numberArray:Wt.interpolate,colorArray:ai.interpolate,variableAnchorOffsetCollection:Si.interpolate,array:Gn};class Oo{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 o=i.expectedType;o&&o.kind!=="value"&&(s=o);const l=[];for(const p of e.slice(1)){const g=i.parse(p,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=o&&l.some((p=>On(o,p.type)));return new Oo(u?qe:s,l)}evaluate(e){let i,s=null,o=0;for(const l of this.args)if(o++,s=l.evaluate(e),s&&s instanceof Ui&&!s.available&&(i||(i=s.name),s=null,o===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 pl(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 fl(r,e,i,s){return s.compare(e,i)===0}function Gi(r,e,i){const s=r!=="=="&&r!=="!=";return class hm{constructor(l,u,p){this.type=We,this.lhs=l,this.rhs=u,this.collator=p,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 p=l[0];let g=u.parse(l[1],1,qe);if(!g)return null;if(!pl(p,g.type))return u.concat(1).error(`"${p}" comparisons are not supported for type '${It(g.type)}'.`);let m=u.parse(l[2],2,qe);if(!m)return null;if(!pl(p,m.type))return u.concat(2).error(`"${p}" comparisons are not supported for type '${It(m.type)}'.`);if(g.type.kind!==m.type.kind&&g.type.kind!=="value"&&m.type.kind!=="value")return u.error(`Cannot compare types '${It(g.type)}' and '${It(m.type)}'.`);s&&(g.type.kind==="value"&&m.type.kind!=="value"?g=new Pi(m.type,[g]):g.type.kind!=="value"&&m.type.kind==="value"&&(m=new Pi(g.type,[m])));let v=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(v=u.parse(l[3],3,Mo),!v)return null}return new hm(g,m,v)}evaluate(l){const u=this.lhs.evaluate(l),p=this.rhs.evaluate(l);if(s&&this.hasUntypedArgument){const g=gt(u),m=gt(p);if(g.kind!==m.kind||g.kind!=="string"&&g.kind!=="number")throw new Ct(`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=gt(u),m=gt(p);if(g.kind!=="string"||m.kind!=="string")return e(l,u,p)}return this.collator?i(l,u,p,this.collator.evaluate(l)):e(l,u,p)}eachChild(l){l(this.lhs),l(this.rhs),this.collator&&l(this.collator)}outputDefined(){return!0}}}const fi=Gi("==",(function(r,e,i){return e===i}),fl),Vo=Gi("!=",(function(r,e,i){return e!==i}),(function(r,e,i,s){return!fl(0,e,i,s)})),Cc=Gi("<",(function(r,e,i){return e<i}),(function(r,e,i,s){return s.compare(e,i)<0})),jo=Gi(">",(function(r,e,i){return e>i}),(function(r,e,i,s){return s.compare(e,i)>0})),Qt=Gi("<=",(function(r,e,i){return e<=i}),(function(r,e,i,s){return s.compare(e,i)<=0})),Ac=Gi(">=",(function(r,e,i){return e>=i}),(function(r,e,i,s){return s.compare(e,i)>=0}));class Hn{constructor(e,i,s){this.type=Mo,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 o=i.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,We);if(!o)return null;const l=i.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,We);if(!l)return null;let u=null;return s.locale&&(u=i.parse(s.locale,1,Ne),!u)?null:new Hn(o,l,u)}evaluate(e){return new cl(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 No{constructor(e,i,s,o,l,u){this.type=Ne,this.number=e,this.locale=i,this.currency=s,this.unit=o,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,Ce);if(!s)return null;const o=e[2];if(typeof o!="object"||Array.isArray(o))return i.error("NumberFormat options argument must be an object.");let l=null;if(o.locale&&(l=i.parse(o.locale,1,Ne),!l))return null;let u=null;if(o.currency&&(u=i.parse(o.currency,1,Ne),!u))return null;let p=null;if(o.unit&&(p=i.parse(o.unit,1,Ne),!p))return null;if(u&&p)return i.error("NumberFormat options `currency` and `unit` are mutually exclusive");let g=null;if(o["min-fraction-digits"]&&(g=i.parse(o["min-fraction-digits"],1,Ce),!g))return null;let m=null;return o["max-fraction-digits"]&&(m=i.parse(o["max-fraction-digits"],1,Ce),!m)?null:new No(s,l,u,p,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 Uo{constructor(e){this.type=Ps,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 o=[];let l=!1;for(let u=1;u<=e.length-1;++u){const p=e[u];if(l&&typeof p=="object"&&!Array.isArray(p)){l=!1;let g=null;if(p["font-scale"]&&(g=i.parse(p["font-scale"],1,Ce),!g))return null;let m=null;if(p["text-font"]&&(m=i.parse(p["text-font"],1,wi(Ne)),!m))return null;let v=null;if(p["text-color"]&&(v=i.parse(p["text-color"],1,Jt),!v))return null;let _=null;if(p["vertical-align"]){if(typeof p["vertical-align"]=="string"&&!Ec.includes(p["vertical-align"]))return i.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${p["vertical-align"]}' instead.`);if(_=i.parse(p["vertical-align"],1,Ne),!_)return null}const T=o[o.length-1];T.scale=g,T.font=m,T.textColor=v,T.verticalAlign=_}else{const g=i.parse(e[u],1,qe);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,o.push({content:g,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Uo(o)}evaluate(e){return new Ni(this.sections.map((i=>{const s=i.content.evaluate(e);return gt(s)===hn?new dn("",s,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(e):null):new dn($n(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 Zr{constructor(e){this.type=hn,this.input=e}static parse(e,i){if(e.length!==2)return i.error("Expected two arguments.");const s=i.parse(e[1],1,Ne);return s?new Zr(s):i.error("No image name provided.")}evaluate(e){const i=this.input.evaluate(e),s=Ui.fromString(i);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(i)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class Xn{constructor(e){this.type=Ce,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 ${It(s.type)} instead.`):new Xn(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 Ct(`Expected value to be of type string or array, but found ${It(gt(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Ji=8192;function Ku(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,o=Math.pow(2,e.z);return[Math.round(i*o*Ji),Math.round(s*o*Ji)]}function Go(r,e){const i=Math.pow(2,e.z);return[(o=(r[0]/Ji+e.x)/i,360*o-180),(s=(r[1]/Ji+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,o}function qr(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 Wr(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function cr(r,e,i){const s=r[0]-e[0],o=r[1]-e[1],l=r[0]-i[0],u=r[1]-i[1];return s*u-l*o==0&&s*l<=0&&o*u<=0}function ks(r,e,i,s){return(o=[s[0]-i[0],s[1]-i[1]])[0]*(l=[e[0]-r[0],e[1]-r[1]])[1]-o[1]*l[0]!=0&&!(!zc(r,e,i,s)||!zc(i,s,r,e));var o,l}function $o(r,e,i){for(const s of i)for(let o=0;o<s.length-1;++o)if(ks(r,e,s[o],s[o+1]))return!0;return!1}function Yn(r,e,i=!1){let s=!1;for(const p of e)for(let g=0;g<p.length-1;g++){if(cr(r,p[g],p[g+1]))return i;(l=p[g])[1]>(o=r)[1]!=(u=p[g+1])[1]>o[1]&&o[0]<(u[0]-l[0])*(o[1]-l[1])/(u[1]-l[1])+l[0]&&(s=!s)}var o,l,u;return s}function ml(r,e){for(const i of e)if(Yn(r,i))return!0;return!1}function Dc(r,e){for(const i of r)if(!Yn(i,e))return!1;for(let i=0;i<r.length-1;++i)if($o(r[i],r[i+1],e))return!1;return!0}function Ju(r,e){for(const i of e)if(Dc(r,i))return!0;return!1}function zc(r,e,i,s){const o=s[0]-i[0],l=s[1]-i[1],u=(r[0]-i[0])*l-o*(r[1]-i[1]),p=(e[0]-i[0])*l-o*(e[1]-i[1]);return u>0&&p<0||u<0&&p>0}function gl(r,e,i){const s=[];for(let o=0;o<r.length;o++){const l=[];for(let u=0;u<r[o].length;u++){const p=Ku(r[o][u],i);qr(e,p),l.push(p)}s.push(l)}return s}function Rs(r,e,i){const s=[];for(let o=0;o<r.length;o++){const l=gl(r[o],e,i);s.push(l)}return s}function kc(r,e,i,s){if(r[0]<i[0]||r[0]>i[2]){const o=.5*s;let l=r[0]-i[0]>o?-s:i[0]-r[0]>o?s:0;l===0&&(l=r[0]-i[2]>o?-s:i[2]-r[0]>o?s:0),r[0]+=l}qr(e,r)}function _l(r,e,i,s){const o=Math.pow(2,s.z)*Ji,l=[s.x*Ji,s.y*Ji],u=[];for(const p of r)for(const g of p){const m=[g.x+l[0],g.y+l[1]];kc(m,e,i,o),u.push(m)}return u}function yl(r,e,i,s){const o=Math.pow(2,s.z)*Ji,l=[s.x*Ji,s.y*Ji],u=[];for(const g of r){const m=[];for(const v of g){const _=[v.x+l[0],v.y+l[1]];qr(e,_),m.push(_)}u.push(m)}if(e[2]-e[0]<=o/2){(p=e)[0]=p[1]=1/0,p[2]=p[3]=-1/0;for(const g of u)for(const m of g)kc(m,e,i,o)}var p;return u}class fn{constructor(e,i){this.type=We,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(yr(e[1])){const s=e[1];if(s.type==="FeatureCollection"){const o=[];for(const l of s.features){const{type:u,coordinates:p}=l.geometry;u==="Polygon"&&o.push(p),u==="MultiPolygon"&&o.push(...p)}if(o.length)return new fn(s,{type:"MultiPolygon",coordinates:o})}else if(s.type==="Feature"){const o=s.geometry.type;if(o==="Polygon"||o==="MultiPolygon")return new fn(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new fn(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 o=[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 p=gl(s.coordinates,l,u),g=_l(i.geometry(),o,l,u);if(!Wr(o,l))return!1;for(const m of g)if(!Yn(m,p))return!1}if(s.type==="MultiPolygon"){const p=Rs(s.coordinates,l,u),g=_l(i.geometry(),o,l,u);if(!Wr(o,l))return!1;for(const m of g)if(!ml(m,p))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,s){const o=[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 p=gl(s.coordinates,l,u),g=yl(i.geometry(),o,l,u);if(!Wr(o,l))return!1;for(const m of g)if(!Dc(m,p))return!1}if(s.type==="MultiPolygon"){const p=Rs(s.coordinates,l,u),g=yl(i.geometry(),o,l,u);if(!Wr(o,l))return!1;for(const m of g)if(!Ju(m,p))return!1}return!0})(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let vl=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 o=r-1>>1,l=e[o];if(i(s,l)>=0)break;e[r]=l,r=o}e[r]=s}_down(r){const{data:e,compare:i}=this,s=this.length>>1,o=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],o)>=0)break;e[r]=e[l],r=l}e[r]=o}};function Rc(r,e,i=0,s=r.length-1,o=Qu){for(;s>i;){if(s-i>600){const g=s-i+1,m=e-i+1,v=Math.log(g),_=.5*Math.exp(2*v/3),T=.5*Math.sqrt(v*_*(g-_)/g)*(m-g/2<0?-1:1);Rc(r,e,Math.max(i,Math.floor(e-m*_/g+T)),Math.min(s,Math.floor(e+(g-m)*_/g+T)),o)}const l=r[e];let u=i,p=s;for(Ls(r,i,e),o(r[s],l)>0&&Ls(r,i,s);u<p;){for(Ls(r,u,p),u++,p--;o(r[u],l)<0;)u++;for(;o(r[p],l)>0;)p--}o(r[i],l)===0?Ls(r,i,p):(p++,Ls(r,p,s)),p<=e&&(i=p+1),e<=p&&(s=p-1)}}function Ls(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function Qu(r,e){return r<e?-1:r>e?1:0}function Zo(r,e){if(r.length<=1)return[r];const i=[];let s,o;for(const l of r){const u=Lc(l);u!==0&&(l.area=Math.abs(u),o===void 0&&(o=u<0),o===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||(Rc(i[l],e,1,i[l].length-1,eh),i[l]=i[l].slice(0,e));return i}function eh(r,e){return e.area-r.area}function Lc(r){let e=0;for(let i,s,o=0,l=r.length,u=l-1;o<l;u=o++)i=r[o],s=r[u],e+=(s.x-i.x)*(i.y+s.y);return e}const xl=1/298.257223563,bl=xl*(2-xl),Fc=Math.PI/180;class wl{constructor(e){const i=6378.137*Fc*1e3,s=Math.cos(e*Fc),o=1/(1-bl*(1-s*s)),l=Math.sqrt(o);this.kx=i*l*s,this.ky=i*l*o*(1-bl)}distance(e,i){const s=this.wrap(e[0]-i[0])*this.kx,o=(e[1]-i[1])*this.ky;return Math.sqrt(s*s+o*o)}pointOnLine(e,i){let s,o,l,u,p=1/0;for(let g=0;g<e.length-1;g++){let m=e[g][0],v=e[g][1],_=this.wrap(e[g+1][0]-m)*this.kx,T=(e[g+1][1]-v)*this.ky,b=0;_===0&&T===0||(b=(this.wrap(i[0]-m)*this.kx*_+(i[1]-v)*this.ky*T)/(_*_+T*T),b>1?(m=e[g+1][0],v=e[g+1][1]):b>0&&(m+=_/this.kx*b,v+=T/this.ky*b)),_=this.wrap(i[0]-m)*this.kx,T=(i[1]-v)*this.ky;const I=_*_+T*T;I<p&&(p=I,s=m,o=v,l=g,u=b)}return{point:[s,o],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 Bc(r,e){return e[0]-r[0]}function qo(r){return r[1]-r[0]+1}function Qi(r,e){return r[1]>=r[0]&&r[1]<e}function Tl(r,e){if(r[0]>r[1])return[null,null];const i=qo(r);if(e){if(i===2)return[r,null];const o=Math.floor(i/2);return[[r[0],r[0]+o],[r[0]+o,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 Sl(r,e){if(!Qi(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)qr(i,r[s]);return i}function Pl(r){const e=[1/0,1/0,-1/0,-1/0];for(const i of r)for(const s of i)qr(e,s);return e}function Oc(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function Fs(r,e,i){if(!Oc(r)||!Oc(e))return NaN;let s=0,o=0;return r[2]<e[0]&&(s=e[0]-r[2]),r[0]>e[2]&&(s=r[0]-e[2]),r[1]>e[3]&&(o=r[1]-e[3]),r[3]<e[1]&&(o=e[1]-r[3]),i.distance([0,0],[s,o])}function Hr(r,e,i){const s=i.pointOnLine(e,r);return i.distance(r,s.point)}function Il(r,e,i,s,o){const l=Math.min(Hr(r,[i,s],o),Hr(e,[i,s],o)),u=Math.min(Hr(i,[r,e],o),Hr(s,[r,e],o));return Math.min(l,u)}function th(r,e,i,s,o){if(!Qi(e,r.length)||!Qi(s,i.length))return 1/0;let l=1/0;for(let u=e[0];u<e[1];++u){const p=r[u],g=r[u+1];for(let m=s[0];m<s[1];++m){const v=i[m],_=i[m+1];if(ks(p,g,v,_))return 0;l=Math.min(l,Il(p,g,v,_,o))}}return l}function Vc(r,e,i,s,o){if(!Qi(e,r.length)||!Qi(s,i.length))return NaN;let l=1/0;for(let u=e[0];u<=e[1];++u)for(let p=s[0];p<=s[1];++p)if(l=Math.min(l,o.distance(r[u],i[p])),l===0)return l;return l}function jc(r,e,i){if(Yn(r,e,!0))return 0;let s=1/0;for(const o of e){const l=o[0],u=o[o.length-1];if(l!==u&&(s=Math.min(s,Hr(r,[u,l],i)),s===0))return s;const p=i.pointOnLine(o,r);if(s=Math.min(s,i.distance(r,p.point)),s===0)return s}return s}function ih(r,e,i,s){if(!Qi(e,r.length))return NaN;for(let l=e[0];l<=e[1];++l)if(Yn(r[l],i,!0))return 0;let o=1/0;for(let l=e[0];l<e[1];++l){const u=r[l],p=r[l+1];for(const g of i)for(let m=0,v=g.length,_=v-1;m<v;_=m++){const T=g[_],b=g[m];if(ks(u,p,T,b))return 0;o=Math.min(o,Il(u,p,T,b,s))}}return o}function Nc(r,e){for(const i of r)for(const s of i)if(Yn(s,e,!0))return!0;return!1}function rh(r,e,i,s=1/0){const o=Pl(r),l=Pl(e);if(s!==1/0&&Fs(o,l,i)>=s)return s;if(Wr(o,l)){if(Nc(r,e))return 0}else if(Nc(e,r))return 0;let u=1/0;for(const p of r)for(let g=0,m=p.length,v=m-1;g<m;v=g++){const _=p[v],T=p[g];for(const b of e)for(let I=0,M=b.length,A=M-1;I<M;A=I++){const D=b[A],F=b[I];if(ks(_,T,D,F))return 0;u=Math.min(u,Il(_,T,D,F,i))}}return u}function Ml(r,e,i,s,o,l){if(!l)return;const u=Fs(Sl(s,l),o,i);u<e&&r.push([u,l,[0,0]])}function Wo(r,e,i,s,o,l,u){if(!l||!u)return;const p=Fs(Sl(s,l),Sl(o,u),i);p<e&&r.push([p,l,u])}function Ho(r,e,i,s,o=1/0){let l=Math.min(s.distance(r[0],i[0][0]),o);if(l===0)return l;const u=new vl([[0,[0,r.length-1],[0,0]]],Bc),p=Pl(i);for(;u.length>0;){const g=u.pop();if(g[0]>=l)continue;const m=g[1],v=e?50:100;if(qo(m)<=v){if(!Qi(m,r.length))return NaN;if(e){const _=ih(r,m,i,s);if(isNaN(_)||_===0)return _;l=Math.min(l,_)}else for(let _=m[0];_<=m[1];++_){const T=jc(r[_],i,s);if(l=Math.min(l,T),l===0)return 0}}else{const _=Tl(m,e);Ml(u,l,s,r,p,_[0]),Ml(u,l,s,r,p,_[1])}}return l}function Xo(r,e,i,s,o,l=1/0){let u=Math.min(l,o.distance(r[0],i[0]));if(u===0)return u;const p=new vl([[0,[0,r.length-1],[0,i.length-1]]],Bc);for(;p.length>0;){const g=p.pop();if(g[0]>=u)continue;const m=g[1],v=g[2],_=e?50:100,T=s?50:100;if(qo(m)<=_&&qo(v)<=T){if(!Qi(m,r.length)&&Qi(v,i.length))return NaN;let b;if(e&&s)b=th(r,m,i,v,o),u=Math.min(u,b);else if(e&&!s){const I=r.slice(m[0],m[1]+1);for(let M=v[0];M<=v[1];++M)if(b=Hr(i[M],I,o),u=Math.min(u,b),u===0)return u}else if(!e&&s){const I=i.slice(v[0],v[1]+1);for(let M=m[0];M<=m[1];++M)if(b=Hr(r[M],I,o),u=Math.min(u,b),u===0)return u}else b=Vc(r,m,i,v,o),u=Math.min(u,b)}else{const b=Tl(m,e),I=Tl(v,s);Wo(p,u,o,r,i,b[0],I[0]),Wo(p,u,o,r,i,b[0],I[1]),Wo(p,u,o,r,i,b[1],I[0]),Wo(p,u,o,r,i,b[1],I[1])}}return u}function El(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 nt{constructor(e,i){this.type=Ce,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(yr(e[1])){const s=e[1];if(s.type==="FeatureCollection")return new nt(s,s.features.map((o=>El(o.geometry))).flat());if(s.type==="Feature")return new nt(s,El(s.geometry));if("type"in s&&"coordinates"in s)return new nt(s,El(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 o=i.geometry(),l=o.flat().map((g=>Go([g.x,g.y],i.canonical)));if(o.length===0)return NaN;const u=new wl(l[0][1]);let p=1/0;for(const g of s){switch(g.type){case"Point":p=Math.min(p,Xo(l,!1,[g.coordinates],!1,u,p));break;case"LineString":p=Math.min(p,Xo(l,!1,g.coordinates,!0,u,p));break;case"Polygon":p=Math.min(p,Ho(l,!1,g.coordinates,u,p))}if(p===0)return p}return p})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,s){const o=i.geometry(),l=o.flat().map((g=>Go([g.x,g.y],i.canonical)));if(o.length===0)return NaN;const u=new wl(l[0][1]);let p=1/0;for(const g of s){switch(g.type){case"Point":p=Math.min(p,Xo(l,!0,[g.coordinates],!1,u,p));break;case"LineString":p=Math.min(p,Xo(l,!0,g.coordinates,!0,u,p));break;case"Polygon":p=Math.min(p,Ho(l,!0,g.coordinates,u,p))}if(p===0)return p}return p})(e,this.geometries);if(e.geometryType()==="Polygon")return(function(i,s){const o=i.geometry();if(o.length===0||o[0].length===0)return NaN;const l=Zo(o,0).map((g=>g.map((m=>m.map((v=>Go([v.x,v.y],i.canonical))))))),u=new wl(l[0][0][0][1]);let p=1/0;for(const g of s)for(const m of l){switch(g.type){case"Point":p=Math.min(p,Ho([g.coordinates],!1,m,u,p));break;case"LineString":p=Math.min(p,Ho(g.coordinates,!0,m,u,p));break;case"Polygon":p=Math.min(p,rh(m,g.coordinates,u,p))}if(p===0)return p}return p})(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Bs{constructor(e){this.type=qe,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 Bs(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?Nn(s,this.key):null}eachChild(){}outputDefined(){return!1}}const Kn={"==":fi,"!=":Vo,">":jo,"<":Cc,">=":Ac,"<=":Qt,array:Pi,at:Lo,boolean:Pi,case:yt,coalesce:Oo,collator:Hn,format:Uo,image:Zr,in:Fo,"index-of":Ds,interpolate:Ii,"interpolate-hcl":Ii,"interpolate-lab":Ii,length:Xn,let:pn,literal:$r,match:qn,number:Pi,"number-format":No,object:Pi,slice:Wn,step:Ue,string:Pi,"to-boolean":Ir,"to-color":Ir,"to-number":Ir,"to-string":Ir,var:Mr,within:fn,distance:nt,"global-state":Bs};class er{constructor(e,i,s,o){this.name=e,this.type=i,this._evaluate=s,this.args=o}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],o=er.definitions[s];if(!o)return i.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const l=Array.isArray(o)?o[0]:o.type,u=Array.isArray(o)?[[o[1],o[2]]]:o.overloads,p=u.filter((([m])=>!Array.isArray(m)||m.length===e.length-1));let g=null;for(const[m,v]of p){g=new Ro(i.registry,Yo,i.path,null,i.scope);const _=[];let T=!1;for(let b=1;b<e.length;b++){const I=e[b],M=Array.isArray(m)?m[b-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 b=0;b<_.length;b++){const I=Array.isArray(m)?m[b]:m.type,M=_[b];g.concat(b+1).checkSubtype(I,M.type)}if(g.errors.length===0)return new er(s,l,v,_)}}if(p.length===1)i.errors.push(...g.errors);else{const m=(p.length?p:u).map((([_])=>{return T=_,Array.isArray(T)?`(${T.map(It).join(", ")})`:`(${It(T.type)}...)`;var T})).join(" | "),v=[];for(let _=1;_<e.length;_++){const T=i.parse(e[_],1+v.length);if(!T)return null;v.push(It(T.type))}i.error(`Expected arguments of type ${m}, but found (${v.join(", ")}) instead.`)}return null}static register(e,i){er.definitions=i;for(const s in i)e[s]=er}}function Uc(r,[e,i,s,o]){e=e.evaluate(r),i=i.evaluate(r),s=s.evaluate(r);const l=o?o.evaluate(r):1,u=it(e,i,s,l);if(u)throw new Ct(u);return new et(e/255,i/255,s/255,l,!1)}function Gc(r,e){return r in e}function Cl(r,e){const i=e[r];return i===void 0?null:i}function mn(r){return{type:r}}function Yo(r){if(r instanceof Mr)return Yo(r.boundExpression);if(r instanceof er&&r.name==="error"||r instanceof Hn||r instanceof fn||r instanceof nt||r instanceof Bs)return!1;const e=r instanceof Ir||r instanceof Pi;let i=!0;return r.eachChild((s=>{i=e?i&&Yo(s):i&&s instanceof $r})),!!i&&Ko(r)&&Jo(r,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Ko(r){if(r instanceof er&&(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 fn||r instanceof nt)return!1;let e=!0;return r.eachChild((i=>{e&&!Ko(i)&&(e=!1)})),e}function Os(r){if(r instanceof er&&r.name==="feature-state")return!1;let e=!0;return r.eachChild((i=>{e&&!Os(i)&&(e=!1)})),e}function Jo(r,e){if(r instanceof er&&e.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild((s=>{i&&!Jo(s,e)&&(i=!1)})),i}function $c(r){return{result:"success",value:r}}function Jn(r){return{result:"error",value:r}}function Qn(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function Zc(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function Al(r){return!!r.expression&&r.expression.interpolated}function Xe(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function Qo(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&gt(r)===gr}function nh(r){return r}function qc(r,e){const i=r.stops&&typeof r.stops[0][0]=="object",s=i||!(i||r.property!==void 0),o=r.type||(Al(e)?"exponential":"interval"),l=(function(v){switch(v.type){case"color":return et.parse;case"padding":return Ti.parse;case"numberArray":return Wt.parse;case"colorArray":return ai.parse;default:return null}})(e);if(l&&((r=un({},r)).stops&&(r.stops=r.stops.map((v=>[v[0],l(v[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 p=(function(v){switch(v){case"exponential":return Wc;case"interval":return oh;case"categorical":return sh;case"identity":return ah;default:throw new Error(`Unknown function type "${v}"`)}})(o);let g,m;if(o==="categorical"){g=Object.create(null);for(const v of r.stops)g[v[0]]=v[1];m=typeof r.stops[0][0]}if(i){const v={},_=[];for(let I=0;I<r.stops.length;I++){const M=r.stops[I],A=M[0].zoom;v[A]===void 0&&(v[A]={zoom:A,type:r.type,property:r.property,default:r.default,stops:[]},_.push(A)),v[A].stops.push([M[0].value,M[1]])}const T=[];for(const I of _)T.push([v[I].zoom,qc(v[I],e)]);const b={name:"linear"};return{kind:"composite",interpolationType:b,interpolationFactor:Ii.interpolationFactor.bind(void 0,b),zoomStops:T.map((I=>I[0])),evaluate:({zoom:I},M)=>Wc({stops:T,base:r.base},e,I).evaluate(I,M)}}if(s){const v=o==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:v,interpolationFactor:Ii.interpolationFactor.bind(void 0,v),zoomStops:r.stops.map((_=>_[0])),evaluate:({zoom:_})=>p(r,e,_,g,m)}}return{kind:"source",evaluate(v,_){const T=_&&_.properties?_.properties[r.property]:void 0;return T===void 0?Vs(r.default,e.default):p(r,e,T,g,m)}}}function Vs(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function sh(r,e,i,s,o){return Vs(typeof i===o?s[i]:void 0,r.default,e.default)}function oh(r,e,i){if(Xe(i)!=="number")return Vs(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 o=rt(r.stops.map((l=>l[0])),i);return r.stops[o][1]}function Wc(r,e,i){const s=r.base!==void 0?r.base:1;if(Xe(i)!=="number")return Vs(r.default,e.default);const o=r.stops.length;if(o===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[o-1][0])return r.stops[o-1][1];const l=rt(r.stops.map((v=>v[0])),i),u=(function(v,_,T,b){const I=b-T,M=v-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]),p=r.stops[l][1],g=r.stops[l+1][1],m=lr[e.type]||nh;return typeof p.evaluate=="function"?{evaluate(...v){const _=p.evaluate.apply(void 0,v),T=g.evaluate.apply(void 0,v);if(_!==void 0&&T!==void 0)return m(_,T,u,r.colorSpace)}}:m(p,g,u,r.colorSpace)}function ah(r,e,i){switch(e.type){case"color":i=et.parse(i);break;case"formatted":i=Ni.fromString(i.toString());break;case"resolvedImage":i=Ui.fromString(i.toString());break;case"padding":i=Ti.parse(i);break;case"colorArray":i=ai.parse(i);break;case"numberArray":i=Wt.parse(i);break;default:Xe(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0)}return Vs(i,r.default,e.default)}er.register(Kn,{error:[{kind:"error"},[Ne],(r,[e])=>{throw new Ct(e.evaluate(r))}],typeof:[Ne,[qe],(r,[e])=>It(gt(e.evaluate(r)))],"to-rgba":[wi(Ce,4),[Jt],(r,[e])=>{const[i,s,o,l]=e.evaluate(r).rgb;return[255*i,255*s,255*o,l]}],rgb:[Jt,[Ce,Ce,Ce],Uc],rgba:[Jt,[Ce,Ce,Ce,Ce],Uc],has:{type:We,overloads:[[[Ne],(r,[e])=>Gc(e.evaluate(r),r.properties())],[[Ne,gr],(r,[e,i])=>Gc(e.evaluate(r),i.evaluate(r))]]},get:{type:qe,overloads:[[[Ne],(r,[e])=>Cl(e.evaluate(r),r.properties())],[[Ne,gr],(r,[e,i])=>Cl(e.evaluate(r),i.evaluate(r))]]},"feature-state":[qe,[Ne],(r,[e])=>Cl(e.evaluate(r),r.featureState||{})],properties:[gr,[],r=>r.properties()],"geometry-type":[Ne,[],r=>r.geometryType()],id:[qe,[],r=>r.id()],zoom:[Ce,[],r=>r.globals.zoom],"heatmap-density":[Ce,[],r=>r.globals.heatmapDensity||0],elevation:[Ce,[],r=>r.globals.elevation||0],"line-progress":[Ce,[],r=>r.globals.lineProgress||0],accumulated:[qe,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[Ce,mn(Ce),(r,e)=>{let i=0;for(const s of e)i+=s.evaluate(r);return i}],"*":[Ce,mn(Ce),(r,e)=>{let i=1;for(const s of e)i*=s.evaluate(r);return i}],"-":{type:Ce,overloads:[[[Ce,Ce],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[Ce],(r,[e])=>-e.evaluate(r)]]},"/":[Ce,[Ce,Ce],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[Ce,[Ce,Ce],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[Ce,[],()=>Math.LN2],pi:[Ce,[],()=>Math.PI],e:[Ce,[],()=>Math.E],"^":[Ce,[Ce,Ce],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[Ce,[Ce],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[Ce,[Ce],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[Ce,[Ce],(r,[e])=>Math.log(e.evaluate(r))],log2:[Ce,[Ce],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[Ce,[Ce],(r,[e])=>Math.sin(e.evaluate(r))],cos:[Ce,[Ce],(r,[e])=>Math.cos(e.evaluate(r))],tan:[Ce,[Ce],(r,[e])=>Math.tan(e.evaluate(r))],asin:[Ce,[Ce],(r,[e])=>Math.asin(e.evaluate(r))],acos:[Ce,[Ce],(r,[e])=>Math.acos(e.evaluate(r))],atan:[Ce,[Ce],(r,[e])=>Math.atan(e.evaluate(r))],min:[Ce,mn(Ce),(r,e)=>Math.min(...e.map((i=>i.evaluate(r))))],max:[Ce,mn(Ce),(r,e)=>Math.max(...e.map((i=>i.evaluate(r))))],abs:[Ce,[Ce],(r,[e])=>Math.abs(e.evaluate(r))],round:[Ce,[Ce],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[Ce,[Ce],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[Ce,[Ce],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[We,[Ne,qe],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[We,[qe],(r,[e])=>r.id()===e.value],"filter-type-==":[We,[Ne],(r,[e])=>r.geometryType()===e.value],"filter-<":[We,[Ne,qe],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s<o}],"filter-id-<":[We,[qe],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<s}],"filter->":[We,[Ne,qe],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s>o}],"filter-id->":[We,[qe],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>s}],"filter-<=":[We,[Ne,qe],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s<=o}],"filter-id-<=":[We,[qe],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<=s}],"filter->=":[We,[Ne,qe],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s>=o}],"filter-id->=":[We,[qe],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>=s}],"filter-has":[We,[qe],(r,[e])=>e.value in r.properties()],"filter-has-id":[We,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[We,[wi(Ne)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[We,[wi(qe)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[We,[Ne,wi(qe)],(r,[e,i])=>i.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[We,[Ne,wi(qe)],(r,[e,i])=>(function(s,o,l,u){for(;l<=u;){const p=l+u>>1;if(o[p]===s)return!0;o[p]>s?u=p-1:l=p+1}return!1})(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:We,overloads:[[[We,We],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[mn(We),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:We,overloads:[[[We,We],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[mn(We),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[We,[We],(r,[e])=>!e.evaluate(r)],"is-supported-script":[We,[Ne],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[Ne,[Ne],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[Ne,[Ne],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[Ne,mn(qe),(r,e)=>e.map((i=>$n(i.evaluate(r)))).join("")],split:[wi(Ne),[Ne,Ne],(r,[e,i])=>e.evaluate(r).split(i.evaluate(r))],join:[Ne,[wi(Ne),Ne],(r,[e,i])=>e.evaluate(r).join(i.evaluate(r))],"resolved-locale":[Ne,[Mo],(r,[e])=>e.evaluate(r).resolvedLocale()]});class Dl{constructor(e,i,s){this.expression=e,this._warningHistory={},this._evaluator=new As,this._defaultValue=i?(function(o){if(o.type==="color"&&Qo(o.default))return new et(0,0,0,0);switch(o.type){case"color":return et.parse(o.default)||null;case"padding":return Ti.parse(o.default)||null;case"numberArray":return Wt.parse(o.default)||null;case"colorArray":return ai.parse(o.default)||null;case"variableAnchorOffsetCollection":return Si.parse(o.default)||null;case"projectionDefinition":return Rt.parse(o.default)||null;default:return o.default===void 0?null:o.default}})(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this._globalState=s}evaluateWithoutErrorHandling(e,i,s,o,l,u){return this._globalState&&(e=ts(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=s,this._evaluator.canonical=o,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=u,this.expression.evaluate(this._evaluator)}evaluate(e,i,s,o,l,u){this._globalState&&(e=ts(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=s||null,this._evaluator.canonical=o,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=u||null;try{const p=this.expression.evaluate(this._evaluator);if(p==null||typeof p=="number"&&p!=p)return this._defaultValue;if(this._enumValues&&!(p in this._enumValues))throw new Ct(`Expected value to be one of ${Object.keys(this._enumValues).map((g=>JSON.stringify(g))).join(", ")}, but found ${JSON.stringify(p)} instead.`);return p}catch(p){return this._warningHistory[p.message]||(this._warningHistory[p.message]=!0,typeof console<"u"&&console.warn(p.message)),this._defaultValue}}}function ea(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Kn}function js(r,e,i){const s=new Ro(Kn,Yo,[],e?(function(l){const u={color:Jt,string:Ne,number:Ce,enum:Ne,boolean:We,formatted:Ps,padding:Fn,numberArray:Bn,colorArray:Is,projectionDefinition:Io,resolvedImage:hn,variableAnchorOffsetCollection:Ms};return l.type==="array"?wi(u[l.value]||qe,l.length):u[l.type]})(e):void 0),o=s.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?$c(new Dl(o,e,i)):Jn(s.errors)}class ta{constructor(e,i,s){this.kind=e,this._styleExpression=i,this.isStateDependent=e!=="constant"&&!Os(i.expression),this.globalStateRefs=Ns(i.expression),this._globalState=s}evaluateWithoutErrorHandling(e,i,s,o,l,u){return this._globalState&&(e=ts(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,i,s,o,l,u)}evaluate(e,i,s,o,l,u){return this._globalState&&(e=ts(e,this._globalState)),this._styleExpression.evaluate(e,i,s,o,l,u)}}class zl{constructor(e,i,s,o,l){this.kind=e,this.zoomStops=s,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!Os(i.expression),this.globalStateRefs=Ns(i.expression),this.interpolationType=o,this._globalState=l}evaluateWithoutErrorHandling(e,i,s,o,l,u){return this._globalState&&(e=ts(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,i,s,o,l,u)}evaluate(e,i,s,o,l,u){return this._globalState&&(e=ts(e,this._globalState)),this._styleExpression.evaluate(e,i,s,o,l,u)}interpolationFactor(e,i,s){return this.interpolationType?Ii.interpolationFactor(this.interpolationType,e,i,s):0}}function Hc(r,e,i){const s=js(r,e,i);if(s.result==="error")return s;const o=s.value.expression,l=Ko(o);if(!l&&!Qn(e))return Jn([new mr("","data expressions not supported")]);const u=Jo(o,["zoom"]);if(!u&&!Zc(e))return Jn([new mr("","zoom expressions not supported")]);const p=ia(o);return p||u?p instanceof mr?Jn([p]):p instanceof Ii&&!Al(e)?Jn([new mr("",'"interpolate" expressions cannot be used with this property')]):$c(p?new zl(l?"camera":"composite",s.value,p.labels,p instanceof Ii?p.interpolation:void 0,i):new ta(l?"constant":"source",s.value,i)):Jn([new mr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class es{constructor(e,i){this._parameters=e,this._specification=i,un(this,qc(this._parameters,this._specification))}static deserialize(e){return new es(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ia(r){let e=null;if(r instanceof pn)e=ia(r.result);else if(r instanceof Oo){for(const i of r.args)if(e=ia(i),e)break}else(r instanceof Ue||r instanceof Ii)&&r.input instanceof er&&r.input.name==="zoom"&&(e=r);return e instanceof mr||r.eachChild((i=>{const s=ia(i);s instanceof mr?e=s:!e&&s?e=new mr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new mr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Ns(r,e=new Set){return r instanceof Bs&&e.add(r.key),r.eachChild((i=>{Ns(i,e)})),e}function ts(r,e){const{zoom:i,heatmapDensity:s,elevation:o,lineProgress:l,isSupportedScript:u,accumulated:p}=r??{};return{zoom:i,heatmapDensity:s,elevation:o,lineProgress:l,isSupportedScript:u,accumulated:p,globalState:e}}function ra(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(!ra(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const lh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Us(r,e){if(r==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};ra(r)||(r=sa(r));const i=js(r,lh,e);if(i.result==="error")throw new Error(i.value.map((s=>`${s.key}: ${s.message}`)).join(", "));return{filter:(s,o,l)=>i.value.evaluate(s,o,{},l),needGeometry:kl(r),getGlobalStateRefs:()=>Ns(i.value.expression)}}function na(r,e){return r<e?-1:r>e?1:0}function kl(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(kl(r[e]))return!0;return!1}function sa(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?Rl(r[1],r[2],"=="):e==="!="?oa(Rl(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Rl(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(sa))):e==="all"?["all"].concat(r.slice(1).map(sa)):e==="none"?["all"].concat(r.slice(1).map(sa).map(oa)):e==="in"?Xc(r[1],r.slice(2)):e==="!in"?oa(Xc(r[1],r.slice(2))):e==="has"?Yc(r[1]):e!=="!has"||oa(Yc(r[1]));var i}function Rl(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 Xc(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(na)]]:["filter-in-small",r,["literal",e]]}}function Yc(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function oa(r){return["!",r]}function aa(r){const e=typeof r;if(e==="number"||e==="boolean"||e==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let o="[";for(const l of r)o+=`${aa(l)},`;return`${o}]`}const i=Object.keys(r).sort();let s="{";for(let o=0;o<i.length;o++)s+=`${JSON.stringify(i[o])}:${aa(r[i[o]])},`;return`${s}}`}function Kc(r){let e="";for(const i of Rn)e+=`/${aa(r[i])}`;return e}function Jc(r){const e=r.value;return e?[new Se(r.key,e,"constants have been deprecated as of v8")]:[]}function Lt(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function Xr(r){if(Array.isArray(r))return r.map(Xr);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=Xr(r[i]);return e}return Lt(r)}function ki(r){const e=r.key,i=r.value,s=r.valueSpec||{},o=r.objectElementValidators||{},l=r.style,u=r.styleSpec,p=r.validateSpec;let g=[];const m=Xe(i);if(m!=="object")return[new Se(e,i,`object expected, ${m} found`)];for(const v in i){const _=v.split(".")[0],T=Nn(s,_)||s["*"];let b;if(Nn(o,_))b=o[_];else if(Nn(s,_)){if(i[v]===void 0)continue;b=p}else if(o["*"])b=o["*"];else{if(!s["*"]){g.push(new Se(e,i[v],`unknown property "${v}"`));continue}b=p}g=g.concat(b({key:(e&&`${e}.`)+v,value:i[v],valueSpec:T,style:l,styleSpec:u,object:i,objectKey:v,validateSpec:p},i))}for(const v in s)o[v]||s[v].required&&s[v].default===void 0&&i[v]===void 0&&g.push(new Se(e,i,`missing required property "${v}"`));return g}function la(r){const e=r.value,i=r.valueSpec,s=r.style,o=r.styleSpec,l=r.key,u=r.arrayElementValidator||r.validateSpec;if(Xe(e)!=="array")return[new Se(l,e,`array expected, ${Xe(e)} found`)];if(i.length&&e.length!==i.length)return[new Se(l,e,`array length ${i.length} expected, length ${e.length} found`)];let p={type:i.value,values:i.values};o.$version<7&&(p.function=i.function),Xe(i.value)==="object"&&(p=i.value);let g=[];for(let m=0;m<e.length;m++)g=g.concat(u({array:e,arrayIndex:m,value:e[m],valueSpec:p,validateSpec:r.validateSpec,style:s,styleSpec:o,key:`${l}[${m}]`}));return g}function ca(r){const e=r.key,i=r.value,s=r.valueSpec;let o=Xe(i);return o==="number"&&i!=i&&(o="NaN"),o!=="number"?[new Se(e,i,`number expected, ${o} found`)]:"minimum"in s&&i<s.minimum?[new Se(e,i,`${i} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&i>s.maximum?[new Se(e,i,`${i} is greater than the maximum value ${s.maximum}`)]:[]}function Qc(r){const e=r.valueSpec,i=Lt(r.value.type);let s,o,l,u={};const p=i!=="categorical"&&r.value.property===void 0,g=!p,m=Xe(r.value.stops)==="array"&&Xe(r.value.stops[0])==="array"&&Xe(r.value.stops[0][0])==="object",v=ki({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(b){if(i==="identity")return[new Se(b.key,b.value,'identity function may not have a "stops" property')];let I=[];const M=b.value;return I=I.concat(la({key:b.key,value:M,valueSpec:b.valueSpec,validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec,arrayElementValidator:_})),Xe(M)==="array"&&M.length===0&&I.push(new Se(b.key,M,"array must have at least one stop")),I},default:function(b){return b.validateSpec({key:b.key,value:b.value,valueSpec:e,validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec})}}});return i==="identity"&&p&&v.push(new Se(r.key,r.value,'missing required property "property"')),i==="identity"||r.value.stops||v.push(new Se(r.key,r.value,'missing required property "stops"')),i==="exponential"&&r.valueSpec.expression&&!Al(r.valueSpec)&&v.push(new Se(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(g&&!Qn(r.valueSpec)?v.push(new Se(r.key,r.value,"property functions not supported")):p&&!Zc(r.valueSpec)&&v.push(new Se(r.key,r.value,"zoom functions not supported"))),i!=="categorical"&&!m||r.value.property!==void 0||v.push(new Se(r.key,r.value,'"property" property is required')),v;function _(b){let I=[];const M=b.value,A=b.key;if(Xe(M)!=="array")return[new Se(A,M,`array expected, ${Xe(M)} found`)];if(M.length!==2)return[new Se(A,M,`array length 2 expected, length ${M.length} found`)];if(m){if(Xe(M[0])!=="object")return[new Se(A,M,`object expected, ${Xe(M[0])} found`)];if(M[0].zoom===void 0)return[new Se(A,M,"object stop key must have zoom")];if(M[0].value===void 0)return[new Se(A,M,"object stop key must have value")];if(l&&l>Lt(M[0].zoom))return[new Se(A,M[0].zoom,"stop zoom values must appear in ascending order")];Lt(M[0].zoom)!==l&&(l=Lt(M[0].zoom),o=void 0,u={}),I=I.concat(ki({key:`${A}[0]`,value:M[0],valueSpec:{zoom:{}},validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{zoom:ca,value:T}}))}else I=I.concat(T({key:`${A}[0]`,value:M[0],validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec},M));return ea(Xr(M[1]))?I.concat([new Se(`${A}[1]`,M[1],"expressions are not allowed in function stops.")]):I.concat(b.validateSpec({key:`${A}[1]`,value:M[1],valueSpec:e,validateSpec:b.validateSpec,style:b.style,styleSpec:b.styleSpec}))}function T(b,I){const M=Xe(b.value),A=Lt(b.value),D=b.value!==null?b.value:I;if(s){if(M!==s)return[new Se(b.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 Se(b.key,D,"stop domain value must be a number, string, or boolean")];if(M!=="number"&&i!=="categorical"){let F=`number expected, ${M} found`;return Qn(e)&&i===void 0&&(F+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Se(b.key,D,F)]}return i!=="categorical"||M!=="number"||isFinite(A)&&Math.floor(A)===A?i!=="categorical"&&M==="number"&&o!==void 0&&A<o?[new Se(b.key,D,"stop domain values must appear in ascending order")]:(o=A,i==="categorical"&&A in u?[new Se(b.key,D,"stop domain values must be unique")]:(u[A]=!0,[])):[new Se(b.key,D,`integer expected, found ${A}`)]}}function is(r){const e=(r.expressionContext==="property"?Hc:js)(Xr(r.value),r.valueSpec);if(e.result==="error")return e.value.map((s=>new Se(`${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 Se(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"&&!Os(i))return[new Se(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!Os(i))return[new Se(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!Jo(i,["zoom","feature-state"]))return[new Se(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!Ko(i))return[new Se(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ll(r){const e=r.key,i=r.value,s=Xe(i);return s!=="string"?[new Se(e,i,`color expected, ${s} found`)]:et.parse(String(i))?[]:[new Se(e,i,`color expected, "${i}" found`)]}function rs(r){const e=r.key,i=r.value,s=r.valueSpec,o=[];return Array.isArray(s.values)?s.values.indexOf(Lt(i))===-1&&o.push(new Se(e,i,`expected one of [${s.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(s.values).indexOf(Lt(i))===-1&&o.push(new Se(e,i,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(i)} found`)),o}function ua(r){return ra(Xr(r.value))?is(un({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):ha(r)}function ha(r){const e=r.value,i=r.key;if(Xe(e)!=="array")return[new Se(i,e,`array expected, ${Xe(e)} found`)];const s=r.styleSpec;let o,l=[];if(e.length<1)return[new Se(i,e,"filter array must have at least 1 element")];switch(l=l.concat(rs({key:`${i}[0]`,value:e[0],valueSpec:s.filter_operator,style:r.style,styleSpec:r.styleSpec})),Lt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Lt(e[1])==="$type"&&l.push(new Se(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&l.push(new Se(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(o=Xe(e[1]),o!=="string"&&l.push(new Se(`${i}[1]`,e[1],`string expected, ${o} found`)));for(let u=2;u<e.length;u++)o=Xe(e[u]),Lt(e[1])==="$type"?l=l.concat(rs({key:`${i}[${u}]`,value:e[u],valueSpec:s.geometry_type,style:r.style,styleSpec:r.styleSpec})):o!=="string"&&o!=="number"&&o!=="boolean"&&l.push(new Se(`${i}[${u}]`,e[u],`string, number, or boolean expected, ${o} found`));break;case"any":case"all":case"none":for(let u=1;u<e.length;u++)l=l.concat(ha({key:`${i}[${u}]`,value:e[u],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":o=Xe(e[1]),e.length!==2?l.push(new Se(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):o!=="string"&&l.push(new Se(`${i}[1]`,e[1],`string expected, ${o} found`))}return l}function da(r,e){const i=r.key,s=r.validateSpec,o=r.style,l=r.styleSpec,u=r.value,p=r.objectKey,g=l[`${e}_${r.layerType}`];if(!g)return[];const m=p.match(/^(.*)-transition$/);if(e==="paint"&&m&&g[m[1]]&&g[m[1]].transition)return s({key:i,value:u,valueSpec:l.transition,style:o,styleSpec:l});const v=r.valueSpec||g[p];if(!v)return[new Se(i,u,`unknown property "${p}"`)];let _;if(Xe(u)==="string"&&Qn(v)&&!v.tokens&&(_=/^{([^}]+)}$/.exec(u)))return[new Se(i,u,`"${p}" does not support interpolation syntax
2
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(_[1])} }\`.`)];const T=[];return r.layerType==="symbol"&&p==="text-font"&&Qo(Xr(u))&&Lt(u.type)==="identity"&&T.push(new Se(i,u,'"text-font" does not support identity functions')),T.concat(s({key:r.key,value:u,valueSpec:v,style:o,styleSpec:l,expressionContext:"property",propertyType:e,propertyKey:p}))}function pa(r){return da(r,"paint")}function fa(r){return da(r,"layout")}function ma(r){var e,i;let s=[];const o=r.value,l=r.key,u=r.style,p=r.styleSpec;if(Xe(o)!=="object")return[new Se(l,o,`object expected, ${Xe(o)} found`)];o.type||o.ref||s.push(new Se(l,o,'either "type" or "ref" is required'));let g=Lt(o.type);const m=Lt(o.ref);if(o.id){const v=Lt(o.id);for(let _=0;_<r.arrayIndex;_++){const T=u.layers[_];Lt(T.id)===v&&s.push(new Se(l,o.id,`duplicate layer id "${o.id}", previously used at line ${T.id.__line__}`))}}if("ref"in o){let v;["type","source","source-layer","filter","layout"].forEach((_=>{_ in o&&s.push(new Se(l,o[_],`"${_}" is prohibited for ref layers`))})),u.layers.forEach((_=>{Lt(_.id)===m&&(v=_)})),v?v.ref?s.push(new Se(l,o.ref,"ref cannot reference another ref layer")):g=Lt(v.type):s.push(new Se(l,o.ref,`ref layer "${m}" not found`))}else if(g!=="background")if(o.source){const v=u.sources&&u.sources[o.source],_=v&&Lt(v.type);v?_==="vector"&&g==="raster"?s.push(new Se(l,o.source,`layer "${o.id}" requires a raster source`)):_!=="raster-dem"&&g==="hillshade"||_!=="raster-dem"&&g==="color-relief"?s.push(new Se(l,o.source,`layer "${o.id}" requires a raster-dem source`)):_==="raster"&&g!=="raster"?s.push(new Se(l,o.source,`layer "${o.id}" requires a vector source`)):_!=="vector"||o["source-layer"]?_==="raster-dem"&&g!=="hillshade"&&g!=="color-relief"?s.push(new Se(l,o.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):g!=="line"||!o.paint||!o.paint["line-gradient"]||_==="geojson"&&v.lineMetrics||s.push(new Se(l,o,`layer "${o.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):s.push(new Se(l,o,`layer "${o.id}" must specify a "source-layer"`)):s.push(new Se(l,o.source,`source "${o.source}" not found`))}else s.push(new Se(l,o,'missing required property "source"'));return g==="raster"&&(!((e=o.paint)===null||e===void 0)&&e.resampling)&&(!((i=o.paint)===null||i===void 0)&&i["raster-resampling"])&&s.push(new Se(l,o.paint,`layer "${o.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),s=s.concat(ki({key:l,value:o,valueSpec:p.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${l}.type`,value:o.type,valueSpec:p.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:o,objectKey:"type"}),filter:ua,layout:v=>ki({layer:o,key:v.key,value:v.value,style:v.style,styleSpec:v.styleSpec,validateSpec:v.validateSpec,objectElementValidators:{"*":_=>fa(un({layerType:g},_))}}),paint:v=>ki({layer:o,key:v.key,value:v.value,style:v.style,styleSpec:v.styleSpec,validateSpec:v.validateSpec,objectElementValidators:{"*":_=>pa(un({layerType:g},_))}})}})),s}function ur(r){const e=r.value,i=r.key,s=Xe(e);return s!=="string"?[new Se(i,e,`string expected, ${s} found`)]:[]}const eu={promoteId:function({key:r,value:e}){if(Xe(e)==="string")return ur({key:r,value:e});{const i=[];for(const s in e)i.push(...ur({key:`${r}.${s}`,value:e[s]}));return i}}};function tu(r){const e=r.value,i=r.key,s=r.styleSpec,o=r.style,l=r.validateSpec;if(!e.type)return[new Se(i,e,'"type" is required')];const u=Lt(e.type);let p;switch(u){case"vector":case"raster":return p=ki({key:i,value:e,valueSpec:s[`source_${u.replace("-","_")}`],style:r.style,styleSpec:s,objectElementValidators:eu,validateSpec:l}),p;case"raster-dem":return p=(function(g){var m;const v=(m=g.sourceName)!==null&&m!==void 0?m:"",_=g.value,T=g.styleSpec,b=T.source_raster_dem,I=g.style;let M=[];const A=Xe(_);if(_===void 0)return M;if(A!=="object")return M.push(new Se("source_raster_dem",_,`object expected, ${A} found`)),M;const D=Lt(_.encoding)==="custom",F=["redFactor","greenFactor","blueFactor","baseShift"],R=g.value.encoding?`"${g.value.encoding}"`:"Default";for(const B in _)!D&&F.includes(B)?M.push(new Se(B,_[B],`In "${v}": "${B}" is only valid when "encoding" is set to "custom". ${R} encoding found`)):b[B]?M=M.concat(g.validateSpec({key:B,value:_[B],valueSpec:b[B],validateSpec:g.validateSpec,style:I,styleSpec:T})):M.push(new Se(B,_[B],`unknown property "${B}"`));return M})({sourceName:i,value:e,style:r.style,styleSpec:s,validateSpec:l}),p;case"geojson":if(p=ki({key:i,value:e,valueSpec:s.source_geojson,style:o,styleSpec:s,validateSpec:l,objectElementValidators:eu}),e.cluster)for(const g in e.clusterProperties){const[m,v]=e.clusterProperties[g],_=typeof m=="string"?[m,["accumulated"],["get",g]]:m;p.push(...is({key:`${i}.${g}.map`,value:v,expressionContext:"cluster-map"})),p.push(...is({key:`${i}.${g}.reduce`,value:_,expressionContext:"cluster-reduce"}))}return p;case"video":return ki({key:i,value:e,valueSpec:s.source_video,style:o,validateSpec:l,styleSpec:s});case"image":return ki({key:i,value:e,valueSpec:s.source_image,style:o,validateSpec:l,styleSpec:s});case"canvas":return[new Se(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return rs({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function iu(r){const e=r.value,i=r.styleSpec,s=i.light,o=r.style;let l=[];const u=Xe(e);if(e===void 0)return l;if(u!=="object")return l=l.concat([new Se("light",e,`object expected, ${u} found`)]),l;for(const p in e){const g=p.match(/^(.*)-transition$/);l=l.concat(g&&s[g[1]]&&s[g[1]].transition?r.validateSpec({key:p,value:e[p],valueSpec:i.transition,validateSpec:r.validateSpec,style:o,styleSpec:i}):s[p]?r.validateSpec({key:p,value:e[p],valueSpec:s[p],validateSpec:r.validateSpec,style:o,styleSpec:i}):[new Se(p,e[p],`unknown property "${p}"`)])}return l}function ru(r){const e=r.value,i=r.styleSpec,s=i.sky,o=r.style,l=Xe(e);if(e===void 0)return[];if(l!=="object")return[new Se("sky",e,`object expected, ${l} found`)];let u=[];for(const p in e)u=u.concat(s[p]?r.validateSpec({key:p,value:e[p],valueSpec:s[p],style:o,styleSpec:i}):[new Se(p,e[p],`unknown property "${p}"`)]);return u}function nu(r){const e=r.value,i=r.styleSpec,s=i.terrain,o=r.style;let l=[];const u=Xe(e);if(e===void 0)return l;if(u!=="object")return l=l.concat([new Se("terrain",e,`object expected, ${u} found`)]),l;for(const p in e)l=l.concat(s[p]?r.validateSpec({key:p,value:e[p],valueSpec:s[p],validateSpec:r.validateSpec,style:o,styleSpec:i}):[new Se(p,e[p],`unknown property "${p}"`)]);return l}function su(r){let e=[];const i=r.value,s=r.key;if(Array.isArray(i)){const o=[],l=[];for(const u in i)i[u].id&&o.includes(i[u].id)&&e.push(new Se(s,i,`all the sprites' ids must be unique, but ${i[u].id} is duplicated`)),o.push(i[u].id),i[u].url&&l.includes(i[u].url)&&e.push(new Se(s,i,`all the sprites' URLs must be unique, but ${i[u].url} is duplicated`)),l.push(i[u].url),e=e.concat(ki({key:`${s}[${u}]`,value:i[u],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return e}return ur({key:s,value:i})}function Fl(r){return!!r&&r.constructor===Object}function Bl(r){return Fl(r.value)?[]:[new Se(r.key,r.value,`object expected, ${Xe(r.value)} found`)]}const Gs={"*":()=>[],array:la,boolean:function(r){const e=r.value,i=r.key,s=Xe(e);return s!=="boolean"?[new Se(i,e,`boolean expected, ${s} found`)]:[]},number:ca,color:Ll,constants:Jc,enum:rs,filter:ua,function:Qc,layer:ma,object:ki,source:tu,light:iu,sky:ru,terrain:nu,projection:function(r){const e=r.value,i=r.styleSpec,s=i.projection,o=r.style,l=Xe(e);if(e===void 0)return[];if(l!=="object")return[new Se("projection",e,`object expected, ${l} found`)];let u=[];for(const p in e)u=u.concat(s[p]?r.validateSpec({key:p,value:e[p],valueSpec:s[p],style:o,styleSpec:i}):[new Se(p,e[p],`unknown property "${p}"`)]);return u},projectionDefinition:function(r){const e=r.key;let i=r.value;i=i instanceof String?i.valueOf():i;const s=Xe(i);return s!=="array"||(function(o){return Array.isArray(o)&&o.length===3&&typeof o[0]=="string"&&typeof o[1]=="string"&&typeof o[2]=="number"})(i)||(function(o){return!!["interpolate","step","literal"].includes(o[0])})(i)?["array","string"].includes(s)?[]:[new Se(e,i,`projection expected, invalid type "${s}" found`)]:[new Se(e,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:ur,formatted:function(r){return ur(r).length===0?[]:is(r)},resolvedImage:function(r){return ur(r).length===0?[]:is(r)},padding:function(r){const e=r.key,i=r.value;if(Xe(i)==="array"){if(i.length<1||i.length>4)return[new Se(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const s={type:"number"};let o=[];for(let l=0;l<i.length;l++)o=o.concat(r.validateSpec({key:`${e}[${l}]`,value:i[l],validateSpec:r.validateSpec,valueSpec:s}));return o}return ca({key:e,value:i,valueSpec:{}})},numberArray:function(r){const e=r.key,i=r.value;if(Xe(i)==="array"){const s={type:"number"};if(i.length<1)return[new Se(e,i,"array length at least 1 expected, length 0 found")];let o=[];for(let l=0;l<i.length;l++)o=o.concat(r.validateSpec({key:`${e}[${l}]`,value:i[l],validateSpec:r.validateSpec,valueSpec:s}));return o}return ca({key:e,value:i,valueSpec:{}})},colorArray:function(r){const e=r.key,i=r.value;if(Xe(i)==="array"){if(i.length<1)return[new Se(e,i,"array length at least 1 expected, length 0 found")];let s=[];for(let o=0;o<i.length;o++)s=s.concat(Ll({key:`${e}[${o}]`,value:i[o]}));return s}return Ll({key:e,value:i})},variableAnchorOffsetCollection:function(r){const e=r.key,i=r.value,s=Xe(i),o=r.styleSpec;if(s!=="array"||i.length<1||i.length%2!=0)return[new Se(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(rs({key:`${e}[${u}]`,value:i[u],valueSpec:o.layout_symbol["text-anchor"]})),l=l.concat(la({key:`${e}[${u+1}]`,value:i[u+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:o}));return l},sprite:su,state:Bl,fontFaces:function(r){const e=r.key,i=r.value,s=r.validateSpec,o=r.styleSpec,l=r.style;if(!Fl(i))return[new Se(e,i,`object expected, ${Xe(i)} found`)];const u=[];for(const p in i){const g=i[p],m=Xe(g);if(m==="string")u.push(...ur({key:`${e}.${p}`,value:g}));else if(m==="array"){const v={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[_,T]of g.entries())u.push(...ki({key:`${e}.${p}[${_}]`,value:T,valueSpec:v,styleSpec:o,style:l,validateSpec:s}))}else u.push(new Se(`${e}.${p}`,g,`string or array expected, ${m} found`))}return u}};function ga(r){const e=r.value,i=r.valueSpec,s=r.styleSpec;return r.validateSpec=ga,i.expression&&Qo(Lt(e))?Qc(r):i.expression&&ea(Xr(e))?is(r):i.type&&Gs[i.type]?Gs[i.type](r):ki(un({},r,{valueSpec:i.type?s[i.type]:i}))}function Ol(r){const e=r.value,i=r.key,s=ur(r);return s.length||(e.indexOf("{fontstack}")===-1&&s.push(new Se(i,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&s.push(new Se(i,e,'"glyphs" url must include a "{range}" token'))),s}function $i(r,e=ce){let i=[];return i=i.concat(ga({key:"",value:r,valueSpec:e.$root,styleSpec:e,style:r,validateSpec:ga,objectElementValidators:{glyphs:Ol,"*":()=>[]}})),r.constants&&(i=i.concat(Jc({key:"constants",value:r.constants}))),$s(i)}function hr(r){return function(e){return r(Object.assign({},e,{validateSpec:ga}))}}function $s(r){return[].concat(r).sort(((e,i)=>e.line-i.line))}function tr(r){return function(...e){return $s(r.apply(this,e))}}$i.source=tr(hr(tu)),$i.sprite=tr(hr(su)),$i.glyphs=tr(hr(Ol)),$i.light=tr(hr(iu)),$i.sky=tr(hr(ru)),$i.terrain=tr(hr(nu)),$i.state=tr(hr(Bl)),$i.layer=tr(hr(ma)),$i.filter=tr(hr(ua)),$i.paintProperty=tr(hr(pa)),$i.layoutProperty=tr(hr(fa));const ou={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class Zs{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=js(e,ou,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=Ns(i.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}const ch=ce,ns=$i,uh=ns.light,hh=ns.sky,dh=ns.paintProperty,ph=ns.layoutProperty;function ss(r,e){let i=!1;if(e?.length)for(const s of e)r.fire(new Ts(new Error(s.message))),i=!0;return i}class Er{constructor(e,i,s){const o=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],v=u[3+g+1];o.push(m===v?null:u.subarray(m,v))}const p=u[3+o.length+1];this.keys=u.subarray(u[3+o.length],p),this.bboxes=u.subarray(p),this.insert=this._insertReadonly}else{this.d=i+2*s;for(let u=0;u<this.d*this.d;u++)o.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,o,l){this._forEachCell(i,s,o,l,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(i),this.bboxes.push(s),this.bboxes.push(o),this.bboxes.push(l)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,i,s,o,l,u){this.cells[l].push(u)}query(e,i,s,o,l){const u=this.min,p=this.max;if(e<=u&&i<=u&&p<=s&&p<=o&&!l)return[...this.keys];{const g=[];return this._forEachCell(e,i,s,o,this._queryCell,g,{},l),g}}_queryCell(e,i,s,o,l,u,p,g){const m=this.cells[l];if(m!==null){const v=this.keys,_=this.bboxes;for(const T of m)if(p[T]===void 0){const b=4*T;(g?g(_[b+0],_[b+1],_[b+2],_[b+3]):e<=_[b+2]&&i<=_[b+3]&&s>=_[b+0]&&o>=_[b+1])?(p[T]=!0,u.push(v[T])):p[T]=!1}}}_forEachCell(e,i,s,o,l,u,p,g){const m=this._convertToCellCoord(e),v=this._convertToCellCoord(i),_=this._convertToCellCoord(s),T=this._convertToCellCoord(o);for(let b=m;b<=_;b++)for(let I=v;I<=T;I++){const M=this.d*I+b;if((!g||g(this._convertFromCellCoord(b),this._convertFromCellCoord(I),this._convertFromCellCoord(b+1),this._convertFromCellCoord(I+1)))&&l.call(this,e,i,s,o,M,u,p,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(const u of this.cells)s+=u.length;const o=new Int32Array(i+s+this.keys.length+this.bboxes.length);o[0]=this.extent,o[1]=this.n,o[2]=this.padding;let l=i;for(let u=0;u<e.length;u++){const p=e[u];o[3+u]=l,o.set(p,l),l+=p.length}return o[3+e.length]=l,o.set(this.keys,l),l+=this.keys.length,o[3+e.length+1]=l,o.set(this.bboxes,l),l+=this.bboxes.length,o.buffer}static serialize(e,i){const s=e.toArrayBuffer();return i&&i.push(s),{buffer:s}}static deserialize(e){return new Er(e.buffer)}}const jt={};function Ae(r,e,i={}){if(jt[r])throw new Error(`${r} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:r,writeable:!1}),jt[r]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}Ae("Object",Object),Ae("Set",Set),Ae("TransferableGridIndex",Er),Ae("Color",et),Ae("Error",Error),Ae("AJAXError",ln),Ae("ResolvedImage",Ui),Ae("StylePropertyFunction",es),Ae("StyleExpression",Dl,{omit:["_evaluator"]}),Ae("ZoomDependentExpression",zl),Ae("ZoomConstantExpression",ta),Ae("CompoundExpression",er,{omit:["_evaluate"]});for(const r in Kn)Kn[r]._classRegistryKey||Ae(`Expression_${r}`,Kn[r]);function Vl(r){var e;return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||((e=r.constructor)===null||e===void 0?void 0:e.name)==="ArrayBuffer")}function jl(r){return r.$name||r.constructor._classRegistryKey}function au(r){return!(function(e){if(e===null||typeof e!="object")return!1;const i=jl(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||Vl(r)||xt(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function Cr(r,e){if(au(r))return(Vl(r)||xt(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(Cr(u,e));return l}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const i=jl(r);if(!i)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!jt[i])throw new Error(`${i} is not registered.`);const{klass:s}=jt[i],o=s.serialize?s.serialize(r,e):{};if(s.serialize){if(o===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)||jt[i].omit.includes(l))continue;const u=r[l];o[l]=jt[i].shallow.includes(l)?u:Cr(u,e)}r instanceof Error&&(o.message=r.message)}if(o.$name)throw new Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(o.$name=i),o}function os(r){if(au(r))return r;if(Array.isArray(r))return r.map(os);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const e=jl(r)||"Object";if(!jt[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=jt[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 o of Object.keys(r)){if(o==="$name")continue;const l=r[o];s[o]=jt[e].shallow.includes(o)?l:os(l)}return s}class qs{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 fh(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 Ws(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 lu(r){return/\s/u.test(String.fromCodePoint(r))}function gn(r){for(const e of r)if(Ws(e.codePointAt(0)))return!0;return!1}function mh(r){for(const e of r)if(!Hs(e.codePointAt(0)))return!1;return!0}function cu(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 gh=cu(["Arab","Dupl","Mong","Ougr","Syrc"]);function Hs(r){return!gh.test(String.fromCodePoint(r))}function uu(r){return!(Ws(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 _h=cu(["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 Xs(r){return _h.test(String.fromCodePoint(r))}function yh(r,e){return!(!e&&Xs(r)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(r)))}function Nl(r){for(const e of r)if(Xs(e.codePointAt(0)))return!0;return!1}const dr=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(dr.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 h(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 o=new Promise((l=>setTimeout((()=>l()),this.TIMEOUT)));if(yield Promise.race([s,o]),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 ft{constructor(e,i){this.isSupportedScript=hu,this.zoom=e,i?(this.now=i.now||0,this.fadeDuration=i.fadeDuration||0,this.zoomHistory=i.zoomHistory||new qs,this.transition=i.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new qs,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 hu(r){return(function(e,i){for(const s of e)if(!yh(s.codePointAt(0),i))return!1;return!0})(r,dr.getRTLTextPluginStatus()==="loaded")}const Ys="-transition";class Ks{constructor(e,i,s){this.property=e,this.value=i,this.expression=(function(o,l,u){if(Qo(o))return new es(o,l);if(ea(o)){const p=Hc(o,l,u);if(p.result==="error")throw new Error(p.value.map((g=>`${g.key}: ${g.message}`)).join(", "));return p.value}{let p=o;return l.type==="color"&&typeof o=="string"?p=et.parse(o):l.type!=="padding"||typeof o!="number"&&!Array.isArray(o)?l.type!=="numberArray"||typeof o!="number"&&!Array.isArray(o)?l.type!=="colorArray"||typeof o!="string"&&!Array.isArray(o)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(o)?p=Si.parse(o):l.type==="projectionDefinition"&&typeof o=="string"&&(p=Rt.parse(o)):p=ai.parse(o):p=Wt.parse(o):p=Ti.parse(o),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>p}}})(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 Js{constructor(e,i){this.property=e,this.value=new Ks(e,void 0,i)}transitioned(e,i){return new du(this.property,this.value,i,di({},e.transition,this.transition),e.now)}untransitioned(){return new du(this.property,this.value,null,{},0)}}class Ul{constructor(e,i){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=i}hasProperty(e){return e in this._properties.defaultTransitionablePropertyValues}getValue(e){return tt(this._values[e].value.value)}setValue(e,i){Object.hasOwn(this._values,e)||(this._values[e]=new Js(this._values[e].property,this._globalState)),this._values[e].value=new Ks(this._values[e].property,i===null?void 0:tt(i),this._globalState)}getTransition(e){return tt(this._values[e].transition)}setTransition(e,i){Object.hasOwn(this._values,e)||(this._values[e]=new Js(this._values[e].property,this._globalState)),this._values[e].transition=tt(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 o=this.getTransition(i);o!==void 0&&(e[`${i}${Ys}`]=o)}return e}transitioned(e,i){const s=new Gl(this._properties);for(const o of Object.keys(this._values))s._values[o]=this._values[o].transitioned(e,i._values[o]);return s}untransitioned(){const e=new Gl(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class du{constructor(e,i,s,o,l){this.property=e,this.value=i,this.begin=l+o.delay||0,this.end=this.begin+o.duration||0,e.specification.transition&&(o.delay||o.duration)&&(this.prior=s)}possiblyEvaluate(e,i,s){const o=e.now||0,l=this.value.possiblyEvaluate(e,i,s),u=this.prior;if(u){if(o>this.end)return this.prior=null,l;if(this.value.isDataDriven())return this.prior=null,l;if(o<this.begin)return u.possiblyEvaluate(e,i,s);{const p=(o-this.begin)/(this.end-this.begin);return this.property.interpolate(u.possiblyEvaluate(e,i,s),l,_s(p))}}return l}}class Gl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,s){const o=new _a(this._properties);for(const l of Object.keys(this._values))o._values[l]=this._values[l].possiblyEvaluate(e,i,s);return o}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class vh{constructor(e,i){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=i}hasValue(e){return this._values[e].value!==void 0}hasProperty(e){return e in this._properties.defaultPropertyValues}getValue(e){return tt(this._values[e].value)}setValue(e,i){this._values[e]=new Ks(this._values[e].property,i===null?void 0:tt(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 o=new _a(this._properties);for(const l of Object.keys(this._values))o._values[l]=this._values[l].possiblyEvaluate(e,i,s);return o}}class pr{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,o){return this.property.evaluate(this.value,this.parameters,e,i,s,o)}}class _a{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class De{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 o=lr[this.specification.type];return o?o(e,i,s):e}}class Fe{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,s,o){return new pr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(i,null,{},s,o)}: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 pr(this,{kind:"constant",value:void 0},e.parameters);const o=lr[this.specification.type];if(o){const l=o(e.value.value,i.value.value,s);return new pr(this,{kind:"constant",value:l},e.parameters)}return e}evaluate(e,i,s,o,l,u){return e.kind==="constant"?e.value:e.evaluate(i,s,o,l,u)}}class Qs extends Fe{possiblyEvaluate(e,i,s,o){if(e.value===void 0)return new pr(this,{kind:"constant",value:void 0},i);if(e.expression.kind==="constant"){const l=e.expression.evaluate(i,null,{},s,o),u=e.property.specification.type==="resolvedImage"&&typeof l!="string"?l.name:l,p=this._calculate(u,u,u,i);return new pr(this,{kind:"constant",value:p},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 pr(this,{kind:"constant",value:l},i)}return new pr(this,e.expression,i)}evaluate(e,i,s,o,l,u){if(e.kind==="source"){const p=e.evaluate(i,s,o,l,u);return this._calculate(p,p,p,i)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(i.zoom)-1},s,o),e.evaluate({zoom:Math.floor(i.zoom)},s,o),e.evaluate({zoom:Math.floor(i.zoom)+1},s,o),i):e.value}_calculate(e,i,s,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:i}:{from:s,to:i}}interpolate(e){return e}}class pu{constructor(e){this.specification=e}possiblyEvaluate(e,i,s,o){if(e.value!==void 0){if(e.expression.kind==="constant"){const l=e.expression.evaluate(i,null,{},s,o);return this._calculate(l,l,l,i)}return this._calculate(e.expression.evaluate(new ft(Math.floor(i.zoom-1),i)),e.expression.evaluate(new ft(Math.floor(i.zoom),i)),e.expression.evaluate(new ft(Math.floor(i.zoom+1),i)),i)}}_calculate(e,i,s,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:i}:{from:s,to:i}}interpolate(e){return e}}class eo{constructor(e){this.specification=e}possiblyEvaluate(e,i,s,o){return!!e.expression.evaluate(i,null,{},s,o)}interpolate(){return!1}}class mi{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 o=this.defaultPropertyValues[i]=new Ks(s,void 0,void 0),l=this.defaultTransitionablePropertyValues[i]=new Js(s,void 0);this.defaultTransitioningPropertyValues[i]=l.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=o.possiblyEvaluate({})}}}Ae("DataDrivenProperty",Fe),Ae("DataConstantProperty",De),Ae("CrossFadedDataDrivenProperty",Qs),Ae("CrossFadedProperty",pu),Ae("ColorRampProperty",eo);const $l=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",ya=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";class Ri extends kn{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(o,l){return new Zs(o,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=Us(e.filter,s)),i.layout&&(this._unevaluatedLayout=new vh(i.layout,s)),i.paint)){this._transitionablePaint=new Ul(i.paint,s);for(const o in e.paint)this.setPaintProperty(o,e.paint[o],{validate:!1});for(const o in e.layout)this.setLayoutProperty(o,e.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new _a(i.paint)}}setFilter(e){this.filter=e,this._featureFilter=Us(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){var i;if(e==="visibility")return this.visibility;if(!((i=this._transitionablePaint)===null||i===void 0)&&i.hasProperty(e))throw new Error(e+$l);if(!this._unevaluatedLayout)throw new Error(`Cannot get layout property "${e}" on layer type "${this.type}" which has no layout properties.`);return 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 o of s.getGlobalStateRefs())e.add(o)}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 o=this._transitionablePaint._values[s].value;for(const l of o.getGlobalStateRefs()){const u=(e=i.get(l))!==null&&e!==void 0?e:[];u.push({name:s,value:o.value}),i.set(l,u)}}return i}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,i,s={}){var o;if(e==="visibility")return this.visibility=i,this._visibilityExpression.setValue(i),void this.recalculateVisibility();!((o=this._transitionablePaint)===null||o===void 0)&&o.hasProperty(e)?this.fire(new Ts(new Error(e+$l))):i!=null&&this._validate(ph,`layers.${this.id}.layout.${e}`,e,i,s)||this._unevaluatedLayout.setValue(e,i)}getPaintProperty(e){var i,s;if(e.endsWith(Ys)){const o=e.slice(0,-11);if(o==="visibility"||!((i=this._unevaluatedLayout)===null||i===void 0)&&i.hasProperty(o))throw new Error(e+ya);return this._transitionablePaint.getTransition(o)}if(e==="visibility"||!((s=this._unevaluatedLayout)===null||s===void 0)&&s.hasProperty(e))throw new Error(e+ya);return this._transitionablePaint.getValue(e)}setPaintProperty(e,i,s={}){var o;if(e==="visibility"||!((o=this._unevaluatedLayout)===null||o===void 0)&&o.hasProperty(e))return this.fire(new Ts(new Error(e+ya))),!1;if(i!=null&&this._validate(dh,`layers.${this.id}.paint.${e}`,e,i,s))return!1;if(e.endsWith(Ys))return this._transitionablePaint.setTransition(e.slice(0,-11),i||void 0),!1;{const l=this._transitionablePaint._values[e],u=l.property.specification["property-type"]==="cross-faded-data-driven",p=l.value.isDataDriven(),g=l.value;this._transitionablePaint.setValue(e,i),this._handleSpecialPaintPropertyUpdate(e);const m=this._transitionablePaint._values[e].value;return m.isDataDriven()||p||u||this._handleOverridablePaintPropertyUpdate(e,g,m)}}_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(){var e,i;const s={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:(e=this._unevaluatedLayout)===null||e===void 0?void 0:e.serialize(),paint:(i=this._transitionablePaint)===null||i===void 0?void 0:i.serialize()};return this.visibility&&(s.layout||(s.layout={}),s.layout.visibility=this.visibility),nn(s,((o,l)=>!(o===void 0||l==="layout"&&!Object.keys(o).length||l==="paint"&&!Object.keys(o).length)))}_validate(e,i,s,o,l={}){return l?.validate!==!1&&ss(this,e.call(ns,{key:i,layerType:this.type,objectKey:s,value:o,styleSpec:ce,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 pr&&Qn(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}}let fu;var Zl={get paint(){return fu=fu||new mi({"raster-opacity":new De(ce.paint_raster["raster-opacity"]),"raster-hue-rotate":new De(ce.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new De(ce.paint_raster["raster-brightness-min"]),"raster-brightness-max":new De(ce.paint_raster["raster-brightness-max"]),"raster-saturation":new De(ce.paint_raster["raster-saturation"]),"raster-contrast":new De(ce.paint_raster["raster-contrast"]),resampling:new De(ce.paint_raster.resampling),"raster-resampling":new De(ce.paint_raster["raster-resampling"]),"raster-fade-duration":new De(ce.paint_raster["raster-fade-duration"])})}};class xh extends Ri{constructor(e,i){super(e,Zl,i)}}const bh={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class as{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 bt{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 At(r,e=1){let i=0,s=0;return{members:r.map((o=>{const l=bh[o.type].BYTES_PER_ELEMENT,u=i=mu(i,Math.max(e,l)),p=o.components||1;return s=Math.max(s,l),i+=l*p,{name:o.name,type:o.type,components:p,offset:u}})),size:mu(i,Math.max(s,e)),alignment:e}}function mu(r,e){return Math.ceil(r/e)*e}class to extends bt{_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 o=2*e;return this.int16[o+0]=i,this.int16[o+1]=s,e}}to.prototype.bytesPerElement=4,Ae("StructArrayLayout2i4",to);class va extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const l=3*e;return this.int16[l+0]=i,this.int16[l+1]=s,this.int16[l+2]=o,e}}va.prototype.bytesPerElement=6,Ae("StructArrayLayout3i6",va);class ql extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,s,o)}emplace(e,i,s,o,l){const u=4*e;return this.int16[u+0]=i,this.int16[u+1]=s,this.int16[u+2]=o,this.int16[u+3]=l,e}}ql.prototype.bytesPerElement=8,Ae("StructArrayLayout4i8",ql);class Wl extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,u){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,s,o,l,u)}emplace(e,i,s,o,l,u,p){const g=6*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=o,this.int16[g+3]=l,this.int16[g+4]=u,this.int16[g+5]=p,e}}Wl.prototype.bytesPerElement=12,Ae("StructArrayLayout2i4i12",Wl);class Yr extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,u){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,s,o,l,u)}emplace(e,i,s,o,l,u,p){const g=4*e,m=8*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.uint8[m+4]=o,this.uint8[m+5]=l,this.uint8[m+6]=u,this.uint8[m+7]=p,e}}Yr.prototype.bytesPerElement=8,Ae("StructArrayLayout2i4ub8",Yr);class io extends bt{_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 o=2*e;return this.float32[o+0]=i,this.float32[o+1]=s,e}}io.prototype.bytesPerElement=8,Ae("StructArrayLayout2f8",io);class Hl extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,u,p,g,m,v){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,s,o,l,u,p,g,m,v)}emplace(e,i,s,o,l,u,p,g,m,v,_){const T=10*e;return this.uint16[T+0]=i,this.uint16[T+1]=s,this.uint16[T+2]=o,this.uint16[T+3]=l,this.uint16[T+4]=u,this.uint16[T+5]=p,this.uint16[T+6]=g,this.uint16[T+7]=m,this.uint16[T+8]=v,this.uint16[T+9]=_,e}}Hl.prototype.bytesPerElement=20,Ae("StructArrayLayout10ui20",Hl);class Xl extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,u,p,g){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,s,o,l,u,p,g)}emplace(e,i,s,o,l,u,p,g,m){const v=8*e;return this.uint16[v+0]=i,this.uint16[v+1]=s,this.uint16[v+2]=o,this.uint16[v+3]=l,this.uint16[v+4]=u,this.uint16[v+5]=p,this.uint16[v+6]=g,this.uint16[v+7]=m,e}}Xl.prototype.bytesPerElement=16,Ae("StructArrayLayout8ui16",Xl);class xa extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,u,p,g,m,v,_,T){const b=this.length;return this.resize(b+1),this.emplace(b,e,i,s,o,l,u,p,g,m,v,_,T)}emplace(e,i,s,o,l,u,p,g,m,v,_,T,b){const I=12*e;return this.int16[I+0]=i,this.int16[I+1]=s,this.int16[I+2]=o,this.int16[I+3]=l,this.uint16[I+4]=u,this.uint16[I+5]=p,this.uint16[I+6]=g,this.uint16[I+7]=m,this.int16[I+8]=v,this.int16[I+9]=_,this.int16[I+10]=T,this.int16[I+11]=b,e}}xa.prototype.bytesPerElement=24,Ae("StructArrayLayout4i4ui4i24",xa);class ba extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const l=3*e;return this.float32[l+0]=i,this.float32[l+1]=s,this.float32[l+2]=o,e}}ba.prototype.bytesPerElement=12,Ae("StructArrayLayout3f12",ba);class Yl extends bt{_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}}Yl.prototype.bytesPerElement=4,Ae("StructArrayLayout1ul4",Yl);class Kl extends bt{_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,o,l,u,p,g,m){const v=this.length;return this.resize(v+1),this.emplace(v,e,i,s,o,l,u,p,g,m)}emplace(e,i,s,o,l,u,p,g,m,v){const _=10*e,T=5*e;return this.int16[_+0]=i,this.int16[_+1]=s,this.int16[_+2]=o,this.int16[_+3]=l,this.int16[_+4]=u,this.int16[_+5]=p,this.uint32[T+3]=g,this.uint16[_+8]=m,this.uint16[_+9]=v,e}}Kl.prototype.bytesPerElement=20,Ae("StructArrayLayout6i1ul2ui20",Kl);class Ar extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,u){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,s,o,l,u)}emplace(e,i,s,o,l,u,p){const g=6*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=o,this.int16[g+3]=l,this.int16[g+4]=u,this.int16[g+5]=p,e}}Ar.prototype.bytesPerElement=12,Ae("StructArrayLayout2i2i2i12",Ar);class wa extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,o,l)}emplace(e,i,s,o,l,u){const p=4*e,g=8*e;return this.float32[p+0]=i,this.float32[p+1]=s,this.float32[p+2]=o,this.int16[g+6]=l,this.int16[g+7]=u,e}}wa.prototype.bytesPerElement=16,Ae("StructArrayLayout2f1f2i16",wa);class ro extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,u){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,s,o,l,u)}emplace(e,i,s,o,l,u,p){const g=16*e,m=4*e,v=8*e;return this.uint8[g+0]=i,this.uint8[g+1]=s,this.float32[m+1]=o,this.float32[m+2]=l,this.int16[v+6]=u,this.int16[v+7]=p,e}}ro.prototype.bytesPerElement=16,Ae("StructArrayLayout2ub2f2i16",ro);class no extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const l=3*e;return this.uint16[l+0]=i,this.uint16[l+1]=s,this.uint16[l+2]=o,e}}no.prototype.bytesPerElement=6,Ae("StructArrayLayout3ui6",no);class so extends bt{_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,o,l,u,p,g,m,v,_,T,b,I,M,A,D){const F=this.length;return this.resize(F+1),this.emplace(F,e,i,s,o,l,u,p,g,m,v,_,T,b,I,M,A,D)}emplace(e,i,s,o,l,u,p,g,m,v,_,T,b,I,M,A,D,F){const R=24*e,B=12*e,V=48*e;return this.int16[R+0]=i,this.int16[R+1]=s,this.uint16[R+2]=o,this.uint16[R+3]=l,this.uint32[B+2]=u,this.uint32[B+3]=p,this.uint32[B+4]=g,this.uint16[R+10]=m,this.uint16[R+11]=v,this.uint16[R+12]=_,this.float32[B+7]=T,this.float32[B+8]=b,this.uint8[V+36]=I,this.uint8[V+37]=M,this.uint8[V+38]=A,this.uint32[B+10]=D,this.int16[R+22]=F,e}}so.prototype.bytesPerElement=48,Ae("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",so);class Jl extends bt{_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,o,l,u,p,g,m,v,_,T,b,I,M,A,D,F,R,B,V,N,K,Q,ae,re,de,pe){const le=this.length;return this.resize(le+1),this.emplace(le,e,i,s,o,l,u,p,g,m,v,_,T,b,I,M,A,D,F,R,B,V,N,K,Q,ae,re,de,pe)}emplace(e,i,s,o,l,u,p,g,m,v,_,T,b,I,M,A,D,F,R,B,V,N,K,Q,ae,re,de,pe,le){const ne=32*e,xe=16*e;return this.int16[ne+0]=i,this.int16[ne+1]=s,this.int16[ne+2]=o,this.int16[ne+3]=l,this.int16[ne+4]=u,this.int16[ne+5]=p,this.int16[ne+6]=g,this.int16[ne+7]=m,this.uint16[ne+8]=v,this.uint16[ne+9]=_,this.uint16[ne+10]=T,this.uint16[ne+11]=b,this.uint16[ne+12]=I,this.uint16[ne+13]=M,this.uint16[ne+14]=A,this.uint16[ne+15]=D,this.uint16[ne+16]=F,this.uint16[ne+17]=R,this.uint16[ne+18]=B,this.uint16[ne+19]=V,this.uint16[ne+20]=N,this.uint16[ne+21]=K,this.uint16[ne+22]=Q,this.uint32[xe+12]=ae,this.float32[xe+13]=re,this.float32[xe+14]=de,this.uint16[ne+30]=pe,this.uint16[ne+31]=le,e}}Jl.prototype.bytesPerElement=64,Ae("StructArrayLayout8i15ui1ul2f2ui64",Jl);class _n extends bt{_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}}_n.prototype.bytesPerElement=4,Ae("StructArrayLayout1f4",_n);class yn extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const l=3*e;return this.uint16[6*e+0]=i,this.float32[l+1]=s,this.float32[l+2]=o,e}}yn.prototype.bytesPerElement=12,Ae("StructArrayLayout1ui2f12",yn);class Ql extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const l=4*e;return this.uint32[2*e+0]=i,this.uint16[l+2]=s,this.uint16[l+3]=o,e}}Ql.prototype.bytesPerElement=8,Ae("StructArrayLayout1ul2ui8",Ql);class Ta extends bt{_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 o=2*e;return this.uint16[o+0]=i,this.uint16[o+1]=s,e}}Ta.prototype.bytesPerElement=4,Ae("StructArrayLayout2ui4",Ta);class vn extends bt{_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}}vn.prototype.bytesPerElement=2,Ae("StructArrayLayout1ui2",vn);class ec extends bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,s,o)}emplace(e,i,s,o,l){const u=4*e;return this.float32[u+0]=i,this.float32[u+1]=s,this.float32[u+2]=o,this.float32[u+3]=l,e}}ec.prototype.bytesPerElement=16,Ae("StructArrayLayout4f16",ec);class gu extends as{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 fe(this.anchorPointX,this.anchorPointY)}}gu.prototype.size=20;class tc extends Kl{get(e){return new gu(this,e)}}Ae("CollisionBoxArray",tc);class _u extends as{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]}}_u.prototype.size=48;class d extends so{get(e){return new _u(this,e)}}Ae("PlacedSymbolArray",d);class t extends as{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]}}t.prototype.size=64;class n extends Jl{get(e){return new t(this,e)}}Ae("SymbolInstanceArray",n);class a extends _n{getoffsetX(e){return this.float32[1*e+0]}}Ae("GlyphOffsetArray",a);class c extends va{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Ae("SymbolLineVertexArray",c);class f extends as{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]}}f.prototype.size=12;class y extends yn{get(e){return new f(this,e)}}Ae("TextAnchorOffsetArray",y);class x extends as{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]}}x.prototype.size=8;class w extends Ql{get(e){return new x(this,e)}}Ae("FeatureIndexArray",w);class S extends to{}class P extends to{}class E extends to{}class C extends Wl{}class z extends Yr{}class O extends io{}class j extends Hl{}class $ extends Xl{}class U extends xa{}class q extends ba{}class Y extends Yl{}class Z extends Ar{}class G extends ro{}class X extends no{}class W extends Ta{}const ee=At([{name:"a_pos",components:2,type:"Int16"}],4),{members:ue}=ee;class oe{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,i,s,o){const l=this.segments[this.segments.length-1];return e>oe.MAX_VERTEX_ARRAY_LENGTH&&pi(`Max vertices per segment is ${oe.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${oe.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!l||l.vertexLength+e>oe.MAX_VERTEX_ARRAY_LENGTH||l.sortKey!==o?this.createNewSegment(i,s,o):l}createNewSegment(e,i,s){const o={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0,vaos:{}};return s!==void 0&&(o.sortKey=s),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(o),o}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,o){return new oe([{vertexOffset:e,primitiveOffset:i,vertexLength:s,primitiveLength:o,vaos:{},sortKey:0}])}}function _e(r,e){return 256*(r=Kt(Math.floor(r),0,255))+Kt(Math.floor(e),0,255)}oe.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ae("SegmentVector",oe);const ye=At([{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"}]),ze=At([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var Ie,me,ke,Re={exports:{}},ut={exports:{}},Dt={exports:{}},_t=(function(){if(ke)return Re.exports;ke=1;var r=(Ie||(Ie=1,ut.exports=function(i,s){var o,l,u,p,g,m,v,_;for(l=i.length-(o=3&i.length),u=s,g=3432918353,m=461845907,_=0;_<l;)v=255&i.charCodeAt(_)|(255&i.charCodeAt(++_))<<8|(255&i.charCodeAt(++_))<<16|(255&i.charCodeAt(++_))<<24,++_,u=27492+(65535&(p=5*(65535&(u=(u^=v=(65535&(v=(v=(65535&v)*g+(((v>>>16)*g&65535)<<16)&4294967295)<<15|v>>>17))*m+(((v>>>16)*m&65535)<<16)&4294967295)<<13|u>>>19))+((5*(u>>>16)&65535)<<16)&4294967295))+((58964+(p>>>16)&65535)<<16);switch(v=0,o){case 3:v^=(255&i.charCodeAt(_+2))<<16;case 2:v^=(255&i.charCodeAt(_+1))<<8;case 1:u^=v=(65535&(v=(v=(65535&(v^=255&i.charCodeAt(_)))*g+(((v>>>16)*g&65535)<<16)&4294967295)<<15|v>>>17))*m+(((v>>>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}),ut.exports),e=(me||(me=1,Dt.exports=function(i,s){for(var o,l=i.length,u=s^l,p=0;l>=4;)o=1540483477*(65535&(o=255&i.charCodeAt(p)|(255&i.charCodeAt(++p))<<8|(255&i.charCodeAt(++p))<<16|(255&i.charCodeAt(++p))<<24))+((1540483477*(o>>>16)&65535)<<16),u=1540483477*(65535&u)+((1540483477*(u>>>16)&65535)<<16)^(o=1540483477*(65535&(o^=o>>>24))+((1540483477*(o>>>16)&65535)<<16)),l-=4,++p;switch(l){case 3:u^=(255&i.charCodeAt(p+2))<<16;case 2:u^=(255&i.charCodeAt(p+1))<<8;case 1:u=1540483477*(65535&(u^=255&i.charCodeAt(p)))+((1540483477*(u>>>16)&65535)<<16)}return u=1540483477*(65535&(u^=u>>>13))+((1540483477*(u>>>16)&65535)<<16),(u^=u>>>15)>>>0}),Dt.exports);return Re.exports=r,Re.exports.murmur3=r,Re.exports.murmur2=e,Re.exports})(),Ft=$e(_t);class Bt{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,i,s,o){this.ids.push(Zi(e)),this.positions.push(i,s,o)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const i=Zi(e);let s=0,o=this.ids.length-1;for(;s<o;){const u=s+o>>1;this.ids[u]>=i?o=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),o=new Uint32Array(e.positions);return Mt(s,o,0,s.length-1),i&&i.push(s.buffer,o.buffer),{ids:s,positions:o}}static deserialize(e){const i=new Bt;return i.ids=e.ids,i.positions=e.positions,i.indexed=!0,i}}function Zi(r){const e=+r;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Ft(String(r))}function Mt(r,e,i,s){for(;i<s;){const o=r[i+s>>1];let l=i-1,u=s+1;for(;;){do l++;while(r[l]<o);do u--;while(r[u]>o);if(l>=u)break;li(r,l,u),li(e,3*l,3*u),li(e,3*l+1,3*u+1),li(e,3*l+2,3*u+2)}u-i<s-u?(Mt(r,e,i,u),i=u+1):(Mt(r,e,u+1,s),s=u)}}function li(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}Ae("FeaturePositionMap",Bt);class wt{constructor(e,i){this.gl=e.gl,this.location=i}}class Ht extends wt{constructor(e,i){super(e,i),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Li extends wt{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 Kr extends wt{constructor(e,i){super(e,i),this.current=et.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 ls=new Float32Array(16);function xn(r){return[_e(255*r.r,255*r.g),_e(255*r.b,255*r.a)]}class ir{constructor(e,i,s){this.value=e,this.uniformNames=i.map((o=>`u_${o}`)),this.type=s}setUniform(e,i,s){e.set(s.constantOr(this.value))}getBinding(e,i,s){return this.type==="color"?new Kr(e,i):new Ht(e,i)}}class rr{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,o){let l=null;o==="u_pattern_to"?l=this.patternTo:o==="u_pattern_from"?l=this.patternFrom:o==="u_dasharray_to"?l=this.dashTo:o==="u_dasharray_from"?l=this.dashFrom:o==="u_pixel_ratio_to"?l=this.pixelRatioTo:o==="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 Li(e,i):new Ht(e,i)}}class Mi{constructor(e,i,s,o){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 o}populatePaintArray(e,i,s){const o=this.paintVertexArray.length,l=this.expression.evaluate(new ft(0,s),i,{},s.canonical,[],s.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(o,e,l)}updatePaintArray(e,i,s,o,l){const u=this.expression.evaluate(new ft(0,l),s,o);this._setPaintValue(e,i,u)}_setPaintValue(e,i,s){if(this.type==="color"){const o=xn(s);for(let l=e;l<i;l++)this.paintVertexArray.emplace(l,o[0],o[1])}else{for(let o=e;o<i;o++)this.paintVertexArray.emplace(o,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(e){var i,s;!((i=this.paintVertexArray)===null||i===void 0)&&i.arrayBuffer.byteLength&&(!((s=this.paintVertexBuffer)===null||s===void 0)&&s.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class qi{constructor(e,i,s,o,l,u){this.expression=e,this.uniformNames=i.map((p=>`u_${p}_t`)),this.type=s,this.useIntegerZoom=o,this.zoom=l,this.maxValue=0,this.paintVertexAttributes=i.map((p=>({name:`a_${p}`,type:"Float32",components:s==="color"?4:2,offset:0}))),this.paintVertexArray=new u}populatePaintArray(e,i,s){const o=this.expression.evaluate(new ft(this.zoom,s),i,{},s.canonical,[],s.formattedSection),l=this.expression.evaluate(new ft(this.zoom+1,s),i,{},s.canonical,[],s.formattedSection),u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(u,e,o,l)}updatePaintArray(e,i,s,o,l){const u=this.expression.evaluate(new ft(this.zoom,l),s,o),p=this.expression.evaluate(new ft(this.zoom+1,l),s,o);this._setPaintValue(e,i,u,p)}_setPaintValue(e,i,s,o){if(this.type==="color"){const l=xn(s),u=xn(o);for(let p=e;p<i;p++)this.paintVertexArray.emplace(p,l[0],l[1],u[0],u[1])}else{for(let l=e;l<i;l++)this.paintVertexArray.emplace(l,s,o);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(o))}}upload(e){var i,s;!((i=this.paintVertexArray)===null||i===void 0)&&i.arrayBuffer.byteLength&&(!((s=this.paintVertexBuffer)===null||s===void 0)&&s.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,o=Kt(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(o)}getBinding(e,i,s){return new Ht(e,i)}}class ci{constructor(e,i,s,o,l,u){this.expression=e,this.type=i,this.useIntegerZoom=s,this.zoom=o,this.layerId=u,this.zoomInPaintVertexArray=new l,this.zoomOutPaintVertexArray=new l}populatePaintArray(e,i,s){const o=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(o,e,this.getPositionIds(i),s)}updatePaintArray(e,i,s,o,l){this._setPaintValues(e,i,this.getPositionIds(s),l)}_setPaintValues(e,i,s,o){const l=this.getPositions(o);if(!l||!s)return;const u=l[s.min],p=l[s.mid],g=l[s.max];if(u&&p&&g)for(let m=e;m<i;m++)this.emplace(this.zoomInPaintVertexArray,m,p,u),this.emplace(this.zoomOutPaintVertexArray,m,p,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 o=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,o,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,o,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Dr extends ci{getPositions(e){return e.imagePositions}getPositionIds(e){var i;return(i=e.patterns)===null||i===void 0?void 0:i[this.layerId]}getVertexAttributes(){return ye.members}emplace(e,i,s,o){e.emplace(i,s.tlbr[0],s.tlbr[1],s.tlbr[2],s.tlbr[3],o.tlbr[0],o.tlbr[1],o.tlbr[2],o.tlbr[3],s.pixelRatio,o.pixelRatio)}}class xr extends ci{getPositions(e){return e.dashPositions}getPositionIds(e){var i;return(i=e.dashes)===null||i===void 0?void 0:i[this.layerId]}getVertexAttributes(){return ze.members}emplace(e,i,s,o){e.emplace(i,0,s.y,s.height,s.width,0,o.y,o.height,o.width)}}class bn{constructor(e,i,s){this.binders={},this._buffers=[];const o=[];for(const l in e.paint._values){if(!s(l))continue;const u=e.paint.get(l);if(!(u instanceof pr&&Qn(u.property.specification)))continue;const p=gi(l,e.type),g=u.value,m=u.property.specification.type,v=u.property.useIntegerZoom,_=u.property.specification["property-type"],T=_==="cross-faded"||_==="cross-faded-data-driven";if(g.kind==="constant")this.binders[l]=T?new rr(g.value,p):new ir(g.value,p,m),o.push(`/u_${l}`);else if(g.kind==="source"||T){const b=Fi(l,m,"source");this.binders[l]=T?l==="line-dasharray"?new xr(g,m,v,i,b,e.id):new Dr(g,m,v,i,b,e.id):new Mi(g,p,m,b),o.push(`/a_${l}`)}else{const b=Fi(l,m,"composite");this.binders[l]=new qi(g,p,m,v,i,b),o.push(`/z_${l}`)}}this.cacheKey=o.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof Mi||i instanceof qi?i.maxValue:0}populatePaintArrays(e,i,s){for(const o in this.binders){const l=this.binders[o];(l instanceof Mi||l instanceof qi||l instanceof ci)&&l.populatePaintArray(e,i,s)}}setConstantPatternPositions(e,i){for(const s in this.binders){const o=this.binders[s];o instanceof rr&&o.setConstantPatternPositions(e,i)}}setConstantDashPositions(e,i){for(const s in this.binders){const o=this.binders[s];o instanceof rr&&o.setConstantDashPositions(e,i)}}updatePaintArrays(e,i,s,o,l){let u=!1;for(const p in e){const g=i.getPositions(p);for(const m of g){const v=s.feature(m.index);for(const _ in this.binders){const T=this.binders[_];if((T instanceof Mi||T instanceof qi||T instanceof ci)&&T.expression.isStateDependent===!0){const b=o.paint.get(_);T.expression=b.value,T.updatePaintArray(m.start,m.end,v,e[p],l),u=!0}}}}return u}defines(){const e=[];for(const i in this.binders){const s=this.binders[i];(s instanceof ir||s instanceof rr)&&e.push(...s.uniformNames.map((o=>`#define HAS_UNIFORM_${o}`)))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof Mi||s instanceof qi)for(const o of s.paintVertexAttributes)e.push(o.name);else if(s instanceof ci){const o=s.getVertexAttributes();for(const l of o)e.push(l.name)}}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof ir||s instanceof rr||s instanceof qi)for(const o of s.uniformNames)e.push(o)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,i){const s=[];for(const o in this.binders){const l=this.binders[o];if(l instanceof ir||l instanceof rr||l instanceof qi){for(const u of l.uniformNames)if(i[u]){const p=l.getBinding(e,i[u],u);s.push({name:u,property:o,binding:p})}}}return s}setUniforms(e,i,s,o){for(const{name:l,property:u,binding:p}of i)this.binders[u].setUniform(p,o,s.get(u),l)}updatePaintBuffers(e){this._buffers=[];for(const i in this.binders){const s=this.binders[i];if(e&&s instanceof ci){const o=e.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;o&&this._buffers.push(o)}else(s instanceof Mi||s instanceof qi)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(e){for(const i in this.binders){const s=this.binders[i];(s instanceof Mi||s instanceof qi||s instanceof ci)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof Mi||i instanceof qi||i instanceof ci)&&i.destroy()}}}class Ot{constructor(e,i,s=()=>!0){this.programConfigurations={};for(const o of e)this.programConfigurations[o.id]=new bn(o,i,s);this.needsUpload=!1,this._featureMap=new Bt,this._bufferOffset=0}populatePaintArrays(e,i,s,o){for(const l in this.programConfigurations)this.programConfigurations[l].populatePaintArrays(e,i,o);i.id!==void 0&&this._featureMap.add(i.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,s,o){for(const l of s)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(e,this._featureMap,i,l,o)||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 gi(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 Fi(r,e,i){const s={color:{source:io,composite:ec},number:{source:_n,composite:io}},o=(function(l){return{"line-pattern":{source:j,composite:j},"fill-pattern":{source:j,composite:j},"fill-extrusion-pattern":{source:j,composite:j},"line-dasharray":{source:$,composite:$}}[l]})(r);return o?.[i]||s[e][i]}Ae("ConstantBinder",ir),Ae("CrossFadedConstantBinder",rr),Ae("SourceExpressionBinder",Mi),Ae("CrossFadedPatternBinder",Dr),Ae("CrossFadedDasharrayBinder",xr),Ae("CompositeExpressionBinder",qi),Ae("ProgramConfiguration",bn,{omit:["_buffers"]}),Ae("ProgramConfigurationSet",Ot);const Tt=Math.pow(2,14)-1,wn=-Tt-1;function zr(r){const e=Be/r.extent,i=r.loadGeometry();for(const s of i)for(const o of s){const l=Math.round(o.x*e),u=Math.round(o.y*e);o.x=Kt(l,wn,Tt),o.y=Kt(u,wn,Tt),(l<o.x||l>o.x+1||u<o.y||u>o.y+1)&&pi("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return i}function kr(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?zr(r):[]}}const Sa=-32768;function wh(r,e,i,s,o){r.emplaceBack(Sa+8*e+s,Sa+8*i+o)}class ic{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 P,this.indexArray=new X,this.segments=new oe,this.programConfigurations=new Ot(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){const o=this.layers[0],l=[];let u=null,p=!1,g=o.type==="heatmap";if(o.type==="circle"){const v=o;u=v.layout.get("circle-sort-key"),p=!u.isConstant(),g||(g=v.paint.get("circle-pitch-alignment")==="map")}const m=g?i.subdivisionGranularity.circle:1;for(const{feature:v,id:_,index:T,sourceLayerIndex:b}of e){const I=this.layers[0]._featureFilter.needGeometry,M=kr(v,I);if(!this.layers[0]._featureFilter.filter(new ft(this.zoom),M,s))continue;const A=p?u.evaluate(M,{},s):void 0,D={id:_,properties:v.properties,type:v.type,sourceLayerIndex:b,index:T,geometry:I?M.geometry:zr(v),patterns:{},sortKey:A};l.push(D)}p&&l.sort(((v,_)=>v.sortKey-_.sortKey));for(const v of l){const{geometry:_,index:T,sourceLayerIndex:b}=v,I=e[T].feature;this.addFeature(v,_,T,s,m),i.featureIndex.insert(I,_,T,b,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,ue),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,o,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 p=u.length;for(const g of i)for(const m of g){const v=m.x,_=m.y;if(v<0||v>=Be||_<0||_>=Be)continue;const T=this.segments.prepareSegment(p*p,this.layoutVertexArray,this.indexArray,e.sortKey),b=T.vertexLength;for(let I=0;I<p;I++)for(let M=0;M<p;M++)wh(this.layoutVertexArray,v,_,u[M],u[I]);for(let I=0;I<p-1;I++)for(let M=0;M<p-1;M++){const A=b+I*p+M,D=b+(I+1)*p+M;this.indexArray.emplaceBack(A,D+1,A+1),this.indexArray.emplaceBack(A,D,D+1)}T.vertexLength+=p*p,T.primitiveLength+=(p-1)*(p-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:{},canonical:o})}}function Jr(r,e){for(const i of r)if(Pa(e,i))return!0;for(const i of e)if(Pa(r,i))return!0;return ao(r,e)}function oo(r,e,i){return!!Pa(r,e)||lo(e,r,i)}function rc(r,e){if(r.length===1)return Od(e,r[0]);for(const i of e)for(const s of i)if(Pa(r,s))return!0;for(const i of r)if(Od(e,i))return!0;for(const i of e)if(ao(r,i))return!0;return!1}function yu(r,e,i){if(r.length>1){if(ao(r,e))return!0;for(const s of e)if(lo(s,r,i))return!0}for(const s of r)if(lo(s,e,i))return!0;return!1}function ao(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const s=r[i],o=r[i+1];for(let l=0;l<e.length-1;l++)if(vu(s,o,e[l],e[l+1]))return!0}return!1}function vu(r,e,i,s){return Yi(r,i,s)!==Yi(e,i,s)&&Yi(r,e,i)!==Yi(r,e,s)}function lo(r,e,i){const s=i*i;if(e.length===1)return r.distSqr(e[0])<s;for(let o=1;o<e.length;o++)if(Bd(r,e[o-1],e[o])<s)return!0;return!1}function Bd(r,e,i){const s=e.distSqr(i);if(s===0)return r.distSqr(e);const o=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/s;return r.distSqr(o<0?e:o>1?i:i.sub(e)._mult(o)._add(e))}function Od(r,e){let i,s,o,l=!1;for(const u of r){i=u;for(let p=0,g=i.length-1;p<i.length;g=p++)s=i[p],o=i[g],s.y>e.y!=o.y>e.y&&e.x<(o.x-s.x)*(e.y-s.y)/(o.y-s.y)+s.x&&(l=!l)}return l}function Pa(r,e){let i=!1;for(let s=0,o=r.length-1;s<r.length;o=s++){const l=r[s],u=r[o];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 Sm(r,e,i){const s=i[0],o=i[2];if(r.x<s.x&&e.x<s.x||r.x>o.x&&e.x>o.x||r.y<s.y&&e.y<s.y||r.y>o.y&&e.y>o.y)return!1;const l=Yi(r,e,i[0]);return l!==Yi(r,e,i[1])||l!==Yi(r,e,i[2])||l!==Yi(r,e,i[3])}function Ia(r,e,i){const s=e.paint.get(r).value;return s.kind==="constant"?s.value:i.programConfigurations.get(e.id).getMaxValue(r)}function xu(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function bu(r,e,i,s,o){if(!e[0]&&!e[1])return r;const l=fe.convert(e)._mult(o);i==="viewport"&&l._rotate(-s);const u=[];for(const p of r)u.push(p.sub(l));return u}function Pm(r){const e=[];for(let i=0;i<r.length;i++){const s=r[i],o=e.at(-1);(i===0||o&&!s.equals(o))&&e.push(s)}return e}function Im({queryGeometry:r,size:e},i){return oo(r,i,e)}function Mm({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o},l){return oo(r,l,e*(i.projectTileCoordinates(l.x,l.y,s,o).signedDistanceFromCamera/i.cameraToCenterDistance))}function Em({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o},l){const u=i.projectTileCoordinates(l.x,l.y,s,o).signedDistanceFromCamera,p=e*(i.cameraToCenterDistance/u);return oo(r,Th(l,i,s,o),p)}function Cm({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o},l){return oo(r,Th(l,i,s,o),e)}function Vd({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o,pitchAlignment:l="map",pitchScale:u="map"},p){const g=l==="map"?u==="map"?Im:Mm:u==="map"?Em:Cm,m={queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o};for(const v of p)for(const _ of v)if(g(m,_))return!0;return!1}function Th(r,e,i,s){const o=e.projectTileCoordinates(r.x,r.y,i,s).point;return new fe((.5*o.x+.5)*e.width,(.5*-o.y+.5)*e.height)}let jd,Nd;Ae("CircleBucket",ic,{omit:["layers"]});var Am={get paint(){return Nd=Nd||new mi({"circle-radius":new Fe(ce.paint_circle["circle-radius"]),"circle-color":new Fe(ce.paint_circle["circle-color"]),"circle-blur":new Fe(ce.paint_circle["circle-blur"]),"circle-opacity":new Fe(ce.paint_circle["circle-opacity"]),"circle-translate":new De(ce.paint_circle["circle-translate"]),"circle-translate-anchor":new De(ce.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new De(ce.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new De(ce.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Fe(ce.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Fe(ce.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Fe(ce.paint_circle["circle-stroke-opacity"])})},get layout(){return jd=jd||new mi({"circle-sort-key":new Fe(ce.layout_circle["circle-sort-key"])})}};class Dm extends Ri{constructor(e,i){super(e,Am,i)}createBucket(e){return new ic(e)}queryRadius(e){const i=e;return Ia("circle-radius",this,i)+Ia("circle-stroke-width",this,i)+xu(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:o,transform:l,pixelsToTileUnits:u,unwrappedTileID:p,getElevation:g}){const m=bu(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-l.bearingInRadians,u),v=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 b,I;return T==="map"?(b=m,I=v*u):(b=(function(M,A,D,F){return M.map((R=>Th(R,A,D,F)))})(m,l,p,g),I=v),Vd({queryGeometry:b,size:I,transform:l,unwrappedTileID:p,getElevation:g,pitchAlignment:T,pitchScale:_},o)}}class Ud extends ic{}let Gd;Ae("HeatmapBucket",Ud,{omit:["layers"]});var zm={get paint(){return Gd=Gd||new mi({"heatmap-radius":new Fe(ce.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Fe(ce.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new De(ce.paint_heatmap["heatmap-intensity"]),"heatmap-color":new eo(ce.paint_heatmap["heatmap-color"]),"heatmap-opacity":new De(ce.paint_heatmap["heatmap-opacity"])})}};function Sh(r,{width:e,height:i},s,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==e*i*s)throw new RangeError(`mismatched image size. expected: ${o.length} but got: ${e*i*s}`)}else o=new Uint8Array(e*i*s);return r.width=e,r.height=i,r.data=o,r}function $d(r,{width:e,height:i},s){if(e===r.width&&i===r.height)return;const o=Sh({},{width:e,height:i},s);Ph(r,o,{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=o.data}function Ph(r,e,i,s,o,l){if(o.width===0||o.height===0)return e;if(o.width>r.width||o.height>r.height||i.x>r.width-o.width||i.y>r.height-o.height)throw new RangeError("out of range source coordinates for image copy");if(o.width>e.width||o.height>e.height||s.x>e.width-o.width||s.y>e.height-o.height)throw new RangeError("out of range destination coordinates for image copy");const u=r.data,p=e.data;if(u===p)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<o.height;g++){const m=((i.y+g)*r.width+i.x)*l,v=((s.y+g)*e.width+s.x)*l;for(let _=0;_<o.width*l;_++)p[v+_]=u[m+_]}return e}class nc{constructor(e,i){Sh(this,e,1,i)}resize(e){$d(this,e,1)}clone(){return new nc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,o,l){Ph(e,i,s,o,l,1)}}class Wi{constructor(e,i){Sh(this,e,4,i)}resize(e){$d(this,e,4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Wi({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,o,l){Ph(e,i,s,o,l,4)}setPixel(e,i,s){const o=4*(e*this.width+i);this.data[o+0]=Math.round(255*s.r/s.a),this.data[o+1]=Math.round(255*s.g/s.a),this.data[o+2]=Math.round(255*s.b/s.a),this.data[o+3]=Math.round(255*s.a)}}function Zd(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 qd(r){const e={},i=r.resolution||256,s=r.clips?r.clips.length:1,o=r.image||new Wi({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,p,g)=>{e[r.evaluationKey]=g;const m=r.expression.evaluate(e);o.setPixel(u/4/i,p/4,m)};if(r.clips)for(let u=0,p=0;u<s;++u,p+=4*i)for(let g=0,m=0;g<i;g++,m+=4){const v=g/(i-1),{start:_,end:T}=r.clips[u];l(p,m,_*(1-v)+T*v)}else for(let u=0,p=0;u<i;u++,p+=4)l(0,p,u/(i-1));return o}Ae("AlphaImage",nc),Ae("RGBAImage",Wi);const Ih="big-fb";class km extends Ri{createBucket(e){return new Ud(e)}constructor(e,i){super(e,zm,i),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=qd({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Ih)&&this.heatmapFbos.delete(Ih)}queryRadius(e){return Ia("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:o,transform:l,pixelsToTileUnits:u,unwrappedTileID:p,getElevation:g}){return Vd({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(i,s)*u,transform:l,unwrappedTileID:p,getElevation:g},o)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}}let Wd;var Rm={get paint(){return Wd=Wd||new mi({"hillshade-illumination-direction":new De(ce.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new De(ce.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new De(ce.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new De(ce.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new De(ce.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new De(ce.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new De(ce.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new De(ce.paint_hillshade["hillshade-method"]),resampling:new De(ce.paint_hillshade.resampling)})}};class Lm extends Ri{constructor(e,i){super(e,Rm,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,o=this.paint.get("hillshade-shadow-color").values;const l=Math.max(e.length,i.length,s.length,o.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))),o=o.concat(Array(l-o.length).fill(o.at(-1)));const u=i.map(Ja);return{directionRadians:e.map(Ja),altitudeRadians:u,shadowColor:o,highlightColor:s}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}}let Hd;var Fm={get paint(){return Hd=Hd||new mi({"color-relief-opacity":new De(ce["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new eo(ce["paint_color-relief"]["color-relief-color"]),resampling:new De(ce["paint_color-relief"].resampling)})}};function Xd(r){return"data"in r}class Mh{constructor(e,i,s,o){this.context=e,this.format=s,this.texture=e.gl.createTexture(),this._ownedHandle=this.texture,this.update(i,o)}update(e,i,s){var o;const{width:l,height:u}=e,p=(((o=this.size)===null||o===void 0?void 0:o[0])!==l||this.size[1]!==u)&&!s,{context:g}=this,{gl:m}=g;this.useMipmap=!!i?.useMipmap,m.bindTexture(m.TEXTURE_2D,this.texture),g.pixelStoreUnpackFlipY.set(!1),g.pixelStoreUnpack.set(1);const v=this.format===m.RGBA&&i?.premultiply!==!1;if(p)this.size=[l,u],Xd(e)?(g.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(e,v,l,u,m)):(g.pixelStoreUnpackPremultiplyAlpha.set(v),this._uploadDomImage(e,m));else{const{x:_,y:T}=s||{x:0,y:0};Xd(e)?(g.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(e,v,_,T,l,u,m)):(g.pixelStoreUnpackPremultiplyAlpha.set(v),this._updateDomImage(e,_,T,m))}this.useMipmap&&this.isSizePowerOfTwo()&&m.generateMipmap(m.TEXTURE_2D),g.pixelStoreUnpackFlipY.setDefault(),g.pixelStoreUnpack.setDefault(),g.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(e,i){i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,i.UNSIGNED_BYTE,e)}_uploadRawData(e,i,s,o,l){let{data:u}=e;i&&u&&(u=Zd(u)),l.texImage2D(l.TEXTURE_2D,0,this.format,s,o,0,this.format,l.UNSIGNED_BYTE,u)}_updateDomImage(e,i,s,o){o.texSubImage2D(o.TEXTURE_2D,0,i,s,o.RGBA,o.UNSIGNED_BYTE,e)}_updateRawData(e,i,s,o,l,u,p){let{data:g}=e;i&&g&&(g=Zd(g)),p.texSubImage2D(p.TEXTURE_2D,0,s,o,l,u,p.RGBA,p.UNSIGNED_BYTE,g)}bind(e,i,s){const{context:o}=this,{gl:l}=o;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 Yd{constructor(e,i,s,o=1,l=1,u=1,p=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 pi(`"${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=o,this.greenFactor=l,this.blueFactor=u,this.baseShift=p;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 v=0;v<g;v++){const _=this.get(m,v);_>this.max&&(this.max=_),_<this.min&&(this.min=_)}}get(e,i){const s=new Uint8Array(this.data.buffer),o=4*this._idx(e,i);return this.unpack(s[o],s[o+1],s[o+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 Wi({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 o=i*this.dim,l=i*this.dim+this.dim,u=s*this.dim,p=s*this.dim+this.dim;switch(i){case-1:o=l-1;break;case 1:l=o+1}switch(s){case-1:u=p-1;break;case 1:p=u+1}const g=-i*this.dim,m=-s*this.dim;for(let v=u;v<p;v++)for(let _=o;_<l;_++)this.data[this._idx(_,v)]=e.data[this._idx(_+g,v+m)]}}function Kd(r,e){const i=e[0],s=e[1],o=e[2],l=e[3],u=Math.min(i,s,o),p=Math.round((r+l)/u);return{r:Math.floor(p*u/i)%256,g:Math.floor(p*u/s)%256,b:Math.floor(p*u/o)%256}}Ae("DEMData",Yd);class Bm extends Ri{constructor(e,i){super(e,Fm,i)}_createColorRamp(e){const i={elevationStops:[],colorStops:[]},s=this._transitionablePaint._values["color-relief-color"].value.expression;if(s instanceof ta&&s._styleExpression.expression instanceof Ii){this.colorRampExpression=s;const u=s._styleExpression.expression;i.elevationStops=u.labels,i.colorStops=[];for(const p of i.elevationStops)i.colorStops.push(u.evaluate({globals:{elevation:p}}))}if(i.elevationStops.length<1&&(i.elevationStops=[0],i.colorStops=[et.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 o={elevationStops:[],colorStops:[]},l=(i.elevationStops.length-1)/(e-1);for(let u=0;u<i.elevationStops.length-.5;u+=l)o.elevationStops.push(i.elevationStops[Math.round(u)]),o.colorStops.push(i.colorStops[Math.round(u)]);return pi(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${i.elevationStops.length}`),o}_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 o=this._createColorRamp(i),l=new Wi({width:o.colorStops.length,height:1}),u=new Wi({width:o.colorStops.length,height:1});for(let p=0;p<o.elevationStops.length;p++){const g=Kd(o.elevationStops[p],s);u.setPixel(0,p,new et(g.r/255,g.g/255,g.b/255,1)),l.setPixel(0,p,o.colorStops[p])}return this.colorRampTextures={elevationTexture:new Mh(e,u,e.gl.RGBA),colorTexture:new Mh(e,l,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}const Om=At([{name:"a_pos",components:2,type:"Int16"}],4),{members:Vm}=Om;function wu(r,e,i){const s=i.patternDependencies;let o=!1;for(const l of e){const u=l.paint.get(`${r}-pattern`);u.isConstant()||(o=!0);const p=u.constantOr(null);p&&(o=!0,s[p.to]=!0,s[p.from]=!0)}return o}function Eh(r,e,i,s,o){const{zoom:l}=s,u=o.patternDependencies;for(const p of e){const g=p.paint.get(`${r}-pattern`).value;if(g.kind!=="constant"){let m=g.evaluate({zoom:l-1},i,{},o.availableImages),v=g.evaluate({zoom:l},i,{},o.availableImages),_=g.evaluate({zoom:l+1},i,{},o.availableImages);m=m?.name?m.name:m,v=v?.name?v.name:v,_=_?.name?_.name:_,u[m]=!0,u[v]=!0,u[_]=!0,i.patterns[p.id]={min:m,mid:v,max:_}}}return i}function Jd(r,e,i,s,o){let l;if(o===(function(u,p,g,m){let v=0;for(let _=p,T=g-m;_<g;_+=m)v+=(u[T]-u[_])*(u[_+1]+u[T+1]),T=_;return v})(r,e,i,s)>0)for(let u=e;u<i;u+=s)l=ip(u/s|0,r[u],r[u+1],l);else for(let u=i-s;u>=e;u-=s)l=ip(u/s|0,r[u],r[u+1],l);return l&&Ma(l,l.next)&&(lc(l),l=l.next),l}function co(r,e){if(!r)return r;e||(e=r);let i,s=r;do if(i=!1,s.steiner||!Ma(s,s.next)&&Nt(s.prev,s,s.next)!==0)s=s.next;else{if(lc(s),s=e=s.prev,s===s.next)break;i=!0}while(i||s!==e);return e}function sc(r,e,i,s,o,l,u){if(!r)return;!u&&l&&(function(g,m,v,_){let T=g;do T.z===0&&(T.z=Ch(T.x,T.y,m,v,_)),T.prevZ=T.prev,T.nextZ=T.next,T=T.next;while(T!==g);T.prevZ.nextZ=null,T.prevZ=null,(function(b){let I,M=1;do{let A,D=b;b=null;let F=null;for(I=0;D;){I++;let R=D,B=0;for(let N=0;N<M&&(B++,R=R.nextZ,R);N++);let V=M;for(;B>0||V>0&&R;)B!==0&&(V===0||!R||D.z<=R.z)?(A=D,D=D.nextZ,B--):(A=R,R=R.nextZ,V--),F?F.nextZ=A:b=A,A.prevZ=F,F=A;D=R}F.nextZ=null,M*=2}while(I>1)})(T)})(r,s,o,l);let p=r;for(;r.prev!==r.next;){const g=r.prev,m=r.next;if(l?Nm(r,s,o,l):jm(r))e.push(g.i,r.i,m.i),lc(r),r=m.next,p=m.next;else if((r=m)===p){u?u===1?sc(r=Um(co(r),e),e,i,s,o,l,2):u===2&&Gm(r,e,i,s,o,l):sc(co(r),e,i,s,o,l,1);break}}}function jm(r){const e=r.prev,i=r,s=r.next;if(Nt(e,i,s)>=0)return!1;const o=e.x,l=i.x,u=s.x,p=e.y,g=i.y,m=s.y,v=Math.min(o,l,u),_=Math.min(p,g,m),T=Math.max(o,l,u),b=Math.max(p,g,m);let I=s.next;for(;I!==e;){if(I.x>=v&&I.x<=T&&I.y>=_&&I.y<=b&&oc(o,p,l,g,u,m,I.x,I.y)&&Nt(I.prev,I,I.next)>=0)return!1;I=I.next}return!0}function Nm(r,e,i,s){const o=r.prev,l=r,u=r.next;if(Nt(o,l,u)>=0)return!1;const p=o.x,g=l.x,m=u.x,v=o.y,_=l.y,T=u.y,b=Math.min(p,g,m),I=Math.min(v,_,T),M=Math.max(p,g,m),A=Math.max(v,_,T),D=Ch(b,I,e,i,s),F=Ch(M,A,e,i,s);let R=r.prevZ,B=r.nextZ;for(;R&&R.z>=D&&B&&B.z<=F;){if(R.x>=b&&R.x<=M&&R.y>=I&&R.y<=A&&R!==o&&R!==u&&oc(p,v,g,_,m,T,R.x,R.y)&&Nt(R.prev,R,R.next)>=0||(R=R.prevZ,B.x>=b&&B.x<=M&&B.y>=I&&B.y<=A&&B!==o&&B!==u&&oc(p,v,g,_,m,T,B.x,B.y)&&Nt(B.prev,B,B.next)>=0))return!1;B=B.nextZ}for(;R&&R.z>=D;){if(R.x>=b&&R.x<=M&&R.y>=I&&R.y<=A&&R!==o&&R!==u&&oc(p,v,g,_,m,T,R.x,R.y)&&Nt(R.prev,R,R.next)>=0)return!1;R=R.prevZ}for(;B&&B.z<=F;){if(B.x>=b&&B.x<=M&&B.y>=I&&B.y<=A&&B!==o&&B!==u&&oc(p,v,g,_,m,T,B.x,B.y)&&Nt(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,o=i.next.next;!Ma(s,o)&&ep(s,i,i.next,o)&&ac(s,o)&&ac(o,s)&&(e.push(s.i,i.i,o.i),lc(i),lc(i.next),i=r=o),i=i.next}while(i!==r);return co(i)}function Gm(r,e,i,s,o,l){let u=r;do{let p=u.next.next;for(;p!==u.prev;){if(u.i!==p.i&&Hm(u,p)){let g=tp(u,p);return u=co(u,u.next),g=co(g,g.next),sc(u,e,i,s,o,l,0),void sc(g,e,i,s,o,l,0)}p=p.next}u=u.next}while(u!==r)}function $m(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 Zm(r,e){const i=(function(o,l){let u=l;const p=o.x,g=o.y;let m,v=-1/0;if(Ma(o,u))return u;do{if(Ma(o,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<=p&&M>v&&(v=M,m=u.x<u.next.x?u:u.next,M===p))return m}u=u.next}while(u!==l);if(!m)return null;const _=m,T=m.x,b=m.y;let I=1/0;u=m;do{if(p>=u.x&&u.x>=T&&p!==u.x&&Qd(g<b?p:v,g,T,b,g<b?v:p,g,u.x,u.y)){const M=Math.abs(g-u.y)/(p-u.x);ac(u,o)&&(M<I||M===I&&(u.x>m.x||u.x===m.x&&qm(m,u)))&&(m=u,I=M)}u=u.next}while(u!==_);return m})(r,e);if(!i)return e;const s=tp(i,r);return co(s,s.next),co(i,i.next)}function qm(r,e){return Nt(r.prev,r,e.prev)<0&&Nt(e.next,r,r.next)<0}function Ch(r,e,i,s,o){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*o|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Wm(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 Qd(r,e,i,s,o,l,u,p){return(o-u)*(e-p)>=(r-u)*(l-p)&&(r-u)*(s-p)>=(i-u)*(e-p)&&(i-u)*(l-p)>=(o-u)*(s-p)}function oc(r,e,i,s,o,l,u,p){return!(r===u&&e===p)&&Qd(r,e,i,s,o,l,u,p)}function Hm(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!(function(i,s){let o=i;do{if(o.i!==i.i&&o.next.i!==i.i&&o.i!==s.i&&o.next.i!==s.i&&ep(o,o.next,i,s))return!0;o=o.next}while(o!==i);return!1})(r,e)&&(ac(r,e)&&ac(e,r)&&(function(i,s){let o=i,l=!1;const u=(i.x+s.x)/2,p=(i.y+s.y)/2;do o.y>p!=o.next.y>p&&o.next.y!==o.y&&u<(o.next.x-o.x)*(p-o.y)/(o.next.y-o.y)+o.x&&(l=!l),o=o.next;while(o!==i);return l})(r,e)&&(Nt(r.prev,r,e.prev)||Nt(r,e.prev,e))||Ma(r,e)&&Nt(r.prev,r,r.next)>0&&Nt(e.prev,e,e.next)>0)}function Nt(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function Ma(r,e){return r.x===e.x&&r.y===e.y}function ep(r,e,i,s){const o=Su(Nt(r,e,i)),l=Su(Nt(r,e,s)),u=Su(Nt(i,s,r)),p=Su(Nt(i,s,e));return o!==l&&u!==p||!(o!==0||!Tu(r,i,e))||!(l!==0||!Tu(r,s,e))||!(u!==0||!Tu(i,r,s))||!(p!==0||!Tu(i,e,s))}function Tu(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 ac(r,e){return Nt(r.prev,r,r.next)<0?Nt(r,e,r.next)>=0&&Nt(r,r.prev,e)>=0:Nt(r,e,r.prev)<0||Nt(r,r.next,e)<0}function tp(r,e){const i=Ah(r.i,r.x,r.y),s=Ah(e.i,e.x,e.y),o=r.next,l=e.prev;return r.next=e,e.prev=r,i.next=o,o.prev=i,s.next=i,i.prev=s,l.next=s,s.prev=l,s}function ip(r,e,i,s){const o=Ah(r,e,i);return s?(o.next=s.next,o.prev=s,s.next.prev=o,s.next=o):(o.prev=o,o.next=o),o}function lc(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 Ah(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Ea{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 Pu{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}Pu.noSubdivision=new Pu({fill:new Ea(0,0),line:new Ea(0,0),tile:new Ea(0,0),stencil:new Ea(0,0),circle:1}),Ae("SubdivisionGranularityExpression",Ea),Ae("SubdivisionGranularitySetting",Pu);const Ca=-32768,cc=32767;class Xm{constructor(e,i){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=Be/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),o=0|Math.round(i),l=this._getKey(s,o);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,o),u}_subdivideTrianglesScanline(e){if(this._granularity<2)return(function(o,l){const u=[];for(let p=0;p<l.length;p+=3){const g=l[p],m=l[p+1],v=l[p+2],_=o[2*g],T=o[2*g+1];(o[2*m]-_)*(o[2*v+1]-T)-(o[2*m+1]-T)*(o[2*v]-_)>0?(u.push(g),u.push(v),u.push(m)):(u.push(g),u.push(m),u.push(v))}return u})(this._vertexBuffer,e);const i=[],s=e.length;for(let o=0;o<s;o+=3){const l=[e[o+0],e[o+1],e[o+2]],u=[this._vertexBuffer[2*e[o+0]+0],this._vertexBuffer[2*e[o+0]+1],this._vertexBuffer[2*e[o+1]+0],this._vertexBuffer[2*e[o+1]+1],this._vertexBuffer[2*e[o+2]+0],this._vertexBuffer[2*e[o+2]+1]];let p=1/0,g=1/0,m=-1/0,v=-1/0;for(let M=0;M<3;M++){const A=u[2*M],D=u[2*M+1];p=Math.min(p,A),m=Math.max(m,A),g=Math.min(g,D),v=Math.max(v,D)}if(p===m||g===v)continue;const _=Math.floor(p/this._granularityCellSize),T=Math.ceil(m/this._granularityCellSize),b=Math.floor(g/this._granularityCellSize),I=Math.ceil(v/this._granularityCellSize);if(_!==T||b!==I)for(let M=b;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 o=e*this._granularityCellSize,l=o+this._granularityCellSize,u=[];for(let p=0;p<3;p++){const g=i[2*p],m=i[2*p+1],v=i[2*(p+1)%6],_=i[(2*(p+1)+1)%6],T=i[2*(p+2)%6],b=i[(2*(p+2)+1)%6],I=v-g,M=_-m,A=I===0,D=M===0,F=(o-m)/M,R=(l-m)/M,B=Math.min(F,R),V=Math.max(F,R);if(!D&&(B>=1||V<=0)||D&&(m<o||m>l)){_>=o&&_<=l&&u.push(s[(p+1)%3]);continue}!D&&B>0&&u.push(this._vertexToIndex(g+I*B,m+M*B));const N=g+I*Math.max(B,0),K=g+I*Math.min(V,1);A||this._generateIntraEdgeVertices(u,g,m,v,_,N,K),!D&&V<1&&u.push(this._vertexToIndex(g+I*V,m+M*V)),(D||_>=o&&_<=l)&&u.push(s[(p+1)%3]),!D&&(_<=o||_>=l)&&this._generateInterEdgeVertices(u,g,m,v,_,T,b,K,o,l)}return u}_generateIntraEdgeVertices(e,i,s,o,l,u,p){const g=o-i,m=l-s,v=m===0,_=v?Math.min(i,o):Math.min(u,p),T=v?Math.max(i,o):Math.max(u,p),b=Math.floor(_/this._granularityCellSize)+1,I=Math.ceil(T/this._granularityCellSize)-1;if(v?i<o:u<p)for(let M=b;M<=I;M++){const A=M*this._granularityCellSize;e.push(this._vertexToIndex(A,s+m*(A-i)/g))}else for(let M=I;M>=b;M--){const A=M*this._granularityCellSize;e.push(this._vertexToIndex(A,s+m*(A-i)/g))}}_generateInterEdgeVertices(e,i,s,o,l,u,p,g,m,v){const _=l-s,T=u-o,b=p-l,I=(m-l)/b,M=(v-l)/b,A=Math.min(I,M),D=Math.max(I,M),F=o+T*A;let R=Math.floor(Math.min(F,g)/this._granularityCellSize)+1,B=Math.ceil(Math.max(F,g)/this._granularityCellSize)-1,V=g<F;const N=b===0;if(N&&(p===m||p===v))return;if(N||A>=1||D<=0){const Q=s-p,ae=u+(i-u)*Math.min((m-p)/Q,(v-p)/Q);R=Math.floor(Math.min(ae,g)/this._granularityCellSize)+1,B=Math.ceil(Math.max(ae,g)/this._granularityCellSize)-1,V=g<ae}const K=_>0?v:m;if(V)for(let Q=R;Q<=B;Q++)e.push(this._vertexToIndex(Q*this._granularityCellSize,K));else for(let Q=B;Q>=R;Q--)e.push(this._vertexToIndex(Q*this._granularityCellSize,K))}_generateOutline(e){const i=[];for(const s of e){const o=uo(s,this._granularity,!0),l=this._pointArrayToIndices(o),u=[];for(let p=1;p<l.length;p++)u.push(l[p-1]),u.push(l[p]);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===Ca&&(e[i+1]=-32767),s===cc&&(e[i+1]=32766)}}_generatePoleQuad(e,i,s,o,l,u){o>l!=(u===Ca)?(e.push(i),e.push(s),e.push(this._vertexToIndex(o,u)),e.push(s),e.push(this._vertexToIndex(l,u)),e.push(this._vertexToIndex(o,u))):(e.push(s),e.push(i),e.push(this._vertexToIndex(o,u)),e.push(this._vertexToIndex(l,u)),e.push(s),e.push(this._vertexToIndex(o,u)))}_fillPoles(e,i,s){const o=this._vertexBuffer,l=Be,u=e.length;for(let p=2;p<u;p+=3){const g=e[p-2],m=e[p-1],v=e[p],_=o[2*g],T=o[2*g+1],b=o[2*m],I=o[2*m+1],M=o[2*v],A=o[2*v+1];i&&(T===0&&I===0&&this._generatePoleQuad(e,g,m,_,b,Ca),I===0&&A===0&&this._generatePoleQuad(e,m,v,b,M,Ca),A===0&&T===0&&this._generatePoleQuad(e,v,g,M,_,Ca)),s&&(T===l&&I===l&&this._generatePoleQuad(e,g,m,_,b,cc),I===l&&A===l&&this._generatePoleQuad(e,m,v,b,M,cc),A===l&&T===l&&this._generatePoleQuad(e,v,g,M,_,cc))}}_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:o}=(function(p){const g=[],m=[];for(const v of p)if(v.length!==0){v!==p[0]&&g.push(m.length/2);for(const _ of v)m.push(_.x),m.push(_.y)}return{flattened:m,holeIndices:g}})(e);let l;this._initializeVertices(s);try{const p=(function(m,v,_=2){const T=v&&v.length,b=T?v[0]*_:m.length;let I=Jd(m,0,b,_,!0);const M=[];if(!I||I.next===I.prev)return M;let A,D,F;if(T&&(I=(function(R,B,V,N){const K=[];for(let Q=0,ae=B.length;Q<ae;Q++){const re=Jd(R,B[Q]*N,Q<ae-1?B[Q+1]*N:R.length,N,!1);re===re.next&&(re.steiner=!0),K.push(Wm(re))}K.sort($m);for(let Q=0;Q<K.length;Q++)V=Zm(K[Q],V);return V})(m,v,I,_)),m.length>80*_){A=m[0],D=m[1];let R=A,B=D;for(let V=_;V<b;V+=_){const N=m[V],K=m[V+1];N<A&&(A=N),K<D&&(D=K),N>R&&(R=N),K>B&&(B=K)}F=Math.max(R-A,B-D),F=F!==0?32767/F:0}return sc(I,M,_,A,D,F,0),M})(s,o),g=this._convertIndices(s,p);l=this._subdivideTrianglesScanline(g)}catch(p){console.error(p)}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(const o of i)s.push(this._vertexToIndex(e[2*o],e[2*o+1]));return s}_pointArrayToIndices(e){const i=[];for(const s of e)i.push(this._vertexToIndex(s.x,s.y));return i}}function rp(r,e,i,s=!0){return new Xm(i,e).subdividePolygonInternal(r,s)}function uo(r,e,i=!1){if(!r||r.length<1)return[];if(r.length<2)return[];const s=r[0],o=r[r.length-1],l=i&&(s.x!==o.x||s.y!==o.y);if(e<2)return l?[...r,r[0]]:[...r];const u=Math.floor(Be/e),p=[];p.push(new fe(r[0].x,r[0].y));const g=r.length,m=l?g:g-1;for(let v=0;v<m;v++){const _=r[v],T=v<g-1?r[v+1]:r[0],b=_.x,I=_.y,M=T.x,A=T.y,D=b!==M,F=I!==A;if(!D&&!F)continue;const R=M-b,B=A-I,V=Math.abs(R),N=Math.abs(B);let K=b,Q=I;for(;;){const re=R>0?(Math.floor(K/u)+1)*u:(Math.ceil(K/u)-1)*u,de=B>0?(Math.floor(Q/u)+1)*u:(Math.ceil(Q/u)-1)*u,pe=Math.abs(K-re),le=Math.abs(Q-de),ne=Math.abs(K-M),xe=Math.abs(Q-A),Me=D?pe/V:Number.POSITIVE_INFINITY,Pe=F?le/N:Number.POSITIVE_INFINITY;if((ne<=pe||!D)&&(xe<=le||!F))break;if(Me<Pe&&D||!F){K=re,Q+=B*Me;const be=new fe(K,Math.round(Q));p[p.length-1].x===be.x&&p[p.length-1].y===be.y||p.push(be)}else{K+=R*Pe,Q=de;const be=new fe(Math.round(K),Q);p[p.length-1].x===be.x&&p[p.length-1].y===be.y||p.push(be)}}const ae=new fe(M,A);p[p.length-1].x===ae.x&&p[p.length-1].y===ae.y||p.push(ae)}return p}function Ym(r,e,i){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let s=0,o=r[2*e[0]];for(let g=1;g<e.length;g++){const m=r[2*e[g]];m<o&&(o=m,s=g)}const l=e.length;let u=s,p=(u+1)%l;for(;;){const g=u-1>=0?u-1:l-1,m=(p+1)%l,v=r[2*e[g]],_=r[2*e[m]],T=r[2*e[u]],b=r[2*e[u]+1],I=r[2*e[p]+1];let M=!1;if(v<_)M=!0;else if(v>_)M=!1;else{const A=I-b,D=-(r[2*e[p]]-T),F=b<I?1:-1;((v-T)*A+(r[2*e[g]+1]-b)*D)*F>((_-T)*A+(r[2*e[m]+1]-b)*D)*F&&(M=!0)}if(M){const A=e[g],D=e[u],F=e[p];A!==D&&A!==F&&D!==F&&i.push(F,D,A),u--,u<0&&(u=l-1)}else{const A=e[m],D=e[u],F=e[p];A!==D&&A!==F&&D!==F&&i.push(F,D,A),p++,p>=l&&(p=0)}if(g===m)break}}function np(r,e,i,s,o,l,u,p,g){const m=o.length/2,v=u&&p&&g;if(m<oe.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 b,I;_.vertexLength+=m,_.primitiveLength+=l.length/3,v&&(I=u.prepareSegment(m,i,p),b=I.vertexLength,I.vertexLength+=m);for(let M=0;M<o.length;M+=2)r(o[M],o[M+1]);if(v)for(const M of g){for(let A=1;A<M.length;A+=2)p.emplaceBack(b+M[A-1],b+M[A]);I.primitiveLength+=M.length/2}}else(function(_,T,b,I,M,A){const D=[];for(let N=0;N<I.length/2;N++)D.push(-1);const F={count:0};let R=0,B=_.getOrCreateLatestSegment(T,b),V=B.vertexLength;for(let N=2;N<M.length;N+=3){const K=M[N-2],Q=M[N-1],ae=M[N];let re=D[K]<R,de=D[Q]<R,pe=D[ae]<R;B.vertexLength+((re?1:0)+(de?1:0)+(pe?1:0))>oe.MAX_VERTEX_ARRAY_LENGTH&&(B=_.createNewSegment(T,b),R=F.count,re=!0,de=!0,pe=!0,V=0);const le=uc(D,I,A,F,K,re,B),ne=uc(D,I,A,F,Q,de,B),xe=uc(D,I,A,F,ae,pe,B);b.emplaceBack(V+le-R,V+ne-R,V+xe-R),B.primitiveLength++}})(e,i,s,o,l,r),v&&(function(_,T,b,I,M,A){const D=[];for(let N=0;N<I.length/2;N++)D.push(-1);const F={count:0};let R=0,B=_.getOrCreateLatestSegment(T,b),V=B.vertexLength;for(const N of M)for(let K=1;K<N.length;K+=2){const Q=N[K-1],ae=N[K];let re=D[Q]<R,de=D[ae]<R;B.vertexLength+((re?1:0)+(de?1:0))>oe.MAX_VERTEX_ARRAY_LENGTH&&(B=_.createNewSegment(T,b),R=F.count,re=!0,de=!0,V=0);const pe=uc(D,I,A,F,Q,re,B),le=uc(D,I,A,F,ae,de,B);b.emplaceBack(V+pe-R,V+le-R),B.primitiveLength++}})(u,i,p,o,g,r),e.forceNewSegmentOnNextPrepare(),u?.forceNewSegmentOnNextPrepare()}function uc(r,e,i,s,o,l,u){if(l){const p=s.count;return i(e[2*o],e[2*o+1]),r[o]=s.count,s.count++,u.vertexLength++,p}return r[o]}class Dh{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 E,this.indexArray=new X,this.indexArray2=new W,this.programConfigurations=new Ot(e.layers,e.zoom),this.segments=new oe,this.segments2=new oe,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){this.hasDependencies=wu("fill",this.layers,i);const o=this.layers[0].layout.get("fill-sort-key"),l=!o.isConstant(),u=[];for(const{feature:p,id:g,index:m,sourceLayerIndex:v}of e){const _=this.layers[0]._featureFilter.needGeometry,T=kr(p,_);if(!this.layers[0]._featureFilter.filter(new ft(this.zoom),T,s))continue;const b=l?o.evaluate(T,{},s,i.availableImages):void 0,I={id:g,properties:p.properties,type:p.type,sourceLayerIndex:v,index:m,geometry:_?T.geometry:zr(p),patterns:{},sortKey:b};u.push(I)}l&&u.sort(((p,g)=>p.sortKey-g.sortKey));for(const p of u){const{geometry:g,index:m,sourceLayerIndex:v}=p;if(this.hasDependencies){const _=Eh("fill",this.layers,p,{zoom:this.zoom},i);this.patternFeatures.push(_)}else this.addFeature(p,g,m,s,{},i.subdivisionGranularity);i.featureIndex.insert(e[m].feature,g,m,v,this.index)}}update(e,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s})}addFeatures(e,i,s){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.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,Vm),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,o,l,u){for(const p of Zo(i,500)){const g=rp(p,o,u.fill.getGranularityForZoomLevel(o.z)),m=this.layoutVertexArray;np(((v,_)=>{m.emplaceBack(v,_)}),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:o})}}let sp,op;Ae("FillBucket",Dh,{omit:["layers","patternFeatures"]});var Km={get paint(){return op=op||new mi({"fill-antialias":new De(ce.paint_fill["fill-antialias"]),"fill-opacity":new Fe(ce.paint_fill["fill-opacity"]),"fill-color":new Fe(ce.paint_fill["fill-color"]),"fill-outline-color":new Fe(ce.paint_fill["fill-outline-color"]),"fill-translate":new De(ce.paint_fill["fill-translate"]),"fill-translate-anchor":new De(ce.paint_fill["fill-translate-anchor"]),"fill-pattern":new Qs(ce.paint_fill["fill-pattern"])})},get layout(){return sp=sp||new mi({"fill-sort-key":new Fe(ce.layout_fill["fill-sort-key"])})}};class Jm extends Ri{constructor(e,i){super(e,Km,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 Dh(e)}queryRadius(){return xu(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:i,transform:s,pixelsToTileUnits:o}){return rc(bu(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-s.bearingInRadians,o),i)}isTileClipped(){return!0}}const Qm=At([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),eg=At([{name:"a_centroid",components:2,type:"Int16"}],4),{members:tg}=Qm;class hc{constructor(e,i,s,o,l){this.properties={},this.extent=s,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=o,this._values=l,e.readFields(ig,this,i)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,s=[];let o,l=1,u=0,p=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)p+=e.readSVarint(),g+=e.readSVarint(),l===1&&(o&&s.push(o),o=[]),o&&o.push(new fe(p,g));else{if(l!==7)throw new Error(`unknown command ${l}`);o&&o.push(o[0].clone())}}return o&&s.push(o),s}bbox(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let s=1,o=0,l=0,u=0,p=1/0,g=-1/0,m=1/0,v=-1/0;for(;e.pos<i;){if(o<=0){const _=e.readVarint();s=7&_,o=_>>3}if(o--,s===1||s===2)l+=e.readSVarint(),u+=e.readSVarint(),l<p&&(p=l),l>g&&(g=l),u<m&&(m=u),u>v&&(v=u);else if(s!==7)throw new Error(`unknown command ${s}`)}return[p,m,g,v]}toGeoJSON(e,i,s){const o=this.extent*Math.pow(2,s),l=this.extent*e,u=this.extent*i,p=this.loadGeometry();function g(T){return[360*(T.x+l)/o-180,360/Math.PI*Math.atan(Math.exp((1-2*(T.y+u)/o)*Math.PI))-90]}function m(T){return T.map(g)}let v;if(this.type===1){const T=[];for(const I of p)T.push(I[0]);const b=m(T);v=T.length===1?{type:"Point",coordinates:b[0]}:{type:"MultiPoint",coordinates:b}}else if(this.type===2){const T=p.map(m);v=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=ap(p),b=[];for(const I of T)b.push(I.map(m));v=b.length===1?{type:"Polygon",coordinates:b[0]}:{type:"MultiPolygon",coordinates:b}}}const _={type:"Feature",geometry:v,properties:this.properties};return this.id!=null&&(_.id=this.id),_}}function ig(r,e,i){r===1?e.id=i.readVarint():r===2?(function(s,o){const l=s.readVarint()+s.pos;for(;s.pos<l;){const u=o._keys[s.readVarint()],p=o._values[s.readVarint()];o.properties[u]=p}})(i,e):r===3?e.type=i.readVarint():r===4&&(e._geometry=i.pos)}function ap(r){const e=r.length;if(e<=1)return[r];const i=[];let s,o;for(let l=0;l<e;l++){const u=rg(r[l]);u!==0&&(o===void 0&&(o=u<0),o===u<0?(s&&i.push(s),s=[r[l]]):s&&s.push(r[l]))}return s&&i.push(s),i}function rg(r){let e=0;for(let i,s,o=0,l=r.length,u=l-1;o<l;u=o++)i=r[o],s=r[u],e+=(s.x-i.x)*(i.y+s.y);return e}hc.types=["Unknown","Point","LineString","Polygon"];class ng{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(sg,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 hc(this._pbf,i,this.extent,this._keys,this._values)}}function sg(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 o=null;const l=s.readVarint()+s.pos;for(;s.pos<l;){const u=s.readVarint()>>3;o=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(o==null)throw new Error("unknown feature value");return o})(i))}class lp{constructor(e,i){this.layers=e.readFields(og,{},i)}}function og(r,e,i){if(r===3){const s=new ng(i,i.readVarint()+i.pos);s.length&&(e[s.name]=s)}}const zh=Math.pow(2,13);function dc(r,e,i,s,o,l,u,p){r.emplaceBack(e,i,2*Math.floor(s*zh)+u,o*zh*2,l*zh*2,Math.round(p))}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.layoutVertexArray=new C,this.centroidVertexArray=new S,this.indexArray=new X,this.programConfigurations=new Ot(e.layers,e.zoom),this.segments=new oe,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){this.features=[],this.hasDependencies=wu("fill-extrusion",this.layers,i);for(const{feature:o,id:l,index:u,sourceLayerIndex:p}of e){const g=this.layers[0]._featureFilter.needGeometry,m=kr(o,g);if(!this.layers[0]._featureFilter.filter(new ft(this.zoom),m,s))continue;const v={id:l,sourceLayerIndex:p,index:u,geometry:g?m.geometry:zr(o),properties:o.properties,type:o.type,patterns:{}};this.hasDependencies?this.features.push(Eh("fill-extrusion",this.layers,v,{zoom:this.zoom},i)):this.addFeature(v,v.geometry,u,s,{},i.subdivisionGranularity),i.featureIndex.insert(o,v.geometry,u,p,this.index,!0)}}addFeatures(e,i,s){for(const o of this.features){const{geometry:l}=o;this.addFeature(o,l,o.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,tg),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,eg.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,o,l,u){for(const p of Zo(i,500)){const g={x:0,y:0,sampleCount:0},m=this.layoutVertexArray.length;this.processPolygon(g,o,e,p,u);const v=this.layoutVertexArray.length-m,_=Math.floor(g.x/g.sampleCount),T=Math.floor(g.y/g.sampleCount);for(let b=0;b<v;b++)this.centroidVertexArray.emplaceBack(_,T)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:l,canonical:o})}processPolygon(e,i,s,o,l){if(o.length<1||cp(o[0]))return;for(const _ of o)_.length!==0&&ag(e,_);const u={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},p=l.fill.getGranularityForZoomLevel(i.z),g=hc.types[s.type]==="Polygon";for(const _ of o){if(_.length===0||cp(_))continue;const T=uo(_,p,g);this._generateSideFaces(T,u)}if(!g)return;const m=rp(o,i,p,!1),v=this.layoutVertexArray;np(((_,T)=>{dc(v,_,T,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,m.verticesFlattened,m.indicesTriangles)}_generateSideFaces(e,i){let s=0;for(let o=1;o<e.length;o++){const l=e[o],u=e[o-1];if(lg(l,u))continue;i.segment.vertexLength+4>oe.MAX_VERTEX_ARRAY_LENGTH&&(i.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const p=l.sub(u)._perp()._unit(),g=u.dist(l);s+g>32768&&(s=0),dc(this.layoutVertexArray,l.x,l.y,p.x,p.y,0,0,s),dc(this.layoutVertexArray,l.x,l.y,p.x,p.y,0,1,s),s+=g,dc(this.layoutVertexArray,u.x,u.y,p.x,p.y,0,0,s),dc(this.layoutVertexArray,u.x,u.y,p.x,p.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 ag(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 lg(r,e){return r.x===e.x&&(r.x<0||r.x>Be)||r.y===e.y&&(r.y<0||r.y>Be)}function cp(r){return r.every((e=>e.x<0))||r.every((e=>e.x>Be))||r.every((e=>e.y<0))||r.every((e=>e.y>Be))}let up;Ae("FillExtrusionBucket",kh,{omit:["layers","features"]});var cg={get paint(){return up=up||new mi({"fill-extrusion-opacity":new De(ce["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Fe(ce["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new De(ce["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new De(ce["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Qs(ce["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Fe(ce["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Fe(ce["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new De(ce["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class ug extends Ri{constructor(e,i){super(e,cg,i)}createBucket(e){return new kh(e)}queryRadius(){return xu(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:o,transform:l,pixelsToTileUnits:u,pixelPosMatrix:p}){const g=bu(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),v=this.paint.get("fill-extrusion-base").evaluate(i,s),_=(function(b,I){const M=[];for(const A of b){const D=[A.x,A.y,0,1];Ke(D,D,I),M.push(new fe(D[0]/D[3],D[1]/D[3]))}return M})(g,p),T=(function(b,I,M,A){const D=[],F=[],R=A[8]*I,B=A[9]*I,V=A[10]*I,N=A[11]*I,K=A[8]*M,Q=A[9]*M,ae=A[10]*M,re=A[11]*M;for(const de of b){const pe=[],le=[];for(const ne of de){const xe=ne.x,Me=ne.y,Pe=A[0]*xe+A[4]*Me+A[12],be=A[1]*xe+A[5]*Me+A[13],Oe=A[2]*xe+A[6]*Me+A[14],at=A[3]*xe+A[7]*Me+A[15],ht=Oe+V,pt=at+N,vi=Pe+K,zt=be+Q,Xt=Oe+ae,ii=at+re,Pt=new fe((Pe+R)/pt,(be+B)/pt);Pt.z=ht/pt,pe.push(Pt);const hi=new fe(vi/ii,zt/ii);hi.z=Xt/ii,le.push(hi)}D.push(pe),F.push(le)}return[D,F]})(o,v,m,p);return(function(b,I,M){let A=1/0;rc(M,I)&&(A=hp(M,I[0]));for(let D=0;D<I.length;D++){const F=I[D],R=b[D];for(let B=0;B<F.length-1;B++){const V=F[B],N=[V,F[B+1],R[B+1],R[B],V];Jr(M,N)&&(A=Math.min(A,hp(M,N)))}}return A!==1/0&&A})(T[0],T[1],_)}}function pc(r,e){return r.x*e.x+r.y*e.y}function hp(r,e){if(r.length===1){let i=0;const s=e[i++];let o;for(;!o||s.equals(o);)if(o=e[i++],!o)return 1/0;for(;i<e.length;i++){const l=e[i],u=r[0],p=o.sub(s),g=l.sub(s),m=u.sub(s),v=pc(p,p),_=pc(p,g),T=pc(g,g),b=pc(m,p),I=pc(m,g),M=v*T-_*_,A=(T*b-_*I)/M,D=(v*I-_*b)/M,F=s.z*(1-A-D)+o.z*A+l.z*D;if(isFinite(F))return F}return 1/0}{let i=1/0;for(const s of e)i=Math.min(i,s.z);return i}}const dp=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Iu{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 o=s>>4;if(o!==1)throw new Error(`Got v${o} data when expected v1.`);const l=dp[15&s];if(!l)throw new Error("Unrecognized array type.");const[u]=new Uint16Array(e,2,1),[p]=new Uint32Array(e,4,1);return new Iu(p,u,l,e)}constructor(e,i=64,s=Float64Array,o){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=dp.indexOf(this.ArrayType),u=2*e*this.ArrayType.BYTES_PER_ELEMENT,p=e*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-p%8)%8;if(l<0)throw new Error(`Unexpected typed array class: ${s}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+p+g,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+u+p+g),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+p+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 Rh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,s,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:u,nodeSize:p}=this,g=[0,l.length-1,0],m=[];for(;g.length;){const v=g.pop()||0,_=g.pop()||0,T=g.pop()||0;if(_-T<=p){for(let A=T;A<=_;A++){const D=u[2*A],F=u[2*A+1];D>=e&&D<=s&&F>=i&&F<=o&&m.push(l[A])}continue}const b=T+_>>1,I=u[2*b],M=u[2*b+1];I>=e&&I<=s&&M>=i&&M<=o&&m.push(l[b]),(v===0?e<=I:i<=M)&&(g.push(T),g.push(b-1),g.push(1-v)),(v===0?s>=I:o>=M)&&(g.push(b+1),g.push(_),g.push(1-v))}return m}within(e,i,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:l,nodeSize:u}=this,p=[0,o.length-1,0],g=[],m=s*s;for(;p.length;){const v=p.pop()||0,_=p.pop()||0,T=p.pop()||0;if(_-T<=u){for(let A=T;A<=_;A++)fp(l[2*A],l[2*A+1],e,i)<=m&&g.push(o[A]);continue}const b=T+_>>1,I=l[2*b],M=l[2*b+1];fp(I,M,e,i)<=m&&g.push(o[b]),(v===0?e-s<=I:i-s<=M)&&(p.push(T),p.push(b-1),p.push(1-v)),(v===0?e+s>=I:i+s>=M)&&(p.push(b+1),p.push(_),p.push(1-v))}return g}}function Rh(r,e,i,s,o,l){if(o-s<=i)return;const u=s+o>>1;pp(r,e,u,s,o,l),Rh(r,e,i,s,u-1,1-l),Rh(r,e,i,u+1,o,1-l)}function pp(r,e,i,s,o,l){for(;o>s;){if(o-s>600){const m=o-s+1,v=i-s+1,_=Math.log(m),T=.5*Math.exp(2*_/3),b=.5*Math.sqrt(_*T*(m-T)/m)*(v-m/2<0?-1:1);pp(r,e,i,Math.max(s,Math.floor(i-v*T/m+b)),Math.min(o,Math.floor(i+(m-v)*T/m+b)),l)}const u=e[2*i+l];let p=s,g=o;for(fc(r,e,s,i),e[2*o+l]>u&&fc(r,e,s,o);p<g;){for(fc(r,e,p,g),p++,g--;e[2*p+l]<u;)p++;for(;e[2*g+l]>u;)g--}e[2*s+l]===u?fc(r,e,s,g):(g++,fc(r,e,g,o)),g<=i&&(s=g+1),i<=g&&(o=g-1)}}function fc(r,e,i,s){Lh(r,i,s),Lh(e,2*i,2*s),Lh(e,2*i+1,2*s+1)}function Lh(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function fp(r,e,i,s){const o=r-i,l=e-s;return o*o+l*l}function Fh(r,e,i,s){let o=s;const l=e+(i-e>>1);let u,p=i-e;const g=r[e],m=r[e+1],v=r[i],_=r[i+1];for(let T=e+3;T<i;T+=3){const b=hg(r[T],r[T+1],g,m,v,_);if(b>o)u=T,o=b;else if(b===o){const I=Math.abs(T-l);I<p&&(u=T,p=I)}}o>s&&(u-e>3&&Fh(r,e,u,s),r[u+2]=o,i-u>3&&Fh(r,u,i,s))}function hg(r,e,i,s,o,l){let u=o-i,p=l-s;if(u!==0||p!==0){const g=((r-i)*u+(e-s)*p)/(u*u+p*p);g>1?(i=o,s=l):g>0&&(i+=u*g,s+=p*g)}return u=r-i,p=e-s,u*u+p*p}function ui(r,e,i,s){const o={type:e,geom:i},l={id:r??null,type:o.type,geometry:o.geom,tags:s,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(o.type){case"Point":case"MultiPoint":mc(l,o.geom);break;case"LineString":mc(l,o.geom.points);break;case"Polygon":mc(l,o.geom[0].points);break;case"MultiLineString":for(const u of o.geom)mc(l,u.points);break;case"MultiPolygon":for(const u of o.geom)mc(l,u[0].points)}return l}function Bh(r){r.points.length>64&&(r.points=new Float64Array(r.points))}function mc(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 Oh(r,e){const i=[];switch(r.type){case"FeatureCollection":for(let s=0;s<r.features.length;s++)Mu(i,r.features[s],e,s);break;case"Feature":Mu(i,r,e);break;default:Mu(i,{geometry:r,properties:void 0},e)}return i}function Mu(r,e,i,s){if(!e.geometry)return;if(e.geometry.type==="GeometryCollection")return void(function(p,g,m,v,_){for(const T of m.geometries)Mu(p,{id:g.id,geometry:T,properties:g.properties},v,_)})(r,e,e.geometry,i,s);if(!e.geometry.coordinates?.length)return;const l=(function(p,g,m){return g.promoteId?p.properties?.[g.promoteId]:g.generateId?m||0:p.id})(e,i,s),u=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2);switch(e.geometry.type){case"Point":return void(function(p,g,m,v){const _=[];_.push(Aa(m.coordinates[0]),Da(m.coordinates[1]),0),p.push(ui(g,"Point",_,v))})(r,l,e.geometry,e.properties);case"MultiPoint":return void(function(p,g,m,v){const _=[];for(const T of m.coordinates)_.push(Aa(T[0]),Da(T[1]),0);p.push(ui(g,"MultiPoint",_,v))})(r,l,e.geometry,e.properties);case"LineString":return void(function(p,g,m,v,_){const T={points:[]};Vh(m.coordinates,T,v,!1),p.push(ui(g,"LineString",T,_))})(r,l,e.geometry,u,e.properties);case"MultiLineString":return void(function(p,g,m,v,_,T){if(_.lineMetrics)for(const b of m.coordinates){const I={points:[]};Vh(b,I,v,!1),p.push(ui(g,"LineString",I,T))}else{const b=[];jh(m.coordinates,b,v,!1),p.push(ui(g,"MultiLineString",b,T))}})(r,l,e.geometry,u,i,e.properties);case"Polygon":return void(function(p,g,m,v,_){const T=[];jh(m.coordinates,T,v,!0),p.push(ui(g,"Polygon",T,_))})(r,l,e.geometry,u,e.properties);case"MultiPolygon":return void(function(p,g,m,v,_){const T=[];for(const b of m.coordinates){const I=[];jh(b,I,v,!0),T.push(I)}p.push(ui(g,"MultiPolygon",T,_))})(r,l,e.geometry,u,e.properties);default:throw new Error("Input data is not a valid GeoJSON object.")}}function Vh(r,e,i,s){let o,l,u=0;for(let g=0;g<r.length;g++){const m=Aa(r[g][0]),v=Da(r[g][1]);e.points.push(m,v,0),g>0&&(u+=s?(o*v-m*l)/2:Math.sqrt(Math.pow(m-o,2)+Math.pow(v-l,2))),o=m,l=v}const p=e.points.length-3;e.points[2]=1,i>0&&Fh(e.points,0,p,i),e.points[p+2]=1,Bh(e),e.size=Math.abs(u),e.start=0,e.end=e.size}function jh(r,e,i,s){for(let o=0;o<r.length;o++){const l={points:[]};Vh(r[o],l,i,s),e.push(l)}}function Aa(r){return r/360+.5}function Da(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 Eu(r){const e={type:"Feature",geometry:dg(r),properties:r.tags};return r.id!=null&&(e.id=r.id),e}function dg(r){const{type:e,geometry:i}=r;switch(e){case"Point":return{type:e,coordinates:mp(i[0],i[1])};case"MultiPoint":return{type:e,coordinates:Cu(i)};case"LineString":return{type:e,coordinates:Cu(i.points)};case"MultiLineString":case"Polygon":return{type:e,coordinates:i.map((s=>Cu(s.points)))};case"MultiPolygon":return{type:e,coordinates:i.map((s=>s.map((o=>Cu(o.points)))))}}}function Cu(r){const e=[];for(let i=0;i<r.length;i+=3)e.push(mp(r[i],r[i+1]));return e}function mp(r,e){return[gp(r),_p(e)]}function gp(r){return 360*(r-.5)}function _p(r){const e=(180-360*r)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}var Ei;function Tn(r,e,i,s,o,l,u,p){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 v=o===Ei.X?m.minX:m.minY,_=o===Ei.X?m.maxX:m.maxY;if(v>=i&&_<s)g.push(m);else if(!(_<i||v>=s))switch(m.type){case"Point":case"MultiPoint":pg(m,g,i,s,o);continue;case"LineString":fg(m,g,i,s,o,p);continue;case"MultiLineString":mg(m,g,i,s,o);continue;case"Polygon":gg(m,g,i,s,o);continue;case"MultiPolygon":_g(m,g,i,s,o);continue}}return g.length?g:null}function pg(r,e,i,s,o){const l=[];(function(u,p,g,m,v){for(let _=0;_<u.length;_+=3){const T=u[_+v];T>=g&&T<=m&&za(p,u[_],u[_+1],u[_+2])}})(r.geometry,l,i,s,o),l.length&&e.push(ui(r.id,l.length===3?"Point":"MultiPoint",l,r.tags))}function fg(r,e,i,s,o,l){const u=[];if(yp(r.geometry,u,i,s,o,!1,l.lineMetrics),u.length)if(l.lineMetrics)for(const p of u)e.push(ui(r.id,"LineString",p,r.tags));else e.push(u.length>1?ui(r.id,"MultiLineString",u,r.tags):ui(r.id,"LineString",u[0],r.tags))}function mg(r,e,i,s,o){const l=[];Nh(r.geometry,l,i,s,o,!1),l.length&&e.push(l.length!==1?ui(r.id,"MultiLineString",l,r.tags):ui(r.id,"LineString",l[0],r.tags))}function gg(r,e,i,s,o){const l=[];Nh(r.geometry,l,i,s,o,!0),l.length&&e.push(ui(r.id,"Polygon",l,r.tags))}function _g(r,e,i,s,o){const l=[];for(const u of r.geometry){const p=[];Nh(u,p,i,s,o,!0),p.length&&l.push(p)}l.length&&e.push(ui(r.id,"MultiPolygon",l,r.tags))}function yp(r,e,i,s,o,l,u){let p=vp(r);const g=o===Ei.X?yg:vg;let m,v,_=r.start;for(let A=0;A<r.points.length-3;A+=3){const D=r.points[A],F=r.points[A+1],R=r.points[A+2],B=r.points[A+3],V=r.points[A+4],N=o===Ei.X?D:F,K=o===Ei.X?B:V;let Q=!1;u&&(m=Math.sqrt(Math.pow(D-B,2)+Math.pow(F-V,2))),N<i?K>i&&(v=g(p,D,F,B,V,i),u&&(p.start=_+m*v)):N>s?K<s&&(v=g(p,D,F,B,V,s),u&&(p.start=_+m*v)):za(p.points,D,F,R),K<i&&N>=i&&(v=g(p,D,F,B,V,i),Q=!0),K>s&&N<=s&&(v=g(p,D,F,B,V,s),Q=!0),!l&&Q&&(u&&(p.end=_+m*v),e.push(p),p=vp(r)),u&&(_+=m)}let T=r.points.length-3;const b=r.points[T],I=r.points[T+1],M=o===Ei.X?b:I;M>=i&&M<=s&&za(p.points,b,I,r.points[T+2]),T=p.points.length-3,l&&T>=3&&(p.points[T]!==p.points[0]||p.points[T+1]!==p.points[1])&&za(p.points,p.points[0],p.points[1],p.points[2]),p.points.length&&(Bh(p),e.push(p))}function vp(r){return{points:[],size:r.size,start:r.start,end:r.end}}function Nh(r,e,i,s,o,l){for(const u of r)yp(u,e,i,s,o,l,!1)}function za(r,e,i,s){r.push(e,i,s)}function yg(r,e,i,s,o,l){const u=(l-e)/(s-e);return za(r.points,l,i+(o-i)*u,1),u}function vg(r,e,i,s,o,l){const u=(l-i)/(o-i);return za(r.points,e+(s-e)*u,l,1),u}function Uh(r,e){const i=e.buffer/e.extent;let s=r;const o=Tn(r,1,-1-i,i,Ei.X,-1,2,e),l=Tn(r,1,1-i,2+i,Ei.X,-1,2,e);return(o||l)&&(s=Tn(r,1,-i,1+i,Ei.X,-1,2,e)||[],o&&(s=xp(o,1).concat(s)),l&&(s=s.concat(xp(l,-1)))),s}function xp(r,e){const i=[];for(const s of r)switch(s.type){case"Point":case"MultiPoint":{const o=xg(s.geometry,e);i.push(ui(s.id,s.type,o,s.tags));continue}case"LineString":{const o=Gh(s.geometry,e);i.push(ui(s.id,s.type,o,s.tags));continue}case"MultiLineString":case"Polygon":{const o=[];for(const l of s.geometry)o.push(Gh(l,e));i.push(ui(s.id,s.type,o,s.tags));continue}case"MultiPolygon":{const o=[];for(const l of s.geometry){const u=[];for(const p of l)u.push(Gh(p,e));o.push(u)}i.push(ui(s.id,s.type,o,s.tags));continue}}return i}function xg(r,e){const i=[];for(let s=0;s<r.length;s+=3)i.push(r[s]+e,r[s+1],r[s+2]);return i}function Gh(r,e){const i={points:[],size:r.size};r.start!==void 0&&(i.start=r.start,i.end=r.end);for(let s=0;s<r.points.length;s+=3)i.points.push(r.points[s]+e,r.points[s+1],r.points[s+2]);return Bh(i),i}function bg(r,e,i){const s=!!e.newGeometry,o=e.removeAllProperties||e.removeProperties?.length>0||e.addOrUpdateProperties?.length>0;if(s){const l=r[0];let u=Oh({type:"FeatureCollection",features:[{type:"Feature",id:l.id,geometry:e.newGeometry,properties:o?bp(l.tags,e):l.tags}]},i);return u=Uh(u,i),u}if(o){const l=[];for(const u of r){const p={...u};p.tags=bp(p.tags,e),l.push(p)}return l}return r}function bp(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:o}of e.addOrUpdateProperties)i[s]=o;return i}(function(r){r[r.X=0]="X",r[r.Y=1]="Y"})(Ei||(Ei={}));const $h={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:r=>r};class wg{constructor(e){this.options=Object.assign(Object.create($h),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[o,l]=s.geometry.coordinates,[u,p]=[Aa(o),Da(l)];i.push({id:s.id,type:"Point",geometry:[u,p],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($h),s.clusterOptions),this.initialize(e)}createIndex(e){const{log:i,minZoom:s,maxZoom:o}=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[v,_]=m.geometry;v=Math.fround(v),_=Math.fround(_),u.push(v,_,1/0,g,-1,1),this.options.reduce&&u.push(0)}let p=this.trees[o+1]=this.createTree(u);i&&console.timeEnd(l);for(let g=o;g>=s;g--){const m=Date.now();p=this.trees[g]=this.createTree(this.cluster(p,g)),i&&console.log("z%d: %d clusters in %dms",g,p.numItems,Date.now()-m)}i&&console.timeEnd("total time")}getClusters(e,i){return this.getClustersInternal(e,i).map((s=>Eu(s)))}getClustersInternal(e,i){let s=((e[0]+180)%360+360)%360-180;const o=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,o,180,u],i),T=this.getClustersInternal([-180,o,l,u],i);return _.concat(T)}const p=this.trees[this.limitZoom(i)],g=p.range(Aa(s),Da(u),Aa(l),Da(o)),m=p.flatData,v=[];for(const _ of g){const T=this.stride*_;v.push(m[T+5]>1?Tg(m,T,this.clusterProps):this.points[m[T+3]])}return v}getChildren(e){const i=this.getOriginId(e),s=this.getOriginZoom(e),o=new Error("No cluster with the specified id: "+e),l=this.trees[s];if(!l)throw o;const u=l.flatData;if(i*this.stride>=u.length)throw o;const p=this.options.radius/(this.options.extent*Math.pow(2,s-1)),g=l.within(u[i*this.stride],u[i*this.stride+1],p),m=[];for(const v of g){const _=v*this.stride;u[_+4]===e&&m.push(u[_+5]>1?Sg(u,_,this.clusterProps):Eu(this.points[u[_+3]]))}if(m.length===0)throw o;return m}getLeaves(e,i,s){const o=[];return this.appendLeaves(o,e,i=i||10,s=s||0,0),o}getTile(e,i,s){const o=this.trees[this.limitZoom(e)];if(!o)return null;const l=Math.pow(2,e),{extent:u,radius:p}=this.options,g=p/u,m=(s-g)/l,v=(s+1+g)/l,_={transformed:!0,features:[],source:null,x:i,y:s,z:e};return this.addTileFeatures(o.range((i-g)/l,m,(i+1+g)/l,v),o.flatData,i,s,l,_),i===0&&this.addTileFeatures(o.range(1-g/l,m,1,v),o.flatData,l,s,l,_),i===l-1&&this.addTileFeatures(o.range(0,m,g/l,v),o.flatData,-1,s,l,_),_}getClusterExpansionZoom(e){return this.getOriginZoom(e)}appendLeaves(e,i,s,o,l){const u=this.getChildren(i);for(const p of u){const g=p.properties;if(g?.cluster?l+g.point_count<=o?l+=g.point_count:l=this.appendLeaves(e,g.cluster_id,s,o,l):l<o?l++:e.push(p),e.length===s)break}return l}createTree(e){const i=new Iu(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,o,l,u){for(const p of e){const g=p*this.stride,m=i[g+5]>1;let v,_,T;if(m)v=Zh(i,g,this.clusterProps),_=i[g],T=i[g+1];else{const M=this.points[i[g+3]];v=M.tags,[_,T]=M.geometry}const b={type:1,geometry:[[Math.round(this.options.extent*(_*l-s)),Math.round(this.options.extent*(T*l-o))]],tags:v};let I;I=m||this.options.generateId?i[g+3]:this.points[i[g+3]].id,I!==void 0&&(b.id=I),u.features.push(b)}}limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}cluster(e,i){const{radius:s,extent:o,reduce:l,minPoints:u}=this.options,p=s/(o*Math.pow(2,i)),g=e.flatData,m=[],v=this.stride;for(let _=0;_<g.length;_+=v){if(g[_+2]<=i)continue;g[_+2]=i;const T=g[_],b=g[_+1],I=e.within(g[_],g[_+1],p),M=g[_+5];let A=M;for(const D of I){const F=D*v;g[F+2]>i&&(A+=g[F+5])}if(A>M&&A>=u){let D,F=T*M,R=b*M,B=-1;const V=(_/v<<5)+(i+1)+this.points.length;for(const N of I){const K=N*v;if(g[K+2]<=i)continue;g[K+2]=i;const Q=g[K+5];F+=g[K]*Q,R+=g[K+1]*Q,g[K+4]=V,l&&(D||(D=this.map(g,_,!0),B=this.clusterProps.length,this.clusterProps.push(D)),l(D,this.map(g,K)))}g[_+4]=V,m.push(F/A,R/A,1/0,V,-1,A),l&&m.push(B)}else{for(let D=0;D<v;D++)m.push(g[_+D]);if(A>1)for(const D of I){const F=D*v;if(!(g[F+2]<=i)){g[F+2]=i;for(let R=0;R<v;R++)m.push(g[F+R])}}}}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 o=this.points[e[i+3]].tags,l=this.options.map(o);return s&&l===o?Object.assign({},l):l}}function Tg(r,e,i){return{id:r[e+3],type:"Point",tags:Zh(r,e,i),geometry:[r[e],r[e+1]]}}function Sg(r,e,i){return{type:"Feature",id:r[e+3],properties:Zh(r,e,i),geometry:{type:"Point",coordinates:[gp(r[e]),_p(r[e+1])]}}}function Zh(r,e,i){const s=r[e+5],o=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:o})}const qh="geojsonvt_clip_start",Wh="geojsonvt_clip_end";function wp(r,e,i,s,o){const l=e===o.maxZoom?0:o.tolerance/((1<<e)*o.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 p of r)Pg(u,p,l,o);return u}function Pg(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(o,l){const u=[];for(let g=0;g<l.geometry.length;g+=3)u.push(l.geometry[g],l.geometry[g+1]),o.numPoints++,o.numSimplified++;if(!u.length)return;const p={type:1,tags:l.tags||null,geometry:u};l.id!==null&&(p.id=l.id),o.features.push(p)})(r,e);case"LineString":return void(function(o,l,u,p){const g=[];if(Hh(g,l.geometry,o,u,!1,!1),!g.length)return;let m=l.tags||null;if(p.lineMetrics){m={};for(const _ in l.tags)m[_]=l.tags[_];m[qh]=l.geometry.start/l.geometry.size,m[Wh]=l.geometry.end/l.geometry.size}const v={type:2,tags:m,geometry:g};l.id!==null&&(v.id=l.id),o.features.push(v)})(r,e,i,s);case"MultiLineString":case"Polygon":return void(function(o,l,u){const p=[];for(let m=0;m<l.geometry.length;m++)Hh(p,l.geometry[m],o,u,l.type==="Polygon",m===0);if(!p.length)return;const g={type:l.type==="Polygon"?3:2,tags:l.tags||null,geometry:p};l.id!==null&&(g.id=l.id),o.features.push(g)})(r,e,i);case"MultiPolygon":return void(function(o,l,u){const p=[];for(let m=0;m<l.geometry.length;m++){const v=l.geometry[m];for(let _=0;_<v.length;_++)Hh(p,v[_],o,u,!0,_===0)}if(!p.length)return;const g={type:3,tags:l.tags||null,geometry:p};l.id!==null&&(g.id=l.id),o.features.push(g)})(r,e,i)}}function Hh(r,e,i,s,o,l){const u=s*s;if(s>0&&e.size<(o?u:s))return void(i.numPoints+=e.points.length/3);const p=[];for(let g=0;g<e.points.length;g+=3)(s===0||e.points[g+2]>u)&&(i.numSimplified++,p.push(e.points[g],e.points[g+1])),i.numPoints++;o&&(function(g,m){let v=0;for(let _=0,T=g.length,b=T-2;_<T;b=_,_+=2)v+=(g[_]-g[b])*(g[_+1]+g[b+1]);if(v>0===m)for(let _=0,T=g.length;_<T/2;_+=2){const b=g[_],I=g[_+1];g[_]=g[T-2-_],g[_+1]=g[T-1-_],g[T-2-_]=b,g[T-1-_]=I}})(p,l),r.push(p)}function Tp(r,e){if(r.transformed)return r;const i=1<<r.z,s=r.x,o=r.y;for(const l of r.features)l.type===1?Ig(l,e,i,s,o):Mg(l,e,i,s,o);return r.transformed=!0,r}function Ig(r,e,i,s,o){const l=r,u=r.geometry,p=[];for(let g=0;g<u.length;g+=2)p.push(Sp(u[g],u[g+1],e,i,s,o));return l.geometry=p,l}function Mg(r,e,i,s,o){const l=r,u=r.geometry,p=[];for(const g of u){const m=[];for(let v=0;v<g.length;v+=2)m.push(Sp(g[v],g[v+1],e,i,s,o));p.push(m)}return l.geometry=p,l}function Sp(r,e,i,s,o,l){return[Math.round(i*(r*s-o)),Math.round(i*(e*s-l))]}class Eg{constructor(e){this.options=e,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(e){this.splitTile(e,0,0,0),this.options.debug&&(e.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}updateIndex(e,i,s){s.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(i),s.debug>1&&console.timeEnd("invalidating");const[o,l,u]=[0,0,0],p=wp(e,o,l,u,s);p.source=e;const g=Au(o,l,u);if(this.tiles[g]=p,this.tileCoords.push({z:o,x:l,y:u,id:g}),s.debug){const m=`z${o}`;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:o,debug:l}=this.options,u=1<<e,p=Au(e,i=i+u&u-1,s);if(this.tiles[p])return Tp(this.tiles[p],o);l>1&&console.log("drilling down to z%d-%d-%d",e,i,s);let g,m=e,v=i,_=s;for(;!g&&m>0;)m--,v>>=1,_>>=1,g=this.tiles[Au(m,v,_)];return g?.source?(l>1&&(console.log("found parent tile z%d-%d-%d",m,v,_),console.time("drilling down")),this.splitTile(g.source,m,v,_,e,i,s),l>1&&console.timeEnd("drilling down"),this.tiles[p]?Tp(this.tiles[p],o):null):null}splitTile(e,i,s,o,l,u,p){const g=[e,i,s,o],m=this.options,v=m.debug;for(;g.length;){o=g.pop(),s=g.pop(),i=g.pop(),e=g.pop();const _=1<<i,T=Au(i,s,o);let b=this.tiles[T];if(!b&&(v>1&&console.time("creation"),b=this.tiles[T]=wp(e,i,s,o,m),this.tileCoords.push({z:i,x:s,y:o,id:T}),v)){v>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",i,s,o,b.numFeatures,b.numPoints,b.numSimplified),console.timeEnd("creation"));const Q=`z${i}`;this.stats[Q]=(this.stats[Q]||0)+1,this.total++}if(b.source=e,l==null){if(i===m.indexMaxZoom||b.numPoints<=m.indexMaxPoints)continue}else{if(i===m.maxZoom||i===l)continue;if(l!=null){const Q=l-i;if(s!==u>>Q||o!==p>>Q)continue}}if(b.source=null,!e.length)continue;v>1&&console.time("clipping");const I=.5*m.buffer/m.extent,M=.5-I,A=.5+I,D=1+I;let F=null,R=null,B=null,V=null;const N=Tn(e,_,s-I,s+A,Ei.X,b.minX,b.maxX,m),K=Tn(e,_,s+M,s+D,Ei.X,b.minX,b.maxX,m);N&&(F=Tn(N,_,o-I,o+A,Ei.Y,b.minY,b.maxY,m),R=Tn(N,_,o+M,o+D,Ei.Y,b.minY,b.maxY,m)),K&&(B=Tn(K,_,o-I,o+A,Ei.Y,b.minY,b.maxY,m),V=Tn(K,_,o+M,o+D,Ei.Y,b.minY,b.maxY,m)),v>1&&console.timeEnd("clipping"),g.push(F||[],i+1,2*s,2*o),g.push(R||[],i+1,2*s,2*o+1),g.push(B||[],i+1,2*s+1,2*o),g.push(V||[],i+1,2*s+1,2*o+1)}}invalidateTiles(e){if(!e.length)return;const i=this.options,{debug:s}=i;let o=1/0,l=-1/0,u=1/0,p=-1/0;for(const v of e)o=Math.min(o,v.minX),l=Math.max(l,v.maxX),u=Math.min(u,v.minY),p=Math.max(p,v.maxY);const g=i.buffer/i.extent,m=new Set;for(const v in this.tiles){const _=this.tiles[v],T=1<<_.z,b=(_.x-g)/T,I=(_.x+1+g)/T,M=(_.y-g)/T,A=(_.y+1+g)/T;if(l<b||o>=I||p<M||u>=A)continue;let D=!1;for(const F of e)if(F.maxX>=b&&F.minX<I&&F.maxY>=M&&F.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 F=`z${_.z}`;this.stats[F]=(this.stats[F]||0)-1,this.total--}delete this.tiles[v],m.add(v)}}m.size&&(this.tileCoords=this.tileCoords.filter((v=>!m.has(v.id))))}}function Au(r,e,i){return 32*((1<<r)*i+e)+r}const Cg={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:$h,debug:0},Ag=At([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Dg}=Ag,zg=At([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:kg}=zg,Rg=Math.cos(Math.PI/180*37.5),Pp=Math.pow(2,14)/.5;class Xh{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={};for(const i of this.layers)this.gradients[i.id]={};this.layoutVertexArray=new z,this.layoutVertexArray2=new O,this.indexArray=new X,this.programConfigurations=new Ot(e.layers,e.zoom),this.segments=new oe,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){this.hasDependencies=wu("line",this.layers,i)||this.hasLineDasharray(this.layers);const o=this.layers[0].layout.get("line-sort-key"),l=!o.isConstant(),u=[];for(const{feature:p,id:g,index:m,sourceLayerIndex:v}of e){const _=this.layers[0]._featureFilter.needGeometry,T=kr(p,_);if(!this.layers[0]._featureFilter.filter(new ft(this.zoom),T,s))continue;const b=l?o.evaluate(T,{},s):void 0,I={id:g,properties:p.properties,type:p.type,sourceLayerIndex:v,index:m,geometry:_?T.geometry:zr(p),patterns:{},dashes:{},sortKey:b};u.push(I)}l&&u.sort(((p,g)=>p.sortKey-g.sortKey));for(const p of u){const{geometry:g,index:m,sourceLayerIndex:v}=p;this.hasDependencies?(wu("line",this.layers,i)?Eh("line",this.layers,p,{zoom:this.zoom},i):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,p,this.zoom,i),this.patternFeatures.push(p)):this.addFeature(p,g,m,s,{},{},i.subdivisionGranularity),i.featureIndex.insert(e[m].feature,g,m,v,this.index)}}update(e,i,s,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s,dashPositions:o})}addFeatures(e,i,s,o){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,i,s,o,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,kg)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Dg),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.hasOwn(e.properties,qh)&&Object.hasOwn(e.properties,Wh))return{start:+e.properties[qh],end:+e.properties[Wh]}}addFeature(e,i,s,o,l,u,p){const g=this.layers[0].layout,m=g.get("line-join").evaluate(e,{}),v=g.get("line-cap").evaluate(e,{}),_=g.get("line-miter-limit").evaluate(e,{}),T=g.get("line-round-limit").evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(const b of i)this.addLine(b,e,m,v,_,T,o,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:l,dashPositions:u,canonical:o})}addLine(e,i,s,o,l,u,p,g){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=uo(e,p?g.line.getGranularityForZoomLevel(p.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let R=0;R<e.length-1;R++)this.totalDistance+=e[R].dist(e[R+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=hc.types[i.type]==="Polygon";let v=e.length;for(;v>=2&&e[v-1].equals(e[v-2]);)v--;let _=0;for(;_<v-1&&e[_].equals(e[_+1]);)_++;if(v<(m?3:2))return;s==="bevel"&&(l=1.05);const T=this.overscaling<=16?122880/(512*this.overscaling):0,b=this.segments.prepareSegment(10*v,this.layoutVertexArray,this.indexArray);let I,M,A,D,F;this.e1=this.e2=-1,m&&(I=e[v-2],F=e[_].sub(I)._unit()._perp());for(let R=_;R<v;R++){if(A=R===v-1?m?e[_+1]:void 0:e[R+1],A&&e[R].equals(A))continue;F&&(D=F),I&&(M=I),I=e[R],F=A?A.sub(I)._unit()._perp():D,D||(D=F);let B=D.add(F);B.x===0&&B.y===0||B._unit();const V=D.x*F.x+D.y*F.y,N=B.x*F.x+B.y*F.y,K=N!==0?1/N:1/0,Q=2*Math.sqrt(2-2*N),ae=N<Rg&&M&&A,re=D.x*F.y-D.y*F.x>0;if(ae&&R>_){const le=I.dist(M);if(le>2*T){const ne=I.sub(I.sub(M)._mult(T/le)._round());this.updateDistance(M,ne),this.addCurrentVertex(ne,D,0,0,b),M=ne}}const de=M&&A;let pe=de?s:m?"butt":o;if(de&&pe==="round"&&(K<u?pe="miter":K<=2&&(pe="fakeround")),pe==="miter"&&K>l&&(pe="bevel"),pe==="bevel"&&(K>2&&(pe="flipbevel"),K<l&&(pe="miter")),M&&this.updateDistance(M,I),pe==="miter")B._mult(K),this.addCurrentVertex(I,B,0,0,b);else if(pe==="flipbevel"){if(K>100)B=F.mult(-1);else{const le=K*D.add(F).mag()/D.sub(F).mag();B._perp()._mult(le*(re?-1:1))}this.addCurrentVertex(I,B,0,0,b),this.addCurrentVertex(I,B.mult(-1),0,0,b)}else if(pe==="bevel"||pe==="fakeround"){const le=-Math.sqrt(K*K-1),ne=re?le:0,xe=re?0:le;if(M&&this.addCurrentVertex(I,D,ne,xe,b),pe==="fakeround"){const Me=Math.round(180*Q/Math.PI/20);for(let Pe=1;Pe<Me;Pe++){let be=Pe/Me;if(be!==.5){const at=be-.5;be+=be*at*(be-1)*((1.0904+V*(V*(3.55645-1.43519*V)-3.2452))*at*at+(.848013+V*(.215638*V-1.06021)))}const Oe=F.sub(D)._mult(be)._add(D)._unit()._mult(re?-1:1);this.addHalfVertex(I,Oe.x,Oe.y,!1,re,0,b)}}A&&this.addCurrentVertex(I,F,-ne,-xe,b)}else if(pe==="butt")this.addCurrentVertex(I,B,0,0,b);else if(pe==="square"){const le=M?1:-1;this.addCurrentVertex(I,B,le,le,b)}else pe==="round"&&(M&&(this.addCurrentVertex(I,D,0,0,b),this.addCurrentVertex(I,D,1,1,b,!0)),A&&(this.addCurrentVertex(I,F,-1,-1,b,!0),this.addCurrentVertex(I,F,0,0,b)));if(ae&&R<v-1){const le=I.dist(A);if(le>2*T){const ne=I.add(A.sub(I)._mult(T/le)._round());this.updateDistance(I,ne),this.addCurrentVertex(ne,F,0,0,b),I=ne}}}}addCurrentVertex(e,i,s,o,l,u=!1){const p=i.y*o-i.x,g=-i.y-i.x*o;this.addHalfVertex(e,i.x+i.y*s,i.y-i.x*s,u,!1,s,l),this.addHalfVertex(e,p,g,u,!0,-o,l),this.distance>Pp/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,i,s,o,l,u))}addHalfVertex({x:e,y:i},s,o,l,u,p,g){const m=.5*(this.lineClips?this.scaledDistance*(Pp-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(l?1:0),(i<<1)+(u?1:0),Math.round(63*s)+128,Math.round(63*o)+128,1+(p===0?0:p<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 v=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,v,this.e2),g.primitiveLength++),u?this.e2=v:this.e1=v}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,o){for(const l of e){const u=l.paint.get("line-dasharray");if(!u||u.value.kind==="constant")continue;const p=l.layout.get("line-cap").evaluate(i,{})==="round",g={dasharray:u.value.evaluate({zoom:s-1},i,{}),round:p},m={dasharray:u.value.evaluate({zoom:s},i,{}),round:p},v={dasharray:u.value.evaluate({zoom:s+1},i,{}),round:p},_=`${g.dasharray.join(",")},${g.round}`,T=`${m.dasharray.join(",")},${m.round}`,b=`${v.dasharray.join(",")},${v.round}`;o.dashDependencies[_]=g,o.dashDependencies[T]=m,o.dashDependencies[b]=v,i.dashes[l.id]={min:_,mid:T,max:b}}}}let Ip,Mp;Ae("LineBucket",Xh,{omit:["layers","patternFeatures"]});var Ep={get paint(){return Mp=Mp||new mi({"line-opacity":new Fe(ce.paint_line["line-opacity"]),"line-color":new Fe(ce.paint_line["line-color"]),"line-translate":new De(ce.paint_line["line-translate"]),"line-translate-anchor":new De(ce.paint_line["line-translate-anchor"]),"line-width":new Fe(ce.paint_line["line-width"]),"line-gap-width":new Fe(ce.paint_line["line-gap-width"]),"line-offset":new Fe(ce.paint_line["line-offset"]),"line-blur":new Fe(ce.paint_line["line-blur"]),"line-dasharray":new Qs(ce.paint_line["line-dasharray"]),"line-pattern":new Qs(ce.paint_line["line-pattern"]),"line-gradient":new eo(ce.paint_line["line-gradient"])})},get layout(){return Ip=Ip||new mi({"line-cap":new Fe(ce.layout_line["line-cap"]),"line-join":new Fe(ce.layout_line["line-join"]),"line-miter-limit":new Fe(ce.layout_line["line-miter-limit"]),"line-round-limit":new Fe(ce.layout_line["line-round-limit"]),"line-sort-key":new Fe(ce.layout_line["line-sort-key"])})}};class Lg extends Fe{possiblyEvaluate(e,i){return i=new ft(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,zoomHistory:i.zoomHistory,transition:i.transition}),super.possiblyEvaluate(e,i)}evaluate(e,i,s,o){return i=di({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,s,o)}}let Du;class Fg extends Ri{constructor(e,i){super(e,Ep,i),this.gradientVersion=0,Du||(Du=new Lg(Ep.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 Ue,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 Xh(e)}queryRadius(e){const i=e,s=Cp(Ia("line-width",this,i),Ia("line-gap-width",this,i)),o=Ia("line-offset",this,i);return s/2+Math.abs(o)+xu(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:o,transform:l,pixelsToTileUnits:u}){const p=bu(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-l.bearingInRadians,u),g=u/2*Cp(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&&(o=(function(v,_){const T=[];for(const b of v){const I=Pm(b),M=[];for(let A=0;A<I.length;A++){const D=I[A],F=I[A-1],R=I[A+1],B=A===0?new fe(0,0):D.sub(F)._unit()._perp(),V=A===I.length-1?new fe(0,0):R.sub(D)._unit()._perp(),N=B._add(V)._unit(),K=N.x*V.x+N.y*V.y;K!==0&&N._mult(1/K),M.push(N._mult(_)._add(D))}T.push(M)}return T})(o,m*u)),(function(v,_,T){for(const b of _){if(v.length>=3){for(const I of b)if(Pa(v,I))return!0}if(yu(v,b,T))return!0}return!1})(p,o,g)}isTileClipped(){return!0}}function Cp(r,e){return e>0?e+2*r:r}const Bg=At([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Og=At([{name:"a_projected_pos",components:3,type:"Float32"}],4);At([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Vg=At([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);At([{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 Ap=At([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),jg=At([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Ng(r,e,i){const s=e.layout.get("text-transform").evaluate(i,{});return s==="uppercase"?r=r.toLocaleUpperCase():s==="lowercase"&&(r=r.toLocaleLowerCase()),dr.applyArabicShaping&&(r=dr.applyArabicShaping(r)),r}function Ug(r,e,i){for(const s of r.sections)s.text=Ng(s.text,e,i);return r}At([{name:"triangle",components:3,type:"Uint16"}]),At([{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"}]),At([{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"}]),At([{type:"Float32",name:"offsetX"}]),At([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),At([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var ei=24;const gc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},Gg={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},$g={40:!0};function Dp(r,e,i,s,o,l){if("fontStack"in e){const u=i[e.fontStack],p=u?.[r];return p?p.metrics.advance*e.scale+o:0}{const u=s[e.imageName];return u?u.displaySize[0]*e.scale*ei/l+o:0}}function zp(r,e,i,s){const o=Math.pow(r-e,2);return s?r<e?o/2:2*o:o+Math.abs(i)*i}function Zg(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 kp(r,e,i,s,o,l){let u=null,p=zp(e,i,o,l);for(const g of s){const m=zp(e-g.x,i,o,l)+g.badness;m<=p&&(u=g,p=m)}return{index:r,x:e,priorBreak:u,badness:p}}function Rp(r){return r?Rp(r.priorBreak).concat(r.index):[]}class ka{constructor(e="",i=[],s=[]){this.text=e,this.sections=i,this.sectionIndex=s,this.imageSectionID=null}static fromFeature(e,i){const s=new ka;for(const o of e.sections)o.image?s.addImageSection(o):s.addTextSection(o,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 o=e[Symbol.iterator]();let l=o.next();const u=e[Symbol.iterator]();u.next();let p=u.next();for(;!l.done;)i+=!p.done&&uu(p.value.codePointAt(0))&&!gc[p.value]||!s.premature&&uu(s.value.codePointAt(0))&&!gc[s.value]||!gc[l.value]?l.value:gc[l.value],s={value:l.value,premature:!1},l=o.next(),p=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*$/),o=s?s[0].length-1:0;this.text=this.text.substring(i,this.text.length-o),this.sectionIndex=this.sectionIndex.slice(i,this.sectionIndex.length-o)}substring(e,i){const s=[...this.text].slice(e,i).join(""),o=this.sectionIndex.slice(e,i);return new ka(s,this.sections,o)}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 o=0;o<this.length();o++){const l=this.getSection(o);if("imageName"in l){const u=e[l.imageName];if(!u)continue;const p=u.displaySize;i=Math.max(i,p[0]),s=Math.max(s,p[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 pi("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)):pi("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,o,l){const u=[],p=this.determineAverageLineWidth(e,i,s,o,l),g=this.hasZeroWidthSpaces();let m=0,v=0;const _=this.text[Symbol.iterator]();let T=_.next();const b=this.text[Symbol.iterator]();b.next();let I=b.next();const M=this.text[Symbol.iterator]();M.next(),M.next();let A=M.next();for(;!T.done;){const D=this.getSection(v),F=T.value.codePointAt(0);if(lu(F)||(m+=Dp(F,D,s,o,e,l)),!I.done){const R=fh(F),B=I.value.codePointAt(0);(Gg[F]||R||"imageName"in D||!A.done&&$g[B])&&u.push(kp(v+1,m,p,u,Zg(F,B,R&&g),!1))}v++,T=_.next(),I=b.next(),A=M.next()}return Rp(kp(this.length(),m,p,u,0,!0))}determineAverageLineWidth(e,i,s,o,l){let u=0,p=0;for(const g of this.text){const m=this.getSection(p);u+=Dp(g.codePointAt(0),m,s,o,e,l),p++}return u/Math.max(1,Math.ceil(u/i))}}const Yh=4294967296,Lp=1/Yh,Fp=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class zu{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 o=this.readVarint(),l=o>>3,u=this.pos;this.type=7&o,e(l,i,this),this.pos===u&&this.skip(o)}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)*Yh;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Yh;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,o;return o=i[this.pos++],s=127&o,o<128?s:(o=i[this.pos++],s|=(127&o)<<7,o<128?s:(o=i[this.pos++],s|=(127&o)<<14,o<128?s:(o=i[this.pos++],s|=(127&o)<<21,o<128?s:(o=i[this.pos],s|=(15&o)<<28,(function(l,u,p){const g=p.buf;let m,v;if(v=g[p.pos++],m=(112&v)>>4,v<128||(v=g[p.pos++],m|=(127&v)<<3,v<128)||(v=g[p.pos++],m|=(127&v)<<10,v<128)||(v=g[p.pos++],m|=(127&v)<<17,v<128)||(v=g[p.pos++],m|=(127&v)<<24,v<128)||(v=g[p.pos++],m|=(1&v)<<31,v<128))return Ra(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&&Fp?Fp.decode(this.buf.subarray(i,e)):(function(s,o,l){let u="",p=o;for(;p<l;){const g=s[p];let m,v,_,T=null,b=g>239?4:g>223?3:g>191?2:1;if(p+b>l)break;b===1?g<128&&(T=g):b===2?(m=s[p+1],(192&m)==128&&(T=(31&g)<<6|63&m,T<=127&&(T=null))):b===3?(m=s[p+1],v=s[p+2],(192&m)==128&&(192&v)==128&&(T=(15&g)<<12|(63&m)<<6|63&v,(T<=2047||T>=55296&&T<=57343)&&(T=null))):b===4&&(m=s[p+1],v=s[p+2],_=s[p+3],(192&m)==128&&(192&v)==128&&(192&_)==128&&(T=(15&g)<<18|(63&m)<<12|(63&v)<<6|63&_,(T<=65535||T>=1114112)&&(T=null))),T===null?(T=65533,b=1):T>65535&&(T-=65536,u+=String.fromCharCode(T>>>10&1023|55296),T=56320|1023&T),u+=String.fromCharCode(T),p+=b}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*Lp),!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*Lp),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?(function(i,s){let o,l;if(i>=0?(o=i%4294967296|0,l=i/4294967296|0):(o=~(-i%4294967296),l=~(-i/4294967296),4294967295^o?o=o+1|0:(o=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,p,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)})(o,0,s),(function(u,p){const g=(7&u)<<4;p.buf[p.pos++]|=g|((u>>>=3)?128:0),u&&(p.buf[p.pos++]=127&u|((u>>>=7)?128:0),u&&(p.buf[p.pos++]=127&u|((u>>>=7)?128:0),u&&(p.buf[p.pos++]=127&u|((u>>>=7)?128:0),u&&(p.buf[p.pos++]=127&u|((u>>>=7)?128:0),u&&(p.buf[p.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(o,l,u){for(let p,g,m=0;m<l.length;m++){if(p=l.charCodeAt(m),p>55295&&p<57344){if(!g){p>56319||m+1===l.length?(o[u++]=239,o[u++]=191,o[u++]=189):g=p;continue}if(p<56320){o[u++]=239,o[u++]=191,o[u++]=189,g=p;continue}p=g-55296<<10|p-56320|65536,g=null}else g&&(o[u++]=239,o[u++]=191,o[u++]=189,g=null);p<128?o[u++]=p:(p<2048?o[u++]=p>>6|192:(p<65536?o[u++]=p>>12|224:(o[u++]=p>>18|240,o[u++]=p>>12&63|128),o[u++]=p>>6&63|128),o[u++]=63&p|128)}return u})(this.buf,e,this.pos);const s=this.pos-i;s>=128&&Bp(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 o=this.pos-s;o>=128&&Bp(s,o,this),this.pos=s-1,this.writeVarint(o),this.pos+=o}writeMessage(e,i,s){this.writeTag(e,2),this.writeRawMessage(i,s)}writePackedVarint(e,i){i.length&&this.writeMessage(e,qg,i)}writePackedSVarint(e,i){i.length&&this.writeMessage(e,Wg,i)}writePackedBoolean(e,i){i.length&&this.writeMessage(e,Yg,i)}writePackedFloat(e,i){i.length&&this.writeMessage(e,Hg,i)}writePackedDouble(e,i){i.length&&this.writeMessage(e,Xg,i)}writePackedFixed32(e,i){i.length&&this.writeMessage(e,Kg,i)}writePackedSFixed32(e,i){i.length&&this.writeMessage(e,Jg,i)}writePackedFixed64(e,i){i.length&&this.writeMessage(e,Qg,i)}writePackedSFixed64(e,i){i.length&&this.writeMessage(e,e_,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 Ra(r,e,i){return i?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function Bp(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 o=i.pos-1;o>=r;o--)i.buf[o+s]=i.buf[o]}function qg(r,e){for(let i=0;i<r.length;i++)e.writeVarint(r[i])}function Wg(r,e){for(let i=0;i<r.length;i++)e.writeSVarint(r[i])}function Hg(r,e){for(let i=0;i<r.length;i++)e.writeFloat(r[i])}function Xg(r,e){for(let i=0;i<r.length;i++)e.writeDouble(r[i])}function Yg(r,e){for(let i=0;i<r.length;i++)e.writeBoolean(r[i])}function Kg(r,e){for(let i=0;i<r.length;i++)e.writeFixed32(r[i])}function Jg(r,e){for(let i=0;i<r.length;i++)e.writeSFixed32(r[i])}function Qg(r,e){for(let i=0;i<r.length;i++)e.writeFixed64(r[i])}function e_(r,e){for(let i=0;i<r.length;i++)e.writeSFixed64(r[i])}function t_(r,e,i){r===1&&i.readMessage(i_,e)}function i_(r,e,i){if(r===3){const{id:s,bitmap:o,width:l,height:u,left:p,top:g,advance:m}=i.readMessage(r_,{});e.push({id:s,bitmap:new nc({width:l+6,height:u+6},o),metrics:{width:l,height:u,left:p,top:g,advance:m}})}}function r_(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 Op(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,p)=>p.h-u.h));const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let o=0,l=0;for(const u of r)for(let p=s.length-1;p>=0;p--){const g=s[p];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),o=Math.max(o,u.x+u.w),u.w===g.w&&u.h===g.h){const m=s.pop();m&&p<s.length&&(s[p]=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:o,h:l,fill:e/(o*l)||0}}class Kh{constructor(e,{pixelRatio:i,version:s,stretchX:o,stretchY:l,content:u,textFitWidth:p,textFitHeight:g}){this.paddedRect=e,this.pixelRatio=i,this.stretchX=o,this.stretchY=l,this.content=u,this.version=s,this.textFitWidth=p,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 Vp{constructor(e,i){const s={},o={};this.haveRenderCallbacks=[];const l=[];this.addImages(e,s,l),this.addImages(i,o,l);const{w:u,h:p}=Op(l),g=new Wi({width:u||1,height:p||1});for(const m in e){const v=e[m],_=s[m].paddedRect;Wi.copy(v.data,g,{x:0,y:0},{x:_.x+1,y:_.y+1},v.data)}for(const m in i){const v=i[m],_=o[m].paddedRect,T=_.x+1,b=_.y+1,I=v.data.width,M=v.data.height;Wi.copy(v.data,g,{x:0,y:0},{x:T,y:b},v.data),Wi.copy(v.data,g,{x:0,y:M-1},{x:T,y:b-1},{width:I,height:1}),Wi.copy(v.data,g,{x:0,y:0},{x:T,y:b+M},{width:I,height:1}),Wi.copy(v.data,g,{x:I-1,y:0},{x:T-1,y:b},{width:1,height:M}),Wi.copy(v.data,g,{x:0,y:0},{x:T+I,y:b},{width:1,height:M})}this.image=g,this.iconPositions=s,this.patternPositions=o}addImages(e,i,s){for(const o in e){const l=e[o],u={x:0,y:0,w:l.data.width+2,h:l.data.height+2};s.push(u),i[o]=new Kh(u,l),l.hasRenderCallback&&this.haveRenderCallbacks.push(o)}}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[o,l]=e.tl;s.update(i.data,void 0,{x:o,y:l})}}var cs;function ku(r,e,i,s,o,l,u,p,g,m,v,_,T,b,I){const M=ka.fromFeature(r,o);let A;_===k.ax.vertical&&M.verticalizePunctuation();let D=M.determineLineBreaks(m,l,e,s,b);const{processBidirectionalText:F,processStyledBidirectionalText:R}=dr;if(F&&M.sections.length===1){A=[],D=D.map((K=>M.toCodeUnitIndex(K)));const N=F(M.toString(),D);for(const K of N){const Q=[...K].map((()=>0));A.push(new ka(K,M.sections,Q))}}else if(R){A=[],D=D.map((ae=>M.toCodeUnitIndex(ae)));let N=0;const K=[];for(const ae of M.text)K.push(...Array(ae.length).fill(M.sectionIndex[N])),N++;const Q=R(M.text,K,D);for(const ae of Q){const re=[];let de="";for(const pe of ae[0])re.push(ae[1][de.length]),de+=pe;A.push(new ka(ae[0],M.sections,re))}}else A=(function(N,K){const Q=[];let ae=0;for(const re of K)Q.push(N.substring(ae,re)),ae=re;return ae<N.length()&&Q.push(N.substring(ae,N.length())),Q})(M,D);const B=[],V={positionedLines:B,text:M.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:_,iconsInText:!1,verticalizable:!1};return(function(N,K,Q,ae,re,de,pe,le,ne,xe,Me,Pe){let be=0,Oe=0,at=0,ht=0;const pt=le==="right"?1:le==="left"?0:.5,vi=ei/Pe;let zt=0;for(const Pt of re){Pt.trim();const hi=Pt.getMaxScale(),Ai={positionedGlyphs:[],lineOffset:0};N.positionedLines[zt]=Ai;const Di=Ai.positionedGlyphs;let Hi=0;if(!Pt.length()){Oe+=de,++zt;continue}const xi=n_(ae,Pt,vi);let Xi=0;for(const ri of Pt.text){const Et=Pt.getSection(Xi),Gt=ri.codePointAt(0),kt=s_(ne,Me,Gt),ni={glyph:Gt,imageName:null,x:be,y:Oe+-17,vertical:kt,scale:1,fontStack:"",sectionIndex:Pt.getSectionIndex(Xi),metrics:null,rect:null};let In;if("fontStack"in Et){if(In=o_(Et,Gt,kt,xi,K,Q),!In)continue;ni.fontStack=Et.fontStack}else{if(N.iconsInText=!0,Et.scale*=vi,In=a_(Et,kt,hi,xi,ae),!In)continue;Hi=Math.max(Hi,In.imageOffset),ni.imageName=Et.imageName}const{rect:Fr,metrics:bc,baselineOffset:gs}=In;ni.y+=gs,ni.scale=Et.scale,ni.metrics=bc,ni.rect=Fr,Di.push(ni),kt?(N.verticalizable=!0,be+=("imageName"in Et?bc.advance:ei)*Et.scale+xe):be+=bc.advance*Et.scale+xe,Xi++}Di.length!==0&&(at=Math.max(be-xe,at),l_(Di,0,Di.length-1,pt)),be=0,Ai.lineOffset=Math.max(Hi,(hi-1)*ei);const br=de*hi+Hi;Oe+=br,ht=Math.max(br,ht),++zt}const{horizontalAlign:Xt,verticalAlign:ii}=Jh(pe);(function(Pt,hi,Ai,Di,Hi,xi,Xi,br,ri){const Et=(hi-Ai)*Hi;let Gt=0;Gt=xi!==Xi?-br*Di- -17:-Di*ri*Xi+.5*Xi;for(const kt of Pt)for(const ni of kt.positionedGlyphs)ni.x+=Et,ni.y+=Gt})(N.positionedLines,pt,Xt,ii,at,ht,de,Oe,re.length),N.top+=-ii*Oe,N.bottom=N.top+Oe,N.left+=-Xt*at,N.right=N.left+at})(V,e,i,s,A,u,p,g,_,m,T,I),!(function(N){for(const K of N)if(K.positionedGlyphs.length!==0)return!1;return!0})(B)&&V}function Jh(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 n_(r,e,i){const s=e.getMaxScale()*ei,{maxImageWidth:o,maxImageHeight:l}=e.getMaxImageSize(r),u=Math.max(s,l*i);return{verticalLineContentWidth:Math.max(s,o*i),horizontalLineContentHeight:u}}function jp(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function s_(r,e,i){return!(r===k.ax.horizontal||!e&&!Ws(i)||e&&(lu(i)||(s=i,/\p{sc=Arab}/u.test(String.fromCodePoint(s)))));var s}function o_(r,e,i,s,o,l){const u=l[r.fontStack],p=(function(m,v,_,T){if(m?.rect)return m;const b=v[_.fontStack],I=b?.[T];return I?{rect:null,metrics:I.metrics}:null})(u?.[e],o,r,e);if(p===null)return null;let g;if(i)g=s.verticalLineContentWidth-r.scale*ei;else{const m=jp(r.verticalAlign);g=(s.horizontalLineContentHeight-r.scale*ei)*m}return{rect:p.rect,metrics:p.metrics,baselineOffset:g}}function a_(r,e,i,s,o){const l=o[r.imageName];if(!l)return null;const u=l.paddedRect,p=l.displaySize,g={width:p[0],height:p[1],left:1,top:-3,advance:e?p[1]:p[0]};let m;if(e)m=s.verticalLineContentWidth-p[1]*r.scale;else{const v=jp(r.verticalAlign);m=(s.horizontalLineContentHeight-p[1]*r.scale)*v}return{rect:u,metrics:g,baselineOffset:m,imageOffset:(e?p[0]:p[1])*r.scale-ei*i}}function l_(r,e,i,s){if(s===0)return;const o=r[i],l=(r[i].x+o.metrics.advance*o.scale)*s;for(let u=e;u<=i;u++)r[u].x-=l}function c_(r,e,i){const{horizontalAlign:s,verticalAlign:o}=Jh(i),l=e[0]-r.displaySize[0]*s,u=e[1]-r.displaySize[1]*o;return{image:r,top:u,bottom:u+r.displaySize[1],left:l,right:l+r.displaySize[0]}}function Np(r){var e,i;let s=r.left,o=r.top,l=r.right-s,u=r.bottom-o;const p=(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(p==="stretchOnly"&&l/u<m||p==="proportional"){const v=Math.ceil(u*m);s*=v/l,l=v}}else if(p==="proportional"&&g==="stretchOnly"&&m!==0&&l/u>m){const v=Math.ceil(l/m);o*=v/u,u=v}return{x1:s,y1:o,x2:s+l,y2:o+u}}function Up(r,e,i,s,o,l){const u=r.image;let p;if(u.content){const A=u.content,D=u.pixelRatio||1;p=[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 v,_,T,b;i==="width"||i==="both"?(b=o[0]+g-s[3],_=o[0]+m+s[1]):(b=o[0]+(g+m-u.displaySize[0])/2,_=b+u.displaySize[0]);const I=e.top*l,M=e.bottom*l;return i==="height"||i==="both"?(v=o[1]+I-s[0],T=o[1]+M+s[2]):(v=o[1]+(I+M-u.displaySize[1])/2,T=v+u.displaySize[1]),{image:u,top:v,right:_,bottom:T,left:b,collisionPadding:p}}Ae("ImagePosition",Kh),Ae("ImageAtlas",Vp),k.ax=void 0,(cs=k.ax||(k.ax={}))[cs.none=0]="none",cs[cs.horizontal=1]="horizontal",cs[cs.vertical=2]="vertical",cs[cs.horizontalOnly=3]="horizontalOnly";const Sn=128,us=32640;function Gp(r,e){const{expression:i}=e;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new ft(r+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:o}=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 p=s[l],g=s[u];return i.kind==="composite"?{kind:"composite",minZoom:p,maxZoom:g,interpolationType:o}:{kind:"camera",minZoom:p,maxZoom:g,minSize:i.evaluate(new ft(p)),maxSize:i.evaluate(new ft(g)),interpolationType:o}}}function Qh(r,e,i){let s="never";const o=r.get(e);return o?s=o:r.get(i)&&(s="always"),s}const u_=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ru(r,e,i,s,o,l,u,p,g,m,v,_,T){const b=p?Math.min(us,Math.round(p[0])):0,I=p?Math.min(us,Math.round(p[1])):0;r.emplaceBack(e,i,Math.round(32*s),Math.round(32*o),l,u,(b<<1)+(g?1:0),I,16*m,16*v,256*_,256*T)}function ed(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 h_(r){for(const e of r.sections)if(Nl(e.text))return!0;return!1}class td{constructor(e){this.layoutVertexArray=new U,this.indexArray=new X,this.programConfigurations=e,this.segments=new oe,this.dynamicLayoutVertexArray=new q,this.opacityVertexArray=new Y,this.hasVisibleVertices=!1,this.placedSymbolArray=new d}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,i,s,o){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Bg.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Og.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,u_,!0),this.opacityVertexBuffer.itemSize=1),(s||o)&&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())}}Ae("SymbolBuffers",td);class id{constructor(e,i,s){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new s,this.segments=new oe,this.collisionVertexArray=new G}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Vg.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Ae("CollisionBuffers",id);class La{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=Gp(this.zoom,i["text-size"]),this.iconSizeData=Gp(this.zoom,i["icon-size"]);const s=this.layers[0].layout,o=s.get("symbol-sort-key"),l=s.get("symbol-z-order");this.canOverlap=Qh(s,"text-overlap","text-allow-overlap")!=="never"||Qh(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=l!=="viewport-y"&&!o.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=>k.ax[u]))),this.stateDependentLayerIds=this.layers.filter((u=>u.isStateDependent())).map((u=>u.id)),this.sourceID=e.sourceID}createArrays(){this.text=new td(new Ot(this.layers,this.zoom,(e=>e.startsWith("text")))),this.icon=new td(new Ot(this.layers,this.zoom,(e=>e.startsWith("icon")))),this.glyphOffsetArray=new a,this.lineVertexArray=new c,this.symbolInstances=new n,this.textAnchorOffsets=new y}calculateGlyphDependencies(e,i,s,o,l){for(const u of e)if(i[u.codePointAt(0)]=!0,(s||o)&&l){const p=gc[u];p&&(i[p.codePointAt(0)]=!0)}}populate(e,i,s){var o;const l=this.layers[0],u=l.layout,p=u.get("text-font"),g=u.get("text-field"),m=u.get("icon-image"),v=(g.value.kind!=="constant"||g.value.value instanceof Ni&&!g.value.value.isEmpty()||g.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),_=m.value.kind!=="constant"||!!m.value.value||Object.keys(m.parameters).length>0,T=u.get("symbol-sort-key");if(this.features=[],!v&&!_)return;const b=i.iconDependencies,I=i.glyphDependencies,M=i.availableImages,A=new ft(this.zoom);for(const{feature:D,id:F,index:R,sourceLayerIndex:B}of e){const V=l._featureFilter.needGeometry,N=kr(D,V);if(!l._featureFilter.filter(A,N,s))continue;let K,Q;if(V||(N.geometry=zr(D)),v){const re=l.getValueAndResolveTokens("text-field",N,s,M),de=Ni.factory(re);this.hasRTLText||(this.hasRTLText=h_(de)),(!this.hasRTLText||dr.getRTLTextPluginStatus()==="unavailable"||this.hasRTLText&&dr.isParsed())&&(K=Ug(de,l,N))}if(_){const re=l.getValueAndResolveTokens("icon-image",N,s,M);Q=re instanceof Ui?re:Ui.fromString(re)}if(!K&&!Q)continue;const ae=this.sortFeaturesByKey?T.evaluate(N,{},s):void 0;if(this.features.push({id:F,text:K,icon:Q,index:R,sourceLayerIndex:B,geometry:N.geometry,properties:D.properties,type:hc.types[D.type],sortKey:ae}),Q&&(b[Q.name]=!0),K){const re=p.evaluate(N,{},s).join(","),de=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=(o=this.writingModes)===null||o===void 0?void 0:o.includes(k.ax.vertical);for(const pe of K.sections)if(pe.image)b[pe.image.name]=!0;else{const le=gn(K.toString()),ne=pe.fontStack||re;I[ne]||(I[ne]={}),this.calculateGlyphDependencies(pe.text,I[ne],de,this.allowVerticalPlacement,le)}}}u.get("symbol-placement")==="line"&&(this.features=(function(D){const F={},R={},B=[];let V=0;function N(re){B.push(D[re]),V++}function K(re,de,pe){const le=R[re];return delete R[re],R[de]=le,B[le].geometry[0].pop(),B[le].geometry[0]=B[le].geometry[0].concat(pe[0]),le}function Q(re,de,pe){const le=F[de];return delete F[de],F[re]=le,B[le].geometry[0].shift(),B[le].geometry[0]=pe[0].concat(B[le].geometry[0]),le}function ae(re,de,pe){const le=pe?de[0][de[0].length-1]:de[0][0];return`${re}:${le.x}:${le.y}`}for(let re=0;re<D.length;re++){const de=D[re],pe=de.geometry,le=de.text?de.text.toString():null;if(!le){N(re);continue}const ne=ae(le,pe),xe=ae(le,pe,!0);if(ne in R&&xe in F&&R[ne]!==F[xe]){const Me=Q(ne,xe,pe),Pe=K(ne,xe,B[Me].geometry);delete F[ne],delete R[xe],R[ae(le,B[Pe].geometry,!0)]=Pe,B[Me].geometry=null}else ne in R?K(ne,xe,pe):xe in F?Q(ne,xe,pe):(N(re),F[ne]=V-1,R[xe]=V-1)}return B.filter((re=>re.geometry))})(this.features)),this.sortFeaturesByKey&&this.features.sort(((D,F)=>D.sortKey-F.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 o=e.dist(i[e.segment+1]),l=e.dist(i[e.segment]);const u={};for(let p=e.segment+1;p<i.length;p++)u[p]={x:i[p].x,y:i[p].y,tileUnitDistanceFromAnchor:o},p<i.length-1&&(o+=i[p+1].dist(i[p]));for(let p=e.segment||0;p>=0;p--)u[p]={x:i[p].x,y:i[p].y,tileUnitDistanceFromAnchor:l},p>0&&(l+=i[p-1].dist(i[p]));for(let p=0;p<i.length;p++){const g=u[p];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,i,s,o,l,u,p,g,m,v,_,T){const b=e.indexArray,I=e.layoutVertexArray,M=e.segments.prepareSegment(4*i.length,I,b,this.canOverlap?u.sortKey:void 0),A=this.glyphOffsetArray.length,D=M.vertexLength,F=this.allowVerticalPlacement&&p===k.ax.vertical?Math.PI/2:0,R=u.text&&u.text.sections;for(let B=0;B<i.length;B++){const{tl:V,tr:N,bl:K,br:Q,tex:ae,pixelOffsetTL:re,pixelOffsetBR:de,minFontScaleX:pe,minFontScaleY:le,glyphOffset:ne,isSDF:xe,sectionIndex:Me}=i[B],Pe=M.vertexLength,be=ne[1];Ru(I,g.x,g.y,V.x,be+V.y,ae.x,ae.y,s,xe,re.x,re.y,pe,le),Ru(I,g.x,g.y,N.x,be+N.y,ae.x+ae.w,ae.y,s,xe,de.x,re.y,pe,le),Ru(I,g.x,g.y,K.x,be+K.y,ae.x,ae.y+ae.h,s,xe,re.x,de.y,pe,le),Ru(I,g.x,g.y,Q.x,be+Q.y,ae.x+ae.w,ae.y+ae.h,s,xe,de.x,de.y,pe,le),ed(e.dynamicLayoutVertexArray,g,F),b.emplaceBack(Pe,Pe+2,Pe+1),b.emplaceBack(Pe+1,Pe+2,Pe+3),M.vertexLength+=4,M.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(ne[0]),B!==i.length-1&&Me===i[B+1].sectionIndex||e.programConfigurations.populatePaintArrays(I.length,u,u.index,{imagePositions:{},canonical:T,formattedSection:R?.[Me]})}e.placedSymbolArray.emplaceBack(g.x,g.y,A,this.glyphOffsetArray.length-A,D,m,v,g.segment,s?s[0]:0,s?s[1]:0,o[0],o[1],p,0,!1,0,_)}_addCollisionDebugVertex(e,i,s,o,l,u){return i.emplaceBack(0,0),e.emplaceBack(s.x,s.y,o,l,Math.round(u.x),Math.round(u.y))}addCollisionDebugVertices(e,i,s,o,l,u,p){const g=l.segments.prepareSegment(4,l.layoutVertexArray,l.indexArray),m=g.vertexLength,v=l.layoutVertexArray,_=l.collisionVertexArray,T=p.anchorX,b=p.anchorY;this._addCollisionDebugVertex(v,_,u,T,b,new fe(e,i)),this._addCollisionDebugVertex(v,_,u,T,b,new fe(s,i)),this._addCollisionDebugVertex(v,_,u,T,b,new fe(s,o)),this._addCollisionDebugVertex(v,_,u,T,b,new fe(e,o)),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,o){for(let l=e;l<i;l++){const u=this.collisionBoxArray.get(l);this.addCollisionDebugVertices(u.x1,u.y1,u.x2,u.y2,o?this.textCollisionBox:this.iconCollisionBox,u.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new id(Z,Ap.members,W),this.iconCollisionBox=new id(Z,Ap.members,W);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,o,l,u,p,g,m){const v={};for(let _=i;_<s;_++){const T=e.get(_);v.textBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},v.textFeatureIndex=T.featureIndex;break}for(let _=o;_<l;_++){const T=e.get(_);v.verticalTextBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},v.verticalTextFeatureIndex=T.featureIndex;break}for(let _=u;_<p;_++){const T=e.get(_);v.iconBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},v.iconFeatureIndex=T.featureIndex;break}for(let _=g;_<m;_++){const T=e.get(_);v.verticalIconBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},v.verticalIconFeatureIndex=T.featureIndex;break}return v}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),o=s.vertexStartIndex+4*s.numGlyphs;for(let l=s.vertexStartIndex;l<o;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),o=[],l=[],u=[];for(let p=0;p<this.symbolInstances.length;++p){u.push(p);const g=this.symbolInstances.get(p);o.push(0|Math.round(i*g.anchorX+s*g.anchorY)),l.push(g.featureIndex)}return u.sort(((p,g)=>o[p]-o[g]||l[g]-l[p])),u}addToSortKeyRanges(e,i){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];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);const o=[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex];for(let l=0;l<o.length;l++){const u=o[l];u>=0&&o.indexOf(u)===l&&this.addIndicesForPlacedSymbol(this.text,u)}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 $p,Zp;Ae("SymbolBucket",La,{omit:["layers","collisionBoxArray","features","compareText"]}),La.MAX_GLYPHS=65535,La.addDynamicAttributes=ed;var rd={get paint(){return Zp=Zp||new mi({"icon-opacity":new Fe(ce.paint_symbol["icon-opacity"]),"icon-color":new Fe(ce.paint_symbol["icon-color"]),"icon-halo-color":new Fe(ce.paint_symbol["icon-halo-color"]),"icon-halo-width":new Fe(ce.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Fe(ce.paint_symbol["icon-halo-blur"]),"icon-translate":new De(ce.paint_symbol["icon-translate"]),"icon-translate-anchor":new De(ce.paint_symbol["icon-translate-anchor"]),"text-opacity":new Fe(ce.paint_symbol["text-opacity"]),"text-color":new Fe(ce.paint_symbol["text-color"],{runtimeType:Jt,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new Fe(ce.paint_symbol["text-halo-color"]),"text-halo-width":new Fe(ce.paint_symbol["text-halo-width"]),"text-halo-blur":new Fe(ce.paint_symbol["text-halo-blur"]),"text-translate":new De(ce.paint_symbol["text-translate"]),"text-translate-anchor":new De(ce.paint_symbol["text-translate-anchor"])})},get layout(){return $p=$p||new mi({"symbol-placement":new De(ce.layout_symbol["symbol-placement"]),"symbol-spacing":new De(ce.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new De(ce.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Fe(ce.layout_symbol["symbol-sort-key"]),"symbol-z-order":new De(ce.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new De(ce.layout_symbol["icon-allow-overlap"]),"icon-overlap":new De(ce.layout_symbol["icon-overlap"]),"icon-ignore-placement":new De(ce.layout_symbol["icon-ignore-placement"]),"icon-optional":new De(ce.layout_symbol["icon-optional"]),"icon-rotation-alignment":new De(ce.layout_symbol["icon-rotation-alignment"]),"icon-size":new Fe(ce.layout_symbol["icon-size"]),"icon-text-fit":new De(ce.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new De(ce.layout_symbol["icon-text-fit-padding"]),"icon-image":new Fe(ce.layout_symbol["icon-image"]),"icon-rotate":new Fe(ce.layout_symbol["icon-rotate"]),"icon-padding":new Fe(ce.layout_symbol["icon-padding"]),"icon-keep-upright":new De(ce.layout_symbol["icon-keep-upright"]),"icon-offset":new Fe(ce.layout_symbol["icon-offset"]),"icon-anchor":new Fe(ce.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new De(ce.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new De(ce.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new De(ce.layout_symbol["text-rotation-alignment"]),"text-field":new Fe(ce.layout_symbol["text-field"]),"text-font":new Fe(ce.layout_symbol["text-font"]),"text-size":new Fe(ce.layout_symbol["text-size"]),"text-max-width":new Fe(ce.layout_symbol["text-max-width"]),"text-line-height":new De(ce.layout_symbol["text-line-height"]),"text-letter-spacing":new Fe(ce.layout_symbol["text-letter-spacing"]),"text-justify":new Fe(ce.layout_symbol["text-justify"]),"text-radial-offset":new Fe(ce.layout_symbol["text-radial-offset"]),"text-variable-anchor":new De(ce.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Fe(ce.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Fe(ce.layout_symbol["text-anchor"]),"text-max-angle":new De(ce.layout_symbol["text-max-angle"]),"text-writing-mode":new De(ce.layout_symbol["text-writing-mode"]),"text-rotate":new Fe(ce.layout_symbol["text-rotate"]),"text-padding":new De(ce.layout_symbol["text-padding"]),"text-keep-upright":new De(ce.layout_symbol["text-keep-upright"]),"text-transform":new Fe(ce.layout_symbol["text-transform"]),"text-offset":new Fe(ce.layout_symbol["text-offset"]),"text-allow-overlap":new De(ce.layout_symbol["text-allow-overlap"]),"text-overlap":new De(ce.layout_symbol["text-overlap"]),"text-ignore-placement":new De(ce.layout_symbol["text-ignore-placement"]),"text-optional":new De(ce.layout_symbol["text-optional"])})}};class qp{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:Ln,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(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}}Ae("FormatSectionOverride",qp,{omit:["defaultValue"]});class Lu extends Ri{constructor(e,i){super(e,rd,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 o=[];for(const l of s)o.includes(l)||o.push(l);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,i,s,o){const l=this.layout.get(e).evaluate(i,{},s,o),u=this._unevaluatedLayout._values[e];return u.isDataDriven()||ea(u.value)||!l?l:(function(p,g){return g.replace(/{([^{}]+)}/g,((m,v)=>p&&v in p?String(p[v]):""))})(i.properties,l)}createBucket(e){return new La(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of rd.paint.overridableProperties){if(!Lu.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),s=new qp(i),o=new Dl(s,i.property.specification);let l=null;l=i.value.kind==="constant"||i.value.kind==="source"?new ta("source",o):new zl("composite",o,i.value.zoomStops),this.paint._values[e]=new pr(i.property,l,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,s){return!(!this.layout||i.isDataDriven()||s.isDataDriven())&&Lu.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const s=e.get("text-field"),o=rd.paint.properties[i];let l=!1;const u=p=>{var g;for(const m of p)if(!((g=o.overrides)===null||g===void 0)&&g.hasOverride(m))return void(l=!0)};if(s.value.kind==="constant"&&s.value.value instanceof Ni)u(s.value.value.sections);else if(s.value.kind==="source"||s.value.kind==="composite"){const p=m=>{l||(m instanceof $r&&gt(m.value)===Ps?u(m.value.sections):m instanceof Uo?u(m.sections):m.eachChild(p))},g=s.value;g._styleExpression&&p(g._styleExpression.expression)}return l}}let Wp;var d_={get paint(){return Wp=Wp||new mi({"background-color":new De(ce.paint_background["background-color"]),"background-pattern":new pu(ce.paint_background["background-pattern"]),"background-opacity":new De(ce.paint_background["background-opacity"])})}};class p_ extends Ri{constructor(e,i){super(e,d_,i)}}class f_ extends Ri{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 m_{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 g_={once:!0},nd=63710088e-1;class hs{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 hs(An(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,o=e.lat*i,l=Math.sin(s)*Math.sin(o)+Math.cos(s)*Math.cos(o)*Math.cos((e.lng-this.lng)*i);return nd*Math.acos(Math.min(l,1))}static convert(e){if(e instanceof hs)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new hs(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new hs(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 Hp=2*Math.PI*nd;function Xp(r){return Hp*Math.cos(r*Math.PI/180)}function Yp(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 Jp(r,e){return r/Xp(e)}function Qp(r){return 360*r-180}function Fu(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function ef(r,e){return r*Xp(Fu(e))}class _c{constructor(e,i,s=0){this.x=+e,this.y=+i,this.z=+s}static fromLngLat(e,i=0){const s=hs.convert(e);return new _c(Yp(s.lng),Kp(s.lat),Jp(i,s.lat))}toLngLat(){return new hs(Qp(this.x),Fu(this.y))}toAltitude(){return ef(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Hp*(e=Fu(this.y),1/Math.cos(e*Math.PI/180));var e}}function tf(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 sd{constructor(e,i,s){if(!(function(o,l,u){return!(o<0||o>25||u<0||u>=Math.pow(2,o)||l<0||l>=Math.pow(2,o))})(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=Fa(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 o=(u=this.y,p=this.z,g=tf(256*(l=this.x),256*(u=Math.pow(2,p)-u-1),p),m=tf(256*(l+1),256*(u+1),p),g[0]+","+g[1]+","+m[0]+","+m[1]);var l,u,p,g,m;const v=(function(_,T,b){let I="";for(let M=_;M>0;M--){const A=1<<M-1;I+=(T&A?1:0)+(b&A?2:0)}return I})(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,v).replace(/{bbox-epsg-3857}/g,o)}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 fe((e.x*i-this.x)*Be,(e.y*i-this.y)*Be)}toString(){return`${this.z}/${this.x}/${this.y}`}}class rf{constructor(e,i){this.wrap=e,this.canonical=i,this.key=Fa(e,i.z,i.z,i.x,i.y)}}class nr{constructor(e,i,s,o,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 sd(s,+o,+l),this.key=Fa(i,e,s,o,l)}clone(){return new nr(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 nr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new nr(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?Fa(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y):Fa(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 nr(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,o=2*this.canonical.y;return[new nr(i,this.wrap,i,s,o),new nr(i,this.wrap,i,s+1,o),new nr(i,this.wrap,i,s,o+1),new nr(i,this.wrap,i,s+1,o+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 nr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new nr(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 rf(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new _c(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 o=Math.floor(e/s),l=Math.floor(i/s),u=e-o*s,p=i-l*s,g=this.canonical.z,m=1<<g,v=this.canonical.y+l;if(v<0||v>=m)return null;let _=this.canonical.x+o,T=this.wrap;return _<0?(T-=Math.ceil(-_/m),_=(_%m+m)%m):_>=m&&(T+=Math.floor(_/m),_%=m),{tileID:new nr(this.overscaledZ,T,g,_,v),x:u,y:p}}}function Fa(r,e,i,s,o){(r*=2)<0&&(r=-1*r-1);const l=1<<i;return(l*l*r+l*o+s).toString(36)+i.toString(36)+e.toString(36)}Ae("CanonicalTileID",sd),Ae("OverscaledTileID",nr,{omit:["terrainRttPosMatrix32f"]});class ho{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 ho;return i.extend(e(new fe(this.minX,this.minY))),i.extend(e(new fe(this.maxX,this.minY))),i.extend(e(new fe(this.minX,this.maxY))),i.extend(e(new fe(this.maxX,this.maxY))),i}static fromPoints(e){const i=new ho;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 nf{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 sf{constructor(e,i,s,o,l){this.type="Feature",this._vectorTileFeature=e,this._x=s,this._y=o,this._z=i,this.properties=e.properties,this.id=l}projectPoint(e,i,s,o){return[360*(e.x+i)/o-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+s)/o)*Math.PI))-90]}projectLine(e,i,s,o){return e.map((l=>this.projectPoint(l,i,s,o)))}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,o=e.extent*this._y,l=e.loadGeometry();switch(e.type){case 1:{const u=[];for(const g of l)u.push(g[0]);const p=this.projectLine(u,s,o,i);this._geometry=u.length===1?{type:"Point",coordinates:p[0]}:{type:"MultiPoint",coordinates:p};break}case 2:{const u=l.map((p=>this.projectLine(p,s,o,i)));this._geometry=u.length===1?{type:"LineString",coordinates:u[0]}:{type:"MultiLineString",coordinates:u};break}case 3:{const u=ap(l),p=[];for(const g of u)p.push(g.map((m=>this.projectLine(m,s,o,i))));this._geometry=p.length===1?{type:"Polygon",coordinates:p[0]}:{type:"MultiPolygon",coordinates:p};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 Ba{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 Bu extends Ba{}class od extends Bu{getValueFromBuffer(e){return this.dataBuffer[e]}}class ad extends Bu{getValueFromBuffer(e){return this.dataBuffer[e]}}class of extends Ba{constructor(e,i,s,o){super(e,i,o),this.delta=s}}class ld extends of{constructor(e,i,s,o){super(e,Int32Array.of(i),s,o)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class cd extends Ba{constructor(e,i,s,o){super(e,o?Int32Array.of(i):Uint32Array.of(i),s)}getValueFromBuffer(e){return this.dataBuffer[0]}}class __{constructor(e,i,s,o,l=4096){this._name=e,this._geometryVector=i,this._idVector=s,this._propertyVectors=o,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 o;if(this.idVector){const p=this.idVector.getValue(s);o=this.containsMaxSafeIntegerValues(this.idVector)&&p!==null?Number(p):p}const l={coordinates:i[s],type:this.geometryVector.geometryType(s)},u={};for(const p of this.propertyVectors){if(!p)continue;const g=p.name,m=p.getValue(s);m!==null&&(u[g]=m)}e.push({id:o,geometry:l,properties:u})}return e}containsMaxSafeIntegerValues(e){return e instanceof od||e instanceof cd||e instanceof ld||e instanceof ad}}class af{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var Qe,ds;(function(r){r.NONE="NONE",r.DELTA="DELTA",r.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",r.RLE="RLE",r.MORTON="MORTON",r.PDE="PDE"})(Qe||(Qe={})),(function(r){r.NONE="NONE",r.FAST_PFOR="FAST_PFOR",r.VARINT="VARINT",r.ALP="ALP"})(ds||(ds={}));const ud=new Uint32Array(33);ud[0]=0;for(let r=1;r<=32;r++)ud[r]=r===32?4294967295:4294967295>>>32-r;const hd=ud,Pn=256;function dd(r,e){return r-r%e}function y_(r){const e=r>>>0;return((255&e)<<24|(65280&e)<<8|e>>>8&65280|e>>>24&255)>>>0}const pd=(function(){if(!Number.isFinite(65536))return 65536;const r=dd(Math.floor(65536),Pn);return r===0?Pn:r})(),v_=3*pd/Pn+pd|0;function lf(){const r=new Uint8Array(v_);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 x_(r,e,i,s,o){switch(o){case 1:(function(l,u,p,g){let m=g,v=u;for(let _=0;_<8;_++){const T=l[v++]>>>0;p[m++]=T>>>0&1,p[m++]=T>>>1&1,p[m++]=T>>>2&1,p[m++]=T>>>3&1,p[m++]=T>>>4&1,p[m++]=T>>>5&1,p[m++]=T>>>6&1,p[m++]=T>>>7&1,p[m++]=T>>>8&1,p[m++]=T>>>9&1,p[m++]=T>>>10&1,p[m++]=T>>>11&1,p[m++]=T>>>12&1,p[m++]=T>>>13&1,p[m++]=T>>>14&1,p[m++]=T>>>15&1,p[m++]=T>>>16&1,p[m++]=T>>>17&1,p[m++]=T>>>18&1,p[m++]=T>>>19&1,p[m++]=T>>>20&1,p[m++]=T>>>21&1,p[m++]=T>>>22&1,p[m++]=T>>>23&1,p[m++]=T>>>24&1,p[m++]=T>>>25&1,p[m++]=T>>>26&1,p[m++]=T>>>27&1,p[m++]=T>>>28&1,p[m++]=T>>>29&1,p[m++]=T>>>30&1,p[m++]=T>>>31&1}})(r,e,i,s);break;case 2:(function(l,u,p,g){let m=g,v=u;for(let _=0;_<8;_++){const T=l[v++]>>>0,b=l[v++]>>>0;p[m++]=T>>>0&3,p[m++]=T>>>2&3,p[m++]=T>>>4&3,p[m++]=T>>>6&3,p[m++]=T>>>8&3,p[m++]=T>>>10&3,p[m++]=T>>>12&3,p[m++]=T>>>14&3,p[m++]=T>>>16&3,p[m++]=T>>>18&3,p[m++]=T>>>20&3,p[m++]=T>>>22&3,p[m++]=T>>>24&3,p[m++]=T>>>26&3,p[m++]=T>>>28&3,p[m++]=T>>>30&3,p[m++]=b>>>0&3,p[m++]=b>>>2&3,p[m++]=b>>>4&3,p[m++]=b>>>6&3,p[m++]=b>>>8&3,p[m++]=b>>>10&3,p[m++]=b>>>12&3,p[m++]=b>>>14&3,p[m++]=b>>>16&3,p[m++]=b>>>18&3,p[m++]=b>>>20&3,p[m++]=b>>>22&3,p[m++]=b>>>24&3,p[m++]=b>>>26&3,p[m++]=b>>>28&3,p[m++]=b>>>30&3}})(r,e,i,s);break;case 3:(function(l,u,p,g){let m=g,v=u;for(let _=0;_<8;_++){const T=l[v++]>>>0,b=l[v++]>>>0,I=l[v++]>>>0;p[m++]=T>>>0&7,p[m++]=T>>>3&7,p[m++]=T>>>6&7,p[m++]=T>>>9&7,p[m++]=T>>>12&7,p[m++]=T>>>15&7,p[m++]=T>>>18&7,p[m++]=T>>>21&7,p[m++]=T>>>24&7,p[m++]=T>>>27&7,p[m++]=7&(T>>>30|(1&b)<<2),p[m++]=b>>>1&7,p[m++]=b>>>4&7,p[m++]=b>>>7&7,p[m++]=b>>>10&7,p[m++]=b>>>13&7,p[m++]=b>>>16&7,p[m++]=b>>>19&7,p[m++]=b>>>22&7,p[m++]=b>>>25&7,p[m++]=b>>>28&7,p[m++]=7&(b>>>31|(3&I)<<1),p[m++]=I>>>2&7,p[m++]=I>>>5&7,p[m++]=I>>>8&7,p[m++]=I>>>11&7,p[m++]=I>>>14&7,p[m++]=I>>>17&7,p[m++]=I>>>20&7,p[m++]=I>>>23&7,p[m++]=I>>>26&7,p[m++]=I>>>29&7}})(r,e,i,s);break;case 4:(function(l,u,p,g){let m=g,v=u;for(let _=0;_<8;_++){const T=l[v++]>>>0,b=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0;p[m++]=T>>>0&15,p[m++]=T>>>4&15,p[m++]=T>>>8&15,p[m++]=T>>>12&15,p[m++]=T>>>16&15,p[m++]=T>>>20&15,p[m++]=T>>>24&15,p[m++]=T>>>28&15,p[m++]=b>>>0&15,p[m++]=b>>>4&15,p[m++]=b>>>8&15,p[m++]=b>>>12&15,p[m++]=b>>>16&15,p[m++]=b>>>20&15,p[m++]=b>>>24&15,p[m++]=b>>>28&15,p[m++]=I>>>0&15,p[m++]=I>>>4&15,p[m++]=I>>>8&15,p[m++]=I>>>12&15,p[m++]=I>>>16&15,p[m++]=I>>>20&15,p[m++]=I>>>24&15,p[m++]=I>>>28&15,p[m++]=M>>>0&15,p[m++]=M>>>4&15,p[m++]=M>>>8&15,p[m++]=M>>>12&15,p[m++]=M>>>16&15,p[m++]=M>>>20&15,p[m++]=M>>>24&15,p[m++]=M>>>28&15}})(r,e,i,s);break;case 5:(function(l,u,p,g){let m=g,v=u;for(let _=0;_<8;_++){const T=l[v++]>>>0,b=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0,A=l[v++]>>>0;p[m++]=T>>>0&31,p[m++]=T>>>5&31,p[m++]=T>>>10&31,p[m++]=T>>>15&31,p[m++]=T>>>20&31,p[m++]=T>>>25&31,p[m++]=31&(T>>>30|(7&b)<<2),p[m++]=b>>>3&31,p[m++]=b>>>8&31,p[m++]=b>>>13&31,p[m++]=b>>>18&31,p[m++]=b>>>23&31,p[m++]=31&(b>>>28|(1&I)<<4),p[m++]=I>>>1&31,p[m++]=I>>>6&31,p[m++]=I>>>11&31,p[m++]=I>>>16&31,p[m++]=I>>>21&31,p[m++]=I>>>26&31,p[m++]=31&(I>>>31|(15&M)<<1),p[m++]=M>>>4&31,p[m++]=M>>>9&31,p[m++]=M>>>14&31,p[m++]=M>>>19&31,p[m++]=M>>>24&31,p[m++]=31&(M>>>29|(3&A)<<3),p[m++]=A>>>2&31,p[m++]=A>>>7&31,p[m++]=A>>>12&31,p[m++]=A>>>17&31,p[m++]=A>>>22&31,p[m++]=A>>>27&31}})(r,e,i,s);break;case 6:(function(l,u,p,g){let m=g,v=u;for(let _=0;_<8;_++){const T=l[v++]>>>0,b=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0,A=l[v++]>>>0,D=l[v++]>>>0;p[m++]=T>>>0&63,p[m++]=T>>>6&63,p[m++]=T>>>12&63,p[m++]=T>>>18&63,p[m++]=T>>>24&63,p[m++]=63&(T>>>30|(15&b)<<2),p[m++]=b>>>4&63,p[m++]=b>>>10&63,p[m++]=b>>>16&63,p[m++]=b>>>22&63,p[m++]=63&(b>>>28|(3&I)<<4),p[m++]=I>>>2&63,p[m++]=I>>>8&63,p[m++]=I>>>14&63,p[m++]=I>>>20&63,p[m++]=I>>>26&63,p[m++]=M>>>0&63,p[m++]=M>>>6&63,p[m++]=M>>>12&63,p[m++]=M>>>18&63,p[m++]=M>>>24&63,p[m++]=63&(M>>>30|(15&A)<<2),p[m++]=A>>>4&63,p[m++]=A>>>10&63,p[m++]=A>>>16&63,p[m++]=A>>>22&63,p[m++]=63&(A>>>28|(3&D)<<4),p[m++]=D>>>2&63,p[m++]=D>>>8&63,p[m++]=D>>>14&63,p[m++]=D>>>20&63,p[m++]=D>>>26&63}})(r,e,i,s);break;case 7:(function(l,u,p,g){let m=g,v=u;for(let _=0;_<8;_++){const T=l[v++]>>>0,b=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0,A=l[v++]>>>0,D=l[v++]>>>0,F=l[v++]>>>0;p[m++]=T>>>0&127,p[m++]=T>>>7&127,p[m++]=T>>>14&127,p[m++]=T>>>21&127,p[m++]=127&(T>>>28|(7&b)<<4),p[m++]=b>>>3&127,p[m++]=b>>>10&127,p[m++]=b>>>17&127,p[m++]=b>>>24&127,p[m++]=127&(b>>>31|(63&I)<<1),p[m++]=I>>>6&127,p[m++]=I>>>13&127,p[m++]=I>>>20&127,p[m++]=127&(I>>>27|(3&M)<<5),p[m++]=M>>>2&127,p[m++]=M>>>9&127,p[m++]=M>>>16&127,p[m++]=M>>>23&127,p[m++]=127&(M>>>30|(31&A)<<2),p[m++]=A>>>5&127,p[m++]=A>>>12&127,p[m++]=A>>>19&127,p[m++]=127&(A>>>26|(1&D)<<6),p[m++]=D>>>1&127,p[m++]=D>>>8&127,p[m++]=D>>>15&127,p[m++]=D>>>22&127,p[m++]=127&(D>>>29|(15&F)<<3),p[m++]=F>>>4&127,p[m++]=F>>>11&127,p[m++]=F>>>18&127,p[m++]=F>>>25&127}})(r,e,i,s);break;case 8:(function(l,u,p,g){let m=g,v=u;for(let _=0;_<8;_++){const T=l[v++]>>>0,b=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0,A=l[v++]>>>0,D=l[v++]>>>0,F=l[v++]>>>0,R=l[v++]>>>0;p[m++]=T>>>0&255,p[m++]=T>>>8&255,p[m++]=T>>>16&255,p[m++]=T>>>24&255,p[m++]=b>>>0&255,p[m++]=b>>>8&255,p[m++]=b>>>16&255,p[m++]=b>>>24&255,p[m++]=I>>>0&255,p[m++]=I>>>8&255,p[m++]=I>>>16&255,p[m++]=I>>>24&255,p[m++]=M>>>0&255,p[m++]=M>>>8&255,p[m++]=M>>>16&255,p[m++]=M>>>24&255,p[m++]=A>>>0&255,p[m++]=A>>>8&255,p[m++]=A>>>16&255,p[m++]=A>>>24&255,p[m++]=D>>>0&255,p[m++]=D>>>8&255,p[m++]=D>>>16&255,p[m++]=D>>>24&255,p[m++]=F>>>0&255,p[m++]=F>>>8&255,p[m++]=F>>>16&255,p[m++]=F>>>24&255,p[m++]=R>>>0&255,p[m++]=R>>>8&255,p[m++]=R>>>16&255,p[m++]=R>>>24&255}})(r,e,i,s);break;case 16:(function(l,u,p,g){let m=g,v=u;for(let _=0;_<128;_++){const T=l[v++]>>>0;p[m++]=65535&T,p[m++]=T>>>16&65535}})(r,e,i,s);break;default:(function(l,u,p,g,m){const v=hd[m]>>>0;let _=u,T=0,b=l[_]>>>0,I=g;for(let M=0;M<8;M++){for(let A=0;A<32;A++)if(T+m<=32)p[I+A]=b>>>T&v,T+=m,T===32&&(T=0,_++,A!==31&&(b=l[_]>>>0));else{const D=32-T,F=b>>>T;_++,b=l[_]>>>0;const R=m-D;p[I+A]=(F|(b&-1>>>32-R>>>0)<<D)&v,T=R}I+=32,T=0,M<7&&(b=l[_]>>>0)}})(r,e,i,s,o)}return e+(o<<3)|0}function b_(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 o=r[i++],l=r[i++];if(o>32)throw new Error(`FastPFOR decode: invalid bitWidth=${o} at block=${s} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:o,exceptionCount:l,bytePosIn:i}}function w_(r,e,i,s,o,l,u,p,g){const{maxBits:m,exceptionBitWidth:v,bytePosIn:_}=(function(A,D,F,R,B,V){if(F+1>D)throw new Error(`FastPFOR decode: exception header underflow at block=${V} (need 1 byte for maxBits, bytePos=${F}, byteSize=${D})`);const N=A[F++];if(N<R||N>32)throw new Error(`FastPFOR decode: invalid maxBits=${N} at block=${V} (bitWidth=${R}, expected ${R}..32)`);const K=N-R|0;if(K<1||K>32)throw new Error(`FastPFOR decode: invalid exceptionBitWidth=${K} at block=${V} (bitWidth=${R}, maxBits=${N})`);if(F+B>D)throw new Error(`FastPFOR decode: exception positions underflow at block=${V} (need=${B}, have=${D-F})`);return{maxBits:N,exceptionBitWidth:K,bytePosIn:F}})(o,l,u,i,s,g);if(u=_,v===1){const A=1<<i;for(let D=0;D<s;D=D+1|0)r[o[u++]+e|0]|=A;return u}const T=p.dataToBePacked[v];if(!T)throw new Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${v} (bitWidth=${i}, maxBits=${m}) at block ${g}`);const b=p.dataPointers;let I=0|b[v];const M=0|p.exceptionSizes[v];if(I+s>M)throw new Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${v} (ptr=${I}, need ${s}, size=${M}) at block ${g}`);for(let A=0;A<s;A=A+1|0){const D=o[u++],F=0|T[I++];r[D+e|0]|=F<<i}return b[v]=I,u}function T_(r,e,i,s,o,l){const u=0|i,p=0|r[u];if(p<=0||u+p>r.length-1)throw new Error(`FastPFOR decode: invalid whereMeta=${p} at pageStart=${u} (expected > 0 and pageStart+whereMeta < encoded.length=${r.length})`);const g=u+1|0,m=u+p|0,v=r[m]>>>0,_=v+3>>>2,T=m+1,b=T+_;if(b>=r.length)throw new Error(`FastPFOR decode: invalid byteSize=${v} (metaInts=${_}, pageStart=${u}, packedEnd=${m}, byteContainerStart=${T}) causes bitmapPos=${b} out of bounds (encoded.length=${r.length})`);const I=(function(D,F,R,B){B.byteContainer.length<R&&(B.byteContainer=new Uint8Array(2*R),B.byteContainerI32=void 0);const V=B.byteContainer,N=R>>>2;if(3&V.byteOffset)for(let Q=0;Q<N;Q=Q+1|0){const ae=0|D[F+Q|0],re=Q<<2;V[re]=255&ae,V[re+1|0]=ae>>>8&255,V[re+2|0]=ae>>>16&255,V[re+3|0]=ae>>>24&255}else{let Q=B.byteContainerI32;(!Q||Q.buffer!==V.buffer||Q.byteOffset!==V.byteOffset||Q.length<N)&&(Q=B.byteContainerI32=new Int32Array(V.buffer,V.byteOffset,V.byteLength>>>2)),Q.set(D.subarray(F,F+N))}const K=3&R;if(K>0){const Q=0|D[F+N|0],ae=N<<2;for(let re=0;re<K;re=re+1|0)V[ae+re|0]=Q>>>(re<<3)&255}return V})(r,T,v,l),M=v,A=(function(D,F,R){const B=0|D[F++],V=R.dataToBePacked;for(let N=2;N<=32;N=N+1|0){if(!(B>>>N-1&1))continue;if(F>=D.length)throw new Error(`FastPFOR decode: truncated exception stream header (bitWidth=${N}, streamWordIndex=${F}, needWords=1, availableWords=${D.length-F}, encodedWords=${D.length})`);const K=D[F++]>>>0,Q=dd(K+31,32),ae=K*N+31>>>5;if(F+ae>D.length)throw new Error(`FastPFOR decode: truncated exception stream (bitWidth=${N}, size=${K}, streamWordIndex=${F}, needWords=${ae}, availableWords=${D.length-F}, encodedWords=${D.length})`);let re=V[N];(!re||re.length<Q)&&(re=V[N]=new Uint32Array(Q));let de=0;for(;de<K;de=de+32|0)S_(D,F,re,de,N),F=F+N|0;F=F-((de-K|0)*N>>>5)|0,R.exceptionSizes[N]=K}return F})(r,b,l);return l.dataPointers.fill(0),(function(D,F,R,B,V,N,K,Q,ae,re){let de=0|R,pe=0;for(let le=0;le<K;le=le+1|0){const ne=b_(Q,ae,pe,le);pe=ne.bytePosIn;const xe=ne.bitWidth,Me=ne.exceptionCount,Pe=N+le*Pn|0;switch(xe){case 0:V.fill(0,Pe,Pe+Pn);break;case 32:for(let be=0;be<Pn;be=be+1|0)V[Pe+be|0]=0|D[de+be|0];de=de+Pn|0;break;default:de=x_(D,de,V,Pe,xe)}Me>0&&(pe=w_(V,Pe,xe,Me,Q,ae,pe,re,le))}if(de!==B)throw new Error(`FastPFOR decode: packed region mismatch (pageStart=${F}, packedStart=${R}, consumedPackedEnd=${de}, expectedPackedEnd=${B}, packedWords=${B-R}, encoded.length=${D.length})`)})(r,u,g,m,e,0|s,o/Pn|0,I,M,l),A}function S_(r,e,i,s,o){switch(o){case 2:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0;_[b++]=I>>>0&3,_[b++]=I>>>2&3,_[b++]=I>>>4&3,_[b++]=I>>>6&3,_[b++]=I>>>8&3,_[b++]=I>>>10&3,_[b++]=I>>>12&3,_[b++]=I>>>14&3,_[b++]=I>>>16&3,_[b++]=I>>>18&3,_[b++]=I>>>20&3,_[b++]=I>>>22&3,_[b++]=I>>>24&3,_[b++]=I>>>26&3,_[b++]=I>>>28&3,_[b++]=I>>>30&3,_[b++]=M>>>0&3,_[b++]=M>>>2&3,_[b++]=M>>>4&3,_[b++]=M>>>6&3,_[b++]=M>>>8&3,_[b++]=M>>>10&3,_[b++]=M>>>12&3,_[b++]=M>>>14&3,_[b++]=M>>>16&3,_[b++]=M>>>18&3,_[b++]=M>>>20&3,_[b++]=M>>>22&3,_[b++]=M>>>24&3,_[b++]=M>>>26&3,_[b++]=M>>>28&3,_[b]=M>>>30&3})(r,e,i,s);case 3:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0;_[b++]=I>>>0&7,_[b++]=I>>>3&7,_[b++]=I>>>6&7,_[b++]=I>>>9&7,_[b++]=I>>>12&7,_[b++]=I>>>15&7,_[b++]=I>>>18&7,_[b++]=I>>>21&7,_[b++]=I>>>24&7,_[b++]=I>>>27&7,_[b++]=7&(I>>>30|(1&M)<<2),_[b++]=M>>>1&7,_[b++]=M>>>4&7,_[b++]=M>>>7&7,_[b++]=M>>>10&7,_[b++]=M>>>13&7,_[b++]=M>>>16&7,_[b++]=M>>>19&7,_[b++]=M>>>22&7,_[b++]=M>>>25&7,_[b++]=M>>>28&7,_[b++]=7&(M>>>31|(3&A)<<1),_[b++]=A>>>2&7,_[b++]=A>>>5&7,_[b++]=A>>>8&7,_[b++]=A>>>11&7,_[b++]=A>>>14&7,_[b++]=A>>>17&7,_[b++]=A>>>20&7,_[b++]=A>>>23&7,_[b++]=A>>>26&7,_[b]=A>>>29&7})(r,e,i,s);case 4:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0;_[b++]=I>>>0&15,_[b++]=I>>>4&15,_[b++]=I>>>8&15,_[b++]=I>>>12&15,_[b++]=I>>>16&15,_[b++]=I>>>20&15,_[b++]=I>>>24&15,_[b++]=I>>>28&15,_[b++]=M>>>0&15,_[b++]=M>>>4&15,_[b++]=M>>>8&15,_[b++]=M>>>12&15,_[b++]=M>>>16&15,_[b++]=M>>>20&15,_[b++]=M>>>24&15,_[b++]=M>>>28&15,_[b++]=A>>>0&15,_[b++]=A>>>4&15,_[b++]=A>>>8&15,_[b++]=A>>>12&15,_[b++]=A>>>16&15,_[b++]=A>>>20&15,_[b++]=A>>>24&15,_[b++]=A>>>28&15,_[b++]=D>>>0&15,_[b++]=D>>>4&15,_[b++]=D>>>8&15,_[b++]=D>>>12&15,_[b++]=D>>>16&15,_[b++]=D>>>20&15,_[b++]=D>>>24&15,_[b]=D>>>28&15})(r,e,i,s);case 5:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0,F=m[v+4]>>>0;_[b++]=I>>>0&31,_[b++]=I>>>5&31,_[b++]=I>>>10&31,_[b++]=I>>>15&31,_[b++]=I>>>20&31,_[b++]=I>>>25&31,_[b++]=31&(I>>>30|(7&M)<<2),_[b++]=M>>>3&31,_[b++]=M>>>8&31,_[b++]=M>>>13&31,_[b++]=M>>>18&31,_[b++]=M>>>23&31,_[b++]=31&(M>>>28|(1&A)<<4),_[b++]=A>>>1&31,_[b++]=A>>>6&31,_[b++]=A>>>11&31,_[b++]=A>>>16&31,_[b++]=A>>>21&31,_[b++]=A>>>26&31,_[b++]=31&(A>>>31|(15&D)<<1),_[b++]=D>>>4&31,_[b++]=D>>>9&31,_[b++]=D>>>14&31,_[b++]=D>>>19&31,_[b++]=D>>>24&31,_[b++]=31&(D>>>29|(3&F)<<3),_[b++]=F>>>2&31,_[b++]=F>>>7&31,_[b++]=F>>>12&31,_[b++]=F>>>17&31,_[b++]=F>>>22&31,_[b]=F>>>27&31})(r,e,i,s);case 6:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0,F=m[v+4]>>>0,R=m[v+5]>>>0;_[b++]=I>>>0&63,_[b++]=I>>>6&63,_[b++]=I>>>12&63,_[b++]=I>>>18&63,_[b++]=I>>>24&63,_[b++]=63&(I>>>30|(15&M)<<2),_[b++]=M>>>4&63,_[b++]=M>>>10&63,_[b++]=M>>>16&63,_[b++]=M>>>22&63,_[b++]=63&(M>>>28|(3&A)<<4),_[b++]=A>>>2&63,_[b++]=A>>>8&63,_[b++]=A>>>14&63,_[b++]=A>>>20&63,_[b++]=A>>>26&63,_[b++]=D>>>0&63,_[b++]=D>>>6&63,_[b++]=D>>>12&63,_[b++]=D>>>18&63,_[b++]=D>>>24&63,_[b++]=63&(D>>>30|(15&F)<<2),_[b++]=F>>>4&63,_[b++]=F>>>10&63,_[b++]=F>>>16&63,_[b++]=F>>>22&63,_[b++]=63&(F>>>28|(3&R)<<4),_[b++]=R>>>2&63,_[b++]=R>>>8&63,_[b++]=R>>>14&63,_[b++]=R>>>20&63,_[b]=R>>>26&63})(r,e,i,s);case 7:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0,F=m[v+4]>>>0,R=m[v+5]>>>0,B=m[v+6]>>>0;_[b++]=I>>>0&127,_[b++]=I>>>7&127,_[b++]=I>>>14&127,_[b++]=I>>>21&127,_[b++]=127&(I>>>28|(7&M)<<4),_[b++]=M>>>3&127,_[b++]=M>>>10&127,_[b++]=M>>>17&127,_[b++]=M>>>24&127,_[b++]=127&(M>>>31|(63&A)<<1),_[b++]=A>>>6&127,_[b++]=A>>>13&127,_[b++]=A>>>20&127,_[b++]=127&(A>>>27|(3&D)<<5),_[b++]=D>>>2&127,_[b++]=D>>>9&127,_[b++]=D>>>16&127,_[b++]=D>>>23&127,_[b++]=127&(D>>>30|(31&F)<<2),_[b++]=F>>>5&127,_[b++]=F>>>12&127,_[b++]=F>>>19&127,_[b++]=127&(F>>>26|(1&R)<<6),_[b++]=R>>>1&127,_[b++]=R>>>8&127,_[b++]=R>>>15&127,_[b++]=R>>>22&127,_[b++]=127&(R>>>29|(15&B)<<3),_[b++]=B>>>4&127,_[b++]=B>>>11&127,_[b++]=B>>>18&127,_[b]=B>>>25&127})(r,e,i,s);case 8:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0,F=m[v+4]>>>0,R=m[v+5]>>>0,B=m[v+6]>>>0,V=m[v+7]>>>0;_[b++]=I>>>0&255,_[b++]=I>>>8&255,_[b++]=I>>>16&255,_[b++]=I>>>24&255,_[b++]=M>>>0&255,_[b++]=M>>>8&255,_[b++]=M>>>16&255,_[b++]=M>>>24&255,_[b++]=A>>>0&255,_[b++]=A>>>8&255,_[b++]=A>>>16&255,_[b++]=A>>>24&255,_[b++]=D>>>0&255,_[b++]=D>>>8&255,_[b++]=D>>>16&255,_[b++]=D>>>24&255,_[b++]=F>>>0&255,_[b++]=F>>>8&255,_[b++]=F>>>16&255,_[b++]=F>>>24&255,_[b++]=R>>>0&255,_[b++]=R>>>8&255,_[b++]=R>>>16&255,_[b++]=R>>>24&255,_[b++]=B>>>0&255,_[b++]=B>>>8&255,_[b++]=B>>>16&255,_[b++]=B>>>24&255,_[b++]=V>>>0&255,_[b++]=V>>>8&255,_[b++]=V>>>16&255,_[b]=V>>>24&255})(r,e,i,s);case 9:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0,F=m[v+4]>>>0,R=m[v+5]>>>0,B=m[v+6]>>>0,V=m[v+7]>>>0,N=m[v+8]>>>0;_[b++]=I>>>0&511,_[b++]=I>>>9&511,_[b++]=I>>>18&511,_[b++]=511&(I>>>27|(15&M)<<5),_[b++]=M>>>4&511,_[b++]=M>>>13&511,_[b++]=M>>>22&511,_[b++]=511&(M>>>31|(255&A)<<1),_[b++]=A>>>8&511,_[b++]=A>>>17&511,_[b++]=511&(A>>>26|(7&D)<<6),_[b++]=D>>>3&511,_[b++]=D>>>12&511,_[b++]=D>>>21&511,_[b++]=511&(D>>>30|(127&F)<<2),_[b++]=F>>>7&511,_[b++]=F>>>16&511,_[b++]=511&(F>>>25|(3&R)<<7),_[b++]=R>>>2&511,_[b++]=R>>>11&511,_[b++]=R>>>20&511,_[b++]=511&(R>>>29|(63&B)<<3),_[b++]=B>>>6&511,_[b++]=B>>>15&511,_[b++]=511&(B>>>24|(1&V)<<8),_[b++]=V>>>1&511,_[b++]=V>>>10&511,_[b++]=V>>>19&511,_[b++]=511&(V>>>28|(31&N)<<4),_[b++]=N>>>5&511,_[b++]=N>>>14&511,_[b]=N>>>23&511})(r,e,i,s);case 10:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0,F=m[v+4]>>>0,R=m[v+5]>>>0,B=m[v+6]>>>0,V=m[v+7]>>>0,N=m[v+8]>>>0,K=m[v+9]>>>0;_[b++]=I>>>0&1023,_[b++]=I>>>10&1023,_[b++]=I>>>20&1023,_[b++]=1023&(I>>>30|(255&M)<<2),_[b++]=M>>>8&1023,_[b++]=M>>>18&1023,_[b++]=1023&(M>>>28|(63&A)<<4),_[b++]=A>>>6&1023,_[b++]=A>>>16&1023,_[b++]=1023&(A>>>26|(15&D)<<6),_[b++]=D>>>4&1023,_[b++]=D>>>14&1023,_[b++]=1023&(D>>>24|(3&F)<<8),_[b++]=F>>>2&1023,_[b++]=F>>>12&1023,_[b++]=F>>>22&1023,_[b++]=R>>>0&1023,_[b++]=R>>>10&1023,_[b++]=R>>>20&1023,_[b++]=1023&(R>>>30|(255&B)<<2),_[b++]=B>>>8&1023,_[b++]=B>>>18&1023,_[b++]=1023&(B>>>28|(63&V)<<4),_[b++]=V>>>6&1023,_[b++]=V>>>16&1023,_[b++]=1023&(V>>>26|(15&N)<<6),_[b++]=N>>>4&1023,_[b++]=N>>>14&1023,_[b++]=1023&(N>>>24|(3&K)<<8),_[b++]=K>>>2&1023,_[b++]=K>>>12&1023,_[b]=K>>>22&1023})(r,e,i,s);case 11:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0,F=m[v+4]>>>0,R=m[v+5]>>>0,B=m[v+6]>>>0,V=m[v+7]>>>0,N=m[v+8]>>>0,K=m[v+9]>>>0,Q=m[v+10]>>>0;_[b++]=I>>>0&2047,_[b++]=I>>>11&2047,_[b++]=2047&(I>>>22|(1&M)<<10),_[b++]=M>>>1&2047,_[b++]=M>>>12&2047,_[b++]=2047&(M>>>23|(3&A)<<9),_[b++]=A>>>2&2047,_[b++]=A>>>13&2047,_[b++]=2047&(A>>>24|(7&D)<<8),_[b++]=D>>>3&2047,_[b++]=D>>>14&2047,_[b++]=2047&(D>>>25|(15&F)<<7),_[b++]=F>>>4&2047,_[b++]=F>>>15&2047,_[b++]=2047&(F>>>26|(31&R)<<6),_[b++]=R>>>5&2047,_[b++]=R>>>16&2047,_[b++]=2047&(R>>>27|(63&B)<<5),_[b++]=B>>>6&2047,_[b++]=B>>>17&2047,_[b++]=2047&(B>>>28|(127&V)<<4),_[b++]=V>>>7&2047,_[b++]=V>>>18&2047,_[b++]=2047&(V>>>29|(255&N)<<3),_[b++]=N>>>8&2047,_[b++]=N>>>19&2047,_[b++]=2047&(N>>>30|(511&K)<<2),_[b++]=K>>>9&2047,_[b++]=K>>>20&2047,_[b++]=2047&(K>>>31|(1023&Q)<<1),_[b++]=Q>>>10&2047,_[b]=Q>>>21&2047})(r,e,i,s);case 12:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0,F=m[v+4]>>>0,R=m[v+5]>>>0,B=m[v+6]>>>0,V=m[v+7]>>>0,N=m[v+8]>>>0,K=m[v+9]>>>0,Q=m[v+10]>>>0,ae=m[v+11]>>>0;_[b++]=I>>>0&4095,_[b++]=I>>>12&4095,_[b++]=4095&(I>>>24|(15&M)<<8),_[b++]=M>>>4&4095,_[b++]=M>>>16&4095,_[b++]=4095&(M>>>28|(255&A)<<4),_[b++]=A>>>8&4095,_[b++]=A>>>20&4095,_[b++]=D>>>0&4095,_[b++]=D>>>12&4095,_[b++]=4095&(D>>>24|(15&F)<<8),_[b++]=F>>>4&4095,_[b++]=F>>>16&4095,_[b++]=4095&(F>>>28|(255&R)<<4),_[b++]=R>>>8&4095,_[b++]=R>>>20&4095,_[b++]=B>>>0&4095,_[b++]=B>>>12&4095,_[b++]=4095&(B>>>24|(15&V)<<8),_[b++]=V>>>4&4095,_[b++]=V>>>16&4095,_[b++]=4095&(V>>>28|(255&N)<<4),_[b++]=N>>>8&4095,_[b++]=N>>>20&4095,_[b++]=K>>>0&4095,_[b++]=K>>>12&4095,_[b++]=4095&(K>>>24|(15&Q)<<8),_[b++]=Q>>>4&4095,_[b++]=Q>>>16&4095,_[b++]=4095&(Q>>>28|(255&ae)<<4),_[b++]=ae>>>8&4095,_[b]=ae>>>20&4095})(r,e,i,s);case 16:return void(function(m,v,_,T){let b=T;const I=m[v]>>>0,M=m[v+1]>>>0,A=m[v+2]>>>0,D=m[v+3]>>>0,F=m[v+4]>>>0,R=m[v+5]>>>0,B=m[v+6]>>>0,V=m[v+7]>>>0,N=m[v+8]>>>0,K=m[v+9]>>>0,Q=m[v+10]>>>0,ae=m[v+11]>>>0,re=m[v+12]>>>0,de=m[v+13]>>>0,pe=m[v+14]>>>0,le=m[v+15]>>>0;_[b++]=I>>>0&65535,_[b++]=I>>>16&65535,_[b++]=M>>>0&65535,_[b++]=M>>>16&65535,_[b++]=A>>>0&65535,_[b++]=A>>>16&65535,_[b++]=D>>>0&65535,_[b++]=D>>>16&65535,_[b++]=F>>>0&65535,_[b++]=F>>>16&65535,_[b++]=R>>>0&65535,_[b++]=R>>>16&65535,_[b++]=B>>>0&65535,_[b++]=B>>>16&65535,_[b++]=V>>>0&65535,_[b++]=V>>>16&65535,_[b++]=N>>>0&65535,_[b++]=N>>>16&65535,_[b++]=K>>>0&65535,_[b++]=K>>>16&65535,_[b++]=Q>>>0&65535,_[b++]=Q>>>16&65535,_[b++]=ae>>>0&65535,_[b++]=ae>>>16&65535,_[b++]=re>>>0&65535,_[b++]=re>>>16&65535,_[b++]=de>>>0&65535,_[b++]=de>>>16&65535,_[b++]=pe>>>0&65535,_[b++]=pe>>>16&65535,_[b++]=le>>>0&65535,_[b]=le>>>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=hd[o]>>>0;let u=e,p=0,g=r[u]>>>0;for(let m=0;m<32;m++)if(p+o<=32)i[s+m]=g>>>p&l,p+=o,p===32&&(p=0,u++,m!==31&&(g=r[u]>>>0));else{const v=32-p,_=g>>>p;u++,g=r[u]>>>0,i[s+m]=(_|(g&hd[o-v]>>>0)<<v)&l,p=o-v}}function Ci(r,e,i){const s=new Uint32Array(i);let o=0,l=e.get();for(let u=0;u<s.length;u++){let p=r[l++],g=127&p;p<128||(p=r[l++],g|=(127&p)<<7,p<128||(p=r[l++],g|=(127&p)<<14,p<128||(p=r[l++],g|=(127&p)<<21,p<128||(p=r[l++],g|=(15&p)<<28)))),s[o++]=g}return e.set(l),s}function Oa(r,e,i){const s=new BigUint64Array(i);for(let o=0;o<s.length;o++)s[o]=P_(r,e);return s}function P_(r,e){let i=0n,s=0,o=e.get();for(;o<r.length;){const l=r[o++];if(i|=BigInt(127&l)<<BigInt(s),!(128&l))break;if(s+=7,s>=64)throw new Error("Varint too long")}return e.set(o),i}function I_(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(o,l,u){let p,g;if(g=l[u.get()],u.increment(),p=(112&g)>>4,g<128||(g=l[u.get()],u.increment(),p|=(127&g)<<3,g<128)||(g=l[u.get()],u.increment(),p|=(127&g)<<10,g<128)||(g=l[u.get()],u.increment(),p|=(127&g)<<17,g<128)||(g=l[u.get()],u.increment(),p|=(127&g)<<24,g<128)||(g=l[u.get()],u.increment(),p|=(1&g)<<31,g<128))return 4294967296*p+(o>>>0);throw new Error("Expected varint not more than 10 bytes")})(i,r,e)))))}function mt(r){return r>>>1^-(1&r)}function Bi(r){return r>>1n^-(1n&r)}function Va(r){return r%2==1?(r+1)/-2:r/2}function fd(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 o=0;for(let l=0;l<e;l++){const u=r[l];s.fill(r[l+e],o,o+u),o+=u}return s}function md(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 o=0;for(let l=0;l<e;l++){const u=Number(r[l]);s.fill(r[l+e],o,o+u),o+=u}return s}function cf(r,e,i){const s=new Float64Array(i);let o=0;for(let l=0;l<e;l++){const u=r[l];s.fill(r[l+e],o,o+u),o+=u}return s}function uf(r){const e=new Int32Array(r.length);e[0]=mt(r[0]);const i=r.length/4*4;let s=1;if(i>=4)for(;s<i-4;s+=4){const o=r[s+1],l=r[s+2],u=r[s+3];e[s]=mt(r[s])+e[s-1],e[s+1]=mt(o)+e[s],e[s+2]=mt(l)+e[s+1],e[s+3]=mt(u)+e[s+2]}for(;s!==r.length;++s)e[s]=mt(r[s])+e[s-1];return e}function hf(r){const e=new BigInt64Array(r.length);e[0]=Bi(r[0]);const i=r.length/4*4;let s=1;if(i>=4)for(;s<i-4;s+=4){const o=r[s+1],l=r[s+2],u=r[s+3];e[s]=Bi(r[s])+e[s-1],e[s+1]=Bi(o)+e[s],e[s+2]=Bi(l)+e[s+1],e[s+3]=Bi(u)+e[s+2]}for(;s!==e.length;++s)e[s]=Bi(r[s])+e[s-1];return e}function gd(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 _i,Rr,po,sr,St,ti,df,ps;function Oi(r,e){const i=(function(s,o){const l=s[o.get()],u=Object.values(_i)[l>>4];let p=null;switch(u){case _i.DATA:p={dictionaryType:Object.values(Rr)[15&l]};break;case _i.OFFSET:p={offsetType:Object.values(po)[15&l]};break;case _i.LENGTH:p={lengthType:Object.values(sr)[15&l]}}o.increment();const g=s[o.get()],m=Object.values(Qe)[g>>5],v=Object.values(Qe)[g>>2&7],_=Object.values(ds)[3&g];o.increment();const T=Ci(s,o,2),b=T[0];return{physicalStreamType:u,logicalStreamType:p,logicalLevelTechnique1:m,logicalLevelTechnique2:v,physicalLevelTechnique:_,numValues:b,byteLength:T[1],decompressedCount:b}})(r,e);return i.logicalLevelTechnique1===Qe.MORTON?(function(s,o,l){const u=Ci(o,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):Qe.RLE!==i.logicalLevelTechnique1&&Qe.RLE!==i.logicalLevelTechnique2||ds.NONE===i.physicalLevelTechnique?i:(function(s,o,l){const u=Ci(o,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"})(_i||(_i={})),(function(r){r.NONE="NONE",r.SINGLE="SINGLE",r.SHARED="SHARED",r.VERTEX="VERTEX",r.MORTON="MORTON",r.FSST="FSST"})(Rr||(Rr={})),(function(r){r.VERTEX="VERTEX",r.INDEX="INDEX",r.STRING="STRING",r.KEY="KEY"})(po||(po={})),(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"})(sr||(sr={})),(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"})(St||(St={}));class Lr{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 ja(r,e,i){if(!e)return r;const s=e.size(),o=new r.constructor(s);let l=0;for(let u=0;u<s;u++)o[u]=e.get(u)?r[l++]:i;return o}function _d(r,e,i,s,o){return(function(l,u,p,g){let m;switch(u.logicalLevelTechnique1){case Qe.DELTA:if(u.logicalLevelTechnique2===Qe.RLE){const v=u;if(!g)return(function(_,T,b){const I=new Int32Array(b);let M=0,A=0;for(let D=0;D<T;D++){const F=_[D],R=mt(_[D+T]);for(let B=0;B<F;B++)A+=R,I[M++]=A}return I})(l,v.runs,v.numRleValues);m=uf(l=fd(l,v.runs,v.numRleValues))}else m=uf(l);break;case Qe.RLE:m=(function(v,_,T){if(T===void 0){T=0;for(let M=0;M<_;M++)T+=v[M]}const b=new Int32Array(T);let I=0;for(let M=0;M<_;M++){const A=v[M];let D=v[M+_];D=mt(D),b.fill(D,I,I+A),I+=A}return b})(l,u.runs,u.numRleValues);break;case Qe.MORTON:gd(l),m=new Int32Array(l);break;case Qe.COMPONENTWISE_DELTA:m=(function(v){if(v.length<2)return new Int32Array(v);const _=new Int32Array(v.length);_[0]=mt(v[0]),_[1]=mt(v[1]);const T=v.length/4*4;let b=2;if(T>=4)for(;b<T-4;b+=4){const I=v[b+1],M=v[b+2],A=v[b+3];_[b]=mt(v[b])+_[b-2],_[b+1]=mt(I)+_[b-1],_[b+2]=mt(M)+_[b],_[b+3]=mt(A)+_[b+1]}for(;b!==v.length;b+=2)_[b]=mt(v[b])+_[b-2],_[b+1]=mt(v[b+1])+_[b-1];return _})(l);break;case Qe.NONE:m=(function(v){const _=new Int32Array(v.length);for(let T=0;T<v.length;T++)_[T]=mt(v[T]);return _})(l);break;default:throw new Error(`The specified Logical level technique is not supported: ${u.logicalLevelTechnique1}`)}return g?ja(m,g,0):m})(Na(r,e,i),i,0,o)}function or(r,e,i,s,o){return(function(l,u,p,g){let m;switch(u.logicalLevelTechnique1){case Qe.DELTA:m=(function(v){const _=new Uint32Array(v.length);_[0]=mt(v[0])>>>0;for(let T=1;T<v.length;T++)_[T]=_[T-1]+mt(v[T])>>>0;return _})(u.logicalLevelTechnique2===Qe.RLE?fd(l,u.runs,u.numRleValues):l);break;case Qe.RLE:m=fd(l,u.runs,u.numRleValues);break;case Qe.MORTON:gd(l),m=l;break;case Qe.COMPONENTWISE_DELTA:m=(function(v){if(v.length<2)return new Uint32Array(v);const _=new Uint32Array(v.length);_[0]=mt(v[0])>>>0,_[1]=mt(v[1])>>>0;for(let T=2;T<v.length;T+=2)_[T]=_[T-2]+mt(v[T])>>>0,_[T+1]=_[T-1]+mt(v[T+1])>>>0;return _})(l);break;case Qe.NONE:m=l;break;default:throw new Error(`The specified Logical level technique is not supported: ${u.logicalLevelTechnique1}`)}return g?ja(m,g,0):m})(Na(r,e,i),i,0,o)}function fs(r,e,i){return(function(s,o){if(o.logicalLevelTechnique1===Qe.DELTA&&o.logicalLevelTechnique2===Qe.NONE)return(function(l){const u=new Int32Array(l.length+1);u[0]=0,u[1]=mt(l[0]);let p=u[1];for(let g=2;g!==u.length;++g)p+=mt(l[g-1]),u[g]=u[g-1]+p;return new Uint32Array(u)})(s);if(o.logicalLevelTechnique1===Qe.RLE&&o.logicalLevelTechnique2===Qe.NONE)return(function(l,u,p){const g=new Uint32Array(p+1);g[0]=0;let m=1,v=g[0];for(let _=0;_<u;_++){const T=l[_],b=l[_+u];for(let I=m;I<m+T;I++)g[I]=b+v,v=g[I];m+=T}return g})(s,o.runs,o.numRleValues);if(o.logicalLevelTechnique1===Qe.NONE&&o.logicalLevelTechnique2===Qe.NONE){(function(u){let p=0;for(let g=0;g<u.length;g++)u[g]+=p,p=u[g]})(s);const l=new Uint32Array(o.numValues+1);return l[0]=0,l.set(s,1),l}if(o.logicalLevelTechnique1===Qe.DELTA&&o.logicalLevelTechnique2===Qe.RLE){const l=(function(u,p,g){const m=new Int32Array(g+1);m[0]=0;let v=1,_=m[0];for(let T=0;T<p;T++){const b=u[T];let I=u[T+p];I=mt(I);for(let M=v;M<v+b;M++)m[M]=I+_,_=m[M];v+=b}return m})(s,o.runs,o.numRleValues);return gd(l),new Uint32Array(l)}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")})(Na(r,e,i),i)}function Na(r,e,i){const s=i.physicalLevelTechnique;switch(s){case ds.FAST_PFOR:return(function(o,l,u,p){return(function(g,m,v,_,T){const b=_.get();if(3&v)throw new Error(`FastPFOR: invalid encodedByteLength=${v} at offset=${b} (encodedBytes.length=${g.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);const I=v>>>2,M=(function(D,F){if(F<=D.encodedWords.length)return D.encodedWords;const R=new Uint32Array(Math.max(16,2*F));return D.encodedWords=R,R})(T,I);(function(D,F,R,B){if(F<0||R<0||F+R>D.length)throw new RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${F}, byteLength=${R}, bytes.length=${D.length})`);const V=Math.floor(R/4),N=R%4!=0,K=N?V+1:V;if(B.length<K)throw new RangeError(`decodeBigEndianInt32sInto: out.length=${B.length} < ${K}`);if(V>0){const Q=D.byteOffset+F;if(3&Q)for(let ae=0;ae<V;ae++){const re=F+4*ae;B[ae]=D[re]<<24|D[re+1]<<16|D[re+2]<<8|D[re+3]}else{const ae=new Uint32Array(D.buffer,Q,V);for(let re=0;re<V;re++)B[re]=0|y_(ae[re])}}if(N){const Q=F+4*V,ae=R-4*V;let re=0;for(let de=0;de<ae;de++)re|=D[Q+de]<<24-8*de;B[V]=0|re}})(g,b,v,M);const A=(function(D,F,R){let B=0,V=0;const N=new Uint32Array(F),K=R??lf();if(D.length>0){const Q=0|D[B];if(B=B+1|0,255&Q)throw new Error(`FastPFOR decode: invalid alignedLength=${Q} (expected multiple of 256)`);if(V+Q>N.length)throw new Error(`FastPFOR decode: output buffer too small (outPos=${V}, alignedLength=${Q}, out.length=${N.length})`);B=(function(ae,re,de,pe,le,ne){const xe=pe+dd(le,Pn);let Me=pe,Pe=de;for(;Me!==xe;){const be=Math.min(pd,xe-Me);Pe=T_(ae,re,Pe,Me,be,ne),Me=Me+be|0}return Pe})(D,N,B,V,Q,K),V=V+Q|0}return(function(Q,ae,re,de,pe,le){if(le===0)return ae;let ne=0,xe=ae;const Me=ae+re,Pe=pe;let be=pe;const Oe=pe+le;let at=0,ht=0;for(;xe<Me&&be<Oe;){const pt=Q[xe]>>>ne&255;if(ne+=8,xe+=ne>>>5,ne&=31,at|=(127&pt)<<ht,128&pt)de[be++]=0|at,at=0,ht=0;else if(ht+=7,ht>28)throw new Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${ht}, partial=${at}, decoded=${be-Pe}/${le}, inPos=${xe}, inEnd=${Me})`)}if(be!==Oe)throw new Error(`FastPFOR VByte: truncated stream (decoded=${be-Pe}, expected=${le}, consumedWords=${xe-ae}/${re}, vbyteStart=${ae}, vbyteEnd=${Me})`)})(D,B,D.length-B|0,N,V,F-V|0),N})(M.subarray(0,I),m,T.decoderWorkspace);return _.add(v),A})(o,l,u,p,(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:lf()}})(u>>>2))})(r,i.numValues,i.byteLength,e);case ds.VARINT:return Ci(r,e,i.numValues);case ds.NONE:{const o=e.get();e.add(i.byteLength);const l=r.subarray(o,e.get());return new Uint32Array(l)}default:throw new Error(`Specified physicalLevelTechnique ${s} is not supported (yet).`)}}function yd(r,e,i){const s=Na(r,e,i);return s.length===1?s[0]:(function(o){return o[1]})(s)}function pf(r,e,i){return(function(s){if(s.length===2){const o=mt(s[1]);return[o,o]}return[mt(s[2]),mt(s[3])]})(Na(r,e,i))}function ff(r,e,i){return(function(s){if(s.length===2){const o=Bi(s[1]);return[o,o]}return[Bi(s[2]),Bi(s[3])]})(Oa(r,e,i.numValues))}function mf(r,e,i,s){return(function(o,l,u){let p;switch(l.logicalLevelTechnique1){case Qe.DELTA:p=(function(g){const m=new BigUint64Array(g.length);m[0]=BigInt.asUintN(64,Bi(g[0]));for(let v=1;v<g.length;v++)m[v]=BigInt.asUintN(64,m[v-1]+Bi(g[v]));return m})(l.logicalLevelTechnique2===Qe.RLE?md(o,l.runs,l.numRleValues):o);break;case Qe.RLE:p=md(o,l.runs,l.numRleValues);break;case Qe.NONE:p=o;break;default:throw new Error(`The specified Logical level technique is not supported: ${l.logicalLevelTechnique1}`)}return u?ja(p,u,0n):p})(Oa(r,e,i.numValues),i,s)}function gf(r,e,i){const s=Oa(r,e,i.numValues);return s.length===1?s[0]:(function(o){return o[1]})(s)}function Ou(r,e,i,s,o="int32"){const l=r.logicalLevelTechnique1;if(l===Qe.RLE)return r.runs===1?St.CONST:St.FLAT;if(l!==Qe.DELTA||r.logicalLevelTechnique2!==Qe.RLE)return r.numValues===1?St.CONST:St.FLAT;const u=e instanceof Lr?e.size():e;if(r.numRleValues!==u)return St.FLAT;if(r.runs===1)return St.SEQUENCE;if(r.runs!==2)return r.numValues===1?St.CONST:St.FLAT;const p=s.get();if(r.physicalLevelTechnique===ds.VARINT)return(function(v,_,T){const b=new af(_.get());if(T==="int64"){const M=Oa(v,b,4);return M[2]===2n&&M[3]===2n}const I=Ci(v,b,4);return I[2]===2&&I[3]===2})(i,s,o)?St.SEQUENCE:r.numValues===1?St.CONST:St.FLAT;const g=s.get(),m=new Int32Array(i.buffer,i.byteOffset+g,4);return s.set(p),m[2]===2&&m[3]===2?St.SEQUENCE:r.numValues===1?St.CONST:St.FLAT}class _f extends Bu{getValueFromBuffer(e){return this.dataBuffer[e]}}class yf extends of{constructor(e,i,s,o){super(e,BigInt64Array.of(i),s,o)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}function vd(r,e,i){return{x:vf(r,e)-i,y:vf(r>>1,e)-i}}function vf(r,e){let i=0;for(let s=0;s<e;s++)i|=(r&1<<2*s)>>s;return i}function Ua(r,e,i,s,o,l,u){return r===ps.MORTON?(function(p,g,m,v,_,T){const b=new Array(_?v+1:v);for(let I=0;I<v;I++){const M=vd(p[g[m+I]],T.numBits,T.coordinateShift);b[I]=new fe(M.x,M.y)}return _&&(b[b.length-1]=b[0]),b})(e,i,s,o,l,u):(function(p,g,m,v,_){const T=new Array(_?v+1:v);for(let b=0;b<2*v;b+=2){const I=2*g[m+b/2];T[b/2]=new fe(p[I],p[I+1])}return _&&(T[T.length-1]=T[0]),T})(e,i,s,o,l)}function Ga(r,e,i,s){const o=new Array(s?i+1:i);for(let l=0;l<2*i;l+=2)o[l/2]=new fe(r[e+l],r[e+l+1]);return s&&(o[o.length-1]=o[0]),o}(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"})(ti||(ti={})),(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON"})(df||(df={})),(function(r){r[r.MORTON=0]="MORTON",r[r.VEC_2=1]="VEC_2",r[r.VEC_3=2]="VEC_3"})(ps||(ps={}));class xf{constructor(e,i,s,o,l){this._vertexBufferType=e,this._topologyVector=i,this._vertexOffsets=s,this._vertexBuffer=o,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=vd(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,o=1,l=1,u=0,p=0,g=0;const m=e.mortonSettings,v=e.topologyVector,_=v.geometryOffsets,T=v.partOffsets,b=v.ringOffsets,I=e.vertexOffsets,M=!I||I.length===0,A=e.containsPolygonGeometry(),D=e.vertexBuffer;for(let F=0;F<e.numGeometries;F++)switch(e.geometryType(F)){case ti.POINT:{let R,B;if(M)R=D[p++],B=D[p++];else if(e.vertexBufferType===ps.MORTON){const V=vd(D[I[g++]],m.numBits,m.coordinateShift);R=V.x,B=V.y}else{const V=2*I[g++];R=D[V],B=D[V+1]}i[u++]=[[new fe(R,B)]],_&&l++,T&&s++,b&&o++}break;case ti.MULTIPOINT:{const R=_[l]-_[l-1];l++;const B=new Array(R);if(M)for(let V=0;V<R;V++){const N=D[p++],K=D[p++];B[V]=new fe(N,K)}else for(let V=0;V<R;V++){const N=2*I[g++];B[V]=new fe(D[N],D[N+1])}i[u++]=B.map((V=>[V])),s+=R,o+=R}break;case ti.LINESTRING:{let R,B;A?(R=b[o]-b[o-1],o++):R=T[s]-T[s-1],s++,M?(B=Ga(D,p,R,!1),p+=2*R):(B=Ua(e.vertexBufferType,D,I,g,R,!1,m),g+=R),i[u++]=[B],_&&l++}break;case ti.POLYGON:{const R=T[s]-T[s-1];s++;const B=new Array(R-1);let V,N=b[o]-b[o-1];if(o++,M){V=Ga(D,p,N,!0),p+=2*N;for(let K=0;K<B.length;K++)N=b[o]-b[o-1],o++,B[K]=Ga(D,p,N,!0),p+=2*N}else{V=Ua(e.vertexBufferType,D,I,g,N,!0,m),g+=N;for(let K=0;K<B.length;K++)N=b[o]-b[o-1],o++,B[K]=Ua(e.vertexBufferType,D,I,g,N,!0,m),g+=N}i[u++]=[V].concat(B),_&&l++}break;case ti.MULTILINESTRING:{const R=_[l]-_[l-1];l++;const B=new Array(R);for(let V=0;V<R;V++){let N;if(A?(N=b[o]-b[o-1],o++):N=T[s]-T[s-1],s++,M)B[V]=Ga(D,p,N,!1),p+=2*N;else{const K=Ua(e.vertexBufferType,D,I,g,N,!1,m);B[V]=K,g+=N}}i[u++]=B}break;case ti.MULTIPOLYGON:{const R=_[l]-_[l-1];l++;const B=new Array(R);for(let V=0;V<R;V++){const N=T[s]-T[s-1];let K;s++;const Q=new Array(N-1),ae=b[o]-b[o-1];o++,M?(K=Ga(D,p,ae,!0),p+=2*ae):(K=Ua(e.vertexBufferType,D,I,g,ae,!0,m),g+=ae);for(let re=0;re<Q.length;re++){const de=b[o]-b[o-1];o++,M?(Q[re]=Ga(D,p,de,!0),p+=2*de):(Q[re]=Ua(e.vertexBufferType,D,I,g,de,!0,m),g+=de)}B[V]=[K].concat(Q)}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 bf extends xf{constructor(e,i,s,o,l,u,p){super(s,o,l,u,p),this._numGeometries=e,this._geometryType=i}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===ti.POLYGON||this._geometryType===ti.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class wf extends xf{constructor(e,i,s,o,l,u){super(e,s,o,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)===ti.POLYGON||this.geometryType(e)===ti.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class Tf{constructor(e,i,s,o){this._triangleOffsets=e,this._indexBuffer=i,this._vertexBuffer=s,this._topologyVector=o}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,o=i.ringOffsets,l=i.geometryOffsets;let u=0,p=1,g=1,m=1;for(let v=0;v<this.numGeometries;v++)switch(this.geometryType(v)){case ti.POLYGON:{const _=s[p]-s[p-1];p++;const T=[];for(let b=0;b<_;b++){const I=o[g]-o[g-1];g++;const M=[];for(let A=0;A<I;A++){const D=this._vertexBuffer[u++],F=this._vertexBuffer[u++];M.push(new fe(D,F))}M.length>0&&M.push(M[0]),T.push(M)}e[v]=T,l&&m++}break;case ti.MULTIPOLYGON:{const _=l[m]-l[m-1];m++;const T=[];for(let b=0;b<_;b++){const I=s[p]-s[p-1];p++;for(let M=0;M<I;M++){const A=o[g]-o[g-1];g++;const D=[];for(let F=0;F<A;F++){const R=this._vertexBuffer[u++],B=this._vertexBuffer[u++];D.push(new fe(R,B))}D.length>0&&D.push(D[0]),T.push(D)}}e[v]=T}}return e}[Symbol.iterator](){return null}}function Sf(r,e,i,s,o,l){return new M_(r,e,i,s,o,l)}class M_ extends Tf{constructor(e,i,s,o,l,u){super(s,o,l,u),this._numGeometries=e,this._geometryType=i}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function Pf(r,e,i,s,o){return new E_(r,e,i,s,o)}class E_ extends Tf{constructor(e,i,s,o,l){super(i,s,o,l),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function C_(r,e,i,s,o){const l=Oi(r,i);let u,p,g,m;if(Ou(l,s,r,i)===St.CONST){const F=yd(r,i,l);let R,B,V,N;for(let K=0;K<e-1;K++){const Q=Oi(r,i);switch(Q.physicalStreamType){case _i.LENGTH:switch(Q.logicalStreamType.lengthType){case sr.GEOMETRIES:R=fs(r,i,Q);break;case sr.PARTS:B=fs(r,i,Q);break;case sr.RINGS:V=fs(r,i,Q);break;case sr.TRIANGLES:N=fs(r,i,Q)}break;case _i.OFFSET:switch(Q.logicalStreamType.offsetType){case po.VERTEX:u=or(r,i,Q);break;case po.INDEX:m=or(r,i,Q)}break;case _i.DATA:Rr.VERTEX===Q.logicalStreamType.dictionaryType?p=_d(r,i,Q):(g={numBits:Q.numBits,coordinateShift:Q.coordinateShift},p=or(r,i,Q))}}return m?R!==void 0||B!==void 0?Sf(s,F,N,m,p,{geometryOffsets:R,partOffsets:B,ringOffsets:V}):Sf(s,F,N,m,p):g===void 0?(function(K,Q,ae,re,de){return new bf(K,Q,ps.VEC_2,ae,re,de)})(s,F,{geometryOffsets:R,partOffsets:B,ringOffsets:V},u,p):(function(K,Q,ae,re,de,pe){return new bf(K,Q,ps.MORTON,ae,re,de,pe)})(s,F,{geometryOffsets:R,partOffsets:B,ringOffsets:V},u,p,g)}const v=or(r,i,l);let _,T,b,I,M,A,D;for(let F=0;F<e-1;F++){const R=Oi(r,i);switch(R.physicalStreamType){case _i.LENGTH:switch(R.logicalStreamType.lengthType){case sr.GEOMETRIES:_=or(r,i,R);break;case sr.PARTS:T=or(r,i,R);break;case sr.RINGS:b=or(r,i,R);break;case sr.TRIANGLES:I=fs(r,i,R)}break;case _i.OFFSET:switch(R.logicalStreamType.offsetType){case po.VERTEX:u=or(r,i,R);break;case po.INDEX:m=or(r,i,R)}break;case _i.DATA:Rr.VERTEX===R.logicalStreamType.dictionaryType?p=_d(r,i,R):(g={numBits:R.numBits,coordinateShift:R.coordinateShift},p=or(r,i,R))}}return _?(M=xd(v,_,2),T&&b?(A=If(v,M,T,!1),D=(function(F,R,B,V){const N=new Uint32Array(B[B.length-1]+1);let K=0;N[0]=K;let Q=1,ae=1,re=0;for(let de=0;de<F.length;de++){const pe=F[de],le=R[de+1]-R[de];if(pe!==0&&pe!==3)for(let ne=0;ne<le;ne++){const xe=B[Q]-B[Q-1];Q++;for(let Me=0;Me<xe;Me++)K=N[ae++]=K+V[re++]}else for(let ne=0;ne<le;ne++)N[ae++]=++K,Q++}return N})(v,M,A,b)):T&&(A=(function(F,R,B){const V=new Uint32Array(R[R.length-1]+1);let N=0;V[0]=N;let K=1,Q=0;for(let ae=0;ae<F.length;ae++){const re=F[ae],de=R[ae+1]-R[ae];if(re===4||re===1)for(let pe=0;pe<de;pe++)N=V[K++]=N+B[Q++];else for(let pe=0;pe<de;pe++)V[K++]=++N}return V})(v,M,T))):T&&b?(A=xd(v,T,1),D=If(v,A,b,!0)):T&&(A=xd(v,T,0)),m&&!A?Pf(v,I,m,p):m?Pf(v,I,m,p,{geometryOffsets:M,partOffsets:A,ringOffsets:D}):g===void 0?(function(F,R,B,V){return new wf(ps.VEC_2,F,R,B,V)})(v,{geometryOffsets:M,partOffsets:A,ringOffsets:D},u,p):(function(F,R,B,V,N){return new wf(ps.MORTON,F,R,B,V,N)})(v,{geometryOffsets:M,partOffsets:A,ringOffsets:D},u,p,g)}function xd(r,e,i){const s=new Uint32Array(r.length+1);let o=0;s[0]=o;let l=0;for(let u=0;u<r.length;u++)o=s[u+1]=o+(r[u]>i?e[l++]:1);return s}function If(r,e,i,s){const o=new Uint32Array(e[e.length-1]+1);let l=0;o[0]=l;let u=1,p=0;for(let g=0;g<r.length;g++){const m=r[g],v=e[g+1]-e[g];if(m===5||m===2||s&&(m===4||m===1))for(let _=0;_<v;_++)l=o[u++]=l+i[p++];else for(let _=0;_<v;_++)o[u++]=++l}return o}class A_ extends Ba{constructor(e,i,s){super(e,i.getBuffer(),s),this.dataVector=i}getValueFromBuffer(e){return this.dataVector.get(e)}}class D_ extends Bu{getValueFromBuffer(e){return this.dataBuffer[e]}}class Mf extends Ba{constructor(e,i,s,o){super(e,o?BigInt64Array.of(i):BigUint64Array.of(i),s)}getValueFromBuffer(e){return this.dataBuffer[0]}}function yc(r,e,i,s,o){const l=(function(u,p,g,m){const v=new Uint8Array(p);let _=0;const T=m.get()+g;for(;_<p&&!(m.get()>=T);){const b=u[m.increment()];if(b<=127){const I=b+3,M=u[m.increment()],A=Math.min(_+I,p);v.fill(M,_,A),_=A}else{const I=256-b;for(let M=0;M<I&&_<p;M++)v[_++]=u[m.increment()]}}return m.set(T),v})(r,Math.ceil(e/8),i,s);return o?(function(u,p,g){if(!g)return u;const m=g.size(),v=new Lr(u,p),_=new Lr(new Uint8Array(Math.ceil(m/8)),m);let T=0;for(let b=0;b<m;b++){const I=!!g.get(b)&&v.get(T++);_.set(b,I)}return _.getBuffer()})(l,e,o):l}const z_=new TextDecoder;function bd(r,e,i){return i-e>=12?z_.decode(r.subarray(e,i)):(function(s,o,l){let u="",p=o;for(;p<l;){const g=s[p];let m,v,_,T=null,b=g>239?4:g>223?3:g>191?2:1;if(p+b>l)break;b===1?g<128&&(T=g):b===2?(m=s[p+1],(192&m)==128&&(T=(31&g)<<6|63&m,T<=127&&(T=null))):b===3?(m=s[p+1],v=s[p+2],(192&m)==128&&(192&v)==128&&(T=(15&g)<<12|(63&m)<<6|63&v,(T<=2047||T>=55296&&T<=57343)&&(T=null))):b===4&&(m=s[p+1],v=s[p+2],_=s[p+3],(192&m)==128&&(192&v)==128&&(192&_)==128&&(T=(15&g)<<18|(63&m)<<12|(63&v)<<6|63&_,(T<=65535||T>=1114112)&&(T=null))),T===null?(T=65533,b=1):T>65535&&(T-=65536,u+=String.fromCharCode(T>>>10&1023|55296),T=56320|1023&T),u+=String.fromCharCode(T),p+=b}return u})(r,e,i)}class wd extends Ba{constructor(e,i,s,o){super(e,s,o),this.offsetBuffer=i}}class Ef extends wd{constructor(e,i,s,o){super(e,i,s,o??i.length-1)}getValueFromBuffer(e){return bd(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class $a extends wd{constructor(e,i,s,o,l){super(e,s,o,l??i.length),this.indexBuffer=i,this.indexBuffer=i}getValueFromBuffer(e){const i=this.indexBuffer[e];return bd(this.dataBuffer,this.offsetBuffer[i],this.offsetBuffer[i+1])}}class Cf extends wd{constructor(e,i,s,o,l,u,p){super(e,s,o,p),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,o,l){const u=[],p=new Array(o.length).fill(0);for(let g=1;g<o.length;g++)p[g]=p[g-1]+o[g-1];for(let g=0;g<l.length;g++)if(l[g]===255)u.push(l[++g]);else{const m=o[l[g]],v=p[l[g]];for(let _=0;_<m;_++)u.push(s[v+_])}return new Uint8Array(u)})(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const i=this.indexBuffer[e];return bd(this.decodedDictionary,this.offsetBuffer[i],this.offsetBuffer[i+1])}offsetToLengthBuffer(e){const i=new Uint32Array(e.length-1);let s=e[0];for(let o=1;o<e.length;o++){const l=e[o];i[o-1]=l-s,s=l}return i}}function k_(r,e,i,s,o,l){return i.type==="scalarType"?(function(u,p,g,m,v,_){let T=null;if(u===0)return null;if(_.nullable){const I=Oi(p,g),M=I.numValues,A=g.get(),D=yc(p,M,I.byteLength,g);g.set(A+I.byteLength),T=new Lr(D,I.numValues)}const b=T??m;switch(v.physicalType){case 4:case 3:return(function(I,M,A,D,F){const R=Oi(I,M),B=Ou(R,F,I,M),V=D.physicalType===3;if(B===St.FLAT){const K=vc(F)?F:void 0,Q=V?_d(I,M,R,0,K):or(I,M,R,0,K);return new od(A.name,Q,F)}if(B===St.SEQUENCE){const K=pf(I,M,R);return new ld(A.name,K[0],K[1],R.numRleValues)}const N=V?(function(K,Q,ae){const re=Na(K,Q,ae);return re.length===1?mt(re[0]):(function(de){return mt(de[1])})(re)})(I,M,R):yd(I,M,R);return new cd(A.name,N,F,V)})(p,g,_,v,b);case 9:return(function(I,M,A,D,F){let R=null,B=null,V=null,N=null,K=null,Q=F??null,ae=null,re=null;for(let de=0;de<D;de++){const pe=Oi(M,A);switch(pe.physicalStreamType){case _i.PRESENT:{const le=yc(M,pe.numValues,pe.byteLength,A),ne=new Lr(le,pe.numValues);Q=F??ne;break}case _i.OFFSET:B=or(M,A,pe,0,Q);break;case _i.LENGTH:{const le=fs(M,A,pe);sr.DICTIONARY===pe.logicalStreamType.lengthType?R=le:sr.SYMBOL===pe.logicalStreamType.lengthType?N=le:ae=le;break}case _i.DATA:{const le=M.subarray(A.get(),A.get()+pe.byteLength);A.add(pe.byteLength);const ne=pe.logicalStreamType.dictionaryType;Rr.FSST===ne?K=le:Rr.SINGLE===ne||Rr.SHARED===ne?V=le:Rr.NONE===ne&&(re=le);break}}}return(function(de,pe,le,ne,xe,Me,Pe){return pe?new Cf(de,le,ne,xe,Me,pe,Pe):null})(I,K,B,R,V,N,Q)??(function(de,pe,le,ne,xe){return pe?xe?new $a(de,le,ne,pe,xe):new $a(de,le,ne,pe):null})(I,V,B,R,Q)??(function(de,pe,le,ne,xe){if(!pe||!le)return null;if(ne)return xe?new $a(de,ne,pe,le,xe):new $a(de,ne,pe,le);if(xe&&xe.size()!==pe.length-1){const Me=new Uint32Array(xe.size());let Pe=0;for(let be=0;be<xe.size();be++)Me[be]=xe.get(be)?Pe++:0;return new $a(de,Me,pe,le,xe)}return xe?new Ef(de,pe,le,xe):new Ef(de,pe,le)})(I,ae,re,B,Q)})(_.name,p,g,_.nullable?u-1:u,T);case 0:return(function(I,M,A,D,F){const R=Oi(I,M),B=R.numValues,V=M.get(),N=vc(F)?F:void 0,K=yc(I,B,R.byteLength,M,N);M.set(V+R.byteLength);const Q=new Lr(K,B);return new A_(A.name,Q,F)})(p,g,_,0,b);case 6:case 5:return(function(I,M,A,D,F){const R=Oi(I,M),B=Ou(R,D,I,M,"int64"),V=F.physicalType===5;if(B===St.FLAT){const K=vc(D)?D:void 0,Q=V?(function(ae,re,de,pe){return(function(le,ne,xe){let Me;switch(ne.logicalLevelTechnique1){case Qe.DELTA:if(ne.logicalLevelTechnique2===Qe.RLE){const Pe=ne;if(!xe)return(function(be,Oe,at){const ht=new BigInt64Array(at);let pt=0,vi=0n;for(let zt=0;zt<Oe;zt++){const Xt=Number(be[zt]),ii=Bi(be[zt+Oe]);for(let Pt=0;Pt<Xt;Pt++)vi+=ii,ht[pt++]=vi}return ht})(le,Pe.runs,Pe.numRleValues);Me=hf(le=md(le,Pe.runs,Pe.numRleValues))}else Me=hf(le);break;case Qe.RLE:Me=(function(Pe,be,Oe){if(Oe===void 0){Oe=0;for(let pt=0;pt<be;pt++)Oe+=Number(Pe[pt])}const at=new BigInt64Array(Oe);let ht=0;for(let pt=0;pt<be;pt++){const vi=Number(Pe[pt]);let zt=Pe[pt+be];zt=Bi(zt),at.fill(zt,ht,ht+vi),ht+=vi}return at})(le,ne.runs,ne.numRleValues);break;case Qe.NONE:Me=(function(Pe){const be=new BigInt64Array(Pe.length);for(let Oe=0;Oe<Pe.length;Oe++)be[Oe]=Bi(Pe[Oe]);return be})(le);break;default:throw new Error(`The specified Logical level technique is not supported: ${ne.logicalLevelTechnique1}`)}return xe?ja(Me,xe,0n):Me})(Oa(ae,re,de.numValues),de,pe)})(I,M,R,K):mf(I,M,R,K);return new _f(A.name,Q,D)}if(B===St.SEQUENCE){const K=ff(I,M,R);return new yf(A.name,K[0],K[1],R.numRleValues)}const N=V?(function(K,Q,ae){const re=Oa(K,Q,ae.numValues);return re.length===1?Bi(re[0]):(function(de){return Bi(de[1])})(re)})(I,M,R):gf(I,M,R);return new Mf(A.name,N,D,V)})(p,g,_,b,v);case 7:return(function(I,M,A,D){const F=Oi(I,M),R=vc(D)?D:void 0,B=(function(V,N,K,Q){const ae=N.get(),re=ae+K*Float32Array.BYTES_PER_ELEMENT,de=new Uint8Array(V.subarray(ae,re)).buffer,pe=new Float32Array(de);return N.set(re),Q?ja(pe,Q,0):pe})(I,M,F.numValues,R);return new D_(A.name,B,D)})(p,g,_,b);case 8:return(function(I,M,A,D){const F=Oi(I,M),R=vc(D)?D:void 0,B=(function(V,N,K,Q){const ae=N.get(),re=ae+K*Float64Array.BYTES_PER_ELEMENT,de=new Uint8Array(V.subarray(ae,re)).buffer,pe=new Float64Array(de);return N.set(re),Q?ja(pe,Q,0):pe})(I,M,F.numValues,R);return new ad(A.name,B,D)})(p,g,_,b);default:throw new Error(`The specified data type for the field is currently not supported: ${v}`)}})(s,r,e,o,i.scalarType,i):s===0?null:(function(u,p,g,m){let v=null,_=null,T=null,b=null,I=!1;for(;!I;){const F=Oi(u,p);switch(F.physicalStreamType){case _i.LENGTH:sr.DICTIONARY===F.logicalStreamType.lengthType?v=fs(u,p,F):T=fs(u,p,F);break;case _i.DATA:Rr.SINGLE===F.logicalStreamType.dictionaryType||Rr.SHARED===F.logicalStreamType.dictionaryType?(_=u.subarray(p.get(),p.get()+F.byteLength),I=!0):b=u.subarray(p.get(),p.get()+F.byteLength),p.add(F.byteLength)}}const M=g.complexType.children,A=[];let D=0;for(const F of M){const R=Ci(u,p,1)[0];if(R===0)continue;const B=F.name?`${g.name}${F.name}`:g.name;if(R!==2||F.type!=="scalarField"||F.scalarField.physicalType!==9)throw new Error("Currently only optional string fields are implemented for a struct.");const V=Oi(u,p),N=yc(u,V.numValues,V.byteLength,p),K=Oi(u,p),Q=or(u,p,K,0,K.decompressedCount!==m?new Lr(N,V.numValues):void 0);A[D++]=b?new Cf(B,Q,v,_,T,b,new Lr(N,V.numValues)):new $a(B,Q,v,_,new Lr(N,V.numValues))}return A})(r,e,i,o)}function vc(r){return r instanceof Lr}function Af(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 o={type:"physicalType"};return o.physicalType=i,s.type="scalarType",s.scalarType=o,s})(r)}}function Df(r){return r>=10}function zf(r){return r===30}function R_(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 L_(r){return r.type==="complexType"&&r.complexType?.type==="physicalType"&&r.complexType.physicalType===0}const F_=new TextDecoder;function Td(r,e){const i=Ci(r,e,1)[0];if(i===0)return"";const s=e.get(),o=r.subarray(s,s+i);return e.add(i),F_.decode(o)}function kf(r,e){const i=Ci(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=Af(i);if(Df(i)&&(s.name=Td(r,e)),zf(i)){const o=Ci(r,e,1)[0]>>>0;s.complexType.children=new Array(o);for(let l=0;l<o;l++)s.complexType.children[l]=kf(r,e)}return(function(o){return{name:o.name,nullable:o.nullable,scalarField:o.scalarType,complexField:o.complexType,type:o.type==="scalarType"?"scalarField":"complexField"}})(s)}function B_(r,e){const i=Ci(r,e,1)[0]>>>0,s=Af(i);if(!s)throw new Error(`Unsupported column type code ${i}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(Df(i)?s.name=Td(r,e):i>=0&&i<=3?s.name="id":i===4&&(s.name="geometry"),zf(i)){const o=Ci(r,e,1)[0]>>>0,l=s.complexType;l.children=new Array(o);for(let u=0;u<o;u++)l.children[u]=kf(r,e)}return s}function O_(r,e){const i={featureTables:[]},s={};s.name=Td(r,e);const o=Ci(r,e,1)[0]>>>0,l=Ci(r,e,1)[0]>>>0;s.columns=new Array(l);for(let u=0;u<l;u++)s.columns[u]=B_(r,e);return i.featureTables.push(s),[i,o]}function V_(r,e,i,s,o,l,u=!1){const p=e.scalarType;if(!p||p.type!=="logicalType"||p.logicalType!==0)throw new Error(`ID column must be a logical ID scalar type: ${s}`);const g=p.longID?6:4,m=typeof l=="number"?void 0:l,v=Ou(o,l,r,i,g===6?"int64":"int32");if(g===4)switch(v){case St.FLAT:{const _=or(r,i,o,0,m);return new od(s,_,l)}case St.SEQUENCE:{const _=pf(r,i,o);return new ld(s,_[0],_[1],o.numRleValues)}case St.CONST:{const _=yd(r,i,o);return new cd(s,_,l,!1)}}switch(v){case St.FLAT:{if(u){const T=(function(b,I,M){const A=(function(D,F,R){const B=new Float64Array(R);for(let V=0;V<R;V++)B[V]=I_(D,F);return B})(b,I,M.numValues);return(function(D,F){switch(F.logicalLevelTechnique1){case Qe.DELTA:return F.logicalLevelTechnique2===Qe.RLE&&(D=cf(D,F.runs,F.numRleValues)),(function(R){R[0]=Va(R[0]);const B=R.length/4*4;let V=1;if(B>=4)for(;V<B-4;V+=4){const N=R[V+1],K=R[V+2],Q=R[V+3];R[V]=Va(R[V])+R[V-1],R[V+1]=Va(N)+R[V],R[V+2]=Va(K)+R[V+1],R[V+3]=Va(Q)+R[V+2]}for(;V!==R.length;++V)R[V]=Va(R[V])+R[V-1]})(D),D;case Qe.RLE:return(function(R,B){return cf(R,B.runs,B.numRleValues)})(D,F);case Qe.NONE:return D;default:throw new Error(`The specified Logical level technique is not supported: ${F.logicalLevelTechnique1}`)}})(A,M)})(r,i,o);return new ad(s,T,l)}const _=mf(r,i,o,m);return new _f(s,_,l)}case St.SEQUENCE:{const _=ff(r,i,o);return new yf(s,_[0],_[1],o.numRleValues)}case St.CONST:{const _=gf(r,i,o);return new Mf(s,_,l,!1)}}throw new Error("Vector type not supported for id column.")}class j_{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 ti.POINT:case ti.MULTIPOINT:this.type=1;break;case ti.LINESTRING:case ti.MULTILINESTRING:this.type=2;break;case ti.POLYGON:case ti.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 o of i)s.push(new fe(o.x,o.y));e.push(s)}return e}}class N_{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 j_(this.features[e],this.extent)}}class Rf{constructor(e){this.layers={};const i=(function(s,o,l=!0){const u=new af(0),p=[];for(;u.get()<s.length;){const m=Ci(s,u,1)[0]>>>0,v=u.get()+m;if(v>s.length)throw new Error(`Block overruns tile: ${v} > ${s.length}`);if(Ci(s,u,1)[0]>>>0!=1){u.set(v);continue}const[_,T]=O_(s,u),b=_.featureTables[0];let I=null,M=null;const A=[];let D=0;for(const R of b.columns){const B=R.name;if((g=R).type==="scalarType"&&g.scalarType?.type==="logicalType"&&g.scalarType.logicalType===0){let V=null;if(R.nullable){const K=Oi(s,u),Q=u.get(),ae=yc(s,K.numValues,K.byteLength,u);u.set(Q+K.byteLength),V=new Lr(ae,K.numValues)}const N=Oi(s,u);D=V?V.size():N.decompressedCount,I=V_(s,R,u,B,N,V??D,l)}else if(L_(R)){const V=Ci(s,u,1)[0];if(D===0){const N=u.get();D=Oi(s,u).decompressedCount,u.set(N)}M=C_(s,V,u,D)}else{const V=R_(R)?Ci(s,u,1)[0]:1;if(V===0)continue;const N=k_(s,u,R,V,D);if(N)if(Array.isArray(N))for(const K of N)A.push(K);else A.push(N)}}const F=new __(b.name,M,I,A,T);p.push(F),u.set(v)}var g;return p})(new Uint8Array(e));this.layers=i.reduce(((s,o)=>Object.assign(Object.assign({},s),{[o.name]:new N_(o)})),{})}}class U_{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 o=[];for(const l of s)o.push(new fe(l[0],l[1]));e.push(o)}return e}}const xc="_geojsonTileLayer";function G_(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,$_,s);const o=s.keys;for(const u of o)e.writeStringField(3,u);const l=s.values;for(const u of l)e.writeMessage(4,W_,u)}function $_(r,e){if(!r.feature)return;const i=r.feature;i.id!==void 0&&e.writeVarintField(1,i.id),e.writeMessage(2,Z_,r),e.writeVarintField(3,i.type),e.writeMessage(4,q_,i)}function Z_(r,e){for(const i in r.feature?.properties){let s=r.feature.properties[i],o=r.keycache[i];if(s==null)continue;o===void 0&&(r.keys.push(i),o=r.keys.length-1,r.keycache[i]=o),e.writeVarint(o),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 Sd(r,e){return(e<<3)+(7&r)}function Lf(r){return r<<1^r>>31}function q_(r,e){const i=r.loadGeometry(),s=r.type;let o=0,l=0;for(const u of i){let p=1;s===1&&(p=u.length),e.writeVarint(Sd(1,p));const g=s===3?u.length-1:u.length;for(let m=0;m<g;m++){m===1&&s!==1&&e.writeVarint(Sd(2,g-1));const v=u[m].x-o,_=u[m].y-l;e.writeVarint(Lf(v)),e.writeVarint(Lf(_)),o+=v,l+=_}r.type===3&&e.writeVarint(Sd(7,1))}}function W_(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 Ff{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Er(Be,16,0),this.grid3D=new Er(Be,16,0),this.featureIndexArray=new w,this.promoteId=i}insert(e,i,s,o,l,u){const p=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,o,l);const g=u?this.grid3D:this.grid;for(const m of i){const v=[1/0,1/0,-1/0,-1/0];for(const _ of m)v[0]=Math.min(v[0],_.x),v[1]=Math.min(v[1],_.y),v[2]=Math.max(v[2],_.x),v[3]=Math.max(v[3],_.y);v[0]<Be&&v[1]<Be&&v[2]>=0&&v[3]>=0&&g.insert(p,v[0],v[1],v[2],v[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=this.encoding!=="mlt"?new lp(new zu(this.rawTileData)).layers:new Rf(this.rawTileData).layers,this.sourceLayerCoder=new nf(this.vtLayers?Object.keys(this.vtLayers).sort():[xc])),this.vtLayers}query(e,i,s,o){this.loadVTLayers();const l=e.params,u=Be/e.tileSize/e.scale,p=Us(l.filter,l.globalState),g=e.queryGeometry,m=e.queryPadding*u,v=ho.fromPoints(g),_=this.grid.query(v.minX-m,v.minY-m,v.maxX+m,v.maxY+m),T=ho.fromPoints(e.cameraQueryGeometry).expandBy(m),b=this.grid3D.query(T.minX,T.minY,T.maxX,T.maxY,((A,D,F,R)=>(function(B,V,N,K,Q){for(const re of B)if(V<=re.x&&N<=re.y&&K>=re.x&&Q>=re.y)return!0;const ae=[new fe(V,N),new fe(V,Q),new fe(K,Q),new fe(K,N)];if(B.length>2){for(const re of ae)if(Pa(B,re))return!0}for(let re=0;re<B.length-1;re++)if(Sm(B[re],B[re+1],ae))return!0;return!1})(e.cameraQueryGeometry,A-m,D-m,F+m,R+m)));for(const A of b)_.push(A);_.sort(H_);const I={};let M;for(const A of _){if(A===M)continue;M=A;const D=this.featureIndexArray.get(A);let F=null;this.loadMatchingFeature(I,D.bucketIndex,D.sourceLayerIndex,D.featureIndex,p,l.layers,l.availableImages,i,s,o,((R,B,V)=>(F||(F=zr(R)),B.queryIntersectsFeature({queryGeometry:g,feature:R,featureState:V,geometry:F,zoom:this.z,transform:e.transform,pixelsToTileUnits:u,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return I}loadMatchingFeature(e,i,s,o,l,u,p,g,m,v,_){const T=this.bucketLayerIDs[i];if(u&&!T.some((A=>u.has(A))))return;const b=this.sourceLayerCoder.decode(s),I=this.vtLayers[b].feature(o);if(l.needGeometry){const A=kr(I,!0);if(!l.filter(new ft(this.tileID.overscaledZ),A,this.tileID.canonical))return}else if(!l.filter(new ft(this.tileID.overscaledZ),I))return;const M=this.getId(I,b);for(const A of T){if(u&&!u.has(A))continue;const D=g[A];if(!D)continue;let F={};M&&v&&(F=v.getState(D.sourceLayer||xc,M));const R=di({},m[A]);R.paint=Bf(R.paint,D.paint,I,F,p),R.layout=Bf(R.layout,D.layout,I,F,p);const B=!_||_(I,D,F);if(!B)continue;const V=new sf(I,this.z,this.x,this.y,M);V.layer=R;let N=e[A];N===void 0&&(N=e[A]=[]),N.push({featureIndex:o,feature:V,intersectionZ:B})}}lookupSymbolFeatures(e,i,s,o,l,u,p,g){const m={};this.loadVTLayers();const v=Us(l.filterSpec,l.globalState);for(const _ of e)this.loadMatchingFeature(m,s,o,_,v,u,p,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 o=e.id;return this.promoteId&&(o=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[i]],typeof o=="boolean"&&(o=Number(o)),o===void 0&&(!((s=e.properties)===null||s===void 0)&&s.cluster)&&this.promoteId&&(o=Number(e.properties.cluster_id))),o}}function Bf(r,e,i,s,o){return Sr(r,((l,u)=>{const p=e instanceof _a?e.get(u):null;return p?.evaluate?p.evaluate(i,s,o):p}))}function H_(r,e){return e-r}function Of(r,e,i,s,o){const l=[];for(const u of r){let p;for(let g=0;g<u.length-1;g++){let m=u[g],v=u[g+1];m.x<e&&v.x<e||(m.x<e?m=new fe(e,m.y+(e-m.x)/(v.x-m.x)*(v.y-m.y))._round():v.x<e&&(v=new fe(e,m.y+(e-m.x)/(v.x-m.x)*(v.y-m.y))._round()),m.y<i&&v.y<i||(m.y<i?m=new fe(m.x+(i-m.y)/(v.y-m.y)*(v.x-m.x),i)._round():v.y<i&&(v=new fe(m.x+(i-m.y)/(v.y-m.y)*(v.x-m.x),i)._round()),m.x>=s&&v.x>=s||(m.x>=s?m=new fe(s,m.y+(s-m.x)/(v.x-m.x)*(v.y-m.y))._round():v.x>=s&&(v=new fe(s,m.y+(s-m.x)/(v.x-m.x)*(v.y-m.y))._round()),m.y>=o&&v.y>=o||(m.y>=o?m=new fe(m.x+(o-m.y)/(v.y-m.y)*(v.x-m.x),o)._round():v.y>=o&&(v=new fe(m.x+(o-m.y)/(v.y-m.y)*(v.x-m.x),o)._round()),p&&m.equals(p[p.length-1])||(p=[m],l.push(p)),p.push(v)))))}}return l}function Vf(r,e,i,s,o){switch(e){case 1:return(function(l,u,p,g){const m=[];for(const v of l)for(const _ of v){const T=g===0?_.x:_.y;T>=u&&T<=p&&m.push([_])}return m})(r,i,s,o);case 2:return jf(r,i,s,o,!1);case 3:return jf(r,i,s,o,!0)}return[]}function X_(r,e,i,s,o){const l=s===0?Y_:K_;let u=[];const p=[];for(let v=0;v<r.length-1;v++){const _=r[v],T=r[v+1],b=s===0?_.x:_.y,I=s===0?T.x:T.y;let M=!1;b<e?I>e&&u.push(l(_,T,e)):b>i?I<i&&u.push(l(_,T,i)):u.push(_),I<e&&b>=e&&(u.push(l(_,T,e)),M=!0),I>i&&b<=i&&(u.push(l(_,T,i)),M=!0),!o&&M&&(p.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]),o&&u.length>0&&!u[0].equals(u[u.length-1])&&u.push(new fe(u[0].x,u[0].y)),u.length>0&&p.push(u),p}function jf(r,e,i,s,o){const l=[];for(const u of r){const p=X_(u,e,i,s,o);p.length>0&&l.push(...p)}return l}function Y_(r,e,i){return new fe(i,r.y+(i-r.x)/(e.x-r.x)*(e.y-r.y))}function K_(r,e,i){return new fe(r.x+(i-r.y)/(e.y-r.y)*(e.x-r.x),i)}Ae("FeatureIndex",Ff,{omit:["rawTileData","sourceLayerCoder"]});class ms extends fe{constructor(e,i,s,o){super(e,i),this.angle=s,o!==void 0&&(this.segment=o)}clone(){return new ms(this.x,this.y,this.angle,this.segment)}}function Nf(r,e,i,s,o){if(e.segment===void 0||i===0)return!0;let l=e,u=e.segment+1,p=0;for(;p>-i/2;){if(u--,u<0)return!1;p-=r[u].dist(l),l=r[u]}p+=r[u].dist(r[u+1]),u++;const g=[];let m=0;for(;p<i/2;){const v=r[u],_=r[u+1];if(!_)return!1;let T=r[u-1].angleTo(v)-v.angleTo(_);for(T=Math.abs((T+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:p,angleDelta:T}),m+=T;p-g[0].distance>s;)m-=g.shift().angleDelta;if(m>o)return!1;u++,p+=v.dist(_)}return!0}function Uf(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function Gf(r,e,i){return r?.6*e*i:0}function $f(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function J_(r,e,i,s,o,l){const u=Gf(i,o,l),p=$f(i,s)*l;let g=0;const m=Uf(r)/2;for(let v=0;v<r.length-1;v++){const _=r[v],T=r[v+1],b=_.dist(T);if(g+b>m){const I=(m-g)/b,M=lr.number(_.x,T.x,I),A=lr.number(_.y,T.y,I),D=new ms(M,A,T.angleTo(_),v);return D._round(),!u||Nf(r,D,p,u,e)?D:void 0}g+=b}}function Q_(r,e,i,s,o,l,u,p,g){const m=Gf(s,l,u),v=$f(s,o),_=v*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),Zf(r,T?e/2*p%e:(v/2+2*l)*u*p%e,e,m,i,_,T,!1,g)}function Zf(r,e,i,s,o,l,u,p,g){const m=l/2,v=Uf(r);let _=0,T=e-i,b=[];for(let I=0;I<r.length-1;I++){const M=r[I],A=r[I+1],D=M.dist(A),F=A.angleTo(M);for(;T+i<_+D;){T+=i;const R=(T-_)/D,B=lr.number(M.x,A.x,R),V=lr.number(M.y,A.y,R);if(B>=0&&B<g&&V>=0&&V<g&&T-m>=0&&T+m<=v){const N=new ms(B,V,F,I);N._round(),s&&!Nf(r,N,l,s,o)||b.push(N)}}_+=D}return p||b.length||u||(b=Zf(r,_/2,i,s,o,l,u,!0,g)),b}function qf(r,e,i,s){const o=[],l=r.image,u=l.pixelRatio,p=l.paddedRect.w-2,g=l.paddedRect.h-2;let m={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const v=l.stretchX||[[0,p]],_=l.stretchY||[[0,g]],T=(ne,xe)=>ne+xe[1]-xe[0],b=v.reduce(T,0),I=_.reduce(T,0),M=p-b,A=g-I;let D=0,F=b,R=0,B=I,V=0,N=M,K=0,Q=A;if(l.content&&s){const ne=l.content,xe=ne[2]-ne[0],Me=ne[3]-ne[1];(l.textFitWidth||l.textFitHeight)&&(m=Np(r)),D=Vu(v,0,ne[0]),R=Vu(_,0,ne[1]),F=Vu(v,ne[0],ne[2]),B=Vu(_,ne[1],ne[3]),V=ne[0]-D,K=ne[1]-R,N=xe-F,Q=Me-B}const ae=m.x1,re=m.y1,de=m.x2-ae,pe=m.y2-re,le=(ne,xe,Me,Pe)=>{const be=ju(ne.stretch-D,F,de,ae),Oe=Nu(ne.fixed-V,N,ne.stretch,b),at=ju(xe.stretch-R,B,pe,re),ht=Nu(xe.fixed-K,Q,xe.stretch,I),pt=ju(Me.stretch-D,F,de,ae),vi=Nu(Me.fixed-V,N,Me.stretch,b),zt=ju(Pe.stretch-R,B,pe,re),Xt=Nu(Pe.fixed-K,Q,Pe.stretch,I),ii=new fe(be,at),Pt=new fe(pt,at),hi=new fe(pt,zt),Ai=new fe(be,zt),Di=new fe(Oe/u,ht/u),Hi=new fe(vi/u,Xt/u),xi=e*Math.PI/180;if(xi){const ri=Math.sin(xi),Et=Math.cos(xi),Gt=[Et,-ri,ri,Et];ii._matMult(Gt),Pt._matMult(Gt),Ai._matMult(Gt),hi._matMult(Gt)}const Xi=ne.stretch+ne.fixed,br=xe.stretch+xe.fixed;return{tl:ii,tr:Pt,bl:Ai,br:hi,tex:{x:l.paddedRect.x+1+Xi,y:l.paddedRect.y+1+br,w:Me.stretch+Me.fixed-Xi,h:Pe.stretch+Pe.fixed-br},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Di,pixelOffsetBR:Hi,minFontScaleX:N/u/de,minFontScaleY:Q/u/pe,isSDF:i}};if(s&&(l.stretchX||l.stretchY)){const ne=Wf(v,M,b),xe=Wf(_,A,I);for(let Me=0;Me<ne.length-1;Me++){const Pe=ne[Me],be=ne[Me+1];for(let Oe=0;Oe<xe.length-1;Oe++)o.push(le(Pe,xe[Oe],be,xe[Oe+1]))}}else o.push(le({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:p+1},{fixed:0,stretch:g+1}));return o}function Vu(r,e,i){let s=0;for(const o of r)s+=Math.max(e,Math.min(i,o[1]))-Math.max(e,Math.min(i,o[0]));return s}function Wf(r,e,i){const s=[{fixed:-1,stretch:0}];for(const[o,l]of r){const u=s[s.length-1];s.push({fixed:o-u.stretch,stretch:u.stretch}),s.push({fixed:o-u.stretch,stretch:u.stretch+(l-o)})}return s.push({fixed:e+1,stretch:i}),s}function ju(r,e,i,s){return r/e*i+s}function Nu(r,e,i,s){return r-e*i/s}Ae("Anchor",ms);class Uu{constructor(e,i,s,o,l,u,p,g,m,v){var _;if(this.boxStartIndex=e.length,m){let T=u.top,b=u.bottom;const I=u.collisionPadding;I&&(T-=I[1],b+=I[3]);let M=b-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)?Np(u):{x1:u.left,y1:u.top,x2:u.right,y2:u.bottom};T.y1=T.y1*p-g[0],T.y2=T.y2*p+g[2],T.x1=T.x1*p-g[3],T.x2=T.x2*p+g[1];const b=u.collisionPadding;if(b&&(T.x1-=b[0]*p,T.y1-=b[1]*p,T.x2+=b[2]*p,T.y2+=b[3]*p),v){const I=new fe(T.x1,T.y1),M=new fe(T.x2,T.y1),A=new fe(T.x1,T.y2),D=new fe(T.x2,T.y2),F=v*Math.PI/180;I._rotate(F),M._rotate(F),A._rotate(F),D._rotate(F),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,o,l)}this.boxEndIndex=e.length}}class ey{constructor(e=[],i=(s,o)=>s<o?-1:s>o?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,o=i[e];for(;e>0;){const l=e-1>>1,u=i[l];if(s(o,u)>=0)break;i[e]=u,e=l}i[e]=o}_down(e){const{data:i,compare:s}=this,o=this.length>>1,l=i[e];for(;e<o;){let u=1+(e<<1);const p=u+1;if(p<this.length&&s(i[p],i[u])<0&&(u=p),s(i[u],l)>=0)break;i[e]=i[u],e=u}i[e]=l}}function ty(r,e=1){const i=ho.fromPoints(r[0]),s=Math.min(i.width(),i.height());let o=s/2;const l=new ey([],iy),{minX:u,minY:p,maxX:g,maxY:m}=i;if(s===0)return new fe(u,p);for(let T=u;T<g;T+=s)for(let b=p;b<m;b+=s)l.push(new Za(T+o,b+o,o,r));const v=(function(T){let b=0,I=0,M=0;const A=T[0];for(let D=0,F=A.length,R=F-1;D<F;R=D++){const B=A[D],V=A[R],N=B.x*V.y-V.x*B.y;I+=(B.x+V.x)*N,M+=(B.y+V.y)*N,b+=3*N}return new Za(I/b,M/b,0,T)})(r);let _=v;for(;l.length;){const T=l.pop();(T.d>_.d||!_.d)&&(_=T),T.max-_.d<=e||(o=T.h/2,l.push(new Za(T.p.x-o,T.p.y-o,o,r)),l.push(new Za(T.p.x+o,T.p.y-o,o,r)),l.push(new Za(T.p.x-o,T.p.y+o,o,r)),l.push(new Za(T.p.x+o,T.p.y+o,o,r)))}return v.d>0&&_.d-v.d<=e?v.p:_.p}function iy(r,e){return e.max-r.max}class Za{constructor(e,i,s,o){this.p=new fe(e,i),this.h=s,this.d=(function(l,u){let p=!1,g=1/0;for(const m of u)for(let v=0,_=m.length,T=_-1;v<_;T=v++){const b=m[v],I=m[T];b.y>l.y!=I.y>l.y&&l.x<(I.x-b.x)*(l.y-b.y)/(I.y-b.y)+b.x&&(p=!p),g=Math.min(g,Bd(l,b,I))}return(p?1:-1)*Math.sqrt(g)})(this.p,o),this.max=this.d+this.h*Math.SQRT2}}var yi;k.aM=void 0,(yi=k.aM||(k.aM={}))[yi.center=1]="center",yi[yi.left=2]="left",yi[yi.right=3]="right",yi[yi.top=4]="top",yi[yi.bottom=5]="bottom",yi[yi["top-left"]=6]="top-left",yi[yi["top-right"]=7]="top-right",yi[yi["bottom-left"]=8]="bottom-left",yi[yi["bottom-right"]=9]="bottom-right";const Pd=Number.POSITIVE_INFINITY;function Hf(r,e){return e[1]!==Pd?(function(i,s,o){let l=0,u=0;switch(s=Math.abs(s),o=Math.abs(o),i){case"top-right":case"top-left":case"top":u=o-7;break;case"bottom-right":case"bottom-left":case"bottom":u=7-o}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 o=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":o=-u;break;case"top-left":case"bottom-left":o=u;break;case"left":o=s;break;case"right":o=-s}return[o,l]})(r,e[0])}function Xf(r,e,i){var s;const o=r.layout,l=(s=o.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(e,{},i);if(l){const p=l.values,g=[];for(let m=0;m<p.length;m+=2){const v=g[m]=p[m],_=p[m+1].map((T=>T*ei));v.startsWith("top")?_[1]-=7:v.startsWith("bottom")&&(_[1]+=7),g[m+1]=_}return new Si(g)}const u=o.get("text-variable-anchor");if(u){let p;p=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[o.get("text-radial-offset").evaluate(e,{},i)*ei,Pd]:o.get("text-offset").evaluate(e,{},i).map((m=>m*ei));const g=[];for(const m of u)g.push(m,Hf(m,p));return new Si(g)}return null}function Id(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 ry(r,e,i,s,o,l,u,p,g,m,v,_){let T=l.textMaxSize.evaluate(e,{});T===void 0&&(T=u);const b=r.layers[0].layout,I=b.get("icon-offset").evaluate(e,{},v),M=Kf(i.horizontal),A=u/24,D=r.tilePixelRatio*A,F=r.tilePixelRatio*T/24,R=r.tilePixelRatio*p,B=r.tilePixelRatio*b.get("symbol-spacing"),V=b.get("text-padding")*r.tilePixelRatio,N=(function(Me,Pe,be,Oe=1){const at=Me.get("icon-padding").evaluate(Pe,{},be),ht=at?.values;return[ht[0]*Oe,ht[1]*Oe,ht[2]*Oe,ht[3]*Oe]})(b,e,v,r.tilePixelRatio),K=b.get("text-max-angle")/180*Math.PI,Q=b.get("text-rotation-alignment")!=="viewport"&&b.get("symbol-placement")!=="point",ae=b.get("icon-rotation-alignment")==="map"&&b.get("symbol-placement")!=="point",re=b.get("symbol-placement"),de=B/2,pe=b.get("icon-text-fit");let le;s&&pe!=="none"&&(r.allowVerticalPlacement&&i.vertical&&(le=Up(s,i.vertical,pe,b.get("icon-text-fit-padding"),I,A)),M&&(s=Up(s,M,pe,b.get("icon-text-fit-padding"),I,A)));const ne=v?_.line.getGranularityForZoomLevel(v.z):1,xe=(Me,Pe)=>{Pe.x<0||Pe.x>=Be||Pe.y<0||Pe.y>=Be||(function(be,Oe,at,ht,pt,vi,zt,Xt,ii,Pt,hi,Ai,Di,Hi,xi,Xi,br,ri,Et,Gt,kt,ni,In,Fr,bc){const gs=be.addToLineVertexArray(Oe,at);let fo,qa,Wa,Ha,Jf=0,Qf=0,em=0,tm=0,Md=-1,Ed=-1;const Mn={};let im=Ft("");if(be.allowVerticalPlacement&&ht.vertical){const zi=Xt.layout.get("text-rotate").evaluate(kt,{},Fr)+90;Wa=new Uu(ii,Oe,Pt,hi,Ai,ht.vertical,Di,Hi,xi,zi),zt&&(Ha=new Uu(ii,Oe,Pt,hi,Ai,zt,br,ri,xi,zi))}if(pt){const zi=Xt.layout.get("icon-rotate").evaluate(kt,{}),fr=Xt.layout.get("icon-text-fit")!=="none",mo=qf(pt,zi,In,fr),Or=zt?qf(zt,zi,In,fr):void 0;qa=new Uu(ii,Oe,Pt,hi,Ai,pt,br,ri,!1,zi),Jf=4*mo.length;const go=be.iconSizeData;let Qr=null;go.kind==="source"?(Qr=[Sn*Xt.layout.get("icon-size").evaluate(kt,{})],Qr[0]>us&&pi(`${be.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):go.kind==="composite"&&(Qr=[Sn*ni.compositeIconSizes[0].evaluate(kt,{},Fr),Sn*ni.compositeIconSizes[1].evaluate(kt,{},Fr)],(Qr[0]>us||Qr[1]>us)&&pi(`${be.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),be.addSymbols(be.icon,mo,Qr,Gt,Et,kt,k.ax.none,Oe,gs.lineStartIndex,gs.lineLength,-1,Fr),Md=be.icon.placedSymbolArray.length-1,Or&&(Qf=4*Or.length,be.addSymbols(be.icon,Or,Qr,Gt,Et,kt,k.ax.vertical,Oe,gs.lineStartIndex,gs.lineLength,-1,Fr),Ed=be.icon.placedSymbolArray.length-1)}const rm=Object.keys(ht.horizontal);for(const zi of rm){const fr=ht.horizontal[zi];if(!fo){im=Ft(fr.text);const Or=Xt.layout.get("text-rotate").evaluate(kt,{},Fr);fo=new Uu(ii,Oe,Pt,hi,Ai,fr,Di,Hi,xi,Or)}const mo=fr.positionedLines.length===1;if(em+=Yf(be,Oe,fr,vi,Xt,xi,kt,Xi,gs,ht.vertical?k.ax.horizontal:k.ax.horizontalOnly,mo?rm:[zi],Mn,Md,ni,Fr),mo)break}ht.vertical&&(tm+=Yf(be,Oe,ht.vertical,vi,Xt,xi,kt,Xi,gs,k.ax.vertical,["vertical"],Mn,Ed,ni,Fr));const sy=fo?fo.boxStartIndex:be.collisionBoxArray.length,oy=fo?fo.boxEndIndex:be.collisionBoxArray.length,ay=Wa?Wa.boxStartIndex:be.collisionBoxArray.length,ly=Wa?Wa.boxEndIndex:be.collisionBoxArray.length,cy=qa?qa.boxStartIndex:be.collisionBoxArray.length,uy=qa?qa.boxEndIndex:be.collisionBoxArray.length,hy=Ha?Ha.boxStartIndex:be.collisionBoxArray.length,dy=Ha?Ha.boxEndIndex:be.collisionBoxArray.length;let Br=-1;const Gu=(zi,fr)=>zi?.circleDiameter?Math.max(zi.circleDiameter,fr):fr;Br=Gu(fo,Br),Br=Gu(Wa,Br),Br=Gu(qa,Br),Br=Gu(Ha,Br);const nm=Br>-1?1:0;nm&&(Br*=bc/ei),be.glyphOffsetArray.length>=La.MAX_GLYPHS&&pi("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),kt.sortKey!==void 0&&be.addToSortKeyRanges(be.symbolInstances.length,kt.sortKey);const py=Xf(Xt,kt,Fr),[fy,my]=(function(zi,fr){const mo=zi.length,Or=fr?.values;if(Or?.length>0)for(let go=0;go<Or.length;go+=2){const Qr=Or[go+1];zi.emplaceBack(k.aM[Or[go]],Qr[0],Qr[1])}return[mo,zi.length]})(be.textAnchorOffsets,py);be.symbolInstances.emplaceBack(Oe.x,Oe.y,Mn.right>=0?Mn.right:-1,Mn.center>=0?Mn.center:-1,Mn.left>=0?Mn.left:-1,Mn.vertical||-1,Md,Ed,im,sy,oy,ay,ly,cy,uy,hy,dy,Pt,em,tm,Jf,Qf,nm,0,Di,Br,fy,my)})(r,Pe,Me,i,s,o,le,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,D,[V,V,V,V],Q,g,R,N,ae,I,e,l,m,v,u)};if(re==="line")for(const Me of Of(e.geometry,0,0,Be,Be)){const Pe=uo(Me,ne),be=Q_(Pe,B,K,i.vertical||M,s,24,F,r.overscaling,Be);for(const Oe of be)M&&ny(r,M.text,de,Oe)||xe(Pe,Oe)}else if(re==="line-center"){for(const Me of e.geometry)if(Me.length>1){const Pe=uo(Me,ne),be=J_(Pe,K,i.vertical||M,s,24,F);be&&xe(Pe,be)}}else if(e.type==="Polygon")for(const Me of Zo(e.geometry,0)){const Pe=ty(Me,16);xe(uo(Me[0],ne,!0),new ms(Pe.x,Pe.y,0))}else if(e.type==="LineString")for(const Me of e.geometry){const Pe=uo(Me,ne);xe(Pe,new ms(Pe[0].x,Pe[0].y,0))}else if(e.type==="Point")for(const Me of e.geometry)for(const Pe of Me)xe([Pe],new ms(Pe.x,Pe.y,0))}function Yf(r,e,i,s,o,l,u,p,g,m,v,_,T,b,I){const M=(function(F,R,B,V,N,K,Q,ae){const re=V.layout.get("text-rotate").evaluate(K,{})*Math.PI/180,de=[];for(const pe of R.positionedLines)for(const le of pe.positionedGlyphs){if(!le.rect)continue;const ne=le.rect||{};let xe=4,Me=!0,Pe=1,be=0;const Oe=(N||ae)&&le.vertical,at=le.metrics.advance*le.scale/2;if(ae&&R.verticalizable&&(be=pe.lineOffset/2-(le.imageName?-(ei-le.metrics.width*le.scale)/2:(le.scale-1)*ei)),le.imageName){const ri=Q[le.imageName];Me=ri.sdf,Pe=ri.pixelRatio,xe=1/Pe}const ht=N?[le.x+at,le.y]:[0,0];let pt=N?[0,0]:[le.x+at+B[0],le.y+B[1]-be],vi=[0,0];Oe&&(vi=pt,pt=[0,0]);const zt=le.metrics.isDoubleResolution?2:1,Xt=(le.metrics.left-xe)*le.scale-at+pt[0],ii=(-le.metrics.top-xe)*le.scale+pt[1],Pt=Xt+ne.w/zt*le.scale/Pe,hi=ii+ne.h/zt*le.scale/Pe,Ai=new fe(Xt,ii),Di=new fe(Pt,ii),Hi=new fe(Xt,hi),xi=new fe(Pt,hi);if(Oe){const ri=new fe(-at,at- -17),Et=-Math.PI/2,Gt=12-at,kt=new fe(22-Gt,-(le.imageName?Gt:0)),ni=new fe(...vi);Ai._rotateAround(Et,ri)._add(kt)._add(ni),Di._rotateAround(Et,ri)._add(kt)._add(ni),Hi._rotateAround(Et,ri)._add(kt)._add(ni),xi._rotateAround(Et,ri)._add(kt)._add(ni)}if(re){const ri=Math.sin(re),Et=Math.cos(re),Gt=[Et,-ri,ri,Et];Ai._matMult(Gt),Di._matMult(Gt),Hi._matMult(Gt),xi._matMult(Gt)}const Xi=new fe(0,0),br=new fe(0,0);de.push({tl:Ai,tr:Di,bl:Hi,br:xi,tex:ne,writingMode:R.writingMode,glyphOffset:ht,sectionIndex:le.sectionIndex,isSDF:Me,pixelOffsetTL:Xi,pixelOffsetBR:br,minFontScaleX:0,minFontScaleY:0})}return de})(0,i,p,o,l,u,s,r.allowVerticalPlacement),A=r.textSizeData;let D=null;A.kind==="source"?(D=[Sn*o.layout.get("text-size").evaluate(u,{})],D[0]>us&&pi(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):A.kind==="composite"&&(D=[Sn*b.compositeTextSizes[0].evaluate(u,{},I),Sn*b.compositeTextSizes[1].evaluate(u,{},I)],(D[0]>us||D[1]>us)&&pi(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),r.addSymbols(r.text,M,D,p,l,u,m,e,g.lineStartIndex,g.lineLength,T,I);for(const F of v)_[F]=r.text.placedSymbolArray.length-1;return 4*M.length}function Kf(r){for(const e in r)return r[e];return null}function ny(r,e,i,s){const o=r.compareText;if(e in o){const l=o[e];for(let u=l.length-1;u>=0;u--)if(s.dist(l[u])<i)return!0}else o[e]=[];return o[e].push(s),!1}k.$=an,k.A=Zt,k.B=Ys,k.C=ss,k.D=De,k.E=kn,k.F=ns,k.G=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)}},k.H=lr,k.I=Kh,k.J=ft,k.K=hh,k.L=function(r){if(Vi==null){const e=r.navigator?r.navigator.userAgent:null;Vi=!!r.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Vi},k.M=bo,k.N=class{constructor(r,e){this.target=r,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new m_((()=>this.process())),this.subscription=vs(this.target,"message",(i=>this.receive(i)),!1),this.globalScope=oi(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 o=Math.round(1e18*Math.random()).toString(36).substring(0,10),l=e?vs(e.signal,"abort",(()=>{l?.unsubscribe(),delete this.resolveRejects[o];const g={id:o,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(g)}),g_):null;this.resolveRejects[o]={resolve:g=>{l?.unsubscribe(),i(g)},reject:g=>{l?.unsubscribe(),s(g)}};const u=[],p=Object.assign(Object.assign({},r),{id:o,sourceMapId:this.mapId,origin:location.origin,data:Cr(r.data,u)});this.target.postMessage(p,{transfer:u})}))}receive(r){const e=r.data,i=e.id,s=["file://","resource://android","null"],o=[e.origin,location.origin],l=e.origin===location.origin,u=o.some((p=>s.includes(p)));if((l||u)&&(!e.targetMapId||this.mapId===e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[i];const p=this.abortControllers[i];return delete this.abortControllers[i],void(p&&p.abort())}if(oi(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 h(this,void 0,void 0,(function*(){if(e.type==="<response>"){const o=this.resolveRejects[r];return delete this.resolveRejects[r],o?void(e.error?o.reject(Ut(os(e.error))):o.resolve(os(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=os(e.data),s=new AbortController;this.abortControllers[r]=s;try{const o=yield this.messageHandlers[e.type](e.sourceMapId,i,s);this.completeTask(r,null,o)}catch(o){this.completeTask(r,Ut(o))}}))}completeTask(r,e,i){const s=[];delete this.abortControllers[r];const o={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?Cr(e):null,data:Cr(i,s)};this.target.postMessage(o,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},k.O=function(){var r=new Zt(16);return Zt!=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},k.P=fe,k.Q=function(r,e,i){var s,o,l,u,p,g,m,v,_,T,b,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]):(o=e[1],l=e[2],u=e[3],p=e[4],g=e[5],m=e[6],v=e[7],_=e[8],T=e[9],b=e[10],I=e[11],r[0]=s=e[0],r[1]=o,r[2]=l,r[3]=u,r[4]=p,r[5]=g,r[6]=m,r[7]=v,r[8]=_,r[9]=T,r[10]=b,r[11]=I,r[12]=s*M+p*A+_*D+e[12],r[13]=o*M+g*A+T*D+e[13],r[14]=l*M+m*A+b*D+e[14],r[15]=u*M+v*A+I*D+e[15]),r},k.R=Wi,k.S=function(r,e,i){var s=i[0],o=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]*o,r[5]=e[5]*o,r[6]=e[6]*o,r[7]=e[7]*o,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},k.T=Mh,k.U=function(r,e,i){var s=e[0],o=e[1],l=e[2],u=e[3],p=e[4],g=e[5],m=e[6],v=e[7],_=e[8],T=e[9],b=e[10],I=e[11],M=e[12],A=e[13],D=e[14],F=e[15],R=i[0],B=i[1],V=i[2],N=i[3];return r[0]=R*s+B*p+V*_+N*M,r[1]=R*o+B*g+V*T+N*A,r[2]=R*l+B*m+V*b+N*D,r[3]=R*u+B*v+V*I+N*F,r[4]=(R=i[4])*s+(B=i[5])*p+(V=i[6])*_+(N=i[7])*M,r[5]=R*o+B*g+V*T+N*A,r[6]=R*l+B*m+V*b+N*D,r[7]=R*u+B*v+V*I+N*F,r[8]=(R=i[8])*s+(B=i[9])*p+(V=i[10])*_+(N=i[11])*M,r[9]=R*o+B*g+V*T+N*A,r[10]=R*l+B*m+V*b+N*D,r[11]=R*u+B*v+V*I+N*F,r[12]=(R=i[12])*s+(B=i[13])*p+(V=i[14])*_+(N=i[15])*M,r[13]=R*o+B*g+V*T+N*A,r[14]=R*l+B*m+V*b+N*D,r[15]=R*u+B*v+V*I+N*F,r},k.V=function(r,e){const i={};for(const s of e)s in r&&(i[s]=r[s]);return i},k.W=hs,k.X=An,k.Y=Kp,k.Z=Yp,k._=h,k.a=xo,k.a$=function(r){var e=new Zt(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e},k.a0=Tr,k.a1=_o,k.a2=Ka,k.a3=nr,k.a4=Qp,k.a5=Fu,k.a6=Be,k.a7=_c,k.a8=ho,k.a9=25,k.aA=function(r){var e=r[0],i=r[1];return Math.sqrt(e*e+i*i)},k.aB=function(r){return r[0]=0,r[1]=0,r},k.aC=function(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r},k.aD=ed,k.aE=Ke,k.aF=function(r,e,i,s){const o=e.y-r.y,l=e.x-r.x,u=s.y-i.y,p=s.x-i.x,g=u*l-p*o;if(g===0)return null;const m=(p*(r.y-i.y)-u*(r.x-i.x))/g;return new fe(r.x+m*l,r.y+m*o)},k.aG=Of,k.aH=Jr,k.aI=function(r){let e=1/0,i=1/0,s=-1/0,o=-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),o=Math.max(o,l.y);return[e,i,s,o]},k.aJ=ei,k.aK=Vt,k.aL=function(r,e,i,s,o=!1){if(!i[0]&&!i[1])return[0,0];const l=o?s==="map"?-r.bearingInRadians:0:s==="viewport"?r.bearingInRadians:0;if(l){const u=Math.sin(l),p=Math.cos(l);i=[i[0]*p-i[1]*u,i[0]*u+i[1]*p]}return[o?i[0]:Vt(e,i[0],r.zoom),o?i[1]:Vt(e,i[1],r.zoom)]},k.aN=Qh,k.aO=Id,k.aP=Jh,k.aQ=r=>r.type==="symbol",k.aR=Iu,k.aS=At,k.aT=Pu,k.aU=S,k.aV=oe,k.aW=X,k.aX=on,k.aY=ef,k.aZ=J,k.a_=H,k.aa=sd,k.ab=r=>{const e=window.document.createElement("video");return e.muted=!0,new Promise((i=>{e.onloadstart=()=>{i(e)};for(const s of r){const o=window.document.createElement("source");zn(s)||(e.crossOrigin="Anonymous"),o.src=s,e.appendChild(o)}}))},k.ac=Se,k.ad=function(){return rn++},k.ae=tc,k.af=La,k.ag=xc,k.ah=Us,k.ai=kr,k.aj=sf,k.ak=function(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((i,s,o,l)=>{const u=o||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},k.al=Kt,k.am=85.051129,k.an=Ja,k.ao=function(r){return Math.pow(2,r)},k.ap=en,k.aq=Jp,k.ar=function(r){return Math.log(r)/Math.LN2},k.as=function(r){var e=r[0],i=r[1];return e*e+i*i},k.at=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,o=1/0,l=-1/0;const u=[];for(const g of r){const{x:m,y:v,z:_}=g.canonical,T=Math.pow(2,e-_),b=m*T,I=v*T;u.push({id:g,x:b,y:I}),b<i&&(i=b),b>s&&(s=b),I<o&&(o=I),I>l&&(l=I)}const p=new Set;for(const g of u)g.x!==i&&g.x!==s&&g.y!==o&&g.y!==l||p.add(g.id);return p},k.au=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},k.av=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 o={value:e,timeout:void 0};if(i!==void 0&&(o.timeout=setTimeout((()=>{this.remove(r,o)}),i)),this.data[s].push(o),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),o=this.data[i][s];return this.data[i].splice(s,1),o.timeout&&clearTimeout(o.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(o.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)}},k.aw=function(r,e){let i=0,s=0;if(r.kind==="constant")s=r.layoutSize;else if(r.kind!=="source"){const{interpolationType:o,minZoom:l,maxZoom:u}=r,p=o?Kt(Ii.interpolationFactor(o,e,l,u),0,1):0;r.kind==="camera"?s=lr.number(r.minSize,r.maxSize,p):i=p}return{uSizeT:i,uSize:s}},k.ay=function(r,{uSize:e,uSizeT:i},{lowerSize:s,upperSize:o}){return r.kind==="source"?s/Sn:r.kind==="composite"?lr.number(s/Sn,o/Sn,i):e},k.az=Ge,k.b=xt,k.b$=Kr,k.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},k.b1=function(r,e){var i=e[0],s=e[1],o=e[2],l=i*i+s*s+o*o;return l>0&&(l=1/Math.sqrt(l)),r[0]=e[0]*l,r[1]=e[1]*l,r[2]=e[2]*l,r},k.b2=ie,k.b3=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]},k.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},k.b5=we,k.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},k.b7=Le,k.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},k.b9=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]},k.bA=Je,k.bB=function(r,e,i){var s=i[0],o=i[1],l=i[2],u=i[3],p=e[0],g=e[1],m=e[2],v=o*m-l*g,_=l*p-s*m,T=s*g-o*p;return r[0]=p+u*(v+=v)+o*(T+=T)-l*(_+=_),r[1]=g+u*_+l*v-s*T,r[2]=m+u*T+s*_-o*v,r},k.bC=function(r,e,i){const s=(o=[r[0],r[1],r[2],e[0],e[1],e[2],i[0],i[1],i[2]])[0]*((v=o[8])*(u=o[4])-(p=o[5])*(m=o[7]))+o[1]*(-v*(l=o[3])+p*(g=o[6]))+o[2]*(m*l-u*g);var o,l,u,p,g,m,v;if(s===0)return null;const _=ie([],[e[0],e[1],e[2]],[i[0],i[1],i[2]]),T=ie([],[i[0],i[1],i[2]],[r[0],r[1],r[2]]),b=ie([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),I=J([],_,-r[3]);return H(I,I,J([],T,-e[3])),H(I,I,J([],b,-i[3])),J(I,I,1/s),I},k.bD=nd,k.bE=function(){return new Float64Array(4)},k.bF=function(r,e,i,s){var o=[],l=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],l[0]=o[0]*Math.cos(s)-o[1]*Math.sin(s),l[1]=o[0]*Math.sin(s)+o[1]*Math.cos(s),l[2]=o[2],r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},k.bG=function(r,e,i,s){var o=[],l=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],l[0]=o[0],l[1]=o[1]*Math.cos(s)-o[2]*Math.sin(s),l[2]=o[1]*Math.sin(s)+o[2]*Math.cos(s),r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},k.bH=function(r,e,i,s){var o=[],l=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],l[0]=o[2]*Math.sin(s)+o[0]*Math.cos(s),l[1]=o[1],l[2]=o[2]*Math.cos(s)-o[0]*Math.sin(s),r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},k.bI=function(r,e,i){var s=Math.sin(i),o=Math.cos(i),l=e[0],u=e[1],p=e[2],g=e[3],m=e[8],v=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*o-m*s,r[1]=u*o-v*s,r[2]=p*o-_*s,r[3]=g*o-T*s,r[8]=l*s+m*o,r[9]=u*s+v*o,r[10]=p*s+_*o,r[11]=g*s+T*o,r},k.bJ=function(r,e){const i=ar(r,360),s=ar(e,360),o=s-i,l=s>i?o-360:o+360;return Math.abs(o)<Math.abs(l)?o:l},k.bK=function(r){return r[0]=0,r[1]=0,r[2]=0,r},k.bL=function(r,e,i,s){const o=Math.sqrt(r*r+e*e),l=Math.sqrt(i*i+s*s);r/=o,e/=o,i/=l,s/=l;const u=Math.acos(r*i+e*s);return-e*i+r*s>0?u:-u},k.bM=function(r,e){const i=ar(r,2*Math.PI),s=ar(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))},k.bN=function(){const r={},e=ce.$version;for(const i in ce.$root){const s=ce.$root[i];if(s.required){let o=null;o=i==="version"?e:s.type==="array"?[]:{},o!=null&&(r[i]=o)}}return r},k.bO=il,k.bP=qs,k.bQ=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},k.bR=el,k.bS=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]=Ss(r[i],e[r[i].ref]));return r},k.bT=function(r,e){if(r.type==="custom")return new f_(r,e);switch(r.type){case"background":return new p_(r,e);case"circle":return new Dm(r,e);case"color-relief":return new Bm(r,e);case"fill":return new Jm(r,e);case"fill-extrusion":return new ug(r,e);case"heatmap":return new km(r,e);case"hillshade":return new Lm(r,e);case"line":return new Fg(r,e);case"raster":return new xh(r,e);case"symbol":return new Lu(r,e)}},k.bU=r=>r.type==="raster",k.bV=tt,k.bW=function(r,e){if(!r)return[{command:"setStyle",args:[e]}];let i=[];try{if(!ct(r.version,e.version))return[{command:"setStyle",args:[e]}];ct(r.center,e.center)||i.push({command:"setCenter",args:[e.center]}),ct(r.state,e.state)||i.push({command:"setGlobalState",args:[e.state]}),ct(r.centerAltitude,e.centerAltitude)||i.push({command:"setCenterAltitude",args:[e.centerAltitude]}),ct(r.zoom,e.zoom)||i.push({command:"setZoom",args:[e.zoom]}),ct(r.bearing,e.bearing)||i.push({command:"setBearing",args:[e.bearing]}),ct(r.pitch,e.pitch)||i.push({command:"setPitch",args:[e.pitch]}),ct(r.roll,e.roll)||i.push({command:"setRoll",args:[e.roll]}),ct(r.sprite,e.sprite)||i.push({command:"setSprite",args:[e.sprite]}),ct(r.glyphs,e.glyphs)||i.push({command:"setGlyphs",args:[e.glyphs]}),ct(r.transition,e.transition)||i.push({command:"setTransition",args:[e.transition]}),ct(r.light,e.light)||i.push({command:"setLight",args:[e.light]}),ct(r.terrain,e.terrain)||i.push({command:"setTerrain",args:[e.terrain]}),ct(r.sky,e.sky)||i.push({command:"setSky",args:[e.sky]}),ct(r.projection,e.projection)||i.push({command:"setProjection",args:[e.projection]});const s={},o=[];(function(u,p,g,m){let v;for(v in p=p||{},u=u||{})Object.prototype.hasOwnProperty.call(u,v)&&(Object.prototype.hasOwnProperty.call(p,v)||Tc(v,g,m));for(v in p)Object.prototype.hasOwnProperty.call(p,v)&&(Object.prototype.hasOwnProperty.call(u,v)?ct(u[v],p[v])||(u[v].type==="geojson"&&p[v].type==="geojson"&&rl(u,p,v)?ji(g,{command:"setGeoJSONSourceData",args:[v,p[v].data]}):Sc(v,p,g,m)):To(v,p,g))})(r.sources,e.sources,o,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(o),(function(u,p,g){p=p||[];const m=(u=u||[]).map(Po),v=p.map(Po),_=u.reduce(cn,{}),T=p.reduce(cn,{}),b=m.slice(),I=Object.create(null);let M,A,D,F,R;for(let B=0,V=0;B<m.length;B++)M=m[B],Object.prototype.hasOwnProperty.call(T,M)?V++:(ji(g,{command:"removeLayer",args:[M]}),b.splice(b.indexOf(M,V),1));for(let B=0,V=0;B<v.length;B++)M=v[v.length-1-B],b[b.length-1-B]!==M&&(Object.prototype.hasOwnProperty.call(_,M)?(ji(g,{command:"removeLayer",args:[M]}),b.splice(b.lastIndexOf(M,b.length-V),1)):V++,F=b[b.length-B],ji(g,{command:"addLayer",args:[T[M],F]}),b.splice(b.length-B,0,M),I[M]=!0);for(let B=0;B<v.length;B++)if(M=v[B],A=_[M],D=T[M],!I[M]&&!ct(A,D))if(ct(A.source,D.source)&&ct(A["source-layer"],D["source-layer"])&&ct(A.type,D.type)){for(R in So(A.layout,D.layout,g,M,null,"setLayoutProperty"),So(A.paint,D.paint,g,M,null,"setPaintProperty"),ct(A.filter,D.filter)||ji(g,{command:"setFilter",args:[M,D.filter]}),ct(A.minzoom,D.minzoom)&&ct(A.maxzoom,D.maxzoom)||ji(g,{command:"setLayerZoomRange",args:[M,D.minzoom,D.maxzoom]}),A)Object.prototype.hasOwnProperty.call(A,R)&&R!=="layout"&&R!=="paint"&&R!=="filter"&&R!=="metadata"&&R!=="minzoom"&&R!=="maxzoom"&&(R.indexOf("paint.")===0?So(A[R],D[R],g,M,R.slice(6),"setPaintProperty"):ct(A[R],D[R])||ji(g,{command:"setLayerProperty",args:[M,R,D[R]]}));for(R in D)Object.prototype.hasOwnProperty.call(D,R)&&!Object.prototype.hasOwnProperty.call(A,R)&&R!=="layout"&&R!=="paint"&&R!=="filter"&&R!=="metadata"&&R!=="minzoom"&&R!=="maxzoom"&&(R.indexOf("paint.")===0?So(A[R],D[R],g,M,R.slice(6),"setPaintProperty"):ct(A[R],D[R])||ji(g,{command:"setLayerProperty",args:[M,R,D[R]]}))}else ji(g,{command:"removeLayer",args:[M]}),F=b[b.lastIndexOf(M)+1],ji(g,{command:"addLayer",args:[D,F]})})(l,e.layers,i)}catch(s){console.warn("Unable to compute style diff:",s),i=[{command:"setStyle",args:[e]}]}return i},k.bX=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},k.bY=Sr,k.bZ=nn,k.b_=class extends wt{constructor(r,e){super(r,e),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},k.ba=rf,k.bb=Fa,k.bc=function(r,e,i,s,o){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,o!=null&&o!==1/0){var u=1/(s-o);r[10]=(o+s)*u,r[14]=2*o*s*u}else r[10]=-1,r[14]=-2*s;return r},k.bd=function(r){var e=new Zt(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},k.be=function(r,e,i){var s=Math.sin(i),o=Math.cos(i),l=e[0],u=e[1],p=e[2],g=e[3],m=e[4],v=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*o+m*s,r[1]=u*o+v*s,r[2]=p*o+_*s,r[3]=g*o+T*s,r[4]=m*o-l*s,r[5]=v*o-u*s,r[6]=_*o-p*s,r[7]=T*o-g*s,r},k.bf=function(r,e,i){var s=Math.sin(i),o=Math.cos(i),l=e[4],u=e[5],p=e[6],g=e[7],m=e[8],v=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*o+m*s,r[5]=u*o+v*s,r[6]=p*o+_*s,r[7]=g*o+T*s,r[8]=m*o-l*s,r[9]=v*o-u*s,r[10]=_*o-p*s,r[11]=T*o-g*s,r},k.bg=function(r,e){var i=e[0],s=e[1],o=e[2],l=e[3],u=e[4],p=e[5],g=e[6],m=e[7],v=e[8],_=e[9],T=e[10],b=e[11],I=e[12],M=e[13],A=e[14],D=e[15],F=i*p-s*u,R=i*g-o*u,B=i*m-l*u,V=s*g-o*p,N=s*m-l*p,K=o*m-l*g,Q=v*M-_*I,ae=v*A-T*I,re=v*D-b*I,de=_*A-T*M,pe=_*D-b*M,le=T*D-b*A,ne=F*le-R*pe+B*de+V*re-N*ae+K*Q;return ne?(r[0]=(p*le-g*pe+m*de)*(ne=1/ne),r[1]=(o*pe-s*le-l*de)*ne,r[2]=(M*K-A*N+D*V)*ne,r[3]=(T*N-_*K-b*V)*ne,r[4]=(g*re-u*le-m*ae)*ne,r[5]=(i*le-o*re+l*ae)*ne,r[6]=(A*B-I*K-D*R)*ne,r[7]=(v*K-T*B+b*R)*ne,r[8]=(u*pe-p*re+m*Q)*ne,r[9]=(s*re-i*pe-l*Q)*ne,r[10]=(I*N-M*B+D*F)*ne,r[11]=(_*B-v*N-b*F)*ne,r[12]=(p*ae-u*de-g*Q)*ne,r[13]=(i*de-s*ae+o*Q)*ne,r[14]=(M*R-I*V-A*F)*ne,r[15]=(v*V-_*R+T*F)*ne,r):null},k.bh=function(){const r=new Float32Array(16);return en(r),r},k.bi=function(){const r=new Float64Array(16);return en(r),r},k.bj=function(){return new Float64Array(16)},k.bk=function(r,e,i){const s=new Float64Array(4);return Je(s,r,e-90,i),s},k.bl=function(r,e,i,s){var o,l,u,p,g,m=e[0],v=e[1],_=e[2],T=e[3],b=i[0],I=i[1],M=i[2],A=i[3];return(l=m*b+v*I+_*M+T*A)<0&&(l=-l,b=-b,I=-I,M=-M,A=-A),1-l>$t?(o=Math.acos(l),u=Math.sin(o),p=Math.sin((1-s)*o)/u,g=Math.sin(s*o)/u):(p=1-s,g=s),r[0]=p*m+g*b,r[1]=p*v+g*I,r[2]=p*_+g*M,r[3]=p*T+g*A,r},k.bm=function(r){const e=new Float64Array(9);var i,s,o,l,u,p,g,m,v,_,T,b,I,M,A,D,F,R;_=(o=(s=r)[0])*(g=o+o),T=(l=s[1])*g,I=(u=s[2])*g,M=u*(m=l+l),D=(p=s[3])*g,F=p*m,R=p*(v=u+u),(i=e)[0]=1-(b=l*m)-(A=u*v),i[3]=T-R,i[6]=I+F,i[1]=T+R,i[4]=1-_-A,i[7]=M-D,i[2]=I-F,i[5]=M+D,i[8]=1-_-b;const B=on(-Math.asin(Kt(e[2],-1,1)));let V,N;return Math.hypot(e[5],e[8])<.001?(V=0,N=-on(Math.atan2(e[3],e[4]))):(V=on(e[5]===0&&e[8]===0?0:Math.atan2(e[5],e[8])),N=on(e[1]===0&&e[0]===0?0:Math.atan2(e[1],e[0]))),{roll:V,pitch:B+90,bearing:N}},k.bn=function(r,e){return r.roll==e.roll&&r.pitch==e.pitch&&r.bearing==e.bearing},k.bo=et,k.bp=Ht,k.bq=Ca,k.br=cc,k.bs=Ea,k.bt=Vr,k.bu=_s,k.bv=Rt,k.bw=function(r,e,i,s,o){return Vr(s,o,Kt((r-e)/(i-e),0,1))},k.bx=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},k.by=ar,k.bz=function(){return new Float64Array(3)},k.c=bs,k.c$=js,k.c0=class extends wt{constructor(r,e){super(r,e),this.current=ls}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}}},k.c1=Li,k.c2=class extends wt{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]))}},k.c3=class extends wt{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]))}},k.c4=yo,k.c5=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},k.c6=function(r,e,i){var s=e[0],o=e[1],l=e[2];return r[0]=s*i[0]+o*i[3]+l*i[6],r[1]=s*i[1]+o*i[4]+l*i[7],r[2]=s*i[2]+o*i[5]+l*i[8],r},k.c7=function(r,e,i,s,o,l,u){var p=1/(e-i),g=1/(s-o),m=1/(l-u);return r[0]=-2*p,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)*p,r[13]=(o+s)*g,r[14]=(u+l)*m,r[15]=1,r},k.c8=class extends wt{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)}}},k.c9=class extends wt{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)}}},k.cA=function(r,e){return Qa[e]&&"touches"in r},k.cB=function(r){return Qa[r]||xs[r]},k.cC=function(r,e,i){var s=e[0],o=e[1];return r[0]=i[0]*s+i[4]*o+i[12],r[1]=i[1]*s+i[5]*o+i[13],r},k.cD=function(r,e){const{x:i,y:s}=_c.fromLngLat(e);return!(r<0||r>25||s<0||s>=1||i<0||i>=1)},k.cE=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},k.cF=class extends va{},k.cG=ln,k.cH=function(r,e){bs.REGISTERED_PROTOCOLS[r]=e},k.cI=function(r){delete bs.REGISTERED_PROTOCOLS[r]},k.cJ=function(r,e){const i={};for(let o=0;o<r.length;o++){const l=e&&e[r[o].id]||Kc(r[o]);e&&(e[r[o].id]=l);let u=i[l];u||(u=i[l]=[]),u.push(r[o])}const s=[];for(const o in i)s.push(i[o]);return s},k.cK=Ae,k.cL=nf,k.cM=Ff,k.cN=Vp,k.cO=function(r){var e,i;r.bucket.createArrays(),r.bucket.tilePixelRatio=Be/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const s=r.bucket.layers[0],o=s.layout,l=s._unevaluatedLayout._values,u={layoutIconSize:l["icon-size"].possiblyEvaluate(new ft(r.bucket.zoom+1),r.canonical),layoutTextSize:l["text-size"].possiblyEvaluate(new ft(r.bucket.zoom+1),r.canonical),textMaxSize:l["text-size"].possiblyEvaluate(new ft(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:_,maxZoom:T}=r.bucket.textSizeData;u.compositeTextSizes=[l["text-size"].possiblyEvaluate(new ft(_),r.canonical),l["text-size"].possiblyEvaluate(new ft(T),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:_,maxZoom:T}=r.bucket.iconSizeData;u.compositeIconSizes=[l["icon-size"].possiblyEvaluate(new ft(_),r.canonical),l["icon-size"].possiblyEvaluate(new ft(T),r.canonical)]}const p=o.get("text-line-height")*ei,g=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point",m=o.get("text-keep-upright"),v=o.get("text-size");for(const _ of r.bucket.features){const T=o.get("text-font").evaluate(_,{},r.canonical).join(","),b=v.evaluate(_,{},r.canonical),I=u.layoutTextSize.evaluate(_,{},r.canonical),M=u.layoutIconSize.evaluate(_,{},r.canonical),A={horizontal:{},vertical:void 0},D=_.text;let F,R=[0,0];if(D){const N=D.toString(),K=o.get("text-letter-spacing").evaluate(_,{},r.canonical)*ei,Q=mh(N)?K:0,ae=o.get("text-anchor").evaluate(_,{},r.canonical),re=Xf(s,_,r.canonical);if(!re){const ne=o.get("text-radial-offset").evaluate(_,{},r.canonical);R=ne?Hf(ae,[ne*ei,Pd]):o.get("text-offset").evaluate(_,{},r.canonical).map((xe=>xe*ei))}let de=g?"center":o.get("text-justify").evaluate(_,{},r.canonical);const pe=o.get("symbol-placement")==="point"?o.get("text-max-width").evaluate(_,{},r.canonical)*ei:1/0,le=()=>{r.bucket.allowVerticalPlacement&&gn(N)&&(A.vertical=ku(D,r.glyphMap,r.glyphPositions,r.imagePositions,T,pe,p,ae,"left",Q,R,k.ax.vertical,!0,I,b))};if(!g&&re){const ne=new Set;if(de==="auto")for(let Me=0;Me<re.values.length;Me+=2)ne.add(Id(re.values[Me]));else ne.add(de);let xe=!1;for(const Me of ne)if(!A.horizontal[Me])if(xe)A.horizontal[Me]=A.horizontal[0];else{const Pe=ku(D,r.glyphMap,r.glyphPositions,r.imagePositions,T,pe,p,"center",Me,Q,R,k.ax.horizontal,!1,I,b);Pe&&(A.horizontal[Me]=Pe,xe=Pe.positionedLines.length===1)}le()}else{de==="auto"&&(de=Id(ae));const ne=ku(D,r.glyphMap,r.glyphPositions,r.imagePositions,T,pe,p,ae,de,Q,R,k.ax.horizontal,!1,I,b);ne&&(A.horizontal[de]=ne),le(),gn(N)&&g&&m&&(A.vertical=ku(D,r.glyphMap,r.glyphPositions,r.imagePositions,T,pe,p,ae,de,Q,R,k.ax.vertical,!1,I,b))}}let B=!1;if(!((e=_.icon)===null||e===void 0)&&e.name){const N=r.imageMap[_.icon.name];N&&(F=c_(r.imagePositions[_.icon.name],o.get("icon-offset").evaluate(_,{},r.canonical),o.get("icon-anchor").evaluate(_,{},r.canonical)),B=!!N.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=B:r.bucket.sdfIcons!==B&&pi("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(N.pixelRatio!==r.bucket.pixelRatio||o.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}const V=Kf(A.horizontal)||A.vertical;(i=r.bucket).iconsInText||(i.iconsInText=!!V&&V.iconsInText),(V||F)&&ry(r.bucket,_,A,F,r.imageMap,u,I,M,R,B,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},k.cP=Dh,k.cQ=kh,k.cR=Xh,k.cS=function(r,e=""){const i=new zu;return(function(s,o,l=""){for(const u in s.layers)o.writeMessage(3,((p,g)=>G_(p,g,l)),s.layers[u])})(r,i,e),i.finish()},k.cT=function(r,e,i,s,o,l){let u=Vf(r,e,i,o,0);return u=Vf(u,e,s,l,1),u},k.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()}},k.cV=lp,k.cW=zu,k.cX=Rf,k.cY=function(r,e,i,s,o){return h(this,void 0,void 0,(function*(){if(_o())try{return yield Ka(r,e,i,s,o)}catch{}return(function(l,u,p,g,m){const v=l.width,_=l.height;sn&&Dn||(sn=new OffscreenCanvas(v,_),Dn=sn.getContext("2d",{willReadFrequently:!0})),sn.width=v,sn.height=_,Dn.drawImage(l,0,0,v,_);const T=Dn.getImageData(u,p,g,m);return Dn.clearRect(0,0,v,_),T.data})(r,e,i,s,o)}))},k.cZ=Yd,k.c_=class{constructor(r,e){this.layers={[xc]:this},this.name=xc,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=r.length,this.features=r}feature(r){return new U_(this.features[r],this.extent)}},k.ca=class extends wa{},k.cb=jg,k.cc=class extends no{},k.cd=Ih,k.ce=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},k.cf=qd,k.cg=function(r,e,i){var s=e[0],o=e[1],l=e[2],u=i[3]*s+i[7]*o+i[11]*l+i[15];return r[0]=(i[0]*s+i[4]*o+i[8]*l+i[12])/(u=u||1),r[1]=(i[1]*s+i[5]*o+i[9]*l+i[13])/u,r[2]=(i[2]*s+i[6]*o+i[10]*l+i[14])/u,r},k.ch=class extends ql{},k.ci=class extends vn{},k.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]},k.ck=function(r,e){var i=r[0],s=r[1],o=r[2],l=r[3],u=r[4],p=r[5],g=r[6],m=r[7],v=r[8],_=r[9],T=r[10],b=r[11],I=r[12],M=r[13],A=r[14],D=r[15],F=e[0],R=e[1],B=e[2],V=e[3],N=e[4],K=e[5],Q=e[6],ae=e[7],re=e[8],de=e[9],pe=e[10],le=e[11],ne=e[12],xe=e[13],Me=e[14],Pe=e[15];return Math.abs(i-F)<=$t*Math.max(1,Math.abs(i),Math.abs(F))&&Math.abs(s-R)<=$t*Math.max(1,Math.abs(s),Math.abs(R))&&Math.abs(o-B)<=$t*Math.max(1,Math.abs(o),Math.abs(B))&&Math.abs(l-V)<=$t*Math.max(1,Math.abs(l),Math.abs(V))&&Math.abs(u-N)<=$t*Math.max(1,Math.abs(u),Math.abs(N))&&Math.abs(p-K)<=$t*Math.max(1,Math.abs(p),Math.abs(K))&&Math.abs(g-Q)<=$t*Math.max(1,Math.abs(g),Math.abs(Q))&&Math.abs(m-ae)<=$t*Math.max(1,Math.abs(m),Math.abs(ae))&&Math.abs(v-re)<=$t*Math.max(1,Math.abs(v),Math.abs(re))&&Math.abs(_-de)<=$t*Math.max(1,Math.abs(_),Math.abs(de))&&Math.abs(T-pe)<=$t*Math.max(1,Math.abs(T),Math.abs(pe))&&Math.abs(b-le)<=$t*Math.max(1,Math.abs(b),Math.abs(le))&&Math.abs(I-ne)<=$t*Math.max(1,Math.abs(I),Math.abs(ne))&&Math.abs(M-xe)<=$t*Math.max(1,Math.abs(M),Math.abs(xe))&&Math.abs(A-Me)<=$t*Math.max(1,Math.abs(A),Math.abs(Me))&&Math.abs(D-Pe)<=$t*Math.max(1,Math.abs(D),Math.abs(Pe))},k.cl=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},k.cm=r=>r.type==="circle",k.cn=r=>r.type==="heatmap",k.co=r=>r.type==="line",k.cp=r=>r.type==="fill",k.cq=r=>r.type==="fill-extrusion",k.cr=r=>r.type==="hillshade",k.cs=r=>r.type==="color-relief",k.ct=r=>r.type==="background",k.cu=r=>r.type==="custom",k.cv=ys,k.cw=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},k.cx=function(r,e,i){const s=lt(e.x-i.x,e.y-i.y),o=lt(r.x-i.x,r.y-i.y);var l,u;return on(Math.atan2(s[0]*o[1]-s[1]*o[0],(l=s)[0]*(u=o)[0]+l[1]*u[1]))},k.cy=Cn,k.cz=function(r,e){var i;if(!xs[e])return!1;const s=r?.target,o=((i=s?.ownerDocument)===null||i===void 0?void 0:i.defaultView)||window;return r instanceof o.MouseEvent||r instanceof o.WheelEvent},k.d=Ut,k.d0=class{constructor(r,e){const i=(e=this.options=Object.assign({},Cg,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=Oh(r,e);i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles")),s=Uh(s,e),e.updateable&&(this.source=s),this.initializeIndex(s,e)}initializeIndex(r,e){this.tileIndex=e.cluster?new wg(e.clusterOptions):new Eg(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:o}=(function(l,u,p){const g=(function(v,_){return v?{removeAll:v.removeAll,remove:new Set(v.remove||[]),add:new Map(v.add?.map((T=>[_.promoteId?T.properties[_.promoteId]:T.id,T]))),update:new Map(v.update?.map((T=>[T.id,T])))}:{remove:new Set,add:new Map,update:new Map}})(u,p);let m=[];if(g.removeAll&&(m=l,l=[]),g.remove.size||g.add.size){const v=[];for(const _ of l)(g.remove.has(_.id)||g.add.has(_.id))&&v.push(_);if(v.length){m.push(...v);const _=new Set(v.map((T=>T.id)));l=l.filter((T=>!_.has(T.id)))}if(g.add.size){let _=Oh({type:"FeatureCollection",features:Array.from(g.add.values())},p);_=Uh(_,p),m.push(..._),l.push(..._)}}if(g.update.size){const v=new Map,_=[];for(const T of l)g.update.has(T.id)?v.set(T.id,[...v.get(T.id)||[],T]):_.push(T);for(const[T,b]of g.update){const I=v.get(T);if(!I||I.length===0)continue;const M=bg(I,b,p);m.push(...I,...M),_.push(...M)}l=_}return{affected:m,source:l}})(this.source,r,i);e&&({affected:s,source:o}=this.filterUpdate(o,s,e)),s.length&&(this.source=o,this.tileIndex.updateIndex(o,s,i))}filterUpdate(r,e,i){const s=new Set;for(const o of r)o.id!=null&&(i(Eu(o))||(e.push(o),s.add(o.id)));return{affected:e,source:r=r.filter((o=>!s.has(o.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=>Eu(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)}},k.d1=dr,k.e=di,k.f=zn,k.g=tl,k.h=r=>h(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 ${Ut(i).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),k.i=oi,k.j=r=>new Promise(((e,i)=>{const s=new Image;s.onload=()=>{e(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame((()=>s.src=Ya))},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 o=new Blob([new Uint8Array(r)],{type:"image/png"});s.src=r.byteLength?URL.createObjectURL(o):Ya})),k.k=(r,e)=>ws(di(r,{type:"json"}),e),k.l=Ts,k.m=ws,k.n=wo,k.o=(r,e)=>ws(di(r,{type:"arrayBuffer"}),e),k.p=Op,k.q=function(r){return new zu(r).readFields(t_,[])},k.r=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))},k.s=vs,k.t=nc,k.u=mi,k.v=ch,k.w=pi,k.x=ce,k.y=Ul,k.z=uh})),ve("worker",["./shared"],(function(k){class h{constructor(H,J){this.keyCache={},H&&this.replace(H,J)}replace(H,J){this._layerConfigs={},this._layers={},this.update(H,[],J)}update(H,J,ie){for(const Le of H){this._layerConfigs[Le.id]=Le;const Ke=this._layers[Le.id]=k.bT(Le,ie);Ke._featureFilter=k.ah(Ke.filter,ie),this.keyCache[Le.id]&&delete this.keyCache[Le.id]}for(const Le of J)delete this.keyCache[Le],delete this._layerConfigs[Le],delete this._layers[Le];this.familiesBySource={};const Te=k.cJ(Object.values(this._layerConfigs),this.keyCache);for(const Le of Te){const Ke=Le.map((Vt=>this._layers[Vt.id])),Ve=Ke[0];if(Ve.isHidden())continue;const Je=Ve.source||"";let Ge=this.familiesBySource[Je];Ge||(Ge=this.familiesBySource[Je]={});const lt=Ve.sourceLayer||k.ag;let Be=Ge[lt];Be||(Be=Ge[lt]=[]),Be.push(Ke)}}}class fe{constructor(H){const J={},ie=[];for(const Ve in H){const Je=H[Ve],Ge=J[Ve]={};for(const lt in Je){const Be=Je[+lt];if(!Be||Be.bitmap.width===0||Be.bitmap.height===0)continue;const Vt={x:0,y:0,w:Be.bitmap.width+2,h:Be.bitmap.height+2};ie.push(Vt),Ge[lt]={rect:Vt,metrics:Be.metrics}}}const{w:Te,h:Le}=k.p(ie),Ke=new k.t({width:Te||1,height:Le||1});for(const Ve in H){const Je=H[Ve];for(const Ge in Je){const lt=Je[+Ge];if(!lt||lt.bitmap.width===0||lt.bitmap.height===0)continue;const Be=J[Ve][Ge].rect;k.t.copy(lt.bitmap,Ke,{x:0,y:0},{x:Be.x+1,y:Be.y+1},lt.bitmap)}}this.image=Ke,this.positions=J}}k.cK("GlyphAtlas",fe);class $e{constructor(H){this.tileID=new k.a3(H.tileID.overscaledZ,H.tileID.wrap,H.tileID.canonical.z,H.tileID.canonical.x,H.tileID.canonical.y),this.uid=H.uid,this.zoom=H.zoom,this.pixelRatio=H.pixelRatio,this.tileSize=H.tileSize,this.source=H.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=H.showCollisionBoxes,this.collectResourceTiming=!!H.collectResourceTiming,this.returnDependencies=!!H.returnDependencies,this.promoteId=H.promoteId,this.inFlightDependencies=[]}parse(H,J,ie,Te,Le){return k._(this,void 0,void 0,(function*(){this.status="parsing",this.data=H,this.collisionBoxArray=new k.ae;const Ke=new k.cL(Object.keys(H.layers).sort()),Ve=new k.cM(this.tileID,this.promoteId);Ve.bucketLayerIDs=[];const Je={},Ge={featureIndex:Ve,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:ie,subdivisionGranularity:Le},lt=J.familiesBySource[this.source];for(const tt in lt){const si=H.layers[tt];if(!si)continue;si.version===1&&k.w(`Vector tile source "${this.source}" layer "${tt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const pi=Ke.encode(tt),Yi=[];for(let oi=0;oi<si.length;oi++){const Vi=si.feature(oi),xt=Ve.getId(Vi,tt);Yi.push({feature:Vi,id:xt,index:oi,sourceLayerIndex:pi})}for(const oi of lt[tt]){const Vi=oi[0];Vi.source!==this.source&&k.w(`layer.source = ${Vi.source} does not equal this.source = ${this.source}`),Vi.isHidden(this.zoom,!0)||(He(oi,this.zoom,ie),(Je[Vi.id]=Vi.createBucket({index:Ve.bucketLayerIDs.length,layers:oi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:pi,sourceID:this.source})).populate(Yi,Ge,this.tileID.canonical),Ve.bucketLayerIDs.push(oi.map((xt=>xt.id))))}}const Be=k.bY(Ge.glyphDependencies,(tt=>Object.keys(tt).map(Number)));for(const tt of this.inFlightDependencies)tt?.abort();this.inFlightDependencies=[];let Vt=Promise.resolve({});if(Object.keys(Be).length){const tt=new AbortController;this.inFlightDependencies.push(tt),Vt=Te.sendAsync({type:"GG",data:{stacks:Be,source:this.source,tileID:this.tileID,type:"glyphs"}},tt)}const Ut=Object.keys(Ge.iconDependencies);let ar=Promise.resolve({});if(Ut.length){const tt=new AbortController;this.inFlightDependencies.push(tt),ar=Te.sendAsync({type:"GI",data:{icons:Ut,source:this.source,tileID:this.tileID,type:"icons"}},tt)}const Vr=Object.keys(Ge.patternDependencies);let _s=Promise.resolve({});if(Vr.length){const tt=new AbortController;this.inFlightDependencies.push(tt),_s=Te.sendAsync({type:"GI",data:{icons:Vr,source:this.source,tileID:this.tileID,type:"patterns"}},tt)}const ys=Ge.dashDependencies;let Cn=Promise.resolve({});if(Object.keys(ys).length){const tt=new AbortController;this.inFlightDependencies.push(tt),Cn=Te.sendAsync({type:"GDA",data:{dashes:ys}},tt)}const[Kt,An,di,rn]=yield Promise.all([Vt,ar,_s,Cn]),Sr=new fe(Kt),nn=new k.cN(An,di);for(const tt in Je){const si=Je[tt];si instanceof k.af?(He(si.layers,this.zoom,ie),k.cO({bucket:si,glyphMap:Kt,glyphPositions:Sr.positions,imageMap:An,imagePositions:nn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:Ge.subdivisionGranularity})):si.hasDependencies&&(si instanceof k.cP||si instanceof k.cQ||si instanceof k.cR)&&(He(si.layers,this.zoom,ie),si.addFeatures(Ge,this.tileID.canonical,nn.patternPositions,rn))}return this.status="done",{buckets:Object.values(Je).filter((tt=>!tt.isEmpty())),featureIndex:Ve,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Sr.image,imageAtlas:nn,dashPositions:rn,glyphMap:this.returnDependencies?Kt:null,iconMap:this.returnDependencies?An:null,glyphPositions:this.returnDependencies?Sr.positions:null}}))}}function He(Ye,H,J){const ie=new k.J(H);for(const Te of Ye)Te.recalculate(ie,J)}class dt{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(H,J){this.loading[H]=J}finishLoading(H){delete this.loading[H]}abort(H){const J=this.loading[H];J?.abort&&(J.abort.abort(),delete this.loading[H])}setParsing(H,J){this.parsing[H]=J}consumeParsing(H){const J=this.parsing[H];if(J)return delete this.parsing[H],J}clearParsing(H){delete this.parsing[H]}markLoaded(H,J){this.loaded[H]=J}getLoaded(H){const J=this.loaded[H];if(J)return J}removeLoaded(H){delete this.loaded[H]}clearLoaded(){this.loaded={}}}class st{constructor(H){this.start=`${H}#start`,this.end=`${H}#end`,this.measure=H,performance.mark(this.start)}finish(){performance.mark(this.end);let H=performance.getEntriesByName(this.measure);return H.length===0&&(performance.measure(this.measure,this.start,this.end),H=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),H}}class Ze{constructor(H,J,ie,Te,Le){this.type=H,this.properties=ie||{},this.extent=Le,this.pointsArray=J,this.id=Te}loadGeometry(){return this.pointsArray.map((H=>H.map((J=>new k.P(J.x,J.y)))))}}class Yt{constructor(H,J,ie){this.version=2,this._myFeatures=H,this.name=J,this.length=H.length,this.extent=ie}feature(H){return this._myFeatures[H]}}class je{constructor(){this.layers={}}addLayer(H){this.layers[H.name]=H}}function Tr(Ye){let H=k.cS(Ye);return H.byteOffset===0&&H.byteLength===H.buffer.byteLength||(H=new Uint8Array(H)),{vectorTile:Ye,rawData:H.buffer}}function _o(Ye,H,J){const{extent:ie}=Ye,Te=Math.pow(2,J.z-H.z),Le=(J.x-H.x*Te)*ie,Ke=(J.y-H.y*Te)*ie,Ve=[];for(let Je=0;Je<Ye.length;Je++){const Ge=Ye.feature(Je);let lt=Ge.loadGeometry();for(const Vt of lt)for(const Ut of Vt)Ut.x=Ut.x*Te-Le,Ut.y=Ut.y*Te-Ke;const Be=128;lt=k.cT(lt,Ge.type,-Be,-Be,ie+Be,ie+Be),lt.length!==0&&Ve.push(new Ze(Ge.type,lt,Ge.properties,Ge.id,ie))}return new Yt(Ve,Ye.name,ie)}class $t{constructor(H,J,ie){this.actor=H,this.layerIndex=J,this.availableImages=ie,this.tileState=new dt,this.overzoomedTileResultCache=new k.cU(1e3)}loadVectorTile(H,J){try{return{vectorTile:H.encoding!=="mlt"?new k.cV(new k.cW(J)):new k.cX(J),rawData:J}}catch(ie){const Te=new Uint8Array(J);let Le=`Unable to parse the tile at ${H.request.url}, `;throw Le+=Te[0]===31&&Te[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${k.d(ie).message}`,new Error(Le)}}loadTile(H){return k._(this,void 0,void 0,(function*(){const{uid:J,overzoomParameters:ie}=H;ie&&(H.request=ie.overzoomRequest);const Te=this._startRequestTiming(H),Le=new $e(H);this.tileState.startLoading(J,Le);const Ke=new AbortController;Le.abort=Ke;try{const Ve=yield k.o(H.request,Ke);if(H.etag&&H.etag===Ve.etag)return this.tileState.finishLoading(J),this._getEtagUnmodifiedResult(Ve,Te);const Je=this.loadVectorTile(H,Ve.data);if(this.tileState.finishLoading(J),!Je)return null;let{vectorTile:Ge,rawData:lt}=Je;ie&&({vectorTile:Ge,rawData:lt}=this._getOverzoomTile(H,Ge));const Be=this._getExpiryData(Ve),Vt=this._finishRequestTiming(Te);Le.vectorTile=Ge,this.tileState.markLoaded(J,Le);const Ut={rawData:lt,cacheControl:Be,resourceTiming:Vt};this.tileState.setParsing(J,Ut);try{return yield this._parseWorkerTile(Le,H,Ut)}finally{this.tileState.clearParsing(J)}}catch(Ve){throw this.tileState.finishLoading(J),Le.status="done",this.tileState.markLoaded(J,Le),Ve}}))}_getEtagUnmodifiedResult(H,J){const ie=this._getExpiryData(H),Te=this._finishRequestTiming(J);return k.e({etagUnmodified:!0},ie,Te)}_parseWorkerTile(H,J,ie){return k._(this,void 0,void 0,(function*(){let Te=yield H.parse(H.vectorTile,this.layerIndex,this.availableImages,this.actor,J.subdivisionGranularity);if(ie){const{rawData:Le,cacheControl:Ke,resourceTiming:Ve}=ie;Te=k.e({rawTileData:Le.slice(0),encoding:J.encoding},Te,Ke,Ve)}return Te}))}_getExpiryData({expires:H,cacheControl:J,etag:ie}){const Te={};return H&&(Te.expires=H),J&&(Te.cacheControl=J),ie&&(Te.etag=ie),Te}_startRequestTiming(H){var J;if(!((J=H.request)===null||J===void 0)&&J.collectResourceTiming)return new st(H.request.url)}_finishRequestTiming(H){const J=H?.finish();return J?{resourceTiming:JSON.parse(JSON.stringify(J))}:{}}_getOverzoomTile(H,J){var ie;const{tileID:Te,source:Le,overzoomParameters:Ke}=H,{maxZoomTileID:Ve}=Ke,Je=`${Ve.key}_${Te.key}_${(ie=H.request)===null||ie===void 0?void 0:ie.url}`,Ge=this.overzoomedTileResultCache.get(Je);if(Ge)return Ge;const lt=new je,Be=this.layerIndex.familiesBySource[Le];for(const Ut in Be){const ar=J.layers[Ut];if(!ar)continue;const Vr=_o(ar,Ve,Te.canonical);Vr.length>0&&lt.addLayer(Vr)}const Vt=Tr(lt);return this.overzoomedTileResultCache.set(Je,Vt),Vt}reloadTile(H){return k._(this,void 0,void 0,(function*(){const J=H.uid,ie=this.tileState.getLoaded(J);if(!ie)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(ie.showCollisionBoxes=H.showCollisionBoxes,ie.status==="parsing"){const Te=this.tileState.consumeParsing(J);return yield this._parseWorkerTile(ie,H,Te)}if(ie.status==="done"&&ie.vectorTile)return yield this._parseWorkerTile(ie,H)}))}abortTile(H){return k._(this,void 0,void 0,(function*(){this.tileState.abort(H.uid)}))}removeTile(H){return k._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(H.uid)}))}}class Zt{constructor(){this.loaded={}}loadTile(H){return k._(this,void 0,void 0,(function*(){const{uid:J,encoding:ie,rawImageData:Te,redFactor:Le,greenFactor:Ke,blueFactor:Ve,baseShift:Je}=H,Ge=Te.width+2,lt=Te.height+2,Be=k.b(Te)?new k.R({width:Ge,height:lt},yield k.cY(Te,-1,-1,Ge,lt)):Te,Vt=new k.cZ(J,Be,ie,Le,Ke,Ve,Je);return this.loaded||(this.loaded={}),this.loaded[J]=Vt,Vt}))}removeTile(H){const J=this.loaded,ie=H.uid;J?.[ie]&&delete J[ie]}}class yo{constructor(H,J,ie,Te=en){this.actor=H,this.layerIndex=J,this.availableImages=ie,this.tileState=new dt,this._createGeoJSONIndex=Te}loadVectorTile(H){if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const{z:J,x:ie,y:Te}=H.tileID.canonical,Le=this._geoJSONIndex.getTile(J,ie,Te);return Le?Tr(new k.c_(Le.features,{version:2,extent:k.a6})):null}loadTile(H){return k._(this,void 0,void 0,(function*(){const{uid:J}=H,ie=new $e(H);ie.abort=new AbortController;try{const Te=this.loadVectorTile(H);if(!Te)return null;const{vectorTile:Le,rawData:Ke}=Te;ie.vectorTile=Le,this.tileState.markLoaded(J,ie);const Ve={rawData:Ke};this.tileState.setParsing(J,Ve);try{return yield this._parseWorkerTile(ie,H,Ve)}finally{this.tileState.clearParsing(J)}}catch(Te){throw ie.status="done",this.tileState.markLoaded(J,ie),Te}}))}_reloadLoadedTile(H){return k._(this,void 0,void 0,(function*(){const J=H.uid,ie=this.tileState.getLoaded(J);if(!ie)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(ie.showCollisionBoxes=H.showCollisionBoxes,ie.status==="parsing"){const Te=this.tileState.consumeParsing(J);return yield this._parseWorkerTile(ie,H,Te)}if(ie.status==="done"&&ie.vectorTile)return yield this._parseWorkerTile(ie,H)}))}_parseWorkerTile(H,J,ie){return k._(this,void 0,void 0,(function*(){let Te=yield H.parse(H.vectorTile,this.layerIndex,this.availableImages,this.actor,J.subdivisionGranularity);if(ie){const{rawData:Le}=ie;Te=k.e({rawTileData:Le.slice(0),encoding:"mvt"},Te)}return Te}))}abortTile(H){return k._(this,void 0,void 0,(function*(){this.tileState.abort(H.uid)}))}removeTile(H){return k._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(H.uid)}))}loadData(H){return k._(this,void 0,void 0,(function*(){var J;(J=this._pendingRequest)===null||J===void 0||J.abort();const ie=this._startRequestTiming(H);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(H,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();const Te={};return H.request&&(Te.data=H.data),this._finishRequestTiming(ie,H,Te),Te}catch(Te){if(delete this._pendingRequest,!k.$(Te))throw Te;return{abandoned:!0}}}))}_startRequestTiming(H){var J;if(!((J=H.request)===null||J===void 0)&&J.collectResourceTiming)return new st(H.request.url)}_finishRequestTiming(H,J,ie){const Te=H?.finish();Te&&(ie.resourceTiming={[J.source]:JSON.parse(JSON.stringify(Te))})}reloadTile(H){return this.tileState.getLoaded(H.uid)?this._reloadLoadedTile(H):this.loadTile(H)}loadAndProcessGeoJSON(H,J){return k._(this,void 0,void 0,(function*(){var ie;if(H.request&&(H.data=(yield k.k(H.request,J)).data),H.data)return H.data=this._filterGeoJSON(H.data,H.filter),void(this._geoJSONIndex=this._createGeoJSONIndex(H.data,H));if(H.dataDiff)return(ie=this._geoJSONIndex)!==null&&ie!==void 0||(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},H)),void this._geoJSONIndex.updateData(H.dataDiff,this._getFilterPredicate(H.filter));if(H.updateCluster&&this._geoJSONIndex.updateClusterOptions(H.geojsonVtOptions.cluster,tn(H)),this._geoJSONIndex==null)throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`)}))}_filterGeoJSON(H,J){if(H.type!=="FeatureCollection")return H;const ie=this._getFilterPredicate(J);return ie?{type:"FeatureCollection",features:H.features.filter((Te=>ie(Te)))}:H}_getFilterPredicate(H){if(typeof H!="boolean"&&!H?.length)return;const J=k.c$(H,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(J.result==="error")throw new Error(J.value.map((ie=>`${ie.key}: ${ie.message}`)).join(", "));return ie=>J.value.evaluate({zoom:0},ie)}removeSource(H){return k._(this,void 0,void 0,(function*(){var J;(J=this._pendingRequest)===null||J===void 0||J.abort()}))}getClusterExpansionZoom(H){return this._geoJSONIndex.getClusterExpansionZoom(H.clusterId)}getClusterChildren(H){return this._geoJSONIndex.getClusterChildren(H.clusterId)}getClusterLeaves(H){return this._geoJSONIndex.getClusterLeaves(H.clusterId,H.limit,H.offset)}}function en(Ye,H){const J=k.e(H.geojsonVtOptions||{},{updateable:!0,clusterOptions:tn(H)});return new k.d0(Ye,J)}function tn({geojsonVtOptions:Ye,clusterProperties:H}){if(!H||!Ye.clusterOptions)return Ye.clusterOptions;const J={},ie={},Te={accumulated:null,zoom:0},Le={properties:null},Ke=Object.keys(H);for(const Ve of Ke){const[Je,Ge]=H[Ve],lt=k.c$(Ge),Be=k.c$(typeof Je=="string"?[Je,["accumulated"],["get",Ve]]:Je);J[Ve]=lt.value,ie[Ve]=Be.value}return Ye.clusterOptions.map=Ve=>{Le.properties=Ve;const Je={};for(const Ge of Ke)Je[Ge]=J[Ge].evaluate(Te,Le);return Je},Ye.clusterOptions.reduce=(Ve,Je)=>{Le.properties=Je;for(const Ge of Ke)Te.accumulated=Ve[Ge],Ve[Ge]=ie[Ge].evaluate(Te,Le)},Ye.clusterOptions}class we{constructor(H){this.self=H,this.actor=new k.N(H),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(J,ie)=>{if(this.externalWorkerSourceTypes[J])throw new Error(`Worker source with name "${J}" already registered.`);this.externalWorkerSourceTypes[J]=ie},this.self.addProtocol=k.cH,this.self.removeProtocol=k.cI,this.self.registerRTLTextPlugin=J=>{k.d1.setMethods(J)},this.self.makeRequest=k.m,this.actor.registerMessageHandler("LDT",((J,ie)=>this._getDEMWorkerSource(J,ie.source).loadTile(ie))),this.actor.registerMessageHandler("RDT",((J,ie)=>k._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(J,ie.source).removeTile(ie)})))),this.actor.registerMessageHandler("GCEZ",((J,ie)=>k._(this,void 0,void 0,(function*(){return this._getWorkerSource(J,ie.type,ie.source).getClusterExpansionZoom(ie)})))),this.actor.registerMessageHandler("GCC",((J,ie)=>k._(this,void 0,void 0,(function*(){return this._getWorkerSource(J,ie.type,ie.source).getClusterChildren(ie)})))),this.actor.registerMessageHandler("GCL",((J,ie)=>k._(this,void 0,void 0,(function*(){return this._getWorkerSource(J,ie.type,ie.source).getClusterLeaves(ie)})))),this.actor.registerMessageHandler("LD",((J,ie)=>this._getWorkerSource(J,ie.type,ie.source).loadData(ie))),this.actor.registerMessageHandler("LT",((J,ie)=>this._getWorkerSource(J,ie.type,ie.source).loadTile(ie))),this.actor.registerMessageHandler("RT",((J,ie)=>this._getWorkerSource(J,ie.type,ie.source).reloadTile(ie))),this.actor.registerMessageHandler("AT",((J,ie)=>this._getWorkerSource(J,ie.type,ie.source).abortTile(ie))),this.actor.registerMessageHandler("RMT",((J,ie)=>this._getWorkerSource(J,ie.type,ie.source).removeTile(ie))),this.actor.registerMessageHandler("RS",((J,ie)=>k._(this,void 0,void 0,(function*(){var Te,Le;if(!(!((Le=(Te=this.workerSources[J])===null||Te===void 0?void 0:Te[ie.type])===null||Le===void 0)&&Le[ie.source]))return;const Ke=this.workerSources[J][ie.type][ie.source];delete this.workerSources[J][ie.type][ie.source],Ke.removeSource!==void 0&&Ke.removeSource(ie)})))),this.actor.registerMessageHandler("RM",(J=>k._(this,void 0,void 0,(function*(){delete this.layerIndexes[J],delete this.availableImages[J],delete this.workerSources[J],delete this.demWorkerSources[J],this.globalStates.delete(J)})))),this.actor.registerMessageHandler("SR",((J,ie)=>k._(this,void 0,void 0,(function*(){this.referrer=ie})))),this.actor.registerMessageHandler("SRPS",((J,ie)=>this._syncRTLPluginState(J,ie))),this.actor.registerMessageHandler("IS",((J,ie)=>k._(this,void 0,void 0,(function*(){this.self.importScripts(ie)})))),this.actor.registerMessageHandler("SI",((J,ie)=>this._setImages(J,ie))),this.actor.registerMessageHandler("UL",((J,ie)=>k._(this,void 0,void 0,(function*(){this._getLayerIndex(J).update(ie.layers,ie.removedIds,this._getGlobalState(J))})))),this.actor.registerMessageHandler("UGS",((J,ie)=>k._(this,void 0,void 0,(function*(){const Te=this._getGlobalState(J);for(const Le in ie)Te[Le]=ie[Le]})))),this.actor.registerMessageHandler("SL",((J,ie)=>k._(this,void 0,void 0,(function*(){this._getLayerIndex(J).replace(ie,this._getGlobalState(J))}))))}_getGlobalState(H){let J=this.globalStates.get(H);return J||(J={},this.globalStates.set(H,J)),J}_setImages(H,J){return k._(this,void 0,void 0,(function*(){this.availableImages[H]=J;for(const ie in this.workerSources[H]){const Te=this.workerSources[H][ie];for(const Le in Te)Te[Le].availableImages=J}}))}_syncRTLPluginState(H,J){return k._(this,void 0,void 0,(function*(){return yield k.d1.syncState(J,this.self.importScripts)}))}_getAvailableImages(H){let J=this.availableImages[H];return J||(J=[]),J}_getLayerIndex(H){let J=this.layerIndexes[H];return J||(J=this.layerIndexes[H]=new h),J}_getWorkerSource(H,J,ie){var Te,Le;if((Te=this.workerSources)[H]||(Te[H]={}),(Le=this.workerSources[H])[J]||(Le[J]={}),!this.workerSources[H][J][ie]){const Ke={sendAsync:(Ve,Je)=>(Ve.targetMapId=H,this.actor.sendAsync(Ve,Je))};switch(J){case"vector":this.workerSources[H][J][ie]=new $t(Ke,this._getLayerIndex(H),this._getAvailableImages(H));break;case"geojson":this.workerSources[H][J][ie]=new yo(Ke,this._getLayerIndex(H),this._getAvailableImages(H));break;default:this.workerSources[H][J][ie]=new this.externalWorkerSourceTypes[J](Ke,this._getLayerIndex(H),this._getAvailableImages(H))}}return this.workerSources[H][J][ie]}_getDEMWorkerSource(H,J){var ie,Te;return(ie=this.demWorkerSources)[H]||(ie[H]={}),(Te=this.demWorkerSources[H])[J]||(Te[J]=new Zt),this.demWorkerSources[H][J]}}return k.i(self)&&(self.worker=new we(self)),we})),ve("index",["exports","./shared"],(function(k,h){var fe="5.24.1";function $e(){var d=new h.A(4);return h.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}let He,dt,st;const Ze={frame(d,t,n,a){const c=a||window,f=c.requestAnimationFrame((x=>{y(),t(x)})),{unsubscribe:y}=h.s(d.signal,"abort",(()=>{y(),c.cancelAnimationFrame(f),n(new h.a(d.signal.reason))}),!1)},frameAsync(d,t){return new Promise(((n,a)=>{this.frame(d,n,a,t)}))},getImageData(d,t=0){return this.getImageCanvasContext(d).getImageData(-t,-t,d.width+2*t,d.height+2*t)},getImageCanvasContext(d){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=d.width,t.height=d.height,n.drawImage(d,0,0,d.width,d.height),n},resolveURL:d=>(He||(He=document.createElement("a")),He.href=d,He.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return st!==void 0?st:!!matchMedia&&(dt!=null||(dt=matchMedia("(prefers-reduced-motion: reduce)")),dt.matches)},set prefersReducedMotion(d){st=d}},Yt=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt!==null?this._frozenAt:performance.now()}setNow(d){this._frozenAt=d}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function je(){return Yt.getCurrentTime()}var Tr;const _o=new Set(["a","abbr","b","bdi","bdo","br","cite","code","del","div","em","i","img","ins","kbd","li","mark","ol","p","q","s","samp","small","span","strong","sub","sup","time","u","ul","var","wbr"]),$t=new Set(["alt","class","datetime","dir","height","href","hreflang","lang","referrerpolicy","rel","role","src","target","title","translate","type","width"]),Zt=new Set(["href","src"]),yo=new Set(["http:","https:","mailto:"]);let en;function tn(){return en!=null||(en={getAttribute:Element.prototype.getAttribute,getAttributeNames:Element.prototype.getAttributeNames,querySelectorAll:Element.prototype.querySelectorAll,remove:Element.prototype.remove,removeAttribute:Element.prototype.removeAttribute,localName:Object.getOwnPropertyDescriptor(Element.prototype,"localName").get,namespaceURI:Object.getOwnPropertyDescriptor(Element.prototype,"namespaceURI").get}),en}class we{static create(t,n,a){const c=window.document.createElement(t);return n!==void 0&&(c.className=n),a&&a.appendChild(c),c}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){we.docStyle&&we.selectProp&&(we.userSelect=we.docStyle[we.selectProp],we.docStyle[we.selectProp]="none")}static enableDrag(){we.docStyle&&we.selectProp&&(we.docStyle[we.selectProp]=we.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",we.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",we.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",we.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,a){const c=n.boundingClientRect;return new h.P((a.clientX-c.left)/n.x-t.clientLeft,(a.clientY-c.top)/n.y-t.clientTop)}static mousePos(t,n){const a=we.getScale(t);return we.getPoint(t,a,n)}static touchPos(t,n){const a=[],c=we.getScale(t);for(const f of n)a.push(we.getPoint(t,c,f));return a}static sanitize(t){const n=new DOMParser().parseFromString(t,"text/html").body,{querySelectorAll:a,remove:c}=tn();for(const y of Array.from(a.call(n,"*")))we.isAllowedElement(y)?we.removeDisallowedAttributes(y):c.call(y);const f=document.createDocumentFragment();return f.append(...n.childNodes),f}static isAllowedElement(t){const{namespaceURI:n,localName:a}=tn();return n.call(t)==="http://www.w3.org/1999/xhtml"&&_o.has(a.call(t))}static removeDisallowedAttributes(t){const{getAttributeNames:n,getAttribute:a,removeAttribute:c}=tn();for(const f of n.call(t))we.isAllowedAttribute(f,a.call(t,f))||c.call(t,f)}static isAllowedAttribute(t,n){if(!$t.has(t)&&!t.startsWith("aria-"))return!1;if(!Zt.has(t))return!0;try{return yo.has(new URL(n,"https://maplibre.invalid/").protocol)}catch{return!1}}}var Ye;we.docStyle=typeof window<"u"&&((Tr=window.document)===null||Tr===void 0?void 0:Tr.documentElement.style),we.selectProp=!we.docStyle||"userSelect"in we.docStyle?"userSelect":"webkitUserSelect",(function(d){let t,n,a,c;d.resetRequestQueue=()=>{t=[],n=0,a=0,c={}},d.addThrottleControl=w=>{const S=a++;return c[S]=w,S},d.removeThrottleControl=w=>{delete c[w],y()},d.getImage=(w,S,P=!0)=>new Promise(((E,C)=>{w.headers||(w.headers={}),w.headers.accept="image/webp,*/*",h.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=>h._(this,void 0,void 0,(function*(){w.state="running";const{requestParameters:S,supportImageRefresh:P,onError:E,onSuccess:C,abortController:z}=w,O=P===!1&&!h.i(self)&&!h.g(S.url)&&(!S.headers||Object.keys(S.headers).reduce(((U,q)=>U&&q==="accept"),!0));n++;const j=O?x(S,z):h.m(S,z);try{const U=yield j;delete w.abortController,w.state="completed",U.data instanceof HTMLImageElement||h.b(U.data)?C(U):U.data&&C({data:yield($=U.data,typeof createImageBitmap=="function"?h.h($):h.j($)),cacheControl:U.cacheControl,expires:U.expires})}catch(U){delete w.abortController,E(h.d(U))}finally{n--,y()}var $})),y=()=>{const w=(()=>{for(const S of Object.keys(c))if(c[S]())return!0;return!1})()?h.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:h.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)}},x=(w,S)=>new Promise(((P,E)=>{const C=new Image,z=w.url,O=w.credentials;O&&O==="include"?C.crossOrigin="use-credentials":(O&&O==="same-origin"||!h.f(z))&&(C.crossOrigin="anonymous"),S.signal.addEventListener("abort",(()=>{C.src="",E(new h.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}))})(Ye||(Ye={})),Ye.resetRequestQueue();class H{constructor(t){this._transformRequestFn=t??null}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function J(d){const t=[];if(typeof d=="string")t.push({id:"default",url:d});else if(d&&d.length>0){const n=[];for(const{id:a,url:c}of d){const f=`${a}${c}`;n.includes(f)||(n.push(f),t.push({id:a,url:c}))}}return t}function ie(d,t,n){try{const a=new URL(d);return a.pathname+=`${t}${n}`,a.toString()}catch{throw new Error(`Invalid sprite URL "${d}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function Te(d){const{userImage:t}=d;return!(!t?.render||!t.render()||(d.data.replace(new Uint8Array(t.data.buffer)),0))}class Le extends h.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new h.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 h.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:a}of this.requestors)a(this._getImagesForIds(n));this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const a=n.spriteData;n.data=new h.R({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.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 a=!0;const c=n.data||n.spriteData;return this._validateStretch(n.stretchX,c?.width)||(this.fire(new h.l(new Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,c?.height)||(this.fire(new h.l(new Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new h.l(new Error(`Image "${t}" has invalid "content" value`))),a=!1),a}_validateStretch(t,n){if(!t)return!0;let a=0;for(const c of t){if(c[0]<a||c[1]<c[0]||n<c[1])return!1;a=c[1]}return!0}_validateContent(t,n){if(!t)return!0;if(t.length!==4)return!1;const a=n.spriteData,c=a?.width||n.data.width,f=a?.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,a=!0){const c=this.getImage(t);if(a&&(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){var n;const a=this.images[t];delete this.images[t],delete this.patterns[t],!((n=a.userImage)===null||n===void 0)&&n.onRemove&&a.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise(((n,a)=>{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){var n;const a={};for(const c of t){let f=this.getImage(c);f||(this.fire(new h.n("styleimagemissing",{id:c})),f=this.getImage(c)),f?a[c]={data:f.data.clone(),pixelRatio:f.pixelRatio,sdf:f.sdf,version:f.version,stretchX:f.stretchX,stretchY:f.stretchY,content:f.content,textFitWidth:f.textFitWidth,textFitHeight:f.textFitHeight,hasRenderCallback:!!(!((n=f.userImage)===null||n===void 0)&&n.render)}:h.w(`Image "${c}" 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 a}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],a=this.getImage(t);if(!a)return null;if(n&&n.position.version===a.version)return n.position;if(n)n.position.version=a.version;else{const c={w:a.data.width+2,h:a.data.height+2,x:0,y:0},f=new h.I(c,a);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 h.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:a}=h.p(t),c=this.atlasImage;c.resize({width:n||1,height:a||1});for(const f in this.patterns){const{bin:y}=this.patterns[f],x=y.x+1,w=y.y+1,S=this.getImage(f).data,P=S.width,E=S.height;h.R.copy(S,c,{x:0,y:0},{x,y:w},{width:P,height:E}),h.R.copy(S,c,{x:0,y:E-1},{x,y:w-1},{width:P,height:1}),h.R.copy(S,c,{x:0,y:0},{x,y:w+E},{width:P,height:1}),h.R.copy(S,c,{x:P-1,y:0},{x:x-1,y:w},{width:1,height:E}),h.R.copy(S,c,{x:0,y:0},{x:x+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 a=this.getImage(n);a||h.w(`Image with ID: "${n}" was not found`),Te(a)&&this.updateImage(n,a)}}cloneImages(){const t={};for(const n in this.images){const a=this.images[n];t[n]=Object.assign(Object.assign({},a),{data:a.data?a.data.clone():null})}return t}}const Ke=1e20,Ve=new Float64Array(256);for(let d=0;d<256;d++){const t=.5-Math.pow(d/255,.45454545454545453);Ve[d]=t*Math.abs(t)}function Je(d,t,n,a,c,f,y,x,w){for(let S=t;S<t+a;S++)Ge(d,n*f+S,f,c,y,x,w);for(let S=n;S<n+c;S++)Ge(d,S*f+t,1,a,y,x,w)}function Ge(d,t,n,a,c,f,y){f[0]=0,y[0]=-Ke,y[1]=Ke,c[0]=d[t];for(let x=1,w=0,S=0;x<a;x++){c[x]=d[t+x*n];const P=x*x;do{const E=f[w];S=(c[x]-c[E]+P-E*E)/(x-E)/2}while(S<=y[w]&&--w>-1);w++,f[w]=x,y[w]=S,y[w+1]=Ke}for(let x=0,w=0;x<a;x++){for(;y[w+1]<x;)w++;const S=f[w],P=x-S;d[t+x*n]=c[S]+P*P}}Ve[255]=-Ke;const lt=h.v.layout_symbol["text-font"].default.join(",");class Be{constructor(t,n,a){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={},this.lang=a}setURL(t){this.url=t}getGlyphs(t){return h._(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 a=yield Promise.all(n),c={};for(const{stack:f,id:y,glyph:x}of a)c[f]||(c[f]={}),c[f][y]=x&&{id:x.id,bitmap:x.bitmap.clone(),metrics:x.metrics};return c}))}_getAndCacheGlyphsPromise(t,n){return h._(this,void 0,void 0,(function*(){var a,c;(a=(c=this.entries)[t])!==null&&a!==void 0||(c[t]={glyphs:{},requests:{},ranges:{}});const f=this.entries[t];let y=f.glyphs[n];return y!==void 0?{stack:t,id:n,glyph:y}:!this.url||this._charUsesLocalIdeographFontFamily(n)?(y=f.glyphs[n]=this._drawGlyph(f,t,n),{stack:t,id:n,glyph:y}):yield this._downloadAndCacheRangePromise(t,n)}))}_downloadAndCacheRangePromise(t,n){return h._(this,void 0,void 0,(function*(){var a;const c=this.entries[t],f=Math.floor(n/256);if(c.ranges[f])return{stack:t,id:n,glyph:null};(a=c.requests)[f]||(a[f]=Be.loadGlyphRange(t,f,this.url,this.requestManager));try{const y=yield c.requests[f];for(const x in y)c.glyphs[+x]=y[+x];return c.ranges[f]=!0,{stack:t,id:n,glyph:y[n]||null}}catch(y){const x=c.glyphs[n]=this._drawGlyph(c,t,n);return this._warnOnMissingGlyphRange(x,f,n,h.d(y)),{stack:t,id:n,glyph:x}}}))}_warnOnMissingGlyphRange(t,n,a,c){const f=256*n,y=f+255,x=a.toString(16).padStart(4,"0").toUpperCase();h.w(`Unable to load glyph range ${n}, ${f}-${y}. Rendering codepoint U+${x} locally instead. ${c}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&h.r(t)}_drawGlyph(t,n,a){const c=n===lt&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(a),f=c?"ideographTinySDF":"tinySDF";t[f]||(t[f]=this._createTinySDF(c?this.localIdeographFontFamily:n));const y=t[f].draw(String.fromCodePoint(a)),x=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(a));return{id:a,bitmap:new h.t({width:y.width||60,height:y.height||60},y.data),metrics:{width:x?0:y.glyphWidth/2||24,height:y.glyphHeight/2||24,left:y.glyphLeft/2+.5||0,top:y.glyphTop/2-27.5||-8,advance:x?0:y.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(t){const n=t?t.split(","):[];n.push("sans-serif");const a=n.map((c=>/[-\w]+/.test(c)?c:`'${CSS.escape(c)}'`)).join(",");return new Be.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:a,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 a;for(const[c,f]of Object.entries(n))new RegExp(`\\b${c}\\b`,"i").test(t)&&(a=`${f}`);return a}destroy(){for(const t in this.entries){const n=this.entries[t];n.tinySDF=null,n.ideographTinySDF=null,n.glyphs={},n.requests={},n.ranges={}}this.entries={}}}Be.loadGlyphRange=function(d,t,n,a){return h._(this,void 0,void 0,(function*(){const c=256*t,f=c+255,y=yield a.transformRequest(n.replace("{fontstack}",d).replace("{range}",`${c}-${f}`),"Glyphs"),x=yield h.o(y,new AbortController);if(!x?.data)throw new Error(`Could not load glyph range. range: ${t}, ${c}-${f}`);const w={};for(const S of h.q(x.data))w[S.id]=S;return w}))},Be.TinySDF=class{constructor({fontSize:d=24,buffer:t=3,radius:n=8,cutoff:a=.25,fontFamily:c="sans-serif",fontWeight:f="normal",fontStyle:y="normal",lang:x=null}={}){this.buffer=t,this.radius=n,this.cutoff=a,this.lang=x;const w=this.size=d+4*t,S=this._createCanvas(w),P=this.ctx=S.getContext("2d",{willReadFrequently:!0});P.font=`${y} ${f} ${d}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(d){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(d,d);const t=document.createElement("canvas");return t.width=t.height=d,t}draw(d){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:c,actualBoundingBoxRight:f}=this.ctx.measureText(d),y=Math.ceil(n),x=Math.floor(c),w=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(f)-x)),S=Math.max(0,Math.min(this.size-this.buffer,y+Math.ceil(a))),P=w+2*this.buffer,E=S+2*this.buffer,C=Math.max(P*E,0),z=new Uint8ClampedArray(C),O={data:z,width:P,height:E,glyphWidth:w,glyphHeight:S,glyphTop:y,glyphLeft:x,glyphAdvance:t};if(w===0||S===0)return O;const{ctx:j,buffer:$,gridInner:U,gridOuter:q}=this;this.lang&&(j.lang=this.lang),j.clearRect($,$,w,S),j.fillText(d,$-x,$+y);const Y=j.getImageData($,$,w,S);q.fill(Ke,0,C),U.fill(0,0,C);let Z=3;for(let W=0;W<S;W++){let ee=(W+$)*P+$;for(let ue=0;ue<w;ue++,Z+=4,ee++){const oe=Y.data[Z];if(oe===0)continue;const _e=Ve[oe];q[ee]=Math.max(0,_e),U[ee]=Math.max(0,-_e)}}Je(q,0,0,P,E,P,this.f,this.v,this.z),Je(U,$,$,w,S,P,this.f,this.v,this.z);const G=255/this.radius,X=255*(1-this.cutoff);for(let W=0;W<C;W++){const ee=Math.sqrt(q[W])-Math.sqrt(U[W]);z[W]=Math.round(X-G*ee)}return O}};class Vt{constructor(){this.specification=h.x.light.position}possiblyEvaluate(t,n){return h.G(t.expression.evaluate(n))}interpolate(t,n,a){return{x:h.H.number(t.x,n.x,a),y:h.H.number(t.y,n.y,a),z:h.H.number(t.z,n.z,a)}}}let Ut;class ar extends h.E{constructor(t){super(),Ut||(Ut=new h.u({anchor:new h.D(h.x.light.anchor),position:new Vt,color:new h.D(h.x.light.color),intensity:new h.D(h.x.light.intensity)})),this._transitionable=new h.y(Ut,void 0),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(h.z,t,n))for(const a in t){const c=t[a];a.endsWith(h.B)?this._transitionable.setTransition(a.slice(0,-h.B.length),c):this._transitionable.setValue(a,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,a){return a?.validate!==!1&&h.C(this,t.call(h.F,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:h.x}))}}const Vr=new h.u({"sky-color":new h.D(h.x.sky["sky-color"]),"horizon-color":new h.D(h.x.sky["horizon-color"]),"fog-color":new h.D(h.x.sky["fog-color"]),"fog-ground-blend":new h.D(h.x.sky["fog-ground-blend"]),"horizon-fog-blend":new h.D(h.x.sky["horizon-fog-blend"]),"sky-horizon-blend":new h.D(h.x.sky["sky-horizon-blend"]),"atmosphere-blend":new h.D(h.x.sky["atmosphere-blend"])});class _s extends h.E{constructor(t){super(),this._transitionable=new h.y(Vr,void 0),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new h.J(0))}setSky(t,n={}){if(!this._validate(h.K,t,n)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const a in t){const c=t[a];a.endsWith(h.B)?this._transitionable.setTransition(a.slice(0,-h.B.length),c):this._transitionable.setValue(a,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,a={}){return a?.validate!==!1&&h.C(this,t.call(h.F,h.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:h.x})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class ys{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){var a;const c=t.join(",")+String(n);return(a=this.dashEntry)[c]||(a[c]=this.addDash(t,n)),this.dashEntry[c]}getDashRanges(t,n,a){const c=[];let f=t.length%2==1?-t[t.length-1]*a:0,y=t[0]*a,x=!0;c.push({left:f,right:y,isDash:x,zeroLength:t[0]===0});let w=t[0];for(let S=1;S<t.length;S++){x=!x;const P=t[S];f=w*a,w+=P,y=w*a,c.push({left:f,right:y,isDash:x,zeroLength:P===0})}return c}addRoundDash(t,n,a){const c=n/2;for(let f=-a;f<=a;f++){const y=this.width*(this.nextRow+a+f);let x=0,w=t[x];for(let S=0;S<this.width;S++){S/w.right>1&&(w=t[++x]);const P=Math.abs(S-w.left),E=Math.abs(S-w.right),C=Math.min(P,E);let z;const O=f/a*(c+1);if(w.isDash){const j=c-Math.abs(O);z=Math.sqrt(C*C+j*j)}else z=c-Math.sqrt(C*C+O*O);this.data[y+S]=Math.max(0,Math.min(255,z+128))}}}addRegularDash(t){for(let x=t.length-1;x>=0;--x){const w=t[x],S=t[x+1];w.zeroLength?t.splice(x,1):S&&S.isDash===w.isDash&&(S.left=w.left,t.splice(x,1))}const n=t[0],a=t[t.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);const c=this.width*this.nextRow;let f=0,y=t[f];for(let x=0;x<this.width;x++){x/y.right>1&&(y=t[++f]);const w=Math.abs(x-y.left),S=Math.abs(x-y.right),P=Math.min(w,S);this.data[c+x]=Math.max(0,Math.min(255,(y.isDash?P:-P)+128))}}addDash(t,n){const a=n?7:0,c=2*a+1;if(this.nextRow+c>this.height)return h.w("LineAtlas out of space"),null;let f=0;for(const x of t)f+=x;if(f!==0){const x=this.width/f,w=this.getDashRanges(t,this.width,x);n?this.addRoundDash(w,x,a):this.addRegularDash(w)}const y={y:this.nextRow+a,height:2*a,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 Cn="maplibre_preloaded_worker_pool";class Kt{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Kt.workerCount;)this.workers.push(new Worker(h.c.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){if(delete this.active[t],this.numActive()===0){for(const n of this.workers)n.terminate();this.workers=null}}isPreloaded(){return!!this.active[Cn]}numActive(){return Object.keys(this.active).length}}const An=Math.floor(Ze.hardwareConcurrency/2);let di,rn;function Sr(){return di||(di=new Kt),di}Kt.workerCount=h.L(globalThis)?Math.max(Math.min(An,3),1):1;class nn{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=n;const a=this.workerPool.acquire(n);for(let c=0;c<a.length;c++){const f=new h.N(a[c],n);f.name=`Worker ${c}`,this.actors.push(f)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n){const a=[];for(const c of this.actors)a.push(c.sendAsync({type:t,data:n}));return Promise.all(a)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){for(const n of this.actors)n.remove();this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,n){for(const a of this.actors)a.registerMessageHandler(t,n)}unregisterMessageHandler(t){for(const n of this.actors)n.unregisterMessageHandler(t)}}function tt(){return rn||(rn=new nn(Sr(),h.M),rn.registerMessageHandler("GR",((d,t,n)=>h.m(t,n)))),rn}function si(d,t){const n=h.O();return h.Q(n,n,[1,1,0]),h.S(n,n,[.5*d.width,.5*d.height,1]),d.calculatePosMatrix?h.U(n,n,d.calculatePosMatrix(t.toUnwrapped())):n}function pi(d,t,n,a,c,f,y){var x;const w=(function(C,z,O){if(C)for(const j of C){const $=z[j];if($?.source===O&&$.type==="fill-extrusion")return!0}else for(const j in z){const $=z[j];if($.source===O&&$.type==="fill-extrusion")return!0}return!1})((x=c?.layers)!==null&&x!==void 0?x:null,t,d.id),S=f.maxPitchScaleFactor(),P=d.tilesIn(a,S,w);P.sort(Yi);const E=[];for(const C of P)E.push({wrappedTileID:C.tileID.wrapped().key,queryResults:C.tile.queryRenderedFeatures(t,n,d.getState(),C.queryGeometry,C.cameraQueryGeometry,C.scale,c,f,S,si(f,C.tileID),y?(z,O)=>y(C.tileID,z,O):void 0)});return(function(C,z){for(const O in C)for(const j of C[O])oi(j,z);return C})((function(C){const z={},O={};for(const{queryResults:j,wrappedTileID:$}of C){O[$]||(O[$]={});const U=O[$];for(const q in j){const Y=j[q];U[q]||(U[q]={});const Z=U[q];z[q]||(z[q]=[]);for(const G of Y)Z[G.featureIndex]||(Z[G.featureIndex]=!0,z[q].push(G))}}return z})(E),d)}function Yi(d,t){const n=d.tileID,a=t.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}function oi(d,t){const n=d.feature,a=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=a}function Vi(d,t,n,a){return h._(this,void 0,void 0,(function*(){let c=d;if(d.url?c=(yield h.k(yield t.transformRequest(d.url,"Source"),n)).data:yield Ze.frameAsync(n,a),!c)return null;const f=h.V(h.e(c,d),["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 h.W?new h.W(t.lng,t.lat):h.W.convert(t),this}setSouthWest(t){return this._sw=t instanceof h.W?new h.W(t.lng,t.lat):h.W.convert(t),this}extend(t){const n=this._sw,a=this._ne;let c,f;if(t instanceof h.W)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(h.W.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(h.W.convert(t)):this;if(c=t._sw,f=t._ne,!c||!f)return this}return n||a?(n.lng=Math.min(c.lng,n.lng),n.lat=Math.min(c.lat,n.lat),a.lng=Math.max(f.lng,a.lng),a.lat=Math.max(f.lat,a.lat)):(this._sw=new h.W(c.lng,c.lat),this._ne=new h.W(f.lng,f.lat)),this}getCenter(){return new h.W((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new h.W(this.getWest(),this.getNorth())}getSouthEast(){return new h.W(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:n,lat:a}=h.W.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<=a&&a<=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()),a=Math.abs(t.getEast()-t.getWest());if(n>=360||a>=360)return!0;const c=h.X(this.getWest(),-180,180),f=h.X(this.getEast(),-180,180),y=h.X(t.getWest(),-180,180),x=h.X(t.getEast(),-180,180),w=c>f,S=y>x;return!(!w||!S)||(w?x>=c||y<=f:S?f>=y||c<=x:y<=f&&x>=c)}static convert(t){return t instanceof xt?t:t&&new xt(t)}static fromLngLat(t,n=0){const a=360*n/40075017,c=a/Math.cos(Math.PI/180*t.lat);return new xt(new h.W(t.lng-c,t.lat-a),new h.W(t.lng+c,t.lat+a))}adjustAntiMeridian(){const t=new h.W(this._sw.lng,this._sw.lat),n=new h.W(this._ne.lng,this._ne.lat);return new xt(t,t.lng>n.lng?new h.W(n.lng+360,n.lat):n)}}class Ya{constructor(t,n,a){this.bounds=xt.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=a||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),a=Math.floor(h.Z(this.bounds.getWest())*n),c=Math.floor(h.Y(this.bounds.getNorth())*n),f=Math.ceil(h.Z(this.bounds.getEast())*n),y=Math.ceil(h.Y(this.bounds.getSouth())*n);return t.x>=a&&t.x<f&&t.y>=c&&t.y<y}}class Ka extends h.E{constructor(t,n,a,c){if(super(),this.id=t,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,h.e(this,h.V(n,["url","scheme","tileSize","promoteId","encoding"])),this._options=h.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 h._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new h.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const n=yield Vi(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,n&&(h.e(this,n),n.bounds&&(this.tileBounds=new Ya(n.bounds,this.minzoom,this.maxzoom)),this.fire(new h.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(n){this._tileJSONRequest=null,this._loaded=!0,h.$(n)||this.fire(new h.l(h.d(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 h.e({},this._options)}loadTile(t){return h._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a={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};a.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:a},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 h._(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,a=n.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:n,overzoomRequest:yield this.map._requestManager.transformRequest(a,"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 a=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(a.resolve).catch(a.reject)}}abortTile(t){return h._(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 h._(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 sn extends h.E{constructor(t,n,a,c){super(),this.id=t,this.dispatcher=a,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=h.e({type:"raster"},n),h.e(this,h.V(n,["url","scheme","tileSize"]))}load(){return h._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new h.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const n=yield Vi(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,n&&(h.e(this,n),n.bounds&&(this.tileBounds=new Ya(n.bounds,this.minzoom,this.maxzoom)),this.fire(new h.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(n){this._tileJSONRequest=null,this._loaded=!0,h.$(n)||this.fire(new h.l(h.d(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 h.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return h._(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 a=yield Ye.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(a?.data){this.map._refreshExpiredTiles&&(a.cacheControl||a.expires)&&t.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});const c=this.map.painter.context,f=c.gl,y=a.data;t.texture=this.map.painter.getTileTexture(y.width),t.texture?t.texture.update(y,{useMipmap:!0}):(t.texture=new h.T(c,y,f.RGBA,{useMipmap:!0}),t.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(a){if(delete t.abortController,t.aborted)t.state="unloaded";else if(a)throw t.state="errored",a}}))}abortTile(t){return h._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)}))}unloadTile(t){return h._(this,void 0,void 0,(function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)}))}hasTransition(){return!1}}class Dn extends sn{constructor(t,n,a,c){super(t,n,a,c),this.type="raster-dem",this.maxzoom=22,this._options=h.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 h._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a=yield this.map._requestManager.transformRequest(n,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const c=yield Ye.getImage(a,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(c?.data){const f=c.data;this.map._refreshExpiredTiles&&(c.cacheControl||c.expires)&&t.setExpiryData({cacheControl:c.cacheControl,expires:c.expires});const y=h.b(f)&&h.a0()?f:yield this.readImageNow(f),x={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()),t.dem=yield t.actor.sendAsync({type:"LDT",data:x}),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 h._(this,void 0,void 0,(function*(){if(typeof VideoFrame<"u"&&h.a1()){const n=t.width+2,a=t.height+2;try{return new h.R({width:n,height:a},yield h.a2(t,-1,-1,n,a))}catch{}}return Ze.getImageData(t,1)}))}_getNeighboringTiles(t){const n=t.canonical,a=Math.pow(2,n.z),c=(n.x-1+a)%a,f=n.x===0?t.wrap-1:t.wrap,y=(n.x+1+a)%a,x=n.x+1===a?t.wrap+1:t.wrap,w={};return w[new h.a3(t.overscaledZ,f,n.z,c,n.y).key]={backfilled:!1},w[new h.a3(t.overscaledZ,x,n.z,y,n.y).key]={backfilled:!1},n.y>0&&(w[new h.a3(t.overscaledZ,f,n.z,c,n.y-1).key]={backfilled:!1},w[new h.a3(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},w[new h.a3(t.overscaledZ,x,n.z,y,n.y-1).key]={backfilled:!1}),n.y+1<a&&(w[new h.a3(t.overscaledZ,f,n.z,c,n.y+1).key]={backfilled:!1},w[new h.a3(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},w[new h.a3(t.overscaledZ,x,n.z,y,n.y+1).key]={backfilled:!1}),w}unloadTile(t){return h._(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 vs(d,t){return t?d.properties[t]:d.id}function Ja(d,t){const n={id:d.id};if(t.removeAllProperties&&(delete d.removeProperties,delete d.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(const a of t.removeProperties){const c=d.addOrUpdateProperties.findIndex((f=>f.key===a));c>-1&&d.addOrUpdateProperties.splice(c,1)}return(d.removeAllProperties||t.removeAllProperties)&&(n.removeAllProperties=!0),(d.removeProperties||t.removeProperties)&&(n.removeProperties=[...d.removeProperties||[],...t.removeProperties||[]]),(d.addOrUpdateProperties||t.addOrUpdateProperties)&&(n.addOrUpdateProperties=[...d.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(d.newGeometry||t.newGeometry)&&(n.newGeometry=t.newGeometry||d.newGeometry),n}function on(d){var t,n;if(!d)return{};const a={};return a.removeAll=d.removeAll,a.remove=new Set(d.remove||[]),a.add=new Map((t=d.add)===null||t===void 0?void 0:t.map((c=>[c.id,c]))),a.update=new Map((n=d.update)===null||n===void 0?void 0:n.map((c=>[c.id,c]))),a}function Qa(d){return d&&d.length!==0?typeof d[0]=="number"?[d]:d.flatMap((t=>Qa(t))):[]}function xs(d){return d.type==="GeometryCollection"?d.geometries.flatMap((t=>xs(t))):Qa(d.coordinates)}function vo(d){const t=new xt;let n;switch(d.type){case"FeatureCollection":n=d.features.flatMap((a=>xs(a.geometry)));break;case"Feature":n=xs(d.geometry);break;default:n=xs(d)}if(n.length===0)return t;for(const a of n){const[c,f]=a;t.extend([c,f])}return t}class xo extends h.E{constructor(t,n,a,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=a.getActor(),this.setEventedParent(c),this._data=typeof n.data=="string"?{url:n.data}:{geojson:n.data},this._options=h.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&&h.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${n.clusterMaxZoom}".`),this.workerOptions=h.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:h.a6,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1,promoteId:typeof n.promoteId=="string"?n.promoteId:void 0,cluster:n.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(n.clusterMaxZoom),minPoints:Math.max(2,n.clusterMinPoints||2),extent:h.a6,radius:this._pixelsToTileUnits(n.clusterRadius||50),log:!1,generateId:n.generateId||!1}},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(t){return t*(h.a6/this.tileSize)}_getClusterMaxZoom(t){const n=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||t===void 0||h.w(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${n}"`),n}load(){return h._(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 a=this._updateWorkerData();return n?a:this}updateData(t,n){this._pendingWorkerUpdate.diff=(function(c,f){if(!c)return f||{};if(!f)return c||{};const y=on(c),x=on(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,Ja(z,C)),S.update.delete(E))}})(y,x);const w={};if((y.removeAll||x.removeAll)&&(w.removeAll=!0),w.remove=new Set([...y.remove,...x.remove]),w.add=new Map([...y.add,...x.add]),w.update=new Map([...y.update,...x.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 a=this._updateWorkerData();return n?a:this}getData(){return h._(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 h._(this,void 0,void 0,(function*(){return vo(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,a){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:n,offset:a}})}_updateWorkerData(){return h._(this,void 0,void 0,(function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void h.w(`No pending worker updates for GeoJSONSource ${this.id}.`);const{data:t,diff:n,updateCluster:a}=this._pendingWorkerUpdate,c=this._getLoadGeoJSONParameters(t,n,a);t!==void 0?this._pendingWorkerUpdate.data=void 0:n?this._pendingWorkerUpdate.diff=void 0:a&&(this._pendingWorkerUpdate.updateCluster=void 0),yield this._dispatchWorkerUpdate(c)}))}_getLoadGeoJSONParameters(t,n,a){return h._(this,void 0,void 0,(function*(){const c=h.e({type:this.type},this.workerOptions);return typeof t=="string"?(c.request=yield this.map._requestManager.transformRequest(Ze.resolveURL(t),"Source"),c.request.collectResourceTiming=this._collectResourceTiming,c):t!==void 0?(c.data=t,c):n?(c.dataDiff=n,c):a?(c.updateCluster=!0,c):void 0}))}_dispatchWorkerUpdate(t){return h._(this,void 0,void 0,(function*(){this._isUpdatingWorker=!0,this.fire(new h.n("dataloading",{dataType:"source"}));try{const n=yield t,a=yield this.actor.sendAsync({type:"LD",data:n});if(this._isUpdatingWorker=!1,this._removed||a.abandoned)return void this.fire(new h.n("dataabort",{dataType:"source"}));a.data&&(this._data={geojson:a.data});const c=this._applyDiffToSource(n.dataDiff),f=this._getShouldReloadTileOptions(c),y={dataType:"source"};this._applyResourceTiming(y,a),this.fire(new h.n("data",Object.assign(Object.assign({},y),{sourceDataType:"metadata"}))),this.fire(new h.n("data",Object.assign(Object.assign({},y),{sourceDataType:"content",shouldReloadTileOptions:f})))}catch(n){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new h.n("dataabort",{dataType:"source"}));this.fire(new h.l(h.d(n)))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}}))}_applyResourceTiming(t,n){var a;if(!this._collectResourceTiming)return;const c=(a=n.resourceTiming)===null||a===void 0?void 0:a[this.id];if(!c)return;const f=c.slice(0);f?.length&&h.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 x=new Map;if(f==null||f.type==null)return x;if(f.type==="Feature"){const w=vs(f,y);return w==null?void 0:(x.set(w,f),x)}if(f.type==="FeatureCollection"){const w=new Set;for(const S of f.features){const P=vs(S,y);if(P==null||w.has(P))return;w.add(P),x.set(P,S)}return x}})(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 a=(function(c,f,y){var x,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=vs(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||((x=P.removeProperties)===null||x===void 0?void 0:x.length)>0||((w=P.addOrUpdateProperties)===null||w===void 0?void 0:w.length)>0;if(!C&&!z)continue;S.push(E.geometry);const O=Object.assign({},E);if(c.set(P.id,O),C&&(S.push(P.newGeometry),O.geometry=P.newGeometry),z){if(O.properties=P.removeAllProperties?{}:Object.assign({},O.properties||{}),P.removeProperties)for(const j of P.removeProperties)delete O.properties[j];if(P.addOrUpdateProperties)for(const{key:j,value:$}of P.addOrUpdateProperties)O.properties[j]=$}}return S})(this._data.updateable,t,n);return t.removeAll||this._options.cluster?void 0:a}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map((n=>vo(n)))}}shouldReloadTile(t,{affectedBounds:n}){if(t.state==="loading")return!0;if(t.state==="unloaded")return!1;const{buffer:a,extent:c}=this.workerOptions.geojsonVtOptions,f=(function({x:y,y:x,z:w},S=0){const P=h.a4((y-S)/Math.pow(2,w)),E=h.a5((x+1+S)/Math.pow(2,w)),C=h.a4((y+1+S)/Math.pow(2,w)),z=h.a5((x-S)/Math.pow(2,w));return new xt([P,E],[C,z])})(t.tileID.canonical,a/c);for(const y of n)if(f.intersects(y))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(t){return h._(this,void 0,void 0,(function*(){const n=t.actor?"RT":"LT";t.actor=this.actor;const a={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:a},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(c,this.map.painter,n==="RT")}))}abortTile(t){return h._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}))}unloadTile(t){return h._(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 h.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 an extends h.E{constructor(t,n,a,c){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=a,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 h._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new h.n("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const n=yield Ye.getImage(yield this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n?.data&&(this.image=n.data,t&&(this.coordinates=t),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,h.$(n)||this.fire(new h.l(h.d(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 h.n("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(h.a7.fromLngLat);var a;return this.tileID=(function(c){const f=h.a8.fromPoints(c),y=f.width(),x=f.height(),w=Math.max(y,x),S=Math.max(0,Math.floor(-Math.log(w)/Math.LN2)),P=Math.pow(2,S);return new h.aa(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=((a=this.tileCoords)[1].x-a[0].x)*(a[2].y-a[0].y)-(a[1].y-a[0].y)*(a[2].x-a[0].x)<0,this.fire(new h.n("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 h.T(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(const c in this.tiles){const f=this.tiles[c];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,a=!0)}a&&this.fire(new h.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return h._(this,void 0,void 0,(function*(){var n;!((n=this.tileID)===null||n===void 0)&&n.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:a,maxX:c,maxY:f}=h.a8.fromPoints(t),y={};for(let x=0;x<=h.a9;x++){const w=Math.pow(2,x),S=Math.floor(n*w),P=Math.floor(a*w),E=Math.floor(c*w),C=Math.floor(f*w),z=(S%w+w)%w,O=E%w,j=Math.floor(S/w),$=Math.floor(E/w);y[x]={minWrap:j,maxWrap:$,minTileXWrapped:z,maxTileXWrapped:O,minTileY:P,maxTileY:C}}return y}}class el extends an{constructor(t,n,a,c){super(t,n,a,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 h._(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 h.ab(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 h.l(h.d(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 h.l(new h.ac(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=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 h.T(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(const c in this.tiles){const f=this.tiles[c];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,a=!0)}a&&this.fire(new h.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class bs extends an{constructor(t,n,a,c){super(t,n,a,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 h.l(new h.ac(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new h.l(new h.ac(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new h.l(new h.ac(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new h.l(new h.ac(`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 h.l(new h.ac(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return h._(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 h.l(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,a=n.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new h.T(n,this.canvas,a.RGBA,{premultiply:!0}),this.texture.bind(a.LINEAR,a.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 h.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const tl={},bo=d=>{switch(d){case"geojson":return xo;case"image":return an;case"raster":return sn;case"raster-dem":return Dn;case"vector":return Ka;case"video":return el;case"canvas":return bs}return tl[d]},ln="RTLPluginLoaded";class il extends h.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=tt()}_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 h._(this,arguments,void 0,(function*(n,a=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=Ze.resolveURL(n),!this.url)throw new Error(`requested url ${n} is invalid`);if(this.status==="unavailable"){if(!a)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()}))}_requestImport(){return h._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new h.n(ln))}))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let ws=null;function zn(){return ws||(ws=new il),ws}var Pr,Ki;(function(d){d[d.Base=0]="Base",d[d.Parent=1]="Parent"})(Pr||(Pr={})),(function(d){d[d.Departing=0]="Departing",d[d.Incoming=1]="Incoming"})(Ki||(Ki={}));class wo{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=h.ad(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading"}isRenderable(t){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:n,fadingParentID:a,fadeEndTime:c}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=n,this.fadingParentID=a,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=je(),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,a){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 x of c){const w=x.layerIds.map((S=>f.getLayer(S))).filter(Boolean);if(w.length!==0){x.layers=w,x.stateDependentLayerIds&&(x.stateDependentLayers=x.stateDependentLayerIds.map((S=>w.filter((P=>P.id===S))[0])));for(const S of w)y[S.id]=x}}return y})(t.buckets,n?.style),this.hasSymbolBuckets=!1;for(const c in this.buckets){const f=this.buckets[c];if(f instanceof h.af){if(this.hasSymbolBuckets=!0,!a)break;f.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const c in this.buckets){const f=this.buckets[c];if(f instanceof h.af&&f.hasRTLText){this.hasRTLText=!0,zn().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 h.ae;else this.state="loaded"}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const a in this.buckets){const c=this.buckets[a];c.uploadPending()&&c.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new h.T(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new h.T(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,a,c,f,y,x,w,S,P,E){var C;return!((C=this.latestFeatureIndex)===null||C===void 0)&&C.rawTileData?this.latestFeatureIndex.query({queryGeometry:c,cameraQueryGeometry:f,scale:y,tileSize:this.tileSize,pixelPosMatrix:P,transform:w,params:x,queryPadding:this.queryPadding*S,getElevation:E},t,n,a):{}}querySourceFeatures(t,n){const a=this.latestFeatureIndex;if(!a?.rawTileData)return;const c=a.loadVTLayers(),f=n?.sourceLayer?n.sourceLayer:"",y=c[h.ag]||c[f];if(!y)return;const x=h.ah(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(x.needGeometry){const $=h.ai(z,!0);if(!x.filter(new h.J(this.tileID.overscaledZ),$,this.tileID.canonical))continue}else if(!x.filter(new h.J(this.tileID.overscaledZ),z))continue;const O=a.getId(z,f),j=new h.aj(z,w,S,P,O);j.tile=E,t.push(j)}}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 a=h.ak(t.cacheControl);a["max-age"]&&(this.expirationTime=Date.now()+1e3*a["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const a=Date.now();let c=!1;if(this.expirationTime>a)c=!1;else if(n)if(this.expirationTime<n)c=!0;else{const f=this.expirationTime-n;f?this.expirationTime=a+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){var a,c,f;if(!(!((a=this.latestFeatureIndex)===null||a===void 0)&&a.rawTileData)||Object.keys(t).length===0)return;const y=this.latestFeatureIndex.loadVTLayers();for(const x in this.buckets){if(!n.style.hasLayer(x))continue;const w=this.buckets[x],S=w.layers[0].sourceLayer||h.ag,P=y[S],E=t[S];if(!P||!E||Object.keys(E).length===0)continue;w.update(E,P,((c=this.imageAtlas)===null||c===void 0?void 0:c.patternPositions)||{},this.dashPositions||{});const C=(f=n?.style)===null||f===void 0?void 0:f.getLayer(x);C&&(this.queryPadding=Math.max(this.queryPadding,C.queryRadius(w)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<je()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=je()+t}setDependencies(t,n){const a={};for(const c of n)a[c]=!0;this.dependencies[t]=a}hasDependency(t,n){for(const a of t){const c=this.dependencies[a];if(c){for(const f of n)if(c[f])return!0}}return!1}}class Ts{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(t,n,a){var c,f,y,x,w;const S=String(n);if((x=this.stateChanges)[t]||(x[t]={}),(w=this.stateChanges[t])[S]||(w[S]={}),h.e(this.stateChanges[t][S],a),this.deletedStates[t]===null){this.deletedStates[t]={};for(const P in this.state[t])P!==S&&(this.deletedStates[t][P]=null)}else if(((c=this.deletedStates[t])===null||c===void 0?void 0:c[S])===null){this.deletedStates[t][S]={};for(const P in this.state[t][S])a[P]||(this.deletedStates[t][S][P]=null)}else for(const P in a)((y=(f=this.deletedStates[t])===null||f===void 0?void 0:f[S])===null||y===void 0?void 0:y[P])===null&&delete this.deletedStates[t][S][P]}removeFeatureState(t,n,a){var c,f,y;if(this.deletedStates[t]===null)return;const x=String(n);if((f=this.deletedStates)[t]||(f[t]={}),a&&n!==void 0)this.deletedStates[t][x]!==null&&((y=this.deletedStates[t])[x]||(y[x]={}),this.deletedStates[t][x][a]=null);else if(n!==void 0)if(!((c=this.stateChanges[t])===null||c===void 0)&&c[x])for(a in this.deletedStates[t][x]={},this.stateChanges[t][x])this.deletedStates[t][x][a]=null;else this.deletedStates[t][x]=null;else this.deletedStates[t]=null}getState(t,n){const a=String(n),c=h.e({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);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){var a,c,f;const y={};for(const x in this.stateChanges){(a=this.state)[x]||(a[x]={});const w={};for(const S in this.stateChanges[x])(c=this.state[x])[S]||(c[S]={}),h.e(this.state[x][S],this.stateChanges[x][S]),w[S]=this.state[x][S];y[x]=w}for(const x in this.deletedStates){(f=this.state)[x]||(f[x]={});const w={};if(this.deletedStates[x]===null)for(const S in this.state[x])w[S]={},this.state[x][S]={};else for(const S in this.deletedStates[x]){if(this.deletedStates[x][S]===null)this.state[x][S]={};else for(const P of Object.keys(this.deletedStates[x][S]))delete this.state[x][S][P];w[S]=this.state[x][S]}y[x]||(y[x]={}),h.e(y[x],w)}this.stateChanges={},this.deletedStates={},Object.keys(y).length!==0&&(this.revision++,t.setFeatureState(y,n))}}const kn=89.25;function ce(d,t){const n=h.al(t.lat,-h.am,h.am);return new h.P(h.Z(t.lng)*d,h.Y(n)*d)}function Rn(d,t){return new h.a7(t.x/d,t.y/d).toLngLat()}function Ss(d){return d.cameraToCenterDistance*Math.min(.85*Math.tan(h.an(90-d.pitch)),Math.tan(h.an(kn-d.pitch)))}function ct(d,t){const n=d.canonical,a=t/h.ao(n.z),c=n.x+Math.pow(2,n.z)*d.wrap,f=h.ap(new Float64Array(16));return h.Q(f,f,[c*a,n.y*a,0]),h.S(f,f,[a/h.a6,a/h.a6,1]),f}function ji(d,t,n,a,c){const f=h.a7.fromLngLat(d,t),y=c*h.aq(1,d.lat),{x,y:w,z:S}=To(n,a);return new h.a7(f.x+y*-x,f.y+y*-w,f.z+y*-S)}function To(d,t){const n=h.an(d),a=h.an(t),c=Math.cos(-n),f=Math.sin(n);return{x:f*Math.sin(a),y:-f*Math.cos(a),z:c}}function Tc(d,t,n){const a=t.intersectsFrustum(d);if(!n||a===0)return a;const c=t.intersectsPlane(n);return c===0?0:a===2&&c===2?2:1}function Sc(d,t,n){let a=0;const c=(n-t)/10;for(let f=0;f<10;f++)a+=c*Math.pow(Math.cos(t+(f+.5)/10*(n-t)),d);return a}function rl(d,t){return function(n,a,c,f,y){const x=2*((d-1)/h.ar(Math.cos(h.an(kn-y))/Math.cos(h.an(kn)))-1),w=Math.acos(c/f),S=2*Sc(x-1,0,h.an(y/2)),P=Math.min(h.an(kn),w+h.an(y/2)),E=Sc(x-1,Math.min(P,w-h.an(y/2)),P),C=Math.atan(a/c),z=Math.hypot(a,c);let O=n;return O+=h.ar(f/z/Math.max(.5,Math.cos(h.an(y/2)))),O+=x*h.ar(Math.cos(C))/2,O-=h.ar(Math.max(1,E/S/t))/2,O}}const So=rl(9.314,3);function Po(d,t){const n=(t.roundZoom?Math.round:Math.floor)(d.zoom+h.ar(d.tileSize/t.tileSize));return Math.max(0,n)}function cn(d,t){const n=d.getCameraFrustum(),a=d.getClippingPlane(),c=d.screenPointToMercatorCoordinate(d.getCameraPoint()),f=h.a7.fromLngLat(d.center,d.elevation);c.z=f.z+Math.cos(d.pitchInRadians)*d.cameraToCenterDistance/d.worldSize;const y=d.getCoveringTilesDetailsProvider(),x=y.allowVariableZoom(d,t),w=Po(d,t),S=t.minzoom||0,P=t.maxzoom!==void 0?t.maxzoom:d.maxZoom,E=Math.min(Math.max(0,w),P),C=Math.pow(2,E),z=[C*c.x,C*c.y,0],O=[C*f.x,C*f.y,0],j=Math.hypot(f.x-c.x,f.y-c.y),$=Math.abs(f.z-c.z),U=Math.hypot(j,$),q=G=>({zoom:0,x:0,y:0,wrap:G,fullyVisible:!1}),Y=[],Z=[];if(d.renderWorldCopies&&y.allowWorldCopies())for(let G=1;G<=3;G++)Y.push(q(-G)),Y.push(q(G));for(Y.push(q(0));Y.length>0;){const G=Y.pop(),X=G.x,W=G.y;let ee=G.fullyVisible;const ue={x:X,y:W,z:G.zoom},oe=y.getTileBoundingVolume(ue,G.wrap,d.elevation,t);if(!ee){const Ie=Tc(n,oe,a);if(Ie===0)continue;ee=Ie===2}const _e=y.distanceToTile2d(c.x,c.y,ue,oe);let ye=w;x&&(ye=(t.calculateTileZoom||So)(d.zoom+h.ar(d.tileSize/t.tileSize),_e,$,U,d.fov)),ye=(t.roundZoom?Math.round:Math.floor)(ye),ye=Math.max(0,ye);const ze=Math.min(ye,P);if(G.wrap=y.getWrap(f,ue,G.wrap),G.zoom>=ze){if(G.zoom<S)continue;const Ie=E-G.zoom,me=z[0]-.5-(X<<Ie),ke=z[1]-.5-(W<<Ie),Re=t.reparseOverscaled?Math.max(G.zoom,ye):G.zoom;Z.push({tileID:new h.a3(G.zoom===P?Re:G.zoom,G.wrap,G.zoom,X,W),distanceSq:h.as([O[0]-.5-X,O[1]-.5-W]),tileDistanceToCamera:Math.sqrt(me*me+ke*ke)})}else for(let Ie=0;Ie<4;Ie++)Y.push({zoom:G.zoom+1,x:(X<<1)+Ie%2,y:(W<<1)+(Ie>>1),wrap:G.wrap,fullyVisible:ee})}return Z.sort(((G,X)=>G.distanceSq-X.distanceSq)).map((G=>G.tileID))}const Se=h.a8.fromPoints([new h.P(0,0),new h.P(h.a6,h.a6)]);function un(d){return d==="raster"||d==="image"||d==="video"}function mr(d,t,n,a,c,f,y){if(!t.hasData())return!1;const{tileID:x,fadingRole:w,fadingDirection:S,fadingParentID:P}=t;if(w===Pr.Base&&S===Ki.Incoming&&P)return n[P.key]=P,!0;const E=Math.max(x.overscaledZ-c,f);for(let C=x.overscaledZ-1;C>=E;C--){const z=x.scaledTo(C),O=d.getLoadedTile(z);if(O)return t.setCrossFadeLogic({fadingRole:Pr.Base,fadingDirection:Ki.Incoming,fadingParentID:O.tileID,fadeEndTime:a+y}),O.setCrossFadeLogic({fadingRole:Pr.Parent,fadingDirection:Ki.Departing,fadeEndTime:a+y}),n[z.key]=z,!0}return!1}function nl(d,t,n,a,c,f){if(!t.hasData())return!1;const y=t.tileID.children(c);let x=Ln(d,t,y,n,a,c,f);if(x)return!0;for(const w of y)Ln(d,t,w.children(c),n,a,c,f)&&(x=!0);return x}function Ln(d,t,n,a,c,f,y){if(n[0].overscaledZ>=f)return!1;let x=!1;for(const w of n){const S=d.getLoadedTile(w);if(!S)continue;const{fadingRole:P,fadingDirection:E,fadingParentID:C}=S;P===Pr.Base&&E===Ki.Departing&&C||(S.setCrossFadeLogic({fadingRole:Pr.Base,fadingDirection:Ki.Departing,fadingParentID:t.tileID,fadeEndTime:c+y}),t.setCrossFadeLogic({fadingRole:Pr.Parent,fadingDirection:Ki.Incoming,fadeEndTime:c+y})),a[w.key]=w,x=!0}return x}function Ce(d,t,n,a){const c=d.tileID;return!!d.selfFading||!d.hasData()&&!!t.has(c)&&(d.setSelfFadeLogic(n+a),!0)}function Ne(d,t){var n;d.needsHillshadePrepare=!0,d.needsTerrainPrepare=!0;let a=t.tileID.canonical.x-d.tileID.canonical.x;const c=t.tileID.canonical.y-d.tileID.canonical.y,f=Math.pow(2,d.tileID.canonical.z),y=t.tileID.key;a===0&&c===0||Math.abs(c)>1||(Math.abs(a)>1&&(Math.abs(a+f)===1?a+=f:Math.abs(a-f)===1&&(a-=f)),t.dem&&d.dem&&(d.dem.backfillBorder(t.dem,a,c),!((n=d.neighboringTiles)===null||n===void 0)&&n[y]&&(d.neighboringTiles[y].backfilled=!0)))}class We{constructor(){this._tiles={}}handleWrapJump(t){const n={};for(const a in this._tiles){const c=this._tiles[a];c.tileID=c.tileID.unwrapTo(c.tileID.wrap+t),n[c.tileID.key]=c}this._tiles=n}setFeatureState(t,n){for(const a in this._tiles)this._tiles[a].setFeatureState(t,n)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map((n=>n.tileID)).sort(h.au).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 a;return(a=this.getTileById(t))===null||a===void 0?void 0:a.isRenderable(n)}getRenderableIds(t=0,n){const a=[];for(const c of this.getAllIds())this.isIdRenderable(c,n)&&a.push(this.getTileById(c));return n?a.sort(((c,f)=>{const y=c.tileID,x=f.tileID,w=new h.P(y.canonical.x,y.canonical.y)._rotate(-t),S=new h.P(x.canonical.x,x.canonical.y)._rotate(-t);return y.overscaledZ-x.overscaledZ||S.y-w.y||S.x-w.x})).map((c=>c.tileID.key)):a.map((c=>c.tileID)).sort(h.au).map((c=>c.key))}}class Jt extends h.E{constructor(t,n,a){super(),this.id=t,this.dispatcher=a,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,x)=>{const w=new(bo(f.type))(c,f,y,x);if(w.id!==c)throw new Error(`Expected Source id to be ${c} instead of ${w.id}`);return w})(t,n,a,this),this._inViewTiles=new We,this._outOfViewCache=new h.av(0,(c=>this._unloadTile(c))),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new Ts,this._didEmitContent=!1,this._updated=!1}onAdd(t){var n;this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,!((n=this._source)===null||n===void 0)&&n.onAdd&&this._source.onAdd(t)}onRemove(t){var n;for(const a of this._inViewTiles.getAllTiles())a.unloadVectorData();this.clearTiles(),!((n=this._source)===null||n===void 0)&&n.onRemove&&this._source.onRemove(t),this._inViewTiles=new We}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,a){return h._(this,void 0,void 0,(function*(){try{const c=yield this._source.loadTile(t);this._tileLoaded(t,n,a,c)}catch(c){t.state="errored",c.status!==404?this._source.fire(new h.l(h.d(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 h.n("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 a=this.getLoadedTile(t.scaledTo(n));if(a)return this._inViewTiles.isIdRenderable(a.tileID.key)}return!1}reload(t,n=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(const a of this._inViewTiles.getAllIds()){const c=this._inViewTiles.getTileById(a);n&&!this._source.shouldReloadTile(c,n)||(t?this._reloadTile(a,"expired"):c.state!=="errored"&&this._reloadTile(a,"reloading"))}}}_reloadTile(t,n){return h._(this,void 0,void 0,(function*(){const a=this._inViewTiles.getTileById(t);a&&(a.state!=="loading"&&(a.state=n),yield this._loadTile(a,t,n))}))}_tileLoaded(t,n,a,c){t.timeAdded=je(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration),a==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),c?.unmodified||(this.getSource().type==="raster-dem"&&t.dem&&(function(f,y){var x,w,S;const P=y.getRenderableIds();for(const E of P){if(!(!((x=f.neighboringTiles)===null||x===void 0)&&x[E]))continue;const C=y.getTileById(E);f.neighboringTiles[E].backfilled||Ne(f,C),!((S=(w=C.neighboringTiles)===null||w===void 0?void 0:w[f.tileID.key])===null||S===void 0)&&S.backfilled||Ne(C,f)}})(t,this._inViewTiles),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new h.n("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 a=this._getLoadedDescendents(n),c=new Set;for(const f of n){const y=a[f.key];if(!y?.length){c.add(f);continue}const x=f.overscaledZ+Jt.maxOverzooming,w=y.filter((E=>E.tileID.overscaledZ<=x));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 a={};for(const c of this._inViewTiles.getAllTiles().filter((f=>f.hasData())))for(const f of t)c.tileID.isChildOf(f)&&(a[n=f.key]||(a[n]=[]),a[f.key].push(c));return a}_areDescendentsComplete(t,n,a){return t.length===1&&t[0].isOverscaled()?t[0].overscaledZ===n:Math.pow(4,n-a)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,a=Math.ceil(t.height/this._source.tileSize)+1,c=Math.floor(n*a*(this._maxTileCacheZoomLevels===null?h.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 a;this.transform=t,this.terrain=n,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((w=>new h.a3(w.canonical.z,w.wrap,w.canonical.z,w.canonical.x,w.canonical.y))):(a=cn(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&&(a=a.filter((w=>this._source.hasTile(w))))):a=[],this.usedForTerrain&&(a=this._addTerrainIdealTiles(a));const c=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,c&&this.fire(new h.n("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const f=Po(t,this._source),y=this._updateRetainedTiles(a,f),x=un(this._source.type);x&&this._rasterFadeDuration>0&&!n&&(function(w,S,P,E,C,z,O){const j=je(),$=h.at(S);for(const U of S){const q=w.getTileById(U.key);q.fadingDirection!==Ki.Departing&&q.fadeOpacity!==0||q.resetFadeLogic(),mr(w,q,P,j,E,C,O)||nl(w,q,P,j,z,O)||Ce(q,$,j,O)||q.resetFadeLogic()}})(this._inViewTiles,a,y,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),x?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 a=this._inViewTiles.getTileById(n);t[n]?a.clearSymbolFadeHold():a.hasSymbolBuckets?a.holdingForSymbolFade()?a.symbolFadeFinished()&&this._removeTile(n):a.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(n)}}_addTerrainIdealTiles(t){const n=[];for(const a of t)if(a.canonical.z>this._source.minzoom){const c=a.scaledTo(a.canonical.z-1);n.push(c);const f=a.scaledTo(Math.max(this._source.minzoom,Math.min(a.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 a;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),x={},w=Math.max(n-Jt.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(x[z.key])break;if(x[z.key]=!0,P=this.getTile(z),!P&&E&&(P=this._addTile(z)),P){const O=P.hasData();if((O||!(!((a=this.map)===null||a===void 0)&&a.cancelPendingTileRequestsWhileZooming)||E)&&(f[z.key]=z),E=P.wasRequested(),O)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 a=n;return n||(n=new wo(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,t.key,n.state)),n.uses++,this._inViewTiles.setTile(t.key,n),a||this._source.fire(new h.n("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){this._clearTileReloadTimer(t);const a=n.getExpiryTimeout();a&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),a))}_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 a=this._inViewTiles.getTileById(n);(this._inViewTiles.isIdRenderable(n)||a.state=="errored")&&t.some((c=>c.equals(a.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,a){const c=[],f=this.transform;if(!f)return c;const y=f.getCoveringTilesDetailsProvider().allowWorldCopies(),x=a?f.getCameraQueryGeometry(t):t,w=z=>f.screenPointToMercatorCoordinate(z,this.terrain),S=this.transformBbox(t,w,!y),P=this.transformBbox(x,w,!y),E=this.getIds(),C=h.a8.fromPoints(P);for(const z of E){const O=this._inViewTiles.getTileById(z);if(O.holdingForSymbolFade())continue;const j=y?[O.tileID]:[O.tileID.unwrapTo(-1),O.tileID.unwrapTo(0)],$=Math.pow(2,f.zoom-O.tileID.overscaledZ),U=n*O.queryPadding*h.a6/O.tileSize/$;for(const q of j){const Y=C.map((Z=>q.getTilePoint(new h.a7(Z.x,Z.y))));if(Y.expandBy(U),Y.intersects(Se)){const Z=S.map((X=>q.getTilePoint(X))),G=P.map((X=>q.getTilePoint(X)));c.push({tile:O,tileID:y?q:q.unwrapTo(0),queryGeometry:Z,cameraQueryGeometry:G,scale:$})}}}return c}transformBbox(t,n,a){let c=t.map(n);if(a){const f=h.a8.fromPoints(t);f.shrinkBy(.001*Math.min(f.width(),f.height()));const y=f.map(n);h.a8.fromPoints(c).covers(y)||(c=c.map((x=>x.x>.5?new h.a7(x.x-1,x.y,x.z):x)))}return c}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map((a=>this._inViewTiles.getTileById(a).tileID));return this.transform&&this.transform.populateCache(n),n}hasTransition(){return!!this._source.hasTransition()||un(this._source.type)&&(function(t,n){if(n<=0)return!1;const a=je();for(const c of t.getAllTiles())if(c.fadeEndTime>=a)return!0;return!1})(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,n,a){t||(t=h.ag),this._state.updateState(t,n,a)}removeFeatureState(t,n,a){t||(t=h.ag),this._state.removeFeatureState(t,n,a)}getFeatureState(t,n){return t||(t=h.ag),this._state.getState(t,n)}setDependencies(t,n,a){const c=this._inViewTiles.getTileById(t);c&&c.setDependencies(n,a)}reloadTilesForDependencies(t,n){for(const a of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(a).hasDependency(t,n)&&this._reloadTile(a,"reloading");this._outOfViewCache.filter((a=>!a.hasDependency(t,n)))}areTilesLoaded(){for(const t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}}Jt.maxUnderzooming=10,Jt.maxOverzooming=3;class Io{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let a=1;a<this.points.length;a++)this._distances[a]=this._distances[a-1]+this.points[a].dist(this.points[a-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=h.al(t,0,1);let n=1,a=this._distances[n];const c=t*this.paddedLength+this.padding;for(;a<c&&n<this._distances.length;)a=this._distances[++n];const f=n-1,y=this._distances[f],x=a-y,w=x>0?(c-y)/x:0;return this.points[f].mult(1-w).add(this.points[n].mult(w))}}function gr(d,t){let n=!0;return d==="always"||d!=="never"&&t!=="never"||(n=!1),n}class qe{constructor(t,n,a){const c=this.boxCells=[],f=this.circleCells=[];this.xCellCount=Math.ceil(t/a),this.yCellCount=Math.ceil(n/a);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,a,c,f){this._forEachCell(n,a,c,f,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(c),this.bboxes.push(f)}insertCircle(t,n,a,c){this._forEachCell(n-c,a-c,n+c,a+c,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(a),this.circles.push(c)}_insertBoxCell(t,n,a,c,f,y){this.boxCells[f].push(y)}_insertCircleCell(t,n,a,c,f,y){this.circleCells[f].push(y)}_query(t,n,a,c,f,y,x){if(a<0||t>this.width||c<0||n>this.height)return[];const w=[];if(t<=0&&n<=0&&this.width<=a&&this.height<=c){if(f)return[{key:null,x1:t,y1:n,x2:a,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,a,c,this._queryCell,w,{hitTest:f,overlapMode:y,seenUids:{box:{},circle:{}}},x);return w}query(t,n,a,c){return this._query(t,n,a,c,!1,null)}hitTest(t,n,a,c,f,y){return this._query(t,n,a,c,!0,f,y).length>0}hitTestCircle(t,n,a,c,f){const y=t-a,x=t+a,w=n-a,S=n+a;if(x<0||y>this.width||S<0||w>this.height)return!1;const P=[];return this._forEachCell(y,w,x,S,this._queryCellCircle,P,{hitTest:!0,overlapMode:c,circle:{x:t,y:n,radius:a},seenUids:{box:{},circle:{}}},f),P.length>0}_queryCell(t,n,a,c,f,y,x,w){const{seenUids:S,hitTest:P,overlapMode:E}=x,C=this.boxCells[f],z=1e-6;if(C!==null){const j=this.bboxes;for(const $ of C)if(!S.box[$]){S.box[$]=!0;const U=4*$,q=this.boxKeys[$];if(t<=j[U+2]+z&&n<=j[U+3]+z&&a>=j[U+0]-z&&c>=j[U+1]-z&&(!w||w(q))&&(!P||!gr(E,q.overlapMode))&&(y.push({key:q,x1:j[U],y1:j[U+1],x2:j[U+2],y2:j[U+3]}),P))return!0}}const O=this.circleCells[f];if(O!==null){const j=this.circles;for(const $ of O)if(!S.circle[$]){S.circle[$]=!0;const U=3*$,q=this.circleKeys[$];if(this._circleAndRectCollide(j[U],j[U+1],j[U+2],t,n,a,c)&&(!w||w(q))&&(!P||!gr(E,q.overlapMode))){const Y=j[U],Z=j[U+1],G=j[U+2];if(y.push({key:q,x1:Y-G,y1:Z-G,x2:Y+G,y2:Z+G}),P)return!0}}}return!1}_queryCellCircle(t,n,a,c,f,y,x,w){const{circle:S,seenUids:P,overlapMode:E}=x,C=this.boxCells[f];if(C!==null){const O=this.bboxes;for(const j of C)if(!P.box[j]){P.box[j]=!0;const $=4*j,U=this.boxKeys[j];if(this._circleAndRectCollide(S.x,S.y,S.radius,O[$+0],O[$+1],O[$+2],O[$+3])&&(!w||w(U))&&!gr(E,U.overlapMode))return y.push(!0),!0}}const z=this.circleCells[f];if(z!==null){const O=this.circles;for(const j of z)if(!P.circle[j]){P.circle[j]=!0;const $=3*j,U=this.circleKeys[j];if(this._circlesCollide(O[$],O[$+1],O[$+2],S.x,S.y,S.radius)&&(!w||w(U))&&!gr(E,U.overlapMode))return y.push(!0),!0}}}_forEachCell(t,n,a,c,f,y,x,w){const S=this._convertToXCellCoord(t),P=this._convertToYCellCoord(n),E=this._convertToXCellCoord(a),C=this._convertToYCellCoord(c);for(let z=S;z<=E;z++)for(let O=P;O<=C;O++)if(f.call(this,t,n,a,c,this.xCellCount*O+z,y,x,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,a,c,f,y){const x=c-t,w=f-n,S=a+y;return S*S>x*x+w*w}_circleAndRectCollide(t,n,a,c,f,y,x){const w=(y-c)/2,S=Math.abs(t-(c+w));if(S>w+a)return!1;const P=(x-f)/2,E=Math.abs(n-(f+P));if(E>P+a)return!1;if(S<=w||E<=P)return!0;const C=S-w,z=E-P;return C*C+z*z<=a*a}}function Mo(d,t){const n=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),a=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),c=t[0]*n,f=t[4]*n,y=t[8]*a,x=t[1]*n,w=t[5]*n,S=t[9]*a,P=t[2]*n,E=t[6]*n,C=t[10]*a;d[0]=c,d[1]=f,d[2]=y,d[4]=x,d[5]=w,d[6]=S,d[8]=P,d[9]=E,d[10]=C;const z=t[12],O=t[13],j=t[14];return d[12]=-c*z-x*O-P*j,d[13]=-f*z-w*O-E*j,d[14]=-y*z-S*O-C*j,d[3]=0,d[7]=0,d[11]=0,d[15]=1,d}const Ps=h.O();function Fn(d,t,n){const a=h.O();if(!d){const{vecSouth:E,vecEast:C}=Bn(t),z=$e();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])*(x=f[1]))&&(c[0]=S*(P=1/P),c[1]=-x*P,c[2]=-w*P,c[3]=y*P),a[0]=z[0],a[1]=z[1],a[4]=z[2],a[5]=z[3]}var c,f,y,x,w,S,P;return h.S(a,a,[1/n,1/n,1]),a}function Is(d,t,n,a){if(d){const c=h.O();if(!t){const{vecSouth:f,vecEast:y}=Bn(n);c[0]=y[0],c[1]=y[1],c[4]=f[0],c[5]=f[1]}return h.S(c,c,[a,a,1]),c}return n.pixelsToClipSpaceMatrix}function Bn(d){const t=Math.cos(d.rollInRadians),n=Math.sin(d.rollInRadians),a=Math.cos(d.pitchInRadians),c=Math.cos(d.bearingInRadians),f=Math.sin(d.bearingInRadians),y=h.az();y[0]=-c*a*n-f*t,y[1]=-f*a*n+c*t;const x=h.aA(y);x<1e-9?h.aB(y):h.aC(y,y,1/x);const w=h.az();w[0]=c*a*t-f*n,w[1]=f*a*t+c*n;const S=h.aA(w);return S<1e-9?h.aB(w):h.aC(w,w,1/S),{vecEast:w,vecSouth:y}}function hn(d,t,n,a){let c;a?(c=[d,t,a(d,t),1],h.aE(c,c,n)):(c=[d,t,0,1],Ao(c,c,n));const f=c[3];return{point:new h.P(c[0]/f,c[1]/f),signedDistanceFromCamera:f,isOccluded:!1}}function Ms(d,t){return .5+d/t*.5}function wi(d,t){return d.x>=-t[0]&&d.x<=t[0]&&d.y>=-t[1]&&d.y<=t[1]}function It(d,t,n,a,c,f,y,x,w,S,P,E,C){const z=n?d.textSizeData:d.iconSizeData,O=h.aw(z,t.transform.zoom),j=[256/t.width*2+1,256/t.height*2+1],$=n?d.text.dynamicLayoutVertexArray:d.icon.dynamicLayoutVertexArray;$.clear();const U=d.lineVertexArray,q=n?d.text.placedSymbolArray:d.icon.placedSymbolArray,Y=t.transform.width/t.transform.height;let Z=!1;for(let G=0;G<q.length;G++){const X=q.get(G);if(X.hidden||X.writingMode===h.ax.vertical&&!Z){Vn(X.numGlyphs,$);continue}Z=!1;const W=new h.P(X.anchorX,X.anchorY),ee={getElevation:C,pitchedLabelPlaneMatrix:a,lineVertexArray:U,pitchWithMap:f,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:W,unwrappedTileID:w,width:S,height:P,translation:E},ue=sl(X.anchorX,X.anchorY,ee);if(!wi(ue.point,j)){Vn(X.numGlyphs,$);continue}const oe=Ms(t.transform.cameraToCenterDistance,ue.signedDistanceFromCamera),_e=h.ay(z,O,X),ye=f?_e*t.transform.getPitchedTextCorrection(X.anchorX,X.anchorY,w)/oe:_e*oe,ze=Eo({projectionContext:ee,pitchedLabelPlaneMatrixInverse:c,symbol:X,fontSize:ye,flip:!1,keepUpright:y,glyphOffsetArray:d.glyphOffsetArray,dynamicLayoutVertexArray:$,aspectRatio:Y,rotateToLine:x});Z=ze.useVertical,(ze.notEnoughRoom||Z||ze.needsFlipping&&Eo({projectionContext:ee,pitchedLabelPlaneMatrixInverse:c,symbol:X,fontSize:ye,flip:!0,keepUpright:y,glyphOffsetArray:d.glyphOffsetArray,dynamicLayoutVertexArray:$,aspectRatio:Y,rotateToLine:x}).notEnoughRoom)&&Vn(X.numGlyphs,$)}n?d.text.dynamicLayoutVertexBuffer.updateData($):d.icon.dynamicLayoutVertexBuffer.updateData($)}function Pc(d,t,n,a,c,f,y,x){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=Co(d*E,n,a,c,f.segment,S,P,x,y);if(!z)return null;const O=Co(d*C,n,a,c,f.segment,S,P,x,y);return O?x.projectionCache.anyProjectionOccluded?null:{first:z,last:O}:null}function On(d,t,n,a){return d===h.ax.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*a?{useVertical:!0}:(d===h.ax.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function Eo(d){const{projectionContext:t,pitchedLabelPlaneMatrixInverse:n,symbol:a,fontSize:c,flip:f,keepUpright:y,glyphOffsetArray:x,dynamicLayoutVertexArray:w,aspectRatio:S,rotateToLine:P}=d,E=c/24,C=a.lineOffsetX*E,z=a.lineOffsetY*E;let O;if(a.numGlyphs>1){const j=a.glyphStartIndex+a.numGlyphs,$=a.lineStartIndex,U=a.lineStartIndex+a.lineLength,q=Pc(E,x,C,z,f,a,P,t);if(!q)return{notEnoughRoom:!0};const Y=Es(q.first.point.x,q.first.point.y,t,n),Z=Es(q.last.point.x,q.last.point.y,t,n);if(y&&!f){const G=On(a.writingMode,Y,Z,S);if(G)return G}O=[q.first];for(let G=a.glyphStartIndex+1;G<j-1;G++){const X=Co(E*x.getoffsetX(G),C,z,f,a.segment,$,U,t,P);if(!X)return{notEnoughRoom:!0};O.push(X)}O.push(q.last)}else{if(y&&!f){const $=Nr(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,U=a.lineStartIndex+a.segment+1,q=new h.P(t.lineVertexArray.getx(U),t.lineVertexArray.gety(U)),Y=Nr(q.x,q.y,t),Z=Y.signedDistanceFromCamera>0?Y.point:jr(t.tileAnchorPoint,q,$,1,t),G=Es($.x,$.y,t,n),X=Es(Z.x,Z.y,t,n),W=On(a.writingMode,G,X,S);if(W)return W}const j=Co(E*x.getoffsetX(a.glyphStartIndex),C,z,f,a.segment,a.lineStartIndex,a.lineStartIndex+a.lineLength,t,P);if(!j||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};O=[j]}for(const j of O)h.aD(w,j.point,j.angle);return{}}function jr(d,t,n,a,c){const f=d.add(d.sub(t)._unit()),y=Nr(f.x,f.y,c).point,x=n.sub(y);return n.add(x._mult(a/x.mag()))}function _r(d,t,n){const a=t.projectionCache;if(a.projections[d])return a.projections[d];const c=new h.P(t.lineVertexArray.getx(d),t.lineVertexArray.gety(d)),f=Nr(c.x,c.y,t);if(f.signedDistanceFromCamera>0)return a.projections[d]=f.point,a.anyProjectionOccluded||(a.anyProjectionOccluded=f.isOccluded),f.point;const y=d-n.direction;return jr(n.distanceFromAnchor===0?t.tileAnchorPoint:new h.P(t.lineVertexArray.getx(y),t.lineVertexArray.gety(y)),c,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,t)}function Nr(d,t,n){const a=d+n.translation[0],c=t+n.translation[1];let f;return n.pitchWithMap?(f=hn(a,c,n.pitchedLabelPlaneMatrix,n.getElevation),f.isOccluded=!1):(f=n.transform.projectTileCoordinates(a,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 Es(d,t,n,a){if(n.pitchWithMap){const c=[d,t,0,1];return h.aE(c,c,a),n.transform.projectTileCoordinates(c[0]/c[3],c[1]/c[3],n.unwrappedTileID,n.getElevation).point}return{x:d/n.width*2-1,y:1-t/n.height*2}}function sl(d,t,n){return n.transform.projectTileCoordinates(d,t,n.unwrappedTileID,n.getElevation)}function Ur(d,t,n){return d._unit()._perp()._mult(t*n)}function Ic(d,t,n,a,c,f,y,x,w){if(x.projectionCache.offsets[d])return x.projectionCache.offsets[d];const S=n.add(t);if(d+w.direction<a||d+w.direction>=c)return x.projectionCache.offsets[d]=S,S;const P=_r(d+w.direction,x,w),E=Ur(P.sub(n),y,w.direction),C=n.add(E),z=P.add(E);return x.projectionCache.offsets[d]=h.aF(f,S,C,z)||S,x.projectionCache.offsets[d]}function Co(d,t,n,a,c,f,y,x,w){const S=a?d-t:d+t;let P=S>0?1:-1,E=0;a&&(P*=-1,E=Math.PI),P<0&&(E+=Math.PI);let C,z=P>0?f+c:f+c+1;x.projectionCache.cachedAnchorPoint?C=x.projectionCache.cachedAnchorPoint:(C=Nr(x.tileAnchorPoint.x,x.tileAnchorPoint.y,x).point,x.projectionCache.cachedAnchorPoint=C);let O,j,$=C,U=C,q=0,Y=0;const Z=Math.abs(S),G=[];let X;for(;q+Y<=Z;){if(z+=P,z<f||z>=y)return null;q+=Y,U=$,j=O;const ue={absOffsetX:Z,direction:P,distanceFromAnchor:q,previousVertex:U};if($=_r(z,x,ue),n===0)G.push(U),X=$.sub(U);else{let oe;const _e=$.sub(U);oe=_e.mag()===0?Ur(_r(z+P,x,ue).sub($),n,P):Ur(_e,n,P),j||(j=U.add(oe)),O=Ic(z,oe,$,f,y,j,n,x,ue),G.push(j),X=O.sub(j)}Y=X.mag()}const W=X._mult((Z-q)/Y)._add(j||U),ee=E+Math.atan2($.y-U.y,$.x-U.x);return G.push(W),{point:W,angle:w?ee:0,path:G}}const Wu=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Vn(d,t){for(let n=0;n<d;n++){const a=t.length;t.resize(a+4),t.float32.set(Wu,3*a)}}function Ao(d,t,n){const a=t[0],c=t[1];return d[0]=n[0]*a+n[4]*c+n[12],d[1]=n[1]*a+n[5]*c+n[13],d[3]=n[3]*a+n[7]*c+n[15],d}const qt=100;class ol{constructor(t,n=new qe(t.width+200,t.height+200,25),a=new qe(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=a,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+qt,this.screenBottomBoundary=t.height+qt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,a,c,f,y,x,w,S,P,E,C){const z=this.projectAndGetPerspectiveRatio(t.anchorPointX+w[0],t.anchorPointY+w[1],f,P,C),O=a*z.perspectiveRatio;let j;if(y||x)j=this._projectCollisionBox(t,O,c,f,y,x,w,z,P,E,C);else{const X=z.x+(E?E.x*O:0),W=z.y+(E?E.y*O:0);j={allPointsOccluded:!1,box:[X+t.x1*O,W+t.y1*O,X+t.x2*O,W+t.y2*O]}}const[$,U,q,Y]=j.box,Z=y?j.allPointsOccluded:z.isOccluded;let G=Z;return G||(G=z.perspectiveRatio<this.perspectiveRatioCutoff),G||(G=!this.isInsideGrid($,U,q,Y)),G||n!=="always"&&this.grid.hitTest($,U,q,Y,n,S)?{box:[$,U,q,Y],placeable:!1,offscreen:!1,occluded:Z}:{box:[$,U,q,Y],placeable:!0,offscreen:this.isOffscreen($,U,q,Y),occluded:Z}}placeCollisionCircles(t,n,a,c,f,y,x,w,S,P,E,C,z,O){const j=[],$=new h.P(n.anchorX,n.anchorY),U=this.getPerspectiveRatio($.x,$.y,y,O),q=(S?f*this.transform.getPitchedTextCorrection(n.anchorX,n.anchorY,y)/U:f*U)/h.aJ,Y={getElevation:O,pitchedLabelPlaneMatrix:x,lineVertexArray:a,pitchWithMap:S,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:$,unwrappedTileID:y,width:this.transform.width,height:this.transform.height,translation:z},Z=Pc(q,c,n.lineOffsetX*q,n.lineOffsetY*q,!1,n,!1,Y);let G=!1,X=!1,W=!0;if(Z){const ee=.5*E*U+C,ue=new h.P(-100,-100),oe=new h.P(this.screenRightBoundary,this.screenBottomBoundary),_e=new Io,ye=Z.first,ze=Z.last;let Ie=[];for(let Re=ye.path.length-1;Re>=1;Re--)Ie.push(ye.path[Re]);for(let Re=1;Re<ze.path.length;Re++)Ie.push(ze.path[Re]);const me=2.5*ee;if(S){const Re=this.projectPathToScreenSpace(Ie,Y);Ie=Re.some((ut=>ut.signedDistanceFromCamera<=0))?[]:Re.map((ut=>ut.point))}let ke=[];if(Ie.length>0){const Re=Ie[0].clone(),ut=Ie[0].clone();for(let Dt=1;Dt<Ie.length;Dt++)Re.x=Math.min(Re.x,Ie[Dt].x),Re.y=Math.min(Re.y,Ie[Dt].y),ut.x=Math.max(ut.x,Ie[Dt].x),ut.y=Math.max(ut.y,Ie[Dt].y);ke=Re.x>=ue.x&&ut.x<=oe.x&&Re.y>=ue.y&&ut.y<=oe.y?[Ie]:ut.x<ue.x||Re.x>oe.x||ut.y<ue.y||Re.y>oe.y?[]:h.aG([Ie],ue.x,ue.y,oe.x,oe.y)}for(const Re of ke){_e.reset(Re,.25*ee);let ut=0;ut=_e.length<=.5*ee?1:Math.ceil(_e.paddedLength/me)+1;for(let Dt=0;Dt<ut;Dt++){const _t=Dt/Math.max(ut-1,1),Ft=_e.lerp(_t),Bt=Ft.x+qt,Zi=Ft.y+qt;j.push(Bt,Zi,ee,0);const Mt=Bt-ee,li=Zi-ee,wt=Bt+ee,Ht=Zi+ee;if(W&&(W=this.isOffscreen(Mt,li,wt,Ht)),X||(X=this.isInsideGrid(Mt,li,wt,Ht)),t!=="always"&&this.grid.hitTestCircle(Bt,Zi,ee,t,P)&&(G=!0,!w))return{circles:[],offscreen:!1,collisionDetected:G}}}}return{circles:!w&&G||!X||U<this.perspectiveRatioCutoff?[]:j,offscreen:W,collisionDetected:G}}projectPathToScreenSpace(t,n){const a=(function(c,f){const y=Ps;return(function(x,w){const S=1/(w[0]*w[5]-w[1]*w[4]);x[0]=w[5]*S,x[1]=-w[1]*S,x[2]=0,x[3]=0,x[4]=-w[4]*S,x[5]=w[0]*S,x[6]=0,x[7]=0,x[8]=0,x[9]=0,x[10]=1/w[10],x[11]=0,x[12]=0,x[13]=0,x[14]=0,x[15]=1/w[15]})(y,f.pitchedLabelPlaneMatrix),c.map((x=>{const w=hn(x.x,x.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,x=0,w=0;for(let S=0;S<c.length;S++)c[S].isOccluded?(x=S+1,w=0):(w++,w>y&&(y=w,f=x));return c.slice(f,f+y)})(a)}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[],a=new h.a8;for(const E of t){const C=new h.P(E.x+qt,E.y+qt);a.extend(C),n.push(C)}const{minX:c,minY:f,maxX:y,maxY:x}=a,w=this.grid.query(c,f,y,x).concat(this.ignoredGrid.query(c,f,y,x)),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 h.P(E.x1,E.y1),new h.P(E.x2,E.y1),new h.P(E.x2,E.y2),new h.P(E.x1,E.y2)];h.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,a,c,f,y){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:f,collisionGroupID:y,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,a,c,f,y){const x=a?this.ignoredGrid:this.grid,w={bucketInstanceId:c,featureIndex:f,collisionGroupID:y,overlapMode:n};for(let S=0;S<t.length;S+=4)x.insertCircle(w,t[S],t[S+1],t[S+2])}projectAndGetPerspectiveRatio(t,n,a,c,f){if(f){let y;c?(y=[t,n,c(t,n),1],h.aE(y,y,f)):(y=[t,n,0,1],Ao(y,y,f));const x=y[3];return{x:(y[0]/x+1)/2*this.transform.width+qt,y:(-y[1]/x+1)/2*this.transform.height+qt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/x*.5,isOccluded:!1,signedDistanceFromCamera:x}}{const y=this.transform.projectTileCoordinates(t,n,a,c);return{x:(y.point.x+1)/2*this.transform.width+qt,y:(1-y.point.y)/2*this.transform.height+qt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/y.signedDistanceFromCamera*.5,isOccluded:y.isOccluded,signedDistanceFromCamera:y.signedDistanceFromCamera}}}getPerspectiveRatio(t,n,a,c){const f=this.transform.projectTileCoordinates(t,n,a,c);return .5+this.transform.cameraToCenterDistance/f.signedDistanceFromCamera*.5}isOffscreen(t,n,a,c){return a<qt||t>=this.screenRightBoundary||c<qt||n>this.screenBottomBoundary}isInsideGrid(t,n,a,c){return a>=0&&t<this.gridRightBoundary&&c>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=h.ap([]);return h.Q(t,t,[-100,-100,0]),t}_projectCollisionBox(t,n,a,c,f,y,x,w,S,P,E){let C=1,z=0,O=0,j=1;const $=t.anchorPointX+x[0],U=t.anchorPointY+x[1];if(y&&!f){const Ie=this.projectAndGetPerspectiveRatio($+1,U,c,S,E),me=Ie.x-w.x,ke=Math.atan((Ie.y-w.y)/me)+(me<0?Math.PI:0),Re=Math.sin(ke),ut=Math.cos(ke);C=ut,z=Re,O=-Re,j=ut}else if(!y&&f){const Ie=Bn(this.transform);C=Ie.vecEast[0],z=Ie.vecEast[1],O=Ie.vecSouth[0],j=Ie.vecSouth[1]}let q=w.x,Y=w.y,Z=n;f&&(q=$,Y=U,Z=Math.pow(2,-(this.transform.zoom-a.overscaledZ)),Z*=this.transform.getPitchedTextCorrection($,U,c),P||(Z*=h.al(.5+w.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),P&&(q+=C*P.x*Z+O*P.y*Z,Y+=z*P.x*Z+j*P.y*Z);const G=t.x1*Z,X=t.x2*Z,W=(G+X)/2,ee=t.y1*Z,ue=t.y2*Z,oe=(ee+ue)/2,_e=[{offsetX:G,offsetY:ee},{offsetX:W,offsetY:ee},{offsetX:X,offsetY:ee},{offsetX:X,offsetY:oe},{offsetX:X,offsetY:ue},{offsetX:W,offsetY:ue},{offsetX:G,offsetY:ue},{offsetX:G,offsetY:oe}];let ye=[];for(const{offsetX:Ie,offsetY:me}of _e)ye.push(new h.P(q+C*Ie+O*me,Y+z*Ie+j*me));let ze=!1;if(f){const Ie=ye.map((me=>this.projectAndGetPerspectiveRatio(me.x,me.y,c,S,E)));ze=Ie.some((me=>!me.isOccluded)),ye=Ie.map((me=>new h.P(me.x,me.y)))}else ze=!0;return{box:h.aI(ye),allPointsOccluded:!ze}}}class Do{constructor(t,n,a,c){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):c&&a?1:0,this.placed=a}isHidden(){return this.opacity===0&&!this.placed}}class jn{constructor(t,n,a,c,f){this.text=new Do(t?t.text:null,n,a,f),this.icon=new Do(t?t.icon:null,n,c,f)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class zo{constructor(t,n,a){this.text=t,this.icon=n,this.skipFade=a}}class al{constructor(t,n,a,c,f){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=a,this.bucketIndex=c,this.tileID=f}}class Hu{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:a=>a.collisionGroupID===n}}return this.collisionGroups[t]}}function Nn(d,t,n,a,c){const{horizontalAlign:f,verticalAlign:y}=h.aP(d);return new h.P(-(f-.5)*t+a[0]*c,-(y-.5)*n+a[1]*c)}class ko{constructor(t,n,a,c,f){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new ol(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Hu(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?(a,c)=>n.getElevation(t,a,c):null}getBucketParts(t,n,a,c){const f=a.getBucket(n),y=a.latestFeatureIndex;if(!f||!y||n.id!==f.layerIds[0])return;const x=a.collisionBoxArray,w=f.layers[0].layout,S=f.layers[0].paint,P=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),E=a.tileSize/h.a6,C=a.tileID.toUnwrapped(),z=w.get("text-rotation-alignment")==="map",O=h.aK(a,1,this.transform.zoom),j=h.aL(this.collisionIndex.transform,a,S.get("text-translate"),S.get("text-translate-anchor")),$=h.aL(this.collisionIndex.transform,a,S.get("icon-translate"),S.get("icon-translate-anchor")),U=Fn(z,this.transform,O);this.retainedQueryData[f.bucketInstanceId]=new al(f.bucketInstanceId,y,f.sourceLayerIndex,f.index,a.tileID);const q={bucket:f,layout:w,translationText:j,translationIcon:$,unwrappedTileID:C,pitchedLabelPlaneMatrix:U,scale:P,textPixelRatio:E,holdingForFade:a.holdingForSymbolFade(),collisionBoxArray:x,partiallyEvaluatedTextSize:h.aw(f.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(f.sourceID)};if(c)for(const Y of f.sortKeyRanges){const{sortKey:Z,symbolInstanceStart:G,symbolInstanceEnd:X}=Y;t.push({sortKey:Z,symbolInstanceStart:G,symbolInstanceEnd:X,parameters:q})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:f.symbolInstances.length,parameters:q})}attemptAnchorPlacement(t,n,a,c,f,y,x,w,S,P,E,C,z,O,j,$,U,q,Y,Z){var G,X,W;const ee=h.aM[t.textAnchor],ue=[t.textOffset0,t.textOffset1],oe=Nn(ee,a,c,ue,f),_e=this.collisionIndex.placeCollisionBox(n,C,w,S,P,x,y,$,E.predicate,Y,oe,Z);if((!q||this.collisionIndex.placeCollisionBox(q,C,w,S,P,x,y,U,E.predicate,Y,oe,Z).placeable)&&_e.placeable){let ye;if(!((G=this.prevPlacement)===null||G===void 0)&&G.variableOffsets[z.crossTileID]&&(!((W=(X=this.prevPlacement)===null||X===void 0?void 0:X.placements[z.crossTileID])===null||W===void 0)&&W.text)&&(ye=this.prevPlacement.variableOffsets[z.crossTileID].anchor),z.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[z.crossTileID]={textOffset:ue,width:a,height:c,anchor:ee,textBoxScale:f,prevAnchor:ye},this.markUsedJustification(O,ee,z,j),O.allowVerticalPlacement&&(this.markUsedOrientation(O,j,z),this.placedOrientations[z.crossTileID]=j),{shift:oe,placedGlyphBoxes:_e}}}placeLayerBucketPart(t,n,a){const{bucket:c,layout:f,translationText:y,translationIcon:x,unwrappedTileID:w,pitchedLabelPlaneMatrix:S,textPixelRatio:P,holdingForFade:E,collisionBoxArray:C,partiallyEvaluatedTextSize:z,collisionGroup:O}=t.parameters,j=f.get("text-optional"),$=f.get("icon-optional"),U=h.aN(f,"text-overlap","text-allow-overlap"),q=U==="always",Y=h.aN(f,"icon-overlap","icon-allow-overlap"),Z=Y==="always",G=f.get("text-rotation-alignment")==="map",X=f.get("text-pitch-alignment")==="map",W=f.get("icon-text-fit")!=="none",ee=f.get("symbol-z-order")==="viewport-y",ue=q&&(Z||!c.hasIconData()||$),oe=Z&&(q||!c.hasTextData()||j);!c.collisionArrays&&C&&c.deserializeCollisionBoxes(C);const _e=this.retainedQueryData[c.bucketInstanceId].tileID,ye=this._getTerrainElevationFunc(_e),ze=this.transform.getFastPathSimpleProjectionMatrix(_e),Ie=(me,ke,Re)=>{var ut,Dt;if(n[me.crossTileID])return;if(E)return void(this.placements[me.crossTileID]=new zo(!1,!1,!1));let _t=!1,Ft=!1,Bt=!0,Zi=null,Mt={box:null,placeable:!1,offscreen:null,occluded:!1},li={placeable:!1},wt=null,Ht=null,Li=null,Kr=0,ls=0,xn=0;ke.textFeatureIndex?Kr=ke.textFeatureIndex:me.useRuntimeCollisionCircles&&(Kr=me.featureIndex),ke.verticalTextFeatureIndex&&(ls=ke.verticalTextFeatureIndex);const ir=ke.textBox;if(ir){const ci=Ot=>{let gi=h.ax.horizontal;if(c.allowVerticalPlacement&&!Ot&&this.prevPlacement){const Fi=this.prevPlacement.placedOrientations[me.crossTileID];Fi&&(this.placedOrientations[me.crossTileID]=Fi,gi=Fi,this.markUsedOrientation(c,gi,me))}return gi},Dr=(Ot,gi)=>{if(c.allowVerticalPlacement&&me.numVerticalGlyphVertices>0&&ke.verticalTextBox){for(const Fi of c.writingModes)if(Fi===h.ax.vertical?(Mt=gi(),li=Mt):Mt=Ot(),Mt?.placeable)break}else Mt=Ot()},xr=me.textAnchorOffsetStartIndex,bn=me.textAnchorOffsetEndIndex;if(bn===xr){const Ot=(gi,Fi)=>{const Tt=this.collisionIndex.placeCollisionBox(gi,U,P,_e,w,X,G,y,O.predicate,ye,void 0,ze);return Tt?.placeable&&(this.markUsedOrientation(c,Fi,me),this.placedOrientations[me.crossTileID]=Fi),Tt};Dr((()=>Ot(ir,h.ax.horizontal)),(()=>{const gi=ke.verticalTextBox;return c.allowVerticalPlacement&&me.numVerticalGlyphVertices>0&&gi?Ot(gi,h.ax.vertical):{box:null,offscreen:null}})),ci(Mt?.placeable)}else{let Ot=h.aM[(Dt=(ut=this.prevPlacement)===null||ut===void 0?void 0:ut.variableOffsets[me.crossTileID])===null||Dt===void 0?void 0:Dt.anchor];const gi=(Tt,wn,zr)=>{const kr=Tt.x2-Tt.x1,Sa=Tt.y2-Tt.y1,wh=me.textBoxScale,ic=W&&Y==="never"?wn:null;let Jr=null,oo=U==="never"?1:2,rc="never";Ot&&oo++;for(let yu=0;yu<oo;yu++){for(let ao=xr;ao<bn;ao++){const vu=c.textAnchorOffsets.get(ao);if(Ot&&vu.textAnchor!==Ot)continue;const lo=this.attemptAnchorPlacement(vu,Tt,kr,Sa,wh,G,X,P,_e,w,O,rc,me,c,zr,y,x,ic,ye);if(lo&&(Jr=lo.placedGlyphBoxes,Jr?.placeable))return _t=!0,Zi=lo.shift,Jr}Ot?Ot=null:rc=U}return a&&!Jr&&(Jr={box:this.collisionIndex.placeCollisionBox(ir,"always",P,_e,w,X,G,y,O.predicate,ye,void 0,ze).box,offscreen:!1,placeable:!1,occluded:!1}),Jr};Dr((()=>gi(ir,ke.iconBox,h.ax.horizontal)),(()=>{const Tt=ke.verticalTextBox;return c.allowVerticalPlacement&&!Mt?.placeable&&me.numVerticalGlyphVertices>0&&Tt?gi(Tt,ke.verticalIconBox,h.ax.vertical):{box:null,occluded:!0,offscreen:null}})),Mt&&(_t=Mt.placeable,Bt=Mt.offscreen);const Fi=ci(Mt?.placeable);if(!_t&&this.prevPlacement){const Tt=this.prevPlacement.variableOffsets[me.crossTileID];Tt&&(this.variableOffsets[me.crossTileID]=Tt,this.markUsedJustification(c,Tt.anchor,me,Fi))}}}if(wt=Mt,_t=wt?.placeable,Bt=wt?.offscreen,me.useRuntimeCollisionCircles&&me.centerJustifiedTextSymbolIndex>=0){const ci=c.text.placedSymbolArray.get(me.centerJustifiedTextSymbolIndex),Dr=h.ay(c.textSizeData,z,ci),xr=f.get("text-padding");Ht=this.collisionIndex.placeCollisionCircles(U,ci,c.lineVertexArray,c.glyphOffsetArray,Dr,w,S,a,X,O.predicate,me.collisionCircleDiameter,xr,y,ye),Ht.circles.length&&Ht.collisionDetected&&!a&&h.w("Collisions detected, but collision boxes are not shown"),_t=q||Ht.circles.length>0&&!Ht.collisionDetected,Bt&&(Bt=Ht.offscreen)}if(ke.iconFeatureIndex&&(xn=ke.iconFeatureIndex),ke.iconBox){const ci=Dr=>this.collisionIndex.placeCollisionBox(Dr,Y,P,_e,w,X,G,x,O.predicate,ye,W&&Zi?Zi:void 0,ze);li&&li.placeable&&ke.verticalIconBox?(Li=ci(ke.verticalIconBox),Ft=Li.placeable):(Li=ci(ke.iconBox),Ft=Li.placeable),Bt&&(Bt=Li.offscreen)}const rr=j||me.numHorizontalGlyphVertices===0&&me.numVerticalGlyphVertices===0,Mi=$||me.numIconVertices===0;rr||Mi?Mi?rr||Ft&&(Ft=_t):_t=Ft&&_t:Ft=_t=Ft&&_t;const qi=Ft&&Li.placeable;if(_t&&wt.placeable&&this.collisionIndex.insertCollisionBox(wt.box,U,f.get("text-ignore-placement"),c.bucketInstanceId,li&&li.placeable&&ls?ls:Kr,O.ID),qi&&this.collisionIndex.insertCollisionBox(Li.box,Y,f.get("icon-ignore-placement"),c.bucketInstanceId,xn,O.ID),Ht&&_t&&this.collisionIndex.insertCollisionCircles(Ht.circles,U,f.get("text-ignore-placement"),c.bucketInstanceId,Kr,O.ID),a&&this.storeCollisionData(c.bucketInstanceId,Re,ke,wt,Li,Ht),me.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[me.crossTileID]=new zo((_t||ue)&&!wt?.occluded,(Ft||oe)&&!Li?.occluded,Bt||c.justReloaded),n[me.crossTileID]=!0};if(ee){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const me=c.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let ke=me.length-1;ke>=0;--ke){const Re=me[ke];Ie(c.symbolInstances.get(Re),c.collisionArrays[Re],Re)}}else for(let me=t.symbolInstanceStart;me<t.symbolInstanceEnd;me++)Ie(c.symbolInstances.get(me),c.collisionArrays[me],me);c.justReloaded=!1}storeCollisionData(t,n,a,c,f,y){if(a.textBox||a.iconBox){let x,w;this.collisionBoxArrays.has(t)?x=this.collisionBoxArrays.get(t):(x=new Map,this.collisionBoxArrays.set(t,x)),x.has(n)?w=x.get(n):(w={text:null,icon:null},x.set(n,w)),a.textBox&&(w.text=c.box),a.iconBox&&(w.icon=f.box)}if(y){let x=this.collisionCircleArrays[t];x===void 0&&(x=this.collisionCircleArrays[t]=[]);for(let w=0;w<y.circles.length;w+=4)x.push(y.circles[w+0]-qt),x.push(y.circles[w+1]-qt),x.push(y.circles[w+2]),x.push(y.collisionDetected?1:0)}}markUsedJustification(t,n,a,c){let f;f=c===h.ax.vertical?a.verticalPlacedTextSymbolIndex:{left:a.leftJustifiedTextSymbolIndex,center:a.centerJustifiedTextSymbolIndex,right:a.rightJustifiedTextSymbolIndex}[h.aO(n)];const y=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex,a.verticalPlacedTextSymbolIndex];for(const x of y)x>=0&&(t.text.placedSymbolArray.get(x).crossTileID=f>=0&&x!==f?0:a.crossTileID)}markUsedOrientation(t,n,a){const c=n===h.ax.horizontal||n===h.ax.horizontalOnly?n:0,f=n===h.ax.vertical?n:0,y=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const x of y)t.text.placedSymbolArray.get(x).placedOrientation=c;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=f)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let a=!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:{},x=n?n.placedOrientations:{};for(const w in this.placements){const S=this.placements[w],P=f[w];P?(this.opacities[w]=new jn(P,c,S.text,S.icon),a||(a=S.text!==P.text.placed),a||(a=S.icon!==P.icon.placed)):(this.opacities[w]=new jn(null,c,S.text,S.icon,S.skipFade),a||(a=S.text||S.icon))}for(const w in f){const S=f[w];if(!this.opacities[w]){const P=new jn(S,c,!1,!1);P.isHidden()||(this.opacities[w]=P,a||(a=S.text.placed),a||(a=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 x)this.placedOrientations[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.placedOrientations[w]=x[w]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const a={};for(const c of n){const f=c.getBucket(t);f&&c.latestFeatureIndex&&t.id===f.layerIds[0]&&this.updateBucketOpacities(f,c.tileID,a,c.collisionBoxArray)}}updateBucketOpacities(t,n,a,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,x=new jn(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",O=new jn(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 j=(U,q,Y)=>{for(let Z=0;Z<q/4;Z++)U.opacityVertexArray.emplaceBack(Y);U.hasVisibleVertices||(U.hasVisibleVertices=Y!==dn)},$=this.collisionBoxArrays.get(t.bucketInstanceId);for(let U=0;U<t.symbolInstances.length;U++){const q=t.symbolInstances.get(U),{numHorizontalGlyphVertices:Y,numVerticalGlyphVertices:Z,crossTileID:G}=q;let X=this.opacities[G];a[G]?X=x:X||(X=O,this.opacities[G]=X),a[G]=!0;const W=q.numIconVertices>0,ee=this.placedOrientations[q.crossTileID],ue=ee===h.ax.vertical,oe=ee===h.ax.horizontal||ee===h.ax.horizontalOnly;if(Y>0||Z>0){const ye=Ec(X.text);j(t.text,Y,ue?dn:ye),j(t.text,Z,oe?dn:ye);const ze=X.text.isHidden(),Ie=[q.rightJustifiedTextSymbolIndex,q.centerJustifiedTextSymbolIndex,q.leftJustifiedTextSymbolIndex];for(const Re of Ie)Re>=0&&(t.text.placedSymbolArray.get(Re).hidden=ze||ue?1:0);q.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(q.verticalPlacedTextSymbolIndex).hidden=ze||oe?1:0);const me=this.variableOffsets[q.crossTileID];me&&this.markUsedJustification(t,me.anchor,q,ee);const ke=this.placedOrientations[q.crossTileID];ke&&(this.markUsedJustification(t,"left",q,ke),this.markUsedOrientation(t,ke,q))}if(W){const ye=Ec(X.icon),ze=!(z&&q.verticalPlacedIconSymbolIndex&&ue);q.placedIconSymbolIndex>=0&&(j(t.icon,q.numIconVertices,ze?ye:dn),t.icon.placedSymbolArray.get(q.placedIconSymbolIndex).hidden=X.icon.isHidden()),q.verticalPlacedIconSymbolIndex>=0&&(j(t.icon,q.numVerticalIconVertices,ze?dn:ye),t.icon.placedSymbolArray.get(q.verticalPlacedIconSymbolIndex).hidden=X.icon.isHidden())}const _e=$?.has(U)?$.get(U):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const ye=t.collisionArrays[U];if(ye){let ze=new h.P(0,0);if(ye.textBox||ye.verticalTextBox){let Ie=!0;if(P){const me=this.variableOffsets[G];me?(ze=Nn(me.anchor,me.width,me.height,me.textOffset,me.textBoxScale),E&&ze._rotate(C?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Ie=!1}if(ye.textBox||ye.verticalTextBox){let me;ye.textBox&&(me=ue),ye.verticalTextBox&&(me=oe),ll(t.textCollisionBox.collisionVertexArray,X.text.placed,!Ie||me,_e.text,ze.x,ze.y)}}if(ye.iconBox||ye.verticalIconBox){const Ie=!!(!oe&&ye.verticalIconBox);let me;ye.iconBox&&(me=Ie),ye.verticalIconBox&&(me=!Ie),ll(t.iconCollisionBox.collisionVertexArray,X.icon.placed,me,_e.icon,z?ze.x:0,z?ze.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 a=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*a>t}setStale(){this.stale=!0}}function ll(d,t,n,a,c,f){a&&a.length!==0||(a=[0,0,0,0]);const y=a[0]-qt,x=a[1]-qt,w=a[2]-qt,S=a[3]-qt;d.emplaceBack(t?1:0,n?1:0,c||0,f||0,y,x),d.emplaceBack(t?1:0,n?1:0,c||0,f||0,w,x),d.emplaceBack(t?1:0,n?1:0,c||0,f||0,w,S),d.emplaceBack(t?1:0,n?1:0,c||0,f||0,y,S)}const Un=Math.pow(2,25),Mc=Math.pow(2,24),Xu=Math.pow(2,17),Gr=Math.pow(2,16),Gn=Math.pow(2,9),et=Math.pow(2,8),cl=Math.pow(2,1);function Ec(d){if(d.opacity===0&&!d.placed)return 0;if(d.opacity===1&&d.placed)return 4294967295;const t=d.placed?1:0,n=Math.floor(127*d.opacity);return n*Un+t*Mc+n*Xu+t*Gr+n*Gn+t*et+n*cl+t}const dn=0;class Ni{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,a,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(((x,w)=>x.sortKey-w.sortKey)));this._currentPartIndex<y.length;)if(n.placeLayerBucketPart(y[this._currentPartIndex],this._seenCrossTileIDs,a),this._currentPartIndex++,f())return!0;return!1}}class Ti{constructor(t,n,a,c,f,y,x,w){this.placement=new ko(t,n,y,x,w),this._currentPlacementIndex=a.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=f,this._done=!1}isDone(){return this._done}continuePlacement(t,n,a){const c=je(),f=()=>!this._forceFullPlacement&&je()-c>2;for(;this._currentPlacementIndex>=0;){const y=n[t[this._currentPlacementIndex]],x=this.placement.collisionIndex.transform.zoom;if(h.aQ(y)&&y.layout&&(!y.minzoom||y.minzoom<=x)&&(!y.maxzoom||y.maxzoom>x)){if(this._inProgressLayer||(this._inProgressLayer=new Ni(y)),this._inProgressLayer.continuePlacement(a[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 Wt=512/h.a6/2;class ai{constructor(t,n,a){this.tileID=t,this.bucketInstanceId=a,this._symbolsByKey={};const c=new Map;for(let f=0;f<n.length;f++){const y=n.get(f),x=y.key,w=c.get(x);w?w.push(y):c.set(x,[y])}for(const[f,y]of c){const x={positions:y.map((w=>({x:Math.floor(w.anchorX*Wt),y:Math.floor(w.anchorY*Wt)}))),crossTileIDs:y.map((w=>w.crossTileID))};if(x.positions.length>128){const w=new h.aR(x.positions.length,16,Uint16Array);for(const{x:S,y:P}of x.positions)w.add(S,P);w.finish(),delete x.positions,x.index=w}this._symbolsByKey[f]=x}}getScaledCoordinates(t,n){const{x:a,y:c,z:f}=this.tileID.canonical,{x:y,y:x,z:w}=n.canonical,S=Wt/Math.pow(2,w-f),P=(x*h.a6+t.anchorY)*S,E=c*h.a6*Wt;return{x:Math.floor((y*h.a6+t.anchorX)*S-a*h.a6*Wt),y:Math.floor(P-E)}}findMatches(t,n,a){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 x=this._symbolsByKey[y.key];if(!x)continue;const w=this.getScaledCoordinates(y,n);if(x.index){const S=x.index.range(w.x-c,w.y-c,w.x+c,w.y+c).sort();for(const P of S){const E=x.crossTileIDs[P];if(!a[E]){a[E]=!0,y.crossTileID=E;break}}}else if(x.positions)for(let S=0;S<x.positions.length;S++){const P=x.positions[S],E=x.crossTileIDs[S];if(Math.abs(P.x-w.x)<=c&&Math.abs(P.y-w.y)<=c&&!a[E]){a[E]=!0,y.crossTileID=E;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class Ct{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Yu{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const a in this.indexes){const c=this.indexes[a],f={};for(const y in c){const x=c[y];x.tileID=x.tileID.unwrapTo(x.tileID.wrap+n),f[x.tileID.key]=x}this.indexes[a]=f}this.lng=t}addBucket(t,n,a){var c,f,y;if(!((c=this.indexes[t.overscaledZ])===null||c===void 0)&&c[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 w=0;w<n.symbolInstances.length;w++)n.symbolInstances.get(w).crossTileID=0;(f=this.usedCrossTileIDs)[y=t.overscaledZ]||(f[y]={});const x=this.usedCrossTileIDs[t.overscaledZ];for(const w in this.indexes){const S=this.indexes[w];if(Number(w)>t.overscaledZ)for(const P in S){const E=S[P];E.tileID.isChildOf(t)&&E.findMatches(n.symbolInstances,t,x)}else{const P=S[t.scaledTo(Number(w)).key];P&&P.findMatches(n.symbolInstances,t,x)}}for(let w=0;w<n.symbolInstances.length;w++){const S=n.symbolInstances.get(w);S.crossTileID||(S.crossTileID=a.generate(),x[S.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new ai(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const a of n.getCrossTileIDsLists())for(const c of a)delete this.usedCrossTileIDs[t][c]}removeStaleBuckets(t){let n=!1;for(const a in this.indexes){const c=this.indexes[a];for(const f in c)t[c[f].bucketInstanceId]||(this.removeBucketCrossTileIDs(a,c[f]),delete c[f],n=!0)}return n}}class Si{constructor(){this.layerIndexes={},this.crossTileIDs=new Ct,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,a){let c=this.layerIndexes[t.id];c===void 0&&(c=this.layerIndexes[t.id]=new Yu);let f=!1;const y={};c.handleWrapJump(a);for(const x of n){const w=x.getBucket(t);t.id===w?.layerIds[0]&&(w.bucketInstanceId||(this.maxBucketInstanceId+=1,w.bucketInstanceId=this.maxBucketInstanceId),c.addBucket(x.tileID,w,this.crossTileIDs)&&(f=!0),y[w.bucketInstanceId]=!0)}return c.removeStaleBuckets(y)&&(f=!0),f}pruneUnusedLayers(t){const n={};for(const a of t)n[a]=!0;for(const a in this.layerIndexes)n[a]||delete this.layerIndexes[a]}}var Ui="void main() {fragColor=vec4(1.0);}";const Rt={prelude:it(`#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:it("","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:it("",`#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:it(`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:it(`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:it(`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:it(Ui,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:it(`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:it(`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:it("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:it("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:it(`#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:it("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:it(Ui,`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:it(`#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:it(`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:it(`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:it(`#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:it(`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:it(`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:it(`#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:it(`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:it(`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:it(`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:it(`#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:it(`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:it(`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:it(`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:it(`uniform sampler2D u_texture;in vec2 v_tex;in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;
658
+ #ifdef OVERDRAW_INSPECTOR
659
+ fragColor=vec4(1.0);
660
+ #endif
661
+ }`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_total_opacity;
662
+ #pragma mapbox: define lowp float opacity
663
+ void main() {
664
+ #pragma mapbox: initialize lowp float opacity
665
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
666
+ camera_to_anchor_distance/u_camera_to_center_distance :
667
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
668
+ #ifdef GLOBE
669
+ if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
670
+ #endif
671
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;}`),symbolSDF:it(`#define SDF_PX 8.0
672
+ uniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;
673
+ #pragma mapbox: define highp vec4 fill_color
674
+ #pragma mapbox: define highp vec4 halo_color
675
+ #pragma mapbox: define lowp float halo_width
676
+ #pragma mapbox: define lowp float halo_blur
677
+ void main() {
678
+ #pragma mapbox: initialize highp vec4 fill_color
679
+ #pragma mapbox: initialize highp vec4 halo_color
680
+ #pragma mapbox: initialize lowp float halo_width
681
+ #pragma mapbox: initialize lowp float halo_blur
682
+ float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}
683
+ #ifdef OVERDRAW_INSPECTOR
684
+ fragColor=vec4(1.0);
685
+ #endif
686
+ }`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;
687
+ #pragma mapbox: define highp vec4 fill_color
688
+ #pragma mapbox: define highp vec4 halo_color
689
+ #pragma mapbox: define lowp float opacity
690
+ #pragma mapbox: define lowp float halo_width
691
+ #pragma mapbox: define lowp float halo_blur
692
+ void main() {
693
+ #pragma mapbox: initialize highp vec4 fill_color
694
+ #pragma mapbox: initialize highp vec4 halo_color
695
+ #pragma mapbox: initialize lowp float opacity
696
+ #pragma mapbox: initialize lowp float halo_width
697
+ #pragma mapbox: initialize lowp float halo_blur
698
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
699
+ camera_to_anchor_distance/u_camera_to_center_distance :
700
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
701
+ #ifdef GLOBE
702
+ if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
703
+ #endif
704
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}`),symbolTextAndIcon:it(`#define SDF_PX 8.0
705
+ #define SDF 1.0
706
+ #define ICON 0.0
707
+ uniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;
708
+ #pragma mapbox: define highp vec4 fill_color
709
+ #pragma mapbox: define highp vec4 halo_color
710
+ #pragma mapbox: define lowp float halo_width
711
+ #pragma mapbox: define lowp float halo_blur
712
+ void main() {
713
+ #pragma mapbox: initialize highp vec4 fill_color
714
+ #pragma mapbox: initialize highp vec4 halo_color
715
+ #pragma mapbox: initialize lowp float halo_width
716
+ #pragma mapbox: initialize lowp float halo_blur
717
+ float total_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;fragColor=texture(u_texture_icon,tex_icon)*total_opacity;
718
+ #ifdef OVERDRAW_INSPECTOR
719
+ fragColor=vec4(1.0);
720
+ #endif
721
+ return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}
722
+ #ifdef OVERDRAW_INSPECTOR
723
+ fragColor=vec4(1.0);
724
+ #endif
725
+ }`,`in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;
726
+ #pragma mapbox: define highp vec4 fill_color
727
+ #pragma mapbox: define highp vec4 halo_color
728
+ #pragma mapbox: define lowp float opacity
729
+ #pragma mapbox: define lowp float halo_width
730
+ #pragma mapbox: define lowp float halo_blur
731
+ void main() {
732
+ #pragma mapbox: initialize highp vec4 fill_color
733
+ #pragma mapbox: initialize highp vec4 halo_color
734
+ #pragma mapbox: initialize lowp float opacity
735
+ #pragma mapbox: initialize lowp float halo_width
736
+ #pragma mapbox: initialize lowp float halo_blur
737
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
738
+ camera_to_anchor_distance/u_camera_to_center_distance :
739
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
740
+ #ifdef GLOBE
741
+ if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
742
+ #endif
743
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,total_opacity,is_sdf);}`),terrain:it("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:it("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:it("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:it("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:it(`#ifdef GL_ES
744
+ precision highp float;
745
+ #endif
746
+ in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758
747
+ );color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:it("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 it(d,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=t.match(/in ([\w]+) ([\w]+)/g),c=d.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),y=f?f.concat(c):c,x={};return{fragmentSource:d=d.replace(n,((w,S,P,E,C)=>(x[C]=!0,S==="define"?`
748
+ #ifndef HAS_UNIFORM_u_${C}
749
+ in ${P} ${E} ${C};
750
+ #else
751
+ uniform ${P} ${E} u_${C};
752
+ #endif
753
+ `:`
754
+ #ifdef HAS_UNIFORM_u_${C}
755
+ ${P} ${E} ${C} = u_${C};
756
+ #endif
757
+ `))),vertexSource:t=t.replace(n,((w,S,P,E,C)=>{const z=E==="float"?"vec2":"vec4",O=C.match(/color/)?"color":z;return x[C]?S==="define"?`
758
+ #ifndef HAS_UNIFORM_u_${C}
759
+ uniform lowp float u_${C}_t;
760
+ in ${P} ${z} a_${C};
761
+ out ${P} ${E} ${C};
762
+ #else
763
+ uniform ${P} ${E} u_${C};
764
+ #endif
765
+ `:O==="vec4"?`
766
+ #ifndef HAS_UNIFORM_u_${C}
767
+ ${C} = a_${C};
768
+ #else
769
+ ${P} ${E} ${C} = u_${C};
770
+ #endif
771
+ `:`
772
+ #ifndef HAS_UNIFORM_u_${C}
773
+ ${C} = unpack_mix_${O}(a_${C}, u_${C}_t);
774
+ #else
775
+ ${P} ${E} ${C} = u_${C};
776
+ #endif
777
+ `:S==="define"?`
778
+ #ifndef HAS_UNIFORM_u_${C}
779
+ uniform lowp float u_${C}_t;
780
+ in ${P} ${z} a_${C};
781
+ #else
782
+ uniform ${P} ${E} u_${C};
783
+ #endif
784
+ `:O==="vec4"?`
785
+ #ifndef HAS_UNIFORM_u_${C}
786
+ ${P} ${E} ${C} = a_${C};
787
+ #else
788
+ ${P} ${E} ${C} = u_${C};
789
+ #endif
790
+ `:`
791
+ #ifndef HAS_UNIFORM_u_${C}
792
+ ${P} ${E} ${C} = unpack_mix_${O}(a_${C}, u_${C}_t);
793
+ #else
794
+ ${P} ${E} ${C} = u_${C};
795
+ #endif
796
+ `})),staticAttributes:a,staticUniforms:y}}class yr{constructor(t,n,a){this.vertexBuffer=t,this.indexBuffer=n,this.segments=a}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var gt=h.aS([{name:"a_pos",type:"Int16",components:2}]);const $n="#define PROJECTION_MERCATOR",$r="mercator";class Zn{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return $r}get shaderDefine(){return $n}get shaderPreludeCode(){return Rt.projectionMercator}get vertexShaderPreludeCode(){return Rt.projectionMercator.vertexSource}get subdivisionGranularity(){return h.aT.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,n,a,c,f){if(this._cachedMesh)return this._cachedMesh;const y=new h.aU;y.emplaceBack(0,0),y.emplaceBack(h.a6,0),y.emplaceBack(0,h.a6),y.emplaceBack(h.a6,h.a6);const x=t.createVertexBuffer(y,gt.members),w=h.aV.simpleSegment(0,0,4,2),S=new h.aW;S.emplaceBack(1,0,2),S.emplaceBack(1,2,3);const P=t.createIndexBuffer(S);return this._cachedMesh=new yr(x,P,w),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(t){}}class Pi{constructor(t=0,n=0,a=0,c=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(a)||a<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=a,this.right=c}interpolate(t,n,a){return n.top!=null&&t.top!=null&&(this.top=h.H.number(t.top,n.top,a)),n.bottom!=null&&t.bottom!=null&&(this.bottom=h.H.number(t.bottom,n.bottom,a)),n.left!=null&&t.left!=null&&(this.left=h.H.number(t.left,n.left,a)),n.right!=null&&t.right!=null&&(this.right=h.H.number(t.right,n.right,a)),this}getCenter(t,n){const a=h.al((this.left+t-this.right)/2,0,t),c=h.al((this.top+n-this.bottom)/2,0,n);return new h.P(a,c)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Pi(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Cs(d,t){if(!d.renderWorldCopies||d.lngRange)return;const n=t.lng-d.center.lng;t.lng+=n>180?-360:n<-180?360:0}function Ir(d){return Math.max(0,Math.floor(d))}class ul{constructor(t,n){var a;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=(a=n?.constrainOverride)!==null&&a!==void 0?a:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new h.W(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Ir(this._zoom),this._scale=h.ao(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Pi,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,n,a){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=Ir(this._zoom),this._scale=h.ao(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 Pi(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=!a&&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 h.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){const n=h.X(t,-180,180)*Math.PI/180;var a,c,f,y,x,w,S,P,E;this._bearingInRadians!==n&&(this._unmodified=!1,this._bearingInRadians=n,this._calcMatrices(),this._rotationMatrix=$e(),a=this._rotationMatrix,f=-this._bearingInRadians,y=(c=this._rotationMatrix)[0],x=c[1],w=c[2],S=c[3],P=Math.sin(f),E=Math.cos(f),a[0]=y*E+w*P,a[1]=x*E+S*P,a[2]=y*-P+w*E,a[3]=x*-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=h.al(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 h.aX(this._fovInRadians)}setFov(t){t=h.al(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=h.an(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=h.ao(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,a){this._unmodified=!1,this._edgeInsets.interpolate(t,n,a),this.constrainInternal(),this._calcMatrices()}resize(t,n,a=!0){this._width=t,this._height=n,a&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){var t,n;return((t=this._latRange)===null||t===void 0?void 0:t.length)!==2||((n=this._lngRange)===null||n===void 0?void 0:n.length)!==2?null:new xt([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-h.am,h.am])}getCameraQueryGeometry(t,n){if(n.length===1)return[n[0],t];{const{minX:a,minY:c,maxX:f,maxY:y}=h.a8.fromPoints(n).extend(t);return[new h.P(a,c),new h.P(f,c),new h.P(f,y),new h.P(a,y),new h.P(a,c)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:n,zoom:a}=this.applyConstrain(this.center,this.zoom);this.setCenter(n),this.setZoom(a),this._unmodified=t,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=h.ap(new Float64Array(16));h.S(t,t,[this._width/2,-this._height/2,1]),h.Q(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=h.ap(new Float64Array(16)),h.S(t,t,[1,-1,1]),h.Q(t,t,[-1,-1,0]),h.S(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,a,c){const f=a!==void 0?a:this.bearing,y=c=c!==void 0?c:this.pitch,{distanceToCenter:x,clampedElevation:w}=this._distanceToCenterFromAltElevationPitch(n,this.elevation,y),{x:S,y:P}=To(y,f),E=h.a7.fromLngLat(t,n);let C,z,O=h.aY(1,E.y),j=0;do{if(j+=1,j>10)break;z=x/O,C=new h.a7(E.x+S*z,E.y+P*z),O=1/C.meterInMercatorCoordinateUnits()}while(Math.abs(x-z*O)>1e-12);return{center:C.toLngLat(),elevation:w,zoom:h.ar(this.height/2/Math.tan(this.fovInRadians/2)/z/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;const n=1/this.worldSize,a=h.aq(1,this.center.lat)*this.worldSize,c=h.a7.fromLngLat(this.center,this.elevation),f=c.x/n,y=c.y/n,x=c.z/n,w=this.pitch,S=this.bearing,{x:P,y:E,z:C}=To(w,S),z=this.cameraToCenterDistance,O=f+z*-P,j=y+z*-E,$=x+z*C,{distanceToCenter:U,clampedElevation:q}=this._distanceToCenterFromAltElevationPitch($/a,t,w),Y=U*a,Z=new h.a7((O+P*Y)*n,(j+E*Y)*n,0).toLngLat(),G=h.aq(1,Z.lat),X=h.ar(this.height/2/Math.tan(this.fovInRadians/2)/U/G/this.tileSize);this._elevation=q,this._center=Z,this.setZoom(X)}_distanceToCenterFromAltElevationPitch(t,n,a){const c=-Math.cos(h.an(a)),f=t-n;let y,x=n;return c*f>=0||Math.abs(c)<.1?(y=1e4,x=t+y*c):y=-f/c,{distanceToCenter:y,clampedElevation:x}}getCameraPoint(){const t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new h.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=h.aq(1,this.center.lat)*this.worldSize;return ji(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/h.a6,1/n/h.a6]}}class As{constructor(t,n){this.min=t,this.max=n,this.center=h.aZ([],h.a_([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],a=h.a$(this.min),c=h.a$(this.max);for(let f=0;f<n.length;f++)a[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 As(a,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(const a of t.planes){const c=this.intersectsPlane(a);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],a=t[3];for(let c=0;c<3;c++)t[c]>0?(n+=t[c]*this.min[c],a+=t[c]*this.max[c]):(a+=t[c]*this.min[c],n+=t[c]*this.max[c]);return n>=0?2:a<0?0:1}}class Ro{distanceToTile2d(t,n,a,c){const f=c,y=f.distanceX([t,n]),x=f.distanceY([t,n]);return Math.hypot(y,x)}getWrap(t,n,a){return a}getTileBoundingVolume(t,n,a,c){var f,y;let x=0,w=0;if(c?.terrain){const P=new h.a3(t.z,n,t.z,t.x,t.y),E=c.terrain.getMinMaxElevation(P);x=(f=E.minElevation)!==null&&f!==void 0?f:Math.min(0,a),w=(y=E.maxElevation)!==null&&y!==void 0?y:Math.max(0,a)}const S=1<<t.z;return new As([n+t.x/S,t.y/S,x],[n+(t.x+1)/S,(t.y+1)/S,w])}allowVariableZoom(t,n){const a=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,c=h.al(78.5-a/2,0,60);return!!n.terrain||t.pitch>c}allowWorldCopies(){return!0}prepareNextFrame(){}}class pn{constructor(t,n,a){this.points=t,this.planes=n,this.aabb=a}static fromInvProjectionMatrix(t,n=1,a=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]],x=Math.pow(2,a),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,O,j,$){const U=h.aE([],z,O),q=1/U[3]/j*$;return h.b4(U,U,[q,q,1/U[3],q])})(C,t,n,x)));c&&(function(C,z,O,j){const $=j?4:0,U=j?0:4;let q=0;const Y=[],Z=[];for(let W=0;W<4;W++){const ee=h.b0([],C[W+U],C[W+$]),ue=h.b5(ee);h.aZ(ee,ee,1/ue),Y.push(ue),Z.push(ee)}for(let W=0;W<4;W++){const ee=h.b6(C[W+$],Z[W],O);q=ee!==null&&ee>=0?Math.max(q,ee):Math.max(q,Y[W])}const G=(function(W,ee){const ue=h.b0([],W[ee[0]],W[ee[1]]),oe=h.b0([],W[ee[2]],W[ee[1]]),_e=[0,0,0,0];return h.b1(_e,h.b2([],ue,oe)),_e[3]=-h.b3(_e,W[ee[0]]),_e})(C,z),X=(function(W,ee){const ue=h.b7(W),oe=h.b8([],W,1/ue),_e=h.b0([],ee,h.aZ([],oe,h.b3(ee,oe))),ye=h.b7(_e);if(ye>0){const ze=Math.sqrt(1-oe[3]*oe[3]),Ie=h.aZ([],oe,-oe[3]),me=h.a_([],Ie,h.aZ([],_e,ze/ye));return h.b9(ee,me)}return null})(O,G);if(X!==null){const W=X/h.b3(Z[0],G);q=Math.min(q,W)}for(let W=0;W<4;W++){const ee=Math.min(q,Y[W]);C[W+U]=[C[W+$][0]+Z[W][0]*ee,C[W+$][1]+Z[W][1]*ee,C[W+$][2]+Z[W][2]*ee,1]}})(w,y[0],c,f);const S=y.map((C=>{const z=h.b0([],w[C[0]],w[C[1]]),O=h.b0([],w[C[2]],w[C[1]]),j=h.b1([],h.b2([],z,O)),$=-h.b3(j,w[C[1]]);return j.concat($)})),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 pn(w,S,new As(P,E))}}class Mr{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,a){this._helper.interpolatePadding(t,n,a)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n,a=!0){this._helper.resize(t,n,a)}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,a)=>{a=h.al(+a,this.minZoom,this.maxZoom);const c={center:new h.W(n.lng,n.lat),zoom:a};let f=this._helper._lngRange;if(!this._helper._renderWorldCopies&&f===null){const Z=179.9999999999;f=[-Z,Z]}const y=this.tileSize*h.ao(c.zoom);let x=0,w=y,S=0,P=y,E=0,C=0;const{x:z,y:O}=this.size;if(this._helper._latRange){const Z=this._helper._latRange;x=h.Y(Z[1])*y,w=h.Y(Z[0])*y,w-x<O&&(E=O/(w-x))}f&&(S=h.X(h.Z(f[0])*y,0,y),P=h.X(h.Z(f[1])*y,0,y),P<S&&(P+=y),P-S<z&&(C=z/(P-S)));const{x:j,y:$}=ce(y,n);let U,q;const Y=Math.max(C||0,E||0);if(Y){const Z=new h.P(C?(P+S)/2:j,E?(w+x)/2:$);return c.center=Rn(y,Z).wrap(),c.zoom+=h.ar(Y),c}if(this._helper._latRange){const Z=O/2;$-Z<x&&(q=x+Z),$+Z>w&&(q=w-Z)}if(f){const Z=(S+P)/2;let G=j;this._helper._renderWorldCopies&&(G=h.X(j,Z-y/2,Z+y/2));const X=z/2;G-X<S&&(U=S+X),G+X>P&&(U=P-X)}if(U!==void 0||q!==void 0){const Z=new h.P(U??j,q??$);c.center=Rn(y,Z).wrap()}return c},this.applyConstrain=(n,a)=>this._helper.applyConstrain(n,a),this._helper=new ul({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(n,a)=>this.defaultConstrain(n,a)},t),this._coveringTilesDetailsProvider=new Ro}clone(){const t=new Mr;return t.apply(this,!1),t}apply(t,n,a){this._helper.apply(t,n,a)}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 h.ba(0,t)];if(this._helper._renderWorldCopies){const a=this.screenPointToMercatorCoordinate(new h.P(0,0)),c=this.screenPointToMercatorCoordinate(new h.P(this._helper._width,0)),f=this.screenPointToMercatorCoordinate(new h.P(this._helper._width,this._helper._height)),y=this.screenPointToMercatorCoordinate(new h.P(0,this._helper._height)),x=Math.floor(Math.min(a.x,c.x,f.x,y.x)),w=Math.floor(Math.max(a.x,c.x,f.x,y.x)),S=1;for(let P=x-S;P<=w+S;P++)P!==0&&n.push(new h.ba(P,t))}return n}getCameraFrustum(){return pn.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){const n=this.screenPointToLocation(this.centerPoint,t),a=t?t.getElevationForLngLatZoom(n,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(a)}setLocationAtPoint(t,n){const a=h.aq(this.elevation,this.center.lat),c=this.screenPointToMercatorCoordinateAtZ(n,a),f=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,a),y=h.a7.fromLngLat(t),x=new h.a7(y.x-(c.x-f.x),y.y-(c.y-f.y));this.setCenter(x?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,n){return n?this.coordinatePoint(h.a7.fromLngLat(t),n.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(h.a7.fromLngLat(t))}screenPointToLocation(t,n){var a;return(a=this.screenPointToMercatorCoordinate(t,n))===null||a===void 0?void 0:a.toLngLat()}screenPointToMercatorCoordinate(t,n){if(n){const a=n.pointCoordinate(t);if(a!=null)return a}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,n){const a=n||0,c=[t.x,t.y,0,1],f=[t.x,t.y,1,1];h.aE(c,c,this._pixelMatrixInverse),h.aE(f,f,this._pixelMatrixInverse);const y=c[3],x=f[3],w=c[1]/y,S=f[1]/x,P=c[2]/y,E=f[2]/x,C=P===E?0:(a-P)/(E-P);return new h.a7(h.H.number(c[0]/y,f[0]/x,C)/this.worldSize,h.H.number(w,S,C)/this.worldSize,a)}coordinatePoint(t,n=0,a=this._pixelMatrix){const c=[t.x*this.worldSize,t.y*this.worldSize,n,1];return h.aE(c,c,a),new h.P(c[0]/c[3],c[1]/c[3])}getBounds(){const t=Math.max(0,this._helper._height/2-Ss(this));return new xt().extend(this.screenPointToLocation(new h.P(0,t))).extend(this.screenPointToLocation(new h.P(this._helper._width,t))).extend(this.screenPointToLocation(new h.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new h.P(0,this._helper._height)))}isPointOnMapSurface(t,n){return n?n.pointCoordinate(t)!=null:t.y>this.height/2-Ss(this)}calculatePosMatrix(t,n=!1,a){var c;const f=(c=t.key)!==null&&c!==void 0?c:h.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 a?S.f32:S.f64}const x=ct(t,this.worldSize);h.U(x,n?this._alignedProjMatrix:this._viewProjMatrix,x);const w={f64:x,f32:new Float32Array(x)};return y.set(f,w),a?w.f32:w.f64}calculateFogMatrix(t){const n=t.key,a=this._fogMatrixCacheF32;if(a.has(n))return a.get(n);const c=ct(t,this.worldSize);return h.U(c,this._fogMatrix,c),a.set(n,new Float32Array(c)),a.get(n)}calculateCenterFromCameraLngLatAlt(t,n,a,c){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,a,c)}_calculateNearFarZIfNeeded(t,n,a){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,x=Math.PI/2+this.pitchInRadians,w=h.an(this.fov)*(Math.abs(Math.cos(h.an(this.roll)))*this.height+Math.abs(Math.sin(h.an(this.roll)))*this.width)/this.height*(.5+a.y/this.height),S=Math.sin(w)*y/Math.sin(h.al(Math.PI-x-w,.01,Math.PI-.01)),P=Ss(this),E=Math.atan(P/this._helper.cameraToCenterDistance),C=h.an(.75),z=E>C?2*E*(.5+a.y/(2*P)):C,O=Math.sin(z)*y/Math.sin(h.al(Math.PI-x-z,.01,Math.PI-.01)),j=Math.min(S,O);this._helper._farZ=1.01*(Math.cos(Math.PI/2-n)*j+y),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const t=this.centerOffset,n=ce(this.worldSize,this.center),a=n.x,c=n.y;this._helper._pixelPerMeter=h.aq(1,this.center.lat)*this.worldSize;const f=h.an(Math.min(this.pitch,kn)),y=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(f));let x;var w,S;this._calculateNearFarZIfNeeded(y,f,t),x=new Float64Array(16),h.bc(x,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),(w=this._invProjMatrix)[0]=1/(S=x)[0],w[1]=0,w[2]=0,w[3]=0,w[4]=0,w[5]=1/S[5],w[6]=0,w[7]=0,w[8]=0,w[9]=0,w[10]=0,w[11]=1/S[14],w[12]=0,w[13]=0,w[14]=-1,w[15]=S[10]/S[14],x[8]=2*-t.x/this._helper._width,x[9]=2*t.y/this._helper._height,this._projectionMatrix=h.bd(x),h.S(x,x,[1,-1,1]),h.Q(x,x,[0,0,-this._helper.cameraToCenterDistance]),h.be(x,x,-this.rollInRadians),h.bf(x,x,this.pitchInRadians),h.be(x,x,-this.bearingInRadians),h.Q(x,x,[-a,-c,0]),this._mercatorMatrix=h.S([],x,[this.worldSize,this.worldSize,this.worldSize]),h.S(x,x,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=h.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,x),h.Q(x,x,[0,0,-this.elevation]),this._viewProjMatrix=x,this._invViewProjMatrix=h.bg([],x);const P=[0,0,-1,1];h.aE(P,P,this._invViewProjMatrix),this._cameraPosition=[P[0]/P[3],P[1]/P[3],P[2]/P[3]],this._fogMatrix=new Float64Array(16),h.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,h.S(this._fogMatrix,this._fogMatrix,[1,-1,1]),h.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),h.be(this._fogMatrix,this._fogMatrix,-this.rollInRadians),h.bf(this._fogMatrix,this._fogMatrix,this.pitchInRadians),h.be(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),h.Q(this._fogMatrix,this._fogMatrix,[-a,-c,0]),h.S(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),h.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=h.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,x);const E=this._helper._width%2/2,C=this._helper._height%2/2,z=Math.cos(this.bearingInRadians),O=Math.sin(-this.bearingInRadians),j=a-Math.round(a)+z*E+O*C,$=c-Math.round(c)+z*C+O*E,U=new Float64Array(x);if(h.Q(U,U,[j>.5?j-1:j,$>.5?$-1:$,0]),this._alignedProjMatrix=U,x=h.bg(new Float64Array(16),this._pixelMatrix),!x)throw new Error("failed to invert matrix");this._pixelMatrixInverse=x,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const t=this.screenPointToMercatorCoordinate(new h.P(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return h.aE(n,n,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const t=h.aq(1,this.center.lat)*this.worldSize;return ji(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,n){const a=h.a7.fromLngLat(t),c=[a.x*this.worldSize,a.y*this.worldSize,n,1];return h.aE(c,c,this._viewProjMatrix),c[2]/c[3]}getProjectionData(t){const{overscaledTileID:n,aligned:a,applyTerrainMatrix:c}=t,f=this._helper.getMercatorTileCoordinates(n),y=n?this.calculatePosMatrix(n,a,!0):null;let x;return x=n?.terrainRttPosMatrix32f&&c?n.terrainRttPosMatrix32f:y||h.bh(),{mainMatrix:x,tileMercatorCoords:f,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:x}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,n,a){return 1}transformLightDirection(t){return h.a$(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,n,a,c){const f=this.calculatePosMatrix(a);let y;c?(y=[t,n,c(t,n),1],h.aE(y,y,f)):(y=[t,n,0,1],Ao(y,y,f));const x=y[3];return{point:new h.P(y[0]/x,y[1]/x),signedDistanceFromCamera:x,isOccluded:!1}}populateCache(t){for(const n of t)this.calculatePosMatrix(n)}getMatrixForModel(t,n){const a=h.a7.fromLngLat(t,n),c=a.meterInMercatorCoordinateUnits(),f=h.bi();return h.Q(f,f,[a.x,a.y,a.z]),h.be(f,f,Math.PI),h.bf(f,f,Math.PI/2),h.S(f,f,[-c,c,c]),f}getProjectionDataForCustomLayer(t=!0){const n=new h.a3(0,0,0,0,0),a=this.getProjectionData({overscaledTileID:n,applyGlobeMatrix:t}),c=ct(n,this.worldSize);h.U(c,this._viewProjMatrix,c),a.tileMercatorCoords=[0,0,1,1];const f=[h.a6,h.a6,this.worldSize/this._helper.pixelsPerMeter],y=h.bj();return h.S(y,c,f),a.fallbackMatrix=y,a.mainMatrix=y,a}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function Lo(){h.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Fo(d){if(d.useSlerp)if(d.k<1){const t=h.bk(d.startEulerAngles.roll,d.startEulerAngles.pitch,d.startEulerAngles.bearing),n=h.bk(d.endEulerAngles.roll,d.endEulerAngles.pitch,d.endEulerAngles.bearing),a=new Float64Array(4);h.bl(a,t,n,d.k);const c=h.bm(a);d.tr.setRoll(c.roll),d.tr.setPitch(c.pitch),d.tr.setBearing(c.bearing)}else d.tr.setRoll(d.endEulerAngles.roll),d.tr.setPitch(d.endEulerAngles.pitch),d.tr.setBearing(d.endEulerAngles.bearing);else d.tr.setRoll(h.H.number(d.startEulerAngles.roll,d.endEulerAngles.roll,d.k)),d.tr.setPitch(h.H.number(d.startEulerAngles.pitch,d.endEulerAngles.pitch,d.k)),d.tr.setBearing(h.H.number(d.startEulerAngles.bearing,d.endEulerAngles.bearing,d.k))}function Ds(d,t,n,a,c){const f=c.padding,y=ce(c.worldSize,n.getNorthWest()),x=ce(c.worldSize,n.getNorthEast()),w=ce(c.worldSize,n.getSouthEast()),S=ce(c.worldSize,n.getSouthWest()),P=h.an(-a),E=y.rotate(P),C=x.rotate(P),z=w.rotate(P),O=S.rotate(P),j=new h.P(Math.max(E.x,C.x,O.x,z.x),Math.max(E.y,C.y,O.y,z.y)),$=new h.P(Math.min(E.x,C.x,O.x,z.x),Math.min(E.y,C.y,O.y,z.y)),U=j.sub($),q=(c.width-(f.left+f.right+t.left+t.right))/U.x,Y=(c.height-(f.top+f.bottom+t.top+t.bottom))/U.y;if(Y<0||q<0)return void Lo();const Z=Math.min(h.ar(c.scale*Math.min(q,Y)),d.maxZoom),G=h.P.convert(d.offset),X=new h.P((t.left-t.right)/2,(t.top-t.bottom)/2).rotate(h.an(a)),W=G.add(X).mult(c.scale/h.ao(Z));return{center:Rn(c.worldSize,y.add(w).div(2).sub(W)),zoom:Z,bearing:a}}class qn{get useGlobeControls(){return!1}handlePanInertia(t,n){const a=t.mag(),c=Math.abs(Ss(n));return{easingOffset:t.mult(Math.min(.75*c/a,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,a){t.around.distSqr(n.centerPoint)<.01||n.setLocationAtPoint(a,t.around)}cameraForBoxAndBearing(t,n,a,c,f){return Ds(t,n,a,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(h.W.convert(n.center))}handleEaseTo(t,n){const a=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},x=n.zoom!==void 0,w=!t.isPaddingEqual(n.padding);let S=!1;const P=x?+n.zoom:t.zoom;let E=t.centerPoint.add(n.offsetAsPoint);const C=t.screenPointToLocation(E),{center:z,zoom:O}=t.applyConstrain(h.W.convert(n.center||C),P??a);Cs(t,z);const j=ce(t.worldSize,C),$=ce(t.worldSize,z).sub(j),U=h.ao(O-a);return S=O!==a,{easeFunc:q=>{if(S&&t.setZoom(h.H.number(a,O,q)),h.bn(f,y)||Fo({startEulerAngles:f,endEulerAngles:y,tr:t,k:q,useSlerp:f.roll!=y.roll}),w&&(t.interpolatePadding(c,n.padding,q),E=t.centerPoint.add(n.offsetAsPoint)),n.around)t.setLocationAtPoint(n.around,n.aroundPoint);else{const Y=h.ao(t.zoom-a),Z=O>a?Math.min(2,U):Math.max(.5,U),G=Math.pow(Z,1-q),X=Rn(t.worldSize,j.add($.mult(q*G)).mult(Y));t.setLocationAtPoint(t.renderWorldCopies?X.wrap():X,E)}},isZooming:S,elevationCenter:z}}handleFlyTo(t,n){const a=n.zoom!==void 0,c=t.zoom,f=t.applyConstrain(h.W.convert(n.center||n.locationAtOffset),a?+n.zoom:c),y=f.center,x=f.zoom;Cs(t,y);const w=ce(t.worldSize,n.locationAtOffset),S=ce(t.worldSize,y).sub(w),P=S.mag(),E=h.ao(x-c);let C;if(n.minZoom!==void 0){const z=Math.min(+n.minZoom,c,x),O=t.applyConstrain(y,z).zoom;C=h.ao(O-c)}return{easeFunc:(z,O,j,$)=>{t.setZoom(z===1?x:c+h.ar(O));const U=z===1?y:Rn(t.worldSize,w.add(S.mult(j)).mult(O));t.setLocationAtPoint(t.renderWorldCopies?U.wrap():U,$)},scaleOfZoom:E,targetCenter:y,scaleOfMinZoom:C,pixelPathLength:P}}}class yt{constructor(t,n,a){this.blendFunction=t,this.blendColor=n,this.mask=a}}yt.Replace=[1,0],yt.disabled=new yt(yt.Replace,h.bo.transparent,[!1,!1,!1,!1]),yt.unblended=new yt(yt.Replace,h.bo.transparent,[!0,!0,!0,!0]),yt.alphaBlended=new yt([1,771],h.bo.transparent,[!0,!0,!0,!0]);const Wn=2305;class rt{constructor(t,n,a){this.enable=t,this.mode=n,this.frontFace=a}}rt.disabled=new rt(!1,1029,Wn),rt.backCCW=new rt(!0,1029,Wn),rt.frontCCW=new rt(!0,1028,Wn);class Ue{constructor(t,n,a){this.func=t,this.mask=n,this.range=a}}Ue.ReadOnly=!1,Ue.ReadWrite=!0,Ue.disabled=new Ue(519,Ue.ReadOnly,[0,1]);const hl=7680;class ot{constructor(t,n,a,c,f,y){this.test=t,this.ref=n,this.mask=a,this.fail=c,this.depthFail=f,this.pass=y}}function vr(d){return typeof WebGL2RenderingContext<"u"&&d instanceof WebGL2RenderingContext}ot.disabled=new ot({func:519,mask:0},0,0,hl,hl,hl);class dl{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,a=n.gl;this._texFormat=a.RGBA,this._texType=a.UNSIGNED_BYTE;const c=new h.aU;c.emplaceBack(-1,-1),c.emplaceBack(2,-1),c.emplaceBack(-1,2);const f=new h.aW;f.emplaceBack(0,1,2),this._fullscreenTriangle=new yr(n.createVertexBuffer(c,gt.members),n.createIndexBuffer(f),h.aV.simpleSegment(0,0,c.length,f.length)),this._resultBuffer=new Uint8Array(4),n.activeTexture.set(a.TEXTURE1);const y=a.createTexture();a.bindTexture(a.TEXTURE_2D,y),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texImage2D(a.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),vr(a)&&(this._pbo=a.createBuffer(),a.bindBuffer(a.PIXEL_PACK_BUFFER,this._pbo),a.bufferData(a.PIXEL_PACK_BUFFER,4,a.STREAM_READ),a.bindBuffer(a.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 a=this._updateCount;return this._readbackQueue?a>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():a>=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 a=this._cachedRenderContext.context,c=a.gl;if(this._bindFramebuffer(),a.viewport.set([0,0,this._texWidth,this._texHeight]),a.clear({color:h.bo.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(a,c.TRIANGLES,Ue.disabled,ot.disabled,yt.unblended,rt.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&&vr(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&&vr(t)){const n=t.clientWaitSync(this._readbackQueue.sync,0,0);if(n===t.WAIT_FAILED)return h.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=dl._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 Bo=h.a6/128;function Ii(d,t){const n=d.granularity!==void 0?Math.max(d.granularity,1):1,a=n+(d.generateBorders?2:0),c=n+(d.extendToNorthPole||d.generateBorders?1:0)+(d.extendToSouthPole||d.generateBorders?1:0),f=a+1,y=c+1,x=d.generateBorders?-1:0,w=d.generateBorders||d.extendToNorthPole?-1:0,S=n+(d.generateBorders?1:0),P=n+(d.generateBorders||d.extendToSouthPole?1:0),E=f*y,C=a*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 O=z||t==="32bit",j=new Int16Array(2*E);let $=0;for(let Y=w;Y<=P;Y++)for(let Z=x;Z<=S;Z++){let G=Z/n*h.a6;Z===-1&&(G=-Bo),Z===n+1&&(G=h.a6+Bo);let X=Y/n*h.a6;Y===-1&&(X=d.extendToNorthPole?h.bq:-Bo),Y===n+1&&(X=d.extendToSouthPole?h.br:h.a6+Bo),j[$++]=G,j[$++]=X}const U=O?new Uint32Array(C):new Uint16Array(C);let q=0;for(let Y=0;Y<c;Y++)for(let Z=0;Z<a;Z++){const G=Z+1+Y*f,X=Z+(Y+1)*f,W=Z+1+(Y+1)*f;U[q++]=Z+Y*f,U[q++]=X,U[q++]=G,U[q++]=G,U[q++]=X,U[q++]=W}return{vertices:j.buffer.slice(0),indices:U.buffer.slice(0),uses32bitIndices:O}}const zs=new h.aT({fill:new h.bs(128,2),line:new h.bs(512,0),tile:new h.bs(128,32),stencil:new h.bs(128,1),circle:3});class lr{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 Rt.projectionGlobe}get vertexShaderPreludeCode(){return Rt.projectionMercator.vertexSource}get subdivisionGranularity(){return zs}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new dl(t));const n=h.Y(this._errorQueryLatitudeDegrees),a=2*Math.atan(Math.exp(Math.PI-n*Math.PI*2))-.5*Math.PI,c=this._errorMeasurement.updateErrorLoop(n,a),f=je();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=h.bt(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,h.bu(y))}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,n,a,c,f){const y=(f==="stencil"?zs.stencil:zs.tile).getGranularityForZoomLevel(n.z);return this._getMesh(t,{granularity:y,generateBorders:a,extendToNorthPole:n.y===0&&c,extendToSouthPole:n.y===(1<<n.z)-1&&c})}_getMesh(t,n){const a=this._getMeshKey(n);if(a in this._tileMeshCache)return this._tileMeshCache[a];const c=(function(f,y){const x=Ii(y,"16bit"),w=h.aU.deserialize({arrayBuffer:x.vertices,length:x.vertices.byteLength/2/2}),S=h.aW.deserialize({arrayBuffer:x.indices,length:x.indices.byteLength/2/3});return new yr(f.createVertexBuffer(w,gt.members),f.createIndexBuffer(S),h.aV.simpleSegment(0,0,w.length,S.length))})(t,n);return this._tileMeshCache[a]=c,c}recalculate(t){}hasTransition(){var t;const n=je();let a=!1;return a||(a=(n-this._errorMeasurementLastChangeTime)/1e3<.7),a||(a=(t=this._errorMeasurement)===null||t===void 0?void 0:t.awaitingQuery),a}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t}}const Oo=new h.u({type:new h.D(h.x.projection.type)});class pl extends h.E{constructor(t){super(),this._transitionable=new h.y(Oo,void 0),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new h.J(0)),this._mercatorProjection=new Zn,this._verticalPerspectiveProjection=new lr}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 h.bv){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,a,c,f){return this.currentProjection.getMeshFromTileID(t,n,a,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 fl(d){const t=Vo(d.worldSize,d.center.lat);return 2*Math.PI*t}function Gi(d,t,n,a,c){const f=1/(1<<c),y=t/h.a6*f+a*f,x=h.by((d/h.a6*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(x)*S,P[1]=Math.sin(w),P[2]=Math.cos(x)*S,P}function fi(d){return(function(t,n){const a=Math.cos(n),c=new Float64Array(3);return c[0]=Math.sin(t)*a,c[1]=Math.sin(n),c[2]=Math.cos(t)*a,c})(d.lng*Math.PI/180,d.lat*Math.PI/180)}function Vo(d,t){return d/(2*Math.PI)/Math.cos(t*Math.PI/180)}function Cc(d){const t=Math.asin(d[1])/Math.PI*180,n=Math.sqrt(d[0]*d[0]+d[2]*d[2]);if(n>1e-6){const a=d[0]/n,c=Math.acos(d[2]/n),f=(a>0?c:-c)/Math.PI*180;return new h.W(h.X(f,-180,180),t)}return new h.W(0,t)}function jo(d){return Math.cos(d*Math.PI/180)}function Qt(d,t){const n=jo(d),a=jo(t);return h.ar(a/n)}function Ac(d,t){const n=d.rotate(t.bearingInRadians),a=t.zoom+Qt(t.center.lat,0),c=h.bt(1/jo(t.center.lat),1/jo(Math.min(Math.abs(t.center.lat),60)),h.bw(a,7,3,0,1)),f=360/fl({worldSize:t.worldSize,center:{lat:t.center.lat}});return new h.W(t.center.lng-n.x*f*c,h.al(t.center.lat+n.y*f,-h.am,h.am))}function Hn(d){const t=.5*d,n=Math.sin(t),a=Math.cos(t);return Math.log(n+a)-Math.log(a-n)}function No(d,t,n,a){const c=d.lat+n*a;if(Math.abs(n)>1){const f=(Math.sign(d.lat+n)!==Math.sign(d.lat)?-Math.abs(d.lat):Math.abs(d.lat))*Math.PI/180,y=Math.abs(d.lat+n)*Math.PI/180,x=Hn(f+a*(y-f)),w=Hn(f),S=Hn(y);return new h.W(d.lng+t*((x-w)/(S-w)),c)}return new h.W(d.lng+t*a,c)}class Uo{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,a,c){const f=`${t.z}_${t.x}_${t.y}_${c?.terrain?"t":""}`,y=this._cache.get(f);if(y)return y;const x=this._cachePrevious.get(f);if(x)return this._cache.set(f,x),x;const w=this._boundingVolumeFactory(t,n,a,c);return this._cache.set(f,w),this._hadAnyChanges=!0,w}}class Zr{constructor(t,n,a,c){this.min=a,this.max=c,this.points=t,this.planes=n}static fromAabb(t,n){const a=[];for(let c=0;c<8;c++)a.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 Zr(a,[[-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,a){const c=h.bA([],a[0],a[1],a[2]),f=h.bB([],[n[0],0,0],c),y=h.bB([],[0,n[1],0],c),x=h.bB([],[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)+x[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];h.a_(C,C,h.aZ([],f,1&~E?-1:1)),h.a_(C,C,h.aZ([],y,(E>>1&1)==1?1:-1)),h.a_(C,C,h.aZ([],x,(E>>2&1)==1?1:-1)),P.push(C)}return new Zr(P,[[...f,-h.b3(f,P[0])],[...y,-h.b3(y,P[0])],[...x,-h.b3(x,P[0])],[-f[0],-f[1],-f[2],-h.b3(f,P[7])],[-y[0],-y[1],-y[2],-h.b3(y,P[7])],[-x[0],-x[1],-x[2],-h.b3(x,P[7])]],w,S)}intersectsFrustum(t){let n=!0;const a=this.points.length,c=this.planes.length,f=t.planes.length,y=t.points.length;for(let x=0;x<f;x++){const w=t.planes[x];let S=0;for(let P=0;P<a;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<a&&(n=!1)}if(n)return 2;for(let x=0;x<c;x++){const w=this.planes[x];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 a=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&&a++}return a===n?2:a===0?0:1}}function Xn(d,t,n){const a=d-t;return a<0?-a:Math.max(0,a-n)}function Ji(d,t,n,a,c){const f=d-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,Xn(t,a,c))}class Ku{constructor(){this._boundingVolumeCache=new Uo(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,n,a,c){const f=1<<a.z,y=1/f,x=a.x/f,w=a.y/f;let S=2;return S=Math.min(S,Ji(t,n,x,w,y)),S=Math.min(S,Ji(t,n,x+.5,-w-y,y)),S=Math.min(S,Ji(t,n,x+.5,2-w-y,y)),S}getWrap(t,n,a){const c=1<<n.z,f=1/c,y=n.x/c,x=Xn(t.x,y,f),w=Xn(t.x,y-1,f),S=Xn(t.x,y+1,f),P=Math.min(x,w,S);return P===S?1:P===w?-1:0}allowVariableZoom(t,n){return Po(t,n)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,n,a,c){return this._boundingVolumeCache.getTileBoundingVolume(t,n,a,c)}_computeTileBoundingVolume(t,n,a,c){var f,y;let x=0,w=0;if(c?.terrain){const S=new h.a3(t.z,n,t.z,t.x,t.y),P=c.terrain.getMinMaxElevation(S);x=(f=P.minElevation)!==null&&f!==void 0?f:Math.min(0,a),w=(y=P.maxElevation)!==null&&y!==void 0?y:Math.max(0,a)}if(x/=h.bD,w/=h.bD,x+=1,w+=1,t.z<=0)return Zr.fromAabb([-w,-w,-w],[w,w,w]);if(t.z===1)return Zr.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=[Gi(0,0,t.x,t.y,t.z),Gi(h.a6,0,t.x,t.y,t.z),Gi(h.a6,h.a6,t.x,t.y,t.z),Gi(0,h.a6,t.x,t.y,t.z)],P=[];for(const _e of S)P.push(h.aZ([],_e,w));if(w!==x)for(const _e of S)P.push(h.aZ([],_e,x));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 _e of P)for(let ye=0;ye<3;ye++)E[ye]=Math.min(E[ye],_e[ye]),C[ye]=Math.max(C[ye],_e[ye]);const z=Gi(h.a6/2,h.a6/2,t.x,t.y,t.z),O=h.b2([],[0,1,0],z);h.b1(O,O);const j=h.b2([],z,O);h.b1(j,j);const $=h.b2([],S[2],S[1]);h.b1($,$);const U=h.b2([],S[0],S[3]);h.b1(U,U),P.push(h.aZ([],z,w)),t.y>=(1<<t.z)/2&&P.push(h.aZ([],Gi(h.a6/2,0,t.x,t.y,t.z),w)),t.y<(1<<t.z)/2&&P.push(h.aZ([],Gi(h.a6/2,h.a6,t.x,t.y,t.z),w));const q=Go(z,P),Y=Go(j,P),Z=[-z[0],-z[1],-z[2],q.max],G=[z[0],z[1],z[2],-q.min],X=[-j[0],-j[1],-j[2],Y.max],W=[j[0],j[1],j[2],-Y.min],ee=[...$,0],ue=[...U,0],oe=[];return t.y===0?oe.push(h.bC(ue,ee,Z),h.bC(ue,ee,G)):oe.push(h.bC(X,ee,Z),h.bC(X,ee,G),h.bC(X,ue,Z),h.bC(X,ue,G)),t.y===(1<<t.z)-1?oe.push(h.bC(ue,ee,Z),h.bC(ue,ee,G)):oe.push(h.bC(W,ee,Z),h.bC(W,ee,G),h.bC(W,ue,Z),h.bC(W,ue,G)),new Zr(oe,[Z,G,X,W,ee,ue],E,C)}}}function Go(d,t){let n=1/0,a=-1/0;for(const c of t){const f=h.b3(d,c);n=Math.min(n,f),a=Math.max(a,f)}return{min:n,max:a}}class qr{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,a){this._helper.interpolatePadding(t,n,a)}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=h.bE(),this._projectionMatrix=h.bi(),this._globeViewProjMatrix32f=h.bh(),this._globeViewProjMatrixNoCorrection=h.bi(),this._globeViewProjMatrixNoCorrectionInverted=h.bi(),this._globeProjMatrixInverted=h.bi(),this._cameraPosition=h.bz(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(n,a)=>{const c=h.al(n.lat,-h.am,h.am),f=h.al(+a,this.minZoom+Qt(0,c),this.maxZoom);return{center:new h.W(n.lng,c),zoom:f}},this.applyConstrain=(n,a)=>this._helper.applyConstrain(n,a),this._helper=new ul({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(n,a)=>this.defaultConstrain(n,a)},t),this._coveringTilesDetailsProvider=new Ku}clone(){const t=new qr;return t.apply(this,!1),t}apply(t,n,a){this._globeLatitudeErrorCorrectionRadians=a||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=h.bz();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:a}=t,c=this._helper.getMercatorTileCoordinates(n);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:c,clippingPlane:this._cachedClippingPlane,projectionTransition:a?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){const n=this.pitchInRadians,a=this.cameraToCenterDistance/t,c=Math.sin(n)*a,f=Math.cos(n)*a+1,y=1/Math.sqrt(c*c+f*f)*1;let x=-c,w=f;const S=Math.sqrt(x*x+w*w);x/=S,w/=S;const P=[0,x,w];h.bF(P,P,[0,0,0],-this.bearingInRadians),h.bG(P,P,[0,0,0],-1*this.center.lat*Math.PI/180),h.bH(P,P,[0,0,0],this.center.lng*Math.PI/180);const E=1/h.b5(P);return h.aZ(P,P,E),[...P,-y*E]}isLocationOccluded(t){return!this.isSurfacePointVisible(fi(t))}transformLightDirection(t){const n=this._helper._center.lng*Math.PI/180,a=this._helper._center.lat*Math.PI/180,c=Math.cos(a),f=[Math.sin(n)*c,Math.sin(a),Math.cos(n)*c],y=[f[2],0,-f[0]],x=[0,0,0];h.b2(x,y,f),h.b1(y,y),h.b1(x,x);const w=[0,0,0];return h.b1(w,[y[0]*t[0]+x[0]*t[1]+f[0]*t[2],y[1]*t[0]+x[1]*t[1]+f[1]*t[2],y[2]*t[0]+x[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,a){const c=(function(x,w,S){const P=1/(1<<S.z);return new h.a7(x/h.a6*P+S.x*P,w/h.a6*P+S.y*P)})(t,n,a.canonical),f=(y=c.y,[h.by(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,a,c){const f=a.canonical,y=Gi(t,n,f.x,f.y,f.z),x=1+(c?c(t,n):0)/h.bD,w=[y[0]*x,y[1]*x,y[2]*x,1];h.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 h.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=Vo(this.worldSize,this.center.lat),n=h.bj(),a=h.bj();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),h.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=h.bd(n),this._globeProjMatrixInverted=h.bj(),h.bg(this._globeProjMatrixInverted,n),h.Q(n,n,[0,0,-this.cameraToCenterDistance]),h.be(n,n,this.rollInRadians),h.bf(n,n,-this.pitchInRadians),h.be(n,n,this.bearingInRadians),h.Q(n,n,[0,0,-t]);const f=h.bz();f[0]=t,f[1]=t,f[2]=t,h.bf(a,n,this.center.lat*Math.PI/180),h.bI(a,a,-this.center.lng*Math.PI/180),h.S(a,a,f),this._globeViewProjMatrixNoCorrection=a,h.bf(n,n,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),h.bI(n,n,-this.center.lng*Math.PI/180),h.S(n,n,f),this._globeViewProjMatrix32f=new Float32Array(n),this._globeViewProjMatrixNoCorrectionInverted=h.bj(),h.bg(this._globeViewProjMatrixNoCorrectionInverted,a);const y=h.bz();this._cameraPosition=h.bz(),this._cameraPosition[2]=this.cameraToCenterDistance/t,h.bF(this._cameraPosition,this._cameraPosition,y,-this.rollInRadians),h.bG(this._cameraPosition,this._cameraPosition,y,this.pitchInRadians),h.bF(this._cameraPosition,this._cameraPosition,y,-this.bearingInRadians),h.a_(this._cameraPosition,this._cameraPosition,[0,0,1]),h.bG(this._cameraPosition,this._cameraPosition,y,-this.center.lat*Math.PI/180),h.bH(this._cameraPosition,this._cameraPosition,y,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);const x=h.bd(this._globeViewProjMatrixNoCorrectionInverted);h.S(x,x,[1,1,-1]),this._cachedFrustum=pn.fromInvProjectionMatrix(x,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){h.w("calculateFogMatrix is not supported on globe projection.");const n=h.bj();return h.ap(n),n}getVisibleUnwrappedCoordinates(t){return[new h.ba(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&h.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 a=fi(t);h.aZ(a,a,1+n/h.bD);const c=h.bE();return h.aE(c,[a[0],a[1],a[2],1],this._globeViewProjMatrixNoCorrection),c[2]/c[3]}populateCache(t){}getBounds(){const t=.5*this.width,n=.5*this.height,a=[new h.P(0,0),new h.P(t,0),new h.P(this.width,0),new h.P(this.width,n),new h.P(this.width,this.height),new h.P(t,this.height),new h.P(0,this.height),new h.P(0,n)],c=[];for(const E of a)c.push(this.unprojectScreenPoint(E));let f=0,y=0,x=0,w=0;const S=this.center;for(const E of c){const C=h.bJ(S.lng,E.lng),z=h.bJ(S.lat,E.lat);C<y&&(y=C),C>f&&(f=C),z<w&&(w=z),z>x&&(x=z)}const P=[S.lng+y,S.lat+w,S.lng+f,S.lat+x];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,a,c){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,a,c)}setLocationAtPoint(t,n){const a=fi(this.unprojectScreenPoint(n)),c=fi(t),f=h.bz();h.bK(f);const y=h.bz();h.bH(y,a,f,-this.center.lng*Math.PI/180),h.bG(y,y,f,this.center.lat*Math.PI/180);const x=c[0]*c[0]+c[2]*c[2],w=y[0]*y[0];if(x<w)return;const S=Math.sqrt(x-w),P=-S,E=h.bL(c[0],c[2],y[0],S),C=h.bL(c[0],c[2],y[0],P),z=h.bz();h.bH(z,c,f,-E);const O=h.bL(z[1],z[2],y[1],y[2]),j=h.bz();h.bH(j,c,f,-C);const $=h.bL(j[1],j[2],y[1],y[2]),U=.5*Math.PI,q=O>=-U&&O<=U,Y=$>=-U&&$<=U;let Z,G;if(q&&Y){const ue=this.center.lng*Math.PI/180,oe=this.center.lat*Math.PI/180;h.bM(E,ue)+h.bM(O,oe)<h.bM(C,ue)+h.bM($,oe)?(Z=E,G=O):(Z=C,G=$)}else if(q)Z=E,G=O;else{if(!Y)return;Z=C,G=$}const X=Z/Math.PI*180,W=G/Math.PI*180,ee=this.center.lat;this.setCenter(new h.W(X,h.al(W,-90,90))),this.setZoom(this.zoom+Qt(ee,this.center.lat))}locationToScreenPoint(t,n){const a=fi(t);if(n){const c=n.getElevationForLngLatZoom(t,this._helper._tileZoom);h.aZ(a,a,1+c/h.bD)}return this._projectSurfacePointToScreen(a)}_projectSurfacePointToScreen(t){const n=h.bE();return h.aE(n,[...t,1],this._globeViewProjMatrixNoCorrection),n[0]/=n[3],n[1]/=n[3],new h.P((.5*n[0]+.5)*this.width,(.5*-n[1]+.5)*this.height)}screenPointToMercatorCoordinate(t,n){if(n){const a=n.pointCoordinate(t);if(a)return a}return h.a7.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,n){var a;return(a=this.screenPointToMercatorCoordinate(t,n))===null||a===void 0?void 0:a.toLngLat()}isPointOnMapSurface(t,n){const a=this._cameraPosition,c=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(a,c)}getRayDirectionFromPixel(t){const n=h.bE();n[0]=t.x/this.width*2-1,n[1]=-1*(t.y/this.height*2-1),n[2]=1,n[3]=1,h.aE(n,n,this._globeViewProjMatrixNoCorrectionInverted),n[0]/=n[3],n[1]/=n[3],n[2]/=n[3];const a=h.bz();a[0]=n[0]-this._cameraPosition[0],a[1]=n[1]-this._cameraPosition[1],a[2]=n[2]-this._cameraPosition[2];const c=h.bz();return h.b1(c,a),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=h.bE();return h.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 a=h.b3(t,n),c=h.bz(),f=h.bz();h.aZ(f,n,a),h.b0(c,t,f);const y=1-h.b3(c,c);if(y<0)return null;const x=h.b3(t,t)-1,w=-a+(a<0?1:-1)*Math.sqrt(y),S=x/w,P=w;return{tMin:Math.min(S,P),tMax:Math.max(S,P)}}unprojectScreenPoint(t){const n=this._cameraPosition,a=this.getRayDirectionFromPixel(t),c=this.rayPlanetIntersection(n,a);if(c){const P=h.bz();h.a_(P,n,[a[0]*c.tMin,a[1]*c.tMin,a[2]*c.tMin]);const E=h.bz();return h.b1(E,P),Cc(E)}const f=this._cachedClippingPlane,y=f[0]*a[0]+f[1]*a[1]+f[2]*a[2],x=-h.b9(f,n)/y,w=h.bz();if(x>0)h.a_(w,n,[a[0]*x,a[1]*x,a[2]*x]);else{const P=h.bz();h.a_(P,n,[2*a[0],2*a[1],2*a[2]]);const E=h.b9(this._cachedClippingPlane,P);h.b0(w,P,[this._cachedClippingPlane[0]*E,this._cachedClippingPlane[1]*E,this._cachedClippingPlane[2]*E])}const S=(function(P){const E=h.bz();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 Cc((function(P,E,C){const z=h.bz();h.b0(z,C,P);const O=h.bz();return h.bx(O,P,z,E/h.b7(z)),O})(S.center,S.radius,w))}getMatrixForModel(t,n){const a=h.W.convert(t),c=1/h.bD,f=h.bi();return h.bI(f,f,a.lng/180*Math.PI),h.bf(f,f,-a.lat/180*Math.PI),h.Q(f,f,[0,0,1+n/h.bD]),h.bf(f,f,.5*Math.PI),h.S(f,f,[c,c,c]),f}getProjectionDataForCustomLayer(t=!0){const n=this.getProjectionData({overscaledTileID:new h.a3(0,0,0,0,0),applyGlobeMatrix:t});return n.tileMercatorCoords=[0,0,1,1],n}getFastPathSimpleProjectionMatrix(t){}}class Wr{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,a){this._helper.interpolatePadding(t,n,a)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n,a=!0){this._helper.resize(t,n,a)}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,a)=>this.currentTransform.defaultConstrain(n,a),this.applyConstrain=(n,a)=>this._helper.applyConstrain(n,a),this._helper=new ul({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(n,a)=>this.defaultConstrain(n,a)},t),this._globeness=1,this._mercatorTransform=new Mr,this._verticalPerspectiveTransform=new qr}clone(){const t=new Wr;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),a=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?a.mainMatrix:n.mainMatrix,clippingPlane:a.clippingPlane,tileMercatorCoords:a.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 h.bt(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return h.bt(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,n,a){const c=this._mercatorTransform.getPitchedTextCorrection(t,n,a),f=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,n,a);return h.bt(c,f,this._globeness)}projectTileCoordinates(t,n,a,c){return this.currentTransform.projectTileCoordinates(t,n,a,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,a,c){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,a,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 a=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return a.fallbackMatrix=n.mainMatrix,a}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class cr{get useGlobeControls(){return!0}handlePanInertia(t,n){const a=Ac(t,n);return Math.abs(a.lng-n.center.lng)>180&&(a.lng=n.center.lng+179.5*Math.sign(a.lng-n.center.lng)),{easingCenter:a,easingOffset:new h.P(0,0)}}handleMapControlsRollPitchBearingZoom(t,n){const a=t.around,c=n.screenPointToLocation(a);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 x=h.bJ(n.center.lng,c.lng),w=x/(Math.abs(x/180)+1),S=h.bJ(n.center.lat,c.lat),P=n.getRayDirectionFromPixel(a),E=n.cameraPosition,C=-1*h.b3(E,P),z=h.bz();h.a_(z,E,[P[0]*C,P[1]*C,P[2]*C]);const O=h.b5(z)-1,j=Math.exp(.5*-Math.max(O-.3,0)),$=Vo(n.worldSize,n.center.lat)/Math.min(n.width,n.height),U=h.bw($,.9,.5,1,.25),q=(1-h.ao(-y))*Math.min(j,U),Y=n.center.lat,Z=n.zoom,G=new h.W(n.center.lng+w*q,h.al(n.center.lat+S*q,-h.am,h.am));n.setLocationAtPoint(c,a);const X=n.center,W=h.bw(Math.abs(x),45,85,0,1),ee=h.bw($,.75,.35,0,1),ue=Math.pow(Math.max(W,ee),.25),oe=h.bJ(X.lng,G.lng),_e=h.bJ(X.lat,G.lat);n.setCenter(new h.W(X.lng+oe*ue,X.lat+_e*ue).wrap()),n.setZoom(Z+Qt(Y,n.center.lat))}handleMapControlsPan(t,n,a){if(!t.panDelta)return;const c=n.center.lat,f=n.zoom;n.setCenter(Ac(t.panDelta,n).wrap()),n.setZoom(f+Qt(c,n.center.lat))}cameraForBoxAndBearing(t,n,a,c,f){const y=Ds(t,n,a,c,f),x=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=h.bJ(a.getWest(),a.getEast())<0,C=E?a.getEast():a.getWest(),z=E?a.getWest():a.getEast(),O=Math.max(a.getNorth(),a.getSouth()),j=Math.min(a.getNorth(),a.getSouth()),$=C+.5*h.bJ(C,z),U=O+.5*h.bJ(O,j),q=f.clone();q.setCenter(y.center),q.setBearing(y.bearing),q.setPitch(0),q.setRoll(0),q.setZoom(y.zoom);const Y=q.modelViewProjectionMatrix,Z=[fi(a.getNorthWest()),fi(a.getNorthEast()),fi(a.getSouthWest()),fi(a.getSouthEast()),fi(new h.W(z,U)),fi(new h.W(C,U)),fi(new h.W($,O)),fi(new h.W($,j))],G=fi(y.center);let X=Number.POSITIVE_INFINITY;for(const W of Z)x<0&&(X=cr.getLesserNonNegativeNonNull(X,cr.solveVectorScale(W,G,Y,"x",x))),w>0&&(X=cr.getLesserNonNegativeNonNull(X,cr.solveVectorScale(W,G,Y,"x",w))),S>0&&(X=cr.getLesserNonNegativeNonNull(X,cr.solveVectorScale(W,G,Y,"y",S))),P<0&&(X=cr.getLesserNonNegativeNonNull(X,cr.solveVectorScale(W,G,Y,"y",P)));if(Number.isFinite(X)&&X!==0)return y.zoom=Math.min(q.zoom+h.ar(X),t.maxZoom),y;Lo()}handleJumpToCenterZoom(t,n){const a=t.center.lat,c=t.applyConstrain(n.center?h.W.convert(n.center):t.center,t.zoom).center;t.setCenter(c.wrap());const f=n.zoom!==void 0?+n.zoom:t.zoom+Qt(a,c.lat);t.zoom!==f&&t.setZoom(f)}handleEaseTo(t,n){const a=t.zoom,c=t.center,f=t.padding,y={roll:t.roll,pitch:t.pitch,bearing:t.bearing},x={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?h.W.convert(n.center):c,C=t.applyConstrain(E,a).center;Cs(t,C);const z=t.clone();z.setCenter(C),z.setZoom(w?+n.zoom:a+Qt(c.lat,E.lat)),z.setBearing(n.bearing);const O=new h.P(h.al(t.centerPoint.x+n.offsetAsPoint.x,0,t.width),h.al(t.centerPoint.y+n.offsetAsPoint.y,0,t.height));z.setLocationAtPoint(C,O);const j=(n.offset&&n.offsetAsPoint.mag())>0?z.center:C,$=w?+n.zoom:a+Qt(c.lat,j.lat),U=a+Qt(c.lat,0),q=$+Qt(j.lat,0),Y=h.bJ(c.lng,j.lng),Z=h.bJ(c.lat,j.lat),G=h.ao(q-U);return P=$!==a,{easeFunc:X=>{if(h.bn(y,x)||Fo({startEulerAngles:y,endEulerAngles:x,tr:t,k:X,useSlerp:y.roll!=x.roll}),S&&t.interpolatePadding(f,n.padding,X),n.around)h.w("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(n.around,n.aroundPoint);else{const W=q>U?Math.min(2,G):Math.max(.5,G),ee=Math.pow(W,1-X),ue=No(c,Y,Z,X*ee);t.setCenter(ue.wrap())}if(P){const W=h.H.number(U,q,X)+Qt(0,t.center.lat);t.setZoom(W)}},isZooming:P,elevationCenter:j}}handleFlyTo(t,n){const a=n.zoom!==void 0,c=t.center,f=t.zoom,y=t.padding,x=!t.isPaddingEqual(n.padding),w=t.applyConstrain(h.W.convert(n.center||n.locationAtOffset),f).center,S=a?+n.zoom:t.zoom+Qt(t.center.lat,w.lat),P=t.clone();P.setCenter(w),P.setZoom(S),P.setBearing(n.bearing);const E=new h.P(h.al(t.centerPoint.x+n.offsetAsPoint.x,0,t.width),h.al(t.centerPoint.y+n.offsetAsPoint.y,0,t.height));P.setLocationAtPoint(w,E);const C=P.center;Cs(t,C);const z=(function(Z,G,X){const W=fi(G),ee=fi(X),ue=h.b3(W,ee),oe=Math.acos(ue),_e=fl(Z);return oe/(2*Math.PI)*_e})(t,c,C),O=f+Qt(c.lat,0),j=S+Qt(C.lat,0),$=h.ao(j-O);let U;if(typeof n.minZoom=="number"){const Z=+n.minZoom+Qt(C.lat,0),G=Math.min(Z,O,j)+Qt(0,C.lat),X=t.applyConstrain(C,G).zoom+Qt(C.lat,0);U=h.ao(X-O)}const q=h.bJ(c.lng,C.lng),Y=h.bJ(c.lat,C.lat);return{easeFunc:(Z,G,X,W)=>{const ee=No(c,q,Y,X);x&&t.interpolatePadding(y,n.padding,Z);const ue=Z===1?C:ee;t.setCenter(ue.wrap());const oe=O+h.ar(G);t.setZoom(Z===1?S:oe+Qt(0,ue.lat))},scaleOfZoom:$,targetCenter:C,scaleOfMinZoom:U,pixelPathLength:z}}static solveVectorScale(t,n,a,c,f){const y=c==="x"?[a[0],a[4],a[8],a[12]]:[a[1],a[5],a[9],a[13]],x=[a[3],a[7],a[11],a[15]],w=t[0]*y[0]+t[1]*y[1]+t[2]*y[2],S=t[0]*x[0]+t[1]*x[1]+t[2]*x[2],P=n[0]*y[0]+n[1]*y[1]+n[2]*y[2],E=n[0]*x[0]+n[1]*x[1]+n[2]*x[2];return P+f*S===w+f*E||x[3]*(w-P)+y[3]*(E-S)+w*E==P*S?null:(P+y[3]-f*E-f*x[3])/(P-w-f*E+f*S)}static getLesserNonNegativeNonNull(t,n){return n!==null&&n>=0&&n<t?n:t}}class ks{constructor(t){this._globe=t,this._mercatorCameraHelper=new qn,this._verticalPerspectiveCameraHelper=new cr}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){this.currentHelper.handleMapControlsRollPitchBearingZoom(t,n)}handleMapControlsPan(t,n,a){this.currentHelper.handleMapControlsPan(t,n,a)}cameraForBoxAndBearing(t,n,a,c,f){return this.currentHelper.cameraForBoxAndBearing(t,n,a,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 $o=(d,t)=>h.C(d,t?.filter((n=>n.identifier!=="source.canvas"))),Yn=h.bN();class ml extends h.E{constructor(t,n={}){var a,c;super(),this._rtlPluginLoaded=()=>{for(const y in this.tileManagers){const x=this.tileManagers[y].getSource().type;x!=="vector"&&x!=="geojson"||this.tileManagers[y].reload()}},this.map=t,this.dispatcher=new nn(Sr(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",((y,x)=>this.getGlyphs(y,x))),this.dispatcher.registerMessageHandler("GI",((y,x)=>this.getImages(y,x))),this.dispatcher.registerMessageHandler("GDA",((y,x)=>this.getDashes(y,x))),this.imageManager=new Le,this.imageManager.setEventedParent(this);const f=((a=t._container)===null||a===void 0?void 0:a.lang)||typeof document<"u"&&((c=document.documentElement)===null||c===void 0?void 0:c.lang)||void 0;this.glyphManager=new Be(t._requestManager,n.localIdeographFontFamily,f),this.lineAtlas=new ys(256,512),this.crossTileSymbolIndex=new Si,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",h.bO()),zn().on(ln,this._rtlPluginLoaded),this.on("data",(y=>{if(y.dataType!=="source"||y.sourceDataType!=="metadata")return;const x=this.tileManagers[y.sourceId];if(!x)return;const w=x.getSource();if(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 h.bP,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 a,c,f;this._checkLoaded();const y=n===null?(f=(c=(a=this.stylesheet.state)===null||a===void 0?void 0:a[t])===null||c===void 0?void 0:c.default)!==null&&f!==void 0?f:null:n;if(h.bQ(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 a in t)!h.bQ(this._globalState[a],t[a].default)&&(n.push(a),this._globalState[a]=t[a].default);this._applyGlobalStateChanges(n)}_applyGlobalStateChanges(t){if(t.length===0)return;const n=new Set,a={};for(const c of t){a[c]=this._globalState[c];for(const f in this._layers){const y=this._layers[f],x=y.getLayoutAffectingGlobalStateRefs(),w=y.getPaintAffectingGlobalStateRefs(),S=y.getVisibilityAffectingGlobalStateRefs();if(x.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",a);for(const c in this.tileManagers)n.has(c)&&(this._reloadSource(c),this._changed=!0)}loadURL(t){return h._(this,arguments,void 0,(function*(n,a={},c){this.fire(new h.n("dataloading",{dataType:"style"})),a.validate=typeof a.validate!="boolean"||a.validate,this._loadStyleRequest=new AbortController;const f=this._loadStyleRequest;try{const y=yield this.map._requestManager.transformRequest(n,"Style");h.bR(f.signal);const x=yield h.k(y,f);this._loadStyleRequest===f&&(this._loadStyleRequest=null),this._load(x.data,a,c)}catch(y){this._loadStyleRequest===f&&(this._loadStyleRequest=null),y&&!f.signal.aborted&&this.fire(new h.l(h.d(y)))}}))}loadJSON(t,n={},a){this.fire(new h.n("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,Ze.frameAsync(this._frameRequest,this.map._ownerWindow).then((()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(t,n,a)})).catch((()=>{}))}loadEmpty(){this.fire(new h.n("dataloading",{dataType:"style"})),this._load(Yn,{validate:!1})}_load(t,n,a){var c,f;let y=n.transformStyle?n.transformStyle(a,t):t;if(!n.validate||!$o(this,h.F(y))){y=Object.assign({},y),this._loaded=!0,this.stylesheet=y;for(const x in y.sources)this.addSource(x,y.sources[x],{validate:!1});y.sprite?this._loadSprite(y.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(y.glyphs),this._createLayers(),this.light=new ar(this.stylesheet.light),this._setProjectionInternal(((c=this.stylesheet.projection)===null||c===void 0?void 0:c.type)||"mercator"),this.sky=new _s(this.stylesheet.sky),this.map.setTerrain((f=this.stylesheet.terrain)!==null&&f!==void 0?f:null),this.fire(new h.n("data",{dataType:"style"})),this.fire(new h.n("style.load"))}}_createLayers(){var t,n,a;const c=h.bS(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=h.bT(f,this._globalState);if(y.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=y,h.bU(y)&&this.tileManagers[y.source]){const x=(a=(n=f.paint)===null||n===void 0?void 0:n["raster-fade-duration"])!==null&&a!==void 0?a:y.paint.get("raster-fade-duration");this.tileManagers[y.source].setRasterFadeDuration(x)}}}_loadSprite(t,n=!1,a=void 0){this.imageManager.setLoaded(!1);const c=new AbortController;let f;this._spriteRequest=c,(function(y,x,w,S){return h._(this,void 0,void 0,(function*(){const P=J(y),E=w>1?"@2x":"",C={},z={};for(const{id:O,url:j}of P){const $=yield x.transformRequest(ie(j,E,".json"),"SpriteJSON");C[O]=h.k($,S);const U=yield x.transformRequest(ie(j,E,".png"),"SpriteImage");z[O]=Ye.getImage(U,S)}return yield Promise.all([...Object.values(C),...Object.values(z)]),(function(O,j){return h._(this,void 0,void 0,(function*(){const $={};for(const U in O){$[U]={};const q=Ze.getImageCanvasContext((yield j[U]).data),Y=(yield O[U]).data;for(const Z in Y){const{width:G,height:X,x:W,y:ee,sdf:ue,pixelRatio:oe,stretchX:_e,stretchY:ye,content:ze,textFitWidth:Ie,textFitHeight:me}=Y[Z];$[U][Z]={data:null,pixelRatio:oe,sdf:ue,stretchX:_e,stretchY:ye,content:ze,textFitWidth:Ie,textFitHeight:me,spriteData:{width:G,height:X,x:W,y:ee,context:q}}}}return $}))})(C,z)}))})(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((y=>{if(this._spriteRequest=null,y)for(const x in y){this._spritesImagesIds[x]=[];const w=this._spritesImagesIds[x]?this._spritesImagesIds[x].filter((S=>!(S in y))):[];for(const S of w)this.imageManager.removeImage(S),this._changedImages[S]=!0;for(const S in y[x]){const P=x==="default"?S:`${x}:${S}`;this._spritesImagesIds[x].push(P),P in this.imageManager.images?this.imageManager.updateImage(P,y[x][S],!1):this.imageManager.addImage(P,y[x][S]),n&&(this._changedImages[P]=!0)}}})).catch((y=>{this._spriteRequest=null,f=y,c.signal.aborted||this.fire(new h.l(f))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.n("data",{dataType:"style"})),a&&a(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 h.n("data",{dataType:"style"}))}_validateLayer(t){const n=this.tileManagers[t.source];if(!n)return;const a=t.sourceLayer;if(!a)return;const c=n.getSource();(c.type==="geojson"||c.vectorLayerIds&&!c.vectorLayerIds.includes(a))&&this.fire(new h.l(new Error(`Source layer "${a}" 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 a=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n?h.bV(a):a);const c=[];for(const f of t)if(a[f]){const y=n?h.bV(a[f]):a[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 a of n){const c=this._layers[a];c.type!=="custom"&&(t[a]=c.serialize())}return t}hasTransitions(){var t,n,a;if(!((t=this.light)===null||t===void 0)&&t.hasTransition()||!((n=this.sky)===null||n===void 0)&&n.hasTransition()||!((a=this.projection)===null||a===void 0)&&a.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 x=this._updatedSources[y];if(x==="reload")this._reloadSource(y);else{if(x!=="clear")throw new Error(`Invalid action ${x}`);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 a={};for(const c in this.tileManagers){const f=this.tileManagers[c];a[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 a){const f=this.tileManagers[c];!!a[c]!=!!f.used&&f.fire(new h.n("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 h.n("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 a;this._checkLoaded();const c=this.serialize();if(t=n.transformStyle?n.transformStyle(c,t):t,((a=n.validate)===null||a===void 0||a)&&$o(this,h.F(t)))return!1;(t=h.bV(t)).layers=h.bS(t.layers);const f=h.bW(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 x of y.operations)x();return this.stylesheet=t,this._serializedLayers=null,this.fire(new h.n("style.load",{style:this})),!0}_getOperationsToPerform(t){const n=[],a=[];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:a.push(c.command)}return{operations:n,unimplemented:a}}addImage(t,n){if(this.getImage(t))return this.fire(new h.l(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 h.l(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 h.n("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,a={}){var c;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"].includes(n.type)&&this._validate(h.F.source,`sources.${t}`,n,null,a))return;!((c=this.map)===null||c===void 0)&&c._collectResourceTiming&&(n.collectResourceTiming=!0);const f=this.tileManagers[t]=new Jt(t,n,this.dispatcher);f.style=this,f.setEventedParent(this,(()=>({isSourceLoaded:f.loaded(),source:f.serialize(),sourceId:t}))),f.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 a in this._layers)if(this._layers[a].source===t)return this.fire(new h.l(new Error(`Source "${t}" cannot be removed while layer "${a}" is using it.`)));const n=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],n.fire(new h.n("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 a=this.tileManagers[t].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(n),this._changed=!0}getSource(t){var n;return(n=this.tileManagers[t])===null||n===void 0?void 0:n.getSource()}addLayer(t,n,a={}){this._checkLoaded();const c=t.id;if(this.getLayer(c))return void this.fire(new h.l(new Error(`Layer "${c}" already exists on this map.`)));let f;if(t.type==="custom"){if($o(this,h.bX(t)))return;f=h.bT(t,this._globalState)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(c,t.source),t=h.bV(t),t=h.e(t,{source:c})),this._validate(h.F.layer,`layers.${c}`,t,{arrayIndex:-1},a))return;f=h.bT(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 h.l(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 x=this._removedLayers[c];delete this._removedLayers[c],x.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 h.l(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const a=this._order.indexOf(t);this._order.splice(a,1);const c=n?this._order.indexOf(n):this._order.length;n&&c===-1?this.fire(new h.l(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 h.l(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const a=this._order.indexOf(t);this._order.splice(a,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,a){this._checkLoaded();const c=this.getLayer(t);c?c.minzoom===n&&c.maxzoom===a||(n!=null&&(c.minzoom=n),a!=null&&(c.maxzoom=a),this._updateLayer(c)):this.fire(new h.l(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,a={}){this._checkLoaded();const c=this.getLayer(t);if(c){if(!h.bQ(c.filter,n))return n==null?(c.setFilter(void 0),void this._updateLayer(c)):void(this._validate(h.F.filter,`layers.${c.id}.filter`,n,null,a)||(c.setFilter(h.bV(n)),this._updateLayer(c)))}else this.fire(new h.l(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return h.bV(this.getLayer(t).filter)}setLayoutProperty(t,n,a,c={}){this._checkLoaded();const f=this.getLayer(t);f?h.bQ(f.getLayoutProperty(n),a)||(f.setLayoutProperty(n,a,c),this._updateLayer(f)):this.fire(new h.l(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const a=this.getLayer(t);if(a)return a.getLayoutProperty(n);this.fire(new h.l(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,a,c={}){this._checkLoaded();const f=this.getLayer(t);f?h.bQ(f.getPaintProperty(n),a)||this._updatePaintProperty(f,n,a,c):this.fire(new h.l(new Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,n,a,c={}){t.setPaintProperty(n,a,c)&&this._updateLayer(t),h.bU(t)&&n==="raster-fade-duration"&&this.tileManagers[t.source].setRasterFadeDuration(a),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 a=t.source,c=t.sourceLayer,f=this.tileManagers[a];if(f===void 0)return void this.fire(new h.l(new Error(`The source '${a}' does not exist in the map's style.`)));const y=f.getSource().type;y==="geojson"&&c?this.fire(new h.l(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):y!=="vector"||c?(t.id===void 0&&this.fire(new h.l(new Error("The feature id parameter must be provided."))),f.setFeatureState(c,t.id,n)):this.fire(new h.l(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const a=t.source,c=this.tileManagers[a];if(c===void 0)return void this.fire(new h.l(new Error(`The source '${a}' 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 h.l(new Error("A feature id is required to remove its specific state property."))):c.removeFeatureState(y,t.id,n):this.fire(new h.l(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,a=t.sourceLayer,c=this.tileManagers[n];if(c!==void 0)return c.getSource().type!=="vector"||a?(t.id===void 0&&this.fire(new h.l(new Error("The feature id parameter must be provided."))),c.getFeatureState(a,t.id)):void this.fire(new h.l(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new h.l(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){var t;return h.e({duration:300,delay:0},(t=this.stylesheet)===null||t===void 0?void 0:t.transition)}serialize(){if(!this._loaded)return;const t=h.bY(this.tileManagers,(f=>f.serialize())),n=this._serializeByIds(this._order,!0),a=this.map.getTerrain()||void 0,c=this.stylesheet;return h.bZ({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:a},(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",a={},c=[];for(let y=this._order.length-1;y>=0;y--){const x=this._order[y];if(n(x)){a[x]=y;for(const w of t){const S=w[x];if(S)for(const P of S)c.push(P)}}}c.sort(((y,x)=>x.intersectionZ-y.intersectionZ));const f=[];for(let y=this._order.length-1;y>=0;y--){const x=this._order[y];if(n(x))for(let w=c.length-1;w>=0;w--){const S=c[w].feature;if(a[S.layer.id]<y)break;f.push(S),c.pop()}else for(const w of t){const S=w[x];if(S)for(const P of S)f.push(P.feature)}}return f}queryRenderedFeatures(t,n,a){n?.filter&&this._validate(h.F.filter,"queryRenderedFeatures.filter",n.filter,null,n);const c={};if(n?.layers){if(!(Array.isArray(n.layers)||n.layers instanceof Set))return this.fire(new h.l(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 h.l(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(),x=n.layers instanceof Set?n.layers:Array.isArray(n.layers)?new Set(n.layers):null,w=Object.assign(Object.assign({},n),{layers:x,globalState:this._globalState});for(const S in this.tileManagers)n.layers&&!c[S]||f.push(pi(this.tileManagers[S],this._layers,y,t,w,a,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,O,j){const $={},U=O.queryRenderedSymbols(C),q=[];for(const Y of Object.keys(U).map(Number))q.push(j[Y]);q.sort(Yi);for(const Y of q){const Z=Y.featureIndex.lookupSymbolFeatures(U[Y.bucketInstanceId],P,Y.bucketIndex,Y.sourceLayerIndex,{filterSpec:z.filter,globalState:z.globalState},z.layers,z.availableImages,S);for(const G in Z){$[G]||($[G]=[]);const X=Z[G];X.sort(((W,ee)=>{const ue=Y.featureSortOrder;if(ue){const oe=ue.indexOf(W.featureIndex);return ue.indexOf(ee.featureIndex)-oe}return ee.featureIndex-W.featureIndex}));for(const W of X)$[G].push(W)}}return(function(Y,Z,G){for(const X in Y)for(const W of Y[X])oi(W,G[Z[X].source]);return Y})($,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(h.F.filter,"querySourceFeatures.filter",n.filter,null,n);const a=this.tileManagers[t];return a?(function(c,f){const y=c.getRenderableIds().map((S=>c.getTileByID(S))),x=[],w={};for(const S of y){const P=S.tileID.canonical.key;w[P]||(w[P]=!0,S.querySourceFeatures(x,f))}return x})(a,n?Object.assign(Object.assign({},n),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const a=this.light.getLight();let c=!1;for(const y in t)if(!h.bQ(t[y],a[y])){c=!0;break}if(!c)return;const f={now:je(),transition:h.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){this._checkLoaded();const n=t??{type:"mercator"};if(this.stylesheet.projection=t,this.projection){if(this.projection.name===n.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(n.type)}getSky(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.sky}setSky(t,n={}){this._checkLoaded();const a=this.getSky();let c=!1;if(!t&&!a)return;if(t&&!a)c=!0;else if(!t&&a)c=!0;else for(const y in t)if(!h.bQ(t[y],a[y])){c=!0;break}if(!c)return;const f={now:je(),transition:h.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(a,c){const f={constrainOverride:c};if(Array.isArray(a)){const y=new pl({type:a});return{projection:y,transform:new Wr(f),cameraHelper:new ks(y)}}switch(a){case"mercator":return{projection:new Zn,transform:new Mr(f),cameraHelper:new qn};case"globe":{const y=new pl({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:y,transform:new Wr(f),cameraHelper:new ks(y)}}case"vertical-perspective":return{projection:new lr,transform:new qr(f),cameraHelper:new cr};default:return h.w(`Unknown projection name: ${a}. Falling back to mercator projection.`),{projection:new Zn,transform:new Mr(f),cameraHelper:new qn}}})(t,this.map.transformConstrain);this.projection=n.projection,this.map.migrateProjection(n.transform,n.cameraHelper);for(const a in this.tileManagers)this.tileManagers[a].reload()}_validate(t,n,a,c,f={}){return f?.validate!==!1&&$o(this,t.call(h.F,h.e({key:n,style:this.serialize(),value:a,styleSpec:h.x},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),zn().off(ln,this._rtlPluginLoaded);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.tileManagers){const a=this.tileManagers[n];a.setEventedParent(null),a.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,a,c,f=!1){let y=!1,x=!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,O)=>O.tileID.overscaledZ-z.tileID.overscaledZ||(z.tileID.isLessThan(O.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||a===0),(f||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(je(),t.zoom))&&(this.pauseablePlacement=new Ti(t,this.map.terrain,this._order,f,n,a,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(je()),x=!0),y&&this.pauseablePlacement.placement.setStale()),x||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(je())}_releaseSymbolFadeTiles(){for(const t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}getImages(t,n){return h._(this,void 0,void 0,(function*(){const a=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),a}))}getGlyphs(t,n){return h._(this,void 0,void 0,(function*(){const a=yield this.glyphManager.getGlyphs(n.stacks),c=this.tileManagers[n.source];return c&&c.setDependencies(n.tileID.key,n.type,[""]),a}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(h.F.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}getDashes(t,n){return h._(this,void 0,void 0,(function*(){const a={};for(const[c,f]of Object.entries(n.dashes))a[c]=this.lineAtlas.getDash(f.dasharray,f.round);return a}))}addSprite(t,n,a={},c){this._checkLoaded();const f=[{id:t,url:n}],y=[...J(this.stylesheet.sprite),...f];this._validate(h.F.sprite,"sprite",y,null,a)||(this.stylesheet.sprite=y,this._loadSprite(f,!0,c))}removeSprite(t){this._checkLoaded();const n=J(this.stylesheet.sprite);if(n.find((a=>a.id===t))){if(this._spritesImagesIds[t])for(const a of this._spritesImagesIds[t])this.imageManager.removeImage(a),this._changedImages[a]=!0;n.splice(n.findIndex((a=>a.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 h.n("data",{dataType:"style"}))}else this.fire(new h.l(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return J(this.stylesheet.sprite)}setSprite(t,n={},a){this._checkLoaded(),t&&this._validate(h.F.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,a):(this._unloadSprite(),a&&a(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 Dc=h.aS([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ju{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,a,c,f,y,x,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!==a||P||this.boundIndexBuffer!==f||this.boundVertexOffset!==y||this.boundDynamicVertexBuffer!==x||this.boundDynamicVertexBuffer2!==w||this.boundDynamicVertexBuffer3!==S?this.freshBind(n,a,c,f,y,x,w,S):(t.bindVertexArray.set(this.vao),x&&x.bind(),f?.dynamicDraw&&f.bind(),w&&w.bind(),S&&S.bind())}freshBind(t,n,a,c,f,y,x,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=a,this.boundIndexBuffer=c,this.boundVertexOffset=f,this.boundDynamicVertexBuffer=y,this.boundDynamicVertexBuffer2=x,this.boundDynamicVertexBuffer3=w,n.enableAttributes(E,t);for(const C of a)C.enableAttributes(E,t);y&&y.enableAttributes(E,t),x&&x.enableAttributes(E,t),w&&w.enableAttributes(E,t),n.bind(),n.setVertexAttribPointers(E,t,f);for(const C of a)C.bind(),C.setVertexAttribPointers(E,t,f);y&&(y.bind(),y.setVertexAttribPointers(E,t,f)),c&&c.bind(),x&&(x.bind(),x.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 zc=(d,t,n,a,c)=>({u_texture:0,u_ele_delta:d,u_fog_matrix:t,u_fog_color:n?n.properties.get("fog-color"):h.bo.white,u_fog_ground_blend:n?n.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:c?0:n?n.calculateFogBlendOpacity(a):0,u_horizon_color:n?n.properties.get("horizon-color"):h.bo.white,u_horizon_fog_blend:n?n.properties.get("horizon-fog-blend"):1,u_is_globe_mode:c?1:0}),gl={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 Rs(d){const t=[];for(const n of d){if(n===null)continue;const a=n.split(" ");t.push(a.pop())}return t}class kc{constructor(t,n,a,c,f,y,x,w,S=[]){const P=t.gl;this.program=P.createProgram();const E=Rs(n.staticAttributes),C=a?a.getBinderAttributes():[],z=E.concat(C),O=Rt.prelude.staticUniforms?Rs(Rt.prelude.staticUniforms):[],j=x.staticUniforms?Rs(x.staticUniforms):[],$=n.staticUniforms?Rs(n.staticUniforms):[],U=a?a.getBinderUniforms():[],q=O.concat(j).concat($).concat(U),Y=[];for(const oe of q)Y.includes(oe)||Y.push(oe);const Z=a?a.defines():[];vr(P)&&Z.unshift("#version 300 es"),f&&Z.push("#define OVERDRAW_INSPECTOR;"),y&&Z.push("#define TERRAIN3D;"),w&&Z.push(w),S&&Z.push(...S);let G=Z.concat(Rt.prelude.fragmentSource,x.fragmentSource,n.fragmentSource).join(`
797
+ `),X=Z.concat(Rt.prelude.vertexSource,x.vertexSource,n.vertexSource).join(`
798
+ `);vr(P)||(G=(function(oe){return oe.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")})(G),X=(function(oe){return oe.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")})(X));const W=P.createShader(P.FRAGMENT_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(W,G),P.compileShader(W),!P.getShaderParameter(W,P.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${P.getShaderInfoLog(W)}`);P.attachShader(this.program,W);const ee=P.createShader(P.VERTEX_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(ee,X),P.compileShader(ee),!P.getShaderParameter(ee,P.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${P.getShaderInfoLog(ee)}`);P.attachShader(this.program,ee),this.attributes={};const ue={};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(ee),P.deleteShader(W);for(const oe of Y)if(oe&&!ue[oe]){const _e=P.getUniformLocation(this.program,oe);_e&&(ue[oe]=_e)}this.fixedUniforms=c(t,ue),this.terrainUniforms=((oe,_e)=>({u_depth:new h.b_(oe,_e.u_depth),u_terrain:new h.b_(oe,_e.u_terrain),u_terrain_dim:new h.bp(oe,_e.u_terrain_dim),u_terrain_matrix:new h.c0(oe,_e.u_terrain_matrix),u_terrain_unpack:new h.c1(oe,_e.u_terrain_unpack),u_terrain_exaggeration:new h.bp(oe,_e.u_terrain_exaggeration)}))(t,ue),this.projectionUniforms=((oe,_e)=>({u_projection_matrix:new h.c0(oe,_e.u_projection_matrix),u_projection_tile_mercator_coords:new h.c1(oe,_e.u_projection_tile_mercator_coords),u_projection_clipping_plane:new h.c1(oe,_e.u_projection_clipping_plane),u_projection_transition:new h.bp(oe,_e.u_projection_transition),u_projection_fallback_matrix:new h.c0(oe,_e.u_projection_fallback_matrix)}))(t,ue),this.binderUniforms=a?a.getUniforms(t,ue):[]}draw(t,n,a,c,f,y,x,w,S,P,E,C,z,O,j,$,U,q,Y){var Z;const G=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(a),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 W in this.terrainUniforms)this.terrainUniforms[W].set(w[W])}if(S)for(const W in S)this.projectionUniforms[gl[W]].set(S[W]);if(x)for(const W in this.fixedUniforms)this.fixedUniforms[W].set(x[W]);$&&$.setUniforms(t,this.binderUniforms,O,{zoom:j});let X=0;switch(n){case G.LINES:X=2;break;case G.TRIANGLES:X=3;break;case G.LINE_STRIP:X=1}for(const W of z.get())W.vaos||(W.vaos={}),(Z=W.vaos)[P]||(Z[P]=new Ju),W.vaos[P].bind(t,this,E,$?$.getPaintVertexBuffers():[],C,W.vertexOffset,U,q,Y),G.drawElements(n,W.primitiveLength*X,G.UNSIGNED_SHORT,W.primitiveOffset*X*2)}}function _l(d,t,n){const a=1/h.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),x=f*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[a,d.fromScale,d.toScale],u_fade:d.t,u_pixel_coord_upper:[y>>16,x>>16],u_pixel_coord_lower:[65535&y,65535&x]}}const yl=(d,t,n,a)=>{const c=d.style.light,f=c.properties.get("position"),y=[f.x,f.y,f.z],x=h.c4();c.properties.get("anchor")==="viewport"&&h.c5(x,d.transform.bearingInRadians),h.c6(y,y,x);const w=d.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:a}},fn=(d,t,n,a,c,f,y)=>h.e(yl(d,t,n,a),_l(f,d,y),{u_height_factor:-Math.pow(2,c.overscaledZ)/y.tileSize/8}),vl=(d,t,n,a)=>h.e(_l(t,d,n),{u_fill_translate:a}),Rc=(d,t)=>({u_world:d,u_fill_translate:t}),Ls=(d,t,n,a,c)=>h.e(vl(d,t,n,c),{u_world:a}),Qu=(d,t,n,a,c)=>{const f=d.transform;let y,x,w=0;if(n.paint.get("circle-pitch-alignment")==="map"){const S=h.aK(t,1,f.zoom);y=!0,x=[S,S],w=S/(h.a6*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*c}else y=!1,x=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:d.pixelRatio,u_extrude_scale:x,u_globe_extrude_scale:w,u_translate:a}},Zo=d=>({u_pixel_extrude_scale:[1/d.width,1/d.height]}),eh=d=>({u_viewport_size:[d.width,d.height]}),Lc=(d,t=1)=>({u_color:d,u_overlay:0,u_overlay_scale:t}),xl=(d,t,n,a)=>{const c=h.aK(d,1,t)/(h.a6*Math.pow(2,d.tileID.overscaledZ))*2*Math.PI*a;return{u_extrude_scale:h.aK(d,1,t),u_intensity:n,u_globe_extrude_scale:c}},bl=(d,t,n,a)=>{const c=h.O();h.c7(c,0,d.width,d.height,0,0,1);const f=d.context.gl;return{u_matrix:c,u_world:[f.drawingBufferWidth,f.drawingBufferHeight],u_image:n,u_color_ramp:a,u_opacity:t.paint.get("heatmap-opacity")}},Fc=(d,t,n)=>{const a=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]+=d.transform.bearingInRadians);return{u_image:0,u_latrange:Bc(0,t.tileID),u_exaggeration:n.paint.get("hillshade-exaggeration"),u_altitudes:f.altitudeRadians,u_azimuths:f.directionRadians,u_accent:a,u_method:c,u_highlights:f.highlightColor,u_shadows:f.shadowColor}},wl=(d,t)=>{const n=t.stride,a=h.O();return h.c7(a,0,h.a6,-h.a6,0,0,1),h.Q(a,a,[0,-h.a6,0]),{u_matrix:a,u_image:1,u_dimension:[n,n],u_zoom:d.overscaledZ,u_unpack:t.getUnpackVector()}};function Bc(d,t){const n=Math.pow(2,t.canonical.z),a=t.canonical.y;return[new h.a7(0,a/n).toLngLat().lat,new h.a7(0,(a+1)/n).toLngLat().lat]}const qo=(d,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:d.paint.get("color-relief-opacity")}),Qi=(d,t,n,a)=>{const c=d.transform;return{u_translation:Hr(d,t,n),u_ratio:a/h.aK(t,1,c.zoom),u_device_pixel_ratio:d.pixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},Tl=(d,t,n,a,c)=>h.e(Qi(d,t,n,a),{u_image:0,u_image_height:c}),Sl=(d,t,n,a,c)=>{const f=d.transform,y=Fs(t,f);return{u_translation:Hr(d,t,n),u_texsize:t.imageAtlasTexture.size,u_ratio:a/h.aK(t,1,f.zoom),u_device_pixel_ratio:d.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]]}},Pl=(d,t,n,a,c)=>{const f=Fs(t,d.transform);return h.e(Qi(d,t,n,a),{u_tileratio:f,u_crossfade_from:c.fromScale,u_crossfade_to:c.toScale,u_image:0,u_mix:c.t,u_lineatlas_width:d.lineAtlas.width,u_lineatlas_height:d.lineAtlas.height})},Oc=(d,t,n,a,c,f)=>{const y=Fs(t,d.transform);return h.e(Qi(d,t,n,a),{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:d.lineAtlas.width,u_lineatlas_height:d.lineAtlas.height})};function Fs(d,t){return 1/h.aK(d,1,t.tileZoom)}function Hr(d,t,n){return h.aL(d.transform,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const Il=(d,t,n,a,c)=>{return{u_tl_parent:d,u_scale_parent:t,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(y=a.paint.get("raster-saturation"),y>0?1-1/(1.001-y):-y),u_contrast_factor:(f=a.paint.get("raster-contrast"),f>0?1/(1-f):1+f),u_spin_weights:th(a.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 th(d){d*=Math.PI/180;const t=Math.sin(d),n=Math.cos(d);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const Vc=(d,t,n,a,c,f,y,x,w,S,P,E,C)=>{const z=y.transform;return{u_is_size_zoom_constant:+(d==="constant"||d==="source"),u_is_size_feature_constant:+(d==="constant"||d==="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:x,u_coord_matrix:w,u_is_text:+P,u_pitch_with_map:+a,u_is_along_line:c,u_is_variable_anchor:f,u_texsize:E,u_texture:0,u_translation:S,u_pitched_scale:C}},jc=(d,t,n,a,c,f,y,x,w,S,P,E,C,z)=>{const O=y.transform;return h.e(Vc(d,t,n,a,c,f,y,x,w,S,P,E,z),{u_gamma_scale:a?Math.cos(O.pitch*Math.PI/180)*O.cameraToCenterDistance:1,u_device_pixel_ratio:y.pixelRatio,u_is_halo:C?1:0,u_is_plain:1})},ih=(d,t,n,a,c,f,y,x,w,S,P,E,C)=>h.e(jc(d,t,n,a,c,f,y,x,w,S,!0,P,!0,C),{u_texsize_icon:E,u_texture_icon:1}),Nc=(d,t)=>({u_opacity:d,u_color:t}),rh=(d,t,n,a,c)=>h.e((function(f,y,x,w){const S=x.imageManager.getPattern(f.from.toString()),P=x.imageManager.getPattern(f.to.toString()),{width:E,height:C}=x.imageManager.getPixelSize(),z=Math.pow(2,w.tileID.overscaledZ),O=w.tileSize*Math.pow(2,x.transform.tileZoom)/z,j=O*(w.tileID.canonical.x+w.tileID.wrap*z),$=O*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/h.aK(w,1,x.transform.tileZoom),u_pixel_coord_upper:[j>>16,$>>16],u_pixel_coord_lower:[65535&j,65535&$]}})(n,c,t,a),{u_opacity:d}),Ml=(d,t)=>{},Wo={fillExtrusion:(d,t)=>({u_lightpos:new h.c2(d,t.u_lightpos),u_lightpos_globe:new h.c2(d,t.u_lightpos_globe),u_lightintensity:new h.bp(d,t.u_lightintensity),u_lightcolor:new h.c2(d,t.u_lightcolor),u_vertical_gradient:new h.bp(d,t.u_vertical_gradient),u_opacity:new h.bp(d,t.u_opacity),u_fill_translate:new h.c3(d,t.u_fill_translate)}),fillExtrusionPattern:(d,t)=>({u_lightpos:new h.c2(d,t.u_lightpos),u_lightpos_globe:new h.c2(d,t.u_lightpos_globe),u_lightintensity:new h.bp(d,t.u_lightintensity),u_lightcolor:new h.c2(d,t.u_lightcolor),u_vertical_gradient:new h.bp(d,t.u_vertical_gradient),u_height_factor:new h.bp(d,t.u_height_factor),u_opacity:new h.bp(d,t.u_opacity),u_fill_translate:new h.c3(d,t.u_fill_translate),u_image:new h.b_(d,t.u_image),u_texsize:new h.c3(d,t.u_texsize),u_pixel_coord_upper:new h.c3(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.c3(d,t.u_pixel_coord_lower),u_scale:new h.c2(d,t.u_scale),u_fade:new h.bp(d,t.u_fade)}),fill:(d,t)=>({u_fill_translate:new h.c3(d,t.u_fill_translate)}),fillPattern:(d,t)=>({u_image:new h.b_(d,t.u_image),u_texsize:new h.c3(d,t.u_texsize),u_pixel_coord_upper:new h.c3(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.c3(d,t.u_pixel_coord_lower),u_scale:new h.c2(d,t.u_scale),u_fade:new h.bp(d,t.u_fade),u_fill_translate:new h.c3(d,t.u_fill_translate)}),fillOutline:(d,t)=>({u_world:new h.c3(d,t.u_world),u_fill_translate:new h.c3(d,t.u_fill_translate)}),fillOutlinePattern:(d,t)=>({u_world:new h.c3(d,t.u_world),u_image:new h.b_(d,t.u_image),u_texsize:new h.c3(d,t.u_texsize),u_pixel_coord_upper:new h.c3(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.c3(d,t.u_pixel_coord_lower),u_scale:new h.c2(d,t.u_scale),u_fade:new h.bp(d,t.u_fade),u_fill_translate:new h.c3(d,t.u_fill_translate)}),circle:(d,t)=>({u_camera_to_center_distance:new h.bp(d,t.u_camera_to_center_distance),u_scale_with_map:new h.b_(d,t.u_scale_with_map),u_pitch_with_map:new h.b_(d,t.u_pitch_with_map),u_extrude_scale:new h.c3(d,t.u_extrude_scale),u_device_pixel_ratio:new h.bp(d,t.u_device_pixel_ratio),u_globe_extrude_scale:new h.bp(d,t.u_globe_extrude_scale),u_translate:new h.c3(d,t.u_translate)}),collisionBox:(d,t)=>({u_pixel_extrude_scale:new h.c3(d,t.u_pixel_extrude_scale)}),collisionCircle:(d,t)=>({u_viewport_size:new h.c3(d,t.u_viewport_size)}),debug:(d,t)=>({u_color:new h.b$(d,t.u_color),u_overlay:new h.b_(d,t.u_overlay),u_overlay_scale:new h.bp(d,t.u_overlay_scale)}),depth:Ml,clippingMask:Ml,heatmap:(d,t)=>({u_extrude_scale:new h.bp(d,t.u_extrude_scale),u_intensity:new h.bp(d,t.u_intensity),u_globe_extrude_scale:new h.bp(d,t.u_globe_extrude_scale)}),heatmapTexture:(d,t)=>({u_matrix:new h.c0(d,t.u_matrix),u_world:new h.c3(d,t.u_world),u_image:new h.b_(d,t.u_image),u_color_ramp:new h.b_(d,t.u_color_ramp),u_opacity:new h.bp(d,t.u_opacity)}),hillshade:(d,t)=>({u_image:new h.b_(d,t.u_image),u_latrange:new h.c3(d,t.u_latrange),u_exaggeration:new h.bp(d,t.u_exaggeration),u_altitudes:new h.c9(d,t.u_altitudes),u_azimuths:new h.c9(d,t.u_azimuths),u_accent:new h.b$(d,t.u_accent),u_method:new h.b_(d,t.u_method),u_shadows:new h.c8(d,t.u_shadows),u_highlights:new h.c8(d,t.u_highlights)}),hillshadePrepare:(d,t)=>({u_matrix:new h.c0(d,t.u_matrix),u_image:new h.b_(d,t.u_image),u_dimension:new h.c3(d,t.u_dimension),u_zoom:new h.bp(d,t.u_zoom),u_unpack:new h.c1(d,t.u_unpack)}),colorRelief:(d,t)=>({u_image:new h.b_(d,t.u_image),u_unpack:new h.c1(d,t.u_unpack),u_dimension:new h.c3(d,t.u_dimension),u_elevation_stops:new h.b_(d,t.u_elevation_stops),u_color_stops:new h.b_(d,t.u_color_stops),u_color_ramp_size:new h.b_(d,t.u_color_ramp_size),u_opacity:new h.bp(d,t.u_opacity)}),line:(d,t)=>({u_translation:new h.c3(d,t.u_translation),u_ratio:new h.bp(d,t.u_ratio),u_device_pixel_ratio:new h.bp(d,t.u_device_pixel_ratio),u_units_to_pixels:new h.c3(d,t.u_units_to_pixels)}),lineGradient:(d,t)=>({u_translation:new h.c3(d,t.u_translation),u_ratio:new h.bp(d,t.u_ratio),u_device_pixel_ratio:new h.bp(d,t.u_device_pixel_ratio),u_units_to_pixels:new h.c3(d,t.u_units_to_pixels),u_image:new h.b_(d,t.u_image),u_image_height:new h.bp(d,t.u_image_height)}),linePattern:(d,t)=>({u_translation:new h.c3(d,t.u_translation),u_texsize:new h.c3(d,t.u_texsize),u_ratio:new h.bp(d,t.u_ratio),u_device_pixel_ratio:new h.bp(d,t.u_device_pixel_ratio),u_image:new h.b_(d,t.u_image),u_units_to_pixels:new h.c3(d,t.u_units_to_pixels),u_scale:new h.c2(d,t.u_scale),u_fade:new h.bp(d,t.u_fade)}),lineSDF:(d,t)=>({u_translation:new h.c3(d,t.u_translation),u_ratio:new h.bp(d,t.u_ratio),u_device_pixel_ratio:new h.bp(d,t.u_device_pixel_ratio),u_units_to_pixels:new h.c3(d,t.u_units_to_pixels),u_image:new h.b_(d,t.u_image),u_mix:new h.bp(d,t.u_mix),u_tileratio:new h.bp(d,t.u_tileratio),u_crossfade_from:new h.bp(d,t.u_crossfade_from),u_crossfade_to:new h.bp(d,t.u_crossfade_to),u_lineatlas_width:new h.bp(d,t.u_lineatlas_width),u_lineatlas_height:new h.bp(d,t.u_lineatlas_height)}),lineGradientSDF:(d,t)=>({u_translation:new h.c3(d,t.u_translation),u_ratio:new h.bp(d,t.u_ratio),u_device_pixel_ratio:new h.bp(d,t.u_device_pixel_ratio),u_units_to_pixels:new h.c3(d,t.u_units_to_pixels),u_image:new h.b_(d,t.u_image),u_image_height:new h.bp(d,t.u_image_height),u_tileratio:new h.bp(d,t.u_tileratio),u_crossfade_from:new h.bp(d,t.u_crossfade_from),u_crossfade_to:new h.bp(d,t.u_crossfade_to),u_image_dash:new h.b_(d,t.u_image_dash),u_mix:new h.bp(d,t.u_mix),u_lineatlas_width:new h.bp(d,t.u_lineatlas_width),u_lineatlas_height:new h.bp(d,t.u_lineatlas_height)}),raster:(d,t)=>({u_tl_parent:new h.c3(d,t.u_tl_parent),u_scale_parent:new h.bp(d,t.u_scale_parent),u_buffer_scale:new h.bp(d,t.u_buffer_scale),u_fade_t:new h.bp(d,t.u_fade_t),u_opacity:new h.bp(d,t.u_opacity),u_image0:new h.b_(d,t.u_image0),u_image1:new h.b_(d,t.u_image1),u_brightness_low:new h.bp(d,t.u_brightness_low),u_brightness_high:new h.bp(d,t.u_brightness_high),u_saturation_factor:new h.bp(d,t.u_saturation_factor),u_contrast_factor:new h.bp(d,t.u_contrast_factor),u_spin_weights:new h.c2(d,t.u_spin_weights),u_coords_top:new h.c1(d,t.u_coords_top),u_coords_bottom:new h.c1(d,t.u_coords_bottom)}),symbolIcon:(d,t)=>({u_is_size_zoom_constant:new h.b_(d,t.u_is_size_zoom_constant),u_is_size_feature_constant:new h.b_(d,t.u_is_size_feature_constant),u_size_t:new h.bp(d,t.u_size_t),u_size:new h.bp(d,t.u_size),u_camera_to_center_distance:new h.bp(d,t.u_camera_to_center_distance),u_pitch:new h.bp(d,t.u_pitch),u_rotate_symbol:new h.b_(d,t.u_rotate_symbol),u_aspect_ratio:new h.bp(d,t.u_aspect_ratio),u_fade_change:new h.bp(d,t.u_fade_change),u_label_plane_matrix:new h.c0(d,t.u_label_plane_matrix),u_coord_matrix:new h.c0(d,t.u_coord_matrix),u_is_text:new h.b_(d,t.u_is_text),u_pitch_with_map:new h.b_(d,t.u_pitch_with_map),u_is_along_line:new h.b_(d,t.u_is_along_line),u_is_variable_anchor:new h.b_(d,t.u_is_variable_anchor),u_texsize:new h.c3(d,t.u_texsize),u_texture:new h.b_(d,t.u_texture),u_translation:new h.c3(d,t.u_translation),u_pitched_scale:new h.bp(d,t.u_pitched_scale)}),symbolSDF:(d,t)=>({u_is_size_zoom_constant:new h.b_(d,t.u_is_size_zoom_constant),u_is_size_feature_constant:new h.b_(d,t.u_is_size_feature_constant),u_size_t:new h.bp(d,t.u_size_t),u_size:new h.bp(d,t.u_size),u_camera_to_center_distance:new h.bp(d,t.u_camera_to_center_distance),u_pitch:new h.bp(d,t.u_pitch),u_rotate_symbol:new h.b_(d,t.u_rotate_symbol),u_aspect_ratio:new h.bp(d,t.u_aspect_ratio),u_fade_change:new h.bp(d,t.u_fade_change),u_label_plane_matrix:new h.c0(d,t.u_label_plane_matrix),u_coord_matrix:new h.c0(d,t.u_coord_matrix),u_is_text:new h.b_(d,t.u_is_text),u_pitch_with_map:new h.b_(d,t.u_pitch_with_map),u_is_along_line:new h.b_(d,t.u_is_along_line),u_is_variable_anchor:new h.b_(d,t.u_is_variable_anchor),u_texsize:new h.c3(d,t.u_texsize),u_texture:new h.b_(d,t.u_texture),u_gamma_scale:new h.bp(d,t.u_gamma_scale),u_device_pixel_ratio:new h.bp(d,t.u_device_pixel_ratio),u_is_halo:new h.b_(d,t.u_is_halo),u_is_plain:new h.b_(d,t.u_is_plain),u_translation:new h.c3(d,t.u_translation),u_pitched_scale:new h.bp(d,t.u_pitched_scale)}),symbolTextAndIcon:(d,t)=>({u_is_size_zoom_constant:new h.b_(d,t.u_is_size_zoom_constant),u_is_size_feature_constant:new h.b_(d,t.u_is_size_feature_constant),u_size_t:new h.bp(d,t.u_size_t),u_size:new h.bp(d,t.u_size),u_camera_to_center_distance:new h.bp(d,t.u_camera_to_center_distance),u_pitch:new h.bp(d,t.u_pitch),u_rotate_symbol:new h.b_(d,t.u_rotate_symbol),u_aspect_ratio:new h.bp(d,t.u_aspect_ratio),u_fade_change:new h.bp(d,t.u_fade_change),u_label_plane_matrix:new h.c0(d,t.u_label_plane_matrix),u_coord_matrix:new h.c0(d,t.u_coord_matrix),u_is_text:new h.b_(d,t.u_is_text),u_pitch_with_map:new h.b_(d,t.u_pitch_with_map),u_is_along_line:new h.b_(d,t.u_is_along_line),u_is_variable_anchor:new h.b_(d,t.u_is_variable_anchor),u_texsize:new h.c3(d,t.u_texsize),u_texsize_icon:new h.c3(d,t.u_texsize_icon),u_texture:new h.b_(d,t.u_texture),u_texture_icon:new h.b_(d,t.u_texture_icon),u_gamma_scale:new h.bp(d,t.u_gamma_scale),u_device_pixel_ratio:new h.bp(d,t.u_device_pixel_ratio),u_is_halo:new h.b_(d,t.u_is_halo),u_translation:new h.c3(d,t.u_translation),u_pitched_scale:new h.bp(d,t.u_pitched_scale)}),background:(d,t)=>({u_opacity:new h.bp(d,t.u_opacity),u_color:new h.b$(d,t.u_color)}),backgroundPattern:(d,t)=>({u_opacity:new h.bp(d,t.u_opacity),u_image:new h.b_(d,t.u_image),u_pattern_tl_a:new h.c3(d,t.u_pattern_tl_a),u_pattern_br_a:new h.c3(d,t.u_pattern_br_a),u_pattern_tl_b:new h.c3(d,t.u_pattern_tl_b),u_pattern_br_b:new h.c3(d,t.u_pattern_br_b),u_texsize:new h.c3(d,t.u_texsize),u_mix:new h.bp(d,t.u_mix),u_pattern_size_a:new h.c3(d,t.u_pattern_size_a),u_pattern_size_b:new h.c3(d,t.u_pattern_size_b),u_scale_a:new h.bp(d,t.u_scale_a),u_scale_b:new h.bp(d,t.u_scale_b),u_pixel_coord_upper:new h.c3(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.c3(d,t.u_pixel_coord_lower),u_tile_units_to_pixels:new h.bp(d,t.u_tile_units_to_pixels)}),terrain:(d,t)=>({u_texture:new h.b_(d,t.u_texture),u_ele_delta:new h.bp(d,t.u_ele_delta),u_fog_matrix:new h.c0(d,t.u_fog_matrix),u_fog_color:new h.b$(d,t.u_fog_color),u_fog_ground_blend:new h.bp(d,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new h.bp(d,t.u_fog_ground_blend_opacity),u_horizon_color:new h.b$(d,t.u_horizon_color),u_horizon_fog_blend:new h.bp(d,t.u_horizon_fog_blend),u_is_globe_mode:new h.bp(d,t.u_is_globe_mode)}),terrainDepth:(d,t)=>({u_ele_delta:new h.bp(d,t.u_ele_delta)}),terrainCoords:(d,t)=>({u_texture:new h.b_(d,t.u_texture),u_terrain_coords_id:new h.bp(d,t.u_terrain_coords_id),u_ele_delta:new h.bp(d,t.u_ele_delta)}),projectionErrorMeasurement:(d,t)=>({u_input:new h.bp(d,t.u_input),u_output_expected:new h.bp(d,t.u_output_expected)}),atmosphere:(d,t)=>({u_sun_pos:new h.c2(d,t.u_sun_pos),u_atmosphere_blend:new h.bp(d,t.u_atmosphere_blend),u_globe_position:new h.c2(d,t.u_globe_position),u_globe_radius:new h.bp(d,t.u_globe_radius),u_inv_proj_matrix:new h.c0(d,t.u_inv_proj_matrix)}),sky:(d,t)=>({u_sky_color:new h.b$(d,t.u_sky_color),u_horizon_color:new h.b$(d,t.u_horizon_color),u_horizon:new h.c3(d,t.u_horizon),u_horizon_normal:new h.c3(d,t.u_horizon_normal),u_sky_horizon_blend:new h.bp(d,t.u_sky_horizon_blend),u_sky_blend:new h.bp(d,t.u_sky_blend)})};class Ho{constructor(t,n,a){this.context=t;const c=t.gl;this.buffer=c.createBuffer(),this.dynamicDraw=!!a,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 Xo={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class El{constructor(t,n,a,c){this.length=n.length,this.attributes=a,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(const a of this.attributes){const c=n.attributes[a.name];c!==void 0&&t.enableVertexAttribArray(c)}}setVertexAttribPointers(t,n,a){for(const c of this.attributes){const f=n.attributes[c.name];f!==void 0&&t.vertexAttribPointer(f,c.components,t[Xo[c.type]],!1,this.itemSize,c.offset+this.itemSize*(a||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class nt{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 Bs extends nt{getDefault(){return h.bo.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 Kn extends nt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class er extends nt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Uc extends nt{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 Gc extends nt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Cl extends nt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class mn extends nt{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 Yo extends nt{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 Ko extends nt{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 Os extends nt{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 Jo extends nt{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 $c extends nt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Jn extends nt{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 Qn extends nt{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 Zc extends nt{getDefault(){return h.bo.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 Al extends nt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Xe extends nt{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 Qo extends nt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class nh extends nt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class qc extends nt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Vs extends nt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class sh extends nt{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 oh extends nt{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 Wc extends nt{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 ah extends nt{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 Dl extends nt{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 ea extends nt{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class js extends nt{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const a=this.gl;vr(a)?a.bindVertexArray(t):(n=a.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class ta extends nt{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 zl extends nt{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 Hc extends nt{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 es extends nt{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class ia extends es{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 Ns extends es{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 ts extends es{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 ra="Framebuffer is not complete";class lh{constructor(t,n,a,c,f){this.context=t,this.width=n,this.height=a;const y=t.gl,x=this.framebuffer=y.createFramebuffer();if(this.colorAttachment=new ia(t,x),c)this.depthAttachment=f?new ts(t,x):new Ns(t,x);else if(f)throw new Error("Stencil cannot be set without depth");if(y.checkFramebufferStatus(y.FRAMEBUFFER)!==y.FRAMEBUFFER_COMPLETE)throw new Error(ra)}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const a=this.depthAttachment.get();a&&t.deleteRenderbuffer(a)}t.deleteFramebuffer(this.framebuffer)}}class Us{constructor(t){var n,a;if(this.gl=t,this.clearColor=new Bs(this),this.clearDepth=new Kn(this),this.clearStencil=new er(this),this.colorMask=new Uc(this),this.depthMask=new Gc(this),this.stencilMask=new Cl(this),this.stencilFunc=new mn(this),this.stencilOp=new Yo(this),this.stencilTest=new Ko(this),this.depthRange=new Os(this),this.depthTest=new Jo(this),this.depthFunc=new $c(this),this.blend=new Jn(this),this.blendFunc=new Qn(this),this.blendColor=new Zc(this),this.blendEquation=new Al(this),this.cullFace=new Xe(this),this.cullFaceSide=new Qo(this),this.frontFace=new nh(this),this.program=new qc(this),this.activeTexture=new Vs(this),this.viewport=new sh(this),this.bindFramebuffer=new oh(this),this.bindRenderbuffer=new Wc(this),this.bindTexture=new ah(this),this.bindVertexBuffer=new Dl(this),this.bindElementBuffer=new ea(this),this.bindVertexArray=new js(this),this.pixelStoreUnpack=new ta(this),this.pixelStoreUnpackPremultiplyAlpha=new zl(this),this.pixelStoreUnpackFlipY=new Hc(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),vr(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=(a=t.RGB16F)!==null&&a!==void 0?a: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 Ho(this,t,n)}createVertexBuffer(t,n,a){return new El(this,t,n,a)}createRenderbuffer(t,n,a){const c=this.gl,f=c.createRenderbuffer();return this.bindRenderbuffer.set(f),c.renderbufferStorage(c.RENDERBUFFER,t,n,a),this.bindRenderbuffer.set(null),f}createFramebuffer(t,n,a,c){return new lh(this,t,n,a,c)}clear({color:t,depth:n,stencil:a}){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)),a!==void 0&&(f|=c.STENCIL_BUFFER_BIT,this.clearStencil.set(a),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){h.bQ(t.blendFunction,yt.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 vr(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;vr(this.gl)?this.gl.deleteVertexArray(t):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0||n.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}let na;function kl(d,t,n,a,c){var f,y;const x=d.context,w=d.transform,S=x.gl,P=d.useProgram("collisionBox"),E=[];let C=0,z=0;for(const Y of a){const Z=t.getTile(Y).getBucket(n);if(!Z)continue;const G=c?Z.textCollisionBox:Z.iconCollisionBox,X=Z.collisionCircleArray;X.length>0&&(E.push({circleArray:X,circleOffset:z,coord:Y}),C+=X.length/4,z=C),G&&P.draw(x,S.LINES,Ue.disabled,ot.disabled,d.colorModeForRenderPass(),rt.disabled,Zo(d.transform),(f=d.style.map.terrain)===null||f===void 0?void 0:f.getTerrainData(Y),w.getProjectionData({overscaledTileID:Y,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),n.id,G.layoutVertexBuffer,G.indexBuffer,G.segments,null,d.transform.zoom,null,null,G.collisionVertexBuffer)}if(!c||!E.length)return;const O=d.useProgram("collisionCircle"),j=new h.ca;j.resize(4*C),j._trim();let $=0;for(const Y of E)for(let Z=0;Z<Y.circleArray.length/4;Z++){const G=4*Z,X=Y.circleArray[G+0],W=Y.circleArray[G+1],ee=Y.circleArray[G+2],ue=Y.circleArray[G+3];j.emplace($++,X,W,ee,ue,0),j.emplace($++,X,W,ee,ue,1),j.emplace($++,X,W,ee,ue,2),j.emplace($++,X,W,ee,ue,3)}(!na||na.length<2*C)&&(na=(function(Y){const Z=2*Y,G=new h.cc;G.resize(Z),G._trim();for(let X=0;X<Z;X++){const W=6*X;G.uint16[W+0]=4*X+0,G.uint16[W+1]=4*X+1,G.uint16[W+2]=4*X+2,G.uint16[W+3]=4*X+2,G.uint16[W+4]=4*X+3,G.uint16[W+5]=4*X+0}return G})(C));const U=x.createIndexBuffer(na,!0),q=x.createVertexBuffer(j,h.cb.members,!0);for(const Y of E){const Z=eh(d.transform);O.draw(x,S.TRIANGLES,Ue.disabled,ot.disabled,d.colorModeForRenderPass(),rt.disabled,Z,(y=d.style.map.terrain)===null||y===void 0?void 0:y.getTerrainData(Y.coord),null,n.id,q,U,h.aV.simpleSegment(0,2*Y.circleOffset,Y.circleArray.length,Y.circleArray.length/2),null,d.transform.zoom,null,null,null)}q.destroy(),U.destroy()}const sa=h.ap(new Float32Array(16));function Rl(d,t,n,a,c,f){const{horizontalAlign:y,verticalAlign:x}=h.aP(d);return new h.P((-(y-.5)*t/c+a[0])*f,(-(x-.5)*n/c+a[1])*f)}function Xc(d,t,n,a,c,f){const y=t.tileAnchorPoint.add(new h.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let x=a.mult(f);n||(x=x.rotate(-c));const w=y.add(x);return hn(w.x,w.y,t.pitchedLabelPlaneMatrix,t.getElevation).point}if(n){const x=Nr(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(d),w=Math.atan(x.y/x.x)+(x.x<0?Math.PI:0);return d.add(a.rotate(w))}return d.add(a)}function Yc(d,t,n,a,c,f,y,x,w,S,P,E){const C=d.text.placedSymbolArray,z=d.text.dynamicLayoutVertexArray,O=d.icon.dynamicLayoutVertexArray,j={};z.clear();for(let $=0;$<C.length;$++){const U=C.get($),q=U.hidden||!U.crossTileID||d.allowVerticalPlacement&&!U.placedOrientation?null:a[U.crossTileID];if(q){const Y=new h.P(U.anchorX,U.anchorY),Z={getElevation:E,width:c.width,height:c.height,pitchedLabelPlaneMatrix:f,pitchWithMap:n,transform:c,tileAnchorPoint:Y,translation:S,unwrappedTileID:P},G=n?sl(Y.x,Y.y,Z):Nr(Y.x,Y.y,Z),X=Ms(c.cameraToCenterDistance,G.signedDistanceFromCamera);let W=h.ay(d.textSizeData,x,U)*X/h.aJ;n&&(W*=d.tilePixelRatio/y);const{width:ee,height:ue,anchor:oe,textOffset:_e,textBoxScale:ye}=q,ze=Rl(oe,ee,ue,_e,ye,W),Ie=c.getPitchedTextCorrection(Y.x+S[0],Y.y+S[1],P),me=Xc(G.point,Z,t,ze,-c.bearingInRadians,Ie),ke=d.allowVerticalPlacement&&U.placedOrientation===h.ax.vertical?Math.PI/2:0;for(let Re=0;Re<U.numGlyphs;Re++)h.aD(z,me,ke);w&&U.associatedIconIndex>=0&&(j[U.associatedIconIndex]={shiftedAnchor:me,angle:ke})}else Vn(U.numGlyphs,z)}if(w){O.clear();const $=d.icon.placedSymbolArray;for(let U=0;U<$.length;U++){const q=$.get(U);if(q.hidden)Vn(q.numGlyphs,O);else{const Y=j[U];if(Y)for(let Z=0;Z<q.numGlyphs;Z++)h.aD(O,Y.shiftedAnchor,Y.angle);else Vn(q.numGlyphs,O)}}d.icon.dynamicLayoutVertexBuffer.updateData(O)}d.text.dynamicLayoutVertexBuffer.updateData(z)}function oa(d,t,n){return n.iconsInText&&t?"symbolTextAndIcon":d?"symbolSDF":"symbolIcon"}function aa(d,t,n,a,c,f,y,x,w,S,P,E,C){var z,O;const j=d.context,$=j.gl,U=d.transform,q=x==="map",Y=w==="map",Z=x!=="viewport"&&n.layout.get("symbol-placement")!=="point",G=q&&!Y&&!Z,X=!n.layout.get("symbol-sort-key").isConstant();let W=!1;const ee=d.getDepthModeForSublayer(0,Ue.ReadOnly),ue=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),oe=[],_e=U.getCircleRadiusCorrection();for(const Ie of a){const me=t.getTile(Ie),ke=me.getBucket(n);if(!ke)continue;const Re=c?ke.text:ke.icon;if(!Re?.segments.get().length||!Re.hasVisibleVertices)continue;const ut=Re.programConfigurations.get(n.id),Dt=c||ke.sdfIcons,_t=c?ke.textSizeData:ke.iconSizeData,Ft=Y||U.pitch!==0,Bt=d.useProgram(oa(Dt,c,ke),ut),Zi=h.aw(_t,U.zoom),Mt=(z=d.style.map.terrain)===null||z===void 0?void 0:z.getTerrainData(Ie);let li,wt,Ht,Li,Kr=[0,0],ls=null;if(c)wt=me.glyphAtlasTexture,Ht=$.LINEAR,li=me.glyphAtlasTexture.size,ke.iconsInText&&(Kr=me.imageAtlasTexture.size,ls=me.imageAtlasTexture,Li=Ft||d.options.rotating||d.options.zooming||_t.kind==="composite"||_t.kind==="camera"?$.LINEAR:$.NEAREST);else{const Tt=n.layout.get("icon-size").constantOr(0)!==1||ke.iconsNeedLinear;wt=me.imageAtlasTexture,Ht=Dt||d.options.rotating||d.options.zooming||Tt||Ft?$.LINEAR:$.NEAREST,li=me.imageAtlasTexture.size}const xn=h.aK(me,1,d.transform.zoom),ir=Fn(q,d.transform,xn),rr=Is(Y,q,d.transform,xn),Mi=h.aL(U,me,f,y),qi=U.getProjectionData({overscaledTileID:Ie,applyGlobeMatrix:!C,applyTerrainMatrix:!0}),ci=ue&&ke.hasTextData(),Dr=n.layout.get("icon-text-fit")!=="none"&&ci&&ke.hasIconData();if(Z){const Tt=h.O();Mo(Tt,ir);const wn=d.style.map.terrain?(kr,Sa)=>d.style.map.terrain.getElevation(Ie,kr,Sa):null,zr=n.layout.get("text-rotation-alignment")==="map";It(ke,d,c,ir,Tt,Y,S,zr,Ie.toUnwrapped(),U.width,U.height,Mi,wn)}const xr=c&&ue||Dr,bn=Z||xr?sa:Y?ir:d.transform.clipSpaceToPixelsMatrix,Ot=Dt&&n.paint.get(c?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let gi;gi=Dt?ke.iconsInText?ih(_t.kind,Zi,G,Y,Z,xr,d,bn,rr,Mi,li,Kr,_e):jc(_t.kind,Zi,G,Y,Z,xr,d,bn,rr,Mi,c,li,Ot,_e):Vc(_t.kind,Zi,G,Y,Z,xr,d,bn,rr,Mi,c,li,_e);const Fi={program:Bt,buffers:Re,uniformValues:gi,projectionData:qi,atlasTexture:wt,atlasTextureIcon:ls,atlasInterpolation:Ht,atlasInterpolationIcon:Li,isSDF:Dt,hasHalo:Ot};if(X&&ke.canOverlap){W=!0;const Tt=Re.segments.get();for(const wn of Tt)oe.push({segments:new h.aV([wn]),sortKey:wn.sortKey,state:Fi,terrainData:Mt})}else oe.push({segments:Re.segments,sortKey:0,state:Fi,terrainData:Mt})}W&&oe.sort(((Ie,me)=>Ie.sortKey-me.sortKey));const ye=(O=n.paint.get(c?"text-halo-width":"icon-halo-width").constantOr(null))!==null&&O!==void 0?O:1/0,ze=n.layout.get("text-letter-spacing").constantOr(0)*h.aJ<0||ye>1;for(const Ie of oe){const me=Ie.state;j.activeTexture.set($.TEXTURE0),me.atlasTexture.bind(me.atlasInterpolation,$.CLAMP_TO_EDGE),me.atlasTextureIcon&&(j.activeTexture.set($.TEXTURE1),me.atlasTextureIcon&&me.atlasTextureIcon.bind(me.atlasInterpolationIcon,$.CLAMP_TO_EDGE));const ke=me.isSDF&&me.hasHalo;if(ke){const Re=me.uniformValues;Re.u_is_halo=1,ze&&(Re.u_is_plain=0,Kc(me.buffers,Ie.segments,n,d,me.program,ee,P,E,Re,me.projectionData,Ie.terrainData),Re.u_is_halo=0,Re.u_is_plain=1)}Kc(me.buffers,Ie.segments,n,d,me.program,ee,P,E,me.uniformValues,me.projectionData,Ie.terrainData),ke&&!ze&&(me.uniformValues.u_is_halo=0)}}function Kc(d,t,n,a,c,f,y,x,w,S,P){const E=a.context;c.draw(E,E.gl.TRIANGLES,f,y,x,rt.backCCW,w,P,S,n.id,d.layoutVertexBuffer,d.indexBuffer,t,n.paint,a.transform.zoom,d.programConfigurations.get(n.id),d.dynamicLayoutVertexBuffer,d.opacityVertexBuffer)}function Jc(d,t,n,a,c){const f=d.context,y=f.gl,x=ot.disabled,w=new yt([y.ONE,y.ONE],h.bo.transparent,[!0,!0,!0,!0]),S=t.getBucket(n);if(!S)return;const P=a.key;let E=n.heatmapFbos.get(P);E||(E=Xr(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:h.bo.transparent});const C=S.programConfigurations.get(n.id),z=d.useProgram("heatmap",C,!c),O=d.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),j=d.style.map.terrain.getTerrainData(a);z.draw(f,y.TRIANGLES,Ue.disabled,x,w,rt.disabled,xl(t,d.transform.zoom,n.paint.get("heatmap-intensity"),1),j,O,n.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,n.paint,d.transform.zoom,C)}function Lt(d,t,n,a,c){const f=d.context,y=f.gl,x=d.transform;f.setColorMode(d.colorModeForRenderPass());const w=ki(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=x.getProjectionData({overscaledTileID:n,applyTerrainMatrix:c,applyGlobeMatrix:!a});d.useProgram("heatmapTexture").draw(f,y.TRIANGLES,Ue.disabled,ot.disabled,d.colorModeForRenderPass(),rt.disabled,bl(d,t,0,1),null,E,t.id,d.rasterBoundsBuffer,d.quadTriangleIndexBuffer,d.rasterBoundsSegments,t.paint,x.zoom),P.destroy(),t.heatmapFbos.delete(S)}function Xr(d,t,n){var a,c;const f=d.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 x=(a=d.HALF_FLOAT)!==null&&a!==void 0?a:f.UNSIGNED_BYTE,w=(c=d.RGBA16F)!==null&&c!==void 0?c:f.RGBA;f.texImage2D(f.TEXTURE_2D,0,w,t,n,0,f.RGBA,x,null);const S=d.createFramebuffer(t,n,!1,!1);return S.colorAttachment.set(y),S}function ki(d,t){return t.colorRampTexture||(t.colorRampTexture=new h.T(d,t.colorRamp,d.gl.RGBA)),t.colorRampTexture}function la(d,t,n,a,c,f,y,x){let w=256;if(c.stepInterpolant){const S=t.getSource().maxzoom,P=y.canonical.z===S?Math.ceil(1<<d.transform.maxZoom-y.canonical.z):1;w=h.al(h.ce(f.maxLineLength/h.a6*1024*P),256,n.maxTextureSize)}return x.gradient=h.cf({expression:c.gradientExpression(),evaluationKey:"lineProgress",resolution:w,image:x.gradient||void 0,clips:f.lineClipsArray}),x.texture?x.texture.update(x.gradient):x.texture=new h.T(n,x.gradient,a.RGBA),x.version=c.gradientVersion,x.texture}function ca(d,t,n,a,c){d.activeTexture.set(t.TEXTURE0),n.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),a.updatePaintBuffers(c)}function Qc(d,t,n,a,c,f){(c||d.lineAtlas.dirty)&&(t.activeTexture.set(n.TEXTURE0),d.lineAtlas.bind(t)),a.updatePaintBuffers(f)}function is(d,t,n,a,c,f,y){const x=f.gradients[c.id];let w=x.texture;c.gradientVersion!==x.version&&(w=la(d,t,n,a,c,f,y,x)),n.activeTexture.set(a.TEXTURE0),w.bind(c.stepInterpolant?a.NEAREST:a.LINEAR,a.CLAMP_TO_EDGE)}function Ll(d,t,n,a,c,f,y,x,w){const S=f.gradients[c.id];let P=S.texture;c.gradientVersion!==S.version&&(P=la(d,t,n,a,c,f,y,S)),n.activeTexture.set(a.TEXTURE0),P.bind(c.stepInterpolant?a.NEAREST:a.LINEAR,a.CLAMP_TO_EDGE),n.activeTexture.set(a.TEXTURE1),d.lineAtlas.bind(n),x.updatePaintBuffers(w)}function rs(d,t,n,a,c){if(!n||!a?.imageAtlas)return;const f=a.imageAtlas.patternPositions;let y=f[n.to.toString()],x=f[n.from.toString()];if(!y&&x&&(y=x),!x&&y&&(x=y),!y||!x){const w=c.getPaintProperty(t);y=f[w],x=f[w]}y&&x&&d.setConstantPatternPositions(y,x)}function ua(d,t,n,a,c,f,y,x){var w;const S=d.context.gl,P="fill-pattern",E=n.paint.get(P),C=E?.constantOr(1),z=n.getCrossfadeParameters();let O,j,$,U,q;const Y=d.transform,Z=n.paint.get("fill-translate"),G=n.paint.get("fill-translate-anchor");y?(j=C&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",O=S.LINES):(j=C?"fillPattern":"fill",O=S.TRIANGLES);const X=E.constantOr(null);for(const W of a){const ee=t.getTile(W);if(C&&!ee.patternsLoaded())continue;const ue=ee.getBucket(n);if(!ue)continue;const oe=ue.programConfigurations.get(n.id),_e=d.useProgram(j,oe),ye=(w=d.style.map.terrain)===null||w===void 0?void 0:w.getTerrainData(W);C&&(d.context.activeTexture.set(S.TEXTURE0),ee.imageAtlasTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE),oe.updatePaintBuffers(z)),rs(oe,P,X,ee,n);const ze=Y.getProjectionData({overscaledTileID:W,applyGlobeMatrix:!x,applyTerrainMatrix:!0}),Ie=h.aL(Y,ee,Z,G);if(y){U=ue.indexBuffer2,q=ue.segments2;const ke=[S.drawingBufferWidth,S.drawingBufferHeight];$=j==="fillOutlinePattern"&&C?Ls(d,z,ee,ke,Ie):Rc(ke,Ie)}else U=ue.indexBuffer,q=ue.segments,$=C?vl(d,z,ee,Ie):{u_fill_translate:Ie};const me=d.stencilModeForClipping(W);_e.draw(d.context,O,c,me,f,rt.backCCW,$,ye,ze,n.id,ue.layoutVertexBuffer,U,q,n.paint,d.transform.zoom,oe)}}function ha(d,t,n,a,c,f,y,x){var w;const S=d.context,P=S.gl,E="fill-extrusion-pattern",C=n.paint.get(E),z=C.constantOr(1),O=n.getCrossfadeParameters(),j=n.paint.get("fill-extrusion-opacity"),$=C.constantOr(null),U=d.transform;for(const q of a){const Y=t.getTile(q),Z=Y.getBucket(n);if(!Z)continue;const G=(w=d.style.map.terrain)===null||w===void 0?void 0:w.getTerrainData(q),X=Z.programConfigurations.get(n.id),W=d.useProgram(z?"fillExtrusionPattern":"fillExtrusion",X);z&&(d.context.activeTexture.set(P.TEXTURE0),Y.imageAtlasTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),X.updatePaintBuffers(O));const ee=U.getProjectionData({overscaledTileID:q,applyGlobeMatrix:!x,applyTerrainMatrix:!0});rs(X,E,$,Y,n);const ue=h.aL(U,Y,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),oe=n.paint.get("fill-extrusion-vertical-gradient"),_e=z?fn(d,oe,j,ue,q,O,Y):yl(d,oe,j,ue);W.draw(S,S.gl.TRIANGLES,c,f,y,rt.backCCW,_e,G,ee,n.id,Z.layoutVertexBuffer,Z.indexBuffer,Z.segments,n.paint,d.transform.zoom,X,d.style.map.terrain&&Z.centroidVertexBuffer)}}function da(d,t,n,a,c,f,y,x,w){var S;const P=d.style.projection,E=d.context,C=d.transform,z=E.gl,O=[`#define NUM_ILLUMINATION_SOURCES ${n.paint.get("hillshade-highlight-color").values.length}`],j=d.useProgram("hillshade",null,!1,O),$=!d.options.moving;for(const U of a){const q=t.getTile(U),Y=q.fbo;if(!Y)continue;const Z=P.getMeshFromTileID(E,U.canonical,x,!0,"raster"),G=(S=d.style.map.terrain)===null||S===void 0?void 0:S.getTerrainData(U);E.activeTexture.set(z.TEXTURE0),z.bindTexture(z.TEXTURE_2D,Y.colorAttachment.get());const X=C.getProjectionData({overscaledTileID:U,aligned:$,applyGlobeMatrix:!w,applyTerrainMatrix:!0});j.draw(E,z.TRIANGLES,f,c[U.overscaledZ],y,rt.backCCW,Fc(d,q,n),G,X,n.id,Z.vertexBuffer,Z.indexBuffer,Z.segments)}}let pa=0;function fa(d,t,n,a,c,f,y,x,w){var S;const P=d.style.projection,E=d.context,C=d.transform,z=E.gl,O=d.useProgram("colorRelief"),j=!d.options.moving,$=n.paint.get("resampling")==="nearest"?z.NEAREST:z.LINEAR;let U=!0,q=0;for(const Y of a){const Z=t.getTile(Y),G=Z.dem;if(U){pa||(pa=z.getParameter(z.MAX_TEXTURE_SIZE));const _e=pa,{elevationTexture:ye,colorTexture:ze}=n.getColorRampTextures(E,_e,G.getUnpackVector());E.activeTexture.set(z.TEXTURE1),ye.bind(z.NEAREST,z.CLAMP_TO_EDGE),E.activeTexture.set(z.TEXTURE4),ze.bind(z.LINEAR,z.CLAMP_TO_EDGE),U=!1,q=ye.size[0]}if(!G?.data)continue;const X=G.stride,W=G.getPixels();if(E.activeTexture.set(z.TEXTURE0),E.pixelStoreUnpackPremultiplyAlpha.set(!1),Z.demTexture||(Z.demTexture=d.getTileTexture(X)),Z.demTexture){const _e=Z.demTexture;_e.update(W,{premultiply:!1}),_e.bind($,z.CLAMP_TO_EDGE)}else Z.demTexture=new h.T(E,W,z.RGBA,{premultiply:!1}),Z.demTexture.bind($,z.CLAMP_TO_EDGE);const ee=P.getMeshFromTileID(E,Y.canonical,x,!0,"raster"),ue=(S=d.style.map.terrain)===null||S===void 0?void 0:S.getTerrainData(Y),oe=C.getProjectionData({overscaledTileID:Y,aligned:j,applyGlobeMatrix:!w,applyTerrainMatrix:!0});O.draw(E,z.TRIANGLES,f,c[Y.overscaledZ],y,rt.backCCW,qo(n,Z.dem,q),ue,oe,n.id,ee.vertexBuffer,ee.indexBuffer,ee.segments)}}const ma=[new h.P(0,0),new h.P(h.a6,0),new h.P(h.a6,h.a6),new h.P(0,h.a6)];function ur(d,t,n,a,c,f,y,x,w=!1,S=!1){var P;const E=a[a.length-1].overscaledZ,C=d.context,z=C.gl,O=d.useProgram("raster"),j=d.transform,$=d.style.projection,U=d.colorModeForRenderPass(),q=!d.options.moving,Y=n.paint.get("raster-opacity"),Z=n.paint.get("resampling")==="nearest"||n.paint.get("raster-resampling")==="nearest"?z.NEAREST:z.LINEAR,G=n.paint.get("raster-fade-duration"),X=!!d.style.map.terrain;for(const W of a){const ee=d.getDepthModeForSublayer(W.overscaledZ-E,Y===1?Ue.ReadWrite:Ue.ReadOnly,z.LESS),ue=t.getTile(W);C.activeTexture.set(z.TEXTURE0),ue.texture.bind(Z,z.CLAMP_TO_EDGE,z.LINEAR_MIPMAP_NEAREST),C.activeTexture.set(z.TEXTURE1);const{parentTile:oe,parentScaleBy:_e,parentTopLeft:ye,fadeValues:ze}=eu(ue,t,G,X);ue.fadeOpacity=ze.tileOpacity,oe?(oe.fadeOpacity=ze.parentTileOpacity,oe.texture.bind(Z,z.CLAMP_TO_EDGE,z.LINEAR_MIPMAP_NEAREST)):ue.texture.bind(Z,z.CLAMP_TO_EDGE,z.LINEAR_MIPMAP_NEAREST),ue.texture.useMipmap&&C.extTextureFilterAnisotropic&&d.transform.pitch>d.options.anisotropicFilterPitch&&z.texParameterf(z.TEXTURE_2D,C.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,C.extTextureFilterAnisotropicMax);const Ie=(P=d.style.map.terrain)===null||P===void 0?void 0:P.getTerrainData(W),me=j.getProjectionData({overscaledTileID:W,aligned:q,applyGlobeMatrix:!S,applyTerrainMatrix:!0}),ke=Il(ye,_e,ze.fadeMix,n,x),Re=$.getMeshFromTileID(C,W.canonical,f,y,"raster");O.draw(C,z.TRIANGLES,ee,c?c[W.overscaledZ]:ot.disabled,U,w?rt.frontCCW:rt.backCCW,ke,Ie,me,n.id,Re.vertexBuffer,Re.indexBuffer,Re.segments)}}function eu(d,t,n,a){const c={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(n===0||a)return c;if(d.fadingParentID){const f=t.getLoadedTile(d.fadingParentID);if(!f)return c;const y=Math.pow(2,f.tileID.overscaledZ-d.tileID.overscaledZ),x=[d.tileID.canonical.x*y%1,d.tileID.canonical.y*y%1],w=(function(S,P,E){const C=je(),z=(C-P.timeAdded)/E,O=S.fadingDirection===Ki.Incoming,j=h.al((C-S.timeAdded)/E,0,1),$=h.al(1-z,0,1),U=O?j:$;return{tileOpacity:U,parentTileOpacity:O?$:j,fadeMix:{opacity:1,mix:1-U}}})(d,f,n);return{parentTile:f,parentScaleBy:y,parentTopLeft:x,fadeValues:w}}if(d.selfFading){const f=(function(y,x){const w=(je()-y.timeAdded)/x,S=h.al(w,0,1);return{tileOpacity:S,fadeMix:{opacity:S,mix:0}}})(d,n);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:f}}return c}const tu=new h.bo(1,0,0,1),iu=new h.bo(0,1,0,1),ru=new h.bo(0,0,1,1),nu=new h.bo(1,0,1,1),su=new h.bo(0,1,1,1);function Fl(d,t,n,a){Gs(d,0,t+n/2,d.transform.width,n,a)}function Bl(d,t,n,a){Gs(d,t-n/2,0,n,d.transform.height,a)}function Gs(d,t,n,a,c,f){const y=d.context,x=y.gl;x.enable(x.SCISSOR_TEST),x.scissor(t*d.pixelRatio,n*d.pixelRatio,a*d.pixelRatio,c*d.pixelRatio),y.clear({color:f}),x.disable(x.SCISSOR_TEST)}function ga(d,t,n){var a;const c=d.context,f=c.gl,y=d.useProgram("debug"),x=Ue.disabled,w=ot.disabled,S=d.colorModeForRenderPass(),P="$debug",E=(a=d.style.map.terrain)===null||a===void 0?void 0:a.getTerrainData(n);c.activeTexture.set(f.TEXTURE0);const C=t.getTileByID(n.key).latestRawTileData,z=Math.floor((C?.byteLength||0)/1024),O=t.getTile(n).tileSize,j=512/Math.min(O,512)*(n.overscaledZ/d.transform.zoom)*.5;let $=n.canonical.toString();n.overscaledZ!==n.canonical.z&&($+=` => ${n.overscaledZ}`),(function(q,Y){q.initDebugOverlayCanvas();const Z=q.debugOverlayCanvas,G=q.context.gl,X=q.debugOverlayCanvas.getContext("2d");X.clearRect(0,0,Z.width,Z.height),X.shadowColor="white",X.shadowBlur=2,X.lineWidth=1.5,X.strokeStyle="white",X.textBaseline="top",X.font="bold 36px Open Sans, sans-serif",X.fillText(Y,5,5),X.strokeText(Y,5,5),q.debugOverlayTexture.update(Z),q.debugOverlayTexture.bind(G.LINEAR,G.CLAMP_TO_EDGE)})(d,`${$} ${z}kB`);const U=d.transform.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!0,applyTerrainMatrix:!0});y.draw(c,f.TRIANGLES,x,w,yt.alphaBlended,rt.disabled,Lc(h.bo.transparent,j),null,U,P,d.debugBuffer,d.quadTriangleIndexBuffer,d.debugSegments),y.draw(c,f.LINE_STRIP,x,w,S,rt.disabled,Lc(h.bo.red),E,U,P,d.debugBuffer,d.tileBorderIndexBuffer,d.debugSegments)}function Ol(d,t,n,a){const{isRenderingGlobe:c}=a,f=d.context,y=f.gl,x=d.transform,w=d.colorModeForRenderPass(),S=d.getDepthModeFor3D(),P=d.useProgram("terrain");f.bindFramebuffer.set(null),f.viewport.set([0,0,d.width,d.height]);for(const E of n){const C=t.getTerrainMesh(E.tileID),z=d.renderToTexture.getTexture(E),O=t.getTerrainData(E.tileID);f.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,z.texture);const j=t.getMeshFrameDelta(x.zoom),$=x.calculateFogMatrix(E.tileID.toUnwrapped()),U=zc(j,$,d.style.sky,x.pitch,c),q=x.getProjectionData({overscaledTileID:E.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});P.draw(f,y.TRIANGLES,S,ot.disabled,w,rt.backCCW,U,O,q,"terrain",C.vertexBuffer,C.indexBuffer,C.segments)}}function $i(d,t){if(!t.mesh){const n=new h.aU;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(1,1),n.emplaceBack(-1,1);const a=new h.aW;a.emplaceBack(0,1,2),a.emplaceBack(0,2,3),t.mesh=new yr(d.createVertexBuffer(n,gt.members),d.createIndexBuffer(a),h.aV.simpleSegment(0,0,n.length,a.length))}return t.mesh}const hr={symbol:function(d,t,n,a,c,f){if(d.renderPass!=="translucent")return;const{isRenderingToTexture:y}=f,x=ot.disabled,w=d.colorModeForRenderPass();(n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&(function(S,P,E,C,z,O,j,$,U){var q;const Y=P.transform,Z=P.style.map.terrain,G=z==="map",X=O==="map";for(const W of S){const ee=C.getTile(W),ue=ee.getBucket(E);if(!(!((q=ue?.text)===null||q===void 0)&&q.segments.get().length))continue;const oe=h.aw(ue.textSizeData,Y.zoom),_e=h.aK(ee,1,P.transform.zoom),ye=Fn(G,P.transform,_e),ze=E.layout.get("icon-text-fit")!=="none"&&ue.hasIconData();if(oe){const Ie=Math.pow(2,Y.zoom-ee.tileID.overscaledZ),me=Z?(ke,Re)=>Z.getElevation(W,ke,Re):null;Yc(ue,G,X,U,Y,ye,Ie,oe,ze,h.aL(Y,ee,j,$),W.toUnwrapped(),me)}}})(a,d,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),c),n.paint.get("icon-opacity").constantOr(1)!==0&&aa(d,t,n,a,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),x,w,y),n.paint.get("text-opacity").constantOr(1)!==0&&aa(d,t,n,a,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),x,w,y),t.map.showCollisionBoxes&&(kl(d,t,n,a,!0),kl(d,t,n,a,!1))},circle:function(d,t,n,a,c){var f;if(d.renderPass!=="translucent")return;const{isRenderingToTexture:y}=c,x=n.paint.get("circle-opacity"),w=n.paint.get("circle-stroke-width"),S=n.paint.get("circle-stroke-opacity"),P=!n.layout.get("circle-sort-key").isConstant();if(x.constantOr(1)===0&&(w.constantOr(1)===0||S.constantOr(1)===0))return;const E=d.context,C=E.gl,z=d.transform,O=d.getDepthModeForSublayer(0,Ue.ReadOnly),j=ot.disabled,$=d.colorModeForRenderPass(),U=[],q=z.getCircleRadiusCorrection();for(const Y of a){const Z=t.getTile(Y),G=Z.getBucket(n);if(!G)continue;const X=n.paint.get("circle-translate"),W=n.paint.get("circle-translate-anchor"),ee=h.aL(z,Z,X,W),ue=G.programConfigurations.get(n.id),oe=d.useProgram("circle",ue),_e=G.layoutVertexBuffer,ye=G.indexBuffer,ze=(f=d.style.map.terrain)===null||f===void 0?void 0:f.getTerrainData(Y),Ie={programConfiguration:ue,program:oe,layoutVertexBuffer:_e,indexBuffer:ye,uniformValues:Qu(d,Z,n,ee,q),terrainData:ze,projectionData:z.getProjectionData({overscaledTileID:Y,applyGlobeMatrix:!y,applyTerrainMatrix:!0})};if(P){const me=G.segments.get();for(const ke of me)U.push({segments:new h.aV([ke]),sortKey:ke.sortKey,state:Ie})}else U.push({segments:G.segments,sortKey:0,state:Ie})}P&&U.sort(((Y,Z)=>Y.sortKey-Z.sortKey));for(const Y of U){const{programConfiguration:Z,program:G,layoutVertexBuffer:X,indexBuffer:W,uniformValues:ee,terrainData:ue,projectionData:oe}=Y.state;G.draw(E,C.TRIANGLES,O,j,$,rt.backCCW,ee,ue,oe,n.id,X,W,Y.segments,n.paint,d.transform.zoom,Z)}},heatmap:function(d,t,n,a,c){if(n.paint.get("heatmap-opacity")===0)return;const f=d.context,{isRenderingToTexture:y,isRenderingGlobe:x}=c;if(d.style.map.terrain){for(const w of a){const S=t.getTile(w);t.hasRenderableParent(w)||(d.renderPass==="offscreen"?Jc(d,S,n,w,x):d.renderPass==="translucent"&&Lt(d,n,w,y,x))}f.viewport.set([0,0,d.width,d.height])}else d.renderPass==="offscreen"?(function(w,S,P,E){const C=w.context,z=C.gl,O=w.transform,j=ot.disabled,$=new yt([z.ONE,z.ONE],h.bo.transparent,[!0,!0,!0,!0]);(function(U,q,Y){const Z=U.gl;U.activeTexture.set(Z.TEXTURE1),U.viewport.set([0,0,q.width/4,q.height/4]);let G=Y.heatmapFbos.get(h.cd);G?(Z.bindTexture(Z.TEXTURE_2D,G.colorAttachment.get()),U.bindFramebuffer.set(G.framebuffer)):(G=Xr(U,q.width/4,q.height/4),Y.heatmapFbos.set(h.cd,G))})(C,w,P),C.clear({color:h.bo.transparent});for(const U of E){if(S.hasRenderableParent(U))continue;const q=S.getTile(U),Y=q.getBucket(P);if(!Y)continue;const Z=Y.programConfigurations.get(P.id),G=w.useProgram("heatmap",Z),X=O.getProjectionData({overscaledTileID:U,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),W=O.getCircleRadiusCorrection();G.draw(C,z.TRIANGLES,Ue.disabled,j,$,rt.backCCW,xl(q,O.zoom,P.paint.get("heatmap-intensity"),W),null,X,P.id,Y.layoutVertexBuffer,Y.indexBuffer,Y.segments,P.paint,O.zoom,Z)}C.viewport.set([0,0,w.width,w.height])})(d,t,n,a):d.renderPass==="translucent"&&(function(w,S){const P=w.context,E=P.gl;P.setColorMode(w.colorModeForRenderPass());const C=S.heatmapFbos.get(h.cd);C&&(P.activeTexture.set(E.TEXTURE0),E.bindTexture(E.TEXTURE_2D,C.colorAttachment.get()),P.activeTexture.set(E.TEXTURE1),ki(P,S).bind(E.LINEAR,E.CLAMP_TO_EDGE),w.useProgram("heatmapTexture").draw(P,E.TRIANGLES,Ue.disabled,ot.disabled,w.colorModeForRenderPass(),rt.disabled,bl(w,S,0,1),null,null,S.id,w.viewportBuffer,w.quadTriangleIndexBuffer,w.viewportSegments,S.paint,w.transform.zoom))})(d,n)},line:function(d,t,n,a,c){var f;if(d.renderPass!=="translucent")return;const{isRenderingToTexture:y}=c,x=n.paint.get("line-opacity"),w=n.paint.get("line-width");if(x.constantOr(1)===0||w.constantOr(1)===0)return;const S=d.getDepthModeForSublayer(0,Ue.ReadOnly),P=d.colorModeForRenderPass(),E=n.paint.get("line-dasharray"),C=E.constantOr(1),z=n.paint.get("line-pattern"),O=z.constantOr(1),j=n.paint.get("line-gradient"),$=n.getCrossfadeParameters();let U;U=O?"linePattern":C&&j?"lineGradientSDF":C?"lineSDF":j?"lineGradient":"line";const q=d.context,Y=q.gl,Z=d.transform;let G=!0;for(const X of a){const W=t.getTile(X);if(O&&!W.patternsLoaded())continue;const ee=W.getBucket(n);if(!ee)continue;const ue=ee.programConfigurations.get(n.id),oe=d.context.program.get(),_e=d.useProgram(U,ue),ye=G||_e.program!==oe,ze=(f=d.style.map.terrain)===null||f===void 0?void 0:f.getTerrainData(X),Ie=z.constantOr(null),me=E?.constantOr(null);if(Ie&&W.imageAtlas){const _t=W.imageAtlas,Ft=_t.patternPositions[Ie.to.toString()],Bt=_t.patternPositions[Ie.from.toString()];Ft&&Bt&&ue.setConstantPatternPositions(Ft,Bt)}else if(me){const _t=n.layout.get("line-cap").constantOr(null)==="round",Ft=d.lineAtlas.getDash(me.to,_t),Bt=d.lineAtlas.getDash(me.from,_t);ue.setConstantDashPositions(Ft,Bt)}const ke=Z.getProjectionData({overscaledTileID:X,applyGlobeMatrix:!y,applyTerrainMatrix:!0}),Re=Z.getPixelScale();let ut;O?(ut=Sl(d,W,n,Re,$),ca(q,Y,W,ue,$)):C&&j?(ut=Oc(d,W,n,Re,$,ee.lineClipsArray.length),Ll(d,t,q,Y,n,ee,X,ue,$)):C?(ut=Pl(d,W,n,Re,$),Qc(d,q,Y,ue,ye,$)):j?(ut=Tl(d,W,n,Re,ee.lineClipsArray.length),is(d,t,q,Y,n,ee,X)):ut=Qi(d,W,n,Re);const Dt=d.stencilModeForClipping(X);_e.draw(q,Y.TRIANGLES,S,Dt,P,rt.disabled,ut,ze,ke,n.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,n.paint,d.transform.zoom,ue,ee.layoutVertexBuffer2),G=!1}},fill:function(d,t,n,a,c){const f=n.paint.get("fill-color"),y=n.paint.get("fill-opacity");if(y.constantOr(1)===0)return;const{isRenderingToTexture:x}=c,w=d.colorModeForRenderPass(),S=n.paint.get("fill-pattern"),P=d.opaquePassEnabledForLayer()&&!S.constantOr(1)&&f.constantOr(h.bo.transparent).a===1&&y.constantOr(0)===1?"opaque":"translucent";if(d.renderPass===P){const E=d.getDepthModeForSublayer(1,d.renderPass==="opaque"?Ue.ReadWrite:Ue.ReadOnly);ua(d,t,n,a,E,w,!1,x)}if(d.renderPass==="translucent"&&n.paint.get("fill-antialias")){const E=d.getDepthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,Ue.ReadOnly);ua(d,t,n,a,E,w,!0,x)}},fillExtrusion:function(d,t,n,a,c){const f=n.paint.get("fill-extrusion-opacity");if(f===0)return;const{isRenderingToTexture:y}=c;if(d.renderPass==="translucent"){const x=new Ue(d.context.gl.LEQUAL,Ue.ReadWrite,d.depthRangeFor3D);if(f!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))ha(d,t,n,a,x,ot.disabled,yt.disabled,y),ha(d,t,n,a,x,d.stencilModeFor3D(),d.colorModeForRenderPass(),y);else{const w=d.colorModeForRenderPass();ha(d,t,n,a,x,ot.disabled,w,y)}}},hillshade:function(d,t,n,a,c){if(d.renderPass!=="offscreen"&&d.renderPass!=="translucent")return;const{isRenderingToTexture:f}=c,y=d.context,x=d.style.projection.useSubdivision,w=d.getDepthModeForSublayer(0,Ue.ReadOnly),S=d.colorModeForRenderPass();if(d.renderPass==="offscreen")(function(P,E,C,z,O,j,$){const U=P.context,q=U.gl,Y=z.paint.get("resampling")==="nearest"?q.NEAREST:q.LINEAR;for(const Z of C){const G=E.getTile(Z),X=G.dem;if(!X?.data||!G.needsHillshadePrepare)continue;const W=X.dim,ee=X.stride,ue=X.getPixels();if(U.activeTexture.set(q.TEXTURE1),U.pixelStoreUnpackPremultiplyAlpha.set(!1),G.demTexture||(G.demTexture=P.getTileTexture(ee)),G.demTexture){const _e=G.demTexture;_e.update(ue,{premultiply:!1}),_e.bind(q.NEAREST,q.CLAMP_TO_EDGE)}else G.demTexture=new h.T(U,ue,q.RGBA,{premultiply:!1}),G.demTexture.bind(q.NEAREST,q.CLAMP_TO_EDGE);U.activeTexture.set(q.TEXTURE0);let oe=G.fbo;if(!oe){const _e=new h.T(U,{width:W,height:W,data:null},q.RGBA);_e.bind(Y,q.CLAMP_TO_EDGE),oe=G.fbo=U.createFramebuffer(W,W,!0,!1),oe.colorAttachment.set(_e.texture)}U.bindFramebuffer.set(oe.framebuffer),U.viewport.set([0,0,W,W]),P.useProgram("hillshadePrepare").draw(U,q.TRIANGLES,O,j,$,rt.disabled,wl(G.tileID,X),null,null,z.id,P.rasterBoundsBuffer,P.quadTriangleIndexBuffer,P.rasterBoundsSegments),G.needsHillshadePrepare=!1}})(d,t,a,n,w,ot.disabled,S),y.viewport.set([0,0,d.width,d.height]);else if(d.renderPass==="translucent")if(x){const[P,E,C]=d.stencilConfigForOverlapTwoPass(a);da(d,t,n,C,P,w,S,!1,f),da(d,t,n,C,E,w,S,!0,f)}else{const[P,E]=d.getStencilConfigForOverlapAndUpdateStencilID(a);da(d,t,n,E,P,w,S,!1,f)}},colorRelief:function(d,t,n,a,c){if(d.renderPass!=="translucent"||!a.length)return;const{isRenderingToTexture:f}=c,y=d.style.projection.useSubdivision,x=d.getDepthModeForSublayer(0,Ue.ReadOnly),w=d.colorModeForRenderPass();if(y){const[S,P,E]=d.stencilConfigForOverlapTwoPass(a);fa(d,t,n,E,S,x,w,!1,f),fa(d,t,n,E,P,x,w,!0,f)}else{const[S,P]=d.getStencilConfigForOverlapAndUpdateStencilID(a);fa(d,t,n,P,S,x,w,!1,f)}},raster:function(d,t,n,a,c){if(d.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!a.length)return;const{isRenderingToTexture:f}=c,y=t.getSource(),x=d.style.projection.useSubdivision;if(y instanceof an)ur(d,t,n,a,null,!1,!1,y.tileCoords,y.flippedWindingOrder,f);else if(x){const[w,S,P]=d.stencilConfigForOverlapTwoPass(a);ur(d,t,n,P,w,!1,!0,ma,!1,f),ur(d,t,n,P,S,!0,!0,ma,!1,f)}else{const[w,S]=d.getStencilConfigForOverlapAndUpdateStencilID(a);ur(d,t,n,S,w,!1,!0,ma,!1,f)}},background:function(d,t,n,a,c){var f;const y=n.paint.get("background-color"),x=n.paint.get("background-opacity");if(x===0)return;const{isRenderingToTexture:w}=c,S=d.context,P=S.gl,E=d.style.projection,C=d.transform,z=C.tileSize,O=n.paint.get("background-pattern");if(d.isPatternMissing(O))return;const j=!O&&y.a===1&&x===1&&d.opaquePassEnabledForLayer()?"opaque":"translucent";if(d.renderPass!==j)return;const $=ot.disabled,U=d.getDepthModeForSublayer(0,j==="opaque"?Ue.ReadWrite:Ue.ReadOnly),q=d.colorModeForRenderPass(),Y=d.useProgram(O?"backgroundPattern":"background"),Z=a||cn(C,{tileSize:z,terrain:d.style.map.terrain});O&&(S.activeTexture.set(P.TEXTURE0),d.imageManager.bind(d.context));const G=n.getCrossfadeParameters();for(const X of Z){const W=C.getProjectionData({overscaledTileID:X,applyGlobeMatrix:!w,applyTerrainMatrix:!0}),ee=O?rh(x,d,O,{tileID:X,tileSize:z},G):Nc(x,y),ue=(f=d.style.map.terrain)===null||f===void 0?void 0:f.getTerrainData(X),oe=E.getMeshFromTileID(S,X.canonical,!1,!0,"raster");Y.draw(S,P.TRIANGLES,U,$,q,rt.backCCW,ee,ue,W,n.id,oe.vertexBuffer,oe.indexBuffer,oe.segments)}},sky:function(d,t){const n=d.context,a=n.gl,c=((P,E,C)=>{const z=Math.cos(E.rollInRadians),O=Math.sin(E.rollInRadians),j=Ss(E),$=E.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:P.properties.get("sky-color"),u_horizon_color:P.properties.get("horizon-color"),u_horizon:[(E.width/2-j*O)*C,(E.height/2+j*z)*C],u_horizon_normal:[-O,z],u_sky_horizon_blend:P.properties.get("sky-horizon-blend")*E.height/2*C,u_sky_blend:$}})(t,d.style.map.transform,d.pixelRatio),f=new Ue(a.LEQUAL,Ue.ReadWrite,[0,1]),y=ot.disabled,x=d.colorModeForRenderPass(),w=d.useProgram("sky"),S=$i(n,t);w.draw(n,a.TRIANGLES,f,y,x,rt.disabled,c,null,void 0,"sky",S.vertexBuffer,S.indexBuffer,S.segments)},atmosphere:function(d,t,n){const a=d.context,c=a.gl,f=d.useProgram("atmosphere"),y=new Ue(c.LEQUAL,Ue.ReadOnly,[0,1]),x=d.transform,w=(function($,U){const q=$.properties.get("position"),Y=[-q.x,-q.y,-q.z],Z=h.ap(new Float64Array(16));return $.properties.get("anchor")==="map"&&(h.be(Z,Z,U.rollInRadians),h.bf(Z,Z,-U.pitchInRadians),h.be(Z,Z,U.bearingInRadians),h.bf(Z,Z,U.center.lat*Math.PI/180),h.bI(Z,Z,-U.center.lng*Math.PI/180)),h.cg(Y,Y,Z),Y})(n,d.transform),S=x.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),P=t.properties.get("atmosphere-blend")*S.projectionTransition;if(P===0)return;const E=Vo(x.worldSize,x.center.lat),C=x.inverseProjectionMatrix,z=new Float64Array(4);z[3]=1,h.aE(z,z,x.modelViewProjectionMatrix),z[0]/=z[3],z[1]/=z[3],z[2]/=z[3],z[3]=1,h.aE(z,z,C),z[0]/=z[3],z[1]/=z[3],z[2]/=z[3],z[3]=1;const O=(($,U,q,Y,Z)=>({u_sun_pos:$,u_atmosphere_blend:U,u_globe_position:q,u_globe_radius:Y,u_inv_proj_matrix:Z}))(w,P,[z[0],z[1],z[2]],E,C),j=$i(a,t);f.draw(a,c.TRIANGLES,y,ot.disabled,yt.alphaBlended,rt.disabled,O,null,null,"atmosphere",j.vertexBuffer,j.indexBuffer,j.segments)},custom:function(d,t,n,a){const{isRenderingGlobe:c}=a,f=d.context,y=n.implementation,x=d.style.projection,w=d.transform,S=w.getProjectionDataForCustomLayer(c),P={farZ:w.farZ,nearZ:w.nearZ,fov:w.fov*Math.PI/180,modelViewProjectionMatrix:w.modelViewProjectionMatrix,projectionMatrix:w.projectionMatrix,shaderData:{variantName:x.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
799
+ uniform mat4 u_projection_matrix;
800
+ ${x.shaderPreludeCode.vertexSource}`,define:x.shaderDefine},defaultProjectionData:S},E=y.renderingMode?y.renderingMode:"2d";if(d.renderPass==="offscreen"){const C=y.prerender;C&&(d.setCustomLayerDefaults(),f.setColorMode(d.colorModeForRenderPass()),C.call(y,f.gl,P),f.setDirty(),d.setBaseState())}else if(d.renderPass==="translucent"){d.setCustomLayerDefaults(),f.setColorMode(d.colorModeForRenderPass()),f.setStencilMode(ot.disabled);const C=E==="3d"?d.getDepthModeFor3D():d.getDepthModeForSublayer(0,Ue.ReadOnly);f.setDepthMode(C),y.render(f.gl,P),f.setDirty(),d.setBaseState(),f.bindFramebuffer.set(null)}},debug:function(d,t,n){for(const a of n)ga(d,t,a)},debugPadding:function(d){const t=d.transform.padding;Fl(d,d.transform.height-(t.top||0),3,tu),Fl(d,t.bottom||0,3,iu),Bl(d,t.left||0,3,ru),Bl(d,d.transform.width-(t.right||0),3,nu);const n=d.transform.centerPoint;(function(a,c,f,y){Gs(a,c-1,f-10,2,20,y),Gs(a,c-10,f-1,20,2,y)})(d,n.x,d.transform.height-n.y,su)},terrainDepth:function(d,t){const n=d.context,a=n.gl,c=d.transform,f=yt.unblended,y=new Ue(a.LEQUAL,Ue.ReadWrite,[0,1]),x=t.tileManager.getRenderableTiles(),w=d.useProgram("terrainDepth");n.bindFramebuffer.set(t.getFramebuffer("depth").framebuffer),n.viewport.set([0,0,d.width/devicePixelRatio,d.height/devicePixelRatio]),n.clear({color:h.bo.transparent,depth:1});for(const S of x){const P=t.getTerrainMesh(S.tileID),E=t.getTerrainData(S.tileID),C=c.getProjectionData({overscaledTileID:S.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),z={u_ele_delta:t.getMeshFrameDelta(c.zoom)};w.draw(n,a.TRIANGLES,y,ot.disabled,f,rt.backCCW,z,E,C,"terrain",P.vertexBuffer,P.indexBuffer,P.segments)}n.bindFramebuffer.set(null),n.viewport.set([0,0,d.width,d.height])},terrainCoords:function(d,t){const n=d.context,a=n.gl,c=d.transform,f=yt.unblended,y=new Ue(a.LEQUAL,Ue.ReadWrite,[0,1]),x=t.getCoordsTexture(),w=t.tileManager.getRenderableTiles(),S=d.useProgram("terrainCoords");n.bindFramebuffer.set(t.getFramebuffer("coords").framebuffer),n.viewport.set([0,0,d.width/devicePixelRatio,d.height/devicePixelRatio]),n.clear({color:h.bo.transparent,depth:1}),t.coordsIndex=[];for(const P of w){const E=t.getTerrainMesh(P.tileID),C=t.getTerrainData(P.tileID);n.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,x.texture);const z={u_terrain_coords_id:(255-t.coordsIndex.length)/255,u_texture:0,u_ele_delta:t.getMeshFrameDelta(c.zoom)},O=c.getProjectionData({overscaledTileID:P.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});S.draw(n,a.TRIANGLES,y,ot.disabled,f,rt.backCCW,z,C,O,"terrain",E.vertexBuffer,E.indexBuffer,E.segments),t.coordsIndex.push(P.tileID.key)}n.bindFramebuffer.set(null),n.viewport.set([0,0,d.width,d.height])}};class $s{constructor(t,n){this.drawFunctions=hr,this.context=new Us(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={depthDirty:!0,coordsDirty:!1,matrix:h.ap(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Jt.maxOverzooming+Jt.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Si}resize(t,n,a){if(this.width=Math.floor(t*a),this.height=Math.floor(n*a),this.pixelRatio=a,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 h.aU;n.emplaceBack(0,0),n.emplaceBack(h.a6,0),n.emplaceBack(0,h.a6),n.emplaceBack(h.a6,h.a6),this.tileExtentBuffer=t.createVertexBuffer(n,gt.members),this.tileExtentSegments=h.aV.simpleSegment(0,0,4,2);const a=new h.aU;a.emplaceBack(0,0),a.emplaceBack(h.a6,0),a.emplaceBack(0,h.a6),a.emplaceBack(h.a6,h.a6),this.debugBuffer=t.createVertexBuffer(a,gt.members),this.debugSegments=h.aV.simpleSegment(0,0,4,5);const c=new h.ch;c.emplaceBack(0,0,0,0),c.emplaceBack(h.a6,0,h.a6,0),c.emplaceBack(0,h.a6,0,h.a6),c.emplaceBack(h.a6,h.a6,h.a6,h.a6),this.rasterBoundsBuffer=t.createVertexBuffer(c,Dc.members),this.rasterBoundsSegments=h.aV.simpleSegment(0,0,4,2);const f=new h.aU;f.emplaceBack(0,0),f.emplaceBack(h.a6,0),f.emplaceBack(0,h.a6),f.emplaceBack(h.a6,h.a6),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(f,gt.members),this.rasterBoundsSegmentsPosOnly=h.aV.simpleSegment(0,0,4,5);const y=new h.aU;y.emplaceBack(0,0),y.emplaceBack(1,0),y.emplaceBack(0,1),y.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(y,gt.members),this.viewportSegments=h.aV.simpleSegment(0,0,4,2);const x=new h.ci;x.emplaceBack(0),x.emplaceBack(1),x.emplaceBack(3),x.emplaceBack(2),x.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(x);const w=new h.aW;w.emplaceBack(1,0,2),w.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(w);const S=this.context.gl;this.stencilClearMode=new ot({func:S.ALWAYS,mask:0},0,255,S.ZERO,S.ZERO,S.ZERO),this.tileExtentMesh=new yr(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=h.O();h.c7(a,0,this.width,this.height,0,0,1),h.S(a,a,[n.drawingBufferWidth,n.drawingBufferHeight,0]);const c={mainMatrix:a,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:a};this.useProgram("clippingMask",null,!0).draw(t,n.TRIANGLES,Ue.disabled,this.stencilClearMode,yt.disabled,rt.disabled,null,null,c,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n,a){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n?.length)return;this.currentStencilSource=t.source,this.nextStencilID+n.length>256&&this.clearStencil();const c=this.context;c.setColorMode(yt.disabled),c.setDepthMode(Ue.disabled);const f={};for(const y of n)f[y.key]=this.nextStencilID++;this._renderTileMasks(f,n,a,!0),this._renderTileMasks(f,n,a,!1),this._tileClippingMaskIDs=f}_renderTileMasks(t,n,a,c){var f;const y=this.context,x=y.gl,w=this.style.projection,S=this.transform,P=this.useProgram("clippingMask");for(const E of n){const C=t[E.key],z=(f=this.style.map.terrain)===null||f===void 0?void 0:f.getTerrainData(E),O=w.getMeshFromTileID(this.context,E.canonical,c,!0,"stencil"),j=S.getProjectionData({overscaledTileID:E,applyGlobeMatrix:!a,applyTerrainMatrix:!0});P.draw(y,x.TRIANGLES,Ue.disabled,new ot({func:x.ALWAYS,mask:0},C,255,x.KEEP,x.KEEP,x.REPLACE),yt.disabled,a?rt.disabled:rt.backCCW,null,z,j,"$clipping",O.vertexBuffer,O.indexBuffer,O.segments)}}_renderTilesDepthBuffer(){var t;const n=this.context,a=n.gl,c=this.style.projection,f=this.transform,y=this.useProgram("depth"),x=this.getDepthModeFor3D(),w=cn(f,{tileSize:f.tileSize});for(const S of w){const P=(t=this.style.map.terrain)===null||t===void 0?void 0:t.getTerrainData(S),E=c.getMeshFromTileID(this.context,S.canonical,!0,!0,"raster"),C=f.getProjectionData({overscaledTileID:S,applyGlobeMatrix:!0,applyTerrainMatrix:!0});y.draw(n,a.TRIANGLES,x,ot.disabled,yt.disabled,rt.backCCW,null,P,C,"$clipping",E.vertexBuffer,E.indexBuffer,E.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new ot({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new ot({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){const n=this.context.gl,a=t.sort(((y,x)=>x.overscaledZ-y.overscaledZ)),c=a[a.length-1].overscaledZ,f=a[0].overscaledZ-c+1;if(f>1){this.currentStencilSource=void 0,this.nextStencilID+f>256&&this.clearStencil();const y={};for(let x=0;x<f;x++)y[x+c]=new ot({func:n.GEQUAL,mask:255},x+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=f,[y,a]}return[{[c]:ot.disabled},a]}stencilConfigForOverlapTwoPass(t){const n=this.context.gl,a=t.sort(((y,x)=>x.overscaledZ-y.overscaledZ)),c=a[a.length-1].overscaledZ,f=a[0].overscaledZ-c+1;if(this.clearStencil(),f>1){const y={},x={};for(let w=0;w<f;w++)y[w+c]=new ot({func:n.GREATER,mask:255},f+1+w,255,n.KEEP,n.KEEP,n.REPLACE),x[w+c]=new ot({func:n.GREATER,mask:255},1+w,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID=2*f+1,[y,x,a]}return this.nextStencilID=3,[{[c]:new ot({func:n.GREATER,mask:255},2,255,n.KEEP,n.KEEP,n.REPLACE)},{[c]:new ot({func:n.GREATER,mask:255},1,255,n.KEEP,n.KEEP,n.REPLACE)},a]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new yt([t.CONSTANT_COLOR,t.ONE],new h.bo(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?yt.unblended:yt.alphaBlended}getDepthModeForSublayer(t,n,a){if(!this.opaquePassEnabledForLayer())return Ue.disabled;const c=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Ue(a||this.context.gl.LEQUAL,n,[c,c])}getDepthModeFor3D(){return new Ue(this.context.gl.LEQUAL,Ue.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){var a,c,f;this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(je()),this.imageManager.beginFrame();const y=this.style._order,x=this.style.tileManagers,w={},S={},P={},E={isRenderingToTexture:!1,isRenderingGlobe:((a=t.projection)===null||a===void 0?void 0:a.transitionState)>0};for(const z in x){const O=x[z];O.used&&O.prepare(this.context),w[z]=O.getVisibleCoordinates(!1),S[z]=w[z].slice().reverse(),P[z]=O.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let z=0;z<y.length;z++)if(this.style._layers[y[z]].is3D()){this.opaquePassCutoff=z;break}this.maybeDrawDepth(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const z of y){const O=this.style._layers[z];if(!O.hasOffscreenPass()||O.isHidden(this.transform.zoom))continue;const j=S[O.source];(O.type==="custom"||j.length)&&this.renderLayer(this,x[O.source],O,j,E)}if((c=this.style.projection)===null||c===void 0||c.updateGPUdependent({context:this.context,useProgram:z=>this.useProgram(z)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?h.bo.black:h.bo.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(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=y.length-1;this.currentLayer>=0;this.currentLayer--){const z=this.style._layers[y[this.currentLayer]],O=x[z.source],j=w[z.source];this._renderTileClippingMasks(z,j,!1),this.renderLayer(this,O,z,j,E)}this.renderPass="translucent";let C=!1;for(this.currentLayer=0;this.currentLayer<y.length;this.currentLayer++){const z=this.style._layers[y[this.currentLayer]],O=x[z.source];if(!((f=this.renderToTexture)===null||f===void 0)&&f.renderLayer(z,E))continue;this.opaquePassEnabledForLayer()||C||(C=!0,E.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const j=(z.type==="symbol"?P:S)[z.source];this._renderTileClippingMasks(z,w[z.source],!!this.renderToTexture),this.renderLayer(this,O,z,j,E)}if(E.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const z=(function(O,j){let $=null;const U=Object.values(O._layers).flatMap((G=>G.source&&!G.isHidden(j)?[O.tileManagers[G.source]]:[])),q=U.filter((G=>G.getSource().type==="vector")),Y=U.filter((G=>G.getSource().type!=="vector")),Z=G=>{(!$||$.getSource().maxzoom<G.getSource().maxzoom)&&($=G)};for(const G of q)Z(G);if(!$)for(const G of Y)Z(G);return $})(this.style,this.transform.zoom);z&&this.drawFunctions.debug(this,z,z.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(t){var n,a;if(!(!((a=(n=this.style)===null||n===void 0?void 0:n.map)===null||a===void 0)&&a.terrain))return;const c=this.terrainFacilitator.matrix,f=this.transform.modelViewProjectionMatrix;let y=this.terrainFacilitator.depthDirty;y||(y=t?!h.cj(c,f):!h.ck(c,f)),y||(y=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),y&&(h.cl(c,f),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.depthDirty=!1,this.terrainFacilitator.coordsDirty=!0,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}maybeDrawCoords(){var t,n;!((n=(t=this.style)===null||t===void 0?void 0:t.map)===null||n===void 0)&&n.terrain&&this.terrainFacilitator.coordsDirty&&(this.terrainFacilitator.coordsDirty=!1,this.drawFunctions.terrainCoords(this,this.style.map.terrain))}renderLayer(t,n,a,c,f){if(a.isHidden(this.transform.zoom)||a.type!=="background"&&a.type!=="custom"&&!(c||[]).length)return;this.id=a.id;const y=this.drawFunctions;h.aQ(a)?y.symbol(t,n,a,c,this.style.placement.variableOffsets,f):h.cm(a)?y.circle(t,n,a,c,f):h.cn(a)?y.heatmap(t,n,a,c,f):h.co(a)?y.line(t,n,a,c,f):h.cp(a)?y.fill(t,n,a,c,f):h.cq(a)?y.fillExtrusion(t,n,a,c,f):h.cr(a)?y.hillshade(t,n,a,c,f):h.cs(a)?y.colorRelief(t,n,a,c,f):h.bU(a)?y.raster(t,n,a,c,f):h.ct(a)?y.background(t,n,a,c,f):h.cu(a)&&y.custom(t,n,a,f)}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.length<$s.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()),a=this.imageManager.getPattern(t.to.toString());return!n||!a}useProgram(t,n,a=!1,c=[]){var f;this.cache||(this.cache={});const y=!!this.style.map.terrain,x=this.style.projection,w=a?Rt.projectionMercator:x.shaderPreludeCode,S=a?$n:x.shaderDefine,P=t+(n?n.cacheKey:"")+`/${a?$r:x.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(y?"/terrain":"")+(c?`/${c.join("/")}`:"");return(f=this.cache)[P]||(f[P]=new kc(this.context,Rt[t],n,Wo[t],this._showOverdrawInspector,y,w,S,c)),this.cache[P]}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 h.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var t,n;if(this._tileTextures){for(const a in this._tileTextures){const c=this._tileTextures[a];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 a in this.cache){const c=this.cache[a];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 tr(d,t){let n,a=!1,c=null;const f=()=>{c=null,a&&(d(...n),c=setTimeout(f,t),a=!1)};return(...y)=>(a=!0,n=y,c||f(),c)}$s.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50;class ou{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let a;const c=n.split("&").map((f=>f.split("=")));for(const f of c)f[0]===this._hashName&&(a=f);return(a&&a[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(!this._isValidHash(n))return!1;const a=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:a,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 a=n.join("/");let c=a;c.split("&").length>0&&(c=c.split("&")[0]),this._hashName&&(c=`${this._hashName}=${a}`);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=tr(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(),a=Math.round(100*this._map.getZoom())/100,c=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),f=Math.pow(10,c),y=Math.round(n.lng*f)/f,x=Math.round(n.lat*f)/f,w=this._map.getBearing(),S=this._map.getPitch();let P="";if(P+=t?`/${y}/${x}/${a}`:`${a}/${x}/${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((O=>{const j=O.split("=")[0];return j===E?(C=!0,`${j}=${P}`):O})).filter((O=>O));return C||z.push(`${E}=${P}`),`#${z.join("&")}`}return`#${P}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new h.W(+t[2],+t[1])}catch{return!1}const n=+t[0],a=+(t[3]||0),c=+(t[4]||0);return n>=this._map.getMinZoom()&&n<=this._map.getMaxZoom()&&a>=-180&&a<=180&&c>=this._map.getMinPitch()&&c<=this._map.getMaxPitch()}}const Zs={linearity:.3,easing:h.cv(0,0,.3,1)},ch=h.e({deceleration:2500,maxSpeed:1400},Zs),ns=h.e({deceleration:20,maxSpeed:1400},Zs),uh=h.e({deceleration:1e3,maxSpeed:360},Zs),hh=h.e({deceleration:1e3,maxSpeed:90},Zs),dh=h.e({deceleration:1e3,maxSpeed:360},Zs);class ph{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:je(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=je();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 h.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 a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,c={};if(n.pan.mag()){const f=Er(n.pan.mag(),a,h.e({},ch,t||{})),y=n.pan.mult(f.amount/n.pan.mag()),x=this._map.cameraHelper.handlePanInertia(y,this._map.transform);c.center=x.easingCenter,c.offset=x.easingOffset,ss(c,f)}if(n.zoom){const f=Er(n.zoom,a,ns);c.zoom=h.cw(this._map.transform.zoom+f.amount,this._map.getZoomSnap(),f.amount),ss(c,f)}if(n.bearing){const f=Er(n.bearing,a,uh);c.bearing=this._map.transform.bearing+h.al(f.amount,-179,179),ss(c,f)}if(n.pitch){const f=Er(n.pitch,a,hh);c.pitch=this._map.transform.pitch+f.amount,ss(c,f)}if(n.roll){const f=Er(n.roll,a,dh);c.roll=this._map.transform.roll+h.al(f.amount,-179,179),ss(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(),h.e(c,{noMoveStart:!0})}}function ss(d,t){(!d.duration||d.duration<t.duration)&&(d.duration=t.duration,d.easing=t.easing)}function Er(d,t,n){const{maxSpeed:a,linearity:c,deceleration:f}=n,y=h.al(d*c/(t/1e3),-a,a),x=Math.abs(y)/(f*c);return{easing:n.easing,duration:1e3*x,amount:y*(x/2)}}class jt extends h.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a,c={}){a=a instanceof MouseEvent?a:new MouseEvent(t,a);const f=we.mousePos(n.getCanvas(),a),y=n.unproject(f);super(t,h.e({point:f,lngLat:y,originalEvent:a},c)),this._defaultPrevented=!1,this.target=n}}class Ae extends h.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){const c=t==="touchend"?a.changedTouches:a.touches,f=we.touchPos(n.getCanvasContainer(),c),y=f.map((w=>n.unproject(w))),x=f.reduce(((w,S,P,E)=>w.add(S.div(E.length))),new h.P(0,0));super(t,{points:f,point:x,lngLats:y,lngLat:n.unproject(x),originalEvent:a}),this._defaultPrevented=!1}}class Vl extends h.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){super(t,{originalEvent:a}),this._defaultPrevented=!1}}class jl{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Vl(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new jt(t.type,this._map,t))}mouseup(t){this._map.fire(new jt(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new jt(t.type,this._map,t))}dblclick(t){return this._firePreventable(new jt(t.type,this._map,t))}mouseover(t){this._map.fire(new jt(t.type,this._map,t))}mouseout(t){this._map.fire(new jt(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Ae(t.type,this._map,t))}touchmove(t){this._map.fire(new Ae(t.type,this._map,t))}touchend(t){this._map.fire(new Ae(t.type,this._map,t))}touchcancel(t){this._map.fire(new Ae(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class au{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new jt(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new jt("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new jt(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Cr{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(h.P.convert(t),this._map.terrain)}}class os{constructor(t,n){this._map=t,this._tr=new Cr(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&&(we.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const a=n;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)<this._clickTolerance)return;const c=this._startPos;this._lastPos=a,this._box||(this._box=we.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const f=Math.min(c.x,a.x),y=Math.max(c.x,a.x),x=Math.min(c.y,a.y),w=Math.max(c.y,a.y);this._box.style.transform=`translate(${f}px,${x}px)`,this._box.style.width=y-f+"px",this._box.style.height=w-x+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const a=this._startPos,c=n;if(this.reset(),we.suppressClick(),a.x!==c.x||a.y!==c.y)return this._map.fire(new h.n("boxzoomend",{originalEvent:t})),this._boxZoomEnd?void this._boxZoomEnd(this._map,a,c,t):{cameraAnimation:f=>f.fitScreenCoordinates(a,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),we.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new h.n(t,{originalEvent:n}))}}function qs(d,t){if(d.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${d.length}, points ${t.length}`);const n={};for(let a=0;a<d.length;a++)n[d[a].identifier]=t[a];return n}class fh{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=(function(c){const f=new h.P(0,0);for(const y of c)f._add(y);return f.div(c.length)})(n),this.touches=qs(a,n)))}touchmove(t,n,a){if(this.aborted||!this.centroid)return;const c=qs(a,n);for(const f in this.touches){const y=c[f];(!y||y.dist(this.touches[f])>30)&&(this.aborted=!0)}}touchend(t,n,a){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const c=!this.aborted&&this.centroid;if(this.reset(),c)return c}}}class Ws{constructor(t){this.singleTap=new fh(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,a){this.singleTap.touchstart(t,n,a)}touchmove(t,n,a){this.singleTap.touchmove(t,n,a)}touchend(t,n,a){const c=this.singleTap.touchend(t,n,a);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 lu{constructor(t){this._tr=new Cr(t),this._zoomIn=new Ws({numTouches:1,numTaps:2}),this._zoomOut=new Ws({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,a){this._zoomIn.touchstart(t,n,a),this._zoomOut.touchstart(t,n,a)}touchmove(t,n,a){this._zoomIn.touchmove(t,n,a),this._zoomOut.touchmove(t,n,a)}touchend(t,n,a){const c=this._zoomIn.touchend(t,n,a),f=this._zoomOut.touchend(t,n,a),y=this._tr;return c?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:x=>x.easeTo({duration:300,zoom:h.cw(y.zoom+1,x.getZoomSnap()),around:y.unproject(c)},{originalEvent:t})}):f?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:x=>x.easeTo({duration:300,zoom:h.cw(y.zoom-1,x.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 gn{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 a=this._lastPoint;if(!a)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(a)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=c,this._move(a,c))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&we.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 mh=0,cu=2,gh={[mh]:1,[cu]:2};class Hs{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,a){const c=gh[a];return n.buttons===void 0||(n.buttons&c)!==c})(t,this._eventButton)}isValidEndEvent(t){return t.button===this._eventButton}}class uu{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 _h{constructor(t=new Hs({checkCorrectEvent:()=>!0}),n=new uu){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=n}_executeRelevantHandler(t,n,a){return t instanceof MouseEvent?n(t):typeof TouchEvent<"u"&&t instanceof TouchEvent?a(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 Xs=d=>{d.mousedown=d.dragStart,d.mousemoveWindow=d.dragMove,d.mouseup=d.dragEnd,d.contextmenu=t=>{t.preventDefault()}};class yh{constructor(t,n){this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new h.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,n,a){return this._calculateTransform(t,n,a)}touchmove(t,n,a){if(this._active){if(!this._shouldBePrevented(a.length))return t.preventDefault(),this._calculateTransform(t,n,a);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,n,a){this._calculateTransform(t,n,a),this._active&&this._shouldBePrevented(a.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,a){a.length>0&&(this._active=!0);const c=qs(a,n),f=new h.P(0,0),y=new h.P(0,0);let x=0;for(const S in c){const P=c[S],E=this._touches[S];E&&(f._add(P),y._add(P.sub(E)),x++,c[S]=P)}if(this._touches=c,this._shouldBePrevented(x)||!y.mag())return;const w=y.div(x);return this._sum._add(w),this._sum.mag()<this._clickTolerance?void 0:{around:f.div(x),panDelta:w}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Nl{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,n,a){this._firstTwoTouches||a.length<2||(this._firstTwoTouches=[a[0].identifier,a[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,a){if(!this._firstTwoTouches)return;t.preventDefault();const[c,f]=this._firstTwoTouches,y=dr(a,n,c),x=dr(a,n,f);if(!y||!x)return;const w=this._aroundCenter?null:y.add(x).div(2);return this._move([y,x],w,t)}touchend(t,n,a){if(!this._firstTwoTouches)return;const[c,f]=this._firstTwoTouches,y=dr(a,n,c),x=dr(a,n,f);y&&x||(this._active&&we.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 dr(d,t,n){for(let a=0;a<d.length;a++)if(d[a].identifier===n)return t[a]}function ft(d,t){return Math.log(d/t)/Math.LN2}class hu extends Nl{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(t){this._zoomRate=t??1}setZoomThreshold(t){this._zoomThreshold=t??.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const a=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(ft(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:ft(this._distance,a)*this._zoomRate,pinchAround:n}}}function Ys(d,t){return 180*d.angleWith(t)/Math.PI}class Ks extends Nl{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,a){const c=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Ys(this._vector,c),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,a=Ys(t,this._startVector);return Math.abs(a)<n}}function Js(d){return Math.abs(d.y)>Math.abs(d.x)}class Ul extends Nl{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,a){super.touchstart(t,n,a),this._currentTouchCount=a.length}_start(t){this._lastPoints=t,Js(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,a){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,a.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(c.y+f.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,a){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=a),a-this._firstMove<100&&void 0;const y=t.y>0==n.y>0;return Js(t)&&Js(n)&&y}}const du={panStep:100,bearingStep:15,pitchStep:10};class Gl{constructor(t){this._tr=new Cr(t);const n=du;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,a=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?a=-1:(t.preventDefault(),f=-1);break;case 39:t.shiftKey?a=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&&(a=0,c=0),{cameraAnimation:x=>{const w=this._tr;x.easeTo({duration:300,easeId:"keyboardHandler",easing:vh,zoom:n?h.cw(w.zoom+n*(t.shiftKey?2:1),x.getZoomSnap()):w.zoom,bearing:w.bearing+a*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 vh(d){return d*(2-d)}const pr=4.000244140625,_a=1/450;class De{constructor(t,n){this._onTimeout=a=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)},this._map=t,this._tr=new Cr(t),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=_a}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 a=je(),c=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,n!==0&&n%pr==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._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=we.mousePos(this._map.getCanvas(),t),a=this._tr;this._aroundPoint=this._aroundCenter?a.transform.locationToScreenPoint(h.W.convert(a.center)):n,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;const t=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const x=t.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=x),typeof this._targetZoom=="number"&&(this._targetZoom+=x)}if(this._delta!==0){const x=this._type==="wheel"&&Math.abs(this._delta)>pr?this._wheelZoomRate:this._defaultZoomRate;let w=2/(1+Math.exp(-Math.abs(this._delta*x)));this._delta<0&&w!==0&&(w=1/w);const S=typeof this._targetZoom!="number"?t.scale:h.ao(this._targetZoom),P=t.applyConstrain(t.getCameraLngLat(),h.ar(S*w)).zoom,E=this._map.getZoomSnap();if(this._type==="wheel"&&E>0){const C=h.cw(t.zoom,E);this._targetZoom=h.cw(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,a=this._startZoom,c=this._easing;let f,y=!1;if(this._type==="wheel"&&a&&c){const x=je()-this._lastWheelEventTime,w=Math.min((x+5)/200,1),S=c(w);f=h.H.number(a,n,S),w<1?this._needsRerender=!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=h.cy;if(this._prevEase){const a=this._prevEase,c=(je()-a.start)/a.duration,f=a.easing(c+.01)-a.easing(c),y=.27/Math.sqrt(f*f+1e-4)*.01,x=Math.sqrt(.0729-y*y);n=h.cv(y,x,.25,1)}return this._prevEase={start:je(),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 Fe{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 Qs{constructor(t){this._tr=new Cr(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:h.cw(this._tr.zoom+(t.shiftKey?-1:1),a.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 pu{constructor(){this._tap=new Ws({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(t){this._zoomRate=t??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,a){if(!this._swipePoint)if(this._tapTime){const c=n[0],f=t.timeStamp-this._tapTime<500,y=this._tapPoint.dist(c)<30;f&&y?a.length>0&&(this._swipePoint=c,this._swipeTouch=a[0].identifier):this.reset()}else this._tap.touchstart(t,n,a)}touchmove(t,n,a){if(this._tapTime){if(this._swipePoint){if(a[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*this._zoomRate}}}else this._tap.touchmove(t,n,a)}touchend(t,n,a){if(this._tapTime)this._swipePoint&&a.length===0&&this.reset();else{const c=this._tap.touchend(t,n,a);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 eo{constructor(t,n,a){this._el=t,this._mousePan=n,this._touchPan=a}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 mi{constructor(t,n,a,c){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=n,this._mousePitch=a,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 $l{constructor(t,n,a,c){this._el=t,this._touchZoom=n,this._touchRotate=a,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()}setZoomRate(t){this._touchZoom.setZoomRate(t),this._tapDragZoom.setZoomRate(t)}setZoomThreshold(t){this._touchZoom.setZoomThreshold(t)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class ya{constructor(t,n){this._bypassKey=navigator.userAgent.includes("Mac")?"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=we.create("div","maplibregl-cooperative-gesture-screen",t);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const a=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=a,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 h.n("cooperativegestureprevented",{gestureType:t,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const Ri=d=>d.zoom||d.drag||d.roll||d.pitch||d.rotate;class fu extends h.n{}function Zl(d){var t;return((t=d.panDelta)===null||t===void 0?void 0:t.mag())||d.zoomDelta||d.bearingDelta||d.pitchDelta||d.rollDelta}class xh{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,x={needsRenderFrame:!1},w={},S={};for(const{handlerName:C,handler:z,allowed:O}of this._handlers){if(!z.isEnabled())continue;let j;if(this._blockedByActive(S,O,C))z.reset();else if(z[f||c.type]){if(h.cz(c,f||c.type)){const $=we.mousePos(this._map.getCanvas(),c);j=z[f||c.type](c,$)}else if(h.cA(c,f||c.type)){const $=this._getMapTouches(c.touches),U=we.touchPos(this._map.getCanvas(),$);j=z[f||c.type](c,U,$)}else h.cB(f||c.type)||(j=z[f||c.type](c));this.mergeHandlerResult(x,w,j,C,y),j?.needsRenderFrame&&this._triggerRenderFrame()}(j||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||Zl(x))&&(this._changes.push([x,w,P]),this._triggerRenderFrame()),(Object.keys(S).length||Zl(x))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:E}=x;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 ph(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"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,a]of this._listeners)t.removeEventListener(n,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(t){const n=this._map,a=n.getCanvasContainer();this._add("mapEvent",new jl(n,t));const c=n.boxZoom=new os(n,t);this._add("boxZoom",c),t.interactive&&t.boxZoom&&c.enable();const f=n.cooperativeGestures=new ya(n,t.cooperativeGestures);this._add("cooperativeGestures",f),t.cooperativeGestures&&f.enable();const y=new lu(n),x=new Qs(n);n.doubleClickZoom=new Fe(x,y),this._add("tapZoom",y),this._add("clickZoom",x),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const w=new pu;this._add("tapDragZoom",w);const S=n.touchPitch=new Ul(n);this._add("touchPitch",S),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const P=()=>n.project(n.getCenter()),E=(function({enable:Z,clickTolerance:G,aroundCenter:X=!0,minPixelCenterThreshold:W=100,rotateDegreesPerPixelMoved:ee=.8},ue){const oe=new Hs({checkCorrectEvent:_e=>_e.button===0&&_e.ctrlKey||_e.button===2&&!_e.ctrlKey});return new gn({clickTolerance:G,move:(_e,ye)=>{const ze=ue();if(X&&Math.abs(ze.y-_e.y)>W)return{bearingDelta:h.cx(new h.P(_e.x,ye.y),ye,ze)};let Ie=(ye.x-_e.x)*ee;return X&&ye.y<ze.y&&(Ie=-Ie),{bearingDelta:Ie}},moveStateManager:oe,enable:Z,assignEvents:Xs})})(t,P),C=(function({enable:Z,clickTolerance:G,pitchDegreesPerPixelMoved:X=-.5}){const W=new Hs({checkCorrectEvent:ee=>ee.button===0&&ee.ctrlKey||ee.button===2});return new gn({clickTolerance:G,move:(ee,ue)=>({pitchDelta:(ue.y-ee.y)*X}),moveStateManager:W,enable:Z,assignEvents:Xs})})(t),z=(function({enable:Z,clickTolerance:G,rollDegreesPerPixelMoved:X=.3},W){const ee=new Hs({checkCorrectEvent:ue=>ue.button===2&&ue.ctrlKey});return new gn({clickTolerance:G,move:(ue,oe)=>{const _e=W();let ye=(oe.x-ue.x)*X;return oe.y<_e.y&&(ye=-ye),{rollDelta:ye}},moveStateManager:ee,enable:Z,assignEvents:Xs})})(t,P);n.dragRotate=new mi(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 O=(function({enable:Z,clickTolerance:G}){const X=new Hs({checkCorrectEvent:W=>W.button===0&&!W.ctrlKey});return new gn({clickTolerance:G,move:(W,ee)=>({around:ee,panDelta:ee.sub(W)}),activateOnStart:!0,moveStateManager:X,enable:Z,assignEvents:Xs})})(t),j=new yh(t,n);n.dragPan=new eo(a,O,j),this._add("mousePan",O),this._add("touchPan",j,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const $=new Ks,U=new hu;n.touchZoomRotate=new $l(a,U,$,w),this._add("touchRotate",$,["touchPan","touchZoom"]),this._add("touchZoom",U,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new au(n));const q=n.scrollZoom=new De(n,(()=>this._triggerRenderFrame()));this._add("scrollZoom",q,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const Y=n.keyboard=new Gl(n);this._add("keyboard",Y),t.interactive&&t.keyboard&&n.keyboard.enable()}_add(t,n,a){this._handlers.push({handlerName:t,handler:n,allowed:a}),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!!Ri(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,a){for(const c in t)if(c!==a&&!n?.includes(c))return!0;return!1}_getMapTouches(t){const n=[];for(const a of t)this._el.contains(a.target)&&n.push(a);return n}mergeHandlerResult(t,n,a,c,f){if(!a)return;h.e(t,a);const y={handlerName:c,originalEvent:a.originalEvent||f};a.zoomDelta!==void 0&&(n.zoom=y),a.panDelta!==void 0&&(n.drag=y),a.rollDelta!==void 0&&(n.roll=y),a.pitchDelta!==void 0&&(n.pitch=y),a.bearingDelta!==void 0&&(n.rotate=y)}_applyChanges(){const t={},n={},a={};for(const[c,f,y]of this._changes)c.panDelta&&(t.panDelta=(t.panDelta||new h.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),h.e(n,f),h.e(a,y);this._updateMapTransform(t,n,a),this._changes=[]}_updateMapTransform(t,n,a){const c=this._map,f=c._getTransformForUpdate(),y=c.terrain;if(!(Zl(t)||y&&this._terrainMovement))return void this._fireEvents(n,a,!0);c._stop(!0);let{panDelta:x,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 O={panDelta:x,zoomDelta:w,rollDelta:E,pitchDelta:P,bearingDelta:S,around:C};this._map.cameraHelper.useGlobeControls&&!f.isPointOnMapSurface(C)&&(C=f.centerPoint);const j=C.distSqr(f.centerPoint)<.01?f.center:f.screenPointToLocation(x?C.sub(x):C);this._handleMapControls({terrain:y,tr:f,deltasForHelper:O,preZoomAroundLoc:j,combinedEventsInProgress:n,panDelta:x}),c._applyUpdatedTransform(f),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,a,!0)}_handleMapControls({terrain:t,tr:n,deltasForHelper:a,preZoomAroundLoc:c,combinedEventsInProgress:f,panDelta:y}){const x=this._map.cameraHelper;if(x.handleMapControlsRollPitchBearingZoom(a,n),t)return x.useGlobeControls?(this._terrainMovement||!f.drag&&!f.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void x.handleMapControlsPan(a,n,c)):this._terrainMovement||!f.drag&&!f.zoom?void(f.drag&&this._terrainMovement&&y?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(y))):x.handleMapControlsPan(a,n,c)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void x.handleMapControlsPan(a,n,c));x.handleMapControlsPan(a,n,c)}_fireEvents(t,n,a){const c=Ri(this._eventsInProgress),f=Ri(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 x={};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,x[`${E}end`]=w)}for(const E in x)this._fireEvent(E,x[E]);const S=Ri(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(a&&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&&Ze.prefersReducedMotion?(this._map.fire(new h.n("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 h.n(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new fu("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class bh extends h.E{constructor(t,n,a){super(),this._renderFrameCallback=()=>{const c=Math.min((je()-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=a.bearingSnap,this._zoomSnap=a.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 h.W(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,a){return t=h.P.convert(t).mult(-1),this.panTo(this.transform.center,h.e({offset:t},n),a)}panTo(t,n,a){return this.easeTo(h.e({center:t},n),a)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,a){return this.easeTo(h.e({zoom:t},n),a)}zoomIn(t,n){return this.zoomTo(h.cw(this.getZoom()+1,this._zoomSnap),t,n),this}zoomOut(t,n){return this.zoomTo(h.cw(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 h.n("movestart",n)).fire(new h.n("move",n)).fire(new h.n("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,a){return this.easeTo(h.e({bearing:t},n),a)}resetNorth(t,n){return this.rotateTo(0,h.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(h.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 a=n?.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),a,n)}_cameraForBoxAndBearing(t,n,a,c){const f={top:0,bottom:0,right:0,left:0};if(typeof(c=h.e({padding:f,offset:[0,0],maxZoom:this.transform.maxZoom},c)).padding=="number"){const P=c.padding;c.padding={top:P,bottom:P,right:P,left:P}}const y=h.e(f,c.padding);c.padding=y;const x=this.transform,w=new xt(t,n),S=this.cameraHelper.cameraForBoxAndBearing(c,y,w,a,x);return S&&this._zoomSnap&&(S.zoom=h.cw(S.zoom,this._zoomSnap,-1)),S}fitBounds(t,n,a){return this._fitInternal(this.cameraForBounds(t,n),n,a)}fitScreenCoordinates(t,n,a,c,f){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(h.P.convert(t)),this.transform.screenPointToLocation(h.P.convert(n)),a,c),c,f)}_fitInternal(t,n,a){return t?(delete(n=h.e(t,n)).padding,n.linear?this.easeTo(n,a):this.flyTo(n,a)):this}jumpTo(t,n){this.stop(),"zoom"in t&&this._zoomSnap&&(t.zoom=h.cw(t.zoom,this._zoomSnap));const a=this._getTransformForUpdate();let c=!1,f=!1,y=!1;const x=a.zoom;this.terrain&&a.setElevation(this.terrain.getElevationForLngLatZoom(t.center?h.W.convert(t.center):a.center,t.zoom||a.tileZoom)),this.cameraHelper.handleJumpToCenterZoom(a,t);const w=a.zoom!==x;return"elevation"in t&&a.elevation!==+t.elevation&&a.setElevation(+t.elevation),"bearing"in t&&a.bearing!==+t.bearing&&(c=!0,a.setBearing(+t.bearing)),"pitch"in t&&a.pitch!==+t.pitch&&(f=!0,a.setPitch(+t.pitch)),"roll"in t&&a.roll!==+t.roll&&(y=!0,a.setRoll(+t.roll)),t.padding==null||a.isPaddingEqual(t.padding)||a.setPadding(t.padding),this._applyUpdatedTransform(a),this.fire(new h.n("movestart",n)).fire(new h.n("move",n)),w&&this.fire(new h.n("zoomstart",n)).fire(new h.n("zoom",n)).fire(new h.n("zoomend",n)),c&&this.fire(new h.n("rotatestart",n)).fire(new h.n("rotate",n)).fire(new h.n("rotateend",n)),f&&this.fire(new h.n("pitchstart",n)).fire(new h.n("pitch",n)).fire(new h.n("pitchend",n)),y&&this.fire(new h.n("rollstart",n)).fire(new h.n("roll",n)).fire(new h.n("rollend",n)),this.fire(new h.n("moveend",n))}calculateCameraOptionsFromTo(t,n,a,c=0){const f=h.a7.fromLngLat(t,n),y=h.a7.fromLngLat(a,c),x=y.x-f.x,w=y.y-f.y,S=y.z-f.z,P=Math.hypot(x,w,S);if(P===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(x,w),C=h.ar(this.transform.cameraToCenterDistance/P/this.transform.tileSize),z=180*Math.atan2(x,-w)/Math.PI;let O=180*Math.acos(E/P)/Math.PI;return O=S<0?90-O:90+O,{center:y.toLngLat(),elevation:c,zoom:C,pitch:O,bearing:z}}calculateCameraOptionsFromCameraLngLatAltRotation(t,n,a,c,f){const y=this.transform.calculateCenterFromCameraLngLatAlt(t,n,a,c);return{center:y.center,elevation:y.elevation,zoom:y.zoom,bearing:a,pitch:c,roll:f}}easeTo(t,n){this._stop(!1,t.easeId),"zoom"in(t=h.e({offset:[0,0],duration:500,easing:h.cy},t))&&this._zoomSnap&&(t.zoom=h.cw(t.zoom,this._zoomSnap)),(t.animate===!1||!t.essential&&Ze.prefersReducedMotion)&&(t.duration=0);const a=this._getTransformForUpdate(),c=this.getBearing(),f=a.pitch,y=a.roll,x="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:a.padding,E=h.P.convert(t.offset);let C,z;t.around&&(C=h.W.convert(t.around),z=a.locationToScreenPoint(C));const O={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},j=this.cameraHelper.handleEaseTo(a,{bearing:x,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!==x),this._pitching||(this._pitching=w!==f),this._rolling||(this._rolling=S!==y),this._padding=!a.isPaddingEqual(P),this._zooming||(this._zooming=j.isZooming),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,O),this.terrain&&this._prepareElevation(j.elevationCenter),this._ease(($=>{j.easeFunc($),this.terrain&&!t.freezeElevation&&this._updateElevation($),this._applyUpdatedTransform(a),this._fireMoveEvents(n)}),($=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,$)}),t),this}_prepareEase(t,n,a={}){this._moving=!0,n||a.moving||this.fire(new h.n("movestart",t)),this._zooming&&!a.zooming&&this.fire(new h.n("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new h.n("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new h.n("pitchstart",t)),this._rolling&&!a.rolling&&this.fire(new h.n("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 a=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(a-(n-(a*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.setElevation(h.H.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(),a=t.getCameraAltitude(),c=this.terrain?this.terrain.getElevationForLngLatZoom(n,t.zoom):0;if(a<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 a=t.clone();for(const c of n){const f=a.clone(),{center:y,zoom:x,roll:w,pitch:S,bearing:P,elevation:E}=c(f);y&&f.setCenter(y),E!==void 0&&f.setElevation(E),x!==void 0&&f.setZoom(x),w!==void 0&&f.setRoll(w),S!==void 0&&f.setPitch(S),P!==void 0&&f.setBearing(P),a.apply(f,!1)}this.transform.apply(a,!1)}_fireMoveEvents(t){this.fire(new h.n("move",t)),this._zooming&&this.fire(new h.n("zoom",t)),this._rotating&&this.fire(new h.n("rotate",t)),this._pitching&&this.fire(new h.n("pitch",t)),this._rolling&&this.fire(new h.n("roll",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const a=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,a&&this.fire(new h.n("zoomend",t)),c&&this.fire(new h.n("rotateend",t)),f&&this.fire(new h.n("pitchend",t)),y&&this.fire(new h.n("rollend",t)),this.fire(new h.n("moveend",t))}flyTo(t,n){if(!t.essential&&Ze.prefersReducedMotion){const ye=h.V(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(ye,n)}this.stop(),"zoom"in(t=h.e({offset:[0,0],speed:1.2,curve:1.42,easing:h.cy},t))&&this._zoomSnap&&(t.zoom=h.cw(t.zoom,this._zoomSnap));const a=this._getTransformForUpdate(),c=a.bearing,f=a.pitch,y=a.roll,x=a.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:a.padding,C=h.P.convert(t.offset);let z=a.centerPoint.add(C);const O=a.screenPointToLocation(z),j=this.cameraHelper.handleFlyTo(a,{bearing:w,pitch:S,roll:P,padding:E,locationAtOffset:O,offsetAsPoint:C,center:t.center,minZoom:t.minZoom,zoom:t.zoom});let $=t.curve;const U=Math.max(a.width,a.height),q=U/j.scaleOfZoom,Y=j.pixelPathLength;typeof j.scaleOfMinZoom=="number"&&($=Math.sqrt(U/j.scaleOfMinZoom/Y*2));const Z=$*$;function G(ye){const ze=(q*q-U*U+(ye?-1:1)*Z*Z*Y*Y)/(2*(ye?q:U)*Z*Y);return Math.log(Math.sqrt(ze*ze+1)-ze)}function X(ye){return(Math.exp(ye)-Math.exp(-ye))/2}function W(ye){return(Math.exp(ye)+Math.exp(-ye))/2}const ee=G(!1);let ue=function(ye){return W(ee)/W(ee+$*ye)},oe=function(ye){return U*((W(ee)*(X(ze=ee+$*ye)/W(ze))-X(ee))/Z)/Y;var ze},_e=(G(!0)-ee)/$;if(Math.abs(Y)<2e-6||!isFinite(_e)){if(Math.abs(U-q)<1e-6)return this.easeTo(t,n);const ye=q<U?-1:1;_e=Math.abs(Math.log(q/U))/$,oe=()=>0,ue=ze=>Math.exp(ye*$*ze)}return t.duration="duration"in t?+t.duration:1e3*_e/("screenSpeed"in t?+t.screenSpeed/$:+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=!a.isPaddingEqual(E),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(j.targetCenter),this._ease((ye=>{const ze=ye*_e,Ie=1/ue(ze),me=oe(ze);this._rotating&&a.setBearing(h.H.number(c,w,ye)),this._pitching&&a.setPitch(h.H.number(f,S,ye)),this._rolling&&a.setRoll(h.H.number(y,P,ye)),this._padding&&(a.interpolatePadding(x,E,ye),z=a.centerPoint.add(C)),j.easeFunc(ye,Ie,me,z),this.terrain&&!t.freezeElevation&&this._updateElevation(ye),this._applyUpdatedTransform(a),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 a;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||(a=this.handlers)===null||a===void 0||a.stop(!1),this}_ease(t,n,a){a.animate===!1||a.duration===0?(t(1),n()):(this._easeStart=je(),this._easeOptions=a,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=h.X(t,-180,180);const a=Math.abs(t-n);return Math.abs(t-360-n)<a&&(t-=360),Math.abs(t+360-n)<a&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(h.W.convert(t),this.transform):null}}const as={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class bt{constructor(t=as){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=we.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=we.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=we.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 a=this._map._getUIString(`AttributionControl.${n}`);t.title=a,t.setAttribute("aria-label",a)}_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.includes(y.attribution)&&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].includes(c))return!1;return!0}));const a=t.join(" | ");if(a!==this._attribHTML){if(this._attribHTML=a,t.length){const c=document.createDocumentFragment();let f=!0;for(const y of t){const x=we.sanitize(y);x.hasChildNodes()&&(f||c.append(" | "),c.append(x),f=!1)}this._innerContainer.replaceChildren(c),this._container.classList.remove("maplibregl-attrib-empty")}else this._container.classList.add("maplibregl-attrib-empty");this._updateCompact(),this._editLink=null}}}class At{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const a=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&a.classList.add("maplibregl-compact"):a.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){var n;this._map=t,this._compact=(n=this.options)===null||n===void 0?void 0:n.compact,this._container=we.create("div","maplibregl-ctrl");const a=we.create("a","maplibregl-ctrl-logo");return a.target="_blank",a.rel="noopener nofollow",a.href="https://maplibre.org/",a.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),a.setAttribute("rel","noopener nofollow"),this._container.appendChild(a),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 mu{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,a=n?this._queue.concat(n):this._queue;for(const c of a)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 a of n)if(!a.cancelled&&(a.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var to=h.aS([{name:"a_pos3d",type:"Int16",components:3}]);class va extends h.E{constructor(t){super(),this._lastTilesetChange=je(),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 a={};for(const c of cn(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n,calculateTileZoom:this.tileManager._source.calculateTileZoom}))a[c.key]=!0,this._renderableTilesKeys.push(c.key),this._tiles[c.key]||(c.terrainRttPosMatrix32f=new Float64Array(16),h.c7(c.terrainRttPosMatrix32f,0,h.a6,h.a6,0,0,1),this._tiles[c.key]=new wo(c,this.tileSize),this._lastTilesetChange=je());for(const c in this._tiles)a[c]||delete this._tiles[c]}freeRtt(t){for(const n in this._tiles){const a=this._tiles[n];(!t||a.tileID.equals(t)||a.tileID.isChildOf(t)||t.isChildOf(a.tileID))&&(a.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 a of this._renderableTilesKeys){const c=this._tiles[a].tileID,f=t.clone(),y=h.bj();if(c.canonical.equals(t.canonical))h.c7(y,0,h.a6,h.a6,0,0,1);else if(c.canonical.isChildOf(t.canonical)){const x=c.canonical.z-t.canonical.z,w=c.canonical.x-(c.canonical.x>>x<<x),S=c.canonical.y-(c.canonical.y>>x<<x),P=h.a6>>x;h.c7(y,0,P,P,0,0,1),h.Q(y,y,[-w*P,-S*P,0])}else{if(!t.canonical.isChildOf(c.canonical))continue;{const x=t.canonical.z-c.canonical.z,w=t.canonical.x-(t.canonical.x>>x<<x),S=t.canonical.y-(t.canonical.y>>x<<x),P=h.a6>>x;h.c7(y,0,h.a6,h.a6,0,0,1),h.Q(y,y,[w*P,S*P,0]),h.S(y,y,[1/2**x,1/2**x,0])}}f.terrainRttPosMatrix32f=new Float32Array(y),n[a]=f}return n}_getTerrainCoordsForTileRanges(t,n){const a={};for(const c of this._renderableTilesKeys){const f=this._tiles[c].tileID;if(!this._isWithinTileRanges(f,n))continue;const y=t.clone(),x=h.bj();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;h.c7(x,0,h.a6,h.a6,0,0,1),h.Q(x,x,[w*h.a6,S*h.a6,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=h.a6>>w;h.c7(x,0,z,z,0,0,1),h.Q(x,x,[-S*z+E*h.a6,-P*z+C*h.a6,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=h.a6<<w;h.c7(x,0,z,z,0,0,1),h.Q(x,x,[S*h.a6+E*z,P*h.a6+C*z,0])}y.terrainRttPosMatrix32f=new Float32Array(x),a[c]=y}return a}getSourceTile(t,n){var a,c;const f=this.tileManager._source;let y=t.overscaledZ-this.deltaZoom;if(y>f.maxzoom&&(y=f.maxzoom),y<f.minzoom)return;(a=this._sourceTileCache)[c=t.key]||(a[c]=t.scaledTo(y).key);let x=this.findTileInCaches(this._sourceTileCache[t.key]);if(!x?.dem&&n)for(;y>=f.minzoom&&!x?.dem;)x=this.findTileInCaches(t.scaledTo(y--).key);return x}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 a=n[t.canonical.z];return!!a&&(t.wrap>a.minWrap||t.wrap<a.maxWrap||t.canonical.x>=a.minTileXWrapped&&t.canonical.x<=a.maxTileXWrapped&&t.canonical.y>=a.minTileY&&t.canonical.y<=a.maxTileY)}}class ql{constructor(t,n,a){this._meshCache={},this.painter=t,this.tileManager=new va(n),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.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,a,c=h.a6){var f;const y=t.normalizeCoordinates(n,a,c);if(!y)return 0;const x=this.getTerrainData(y.tileID),w=(f=x.tile)===null||f===void 0?void 0:f.dem;if(!w)return 0;const S=h.cC([],[y.x/c*h.a6,y.y/c*h.a6],x.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,O=P[1]-C;return w.get(E,C)*(1-z)*(1-O)+w.get(E+1,C)*z*(1-O)+w.get(E,C+1)*(1-z)*O+w.get(E+1,C+1)*z*O}getElevationForLngLatZoom(t,n){if(!h.cD(n,t.wrap()))return 0;const{tileID:a,mercatorX:c,mercatorY:f}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(a,c%h.a6,f%h.a6,h.a6)}getElevationForLngLat(t,n){const a=cn(n,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this});let c=0;for(const f of a)f.canonical.z>c&&(c=Math.min(f.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,c)}getElevation(t,n,a,c=h.a6){return this.getDEMElevation(t,n,a,c)*this.exaggeration}getTerrainData(t){var n,a;if(!this._emptyDemTexture){const y=this.painter.context,x=new h.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new h.T(y,x,y.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new h.T(y,new h.R({width:1,height:1}),y.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(y.gl.NEAREST,y.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=h.ap([])}const c=this.tileManager.getSourceTile(t,!0);if(c?.dem&&(!c.demTexture||c.needsTerrainPrepare)){const y=this.painter.context;c.demTexture=this.painter.getTileTexture(c.dem.stride),c.demTexture?c.demTexture.update(c.dem.getPixels(),{premultiply:!1}):c.demTexture=new h.T(y,c.dem.getPixels(),y.gl.RGBA,{premultiply:!1}),c.demTexture.bind(y.gl.NEAREST,y.gl.CLAMP_TO_EDGE),c.needsTerrainPrepare=!1}const f=c&&c.toString()+c.tileID.key+t.key;if(f&&!this._demMatrixCache[f]){const y=this.tileManager.getSource().maxzoom;let x=t.canonical.z-c.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=y?x=t.canonical.z-y:h.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const w=t.canonical.x-(t.canonical.x>>x<<x),S=t.canonical.y-(t.canonical.y>>x<<x),P=h.cE(new Float64Array(16),[1/(h.a6<<x),1/(h.a6<<x),0]);h.Q(P,P,[w*h.a6,S*h.a6,0]),this._demMatrixCache[f]={matrix:P,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:((n=c?.dem)===null||n===void 0?void 0:n.dim)||1,u_terrain_matrix:f?this._demMatrixCache[f].matrix:this._emptyDemMatrix,u_terrain_unpack:((a=c?.dem)===null||a===void 0?void 0:a.getUnpackVector())||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(c?.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:c}}getFramebuffer(t){const n=this.painter,a=n.width/devicePixelRatio,c=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===a&&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 h.T(n.context,{width:a,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 h.T(n.context,{width:a,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(a,c,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,a,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 x=0;x<this._coordsTextureSize;x++,y+=4)n[y+0]=255&x,n[y+1]=255&f,n[y+2]=x>>8<<4|f>>8,n[y+3]=0;const a=new h.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),c=new h.T(t,a,t.gl.RGBA,{premultiply:!1});return c.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=c,c}pointCoordinate(t){this.painter.maybeDrawDepth(!0),this.painter.maybeDrawCoords();const n=new Uint8Array(4),a=this.painter.context,c=a.gl,f=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),y=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),x=Math.round(this.painter.height/devicePixelRatio);a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),c.readPixels(f,x-y-1,1,1,c.RGBA,c.UNSIGNED_BYTE,n),a.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 h.a7((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),a=this.painter.context,c=a.gl;return a.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),a.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(t){var n;const a=((n=this.painter.style.projection)===null||n===void 0?void 0:n.transitionState)>0,c=a&&t.canonical.y===0,f=a&&t.canonical.y===(1<<t.canonical.z)-1,y=`m_${c?"n":""}_${f?"s":""}`;if(this._meshCache[y])return this._meshCache[y];const x=this.painter.context,w=new h.cF,S=new h.aW,P=this.meshSize,E=h.a6/P,C=P*P;for(let W=0;W<=P;W++)for(let ee=0;ee<=P;ee++)w.emplaceBack(ee*E,W*E,0);for(let W=0;W<C;W+=P+1)for(let ee=0;ee<P;ee++)S.emplaceBack(ee+W,P+ee+W+1,P+ee+W+2),S.emplaceBack(ee+W,P+ee+W+2,ee+W+1);const z=w.length,O=z+(P+1),j=(P+1)*P,$=c?h.bq:0,U=c?0:1,q=f?h.br:h.a6,Y=f?0:1;for(let W=0;W<=P;W++)w.emplaceBack(W*E,$,U);for(let W=0;W<=P;W++)w.emplaceBack(W*E,q,Y);for(let W=0;W<P;W++)S.emplaceBack(j+W,O+W,O+W+1),S.emplaceBack(j+W,O+W+1,j+W+1),S.emplaceBack(0+W,z+W+1,z+W),S.emplaceBack(0+W,0+W+1,z+W+1);const Z=w.length,G=Z+2*(P+1);for(const W of[0,1])for(let ee=0;ee<=P;ee++)for(const ue of[0,1])w.emplaceBack(W*h.a6,ee*E,ue);for(let W=0;W<2*P;W+=2)S.emplaceBack(Z+W,Z+W+1,Z+W+3),S.emplaceBack(Z+W,Z+W+3,Z+W+2),S.emplaceBack(G+W,G+W+3,G+W+1),S.emplaceBack(G+W,G+W+2,G+W+3);const X=new yr(x.createVertexBuffer(w,to.members),x.createIndexBuffer(S),h.aV.simpleSegment(0,0,w.length,S.length));return this._meshCache[y]=X,X}getMeshFrameDelta(t){return 2*Math.PI*h.bD/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,n){var a;if(!h.cD(n,t.wrap()))return 0;const{tileID:c}=this._getOverscaledTileIDFromLngLatZoom(t,n);return(a=this.getMinMaxElevation(c).minElevation)!==null&&a!==void 0?a:0}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,a={minElevation:null,maxElevation:null};return n?.dem&&(a.minElevation=n.dem.min*this.exaggeration,a.maxElevation=n.dem.max*this.exaggeration),a}_getOverscaledTileIDFromLngLatZoom(t,n){const a=h.a7.fromLngLat(t.wrap()),c=(1<<n)*h.a6,f=a.x*c,y=a.y*c,x=Math.floor(f/h.a6),w=Math.floor(y/h.a6);return{tileID:new h.a3(n,0,n,x,w),mercatorX:f,mercatorY:y}}}class Wl{constructor(t,n,a){this._context=t,this._size=n,this._tileSize=a,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),a=new h.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return a.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(a.texture),{id:t,fbo:n,texture:a,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 Yr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class io{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new Wl(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 a,c,f;this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter((y=>!t._layers[y].isHidden(n))),this._coordsAscending={};for(const y in t.tileManagers){this._coordsAscending[y]={};const x=t.tileManagers[y].getVisibleCoordinates(),w=t.tileManagers[y].getSource(),S=w instanceof an?w.terrainTileRanges:null;for(const P of x){const E=this.terrain.tileManager.getTerrainCoords(P,S);for(const C in E)(f=this._coordsAscending[y])[C]||(f[C]=[]),this._coordsAscending[y][C].push(E[C])}}this._rttFingerprints={};for(const y of t._order){const x=t._layers[y],w=x.source;if(Yr[x.type]&&!this._rttFingerprints[w]){this._rttFingerprints[w]={};const S=(c=(a=t.tileManagers[w])===null||a===void 0?void 0:a.getState().revision)!==null&&c!==void 0?c:0;for(const P in this._coordsAscending[w])this._rttFingerprints[w][P]=`${this._coordsAscending[w][P].map((E=>E.key)).sort().join()}#${S}`}}for(const y of this._renderableTiles)for(const x in this._rttFingerprints){const w=this._rttFingerprints[x][y.tileID.key];w&&w!==y.rttFingerprint[x]&&(y.rtt=[])}}renderLayer(t,n){if(t.isHidden(this.painter.transform.zoom))return!1;const a=Object.assign(Object.assign({},n),{isRenderingToTexture:!0}),c=t.type,f=this.painter,y=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Yr[c]&&(this._prevType&&Yr[this._prevType]||this._stacks.push([]),this._prevType=c,this._stacks[this._stacks.length-1].push(t.id),!y))return!0;if(Yr[this._prevType]||Yr[c]&&y){this._prevType=c;const x=this._stacks.length-1,w=this._stacks[x]||[];for(const S of this._renderableTiles){if(this.pool.isFull()&&(Ol(this.painter,this.terrain,this._rttTiles,a),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(S),S.rtt[x]){const E=this.pool.getObjectForId(S.rtt[x].id);if(E.stamp===S.rtt[x].stamp){this.pool.useObject(E);continue}}const P=this.pool.getOrCreateFreeObject();this.pool.useObject(P),this.pool.stampObject(P),S.rtt[x]={id:P.id,stamp:P.stamp},f.context.bindFramebuffer.set(P.fbo.framebuffer),f.context.clear({color:h.bo.transparent,stencil:0}),f.currentStencilSource=void 0;for(const E of w){const C=f.style._layers[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,a),C.source&&(S.rttFingerprint[C.source]=this._rttFingerprints[C.source][S.tileID.key])}}return Ol(this.painter,this.terrain,this._rttTiles,a),this._rttTiles=[],this.pool.freeAllObjects(),Yr[c]}return!1}}const Hl={"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"},Xl=fe,xa={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:as,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:h.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 ba=class extends bh{get _ownerWindow(){var d,t;return((t=(d=this._container)===null||d===void 0?void 0:d.ownerDocument)===null||t===void 0?void 0:t.defaultView)||window}constructor(d){var t,n,a;const c=Object.assign(Object.assign(Object.assign({},xa),d),{canvasContextAttributes:Object.assign(Object.assign({},xa.canvasContextAttributes),d.canvasContextAttributes)});if(c.minZoom!=null&&c.maxZoom!=null&&c.minZoom>c.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(c.minPitch!=null&&c.maxPitch!=null&&c.minPitch>c.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(c.minPitch!=null&&c.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(c.maxPitch!=null&&c.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const f=new Mr,y=new qn;c.minZoom!==void 0&&f.setMinZoom(c.minZoom),c.maxZoom!==void 0&&f.setMaxZoom(c.maxZoom),c.minPitch!==void 0&&f.setMinPitch(c.minPitch),c.maxPitch!==void 0&&f.setMaxPitch(c.maxPitch),c.renderWorldCopies!==void 0&&f.setRenderWorldCopies(c.renderWorldCopies),c.transformConstrain!==null&&f.setConstrainOverride(c.transformConstrain),super(f,y,{bearingSnap:c.bearingSnap,zoomSnap:c.zoomSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new mu,this._controls=[],this._mapId=h.ad(),this._lostContextStyle={style:null,images:null},this._contextLost=w=>{if(w.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(const S of Object.values(this.style._layers))if(S.type==="custom"&&console.warn(`Custom layer with id '${S.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),S._listeners)for(const[P]of Object.entries(S._listeners))console.warn(`Custom layer with id '${S.id}' had event listeners for event '${P}' 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 h.n("webglcontextlost",{originalEvent:w}))}else this.fire(new h.n("webglcontextlost",{originalEvent:w}))},this._contextRestored=w=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new h.n("webglcontextrestored",{originalEvent:w}))},this._onMapScroll=w=>{if(w.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=c.interactive,this._maxTileCacheSize=c.maxTileCacheSize,this._maxTileCacheZoomLevels=c.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},c.canvasContextAttributes),this._trackResize=c.trackResize===!0,this._bearingSnap=c.bearingSnap,this._zoomSnap=c.zoomSnap,this._centerClampedToGround=c.centerClampedToGround,this._refreshExpiredTiles=c.refreshExpiredTiles===!0,this._fadeDuration=c.fadeDuration,this._crossSourceCollisions=c.crossSourceCollisions===!0,this._collectResourceTiming=c.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Hl),c.locale),this._clickTolerance=c.clickTolerance,this._overridePixelRatio=c.pixelRatio,this._maxCanvasSize=c.maxCanvasSize,this._zoomLevelsToOverscale=c.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=c.transformCameraUpdate,this.transformConstrain=c.transformConstrain,this.cancelPendingTileRequestsWhileZooming=c.cancelPendingTileRequestsWhileZooming===!0,this.setAnisotropicFilterPitch(c.anisotropicFilterPitch),c.reduceMotion!==void 0&&(Ze.prefersReducedMotion=c.reduceMotion),this._imageQueueHandle=Ye.addThrottleControl((()=>this.isMoving())),this._requestManager=new H(c.transformRequest),this._container=this._resolveContainer(c.container),c.maxBounds&&this.setMaxBounds(c.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)})),this.once("idle",(()=>this._idleTriggered=!0)),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver()),this.handlers=new xh(this,c),this._hash=c.hash?new ou(typeof c.hash=="string"&&c.hash||void 0).addTo(this):void 0,!((t=this._hash)===null||t===void 0)&&t._onHashChange()||(this.jumpTo({center:c.center,elevation:c.elevation,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch,roll:c.roll}),c.bounds&&(this.resize(),this.fitBounds(c.bounds,h.e({},c.fitBoundsOptions,{duration:0}))));const x=typeof c.style=="string"||((a=(n=c.style)===null||n===void 0?void 0:n.projection)===null||a===void 0?void 0:a.type)!=="globe";this.resize(null,x),this._localIdeographFontFamily=c.localIdeographFontFamily,this._validateStyle=c.validateStyle,c.style&&this.setStyle(c.style,{localIdeographFontFamily:c.localIdeographFontFamily}),c.attributionControl&&this.addControl(new bt(typeof c.attributionControl=="boolean"?void 0:c.attributionControl)),c.maplibreLogo&&this.addControl(new At,c.logoPosition),this.on("style.load",(()=>{if(x||this._resizeTransform(),this.transform.unmodified){const w=h.V(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(w)}})),this.on("data",(w=>{this._update(w.dataType==="style"),this.fire(new h.n(`${w.dataType}data`,w))})),this.on("dataloading",(w=>{this.fire(new h.n(`${w.dataType}dataloading`,w))})),this.on("dataabort",(w=>{this.fire(new h.n("sourcedataabort",w))}))}_getMapId(){return this._mapId}setGlobalStateProperty(d,t){return this.style.setGlobalStateProperty(d,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(d,t){if(t===void 0&&(t=d.getDefaultPosition?d.getDefaultPosition():"top-right"),!d?.onAdd)return this.fire(new h.l(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=d.onAdd(this);this._controls.push(d);const a=this._controlPositions[t];return t.includes("bottom")?a.insertBefore(n,a.firstChild):a.appendChild(n),this}removeControl(d){if(!d?.onRemove)return this.fire(new h.l(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(d);return t>-1&&this._controls.splice(t,1),d.onRemove(this),this}hasControl(d){return this._controls.includes(d)}coveringTiles(d){return cn(this.transform,d)}calculateCameraOptionsFromTo(d,t,n,a){return a==null&&this.terrain&&(a=this.terrain.getElevationForLngLat(n,this.transform)),super.calculateCameraOptionsFromTo(d,t,n,a)}resize(d,t=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t);const n=!this._moving;return n&&(this.stop(),this.fire(new h.n("movestart",d)).fire(new h.n("move",d))),this.fire(new h.n("resize",d)),n&&this.fire(new h.n("moveend",d)),this}_resizeInternal(d=!0){const[t,n]=this._containerDimensions(),a=this._getClampedPixelRatio(t,n);if(this._resizeCanvas(t,n,a),this.painter.resize(t,n,a),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(d)}_resizeTransform(d=!0){var t;const[n,a]=this._containerDimensions();this.transform.resize(n,a,d),(t=this._requestedCameraState)===null||t===void 0||t.resize(n,a,d)}_getClampedPixelRatio(d,t){const{0:n,1:a}=this._maxCanvasSize,c=this.getPixelRatio(),f=d*c,y=t*c;return Math.min(f>n?n/f:1,y>a?a/y:1)*c}getPixelRatio(){var d;return(d=this._overridePixelRatio)!==null&&d!==void 0?d:devicePixelRatio}setPixelRatio(d){this._overridePixelRatio=d,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(d){return this.transform.setMaxBounds(xt.convert(d)),this._update()}setMinZoom(d){if((d=d??-2)>=-2&&d<=this.transform.maxZoom){const t=this.transform.zoom,n=this._getTransformForUpdate();return n.setMinZoom(d),this._applyUpdatedTransform(n),this._update(),t!==this.transform.zoom&&this.fire(new h.n("zoomstart")).fire(new h.n("zoom")).fire(new h.n("zoomend")).fire(new h.n("movestart")).fire(new h.n("move")).fire(new h.n("moveend")),this}throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(d){if((d=d??22)>=this.transform.minZoom){const t=this.transform.zoom,n=this._getTransformForUpdate();return n.setMaxZoom(d),this._applyUpdatedTransform(n),this._update(),t!==this.transform.zoom&&this.fire(new h.n("zoomstart")).fire(new h.n("zoom")).fire(new h.n("zoomend")).fire(new h.n("movestart")).fire(new h.n("move")).fire(new h.n("moveend")),this}throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(d){if((d=d??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(d>=0&&d<=this.transform.maxPitch){const t=this.transform.pitch,n=this._getTransformForUpdate();return n.setMinPitch(d),this._applyUpdatedTransform(n),this._update(),t!==this.transform.pitch&&this.fire(new h.n("pitchstart")).fire(new h.n("pitch")).fire(new h.n("pitchend")).fire(new h.n("movestart")).fire(new h.n("move")).fire(new h.n("moveend")),this}throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(d){if((d=d??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(d>=this.transform.minPitch){const t=this.transform.pitch,n=this._getTransformForUpdate();return n.setMaxPitch(d),this._applyUpdatedTransform(n),this._update(),t!==this.transform.pitch&&this.fire(new h.n("pitchstart")).fire(new h.n("pitch")).fire(new h.n("pitchend")).fire(new h.n("movestart")).fire(new h.n("move")).fire(new h.n("moveend")),this}throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(d){if((d=d??20)>180)throw new Error("anisotropicFilterPitch must be less than or equal to 180");if(d<0)throw new Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=d,this._update()}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(d){return this.transform.setRenderWorldCopies(d),this._update()}setTransformConstrain(d){return this.transform.setConstrainOverride(d),this._update()}project(d){return this.transform.locationToScreenPoint(h.W.convert(d),this.style&&this.terrain)}unproject(d){return this.transform.screenPointToLocation(h.P.convert(d),this.terrain)}isMoving(){var d;return this._moving||((d=this.handlers)===null||d===void 0?void 0:d.isMoving())}isZooming(){var d;return this._zooming||((d=this.handlers)===null||d===void 0?void 0:d.isZooming())}isRotating(){var d;return this._rotating||((d=this.handlers)===null||d===void 0?void 0:d.isRotating())}_createDelegatedListener(d,t,n){if(d==="mouseenter"||d==="mouseover"){let a=!1;return{layers:t,listener:n,delegates:{mousemove:f=>{const y=t.filter((w=>this.getLayer(w))),x=y.length!==0?this.queryRenderedFeatures(f.point,{layers:y}):[];x.length?a||(a=!0,n.call(this,new jt(d,this,f.originalEvent,{features:x}))):a=!1},mouseout:()=>{a=!1}}}}if(d==="mouseleave"||d==="mouseout"){let a=!1;return{layers:t,listener:n,delegates:{mousemove:y=>{const x=t.filter((w=>this.getLayer(w)));(x.length!==0?this.queryRenderedFeatures(y.point,{layers:x}):[]).length?a=!0:a&&(a=!1,n.call(this,new jt(d,this,y.originalEvent)))},mouseout:y=>{a&&(a=!1,n.call(this,new jt(d,this,y.originalEvent)))}}}}{const a=c=>{const f=t.filter((x=>this.getLayer(x))),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:{[d]:a}}}}_saveDelegatedListener(d,t){var n;this._delegatedListeners||(this._delegatedListeners={}),(n=this._delegatedListeners)[d]||(n[d]=[]),this._delegatedListeners[d].push(t)}_removeDelegatedListener(d,t,n){var a;if(!(!((a=this._delegatedListeners)===null||a===void 0)&&a[d]))return;const c=this._delegatedListeners[d];for(let f=0;f<c.length;f++){const y=c[f];if(y.listener===n&&y.layers.length===t.length&&y.layers.every((x=>t.includes(x)))){for(const x in y.delegates)this.off(x,y.delegates[x]);return void c.splice(f,1)}}}on(d,t,n){if(n===void 0)return super.on(d,t);const a=typeof t=="string"?[t]:t,c=this._createDelegatedListener(d,a,n);this._saveDelegatedListener(d,c);for(const f in c.delegates)this.on(f,c.delegates[f]);return{unsubscribe:()=>{this._removeDelegatedListener(d,a,n)}}}once(d,t,n){if(n===void 0)return super.once(d,t);const a=typeof t=="string"?[t]:t,c=this._createDelegatedListener(d,a,n);for(const f in c.delegates){const y=c.delegates[f];c.delegates[f]=(...x)=>{this._removeDelegatedListener(d,a,n),y(...x)}}this._saveDelegatedListener(d,c);for(const f in c.delegates)this.once(f,c.delegates[f]);return this}off(d,t,n){return n===void 0?super.off(d,t):(this._removeDelegatedListener(d,typeof t=="string"?[t]:t,n),this)}queryRenderedFeatures(d,t){if(!this.style)return[];let n;const a=d instanceof h.P||Array.isArray(d),c=a?d:[[0,0],[this.transform.width,this.transform.height]];if(t||(t=(a?{}:d)||{}),c instanceof h.P||typeof c[0]=="number")n=[h.P.convert(c)];else{const f=h.P.convert(c[0]),y=h.P.convert(c[1]);n=[f,new h.P(y.x,f.y),y,new h.P(f.x,y.y),f]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(d,t){return this.style.querySourceFeatures(d,t)}setStyle(d,t){return(t=h.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&d?(this._diffStyle(d,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(d,t))}setTransformRequest(d){return this._requestManager.setTransformRequest(d),this}_getUIString(d){const t=this._locale[d];if(t==null)throw new Error(`Missing UI string '${d}'`);return t}_updateStyle(d,t){var n,a,c;if((n=this._diffStyleRequest)===null||n===void 0||n.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(d,t)));const f=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!d)),d?(this.style=new ml(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof d=="string"?this.style.loadURL(d,t,f):this.style.loadJSON(d,t,f),this):(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),(c=(a=this.style)===null||a===void 0?void 0:a.projection)===null||c===void 0||c.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new ml(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(d,t){return h._(this,void 0,void 0,(function*(){var n;if((n=this._diffStyleRequest)===null||n===void 0||n.abort(),typeof d=="string"){const a=d;this._diffStyleRequest=new AbortController;const c=this._diffStyleRequest;try{const f=yield this._requestManager.transformRequest(a,"Style");if(c.signal.aborted)return void(this._diffStyleRequest=null);const y=yield h.k(f,c);this._diffStyleRequest=null,this._updateDiff(y.data,t)}catch(f){this._diffStyleRequest=null,h.$(f)||this.fire(new h.l(h.d(f)))}}else typeof d=="object"&&(this._diffStyleRequest=null,this._updateDiff(d,t))}))}_updateDiff(d,t){try{this.style.setState(d,t)&&this._update(!0)}catch(n){h.w(`Unable to perform style diff: ${h.d(n).message}. Rebuilding the style from scratch.`),this._updateStyle(d,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(){if(this.style)return this.style.loaded();h.w("There is no style added to the map.")}addSource(d,t){return this._lazyInitEmptyStyle(),this.style.addSource(d,t),this._update(!0)}isSourceLoaded(d){var t;const n=(t=this.style)===null||t===void 0?void 0:t.tileManagers[d];if(n!==void 0)return n.loaded();this.fire(new h.l(new Error(`There is no tile manager with ID '${d}'`)))}setTerrain(d){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),d){const t=this.style.tileManagers[d.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${d.source}`);this.terrain===null&&t.reload();for(const n in this.style._layers){const a=this.style._layers[n];a.type==="hillshade"&&a.source===d.source&&h.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."),a.type==="color-relief"&&a.source===d.source&&h.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 ql(this.painter,t,d),this.painter.renderToTexture=new io(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 a;n.dataType==="style"?this.terrain.tileManager.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==d.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))),((a=n.source)===null||a===void 0?void 0:a.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 h.n("terrain",{terrain:d})),this}getTerrain(){var d,t;return(t=(d=this.terrain)===null||d===void 0?void 0:d.options)!==null&&t!==void 0?t:null}areTilesLoaded(){var d;const t=(d=this.style)===null||d===void 0?void 0:d.tileManagers;for(const n of Object.values(t))if(!n.areTilesLoaded())return!1;return!0}removeSource(d){return this.style.removeSource(d),this._update(!0)}getSource(d){return this.style.getSource(d)}setSourceTileLodParams(d,t,n){if(n){const a=this.getSource(n);if(!a)throw new Error(`There is no source with ID "${n}", cannot set LOD parameters`);a.calculateTileZoom=rl(Math.max(1,d),Math.max(1,t))}else for(const a in this.style.tileManagers)this.style.tileManagers[a].getSource().calculateTileZoom=rl(Math.max(1,d),Math.max(1,t));return this._update(!0),this}refreshTiles(d,t){const n=this.style.tileManagers[d];if(!n)throw new Error(`There is no tile manager with ID "${d}", cannot refresh tile`);t===void 0?n.reload(!0):n.refreshTiles(t.map((a=>new h.aa(a.z,a.x,a.y))))}addImage(d,t,n={}){const{pixelRatio:a=1,sdf:c=!1,stretchX:f,stretchY:y,content:x,textFitWidth:w,textFitHeight:S}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||h.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new h.l(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(d,{data:new h.R({width:P,height:E},new Uint8Array(C)),pixelRatio:a,stretchX:f,stretchY:y,content:x,textFitWidth:w,textFitHeight:S,sdf:c,version:0,userImage:z}),z.onAdd&&z.onAdd(this,d),this}}{const{width:P,height:E,data:C}=Ze.getImageData(t);this.style.addImage(d,{data:new h.R({width:P,height:E},C),pixelRatio:a,stretchX:f,stretchY:y,content:x,textFitWidth:w,textFitHeight:S,sdf:c,version:0})}}updateImage(d,t){const n=this.style.getImage(d);if(!n)return this.fire(new h.l(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=t instanceof HTMLImageElement||h.b(t)?Ze.getImageData(t):t,{width:c,height:f,data:y}=a;if(c===void 0||f===void 0)return this.fire(new h.l(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 h.l(new Error("The width and height of the updated image must be that same as the previous version of the image")));const x=!(t instanceof HTMLImageElement||h.b(t));return n.data.replace(y,x),this.style.updateImage(d,n),this}getImage(d){return this.style.getImage(d)}hasImage(d){return d?!!this.style.getImage(d):(this.fire(new h.l(new Error("Missing required image id"))),!1)}removeImage(d){this.style.removeImage(d)}loadImage(d){return h._(this,void 0,void 0,(function*(){return Ye.getImage(yield this._requestManager.transformRequest(d,"Image"),new AbortController)}))}listImages(){return this.style.listImages()}addLayer(d,t){return this._lazyInitEmptyStyle(),this.style.addLayer(d,t),this._update(!0)}moveLayer(d,t){return this.style.moveLayer(d,t),this._update(!0)}removeLayer(d){return this.style.removeLayer(d),this._update(!0)}getLayer(d){return this.style.getLayer(d)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(d,t,n){return this.style.setLayerZoomRange(d,t,n),this._update(!0)}setFilter(d,t,n={}){return this.style.setFilter(d,t,n),this._update(!0)}getFilter(d){return this.style.getFilter(d)}setPaintProperty(d,t,n,a={}){return this.style.setPaintProperty(d,t,n,a),this._update(!0)}getPaintProperty(d,t){return this.style.getPaintProperty(d,t)}setLayoutProperty(d,t,n,a={}){return this.style.setLayoutProperty(d,t,n,a),this._update(!0)}getLayoutProperty(d,t){return this.style.getLayoutProperty(d,t)}setGlyphs(d,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(d,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(d,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(d,t,n,(a=>{a||this._update(!0)})),this}removeSprite(d){return this._lazyInitEmptyStyle(),this.style.removeSprite(d),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(d,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(d,t,(n=>{n||this._update(!0)})),this}setLight(d,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(d,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(d,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(d,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(d,t){return this.style.setFeatureState(d,t),this._update()}removeFeatureState(d,t){return this.style.removeFeatureState(d,t),this._update()}getFeatureState(d){return this.style.getFeatureState(d)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let d=0,t=0;return this._container&&(d=this._container.clientWidth||400,t=this._container.clientHeight||300),[d,t]}_setupResizeObserver(){var d;let t=!1;const n=tr((c=>{this._trackResize&&!this._removed&&(this.resize(c),this.redraw())}),50),a=(d=this._ownerWindow.ResizeObserver)!==null&&d!==void 0?d:ResizeObserver;this._resizeObserver=new a((c=>{t?n(c):t=!0})),this._resizeObserver.observe(this._container)}_resolveContainer(d){if(typeof d=="string"){const t=document.getElementById(d);if(!t)throw new Error(`Container '${d}' not found.`);return t}if(d instanceof HTMLElement||d&&typeof d=="object"&&d.nodeType===1)return d;throw new Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){const d=this._container;d.classList.add("maplibregl-map");const t=this._canvasContainer=we.create("div","maplibregl-canvas-container",d);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=we.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(),a=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],a);const c=this._controlContainer=we.create("div","maplibregl-control-container",d),f=this._controlPositions={};for(const y of["top-left","top-right","bottom-left","bottom-right"])f[y]=we.create("div",`maplibregl-ctrl-${y} `,c);this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(d,t,n){this._canvas.width=Math.floor(n*d),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${d}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const d=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let t=null;this._canvas.addEventListener("webglcontextcreationerror",(a=>{t={requestedAttributes:d},a&&(t.statusMessage=a.statusMessage,t.type=a.type)}),{once:!0});let n=null;if(n=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,d):this._canvas.getContext("webgl2",d)||this._canvas.getContext("webgl",d),!n){const a="Failed to initialize WebGL";throw t?(t.message=a,new Error(JSON.stringify(t))):new Error(a)}this.painter=new $s(n,this.transform)}migrateProjection(d,t){super.migrateProjection(d,t),this.painter.transform=d,this.fire(new h.n("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(d){var t;return!((t=this.style)===null||t===void 0)&&t._loaded?(this._styleDirty||(this._styleDirty=d),this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(d){return this._update(),this._renderTaskQueue.add(d)}_cancelRenderFrame(d){this._renderTaskQueue.remove(d)}_render(d){var t,n,a,c,f,y;const x=this._idleTriggered?this._fadeDuration:0,w=((t=this.style.projection)===null||t===void 0?void 0:t.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(d),this._removed)return;let S=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const C=this.transform.zoom,z=je();this.style.zoomHistory.update(C,z);const O=new h.J(C,{now:z,fadeDuration:x,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),j=O.crossFadingFactor();j===1&&j===this._crossFadingFactor||(S=!0,this._crossFadingFactor=j),this.style.update(O)}const P=((n=this.style.projection)===null||n===void 0?void 0:n.transitionState)>0!==w;(a=this.style.projection)===null||a===void 0||a.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||P)&&(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=(y=this.style)===null||y===void 0?void 0:y._updatePlacement(this.transform,this.showCollisionBoxes,x,this._crossSourceCollisions,P),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:x,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new h.n("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new h.n("load"))),this.style&&(this.style.hasTransitions()||S)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const E=this._sourcesDirty||this._styleDirty||this._placementDirty;return E||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new h.n("idle")),!this._loaded||this._fullyLoaded||E||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var d,t;this._hash&&this._hash.remove();for(const a of this._controls)a.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),(d=this._diffStyleRequest)===null||d===void 0||d.abort(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),Ye.removeThrottleControl(this._imageQueueHandle),(t=this._resizeObserver)===null||t===void 0||t.disconnect();const n=this.painter.context.gl.getExtension("WEBGL_lose_context");n?.loseContext&&n.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),this._removed=!0,this.fire(new h.n("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Ze.frame(this._frameRequest,(d=>{this._frameRequest=null;try{this._render(d)}catch(t){if(!h.$(t)&&!(function(n){return n.message===ra})(t))throw t}}),(()=>{}),this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(d){this._showTileBoundaries!==d&&(this._showTileBoundaries=d,this._update())}get showPadding(){return!!this._showPadding}set showPadding(d){this._showPadding!==d&&(this._showPadding=d,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(d){this._showCollisionBoxes!==d&&(this._showCollisionBoxes=d,d?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(d){this._showOverdrawInspector!==d&&(this._showOverdrawInspector=d,this._update())}get repaint(){return!!this._repaint}set repaint(d){this._repaint!==d&&(this._repaint=d,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(d){this._vertices=d,this._update()}get version(){return Xl}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(d){return this._lazyInitEmptyStyle(),this.style.setProjection(d),this._update(!0)}};const Yl={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Kl{constructor(t,n,a=!1){this.mousedown=f=>{this.startMove(f,we.mousePos(this.element,f)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=f=>{this.move(f,we.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=we.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=we.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 _h;this._rotatePitchHandler=new gn({clickTolerance:3,move:(f,y)=>{const x=n.getBoundingClientRect(),w=new h.P((x.bottom-x.top)/2,(x.right-x.left)/2);return{bearingDelta:h.cx(new h.P(f.x,y.y),y,w),pitchDelta:a?-.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),we.disableDrag()}move(t,n){const a=this.map,{bearingDelta:c,pitchDelta:f}=this._rotatePitchHandler.dragMove(t,n)||{};c&&a.setBearing(a.getBearing()+c),f&&a.setPitch(a.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(){we.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}}let Ar;function wa(d,t,n,a=!1){if(a||!n.getCoveringTilesDetailsProvider().allowWorldCopies())return d?.wrap();const c=new h.W(d.lng,d.lat);if(d=new h.W(d.lng,d.lat),t){const f=new h.W(d.lng-360,d.lat),y=new h.W(d.lng+360,d.lat),x=n.locationToScreenPoint(d).distSqr(t);n.locationToScreenPoint(f).distSqr(t)<x?d=f:n.locationToScreenPoint(y).distSqr(t)<x&&(d=y)}for(;Math.abs(d.lng-n.center.lng)>180;){const f=n.locationToScreenPoint(d);if(f.x>=0&&f.y>=0&&f.x<=n.width&&f.y<=n.height)break;d.lng>n.center.lng?d.lng-=360:d.lng+=360}return d.lng!==c.lng&&n.isPointOnMapSurface(n.locationToScreenPoint(d))?d:c}const ro={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 no(d,t,n){const a=d.classList;for(const c in ro)a.remove(`maplibregl-${n}-anchor-${c}`);a.add(`maplibregl-${n}-anchor-${t}`)}class so extends h.E{constructor(t){if(super(),this._onClick=n=>{this.fire(new h.n("click",{originalEvent:n}))},this._onKeyPress=n=>{n.code!=="Space"&&n.code!=="Enter"||this.togglePopup()},this._onMapClick=n=>{const a=n.originalEvent.target,c=this._element;this._popup&&(a===c||c.contains(a))&&this.togglePopup()},this._update=n=>{if(!this._map)return;const a=this._map.loaded()&&!this._map.isMoving();(n?.type==="terrain"||n?.type==="render"&&!a)&&this._map.once("render",this._update),this._lngLat=wa(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=`${ro[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${f} ${c}`,Ze.frameAsync(new AbortController,this._map._ownerWindow).then((()=>{this._updateOpacity(n?.type==="moveend")})).catch((()=>{}))},this._onMove=n=>{if(!this._isDragging){const a=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=a}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 h.n("dragstart"))),this.fire(new h.n("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 h.n("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?.anchor||"center",this._color=t?.color||"#3FB1CE",this._scale=t?.scale||1,this._draggable=t?.draggable||!1,this._clickTolerance=t?.clickTolerance||0,this._subpixelPositioning=t?.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t?.rotation||0,this._rotationAlignment=t?.rotationAlignment||"auto",this._pitchAlignment=t?.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t?.opacity,t?.opacityWhenCovered),t?.element)this._element=t.element,this._offset=h.P.convert(t?.offset||[0,0]);else{this._defaultMarker=!0,this._element=we.create("div");const n=we.createNS("http://www.w3.org/2000/svg","svg"),a=41,c=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${a}px`),n.setAttributeNS(null,"width",`${c}px`),n.setAttributeNS(null,"viewBox",`0 0 ${c} ${a}`);const f=we.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=we.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"fill-rule","nonzero");const x=we.createNS("http://www.w3.org/2000/svg","g");x.setAttributeNS(null,"transform","translate(3.0, 29.0)"),x.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 U of w){const q=we.createNS("http://www.w3.org/2000/svg","ellipse");q.setAttributeNS(null,"opacity","0.04"),q.setAttributeNS(null,"cx","10.5"),q.setAttributeNS(null,"cy","5.80029008"),q.setAttributeNS(null,"rx",U.rx),q.setAttributeNS(null,"ry",U.ry),x.appendChild(q)}const S=we.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"fill",this._color);const P=we.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=we.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const C=we.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=we.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"transform","translate(6.0, 7.0)"),z.setAttributeNS(null,"fill","#FFFFFF");const O=we.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");const j=we.createNS("http://www.w3.org/2000/svg","circle");j.setAttributeNS(null,"fill","#000000"),j.setAttributeNS(null,"opacity","0.25"),j.setAttributeNS(null,"cx","5.5"),j.setAttributeNS(null,"cy","5.5"),j.setAttributeNS(null,"r","5.4999962");const $=we.createNS("http://www.w3.org/2000/svg","circle");$.setAttributeNS(null,"fill","#FFFFFF"),$.setAttributeNS(null,"cx","5.5"),$.setAttributeNS(null,"cy","5.5"),$.setAttributeNS(null,"r","5.4999962"),O.appendChild(j),O.appendChild($),y.appendChild(x),y.appendChild(S),y.appendChild(E),y.appendChild(z),y.appendChild(O),n.appendChild(y),n.setAttributeNS(null,"height",a*this._scale+"px"),n.setAttributeNS(null,"width",c*this._scale+"px"),this._element.appendChild(n),this._offset=h.P.convert(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()})),no(this._element,this._anchor,"marker"),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=h.W.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,a;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,this._element.classList.toggle("maplibregl-marker-covered",f)))}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const y=this._map,x=y.terrain.depthAtPoint(this._pos),w=y.terrain.getElevationForLngLat(this._lngLat,y.transform);if(y.transform.lngLatToCameraDepth(this._lngLat,w)-x<.006)return this._element.style.opacity=this._opacity,void this._element.classList.remove("maplibregl-marker-covered");const S=-this._offset.y/y.transform.pixelsPerMeter,P=Math.sin(y.getPitch()*Math.PI/180)*S,E=y.terrain.depthAtPoint(new h.P(this._pos.x,this._pos.y-this._offset.y)),C=y.transform.lngLatToCameraDepth(this._lngLat,w+P)-E>.006;!((a=this._popup)===null||a===void 0)&&a.isOpen()&&C&&this._popup.remove(),this._element.style.opacity=C?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",C)}getOffset(){return this._offset}setOffset(t){return this._offset=h.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=String(t)),n!==void 0&&(this._opacityWhenCovered=String(n)),this._map&&this._updateOpacity(!0),this}}const Jl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let _n=0,yn=!1;const Ql={maxWidth:100,unit:"metric"};function Ta(d,t,n){const a=n?.maxWidth||100,c=d._container.clientHeight/2,f=d._container.clientWidth/2,y=d.unproject([f-a/2,c]),x=d.unproject([f+a/2,c]),w=Math.round(d.project(x).x-d.project(y).x),S=Math.min(a,w,d._container.clientWidth),P=y.distanceTo(x);if(n?.unit==="imperial"){const E=3.2808*P;E>5280?vn(t,S,E/5280,d._getUIString("ScaleControl.Miles")):vn(t,S,E,d._getUIString("ScaleControl.Feet"))}else n?.unit==="nautical"?vn(t,S,P/1852,d._getUIString("ScaleControl.NauticalMiles")):P>=1e3?vn(t,S,P/1e3,d._getUIString("ScaleControl.Kilometers")):vn(t,S,P,d._getUIString("ScaleControl.Meters"))}function vn(d,t,n,a){const c=(function(f){const y=Math.pow(10,`${Math.floor(f)}`.length-1);let x=f/y;return x=x>=10?10:x>=5?5:x>=3?3:x>=2?2:x>=1?1:(function(w){const S=Math.pow(10,Math.ceil(-Math.log(w)/Math.LN10));return Math.round(w*S)/S})(x),y*x})(n);d.style.width=t*(c/n)+"px",d.innerHTML=`${c}&nbsp;${a}`}const ec={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},gu=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function tc(d){if(d){if(typeof d=="number"){const t=Math.round(Math.abs(d)/Math.SQRT2);return{center:new h.P(0,0),top:new h.P(0,d),"top-left":new h.P(t,t),"top-right":new h.P(-t,t),bottom:new h.P(0,-d),"bottom-left":new h.P(t,-t),"bottom-right":new h.P(-t,-t),left:new h.P(d,0),right:new h.P(-d,0)}}if(d instanceof h.P||Array.isArray(d)){const t=h.P.convert(d);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:h.P.convert(d.center||[0,0]),top:h.P.convert(d.top||[0,0]),"top-left":h.P.convert(d["top-left"]||[0,0]),"top-right":h.P.convert(d["top-right"]||[0,0]),bottom:h.P.convert(d.bottom||[0,0]),"bottom-left":h.P.convert(d["bottom-left"]||[0,0]),"bottom-right":h.P.convert(d["bottom-right"]||[0,0]),left:h.P.convert(d.left||[0,0]),right:h.P.convert(d.right||[0,0])}}return tc(new h.P(0,0))}const _u=fe;k.AJAXError=h.cG,k.EXTENT=h.a6,k.Event=h.n,k.Evented=h.E,k.LngLat=h.W,k.MercatorCoordinate=h.a7,k.Point=h.P,k.addProtocol=h.cH,k.config=h.c,k.removeProtocol=h.cI,k.AttributionControl=bt,k.BoxZoomHandler=os,k.CanvasSource=bs,k.CooperativeGesturesHandler=ya,k.DoubleClickZoomHandler=Fe,k.DragPanHandler=eo,k.DragRotateHandler=mi,k.EdgeInsets=Pi,k.FullscreenControl=class extends h.E{constructor(d={}){var t;super(),this._onFullscreenChange=()=>{var n;let a=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;!((n=a?.shadowRoot)===null||n===void 0)&&n.fullscreenElement;)a=a.shadowRoot.fullscreenElement;a===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=(t=d.pseudo)!==null&&t!==void 0&&t,d?.container&&(d.container instanceof HTMLElement?this._container=d.container:h.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(d){return this._map=d,this._container||(this._container=this._map.getContainer()),this._controlContainer=we.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 d=this._fullscreenButton=we.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);we.create("span","maplibregl-ctrl-icon",d).setAttribute("aria-hidden","true"),d.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const d=this._getTitle();this._fullscreenButton.setAttribute("aria-label",d),this._fullscreenButton.title=d}_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 h.n("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new h.n("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()}},k.GeoJSONSource=xo,k.GeolocateControl=class extends h.E{constructor(d){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new h.n("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 h.n("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new h.W(t.coords.longitude,t.coords.latitude),a=t.coords.accuracy,c=this._map.getBearing(),f=h.e({bearing:c},this.options.fitBoundsOptions),y=xt.fromLngLat(n,a);this._map.fitBounds(y,f,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new h.W(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&&yn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new h.n("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 h.n("trackuserlocationend")),this.fire(new h.n("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(t=>{t.preventDefault()})),this._geolocateButton=we.create("button","maplibregl-ctrl-geolocate",this._container),we.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){h.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=we.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new so({element:this._dotElement}),this._circleElement=we.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new so({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=h.e({},Jl,d)}onAdd(d){return this._map=d,this._container=we.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return h._(this,arguments,void 0,(function*(t=!1){if(Ar!==void 0&&!t)return Ar;if(window.navigator.permissions===void 0)return Ar=!!window.navigator.geolocation,Ar;try{Ar=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Ar=!!window.navigator.geolocation}return Ar}))})().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,_n=0,yn=!1}_isOutOfMapMaxBounds(d){const t=this._map.getMaxBounds(),n=d.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 d=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&d))return;const t=this._map.project(d),n=this._map.unproject([t.x+100,t.y]),a=d.distanceTo(n)/100,c=2*this._accuracy/a;this._circleElement.style.width=`${c.toFixed(2)}px`,this._circleElement.style.height=`${c.toFixed(2)}px`}trigger(){if(!this._setup)return h.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 h.n("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":_n--,yn=!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 h.n("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 h.n("trackuserlocationstart")),this.fire(new h.n("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 d;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),_n++,_n>1?(d={maximumAge:6e5,timeout:0},yn=!0):(d=this.options.positionOptions,yn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,d)}}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)}},k.GlobeControl=class{constructor(){this._toggleProjection=()=>{var d;const t=(d=this._map.getProjection())===null||d===void 0?void 0:d.type;this._map.setProjection(t!=="mercator"&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var d;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((d=this._map.getProjection())===null||d===void 0?void 0:d.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(d){return this._map=d,this._container=we.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=we.create("button","maplibregl-ctrl-globe",this._container),we.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}},k.Hash=ou,k.ImageSource=an,k.KeyboardHandler=Gl,k.LngLatBounds=xt,k.LogoControl=At,k.Map=ba,k.MapLibreMap=ba,k.MapMouseEvent=jt,k.MapTouchEvent=Ae,k.MapWheelEvent=Vl,k.Marker=so,k.NavigationControl=class{constructor(d){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),a=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.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 a=this._map._getUIString(`NavigationControl.${n}`);t.title=a,t.setAttribute("aria-label",a)},this.options=h.e({},Yl,d),this._container=we.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}))),we.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}))),we.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=we.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(d){return this._map=d,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 Kl(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(d,t){const n=we.create("button",d,this._container);return n.type="button",n.addEventListener("click",t),n}},k.Popup=class extends h.E{constructor(d){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new h.n("close"))),this),this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=we.create("div","maplibregl-popup",this._map.getContainer()),this._tip=we.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const x of this.options.className.split(" "))this._container.classList.add(x);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=wa(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),t&&"point"in t&&t.point&&(n=t.point),this._trackPointer&&!n)return;const a=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=tc(this.options.offset);if(!c){const x=this._container.offsetWidth,w=this._container.offsetHeight,S=(function(E){var C,z,O,j;return E?{top:(C=E.top)!==null&&C!==void 0?C:0,right:(z=E.right)!==null&&z!==void 0?z:0,bottom:(O=E.bottom)!==null&&O!==void 0?O:0,left:(j=E.left)!==null&&j!==void 0?j:0}:{top:0,right:0,bottom:0,left:0}})(this.options.padding);let P;P=a.y+f.bottom.y<w+S.top?["top"]:a.y>this._map.transform.height-w-S.bottom?["bottom"]:[],a.x<x/2+S.left?P.push("left"):a.x>this._map.transform.width-x/2-S.right&&P.push("right"),c=P.length===0?"bottom":P.join("-")}let y=a.add(f[c]);this.options.subpixelPositioning||(y=y.round()),this._container.style.transform=`${ro[c]} translate(${y.x}px,${y.y}px)`,no(this._container,c,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=h.e(Object.create(ec),d)}addTo(d){return this._map&&this.remove(),this._map=d,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new h.n("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=h.W.convert(d),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(d){return this.setDOMContent(document.createTextNode(d))}setHTML(d){const t=document.createDocumentFragment(),n=document.createElement("body");let a;for(n.innerHTML=d;a=n.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){var d;return(d=this._container)===null||d===void 0?void 0:d.style.maxWidth}setMaxWidth(d){return this.options.maxWidth=d,this._update(),this}setDOMContent(d){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=we.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(d),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(d){return this._container&&this._container.classList.add(d),this}removeClassName(d){return this._container&&this._container.classList.remove(d),this}setOffset(d){return this.options.offset=d,this._update(),this}toggleClassName(d){if(this._container)return this._container.classList.toggle(d)}setSubpixelPositioning(d){this.options.subpixelPositioning=d}setPadding(d){this.options.padding=d,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=we.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 d=this._container.querySelector(gu);d&&d.focus()}},k.RasterDEMTileSource=Dn,k.RasterTileSource=sn,k.ScaleControl=class{constructor(d){this._onMove=()=>{Ta(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Ta(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Ql),d)}getDefaultPosition(){return"bottom-left"}onAdd(d){return this._map=d,this._container=we.create("div","maplibregl-ctrl maplibregl-ctrl-scale",d.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}},k.ScrollZoomHandler=De,k.Style=ml,k.TerrainControl=class{constructor(d){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=d}onAdd(d){return this._map=d,this._container=we.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=we.create("button","maplibregl-ctrl-terrain",this._container),we.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}},k.TwoFingersTouchPitchHandler=Ul,k.TwoFingersTouchRotateHandler=Ks,k.TwoFingersTouchZoomHandler=hu,k.TwoFingersTouchZoomRotateHandler=$l,k.VectorTileSource=Ka,k.VideoSource=el,k.addSourceType=(d,t)=>h._(void 0,void 0,void 0,(function*(){if(bo(d))throw new Error(`A source type called "${d}" already exists.`);((n,a)=>{tl[n]=a})(d,t)})),k.clearPrewarmedResources=function(){const d=di;d&&(d.isPreloaded()&&d.numActive()===1?(d.release(Cn),di=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()"))},k.createTileMesh=Ii,k.getGlobalDispatcher=tt,k.getMaxParallelImageRequests=function(){return h.c.MAX_PARALLEL_IMAGE_REQUESTS},k.getRTLTextPluginStatus=function(){return zn().getRTLTextPluginStatus()},k.getVersion=function(){return _u},k.getWorkerCount=function(){return Kt.workerCount},k.getWorkerUrl=function(){return h.c.WORKER_URL},k.importScriptInWorkers=function(d){return tt().broadcast("IS",d)},k.isTimeFrozen=function(){return Yt.isFrozen()},k.now=je,k.prewarm=function(){Sr().acquire(Cn)},k.restoreNow=function(){Yt.restoreNow()},k.setMaxParallelImageRequests=function(d){h.c.MAX_PARALLEL_IMAGE_REQUESTS=d},k.setNow=function(d){Yt.setNow(d)},k.setRTLTextPlugin=function(d,t){return zn().setRTLTextPlugin(d,t)},k.setWorkerCount=function(d){Kt.workerCount=d},k.setWorkerUrl=function(d){h.c.WORKER_URL=d}}));var Ee=te;return Ee}))})(Zu)),Zu.exports}var wc=xy(),by=Object.defineProperty,wy=Math.pow,vt=(ge,se)=>by(ge,"name",{value:se,configurable:!0}),bi=(ge,se,te)=>new Promise((he,ve)=>{var Ee=fe=>{try{h(te.next(fe))}catch($e){ve($e)}},k=fe=>{try{h(te.throw(fe))}catch($e){ve($e)}},h=fe=>fe.done?he(fe.value):Promise.resolve(fe.value).then(Ee,k);h((te=te.apply(ge,se)).next())});vt((ge,se)=>{let te=!1,he="",ve=L.GridLayer.extend({createTile:vt((Ee,k)=>{let h=document.createElement("img"),fe=new AbortController,$e=fe.signal;return h.cancel=()=>{fe.abort()},te||(ge.getHeader().then(He=>{He.tileType===1||He.tileType===6?console.error("Error: archive contains vector tiles, but leafletRasterLayer is for displaying raster tiles. See https://github.com/protomaps/PMTiles/tree/main/js for details."):He.tileType===2?he="image/png":He.tileType===3?he="image/jpeg":He.tileType===4?he="image/webp":He.tileType===5&&(he="image/avif")}),te=!0),ge.getZxy(Ee.z,Ee.x,Ee.y,$e).then(He=>{if(He){let dt=new Blob([He.data],{type:he}),st=window.URL.createObjectURL(dt);h.src=st}else h.style.display="none";h.cancel=void 0,k(void 0,h)}).catch(He=>{if(He.name!=="AbortError")throw He}),h},"createTile"),_removeTile:vt(function(Ee){let k=this._tiles[Ee];k&&(k.el.cancel&&k.el.cancel(),k.el.src&&window.URL.revokeObjectURL(k.el.src),k.el.width=0,k.el.height=0,k.el.deleted=!0,L.DomUtil.remove(k.el),delete this._tiles[Ee],this.fire("tileunload",{tile:k.el,coords:this._keyToTileCoords(Ee)}))},"_removeTile")});return new ve(se)},"leafletRasterLayer");var Ty=vt(ge=>(se,te)=>{if(te instanceof AbortController)return ge(se,te);let he=new AbortController;return ge(se,he).then(ve=>te(void 0,ve.data,ve.cacheControl||"",ve.expires||""),ve=>te(ve)).catch(ve=>te(ve)),{cancel:vt(()=>he.abort(),"cancel")}},"v3compat"),dm=class{constructor(se){this.tilev4=vt((te,he)=>bi(this,null,function*(){if(te.type==="json"){let Ze=te.url.substr(10),Yt=this.tiles.get(Ze);if(Yt||(Yt=new am(Ze),this.tiles.set(Ze,Yt)),this.metadata){let Tr=yield Yt.getTileJson(te.url);return he.signal.throwIfAborted(),{data:Tr}}let je=yield Yt.getHeader();return he.signal.throwIfAborted(),(je.minLon>=je.maxLon||je.minLat>=je.maxLat)&&console.error(`Bounds of PMTiles archive ${je.minLon},${je.minLat},${je.maxLon},${je.maxLat} are not valid.`),{data:{tiles:[`${te.url}/{z}/{x}/{y}`],minzoom:je.minZoom,maxzoom:je.maxZoom,bounds:[je.minLon,je.minLat,je.maxLon,je.maxLat]}}}let ve=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),Ee=te.url.match(ve);if(!Ee)throw new Error("Invalid PMTiles protocol URL");let k=Ee[1],h=this.tiles.get(k);h||(h=new am(k),this.tiles.set(k,h));let fe=Ee[2],$e=Ee[3],He=Ee[4],dt=yield h?.getZxy(+fe,+$e,+He,he.signal);if(he.signal.throwIfAborted(),dt)return{data:new Uint8Array(dt.data),cacheControl:dt.cacheControl,expires:dt.expires};let st=yield h.getHeader();if(st.tileType===1||st.tileType===6){if(this.errorOnMissingTile)throw new Error("Tile not found.");return{data:new Uint8Array}}return{data:null}}),"tilev4"),this.tile=Ty(this.tilev4),this.tiles=new Map,this.metadata=se?.metadata||!1,this.errorOnMissingTile=se?.errorOnMissingTile||!1}add(se){this.tiles.set(se.source.getKey(),se)}get(se){return this.tiles.get(se)}};vt(dm,"Protocol");var Sy=dm;function pm(ge,se){return(se>>>0)*4294967296+(ge>>>0)}vt(pm,"toNum");function fm(ge,se){let te=se.buf,he=te[se.pos++],ve=(he&112)>>4;if(he<128||(he=te[se.pos++],ve|=(he&127)<<3,he<128)||(he=te[se.pos++],ve|=(he&127)<<10,he<128)||(he=te[se.pos++],ve|=(he&127)<<17,he<128)||(he=te[se.pos++],ve|=(he&127)<<24,he<128)||(he=te[se.pos++],ve|=(he&1)<<31,he<128))return pm(ge,ve);throw new Error("Expected varint not more than 10 bytes")}vt(fm,"readVarintRemainder");function Xa(ge){let se=ge.buf,te=se[ge.pos++],he=te&127;return te<128||(te=se[ge.pos++],he|=(te&127)<<7,te<128)||(te=se[ge.pos++],he|=(te&127)<<14,te<128)||(te=se[ge.pos++],he|=(te&127)<<21,te<128)?he:(te=se[ge.pos],he|=(te&15)<<28,fm(he,ge))}vt(Xa,"readVarint");function kd(ge,se,te,he,ve){return ve===0?he!==0?[ge-1-te,ge-1-se]:[te,se]:[se,te]}vt(kd,"rotate");function mm(ge,se,te){if(ge>26)throw new Error("Tile zoom level exceeds max safe number limit (26)");if(se>=1<<ge||te>=1<<ge)throw new Error("tile x/y outside zoom level bounds");let he=((1<<ge)*(1<<ge)-1)/3,ve=ge-1,[Ee,k]=[se,te];for(let h=1<<ve;h>0;h>>=1){let fe=Ee&h,$e=k&h;he+=(3*fe^$e)*(1<<ve),[Ee,k]=kd(h,Ee,k,fe,$e),ve--}return he}vt(mm,"zxyToTileId");function gm(ge){let se=3*ge+1;return se<4294967296?31-Math.clz32(se):63-Math.clz32(se/4294967296)}vt(gm,"tileIdToZ");function Py(ge){let se=gm(ge)>>1;if(se>26)throw new Error("Tile zoom level exceeds max safe number limit (26)");let te=((1<<se)*(1<<se)-1)/3,he=ge-te,ve=0,Ee=0,k=1<<se;for(let h=1;h<k;h<<=1){let fe=h&he/2,$e=h&(he^fe);[ve,Ee]=kd(h,ve,Ee,fe,$e),he=he/2,ve+=fe,Ee+=$e}return[se,ve,Ee]}vt(Py,"tileIdToZxy");var Iy=(ge=>(ge[ge.Unknown=0]="Unknown",ge[ge.None=1]="None",ge[ge.Gzip=2]="Gzip",ge[ge.Brotli=3]="Brotli",ge[ge.Zstd=4]="Zstd",ge))(Iy||{});function qu(ge,se){return bi(this,null,function*(){if(se===1||se===0)return ge;if(se===2){if(typeof globalThis.DecompressionStream>"u")return yy(new Uint8Array(ge));let te=new Response(ge).body;if(!te)throw new Error("Failed to read response stream");let he=te.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(he).arrayBuffer()}throw new Error("Compression method not supported")})}vt(qu,"defaultDecompress");var My=(ge=>(ge[ge.Unknown=0]="Unknown",ge[ge.Mvt=1]="Mvt",ge[ge.Png=2]="Png",ge[ge.Jpeg=3]="Jpeg",ge[ge.Webp=4]="Webp",ge[ge.Avif=5]="Avif",ge[ge.Mlt=6]="Mlt",ge))(My||{});function _m(ge){return ge===1?".mvt":ge===2?".png":ge===3?".jpg":ge===4?".webp":ge===5?".avif":ge===6?".mlt":""}vt(_m,"tileTypeExt");var Ey=127;function ym(ge,se){let te=0,he=ge.length-1;for(;te<=he;){let ve=he+te>>1,Ee=se-ge[ve].tileId;if(Ee>0)te=ve+1;else if(Ee<0)he=ve-1;else return ge[ve]}return he>=0&&(ge[he].runLength===0||se-ge[he].tileId<ge[he].runLength)?ge[he]:null}vt(ym,"findTile");var Cy=class{constructor(se){this.file=se}getKey(){return this.file.name}getBytes(se,te){return bi(this,null,function*(){return{data:yield this.file.slice(se,se+te).arrayBuffer()}})}};vt(Cy,"FileSource");var vm=class{constructor(se,te=new Headers,he=void 0){var ve,Ee;this.url=se,this.customHeaders=te,this.credentials=he,this.mustReload=!1;let k="";"navigator"in globalThis&&(k=(Ee=(ve=globalThis.navigator)==null?void 0:ve.userAgent)!=null?Ee:"");let h=k.indexOf("Windows")>-1,fe=/Chrome|Chromium|Edg|OPR|Brave/.test(k);this.chromeWindowsNoCache=!1,h&&fe&&(this.chromeWindowsNoCache=!0)}getKey(){return this.url}setHeaders(se){this.customHeaders=se}getBytes(se,te,he,ve){return bi(this,null,function*(){let Ee,k;he?k=he:(Ee=new AbortController,k=Ee.signal);let h=new Headers(this.customHeaders);h.set("range",`bytes=${se}-${se+te-1}`);let fe;this.mustReload?fe="reload":this.chromeWindowsNoCache&&(fe="no-store");let $e=yield fetch(this.url,{signal:k,cache:fe,headers:h,credentials:this.credentials});if(se===0&&$e.status===416){let st=$e.headers.get("Content-Range");if(!st||!st.startsWith("bytes */"))throw new Error("Missing content-length on 416 response");let Ze=+st.substr(8);h.set("range",`bytes=0-${Ze-1}`),$e=yield fetch(this.url,{signal:k,cache:"reload",headers:h,credentials:this.credentials})}let He=$e.headers.get("Etag");if(He!=null&&He.startsWith("W/")&&(He=null),$e.status===416||ve&&He&&He!==ve)throw this.mustReload=!0,new zd(`Server returned non-matching ETag ${ve} after one retry. Check browser extensions and servers for issues that may affect correct ETag headers.`);if($e.status>=300)throw new Error(`Bad response code: ${$e.status}`);let dt=$e.headers.get("Content-Length");if($e.status===200&&(!dt||+dt>te))throw Ee&&Ee.abort(),new Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield $e.arrayBuffer(),etag:He||void 0,cacheControl:$e.headers.get("Cache-Control")||void 0,expires:$e.headers.get("Expires")||void 0}})}};vt(vm,"FetchSource");var Ay=vm;function wr(ge,se){let te=ge.getUint32(se+4,!0),he=ge.getUint32(se+0,!0);return te*wy(2,32)+he}vt(wr,"getUint64");function xm(ge,se){let te=new DataView(ge),he=te.getUint8(7);if(he>3)throw new Error(`Archive is spec version ${he} but this library supports up to spec version 3`);return{specVersion:he,rootDirectoryOffset:wr(te,8),rootDirectoryLength:wr(te,16),jsonMetadataOffset:wr(te,24),jsonMetadataLength:wr(te,32),leafDirectoryOffset:wr(te,40),leafDirectoryLength:wr(te,48),tileDataOffset:wr(te,56),tileDataLength:wr(te,64),numAddressedTiles:wr(te,72),numTileEntries:wr(te,80),numTileContents:wr(te,88),clustered:te.getUint8(96)===1,internalCompression:te.getUint8(97),tileCompression:te.getUint8(98),tileType:te.getUint8(99),minZoom:te.getUint8(100),maxZoom:te.getUint8(101),minLon:te.getInt32(102,!0)/1e7,minLat:te.getInt32(106,!0)/1e7,maxLon:te.getInt32(110,!0)/1e7,maxLat:te.getInt32(114,!0)/1e7,centerZoom:te.getUint8(118),centerLon:te.getInt32(119,!0)/1e7,centerLat:te.getInt32(123,!0)/1e7,etag:se}}vt(xm,"bytesToHeader");function Rd(ge){let se={buf:new Uint8Array(ge),pos:0},te=Xa(se),he=[],ve=0;for(let Ee=0;Ee<te;Ee++){let k=Xa(se);he.push({tileId:ve+k,offset:0,length:0,runLength:1}),ve+=k}for(let Ee=0;Ee<te;Ee++)he[Ee].runLength=Xa(se);for(let Ee=0;Ee<te;Ee++)he[Ee].length=Xa(se);for(let Ee=0;Ee<te;Ee++){let k=Xa(se);k===0&&Ee>0?he[Ee].offset=he[Ee-1].offset+he[Ee-1].length:he[Ee].offset=k-1}return he}vt(Rd,"deserializeIndex");var bm=class extends Error{};vt(bm,"EtagMismatch");var zd=bm;function Ld(ge,se){return bi(this,null,function*(){let te=yield ge.getBytes(0,16384);if(new DataView(te.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");let he=te.data.slice(0,Ey),ve=xm(he,te.etag),Ee=te.data.slice(ve.rootDirectoryOffset,ve.rootDirectoryOffset+ve.rootDirectoryLength),k=`${ge.getKey()}|${ve.etag||""}|${ve.rootDirectoryOffset}|${ve.rootDirectoryLength}`,h=Rd(yield se(Ee,ve.internalCompression));return[ve,[k,h.length,h]]})}vt(Ld,"getHeaderAndRoot");function Fd(ge,se,te,he,ve,Ee){return bi(this,null,function*(){let k=yield ge.getBytes(te,he,Ee,ve.etag),h=yield se(k.data,ve.internalCompression),fe=Rd(h);if(fe.length===0)throw new Error("Empty directory is invalid");return fe})}vt(Fd,"getDirectory");var Dy=class{constructor(se=100,te=!0,he=qu){this.cache=new Map,this.maxCacheEntries=se,this.counter=1,this.decompress=he}getHeader(se){return bi(this,null,function*(){let te=se.getKey(),he=this.cache.get(te);if(he)return he.lastUsed=this.counter++,he.data;let ve=yield Ld(se,this.decompress);return ve[1]&&this.cache.set(ve[1][0],{lastUsed:this.counter++,data:ve[1][2]}),this.cache.set(te,{lastUsed:this.counter++,data:ve[0]}),this.prune(),ve[0]})}getDirectory(se,te,he,ve,Ee){return bi(this,null,function*(){let k=`${se.getKey()}|${ve.etag||""}|${te}|${he}`,h=this.cache.get(k);if(h)return h.lastUsed=this.counter++,h.data;let fe=yield Fd(se,this.decompress,te,he,ve,Ee);return this.cache.set(k,{lastUsed:this.counter++,data:fe}),this.prune(),fe})}prune(){if(this.cache.size>this.maxCacheEntries){let se=1/0,te;this.cache.forEach((he,ve)=>{he.lastUsed<se&&(se=he.lastUsed,te=ve)}),te&&this.cache.delete(te)}}invalidate(se){return bi(this,null,function*(){this.cache.delete(se.getKey())})}};vt(Dy,"ResolvedValueCache");var wm=class{constructor(se=100,te=!0,he=qu){this.cache=new Map,this.invalidations=new Map,this.pendingFetches=new Map,this.maxCacheEntries=se,this.counter=1,this.decompress=he}getHeader(se){return bi(this,null,function*(){let te=se.getKey(),he=this.cache.get(te);if(he)return he.lastUsed=this.counter++,yield he.data;let ve=new Promise((Ee,k)=>{Ld(se,this.decompress).then(h=>{h[1]&&this.cache.set(h[1][0],{lastUsed:this.counter++,data:Promise.resolve(h[1][2])}),Ee(h[0]),this.prune()}).catch(h=>{k(h)})});return this.cache.set(te,{lastUsed:this.counter++,data:ve}),ve})}trackSignal(se,te,he){te.refs++,he.addEventListener("abort",()=>{--te.refs<=0&&this.pendingFetches.get(se)===te&&(te.controller.abort(),this.cache.delete(se),this.pendingFetches.delete(se))},{once:!0})}getDirectory(se,te,he,ve,Ee){return bi(this,null,function*(){let k=`${se.getKey()}|${ve.etag||""}|${te}|${he}`,h=this.cache.get(k);if(h){h.lastUsed=this.counter++;let dt=this.pendingFetches.get(k);return dt&&this.trackSignal(k,dt,Ee??new AbortController().signal),yield h.data}let fe=new AbortController,$e={controller:fe,refs:0};this.trackSignal(k,$e,Ee??new AbortController().signal),this.pendingFetches.set(k,$e);let He=new Promise((dt,st)=>{Fd(se,this.decompress,te,he,ve,fe.signal).then(Ze=>{this.pendingFetches.delete(k),dt(Ze),this.prune()}).catch(Ze=>{st(Ze)})});return this.cache.set(k,{lastUsed:this.counter++,data:He}),He})}prune(){if(this.cache.size>=this.maxCacheEntries){let se=1/0,te;this.cache.forEach((he,ve)=>{he.lastUsed<se&&(se=he.lastUsed,te=ve)}),te&&this.cache.delete(te)}}invalidate(se){return bi(this,null,function*(){let te=se.getKey();if(this.invalidations.get(te))return yield this.invalidations.get(te);this.cache.delete(se.getKey());let he=new Promise((ve,Ee)=>{this.getHeader(se).then(k=>{ve(),this.invalidations.delete(te)}).catch(k=>{Ee(k)})});this.invalidations.set(te,he)})}};vt(wm,"SharedPromiseCache");var zy=wm,Tm=class{constructor(se,te,he){typeof se=="string"?this.source=new Ay(se):this.source=se,he?this.decompress=he:this.decompress=qu,te?this.cache=te:this.cache=new zy}getHeader(){return bi(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(se,te,he,ve){return bi(this,null,function*(){let Ee=mm(se,te,he),k=yield this.cache.getHeader(this.source);if(ve?.throwIfAborted(),se<k.minZoom||se>k.maxZoom)return;let h=k.rootDirectoryOffset,fe=k.rootDirectoryLength;for(let $e=0;$e<=3;$e++){let He=yield this.cache.getDirectory(this.source,h,fe,k,ve);ve?.throwIfAborted();let dt=ym(He,Ee);if(dt){if(dt.runLength>0){let st=yield this.source.getBytes(k.tileDataOffset+dt.offset,dt.length,ve,k.etag);return{data:yield this.decompress(st.data,k.tileCompression),cacheControl:st.cacheControl,expires:st.expires}}h=k.leafDirectoryOffset+dt.offset,fe=dt.length}else return}throw new Error("Maximum directory depth exceeded")})}getZxy(se,te,he,ve){return bi(this,null,function*(){try{return yield this.getZxyAttempt(se,te,he,ve)}catch(Ee){if(Ee instanceof zd)return this.cache.invalidate(this.source),yield this.getZxyAttempt(se,te,he,ve);throw Ee}})}getMetadataAttempt(){return bi(this,null,function*(){let se=yield this.cache.getHeader(this.source),te=yield this.source.getBytes(se.jsonMetadataOffset,se.jsonMetadataLength,void 0,se.etag),he=yield this.decompress(te.data,se.internalCompression),ve=new TextDecoder("utf-8");return JSON.parse(ve.decode(he))})}getMetadata(){return bi(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(se){if(se instanceof zd)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw se}})}getTileJson(se){return bi(this,null,function*(){let te=yield this.getHeader(),he=yield this.getMetadata(),ve=_m(te.tileType);return{tilejson:"3.0.0",scheme:"xyz",tiles:[`${se}/{z}/{x}/{y}${ve}`],vector_layers:he.vector_layers,attribution:he.attribution,description:he.description,name:he.name,version:he.version,bounds:[te.minLon,te.minLat,te.maxLon,te.maxLat],center:[te.centerLon,te.centerLat,te.centerZoom],minzoom:te.minZoom,maxzoom:te.maxZoom}})}};vt(Tm,"PMTiles");var am=Tm;const ky="https://tiles.overturemaps.org",Ry="https://stac.overturemaps.org/catalog.json",Ly="https://protomaps.github.io/basemaps-assets/fonts/{fontstack}/{range}.pbf",lm=["Noto Sans Regular"],Fy='<a href="https://www.openstreetmap.org/copyright" target="_blank" rel="noreferrer">© OpenStreetMap contributors</a>, <a href="https://docs.overturemaps.org/attribution/" target="_blank" rel="noreferrer">Overture Maps Foundation</a>',By={background:"#f6f8fa",park:"#dcefd9",water:"#b9d8ee",building:"#e4e2de",road:"#ffffff",roadMajor:"#fde7b2",roadCasing:"#d0d7de",rail:"#afb8c1",boundary:"#8c959f",label:"#424a53",halo:"#ffffff"},Oy={background:"#161b22",park:"#1f2d22",water:"#0f2a43",building:"#262c36",road:"#30363d",roadMajor:"#4d4224",roadCasing:"#0d1117",rail:"#484f58",boundary:"#6e7681",label:"#c9d1d9",halo:"#0d1117"},Vy=["base","buildings","transportation","divisions"];function jy(ge,se){return`pmtiles://${ky}/${ge}/${se}.pmtiles`}const Ad=["motorway","trunk","primary","secondary"],Dd=["tertiary","residential","living_street","unclassified","service"],Ny=["pedestrian","footway","path","steps","cycleway"];function cm(ge){return["in",["get","class"],["literal",ge]]}function Uy(ge,se=!1){const te=se?Oy:By,he=Object.fromEntries(Vy.map(Ee=>[Ee,{type:"vector",url:jy(ge,Ee),attribution:Fy}])),ve=(Ee,k,h,fe,$e={})=>({id:Ee,type:"line",source:"transportation","source-layer":"segment",filter:["all",["==",["get","subtype"],"road"],cm(k)],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":h,"line-width":["interpolate",["exponential",1.6],["zoom"],10,fe[0],14,fe[1],18,fe[2]],...$e}});return{version:8,glyphs:Ly,sources:he,layers:[{id:"background",type:"background",paint:{"background-color":te.background}},{id:"park",type:"fill",source:"base","source-layer":"land_use",filter:["in",["get","subtype"],["literal",["park","recreation","cemetery","golf"]]],paint:{"fill-color":te.park}},{id:"water",type:"fill",source:"base","source-layer":"water",filter:["==",["geometry-type"],"Polygon"],paint:{"fill-color":te.water}},{id:"building",type:"fill",source:"buildings","source-layer":"building",minzoom:13,paint:{"fill-color":te.building,"fill-opacity":.9}},ve("road-path",Ny,te.roadCasing,[.3,.8,2],{"line-dasharray":[2,1]}),ve("road-casing",[...Ad,...Dd],te.roadCasing,[1,4,18]),ve("road-minor",Dd,te.road,[.5,2.5,14]),ve("road-major",Ad,te.roadMajor,[1,3.5,16]),{id:"rail",type:"line",source:"transportation","source-layer":"segment",filter:["==",["get","subtype"],"rail"],paint:{"line-color":te.rail,"line-width":1,"line-dasharray":[3,2]}},{id:"boundary",type:"line",source:"divisions","source-layer":"division_boundary",paint:{"line-color":te.boundary,"line-width":1,"line-dasharray":[4,2]}},{id:"road-label",type:"symbol",source:"transportation","source-layer":"segment",minzoom:14,filter:["all",["==",["get","subtype"],"road"],cm([...Ad,...Dd])],layout:{"symbol-placement":"line","text-field":["get","@name"],"text-font":lm,"text-size":11},paint:{"text-color":te.label,"text-halo-color":te.halo,"text-halo-width":1.5}},{id:"place-label",type:"symbol",source:"divisions","source-layer":"division",filter:["==",["geometry-type"],"Point"],layout:{"text-field":["get","@name"],"text-font":lm,"text-size":["interpolate",["linear"],["zoom"],4,11,12,14],"symbol-sort-key":["-",0,["coalesce",["get","@prominence"],0]]},paint:{"text-color":te.label,"text-halo-color":te.halo,"text-halo-width":1.5}}]}}let $u=null;function Gy(ge=fetch){return $u||($u=ge(Ry).then(se=>{if(!se.ok)throw new Error(`Overture's catalogue answered ${se.status}`);return se.json()}).then(se=>{if(typeof se.latest!="string"||!se.latest)throw new Error("Overture's catalogue names no latest release");return se.latest}).catch(se=>{throw $u=null,se})),$u}const $y={stay:"#8250df",food:"#bf3989",sight:"#0969da",transport:"#1a7f37",other:"#6e7781"};let um=!1;function Zy(){um||(wc.addProtocol("pmtiles",new Sy().tile),um=!0)}function qy(ge){const se=document.createElement("div");return se.textContent=String(ge.number),se.setAttribute("aria-label",`${ge.number}. ${ge.name}`),se.title=ge.name,Object.assign(se.style,{width:"24px",height:"24px",borderRadius:"50%",background:$y[ge.kind],color:"#ffffff",border:"2px solid #ffffff",boxShadow:"0 1px 3px rgba(0,0,0,0.4)",font:'600 12px/20px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',textAlign:"center",cursor:"pointer"}),se}function Wy(ge,se){if(!se)return;const[te,he,ve,Ee]=se;ge.fitBounds([[te,he],[ve,Ee]],{padding:40,maxZoom:16,duration:0})}function r0({places:ge,dark:se,height:te=320}){const he=En.useRef(null),ve=En.useRef(null),Ee=En.useRef([]),[k,h]=En.useState(""),[fe,$e]=En.useState(""),[He,dt]=En.useState(0);return En.useEffect(()=>{let st=!0;return Gy().then(Ze=>st&&h(Ze)).catch(Ze=>st&&$e(String(Ze?.message??Ze))),()=>{st=!1}},[]),En.useEffect(()=>{if(!k||!he.current)return;Zy();const st=new wc.Map({container:he.current,style:Uy(k,se),center:[0,20],zoom:1,attributionControl:{compact:!0},cooperativeGestures:!0});st.addControl(new wc.NavigationControl({showCompass:!1}),"top-right"),st.once("load",()=>{st.resize(),dt(Yt=>Yt+1)});const Ze=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>st.resize());return Ze?.observe(he.current),ve.current=st,()=>{Ze?.disconnect(),Ee.current.forEach(Yt=>Yt.remove()),Ee.current=[],st.remove(),ve.current=null}},[k,se]),En.useEffect(()=>{const st=ve.current;st&&(Ee.current.forEach(Ze=>Ze.remove()),Ee.current=ge.map(Ze=>new wc.Marker({element:qy(Ze)}).setLngLat([Ze.lon,Ze.lat]).setPopup(new wc.Popup({offset:14,closeButton:!1}).setText([Ze.name,Ze.time,Ze.address].filter(Boolean).join(" · "))).addTo(st)),Wy(st,gy(ge)))},[ge,He]),fe?Cd.jsx(sm,{height:te,display:"flex",alignItems:"center",justifyContent:"center",bg:"canvas.subtle",borderRadius:2,children:Cd.jsxs(_y,{sx:{fontSize:1,color:"fg.muted"},children:["The map could not load Overture's release (",fe,"): the places are listed below."]})}):Cd.jsx(sm,{ref:he,height:te,borderRadius:2,overflow:"hidden",bg:"canvas.subtle","aria-label":"Map of the option's places",role:"region","data-testid":"trip-map-canvas"})}export{$y as KIND_COLORS,r0 as TripMapView,r0 as default};