@local-logic/sdks-app 1.0.0-beta.41 → 1.0.0-beta.44

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 (152) hide show
  1. package/dist/assets/index.bffff470.js +715 -0
  2. package/dist/assets/{index.128006c6.js → index.e4acce0a.js} +163 -139
  3. package/dist/index.html +1 -1
  4. package/dist/types/context/stateManager/index.d.ts +3 -3
  5. package/dist/types/context/stateManager/index.d.ts.map +1 -1
  6. package/dist/types/context/stateManager/index.js +8 -7
  7. package/dist/types/context/stateManager/index.js.map +1 -1
  8. package/dist/types/features/scores/keyFactory.d.ts +1 -1
  9. package/dist/types/sdks/LocalContent/Map/Attribution/index.d.ts +4 -0
  10. package/dist/types/sdks/LocalContent/Map/Attribution/index.d.ts.map +1 -0
  11. package/dist/types/sdks/LocalContent/Map/Attribution/index.js +7 -0
  12. package/dist/types/sdks/LocalContent/Map/Attribution/index.js.map +1 -0
  13. package/dist/types/sdks/LocalContent/Map/Attribution/styles.d.ts +2 -0
  14. package/dist/types/sdks/LocalContent/Map/Attribution/styles.d.ts.map +1 -0
  15. package/dist/types/sdks/LocalContent/Map/Attribution/styles.js +9 -0
  16. package/dist/types/sdks/LocalContent/Map/Attribution/styles.js.map +1 -0
  17. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/Score/index.d.ts +11 -0
  18. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/Score/index.d.ts.map +1 -0
  19. package/dist/types/sdks/LocalContent/Map/{Scores → DesktopScores/ScoreCategoryAccordion}/ScoreCategory/Score/index.js +5 -4
  20. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/Score/index.js.map +1 -0
  21. package/dist/types/sdks/LocalContent/Map/{Scores → DesktopScores/ScoreCategoryAccordion}/ScoreCategory/Score/styles.d.ts +0 -0
  22. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/Score/styles.d.ts.map +1 -0
  23. package/dist/types/sdks/LocalContent/Map/{Scores → DesktopScores/ScoreCategoryAccordion}/ScoreCategory/Score/styles.js +0 -0
  24. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/Score/styles.js.map +1 -0
  25. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/index.d.ts +14 -0
  26. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/index.d.ts.map +1 -0
  27. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/index.js +27 -0
  28. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/index.js.map +1 -0
  29. package/dist/types/sdks/LocalContent/Map/{Scores → DesktopScores/ScoreCategoryAccordion}/ScoreCategory/styles.d.ts +0 -0
  30. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/styles.d.ts.map +1 -0
  31. package/dist/types/sdks/LocalContent/Map/{Scores → DesktopScores/ScoreCategoryAccordion}/ScoreCategory/styles.js +0 -0
  32. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/styles.js.map +1 -0
  33. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/index.d.ts +7 -0
  34. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/index.d.ts.map +1 -0
  35. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/index.js +18 -0
  36. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/index.js.map +1 -0
  37. package/dist/types/sdks/LocalContent/Map/DesktopScores/index.d.ts +4 -0
  38. package/dist/types/sdks/LocalContent/Map/DesktopScores/index.d.ts.map +1 -0
  39. package/dist/types/sdks/LocalContent/Map/DesktopScores/index.js +21 -0
  40. package/dist/types/sdks/LocalContent/Map/DesktopScores/index.js.map +1 -0
  41. package/dist/types/sdks/LocalContent/Map/DesktopScores/styles.d.ts +5 -0
  42. package/dist/types/sdks/LocalContent/Map/DesktopScores/styles.d.ts.map +1 -0
  43. package/dist/types/sdks/LocalContent/Map/DesktopScores/styles.js +31 -0
  44. package/dist/types/sdks/LocalContent/Map/DesktopScores/styles.js.map +1 -0
  45. package/dist/types/sdks/LocalContent/Map/{Cluster → Markers/Cluster}/index.d.ts +0 -0
  46. package/dist/types/sdks/LocalContent/Map/Markers/Cluster/index.d.ts.map +1 -0
  47. package/dist/types/sdks/LocalContent/Map/{Cluster → Markers/Cluster}/index.js +0 -0
  48. package/dist/types/sdks/LocalContent/Map/Markers/Cluster/index.js.map +1 -0
  49. package/dist/types/sdks/LocalContent/Map/{Cluster → Markers/Cluster}/styles.d.ts +0 -0
  50. package/dist/types/sdks/LocalContent/Map/Markers/Cluster/styles.d.ts.map +1 -0
  51. package/dist/types/sdks/LocalContent/Map/{Cluster → Markers/Cluster}/styles.js +0 -0
  52. package/dist/types/sdks/LocalContent/Map/Markers/Cluster/styles.js.map +1 -0
  53. package/dist/types/sdks/LocalContent/Map/Markers/index.d.ts +22 -0
  54. package/dist/types/sdks/LocalContent/Map/Markers/index.d.ts.map +1 -0
  55. package/dist/types/sdks/LocalContent/Map/Markers/index.js +69 -0
  56. package/dist/types/sdks/LocalContent/Map/Markers/index.js.map +1 -0
  57. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/index.d.ts +8 -0
  58. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/index.d.ts.map +1 -0
  59. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/index.js +46 -0
  60. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/index.js.map +1 -0
  61. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/styles.d.ts +5 -0
  62. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/styles.d.ts.map +1 -0
  63. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/styles.js +30 -0
  64. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/styles.js.map +1 -0
  65. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/index.d.ts +4 -0
  66. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/index.d.ts.map +1 -0
  67. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/index.js +37 -0
  68. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/index.js.map +1 -0
  69. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/styles.d.ts +4 -0
  70. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/styles.d.ts.map +1 -0
  71. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/styles.js +20 -0
  72. package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/styles.js.map +1 -0
  73. package/dist/types/sdks/LocalContent/Map/MobileScores/index.d.ts +7 -0
  74. package/dist/types/sdks/LocalContent/Map/MobileScores/index.d.ts.map +1 -0
  75. package/dist/types/sdks/LocalContent/Map/MobileScores/index.js +11 -0
  76. package/dist/types/sdks/LocalContent/Map/MobileScores/index.js.map +1 -0
  77. package/dist/types/sdks/LocalContent/Map/MobileScores/styles.d.ts +5 -0
  78. package/dist/types/sdks/LocalContent/Map/MobileScores/styles.d.ts.map +1 -0
  79. package/dist/types/sdks/LocalContent/Map/MobileScores/styles.js +24 -0
  80. package/dist/types/sdks/LocalContent/Map/MobileScores/styles.js.map +1 -0
  81. package/dist/types/sdks/LocalContent/Map/{Scores/ScoreCategory/Score/POIs → POIs}/index.d.ts +0 -0
  82. package/dist/types/sdks/LocalContent/Map/POIs/index.d.ts.map +1 -0
  83. package/dist/types/sdks/LocalContent/Map/{Scores/ScoreCategory/Score/POIs → POIs}/index.js +8 -5
  84. package/dist/types/sdks/LocalContent/Map/POIs/index.js.map +1 -0
  85. package/dist/types/sdks/LocalContent/Map/Pin/index.d.ts +10 -0
  86. package/dist/types/sdks/LocalContent/Map/Pin/index.d.ts.map +1 -0
  87. package/dist/types/sdks/LocalContent/Map/Pin/index.js +10 -0
  88. package/dist/types/sdks/LocalContent/Map/Pin/index.js.map +1 -0
  89. package/dist/types/sdks/LocalContent/Map/{Scores/ScoreCategory/Score/Schools → Schools}/index.d.ts +0 -0
  90. package/dist/types/sdks/LocalContent/Map/Schools/index.d.ts.map +1 -0
  91. package/dist/types/sdks/LocalContent/Map/{Scores/ScoreCategory/Score/Schools → Schools}/index.js +9 -6
  92. package/dist/types/sdks/LocalContent/Map/Schools/index.js.map +1 -0
  93. package/dist/types/sdks/LocalContent/Map/index.d.ts.map +1 -1
  94. package/dist/types/sdks/LocalContent/Map/index.js +56 -86
  95. package/dist/types/sdks/LocalContent/Map/index.js.map +1 -1
  96. package/dist/types/sdks/LocalContent/Map/styles.d.ts +3 -0
  97. package/dist/types/sdks/LocalContent/Map/styles.d.ts.map +1 -0
  98. package/dist/types/sdks/LocalContent/Map/styles.js +17 -0
  99. package/dist/types/sdks/LocalContent/Map/styles.js.map +1 -0
  100. package/dist/types/sdks/LocalContent/context.d.ts +6 -4
  101. package/dist/types/sdks/LocalContent/context.d.ts.map +1 -1
  102. package/dist/types/sdks/LocalContent/context.js +45 -11
  103. package/dist/types/sdks/LocalContent/context.js.map +1 -1
  104. package/dist/types/sdks/LocalContent/features/usePois.d.ts +1 -1
  105. package/dist/types/sdks/LocalContent/features/usePois.d.ts.map +1 -1
  106. package/dist/types/sdks/LocalContent/features/usePois.js +4 -4
  107. package/dist/types/sdks/LocalContent/features/usePois.js.map +1 -1
  108. package/dist/types/sdks/LocalContent/features/useSchools.d.ts +1 -1
  109. package/dist/types/sdks/LocalContent/features/useSchools.d.ts.map +1 -1
  110. package/dist/types/sdks/LocalContent/features/useSchools.js +3 -3
  111. package/dist/types/sdks/LocalContent/features/useSchools.js.map +1 -1
  112. package/dist/types/sdks/LocalContent/features/useScores.d.ts +2 -2
  113. package/dist/types/sdks/LocalContent/features/useScores.d.ts.map +1 -1
  114. package/dist/types/sdks/LocalContent/features/useScores.js +3 -3
  115. package/dist/types/sdks/LocalContent/features/useScores.js.map +1 -1
  116. package/dist/types/services/isObject/index.d.ts +2 -0
  117. package/dist/types/services/isObject/index.d.ts.map +1 -0
  118. package/dist/types/services/isObject/index.js +2 -0
  119. package/dist/types/services/isObject/index.js.map +1 -0
  120. package/dist/types/services/mergeDeep/index.d.ts +2 -0
  121. package/dist/types/services/mergeDeep/index.d.ts.map +1 -0
  122. package/dist/types/services/mergeDeep/index.js +22 -0
  123. package/dist/types/services/mergeDeep/index.js.map +1 -0
  124. package/package.json +7 -7
  125. package/dist/assets/index.1ce1f547.js +0 -714
  126. package/dist/types/sdks/LocalContent/Map/Cluster/index.d.ts.map +0 -1
  127. package/dist/types/sdks/LocalContent/Map/Cluster/index.js.map +0 -1
  128. package/dist/types/sdks/LocalContent/Map/Cluster/styles.d.ts.map +0 -1
  129. package/dist/types/sdks/LocalContent/Map/Cluster/styles.js.map +0 -1
  130. package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategory/Score/POIs/index.d.ts.map +0 -1
  131. package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategory/Score/POIs/index.js.map +0 -1
  132. package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategory/Score/Schools/index.d.ts.map +0 -1
  133. package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategory/Score/Schools/index.js.map +0 -1
  134. package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategory/Score/index.d.ts +0 -10
  135. package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategory/Score/index.d.ts.map +0 -1
  136. package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategory/Score/index.js.map +0 -1
  137. package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategory/Score/styles.d.ts.map +0 -1
  138. package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategory/Score/styles.js.map +0 -1
  139. package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategory/index.d.ts +0 -7
  140. package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategory/index.d.ts.map +0 -1
  141. package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategory/index.js +0 -31
  142. package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategory/index.js.map +0 -1
  143. package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategory/styles.d.ts.map +0 -1
  144. package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategory/styles.js.map +0 -1
  145. package/dist/types/sdks/LocalContent/Map/Scores/index.d.ts +0 -8
  146. package/dist/types/sdks/LocalContent/Map/Scores/index.d.ts.map +0 -1
  147. package/dist/types/sdks/LocalContent/Map/Scores/index.js +0 -69
  148. package/dist/types/sdks/LocalContent/Map/Scores/index.js.map +0 -1
  149. package/dist/types/sdks/LocalContent/Map/Scores/styles.d.ts +0 -18
  150. package/dist/types/sdks/LocalContent/Map/Scores/styles.d.ts.map +0 -1
  151. package/dist/types/sdks/LocalContent/Map/Scores/styles.js +0 -92
  152. package/dist/types/sdks/LocalContent/Map/Scores/styles.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import{R as Tf,r as ve,$ as Xh,a as Wh,u as Hh,_ as Oc,s as Ef,b as Sf,c as If,d as Cf,P as Af,L as Mf,e as Pf,f as zf,g as kf,h as st,j as Ze,i as Df,k as Kh,l as aa,m as Lf,n as mi,t as St,o as Jh,p as Gc,q as Tl,v as Eh,w as ca,x as cr,y as Yh,z as Rf,A as ua,B as Sl,C as qc,D as Zc,U as Qh,F as jc,E as Xc,G as ep,H as os,I as xr,J as rs,S as Bf,K as vl,M as Gn,N as Ff,T as tp,O as Sh,Q as Of,V as kc,W as oa}from"./index.1ce1f547.js";const Uf=Tf["useId".toString()]||(()=>{});let $f=0;function ip(b){const[C,A]=ve.exports.useState(Uf());return Xh(()=>{b||A(D=>D!=null?D:String($f++))},[b]),b||(C?`radix-${C}`:"")}function Wc({prop:b,defaultProp:C,onChange:A=()=>{}}){const[D,B]=Vf({defaultProp:C,onChange:A}),G=b!==void 0,ne=G?b:D,a=Wh(A),Y=ve.exports.useCallback(ie=>{if(G){const ue=typeof ie=="function"?ie(b):ie;ue!==b&&a(ue)}else B(ie)},[G,b,B,a]);return[ne,Y]}function Vf({defaultProp:b,onChange:C}){const A=ve.exports.useState(b),[D]=A,B=ve.exports.useRef(D),G=Wh(C);return ve.exports.useEffect(()=>{B.current!==D&&(G(D),B.current=D)},[D,B,G]),A}function rp(){var b=ve.exports.useRef(!1);return Hh(function(){return b.current=!0,function(){b.current=!1}},[]),b}function Nf(){var b=rp(),C=Oc(ve.exports.useState(0),2),A=C[0],D=C[1],B=ve.exports.useCallback(function(){b.current&&D(A+1)},[A]),G=ve.exports.useCallback(function(){return Ef.postRender(B)},[B]);return[G,A]}var Dc=function(b){var C=b.children,A=b.initial,D=b.isPresent,B=b.onExitComplete,G=b.custom,ne=b.presenceAffectsLayout,a=Sf(Gf),Y=If(),ie=ve.exports.useMemo(function(){return{id:Y,initial:A,isPresent:D,custom:G,onExitComplete:function(pe){var ue,te;a.set(pe,!0);try{for(var ke=Cf(a.values()),Se=ke.next();!Se.done;Se=ke.next()){var Ie=Se.value;if(!Ie)return}}catch(Ye){ue={error:Ye}}finally{try{Se&&!Se.done&&(te=ke.return)&&te.call(ke)}finally{if(ue)throw ue.error}}B==null||B()},register:function(pe){return a.set(pe,!1),function(){return a.delete(pe)}}}},ne?void 0:[D]);return ve.exports.useMemo(function(){a.forEach(function(pe,ue){return a.set(ue,!1)})},[D]),ve.exports.useEffect(function(){!D&&!a.size&&(B==null||B())},[D]),ve.exports.createElement(Af.Provider,{value:ie},C)};function Gf(){return new Map}var ns=function(b){return b.key||""};function qf(b,C){b.forEach(function(A){var D=ns(A);C.set(D,A)})}function Zf(b){var C=[];return ve.exports.Children.forEach(b,function(A){ve.exports.isValidElement(A)&&C.push(A)}),C}var jf=function(b){var C=b.children,A=b.custom,D=b.initial,B=D===void 0?!0:D,G=b.onExitComplete,ne=b.exitBeforeEnter,a=b.presenceAffectsLayout,Y=a===void 0?!0:a,ie=Oc(Nf(),1),pe=ie[0],ue=ve.exports.useContext(Mf).forceRender;ue&&(pe=ue);var te=rp(),ke=Zf(C),Se=ke,Ie=new Set,Ye=ve.exports.useRef(Se),tt=ve.exports.useRef(new Map).current,Qe=ve.exports.useRef(!0);if(Hh(function(){Qe.current=!1,qf(ke,tt),Ye.current=Se}),Pf(function(){Qe.current=!0,tt.clear(),Ie.clear()}),Qe.current)return ve.exports.createElement(ve.exports.Fragment,null,Se.map(function(gt){return ve.exports.createElement(Dc,{key:ns(gt),isPresent:!0,initial:B?void 0:!1,presenceAffectsLayout:Y},gt)}));Se=zf([],Oc(Se),!1);for(var dt=Ye.current.map(ns),It=ke.map(ns),ht=dt.length,xt=0;xt<ht;xt++){var Xt=dt[xt];It.indexOf(Xt)===-1&&Ie.add(Xt)}return ne&&Ie.size&&(Se=[]),Ie.forEach(function(gt){if(It.indexOf(gt)===-1){var xi=tt.get(gt);if(!!xi){var zi=dt.indexOf(gt),_t=function(){tt.delete(gt),Ie.delete(gt);var Wt=Ye.current.findIndex(function(ei){return ei.key===gt});if(Ye.current.splice(Wt,1),!Ie.size){if(Ye.current=ke,te.current===!1)return;pe(),G&&G()}};Se.splice(zi,0,ve.exports.createElement(Dc,{key:ns(xi),isPresent:!1,onExitComplete:_t,custom:A,presenceAffectsLayout:Y},xi))}}}),Se=Se.map(function(gt){var xi=gt.key;return Ie.has(xi)?gt:ve.exports.createElement(Dc,{key:ns(gt),isPresent:!0,presenceAffectsLayout:Y},gt)}),kf!=="production"&&ne&&Se.length>1&&console.warn("You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour."),ve.exports.createElement(ve.exports.Fragment,null,Ie.size?Se:Se.map(function(gt){return ve.exports.cloneElement(gt)}))};const np=st.createContext({}),as=()=>ve.exports.useContext(np),Xf=({children:b})=>{const[C,A]=ve.exports.useState({commute:"pedestrian_friendly",amenities:"groceries",character:"vibrant",nature:"parks",education:"high_schools"}),[D,B]=ve.exports.useState(),[G,ne]=ve.exports.useState(),[a,Y]=ve.exports.useState("commute"),ie=C[a],pe=te=>{A(ke=>({...ke,[a]:te}))},ue=ve.exports.useMemo(()=>({activeScore:ie,setActiveScore:pe,activeCategory:a,setActiveCategory:Y,activePOI:D,setActivePOI:B,hoveredPOI:G,setHoveredPOI:ne}),[ie,pe,a,Y,D,B,G,ne]);return Ze(np.Provider,{value:ue,children:b})},Wf=ve.exports.createContext(null);function Hf(b){const C=b.clone();return C.pixelsToGLUnits=b.pixelsToGLUnits,C}function Ih(b){return{longitude:b.center.lng,latitude:b.center.lat,zoom:b.zoom,pitch:b.pitch,bearing:b.bearing,padding:b.padding}}function Ch(b,C){const A=C.viewState||C;let D=!1;if("longitude"in A&&"latitude"in A){const B=b.center;b.center=new B.constructor(A.longitude,A.latitude),D=D||B!==b.center}if("zoom"in A){const B=b.zoom;b.zoom=A.zoom,D=D||B!==b.zoom}if("bearing"in A){const B=b.bearing;b.bearing=A.bearing,D=D||B!==b.bearing}if("pitch"in A){const B=b.pitch;b.pitch=A.pitch,D=D||B!==b.pitch}return A.padding&&!b.isPaddingEqual(A.padding)&&(D=!0,b.padding=A.padding),D}const Kf=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Ah(b){if(!b)return null;if(typeof b=="string"||("toJS"in b&&(b=b.toJS()),!b.layers))return b;const C={};for(const D of b.layers)C[D.id]=D;const A=b.layers.map(D=>{const B=C[D.ref];let G=null;if("interactive"in D&&(G={...D},delete G.interactive),B){G=G||{...D},delete G.ref;for(const ne of Kf)ne in B&&(G[ne]=B[ne])}return G||D});return{...b,layers:A}}function Jf(b,C){const A=Array.isArray(b)?b[0]:b?b.x:0,D=Array.isArray(b)?b[1]:b?b.y:0,B=Array.isArray(C)?C[0]:C?C.x:0,G=Array.isArray(C)?C[1]:C?C.y:0;return A===B&&D===G}function qn(b,C){if(b===C)return!0;if(!b||!C)return!1;if(Array.isArray(b)){if(!Array.isArray(C)||b.length!==C.length)return!1;for(let A=0;A<b.length;A++)if(!qn(b[A],C[A]))return!1;return!0}else if(Array.isArray(C))return!1;if(typeof b=="object"&&typeof C=="object"){const A=Object.keys(b),D=Object.keys(C);if(A.length!==D.length)return!1;for(const B of A)if(!C.hasOwnProperty(B)||!qn(b[B],C[B]))return!1;return!0}return!1}const Mh={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},Lc={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},Ph={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},Yf=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],Qf=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class ss{constructor(C,A,D){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=B=>{const G=this.props[Ph[B.type]];G&&G(B)},this._onPointerEvent=B=>{(B.type==="mousemove"||B.type==="mouseout")&&this._updateHover(B);const G=this.props[Mh[B.type]];if(G){if(this.props.interactiveLayerIds&&B.type!=="mouseover"&&B.type!=="mouseout"){const ne=this._hoveredFeatures||this._map.queryRenderedFeatures(B.point,{layers:this.props.interactiveLayerIds});B.features=ne}G(B),delete B.features}},this._onCameraEvent=B=>{if(!this._internalUpdate){const G=this.props[Lc[B.type]];G&&G(B)}B.type in this._deferredEvents&&(this._deferredEvents[B.type]=!1)},this._MapClass=C,this.props=A,this._initialize(D)}get map(){return this._map}get transform(){return this._renderTransform}setProps(C){const A=this.props;this.props=C;const D=this._updateSettings(C,A);D&&this._createShadowTransform(this._map);const B=this._updateSize(C),G=this._updateViewState(C,!0);this._updateStyle(C,A),this._updateStyleComponents(C,A),this._updateHandlers(C,A),(D||B||G&&!this._map.isMoving())&&this.redraw()}static reuse(C,A){const D=ss.savedMaps.pop();if(!D)return null;const B=D.map,G=B.getContainer();for(A.className=G.className;G.childNodes.length>0;)A.appendChild(G.childNodes[0]);B._container=A,D.setProps({...C,styleDiffing:!1}),B.resize();const{initialViewState:ne}=C;return ne&&(ne.bounds?B.fitBounds(ne.bounds,{...ne.fitBoundsOptions,duration:0}):D._updateViewState(ne,!1)),B.isStyleLoaded()?B.fire("load"):B.once("styledata",()=>B.fire("load")),D}_initialize(C){const{props:A}=this,D={...A,...A.initialViewState,accessToken:A.mapboxAccessToken||em()||null,container:C,style:Ah(A.mapStyle)},B=D.initialViewState||D.viewState||D;if(Object.assign(D,{center:[B.longitude||0,B.latitude||0],zoom:B.zoom||0,pitch:B.pitch||0,bearing:B.bearing||0}),A.gl){const ie=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=ie,A.gl)}const G=new this._MapClass(D);B.padding&&G.setPadding(B.padding),A.cursor&&(G.getCanvas().style.cursor=A.cursor),this._createShadowTransform(G);const ne=G._render;G._render=ie=>{this._inRender=!0,ne.call(G,ie),this._inRender=!1};const a=G._renderTaskQueue.run;G._renderTaskQueue.run=ie=>{a.call(G._renderTaskQueue,ie),this._onBeforeRepaint()},G.on("render",()=>this._onAfterRepaint());const Y=G.fire;G.fire=this._fireEvent.bind(this,Y),G.on("resize",()=>{this._renderTransform.resize(G.transform.width,G.transform.height)}),G.on("styledata",()=>this._updateStyleComponents(this.props,{})),G.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const ie in Mh)G.on(ie,this._onPointerEvent);for(const ie in Lc)G.on(ie,this._onCameraEvent);for(const ie in Ph)G.on(ie,this._onEvent);this._map=G}recycle(){ss.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const C=this._map;!this._inRender&&C.style&&(C._frame&&(C._frame.cancel(),C._frame=null),C._render())}_createShadowTransform(C){const A=Hf(C.transform);C.painter.transform=A,this._renderTransform=A}_updateSize(C){const{viewState:A}=C;if(A){const D=this._map;if(A.width!==D.transform.width||A.height!==D.transform.height)return D.resize(),!0}return!1}_updateViewState(C,A){if(this._internalUpdate)return!1;const D=this._map,B=this._renderTransform,{zoom:G,pitch:ne,bearing:a}=B,Y=D.isMoving();Y&&(B.cameraElevationReference="sea");const ie=Ch(B,{...Ih(D.transform),...C});if(Y&&(B.cameraElevationReference="ground"),ie&&A){const pe=this._deferredEvents;pe.move=!0,pe.zoom||(pe.zoom=G!==B.zoom),pe.rotate||(pe.rotate=a!==B.bearing),pe.pitch||(pe.pitch=ne!==B.pitch)}return Y||Ch(D.transform,C),ie}_updateSettings(C,A){const D=this._map;let B=!1;for(const G of Yf)G in C&&!qn(C[G],A[G])&&(B=!0,D[`set${G[0].toUpperCase()}${G.slice(1)}`](C[G]));return B}_updateStyle(C,A){if(C.cursor!==A.cursor&&(this._map.getCanvas().style.cursor=C.cursor),C.mapStyle!==A.mapStyle){const D={diff:C.styleDiffing};return"localIdeographFontFamily"in C&&(D.localIdeographFontFamily=C.localIdeographFontFamily),this._map.setStyle(Ah(C.mapStyle),D),!0}return!1}_updateStyleComponents(C,A){const D=this._map;let B=!1;return D.style.loaded()&&("light"in C&&!qn(C.light,A.light)&&(B=!0,D.setLight(C.light)),"fog"in C&&!qn(C.fog,A.fog)&&(B=!0,D.setFog(C.fog)),"terrain"in C&&!qn(C.terrain,A.terrain)&&(!C.terrain||D.getSource(C.terrain.source))&&(B=!0,D.setTerrain(C.terrain))),B}_updateHandlers(C,A){const D=this._map;let B=!1;for(const G of Qf){const ne=C[G];qn(ne,A[G])||(B=!0,ne?D[G].enable(ne):D[G].disable())}return B}_updateHover(C){var A;const{props:D}=this;if(D.interactiveLayerIds&&(D.onMouseMove||D.onMouseEnter||D.onMouseLeave)){const G=C.type,ne=((A=this._hoveredFeatures)===null||A===void 0?void 0:A.length)>0;let a;if(G==="mousemove")try{a=this._map.queryRenderedFeatures(C.point,{layers:D.interactiveLayerIds})}catch{a=[]}else a=[];const Y=a.length>0;!Y&&ne&&(C.type="mouseleave",this._onPointerEvent(C)),this._hoveredFeatures=a,Y&&!ne&&(C.type="mouseenter",this._onPointerEvent(C)),C.type=G}else this._hoveredFeatures=null}_fireEvent(C,A,D){const B=this._map,G=B.transform,ne=typeof A=="string"?A:A.type;return ne==="move"&&this._updateViewState(this.props,!1),ne in Lc&&(typeof A=="object"&&(A.viewState=Ih(G)),this._map.isMoving())?(B.transform=this._renderTransform,C.call(B,A,D),B.transform=G,B):(C.call(B,A,D),B)}_onBeforeRepaint(){const C=this._map;this._internalUpdate=!0;for(const D in this._deferredEvents)this._deferredEvents[D]&&C.fire(D);this._internalUpdate=!1;const A=this._map.transform;this._map.transform=this._renderTransform,this._onAfterRepaint=()=>{this._map.transform=A}}}ss.savedMaps=[];function em(){let b=null;if(typeof location!="undefined"){const C=/access_token=([^&\/]*)/.exec(location.search);b=C&&C[1]}try{b=b||{}.MapboxAccessToken}catch{}try{b=b||{}.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return b}const tm=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function im(b,C){if(!b)return null;const A=b.map,D={getMap:()=>A,getCenter:()=>b.transform.center,getZoom:()=>b.transform.zoom,getBearing:()=>b.transform.bearing,getPitch:()=>b.transform.pitch,getPadding:()=>b.transform.padding,getBounds:()=>b.transform.getBounds(),project:B=>b.transform.locationPoint(C.LngLat.convert(B)),unproject:B=>b.transform.pointLocation(C.Point.convert(B)),queryTerrainElevation:(B,G)=>{const ne=A.transform;A.transform=b.transform;const a=A.queryTerrainElevation(B,G);return A.transform=ne,a}};for(const B of rm(A))!(B in D)&&!tm.includes(B)&&(D[B]=A[B].bind(A));return D}function rm(b){const C=new Set;let A=b;for(;A;){for(const D of Object.getOwnPropertyNames(A))D[0]!=="_"&&typeof b[D]=="function"&&D!=="fire"&&D!=="setEventedParent"&&C.add(D);A=Object.getPrototypeOf(A)}return Array.from(C)}const nm=typeof document!="undefined"?ve.exports.useLayoutEffect:ve.exports.useEffect,om=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function sm(b,C){for(const A of om)A in C&&(b[A]=C[A]);C.RTLTextPlugin&&b.getRTLTextPluginStatus&&b.getRTLTextPluginStatus()==="unavailable"&&b.setRTLTextPlugin(C.RTLTextPlugin,A=>{A&&console.error(A)},!1)}const Il=ve.exports.createContext(null),am={minZoom:0,maxZoom:22,minPitch:0,maxPitch:60,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,mapStyle:{version:8,sources:{},layers:[]},styleDiffing:!0,projection:"mercator",renderWorldCopies:!0,onError:b=>console.error(b.error),RTLTextPlugin:"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"},Hc=ve.exports.forwardRef((b,C)=>{const A=ve.exports.useContext(Wf),[D,B]=ve.exports.useState(null),G=ve.exports.useRef(),{current:ne}=ve.exports.useRef({mapLib:null,map:null});ve.exports.useEffect(()=>{const Y=b.mapLib;let ie=!0,pe;return Promise.resolve(Y||Df(()=>import("./index.c629d6a1.js").then(function(ue){return ue.i}),[])).then(ue=>{if(!!ie){if(ue.Map||(ue=ue.default),!ue||!ue.Map)throw new Error("Invalid mapLib");if(ue.supported(b))sm(ue,b),b.reuseMaps&&(pe=ss.reuse(b,G.current)),pe||(pe=new ss(ue.Map,b,G.current)),ne.map=im(pe,ue),ne.mapLib=ue,B(pe),A==null||A.onMapMount(ne.map,b.id);else throw new Error("Map is not supported by this browser")}}).catch(ue=>{b.onError({type:"error",target:null,originalEvent:null,error:ue})}),()=>{ie=!1,pe&&(A==null||A.onMapUnmount(b.id),b.reuseMaps?pe.recycle():pe.destroy())}},[]),nm(()=>{D&&D.setProps(b)}),ve.exports.useImperativeHandle(C,()=>ne.map,[D]);const a=ve.exports.useMemo(()=>({position:"relative",width:"100%",height:"100%",...b.style}),[b.style]);return ve.exports.createElement("div",{id:b.id,ref:G,style:a},D&&ve.exports.createElement(Il.Provider,{value:ne},b.children))});Hc.displayName="Map";Hc.defaultProps=am;const lm=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function Io(b,C){if(!b||!C)return;const A=b.style;for(const D in C){const B=C[D];Number.isFinite(B)&&!lm.test(D)?A[D]=`${B}px`:A[D]=B}}const cm={draggable:!1,popup:null,rotation:0,rotationAlignment:"auto",pitchAlignment:"auto"};function op(b){const{map:C,mapLib:A}=ve.exports.useContext(Il),D=ve.exports.useRef({props:b});D.current.props=b;const B=ve.exports.useMemo(()=>{let G=!1;ve.exports.Children.forEach(b.children,Y=>{Y&&(G=!0)});const ne={...b,element:G?document.createElement("div"):null},a=new A.Marker(ne).setLngLat([b.longitude,b.latitude]);return a.getElement().addEventListener("click",Y=>{var ie,pe;(pe=(ie=D.current.props).onClick)===null||pe===void 0||pe.call(ie,{type:"click",target:a,originalEvent:Y})}),a.on("dragstart",Y=>{var ie,pe;const ue=Y;ue.lngLat=B.getLngLat(),(pe=(ie=D.current.props).onDragStart)===null||pe===void 0||pe.call(ie,ue)}),a.on("drag",Y=>{var ie,pe;const ue=Y;ue.lngLat=B.getLngLat(),(pe=(ie=D.current.props).onDrag)===null||pe===void 0||pe.call(ie,ue)}),a.on("dragend",Y=>{var ie,pe;const ue=Y;ue.lngLat=B.getLngLat(),(pe=(ie=D.current.props).onDragEnd)===null||pe===void 0||pe.call(ie,ue)}),a},[]);return ve.exports.useEffect(()=>(B.addTo(C.getMap()),()=>{B.remove()}),[]),ve.exports.useEffect(()=>{Io(B.getElement(),b.style)},[b.style]),(B.getLngLat().lng!==b.longitude||B.getLngLat().lat!==b.latitude)&&B.setLngLat([b.longitude,b.latitude]),b.offset&&!Jf(B.getOffset(),b.offset)&&B.setOffset(b.offset),B.isDraggable()!==b.draggable&&B.setDraggable(b.draggable),B.getRotation()!==b.rotation&&B.setRotation(b.rotation),B.getRotationAlignment()!==b.rotationAlignment&&B.setRotationAlignment(b.rotationAlignment),B.getPitchAlignment()!==b.pitchAlignment&&B.setPitchAlignment(b.pitchAlignment),B.getPopup()!==b.popup&&B.setPopup(b.popup),Kh.exports.createPortal(b.children,B.getElement())}op.defaultProps=cm;var Rc=ve.exports.memo(op);function zh(b){return new Set(b?b.trim().split(/\s+/):[])}function um(b){const{map:C,mapLib:A}=ve.exports.useContext(Il),D=ve.exports.useMemo(()=>document.createElement("div"),[]),B=ve.exports.useRef({props:b});B.current.props=b;const G=ve.exports.useMemo(()=>{const ne={...b},a=new A.Popup(ne).setLngLat([b.longitude,b.latitude]);return a.once("open",Y=>{var ie,pe;(pe=(ie=B.current.props).onOpen)===null||pe===void 0||pe.call(ie,Y)}),a},[]);if(ve.exports.useEffect(()=>{const ne=a=>{var Y,ie;(ie=(Y=B.current.props).onClose)===null||ie===void 0||ie.call(Y,a)};return G.on("close",ne),G.setDOMContent(D).addTo(C.getMap()),()=>{G.off("close",ne),G.isOpen()&&G.remove()}},[]),ve.exports.useEffect(()=>{Io(G.getElement(),b.style)},[b.style]),G.isOpen()&&((G.getLngLat().lng!==b.longitude||G.getLngLat().lat!==b.latitude)&&G.setLngLat([b.longitude,b.latitude]),b.offset&&!qn(G.options.offset,b.offset)&&G.setOffset(b.offset),(G.options.anchor!==b.anchor||G.options.maxWidth!==b.maxWidth)&&(G.options.anchor=b.anchor,G.setMaxWidth(b.maxWidth)),G.options.className!==b.className)){const ne=zh(G.options.className),a=zh(b.className);for(const Y of ne)a.has(Y)||G.removeClassName(Y);for(const Y of a)ne.has(Y)||G.addClassName(Y);G.options.className=b.className}return Kh.exports.createPortal(b.children,D)}ve.exports.memo(um);function ha(b,C,A,D){const B=ve.exports.useContext(Il),G=ve.exports.useMemo(()=>b(B),[]);return ve.exports.useEffect(()=>{const ne=D||A||C,a=typeof C=="function"&&typeof A=="function"?C:null,Y=typeof A=="function"?A:typeof C=="function"?C:null,{map:ie}=B;return ie.hasControl(G)||(ie.addControl(G,ne==null?void 0:ne.position),a&&a(B)),()=>{Y&&Y(B),ie.hasControl(G)&&ie.removeControl(G)}},[]),G}function hm(b){const C=ha(({mapLib:A})=>new A.AttributionControl(b),{position:b.position});return ve.exports.useEffect(()=>{Io(C._container,b.style)},[b.style]),null}ve.exports.memo(hm);function pm(b){const C=ha(({mapLib:A})=>new A.FullscreenControl({container:b.containerId&&document.getElementById(b.containerId)}),{position:b.position});return ve.exports.useEffect(()=>{Io(C._controlContainer,b.style)},[b.style]),null}ve.exports.memo(pm);const sp=ve.exports.forwardRef((b,C)=>{const A=ve.exports.useRef({props:b}),D=ha(({mapLib:B})=>{const G=new B.GeolocateControl(b),ne=G._setupUI;return G._setupUI=a=>{G._container.hasChildNodes()||ne(a)},G.on("geolocate",a=>{var Y,ie;(ie=(Y=A.current.props).onGeolocate)===null||ie===void 0||ie.call(Y,a)}),G.on("error",a=>{var Y,ie;(ie=(Y=A.current.props).onError)===null||ie===void 0||ie.call(Y,a)}),G.on("outofmaxbounds",a=>{var Y,ie;(ie=(Y=A.current.props).onOutOfMaxBounds)===null||ie===void 0||ie.call(Y,a)}),G.on("trackuserlocationstart",a=>{var Y,ie;(ie=(Y=A.current.props).onTrackUserLocationStart)===null||ie===void 0||ie.call(Y,a)}),G.on("trackuserlocationend",a=>{var Y,ie;(ie=(Y=A.current.props).onTrackUserLocationEnd)===null||ie===void 0||ie.call(Y,a)}),G},{position:b.position});return A.current.props=b,ve.exports.useImperativeHandle(C,()=>({trigger:()=>D.trigger()}),[]),ve.exports.useEffect(()=>{Io(D._container,b.style)},[b.style]),null});sp.displayName="GeolocateControl";ve.exports.memo(sp);function dm(b){const C=ha(({mapLib:A})=>new A.NavigationControl(b),{position:b.position});return ve.exports.useEffect(()=>{Io(C._container,b.style)},[b.style]),null}var fm=ve.exports.memo(dm);const mm={unit:"metric",maxWidth:100};function ap(b){const C=ha(({mapLib:A})=>new A.ScaleControl(b),{position:b.position});return(C.options.unit!==b.unit||C.options.maxWidth!==b.maxWidth)&&(C.options.maxWidth=b.maxWidth,C.setUnit(b.unit)),ve.exports.useEffect(()=>{Io(C._container,b.style)},[b.style]),null}ap.defaultProps=mm;ve.exports.memo(ap);var lp={exports:{}};(function(b,C){(function(A,D){b.exports=D()})(aa,function(){var A,D,B;function G(a,Y){if(!A)A=Y;else if(!D)D=Y;else{var ie="var sharedChunk = {}; ("+A+")(sharedChunk); ("+D+")(sharedChunk);",pe={};A(pe),B=Y(pe),typeof window!="undefined"&&(B.workerUrl=window.URL.createObjectURL(new Blob([ie],{type:"text/javascript"})))}}G(["exports"],function(a){var Y=ie;function ie(i,e,r,o){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(o-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=o}function pe(i,e,r,o){const c=new Y(i,e,r,o);return function(h){return c.solve(h)}}ie.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,o=0;o<8;o++){var c=this.sampleCurveX(r)-i;if(Math.abs(c)<e)return r;var h=this.sampleCurveDerivativeX(r);if(Math.abs(h)<1e-6)break;r-=c/h}var d=0,m=1;for(r=i,o=0;o<20&&(c=this.sampleCurveX(r),!(Math.abs(c-i)<e));o++)i>c?d=r:m=r,r=.5*(m-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};const ue=pe(.25,.1,.25,1);function te(i,e,r){return Math.min(r,Math.max(e,i))}function ke(i,e,r){const o=r-e,c=((i-e)%o+o)%o+e;return c===e?r:c}function Se(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}let Ie=1;function Ye(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function tt(i,e,r){const o={};for(const c in i)o[c]=e.call(r||this,i[c],c,i);return o}function Qe(i,e,r){const o={};for(const c in i)e.call(r||this,i[c],c,i)&&(o[c]=i[c]);return o}function dt(i){return Array.isArray(i)?i.map(dt):typeof i=="object"&&i?tt(i,dt):i}const It={};function ht(i){It[i]||(typeof console!="undefined"&&console.warn(i),It[i]=!0)}function xt(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Xt(i){let e=0;for(let r,o,c=0,h=i.length,d=h-1;c<h;d=c++)r=i[c],o=i[d],e+=(o.x-r.x)*(r.y+o.y);return e}function gt(){return typeof WorkerGlobalScope!="undefined"&&typeof self!="undefined"&&self instanceof WorkerGlobalScope}function xi(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,o,c,h)=>{const d=c||h;return e[o]=!d||d.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}let zi,_t,Wt=null;function ei(i){if(Wt==null){const e=i.navigator?i.navigator.userAgent:null;Wt=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Wt}function Ht(i){return typeof ImageBitmap!="undefined"&&i instanceof ImageBitmap}const Kt={now:typeof performance!="undefined"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){const r=window.document.createElement("canvas"),o=r.getContext("2d");if(!o)throw new Error("failed to create canvas 2d context");return r.width=i.width,r.height=i.height,o.drawImage(i,0,0,i.width,i.height),o.getImageData(-e,-e,i.width+2*e,i.height+2*e)},resolveURL:i=>(zi||(zi=document.createElement("a")),zi.href=i,zi.href),hardwareConcurrency:typeof navigator!="undefined"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(_t==null&&(_t=matchMedia("(prefers-reduced-motion: reduce)")),_t.matches)}};var He=vi;function vi(i,e){this.x=i,this.y=e}vi.prototype={clone:function(){return new vi(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),o=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=o,this},_rotateAround:function(i,e){var r=Math.cos(i),o=Math.sin(i),c=e.y+o*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-o*(this.y-e.y),this.y=c,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},vi.convert=function(i){return i instanceof vi?i:Array.isArray(i)?new vi(i[0],i[1]):i};const ki={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},Ii="mapbox-tiles";let Di,Hr,mn=500,gn=50;function _n(){typeof caches=="undefined"||Di||(Di=caches.open(Ii))}let ur=1/0;const kr={supported:!1,testSupport:function(i){!Li&&Lr&&(yn?Zn(i):Dr=i)}};let Dr,Lr,Li=!1,yn=!1;function Zn(i){const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,Lr),i.isContextLost())return;kr.supported=!0}catch{}i.deleteTexture(e),Li=!0}typeof document!="undefined"&&(Lr=document.createElement("img"),Lr.onload=function(){Dr&&Zn(Dr),Dr=null,yn=!0},Lr.onerror=function(){Li=!0,Dr=null},Lr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const vr={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(vr);class $i extends Error{constructor(e,r,o,c){super(`AJAXError: ${r} (${e}): ${o}`),this.status=e,this.statusText=r,this.url=o,this.body=c}}const jn=gt()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function Rr(i,e){const r=new AbortController,o=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:jn(),signal:r.signal});let c=!1,h=!1;return i.type==="json"&&o.headers.set("Accept","application/json"),((d,m,g)=>{if(h)return;const x=Date.now();fetch(o).then(T=>T.ok?((S,P,k)=>{(i.type==="arrayBuffer"?S.arrayBuffer():i.type==="json"?S.json():S.text()).then(L=>{h||(P&&k&&function(Z,q,re){if(_n(),!Di)return;const ce={status:q.status,statusText:q.statusText,headers:new Headers};q.headers.forEach((ae,xe)=>ce.headers.set(xe,ae));const ee=xi(q.headers.get("Cache-Control")||"");ee["no-store"]||(ee["max-age"]&&ce.headers.set("Expires",new Date(re+1e3*ee["max-age"]).toUTCString()),new Date(ce.headers.get("Expires")).getTime()-re<42e4||function(ae,xe){if(Hr===void 0)try{new Response(new ReadableStream),Hr=!0}catch{Hr=!1}Hr?xe(ae.body):ae.blob().then(xe)}(q,ae=>{const xe=new Response(ae,ce);_n(),Di&&Di.then(ye=>ye.put(function(Ue){const Ne=Ue.indexOf("?");return Ne<0?Ue:Ue.slice(0,Ne)}(Z.url),xe)).catch(ye=>ht(ye.message))}))}(o,P,k),c=!0,e(null,L,S.headers.get("Cache-Control"),S.headers.get("Expires")))}).catch(L=>{h||e(new Error(L.message))})})(T,null,x):T.blob().then(S=>e(new $i(T.status,T.statusText,i.url,S)))).catch(T=>{T.code!==20&&e(new Error(T.message))})})(),{cancel:()=>{h=!0,c||r.abort()}}}const xn=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(gt()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!gt()){const o=i.url.substring(0,i.url.indexOf("://"));return(ki.REGISTERED_PROTOCOLS[o]||Rr)(i,e)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(jn())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Rr(i,e);if(gt()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(o,c){const h=new XMLHttpRequest;h.open(o.method||"GET",o.url,!0),o.type==="arrayBuffer"&&(h.responseType="arraybuffer");for(const d in o.headers)h.setRequestHeader(d,o.headers[d]);return o.type==="json"&&(h.responseType="text",h.setRequestHeader("Accept","application/json")),h.withCredentials=o.credentials==="include",h.onerror=()=>{c(new Error(h.statusText))},h.onload=()=>{if((h.status>=200&&h.status<300||h.status===0)&&h.response!==null){let d=h.response;if(o.type==="json")try{d=JSON.parse(h.response)}catch(m){return c(m)}c(null,d,h.getResponseHeader("Cache-Control"),h.getResponseHeader("Expires"))}else{const d=new Blob([h.response],{type:h.getResponseHeader("Content-Type")});c(new $i(h.status,h.statusText,o.url,d))}},h.send(o.body),{cancel:()=>h.abort()}}(i,e)},vn=function(i,e){return xn(Se(i,{type:"arrayBuffer"}),e)};function Xn(i){const e=window.document.createElement("a");return e.href=i,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const vt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let hr,Br;hr=[],Br=0;const Fr=function(i,e){if(kr.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),Br>=ki.MAX_PARALLEL_IMAGE_REQUESTS){const h={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return hr.push(h),h}Br++;let r=!1;const o=()=>{if(!r)for(r=!0,Br--;hr.length&&Br<ki.MAX_PARALLEL_IMAGE_REQUESTS;){const h=hr.shift(),{requestParameters:d,callback:m,cancelled:g}=h;g||(h.cancel=Fr(d,m).cancel)}},c=vn(i,(h,d,m,g)=>{o(),h?e(h):d&&function(x,T){typeof createImageBitmap=="function"?function(S,P){const k=new Blob([new Uint8Array(S)],{type:"image/png"});createImageBitmap(k).then(L=>{P(null,L)}).catch(L=>{P(new Error(`Could not load image because of ${L.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(x,T):function(S,P){const k=new Image;k.onload=()=>{P(null,k),URL.revokeObjectURL(k.src),k.onload=null,window.requestAnimationFrame(()=>{k.src=vt})},k.onerror=()=>P(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 L=new Blob([new Uint8Array(S)],{type:"image/png"});k.src=S.byteLength?URL.createObjectURL(L):vt}(x,T)}(d,(x,T)=>{x!=null?e(x):T!=null&&e(null,T,{cacheControl:m,expires:g})})});return{cancel:()=>{c.cancel(),o()}}};function Wn(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function br(i,e,r){if(r&&r[i]){const o=r[i].indexOf(e);o!==-1&&r[i].splice(o,1)}}class wr{constructor(e,r={}){Se(this,r),this.type=e}}class bn extends wr{constructor(e,r={}){super("error",Se({error:e},r))}}class Tr{on(e,r){return this._listeners=this._listeners||{},Wn(e,r,this._listeners),this}off(e,r){return br(e,r,this._listeners),br(e,r,this._oneTimeListeners),this}once(e,r){return this._oneTimeListeners=this._oneTimeListeners||{},Wn(e,r,this._oneTimeListeners),this}fire(e,r){typeof e=="string"&&(e=new wr(e,r||{}));const o=e.type;if(this.listens(o)){e.target=this;const c=this._listeners&&this._listeners[o]?this._listeners[o].slice():[];for(const m of c)m.call(this,e);const h=this._oneTimeListeners&&this._oneTimeListeners[o]?this._oneTimeListeners[o].slice():[];for(const m of h)br(o,m,this._oneTimeListeners),m.call(this,e);const d=this._eventedParent;d&&(Se(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof bn&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var _e={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},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},"*":{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:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},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:{},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_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"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","property-type":"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","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"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-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","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},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:"*",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}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","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"]},"property-type":"cross-faded"},"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"},"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:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},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"}}};class Pe{constructor(e,r,o,c){this.message=(e?`${e}: `:"")+o,c&&(this.identifier=c),r!=null&&r.__line__&&(this.line=r.__line__)}}function Kr(i){const e=i.value;return e?[new Pe(i.key,e,"constants have been deprecated as of v8")]:[]}function ir(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}function bt(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Ji(i){if(Array.isArray(i))return i.map(Ji);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=Ji(i[r]);return e}return bt(i)}class Vi extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class Ni{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[o,c]of r)this.bindings[o]=c}concat(e){return new Ni(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 Or={kind:"null"},Ce={kind:"number"},at={kind:"string"},nt={kind:"boolean"},gi={kind:"color"},Ur={kind:"object"},rt={kind:"value"},Er={kind:"collator"},li={kind:"formatted"},wn={kind:"padding"},ti={kind:"resolvedImage"};function Ci(i,e){return{kind:"array",itemType:i,N:e}}function kt(i){if(i.kind==="array"){const e=kt(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const Tn=[Or,Ce,at,nt,gi,li,Ur,Ci(rt),wn,ti];function pr(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!pr(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of Tn)if(!pr(r,e))return null}}return`Expected ${kt(i)} but found ${kt(e)} instead.`}function Jr(i,e){return e.some(r=>r.kind===i.kind)}function Yr(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}var En,Qr={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function O(i){return(i=Math.round(i))<0?0:i>255?255:i}function w(i){return O(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function I(i){return(e=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:e>1?1:e;var e}function R(i,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?i+(e-i)*r*6:2*r<1?e:3*r<2?i+(e-i)*(2/3-r)*6:i}try{En={}.parseCSSColor=function(i){var e,r=i.replace(/ /g,"").toLowerCase();if(r in Qr)return Qr[r].slice();if(r[0]==="#")return r.length===4?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:r.length===7&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var o=r.indexOf("("),c=r.indexOf(")");if(o!==-1&&c+1===r.length){var h=r.substr(0,o),d=r.substr(o+1,c-(o+1)).split(","),m=1;switch(h){case"rgba":if(d.length!==4)return null;m=I(d.pop());case"rgb":return d.length!==3?null:[w(d[0]),w(d[1]),w(d[2]),m];case"hsla":if(d.length!==4)return null;m=I(d.pop());case"hsl":if(d.length!==3)return null;var g=(parseFloat(d[0])%360+360)%360/360,x=I(d[1]),T=I(d[2]),S=T<=.5?T*(x+1):T+x-T*x,P=2*T-S;return[O(255*R(P,S,g+1/3)),O(255*R(P,S,g)),O(255*R(P,S,g-1/3)),m];default:return null}}return null}}catch{}class F{constructor(e,r,o,c=1){this.r=e,this.g=r,this.b=o,this.a=c}static parse(e){if(!e)return;if(e instanceof F)return e;if(typeof e!="string")return;const r=En(e);return r?new F(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){const[e,r,o,c]=this.toArray();return`rgba(${Math.round(e)},${Math.round(r)},${Math.round(o)},${c})`}toArray(){const{r:e,g:r,b:o,a:c}=this;return c===0?[0,0,0,0]:[255*e/c,255*r/c,255*o/c,c]}}F.black=new F(0,0,0,1),F.white=new F(1,1,1,1),F.transparent=new F(0,0,0,0),F.red=new F(1,0,0,1);class j{constructor(e,r,o){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=o,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class K{constructor(e,r,o,c,h){this.text=e,this.image=r,this.scale=o,this.fontStack=c,this.textColor=h}}class W{constructor(e){this.sections=e}static fromString(e){return new W([new K(e,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 W?e:W.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class X{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof X)return e;if(typeof e=="number")return new X([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="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 X(e)}}toString(){return JSON.stringify(this.values)}}class J{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new J({name:e,available:!1}):null}}function de(i,e,r,o){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?o===void 0||typeof o=="number"&&o>=0&&o<=1?null:`Invalid rgba value [${[i,e,r,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof o=="number"?[i,e,r,o]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function be(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof F||i instanceof j||i instanceof W||i instanceof X||i instanceof J)return!0;if(Array.isArray(i)){for(const e of i)if(!be(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!be(i[e]))return!1;return!0}return!1}function he(i){if(i===null)return Or;if(typeof i=="string")return at;if(typeof i=="boolean")return nt;if(typeof i=="number")return Ce;if(i instanceof F)return gi;if(i instanceof j)return Er;if(i instanceof W)return li;if(i instanceof X)return wn;if(i instanceof J)return ti;if(Array.isArray(i)){const e=i.length;let r;for(const o of i){const c=he(o);if(r){if(r===c)continue;r=rt;break}r=c}return Ci(r||rt,e)}return Ur}function Ve(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof F||i instanceof W||i instanceof X||i instanceof J?i.toString():JSON.stringify(i)}class Ge{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!be(e[1]))return r.error("invalid value");const o=e[1];let c=he(o);const h=r.expectedType;return c.kind!=="array"||c.N!==0||!h||h.kind!=="array"||typeof h.N=="number"&&h.N!==0||(c=h),new Ge(c,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Be{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Ke={string:at,number:Ce,boolean:nt,object:Ur};class et{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let o,c=1;const h=e[0];if(h==="array"){let m,g;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in Ke)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=Ke[x],c++}else m=rt;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=e[2],c++}o=Ci(m,g)}else{if(!Ke[h])throw new Error(`Types doesn't contain name = ${h}`);o=Ke[h]}const d=[];for(;c<e.length;c++){const m=r.parse(e[c],c,rt);if(!m)return null;d.push(m)}return new et(o,d)}evaluate(e){for(let r=0;r<this.args.length;r++){const o=this.args[r].evaluate(e);if(!pr(this.type,he(o)))return o;if(r===this.args.length-1)throw new Be(`Expected value to be of type ${kt(this.type)}, but found ${kt(he(o))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const wt={"to-boolean":nt,"to-color":gi,"to-number":Ce,"to-string":at};class it{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const o=e[0];if(!wt[o])throw new Error(`Can't parse ${o} as it is not part of the known types`);if((o==="to-boolean"||o==="to-string")&&e.length!==2)return r.error("Expected one argument.");const c=wt[o],h=[];for(let d=1;d<e.length;d++){const m=r.parse(e[d],d,rt);if(!m)return null;h.push(m)}return new it(c,h)}evaluate(e){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(e));if(this.type.kind==="color"){let r,o;for(const c of this.args){if(r=c.evaluate(e),o=null,r instanceof F)return r;if(typeof r=="string"){const h=e.parseColor(r);if(h)return h}else if(Array.isArray(r)&&(o=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:de(r[0],r[1],r[2],r[3]),!o))return new F(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Be(o||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="padding"){let r;for(const o of this.args){r=o.evaluate(e);const c=X.parse(r);if(c)return c}throw new Be(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="number"){let r=null;for(const o of this.args){if(r=o.evaluate(e),r===null)return 0;const c=Number(r);if(!isNaN(c))return c}throw new Be(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?W.fromString(Ve(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?J.fromString(Ve(this.args[0].evaluate(e))):Ve(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const lt=["Unknown","Point","LineString","Polygon"];class Tt{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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"?lt[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 r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=F.parse(e)),r}}class Lt{constructor(e,r,o,c){this.name=e,this.type=r,this._evaluate=o,this.args=c}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const o=e[0],c=Lt.definitions[o];if(!c)return r.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0);const h=Array.isArray(c)?c[0]:c.type,d=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,m=d.filter(([x])=>!Array.isArray(x)||x.length===e.length-1);let g=null;for(const[x,T]of m){g=new Cn(r.registry,r.path,null,r.scope);const S=[];let P=!1;for(let k=1;k<e.length;k++){const L=e[k],Z=Array.isArray(x)?x[k-1]:x.type,q=g.parse(L,1+S.length,Z);if(!q){P=!0;break}S.push(q)}if(!P)if(Array.isArray(x)&&x.length!==S.length)g.error(`Expected ${x.length} arguments, but found ${S.length} instead.`);else{for(let k=0;k<S.length;k++){const L=Array.isArray(x)?x[k]:x.type,Z=S[k];g.concat(k+1).checkSubtype(L,Z.type)}if(g.errors.length===0)return new Lt(o,h,T,S)}}if(m.length===1)r.errors.push(...g.errors);else{const x=(m.length?m:d).map(([S])=>{return P=S,Array.isArray(P)?`(${P.map(kt).join(", ")})`:`(${kt(P.type)}...)`;var P}).join(" | "),T=[];for(let S=1;S<e.length;S++){const P=r.parse(e[S],1+T.length);if(!P)return null;T.push(kt(P.type))}r.error(`Expected arguments of type ${x}, but found (${T.join(", ")}) instead.`)}return null}static register(e,r){Lt.definitions=r;for(const o in r)e[o]=Lt}}class ci{constructor(e,r,o){this.type=Er,this.locale=o,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const o=e[1];if(typeof o!="object"||Array.isArray(o))return r.error("Collator options argument must be an object.");const c=r.parse(o["case-sensitive"]!==void 0&&o["case-sensitive"],1,nt);if(!c)return null;const h=r.parse(o["diacritic-sensitive"]!==void 0&&o["diacritic-sensitive"],1,nt);if(!h)return null;let d=null;return o.locale&&(d=r.parse(o.locale,1,at),!d)?null:new ci(c,h,d)}evaluate(e){return new j(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}}const $t=8192;function bi(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function Sn(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Hn(i,e){const r=(180+i[0])/360,o=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,c=Math.pow(2,e.z);return[Math.round(r*c*$t),Math.round(o*c*$t)]}function Rt(i,e,r){const o=i[0]-e[0],c=i[1]-e[1],h=i[0]-r[0],d=i[1]-r[1];return o*d-h*c==0&&o*h<=0&&c*d<=0}function ls(i,e){let r=!1;for(let d=0,m=e.length;d<m;d++){const g=e[d];for(let x=0,T=g.length;x<T-1;x++){if(Rt(i,g[x],g[x+1]))return!1;(c=g[x])[1]>(o=i)[1]!=(h=g[x+1])[1]>o[1]&&o[0]<(h[0]-c[0])*(o[1]-c[1])/(h[1]-c[1])+c[0]&&(r=!r)}}var o,c,h;return r}function cs(i,e){for(let r=0;r<e.length;r++)if(ls(i,e[r]))return!0;return!1}function da(i,e,r,o){const c=o[0]-r[0],h=o[1]-r[1],d=(i[0]-r[0])*h-c*(i[1]-r[1]),m=(e[0]-r[0])*h-c*(e[1]-r[1]);return d>0&&m<0||d<0&&m>0}function fa(i,e,r){for(const x of r)for(let T=0;T<x.length-1;++T)if((m=[(d=x[T+1])[0]-(h=x[T])[0],d[1]-h[1]])[0]*(g=[(c=e)[0]-(o=i)[0],c[1]-o[1]])[1]-m[1]*g[0]!=0&&da(o,c,h,d)&&da(h,d,o,c))return!0;var o,c,h,d,m,g;return!1}function us(i,e){for(let r=0;r<i.length;++r)if(!ls(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(fa(i[r],i[r+1],e))return!1;return!0}function Al(i,e){for(let r=0;r<e.length;r++)if(us(i,e[r]))return!0;return!1}function Co(i,e,r){const o=[];for(let c=0;c<i.length;c++){const h=[];for(let d=0;d<i[c].length;d++){const m=Hn(i[c][d],r);bi(e,m),h.push(m)}o.push(h)}return o}function hs(i,e,r){const o=[];for(let c=0;c<i.length;c++){const h=Co(i[c],e,r);o.push(h)}return o}function ma(i,e,r,o){if(i[0]<r[0]||i[0]>r[2]){const c=.5*o;let h=i[0]-r[0]>c?-o:r[0]-i[0]>c?o:0;h===0&&(h=i[0]-r[2]>c?-o:r[2]-i[0]>c?o:0),i[0]+=h}bi(e,i)}function ga(i,e,r,o){const c=Math.pow(2,o.z)*$t,h=[o.x*$t,o.y*$t],d=[];for(const m of i)for(const g of m){const x=[g.x+h[0],g.y+h[1]];ma(x,e,r,c),d.push(x)}return d}function _a(i,e,r,o){const c=Math.pow(2,o.z)*$t,h=[o.x*$t,o.y*$t],d=[];for(const g of i){const x=[];for(const T of g){const S=[T.x+h[0],T.y+h[1]];bi(e,S),x.push(S)}d.push(x)}if(e[2]-e[0]<=c/2){(m=e)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const g of d)for(const x of g)ma(x,e,r,c)}var m;return d}class en{constructor(e,r){this.type=nt,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(be(e[1])){const o=e[1];if(o.type==="FeatureCollection")for(let c=0;c<o.features.length;++c){const h=o.features[c].geometry.type;if(h==="Polygon"||h==="MultiPolygon")return new en(o,o.features[c].geometry)}else if(o.type==="Feature"){const c=o.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new en(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new en(o,o)}return r.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(r,o){const c=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(o.type==="Polygon"){const m=Co(o.coordinates,h,d),g=ga(r.geometry(),c,h,d);if(!Sn(c,h))return!1;for(const x of g)if(!ls(x,m))return!1}if(o.type==="MultiPolygon"){const m=hs(o.coordinates,h,d),g=ga(r.geometry(),c,h,d);if(!Sn(c,h))return!1;for(const x of g)if(!cs(x,m))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,o){const c=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(o.type==="Polygon"){const m=Co(o.coordinates,h,d),g=_a(r.geometry(),c,h,d);if(!Sn(c,h))return!1;for(const x of g)if(!us(x,m))return!1}if(o.type==="MultiPolygon"){const m=hs(o.coordinates,h,d),g=_a(r.geometry(),c,h,d);if(!Sn(c,h))return!1;for(const x of g)if(!Al(x,m))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}function Kn(i){if(i instanceof Lt&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof en)return!1;let e=!0;return i.eachChild(r=>{e&&!Kn(r)&&(e=!1)}),e}function In(i){if(i instanceof Lt&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!In(r)&&(e=!1)}),e}function Ao(i,e){if(i instanceof Lt&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(o=>{r&&!Ao(o,e)&&(r=!1)}),r}class Mo{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const o=e[1];return r.scope.has(o)?new Mo(o,r.scope.get(o)):r.error(`Unknown variable "${o}". Make sure "${o}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Cn{constructor(e,r=[],o,c=new Ni,h=[]){this.registry=e,this.path=r,this.key=r.map(d=>`[${d}]`).join(""),this.scope=c,this.errors=h,this.expectedType=o}parse(e,r,o,c,h={}){return r?this.concat(r,o,c)._parse(e,h):this._parse(e,h)}_parse(e,r){function o(c,h,d){return d==="assert"?new et(h,[c]):d==="coerce"?new it(h,[c]):c}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 c=e[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const h=this.registry[c];if(h){let d=h.parse(e,this);if(!d)return null;if(this.expectedType){const m=this.expectedType,g=d.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||g.kind!=="value")if(m.kind!=="color"&&m.kind!=="formatted"&&m.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(m.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array"){if(this.checkSubtype(m,g))return null}else d=o(d,m,r.typeAnnotation||"coerce");else d=o(d,m,r.typeAnnotation||"coerce");else d=o(d,m,r.typeAnnotation||"assert")}if(!(d instanceof Ge)&&d.type.kind!=="resolvedImage"&&ps(d)){const m=new Tt;try{d=new Ge(d.type,d.evaluate(m))}catch(g){return this.error(g.message),null}}return d}return this.error(`Unknown expression "${c}". 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,r,o){const c=typeof e=="number"?this.path.concat(e):this.path,h=o?this.scope.concat(o):this.scope;return new Cn(this.registry,c,r||null,h,this.errors)}error(e,...r){const o=`${this.key}${r.map(c=>`[${c}]`).join("")}`;this.errors.push(new Vi(o,e))}checkSubtype(e,r){const o=pr(e,r);return o&&this.error(o),o}}function ps(i){if(i instanceof Mo)return ps(i.boundExpression);if(i instanceof Lt&&i.name==="error"||i instanceof ci||i instanceof en)return!1;const e=i instanceof it||i instanceof et;let r=!0;return i.eachChild(o=>{r=e?r&&ps(o):r&&o instanceof Ge}),!!r&&Kn(i)&&Ao(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Po(i,e){const r=i.length-1;let o,c,h=0,d=r,m=0;for(;h<=d;)if(m=Math.floor((h+d)/2),o=i[m],c=i[m+1],o<=e){if(m===r||e<c)return m;h=m+1}else{if(!(o>e))throw new Be("Input is not a number.");d=m-1}return 0}class Jn{constructor(e,r,o){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[c,h]of o)this.labels.push(c),this.outputs.push(h)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const o=r.parse(e[1],1,Ce);if(!o)return null;const c=[];let h=null;r.expectedType&&r.expectedType.kind!=="value"&&(h=r.expectedType);for(let d=1;d<e.length;d+=2){const m=d===1?-1/0:e[d],g=e[d+1],x=d,T=d+1;if(typeof m!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',x);if(c.length&&c[c.length-1][0]>=m)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const S=r.parse(g,T,h);if(!S)return null;h=h||S.type,c.push([m,S])}return new Jn(h,o,c)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const c=this.input.evaluate(e);if(c<=r[0])return o[0].evaluate(e);const h=r.length;return c>=r[h-1]?o[h-1].evaluate(e):o[Po(r,c)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Vt(i,e,r){return i*(1-r)+e*r}var Yn=Object.freeze({__proto__:null,number:Vt,color:function(i,e,r){return new F(Vt(i.r,e.r,r),Vt(i.g,e.g,r),Vt(i.b,e.b,r),Vt(i.a,e.a,r))},array:function(i,e,r){return i.map((o,c)=>Vt(o,e[c],r))},padding:function(i,e,r){const o=i.values,c=e.values;return new X([Vt(o[0],c[0],r),Vt(o[1],c[1],r),Vt(o[2],c[2],r),Vt(o[3],c[3],r)])}});const ya=.95047,xa=1.08883,ds=4/29,zo=6/29,va=3*zo*zo,Ml=Math.PI/180,Pl=180/Math.PI;function fs(i){return i>.008856451679035631?Math.pow(i,1/3):i/va+ds}function ms(i){return i>zo?i*i*i:va*(i-ds)}function gs(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function _s(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Ct(i){const e=_s(i.r),r=_s(i.g),o=_s(i.b),c=fs((.4124564*e+.3575761*r+.1804375*o)/ya),h=fs((.2126729*e+.7151522*r+.072175*o)/1);return{l:116*h-16,a:500*(c-h),b:200*(h-fs((.0193339*e+.119192*r+.9503041*o)/xa)),alpha:i.a}}function ba(i){let e=(i.l+16)/116,r=isNaN(i.a)?e:e+i.a/500,o=isNaN(i.b)?e:e-i.b/200;return e=1*ms(e),r=ya*ms(r),o=xa*ms(o),new F(gs(3.2404542*r-1.5371385*e-.4985314*o),gs(-.969266*r+1.8760108*e+.041556*o),gs(.0556434*r-.2040259*e+1.0572252*o),i.alpha)}function zl(i,e,r){const o=e-i;return i+r*(o>180||o<-180?o-360*Math.round(o/360):o)}const Qn={forward:Ct,reverse:ba,interpolate:function(i,e,r){return{l:Vt(i.l,e.l,r),a:Vt(i.a,e.a,r),b:Vt(i.b,e.b,r),alpha:Vt(i.alpha,e.alpha,r)}}},eo={forward:function(i){const{l:e,a:r,b:o}=Ct(i),c=Math.atan2(o,r)*Pl;return{h:c<0?c+360:c,c:Math.sqrt(r*r+o*o),l:e,alpha:i.a}},reverse:function(i){const e=i.h*Ml,r=i.c;return ba({l:i.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:i.alpha})},interpolate:function(i,e,r){return{h:zl(i.h,e.h,r),c:Vt(i.c,e.c,r),l:Vt(i.l,e.l,r),alpha:Vt(i.alpha,e.alpha,r)}}};var wa=Object.freeze({__proto__:null,lab:Qn,hcl:eo});class Gi{constructor(e,r,o,c,h){this.type=e,this.operator=r,this.interpolation=o,this.input=c,this.labels=[],this.outputs=[];for(const[d,m]of h)this.labels.push(d),this.outputs.push(m)}static interpolationFactor(e,r,o,c){let h=0;if(e.name==="exponential")h=ys(r,e.base,o,c);else if(e.name==="linear")h=ys(r,1,o,c);else if(e.name==="cubic-bezier"){const d=e.controlPoints;h=new Y(d[0],d[1],d[2],d[3]).solve(ys(r,1,o,c))}return h}static parse(e,r){let[o,c,h,...d]=e;if(!Array.isArray(c)||c.length===0)return r.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){const x=c[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:x}}else{if(c[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const x=c.slice(1);if(x.length!==4||x.some(T=>typeof T!="number"||T<0||T>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:x}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(h=r.parse(h,2,Ce),!h)return null;const m=[];let g=null;o==="interpolate-hcl"||o==="interpolate-lab"?g=gi:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let x=0;x<d.length;x+=2){const T=d[x],S=d[x+1],P=x+3,k=x+4;if(typeof T!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',P);if(m.length&&m[m.length-1][0]>=T)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',P);const L=r.parse(S,k,g);if(!L)return null;g=g||L.type,m.push([T,L])}return g.kind==="number"||g.kind==="color"||g.kind==="padding"||g.kind==="array"&&g.itemType.kind==="number"&&typeof g.N=="number"?new Gi(g,o,c,h,m):r.error(`Type ${kt(g)} is not interpolatable.`)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const c=this.input.evaluate(e);if(c<=r[0])return o[0].evaluate(e);const h=r.length;if(c>=r[h-1])return o[h-1].evaluate(e);const d=Po(r,c),m=Gi.interpolationFactor(this.interpolation,c,r[d],r[d+1]),g=o[d].evaluate(e),x=o[d+1].evaluate(e);return this.operator==="interpolate"?Yn[this.type.kind.toLowerCase()](g,x,m):this.operator==="interpolate-hcl"?eo.reverse(eo.interpolate(eo.forward(g),eo.forward(x),m)):Qn.reverse(Qn.interpolate(Qn.forward(g),Qn.forward(x),m))}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function ys(i,e,r,o){const c=o-r,h=i-r;return c===0?0:e===1?h/c:(Math.pow(e,h)-1)/(Math.pow(e,c)-1)}class ko{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let o=null;const c=r.expectedType;c&&c.kind!=="value"&&(o=c);const h=[];for(const m of e.slice(1)){const g=r.parse(m,1+h.length,o,void 0,{typeAnnotation:"omit"});if(!g)return null;o=o||g.type,h.push(g)}if(!o)throw new Error("No output type");const d=c&&h.some(m=>pr(c,m.type));return new ko(d?rt:o,h)}evaluate(e){let r,o=null,c=0;for(const h of this.args)if(c++,o=h.evaluate(e),o&&o instanceof J&&!o.available&&(r||(r=o.name),o=null,c===this.args.length&&(o=r)),o!==null)break;return o}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class Do{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const o=[];for(let h=1;h<e.length-1;h+=2){const d=e[h];if(typeof d!="string")return r.error(`Expected string, but found ${typeof d} instead.`,h);if(/[^a-zA-Z0-9_]/.test(d))return r.error("Variable names must contain only alphanumeric characters or '_'.",h);const m=r.parse(e[h+1],h+1);if(!m)return null;o.push([d,m])}const c=r.parse(e[e.length-1],e.length-1,r.expectedType,o);return c?new Do(o,c):null}outputDefined(){return this.result.outputDefined()}}class xs{constructor(e,r,o){this.type=e,this.index=r,this.input=o}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Ce),c=r.parse(e[2],2,Ci(r.expectedType||rt));return o&&c?new xs(c.type.itemType,o,c):null}evaluate(e){const r=this.index.evaluate(e),o=this.input.evaluate(e);if(r<0)throw new Be(`Array index out of bounds: ${r} < 0.`);if(r>=o.length)throw new Be(`Array index out of bounds: ${r} > ${o.length-1}.`);if(r!==Math.floor(r))throw new Be(`Array index must be an integer, but found ${r} instead.`);return o[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class vs{constructor(e,r){this.type=nt,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,rt),c=r.parse(e[2],2,rt);return o&&c?Jr(o.type,[nt,at,Ce,Or,rt])?new vs(o,c):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${kt(o.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!o)return!1;if(!Yr(r,["boolean","string","number","null"]))throw new Be(`Expected first argument to be of type boolean, string, number or null, but found ${kt(he(r))} instead.`);if(!Yr(o,["string","array"]))throw new Be(`Expected second argument to be of type array or string, but found ${kt(he(o))} instead.`);return o.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Lo{constructor(e,r,o){this.type=Ce,this.needle=e,this.haystack=r,this.fromIndex=o}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,rt),c=r.parse(e[2],2,rt);if(!o||!c)return null;if(!Jr(o.type,[nt,at,Ce,Or,rt]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${kt(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Ce);return h?new Lo(o,c,h):null}return new Lo(o,c)}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!Yr(r,["boolean","string","number","null"]))throw new Be(`Expected first argument to be of type boolean, string, number or null, but found ${kt(he(r))} instead.`);if(!Yr(o,["string","array"]))throw new Be(`Expected second argument to be of type array or string, but found ${kt(he(o))} instead.`);if(this.fromIndex){const c=this.fromIndex.evaluate(e);return o.indexOf(r,c)}return o.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class bs{constructor(e,r,o,c,h,d){this.inputType=e,this.type=r,this.input=o,this.cases=c,this.outputs=h,this.otherwise=d}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let o,c;r.expectedType&&r.expectedType.kind!=="value"&&(c=r.expectedType);const h={},d=[];for(let x=2;x<e.length-1;x+=2){let T=e[x];const S=e[x+1];Array.isArray(T)||(T=[T]);const P=r.concat(x);if(T.length===0)return P.error("Expected at least one branch label.");for(const L of T){if(typeof L!="number"&&typeof L!="string")return P.error("Branch labels must be numbers or strings.");if(typeof L=="number"&&Math.abs(L)>Number.MAX_SAFE_INTEGER)return P.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof L=="number"&&Math.floor(L)!==L)return P.error("Numeric branch labels must be integer values.");if(o){if(P.checkSubtype(o,he(L)))return null}else o=he(L);if(h[String(L)]!==void 0)return P.error("Branch labels must be unique.");h[String(L)]=d.length}const k=r.parse(S,x,c);if(!k)return null;c=c||k.type,d.push(k)}const m=r.parse(e[1],1,rt);if(!m)return null;const g=r.parse(e[e.length-1],e.length-1,c);return g?m.type.kind!=="value"&&r.concat(1).checkSubtype(o,m.type)?null:new bs(o,c,m,h,d,g):null}evaluate(e){const r=this.input.evaluate(e);return(he(r)===this.inputType&&this.outputs[this.cases[r]]||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 ws{constructor(e,r,o){this.type=e,this.branches=r,this.otherwise=o}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let o;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);const c=[];for(let d=1;d<e.length-1;d+=2){const m=r.parse(e[d],d,nt);if(!m)return null;const g=r.parse(e[d+1],d+1,o);if(!g)return null;c.push([m,g]),o=o||g.type}const h=r.parse(e[e.length-1],e.length-1,o);if(!h)return null;if(!o)throw new Error("Can't infer output type");return new ws(o,c,h)}evaluate(e){for(const[r,o]of this.branches)if(r.evaluate(e))return o.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,o]of this.branches)e(r),e(o);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class Ro{constructor(e,r,o,c){this.type=e,this.input=r,this.beginIndex=o,this.endIndex=c}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,rt),c=r.parse(e[2],2,Ce);if(!o||!c)return null;if(!Jr(o.type,[Ci(rt),at,rt]))return r.error(`Expected first argument to be of type array or string, but found ${kt(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Ce);return h?new Ro(o.type,o,c,h):null}return new Ro(o.type,o,c)}evaluate(e){const r=this.input.evaluate(e),o=this.beginIndex.evaluate(e);if(!Yr(r,["string","array"]))throw new Be(`Expected first argument to be of type array or string, but found ${kt(he(r))} instead.`);if(this.endIndex){const c=this.endIndex.evaluate(e);return r.slice(o,c)}return r.slice(o)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Ta(i,e){return i==="=="||i==="!="?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 Ea(i,e,r,o){return o.compare(e,r)===0}function An(i,e,r){const o=i!=="=="&&i!=="!=";return class cp{constructor(h,d,m){this.type=nt,this.lhs=h,this.rhs=d,this.collator=m,this.hasUntypedArgument=h.type.kind==="value"||d.type.kind==="value"}static parse(h,d){if(h.length!==3&&h.length!==4)return d.error("Expected two or three arguments.");const m=h[0];let g=d.parse(h[1],1,rt);if(!g)return null;if(!Ta(m,g.type))return d.concat(1).error(`"${m}" comparisons are not supported for type '${kt(g.type)}'.`);let x=d.parse(h[2],2,rt);if(!x)return null;if(!Ta(m,x.type))return d.concat(2).error(`"${m}" comparisons are not supported for type '${kt(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return d.error(`Cannot compare types '${kt(g.type)}' and '${kt(x.type)}'.`);o&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new et(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new et(g.type,[x])));let T=null;if(h.length===4){if(g.type.kind!=="string"&&x.type.kind!=="string"&&g.type.kind!=="value"&&x.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(T=d.parse(h[3],3,Er),!T)return null}return new cp(g,x,T)}evaluate(h){const d=this.lhs.evaluate(h),m=this.rhs.evaluate(h);if(o&&this.hasUntypedArgument){const g=he(d),x=he(m);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new Be(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${x.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const g=he(d),x=he(m);if(g.kind!=="string"||x.kind!=="string")return e(h,d,m)}return this.collator?r(h,d,m,this.collator.evaluate(h)):e(h,d,m)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}}}const kl=An("==",function(i,e,r){return e===r},Ea),Dl=An("!=",function(i,e,r){return e!==r},function(i,e,r,o){return!Ea(0,e,r,o)}),Ll=An("<",function(i,e,r){return e<r},function(i,e,r,o){return o.compare(e,r)<0}),Rl=An(">",function(i,e,r){return e>r},function(i,e,r,o){return o.compare(e,r)>0}),Bl=An("<=",function(i,e,r){return e<=r},function(i,e,r,o){return o.compare(e,r)<=0}),Fl=An(">=",function(i,e,r){return e>=r},function(i,e,r,o){return o.compare(e,r)>=0});class Ts{constructor(e,r,o,c,h){this.type=at,this.number=e,this.locale=r,this.currency=o,this.minFractionDigits=c,this.maxFractionDigits=h}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const o=r.parse(e[1],1,Ce);if(!o)return null;const c=e[2];if(typeof c!="object"||Array.isArray(c))return r.error("NumberFormat options argument must be an object.");let h=null;if(c.locale&&(h=r.parse(c.locale,1,at),!h))return null;let d=null;if(c.currency&&(d=r.parse(c.currency,1,at),!d))return null;let m=null;if(c["min-fraction-digits"]&&(m=r.parse(c["min-fraction-digits"],1,Ce),!m))return null;let g=null;return c["max-fraction-digits"]&&(g=r.parse(c["max-fraction-digits"],1,Ce),!g)?null:new Ts(o,h,d,m,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.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.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Bo{constructor(e){this.type=li,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const o=e[1];if(!Array.isArray(o)&&typeof o=="object")return r.error("First argument must be an image or text section.");const c=[];let h=!1;for(let d=1;d<=e.length-1;++d){const m=e[d];if(h&&typeof m=="object"&&!Array.isArray(m)){h=!1;let g=null;if(m["font-scale"]&&(g=r.parse(m["font-scale"],1,Ce),!g))return null;let x=null;if(m["text-font"]&&(x=r.parse(m["text-font"],1,Ci(at)),!x))return null;let T=null;if(m["text-color"]&&(T=r.parse(m["text-color"],1,gi),!T))return null;const S=c[c.length-1];S.scale=g,S.font=x,S.textColor=T}else{const g=r.parse(e[d],1,rt);if(!g)return null;const x=g.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");h=!0,c.push({content:g,scale:null,font:null,textColor:null})}}return new Bo(c)}evaluate(e){return new W(this.sections.map(r=>{const o=r.content.evaluate(e);return he(o)===ti?new K("",o,null,null,null):new K(Ve(o),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class Es{constructor(e){this.type=ti,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const o=r.parse(e[1],1,at);return o?new Es(o):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),o=J.fromString(r);return o&&e.availableImages&&(o.available=e.availableImages.indexOf(r)>-1),o}eachChild(e){e(this.input)}outputDefined(){return!1}}class Ss{constructor(e){this.type=Ce,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const o=r.parse(e[1],1);return o?o.type.kind!=="array"&&o.type.kind!=="string"&&o.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${kt(o.type)} instead.`):new Ss(o):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Be(`Expected value to be of type string or array, but found ${kt(he(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Mn={"==":kl,"!=":Dl,">":Rl,"<":Ll,">=":Fl,"<=":Bl,array:et,at:xs,boolean:et,case:ws,coalesce:ko,collator:ci,format:Bo,image:Es,in:vs,"index-of":Lo,interpolate:Gi,"interpolate-hcl":Gi,"interpolate-lab":Gi,length:Ss,let:Do,literal:Ge,match:bs,number:et,"number-format":Ts,object:et,slice:Ro,step:Jn,string:et,"to-boolean":it,"to-color":it,"to-number":it,"to-string":it,var:Mo,within:en};function Sa(i,[e,r,o,c]){e=e.evaluate(i),r=r.evaluate(i),o=o.evaluate(i);const h=c?c.evaluate(i):1,d=de(e,r,o,h);if(d)throw new Be(d);return new F(e/255*h,r/255*h,o/255*h,h)}function Ia(i,e){return i in e}function Fo(i,e){const r=e[i];return r===void 0?null:r}function tn(i){return{type:i}}function Ca(i){return{result:"success",value:i}}function Pn(i){return{result:"error",value:i}}function Ot(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Aa(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function mt(i){return!!i.expression&&i.expression.interpolated}function At(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Ft(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Nt(i){return i}function to(i,e){const r=e.type==="color",o=i.stops&&typeof i.stops[0][0]=="object",c=o||!(o||i.property!==void 0),h=i.type||(mt(e)?"exponential":"interval");if(r||e.type==="padding"){const x=r?F.parse:X.parse;(i=ir({},i)).stops&&(i.stops=i.stops.map(T=>[T[0],x(T[1])])),i.default=x(i.default?i.default:e.default)}if(i.colorSpace&&i.colorSpace!=="rgb"&&!wa[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let d,m,g;if(h==="exponential")d=Ma;else if(h==="interval")d=Ul;else if(h==="categorical"){d=Ol,m=Object.create(null);for(const x of i.stops)m[x[0]]=x[1];g=typeof i.stops[0][0]}else{if(h!=="identity")throw new Error(`Unknown function type "${h}"`);d=$l}if(o){const x={},T=[];for(let k=0;k<i.stops.length;k++){const L=i.stops[k],Z=L[0].zoom;x[Z]===void 0&&(x[Z]={zoom:Z,type:i.type,property:i.property,default:i.default,stops:[]},T.push(Z)),x[Z].stops.push([L[0].value,L[1]])}const S=[];for(const k of T)S.push([x[k].zoom,to(x[k],e)]);const P={name:"linear"};return{kind:"composite",interpolationType:P,interpolationFactor:Gi.interpolationFactor.bind(void 0,P),zoomStops:S.map(k=>k[0]),evaluate:({zoom:k},L)=>Ma({stops:S,base:i.base},e,k).evaluate(k,L)}}if(c){const x=h==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:Gi.interpolationFactor.bind(void 0,x),zoomStops:i.stops.map(T=>T[0]),evaluate:({zoom:T})=>d(i,e,T,m,g)}}return{kind:"source",evaluate(x,T){const S=T&&T.properties?T.properties[i.property]:void 0;return S===void 0?zn(i.default,e.default):d(i,e,S,m,g)}}}function zn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Ol(i,e,r,o,c){return zn(typeof r===c?o[r]:void 0,i.default,e.default)}function Ul(i,e,r){if(At(r)!=="number")return zn(i.default,e.default);const o=i.stops.length;if(o===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[o-1][0])return i.stops[o-1][1];const c=Po(i.stops.map(h=>h[0]),r);return i.stops[c][1]}function Ma(i,e,r){const o=i.base!==void 0?i.base:1;if(At(r)!=="number")return zn(i.default,e.default);const c=i.stops.length;if(c===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[c-1][0])return i.stops[c-1][1];const h=Po(i.stops.map(T=>T[0]),r),d=function(T,S,P,k){const L=k-P,Z=T-P;return L===0?0:S===1?Z/L:(Math.pow(S,Z)-1)/(Math.pow(S,L)-1)}(r,o,i.stops[h][0],i.stops[h+1][0]),m=i.stops[h][1],g=i.stops[h+1][1];let x=Yn[e.type]||Nt;if(i.colorSpace&&i.colorSpace!=="rgb"){const T=wa[i.colorSpace];x=(S,P)=>T.reverse(T.interpolate(T.forward(S),T.forward(P),d))}return typeof m.evaluate=="function"?{evaluate(...T){const S=m.evaluate.apply(void 0,T),P=g.evaluate.apply(void 0,T);if(S!==void 0&&P!==void 0)return x(S,P,d)}}:x(m,g,d)}function $l(i,e,r){switch(e.type){case"color":r=F.parse(r);break;case"formatted":r=W.fromString(r.toString());break;case"resolvedImage":r=J.fromString(r.toString());break;case"padding":r=X.parse(r);break;default:At(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return zn(r,i.default,e.default)}Lt.register(Mn,{error:[{kind:"error"},[at],(i,[e])=>{throw new Be(e.evaluate(i))}],typeof:[at,[rt],(i,[e])=>kt(he(e.evaluate(i)))],"to-rgba":[Ci(Ce,4),[gi],(i,[e])=>e.evaluate(i).toArray()],rgb:[gi,[Ce,Ce,Ce],Sa],rgba:[gi,[Ce,Ce,Ce,Ce],Sa],has:{type:nt,overloads:[[[at],(i,[e])=>Ia(e.evaluate(i),i.properties())],[[at,Ur],(i,[e,r])=>Ia(e.evaluate(i),r.evaluate(i))]]},get:{type:rt,overloads:[[[at],(i,[e])=>Fo(e.evaluate(i),i.properties())],[[at,Ur],(i,[e,r])=>Fo(e.evaluate(i),r.evaluate(i))]]},"feature-state":[rt,[at],(i,[e])=>Fo(e.evaluate(i),i.featureState||{})],properties:[Ur,[],i=>i.properties()],"geometry-type":[at,[],i=>i.geometryType()],id:[rt,[],i=>i.id()],zoom:[Ce,[],i=>i.globals.zoom],"heatmap-density":[Ce,[],i=>i.globals.heatmapDensity||0],"line-progress":[Ce,[],i=>i.globals.lineProgress||0],accumulated:[rt,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ce,tn(Ce),(i,e)=>{let r=0;for(const o of e)r+=o.evaluate(i);return r}],"*":[Ce,tn(Ce),(i,e)=>{let r=1;for(const o of e)r*=o.evaluate(i);return r}],"-":{type:Ce,overloads:[[[Ce,Ce],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Ce],(i,[e])=>-e.evaluate(i)]]},"/":[Ce,[Ce,Ce],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Ce,[Ce,Ce],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Ce,[],()=>Math.LN2],pi:[Ce,[],()=>Math.PI],e:[Ce,[],()=>Math.E],"^":[Ce,[Ce,Ce],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Ce,[Ce],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Ce,[Ce],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Ce,[Ce],(i,[e])=>Math.log(e.evaluate(i))],log2:[Ce,[Ce],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Ce,[Ce],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Ce,[Ce],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Ce,[Ce],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Ce,[Ce],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Ce,[Ce],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Ce,[Ce],(i,[e])=>Math.atan(e.evaluate(i))],min:[Ce,tn(Ce),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Ce,tn(Ce),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Ce,[Ce],(i,[e])=>Math.abs(e.evaluate(i))],round:[Ce,[Ce],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ce,[Ce],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Ce,[Ce],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[nt,[at,rt],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[nt,[rt],(i,[e])=>i.id()===e.value],"filter-type-==":[nt,[at],(i,[e])=>i.geometryType()===e.value],"filter-<":[nt,[at,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<c}],"filter-id-<":[nt,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<o}],"filter->":[nt,[at,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>c}],"filter-id->":[nt,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>o}],"filter-<=":[nt,[at,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<=c}],"filter-id-<=":[nt,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<=o}],"filter->=":[nt,[at,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>=c}],"filter-id->=":[nt,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>=o}],"filter-has":[nt,[rt],(i,[e])=>e.value in i.properties()],"filter-has-id":[nt,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[nt,[Ci(at)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[nt,[Ci(rt)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[nt,[at,Ci(rt)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[nt,[at,Ci(rt)],(i,[e,r])=>function(o,c,h,d){for(;h<=d;){const m=h+d>>1;if(c[m]===o)return!0;c[m]>o?d=m-1:h=m+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:nt,overloads:[[[nt,nt],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[tn(nt),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:nt,overloads:[[[nt,nt],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[tn(nt),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[nt,[nt],(i,[e])=>!e.evaluate(i)],"is-supported-script":[nt,[at],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[at,[at],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[at,[at],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[at,tn(rt),(i,e)=>e.map(r=>Ve(r.evaluate(i))).join("")],"resolved-locale":[at,[Er],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Oo{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new Tt,this._defaultValue=r?function(o){return o.type==="color"&&Ft(o.default)?new F(0,0,0,0):o.type==="color"?F.parse(o.default)||null:o.type==="padding"?X.parse(o.default)||null:o.default===void 0?null:o.default}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,o,c,h,d){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=o,this._evaluator.canonical=c,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(e,r,o,c,h,d){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=o||null,this._evaluator.canonical=c,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=d||null;try{const m=this.expression.evaluate(this._evaluator);if(m==null||typeof m=="number"&&m!=m)return this._defaultValue;if(this._enumValues&&!(m in this._enumValues))throw new Be(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(m)} instead.`);return m}catch(m){return this._warningHistory[m.message]||(this._warningHistory[m.message]=!0,typeof console!="undefined"&&console.warn(m.message)),this._defaultValue}}}function io(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Mn}function ro(i,e){const r=new Cn(Mn,[],e?function(c){const h={color:gi,string:at,number:Ce,enum:at,boolean:nt,formatted:li,padding:wn,resolvedImage:ti};return c.type==="array"?Ci(h[c.value]||rt,c.length):h[c.type]}(e):void 0),o=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?Ca(new Oo(o,e)):Pn(r.errors)}class no{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!In(r.expression)}evaluateWithoutErrorHandling(e,r,o,c,h,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,c,h,d)}evaluate(e,r,o,c,h,d){return this._styleExpression.evaluate(e,r,o,c,h,d)}}class Is{constructor(e,r,o,c){this.kind=e,this.zoomStops=o,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!In(r.expression),this.interpolationType=c}evaluateWithoutErrorHandling(e,r,o,c,h,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,c,h,d)}evaluate(e,r,o,c,h,d){return this._styleExpression.evaluate(e,r,o,c,h,d)}interpolationFactor(e,r,o){return this.interpolationType?Gi.interpolationFactor(this.interpolationType,e,r,o):0}}function Pa(i,e){const r=ro(i,e);if(r.result==="error")return r;const o=r.value.expression,c=Kn(o);if(!c&&!Ot(e))return Pn([new Vi("","data expressions not supported")]);const h=Ao(o,["zoom"]);if(!h&&!Aa(e))return Pn([new Vi("","zoom expressions not supported")]);const d=$o(o);return d||h?d instanceof Vi?Pn([d]):d instanceof Gi&&!mt(e)?Pn([new Vi("",'"interpolate" expressions cannot be used with this property')]):Ca(d?new Is(c?"camera":"composite",r.value,d.labels,d instanceof Gi?d.interpolation:void 0):new no(c?"constant":"source",r.value)):Pn([new Vi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Uo{constructor(e,r){this._parameters=e,this._specification=r,ir(this,to(this._parameters,this._specification))}static deserialize(e){return new Uo(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function $o(i){let e=null;if(i instanceof Do)e=$o(i.result);else if(i instanceof ko){for(const r of i.args)if(e=$o(r),e)break}else(i instanceof Jn||i instanceof Gi)&&i.input instanceof Lt&&i.input.name==="zoom"&&(e=i);return e instanceof Vi||i.eachChild(r=>{const o=$o(r);o instanceof Vi?e=o:!e&&o?e=new Vi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&o&&e!==o&&(e=new Vi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function rr(i){const e=i.key,r=i.value,o=i.valueSpec||{},c=i.objectElementValidators||{},h=i.style,d=i.styleSpec;let m=[];const g=At(r);if(g!=="object")return[new Pe(e,r,`object expected, ${g} found`)];for(const x in r){const T=x.split(".")[0],S=o[T]||o["*"];let P;if(c[T])P=c[T];else if(o[T])P=Zi;else if(c["*"])P=c["*"];else{if(!o["*"]){m.push(new Pe(e,r[x],`unknown property "${x}"`));continue}P=Zi}m=m.concat(P({key:(e&&`${e}.`)+x,value:r[x],valueSpec:S,style:h,styleSpec:d,object:r,objectKey:x},r))}for(const x in o)c[x]||o[x].required&&o[x].default===void 0&&r[x]===void 0&&m.push(new Pe(e,r,`missing required property "${x}"`));return m}function za(i){const e=i.value,r=i.valueSpec,o=i.style,c=i.styleSpec,h=i.key,d=i.arrayElementValidator||Zi;if(At(e)!=="array")return[new Pe(h,e,`array expected, ${At(e)} found`)];if(r.length&&e.length!==r.length)return[new Pe(h,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Pe(h,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let m={type:r.value,values:r.values};c.$version<7&&(m.function=r.function),At(r.value)==="object"&&(m=r.value);let g=[];for(let x=0;x<e.length;x++)g=g.concat(d({array:e,arrayIndex:x,value:e[x],valueSpec:m,style:o,styleSpec:c,key:`${h}[${x}]`}));return g}function Cs(i){const e=i.key,r=i.value,o=i.valueSpec;let c=At(r);return c==="number"&&r!=r&&(c="NaN"),c!=="number"?[new Pe(e,r,`number expected, ${c} found`)]:"minimum"in o&&r<o.minimum?[new Pe(e,r,`${r} is less than the minimum value ${o.minimum}`)]:"maximum"in o&&r>o.maximum?[new Pe(e,r,`${r} is greater than the maximum value ${o.maximum}`)]:[]}function ka(i){const e=i.valueSpec,r=bt(i.value.type);let o,c,h,d={};const m=r!=="categorical"&&i.value.property===void 0,g=!m,x=At(i.value.stops)==="array"&&At(i.value.stops[0])==="array"&&At(i.value.stops[0][0])==="object",T=rr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(k){if(r==="identity")return[new Pe(k.key,k.value,'identity function may not have a "stops" property')];let L=[];const Z=k.value;return L=L.concat(za({key:k.key,value:Z,valueSpec:k.valueSpec,style:k.style,styleSpec:k.styleSpec,arrayElementValidator:S})),At(Z)==="array"&&Z.length===0&&L.push(new Pe(k.key,Z,"array must have at least one stop")),L},default:function(k){return Zi({key:k.key,value:k.value,valueSpec:e,style:k.style,styleSpec:k.styleSpec})}}});return r==="identity"&&m&&T.push(new Pe(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||T.push(new Pe(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!mt(i.valueSpec)&&T.push(new Pe(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!Ot(i.valueSpec)?T.push(new Pe(i.key,i.value,"property functions not supported")):m&&!Aa(i.valueSpec)&&T.push(new Pe(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||T.push(new Pe(i.key,i.value,'"property" property is required')),T;function S(k){let L=[];const Z=k.value,q=k.key;if(At(Z)!=="array")return[new Pe(q,Z,`array expected, ${At(Z)} found`)];if(Z.length!==2)return[new Pe(q,Z,`array length 2 expected, length ${Z.length} found`)];if(x){if(At(Z[0])!=="object")return[new Pe(q,Z,`object expected, ${At(Z[0])} found`)];if(Z[0].zoom===void 0)return[new Pe(q,Z,"object stop key must have zoom")];if(Z[0].value===void 0)return[new Pe(q,Z,"object stop key must have value")];if(h&&h>bt(Z[0].zoom))return[new Pe(q,Z[0].zoom,"stop zoom values must appear in ascending order")];bt(Z[0].zoom)!==h&&(h=bt(Z[0].zoom),c=void 0,d={}),L=L.concat(rr({key:`${q}[0]`,value:Z[0],valueSpec:{zoom:{}},style:k.style,styleSpec:k.styleSpec,objectElementValidators:{zoom:Cs,value:P}}))}else L=L.concat(P({key:`${q}[0]`,value:Z[0],valueSpec:{},style:k.style,styleSpec:k.styleSpec},Z));return io(Ji(Z[1]))?L.concat([new Pe(`${q}[1]`,Z[1],"expressions are not allowed in function stops.")]):L.concat(Zi({key:`${q}[1]`,value:Z[1],valueSpec:e,style:k.style,styleSpec:k.styleSpec}))}function P(k,L){const Z=At(k.value),q=bt(k.value),re=k.value!==null?k.value:L;if(o){if(Z!==o)return[new Pe(k.key,re,`${Z} stop domain type must match previous stop domain type ${o}`)]}else o=Z;if(Z!=="number"&&Z!=="string"&&Z!=="boolean")return[new Pe(k.key,re,"stop domain value must be a number, string, or boolean")];if(Z!=="number"&&r!=="categorical"){let ce=`number expected, ${Z} found`;return Ot(e)&&r===void 0&&(ce+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Pe(k.key,re,ce)]}return r!=="categorical"||Z!=="number"||isFinite(q)&&Math.floor(q)===q?r!=="categorical"&&Z==="number"&&c!==void 0&&q<c?[new Pe(k.key,re,"stop domain values must appear in ascending order")]:(c=q,r==="categorical"&&q in d?[new Pe(k.key,re,"stop domain values must be unique")]:(d[q]=!0,[])):[new Pe(k.key,re,`integer expected, found ${q}`)]}}function rn(i){const e=(i.expressionContext==="property"?Pa:ro)(Ji(i.value),i.valueSpec);if(e.result==="error")return e.value.map(o=>new Pe(`${i.key}${o.key}`,i.value,o.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Pe(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!In(r))return[new Pe(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!In(r))return[new Pe(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Ao(r,["zoom","feature-state"]))return[new Pe(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Kn(r))return[new Pe(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function oo(i){const e=i.key,r=i.value,o=i.valueSpec,c=[];return Array.isArray(o.values)?o.values.indexOf(bt(r))===-1&&c.push(new Pe(e,r,`expected one of [${o.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(o.values).indexOf(bt(r))===-1&&c.push(new Pe(e,r,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(r)} found`)),c}function kn(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!kn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Vl={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Vo(i){if(i==null)return{filter:()=>!0,needGeometry:!1};kn(i)||(i=so(i));const e=ro(i,Vl);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,o,c)=>e.value.evaluate(r,o,{},c),needGeometry:La(i)}}function Da(i,e){return i<e?-1:i>e?1:0}function La(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(La(i[e]))return!0;return!1}function so(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?As(i[1],i[2],"=="):e==="!="?Dn(As(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?As(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(so))):e==="all"?["all"].concat(i.slice(1).map(so)):e==="none"?["all"].concat(i.slice(1).map(so).map(Dn)):e==="in"?No(i[1],i.slice(2)):e==="!in"?Dn(No(i[1],i.slice(2))):e==="has"?ao(i[1]):e==="!has"?Dn(ao(i[1])):e!=="within"||i;var r}function As(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function No(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(Da)]]:["filter-in-small",i,["literal",e]]}}function ao(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Dn(i){return["!",i]}function lo(i){return kn(Ji(i.value))?rn(ir({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ra(i)}function Ra(i){const e=i.value,r=i.key;if(At(e)!=="array")return[new Pe(r,e,`array expected, ${At(e)} found`)];const o=i.styleSpec;let c,h=[];if(e.length<1)return[new Pe(r,e,"filter array must have at least 1 element")];switch(h=h.concat(oo({key:`${r}[0]`,value:e[0],valueSpec:o.filter_operator,style:i.style,styleSpec:i.styleSpec})),bt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&bt(e[1])==="$type"&&h.push(new Pe(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&h.push(new Pe(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(c=At(e[1]),c!=="string"&&h.push(new Pe(`${r}[1]`,e[1],`string expected, ${c} found`)));for(let d=2;d<e.length;d++)c=At(e[d]),bt(e[1])==="$type"?h=h.concat(oo({key:`${r}[${d}]`,value:e[d],valueSpec:o.geometry_type,style:i.style,styleSpec:i.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&h.push(new Pe(`${r}[${d}]`,e[d],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let d=1;d<e.length;d++)h=h.concat(Ra({key:`${r}[${d}]`,value:e[d],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":c=At(e[1]),e.length!==2?h.push(new Pe(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="string"&&h.push(new Pe(`${r}[1]`,e[1],`string expected, ${c} found`));break;case"within":c=At(e[1]),e.length!==2?h.push(new Pe(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="object"&&h.push(new Pe(`${r}[1]`,e[1],`object expected, ${c} found`))}return h}function co(i,e){const r=i.key,o=i.style,c=i.styleSpec,h=i.value,d=i.objectKey,m=c[`${e}_${i.layerType}`];if(!m)return[];const g=d.match(/^(.*)-transition$/);if(e==="paint"&&g&&m[g[1]]&&m[g[1]].transition)return Zi({key:r,value:h,valueSpec:c.transition,style:o,styleSpec:c});const x=i.valueSpec||m[d];if(!x)return[new Pe(r,h,`unknown property "${d}"`)];let T;if(At(h)==="string"&&Ot(x)&&!x.tokens&&(T=/^{([^}]+)}$/.exec(h)))return[new Pe(r,h,`"${d}" does not support interpolation syntax
2
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(T[1])} }\`.`)];const S=[];return i.layerType==="symbol"&&(d==="text-field"&&o&&!o.glyphs&&S.push(new Pe(r,h,'use of "text-field" requires a style "glyphs" property')),d==="text-font"&&Ft(Ji(h))&&bt(h.type)==="identity"&&S.push(new Pe(r,h,'"text-font" does not support identity functions'))),S.concat(Zi({key:i.key,value:h,valueSpec:x,style:o,styleSpec:c,expressionContext:"property",propertyType:e,propertyKey:d}))}function Ba(i){return co(i,"paint")}function Fa(i){return co(i,"layout")}function Oa(i){let e=[];const r=i.value,o=i.key,c=i.style,h=i.styleSpec;r.type||r.ref||e.push(new Pe(o,r,'either "type" or "ref" is required'));let d=bt(r.type);const m=bt(r.ref);if(r.id){const g=bt(r.id);for(let x=0;x<i.arrayIndex;x++){const T=c.layers[x];bt(T.id)===g&&e.push(new Pe(o,r.id,`duplicate layer id "${r.id}", previously used at line ${T.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&e.push(new Pe(o,r[x],`"${x}" is prohibited for ref layers`))}),c.layers.forEach(x=>{bt(x.id)===m&&(g=x)}),g?g.ref?e.push(new Pe(o,r.ref,"ref cannot reference another ref layer")):d=bt(g.type):e.push(new Pe(o,r.ref,`ref layer "${m}" not found`))}else if(d!=="background")if(r.source){const g=c.sources&&c.sources[r.source],x=g&&bt(g.type);g?x==="vector"&&d==="raster"?e.push(new Pe(o,r.source,`layer "${r.id}" requires a raster source`)):x==="raster"&&d!=="raster"?e.push(new Pe(o,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&d!=="hillshade"?e.push(new Pe(o,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&g.lineMetrics||e.push(new Pe(o,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Pe(o,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Pe(o,r.source,`source "${r.source}" not found`))}else e.push(new Pe(o,r,'missing required property "source"'));return e=e.concat(rr({key:o,value:r,valueSpec:h.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Zi({key:`${o}.type`,value:r.type,valueSpec:h.layer.type,style:i.style,styleSpec:i.styleSpec,object:r,objectKey:"type"}),filter:lo,layout:g=>rr({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>Fa(ir({layerType:d},x))}}),paint:g=>rr({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>Ba(ir({layerType:d},x))}})}})),e}function Ln(i){const e=i.value,r=i.key,o=At(e);return o!=="string"?[new Pe(r,e,`string expected, ${o} found`)]:[]}const Ua={promoteId:function({key:i,value:e}){if(At(e)==="string")return Ln({key:i,value:e});{const r=[];for(const o in e)r.push(...Ln({key:`${i}.${o}`,value:e[o]}));return r}}};function uo(i){const e=i.value,r=i.key,o=i.styleSpec,c=i.style;if(!e.type)return[new Pe(r,e,'"type" is required')];const h=bt(e.type);let d;switch(h){case"vector":case"raster":case"raster-dem":return d=rr({key:r,value:e,valueSpec:o[`source_${h.replace("-","_")}`],style:i.style,styleSpec:o,objectElementValidators:Ua}),d;case"geojson":if(d=rr({key:r,value:e,valueSpec:o.source_geojson,style:c,styleSpec:o,objectElementValidators:Ua}),e.cluster)for(const m in e.clusterProperties){const[g,x]=e.clusterProperties[m],T=typeof g=="string"?[g,["accumulated"],["get",m]]:g;d.push(...rn({key:`${r}.${m}.map`,value:x,expressionContext:"cluster-map"})),d.push(...rn({key:`${r}.${m}.reduce`,value:T,expressionContext:"cluster-reduce"}))}return d;case"video":return rr({key:r,value:e,valueSpec:o.source_video,style:c,styleSpec:o});case"image":return rr({key:r,value:e,valueSpec:o.source_image,style:c,styleSpec:o});case"canvas":return[new Pe(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return oo({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:c,styleSpec:o})}}function ho(i){const e=i.value,r=i.styleSpec,o=r.light,c=i.style;let h=[];const d=At(e);if(e===void 0)return h;if(d!=="object")return h=h.concat([new Pe("light",e,`object expected, ${d} found`)]),h;for(const m in e){const g=m.match(/^(.*)-transition$/);h=h.concat(g&&o[g[1]]&&o[g[1]].transition?Zi({key:m,value:e[m],valueSpec:r.transition,style:c,styleSpec:r}):o[m]?Zi({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new Pe(m,e[m],`unknown property "${m}"`)])}return h}function qi(i){const e=i.value,r=i.styleSpec,o=r.terrain,c=i.style;let h=[];const d=At(e);if(e===void 0)return h;if(d!=="object")return h=h.concat([new Pe("terrain",e,`object expected, ${d} found`)]),h;for(const m in e)h=h.concat(o[m]?Zi({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new Pe(m,e[m],`unknown property "${m}"`)]);return h}const po={"*":()=>[],array:za,boolean:function(i){const e=i.value,r=i.key,o=At(e);return o!=="boolean"?[new Pe(r,e,`boolean expected, ${o} found`)]:[]},number:Cs,color:function(i){const e=i.key,r=i.value,o=At(r);return o!=="string"?[new Pe(e,r,`color expected, ${o} found`)]:En(r)===null?[new Pe(e,r,`color expected, "${r}" found`)]:[]},constants:Kr,enum:oo,filter:lo,function:ka,layer:Oa,object:rr,source:uo,light:ho,terrain:qi,string:Ln,formatted:function(i){return Ln(i).length===0?[]:rn(i)},resolvedImage:function(i){return Ln(i).length===0?[]:rn(i)},padding:function(i){const e=i.key,r=i.value;if(At(r)==="array"){if(r.length<1||r.length>4)return[new Pe(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const o={type:"number"};let c=[];for(let h=0;h<r.length;h++)c=c.concat(Zi({key:`${e}[${h}]`,value:r[h],valueSpec:o}));return c}return Cs({key:e,value:r,valueSpec:{}})}};function Zi(i){const e=i.value,r=i.valueSpec,o=i.styleSpec;return r.expression&&Ft(bt(e))?ka(i):r.expression&&io(Ji(e))?rn(i):r.type&&po[r.type]?po[r.type](i):rr(ir({},i,{valueSpec:r.type?o[r.type]:r}))}function Nl(i){const e=i.value,r=i.key,o=Ln(i);return o.length||(e.indexOf("{fontstack}")===-1&&o.push(new Pe(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&o.push(new Pe(r,e,'"glyphs" url must include a "{range}" token'))),o}function $r(i,e=_e){let r=[];return r=r.concat(Zi({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,objectElementValidators:{glyphs:Nl,"*":()=>[]}})),i.constants&&(r=r.concat(Kr({key:"constants",value:i.constants,style:i,styleSpec:e}))),$a(r)}function $a(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function Sr(i){return function(...e){return $a(i.apply(this,e))}}$r.source=Sr(uo),$r.light=Sr(ho),$r.terrain=Sr(qi),$r.layer=Sr(Oa),$r.filter=Sr(lo),$r.paintProperty=Sr(Ba),$r.layoutProperty=Sr(Fa);const fo=$r,Ms=fo.light,Gl=fo.paintProperty,ql=fo.layoutProperty;function Go(i,e){let r=!1;if(e&&e.length)for(const o of e)i.fire(new bn(new Error(o.message))),r=!0;return r}class mo{constructor(e,r,o){const c=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const d=new Int32Array(this.arrayBuffer);e=d[0],this.d=(r=d[1])+2*(o=d[2]);for(let g=0;g<this.d*this.d;g++){const x=d[3+g],T=d[3+g+1];c.push(x===T?null:d.subarray(x,T))}const m=d[3+c.length+1];this.keys=d.subarray(d[3+c.length],m),this.bboxes=d.subarray(m),this.insert=this._insertReadonly}else{this.d=r+2*o;for(let d=0;d<this.d*this.d;d++)c.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=o,this.scale=r/e,this.uid=0;const h=o/r*e;this.min=-h,this.max=e+h}insert(e,r,o,c,h){this._forEachCell(r,o,c,h,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(o),this.bboxes.push(c),this.bboxes.push(h)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,o,c,h,d){this.cells[h].push(d)}query(e,r,o,c,h){const d=this.min,m=this.max;if(e<=d&&r<=d&&m<=o&&m<=c&&!h)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(e,r,o,c,this._queryCell,g,{},h),g}}_queryCell(e,r,o,c,h,d,m,g){const x=this.cells[h];if(x!==null){const T=this.keys,S=this.bboxes;for(let P=0;P<x.length;P++){const k=x[P];if(m[k]===void 0){const L=4*k;(g?g(S[L+0],S[L+1],S[L+2],S[L+3]):e<=S[L+2]&&r<=S[L+3]&&o>=S[L+0]&&c>=S[L+1])?(m[k]=!0,d.push(T[k])):m[k]=!1}}}}_forEachCell(e,r,o,c,h,d,m,g){const x=this._convertToCellCoord(e),T=this._convertToCellCoord(r),S=this._convertToCellCoord(o),P=this._convertToCellCoord(c);for(let k=x;k<=S;k++)for(let L=T;L<=P;L++){const Z=this.d*L+k;if((!g||g(this._convertFromCellCoord(k),this._convertFromCellCoord(L),this._convertFromCellCoord(k+1),this._convertFromCellCoord(L+1)))&&h.call(this,e,r,o,c,Z,d,m,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,r=3+this.cells.length+1+1;let o=0;for(let d=0;d<this.cells.length;d++)o+=this.cells[d].length;const c=new Int32Array(r+o+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let h=r;for(let d=0;d<e.length;d++){const m=e[d];c[3+d]=h,c.set(m,h),h+=m.length}return c[3+e.length]=h,c.set(this.keys,h),h+=this.keys.length,c[3+e.length+1]=h,c.set(this.bboxes,h),h+=this.bboxes.length,c.buffer}static serialize(e,r){const o=e.toArrayBuffer();return r&&r.push(o),{buffer:o}}static deserialize(e){return new mo(e.buffer)}}const Ir={};function $e(i,e,r={}){if(Ir[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),Ir[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}$e("Object",Object),$e("TransferableGridIndex",mo),$e("Color",F),$e("Error",Error),$e("AJAXError",$i),$e("ResolvedImage",J),$e("StylePropertyFunction",Uo),$e("StyleExpression",Oo,{omit:["_evaluator"]}),$e("ZoomDependentExpression",Is),$e("ZoomConstantExpression",no),$e("CompoundExpression",Lt,{omit:["_evaluate"]});for(const i in Mn)Mn[i]._classRegistryKey||$e(`Expression_${i}`,Mn[i]);function Va(i){return i&&typeof ArrayBuffer!="undefined"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function nn(i,e){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob)return i;if(Va(i)||Ht(i))return e&&e.push(i),i;if(ArrayBuffer.isView(i)){const r=i;return e&&e.push(r.buffer),r}if(i instanceof ImageData)return e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const r=[];for(const o of i)r.push(nn(o,e));return r}if(typeof i=="object"){const r=i.constructor,o=r._classRegistryKey;if(!o)throw new Error("can't serialize object of unregistered class");if(!Ir[o])throw new Error(`${o} is not registered.`);const c=r.serialize?r.serialize(i,e):{};if(r.serialize){if(e&&c===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const h in i){if(!i.hasOwnProperty(h)||Ir[o].omit.indexOf(h)>=0)continue;const d=i[h];c[h]=Ir[o].shallow.indexOf(h)>=0?d:nn(d,e)}i instanceof Error&&(c.message=i.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return o!=="Object"&&(c.$name=o),c}throw new Error("can't serialize object of type "+typeof i)}function Vr(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||Va(i)||Ht(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Vr);if(typeof i=="object"){const e=i.$name||"Object";if(!Ir[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=Ir[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const o=Object.create(r.prototype);for(const c of Object.keys(i)){if(c==="$name")continue;const h=i[c];o[c]=Ir[e].shallow.indexOf(c)>=0?h:Vr(h)}return o}throw new Error("can't deserialize object of type "+typeof i)}class Ps{constructor(){this.first=!0}update(e,r){const o=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=o,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=o,!0):(this.lastFloorZoom>o?(this.lastIntegerZoom=o+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<o&&(this.lastIntegerZoom=o,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=o,!0))}}const De={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function qo(i){for(const e of i)if(ks(e.charCodeAt(0)))return!0;return!1}function Zl(i){for(const e of i)if(!zs(e.charCodeAt(0)))return!1;return!0}function zs(i){return!(De.Arabic(i)||De["Arabic Supplement"](i)||De["Arabic Extended-A"](i)||De["Arabic Presentation Forms-A"](i)||De["Arabic Presentation Forms-B"](i))}function ks(i){return!(i!==746&&i!==747&&(i<4352||!(De["Bopomofo Extended"](i)||De.Bopomofo(i)||De["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||De["CJK Compatibility Ideographs"](i)||De["CJK Compatibility"](i)||De["CJK Radicals Supplement"](i)||De["CJK Strokes"](i)||!(!De["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||De["CJK Unified Ideographs Extension A"](i)||De["CJK Unified Ideographs"](i)||De["Enclosed CJK Letters and Months"](i)||De["Hangul Compatibility Jamo"](i)||De["Hangul Jamo Extended-A"](i)||De["Hangul Jamo Extended-B"](i)||De["Hangul Jamo"](i)||De["Hangul Syllables"](i)||De.Hiragana(i)||De["Ideographic Description Characters"](i)||De.Kanbun(i)||De["Kangxi Radicals"](i)||De["Katakana Phonetic Extensions"](i)||De.Katakana(i)&&i!==12540||!(!De["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!De["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||De["Unified Canadian Aboriginal Syllabics"](i)||De["Unified Canadian Aboriginal Syllabics Extended"](i)||De["Vertical Forms"](i)||De["Yijing Hexagram Symbols"](i)||De["Yi Syllables"](i)||De["Yi Radicals"](i))))}function Na(i){return!(ks(i)||function(e){return!!(De["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||De["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||De["Letterlike Symbols"](e)||De["Number Forms"](e)||De["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||De["Control Pictures"](e)&&e!==9251||De["Optical Character Recognition"](e)||De["Enclosed Alphanumerics"](e)||De["Geometric Shapes"](e)||De["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||De["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||De["CJK Symbols and Punctuation"](e)||De.Katakana(e)||De["Private Use Area"](e)||De["CJK Compatibility Forms"](e)||De["Small Form Variants"](e)||De["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function Ga(i){return i>=1424&&i<=2303||De["Arabic Presentation Forms-A"](i)||De["Arabic Presentation Forms-B"](i)}function jl(i,e){return!(!e&&Ga(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||De.Khmer(i))}function qa(i){for(const e of i)if(Ga(e.charCodeAt(0)))return!0;return!1}const Ds="deferred",Ls="loading",Rs="loaded";let Bs=null,Ri="unavailable",Nr=null;const Za=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Ri="error"),Bs&&Bs(i)};function Rn(){Fs.fire(new wr("pluginStateChange",{pluginStatus:Ri,pluginURL:Nr}))}const Fs=new Tr,go=function(){return Ri},ja=function(){if(Ri!==Ds||!Nr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ri=Ls,Rn(),Nr&&vn({url:Nr},i=>{i?Za(i):(Ri=Rs,Rn())})},Yi={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Ri===Rs||Yi.applyArabicShaping!=null,isLoading:()=>Ri===Ls,setState(i){if(!gt())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Ri=i.pluginStatus,Nr=i.pluginURL},isParsed(){if(!gt())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Yi.applyArabicShaping!=null&&Yi.processBidirectionalText!=null&&Yi.processStyledBidirectionalText!=null},getPluginURL(){if(!gt())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Nr}};class Gt{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ps,this.transition={})}isSupportedScript(e){return function(r,o){for(const c of r)if(!jl(c.charCodeAt(0),o))return!1;return!0}(e,Yi.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),o=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*o}:{fromScale:.5,toScale:1,t:1-(1-o)*r}}}class _o{constructor(e,r){this.property=e,this.value=r,this.expression=function(o,c){if(Ft(o))return new Uo(o,c);if(io(o)){const h=Pa(o,c);if(h.result==="error")throw new Error(h.value.map(d=>`${d.key}: ${d.message}`).join(", "));return h.value}{let h=o;return c.type==="color"&&typeof o=="string"?h=F.parse(o):c.type!=="padding"||typeof o!="number"&&!Array.isArray(o)||(h=X.parse(o)),{kind:"constant",evaluate:()=>h}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,o){return this.property.possiblyEvaluate(this,e,r,o)}}class Zo{constructor(e){this.property=e,this.value=new _o(e,void 0)}transitioned(e,r){return new Wa(this.property,this.value,r,Se({},e.transition,this.transition),e.now)}untransitioned(){return new Wa(this.property,this.value,null,{},0)}}class Xa{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return dt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Zo(this._values[e].property)),this._values[e].value=new _o(this._values[e].property,r===null?void 0:dt(r))}getTransition(e){return dt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Zo(this._values[e].property)),this._values[e].transition=dt(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(e[r]=o);const c=this.getTransition(r);c!==void 0&&(e[`${r}-transition`]=c)}return e}transitioned(e,r){const o=new Ha(this._properties);for(const c of Object.keys(this._values))o._values[c]=this._values[c].transitioned(e,r._values[c]);return o}untransitioned(){const e=new Ha(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Wa{constructor(e,r,o,c,h){this.property=e,this.value=r,this.begin=h+c.delay||0,this.end=this.begin+c.duration||0,e.specification.transition&&(c.delay||c.duration)&&(this.prior=o)}possiblyEvaluate(e,r,o){const c=e.now||0,h=this.value.possiblyEvaluate(e,r,o),d=this.prior;if(d){if(c>this.end)return this.prior=null,h;if(this.value.isDataDriven())return this.prior=null,h;if(c<this.begin)return d.possiblyEvaluate(e,r,o);{const m=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(d.possiblyEvaluate(e,r,o),h,function(g){if(g<=0)return 0;if(g>=1)return 1;const x=g*g,T=x*g;return 4*(g<.5?T:3*(g-x)+T-.75)}(m))}}return h}}class Ha{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,o){const c=new yo(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,r,o);return c}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Xl{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return dt(this._values[e].value)}setValue(e,r){this._values[e]=new _o(this._values[e].property,r===null?void 0:dt(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(e[r]=o)}return e}possiblyEvaluate(e,r,o){const c=new yo(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,r,o);return c}}class dr{constructor(e,r,o){this.property=e,this.value=r,this.parameters=o}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,o,c){return this.property.evaluate(this.value,this.parameters,e,r,o,c)}}class yo{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class qe{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,o){const c=Yn[this.specification.type];return c?c(e,r,o):e}}class Je{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,o,c){return new dr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},o,c)}:e.expression,r)}interpolate(e,r,o){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new dr(this,{kind:"constant",value:void 0},e.parameters);const c=Yn[this.specification.type];return c?new dr(this,{kind:"constant",value:c(e.value.value,r.value.value,o)},e.parameters):e}evaluate(e,r,o,c,h,d){return e.kind==="constant"?e.value:e.evaluate(r,o,c,h,d)}}class Bn extends Je{possiblyEvaluate(e,r,o,c){if(e.value===void 0)return new dr(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const h=e.expression.evaluate(r,null,{},o,c),d=e.property.specification.type==="resolvedImage"&&typeof h!="string"?h.name:h,m=this._calculate(d,d,d,r);return new dr(this,{kind:"constant",value:m},r)}if(e.expression.kind==="camera"){const h=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new dr(this,{kind:"constant",value:h},r)}return new dr(this,e.expression,r)}evaluate(e,r,o,c,h,d){if(e.kind==="source"){const m=e.evaluate(r,o,c,h,d);return this._calculate(m,m,m,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},o,c),e.evaluate({zoom:Math.floor(r.zoom)},o,c),e.evaluate({zoom:Math.floor(r.zoom)+1},o,c),r):e.value}_calculate(e,r,o,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class Os{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,c){if(e.value!==void 0){if(e.expression.kind==="constant"){const h=e.expression.evaluate(r,null,{},o,c);return this._calculate(h,h,h,r)}return this._calculate(e.expression.evaluate(new Gt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Gt(Math.floor(r.zoom),r)),e.expression.evaluate(new Gt(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,o,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class Gr{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,c){return!!e.expression.evaluate(r,null,{},o,c)}interpolate(){return!1}}class _i{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const o=e[r];o.specification.overridable&&this.overridableProperties.push(r);const c=this.defaultPropertyValues[r]=new _o(o,void 0),h=this.defaultTransitionablePropertyValues[r]=new Zo(o);this.defaultTransitioningPropertyValues[r]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=c.possiblyEvaluate({})}}}$e("DataDrivenProperty",Je),$e("DataConstantProperty",qe),$e("CrossFadedDataDrivenProperty",Bn),$e("CrossFadedProperty",Os),$e("ColorRampProperty",Gr);const qr="-transition";class fr extends Tr{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},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),r.layout&&(this._unevaluatedLayout=new Xl(r.layout)),r.paint)){this._transitionablePaint=new Xa(r.paint);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 yo(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,o={}){r!=null&&this._validate(ql,`layers.${this.id}.layout.${e}`,e,r,o)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(qr)?this._transitionablePaint.getTransition(e.slice(0,-qr.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,o={}){if(r!=null&&this._validate(Gl,`layers.${this.id}.paint.${e}`,e,r,o))return!1;if(e.endsWith(qr))return this._transitionablePaint.setTransition(e.slice(0,-qr.length),r||void 0),!1;{const c=this._transitionablePaint._values[e],h=c.property.specification["property-type"]==="cross-faded-data-driven",d=c.value.isDataDriven(),m=c.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||d||h||this._handleOverridablePaintPropertyUpdate(e,m,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,o){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),Qe(e,(r,o)=>!(r===void 0||o==="layout"&&!Object.keys(r).length||o==="paint"&&!Object.keys(r).length))}_validate(e,r,o,c,h={}){return(!h||h.validate!==!1)&&Go(this,e.call(fo,{key:r,layerType:this.type,objectKey:o,value:c,styleSpec:_e,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof dr&&Ot(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Ka={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Zr{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Jt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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 r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ii(i,e=1){let r=0,o=0;return{members:i.map(c=>{const h=Ka[c.type].BYTES_PER_ELEMENT,d=r=Us(r,Math.max(e,h)),m=c.components||1;return o=Math.max(o,h),r+=h*m,{name:c.name,type:c.type,components:m,offset:d}}),size:Us(r,Math.max(o,e)),alignment:e}}function Us(i,e){return Math.ceil(i/e)*e}class on extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const c=2*e;return this.int16[c+0]=r,this.int16[c+1]=o,e}}on.prototype.bytesPerElement=4,$e("StructArrayLayout2i4",on);class l extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const d=4*e;return this.int16[d+0]=r,this.int16[d+1]=o,this.int16[d+2]=c,this.int16[d+3]=h,e}}l.prototype.bytesPerElement=8,$e("StructArrayLayout4i8",l);class t extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,d)}emplace(e,r,o,c,h,d,m){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.int16[g+2]=c,this.int16[g+3]=h,this.int16[g+4]=d,this.int16[g+5]=m,e}}t.prototype.bytesPerElement=12,$e("StructArrayLayout2i4i12",t);class n extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,d)}emplace(e,r,o,c,h,d,m){const g=4*e,x=8*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.uint8[x+4]=c,this.uint8[x+5]=h,this.uint8[x+6]=d,this.uint8[x+7]=m,e}}n.prototype.bytesPerElement=8,$e("StructArrayLayout2i4ub8",n);class s extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const c=2*e;return this.float32[c+0]=r,this.float32[c+1]=o,e}}s.prototype.bytesPerElement=8,$e("StructArrayLayout2f8",s);class u extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d,m,g,x,T){const S=this.length;return this.resize(S+1),this.emplace(S,e,r,o,c,h,d,m,g,x,T)}emplace(e,r,o,c,h,d,m,g,x,T,S){const P=10*e;return this.uint16[P+0]=r,this.uint16[P+1]=o,this.uint16[P+2]=c,this.uint16[P+3]=h,this.uint16[P+4]=d,this.uint16[P+5]=m,this.uint16[P+6]=g,this.uint16[P+7]=x,this.uint16[P+8]=T,this.uint16[P+9]=S,e}}u.prototype.bytesPerElement=20,$e("StructArrayLayout10ui20",u);class p extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d,m,g,x,T,S,P){const k=this.length;return this.resize(k+1),this.emplace(k,e,r,o,c,h,d,m,g,x,T,S,P)}emplace(e,r,o,c,h,d,m,g,x,T,S,P,k){const L=12*e;return this.int16[L+0]=r,this.int16[L+1]=o,this.int16[L+2]=c,this.int16[L+3]=h,this.uint16[L+4]=d,this.uint16[L+5]=m,this.uint16[L+6]=g,this.uint16[L+7]=x,this.int16[L+8]=T,this.int16[L+9]=S,this.int16[L+10]=P,this.int16[L+11]=k,e}}p.prototype.bytesPerElement=24,$e("StructArrayLayout4i4ui4i24",p);class f extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.float32[h+0]=r,this.float32[h+1]=o,this.float32[h+2]=c,e}}f.prototype.bytesPerElement=12,$e("StructArrayLayout3f12",f);class _ extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}_.prototype.bytesPerElement=4,$e("StructArrayLayout1ul4",_);class y extends Jt{_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,r,o,c,h,d,m,g,x){const T=this.length;return this.resize(T+1),this.emplace(T,e,r,o,c,h,d,m,g,x)}emplace(e,r,o,c,h,d,m,g,x,T){const S=10*e,P=5*e;return this.int16[S+0]=r,this.int16[S+1]=o,this.int16[S+2]=c,this.int16[S+3]=h,this.int16[S+4]=d,this.int16[S+5]=m,this.uint32[P+3]=g,this.uint16[S+8]=x,this.uint16[S+9]=T,e}}y.prototype.bytesPerElement=20,$e("StructArrayLayout6i1ul2ui20",y);class v extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,d)}emplace(e,r,o,c,h,d,m){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.int16[g+2]=c,this.int16[g+3]=h,this.int16[g+4]=d,this.int16[g+5]=m,e}}v.prototype.bytesPerElement=12,$e("StructArrayLayout2i2i2i12",v);class E extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,o,c,h)}emplace(e,r,o,c,h,d){const m=4*e,g=8*e;return this.float32[m+0]=r,this.float32[m+1]=o,this.float32[m+2]=c,this.int16[g+6]=h,this.int16[g+7]=d,e}}E.prototype.bytesPerElement=16,$e("StructArrayLayout2f1f2i16",E);class M extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const d=12*e,m=3*e;return this.uint8[d+0]=r,this.uint8[d+1]=o,this.float32[m+1]=c,this.float32[m+2]=h,e}}M.prototype.bytesPerElement=12,$e("StructArrayLayout2ub2f12",M);class z extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.uint16[h+0]=r,this.uint16[h+1]=o,this.uint16[h+2]=c,e}}z.prototype.bytesPerElement=6,$e("StructArrayLayout3ui6",z);class V extends Jt{_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,r,o,c,h,d,m,g,x,T,S,P,k,L,Z,q,re){const ce=this.length;return this.resize(ce+1),this.emplace(ce,e,r,o,c,h,d,m,g,x,T,S,P,k,L,Z,q,re)}emplace(e,r,o,c,h,d,m,g,x,T,S,P,k,L,Z,q,re,ce){const ee=24*e,ae=12*e,xe=48*e;return this.int16[ee+0]=r,this.int16[ee+1]=o,this.uint16[ee+2]=c,this.uint16[ee+3]=h,this.uint32[ae+2]=d,this.uint32[ae+3]=m,this.uint32[ae+4]=g,this.uint16[ee+10]=x,this.uint16[ee+11]=T,this.uint16[ee+12]=S,this.float32[ae+7]=P,this.float32[ae+8]=k,this.uint8[xe+36]=L,this.uint8[xe+37]=Z,this.uint8[xe+38]=q,this.uint32[ae+10]=re,this.int16[ee+22]=ce,e}}V.prototype.bytesPerElement=48,$e("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",V);class U extends Jt{_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,r,o,c,h,d,m,g,x,T,S,P,k,L,Z,q,re,ce,ee,ae,xe,ye,Ue,Ne,Le,Me,Ee,Re){const ze=this.length;return this.resize(ze+1),this.emplace(ze,e,r,o,c,h,d,m,g,x,T,S,P,k,L,Z,q,re,ce,ee,ae,xe,ye,Ue,Ne,Le,Me,Ee,Re)}emplace(e,r,o,c,h,d,m,g,x,T,S,P,k,L,Z,q,re,ce,ee,ae,xe,ye,Ue,Ne,Le,Me,Ee,Re,ze){const Te=34*e,We=17*e;return this.int16[Te+0]=r,this.int16[Te+1]=o,this.int16[Te+2]=c,this.int16[Te+3]=h,this.int16[Te+4]=d,this.int16[Te+5]=m,this.int16[Te+6]=g,this.int16[Te+7]=x,this.uint16[Te+8]=T,this.uint16[Te+9]=S,this.uint16[Te+10]=P,this.uint16[Te+11]=k,this.uint16[Te+12]=L,this.uint16[Te+13]=Z,this.uint16[Te+14]=q,this.uint16[Te+15]=re,this.uint16[Te+16]=ce,this.uint16[Te+17]=ee,this.uint16[Te+18]=ae,this.uint16[Te+19]=xe,this.uint16[Te+20]=ye,this.uint16[Te+21]=Ue,this.uint16[Te+22]=Ne,this.uint32[We+12]=Le,this.float32[We+13]=Me,this.float32[We+14]=Ee,this.float32[We+15]=Re,this.float32[We+16]=ze,e}}U.prototype.bytesPerElement=68,$e("StructArrayLayout8i15ui1ul4f68",U);class $ extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}$.prototype.bytesPerElement=4,$e("StructArrayLayout1f4",$);class H extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.int16[h+0]=r,this.int16[h+1]=o,this.int16[h+2]=c,e}}H.prototype.bytesPerElement=6,$e("StructArrayLayout3i6",H);class Q extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=4*e;return this.uint32[2*e+0]=r,this.uint16[h+2]=o,this.uint16[h+3]=c,e}}Q.prototype.bytesPerElement=8,$e("StructArrayLayout1ul2ui8",Q);class oe extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const c=2*e;return this.uint16[c+0]=r,this.uint16[c+1]=o,e}}oe.prototype.bytesPerElement=4,$e("StructArrayLayout2ui4",oe);class N extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}N.prototype.bytesPerElement=2,$e("StructArrayLayout1ui2",N);class le extends Jt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const d=4*e;return this.float32[d+0]=r,this.float32[d+1]=o,this.float32[d+2]=c,this.float32[d+3]=h,e}}le.prototype.bytesPerElement=16,$e("StructArrayLayout4f16",le);class se extends Zr{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 He(this.anchorPointX,this.anchorPointY)}}se.prototype.size=20;class me extends y{get(e){return new se(this,e)}}$e("CollisionBoxArray",me);class ge extends Zr{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]}}ge.prototype.size=48;class we extends V{get(e){return new ge(this,e)}}$e("PlacedSymbolArray",we);class fe extends Zr{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 textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}fe.prototype.size=68;class Fe extends U{get(e){return new fe(this,e)}}$e("SymbolInstanceArray",Fe);class Ae extends ${getoffsetX(e){return this.float32[1*e+0]}}$e("GlyphOffsetArray",Ae);class Oe extends H{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}$e("SymbolLineVertexArray",Oe);class ot extends Zr{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]}}ot.prototype.size=8;class ct extends Q{get(e){return new ot(this,e)}}$e("FeatureIndexArray",ct);class Xe extends on{}class Pt extends on{}class zt extends on{}class yt extends t{}class Et extends n{}class Dt extends s{}class ui extends u{}class mr extends p{}class nr extends f{}class gr extends _{}class jr extends v{}class Qi extends M{}class Bi extends z{}class Cr extends oe{}const jo=ii([{name:"a_pos",components:2,type:"Int16"}],4),{members:oi}=jo;class pt{constructor(e=[]){this.segments=e}prepareSegment(e,r,o,c){let h=this.segments[this.segments.length-1];return e>pt.MAX_VERTEX_ARRAY_LENGTH&&ht(`Max vertices per segment is ${pt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!h||h.vertexLength+e>pt.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==c)&&(h={vertexOffset:r.length,primitiveOffset:o.length,vertexLength:0,primitiveLength:0},c!==void 0&&(h.sortKey=c),this.segments.push(h)),h}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,o,c){return new pt([{vertexOffset:e,primitiveOffset:r,vertexLength:o,primitiveLength:c,vaos:{},sortKey:0}])}}function Mt(i,e){return 256*(i=te(Math.floor(i),0,255))+te(Math.floor(e),0,255)}pt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,$e("SegmentVector",pt);const hi=ii([{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"}]);var pi={exports:{}},qt={exports:{}};qt.exports=function(i,e){var r,o,c,h,d,m,g,x;for(o=i.length-(r=3&i.length),c=e,d=3432918353,m=461845907,x=0;x<o;)g=255&i.charCodeAt(x)|(255&i.charCodeAt(++x))<<8|(255&i.charCodeAt(++x))<<16|(255&i.charCodeAt(++x))<<24,++x,c=27492+(65535&(h=5*(65535&(c=(c^=g=(65535&(g=(g=(65535&g)*d+(((g>>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*m+(((g>>>16)*m&65535)<<16)&4294967295)<<13|c>>>19))+((5*(c>>>16)&65535)<<16)&4294967295))+((58964+(h>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(x+2))<<16;case 2:g^=(255&i.charCodeAt(x+1))<<8;case 1:c^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(x)))*d+(((g>>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*m+(((g>>>16)*m&65535)<<16)&4294967295}return c^=i.length,c=2246822507*(65535&(c^=c>>>16))+((2246822507*(c>>>16)&65535)<<16)&4294967295,c=3266489909*(65535&(c^=c>>>13))+((3266489909*(c>>>16)&65535)<<16)&4294967295,(c^=c>>>16)>>>0};var er={exports:{}};er.exports=function(i,e){for(var r,o=i.length,c=e^o,h=0;o>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(h)|(255&i.charCodeAt(++h))<<8|(255&i.charCodeAt(++h))<<16|(255&i.charCodeAt(++h))<<24))+((1540483477*(r>>>16)&65535)<<16),c=1540483477*(65535&c)+((1540483477*(c>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),o-=4,++h;switch(o){case 3:c^=(255&i.charCodeAt(h+2))<<16;case 2:c^=(255&i.charCodeAt(h+1))<<8;case 1:c=1540483477*(65535&(c^=255&i.charCodeAt(h)))+((1540483477*(c>>>16)&65535)<<16)}return c=1540483477*(65535&(c^=c>>>13))+((1540483477*(c>>>16)&65535)<<16),(c^=c>>>15)>>>0};var sn=qt.exports,$s=er.exports;pi.exports=sn,pi.exports.murmur3=sn,pi.exports.murmur2=$s;class Fn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,o,c){this.ids.push(Ja(e)),this.positions.push(r,o,c)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Ja(e);let o=0,c=this.ids.length-1;for(;o<c;){const d=o+c>>1;this.ids[d]>=r?c=d:o=d+1}const h=[];for(;this.ids[o]===r;)h.push({index:this.positions[3*o],start:this.positions[3*o+1],end:this.positions[3*o+2]}),o++;return h}static serialize(e,r){const o=new Float64Array(e.ids),c=new Uint32Array(e.positions);return Vs(o,c,0,o.length-1),r&&r.push(o.buffer,c.buffer),{ids:o,positions:c}}static deserialize(e){const r=new Fn;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Ja(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:pi.exports(String(i))}function Vs(i,e,r,o){for(;r<o;){const c=i[r+o>>1];let h=r-1,d=o+1;for(;;){do h++;while(i[h]<c);do d--;while(i[d]>c);if(h>=d)break;Xr(i,h,d),Xr(e,3*h,3*d),Xr(e,3*h+1,3*d+1),Xr(e,3*h+2,3*d+2)}d-r<o-d?(Vs(i,e,r,d),r=d+1):(Vs(i,e,d+1,o),o=d)}}function Xr(i,e,r){const o=i[e];i[e]=i[r],i[r]=o}$e("FeaturePositionMap",Fn);class an{constructor(e,r){this.gl=e.gl,this.location=r}}class ln extends an{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Xo extends an{constructor(e,r){super(e,r),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 iu extends an{constructor(e,r){super(e,r),this.current=F.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 Lp=new Float32Array(16);function Wl(i){return[Mt(255*i.r,255*i.g),Mt(255*i.b,255*i.a)]}class Ns{constructor(e,r,o){this.value=e,this.uniformNames=r.map(c=>`u_${c}`),this.type=o}setUniform(e,r,o){e.set(o.constantOr(this.value))}getBinding(e,r,o){return this.type==="color"?new iu(e,r):new ln(e,r)}}class Wo{constructor(e,r){this.uniformNames=r.map(o=>`u_${o}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,o,c){const h=c==="u_pattern_to"?this.patternTo:c==="u_pattern_from"?this.patternFrom:c==="u_pixel_ratio_to"?this.pixelRatioTo:c==="u_pixel_ratio_from"?this.pixelRatioFrom:null;h&&e.set(h)}getBinding(e,r,o){return o.substr(0,9)==="u_pattern"?new Xo(e,r):new ln(e,r)}}class cn{constructor(e,r,o,c){this.expression=e,this.type=o,this.maxValue=0,this.paintVertexAttributes=r.map(h=>({name:`a_${h}`,type:"Float32",components:o==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(e,r,o,c,h){const d=this.paintVertexArray.length,m=this.expression.evaluate(new Gt(0),r,{},c,[],h);this.paintVertexArray.resize(e),this._setPaintValue(d,e,m)}updatePaintArray(e,r,o,c){const h=this.expression.evaluate({zoom:0},o,c);this._setPaintValue(e,r,h)}_setPaintValue(e,r,o){if(this.type==="color"){const c=Wl(o);for(let h=e;h<r;h++)this.paintVertexArray.emplace(h,c[0],c[1])}else{for(let c=e;c<r;c++)this.paintVertexArray.emplace(c,o);this.maxValue=Math.max(this.maxValue,Math.abs(o))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Ar{constructor(e,r,o,c,h,d){this.expression=e,this.uniformNames=r.map(m=>`u_${m}_t`),this.type=o,this.useIntegerZoom=c,this.zoom=h,this.maxValue=0,this.paintVertexAttributes=r.map(m=>({name:`a_${m}`,type:"Float32",components:o==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(e,r,o,c,h){const d=this.expression.evaluate(new Gt(this.zoom),r,{},c,[],h),m=this.expression.evaluate(new Gt(this.zoom+1),r,{},c,[],h),g=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(g,e,d,m)}updatePaintArray(e,r,o,c){const h=this.expression.evaluate({zoom:this.zoom},o,c),d=this.expression.evaluate({zoom:this.zoom+1},o,c);this._setPaintValue(e,r,h,d)}_setPaintValue(e,r,o,c){if(this.type==="color"){const h=Wl(o),d=Wl(c);for(let m=e;m<r;m++)this.paintVertexArray.emplace(m,h[0],h[1],d[0],d[1])}else{for(let h=e;h<r;h++)this.paintVertexArray.emplace(h,o,c);this.maxValue=Math.max(this.maxValue,Math.abs(o),Math.abs(c))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){const o=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,c=te(this.expression.interpolationFactor(o,this.zoom,this.zoom+1),0,1);e.set(c)}getBinding(e,r,o){return new ln(e,r)}}class On{constructor(e,r,o,c,h,d){this.expression=e,this.type=r,this.useIntegerZoom=o,this.zoom=c,this.layerId=d,this.zoomInPaintVertexArray=new h,this.zoomOutPaintVertexArray=new h}populatePaintArray(e,r,o){const c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(c,e,r.patterns&&r.patterns[this.layerId],o)}updatePaintArray(e,r,o,c,h){this._setPaintValues(e,r,o.patterns&&o.patterns[this.layerId],h)}_setPaintValues(e,r,o,c){if(!c||!o)return;const{min:h,mid:d,max:m}=o,g=c[h],x=c[d],T=c[m];if(g&&x&&T)for(let S=e;S<r;S++)this.zoomInPaintVertexArray.emplace(S,x.tl[0],x.tl[1],x.br[0],x.br[1],g.tl[0],g.tl[1],g.br[0],g.br[1],x.pixelRatio,g.pixelRatio),this.zoomOutPaintVertexArray.emplace(S,x.tl[0],x.tl[1],x.br[0],x.br[1],T.tl[0],T.tl[1],T.br[0],T.br[1],x.pixelRatio,T.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,hi.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,hi.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class ru{constructor(e,r,o){this.binders={},this._buffers=[];const c=[];for(const h in e.paint._values){if(!o(h))continue;const d=e.paint.get(h);if(!(d instanceof dr&&Ot(d.property.specification)))continue;const m=Rp(h,e.type),g=d.value,x=d.property.specification.type,T=d.property.useIntegerZoom,S=d.property.specification["property-type"],P=S==="cross-faded"||S==="cross-faded-data-driven";if(g.kind==="constant")this.binders[h]=P?new Wo(g.value,m):new Ns(g.value,m,x),c.push(`/u_${h}`);else if(g.kind==="source"||P){const k=nu(h,x,"source");this.binders[h]=P?new On(g,x,T,r,k,e.id):new cn(g,m,x,k),c.push(`/a_${h}`)}else{const k=nu(h,x,"composite");this.binders[h]=new Ar(g,m,x,T,r,k),c.push(`/z_${h}`)}}this.cacheKey=c.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof cn||r instanceof Ar?r.maxValue:0}populatePaintArrays(e,r,o,c,h){for(const d in this.binders){const m=this.binders[d];(m instanceof cn||m instanceof Ar||m instanceof On)&&m.populatePaintArray(e,r,o,c,h)}}setConstantPatternPositions(e,r){for(const o in this.binders){const c=this.binders[o];c instanceof Wo&&c.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,o,c,h){let d=!1;for(const m in e){const g=r.getPositions(m);for(const x of g){const T=o.feature(x.index);for(const S in this.binders){const P=this.binders[S];if((P instanceof cn||P instanceof Ar||P instanceof On)&&P.expression.isStateDependent===!0){const k=c.paint.get(S);P.expression=k.value,P.updatePaintArray(x.start,x.end,T,e[m],h),d=!0}}}}return d}defines(){const e=[];for(const r in this.binders){const o=this.binders[r];(o instanceof Ns||o instanceof Wo)&&e.push(...o.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof cn||o instanceof Ar)for(let c=0;c<o.paintVertexAttributes.length;c++)e.push(o.paintVertexAttributes[c].name);else if(o instanceof On)for(let c=0;c<hi.members.length;c++)e.push(hi.members[c].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof Ns||o instanceof Wo||o instanceof Ar)for(const c of o.uniformNames)e.push(c)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const o=[];for(const c in this.binders){const h=this.binders[c];if(h instanceof Ns||h instanceof Wo||h instanceof Ar){for(const d of h.uniformNames)if(r[d]){const m=h.getBinding(e,r[d],d);o.push({name:d,property:c,binding:m})}}}return o}setUniforms(e,r,o,c){for(const{name:h,property:d,binding:m}of r)this.binders[d].setUniform(m,c,o.get(d),h)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const o=this.binders[r];if(e&&o instanceof On){const c=e.fromScale===2?o.zoomInPaintVertexBuffer:o.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(o instanceof cn||o instanceof Ar)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}}upload(e){for(const r in this.binders){const o=this.binders[r];(o instanceof cn||o instanceof Ar||o instanceof On)&&o.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof cn||r instanceof Ar||r instanceof On)&&r.destroy()}}}class xo{constructor(e,r,o=()=>!0){this.programConfigurations={};for(const c of e)this.programConfigurations[c.id]=new ru(c,r,o);this.needsUpload=!1,this._featureMap=new Fn,this._bufferOffset=0}populatePaintArrays(e,r,o,c,h,d){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(e,r,c,h,d);r.id!==void 0&&this._featureMap.add(r.id,o,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,o,c){for(const h of o)this.needsUpload=this.programConfigurations[h.id].updatePaintArrays(e,this._featureMap,r,h,c)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Rp(i,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-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"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function nu(i,e,r){const o={color:{source:s,composite:le},number:{source:$,composite:s}},c=function(h){return{"line-pattern":{source:ui,composite:ui},"fill-pattern":{source:ui,composite:ui},"fill-extrusion-pattern":{source:ui,composite:ui}}[h]}(i);return c&&c[r]||o[e][r]}$e("ConstantBinder",Ns),$e("CrossFadedConstantBinder",Wo),$e("SourceExpressionBinder",cn),$e("CrossFadedCompositeBinder",On),$e("CompositeExpressionBinder",Ar),$e("ProgramConfiguration",ru,{omit:["_buffers"]}),$e("ProgramConfigurationSet",xo);var si=8192;const Hl=Math.pow(2,14)-1,ou=-Hl-1;function vo(i){const e=si/i.extent,r=i.loadGeometry();for(let o=0;o<r.length;o++){const c=r[o];for(let h=0;h<c.length;h++){const d=c[h],m=Math.round(d.x*e),g=Math.round(d.y*e);d.x=te(m,ou,Hl),d.y=te(g,ou,Hl),(m<d.x||m>d.x+1||g<d.y||g>d.y+1)&&ht("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function bo(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?vo(i):[]}}function Ya(i,e,r,o,c){i.emplaceBack(2*e+(o+1)/2,2*r+(c+1)/2)}class Kl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Pt,this.indexArray=new Bi,this.segments=new pt,this.programConfigurations=new xo(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){const c=this.layers[0],h=[];let d=null,m=!1;c.type==="circle"&&(d=c.layout.get("circle-sort-key"),m=!d.isConstant());for(const{feature:g,id:x,index:T,sourceLayerIndex:S}of e){const P=this.layers[0]._featureFilter.needGeometry,k=bo(g,P);if(!this.layers[0]._featureFilter.filter(new Gt(this.zoom),k,o))continue;const L=m?d.evaluate(k,{},o):void 0,Z={id:x,properties:g.properties,type:g.type,sourceLayerIndex:S,index:T,geometry:P?k.geometry:vo(g),patterns:{},sortKey:L};h.push(Z)}m&&h.sort((g,x)=>g.sortKey-x.sortKey);for(const g of h){const{geometry:x,index:T,sourceLayerIndex:S}=g,P=e[T].feature;this.addFeature(g,x,T,o),r.featureIndex.insert(P,x,T,S,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,oi),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,r,o,c){for(const h of r)for(const d of h){const m=d.x,g=d.y;if(m<0||m>=si||g<0||g>=si)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),T=x.vertexLength;Ya(this.layoutVertexArray,m,g,-1,-1),Ya(this.layoutVertexArray,m,g,1,-1),Ya(this.layoutVertexArray,m,g,1,1),Ya(this.layoutVertexArray,m,g,-1,1),this.indexArray.emplaceBack(T,T+1,T+2),this.indexArray.emplaceBack(T,T+3,T+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{},c)}}function su(i,e){for(let r=0;r<i.length;r++)if(Ho(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Ho(i,e[r]))return!0;return!!Jl(i,e)}function Bp(i,e,r){return!!Ho(i,e)||!!Yl(e,i,r)}function au(i,e){if(i.length===1)return cu(e,i[0]);for(let r=0;r<e.length;r++){const o=e[r];for(let c=0;c<o.length;c++)if(Ho(i,o[c]))return!0}for(let r=0;r<i.length;r++)if(cu(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Jl(i,e[r]))return!0;return!1}function Fp(i,e,r){if(i.length>1){if(Jl(i,e))return!0;for(let o=0;o<e.length;o++)if(Yl(e[o],i,r))return!0}for(let o=0;o<i.length;o++)if(Yl(i[o],e,r))return!0;return!1}function Jl(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const o=i[r],c=i[r+1];for(let h=0;h<e.length-1;h++)if(Op(o,c,e[h],e[h+1]))return!0}return!1}function Op(i,e,r,o){return xt(i,r,o)!==xt(e,r,o)&&xt(i,e,r)!==xt(i,e,o)}function Yl(i,e,r){const o=r*r;if(e.length===1)return i.distSqr(e[0])<o;for(let c=1;c<e.length;c++)if(lu(i,e[c-1],e[c])<o)return!0;return!1}function lu(i,e,r){const o=e.distSqr(r);if(o===0)return i.distSqr(e);const c=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/o;return i.distSqr(c<0?e:c>1?r:r.sub(e)._mult(c)._add(e))}function cu(i,e){let r,o,c,h=!1;for(let d=0;d<i.length;d++){r=i[d];for(let m=0,g=r.length-1;m<r.length;g=m++)o=r[m],c=r[g],o.y>e.y!=c.y>e.y&&e.x<(c.x-o.x)*(e.y-o.y)/(c.y-o.y)+o.x&&(h=!h)}return h}function Ho(i,e){let r=!1;for(let o=0,c=i.length-1;o<i.length;c=o++){const h=i[o],d=i[c];h.y>e.y!=d.y>e.y&&e.x<(d.x-h.x)*(e.y-h.y)/(d.y-h.y)+h.x&&(r=!r)}return r}function Up(i,e,r){const o=r[0],c=r[2];if(i.x<o.x&&e.x<o.x||i.x>c.x&&e.x>c.x||i.y<o.y&&e.y<o.y||i.y>c.y&&e.y>c.y)return!1;const h=xt(i,e,r[0]);return h!==xt(i,e,r[1])||h!==xt(i,e,r[2])||h!==xt(i,e,r[3])}function Gs(i,e,r){const o=e.paint.get(i).value;return o.kind==="constant"?o.value:r.programConfigurations.get(e.id).getMaxValue(i)}function Qa(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function el(i,e,r,o,c){if(!e[0]&&!e[1])return i;const h=He.convert(e)._mult(c);r==="viewport"&&h._rotate(-o);const d=[];for(let m=0;m<i.length;m++)d.push(i[m].sub(h));return d}$e("CircleBucket",Kl,{omit:["layers"]});const $p=new _i({"circle-sort-key":new Je(_e.layout_circle["circle-sort-key"])});var Vp={paint:new _i({"circle-radius":new Je(_e.paint_circle["circle-radius"]),"circle-color":new Je(_e.paint_circle["circle-color"]),"circle-blur":new Je(_e.paint_circle["circle-blur"]),"circle-opacity":new Je(_e.paint_circle["circle-opacity"]),"circle-translate":new qe(_e.paint_circle["circle-translate"]),"circle-translate-anchor":new qe(_e.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new qe(_e.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new qe(_e.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Je(_e.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Je(_e.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Je(_e.paint_circle["circle-stroke-opacity"])}),layout:$p},Fi=1e-6,Oi=typeof Float32Array!="undefined"?Float32Array:Array;function uu(){var i=new Oi(9);return Oi!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,i}function Ql(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function hu(i,e,r){var o=e[0],c=e[1],h=e[2],d=e[3],m=e[4],g=e[5],x=e[6],T=e[7],S=e[8],P=e[9],k=e[10],L=e[11],Z=e[12],q=e[13],re=e[14],ce=e[15],ee=r[0],ae=r[1],xe=r[2],ye=r[3];return i[0]=ee*o+ae*m+xe*S+ye*Z,i[1]=ee*c+ae*g+xe*P+ye*q,i[2]=ee*h+ae*x+xe*k+ye*re,i[3]=ee*d+ae*T+xe*L+ye*ce,i[4]=(ee=r[4])*o+(ae=r[5])*m+(xe=r[6])*S+(ye=r[7])*Z,i[5]=ee*c+ae*g+xe*P+ye*q,i[6]=ee*h+ae*x+xe*k+ye*re,i[7]=ee*d+ae*T+xe*L+ye*ce,i[8]=(ee=r[8])*o+(ae=r[9])*m+(xe=r[10])*S+(ye=r[11])*Z,i[9]=ee*c+ae*g+xe*P+ye*q,i[10]=ee*h+ae*x+xe*k+ye*re,i[11]=ee*d+ae*T+xe*L+ye*ce,i[12]=(ee=r[12])*o+(ae=r[13])*m+(xe=r[14])*S+(ye=r[15])*Z,i[13]=ee*c+ae*g+xe*P+ye*q,i[14]=ee*h+ae*x+xe*k+ye*re,i[15]=ee*d+ae*T+xe*L+ye*ce,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var qs,Np=hu;function pu(){var i=new Oi(3);return Oi!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function du(i,e,r){var o=new Oi(3);return o[0]=i,o[1]=e,o[2]=r,o}function tl(i,e,r){var o=e[0],c=e[1],h=e[2],d=e[3];return i[0]=r[0]*o+r[4]*c+r[8]*h+r[12]*d,i[1]=r[1]*o+r[5]*c+r[9]*h+r[13]*d,i[2]=r[2]*o+r[6]*c+r[10]*h+r[14]*d,i[3]=r[3]*o+r[7]*c+r[11]*h+r[15]*d,i}function fu(){var i=new Oi(4);return Oi!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function mu(i,e){const r=tl([],[i.x,i.y,0,1],e);return new He(r[0]/r[3],r[1]/r[3])}pu(),qs=new Oi(4),Oi!=Float32Array&&(qs[0]=0,qs[1]=0,qs[2]=0,qs[3]=0),pu(),du(1,0,0),du(0,1,0),fu(),fu(),uu(),function(){var i;i=new Oi(2),Oi!=Float32Array&&(i[0]=0,i[1]=0)}();class gu extends Kl{}$e("HeatmapBucket",gu,{omit:["layers"]});var Gp={paint:new _i({"heatmap-radius":new Je(_e.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Je(_e.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new qe(_e.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Gr(_e.paint_heatmap["heatmap-color"]),"heatmap-opacity":new qe(_e.paint_heatmap["heatmap-opacity"])})};function ec(i,{width:e,height:r},o,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==e*r*o)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${e*r*o}`)}else c=new Uint8Array(e*r*o);return i.width=e,i.height=r,i.data=c,i}function _u(i,{width:e,height:r},o){if(e===i.width&&r===i.height)return;const c=ec({},{width:e,height:r},o);tc(i,c,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},o),i.width=e,i.height=r,i.data=c.data}function tc(i,e,r,o,c,h){if(c.width===0||c.height===0)return e;if(c.width>i.width||c.height>i.height||r.x>i.width-c.width||r.y>i.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>e.width||c.height>e.height||o.x>e.width-c.width||o.y>e.height-c.height)throw new RangeError("out of range destination coordinates for image copy");const d=i.data,m=e.data;if(d===m)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<c.height;g++){const x=((r.y+g)*i.width+r.x)*h,T=((o.y+g)*e.width+o.x)*h;for(let S=0;S<c.width*h;S++)m[T+S]=d[x+S]}return e}class Zs{constructor(e,r){ec(this,e,1,r)}resize(e){_u(this,e,1)}clone(){return new Zs({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){tc(e,r,o,c,h,1)}}class or{constructor(e,r){ec(this,e,4,r)}resize(e){_u(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new or({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){tc(e,r,o,c,h,4)}}function yu(i){const e={},r=i.resolution||256,o=i.clips?i.clips.length:1,c=i.image||new or({width:r,height:o});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const h=(d,m,g)=>{e[i.evaluationKey]=g;const x=i.expression.evaluate(e);c.data[d+m+0]=Math.floor(255*x.r/x.a),c.data[d+m+1]=Math.floor(255*x.g/x.a),c.data[d+m+2]=Math.floor(255*x.b/x.a),c.data[d+m+3]=Math.floor(255*x.a)};if(i.clips)for(let d=0,m=0;d<o;++d,m+=4*r)for(let g=0,x=0;g<r;g++,x+=4){const T=g/(r-1),{start:S,end:P}=i.clips[d];h(m,x,S*(1-T)+P*T)}else for(let d=0,m=0;d<r;d++,m+=4)h(0,m,d/(r-1));return c}$e("AlphaImage",Zs),$e("RGBAImage",or);var qp={paint:new _i({"hillshade-illumination-direction":new qe(_e.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new qe(_e.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new qe(_e.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new qe(_e.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new qe(_e.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new qe(_e.paint_hillshade["hillshade-accent-color"])})};const Zp=ii([{name:"a_pos",components:2,type:"Int16"}],4),{members:jp}=Zp;var il={exports:{}};function rl(i,e,r){r=r||2;var o,c,h,d,m,g,x,T=e&&e.length,S=T?e[0]*r:i.length,P=xu(i,0,S,r,!0),k=[];if(!P||P.next===P.prev)return k;if(T&&(P=function(Z,q,re,ce){var ee,ae,xe,ye=[];for(ee=0,ae=q.length;ee<ae;ee++)(xe=xu(Z,q[ee]*ce,ee<ae-1?q[ee+1]*ce:Z.length,ce,!1))===xe.next&&(xe.steiner=!0),ye.push(ed(xe));for(ye.sort(Jp),ee=0;ee<ye.length;ee++)re=Yp(ye[ee],re);return re}(i,e,P,r)),i.length>80*r){o=h=i[0],c=d=i[1];for(var L=r;L<S;L+=r)(m=i[L])<o&&(o=m),(g=i[L+1])<c&&(c=g),m>h&&(h=m),g>d&&(d=g);x=(x=Math.max(h-o,d-c))!==0?32767/x:0}return js(P,k,r,o,c,x,0),k}function xu(i,e,r,o,c){var h,d;if(c===nc(i,e,r,o)>0)for(h=e;h<r;h+=o)d=wu(h,i[h],i[h+1],d);else for(h=r-o;h>=e;h-=o)d=wu(h,i[h],i[h+1],d);return d&&nl(d,d.next)&&(Ws(d),d=d.next),d}function wo(i,e){if(!i)return i;e||(e=i);var r,o=i;do if(r=!1,o.steiner||!nl(o,o.next)&&Qt(o.prev,o,o.next)!==0)o=o.next;else{if(Ws(o),(o=e=o.prev)===o.next)break;r=!0}while(r||o!==e);return e}function js(i,e,r,o,c,h,d){if(i){!d&&h&&function(T,S,P,k){var L=T;do L.z===0&&(L.z=ic(L.x,L.y,S,P,k)),L.prevZ=L.prev,L.nextZ=L.next,L=L.next;while(L!==T);L.prevZ.nextZ=null,L.prevZ=null,function(Z){var q,re,ce,ee,ae,xe,ye,Ue,Ne=1;do{for(re=Z,Z=null,ae=null,xe=0;re;){for(xe++,ce=re,ye=0,q=0;q<Ne&&(ye++,ce=ce.nextZ);q++);for(Ue=Ne;ye>0||Ue>0&&ce;)ye!==0&&(Ue===0||!ce||re.z<=ce.z)?(ee=re,re=re.nextZ,ye--):(ee=ce,ce=ce.nextZ,Ue--),ae?ae.nextZ=ee:Z=ee,ee.prevZ=ae,ae=ee;re=ce}ae.nextZ=null,Ne*=2}while(xe>1)}(L)}(i,o,c,h);for(var m,g,x=i;i.prev!==i.next;)if(m=i.prev,g=i.next,h?Wp(i,o,c,h):Xp(i))e.push(m.i/r|0),e.push(i.i/r|0),e.push(g.i/r|0),Ws(i),i=g.next,x=g.next;else if((i=g)===x){d?d===1?js(i=Hp(wo(i),e,r),e,r,o,c,h,2):d===2&&Kp(i,e,r,o,c,h):js(wo(i),e,r,o,c,h,1);break}}}function Xp(i){var e=i.prev,r=i,o=i.next;if(Qt(e,r,o)>=0)return!1;for(var c=e.x,h=r.x,d=o.x,m=e.y,g=r.y,x=o.y,T=c<h?c<d?c:d:h<d?h:d,S=m<g?m<x?m:x:g<x?g:x,P=c>h?c>d?c:d:h>d?h:d,k=m>g?m>x?m:x:g>x?g:x,L=o.next;L!==e;){if(L.x>=T&&L.x<=P&&L.y>=S&&L.y<=k&&Ko(c,m,h,g,d,x,L.x,L.y)&&Qt(L.prev,L,L.next)>=0)return!1;L=L.next}return!0}function Wp(i,e,r,o){var c=i.prev,h=i,d=i.next;if(Qt(c,h,d)>=0)return!1;for(var m=c.x,g=h.x,x=d.x,T=c.y,S=h.y,P=d.y,k=m<g?m<x?m:x:g<x?g:x,L=T<S?T<P?T:P:S<P?S:P,Z=m>g?m>x?m:x:g>x?g:x,q=T>S?T>P?T:P:S>P?S:P,re=ic(k,L,e,r,o),ce=ic(Z,q,e,r,o),ee=i.prevZ,ae=i.nextZ;ee&&ee.z>=re&&ae&&ae.z<=ce;){if(ee.x>=k&&ee.x<=Z&&ee.y>=L&&ee.y<=q&&ee!==c&&ee!==d&&Ko(m,T,g,S,x,P,ee.x,ee.y)&&Qt(ee.prev,ee,ee.next)>=0||(ee=ee.prevZ,ae.x>=k&&ae.x<=Z&&ae.y>=L&&ae.y<=q&&ae!==c&&ae!==d&&Ko(m,T,g,S,x,P,ae.x,ae.y)&&Qt(ae.prev,ae,ae.next)>=0))return!1;ae=ae.nextZ}for(;ee&&ee.z>=re;){if(ee.x>=k&&ee.x<=Z&&ee.y>=L&&ee.y<=q&&ee!==c&&ee!==d&&Ko(m,T,g,S,x,P,ee.x,ee.y)&&Qt(ee.prev,ee,ee.next)>=0)return!1;ee=ee.prevZ}for(;ae&&ae.z<=ce;){if(ae.x>=k&&ae.x<=Z&&ae.y>=L&&ae.y<=q&&ae!==c&&ae!==d&&Ko(m,T,g,S,x,P,ae.x,ae.y)&&Qt(ae.prev,ae,ae.next)>=0)return!1;ae=ae.nextZ}return!0}function Hp(i,e,r){var o=i;do{var c=o.prev,h=o.next.next;!nl(c,h)&&vu(c,o,o.next,h)&&Xs(c,h)&&Xs(h,c)&&(e.push(c.i/r|0),e.push(o.i/r|0),e.push(h.i/r|0),Ws(o),Ws(o.next),o=i=h),o=o.next}while(o!==i);return wo(o)}function Kp(i,e,r,o,c,h){var d=i;do{for(var m=d.next.next;m!==d.prev;){if(d.i!==m.i&&td(d,m)){var g=bu(d,m);return d=wo(d,d.next),g=wo(g,g.next),js(d,e,r,o,c,h,0),void js(g,e,r,o,c,h,0)}m=m.next}d=d.next}while(d!==i)}function Jp(i,e){return i.x-e.x}function Yp(i,e){var r=function(c,h){var d,m=h,g=c.x,x=c.y,T=-1/0;do{if(x<=m.y&&x>=m.next.y&&m.next.y!==m.y){var S=m.x+(x-m.y)*(m.next.x-m.x)/(m.next.y-m.y);if(S<=g&&S>T&&(T=S,d=m.x<m.next.x?m:m.next,S===g))return d}m=m.next}while(m!==h);if(!d)return null;var P,k=d,L=d.x,Z=d.y,q=1/0;m=d;do g>=m.x&&m.x>=L&&g!==m.x&&Ko(x<Z?g:T,x,L,Z,x<Z?T:g,x,m.x,m.y)&&(P=Math.abs(x-m.y)/(g-m.x),Xs(m,c)&&(P<q||P===q&&(m.x>d.x||m.x===d.x&&Qp(d,m)))&&(d=m,q=P)),m=m.next;while(m!==k);return d}(i,e);if(!r)return e;var o=bu(r,i);return wo(o,o.next),wo(r,r.next)}function Qp(i,e){return Qt(i.prev,i,e.prev)<0&&Qt(e.next,i,i.next)<0}function ic(i,e,r,o,c){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*c|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-o)*c|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ed(i){var e=i,r=i;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==i);return r}function Ko(i,e,r,o,c,h,d,m){return(c-d)*(e-m)>=(i-d)*(h-m)&&(i-d)*(o-m)>=(r-d)*(e-m)&&(r-d)*(h-m)>=(c-d)*(o-m)}function td(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,o){var c=r;do{if(c.i!==r.i&&c.next.i!==r.i&&c.i!==o.i&&c.next.i!==o.i&&vu(c,c.next,r,o))return!0;c=c.next}while(c!==r);return!1}(i,e)&&(Xs(i,e)&&Xs(e,i)&&function(r,o){var c=r,h=!1,d=(r.x+o.x)/2,m=(r.y+o.y)/2;do c.y>m!=c.next.y>m&&c.next.y!==c.y&&d<(c.next.x-c.x)*(m-c.y)/(c.next.y-c.y)+c.x&&(h=!h),c=c.next;while(c!==r);return h}(i,e)&&(Qt(i.prev,i,e.prev)||Qt(i,e.prev,e))||nl(i,e)&&Qt(i.prev,i,i.next)>0&&Qt(e.prev,e,e.next)>0)}function Qt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function nl(i,e){return i.x===e.x&&i.y===e.y}function vu(i,e,r,o){var c=sl(Qt(i,e,r)),h=sl(Qt(i,e,o)),d=sl(Qt(r,o,i)),m=sl(Qt(r,o,e));return c!==h&&d!==m||!(c!==0||!ol(i,r,e))||!(h!==0||!ol(i,o,e))||!(d!==0||!ol(r,i,o))||!(m!==0||!ol(r,e,o))}function ol(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function sl(i){return i>0?1:i<0?-1:0}function Xs(i,e){return Qt(i.prev,i,i.next)<0?Qt(i,e,i.next)>=0&&Qt(i,i.prev,e)>=0:Qt(i,e,i.prev)<0||Qt(i,i.next,e)<0}function bu(i,e){var r=new rc(i.i,i.x,i.y),o=new rc(e.i,e.x,e.y),c=i.next,h=e.prev;return i.next=e,e.prev=i,r.next=c,c.prev=r,o.next=r,r.prev=o,h.next=o,o.prev=h,o}function wu(i,e,r,o){var c=new rc(i,e,r);return o?(c.next=o.next,c.prev=o,o.next.prev=c,o.next=c):(c.prev=c,c.next=c),c}function Ws(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function rc(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function nc(i,e,r,o){for(var c=0,h=e,d=r-o;h<r;h+=o)c+=(i[d]-i[h])*(i[h+1]+i[d+1]),d=h;return c}function id(i,e,r,o,c){Tu(i,e,r||0,o||i.length-1,c||rd)}function Tu(i,e,r,o,c){for(;o>r;){if(o-r>600){var h=o-r+1,d=e-r+1,m=Math.log(h),g=.5*Math.exp(2*m/3),x=.5*Math.sqrt(m*g*(h-g)/h)*(d-h/2<0?-1:1);Tu(i,e,Math.max(r,Math.floor(e-d*g/h+x)),Math.min(o,Math.floor(e+(h-d)*g/h+x)),c)}var T=i[e],S=r,P=o;for(Hs(i,r,e),c(i[o],T)>0&&Hs(i,r,o);S<P;){for(Hs(i,S,P),S++,P--;c(i[S],T)<0;)S++;for(;c(i[P],T)>0;)P--}c(i[r],T)===0?Hs(i,r,P):Hs(i,++P,o),P<=e&&(r=P+1),e<=P&&(o=P-1)}}function Hs(i,e,r){var o=i[e];i[e]=i[r],i[r]=o}function rd(i,e){return i<e?-1:i>e?1:0}function oc(i,e){const r=i.length;if(r<=1)return[i];const o=[];let c,h;for(let d=0;d<r;d++){const m=Xt(i[d]);m!==0&&(i[d].area=Math.abs(m),h===void 0&&(h=m<0),h===m<0?(c&&o.push(c),c=[i[d]]):c.push(i[d]))}if(c&&o.push(c),e>1)for(let d=0;d<o.length;d++)o[d].length<=e||(id(o[d],e,1,o[d].length-1,nd),o[d]=o[d].slice(0,e));return o}function nd(i,e){return e.area-i.area}function sc(i,e,r){const o=r.patternDependencies;let c=!1;for(const h of e){const d=h.paint.get(`${i}-pattern`);d.isConstant()||(c=!0);const m=d.constantOr(null);m&&(c=!0,o[m.to]=!0,o[m.from]=!0)}return c}function ac(i,e,r,o,c){const h=c.patternDependencies;for(const d of e){const m=d.paint.get(`${i}-pattern`).value;if(m.kind!=="constant"){let g=m.evaluate({zoom:o-1},r,{},c.availableImages),x=m.evaluate({zoom:o},r,{},c.availableImages),T=m.evaluate({zoom:o+1},r,{},c.availableImages);g=g&&g.name?g.name:g,x=x&&x.name?x.name:x,T=T&&T.name?T.name:T,h[g]=!0,h[x]=!0,h[T]=!0,r.patterns[d.id]={min:g,mid:x,max:T}}}return r}il.exports=rl,il.exports.default=rl,rl.deviation=function(i,e,r,o){var c=e&&e.length,h=Math.abs(nc(i,0,c?e[0]*r:i.length,r));if(c)for(var d=0,m=e.length;d<m;d++)h-=Math.abs(nc(i,e[d]*r,d<m-1?e[d+1]*r:i.length,r));var g=0;for(d=0;d<o.length;d+=3){var x=o[d]*r,T=o[d+1]*r,S=o[d+2]*r;g+=Math.abs((i[x]-i[S])*(i[T+1]-i[x+1])-(i[x]-i[T])*(i[S+1]-i[x+1]))}return h===0&&g===0?0:Math.abs((g-h)/h)},rl.flatten=function(i){for(var e=i[0][0].length,r={vertices:[],holes:[],dimensions:e},o=0,c=0;c<i.length;c++){for(var h=0;h<i[c].length;h++)for(var d=0;d<e;d++)r.vertices.push(i[c][h][d]);c>0&&r.holes.push(o+=i[c-1].length)}return r};class lc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new zt,this.indexArray=new Bi,this.indexArray2=new Cr,this.programConfigurations=new xo(e.layers,e.zoom),this.segments=new pt,this.segments2=new pt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=sc("fill",this.layers,r);const c=this.layers[0].layout.get("fill-sort-key"),h=!c.isConstant(),d=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:T}of e){const S=this.layers[0]._featureFilter.needGeometry,P=bo(m,S);if(!this.layers[0]._featureFilter.filter(new Gt(this.zoom),P,o))continue;const k=h?c.evaluate(P,{},o,r.availableImages):void 0,L={id:g,properties:m.properties,type:m.type,sourceLayerIndex:T,index:x,geometry:S?P.geometry:vo(m),patterns:{},sortKey:k};d.push(L)}h&&d.sort((m,g)=>m.sortKey-g.sortKey);for(const m of d){const{geometry:g,index:x,sourceLayerIndex:T}=m;if(this.hasPattern){const S=ac("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(S)}else this.addFeature(m,g,x,o,{});r.featureIndex.insert(e[x].feature,g,x,T,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}addFeatures(e,r,o){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,jp),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,r,o,c,h){for(const d of oc(r,500)){let m=0;for(const k of d)m+=k.length;const g=this.segments.prepareSegment(m,this.layoutVertexArray,this.indexArray),x=g.vertexLength,T=[],S=[];for(const k of d){if(k.length===0)continue;k!==d[0]&&S.push(T.length/2);const L=this.segments2.prepareSegment(k.length,this.layoutVertexArray,this.indexArray2),Z=L.vertexLength;this.layoutVertexArray.emplaceBack(k[0].x,k[0].y),this.indexArray2.emplaceBack(Z+k.length-1,Z),T.push(k[0].x),T.push(k[0].y);for(let q=1;q<k.length;q++)this.layoutVertexArray.emplaceBack(k[q].x,k[q].y),this.indexArray2.emplaceBack(Z+q-1,Z+q),T.push(k[q].x),T.push(k[q].y);L.vertexLength+=k.length,L.primitiveLength+=k.length}const P=il.exports(T,S);for(let k=0;k<P.length;k+=3)this.indexArray.emplaceBack(x+P[k],x+P[k+1],x+P[k+2]);g.vertexLength+=m,g.primitiveLength+=P.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}}$e("FillBucket",lc,{omit:["layers","patternFeatures"]});const od=new _i({"fill-sort-key":new Je(_e.layout_fill["fill-sort-key"])});var sd={paint:new _i({"fill-antialias":new qe(_e.paint_fill["fill-antialias"]),"fill-opacity":new Je(_e.paint_fill["fill-opacity"]),"fill-color":new Je(_e.paint_fill["fill-color"]),"fill-outline-color":new Je(_e.paint_fill["fill-outline-color"]),"fill-translate":new qe(_e.paint_fill["fill-translate"]),"fill-translate-anchor":new qe(_e.paint_fill["fill-translate-anchor"]),"fill-pattern":new Bn(_e.paint_fill["fill-pattern"])}),layout:od};const ad=ii([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),ld=ii([{name:"a_centroid",components:2,type:"Int16"}],4),{members:cd}=ad;var Un={},ud=He,Eu=Jo;function Jo(i,e,r,o,c){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=o,this._values=c,i.readFields(hd,this,e)}function hd(i,e,r){i==1?e.id=r.readVarint():i==2?function(o,c){for(var h=o.readVarint()+o.pos;o.pos<h;){var d=c._keys[o.readVarint()],m=c._values[o.readVarint()];c.properties[d]=m}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function pd(i){for(var e,r,o=0,c=0,h=i.length,d=h-1;c<h;d=c++)o+=((r=i[d]).x-(e=i[c]).x)*(e.y+r.y);return o}Jo.types=["Unknown","Point","LineString","Polygon"],Jo.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,o=1,c=0,h=0,d=0,m=[];i.pos<r;){if(c<=0){var g=i.readVarint();o=7&g,c=g>>3}if(c--,o===1||o===2)h+=i.readSVarint(),d+=i.readSVarint(),o===1&&(e&&m.push(e),e=[]),e.push(new ud(h,d));else{if(o!==7)throw new Error("unknown command "+o);e&&e.push(e[0].clone())}}return e&&m.push(e),m},Jo.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,o=0,c=0,h=0,d=1/0,m=-1/0,g=1/0,x=-1/0;i.pos<e;){if(o<=0){var T=i.readVarint();r=7&T,o=T>>3}if(o--,r===1||r===2)(c+=i.readSVarint())<d&&(d=c),c>m&&(m=c),(h+=i.readSVarint())<g&&(g=h),h>x&&(x=h);else if(r!==7)throw new Error("unknown command "+r)}return[d,g,m,x]},Jo.prototype.toGeoJSON=function(i,e,r){var o,c,h=this.extent*Math.pow(2,r),d=this.extent*i,m=this.extent*e,g=this.loadGeometry(),x=Jo.types[this.type];function T(k){for(var L=0;L<k.length;L++){var Z=k[L];k[L]=[360*(Z.x+d)/h-180,360/Math.PI*Math.atan(Math.exp((180-360*(Z.y+m)/h)*Math.PI/180))-90]}}switch(this.type){case 1:var S=[];for(o=0;o<g.length;o++)S[o]=g[o][0];T(g=S);break;case 2:for(o=0;o<g.length;o++)T(g[o]);break;case 3:for(g=function(k){var L=k.length;if(L<=1)return[k];for(var Z,q,re=[],ce=0;ce<L;ce++){var ee=pd(k[ce]);ee!==0&&(q===void 0&&(q=ee<0),q===ee<0?(Z&&re.push(Z),Z=[k[ce]]):Z.push(k[ce]))}return Z&&re.push(Z),re}(g),o=0;o<g.length;o++)for(c=0;c<g[o].length;c++)T(g[o][c])}g.length===1?g=g[0]:x="Multi"+x;var P={type:"Feature",geometry:{type:x,coordinates:g},properties:this.properties};return"id"in this&&(P.id=this.id),P};var dd=Eu,Su=Iu;function Iu(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(fd,this,e),this.length=this._features.length}function fd(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(o){for(var c=null,h=o.readVarint()+o.pos;o.pos<h;){var d=o.readVarint()>>3;c=d===1?o.readString():d===2?o.readFloat():d===3?o.readDouble():d===4?o.readVarint64():d===5?o.readVarint():d===6?o.readSVarint():d===7?o.readBoolean():null}return c}(r))}Iu.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new dd(this._pbf,e,this.extent,this._keys,this._values)};var md=Su;function gd(i,e,r){if(i===3){var o=new md(r,r.readVarint()+r.pos);o.length&&(e[o.name]=o)}}Un.VectorTile=function(i,e){this.layers=i.readFields(gd,{},e)},Un.VectorTileFeature=Eu,Un.VectorTileLayer=Su;const _d=Un.VectorTileFeature.types,cc=Math.pow(2,13);function Ks(i,e,r,o,c,h,d,m){i.emplaceBack(e,r,2*Math.floor(o*cc)+d,c*cc*2,h*cc*2,Math.round(m))}class uc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new yt,this.centroidVertexArray=new Xe,this.indexArray=new Bi,this.programConfigurations=new xo(e.layers,e.zoom),this.segments=new pt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.features=[],this.hasPattern=sc("fill-extrusion",this.layers,r);for(const{feature:c,id:h,index:d,sourceLayerIndex:m}of e){const g=this.layers[0]._featureFilter.needGeometry,x=bo(c,g);if(!this.layers[0]._featureFilter.filter(new Gt(this.zoom),x,o))continue;const T={id:h,sourceLayerIndex:m,index:d,geometry:g?x.geometry:vo(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(ac("fill-extrusion",this.layers,T,this.zoom,r)):this.addFeature(T,T.geometry,d,o,{}),r.featureIndex.insert(c,T.geometry,d,m,this.index,!0)}}addFeatures(e,r,o){for(const c of this.features){const{geometry:h}=c;this.addFeature(c,h,c.index,r,o)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}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,cd),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,ld.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,r,o,c,h){const d={x:0,y:0,vertexCount:0};for(const m of oc(r,500)){let g=0;for(const L of m)g+=L.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const L of m){if(L.length===0||xd(L))continue;let Z=0;for(let q=0;q<L.length;q++){const re=L[q];if(q>=1){const ce=L[q-1];if(!yd(re,ce)){x.vertexLength+4>pt.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const ee=re.sub(ce)._perp()._unit(),ae=ce.dist(re);Z+ae>32768&&(Z=0),Ks(this.layoutVertexArray,re.x,re.y,ee.x,ee.y,0,0,Z),Ks(this.layoutVertexArray,re.x,re.y,ee.x,ee.y,0,1,Z),d.x+=2*re.x,d.y+=2*re.y,d.vertexCount+=2,Z+=ae,Ks(this.layoutVertexArray,ce.x,ce.y,ee.x,ee.y,0,0,Z),Ks(this.layoutVertexArray,ce.x,ce.y,ee.x,ee.y,0,1,Z),d.x+=2*ce.x,d.y+=2*ce.y,d.vertexCount+=2;const xe=x.vertexLength;this.indexArray.emplaceBack(xe,xe+2,xe+1),this.indexArray.emplaceBack(xe+1,xe+2,xe+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+g>pt.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),_d[e.type]!=="Polygon")continue;const T=[],S=[],P=x.vertexLength;for(const L of m)if(L.length!==0){L!==m[0]&&S.push(T.length/2);for(let Z=0;Z<L.length;Z++){const q=L[Z];Ks(this.layoutVertexArray,q.x,q.y,0,0,1,1,0),d.x+=q.x,d.y+=q.y,d.vertexCount+=1,T.push(q.x),T.push(q.y)}}const k=il.exports(T,S);for(let L=0;L<k.length;L+=3)this.indexArray.emplaceBack(P+k[L],P+k[L+2],P+k[L+1]);x.primitiveLength+=k.length/3,x.vertexLength+=g}for(let m=0;m<d.vertexCount;m++)this.centroidVertexArray.emplaceBack(Math.floor(d.x/d.vertexCount),Math.floor(d.y/d.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}}function yd(i,e){return i.x===e.x&&(i.x<0||i.x>si)||i.y===e.y&&(i.y<0||i.y>si)}function xd(i){return i.every(e=>e.x<0)||i.every(e=>e.x>si)||i.every(e=>e.y<0)||i.every(e=>e.y>si)}$e("FillExtrusionBucket",uc,{omit:["layers","features"]});var vd={paint:new _i({"fill-extrusion-opacity":new qe(_e["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Je(_e["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new qe(_e["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new qe(_e["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Bn(_e["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Je(_e["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Je(_e["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new qe(_e["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Js(i,e){return i.x*e.x+i.y*e.y}function Cu(i,e){if(i.length===1){let r=0;const o=e[r++];let c;for(;!c||o.equals(c);)if(c=e[r++],!c)return 1/0;for(;r<e.length;r++){const h=e[r],d=i[0],m=c.sub(o),g=h.sub(o),x=d.sub(o),T=Js(m,m),S=Js(m,g),P=Js(g,g),k=Js(x,m),L=Js(x,g),Z=T*P-S*S,q=(P*k-S*L)/Z,re=(T*L-S*k)/Z,ce=o.z*(1-q-re)+c.z*q+h.z*re;if(isFinite(ce))return ce}return 1/0}{let r=1/0;for(const o of e)r=Math.min(r,o.z);return r}}const bd=ii([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:wd}=bd,Td=ii([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Ed}=Td,Sd=Un.VectorTileFeature.types,Id=Math.cos(Math.PI/180*37.5),Au=Math.pow(2,14)/.5;class hc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Et,this.layoutVertexArray2=new Dt,this.indexArray=new Bi,this.programConfigurations=new xo(e.layers,e.zoom),this.segments=new pt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=sc("line",this.layers,r);const c=this.layers[0].layout.get("line-sort-key"),h=!c.isConstant(),d=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:T}of e){const S=this.layers[0]._featureFilter.needGeometry,P=bo(m,S);if(!this.layers[0]._featureFilter.filter(new Gt(this.zoom),P,o))continue;const k=h?c.evaluate(P,{},o):void 0,L={id:g,properties:m.properties,type:m.type,sourceLayerIndex:T,index:x,geometry:S?P.geometry:vo(m),patterns:{},sortKey:k};d.push(L)}h&&d.sort((m,g)=>m.sortKey-g.sortKey);for(const m of d){const{geometry:g,index:x,sourceLayerIndex:T}=m;if(this.hasPattern){const S=ac("line",this.layers,m,this.zoom,r);this.patternFeatures.push(S)}else this.addFeature(m,g,x,o,{});r.featureIndex.insert(e[x].feature,g,x,T,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}addFeatures(e,r,o){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,o)}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,Ed)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,wd),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,o,c,h){const d=this.layers[0].layout,m=d.get("line-join").evaluate(e,{}),g=d.get("line-cap"),x=d.get("line-miter-limit"),T=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const S of r)this.addLine(S,e,m,g,x,T);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}addLine(e,r,o,c,h,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let re=0;re<e.length-1;re++)this.totalDistance+=e[re].dist(e[re+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=Sd[r.type]==="Polygon";let g=e.length;for(;g>=2&&e[g-1].equals(e[g-2]);)g--;let x=0;for(;x<g-1&&e[x].equals(e[x+1]);)x++;if(g<(m?3:2))return;o==="bevel"&&(h=1.05);const T=this.overscaling<=16?122880/(512*this.overscaling):0,S=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let P,k,L,Z,q;this.e1=this.e2=-1,m&&(P=e[g-2],q=e[x].sub(P)._unit()._perp());for(let re=x;re<g;re++){if(L=re===g-1?m?e[x+1]:void 0:e[re+1],L&&e[re].equals(L))continue;q&&(Z=q),P&&(k=P),P=e[re],q=L?L.sub(P)._unit()._perp():Z,Z=Z||q;let ce=Z.add(q);ce.x===0&&ce.y===0||ce._unit();const ee=Z.x*q.x+Z.y*q.y,ae=ce.x*q.x+ce.y*q.y,xe=ae!==0?1/ae:1/0,ye=2*Math.sqrt(2-2*ae),Ue=ae<Id&&k&&L,Ne=Z.x*q.y-Z.y*q.x>0;if(Ue&&re>x){const Ee=P.dist(k);if(Ee>2*T){const Re=P.sub(P.sub(k)._mult(T/Ee)._round());this.updateDistance(k,Re),this.addCurrentVertex(Re,Z,0,0,S),k=Re}}const Le=k&&L;let Me=Le?o:m?"butt":c;if(Le&&Me==="round"&&(xe<d?Me="miter":xe<=2&&(Me="fakeround")),Me==="miter"&&xe>h&&(Me="bevel"),Me==="bevel"&&(xe>2&&(Me="flipbevel"),xe<h&&(Me="miter")),k&&this.updateDistance(k,P),Me==="miter")ce._mult(xe),this.addCurrentVertex(P,ce,0,0,S);else if(Me==="flipbevel"){if(xe>100)ce=q.mult(-1);else{const Ee=xe*Z.add(q).mag()/Z.sub(q).mag();ce._perp()._mult(Ee*(Ne?-1:1))}this.addCurrentVertex(P,ce,0,0,S),this.addCurrentVertex(P,ce.mult(-1),0,0,S)}else if(Me==="bevel"||Me==="fakeround"){const Ee=-Math.sqrt(xe*xe-1),Re=Ne?Ee:0,ze=Ne?0:Ee;if(k&&this.addCurrentVertex(P,Z,Re,ze,S),Me==="fakeround"){const Te=Math.round(180*ye/Math.PI/20);for(let We=1;We<Te;We++){let je=We/Te;if(je!==.5){const Ut=je-.5;je+=je*Ut*(je-1)*((1.0904+ee*(ee*(3.55645-1.43519*ee)-3.2452))*Ut*Ut+(.848013+ee*(.215638*ee-1.06021)))}const ut=q.sub(Z)._mult(je)._add(Z)._unit()._mult(Ne?-1:1);this.addHalfVertex(P,ut.x,ut.y,!1,Ne,0,S)}}L&&this.addCurrentVertex(P,q,-Re,-ze,S)}else if(Me==="butt")this.addCurrentVertex(P,ce,0,0,S);else if(Me==="square"){const Ee=k?1:-1;this.addCurrentVertex(P,ce,Ee,Ee,S)}else Me==="round"&&(k&&(this.addCurrentVertex(P,Z,0,0,S),this.addCurrentVertex(P,Z,1,1,S,!0)),L&&(this.addCurrentVertex(P,q,-1,-1,S,!0),this.addCurrentVertex(P,q,0,0,S)));if(Ue&&re<g-1){const Ee=P.dist(L);if(Ee>2*T){const Re=P.add(L.sub(P)._mult(T/Ee)._round());this.updateDistance(P,Re),this.addCurrentVertex(Re,q,0,0,S),P=Re}}}}addCurrentVertex(e,r,o,c,h,d=!1){const m=r.y*c-r.x,g=-r.y-r.x*c;this.addHalfVertex(e,r.x+r.y*o,r.y-r.x*o,d,!1,o,h),this.addHalfVertex(e,m,g,d,!0,-c,h),this.distance>Au/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(e,r,o,c,h,d))}addHalfVertex({x:e,y:r},o,c,h,d,m,g){const x=.5*(this.lineClips?this.scaledDistance*(Au-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(h?1:0),(r<<1)+(d?1:0),Math.round(63*o)+128,Math.round(63*c)+128,1+(m===0?0:m<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const T=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,T),g.primitiveLength++),d?this.e2=T:this.e1=T}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}$e("LineBucket",hc,{omit:["layers","patternFeatures"]});const Cd=new _i({"line-cap":new qe(_e.layout_line["line-cap"]),"line-join":new Je(_e.layout_line["line-join"]),"line-miter-limit":new qe(_e.layout_line["line-miter-limit"]),"line-round-limit":new qe(_e.layout_line["line-round-limit"]),"line-sort-key":new Je(_e.layout_line["line-sort-key"])});var Mu={paint:new _i({"line-opacity":new Je(_e.paint_line["line-opacity"]),"line-color":new Je(_e.paint_line["line-color"]),"line-translate":new qe(_e.paint_line["line-translate"]),"line-translate-anchor":new qe(_e.paint_line["line-translate-anchor"]),"line-width":new Je(_e.paint_line["line-width"]),"line-gap-width":new Je(_e.paint_line["line-gap-width"]),"line-offset":new Je(_e.paint_line["line-offset"]),"line-blur":new Je(_e.paint_line["line-blur"]),"line-dasharray":new Os(_e.paint_line["line-dasharray"]),"line-pattern":new Bn(_e.paint_line["line-pattern"]),"line-gradient":new Gr(_e.paint_line["line-gradient"])}),layout:Cd};const Pu=new class extends Je{possiblyEvaluate(i,e){return e=new Gt(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(i,e)}evaluate(i,e,r,o){return e=Se({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(i,e,r,o)}}(Mu.paint.properties["line-width"].specification);function zu(i,e){return e>0?e+2*i:i}Pu.useIntegerZoom=!0;const Ad=ii([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Md=ii([{name:"a_projected_pos",components:3,type:"Float32"}],4);ii([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Pd=ii([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);ii([{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 ku=ii([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),zd=ii([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function kd(i,e,r){return i.sections.forEach(o=>{o.text=function(c,h,d){const m=h.layout.get("text-transform").evaluate(d,{});return m==="uppercase"?c=c.toLocaleUpperCase():m==="lowercase"&&(c=c.toLocaleLowerCase()),Yi.applyArabicShaping&&(c=Yi.applyArabicShaping(c)),c}(o.text,e,r)}),i}ii([{name:"triangle",components:3,type:"Uint16"}]),ii([{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"}]),ii([{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),ii([{type:"Float32",name:"offsetX"}]),ii([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Ys={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};var yi=24,pc=Bt,Du=function(i,e,r,o,c){var h,d,m=8*c-o-1,g=(1<<m)-1,x=g>>1,T=-7,S=r?c-1:0,P=r?-1:1,k=i[e+S];for(S+=P,h=k&(1<<-T)-1,k>>=-T,T+=m;T>0;h=256*h+i[e+S],S+=P,T-=8);for(d=h&(1<<-T)-1,h>>=-T,T+=o;T>0;d=256*d+i[e+S],S+=P,T-=8);if(h===0)h=1-x;else{if(h===g)return d?NaN:1/0*(k?-1:1);d+=Math.pow(2,o),h-=x}return(k?-1:1)*d*Math.pow(2,h-o)},Lu=function(i,e,r,o,c,h){var d,m,g,x=8*h-c-1,T=(1<<x)-1,S=T>>1,P=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,k=o?0:h-1,L=o?1:-1,Z=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,d=T):(d=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-d))<1&&(d--,g*=2),(e+=d+S>=1?P/g:P*Math.pow(2,1-S))*g>=2&&(d++,g/=2),d+S>=T?(m=0,d=T):d+S>=1?(m=(e*g-1)*Math.pow(2,c),d+=S):(m=e*Math.pow(2,S-1)*Math.pow(2,c),d=0));c>=8;i[r+k]=255&m,k+=L,m/=256,c-=8);for(d=d<<c|m,x+=c;x>0;i[r+k]=255&d,k+=L,d/=256,x-=8);i[r+k-L]|=128*Z};function Bt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Bt.Varint=0,Bt.Fixed64=1,Bt.Bytes=2,Bt.Fixed32=5;var $n,dc=4294967296,Ru=1/dc,Bu=typeof TextDecoder=="undefined"?null:new TextDecoder("utf8");function un(i){return i.type===Bt.Bytes?i.readVarint()+i.pos:i.pos+1}function Yo(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Fu(i,e,r){var o=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(o);for(var c=r.pos-1;c>=i;c--)r.buf[c+o]=r.buf[c]}function Dd(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function Ld(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function Rd(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function Bd(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function Fd(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function Od(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function Ud(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function $d(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function Vd(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function al(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function Qo(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function Ou(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}function Nd(i,e,r){i===1&&r.readMessage(Gd,e)}function Gd(i,e,r){if(i===3){const{id:o,bitmap:c,width:h,height:d,left:m,top:g,advance:x}=r.readMessage(qd,{});e.push({id:o,bitmap:new Zs({width:h+6,height:d+6},c),metrics:{width:h,height:d,left:m,top:g,advance:x}})}}function qd(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}function Uu(i){let e=0,r=0;for(const d of i)e+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,m)=>m.h-d.h);const o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let c=0,h=0;for(const d of i)for(let m=o.length-1;m>=0;m--){const g=o[m];if(!(d.w>g.w||d.h>g.h)){if(d.x=g.x,d.y=g.y,h=Math.max(h,d.y+d.h),c=Math.max(c,d.x+d.w),d.w===g.w&&d.h===g.h){const x=o.pop();m<o.length&&(o[m]=x)}else d.h===g.h?(g.x+=d.w,g.w-=d.w):d.w===g.w?(g.y+=d.h,g.h-=d.h):(o.push({x:g.x+d.w,y:g.y,w:g.w-d.w,h:d.h}),g.y+=d.h,g.h-=d.h);break}}return{w:c,h,fill:e/(c*h)||0}}Bt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var o=this.readVarint(),c=o>>3,h=this.pos;this.type=7&o,i(c,e,this),this.pos===h&&this.skip(o)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=al(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Ou(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=al(this.buf,this.pos)+al(this.buf,this.pos+4)*dc;return this.pos+=8,i},readSFixed64:function(){var i=al(this.buf,this.pos)+Ou(this.buf,this.pos+4)*dc;return this.pos+=8,i},readFloat:function(){var i=Du(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Du(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,o=this.buf;return e=127&(r=o[this.pos++]),r<128?e:(e|=(127&(r=o[this.pos++]))<<7,r<128?e:(e|=(127&(r=o[this.pos++]))<<14,r<128?e:(e|=(127&(r=o[this.pos++]))<<21,r<128?e:function(c,h,d){var m,g,x=d.buf;if(m=(112&(g=x[d.pos++]))>>4,g<128||(m|=(127&(g=x[d.pos++]))<<3,g<128)||(m|=(127&(g=x[d.pos++]))<<10,g<128)||(m|=(127&(g=x[d.pos++]))<<17,g<128)||(m|=(127&(g=x[d.pos++]))<<24,g<128)||(m|=(1&(g=x[d.pos++]))<<31,g<128))return Yo(c,m,h);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=o[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&Bu?function(r,o,c){return Bu.decode(r.subarray(o,c))}(this.buf,e,i):function(r,o,c){for(var h="",d=o;d<c;){var m,g,x,T=r[d],S=null,P=T>239?4:T>223?3:T>191?2:1;if(d+P>c)break;P===1?T<128&&(S=T):P===2?(192&(m=r[d+1]))==128&&(S=(31&T)<<6|63&m)<=127&&(S=null):P===3?(g=r[d+2],(192&(m=r[d+1]))==128&&(192&g)==128&&((S=(15&T)<<12|(63&m)<<6|63&g)<=2047||S>=55296&&S<=57343)&&(S=null)):P===4&&(g=r[d+2],x=r[d+3],(192&(m=r[d+1]))==128&&(192&g)==128&&(192&x)==128&&((S=(15&T)<<18|(63&m)<<12|(63&g)<<6|63&x)<=65535||S>=1114112)&&(S=null)),S===null?(S=65533,P=1):S>65535&&(S-=65536,h+=String.fromCharCode(S>>>10&1023|55296),S=56320|1023&S),h+=String.fromCharCode(S),d+=P}return h}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==Bt.Bytes)return i.push(this.readVarint(e));var r=un(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==Bt.Bytes)return i.push(this.readSVarint());var e=un(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==Bt.Bytes)return i.push(this.readBoolean());var e=un(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==Bt.Bytes)return i.push(this.readFloat());var e=un(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==Bt.Bytes)return i.push(this.readDouble());var e=un(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==Bt.Bytes)return i.push(this.readFixed32());var e=un(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==Bt.Bytes)return i.push(this.readSFixed32());var e=un(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==Bt.Bytes)return i.push(this.readFixed64());var e=un(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==Bt.Bytes)return i.push(this.readSFixed64());var e=un(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===Bt.Varint)for(;this.buf[this.pos++]>127;);else if(e===Bt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Bt.Fixed32)this.pos+=4;else{if(e!==Bt.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e<this.pos+i;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),Qo(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),Qo(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),Qo(this.buf,-1&i,this.pos),Qo(this.buf,Math.floor(i*Ru),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),Qo(this.buf,-1&i,this.pos),Qo(this.buf,Math.floor(i*Ru),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var o,c;if(e>=0?(o=e%4294967296|0,c=e/4294967296|0):(c=~(-e/4294967296),4294967295^(o=~(-e%4294967296))?o=o+1|0:(o=0,c=c+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(h,d,m){m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,m.buf[m.pos]=127&(h>>>=7)}(o,0,r),function(h,d){var m=(7&h)<<4;d.buf[d.pos++]|=m|((h>>>=3)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h)))))}(c,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(o,c,h){for(var d,m,g=0;g<c.length;g++){if((d=c.charCodeAt(g))>55295&&d<57344){if(!m){d>56319||g+1===c.length?(o[h++]=239,o[h++]=191,o[h++]=189):m=d;continue}if(d<56320){o[h++]=239,o[h++]=191,o[h++]=189,m=d;continue}d=m-55296<<10|d-56320|65536,m=null}else m&&(o[h++]=239,o[h++]=191,o[h++]=189,m=null);d<128?o[h++]=d:(d<2048?o[h++]=d>>6|192:(d<65536?o[h++]=d>>12|224:(o[h++]=d>>18|240,o[h++]=d>>12&63|128),o[h++]=d>>6&63|128),o[h++]=63&d|128)}return h}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&Fu(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Lu(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Lu(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,e){this.pos++;var r=this.pos;i(e,this);var o=this.pos-r;o>=128&&Fu(r,o,this),this.pos=r-1,this.writeVarint(o),this.pos+=o},writeMessage:function(i,e,r){this.writeTag(i,Bt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Dd,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Ld,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Fd,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Rd,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Bd,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Od,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,Ud,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,$d,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,Vd,e)},writeBytesField:function(i,e){this.writeTag(i,Bt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Bt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Bt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Bt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Bt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Bt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Bt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Bt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Bt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Bt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,Boolean(e))}};class fc{constructor(e,{pixelRatio:r,version:o,stretchX:c,stretchY:h,content:d}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=c,this.stretchY=h,this.content=d,this.version=o}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 $u{constructor(e,r){const o={},c={};this.haveRenderCallbacks=[];const h=[];this.addImages(e,o,h),this.addImages(r,c,h);const{w:d,h:m}=Uu(h),g=new or({width:d||1,height:m||1});for(const x in e){const T=e[x],S=o[x].paddedRect;or.copy(T.data,g,{x:0,y:0},{x:S.x+1,y:S.y+1},T.data)}for(const x in r){const T=r[x],S=c[x].paddedRect,P=S.x+1,k=S.y+1,L=T.data.width,Z=T.data.height;or.copy(T.data,g,{x:0,y:0},{x:P,y:k},T.data),or.copy(T.data,g,{x:0,y:Z-1},{x:P,y:k-1},{width:L,height:1}),or.copy(T.data,g,{x:0,y:0},{x:P,y:k+Z},{width:L,height:1}),or.copy(T.data,g,{x:L-1,y:0},{x:P-1,y:k},{width:1,height:Z}),or.copy(T.data,g,{x:0,y:0},{x:P+L,y:k},{width:1,height:Z})}this.image=g,this.iconPositions=o,this.patternPositions=c}addImages(e,r,o){for(const c in e){const h=e[c],d={x:0,y:0,w:h.data.width+2,h:h.data.height+2};o.push(d),r[c]=new fc(d,h),h.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const o in e.updatedImages)this.patchUpdatedImage(this.iconPositions[o],e.getImage(o),r),this.patchUpdatedImage(this.patternPositions[o],e.getImage(o),r)}patchUpdatedImage(e,r,o){if(!e||!r||e.version===r.version)return;e.version=r.version;const[c,h]=e.tl;o.update(r.data,void 0,{x:c,y:h})}}$e("ImagePosition",fc),$e("ImageAtlas",$u),a.WritingMode=void 0,($n=a.WritingMode||(a.WritingMode={}))[$n.none=0]="none",$n[$n.horizontal=1]="horizontal",$n[$n.vertical=2]="vertical",$n[$n.horizontalOnly=3]="horizontalOnly";const ll=-17;class Qs{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const o=new Qs;return o.scale=e||1,o.fontStack=r,o}static forImage(e){const r=new Qs;return r.imageName=e,r}}class es{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const o=new es;for(let c=0;c<e.sections.length;c++){const h=e.sections[c];h.image?o.addImageSection(h):o.addTextSection(h,r)}return o}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let r="";for(let o=0;o<e.length;o++){const c=e.charCodeAt(o+1)||null,h=e.charCodeAt(o-1)||null;r+=c&&Na(c)&&!Ys[e[o+1]]||h&&Na(h)&&!Ys[e[o-1]]||!Ys[e[o]]?e[o]:Ys[e[o]]}return r}(this.text)}trim(){let e=0;for(let o=0;o<this.text.length&&ul[this.text.charCodeAt(o)];o++)e++;let r=this.text.length;for(let o=this.text.length-1;o>=0&&o>=e&&ul[this.text.charCodeAt(o)];o--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const o=new es;return o.text=this.text.substring(e,r),o.sectionIndex=this.sectionIndex.slice(e,r),o.sections=this.sections,o}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(Qs.forText(e.scale,e.fontStack||r));const o=this.sections.length-1;for(let c=0;c<e.text.length;++c)this.sectionIndex.push(o)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void ht("Can't add FormattedSection with an empty image.");const o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCharCode(o),this.sections.push(Qs.forImage(r)),this.sectionIndex.push(this.sections.length-1)):ht("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function cl(i,e,r,o,c,h,d,m,g,x,T,S,P,k,L,Z){const q=es.fromFeature(i,c);let re;S===a.WritingMode.vertical&&q.verticalizePunctuation();const{processBidirectionalText:ce,processStyledBidirectionalText:ee}=Yi;if(ce&&q.sections.length===1){re=[];const ye=ce(q.toString(),mc(q,x,h,e,o,k,L));for(const Ue of ye){const Ne=new es;Ne.text=Ue,Ne.sections=q.sections;for(let Le=0;Le<Ue.length;Le++)Ne.sectionIndex.push(0);re.push(Ne)}}else if(ee){re=[];const ye=ee(q.text,q.sectionIndex,mc(q,x,h,e,o,k,L));for(const Ue of ye){const Ne=new es;Ne.text=Ue[0],Ne.sectionIndex=Ue[1],Ne.sections=q.sections,re.push(Ne)}}else re=function(ye,Ue){const Ne=[],Le=ye.text;let Me=0;for(const Ee of Ue)Ne.push(ye.substring(Me,Ee)),Me=Ee;return Me<Le.length&&Ne.push(ye.substring(Me,Le.length)),Ne}(q,mc(q,x,h,e,o,k,L));const ae=[],xe={positionedLines:ae,text:q.toString(),top:T[1],bottom:T[1],left:T[0],right:T[0],writingMode:S,iconsInText:!1,verticalizable:!1};return function(ye,Ue,Ne,Le,Me,Ee,Re,ze,Te,We,je,ut){let Ut=0,Zt=ll,ai=0,ar=0;const wi=ze==="right"?1:ze==="left"?0:.5;let ri=0;for(const ni of Me){ni.trim();const Ei=ni.getMaxScale(),Mi=(Ei-1)*yi,Ui={positionedGlyphs:[],lineOffset:0};ye.positionedLines[ri]=Ui;const Xi=Ui.positionedGlyphs;let Wi=0;if(!ni.length()){Zt+=Ee,++ri;continue}for(let fi=0;fi<ni.length();fi++){const ft=ni.getSection(fi),tr=ni.getSectionIndex(fi),Si=ni.getCharCode(fi);let Pi=0,_r=null,Mr=null,Pr=null,pn=yi;const yr=!(Te===a.WritingMode.horizontal||!je&&!ks(Si)||je&&(ul[Si]||(di=Si,De.Arabic(di)||De["Arabic Supplement"](di)||De["Arabic Extended-A"](di)||De["Arabic Presentation Forms-A"](di)||De["Arabic Presentation Forms-B"](di))));if(ft.imageName){const lr=Le[ft.imageName];if(!lr)continue;Pr=ft.imageName,ye.iconsInText=ye.iconsInText||!0,Mr=lr.paddedRect;const Hi=lr.displaySize;ft.scale=ft.scale*yi/ut,_r={width:Hi[0],height:Hi[1],left:1,top:-3,advance:yr?Hi[1]:Hi[0]},Pi=Mi+(yi-Hi[1]*ft.scale),pn=_r.advance;const dn=yr?Hi[0]*ft.scale-yi*Ei:Hi[1]*ft.scale-yi*Ei;dn>0&&dn>Wi&&(Wi=dn)}else{const lr=Ne[ft.fontStack],Hi=lr&&lr[Si];if(Hi&&Hi.rect)Mr=Hi.rect,_r=Hi.metrics;else{const dn=Ue[ft.fontStack],ia=dn&&dn[Si];if(!ia)continue;_r=ia.metrics}Pi=(Ei-ft.scale)*yi}yr?(ye.verticalizable=!0,Xi.push({glyph:Si,imageName:Pr,x:Ut,y:Zt+Pi,vertical:yr,scale:ft.scale,fontStack:ft.fontStack,sectionIndex:tr,metrics:_r,rect:Mr}),Ut+=pn*ft.scale+We):(Xi.push({glyph:Si,imageName:Pr,x:Ut,y:Zt+Pi,vertical:yr,scale:ft.scale,fontStack:ft.fontStack,sectionIndex:tr,metrics:_r,rect:Mr}),Ut+=_r.advance*ft.scale+We)}Xi.length!==0&&(ai=Math.max(Ut-We,ai),Xd(Xi,0,Xi.length-1,wi,Wi)),Ut=0;const jt=Ee*Ei+Wi;Ui.lineOffset=Math.max(Wi,Mi),Zt+=jt,ar=Math.max(jt,ar),++ri}var di;const Ti=Zt-ll,{horizontalAlign:Ai,verticalAlign:ji}=gc(Re);(function(ni,Ei,Mi,Ui,Xi,Wi,jt,fi,ft){const tr=(Ei-Mi)*Xi;let Si=0;Si=Wi!==jt?-fi*Ui-ll:(-Ui*ft+.5)*jt;for(const Pi of ni)for(const _r of Pi.positionedGlyphs)_r.x+=tr,_r.y+=Si})(ye.positionedLines,wi,Ai,ji,ai,ar,Ee,Ti,Me.length),ye.top+=-ji*Ti,ye.bottom=ye.top+Ti,ye.left+=-Ai*ai,ye.right=ye.left+ai}(xe,e,r,o,re,d,m,g,S,x,P,Z),!function(ye){for(const Ue of ye)if(Ue.positionedGlyphs.length!==0)return!1;return!0}(ae)&&xe}const ul={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Zd={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Vu(i,e,r,o,c,h){if(e.imageName){const d=o[e.imageName];return d?d.displaySize[0]*e.scale*yi/h+c:0}{const d=r[e.fontStack],m=d&&d[i];return m?m.metrics.advance*e.scale+c:0}}function Nu(i,e,r,o){const c=Math.pow(i-e,2);return o?i<e?c/2:2*c:c+Math.abs(r)*r}function jd(i,e,r){let o=0;return i===10&&(o-=1e4),r&&(o+=150),i!==40&&i!==65288||(o+=50),e!==41&&e!==65289||(o+=50),o}function Gu(i,e,r,o,c,h){let d=null,m=Nu(e,r,c,h);for(const g of o){const x=Nu(e-g.x,r,c,h)+g.badness;x<=m&&(d=g,m=x)}return{index:i,x:e,priorBreak:d,badness:m}}function qu(i){return i?qu(i.priorBreak).concat(i.index):[]}function mc(i,e,r,o,c,h,d){if(h!=="point")return[];if(!i)return[];const m=[],g=function(P,k,L,Z,q,re){let ce=0;for(let ee=0;ee<P.length();ee++){const ae=P.getSection(ee);ce+=Vu(P.getCharCode(ee),ae,Z,q,k,re)}return ce/Math.max(1,Math.ceil(ce/L))}(i,e,r,o,c,d),x=i.text.indexOf("\u200B")>=0;let T=0;for(let P=0;P<i.length();P++){const k=i.getSection(P),L=i.getCharCode(P);if(ul[L]||(T+=Vu(L,k,o,c,e,d)),P<i.length()-1){const Z=!((S=L)<11904||!(De["Bopomofo Extended"](S)||De.Bopomofo(S)||De["CJK Compatibility Forms"](S)||De["CJK Compatibility Ideographs"](S)||De["CJK Compatibility"](S)||De["CJK Radicals Supplement"](S)||De["CJK Strokes"](S)||De["CJK Symbols and Punctuation"](S)||De["CJK Unified Ideographs Extension A"](S)||De["CJK Unified Ideographs"](S)||De["Enclosed CJK Letters and Months"](S)||De["Halfwidth and Fullwidth Forms"](S)||De.Hiragana(S)||De["Ideographic Description Characters"](S)||De["Kangxi Radicals"](S)||De["Katakana Phonetic Extensions"](S)||De.Katakana(S)||De["Vertical Forms"](S)||De["Yi Radicals"](S)||De["Yi Syllables"](S)));(Zd[L]||Z||k.imageName)&&m.push(Gu(P+1,T,g,m,jd(L,i.getCharCode(P+1),Z&&x),!1))}}var S;return qu(Gu(i.length(),T,g,m,0,!0))}function gc(i){let e=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Xd(i,e,r,o,c){if(!o&&!c)return;const h=i[r],d=(i[r].x+h.metrics.advance*h.scale)*o;for(let m=e;m<=r;m++)i[m].x-=d,i[m].y+=c}function Wd(i,e,r){const{horizontalAlign:o,verticalAlign:c}=gc(r),h=e[0]-i.displaySize[0]*o,d=e[1]-i.displaySize[1]*c;return{image:i,top:d,bottom:d+i.displaySize[1],left:h,right:h+i.displaySize[0]}}function Zu(i,e,r,o,c,h){const d=i.image;let m;if(d.content){const q=d.content,re=d.pixelRatio||1;m=[q[0]/re,q[1]/re,d.displaySize[0]-q[2]/re,d.displaySize[1]-q[3]/re]}const g=e.left*h,x=e.right*h;let T,S,P,k;r==="width"||r==="both"?(k=c[0]+g-o[3],S=c[0]+x+o[1]):(k=c[0]+(g+x-d.displaySize[0])/2,S=k+d.displaySize[0]);const L=e.top*h,Z=e.bottom*h;return r==="height"||r==="both"?(T=c[1]+L-o[0],P=c[1]+Z+o[2]):(T=c[1]+(L+Z-d.displaySize[1])/2,P=T+d.displaySize[1]),{image:d,top:T,right:S,bottom:P,left:k,collisionPadding:m}}const hn=128;function ju(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Gt(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:o,interpolationType:c}=r;let h=0;for(;h<o.length&&o[h]<=i;)h++;h=Math.max(0,h-1);let d=h;for(;d<o.length&&o[d]<i+1;)d++;d=Math.min(o.length-1,d);const m=o[h],g=o[d];return r.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:g,interpolationType:c}:{kind:"camera",minZoom:m,maxZoom:g,minSize:r.evaluate(new Gt(m)),maxSize:r.evaluate(new Gt(g)),interpolationType:c}}}class Vn extends He{constructor(e,r,o,c){super(e,r),this.angle=o,c!==void 0&&(this.segment=c)}clone(){return new Vn(this.x,this.y,this.angle,this.segment)}}function Xu(i,e,r,o,c){if(e.segment===void 0)return!0;let h=e,d=e.segment+1,m=0;for(;m>-r/2;){if(d--,d<0)return!1;m-=i[d].dist(h),h=i[d]}m+=i[d].dist(i[d+1]),d++;const g=[];let x=0;for(;m<r/2;){const T=i[d],S=i[d+1];if(!S)return!1;let P=i[d-1].angleTo(T)-T.angleTo(S);for(P=Math.abs((P+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:m,angleDelta:P}),x+=P;m-g[0].distance>o;)x-=g.shift().angleDelta;if(x>c)return!1;d++,m+=T.dist(S)}return!0}function Wu(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function Hu(i,e,r){return i?.6*e*r:0}function Ku(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function Hd(i,e,r,o,c,h){const d=Hu(r,c,h),m=Ku(r,o)*h;let g=0;const x=Wu(i)/2;for(let T=0;T<i.length-1;T++){const S=i[T],P=i[T+1],k=S.dist(P);if(g+k>x){const L=(x-g)/k,Z=Vt(S.x,P.x,L),q=Vt(S.y,P.y,L),re=new Vn(Z,q,P.angleTo(S),T);return re._round(),!d||Xu(i,re,m,d,e)?re:void 0}g+=k}}function Kd(i,e,r,o,c,h,d,m,g){const x=Hu(o,h,d),T=Ku(o,c),S=T*d,P=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-S<e/4&&(e=S+e/4),Ju(i,P?e/2*m%e:(T/2+2*h)*d*m%e,e,x,r,S,P,!1,g)}function Ju(i,e,r,o,c,h,d,m,g){const x=h/2,T=Wu(i);let S=0,P=e-r,k=[];for(let L=0;L<i.length-1;L++){const Z=i[L],q=i[L+1],re=Z.dist(q),ce=q.angleTo(Z);for(;P+r<S+re;){P+=r;const ee=(P-S)/re,ae=Vt(Z.x,q.x,ee),xe=Vt(Z.y,q.y,ee);if(ae>=0&&ae<g&&xe>=0&&xe<g&&P-x>=0&&P+x<=T){const ye=new Vn(ae,xe,ce,L);ye._round(),o&&!Xu(i,ye,h,o,c)||k.push(ye)}}S+=re}return m||k.length||d||(k=Ju(i,S/2,r,o,c,h,d,!0,g)),k}function Yu(i,e,r,o,c){const h=[];for(let d=0;d<i.length;d++){const m=i[d];let g;for(let x=0;x<m.length-1;x++){let T=m[x],S=m[x+1];T.x<e&&S.x<e||(T.x<e?T=new He(e,T.y+(e-T.x)/(S.x-T.x)*(S.y-T.y))._round():S.x<e&&(S=new He(e,T.y+(e-T.x)/(S.x-T.x)*(S.y-T.y))._round()),T.y<r&&S.y<r||(T.y<r?T=new He(T.x+(r-T.y)/(S.y-T.y)*(S.x-T.x),r)._round():S.y<r&&(S=new He(T.x+(r-T.y)/(S.y-T.y)*(S.x-T.x),r)._round()),T.x>=o&&S.x>=o||(T.x>=o?T=new He(o,T.y+(o-T.x)/(S.x-T.x)*(S.y-T.y))._round():S.x>=o&&(S=new He(o,T.y+(o-T.x)/(S.x-T.x)*(S.y-T.y))._round()),T.y>=c&&S.y>=c||(T.y>=c?T=new He(T.x+(c-T.y)/(S.y-T.y)*(S.x-T.x),c)._round():S.y>=c&&(S=new He(T.x+(c-T.y)/(S.y-T.y)*(S.x-T.x),c)._round()),g&&T.equals(g[g.length-1])||(g=[T],h.push(g)),g.push(S)))))}}return h}function Qu(i,e,r,o){const c=[],h=i.image,d=h.pixelRatio,m=h.paddedRect.w-2,g=h.paddedRect.h-2,x=i.right-i.left,T=i.bottom-i.top,S=h.stretchX||[[0,m]],P=h.stretchY||[[0,g]],k=(Ee,Re)=>Ee+Re[1]-Re[0],L=S.reduce(k,0),Z=P.reduce(k,0),q=m-L,re=g-Z;let ce=0,ee=L,ae=0,xe=Z,ye=0,Ue=q,Ne=0,Le=re;if(h.content&&o){const Ee=h.content;ce=hl(S,0,Ee[0]),ae=hl(P,0,Ee[1]),ee=hl(S,Ee[0],Ee[2]),xe=hl(P,Ee[1],Ee[3]),ye=Ee[0]-ce,Ne=Ee[1]-ae,Ue=Ee[2]-Ee[0]-ee,Le=Ee[3]-Ee[1]-xe}const Me=(Ee,Re,ze,Te)=>{const We=pl(Ee.stretch-ce,ee,x,i.left),je=dl(Ee.fixed-ye,Ue,Ee.stretch,L),ut=pl(Re.stretch-ae,xe,T,i.top),Ut=dl(Re.fixed-Ne,Le,Re.stretch,Z),Zt=pl(ze.stretch-ce,ee,x,i.left),ai=dl(ze.fixed-ye,Ue,ze.stretch,L),ar=pl(Te.stretch-ae,xe,T,i.top),wi=dl(Te.fixed-Ne,Le,Te.stretch,Z),ri=new He(We,ut),di=new He(Zt,ut),Ti=new He(Zt,ar),Ai=new He(We,ar),ji=new He(je/d,Ut/d),ni=new He(ai/d,wi/d),Ei=e*Math.PI/180;if(Ei){const Xi=Math.sin(Ei),Wi=Math.cos(Ei),jt=[Wi,-Xi,Xi,Wi];ri._matMult(jt),di._matMult(jt),Ai._matMult(jt),Ti._matMult(jt)}const Mi=Ee.stretch+Ee.fixed,Ui=Re.stretch+Re.fixed;return{tl:ri,tr:di,bl:Ai,br:Ti,tex:{x:h.paddedRect.x+1+Mi,y:h.paddedRect.y+1+Ui,w:ze.stretch+ze.fixed-Mi,h:Te.stretch+Te.fixed-Ui},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ji,pixelOffsetBR:ni,minFontScaleX:Ue/d/x,minFontScaleY:Le/d/T,isSDF:r}};if(o&&(h.stretchX||h.stretchY)){const Ee=eh(S,q,L),Re=eh(P,re,Z);for(let ze=0;ze<Ee.length-1;ze++){const Te=Ee[ze],We=Ee[ze+1];for(let je=0;je<Re.length-1;je++)c.push(Me(Te,Re[je],We,Re[je+1]))}}else c.push(Me({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:g+1}));return c}function hl(i,e,r){let o=0;for(const c of i)o+=Math.max(e,Math.min(r,c[1]))-Math.max(e,Math.min(r,c[0]));return o}function eh(i,e,r){const o=[{fixed:-1,stretch:0}];for(const[c,h]of i){const d=o[o.length-1];o.push({fixed:c-d.stretch,stretch:d.stretch}),o.push({fixed:c-d.stretch,stretch:d.stretch+(h-c)})}return o.push({fixed:e+1,stretch:r}),o}function pl(i,e,r,o){return i/e*r+o}function dl(i,e,r,o){return i-e*r/o}$e("Anchor",Vn);class fl{constructor(e,r,o,c,h,d,m,g,x,T){if(this.boxStartIndex=e.length,x){let S=d.top,P=d.bottom;const k=d.collisionPadding;k&&(S-=k[1],P+=k[3]);let L=P-S;L>0&&(L=Math.max(10,L),this.circleDiameter=L)}else{let S=d.top*m-g[0],P=d.bottom*m+g[2],k=d.left*m-g[3],L=d.right*m+g[1];const Z=d.collisionPadding;if(Z&&(k-=Z[0]*m,S-=Z[1]*m,L+=Z[2]*m,P+=Z[3]*m),T){const q=new He(k,S),re=new He(L,S),ce=new He(k,P),ee=new He(L,P),ae=T*Math.PI/180;q._rotate(ae),re._rotate(ae),ce._rotate(ae),ee._rotate(ae),k=Math.min(q.x,re.x,ce.x,ee.x),L=Math.max(q.x,re.x,ce.x,ee.x),S=Math.min(q.y,re.y,ce.y,ee.y),P=Math.max(q.y,re.y,ce.y,ee.y)}e.emplaceBack(r.x,r.y,k,S,L,P,o,c,h)}this.boxEndIndex=e.length}}class Jd{constructor(e=[],r=Yd){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:o}=this,c=r[e];for(;e>0;){const h=e-1>>1,d=r[h];if(o(c,d)>=0)break;r[e]=d,e=h}r[e]=c}_down(e){const{data:r,compare:o}=this,c=this.length>>1,h=r[e];for(;e<c;){let d=1+(e<<1),m=r[d];const g=d+1;if(g<this.length&&o(r[g],m)<0&&(d=g,m=r[g]),o(m,h)>=0)break;r[e]=m,e=d}r[e]=h}}function Yd(i,e){return i<e?-1:i>e?1:0}function Qd(i,e=1,r=!1){let o=1/0,c=1/0,h=-1/0,d=-1/0;const m=i[0];for(let k=0;k<m.length;k++){const L=m[k];(!k||L.x<o)&&(o=L.x),(!k||L.y<c)&&(c=L.y),(!k||L.x>h)&&(h=L.x),(!k||L.y>d)&&(d=L.y)}const g=Math.min(h-o,d-c);let x=g/2;const T=new Jd([],ef);if(g===0)return new He(o,c);for(let k=o;k<h;k+=g)for(let L=c;L<d;L+=g)T.push(new ts(k+x,L+x,x,i));let S=function(k){let L=0,Z=0,q=0;const re=k[0];for(let ce=0,ee=re.length,ae=ee-1;ce<ee;ae=ce++){const xe=re[ce],ye=re[ae],Ue=xe.x*ye.y-ye.x*xe.y;Z+=(xe.x+ye.x)*Ue,q+=(xe.y+ye.y)*Ue,L+=3*Ue}return new ts(Z/L,q/L,0,k)}(i),P=T.length;for(;T.length;){const k=T.pop();(k.d>S.d||!S.d)&&(S=k,r&&console.log("found best %d after %d probes",Math.round(1e4*k.d)/1e4,P)),k.max-S.d<=e||(x=k.h/2,T.push(new ts(k.p.x-x,k.p.y-x,x,i)),T.push(new ts(k.p.x+x,k.p.y-x,x,i)),T.push(new ts(k.p.x-x,k.p.y+x,x,i)),T.push(new ts(k.p.x+x,k.p.y+x,x,i)),P+=4)}return r&&(console.log(`num probes: ${P}`),console.log(`best distance: ${S.d}`)),S.p}function ef(i,e){return e.max-i.max}function ts(i,e,r,o){this.p=new He(i,e),this.h=r,this.d=function(c,h){let d=!1,m=1/0;for(let g=0;g<h.length;g++){const x=h[g];for(let T=0,S=x.length,P=S-1;T<S;P=T++){const k=x[T],L=x[P];k.y>c.y!=L.y>c.y&&c.x<(L.x-k.x)*(c.y-k.y)/(L.y-k.y)+k.x&&(d=!d),m=Math.min(m,lu(c,k,L))}}return(d?1:-1)*Math.sqrt(m)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}const _c=Number.POSITIVE_INFINITY;function th(i,e){return e[1]!==_c?function(r,o,c){let h=0,d=0;switch(o=Math.abs(o),c=Math.abs(c),r){case"top-right":case"top-left":case"top":d=c-7;break;case"bottom-right":case"bottom-left":case"bottom":d=7-c}switch(r){case"top-right":case"bottom-right":case"right":h=-o;break;case"top-left":case"bottom-left":case"left":h=o}return[h,d]}(i,e[0],e[1]):function(r,o){let c=0,h=0;o<0&&(o=0);const d=o/Math.sqrt(2);switch(r){case"top-right":case"top-left":h=d-7;break;case"bottom-right":case"bottom-left":h=7-d;break;case"bottom":h=7-o;break;case"top":h=o-7}switch(r){case"top-right":case"bottom-right":c=-d;break;case"top-left":case"bottom-left":c=d;break;case"left":c=o;break;case"right":c=-o}return[c,h]}(i,e[0])}function yc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function tf(i,e,r,o,c,h,d,m,g,x,T){let S=h.textMaxSize.evaluate(e,{});S===void 0&&(S=d);const P=i.layers[0].layout,k=P.get("icon-offset").evaluate(e,{},T),L=rh(r.horizontal),Z=d/24,q=i.tilePixelRatio*Z,re=i.tilePixelRatio*S/24,ce=i.tilePixelRatio*m,ee=i.tilePixelRatio*P.get("symbol-spacing"),ae=P.get("text-padding")*i.tilePixelRatio,xe=function(Te,We,je,ut=1){const Ut=Te.get("icon-padding").evaluate(We,{},je),Zt=Ut&&Ut.values;return[Zt[0]*ut,Zt[1]*ut,Zt[2]*ut,Zt[3]*ut]}(P,e,T,i.tilePixelRatio),ye=P.get("text-max-angle")/180*Math.PI,Ue=P.get("text-rotation-alignment")!=="viewport"&&P.get("symbol-placement")!=="point",Ne=P.get("icon-rotation-alignment")==="map"&&P.get("symbol-placement")!=="point",Le=P.get("symbol-placement"),Me=ee/2,Ee=P.get("icon-text-fit");let Re;o&&Ee!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Re=Zu(o,r.vertical,Ee,P.get("icon-text-fit-padding"),k,Z)),L&&(o=Zu(o,L,Ee,P.get("icon-text-fit-padding"),k,Z)));const ze=(Te,We)=>{We.x<0||We.x>=si||We.y<0||We.y>=si||function(je,ut,Ut,Zt,ai,ar,wi,ri,di,Ti,Ai,ji,ni,Ei,Mi,Ui,Xi,Wi,jt,fi,ft,tr,Si,Pi,_r){const Mr=je.addToLineVertexArray(ut,Ut);let Pr,pn,yr,lr,Hi=0,dn=0,ia=0,xh=0,Ac=-1,Mc=-1;const fn={};let vh=pi.exports(""),Pc=0,zc=0;if(ri._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Pc,zc]=ri.layout.get("text-offset").evaluate(ft,{},Pi).map(Ki=>Ki*yi):(Pc=ri.layout.get("text-radial-offset").evaluate(ft,{},Pi)*yi,zc=_c),je.allowVerticalPlacement&&Zt.vertical){const Ki=ri.layout.get("text-rotate").evaluate(ft,{},Pi)+90;yr=new fl(di,ut,Ti,Ai,ji,Zt.vertical,ni,Ei,Mi,Ki),wi&&(lr=new fl(di,ut,Ti,Ai,ji,wi,Xi,Wi,Mi,Ki))}if(ai){const Ki=ri.layout.get("icon-rotate").evaluate(ft,{}),Wr=ri.layout.get("icon-text-fit")!=="none",ra=Qu(ai,Ki,Si,Wr),na=wi?Qu(wi,Ki,Si,Wr):void 0;pn=new fl(di,ut,Ti,Ai,ji,ai,Xi,Wi,!1,Ki),Hi=4*ra.length;const Th=je.iconSizeData;let Eo=null;Th.kind==="source"?(Eo=[hn*ri.layout.get("icon-size").evaluate(ft,{})],Eo[0]>Nn&&ht(`${je.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Th.kind==="composite"&&(Eo=[hn*tr.compositeIconSizes[0].evaluate(ft,{},Pi),hn*tr.compositeIconSizes[1].evaluate(ft,{},Pi)],(Eo[0]>Nn||Eo[1]>Nn)&&ht(`${je.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),je.addSymbols(je.icon,ra,Eo,fi,jt,ft,a.WritingMode.none,ut,Mr.lineStartIndex,Mr.lineLength,-1,Pi),Ac=je.icon.placedSymbolArray.length-1,na&&(dn=4*na.length,je.addSymbols(je.icon,na,Eo,fi,jt,ft,a.WritingMode.vertical,ut,Mr.lineStartIndex,Mr.lineLength,-1,Pi),Mc=je.icon.placedSymbolArray.length-1)}const bh=Object.keys(Zt.horizontal);for(const Ki of bh){const Wr=Zt.horizontal[Ki];if(!Pr){vh=pi.exports(Wr.text);const na=ri.layout.get("text-rotate").evaluate(ft,{},Pi);Pr=new fl(di,ut,Ti,Ai,ji,Wr,ni,Ei,Mi,na)}const ra=Wr.positionedLines.length===1;if(ia+=ih(je,ut,Wr,ar,ri,Mi,ft,Ui,Mr,Zt.vertical?a.WritingMode.horizontal:a.WritingMode.horizontalOnly,ra?bh:[Ki],fn,Ac,tr,Pi),ra)break}Zt.vertical&&(xh+=ih(je,ut,Zt.vertical,ar,ri,Mi,ft,Ui,Mr,a.WritingMode.vertical,["vertical"],fn,Mc,tr,Pi));const mf=Pr?Pr.boxStartIndex:je.collisionBoxArray.length,gf=Pr?Pr.boxEndIndex:je.collisionBoxArray.length,_f=yr?yr.boxStartIndex:je.collisionBoxArray.length,yf=yr?yr.boxEndIndex:je.collisionBoxArray.length,xf=pn?pn.boxStartIndex:je.collisionBoxArray.length,vf=pn?pn.boxEndIndex:je.collisionBoxArray.length,bf=lr?lr.boxStartIndex:je.collisionBoxArray.length,wf=lr?lr.boxEndIndex:je.collisionBoxArray.length;let zr=-1;const xl=(Ki,Wr)=>Ki&&Ki.circleDiameter?Math.max(Ki.circleDiameter,Wr):Wr;zr=xl(Pr,zr),zr=xl(yr,zr),zr=xl(pn,zr),zr=xl(lr,zr);const wh=zr>-1?1:0;wh&&(zr*=_r/yi),je.glyphOffsetArray.length>=is.MAX_GLYPHS&&ht("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),ft.sortKey!==void 0&&je.addToSortKeyRanges(je.symbolInstances.length,ft.sortKey),je.symbolInstances.emplaceBack(ut.x,ut.y,fn.right>=0?fn.right:-1,fn.center>=0?fn.center:-1,fn.left>=0?fn.left:-1,fn.vertical||-1,Ac,Mc,vh,mf,gf,_f,yf,xf,vf,bf,wf,Ti,ia,xh,Hi,dn,wh,0,ni,Pc,zc,zr)}(i,We,Te,r,o,c,Re,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,q,[ae,ae,ae,ae],Ue,g,ce,xe,Ne,k,e,h,x,T,d)};if(Le==="line")for(const Te of Yu(e.geometry,0,0,si,si)){const We=Kd(Te,ee,ye,r.vertical||L,o,24,re,i.overscaling,si);for(const je of We){const ut=L;ut&&rf(i,ut.text,Me,je)||ze(Te,je)}}else if(Le==="line-center"){for(const Te of e.geometry)if(Te.length>1){const We=Hd(Te,ye,r.vertical||L,o,24,re);We&&ze(Te,We)}}else if(e.type==="Polygon")for(const Te of oc(e.geometry,0)){const We=Qd(Te,16);ze(Te[0],new Vn(We.x,We.y,0))}else if(e.type==="LineString")for(const Te of e.geometry)ze(Te,new Vn(Te[0].x,Te[0].y,0));else if(e.type==="Point")for(const Te of e.geometry)for(const We of Te)ze([We],new Vn(We.x,We.y,0))}const Nn=32640;function ih(i,e,r,o,c,h,d,m,g,x,T,S,P,k,L){const Z=function(ce,ee,ae,xe,ye,Ue,Ne,Le){const Me=xe.layout.get("text-rotate").evaluate(Ue,{})*Math.PI/180,Ee=[];for(const Re of ee.positionedLines)for(const ze of Re.positionedGlyphs){if(!ze.rect)continue;const Te=ze.rect||{};let We=4,je=!0,ut=1,Ut=0;const Zt=(ye||Le)&&ze.vertical,ai=ze.metrics.advance*ze.scale/2;if(Le&&ee.verticalizable){const jt=(ze.scale-1)*yi,fi=(yi-ze.metrics.width*ze.scale)/2;Ut=Re.lineOffset/2-(ze.imageName?-fi:jt)}if(ze.imageName){const jt=Ne[ze.imageName];je=jt.sdf,ut=jt.pixelRatio,We=1/ut}const ar=ye?[ze.x+ai,ze.y]:[0,0];let wi=ye?[0,0]:[ze.x+ai+ae[0],ze.y+ae[1]-Ut],ri=[0,0];Zt&&(ri=wi,wi=[0,0]);const di=(ze.metrics.left-We)*ze.scale-ai+wi[0],Ti=(-ze.metrics.top-We)*ze.scale+wi[1],Ai=di+Te.w*ze.scale/ut,ji=Ti+Te.h*ze.scale/ut,ni=new He(di,Ti),Ei=new He(Ai,Ti),Mi=new He(di,ji),Ui=new He(Ai,ji);if(Zt){const jt=new He(-ai,ai-ll),fi=-Math.PI/2,ft=12-ai,tr=new He(22-ft,-(ze.imageName?ft:0)),Si=new He(...ri);ni._rotateAround(fi,jt)._add(tr)._add(Si),Ei._rotateAround(fi,jt)._add(tr)._add(Si),Mi._rotateAround(fi,jt)._add(tr)._add(Si),Ui._rotateAround(fi,jt)._add(tr)._add(Si)}if(Me){const jt=Math.sin(Me),fi=Math.cos(Me),ft=[fi,-jt,jt,fi];ni._matMult(ft),Ei._matMult(ft),Mi._matMult(ft),Ui._matMult(ft)}const Xi=new He(0,0),Wi=new He(0,0);Ee.push({tl:ni,tr:Ei,bl:Mi,br:Ui,tex:Te,writingMode:ee.writingMode,glyphOffset:ar,sectionIndex:ze.sectionIndex,isSDF:je,pixelOffsetTL:Xi,pixelOffsetBR:Wi,minFontScaleX:0,minFontScaleY:0})}return Ee}(0,r,m,c,h,d,o,i.allowVerticalPlacement),q=i.textSizeData;let re=null;q.kind==="source"?(re=[hn*c.layout.get("text-size").evaluate(d,{})],re[0]>Nn&&ht(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):q.kind==="composite"&&(re=[hn*k.compositeTextSizes[0].evaluate(d,{},L),hn*k.compositeTextSizes[1].evaluate(d,{},L)],(re[0]>Nn||re[1]>Nn)&&ht(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,Z,re,m,h,d,x,e,g.lineStartIndex,g.lineLength,P,L);for(const ce of T)S[ce]=i.text.placedSymbolArray.length-1;return 4*Z.length}function rh(i){for(const e in i)return i[e];return null}function rf(i,e,r,o){const c=i.compareText;if(e in c){const h=c[e];for(let d=h.length-1;d>=0;d--)if(o.dist(h[d])<r)return!0}else c[e]=[];return c[e].push(o),!1}const nf=Un.VectorTileFeature.types,of=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ml(i,e,r,o,c,h,d,m,g,x,T,S,P){const k=m?Math.min(Nn,Math.round(m[0])):0,L=m?Math.min(Nn,Math.round(m[1])):0;i.emplaceBack(e,r,Math.round(32*o),Math.round(32*c),h,d,(k<<1)+(g?1:0),L,16*x,16*T,256*S,256*P)}function xc(i,e,r){i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r)}function sf(i){for(const e of i.sections)if(qa(e.text))return!0;return!1}class vc{constructor(e){this.layoutVertexArray=new mr,this.indexArray=new Bi,this.programConfigurations=e,this.segments=new pt,this.dynamicLayoutVertexArray=new nr,this.opacityVertexArray=new gr,this.placedSymbolArray=new we}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,o,c){this.isEmpty()||(o&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ad.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Md.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,of,!0),this.opacityVertexBuffer.itemSize=1),(o||c)&&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())}}$e("SymbolBuffers",vc);class bc{constructor(e,r,o){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new o,this.segments=new pt,this.collisionVertexArray=new Qi}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Pd.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}$e("CollisionBuffers",bc);class is{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(d=>d.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Ql([]),this.placementViewportMatrix=Ql([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ju(this.zoom,r["text-size"]),this.iconSizeData=ju(this.zoom,r["icon-size"]);const o=this.layers[0].layout,c=o.get("symbol-sort-key"),h=o.get("symbol-z-order");this.canOverlap=Tc(o,"text-overlap","text-allow-overlap")!=="never"||Tc(o,"icon-overlap","icon-allow-overlap")!=="never"||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=h!=="viewport-y"&&!c.isConstant(),this.sortFeaturesByY=(h==="viewport-y"||h==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,o.get("symbol-placement")==="point"&&(this.writingModes=o.get("text-writing-mode").map(d=>a.WritingMode[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=e.sourceID}createArrays(){this.text=new vc(new xo(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new vc(new xo(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Ae,this.lineVertexArray=new Oe,this.symbolInstances=new Fe}calculateGlyphDependencies(e,r,o,c,h){for(let d=0;d<e.length;d++)if(r[e.charCodeAt(d)]=!0,(o||c)&&h){const m=Ys[e.charAt(d)];m&&(r[m.charCodeAt(0)]=!0)}}populate(e,r,o){const c=this.layers[0],h=c.layout,d=h.get("text-font"),m=h.get("text-field"),g=h.get("icon-image"),x=(m.value.kind!=="constant"||m.value.value instanceof W&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),T=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,S=h.get("symbol-sort-key");if(this.features=[],!x&&!T)return;const P=r.iconDependencies,k=r.glyphDependencies,L=r.availableImages,Z=new Gt(this.zoom);for(const{feature:q,id:re,index:ce,sourceLayerIndex:ee}of e){const ae=c._featureFilter.needGeometry,xe=bo(q,ae);if(!c._featureFilter.filter(Z,xe,o))continue;let ye,Ue;if(ae||(xe.geometry=vo(q)),x){const Le=c.getValueAndResolveTokens("text-field",xe,o,L),Me=W.factory(Le);sf(Me)&&(this.hasRTLText=!0),(!this.hasRTLText||go()==="unavailable"||this.hasRTLText&&Yi.isParsed())&&(ye=kd(Me,c,xe))}if(T){const Le=c.getValueAndResolveTokens("icon-image",xe,o,L);Ue=Le instanceof J?Le:J.fromString(Le)}if(!ye&&!Ue)continue;const Ne=this.sortFeaturesByKey?S.evaluate(xe,{},o):void 0;if(this.features.push({id:re,text:ye,icon:Ue,index:ce,sourceLayerIndex:ee,geometry:xe.geometry,properties:q.properties,type:nf[q.type],sortKey:Ne}),Ue&&(P[Ue.name]=!0),ye){const Le=d.evaluate(xe,{},o).join(","),Me=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.WritingMode.vertical)>=0;for(const Ee of ye.sections)if(Ee.image)P[Ee.image.name]=!0;else{const Re=qo(ye.toString()),ze=Ee.fontStack||Le,Te=k[ze]=k[ze]||{};this.calculateGlyphDependencies(Ee.text,Te,Me,this.allowVerticalPlacement,Re)}}}h.get("symbol-placement")==="line"&&(this.features=function(q){const re={},ce={},ee=[];let ae=0;function xe(Le){ee.push(q[Le]),ae++}function ye(Le,Me,Ee){const Re=ce[Le];return delete ce[Le],ce[Me]=Re,ee[Re].geometry[0].pop(),ee[Re].geometry[0]=ee[Re].geometry[0].concat(Ee[0]),Re}function Ue(Le,Me,Ee){const Re=re[Me];return delete re[Me],re[Le]=Re,ee[Re].geometry[0].shift(),ee[Re].geometry[0]=Ee[0].concat(ee[Re].geometry[0]),Re}function Ne(Le,Me,Ee){const Re=Ee?Me[0][Me[0].length-1]:Me[0][0];return`${Le}:${Re.x}:${Re.y}`}for(let Le=0;Le<q.length;Le++){const Me=q[Le],Ee=Me.geometry,Re=Me.text?Me.text.toString():null;if(!Re){xe(Le);continue}const ze=Ne(Re,Ee),Te=Ne(Re,Ee,!0);if(ze in ce&&Te in re&&ce[ze]!==re[Te]){const We=Ue(ze,Te,Ee),je=ye(ze,Te,ee[We].geometry);delete re[ze],delete ce[Te],ce[Ne(Re,ee[je].geometry,!0)]=je,ee[We].geometry=null}else ze in ce?ye(ze,Te,Ee):Te in re?Ue(ze,Te,Ee):(xe(Le),re[ze]=ae-1,ce[Te]=ae-1)}return ee.filter(Le=>Le.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((q,re)=>q.sortKey-re.sortKey)}update(e,r,o){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,o),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,o))}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,r){const o=this.lineVertexArray.length;if(e.segment!==void 0){let c=e.dist(r[e.segment+1]),h=e.dist(r[e.segment]);const d={};for(let m=e.segment+1;m<r.length;m++)d[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:c},m<r.length-1&&(c+=r[m+1].dist(r[m]));for(let m=e.segment||0;m>=0;m--)d[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:h},m>0&&(h+=r[m-1].dist(r[m]));for(let m=0;m<r.length;m++){const g=d[m];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(e,r,o,c,h,d,m,g,x,T,S,P){const k=e.indexArray,L=e.layoutVertexArray,Z=e.segments.prepareSegment(4*r.length,L,k,this.canOverlap?d.sortKey:void 0),q=this.glyphOffsetArray.length,re=Z.vertexLength,ce=this.allowVerticalPlacement&&m===a.WritingMode.vertical?Math.PI/2:0,ee=d.text&&d.text.sections;for(let ae=0;ae<r.length;ae++){const{tl:xe,tr:ye,bl:Ue,br:Ne,tex:Le,pixelOffsetTL:Me,pixelOffsetBR:Ee,minFontScaleX:Re,minFontScaleY:ze,glyphOffset:Te,isSDF:We,sectionIndex:je}=r[ae],ut=Z.vertexLength,Ut=Te[1];ml(L,g.x,g.y,xe.x,Ut+xe.y,Le.x,Le.y,o,We,Me.x,Me.y,Re,ze),ml(L,g.x,g.y,ye.x,Ut+ye.y,Le.x+Le.w,Le.y,o,We,Ee.x,Me.y,Re,ze),ml(L,g.x,g.y,Ue.x,Ut+Ue.y,Le.x,Le.y+Le.h,o,We,Me.x,Ee.y,Re,ze),ml(L,g.x,g.y,Ne.x,Ut+Ne.y,Le.x+Le.w,Le.y+Le.h,o,We,Ee.x,Ee.y,Re,ze),xc(e.dynamicLayoutVertexArray,g,ce),k.emplaceBack(ut,ut+1,ut+2),k.emplaceBack(ut+1,ut+2,ut+3),Z.vertexLength+=4,Z.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Te[0]),ae!==r.length-1&&je===r[ae+1].sectionIndex||e.programConfigurations.populatePaintArrays(L.length,d,d.index,{},P,ee&&ee[je])}e.placedSymbolArray.emplaceBack(g.x,g.y,q,this.glyphOffsetArray.length-q,re,x,T,g.segment,o?o[0]:0,o?o[1]:0,c[0],c[1],m,0,!1,0,S)}_addCollisionDebugVertex(e,r,o,c,h,d){return r.emplaceBack(0,0),e.emplaceBack(o.x,o.y,c,h,Math.round(d.x),Math.round(d.y))}addCollisionDebugVertices(e,r,o,c,h,d,m){const g=h.segments.prepareSegment(4,h.layoutVertexArray,h.indexArray),x=g.vertexLength,T=h.layoutVertexArray,S=h.collisionVertexArray,P=m.anchorX,k=m.anchorY;this._addCollisionDebugVertex(T,S,d,P,k,new He(e,r)),this._addCollisionDebugVertex(T,S,d,P,k,new He(o,r)),this._addCollisionDebugVertex(T,S,d,P,k,new He(o,c)),this._addCollisionDebugVertex(T,S,d,P,k,new He(e,c)),g.vertexLength+=4;const L=h.indexArray;L.emplaceBack(x,x+1),L.emplaceBack(x+1,x+2),L.emplaceBack(x+2,x+3),L.emplaceBack(x+3,x),g.primitiveLength+=4}addDebugCollisionBoxes(e,r,o,c){for(let h=e;h<r;h++){const d=this.collisionBoxArray.get(h);this.addCollisionDebugVertices(d.x1,d.y1,d.x2,d.y2,c?this.textCollisionBox:this.iconCollisionBox,d.anchorPoint,o)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new bc(jr,ku.members,Cr),this.iconCollisionBox=new bc(jr,ku.members,Cr);for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,o,c,h,d,m,g,x){const T={};for(let S=r;S<o;S++){const P=e.get(S);T.textBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.textFeatureIndex=P.featureIndex;break}for(let S=c;S<h;S++){const P=e.get(S);T.verticalTextBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.verticalTextFeatureIndex=P.featureIndex;break}for(let S=d;S<m;S++){const P=e.get(S);T.iconBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.iconFeatureIndex=P.featureIndex;break}for(let S=g;S<x;S++){const P=e.get(S);T.verticalIconBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.verticalIconFeatureIndex=P.featureIndex;break}return T}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const o=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,o.textBoxStartIndex,o.textBoxEndIndex,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o.iconBoxStartIndex,o.iconBoxEndIndex,o.verticalIconBoxStartIndex,o.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,r){const o=e.placedSymbolArray.get(r),c=o.vertexStartIndex+4*o.numGlyphs;for(let h=o.vertexStartIndex;h<c;h+=4)e.indexArray.emplaceBack(h,h+1,h+2),e.indexArray.emplaceBack(h+1,h+2,h+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),o=Math.cos(e),c=[],h=[],d=[];for(let m=0;m<this.symbolInstances.length;++m){d.push(m);const g=this.symbolInstances.get(m);c.push(0|Math.round(r*g.anchorX+o*g.anchorY)),h.push(g.featureIndex)}return d.sort((m,g)=>c[m]-c[g]||h[g]-h[m]),d}addToSortKeyRanges(e,r){const o=this.sortKeyRanges[this.sortKeyRanges.length-1];o&&o.sortKey===r?o.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,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 r of this.symbolInstanceIndexes){const o=this.symbolInstances.get(r);this.featureSortOrder.push(o.featureIndex),[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((c,h,d)=>{c>=0&&d.indexOf(c)===h&&this.addIndicesForPlacedSymbol(this.text,c)}),o.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,o.verticalPlacedTextSymbolIndex),o.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.placedIconSymbolIndex),o.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}$e("SymbolBucket",is,{omit:["layers","collisionBoxArray","features","compareText"]}),is.MAX_GLYPHS=65535,is.addDynamicAttributes=xc;const af=new _i({"symbol-placement":new qe(_e.layout_symbol["symbol-placement"]),"symbol-spacing":new qe(_e.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new qe(_e.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Je(_e.layout_symbol["symbol-sort-key"]),"symbol-z-order":new qe(_e.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new qe(_e.layout_symbol["icon-allow-overlap"]),"icon-overlap":new qe(_e.layout_symbol["icon-overlap"]),"icon-ignore-placement":new qe(_e.layout_symbol["icon-ignore-placement"]),"icon-optional":new qe(_e.layout_symbol["icon-optional"]),"icon-rotation-alignment":new qe(_e.layout_symbol["icon-rotation-alignment"]),"icon-size":new Je(_e.layout_symbol["icon-size"]),"icon-text-fit":new qe(_e.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new qe(_e.layout_symbol["icon-text-fit-padding"]),"icon-image":new Je(_e.layout_symbol["icon-image"]),"icon-rotate":new Je(_e.layout_symbol["icon-rotate"]),"icon-padding":new Je(_e.layout_symbol["icon-padding"]),"icon-keep-upright":new qe(_e.layout_symbol["icon-keep-upright"]),"icon-offset":new Je(_e.layout_symbol["icon-offset"]),"icon-anchor":new Je(_e.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new qe(_e.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new qe(_e.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new qe(_e.layout_symbol["text-rotation-alignment"]),"text-field":new Je(_e.layout_symbol["text-field"]),"text-font":new Je(_e.layout_symbol["text-font"]),"text-size":new Je(_e.layout_symbol["text-size"]),"text-max-width":new Je(_e.layout_symbol["text-max-width"]),"text-line-height":new qe(_e.layout_symbol["text-line-height"]),"text-letter-spacing":new Je(_e.layout_symbol["text-letter-spacing"]),"text-justify":new Je(_e.layout_symbol["text-justify"]),"text-radial-offset":new Je(_e.layout_symbol["text-radial-offset"]),"text-variable-anchor":new qe(_e.layout_symbol["text-variable-anchor"]),"text-anchor":new Je(_e.layout_symbol["text-anchor"]),"text-max-angle":new qe(_e.layout_symbol["text-max-angle"]),"text-writing-mode":new qe(_e.layout_symbol["text-writing-mode"]),"text-rotate":new Je(_e.layout_symbol["text-rotate"]),"text-padding":new qe(_e.layout_symbol["text-padding"]),"text-keep-upright":new qe(_e.layout_symbol["text-keep-upright"]),"text-transform":new Je(_e.layout_symbol["text-transform"]),"text-offset":new Je(_e.layout_symbol["text-offset"]),"text-allow-overlap":new qe(_e.layout_symbol["text-allow-overlap"]),"text-overlap":new qe(_e.layout_symbol["text-overlap"]),"text-ignore-placement":new qe(_e.layout_symbol["text-ignore-placement"]),"text-optional":new qe(_e.layout_symbol["text-optional"])});var wc={paint:new _i({"icon-opacity":new Je(_e.paint_symbol["icon-opacity"]),"icon-color":new Je(_e.paint_symbol["icon-color"]),"icon-halo-color":new Je(_e.paint_symbol["icon-halo-color"]),"icon-halo-width":new Je(_e.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Je(_e.paint_symbol["icon-halo-blur"]),"icon-translate":new qe(_e.paint_symbol["icon-translate"]),"icon-translate-anchor":new qe(_e.paint_symbol["icon-translate-anchor"]),"text-opacity":new Je(_e.paint_symbol["text-opacity"]),"text-color":new Je(_e.paint_symbol["text-color"],{runtimeType:gi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Je(_e.paint_symbol["text-halo-color"]),"text-halo-width":new Je(_e.paint_symbol["text-halo-width"]),"text-halo-blur":new Je(_e.paint_symbol["text-halo-blur"]),"text-translate":new qe(_e.paint_symbol["text-translate"]),"text-translate-anchor":new qe(_e.paint_symbol["text-translate-anchor"])}),layout:af};class nh{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:Or,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.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}}$e("FormatSectionOverride",nh,{omit:["defaultValue"]});class gl extends fr{constructor(e){super(e,wc)}recalculate(e,r){if(super.recalculate(e,r),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 o=this.layout.get("text-writing-mode");if(o){const c=[];for(const h of o)c.indexOf(h)<0&&c.push(h);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,o,c){const h=this.layout.get(e).evaluate(r,{},o,c),d=this._unevaluatedLayout._values[e];return d.isDataDriven()||io(d.value)||!h?h:function(m,g){return g.replace(/{([^{}]+)}/g,(x,T)=>T in m?String(m[T]):"")}(r.properties,h)}createBucket(e){return new is(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of wc.paint.overridableProperties){if(!gl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),o=new nh(r),c=new Oo(o,r.property.specification);let h=null;h=r.value.kind==="constant"||r.value.kind==="source"?new no("source",c):new Is("composite",c,r.value.zoomStops),this.paint._values[e]=new dr(r.property,h,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,o){return!(!this.layout||r.isDataDriven()||o.isDataDriven())&&gl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const o=e.get("text-field"),c=wc.paint.properties[r];let h=!1;const d=m=>{for(const g of m)if(c.overrides&&c.overrides.hasOverride(g))return void(h=!0)};if(o.value.kind==="constant"&&o.value.value instanceof W)d(o.value.value.sections);else if(o.value.kind==="source"){const m=x=>{h||(x instanceof Ge&&he(x.value)===li?d(x.value.sections):x instanceof Bo?d(x.sections):x.eachChild(m))},g=o.value;g._styleExpression&&m(g._styleExpression.expression)}return h}}function Tc(i,e,r){let o="never";const c=i.get(e);return c?o=c:i.get(r)&&(o="always"),o}var lf={paint:new _i({"background-color":new qe(_e.paint_background["background-color"]),"background-pattern":new Os(_e.paint_background["background-pattern"]),"background-opacity":new qe(_e.paint_background["background-opacity"])})},cf={paint:new _i({"raster-opacity":new qe(_e.paint_raster["raster-opacity"]),"raster-hue-rotate":new qe(_e.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new qe(_e.paint_raster["raster-brightness-min"]),"raster-brightness-max":new qe(_e.paint_raster["raster-brightness-max"]),"raster-saturation":new qe(_e.paint_raster["raster-saturation"]),"raster-contrast":new qe(_e.paint_raster["raster-contrast"]),"raster-resampling":new qe(_e.paint_raster["raster-resampling"]),"raster-fade-duration":new qe(_e.paint_raster["raster-fade-duration"])})};class uf extends fr{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.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")}}const hf={circle:class extends fr{constructor(i){super(i,Vp)}createBucket(i){return new Kl(i)}queryRadius(i){const e=i;return Gs("circle-radius",this,e)+Gs("circle-stroke-width",this,e)+Qa(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,o,c,h,d,m){const g=el(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),h.angle,d),x=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),T=this.paint.get("circle-pitch-alignment")==="map",S=T?g:function(k,L){return k.map(Z=>mu(Z,L))}(g,m),P=T?x*d:x;for(const k of o)for(const L of k){const Z=T?L:mu(L,m);let q=P;const re=tl([],[L.x,L.y,0,1],m);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?q*=re[3]/h.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(q*=h.cameraToCenterDistance/re[3]),Bp(S,Z,q))return!0}return!1}},heatmap:class extends fr{constructor(i){super(i,Gp),this._updateColorRamp()}createBucket(i){return new gu(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=yu({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends fr{constructor(i){super(i,qp)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends fr{constructor(i){super(i,sd)}recalculate(i,e){super.recalculate(i,e);const r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new lc(i)}queryRadius(){return Qa(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,o,c,h,d){return au(el(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),h.angle,d),o)}isTileClipped(){return!0}},"fill-extrusion":class extends fr{constructor(i){super(i,vd)}createBucket(i){return new uc(i)}queryRadius(){return Qa(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,o,c,h,d,m){const g=el(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),h.angle,d),x=this.paint.get("fill-extrusion-height").evaluate(e,r),T=this.paint.get("fill-extrusion-base").evaluate(e,r),S=function(k,L,Z,q){const re=[];for(const ce of k){const ee=[ce.x,ce.y,0,1];tl(ee,ee,L),re.push(new He(ee[0]/ee[3],ee[1]/ee[3]))}return re}(g,m),P=function(k,L,Z,q){const re=[],ce=[],ee=q[8]*L,ae=q[9]*L,xe=q[10]*L,ye=q[11]*L,Ue=q[8]*Z,Ne=q[9]*Z,Le=q[10]*Z,Me=q[11]*Z;for(const Ee of k){const Re=[],ze=[];for(const Te of Ee){const We=Te.x,je=Te.y,ut=q[0]*We+q[4]*je+q[12],Ut=q[1]*We+q[5]*je+q[13],Zt=q[2]*We+q[6]*je+q[14],ai=q[3]*We+q[7]*je+q[15],ar=Zt+xe,wi=ai+ye,ri=ut+Ue,di=Ut+Ne,Ti=Zt+Le,Ai=ai+Me,ji=new He((ut+ee)/wi,(Ut+ae)/wi);ji.z=ar/wi,Re.push(ji);const ni=new He(ri/Ai,di/Ai);ni.z=Ti/Ai,ze.push(ni)}re.push(Re),ce.push(ze)}return[re,ce]}(o,T,x,m);return function(k,L,Z){let q=1/0;au(Z,L)&&(q=Cu(Z,L[0]));for(let re=0;re<L.length;re++){const ce=L[re],ee=k[re];for(let ae=0;ae<ce.length-1;ae++){const xe=ce[ae],ye=[xe,ce[ae+1],ee[ae+1],ee[ae],xe];su(Z,ye)&&(q=Math.min(q,Cu(Z,ye)))}}return q!==1/0&&q}(P[0],P[1],S)}},line:class extends fr{constructor(i){super(i,Mu),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Jn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,e){super.recalculate(i,e),this.paint._values["line-floorwidth"]=Pu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new hc(i)}queryRadius(i){const e=i,r=zu(Gs("line-width",this,e),Gs("line-gap-width",this,e)),o=Gs("line-offset",this,e);return r/2+Math.abs(o)+Qa(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,r,o,c,h,d){const m=el(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),h.angle,d),g=d/2*zu(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),x=this.paint.get("line-offset").evaluate(e,r);return x&&(o=function(T,S){const P=[];for(let k=0;k<T.length;k++){const L=T[k],Z=[];for(let q=0;q<L.length;q++){const re=L[q-1],ce=L[q],ee=L[q+1],ae=q===0?new He(0,0):ce.sub(re)._unit()._perp(),xe=q===L.length-1?new He(0,0):ee.sub(ce)._unit()._perp(),ye=ae._add(xe)._unit(),Ue=ye.x*xe.x+ye.y*xe.y;Ue!==0&&ye._mult(1/Ue),Z.push(ye._mult(S)._add(ce))}P.push(Z)}return P}(o,x*d)),function(T,S,P){for(let k=0;k<S.length;k++){const L=S[k];if(T.length>=3){for(let Z=0;Z<L.length;Z++)if(Ho(T,L[Z]))return!0}if(Fp(T,L,P))return!0}return!1}(m,o,g)}isTileClipped(){return!0}},symbol:gl,background:class extends fr{constructor(i){super(i,lf)}},raster:class extends fr{constructor(i){super(i,cf)}}};class pf{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel!="undefined"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const oh=63710088e-1;class Yt{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Yt(ke(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,o=this.lat*r,c=e.lat*r,h=Math.sin(o)*Math.sin(c)+Math.cos(o)*Math.cos(c)*Math.cos((e.lng-this.lng)*r);return oh*Math.acos(Math.min(h,1))}toBounds(e=0){const r=360*e/40075017,o=r/Math.cos(Math.PI/180*this.lat);return new To(new Yt(this.lng-o,this.lat-r),new Yt(this.lng+o,this.lat+r))}static convert(e){if(e instanceof Yt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Yt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Yt(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>]")}}class To{constructor(e,r){e&&(r?this.setSouthWest(e).setNorthEast(r):e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof Yt?new Yt(e.lng,e.lat):Yt.convert(e),this}setSouthWest(e){return this._sw=e instanceof Yt?new Yt(e.lng,e.lat):Yt.convert(e),this}extend(e){const r=this._sw,o=this._ne;let c,h;if(e instanceof Yt)c=e,h=e;else{if(!(e instanceof To))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(To.convert(e)):this.extend(Yt.convert(e)):this;if(c=e._sw,h=e._ne,!c||!h)return this}return r||o?(r.lng=Math.min(c.lng,r.lng),r.lat=Math.min(c.lat,r.lat),o.lng=Math.max(h.lng,o.lng),o.lat=Math.max(h.lat,o.lat)):(this._sw=new Yt(c.lng,c.lat),this._ne=new Yt(h.lng,h.lat)),this}getCenter(){return new Yt((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 Yt(this.getWest(),this.getNorth())}getSouthEast(){return new Yt(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:r,lat:o}=Yt.convert(e);let c=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&c}static convert(e){return e instanceof To?e:e&&new To(e)}}const sh=2*Math.PI*oh;function ah(i){return sh*Math.cos(i*Math.PI/180)}function lh(i){return(180+i)/360}function ch(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function uh(i,e){return i/ah(e)}function Ec(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class _l{constructor(e,r,o=0){this.x=+e,this.y=+r,this.z=+o}static fromLngLat(e,r=0){const o=Yt.convert(e);return new _l(lh(o.lng),ch(o.lat),uh(r,o.lat))}toLngLat(){return new Yt(360*this.x-180,Ec(this.y))}toAltitude(){return this.z*ah(Ec(this.y))}meterInMercatorCoordinateUnits(){return 1/sh*(e=Ec(this.y),1/Math.cos(e*Math.PI/180));var e}}function hh(i,e,r){var o=2*Math.PI*6378137/256/Math.pow(2,r);return[i*o-2*Math.PI*6378137/2,e*o-2*Math.PI*6378137/2]}class Sc{constructor(e,r,o){if(e<0||e>25||o<0||o>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${o}, 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=r,this.y=o,this.key=ea(0,e,e,r,o)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,o){const c=(d=this.y,m=this.z,g=hh(256*(h=this.x),256*(d=Math.pow(2,m)-d-1),m),x=hh(256*(h+1),256*(d+1),m),g[0]+","+g[1]+","+x[0]+","+x[1]);var h,d,m,g,x;const T=function(S,P,k){let L,Z="";for(let q=S;q>0;q--)L=1<<q-1,Z+=(P&L?1:0)+(k&L?2:0);return Z}(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(o==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,T).replace(/{bbox-epsg-3857}/g,c)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new He((e.x*r-this.x)*si,(e.y*r-this.y)*si)}toString(){return`${this.z}/${this.x}/${this.y}`}}class ph{constructor(e,r){this.wrap=e,this.canonical=r,this.key=ea(e,r.z,r.z,r.x,r.y)}}class sr{constructor(e,r,o,c,h){if(e<o)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${o}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Sc(o,+c,+h),this.key=ea(r,e,o,c,h)}clone(){return new sr(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 r=this.canonical.z-e;return e>this.canonical.z?new sr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new sr(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const o=this.canonical.z-e;return e>this.canonical.z?ea(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):ea(this.wrap*+r,e,e,this.canonical.x>>o,this.canonical.y>>o)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new sr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,o=2*this.canonical.x,c=2*this.canonical.y;return[new sr(r,this.wrap,r,o,c),new sr(r,this.wrap,r,o+1,c),new sr(r,this.wrap,r,o,c+1),new sr(r,this.wrap,r,o+1,c+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 sr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new sr(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 ph(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new _l(e.x-this.wrap,e.y))}}function ea(i,e,r,o,c){(i*=2)<0&&(i=-1*i-1);const h=1<<r;return(h*h*i+h*c+o).toString(36)+r.toString(36)+e.toString(36)}$e("CanonicalTileID",Sc),$e("OverscaledTileID",sr,{omit:["posMatrix"]});class dh{constructor(e,r,o){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(o&&o!=="mapbox"&&o!=="terrarium")return void ht(`"${o}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;const c=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=o||"mapbox";for(let h=0;h<c;h++)this.data[this._idx(-1,h)]=this.data[this._idx(0,h)],this.data[this._idx(c,h)]=this.data[this._idx(c-1,h)],this.data[this._idx(h,-1)]=this.data[this._idx(h,0)],this.data[this._idx(h,c)]=this.data[this._idx(h,c-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(c,-1)]=this.data[this._idx(c-1,0)],this.data[this._idx(-1,c)]=this.data[this._idx(0,c-1)],this.data[this._idx(c,c)]=this.data[this._idx(c-1,c-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let h=0;h<c;h++)for(let d=0;d<c;d++){const m=this.get(h,d);m>this.max&&(this.max=m),m<this.min&&(this.min=m)}}get(e,r){const o=new Uint8Array(this.data.buffer),c=4*this._idx(e,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(o[c],o[c+1],o[c+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}_unpackMapbox(e,r,o){return(256*e*256+256*r+o)/10-1e4}_unpackTerrarium(e,r,o){return 256*e+r+o/256-32768}getPixels(){return new or({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,o){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let c=r*this.dim,h=r*this.dim+this.dim,d=o*this.dim,m=o*this.dim+this.dim;switch(r){case-1:c=h-1;break;case 1:h=c+1}switch(o){case-1:d=m-1;break;case 1:m=d+1}const g=-r*this.dim,x=-o*this.dim;for(let T=d;T<m;T++)for(let S=c;S<h;S++)this.data[this._idx(S,T)]=e.data[this._idx(S+g,T+x)]}}$e("DEMData",dh);class fh{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const o=e[r];this._stringToNumber[o]=r,this._numberToString[r]=o}}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 mh{constructor(e,r,o,c,h){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=o,e._y=c,this.properties=e.properties,this.id=h}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class gh{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new mo(si,16,0),this.grid3D=new mo(si,16,0),this.featureIndexArray=new ct,this.promoteId=r}insert(e,r,o,c,h,d){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,c,h);const g=d?this.grid3D:this.grid;for(let x=0;x<r.length;x++){const T=r[x],S=[1/0,1/0,-1/0,-1/0];for(let P=0;P<T.length;P++){const k=T[P];S[0]=Math.min(S[0],k.x),S[1]=Math.min(S[1],k.y),S[2]=Math.max(S[2],k.x),S[3]=Math.max(S[3],k.y)}S[0]<si&&S[1]<si&&S[2]>=0&&S[3]>=0&&g.insert(m,S[0],S[1],S[2],S[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Un.VectorTile(new pc(this.rawTileData)).layers,this.sourceLayerCoder=new fh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,o,c){this.loadVTLayers();const h=e.params||{},d=si/e.tileSize/e.scale,m=Vo(h.filter),g=e.queryGeometry,x=e.queryPadding*d,T=yh(g),S=this.grid.query(T.minX-x,T.minY-x,T.maxX+x,T.maxY+x),P=yh(e.cameraQueryGeometry),k=this.grid3D.query(P.minX-x,P.minY-x,P.maxX+x,P.maxY+x,(q,re,ce,ee)=>function(ae,xe,ye,Ue,Ne){for(const Me of ae)if(xe<=Me.x&&ye<=Me.y&&Ue>=Me.x&&Ne>=Me.y)return!0;const Le=[new He(xe,ye),new He(xe,Ne),new He(Ue,Ne),new He(Ue,ye)];if(ae.length>2){for(const Me of Le)if(Ho(ae,Me))return!0}for(let Me=0;Me<ae.length-1;Me++)if(Up(ae[Me],ae[Me+1],Le))return!0;return!1}(e.cameraQueryGeometry,q-x,re-x,ce+x,ee+x));for(const q of k)S.push(q);S.sort(df);const L={};let Z;for(let q=0;q<S.length;q++){const re=S[q];if(re===Z)continue;Z=re;const ce=this.featureIndexArray.get(re);let ee=null;this.loadMatchingFeature(L,ce.bucketIndex,ce.sourceLayerIndex,ce.featureIndex,m,h.layers,h.availableImages,r,o,c,(ae,xe,ye)=>(ee||(ee=vo(ae)),xe.queryIntersectsFeature(g,ae,ye,ee,this.z,e.transform,d,e.pixelPosMatrix)))}return L}loadMatchingFeature(e,r,o,c,h,d,m,g,x,T,S){const P=this.bucketLayerIDs[r];if(d&&!function(q,re){for(let ce=0;ce<q.length;ce++)if(re.indexOf(q[ce])>=0)return!0;return!1}(d,P))return;const k=this.sourceLayerCoder.decode(o),L=this.vtLayers[k].feature(c);if(h.needGeometry){const q=bo(L,!0);if(!h.filter(new Gt(this.tileID.overscaledZ),q,this.tileID.canonical))return}else if(!h.filter(new Gt(this.tileID.overscaledZ),L))return;const Z=this.getId(L,k);for(let q=0;q<P.length;q++){const re=P[q];if(d&&d.indexOf(re)<0)continue;const ce=g[re];if(!ce)continue;let ee={};Z&&T&&(ee=T.getState(ce.sourceLayer||"_geojsonTileLayer",Z));const ae=Se({},x[re]);ae.paint=_h(ae.paint,ce.paint,L,ee,m),ae.layout=_h(ae.layout,ce.layout,L,ee,m);const xe=!S||S(L,ce,ee);if(!xe)continue;const ye=new mh(L,this.z,this.x,this.y,Z);ye.layer=ae;let Ue=e[re];Ue===void 0&&(Ue=e[re]=[]),Ue.push({featureIndex:c,feature:ye,intersectionZ:xe})}}lookupSymbolFeatures(e,r,o,c,h,d,m,g){const x={};this.loadVTLayers();const T=Vo(h);for(const S of e)this.loadMatchingFeature(x,o,c,S,T,d,m,g,r);return x}hasLayer(e){for(const r of this.bucketLayerIDs)for(const o of r)if(e===o)return!0;return!1}getId(e,r){let o=e.id;return this.promoteId&&(o=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof o=="boolean"&&(o=Number(o))),o}}function _h(i,e,r,o,c){return tt(i,(h,d)=>{const m=e instanceof yo?e.get(d):null;return m&&m.evaluate?m.evaluate(r,o,c):m})}function yh(i){let e=1/0,r=1/0,o=-1/0,c=-1/0;for(const h of i)e=Math.min(e,h.x),r=Math.min(r,h.y),o=Math.max(o,h.x),c=Math.max(c,h.y);return{minX:e,minY:r,maxX:o,maxY:c}}function df(i,e){return e-i}var Ic;$e("FeatureIndex",gh,{omit:["rawTileData","sourceLayerCoder"]}),a.PerformanceMarkers=void 0,(Ic=a.PerformanceMarkers||(a.PerformanceMarkers={})).create="create",Ic.load="load",Ic.fullLoad="fullLoad";let yl=null,ta=[];const Cc=1e3/30,ff={mark(i){performance.mark(i)},frame(i){const e=i;yl!=null&&ta.push(e-yl),yl=e},clearMetrics(){yl=null,ta=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const i in a.PerformanceMarkers)performance.clearMarks(a.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.load),performance.measure("fullLoadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName("loadTime")[0].duration,e=performance.getEntriesByName("fullLoadTime")[0].duration,r=ta.length,o=1/(ta.reduce((h,d)=>h+d,0)/r/1e3),c=ta.filter(h=>h>Cc).reduce((h,d)=>h+(d-Cc)/Cc,0);return{loadTime:i,fullLoadTime:e,fps:o,percentDroppedFrames:c/(r+c)*100}}};a.AJAXError=$i,a.ARRAY_TYPE=Oi,a.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},Ye(["receive","process"],this),this.invoker=new pf(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=gt()?i:window}send(i,e,r,o,c=!1){const h=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[h]=r);const d=ei(this.globalScope)?void 0:[];return this.target.postMessage({id:h,type:i,hasCallback:!!r,targetMapId:o,mustQueue:c,sourceMapId:this.mapId,data:nn(e,d)},d),{cancel:()=>{r&&delete this.callbacks[h],this.target.postMessage({id:h,type:"<cancel>",targetMapId:o,sourceMapId:this.mapId})}}}receive(i){const e=i.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type==="<cancel>"){delete this.tasks[r];const o=this.cancelCallbacks[r];delete this.cancelCallbacks[r],o&&o()}else gt()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)}process(){if(!this.taskQueue.length)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){if(e.type==="<response>"){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(Vr(e.error)):r(null,Vr(e.data)))}else{let r=!1;const o=ei(this.globalScope)?void 0:[],c=e.hasCallback?(m,g)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:m?nn(m):null,data:nn(g,o)},o)}:m=>{r=!0};let h=null;const d=Vr(e.data);if(this.parent[e.type])h=this.parent[e.type](e.sourceMapId,d,c);else if(this.parent.getWorkerSource){const m=e.type.split(".");h=this.parent.getWorkerSource(e.sourceMapId,m[0],d.source)[m[1]](d,c)}else c(new Error(`Could not find function ${e.type}`));!r&&h&&h.cancel&&(this.cancelCallbacks[i]=h.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},a.AlphaImage=Zs,a.CanonicalTileID=Sc,a.CollisionBoxArray=me,a.CollisionCircleLayoutArray=class extends E{},a.Color=F,a.DEMData=dh,a.DataConstantProperty=qe,a.DictionaryCoder=fh,a.EXTENT=si,a.ErrorEvent=bn,a.EvaluationParameters=Gt,a.Event=wr,a.Evented=Tr,a.FeatureIndex=gh,a.FillBucket=lc,a.FillExtrusionBucket=uc,a.GeoJSONFeature=mh,a.ImageAtlas=$u,a.ImagePosition=fc,a.LineBucket=hc,a.LineStripIndexArray=class extends N{},a.LngLat=Yt,a.LngLatBounds=To,a.MercatorCoordinate=_l,a.ONE_EM=yi,a.OverscaledTileID=sr,a.PerformanceUtils=ff,a.PosArray=Xe,a.Properties=_i,a.QuadTriangleArray=class extends z{},a.RGBAImage=or,a.RasterBoundsArray=class extends l{},a.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},a.ResourceType=vr,a.SegmentVector=pt,a.SymbolBucket=is,a.Transitionable=Xa,a.TriangleIndexArray=Bi,a.Uniform1f=ln,a.Uniform1i=class extends an{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},a.Uniform2f=class extends an{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},a.Uniform3f=class extends an{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},a.Uniform4f=Xo,a.UniformColor=iu,a.UniformMatrix4f=class extends an{constructor(i,e){super(i,e),this.current=Lp}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},a.UnwrappedTileID=ph,a.ValidationError=Pe,a.ZoomHistory=Ps,a.add=function(i,e,r){return i[0]=e[0]+r[0],i[1]=e[1]+r[1],i[2]=e[2]+r[2],i},a.addDynamicAttributes=xc,a.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let o=i.length;const c=new Array(i.length);let h=null;i.forEach((d,m)=>{e(d,(g,x)=>{g&&(h=g),c[m]=x,--o==0&&r(h,c)})})},a.bezier=pe,a.bindAll=Ye,a.cacheEntryPossiblyAdded=function(i){ur++,ur>gn&&(i.getActor().send("enforceCacheSizeLimit",mn),ur=0)},a.clamp=te,a.clearTileCache=function(i){const e=caches.delete(Ii);i&&e.catch(i).then(()=>i())},a.clipLine=Yu,a.clone=function(i){var e=new Oi(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},a.clone$1=dt,a.clone$2=function(i){var e=new Oi(3);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},a.collisionCircleLayout=zd,a.config=ki,a.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},a.create=function(){var i=new Oi(16);return Oi!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},a.create$1=uu,a.createExpression=ro,a.createFilter=Vo,a.createLayout=ii,a.createStyleLayer=function(i){return i.type==="custom"?new uf(i):new hf[i.type](i)},a.cross=function(i,e,r){var o=e[0],c=e[1],h=e[2],d=r[0],m=r[1],g=r[2];return i[0]=c*g-h*m,i[1]=h*d-o*g,i[2]=o*m-c*d,i},a.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]},a.dot$1=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},a.ease=ue,a.emitValidationErrors=Go,a.enforceCacheSizeLimit=function(i){_n(),Di&&Di.then(e=>{e.keys().then(r=>{for(let o=0;o<r.length-i;o++)e.delete(r[o])})})},a.equals=function(i,e){var r=i[0],o=i[1],c=i[2],h=i[3],d=i[4],m=i[5],g=i[6],x=i[7],T=i[8],S=i[9],P=i[10],k=i[11],L=i[12],Z=i[13],q=i[14],re=i[15],ce=e[0],ee=e[1],ae=e[2],xe=e[3],ye=e[4],Ue=e[5],Ne=e[6],Le=e[7],Me=e[8],Ee=e[9],Re=e[10],ze=e[11],Te=e[12],We=e[13],je=e[14],ut=e[15];return Math.abs(r-ce)<=Fi*Math.max(1,Math.abs(r),Math.abs(ce))&&Math.abs(o-ee)<=Fi*Math.max(1,Math.abs(o),Math.abs(ee))&&Math.abs(c-ae)<=Fi*Math.max(1,Math.abs(c),Math.abs(ae))&&Math.abs(h-xe)<=Fi*Math.max(1,Math.abs(h),Math.abs(xe))&&Math.abs(d-ye)<=Fi*Math.max(1,Math.abs(d),Math.abs(ye))&&Math.abs(m-Ue)<=Fi*Math.max(1,Math.abs(m),Math.abs(Ue))&&Math.abs(g-Ne)<=Fi*Math.max(1,Math.abs(g),Math.abs(Ne))&&Math.abs(x-Le)<=Fi*Math.max(1,Math.abs(x),Math.abs(Le))&&Math.abs(T-Me)<=Fi*Math.max(1,Math.abs(T),Math.abs(Me))&&Math.abs(S-Ee)<=Fi*Math.max(1,Math.abs(S),Math.abs(Ee))&&Math.abs(P-Re)<=Fi*Math.max(1,Math.abs(P),Math.abs(Re))&&Math.abs(k-ze)<=Fi*Math.max(1,Math.abs(k),Math.abs(ze))&&Math.abs(L-Te)<=Fi*Math.max(1,Math.abs(L),Math.abs(Te))&&Math.abs(Z-We)<=Fi*Math.max(1,Math.abs(Z),Math.abs(We))&&Math.abs(q-je)<=Fi*Math.max(1,Math.abs(q),Math.abs(je))&&Math.abs(re-ut)<=Fi*Math.max(1,Math.abs(re),Math.abs(ut))},a.evaluateSizeForFeature=function(i,{uSize:e,uSizeT:r},{lowerSize:o,upperSize:c}){return i.kind==="source"?o/hn:i.kind==="composite"?Vt(o/hn,c/hn,r):e},a.evaluateSizeForZoom=function(i,e){let r=0,o=0;if(i.kind==="constant")o=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:c,minZoom:h,maxZoom:d}=i,m=c?te(Gi.interpolationFactor(c,e,h,d),0,1):0;i.kind==="camera"?o=Vt(i.minSize,i.maxSize,m):r=m}return{uSizeT:r,uSize:o}},a.evaluateVariableOffset=th,a.evented=Fs,a.exported=Kt,a.exported$1=kr,a.extend=Se,a.filterObject=Qe,a.fromRotation=function(i,e){var r=Math.sin(e),o=Math.cos(e);return i[0]=o,i[1]=r,i[2]=0,i[3]=-r,i[4]=o,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i},a.fromScaling=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},a.getAnchorAlignment=gc,a.getAnchorJustification=yc,a.getArrayBuffer=vn,a.getImage=Fr,a.getJSON=function(i,e){return xn(Se(i,{type:"json"}),e)},a.getOverlapMode=Tc,a.getRTLTextPluginStatus=go,a.getReferrer=jn,a.getVideo=function(i,e){const r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let o=0;o<i.length;o++){const c=window.document.createElement("source");Xn(i[o])||(r.crossOrigin="Anonymous"),c.src=i[o],r.appendChild(c)}return{cancel:()=>{}}},a.identity=Ql,a.invert=function(i,e){var r=e[0],o=e[1],c=e[2],h=e[3],d=e[4],m=e[5],g=e[6],x=e[7],T=e[8],S=e[9],P=e[10],k=e[11],L=e[12],Z=e[13],q=e[14],re=e[15],ce=r*m-o*d,ee=r*g-c*d,ae=r*x-h*d,xe=o*g-c*m,ye=o*x-h*m,Ue=c*x-h*g,Ne=T*Z-S*L,Le=T*q-P*L,Me=T*re-k*L,Ee=S*q-P*Z,Re=S*re-k*Z,ze=P*re-k*q,Te=ce*ze-ee*Re+ae*Ee+xe*Me-ye*Le+Ue*Ne;return Te?(i[0]=(m*ze-g*Re+x*Ee)*(Te=1/Te),i[1]=(c*Re-o*ze-h*Ee)*Te,i[2]=(Z*Ue-q*ye+re*xe)*Te,i[3]=(P*ye-S*Ue-k*xe)*Te,i[4]=(g*Me-d*ze-x*Le)*Te,i[5]=(r*ze-c*Me+h*Le)*Te,i[6]=(q*ae-L*Ue-re*ee)*Te,i[7]=(T*Ue-P*ae+k*ee)*Te,i[8]=(d*Re-m*Me+x*Ne)*Te,i[9]=(o*Me-r*Re-h*Ne)*Te,i[10]=(L*ye-Z*ae+re*ce)*Te,i[11]=(S*ae-T*ye-k*ce)*Te,i[12]=(m*Le-d*Ee-g*Ne)*Te,i[13]=(r*Ee-o*Le+c*Ne)*Te,i[14]=(Z*ee-L*xe-q*ce)*Te,i[15]=(T*xe-S*ee+P*ce)*Te,i):null},a.isImageBitmap=Ht,a.isSafari=ei,a.isWorker=gt,a.keysDifference=function(i,e){const r=[];for(const o in i)o in e||r.push(o);return r},a.lazyLoadRTLTextPlugin=function(){Yi.isLoading()||Yi.isLoaded()||go()!=="deferred"||ja()},a.makeRequest=xn,a.mapObject=tt,a.mercatorXfromLng=lh,a.mercatorYfromLat=ch,a.mercatorZfromAltitude=uh,a.mul=Np,a.mul$1=function(i,e,r){return i[0]=e[0]*r[0],i[1]=e[1]*r[1],i[2]=e[2]*r[2],i[3]=e[3]*r[3],i},a.multiply=hu,a.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},a.normalize=function(i,e){var r=e[0],o=e[1],c=e[2],h=r*r+o*o+c*c;return h>0&&(h=1/Math.sqrt(h)),i[0]=e[0]*h,i[1]=e[1]*h,i[2]=e[2]*h,i},a.number=Vt,a.ortho=function(i,e,r,o,c,h,d){var m=1/(e-r),g=1/(o-c),x=1/(h-d);return i[0]=-2*m,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*g,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*x,i[11]=0,i[12]=(e+r)*m,i[13]=(c+o)*g,i[14]=(d+h)*x,i[15]=1,i},a.parseCacheControl=xi,a.parseGlyphPbf=function(i){return new pc(i).readFields(Nd,[])},a.pbf=pc,a.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=si/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0].layout,r=i.bucket.layers[0]._unevaluatedLayout._values,o={layoutIconSize:r["icon-size"].possiblyEvaluate(new Gt(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Gt(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Gt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.textSizeData;o.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Gt(g),i.canonical),r["text-size"].possiblyEvaluate(new Gt(x),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.iconSizeData;o.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Gt(g),i.canonical),r["icon-size"].possiblyEvaluate(new Gt(x),i.canonical)]}const c=e.get("text-line-height")*yi,h=e.get("text-rotation-alignment")!=="viewport"&&e.get("symbol-placement")!=="point",d=e.get("text-keep-upright"),m=e.get("text-size");for(const g of i.bucket.features){const x=e.get("text-font").evaluate(g,{},i.canonical).join(","),T=m.evaluate(g,{},i.canonical),S=o.layoutTextSize.evaluate(g,{},i.canonical),P=o.layoutIconSize.evaluate(g,{},i.canonical),k={horizontal:{},vertical:void 0},L=g.text;let Z,q=[0,0];if(L){const ee=L.toString(),ae=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*yi,xe=Zl(ee)?ae:0,ye=e.get("text-anchor").evaluate(g,{},i.canonical),Ue=e.get("text-variable-anchor");if(!Ue){const Re=e.get("text-radial-offset").evaluate(g,{},i.canonical);q=Re?th(ye,[Re*yi,_c]):e.get("text-offset").evaluate(g,{},i.canonical).map(ze=>ze*yi)}let Ne=h?"center":e.get("text-justify").evaluate(g,{},i.canonical);const Le=e.get("symbol-placement"),Me=Le==="point"?e.get("text-max-width").evaluate(g,{},i.canonical)*yi:0,Ee=()=>{i.bucket.allowVerticalPlacement&&qo(ee)&&(k.vertical=cl(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Me,c,ye,"left",xe,q,a.WritingMode.vertical,!0,Le,S,T))};if(!h&&Ue){const Re=Ne==="auto"?Ue.map(Te=>yc(Te)):[Ne];let ze=!1;for(let Te=0;Te<Re.length;Te++){const We=Re[Te];if(!k.horizontal[We])if(ze)k.horizontal[We]=k.horizontal[0];else{const je=cl(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Me,c,"center",We,xe,q,a.WritingMode.horizontal,!1,Le,S,T);je&&(k.horizontal[We]=je,ze=je.positionedLines.length===1)}}Ee()}else{Ne==="auto"&&(Ne=yc(ye));const Re=cl(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Me,c,ye,Ne,xe,q,a.WritingMode.horizontal,!1,Le,S,T);Re&&(k.horizontal[Ne]=Re),Ee(),qo(ee)&&h&&d&&(k.vertical=cl(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Me,c,ye,Ne,xe,q,a.WritingMode.vertical,!1,Le,S,T))}}let re=!1;if(g.icon&&g.icon.name){const ee=i.imageMap[g.icon.name];ee&&(Z=Wd(i.imagePositions[g.icon.name],e.get("icon-offset").evaluate(g,{},i.canonical),e.get("icon-anchor").evaluate(g,{},i.canonical)),re=!!ee.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=re:i.bucket.sdfIcons!==re&&ht("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ee.pixelRatio!==i.bucket.pixelRatio||e.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const ce=rh(k.horizontal)||k.vertical;i.bucket.iconsInText=!!ce&&ce.iconsInText,(ce||Z)&&tf(i.bucket,g,k,Z,i.imageMap,o,S,P,q,re,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},a.perspective=function(i,e,r,o,c){var h,d=1/Math.tan(e/2);return i[0]=d/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,c!=null&&c!==1/0?(i[10]=(c+o)*(h=1/(o-c)),i[14]=2*c*o*h):(i[10]=-1,i[14]=-2*o),i},a.pick=function(i,e){const r={};for(let o=0;o<e.length;o++){const c=e[o];c in i&&(r[c]=i[c])}return r},a.plugin=Yi,a.pointGeometry=He,a.polygonIntersectsPolygon=su,a.potpack=Uu,a.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],a.register=$e,a.registerForPluginStateChange=function(i){return i({pluginStatus:Ri,pluginURL:Nr}),Fs.on("pluginStateChange",i),i},a.renderColorRamp=yu,a.rotateX=function(i,e,r){var o=Math.sin(r),c=Math.cos(r),h=e[4],d=e[5],m=e[6],g=e[7],x=e[8],T=e[9],S=e[10],P=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=h*c+x*o,i[5]=d*c+T*o,i[6]=m*c+S*o,i[7]=g*c+P*o,i[8]=x*c-h*o,i[9]=T*c-d*o,i[10]=S*c-m*o,i[11]=P*c-g*o,i},a.rotateZ=function(i,e,r){var o=Math.sin(r),c=Math.cos(r),h=e[0],d=e[1],m=e[2],g=e[3],x=e[4],T=e[5],S=e[6],P=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=h*c+x*o,i[1]=d*c+T*o,i[2]=m*c+S*o,i[3]=g*c+P*o,i[4]=x*c-h*o,i[5]=T*c-d*o,i[6]=S*c-m*o,i[7]=P*c-g*o,i},a.scale=function(i,e,r){var o=r[0],c=r[1],h=r[2];return i[0]=e[0]*o,i[1]=e[1]*o,i[2]=e[2]*o,i[3]=e[3]*o,i[4]=e[4]*c,i[5]=e[5]*c,i[6]=e[6]*c,i[7]=e[7]*c,i[8]=e[8]*h,i[9]=e[9]*h,i[10]=e[10]*h,i[11]=e[11]*h,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},a.scale$1=function(i,e,r){return i[0]=e[0]*r,i[1]=e[1]*r,i[2]=e[2]*r,i},a.setCacheLimits=function(i,e){mn=i,gn=e},a.setRTLTextPlugin=function(i,e,r=!1){if(Ri===Ds||Ri===Ls||Ri===Rs)throw new Error("setRTLTextPlugin cannot be called multiple times.");Nr=Kt.resolveURL(i),Ri=Ds,Bs=e,Rn(),r||ja()},a.spec=_e,a.sphericalToCartesian=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}},a.sqrLen=function(i){var e=i[0],r=i[1];return e*e+r*r},a.sub=function(i,e,r){return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],i},a.toEvaluationFeature=bo,a.transformMat3=function(i,e,r){var o=e[0],c=e[1],h=e[2];return i[0]=o*r[0]+c*r[3]+h*r[6],i[1]=o*r[1]+c*r[4]+h*r[7],i[2]=o*r[2]+c*r[5]+h*r[8],i},a.transformMat4=tl,a.transformMat4$1=function(i,e,r){var o=e[0],c=e[1];return i[0]=r[0]*o+r[4]*c+r[12],i[1]=r[1]*o+r[5]*c+r[13],i},a.translate=function(i,e,r){var o,c,h,d,m,g,x,T,S,P,k,L,Z=r[0],q=r[1],re=r[2];return e===i?(i[12]=e[0]*Z+e[4]*q+e[8]*re+e[12],i[13]=e[1]*Z+e[5]*q+e[9]*re+e[13],i[14]=e[2]*Z+e[6]*q+e[10]*re+e[14],i[15]=e[3]*Z+e[7]*q+e[11]*re+e[15]):(c=e[1],h=e[2],d=e[3],m=e[4],g=e[5],x=e[6],T=e[7],S=e[8],P=e[9],k=e[10],L=e[11],i[0]=o=e[0],i[1]=c,i[2]=h,i[3]=d,i[4]=m,i[5]=g,i[6]=x,i[7]=T,i[8]=S,i[9]=P,i[10]=k,i[11]=L,i[12]=o*Z+m*q+S*re+e[12],i[13]=c*Z+g*q+P*re+e[13],i[14]=h*Z+x*q+k*re+e[14],i[15]=d*Z+T*q+L*re+e[15]),i},a.triggerPluginCompletionEvent=Za,a.unicodeBlockLookup=De,a.uniqueId=function(){return Ie++},a.validateCustomStyleLayer=function(i){const e=[],r=i.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},a.validateLight=Ms,a.validateStyle=fo,a.vectorTile=Un,a.warnOnce=ht,a.wrap=ke}),G(["./shared"],function(a){function Y(O){const w=typeof O;if(w==="number"||w==="boolean"||w==="string"||O==null)return JSON.stringify(O);if(Array.isArray(O)){let F="[";for(const j of O)F+=`${Y(j)},`;return`${F}]`}const I=Object.keys(O).sort();let R="{";for(let F=0;F<I.length;F++)R+=`${JSON.stringify(I[F])}:${Y(O[I[F]])},`;return`${R}}`}function ie(O){let w="";for(const I of a.refProperties)w+=`/${Y(O[I])}`;return w}class pe{constructor(w){this.keyCache={},w&&this.replace(w)}replace(w){this._layerConfigs={},this._layers={},this.update(w,[])}update(w,I){for(const F of w){this._layerConfigs[F.id]=F;const j=this._layers[F.id]=a.createStyleLayer(F);j._featureFilter=a.createFilter(j.filter),this.keyCache[F.id]&&delete this.keyCache[F.id]}for(const F of I)delete this.keyCache[F],delete this._layerConfigs[F],delete this._layers[F];this.familiesBySource={};const R=function(F,j){const K={};for(let X=0;X<F.length;X++){const J=j&&j[F[X].id]||ie(F[X]);j&&(j[F[X].id]=J);let de=K[J];de||(de=K[J]=[]),de.push(F[X])}const W=[];for(const X in K)W.push(K[X]);return W}(Object.values(this._layerConfigs),this.keyCache);for(const F of R){const j=F.map(be=>this._layers[be.id]),K=j[0];if(K.visibility==="none")continue;const W=K.source||"";let X=this.familiesBySource[W];X||(X=this.familiesBySource[W]={});const J=K.sourceLayer||"_geojsonTileLayer";let de=X[J];de||(de=X[J]=[]),de.push(j)}}}class ue{constructor(w){const I={},R=[];for(const W in w){const X=w[W],J=I[W]={};for(const de in X){const be=X[+de];if(!be||be.bitmap.width===0||be.bitmap.height===0)continue;const he={x:0,y:0,w:be.bitmap.width+2,h:be.bitmap.height+2};R.push(he),J[de]={rect:he,metrics:be.metrics}}}const{w:F,h:j}=a.potpack(R),K=new a.AlphaImage({width:F||1,height:j||1});for(const W in w){const X=w[W];for(const J in X){const de=X[+J];if(!de||de.bitmap.width===0||de.bitmap.height===0)continue;const be=I[W][J].rect;a.AlphaImage.copy(de.bitmap,K,{x:0,y:0},{x:be.x+1,y:be.y+1},de.bitmap)}}this.image=K,this.positions=I}}a.register("GlyphAtlas",ue);class te{constructor(w){this.tileID=new a.OverscaledTileID(w.tileID.overscaledZ,w.tileID.wrap,w.tileID.canonical.z,w.tileID.canonical.x,w.tileID.canonical.y),this.uid=w.uid,this.zoom=w.zoom,this.pixelRatio=w.pixelRatio,this.tileSize=w.tileSize,this.source=w.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=w.showCollisionBoxes,this.collectResourceTiming=!!w.collectResourceTiming,this.returnDependencies=!!w.returnDependencies,this.promoteId=w.promoteId}parse(w,I,R,F,j){this.status="parsing",this.data=w,this.collisionBoxArray=new a.CollisionBoxArray;const K=new a.DictionaryCoder(Object.keys(w.layers).sort()),W=new a.FeatureIndex(this.tileID,this.promoteId);W.bucketLayerIDs=[];const X={},J={featureIndex:W,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:R},de=I.familiesBySource[this.source];for(const it in de){const lt=w.layers[it];if(!lt)continue;lt.version===1&&a.warnOnce(`Vector tile source "${this.source}" layer "${it}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Tt=K.encode(it),Lt=[];for(let ci=0;ci<lt.length;ci++){const $t=lt.feature(ci),bi=W.getId($t,it);Lt.push({feature:$t,id:bi,index:ci,sourceLayerIndex:Tt})}for(const ci of de[it]){const $t=ci[0];$t.source!==this.source&&a.warnOnce(`layer.source = ${$t.source} does not equal this.source = ${this.source}`),$t.minzoom&&this.zoom<Math.floor($t.minzoom)||$t.maxzoom&&this.zoom>=$t.maxzoom||$t.visibility!=="none"&&(ke(ci,this.zoom,R),(X[$t.id]=$t.createBucket({index:W.bucketLayerIDs.length,layers:ci,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Tt,sourceID:this.source})).populate(Lt,J,this.tileID.canonical),W.bucketLayerIDs.push(ci.map(bi=>bi.id)))}}let be,he,Ve,Ge;const Be=a.mapObject(J.glyphDependencies,it=>Object.keys(it).map(Number));Object.keys(Be).length?F.send("getGlyphs",{uid:this.uid,stacks:Be},(it,lt)=>{be||(be=it,he=lt,wt.call(this))}):he={};const Ke=Object.keys(J.iconDependencies);Ke.length?F.send("getImages",{icons:Ke,source:this.source,tileID:this.tileID,type:"icons"},(it,lt)=>{be||(be=it,Ve=lt,wt.call(this))}):Ve={};const et=Object.keys(J.patternDependencies);function wt(){if(be)return j(be);if(he&&Ve&&Ge){const it=new ue(he),lt=new a.ImageAtlas(Ve,Ge);for(const Tt in X){const Lt=X[Tt];Lt instanceof a.SymbolBucket?(ke(Lt.layers,this.zoom,R),a.performSymbolLayout({bucket:Lt,glyphMap:he,glyphPositions:it.positions,imageMap:Ve,imagePositions:lt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Lt.hasPattern&&(Lt instanceof a.LineBucket||Lt instanceof a.FillBucket||Lt instanceof a.FillExtrusionBucket)&&(ke(Lt.layers,this.zoom,R),Lt.addFeatures(J,this.tileID.canonical,lt.patternPositions))}this.status="done",j(null,{buckets:Object.values(X).filter(Tt=>!Tt.isEmpty()),featureIndex:W,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:it.image,imageAtlas:lt,glyphMap:this.returnDependencies?he:null,iconMap:this.returnDependencies?Ve:null,glyphPositions:this.returnDependencies?it.positions:null})}}et.length?F.send("getImages",{icons:et,source:this.source,tileID:this.tileID,type:"patterns"},(it,lt)=>{be||(be=it,Ge=lt,wt.call(this))}):Ge={},wt.call(this)}}function ke(O,w,I){const R=new a.EvaluationParameters(w);for(const F of O)F.recalculate(R,I)}function Se(O,w){const I=a.getArrayBuffer(O.request,(R,F,j,K)=>{R?w(R):F&&w(null,{vectorTile:new a.vectorTile.VectorTile(new a.pbf(F)),rawData:F,cacheControl:j,expires:K})});return()=>{I.cancel(),w()}}class Ie{constructor(w,I,R,F){this.actor=w,this.layerIndex=I,this.availableImages=R,this.loadVectorData=F||Se,this.loading={},this.loaded={}}loadTile(w,I){const R=w.uid;this.loading||(this.loading={});const F=!!(w&&w.request&&w.request.collectResourceTiming)&&new a.RequestPerformance(w.request),j=this.loading[R]=new te(w);j.abort=this.loadVectorData(w,(K,W)=>{if(delete this.loading[R],K||!W)return j.status="done",this.loaded[R]=j,I(K);const X=W.rawData,J={};W.expires&&(J.expires=W.expires),W.cacheControl&&(J.cacheControl=W.cacheControl);const de={};if(F){const be=F.finish();be&&(de.resourceTiming=JSON.parse(JSON.stringify(be)))}j.vectorTile=W.vectorTile,j.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor,(be,he)=>{if(be||!he)return I(be);I(null,a.extend({rawTileData:X.slice(0)},he,J,de))}),this.loaded=this.loaded||{},this.loaded[R]=j})}reloadTile(w,I){const R=this.loaded,F=w.uid,j=this;if(R&&R[F]){const K=R[F];K.showCollisionBoxes=w.showCollisionBoxes;const W=(X,J)=>{const de=K.reloadCallback;de&&(delete K.reloadCallback,K.parse(K.vectorTile,j.layerIndex,this.availableImages,j.actor,de)),I(X,J)};K.status==="parsing"?K.reloadCallback=W:K.status==="done"&&(K.vectorTile?K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor,W):W())}}abortTile(w,I){const R=this.loading,F=w.uid;R&&R[F]&&R[F].abort&&(R[F].abort(),delete R[F]),I()}removeTile(w,I){const R=this.loaded,F=w.uid;R&&R[F]&&delete R[F],I()}}class Ye{constructor(){this.loaded={}}loadTile(w,I){const{uid:R,encoding:F,rawImageData:j}=w,K=a.isImageBitmap(j)?this.getImageData(j):j,W=new a.DEMData(R,K,F);this.loaded=this.loaded||{},this.loaded[R]=W,I(null,W)}getImageData(w){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(w.width,w.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=w.width,this.offscreenCanvas.height=w.height,this.offscreenCanvasContext.drawImage(w,0,0,w.width,w.height);const I=this.offscreenCanvasContext.getImageData(-1,-1,w.width+2,w.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new a.RGBAImage({width:I.width,height:I.height},I.data)}removeTile(w){const I=this.loaded,R=w.uid;I&&I[R]&&delete I[R]}}var tt=function O(w,I){var R,F=w&&w.type;if(F==="FeatureCollection")for(R=0;R<w.features.length;R++)O(w.features[R],I);else if(F==="GeometryCollection")for(R=0;R<w.geometries.length;R++)O(w.geometries[R],I);else if(F==="Feature")O(w.geometry,I);else if(F==="Polygon")Qe(w.coordinates,I);else if(F==="MultiPolygon")for(R=0;R<w.coordinates.length;R++)Qe(w.coordinates[R],I);return w};function Qe(O,w){if(O.length!==0){dt(O[0],w);for(var I=1;I<O.length;I++)dt(O[I],!w)}}function dt(O,w){for(var I=0,R=0,F=0,j=O.length,K=j-1;F<j;K=F++){var W=(O[F][0]-O[K][0])*(O[K][1]+O[F][1]),X=I+W;R+=Math.abs(I)>=Math.abs(W)?I-X+W:W-X+I,I=X}I+R>=0!=!!w&&O.reverse()}const It=a.vectorTile.VectorTileFeature.prototype.toGeoJSON;class ht{constructor(w){this._feature=w,this.extent=a.EXTENT,this.type=w.type,this.properties=w.tags,"id"in w&&!isNaN(w.id)&&(this.id=parseInt(w.id,10))}loadGeometry(){if(this._feature.type===1){const w=[];for(const I of this._feature.geometry)w.push([new a.pointGeometry(I[0],I[1])]);return w}{const w=[];for(const I of this._feature.geometry){const R=[];for(const F of I)R.push(new a.pointGeometry(F[0],F[1]));w.push(R)}return w}}toGeoJSON(w,I,R){return It.call(this,w,I,R)}}class xt{constructor(w){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.EXTENT,this.length=w.length,this._features=w}feature(w){return new ht(this._features[w])}}var Xt={exports:{}},gt=a.pointGeometry,xi=a.vectorTile.VectorTileFeature,zi=_t;function _t(O,w){this.options=w||{},this.features=O,this.length=O.length}function Wt(O,w){this.id=typeof O.id=="number"?O.id:void 0,this.type=O.type,this.rawGeometry=O.type===1?[O.geometry]:O.geometry,this.properties=O.tags,this.extent=w||4096}_t.prototype.feature=function(O){return new Wt(this.features[O],this.options.extent)},Wt.prototype.loadGeometry=function(){var O=this.rawGeometry;this.geometry=[];for(var w=0;w<O.length;w++){for(var I=O[w],R=[],F=0;F<I.length;F++)R.push(new gt(I[F][0],I[F][1]));this.geometry.push(R)}return this.geometry},Wt.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var O=this.geometry,w=1/0,I=-1/0,R=1/0,F=-1/0,j=0;j<O.length;j++)for(var K=O[j],W=0;W<K.length;W++){var X=K[W];w=Math.min(w,X.x),I=Math.max(I,X.x),R=Math.min(R,X.y),F=Math.max(F,X.y)}return[w,R,I,F]},Wt.prototype.toGeoJSON=xi.prototype.toGeoJSON;var ei=a.pbf,Ht=zi;function Kt(O){var w=new ei;return function(I,R){for(var F in I.layers)R.writeMessage(3,He,I.layers[F])}(O,w),w.finish()}function He(O,w){var I;w.writeVarintField(15,O.version||1),w.writeStringField(1,O.name||""),w.writeVarintField(5,O.extent||4096);var R={keys:[],values:[],keycache:{},valuecache:{}};for(I=0;I<O.length;I++)R.feature=O.feature(I),w.writeMessage(2,vi,R);var F=R.keys;for(I=0;I<F.length;I++)w.writeStringField(3,F[I]);var j=R.values;for(I=0;I<j.length;I++)w.writeMessage(4,mn,j[I])}function vi(O,w){var I=O.feature;I.id!==void 0&&w.writeVarintField(1,I.id),w.writeMessage(2,ki,O),w.writeVarintField(3,I.type),w.writeMessage(4,Hr,I)}function ki(O,w){var I=O.feature,R=O.keys,F=O.values,j=O.keycache,K=O.valuecache;for(var W in I.properties){var X=I.properties[W],J=j[W];if(X!==null){J===void 0&&(R.push(W),j[W]=J=R.length-1),w.writeVarint(J);var de=typeof X;de!=="string"&&de!=="boolean"&&de!=="number"&&(X=JSON.stringify(X));var be=de+":"+X,he=K[be];he===void 0&&(F.push(X),K[be]=he=F.length-1),w.writeVarint(he)}}}function Ii(O,w){return(w<<3)+(7&O)}function Di(O){return O<<1^O>>31}function Hr(O,w){for(var I=O.loadGeometry(),R=O.type,F=0,j=0,K=I.length,W=0;W<K;W++){var X=I[W],J=1;R===1&&(J=X.length),w.writeVarint(Ii(1,J));for(var de=R===3?X.length-1:X.length,be=0;be<de;be++){be===1&&R!==1&&w.writeVarint(Ii(2,de-1));var he=X[be].x-F,Ve=X[be].y-j;w.writeVarint(Di(he)),w.writeVarint(Di(Ve)),F+=he,j+=Ve}R===3&&w.writeVarint(Ii(7,1))}}function mn(O,w){var I=typeof O;I==="string"?w.writeStringField(1,O):I==="boolean"?w.writeBooleanField(7,O):I==="number"&&(O%1!=0?w.writeDoubleField(3,O):O<0?w.writeSVarintField(6,O):w.writeVarintField(5,O))}function gn(O,w,I,R,F,j){if(F-R<=I)return;const K=R+F>>1;_n(O,w,K,R,F,j%2),gn(O,w,I,R,K-1,j+1),gn(O,w,I,K+1,F,j+1)}function _n(O,w,I,R,F,j){for(;F>R;){if(F-R>600){const J=F-R+1,de=I-R+1,be=Math.log(J),he=.5*Math.exp(2*be/3),Ve=.5*Math.sqrt(be*he*(J-he)/J)*(de-J/2<0?-1:1);_n(O,w,I,Math.max(R,Math.floor(I-de*he/J+Ve)),Math.min(F,Math.floor(I+(J-de)*he/J+Ve)),j)}const K=w[2*I+j];let W=R,X=F;for(ur(O,w,R,I),w[2*F+j]>K&&ur(O,w,R,F);W<X;){for(ur(O,w,W,X),W++,X--;w[2*W+j]<K;)W++;for(;w[2*X+j]>K;)X--}w[2*R+j]===K?ur(O,w,R,X):(X++,ur(O,w,X,F)),X<=I&&(R=X+1),I<=X&&(F=X-1)}}function ur(O,w,I,R){kr(O,I,R),kr(w,2*I,2*R),kr(w,2*I+1,2*R+1)}function kr(O,w,I){const R=O[w];O[w]=O[I],O[I]=R}function Dr(O,w,I,R){const F=O-I,j=w-R;return F*F+j*j}Xt.exports=Kt,Xt.exports.fromVectorTileJs=Kt,Xt.exports.fromGeojsonVt=function(O,w){w=w||{};var I={};for(var R in O)I[R]=new Ht(O[R].features,w),I[R].name=R,I[R].version=w.version,I[R].extent=w.extent;return Kt({layers:I})},Xt.exports.GeoJSONWrapper=Ht;const Lr=O=>O[0],Li=O=>O[1];class yn{constructor(w,I=Lr,R=Li,F=64,j=Float64Array){this.nodeSize=F,this.points=w;const K=w.length<65536?Uint16Array:Uint32Array,W=this.ids=new K(w.length),X=this.coords=new j(2*w.length);for(let J=0;J<w.length;J++)W[J]=J,X[2*J]=I(w[J]),X[2*J+1]=R(w[J]);gn(W,X,F,0,W.length-1,0)}range(w,I,R,F){return function(j,K,W,X,J,de,be){const he=[0,j.length-1,0],Ve=[];let Ge,Be;for(;he.length;){const Ke=he.pop(),et=he.pop(),wt=he.pop();if(et-wt<=be){for(let Tt=wt;Tt<=et;Tt++)Ge=K[2*Tt],Be=K[2*Tt+1],Ge>=W&&Ge<=J&&Be>=X&&Be<=de&&Ve.push(j[Tt]);continue}const it=Math.floor((wt+et)/2);Ge=K[2*it],Be=K[2*it+1],Ge>=W&&Ge<=J&&Be>=X&&Be<=de&&Ve.push(j[it]);const lt=(Ke+1)%2;(Ke===0?W<=Ge:X<=Be)&&(he.push(wt),he.push(it-1),he.push(lt)),(Ke===0?J>=Ge:de>=Be)&&(he.push(it+1),he.push(et),he.push(lt))}return Ve}(this.ids,this.coords,w,I,R,F,this.nodeSize)}within(w,I,R){return function(F,j,K,W,X,J){const de=[0,F.length-1,0],be=[],he=X*X;for(;de.length;){const Ve=de.pop(),Ge=de.pop(),Be=de.pop();if(Ge-Be<=J){for(let lt=Be;lt<=Ge;lt++)Dr(j[2*lt],j[2*lt+1],K,W)<=he&&be.push(F[lt]);continue}const Ke=Math.floor((Be+Ge)/2),et=j[2*Ke],wt=j[2*Ke+1];Dr(et,wt,K,W)<=he&&be.push(F[Ke]);const it=(Ve+1)%2;(Ve===0?K-X<=et:W-X<=wt)&&(de.push(Be),de.push(Ke-1),de.push(it)),(Ve===0?K+X>=et:W+X>=wt)&&(de.push(Ke+1),de.push(Ge),de.push(it))}return be}(this.ids,this.coords,w,I,R,this.nodeSize)}}const Zn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:O=>O},vr=Math.fround||($i=new Float32Array(1),O=>($i[0]=+O,$i[0]));var $i;class jn{constructor(w){this.options=Fr(Object.create(Zn),w),this.trees=new Array(this.options.maxZoom+1)}load(w){const{log:I,minZoom:R,maxZoom:F,nodeSize:j}=this.options;I&&console.time("total time");const K=`prepare ${w.length} points`;I&&console.time(K),this.points=w;let W=[];for(let X=0;X<w.length;X++)w[X].geometry&&W.push(xn(w[X],X));this.trees[F+1]=new yn(W,Wn,br,j,Float32Array),I&&console.timeEnd(K);for(let X=F;X>=R;X--){const J=+Date.now();W=this._cluster(W,X),this.trees[X]=new yn(W,Wn,br,j,Float32Array),I&&console.log("z%d: %d clusters in %dms",X,W.length,+Date.now()-J)}return I&&console.timeEnd("total time"),this}getClusters(w,I){let R=((w[0]+180)%360+360)%360-180;const F=Math.max(-90,Math.min(90,w[1]));let j=w[2]===180?180:((w[2]+180)%360+360)%360-180;const K=Math.max(-90,Math.min(90,w[3]));if(w[2]-w[0]>=360)R=-180,j=180;else if(R>j){const de=this.getClusters([R,F,180,K],I),be=this.getClusters([-180,F,j,K],I);return de.concat(be)}const W=this.trees[this._limitZoom(I)],X=W.range(vt(R),hr(K),vt(j),hr(F)),J=[];for(const de of X){const be=W.points[de];J.push(be.numPoints?vn(be):this.points[be.index])}return J}getChildren(w){const I=this._getOriginId(w),R=this._getOriginZoom(w),F="No cluster with the specified id.",j=this.trees[R];if(!j)throw new Error(F);const K=j.points[I];if(!K)throw new Error(F);const W=this.options.radius/(this.options.extent*Math.pow(2,R-1)),X=j.within(K.x,K.y,W),J=[];for(const de of X){const be=j.points[de];be.parentId===w&&J.push(be.numPoints?vn(be):this.points[be.index])}if(J.length===0)throw new Error(F);return J}getLeaves(w,I,R){const F=[];return this._appendLeaves(F,w,I=I||10,R=R||0,0),F}getTile(w,I,R){const F=this.trees[this._limitZoom(w)],j=Math.pow(2,w),{extent:K,radius:W}=this.options,X=W/K,J=(R-X)/j,de=(R+1+X)/j,be={features:[]};return this._addTileFeatures(F.range((I-X)/j,J,(I+1+X)/j,de),F.points,I,R,j,be),I===0&&this._addTileFeatures(F.range(1-X/j,J,1,de),F.points,j,R,j,be),I===j-1&&this._addTileFeatures(F.range(0,J,X/j,de),F.points,-1,R,j,be),be.features.length?be:null}getClusterExpansionZoom(w){let I=this._getOriginZoom(w)-1;for(;I<=this.options.maxZoom;){const R=this.getChildren(w);if(I++,R.length!==1)break;w=R[0].properties.cluster_id}return I}_appendLeaves(w,I,R,F,j){const K=this.getChildren(I);for(const W of K){const X=W.properties;if(X&&X.cluster?j+X.point_count<=F?j+=X.point_count:j=this._appendLeaves(w,X.cluster_id,R,F,j):j<F?j++:w.push(W),w.length===R)break}return j}_addTileFeatures(w,I,R,F,j,K){for(const W of w){const X=I[W],J=X.numPoints;let de,be,he;if(J)de=Xn(X),be=X.x,he=X.y;else{const Be=this.points[X.index];de=Be.properties,be=vt(Be.geometry.coordinates[0]),he=hr(Be.geometry.coordinates[1])}const Ve={type:1,geometry:[[Math.round(this.options.extent*(be*j-R)),Math.round(this.options.extent*(he*j-F))]],tags:de};let Ge;J?Ge=X.id:this.options.generateId?Ge=X.index:this.points[X.index].id&&(Ge=this.points[X.index].id),Ge!==void 0&&(Ve.id=Ge),K.features.push(Ve)}}_limitZoom(w){return Math.max(this.options.minZoom,Math.min(Math.floor(+w),this.options.maxZoom+1))}_cluster(w,I){const R=[],{radius:F,extent:j,reduce:K,minPoints:W}=this.options,X=F/(j*Math.pow(2,I));for(let J=0;J<w.length;J++){const de=w[J];if(de.zoom<=I)continue;de.zoom=I;const be=this.trees[I+1],he=be.within(de.x,de.y,X),Ve=de.numPoints||1;let Ge=Ve;for(const Be of he){const Ke=be.points[Be];Ke.zoom>I&&(Ge+=Ke.numPoints||1)}if(Ge>Ve&&Ge>=W){let Be=de.x*Ve,Ke=de.y*Ve,et=K&&Ve>1?this._map(de,!0):null;const wt=(J<<5)+(I+1)+this.points.length;for(const it of he){const lt=be.points[it];if(lt.zoom<=I)continue;lt.zoom=I;const Tt=lt.numPoints||1;Be+=lt.x*Tt,Ke+=lt.y*Tt,lt.parentId=wt,K&&(et||(et=this._map(de,!0)),K(et,this._map(lt)))}de.parentId=wt,R.push(Rr(Be/Ge,Ke/Ge,wt,Ge,et))}else if(R.push(de),Ge>1)for(const Be of he){const Ke=be.points[Be];Ke.zoom<=I||(Ke.zoom=I,R.push(Ke))}}return R}_getOriginId(w){return w-this.points.length>>5}_getOriginZoom(w){return(w-this.points.length)%32}_map(w,I){if(w.numPoints)return I?Fr({},w.properties):w.properties;const R=this.points[w.index].properties,F=this.options.map(R);return I&&F===R?Fr({},F):F}}function Rr(O,w,I,R,F){return{x:vr(O),y:vr(w),zoom:1/0,id:I,parentId:-1,numPoints:R,properties:F}}function xn(O,w){const[I,R]=O.geometry.coordinates;return{x:vr(vt(I)),y:vr(hr(R)),zoom:1/0,index:w,parentId:-1}}function vn(O){return{type:"Feature",id:O.id,properties:Xn(O),geometry:{type:"Point",coordinates:[(w=O.x,360*(w-.5)),Br(O.y)]}};var w}function Xn(O){const w=O.numPoints,I=w>=1e4?`${Math.round(w/1e3)}k`:w>=1e3?Math.round(w/100)/10+"k":w;return Fr(Fr({},O.properties),{cluster:!0,cluster_id:O.id,point_count:w,point_count_abbreviated:I})}function vt(O){return O/360+.5}function hr(O){const w=Math.sin(O*Math.PI/180),I=.5-.25*Math.log((1+w)/(1-w))/Math.PI;return I<0?0:I>1?1:I}function Br(O){const w=(180-360*O)*Math.PI/180;return 360*Math.atan(Math.exp(w))/Math.PI-90}function Fr(O,w){for(const I in w)O[I]=w[I];return O}function Wn(O){return O.x}function br(O){return O.y}function wr(O,w,I,R){for(var F,j=R,K=I-w>>1,W=I-w,X=O[w],J=O[w+1],de=O[I],be=O[I+1],he=w+3;he<I;he+=3){var Ve=bn(O[he],O[he+1],X,J,de,be);if(Ve>j)F=he,j=Ve;else if(Ve===j){var Ge=Math.abs(he-K);Ge<W&&(F=he,W=Ge)}}j>R&&(F-w>3&&wr(O,w,F,R),O[F+2]=j,I-F>3&&wr(O,F,I,R))}function bn(O,w,I,R,F,j){var K=F-I,W=j-R;if(K!==0||W!==0){var X=((O-I)*K+(w-R)*W)/(K*K+W*W);X>1?(I=F,R=j):X>0&&(I+=K*X,R+=W*X)}return(K=O-I)*K+(W=w-R)*W}function Tr(O,w,I,R){var F={id:O===void 0?null:O,type:w,geometry:I,tags:R,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(j){var K=j.geometry,W=j.type;if(W==="Point"||W==="MultiPoint"||W==="LineString")_e(j,K);else if(W==="Polygon"||W==="MultiLineString")for(var X=0;X<K.length;X++)_e(j,K[X]);else if(W==="MultiPolygon")for(X=0;X<K.length;X++)for(var J=0;J<K[X].length;J++)_e(j,K[X][J])}(F),F}function _e(O,w){for(var I=0;I<w.length;I+=3)O.minX=Math.min(O.minX,w[I]),O.minY=Math.min(O.minY,w[I+1]),O.maxX=Math.max(O.maxX,w[I]),O.maxY=Math.max(O.maxY,w[I+1])}function Pe(O,w,I,R){if(w.geometry){var F=w.geometry.coordinates,j=w.geometry.type,K=Math.pow(I.tolerance/((1<<I.maxZoom)*I.extent),2),W=[],X=w.id;if(I.promoteId?X=w.properties[I.promoteId]:I.generateId&&(X=R||0),j==="Point")Kr(F,W);else if(j==="MultiPoint")for(var J=0;J<F.length;J++)Kr(F[J],W);else if(j==="LineString")ir(F,W,K,!1);else if(j==="MultiLineString"){if(I.lineMetrics){for(J=0;J<F.length;J++)ir(F[J],W=[],K,!1),O.push(Tr(X,"LineString",W,w.properties));return}bt(F,W,K,!1)}else if(j==="Polygon")bt(F,W,K,!0);else{if(j!=="MultiPolygon"){if(j==="GeometryCollection"){for(J=0;J<w.geometry.geometries.length;J++)Pe(O,{id:X,geometry:w.geometry.geometries[J],properties:w.properties},I,R);return}throw new Error("Input data is not a valid GeoJSON object.")}for(J=0;J<F.length;J++){var de=[];bt(F[J],de,K,!0),W.push(de)}}O.push(Tr(X,j,W,w.properties))}}function Kr(O,w){w.push(Ji(O[0])),w.push(Vi(O[1])),w.push(0)}function ir(O,w,I,R){for(var F,j,K=0,W=0;W<O.length;W++){var X=Ji(O[W][0]),J=Vi(O[W][1]);w.push(X),w.push(J),w.push(0),W>0&&(K+=R?(F*J-X*j)/2:Math.sqrt(Math.pow(X-F,2)+Math.pow(J-j,2))),F=X,j=J}var de=w.length-3;w[2]=1,wr(w,0,de,I),w[de+2]=1,w.size=Math.abs(K),w.start=0,w.end=w.size}function bt(O,w,I,R){for(var F=0;F<O.length;F++){var j=[];ir(O[F],j,I,R),w.push(j)}}function Ji(O){return O/360+.5}function Vi(O){var w=Math.sin(O*Math.PI/180),I=.5-.25*Math.log((1+w)/(1-w))/Math.PI;return I<0?0:I>1?1:I}function Ni(O,w,I,R,F,j,K,W){if(R/=w,j>=(I/=w)&&K<R)return O;if(K<I||j>=R)return null;for(var X=[],J=0;J<O.length;J++){var de=O[J],be=de.geometry,he=de.type,Ve=F===0?de.minX:de.minY,Ge=F===0?de.maxX:de.maxY;if(Ve>=I&&Ge<R)X.push(de);else if(!(Ge<I||Ve>=R)){var Be=[];if(he==="Point"||he==="MultiPoint")Or(be,Be,I,R,F);else if(he==="LineString")Ce(be,Be,I,R,F,!1,W.lineMetrics);else if(he==="MultiLineString")nt(be,Be,I,R,F,!1);else if(he==="Polygon")nt(be,Be,I,R,F,!0);else if(he==="MultiPolygon")for(var Ke=0;Ke<be.length;Ke++){var et=[];nt(be[Ke],et,I,R,F,!0),et.length&&Be.push(et)}if(Be.length){if(W.lineMetrics&&he==="LineString"){for(Ke=0;Ke<Be.length;Ke++)X.push(Tr(de.id,he,Be[Ke],de.tags));continue}he!=="LineString"&&he!=="MultiLineString"||(Be.length===1?(he="LineString",Be=Be[0]):he="MultiLineString"),he!=="Point"&&he!=="MultiPoint"||(he=Be.length===3?"Point":"MultiPoint"),X.push(Tr(de.id,he,Be,de.tags))}}}return X.length?X:null}function Or(O,w,I,R,F){for(var j=0;j<O.length;j+=3){var K=O[j+F];K>=I&&K<=R&&(w.push(O[j]),w.push(O[j+1]),w.push(O[j+2]))}}function Ce(O,w,I,R,F,j,K){for(var W,X,J=at(O),de=F===0?Ur:rt,be=O.start,he=0;he<O.length-3;he+=3){var Ve=O[he],Ge=O[he+1],Be=O[he+2],Ke=O[he+3],et=O[he+4],wt=F===0?Ve:Ge,it=F===0?Ke:et,lt=!1;K&&(W=Math.sqrt(Math.pow(Ve-Ke,2)+Math.pow(Ge-et,2))),wt<I?it>I&&(X=de(J,Ve,Ge,Ke,et,I),K&&(J.start=be+W*X)):wt>R?it<R&&(X=de(J,Ve,Ge,Ke,et,R),K&&(J.start=be+W*X)):gi(J,Ve,Ge,Be),it<I&&wt>=I&&(X=de(J,Ve,Ge,Ke,et,I),lt=!0),it>R&&wt<=R&&(X=de(J,Ve,Ge,Ke,et,R),lt=!0),!j&&lt&&(K&&(J.end=be+W*X),w.push(J),J=at(O)),K&&(be+=W)}var Tt=O.length-3;Ve=O[Tt],Ge=O[Tt+1],Be=O[Tt+2],(wt=F===0?Ve:Ge)>=I&&wt<=R&&gi(J,Ve,Ge,Be),Tt=J.length-3,j&&Tt>=3&&(J[Tt]!==J[0]||J[Tt+1]!==J[1])&&gi(J,J[0],J[1],J[2]),J.length&&w.push(J)}function at(O){var w=[];return w.size=O.size,w.start=O.start,w.end=O.end,w}function nt(O,w,I,R,F,j){for(var K=0;K<O.length;K++)Ce(O[K],w,I,R,F,j,!1)}function gi(O,w,I,R){O.push(w),O.push(I),O.push(R)}function Ur(O,w,I,R,F,j){var K=(j-w)/(R-w);return O.push(j),O.push(I+(F-I)*K),O.push(1),K}function rt(O,w,I,R,F,j){var K=(j-I)/(F-I);return O.push(w+(R-w)*K),O.push(j),O.push(1),K}function Er(O,w){for(var I=[],R=0;R<O.length;R++){var F,j=O[R],K=j.type;if(K==="Point"||K==="MultiPoint"||K==="LineString")F=li(j.geometry,w);else if(K==="MultiLineString"||K==="Polygon"){F=[];for(var W=0;W<j.geometry.length;W++)F.push(li(j.geometry[W],w))}else if(K==="MultiPolygon")for(F=[],W=0;W<j.geometry.length;W++){for(var X=[],J=0;J<j.geometry[W].length;J++)X.push(li(j.geometry[W][J],w));F.push(X)}I.push(Tr(j.id,K,F,j.tags))}return I}function li(O,w){var I=[];I.size=O.size,O.start!==void 0&&(I.start=O.start,I.end=O.end);for(var R=0;R<O.length;R+=3)I.push(O[R]+w,O[R+1],O[R+2]);return I}function wn(O,w){if(O.transformed)return O;var I,R,F,j=1<<O.z,K=O.x,W=O.y;for(I=0;I<O.features.length;I++){var X=O.features[I],J=X.geometry,de=X.type;if(X.geometry=[],de===1)for(R=0;R<J.length;R+=2)X.geometry.push(ti(J[R],J[R+1],w,j,K,W));else for(R=0;R<J.length;R++){var be=[];for(F=0;F<J[R].length;F+=2)be.push(ti(J[R][F],J[R][F+1],w,j,K,W));X.geometry.push(be)}}return O.transformed=!0,O}function ti(O,w,I,R,F,j){return[Math.round(I*(O*R-F)),Math.round(I*(w*R-j))]}function Ci(O,w,I,R,F){for(var j=w===F.maxZoom?0:F.tolerance/((1<<w)*F.extent),K={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:I,y:R,z:w,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},W=0;W<O.length;W++){K.numFeatures++,kt(K,O[W],j,F);var X=O[W].minX,J=O[W].minY,de=O[W].maxX,be=O[W].maxY;X<K.minX&&(K.minX=X),J<K.minY&&(K.minY=J),de>K.maxX&&(K.maxX=de),be>K.maxY&&(K.maxY=be)}return K}function kt(O,w,I,R){var F=w.geometry,j=w.type,K=[];if(j==="Point"||j==="MultiPoint")for(var W=0;W<F.length;W+=3)K.push(F[W]),K.push(F[W+1]),O.numPoints++,O.numSimplified++;else if(j==="LineString")Tn(K,F,O,I,!1,!1);else if(j==="MultiLineString"||j==="Polygon")for(W=0;W<F.length;W++)Tn(K,F[W],O,I,j==="Polygon",W===0);else if(j==="MultiPolygon")for(var X=0;X<F.length;X++){var J=F[X];for(W=0;W<J.length;W++)Tn(K,J[W],O,I,!0,W===0)}if(K.length){var de=w.tags||null;if(j==="LineString"&&R.lineMetrics){for(var be in de={},w.tags)de[be]=w.tags[be];de.mapbox_clip_start=F.start/F.size,de.mapbox_clip_end=F.end/F.size}var he={geometry:K,type:j==="Polygon"||j==="MultiPolygon"?3:j==="LineString"||j==="MultiLineString"?2:1,tags:de};w.id!==null&&(he.id=w.id),O.features.push(he)}}function Tn(O,w,I,R,F,j){var K=R*R;if(R>0&&w.size<(F?K:R))I.numPoints+=w.length/3;else{for(var W=[],X=0;X<w.length;X+=3)(R===0||w[X+2]>K)&&(I.numSimplified++,W.push(w[X]),W.push(w[X+1])),I.numPoints++;F&&function(J,de){for(var be=0,he=0,Ve=J.length,Ge=Ve-2;he<Ve;Ge=he,he+=2)be+=(J[he]-J[Ge])*(J[he+1]+J[Ge+1]);if(be>0===de)for(he=0,Ve=J.length;he<Ve/2;he+=2){var Be=J[he],Ke=J[he+1];J[he]=J[Ve-2-he],J[he+1]=J[Ve-1-he],J[Ve-2-he]=Be,J[Ve-1-he]=Ke}}(W,j),O.push(W)}}function pr(O,w){var I=(w=this.options=function(F,j){for(var K in j)F[K]=j[K];return F}(Object.create(this.options),w)).debug;if(I&&console.time("preprocess data"),w.maxZoom<0||w.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(w.promoteId&&w.generateId)throw new Error("promoteId and generateId cannot be used together.");var R=function(F,j){var K=[];if(F.type==="FeatureCollection")for(var W=0;W<F.features.length;W++)Pe(K,F.features[W],j,W);else Pe(K,F.type==="Feature"?F:{geometry:F},j);return K}(O,w);this.tiles={},this.tileCoords=[],I&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",w.indexMaxZoom,w.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),R=function(F,j){var K=j.buffer/j.extent,W=F,X=Ni(F,1,-1-K,K,0,-1,2,j),J=Ni(F,1,1-K,2+K,0,-1,2,j);return(X||J)&&(W=Ni(F,1,-K,1+K,0,-1,2,j)||[],X&&(W=Er(X,1).concat(W)),J&&(W=W.concat(Er(J,-1)))),W}(R,w),R.length&&this.splitTile(R,0,0,0),I&&(R.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)))}function Jr(O,w,I){return 32*((1<<O)*I+w)+O}function Yr(O,w){const I=O.tileID.canonical;if(!this._geoJSONIndex)return w(null,null);const R=this._geoJSONIndex.getTile(I.z,I.x,I.y);if(!R)return w(null,null);const F=new xt(R.features);let j=Xt.exports(F);j.byteOffset===0&&j.byteLength===j.buffer.byteLength||(j=new Uint8Array(j)),w(null,{vectorTile:F,rawData:j.buffer})}pr.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},pr.prototype.splitTile=function(O,w,I,R,F,j,K){for(var W=[O,w,I,R],X=this.options,J=X.debug;W.length;){R=W.pop(),I=W.pop(),w=W.pop(),O=W.pop();var de=1<<w,be=Jr(w,I,R),he=this.tiles[be];if(!he&&(J>1&&console.time("creation"),he=this.tiles[be]=Ci(O,w,I,R,X),this.tileCoords.push({z:w,x:I,y:R}),J)){J>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",w,I,R,he.numFeatures,he.numPoints,he.numSimplified),console.timeEnd("creation"));var Ve="z"+w;this.stats[Ve]=(this.stats[Ve]||0)+1,this.total++}if(he.source=O,F){if(w===X.maxZoom||w===F)continue;var Ge=1<<F-w;if(I!==Math.floor(j/Ge)||R!==Math.floor(K/Ge))continue}else if(w===X.indexMaxZoom||he.numPoints<=X.indexMaxPoints)continue;if(he.source=null,O.length!==0){J>1&&console.time("clipping");var Be,Ke,et,wt,it,lt,Tt=.5*X.buffer/X.extent,Lt=.5-Tt,ci=.5+Tt,$t=1+Tt;Be=Ke=et=wt=null,it=Ni(O,de,I-Tt,I+ci,0,he.minX,he.maxX,X),lt=Ni(O,de,I+Lt,I+$t,0,he.minX,he.maxX,X),O=null,it&&(Be=Ni(it,de,R-Tt,R+ci,1,he.minY,he.maxY,X),Ke=Ni(it,de,R+Lt,R+$t,1,he.minY,he.maxY,X),it=null),lt&&(et=Ni(lt,de,R-Tt,R+ci,1,he.minY,he.maxY,X),wt=Ni(lt,de,R+Lt,R+$t,1,he.minY,he.maxY,X),lt=null),J>1&&console.timeEnd("clipping"),W.push(Be||[],w+1,2*I,2*R),W.push(Ke||[],w+1,2*I,2*R+1),W.push(et||[],w+1,2*I+1,2*R),W.push(wt||[],w+1,2*I+1,2*R+1)}}},pr.prototype.getTile=function(O,w,I){var R=this.options,F=R.extent,j=R.debug;if(O<0||O>24)return null;var K=1<<O,W=Jr(O,w=(w%K+K)%K,I);if(this.tiles[W])return wn(this.tiles[W],F);j>1&&console.log("drilling down to z%d-%d-%d",O,w,I);for(var X,J=O,de=w,be=I;!X&&J>0;)J--,de=Math.floor(de/2),be=Math.floor(be/2),X=this.tiles[Jr(J,de,be)];return X&&X.source?(j>1&&console.log("found parent tile z%d-%d-%d",J,de,be),j>1&&console.time("drilling down"),this.splitTile(X.source,J,de,be,O,w,I),j>1&&console.timeEnd("drilling down"),this.tiles[W]?wn(this.tiles[W],F):null):null};class En extends Ie{constructor(w,I,R,F){super(w,I,R,Yr),F&&(this.loadGeoJSON=F)}loadData(w,I){var R;(R=this._pendingRequest)===null||R===void 0||R.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const F=!!(w&&w.request&&w.request.collectResourceTiming)&&new a.RequestPerformance(w.request);this._pendingCallback=I,this._pendingRequest=this.loadGeoJSON(w,(j,K)=>{if(delete this._pendingCallback,delete this._pendingRequest,j||!K)return I(j);if(typeof K!="object")return I(new Error(`Input data given to '${w.source}' is not a valid GeoJSON object.`));{tt(K,!0);try{if(w.filter){const X=a.createExpression(w.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(X.result==="error")throw new Error(X.value.map(de=>`${de.key}: ${de.message}`).join(", "));const J=K.features.filter(de=>X.value.evaluate({zoom:0},de));K={type:"FeatureCollection",features:J}}this._geoJSONIndex=w.cluster?new jn(function({superclusterOptions:X,clusterProperties:J}){if(!J||!X)return X;const de={},be={},he={accumulated:null,zoom:0},Ve={properties:null},Ge=Object.keys(J);for(const Be of Ge){const[Ke,et]=J[Be],wt=a.createExpression(et),it=a.createExpression(typeof Ke=="string"?[Ke,["accumulated"],["get",Be]]:Ke);de[Be]=wt.value,be[Be]=it.value}return X.map=Be=>{Ve.properties=Be;const Ke={};for(const et of Ge)Ke[et]=de[et].evaluate(he,Ve);return Ke},X.reduce=(Be,Ke)=>{Ve.properties=Ke;for(const et of Ge)he.accumulated=Be[et],Be[et]=be[et].evaluate(he,Ve)},X}(w)).load(K.features):function(X,J){return new pr(X,J)}(K,w.geojsonVtOptions)}catch(X){return I(X)}this.loaded={};const W={};if(F){const X=F.finish();X&&(W.resourceTiming={},W.resourceTiming[w.source]=JSON.parse(JSON.stringify(X)))}I(null,W)}})}reloadTile(w,I){const R=this.loaded;return R&&R[w.uid]?super.reloadTile(w,I):this.loadTile(w,I)}loadGeoJSON(w,I){if(w.request)return a.getJSON(w.request,I);if(typeof w.data=="string")try{I(null,JSON.parse(w.data))}catch{I(new Error(`Input data given to '${w.source}' is not a valid GeoJSON object.`))}else I(new Error(`Input data given to '${w.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(w,I){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),I()}getClusterExpansionZoom(w,I){try{I(null,this._geoJSONIndex.getClusterExpansionZoom(w.clusterId))}catch(R){I(R)}}getClusterChildren(w,I){try{I(null,this._geoJSONIndex.getChildren(w.clusterId))}catch(R){I(R)}}getClusterLeaves(w,I){try{I(null,this._geoJSONIndex.getLeaves(w.clusterId,w.limit,w.offset))}catch(R){I(R)}}}class Qr{constructor(w){this.self=w,this.actor=new a.Actor(w,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Ie,geojson:En},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(I,R)=>{if(this.workerSourceTypes[I])throw new Error(`Worker source with name "${I}" already registered.`);this.workerSourceTypes[I]=R},this.self.registerRTLTextPlugin=I=>{if(a.plugin.isParsed())throw new Error("RTL text plugin already registered.");a.plugin.applyArabicShaping=I.applyArabicShaping,a.plugin.processBidirectionalText=I.processBidirectionalText,a.plugin.processStyledBidirectionalText=I.processStyledBidirectionalText}}setReferrer(w,I){this.referrer=I}setImages(w,I,R){this.availableImages[w]=I;for(const F in this.workerSources[w]){const j=this.workerSources[w][F];for(const K in j)j[K].availableImages=I}R()}setLayers(w,I,R){this.getLayerIndex(w).replace(I),R()}updateLayers(w,I,R){this.getLayerIndex(w).update(I.layers,I.removedIds),R()}loadTile(w,I,R){this.getWorkerSource(w,I.type,I.source).loadTile(I,R)}loadDEMTile(w,I,R){this.getDEMWorkerSource(w,I.source).loadTile(I,R)}reloadTile(w,I,R){this.getWorkerSource(w,I.type,I.source).reloadTile(I,R)}abortTile(w,I,R){this.getWorkerSource(w,I.type,I.source).abortTile(I,R)}removeTile(w,I,R){this.getWorkerSource(w,I.type,I.source).removeTile(I,R)}removeDEMTile(w,I){this.getDEMWorkerSource(w,I.source).removeTile(I)}removeSource(w,I,R){if(!this.workerSources[w]||!this.workerSources[w][I.type]||!this.workerSources[w][I.type][I.source])return;const F=this.workerSources[w][I.type][I.source];delete this.workerSources[w][I.type][I.source],F.removeSource!==void 0?F.removeSource(I,R):R()}loadWorkerSource(w,I,R){try{this.self.importScripts(I.url),R()}catch(F){R(F.toString())}}syncRTLPluginState(w,I,R){try{a.plugin.setState(I);const F=a.plugin.getPluginURL();if(a.plugin.isLoaded()&&!a.plugin.isParsed()&&F!=null){this.self.importScripts(F);const j=a.plugin.isParsed();R(j?void 0:new Error(`RTL Text Plugin failed to import scripts from ${F}`),j)}}catch(F){R(F.toString())}}getAvailableImages(w){let I=this.availableImages[w];return I||(I=[]),I}getLayerIndex(w){let I=this.layerIndexes[w];return I||(I=this.layerIndexes[w]=new pe),I}getWorkerSource(w,I,R){if(this.workerSources[w]||(this.workerSources[w]={}),this.workerSources[w][I]||(this.workerSources[w][I]={}),!this.workerSources[w][I][R]){const F={send:(j,K,W)=>{this.actor.send(j,K,W,w)}};this.workerSources[w][I][R]=new this.workerSourceTypes[I](F,this.getLayerIndex(w),this.getAvailableImages(w))}return this.workerSources[w][I][R]}getDEMWorkerSource(w,I){return this.demWorkerSources[w]||(this.demWorkerSources[w]={}),this.demWorkerSources[w][I]||(this.demWorkerSources[w][I]=new Ye),this.demWorkerSources[w][I]}enforceCacheSizeLimit(w,I){a.enforceCacheSizeLimit(I)}}return a.isWorker()&&(self.worker=new Qr(self)),Qr}),G(["./shared"],function(a){var Y=ie;function ie(l){return!function(t){return typeof window=="undefined"||typeof document=="undefined"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var s,u,p=new Blob([""],{type:"text/javascript"}),f=URL.createObjectURL(p);try{u=new Worker(f),s=!0}catch{s=!1}return u&&u.terminate(),URL.revokeObjectURL(f),s}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var s=document.createElement("canvas");s.width=s.height=1;var u=s.getContext("2d");if(!u)return!1;var p=u.getImageData(0,0,1,1);return p&&p.width===s.width}()?(pe[n=t&&t.failIfMajorPerformanceCaveat]===void 0&&(pe[n]=function(s){var u,p=function(f){var _=document.createElement("canvas"),y=Object.create(ie.webGLContextAttributes);return y.failIfMajorPerformanceCaveat=f,_.getContext("webgl",y)||_.getContext("experimental-webgl",y)}(s);if(!p)return!1;try{u=p.createShader(p.VERTEX_SHADER)}catch{return!1}return!(!u||p.isContextLost())&&(p.shaderSource(u,"void main() {}"),p.compileShader(u),p.getShaderParameter(u,p.COMPILE_STATUS)===!0)}(n)),pe[n]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var n}(l)}var pe={};function ue(l,t){if(Array.isArray(l)){if(!Array.isArray(t)||l.length!==t.length)return!1;for(let n=0;n<l.length;n++)if(!ue(l[n],t[n]))return!1;return!0}if(typeof l=="object"&&l!==null&&t!==null){if(typeof t!="object"||Object.keys(l).length!==Object.keys(t).length)return!1;for(const n in l)if(!ue(l[n],t[n]))return!1;return!0}return l===t}ie.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class te{static testProp(t){if(!te.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in te.docStyle)return t[n];return t[0]}static create(t,n,s){const u=window.document.createElement(t);return n!==void 0&&(u.className=n),s&&s.appendChild(u),u}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){te.docStyle&&te.selectProp&&(te.userSelect=te.docStyle[te.selectProp],te.docStyle[te.selectProp]="none")}static enableDrag(){te.docStyle&&te.selectProp&&(te.docStyle[te.selectProp]=te.userSelect)}static setTransform(t,n){t.style[te.transformProp]=n}static addEventListener(t,n,s,u={}){t.addEventListener(n,s,"passive"in u?u:u.capture)}static removeEventListener(t,n,s,u={}){t.removeEventListener(n,s,"passive"in u?u:u.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",te.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",te.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",te.suppressClickInternal,!0)},0)}static mousePos(t,n){const s=t.getBoundingClientRect();return new a.pointGeometry(n.clientX-s.left-t.clientLeft,n.clientY-s.top-t.clientTop)}static touchPos(t,n){const s=t.getBoundingClientRect(),u=[];for(let p=0;p<n.length;p++)u.push(new a.pointGeometry(n[p].clientX-s.left-t.clientLeft,n[p].clientY-s.top-t.clientTop));return u}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}te.docStyle=typeof window!="undefined"&&window.document&&window.document.documentElement.style,te.selectProp=te.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),te.transformProp=te.testProp(["transform","WebkitTransform"]);class ke{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,s){const u=function(p){const f=p.match(Se);if(!f)throw new Error(`Unable to parse URL "${p}"`);return{protocol:f[1],authority:f[2],path:f[3]||"/",params:f[4]?f[4].split("&"):[]}}(t);return u.path+=`${n}${s}`,function(p){const f=p.params.length?`?${p.params.join("&")}`:"";return`${p.protocol}://${p.authority}${p.path}${f}`}(u)}setTransformRequest(t){this._transformRequestFn=t}}const Se=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;class Ie{constructor(t,n,s,u){this.context=t,this.format=s,this.texture=t.gl.createTexture(),this.update(n,u)}update(t,n,s){const{width:u,height:p}=t,f=!(this.size&&this.size[0]===u&&this.size[1]===p||s),{context:_}=this,{gl:y}=_;if(this.useMipmap=Boolean(n&&n.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!n||n.premultiply!==!1)),f)this.size=[u,p],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||a.isImageBitmap(t)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,t):y.texImage2D(y.TEXTURE_2D,0,this.format,u,p,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:v,y:E}=s||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||a.isImageBitmap(t)?y.texSubImage2D(y.TEXTURE_2D,0,v,E,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,v,E,u,p,y.RGBA,y.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(t,n,s){const{context:u}=this,{gl:p}=u;p.bindTexture(p.TEXTURE_2D,this.texture),s!==p.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=p.LINEAR),t!==this.filter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,t),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,s||t),this.filter=t),n!==this.wrap&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,n),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function Ye(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class tt extends a.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.RGBAImage({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,callback:s}of this.requestors)this._notify(n,s);this.requestors=[]}}getImage(t){return this.images[t]}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 s=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new a.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),s=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new a.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),s=!1),this._validateContent(n.content,n)||(this.fire(new a.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),s=!1),s}_validateStretch(t,n){if(!t)return!0;let s=0;for(const u of t){if(u[0]<s||u[1]<u[0]||n<u[1])return!1;s=u[1]}return!0}_validateContent(t,n){return!(t&&(t.length!==4||t[0]<0||n.data.width<t[0]||t[1]<0||n.data.height<t[1]||t[2]<0||n.data.width<t[2]||t[3]<0||n.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))}updateImage(t,n){const s=this.images[t];if(s.data.width!==n.data.width||s.data.height!==n.data.height)throw new Error(`size mismatch between old image (${s.data.width}x${s.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=s.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,n){let s=!0;if(!this.isLoaded())for(const u of t)this.images[u]||(s=!1);this.isLoaded()||s?this._notify(t,n):this.requestors.push({ids:t,callback:n})}_notify(t,n){const s={};for(const u of t){this.images[u]||this.fire(new a.Event("styleimagemissing",{id:u}));const p=this.images[u];p?s[u]={data:p.data.clone(),pixelRatio:p.pixelRatio,sdf:p.sdf,version:p.version,stretchX:p.stretchX,stretchY:p.stretchY,content:p.content,hasRenderCallback:Boolean(p.userImage&&p.userImage.render)}:a.warnOnce(`Image "${u}" 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.`)}n(null,s)}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],s=this.getImage(t);if(!s)return null;if(n&&n.position.version===s.version)return n.position;if(n)n.position.version=s.version;else{const u={w:s.data.width+2,h:s.data.height+2,x:0,y:0},p=new a.ImagePosition(u,s);this.patterns[t]={bin:u,position:p}}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 Ie(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const p in this.patterns)t.push(this.patterns[p].bin);const{w:n,h:s}=a.potpack(t),u=this.atlasImage;u.resize({width:n||1,height:s||1});for(const p in this.patterns){const{bin:f}=this.patterns[p],_=f.x+1,y=f.y+1,v=this.images[p].data,E=v.width,M=v.height;a.RGBAImage.copy(v,u,{x:0,y:0},{x:_,y},{width:E,height:M}),a.RGBAImage.copy(v,u,{x:0,y:M-1},{x:_,y:y-1},{width:E,height:1}),a.RGBAImage.copy(v,u,{x:0,y:0},{x:_,y:y+M},{width:E,height:1}),a.RGBAImage.copy(v,u,{x:E-1,y:0},{x:_-1,y},{width:1,height:M}),a.RGBAImage.copy(v,u,{x:0,y:0},{x:_+E,y},{width:1,height:M})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const s=this.images[n];s||a.warnOnce(`Image with ID: "${n}" was not found`),Ye(s)&&this.updateImage(n,s)}}}const Qe=1e20;function dt(l,t,n,s,u,p,f,_,y){for(let v=t;v<t+s;v++)It(l,n*p+v,p,u,f,_,y);for(let v=n;v<n+u;v++)It(l,v*p+t,1,s,f,_,y)}function It(l,t,n,s,u,p,f){p[0]=0,f[0]=-Qe,f[1]=Qe,u[0]=l[t];for(let _=1,y=0,v=0;_<s;_++){u[_]=l[t+_*n];const E=_*_;do{const M=p[y];v=(u[_]-u[M]+E-M*M)/(_-M)/2}while(v<=f[y]&&--y>-1);y++,p[y]=_,f[y]=v,f[y+1]=Qe}for(let _=0,y=0;_<s;_++){for(;f[y+1]<_;)y++;const v=p[y],E=_-v;l[t+_*n]=u[v]+E*E}}class ht{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t,n){const s=[];for(const u in t)for(const p of t[u])s.push({stack:u,id:p});a.asyncAll(s,({stack:u,id:p},f)=>{let _=this.entries[u];_||(_=this.entries[u]={glyphs:{},requests:{},ranges:{}});let y=_.glyphs[p];if(y!==void 0)return void f(null,{stack:u,id:p,glyph:y});if(y=this._tinySDF(_,u,p),y)return _.glyphs[p]=y,void f(null,{stack:u,id:p,glyph:y});const v=Math.floor(p/256);if(256*v>65535)return void f(new Error("glyphs > 65535 not supported"));if(_.ranges[v])return void f(null,{stack:u,id:p,glyph:y});let E=_.requests[v];E||(E=_.requests[v]=[],ht.loadGlyphRange(u,v,this.url,this.requestManager,(M,z)=>{if(z){for(const V in z)this._doesCharSupportLocalGlyph(+V)||(_.glyphs[+V]=z[+V]);_.ranges[v]=!0}for(const V of E)V(M,z);delete _.requests[v]})),E.push((M,z)=>{M?f(M):z&&f(null,{stack:u,id:p,glyph:z[p]||null})})},(u,p)=>{if(u)n(u);else if(p){const f={};for(const{stack:_,id:y,glyph:v}of p)(f[_]||(f[_]={}))[y]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics};n(null,f)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(a.unicodeBlockLookup["CJK Unified Ideographs"](t)||a.unicodeBlockLookup["Hangul Syllables"](t)||a.unicodeBlockLookup.Hiragana(t)||a.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,s){const u=this.localIdeographFontFamily;if(!u||!this._doesCharSupportLocalGlyph(s))return;let p=t.tinySDF;if(!p){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),p=t.tinySDF=new ht.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:u,fontWeight:_})}const f=p.draw(String.fromCharCode(s));return{id:s,bitmap:new a.AlphaImage({width:f.width||30,height:f.height||30},f.data),metrics:{width:f.glyphWidth||24,height:f.glyphHeight||24,left:f.glyphLeft||0,top:f.glyphTop-27||-8,advance:f.glyphAdvance||24}}}}ht.loadGlyphRange=function(l,t,n,s,u){const p=256*t,f=p+255,_=s.transformRequest(n.replace("{fontstack}",l).replace("{range}",`${p}-${f}`),a.ResourceType.Glyphs);a.getArrayBuffer(_,(y,v)=>{if(y)u(y);else if(v){const E={};for(const M of a.parseGlyphPbf(v))E[M.id]=M;u(null,E)}})},ht.TinySDF=class{constructor({fontSize:l=24,buffer:t=3,radius:n=8,cutoff:s=.25,fontFamily:u="sans-serif",fontWeight:p="normal",fontStyle:f="normal"}={}){this.buffer=t,this.cutoff=s,this.radius=n;const _=this.size=l+4*t,y=this._createCanvas(_),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${f} ${p} ${l}px ${u}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(l){const t=document.createElement("canvas");return t.width=t.height=l,t}draw(l){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:s,actualBoundingBoxLeft:u,actualBoundingBoxRight:p}=this.ctx.measureText(l),f=Math.ceil(n),_=Math.min(this.size-this.buffer,Math.ceil(p-u)),y=Math.min(this.size-this.buffer,f+Math.ceil(s)),v=_+2*this.buffer,E=y+2*this.buffer,M=Math.max(v*E,0),z=new Uint8ClampedArray(M),V={data:z,width:v,height:E,glyphWidth:_,glyphHeight:y,glyphTop:f,glyphLeft:0,glyphAdvance:t};if(_===0||y===0)return V;const{ctx:U,buffer:$,gridInner:H,gridOuter:Q}=this;U.clearRect($,$,_,y),U.fillText(l,$,$+f);const oe=U.getImageData($,$,_,y);Q.fill(Qe,0,M),H.fill(0,0,M);for(let N=0;N<y;N++)for(let le=0;le<_;le++){const se=oe.data[4*(N*_+le)+3]/255;if(se===0)continue;const me=(N+$)*v+le+$;if(se===1)Q[me]=0,H[me]=Qe;else{const ge=.5-se;Q[me]=ge>0?ge*ge:0,H[me]=ge<0?ge*ge:0}}dt(Q,0,0,v,E,v,this.f,this.v,this.z),dt(H,$,$,_,y,v,this.f,this.v,this.z);for(let N=0;N<M;N++){const le=Math.sqrt(Q[N])-Math.sqrt(H[N]);z[N]=Math.round(255-255*(le/this.radius+this.cutoff))}return V}};const xt=new a.Properties({anchor:new a.DataConstantProperty(a.spec.light.anchor),position:new class{constructor(){this.specification=a.spec.light.position}possiblyEvaluate(l,t){return a.sphericalToCartesian(l.expression.evaluate(t))}interpolate(l,t,n){return{x:a.number(l.x,t.x,n),y:a.number(l.y,t.y,n),z:a.number(l.z,t.z,n)}}},color:new a.DataConstantProperty(a.spec.light.color),intensity:new a.DataConstantProperty(a.spec.light.intensity)}),Xt="-transition";class gt extends a.Evented{constructor(t){super(),this._transitionable=new a.Transitionable(xt),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(a.validateLight,t,n))for(const s in t){const u=t[s];s.endsWith(Xt)?this._transitionable.setTransition(s.slice(0,-Xt.length),u):this._transitionable.setValue(s,u)}}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,s){return(!s||s.validate!==!1)&&a.emitValidationErrors(this,t.call(a.validateStyle,a.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:a.spec})))}}class xi{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const s=t.join(",")+String(n);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(t,n)),this.dashEntry[s]}getDashRanges(t,n,s){const u=[];let p=t.length%2==1?-t[t.length-1]*s:0,f=t[0]*s,_=!0;u.push({left:p,right:f,isDash:_,zeroLength:t[0]===0});let y=t[0];for(let v=1;v<t.length;v++){_=!_;const E=t[v];p=y*s,y+=E,f=y*s,u.push({left:p,right:f,isDash:_,zeroLength:E===0})}return u}addRoundDash(t,n,s){const u=n/2;for(let p=-s;p<=s;p++){const f=this.width*(this.nextRow+s+p);let _=0,y=t[_];for(let v=0;v<this.width;v++){v/y.right>1&&(y=t[++_]);const E=Math.abs(v-y.left),M=Math.abs(v-y.right),z=Math.min(E,M);let V;const U=p/s*(u+1);if(y.isDash){const $=u-Math.abs(U);V=Math.sqrt(z*z+$*$)}else V=u-Math.sqrt(z*z+U*U);this.data[f+v]=Math.max(0,Math.min(255,V+128))}}}addRegularDash(t){for(let _=t.length-1;_>=0;--_){const y=t[_],v=t[_+1];y.zeroLength?t.splice(_,1):v&&v.isDash===y.isDash&&(v.left=y.left,t.splice(_,1))}const n=t[0],s=t[t.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);const u=this.width*this.nextRow;let p=0,f=t[p];for(let _=0;_<this.width;_++){_/f.right>1&&(f=t[++p]);const y=Math.abs(_-f.left),v=Math.abs(_-f.right),E=Math.min(y,v);this.data[u+_]=Math.max(0,Math.min(255,(f.isDash?E:-E)+128))}}addDash(t,n){const s=n?7:0,u=2*s+1;if(this.nextRow+u>this.height)return a.warnOnce("LineAtlas out of space"),null;let p=0;for(let _=0;_<t.length;_++)p+=t[_];if(p!==0){const _=this.width/p,y=this.getDashRanges(t,this.width,_);n?this.addRoundDash(y,_,s):this.addRegularDash(y)}const f={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:p};return this.nextRow+=u,this.dirty=!0,f}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))}}class zi{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=a.uniqueId();const s=this.workerPool.acquire(this.id);for(let u=0;u<s.length;u++){const p=new zi.Actor(s[u],n,this.id);p.name=`Worker ${u}`,this.actors.push(p)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n,s){a.asyncAll(this.actors,(u,p)=>{u.send(t,n,p)},s=s||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=>{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}function _t(l,t,n){const s=function(u,p){if(u)return n(u);if(p){const f=a.pick(a.extend(p,l),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);p.vector_layers&&(f.vectorLayers=p.vector_layers,f.vectorLayerIds=f.vectorLayers.map(_=>_.id)),n(null,f)}};return l.url?a.getJSON(t.transformRequest(l.url,a.ResourceType.Source),s):a.exported.frame(()=>s(null,l))}zi.Actor=a.Actor;class Wt{constructor(t,n,s){this.bounds=a.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=s||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),s=Math.floor(a.mercatorXfromLng(this.bounds.getWest())*n),u=Math.floor(a.mercatorYfromLat(this.bounds.getNorth())*n),p=Math.ceil(a.mercatorXfromLng(this.bounds.getEast())*n),f=Math.ceil(a.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=s&&t.x<p&&t.y>=u&&t.y<f}}class ei extends a.Evented{constructor(t,n,s,u){if(super(),this.id=t,this.dispatcher=s,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,a.extend(this,a.pick(n,["url","scheme","tileSize","promoteId"])),this._options=a.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(u)}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=_t(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new a.ErrorEvent(t)):n&&(a.extend(this,n),n.bounds&&(this.tileBounds=new Wt(n.bounds,this.minzoom,this.maxzoom)),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}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.cancel(),t(),this.load()}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.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),u={request:this.map._requestManager.transformRequest(s,a.ResourceType.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};function p(f,_){return delete t.request,t.aborted?n(null):f&&f.status!==404?n(f):(_&&_.resourceTiming&&(t.resourceTiming=_.resourceTiming),this.map._refreshExpiredTiles&&_&&t.setExpiryData(_),t.loadVectorData(_,this.map.painter),a.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}u.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",u,p.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",u,p.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class Ht extends a.Evented{constructor(t,n,s,u){super(),this.id=t,this.dispatcher=s,this.setEventedParent(u),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=a.extend({type:"raster"},n),a.extend(this,a.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=_t(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new a.ErrorEvent(t)):n&&(a.extend(this,n),n.bounds&&(this.tileBounds=new Wt(n.bounds,this.minzoom,this.maxzoom)),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=a.getImage(this.map._requestManager.transformRequest(s,a.ResourceType.Tile),(u,p,f)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(u)t.state="errored",n(u);else if(p){this.map._refreshExpiredTiles&&t.setExpiryData(f);const _=this.map.painter.context,y=_.gl;t.texture=this.map.painter.getTileTexture(p.width),t.texture?t.texture.update(p,{useMipmap:!0}):(t.texture=new Ie(_,p,y.RGBA,{useMipmap:!0}),t.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),_.extTextureFilterAnisotropic&&y.texParameterf(y.TEXTURE_2D,_.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,_.extTextureFilterAnisotropicMax)),t.state="loaded",a.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}let Kt;class He extends Ht{constructor(t,n,s,u){super(t,n,s,u),this.type="raster-dem",this.maxzoom=22,this._options=a.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function u(p,f){p&&(t.state="errored",n(p)),f&&(t.dem=f,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=a.getImage(this.map._requestManager.transformRequest(s,a.ResourceType.Tile),function(p,f){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(p)t.state="errored",n(p);else if(f){this.map._refreshExpiredTiles&&t.setExpiryData(f),delete f.cacheControl,delete f.expires;const _=a.isImageBitmap(f)&&(Kt==null&&(Kt=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Kt)?f:a.exported.getImageData(f,1),y={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:_,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",y,u.bind(this)))}}.bind(this)),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,s=Math.pow(2,n.z),u=(n.x-1+s)%s,p=n.x===0?t.wrap-1:t.wrap,f=(n.x+1+s)%s,_=n.x+1===s?t.wrap+1:t.wrap,y={};return y[new a.OverscaledTileID(t.overscaledZ,p,n.z,u,n.y).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y).key]={backfilled:!1},n.y>0&&(y[new a.OverscaledTileID(t.overscaledZ,p,n.z,u,n.y-1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y-1).key]={backfilled:!1}),n.y+1<s&&(y[new a.OverscaledTileID(t.overscaledZ,p,n.z,u,n.y+1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y+1).key]={backfilled:!1}),y}unloadTile(t){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&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class vi extends a.Evented{constructor(t,n,s,u){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._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(u),this._data=n.data,this._options=a.extend({},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;const p=a.EXTENT/this.tileSize;this.workerOptions=a.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*p,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*p,extent:a.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:a.EXTENT,radius:(n.clusterRadius||50)*p,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData("content"),this}getClusterExpansionZoom(t,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},n),this}getClusterChildren(t,n){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},n),this}getClusterLeaves(t,n,s,u){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:n,offset:s},u),this}_updateWorkerData(t){const n=a.extend({},this.workerOptions),s=this._data;typeof s=="string"?(n.request=this.map._requestManager.transformRequest(a.exported.resolveURL(s),a.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(s),this._pendingLoads++,this.fire(new a.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(u,p)=>{if(this._pendingLoads--,this._removed||p&&p.abandoned)return void this.fire(new a.Event("dataabort",{dataType:"source",sourceDataType:t}));let f=null;if(p&&p.resourceTiming&&p.resourceTiming[this.id]&&(f=p.resourceTiming[this.id].slice(0)),u)return void this.fire(new a.ErrorEvent(u));const _={dataType:"source",sourceDataType:t};this._collectResourceTiming&&f&&f.length>0&&a.extend(_,{resourceTiming:f}),this.fire(new a.Event("data",_))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const s=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const u={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};t.request=this.actor.send(s,u,(p,f)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):p?n(p):(t.loadVectorData(f,this.map.painter,s==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return a.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var ki=a.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ii extends a.Evented{constructor(t,n,s,u){super(),this.id=t,this.dispatcher=s,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(u),this.options=n}load(t,n){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this.url=this.options.url,a.getImage(this.map._requestManager.transformRequest(this.url,a.ResourceType.Image),(s,u)=>{this._loaded=!0,s?this.fire(new a.ErrorEvent(s)):u&&(this.image=u,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(t){this.coordinates=t;const n=t.map(a.MercatorCoordinate.fromLngLat);this.tileID=function(u){let p=1/0,f=1/0,_=-1/0,y=-1/0;for(const z of u)p=Math.min(p,z.x),f=Math.min(f,z.y),_=Math.max(_,z.x),y=Math.max(y,z.y);const v=Math.max(_-p,y-f),E=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),M=Math.pow(2,E);return new a.CanonicalTileID(E,Math.floor((p+_)/2*M),Math.floor((f+y)/2*M))}(n),this.minzoom=this.maxzoom=this.tileID.z;const s=n.map(u=>this.tileID.getTilePoint(u)._round());return this._boundsArray=new a.RasterBoundsArray,this._boundsArray.emplaceBack(s[0].x,s[0].y,0,0),this._boundsArray.emplaceBack(s[1].x,s[1].y,a.EXTENT,0),this._boundsArray.emplaceBack(s[3].x,s[3].y,0,a.EXTENT),this._boundsArray.emplaceBack(s[2].x,s[2].y,a.EXTENT,a.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new a.Event("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.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,ki.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Ie(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const s in this.tiles){const u=this.tiles[s];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture)}}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Di extends Ii{constructor(t,n,s,u){super(t,n,s,u),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,a.ResourceType.Source).url);a.getVideo(this.urls,(n,s)=>{this._loaded=!0,n?this.fire(new a.ErrorEvent(n)):s&&(this.video=s,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}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 a.ErrorEvent(new a.ValidationError(`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)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,ki.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),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 Ie(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const s in this.tiles){const u=this.tiles[s];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Hr extends Ii{constructor(t,n,s,u){super(t,n,s,u),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(f=>typeof f!="number"))||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new a.ErrorEvent(new a.ValidationError(`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 a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){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 a.ErrorEvent(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,s=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,ki.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Ie(n,this.canvas,s.RGBA,{premultiply:!0});for(const u in this.tiles){const p=this.tiles[u];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture)}}serialize(){return{type:"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 mn={vector:ei,raster:Ht,"raster-dem":He,geojson:vi,video:Di,image:Ii,canvas:Hr};function gn(l,t){const n=a.create();return a.translate(n,n,[1,1,0]),a.scale(n,n,[.5*l.width,.5*l.height,1]),a.multiply(n,n,l.calculatePosMatrix(t.toUnwrapped()))}function _n(l,t,n,s,u,p){const f=function(M,z,V){if(M)for(const U of M){const $=z[U];if($&&$.source===V&&$.type==="fill-extrusion")return!0}else for(const U in z){const $=z[U];if($.source===V&&$.type==="fill-extrusion")return!0}return!1}(u&&u.layers,t,l.id),_=p.maxPitchScaleFactor(),y=l.tilesIn(s,_,f);y.sort(ur);const v=[];for(const M of y)v.push({wrappedTileID:M.tileID.wrapped().key,queryResults:M.tile.queryRenderedFeatures(t,n,l._state,M.queryGeometry,M.cameraQueryGeometry,M.scale,u,p,_,gn(l.transform,M.tileID))});const E=function(M){const z={},V={};for(const U of M){const $=U.queryResults,H=U.wrappedTileID,Q=V[H]=V[H]||{};for(const oe in $){const N=$[oe],le=Q[oe]=Q[oe]||{},se=z[oe]=z[oe]||[];for(const me of N)le[me.featureIndex]||(le[me.featureIndex]=!0,se.push(me))}}return z}(v);for(const M in E)E[M].forEach(z=>{const V=z.feature,U=l.getFeatureState(V.layer["source-layer"],V.id);V.source=V.layer.source,V.layer["source-layer"]&&(V.sourceLayer=V.layer["source-layer"]),V.state=U});return E}function ur(l,t){const n=l.tileID,s=t.tileID;return n.overscaledZ-s.overscaledZ||n.canonical.y-s.canonical.y||n.wrap-s.wrap||n.canonical.x-s.canonical.x}class kr{constructor(t,n){this.tileID=t,this.uid=a.uniqueId(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.textures=[],this.textureCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const n=t+this.timeAdded;n<a.exported.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.textures.forEach(n=>t.saveTileTexture(n)),this.demTexture=null,this.textures=[],this.textureCoords={}}loadVectorData(t,n,s){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(u,p){const f={};if(!p)return f;for(const _ of u){const y=_.layerIds.map(v=>p.getLayer(v)).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(v=>y.filter(E=>E.id===v)[0]));for(const v of y)f[v.id]=_}}return f}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const u in this.buckets){const p=this.buckets[u];if(p instanceof a.SymbolBucket){if(this.hasSymbolBuckets=!0,!s)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const u in this.buckets){const p=this.buckets[u];if(p instanceof a.SymbolBucket&&p.hasRTLText){this.hasRTLText=!0,a.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const u in this.buckets){const p=this.buckets[u];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(u).queryRadius(p))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new a.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const s in this.buckets){const u=this.buckets[s];u.uploadPending()&&u.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Ie(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Ie(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,s,u,p,f,_,y,v,E){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:u,cameraQueryGeometry:p,scale:f,tileSize:this.tileSize,pixelPosMatrix:E,transform:y,params:_,queryPadding:this.queryPadding*v},t,n,s):{}}querySourceFeatures(t,n){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const u=s.loadVTLayers(),p=n?n.sourceLayer:"",f=u._geojsonTileLayer||u[p];if(!f)return;const _=a.createFilter(n&&n.filter),{z:y,x:v,y:E}=this.tileID.canonical,M={z:y,x:v,y:E};for(let z=0;z<f.length;z++){const V=f.feature(z);if(_.needGeometry){const H=a.toEvaluationFeature(V,!0);if(!_.filter(new a.EvaluationParameters(this.tileID.overscaledZ),H,this.tileID.canonical))continue}else if(!_.filter(new a.EvaluationParameters(this.tileID.overscaledZ),V))continue;const U=s.getId(V,p),$=new a.GeoJSONFeature(V,y,v,E,U);$.tile=M,t.push($)}}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 s=a.parseCacheControl(t.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const s=Date.now();let u=!1;if(this.expirationTime>s)u=!1;else if(n)if(this.expirationTime<n)u=!0;else{const p=this.expirationTime-n;p?this.expirationTime=s+Math.max(p,3e4):u=!0}else u=!0;u?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const u in this.buckets){if(!n.style.hasLayer(u))continue;const p=this.buckets[u],f=p.layers[0].sourceLayer||"_geojsonTileLayer",_=s[f],y=t[f];if(!_||!y||Object.keys(y).length===0)continue;p.update(y,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const v=n&&n.style&&n.style.getLayer(u);v&&(this.queryPadding=Math.max(this.queryPadding,v.queryRadius(p)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<a.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=a.exported.now()+t}setDependencies(t,n){const s={};for(const u of n)s[u]=!0;this.dependencies[t]=s}hasDependency(t,n){for(const s of t){const u=this.dependencies[s];if(u){for(const p of n)if(u[p])return!0}}return!1}}class Dr{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,s){const u=t.wrapped().key;this.data[u]===void 0&&(this.data[u]=[]);const p={value:n,timeout:void 0};if(s!==void 0&&(p.timeout=setTimeout(()=>{this.remove(t,p)},s)),this.data[u].push(p),this.order.push(u),this.order.length>this.max){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const s=t.wrapped().key,u=n===void 0?0:this.data[s].indexOf(n),p=this.data[s][u];return this.data[s].splice(u,1),p.timeout&&clearTimeout(p.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(p.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const s in this.data)for(const u of this.data[s])t(u.value)||n.push(u);for(const s of n)this.remove(s.value.tileID,s)}}class Lr{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,s){const u=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][u]=this.stateChanges[t][u]||{},a.extend(this.stateChanges[t][u],s),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==u&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][u]===null){this.deletedStates[t][u]={};for(const p in this.state[t][u])s[p]||(this.deletedStates[t][u][p]=null)}else for(const p in s)this.deletedStates[t]&&this.deletedStates[t][u]&&this.deletedStates[t][u][p]===null&&delete this.deletedStates[t][u][p]}removeFeatureState(t,n,s){if(this.deletedStates[t]===null)return;const u=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},s&&n!==void 0)this.deletedStates[t][u]!==null&&(this.deletedStates[t][u]=this.deletedStates[t][u]||{},this.deletedStates[t][u][s]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][u])for(s in this.deletedStates[t][u]={},this.stateChanges[t][u])this.deletedStates[t][u][s]=null;else this.deletedStates[t][u]=null;else this.deletedStates[t]=null}getState(t,n){const s=String(n),u=a.extend({},(this.state[t]||{})[s],(this.stateChanges[t]||{})[s]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const p=this.deletedStates[t][n];if(p===null)return{};for(const f in p)delete u[f]}return u}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const s={};for(const u in this.stateChanges){this.state[u]=this.state[u]||{};const p={};for(const f in this.stateChanges[u])this.state[u][f]||(this.state[u][f]={}),a.extend(this.state[u][f],this.stateChanges[u][f]),p[f]=this.state[u][f];s[u]=p}for(const u in this.deletedStates){this.state[u]=this.state[u]||{};const p={};if(this.deletedStates[u]===null)for(const f in this.state[u])p[f]={},this.state[u][f]={};else for(const f in this.deletedStates[u]){if(this.deletedStates[u][f]===null)this.state[u][f]={};else for(const _ of Object.keys(this.deletedStates[u][f]))delete this.state[u][f][_];p[f]=this.state[u][f]}s[u]=s[u]||{},a.extend(s[u],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const u in t)t[u].setFeatureState(s,n)}}class Li extends a.Evented{constructor(t,n,s){super(),this.id=t,this.dispatcher=s,this.on("data",u=>{u.dataType==="source"&&u.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&u.dataType==="source"&&u.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(u,p,f,_){const y=new mn[p.type](u,p,f,_);if(y.id!==u)throw new Error(`Expected Source id to be ${u} instead of ${y.id}`);return a.bindAll(["load","abort","unload","serialize","prepare"],y),y}(t,n,s,this),this._tiles={},this._cache=new Dr(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Lr}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}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){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new a.Event("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._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const s=this._tiles[n];s.upload(t),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(yn).map(t=>t.key)}getRenderableIds(t){const n=[];for(const s in this._tiles)this._isIdRenderable(s,t)&&n.push(this._tiles[s]);return t?n.sort((s,u)=>{const p=s.tileID,f=u.tileID,_=new a.pointGeometry(p.canonical.x,p.canonical.y)._rotate(this.transform.angle),y=new a.pointGeometry(f.canonical.x,f.canonical.y)._rotate(this.transform.angle);return p.overscaledZ-f.overscaledZ||y.y-_.y||y.x-_.x}).map(s=>s.tileID.key):n.map(s=>s.tileID).sort(yn).map(s=>s.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const s=this._tiles[t];s&&(s.state!=="loading"&&(s.state=n),this._loadTile(s,this._tileLoaded.bind(this,s,t,n)))}_tileLoaded(t,n,s,u){if(u)return t.state="errored",void(u.status!==404?this._source.fire(new a.ErrorEvent(u,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=a.exported.now(),s==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new a.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let u=0;u<n.length;u++){const p=n[u];if(t.neighboringTiles&&t.neighboringTiles[p]){const f=this.getTileByID(p);s(t,f),s(f,t)}}function s(u,p){u.needsHillshadePrepare=!0,u.needsTerrainPrepare=!0;let f=p.tileID.canonical.x-u.tileID.canonical.x;const _=p.tileID.canonical.y-u.tileID.canonical.y,y=Math.pow(2,u.tileID.canonical.z),v=p.tileID.key;f===0&&_===0||Math.abs(_)>1||(Math.abs(f)>1&&(Math.abs(f+y)===1?f+=y:Math.abs(f-y)===1&&(f-=y)),p.dem&&u.dem&&(u.dem.backfillBorder(p.dem,f,_),u.neighboringTiles&&u.neighboringTiles[v]&&(u.neighboringTiles[v].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,s,u){for(const p in this._tiles){let f=this._tiles[p];if(u[p]||!f.hasData()||f.tileID.overscaledZ<=n||f.tileID.overscaledZ>s)continue;let _=f.tileID;for(;f&&f.tileID.overscaledZ>n+1;){const v=f.tileID.scaledTo(f.tileID.overscaledZ-1);f=this._tiles[v.key],f&&f.hasData()&&(_=v)}let y=_;for(;y.overscaledZ>n;)if(y=y.scaledTo(y.overscaledZ-1),t[y.key]){u[_.key]=_;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const s=this._loadedParentTiles[t.key];return s&&s.tileID.overscaledZ>=n?s:null}for(let s=t.overscaledZ-1;s>=n;s--){const u=t.scaledTo(s),p=this._getLoadedTile(u);if(p)return p}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,s=Math.ceil(t.height/this._source.tileSize)+1,u=Math.floor(n*s*5),p=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,u):u;this._cache.setMaxSize(p)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const s={};for(const u in this._tiles){const p=this._tiles[u];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),s[p.tileID.key]=p}this._tiles=s;for(const u in this._timers)clearTimeout(this._timers[u]),delete this._timers[u];for(const u in this._tiles)this._setTileReloadTimer(u,this._tiles[u])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let s;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(v=>new a.OverscaledTileID(v.canonical.z,v.wrap,v.canonical.z,v.canonical.x,v.canonical.y)):(s=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(s=s.filter(v=>this._source.hasTile(v)))):s=[];const u=t.coveringZoomLevel(this._source),p=Math.max(u-Li.maxOverzooming,this._source.minzoom),f=Math.max(u+Li.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const v={};for(const E of s)if(E.canonical.z>this._source.minzoom){const M=E.scaledTo(E.canonical.z-1);v[M.key]=M;const z=E.scaledTo(Math.max(this._source.minzoom,Math.min(E.canonical.z,5)));v[z.key]=z}s=s.concat(Object.values(v))}const _=this._updateRetainedTiles(s,u);if(Zn(this._source.type)){const v={},E={},M=Object.keys(_);for(const z of M){const V=_[z],U=this._tiles[z];if(!U||U.fadeEndTime&&U.fadeEndTime<=a.exported.now())continue;const $=this.findLoadedParent(V,p);$&&(this._addTile($.tileID),v[$.tileID.key]=$.tileID),E[z]=V}this._retainLoadedChildren(E,u,f,_);for(const z in v)_[z]||(this._coveredTiles[z]=!0,_[z]=v[z]);if(n){const z={},V={};for(const U of s)this._tiles[U.key].hasData()?z[U.key]=U:V[U.key]=U;for(const U in V){const $=V[U].children(this._source.maxzoom);this._tiles[$[0].key]&&this._tiles[$[1].key]&&this._tiles[$[2].key]&&this._tiles[$[3].key]&&(z[$[0].key]=_[$[0].key]=$[0],z[$[1].key]=_[$[1].key]=$[1],z[$[2].key]=_[$[2].key]=$[2],z[$[3].key]=_[$[3].key]=$[3],delete V[U])}for(const U in V){const $=this.findLoadedParent(V[U],this._source.minzoom);if($){z[$.tileID.key]=_[$.tileID.key]=$.tileID;for(const H in z)z[H].isChildOf($.tileID)&&delete z[H]}}for(const U in this._tiles)z[U]||(this._coveredTiles[U]=!0)}}for(const v in _)this._tiles[v].clearFadeHold();const y=a.keysDifference(this._tiles,_);for(const v of y){const E=this._tiles[v];E.hasSymbolBuckets&&!E.holdingForFade()?E.setHoldDuration(this.map._fadeDuration):E.hasSymbolBuckets&&!E.symbolFadeFinished()||this._removeTile(v)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const s={},u={},p=Math.max(n-Li.maxOverzooming,this._source.minzoom),f=Math.max(n+Li.maxUnderzooming,this._source.minzoom),_={};for(const y of t){const v=this._addTile(y);s[y.key]=y,v.hasData()||n<this._source.maxzoom&&(_[y.key]=y)}this._retainLoadedChildren(_,n,f,s);for(const y of t){let v=this._tiles[y.key];if(v.hasData())continue;if(n+1>this._source.maxzoom){const M=y.children(this._source.maxzoom)[0],z=this.getTile(M);if(z&&z.hasData()){s[M.key]=M;continue}}else{const M=y.children(this._source.maxzoom);if(s[M[0].key]&&s[M[1].key]&&s[M[2].key]&&s[M[3].key])continue}let E=v.wasRequested();for(let M=y.overscaledZ-1;M>=p;--M){const z=y.scaledTo(M);if(u[z.key]||(u[z.key]=!0,v=this.getTile(z),!v&&E&&(v=this._addTile(z)),v&&(s[z.key]=z,E=v.wasRequested(),v.hasData())))break}}return s}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let s,u=this._tiles[t].tileID;for(;u.overscaledZ>0;){if(u.key in this._loadedParentTiles){s=this._loadedParentTiles[u.key];break}n.push(u.key);const p=u.scaledTo(u.overscaledZ-1);if(s=this._getLoadedTile(p),s)break;u=p}for(const p of n)this._loadedParentTiles[p]=s}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const s=n;return n||(n=new kr(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,s||this._source.fire(new a.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const s=n.getExpiryTimeout();s&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},s))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,s){const u=[],p=this.transform;if(!p)return u;const f=s?p.getCameraQueryGeometry(t):t,_=t.map(U=>p.pointCoordinate(U,this.terrain)),y=f.map(U=>p.pointCoordinate(U,this.terrain)),v=this.getIds();let E=1/0,M=1/0,z=-1/0,V=-1/0;for(const U of y)E=Math.min(E,U.x),M=Math.min(M,U.y),z=Math.max(z,U.x),V=Math.max(V,U.y);for(let U=0;U<v.length;U++){const $=this._tiles[v[U]];if($.holdingForFade())continue;const H=$.tileID,Q=Math.pow(2,p.zoom-$.tileID.overscaledZ),oe=n*$.queryPadding*a.EXTENT/$.tileSize/Q,N=[H.getTilePoint(new a.MercatorCoordinate(E,M)),H.getTilePoint(new a.MercatorCoordinate(z,V))];if(N[0].x-oe<a.EXTENT&&N[0].y-oe<a.EXTENT&&N[1].x+oe>=0&&N[1].y+oe>=0){const le=_.map(me=>H.getTilePoint(me)),se=y.map(me=>H.getTilePoint(me));u.push({tile:$,tileID:H,queryGeometry:le,cameraQueryGeometry:se,scale:Q})}}return u}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(s=>this._tiles[s].tileID);for(const s of n)s.posMatrix=this.transform.calculatePosMatrix(s.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(Zn(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=a.exported.now())return!0}return!1}setFeatureState(t,n,s){this._state.updateState(t=t||"_geojsonTileLayer",n,s)}removeFeatureState(t,n,s){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,s)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,s){const u=this._tiles[t];u&&u.setDependencies(n,s)}reloadTilesForDependencies(t,n){for(const s in this._tiles)this._tiles[s].hasDependency(t,n)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(t,n))}}function yn(l,t){const n=Math.abs(2*l.wrap)-+(l.wrap<0),s=Math.abs(2*t.wrap)-+(t.wrap<0);return l.overscaledZ-t.overscaledZ||s-n||t.canonical.y-l.canonical.y||t.canonical.x-l.canonical.x}function Zn(l){return l==="raster"||l==="image"||l==="video"}Li.maxOverzooming=10,Li.maxUnderzooming=3;const vr="mapboxgl_preloaded_worker_pool";class $i{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<$i.workerCount;)this.workers.push(new Worker(on.workerUrl));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[vr]}numActive(){return Object.keys(this.active).length}}const jn=Math.floor(a.exported.hardwareConcurrency/2);let Rr;function xn(){return Rr||(Rr=new $i),Rr}function vn(l,t){const n={};for(const s in l)s!=="ref"&&(n[s]=l[s]);return a.refProperties.forEach(s=>{s in t&&(n[s]=t[s])}),n}function Xn(l){l=l.slice();const t=Object.create(null);for(let n=0;n<l.length;n++)t[l[n].id]=l[n];for(let n=0;n<l.length;n++)"ref"in l[n]&&(l[n]=vn(l[n],t[l[n].ref]));return l}$i.workerCount=Math.max(Math.min(jn,6),1);const vt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function hr(l,t,n){n.push({command:vt.addSource,args:[l,t[l]]})}function Br(l,t,n){t.push({command:vt.removeSource,args:[l]}),n[l]=!0}function Fr(l,t,n,s){Br(l,n,s),hr(l,t,n)}function Wn(l,t,n){let s;for(s in l[n])if(Object.prototype.hasOwnProperty.call(l[n],s)&&s!=="data"&&!ue(l[n][s],t[n][s]))return!1;for(s in t[n])if(Object.prototype.hasOwnProperty.call(t[n],s)&&s!=="data"&&!ue(l[n][s],t[n][s]))return!1;return!0}function br(l,t,n,s,u,p){let f;for(f in t=t||{},l=l||{})Object.prototype.hasOwnProperty.call(l,f)&&(ue(l[f],t[f])||n.push({command:p,args:[s,f,t[f],u]}));for(f in t)Object.prototype.hasOwnProperty.call(t,f)&&!Object.prototype.hasOwnProperty.call(l,f)&&(ue(l[f],t[f])||n.push({command:p,args:[s,f,t[f],u]}))}function wr(l){return l.id}function bn(l,t){return l[t.id]=t,l}class Tr{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let s=1;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-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=a.clamp(t,0,1);let n=1,s=this._distances[n];const u=t*this.paddedLength+this.padding;for(;s<u&&n<this._distances.length;)s=this._distances[++n];const p=n-1,f=this._distances[p],_=s-f,y=_>0?(u-f)/_:0;return this.points[p].mult(1-y).add(this.points[n].mult(y))}}function _e(l,t){let n=!0;return l==="always"||l!=="never"&&t!=="never"||(n=!1),n}class Pe{constructor(t,n,s){const u=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/s),this.yCellCount=Math.ceil(n/s);for(let f=0;f<this.xCellCount*this.yCellCount;f++)u.push([]),p.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,s,u,p){this._forEachCell(n,s,u,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(u),this.bboxes.push(p)}insertCircle(t,n,s,u){this._forEachCell(n-u,s-u,n+u,s+u,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(s),this.circles.push(u)}_insertBoxCell(t,n,s,u,p,f){this.boxCells[p].push(f)}_insertCircleCell(t,n,s,u,p,f){this.circleCells[p].push(f)}_query(t,n,s,u,p,f,_){if(s<0||t>this.width||u<0||n>this.height)return[];const y=[];if(t<=0&&n<=0&&this.width<=s&&this.height<=u){if(p)return[{key:null,x1:t,y1:n,x2:s,y2:u}];for(let v=0;v<this.boxKeys.length;v++)y.push({key:this.boxKeys[v],x1:this.bboxes[4*v],y1:this.bboxes[4*v+1],x2:this.bboxes[4*v+2],y2:this.bboxes[4*v+3]});for(let v=0;v<this.circleKeys.length;v++){const E=this.circles[3*v],M=this.circles[3*v+1],z=this.circles[3*v+2];y.push({key:this.circleKeys[v],x1:E-z,y1:M-z,x2:E+z,y2:M+z})}}else this._forEachCell(t,n,s,u,this._queryCell,y,{hitTest:p,overlapMode:f,seenUids:{box:{},circle:{}}},_);return y}query(t,n,s,u){return this._query(t,n,s,u,!1,null)}hitTest(t,n,s,u,p,f){return this._query(t,n,s,u,!0,p,f).length>0}hitTestCircle(t,n,s,u,p){const f=t-s,_=t+s,y=n-s,v=n+s;if(_<0||f>this.width||v<0||y>this.height)return!1;const E=[];return this._forEachCell(f,y,_,v,this._queryCellCircle,E,{hitTest:!0,overlapMode:u,circle:{x:t,y:n,radius:s},seenUids:{box:{},circle:{}}},p),E.length>0}_queryCell(t,n,s,u,p,f,_,y){const{seenUids:v,hitTest:E,overlapMode:M}=_,z=this.boxCells[p];if(z!==null){const U=this.bboxes;for(const $ of z)if(!v.box[$]){v.box[$]=!0;const H=4*$,Q=this.boxKeys[$];if(t<=U[H+2]&&n<=U[H+3]&&s>=U[H+0]&&u>=U[H+1]&&(!y||y(Q))&&(!E||!_e(M,Q.overlapMode))&&(f.push({key:Q,x1:U[H],y1:U[H+1],x2:U[H+2],y2:U[H+3]}),E))return!0}}const V=this.circleCells[p];if(V!==null){const U=this.circles;for(const $ of V)if(!v.circle[$]){v.circle[$]=!0;const H=3*$,Q=this.circleKeys[$];if(this._circleAndRectCollide(U[H],U[H+1],U[H+2],t,n,s,u)&&(!y||y(Q))&&(!E||!_e(M,Q.overlapMode))){const oe=U[H],N=U[H+1],le=U[H+2];if(f.push({key:Q,x1:oe-le,y1:N-le,x2:oe+le,y2:N+le}),E)return!0}}}return!1}_queryCellCircle(t,n,s,u,p,f,_,y){const{circle:v,seenUids:E,overlapMode:M}=_,z=this.boxCells[p];if(z!==null){const U=this.bboxes;for(const $ of z)if(!E.box[$]){E.box[$]=!0;const H=4*$,Q=this.boxKeys[$];if(this._circleAndRectCollide(v.x,v.y,v.radius,U[H+0],U[H+1],U[H+2],U[H+3])&&(!y||y(Q))&&!_e(M,Q.overlapMode))return f.push(!0),!0}}const V=this.circleCells[p];if(V!==null){const U=this.circles;for(const $ of V)if(!E.circle[$]){E.circle[$]=!0;const H=3*$,Q=this.circleKeys[$];if(this._circlesCollide(U[H],U[H+1],U[H+2],v.x,v.y,v.radius)&&(!y||y(Q))&&!_e(M,Q.overlapMode))return f.push(!0),!0}}}_forEachCell(t,n,s,u,p,f,_,y){const v=this._convertToXCellCoord(t),E=this._convertToYCellCoord(n),M=this._convertToXCellCoord(s),z=this._convertToYCellCoord(u);for(let V=v;V<=M;V++)for(let U=E;U<=z;U++)if(p.call(this,t,n,s,u,this.xCellCount*U+V,f,_,y))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,s,u,p,f){const _=u-t,y=p-n,v=s+f;return v*v>_*_+y*y}_circleAndRectCollide(t,n,s,u,p,f,_){const y=(f-u)/2,v=Math.abs(t-(u+y));if(v>y+s)return!1;const E=(_-p)/2,M=Math.abs(n-(p+E));if(M>E+s)return!1;if(v<=y||M<=E)return!0;const z=v-y,V=M-E;return z*z+V*V<=s*s}}function Kr(l,t,n,s,u){const p=a.create();return t?(a.scale(p,p,[1/u,1/u,1]),n||a.rotateZ(p,p,s.angle)):a.multiply(p,s.labelPlaneMatrix,l),p}function ir(l,t,n,s,u){if(t){const p=a.clone(l);return a.scale(p,p,[u,u,1]),n||a.rotateZ(p,p,-s.angle),p}return s.glCoordMatrix}function bt(l,t,n){let s;n?(s=[l.x,l.y,n(l.x,l.y),1],a.transformMat4(s,s,t)):(s=[l.x,l.y,0,1],Er(s,s,t));const u=s[3];return{point:new a.pointGeometry(s[0]/u,s[1]/u),signedDistanceFromCamera:u}}function Ji(l,t){return .5+l/t*.5}function Vi(l,t){const n=l[0]/l[3],s=l[1]/l[3];return n>=-t[0]&&n<=t[0]&&s>=-t[1]&&s<=t[1]}function Ni(l,t,n,s,u,p,f,_,y,v){const E=s?l.textSizeData:l.iconSizeData,M=a.evaluateSizeForZoom(E,n.transform.zoom),z=[256/n.width*2+1,256/n.height*2+1],V=s?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;V.clear();const U=l.lineVertexArray,$=s?l.text.placedSymbolArray:l.icon.placedSymbolArray,H=n.transform.width/n.transform.height;let Q=!1;for(let oe=0;oe<$.length;oe++){const N=$.get(oe);if(N.hidden||N.writingMode===a.WritingMode.vertical&&!Q){rt(N.numGlyphs,V);continue}let le;if(Q=!1,v?(le=[N.anchorX,N.anchorY,v(N.anchorX,N.anchorY),1],a.transformMat4(le,le,t)):(le=[N.anchorX,N.anchorY,0,1],Er(le,le,t)),!Vi(le,z)){rt(N.numGlyphs,V);continue}const se=Ji(n.transform.cameraToCenterDistance,le[3]),me=a.evaluateSizeForFeature(E,M,N),ge=f?me/se:me*se,we=new a.pointGeometry(N.anchorX,N.anchorY),fe=bt(we,u,v).point,Fe={},Ae=at(N,ge,!1,_,t,u,p,l.glyphOffsetArray,U,V,fe,we,Fe,H,y,v);Q=Ae.useVertical,(Ae.notEnoughRoom||Q||Ae.needsFlipping&&at(N,ge,!0,_,t,u,p,l.glyphOffsetArray,U,V,fe,we,Fe,H,y,v).notEnoughRoom)&&rt(N.numGlyphs,V)}s?l.text.dynamicLayoutVertexBuffer.updateData(V):l.icon.dynamicLayoutVertexBuffer.updateData(V)}function Or(l,t,n,s,u,p,f,_,y,v,E,M,z){const V=_.glyphStartIndex+_.numGlyphs,U=_.lineStartIndex,$=_.lineStartIndex+_.lineLength,H=t.getoffsetX(_.glyphStartIndex),Q=t.getoffsetX(V-1),oe=gi(l*H,n,s,u,p,f,_.segment,U,$,y,v,E,M,z);if(!oe)return null;const N=gi(l*Q,n,s,u,p,f,_.segment,U,$,y,v,E,M,z);return N?{first:oe,last:N}:null}function Ce(l,t,n,s){return l===a.WritingMode.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*s?{useVertical:!0}:(l===a.WritingMode.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function at(l,t,n,s,u,p,f,_,y,v,E,M,z,V,U,$){const H=t/24,Q=l.lineOffsetX*H,oe=l.lineOffsetY*H;let N;if(l.numGlyphs>1){const le=l.glyphStartIndex+l.numGlyphs,se=l.lineStartIndex,me=l.lineStartIndex+l.lineLength,ge=Or(H,_,Q,oe,n,E,M,l,y,p,z,U,$);if(!ge)return{notEnoughRoom:!0};const we=bt(ge.first.point,f,$).point,fe=bt(ge.last.point,f,$).point;if(s&&!n){const Fe=Ce(l.writingMode,we,fe,V);if(Fe)return Fe}N=[ge.first];for(let Fe=l.glyphStartIndex+1;Fe<le-1;Fe++)N.push(gi(H*_.getoffsetX(Fe),Q,oe,n,E,M,l.segment,se,me,y,p,z,U,$));N.push(ge.last)}else{if(s&&!n){const se=bt(M,u,$).point,me=l.lineStartIndex+l.segment+1,ge=new a.pointGeometry(y.getx(me),y.gety(me)),we=bt(ge,u,$),fe=we.signedDistanceFromCamera>0?we.point:nt(M,ge,se,1,u,$),Fe=Ce(l.writingMode,se,fe,V);if(Fe)return Fe}const le=gi(H*_.getoffsetX(l.glyphStartIndex),Q,oe,n,E,M,l.segment,l.lineStartIndex,l.lineStartIndex+l.lineLength,y,p,z,U,$);if(!le)return{notEnoughRoom:!0};N=[le]}for(const le of N)a.addDynamicAttributes(v,le.point,le.angle);return{}}function nt(l,t,n,s,u,p){const f=bt(l.add(l.sub(t)._unit()),u,p).point,_=n.sub(f);return n.add(_._mult(s/_.mag()))}function gi(l,t,n,s,u,p,f,_,y,v,E,M,z,V){const U=s?l-t:l+t;let $=U>0?1:-1,H=0;s&&($*=-1,H=Math.PI),$<0&&(H+=Math.PI);let Q=$>0?_+f:_+f+1,oe=u,N=u,le=0,se=0;const me=Math.abs(U),ge=[];for(;le+se<=me;){if(Q+=$,Q<_||Q>=y)return null;if(N=oe,ge.push(oe),oe=M[Q],oe===void 0){const Oe=new a.pointGeometry(v.getx(Q),v.gety(Q)),ot=bt(Oe,E,V);if(ot.signedDistanceFromCamera>0)oe=M[Q]=ot.point;else{const ct=Q-$;oe=nt(le===0?p:new a.pointGeometry(v.getx(ct),v.gety(ct)),Oe,N,me-le+1,E,V)}}le+=se,se=N.dist(oe)}const we=(me-le)/se,fe=oe.sub(N),Fe=fe.mult(we)._add(N);Fe._add(fe._unit()._perp()._mult(n*$));const Ae=H+Math.atan2(oe.y-N.y,oe.x-N.x);return ge.push(Fe),{point:Fe,angle:z?Ae:0,path:ge}}const Ur=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function rt(l,t){for(let n=0;n<l;n++){const s=t.length;t.resize(s+4),t.float32.set(Ur,3*s)}}function Er(l,t,n){const s=t[0],u=t[1];return l[0]=n[0]*s+n[4]*u+n[12],l[1]=n[1]*s+n[5]*u+n[13],l[3]=n[3]*s+n[7]*u+n[15],l}const li=100;class wn{constructor(t,n=new Pe(t.width+200,t.height+200,25),s=new Pe(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=s,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+li,this.screenBottomBoundary=t.height+li,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,s,u,p,f){const _=this.projectAndGetPerspectiveRatio(u,t.anchorPointX,t.anchorPointY,f),y=s*_.perspectiveRatio,v=t.x1*y+_.point.x,E=t.y1*y+_.point.y,M=t.x2*y+_.point.x,z=t.y2*y+_.point.y;return!this.isInsideGrid(v,E,M,z)||n!=="always"&&this.grid.hitTest(v,E,M,z,n,p)||_.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[v,E,M,z],offscreen:this.isOffscreen(v,E,M,z)}}placeCollisionCircles(t,n,s,u,p,f,_,y,v,E,M,z,V,U){const $=[],H=new a.pointGeometry(n.anchorX,n.anchorY),Q=bt(H,f,U),oe=Ji(this.transform.cameraToCenterDistance,Q.signedDistanceFromCamera),N=(E?p/oe:p*oe)/a.ONE_EM,le=bt(H,_,U).point,se=Or(N,u,n.lineOffsetX*N,n.lineOffsetY*N,!1,le,H,n,s,_,{},!1,U);let me=!1,ge=!1,we=!0;if(se){const fe=.5*z*oe+V,Fe=new a.pointGeometry(-100,-100),Ae=new a.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),Oe=new Tr,ot=se.first,ct=se.last;let Xe=[];for(let yt=ot.path.length-1;yt>=1;yt--)Xe.push(ot.path[yt]);for(let yt=1;yt<ct.path.length;yt++)Xe.push(ct.path[yt]);const Pt=2.5*fe;if(y){const yt=Xe.map(Et=>bt(Et,y,U));Xe=yt.some(Et=>Et.signedDistanceFromCamera<=0)?[]:yt.map(Et=>Et.point)}let zt=[];if(Xe.length>0){const yt=Xe[0].clone(),Et=Xe[0].clone();for(let Dt=1;Dt<Xe.length;Dt++)yt.x=Math.min(yt.x,Xe[Dt].x),yt.y=Math.min(yt.y,Xe[Dt].y),Et.x=Math.max(Et.x,Xe[Dt].x),Et.y=Math.max(Et.y,Xe[Dt].y);zt=yt.x>=Fe.x&&Et.x<=Ae.x&&yt.y>=Fe.y&&Et.y<=Ae.y?[Xe]:Et.x<Fe.x||yt.x>Ae.x||Et.y<Fe.y||yt.y>Ae.y?[]:a.clipLine([Xe],Fe.x,Fe.y,Ae.x,Ae.y)}for(const yt of zt){Oe.reset(yt,.25*fe);let Et=0;Et=Oe.length<=.5*fe?1:Math.ceil(Oe.paddedLength/Pt)+1;for(let Dt=0;Dt<Et;Dt++){const ui=Dt/Math.max(Et-1,1),mr=Oe.lerp(ui),nr=mr.x+li,gr=mr.y+li;$.push(nr,gr,fe,0);const jr=nr-fe,Qi=gr-fe,Bi=nr+fe,Cr=gr+fe;if(we=we&&this.isOffscreen(jr,Qi,Bi,Cr),ge=ge||this.isInsideGrid(jr,Qi,Bi,Cr),t!=="always"&&this.grid.hitTestCircle(nr,gr,fe,t,M)&&(me=!0,!v))return{circles:[],offscreen:!1,collisionDetected:me}}}}return{circles:!v&&me||!ge||oe<this.perspectiveRatioCutoff?[]:$,offscreen:we,collisionDetected:me}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let s=1/0,u=1/0,p=-1/0,f=-1/0;for(const E of t){const M=new a.pointGeometry(E.x+li,E.y+li);s=Math.min(s,M.x),u=Math.min(u,M.y),p=Math.max(p,M.x),f=Math.max(f,M.y),n.push(M)}const _=this.grid.query(s,u,p,f).concat(this.ignoredGrid.query(s,u,p,f)),y={},v={};for(const E of _){const M=E.key;if(y[M.bucketInstanceId]===void 0&&(y[M.bucketInstanceId]={}),y[M.bucketInstanceId][M.featureIndex])continue;const z=[new a.pointGeometry(E.x1,E.y1),new a.pointGeometry(E.x2,E.y1),new a.pointGeometry(E.x2,E.y2),new a.pointGeometry(E.x1,E.y2)];a.polygonIntersectsPolygon(n,z)&&(y[M.bucketInstanceId][M.featureIndex]=!0,v[M.bucketInstanceId]===void 0&&(v[M.bucketInstanceId]=[]),v[M.bucketInstanceId].push(M.featureIndex))}return v}insertCollisionBox(t,n,s,u,p,f){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:u,featureIndex:p,collisionGroupID:f,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,s,u,p,f){const _=s?this.ignoredGrid:this.grid,y={bucketInstanceId:u,featureIndex:p,collisionGroupID:f,overlapMode:n};for(let v=0;v<t.length;v+=4)_.insertCircle(y,t[v],t[v+1],t[v+2])}projectAndGetPerspectiveRatio(t,n,s,u){let p;return u?(p=[n,s,u(n,s),1],a.transformMat4(p,p,t)):(p=[n,s,0,1],Er(p,p,t)),{point:new a.pointGeometry((p[0]/p[3]+1)/2*this.transform.width+li,(-p[1]/p[3]+1)/2*this.transform.height+li),perspectiveRatio:.5+this.transform.cameraToCenterDistance/p[3]*.5}}isOffscreen(t,n,s,u){return s<li||t>=this.screenRightBoundary||u<li||n>this.screenBottomBoundary}isInsideGrid(t,n,s,u){return s>=0&&t<this.gridRightBoundary&&u>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=a.identity([]);return a.translate(t,t,[-100,-100,0]),t}}function ti(l,t,n){return t*(a.EXTENT/(l.tileSize*Math.pow(2,n-l.tileID.overscaledZ)))}class Ci{constructor(t,n,s,u){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):u&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class kt{constructor(t,n,s,u,p){this.text=new Ci(t?t.text:null,n,s,p),this.icon=new Ci(t?t.icon:null,n,u,p)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Tn{constructor(t,n,s){this.text=t,this.icon=n,this.skipFade=s}}class pr{constructor(){this.invProjMatrix=a.create(),this.viewportMatrix=a.create(),this.circles=[]}}class Jr{constructor(t,n,s,u,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=s,this.bucketIndex=u,this.tileID=p}}class Yr{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:s=>s.collisionGroupID===n}}return this.collisionGroups[t]}}function En(l,t,n,s,u){const{horizontalAlign:p,verticalAlign:f}=a.getAnchorAlignment(l),_=-(p-.5)*t,y=-(f-.5)*n,v=a.evaluateVariableOffset(l,s);return new a.pointGeometry(_+v[0]*u,y+v[1]*u)}function Qr(l,t,n,s,u,p){const{x1:f,x2:_,y1:y,y2:v,anchorPointX:E,anchorPointY:M}=l,z=new a.pointGeometry(t,n);return s&&z._rotate(u?p:-p),{x1:f+z.x,y1:y+z.y,x2:_+z.x,y2:v+z.y,anchorPointX:E,anchorPointY:M}}class O{constructor(t,n,s,u,p){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new wn(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new Yr(u),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,s,u){const p=s.getBucket(n),f=s.latestFeatureIndex;if(!p||!f||n.id!==p.layerIds[0])return;const _=s.collisionBoxArray,y=p.layers[0].layout,v=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),E=s.tileSize/a.EXTENT,M=this.transform.calculatePosMatrix(s.tileID.toUnwrapped()),z=y.get("text-pitch-alignment")==="map",V=y.get("text-rotation-alignment")==="map",U=ti(s,1,this.transform.zoom),$=Kr(M,z,V,this.transform,U);let H=null;if(z){const oe=ir(M,z,V,this.transform,U);H=a.multiply([],this.transform.labelPlaneMatrix,oe)}this.retainedQueryData[p.bucketInstanceId]=new Jr(p.bucketInstanceId,f,p.sourceLayerIndex,p.index,s.tileID);const Q={bucket:p,layout:y,posMatrix:M,textLabelPlaneMatrix:$,labelToScreenMatrix:H,scale:v,textPixelRatio:E,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:a.evaluateSizeForZoom(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(u)for(const oe of p.sortKeyRanges){const{sortKey:N,symbolInstanceStart:le,symbolInstanceEnd:se}=oe;t.push({sortKey:N,symbolInstanceStart:le,symbolInstanceEnd:se,parameters:Q})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:Q})}attemptAnchorPlacement(t,n,s,u,p,f,_,y,v,E,M,z,V,U,$,H){const Q=[z.textOffset0,z.textOffset1],oe=En(t,s,u,Q,p),N=this.collisionIndex.placeCollisionBox(Qr(n,oe.x,oe.y,f,_,this.transform.angle),M,y,v,E.predicate,H);if((!$||this.collisionIndex.placeCollisionBox(Qr($,oe.x,oe.y,f,_,this.transform.angle),M,y,v,E.predicate,H).box.length!==0)&&N.box.length>0){let le;if(this.prevPlacement&&this.prevPlacement.variableOffsets[z.crossTileID]&&this.prevPlacement.placements[z.crossTileID]&&this.prevPlacement.placements[z.crossTileID].text&&(le=this.prevPlacement.variableOffsets[z.crossTileID].anchor),z.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[z.crossTileID]={textOffset:Q,width:s,height:u,anchor:t,textBoxScale:p,prevAnchor:le},this.markUsedJustification(V,t,z,U),V.allowVerticalPlacement&&(this.markUsedOrientation(V,U,z),this.placedOrientations[z.crossTileID]=U),{shift:oe,placedGlyphBoxes:N}}}placeLayerBucketPart(t,n,s){const{bucket:u,layout:p,posMatrix:f,textLabelPlaneMatrix:_,labelToScreenMatrix:y,textPixelRatio:v,holdingForFade:E,collisionBoxArray:M,partiallyEvaluatedTextSize:z,collisionGroup:V}=t.parameters,U=p.get("text-optional"),$=p.get("icon-optional"),H=a.getOverlapMode(p,"text-overlap","text-allow-overlap"),Q=H==="always",oe=a.getOverlapMode(p,"icon-overlap","icon-allow-overlap"),N=oe==="always",le=p.get("text-rotation-alignment")==="map",se=p.get("text-pitch-alignment")==="map",me=p.get("icon-text-fit")!=="none",ge=p.get("symbol-z-order")==="viewport-y",we=Q&&(N||!u.hasIconData()||$),fe=N&&(Q||!u.hasTextData()||U);!u.collisionArrays&&M&&u.deserializeCollisionBoxes(M);const Fe=(Ae,Oe)=>{if(n[Ae.crossTileID])return;if(E)return void(this.placements[Ae.crossTileID]=new Tn(!1,!1,!1));let ot=!1,ct=!1,Xe=!0,Pt=null,zt={box:null,offscreen:null},yt={box:null,offscreen:null},Et=null,Dt=null,ui=null,mr=0,nr=0,gr=0;Oe.textFeatureIndex?mr=Oe.textFeatureIndex:Ae.useRuntimeCollisionCircles&&(mr=Ae.featureIndex),Oe.verticalTextFeatureIndex&&(nr=Oe.verticalTextFeatureIndex);const jr=this.retainedQueryData[u.bucketInstanceId].tileID,Qi=this.terrain?(oi,pt)=>this.terrain.getElevation(jr,oi,pt):null;for(const oi of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const pt=Oe[oi];pt&&(pt.elevation=Qi?Qi(pt.anchorPointX,pt.anchorPointY):0)}const Bi=Oe.textBox;if(Bi){const oi=Mt=>{let hi=a.WritingMode.horizontal;if(u.allowVerticalPlacement&&!Mt&&this.prevPlacement){const pi=this.prevPlacement.placedOrientations[Ae.crossTileID];pi&&(this.placedOrientations[Ae.crossTileID]=pi,hi=pi,this.markUsedOrientation(u,hi,Ae))}return hi},pt=(Mt,hi)=>{if(u.allowVerticalPlacement&&Ae.numVerticalGlyphVertices>0&&Oe.verticalTextBox){for(const pi of u.writingModes)if(pi===a.WritingMode.vertical?(zt=hi(),yt=zt):zt=Mt(),zt&&zt.box&&zt.box.length)break}else zt=Mt()};if(p.get("text-variable-anchor")){let Mt=p.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ae.crossTileID]){const qt=this.prevPlacement.variableOffsets[Ae.crossTileID];Mt.indexOf(qt.anchor)>0&&(Mt=Mt.filter(er=>er!==qt.anchor),Mt.unshift(qt.anchor))}const hi=(qt,er,sn)=>{const $s=qt.x2-qt.x1,Fn=qt.y2-qt.y1,Ja=Ae.textBoxScale,Vs=me&&oe==="never"?er:null;let Xr={box:[],offscreen:!1};const an=H!=="never"?2*Mt.length:Mt.length;for(let ln=0;ln<an;++ln){const Xo=this.attemptAnchorPlacement(Mt[ln%Mt.length],qt,$s,Fn,Ja,le,se,v,f,V,ln>=Mt.length?H:"never",Ae,u,sn,Vs,Qi);if(Xo&&(Xr=Xo.placedGlyphBoxes,Xr&&Xr.box&&Xr.box.length)){ot=!0,Pt=Xo.shift;break}}return Xr};pt(()=>hi(Bi,Oe.iconBox,a.WritingMode.horizontal),()=>{const qt=Oe.verticalTextBox;return u.allowVerticalPlacement&&!(zt&&zt.box&&zt.box.length)&&Ae.numVerticalGlyphVertices>0&&qt?hi(qt,Oe.verticalIconBox,a.WritingMode.vertical):{box:null,offscreen:null}}),zt&&(ot=zt.box,Xe=zt.offscreen);const pi=oi(zt&&zt.box);if(!ot&&this.prevPlacement){const qt=this.prevPlacement.variableOffsets[Ae.crossTileID];qt&&(this.variableOffsets[Ae.crossTileID]=qt,this.markUsedJustification(u,qt.anchor,Ae,pi))}}else{const Mt=(hi,pi)=>{const qt=this.collisionIndex.placeCollisionBox(hi,H,v,f,V.predicate,Qi);return qt&&qt.box&&qt.box.length&&(this.markUsedOrientation(u,pi,Ae),this.placedOrientations[Ae.crossTileID]=pi),qt};pt(()=>Mt(Bi,a.WritingMode.horizontal),()=>{const hi=Oe.verticalTextBox;return u.allowVerticalPlacement&&Ae.numVerticalGlyphVertices>0&&hi?Mt(hi,a.WritingMode.vertical):{box:null,offscreen:null}}),oi(zt&&zt.box&&zt.box.length)}}if(Et=zt,ot=Et&&Et.box&&Et.box.length>0,Xe=Et&&Et.offscreen,Ae.useRuntimeCollisionCircles){const oi=u.text.placedSymbolArray.get(Ae.centerJustifiedTextSymbolIndex),pt=a.evaluateSizeForFeature(u.textSizeData,z,oi),Mt=p.get("text-padding");Dt=this.collisionIndex.placeCollisionCircles(H,oi,u.lineVertexArray,u.glyphOffsetArray,pt,f,_,y,s,se,V.predicate,Ae.collisionCircleDiameter,Mt,Qi),Dt.circles.length&&Dt.collisionDetected&&!s&&a.warnOnce("Collisions detected, but collision boxes are not shown"),ot=Q||Dt.circles.length>0&&!Dt.collisionDetected,Xe=Xe&&Dt.offscreen}if(Oe.iconFeatureIndex&&(gr=Oe.iconFeatureIndex),Oe.iconBox){const oi=pt=>{const Mt=me&&Pt?Qr(pt,Pt.x,Pt.y,le,se,this.transform.angle):pt;return this.collisionIndex.placeCollisionBox(Mt,oe,v,f,V.predicate,Qi)};yt&&yt.box&&yt.box.length&&Oe.verticalIconBox?(ui=oi(Oe.verticalIconBox),ct=ui.box.length>0):(ui=oi(Oe.iconBox),ct=ui.box.length>0),Xe=Xe&&ui.offscreen}const Cr=U||Ae.numHorizontalGlyphVertices===0&&Ae.numVerticalGlyphVertices===0,jo=$||Ae.numIconVertices===0;if(Cr||jo?jo?Cr||(ct=ct&&ot):ot=ct&&ot:ct=ot=ct&&ot,ot&&Et&&Et.box&&this.collisionIndex.insertCollisionBox(Et.box,H,p.get("text-ignore-placement"),u.bucketInstanceId,yt&&yt.box&&nr?nr:mr,V.ID),ct&&ui&&this.collisionIndex.insertCollisionBox(ui.box,oe,p.get("icon-ignore-placement"),u.bucketInstanceId,gr,V.ID),Dt&&(ot&&this.collisionIndex.insertCollisionCircles(Dt.circles,H,p.get("text-ignore-placement"),u.bucketInstanceId,mr,V.ID),s)){const oi=u.bucketInstanceId;let pt=this.collisionCircleArrays[oi];pt===void 0&&(pt=this.collisionCircleArrays[oi]=new pr);for(let Mt=0;Mt<Dt.circles.length;Mt+=4)pt.circles.push(Dt.circles[Mt+0]),pt.circles.push(Dt.circles[Mt+1]),pt.circles.push(Dt.circles[Mt+2]),pt.circles.push(Dt.collisionDetected?1:0)}if(Ae.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(u.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ae.crossTileID]=new Tn(ot||we,ct||fe,Xe||u.justReloaded),n[Ae.crossTileID]=!0};if(ge){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ae=u.getSortedSymbolIndexes(this.transform.angle);for(let Oe=Ae.length-1;Oe>=0;--Oe){const ot=Ae[Oe];Fe(u.symbolInstances.get(ot),u.collisionArrays[ot])}}else for(let Ae=t.symbolInstanceStart;Ae<t.symbolInstanceEnd;Ae++)Fe(u.symbolInstances.get(Ae),u.collisionArrays[Ae]);if(s&&u.bucketInstanceId in this.collisionCircleArrays){const Ae=this.collisionCircleArrays[u.bucketInstanceId];a.invert(Ae.invProjMatrix,f),Ae.viewportMatrix=this.collisionIndex.getViewportMatrix()}u.justReloaded=!1}markUsedJustification(t,n,s,u){let p;p=u===a.WritingMode.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[a.getAnchorJustification(n)];const f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const _ of f)_>=0&&(t.text.placedSymbolArray.get(_).crossTileID=p>=0&&_!==p?0:s.crossTileID)}markUsedOrientation(t,n,s){const u=n===a.WritingMode.horizontal||n===a.WritingMode.horizontalOnly?n:0,p=n===a.WritingMode.vertical?n:0,f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const _ of f)t.text.placedSymbolArray.get(_).placedOrientation=u;s.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let s=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const u=n?n.symbolFadeChange(t):1,p=n?n.opacities:{},f=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const y in this.placements){const v=this.placements[y],E=p[y];E?(this.opacities[y]=new kt(E,u,v.text,v.icon),s=s||v.text!==E.text.placed||v.icon!==E.icon.placed):(this.opacities[y]=new kt(null,u,v.text,v.icon,v.skipFade),s=s||v.text||v.icon)}for(const y in p){const v=p[y];if(!this.opacities[y]){const E=new kt(v,u,!1,!1);E.isHidden()||(this.opacities[y]=E,s=s||v.text.placed||v.icon.placed)}}for(const y in f)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=f[y]);for(const y in _)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=_[y]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const s={};for(const u of n){const p=u.getBucket(t);p&&u.latestFeatureIndex&&t.id===p.layerIds[0]&&this.updateBucketOpacities(p,s,u.collisionBoxArray)}}updateBucketOpacities(t,n,s){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const u=t.layers[0].layout,p=new kt(null,0,!1,!1,!0),f=u.get("text-allow-overlap"),_=u.get("icon-allow-overlap"),y=u.get("text-variable-anchor"),v=u.get("text-rotation-alignment")==="map",E=u.get("text-pitch-alignment")==="map",M=u.get("icon-text-fit")!=="none",z=new kt(null,0,f&&(_||!t.hasIconData()||u.get("icon-optional")),_&&(f||!t.hasTextData()||u.get("text-optional")),!0);!t.collisionArrays&&s&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(s);const V=(U,$,H)=>{for(let Q=0;Q<$/4;Q++)U.opacityVertexArray.emplaceBack(H)};for(let U=0;U<t.symbolInstances.length;U++){const $=t.symbolInstances.get(U),{numHorizontalGlyphVertices:H,numVerticalGlyphVertices:Q,crossTileID:oe}=$;let N=this.opacities[oe];n[oe]?N=p:N||(N=z,this.opacities[oe]=N),n[oe]=!0;const le=$.numIconVertices>0,se=this.placedOrientations[$.crossTileID],me=se===a.WritingMode.vertical,ge=se===a.WritingMode.horizontal||se===a.WritingMode.horizontalOnly;if(H>0||Q>0){const we=J(N.text);V(t.text,H,me?de:we),V(t.text,Q,ge?de:we);const fe=N.text.isHidden();[$.rightJustifiedTextSymbolIndex,$.centerJustifiedTextSymbolIndex,$.leftJustifiedTextSymbolIndex].forEach(Oe=>{Oe>=0&&(t.text.placedSymbolArray.get(Oe).hidden=fe||me?1:0)}),$.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get($.verticalPlacedTextSymbolIndex).hidden=fe||ge?1:0);const Fe=this.variableOffsets[$.crossTileID];Fe&&this.markUsedJustification(t,Fe.anchor,$,se);const Ae=this.placedOrientations[$.crossTileID];Ae&&(this.markUsedJustification(t,"left",$,Ae),this.markUsedOrientation(t,Ae,$))}if(le){const we=J(N.icon),fe=!(M&&$.verticalPlacedIconSymbolIndex&&me);$.placedIconSymbolIndex>=0&&(V(t.icon,$.numIconVertices,fe?we:de),t.icon.placedSymbolArray.get($.placedIconSymbolIndex).hidden=N.icon.isHidden()),$.verticalPlacedIconSymbolIndex>=0&&(V(t.icon,$.numVerticalIconVertices,fe?de:we),t.icon.placedSymbolArray.get($.verticalPlacedIconSymbolIndex).hidden=N.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const we=t.collisionArrays[U];if(we){let fe=new a.pointGeometry(0,0);if(we.textBox||we.verticalTextBox){let Ae=!0;if(y){const Oe=this.variableOffsets[oe];Oe?(fe=En(Oe.anchor,Oe.width,Oe.height,Oe.textOffset,Oe.textBoxScale),v&&fe._rotate(E?this.transform.angle:-this.transform.angle)):Ae=!1}we.textBox&&w(t.textCollisionBox.collisionVertexArray,N.text.placed,!Ae||me,fe.x,fe.y),we.verticalTextBox&&w(t.textCollisionBox.collisionVertexArray,N.text.placed,!Ae||ge,fe.x,fe.y)}const Fe=Boolean(!ge&&we.verticalIconBox);we.iconBox&&w(t.iconCollisionBox.collisionVertexArray,N.icon.placed,Fe,M?fe.x:0,M?fe.y:0),we.verticalIconBox&&w(t.iconCollisionBox.collisionVertexArray,N.icon.placed,!Fe,M?fe.x:0,M?fe.y:0)}}}if(t.sortFeatures(this.transform.angle),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`);if(t.bucketInstanceId in this.collisionCircleArrays){const U=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=U.invProjMatrix,t.placementViewportMatrix=U.viewportMatrix,t.collisionCircleArray=U.circles,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 s=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*s>t}setStale(){this.stale=!0}}function w(l,t,n,s,u){l.emplaceBack(t?1:0,n?1:0,s||0,u||0),l.emplaceBack(t?1:0,n?1:0,s||0,u||0),l.emplaceBack(t?1:0,n?1:0,s||0,u||0),l.emplaceBack(t?1:0,n?1:0,s||0,u||0)}const I=Math.pow(2,25),R=Math.pow(2,24),F=Math.pow(2,17),j=Math.pow(2,16),K=Math.pow(2,9),W=Math.pow(2,8),X=Math.pow(2,1);function J(l){if(l.opacity===0&&!l.placed)return 0;if(l.opacity===1&&l.placed)return 4294967295;const t=l.placed?1:0,n=Math.floor(127*l.opacity);return n*I+t*R+n*F+t*j+n*K+t*W+n*X+t}const de=0;class be{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,s,u,p){const f=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(f,u,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,f.sort((_,y)=>_.sortKey-y.sortKey));this._currentPartIndex<f.length;)if(n.placeLayerBucketPart(f[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,p())return!0;return!1}}class he{constructor(t,n,s,u,p,f,_,y){this.placement=new O(t,n,f,_,y),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=u,this._showCollisionBoxes=p,this._done=!1}isDone(){return this._done}continuePlacement(t,n,s){const u=a.exported.now(),p=()=>{const f=a.exported.now()-u;return!this._forceFullPlacement&&f>2};for(;this._currentPlacementIndex>=0;){const f=n[t[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(f.type==="symbol"&&(!f.minzoom||f.minzoom<=_)&&(!f.maxzoom||f.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new be(f)),this._inProgressLayer.continuePlacement(s[f.source],this.placement,this._showCollisionBoxes,f,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Ve=512/a.EXTENT/2;class Ge{constructor(t,n,s){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=s;for(let u=0;u<n.length;u++){const p=n.get(u),f=p.key;this.indexedSymbolInstances[f]||(this.indexedSymbolInstances[f]=[]),this.indexedSymbolInstances[f].push({crossTileID:p.crossTileID,coord:this.getScaledCoordinates(p,t)})}}getScaledCoordinates(t,n){const s=Ve/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*a.EXTENT+t.anchorX)*s),y:Math.floor((n.canonical.y*a.EXTENT+t.anchorY)*s)}}findMatches(t,n,s){const u=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let p=0;p<t.length;p++){const f=t.get(p);if(f.crossTileID)continue;const _=this.indexedSymbolInstances[f.key];if(!_)continue;const y=this.getScaledCoordinates(f,n);for(const v of _)if(Math.abs(v.coord.x-y.x)<=u&&Math.abs(v.coord.y-y.y)<=u&&!s[v.crossTileID]){s[v.crossTileID]=!0,f.crossTileID=v.crossTileID;break}}}}class Be{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ke{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const s in this.indexes){const u=this.indexes[s],p={};for(const f in u){const _=u[f];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),p[_.tileID.key]=_}this.indexes[s]=p}this.lng=t}addBucket(t,n,s){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const u=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const f=this.indexes[p];if(Number(p)>t.overscaledZ)for(const _ in f){const y=f[_];y.tileID.isChildOf(t)&&y.findMatches(n.symbolInstances,t,u)}else{const _=f[t.scaledTo(Number(p)).key];_&&_.findMatches(n.symbolInstances,t,u)}}for(let p=0;p<n.symbolInstances.length;p++){const f=n.symbolInstances.get(p);f.crossTileID||(f.crossTileID=s.generate(),u[f.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Ge(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const s in n.indexedSymbolInstances)for(const u of n.indexedSymbolInstances[s])delete this.usedCrossTileIDs[t][u.crossTileID]}removeStaleBuckets(t){let n=!1;for(const s in this.indexes){const u=this.indexes[s];for(const p in u)t[u[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,u[p]),delete u[p],n=!0)}return n}}class et{constructor(){this.layerIndexes={},this.crossTileIDs=new Be,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,s){let u=this.layerIndexes[t.id];u===void 0&&(u=this.layerIndexes[t.id]=new Ke);let p=!1;const f={};u.handleWrapJump(s);for(const _ of n){const y=_.getBucket(t);y&&t.id===y.layerIds[0]&&(y.bucketInstanceId||(y.bucketInstanceId=++this.maxBucketInstanceId),u.addBucket(_.tileID,y,this.crossTileIDs)&&(p=!0),f[y.bucketInstanceId]=!0)}return u.removeStaleBuckets(f)&&(p=!0),p}pruneUnusedLayers(t){const n={};t.forEach(s=>{n[s]=!0});for(const s in this.layerIndexes)n[s]||delete this.layerIndexes[s]}}var wt=a.createLayout([{name:"a_pos",type:"Int16",components:2}]);class it extends a.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.renderHistory=[],this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,this.renderHistorySize=t._cache.max,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;for(const t in this._tiles){const n=this._tiles[t];n.textures.forEach(s=>s.destroy()),n.textures=[]}}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];for(const s of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))this._renderableTilesKeys.push(s.key),this._tiles[s.key]||(s.posMatrix=new Float64Array(16),a.ortho(s.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),this._tiles[s.key]=new kr(s,this.tileSize))}removeOutdated(t){const n={};this.renderHistory=this.renderHistory.filter((s,u)=>this.renderHistory.indexOf(s)===u).slice(0,this.renderHistorySize);for(const s of this._renderableTilesKeys)n[s]=!0;for(const s of this.renderHistory)n[s]=!0;for(const s in this._tiles)n[s]||(this._tiles[s].clearTextures(t),delete this._tiles[s])}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const s of this._renderableTilesKeys){const u=this._tiles[s].tileID;if(u.canonical.equals(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16),a.ortho(p.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),n[s]=p}else if(u.canonical.isChildOf(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const f=u.canonical.z-t.canonical.z,_=u.canonical.x-(u.canonical.x>>f<<f),y=u.canonical.y-(u.canonical.y>>f<<f),v=a.EXTENT>>f;a.ortho(p.posMatrix,0,v,0,v,0,1),a.translate(p.posMatrix,p.posMatrix,[-_*v,-y*v,0]),n[s]=p}else if(t.canonical.isChildOf(u.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const f=t.canonical.z-u.canonical.z,_=t.canonical.x-(t.canonical.x>>f<<f),y=t.canonical.y-(t.canonical.y>>f<<f),v=a.EXTENT>>f;a.ortho(p.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),a.translate(p.posMatrix,p.posMatrix,[_*v,y*v,0]),a.scale(p.posMatrix,p.posMatrix,[1/2**f,1/2**f,0]),n[s]=p}}return n}getSourceTile(t,n){const s=this.sourceCache._source;let u=t.overscaledZ-this.deltaZoom;if(u>s.maxzoom&&(u=s.maxzoom),u<s.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(u).key);let p=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!p||!p.dem)&&n)for(;u>=s.minzoom&&(!p||!p.dem);)p=this.sourceCache.getTileByID(t.scaledTo(u--).key);return p}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeLoaded>=t)}}class lt{constructor(t,n,s){this.style=t,this.sourceCache=new it(n),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.elevationOffset=typeof s.elevationOffset=="number"?s.elevationOffset:450,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024,this.clearRerenderCache()}getDEMElevation(t,n,s,u=a.EXTENT){if(!(n>=0&&n<u&&s>=0&&s<u))return this.elevationOffset;let p=0;const f=this.getTerrainData(t);if(f.tile&&f.tile.dem){const _=a.transformMat4$1([],[n/u*a.EXTENT,s/u*a.EXTENT],f.u_terrain_matrix),y=[_[0]*f.tile.dem.dim,_[1]*f.tile.dem.dim],v=[Math.floor(y[0]),Math.floor(y[1])],E=f.tile.dem.get(v[0],v[1]),M=f.tile.dem.get(v[0],v[1]+1),z=f.tile.dem.get(v[0]+1,v[1]),V=f.tile.dem.get(v[0]+1,v[1]+1);p=a.number(a.number(E,M,y[0]-v[0]),a.number(z,V,y[0]-v[0]),y[1]-v[1])}return p}rememberForRerender(t,n){for(const s in this.sourceCache._tiles){const u=this.sourceCache._tiles[s];(u.tileID.equals(n)||u.tileID.isChildOf(n))&&(t===this.sourceCache.sourceCache.id&&(u.timeLoaded=Date.now()),this._rerender[t]=this._rerender[t]||{},this._rerender[t][u.tileID.key]=!0)}}needsRerender(t,n){return this._rerender[t]&&this._rerender[t][n.key]}clearRerenderCache(){this._rerender={}}getElevation(t,n,s,u=a.EXTENT){return(this.getDEMElevation(t,n,s,u)+this.elevationOffset)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const u=this.style.map.painter.context,p=new a.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Ie(u,p,u.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Ie(u,new a.RGBAImage({width:1,height:1}),u.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=a.identity([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const u=this.style.map.painter.context;n.demTexture=this.style.map.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new Ie(u,n.dem.getPixels(),u.gl.RGBA,{premultiply:!1}),n.demTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const s=n&&n+n.tileID.key+t.key;if(s&&!this._demMatrixCache[s]){const u=this.sourceCache.sourceCache._source.maxzoom;let p=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=u?p=t.canonical.z-u:a.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=t.canonical.x-(t.canonical.x>>p<<p),_=t.canonical.y-(t.canonical.y>>p<<p),y=a.fromScaling(new Float64Array(16),[1/(a.EXTENT<<p),1/(a.EXTENT<<p),0]);a.translate(y,y,[f*a.EXTENT,_*a.EXTENT,0]),this._demMatrixCache[t.key]={matrix:y,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_offset:this.elevationOffset,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getRTTFramebuffer(){const t=this.style.map.painter;if(!this._rttFramebuffer){const n=this.sourceCache.tileSize*this.qualityFactor;this._rttFramebuffer=t.context.createFramebuffer(n,n,!0),this._rttFramebuffer.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,n,n))}return this._rttFramebuffer}getFramebuffer(t){const n=this.style.map.painter,s=n.width/devicePixelRatio,u=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===u||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Ie(n.context,{width:s,height:u,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 Ie(n.context,{width:s,height:u,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(s,u,!0),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,s,u))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.style.map.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let p=0,f=0;p<this._coordsTextureSize;p++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)n[f+0]=255&_,n[f+1]=255&p,n[f+2]=_>>8<<4|p>>8,n[f+3]=0;const s=new a.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),u=new Ie(t,s,t.gl.RGBA,{premultiply:!1});return u.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=u,u}pointCoordinate(t){const n=new Uint8Array(4),s=this.style.map.painter,u=s.context,p=u.gl;u.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),p.readPixels(t.x,s.height/devicePixelRatio-t.y-1,1,1,p.RGBA,p.UNSIGNED_BYTE,n),u.bindFramebuffer.set(null);const f=n[0]+(n[2]>>4<<8),_=n[1]+((15&n[2])<<8),y=this.coordsIndex[255-n[3]],v=y&&this.sourceCache.getTileByID(y);if(!v)return null;const E=this._coordsTextureSize,M=(1<<v.tileID.canonical.z)*E;return new a.MercatorCoordinate((v.tileID.canonical.x*E+f)/M,(v.tileID.canonical.y*E+_)/M,this.getElevation(v.tileID,f,_,E))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.style.map.painter.context,n=new a.PosArray,s=new a.TriangleIndexArray,u=this.meshSize,p=a.EXTENT/u,f=u*u;for(let _=0;_<=u;_++)for(let y=0;y<=u;y++)n.emplaceBack(y*p,_*p);for(let _=0;_<f;_+=u+1)for(let y=0;y<u;y++)s.emplaceBack(y+_,u+y+_+1,u+y+_+2),s.emplaceBack(y+_,u+y+_+2,y+_+1);return this._mesh={indexBuffer:t.createIndexBuffer(s),vertexBuffer:t.createVertexBuffer(n,wt.members),segments:a.SegmentVector.simpleSegment(0,0,n.length,s.length)},this._mesh}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,s={minElevation:null,maxElevation:null};return n&&n.dem&&(s.minElevation=(n.dem.min+this.elevationOffset)*this.exaggeration,s.maxElevation=(n.dem.max+this.elevationOffset)*this.exaggeration),s}}const Tt=(l,t)=>a.emitValidationErrors(l,t&&t.filter(n=>n.identifier!=="source.canvas")),Lt=a.pick(vt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),ci=a.pick(vt,["setCenter","setZoom","setBearing","setPitch"]),$t=function(){const l={},t=a.spec.$version;for(const n in a.spec.$root){const s=a.spec.$root[n];if(s.required){let u=null;u=n==="version"?t:s.type==="array"?[]:{},u!=null&&(l[n]=u)}}return l}();class bi extends a.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new zi(xn(),this),this.imageManager=new tt,this.imageManager.setEventedParent(this),this.glyphManager=new ht(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new xi(256,512),this.crossTileSymbolIndex=new et,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new a.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",a.getReferrer());const s=this;this._rtlTextPluginCallback=bi.registerForPluginStateChange(u=>{s.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:u.pluginStatus,pluginURL:u.pluginURL},(p,f)=>{if(a.triggerPluginCompletionEvent(p),f&&f.every(_=>_))for(const _ in s.sourceCaches)s.sourceCaches[_].reload()})}),this.on("data",u=>{if(u.dataType!=="source"||u.sourceDataType!=="metadata")return;const p=this.sourceCaches[u.sourceId];if(!p)return;const f=p.getSource();if(f&&f.vectorLayerIds)for(const _ in this._layers){const y=this._layers[_];y.source===f.id&&this._validateLayer(y)}})}loadURL(t,n={}){this.fire(new a.Event("dataloading",{dataType:"style"}));const s=typeof n.validate!="boolean"||n.validate,u=this.map._requestManager.transformRequest(t,a.ResourceType.Style);this._request=a.getJSON(u,(p,f)=>{this._request=null,p?this.fire(new a.ErrorEvent(p)):f&&this._load(f,s)})}loadJSON(t,n={}){this.fire(new a.Event("dataloading",{dataType:"style"})),this._request=a.exported.frame(()=>{this._request=null,this._load(t,n.validate!==!1)})}loadEmpty(){this.fire(new a.Event("dataloading",{dataType:"style"})),this._load($t,!1)}_load(t,n){if(n&&Tt(this,a.validateStyle(t)))return;this._loaded=!0,this.stylesheet=t;for(const u in t.sources)this.addSource(u,t.sources[u],{validate:!1});t.sprite?this._loadSprite(t.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(t.glyphs);const s=Xn(this.stylesheet.layers);this._order=s.map(u=>u.id),this._layers={},this._serializedLayers={};for(let u of s)u=a.createStyleLayer(u),u.setEventedParent(this,{layer:{id:u.id}}),this._layers[u.id]=u,this._serializedLayers[u.id]=u.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new gt(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new a.Event("data",{dataType:"style"})),this.fire(new a.Event("style.load"))}_loadSprite(t){this._spriteRequest=function(n,s,u,p){let f,_,y;const v=u>1?"@2x":"";let E=a.getJSON(s.transformRequest(s.normalizeSpriteURL(n,v,".json"),a.ResourceType.SpriteJSON),(V,U)=>{E=null,y||(y=V,f=U,z())}),M=a.getImage(s.transformRequest(s.normalizeSpriteURL(n,v,".png"),a.ResourceType.SpriteImage),(V,U)=>{M=null,y||(y=V,_=U,z())});function z(){if(y)p(y);else if(f&&_){const V=a.exported.getImageData(_),U={};for(const $ in f){const{width:H,height:Q,x:oe,y:N,sdf:le,pixelRatio:se,stretchX:me,stretchY:ge,content:we}=f[$],fe=new a.RGBAImage({width:H,height:Q});a.RGBAImage.copy(V,fe,{x:oe,y:N},{x:0,y:0},{width:H,height:Q}),U[$]={data:fe,pixelRatio:se,sdf:le,stretchX:me,stretchY:ge,content:we}}p(null,U)}}return{cancel(){E&&(E.cancel(),E=null),M&&(M.cancel(),M=null)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(n,s)=>{if(this._spriteRequest=null,n)this.fire(new a.ErrorEvent(n));else if(s)for(const u in s)this.imageManager.addImage(u,s[u]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))})}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const s=t.sourceLayer;if(!s)return;const u=n.getSource();(u.type==="geojson"||u.vectorLayerIds&&u.vectorLayerIds.indexOf(s)===-1)&&this.fire(new a.ErrorEvent(new Error(`Source layer "${s}" does not exist on source "${u.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const n=[];for(const s of t){const u=this._layers[s];u.type!=="custom"&&n.push(u.serialize())}return n}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].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(this._changed){const u=Object.keys(this._updatedLayers),p=Object.keys(this._removedLayers);(u.length||p.length)&&this._updateWorkerLayers(u,p);for(const f in this._updatedSources){const _=this._updatedSources[f];if(_==="reload")this._reloadSource(f);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(f)}}this._updateTilesForChangedImages();for(const f in this._updatedPaintProps)this._layers[f].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const s={};for(const u in this.sourceCaches){const p=this.sourceCaches[u];s[u]=p.used,p.used=!1}for(const u of this._order){const p=this._layers[u];p.recalculate(t,this._availableImages),!p.isHidden(t.zoom)&&p.source&&(this.sourceCaches[p.source].used=!0)}for(const u in s){const p=this.sourceCaches[u];s[u]!==p.used&&p.fire(new a.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:u}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new a.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setTerrain(t){if(this._checkLoaded(),this._terrainDataCallback&&this.off("data",this._terrainDataCallback),this._terrainfreezeElevationCallback&&this.map.off("freezeElevation",this._terrainfreezeElevationCallback),t){const n=this.sourceCaches[t.source];if(!n)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);this.terrain=new lt(this,n,t),this.map.transform.updateElevation(this.terrain),this._terrainfreezeElevationCallback=s=>{s.freeze?this.map.transform.freezeElevation=!0:(this.map.transform.freezeElevation=!1,this.map.transform.recalculateZoom(this.terrain))},this._terrainDataCallback=s=>{s.tile&&(s.sourceId===t.source?(this.map.transform.updateElevation(this.terrain),this.terrain.rememberForRerender(s.sourceId,s.tile.tileID)):s.source.type==="geojson"&&this.terrain.rememberForRerender(s.sourceId,s.tile.tileID))},this.on("data",this._terrainDataCallback),this.map.on("freezeElevation",this._terrainfreezeElevationCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.map.transform.updateElevation(this.terrain);this.map.fire(new a.Event("terrain",{terrain:t}))}setState(t){if(this._checkLoaded(),Tt(this,a.validateStyle(t)))return!1;(t=a.clone$1(t)).layers=Xn(t.layers);const n=function(u,p){if(!u)return[{command:vt.setStyle,args:[p]}];let f=[];try{if(!ue(u.version,p.version))return[{command:vt.setStyle,args:[p]}];ue(u.center,p.center)||f.push({command:vt.setCenter,args:[p.center]}),ue(u.zoom,p.zoom)||f.push({command:vt.setZoom,args:[p.zoom]}),ue(u.bearing,p.bearing)||f.push({command:vt.setBearing,args:[p.bearing]}),ue(u.pitch,p.pitch)||f.push({command:vt.setPitch,args:[p.pitch]}),ue(u.sprite,p.sprite)||f.push({command:vt.setSprite,args:[p.sprite]}),ue(u.glyphs,p.glyphs)||f.push({command:vt.setGlyphs,args:[p.glyphs]}),ue(u.transition,p.transition)||f.push({command:vt.setTransition,args:[p.transition]}),ue(u.light,p.light)||f.push({command:vt.setLight,args:[p.light]});const _={},y=[];(function(E,M,z,V){let U;for(U in M=M||{},E=E||{})Object.prototype.hasOwnProperty.call(E,U)&&(Object.prototype.hasOwnProperty.call(M,U)||Br(U,z,V));for(U in M)Object.prototype.hasOwnProperty.call(M,U)&&(Object.prototype.hasOwnProperty.call(E,U)?ue(E[U],M[U])||(E[U].type==="geojson"&&M[U].type==="geojson"&&Wn(E,M,U)?z.push({command:vt.setGeoJSONSourceData,args:[U,M[U].data]}):Fr(U,M,z,V)):hr(U,M,z))})(u.sources,p.sources,y,_);const v=[];u.layers&&u.layers.forEach(E=>{_[E.source]?f.push({command:vt.removeLayer,args:[E.id]}):v.push(E)}),f=f.concat(y),function(E,M,z){M=M||[];const V=(E=E||[]).map(wr),U=M.map(wr),$=E.reduce(bn,{}),H=M.reduce(bn,{}),Q=V.slice(),oe=Object.create(null);let N,le,se,me,ge,we,fe;for(N=0,le=0;N<V.length;N++)se=V[N],Object.prototype.hasOwnProperty.call(H,se)?le++:(z.push({command:vt.removeLayer,args:[se]}),Q.splice(Q.indexOf(se,le),1));for(N=0,le=0;N<U.length;N++)se=U[U.length-1-N],Q[Q.length-1-N]!==se&&(Object.prototype.hasOwnProperty.call($,se)?(z.push({command:vt.removeLayer,args:[se]}),Q.splice(Q.lastIndexOf(se,Q.length-le),1)):le++,we=Q[Q.length-N],z.push({command:vt.addLayer,args:[H[se],we]}),Q.splice(Q.length-N,0,se),oe[se]=!0);for(N=0;N<U.length;N++)if(se=U[N],me=$[se],ge=H[se],!oe[se]&&!ue(me,ge))if(ue(me.source,ge.source)&&ue(me["source-layer"],ge["source-layer"])&&ue(me.type,ge.type)){for(fe in br(me.layout,ge.layout,z,se,null,vt.setLayoutProperty),br(me.paint,ge.paint,z,se,null,vt.setPaintProperty),ue(me.filter,ge.filter)||z.push({command:vt.setFilter,args:[se,ge.filter]}),ue(me.minzoom,ge.minzoom)&&ue(me.maxzoom,ge.maxzoom)||z.push({command:vt.setLayerZoomRange,args:[se,ge.minzoom,ge.maxzoom]}),me)Object.prototype.hasOwnProperty.call(me,fe)&&fe!=="layout"&&fe!=="paint"&&fe!=="filter"&&fe!=="metadata"&&fe!=="minzoom"&&fe!=="maxzoom"&&(fe.indexOf("paint.")===0?br(me[fe],ge[fe],z,se,fe.slice(6),vt.setPaintProperty):ue(me[fe],ge[fe])||z.push({command:vt.setLayerProperty,args:[se,fe,ge[fe]]}));for(fe in ge)Object.prototype.hasOwnProperty.call(ge,fe)&&!Object.prototype.hasOwnProperty.call(me,fe)&&fe!=="layout"&&fe!=="paint"&&fe!=="filter"&&fe!=="metadata"&&fe!=="minzoom"&&fe!=="maxzoom"&&(fe.indexOf("paint.")===0?br(me[fe],ge[fe],z,se,fe.slice(6),vt.setPaintProperty):ue(me[fe],ge[fe])||z.push({command:vt.setLayerProperty,args:[se,fe,ge[fe]]}))}else z.push({command:vt.removeLayer,args:[se]}),we=Q[Q.lastIndexOf(se)+1],z.push({command:vt.addLayer,args:[ge,we]})}(v,p.layers,f)}catch(_){console.warn("Unable to compute style diff:",_),f=[{command:vt.setStyle,args:[p]}]}return f}(this.serialize(),t).filter(u=>!(u.command in ci));if(n.length===0)return!1;const s=n.filter(u=>!(u.command in Lt));if(s.length>0)throw new Error(`Unimplemented: ${s.map(u=>u.command).join(", ")}.`);return n.forEach(u=>{u.command!=="setTransition"&&this[u.command].apply(this,u.args)}),this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new a.ErrorEvent(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 a.ErrorEvent(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("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,s={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(a.validateStyle.source,`sources.${t}`,n,null,s))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const u=this.sourceCaches[t]=new Li(t,n,this.dispatcher);u.style=this,u.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:u.serialize(),sourceId:t})),u.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const s in this._layers)if(this._layers[s].source===t)return this.fire(new a.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${s}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new a.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const s=this.sourceCaches[t].getSource();if(s.type!=="geojson")throw new Error(`geojsonSource.type is ${s.type}, which is !== 'geojson`);s.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,s={}){this._checkLoaded();const u=t.id;if(this.getLayer(u))return void this.fire(new a.ErrorEvent(new Error(`Layer "${u}" already exists on this map.`)));let p;if(t.type==="custom"){if(Tt(this,a.validateCustomStyleLayer(t)))return;p=a.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(u,t.source),t=a.clone$1(t),t=a.extend(t,{source:u})),this._validate(a.validateStyle.layer,`layers.${u}`,t,{arrayIndex:-1},s))return;p=a.createStyleLayer(t),this._validateLayer(p),p.setEventedParent(this,{layer:{id:u}}),this._serializedLayers[p.id]=p.serialize()}const f=n?this._order.indexOf(n):this._order.length;if(n&&f===-1)this.fire(new a.ErrorEvent(new Error(`Cannot add layer "${u}" before non-existing layer "${n}".`)));else{if(this._order.splice(f,0,u),this._layerOrderChanged=!0,this._layers[u]=p,this._removedLayers[u]&&p.source&&p.type!=="custom"){const _=this._removedLayers[u];delete this._removedLayers[u],_.type!==p.type?this._updatedSources[p.source]="clear":(this._updatedSources[p.source]="reload",this.sourceCaches[p.source].pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new a.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const s=this._order.indexOf(t);this._order.splice(s,1);const u=n?this._order.indexOf(n):this._order.length;n&&u===-1?this.fire(new a.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(u,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new a.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const s=this._order.indexOf(t);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,s){this._checkLoaded();const u=this.getLayer(t);u?u.minzoom===n&&u.maxzoom===s||(n!=null&&(u.minzoom=n),s!=null&&(u.maxzoom=s),this._updateLayer(u)):this.fire(new a.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,s={}){this._checkLoaded();const u=this.getLayer(t);if(u){if(!ue(u.filter,n))return n==null?(u.filter=void 0,void this._updateLayer(u)):void(this._validate(a.validateStyle.filter,`layers.${u.id}.filter`,n,null,s)||(u.filter=a.clone$1(n),this._updateLayer(u)))}else this.fire(new a.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return a.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,s,u={}){this._checkLoaded();const p=this.getLayer(t);p?ue(p.getLayoutProperty(n),s)||(p.setLayoutProperty(n,s,u),this._updateLayer(p)):this.fire(new a.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const s=this.getLayer(t);if(s)return s.getLayoutProperty(n);this.fire(new a.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,s,u={}){this._checkLoaded();const p=this.getLayer(t);p?ue(p.getPaintProperty(n),s)||(p.setPaintProperty(n,s,u)&&this._updateLayer(p),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new a.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const s=t.source,u=t.sourceLayer,p=this.sourceCaches[s];if(p===void 0)return void this.fire(new a.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const f=p.getSource().type;f==="geojson"&&u?this.fire(new a.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):f!=="vector"||u?(t.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),p.setFeatureState(u,t.id,n)):this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const s=t.source,u=this.sourceCaches[s];if(u===void 0)return void this.fire(new a.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const p=u.getSource().type,f=p==="vector"?t.sourceLayer:void 0;p!=="vector"||f?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new a.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):u.removeFeatureState(f,t.id,n):this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,s=t.sourceLayer,u=this.sourceCaches[n];if(u!==void 0)return u.getSource().type!=="vector"||s?(t.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),u.getFeatureState(s,t.id)):void this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new a.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return a.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return a.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:a.mapObject(this.sourceCaches,t=>t.serialize()),layers:this._serializeLayers(this._order)},t=>t!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=f=>this._layers[f].type==="fill-extrusion",s={},u=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(n(_)){s[_]=f;for(const y of t){const v=y[_];if(v)for(const E of v)u.push(E)}}}u.sort((f,_)=>_.intersectionZ-f.intersectionZ);const p=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(n(_))for(let y=u.length-1;y>=0;y--){const v=u[y].feature;if(s[v.layer.id]<f)break;p.push(v),u.pop()}else for(const y of t){const v=y[_];if(v)for(const E of v)p.push(E.feature)}}return p}queryRenderedFeatures(t,n,s){n&&n.filter&&this._validate(a.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const u={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new a.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const f of n.layers){const _=this._layers[f];if(!_)return this.fire(new a.ErrorEvent(new Error(`The layer '${f}' does not exist in the map's style and cannot be queried for features.`))),[];u[_.source]=!0}}const p=[];n.availableImages=this._availableImages;for(const f in this.sourceCaches)n.layers&&!u[f]||p.push(_n(this.sourceCaches[f],this._layers,this._serializedLayers,t,n,s));return this.placement&&p.push(function(f,_,y,v,E,M,z){const V={},U=M.queryRenderedSymbols(v),$=[];for(const H of Object.keys(U).map(Number))$.push(z[H]);$.sort(ur);for(const H of $){const Q=H.featureIndex.lookupSymbolFeatures(U[H.bucketInstanceId],_,H.bucketIndex,H.sourceLayerIndex,E.filter,E.layers,E.availableImages,f);for(const oe in Q){const N=V[oe]=V[oe]||[],le=Q[oe];le.sort((se,me)=>{const ge=H.featureSortOrder;if(ge){const we=ge.indexOf(se.featureIndex);return ge.indexOf(me.featureIndex)-we}return me.featureIndex-se.featureIndex});for(const se of le)N.push(se)}}for(const H in V)V[H].forEach(Q=>{const oe=Q.feature,N=y[f[H].source].getFeatureState(oe.layer["source-layer"],oe.id);oe.source=oe.layer.source,oe.layer["source-layer"]&&(oe.sourceLayer=oe.layer["source-layer"]),oe.state=N});return V}(this._layers,this._serializedLayers,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}querySourceFeatures(t,n){n&&n.filter&&this._validate(a.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const s=this.sourceCaches[t];return s?function(u,p){const f=u.getRenderableIds().map(v=>u.getTileByID(v)),_=[],y={};for(let v=0;v<f.length;v++){const E=f[v],M=E.tileID.canonical.key;y[M]||(y[M]=!0,E.querySourceFeatures(_,p))}return _}(s,n):[]}addSourceType(t,n,s){return bi.getSourceType(t)?s(new Error(`A source type called "${t}" already exists.`)):(bi.setSourceType(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},s):s(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const s=this.light.getLight();let u=!1;for(const f in t)if(!ue(t[f],s[f])){u=!0;break}if(!u)return;const p={now:a.exported.now(),transition:a.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(p)}_validate(t,n,s,u,p={}){return(!p||p.validate!==!1)&&Tt(this,t.call(a.validateStyle,a.extend({key:n,style:this.serialize(),value:s,styleSpec:a.spec},u)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const n=this.sourceCaches[t];n.setEventedParent(null),n.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t,this.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,s,u,p=!1){let f=!1,_=!1;const y={};for(const v of this._order){const E=this._layers[v];if(E.type!=="symbol")continue;if(!y[E.source]){const z=this.sourceCaches[E.source];y[E.source]=z.getRenderableIds(!0).map(V=>z.getTileByID(V)).sort((V,U)=>U.tileID.overscaledZ-V.tileID.overscaledZ||(V.tileID.isLessThan(U.tileID)?-1:1))}const M=this.crossTileSymbolIndex.addLayer(E,y[E.source],t.center.lng);f=f||M}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.exported.now(),t.zoom))&&(this.pauseablePlacement=new he(t,this.terrain,this._order,p,n,s,u,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.exported.now()),_=!0),f&&this.pauseablePlacement.placement.setStale()),_||f)for(const v of this._order){const E=this._layers[v];E.type==="symbol"&&this.placement.updateLayerOpacities(E,y[E.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,s){this.imageManager.getImages(n.icons,s),this._updateTilesForChangedImages();const u=this.sourceCaches[n.source];u&&u.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,s){this.glyphManager.getGlyphs(n.stacks,s)}getResource(t,n,s){return a.makeRequest(n,s)}}bi.getSourceType=function(l){return mn[l]},bi.setSourceType=function(l,t){mn[l]=t},bi.registerForPluginStateChange=a.registerForPluginStateChange;var Sn="attribute vec2 a_pos;uniform mat4 u_matrix;varying vec2 v_texture_pos;varying float v_depth;void main() {v_texture_pos=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);v_depth=gl_Position.z/gl_Position.w;}";const Hn={prelude:Rt(`#ifdef GL_ES
1
+ import{R as Tf,r as Te,$ as jh,a as Xh,b as nt,j as Se,s as Tl,_ as Ef,c as Wh,d as Sf,i as Co,u as El,e as Sl,f as qc,g as Zc,h as If,k as Zt,t as Tt,F as Il,l as Ri,m as Lc,n as os,o as jc,p as bl,q as Sh,v as la,w as cr,x as Hh,y as Cf,U as Kh,z as Jh,L as Cl,A as tr,S as Ih,B as Af,C as oa,D as yl,E as Mf,T as Pf,G as zf,H as kf}from"./index.bffff470.js";var sa=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};const Df=Tf["useId".toString()]||(()=>{});let Lf=0;function Yh(b){const[I,A]=Te.exports.useState(Df());return jh(()=>{b||A(D=>D!=null?D:String(Lf++))},[b]),b||(I?`radix-${I}`:"")}function Xc({prop:b,defaultProp:I,onChange:A=()=>{}}){const[D,F]=Rf({defaultProp:I,onChange:A}),N=b!==void 0,oe=N?b:D,a=Xh(A),Y=Te.exports.useCallback(te=>{if(N){const ue=typeof te=="function"?te(b):te;ue!==b&&a(ue)}else F(te)},[N,b,F,a]);return[oe,Y]}function Rf({defaultProp:b,onChange:I}){const A=Te.exports.useState(b),[D]=A,F=Te.exports.useRef(D),N=Xh(I);return Te.exports.useEffect(()=>{F.current!==D&&(N(D),F.current=D)},[D,F,N]),A}const Qh=nt.createContext({}),Zn=()=>Te.exports.useContext(Qh),Bf=(b,I)=>{switch(I.type){case"CATEGORY":return{...b,activeCategory:I.value};case"SCORE":{const A=Tl.find(D=>I.value===""?D.value===b.activeCategory:D.scores.includes(I.value)).value;return{activeCategory:A,activeScoreByCategory:{...b.activeScoreByCategory,[A]:I.value}}}}},Ff=({children:b})=>{const[I,A]=Te.exports.useState(!1),[D,F]=Te.exports.useReducer(Bf,{activeCategory:"commute",activeScoreByCategory:{commute:"pedestrian_friendly",amenities:"groceries",character:"vibrant",nature:"parks",education:"high_schools"}}),[N,oe]=Te.exports.useState(),[a,Y]=Te.exports.useState(),{activeCategory:te}=D,fe=D.activeScoreByCategory[te],ue=$e=>{F({type:"SCORE",value:$e})},ie=$e=>{F({type:"CATEGORY",value:$e})},Ge=Te.exports.useMemo(()=>({activeScore:fe,setActiveScore:ue,activeCategory:te,setActiveCategory:ie,activePOI:N,setActivePOI:oe,hoveredPOI:a,setHoveredPOI:Y,showMobileList:I,setShowMobileList:A}),[fe,ue,te,ie,N,oe,a,Y,I,A]);return Se(Qh.Provider,{value:Ge,children:b})},Of=Te.exports.createContext(null);function $f(b){const I=b.clone();return I.pixelsToGLUnits=b.pixelsToGLUnits,I}function Ch(b){return{longitude:b.center.lng,latitude:b.center.lat,zoom:b.zoom,pitch:b.pitch,bearing:b.bearing,padding:b.padding}}function Ah(b,I){const A=I.viewState||I;let D=!1;if("longitude"in A&&"latitude"in A){const F=b.center;b.center=new F.constructor(A.longitude,A.latitude),D=D||F!==b.center}if("zoom"in A){const F=b.zoom;b.zoom=A.zoom,D=D||F!==b.zoom}if("bearing"in A){const F=b.bearing;b.bearing=A.bearing,D=D||F!==b.bearing}if("pitch"in A){const F=b.pitch;b.pitch=A.pitch,D=D||F!==b.pitch}return A.padding&&!b.isPaddingEqual(A.padding)&&(D=!0,b.padding=A.padding),D}const Uf=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Mh(b){if(!b)return null;if(typeof b=="string"||("toJS"in b&&(b=b.toJS()),!b.layers))return b;const I={};for(const D of b.layers)I[D.id]=D;const A=b.layers.map(D=>{const F=I[D.ref];let N=null;if("interactive"in D&&(N={...D},delete N.interactive),F){N=N||{...D},delete N.ref;for(const oe of Uf)oe in F&&(N[oe]=F[oe])}return N||D});return{...b,layers:A}}function Vf(b,I){const A=Array.isArray(b)?b[0]:b?b.x:0,D=Array.isArray(b)?b[1]:b?b.y:0,F=Array.isArray(I)?I[0]:I?I.x:0,N=Array.isArray(I)?I[1]:I?I.y:0;return A===F&&D===N}function qn(b,I){if(b===I)return!0;if(!b||!I)return!1;if(Array.isArray(b)){if(!Array.isArray(I)||b.length!==I.length)return!1;for(let A=0;A<b.length;A++)if(!qn(b[A],I[A]))return!1;return!0}else if(Array.isArray(I))return!1;if(typeof b=="object"&&typeof I=="object"){const A=Object.keys(b),D=Object.keys(I);if(A.length!==D.length)return!1;for(const F of A)if(!I.hasOwnProperty(F)||!qn(b[F],I[F]))return!1;return!0}return!1}const Ph={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},Rc={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},zh={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},Nf=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],Gf=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class ss{constructor(I,A,D){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=F=>{const N=this.props[zh[F.type]];N&&N(F)},this._onPointerEvent=F=>{(F.type==="mousemove"||F.type==="mouseout")&&this._updateHover(F);const N=this.props[Ph[F.type]];if(N){if(this.props.interactiveLayerIds&&F.type!=="mouseover"&&F.type!=="mouseout"){const oe=this._hoveredFeatures||this._map.queryRenderedFeatures(F.point,{layers:this.props.interactiveLayerIds});F.features=oe}N(F),delete F.features}},this._onCameraEvent=F=>{if(!this._internalUpdate){const N=this.props[Rc[F.type]];N&&N(F)}F.type in this._deferredEvents&&(this._deferredEvents[F.type]=!1)},this._MapClass=I,this.props=A,this._initialize(D)}get map(){return this._map}get transform(){return this._renderTransform}setProps(I){const A=this.props;this.props=I;const D=this._updateSettings(I,A);D&&this._createShadowTransform(this._map);const F=this._updateSize(I),N=this._updateViewState(I,!0);this._updateStyle(I,A),this._updateStyleComponents(I,A),this._updateHandlers(I,A),(D||F||N&&!this._map.isMoving())&&this.redraw()}static reuse(I,A){const D=ss.savedMaps.pop();if(!D)return null;const F=D.map,N=F.getContainer();for(A.className=N.className;N.childNodes.length>0;)A.appendChild(N.childNodes[0]);F._container=A,D.setProps({...I,styleDiffing:!1}),F.resize();const{initialViewState:oe}=I;return oe&&(oe.bounds?F.fitBounds(oe.bounds,{...oe.fitBoundsOptions,duration:0}):D._updateViewState(oe,!1)),F.isStyleLoaded()?F.fire("load"):F.once("styledata",()=>F.fire("load")),D}_initialize(I){const{props:A}=this,D={...A,...A.initialViewState,accessToken:A.mapboxAccessToken||qf()||null,container:I,style:Mh(A.mapStyle)},F=D.initialViewState||D.viewState||D;if(Object.assign(D,{center:[F.longitude||0,F.latitude||0],zoom:F.zoom||0,pitch:F.pitch||0,bearing:F.bearing||0}),A.gl){const te=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=te,A.gl)}const N=new this._MapClass(D);F.padding&&N.setPadding(F.padding),A.cursor&&(N.getCanvas().style.cursor=A.cursor),this._createShadowTransform(N);const oe=N._render;N._render=te=>{this._inRender=!0,oe.call(N,te),this._inRender=!1};const a=N._renderTaskQueue.run;N._renderTaskQueue.run=te=>{a.call(N._renderTaskQueue,te),this._onBeforeRepaint()},N.on("render",()=>this._onAfterRepaint());const Y=N.fire;N.fire=this._fireEvent.bind(this,Y),N.on("resize",()=>{this._renderTransform.resize(N.transform.width,N.transform.height)}),N.on("styledata",()=>this._updateStyleComponents(this.props,{})),N.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const te in Ph)N.on(te,this._onPointerEvent);for(const te in Rc)N.on(te,this._onCameraEvent);for(const te in zh)N.on(te,this._onEvent);this._map=N}recycle(){ss.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const I=this._map;!this._inRender&&I.style&&(I._frame&&(I._frame.cancel(),I._frame=null),I._render())}_createShadowTransform(I){const A=$f(I.transform);I.painter.transform=A,this._renderTransform=A}_updateSize(I){const{viewState:A}=I;if(A){const D=this._map;if(A.width!==D.transform.width||A.height!==D.transform.height)return D.resize(),!0}return!1}_updateViewState(I,A){if(this._internalUpdate)return!1;const D=this._map,F=this._renderTransform,{zoom:N,pitch:oe,bearing:a}=F,Y=D.isMoving();Y&&(F.cameraElevationReference="sea");const te=Ah(F,{...Ch(D.transform),...I});if(Y&&(F.cameraElevationReference="ground"),te&&A){const fe=this._deferredEvents;fe.move=!0,fe.zoom||(fe.zoom=N!==F.zoom),fe.rotate||(fe.rotate=a!==F.bearing),fe.pitch||(fe.pitch=oe!==F.pitch)}return Y||Ah(D.transform,I),te}_updateSettings(I,A){const D=this._map;let F=!1;for(const N of Nf)N in I&&!qn(I[N],A[N])&&(F=!0,D[`set${N[0].toUpperCase()}${N.slice(1)}`](I[N]));return F}_updateStyle(I,A){if(I.cursor!==A.cursor&&(this._map.getCanvas().style.cursor=I.cursor),I.mapStyle!==A.mapStyle){const D={diff:I.styleDiffing};return"localIdeographFontFamily"in I&&(D.localIdeographFontFamily=I.localIdeographFontFamily),this._map.setStyle(Mh(I.mapStyle),D),!0}return!1}_updateStyleComponents(I,A){const D=this._map;let F=!1;return D.style.loaded()&&("light"in I&&!qn(I.light,A.light)&&(F=!0,D.setLight(I.light)),"fog"in I&&!qn(I.fog,A.fog)&&(F=!0,D.setFog(I.fog)),"terrain"in I&&!qn(I.terrain,A.terrain)&&(!I.terrain||D.getSource(I.terrain.source))&&(F=!0,D.setTerrain(I.terrain))),F}_updateHandlers(I,A){const D=this._map;let F=!1;for(const N of Gf){const oe=I[N];qn(oe,A[N])||(F=!0,oe?D[N].enable(oe):D[N].disable())}return F}_updateHover(I){var A;const{props:D}=this;if(D.interactiveLayerIds&&(D.onMouseMove||D.onMouseEnter||D.onMouseLeave)){const N=I.type,oe=((A=this._hoveredFeatures)===null||A===void 0?void 0:A.length)>0;let a;if(N==="mousemove")try{a=this._map.queryRenderedFeatures(I.point,{layers:D.interactiveLayerIds})}catch{a=[]}else a=[];const Y=a.length>0;!Y&&oe&&(I.type="mouseleave",this._onPointerEvent(I)),this._hoveredFeatures=a,Y&&!oe&&(I.type="mouseenter",this._onPointerEvent(I)),I.type=N}else this._hoveredFeatures=null}_fireEvent(I,A,D){const F=this._map,N=F.transform,oe=typeof A=="string"?A:A.type;return oe==="move"&&this._updateViewState(this.props,!1),oe in Rc&&(typeof A=="object"&&(A.viewState=Ch(N)),this._map.isMoving())?(F.transform=this._renderTransform,I.call(F,A,D),F.transform=N,F):(I.call(F,A,D),F)}_onBeforeRepaint(){const I=this._map;this._internalUpdate=!0;for(const D in this._deferredEvents)this._deferredEvents[D]&&I.fire(D);this._internalUpdate=!1;const A=this._map.transform;this._map.transform=this._renderTransform,this._onAfterRepaint=()=>{this._map.transform=A}}}ss.savedMaps=[];function qf(){let b=null;if(typeof location!="undefined"){const I=/access_token=([^&\/]*)/.exec(location.search);b=I&&I[1]}try{b=b||{}.MapboxAccessToken}catch{}try{b=b||{}.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return b}const Zf=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function jf(b,I){if(!b)return null;const A=b.map,D={getMap:()=>A,getCenter:()=>b.transform.center,getZoom:()=>b.transform.zoom,getBearing:()=>b.transform.bearing,getPitch:()=>b.transform.pitch,getPadding:()=>b.transform.padding,getBounds:()=>b.transform.getBounds(),project:F=>b.transform.locationPoint(I.LngLat.convert(F)),unproject:F=>b.transform.pointLocation(I.Point.convert(F)),queryTerrainElevation:(F,N)=>{const oe=A.transform;A.transform=b.transform;const a=A.queryTerrainElevation(F,N);return A.transform=oe,a}};for(const F of Xf(A))!(F in D)&&!Zf.includes(F)&&(D[F]=A[F].bind(A));return D}function Xf(b){const I=new Set;let A=b;for(;A;){for(const D of Object.getOwnPropertyNames(A))D[0]!=="_"&&typeof b[D]=="function"&&D!=="fire"&&D!=="setEventedParent"&&I.add(D);A=Object.getPrototypeOf(A)}return Array.from(I)}const Wf=typeof document!="undefined"?Te.exports.useLayoutEffect:Te.exports.useEffect,Hf=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function Kf(b,I){for(const A of Hf)A in I&&(b[A]=I[A]);I.RTLTextPlugin&&b.getRTLTextPluginStatus&&b.getRTLTextPluginStatus()==="unavailable"&&b.setRTLTextPlugin(I.RTLTextPlugin,A=>{A&&console.error(A)},!1)}const Al=Te.exports.createContext(null),Jf={minZoom:0,maxZoom:22,minPitch:0,maxPitch:60,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,mapStyle:{version:8,sources:{},layers:[]},styleDiffing:!0,projection:"mercator",renderWorldCopies:!0,onError:b=>console.error(b.error),RTLTextPlugin:"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"},Wc=Te.exports.forwardRef((b,I)=>{const A=Te.exports.useContext(Of),[D,F]=Te.exports.useState(null),N=Te.exports.useRef(),{current:oe}=Te.exports.useRef({mapLib:null,map:null});Te.exports.useEffect(()=>{const Y=b.mapLib;let te=!0,fe;return Promise.resolve(Y||Ef(()=>import("./index.c629d6a1.js").then(function(ue){return ue.i}),[])).then(ue=>{if(!!te){if(ue.Map||(ue=ue.default),!ue||!ue.Map)throw new Error("Invalid mapLib");if(ue.supported(b))Kf(ue,b),b.reuseMaps&&(fe=ss.reuse(b,N.current)),fe||(fe=new ss(ue.Map,b,N.current)),oe.map=jf(fe,ue),oe.mapLib=ue,F(fe),A==null||A.onMapMount(oe.map,b.id);else throw new Error("Map is not supported by this browser")}}).catch(ue=>{b.onError({type:"error",target:null,originalEvent:null,error:ue})}),()=>{te=!1,fe&&(A==null||A.onMapUnmount(b.id),b.reuseMaps?fe.recycle():fe.destroy())}},[]),Wf(()=>{D&&D.setProps(b)}),Te.exports.useImperativeHandle(I,()=>oe.map,[D]);const a=Te.exports.useMemo(()=>({position:"relative",width:"100%",height:"100%",...b.style}),[b.style]);return Te.exports.createElement("div",{id:b.id,ref:N,style:a},D&&Te.exports.createElement(Al.Provider,{value:oe},b.children))});Wc.displayName="Map";Wc.defaultProps=Jf;const Yf=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function Ao(b,I){if(!b||!I)return;const A=b.style;for(const D in I){const F=I[D];Number.isFinite(F)&&!Yf.test(D)?A[D]=`${F}px`:A[D]=F}}const Qf={draggable:!1,popup:null,rotation:0,rotationAlignment:"auto",pitchAlignment:"auto"};function ep(b){const{map:I,mapLib:A}=Te.exports.useContext(Al),D=Te.exports.useRef({props:b});D.current.props=b;const F=Te.exports.useMemo(()=>{let N=!1;Te.exports.Children.forEach(b.children,Y=>{Y&&(N=!0)});const oe={...b,element:N?document.createElement("div"):null},a=new A.Marker(oe).setLngLat([b.longitude,b.latitude]);return a.getElement().addEventListener("click",Y=>{var te,fe;(fe=(te=D.current.props).onClick)===null||fe===void 0||fe.call(te,{type:"click",target:a,originalEvent:Y})}),a.on("dragstart",Y=>{var te,fe;const ue=Y;ue.lngLat=F.getLngLat(),(fe=(te=D.current.props).onDragStart)===null||fe===void 0||fe.call(te,ue)}),a.on("drag",Y=>{var te,fe;const ue=Y;ue.lngLat=F.getLngLat(),(fe=(te=D.current.props).onDrag)===null||fe===void 0||fe.call(te,ue)}),a.on("dragend",Y=>{var te,fe;const ue=Y;ue.lngLat=F.getLngLat(),(fe=(te=D.current.props).onDragEnd)===null||fe===void 0||fe.call(te,ue)}),a},[]);return Te.exports.useEffect(()=>(F.addTo(I.getMap()),()=>{F.remove()}),[]),Te.exports.useEffect(()=>{Ao(F.getElement(),b.style)},[b.style]),(F.getLngLat().lng!==b.longitude||F.getLngLat().lat!==b.latitude)&&F.setLngLat([b.longitude,b.latitude]),b.offset&&!Vf(F.getOffset(),b.offset)&&F.setOffset(b.offset),F.isDraggable()!==b.draggable&&F.setDraggable(b.draggable),F.getRotation()!==b.rotation&&F.setRotation(b.rotation),F.getRotationAlignment()!==b.rotationAlignment&&F.setRotationAlignment(b.rotationAlignment),F.getPitchAlignment()!==b.pitchAlignment&&F.setPitchAlignment(b.pitchAlignment),F.getPopup()!==b.popup&&F.setPopup(b.popup),Wh.exports.createPortal(b.children,F.getElement())}ep.defaultProps=Qf;var $c=Te.exports.memo(ep);function kh(b){return new Set(b?b.trim().split(/\s+/):[])}function em(b){const{map:I,mapLib:A}=Te.exports.useContext(Al),D=Te.exports.useMemo(()=>document.createElement("div"),[]),F=Te.exports.useRef({props:b});F.current.props=b;const N=Te.exports.useMemo(()=>{const oe={...b},a=new A.Popup(oe).setLngLat([b.longitude,b.latitude]);return a.once("open",Y=>{var te,fe;(fe=(te=F.current.props).onOpen)===null||fe===void 0||fe.call(te,Y)}),a},[]);if(Te.exports.useEffect(()=>{const oe=a=>{var Y,te;(te=(Y=F.current.props).onClose)===null||te===void 0||te.call(Y,a)};return N.on("close",oe),N.setDOMContent(D).addTo(I.getMap()),()=>{N.off("close",oe),N.isOpen()&&N.remove()}},[]),Te.exports.useEffect(()=>{Ao(N.getElement(),b.style)},[b.style]),N.isOpen()&&((N.getLngLat().lng!==b.longitude||N.getLngLat().lat!==b.latitude)&&N.setLngLat([b.longitude,b.latitude]),b.offset&&!qn(N.options.offset,b.offset)&&N.setOffset(b.offset),(N.options.anchor!==b.anchor||N.options.maxWidth!==b.maxWidth)&&(N.options.anchor=b.anchor,N.setMaxWidth(b.maxWidth)),N.options.className!==b.className)){const oe=kh(N.options.className),a=kh(b.className);for(const Y of oe)a.has(Y)||N.removeClassName(Y);for(const Y of a)oe.has(Y)||N.addClassName(Y);N.options.className=b.className}return Wh.exports.createPortal(b.children,D)}Te.exports.memo(em);function ca(b,I,A,D){const F=Te.exports.useContext(Al),N=Te.exports.useMemo(()=>b(F),[]);return Te.exports.useEffect(()=>{const oe=D||A||I,a=typeof I=="function"&&typeof A=="function"?I:null,Y=typeof A=="function"?A:typeof I=="function"?I:null,{map:te}=F;return te.hasControl(N)||(te.addControl(N,oe==null?void 0:oe.position),a&&a(F)),()=>{Y&&Y(F),te.hasControl(N)&&te.removeControl(N)}},[]),N}function tm(b){const I=ca(({mapLib:A})=>new A.AttributionControl(b),{position:b.position});return Te.exports.useEffect(()=>{Ao(I._container,b.style)},[b.style]),null}Te.exports.memo(tm);function im(b){const I=ca(({mapLib:A})=>new A.FullscreenControl({container:b.containerId&&document.getElementById(b.containerId)}),{position:b.position});return Te.exports.useEffect(()=>{Ao(I._controlContainer,b.style)},[b.style]),null}Te.exports.memo(im);const tp=Te.exports.forwardRef((b,I)=>{const A=Te.exports.useRef({props:b}),D=ca(({mapLib:F})=>{const N=new F.GeolocateControl(b),oe=N._setupUI;return N._setupUI=a=>{N._container.hasChildNodes()||oe(a)},N.on("geolocate",a=>{var Y,te;(te=(Y=A.current.props).onGeolocate)===null||te===void 0||te.call(Y,a)}),N.on("error",a=>{var Y,te;(te=(Y=A.current.props).onError)===null||te===void 0||te.call(Y,a)}),N.on("outofmaxbounds",a=>{var Y,te;(te=(Y=A.current.props).onOutOfMaxBounds)===null||te===void 0||te.call(Y,a)}),N.on("trackuserlocationstart",a=>{var Y,te;(te=(Y=A.current.props).onTrackUserLocationStart)===null||te===void 0||te.call(Y,a)}),N.on("trackuserlocationend",a=>{var Y,te;(te=(Y=A.current.props).onTrackUserLocationEnd)===null||te===void 0||te.call(Y,a)}),N},{position:b.position});return A.current.props=b,Te.exports.useImperativeHandle(I,()=>({trigger:()=>D.trigger()}),[]),Te.exports.useEffect(()=>{Ao(D._container,b.style)},[b.style]),null});tp.displayName="GeolocateControl";Te.exports.memo(tp);function rm(b){const I=ca(({mapLib:A})=>new A.NavigationControl(b),{position:b.position});return Te.exports.useEffect(()=>{Ao(I._container,b.style)},[b.style]),null}var nm=Te.exports.memo(rm);const om={unit:"metric",maxWidth:100};function ip(b){const I=ca(({mapLib:A})=>new A.ScaleControl(b),{position:b.position});return(I.options.unit!==b.unit||I.options.maxWidth!==b.maxWidth)&&(I.options.maxWidth=b.maxWidth,I.setUnit(b.unit)),Te.exports.useEffect(()=>{Ao(I._container,b.style)},[b.style]),null}ip.defaultProps=om;Te.exports.memo(ip);var rp={exports:{}};(function(b,I){(function(A,D){b.exports=D()})(sa,function(){var A,D,F;function N(a,Y){if(!A)A=Y;else if(!D)D=Y;else{var te="var sharedChunk = {}; ("+A+")(sharedChunk); ("+D+")(sharedChunk);",fe={};A(fe),F=Y(fe),typeof window!="undefined"&&(F.workerUrl=window.URL.createObjectURL(new Blob([te],{type:"text/javascript"})))}}N(["exports"],function(a){var Y=te;function te(i,e,r,o){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(o-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=o}function fe(i,e,r,o){const c=new Y(i,e,r,o);return function(h){return c.solve(h)}}te.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,o=0;o<8;o++){var c=this.sampleCurveX(r)-i;if(Math.abs(c)<e)return r;var h=this.sampleCurveDerivativeX(r);if(Math.abs(h)<1e-6)break;r-=c/h}var d=0,m=1;for(r=i,o=0;o<20&&(c=this.sampleCurveX(r),!(Math.abs(c-i)<e));o++)i>c?d=r:m=r,r=.5*(m-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};const ue=fe(.25,.1,.25,1);function ie(i,e,r){return Math.min(r,Math.max(e,i))}function Ge(i,e,r){const o=r-e,c=((i-e)%o+o)%o+e;return c===e?r:c}function $e(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}let Ue=1;function et(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function Ke(i,e,r){const o={};for(const c in i)o[c]=e.call(r||this,i[c],c,i);return o}function tt(i,e,r){const o={};for(const c in i)e.call(r||this,i[c],c,i)&&(o[c]=i[c]);return o}function lt(i){return Array.isArray(i)?i.map(lt):typeof i=="object"&&i?Ke(i,lt):i}const It={};function at(i){It[i]||(typeof console!="undefined"&&console.warn(i),It[i]=!0)}function gt(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function ti(i){let e=0;for(let r,o,c=0,h=i.length,d=h-1;c<h;d=c++)r=i[c],o=i[d],e+=(o.x-r.x)*(r.y+o.y);return e}function Kt(){return typeof WorkerGlobalScope!="undefined"&&typeof self!="undefined"&&self instanceof WorkerGlobalScope}function ur(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,o,c,h)=>{const d=c||h;return e[o]=!d||d.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}let Wi,hr,Hi=null;function Rt(i){if(Hi==null){const e=i.navigator?i.navigator.userAgent:null;Hi=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Hi}function pi(i){return typeof ImageBitmap!="undefined"&&i instanceof ImageBitmap}const di={now:typeof performance!="undefined"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){const r=window.document.createElement("canvas"),o=r.getContext("2d");if(!o)throw new Error("failed to create canvas 2d context");return r.width=i.width,r.height=i.height,o.drawImage(i,0,0,i.width,i.height),o.getImageData(-e,-e,i.width+2*e,i.height+2*e)},resolveURL:i=>(Wi||(Wi=document.createElement("a")),Wi.href=i,Wi.href),hardwareConcurrency:typeof navigator!="undefined"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(hr==null&&(hr=matchMedia("(prefers-reduced-motion: reduce)")),hr.matches)}};var Xe=Bi;function Bi(i,e){this.x=i,this.y=e}Bi.prototype={clone:function(){return new Bi(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),o=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=o,this},_rotateAround:function(i,e){var r=Math.cos(i),o=Math.sin(i),c=e.y+o*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-o*(this.y-e.y),this.y=c,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Bi.convert=function(i){return i instanceof Bi?i:Array.isArray(i)?new Bi(i[0],i[1]):i};const wi={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},Ci="mapbox-tiles";let Ai,Kr,gn=500,_n=50;function yn(){typeof caches=="undefined"||Ai||(Ai=caches.open(Ci))}let pr=1/0;const Dr={supported:!1,testSupport:function(i){!Mi&&Rr&&(xn?jn(i):Lr=i)}};let Lr,Rr,Mi=!1,xn=!1;function jn(i){const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,Rr),i.isContextLost())return;Dr.supported=!0}catch{}i.deleteTexture(e),Mi=!0}typeof document!="undefined"&&(Rr=document.createElement("img"),Rr.onload=function(){Lr&&jn(Lr),Lr=null,xn=!0},Rr.onerror=function(){Mi=!0,Lr=null},Rr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const br={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(br);class Fi extends Error{constructor(e,r,o,c){super(`AJAXError: ${r} (${e}): ${o}`),this.status=e,this.statusText=r,this.url=o,this.body=c}}const Xn=Kt()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function Br(i,e){const r=new AbortController,o=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:Xn(),signal:r.signal});let c=!1,h=!1;return i.type==="json"&&o.headers.set("Accept","application/json"),((d,m,g)=>{if(h)return;const x=Date.now();fetch(o).then(T=>T.ok?((S,P,k)=>{(i.type==="arrayBuffer"?S.arrayBuffer():i.type==="json"?S.json():S.text()).then(L=>{h||(P&&k&&function(Z,q,re){if(yn(),!Ai)return;const ce={status:q.status,statusText:q.statusText,headers:new Headers};q.headers.forEach((ae,xe)=>ce.headers.set(xe,ae));const ee=ur(q.headers.get("Cache-Control")||"");ee["no-store"]||(ee["max-age"]&&ce.headers.set("Expires",new Date(re+1e3*ee["max-age"]).toUTCString()),new Date(ce.headers.get("Expires")).getTime()-re<42e4||function(ae,xe){if(Kr===void 0)try{new Response(new ReadableStream),Kr=!0}catch{Kr=!1}Kr?xe(ae.body):ae.blob().then(xe)}(q,ae=>{const xe=new Response(ae,ce);yn(),Ai&&Ai.then(ye=>ye.put(function(Fe){const Ne=Fe.indexOf("?");return Ne<0?Fe:Fe.slice(0,Ne)}(Z.url),xe)).catch(ye=>at(ye.message))}))}(o,P,k),c=!0,e(null,L,S.headers.get("Cache-Control"),S.headers.get("Expires")))}).catch(L=>{h||e(new Error(L.message))})})(T,null,x):T.blob().then(S=>e(new Fi(T.status,T.statusText,i.url,S)))).catch(T=>{T.code!==20&&e(new Error(T.message))})})(),{cancel:()=>{h=!0,c||r.abort()}}}const vn=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(Kt()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!Kt()){const o=i.url.substring(0,i.url.indexOf("://"));return(wi.REGISTERED_PROTOCOLS[o]||Br)(i,e)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(Xn())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Br(i,e);if(Kt()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(o,c){const h=new XMLHttpRequest;h.open(o.method||"GET",o.url,!0),o.type==="arrayBuffer"&&(h.responseType="arraybuffer");for(const d in o.headers)h.setRequestHeader(d,o.headers[d]);return o.type==="json"&&(h.responseType="text",h.setRequestHeader("Accept","application/json")),h.withCredentials=o.credentials==="include",h.onerror=()=>{c(new Error(h.statusText))},h.onload=()=>{if((h.status>=200&&h.status<300||h.status===0)&&h.response!==null){let d=h.response;if(o.type==="json")try{d=JSON.parse(h.response)}catch(m){return c(m)}c(null,d,h.getResponseHeader("Cache-Control"),h.getResponseHeader("Expires"))}else{const d=new Blob([h.response],{type:h.getResponseHeader("Content-Type")});c(new Fi(h.status,h.statusText,o.url,d))}},h.send(o.body),{cancel:()=>h.abort()}}(i,e)},bn=function(i,e){return vn($e(i,{type:"arrayBuffer"}),e)};function Wn(i){const e=window.document.createElement("a");return e.href=i,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const yt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let dr,Fr;dr=[],Fr=0;const Or=function(i,e){if(Dr.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),Fr>=wi.MAX_PARALLEL_IMAGE_REQUESTS){const h={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return dr.push(h),h}Fr++;let r=!1;const o=()=>{if(!r)for(r=!0,Fr--;dr.length&&Fr<wi.MAX_PARALLEL_IMAGE_REQUESTS;){const h=dr.shift(),{requestParameters:d,callback:m,cancelled:g}=h;g||(h.cancel=Or(d,m).cancel)}},c=bn(i,(h,d,m,g)=>{o(),h?e(h):d&&function(x,T){typeof createImageBitmap=="function"?function(S,P){const k=new Blob([new Uint8Array(S)],{type:"image/png"});createImageBitmap(k).then(L=>{P(null,L)}).catch(L=>{P(new Error(`Could not load image because of ${L.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(x,T):function(S,P){const k=new Image;k.onload=()=>{P(null,k),URL.revokeObjectURL(k.src),k.onload=null,window.requestAnimationFrame(()=>{k.src=yt})},k.onerror=()=>P(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 L=new Blob([new Uint8Array(S)],{type:"image/png"});k.src=S.byteLength?URL.createObjectURL(L):yt}(x,T)}(d,(x,T)=>{x!=null?e(x):T!=null&&e(null,T,{cacheControl:m,expires:g})})});return{cancel:()=>{c.cancel(),o()}}};function Hn(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function wr(i,e,r){if(r&&r[i]){const o=r[i].indexOf(e);o!==-1&&r[i].splice(o,1)}}class Tr{constructor(e,r={}){$e(this,r),this.type=e}}class wn extends Tr{constructor(e,r={}){super("error",$e({error:e},r))}}class Er{on(e,r){return this._listeners=this._listeners||{},Hn(e,r,this._listeners),this}off(e,r){return wr(e,r,this._listeners),wr(e,r,this._oneTimeListeners),this}once(e,r){return this._oneTimeListeners=this._oneTimeListeners||{},Hn(e,r,this._oneTimeListeners),this}fire(e,r){typeof e=="string"&&(e=new Tr(e,r||{}));const o=e.type;if(this.listens(o)){e.target=this;const c=this._listeners&&this._listeners[o]?this._listeners[o].slice():[];for(const m of c)m.call(this,e);const h=this._oneTimeListeners&&this._oneTimeListeners[o]?this._oneTimeListeners[o].slice():[];for(const m of h)wr(o,m,this._oneTimeListeners),m.call(this,e);const d=this._eventedParent;d&&($e(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof wn&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var _e={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},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},"*":{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:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},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:{},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_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"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","property-type":"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","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"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-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","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},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:"*",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}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","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"]},"property-type":"cross-faded"},"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"},"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:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},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"}}};class Me{constructor(e,r,o,c){this.message=(e?`${e}: `:"")+o,c&&(this.identifier=c),r!=null&&r.__line__&&(this.line=r.__line__)}}function Jr(i){const e=i.value;return e?[new Me(i.key,e,"constants have been deprecated as of v8")]:[]}function ir(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}function xt(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Ki(i){if(Array.isArray(i))return i.map(Ki);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=Ki(i[r]);return e}return xt(i)}class Oi extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class $i{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[o,c]of r)this.bindings[o]=c}concat(e){return new $i(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 $r={kind:"null"},Ie={kind:"number"},ct={kind:"string"},ot={kind:"boolean"},fi={kind:"color"},Ur={kind:"object"},rt={kind:"value"},Sr={kind:"collator"},oi={kind:"formatted"},Tn={kind:"padding"},Jt={kind:"resolvedImage"};function Ti(i,e){return{kind:"array",itemType:i,N:e}}function Pt(i){if(i.kind==="array"){const e=Pt(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const En=[$r,Ie,ct,ot,fi,oi,Ur,Ti(rt),Tn,Jt];function fr(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!fr(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of En)if(!fr(r,e))return null}}return`Expected ${Pt(i)} but found ${Pt(e)} instead.`}function Yr(i,e){return e.some(r=>r.kind===i.kind)}function Qr(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}var Sn,en={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function O(i){return(i=Math.round(i))<0?0:i>255?255:i}function w(i){return O(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function C(i){return(e=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:e>1?1:e;var e}function R(i,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?i+(e-i)*r*6:2*r<1?e:3*r<2?i+(e-i)*(2/3-r)*6:i}try{Sn={}.parseCSSColor=function(i){var e,r=i.replace(/ /g,"").toLowerCase();if(r in en)return en[r].slice();if(r[0]==="#")return r.length===4?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:r.length===7&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var o=r.indexOf("("),c=r.indexOf(")");if(o!==-1&&c+1===r.length){var h=r.substr(0,o),d=r.substr(o+1,c-(o+1)).split(","),m=1;switch(h){case"rgba":if(d.length!==4)return null;m=C(d.pop());case"rgb":return d.length!==3?null:[w(d[0]),w(d[1]),w(d[2]),m];case"hsla":if(d.length!==4)return null;m=C(d.pop());case"hsl":if(d.length!==3)return null;var g=(parseFloat(d[0])%360+360)%360/360,x=C(d[1]),T=C(d[2]),S=T<=.5?T*(x+1):T+x-T*x,P=2*T-S;return[O(255*R(P,S,g+1/3)),O(255*R(P,S,g)),O(255*R(P,S,g-1/3)),m];default:return null}}return null}}catch{}class B{constructor(e,r,o,c=1){this.r=e,this.g=r,this.b=o,this.a=c}static parse(e){if(!e)return;if(e instanceof B)return e;if(typeof e!="string")return;const r=Sn(e);return r?new B(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){const[e,r,o,c]=this.toArray();return`rgba(${Math.round(e)},${Math.round(r)},${Math.round(o)},${c})`}toArray(){const{r:e,g:r,b:o,a:c}=this;return c===0?[0,0,0,0]:[255*e/c,255*r/c,255*o/c,c]}}B.black=new B(0,0,0,1),B.white=new B(1,1,1,1),B.transparent=new B(0,0,0,0),B.red=new B(1,0,0,1);class j{constructor(e,r,o){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=o,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class K{constructor(e,r,o,c,h){this.text=e,this.image=r,this.scale=o,this.fontStack=c,this.textColor=h}}class W{constructor(e){this.sections=e}static fromString(e){return new W([new K(e,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 W?e:W.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class X{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof X)return e;if(typeof e=="number")return new X([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="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 X(e)}}toString(){return JSON.stringify(this.values)}}class J{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new J({name:e,available:!1}):null}}function pe(i,e,r,o){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?o===void 0||typeof o=="number"&&o>=0&&o<=1?null:`Invalid rgba value [${[i,e,r,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof o=="number"?[i,e,r,o]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ve(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof B||i instanceof j||i instanceof W||i instanceof X||i instanceof J)return!0;if(Array.isArray(i)){for(const e of i)if(!ve(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!ve(i[e]))return!1;return!0}return!1}function he(i){if(i===null)return $r;if(typeof i=="string")return ct;if(typeof i=="boolean")return ot;if(typeof i=="number")return Ie;if(i instanceof B)return fi;if(i instanceof j)return Sr;if(i instanceof W)return oi;if(i instanceof X)return Tn;if(i instanceof J)return Jt;if(Array.isArray(i)){const e=i.length;let r;for(const o of i){const c=he(o);if(r){if(r===c)continue;r=rt;break}r=c}return Ti(r||rt,e)}return Ur}function Ve(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof B||i instanceof W||i instanceof X||i instanceof J?i.toString():JSON.stringify(i)}class qe{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ve(e[1]))return r.error("invalid value");const o=e[1];let c=he(o);const h=r.expectedType;return c.kind!=="array"||c.N!==0||!h||h.kind!=="array"||typeof h.N=="number"&&h.N!==0||(c=h),new qe(c,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Le{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Je={string:ct,number:Ie,boolean:ot,object:Ur};class Qe{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let o,c=1;const h=e[0];if(h==="array"){let m,g;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in Je)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=Je[x],c++}else m=rt;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=e[2],c++}o=Ti(m,g)}else{if(!Je[h])throw new Error(`Types doesn't contain name = ${h}`);o=Je[h]}const d=[];for(;c<e.length;c++){const m=r.parse(e[c],c,rt);if(!m)return null;d.push(m)}return new Qe(o,d)}evaluate(e){for(let r=0;r<this.args.length;r++){const o=this.args[r].evaluate(e);if(!fr(this.type,he(o)))return o;if(r===this.args.length-1)throw new Le(`Expected value to be of type ${Pt(this.type)}, but found ${Pt(he(o))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const vt={"to-boolean":ot,"to-color":fi,"to-number":Ie,"to-string":ct};class it{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const o=e[0];if(!vt[o])throw new Error(`Can't parse ${o} as it is not part of the known types`);if((o==="to-boolean"||o==="to-string")&&e.length!==2)return r.error("Expected one argument.");const c=vt[o],h=[];for(let d=1;d<e.length;d++){const m=r.parse(e[d],d,rt);if(!m)return null;h.push(m)}return new it(c,h)}evaluate(e){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(e));if(this.type.kind==="color"){let r,o;for(const c of this.args){if(r=c.evaluate(e),o=null,r instanceof B)return r;if(typeof r=="string"){const h=e.parseColor(r);if(h)return h}else if(Array.isArray(r)&&(o=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:pe(r[0],r[1],r[2],r[3]),!o))return new B(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Le(o||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="padding"){let r;for(const o of this.args){r=o.evaluate(e);const c=X.parse(r);if(c)return c}throw new Le(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="number"){let r=null;for(const o of this.args){if(r=o.evaluate(e),r===null)return 0;const c=Number(r);if(!isNaN(c))return c}throw new Le(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?W.fromString(Ve(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?J.fromString(Ve(this.args[0].evaluate(e))):Ve(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const ut=["Unknown","Point","LineString","Polygon"];class bt{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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"?ut[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 r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=B.parse(e)),r}}class kt{constructor(e,r,o,c){this.name=e,this.type=r,this._evaluate=o,this.args=c}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const o=e[0],c=kt.definitions[o];if(!c)return r.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0);const h=Array.isArray(c)?c[0]:c.type,d=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,m=d.filter(([x])=>!Array.isArray(x)||x.length===e.length-1);let g=null;for(const[x,T]of m){g=new An(r.registry,r.path,null,r.scope);const S=[];let P=!1;for(let k=1;k<e.length;k++){const L=e[k],Z=Array.isArray(x)?x[k-1]:x.type,q=g.parse(L,1+S.length,Z);if(!q){P=!0;break}S.push(q)}if(!P)if(Array.isArray(x)&&x.length!==S.length)g.error(`Expected ${x.length} arguments, but found ${S.length} instead.`);else{for(let k=0;k<S.length;k++){const L=Array.isArray(x)?x[k]:x.type,Z=S[k];g.concat(k+1).checkSubtype(L,Z.type)}if(g.errors.length===0)return new kt(o,h,T,S)}}if(m.length===1)r.errors.push(...g.errors);else{const x=(m.length?m:d).map(([S])=>{return P=S,Array.isArray(P)?`(${P.map(Pt).join(", ")})`:`(${Pt(P.type)}...)`;var P}).join(" | "),T=[];for(let S=1;S<e.length;S++){const P=r.parse(e[S],1+T.length);if(!P)return null;T.push(Pt(P.type))}r.error(`Expected arguments of type ${x}, but found (${T.join(", ")}) instead.`)}return null}static register(e,r){kt.definitions=r;for(const o in r)e[o]=kt}}class si{constructor(e,r,o){this.type=Sr,this.locale=o,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const o=e[1];if(typeof o!="object"||Array.isArray(o))return r.error("Collator options argument must be an object.");const c=r.parse(o["case-sensitive"]!==void 0&&o["case-sensitive"],1,ot);if(!c)return null;const h=r.parse(o["diacritic-sensitive"]!==void 0&&o["diacritic-sensitive"],1,ot);if(!h)return null;let d=null;return o.locale&&(d=r.parse(o.locale,1,ct),!d)?null:new si(c,h,d)}evaluate(e){return new j(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}}const $t=8192;function _i(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function In(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Kn(i,e){const r=(180+i[0])/360,o=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,c=Math.pow(2,e.z);return[Math.round(r*c*$t),Math.round(o*c*$t)]}function Dt(i,e,r){const o=i[0]-e[0],c=i[1]-e[1],h=i[0]-r[0],d=i[1]-r[1];return o*d-h*c==0&&o*h<=0&&c*d<=0}function as(i,e){let r=!1;for(let d=0,m=e.length;d<m;d++){const g=e[d];for(let x=0,T=g.length;x<T-1;x++){if(Dt(i,g[x],g[x+1]))return!1;(c=g[x])[1]>(o=i)[1]!=(h=g[x+1])[1]>o[1]&&o[0]<(h[0]-c[0])*(o[1]-c[1])/(h[1]-c[1])+c[0]&&(r=!r)}}var o,c,h;return r}function ls(i,e){for(let r=0;r<e.length;r++)if(as(i,e[r]))return!0;return!1}function ha(i,e,r,o){const c=o[0]-r[0],h=o[1]-r[1],d=(i[0]-r[0])*h-c*(i[1]-r[1]),m=(e[0]-r[0])*h-c*(e[1]-r[1]);return d>0&&m<0||d<0&&m>0}function pa(i,e,r){for(const x of r)for(let T=0;T<x.length-1;++T)if((m=[(d=x[T+1])[0]-(h=x[T])[0],d[1]-h[1]])[0]*(g=[(c=e)[0]-(o=i)[0],c[1]-o[1]])[1]-m[1]*g[0]!=0&&ha(o,c,h,d)&&ha(h,d,o,c))return!0;var o,c,h,d,m,g;return!1}function cs(i,e){for(let r=0;r<i.length;++r)if(!as(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(pa(i[r],i[r+1],e))return!1;return!0}function Pl(i,e){for(let r=0;r<e.length;r++)if(cs(i,e[r]))return!0;return!1}function Mo(i,e,r){const o=[];for(let c=0;c<i.length;c++){const h=[];for(let d=0;d<i[c].length;d++){const m=Kn(i[c][d],r);_i(e,m),h.push(m)}o.push(h)}return o}function us(i,e,r){const o=[];for(let c=0;c<i.length;c++){const h=Mo(i[c],e,r);o.push(h)}return o}function da(i,e,r,o){if(i[0]<r[0]||i[0]>r[2]){const c=.5*o;let h=i[0]-r[0]>c?-o:r[0]-i[0]>c?o:0;h===0&&(h=i[0]-r[2]>c?-o:r[2]-i[0]>c?o:0),i[0]+=h}_i(e,i)}function fa(i,e,r,o){const c=Math.pow(2,o.z)*$t,h=[o.x*$t,o.y*$t],d=[];for(const m of i)for(const g of m){const x=[g.x+h[0],g.y+h[1]];da(x,e,r,c),d.push(x)}return d}function ma(i,e,r,o){const c=Math.pow(2,o.z)*$t,h=[o.x*$t,o.y*$t],d=[];for(const g of i){const x=[];for(const T of g){const S=[T.x+h[0],T.y+h[1]];_i(e,S),x.push(S)}d.push(x)}if(e[2]-e[0]<=c/2){(m=e)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const g of d)for(const x of g)da(x,e,r,c)}var m;return d}class tn{constructor(e,r){this.type=ot,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ve(e[1])){const o=e[1];if(o.type==="FeatureCollection")for(let c=0;c<o.features.length;++c){const h=o.features[c].geometry.type;if(h==="Polygon"||h==="MultiPolygon")return new tn(o,o.features[c].geometry)}else if(o.type==="Feature"){const c=o.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new tn(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new tn(o,o)}return r.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(r,o){const c=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(o.type==="Polygon"){const m=Mo(o.coordinates,h,d),g=fa(r.geometry(),c,h,d);if(!In(c,h))return!1;for(const x of g)if(!as(x,m))return!1}if(o.type==="MultiPolygon"){const m=us(o.coordinates,h,d),g=fa(r.geometry(),c,h,d);if(!In(c,h))return!1;for(const x of g)if(!ls(x,m))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,o){const c=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(o.type==="Polygon"){const m=Mo(o.coordinates,h,d),g=ma(r.geometry(),c,h,d);if(!In(c,h))return!1;for(const x of g)if(!cs(x,m))return!1}if(o.type==="MultiPolygon"){const m=us(o.coordinates,h,d),g=ma(r.geometry(),c,h,d);if(!In(c,h))return!1;for(const x of g)if(!Pl(x,m))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}function Jn(i){if(i instanceof kt&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof tn)return!1;let e=!0;return i.eachChild(r=>{e&&!Jn(r)&&(e=!1)}),e}function Cn(i){if(i instanceof kt&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Cn(r)&&(e=!1)}),e}function Po(i,e){if(i instanceof kt&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(o=>{r&&!Po(o,e)&&(r=!1)}),r}class zo{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const o=e[1];return r.scope.has(o)?new zo(o,r.scope.get(o)):r.error(`Unknown variable "${o}". Make sure "${o}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class An{constructor(e,r=[],o,c=new $i,h=[]){this.registry=e,this.path=r,this.key=r.map(d=>`[${d}]`).join(""),this.scope=c,this.errors=h,this.expectedType=o}parse(e,r,o,c,h={}){return r?this.concat(r,o,c)._parse(e,h):this._parse(e,h)}_parse(e,r){function o(c,h,d){return d==="assert"?new Qe(h,[c]):d==="coerce"?new it(h,[c]):c}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 c=e[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const h=this.registry[c];if(h){let d=h.parse(e,this);if(!d)return null;if(this.expectedType){const m=this.expectedType,g=d.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||g.kind!=="value")if(m.kind!=="color"&&m.kind!=="formatted"&&m.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(m.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array"){if(this.checkSubtype(m,g))return null}else d=o(d,m,r.typeAnnotation||"coerce");else d=o(d,m,r.typeAnnotation||"coerce");else d=o(d,m,r.typeAnnotation||"assert")}if(!(d instanceof qe)&&d.type.kind!=="resolvedImage"&&hs(d)){const m=new bt;try{d=new qe(d.type,d.evaluate(m))}catch(g){return this.error(g.message),null}}return d}return this.error(`Unknown expression "${c}". 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,r,o){const c=typeof e=="number"?this.path.concat(e):this.path,h=o?this.scope.concat(o):this.scope;return new An(this.registry,c,r||null,h,this.errors)}error(e,...r){const o=`${this.key}${r.map(c=>`[${c}]`).join("")}`;this.errors.push(new Oi(o,e))}checkSubtype(e,r){const o=fr(e,r);return o&&this.error(o),o}}function hs(i){if(i instanceof zo)return hs(i.boundExpression);if(i instanceof kt&&i.name==="error"||i instanceof si||i instanceof tn)return!1;const e=i instanceof it||i instanceof Qe;let r=!0;return i.eachChild(o=>{r=e?r&&hs(o):r&&o instanceof qe}),!!r&&Jn(i)&&Po(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ko(i,e){const r=i.length-1;let o,c,h=0,d=r,m=0;for(;h<=d;)if(m=Math.floor((h+d)/2),o=i[m],c=i[m+1],o<=e){if(m===r||e<c)return m;h=m+1}else{if(!(o>e))throw new Le("Input is not a number.");d=m-1}return 0}class Yn{constructor(e,r,o){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[c,h]of o)this.labels.push(c),this.outputs.push(h)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const o=r.parse(e[1],1,Ie);if(!o)return null;const c=[];let h=null;r.expectedType&&r.expectedType.kind!=="value"&&(h=r.expectedType);for(let d=1;d<e.length;d+=2){const m=d===1?-1/0:e[d],g=e[d+1],x=d,T=d+1;if(typeof m!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',x);if(c.length&&c[c.length-1][0]>=m)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const S=r.parse(g,T,h);if(!S)return null;h=h||S.type,c.push([m,S])}return new Yn(h,o,c)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const c=this.input.evaluate(e);if(c<=r[0])return o[0].evaluate(e);const h=r.length;return c>=r[h-1]?o[h-1].evaluate(e):o[ko(r,c)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Ut(i,e,r){return i*(1-r)+e*r}var Qn=Object.freeze({__proto__:null,number:Ut,color:function(i,e,r){return new B(Ut(i.r,e.r,r),Ut(i.g,e.g,r),Ut(i.b,e.b,r),Ut(i.a,e.a,r))},array:function(i,e,r){return i.map((o,c)=>Ut(o,e[c],r))},padding:function(i,e,r){const o=i.values,c=e.values;return new X([Ut(o[0],c[0],r),Ut(o[1],c[1],r),Ut(o[2],c[2],r),Ut(o[3],c[3],r)])}});const ga=.95047,_a=1.08883,ps=4/29,Do=6/29,ya=3*Do*Do,zl=Math.PI/180,kl=180/Math.PI;function ds(i){return i>.008856451679035631?Math.pow(i,1/3):i/ya+ps}function fs(i){return i>Do?i*i*i:ya*(i-ps)}function ms(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function gs(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Et(i){const e=gs(i.r),r=gs(i.g),o=gs(i.b),c=ds((.4124564*e+.3575761*r+.1804375*o)/ga),h=ds((.2126729*e+.7151522*r+.072175*o)/1);return{l:116*h-16,a:500*(c-h),b:200*(h-ds((.0193339*e+.119192*r+.9503041*o)/_a)),alpha:i.a}}function xa(i){let e=(i.l+16)/116,r=isNaN(i.a)?e:e+i.a/500,o=isNaN(i.b)?e:e-i.b/200;return e=1*fs(e),r=ga*fs(r),o=_a*fs(o),new B(ms(3.2404542*r-1.5371385*e-.4985314*o),ms(-.969266*r+1.8760108*e+.041556*o),ms(.0556434*r-.2040259*e+1.0572252*o),i.alpha)}function Dl(i,e,r){const o=e-i;return i+r*(o>180||o<-180?o-360*Math.round(o/360):o)}const eo={forward:Et,reverse:xa,interpolate:function(i,e,r){return{l:Ut(i.l,e.l,r),a:Ut(i.a,e.a,r),b:Ut(i.b,e.b,r),alpha:Ut(i.alpha,e.alpha,r)}}},to={forward:function(i){const{l:e,a:r,b:o}=Et(i),c=Math.atan2(o,r)*kl;return{h:c<0?c+360:c,c:Math.sqrt(r*r+o*o),l:e,alpha:i.a}},reverse:function(i){const e=i.h*zl,r=i.c;return xa({l:i.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:i.alpha})},interpolate:function(i,e,r){return{h:Dl(i.h,e.h,r),c:Ut(i.c,e.c,r),l:Ut(i.l,e.l,r),alpha:Ut(i.alpha,e.alpha,r)}}};var va=Object.freeze({__proto__:null,lab:eo,hcl:to});class Ui{constructor(e,r,o,c,h){this.type=e,this.operator=r,this.interpolation=o,this.input=c,this.labels=[],this.outputs=[];for(const[d,m]of h)this.labels.push(d),this.outputs.push(m)}static interpolationFactor(e,r,o,c){let h=0;if(e.name==="exponential")h=_s(r,e.base,o,c);else if(e.name==="linear")h=_s(r,1,o,c);else if(e.name==="cubic-bezier"){const d=e.controlPoints;h=new Y(d[0],d[1],d[2],d[3]).solve(_s(r,1,o,c))}return h}static parse(e,r){let[o,c,h,...d]=e;if(!Array.isArray(c)||c.length===0)return r.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){const x=c[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:x}}else{if(c[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const x=c.slice(1);if(x.length!==4||x.some(T=>typeof T!="number"||T<0||T>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:x}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(h=r.parse(h,2,Ie),!h)return null;const m=[];let g=null;o==="interpolate-hcl"||o==="interpolate-lab"?g=fi:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let x=0;x<d.length;x+=2){const T=d[x],S=d[x+1],P=x+3,k=x+4;if(typeof T!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',P);if(m.length&&m[m.length-1][0]>=T)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',P);const L=r.parse(S,k,g);if(!L)return null;g=g||L.type,m.push([T,L])}return g.kind==="number"||g.kind==="color"||g.kind==="padding"||g.kind==="array"&&g.itemType.kind==="number"&&typeof g.N=="number"?new Ui(g,o,c,h,m):r.error(`Type ${Pt(g)} is not interpolatable.`)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const c=this.input.evaluate(e);if(c<=r[0])return o[0].evaluate(e);const h=r.length;if(c>=r[h-1])return o[h-1].evaluate(e);const d=ko(r,c),m=Ui.interpolationFactor(this.interpolation,c,r[d],r[d+1]),g=o[d].evaluate(e),x=o[d+1].evaluate(e);return this.operator==="interpolate"?Qn[this.type.kind.toLowerCase()](g,x,m):this.operator==="interpolate-hcl"?to.reverse(to.interpolate(to.forward(g),to.forward(x),m)):eo.reverse(eo.interpolate(eo.forward(g),eo.forward(x),m))}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function _s(i,e,r,o){const c=o-r,h=i-r;return c===0?0:e===1?h/c:(Math.pow(e,h)-1)/(Math.pow(e,c)-1)}class Lo{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let o=null;const c=r.expectedType;c&&c.kind!=="value"&&(o=c);const h=[];for(const m of e.slice(1)){const g=r.parse(m,1+h.length,o,void 0,{typeAnnotation:"omit"});if(!g)return null;o=o||g.type,h.push(g)}if(!o)throw new Error("No output type");const d=c&&h.some(m=>fr(c,m.type));return new Lo(d?rt:o,h)}evaluate(e){let r,o=null,c=0;for(const h of this.args)if(c++,o=h.evaluate(e),o&&o instanceof J&&!o.available&&(r||(r=o.name),o=null,c===this.args.length&&(o=r)),o!==null)break;return o}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class Ro{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const o=[];for(let h=1;h<e.length-1;h+=2){const d=e[h];if(typeof d!="string")return r.error(`Expected string, but found ${typeof d} instead.`,h);if(/[^a-zA-Z0-9_]/.test(d))return r.error("Variable names must contain only alphanumeric characters or '_'.",h);const m=r.parse(e[h+1],h+1);if(!m)return null;o.push([d,m])}const c=r.parse(e[e.length-1],e.length-1,r.expectedType,o);return c?new Ro(o,c):null}outputDefined(){return this.result.outputDefined()}}class ys{constructor(e,r,o){this.type=e,this.index=r,this.input=o}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Ie),c=r.parse(e[2],2,Ti(r.expectedType||rt));return o&&c?new ys(c.type.itemType,o,c):null}evaluate(e){const r=this.index.evaluate(e),o=this.input.evaluate(e);if(r<0)throw new Le(`Array index out of bounds: ${r} < 0.`);if(r>=o.length)throw new Le(`Array index out of bounds: ${r} > ${o.length-1}.`);if(r!==Math.floor(r))throw new Le(`Array index must be an integer, but found ${r} instead.`);return o[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class xs{constructor(e,r){this.type=ot,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,rt),c=r.parse(e[2],2,rt);return o&&c?Yr(o.type,[ot,ct,Ie,$r,rt])?new xs(o,c):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Pt(o.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!o)return!1;if(!Qr(r,["boolean","string","number","null"]))throw new Le(`Expected first argument to be of type boolean, string, number or null, but found ${Pt(he(r))} instead.`);if(!Qr(o,["string","array"]))throw new Le(`Expected second argument to be of type array or string, but found ${Pt(he(o))} instead.`);return o.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Bo{constructor(e,r,o){this.type=Ie,this.needle=e,this.haystack=r,this.fromIndex=o}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,rt),c=r.parse(e[2],2,rt);if(!o||!c)return null;if(!Yr(o.type,[ot,ct,Ie,$r,rt]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Pt(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Ie);return h?new Bo(o,c,h):null}return new Bo(o,c)}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!Qr(r,["boolean","string","number","null"]))throw new Le(`Expected first argument to be of type boolean, string, number or null, but found ${Pt(he(r))} instead.`);if(!Qr(o,["string","array"]))throw new Le(`Expected second argument to be of type array or string, but found ${Pt(he(o))} instead.`);if(this.fromIndex){const c=this.fromIndex.evaluate(e);return o.indexOf(r,c)}return o.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class vs{constructor(e,r,o,c,h,d){this.inputType=e,this.type=r,this.input=o,this.cases=c,this.outputs=h,this.otherwise=d}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let o,c;r.expectedType&&r.expectedType.kind!=="value"&&(c=r.expectedType);const h={},d=[];for(let x=2;x<e.length-1;x+=2){let T=e[x];const S=e[x+1];Array.isArray(T)||(T=[T]);const P=r.concat(x);if(T.length===0)return P.error("Expected at least one branch label.");for(const L of T){if(typeof L!="number"&&typeof L!="string")return P.error("Branch labels must be numbers or strings.");if(typeof L=="number"&&Math.abs(L)>Number.MAX_SAFE_INTEGER)return P.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof L=="number"&&Math.floor(L)!==L)return P.error("Numeric branch labels must be integer values.");if(o){if(P.checkSubtype(o,he(L)))return null}else o=he(L);if(h[String(L)]!==void 0)return P.error("Branch labels must be unique.");h[String(L)]=d.length}const k=r.parse(S,x,c);if(!k)return null;c=c||k.type,d.push(k)}const m=r.parse(e[1],1,rt);if(!m)return null;const g=r.parse(e[e.length-1],e.length-1,c);return g?m.type.kind!=="value"&&r.concat(1).checkSubtype(o,m.type)?null:new vs(o,c,m,h,d,g):null}evaluate(e){const r=this.input.evaluate(e);return(he(r)===this.inputType&&this.outputs[this.cases[r]]||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 bs{constructor(e,r,o){this.type=e,this.branches=r,this.otherwise=o}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let o;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);const c=[];for(let d=1;d<e.length-1;d+=2){const m=r.parse(e[d],d,ot);if(!m)return null;const g=r.parse(e[d+1],d+1,o);if(!g)return null;c.push([m,g]),o=o||g.type}const h=r.parse(e[e.length-1],e.length-1,o);if(!h)return null;if(!o)throw new Error("Can't infer output type");return new bs(o,c,h)}evaluate(e){for(const[r,o]of this.branches)if(r.evaluate(e))return o.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,o]of this.branches)e(r),e(o);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class Fo{constructor(e,r,o,c){this.type=e,this.input=r,this.beginIndex=o,this.endIndex=c}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,rt),c=r.parse(e[2],2,Ie);if(!o||!c)return null;if(!Yr(o.type,[Ti(rt),ct,rt]))return r.error(`Expected first argument to be of type array or string, but found ${Pt(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Ie);return h?new Fo(o.type,o,c,h):null}return new Fo(o.type,o,c)}evaluate(e){const r=this.input.evaluate(e),o=this.beginIndex.evaluate(e);if(!Qr(r,["string","array"]))throw new Le(`Expected first argument to be of type array or string, but found ${Pt(he(r))} instead.`);if(this.endIndex){const c=this.endIndex.evaluate(e);return r.slice(o,c)}return r.slice(o)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function ba(i,e){return i==="=="||i==="!="?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 wa(i,e,r,o){return o.compare(e,r)===0}function Mn(i,e,r){const o=i!=="=="&&i!=="!=";return class np{constructor(h,d,m){this.type=ot,this.lhs=h,this.rhs=d,this.collator=m,this.hasUntypedArgument=h.type.kind==="value"||d.type.kind==="value"}static parse(h,d){if(h.length!==3&&h.length!==4)return d.error("Expected two or three arguments.");const m=h[0];let g=d.parse(h[1],1,rt);if(!g)return null;if(!ba(m,g.type))return d.concat(1).error(`"${m}" comparisons are not supported for type '${Pt(g.type)}'.`);let x=d.parse(h[2],2,rt);if(!x)return null;if(!ba(m,x.type))return d.concat(2).error(`"${m}" comparisons are not supported for type '${Pt(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return d.error(`Cannot compare types '${Pt(g.type)}' and '${Pt(x.type)}'.`);o&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new Qe(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new Qe(g.type,[x])));let T=null;if(h.length===4){if(g.type.kind!=="string"&&x.type.kind!=="string"&&g.type.kind!=="value"&&x.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(T=d.parse(h[3],3,Sr),!T)return null}return new np(g,x,T)}evaluate(h){const d=this.lhs.evaluate(h),m=this.rhs.evaluate(h);if(o&&this.hasUntypedArgument){const g=he(d),x=he(m);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new Le(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${x.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const g=he(d),x=he(m);if(g.kind!=="string"||x.kind!=="string")return e(h,d,m)}return this.collator?r(h,d,m,this.collator.evaluate(h)):e(h,d,m)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}}}const Ll=Mn("==",function(i,e,r){return e===r},wa),Rl=Mn("!=",function(i,e,r){return e!==r},function(i,e,r,o){return!wa(0,e,r,o)}),Bl=Mn("<",function(i,e,r){return e<r},function(i,e,r,o){return o.compare(e,r)<0}),Fl=Mn(">",function(i,e,r){return e>r},function(i,e,r,o){return o.compare(e,r)>0}),Ol=Mn("<=",function(i,e,r){return e<=r},function(i,e,r,o){return o.compare(e,r)<=0}),$l=Mn(">=",function(i,e,r){return e>=r},function(i,e,r,o){return o.compare(e,r)>=0});class ws{constructor(e,r,o,c,h){this.type=ct,this.number=e,this.locale=r,this.currency=o,this.minFractionDigits=c,this.maxFractionDigits=h}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const o=r.parse(e[1],1,Ie);if(!o)return null;const c=e[2];if(typeof c!="object"||Array.isArray(c))return r.error("NumberFormat options argument must be an object.");let h=null;if(c.locale&&(h=r.parse(c.locale,1,ct),!h))return null;let d=null;if(c.currency&&(d=r.parse(c.currency,1,ct),!d))return null;let m=null;if(c["min-fraction-digits"]&&(m=r.parse(c["min-fraction-digits"],1,Ie),!m))return null;let g=null;return c["max-fraction-digits"]&&(g=r.parse(c["max-fraction-digits"],1,Ie),!g)?null:new ws(o,h,d,m,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.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.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Oo{constructor(e){this.type=oi,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const o=e[1];if(!Array.isArray(o)&&typeof o=="object")return r.error("First argument must be an image or text section.");const c=[];let h=!1;for(let d=1;d<=e.length-1;++d){const m=e[d];if(h&&typeof m=="object"&&!Array.isArray(m)){h=!1;let g=null;if(m["font-scale"]&&(g=r.parse(m["font-scale"],1,Ie),!g))return null;let x=null;if(m["text-font"]&&(x=r.parse(m["text-font"],1,Ti(ct)),!x))return null;let T=null;if(m["text-color"]&&(T=r.parse(m["text-color"],1,fi),!T))return null;const S=c[c.length-1];S.scale=g,S.font=x,S.textColor=T}else{const g=r.parse(e[d],1,rt);if(!g)return null;const x=g.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");h=!0,c.push({content:g,scale:null,font:null,textColor:null})}}return new Oo(c)}evaluate(e){return new W(this.sections.map(r=>{const o=r.content.evaluate(e);return he(o)===Jt?new K("",o,null,null,null):new K(Ve(o),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class Ts{constructor(e){this.type=Jt,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const o=r.parse(e[1],1,ct);return o?new Ts(o):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),o=J.fromString(r);return o&&e.availableImages&&(o.available=e.availableImages.indexOf(r)>-1),o}eachChild(e){e(this.input)}outputDefined(){return!1}}class Es{constructor(e){this.type=Ie,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const o=r.parse(e[1],1);return o?o.type.kind!=="array"&&o.type.kind!=="string"&&o.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${Pt(o.type)} instead.`):new Es(o):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Le(`Expected value to be of type string or array, but found ${Pt(he(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Pn={"==":Ll,"!=":Rl,">":Fl,"<":Bl,">=":$l,"<=":Ol,array:Qe,at:ys,boolean:Qe,case:bs,coalesce:Lo,collator:si,format:Oo,image:Ts,in:xs,"index-of":Bo,interpolate:Ui,"interpolate-hcl":Ui,"interpolate-lab":Ui,length:Es,let:Ro,literal:qe,match:vs,number:Qe,"number-format":ws,object:Qe,slice:Fo,step:Yn,string:Qe,"to-boolean":it,"to-color":it,"to-number":it,"to-string":it,var:zo,within:tn};function Ta(i,[e,r,o,c]){e=e.evaluate(i),r=r.evaluate(i),o=o.evaluate(i);const h=c?c.evaluate(i):1,d=pe(e,r,o,h);if(d)throw new Le(d);return new B(e/255*h,r/255*h,o/255*h,h)}function Ea(i,e){return i in e}function $o(i,e){const r=e[i];return r===void 0?null:r}function rn(i){return{type:i}}function Sa(i){return{result:"success",value:i}}function zn(i){return{result:"error",value:i}}function Ft(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Ia(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function mt(i){return!!i.expression&&i.expression.interpolated}function St(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Bt(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Vt(i){return i}function io(i,e){const r=e.type==="color",o=i.stops&&typeof i.stops[0][0]=="object",c=o||!(o||i.property!==void 0),h=i.type||(mt(e)?"exponential":"interval");if(r||e.type==="padding"){const x=r?B.parse:X.parse;(i=ir({},i)).stops&&(i.stops=i.stops.map(T=>[T[0],x(T[1])])),i.default=x(i.default?i.default:e.default)}if(i.colorSpace&&i.colorSpace!=="rgb"&&!va[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let d,m,g;if(h==="exponential")d=Ca;else if(h==="interval")d=Vl;else if(h==="categorical"){d=Ul,m=Object.create(null);for(const x of i.stops)m[x[0]]=x[1];g=typeof i.stops[0][0]}else{if(h!=="identity")throw new Error(`Unknown function type "${h}"`);d=Nl}if(o){const x={},T=[];for(let k=0;k<i.stops.length;k++){const L=i.stops[k],Z=L[0].zoom;x[Z]===void 0&&(x[Z]={zoom:Z,type:i.type,property:i.property,default:i.default,stops:[]},T.push(Z)),x[Z].stops.push([L[0].value,L[1]])}const S=[];for(const k of T)S.push([x[k].zoom,io(x[k],e)]);const P={name:"linear"};return{kind:"composite",interpolationType:P,interpolationFactor:Ui.interpolationFactor.bind(void 0,P),zoomStops:S.map(k=>k[0]),evaluate:({zoom:k},L)=>Ca({stops:S,base:i.base},e,k).evaluate(k,L)}}if(c){const x=h==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:Ui.interpolationFactor.bind(void 0,x),zoomStops:i.stops.map(T=>T[0]),evaluate:({zoom:T})=>d(i,e,T,m,g)}}return{kind:"source",evaluate(x,T){const S=T&&T.properties?T.properties[i.property]:void 0;return S===void 0?kn(i.default,e.default):d(i,e,S,m,g)}}}function kn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Ul(i,e,r,o,c){return kn(typeof r===c?o[r]:void 0,i.default,e.default)}function Vl(i,e,r){if(St(r)!=="number")return kn(i.default,e.default);const o=i.stops.length;if(o===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[o-1][0])return i.stops[o-1][1];const c=ko(i.stops.map(h=>h[0]),r);return i.stops[c][1]}function Ca(i,e,r){const o=i.base!==void 0?i.base:1;if(St(r)!=="number")return kn(i.default,e.default);const c=i.stops.length;if(c===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[c-1][0])return i.stops[c-1][1];const h=ko(i.stops.map(T=>T[0]),r),d=function(T,S,P,k){const L=k-P,Z=T-P;return L===0?0:S===1?Z/L:(Math.pow(S,Z)-1)/(Math.pow(S,L)-1)}(r,o,i.stops[h][0],i.stops[h+1][0]),m=i.stops[h][1],g=i.stops[h+1][1];let x=Qn[e.type]||Vt;if(i.colorSpace&&i.colorSpace!=="rgb"){const T=va[i.colorSpace];x=(S,P)=>T.reverse(T.interpolate(T.forward(S),T.forward(P),d))}return typeof m.evaluate=="function"?{evaluate(...T){const S=m.evaluate.apply(void 0,T),P=g.evaluate.apply(void 0,T);if(S!==void 0&&P!==void 0)return x(S,P,d)}}:x(m,g,d)}function Nl(i,e,r){switch(e.type){case"color":r=B.parse(r);break;case"formatted":r=W.fromString(r.toString());break;case"resolvedImage":r=J.fromString(r.toString());break;case"padding":r=X.parse(r);break;default:St(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return kn(r,i.default,e.default)}kt.register(Pn,{error:[{kind:"error"},[ct],(i,[e])=>{throw new Le(e.evaluate(i))}],typeof:[ct,[rt],(i,[e])=>Pt(he(e.evaluate(i)))],"to-rgba":[Ti(Ie,4),[fi],(i,[e])=>e.evaluate(i).toArray()],rgb:[fi,[Ie,Ie,Ie],Ta],rgba:[fi,[Ie,Ie,Ie,Ie],Ta],has:{type:ot,overloads:[[[ct],(i,[e])=>Ea(e.evaluate(i),i.properties())],[[ct,Ur],(i,[e,r])=>Ea(e.evaluate(i),r.evaluate(i))]]},get:{type:rt,overloads:[[[ct],(i,[e])=>$o(e.evaluate(i),i.properties())],[[ct,Ur],(i,[e,r])=>$o(e.evaluate(i),r.evaluate(i))]]},"feature-state":[rt,[ct],(i,[e])=>$o(e.evaluate(i),i.featureState||{})],properties:[Ur,[],i=>i.properties()],"geometry-type":[ct,[],i=>i.geometryType()],id:[rt,[],i=>i.id()],zoom:[Ie,[],i=>i.globals.zoom],"heatmap-density":[Ie,[],i=>i.globals.heatmapDensity||0],"line-progress":[Ie,[],i=>i.globals.lineProgress||0],accumulated:[rt,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ie,rn(Ie),(i,e)=>{let r=0;for(const o of e)r+=o.evaluate(i);return r}],"*":[Ie,rn(Ie),(i,e)=>{let r=1;for(const o of e)r*=o.evaluate(i);return r}],"-":{type:Ie,overloads:[[[Ie,Ie],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Ie],(i,[e])=>-e.evaluate(i)]]},"/":[Ie,[Ie,Ie],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Ie,[Ie,Ie],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Ie,[],()=>Math.LN2],pi:[Ie,[],()=>Math.PI],e:[Ie,[],()=>Math.E],"^":[Ie,[Ie,Ie],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Ie,[Ie],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Ie,[Ie],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Ie,[Ie],(i,[e])=>Math.log(e.evaluate(i))],log2:[Ie,[Ie],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Ie,[Ie],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Ie,[Ie],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Ie,[Ie],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Ie,[Ie],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Ie,[Ie],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Ie,[Ie],(i,[e])=>Math.atan(e.evaluate(i))],min:[Ie,rn(Ie),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Ie,rn(Ie),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Ie,[Ie],(i,[e])=>Math.abs(e.evaluate(i))],round:[Ie,[Ie],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ie,[Ie],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Ie,[Ie],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[ot,[ct,rt],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[ot,[rt],(i,[e])=>i.id()===e.value],"filter-type-==":[ot,[ct],(i,[e])=>i.geometryType()===e.value],"filter-<":[ot,[ct,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<c}],"filter-id-<":[ot,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<o}],"filter->":[ot,[ct,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>c}],"filter-id->":[ot,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>o}],"filter-<=":[ot,[ct,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<=c}],"filter-id-<=":[ot,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<=o}],"filter->=":[ot,[ct,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>=c}],"filter-id->=":[ot,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>=o}],"filter-has":[ot,[rt],(i,[e])=>e.value in i.properties()],"filter-has-id":[ot,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[ot,[Ti(ct)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[ot,[Ti(rt)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[ot,[ct,Ti(rt)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[ot,[ct,Ti(rt)],(i,[e,r])=>function(o,c,h,d){for(;h<=d;){const m=h+d>>1;if(c[m]===o)return!0;c[m]>o?d=m-1:h=m+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:ot,overloads:[[[ot,ot],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[rn(ot),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:ot,overloads:[[[ot,ot],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[rn(ot),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[ot,[ot],(i,[e])=>!e.evaluate(i)],"is-supported-script":[ot,[ct],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[ct,[ct],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[ct,[ct],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[ct,rn(rt),(i,e)=>e.map(r=>Ve(r.evaluate(i))).join("")],"resolved-locale":[ct,[Sr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Uo{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new bt,this._defaultValue=r?function(o){return o.type==="color"&&Bt(o.default)?new B(0,0,0,0):o.type==="color"?B.parse(o.default)||null:o.type==="padding"?X.parse(o.default)||null:o.default===void 0?null:o.default}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,o,c,h,d){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=o,this._evaluator.canonical=c,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(e,r,o,c,h,d){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=o||null,this._evaluator.canonical=c,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=d||null;try{const m=this.expression.evaluate(this._evaluator);if(m==null||typeof m=="number"&&m!=m)return this._defaultValue;if(this._enumValues&&!(m in this._enumValues))throw new Le(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(m)} instead.`);return m}catch(m){return this._warningHistory[m.message]||(this._warningHistory[m.message]=!0,typeof console!="undefined"&&console.warn(m.message)),this._defaultValue}}}function ro(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Pn}function no(i,e){const r=new An(Pn,[],e?function(c){const h={color:fi,string:ct,number:Ie,enum:ct,boolean:ot,formatted:oi,padding:Tn,resolvedImage:Jt};return c.type==="array"?Ti(h[c.value]||rt,c.length):h[c.type]}(e):void 0),o=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?Sa(new Uo(o,e)):zn(r.errors)}class oo{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Cn(r.expression)}evaluateWithoutErrorHandling(e,r,o,c,h,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,c,h,d)}evaluate(e,r,o,c,h,d){return this._styleExpression.evaluate(e,r,o,c,h,d)}}class Ss{constructor(e,r,o,c){this.kind=e,this.zoomStops=o,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Cn(r.expression),this.interpolationType=c}evaluateWithoutErrorHandling(e,r,o,c,h,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,c,h,d)}evaluate(e,r,o,c,h,d){return this._styleExpression.evaluate(e,r,o,c,h,d)}interpolationFactor(e,r,o){return this.interpolationType?Ui.interpolationFactor(this.interpolationType,e,r,o):0}}function Aa(i,e){const r=no(i,e);if(r.result==="error")return r;const o=r.value.expression,c=Jn(o);if(!c&&!Ft(e))return zn([new Oi("","data expressions not supported")]);const h=Po(o,["zoom"]);if(!h&&!Ia(e))return zn([new Oi("","zoom expressions not supported")]);const d=No(o);return d||h?d instanceof Oi?zn([d]):d instanceof Ui&&!mt(e)?zn([new Oi("",'"interpolate" expressions cannot be used with this property')]):Sa(d?new Ss(c?"camera":"composite",r.value,d.labels,d instanceof Ui?d.interpolation:void 0):new oo(c?"constant":"source",r.value)):zn([new Oi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Vo{constructor(e,r){this._parameters=e,this._specification=r,ir(this,io(this._parameters,this._specification))}static deserialize(e){return new Vo(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function No(i){let e=null;if(i instanceof Ro)e=No(i.result);else if(i instanceof Lo){for(const r of i.args)if(e=No(r),e)break}else(i instanceof Yn||i instanceof Ui)&&i.input instanceof kt&&i.input.name==="zoom"&&(e=i);return e instanceof Oi||i.eachChild(r=>{const o=No(r);o instanceof Oi?e=o:!e&&o?e=new Oi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&o&&e!==o&&(e=new Oi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function rr(i){const e=i.key,r=i.value,o=i.valueSpec||{},c=i.objectElementValidators||{},h=i.style,d=i.styleSpec;let m=[];const g=St(r);if(g!=="object")return[new Me(e,r,`object expected, ${g} found`)];for(const x in r){const T=x.split(".")[0],S=o[T]||o["*"];let P;if(c[T])P=c[T];else if(o[T])P=Ni;else if(c["*"])P=c["*"];else{if(!o["*"]){m.push(new Me(e,r[x],`unknown property "${x}"`));continue}P=Ni}m=m.concat(P({key:(e&&`${e}.`)+x,value:r[x],valueSpec:S,style:h,styleSpec:d,object:r,objectKey:x},r))}for(const x in o)c[x]||o[x].required&&o[x].default===void 0&&r[x]===void 0&&m.push(new Me(e,r,`missing required property "${x}"`));return m}function Ma(i){const e=i.value,r=i.valueSpec,o=i.style,c=i.styleSpec,h=i.key,d=i.arrayElementValidator||Ni;if(St(e)!=="array")return[new Me(h,e,`array expected, ${St(e)} found`)];if(r.length&&e.length!==r.length)return[new Me(h,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Me(h,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let m={type:r.value,values:r.values};c.$version<7&&(m.function=r.function),St(r.value)==="object"&&(m=r.value);let g=[];for(let x=0;x<e.length;x++)g=g.concat(d({array:e,arrayIndex:x,value:e[x],valueSpec:m,style:o,styleSpec:c,key:`${h}[${x}]`}));return g}function Is(i){const e=i.key,r=i.value,o=i.valueSpec;let c=St(r);return c==="number"&&r!=r&&(c="NaN"),c!=="number"?[new Me(e,r,`number expected, ${c} found`)]:"minimum"in o&&r<o.minimum?[new Me(e,r,`${r} is less than the minimum value ${o.minimum}`)]:"maximum"in o&&r>o.maximum?[new Me(e,r,`${r} is greater than the maximum value ${o.maximum}`)]:[]}function Pa(i){const e=i.valueSpec,r=xt(i.value.type);let o,c,h,d={};const m=r!=="categorical"&&i.value.property===void 0,g=!m,x=St(i.value.stops)==="array"&&St(i.value.stops[0])==="array"&&St(i.value.stops[0][0])==="object",T=rr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(k){if(r==="identity")return[new Me(k.key,k.value,'identity function may not have a "stops" property')];let L=[];const Z=k.value;return L=L.concat(Ma({key:k.key,value:Z,valueSpec:k.valueSpec,style:k.style,styleSpec:k.styleSpec,arrayElementValidator:S})),St(Z)==="array"&&Z.length===0&&L.push(new Me(k.key,Z,"array must have at least one stop")),L},default:function(k){return Ni({key:k.key,value:k.value,valueSpec:e,style:k.style,styleSpec:k.styleSpec})}}});return r==="identity"&&m&&T.push(new Me(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||T.push(new Me(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!mt(i.valueSpec)&&T.push(new Me(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!Ft(i.valueSpec)?T.push(new Me(i.key,i.value,"property functions not supported")):m&&!Ia(i.valueSpec)&&T.push(new Me(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||T.push(new Me(i.key,i.value,'"property" property is required')),T;function S(k){let L=[];const Z=k.value,q=k.key;if(St(Z)!=="array")return[new Me(q,Z,`array expected, ${St(Z)} found`)];if(Z.length!==2)return[new Me(q,Z,`array length 2 expected, length ${Z.length} found`)];if(x){if(St(Z[0])!=="object")return[new Me(q,Z,`object expected, ${St(Z[0])} found`)];if(Z[0].zoom===void 0)return[new Me(q,Z,"object stop key must have zoom")];if(Z[0].value===void 0)return[new Me(q,Z,"object stop key must have value")];if(h&&h>xt(Z[0].zoom))return[new Me(q,Z[0].zoom,"stop zoom values must appear in ascending order")];xt(Z[0].zoom)!==h&&(h=xt(Z[0].zoom),c=void 0,d={}),L=L.concat(rr({key:`${q}[0]`,value:Z[0],valueSpec:{zoom:{}},style:k.style,styleSpec:k.styleSpec,objectElementValidators:{zoom:Is,value:P}}))}else L=L.concat(P({key:`${q}[0]`,value:Z[0],valueSpec:{},style:k.style,styleSpec:k.styleSpec},Z));return ro(Ki(Z[1]))?L.concat([new Me(`${q}[1]`,Z[1],"expressions are not allowed in function stops.")]):L.concat(Ni({key:`${q}[1]`,value:Z[1],valueSpec:e,style:k.style,styleSpec:k.styleSpec}))}function P(k,L){const Z=St(k.value),q=xt(k.value),re=k.value!==null?k.value:L;if(o){if(Z!==o)return[new Me(k.key,re,`${Z} stop domain type must match previous stop domain type ${o}`)]}else o=Z;if(Z!=="number"&&Z!=="string"&&Z!=="boolean")return[new Me(k.key,re,"stop domain value must be a number, string, or boolean")];if(Z!=="number"&&r!=="categorical"){let ce=`number expected, ${Z} found`;return Ft(e)&&r===void 0&&(ce+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Me(k.key,re,ce)]}return r!=="categorical"||Z!=="number"||isFinite(q)&&Math.floor(q)===q?r!=="categorical"&&Z==="number"&&c!==void 0&&q<c?[new Me(k.key,re,"stop domain values must appear in ascending order")]:(c=q,r==="categorical"&&q in d?[new Me(k.key,re,"stop domain values must be unique")]:(d[q]=!0,[])):[new Me(k.key,re,`integer expected, found ${q}`)]}}function nn(i){const e=(i.expressionContext==="property"?Aa:no)(Ki(i.value),i.valueSpec);if(e.result==="error")return e.value.map(o=>new Me(`${i.key}${o.key}`,i.value,o.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Me(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Cn(r))return[new Me(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Cn(r))return[new Me(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Po(r,["zoom","feature-state"]))return[new Me(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Jn(r))return[new Me(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function so(i){const e=i.key,r=i.value,o=i.valueSpec,c=[];return Array.isArray(o.values)?o.values.indexOf(xt(r))===-1&&c.push(new Me(e,r,`expected one of [${o.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(o.values).indexOf(xt(r))===-1&&c.push(new Me(e,r,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(r)} found`)),c}function Dn(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Dn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Gl={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Go(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Dn(i)||(i=ao(i));const e=no(i,Gl);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,o,c)=>e.value.evaluate(r,o,{},c),needGeometry:ka(i)}}function za(i,e){return i<e?-1:i>e?1:0}function ka(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(ka(i[e]))return!0;return!1}function ao(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?Cs(i[1],i[2],"=="):e==="!="?Ln(Cs(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Cs(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(ao))):e==="all"?["all"].concat(i.slice(1).map(ao)):e==="none"?["all"].concat(i.slice(1).map(ao).map(Ln)):e==="in"?qo(i[1],i.slice(2)):e==="!in"?Ln(qo(i[1],i.slice(2))):e==="has"?lo(i[1]):e==="!has"?Ln(lo(i[1])):e!=="within"||i;var r}function Cs(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function qo(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(za)]]:["filter-in-small",i,["literal",e]]}}function lo(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Ln(i){return["!",i]}function co(i){return Dn(Ki(i.value))?nn(ir({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Da(i)}function Da(i){const e=i.value,r=i.key;if(St(e)!=="array")return[new Me(r,e,`array expected, ${St(e)} found`)];const o=i.styleSpec;let c,h=[];if(e.length<1)return[new Me(r,e,"filter array must have at least 1 element")];switch(h=h.concat(so({key:`${r}[0]`,value:e[0],valueSpec:o.filter_operator,style:i.style,styleSpec:i.styleSpec})),xt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&xt(e[1])==="$type"&&h.push(new Me(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&h.push(new Me(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(c=St(e[1]),c!=="string"&&h.push(new Me(`${r}[1]`,e[1],`string expected, ${c} found`)));for(let d=2;d<e.length;d++)c=St(e[d]),xt(e[1])==="$type"?h=h.concat(so({key:`${r}[${d}]`,value:e[d],valueSpec:o.geometry_type,style:i.style,styleSpec:i.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&h.push(new Me(`${r}[${d}]`,e[d],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let d=1;d<e.length;d++)h=h.concat(Da({key:`${r}[${d}]`,value:e[d],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":c=St(e[1]),e.length!==2?h.push(new Me(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="string"&&h.push(new Me(`${r}[1]`,e[1],`string expected, ${c} found`));break;case"within":c=St(e[1]),e.length!==2?h.push(new Me(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="object"&&h.push(new Me(`${r}[1]`,e[1],`object expected, ${c} found`))}return h}function uo(i,e){const r=i.key,o=i.style,c=i.styleSpec,h=i.value,d=i.objectKey,m=c[`${e}_${i.layerType}`];if(!m)return[];const g=d.match(/^(.*)-transition$/);if(e==="paint"&&g&&m[g[1]]&&m[g[1]].transition)return Ni({key:r,value:h,valueSpec:c.transition,style:o,styleSpec:c});const x=i.valueSpec||m[d];if(!x)return[new Me(r,h,`unknown property "${d}"`)];let T;if(St(h)==="string"&&Ft(x)&&!x.tokens&&(T=/^{([^}]+)}$/.exec(h)))return[new Me(r,h,`"${d}" does not support interpolation syntax
2
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(T[1])} }\`.`)];const S=[];return i.layerType==="symbol"&&(d==="text-field"&&o&&!o.glyphs&&S.push(new Me(r,h,'use of "text-field" requires a style "glyphs" property')),d==="text-font"&&Bt(Ki(h))&&xt(h.type)==="identity"&&S.push(new Me(r,h,'"text-font" does not support identity functions'))),S.concat(Ni({key:i.key,value:h,valueSpec:x,style:o,styleSpec:c,expressionContext:"property",propertyType:e,propertyKey:d}))}function La(i){return uo(i,"paint")}function Ra(i){return uo(i,"layout")}function Ba(i){let e=[];const r=i.value,o=i.key,c=i.style,h=i.styleSpec;r.type||r.ref||e.push(new Me(o,r,'either "type" or "ref" is required'));let d=xt(r.type);const m=xt(r.ref);if(r.id){const g=xt(r.id);for(let x=0;x<i.arrayIndex;x++){const T=c.layers[x];xt(T.id)===g&&e.push(new Me(o,r.id,`duplicate layer id "${r.id}", previously used at line ${T.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&e.push(new Me(o,r[x],`"${x}" is prohibited for ref layers`))}),c.layers.forEach(x=>{xt(x.id)===m&&(g=x)}),g?g.ref?e.push(new Me(o,r.ref,"ref cannot reference another ref layer")):d=xt(g.type):e.push(new Me(o,r.ref,`ref layer "${m}" not found`))}else if(d!=="background")if(r.source){const g=c.sources&&c.sources[r.source],x=g&&xt(g.type);g?x==="vector"&&d==="raster"?e.push(new Me(o,r.source,`layer "${r.id}" requires a raster source`)):x==="raster"&&d!=="raster"?e.push(new Me(o,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&d!=="hillshade"?e.push(new Me(o,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&g.lineMetrics||e.push(new Me(o,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Me(o,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Me(o,r.source,`source "${r.source}" not found`))}else e.push(new Me(o,r,'missing required property "source"'));return e=e.concat(rr({key:o,value:r,valueSpec:h.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Ni({key:`${o}.type`,value:r.type,valueSpec:h.layer.type,style:i.style,styleSpec:i.styleSpec,object:r,objectKey:"type"}),filter:co,layout:g=>rr({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>Ra(ir({layerType:d},x))}}),paint:g=>rr({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>La(ir({layerType:d},x))}})}})),e}function Rn(i){const e=i.value,r=i.key,o=St(e);return o!=="string"?[new Me(r,e,`string expected, ${o} found`)]:[]}const Fa={promoteId:function({key:i,value:e}){if(St(e)==="string")return Rn({key:i,value:e});{const r=[];for(const o in e)r.push(...Rn({key:`${i}.${o}`,value:e[o]}));return r}}};function ho(i){const e=i.value,r=i.key,o=i.styleSpec,c=i.style;if(!e.type)return[new Me(r,e,'"type" is required')];const h=xt(e.type);let d;switch(h){case"vector":case"raster":case"raster-dem":return d=rr({key:r,value:e,valueSpec:o[`source_${h.replace("-","_")}`],style:i.style,styleSpec:o,objectElementValidators:Fa}),d;case"geojson":if(d=rr({key:r,value:e,valueSpec:o.source_geojson,style:c,styleSpec:o,objectElementValidators:Fa}),e.cluster)for(const m in e.clusterProperties){const[g,x]=e.clusterProperties[m],T=typeof g=="string"?[g,["accumulated"],["get",m]]:g;d.push(...nn({key:`${r}.${m}.map`,value:x,expressionContext:"cluster-map"})),d.push(...nn({key:`${r}.${m}.reduce`,value:T,expressionContext:"cluster-reduce"}))}return d;case"video":return rr({key:r,value:e,valueSpec:o.source_video,style:c,styleSpec:o});case"image":return rr({key:r,value:e,valueSpec:o.source_image,style:c,styleSpec:o});case"canvas":return[new Me(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return so({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:c,styleSpec:o})}}function po(i){const e=i.value,r=i.styleSpec,o=r.light,c=i.style;let h=[];const d=St(e);if(e===void 0)return h;if(d!=="object")return h=h.concat([new Me("light",e,`object expected, ${d} found`)]),h;for(const m in e){const g=m.match(/^(.*)-transition$/);h=h.concat(g&&o[g[1]]&&o[g[1]].transition?Ni({key:m,value:e[m],valueSpec:r.transition,style:c,styleSpec:r}):o[m]?Ni({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new Me(m,e[m],`unknown property "${m}"`)])}return h}function Vi(i){const e=i.value,r=i.styleSpec,o=r.terrain,c=i.style;let h=[];const d=St(e);if(e===void 0)return h;if(d!=="object")return h=h.concat([new Me("terrain",e,`object expected, ${d} found`)]),h;for(const m in e)h=h.concat(o[m]?Ni({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new Me(m,e[m],`unknown property "${m}"`)]);return h}const fo={"*":()=>[],array:Ma,boolean:function(i){const e=i.value,r=i.key,o=St(e);return o!=="boolean"?[new Me(r,e,`boolean expected, ${o} found`)]:[]},number:Is,color:function(i){const e=i.key,r=i.value,o=St(r);return o!=="string"?[new Me(e,r,`color expected, ${o} found`)]:Sn(r)===null?[new Me(e,r,`color expected, "${r}" found`)]:[]},constants:Jr,enum:so,filter:co,function:Pa,layer:Ba,object:rr,source:ho,light:po,terrain:Vi,string:Rn,formatted:function(i){return Rn(i).length===0?[]:nn(i)},resolvedImage:function(i){return Rn(i).length===0?[]:nn(i)},padding:function(i){const e=i.key,r=i.value;if(St(r)==="array"){if(r.length<1||r.length>4)return[new Me(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const o={type:"number"};let c=[];for(let h=0;h<r.length;h++)c=c.concat(Ni({key:`${e}[${h}]`,value:r[h],valueSpec:o}));return c}return Is({key:e,value:r,valueSpec:{}})}};function Ni(i){const e=i.value,r=i.valueSpec,o=i.styleSpec;return r.expression&&Bt(xt(e))?Pa(i):r.expression&&ro(Ki(e))?nn(i):r.type&&fo[r.type]?fo[r.type](i):rr(ir({},i,{valueSpec:r.type?o[r.type]:r}))}function ql(i){const e=i.value,r=i.key,o=Rn(i);return o.length||(e.indexOf("{fontstack}")===-1&&o.push(new Me(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&o.push(new Me(r,e,'"glyphs" url must include a "{range}" token'))),o}function Vr(i,e=_e){let r=[];return r=r.concat(Ni({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,objectElementValidators:{glyphs:ql,"*":()=>[]}})),i.constants&&(r=r.concat(Jr({key:"constants",value:i.constants,style:i,styleSpec:e}))),Oa(r)}function Oa(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function Ir(i){return function(...e){return Oa(i.apply(this,e))}}Vr.source=Ir(ho),Vr.light=Ir(po),Vr.terrain=Ir(Vi),Vr.layer=Ir(Ba),Vr.filter=Ir(co),Vr.paintProperty=Ir(La),Vr.layoutProperty=Ir(Ra);const mo=Vr,As=mo.light,Zl=mo.paintProperty,jl=mo.layoutProperty;function Zo(i,e){let r=!1;if(e&&e.length)for(const o of e)i.fire(new wn(new Error(o.message))),r=!0;return r}class go{constructor(e,r,o){const c=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const d=new Int32Array(this.arrayBuffer);e=d[0],this.d=(r=d[1])+2*(o=d[2]);for(let g=0;g<this.d*this.d;g++){const x=d[3+g],T=d[3+g+1];c.push(x===T?null:d.subarray(x,T))}const m=d[3+c.length+1];this.keys=d.subarray(d[3+c.length],m),this.bboxes=d.subarray(m),this.insert=this._insertReadonly}else{this.d=r+2*o;for(let d=0;d<this.d*this.d;d++)c.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=o,this.scale=r/e,this.uid=0;const h=o/r*e;this.min=-h,this.max=e+h}insert(e,r,o,c,h){this._forEachCell(r,o,c,h,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(o),this.bboxes.push(c),this.bboxes.push(h)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,o,c,h,d){this.cells[h].push(d)}query(e,r,o,c,h){const d=this.min,m=this.max;if(e<=d&&r<=d&&m<=o&&m<=c&&!h)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(e,r,o,c,this._queryCell,g,{},h),g}}_queryCell(e,r,o,c,h,d,m,g){const x=this.cells[h];if(x!==null){const T=this.keys,S=this.bboxes;for(let P=0;P<x.length;P++){const k=x[P];if(m[k]===void 0){const L=4*k;(g?g(S[L+0],S[L+1],S[L+2],S[L+3]):e<=S[L+2]&&r<=S[L+3]&&o>=S[L+0]&&c>=S[L+1])?(m[k]=!0,d.push(T[k])):m[k]=!1}}}}_forEachCell(e,r,o,c,h,d,m,g){const x=this._convertToCellCoord(e),T=this._convertToCellCoord(r),S=this._convertToCellCoord(o),P=this._convertToCellCoord(c);for(let k=x;k<=S;k++)for(let L=T;L<=P;L++){const Z=this.d*L+k;if((!g||g(this._convertFromCellCoord(k),this._convertFromCellCoord(L),this._convertFromCellCoord(k+1),this._convertFromCellCoord(L+1)))&&h.call(this,e,r,o,c,Z,d,m,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,r=3+this.cells.length+1+1;let o=0;for(let d=0;d<this.cells.length;d++)o+=this.cells[d].length;const c=new Int32Array(r+o+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let h=r;for(let d=0;d<e.length;d++){const m=e[d];c[3+d]=h,c.set(m,h),h+=m.length}return c[3+e.length]=h,c.set(this.keys,h),h+=this.keys.length,c[3+e.length+1]=h,c.set(this.bboxes,h),h+=this.bboxes.length,c.buffer}static serialize(e,r){const o=e.toArrayBuffer();return r&&r.push(o),{buffer:o}}static deserialize(e){return new go(e.buffer)}}const Cr={};function Oe(i,e,r={}){if(Cr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),Cr[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}Oe("Object",Object),Oe("TransferableGridIndex",go),Oe("Color",B),Oe("Error",Error),Oe("AJAXError",Fi),Oe("ResolvedImage",J),Oe("StylePropertyFunction",Vo),Oe("StyleExpression",Uo,{omit:["_evaluator"]}),Oe("ZoomDependentExpression",Ss),Oe("ZoomConstantExpression",oo),Oe("CompoundExpression",kt,{omit:["_evaluate"]});for(const i in Pn)Pn[i]._classRegistryKey||Oe(`Expression_${i}`,Pn[i]);function $a(i){return i&&typeof ArrayBuffer!="undefined"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function on(i,e){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob)return i;if($a(i)||pi(i))return e&&e.push(i),i;if(ArrayBuffer.isView(i)){const r=i;return e&&e.push(r.buffer),r}if(i instanceof ImageData)return e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const r=[];for(const o of i)r.push(on(o,e));return r}if(typeof i=="object"){const r=i.constructor,o=r._classRegistryKey;if(!o)throw new Error("can't serialize object of unregistered class");if(!Cr[o])throw new Error(`${o} is not registered.`);const c=r.serialize?r.serialize(i,e):{};if(r.serialize){if(e&&c===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const h in i){if(!i.hasOwnProperty(h)||Cr[o].omit.indexOf(h)>=0)continue;const d=i[h];c[h]=Cr[o].shallow.indexOf(h)>=0?d:on(d,e)}i instanceof Error&&(c.message=i.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return o!=="Object"&&(c.$name=o),c}throw new Error("can't serialize object of type "+typeof i)}function Nr(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||$a(i)||pi(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Nr);if(typeof i=="object"){const e=i.$name||"Object";if(!Cr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=Cr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const o=Object.create(r.prototype);for(const c of Object.keys(i)){if(c==="$name")continue;const h=i[c];o[c]=Cr[e].shallow.indexOf(c)>=0?h:Nr(h)}return o}throw new Error("can't deserialize object of type "+typeof i)}class Ms{constructor(){this.first=!0}update(e,r){const o=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=o,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=o,!0):(this.lastFloorZoom>o?(this.lastIntegerZoom=o+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<o&&(this.lastIntegerZoom=o,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=o,!0))}}const ze={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function jo(i){for(const e of i)if(zs(e.charCodeAt(0)))return!0;return!1}function Xl(i){for(const e of i)if(!Ps(e.charCodeAt(0)))return!1;return!0}function Ps(i){return!(ze.Arabic(i)||ze["Arabic Supplement"](i)||ze["Arabic Extended-A"](i)||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i))}function zs(i){return!(i!==746&&i!==747&&(i<4352||!(ze["Bopomofo Extended"](i)||ze.Bopomofo(i)||ze["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||ze["CJK Compatibility Ideographs"](i)||ze["CJK Compatibility"](i)||ze["CJK Radicals Supplement"](i)||ze["CJK Strokes"](i)||!(!ze["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||ze["CJK Unified Ideographs Extension A"](i)||ze["CJK Unified Ideographs"](i)||ze["Enclosed CJK Letters and Months"](i)||ze["Hangul Compatibility Jamo"](i)||ze["Hangul Jamo Extended-A"](i)||ze["Hangul Jamo Extended-B"](i)||ze["Hangul Jamo"](i)||ze["Hangul Syllables"](i)||ze.Hiragana(i)||ze["Ideographic Description Characters"](i)||ze.Kanbun(i)||ze["Kangxi Radicals"](i)||ze["Katakana Phonetic Extensions"](i)||ze.Katakana(i)&&i!==12540||!(!ze["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!ze["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||ze["Unified Canadian Aboriginal Syllabics"](i)||ze["Unified Canadian Aboriginal Syllabics Extended"](i)||ze["Vertical Forms"](i)||ze["Yijing Hexagram Symbols"](i)||ze["Yi Syllables"](i)||ze["Yi Radicals"](i))))}function Ua(i){return!(zs(i)||function(e){return!!(ze["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||ze["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||ze["Letterlike Symbols"](e)||ze["Number Forms"](e)||ze["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||ze["Control Pictures"](e)&&e!==9251||ze["Optical Character Recognition"](e)||ze["Enclosed Alphanumerics"](e)||ze["Geometric Shapes"](e)||ze["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||ze["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||ze["CJK Symbols and Punctuation"](e)||ze.Katakana(e)||ze["Private Use Area"](e)||ze["CJK Compatibility Forms"](e)||ze["Small Form Variants"](e)||ze["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function Va(i){return i>=1424&&i<=2303||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i)}function Wl(i,e){return!(!e&&Va(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||ze.Khmer(i))}function Na(i){for(const e of i)if(Va(e.charCodeAt(0)))return!0;return!1}const ks="deferred",Ds="loading",Ls="loaded";let Rs=null,Pi="unavailable",Gr=null;const Ga=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Pi="error"),Rs&&Rs(i)};function Bn(){Bs.fire(new Tr("pluginStateChange",{pluginStatus:Pi,pluginURL:Gr}))}const Bs=new Er,_o=function(){return Pi},qa=function(){if(Pi!==ks||!Gr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Pi=Ds,Bn(),Gr&&bn({url:Gr},i=>{i?Ga(i):(Pi=Ls,Bn())})},Ji={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Pi===Ls||Ji.applyArabicShaping!=null,isLoading:()=>Pi===Ds,setState(i){if(!Kt())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Pi=i.pluginStatus,Gr=i.pluginURL},isParsed(){if(!Kt())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Ji.applyArabicShaping!=null&&Ji.processBidirectionalText!=null&&Ji.processStyledBidirectionalText!=null},getPluginURL(){if(!Kt())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Gr}};class Nt{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ms,this.transition={})}isSupportedScript(e){return function(r,o){for(const c of r)if(!Wl(c.charCodeAt(0),o))return!1;return!0}(e,Ji.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),o=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*o}:{fromScale:.5,toScale:1,t:1-(1-o)*r}}}class yo{constructor(e,r){this.property=e,this.value=r,this.expression=function(o,c){if(Bt(o))return new Vo(o,c);if(ro(o)){const h=Aa(o,c);if(h.result==="error")throw new Error(h.value.map(d=>`${d.key}: ${d.message}`).join(", "));return h.value}{let h=o;return c.type==="color"&&typeof o=="string"?h=B.parse(o):c.type!=="padding"||typeof o!="number"&&!Array.isArray(o)||(h=X.parse(o)),{kind:"constant",evaluate:()=>h}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,o){return this.property.possiblyEvaluate(this,e,r,o)}}class Xo{constructor(e){this.property=e,this.value=new yo(e,void 0)}transitioned(e,r){return new ja(this.property,this.value,r,$e({},e.transition,this.transition),e.now)}untransitioned(){return new ja(this.property,this.value,null,{},0)}}class Za{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return lt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Xo(this._values[e].property)),this._values[e].value=new yo(this._values[e].property,r===null?void 0:lt(r))}getTransition(e){return lt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Xo(this._values[e].property)),this._values[e].transition=lt(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(e[r]=o);const c=this.getTransition(r);c!==void 0&&(e[`${r}-transition`]=c)}return e}transitioned(e,r){const o=new Xa(this._properties);for(const c of Object.keys(this._values))o._values[c]=this._values[c].transitioned(e,r._values[c]);return o}untransitioned(){const e=new Xa(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class ja{constructor(e,r,o,c,h){this.property=e,this.value=r,this.begin=h+c.delay||0,this.end=this.begin+c.duration||0,e.specification.transition&&(c.delay||c.duration)&&(this.prior=o)}possiblyEvaluate(e,r,o){const c=e.now||0,h=this.value.possiblyEvaluate(e,r,o),d=this.prior;if(d){if(c>this.end)return this.prior=null,h;if(this.value.isDataDriven())return this.prior=null,h;if(c<this.begin)return d.possiblyEvaluate(e,r,o);{const m=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(d.possiblyEvaluate(e,r,o),h,function(g){if(g<=0)return 0;if(g>=1)return 1;const x=g*g,T=x*g;return 4*(g<.5?T:3*(g-x)+T-.75)}(m))}}return h}}class Xa{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,o){const c=new xo(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,r,o);return c}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Hl{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return lt(this._values[e].value)}setValue(e,r){this._values[e]=new yo(this._values[e].property,r===null?void 0:lt(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(e[r]=o)}return e}possiblyEvaluate(e,r,o){const c=new xo(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,r,o);return c}}class mr{constructor(e,r,o){this.property=e,this.value=r,this.parameters=o}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,o,c){return this.property.evaluate(this.value,this.parameters,e,r,o,c)}}class xo{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ze{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,o){const c=Qn[this.specification.type];return c?c(e,r,o):e}}class Ye{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,o,c){return new mr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},o,c)}:e.expression,r)}interpolate(e,r,o){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new mr(this,{kind:"constant",value:void 0},e.parameters);const c=Qn[this.specification.type];return c?new mr(this,{kind:"constant",value:c(e.value.value,r.value.value,o)},e.parameters):e}evaluate(e,r,o,c,h,d){return e.kind==="constant"?e.value:e.evaluate(r,o,c,h,d)}}class Fn extends Ye{possiblyEvaluate(e,r,o,c){if(e.value===void 0)return new mr(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const h=e.expression.evaluate(r,null,{},o,c),d=e.property.specification.type==="resolvedImage"&&typeof h!="string"?h.name:h,m=this._calculate(d,d,d,r);return new mr(this,{kind:"constant",value:m},r)}if(e.expression.kind==="camera"){const h=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new mr(this,{kind:"constant",value:h},r)}return new mr(this,e.expression,r)}evaluate(e,r,o,c,h,d){if(e.kind==="source"){const m=e.evaluate(r,o,c,h,d);return this._calculate(m,m,m,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},o,c),e.evaluate({zoom:Math.floor(r.zoom)},o,c),e.evaluate({zoom:Math.floor(r.zoom)+1},o,c),r):e.value}_calculate(e,r,o,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class Fs{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,c){if(e.value!==void 0){if(e.expression.kind==="constant"){const h=e.expression.evaluate(r,null,{},o,c);return this._calculate(h,h,h,r)}return this._calculate(e.expression.evaluate(new Nt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Nt(Math.floor(r.zoom),r)),e.expression.evaluate(new Nt(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,o,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class qr{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,c){return!!e.expression.evaluate(r,null,{},o,c)}interpolate(){return!1}}class mi{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const o=e[r];o.specification.overridable&&this.overridableProperties.push(r);const c=this.defaultPropertyValues[r]=new yo(o,void 0),h=this.defaultTransitionablePropertyValues[r]=new Xo(o);this.defaultTransitioningPropertyValues[r]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=c.possiblyEvaluate({})}}}Oe("DataDrivenProperty",Ye),Oe("DataConstantProperty",Ze),Oe("CrossFadedDataDrivenProperty",Fn),Oe("CrossFadedProperty",Fs),Oe("ColorRampProperty",qr);const Zr="-transition";class gr extends Er{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},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),r.layout&&(this._unevaluatedLayout=new Hl(r.layout)),r.paint)){this._transitionablePaint=new Za(r.paint);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 xo(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,o={}){r!=null&&this._validate(jl,`layers.${this.id}.layout.${e}`,e,r,o)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(Zr)?this._transitionablePaint.getTransition(e.slice(0,-Zr.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,o={}){if(r!=null&&this._validate(Zl,`layers.${this.id}.paint.${e}`,e,r,o))return!1;if(e.endsWith(Zr))return this._transitionablePaint.setTransition(e.slice(0,-Zr.length),r||void 0),!1;{const c=this._transitionablePaint._values[e],h=c.property.specification["property-type"]==="cross-faded-data-driven",d=c.value.isDataDriven(),m=c.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||d||h||this._handleOverridablePaintPropertyUpdate(e,m,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,o){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),tt(e,(r,o)=>!(r===void 0||o==="layout"&&!Object.keys(r).length||o==="paint"&&!Object.keys(r).length))}_validate(e,r,o,c,h={}){return(!h||h.validate!==!1)&&Zo(this,e.call(mo,{key:r,layerType:this.type,objectKey:o,value:c,styleSpec:_e,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof mr&&Ft(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Wa={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class jr{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Xt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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 r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Yt(i,e=1){let r=0,o=0;return{members:i.map(c=>{const h=Wa[c.type].BYTES_PER_ELEMENT,d=r=Os(r,Math.max(e,h)),m=c.components||1;return o=Math.max(o,h),r+=h*m,{name:c.name,type:c.type,components:m,offset:d}}),size:Os(r,Math.max(o,e)),alignment:e}}function Os(i,e){return Math.ceil(i/e)*e}class sn extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const c=2*e;return this.int16[c+0]=r,this.int16[c+1]=o,e}}sn.prototype.bytesPerElement=4,Oe("StructArrayLayout2i4",sn);class l extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const d=4*e;return this.int16[d+0]=r,this.int16[d+1]=o,this.int16[d+2]=c,this.int16[d+3]=h,e}}l.prototype.bytesPerElement=8,Oe("StructArrayLayout4i8",l);class t extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,d)}emplace(e,r,o,c,h,d,m){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.int16[g+2]=c,this.int16[g+3]=h,this.int16[g+4]=d,this.int16[g+5]=m,e}}t.prototype.bytesPerElement=12,Oe("StructArrayLayout2i4i12",t);class n extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,d)}emplace(e,r,o,c,h,d,m){const g=4*e,x=8*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.uint8[x+4]=c,this.uint8[x+5]=h,this.uint8[x+6]=d,this.uint8[x+7]=m,e}}n.prototype.bytesPerElement=8,Oe("StructArrayLayout2i4ub8",n);class s extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const c=2*e;return this.float32[c+0]=r,this.float32[c+1]=o,e}}s.prototype.bytesPerElement=8,Oe("StructArrayLayout2f8",s);class u extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d,m,g,x,T){const S=this.length;return this.resize(S+1),this.emplace(S,e,r,o,c,h,d,m,g,x,T)}emplace(e,r,o,c,h,d,m,g,x,T,S){const P=10*e;return this.uint16[P+0]=r,this.uint16[P+1]=o,this.uint16[P+2]=c,this.uint16[P+3]=h,this.uint16[P+4]=d,this.uint16[P+5]=m,this.uint16[P+6]=g,this.uint16[P+7]=x,this.uint16[P+8]=T,this.uint16[P+9]=S,e}}u.prototype.bytesPerElement=20,Oe("StructArrayLayout10ui20",u);class p extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d,m,g,x,T,S,P){const k=this.length;return this.resize(k+1),this.emplace(k,e,r,o,c,h,d,m,g,x,T,S,P)}emplace(e,r,o,c,h,d,m,g,x,T,S,P,k){const L=12*e;return this.int16[L+0]=r,this.int16[L+1]=o,this.int16[L+2]=c,this.int16[L+3]=h,this.uint16[L+4]=d,this.uint16[L+5]=m,this.uint16[L+6]=g,this.uint16[L+7]=x,this.int16[L+8]=T,this.int16[L+9]=S,this.int16[L+10]=P,this.int16[L+11]=k,e}}p.prototype.bytesPerElement=24,Oe("StructArrayLayout4i4ui4i24",p);class f extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.float32[h+0]=r,this.float32[h+1]=o,this.float32[h+2]=c,e}}f.prototype.bytesPerElement=12,Oe("StructArrayLayout3f12",f);class _ extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}_.prototype.bytesPerElement=4,Oe("StructArrayLayout1ul4",_);class y extends Xt{_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,r,o,c,h,d,m,g,x){const T=this.length;return this.resize(T+1),this.emplace(T,e,r,o,c,h,d,m,g,x)}emplace(e,r,o,c,h,d,m,g,x,T){const S=10*e,P=5*e;return this.int16[S+0]=r,this.int16[S+1]=o,this.int16[S+2]=c,this.int16[S+3]=h,this.int16[S+4]=d,this.int16[S+5]=m,this.uint32[P+3]=g,this.uint16[S+8]=x,this.uint16[S+9]=T,e}}y.prototype.bytesPerElement=20,Oe("StructArrayLayout6i1ul2ui20",y);class v extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,d)}emplace(e,r,o,c,h,d,m){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.int16[g+2]=c,this.int16[g+3]=h,this.int16[g+4]=d,this.int16[g+5]=m,e}}v.prototype.bytesPerElement=12,Oe("StructArrayLayout2i2i2i12",v);class E extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,o,c,h)}emplace(e,r,o,c,h,d){const m=4*e,g=8*e;return this.float32[m+0]=r,this.float32[m+1]=o,this.float32[m+2]=c,this.int16[g+6]=h,this.int16[g+7]=d,e}}E.prototype.bytesPerElement=16,Oe("StructArrayLayout2f1f2i16",E);class M extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const d=12*e,m=3*e;return this.uint8[d+0]=r,this.uint8[d+1]=o,this.float32[m+1]=c,this.float32[m+2]=h,e}}M.prototype.bytesPerElement=12,Oe("StructArrayLayout2ub2f12",M);class z extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.uint16[h+0]=r,this.uint16[h+1]=o,this.uint16[h+2]=c,e}}z.prototype.bytesPerElement=6,Oe("StructArrayLayout3ui6",z);class V extends Xt{_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,r,o,c,h,d,m,g,x,T,S,P,k,L,Z,q,re){const ce=this.length;return this.resize(ce+1),this.emplace(ce,e,r,o,c,h,d,m,g,x,T,S,P,k,L,Z,q,re)}emplace(e,r,o,c,h,d,m,g,x,T,S,P,k,L,Z,q,re,ce){const ee=24*e,ae=12*e,xe=48*e;return this.int16[ee+0]=r,this.int16[ee+1]=o,this.uint16[ee+2]=c,this.uint16[ee+3]=h,this.uint32[ae+2]=d,this.uint32[ae+3]=m,this.uint32[ae+4]=g,this.uint16[ee+10]=x,this.uint16[ee+11]=T,this.uint16[ee+12]=S,this.float32[ae+7]=P,this.float32[ae+8]=k,this.uint8[xe+36]=L,this.uint8[xe+37]=Z,this.uint8[xe+38]=q,this.uint32[ae+10]=re,this.int16[ee+22]=ce,e}}V.prototype.bytesPerElement=48,Oe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",V);class $ extends Xt{_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,r,o,c,h,d,m,g,x,T,S,P,k,L,Z,q,re,ce,ee,ae,xe,ye,Fe,Ne,ke,Ae,Ee,De){const Pe=this.length;return this.resize(Pe+1),this.emplace(Pe,e,r,o,c,h,d,m,g,x,T,S,P,k,L,Z,q,re,ce,ee,ae,xe,ye,Fe,Ne,ke,Ae,Ee,De)}emplace(e,r,o,c,h,d,m,g,x,T,S,P,k,L,Z,q,re,ce,ee,ae,xe,ye,Fe,Ne,ke,Ae,Ee,De,Pe){const we=34*e,He=17*e;return this.int16[we+0]=r,this.int16[we+1]=o,this.int16[we+2]=c,this.int16[we+3]=h,this.int16[we+4]=d,this.int16[we+5]=m,this.int16[we+6]=g,this.int16[we+7]=x,this.uint16[we+8]=T,this.uint16[we+9]=S,this.uint16[we+10]=P,this.uint16[we+11]=k,this.uint16[we+12]=L,this.uint16[we+13]=Z,this.uint16[we+14]=q,this.uint16[we+15]=re,this.uint16[we+16]=ce,this.uint16[we+17]=ee,this.uint16[we+18]=ae,this.uint16[we+19]=xe,this.uint16[we+20]=ye,this.uint16[we+21]=Fe,this.uint16[we+22]=Ne,this.uint32[He+12]=ke,this.float32[He+13]=Ae,this.float32[He+14]=Ee,this.float32[He+15]=De,this.float32[He+16]=Pe,e}}$.prototype.bytesPerElement=68,Oe("StructArrayLayout8i15ui1ul4f68",$);class U extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}U.prototype.bytesPerElement=4,Oe("StructArrayLayout1f4",U);class H extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.int16[h+0]=r,this.int16[h+1]=o,this.int16[h+2]=c,e}}H.prototype.bytesPerElement=6,Oe("StructArrayLayout3i6",H);class Q extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=4*e;return this.uint32[2*e+0]=r,this.uint16[h+2]=o,this.uint16[h+3]=c,e}}Q.prototype.bytesPerElement=8,Oe("StructArrayLayout1ul2ui8",Q);class ne extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const c=2*e;return this.uint16[c+0]=r,this.uint16[c+1]=o,e}}ne.prototype.bytesPerElement=4,Oe("StructArrayLayout2ui4",ne);class G extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}G.prototype.bytesPerElement=2,Oe("StructArrayLayout1ui2",G);class le extends Xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const d=4*e;return this.float32[d+0]=r,this.float32[d+1]=o,this.float32[d+2]=c,this.float32[d+3]=h,e}}le.prototype.bytesPerElement=16,Oe("StructArrayLayout4f16",le);class se extends jr{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 Xe(this.anchorPointX,this.anchorPointY)}}se.prototype.size=20;class me extends y{get(e){return new se(this,e)}}Oe("CollisionBoxArray",me);class ge extends jr{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]}}ge.prototype.size=48;class be extends V{get(e){return new ge(this,e)}}Oe("PlacedSymbolArray",be);class de extends jr{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 textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}de.prototype.size=68;class Re extends ${get(e){return new de(this,e)}}Oe("SymbolInstanceArray",Re);class Ce extends U{getoffsetX(e){return this.float32[1*e+0]}}Oe("GlyphOffsetArray",Ce);class Be extends H{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Oe("SymbolLineVertexArray",Be);class st extends jr{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]}}st.prototype.size=8;class ht extends Q{get(e){return new st(this,e)}}Oe("FeatureIndexArray",ht);class We extends sn{}class At extends sn{}class Mt extends sn{}class _t extends t{}class wt extends n{}class zt extends s{}class ai extends u{}class _r extends p{}class nr extends f{}class yr extends _{}class Xr extends v{}class Yi extends M{}class zi extends z{}class Ar extends ne{}const Wo=Yt([{name:"a_pos",components:2,type:"Int16"}],4),{members:ii}=Wo;class dt{constructor(e=[]){this.segments=e}prepareSegment(e,r,o,c){let h=this.segments[this.segments.length-1];return e>dt.MAX_VERTEX_ARRAY_LENGTH&&at(`Max vertices per segment is ${dt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!h||h.vertexLength+e>dt.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==c)&&(h={vertexOffset:r.length,primitiveOffset:o.length,vertexLength:0,primitiveLength:0},c!==void 0&&(h.sortKey=c),this.segments.push(h)),h}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,o,c){return new dt([{vertexOffset:e,primitiveOffset:r,vertexLength:o,primitiveLength:c,vaos:{},sortKey:0}])}}function Ct(i,e){return 256*(i=ie(Math.floor(i),0,255))+ie(Math.floor(e),0,255)}dt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Oe("SegmentVector",dt);const li=Yt([{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"}]);var ci={exports:{}},Gt={exports:{}};Gt.exports=function(i,e){var r,o,c,h,d,m,g,x;for(o=i.length-(r=3&i.length),c=e,d=3432918353,m=461845907,x=0;x<o;)g=255&i.charCodeAt(x)|(255&i.charCodeAt(++x))<<8|(255&i.charCodeAt(++x))<<16|(255&i.charCodeAt(++x))<<24,++x,c=27492+(65535&(h=5*(65535&(c=(c^=g=(65535&(g=(g=(65535&g)*d+(((g>>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*m+(((g>>>16)*m&65535)<<16)&4294967295)<<13|c>>>19))+((5*(c>>>16)&65535)<<16)&4294967295))+((58964+(h>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(x+2))<<16;case 2:g^=(255&i.charCodeAt(x+1))<<8;case 1:c^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(x)))*d+(((g>>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*m+(((g>>>16)*m&65535)<<16)&4294967295}return c^=i.length,c=2246822507*(65535&(c^=c>>>16))+((2246822507*(c>>>16)&65535)<<16)&4294967295,c=3266489909*(65535&(c^=c>>>13))+((3266489909*(c>>>16)&65535)<<16)&4294967295,(c^=c>>>16)>>>0};var Qi={exports:{}};Qi.exports=function(i,e){for(var r,o=i.length,c=e^o,h=0;o>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(h)|(255&i.charCodeAt(++h))<<8|(255&i.charCodeAt(++h))<<16|(255&i.charCodeAt(++h))<<24))+((1540483477*(r>>>16)&65535)<<16),c=1540483477*(65535&c)+((1540483477*(c>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),o-=4,++h;switch(o){case 3:c^=(255&i.charCodeAt(h+2))<<16;case 2:c^=(255&i.charCodeAt(h+1))<<8;case 1:c=1540483477*(65535&(c^=255&i.charCodeAt(h)))+((1540483477*(c>>>16)&65535)<<16)}return c=1540483477*(65535&(c^=c>>>13))+((1540483477*(c>>>16)&65535)<<16),(c^=c>>>15)>>>0};var an=Gt.exports,$s=Qi.exports;ci.exports=an,ci.exports.murmur3=an,ci.exports.murmur2=$s;class On{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,o,c){this.ids.push(Ha(e)),this.positions.push(r,o,c)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Ha(e);let o=0,c=this.ids.length-1;for(;o<c;){const d=o+c>>1;this.ids[d]>=r?c=d:o=d+1}const h=[];for(;this.ids[o]===r;)h.push({index:this.positions[3*o],start:this.positions[3*o+1],end:this.positions[3*o+2]}),o++;return h}static serialize(e,r){const o=new Float64Array(e.ids),c=new Uint32Array(e.positions);return Us(o,c,0,o.length-1),r&&r.push(o.buffer,c.buffer),{ids:o,positions:c}}static deserialize(e){const r=new On;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Ha(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ci.exports(String(i))}function Us(i,e,r,o){for(;r<o;){const c=i[r+o>>1];let h=r-1,d=o+1;for(;;){do h++;while(i[h]<c);do d--;while(i[d]>c);if(h>=d)break;Wr(i,h,d),Wr(e,3*h,3*d),Wr(e,3*h+1,3*d+1),Wr(e,3*h+2,3*d+2)}d-r<o-d?(Us(i,e,r,d),r=d+1):(Us(i,e,d+1,o),o=d)}}function Wr(i,e,r){const o=i[e];i[e]=i[r],i[r]=o}Oe("FeaturePositionMap",On);class ln{constructor(e,r){this.gl=e.gl,this.location=r}}class cn extends ln{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Ho extends ln{constructor(e,r){super(e,r),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 ru extends ln{constructor(e,r){super(e,r),this.current=B.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 Lp=new Float32Array(16);function Kl(i){return[Ct(255*i.r,255*i.g),Ct(255*i.b,255*i.a)]}class Vs{constructor(e,r,o){this.value=e,this.uniformNames=r.map(c=>`u_${c}`),this.type=o}setUniform(e,r,o){e.set(o.constantOr(this.value))}getBinding(e,r,o){return this.type==="color"?new ru(e,r):new cn(e,r)}}class Ko{constructor(e,r){this.uniformNames=r.map(o=>`u_${o}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,o,c){const h=c==="u_pattern_to"?this.patternTo:c==="u_pattern_from"?this.patternFrom:c==="u_pixel_ratio_to"?this.pixelRatioTo:c==="u_pixel_ratio_from"?this.pixelRatioFrom:null;h&&e.set(h)}getBinding(e,r,o){return o.substr(0,9)==="u_pattern"?new Ho(e,r):new cn(e,r)}}class un{constructor(e,r,o,c){this.expression=e,this.type=o,this.maxValue=0,this.paintVertexAttributes=r.map(h=>({name:`a_${h}`,type:"Float32",components:o==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(e,r,o,c,h){const d=this.paintVertexArray.length,m=this.expression.evaluate(new Nt(0),r,{},c,[],h);this.paintVertexArray.resize(e),this._setPaintValue(d,e,m)}updatePaintArray(e,r,o,c){const h=this.expression.evaluate({zoom:0},o,c);this._setPaintValue(e,r,h)}_setPaintValue(e,r,o){if(this.type==="color"){const c=Kl(o);for(let h=e;h<r;h++)this.paintVertexArray.emplace(h,c[0],c[1])}else{for(let c=e;c<r;c++)this.paintVertexArray.emplace(c,o);this.maxValue=Math.max(this.maxValue,Math.abs(o))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Mr{constructor(e,r,o,c,h,d){this.expression=e,this.uniformNames=r.map(m=>`u_${m}_t`),this.type=o,this.useIntegerZoom=c,this.zoom=h,this.maxValue=0,this.paintVertexAttributes=r.map(m=>({name:`a_${m}`,type:"Float32",components:o==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(e,r,o,c,h){const d=this.expression.evaluate(new Nt(this.zoom),r,{},c,[],h),m=this.expression.evaluate(new Nt(this.zoom+1),r,{},c,[],h),g=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(g,e,d,m)}updatePaintArray(e,r,o,c){const h=this.expression.evaluate({zoom:this.zoom},o,c),d=this.expression.evaluate({zoom:this.zoom+1},o,c);this._setPaintValue(e,r,h,d)}_setPaintValue(e,r,o,c){if(this.type==="color"){const h=Kl(o),d=Kl(c);for(let m=e;m<r;m++)this.paintVertexArray.emplace(m,h[0],h[1],d[0],d[1])}else{for(let h=e;h<r;h++)this.paintVertexArray.emplace(h,o,c);this.maxValue=Math.max(this.maxValue,Math.abs(o),Math.abs(c))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){const o=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,c=ie(this.expression.interpolationFactor(o,this.zoom,this.zoom+1),0,1);e.set(c)}getBinding(e,r,o){return new cn(e,r)}}class $n{constructor(e,r,o,c,h,d){this.expression=e,this.type=r,this.useIntegerZoom=o,this.zoom=c,this.layerId=d,this.zoomInPaintVertexArray=new h,this.zoomOutPaintVertexArray=new h}populatePaintArray(e,r,o){const c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(c,e,r.patterns&&r.patterns[this.layerId],o)}updatePaintArray(e,r,o,c,h){this._setPaintValues(e,r,o.patterns&&o.patterns[this.layerId],h)}_setPaintValues(e,r,o,c){if(!c||!o)return;const{min:h,mid:d,max:m}=o,g=c[h],x=c[d],T=c[m];if(g&&x&&T)for(let S=e;S<r;S++)this.zoomInPaintVertexArray.emplace(S,x.tl[0],x.tl[1],x.br[0],x.br[1],g.tl[0],g.tl[1],g.br[0],g.br[1],x.pixelRatio,g.pixelRatio),this.zoomOutPaintVertexArray.emplace(S,x.tl[0],x.tl[1],x.br[0],x.br[1],T.tl[0],T.tl[1],T.br[0],T.br[1],x.pixelRatio,T.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,li.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,li.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class nu{constructor(e,r,o){this.binders={},this._buffers=[];const c=[];for(const h in e.paint._values){if(!o(h))continue;const d=e.paint.get(h);if(!(d instanceof mr&&Ft(d.property.specification)))continue;const m=Rp(h,e.type),g=d.value,x=d.property.specification.type,T=d.property.useIntegerZoom,S=d.property.specification["property-type"],P=S==="cross-faded"||S==="cross-faded-data-driven";if(g.kind==="constant")this.binders[h]=P?new Ko(g.value,m):new Vs(g.value,m,x),c.push(`/u_${h}`);else if(g.kind==="source"||P){const k=ou(h,x,"source");this.binders[h]=P?new $n(g,x,T,r,k,e.id):new un(g,m,x,k),c.push(`/a_${h}`)}else{const k=ou(h,x,"composite");this.binders[h]=new Mr(g,m,x,T,r,k),c.push(`/z_${h}`)}}this.cacheKey=c.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof un||r instanceof Mr?r.maxValue:0}populatePaintArrays(e,r,o,c,h){for(const d in this.binders){const m=this.binders[d];(m instanceof un||m instanceof Mr||m instanceof $n)&&m.populatePaintArray(e,r,o,c,h)}}setConstantPatternPositions(e,r){for(const o in this.binders){const c=this.binders[o];c instanceof Ko&&c.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,o,c,h){let d=!1;for(const m in e){const g=r.getPositions(m);for(const x of g){const T=o.feature(x.index);for(const S in this.binders){const P=this.binders[S];if((P instanceof un||P instanceof Mr||P instanceof $n)&&P.expression.isStateDependent===!0){const k=c.paint.get(S);P.expression=k.value,P.updatePaintArray(x.start,x.end,T,e[m],h),d=!0}}}}return d}defines(){const e=[];for(const r in this.binders){const o=this.binders[r];(o instanceof Vs||o instanceof Ko)&&e.push(...o.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof un||o instanceof Mr)for(let c=0;c<o.paintVertexAttributes.length;c++)e.push(o.paintVertexAttributes[c].name);else if(o instanceof $n)for(let c=0;c<li.members.length;c++)e.push(li.members[c].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof Vs||o instanceof Ko||o instanceof Mr)for(const c of o.uniformNames)e.push(c)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const o=[];for(const c in this.binders){const h=this.binders[c];if(h instanceof Vs||h instanceof Ko||h instanceof Mr){for(const d of h.uniformNames)if(r[d]){const m=h.getBinding(e,r[d],d);o.push({name:d,property:c,binding:m})}}}return o}setUniforms(e,r,o,c){for(const{name:h,property:d,binding:m}of r)this.binders[d].setUniform(m,c,o.get(d),h)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const o=this.binders[r];if(e&&o instanceof $n){const c=e.fromScale===2?o.zoomInPaintVertexBuffer:o.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(o instanceof un||o instanceof Mr)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}}upload(e){for(const r in this.binders){const o=this.binders[r];(o instanceof un||o instanceof Mr||o instanceof $n)&&o.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof un||r instanceof Mr||r instanceof $n)&&r.destroy()}}}class vo{constructor(e,r,o=()=>!0){this.programConfigurations={};for(const c of e)this.programConfigurations[c.id]=new nu(c,r,o);this.needsUpload=!1,this._featureMap=new On,this._bufferOffset=0}populatePaintArrays(e,r,o,c,h,d){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(e,r,c,h,d);r.id!==void 0&&this._featureMap.add(r.id,o,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,o,c){for(const h of o)this.needsUpload=this.programConfigurations[h.id].updatePaintArrays(e,this._featureMap,r,h,c)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Rp(i,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-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"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function ou(i,e,r){const o={color:{source:s,composite:le},number:{source:U,composite:s}},c=function(h){return{"line-pattern":{source:ai,composite:ai},"fill-pattern":{source:ai,composite:ai},"fill-extrusion-pattern":{source:ai,composite:ai}}[h]}(i);return c&&c[r]||o[e][r]}Oe("ConstantBinder",Vs),Oe("CrossFadedConstantBinder",Ko),Oe("SourceExpressionBinder",un),Oe("CrossFadedCompositeBinder",$n),Oe("CompositeExpressionBinder",Mr),Oe("ProgramConfiguration",nu,{omit:["_buffers"]}),Oe("ProgramConfigurationSet",vo);var ri=8192;const Jl=Math.pow(2,14)-1,su=-Jl-1;function bo(i){const e=ri/i.extent,r=i.loadGeometry();for(let o=0;o<r.length;o++){const c=r[o];for(let h=0;h<c.length;h++){const d=c[h],m=Math.round(d.x*e),g=Math.round(d.y*e);d.x=ie(m,su,Jl),d.y=ie(g,su,Jl),(m<d.x||m>d.x+1||g<d.y||g>d.y+1)&&at("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function wo(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?bo(i):[]}}function Ka(i,e,r,o,c){i.emplaceBack(2*e+(o+1)/2,2*r+(c+1)/2)}class Yl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new At,this.indexArray=new zi,this.segments=new dt,this.programConfigurations=new vo(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){const c=this.layers[0],h=[];let d=null,m=!1;c.type==="circle"&&(d=c.layout.get("circle-sort-key"),m=!d.isConstant());for(const{feature:g,id:x,index:T,sourceLayerIndex:S}of e){const P=this.layers[0]._featureFilter.needGeometry,k=wo(g,P);if(!this.layers[0]._featureFilter.filter(new Nt(this.zoom),k,o))continue;const L=m?d.evaluate(k,{},o):void 0,Z={id:x,properties:g.properties,type:g.type,sourceLayerIndex:S,index:T,geometry:P?k.geometry:bo(g),patterns:{},sortKey:L};h.push(Z)}m&&h.sort((g,x)=>g.sortKey-x.sortKey);for(const g of h){const{geometry:x,index:T,sourceLayerIndex:S}=g,P=e[T].feature;this.addFeature(g,x,T,o),r.featureIndex.insert(P,x,T,S,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ii),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,r,o,c){for(const h of r)for(const d of h){const m=d.x,g=d.y;if(m<0||m>=ri||g<0||g>=ri)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),T=x.vertexLength;Ka(this.layoutVertexArray,m,g,-1,-1),Ka(this.layoutVertexArray,m,g,1,-1),Ka(this.layoutVertexArray,m,g,1,1),Ka(this.layoutVertexArray,m,g,-1,1),this.indexArray.emplaceBack(T,T+1,T+2),this.indexArray.emplaceBack(T,T+3,T+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{},c)}}function au(i,e){for(let r=0;r<i.length;r++)if(Jo(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Jo(i,e[r]))return!0;return!!Ql(i,e)}function Bp(i,e,r){return!!Jo(i,e)||!!ec(e,i,r)}function lu(i,e){if(i.length===1)return uu(e,i[0]);for(let r=0;r<e.length;r++){const o=e[r];for(let c=0;c<o.length;c++)if(Jo(i,o[c]))return!0}for(let r=0;r<i.length;r++)if(uu(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Ql(i,e[r]))return!0;return!1}function Fp(i,e,r){if(i.length>1){if(Ql(i,e))return!0;for(let o=0;o<e.length;o++)if(ec(e[o],i,r))return!0}for(let o=0;o<i.length;o++)if(ec(i[o],e,r))return!0;return!1}function Ql(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const o=i[r],c=i[r+1];for(let h=0;h<e.length-1;h++)if(Op(o,c,e[h],e[h+1]))return!0}return!1}function Op(i,e,r,o){return gt(i,r,o)!==gt(e,r,o)&&gt(i,e,r)!==gt(i,e,o)}function ec(i,e,r){const o=r*r;if(e.length===1)return i.distSqr(e[0])<o;for(let c=1;c<e.length;c++)if(cu(i,e[c-1],e[c])<o)return!0;return!1}function cu(i,e,r){const o=e.distSqr(r);if(o===0)return i.distSqr(e);const c=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/o;return i.distSqr(c<0?e:c>1?r:r.sub(e)._mult(c)._add(e))}function uu(i,e){let r,o,c,h=!1;for(let d=0;d<i.length;d++){r=i[d];for(let m=0,g=r.length-1;m<r.length;g=m++)o=r[m],c=r[g],o.y>e.y!=c.y>e.y&&e.x<(c.x-o.x)*(e.y-o.y)/(c.y-o.y)+o.x&&(h=!h)}return h}function Jo(i,e){let r=!1;for(let o=0,c=i.length-1;o<i.length;c=o++){const h=i[o],d=i[c];h.y>e.y!=d.y>e.y&&e.x<(d.x-h.x)*(e.y-h.y)/(d.y-h.y)+h.x&&(r=!r)}return r}function $p(i,e,r){const o=r[0],c=r[2];if(i.x<o.x&&e.x<o.x||i.x>c.x&&e.x>c.x||i.y<o.y&&e.y<o.y||i.y>c.y&&e.y>c.y)return!1;const h=gt(i,e,r[0]);return h!==gt(i,e,r[1])||h!==gt(i,e,r[2])||h!==gt(i,e,r[3])}function Ns(i,e,r){const o=e.paint.get(i).value;return o.kind==="constant"?o.value:r.programConfigurations.get(e.id).getMaxValue(i)}function Ja(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Ya(i,e,r,o,c){if(!e[0]&&!e[1])return i;const h=Xe.convert(e)._mult(c);r==="viewport"&&h._rotate(-o);const d=[];for(let m=0;m<i.length;m++)d.push(i[m].sub(h));return d}Oe("CircleBucket",Yl,{omit:["layers"]});const Up=new mi({"circle-sort-key":new Ye(_e.layout_circle["circle-sort-key"])});var Vp={paint:new mi({"circle-radius":new Ye(_e.paint_circle["circle-radius"]),"circle-color":new Ye(_e.paint_circle["circle-color"]),"circle-blur":new Ye(_e.paint_circle["circle-blur"]),"circle-opacity":new Ye(_e.paint_circle["circle-opacity"]),"circle-translate":new Ze(_e.paint_circle["circle-translate"]),"circle-translate-anchor":new Ze(_e.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ze(_e.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ze(_e.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ye(_e.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ye(_e.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ye(_e.paint_circle["circle-stroke-opacity"])}),layout:Up},ki=1e-6,Di=typeof Float32Array!="undefined"?Float32Array:Array;function hu(){var i=new Di(9);return Di!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,i}function tc(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function pu(i,e,r){var o=e[0],c=e[1],h=e[2],d=e[3],m=e[4],g=e[5],x=e[6],T=e[7],S=e[8],P=e[9],k=e[10],L=e[11],Z=e[12],q=e[13],re=e[14],ce=e[15],ee=r[0],ae=r[1],xe=r[2],ye=r[3];return i[0]=ee*o+ae*m+xe*S+ye*Z,i[1]=ee*c+ae*g+xe*P+ye*q,i[2]=ee*h+ae*x+xe*k+ye*re,i[3]=ee*d+ae*T+xe*L+ye*ce,i[4]=(ee=r[4])*o+(ae=r[5])*m+(xe=r[6])*S+(ye=r[7])*Z,i[5]=ee*c+ae*g+xe*P+ye*q,i[6]=ee*h+ae*x+xe*k+ye*re,i[7]=ee*d+ae*T+xe*L+ye*ce,i[8]=(ee=r[8])*o+(ae=r[9])*m+(xe=r[10])*S+(ye=r[11])*Z,i[9]=ee*c+ae*g+xe*P+ye*q,i[10]=ee*h+ae*x+xe*k+ye*re,i[11]=ee*d+ae*T+xe*L+ye*ce,i[12]=(ee=r[12])*o+(ae=r[13])*m+(xe=r[14])*S+(ye=r[15])*Z,i[13]=ee*c+ae*g+xe*P+ye*q,i[14]=ee*h+ae*x+xe*k+ye*re,i[15]=ee*d+ae*T+xe*L+ye*ce,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var Gs,Np=pu;function du(){var i=new Di(3);return Di!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function fu(i,e,r){var o=new Di(3);return o[0]=i,o[1]=e,o[2]=r,o}function Qa(i,e,r){var o=e[0],c=e[1],h=e[2],d=e[3];return i[0]=r[0]*o+r[4]*c+r[8]*h+r[12]*d,i[1]=r[1]*o+r[5]*c+r[9]*h+r[13]*d,i[2]=r[2]*o+r[6]*c+r[10]*h+r[14]*d,i[3]=r[3]*o+r[7]*c+r[11]*h+r[15]*d,i}function mu(){var i=new Di(4);return Di!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function gu(i,e){const r=Qa([],[i.x,i.y,0,1],e);return new Xe(r[0]/r[3],r[1]/r[3])}du(),Gs=new Di(4),Di!=Float32Array&&(Gs[0]=0,Gs[1]=0,Gs[2]=0,Gs[3]=0),du(),fu(1,0,0),fu(0,1,0),mu(),mu(),hu(),function(){var i;i=new Di(2),Di!=Float32Array&&(i[0]=0,i[1]=0)}();class _u extends Yl{}Oe("HeatmapBucket",_u,{omit:["layers"]});var Gp={paint:new mi({"heatmap-radius":new Ye(_e.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ye(_e.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ze(_e.paint_heatmap["heatmap-intensity"]),"heatmap-color":new qr(_e.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ze(_e.paint_heatmap["heatmap-opacity"])})};function ic(i,{width:e,height:r},o,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==e*r*o)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${e*r*o}`)}else c=new Uint8Array(e*r*o);return i.width=e,i.height=r,i.data=c,i}function yu(i,{width:e,height:r},o){if(e===i.width&&r===i.height)return;const c=ic({},{width:e,height:r},o);rc(i,c,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},o),i.width=e,i.height=r,i.data=c.data}function rc(i,e,r,o,c,h){if(c.width===0||c.height===0)return e;if(c.width>i.width||c.height>i.height||r.x>i.width-c.width||r.y>i.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>e.width||c.height>e.height||o.x>e.width-c.width||o.y>e.height-c.height)throw new RangeError("out of range destination coordinates for image copy");const d=i.data,m=e.data;if(d===m)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<c.height;g++){const x=((r.y+g)*i.width+r.x)*h,T=((o.y+g)*e.width+o.x)*h;for(let S=0;S<c.width*h;S++)m[T+S]=d[x+S]}return e}class qs{constructor(e,r){ic(this,e,1,r)}resize(e){yu(this,e,1)}clone(){return new qs({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){rc(e,r,o,c,h,1)}}class or{constructor(e,r){ic(this,e,4,r)}resize(e){yu(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new or({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){rc(e,r,o,c,h,4)}}function xu(i){const e={},r=i.resolution||256,o=i.clips?i.clips.length:1,c=i.image||new or({width:r,height:o});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const h=(d,m,g)=>{e[i.evaluationKey]=g;const x=i.expression.evaluate(e);c.data[d+m+0]=Math.floor(255*x.r/x.a),c.data[d+m+1]=Math.floor(255*x.g/x.a),c.data[d+m+2]=Math.floor(255*x.b/x.a),c.data[d+m+3]=Math.floor(255*x.a)};if(i.clips)for(let d=0,m=0;d<o;++d,m+=4*r)for(let g=0,x=0;g<r;g++,x+=4){const T=g/(r-1),{start:S,end:P}=i.clips[d];h(m,x,S*(1-T)+P*T)}else for(let d=0,m=0;d<r;d++,m+=4)h(0,m,d/(r-1));return c}Oe("AlphaImage",qs),Oe("RGBAImage",or);var qp={paint:new mi({"hillshade-illumination-direction":new Ze(_e.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ze(_e.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ze(_e.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ze(_e.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ze(_e.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ze(_e.paint_hillshade["hillshade-accent-color"])})};const Zp=Yt([{name:"a_pos",components:2,type:"Int16"}],4),{members:jp}=Zp;var el={exports:{}};function tl(i,e,r){r=r||2;var o,c,h,d,m,g,x,T=e&&e.length,S=T?e[0]*r:i.length,P=vu(i,0,S,r,!0),k=[];if(!P||P.next===P.prev)return k;if(T&&(P=function(Z,q,re,ce){var ee,ae,xe,ye=[];for(ee=0,ae=q.length;ee<ae;ee++)(xe=vu(Z,q[ee]*ce,ee<ae-1?q[ee+1]*ce:Z.length,ce,!1))===xe.next&&(xe.steiner=!0),ye.push(ed(xe));for(ye.sort(Jp),ee=0;ee<ye.length;ee++)re=Yp(ye[ee],re);return re}(i,e,P,r)),i.length>80*r){o=h=i[0],c=d=i[1];for(var L=r;L<S;L+=r)(m=i[L])<o&&(o=m),(g=i[L+1])<c&&(c=g),m>h&&(h=m),g>d&&(d=g);x=(x=Math.max(h-o,d-c))!==0?32767/x:0}return Zs(P,k,r,o,c,x,0),k}function vu(i,e,r,o,c){var h,d;if(c===sc(i,e,r,o)>0)for(h=e;h<r;h+=o)d=Tu(h,i[h],i[h+1],d);else for(h=r-o;h>=e;h-=o)d=Tu(h,i[h],i[h+1],d);return d&&il(d,d.next)&&(Xs(d),d=d.next),d}function To(i,e){if(!i)return i;e||(e=i);var r,o=i;do if(r=!1,o.steiner||!il(o,o.next)&&Ht(o.prev,o,o.next)!==0)o=o.next;else{if(Xs(o),(o=e=o.prev)===o.next)break;r=!0}while(r||o!==e);return e}function Zs(i,e,r,o,c,h,d){if(i){!d&&h&&function(T,S,P,k){var L=T;do L.z===0&&(L.z=nc(L.x,L.y,S,P,k)),L.prevZ=L.prev,L.nextZ=L.next,L=L.next;while(L!==T);L.prevZ.nextZ=null,L.prevZ=null,function(Z){var q,re,ce,ee,ae,xe,ye,Fe,Ne=1;do{for(re=Z,Z=null,ae=null,xe=0;re;){for(xe++,ce=re,ye=0,q=0;q<Ne&&(ye++,ce=ce.nextZ);q++);for(Fe=Ne;ye>0||Fe>0&&ce;)ye!==0&&(Fe===0||!ce||re.z<=ce.z)?(ee=re,re=re.nextZ,ye--):(ee=ce,ce=ce.nextZ,Fe--),ae?ae.nextZ=ee:Z=ee,ee.prevZ=ae,ae=ee;re=ce}ae.nextZ=null,Ne*=2}while(xe>1)}(L)}(i,o,c,h);for(var m,g,x=i;i.prev!==i.next;)if(m=i.prev,g=i.next,h?Wp(i,o,c,h):Xp(i))e.push(m.i/r|0),e.push(i.i/r|0),e.push(g.i/r|0),Xs(i),i=g.next,x=g.next;else if((i=g)===x){d?d===1?Zs(i=Hp(To(i),e,r),e,r,o,c,h,2):d===2&&Kp(i,e,r,o,c,h):Zs(To(i),e,r,o,c,h,1);break}}}function Xp(i){var e=i.prev,r=i,o=i.next;if(Ht(e,r,o)>=0)return!1;for(var c=e.x,h=r.x,d=o.x,m=e.y,g=r.y,x=o.y,T=c<h?c<d?c:d:h<d?h:d,S=m<g?m<x?m:x:g<x?g:x,P=c>h?c>d?c:d:h>d?h:d,k=m>g?m>x?m:x:g>x?g:x,L=o.next;L!==e;){if(L.x>=T&&L.x<=P&&L.y>=S&&L.y<=k&&Yo(c,m,h,g,d,x,L.x,L.y)&&Ht(L.prev,L,L.next)>=0)return!1;L=L.next}return!0}function Wp(i,e,r,o){var c=i.prev,h=i,d=i.next;if(Ht(c,h,d)>=0)return!1;for(var m=c.x,g=h.x,x=d.x,T=c.y,S=h.y,P=d.y,k=m<g?m<x?m:x:g<x?g:x,L=T<S?T<P?T:P:S<P?S:P,Z=m>g?m>x?m:x:g>x?g:x,q=T>S?T>P?T:P:S>P?S:P,re=nc(k,L,e,r,o),ce=nc(Z,q,e,r,o),ee=i.prevZ,ae=i.nextZ;ee&&ee.z>=re&&ae&&ae.z<=ce;){if(ee.x>=k&&ee.x<=Z&&ee.y>=L&&ee.y<=q&&ee!==c&&ee!==d&&Yo(m,T,g,S,x,P,ee.x,ee.y)&&Ht(ee.prev,ee,ee.next)>=0||(ee=ee.prevZ,ae.x>=k&&ae.x<=Z&&ae.y>=L&&ae.y<=q&&ae!==c&&ae!==d&&Yo(m,T,g,S,x,P,ae.x,ae.y)&&Ht(ae.prev,ae,ae.next)>=0))return!1;ae=ae.nextZ}for(;ee&&ee.z>=re;){if(ee.x>=k&&ee.x<=Z&&ee.y>=L&&ee.y<=q&&ee!==c&&ee!==d&&Yo(m,T,g,S,x,P,ee.x,ee.y)&&Ht(ee.prev,ee,ee.next)>=0)return!1;ee=ee.prevZ}for(;ae&&ae.z<=ce;){if(ae.x>=k&&ae.x<=Z&&ae.y>=L&&ae.y<=q&&ae!==c&&ae!==d&&Yo(m,T,g,S,x,P,ae.x,ae.y)&&Ht(ae.prev,ae,ae.next)>=0)return!1;ae=ae.nextZ}return!0}function Hp(i,e,r){var o=i;do{var c=o.prev,h=o.next.next;!il(c,h)&&bu(c,o,o.next,h)&&js(c,h)&&js(h,c)&&(e.push(c.i/r|0),e.push(o.i/r|0),e.push(h.i/r|0),Xs(o),Xs(o.next),o=i=h),o=o.next}while(o!==i);return To(o)}function Kp(i,e,r,o,c,h){var d=i;do{for(var m=d.next.next;m!==d.prev;){if(d.i!==m.i&&td(d,m)){var g=wu(d,m);return d=To(d,d.next),g=To(g,g.next),Zs(d,e,r,o,c,h,0),void Zs(g,e,r,o,c,h,0)}m=m.next}d=d.next}while(d!==i)}function Jp(i,e){return i.x-e.x}function Yp(i,e){var r=function(c,h){var d,m=h,g=c.x,x=c.y,T=-1/0;do{if(x<=m.y&&x>=m.next.y&&m.next.y!==m.y){var S=m.x+(x-m.y)*(m.next.x-m.x)/(m.next.y-m.y);if(S<=g&&S>T&&(T=S,d=m.x<m.next.x?m:m.next,S===g))return d}m=m.next}while(m!==h);if(!d)return null;var P,k=d,L=d.x,Z=d.y,q=1/0;m=d;do g>=m.x&&m.x>=L&&g!==m.x&&Yo(x<Z?g:T,x,L,Z,x<Z?T:g,x,m.x,m.y)&&(P=Math.abs(x-m.y)/(g-m.x),js(m,c)&&(P<q||P===q&&(m.x>d.x||m.x===d.x&&Qp(d,m)))&&(d=m,q=P)),m=m.next;while(m!==k);return d}(i,e);if(!r)return e;var o=wu(r,i);return To(o,o.next),To(r,r.next)}function Qp(i,e){return Ht(i.prev,i,e.prev)<0&&Ht(e.next,i,i.next)<0}function nc(i,e,r,o,c){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*c|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-o)*c|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ed(i){var e=i,r=i;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==i);return r}function Yo(i,e,r,o,c,h,d,m){return(c-d)*(e-m)>=(i-d)*(h-m)&&(i-d)*(o-m)>=(r-d)*(e-m)&&(r-d)*(h-m)>=(c-d)*(o-m)}function td(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,o){var c=r;do{if(c.i!==r.i&&c.next.i!==r.i&&c.i!==o.i&&c.next.i!==o.i&&bu(c,c.next,r,o))return!0;c=c.next}while(c!==r);return!1}(i,e)&&(js(i,e)&&js(e,i)&&function(r,o){var c=r,h=!1,d=(r.x+o.x)/2,m=(r.y+o.y)/2;do c.y>m!=c.next.y>m&&c.next.y!==c.y&&d<(c.next.x-c.x)*(m-c.y)/(c.next.y-c.y)+c.x&&(h=!h),c=c.next;while(c!==r);return h}(i,e)&&(Ht(i.prev,i,e.prev)||Ht(i,e.prev,e))||il(i,e)&&Ht(i.prev,i,i.next)>0&&Ht(e.prev,e,e.next)>0)}function Ht(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function il(i,e){return i.x===e.x&&i.y===e.y}function bu(i,e,r,o){var c=nl(Ht(i,e,r)),h=nl(Ht(i,e,o)),d=nl(Ht(r,o,i)),m=nl(Ht(r,o,e));return c!==h&&d!==m||!(c!==0||!rl(i,r,e))||!(h!==0||!rl(i,o,e))||!(d!==0||!rl(r,i,o))||!(m!==0||!rl(r,e,o))}function rl(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function nl(i){return i>0?1:i<0?-1:0}function js(i,e){return Ht(i.prev,i,i.next)<0?Ht(i,e,i.next)>=0&&Ht(i,i.prev,e)>=0:Ht(i,e,i.prev)<0||Ht(i,i.next,e)<0}function wu(i,e){var r=new oc(i.i,i.x,i.y),o=new oc(e.i,e.x,e.y),c=i.next,h=e.prev;return i.next=e,e.prev=i,r.next=c,c.prev=r,o.next=r,r.prev=o,h.next=o,o.prev=h,o}function Tu(i,e,r,o){var c=new oc(i,e,r);return o?(c.next=o.next,c.prev=o,o.next.prev=c,o.next=c):(c.prev=c,c.next=c),c}function Xs(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function oc(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function sc(i,e,r,o){for(var c=0,h=e,d=r-o;h<r;h+=o)c+=(i[d]-i[h])*(i[h+1]+i[d+1]),d=h;return c}function id(i,e,r,o,c){Eu(i,e,r||0,o||i.length-1,c||rd)}function Eu(i,e,r,o,c){for(;o>r;){if(o-r>600){var h=o-r+1,d=e-r+1,m=Math.log(h),g=.5*Math.exp(2*m/3),x=.5*Math.sqrt(m*g*(h-g)/h)*(d-h/2<0?-1:1);Eu(i,e,Math.max(r,Math.floor(e-d*g/h+x)),Math.min(o,Math.floor(e+(h-d)*g/h+x)),c)}var T=i[e],S=r,P=o;for(Ws(i,r,e),c(i[o],T)>0&&Ws(i,r,o);S<P;){for(Ws(i,S,P),S++,P--;c(i[S],T)<0;)S++;for(;c(i[P],T)>0;)P--}c(i[r],T)===0?Ws(i,r,P):Ws(i,++P,o),P<=e&&(r=P+1),e<=P&&(o=P-1)}}function Ws(i,e,r){var o=i[e];i[e]=i[r],i[r]=o}function rd(i,e){return i<e?-1:i>e?1:0}function ac(i,e){const r=i.length;if(r<=1)return[i];const o=[];let c,h;for(let d=0;d<r;d++){const m=ti(i[d]);m!==0&&(i[d].area=Math.abs(m),h===void 0&&(h=m<0),h===m<0?(c&&o.push(c),c=[i[d]]):c.push(i[d]))}if(c&&o.push(c),e>1)for(let d=0;d<o.length;d++)o[d].length<=e||(id(o[d],e,1,o[d].length-1,nd),o[d]=o[d].slice(0,e));return o}function nd(i,e){return e.area-i.area}function lc(i,e,r){const o=r.patternDependencies;let c=!1;for(const h of e){const d=h.paint.get(`${i}-pattern`);d.isConstant()||(c=!0);const m=d.constantOr(null);m&&(c=!0,o[m.to]=!0,o[m.from]=!0)}return c}function cc(i,e,r,o,c){const h=c.patternDependencies;for(const d of e){const m=d.paint.get(`${i}-pattern`).value;if(m.kind!=="constant"){let g=m.evaluate({zoom:o-1},r,{},c.availableImages),x=m.evaluate({zoom:o},r,{},c.availableImages),T=m.evaluate({zoom:o+1},r,{},c.availableImages);g=g&&g.name?g.name:g,x=x&&x.name?x.name:x,T=T&&T.name?T.name:T,h[g]=!0,h[x]=!0,h[T]=!0,r.patterns[d.id]={min:g,mid:x,max:T}}}return r}el.exports=tl,el.exports.default=tl,tl.deviation=function(i,e,r,o){var c=e&&e.length,h=Math.abs(sc(i,0,c?e[0]*r:i.length,r));if(c)for(var d=0,m=e.length;d<m;d++)h-=Math.abs(sc(i,e[d]*r,d<m-1?e[d+1]*r:i.length,r));var g=0;for(d=0;d<o.length;d+=3){var x=o[d]*r,T=o[d+1]*r,S=o[d+2]*r;g+=Math.abs((i[x]-i[S])*(i[T+1]-i[x+1])-(i[x]-i[T])*(i[S+1]-i[x+1]))}return h===0&&g===0?0:Math.abs((g-h)/h)},tl.flatten=function(i){for(var e=i[0][0].length,r={vertices:[],holes:[],dimensions:e},o=0,c=0;c<i.length;c++){for(var h=0;h<i[c].length;h++)for(var d=0;d<e;d++)r.vertices.push(i[c][h][d]);c>0&&r.holes.push(o+=i[c-1].length)}return r};class uc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Mt,this.indexArray=new zi,this.indexArray2=new Ar,this.programConfigurations=new vo(e.layers,e.zoom),this.segments=new dt,this.segments2=new dt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=lc("fill",this.layers,r);const c=this.layers[0].layout.get("fill-sort-key"),h=!c.isConstant(),d=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:T}of e){const S=this.layers[0]._featureFilter.needGeometry,P=wo(m,S);if(!this.layers[0]._featureFilter.filter(new Nt(this.zoom),P,o))continue;const k=h?c.evaluate(P,{},o,r.availableImages):void 0,L={id:g,properties:m.properties,type:m.type,sourceLayerIndex:T,index:x,geometry:S?P.geometry:bo(m),patterns:{},sortKey:k};d.push(L)}h&&d.sort((m,g)=>m.sortKey-g.sortKey);for(const m of d){const{geometry:g,index:x,sourceLayerIndex:T}=m;if(this.hasPattern){const S=cc("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(S)}else this.addFeature(m,g,x,o,{});r.featureIndex.insert(e[x].feature,g,x,T,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}addFeatures(e,r,o){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,jp),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,r,o,c,h){for(const d of ac(r,500)){let m=0;for(const k of d)m+=k.length;const g=this.segments.prepareSegment(m,this.layoutVertexArray,this.indexArray),x=g.vertexLength,T=[],S=[];for(const k of d){if(k.length===0)continue;k!==d[0]&&S.push(T.length/2);const L=this.segments2.prepareSegment(k.length,this.layoutVertexArray,this.indexArray2),Z=L.vertexLength;this.layoutVertexArray.emplaceBack(k[0].x,k[0].y),this.indexArray2.emplaceBack(Z+k.length-1,Z),T.push(k[0].x),T.push(k[0].y);for(let q=1;q<k.length;q++)this.layoutVertexArray.emplaceBack(k[q].x,k[q].y),this.indexArray2.emplaceBack(Z+q-1,Z+q),T.push(k[q].x),T.push(k[q].y);L.vertexLength+=k.length,L.primitiveLength+=k.length}const P=el.exports(T,S);for(let k=0;k<P.length;k+=3)this.indexArray.emplaceBack(x+P[k],x+P[k+1],x+P[k+2]);g.vertexLength+=m,g.primitiveLength+=P.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}}Oe("FillBucket",uc,{omit:["layers","patternFeatures"]});const od=new mi({"fill-sort-key":new Ye(_e.layout_fill["fill-sort-key"])});var sd={paint:new mi({"fill-antialias":new Ze(_e.paint_fill["fill-antialias"]),"fill-opacity":new Ye(_e.paint_fill["fill-opacity"]),"fill-color":new Ye(_e.paint_fill["fill-color"]),"fill-outline-color":new Ye(_e.paint_fill["fill-outline-color"]),"fill-translate":new Ze(_e.paint_fill["fill-translate"]),"fill-translate-anchor":new Ze(_e.paint_fill["fill-translate-anchor"]),"fill-pattern":new Fn(_e.paint_fill["fill-pattern"])}),layout:od};const ad=Yt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),ld=Yt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:cd}=ad;var Un={},ud=Xe,Su=Qo;function Qo(i,e,r,o,c){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=o,this._values=c,i.readFields(hd,this,e)}function hd(i,e,r){i==1?e.id=r.readVarint():i==2?function(o,c){for(var h=o.readVarint()+o.pos;o.pos<h;){var d=c._keys[o.readVarint()],m=c._values[o.readVarint()];c.properties[d]=m}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function pd(i){for(var e,r,o=0,c=0,h=i.length,d=h-1;c<h;d=c++)o+=((r=i[d]).x-(e=i[c]).x)*(e.y+r.y);return o}Qo.types=["Unknown","Point","LineString","Polygon"],Qo.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,o=1,c=0,h=0,d=0,m=[];i.pos<r;){if(c<=0){var g=i.readVarint();o=7&g,c=g>>3}if(c--,o===1||o===2)h+=i.readSVarint(),d+=i.readSVarint(),o===1&&(e&&m.push(e),e=[]),e.push(new ud(h,d));else{if(o!==7)throw new Error("unknown command "+o);e&&e.push(e[0].clone())}}return e&&m.push(e),m},Qo.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,o=0,c=0,h=0,d=1/0,m=-1/0,g=1/0,x=-1/0;i.pos<e;){if(o<=0){var T=i.readVarint();r=7&T,o=T>>3}if(o--,r===1||r===2)(c+=i.readSVarint())<d&&(d=c),c>m&&(m=c),(h+=i.readSVarint())<g&&(g=h),h>x&&(x=h);else if(r!==7)throw new Error("unknown command "+r)}return[d,g,m,x]},Qo.prototype.toGeoJSON=function(i,e,r){var o,c,h=this.extent*Math.pow(2,r),d=this.extent*i,m=this.extent*e,g=this.loadGeometry(),x=Qo.types[this.type];function T(k){for(var L=0;L<k.length;L++){var Z=k[L];k[L]=[360*(Z.x+d)/h-180,360/Math.PI*Math.atan(Math.exp((180-360*(Z.y+m)/h)*Math.PI/180))-90]}}switch(this.type){case 1:var S=[];for(o=0;o<g.length;o++)S[o]=g[o][0];T(g=S);break;case 2:for(o=0;o<g.length;o++)T(g[o]);break;case 3:for(g=function(k){var L=k.length;if(L<=1)return[k];for(var Z,q,re=[],ce=0;ce<L;ce++){var ee=pd(k[ce]);ee!==0&&(q===void 0&&(q=ee<0),q===ee<0?(Z&&re.push(Z),Z=[k[ce]]):Z.push(k[ce]))}return Z&&re.push(Z),re}(g),o=0;o<g.length;o++)for(c=0;c<g[o].length;c++)T(g[o][c])}g.length===1?g=g[0]:x="Multi"+x;var P={type:"Feature",geometry:{type:x,coordinates:g},properties:this.properties};return"id"in this&&(P.id=this.id),P};var dd=Su,Iu=Cu;function Cu(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(fd,this,e),this.length=this._features.length}function fd(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(o){for(var c=null,h=o.readVarint()+o.pos;o.pos<h;){var d=o.readVarint()>>3;c=d===1?o.readString():d===2?o.readFloat():d===3?o.readDouble():d===4?o.readVarint64():d===5?o.readVarint():d===6?o.readSVarint():d===7?o.readBoolean():null}return c}(r))}Cu.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new dd(this._pbf,e,this.extent,this._keys,this._values)};var md=Iu;function gd(i,e,r){if(i===3){var o=new md(r,r.readVarint()+r.pos);o.length&&(e[o.name]=o)}}Un.VectorTile=function(i,e){this.layers=i.readFields(gd,{},e)},Un.VectorTileFeature=Su,Un.VectorTileLayer=Iu;const _d=Un.VectorTileFeature.types,hc=Math.pow(2,13);function Hs(i,e,r,o,c,h,d,m){i.emplaceBack(e,r,2*Math.floor(o*hc)+d,c*hc*2,h*hc*2,Math.round(m))}class pc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new _t,this.centroidVertexArray=new We,this.indexArray=new zi,this.programConfigurations=new vo(e.layers,e.zoom),this.segments=new dt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.features=[],this.hasPattern=lc("fill-extrusion",this.layers,r);for(const{feature:c,id:h,index:d,sourceLayerIndex:m}of e){const g=this.layers[0]._featureFilter.needGeometry,x=wo(c,g);if(!this.layers[0]._featureFilter.filter(new Nt(this.zoom),x,o))continue;const T={id:h,sourceLayerIndex:m,index:d,geometry:g?x.geometry:bo(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(cc("fill-extrusion",this.layers,T,this.zoom,r)):this.addFeature(T,T.geometry,d,o,{}),r.featureIndex.insert(c,T.geometry,d,m,this.index,!0)}}addFeatures(e,r,o){for(const c of this.features){const{geometry:h}=c;this.addFeature(c,h,c.index,r,o)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}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,cd),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,ld.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,r,o,c,h){const d={x:0,y:0,vertexCount:0};for(const m of ac(r,500)){let g=0;for(const L of m)g+=L.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const L of m){if(L.length===0||xd(L))continue;let Z=0;for(let q=0;q<L.length;q++){const re=L[q];if(q>=1){const ce=L[q-1];if(!yd(re,ce)){x.vertexLength+4>dt.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const ee=re.sub(ce)._perp()._unit(),ae=ce.dist(re);Z+ae>32768&&(Z=0),Hs(this.layoutVertexArray,re.x,re.y,ee.x,ee.y,0,0,Z),Hs(this.layoutVertexArray,re.x,re.y,ee.x,ee.y,0,1,Z),d.x+=2*re.x,d.y+=2*re.y,d.vertexCount+=2,Z+=ae,Hs(this.layoutVertexArray,ce.x,ce.y,ee.x,ee.y,0,0,Z),Hs(this.layoutVertexArray,ce.x,ce.y,ee.x,ee.y,0,1,Z),d.x+=2*ce.x,d.y+=2*ce.y,d.vertexCount+=2;const xe=x.vertexLength;this.indexArray.emplaceBack(xe,xe+2,xe+1),this.indexArray.emplaceBack(xe+1,xe+2,xe+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+g>dt.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),_d[e.type]!=="Polygon")continue;const T=[],S=[],P=x.vertexLength;for(const L of m)if(L.length!==0){L!==m[0]&&S.push(T.length/2);for(let Z=0;Z<L.length;Z++){const q=L[Z];Hs(this.layoutVertexArray,q.x,q.y,0,0,1,1,0),d.x+=q.x,d.y+=q.y,d.vertexCount+=1,T.push(q.x),T.push(q.y)}}const k=el.exports(T,S);for(let L=0;L<k.length;L+=3)this.indexArray.emplaceBack(P+k[L],P+k[L+2],P+k[L+1]);x.primitiveLength+=k.length/3,x.vertexLength+=g}for(let m=0;m<d.vertexCount;m++)this.centroidVertexArray.emplaceBack(Math.floor(d.x/d.vertexCount),Math.floor(d.y/d.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}}function yd(i,e){return i.x===e.x&&(i.x<0||i.x>ri)||i.y===e.y&&(i.y<0||i.y>ri)}function xd(i){return i.every(e=>e.x<0)||i.every(e=>e.x>ri)||i.every(e=>e.y<0)||i.every(e=>e.y>ri)}Oe("FillExtrusionBucket",pc,{omit:["layers","features"]});var vd={paint:new mi({"fill-extrusion-opacity":new Ze(_e["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ye(_e["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ze(_e["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ze(_e["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Fn(_e["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ye(_e["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ye(_e["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ze(_e["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Ks(i,e){return i.x*e.x+i.y*e.y}function Au(i,e){if(i.length===1){let r=0;const o=e[r++];let c;for(;!c||o.equals(c);)if(c=e[r++],!c)return 1/0;for(;r<e.length;r++){const h=e[r],d=i[0],m=c.sub(o),g=h.sub(o),x=d.sub(o),T=Ks(m,m),S=Ks(m,g),P=Ks(g,g),k=Ks(x,m),L=Ks(x,g),Z=T*P-S*S,q=(P*k-S*L)/Z,re=(T*L-S*k)/Z,ce=o.z*(1-q-re)+c.z*q+h.z*re;if(isFinite(ce))return ce}return 1/0}{let r=1/0;for(const o of e)r=Math.min(r,o.z);return r}}const bd=Yt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:wd}=bd,Td=Yt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Ed}=Td,Sd=Un.VectorTileFeature.types,Id=Math.cos(Math.PI/180*37.5),Mu=Math.pow(2,14)/.5;class dc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new wt,this.layoutVertexArray2=new zt,this.indexArray=new zi,this.programConfigurations=new vo(e.layers,e.zoom),this.segments=new dt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=lc("line",this.layers,r);const c=this.layers[0].layout.get("line-sort-key"),h=!c.isConstant(),d=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:T}of e){const S=this.layers[0]._featureFilter.needGeometry,P=wo(m,S);if(!this.layers[0]._featureFilter.filter(new Nt(this.zoom),P,o))continue;const k=h?c.evaluate(P,{},o):void 0,L={id:g,properties:m.properties,type:m.type,sourceLayerIndex:T,index:x,geometry:S?P.geometry:bo(m),patterns:{},sortKey:k};d.push(L)}h&&d.sort((m,g)=>m.sortKey-g.sortKey);for(const m of d){const{geometry:g,index:x,sourceLayerIndex:T}=m;if(this.hasPattern){const S=cc("line",this.layers,m,this.zoom,r);this.patternFeatures.push(S)}else this.addFeature(m,g,x,o,{});r.featureIndex.insert(e[x].feature,g,x,T,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}addFeatures(e,r,o){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,o)}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,Ed)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,wd),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,o,c,h){const d=this.layers[0].layout,m=d.get("line-join").evaluate(e,{}),g=d.get("line-cap"),x=d.get("line-miter-limit"),T=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const S of r)this.addLine(S,e,m,g,x,T);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}addLine(e,r,o,c,h,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let re=0;re<e.length-1;re++)this.totalDistance+=e[re].dist(e[re+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=Sd[r.type]==="Polygon";let g=e.length;for(;g>=2&&e[g-1].equals(e[g-2]);)g--;let x=0;for(;x<g-1&&e[x].equals(e[x+1]);)x++;if(g<(m?3:2))return;o==="bevel"&&(h=1.05);const T=this.overscaling<=16?122880/(512*this.overscaling):0,S=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let P,k,L,Z,q;this.e1=this.e2=-1,m&&(P=e[g-2],q=e[x].sub(P)._unit()._perp());for(let re=x;re<g;re++){if(L=re===g-1?m?e[x+1]:void 0:e[re+1],L&&e[re].equals(L))continue;q&&(Z=q),P&&(k=P),P=e[re],q=L?L.sub(P)._unit()._perp():Z,Z=Z||q;let ce=Z.add(q);ce.x===0&&ce.y===0||ce._unit();const ee=Z.x*q.x+Z.y*q.y,ae=ce.x*q.x+ce.y*q.y,xe=ae!==0?1/ae:1/0,ye=2*Math.sqrt(2-2*ae),Fe=ae<Id&&k&&L,Ne=Z.x*q.y-Z.y*q.x>0;if(Fe&&re>x){const Ee=P.dist(k);if(Ee>2*T){const De=P.sub(P.sub(k)._mult(T/Ee)._round());this.updateDistance(k,De),this.addCurrentVertex(De,Z,0,0,S),k=De}}const ke=k&&L;let Ae=ke?o:m?"butt":c;if(ke&&Ae==="round"&&(xe<d?Ae="miter":xe<=2&&(Ae="fakeround")),Ae==="miter"&&xe>h&&(Ae="bevel"),Ae==="bevel"&&(xe>2&&(Ae="flipbevel"),xe<h&&(Ae="miter")),k&&this.updateDistance(k,P),Ae==="miter")ce._mult(xe),this.addCurrentVertex(P,ce,0,0,S);else if(Ae==="flipbevel"){if(xe>100)ce=q.mult(-1);else{const Ee=xe*Z.add(q).mag()/Z.sub(q).mag();ce._perp()._mult(Ee*(Ne?-1:1))}this.addCurrentVertex(P,ce,0,0,S),this.addCurrentVertex(P,ce.mult(-1),0,0,S)}else if(Ae==="bevel"||Ae==="fakeround"){const Ee=-Math.sqrt(xe*xe-1),De=Ne?Ee:0,Pe=Ne?0:Ee;if(k&&this.addCurrentVertex(P,Z,De,Pe,S),Ae==="fakeround"){const we=Math.round(180*ye/Math.PI/20);for(let He=1;He<we;He++){let je=He/we;if(je!==.5){const Ot=je-.5;je+=je*Ot*(je-1)*((1.0904+ee*(ee*(3.55645-1.43519*ee)-3.2452))*Ot*Ot+(.848013+ee*(.215638*ee-1.06021)))}const pt=q.sub(Z)._mult(je)._add(Z)._unit()._mult(Ne?-1:1);this.addHalfVertex(P,pt.x,pt.y,!1,Ne,0,S)}}L&&this.addCurrentVertex(P,q,-De,-Pe,S)}else if(Ae==="butt")this.addCurrentVertex(P,ce,0,0,S);else if(Ae==="square"){const Ee=k?1:-1;this.addCurrentVertex(P,ce,Ee,Ee,S)}else Ae==="round"&&(k&&(this.addCurrentVertex(P,Z,0,0,S),this.addCurrentVertex(P,Z,1,1,S,!0)),L&&(this.addCurrentVertex(P,q,-1,-1,S,!0),this.addCurrentVertex(P,q,0,0,S)));if(Fe&&re<g-1){const Ee=P.dist(L);if(Ee>2*T){const De=P.add(L.sub(P)._mult(T/Ee)._round());this.updateDistance(P,De),this.addCurrentVertex(De,q,0,0,S),P=De}}}}addCurrentVertex(e,r,o,c,h,d=!1){const m=r.y*c-r.x,g=-r.y-r.x*c;this.addHalfVertex(e,r.x+r.y*o,r.y-r.x*o,d,!1,o,h),this.addHalfVertex(e,m,g,d,!0,-c,h),this.distance>Mu/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(e,r,o,c,h,d))}addHalfVertex({x:e,y:r},o,c,h,d,m,g){const x=.5*(this.lineClips?this.scaledDistance*(Mu-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(h?1:0),(r<<1)+(d?1:0),Math.round(63*o)+128,Math.round(63*c)+128,1+(m===0?0:m<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const T=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,T),g.primitiveLength++),d?this.e2=T:this.e1=T}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}Oe("LineBucket",dc,{omit:["layers","patternFeatures"]});const Cd=new mi({"line-cap":new Ze(_e.layout_line["line-cap"]),"line-join":new Ye(_e.layout_line["line-join"]),"line-miter-limit":new Ze(_e.layout_line["line-miter-limit"]),"line-round-limit":new Ze(_e.layout_line["line-round-limit"]),"line-sort-key":new Ye(_e.layout_line["line-sort-key"])});var Pu={paint:new mi({"line-opacity":new Ye(_e.paint_line["line-opacity"]),"line-color":new Ye(_e.paint_line["line-color"]),"line-translate":new Ze(_e.paint_line["line-translate"]),"line-translate-anchor":new Ze(_e.paint_line["line-translate-anchor"]),"line-width":new Ye(_e.paint_line["line-width"]),"line-gap-width":new Ye(_e.paint_line["line-gap-width"]),"line-offset":new Ye(_e.paint_line["line-offset"]),"line-blur":new Ye(_e.paint_line["line-blur"]),"line-dasharray":new Fs(_e.paint_line["line-dasharray"]),"line-pattern":new Fn(_e.paint_line["line-pattern"]),"line-gradient":new qr(_e.paint_line["line-gradient"])}),layout:Cd};const zu=new class extends Ye{possiblyEvaluate(i,e){return e=new Nt(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(i,e)}evaluate(i,e,r,o){return e=$e({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(i,e,r,o)}}(Pu.paint.properties["line-width"].specification);function ku(i,e){return e>0?e+2*i:i}zu.useIntegerZoom=!0;const Ad=Yt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Md=Yt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Yt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Pd=Yt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Yt([{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 Du=Yt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),zd=Yt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function kd(i,e,r){return i.sections.forEach(o=>{o.text=function(c,h,d){const m=h.layout.get("text-transform").evaluate(d,{});return m==="uppercase"?c=c.toLocaleUpperCase():m==="lowercase"&&(c=c.toLocaleLowerCase()),Ji.applyArabicShaping&&(c=Ji.applyArabicShaping(c)),c}(o.text,e,r)}),i}Yt([{name:"triangle",components:3,type:"Uint16"}]),Yt([{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"}]),Yt([{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Yt([{type:"Float32",name:"offsetX"}]),Yt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Js={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};var gi=24,fc=Lt,Lu=function(i,e,r,o,c){var h,d,m=8*c-o-1,g=(1<<m)-1,x=g>>1,T=-7,S=r?c-1:0,P=r?-1:1,k=i[e+S];for(S+=P,h=k&(1<<-T)-1,k>>=-T,T+=m;T>0;h=256*h+i[e+S],S+=P,T-=8);for(d=h&(1<<-T)-1,h>>=-T,T+=o;T>0;d=256*d+i[e+S],S+=P,T-=8);if(h===0)h=1-x;else{if(h===g)return d?NaN:1/0*(k?-1:1);d+=Math.pow(2,o),h-=x}return(k?-1:1)*d*Math.pow(2,h-o)},Ru=function(i,e,r,o,c,h){var d,m,g,x=8*h-c-1,T=(1<<x)-1,S=T>>1,P=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,k=o?0:h-1,L=o?1:-1,Z=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,d=T):(d=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-d))<1&&(d--,g*=2),(e+=d+S>=1?P/g:P*Math.pow(2,1-S))*g>=2&&(d++,g/=2),d+S>=T?(m=0,d=T):d+S>=1?(m=(e*g-1)*Math.pow(2,c),d+=S):(m=e*Math.pow(2,S-1)*Math.pow(2,c),d=0));c>=8;i[r+k]=255&m,k+=L,m/=256,c-=8);for(d=d<<c|m,x+=c;x>0;i[r+k]=255&d,k+=L,d/=256,x-=8);i[r+k-L]|=128*Z};function Lt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Lt.Varint=0,Lt.Fixed64=1,Lt.Bytes=2,Lt.Fixed32=5;var Vn,mc=4294967296,Bu=1/mc,Fu=typeof TextDecoder=="undefined"?null:new TextDecoder("utf8");function hn(i){return i.type===Lt.Bytes?i.readVarint()+i.pos:i.pos+1}function es(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Ou(i,e,r){var o=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(o);for(var c=r.pos-1;c>=i;c--)r.buf[c+o]=r.buf[c]}function Dd(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function Ld(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function Rd(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function Bd(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function Fd(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function Od(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function $d(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function Ud(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function Vd(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function ol(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function ts(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function $u(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}function Nd(i,e,r){i===1&&r.readMessage(Gd,e)}function Gd(i,e,r){if(i===3){const{id:o,bitmap:c,width:h,height:d,left:m,top:g,advance:x}=r.readMessage(qd,{});e.push({id:o,bitmap:new qs({width:h+6,height:d+6},c),metrics:{width:h,height:d,left:m,top:g,advance:x}})}}function qd(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}function Uu(i){let e=0,r=0;for(const d of i)e+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,m)=>m.h-d.h);const o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let c=0,h=0;for(const d of i)for(let m=o.length-1;m>=0;m--){const g=o[m];if(!(d.w>g.w||d.h>g.h)){if(d.x=g.x,d.y=g.y,h=Math.max(h,d.y+d.h),c=Math.max(c,d.x+d.w),d.w===g.w&&d.h===g.h){const x=o.pop();m<o.length&&(o[m]=x)}else d.h===g.h?(g.x+=d.w,g.w-=d.w):d.w===g.w?(g.y+=d.h,g.h-=d.h):(o.push({x:g.x+d.w,y:g.y,w:g.w-d.w,h:d.h}),g.y+=d.h,g.h-=d.h);break}}return{w:c,h,fill:e/(c*h)||0}}Lt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var o=this.readVarint(),c=o>>3,h=this.pos;this.type=7&o,i(c,e,this),this.pos===h&&this.skip(o)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=ol(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=$u(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=ol(this.buf,this.pos)+ol(this.buf,this.pos+4)*mc;return this.pos+=8,i},readSFixed64:function(){var i=ol(this.buf,this.pos)+$u(this.buf,this.pos+4)*mc;return this.pos+=8,i},readFloat:function(){var i=Lu(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Lu(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,o=this.buf;return e=127&(r=o[this.pos++]),r<128?e:(e|=(127&(r=o[this.pos++]))<<7,r<128?e:(e|=(127&(r=o[this.pos++]))<<14,r<128?e:(e|=(127&(r=o[this.pos++]))<<21,r<128?e:function(c,h,d){var m,g,x=d.buf;if(m=(112&(g=x[d.pos++]))>>4,g<128||(m|=(127&(g=x[d.pos++]))<<3,g<128)||(m|=(127&(g=x[d.pos++]))<<10,g<128)||(m|=(127&(g=x[d.pos++]))<<17,g<128)||(m|=(127&(g=x[d.pos++]))<<24,g<128)||(m|=(1&(g=x[d.pos++]))<<31,g<128))return es(c,m,h);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=o[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&Fu?function(r,o,c){return Fu.decode(r.subarray(o,c))}(this.buf,e,i):function(r,o,c){for(var h="",d=o;d<c;){var m,g,x,T=r[d],S=null,P=T>239?4:T>223?3:T>191?2:1;if(d+P>c)break;P===1?T<128&&(S=T):P===2?(192&(m=r[d+1]))==128&&(S=(31&T)<<6|63&m)<=127&&(S=null):P===3?(g=r[d+2],(192&(m=r[d+1]))==128&&(192&g)==128&&((S=(15&T)<<12|(63&m)<<6|63&g)<=2047||S>=55296&&S<=57343)&&(S=null)):P===4&&(g=r[d+2],x=r[d+3],(192&(m=r[d+1]))==128&&(192&g)==128&&(192&x)==128&&((S=(15&T)<<18|(63&m)<<12|(63&g)<<6|63&x)<=65535||S>=1114112)&&(S=null)),S===null?(S=65533,P=1):S>65535&&(S-=65536,h+=String.fromCharCode(S>>>10&1023|55296),S=56320|1023&S),h+=String.fromCharCode(S),d+=P}return h}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==Lt.Bytes)return i.push(this.readVarint(e));var r=hn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==Lt.Bytes)return i.push(this.readSVarint());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==Lt.Bytes)return i.push(this.readBoolean());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==Lt.Bytes)return i.push(this.readFloat());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==Lt.Bytes)return i.push(this.readDouble());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==Lt.Bytes)return i.push(this.readFixed32());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==Lt.Bytes)return i.push(this.readSFixed32());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==Lt.Bytes)return i.push(this.readFixed64());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==Lt.Bytes)return i.push(this.readSFixed64());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===Lt.Varint)for(;this.buf[this.pos++]>127;);else if(e===Lt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Lt.Fixed32)this.pos+=4;else{if(e!==Lt.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e<this.pos+i;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),ts(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),ts(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),ts(this.buf,-1&i,this.pos),ts(this.buf,Math.floor(i*Bu),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),ts(this.buf,-1&i,this.pos),ts(this.buf,Math.floor(i*Bu),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var o,c;if(e>=0?(o=e%4294967296|0,c=e/4294967296|0):(c=~(-e/4294967296),4294967295^(o=~(-e%4294967296))?o=o+1|0:(o=0,c=c+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(h,d,m){m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,m.buf[m.pos]=127&(h>>>=7)}(o,0,r),function(h,d){var m=(7&h)<<4;d.buf[d.pos++]|=m|((h>>>=3)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h)))))}(c,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(o,c,h){for(var d,m,g=0;g<c.length;g++){if((d=c.charCodeAt(g))>55295&&d<57344){if(!m){d>56319||g+1===c.length?(o[h++]=239,o[h++]=191,o[h++]=189):m=d;continue}if(d<56320){o[h++]=239,o[h++]=191,o[h++]=189,m=d;continue}d=m-55296<<10|d-56320|65536,m=null}else m&&(o[h++]=239,o[h++]=191,o[h++]=189,m=null);d<128?o[h++]=d:(d<2048?o[h++]=d>>6|192:(d<65536?o[h++]=d>>12|224:(o[h++]=d>>18|240,o[h++]=d>>12&63|128),o[h++]=d>>6&63|128),o[h++]=63&d|128)}return h}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&Ou(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Ru(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Ru(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,e){this.pos++;var r=this.pos;i(e,this);var o=this.pos-r;o>=128&&Ou(r,o,this),this.pos=r-1,this.writeVarint(o),this.pos+=o},writeMessage:function(i,e,r){this.writeTag(i,Lt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Dd,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Ld,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Fd,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Rd,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Bd,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Od,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,$d,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Ud,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,Vd,e)},writeBytesField:function(i,e){this.writeTag(i,Lt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Lt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Lt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Lt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Lt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Lt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Lt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Lt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Lt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Lt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,Boolean(e))}};class gc{constructor(e,{pixelRatio:r,version:o,stretchX:c,stretchY:h,content:d}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=c,this.stretchY=h,this.content=d,this.version=o}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 Vu{constructor(e,r){const o={},c={};this.haveRenderCallbacks=[];const h=[];this.addImages(e,o,h),this.addImages(r,c,h);const{w:d,h:m}=Uu(h),g=new or({width:d||1,height:m||1});for(const x in e){const T=e[x],S=o[x].paddedRect;or.copy(T.data,g,{x:0,y:0},{x:S.x+1,y:S.y+1},T.data)}for(const x in r){const T=r[x],S=c[x].paddedRect,P=S.x+1,k=S.y+1,L=T.data.width,Z=T.data.height;or.copy(T.data,g,{x:0,y:0},{x:P,y:k},T.data),or.copy(T.data,g,{x:0,y:Z-1},{x:P,y:k-1},{width:L,height:1}),or.copy(T.data,g,{x:0,y:0},{x:P,y:k+Z},{width:L,height:1}),or.copy(T.data,g,{x:L-1,y:0},{x:P-1,y:k},{width:1,height:Z}),or.copy(T.data,g,{x:0,y:0},{x:P+L,y:k},{width:1,height:Z})}this.image=g,this.iconPositions=o,this.patternPositions=c}addImages(e,r,o){for(const c in e){const h=e[c],d={x:0,y:0,w:h.data.width+2,h:h.data.height+2};o.push(d),r[c]=new gc(d,h),h.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const o in e.updatedImages)this.patchUpdatedImage(this.iconPositions[o],e.getImage(o),r),this.patchUpdatedImage(this.patternPositions[o],e.getImage(o),r)}patchUpdatedImage(e,r,o){if(!e||!r||e.version===r.version)return;e.version=r.version;const[c,h]=e.tl;o.update(r.data,void 0,{x:c,y:h})}}Oe("ImagePosition",gc),Oe("ImageAtlas",Vu),a.WritingMode=void 0,(Vn=a.WritingMode||(a.WritingMode={}))[Vn.none=0]="none",Vn[Vn.horizontal=1]="horizontal",Vn[Vn.vertical=2]="vertical",Vn[Vn.horizontalOnly=3]="horizontalOnly";const sl=-17;class Ys{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const o=new Ys;return o.scale=e||1,o.fontStack=r,o}static forImage(e){const r=new Ys;return r.imageName=e,r}}class is{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const o=new is;for(let c=0;c<e.sections.length;c++){const h=e.sections[c];h.image?o.addImageSection(h):o.addTextSection(h,r)}return o}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let r="";for(let o=0;o<e.length;o++){const c=e.charCodeAt(o+1)||null,h=e.charCodeAt(o-1)||null;r+=c&&Ua(c)&&!Js[e[o+1]]||h&&Ua(h)&&!Js[e[o-1]]||!Js[e[o]]?e[o]:Js[e[o]]}return r}(this.text)}trim(){let e=0;for(let o=0;o<this.text.length&&ll[this.text.charCodeAt(o)];o++)e++;let r=this.text.length;for(let o=this.text.length-1;o>=0&&o>=e&&ll[this.text.charCodeAt(o)];o--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const o=new is;return o.text=this.text.substring(e,r),o.sectionIndex=this.sectionIndex.slice(e,r),o.sections=this.sections,o}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(Ys.forText(e.scale,e.fontStack||r));const o=this.sections.length-1;for(let c=0;c<e.text.length;++c)this.sectionIndex.push(o)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void at("Can't add FormattedSection with an empty image.");const o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCharCode(o),this.sections.push(Ys.forImage(r)),this.sectionIndex.push(this.sections.length-1)):at("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function al(i,e,r,o,c,h,d,m,g,x,T,S,P,k,L,Z){const q=is.fromFeature(i,c);let re;S===a.WritingMode.vertical&&q.verticalizePunctuation();const{processBidirectionalText:ce,processStyledBidirectionalText:ee}=Ji;if(ce&&q.sections.length===1){re=[];const ye=ce(q.toString(),_c(q,x,h,e,o,k,L));for(const Fe of ye){const Ne=new is;Ne.text=Fe,Ne.sections=q.sections;for(let ke=0;ke<Fe.length;ke++)Ne.sectionIndex.push(0);re.push(Ne)}}else if(ee){re=[];const ye=ee(q.text,q.sectionIndex,_c(q,x,h,e,o,k,L));for(const Fe of ye){const Ne=new is;Ne.text=Fe[0],Ne.sectionIndex=Fe[1],Ne.sections=q.sections,re.push(Ne)}}else re=function(ye,Fe){const Ne=[],ke=ye.text;let Ae=0;for(const Ee of Fe)Ne.push(ye.substring(Ae,Ee)),Ae=Ee;return Ae<ke.length&&Ne.push(ye.substring(Ae,ke.length)),Ne}(q,_c(q,x,h,e,o,k,L));const ae=[],xe={positionedLines:ae,text:q.toString(),top:T[1],bottom:T[1],left:T[0],right:T[0],writingMode:S,iconsInText:!1,verticalizable:!1};return function(ye,Fe,Ne,ke,Ae,Ee,De,Pe,we,He,je,pt){let Ot=0,qt=sl,ni=0,ar=0;const yi=Pe==="right"?1:Pe==="left"?0:.5;let Qt=0;for(const ei of Ae){ei.trim();const vi=ei.getMaxScale(),Si=(vi-1)*gi,Li={positionedGlyphs:[],lineOffset:0};ye.positionedLines[Qt]=Li;const qi=Li.positionedGlyphs;let Zi=0;if(!ei.length()){qt+=Ee,++Qt;continue}for(let hi=0;hi<ei.length();hi++){const ft=ei.getSection(hi),er=ei.getSectionIndex(hi),bi=ei.getCharCode(hi);let Ii=0,xr=null,Pr=null,zr=null,dn=gi;const vr=!(we===a.WritingMode.horizontal||!je&&!zs(bi)||je&&(ll[bi]||(ui=bi,ze.Arabic(ui)||ze["Arabic Supplement"](ui)||ze["Arabic Extended-A"](ui)||ze["Arabic Presentation Forms-A"](ui)||ze["Arabic Presentation Forms-B"](ui))));if(ft.imageName){const lr=ke[ft.imageName];if(!lr)continue;zr=ft.imageName,ye.iconsInText=ye.iconsInText||!0,Pr=lr.paddedRect;const ji=lr.displaySize;ft.scale=ft.scale*gi/pt,xr={width:ji[0],height:ji[1],left:1,top:-3,advance:vr?ji[1]:ji[0]},Ii=Si+(gi-ji[1]*ft.scale),dn=xr.advance;const fn=vr?ji[0]*ft.scale-gi*vi:ji[1]*ft.scale-gi*vi;fn>0&&fn>Zi&&(Zi=fn)}else{const lr=Ne[ft.fontStack],ji=lr&&lr[bi];if(ji&&ji.rect)Pr=ji.rect,xr=ji.metrics;else{const fn=Fe[ft.fontStack],ta=fn&&fn[bi];if(!ta)continue;xr=ta.metrics}Ii=(vi-ft.scale)*gi}vr?(ye.verticalizable=!0,qi.push({glyph:bi,imageName:zr,x:Ot,y:qt+Ii,vertical:vr,scale:ft.scale,fontStack:ft.fontStack,sectionIndex:er,metrics:xr,rect:Pr}),Ot+=dn*ft.scale+He):(qi.push({glyph:bi,imageName:zr,x:Ot,y:qt+Ii,vertical:vr,scale:ft.scale,fontStack:ft.fontStack,sectionIndex:er,metrics:xr,rect:Pr}),Ot+=xr.advance*ft.scale+He)}qi.length!==0&&(ni=Math.max(Ot-He,ni),Xd(qi,0,qi.length-1,yi,Zi)),Ot=0;const jt=Ee*vi+Zi;Li.lineOffset=Math.max(Zi,Si),qt+=jt,ar=Math.max(jt,ar),++Qt}var ui;const xi=qt-sl,{horizontalAlign:Ei,verticalAlign:Gi}=yc(De);(function(ei,vi,Si,Li,qi,Zi,jt,hi,ft){const er=(vi-Si)*qi;let bi=0;bi=Zi!==jt?-hi*Li-sl:(-Li*ft+.5)*jt;for(const Ii of ei)for(const xr of Ii.positionedGlyphs)xr.x+=er,xr.y+=bi})(ye.positionedLines,yi,Ei,Gi,ni,ar,Ee,xi,Ae.length),ye.top+=-Gi*xi,ye.bottom=ye.top+xi,ye.left+=-Ei*ni,ye.right=ye.left+ni}(xe,e,r,o,re,d,m,g,S,x,P,Z),!function(ye){for(const Fe of ye)if(Fe.positionedGlyphs.length!==0)return!1;return!0}(ae)&&xe}const ll={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Zd={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Nu(i,e,r,o,c,h){if(e.imageName){const d=o[e.imageName];return d?d.displaySize[0]*e.scale*gi/h+c:0}{const d=r[e.fontStack],m=d&&d[i];return m?m.metrics.advance*e.scale+c:0}}function Gu(i,e,r,o){const c=Math.pow(i-e,2);return o?i<e?c/2:2*c:c+Math.abs(r)*r}function jd(i,e,r){let o=0;return i===10&&(o-=1e4),r&&(o+=150),i!==40&&i!==65288||(o+=50),e!==41&&e!==65289||(o+=50),o}function qu(i,e,r,o,c,h){let d=null,m=Gu(e,r,c,h);for(const g of o){const x=Gu(e-g.x,r,c,h)+g.badness;x<=m&&(d=g,m=x)}return{index:i,x:e,priorBreak:d,badness:m}}function Zu(i){return i?Zu(i.priorBreak).concat(i.index):[]}function _c(i,e,r,o,c,h,d){if(h!=="point")return[];if(!i)return[];const m=[],g=function(P,k,L,Z,q,re){let ce=0;for(let ee=0;ee<P.length();ee++){const ae=P.getSection(ee);ce+=Nu(P.getCharCode(ee),ae,Z,q,k,re)}return ce/Math.max(1,Math.ceil(ce/L))}(i,e,r,o,c,d),x=i.text.indexOf("\u200B")>=0;let T=0;for(let P=0;P<i.length();P++){const k=i.getSection(P),L=i.getCharCode(P);if(ll[L]||(T+=Nu(L,k,o,c,e,d)),P<i.length()-1){const Z=!((S=L)<11904||!(ze["Bopomofo Extended"](S)||ze.Bopomofo(S)||ze["CJK Compatibility Forms"](S)||ze["CJK Compatibility Ideographs"](S)||ze["CJK Compatibility"](S)||ze["CJK Radicals Supplement"](S)||ze["CJK Strokes"](S)||ze["CJK Symbols and Punctuation"](S)||ze["CJK Unified Ideographs Extension A"](S)||ze["CJK Unified Ideographs"](S)||ze["Enclosed CJK Letters and Months"](S)||ze["Halfwidth and Fullwidth Forms"](S)||ze.Hiragana(S)||ze["Ideographic Description Characters"](S)||ze["Kangxi Radicals"](S)||ze["Katakana Phonetic Extensions"](S)||ze.Katakana(S)||ze["Vertical Forms"](S)||ze["Yi Radicals"](S)||ze["Yi Syllables"](S)));(Zd[L]||Z||k.imageName)&&m.push(qu(P+1,T,g,m,jd(L,i.getCharCode(P+1),Z&&x),!1))}}var S;return Zu(qu(i.length(),T,g,m,0,!0))}function yc(i){let e=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Xd(i,e,r,o,c){if(!o&&!c)return;const h=i[r],d=(i[r].x+h.metrics.advance*h.scale)*o;for(let m=e;m<=r;m++)i[m].x-=d,i[m].y+=c}function Wd(i,e,r){const{horizontalAlign:o,verticalAlign:c}=yc(r),h=e[0]-i.displaySize[0]*o,d=e[1]-i.displaySize[1]*c;return{image:i,top:d,bottom:d+i.displaySize[1],left:h,right:h+i.displaySize[0]}}function ju(i,e,r,o,c,h){const d=i.image;let m;if(d.content){const q=d.content,re=d.pixelRatio||1;m=[q[0]/re,q[1]/re,d.displaySize[0]-q[2]/re,d.displaySize[1]-q[3]/re]}const g=e.left*h,x=e.right*h;let T,S,P,k;r==="width"||r==="both"?(k=c[0]+g-o[3],S=c[0]+x+o[1]):(k=c[0]+(g+x-d.displaySize[0])/2,S=k+d.displaySize[0]);const L=e.top*h,Z=e.bottom*h;return r==="height"||r==="both"?(T=c[1]+L-o[0],P=c[1]+Z+o[2]):(T=c[1]+(L+Z-d.displaySize[1])/2,P=T+d.displaySize[1]),{image:d,top:T,right:S,bottom:P,left:k,collisionPadding:m}}const pn=128;function Xu(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Nt(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:o,interpolationType:c}=r;let h=0;for(;h<o.length&&o[h]<=i;)h++;h=Math.max(0,h-1);let d=h;for(;d<o.length&&o[d]<i+1;)d++;d=Math.min(o.length-1,d);const m=o[h],g=o[d];return r.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:g,interpolationType:c}:{kind:"camera",minZoom:m,maxZoom:g,minSize:r.evaluate(new Nt(m)),maxSize:r.evaluate(new Nt(g)),interpolationType:c}}}class Nn extends Xe{constructor(e,r,o,c){super(e,r),this.angle=o,c!==void 0&&(this.segment=c)}clone(){return new Nn(this.x,this.y,this.angle,this.segment)}}function Wu(i,e,r,o,c){if(e.segment===void 0)return!0;let h=e,d=e.segment+1,m=0;for(;m>-r/2;){if(d--,d<0)return!1;m-=i[d].dist(h),h=i[d]}m+=i[d].dist(i[d+1]),d++;const g=[];let x=0;for(;m<r/2;){const T=i[d],S=i[d+1];if(!S)return!1;let P=i[d-1].angleTo(T)-T.angleTo(S);for(P=Math.abs((P+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:m,angleDelta:P}),x+=P;m-g[0].distance>o;)x-=g.shift().angleDelta;if(x>c)return!1;d++,m+=T.dist(S)}return!0}function Hu(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function Ku(i,e,r){return i?.6*e*r:0}function Ju(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function Hd(i,e,r,o,c,h){const d=Ku(r,c,h),m=Ju(r,o)*h;let g=0;const x=Hu(i)/2;for(let T=0;T<i.length-1;T++){const S=i[T],P=i[T+1],k=S.dist(P);if(g+k>x){const L=(x-g)/k,Z=Ut(S.x,P.x,L),q=Ut(S.y,P.y,L),re=new Nn(Z,q,P.angleTo(S),T);return re._round(),!d||Wu(i,re,m,d,e)?re:void 0}g+=k}}function Kd(i,e,r,o,c,h,d,m,g){const x=Ku(o,h,d),T=Ju(o,c),S=T*d,P=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-S<e/4&&(e=S+e/4),Yu(i,P?e/2*m%e:(T/2+2*h)*d*m%e,e,x,r,S,P,!1,g)}function Yu(i,e,r,o,c,h,d,m,g){const x=h/2,T=Hu(i);let S=0,P=e-r,k=[];for(let L=0;L<i.length-1;L++){const Z=i[L],q=i[L+1],re=Z.dist(q),ce=q.angleTo(Z);for(;P+r<S+re;){P+=r;const ee=(P-S)/re,ae=Ut(Z.x,q.x,ee),xe=Ut(Z.y,q.y,ee);if(ae>=0&&ae<g&&xe>=0&&xe<g&&P-x>=0&&P+x<=T){const ye=new Nn(ae,xe,ce,L);ye._round(),o&&!Wu(i,ye,h,o,c)||k.push(ye)}}S+=re}return m||k.length||d||(k=Yu(i,S/2,r,o,c,h,d,!0,g)),k}function Qu(i,e,r,o,c){const h=[];for(let d=0;d<i.length;d++){const m=i[d];let g;for(let x=0;x<m.length-1;x++){let T=m[x],S=m[x+1];T.x<e&&S.x<e||(T.x<e?T=new Xe(e,T.y+(e-T.x)/(S.x-T.x)*(S.y-T.y))._round():S.x<e&&(S=new Xe(e,T.y+(e-T.x)/(S.x-T.x)*(S.y-T.y))._round()),T.y<r&&S.y<r||(T.y<r?T=new Xe(T.x+(r-T.y)/(S.y-T.y)*(S.x-T.x),r)._round():S.y<r&&(S=new Xe(T.x+(r-T.y)/(S.y-T.y)*(S.x-T.x),r)._round()),T.x>=o&&S.x>=o||(T.x>=o?T=new Xe(o,T.y+(o-T.x)/(S.x-T.x)*(S.y-T.y))._round():S.x>=o&&(S=new Xe(o,T.y+(o-T.x)/(S.x-T.x)*(S.y-T.y))._round()),T.y>=c&&S.y>=c||(T.y>=c?T=new Xe(T.x+(c-T.y)/(S.y-T.y)*(S.x-T.x),c)._round():S.y>=c&&(S=new Xe(T.x+(c-T.y)/(S.y-T.y)*(S.x-T.x),c)._round()),g&&T.equals(g[g.length-1])||(g=[T],h.push(g)),g.push(S)))))}}return h}function eh(i,e,r,o){const c=[],h=i.image,d=h.pixelRatio,m=h.paddedRect.w-2,g=h.paddedRect.h-2,x=i.right-i.left,T=i.bottom-i.top,S=h.stretchX||[[0,m]],P=h.stretchY||[[0,g]],k=(Ee,De)=>Ee+De[1]-De[0],L=S.reduce(k,0),Z=P.reduce(k,0),q=m-L,re=g-Z;let ce=0,ee=L,ae=0,xe=Z,ye=0,Fe=q,Ne=0,ke=re;if(h.content&&o){const Ee=h.content;ce=cl(S,0,Ee[0]),ae=cl(P,0,Ee[1]),ee=cl(S,Ee[0],Ee[2]),xe=cl(P,Ee[1],Ee[3]),ye=Ee[0]-ce,Ne=Ee[1]-ae,Fe=Ee[2]-Ee[0]-ee,ke=Ee[3]-Ee[1]-xe}const Ae=(Ee,De,Pe,we)=>{const He=ul(Ee.stretch-ce,ee,x,i.left),je=hl(Ee.fixed-ye,Fe,Ee.stretch,L),pt=ul(De.stretch-ae,xe,T,i.top),Ot=hl(De.fixed-Ne,ke,De.stretch,Z),qt=ul(Pe.stretch-ce,ee,x,i.left),ni=hl(Pe.fixed-ye,Fe,Pe.stretch,L),ar=ul(we.stretch-ae,xe,T,i.top),yi=hl(we.fixed-Ne,ke,we.stretch,Z),Qt=new Xe(He,pt),ui=new Xe(qt,pt),xi=new Xe(qt,ar),Ei=new Xe(He,ar),Gi=new Xe(je/d,Ot/d),ei=new Xe(ni/d,yi/d),vi=e*Math.PI/180;if(vi){const qi=Math.sin(vi),Zi=Math.cos(vi),jt=[Zi,-qi,qi,Zi];Qt._matMult(jt),ui._matMult(jt),Ei._matMult(jt),xi._matMult(jt)}const Si=Ee.stretch+Ee.fixed,Li=De.stretch+De.fixed;return{tl:Qt,tr:ui,bl:Ei,br:xi,tex:{x:h.paddedRect.x+1+Si,y:h.paddedRect.y+1+Li,w:Pe.stretch+Pe.fixed-Si,h:we.stretch+we.fixed-Li},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Gi,pixelOffsetBR:ei,minFontScaleX:Fe/d/x,minFontScaleY:ke/d/T,isSDF:r}};if(o&&(h.stretchX||h.stretchY)){const Ee=th(S,q,L),De=th(P,re,Z);for(let Pe=0;Pe<Ee.length-1;Pe++){const we=Ee[Pe],He=Ee[Pe+1];for(let je=0;je<De.length-1;je++)c.push(Ae(we,De[je],He,De[je+1]))}}else c.push(Ae({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:g+1}));return c}function cl(i,e,r){let o=0;for(const c of i)o+=Math.max(e,Math.min(r,c[1]))-Math.max(e,Math.min(r,c[0]));return o}function th(i,e,r){const o=[{fixed:-1,stretch:0}];for(const[c,h]of i){const d=o[o.length-1];o.push({fixed:c-d.stretch,stretch:d.stretch}),o.push({fixed:c-d.stretch,stretch:d.stretch+(h-c)})}return o.push({fixed:e+1,stretch:r}),o}function ul(i,e,r,o){return i/e*r+o}function hl(i,e,r,o){return i-e*r/o}Oe("Anchor",Nn);class pl{constructor(e,r,o,c,h,d,m,g,x,T){if(this.boxStartIndex=e.length,x){let S=d.top,P=d.bottom;const k=d.collisionPadding;k&&(S-=k[1],P+=k[3]);let L=P-S;L>0&&(L=Math.max(10,L),this.circleDiameter=L)}else{let S=d.top*m-g[0],P=d.bottom*m+g[2],k=d.left*m-g[3],L=d.right*m+g[1];const Z=d.collisionPadding;if(Z&&(k-=Z[0]*m,S-=Z[1]*m,L+=Z[2]*m,P+=Z[3]*m),T){const q=new Xe(k,S),re=new Xe(L,S),ce=new Xe(k,P),ee=new Xe(L,P),ae=T*Math.PI/180;q._rotate(ae),re._rotate(ae),ce._rotate(ae),ee._rotate(ae),k=Math.min(q.x,re.x,ce.x,ee.x),L=Math.max(q.x,re.x,ce.x,ee.x),S=Math.min(q.y,re.y,ce.y,ee.y),P=Math.max(q.y,re.y,ce.y,ee.y)}e.emplaceBack(r.x,r.y,k,S,L,P,o,c,h)}this.boxEndIndex=e.length}}class Jd{constructor(e=[],r=Yd){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:o}=this,c=r[e];for(;e>0;){const h=e-1>>1,d=r[h];if(o(c,d)>=0)break;r[e]=d,e=h}r[e]=c}_down(e){const{data:r,compare:o}=this,c=this.length>>1,h=r[e];for(;e<c;){let d=1+(e<<1),m=r[d];const g=d+1;if(g<this.length&&o(r[g],m)<0&&(d=g,m=r[g]),o(m,h)>=0)break;r[e]=m,e=d}r[e]=h}}function Yd(i,e){return i<e?-1:i>e?1:0}function Qd(i,e=1,r=!1){let o=1/0,c=1/0,h=-1/0,d=-1/0;const m=i[0];for(let k=0;k<m.length;k++){const L=m[k];(!k||L.x<o)&&(o=L.x),(!k||L.y<c)&&(c=L.y),(!k||L.x>h)&&(h=L.x),(!k||L.y>d)&&(d=L.y)}const g=Math.min(h-o,d-c);let x=g/2;const T=new Jd([],ef);if(g===0)return new Xe(o,c);for(let k=o;k<h;k+=g)for(let L=c;L<d;L+=g)T.push(new rs(k+x,L+x,x,i));let S=function(k){let L=0,Z=0,q=0;const re=k[0];for(let ce=0,ee=re.length,ae=ee-1;ce<ee;ae=ce++){const xe=re[ce],ye=re[ae],Fe=xe.x*ye.y-ye.x*xe.y;Z+=(xe.x+ye.x)*Fe,q+=(xe.y+ye.y)*Fe,L+=3*Fe}return new rs(Z/L,q/L,0,k)}(i),P=T.length;for(;T.length;){const k=T.pop();(k.d>S.d||!S.d)&&(S=k,r&&console.log("found best %d after %d probes",Math.round(1e4*k.d)/1e4,P)),k.max-S.d<=e||(x=k.h/2,T.push(new rs(k.p.x-x,k.p.y-x,x,i)),T.push(new rs(k.p.x+x,k.p.y-x,x,i)),T.push(new rs(k.p.x-x,k.p.y+x,x,i)),T.push(new rs(k.p.x+x,k.p.y+x,x,i)),P+=4)}return r&&(console.log(`num probes: ${P}`),console.log(`best distance: ${S.d}`)),S.p}function ef(i,e){return e.max-i.max}function rs(i,e,r,o){this.p=new Xe(i,e),this.h=r,this.d=function(c,h){let d=!1,m=1/0;for(let g=0;g<h.length;g++){const x=h[g];for(let T=0,S=x.length,P=S-1;T<S;P=T++){const k=x[T],L=x[P];k.y>c.y!=L.y>c.y&&c.x<(L.x-k.x)*(c.y-k.y)/(L.y-k.y)+k.x&&(d=!d),m=Math.min(m,cu(c,k,L))}}return(d?1:-1)*Math.sqrt(m)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}const xc=Number.POSITIVE_INFINITY;function ih(i,e){return e[1]!==xc?function(r,o,c){let h=0,d=0;switch(o=Math.abs(o),c=Math.abs(c),r){case"top-right":case"top-left":case"top":d=c-7;break;case"bottom-right":case"bottom-left":case"bottom":d=7-c}switch(r){case"top-right":case"bottom-right":case"right":h=-o;break;case"top-left":case"bottom-left":case"left":h=o}return[h,d]}(i,e[0],e[1]):function(r,o){let c=0,h=0;o<0&&(o=0);const d=o/Math.sqrt(2);switch(r){case"top-right":case"top-left":h=d-7;break;case"bottom-right":case"bottom-left":h=7-d;break;case"bottom":h=7-o;break;case"top":h=o-7}switch(r){case"top-right":case"bottom-right":c=-d;break;case"top-left":case"bottom-left":c=d;break;case"left":c=o;break;case"right":c=-o}return[c,h]}(i,e[0])}function vc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function tf(i,e,r,o,c,h,d,m,g,x,T){let S=h.textMaxSize.evaluate(e,{});S===void 0&&(S=d);const P=i.layers[0].layout,k=P.get("icon-offset").evaluate(e,{},T),L=nh(r.horizontal),Z=d/24,q=i.tilePixelRatio*Z,re=i.tilePixelRatio*S/24,ce=i.tilePixelRatio*m,ee=i.tilePixelRatio*P.get("symbol-spacing"),ae=P.get("text-padding")*i.tilePixelRatio,xe=function(we,He,je,pt=1){const Ot=we.get("icon-padding").evaluate(He,{},je),qt=Ot&&Ot.values;return[qt[0]*pt,qt[1]*pt,qt[2]*pt,qt[3]*pt]}(P,e,T,i.tilePixelRatio),ye=P.get("text-max-angle")/180*Math.PI,Fe=P.get("text-rotation-alignment")!=="viewport"&&P.get("symbol-placement")!=="point",Ne=P.get("icon-rotation-alignment")==="map"&&P.get("symbol-placement")!=="point",ke=P.get("symbol-placement"),Ae=ee/2,Ee=P.get("icon-text-fit");let De;o&&Ee!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(De=ju(o,r.vertical,Ee,P.get("icon-text-fit-padding"),k,Z)),L&&(o=ju(o,L,Ee,P.get("icon-text-fit-padding"),k,Z)));const Pe=(we,He)=>{He.x<0||He.x>=ri||He.y<0||He.y>=ri||function(je,pt,Ot,qt,ni,ar,yi,Qt,ui,xi,Ei,Gi,ei,vi,Si,Li,qi,Zi,jt,hi,ft,er,bi,Ii,xr){const Pr=je.addToLineVertexArray(pt,Ot);let zr,dn,vr,lr,ji=0,fn=0,ta=0,vh=0,Pc=-1,zc=-1;const mn={};let bh=ci.exports(""),kc=0,Dc=0;if(Qt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[kc,Dc]=Qt.layout.get("text-offset").evaluate(ft,{},Ii).map(Xi=>Xi*gi):(kc=Qt.layout.get("text-radial-offset").evaluate(ft,{},Ii)*gi,Dc=xc),je.allowVerticalPlacement&&qt.vertical){const Xi=Qt.layout.get("text-rotate").evaluate(ft,{},Ii)+90;vr=new pl(ui,pt,xi,Ei,Gi,qt.vertical,ei,vi,Si,Xi),yi&&(lr=new pl(ui,pt,xi,Ei,Gi,yi,qi,Zi,Si,Xi))}if(ni){const Xi=Qt.layout.get("icon-rotate").evaluate(ft,{}),Hr=Qt.layout.get("icon-text-fit")!=="none",ia=eh(ni,Xi,bi,Hr),ra=yi?eh(yi,Xi,bi,Hr):void 0;dn=new pl(ui,pt,xi,Ei,Gi,ni,qi,Zi,!1,Xi),ji=4*ia.length;const Eh=je.iconSizeData;let So=null;Eh.kind==="source"?(So=[pn*Qt.layout.get("icon-size").evaluate(ft,{})],So[0]>Gn&&at(`${je.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Eh.kind==="composite"&&(So=[pn*er.compositeIconSizes[0].evaluate(ft,{},Ii),pn*er.compositeIconSizes[1].evaluate(ft,{},Ii)],(So[0]>Gn||So[1]>Gn)&&at(`${je.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),je.addSymbols(je.icon,ia,So,hi,jt,ft,a.WritingMode.none,pt,Pr.lineStartIndex,Pr.lineLength,-1,Ii),Pc=je.icon.placedSymbolArray.length-1,ra&&(fn=4*ra.length,je.addSymbols(je.icon,ra,So,hi,jt,ft,a.WritingMode.vertical,pt,Pr.lineStartIndex,Pr.lineLength,-1,Ii),zc=je.icon.placedSymbolArray.length-1)}const wh=Object.keys(qt.horizontal);for(const Xi of wh){const Hr=qt.horizontal[Xi];if(!zr){bh=ci.exports(Hr.text);const ra=Qt.layout.get("text-rotate").evaluate(ft,{},Ii);zr=new pl(ui,pt,xi,Ei,Gi,Hr,ei,vi,Si,ra)}const ia=Hr.positionedLines.length===1;if(ta+=rh(je,pt,Hr,ar,Qt,Si,ft,Li,Pr,qt.vertical?a.WritingMode.horizontal:a.WritingMode.horizontalOnly,ia?wh:[Xi],mn,Pc,er,Ii),ia)break}qt.vertical&&(vh+=rh(je,pt,qt.vertical,ar,Qt,Si,ft,Li,Pr,a.WritingMode.vertical,["vertical"],mn,zc,er,Ii));const mf=zr?zr.boxStartIndex:je.collisionBoxArray.length,gf=zr?zr.boxEndIndex:je.collisionBoxArray.length,_f=vr?vr.boxStartIndex:je.collisionBoxArray.length,yf=vr?vr.boxEndIndex:je.collisionBoxArray.length,xf=dn?dn.boxStartIndex:je.collisionBoxArray.length,vf=dn?dn.boxEndIndex:je.collisionBoxArray.length,bf=lr?lr.boxStartIndex:je.collisionBoxArray.length,wf=lr?lr.boxEndIndex:je.collisionBoxArray.length;let kr=-1;const _l=(Xi,Hr)=>Xi&&Xi.circleDiameter?Math.max(Xi.circleDiameter,Hr):Hr;kr=_l(zr,kr),kr=_l(vr,kr),kr=_l(dn,kr),kr=_l(lr,kr);const Th=kr>-1?1:0;Th&&(kr*=xr/gi),je.glyphOffsetArray.length>=ns.MAX_GLYPHS&&at("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),ft.sortKey!==void 0&&je.addToSortKeyRanges(je.symbolInstances.length,ft.sortKey),je.symbolInstances.emplaceBack(pt.x,pt.y,mn.right>=0?mn.right:-1,mn.center>=0?mn.center:-1,mn.left>=0?mn.left:-1,mn.vertical||-1,Pc,zc,bh,mf,gf,_f,yf,xf,vf,bf,wf,xi,ta,vh,ji,fn,Th,0,ei,kc,Dc,kr)}(i,He,we,r,o,c,De,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,q,[ae,ae,ae,ae],Fe,g,ce,xe,Ne,k,e,h,x,T,d)};if(ke==="line")for(const we of Qu(e.geometry,0,0,ri,ri)){const He=Kd(we,ee,ye,r.vertical||L,o,24,re,i.overscaling,ri);for(const je of He){const pt=L;pt&&rf(i,pt.text,Ae,je)||Pe(we,je)}}else if(ke==="line-center"){for(const we of e.geometry)if(we.length>1){const He=Hd(we,ye,r.vertical||L,o,24,re);He&&Pe(we,He)}}else if(e.type==="Polygon")for(const we of ac(e.geometry,0)){const He=Qd(we,16);Pe(we[0],new Nn(He.x,He.y,0))}else if(e.type==="LineString")for(const we of e.geometry)Pe(we,new Nn(we[0].x,we[0].y,0));else if(e.type==="Point")for(const we of e.geometry)for(const He of we)Pe([He],new Nn(He.x,He.y,0))}const Gn=32640;function rh(i,e,r,o,c,h,d,m,g,x,T,S,P,k,L){const Z=function(ce,ee,ae,xe,ye,Fe,Ne,ke){const Ae=xe.layout.get("text-rotate").evaluate(Fe,{})*Math.PI/180,Ee=[];for(const De of ee.positionedLines)for(const Pe of De.positionedGlyphs){if(!Pe.rect)continue;const we=Pe.rect||{};let He=4,je=!0,pt=1,Ot=0;const qt=(ye||ke)&&Pe.vertical,ni=Pe.metrics.advance*Pe.scale/2;if(ke&&ee.verticalizable){const jt=(Pe.scale-1)*gi,hi=(gi-Pe.metrics.width*Pe.scale)/2;Ot=De.lineOffset/2-(Pe.imageName?-hi:jt)}if(Pe.imageName){const jt=Ne[Pe.imageName];je=jt.sdf,pt=jt.pixelRatio,He=1/pt}const ar=ye?[Pe.x+ni,Pe.y]:[0,0];let yi=ye?[0,0]:[Pe.x+ni+ae[0],Pe.y+ae[1]-Ot],Qt=[0,0];qt&&(Qt=yi,yi=[0,0]);const ui=(Pe.metrics.left-He)*Pe.scale-ni+yi[0],xi=(-Pe.metrics.top-He)*Pe.scale+yi[1],Ei=ui+we.w*Pe.scale/pt,Gi=xi+we.h*Pe.scale/pt,ei=new Xe(ui,xi),vi=new Xe(Ei,xi),Si=new Xe(ui,Gi),Li=new Xe(Ei,Gi);if(qt){const jt=new Xe(-ni,ni-sl),hi=-Math.PI/2,ft=12-ni,er=new Xe(22-ft,-(Pe.imageName?ft:0)),bi=new Xe(...Qt);ei._rotateAround(hi,jt)._add(er)._add(bi),vi._rotateAround(hi,jt)._add(er)._add(bi),Si._rotateAround(hi,jt)._add(er)._add(bi),Li._rotateAround(hi,jt)._add(er)._add(bi)}if(Ae){const jt=Math.sin(Ae),hi=Math.cos(Ae),ft=[hi,-jt,jt,hi];ei._matMult(ft),vi._matMult(ft),Si._matMult(ft),Li._matMult(ft)}const qi=new Xe(0,0),Zi=new Xe(0,0);Ee.push({tl:ei,tr:vi,bl:Si,br:Li,tex:we,writingMode:ee.writingMode,glyphOffset:ar,sectionIndex:Pe.sectionIndex,isSDF:je,pixelOffsetTL:qi,pixelOffsetBR:Zi,minFontScaleX:0,minFontScaleY:0})}return Ee}(0,r,m,c,h,d,o,i.allowVerticalPlacement),q=i.textSizeData;let re=null;q.kind==="source"?(re=[pn*c.layout.get("text-size").evaluate(d,{})],re[0]>Gn&&at(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):q.kind==="composite"&&(re=[pn*k.compositeTextSizes[0].evaluate(d,{},L),pn*k.compositeTextSizes[1].evaluate(d,{},L)],(re[0]>Gn||re[1]>Gn)&&at(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,Z,re,m,h,d,x,e,g.lineStartIndex,g.lineLength,P,L);for(const ce of T)S[ce]=i.text.placedSymbolArray.length-1;return 4*Z.length}function nh(i){for(const e in i)return i[e];return null}function rf(i,e,r,o){const c=i.compareText;if(e in c){const h=c[e];for(let d=h.length-1;d>=0;d--)if(o.dist(h[d])<r)return!0}else c[e]=[];return c[e].push(o),!1}const nf=Un.VectorTileFeature.types,of=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function dl(i,e,r,o,c,h,d,m,g,x,T,S,P){const k=m?Math.min(Gn,Math.round(m[0])):0,L=m?Math.min(Gn,Math.round(m[1])):0;i.emplaceBack(e,r,Math.round(32*o),Math.round(32*c),h,d,(k<<1)+(g?1:0),L,16*x,16*T,256*S,256*P)}function bc(i,e,r){i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r)}function sf(i){for(const e of i.sections)if(Na(e.text))return!0;return!1}class wc{constructor(e){this.layoutVertexArray=new _r,this.indexArray=new zi,this.programConfigurations=e,this.segments=new dt,this.dynamicLayoutVertexArray=new nr,this.opacityVertexArray=new yr,this.placedSymbolArray=new be}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,o,c){this.isEmpty()||(o&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ad.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Md.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,of,!0),this.opacityVertexBuffer.itemSize=1),(o||c)&&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())}}Oe("SymbolBuffers",wc);class Tc{constructor(e,r,o){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new o,this.segments=new dt,this.collisionVertexArray=new Yi}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Pd.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Oe("CollisionBuffers",Tc);class ns{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(d=>d.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=tc([]),this.placementViewportMatrix=tc([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Xu(this.zoom,r["text-size"]),this.iconSizeData=Xu(this.zoom,r["icon-size"]);const o=this.layers[0].layout,c=o.get("symbol-sort-key"),h=o.get("symbol-z-order");this.canOverlap=Sc(o,"text-overlap","text-allow-overlap")!=="never"||Sc(o,"icon-overlap","icon-allow-overlap")!=="never"||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=h!=="viewport-y"&&!c.isConstant(),this.sortFeaturesByY=(h==="viewport-y"||h==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,o.get("symbol-placement")==="point"&&(this.writingModes=o.get("text-writing-mode").map(d=>a.WritingMode[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=e.sourceID}createArrays(){this.text=new wc(new vo(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new wc(new vo(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Ce,this.lineVertexArray=new Be,this.symbolInstances=new Re}calculateGlyphDependencies(e,r,o,c,h){for(let d=0;d<e.length;d++)if(r[e.charCodeAt(d)]=!0,(o||c)&&h){const m=Js[e.charAt(d)];m&&(r[m.charCodeAt(0)]=!0)}}populate(e,r,o){const c=this.layers[0],h=c.layout,d=h.get("text-font"),m=h.get("text-field"),g=h.get("icon-image"),x=(m.value.kind!=="constant"||m.value.value instanceof W&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),T=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,S=h.get("symbol-sort-key");if(this.features=[],!x&&!T)return;const P=r.iconDependencies,k=r.glyphDependencies,L=r.availableImages,Z=new Nt(this.zoom);for(const{feature:q,id:re,index:ce,sourceLayerIndex:ee}of e){const ae=c._featureFilter.needGeometry,xe=wo(q,ae);if(!c._featureFilter.filter(Z,xe,o))continue;let ye,Fe;if(ae||(xe.geometry=bo(q)),x){const ke=c.getValueAndResolveTokens("text-field",xe,o,L),Ae=W.factory(ke);sf(Ae)&&(this.hasRTLText=!0),(!this.hasRTLText||_o()==="unavailable"||this.hasRTLText&&Ji.isParsed())&&(ye=kd(Ae,c,xe))}if(T){const ke=c.getValueAndResolveTokens("icon-image",xe,o,L);Fe=ke instanceof J?ke:J.fromString(ke)}if(!ye&&!Fe)continue;const Ne=this.sortFeaturesByKey?S.evaluate(xe,{},o):void 0;if(this.features.push({id:re,text:ye,icon:Fe,index:ce,sourceLayerIndex:ee,geometry:xe.geometry,properties:q.properties,type:nf[q.type],sortKey:Ne}),Fe&&(P[Fe.name]=!0),ye){const ke=d.evaluate(xe,{},o).join(","),Ae=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.WritingMode.vertical)>=0;for(const Ee of ye.sections)if(Ee.image)P[Ee.image.name]=!0;else{const De=jo(ye.toString()),Pe=Ee.fontStack||ke,we=k[Pe]=k[Pe]||{};this.calculateGlyphDependencies(Ee.text,we,Ae,this.allowVerticalPlacement,De)}}}h.get("symbol-placement")==="line"&&(this.features=function(q){const re={},ce={},ee=[];let ae=0;function xe(ke){ee.push(q[ke]),ae++}function ye(ke,Ae,Ee){const De=ce[ke];return delete ce[ke],ce[Ae]=De,ee[De].geometry[0].pop(),ee[De].geometry[0]=ee[De].geometry[0].concat(Ee[0]),De}function Fe(ke,Ae,Ee){const De=re[Ae];return delete re[Ae],re[ke]=De,ee[De].geometry[0].shift(),ee[De].geometry[0]=Ee[0].concat(ee[De].geometry[0]),De}function Ne(ke,Ae,Ee){const De=Ee?Ae[0][Ae[0].length-1]:Ae[0][0];return`${ke}:${De.x}:${De.y}`}for(let ke=0;ke<q.length;ke++){const Ae=q[ke],Ee=Ae.geometry,De=Ae.text?Ae.text.toString():null;if(!De){xe(ke);continue}const Pe=Ne(De,Ee),we=Ne(De,Ee,!0);if(Pe in ce&&we in re&&ce[Pe]!==re[we]){const He=Fe(Pe,we,Ee),je=ye(Pe,we,ee[He].geometry);delete re[Pe],delete ce[we],ce[Ne(De,ee[je].geometry,!0)]=je,ee[He].geometry=null}else Pe in ce?ye(Pe,we,Ee):we in re?Fe(Pe,we,Ee):(xe(ke),re[Pe]=ae-1,ce[we]=ae-1)}return ee.filter(ke=>ke.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((q,re)=>q.sortKey-re.sortKey)}update(e,r,o){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,o),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,o))}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,r){const o=this.lineVertexArray.length;if(e.segment!==void 0){let c=e.dist(r[e.segment+1]),h=e.dist(r[e.segment]);const d={};for(let m=e.segment+1;m<r.length;m++)d[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:c},m<r.length-1&&(c+=r[m+1].dist(r[m]));for(let m=e.segment||0;m>=0;m--)d[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:h},m>0&&(h+=r[m-1].dist(r[m]));for(let m=0;m<r.length;m++){const g=d[m];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(e,r,o,c,h,d,m,g,x,T,S,P){const k=e.indexArray,L=e.layoutVertexArray,Z=e.segments.prepareSegment(4*r.length,L,k,this.canOverlap?d.sortKey:void 0),q=this.glyphOffsetArray.length,re=Z.vertexLength,ce=this.allowVerticalPlacement&&m===a.WritingMode.vertical?Math.PI/2:0,ee=d.text&&d.text.sections;for(let ae=0;ae<r.length;ae++){const{tl:xe,tr:ye,bl:Fe,br:Ne,tex:ke,pixelOffsetTL:Ae,pixelOffsetBR:Ee,minFontScaleX:De,minFontScaleY:Pe,glyphOffset:we,isSDF:He,sectionIndex:je}=r[ae],pt=Z.vertexLength,Ot=we[1];dl(L,g.x,g.y,xe.x,Ot+xe.y,ke.x,ke.y,o,He,Ae.x,Ae.y,De,Pe),dl(L,g.x,g.y,ye.x,Ot+ye.y,ke.x+ke.w,ke.y,o,He,Ee.x,Ae.y,De,Pe),dl(L,g.x,g.y,Fe.x,Ot+Fe.y,ke.x,ke.y+ke.h,o,He,Ae.x,Ee.y,De,Pe),dl(L,g.x,g.y,Ne.x,Ot+Ne.y,ke.x+ke.w,ke.y+ke.h,o,He,Ee.x,Ee.y,De,Pe),bc(e.dynamicLayoutVertexArray,g,ce),k.emplaceBack(pt,pt+1,pt+2),k.emplaceBack(pt+1,pt+2,pt+3),Z.vertexLength+=4,Z.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(we[0]),ae!==r.length-1&&je===r[ae+1].sectionIndex||e.programConfigurations.populatePaintArrays(L.length,d,d.index,{},P,ee&&ee[je])}e.placedSymbolArray.emplaceBack(g.x,g.y,q,this.glyphOffsetArray.length-q,re,x,T,g.segment,o?o[0]:0,o?o[1]:0,c[0],c[1],m,0,!1,0,S)}_addCollisionDebugVertex(e,r,o,c,h,d){return r.emplaceBack(0,0),e.emplaceBack(o.x,o.y,c,h,Math.round(d.x),Math.round(d.y))}addCollisionDebugVertices(e,r,o,c,h,d,m){const g=h.segments.prepareSegment(4,h.layoutVertexArray,h.indexArray),x=g.vertexLength,T=h.layoutVertexArray,S=h.collisionVertexArray,P=m.anchorX,k=m.anchorY;this._addCollisionDebugVertex(T,S,d,P,k,new Xe(e,r)),this._addCollisionDebugVertex(T,S,d,P,k,new Xe(o,r)),this._addCollisionDebugVertex(T,S,d,P,k,new Xe(o,c)),this._addCollisionDebugVertex(T,S,d,P,k,new Xe(e,c)),g.vertexLength+=4;const L=h.indexArray;L.emplaceBack(x,x+1),L.emplaceBack(x+1,x+2),L.emplaceBack(x+2,x+3),L.emplaceBack(x+3,x),g.primitiveLength+=4}addDebugCollisionBoxes(e,r,o,c){for(let h=e;h<r;h++){const d=this.collisionBoxArray.get(h);this.addCollisionDebugVertices(d.x1,d.y1,d.x2,d.y2,c?this.textCollisionBox:this.iconCollisionBox,d.anchorPoint,o)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Tc(Xr,Du.members,Ar),this.iconCollisionBox=new Tc(Xr,Du.members,Ar);for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,o,c,h,d,m,g,x){const T={};for(let S=r;S<o;S++){const P=e.get(S);T.textBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.textFeatureIndex=P.featureIndex;break}for(let S=c;S<h;S++){const P=e.get(S);T.verticalTextBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.verticalTextFeatureIndex=P.featureIndex;break}for(let S=d;S<m;S++){const P=e.get(S);T.iconBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.iconFeatureIndex=P.featureIndex;break}for(let S=g;S<x;S++){const P=e.get(S);T.verticalIconBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.verticalIconFeatureIndex=P.featureIndex;break}return T}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const o=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,o.textBoxStartIndex,o.textBoxEndIndex,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o.iconBoxStartIndex,o.iconBoxEndIndex,o.verticalIconBoxStartIndex,o.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,r){const o=e.placedSymbolArray.get(r),c=o.vertexStartIndex+4*o.numGlyphs;for(let h=o.vertexStartIndex;h<c;h+=4)e.indexArray.emplaceBack(h,h+1,h+2),e.indexArray.emplaceBack(h+1,h+2,h+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),o=Math.cos(e),c=[],h=[],d=[];for(let m=0;m<this.symbolInstances.length;++m){d.push(m);const g=this.symbolInstances.get(m);c.push(0|Math.round(r*g.anchorX+o*g.anchorY)),h.push(g.featureIndex)}return d.sort((m,g)=>c[m]-c[g]||h[g]-h[m]),d}addToSortKeyRanges(e,r){const o=this.sortKeyRanges[this.sortKeyRanges.length-1];o&&o.sortKey===r?o.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,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 r of this.symbolInstanceIndexes){const o=this.symbolInstances.get(r);this.featureSortOrder.push(o.featureIndex),[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((c,h,d)=>{c>=0&&d.indexOf(c)===h&&this.addIndicesForPlacedSymbol(this.text,c)}),o.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,o.verticalPlacedTextSymbolIndex),o.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.placedIconSymbolIndex),o.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Oe("SymbolBucket",ns,{omit:["layers","collisionBoxArray","features","compareText"]}),ns.MAX_GLYPHS=65535,ns.addDynamicAttributes=bc;const af=new mi({"symbol-placement":new Ze(_e.layout_symbol["symbol-placement"]),"symbol-spacing":new Ze(_e.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ze(_e.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ye(_e.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ze(_e.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ze(_e.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ze(_e.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ze(_e.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ze(_e.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ze(_e.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ye(_e.layout_symbol["icon-size"]),"icon-text-fit":new Ze(_e.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ze(_e.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ye(_e.layout_symbol["icon-image"]),"icon-rotate":new Ye(_e.layout_symbol["icon-rotate"]),"icon-padding":new Ye(_e.layout_symbol["icon-padding"]),"icon-keep-upright":new Ze(_e.layout_symbol["icon-keep-upright"]),"icon-offset":new Ye(_e.layout_symbol["icon-offset"]),"icon-anchor":new Ye(_e.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ze(_e.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ze(_e.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ze(_e.layout_symbol["text-rotation-alignment"]),"text-field":new Ye(_e.layout_symbol["text-field"]),"text-font":new Ye(_e.layout_symbol["text-font"]),"text-size":new Ye(_e.layout_symbol["text-size"]),"text-max-width":new Ye(_e.layout_symbol["text-max-width"]),"text-line-height":new Ze(_e.layout_symbol["text-line-height"]),"text-letter-spacing":new Ye(_e.layout_symbol["text-letter-spacing"]),"text-justify":new Ye(_e.layout_symbol["text-justify"]),"text-radial-offset":new Ye(_e.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ze(_e.layout_symbol["text-variable-anchor"]),"text-anchor":new Ye(_e.layout_symbol["text-anchor"]),"text-max-angle":new Ze(_e.layout_symbol["text-max-angle"]),"text-writing-mode":new Ze(_e.layout_symbol["text-writing-mode"]),"text-rotate":new Ye(_e.layout_symbol["text-rotate"]),"text-padding":new Ze(_e.layout_symbol["text-padding"]),"text-keep-upright":new Ze(_e.layout_symbol["text-keep-upright"]),"text-transform":new Ye(_e.layout_symbol["text-transform"]),"text-offset":new Ye(_e.layout_symbol["text-offset"]),"text-allow-overlap":new Ze(_e.layout_symbol["text-allow-overlap"]),"text-overlap":new Ze(_e.layout_symbol["text-overlap"]),"text-ignore-placement":new Ze(_e.layout_symbol["text-ignore-placement"]),"text-optional":new Ze(_e.layout_symbol["text-optional"])});var Ec={paint:new mi({"icon-opacity":new Ye(_e.paint_symbol["icon-opacity"]),"icon-color":new Ye(_e.paint_symbol["icon-color"]),"icon-halo-color":new Ye(_e.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ye(_e.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ye(_e.paint_symbol["icon-halo-blur"]),"icon-translate":new Ze(_e.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ze(_e.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ye(_e.paint_symbol["text-opacity"]),"text-color":new Ye(_e.paint_symbol["text-color"],{runtimeType:fi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Ye(_e.paint_symbol["text-halo-color"]),"text-halo-width":new Ye(_e.paint_symbol["text-halo-width"]),"text-halo-blur":new Ye(_e.paint_symbol["text-halo-blur"]),"text-translate":new Ze(_e.paint_symbol["text-translate"]),"text-translate-anchor":new Ze(_e.paint_symbol["text-translate-anchor"])}),layout:af};class oh{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:$r,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.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}}Oe("FormatSectionOverride",oh,{omit:["defaultValue"]});class fl extends gr{constructor(e){super(e,Ec)}recalculate(e,r){if(super.recalculate(e,r),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 o=this.layout.get("text-writing-mode");if(o){const c=[];for(const h of o)c.indexOf(h)<0&&c.push(h);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,o,c){const h=this.layout.get(e).evaluate(r,{},o,c),d=this._unevaluatedLayout._values[e];return d.isDataDriven()||ro(d.value)||!h?h:function(m,g){return g.replace(/{([^{}]+)}/g,(x,T)=>T in m?String(m[T]):"")}(r.properties,h)}createBucket(e){return new ns(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Ec.paint.overridableProperties){if(!fl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),o=new oh(r),c=new Uo(o,r.property.specification);let h=null;h=r.value.kind==="constant"||r.value.kind==="source"?new oo("source",c):new Ss("composite",c,r.value.zoomStops),this.paint._values[e]=new mr(r.property,h,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,o){return!(!this.layout||r.isDataDriven()||o.isDataDriven())&&fl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const o=e.get("text-field"),c=Ec.paint.properties[r];let h=!1;const d=m=>{for(const g of m)if(c.overrides&&c.overrides.hasOverride(g))return void(h=!0)};if(o.value.kind==="constant"&&o.value.value instanceof W)d(o.value.value.sections);else if(o.value.kind==="source"){const m=x=>{h||(x instanceof qe&&he(x.value)===oi?d(x.value.sections):x instanceof Oo?d(x.sections):x.eachChild(m))},g=o.value;g._styleExpression&&m(g._styleExpression.expression)}return h}}function Sc(i,e,r){let o="never";const c=i.get(e);return c?o=c:i.get(r)&&(o="always"),o}var lf={paint:new mi({"background-color":new Ze(_e.paint_background["background-color"]),"background-pattern":new Fs(_e.paint_background["background-pattern"]),"background-opacity":new Ze(_e.paint_background["background-opacity"])})},cf={paint:new mi({"raster-opacity":new Ze(_e.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ze(_e.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ze(_e.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ze(_e.paint_raster["raster-brightness-max"]),"raster-saturation":new Ze(_e.paint_raster["raster-saturation"]),"raster-contrast":new Ze(_e.paint_raster["raster-contrast"]),"raster-resampling":new Ze(_e.paint_raster["raster-resampling"]),"raster-fade-duration":new Ze(_e.paint_raster["raster-fade-duration"])})};class uf extends gr{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.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")}}const hf={circle:class extends gr{constructor(i){super(i,Vp)}createBucket(i){return new Yl(i)}queryRadius(i){const e=i;return Ns("circle-radius",this,e)+Ns("circle-stroke-width",this,e)+Ja(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,o,c,h,d,m){const g=Ya(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),h.angle,d),x=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),T=this.paint.get("circle-pitch-alignment")==="map",S=T?g:function(k,L){return k.map(Z=>gu(Z,L))}(g,m),P=T?x*d:x;for(const k of o)for(const L of k){const Z=T?L:gu(L,m);let q=P;const re=Qa([],[L.x,L.y,0,1],m);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?q*=re[3]/h.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(q*=h.cameraToCenterDistance/re[3]),Bp(S,Z,q))return!0}return!1}},heatmap:class extends gr{constructor(i){super(i,Gp),this._updateColorRamp()}createBucket(i){return new _u(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=xu({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends gr{constructor(i){super(i,qp)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends gr{constructor(i){super(i,sd)}recalculate(i,e){super.recalculate(i,e);const r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new uc(i)}queryRadius(){return Ja(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,o,c,h,d){return lu(Ya(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),h.angle,d),o)}isTileClipped(){return!0}},"fill-extrusion":class extends gr{constructor(i){super(i,vd)}createBucket(i){return new pc(i)}queryRadius(){return Ja(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,o,c,h,d,m){const g=Ya(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),h.angle,d),x=this.paint.get("fill-extrusion-height").evaluate(e,r),T=this.paint.get("fill-extrusion-base").evaluate(e,r),S=function(k,L,Z,q){const re=[];for(const ce of k){const ee=[ce.x,ce.y,0,1];Qa(ee,ee,L),re.push(new Xe(ee[0]/ee[3],ee[1]/ee[3]))}return re}(g,m),P=function(k,L,Z,q){const re=[],ce=[],ee=q[8]*L,ae=q[9]*L,xe=q[10]*L,ye=q[11]*L,Fe=q[8]*Z,Ne=q[9]*Z,ke=q[10]*Z,Ae=q[11]*Z;for(const Ee of k){const De=[],Pe=[];for(const we of Ee){const He=we.x,je=we.y,pt=q[0]*He+q[4]*je+q[12],Ot=q[1]*He+q[5]*je+q[13],qt=q[2]*He+q[6]*je+q[14],ni=q[3]*He+q[7]*je+q[15],ar=qt+xe,yi=ni+ye,Qt=pt+Fe,ui=Ot+Ne,xi=qt+ke,Ei=ni+Ae,Gi=new Xe((pt+ee)/yi,(Ot+ae)/yi);Gi.z=ar/yi,De.push(Gi);const ei=new Xe(Qt/Ei,ui/Ei);ei.z=xi/Ei,Pe.push(ei)}re.push(De),ce.push(Pe)}return[re,ce]}(o,T,x,m);return function(k,L,Z){let q=1/0;lu(Z,L)&&(q=Au(Z,L[0]));for(let re=0;re<L.length;re++){const ce=L[re],ee=k[re];for(let ae=0;ae<ce.length-1;ae++){const xe=ce[ae],ye=[xe,ce[ae+1],ee[ae+1],ee[ae],xe];au(Z,ye)&&(q=Math.min(q,Au(Z,ye)))}}return q!==1/0&&q}(P[0],P[1],S)}},line:class extends gr{constructor(i){super(i,Pu),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Yn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,e){super.recalculate(i,e),this.paint._values["line-floorwidth"]=zu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new dc(i)}queryRadius(i){const e=i,r=ku(Ns("line-width",this,e),Ns("line-gap-width",this,e)),o=Ns("line-offset",this,e);return r/2+Math.abs(o)+Ja(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,r,o,c,h,d){const m=Ya(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),h.angle,d),g=d/2*ku(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),x=this.paint.get("line-offset").evaluate(e,r);return x&&(o=function(T,S){const P=[];for(let k=0;k<T.length;k++){const L=T[k],Z=[];for(let q=0;q<L.length;q++){const re=L[q-1],ce=L[q],ee=L[q+1],ae=q===0?new Xe(0,0):ce.sub(re)._unit()._perp(),xe=q===L.length-1?new Xe(0,0):ee.sub(ce)._unit()._perp(),ye=ae._add(xe)._unit(),Fe=ye.x*xe.x+ye.y*xe.y;Fe!==0&&ye._mult(1/Fe),Z.push(ye._mult(S)._add(ce))}P.push(Z)}return P}(o,x*d)),function(T,S,P){for(let k=0;k<S.length;k++){const L=S[k];if(T.length>=3){for(let Z=0;Z<L.length;Z++)if(Jo(T,L[Z]))return!0}if(Fp(T,L,P))return!0}return!1}(m,o,g)}isTileClipped(){return!0}},symbol:fl,background:class extends gr{constructor(i){super(i,lf)}},raster:class extends gr{constructor(i){super(i,cf)}}};class pf{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel!="undefined"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const sh=63710088e-1;class Wt{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Wt(Ge(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,o=this.lat*r,c=e.lat*r,h=Math.sin(o)*Math.sin(c)+Math.cos(o)*Math.cos(c)*Math.cos((e.lng-this.lng)*r);return sh*Math.acos(Math.min(h,1))}toBounds(e=0){const r=360*e/40075017,o=r/Math.cos(Math.PI/180*this.lat);return new Eo(new Wt(this.lng-o,this.lat-r),new Wt(this.lng+o,this.lat+r))}static convert(e){if(e instanceof Wt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Wt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Wt(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>]")}}class Eo{constructor(e,r){e&&(r?this.setSouthWest(e).setNorthEast(r):e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof Wt?new Wt(e.lng,e.lat):Wt.convert(e),this}setSouthWest(e){return this._sw=e instanceof Wt?new Wt(e.lng,e.lat):Wt.convert(e),this}extend(e){const r=this._sw,o=this._ne;let c,h;if(e instanceof Wt)c=e,h=e;else{if(!(e instanceof Eo))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Eo.convert(e)):this.extend(Wt.convert(e)):this;if(c=e._sw,h=e._ne,!c||!h)return this}return r||o?(r.lng=Math.min(c.lng,r.lng),r.lat=Math.min(c.lat,r.lat),o.lng=Math.max(h.lng,o.lng),o.lat=Math.max(h.lat,o.lat)):(this._sw=new Wt(c.lng,c.lat),this._ne=new Wt(h.lng,h.lat)),this}getCenter(){return new Wt((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 Wt(this.getWest(),this.getNorth())}getSouthEast(){return new Wt(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:r,lat:o}=Wt.convert(e);let c=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&c}static convert(e){return e instanceof Eo?e:e&&new Eo(e)}}const ah=2*Math.PI*sh;function lh(i){return ah*Math.cos(i*Math.PI/180)}function ch(i){return(180+i)/360}function uh(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function hh(i,e){return i/lh(e)}function Ic(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class ml{constructor(e,r,o=0){this.x=+e,this.y=+r,this.z=+o}static fromLngLat(e,r=0){const o=Wt.convert(e);return new ml(ch(o.lng),uh(o.lat),hh(r,o.lat))}toLngLat(){return new Wt(360*this.x-180,Ic(this.y))}toAltitude(){return this.z*lh(Ic(this.y))}meterInMercatorCoordinateUnits(){return 1/ah*(e=Ic(this.y),1/Math.cos(e*Math.PI/180));var e}}function ph(i,e,r){var o=2*Math.PI*6378137/256/Math.pow(2,r);return[i*o-2*Math.PI*6378137/2,e*o-2*Math.PI*6378137/2]}class Cc{constructor(e,r,o){if(e<0||e>25||o<0||o>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${o}, 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=r,this.y=o,this.key=Qs(0,e,e,r,o)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,o){const c=(d=this.y,m=this.z,g=ph(256*(h=this.x),256*(d=Math.pow(2,m)-d-1),m),x=ph(256*(h+1),256*(d+1),m),g[0]+","+g[1]+","+x[0]+","+x[1]);var h,d,m,g,x;const T=function(S,P,k){let L,Z="";for(let q=S;q>0;q--)L=1<<q-1,Z+=(P&L?1:0)+(k&L?2:0);return Z}(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(o==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,T).replace(/{bbox-epsg-3857}/g,c)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new Xe((e.x*r-this.x)*ri,(e.y*r-this.y)*ri)}toString(){return`${this.z}/${this.x}/${this.y}`}}class dh{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Qs(e,r.z,r.z,r.x,r.y)}}class sr{constructor(e,r,o,c,h){if(e<o)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${o}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Cc(o,+c,+h),this.key=Qs(r,e,o,c,h)}clone(){return new sr(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 r=this.canonical.z-e;return e>this.canonical.z?new sr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new sr(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const o=this.canonical.z-e;return e>this.canonical.z?Qs(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Qs(this.wrap*+r,e,e,this.canonical.x>>o,this.canonical.y>>o)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new sr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,o=2*this.canonical.x,c=2*this.canonical.y;return[new sr(r,this.wrap,r,o,c),new sr(r,this.wrap,r,o+1,c),new sr(r,this.wrap,r,o,c+1),new sr(r,this.wrap,r,o+1,c+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 sr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new sr(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 dh(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new ml(e.x-this.wrap,e.y))}}function Qs(i,e,r,o,c){(i*=2)<0&&(i=-1*i-1);const h=1<<r;return(h*h*i+h*c+o).toString(36)+r.toString(36)+e.toString(36)}Oe("CanonicalTileID",Cc),Oe("OverscaledTileID",sr,{omit:["posMatrix"]});class fh{constructor(e,r,o){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(o&&o!=="mapbox"&&o!=="terrarium")return void at(`"${o}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;const c=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=o||"mapbox";for(let h=0;h<c;h++)this.data[this._idx(-1,h)]=this.data[this._idx(0,h)],this.data[this._idx(c,h)]=this.data[this._idx(c-1,h)],this.data[this._idx(h,-1)]=this.data[this._idx(h,0)],this.data[this._idx(h,c)]=this.data[this._idx(h,c-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(c,-1)]=this.data[this._idx(c-1,0)],this.data[this._idx(-1,c)]=this.data[this._idx(0,c-1)],this.data[this._idx(c,c)]=this.data[this._idx(c-1,c-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let h=0;h<c;h++)for(let d=0;d<c;d++){const m=this.get(h,d);m>this.max&&(this.max=m),m<this.min&&(this.min=m)}}get(e,r){const o=new Uint8Array(this.data.buffer),c=4*this._idx(e,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(o[c],o[c+1],o[c+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}_unpackMapbox(e,r,o){return(256*e*256+256*r+o)/10-1e4}_unpackTerrarium(e,r,o){return 256*e+r+o/256-32768}getPixels(){return new or({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,o){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let c=r*this.dim,h=r*this.dim+this.dim,d=o*this.dim,m=o*this.dim+this.dim;switch(r){case-1:c=h-1;break;case 1:h=c+1}switch(o){case-1:d=m-1;break;case 1:m=d+1}const g=-r*this.dim,x=-o*this.dim;for(let T=d;T<m;T++)for(let S=c;S<h;S++)this.data[this._idx(S,T)]=e.data[this._idx(S+g,T+x)]}}Oe("DEMData",fh);class mh{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const o=e[r];this._stringToNumber[o]=r,this._numberToString[r]=o}}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 gh{constructor(e,r,o,c,h){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=o,e._y=c,this.properties=e.properties,this.id=h}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class _h{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new go(ri,16,0),this.grid3D=new go(ri,16,0),this.featureIndexArray=new ht,this.promoteId=r}insert(e,r,o,c,h,d){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,c,h);const g=d?this.grid3D:this.grid;for(let x=0;x<r.length;x++){const T=r[x],S=[1/0,1/0,-1/0,-1/0];for(let P=0;P<T.length;P++){const k=T[P];S[0]=Math.min(S[0],k.x),S[1]=Math.min(S[1],k.y),S[2]=Math.max(S[2],k.x),S[3]=Math.max(S[3],k.y)}S[0]<ri&&S[1]<ri&&S[2]>=0&&S[3]>=0&&g.insert(m,S[0],S[1],S[2],S[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Un.VectorTile(new fc(this.rawTileData)).layers,this.sourceLayerCoder=new mh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,o,c){this.loadVTLayers();const h=e.params||{},d=ri/e.tileSize/e.scale,m=Go(h.filter),g=e.queryGeometry,x=e.queryPadding*d,T=xh(g),S=this.grid.query(T.minX-x,T.minY-x,T.maxX+x,T.maxY+x),P=xh(e.cameraQueryGeometry),k=this.grid3D.query(P.minX-x,P.minY-x,P.maxX+x,P.maxY+x,(q,re,ce,ee)=>function(ae,xe,ye,Fe,Ne){for(const Ae of ae)if(xe<=Ae.x&&ye<=Ae.y&&Fe>=Ae.x&&Ne>=Ae.y)return!0;const ke=[new Xe(xe,ye),new Xe(xe,Ne),new Xe(Fe,Ne),new Xe(Fe,ye)];if(ae.length>2){for(const Ae of ke)if(Jo(ae,Ae))return!0}for(let Ae=0;Ae<ae.length-1;Ae++)if($p(ae[Ae],ae[Ae+1],ke))return!0;return!1}(e.cameraQueryGeometry,q-x,re-x,ce+x,ee+x));for(const q of k)S.push(q);S.sort(df);const L={};let Z;for(let q=0;q<S.length;q++){const re=S[q];if(re===Z)continue;Z=re;const ce=this.featureIndexArray.get(re);let ee=null;this.loadMatchingFeature(L,ce.bucketIndex,ce.sourceLayerIndex,ce.featureIndex,m,h.layers,h.availableImages,r,o,c,(ae,xe,ye)=>(ee||(ee=bo(ae)),xe.queryIntersectsFeature(g,ae,ye,ee,this.z,e.transform,d,e.pixelPosMatrix)))}return L}loadMatchingFeature(e,r,o,c,h,d,m,g,x,T,S){const P=this.bucketLayerIDs[r];if(d&&!function(q,re){for(let ce=0;ce<q.length;ce++)if(re.indexOf(q[ce])>=0)return!0;return!1}(d,P))return;const k=this.sourceLayerCoder.decode(o),L=this.vtLayers[k].feature(c);if(h.needGeometry){const q=wo(L,!0);if(!h.filter(new Nt(this.tileID.overscaledZ),q,this.tileID.canonical))return}else if(!h.filter(new Nt(this.tileID.overscaledZ),L))return;const Z=this.getId(L,k);for(let q=0;q<P.length;q++){const re=P[q];if(d&&d.indexOf(re)<0)continue;const ce=g[re];if(!ce)continue;let ee={};Z&&T&&(ee=T.getState(ce.sourceLayer||"_geojsonTileLayer",Z));const ae=$e({},x[re]);ae.paint=yh(ae.paint,ce.paint,L,ee,m),ae.layout=yh(ae.layout,ce.layout,L,ee,m);const xe=!S||S(L,ce,ee);if(!xe)continue;const ye=new gh(L,this.z,this.x,this.y,Z);ye.layer=ae;let Fe=e[re];Fe===void 0&&(Fe=e[re]=[]),Fe.push({featureIndex:c,feature:ye,intersectionZ:xe})}}lookupSymbolFeatures(e,r,o,c,h,d,m,g){const x={};this.loadVTLayers();const T=Go(h);for(const S of e)this.loadMatchingFeature(x,o,c,S,T,d,m,g,r);return x}hasLayer(e){for(const r of this.bucketLayerIDs)for(const o of r)if(e===o)return!0;return!1}getId(e,r){let o=e.id;return this.promoteId&&(o=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof o=="boolean"&&(o=Number(o))),o}}function yh(i,e,r,o,c){return Ke(i,(h,d)=>{const m=e instanceof xo?e.get(d):null;return m&&m.evaluate?m.evaluate(r,o,c):m})}function xh(i){let e=1/0,r=1/0,o=-1/0,c=-1/0;for(const h of i)e=Math.min(e,h.x),r=Math.min(r,h.y),o=Math.max(o,h.x),c=Math.max(c,h.y);return{minX:e,minY:r,maxX:o,maxY:c}}function df(i,e){return e-i}var Ac;Oe("FeatureIndex",_h,{omit:["rawTileData","sourceLayerCoder"]}),a.PerformanceMarkers=void 0,(Ac=a.PerformanceMarkers||(a.PerformanceMarkers={})).create="create",Ac.load="load",Ac.fullLoad="fullLoad";let gl=null,ea=[];const Mc=1e3/30,ff={mark(i){performance.mark(i)},frame(i){const e=i;gl!=null&&ea.push(e-gl),gl=e},clearMetrics(){gl=null,ea=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const i in a.PerformanceMarkers)performance.clearMarks(a.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.load),performance.measure("fullLoadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName("loadTime")[0].duration,e=performance.getEntriesByName("fullLoadTime")[0].duration,r=ea.length,o=1/(ea.reduce((h,d)=>h+d,0)/r/1e3),c=ea.filter(h=>h>Mc).reduce((h,d)=>h+(d-Mc)/Mc,0);return{loadTime:i,fullLoadTime:e,fps:o,percentDroppedFrames:c/(r+c)*100}}};a.AJAXError=Fi,a.ARRAY_TYPE=Di,a.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},et(["receive","process"],this),this.invoker=new pf(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Kt()?i:window}send(i,e,r,o,c=!1){const h=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[h]=r);const d=Rt(this.globalScope)?void 0:[];return this.target.postMessage({id:h,type:i,hasCallback:!!r,targetMapId:o,mustQueue:c,sourceMapId:this.mapId,data:on(e,d)},d),{cancel:()=>{r&&delete this.callbacks[h],this.target.postMessage({id:h,type:"<cancel>",targetMapId:o,sourceMapId:this.mapId})}}}receive(i){const e=i.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type==="<cancel>"){delete this.tasks[r];const o=this.cancelCallbacks[r];delete this.cancelCallbacks[r],o&&o()}else Kt()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)}process(){if(!this.taskQueue.length)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){if(e.type==="<response>"){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(Nr(e.error)):r(null,Nr(e.data)))}else{let r=!1;const o=Rt(this.globalScope)?void 0:[],c=e.hasCallback?(m,g)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:m?on(m):null,data:on(g,o)},o)}:m=>{r=!0};let h=null;const d=Nr(e.data);if(this.parent[e.type])h=this.parent[e.type](e.sourceMapId,d,c);else if(this.parent.getWorkerSource){const m=e.type.split(".");h=this.parent.getWorkerSource(e.sourceMapId,m[0],d.source)[m[1]](d,c)}else c(new Error(`Could not find function ${e.type}`));!r&&h&&h.cancel&&(this.cancelCallbacks[i]=h.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},a.AlphaImage=qs,a.CanonicalTileID=Cc,a.CollisionBoxArray=me,a.CollisionCircleLayoutArray=class extends E{},a.Color=B,a.DEMData=fh,a.DataConstantProperty=Ze,a.DictionaryCoder=mh,a.EXTENT=ri,a.ErrorEvent=wn,a.EvaluationParameters=Nt,a.Event=Tr,a.Evented=Er,a.FeatureIndex=_h,a.FillBucket=uc,a.FillExtrusionBucket=pc,a.GeoJSONFeature=gh,a.ImageAtlas=Vu,a.ImagePosition=gc,a.LineBucket=dc,a.LineStripIndexArray=class extends G{},a.LngLat=Wt,a.LngLatBounds=Eo,a.MercatorCoordinate=ml,a.ONE_EM=gi,a.OverscaledTileID=sr,a.PerformanceUtils=ff,a.PosArray=We,a.Properties=mi,a.QuadTriangleArray=class extends z{},a.RGBAImage=or,a.RasterBoundsArray=class extends l{},a.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},a.ResourceType=br,a.SegmentVector=dt,a.SymbolBucket=ns,a.Transitionable=Za,a.TriangleIndexArray=zi,a.Uniform1f=cn,a.Uniform1i=class extends ln{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},a.Uniform2f=class extends ln{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},a.Uniform3f=class extends ln{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},a.Uniform4f=Ho,a.UniformColor=ru,a.UniformMatrix4f=class extends ln{constructor(i,e){super(i,e),this.current=Lp}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},a.UnwrappedTileID=dh,a.ValidationError=Me,a.ZoomHistory=Ms,a.add=function(i,e,r){return i[0]=e[0]+r[0],i[1]=e[1]+r[1],i[2]=e[2]+r[2],i},a.addDynamicAttributes=bc,a.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let o=i.length;const c=new Array(i.length);let h=null;i.forEach((d,m)=>{e(d,(g,x)=>{g&&(h=g),c[m]=x,--o==0&&r(h,c)})})},a.bezier=fe,a.bindAll=et,a.cacheEntryPossiblyAdded=function(i){pr++,pr>_n&&(i.getActor().send("enforceCacheSizeLimit",gn),pr=0)},a.clamp=ie,a.clearTileCache=function(i){const e=caches.delete(Ci);i&&e.catch(i).then(()=>i())},a.clipLine=Qu,a.clone=function(i){var e=new Di(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},a.clone$1=lt,a.clone$2=function(i){var e=new Di(3);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},a.collisionCircleLayout=zd,a.config=wi,a.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},a.create=function(){var i=new Di(16);return Di!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},a.create$1=hu,a.createExpression=no,a.createFilter=Go,a.createLayout=Yt,a.createStyleLayer=function(i){return i.type==="custom"?new uf(i):new hf[i.type](i)},a.cross=function(i,e,r){var o=e[0],c=e[1],h=e[2],d=r[0],m=r[1],g=r[2];return i[0]=c*g-h*m,i[1]=h*d-o*g,i[2]=o*m-c*d,i},a.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]},a.dot$1=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},a.ease=ue,a.emitValidationErrors=Zo,a.enforceCacheSizeLimit=function(i){yn(),Ai&&Ai.then(e=>{e.keys().then(r=>{for(let o=0;o<r.length-i;o++)e.delete(r[o])})})},a.equals=function(i,e){var r=i[0],o=i[1],c=i[2],h=i[3],d=i[4],m=i[5],g=i[6],x=i[7],T=i[8],S=i[9],P=i[10],k=i[11],L=i[12],Z=i[13],q=i[14],re=i[15],ce=e[0],ee=e[1],ae=e[2],xe=e[3],ye=e[4],Fe=e[5],Ne=e[6],ke=e[7],Ae=e[8],Ee=e[9],De=e[10],Pe=e[11],we=e[12],He=e[13],je=e[14],pt=e[15];return Math.abs(r-ce)<=ki*Math.max(1,Math.abs(r),Math.abs(ce))&&Math.abs(o-ee)<=ki*Math.max(1,Math.abs(o),Math.abs(ee))&&Math.abs(c-ae)<=ki*Math.max(1,Math.abs(c),Math.abs(ae))&&Math.abs(h-xe)<=ki*Math.max(1,Math.abs(h),Math.abs(xe))&&Math.abs(d-ye)<=ki*Math.max(1,Math.abs(d),Math.abs(ye))&&Math.abs(m-Fe)<=ki*Math.max(1,Math.abs(m),Math.abs(Fe))&&Math.abs(g-Ne)<=ki*Math.max(1,Math.abs(g),Math.abs(Ne))&&Math.abs(x-ke)<=ki*Math.max(1,Math.abs(x),Math.abs(ke))&&Math.abs(T-Ae)<=ki*Math.max(1,Math.abs(T),Math.abs(Ae))&&Math.abs(S-Ee)<=ki*Math.max(1,Math.abs(S),Math.abs(Ee))&&Math.abs(P-De)<=ki*Math.max(1,Math.abs(P),Math.abs(De))&&Math.abs(k-Pe)<=ki*Math.max(1,Math.abs(k),Math.abs(Pe))&&Math.abs(L-we)<=ki*Math.max(1,Math.abs(L),Math.abs(we))&&Math.abs(Z-He)<=ki*Math.max(1,Math.abs(Z),Math.abs(He))&&Math.abs(q-je)<=ki*Math.max(1,Math.abs(q),Math.abs(je))&&Math.abs(re-pt)<=ki*Math.max(1,Math.abs(re),Math.abs(pt))},a.evaluateSizeForFeature=function(i,{uSize:e,uSizeT:r},{lowerSize:o,upperSize:c}){return i.kind==="source"?o/pn:i.kind==="composite"?Ut(o/pn,c/pn,r):e},a.evaluateSizeForZoom=function(i,e){let r=0,o=0;if(i.kind==="constant")o=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:c,minZoom:h,maxZoom:d}=i,m=c?ie(Ui.interpolationFactor(c,e,h,d),0,1):0;i.kind==="camera"?o=Ut(i.minSize,i.maxSize,m):r=m}return{uSizeT:r,uSize:o}},a.evaluateVariableOffset=ih,a.evented=Bs,a.exported=di,a.exported$1=Dr,a.extend=$e,a.filterObject=tt,a.fromRotation=function(i,e){var r=Math.sin(e),o=Math.cos(e);return i[0]=o,i[1]=r,i[2]=0,i[3]=-r,i[4]=o,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i},a.fromScaling=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},a.getAnchorAlignment=yc,a.getAnchorJustification=vc,a.getArrayBuffer=bn,a.getImage=Or,a.getJSON=function(i,e){return vn($e(i,{type:"json"}),e)},a.getOverlapMode=Sc,a.getRTLTextPluginStatus=_o,a.getReferrer=Xn,a.getVideo=function(i,e){const r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let o=0;o<i.length;o++){const c=window.document.createElement("source");Wn(i[o])||(r.crossOrigin="Anonymous"),c.src=i[o],r.appendChild(c)}return{cancel:()=>{}}},a.identity=tc,a.invert=function(i,e){var r=e[0],o=e[1],c=e[2],h=e[3],d=e[4],m=e[5],g=e[6],x=e[7],T=e[8],S=e[9],P=e[10],k=e[11],L=e[12],Z=e[13],q=e[14],re=e[15],ce=r*m-o*d,ee=r*g-c*d,ae=r*x-h*d,xe=o*g-c*m,ye=o*x-h*m,Fe=c*x-h*g,Ne=T*Z-S*L,ke=T*q-P*L,Ae=T*re-k*L,Ee=S*q-P*Z,De=S*re-k*Z,Pe=P*re-k*q,we=ce*Pe-ee*De+ae*Ee+xe*Ae-ye*ke+Fe*Ne;return we?(i[0]=(m*Pe-g*De+x*Ee)*(we=1/we),i[1]=(c*De-o*Pe-h*Ee)*we,i[2]=(Z*Fe-q*ye+re*xe)*we,i[3]=(P*ye-S*Fe-k*xe)*we,i[4]=(g*Ae-d*Pe-x*ke)*we,i[5]=(r*Pe-c*Ae+h*ke)*we,i[6]=(q*ae-L*Fe-re*ee)*we,i[7]=(T*Fe-P*ae+k*ee)*we,i[8]=(d*De-m*Ae+x*Ne)*we,i[9]=(o*Ae-r*De-h*Ne)*we,i[10]=(L*ye-Z*ae+re*ce)*we,i[11]=(S*ae-T*ye-k*ce)*we,i[12]=(m*ke-d*Ee-g*Ne)*we,i[13]=(r*Ee-o*ke+c*Ne)*we,i[14]=(Z*ee-L*xe-q*ce)*we,i[15]=(T*xe-S*ee+P*ce)*we,i):null},a.isImageBitmap=pi,a.isSafari=Rt,a.isWorker=Kt,a.keysDifference=function(i,e){const r=[];for(const o in i)o in e||r.push(o);return r},a.lazyLoadRTLTextPlugin=function(){Ji.isLoading()||Ji.isLoaded()||_o()!=="deferred"||qa()},a.makeRequest=vn,a.mapObject=Ke,a.mercatorXfromLng=ch,a.mercatorYfromLat=uh,a.mercatorZfromAltitude=hh,a.mul=Np,a.mul$1=function(i,e,r){return i[0]=e[0]*r[0],i[1]=e[1]*r[1],i[2]=e[2]*r[2],i[3]=e[3]*r[3],i},a.multiply=pu,a.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},a.normalize=function(i,e){var r=e[0],o=e[1],c=e[2],h=r*r+o*o+c*c;return h>0&&(h=1/Math.sqrt(h)),i[0]=e[0]*h,i[1]=e[1]*h,i[2]=e[2]*h,i},a.number=Ut,a.ortho=function(i,e,r,o,c,h,d){var m=1/(e-r),g=1/(o-c),x=1/(h-d);return i[0]=-2*m,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*g,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*x,i[11]=0,i[12]=(e+r)*m,i[13]=(c+o)*g,i[14]=(d+h)*x,i[15]=1,i},a.parseCacheControl=ur,a.parseGlyphPbf=function(i){return new fc(i).readFields(Nd,[])},a.pbf=fc,a.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=ri/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0].layout,r=i.bucket.layers[0]._unevaluatedLayout._values,o={layoutIconSize:r["icon-size"].possiblyEvaluate(new Nt(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Nt(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Nt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.textSizeData;o.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Nt(g),i.canonical),r["text-size"].possiblyEvaluate(new Nt(x),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.iconSizeData;o.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Nt(g),i.canonical),r["icon-size"].possiblyEvaluate(new Nt(x),i.canonical)]}const c=e.get("text-line-height")*gi,h=e.get("text-rotation-alignment")!=="viewport"&&e.get("symbol-placement")!=="point",d=e.get("text-keep-upright"),m=e.get("text-size");for(const g of i.bucket.features){const x=e.get("text-font").evaluate(g,{},i.canonical).join(","),T=m.evaluate(g,{},i.canonical),S=o.layoutTextSize.evaluate(g,{},i.canonical),P=o.layoutIconSize.evaluate(g,{},i.canonical),k={horizontal:{},vertical:void 0},L=g.text;let Z,q=[0,0];if(L){const ee=L.toString(),ae=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*gi,xe=Xl(ee)?ae:0,ye=e.get("text-anchor").evaluate(g,{},i.canonical),Fe=e.get("text-variable-anchor");if(!Fe){const De=e.get("text-radial-offset").evaluate(g,{},i.canonical);q=De?ih(ye,[De*gi,xc]):e.get("text-offset").evaluate(g,{},i.canonical).map(Pe=>Pe*gi)}let Ne=h?"center":e.get("text-justify").evaluate(g,{},i.canonical);const ke=e.get("symbol-placement"),Ae=ke==="point"?e.get("text-max-width").evaluate(g,{},i.canonical)*gi:0,Ee=()=>{i.bucket.allowVerticalPlacement&&jo(ee)&&(k.vertical=al(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ae,c,ye,"left",xe,q,a.WritingMode.vertical,!0,ke,S,T))};if(!h&&Fe){const De=Ne==="auto"?Fe.map(we=>vc(we)):[Ne];let Pe=!1;for(let we=0;we<De.length;we++){const He=De[we];if(!k.horizontal[He])if(Pe)k.horizontal[He]=k.horizontal[0];else{const je=al(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ae,c,"center",He,xe,q,a.WritingMode.horizontal,!1,ke,S,T);je&&(k.horizontal[He]=je,Pe=je.positionedLines.length===1)}}Ee()}else{Ne==="auto"&&(Ne=vc(ye));const De=al(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ae,c,ye,Ne,xe,q,a.WritingMode.horizontal,!1,ke,S,T);De&&(k.horizontal[Ne]=De),Ee(),jo(ee)&&h&&d&&(k.vertical=al(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ae,c,ye,Ne,xe,q,a.WritingMode.vertical,!1,ke,S,T))}}let re=!1;if(g.icon&&g.icon.name){const ee=i.imageMap[g.icon.name];ee&&(Z=Wd(i.imagePositions[g.icon.name],e.get("icon-offset").evaluate(g,{},i.canonical),e.get("icon-anchor").evaluate(g,{},i.canonical)),re=!!ee.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=re:i.bucket.sdfIcons!==re&&at("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ee.pixelRatio!==i.bucket.pixelRatio||e.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const ce=nh(k.horizontal)||k.vertical;i.bucket.iconsInText=!!ce&&ce.iconsInText,(ce||Z)&&tf(i.bucket,g,k,Z,i.imageMap,o,S,P,q,re,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},a.perspective=function(i,e,r,o,c){var h,d=1/Math.tan(e/2);return i[0]=d/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,c!=null&&c!==1/0?(i[10]=(c+o)*(h=1/(o-c)),i[14]=2*c*o*h):(i[10]=-1,i[14]=-2*o),i},a.pick=function(i,e){const r={};for(let o=0;o<e.length;o++){const c=e[o];c in i&&(r[c]=i[c])}return r},a.plugin=Ji,a.pointGeometry=Xe,a.polygonIntersectsPolygon=au,a.potpack=Uu,a.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],a.register=Oe,a.registerForPluginStateChange=function(i){return i({pluginStatus:Pi,pluginURL:Gr}),Bs.on("pluginStateChange",i),i},a.renderColorRamp=xu,a.rotateX=function(i,e,r){var o=Math.sin(r),c=Math.cos(r),h=e[4],d=e[5],m=e[6],g=e[7],x=e[8],T=e[9],S=e[10],P=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=h*c+x*o,i[5]=d*c+T*o,i[6]=m*c+S*o,i[7]=g*c+P*o,i[8]=x*c-h*o,i[9]=T*c-d*o,i[10]=S*c-m*o,i[11]=P*c-g*o,i},a.rotateZ=function(i,e,r){var o=Math.sin(r),c=Math.cos(r),h=e[0],d=e[1],m=e[2],g=e[3],x=e[4],T=e[5],S=e[6],P=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=h*c+x*o,i[1]=d*c+T*o,i[2]=m*c+S*o,i[3]=g*c+P*o,i[4]=x*c-h*o,i[5]=T*c-d*o,i[6]=S*c-m*o,i[7]=P*c-g*o,i},a.scale=function(i,e,r){var o=r[0],c=r[1],h=r[2];return i[0]=e[0]*o,i[1]=e[1]*o,i[2]=e[2]*o,i[3]=e[3]*o,i[4]=e[4]*c,i[5]=e[5]*c,i[6]=e[6]*c,i[7]=e[7]*c,i[8]=e[8]*h,i[9]=e[9]*h,i[10]=e[10]*h,i[11]=e[11]*h,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},a.scale$1=function(i,e,r){return i[0]=e[0]*r,i[1]=e[1]*r,i[2]=e[2]*r,i},a.setCacheLimits=function(i,e){gn=i,_n=e},a.setRTLTextPlugin=function(i,e,r=!1){if(Pi===ks||Pi===Ds||Pi===Ls)throw new Error("setRTLTextPlugin cannot be called multiple times.");Gr=di.resolveURL(i),Pi=ks,Rs=e,Bn(),r||qa()},a.spec=_e,a.sphericalToCartesian=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}},a.sqrLen=function(i){var e=i[0],r=i[1];return e*e+r*r},a.sub=function(i,e,r){return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],i},a.toEvaluationFeature=wo,a.transformMat3=function(i,e,r){var o=e[0],c=e[1],h=e[2];return i[0]=o*r[0]+c*r[3]+h*r[6],i[1]=o*r[1]+c*r[4]+h*r[7],i[2]=o*r[2]+c*r[5]+h*r[8],i},a.transformMat4=Qa,a.transformMat4$1=function(i,e,r){var o=e[0],c=e[1];return i[0]=r[0]*o+r[4]*c+r[12],i[1]=r[1]*o+r[5]*c+r[13],i},a.translate=function(i,e,r){var o,c,h,d,m,g,x,T,S,P,k,L,Z=r[0],q=r[1],re=r[2];return e===i?(i[12]=e[0]*Z+e[4]*q+e[8]*re+e[12],i[13]=e[1]*Z+e[5]*q+e[9]*re+e[13],i[14]=e[2]*Z+e[6]*q+e[10]*re+e[14],i[15]=e[3]*Z+e[7]*q+e[11]*re+e[15]):(c=e[1],h=e[2],d=e[3],m=e[4],g=e[5],x=e[6],T=e[7],S=e[8],P=e[9],k=e[10],L=e[11],i[0]=o=e[0],i[1]=c,i[2]=h,i[3]=d,i[4]=m,i[5]=g,i[6]=x,i[7]=T,i[8]=S,i[9]=P,i[10]=k,i[11]=L,i[12]=o*Z+m*q+S*re+e[12],i[13]=c*Z+g*q+P*re+e[13],i[14]=h*Z+x*q+k*re+e[14],i[15]=d*Z+T*q+L*re+e[15]),i},a.triggerPluginCompletionEvent=Ga,a.unicodeBlockLookup=ze,a.uniqueId=function(){return Ue++},a.validateCustomStyleLayer=function(i){const e=[],r=i.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},a.validateLight=As,a.validateStyle=mo,a.vectorTile=Un,a.warnOnce=at,a.wrap=Ge}),N(["./shared"],function(a){function Y(O){const w=typeof O;if(w==="number"||w==="boolean"||w==="string"||O==null)return JSON.stringify(O);if(Array.isArray(O)){let B="[";for(const j of O)B+=`${Y(j)},`;return`${B}]`}const C=Object.keys(O).sort();let R="{";for(let B=0;B<C.length;B++)R+=`${JSON.stringify(C[B])}:${Y(O[C[B]])},`;return`${R}}`}function te(O){let w="";for(const C of a.refProperties)w+=`/${Y(O[C])}`;return w}class fe{constructor(w){this.keyCache={},w&&this.replace(w)}replace(w){this._layerConfigs={},this._layers={},this.update(w,[])}update(w,C){for(const B of w){this._layerConfigs[B.id]=B;const j=this._layers[B.id]=a.createStyleLayer(B);j._featureFilter=a.createFilter(j.filter),this.keyCache[B.id]&&delete this.keyCache[B.id]}for(const B of C)delete this.keyCache[B],delete this._layerConfigs[B],delete this._layers[B];this.familiesBySource={};const R=function(B,j){const K={};for(let X=0;X<B.length;X++){const J=j&&j[B[X].id]||te(B[X]);j&&(j[B[X].id]=J);let pe=K[J];pe||(pe=K[J]=[]),pe.push(B[X])}const W=[];for(const X in K)W.push(K[X]);return W}(Object.values(this._layerConfigs),this.keyCache);for(const B of R){const j=B.map(ve=>this._layers[ve.id]),K=j[0];if(K.visibility==="none")continue;const W=K.source||"";let X=this.familiesBySource[W];X||(X=this.familiesBySource[W]={});const J=K.sourceLayer||"_geojsonTileLayer";let pe=X[J];pe||(pe=X[J]=[]),pe.push(j)}}}class ue{constructor(w){const C={},R=[];for(const W in w){const X=w[W],J=C[W]={};for(const pe in X){const ve=X[+pe];if(!ve||ve.bitmap.width===0||ve.bitmap.height===0)continue;const he={x:0,y:0,w:ve.bitmap.width+2,h:ve.bitmap.height+2};R.push(he),J[pe]={rect:he,metrics:ve.metrics}}}const{w:B,h:j}=a.potpack(R),K=new a.AlphaImage({width:B||1,height:j||1});for(const W in w){const X=w[W];for(const J in X){const pe=X[+J];if(!pe||pe.bitmap.width===0||pe.bitmap.height===0)continue;const ve=C[W][J].rect;a.AlphaImage.copy(pe.bitmap,K,{x:0,y:0},{x:ve.x+1,y:ve.y+1},pe.bitmap)}}this.image=K,this.positions=C}}a.register("GlyphAtlas",ue);class ie{constructor(w){this.tileID=new a.OverscaledTileID(w.tileID.overscaledZ,w.tileID.wrap,w.tileID.canonical.z,w.tileID.canonical.x,w.tileID.canonical.y),this.uid=w.uid,this.zoom=w.zoom,this.pixelRatio=w.pixelRatio,this.tileSize=w.tileSize,this.source=w.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=w.showCollisionBoxes,this.collectResourceTiming=!!w.collectResourceTiming,this.returnDependencies=!!w.returnDependencies,this.promoteId=w.promoteId}parse(w,C,R,B,j){this.status="parsing",this.data=w,this.collisionBoxArray=new a.CollisionBoxArray;const K=new a.DictionaryCoder(Object.keys(w.layers).sort()),W=new a.FeatureIndex(this.tileID,this.promoteId);W.bucketLayerIDs=[];const X={},J={featureIndex:W,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:R},pe=C.familiesBySource[this.source];for(const it in pe){const ut=w.layers[it];if(!ut)continue;ut.version===1&&a.warnOnce(`Vector tile source "${this.source}" layer "${it}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const bt=K.encode(it),kt=[];for(let si=0;si<ut.length;si++){const $t=ut.feature(si),_i=W.getId($t,it);kt.push({feature:$t,id:_i,index:si,sourceLayerIndex:bt})}for(const si of pe[it]){const $t=si[0];$t.source!==this.source&&a.warnOnce(`layer.source = ${$t.source} does not equal this.source = ${this.source}`),$t.minzoom&&this.zoom<Math.floor($t.minzoom)||$t.maxzoom&&this.zoom>=$t.maxzoom||$t.visibility!=="none"&&(Ge(si,this.zoom,R),(X[$t.id]=$t.createBucket({index:W.bucketLayerIDs.length,layers:si,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:bt,sourceID:this.source})).populate(kt,J,this.tileID.canonical),W.bucketLayerIDs.push(si.map(_i=>_i.id)))}}let ve,he,Ve,qe;const Le=a.mapObject(J.glyphDependencies,it=>Object.keys(it).map(Number));Object.keys(Le).length?B.send("getGlyphs",{uid:this.uid,stacks:Le},(it,ut)=>{ve||(ve=it,he=ut,vt.call(this))}):he={};const Je=Object.keys(J.iconDependencies);Je.length?B.send("getImages",{icons:Je,source:this.source,tileID:this.tileID,type:"icons"},(it,ut)=>{ve||(ve=it,Ve=ut,vt.call(this))}):Ve={};const Qe=Object.keys(J.patternDependencies);function vt(){if(ve)return j(ve);if(he&&Ve&&qe){const it=new ue(he),ut=new a.ImageAtlas(Ve,qe);for(const bt in X){const kt=X[bt];kt instanceof a.SymbolBucket?(Ge(kt.layers,this.zoom,R),a.performSymbolLayout({bucket:kt,glyphMap:he,glyphPositions:it.positions,imageMap:Ve,imagePositions:ut.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):kt.hasPattern&&(kt instanceof a.LineBucket||kt instanceof a.FillBucket||kt instanceof a.FillExtrusionBucket)&&(Ge(kt.layers,this.zoom,R),kt.addFeatures(J,this.tileID.canonical,ut.patternPositions))}this.status="done",j(null,{buckets:Object.values(X).filter(bt=>!bt.isEmpty()),featureIndex:W,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:it.image,imageAtlas:ut,glyphMap:this.returnDependencies?he:null,iconMap:this.returnDependencies?Ve:null,glyphPositions:this.returnDependencies?it.positions:null})}}Qe.length?B.send("getImages",{icons:Qe,source:this.source,tileID:this.tileID,type:"patterns"},(it,ut)=>{ve||(ve=it,qe=ut,vt.call(this))}):qe={},vt.call(this)}}function Ge(O,w,C){const R=new a.EvaluationParameters(w);for(const B of O)B.recalculate(R,C)}function $e(O,w){const C=a.getArrayBuffer(O.request,(R,B,j,K)=>{R?w(R):B&&w(null,{vectorTile:new a.vectorTile.VectorTile(new a.pbf(B)),rawData:B,cacheControl:j,expires:K})});return()=>{C.cancel(),w()}}class Ue{constructor(w,C,R,B){this.actor=w,this.layerIndex=C,this.availableImages=R,this.loadVectorData=B||$e,this.loading={},this.loaded={}}loadTile(w,C){const R=w.uid;this.loading||(this.loading={});const B=!!(w&&w.request&&w.request.collectResourceTiming)&&new a.RequestPerformance(w.request),j=this.loading[R]=new ie(w);j.abort=this.loadVectorData(w,(K,W)=>{if(delete this.loading[R],K||!W)return j.status="done",this.loaded[R]=j,C(K);const X=W.rawData,J={};W.expires&&(J.expires=W.expires),W.cacheControl&&(J.cacheControl=W.cacheControl);const pe={};if(B){const ve=B.finish();ve&&(pe.resourceTiming=JSON.parse(JSON.stringify(ve)))}j.vectorTile=W.vectorTile,j.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor,(ve,he)=>{if(ve||!he)return C(ve);C(null,a.extend({rawTileData:X.slice(0)},he,J,pe))}),this.loaded=this.loaded||{},this.loaded[R]=j})}reloadTile(w,C){const R=this.loaded,B=w.uid,j=this;if(R&&R[B]){const K=R[B];K.showCollisionBoxes=w.showCollisionBoxes;const W=(X,J)=>{const pe=K.reloadCallback;pe&&(delete K.reloadCallback,K.parse(K.vectorTile,j.layerIndex,this.availableImages,j.actor,pe)),C(X,J)};K.status==="parsing"?K.reloadCallback=W:K.status==="done"&&(K.vectorTile?K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor,W):W())}}abortTile(w,C){const R=this.loading,B=w.uid;R&&R[B]&&R[B].abort&&(R[B].abort(),delete R[B]),C()}removeTile(w,C){const R=this.loaded,B=w.uid;R&&R[B]&&delete R[B],C()}}class et{constructor(){this.loaded={}}loadTile(w,C){const{uid:R,encoding:B,rawImageData:j}=w,K=a.isImageBitmap(j)?this.getImageData(j):j,W=new a.DEMData(R,K,B);this.loaded=this.loaded||{},this.loaded[R]=W,C(null,W)}getImageData(w){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(w.width,w.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=w.width,this.offscreenCanvas.height=w.height,this.offscreenCanvasContext.drawImage(w,0,0,w.width,w.height);const C=this.offscreenCanvasContext.getImageData(-1,-1,w.width+2,w.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new a.RGBAImage({width:C.width,height:C.height},C.data)}removeTile(w){const C=this.loaded,R=w.uid;C&&C[R]&&delete C[R]}}var Ke=function O(w,C){var R,B=w&&w.type;if(B==="FeatureCollection")for(R=0;R<w.features.length;R++)O(w.features[R],C);else if(B==="GeometryCollection")for(R=0;R<w.geometries.length;R++)O(w.geometries[R],C);else if(B==="Feature")O(w.geometry,C);else if(B==="Polygon")tt(w.coordinates,C);else if(B==="MultiPolygon")for(R=0;R<w.coordinates.length;R++)tt(w.coordinates[R],C);return w};function tt(O,w){if(O.length!==0){lt(O[0],w);for(var C=1;C<O.length;C++)lt(O[C],!w)}}function lt(O,w){for(var C=0,R=0,B=0,j=O.length,K=j-1;B<j;K=B++){var W=(O[B][0]-O[K][0])*(O[K][1]+O[B][1]),X=C+W;R+=Math.abs(C)>=Math.abs(W)?C-X+W:W-X+C,C=X}C+R>=0!=!!w&&O.reverse()}const It=a.vectorTile.VectorTileFeature.prototype.toGeoJSON;class at{constructor(w){this._feature=w,this.extent=a.EXTENT,this.type=w.type,this.properties=w.tags,"id"in w&&!isNaN(w.id)&&(this.id=parseInt(w.id,10))}loadGeometry(){if(this._feature.type===1){const w=[];for(const C of this._feature.geometry)w.push([new a.pointGeometry(C[0],C[1])]);return w}{const w=[];for(const C of this._feature.geometry){const R=[];for(const B of C)R.push(new a.pointGeometry(B[0],B[1]));w.push(R)}return w}}toGeoJSON(w,C,R){return It.call(this,w,C,R)}}class gt{constructor(w){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.EXTENT,this.length=w.length,this._features=w}feature(w){return new at(this._features[w])}}var ti={exports:{}},Kt=a.pointGeometry,ur=a.vectorTile.VectorTileFeature,Wi=hr;function hr(O,w){this.options=w||{},this.features=O,this.length=O.length}function Hi(O,w){this.id=typeof O.id=="number"?O.id:void 0,this.type=O.type,this.rawGeometry=O.type===1?[O.geometry]:O.geometry,this.properties=O.tags,this.extent=w||4096}hr.prototype.feature=function(O){return new Hi(this.features[O],this.options.extent)},Hi.prototype.loadGeometry=function(){var O=this.rawGeometry;this.geometry=[];for(var w=0;w<O.length;w++){for(var C=O[w],R=[],B=0;B<C.length;B++)R.push(new Kt(C[B][0],C[B][1]));this.geometry.push(R)}return this.geometry},Hi.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var O=this.geometry,w=1/0,C=-1/0,R=1/0,B=-1/0,j=0;j<O.length;j++)for(var K=O[j],W=0;W<K.length;W++){var X=K[W];w=Math.min(w,X.x),C=Math.max(C,X.x),R=Math.min(R,X.y),B=Math.max(B,X.y)}return[w,R,C,B]},Hi.prototype.toGeoJSON=ur.prototype.toGeoJSON;var Rt=a.pbf,pi=Wi;function di(O){var w=new Rt;return function(C,R){for(var B in C.layers)R.writeMessage(3,Xe,C.layers[B])}(O,w),w.finish()}function Xe(O,w){var C;w.writeVarintField(15,O.version||1),w.writeStringField(1,O.name||""),w.writeVarintField(5,O.extent||4096);var R={keys:[],values:[],keycache:{},valuecache:{}};for(C=0;C<O.length;C++)R.feature=O.feature(C),w.writeMessage(2,Bi,R);var B=R.keys;for(C=0;C<B.length;C++)w.writeStringField(3,B[C]);var j=R.values;for(C=0;C<j.length;C++)w.writeMessage(4,gn,j[C])}function Bi(O,w){var C=O.feature;C.id!==void 0&&w.writeVarintField(1,C.id),w.writeMessage(2,wi,O),w.writeVarintField(3,C.type),w.writeMessage(4,Kr,C)}function wi(O,w){var C=O.feature,R=O.keys,B=O.values,j=O.keycache,K=O.valuecache;for(var W in C.properties){var X=C.properties[W],J=j[W];if(X!==null){J===void 0&&(R.push(W),j[W]=J=R.length-1),w.writeVarint(J);var pe=typeof X;pe!=="string"&&pe!=="boolean"&&pe!=="number"&&(X=JSON.stringify(X));var ve=pe+":"+X,he=K[ve];he===void 0&&(B.push(X),K[ve]=he=B.length-1),w.writeVarint(he)}}}function Ci(O,w){return(w<<3)+(7&O)}function Ai(O){return O<<1^O>>31}function Kr(O,w){for(var C=O.loadGeometry(),R=O.type,B=0,j=0,K=C.length,W=0;W<K;W++){var X=C[W],J=1;R===1&&(J=X.length),w.writeVarint(Ci(1,J));for(var pe=R===3?X.length-1:X.length,ve=0;ve<pe;ve++){ve===1&&R!==1&&w.writeVarint(Ci(2,pe-1));var he=X[ve].x-B,Ve=X[ve].y-j;w.writeVarint(Ai(he)),w.writeVarint(Ai(Ve)),B+=he,j+=Ve}R===3&&w.writeVarint(Ci(7,1))}}function gn(O,w){var C=typeof O;C==="string"?w.writeStringField(1,O):C==="boolean"?w.writeBooleanField(7,O):C==="number"&&(O%1!=0?w.writeDoubleField(3,O):O<0?w.writeSVarintField(6,O):w.writeVarintField(5,O))}function _n(O,w,C,R,B,j){if(B-R<=C)return;const K=R+B>>1;yn(O,w,K,R,B,j%2),_n(O,w,C,R,K-1,j+1),_n(O,w,C,K+1,B,j+1)}function yn(O,w,C,R,B,j){for(;B>R;){if(B-R>600){const J=B-R+1,pe=C-R+1,ve=Math.log(J),he=.5*Math.exp(2*ve/3),Ve=.5*Math.sqrt(ve*he*(J-he)/J)*(pe-J/2<0?-1:1);yn(O,w,C,Math.max(R,Math.floor(C-pe*he/J+Ve)),Math.min(B,Math.floor(C+(J-pe)*he/J+Ve)),j)}const K=w[2*C+j];let W=R,X=B;for(pr(O,w,R,C),w[2*B+j]>K&&pr(O,w,R,B);W<X;){for(pr(O,w,W,X),W++,X--;w[2*W+j]<K;)W++;for(;w[2*X+j]>K;)X--}w[2*R+j]===K?pr(O,w,R,X):(X++,pr(O,w,X,B)),X<=C&&(R=X+1),C<=X&&(B=X-1)}}function pr(O,w,C,R){Dr(O,C,R),Dr(w,2*C,2*R),Dr(w,2*C+1,2*R+1)}function Dr(O,w,C){const R=O[w];O[w]=O[C],O[C]=R}function Lr(O,w,C,R){const B=O-C,j=w-R;return B*B+j*j}ti.exports=di,ti.exports.fromVectorTileJs=di,ti.exports.fromGeojsonVt=function(O,w){w=w||{};var C={};for(var R in O)C[R]=new pi(O[R].features,w),C[R].name=R,C[R].version=w.version,C[R].extent=w.extent;return di({layers:C})},ti.exports.GeoJSONWrapper=pi;const Rr=O=>O[0],Mi=O=>O[1];class xn{constructor(w,C=Rr,R=Mi,B=64,j=Float64Array){this.nodeSize=B,this.points=w;const K=w.length<65536?Uint16Array:Uint32Array,W=this.ids=new K(w.length),X=this.coords=new j(2*w.length);for(let J=0;J<w.length;J++)W[J]=J,X[2*J]=C(w[J]),X[2*J+1]=R(w[J]);_n(W,X,B,0,W.length-1,0)}range(w,C,R,B){return function(j,K,W,X,J,pe,ve){const he=[0,j.length-1,0],Ve=[];let qe,Le;for(;he.length;){const Je=he.pop(),Qe=he.pop(),vt=he.pop();if(Qe-vt<=ve){for(let bt=vt;bt<=Qe;bt++)qe=K[2*bt],Le=K[2*bt+1],qe>=W&&qe<=J&&Le>=X&&Le<=pe&&Ve.push(j[bt]);continue}const it=Math.floor((vt+Qe)/2);qe=K[2*it],Le=K[2*it+1],qe>=W&&qe<=J&&Le>=X&&Le<=pe&&Ve.push(j[it]);const ut=(Je+1)%2;(Je===0?W<=qe:X<=Le)&&(he.push(vt),he.push(it-1),he.push(ut)),(Je===0?J>=qe:pe>=Le)&&(he.push(it+1),he.push(Qe),he.push(ut))}return Ve}(this.ids,this.coords,w,C,R,B,this.nodeSize)}within(w,C,R){return function(B,j,K,W,X,J){const pe=[0,B.length-1,0],ve=[],he=X*X;for(;pe.length;){const Ve=pe.pop(),qe=pe.pop(),Le=pe.pop();if(qe-Le<=J){for(let ut=Le;ut<=qe;ut++)Lr(j[2*ut],j[2*ut+1],K,W)<=he&&ve.push(B[ut]);continue}const Je=Math.floor((Le+qe)/2),Qe=j[2*Je],vt=j[2*Je+1];Lr(Qe,vt,K,W)<=he&&ve.push(B[Je]);const it=(Ve+1)%2;(Ve===0?K-X<=Qe:W-X<=vt)&&(pe.push(Le),pe.push(Je-1),pe.push(it)),(Ve===0?K+X>=Qe:W+X>=vt)&&(pe.push(Je+1),pe.push(qe),pe.push(it))}return ve}(this.ids,this.coords,w,C,R,this.nodeSize)}}const jn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:O=>O},br=Math.fround||(Fi=new Float32Array(1),O=>(Fi[0]=+O,Fi[0]));var Fi;class Xn{constructor(w){this.options=Or(Object.create(jn),w),this.trees=new Array(this.options.maxZoom+1)}load(w){const{log:C,minZoom:R,maxZoom:B,nodeSize:j}=this.options;C&&console.time("total time");const K=`prepare ${w.length} points`;C&&console.time(K),this.points=w;let W=[];for(let X=0;X<w.length;X++)w[X].geometry&&W.push(vn(w[X],X));this.trees[B+1]=new xn(W,Hn,wr,j,Float32Array),C&&console.timeEnd(K);for(let X=B;X>=R;X--){const J=+Date.now();W=this._cluster(W,X),this.trees[X]=new xn(W,Hn,wr,j,Float32Array),C&&console.log("z%d: %d clusters in %dms",X,W.length,+Date.now()-J)}return C&&console.timeEnd("total time"),this}getClusters(w,C){let R=((w[0]+180)%360+360)%360-180;const B=Math.max(-90,Math.min(90,w[1]));let j=w[2]===180?180:((w[2]+180)%360+360)%360-180;const K=Math.max(-90,Math.min(90,w[3]));if(w[2]-w[0]>=360)R=-180,j=180;else if(R>j){const pe=this.getClusters([R,B,180,K],C),ve=this.getClusters([-180,B,j,K],C);return pe.concat(ve)}const W=this.trees[this._limitZoom(C)],X=W.range(yt(R),dr(K),yt(j),dr(B)),J=[];for(const pe of X){const ve=W.points[pe];J.push(ve.numPoints?bn(ve):this.points[ve.index])}return J}getChildren(w){const C=this._getOriginId(w),R=this._getOriginZoom(w),B="No cluster with the specified id.",j=this.trees[R];if(!j)throw new Error(B);const K=j.points[C];if(!K)throw new Error(B);const W=this.options.radius/(this.options.extent*Math.pow(2,R-1)),X=j.within(K.x,K.y,W),J=[];for(const pe of X){const ve=j.points[pe];ve.parentId===w&&J.push(ve.numPoints?bn(ve):this.points[ve.index])}if(J.length===0)throw new Error(B);return J}getLeaves(w,C,R){const B=[];return this._appendLeaves(B,w,C=C||10,R=R||0,0),B}getTile(w,C,R){const B=this.trees[this._limitZoom(w)],j=Math.pow(2,w),{extent:K,radius:W}=this.options,X=W/K,J=(R-X)/j,pe=(R+1+X)/j,ve={features:[]};return this._addTileFeatures(B.range((C-X)/j,J,(C+1+X)/j,pe),B.points,C,R,j,ve),C===0&&this._addTileFeatures(B.range(1-X/j,J,1,pe),B.points,j,R,j,ve),C===j-1&&this._addTileFeatures(B.range(0,J,X/j,pe),B.points,-1,R,j,ve),ve.features.length?ve:null}getClusterExpansionZoom(w){let C=this._getOriginZoom(w)-1;for(;C<=this.options.maxZoom;){const R=this.getChildren(w);if(C++,R.length!==1)break;w=R[0].properties.cluster_id}return C}_appendLeaves(w,C,R,B,j){const K=this.getChildren(C);for(const W of K){const X=W.properties;if(X&&X.cluster?j+X.point_count<=B?j+=X.point_count:j=this._appendLeaves(w,X.cluster_id,R,B,j):j<B?j++:w.push(W),w.length===R)break}return j}_addTileFeatures(w,C,R,B,j,K){for(const W of w){const X=C[W],J=X.numPoints;let pe,ve,he;if(J)pe=Wn(X),ve=X.x,he=X.y;else{const Le=this.points[X.index];pe=Le.properties,ve=yt(Le.geometry.coordinates[0]),he=dr(Le.geometry.coordinates[1])}const Ve={type:1,geometry:[[Math.round(this.options.extent*(ve*j-R)),Math.round(this.options.extent*(he*j-B))]],tags:pe};let qe;J?qe=X.id:this.options.generateId?qe=X.index:this.points[X.index].id&&(qe=this.points[X.index].id),qe!==void 0&&(Ve.id=qe),K.features.push(Ve)}}_limitZoom(w){return Math.max(this.options.minZoom,Math.min(Math.floor(+w),this.options.maxZoom+1))}_cluster(w,C){const R=[],{radius:B,extent:j,reduce:K,minPoints:W}=this.options,X=B/(j*Math.pow(2,C));for(let J=0;J<w.length;J++){const pe=w[J];if(pe.zoom<=C)continue;pe.zoom=C;const ve=this.trees[C+1],he=ve.within(pe.x,pe.y,X),Ve=pe.numPoints||1;let qe=Ve;for(const Le of he){const Je=ve.points[Le];Je.zoom>C&&(qe+=Je.numPoints||1)}if(qe>Ve&&qe>=W){let Le=pe.x*Ve,Je=pe.y*Ve,Qe=K&&Ve>1?this._map(pe,!0):null;const vt=(J<<5)+(C+1)+this.points.length;for(const it of he){const ut=ve.points[it];if(ut.zoom<=C)continue;ut.zoom=C;const bt=ut.numPoints||1;Le+=ut.x*bt,Je+=ut.y*bt,ut.parentId=vt,K&&(Qe||(Qe=this._map(pe,!0)),K(Qe,this._map(ut)))}pe.parentId=vt,R.push(Br(Le/qe,Je/qe,vt,qe,Qe))}else if(R.push(pe),qe>1)for(const Le of he){const Je=ve.points[Le];Je.zoom<=C||(Je.zoom=C,R.push(Je))}}return R}_getOriginId(w){return w-this.points.length>>5}_getOriginZoom(w){return(w-this.points.length)%32}_map(w,C){if(w.numPoints)return C?Or({},w.properties):w.properties;const R=this.points[w.index].properties,B=this.options.map(R);return C&&B===R?Or({},B):B}}function Br(O,w,C,R,B){return{x:br(O),y:br(w),zoom:1/0,id:C,parentId:-1,numPoints:R,properties:B}}function vn(O,w){const[C,R]=O.geometry.coordinates;return{x:br(yt(C)),y:br(dr(R)),zoom:1/0,index:w,parentId:-1}}function bn(O){return{type:"Feature",id:O.id,properties:Wn(O),geometry:{type:"Point",coordinates:[(w=O.x,360*(w-.5)),Fr(O.y)]}};var w}function Wn(O){const w=O.numPoints,C=w>=1e4?`${Math.round(w/1e3)}k`:w>=1e3?Math.round(w/100)/10+"k":w;return Or(Or({},O.properties),{cluster:!0,cluster_id:O.id,point_count:w,point_count_abbreviated:C})}function yt(O){return O/360+.5}function dr(O){const w=Math.sin(O*Math.PI/180),C=.5-.25*Math.log((1+w)/(1-w))/Math.PI;return C<0?0:C>1?1:C}function Fr(O){const w=(180-360*O)*Math.PI/180;return 360*Math.atan(Math.exp(w))/Math.PI-90}function Or(O,w){for(const C in w)O[C]=w[C];return O}function Hn(O){return O.x}function wr(O){return O.y}function Tr(O,w,C,R){for(var B,j=R,K=C-w>>1,W=C-w,X=O[w],J=O[w+1],pe=O[C],ve=O[C+1],he=w+3;he<C;he+=3){var Ve=wn(O[he],O[he+1],X,J,pe,ve);if(Ve>j)B=he,j=Ve;else if(Ve===j){var qe=Math.abs(he-K);qe<W&&(B=he,W=qe)}}j>R&&(B-w>3&&Tr(O,w,B,R),O[B+2]=j,C-B>3&&Tr(O,B,C,R))}function wn(O,w,C,R,B,j){var K=B-C,W=j-R;if(K!==0||W!==0){var X=((O-C)*K+(w-R)*W)/(K*K+W*W);X>1?(C=B,R=j):X>0&&(C+=K*X,R+=W*X)}return(K=O-C)*K+(W=w-R)*W}function Er(O,w,C,R){var B={id:O===void 0?null:O,type:w,geometry:C,tags:R,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(j){var K=j.geometry,W=j.type;if(W==="Point"||W==="MultiPoint"||W==="LineString")_e(j,K);else if(W==="Polygon"||W==="MultiLineString")for(var X=0;X<K.length;X++)_e(j,K[X]);else if(W==="MultiPolygon")for(X=0;X<K.length;X++)for(var J=0;J<K[X].length;J++)_e(j,K[X][J])}(B),B}function _e(O,w){for(var C=0;C<w.length;C+=3)O.minX=Math.min(O.minX,w[C]),O.minY=Math.min(O.minY,w[C+1]),O.maxX=Math.max(O.maxX,w[C]),O.maxY=Math.max(O.maxY,w[C+1])}function Me(O,w,C,R){if(w.geometry){var B=w.geometry.coordinates,j=w.geometry.type,K=Math.pow(C.tolerance/((1<<C.maxZoom)*C.extent),2),W=[],X=w.id;if(C.promoteId?X=w.properties[C.promoteId]:C.generateId&&(X=R||0),j==="Point")Jr(B,W);else if(j==="MultiPoint")for(var J=0;J<B.length;J++)Jr(B[J],W);else if(j==="LineString")ir(B,W,K,!1);else if(j==="MultiLineString"){if(C.lineMetrics){for(J=0;J<B.length;J++)ir(B[J],W=[],K,!1),O.push(Er(X,"LineString",W,w.properties));return}xt(B,W,K,!1)}else if(j==="Polygon")xt(B,W,K,!0);else{if(j!=="MultiPolygon"){if(j==="GeometryCollection"){for(J=0;J<w.geometry.geometries.length;J++)Me(O,{id:X,geometry:w.geometry.geometries[J],properties:w.properties},C,R);return}throw new Error("Input data is not a valid GeoJSON object.")}for(J=0;J<B.length;J++){var pe=[];xt(B[J],pe,K,!0),W.push(pe)}}O.push(Er(X,j,W,w.properties))}}function Jr(O,w){w.push(Ki(O[0])),w.push(Oi(O[1])),w.push(0)}function ir(O,w,C,R){for(var B,j,K=0,W=0;W<O.length;W++){var X=Ki(O[W][0]),J=Oi(O[W][1]);w.push(X),w.push(J),w.push(0),W>0&&(K+=R?(B*J-X*j)/2:Math.sqrt(Math.pow(X-B,2)+Math.pow(J-j,2))),B=X,j=J}var pe=w.length-3;w[2]=1,Tr(w,0,pe,C),w[pe+2]=1,w.size=Math.abs(K),w.start=0,w.end=w.size}function xt(O,w,C,R){for(var B=0;B<O.length;B++){var j=[];ir(O[B],j,C,R),w.push(j)}}function Ki(O){return O/360+.5}function Oi(O){var w=Math.sin(O*Math.PI/180),C=.5-.25*Math.log((1+w)/(1-w))/Math.PI;return C<0?0:C>1?1:C}function $i(O,w,C,R,B,j,K,W){if(R/=w,j>=(C/=w)&&K<R)return O;if(K<C||j>=R)return null;for(var X=[],J=0;J<O.length;J++){var pe=O[J],ve=pe.geometry,he=pe.type,Ve=B===0?pe.minX:pe.minY,qe=B===0?pe.maxX:pe.maxY;if(Ve>=C&&qe<R)X.push(pe);else if(!(qe<C||Ve>=R)){var Le=[];if(he==="Point"||he==="MultiPoint")$r(ve,Le,C,R,B);else if(he==="LineString")Ie(ve,Le,C,R,B,!1,W.lineMetrics);else if(he==="MultiLineString")ot(ve,Le,C,R,B,!1);else if(he==="Polygon")ot(ve,Le,C,R,B,!0);else if(he==="MultiPolygon")for(var Je=0;Je<ve.length;Je++){var Qe=[];ot(ve[Je],Qe,C,R,B,!0),Qe.length&&Le.push(Qe)}if(Le.length){if(W.lineMetrics&&he==="LineString"){for(Je=0;Je<Le.length;Je++)X.push(Er(pe.id,he,Le[Je],pe.tags));continue}he!=="LineString"&&he!=="MultiLineString"||(Le.length===1?(he="LineString",Le=Le[0]):he="MultiLineString"),he!=="Point"&&he!=="MultiPoint"||(he=Le.length===3?"Point":"MultiPoint"),X.push(Er(pe.id,he,Le,pe.tags))}}}return X.length?X:null}function $r(O,w,C,R,B){for(var j=0;j<O.length;j+=3){var K=O[j+B];K>=C&&K<=R&&(w.push(O[j]),w.push(O[j+1]),w.push(O[j+2]))}}function Ie(O,w,C,R,B,j,K){for(var W,X,J=ct(O),pe=B===0?Ur:rt,ve=O.start,he=0;he<O.length-3;he+=3){var Ve=O[he],qe=O[he+1],Le=O[he+2],Je=O[he+3],Qe=O[he+4],vt=B===0?Ve:qe,it=B===0?Je:Qe,ut=!1;K&&(W=Math.sqrt(Math.pow(Ve-Je,2)+Math.pow(qe-Qe,2))),vt<C?it>C&&(X=pe(J,Ve,qe,Je,Qe,C),K&&(J.start=ve+W*X)):vt>R?it<R&&(X=pe(J,Ve,qe,Je,Qe,R),K&&(J.start=ve+W*X)):fi(J,Ve,qe,Le),it<C&&vt>=C&&(X=pe(J,Ve,qe,Je,Qe,C),ut=!0),it>R&&vt<=R&&(X=pe(J,Ve,qe,Je,Qe,R),ut=!0),!j&&ut&&(K&&(J.end=ve+W*X),w.push(J),J=ct(O)),K&&(ve+=W)}var bt=O.length-3;Ve=O[bt],qe=O[bt+1],Le=O[bt+2],(vt=B===0?Ve:qe)>=C&&vt<=R&&fi(J,Ve,qe,Le),bt=J.length-3,j&&bt>=3&&(J[bt]!==J[0]||J[bt+1]!==J[1])&&fi(J,J[0],J[1],J[2]),J.length&&w.push(J)}function ct(O){var w=[];return w.size=O.size,w.start=O.start,w.end=O.end,w}function ot(O,w,C,R,B,j){for(var K=0;K<O.length;K++)Ie(O[K],w,C,R,B,j,!1)}function fi(O,w,C,R){O.push(w),O.push(C),O.push(R)}function Ur(O,w,C,R,B,j){var K=(j-w)/(R-w);return O.push(j),O.push(C+(B-C)*K),O.push(1),K}function rt(O,w,C,R,B,j){var K=(j-C)/(B-C);return O.push(w+(R-w)*K),O.push(j),O.push(1),K}function Sr(O,w){for(var C=[],R=0;R<O.length;R++){var B,j=O[R],K=j.type;if(K==="Point"||K==="MultiPoint"||K==="LineString")B=oi(j.geometry,w);else if(K==="MultiLineString"||K==="Polygon"){B=[];for(var W=0;W<j.geometry.length;W++)B.push(oi(j.geometry[W],w))}else if(K==="MultiPolygon")for(B=[],W=0;W<j.geometry.length;W++){for(var X=[],J=0;J<j.geometry[W].length;J++)X.push(oi(j.geometry[W][J],w));B.push(X)}C.push(Er(j.id,K,B,j.tags))}return C}function oi(O,w){var C=[];C.size=O.size,O.start!==void 0&&(C.start=O.start,C.end=O.end);for(var R=0;R<O.length;R+=3)C.push(O[R]+w,O[R+1],O[R+2]);return C}function Tn(O,w){if(O.transformed)return O;var C,R,B,j=1<<O.z,K=O.x,W=O.y;for(C=0;C<O.features.length;C++){var X=O.features[C],J=X.geometry,pe=X.type;if(X.geometry=[],pe===1)for(R=0;R<J.length;R+=2)X.geometry.push(Jt(J[R],J[R+1],w,j,K,W));else for(R=0;R<J.length;R++){var ve=[];for(B=0;B<J[R].length;B+=2)ve.push(Jt(J[R][B],J[R][B+1],w,j,K,W));X.geometry.push(ve)}}return O.transformed=!0,O}function Jt(O,w,C,R,B,j){return[Math.round(C*(O*R-B)),Math.round(C*(w*R-j))]}function Ti(O,w,C,R,B){for(var j=w===B.maxZoom?0:B.tolerance/((1<<w)*B.extent),K={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:C,y:R,z:w,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},W=0;W<O.length;W++){K.numFeatures++,Pt(K,O[W],j,B);var X=O[W].minX,J=O[W].minY,pe=O[W].maxX,ve=O[W].maxY;X<K.minX&&(K.minX=X),J<K.minY&&(K.minY=J),pe>K.maxX&&(K.maxX=pe),ve>K.maxY&&(K.maxY=ve)}return K}function Pt(O,w,C,R){var B=w.geometry,j=w.type,K=[];if(j==="Point"||j==="MultiPoint")for(var W=0;W<B.length;W+=3)K.push(B[W]),K.push(B[W+1]),O.numPoints++,O.numSimplified++;else if(j==="LineString")En(K,B,O,C,!1,!1);else if(j==="MultiLineString"||j==="Polygon")for(W=0;W<B.length;W++)En(K,B[W],O,C,j==="Polygon",W===0);else if(j==="MultiPolygon")for(var X=0;X<B.length;X++){var J=B[X];for(W=0;W<J.length;W++)En(K,J[W],O,C,!0,W===0)}if(K.length){var pe=w.tags||null;if(j==="LineString"&&R.lineMetrics){for(var ve in pe={},w.tags)pe[ve]=w.tags[ve];pe.mapbox_clip_start=B.start/B.size,pe.mapbox_clip_end=B.end/B.size}var he={geometry:K,type:j==="Polygon"||j==="MultiPolygon"?3:j==="LineString"||j==="MultiLineString"?2:1,tags:pe};w.id!==null&&(he.id=w.id),O.features.push(he)}}function En(O,w,C,R,B,j){var K=R*R;if(R>0&&w.size<(B?K:R))C.numPoints+=w.length/3;else{for(var W=[],X=0;X<w.length;X+=3)(R===0||w[X+2]>K)&&(C.numSimplified++,W.push(w[X]),W.push(w[X+1])),C.numPoints++;B&&function(J,pe){for(var ve=0,he=0,Ve=J.length,qe=Ve-2;he<Ve;qe=he,he+=2)ve+=(J[he]-J[qe])*(J[he+1]+J[qe+1]);if(ve>0===pe)for(he=0,Ve=J.length;he<Ve/2;he+=2){var Le=J[he],Je=J[he+1];J[he]=J[Ve-2-he],J[he+1]=J[Ve-1-he],J[Ve-2-he]=Le,J[Ve-1-he]=Je}}(W,j),O.push(W)}}function fr(O,w){var C=(w=this.options=function(B,j){for(var K in j)B[K]=j[K];return B}(Object.create(this.options),w)).debug;if(C&&console.time("preprocess data"),w.maxZoom<0||w.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(w.promoteId&&w.generateId)throw new Error("promoteId and generateId cannot be used together.");var R=function(B,j){var K=[];if(B.type==="FeatureCollection")for(var W=0;W<B.features.length;W++)Me(K,B.features[W],j,W);else Me(K,B.type==="Feature"?B:{geometry:B},j);return K}(O,w);this.tiles={},this.tileCoords=[],C&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",w.indexMaxZoom,w.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),R=function(B,j){var K=j.buffer/j.extent,W=B,X=$i(B,1,-1-K,K,0,-1,2,j),J=$i(B,1,1-K,2+K,0,-1,2,j);return(X||J)&&(W=$i(B,1,-K,1+K,0,-1,2,j)||[],X&&(W=Sr(X,1).concat(W)),J&&(W=W.concat(Sr(J,-1)))),W}(R,w),R.length&&this.splitTile(R,0,0,0),C&&(R.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)))}function Yr(O,w,C){return 32*((1<<O)*C+w)+O}function Qr(O,w){const C=O.tileID.canonical;if(!this._geoJSONIndex)return w(null,null);const R=this._geoJSONIndex.getTile(C.z,C.x,C.y);if(!R)return w(null,null);const B=new gt(R.features);let j=ti.exports(B);j.byteOffset===0&&j.byteLength===j.buffer.byteLength||(j=new Uint8Array(j)),w(null,{vectorTile:B,rawData:j.buffer})}fr.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},fr.prototype.splitTile=function(O,w,C,R,B,j,K){for(var W=[O,w,C,R],X=this.options,J=X.debug;W.length;){R=W.pop(),C=W.pop(),w=W.pop(),O=W.pop();var pe=1<<w,ve=Yr(w,C,R),he=this.tiles[ve];if(!he&&(J>1&&console.time("creation"),he=this.tiles[ve]=Ti(O,w,C,R,X),this.tileCoords.push({z:w,x:C,y:R}),J)){J>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",w,C,R,he.numFeatures,he.numPoints,he.numSimplified),console.timeEnd("creation"));var Ve="z"+w;this.stats[Ve]=(this.stats[Ve]||0)+1,this.total++}if(he.source=O,B){if(w===X.maxZoom||w===B)continue;var qe=1<<B-w;if(C!==Math.floor(j/qe)||R!==Math.floor(K/qe))continue}else if(w===X.indexMaxZoom||he.numPoints<=X.indexMaxPoints)continue;if(he.source=null,O.length!==0){J>1&&console.time("clipping");var Le,Je,Qe,vt,it,ut,bt=.5*X.buffer/X.extent,kt=.5-bt,si=.5+bt,$t=1+bt;Le=Je=Qe=vt=null,it=$i(O,pe,C-bt,C+si,0,he.minX,he.maxX,X),ut=$i(O,pe,C+kt,C+$t,0,he.minX,he.maxX,X),O=null,it&&(Le=$i(it,pe,R-bt,R+si,1,he.minY,he.maxY,X),Je=$i(it,pe,R+kt,R+$t,1,he.minY,he.maxY,X),it=null),ut&&(Qe=$i(ut,pe,R-bt,R+si,1,he.minY,he.maxY,X),vt=$i(ut,pe,R+kt,R+$t,1,he.minY,he.maxY,X),ut=null),J>1&&console.timeEnd("clipping"),W.push(Le||[],w+1,2*C,2*R),W.push(Je||[],w+1,2*C,2*R+1),W.push(Qe||[],w+1,2*C+1,2*R),W.push(vt||[],w+1,2*C+1,2*R+1)}}},fr.prototype.getTile=function(O,w,C){var R=this.options,B=R.extent,j=R.debug;if(O<0||O>24)return null;var K=1<<O,W=Yr(O,w=(w%K+K)%K,C);if(this.tiles[W])return Tn(this.tiles[W],B);j>1&&console.log("drilling down to z%d-%d-%d",O,w,C);for(var X,J=O,pe=w,ve=C;!X&&J>0;)J--,pe=Math.floor(pe/2),ve=Math.floor(ve/2),X=this.tiles[Yr(J,pe,ve)];return X&&X.source?(j>1&&console.log("found parent tile z%d-%d-%d",J,pe,ve),j>1&&console.time("drilling down"),this.splitTile(X.source,J,pe,ve,O,w,C),j>1&&console.timeEnd("drilling down"),this.tiles[W]?Tn(this.tiles[W],B):null):null};class Sn extends Ue{constructor(w,C,R,B){super(w,C,R,Qr),B&&(this.loadGeoJSON=B)}loadData(w,C){var R;(R=this._pendingRequest)===null||R===void 0||R.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const B=!!(w&&w.request&&w.request.collectResourceTiming)&&new a.RequestPerformance(w.request);this._pendingCallback=C,this._pendingRequest=this.loadGeoJSON(w,(j,K)=>{if(delete this._pendingCallback,delete this._pendingRequest,j||!K)return C(j);if(typeof K!="object")return C(new Error(`Input data given to '${w.source}' is not a valid GeoJSON object.`));{Ke(K,!0);try{if(w.filter){const X=a.createExpression(w.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(X.result==="error")throw new Error(X.value.map(pe=>`${pe.key}: ${pe.message}`).join(", "));const J=K.features.filter(pe=>X.value.evaluate({zoom:0},pe));K={type:"FeatureCollection",features:J}}this._geoJSONIndex=w.cluster?new Xn(function({superclusterOptions:X,clusterProperties:J}){if(!J||!X)return X;const pe={},ve={},he={accumulated:null,zoom:0},Ve={properties:null},qe=Object.keys(J);for(const Le of qe){const[Je,Qe]=J[Le],vt=a.createExpression(Qe),it=a.createExpression(typeof Je=="string"?[Je,["accumulated"],["get",Le]]:Je);pe[Le]=vt.value,ve[Le]=it.value}return X.map=Le=>{Ve.properties=Le;const Je={};for(const Qe of qe)Je[Qe]=pe[Qe].evaluate(he,Ve);return Je},X.reduce=(Le,Je)=>{Ve.properties=Je;for(const Qe of qe)he.accumulated=Le[Qe],Le[Qe]=ve[Qe].evaluate(he,Ve)},X}(w)).load(K.features):function(X,J){return new fr(X,J)}(K,w.geojsonVtOptions)}catch(X){return C(X)}this.loaded={};const W={};if(B){const X=B.finish();X&&(W.resourceTiming={},W.resourceTiming[w.source]=JSON.parse(JSON.stringify(X)))}C(null,W)}})}reloadTile(w,C){const R=this.loaded;return R&&R[w.uid]?super.reloadTile(w,C):this.loadTile(w,C)}loadGeoJSON(w,C){if(w.request)return a.getJSON(w.request,C);if(typeof w.data=="string")try{C(null,JSON.parse(w.data))}catch{C(new Error(`Input data given to '${w.source}' is not a valid GeoJSON object.`))}else C(new Error(`Input data given to '${w.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(w,C){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),C()}getClusterExpansionZoom(w,C){try{C(null,this._geoJSONIndex.getClusterExpansionZoom(w.clusterId))}catch(R){C(R)}}getClusterChildren(w,C){try{C(null,this._geoJSONIndex.getChildren(w.clusterId))}catch(R){C(R)}}getClusterLeaves(w,C){try{C(null,this._geoJSONIndex.getLeaves(w.clusterId,w.limit,w.offset))}catch(R){C(R)}}}class en{constructor(w){this.self=w,this.actor=new a.Actor(w,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Ue,geojson:Sn},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(C,R)=>{if(this.workerSourceTypes[C])throw new Error(`Worker source with name "${C}" already registered.`);this.workerSourceTypes[C]=R},this.self.registerRTLTextPlugin=C=>{if(a.plugin.isParsed())throw new Error("RTL text plugin already registered.");a.plugin.applyArabicShaping=C.applyArabicShaping,a.plugin.processBidirectionalText=C.processBidirectionalText,a.plugin.processStyledBidirectionalText=C.processStyledBidirectionalText}}setReferrer(w,C){this.referrer=C}setImages(w,C,R){this.availableImages[w]=C;for(const B in this.workerSources[w]){const j=this.workerSources[w][B];for(const K in j)j[K].availableImages=C}R()}setLayers(w,C,R){this.getLayerIndex(w).replace(C),R()}updateLayers(w,C,R){this.getLayerIndex(w).update(C.layers,C.removedIds),R()}loadTile(w,C,R){this.getWorkerSource(w,C.type,C.source).loadTile(C,R)}loadDEMTile(w,C,R){this.getDEMWorkerSource(w,C.source).loadTile(C,R)}reloadTile(w,C,R){this.getWorkerSource(w,C.type,C.source).reloadTile(C,R)}abortTile(w,C,R){this.getWorkerSource(w,C.type,C.source).abortTile(C,R)}removeTile(w,C,R){this.getWorkerSource(w,C.type,C.source).removeTile(C,R)}removeDEMTile(w,C){this.getDEMWorkerSource(w,C.source).removeTile(C)}removeSource(w,C,R){if(!this.workerSources[w]||!this.workerSources[w][C.type]||!this.workerSources[w][C.type][C.source])return;const B=this.workerSources[w][C.type][C.source];delete this.workerSources[w][C.type][C.source],B.removeSource!==void 0?B.removeSource(C,R):R()}loadWorkerSource(w,C,R){try{this.self.importScripts(C.url),R()}catch(B){R(B.toString())}}syncRTLPluginState(w,C,R){try{a.plugin.setState(C);const B=a.plugin.getPluginURL();if(a.plugin.isLoaded()&&!a.plugin.isParsed()&&B!=null){this.self.importScripts(B);const j=a.plugin.isParsed();R(j?void 0:new Error(`RTL Text Plugin failed to import scripts from ${B}`),j)}}catch(B){R(B.toString())}}getAvailableImages(w){let C=this.availableImages[w];return C||(C=[]),C}getLayerIndex(w){let C=this.layerIndexes[w];return C||(C=this.layerIndexes[w]=new fe),C}getWorkerSource(w,C,R){if(this.workerSources[w]||(this.workerSources[w]={}),this.workerSources[w][C]||(this.workerSources[w][C]={}),!this.workerSources[w][C][R]){const B={send:(j,K,W)=>{this.actor.send(j,K,W,w)}};this.workerSources[w][C][R]=new this.workerSourceTypes[C](B,this.getLayerIndex(w),this.getAvailableImages(w))}return this.workerSources[w][C][R]}getDEMWorkerSource(w,C){return this.demWorkerSources[w]||(this.demWorkerSources[w]={}),this.demWorkerSources[w][C]||(this.demWorkerSources[w][C]=new et),this.demWorkerSources[w][C]}enforceCacheSizeLimit(w,C){a.enforceCacheSizeLimit(C)}}return a.isWorker()&&(self.worker=new en(self)),en}),N(["./shared"],function(a){var Y=te;function te(l){return!function(t){return typeof window=="undefined"||typeof document=="undefined"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var s,u,p=new Blob([""],{type:"text/javascript"}),f=URL.createObjectURL(p);try{u=new Worker(f),s=!0}catch{s=!1}return u&&u.terminate(),URL.revokeObjectURL(f),s}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var s=document.createElement("canvas");s.width=s.height=1;var u=s.getContext("2d");if(!u)return!1;var p=u.getImageData(0,0,1,1);return p&&p.width===s.width}()?(fe[n=t&&t.failIfMajorPerformanceCaveat]===void 0&&(fe[n]=function(s){var u,p=function(f){var _=document.createElement("canvas"),y=Object.create(te.webGLContextAttributes);return y.failIfMajorPerformanceCaveat=f,_.getContext("webgl",y)||_.getContext("experimental-webgl",y)}(s);if(!p)return!1;try{u=p.createShader(p.VERTEX_SHADER)}catch{return!1}return!(!u||p.isContextLost())&&(p.shaderSource(u,"void main() {}"),p.compileShader(u),p.getShaderParameter(u,p.COMPILE_STATUS)===!0)}(n)),fe[n]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var n}(l)}var fe={};function ue(l,t){if(Array.isArray(l)){if(!Array.isArray(t)||l.length!==t.length)return!1;for(let n=0;n<l.length;n++)if(!ue(l[n],t[n]))return!1;return!0}if(typeof l=="object"&&l!==null&&t!==null){if(typeof t!="object"||Object.keys(l).length!==Object.keys(t).length)return!1;for(const n in l)if(!ue(l[n],t[n]))return!1;return!0}return l===t}te.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class ie{static testProp(t){if(!ie.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in ie.docStyle)return t[n];return t[0]}static create(t,n,s){const u=window.document.createElement(t);return n!==void 0&&(u.className=n),s&&s.appendChild(u),u}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){ie.docStyle&&ie.selectProp&&(ie.userSelect=ie.docStyle[ie.selectProp],ie.docStyle[ie.selectProp]="none")}static enableDrag(){ie.docStyle&&ie.selectProp&&(ie.docStyle[ie.selectProp]=ie.userSelect)}static setTransform(t,n){t.style[ie.transformProp]=n}static addEventListener(t,n,s,u={}){t.addEventListener(n,s,"passive"in u?u:u.capture)}static removeEventListener(t,n,s,u={}){t.removeEventListener(n,s,"passive"in u?u:u.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",ie.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ie.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",ie.suppressClickInternal,!0)},0)}static mousePos(t,n){const s=t.getBoundingClientRect();return new a.pointGeometry(n.clientX-s.left-t.clientLeft,n.clientY-s.top-t.clientTop)}static touchPos(t,n){const s=t.getBoundingClientRect(),u=[];for(let p=0;p<n.length;p++)u.push(new a.pointGeometry(n[p].clientX-s.left-t.clientLeft,n[p].clientY-s.top-t.clientTop));return u}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}ie.docStyle=typeof window!="undefined"&&window.document&&window.document.documentElement.style,ie.selectProp=ie.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),ie.transformProp=ie.testProp(["transform","WebkitTransform"]);class Ge{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,s){const u=function(p){const f=p.match($e);if(!f)throw new Error(`Unable to parse URL "${p}"`);return{protocol:f[1],authority:f[2],path:f[3]||"/",params:f[4]?f[4].split("&"):[]}}(t);return u.path+=`${n}${s}`,function(p){const f=p.params.length?`?${p.params.join("&")}`:"";return`${p.protocol}://${p.authority}${p.path}${f}`}(u)}setTransformRequest(t){this._transformRequestFn=t}}const $e=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;class Ue{constructor(t,n,s,u){this.context=t,this.format=s,this.texture=t.gl.createTexture(),this.update(n,u)}update(t,n,s){const{width:u,height:p}=t,f=!(this.size&&this.size[0]===u&&this.size[1]===p||s),{context:_}=this,{gl:y}=_;if(this.useMipmap=Boolean(n&&n.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!n||n.premultiply!==!1)),f)this.size=[u,p],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||a.isImageBitmap(t)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,t):y.texImage2D(y.TEXTURE_2D,0,this.format,u,p,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:v,y:E}=s||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||a.isImageBitmap(t)?y.texSubImage2D(y.TEXTURE_2D,0,v,E,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,v,E,u,p,y.RGBA,y.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(t,n,s){const{context:u}=this,{gl:p}=u;p.bindTexture(p.TEXTURE_2D,this.texture),s!==p.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=p.LINEAR),t!==this.filter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,t),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,s||t),this.filter=t),n!==this.wrap&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,n),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function et(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class Ke extends a.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.RGBAImage({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,callback:s}of this.requestors)this._notify(n,s);this.requestors=[]}}getImage(t){return this.images[t]}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 s=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new a.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),s=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new a.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),s=!1),this._validateContent(n.content,n)||(this.fire(new a.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),s=!1),s}_validateStretch(t,n){if(!t)return!0;let s=0;for(const u of t){if(u[0]<s||u[1]<u[0]||n<u[1])return!1;s=u[1]}return!0}_validateContent(t,n){return!(t&&(t.length!==4||t[0]<0||n.data.width<t[0]||t[1]<0||n.data.height<t[1]||t[2]<0||n.data.width<t[2]||t[3]<0||n.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))}updateImage(t,n){const s=this.images[t];if(s.data.width!==n.data.width||s.data.height!==n.data.height)throw new Error(`size mismatch between old image (${s.data.width}x${s.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=s.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,n){let s=!0;if(!this.isLoaded())for(const u of t)this.images[u]||(s=!1);this.isLoaded()||s?this._notify(t,n):this.requestors.push({ids:t,callback:n})}_notify(t,n){const s={};for(const u of t){this.images[u]||this.fire(new a.Event("styleimagemissing",{id:u}));const p=this.images[u];p?s[u]={data:p.data.clone(),pixelRatio:p.pixelRatio,sdf:p.sdf,version:p.version,stretchX:p.stretchX,stretchY:p.stretchY,content:p.content,hasRenderCallback:Boolean(p.userImage&&p.userImage.render)}:a.warnOnce(`Image "${u}" 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.`)}n(null,s)}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],s=this.getImage(t);if(!s)return null;if(n&&n.position.version===s.version)return n.position;if(n)n.position.version=s.version;else{const u={w:s.data.width+2,h:s.data.height+2,x:0,y:0},p=new a.ImagePosition(u,s);this.patterns[t]={bin:u,position:p}}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 Ue(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const p in this.patterns)t.push(this.patterns[p].bin);const{w:n,h:s}=a.potpack(t),u=this.atlasImage;u.resize({width:n||1,height:s||1});for(const p in this.patterns){const{bin:f}=this.patterns[p],_=f.x+1,y=f.y+1,v=this.images[p].data,E=v.width,M=v.height;a.RGBAImage.copy(v,u,{x:0,y:0},{x:_,y},{width:E,height:M}),a.RGBAImage.copy(v,u,{x:0,y:M-1},{x:_,y:y-1},{width:E,height:1}),a.RGBAImage.copy(v,u,{x:0,y:0},{x:_,y:y+M},{width:E,height:1}),a.RGBAImage.copy(v,u,{x:E-1,y:0},{x:_-1,y},{width:1,height:M}),a.RGBAImage.copy(v,u,{x:0,y:0},{x:_+E,y},{width:1,height:M})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const s=this.images[n];s||a.warnOnce(`Image with ID: "${n}" was not found`),et(s)&&this.updateImage(n,s)}}}const tt=1e20;function lt(l,t,n,s,u,p,f,_,y){for(let v=t;v<t+s;v++)It(l,n*p+v,p,u,f,_,y);for(let v=n;v<n+u;v++)It(l,v*p+t,1,s,f,_,y)}function It(l,t,n,s,u,p,f){p[0]=0,f[0]=-tt,f[1]=tt,u[0]=l[t];for(let _=1,y=0,v=0;_<s;_++){u[_]=l[t+_*n];const E=_*_;do{const M=p[y];v=(u[_]-u[M]+E-M*M)/(_-M)/2}while(v<=f[y]&&--y>-1);y++,p[y]=_,f[y]=v,f[y+1]=tt}for(let _=0,y=0;_<s;_++){for(;f[y+1]<_;)y++;const v=p[y],E=_-v;l[t+_*n]=u[v]+E*E}}class at{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t,n){const s=[];for(const u in t)for(const p of t[u])s.push({stack:u,id:p});a.asyncAll(s,({stack:u,id:p},f)=>{let _=this.entries[u];_||(_=this.entries[u]={glyphs:{},requests:{},ranges:{}});let y=_.glyphs[p];if(y!==void 0)return void f(null,{stack:u,id:p,glyph:y});if(y=this._tinySDF(_,u,p),y)return _.glyphs[p]=y,void f(null,{stack:u,id:p,glyph:y});const v=Math.floor(p/256);if(256*v>65535)return void f(new Error("glyphs > 65535 not supported"));if(_.ranges[v])return void f(null,{stack:u,id:p,glyph:y});let E=_.requests[v];E||(E=_.requests[v]=[],at.loadGlyphRange(u,v,this.url,this.requestManager,(M,z)=>{if(z){for(const V in z)this._doesCharSupportLocalGlyph(+V)||(_.glyphs[+V]=z[+V]);_.ranges[v]=!0}for(const V of E)V(M,z);delete _.requests[v]})),E.push((M,z)=>{M?f(M):z&&f(null,{stack:u,id:p,glyph:z[p]||null})})},(u,p)=>{if(u)n(u);else if(p){const f={};for(const{stack:_,id:y,glyph:v}of p)(f[_]||(f[_]={}))[y]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics};n(null,f)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(a.unicodeBlockLookup["CJK Unified Ideographs"](t)||a.unicodeBlockLookup["Hangul Syllables"](t)||a.unicodeBlockLookup.Hiragana(t)||a.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,s){const u=this.localIdeographFontFamily;if(!u||!this._doesCharSupportLocalGlyph(s))return;let p=t.tinySDF;if(!p){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),p=t.tinySDF=new at.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:u,fontWeight:_})}const f=p.draw(String.fromCharCode(s));return{id:s,bitmap:new a.AlphaImage({width:f.width||30,height:f.height||30},f.data),metrics:{width:f.glyphWidth||24,height:f.glyphHeight||24,left:f.glyphLeft||0,top:f.glyphTop-27||-8,advance:f.glyphAdvance||24}}}}at.loadGlyphRange=function(l,t,n,s,u){const p=256*t,f=p+255,_=s.transformRequest(n.replace("{fontstack}",l).replace("{range}",`${p}-${f}`),a.ResourceType.Glyphs);a.getArrayBuffer(_,(y,v)=>{if(y)u(y);else if(v){const E={};for(const M of a.parseGlyphPbf(v))E[M.id]=M;u(null,E)}})},at.TinySDF=class{constructor({fontSize:l=24,buffer:t=3,radius:n=8,cutoff:s=.25,fontFamily:u="sans-serif",fontWeight:p="normal",fontStyle:f="normal"}={}){this.buffer=t,this.cutoff=s,this.radius=n;const _=this.size=l+4*t,y=this._createCanvas(_),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${f} ${p} ${l}px ${u}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(l){const t=document.createElement("canvas");return t.width=t.height=l,t}draw(l){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:s,actualBoundingBoxLeft:u,actualBoundingBoxRight:p}=this.ctx.measureText(l),f=Math.ceil(n),_=Math.min(this.size-this.buffer,Math.ceil(p-u)),y=Math.min(this.size-this.buffer,f+Math.ceil(s)),v=_+2*this.buffer,E=y+2*this.buffer,M=Math.max(v*E,0),z=new Uint8ClampedArray(M),V={data:z,width:v,height:E,glyphWidth:_,glyphHeight:y,glyphTop:f,glyphLeft:0,glyphAdvance:t};if(_===0||y===0)return V;const{ctx:$,buffer:U,gridInner:H,gridOuter:Q}=this;$.clearRect(U,U,_,y),$.fillText(l,U,U+f);const ne=$.getImageData(U,U,_,y);Q.fill(tt,0,M),H.fill(0,0,M);for(let G=0;G<y;G++)for(let le=0;le<_;le++){const se=ne.data[4*(G*_+le)+3]/255;if(se===0)continue;const me=(G+U)*v+le+U;if(se===1)Q[me]=0,H[me]=tt;else{const ge=.5-se;Q[me]=ge>0?ge*ge:0,H[me]=ge<0?ge*ge:0}}lt(Q,0,0,v,E,v,this.f,this.v,this.z),lt(H,U,U,_,y,v,this.f,this.v,this.z);for(let G=0;G<M;G++){const le=Math.sqrt(Q[G])-Math.sqrt(H[G]);z[G]=Math.round(255-255*(le/this.radius+this.cutoff))}return V}};const gt=new a.Properties({anchor:new a.DataConstantProperty(a.spec.light.anchor),position:new class{constructor(){this.specification=a.spec.light.position}possiblyEvaluate(l,t){return a.sphericalToCartesian(l.expression.evaluate(t))}interpolate(l,t,n){return{x:a.number(l.x,t.x,n),y:a.number(l.y,t.y,n),z:a.number(l.z,t.z,n)}}},color:new a.DataConstantProperty(a.spec.light.color),intensity:new a.DataConstantProperty(a.spec.light.intensity)}),ti="-transition";class Kt extends a.Evented{constructor(t){super(),this._transitionable=new a.Transitionable(gt),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(a.validateLight,t,n))for(const s in t){const u=t[s];s.endsWith(ti)?this._transitionable.setTransition(s.slice(0,-ti.length),u):this._transitionable.setValue(s,u)}}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,s){return(!s||s.validate!==!1)&&a.emitValidationErrors(this,t.call(a.validateStyle,a.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:a.spec})))}}class ur{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const s=t.join(",")+String(n);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(t,n)),this.dashEntry[s]}getDashRanges(t,n,s){const u=[];let p=t.length%2==1?-t[t.length-1]*s:0,f=t[0]*s,_=!0;u.push({left:p,right:f,isDash:_,zeroLength:t[0]===0});let y=t[0];for(let v=1;v<t.length;v++){_=!_;const E=t[v];p=y*s,y+=E,f=y*s,u.push({left:p,right:f,isDash:_,zeroLength:E===0})}return u}addRoundDash(t,n,s){const u=n/2;for(let p=-s;p<=s;p++){const f=this.width*(this.nextRow+s+p);let _=0,y=t[_];for(let v=0;v<this.width;v++){v/y.right>1&&(y=t[++_]);const E=Math.abs(v-y.left),M=Math.abs(v-y.right),z=Math.min(E,M);let V;const $=p/s*(u+1);if(y.isDash){const U=u-Math.abs($);V=Math.sqrt(z*z+U*U)}else V=u-Math.sqrt(z*z+$*$);this.data[f+v]=Math.max(0,Math.min(255,V+128))}}}addRegularDash(t){for(let _=t.length-1;_>=0;--_){const y=t[_],v=t[_+1];y.zeroLength?t.splice(_,1):v&&v.isDash===y.isDash&&(v.left=y.left,t.splice(_,1))}const n=t[0],s=t[t.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);const u=this.width*this.nextRow;let p=0,f=t[p];for(let _=0;_<this.width;_++){_/f.right>1&&(f=t[++p]);const y=Math.abs(_-f.left),v=Math.abs(_-f.right),E=Math.min(y,v);this.data[u+_]=Math.max(0,Math.min(255,(f.isDash?E:-E)+128))}}addDash(t,n){const s=n?7:0,u=2*s+1;if(this.nextRow+u>this.height)return a.warnOnce("LineAtlas out of space"),null;let p=0;for(let _=0;_<t.length;_++)p+=t[_];if(p!==0){const _=this.width/p,y=this.getDashRanges(t,this.width,_);n?this.addRoundDash(y,_,s):this.addRegularDash(y)}const f={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:p};return this.nextRow+=u,this.dirty=!0,f}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))}}class Wi{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=a.uniqueId();const s=this.workerPool.acquire(this.id);for(let u=0;u<s.length;u++){const p=new Wi.Actor(s[u],n,this.id);p.name=`Worker ${u}`,this.actors.push(p)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n,s){a.asyncAll(this.actors,(u,p)=>{u.send(t,n,p)},s=s||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=>{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}function hr(l,t,n){const s=function(u,p){if(u)return n(u);if(p){const f=a.pick(a.extend(p,l),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);p.vector_layers&&(f.vectorLayers=p.vector_layers,f.vectorLayerIds=f.vectorLayers.map(_=>_.id)),n(null,f)}};return l.url?a.getJSON(t.transformRequest(l.url,a.ResourceType.Source),s):a.exported.frame(()=>s(null,l))}Wi.Actor=a.Actor;class Hi{constructor(t,n,s){this.bounds=a.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=s||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),s=Math.floor(a.mercatorXfromLng(this.bounds.getWest())*n),u=Math.floor(a.mercatorYfromLat(this.bounds.getNorth())*n),p=Math.ceil(a.mercatorXfromLng(this.bounds.getEast())*n),f=Math.ceil(a.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=s&&t.x<p&&t.y>=u&&t.y<f}}class Rt extends a.Evented{constructor(t,n,s,u){if(super(),this.id=t,this.dispatcher=s,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,a.extend(this,a.pick(n,["url","scheme","tileSize","promoteId"])),this._options=a.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(u)}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=hr(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new a.ErrorEvent(t)):n&&(a.extend(this,n),n.bounds&&(this.tileBounds=new Hi(n.bounds,this.minzoom,this.maxzoom)),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}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.cancel(),t(),this.load()}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.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),u={request:this.map._requestManager.transformRequest(s,a.ResourceType.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};function p(f,_){return delete t.request,t.aborted?n(null):f&&f.status!==404?n(f):(_&&_.resourceTiming&&(t.resourceTiming=_.resourceTiming),this.map._refreshExpiredTiles&&_&&t.setExpiryData(_),t.loadVectorData(_,this.map.painter),a.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}u.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",u,p.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",u,p.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class pi extends a.Evented{constructor(t,n,s,u){super(),this.id=t,this.dispatcher=s,this.setEventedParent(u),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=a.extend({type:"raster"},n),a.extend(this,a.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=hr(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new a.ErrorEvent(t)):n&&(a.extend(this,n),n.bounds&&(this.tileBounds=new Hi(n.bounds,this.minzoom,this.maxzoom)),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=a.getImage(this.map._requestManager.transformRequest(s,a.ResourceType.Tile),(u,p,f)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(u)t.state="errored",n(u);else if(p){this.map._refreshExpiredTiles&&t.setExpiryData(f);const _=this.map.painter.context,y=_.gl;t.texture=this.map.painter.getTileTexture(p.width),t.texture?t.texture.update(p,{useMipmap:!0}):(t.texture=new Ue(_,p,y.RGBA,{useMipmap:!0}),t.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),_.extTextureFilterAnisotropic&&y.texParameterf(y.TEXTURE_2D,_.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,_.extTextureFilterAnisotropicMax)),t.state="loaded",a.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}let di;class Xe extends pi{constructor(t,n,s,u){super(t,n,s,u),this.type="raster-dem",this.maxzoom=22,this._options=a.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function u(p,f){p&&(t.state="errored",n(p)),f&&(t.dem=f,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=a.getImage(this.map._requestManager.transformRequest(s,a.ResourceType.Tile),function(p,f){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(p)t.state="errored",n(p);else if(f){this.map._refreshExpiredTiles&&t.setExpiryData(f),delete f.cacheControl,delete f.expires;const _=a.isImageBitmap(f)&&(di==null&&(di=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),di)?f:a.exported.getImageData(f,1),y={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:_,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",y,u.bind(this)))}}.bind(this)),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,s=Math.pow(2,n.z),u=(n.x-1+s)%s,p=n.x===0?t.wrap-1:t.wrap,f=(n.x+1+s)%s,_=n.x+1===s?t.wrap+1:t.wrap,y={};return y[new a.OverscaledTileID(t.overscaledZ,p,n.z,u,n.y).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y).key]={backfilled:!1},n.y>0&&(y[new a.OverscaledTileID(t.overscaledZ,p,n.z,u,n.y-1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y-1).key]={backfilled:!1}),n.y+1<s&&(y[new a.OverscaledTileID(t.overscaledZ,p,n.z,u,n.y+1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y+1).key]={backfilled:!1}),y}unloadTile(t){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&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class Bi extends a.Evented{constructor(t,n,s,u){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._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(u),this._data=n.data,this._options=a.extend({},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;const p=a.EXTENT/this.tileSize;this.workerOptions=a.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*p,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*p,extent:a.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:a.EXTENT,radius:(n.clusterRadius||50)*p,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData("content"),this}getClusterExpansionZoom(t,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},n),this}getClusterChildren(t,n){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},n),this}getClusterLeaves(t,n,s,u){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:n,offset:s},u),this}_updateWorkerData(t){const n=a.extend({},this.workerOptions),s=this._data;typeof s=="string"?(n.request=this.map._requestManager.transformRequest(a.exported.resolveURL(s),a.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(s),this._pendingLoads++,this.fire(new a.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(u,p)=>{if(this._pendingLoads--,this._removed||p&&p.abandoned)return void this.fire(new a.Event("dataabort",{dataType:"source",sourceDataType:t}));let f=null;if(p&&p.resourceTiming&&p.resourceTiming[this.id]&&(f=p.resourceTiming[this.id].slice(0)),u)return void this.fire(new a.ErrorEvent(u));const _={dataType:"source",sourceDataType:t};this._collectResourceTiming&&f&&f.length>0&&a.extend(_,{resourceTiming:f}),this.fire(new a.Event("data",_))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const s=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const u={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};t.request=this.actor.send(s,u,(p,f)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):p?n(p):(t.loadVectorData(f,this.map.painter,s==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return a.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var wi=a.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ci extends a.Evented{constructor(t,n,s,u){super(),this.id=t,this.dispatcher=s,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(u),this.options=n}load(t,n){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this.url=this.options.url,a.getImage(this.map._requestManager.transformRequest(this.url,a.ResourceType.Image),(s,u)=>{this._loaded=!0,s?this.fire(new a.ErrorEvent(s)):u&&(this.image=u,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(t){this.coordinates=t;const n=t.map(a.MercatorCoordinate.fromLngLat);this.tileID=function(u){let p=1/0,f=1/0,_=-1/0,y=-1/0;for(const z of u)p=Math.min(p,z.x),f=Math.min(f,z.y),_=Math.max(_,z.x),y=Math.max(y,z.y);const v=Math.max(_-p,y-f),E=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),M=Math.pow(2,E);return new a.CanonicalTileID(E,Math.floor((p+_)/2*M),Math.floor((f+y)/2*M))}(n),this.minzoom=this.maxzoom=this.tileID.z;const s=n.map(u=>this.tileID.getTilePoint(u)._round());return this._boundsArray=new a.RasterBoundsArray,this._boundsArray.emplaceBack(s[0].x,s[0].y,0,0),this._boundsArray.emplaceBack(s[1].x,s[1].y,a.EXTENT,0),this._boundsArray.emplaceBack(s[3].x,s[3].y,0,a.EXTENT),this._boundsArray.emplaceBack(s[2].x,s[2].y,a.EXTENT,a.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new a.Event("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.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,wi.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Ue(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const s in this.tiles){const u=this.tiles[s];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture)}}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Ai extends Ci{constructor(t,n,s,u){super(t,n,s,u),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,a.ResourceType.Source).url);a.getVideo(this.urls,(n,s)=>{this._loaded=!0,n?this.fire(new a.ErrorEvent(n)):s&&(this.video=s,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}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 a.ErrorEvent(new a.ValidationError(`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)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,wi.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),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 Ue(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const s in this.tiles){const u=this.tiles[s];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Kr extends Ci{constructor(t,n,s,u){super(t,n,s,u),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(f=>typeof f!="number"))||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new a.ErrorEvent(new a.ValidationError(`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 a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){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 a.ErrorEvent(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,s=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,wi.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Ue(n,this.canvas,s.RGBA,{premultiply:!0});for(const u in this.tiles){const p=this.tiles[u];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture)}}serialize(){return{type:"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 gn={vector:Rt,raster:pi,"raster-dem":Xe,geojson:Bi,video:Ai,image:Ci,canvas:Kr};function _n(l,t){const n=a.create();return a.translate(n,n,[1,1,0]),a.scale(n,n,[.5*l.width,.5*l.height,1]),a.multiply(n,n,l.calculatePosMatrix(t.toUnwrapped()))}function yn(l,t,n,s,u,p){const f=function(M,z,V){if(M)for(const $ of M){const U=z[$];if(U&&U.source===V&&U.type==="fill-extrusion")return!0}else for(const $ in z){const U=z[$];if(U.source===V&&U.type==="fill-extrusion")return!0}return!1}(u&&u.layers,t,l.id),_=p.maxPitchScaleFactor(),y=l.tilesIn(s,_,f);y.sort(pr);const v=[];for(const M of y)v.push({wrappedTileID:M.tileID.wrapped().key,queryResults:M.tile.queryRenderedFeatures(t,n,l._state,M.queryGeometry,M.cameraQueryGeometry,M.scale,u,p,_,_n(l.transform,M.tileID))});const E=function(M){const z={},V={};for(const $ of M){const U=$.queryResults,H=$.wrappedTileID,Q=V[H]=V[H]||{};for(const ne in U){const G=U[ne],le=Q[ne]=Q[ne]||{},se=z[ne]=z[ne]||[];for(const me of G)le[me.featureIndex]||(le[me.featureIndex]=!0,se.push(me))}}return z}(v);for(const M in E)E[M].forEach(z=>{const V=z.feature,$=l.getFeatureState(V.layer["source-layer"],V.id);V.source=V.layer.source,V.layer["source-layer"]&&(V.sourceLayer=V.layer["source-layer"]),V.state=$});return E}function pr(l,t){const n=l.tileID,s=t.tileID;return n.overscaledZ-s.overscaledZ||n.canonical.y-s.canonical.y||n.wrap-s.wrap||n.canonical.x-s.canonical.x}class Dr{constructor(t,n){this.tileID=t,this.uid=a.uniqueId(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.textures=[],this.textureCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const n=t+this.timeAdded;n<a.exported.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.textures.forEach(n=>t.saveTileTexture(n)),this.demTexture=null,this.textures=[],this.textureCoords={}}loadVectorData(t,n,s){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(u,p){const f={};if(!p)return f;for(const _ of u){const y=_.layerIds.map(v=>p.getLayer(v)).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(v=>y.filter(E=>E.id===v)[0]));for(const v of y)f[v.id]=_}}return f}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const u in this.buckets){const p=this.buckets[u];if(p instanceof a.SymbolBucket){if(this.hasSymbolBuckets=!0,!s)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const u in this.buckets){const p=this.buckets[u];if(p instanceof a.SymbolBucket&&p.hasRTLText){this.hasRTLText=!0,a.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const u in this.buckets){const p=this.buckets[u];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(u).queryRadius(p))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new a.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const s in this.buckets){const u=this.buckets[s];u.uploadPending()&&u.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Ue(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Ue(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,s,u,p,f,_,y,v,E){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:u,cameraQueryGeometry:p,scale:f,tileSize:this.tileSize,pixelPosMatrix:E,transform:y,params:_,queryPadding:this.queryPadding*v},t,n,s):{}}querySourceFeatures(t,n){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const u=s.loadVTLayers(),p=n?n.sourceLayer:"",f=u._geojsonTileLayer||u[p];if(!f)return;const _=a.createFilter(n&&n.filter),{z:y,x:v,y:E}=this.tileID.canonical,M={z:y,x:v,y:E};for(let z=0;z<f.length;z++){const V=f.feature(z);if(_.needGeometry){const H=a.toEvaluationFeature(V,!0);if(!_.filter(new a.EvaluationParameters(this.tileID.overscaledZ),H,this.tileID.canonical))continue}else if(!_.filter(new a.EvaluationParameters(this.tileID.overscaledZ),V))continue;const $=s.getId(V,p),U=new a.GeoJSONFeature(V,y,v,E,$);U.tile=M,t.push(U)}}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 s=a.parseCacheControl(t.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const s=Date.now();let u=!1;if(this.expirationTime>s)u=!1;else if(n)if(this.expirationTime<n)u=!0;else{const p=this.expirationTime-n;p?this.expirationTime=s+Math.max(p,3e4):u=!0}else u=!0;u?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const u in this.buckets){if(!n.style.hasLayer(u))continue;const p=this.buckets[u],f=p.layers[0].sourceLayer||"_geojsonTileLayer",_=s[f],y=t[f];if(!_||!y||Object.keys(y).length===0)continue;p.update(y,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const v=n&&n.style&&n.style.getLayer(u);v&&(this.queryPadding=Math.max(this.queryPadding,v.queryRadius(p)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<a.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=a.exported.now()+t}setDependencies(t,n){const s={};for(const u of n)s[u]=!0;this.dependencies[t]=s}hasDependency(t,n){for(const s of t){const u=this.dependencies[s];if(u){for(const p of n)if(u[p])return!0}}return!1}}class Lr{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,s){const u=t.wrapped().key;this.data[u]===void 0&&(this.data[u]=[]);const p={value:n,timeout:void 0};if(s!==void 0&&(p.timeout=setTimeout(()=>{this.remove(t,p)},s)),this.data[u].push(p),this.order.push(u),this.order.length>this.max){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const s=t.wrapped().key,u=n===void 0?0:this.data[s].indexOf(n),p=this.data[s][u];return this.data[s].splice(u,1),p.timeout&&clearTimeout(p.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(p.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const s in this.data)for(const u of this.data[s])t(u.value)||n.push(u);for(const s of n)this.remove(s.value.tileID,s)}}class Rr{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,s){const u=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][u]=this.stateChanges[t][u]||{},a.extend(this.stateChanges[t][u],s),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==u&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][u]===null){this.deletedStates[t][u]={};for(const p in this.state[t][u])s[p]||(this.deletedStates[t][u][p]=null)}else for(const p in s)this.deletedStates[t]&&this.deletedStates[t][u]&&this.deletedStates[t][u][p]===null&&delete this.deletedStates[t][u][p]}removeFeatureState(t,n,s){if(this.deletedStates[t]===null)return;const u=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},s&&n!==void 0)this.deletedStates[t][u]!==null&&(this.deletedStates[t][u]=this.deletedStates[t][u]||{},this.deletedStates[t][u][s]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][u])for(s in this.deletedStates[t][u]={},this.stateChanges[t][u])this.deletedStates[t][u][s]=null;else this.deletedStates[t][u]=null;else this.deletedStates[t]=null}getState(t,n){const s=String(n),u=a.extend({},(this.state[t]||{})[s],(this.stateChanges[t]||{})[s]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const p=this.deletedStates[t][n];if(p===null)return{};for(const f in p)delete u[f]}return u}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const s={};for(const u in this.stateChanges){this.state[u]=this.state[u]||{};const p={};for(const f in this.stateChanges[u])this.state[u][f]||(this.state[u][f]={}),a.extend(this.state[u][f],this.stateChanges[u][f]),p[f]=this.state[u][f];s[u]=p}for(const u in this.deletedStates){this.state[u]=this.state[u]||{};const p={};if(this.deletedStates[u]===null)for(const f in this.state[u])p[f]={},this.state[u][f]={};else for(const f in this.deletedStates[u]){if(this.deletedStates[u][f]===null)this.state[u][f]={};else for(const _ of Object.keys(this.deletedStates[u][f]))delete this.state[u][f][_];p[f]=this.state[u][f]}s[u]=s[u]||{},a.extend(s[u],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const u in t)t[u].setFeatureState(s,n)}}class Mi extends a.Evented{constructor(t,n,s){super(),this.id=t,this.dispatcher=s,this.on("data",u=>{u.dataType==="source"&&u.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&u.dataType==="source"&&u.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(u,p,f,_){const y=new gn[p.type](u,p,f,_);if(y.id!==u)throw new Error(`Expected Source id to be ${u} instead of ${y.id}`);return a.bindAll(["load","abort","unload","serialize","prepare"],y),y}(t,n,s,this),this._tiles={},this._cache=new Lr(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Rr}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}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){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new a.Event("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._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const s=this._tiles[n];s.upload(t),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(xn).map(t=>t.key)}getRenderableIds(t){const n=[];for(const s in this._tiles)this._isIdRenderable(s,t)&&n.push(this._tiles[s]);return t?n.sort((s,u)=>{const p=s.tileID,f=u.tileID,_=new a.pointGeometry(p.canonical.x,p.canonical.y)._rotate(this.transform.angle),y=new a.pointGeometry(f.canonical.x,f.canonical.y)._rotate(this.transform.angle);return p.overscaledZ-f.overscaledZ||y.y-_.y||y.x-_.x}).map(s=>s.tileID.key):n.map(s=>s.tileID).sort(xn).map(s=>s.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const s=this._tiles[t];s&&(s.state!=="loading"&&(s.state=n),this._loadTile(s,this._tileLoaded.bind(this,s,t,n)))}_tileLoaded(t,n,s,u){if(u)return t.state="errored",void(u.status!==404?this._source.fire(new a.ErrorEvent(u,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=a.exported.now(),s==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new a.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let u=0;u<n.length;u++){const p=n[u];if(t.neighboringTiles&&t.neighboringTiles[p]){const f=this.getTileByID(p);s(t,f),s(f,t)}}function s(u,p){u.needsHillshadePrepare=!0,u.needsTerrainPrepare=!0;let f=p.tileID.canonical.x-u.tileID.canonical.x;const _=p.tileID.canonical.y-u.tileID.canonical.y,y=Math.pow(2,u.tileID.canonical.z),v=p.tileID.key;f===0&&_===0||Math.abs(_)>1||(Math.abs(f)>1&&(Math.abs(f+y)===1?f+=y:Math.abs(f-y)===1&&(f-=y)),p.dem&&u.dem&&(u.dem.backfillBorder(p.dem,f,_),u.neighboringTiles&&u.neighboringTiles[v]&&(u.neighboringTiles[v].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,s,u){for(const p in this._tiles){let f=this._tiles[p];if(u[p]||!f.hasData()||f.tileID.overscaledZ<=n||f.tileID.overscaledZ>s)continue;let _=f.tileID;for(;f&&f.tileID.overscaledZ>n+1;){const v=f.tileID.scaledTo(f.tileID.overscaledZ-1);f=this._tiles[v.key],f&&f.hasData()&&(_=v)}let y=_;for(;y.overscaledZ>n;)if(y=y.scaledTo(y.overscaledZ-1),t[y.key]){u[_.key]=_;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const s=this._loadedParentTiles[t.key];return s&&s.tileID.overscaledZ>=n?s:null}for(let s=t.overscaledZ-1;s>=n;s--){const u=t.scaledTo(s),p=this._getLoadedTile(u);if(p)return p}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,s=Math.ceil(t.height/this._source.tileSize)+1,u=Math.floor(n*s*5),p=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,u):u;this._cache.setMaxSize(p)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const s={};for(const u in this._tiles){const p=this._tiles[u];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),s[p.tileID.key]=p}this._tiles=s;for(const u in this._timers)clearTimeout(this._timers[u]),delete this._timers[u];for(const u in this._tiles)this._setTileReloadTimer(u,this._tiles[u])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let s;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(v=>new a.OverscaledTileID(v.canonical.z,v.wrap,v.canonical.z,v.canonical.x,v.canonical.y)):(s=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(s=s.filter(v=>this._source.hasTile(v)))):s=[];const u=t.coveringZoomLevel(this._source),p=Math.max(u-Mi.maxOverzooming,this._source.minzoom),f=Math.max(u+Mi.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const v={};for(const E of s)if(E.canonical.z>this._source.minzoom){const M=E.scaledTo(E.canonical.z-1);v[M.key]=M;const z=E.scaledTo(Math.max(this._source.minzoom,Math.min(E.canonical.z,5)));v[z.key]=z}s=s.concat(Object.values(v))}const _=this._updateRetainedTiles(s,u);if(jn(this._source.type)){const v={},E={},M=Object.keys(_);for(const z of M){const V=_[z],$=this._tiles[z];if(!$||$.fadeEndTime&&$.fadeEndTime<=a.exported.now())continue;const U=this.findLoadedParent(V,p);U&&(this._addTile(U.tileID),v[U.tileID.key]=U.tileID),E[z]=V}this._retainLoadedChildren(E,u,f,_);for(const z in v)_[z]||(this._coveredTiles[z]=!0,_[z]=v[z]);if(n){const z={},V={};for(const $ of s)this._tiles[$.key].hasData()?z[$.key]=$:V[$.key]=$;for(const $ in V){const U=V[$].children(this._source.maxzoom);this._tiles[U[0].key]&&this._tiles[U[1].key]&&this._tiles[U[2].key]&&this._tiles[U[3].key]&&(z[U[0].key]=_[U[0].key]=U[0],z[U[1].key]=_[U[1].key]=U[1],z[U[2].key]=_[U[2].key]=U[2],z[U[3].key]=_[U[3].key]=U[3],delete V[$])}for(const $ in V){const U=this.findLoadedParent(V[$],this._source.minzoom);if(U){z[U.tileID.key]=_[U.tileID.key]=U.tileID;for(const H in z)z[H].isChildOf(U.tileID)&&delete z[H]}}for(const $ in this._tiles)z[$]||(this._coveredTiles[$]=!0)}}for(const v in _)this._tiles[v].clearFadeHold();const y=a.keysDifference(this._tiles,_);for(const v of y){const E=this._tiles[v];E.hasSymbolBuckets&&!E.holdingForFade()?E.setHoldDuration(this.map._fadeDuration):E.hasSymbolBuckets&&!E.symbolFadeFinished()||this._removeTile(v)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const s={},u={},p=Math.max(n-Mi.maxOverzooming,this._source.minzoom),f=Math.max(n+Mi.maxUnderzooming,this._source.minzoom),_={};for(const y of t){const v=this._addTile(y);s[y.key]=y,v.hasData()||n<this._source.maxzoom&&(_[y.key]=y)}this._retainLoadedChildren(_,n,f,s);for(const y of t){let v=this._tiles[y.key];if(v.hasData())continue;if(n+1>this._source.maxzoom){const M=y.children(this._source.maxzoom)[0],z=this.getTile(M);if(z&&z.hasData()){s[M.key]=M;continue}}else{const M=y.children(this._source.maxzoom);if(s[M[0].key]&&s[M[1].key]&&s[M[2].key]&&s[M[3].key])continue}let E=v.wasRequested();for(let M=y.overscaledZ-1;M>=p;--M){const z=y.scaledTo(M);if(u[z.key]||(u[z.key]=!0,v=this.getTile(z),!v&&E&&(v=this._addTile(z)),v&&(s[z.key]=z,E=v.wasRequested(),v.hasData())))break}}return s}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let s,u=this._tiles[t].tileID;for(;u.overscaledZ>0;){if(u.key in this._loadedParentTiles){s=this._loadedParentTiles[u.key];break}n.push(u.key);const p=u.scaledTo(u.overscaledZ-1);if(s=this._getLoadedTile(p),s)break;u=p}for(const p of n)this._loadedParentTiles[p]=s}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const s=n;return n||(n=new Dr(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,s||this._source.fire(new a.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const s=n.getExpiryTimeout();s&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},s))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,s){const u=[],p=this.transform;if(!p)return u;const f=s?p.getCameraQueryGeometry(t):t,_=t.map($=>p.pointCoordinate($,this.terrain)),y=f.map($=>p.pointCoordinate($,this.terrain)),v=this.getIds();let E=1/0,M=1/0,z=-1/0,V=-1/0;for(const $ of y)E=Math.min(E,$.x),M=Math.min(M,$.y),z=Math.max(z,$.x),V=Math.max(V,$.y);for(let $=0;$<v.length;$++){const U=this._tiles[v[$]];if(U.holdingForFade())continue;const H=U.tileID,Q=Math.pow(2,p.zoom-U.tileID.overscaledZ),ne=n*U.queryPadding*a.EXTENT/U.tileSize/Q,G=[H.getTilePoint(new a.MercatorCoordinate(E,M)),H.getTilePoint(new a.MercatorCoordinate(z,V))];if(G[0].x-ne<a.EXTENT&&G[0].y-ne<a.EXTENT&&G[1].x+ne>=0&&G[1].y+ne>=0){const le=_.map(me=>H.getTilePoint(me)),se=y.map(me=>H.getTilePoint(me));u.push({tile:U,tileID:H,queryGeometry:le,cameraQueryGeometry:se,scale:Q})}}return u}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(s=>this._tiles[s].tileID);for(const s of n)s.posMatrix=this.transform.calculatePosMatrix(s.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(jn(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=a.exported.now())return!0}return!1}setFeatureState(t,n,s){this._state.updateState(t=t||"_geojsonTileLayer",n,s)}removeFeatureState(t,n,s){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,s)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,s){const u=this._tiles[t];u&&u.setDependencies(n,s)}reloadTilesForDependencies(t,n){for(const s in this._tiles)this._tiles[s].hasDependency(t,n)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(t,n))}}function xn(l,t){const n=Math.abs(2*l.wrap)-+(l.wrap<0),s=Math.abs(2*t.wrap)-+(t.wrap<0);return l.overscaledZ-t.overscaledZ||s-n||t.canonical.y-l.canonical.y||t.canonical.x-l.canonical.x}function jn(l){return l==="raster"||l==="image"||l==="video"}Mi.maxOverzooming=10,Mi.maxUnderzooming=3;const br="mapboxgl_preloaded_worker_pool";class Fi{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Fi.workerCount;)this.workers.push(new Worker(sn.workerUrl));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[br]}numActive(){return Object.keys(this.active).length}}const Xn=Math.floor(a.exported.hardwareConcurrency/2);let Br;function vn(){return Br||(Br=new Fi),Br}function bn(l,t){const n={};for(const s in l)s!=="ref"&&(n[s]=l[s]);return a.refProperties.forEach(s=>{s in t&&(n[s]=t[s])}),n}function Wn(l){l=l.slice();const t=Object.create(null);for(let n=0;n<l.length;n++)t[l[n].id]=l[n];for(let n=0;n<l.length;n++)"ref"in l[n]&&(l[n]=bn(l[n],t[l[n].ref]));return l}Fi.workerCount=Math.max(Math.min(Xn,6),1);const yt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function dr(l,t,n){n.push({command:yt.addSource,args:[l,t[l]]})}function Fr(l,t,n){t.push({command:yt.removeSource,args:[l]}),n[l]=!0}function Or(l,t,n,s){Fr(l,n,s),dr(l,t,n)}function Hn(l,t,n){let s;for(s in l[n])if(Object.prototype.hasOwnProperty.call(l[n],s)&&s!=="data"&&!ue(l[n][s],t[n][s]))return!1;for(s in t[n])if(Object.prototype.hasOwnProperty.call(t[n],s)&&s!=="data"&&!ue(l[n][s],t[n][s]))return!1;return!0}function wr(l,t,n,s,u,p){let f;for(f in t=t||{},l=l||{})Object.prototype.hasOwnProperty.call(l,f)&&(ue(l[f],t[f])||n.push({command:p,args:[s,f,t[f],u]}));for(f in t)Object.prototype.hasOwnProperty.call(t,f)&&!Object.prototype.hasOwnProperty.call(l,f)&&(ue(l[f],t[f])||n.push({command:p,args:[s,f,t[f],u]}))}function Tr(l){return l.id}function wn(l,t){return l[t.id]=t,l}class Er{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let s=1;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-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=a.clamp(t,0,1);let n=1,s=this._distances[n];const u=t*this.paddedLength+this.padding;for(;s<u&&n<this._distances.length;)s=this._distances[++n];const p=n-1,f=this._distances[p],_=s-f,y=_>0?(u-f)/_:0;return this.points[p].mult(1-y).add(this.points[n].mult(y))}}function _e(l,t){let n=!0;return l==="always"||l!=="never"&&t!=="never"||(n=!1),n}class Me{constructor(t,n,s){const u=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/s),this.yCellCount=Math.ceil(n/s);for(let f=0;f<this.xCellCount*this.yCellCount;f++)u.push([]),p.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,s,u,p){this._forEachCell(n,s,u,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(u),this.bboxes.push(p)}insertCircle(t,n,s,u){this._forEachCell(n-u,s-u,n+u,s+u,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(s),this.circles.push(u)}_insertBoxCell(t,n,s,u,p,f){this.boxCells[p].push(f)}_insertCircleCell(t,n,s,u,p,f){this.circleCells[p].push(f)}_query(t,n,s,u,p,f,_){if(s<0||t>this.width||u<0||n>this.height)return[];const y=[];if(t<=0&&n<=0&&this.width<=s&&this.height<=u){if(p)return[{key:null,x1:t,y1:n,x2:s,y2:u}];for(let v=0;v<this.boxKeys.length;v++)y.push({key:this.boxKeys[v],x1:this.bboxes[4*v],y1:this.bboxes[4*v+1],x2:this.bboxes[4*v+2],y2:this.bboxes[4*v+3]});for(let v=0;v<this.circleKeys.length;v++){const E=this.circles[3*v],M=this.circles[3*v+1],z=this.circles[3*v+2];y.push({key:this.circleKeys[v],x1:E-z,y1:M-z,x2:E+z,y2:M+z})}}else this._forEachCell(t,n,s,u,this._queryCell,y,{hitTest:p,overlapMode:f,seenUids:{box:{},circle:{}}},_);return y}query(t,n,s,u){return this._query(t,n,s,u,!1,null)}hitTest(t,n,s,u,p,f){return this._query(t,n,s,u,!0,p,f).length>0}hitTestCircle(t,n,s,u,p){const f=t-s,_=t+s,y=n-s,v=n+s;if(_<0||f>this.width||v<0||y>this.height)return!1;const E=[];return this._forEachCell(f,y,_,v,this._queryCellCircle,E,{hitTest:!0,overlapMode:u,circle:{x:t,y:n,radius:s},seenUids:{box:{},circle:{}}},p),E.length>0}_queryCell(t,n,s,u,p,f,_,y){const{seenUids:v,hitTest:E,overlapMode:M}=_,z=this.boxCells[p];if(z!==null){const $=this.bboxes;for(const U of z)if(!v.box[U]){v.box[U]=!0;const H=4*U,Q=this.boxKeys[U];if(t<=$[H+2]&&n<=$[H+3]&&s>=$[H+0]&&u>=$[H+1]&&(!y||y(Q))&&(!E||!_e(M,Q.overlapMode))&&(f.push({key:Q,x1:$[H],y1:$[H+1],x2:$[H+2],y2:$[H+3]}),E))return!0}}const V=this.circleCells[p];if(V!==null){const $=this.circles;for(const U of V)if(!v.circle[U]){v.circle[U]=!0;const H=3*U,Q=this.circleKeys[U];if(this._circleAndRectCollide($[H],$[H+1],$[H+2],t,n,s,u)&&(!y||y(Q))&&(!E||!_e(M,Q.overlapMode))){const ne=$[H],G=$[H+1],le=$[H+2];if(f.push({key:Q,x1:ne-le,y1:G-le,x2:ne+le,y2:G+le}),E)return!0}}}return!1}_queryCellCircle(t,n,s,u,p,f,_,y){const{circle:v,seenUids:E,overlapMode:M}=_,z=this.boxCells[p];if(z!==null){const $=this.bboxes;for(const U of z)if(!E.box[U]){E.box[U]=!0;const H=4*U,Q=this.boxKeys[U];if(this._circleAndRectCollide(v.x,v.y,v.radius,$[H+0],$[H+1],$[H+2],$[H+3])&&(!y||y(Q))&&!_e(M,Q.overlapMode))return f.push(!0),!0}}const V=this.circleCells[p];if(V!==null){const $=this.circles;for(const U of V)if(!E.circle[U]){E.circle[U]=!0;const H=3*U,Q=this.circleKeys[U];if(this._circlesCollide($[H],$[H+1],$[H+2],v.x,v.y,v.radius)&&(!y||y(Q))&&!_e(M,Q.overlapMode))return f.push(!0),!0}}}_forEachCell(t,n,s,u,p,f,_,y){const v=this._convertToXCellCoord(t),E=this._convertToYCellCoord(n),M=this._convertToXCellCoord(s),z=this._convertToYCellCoord(u);for(let V=v;V<=M;V++)for(let $=E;$<=z;$++)if(p.call(this,t,n,s,u,this.xCellCount*$+V,f,_,y))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,s,u,p,f){const _=u-t,y=p-n,v=s+f;return v*v>_*_+y*y}_circleAndRectCollide(t,n,s,u,p,f,_){const y=(f-u)/2,v=Math.abs(t-(u+y));if(v>y+s)return!1;const E=(_-p)/2,M=Math.abs(n-(p+E));if(M>E+s)return!1;if(v<=y||M<=E)return!0;const z=v-y,V=M-E;return z*z+V*V<=s*s}}function Jr(l,t,n,s,u){const p=a.create();return t?(a.scale(p,p,[1/u,1/u,1]),n||a.rotateZ(p,p,s.angle)):a.multiply(p,s.labelPlaneMatrix,l),p}function ir(l,t,n,s,u){if(t){const p=a.clone(l);return a.scale(p,p,[u,u,1]),n||a.rotateZ(p,p,-s.angle),p}return s.glCoordMatrix}function xt(l,t,n){let s;n?(s=[l.x,l.y,n(l.x,l.y),1],a.transformMat4(s,s,t)):(s=[l.x,l.y,0,1],Sr(s,s,t));const u=s[3];return{point:new a.pointGeometry(s[0]/u,s[1]/u),signedDistanceFromCamera:u}}function Ki(l,t){return .5+l/t*.5}function Oi(l,t){const n=l[0]/l[3],s=l[1]/l[3];return n>=-t[0]&&n<=t[0]&&s>=-t[1]&&s<=t[1]}function $i(l,t,n,s,u,p,f,_,y,v){const E=s?l.textSizeData:l.iconSizeData,M=a.evaluateSizeForZoom(E,n.transform.zoom),z=[256/n.width*2+1,256/n.height*2+1],V=s?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;V.clear();const $=l.lineVertexArray,U=s?l.text.placedSymbolArray:l.icon.placedSymbolArray,H=n.transform.width/n.transform.height;let Q=!1;for(let ne=0;ne<U.length;ne++){const G=U.get(ne);if(G.hidden||G.writingMode===a.WritingMode.vertical&&!Q){rt(G.numGlyphs,V);continue}let le;if(Q=!1,v?(le=[G.anchorX,G.anchorY,v(G.anchorX,G.anchorY),1],a.transformMat4(le,le,t)):(le=[G.anchorX,G.anchorY,0,1],Sr(le,le,t)),!Oi(le,z)){rt(G.numGlyphs,V);continue}const se=Ki(n.transform.cameraToCenterDistance,le[3]),me=a.evaluateSizeForFeature(E,M,G),ge=f?me/se:me*se,be=new a.pointGeometry(G.anchorX,G.anchorY),de=xt(be,u,v).point,Re={},Ce=ct(G,ge,!1,_,t,u,p,l.glyphOffsetArray,$,V,de,be,Re,H,y,v);Q=Ce.useVertical,(Ce.notEnoughRoom||Q||Ce.needsFlipping&&ct(G,ge,!0,_,t,u,p,l.glyphOffsetArray,$,V,de,be,Re,H,y,v).notEnoughRoom)&&rt(G.numGlyphs,V)}s?l.text.dynamicLayoutVertexBuffer.updateData(V):l.icon.dynamicLayoutVertexBuffer.updateData(V)}function $r(l,t,n,s,u,p,f,_,y,v,E,M,z){const V=_.glyphStartIndex+_.numGlyphs,$=_.lineStartIndex,U=_.lineStartIndex+_.lineLength,H=t.getoffsetX(_.glyphStartIndex),Q=t.getoffsetX(V-1),ne=fi(l*H,n,s,u,p,f,_.segment,$,U,y,v,E,M,z);if(!ne)return null;const G=fi(l*Q,n,s,u,p,f,_.segment,$,U,y,v,E,M,z);return G?{first:ne,last:G}:null}function Ie(l,t,n,s){return l===a.WritingMode.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*s?{useVertical:!0}:(l===a.WritingMode.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function ct(l,t,n,s,u,p,f,_,y,v,E,M,z,V,$,U){const H=t/24,Q=l.lineOffsetX*H,ne=l.lineOffsetY*H;let G;if(l.numGlyphs>1){const le=l.glyphStartIndex+l.numGlyphs,se=l.lineStartIndex,me=l.lineStartIndex+l.lineLength,ge=$r(H,_,Q,ne,n,E,M,l,y,p,z,$,U);if(!ge)return{notEnoughRoom:!0};const be=xt(ge.first.point,f,U).point,de=xt(ge.last.point,f,U).point;if(s&&!n){const Re=Ie(l.writingMode,be,de,V);if(Re)return Re}G=[ge.first];for(let Re=l.glyphStartIndex+1;Re<le-1;Re++)G.push(fi(H*_.getoffsetX(Re),Q,ne,n,E,M,l.segment,se,me,y,p,z,$,U));G.push(ge.last)}else{if(s&&!n){const se=xt(M,u,U).point,me=l.lineStartIndex+l.segment+1,ge=new a.pointGeometry(y.getx(me),y.gety(me)),be=xt(ge,u,U),de=be.signedDistanceFromCamera>0?be.point:ot(M,ge,se,1,u,U),Re=Ie(l.writingMode,se,de,V);if(Re)return Re}const le=fi(H*_.getoffsetX(l.glyphStartIndex),Q,ne,n,E,M,l.segment,l.lineStartIndex,l.lineStartIndex+l.lineLength,y,p,z,$,U);if(!le)return{notEnoughRoom:!0};G=[le]}for(const le of G)a.addDynamicAttributes(v,le.point,le.angle);return{}}function ot(l,t,n,s,u,p){const f=xt(l.add(l.sub(t)._unit()),u,p).point,_=n.sub(f);return n.add(_._mult(s/_.mag()))}function fi(l,t,n,s,u,p,f,_,y,v,E,M,z,V){const $=s?l-t:l+t;let U=$>0?1:-1,H=0;s&&(U*=-1,H=Math.PI),U<0&&(H+=Math.PI);let Q=U>0?_+f:_+f+1,ne=u,G=u,le=0,se=0;const me=Math.abs($),ge=[];for(;le+se<=me;){if(Q+=U,Q<_||Q>=y)return null;if(G=ne,ge.push(ne),ne=M[Q],ne===void 0){const Be=new a.pointGeometry(v.getx(Q),v.gety(Q)),st=xt(Be,E,V);if(st.signedDistanceFromCamera>0)ne=M[Q]=st.point;else{const ht=Q-U;ne=ot(le===0?p:new a.pointGeometry(v.getx(ht),v.gety(ht)),Be,G,me-le+1,E,V)}}le+=se,se=G.dist(ne)}const be=(me-le)/se,de=ne.sub(G),Re=de.mult(be)._add(G);Re._add(de._unit()._perp()._mult(n*U));const Ce=H+Math.atan2(ne.y-G.y,ne.x-G.x);return ge.push(Re),{point:Re,angle:z?Ce:0,path:ge}}const Ur=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function rt(l,t){for(let n=0;n<l;n++){const s=t.length;t.resize(s+4),t.float32.set(Ur,3*s)}}function Sr(l,t,n){const s=t[0],u=t[1];return l[0]=n[0]*s+n[4]*u+n[12],l[1]=n[1]*s+n[5]*u+n[13],l[3]=n[3]*s+n[7]*u+n[15],l}const oi=100;class Tn{constructor(t,n=new Me(t.width+200,t.height+200,25),s=new Me(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=s,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+oi,this.screenBottomBoundary=t.height+oi,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,s,u,p,f){const _=this.projectAndGetPerspectiveRatio(u,t.anchorPointX,t.anchorPointY,f),y=s*_.perspectiveRatio,v=t.x1*y+_.point.x,E=t.y1*y+_.point.y,M=t.x2*y+_.point.x,z=t.y2*y+_.point.y;return!this.isInsideGrid(v,E,M,z)||n!=="always"&&this.grid.hitTest(v,E,M,z,n,p)||_.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[v,E,M,z],offscreen:this.isOffscreen(v,E,M,z)}}placeCollisionCircles(t,n,s,u,p,f,_,y,v,E,M,z,V,$){const U=[],H=new a.pointGeometry(n.anchorX,n.anchorY),Q=xt(H,f,$),ne=Ki(this.transform.cameraToCenterDistance,Q.signedDistanceFromCamera),G=(E?p/ne:p*ne)/a.ONE_EM,le=xt(H,_,$).point,se=$r(G,u,n.lineOffsetX*G,n.lineOffsetY*G,!1,le,H,n,s,_,{},!1,$);let me=!1,ge=!1,be=!0;if(se){const de=.5*z*ne+V,Re=new a.pointGeometry(-100,-100),Ce=new a.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),Be=new Er,st=se.first,ht=se.last;let We=[];for(let _t=st.path.length-1;_t>=1;_t--)We.push(st.path[_t]);for(let _t=1;_t<ht.path.length;_t++)We.push(ht.path[_t]);const At=2.5*de;if(y){const _t=We.map(wt=>xt(wt,y,$));We=_t.some(wt=>wt.signedDistanceFromCamera<=0)?[]:_t.map(wt=>wt.point)}let Mt=[];if(We.length>0){const _t=We[0].clone(),wt=We[0].clone();for(let zt=1;zt<We.length;zt++)_t.x=Math.min(_t.x,We[zt].x),_t.y=Math.min(_t.y,We[zt].y),wt.x=Math.max(wt.x,We[zt].x),wt.y=Math.max(wt.y,We[zt].y);Mt=_t.x>=Re.x&&wt.x<=Ce.x&&_t.y>=Re.y&&wt.y<=Ce.y?[We]:wt.x<Re.x||_t.x>Ce.x||wt.y<Re.y||_t.y>Ce.y?[]:a.clipLine([We],Re.x,Re.y,Ce.x,Ce.y)}for(const _t of Mt){Be.reset(_t,.25*de);let wt=0;wt=Be.length<=.5*de?1:Math.ceil(Be.paddedLength/At)+1;for(let zt=0;zt<wt;zt++){const ai=zt/Math.max(wt-1,1),_r=Be.lerp(ai),nr=_r.x+oi,yr=_r.y+oi;U.push(nr,yr,de,0);const Xr=nr-de,Yi=yr-de,zi=nr+de,Ar=yr+de;if(be=be&&this.isOffscreen(Xr,Yi,zi,Ar),ge=ge||this.isInsideGrid(Xr,Yi,zi,Ar),t!=="always"&&this.grid.hitTestCircle(nr,yr,de,t,M)&&(me=!0,!v))return{circles:[],offscreen:!1,collisionDetected:me}}}}return{circles:!v&&me||!ge||ne<this.perspectiveRatioCutoff?[]:U,offscreen:be,collisionDetected:me}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let s=1/0,u=1/0,p=-1/0,f=-1/0;for(const E of t){const M=new a.pointGeometry(E.x+oi,E.y+oi);s=Math.min(s,M.x),u=Math.min(u,M.y),p=Math.max(p,M.x),f=Math.max(f,M.y),n.push(M)}const _=this.grid.query(s,u,p,f).concat(this.ignoredGrid.query(s,u,p,f)),y={},v={};for(const E of _){const M=E.key;if(y[M.bucketInstanceId]===void 0&&(y[M.bucketInstanceId]={}),y[M.bucketInstanceId][M.featureIndex])continue;const z=[new a.pointGeometry(E.x1,E.y1),new a.pointGeometry(E.x2,E.y1),new a.pointGeometry(E.x2,E.y2),new a.pointGeometry(E.x1,E.y2)];a.polygonIntersectsPolygon(n,z)&&(y[M.bucketInstanceId][M.featureIndex]=!0,v[M.bucketInstanceId]===void 0&&(v[M.bucketInstanceId]=[]),v[M.bucketInstanceId].push(M.featureIndex))}return v}insertCollisionBox(t,n,s,u,p,f){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:u,featureIndex:p,collisionGroupID:f,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,s,u,p,f){const _=s?this.ignoredGrid:this.grid,y={bucketInstanceId:u,featureIndex:p,collisionGroupID:f,overlapMode:n};for(let v=0;v<t.length;v+=4)_.insertCircle(y,t[v],t[v+1],t[v+2])}projectAndGetPerspectiveRatio(t,n,s,u){let p;return u?(p=[n,s,u(n,s),1],a.transformMat4(p,p,t)):(p=[n,s,0,1],Sr(p,p,t)),{point:new a.pointGeometry((p[0]/p[3]+1)/2*this.transform.width+oi,(-p[1]/p[3]+1)/2*this.transform.height+oi),perspectiveRatio:.5+this.transform.cameraToCenterDistance/p[3]*.5}}isOffscreen(t,n,s,u){return s<oi||t>=this.screenRightBoundary||u<oi||n>this.screenBottomBoundary}isInsideGrid(t,n,s,u){return s>=0&&t<this.gridRightBoundary&&u>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=a.identity([]);return a.translate(t,t,[-100,-100,0]),t}}function Jt(l,t,n){return t*(a.EXTENT/(l.tileSize*Math.pow(2,n-l.tileID.overscaledZ)))}class Ti{constructor(t,n,s,u){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):u&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class Pt{constructor(t,n,s,u,p){this.text=new Ti(t?t.text:null,n,s,p),this.icon=new Ti(t?t.icon:null,n,u,p)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class En{constructor(t,n,s){this.text=t,this.icon=n,this.skipFade=s}}class fr{constructor(){this.invProjMatrix=a.create(),this.viewportMatrix=a.create(),this.circles=[]}}class Yr{constructor(t,n,s,u,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=s,this.bucketIndex=u,this.tileID=p}}class Qr{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:s=>s.collisionGroupID===n}}return this.collisionGroups[t]}}function Sn(l,t,n,s,u){const{horizontalAlign:p,verticalAlign:f}=a.getAnchorAlignment(l),_=-(p-.5)*t,y=-(f-.5)*n,v=a.evaluateVariableOffset(l,s);return new a.pointGeometry(_+v[0]*u,y+v[1]*u)}function en(l,t,n,s,u,p){const{x1:f,x2:_,y1:y,y2:v,anchorPointX:E,anchorPointY:M}=l,z=new a.pointGeometry(t,n);return s&&z._rotate(u?p:-p),{x1:f+z.x,y1:y+z.y,x2:_+z.x,y2:v+z.y,anchorPointX:E,anchorPointY:M}}class O{constructor(t,n,s,u,p){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new Tn(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new Qr(u),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,s,u){const p=s.getBucket(n),f=s.latestFeatureIndex;if(!p||!f||n.id!==p.layerIds[0])return;const _=s.collisionBoxArray,y=p.layers[0].layout,v=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),E=s.tileSize/a.EXTENT,M=this.transform.calculatePosMatrix(s.tileID.toUnwrapped()),z=y.get("text-pitch-alignment")==="map",V=y.get("text-rotation-alignment")==="map",$=Jt(s,1,this.transform.zoom),U=Jr(M,z,V,this.transform,$);let H=null;if(z){const ne=ir(M,z,V,this.transform,$);H=a.multiply([],this.transform.labelPlaneMatrix,ne)}this.retainedQueryData[p.bucketInstanceId]=new Yr(p.bucketInstanceId,f,p.sourceLayerIndex,p.index,s.tileID);const Q={bucket:p,layout:y,posMatrix:M,textLabelPlaneMatrix:U,labelToScreenMatrix:H,scale:v,textPixelRatio:E,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:a.evaluateSizeForZoom(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(u)for(const ne of p.sortKeyRanges){const{sortKey:G,symbolInstanceStart:le,symbolInstanceEnd:se}=ne;t.push({sortKey:G,symbolInstanceStart:le,symbolInstanceEnd:se,parameters:Q})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:Q})}attemptAnchorPlacement(t,n,s,u,p,f,_,y,v,E,M,z,V,$,U,H){const Q=[z.textOffset0,z.textOffset1],ne=Sn(t,s,u,Q,p),G=this.collisionIndex.placeCollisionBox(en(n,ne.x,ne.y,f,_,this.transform.angle),M,y,v,E.predicate,H);if((!U||this.collisionIndex.placeCollisionBox(en(U,ne.x,ne.y,f,_,this.transform.angle),M,y,v,E.predicate,H).box.length!==0)&&G.box.length>0){let le;if(this.prevPlacement&&this.prevPlacement.variableOffsets[z.crossTileID]&&this.prevPlacement.placements[z.crossTileID]&&this.prevPlacement.placements[z.crossTileID].text&&(le=this.prevPlacement.variableOffsets[z.crossTileID].anchor),z.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[z.crossTileID]={textOffset:Q,width:s,height:u,anchor:t,textBoxScale:p,prevAnchor:le},this.markUsedJustification(V,t,z,$),V.allowVerticalPlacement&&(this.markUsedOrientation(V,$,z),this.placedOrientations[z.crossTileID]=$),{shift:ne,placedGlyphBoxes:G}}}placeLayerBucketPart(t,n,s){const{bucket:u,layout:p,posMatrix:f,textLabelPlaneMatrix:_,labelToScreenMatrix:y,textPixelRatio:v,holdingForFade:E,collisionBoxArray:M,partiallyEvaluatedTextSize:z,collisionGroup:V}=t.parameters,$=p.get("text-optional"),U=p.get("icon-optional"),H=a.getOverlapMode(p,"text-overlap","text-allow-overlap"),Q=H==="always",ne=a.getOverlapMode(p,"icon-overlap","icon-allow-overlap"),G=ne==="always",le=p.get("text-rotation-alignment")==="map",se=p.get("text-pitch-alignment")==="map",me=p.get("icon-text-fit")!=="none",ge=p.get("symbol-z-order")==="viewport-y",be=Q&&(G||!u.hasIconData()||U),de=G&&(Q||!u.hasTextData()||$);!u.collisionArrays&&M&&u.deserializeCollisionBoxes(M);const Re=(Ce,Be)=>{if(n[Ce.crossTileID])return;if(E)return void(this.placements[Ce.crossTileID]=new En(!1,!1,!1));let st=!1,ht=!1,We=!0,At=null,Mt={box:null,offscreen:null},_t={box:null,offscreen:null},wt=null,zt=null,ai=null,_r=0,nr=0,yr=0;Be.textFeatureIndex?_r=Be.textFeatureIndex:Ce.useRuntimeCollisionCircles&&(_r=Ce.featureIndex),Be.verticalTextFeatureIndex&&(nr=Be.verticalTextFeatureIndex);const Xr=this.retainedQueryData[u.bucketInstanceId].tileID,Yi=this.terrain?(ii,dt)=>this.terrain.getElevation(Xr,ii,dt):null;for(const ii of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const dt=Be[ii];dt&&(dt.elevation=Yi?Yi(dt.anchorPointX,dt.anchorPointY):0)}const zi=Be.textBox;if(zi){const ii=Ct=>{let li=a.WritingMode.horizontal;if(u.allowVerticalPlacement&&!Ct&&this.prevPlacement){const ci=this.prevPlacement.placedOrientations[Ce.crossTileID];ci&&(this.placedOrientations[Ce.crossTileID]=ci,li=ci,this.markUsedOrientation(u,li,Ce))}return li},dt=(Ct,li)=>{if(u.allowVerticalPlacement&&Ce.numVerticalGlyphVertices>0&&Be.verticalTextBox){for(const ci of u.writingModes)if(ci===a.WritingMode.vertical?(Mt=li(),_t=Mt):Mt=Ct(),Mt&&Mt.box&&Mt.box.length)break}else Mt=Ct()};if(p.get("text-variable-anchor")){let Ct=p.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ce.crossTileID]){const Gt=this.prevPlacement.variableOffsets[Ce.crossTileID];Ct.indexOf(Gt.anchor)>0&&(Ct=Ct.filter(Qi=>Qi!==Gt.anchor),Ct.unshift(Gt.anchor))}const li=(Gt,Qi,an)=>{const $s=Gt.x2-Gt.x1,On=Gt.y2-Gt.y1,Ha=Ce.textBoxScale,Us=me&&ne==="never"?Qi:null;let Wr={box:[],offscreen:!1};const ln=H!=="never"?2*Ct.length:Ct.length;for(let cn=0;cn<ln;++cn){const Ho=this.attemptAnchorPlacement(Ct[cn%Ct.length],Gt,$s,On,Ha,le,se,v,f,V,cn>=Ct.length?H:"never",Ce,u,an,Us,Yi);if(Ho&&(Wr=Ho.placedGlyphBoxes,Wr&&Wr.box&&Wr.box.length)){st=!0,At=Ho.shift;break}}return Wr};dt(()=>li(zi,Be.iconBox,a.WritingMode.horizontal),()=>{const Gt=Be.verticalTextBox;return u.allowVerticalPlacement&&!(Mt&&Mt.box&&Mt.box.length)&&Ce.numVerticalGlyphVertices>0&&Gt?li(Gt,Be.verticalIconBox,a.WritingMode.vertical):{box:null,offscreen:null}}),Mt&&(st=Mt.box,We=Mt.offscreen);const ci=ii(Mt&&Mt.box);if(!st&&this.prevPlacement){const Gt=this.prevPlacement.variableOffsets[Ce.crossTileID];Gt&&(this.variableOffsets[Ce.crossTileID]=Gt,this.markUsedJustification(u,Gt.anchor,Ce,ci))}}else{const Ct=(li,ci)=>{const Gt=this.collisionIndex.placeCollisionBox(li,H,v,f,V.predicate,Yi);return Gt&&Gt.box&&Gt.box.length&&(this.markUsedOrientation(u,ci,Ce),this.placedOrientations[Ce.crossTileID]=ci),Gt};dt(()=>Ct(zi,a.WritingMode.horizontal),()=>{const li=Be.verticalTextBox;return u.allowVerticalPlacement&&Ce.numVerticalGlyphVertices>0&&li?Ct(li,a.WritingMode.vertical):{box:null,offscreen:null}}),ii(Mt&&Mt.box&&Mt.box.length)}}if(wt=Mt,st=wt&&wt.box&&wt.box.length>0,We=wt&&wt.offscreen,Ce.useRuntimeCollisionCircles){const ii=u.text.placedSymbolArray.get(Ce.centerJustifiedTextSymbolIndex),dt=a.evaluateSizeForFeature(u.textSizeData,z,ii),Ct=p.get("text-padding");zt=this.collisionIndex.placeCollisionCircles(H,ii,u.lineVertexArray,u.glyphOffsetArray,dt,f,_,y,s,se,V.predicate,Ce.collisionCircleDiameter,Ct,Yi),zt.circles.length&&zt.collisionDetected&&!s&&a.warnOnce("Collisions detected, but collision boxes are not shown"),st=Q||zt.circles.length>0&&!zt.collisionDetected,We=We&&zt.offscreen}if(Be.iconFeatureIndex&&(yr=Be.iconFeatureIndex),Be.iconBox){const ii=dt=>{const Ct=me&&At?en(dt,At.x,At.y,le,se,this.transform.angle):dt;return this.collisionIndex.placeCollisionBox(Ct,ne,v,f,V.predicate,Yi)};_t&&_t.box&&_t.box.length&&Be.verticalIconBox?(ai=ii(Be.verticalIconBox),ht=ai.box.length>0):(ai=ii(Be.iconBox),ht=ai.box.length>0),We=We&&ai.offscreen}const Ar=$||Ce.numHorizontalGlyphVertices===0&&Ce.numVerticalGlyphVertices===0,Wo=U||Ce.numIconVertices===0;if(Ar||Wo?Wo?Ar||(ht=ht&&st):st=ht&&st:ht=st=ht&&st,st&&wt&&wt.box&&this.collisionIndex.insertCollisionBox(wt.box,H,p.get("text-ignore-placement"),u.bucketInstanceId,_t&&_t.box&&nr?nr:_r,V.ID),ht&&ai&&this.collisionIndex.insertCollisionBox(ai.box,ne,p.get("icon-ignore-placement"),u.bucketInstanceId,yr,V.ID),zt&&(st&&this.collisionIndex.insertCollisionCircles(zt.circles,H,p.get("text-ignore-placement"),u.bucketInstanceId,_r,V.ID),s)){const ii=u.bucketInstanceId;let dt=this.collisionCircleArrays[ii];dt===void 0&&(dt=this.collisionCircleArrays[ii]=new fr);for(let Ct=0;Ct<zt.circles.length;Ct+=4)dt.circles.push(zt.circles[Ct+0]),dt.circles.push(zt.circles[Ct+1]),dt.circles.push(zt.circles[Ct+2]),dt.circles.push(zt.collisionDetected?1:0)}if(Ce.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(u.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ce.crossTileID]=new En(st||be,ht||de,We||u.justReloaded),n[Ce.crossTileID]=!0};if(ge){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ce=u.getSortedSymbolIndexes(this.transform.angle);for(let Be=Ce.length-1;Be>=0;--Be){const st=Ce[Be];Re(u.symbolInstances.get(st),u.collisionArrays[st])}}else for(let Ce=t.symbolInstanceStart;Ce<t.symbolInstanceEnd;Ce++)Re(u.symbolInstances.get(Ce),u.collisionArrays[Ce]);if(s&&u.bucketInstanceId in this.collisionCircleArrays){const Ce=this.collisionCircleArrays[u.bucketInstanceId];a.invert(Ce.invProjMatrix,f),Ce.viewportMatrix=this.collisionIndex.getViewportMatrix()}u.justReloaded=!1}markUsedJustification(t,n,s,u){let p;p=u===a.WritingMode.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[a.getAnchorJustification(n)];const f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const _ of f)_>=0&&(t.text.placedSymbolArray.get(_).crossTileID=p>=0&&_!==p?0:s.crossTileID)}markUsedOrientation(t,n,s){const u=n===a.WritingMode.horizontal||n===a.WritingMode.horizontalOnly?n:0,p=n===a.WritingMode.vertical?n:0,f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const _ of f)t.text.placedSymbolArray.get(_).placedOrientation=u;s.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let s=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const u=n?n.symbolFadeChange(t):1,p=n?n.opacities:{},f=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const y in this.placements){const v=this.placements[y],E=p[y];E?(this.opacities[y]=new Pt(E,u,v.text,v.icon),s=s||v.text!==E.text.placed||v.icon!==E.icon.placed):(this.opacities[y]=new Pt(null,u,v.text,v.icon,v.skipFade),s=s||v.text||v.icon)}for(const y in p){const v=p[y];if(!this.opacities[y]){const E=new Pt(v,u,!1,!1);E.isHidden()||(this.opacities[y]=E,s=s||v.text.placed||v.icon.placed)}}for(const y in f)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=f[y]);for(const y in _)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=_[y]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const s={};for(const u of n){const p=u.getBucket(t);p&&u.latestFeatureIndex&&t.id===p.layerIds[0]&&this.updateBucketOpacities(p,s,u.collisionBoxArray)}}updateBucketOpacities(t,n,s){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const u=t.layers[0].layout,p=new Pt(null,0,!1,!1,!0),f=u.get("text-allow-overlap"),_=u.get("icon-allow-overlap"),y=u.get("text-variable-anchor"),v=u.get("text-rotation-alignment")==="map",E=u.get("text-pitch-alignment")==="map",M=u.get("icon-text-fit")!=="none",z=new Pt(null,0,f&&(_||!t.hasIconData()||u.get("icon-optional")),_&&(f||!t.hasTextData()||u.get("text-optional")),!0);!t.collisionArrays&&s&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(s);const V=($,U,H)=>{for(let Q=0;Q<U/4;Q++)$.opacityVertexArray.emplaceBack(H)};for(let $=0;$<t.symbolInstances.length;$++){const U=t.symbolInstances.get($),{numHorizontalGlyphVertices:H,numVerticalGlyphVertices:Q,crossTileID:ne}=U;let G=this.opacities[ne];n[ne]?G=p:G||(G=z,this.opacities[ne]=G),n[ne]=!0;const le=U.numIconVertices>0,se=this.placedOrientations[U.crossTileID],me=se===a.WritingMode.vertical,ge=se===a.WritingMode.horizontal||se===a.WritingMode.horizontalOnly;if(H>0||Q>0){const be=J(G.text);V(t.text,H,me?pe:be),V(t.text,Q,ge?pe:be);const de=G.text.isHidden();[U.rightJustifiedTextSymbolIndex,U.centerJustifiedTextSymbolIndex,U.leftJustifiedTextSymbolIndex].forEach(Be=>{Be>=0&&(t.text.placedSymbolArray.get(Be).hidden=de||me?1:0)}),U.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(U.verticalPlacedTextSymbolIndex).hidden=de||ge?1:0);const Re=this.variableOffsets[U.crossTileID];Re&&this.markUsedJustification(t,Re.anchor,U,se);const Ce=this.placedOrientations[U.crossTileID];Ce&&(this.markUsedJustification(t,"left",U,Ce),this.markUsedOrientation(t,Ce,U))}if(le){const be=J(G.icon),de=!(M&&U.verticalPlacedIconSymbolIndex&&me);U.placedIconSymbolIndex>=0&&(V(t.icon,U.numIconVertices,de?be:pe),t.icon.placedSymbolArray.get(U.placedIconSymbolIndex).hidden=G.icon.isHidden()),U.verticalPlacedIconSymbolIndex>=0&&(V(t.icon,U.numVerticalIconVertices,de?pe:be),t.icon.placedSymbolArray.get(U.verticalPlacedIconSymbolIndex).hidden=G.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const be=t.collisionArrays[$];if(be){let de=new a.pointGeometry(0,0);if(be.textBox||be.verticalTextBox){let Ce=!0;if(y){const Be=this.variableOffsets[ne];Be?(de=Sn(Be.anchor,Be.width,Be.height,Be.textOffset,Be.textBoxScale),v&&de._rotate(E?this.transform.angle:-this.transform.angle)):Ce=!1}be.textBox&&w(t.textCollisionBox.collisionVertexArray,G.text.placed,!Ce||me,de.x,de.y),be.verticalTextBox&&w(t.textCollisionBox.collisionVertexArray,G.text.placed,!Ce||ge,de.x,de.y)}const Re=Boolean(!ge&&be.verticalIconBox);be.iconBox&&w(t.iconCollisionBox.collisionVertexArray,G.icon.placed,Re,M?de.x:0,M?de.y:0),be.verticalIconBox&&w(t.iconCollisionBox.collisionVertexArray,G.icon.placed,!Re,M?de.x:0,M?de.y:0)}}}if(t.sortFeatures(this.transform.angle),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`);if(t.bucketInstanceId in this.collisionCircleArrays){const $=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=$.invProjMatrix,t.placementViewportMatrix=$.viewportMatrix,t.collisionCircleArray=$.circles,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 s=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*s>t}setStale(){this.stale=!0}}function w(l,t,n,s,u){l.emplaceBack(t?1:0,n?1:0,s||0,u||0),l.emplaceBack(t?1:0,n?1:0,s||0,u||0),l.emplaceBack(t?1:0,n?1:0,s||0,u||0),l.emplaceBack(t?1:0,n?1:0,s||0,u||0)}const C=Math.pow(2,25),R=Math.pow(2,24),B=Math.pow(2,17),j=Math.pow(2,16),K=Math.pow(2,9),W=Math.pow(2,8),X=Math.pow(2,1);function J(l){if(l.opacity===0&&!l.placed)return 0;if(l.opacity===1&&l.placed)return 4294967295;const t=l.placed?1:0,n=Math.floor(127*l.opacity);return n*C+t*R+n*B+t*j+n*K+t*W+n*X+t}const pe=0;class ve{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,s,u,p){const f=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(f,u,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,f.sort((_,y)=>_.sortKey-y.sortKey));this._currentPartIndex<f.length;)if(n.placeLayerBucketPart(f[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,p())return!0;return!1}}class he{constructor(t,n,s,u,p,f,_,y){this.placement=new O(t,n,f,_,y),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=u,this._showCollisionBoxes=p,this._done=!1}isDone(){return this._done}continuePlacement(t,n,s){const u=a.exported.now(),p=()=>{const f=a.exported.now()-u;return!this._forceFullPlacement&&f>2};for(;this._currentPlacementIndex>=0;){const f=n[t[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(f.type==="symbol"&&(!f.minzoom||f.minzoom<=_)&&(!f.maxzoom||f.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new ve(f)),this._inProgressLayer.continuePlacement(s[f.source],this.placement,this._showCollisionBoxes,f,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Ve=512/a.EXTENT/2;class qe{constructor(t,n,s){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=s;for(let u=0;u<n.length;u++){const p=n.get(u),f=p.key;this.indexedSymbolInstances[f]||(this.indexedSymbolInstances[f]=[]),this.indexedSymbolInstances[f].push({crossTileID:p.crossTileID,coord:this.getScaledCoordinates(p,t)})}}getScaledCoordinates(t,n){const s=Ve/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*a.EXTENT+t.anchorX)*s),y:Math.floor((n.canonical.y*a.EXTENT+t.anchorY)*s)}}findMatches(t,n,s){const u=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let p=0;p<t.length;p++){const f=t.get(p);if(f.crossTileID)continue;const _=this.indexedSymbolInstances[f.key];if(!_)continue;const y=this.getScaledCoordinates(f,n);for(const v of _)if(Math.abs(v.coord.x-y.x)<=u&&Math.abs(v.coord.y-y.y)<=u&&!s[v.crossTileID]){s[v.crossTileID]=!0,f.crossTileID=v.crossTileID;break}}}}class Le{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Je{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const s in this.indexes){const u=this.indexes[s],p={};for(const f in u){const _=u[f];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),p[_.tileID.key]=_}this.indexes[s]=p}this.lng=t}addBucket(t,n,s){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const u=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const f=this.indexes[p];if(Number(p)>t.overscaledZ)for(const _ in f){const y=f[_];y.tileID.isChildOf(t)&&y.findMatches(n.symbolInstances,t,u)}else{const _=f[t.scaledTo(Number(p)).key];_&&_.findMatches(n.symbolInstances,t,u)}}for(let p=0;p<n.symbolInstances.length;p++){const f=n.symbolInstances.get(p);f.crossTileID||(f.crossTileID=s.generate(),u[f.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new qe(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const s in n.indexedSymbolInstances)for(const u of n.indexedSymbolInstances[s])delete this.usedCrossTileIDs[t][u.crossTileID]}removeStaleBuckets(t){let n=!1;for(const s in this.indexes){const u=this.indexes[s];for(const p in u)t[u[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,u[p]),delete u[p],n=!0)}return n}}class Qe{constructor(){this.layerIndexes={},this.crossTileIDs=new Le,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,s){let u=this.layerIndexes[t.id];u===void 0&&(u=this.layerIndexes[t.id]=new Je);let p=!1;const f={};u.handleWrapJump(s);for(const _ of n){const y=_.getBucket(t);y&&t.id===y.layerIds[0]&&(y.bucketInstanceId||(y.bucketInstanceId=++this.maxBucketInstanceId),u.addBucket(_.tileID,y,this.crossTileIDs)&&(p=!0),f[y.bucketInstanceId]=!0)}return u.removeStaleBuckets(f)&&(p=!0),p}pruneUnusedLayers(t){const n={};t.forEach(s=>{n[s]=!0});for(const s in this.layerIndexes)n[s]||delete this.layerIndexes[s]}}var vt=a.createLayout([{name:"a_pos",type:"Int16",components:2}]);class it extends a.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.renderHistory=[],this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,this.renderHistorySize=t._cache.max,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;for(const t in this._tiles){const n=this._tiles[t];n.textures.forEach(s=>s.destroy()),n.textures=[]}}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];for(const s of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))this._renderableTilesKeys.push(s.key),this._tiles[s.key]||(s.posMatrix=new Float64Array(16),a.ortho(s.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),this._tiles[s.key]=new Dr(s,this.tileSize))}removeOutdated(t){const n={};this.renderHistory=this.renderHistory.filter((s,u)=>this.renderHistory.indexOf(s)===u).slice(0,this.renderHistorySize);for(const s of this._renderableTilesKeys)n[s]=!0;for(const s of this.renderHistory)n[s]=!0;for(const s in this._tiles)n[s]||(this._tiles[s].clearTextures(t),delete this._tiles[s])}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const s of this._renderableTilesKeys){const u=this._tiles[s].tileID;if(u.canonical.equals(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16),a.ortho(p.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),n[s]=p}else if(u.canonical.isChildOf(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const f=u.canonical.z-t.canonical.z,_=u.canonical.x-(u.canonical.x>>f<<f),y=u.canonical.y-(u.canonical.y>>f<<f),v=a.EXTENT>>f;a.ortho(p.posMatrix,0,v,0,v,0,1),a.translate(p.posMatrix,p.posMatrix,[-_*v,-y*v,0]),n[s]=p}else if(t.canonical.isChildOf(u.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const f=t.canonical.z-u.canonical.z,_=t.canonical.x-(t.canonical.x>>f<<f),y=t.canonical.y-(t.canonical.y>>f<<f),v=a.EXTENT>>f;a.ortho(p.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),a.translate(p.posMatrix,p.posMatrix,[_*v,y*v,0]),a.scale(p.posMatrix,p.posMatrix,[1/2**f,1/2**f,0]),n[s]=p}}return n}getSourceTile(t,n){const s=this.sourceCache._source;let u=t.overscaledZ-this.deltaZoom;if(u>s.maxzoom&&(u=s.maxzoom),u<s.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(u).key);let p=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!p||!p.dem)&&n)for(;u>=s.minzoom&&(!p||!p.dem);)p=this.sourceCache.getTileByID(t.scaledTo(u--).key);return p}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeLoaded>=t)}}class ut{constructor(t,n,s){this.style=t,this.sourceCache=new it(n),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.elevationOffset=typeof s.elevationOffset=="number"?s.elevationOffset:450,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024,this.clearRerenderCache()}getDEMElevation(t,n,s,u=a.EXTENT){if(!(n>=0&&n<u&&s>=0&&s<u))return this.elevationOffset;let p=0;const f=this.getTerrainData(t);if(f.tile&&f.tile.dem){const _=a.transformMat4$1([],[n/u*a.EXTENT,s/u*a.EXTENT],f.u_terrain_matrix),y=[_[0]*f.tile.dem.dim,_[1]*f.tile.dem.dim],v=[Math.floor(y[0]),Math.floor(y[1])],E=f.tile.dem.get(v[0],v[1]),M=f.tile.dem.get(v[0],v[1]+1),z=f.tile.dem.get(v[0]+1,v[1]),V=f.tile.dem.get(v[0]+1,v[1]+1);p=a.number(a.number(E,M,y[0]-v[0]),a.number(z,V,y[0]-v[0]),y[1]-v[1])}return p}rememberForRerender(t,n){for(const s in this.sourceCache._tiles){const u=this.sourceCache._tiles[s];(u.tileID.equals(n)||u.tileID.isChildOf(n))&&(t===this.sourceCache.sourceCache.id&&(u.timeLoaded=Date.now()),this._rerender[t]=this._rerender[t]||{},this._rerender[t][u.tileID.key]=!0)}}needsRerender(t,n){return this._rerender[t]&&this._rerender[t][n.key]}clearRerenderCache(){this._rerender={}}getElevation(t,n,s,u=a.EXTENT){return(this.getDEMElevation(t,n,s,u)+this.elevationOffset)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const u=this.style.map.painter.context,p=new a.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Ue(u,p,u.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Ue(u,new a.RGBAImage({width:1,height:1}),u.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=a.identity([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const u=this.style.map.painter.context;n.demTexture=this.style.map.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new Ue(u,n.dem.getPixels(),u.gl.RGBA,{premultiply:!1}),n.demTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const s=n&&n+n.tileID.key+t.key;if(s&&!this._demMatrixCache[s]){const u=this.sourceCache.sourceCache._source.maxzoom;let p=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=u?p=t.canonical.z-u:a.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=t.canonical.x-(t.canonical.x>>p<<p),_=t.canonical.y-(t.canonical.y>>p<<p),y=a.fromScaling(new Float64Array(16),[1/(a.EXTENT<<p),1/(a.EXTENT<<p),0]);a.translate(y,y,[f*a.EXTENT,_*a.EXTENT,0]),this._demMatrixCache[t.key]={matrix:y,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_offset:this.elevationOffset,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getRTTFramebuffer(){const t=this.style.map.painter;if(!this._rttFramebuffer){const n=this.sourceCache.tileSize*this.qualityFactor;this._rttFramebuffer=t.context.createFramebuffer(n,n,!0),this._rttFramebuffer.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,n,n))}return this._rttFramebuffer}getFramebuffer(t){const n=this.style.map.painter,s=n.width/devicePixelRatio,u=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===u||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Ue(n.context,{width:s,height:u,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 Ue(n.context,{width:s,height:u,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(s,u,!0),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,s,u))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.style.map.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let p=0,f=0;p<this._coordsTextureSize;p++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)n[f+0]=255&_,n[f+1]=255&p,n[f+2]=_>>8<<4|p>>8,n[f+3]=0;const s=new a.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),u=new Ue(t,s,t.gl.RGBA,{premultiply:!1});return u.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=u,u}pointCoordinate(t){const n=new Uint8Array(4),s=this.style.map.painter,u=s.context,p=u.gl;u.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),p.readPixels(t.x,s.height/devicePixelRatio-t.y-1,1,1,p.RGBA,p.UNSIGNED_BYTE,n),u.bindFramebuffer.set(null);const f=n[0]+(n[2]>>4<<8),_=n[1]+((15&n[2])<<8),y=this.coordsIndex[255-n[3]],v=y&&this.sourceCache.getTileByID(y);if(!v)return null;const E=this._coordsTextureSize,M=(1<<v.tileID.canonical.z)*E;return new a.MercatorCoordinate((v.tileID.canonical.x*E+f)/M,(v.tileID.canonical.y*E+_)/M,this.getElevation(v.tileID,f,_,E))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.style.map.painter.context,n=new a.PosArray,s=new a.TriangleIndexArray,u=this.meshSize,p=a.EXTENT/u,f=u*u;for(let _=0;_<=u;_++)for(let y=0;y<=u;y++)n.emplaceBack(y*p,_*p);for(let _=0;_<f;_+=u+1)for(let y=0;y<u;y++)s.emplaceBack(y+_,u+y+_+1,u+y+_+2),s.emplaceBack(y+_,u+y+_+2,y+_+1);return this._mesh={indexBuffer:t.createIndexBuffer(s),vertexBuffer:t.createVertexBuffer(n,vt.members),segments:a.SegmentVector.simpleSegment(0,0,n.length,s.length)},this._mesh}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,s={minElevation:null,maxElevation:null};return n&&n.dem&&(s.minElevation=(n.dem.min+this.elevationOffset)*this.exaggeration,s.maxElevation=(n.dem.max+this.elevationOffset)*this.exaggeration),s}}const bt=(l,t)=>a.emitValidationErrors(l,t&&t.filter(n=>n.identifier!=="source.canvas")),kt=a.pick(yt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),si=a.pick(yt,["setCenter","setZoom","setBearing","setPitch"]),$t=function(){const l={},t=a.spec.$version;for(const n in a.spec.$root){const s=a.spec.$root[n];if(s.required){let u=null;u=n==="version"?t:s.type==="array"?[]:{},u!=null&&(l[n]=u)}}return l}();class _i extends a.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new Wi(vn(),this),this.imageManager=new Ke,this.imageManager.setEventedParent(this),this.glyphManager=new at(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new ur(256,512),this.crossTileSymbolIndex=new Qe,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new a.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",a.getReferrer());const s=this;this._rtlTextPluginCallback=_i.registerForPluginStateChange(u=>{s.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:u.pluginStatus,pluginURL:u.pluginURL},(p,f)=>{if(a.triggerPluginCompletionEvent(p),f&&f.every(_=>_))for(const _ in s.sourceCaches)s.sourceCaches[_].reload()})}),this.on("data",u=>{if(u.dataType!=="source"||u.sourceDataType!=="metadata")return;const p=this.sourceCaches[u.sourceId];if(!p)return;const f=p.getSource();if(f&&f.vectorLayerIds)for(const _ in this._layers){const y=this._layers[_];y.source===f.id&&this._validateLayer(y)}})}loadURL(t,n={}){this.fire(new a.Event("dataloading",{dataType:"style"}));const s=typeof n.validate!="boolean"||n.validate,u=this.map._requestManager.transformRequest(t,a.ResourceType.Style);this._request=a.getJSON(u,(p,f)=>{this._request=null,p?this.fire(new a.ErrorEvent(p)):f&&this._load(f,s)})}loadJSON(t,n={}){this.fire(new a.Event("dataloading",{dataType:"style"})),this._request=a.exported.frame(()=>{this._request=null,this._load(t,n.validate!==!1)})}loadEmpty(){this.fire(new a.Event("dataloading",{dataType:"style"})),this._load($t,!1)}_load(t,n){if(n&&bt(this,a.validateStyle(t)))return;this._loaded=!0,this.stylesheet=t;for(const u in t.sources)this.addSource(u,t.sources[u],{validate:!1});t.sprite?this._loadSprite(t.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(t.glyphs);const s=Wn(this.stylesheet.layers);this._order=s.map(u=>u.id),this._layers={},this._serializedLayers={};for(let u of s)u=a.createStyleLayer(u),u.setEventedParent(this,{layer:{id:u.id}}),this._layers[u.id]=u,this._serializedLayers[u.id]=u.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new Kt(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new a.Event("data",{dataType:"style"})),this.fire(new a.Event("style.load"))}_loadSprite(t){this._spriteRequest=function(n,s,u,p){let f,_,y;const v=u>1?"@2x":"";let E=a.getJSON(s.transformRequest(s.normalizeSpriteURL(n,v,".json"),a.ResourceType.SpriteJSON),(V,$)=>{E=null,y||(y=V,f=$,z())}),M=a.getImage(s.transformRequest(s.normalizeSpriteURL(n,v,".png"),a.ResourceType.SpriteImage),(V,$)=>{M=null,y||(y=V,_=$,z())});function z(){if(y)p(y);else if(f&&_){const V=a.exported.getImageData(_),$={};for(const U in f){const{width:H,height:Q,x:ne,y:G,sdf:le,pixelRatio:se,stretchX:me,stretchY:ge,content:be}=f[U],de=new a.RGBAImage({width:H,height:Q});a.RGBAImage.copy(V,de,{x:ne,y:G},{x:0,y:0},{width:H,height:Q}),$[U]={data:de,pixelRatio:se,sdf:le,stretchX:me,stretchY:ge,content:be}}p(null,$)}}return{cancel(){E&&(E.cancel(),E=null),M&&(M.cancel(),M=null)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(n,s)=>{if(this._spriteRequest=null,n)this.fire(new a.ErrorEvent(n));else if(s)for(const u in s)this.imageManager.addImage(u,s[u]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))})}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const s=t.sourceLayer;if(!s)return;const u=n.getSource();(u.type==="geojson"||u.vectorLayerIds&&u.vectorLayerIds.indexOf(s)===-1)&&this.fire(new a.ErrorEvent(new Error(`Source layer "${s}" does not exist on source "${u.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const n=[];for(const s of t){const u=this._layers[s];u.type!=="custom"&&n.push(u.serialize())}return n}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].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(this._changed){const u=Object.keys(this._updatedLayers),p=Object.keys(this._removedLayers);(u.length||p.length)&&this._updateWorkerLayers(u,p);for(const f in this._updatedSources){const _=this._updatedSources[f];if(_==="reload")this._reloadSource(f);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(f)}}this._updateTilesForChangedImages();for(const f in this._updatedPaintProps)this._layers[f].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const s={};for(const u in this.sourceCaches){const p=this.sourceCaches[u];s[u]=p.used,p.used=!1}for(const u of this._order){const p=this._layers[u];p.recalculate(t,this._availableImages),!p.isHidden(t.zoom)&&p.source&&(this.sourceCaches[p.source].used=!0)}for(const u in s){const p=this.sourceCaches[u];s[u]!==p.used&&p.fire(new a.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:u}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new a.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setTerrain(t){if(this._checkLoaded(),this._terrainDataCallback&&this.off("data",this._terrainDataCallback),this._terrainfreezeElevationCallback&&this.map.off("freezeElevation",this._terrainfreezeElevationCallback),t){const n=this.sourceCaches[t.source];if(!n)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);this.terrain=new ut(this,n,t),this.map.transform.updateElevation(this.terrain),this._terrainfreezeElevationCallback=s=>{s.freeze?this.map.transform.freezeElevation=!0:(this.map.transform.freezeElevation=!1,this.map.transform.recalculateZoom(this.terrain))},this._terrainDataCallback=s=>{s.tile&&(s.sourceId===t.source?(this.map.transform.updateElevation(this.terrain),this.terrain.rememberForRerender(s.sourceId,s.tile.tileID)):s.source.type==="geojson"&&this.terrain.rememberForRerender(s.sourceId,s.tile.tileID))},this.on("data",this._terrainDataCallback),this.map.on("freezeElevation",this._terrainfreezeElevationCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.map.transform.updateElevation(this.terrain);this.map.fire(new a.Event("terrain",{terrain:t}))}setState(t){if(this._checkLoaded(),bt(this,a.validateStyle(t)))return!1;(t=a.clone$1(t)).layers=Wn(t.layers);const n=function(u,p){if(!u)return[{command:yt.setStyle,args:[p]}];let f=[];try{if(!ue(u.version,p.version))return[{command:yt.setStyle,args:[p]}];ue(u.center,p.center)||f.push({command:yt.setCenter,args:[p.center]}),ue(u.zoom,p.zoom)||f.push({command:yt.setZoom,args:[p.zoom]}),ue(u.bearing,p.bearing)||f.push({command:yt.setBearing,args:[p.bearing]}),ue(u.pitch,p.pitch)||f.push({command:yt.setPitch,args:[p.pitch]}),ue(u.sprite,p.sprite)||f.push({command:yt.setSprite,args:[p.sprite]}),ue(u.glyphs,p.glyphs)||f.push({command:yt.setGlyphs,args:[p.glyphs]}),ue(u.transition,p.transition)||f.push({command:yt.setTransition,args:[p.transition]}),ue(u.light,p.light)||f.push({command:yt.setLight,args:[p.light]});const _={},y=[];(function(E,M,z,V){let $;for($ in M=M||{},E=E||{})Object.prototype.hasOwnProperty.call(E,$)&&(Object.prototype.hasOwnProperty.call(M,$)||Fr($,z,V));for($ in M)Object.prototype.hasOwnProperty.call(M,$)&&(Object.prototype.hasOwnProperty.call(E,$)?ue(E[$],M[$])||(E[$].type==="geojson"&&M[$].type==="geojson"&&Hn(E,M,$)?z.push({command:yt.setGeoJSONSourceData,args:[$,M[$].data]}):Or($,M,z,V)):dr($,M,z))})(u.sources,p.sources,y,_);const v=[];u.layers&&u.layers.forEach(E=>{_[E.source]?f.push({command:yt.removeLayer,args:[E.id]}):v.push(E)}),f=f.concat(y),function(E,M,z){M=M||[];const V=(E=E||[]).map(Tr),$=M.map(Tr),U=E.reduce(wn,{}),H=M.reduce(wn,{}),Q=V.slice(),ne=Object.create(null);let G,le,se,me,ge,be,de;for(G=0,le=0;G<V.length;G++)se=V[G],Object.prototype.hasOwnProperty.call(H,se)?le++:(z.push({command:yt.removeLayer,args:[se]}),Q.splice(Q.indexOf(se,le),1));for(G=0,le=0;G<$.length;G++)se=$[$.length-1-G],Q[Q.length-1-G]!==se&&(Object.prototype.hasOwnProperty.call(U,se)?(z.push({command:yt.removeLayer,args:[se]}),Q.splice(Q.lastIndexOf(se,Q.length-le),1)):le++,be=Q[Q.length-G],z.push({command:yt.addLayer,args:[H[se],be]}),Q.splice(Q.length-G,0,se),ne[se]=!0);for(G=0;G<$.length;G++)if(se=$[G],me=U[se],ge=H[se],!ne[se]&&!ue(me,ge))if(ue(me.source,ge.source)&&ue(me["source-layer"],ge["source-layer"])&&ue(me.type,ge.type)){for(de in wr(me.layout,ge.layout,z,se,null,yt.setLayoutProperty),wr(me.paint,ge.paint,z,se,null,yt.setPaintProperty),ue(me.filter,ge.filter)||z.push({command:yt.setFilter,args:[se,ge.filter]}),ue(me.minzoom,ge.minzoom)&&ue(me.maxzoom,ge.maxzoom)||z.push({command:yt.setLayerZoomRange,args:[se,ge.minzoom,ge.maxzoom]}),me)Object.prototype.hasOwnProperty.call(me,de)&&de!=="layout"&&de!=="paint"&&de!=="filter"&&de!=="metadata"&&de!=="minzoom"&&de!=="maxzoom"&&(de.indexOf("paint.")===0?wr(me[de],ge[de],z,se,de.slice(6),yt.setPaintProperty):ue(me[de],ge[de])||z.push({command:yt.setLayerProperty,args:[se,de,ge[de]]}));for(de in ge)Object.prototype.hasOwnProperty.call(ge,de)&&!Object.prototype.hasOwnProperty.call(me,de)&&de!=="layout"&&de!=="paint"&&de!=="filter"&&de!=="metadata"&&de!=="minzoom"&&de!=="maxzoom"&&(de.indexOf("paint.")===0?wr(me[de],ge[de],z,se,de.slice(6),yt.setPaintProperty):ue(me[de],ge[de])||z.push({command:yt.setLayerProperty,args:[se,de,ge[de]]}))}else z.push({command:yt.removeLayer,args:[se]}),be=Q[Q.lastIndexOf(se)+1],z.push({command:yt.addLayer,args:[ge,be]})}(v,p.layers,f)}catch(_){console.warn("Unable to compute style diff:",_),f=[{command:yt.setStyle,args:[p]}]}return f}(this.serialize(),t).filter(u=>!(u.command in si));if(n.length===0)return!1;const s=n.filter(u=>!(u.command in kt));if(s.length>0)throw new Error(`Unimplemented: ${s.map(u=>u.command).join(", ")}.`);return n.forEach(u=>{u.command!=="setTransition"&&this[u.command].apply(this,u.args)}),this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new a.ErrorEvent(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 a.ErrorEvent(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("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,s={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(a.validateStyle.source,`sources.${t}`,n,null,s))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const u=this.sourceCaches[t]=new Mi(t,n,this.dispatcher);u.style=this,u.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:u.serialize(),sourceId:t})),u.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const s in this._layers)if(this._layers[s].source===t)return this.fire(new a.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${s}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new a.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const s=this.sourceCaches[t].getSource();if(s.type!=="geojson")throw new Error(`geojsonSource.type is ${s.type}, which is !== 'geojson`);s.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,s={}){this._checkLoaded();const u=t.id;if(this.getLayer(u))return void this.fire(new a.ErrorEvent(new Error(`Layer "${u}" already exists on this map.`)));let p;if(t.type==="custom"){if(bt(this,a.validateCustomStyleLayer(t)))return;p=a.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(u,t.source),t=a.clone$1(t),t=a.extend(t,{source:u})),this._validate(a.validateStyle.layer,`layers.${u}`,t,{arrayIndex:-1},s))return;p=a.createStyleLayer(t),this._validateLayer(p),p.setEventedParent(this,{layer:{id:u}}),this._serializedLayers[p.id]=p.serialize()}const f=n?this._order.indexOf(n):this._order.length;if(n&&f===-1)this.fire(new a.ErrorEvent(new Error(`Cannot add layer "${u}" before non-existing layer "${n}".`)));else{if(this._order.splice(f,0,u),this._layerOrderChanged=!0,this._layers[u]=p,this._removedLayers[u]&&p.source&&p.type!=="custom"){const _=this._removedLayers[u];delete this._removedLayers[u],_.type!==p.type?this._updatedSources[p.source]="clear":(this._updatedSources[p.source]="reload",this.sourceCaches[p.source].pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new a.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const s=this._order.indexOf(t);this._order.splice(s,1);const u=n?this._order.indexOf(n):this._order.length;n&&u===-1?this.fire(new a.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(u,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new a.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const s=this._order.indexOf(t);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,s){this._checkLoaded();const u=this.getLayer(t);u?u.minzoom===n&&u.maxzoom===s||(n!=null&&(u.minzoom=n),s!=null&&(u.maxzoom=s),this._updateLayer(u)):this.fire(new a.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,s={}){this._checkLoaded();const u=this.getLayer(t);if(u){if(!ue(u.filter,n))return n==null?(u.filter=void 0,void this._updateLayer(u)):void(this._validate(a.validateStyle.filter,`layers.${u.id}.filter`,n,null,s)||(u.filter=a.clone$1(n),this._updateLayer(u)))}else this.fire(new a.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return a.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,s,u={}){this._checkLoaded();const p=this.getLayer(t);p?ue(p.getLayoutProperty(n),s)||(p.setLayoutProperty(n,s,u),this._updateLayer(p)):this.fire(new a.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const s=this.getLayer(t);if(s)return s.getLayoutProperty(n);this.fire(new a.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,s,u={}){this._checkLoaded();const p=this.getLayer(t);p?ue(p.getPaintProperty(n),s)||(p.setPaintProperty(n,s,u)&&this._updateLayer(p),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new a.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const s=t.source,u=t.sourceLayer,p=this.sourceCaches[s];if(p===void 0)return void this.fire(new a.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const f=p.getSource().type;f==="geojson"&&u?this.fire(new a.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):f!=="vector"||u?(t.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),p.setFeatureState(u,t.id,n)):this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const s=t.source,u=this.sourceCaches[s];if(u===void 0)return void this.fire(new a.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const p=u.getSource().type,f=p==="vector"?t.sourceLayer:void 0;p!=="vector"||f?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new a.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):u.removeFeatureState(f,t.id,n):this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,s=t.sourceLayer,u=this.sourceCaches[n];if(u!==void 0)return u.getSource().type!=="vector"||s?(t.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),u.getFeatureState(s,t.id)):void this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new a.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return a.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return a.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:a.mapObject(this.sourceCaches,t=>t.serialize()),layers:this._serializeLayers(this._order)},t=>t!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=f=>this._layers[f].type==="fill-extrusion",s={},u=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(n(_)){s[_]=f;for(const y of t){const v=y[_];if(v)for(const E of v)u.push(E)}}}u.sort((f,_)=>_.intersectionZ-f.intersectionZ);const p=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(n(_))for(let y=u.length-1;y>=0;y--){const v=u[y].feature;if(s[v.layer.id]<f)break;p.push(v),u.pop()}else for(const y of t){const v=y[_];if(v)for(const E of v)p.push(E.feature)}}return p}queryRenderedFeatures(t,n,s){n&&n.filter&&this._validate(a.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const u={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new a.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const f of n.layers){const _=this._layers[f];if(!_)return this.fire(new a.ErrorEvent(new Error(`The layer '${f}' does not exist in the map's style and cannot be queried for features.`))),[];u[_.source]=!0}}const p=[];n.availableImages=this._availableImages;for(const f in this.sourceCaches)n.layers&&!u[f]||p.push(yn(this.sourceCaches[f],this._layers,this._serializedLayers,t,n,s));return this.placement&&p.push(function(f,_,y,v,E,M,z){const V={},$=M.queryRenderedSymbols(v),U=[];for(const H of Object.keys($).map(Number))U.push(z[H]);U.sort(pr);for(const H of U){const Q=H.featureIndex.lookupSymbolFeatures($[H.bucketInstanceId],_,H.bucketIndex,H.sourceLayerIndex,E.filter,E.layers,E.availableImages,f);for(const ne in Q){const G=V[ne]=V[ne]||[],le=Q[ne];le.sort((se,me)=>{const ge=H.featureSortOrder;if(ge){const be=ge.indexOf(se.featureIndex);return ge.indexOf(me.featureIndex)-be}return me.featureIndex-se.featureIndex});for(const se of le)G.push(se)}}for(const H in V)V[H].forEach(Q=>{const ne=Q.feature,G=y[f[H].source].getFeatureState(ne.layer["source-layer"],ne.id);ne.source=ne.layer.source,ne.layer["source-layer"]&&(ne.sourceLayer=ne.layer["source-layer"]),ne.state=G});return V}(this._layers,this._serializedLayers,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}querySourceFeatures(t,n){n&&n.filter&&this._validate(a.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const s=this.sourceCaches[t];return s?function(u,p){const f=u.getRenderableIds().map(v=>u.getTileByID(v)),_=[],y={};for(let v=0;v<f.length;v++){const E=f[v],M=E.tileID.canonical.key;y[M]||(y[M]=!0,E.querySourceFeatures(_,p))}return _}(s,n):[]}addSourceType(t,n,s){return _i.getSourceType(t)?s(new Error(`A source type called "${t}" already exists.`)):(_i.setSourceType(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},s):s(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const s=this.light.getLight();let u=!1;for(const f in t)if(!ue(t[f],s[f])){u=!0;break}if(!u)return;const p={now:a.exported.now(),transition:a.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(p)}_validate(t,n,s,u,p={}){return(!p||p.validate!==!1)&&bt(this,t.call(a.validateStyle,a.extend({key:n,style:this.serialize(),value:s,styleSpec:a.spec},u)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const n=this.sourceCaches[t];n.setEventedParent(null),n.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t,this.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,s,u,p=!1){let f=!1,_=!1;const y={};for(const v of this._order){const E=this._layers[v];if(E.type!=="symbol")continue;if(!y[E.source]){const z=this.sourceCaches[E.source];y[E.source]=z.getRenderableIds(!0).map(V=>z.getTileByID(V)).sort((V,$)=>$.tileID.overscaledZ-V.tileID.overscaledZ||(V.tileID.isLessThan($.tileID)?-1:1))}const M=this.crossTileSymbolIndex.addLayer(E,y[E.source],t.center.lng);f=f||M}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.exported.now(),t.zoom))&&(this.pauseablePlacement=new he(t,this.terrain,this._order,p,n,s,u,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.exported.now()),_=!0),f&&this.pauseablePlacement.placement.setStale()),_||f)for(const v of this._order){const E=this._layers[v];E.type==="symbol"&&this.placement.updateLayerOpacities(E,y[E.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,s){this.imageManager.getImages(n.icons,s),this._updateTilesForChangedImages();const u=this.sourceCaches[n.source];u&&u.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,s){this.glyphManager.getGlyphs(n.stacks,s)}getResource(t,n,s){return a.makeRequest(n,s)}}_i.getSourceType=function(l){return gn[l]},_i.setSourceType=function(l,t){gn[l]=t},_i.registerForPluginStateChange=a.registerForPluginStateChange;var In="attribute vec2 a_pos;uniform mat4 u_matrix;varying vec2 v_texture_pos;varying float v_depth;void main() {v_texture_pos=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);v_depth=gl_Position.z/gl_Position.w;}";const Kn={prelude:Dt(`#ifdef GL_ES
3
3
  precision mediump float;
4
4
  #else
5
5
  #if !defined(lowp)
@@ -53,15 +53,15 @@ vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=frac
53
53
  #else
54
54
  return 0.0;
55
55
  #endif
56
- }`),background:Rt(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
56
+ }`),background:Dt(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
57
57
  #ifdef OVERDRAW_INSPECTOR
58
58
  gl_FragColor=vec4(1.0);
59
59
  #endif
60
- }`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:Rt(`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;varying vec2 v_pos_a;varying 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=texture2D(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=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
60
+ }`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:Dt(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying 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=texture2D(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=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
61
61
  #ifdef OVERDRAW_INSPECTOR
62
62
  gl_FragColor=vec4(1.0);
63
63
  #endif
64
- }`,"uniform mat4 u_matrix;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;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);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:Rt(`varying vec3 v_data;varying float v_visibility;
64
+ }`,"uniform mat4 u_matrix;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;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:Dt(`varying vec3 v_data;varying float v_visibility;
65
65
  #pragma mapbox: define highp vec4 color
66
66
  #pragma mapbox: define mediump float radius
67
67
  #pragma mapbox: define lowp float blur
@@ -97,7 +97,7 @@ void main(void) {
97
97
  #pragma mapbox: initialize highp vec4 stroke_color
98
98
  #pragma mapbox: initialize mediump float stroke_width
99
99
  #pragma mapbox: initialize lowp float stroke_opacity
100
- vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);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;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:Rt("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Rt(`uniform highp float u_intensity;varying vec2 v_extrude;
100
+ vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);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;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:Dt("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Dt(`uniform highp float u_intensity;varying vec2 v_extrude;
101
101
  #pragma mapbox: define highp float weight
102
102
  #define GAUSS_COEF 0.3989422804014327
103
103
  void main() {
@@ -114,11 +114,11 @@ const highp float ZERO=1.0/255.0/16.0;
114
114
  void main(void) {
115
115
  #pragma mapbox: initialize highp float weight
116
116
  #pragma mapbox: initialize mediump float radius
117
- vec2 unscaled_extrude=vec2(mod(a_pos,2.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;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:Rt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
117
+ vec2 unscaled_extrude=vec2(mod(a_pos,2.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;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:Dt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
118
118
  #ifdef OVERDRAW_INSPECTOR
119
119
  gl_FragColor=vec4(0.0);
120
120
  #endif
121
- }`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying 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:Rt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Rt("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);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);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;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;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:Rt("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:Rt(`#pragma mapbox: define highp vec4 color
121
+ }`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:Dt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Dt("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);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);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;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;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:Dt("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:Dt(`#pragma mapbox: define highp vec4 color
122
122
  #pragma mapbox: define lowp float opacity
123
123
  void main() {
124
124
  #pragma mapbox: initialize highp vec4 color
@@ -133,7 +133,7 @@ gl_FragColor=vec4(1.0);
133
133
  void main() {
134
134
  #pragma mapbox: initialize highp vec4 color
135
135
  #pragma mapbox: initialize lowp float opacity
136
- gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:Rt(`varying vec2 v_pos;
136
+ gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:Dt(`varying vec2 v_pos;
137
137
  #pragma mapbox: define highp vec4 outline_color
138
138
  #pragma mapbox: define lowp float opacity
139
139
  void main() {
@@ -149,7 +149,7 @@ gl_FragColor=vec4(1.0);
149
149
  void main() {
150
150
  #pragma mapbox: initialize highp vec4 outline_color
151
151
  #pragma mapbox: initialize lowp float opacity
152
- gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:Rt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
152
+ gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:Dt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
153
153
  #pragma mapbox: define lowp float opacity
154
154
  #pragma mapbox: define lowp vec4 pattern_from
155
155
  #pragma mapbox: define lowp vec4 pattern_to
@@ -173,7 +173,7 @@ void main() {
173
173
  #pragma mapbox: initialize mediump vec4 pattern_to
174
174
  #pragma mapbox: initialize lowp float pixel_ratio_from
175
175
  #pragma mapbox: initialize lowp float pixel_ratio_to
176
- 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=u_matrix*vec4(a_pos,0,1);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;}`),fillPattern:Rt(`#ifdef GL_ES
176
+ 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=u_matrix*vec4(a_pos,0,1);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;}`),fillPattern:Dt(`#ifdef GL_ES
177
177
  precision highp float;
178
178
  #endif
179
179
  uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
@@ -200,7 +200,7 @@ void main() {
200
200
  #pragma mapbox: initialize mediump vec4 pattern_to
201
201
  #pragma mapbox: initialize lowp float pixel_ratio_from
202
202
  #pragma mapbox: initialize lowp float pixel_ratio_to
203
- 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=u_matrix*vec4(a_pos,0,1);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:Rt(`varying vec4 v_color;void main() {gl_FragColor=v_color;
203
+ 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=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:Dt(`varying vec4 v_color;void main() {gl_FragColor=v_color;
204
204
  #ifdef OVERDRAW_INSPECTOR
205
205
  gl_FragColor=vec4(1.0);
206
206
  #endif
@@ -222,7 +222,7 @@ float baseDelta=10.0;float ele=get_elevation(a_centroid);
222
222
  #else
223
223
  float baseDelta=0.0;float ele=0.0;
224
224
  #endif
225
- base=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);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;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);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:Rt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
225
+ base=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);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;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:Dt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
226
226
  #pragma mapbox: define lowp float base
227
227
  #pragma mapbox: define lowp float height
228
228
  #pragma mapbox: define lowp vec4 pattern_from
@@ -266,20 +266,20 @@ float baseDelta=0.0;float ele=0.0;
266
266
  #endif
267
267
  base=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
268
268
  ? a_pos
269
- : vec2(edgedistance,z*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:Rt(`#ifdef GL_ES
269
+ : vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:Dt(`#ifdef GL_ES
270
270
  precision highp float;
271
271
  #endif
272
272
  uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;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))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
273
273
  #ifdef OVERDRAW_INSPECTOR
274
274
  gl_FragColor=vec4(1.0);
275
275
  #endif
276
- }`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying 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:Rt(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
276
+ }`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Dt(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
277
277
  #define PI 3.141592653589793
278
278
  void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;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_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
279
279
  #ifdef OVERDRAW_INSPECTOR
280
280
  gl_FragColor=vec4(1.0);
281
281
  #endif
282
- }`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:Rt(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
282
+ }`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:Dt(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
283
283
  #pragma mapbox: define highp vec4 color
284
284
  #pragma mapbox: define lowp float blur
285
285
  #pragma mapbox: define lowp float opacity
@@ -313,7 +313,7 @@ v_gamma_scale=1.0;
313
313
  #else
314
314
  float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
315
315
  #endif
316
- v_width2=vec2(outset,inset);}`),lineGradient:Rt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
316
+ v_width2=vec2(outset,inset);}`),lineGradient:Dt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
317
317
  #pragma mapbox: define lowp float blur
318
318
  #pragma mapbox: define lowp float opacity
319
319
  void main() {
@@ -343,7 +343,7 @@ v_gamma_scale=1.0;
343
343
  #else
344
344
  float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
345
345
  #endif
346
- v_width2=vec2(outset,inset);}`),linePattern:Rt(`#ifdef GL_ES
346
+ v_width2=vec2(outset,inset);}`),linePattern:Dt(`#ifdef GL_ES
347
347
  precision highp float;
348
348
  #endif
349
349
  uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
@@ -395,7 +395,7 @@ v_gamma_scale=1.0;
395
395
  #else
396
396
  float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
397
397
  #endif
398
- v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Rt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
398
+ v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Dt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
399
399
  #pragma mapbox: define highp vec4 color
400
400
  #pragma mapbox: define lowp float blur
401
401
  #pragma mapbox: define lowp float opacity
@@ -436,11 +436,11 @@ v_gamma_scale=1.0;
436
436
  #else
437
437
  float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
438
438
  #endif
439
- v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:Rt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying 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=texture2D(u_image0,v_pos0);vec4 color1=texture2D(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);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
439
+ v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:Dt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying 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=texture2D(u_image0,v_pos0);vec4 color1=texture2D(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);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
440
440
  #ifdef OVERDRAW_INSPECTOR
441
441
  gl_FragColor=vec4(1.0);
442
442
  #endif
443
- }`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:Rt(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
443
+ }`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:Dt(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
444
444
  #pragma mapbox: define lowp float opacity
445
445
  void main() {
446
446
  #pragma mapbox: initialize lowp float opacity
@@ -454,7 +454,7 @@ void main() {
454
454
  #pragma mapbox: initialize lowp float opacity
455
455
  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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
456
456
  camera_to_anchor_distance/u_camera_to_center_distance :
457
- 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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:Rt(`#define SDF_PX 8.0
457
+ 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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:Dt(`#define SDF_PX 8.0
458
458
  uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
459
459
  #pragma mapbox: define highp vec4 fill_color
460
460
  #pragma mapbox: define highp vec4 halo_color
@@ -485,7 +485,7 @@ void main() {
485
485
  #pragma mapbox: initialize lowp float halo_blur
486
486
  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;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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
487
487
  camera_to_anchor_distance/u_camera_to_center_distance :
488
- 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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:Rt(`#define SDF_PX 8.0
488
+ 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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:Dt(`#define SDF_PX 8.0
489
489
  #define SDF 1.0
490
490
  #define ICON 0.0
491
491
  uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
@@ -522,7 +522,7 @@ void main() {
522
522
  #pragma mapbox: initialize lowp float halo_blur
523
523
  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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
524
524
  camera_to_anchor_distance/u_camera_to_center_distance :
525
- 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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:Rt("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Sn),terrainDepth:Rt("varying 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() {gl_FragColor=pack(v_depth);}",Sn),terrainCoords:Rt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",Sn)};function Rt(l,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=t.match(/attribute ([\w]+) ([\w]+)/g),u=l.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),p=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=p?p.concat(u):u,_={};return{fragmentSource:l=l.replace(n,(y,v,E,M,z)=>(_[z]=!0,v==="define"?`
525
+ 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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:Dt("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",In),terrainDepth:Dt("varying 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() {gl_FragColor=pack(v_depth);}",In),terrainCoords:Dt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",In)};function Dt(l,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=t.match(/attribute ([\w]+) ([\w]+)/g),u=l.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),p=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=p?p.concat(u):u,_={};return{fragmentSource:l=l.replace(n,(y,v,E,M,z)=>(_[z]=!0,v==="define"?`
526
526
  #ifndef HAS_UNIFORM_u_${z}
527
527
  varying ${E} ${M} ${z};
528
528
  #else
@@ -532,7 +532,7 @@ uniform ${E} ${M} u_${z};
532
532
  #ifdef HAS_UNIFORM_u_${z}
533
533
  ${E} ${M} ${z} = u_${z};
534
534
  #endif
535
- `)),vertexSource:t=t.replace(n,(y,v,E,M,z)=>{const V=M==="float"?"vec2":"vec4",U=z.match(/color/)?"color":V;return _[z]?v==="define"?`
535
+ `)),vertexSource:t=t.replace(n,(y,v,E,M,z)=>{const V=M==="float"?"vec2":"vec4",$=z.match(/color/)?"color":V;return _[z]?v==="define"?`
536
536
  #ifndef HAS_UNIFORM_u_${z}
537
537
  uniform lowp float u_${z}_t;
538
538
  attribute ${E} ${V} a_${z};
@@ -540,7 +540,7 @@ varying ${E} ${M} ${z};
540
540
  #else
541
541
  uniform ${E} ${M} u_${z};
542
542
  #endif
543
- `:U==="vec4"?`
543
+ `:$==="vec4"?`
544
544
  #ifndef HAS_UNIFORM_u_${z}
545
545
  ${z} = a_${z};
546
546
  #else
@@ -548,7 +548,7 @@ uniform ${E} ${M} u_${z};
548
548
  #endif
549
549
  `:`
550
550
  #ifndef HAS_UNIFORM_u_${z}
551
- ${z} = unpack_mix_${U}(a_${z}, u_${z}_t);
551
+ ${z} = unpack_mix_${$}(a_${z}, u_${z}_t);
552
552
  #else
553
553
  ${E} ${M} ${z} = u_${z};
554
554
  #endif
@@ -559,7 +559,7 @@ attribute ${E} ${V} a_${z};
559
559
  #else
560
560
  uniform ${E} ${M} u_${z};
561
561
  #endif
562
- `:U==="vec4"?`
562
+ `:$==="vec4"?`
563
563
  #ifndef HAS_UNIFORM_u_${z}
564
564
  ${E} ${M} ${z} = a_${z};
565
565
  #else
@@ -567,153 +567,177 @@ uniform ${E} ${M} u_${z};
567
567
  #endif
568
568
  `:`
569
569
  #ifndef HAS_UNIFORM_u_${z}
570
- ${E} ${M} ${z} = unpack_mix_${U}(a_${z}, u_${z}_t);
570
+ ${E} ${M} ${z} = unpack_mix_${$}(a_${z}, u_${z}_t);
571
571
  #else
572
572
  ${E} ${M} ${z} = u_${z};
573
573
  #endif
574
- `}),staticAttributes:s,staticUniforms:f}}class ls{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,s,u,p,f,_,y,v){this.context=t;let E=this.boundPaintVertexBuffers.length!==u.length;for(let M=0;!E&&M<u.length;M++)this.boundPaintVertexBuffers[M]!==u[M]&&(E=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===n&&this.boundLayoutVertexBuffer===s&&!E&&this.boundIndexBuffer===p&&this.boundVertexOffset===f&&this.boundDynamicVertexBuffer===_&&this.boundDynamicVertexBuffer2===y&&this.boundDynamicVertexBuffer3===v?(t.bindVertexArrayOES.set(this.vao),_&&_.bind(),p&&p.dynamicDraw&&p.bind(),y&&y.bind(),v&&v.bind()):this.freshBind(n,s,u,p,f,_,y,v)}freshBind(t,n,s,u,p,f,_,y){let v;const E=t.numAttributes,M=this.context,z=M.gl;if(M.extVertexArrayObject)this.vao&&this.destroy(),this.vao=M.extVertexArrayObject.createVertexArrayOES(),M.bindVertexArrayOES.set(this.vao),v=0,this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=s,this.boundIndexBuffer=u,this.boundVertexOffset=p,this.boundDynamicVertexBuffer=f,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=y;else{v=M.currentNumAttributes||0;for(let V=E;V<v;V++)z.disableVertexAttribArray(V)}n.enableAttributes(z,t);for(const V of s)V.enableAttributes(z,t);f&&f.enableAttributes(z,t),_&&_.enableAttributes(z,t),y&&y.enableAttributes(z,t),n.bind(),n.setVertexAttribPointers(z,t,p);for(const V of s)V.bind(),V.setVertexAttribPointers(z,t,p);f&&(f.bind(),f.setVertexAttribPointers(z,t,p)),u&&u.bind(),_&&(_.bind(),_.setVertexAttribPointers(z,t,p)),y&&(y.bind(),y.setVertexAttribPointers(z,t,p)),M.currentNumAttributes=E}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function cs(l){const t=[];for(let n=0;n<l.length;n++){if(l[n]===null)continue;const s=l[n].split(" ");t.push(s.pop())}return t}class da{constructor(t,n,s,u,p,f,_){const y=t.gl;this.program=y.createProgram();const v=cs(s.staticAttributes),E=u?u.getBinderAttributes():[],M=v.concat(E),z=Hn.prelude.staticUniforms?cs(Hn.prelude.staticUniforms):[],V=s.staticUniforms?cs(s.staticUniforms):[],U=u?u.getBinderUniforms():[],$=z.concat(V).concat(U),H=[];for(const ge of $)H.indexOf(ge)<0&&H.push(ge);const Q=u?u.defines():[];f&&Q.push("#define OVERDRAW_INSPECTOR;"),_&&Q.push("#define TERRAIN3D;");const oe=Q.concat(Hn.prelude.fragmentSource,s.fragmentSource).join(`
575
- `),N=Q.concat(Hn.prelude.vertexSource,s.vertexSource).join(`
576
- `),le=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(le,oe),y.compileShader(le),y.attachShader(this.program,le);const se=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(se,N),y.compileShader(se),y.attachShader(this.program,se),this.attributes={};const me={};this.numAttributes=M.length;for(let ge=0;ge<this.numAttributes;ge++)M[ge]&&(y.bindAttribLocation(this.program,ge,M[ge]),this.attributes[M[ge]]=ge);y.linkProgram(this.program),y.deleteShader(se),y.deleteShader(le);for(let ge=0;ge<H.length;ge++){const we=H[ge];if(we&&!me[we]){const fe=y.getUniformLocation(this.program,we);fe&&(me[we]=fe)}}this.fixedUniforms=p(t,me),this.terrainUniforms=((ge,we)=>({u_depth:new a.Uniform1i(ge,we.u_depth),u_terrain:new a.Uniform1i(ge,we.u_terrain),u_terrain_dim:new a.Uniform1f(ge,we.u_terrain_dim),u_terrain_matrix:new a.UniformMatrix4f(ge,we.u_terrain_matrix),u_terrain_unpack:new a.Uniform4f(ge,we.u_terrain_unpack),u_terrain_offset:new a.Uniform1f(ge,we.u_terrain_offset),u_terrain_exaggeration:new a.Uniform1f(ge,we.u_terrain_exaggeration)}))(t,me),this.binderUniforms=u?u.getUniforms(t,me):[]}draw(t,n,s,u,p,f,_,y,v,E,M,z,V,U,$,H,Q,oe){const N=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(s),t.setStencilMode(u),t.setColorMode(p),t.setCullFace(f),y){t.activeTexture.set(N.TEXTURE2),N.bindTexture(N.TEXTURE_2D,y.depthTexture),t.activeTexture.set(N.TEXTURE3),N.bindTexture(N.TEXTURE_2D,y.texture);for(const se in this.terrainUniforms)this.terrainUniforms[se].set(y[se])}for(const se in this.fixedUniforms)this.fixedUniforms[se].set(_[se]);$&&$.setUniforms(t,this.binderUniforms,V,{zoom:U});let le=0;switch(n){case N.LINES:le=2;break;case N.TRIANGLES:le=3;break;case N.LINE_STRIP:le=1}for(const se of z.get()){const me=se.vaos||(se.vaos={});(me[v]||(me[v]=new ls)).bind(t,this,E,$?$.getPaintVertexBuffers():[],M,se.vertexOffset,H,Q,oe),N.drawElements(n,se.primitiveLength*le,N.UNSIGNED_SHORT,se.primitiveOffset*le*2)}}}function fa(l,t,n){const s=1/ti(n,1,t.transform.tileZoom),u=Math.pow(2,n.tileID.overscaledZ),p=n.tileSize*Math.pow(2,t.transform.tileZoom)/u,f=p*(n.tileID.canonical.x+n.tileID.wrap*u),_=p*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[s,l.fromScale,l.toScale],u_fade:l.t,u_pixel_coord_upper:[f>>16,_>>16],u_pixel_coord_lower:[65535&f,65535&_]}}const us=(l,t,n,s)=>{const u=t.style.light,p=u.properties.get("position"),f=[p.x,p.y,p.z],_=a.create$1();u.properties.get("anchor")==="viewport"&&a.fromRotation(_,-t.transform.angle),a.transformMat3(f,f,_);const y=u.properties.get("color");return{u_matrix:l,u_lightpos:f,u_lightintensity:u.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:s}},Al=(l,t,n,s,u,p,f)=>a.extend(us(l,t,n,s),fa(p,t,f),{u_height_factor:-Math.pow(2,u.overscaledZ)/f.tileSize/8}),Co=l=>({u_matrix:l}),hs=(l,t,n,s)=>a.extend(Co(l),fa(n,t,s)),ma=(l,t)=>({u_matrix:l,u_world:t}),ga=(l,t,n,s,u)=>a.extend(hs(l,t,n,s),{u_world:u}),_a=(l,t,n,s)=>{const u=l.transform;let p,f;if(s.paint.get("circle-pitch-alignment")==="map"){const _=ti(n,1,u.zoom);p=!0,f=[_,_]}else p=!1,f=u.pixelsToGLUnits;return{u_camera_to_center_distance:u.cameraToCenterDistance,u_scale_with_map:+(s.paint.get("circle-pitch-scale")==="map"),u_matrix:l.translatePosMatrix(t.posMatrix,n,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_pitch_with_map:+p,u_device_pixel_ratio:l.pixelRatio,u_extrude_scale:f}},en=(l,t,n)=>{const s=ti(n,1,t.zoom),u=Math.pow(2,t.zoom-n.tileID.overscaledZ),p=n.tileID.overscaleFactor();return{u_matrix:l,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:s,u_extrude_scale:[t.pixelsToGLUnits[0]/(s*u),t.pixelsToGLUnits[1]/(s*u)],u_overscale_factor:p}},Kn=(l,t,n=1)=>({u_matrix:l,u_color:t,u_overlay:0,u_overlay_scale:n}),In=l=>({u_matrix:l}),Ao=(l,t,n,s)=>({u_matrix:l,u_extrude_scale:ti(t,1,n),u_intensity:s});function Mo(l,t){const n=Math.pow(2,t.canonical.z),s=t.canonical.y;return[new a.MercatorCoordinate(0,s/n).toLngLat().lat,new a.MercatorCoordinate(0,(s+1)/n).toLngLat().lat]}const Cn=(l,t,n,s)=>{const u=l.transform;return{u_matrix:Yn(l,t,n,s),u_ratio:1/ti(t,1,u.zoom),u_device_pixel_ratio:l.pixelRatio,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]]}},ps=(l,t,n,s,u)=>a.extend(Cn(l,t,n,u),{u_image:0,u_image_height:s}),Po=(l,t,n,s,u)=>{const p=l.transform,f=Vt(t,p);return{u_matrix:Yn(l,t,n,u),u_texsize:t.imageAtlasTexture.size,u_ratio:1/ti(t,1,p.zoom),u_device_pixel_ratio:l.pixelRatio,u_image:0,u_scale:[f,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},Jn=(l,t,n,s,u,p)=>{const f=l.lineAtlas,_=Vt(t,l.transform),y=n.layout.get("line-cap")==="round",v=f.getDash(s.from,y),E=f.getDash(s.to,y),M=v.width*u.fromScale,z=E.width*u.toScale;return a.extend(Cn(l,t,n,p),{u_patternscale_a:[_/M,-v.height/2],u_patternscale_b:[_/z,-E.height/2],u_sdfgamma:f.width/(256*Math.min(M,z)*l.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:E.y,u_mix:u.t})};function Vt(l,t){return 1/ti(l,1,t.tileZoom)}function Yn(l,t,n,s){return l.translatePosMatrix(s?s.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const ya=(l,t,n,s,u)=>{return{u_matrix:l,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:s.mix,u_opacity:s.opacity*u.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:u.paint.get("raster-brightness-min"),u_brightness_high:u.paint.get("raster-brightness-max"),u_saturation_factor:(f=u.paint.get("raster-saturation"),f>0?1-1/(1.001-f):-f),u_contrast_factor:(p=u.paint.get("raster-contrast"),p>0?1/(1-p):1+p),u_spin_weights:xa(u.paint.get("raster-hue-rotate"))};var p,f};function xa(l){l*=Math.PI/180;const t=Math.sin(l),n=Math.cos(l);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const ds=(l,t,n,s,u,p,f,_,y,v)=>{const E=u.transform;return{u_is_size_zoom_constant:+(l==="constant"||l==="source"),u_is_size_feature_constant:+(l==="constant"||l==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:E.cameraToCenterDistance,u_pitch:E.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:E.width/E.height,u_fade_change:u.options.fadeDuration?u.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:f,u_coord_matrix:_,u_is_text:+y,u_pitch_with_map:+s,u_texsize:v,u_texture:0}},zo=(l,t,n,s,u,p,f,_,y,v,E)=>{const M=u.transform;return a.extend(ds(l,t,n,s,u,p,f,_,y,v),{u_gamma_scale:s?Math.cos(M._pitch)*M.cameraToCenterDistance:1,u_device_pixel_ratio:u.pixelRatio,u_is_halo:+E})},va=(l,t,n,s,u,p,f,_,y,v)=>a.extend(zo(l,t,n,s,u,p,f,_,!0,y,!0),{u_texsize_icon:v,u_texture_icon:1}),Ml=(l,t,n)=>({u_matrix:l,u_opacity:t,u_color:n}),Pl=(l,t,n,s,u,p)=>a.extend(function(f,_,y,v){const E=y.imageManager.getPattern(f.from.toString()),M=y.imageManager.getPattern(f.to.toString()),{width:z,height:V}=y.imageManager.getPixelSize(),U=Math.pow(2,v.tileID.overscaledZ),$=v.tileSize*Math.pow(2,y.transform.tileZoom)/U,H=$*(v.tileID.canonical.x+v.tileID.wrap*U),Q=$*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:E.tl,u_pattern_br_a:E.br,u_pattern_tl_b:M.tl,u_pattern_br_b:M.br,u_texsize:[z,V],u_mix:_.t,u_pattern_size_a:E.displaySize,u_pattern_size_b:M.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/ti(v,1,y.transform.tileZoom),u_pixel_coord_upper:[H>>16,Q>>16],u_pixel_coord_lower:[65535&H,65535&Q]}}(s,p,n,u),{u_matrix:l,u_opacity:t}),fs={fillExtrusion:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_lightpos:new a.Uniform3f(l,t.u_lightpos),u_lightintensity:new a.Uniform1f(l,t.u_lightintensity),u_lightcolor:new a.Uniform3f(l,t.u_lightcolor),u_vertical_gradient:new a.Uniform1f(l,t.u_vertical_gradient),u_opacity:new a.Uniform1f(l,t.u_opacity)}),fillExtrusionPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_lightpos:new a.Uniform3f(l,t.u_lightpos),u_lightintensity:new a.Uniform1f(l,t.u_lightintensity),u_lightcolor:new a.Uniform3f(l,t.u_lightcolor),u_vertical_gradient:new a.Uniform1f(l,t.u_vertical_gradient),u_height_factor:new a.Uniform1f(l,t.u_height_factor),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade),u_opacity:new a.Uniform1f(l,t.u_opacity)}),fill:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),fillPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),fillOutline:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world)}),fillOutlinePattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),circle:(l,t)=>({u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_scale_with_map:new a.Uniform1i(l,t.u_scale_with_map),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_extrude_scale:new a.Uniform2f(l,t.u_extrude_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),collisionBox:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pixels_to_tile_units:new a.Uniform1f(l,t.u_pixels_to_tile_units),u_extrude_scale:new a.Uniform2f(l,t.u_extrude_scale),u_overscale_factor:new a.Uniform1f(l,t.u_overscale_factor)}),collisionCircle:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_inv_matrix:new a.UniformMatrix4f(l,t.u_inv_matrix),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_viewport_size:new a.Uniform2f(l,t.u_viewport_size)}),debug:(l,t)=>({u_color:new a.UniformColor(l,t.u_color),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_overlay:new a.Uniform1i(l,t.u_overlay),u_overlay_scale:new a.Uniform1f(l,t.u_overlay_scale)}),clippingMask:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),heatmap:(l,t)=>({u_extrude_scale:new a.Uniform1f(l,t.u_extrude_scale),u_intensity:new a.Uniform1f(l,t.u_intensity),u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),heatmapTexture:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world),u_image:new a.Uniform1i(l,t.u_image),u_color_ramp:new a.Uniform1i(l,t.u_color_ramp),u_opacity:new a.Uniform1f(l,t.u_opacity)}),hillshade:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_latrange:new a.Uniform2f(l,t.u_latrange),u_light:new a.Uniform2f(l,t.u_light),u_shadow:new a.UniformColor(l,t.u_shadow),u_highlight:new a.UniformColor(l,t.u_highlight),u_accent:new a.UniformColor(l,t.u_accent)}),hillshadePrepare:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_dimension:new a.Uniform2f(l,t.u_dimension),u_zoom:new a.Uniform1f(l,t.u_zoom),u_unpack:new a.Uniform4f(l,t.u_unpack)}),line:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels)}),lineGradient:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_image:new a.Uniform1i(l,t.u_image),u_image_height:new a.Uniform1f(l,t.u_image_height)}),linePattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texsize:new a.Uniform2f(l,t.u_texsize),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_image:new a.Uniform1i(l,t.u_image),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),lineSDF:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_patternscale_a:new a.Uniform2f(l,t.u_patternscale_a),u_patternscale_b:new a.Uniform2f(l,t.u_patternscale_b),u_sdfgamma:new a.Uniform1f(l,t.u_sdfgamma),u_image:new a.Uniform1i(l,t.u_image),u_tex_y_a:new a.Uniform1f(l,t.u_tex_y_a),u_tex_y_b:new a.Uniform1f(l,t.u_tex_y_b),u_mix:new a.Uniform1f(l,t.u_mix)}),raster:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_tl_parent:new a.Uniform2f(l,t.u_tl_parent),u_scale_parent:new a.Uniform1f(l,t.u_scale_parent),u_buffer_scale:new a.Uniform1f(l,t.u_buffer_scale),u_fade_t:new a.Uniform1f(l,t.u_fade_t),u_opacity:new a.Uniform1f(l,t.u_opacity),u_image0:new a.Uniform1i(l,t.u_image0),u_image1:new a.Uniform1i(l,t.u_image1),u_brightness_low:new a.Uniform1f(l,t.u_brightness_low),u_brightness_high:new a.Uniform1f(l,t.u_brightness_high),u_saturation_factor:new a.Uniform1f(l,t.u_saturation_factor),u_contrast_factor:new a.Uniform1f(l,t.u_contrast_factor),u_spin_weights:new a.Uniform3f(l,t.u_spin_weights)}),symbolIcon:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pitch:new a.Uniform1f(l,t.u_pitch),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texture:new a.Uniform1i(l,t.u_texture)}),symbolSDF:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pitch:new a.Uniform1f(l,t.u_pitch),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texture:new a.Uniform1i(l,t.u_texture),u_gamma_scale:new a.Uniform1f(l,t.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(l,t.u_is_halo)}),symbolTextAndIcon:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pitch:new a.Uniform1f(l,t.u_pitch),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texsize_icon:new a.Uniform2f(l,t.u_texsize_icon),u_texture:new a.Uniform1i(l,t.u_texture),u_texture_icon:new a.Uniform1i(l,t.u_texture_icon),u_gamma_scale:new a.Uniform1f(l,t.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(l,t.u_is_halo)}),background:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_opacity:new a.Uniform1f(l,t.u_opacity),u_color:new a.UniformColor(l,t.u_color)}),backgroundPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_opacity:new a.Uniform1f(l,t.u_opacity),u_image:new a.Uniform1i(l,t.u_image),u_pattern_tl_a:new a.Uniform2f(l,t.u_pattern_tl_a),u_pattern_br_a:new a.Uniform2f(l,t.u_pattern_br_a),u_pattern_tl_b:new a.Uniform2f(l,t.u_pattern_tl_b),u_pattern_br_b:new a.Uniform2f(l,t.u_pattern_br_b),u_texsize:new a.Uniform2f(l,t.u_texsize),u_mix:new a.Uniform1f(l,t.u_mix),u_pattern_size_a:new a.Uniform2f(l,t.u_pattern_size_a),u_pattern_size_b:new a.Uniform2f(l,t.u_pattern_size_b),u_scale_a:new a.Uniform1f(l,t.u_scale_a),u_scale_b:new a.Uniform1f(l,t.u_scale_b),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_tile_units_to_pixels:new a.Uniform1f(l,t.u_tile_units_to_pixels)}),terrain:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texture:new a.Uniform1i(l,t.u_texture)}),terrainDepth:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),terrainCoords:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texture:new a.Uniform1i(l,t.u_texture),u_terrain_coords_id:new a.Uniform1f(l,t.u_terrain_coords_id)})};class ms{constructor(t,n,s){this.context=t;const u=t.gl;this.buffer=u.createBuffer(),this.dynamicDraw=Boolean(s),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),u.bufferData(u.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?u.DYNAMIC_DRAW:u.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}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 gs={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class _s{constructor(t,n,s,u){this.length=n.length,this.attributes=s,this.itemSize=n.bytesPerElement,this.dynamicDraw=u,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),t.bindVertexBuffer.set(this.buffer),p.bufferData(p.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let s=0;s<this.attributes.length;s++){const u=n.attributes[this.attributes[s].name];u!==void 0&&t.enableVertexAttribArray(u)}}setVertexAttribPointers(t,n,s){for(let u=0;u<this.attributes.length;u++){const p=this.attributes[u],f=n.attributes[p.name];f!==void 0&&t.vertexAttribPointer(f,p.components,t[gs[p.type]],!1,this.itemSize,p.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Ct{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 ba extends Ct{getDefault(){return a.Color.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 zl extends Ct{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Qn extends Ct{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class eo extends Ct{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 wa extends Ct{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Gi extends Ct{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class ys extends Ct{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 ko extends Ct{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 Do extends Ct{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 xs extends Ct{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 vs extends Ct{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 Lo extends Ct{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class bs extends Ct{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 ws extends Ct{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 Ro extends Ct{getDefault(){return a.Color.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 Ta extends Ct{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Ea extends Ct{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 An extends Ct{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class kl extends Ct{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Dl extends Ct{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Ll extends Ct{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Rl extends Ct{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 Bl extends Ct{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 Fl extends Ct{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 Ts extends Ct{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 Bo extends Ct{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 Es extends Ct{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Ss extends Ct{constructor(t){super(t),this.vao=t.extVertexArrayObject}getDefault(){return null}set(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)}}class Mn extends Ct{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 Sa extends Ct{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 Ia extends Ct{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 Fo extends Ct{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class tn extends Fo{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 Ca extends Fo{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 Pn{constructor(t,n,s,u){this.context=t,this.width=n,this.height=s;const p=t.gl,f=this.framebuffer=p.createFramebuffer();if(this.colorAttachment=new tn(t,f),u&&(this.depthAttachment=new Ca(t,f)),p.checkFramebufferStatus(p.FRAMEBUFFER)!==p.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const s=this.depthAttachment.get();s&&t.deleteRenderbuffer(s)}t.deleteFramebuffer(this.framebuffer)}}class Ot{constructor(t,n,s){this.blendFunction=t,this.blendColor=n,this.mask=s}}Ot.Replace=[1,0],Ot.disabled=new Ot(Ot.Replace,a.Color.transparent,[!1,!1,!1,!1]),Ot.unblended=new Ot(Ot.Replace,a.Color.transparent,[!0,!0,!0,!0]),Ot.alphaBlended=new Ot([1,771],a.Color.transparent,[!0,!0,!0,!0]);class Aa{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new ba(this),this.clearDepth=new zl(this),this.clearStencil=new Qn(this),this.colorMask=new eo(this),this.depthMask=new wa(this),this.stencilMask=new Gi(this),this.stencilFunc=new ys(this),this.stencilOp=new ko(this),this.stencilTest=new Do(this),this.depthRange=new xs(this),this.depthTest=new vs(this),this.depthFunc=new Lo(this),this.blend=new bs(this),this.blendFunc=new ws(this),this.blendColor=new Ro(this),this.blendEquation=new Ta(this),this.cullFace=new Ea(this),this.cullFaceSide=new An(this),this.frontFace=new kl(this),this.program=new Dl(this),this.activeTexture=new Ll(this),this.viewport=new Rl(this),this.bindFramebuffer=new Bl(this),this.bindRenderbuffer=new Fl(this),this.bindTexture=new Ts(this),this.bindVertexBuffer=new Bo(this),this.bindElementBuffer=new Es(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Ss(this),this.pixelStoreUnpack=new Mn(this),this.pixelStoreUnpackPremultiplyAlpha=new Sa(this),this.pixelStoreUnpackFlipY=new Ia(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)}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.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n){return new ms(this,t,n)}createVertexBuffer(t,n,s){return new _s(this,t,n,s)}createRenderbuffer(t,n,s){const u=this.gl,p=u.createRenderbuffer();return this.bindRenderbuffer.set(p),u.renderbufferStorage(u.RENDERBUFFER,t,n,s),this.bindRenderbuffer.set(null),p}createFramebuffer(t,n,s){return new Pn(this,t,n,s)}clear({color:t,depth:n}){const s=this.gl;let u=0;t&&(u|=s.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(u|=s.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),s.clear(u)}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){ue(t.blendFunction,Ot.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class mt{constructor(t,n,s){this.func=t,this.mask=n,this.range=s}}mt.ReadOnly=!1,mt.ReadWrite=!0,mt.disabled=new mt(519,mt.ReadOnly,[0,1]);const At=7680;class Ft{constructor(t,n,s,u,p,f){this.test=t,this.ref=n,this.mask=s,this.fail=u,this.depthFail=p,this.pass=f}}Ft.disabled=new Ft({func:519,mask:0},0,0,At,At,At);class Nt{constructor(t,n,s){this.enable=t,this.mode=n,this.frontFace=s}}let to;function zn(l,t,n,s,u,p,f){const _=l.context,y=_.gl,v=l.useProgram("collisionBox"),E=[];let M=0,z=0;for(let N=0;N<s.length;N++){const le=s[N],se=t.getTile(le),me=se.getBucket(n);if(!me)continue;let ge=le.posMatrix;u[0]===0&&u[1]===0||(ge=l.translatePosMatrix(le.posMatrix,se,u,p));const we=f?me.textCollisionBox:me.iconCollisionBox,fe=me.collisionCircleArray;if(fe.length>0){const Fe=a.create(),Ae=ge;a.mul(Fe,me.placementInvProjMatrix,l.transform.glCoordMatrix),a.mul(Fe,Fe,me.placementViewportMatrix),E.push({circleArray:fe,circleOffset:z,transform:Ae,invTransform:Fe,coord:le}),M+=fe.length/4,z=M}we&&v.draw(_,y.LINES,mt.disabled,Ft.disabled,l.colorModeForRenderPass(),Nt.disabled,en(ge,l.transform,se),l.style.terrain&&l.style.terrain.getTerrainData(le),n.id,we.layoutVertexBuffer,we.indexBuffer,we.segments,null,l.transform.zoom,null,null,we.collisionVertexBuffer)}if(!f||!E.length)return;const V=l.useProgram("collisionCircle"),U=new a.CollisionCircleLayoutArray;U.resize(4*M),U._trim();let $=0;for(const N of E)for(let le=0;le<N.circleArray.length/4;le++){const se=4*le,me=N.circleArray[se+0],ge=N.circleArray[se+1],we=N.circleArray[se+2],fe=N.circleArray[se+3];U.emplace($++,me,ge,we,fe,0),U.emplace($++,me,ge,we,fe,1),U.emplace($++,me,ge,we,fe,2),U.emplace($++,me,ge,we,fe,3)}(!to||to.length<2*M)&&(to=function(N){const le=2*N,se=new a.QuadTriangleArray;se.resize(le),se._trim();for(let me=0;me<le;me++){const ge=6*me;se.uint16[ge+0]=4*me+0,se.uint16[ge+1]=4*me+1,se.uint16[ge+2]=4*me+2,se.uint16[ge+3]=4*me+2,se.uint16[ge+4]=4*me+3,se.uint16[ge+5]=4*me+0}return se}(M));const H=_.createIndexBuffer(to,!0),Q=_.createVertexBuffer(U,a.collisionCircleLayout.members,!0);for(const N of E){const le={u_matrix:N.transform,u_inv_matrix:N.invTransform,u_camera_to_center_distance:(oe=l.transform).cameraToCenterDistance,u_viewport_size:[oe.width,oe.height]};V.draw(_,y.TRIANGLES,mt.disabled,Ft.disabled,l.colorModeForRenderPass(),Nt.disabled,le,l.style.terrain&&l.style.terrain.getTerrainData(N.coord),n.id,Q,H,a.SegmentVector.simpleSegment(0,2*N.circleOffset,N.circleArray.length,N.circleArray.length/2),null,l.transform.zoom,null,null,null)}var oe;Q.destroy(),H.destroy()}Nt.disabled=new Nt(!1,1029,2305),Nt.backCCW=new Nt(!0,1029,2305);const Ol=a.identity(new Float32Array(16));function Ul(l,t,n,s,u,p){const{horizontalAlign:f,verticalAlign:_}=a.getAnchorAlignment(l),y=-(f-.5)*t,v=-(_-.5)*n,E=a.evaluateVariableOffset(l,s);return new a.pointGeometry((y/u+E[0])*p,(v/u+E[1])*p)}function Ma(l,t,n,s,u,p,f,_,y,v,E){const M=l.text.placedSymbolArray,z=l.text.dynamicLayoutVertexArray,V=l.icon.dynamicLayoutVertexArray,U={};z.clear();for(let $=0;$<M.length;$++){const H=M.get($),Q=l.allowVerticalPlacement&&!H.placedOrientation,oe=H.hidden||!H.crossTileID||Q?null:s[H.crossTileID];if(oe){const N=new a.pointGeometry(H.anchorX,H.anchorY),le=bt(N,n?f:p,E),se=Ji(u.cameraToCenterDistance,le.signedDistanceFromCamera);let me=a.evaluateSizeForFeature(l.textSizeData,y,H)*se/a.ONE_EM;n&&(me*=l.tilePixelRatio/_);const{width:ge,height:we,anchor:fe,textOffset:Fe,textBoxScale:Ae}=oe,Oe=Ul(fe,ge,we,Fe,Ae,me),ot=n?bt(N.add(Oe),p,E).point:le.point.add(t?Oe.rotate(-u.angle):Oe),ct=l.allowVerticalPlacement&&H.placedOrientation===a.WritingMode.vertical?Math.PI/2:0;for(let Xe=0;Xe<H.numGlyphs;Xe++)a.addDynamicAttributes(z,ot,ct);v&&H.associatedIconIndex>=0&&(U[H.associatedIconIndex]={shiftedAnchor:ot,angle:ct})}else rt(H.numGlyphs,z)}if(v){V.clear();const $=l.icon.placedSymbolArray;for(let H=0;H<$.length;H++){const Q=$.get(H);if(Q.hidden)rt(Q.numGlyphs,V);else{const oe=U[H];if(oe)for(let N=0;N<Q.numGlyphs;N++)a.addDynamicAttributes(V,oe.shiftedAnchor,oe.angle);else rt(Q.numGlyphs,V)}}l.icon.dynamicLayoutVertexBuffer.updateData(V)}l.text.dynamicLayoutVertexBuffer.updateData(z)}function $l(l,t,n){return n.iconsInText&&t?"symbolTextAndIcon":l?"symbolSDF":"symbolIcon"}function Oo(l,t,n,s,u,p,f,_,y,v,E,M){const z=l.context,V=z.gl,U=l.transform,$=_==="map",H=y==="map",Q=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",oe=$&&!H&&!Q,N=!n.layout.get("symbol-sort-key").isConstant();let le=!1;const se=l.depthModeForSublayer(0,mt.ReadOnly),me=n.layout.get("text-variable-anchor"),ge=[];for(const we of s){const fe=t.getTile(we),Fe=fe.getBucket(n);if(!Fe)continue;const Ae=u?Fe.text:Fe.icon;if(!Ae||!Ae.segments.get().length)continue;const Oe=Ae.programConfigurations.get(n.id),ot=u||Fe.sdfIcons,ct=u?Fe.textSizeData:Fe.iconSizeData,Xe=H||U.pitch!==0,Pt=l.useProgram($l(ot,u,Fe),Oe),zt=a.evaluateSizeForZoom(ct,U.zoom),yt=l.style.terrain&&l.style.terrain.getTerrainData(we);let Et,Dt,ui,mr,nr=[0,0],gr=null;if(u){if(Dt=fe.glyphAtlasTexture,ui=V.LINEAR,Et=fe.glyphAtlasTexture.size,Fe.iconsInText){nr=fe.imageAtlasTexture.size,gr=fe.imageAtlasTexture;const er=ct.kind==="composite"||ct.kind==="camera";mr=Xe||l.options.rotating||l.options.zooming||er?V.LINEAR:V.NEAREST}}else{const er=n.layout.get("icon-size").constantOr(0)!==1||Fe.iconsNeedLinear;Dt=fe.imageAtlasTexture,ui=ot||l.options.rotating||l.options.zooming||er||Xe?V.LINEAR:V.NEAREST,Et=fe.imageAtlasTexture.size}const jr=ti(fe,1,l.transform.zoom),Qi=Kr(we.posMatrix,H,$,l.transform,jr),Bi=ir(we.posMatrix,H,$,l.transform,jr),Cr=me&&Fe.hasTextData(),jo=n.layout.get("icon-text-fit")!=="none"&&Cr&&Fe.hasIconData();if(Q){const er=l.style.terrain?($s,Fn)=>l.style.terrain.getElevation(we,$s,Fn):null,sn=n.layout.get("text-rotation-alignment")==="map";Ni(Fe,we.posMatrix,l,u,Qi,Bi,H,v,sn,er)}const oi=l.translatePosMatrix(we.posMatrix,fe,p,f),pt=Q||u&&me||jo?Ol:Qi,Mt=l.translatePosMatrix(Bi,fe,p,f,!0),hi=ot&&n.paint.get(u?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let pi;pi=ot?Fe.iconsInText?va(ct.kind,zt,oe,H,l,oi,pt,Mt,Et,nr):zo(ct.kind,zt,oe,H,l,oi,pt,Mt,u,Et,!0):ds(ct.kind,zt,oe,H,l,oi,pt,Mt,u,Et);const qt={program:Pt,buffers:Ae,uniformValues:pi,atlasTexture:Dt,atlasTextureIcon:gr,atlasInterpolation:ui,atlasInterpolationIcon:mr,isSDF:ot,hasHalo:hi};if(N&&Fe.canOverlap){le=!0;const er=Ae.segments.get();for(const sn of er)ge.push({segments:new a.SegmentVector([sn]),sortKey:sn.sortKey,state:qt,terrainData:yt})}else ge.push({segments:Ae.segments,sortKey:0,state:qt,terrainData:yt})}le&&ge.sort((we,fe)=>we.sortKey-fe.sortKey);for(const we of ge){const fe=we.state;if(z.activeTexture.set(V.TEXTURE0),fe.atlasTexture.bind(fe.atlasInterpolation,V.CLAMP_TO_EDGE),fe.atlasTextureIcon&&(z.activeTexture.set(V.TEXTURE1),fe.atlasTextureIcon&&fe.atlasTextureIcon.bind(fe.atlasInterpolationIcon,V.CLAMP_TO_EDGE)),fe.isSDF){const Fe=fe.uniformValues;fe.hasHalo&&(Fe.u_is_halo=1,io(fe.buffers,we.segments,n,l,fe.program,se,E,M,Fe,we.terrainData)),Fe.u_is_halo=0}io(fe.buffers,we.segments,n,l,fe.program,se,E,M,fe.uniformValues,we.terrainData)}}function io(l,t,n,s,u,p,f,_,y,v){const E=s.context;u.draw(E,E.gl.TRIANGLES,p,f,_,Nt.disabled,y,v,n.id,l.layoutVertexBuffer,l.indexBuffer,t,n.paint,s.transform.zoom,l.programConfigurations.get(n.id),l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer)}function ro(l,t,n,s,u,p,f){const _=l.context.gl,y=n.paint.get("fill-pattern"),v=y&&y.constantOr(1),E=n.getCrossfadeParameters();let M,z,V,U,$;f?(z=v&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",M=_.LINES):(z=v?"fillPattern":"fill",M=_.TRIANGLES);for(const H of s){const Q=t.getTile(H);if(v&&!Q.patternsLoaded())continue;const oe=Q.getBucket(n);if(!oe)continue;const N=oe.programConfigurations.get(n.id),le=l.useProgram(z,N),se=l.style.terrain&&l.style.terrain.getTerrainData(H);v&&(l.context.activeTexture.set(_.TEXTURE0),Q.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),N.updatePaintBuffers(E));const me=y.constantOr(null);if(me&&Q.imageAtlas){const fe=Q.imageAtlas,Fe=fe.patternPositions[me.to.toString()],Ae=fe.patternPositions[me.from.toString()];Fe&&Ae&&N.setConstantPatternPositions(Fe,Ae)}const ge=se?H:null,we=l.translatePosMatrix(ge?ge.posMatrix:H.posMatrix,Q,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(f){U=oe.indexBuffer2,$=oe.segments2;const fe=[_.drawingBufferWidth,_.drawingBufferHeight];V=z==="fillOutlinePattern"&&v?ga(we,l,E,Q,fe):ma(we,fe)}else U=oe.indexBuffer,$=oe.segments,V=v?hs(we,l,E,Q):Co(we);le.draw(l.context,M,u,l.stencilModeForClipping(H),p,Nt.disabled,V,se,n.id,oe.layoutVertexBuffer,U,$,n.paint,l.transform.zoom,N)}}function no(l,t,n,s,u,p,f){const _=l.context,y=_.gl,v=n.paint.get("fill-extrusion-pattern"),E=v.constantOr(1),M=n.getCrossfadeParameters(),z=n.paint.get("fill-extrusion-opacity");for(const V of s){const U=t.getTile(V),$=U.getBucket(n);if(!$)continue;const H=l.style.terrain&&l.style.terrain.getTerrainData(V),Q=$.programConfigurations.get(n.id),oe=l.useProgram(E?"fillExtrusionPattern":"fillExtrusion",Q);E&&(l.context.activeTexture.set(y.TEXTURE0),U.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),Q.updatePaintBuffers(M));const N=v.constantOr(null);if(N&&U.imageAtlas){const ge=U.imageAtlas,we=ge.patternPositions[N.to.toString()],fe=ge.patternPositions[N.from.toString()];we&&fe&&Q.setConstantPatternPositions(we,fe)}const le=l.translatePosMatrix(V.posMatrix,U,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),se=n.paint.get("fill-extrusion-vertical-gradient"),me=E?Al(le,l,se,z,V,M,U):us(le,l,se,z);oe.draw(_,_.gl.TRIANGLES,u,p,f,Nt.backCCW,me,H,n.id,$.layoutVertexBuffer,$.indexBuffer,$.segments,n.paint,l.transform.zoom,Q,l.style.terrain&&$.centroidVertexBuffer)}}function Is(l,t,n,s,u,p,f){const _=l.context,y=_.gl,v=n.fbo;if(!v)return;const E=l.useProgram("hillshade"),M=l.style.terrain&&l.style.terrain.getTerrainData(t);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment.get()),E.draw(_,y.TRIANGLES,u,p,f,Nt.disabled,((z,V,U,$)=>{const H=U.paint.get("hillshade-shadow-color"),Q=U.paint.get("hillshade-highlight-color"),oe=U.paint.get("hillshade-accent-color");let N=U.paint.get("hillshade-illumination-direction")*(Math.PI/180);U.paint.get("hillshade-illumination-anchor")==="viewport"&&(N-=z.transform.angle);const le=!z.options.moving;return{u_matrix:$?$.posMatrix:z.transform.calculatePosMatrix(V.tileID.toUnwrapped(),le),u_image:0,u_latrange:Mo(0,V.tileID),u_light:[U.paint.get("hillshade-exaggeration"),N],u_shadow:H,u_highlight:Q,u_accent:oe}})(l,n,s,M?t:null),M,s.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments)}function Pa(l,t,n,s,u,p){const f=l.context,_=f.gl,y=t.dem;if(y&&y.data){const v=y.dim,E=y.stride,M=y.getPixels();if(f.activeTexture.set(_.TEXTURE1),f.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||l.getTileTexture(E),t.demTexture){const V=t.demTexture;V.update(M,{premultiply:!1}),V.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else t.demTexture=new Ie(f,M,_.RGBA,{premultiply:!1}),t.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);f.activeTexture.set(_.TEXTURE0);let z=t.fbo;if(!z){const V=new Ie(f,{width:v,height:v,data:null},_.RGBA);V.bind(_.LINEAR,_.CLAMP_TO_EDGE),z=t.fbo=f.createFramebuffer(v,v,!0),z.colorAttachment.set(V.texture)}f.bindFramebuffer.set(z.framebuffer),f.viewport.set([0,0,v,v]),l.useProgram("hillshadePrepare").draw(f,_.TRIANGLES,s,u,p,Nt.disabled,((V,U)=>{const $=U.stride,H=a.create();return a.ortho(H,0,a.EXTENT,-a.EXTENT,0,0,1),a.translate(H,H,[0,-a.EXTENT,0]),{u_matrix:H,u_image:1,u_dimension:[$,$],u_zoom:V.overscaledZ,u_unpack:U.getUnpackVector()}})(t.tileID,y),null,n.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Uo(l,t,n,s,u,p){const f=s.paint.get("raster-fade-duration");if(!p&&f>0){const _=a.exported.now(),y=(_-l.timeAdded)/f,v=t?(_-t.timeAdded)/f:-1,E=n.getSource(),M=u.coveringZoomLevel({tileSize:E.tileSize,roundZoom:E.roundZoom}),z=!t||Math.abs(t.tileID.overscaledZ-M)>Math.abs(l.tileID.overscaledZ-M),V=z&&l.refreshedUponExpiration?1:a.clamp(z?y:1-v,0,1);return l.refreshedUponExpiration&&y>=1&&(l.refreshedUponExpiration=!1),t?{opacity:1,mix:1-V}:{opacity:V,mix:0}}return{opacity:1,mix:0}}const $o=new a.Color(1,0,0,1),rr=new a.Color(0,1,0,1),za=new a.Color(0,0,1,1),Cs=new a.Color(1,0,1,1),ka=new a.Color(0,1,1,1);function rn(l,t,n,s){kn(l,0,t+n/2,l.transform.width,n,s)}function oo(l,t,n,s){kn(l,t-n/2,0,n,l.transform.height,s)}function kn(l,t,n,s,u,p){const f=l.context,_=f.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*l.pixelRatio,n*l.pixelRatio,s*l.pixelRatio,u*l.pixelRatio),f.clear({color:p}),_.disable(_.SCISSOR_TEST)}function Vl(l,t,n){const s=l.context,u=s.gl,p=n.posMatrix,f=l.useProgram("debug"),_=mt.disabled,y=Ft.disabled,v=l.colorModeForRenderPass(),E="$debug",M=l.style.terrain&&l.style.terrain.getTerrainData(n);s.activeTexture.set(u.TEXTURE0),l.emptyTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE);const z=t.getTileByID(n.key).latestRawTileData,V=Math.floor((z&&z.byteLength||0)/1024),U=t.getTile(n).tileSize,$=512/Math.min(U,512)*(n.overscaledZ/l.transform.zoom)*.5;let H=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(H+=` => ${n.overscaledZ}`),function(Q,oe){Q.initDebugOverlayCanvas();const N=Q.debugOverlayCanvas,le=Q.context.gl,se=Q.debugOverlayCanvas.getContext("2d");se.clearRect(0,0,N.width,N.height),se.shadowColor="white",se.shadowBlur=2,se.lineWidth=1.5,se.strokeStyle="white",se.textBaseline="top",se.font="bold 36px Open Sans, sans-serif",se.fillText(oe,5,5),se.strokeText(oe,5,5),Q.debugOverlayTexture.update(N),Q.debugOverlayTexture.bind(le.LINEAR,le.CLAMP_TO_EDGE)}(l,`${H} ${V}kB`),f.draw(s,u.TRIANGLES,_,y,Ot.alphaBlended,Nt.disabled,Kn(p,a.Color.transparent,$),null,E,l.debugBuffer,l.quadTriangleIndexBuffer,l.debugSegments),f.draw(s,u.LINE_STRIP,_,y,v,Nt.disabled,Kn(p,a.Color.red),M,E,l.debugBuffer,l.tileBorderIndexBuffer,l.debugSegments)}function Vo(l,t,n){const s=l.context,u=s.gl,p=l.colorModeForRenderPass(),f=new mt(u.LEQUAL,mt.ReadWrite,l.depthRangeFor3D),_=l.useProgram("terrain"),y=t.getTerrainMesh(),v=t.getTerrainData(n.tileID);s.bindFramebuffer.set(null),s.viewport.set([0,0,l.width,l.height]),s.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,t.getRTTFramebuffer().colorAttachment.get());const E=l.transform.calculatePosMatrix(n.tileID.toUnwrapped());_.draw(s,u.TRIANGLES,f,Ft.disabled,p,Nt.backCCW,{u_matrix:E,u_texture:0},v,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}function Da(l,t,n,s){const u=l.context,p=n.tileSize*t.qualityFactor;n.textures[s]||(n.textures[s]=l.getTileTexture(p)||new Ie(u,{width:p,height:p,data:null},u.gl.RGBA),n.textures[s].bind(u.gl.LINEAR,u.gl.CLAMP_TO_EDGE),s===0&&t.sourceCache.renderHistory.unshift(n.tileID.key));const f=t.getRTTFramebuffer();f.colorAttachment.set(n.textures[s].texture),u.bindFramebuffer.set(f.framebuffer),u.viewport.set([0,0,p,p])}class La{constructor(t){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=t,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=t.style.terrain.sourceCache.getRenderableTiles(),this._init()}_init(){const t=this.painter.style,n=t.terrain;for(const s in t.sourceCaches){this._coordsDescendingInv[s]={};const u=t.sourceCaches[s].getVisibleCoordinates();for(const p of u){const f=n.sourceCache.getTerrainCoords(p);for(const _ in f)this._coordsDescendingInv[s][_]||(this._coordsDescendingInv[s][_]=[]),this._coordsDescendingInv[s][_].push(f[_])}}for(const s of t._order){const u=t._layers[s],p=u.source;if(this._renderToTexture[u.type]&&!this._coordsDescendingInvStr[p]){this._coordsDescendingInvStr[p]={};for(const f in this._coordsDescendingInv[p])this._coordsDescendingInvStr[p][f]=this._coordsDescendingInv[p][f].map(_=>_.key).sort().join()}}return this._renderableTiles.forEach(s=>{for(const u in this._coordsDescendingInvStr){const p=this._coordsDescendingInvStr[u][s.tileID.key];p&&p!==s.textureCoords[u]&&s.clearTextures(this.painter),n.needsRerender(u,s.tileID)&&s.clearTextures(this.painter)}this._rerender[s.tileID.key]=!s.textures.length}),n.clearRerenderCache(),n.sourceCache.removeOutdated(this.painter),this}renderLayer(t){const n=t.type,s=this.painter,u=s.style._order,p=s.currentLayer,f=p+1===u.length;if(this._renderToTexture[n]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(u[p]),!f))return!0;if(this._renderToTexture[this._prevType]||n==="hillshade"||this._renderToTexture[n]&&f){this._prevType=n;const _=this._stacks.length-1,y=this._stacks[_]||[];for(const v of this._renderableTiles){if(Da(s,s.style.terrain,v,_),this._rerender[v.tileID.key]){s.context.clear({color:a.Color.transparent});for(let E=0;E<y.length;E++){const M=s.style._layers[y[E]],z=M.source?this._coordsDescendingInv[M.source][v.tileID.key]:[v.tileID];s._renderTileClippingMasks(M,z),s.renderLayer(s,s.style.sourceCaches[M.source],M,z),M.source&&(v.textureCoords[M.source]=this._coordsDescendingInvStr[M.source][v.tileID.key])}}Vo(s,s.style.terrain,v)}if(n==="hillshade"){this._stacks.push([u[p]]);for(const v of this._renderableTiles){const E=this._coordsDescendingInv[t.source][v.tileID.key];Da(s,s.style.terrain,v,this._stacks.length-1),s.context.clear({color:a.Color.transparent}),s._renderTileClippingMasks(t,E),s.renderLayer(s,s.style.sourceCaches[t.source],t,E),Vo(s,s.style.terrain,v)}return!0}return this._renderToTexture[n]}return!1}}const so={symbol:function(l,t,n,s,u){if(l.renderPass!=="translucent")return;const p=Ft.disabled,f=l.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(_,y,v,E,M,z,V){const U=y.transform,$=M==="map",H=z==="map";for(const Q of _){const oe=E.getTile(Q),N=oe.getBucket(v);if(!N||!N.text||!N.text.segments.get().length)continue;const le=a.evaluateSizeForZoom(N.textSizeData,U.zoom),se=ti(oe,1,y.transform.zoom),me=Kr(Q.posMatrix,H,$,y.transform,se),ge=v.layout.get("icon-text-fit")!=="none"&&N.hasIconData();if(le){const we=Math.pow(2,U.zoom-oe.tileID.overscaledZ);Ma(N,$,H,V,U,me,Q.posMatrix,we,le,ge,y.style.terrain?(fe,Fe)=>y.style.terrain.getElevation(Q,fe,Fe):null)}}}(s,l,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),u),n.paint.get("icon-opacity").constantOr(1)!==0&&Oo(l,t,n,s,!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"),p,f),n.paint.get("text-opacity").constantOr(1)!==0&&Oo(l,t,n,s,!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"),p,f),t.map.showCollisionBoxes&&(zn(l,t,n,s,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),zn(l,t,n,s,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(l,t,n,s){if(l.renderPass!=="translucent")return;const u=n.paint.get("circle-opacity"),p=n.paint.get("circle-stroke-width"),f=n.paint.get("circle-stroke-opacity"),_=!n.layout.get("circle-sort-key").isConstant();if(u.constantOr(1)===0&&(p.constantOr(1)===0||f.constantOr(1)===0))return;const y=l.context,v=y.gl,E=l.depthModeForSublayer(0,mt.ReadOnly),M=Ft.disabled,z=l.colorModeForRenderPass(),V=[];for(let U=0;U<s.length;U++){const $=s[U],H=t.getTile($),Q=H.getBucket(n);if(!Q)continue;const oe=Q.programConfigurations.get(n.id),N=l.useProgram("circle",oe),le=Q.layoutVertexBuffer,se=Q.indexBuffer,me=l.style.terrain&&l.style.terrain.getTerrainData($),ge={programConfiguration:oe,program:N,layoutVertexBuffer:le,indexBuffer:se,uniformValues:_a(l,$,H,n),terrainData:me};if(_){const we=Q.segments.get();for(const fe of we)V.push({segments:new a.SegmentVector([fe]),sortKey:fe.sortKey,state:ge})}else V.push({segments:Q.segments,sortKey:0,state:ge})}_&&V.sort((U,$)=>U.sortKey-$.sortKey);for(const U of V){const{programConfiguration:$,program:H,layoutVertexBuffer:Q,indexBuffer:oe,uniformValues:N,terrainData:le}=U.state;H.draw(y,v.TRIANGLES,E,M,z,Nt.disabled,N,le,n.id,Q,oe,U.segments,n.paint,l.transform.zoom,$)}},heatmap:function(l,t,n,s){if(n.paint.get("heatmap-opacity")!==0)if(l.renderPass==="offscreen"){const u=l.context,p=u.gl,f=Ft.disabled,_=new Ot([p.ONE,p.ONE],a.Color.transparent,[!0,!0,!0,!0]);(function(y,v,E){const M=y.gl;y.activeTexture.set(M.TEXTURE1),y.viewport.set([0,0,v.width/4,v.height/4]);let z=E.heatmapFbo;if(z)M.bindTexture(M.TEXTURE_2D,z.colorAttachment.get()),y.bindFramebuffer.set(z.framebuffer);else{const V=M.createTexture();M.bindTexture(M.TEXTURE_2D,V),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_S,M.CLAMP_TO_EDGE),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_T,M.CLAMP_TO_EDGE),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MIN_FILTER,M.LINEAR),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MAG_FILTER,M.LINEAR),z=E.heatmapFbo=y.createFramebuffer(v.width/4,v.height/4,!1),function(U,$,H,Q){const oe=U.gl;oe.texImage2D(oe.TEXTURE_2D,0,oe.RGBA,$.width/4,$.height/4,0,oe.RGBA,U.extRenderToTextureHalfFloat?U.extTextureHalfFloat.HALF_FLOAT_OES:oe.UNSIGNED_BYTE,null),Q.colorAttachment.set(H)}(y,v,V,z)}})(u,l,n),u.clear({color:a.Color.transparent});for(let y=0;y<s.length;y++){const v=s[y];if(t.hasRenderableParent(v))continue;const E=t.getTile(v),M=E.getBucket(n);if(!M)continue;const z=M.programConfigurations.get(n.id),V=l.useProgram("heatmap",z),{zoom:U}=l.transform;V.draw(u,p.TRIANGLES,mt.disabled,f,_,Nt.disabled,Ao(v.posMatrix,E,U,n.paint.get("heatmap-intensity")),null,n.id,M.layoutVertexBuffer,M.indexBuffer,M.segments,n.paint,l.transform.zoom,z)}u.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.colorModeForRenderPass()),function(u,p){const f=u.context,_=f.gl,y=p.heatmapFbo;if(!y)return;f.activeTexture.set(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,y.colorAttachment.get()),f.activeTexture.set(_.TEXTURE1);let v=p.colorRampTexture;v||(v=p.colorRampTexture=new Ie(f,p.colorRamp,_.RGBA)),v.bind(_.LINEAR,_.CLAMP_TO_EDGE),u.useProgram("heatmapTexture").draw(f,_.TRIANGLES,mt.disabled,Ft.disabled,u.colorModeForRenderPass(),Nt.disabled,((E,M,z,V)=>{const U=a.create();a.ortho(U,0,E.width,E.height,0,0,1);const $=E.context.gl;return{u_matrix:U,u_world:[$.drawingBufferWidth,$.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:M.paint.get("heatmap-opacity")}})(u,p),null,p.id,u.viewportBuffer,u.quadTriangleIndexBuffer,u.viewportSegments,p.paint,u.transform.zoom)}(l,n))},line:function(l,t,n,s){if(l.renderPass!=="translucent")return;const u=n.paint.get("line-opacity"),p=n.paint.get("line-width");if(u.constantOr(1)===0||p.constantOr(1)===0)return;const f=l.depthModeForSublayer(0,mt.ReadOnly),_=l.colorModeForRenderPass(),y=n.paint.get("line-dasharray"),v=n.paint.get("line-pattern"),E=v.constantOr(1),M=n.paint.get("line-gradient"),z=n.getCrossfadeParameters(),V=E?"linePattern":y?"lineSDF":M?"lineGradient":"line",U=l.context,$=U.gl;let H=!0;for(const Q of s){const oe=t.getTile(Q);if(E&&!oe.patternsLoaded())continue;const N=oe.getBucket(n);if(!N)continue;const le=N.programConfigurations.get(n.id),se=l.context.program.get(),me=l.useProgram(V,le),ge=H||me.program!==se,we=l.style.terrain&&l.style.terrain.getTerrainData(Q),fe=v.constantOr(null);if(fe&&oe.imageAtlas){const Oe=oe.imageAtlas,ot=Oe.patternPositions[fe.to.toString()],ct=Oe.patternPositions[fe.from.toString()];ot&&ct&&le.setConstantPatternPositions(ot,ct)}const Fe=we?Q:null,Ae=E?Po(l,oe,n,z,Fe):y?Jn(l,oe,n,y,z,Fe):M?ps(l,oe,n,N.lineClipsArray.length,Fe):Cn(l,oe,n,Fe);if(E)U.activeTexture.set($.TEXTURE0),oe.imageAtlasTexture.bind($.LINEAR,$.CLAMP_TO_EDGE),le.updatePaintBuffers(z);else if(y&&(ge||l.lineAtlas.dirty))U.activeTexture.set($.TEXTURE0),l.lineAtlas.bind(U);else if(M){const Oe=N.gradients[n.id];let ot=Oe.texture;if(n.gradientVersion!==Oe.version){let ct=256;if(n.stepInterpolant){const Xe=t.getSource().maxzoom,Pt=Q.canonical.z===Xe?Math.ceil(1<<l.transform.maxZoom-Q.canonical.z):1;ct=a.clamp(a.nextPowerOfTwo(N.maxLineLength/a.EXTENT*1024*Pt),256,U.maxTextureSize)}Oe.gradient=a.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:ct,image:Oe.gradient||void 0,clips:N.lineClipsArray}),Oe.texture?Oe.texture.update(Oe.gradient):Oe.texture=new Ie(U,Oe.gradient,$.RGBA),Oe.version=n.gradientVersion,ot=Oe.texture}U.activeTexture.set($.TEXTURE0),ot.bind(n.stepInterpolant?$.NEAREST:$.LINEAR,$.CLAMP_TO_EDGE)}me.draw(U,$.TRIANGLES,f,l.stencilModeForClipping(Q),_,Nt.disabled,Ae,we,n.id,N.layoutVertexBuffer,N.indexBuffer,N.segments,n.paint,l.transform.zoom,le,N.layoutVertexBuffer2),H=!1}},fill:function(l,t,n,s){const u=n.paint.get("fill-color"),p=n.paint.get("fill-opacity");if(p.constantOr(1)===0)return;const f=l.colorModeForRenderPass(),_=n.paint.get("fill-pattern"),y=l.opaquePassEnabledForLayer()&&!_.constantOr(1)&&u.constantOr(a.Color.transparent).a===1&&p.constantOr(0)===1?"opaque":"translucent";if(l.renderPass===y){const v=l.depthModeForSublayer(1,l.renderPass==="opaque"?mt.ReadWrite:mt.ReadOnly);ro(l,t,n,s,v,f,!1)}if(l.renderPass==="translucent"&&n.paint.get("fill-antialias")){const v=l.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,mt.ReadOnly);ro(l,t,n,s,v,f,!0)}},"fill-extrusion":function(l,t,n,s){const u=n.paint.get("fill-extrusion-opacity");if(u!==0&&l.renderPass==="translucent"){const p=new mt(l.context.gl.LEQUAL,mt.ReadWrite,l.depthRangeFor3D);if(u!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))no(l,t,n,s,p,Ft.disabled,Ot.disabled),no(l,t,n,s,p,l.stencilModeFor3D(),l.colorModeForRenderPass());else{const f=l.colorModeForRenderPass();no(l,t,n,s,p,Ft.disabled,f)}}},hillshade:function(l,t,n,s){if(l.renderPass!=="offscreen"&&l.renderPass!=="translucent")return;const u=l.context,p=l.depthModeForSublayer(0,mt.ReadOnly),f=l.colorModeForRenderPass(),[_,y]=l.renderPass==="translucent"?l.stencilConfigForOverlap(s):[{},s];for(const v of y){const E=t.getTile(v);E.needsHillshadePrepare!==void 0&&E.needsHillshadePrepare&&l.renderPass==="offscreen"?Pa(l,E,n,p,Ft.disabled,f):l.renderPass==="translucent"&&Is(l,v,E,n,p,_[v.overscaledZ],f)}u.viewport.set([0,0,l.width,l.height])},raster:function(l,t,n,s){if(l.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!s.length)return;const u=l.context,p=u.gl,f=t.getSource(),_=l.useProgram("raster"),y=l.colorModeForRenderPass(),[v,E]=f instanceof Ii?[{},s]:l.stencilConfigForOverlap(s),M=E[E.length-1].overscaledZ,z=!l.options.moving;for(const V of E){const U=l.depthModeForSublayer(V.overscaledZ-M,n.paint.get("raster-opacity")===1?mt.ReadWrite:mt.ReadOnly,p.LESS),$=t.getTile(V);$.registerFadeDuration(n.paint.get("raster-fade-duration"));const H=t.findLoadedParent(V,0),Q=Uo($,H,t,n,l.transform,l.style.terrain);let oe,N;const le=n.paint.get("raster-resampling")==="nearest"?p.NEAREST:p.LINEAR;u.activeTexture.set(p.TEXTURE0),$.texture.bind(le,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),u.activeTexture.set(p.TEXTURE1),H?(H.texture.bind(le,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),oe=Math.pow(2,H.tileID.overscaledZ-$.tileID.overscaledZ),N=[$.tileID.canonical.x*oe%1,$.tileID.canonical.y*oe%1]):$.texture.bind(le,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST);const se=l.style.terrain&&l.style.terrain.getTerrainData(V),me=se?V:null,ge=me?me.posMatrix:l.transform.calculatePosMatrix(V.toUnwrapped(),z),we=ya(ge,N||[0,0],oe||1,Q,n);f instanceof Ii?_.draw(u,p.TRIANGLES,U,Ft.disabled,y,Nt.disabled,we,se,n.id,f.boundsBuffer,l.quadTriangleIndexBuffer,f.boundsSegments):_.draw(u,p.TRIANGLES,U,v[V.overscaledZ],y,Nt.disabled,we,se,n.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments)}},background:function(l,t,n,s){const u=n.paint.get("background-color"),p=n.paint.get("background-opacity");if(p===0)return;const f=l.context,_=f.gl,y=l.transform,v=y.tileSize,E=n.paint.get("background-pattern");if(l.isPatternMissing(E))return;const M=!E&&u.a===1&&p===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass!==M)return;const z=Ft.disabled,V=l.depthModeForSublayer(0,M==="opaque"?mt.ReadWrite:mt.ReadOnly),U=l.colorModeForRenderPass(),$=l.useProgram(E?"backgroundPattern":"background"),H=s||y.coveringTiles({tileSize:v,terrain:l.style.terrain});E&&(f.activeTexture.set(_.TEXTURE0),l.imageManager.bind(l.context));const Q=n.getCrossfadeParameters();for(const oe of H){const N=s?oe.posMatrix:l.transform.calculatePosMatrix(oe.toUnwrapped()),le=E?Pl(N,p,l,E,{tileID:oe,tileSize:v},Q):Ml(N,p,u),se=l.style.terrain&&l.style.terrain.getTerrainData(oe);$.draw(f,_.TRIANGLES,V,z,U,Nt.disabled,le,se,n.id,l.tileExtentBuffer,l.quadTriangleIndexBuffer,l.tileExtentSegments)}},debug:function(l,t,n){for(let s=0;s<n.length;s++)Vl(l,t,n[s])},custom:function(l,t,n){const s=l.context,u=n.implementation;if(l.renderPass==="offscreen"){const p=u.prerender;p&&(l.setCustomLayerDefaults(),s.setColorMode(l.colorModeForRenderPass()),p.call(u,s.gl,l.transform.customLayerMatrix()),s.setDirty(),l.setBaseState())}else if(l.renderPass==="translucent"){l.setCustomLayerDefaults(),s.setColorMode(l.colorModeForRenderPass()),s.setStencilMode(Ft.disabled);const p=u.renderingMode==="3d"?new mt(l.context.gl.LEQUAL,mt.ReadWrite,l.depthRangeFor3D):l.depthModeForSublayer(0,mt.ReadOnly);s.setDepthMode(p),u.render(s.gl,l.transform.customLayerMatrix()),s.setDirty(),l.setBaseState(),s.bindFramebuffer.set(null)}}};class As{constructor(t,n){this.context=new Aa(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:a.create(),renderTime:0},this.setup(),this.numSublayers=Li.maxUnderzooming+Li.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new et,this.gpuTimers={}}resize(t,n,s){if(this.width=t*s,this.height=n*s,this.pixelRatio=s,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const u of this.style._order)this.style._layers[u].resize()}setup(){const t=this.context,n=new a.PosArray;n.emplaceBack(0,0),n.emplaceBack(a.EXTENT,0),n.emplaceBack(0,a.EXTENT),n.emplaceBack(a.EXTENT,a.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,wt.members),this.tileExtentSegments=a.SegmentVector.simpleSegment(0,0,4,2);const s=new a.PosArray;s.emplaceBack(0,0),s.emplaceBack(a.EXTENT,0),s.emplaceBack(0,a.EXTENT),s.emplaceBack(a.EXTENT,a.EXTENT),this.debugBuffer=t.createVertexBuffer(s,wt.members),this.debugSegments=a.SegmentVector.simpleSegment(0,0,4,5);const u=new a.RasterBoundsArray;u.emplaceBack(0,0,0,0),u.emplaceBack(a.EXTENT,0,a.EXTENT,0),u.emplaceBack(0,a.EXTENT,0,a.EXTENT),u.emplaceBack(a.EXTENT,a.EXTENT,a.EXTENT,a.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(u,ki.members),this.rasterBoundsSegments=a.SegmentVector.simpleSegment(0,0,4,2);const p=new a.PosArray;p.emplaceBack(0,0),p.emplaceBack(1,0),p.emplaceBack(0,1),p.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(p,wt.members),this.viewportSegments=a.SegmentVector.simpleSegment(0,0,4,2);const f=new a.LineStripIndexArray;f.emplaceBack(0),f.emplaceBack(1),f.emplaceBack(3),f.emplaceBack(2),f.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(f);const _=new a.TriangleIndexArray;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_),this.emptyTexture=new Ie(t,{width:1,height:1,data:new Uint8Array([0,0,0,0])},t.gl.RGBA);const y=this.context.gl;this.stencilClearMode=new Ft({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=a.create();a.ortho(s,0,this.width,this.height,0,0,1),a.scale(s,s,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,mt.disabled,this.stencilClearMode,Ot.disabled,Nt.disabled,In(s),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const s=this.context,u=s.gl;this.nextStencilID+n.length>256&&this.clearStencil(),s.setColorMode(Ot.disabled),s.setDepthMode(mt.disabled);const p=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const f of n){const _=this._tileClippingMaskIDs[f.key]=this.nextStencilID++,y=this.style.terrain&&this.style.terrain.getTerrainData(f);p.draw(s,u.TRIANGLES,mt.disabled,new Ft({func:u.ALWAYS,mask:0},_,255,u.KEEP,u.KEEP,u.REPLACE),Ot.disabled,Nt.disabled,In(f.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new Ft({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Ft({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,s=t.sort((f,_)=>_.overscaledZ-f.overscaledZ),u=s[s.length-1].overscaledZ,p=s[0].overscaledZ-u+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const f={};for(let _=0;_<p;_++)f[_+u]=new Ft({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[f,s]}return[{[u]:Ft.disabled},s]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Ot([t.CONSTANT_COLOR,t.ONE],new a.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ot.unblended:Ot.alphaBlended}depthModeForSublayer(t,n,s){if(!this.opaquePassEnabledForLayer())return mt.disabled;const u=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new mt(s||this.context.gl.LEQUAL,n,[u,u])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(a.exported.now()),this.imageManager.beginFrame();const s=this.style._order,u=this.style.sourceCaches,p=this.style.terrain&&new La(this);for(const v in u){const E=u[v];E.used&&E.prepare(this.context)}const f={},_={},y={};for(const v in u){const E=u[v];f[v]=E.getVisibleCoordinates(),_[v]=f[v].slice().reverse(),y[v]=E.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let v=0;v<s.length;v++)if(this.style._layers[s[v]].is3D()){this.opaquePassCutoff=v;break}if(p){this.opaquePassCutoff=0;const v=this.style.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!a.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||v.length)&&(a.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(E,M){const z=E.context,V=z.gl,U=Ot.unblended,$=new mt(V.LEQUAL,mt.ReadWrite,[0,1]),H=M.getTerrainMesh(),Q=M.sourceCache.getRenderableTiles(),oe=E.useProgram("terrainDepth");z.bindFramebuffer.set(M.getFramebuffer("depth").framebuffer),z.viewport.set([0,0,E.width/devicePixelRatio,E.height/devicePixelRatio]),z.clear({color:a.Color.transparent,depth:1});for(const N of Q){const le=M.getTerrainData(N.tileID),se=E.transform.calculatePosMatrix(N.tileID.toUnwrapped());oe.draw(z,V.TRIANGLES,$,Ft.disabled,U,Nt.backCCW,{u_matrix:se},le,"terrain",H.vertexBuffer,H.indexBuffer,H.segments)}z.bindFramebuffer.set(null),z.viewport.set([0,0,E.width,E.height])}(this,this.style.terrain),function(E,M){const z=E.context,V=z.gl,U=Ot.unblended,$=new mt(V.LEQUAL,mt.ReadWrite,[0,1]),H=M.getTerrainMesh(),Q=M.getCoordsTexture(),oe=M.sourceCache.getRenderableTiles(),N=E.useProgram("terrainCoords");z.bindFramebuffer.set(M.getFramebuffer("coords").framebuffer),z.viewport.set([0,0,E.width/devicePixelRatio,E.height/devicePixelRatio]),z.clear({color:a.Color.transparent,depth:1}),M.coordsIndex=[];for(const le of oe){const se=M.getTerrainData(le.tileID);z.activeTexture.set(V.TEXTURE0),V.bindTexture(V.TEXTURE_2D,Q.texture);const me=E.transform.calculatePosMatrix(le.tileID.toUnwrapped());N.draw(z,V.TRIANGLES,$,Ft.disabled,U,Nt.backCCW,{u_matrix:me,u_terrain_coords_id:(255-M.coordsIndex.length)/255,u_texture:0},se,"terrain",H.vertexBuffer,H.indexBuffer,H.segments),M.coordsIndex.push(le.tileID.key)}z.bindFramebuffer.set(null),z.viewport.set([0,0,E.width,E.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(const v of s){const E=this.style._layers[v];if(!E.hasOffscreenPass()||E.isHidden(this.transform.zoom))continue;const M=_[E.source];(E.type==="custom"||M.length)&&this.renderLayer(this,u[E.source],E,M)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?a.Color.black:a.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!p)for(this.renderPass="opaque",this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){const v=this.style._layers[s[this.currentLayer]],E=u[v.source],M=f[v.source];this._renderTileClippingMasks(v,M),this.renderLayer(this,E,v,M)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){const v=this.style._layers[s[this.currentLayer]],E=u[v.source];if(p&&p.renderLayer(v))continue;const M=(v.type==="symbol"?y:_)[v.source];this._renderTileClippingMasks(v,f[v.source]),this.renderLayer(this,E,v,M)}if(this.options.showTileBoundaries){let v,E;Object.values(this.style._layers).forEach(M=>{M.source&&!M.isHidden(this.transform.zoom)&&(M.source!==(E&&E.id)&&(E=this.style.sourceCaches[M.source]),(!v||v.getSource().maxzoom<E.getSource().maxzoom)&&(v=E))}),v&&so.debug(this,v,v.getVisibleCoordinates())}this.options.showPadding&&function(v){const E=v.transform.padding;rn(v,v.transform.height-(E.top||0),3,$o),rn(v,E.bottom||0,3,rr),oo(v,E.left||0,3,za),oo(v,v.transform.width-(E.right||0),3,Cs);const M=v.transform.centerPoint;(function(z,V,U,$){kn(z,V-1,U-10,2,20,$),kn(z,V-10,U-1,20,2,$)})(v,M.x,v.transform.height-M.y,ka)}(this),this.context.setDefault()}renderLayer(t,n,s,u){s.isHidden(this.transform.zoom)||(s.type==="background"||s.type==="custom"||(u||[]).length)&&(this.id=s.id,this.gpuTimingStart(s),so[s.type](t,n,s,u,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const n=this.context.extTimerQuery;let s=this.gpuTimers[t.id];s||(s=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:n.createQueryEXT()}),s.calls++,n.beginQueryEXT(n.TIME_ELAPSED_EXT,s.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}queryGpuTimers(t){const n={};for(const s in t){const u=t[s],p=this.context.extTimerQuery,f=p.getQueryObjectEXT(u.query,p.QUERY_RESULT_EXT)/1e6;p.deleteQueryEXT(u.query),n[s]=f}return n}translatePosMatrix(t,n,s,u,p){if(!s[0]&&!s[1])return t;const f=p?u==="map"?this.transform.angle:0:u==="viewport"?-this.transform.angle:0;if(f){const v=Math.sin(f),E=Math.cos(f);s=[s[0]*E-s[1]*v,s[0]*v+s[1]*E]}const _=[p?s[0]:ti(n,s[0],this.transform.zoom),p?s[1]:ti(n,s[1],this.transform.zoom),0],y=new Float32Array(16);return a.translate(y,t,_),y}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):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()),s=this.imageManager.getPattern(t.to.toString());return!n||!s}useProgram(t,n){this.cache=this.cache||{};const s=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.terrain?"/terrain":"");return this.cache[s]||(this.cache[s]=new da(this.context,t,Hn[t],n,fs[t],this._showOverdrawInspector,this.style.terrain)),this.cache[s]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Ie(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class No{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,s){const u=Math.pow(2,s),p=[[-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(_=>{const y=1/(_=a.transformMat4([],_,t))[3]/n*u;return a.mul$1(_,_,[y,y,1/_[3],y])}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const y=a.sub([],p[_[0]],p[_[1]]),v=a.sub([],p[_[2]],p[_[1]]),E=a.normalize([],a.cross([],y,v)),M=-a.dot(E,p[_[1]]);return E.concat(M)});return new No(p,f)}}class ao{constructor(t,n){this.min=t,this.max=n,this.center=a.scale$1([],a.add([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],s=a.clone$2(this.min),u=a.clone$2(this.max);for(let p=0;p<n.length;p++)s[p]=n[p]?this.min[p]:this.center[p],u[p]=n[p]?this.center[p]:this.max[p];return u[2]=this.max[2],new ao(s,u)}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]}intersects(t){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let s=!0;for(let u=0;u<t.planes.length;u++){const p=t.planes[u];let f=0;for(let _=0;_<n.length;_++)a.dot$1(p,n[_])>=0&&f++;if(f===0)return 0;f!==n.length&&(s=!1)}if(s)return 2;for(let u=0;u<3;u++){let p=Number.MAX_VALUE,f=-Number.MAX_VALUE;for(let _=0;_<t.points.length;_++){const y=t.points[_][u]-this.min[u];p=Math.min(p,y),f=Math.max(f,y)}if(f<0||p>this.max[u]-this.min[u])return 0}return 1}}class Dn{constructor(t=0,n=0,s=0,u=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(s)||s<0||isNaN(u)||u<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=s,this.right=u}interpolate(t,n,s){return n.top!=null&&t.top!=null&&(this.top=a.number(t.top,n.top,s)),n.bottom!=null&&t.bottom!=null&&(this.bottom=a.number(t.bottom,n.bottom,s)),n.left!=null&&t.left!=null&&(this.left=a.number(t.left,n.left,s)),n.right!=null&&t.right!=null&&(this.right=a.number(t.right,n.right,s)),this}getCenter(t,n){const s=a.clamp((this.left+t-this.right)/2,0,t),u=a.clamp((this.top+n-this.bottom)/2,0,n);return new a.pointGeometry(s,u)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Dn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class lo{constructor(t,n,s,u,p){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=p===void 0||!!p,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=s==null?0:s,this._maxPitch=u==null?60:u,this.setMaxBounds(),this.width=0,this.height=0,this._center=new a.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Dn,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new lo(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t._elevation=this._elevation,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-a.wrap(t,-180,180)*Math.PI/180;var s;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(s=new a.ARRAY_TYPE(4),a.ARRAY_TYPE!=Float32Array&&(s[1]=0,s[2]=0),s[0]=1,s[3]=1,s),function(u,p,f){var _=p[0],y=p[1],v=p[2],E=p[3],M=Math.sin(f),z=Math.cos(f);u[0]=_*z+v*M,u[1]=y*z+E*M,u[2]=_*-M+v*z,u[3]=y*-M+E*z}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=a.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.scale=this.zoomScale(n),this.tileZoom=Math.floor(n),this.zoomFraction=n-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(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)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,s){this._unmodified=!1,this._edgeInsets.interpolate(t,n,s),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new a.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const s=this.pointCoordinate(new a.pointGeometry(0,0)),u=this.pointCoordinate(new a.pointGeometry(this.width,0)),p=this.pointCoordinate(new a.pointGeometry(this.width,this.height)),f=this.pointCoordinate(new a.pointGeometry(0,this.height)),_=Math.floor(Math.min(s.x,u.x,p.x,f.x)),y=Math.floor(Math.max(s.x,u.x,p.x,f.x)),v=1;for(let E=_-v;E<=y+v;E++)E!==0&&n.push(new a.UnwrappedTileID(E,t))}return n}coveringTiles(t){var n,s;let u=this.coveringZoomLevel(t);const p=u;if(t.minzoom!==void 0&&u<t.minzoom)return[];t.maxzoom!==void 0&&u>t.maxzoom&&(u=t.maxzoom);const f=this.pointCoordinate(this.getCameraPoint()),_=a.MercatorCoordinate.fromLngLat(this.center),y=Math.pow(2,u),v=[y*f.x,y*f.y,0],E=[y*_.x,y*_.y,0],M=No.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,u);let z=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(z=u);const V=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,U=N=>({aabb:new ao([N*y,0,0],[(N+1)*y,y,0]),zoom:0,x:0,y:0,wrap:N,fullyVisible:!1}),$=[],H=[],Q=u,oe=t.reparseOverscaled?p:u;if(this._renderWorldCopies)for(let N=1;N<=3;N++)$.push(U(-N)),$.push(U(N));for($.push(U(0));$.length>0;){const N=$.pop(),le=N.x,se=N.y;let me=N.fullyVisible;if(!me){const Oe=N.aabb.intersects(M);if(Oe===0)continue;me=Oe===2}const ge=t.terrain?v:E,we=N.aabb.distanceX(ge),fe=N.aabb.distanceY(ge),Fe=Math.max(Math.abs(we),Math.abs(fe)),Ae=V+(1<<Q-N.zoom)-2;if(N.zoom===Q||Fe>Ae&&N.zoom>=z){const Oe=Q-N.zoom,ot=v[0]-.5-(le<<Oe),ct=v[1]-.5-(se<<Oe);H.push({tileID:new a.OverscaledTileID(N.zoom===Q?oe:N.zoom,N.wrap,N.zoom,le,se),distanceSq:a.sqrLen([E[0]-.5-le,E[1]-.5-se]),tileDistanceToCamera:Math.sqrt(ot*ot+ct*ct)})}else for(let Oe=0;Oe<4;Oe++){const ot=(le<<1)+Oe%2,ct=(se<<1)+(Oe>>1),Xe=N.zoom+1;let Pt=N.aabb.quadrant(Oe);if(t.terrain){const zt=new a.OverscaledTileID(Xe,N.wrap,Xe,ot,ct),yt=t.terrain.getMinMaxElevation(zt),Et=(n=yt.minElevation)!==null&&n!==void 0?n:this.elevation,Dt=(s=yt.maxElevation)!==null&&s!==void 0?s:this.elevation;Pt=new ao([Pt.min[0],Pt.min[1],Et],[Pt.max[0],Pt.max[1],Dt])}$.push({aabb:Pt,zoom:Xe,x:ot,y:ct,wrap:N.wrap,fullyVisible:me})}}return H.sort((N,le)=>N.distanceSq-le.distanceSq).map(N=>N.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=a.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new a.pointGeometry(a.mercatorXfromLng(t.lng)*this.worldSize,a.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new a.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0)}getElevation(t,n){const s=a.MercatorCoordinate.fromLngLat(t),u=(1<<this.tileZoom)*a.EXTENT,p=s.x*u,f=s.y*u,_=Math.floor(p/a.EXTENT),y=Math.floor(f/a.EXTENT),v=new a.OverscaledTileID(this.tileZoom,0,this.tileZoom,_,y);return n.getElevation(v,p%a.EXTENT,f%a.EXTENT,a.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.pointLocation(this.centerPoint,t),s=this.getElevation(n,t);if(!(this.elevation-s))return;const u=this.getCameraPosition(),p=a.MercatorCoordinate.fromLngLat(u.lngLat,u.altitude),f=a.MercatorCoordinate.fromLngLat(n,s),_=p.x-f.x,y=p.y-f.y,v=p.z-f.z,E=Math.sqrt(_*_+y*y+v*v),M=this.scaleZoom(this.cameraToCenterDistance/E/this.tileSize);this._elevation=s,this._center=n,this.zoom=M}setLocationAtPoint(t,n){const s=this.pointCoordinate(n),u=this.pointCoordinate(this.centerPoint),p=this.locationCoordinate(t),f=new a.MercatorCoordinate(p.x-(s.x-u.x),p.y-(s.y-u.y));this.center=this.coordinateLocation(f),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),this.getElevation(t,n),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return a.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const z=n.pointCoordinate(t);if(z!=null)return z}const s=[t.x,t.y,0,1],u=[t.x,t.y,1,1];a.transformMat4(s,s,this.pixelMatrixInverse),a.transformMat4(u,u,this.pixelMatrixInverse);const p=s[3],f=u[3],_=s[1]/p,y=u[1]/f,v=s[2]/p,E=u[2]/f,M=v===E?0:(0-v)/(E-v);return new a.MercatorCoordinate(a.number(s[0]/p,u[0]/f,M)/this.worldSize,a.number(_,y,M)/this.worldSize)}coordinatePoint(t,n=0,s=this.pixelMatrix){const u=[t.x*this.worldSize,t.y*this.worldSize,n,1];return a.transformMat4(u,u,s),new a.pointGeometry(u[0]/u[3],u[1]/u[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new a.LngLatBounds().extend(this.pointLocation(new a.pointGeometry(0,t))).extend(this.pointLocation(new a.pointGeometry(this.width,t))).extend(this.pointLocation(new a.pointGeometry(this.width,this.height))).extend(this.pointLocation(new a.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new a.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const s=t.key,u=n?this._alignedPosMatrixCache:this._posMatrixCache;if(u[s])return u[s];const p=t.canonical,f=this.worldSize/this.zoomScale(p.z),_=p.x+Math.pow(2,p.z)*t.wrap,y=a.identity(new Float64Array(16));return a.translate(y,y,[_*f,p.y*f,0]),a.scale(y,y,[f/a.EXTENT,f/a.EXTENT,1]),a.multiply(y,n?this.alignedProjMatrix:this.projMatrix,y),u[s]=new Float32Array(y),u[s]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,s,u,p=-90,f=90,_=-180,y=180;const v=this.size,E=this._unmodified;if(this.latRange){const V=this.latRange;p=a.mercatorYfromLat(V[1])*this.worldSize,f=a.mercatorYfromLat(V[0])*this.worldSize,t=f-p<v.y?v.y/(f-p):0}if(this.lngRange){const V=this.lngRange;_=a.wrap(a.mercatorXfromLng(V[0])*this.worldSize,0,this.worldSize),y=a.wrap(a.mercatorXfromLng(V[1])*this.worldSize,0,this.worldSize),y<_&&(y+=this.worldSize),n=y-_<v.x?v.x/(y-_):0}const M=this.point,z=Math.max(n||0,t||0);if(z)return this.center=this.unproject(new a.pointGeometry(n?(y+_)/2:M.x,t?(f+p)/2:M.y)),this.zoom+=this.scaleZoom(z),this._unmodified=E,void(this._constraining=!1);if(this.latRange){const V=M.y,U=v.y/2;V-U<p&&(u=p+U),V+U>f&&(u=f-U)}if(this.lngRange){const V=(_+y)/2,U=a.wrap(M.x,V-this.worldSize/2,V+this.worldSize/2),$=v.x/2;U-$<_&&(s=_+$),U+$>y&&(s=y-$)}s===void 0&&u===void 0||(this.center=this.unproject(new a.pointGeometry(s!==void 0?s:M.x,u!==void 0?u:M.y)).wrap()),this._unmodified=E,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,s=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=a.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let u=a.identity(new Float64Array(16));a.scale(u,u,[this.width/2,-this.height/2,1]),a.translate(u,u,[1,-1,0]),this.labelPlaneMatrix=u,u=a.identity(new Float64Array(16)),a.scale(u,u,[1,-1,1]),a.translate(u,u,[-1,-1,0]),a.scale(u,u,[2/this.width,2/this.height,1]),this.glCoordMatrix=u,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const p=Math.PI/2+this._pitch,f=this._fov*(.5+t.y/this.height),_=Math.sin(f)*this.cameraToSeaLevelDistance/Math.sin(a.clamp(Math.PI-p-f,.01,Math.PI-.01)),y=this.getHorizon(),v=2*Math.atan(y/this.cameraToCenterDistance)*(.5+t.y/(2*y)),E=Math.sin(v)*this.cameraToSeaLevelDistance/Math.sin(a.clamp(Math.PI-p-v,.01,Math.PI-.01)),M=Math.cos(Math.PI/2-this._pitch)*_+this.cameraToSeaLevelDistance,z=Math.cos(Math.PI/2-this._pitch)*E+this.cameraToSeaLevelDistance,V=1.01*Math.min(M,z),U=this.height/50;u=new Float64Array(16),a.perspective(u,this._fov,this.width/this.height,U,V),u[8]=2*-t.x/this.width,u[9]=2*t.y/this.height,a.scale(u,u,[1,-1,1]),a.translate(u,u,[0,0,-this.cameraToCenterDistance]),a.rotateX(u,u,this._pitch),a.rotateZ(u,u,this.angle),a.translate(u,u,[-n,-s,0]),this.mercatorMatrix=a.scale([],u,[this.worldSize,this.worldSize,this.worldSize]),a.scale(u,u,[1,1,this._pixelPerMeter]),this.pixelMatrix=a.multiply(new Float64Array(16),this.labelPlaneMatrix,u),a.translate(u,u,[0,0,-this.elevation]),this.projMatrix=u,this.invProjMatrix=a.invert([],u),this.pixelMatrix3D=a.multiply(new Float64Array(16),this.labelPlaneMatrix,u);const $=this.width%2/2,H=this.height%2/2,Q=Math.cos(this.angle),oe=Math.sin(this.angle),N=n-Math.round(n)+Q*$+oe*H,le=s-Math.round(s)+Q*H+oe*$,se=new Float64Array(u);if(a.translate(se,se,[N>.5?N-1:N,le>.5?le-1:le,0]),this.alignedProjMatrix=se,u=a.invert(new Float64Array(16),this.pixelMatrix),!u)throw new Error("failed to invert matrix");this.pixelMatrixInverse=u,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new a.pointGeometry(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return a.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.pointGeometry(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let s=n.x,u=n.y,p=n.x,f=n.y;for(const _ of t)s=Math.min(s,_.x),u=Math.min(u,_.y),p=Math.max(p,_.x),f=Math.max(f,_.y);return[new a.pointGeometry(s,u),new a.pointGeometry(p,u),new a.pointGeometry(p,f),new a.pointGeometry(s,f),new a.pointGeometry(s,u)]}}}class Ra{constructor(t){this._hashName=t&&encodeURIComponent(t),a.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(n,s){let u=!1,p=null;const f=()=>{p=null,u&&(n(),p=setTimeout(f,300),u=!1)};return()=>(u=!0,p||f(),p)}(this._updateHashUnthrottled.bind(this))}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()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,u=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,u),f=Math.round(n.lng*p)/p,_=Math.round(n.lat*p)/p,y=this._map.getBearing(),v=this._map.getPitch();let E="";if(E+=t?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(y||v)&&(E+="/"+Math.round(10*y)/10),v&&(E+=`/${Math.round(v)}`),this._hashName){const M=this._hashName;let z=!1;const V=window.location.hash.slice(1).split("&").map(U=>{const $=U.split("=")[0];return $===M?(z=!0,`${$}=${E}`):U}).filter(U=>U);return z||V.push(`${M}=${E}`),`#${V.join("&")}`}return`#${E}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(s=>s.split("=")).forEach(s=>{s[0]===this._hashName&&(n=s)}),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(n=>isNaN(n))){const n=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:n,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch{}}}const co={linearity:.3,easing:a.bezier(0,0,.3,1)},Ba=a.extend({deceleration:2500,maxSpeed:1400},co),Fa=a.extend({deceleration:20,maxSpeed:1400},co),Oa=a.extend({deceleration:1e3,maxSpeed:360},co),Ln=a.extend({deceleration:1e3,maxSpeed:90},co);class Ua{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=a.exported.now();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,pan:new a.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)n.zoom+=p.zoomDelta||0,n.bearing+=p.bearingDelta||0,n.pitch+=p.pitchDelta||0,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,u={};if(n.pan.mag()){const p=ho(n.pan.mag(),s,a.extend({},Ba,t||{}));u.offset=n.pan.mult(p.amount/n.pan.mag()),u.center=this._map.transform.center,uo(u,p)}if(n.zoom){const p=ho(n.zoom,s,Fa);u.zoom=this._map.transform.zoom+p.amount,uo(u,p)}if(n.bearing){const p=ho(n.bearing,s,Oa);u.bearing=this._map.transform.bearing+a.clamp(p.amount,-179,179),uo(u,p)}if(n.pitch){const p=ho(n.pitch,s,Ln);u.pitch=this._map.transform.pitch+p.amount,uo(u,p)}if(u.zoom||u.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;u.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),a.extend(u,{noMoveStart:!0})}}function uo(l,t){(!l.duration||l.duration<t.duration)&&(l.duration=t.duration,l.easing=t.easing)}function ho(l,t,n){const{maxSpeed:s,linearity:u,deceleration:p}=n,f=a.clamp(l*u/(t/1e3),-s,s),_=Math.abs(f)/(p*u);return{easing:n.easing,duration:1e3*_,amount:f*(_/2)}}class qi extends a.Event{constructor(t,n,s,u={}){const p=te.mousePos(n.getCanvasContainer(),s),f=n.unproject(p);super(t,a.extend({point:p,lngLat:f,originalEvent:s},u)),this._defaultPrevented=!1,this.target=n}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class po extends a.Event{constructor(t,n,s){const u=t==="touchend"?s.changedTouches:s.touches,p=te.touchPos(n.getCanvasContainer(),u),f=p.map(y=>n.unproject(y)),_=p.reduce((y,v,E,M)=>y.add(v.div(M.length)),new a.pointGeometry(0,0));super(t,{points:p,point:_,lngLats:f,lngLat:n.unproject(_),originalEvent:s}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Zi extends a.Event{constructor(t,n,s){super(t,{originalEvent:s}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Nl{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Zi(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new qi(t.type,this._map,t))}mouseup(t){this._map.fire(new qi(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new qi(t.type,this._map,t))}dblclick(t){return this._firePreventable(new qi(t.type,this._map,t))}mouseover(t){this._map.fire(new qi(t.type,this._map,t))}mouseout(t){this._map.fire(new qi(t.type,this._map,t))}touchstart(t){return this._firePreventable(new po(t.type,this._map,t))}touchmove(t){this._map.fire(new po(t.type,this._map,t))}touchend(t){this._map.fire(new po(t.type,this._map,t))}touchcancel(t){this._map.fire(new po(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class $r{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new qi(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new qi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new qi(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class $a{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}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&&(te.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const s=n;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const u=this._startPos;this._lastPos=s,this._box||(this._box=te.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const p=Math.min(u.x,s.x),f=Math.max(u.x,s.x),_=Math.min(u.y,s.y),y=Math.max(u.y,s.y);te.setTransform(this._box,`translate(${p}px,${_}px)`),this._box.style.width=f-p+"px",this._box.style.height=y-_+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const s=this._startPos,u=n;if(this.reset(),te.suppressClick(),s.x!==u.x||s.y!==u.y)return this._map.fire(new a.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(s,u,this._map.getBearing(),{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","mapboxgl-crosshair"),this._box&&(te.remove(this._box),this._box=null),te.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new a.Event(t,{originalEvent:n}))}}function Sr(l,t){if(l.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${l.length}, points ${t.length}`);const n={};for(let s=0;s<l.length;s++)n[l[s].identifier]=t[s];return n}class fo{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),s.length===this.numTouches&&(this.centroid=function(u){const p=new a.pointGeometry(0,0);for(const f of u)p._add(f);return p.div(u.length)}(n),this.touches=Sr(s,n)))}touchmove(t,n,s){if(this.aborted||!this.centroid)return;const u=Sr(s,n);for(const p in this.touches){const f=this.touches[p],_=u[p];(!_||_.dist(f)>30)&&(this.aborted=!0)}}touchend(t,n,s){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const u=!this.aborted&&this.centroid;if(this.reset(),u)return u}}}class Ms{constructor(t){this.singleTap=new fo(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,s){this.singleTap.touchstart(t,n,s)}touchmove(t,n,s){this.singleTap.touchmove(t,n,s)}touchend(t,n,s){const u=this.singleTap.touchend(t,n,s);if(u){const p=t.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(u)<30;if(p&&f||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=u,this.count===this.numTaps)return this.reset(),u}}}class Gl{constructor(){this._zoomIn=new Ms({numTouches:1,numTaps:2}),this._zoomOut=new Ms({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,s){this._zoomIn.touchstart(t,n,s),this._zoomOut.touchstart(t,n,s)}touchmove(t,n,s){this._zoomIn.touchmove(t,n,s),this._zoomOut.touchmove(t,n,s)}touchend(t,n,s){const u=this._zoomIn.touchend(t,n,s),p=this._zoomOut.touchend(t,n,s);return u?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:f=>f.easeTo({duration:300,zoom:f.getZoom()+1,around:f.unproject(u)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:f=>f.easeTo({duration:300,zoom:f.getZoom()-1,around:f.unproject(p)},{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}}const ql={0:1,2:2};class Go{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(t,n){return!1}_move(t,n){return{}}mousedown(t,n){if(this._lastPoint)return;const s=te.mouseButton(t);this._correctButton(t,s)&&(this._lastPoint=n,this._eventButton=s)}mousemoveWindow(t,n){const s=this._lastPoint;if(s){if(t.preventDefault(),function(u,p){const f=ql[p];return u.buttons===void 0||(u.buttons&f)!==f}(t,this._eventButton))this.reset();else if(this._moved||!(n.dist(s)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(s,n)}}mouseupWindow(t){this._lastPoint&&te.mouseButton(t)===this._eventButton&&(this._moved&&te.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class mo extends Go{mousedown(t,n){super.mousedown(t,n),this._lastPoint&&(this._active=!0)}_correctButton(t,n){return n===0&&!t.ctrlKey}_move(t,n){return{around:n,panDelta:n.sub(t)}}}class Ir extends Go{_correctButton(t,n){return n===0&&t.ctrlKey||n===2}_move(t,n){const s=.8*(n.x-t.x);if(s)return this._active=!0,{bearingDelta:s}}contextmenu(t){t.preventDefault()}}class $e extends Go{_correctButton(t,n){return n===0&&t.ctrlKey||n===2}_move(t,n){const s=-.5*(n.y-t.y);if(s)return this._active=!0,{pitchDelta:s}}contextmenu(t){t.preventDefault()}}class Va{constructor(t,n){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new a.pointGeometry(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,s){return this._calculateTransform(t,n,s)}touchmove(t,n,s){if(this._map._cooperativeGestures&&(this._minTouches===2&&s.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,s.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(s.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,n,s)}touchend(t,n,s){this._calculateTransform(t,n,s),this._active&&s.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,s){s.length>0&&(this._active=!0);const u=Sr(s,n),p=new a.pointGeometry(0,0),f=new a.pointGeometry(0,0);let _=0;for(const v in u){const E=u[v],M=this._touches[v];M&&(p._add(E),f._add(E.sub(M)),_++,u[v]=E)}if(this._touches=u,_<this._minTouches||!f.mag())return;const y=f.div(_);return this._sum._add(y),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(_),panDelta:y}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nn{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(t){}_move(t,n,s){return{}}touchstart(t,n,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,s){if(!this._firstTwoTouches)return;t.preventDefault();const[u,p]=this._firstTwoTouches,f=Vr(s,n,u),_=Vr(s,n,p);if(!f||!_)return;const y=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],y,t)}touchend(t,n,s){if(!this._firstTwoTouches)return;const[u,p]=this._firstTwoTouches,f=Vr(s,n,u),_=Vr(s,n,p);f&&_||(this._active&&te.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 Vr(l,t,n){for(let s=0;s<l.length;s++)if(l[s].identifier===n)return t[s]}function Ps(l,t){return Math.log(l/t)/Math.LN2}class De extends nn{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const s=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Ps(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Ps(this._distance,s),pinchAround:n}}}function qo(l,t){return 180*l.angleWith(t)/Math.PI}class Zl extends nn{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){const s=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:qo(this._vector,s),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,s=qo(t,this._startVector);return Math.abs(s)<n}}function zs(l){return Math.abs(l.y)>Math.abs(l.x)}class ks extends nn{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,s){super.touchstart(t,n,s),this._currentTouchCount=s.length}_start(t){this._lastPoints=t,zs(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,s){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const u=t[0].sub(this._lastPoints[0]),p=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(u,p,s.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(u.y+p.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,s){if(this._valid!==void 0)return this._valid;const u=t.mag()>=2,p=n.mag()>=2;if(!u&&!p)return;if(!u||!p)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const f=t.y>0==n.y>0;return zs(t)&&zs(n)&&f}}const Na={panStep:100,bearingStep:15,pitchStep:10};class Ga{constructor(){const t=Na;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,s=0,u=0,p=0,f=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?s=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?s=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?u=1:(t.preventDefault(),f=-1);break;case 40:t.shiftKey?u=-1:(t.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,u=0),{cameraAnimation:_=>{const y=_.getZoom();_.easeTo({duration:300,easeId:"keyboardHandler",easing:jl,zoom:n?Math.round(y)+n*(t.shiftKey?2:1):y,bearing:_.getBearing()+s*this._bearingStep,pitch:_.getPitch()+u*this._pitchStep,offset:[-p*this._panStep,-f*this._panStep],center:_.getCenter()},{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 jl(l){return l*(2-l)}const qa=4.000244140625;class Ds{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,a.bindAll(["_onTimeout"],this)}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)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const s=a.exported.now(),u=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,n!==0&&n%qa==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":u>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(u*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()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=te.mousePos(this._el,t);this._around=a.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>qa?this._wheelZoomRate:this._defaultZoomRate;let y=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&y!==0&&(y=1/y);const v=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(v*y))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,s=this._startZoom,u=this._easing;let p,f=!1;if(this._type==="wheel"&&s&&u){const _=Math.min((a.exported.now()-this._lastWheelEventTime)/200,1),y=u(_);p=a.number(s,n,y),_<1?this._frameId||(this._frameId=!0):f=!0}else p=n,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!f,zoomDelta:p-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=a.ease;if(this._prevEase){const s=this._prevEase,u=(a.exported.now()-s.start)/s.duration,p=s.easing(u+.01)-s.easing(u),f=.27/Math.sqrt(p*p+1e-4)*.01,_=Math.sqrt(.0729-f*f);n=a.bezier(f,_,.25,1)}return this._prevEase={start:a.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class Ls{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 Rs{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:s.getZoom()+(t.shiftKey?-1:1),around:s.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Bs{constructor(){this._tap=new Ms({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,n,s){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?s.length>0&&(this._swipePoint=n[0],this._swipeTouch=s[0].identifier):this._tap.touchstart(t,n,s))}touchmove(t,n,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const u=n[0],p=u.y-this._swipePoint.y;return this._swipePoint=u,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,n,s)}touchend(t,n,s){this._tapTime?this._swipePoint&&s.length===0&&this.reset():this._tap.touchend(t,n,s)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ri{constructor(t,n,s){this._el=t,this._mousePan=n,this._touchPan=s}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Nr{constructor(t,n,s){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=s}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Za{constructor(t,n,s,u){this._el=t,this._touchZoom=n,this._touchRotate=s,this._tapDragZoom=u,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","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Rn=l=>l.zoom||l.drag||l.pitch||l.rotate;class Fs extends a.Event{}function go(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}class ja{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ua(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),a.bindAll(["handleEvent","handleWindowEvent"],this);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[u,p,f]of this._listeners)te.addEventListener(u,p,u===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[t,n,s]of this._listeners)te.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(t){const n=this._map,s=n.getCanvasContainer();this._add("mapEvent",new Nl(n,t));const u=n.boxZoom=new $a(n,t);this._add("boxZoom",u);const p=new Gl,f=new Rs;n.doubleClickZoom=new Ls(f,p),this._add("tapZoom",p),this._add("clickZoom",f);const _=new Bs;this._add("tapDragZoom",_);const y=n.touchPitch=new ks(n);this._add("touchPitch",y);const v=new Ir(t),E=new $e(t);n.dragRotate=new Nr(t,v,E),this._add("mouseRotate",v,["mousePitch"]),this._add("mousePitch",E,["mouseRotate"]);const M=new mo(t),z=new Va(t,n);n.dragPan=new Ri(s,M,z),this._add("mousePan",M),this._add("touchPan",z,["touchZoom","touchRotate"]);const V=new Zl,U=new De;n.touchZoomRotate=new Za(s,U,V,_),this._add("touchRotate",V,["touchPan","touchZoom"]),this._add("touchZoom",U,["touchPan","touchRotate"]);const $=n.scrollZoom=new Ds(n,this);this._add("scrollZoom",$,["mousePan"]);const H=n.keyboard=new Ga;this._add("keyboard",H),this._add("blockableMapEvent",new $r(n));for(const Q of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[Q]&&n[Q].enable(t[Q])}_add(t,n,s){this._handlers.push({handlerName:t,handler:n,allowed:s}),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 Boolean(Rn(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,n,s){for(const u in t)if(u!==s&&(!n||n.indexOf(u)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const s of t)this._el.contains(s.target)&&n.push(s);return n}handleEvent(t,n){if(t.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const s=t.type==="renderFrame"?void 0:t,u={needsRenderFrame:!1},p={},f={},_=t.touches,y=_?this._getMapTouches(_):void 0,v=y?te.touchPos(this._el,y):te.mousePos(this._el,t);for(const{handlerName:z,handler:V,allowed:U}of this._handlers){if(!V.isEnabled())continue;let $;this._blockedByActive(f,U,z)?V.reset():V[n||t.type]&&($=V[n||t.type](t,v,y),this.mergeHandlerResult(u,p,$,z,s),$&&$.needsRenderFrame&&this._triggerRenderFrame()),($||V.isActive())&&(f[z]=V)}const E={};for(const z in this._previousActiveHandlers)f[z]||(E[z]=s);this._previousActiveHandlers=f,(Object.keys(E).length||go(u))&&(this._changes.push([u,p,E]),this._triggerRenderFrame()),(Object.keys(f).length||go(u))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:M}=u;M&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],M(this._map))}mergeHandlerResult(t,n,s,u,p){if(!s)return;a.extend(t,s);const f={handlerName:u,originalEvent:s.originalEvent||p};s.zoomDelta!==void 0&&(n.zoom=f),s.panDelta!==void 0&&(n.drag=f),s.pitchDelta!==void 0&&(n.pitch=f),s.bearingDelta!==void 0&&(n.rotate=f)}_applyChanges(){const t={},n={},s={};for(const[u,p,f]of this._changes)u.panDelta&&(t.panDelta=(t.panDelta||new a.pointGeometry(0,0))._add(u.panDelta)),u.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+u.zoomDelta),u.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+u.bearingDelta),u.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+u.pitchDelta),u.around!==void 0&&(t.around=u.around),u.pinchAround!==void 0&&(t.pinchAround=u.pinchAround),u.noInertia&&(t.noInertia=u.noInertia),a.extend(n,p),a.extend(s,f);this._updateMapTransform(t,n,s),this._changes=[]}_updateMapTransform(t,n,s){const u=this._map,p=u.transform,f=u.style&&u.style.terrain;if(!(go(t)||f&&this._drag))return this._fireEvents(n,s,!0);let{panDelta:_,zoomDelta:y,bearingDelta:v,pitchDelta:E,around:M,pinchAround:z}=t;z!==void 0&&(M=z),u._stop(!0),M=M||u.transform.centerPoint;const V=p.pointLocation(_?M.sub(_):M);v&&(p.bearing+=v),E&&(p.pitch+=E),y&&(p.zoom+=y),f?n.drag&&!this._drag?(this._drag={center:p.centerPoint,lngLat:p.pointLocation(M),point:M,handlerName:n.drag.handlerName},u.fire(new a.Event("freezeElevation",{freeze:!0}))):this._drag&&s[this._drag.handlerName]?(u.fire(new a.Event("freezeElevation",{freeze:!1})),this._drag=null):n.drag&&this._drag&&(p.center=p.pointLocation(p.centerPoint.sub(_))):p.setLocationAtPoint(V,M),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,s,!0)}_fireEvents(t,n,s){const u=Rn(this._eventsInProgress),p=Rn(t),f={};for(const E in t){const{originalEvent:M}=t[E];this._eventsInProgress[E]||(f[`${E}start`]=M),this._eventsInProgress[E]=t[E]}!u&&p&&this._fireEvent("movestart",p.originalEvent);for(const E in f)this._fireEvent(E,f[E]);p&&this._fireEvent("move",p.originalEvent);for(const E in t){const{originalEvent:M}=t[E];this._fireEvent(E,M)}const _={};let y;for(const E in this._eventsInProgress){const{handlerName:M,originalEvent:z}=this._eventsInProgress[E];this._handlersById[M].isActive()||(delete this._eventsInProgress[E],y=n[M]||z,_[`${E}end`]=y)}for(const E in _)this._fireEvent(E,_[E]);const v=Rn(this._eventsInProgress);if(s&&(u||p)&&!v){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),M=z=>z!==0&&-this._bearingSnap<z&&z<this._bearingSnap;E?(M(E.bearing||this._map.getBearing())&&(E.bearing=0),this._map.easeTo(E,{originalEvent:y})):(this._map.fire(new a.Event("moveend",{originalEvent:y})),M(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new a.Event(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Fs("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Yi={extend:(l,...t)=>a.extend(l,...t),run(l){l()},logToElement(l,t=!1,n="log"){const s=window.document.getElementById(n);s&&(t&&(s.innerHTML=""),s.innerHTML+=`<br>${l}`)}};class Gt extends a.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,a.bindAll(["_renderFrameCallback"],this)}getCenter(){return new a.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,s){return t=a.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,a.extend({offset:t},n),s)}panTo(t,n,s){return this.easeTo(a.extend({center:t},n),s)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,s){return this.easeTo(a.extend({zoom:t},n),s)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}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,s){return this.easeTo(a.extend({bearing:t},n),s)}resetNorth(t,n){return this.rotateTo(0,a.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(a.extend({bearing:0,pitch: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}cameraForBounds(t,n){t=a.LngLatBounds.convert(t);const s=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),s,n)}_cameraForBoxAndBearing(t,n,s,u){const p={top:0,bottom:0,right:0,left:0};if(typeof(u=a.extend({padding:p,offset:[0,0],maxZoom:this.transform.maxZoom},u)).padding=="number"){const se=u.padding;u.padding={top:se,bottom:se,right:se,left:se}}u.padding=a.extend(p,u.padding);const f=this.transform,_=f.padding,y=f.project(a.LngLat.convert(t)),v=f.project(a.LngLat.convert(n)),E=y.rotate(-s*Math.PI/180),M=v.rotate(-s*Math.PI/180),z=new a.pointGeometry(Math.max(E.x,M.x),Math.max(E.y,M.y)),V=new a.pointGeometry(Math.min(E.x,M.x),Math.min(E.y,M.y)),U=z.sub(V),$=(f.width-(_.left+_.right+u.padding.left+u.padding.right))/U.x,H=(f.height-(_.top+_.bottom+u.padding.top+u.padding.bottom))/U.y;if(H<0||$<0)return void a.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const Q=Math.min(f.scaleZoom(f.scale*Math.min($,H)),u.maxZoom),oe=a.pointGeometry.convert(u.offset),N=new a.pointGeometry((u.padding.left-u.padding.right)/2,(u.padding.top-u.padding.bottom)/2).rotate(s*Math.PI/180),le=oe.add(N).mult(f.scale/f.zoomScale(Q));return{center:f.unproject(y.add(v).div(2).sub(le)),zoom:Q,bearing:s}}fitBounds(t,n,s){return this._fitInternal(this.cameraForBounds(t,n),n,s)}fitScreenCoordinates(t,n,s,u,p){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(a.pointGeometry.convert(t)),this.transform.pointLocation(a.pointGeometry.convert(n)),s,u),u,p)}_fitInternal(t,n,s){return t?(delete(n=a.extend(t,n)).padding,n.linear?this.easeTo(n,s):this.flyTo(n,s)):this}jumpTo(t,n){this.stop();const s=this.transform;let u=!1,p=!1,f=!1;return"zoom"in t&&s.zoom!==+t.zoom&&(u=!0,s.zoom=+t.zoom),t.center!==void 0&&(s.center=a.LngLat.convert(t.center)),"bearing"in t&&s.bearing!==+t.bearing&&(p=!0,s.bearing=+t.bearing),"pitch"in t&&s.pitch!==+t.pitch&&(f=!0,s.pitch=+t.pitch),t.padding==null||s.isPaddingEqual(t.padding)||(s.padding=t.padding),this.fire(new a.Event("movestart",n)).fire(new a.Event("move",n)),u&&this.fire(new a.Event("zoomstart",n)).fire(new a.Event("zoom",n)).fire(new a.Event("zoomend",n)),p&&this.fire(new a.Event("rotatestart",n)).fire(new a.Event("rotate",n)).fire(new a.Event("rotateend",n)),f&&this.fire(new a.Event("pitchstart",n)).fire(new a.Event("pitch",n)).fire(new a.Event("pitchend",n)),this.fire(new a.Event("moveend",n))}calculateCameraOptionsFromTo(t,n,s,u=0){const p=a.MercatorCoordinate.fromLngLat(t,n),f=a.MercatorCoordinate.fromLngLat(s,u),_=f.x-p.x,y=f.y-p.y,v=f.z-p.z,E=Math.hypot(_,y,v);if(E===0)throw new Error("Can't calculate camera options with same From and To");const M=Math.hypot(_,y),z=this.transform.scaleZoom(this.transform.cameraToCenterDistance/E/this.transform.tileSize),V=180*Math.atan2(_,-y)/Math.PI;let U=180*Math.acos(M/E)/Math.PI;return U=v<0?90-U:90+U,{center:f.toLngLat(),zoom:z,pitch:U,bearing:V}}easeTo(t,n){this._stop(!1,t.easeId),((t=a.extend({offset:[0,0],duration:500,easing:a.ease},t)).animate===!1||!t.essential&&a.exported.prefersReducedMotion)&&(t.duration=0);const s=this.transform,u=this.getZoom(),p=this.getBearing(),f=this.getPitch(),_=this.getPadding(),y="zoom"in t?+t.zoom:u,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,E="pitch"in t?+t.pitch:f,M="padding"in t?t.padding:s.padding,z=a.pointGeometry.convert(t.offset);let V=s.centerPoint.add(z);const U=s.pointLocation(V),$=a.LngLat.convert(t.center||U);this._normalizeCenter($);const H=s.project(U),Q=s.project($).sub(H),oe=s.zoomScale(y-u);let N,le;t.around&&(N=a.LngLat.convert(t.around),le=s.locationPoint(N));const se={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||y!==u,this._rotating=this._rotating||p!==v,this._pitching=this._pitching||E!==f,this._padding=!s.isPaddingEqual(M),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,se),this._ease(me=>{if(this._zooming&&(s.zoom=a.number(u,y,me)),this._rotating&&(s.bearing=a.number(p,v,me)),this._pitching&&(s.pitch=a.number(f,E,me)),this._padding&&(s.interpolatePadding(_,M,me),V=s.centerPoint.add(z)),N)s.setLocationAtPoint(N,le);else{const ge=s.zoomScale(s.zoom-u),we=y>u?Math.min(2,oe):Math.max(.5,oe),fe=Math.pow(we,1-me),Fe=s.unproject(H.add(Q.mult(me*fe)).mult(ge));s.setLocationAtPoint(s.renderWorldCopies?Fe.wrap():Fe,V)}this._fireMoveEvents(n)},me=>{this._afterEase(n,me)},t),this}_prepareEase(t,n,s={}){this._moving=!0,this.fire(new a.Event("freezeElevation",{freeze:!0})),n||s.moving||this.fire(new a.Event("movestart",t)),this._zooming&&!s.zooming&&this.fire(new a.Event("zoomstart",t)),this._rotating&&!s.rotating&&this.fire(new a.Event("rotatestart",t)),this._pitching&&!s.pitching&&this.fire(new a.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new a.Event("move",t)),this._zooming&&this.fire(new a.Event("zoom",t)),this._rotating&&this.fire(new a.Event("rotate",t)),this._pitching&&this.fire(new a.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId,this.fire(new a.Event("freezeElevation",{freeze:!1}));const s=this._zooming,u=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,s&&this.fire(new a.Event("zoomend",t)),u&&this.fire(new a.Event("rotateend",t)),p&&this.fire(new a.Event("pitchend",t)),this.fire(new a.Event("moveend",t))}flyTo(t,n){if(!t.essential&&a.exported.prefersReducedMotion){const Xe=a.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Xe,n)}this.stop(),t=a.extend({offset:[0,0],speed:1.2,curve:1.42,easing:a.ease},t);const s=this.transform,u=this.getZoom(),p=this.getBearing(),f=this.getPitch(),_=this.getPadding(),y="zoom"in t?a.clamp(+t.zoom,s.minZoom,s.maxZoom):u,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,E="pitch"in t?+t.pitch:f,M="padding"in t?t.padding:s.padding,z=s.zoomScale(y-u),V=a.pointGeometry.convert(t.offset);let U=s.centerPoint.add(V);const $=s.pointLocation(U),H=a.LngLat.convert(t.center||$);this._normalizeCenter(H);const Q=s.project($),oe=s.project(H).sub(Q);let N=t.curve;const le=Math.max(s.width,s.height),se=le/z,me=oe.mag();if("minZoom"in t){const Xe=a.clamp(Math.min(t.minZoom,u,y),s.minZoom,s.maxZoom),Pt=le/s.zoomScale(Xe-u);N=Math.sqrt(Pt/me*2)}const ge=N*N;function we(Xe){const Pt=(se*se-le*le+(Xe?-1:1)*ge*ge*me*me)/(2*(Xe?se:le)*ge*me);return Math.log(Math.sqrt(Pt*Pt+1)-Pt)}function fe(Xe){return(Math.exp(Xe)-Math.exp(-Xe))/2}function Fe(Xe){return(Math.exp(Xe)+Math.exp(-Xe))/2}const Ae=we(0);let Oe=function(Xe){return Fe(Ae)/Fe(Ae+N*Xe)},ot=function(Xe){return le*((Fe(Ae)*(fe(Pt=Ae+N*Xe)/Fe(Pt))-fe(Ae))/ge)/me;var Pt},ct=(we(1)-Ae)/N;if(Math.abs(me)<1e-6||!isFinite(ct)){if(Math.abs(le-se)<1e-6)return this.easeTo(t,n);const Xe=se<le?-1:1;ct=Math.abs(Math.log(se/le))/N,ot=function(){return 0},Oe=function(Pt){return Math.exp(Xe*N*Pt)}}return t.duration="duration"in t?+t.duration:1e3*ct/("screenSpeed"in t?+t.screenSpeed/N:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=p!==v,this._pitching=E!==f,this._padding=!s.isPaddingEqual(M),this._prepareEase(n,!1),this._ease(Xe=>{const Pt=Xe*ct,zt=1/Oe(Pt);s.zoom=Xe===1?y:u+s.scaleZoom(zt),this._rotating&&(s.bearing=a.number(p,v,Xe)),this._pitching&&(s.pitch=a.number(f,E,Xe)),this._padding&&(s.interpolatePadding(_,M,Xe),U=s.centerPoint.add(V));const yt=Xe===1?H:s.unproject(Q.add(oe.mult(ot(Pt))).mult(zt));s.setLocationAtPoint(s.renderWorldCopies?yt.wrap():yt,U),this._fireMoveEvents(n)},()=>this._afterEase(n),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const s=this._onEaseEnd;delete this._onEaseEnd,s.call(this,n)}if(!t){const s=this.handlers;s&&s.stop(!1)}return this}_ease(t,n,s){s.animate===!1||s.duration===0?(t(1),n()):(this._easeStart=a.exported.now(),this._easeOptions=s,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((a.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=a.wrap(t,-180,180);const s=Math.abs(t-n);return Math.abs(t-360-n)<s&&(t-=360),Math.abs(t+360-n)<s&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(!n.renderWorldCopies||n.lngRange)return;const s=t.lng-n.center.lng;t.lng+=s>180?-360:s<-180?360:0}}class _o{constructor(t={}){this.options=t,a.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=te.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=te.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=te.create("div","maplibregl-ctrl-attrib-inner mapboxgl-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(){te.remove(this._container),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 s=this._map._getUIString(`AttributionControl.${n}`);t.title=s,t.setAttribute("aria-label",s)}_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","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"&&t.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(u=>typeof u!="string"?"":u)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const u=this._map.style.stylesheet;this.styleOwner=u.owner,this.styleId=u.id}const n=this._map.style.sourceCaches;for(const u in n){const p=n[u];if(p.used||p.usedForTerrain){const f=p.getSource();f.attribution&&t.indexOf(f.attribution)<0&&t.push(f.attribution)}}t=t.filter(u=>String(u).trim()),t.sort((u,p)=>u.length-p.length),t=t.filter((u,p)=>{for(let f=p+1;f<t.length;f++)if(t[f].indexOf(u)>=0)return!1;return!0});const s=t.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,t.length?(this._innerContainer.innerHTML=s,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_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","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class Zo{constructor(t={}){this.options=t,a.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=te.create("div","maplibregl-ctrl mapboxgl-ctrl");const n=te.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){te.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&n.classList.add("maplibregl-compact","mapboxgl-compact"):n.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class Xa{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,s=n?this._queue.concat(n):this._queue;for(const u of s)if(u.id===t)return void(u.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 s of n)if(!s.cancelled&&(s.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Wa={"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":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"},Ha={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},Xl={showCompass:!0,showZoom:!0,visualizePitch:!1};class dr{constructor(t,n,s=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new Ir({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,s&&(this.mousePitch=new $e({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),a.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),te.addEventListener(n,"mousedown",this.mousedown),te.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),te.addEventListener(n,"touchmove",this.touchmove),te.addEventListener(n,"touchend",this.touchend),te.addEventListener(n,"touchcancel",this.reset)}down(t,n){this.mouseRotate.mousedown(t,n),this.mousePitch&&this.mousePitch.mousedown(t,n),te.disableDrag()}move(t,n){const s=this.map,u=this.mouseRotate.mousemoveWindow(t,n);if(u&&u.bearingDelta&&s.setBearing(s.getBearing()+u.bearingDelta),this.mousePitch){const p=this.mousePitch.mousemoveWindow(t,n);p&&p.pitchDelta&&s.setPitch(s.getPitch()+p.pitchDelta)}}off(){const t=this.element;te.removeEventListener(t,"mousedown",this.mousedown),te.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),te.removeEventListener(t,"touchmove",this.touchmove),te.removeEventListener(t,"touchend",this.touchend),te.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){te.enableDrag(),te.removeEventListener(window,"mousemove",this.mousemove),te.removeEventListener(window,"mouseup",this.mouseup)}mousedown(t){this.down(a.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),te.mousePos(this.element,t)),te.addEventListener(window,"mousemove",this.mousemove),te.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.move(t,te.mousePos(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=te.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=te.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function yo(l,t,n){if(l=new a.LngLat(l.lng,l.lat),t){const s=new a.LngLat(l.lng-360,l.lat),u=new a.LngLat(l.lng+360,l.lat),p=n.locationPoint(l).distSqr(t);n.locationPoint(s).distSqr(t)<p?l=s:n.locationPoint(u).distSqr(t)<p&&(l=u)}for(;Math.abs(l.lng-n.center.lng)>180;){const s=n.locationPoint(l);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;l.lng>n.center.lng?l.lng-=360:l.lng+=360}return l}const qe={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 Je(l,t,n){const s=l.classList;for(const u in qe)s.remove(`maplibregl-${n}-anchor-${u}`,`mapboxgl-${n}-anchor-${u}`);s.add(`maplibregl-${n}-anchor-${t}`,`mapboxgl-${n}-anchor-${t}`)}class Bn extends a.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=a.extend({element:t},n)),a.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=a.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=te.create("div"),this._element.setAttribute("aria-label","Map marker");const s=te.createNS("http://www.w3.org/2000/svg","svg"),u=41,p=27;s.setAttributeNS(null,"display","block"),s.setAttributeNS(null,"height",`${u}px`),s.setAttributeNS(null,"width",`${p}px`),s.setAttributeNS(null,"viewBox",`0 0 ${p} ${u}`);const f=te.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 _=te.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"fill-rule","nonzero");const y=te.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.setAttributeNS(null,"fill","#000000");const v=[{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 oe of v){const N=te.createNS("http://www.w3.org/2000/svg","ellipse");N.setAttributeNS(null,"opacity","0.04"),N.setAttributeNS(null,"cx","10.5"),N.setAttributeNS(null,"cy","5.80029008"),N.setAttributeNS(null,"rx",oe.rx),N.setAttributeNS(null,"ry",oe.ry),y.appendChild(N)}const E=te.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"fill",this._color);const M=te.createNS("http://www.w3.org/2000/svg","path");M.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"),E.appendChild(M);const z=te.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"opacity","0.25"),z.setAttributeNS(null,"fill","#000000");const V=te.createNS("http://www.w3.org/2000/svg","path");V.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"),z.appendChild(V);const U=te.createNS("http://www.w3.org/2000/svg","g");U.setAttributeNS(null,"transform","translate(6.0, 7.0)"),U.setAttributeNS(null,"fill","#FFFFFF");const $=te.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=te.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const Q=te.createNS("http://www.w3.org/2000/svg","circle");Q.setAttributeNS(null,"fill","#FFFFFF"),Q.setAttributeNS(null,"cx","5.5"),Q.setAttributeNS(null,"cy","5.5"),Q.setAttributeNS(null,"r","5.4999962"),$.appendChild(H),$.appendChild(Q),_.appendChild(y),_.appendChild(E),_.appendChild(z),_.appendChild(U),_.appendChild($),s.appendChild(_),s.setAttributeNS(null,"height",u*this._scale+"px"),s.setAttributeNS(null,"width",p*this._scale+"px"),this._element.appendChild(s),this._offset=a.pointGeometry.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",s=>{s.preventDefault()}),this._element.addEventListener("mousedown",s=>{s.preventDefault()}),Je(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),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("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),te.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=a.LngLat.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 u=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[u,-1*(38.1-13.5+u)],"bottom-right":[-u,-1*(38.1-13.5+u)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const n=t.code,s=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&s!==32&&s!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,s=this._element;this._popup&&(n===s||s.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=yo(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let s="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?s="rotateX(0deg)":this._pitchAlignment==="map"&&(s=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!=="moveend"||(this._pos=this._pos.round()),te.setTransform(this._element,`${qe[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${s} ${n}`),this._map.style&&this._map.style.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const u=this._map.unproject(this._pos),p=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=u.distanceTo(this._lngLat)>20*p?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(t){return this._offset=a.pointGeometry.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=t.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 a.Event("dragstart"))),this.fire(new a.Event("drag")))}_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 a.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.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))}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}}const Os={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Gr,_i=0,qr=!1;const fr={maxWidth:100,unit:"metric"};function Ka(l,t,n){const s=n&&n.maxWidth||100,u=l._container.clientHeight/2,p=l.unproject([0,u]),f=l.unproject([s,u]),_=p.distanceTo(f);if(n&&n.unit==="imperial"){const y=3.2808*_;y>5280?Zr(t,s,y/5280,l._getUIString("ScaleControl.Miles")):Zr(t,s,y,l._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Zr(t,s,_/1852,l._getUIString("ScaleControl.NauticalMiles")):_>=1e3?Zr(t,s,_/1e3,l._getUIString("ScaleControl.Kilometers")):Zr(t,s,_,l._getUIString("ScaleControl.Meters"))}function Zr(l,t,n,s){const u=function(p){const f=Math.pow(10,`${Math.floor(p)}`.length-1);let _=p/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(y){const v=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*v)/v}(_),f*_}(n);l.style.width=t*(u/n)+"px",l.innerHTML=`${u}&nbsp;${s}`}const Jt={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},ii=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Us(l){if(l){if(typeof l=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(l,2)));return{center:new a.pointGeometry(0,0),top:new a.pointGeometry(0,l),"top-left":new a.pointGeometry(t,t),"top-right":new a.pointGeometry(-t,t),bottom:new a.pointGeometry(0,-l),"bottom-left":new a.pointGeometry(t,-t),"bottom-right":new a.pointGeometry(-t,-t),left:new a.pointGeometry(l,0),right:new a.pointGeometry(-l,0)}}if(l instanceof a.pointGeometry||Array.isArray(l)){const t=a.pointGeometry.convert(l);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:a.pointGeometry.convert(l.center||[0,0]),top:a.pointGeometry.convert(l.top||[0,0]),"top-left":a.pointGeometry.convert(l["top-left"]||[0,0]),"top-right":a.pointGeometry.convert(l["top-right"]||[0,0]),bottom:a.pointGeometry.convert(l.bottom||[0,0]),"bottom-left":a.pointGeometry.convert(l["bottom-left"]||[0,0]),"bottom-right":a.pointGeometry.convert(l["bottom-right"]||[0,0]),left:a.pointGeometry.convert(l.left||[0,0]),right:a.pointGeometry.convert(l.right||[0,0])}}return Us(new a.pointGeometry(0,0))}const on={supported:Y,setRTLTextPlugin:a.setRTLTextPlugin,getRTLTextPluginStatus:a.getRTLTextPluginStatus,Map:class extends Gt{constructor(l){var t;if(a.PerformanceUtils.mark(a.PerformanceMarkers.create),(l=a.extend({},Ha,l)).minZoom!=null&&l.maxZoom!=null&&l.minZoom>l.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(l.minPitch!=null&&l.maxPitch!=null&&l.minPitch>l.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(l.minPitch!=null&&l.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(l.maxPitch!=null&&l.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new lo(l.minZoom,l.maxZoom,l.minPitch,l.maxPitch,l.renderWorldCopies),{bearingSnap:l.bearingSnap}),this._interactive=l.interactive,this._cooperativeGestures=l.cooperativeGestures,this._maxTileCacheSize=l.maxTileCacheSize,this._failIfMajorPerformanceCaveat=l.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=l.preserveDrawingBuffer,this._antialias=l.antialias,this._trackResize=l.trackResize,this._bearingSnap=l.bearingSnap,this._refreshExpiredTiles=l.refreshExpiredTiles,this._fadeDuration=l.fadeDuration,this._crossSourceCollisions=l.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=l.collectResourceTiming,this._renderTaskQueue=new Xa,this._controls=[],this._mapId=a.uniqueId(),this._locale=a.extend({},Wa,l.locale),this._clickTolerance=l.clickTolerance,this._pixelRatio=(t=l.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this._requestManager=new ke(l.transformRequest),typeof l.container=="string"){if(this._container=document.getElementById(l.container),!this._container)throw new Error(`Container '${l.container}' not found.`)}else{if(!(l.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=l.container}if(l.maxBounds&&this.setMaxBounds(l.maxBounds),a.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),typeof window!="undefined"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new ja(this,l),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=l.hash&&new Ra(typeof l.hash=="string"&&l.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch}),l.bounds&&(this.resize(),this.fitBounds(l.bounds,a.extend({},l.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=l.localIdeographFontFamily,l.style&&this.setStyle(l.style,{localIdeographFontFamily:l.localIdeographFontFamily}),l.attributionControl&&this.addControl(new _o({customAttribution:l.customAttribution})),l.maplibreLogo&&this.addControl(new Zo,l.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new a.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new a.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new a.Event("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(l,t){if(t===void 0&&(t=l.getDefaultPosition?l.getDefaultPosition():"top-right"),!l||!l.onAdd)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=l.onAdd(this);this._controls.push(l);const s=this._controlPositions[t];return t.indexOf("bottom")!==-1?s.insertBefore(n,s.firstChild):s.appendChild(n),this}removeControl(l){if(!l||!l.onRemove)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(l);return t>-1&&this._controls.splice(t,1),l.onRemove(this),this}hasControl(l){return this._controls.indexOf(l)>-1}calculateCameraOptionsFromTo(l,t,n,s){return s==null&&this.style.terrain&&(s=this.transform.getElevation(n,this.style.terrain)),super.calculateCameraOptionsFromTo(l,t,n,s)}resize(l){const t=this._containerDimensions(),n=t[0],s=t[1];this._resizeCanvas(n,s,this.getPixelRatio()),this.transform.resize(n,s),this.painter.resize(n,s,this.getPixelRatio());const u=!this._moving;return u&&(this.stop(),this.fire(new a.Event("movestart",l)).fire(new a.Event("move",l))),this.fire(new a.Event("resize",l)),u&&this.fire(new a.Event("moveend",l)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(l){const[t,n]=this._containerDimensions();this._pixelRatio=l,this._resizeCanvas(t,n,l),this.painter.resize(t,n,l)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(l){return this.transform.setMaxBounds(a.LngLatBounds.convert(l)),this._update()}setMinZoom(l){if((l=l==null?-2:l)>=-2&&l<=this.transform.maxZoom)return this.transform.minZoom=l,this._update(),this.getZoom()<l&&this.setZoom(l),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(l){if((l=l==null?22:l)>=this.transform.minZoom)return this.transform.maxZoom=l,this._update(),this.getZoom()>l&&this.setZoom(l),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(l){if((l=l==null?0:l)<0)throw new Error("minPitch must be greater than or equal to 0");if(l>=0&&l<=this.transform.maxPitch)return this.transform.minPitch=l,this._update(),this.getPitch()<l&&this.setPitch(l),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(l){if((l=l==null?60:l)>85)throw new Error("maxPitch must be less than or equal to 85");if(l>=this.transform.minPitch)return this.transform.maxPitch=l,this._update(),this.getPitch()>l&&this.setPitch(l),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(l){return this.transform.renderWorldCopies=l,this._update()}project(l){return this.transform.locationPoint(a.LngLat.convert(l),this.style&&this.style.terrain)}unproject(l){return this.transform.pointLocation(a.pointGeometry.convert(l),this.style&&this.style.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(l,t,n){if(l==="mouseenter"||l==="mouseover"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:p=>{const f=this.getLayer(t)?this.queryRenderedFeatures(p.point,{layers:[t]}):[];f.length?s||(s=!0,n.call(this,new qi(l,this,p.originalEvent,{features:f}))):s=!1},mouseout:()=>{s=!1}}}}if(l==="mouseleave"||l==="mouseout"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:f=>{(this.getLayer(t)?this.queryRenderedFeatures(f.point,{layers:[t]}):[]).length?s=!0:s&&(s=!1,n.call(this,new qi(l,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,n.call(this,new qi(l,this,f.originalEvent)))}}}}{const s=u=>{const p=this.getLayer(t)?this.queryRenderedFeatures(u.point,{layers:[t]}):[];p.length&&(u.features=p,n.call(this,u),delete u.features)};return{layer:t,listener:n,delegates:{[l]:s}}}}on(l,t,n){if(n===void 0)return super.on(l,t);const s=this._createDelegatedListener(l,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[l]=this._delegatedListeners[l]||[],this._delegatedListeners[l].push(s);for(const u in s.delegates)this.on(u,s.delegates[u]);return this}once(l,t,n){if(n===void 0)return super.once(l,t);const s=this._createDelegatedListener(l,t,n);for(const u in s.delegates)this.once(u,s.delegates[u]);return this}off(l,t,n){return n===void 0?super.off(l,t):(this._delegatedListeners&&this._delegatedListeners[l]&&(s=>{const u=this._delegatedListeners[l];for(let p=0;p<u.length;p++){const f=u[p];if(f.layer===t&&f.listener===n){for(const _ in f.delegates)this.off(_,f.delegates[_]);return u.splice(p,1),this}}})(),this)}queryRenderedFeatures(l,t){if(!this.style)return[];let n;if(t!==void 0||l===void 0||l instanceof a.pointGeometry||Array.isArray(l)||(t=l,l=void 0),t=t||{},(l=l||[[0,0],[this.transform.width,this.transform.height]])instanceof a.pointGeometry||typeof l[0]=="number")n=[a.pointGeometry.convert(l)];else{const s=a.pointGeometry.convert(l[0]),u=a.pointGeometry.convert(l[1]);n=[s,new a.pointGeometry(u.x,s.y),u,new a.pointGeometry(s.x,u.y),s]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(l,t){return this.style.querySourceFeatures(l,t)}setStyle(l,t){return(t=a.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&l?(this._diffStyle(l,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(l,t))}setTransformRequest(l){return this._requestManager.setTransformRequest(l),this}_getUIString(l){const t=this._locale[l];if(t==null)throw new Error(`Missing UI string '${l}'`);return t}_updateStyle(l,t){return this.style&&(this.style.setEventedParent(null),this.style._remove()),l?(this.style=new bi(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof l=="string"?this.style.loadURL(l):this.style.loadJSON(l),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new bi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(l,t){if(typeof l=="string"){const n=this._requestManager.transformRequest(l,a.ResourceType.Style);a.getJSON(n,(s,u)=>{s?this.fire(new a.ErrorEvent(s)):u&&this._updateDiff(u,t)})}else typeof l=="object"&&this._updateDiff(l,t)}_updateDiff(l,t){try{this.style.setState(l)&&this._update(!0)}catch(n){a.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(l,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():a.warnOnce("There is no style added to the map.")}addSource(l,t){return this._lazyInitEmptyStyle(),this.style.addSource(l,t),this._update(!0)}isSourceLoaded(l){const t=this.style&&this.style.sourceCaches[l];if(t!==void 0)return t.loaded();this.fire(new a.ErrorEvent(new Error(`There is no source with ID '${l}'`)))}setTerrain(l){return this.style.setTerrain(l),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){const l=this.style&&this.style.sourceCaches;for(const t in l){const n=l[t]._tiles;for(const s in n){const u=n[s];if(u.state!=="loaded"&&u.state!=="errored")return!1}}return!0}addSourceType(l,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(l,t,n)}removeSource(l){return this.style.removeSource(l),this._update(!0)}getSource(l){return this.style.getSource(l)}addImage(l,t,{pixelRatio:n=1,sdf:s=!1,stretchX:u,stretchY:p,content:f}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||a.isImageBitmap(t)){const{width:_,height:y,data:v}=a.exported.getImageData(t);this.style.addImage(l,{data:new a.RGBAImage({width:_,height:y},v),pixelRatio:n,stretchX:u,stretchY:p,content:f,sdf:s,version:0})}else{if(t.width===void 0||t.height===void 0)return this.fire(new a.ErrorEvent(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:_,height:y,data:v}=t,E=t;this.style.addImage(l,{data:new a.RGBAImage({width:_,height:y},new Uint8Array(v)),pixelRatio:n,stretchX:u,stretchY:p,content:f,sdf:s,version:0,userImage:E}),E.onAdd&&E.onAdd(this,l)}}}updateImage(l,t){const n=this.style.getImage(l);if(!n)return this.fire(new a.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=t instanceof HTMLImageElement||a.isImageBitmap(t)?a.exported.getImageData(t):t,{width:u,height:p,data:f}=s;if(u===void 0||p===void 0)return this.fire(new a.ErrorEvent(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(u!==n.data.width||p!==n.data.height)return this.fire(new a.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(t instanceof HTMLImageElement||a.isImageBitmap(t));n.data.replace(f,_),this.style.updateImage(l,n)}hasImage(l){return l?!!this.style.getImage(l):(this.fire(new a.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(l){this.style.removeImage(l)}loadImage(l,t){a.getImage(this._requestManager.transformRequest(l,a.ResourceType.Image),t)}listImages(){return this.style.listImages()}addLayer(l,t){return this._lazyInitEmptyStyle(),this.style.addLayer(l,t),this._update(!0)}moveLayer(l,t){return this.style.moveLayer(l,t),this._update(!0)}removeLayer(l){return this.style.removeLayer(l),this._update(!0)}getLayer(l){return this.style.getLayer(l)}setLayerZoomRange(l,t,n){return this.style.setLayerZoomRange(l,t,n),this._update(!0)}setFilter(l,t,n={}){return this.style.setFilter(l,t,n),this._update(!0)}getFilter(l){return this.style.getFilter(l)}setPaintProperty(l,t,n,s={}){return this.style.setPaintProperty(l,t,n,s),this._update(!0)}getPaintProperty(l,t){return this.style.getPaintProperty(l,t)}setLayoutProperty(l,t,n,s={}){return this.style.setLayoutProperty(l,t,n,s),this._update(!0)}getLayoutProperty(l,t){return this.style.getLayoutProperty(l,t)}setLight(l,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(l,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(l,t){return this.style.setFeatureState(l,t),this._update()}removeFeatureState(l,t){return this.style.removeFeatureState(l,t),this._update()}getFeatureState(l){return this.style.getFeatureState(l)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let l=0,t=0;return this._container&&(l=this._container.clientWidth||400,t=this._container.clientHeight||300),[l,t]}_setupContainer(){const l=this._container;l.classList.add("maplibregl-map","mapboxgl-map");const t=this._canvasContainer=te.create("div","maplibregl-canvas-container mapboxgl-canvas-container",l);this._interactive&&t.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=te.create("canvas","maplibregl-canvas mapboxgl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions();this._resizeCanvas(n[0],n[1],this.getPixelRatio());const s=this._controlContainer=te.create("div","maplibregl-control-container mapboxgl-control-container",l),u=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(p=>{u[p]=te.create("div",`maplibregl-ctrl-${p} mapboxgl-ctrl-${p}`,s)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const l=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=te.create("div","maplibregl-cooperative-gesture-screen",l);let t="Control",n=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(n=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map",t="Meta"),this._cooperativeGesturesScreen.innerHTML=`
574
+ `}),staticAttributes:s,staticUniforms:f}}class as{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,s,u,p,f,_,y,v){this.context=t;let E=this.boundPaintVertexBuffers.length!==u.length;for(let M=0;!E&&M<u.length;M++)this.boundPaintVertexBuffers[M]!==u[M]&&(E=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===n&&this.boundLayoutVertexBuffer===s&&!E&&this.boundIndexBuffer===p&&this.boundVertexOffset===f&&this.boundDynamicVertexBuffer===_&&this.boundDynamicVertexBuffer2===y&&this.boundDynamicVertexBuffer3===v?(t.bindVertexArrayOES.set(this.vao),_&&_.bind(),p&&p.dynamicDraw&&p.bind(),y&&y.bind(),v&&v.bind()):this.freshBind(n,s,u,p,f,_,y,v)}freshBind(t,n,s,u,p,f,_,y){let v;const E=t.numAttributes,M=this.context,z=M.gl;if(M.extVertexArrayObject)this.vao&&this.destroy(),this.vao=M.extVertexArrayObject.createVertexArrayOES(),M.bindVertexArrayOES.set(this.vao),v=0,this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=s,this.boundIndexBuffer=u,this.boundVertexOffset=p,this.boundDynamicVertexBuffer=f,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=y;else{v=M.currentNumAttributes||0;for(let V=E;V<v;V++)z.disableVertexAttribArray(V)}n.enableAttributes(z,t);for(const V of s)V.enableAttributes(z,t);f&&f.enableAttributes(z,t),_&&_.enableAttributes(z,t),y&&y.enableAttributes(z,t),n.bind(),n.setVertexAttribPointers(z,t,p);for(const V of s)V.bind(),V.setVertexAttribPointers(z,t,p);f&&(f.bind(),f.setVertexAttribPointers(z,t,p)),u&&u.bind(),_&&(_.bind(),_.setVertexAttribPointers(z,t,p)),y&&(y.bind(),y.setVertexAttribPointers(z,t,p)),M.currentNumAttributes=E}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function ls(l){const t=[];for(let n=0;n<l.length;n++){if(l[n]===null)continue;const s=l[n].split(" ");t.push(s.pop())}return t}class ha{constructor(t,n,s,u,p,f,_){const y=t.gl;this.program=y.createProgram();const v=ls(s.staticAttributes),E=u?u.getBinderAttributes():[],M=v.concat(E),z=Kn.prelude.staticUniforms?ls(Kn.prelude.staticUniforms):[],V=s.staticUniforms?ls(s.staticUniforms):[],$=u?u.getBinderUniforms():[],U=z.concat(V).concat($),H=[];for(const ge of U)H.indexOf(ge)<0&&H.push(ge);const Q=u?u.defines():[];f&&Q.push("#define OVERDRAW_INSPECTOR;"),_&&Q.push("#define TERRAIN3D;");const ne=Q.concat(Kn.prelude.fragmentSource,s.fragmentSource).join(`
575
+ `),G=Q.concat(Kn.prelude.vertexSource,s.vertexSource).join(`
576
+ `),le=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(le,ne),y.compileShader(le),y.attachShader(this.program,le);const se=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(se,G),y.compileShader(se),y.attachShader(this.program,se),this.attributes={};const me={};this.numAttributes=M.length;for(let ge=0;ge<this.numAttributes;ge++)M[ge]&&(y.bindAttribLocation(this.program,ge,M[ge]),this.attributes[M[ge]]=ge);y.linkProgram(this.program),y.deleteShader(se),y.deleteShader(le);for(let ge=0;ge<H.length;ge++){const be=H[ge];if(be&&!me[be]){const de=y.getUniformLocation(this.program,be);de&&(me[be]=de)}}this.fixedUniforms=p(t,me),this.terrainUniforms=((ge,be)=>({u_depth:new a.Uniform1i(ge,be.u_depth),u_terrain:new a.Uniform1i(ge,be.u_terrain),u_terrain_dim:new a.Uniform1f(ge,be.u_terrain_dim),u_terrain_matrix:new a.UniformMatrix4f(ge,be.u_terrain_matrix),u_terrain_unpack:new a.Uniform4f(ge,be.u_terrain_unpack),u_terrain_offset:new a.Uniform1f(ge,be.u_terrain_offset),u_terrain_exaggeration:new a.Uniform1f(ge,be.u_terrain_exaggeration)}))(t,me),this.binderUniforms=u?u.getUniforms(t,me):[]}draw(t,n,s,u,p,f,_,y,v,E,M,z,V,$,U,H,Q,ne){const G=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(s),t.setStencilMode(u),t.setColorMode(p),t.setCullFace(f),y){t.activeTexture.set(G.TEXTURE2),G.bindTexture(G.TEXTURE_2D,y.depthTexture),t.activeTexture.set(G.TEXTURE3),G.bindTexture(G.TEXTURE_2D,y.texture);for(const se in this.terrainUniforms)this.terrainUniforms[se].set(y[se])}for(const se in this.fixedUniforms)this.fixedUniforms[se].set(_[se]);U&&U.setUniforms(t,this.binderUniforms,V,{zoom:$});let le=0;switch(n){case G.LINES:le=2;break;case G.TRIANGLES:le=3;break;case G.LINE_STRIP:le=1}for(const se of z.get()){const me=se.vaos||(se.vaos={});(me[v]||(me[v]=new as)).bind(t,this,E,U?U.getPaintVertexBuffers():[],M,se.vertexOffset,H,Q,ne),G.drawElements(n,se.primitiveLength*le,G.UNSIGNED_SHORT,se.primitiveOffset*le*2)}}}function pa(l,t,n){const s=1/Jt(n,1,t.transform.tileZoom),u=Math.pow(2,n.tileID.overscaledZ),p=n.tileSize*Math.pow(2,t.transform.tileZoom)/u,f=p*(n.tileID.canonical.x+n.tileID.wrap*u),_=p*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[s,l.fromScale,l.toScale],u_fade:l.t,u_pixel_coord_upper:[f>>16,_>>16],u_pixel_coord_lower:[65535&f,65535&_]}}const cs=(l,t,n,s)=>{const u=t.style.light,p=u.properties.get("position"),f=[p.x,p.y,p.z],_=a.create$1();u.properties.get("anchor")==="viewport"&&a.fromRotation(_,-t.transform.angle),a.transformMat3(f,f,_);const y=u.properties.get("color");return{u_matrix:l,u_lightpos:f,u_lightintensity:u.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:s}},Pl=(l,t,n,s,u,p,f)=>a.extend(cs(l,t,n,s),pa(p,t,f),{u_height_factor:-Math.pow(2,u.overscaledZ)/f.tileSize/8}),Mo=l=>({u_matrix:l}),us=(l,t,n,s)=>a.extend(Mo(l),pa(n,t,s)),da=(l,t)=>({u_matrix:l,u_world:t}),fa=(l,t,n,s,u)=>a.extend(us(l,t,n,s),{u_world:u}),ma=(l,t,n,s)=>{const u=l.transform;let p,f;if(s.paint.get("circle-pitch-alignment")==="map"){const _=Jt(n,1,u.zoom);p=!0,f=[_,_]}else p=!1,f=u.pixelsToGLUnits;return{u_camera_to_center_distance:u.cameraToCenterDistance,u_scale_with_map:+(s.paint.get("circle-pitch-scale")==="map"),u_matrix:l.translatePosMatrix(t.posMatrix,n,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_pitch_with_map:+p,u_device_pixel_ratio:l.pixelRatio,u_extrude_scale:f}},tn=(l,t,n)=>{const s=Jt(n,1,t.zoom),u=Math.pow(2,t.zoom-n.tileID.overscaledZ),p=n.tileID.overscaleFactor();return{u_matrix:l,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:s,u_extrude_scale:[t.pixelsToGLUnits[0]/(s*u),t.pixelsToGLUnits[1]/(s*u)],u_overscale_factor:p}},Jn=(l,t,n=1)=>({u_matrix:l,u_color:t,u_overlay:0,u_overlay_scale:n}),Cn=l=>({u_matrix:l}),Po=(l,t,n,s)=>({u_matrix:l,u_extrude_scale:Jt(t,1,n),u_intensity:s});function zo(l,t){const n=Math.pow(2,t.canonical.z),s=t.canonical.y;return[new a.MercatorCoordinate(0,s/n).toLngLat().lat,new a.MercatorCoordinate(0,(s+1)/n).toLngLat().lat]}const An=(l,t,n,s)=>{const u=l.transform;return{u_matrix:Qn(l,t,n,s),u_ratio:1/Jt(t,1,u.zoom),u_device_pixel_ratio:l.pixelRatio,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]]}},hs=(l,t,n,s,u)=>a.extend(An(l,t,n,u),{u_image:0,u_image_height:s}),ko=(l,t,n,s,u)=>{const p=l.transform,f=Ut(t,p);return{u_matrix:Qn(l,t,n,u),u_texsize:t.imageAtlasTexture.size,u_ratio:1/Jt(t,1,p.zoom),u_device_pixel_ratio:l.pixelRatio,u_image:0,u_scale:[f,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},Yn=(l,t,n,s,u,p)=>{const f=l.lineAtlas,_=Ut(t,l.transform),y=n.layout.get("line-cap")==="round",v=f.getDash(s.from,y),E=f.getDash(s.to,y),M=v.width*u.fromScale,z=E.width*u.toScale;return a.extend(An(l,t,n,p),{u_patternscale_a:[_/M,-v.height/2],u_patternscale_b:[_/z,-E.height/2],u_sdfgamma:f.width/(256*Math.min(M,z)*l.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:E.y,u_mix:u.t})};function Ut(l,t){return 1/Jt(l,1,t.tileZoom)}function Qn(l,t,n,s){return l.translatePosMatrix(s?s.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const ga=(l,t,n,s,u)=>{return{u_matrix:l,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:s.mix,u_opacity:s.opacity*u.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:u.paint.get("raster-brightness-min"),u_brightness_high:u.paint.get("raster-brightness-max"),u_saturation_factor:(f=u.paint.get("raster-saturation"),f>0?1-1/(1.001-f):-f),u_contrast_factor:(p=u.paint.get("raster-contrast"),p>0?1/(1-p):1+p),u_spin_weights:_a(u.paint.get("raster-hue-rotate"))};var p,f};function _a(l){l*=Math.PI/180;const t=Math.sin(l),n=Math.cos(l);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const ps=(l,t,n,s,u,p,f,_,y,v)=>{const E=u.transform;return{u_is_size_zoom_constant:+(l==="constant"||l==="source"),u_is_size_feature_constant:+(l==="constant"||l==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:E.cameraToCenterDistance,u_pitch:E.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:E.width/E.height,u_fade_change:u.options.fadeDuration?u.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:f,u_coord_matrix:_,u_is_text:+y,u_pitch_with_map:+s,u_texsize:v,u_texture:0}},Do=(l,t,n,s,u,p,f,_,y,v,E)=>{const M=u.transform;return a.extend(ps(l,t,n,s,u,p,f,_,y,v),{u_gamma_scale:s?Math.cos(M._pitch)*M.cameraToCenterDistance:1,u_device_pixel_ratio:u.pixelRatio,u_is_halo:+E})},ya=(l,t,n,s,u,p,f,_,y,v)=>a.extend(Do(l,t,n,s,u,p,f,_,!0,y,!0),{u_texsize_icon:v,u_texture_icon:1}),zl=(l,t,n)=>({u_matrix:l,u_opacity:t,u_color:n}),kl=(l,t,n,s,u,p)=>a.extend(function(f,_,y,v){const E=y.imageManager.getPattern(f.from.toString()),M=y.imageManager.getPattern(f.to.toString()),{width:z,height:V}=y.imageManager.getPixelSize(),$=Math.pow(2,v.tileID.overscaledZ),U=v.tileSize*Math.pow(2,y.transform.tileZoom)/$,H=U*(v.tileID.canonical.x+v.tileID.wrap*$),Q=U*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:E.tl,u_pattern_br_a:E.br,u_pattern_tl_b:M.tl,u_pattern_br_b:M.br,u_texsize:[z,V],u_mix:_.t,u_pattern_size_a:E.displaySize,u_pattern_size_b:M.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/Jt(v,1,y.transform.tileZoom),u_pixel_coord_upper:[H>>16,Q>>16],u_pixel_coord_lower:[65535&H,65535&Q]}}(s,p,n,u),{u_matrix:l,u_opacity:t}),ds={fillExtrusion:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_lightpos:new a.Uniform3f(l,t.u_lightpos),u_lightintensity:new a.Uniform1f(l,t.u_lightintensity),u_lightcolor:new a.Uniform3f(l,t.u_lightcolor),u_vertical_gradient:new a.Uniform1f(l,t.u_vertical_gradient),u_opacity:new a.Uniform1f(l,t.u_opacity)}),fillExtrusionPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_lightpos:new a.Uniform3f(l,t.u_lightpos),u_lightintensity:new a.Uniform1f(l,t.u_lightintensity),u_lightcolor:new a.Uniform3f(l,t.u_lightcolor),u_vertical_gradient:new a.Uniform1f(l,t.u_vertical_gradient),u_height_factor:new a.Uniform1f(l,t.u_height_factor),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade),u_opacity:new a.Uniform1f(l,t.u_opacity)}),fill:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),fillPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),fillOutline:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world)}),fillOutlinePattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),circle:(l,t)=>({u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_scale_with_map:new a.Uniform1i(l,t.u_scale_with_map),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_extrude_scale:new a.Uniform2f(l,t.u_extrude_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),collisionBox:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pixels_to_tile_units:new a.Uniform1f(l,t.u_pixels_to_tile_units),u_extrude_scale:new a.Uniform2f(l,t.u_extrude_scale),u_overscale_factor:new a.Uniform1f(l,t.u_overscale_factor)}),collisionCircle:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_inv_matrix:new a.UniformMatrix4f(l,t.u_inv_matrix),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_viewport_size:new a.Uniform2f(l,t.u_viewport_size)}),debug:(l,t)=>({u_color:new a.UniformColor(l,t.u_color),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_overlay:new a.Uniform1i(l,t.u_overlay),u_overlay_scale:new a.Uniform1f(l,t.u_overlay_scale)}),clippingMask:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),heatmap:(l,t)=>({u_extrude_scale:new a.Uniform1f(l,t.u_extrude_scale),u_intensity:new a.Uniform1f(l,t.u_intensity),u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),heatmapTexture:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world),u_image:new a.Uniform1i(l,t.u_image),u_color_ramp:new a.Uniform1i(l,t.u_color_ramp),u_opacity:new a.Uniform1f(l,t.u_opacity)}),hillshade:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_latrange:new a.Uniform2f(l,t.u_latrange),u_light:new a.Uniform2f(l,t.u_light),u_shadow:new a.UniformColor(l,t.u_shadow),u_highlight:new a.UniformColor(l,t.u_highlight),u_accent:new a.UniformColor(l,t.u_accent)}),hillshadePrepare:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_dimension:new a.Uniform2f(l,t.u_dimension),u_zoom:new a.Uniform1f(l,t.u_zoom),u_unpack:new a.Uniform4f(l,t.u_unpack)}),line:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels)}),lineGradient:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_image:new a.Uniform1i(l,t.u_image),u_image_height:new a.Uniform1f(l,t.u_image_height)}),linePattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texsize:new a.Uniform2f(l,t.u_texsize),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_image:new a.Uniform1i(l,t.u_image),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),lineSDF:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_patternscale_a:new a.Uniform2f(l,t.u_patternscale_a),u_patternscale_b:new a.Uniform2f(l,t.u_patternscale_b),u_sdfgamma:new a.Uniform1f(l,t.u_sdfgamma),u_image:new a.Uniform1i(l,t.u_image),u_tex_y_a:new a.Uniform1f(l,t.u_tex_y_a),u_tex_y_b:new a.Uniform1f(l,t.u_tex_y_b),u_mix:new a.Uniform1f(l,t.u_mix)}),raster:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_tl_parent:new a.Uniform2f(l,t.u_tl_parent),u_scale_parent:new a.Uniform1f(l,t.u_scale_parent),u_buffer_scale:new a.Uniform1f(l,t.u_buffer_scale),u_fade_t:new a.Uniform1f(l,t.u_fade_t),u_opacity:new a.Uniform1f(l,t.u_opacity),u_image0:new a.Uniform1i(l,t.u_image0),u_image1:new a.Uniform1i(l,t.u_image1),u_brightness_low:new a.Uniform1f(l,t.u_brightness_low),u_brightness_high:new a.Uniform1f(l,t.u_brightness_high),u_saturation_factor:new a.Uniform1f(l,t.u_saturation_factor),u_contrast_factor:new a.Uniform1f(l,t.u_contrast_factor),u_spin_weights:new a.Uniform3f(l,t.u_spin_weights)}),symbolIcon:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pitch:new a.Uniform1f(l,t.u_pitch),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texture:new a.Uniform1i(l,t.u_texture)}),symbolSDF:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pitch:new a.Uniform1f(l,t.u_pitch),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texture:new a.Uniform1i(l,t.u_texture),u_gamma_scale:new a.Uniform1f(l,t.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(l,t.u_is_halo)}),symbolTextAndIcon:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pitch:new a.Uniform1f(l,t.u_pitch),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texsize_icon:new a.Uniform2f(l,t.u_texsize_icon),u_texture:new a.Uniform1i(l,t.u_texture),u_texture_icon:new a.Uniform1i(l,t.u_texture_icon),u_gamma_scale:new a.Uniform1f(l,t.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(l,t.u_is_halo)}),background:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_opacity:new a.Uniform1f(l,t.u_opacity),u_color:new a.UniformColor(l,t.u_color)}),backgroundPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_opacity:new a.Uniform1f(l,t.u_opacity),u_image:new a.Uniform1i(l,t.u_image),u_pattern_tl_a:new a.Uniform2f(l,t.u_pattern_tl_a),u_pattern_br_a:new a.Uniform2f(l,t.u_pattern_br_a),u_pattern_tl_b:new a.Uniform2f(l,t.u_pattern_tl_b),u_pattern_br_b:new a.Uniform2f(l,t.u_pattern_br_b),u_texsize:new a.Uniform2f(l,t.u_texsize),u_mix:new a.Uniform1f(l,t.u_mix),u_pattern_size_a:new a.Uniform2f(l,t.u_pattern_size_a),u_pattern_size_b:new a.Uniform2f(l,t.u_pattern_size_b),u_scale_a:new a.Uniform1f(l,t.u_scale_a),u_scale_b:new a.Uniform1f(l,t.u_scale_b),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_tile_units_to_pixels:new a.Uniform1f(l,t.u_tile_units_to_pixels)}),terrain:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texture:new a.Uniform1i(l,t.u_texture)}),terrainDepth:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),terrainCoords:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texture:new a.Uniform1i(l,t.u_texture),u_terrain_coords_id:new a.Uniform1f(l,t.u_terrain_coords_id)})};class fs{constructor(t,n,s){this.context=t;const u=t.gl;this.buffer=u.createBuffer(),this.dynamicDraw=Boolean(s),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),u.bufferData(u.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?u.DYNAMIC_DRAW:u.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}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 ms={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class gs{constructor(t,n,s,u){this.length=n.length,this.attributes=s,this.itemSize=n.bytesPerElement,this.dynamicDraw=u,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),t.bindVertexBuffer.set(this.buffer),p.bufferData(p.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let s=0;s<this.attributes.length;s++){const u=n.attributes[this.attributes[s].name];u!==void 0&&t.enableVertexAttribArray(u)}}setVertexAttribPointers(t,n,s){for(let u=0;u<this.attributes.length;u++){const p=this.attributes[u],f=n.attributes[p.name];f!==void 0&&t.vertexAttribPointer(f,p.components,t[ms[p.type]],!1,this.itemSize,p.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Et{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 xa extends Et{getDefault(){return a.Color.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 Dl extends Et{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class eo extends Et{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class to extends Et{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 va extends Et{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Ui extends Et{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class _s extends Et{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 Lo extends Et{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 Ro extends Et{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 ys extends Et{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 xs extends Et{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 Bo extends Et{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class vs extends Et{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 bs extends Et{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 Fo extends Et{getDefault(){return a.Color.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 ba extends Et{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class wa extends Et{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 Mn extends Et{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Ll extends Et{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Rl extends Et{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Bl extends Et{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Fl extends Et{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 Ol extends Et{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 $l extends Et{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 ws extends Et{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 Oo extends Et{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 Ts extends Et{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Es extends Et{constructor(t){super(t),this.vao=t.extVertexArrayObject}getDefault(){return null}set(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)}}class Pn extends Et{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 Ta extends Et{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 Ea extends Et{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 $o extends Et{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class rn extends $o{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 Sa extends $o{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 zn{constructor(t,n,s,u){this.context=t,this.width=n,this.height=s;const p=t.gl,f=this.framebuffer=p.createFramebuffer();if(this.colorAttachment=new rn(t,f),u&&(this.depthAttachment=new Sa(t,f)),p.checkFramebufferStatus(p.FRAMEBUFFER)!==p.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const s=this.depthAttachment.get();s&&t.deleteRenderbuffer(s)}t.deleteFramebuffer(this.framebuffer)}}class Ft{constructor(t,n,s){this.blendFunction=t,this.blendColor=n,this.mask=s}}Ft.Replace=[1,0],Ft.disabled=new Ft(Ft.Replace,a.Color.transparent,[!1,!1,!1,!1]),Ft.unblended=new Ft(Ft.Replace,a.Color.transparent,[!0,!0,!0,!0]),Ft.alphaBlended=new Ft([1,771],a.Color.transparent,[!0,!0,!0,!0]);class Ia{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new xa(this),this.clearDepth=new Dl(this),this.clearStencil=new eo(this),this.colorMask=new to(this),this.depthMask=new va(this),this.stencilMask=new Ui(this),this.stencilFunc=new _s(this),this.stencilOp=new Lo(this),this.stencilTest=new Ro(this),this.depthRange=new ys(this),this.depthTest=new xs(this),this.depthFunc=new Bo(this),this.blend=new vs(this),this.blendFunc=new bs(this),this.blendColor=new Fo(this),this.blendEquation=new ba(this),this.cullFace=new wa(this),this.cullFaceSide=new Mn(this),this.frontFace=new Ll(this),this.program=new Rl(this),this.activeTexture=new Bl(this),this.viewport=new Fl(this),this.bindFramebuffer=new Ol(this),this.bindRenderbuffer=new $l(this),this.bindTexture=new ws(this),this.bindVertexBuffer=new Oo(this),this.bindElementBuffer=new Ts(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Es(this),this.pixelStoreUnpack=new Pn(this),this.pixelStoreUnpackPremultiplyAlpha=new Ta(this),this.pixelStoreUnpackFlipY=new Ea(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)}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.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n){return new fs(this,t,n)}createVertexBuffer(t,n,s){return new gs(this,t,n,s)}createRenderbuffer(t,n,s){const u=this.gl,p=u.createRenderbuffer();return this.bindRenderbuffer.set(p),u.renderbufferStorage(u.RENDERBUFFER,t,n,s),this.bindRenderbuffer.set(null),p}createFramebuffer(t,n,s){return new zn(this,t,n,s)}clear({color:t,depth:n}){const s=this.gl;let u=0;t&&(u|=s.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(u|=s.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),s.clear(u)}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){ue(t.blendFunction,Ft.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class mt{constructor(t,n,s){this.func=t,this.mask=n,this.range=s}}mt.ReadOnly=!1,mt.ReadWrite=!0,mt.disabled=new mt(519,mt.ReadOnly,[0,1]);const St=7680;class Bt{constructor(t,n,s,u,p,f){this.test=t,this.ref=n,this.mask=s,this.fail=u,this.depthFail=p,this.pass=f}}Bt.disabled=new Bt({func:519,mask:0},0,0,St,St,St);class Vt{constructor(t,n,s){this.enable=t,this.mode=n,this.frontFace=s}}let io;function kn(l,t,n,s,u,p,f){const _=l.context,y=_.gl,v=l.useProgram("collisionBox"),E=[];let M=0,z=0;for(let G=0;G<s.length;G++){const le=s[G],se=t.getTile(le),me=se.getBucket(n);if(!me)continue;let ge=le.posMatrix;u[0]===0&&u[1]===0||(ge=l.translatePosMatrix(le.posMatrix,se,u,p));const be=f?me.textCollisionBox:me.iconCollisionBox,de=me.collisionCircleArray;if(de.length>0){const Re=a.create(),Ce=ge;a.mul(Re,me.placementInvProjMatrix,l.transform.glCoordMatrix),a.mul(Re,Re,me.placementViewportMatrix),E.push({circleArray:de,circleOffset:z,transform:Ce,invTransform:Re,coord:le}),M+=de.length/4,z=M}be&&v.draw(_,y.LINES,mt.disabled,Bt.disabled,l.colorModeForRenderPass(),Vt.disabled,tn(ge,l.transform,se),l.style.terrain&&l.style.terrain.getTerrainData(le),n.id,be.layoutVertexBuffer,be.indexBuffer,be.segments,null,l.transform.zoom,null,null,be.collisionVertexBuffer)}if(!f||!E.length)return;const V=l.useProgram("collisionCircle"),$=new a.CollisionCircleLayoutArray;$.resize(4*M),$._trim();let U=0;for(const G of E)for(let le=0;le<G.circleArray.length/4;le++){const se=4*le,me=G.circleArray[se+0],ge=G.circleArray[se+1],be=G.circleArray[se+2],de=G.circleArray[se+3];$.emplace(U++,me,ge,be,de,0),$.emplace(U++,me,ge,be,de,1),$.emplace(U++,me,ge,be,de,2),$.emplace(U++,me,ge,be,de,3)}(!io||io.length<2*M)&&(io=function(G){const le=2*G,se=new a.QuadTriangleArray;se.resize(le),se._trim();for(let me=0;me<le;me++){const ge=6*me;se.uint16[ge+0]=4*me+0,se.uint16[ge+1]=4*me+1,se.uint16[ge+2]=4*me+2,se.uint16[ge+3]=4*me+2,se.uint16[ge+4]=4*me+3,se.uint16[ge+5]=4*me+0}return se}(M));const H=_.createIndexBuffer(io,!0),Q=_.createVertexBuffer($,a.collisionCircleLayout.members,!0);for(const G of E){const le={u_matrix:G.transform,u_inv_matrix:G.invTransform,u_camera_to_center_distance:(ne=l.transform).cameraToCenterDistance,u_viewport_size:[ne.width,ne.height]};V.draw(_,y.TRIANGLES,mt.disabled,Bt.disabled,l.colorModeForRenderPass(),Vt.disabled,le,l.style.terrain&&l.style.terrain.getTerrainData(G.coord),n.id,Q,H,a.SegmentVector.simpleSegment(0,2*G.circleOffset,G.circleArray.length,G.circleArray.length/2),null,l.transform.zoom,null,null,null)}var ne;Q.destroy(),H.destroy()}Vt.disabled=new Vt(!1,1029,2305),Vt.backCCW=new Vt(!0,1029,2305);const Ul=a.identity(new Float32Array(16));function Vl(l,t,n,s,u,p){const{horizontalAlign:f,verticalAlign:_}=a.getAnchorAlignment(l),y=-(f-.5)*t,v=-(_-.5)*n,E=a.evaluateVariableOffset(l,s);return new a.pointGeometry((y/u+E[0])*p,(v/u+E[1])*p)}function Ca(l,t,n,s,u,p,f,_,y,v,E){const M=l.text.placedSymbolArray,z=l.text.dynamicLayoutVertexArray,V=l.icon.dynamicLayoutVertexArray,$={};z.clear();for(let U=0;U<M.length;U++){const H=M.get(U),Q=l.allowVerticalPlacement&&!H.placedOrientation,ne=H.hidden||!H.crossTileID||Q?null:s[H.crossTileID];if(ne){const G=new a.pointGeometry(H.anchorX,H.anchorY),le=xt(G,n?f:p,E),se=Ki(u.cameraToCenterDistance,le.signedDistanceFromCamera);let me=a.evaluateSizeForFeature(l.textSizeData,y,H)*se/a.ONE_EM;n&&(me*=l.tilePixelRatio/_);const{width:ge,height:be,anchor:de,textOffset:Re,textBoxScale:Ce}=ne,Be=Vl(de,ge,be,Re,Ce,me),st=n?xt(G.add(Be),p,E).point:le.point.add(t?Be.rotate(-u.angle):Be),ht=l.allowVerticalPlacement&&H.placedOrientation===a.WritingMode.vertical?Math.PI/2:0;for(let We=0;We<H.numGlyphs;We++)a.addDynamicAttributes(z,st,ht);v&&H.associatedIconIndex>=0&&($[H.associatedIconIndex]={shiftedAnchor:st,angle:ht})}else rt(H.numGlyphs,z)}if(v){V.clear();const U=l.icon.placedSymbolArray;for(let H=0;H<U.length;H++){const Q=U.get(H);if(Q.hidden)rt(Q.numGlyphs,V);else{const ne=$[H];if(ne)for(let G=0;G<Q.numGlyphs;G++)a.addDynamicAttributes(V,ne.shiftedAnchor,ne.angle);else rt(Q.numGlyphs,V)}}l.icon.dynamicLayoutVertexBuffer.updateData(V)}l.text.dynamicLayoutVertexBuffer.updateData(z)}function Nl(l,t,n){return n.iconsInText&&t?"symbolTextAndIcon":l?"symbolSDF":"symbolIcon"}function Uo(l,t,n,s,u,p,f,_,y,v,E,M){const z=l.context,V=z.gl,$=l.transform,U=_==="map",H=y==="map",Q=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",ne=U&&!H&&!Q,G=!n.layout.get("symbol-sort-key").isConstant();let le=!1;const se=l.depthModeForSublayer(0,mt.ReadOnly),me=n.layout.get("text-variable-anchor"),ge=[];for(const be of s){const de=t.getTile(be),Re=de.getBucket(n);if(!Re)continue;const Ce=u?Re.text:Re.icon;if(!Ce||!Ce.segments.get().length)continue;const Be=Ce.programConfigurations.get(n.id),st=u||Re.sdfIcons,ht=u?Re.textSizeData:Re.iconSizeData,We=H||$.pitch!==0,At=l.useProgram(Nl(st,u,Re),Be),Mt=a.evaluateSizeForZoom(ht,$.zoom),_t=l.style.terrain&&l.style.terrain.getTerrainData(be);let wt,zt,ai,_r,nr=[0,0],yr=null;if(u){if(zt=de.glyphAtlasTexture,ai=V.LINEAR,wt=de.glyphAtlasTexture.size,Re.iconsInText){nr=de.imageAtlasTexture.size,yr=de.imageAtlasTexture;const Qi=ht.kind==="composite"||ht.kind==="camera";_r=We||l.options.rotating||l.options.zooming||Qi?V.LINEAR:V.NEAREST}}else{const Qi=n.layout.get("icon-size").constantOr(0)!==1||Re.iconsNeedLinear;zt=de.imageAtlasTexture,ai=st||l.options.rotating||l.options.zooming||Qi||We?V.LINEAR:V.NEAREST,wt=de.imageAtlasTexture.size}const Xr=Jt(de,1,l.transform.zoom),Yi=Jr(be.posMatrix,H,U,l.transform,Xr),zi=ir(be.posMatrix,H,U,l.transform,Xr),Ar=me&&Re.hasTextData(),Wo=n.layout.get("icon-text-fit")!=="none"&&Ar&&Re.hasIconData();if(Q){const Qi=l.style.terrain?($s,On)=>l.style.terrain.getElevation(be,$s,On):null,an=n.layout.get("text-rotation-alignment")==="map";$i(Re,be.posMatrix,l,u,Yi,zi,H,v,an,Qi)}const ii=l.translatePosMatrix(be.posMatrix,de,p,f),dt=Q||u&&me||Wo?Ul:Yi,Ct=l.translatePosMatrix(zi,de,p,f,!0),li=st&&n.paint.get(u?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ci;ci=st?Re.iconsInText?ya(ht.kind,Mt,ne,H,l,ii,dt,Ct,wt,nr):Do(ht.kind,Mt,ne,H,l,ii,dt,Ct,u,wt,!0):ps(ht.kind,Mt,ne,H,l,ii,dt,Ct,u,wt);const Gt={program:At,buffers:Ce,uniformValues:ci,atlasTexture:zt,atlasTextureIcon:yr,atlasInterpolation:ai,atlasInterpolationIcon:_r,isSDF:st,hasHalo:li};if(G&&Re.canOverlap){le=!0;const Qi=Ce.segments.get();for(const an of Qi)ge.push({segments:new a.SegmentVector([an]),sortKey:an.sortKey,state:Gt,terrainData:_t})}else ge.push({segments:Ce.segments,sortKey:0,state:Gt,terrainData:_t})}le&&ge.sort((be,de)=>be.sortKey-de.sortKey);for(const be of ge){const de=be.state;if(z.activeTexture.set(V.TEXTURE0),de.atlasTexture.bind(de.atlasInterpolation,V.CLAMP_TO_EDGE),de.atlasTextureIcon&&(z.activeTexture.set(V.TEXTURE1),de.atlasTextureIcon&&de.atlasTextureIcon.bind(de.atlasInterpolationIcon,V.CLAMP_TO_EDGE)),de.isSDF){const Re=de.uniformValues;de.hasHalo&&(Re.u_is_halo=1,ro(de.buffers,be.segments,n,l,de.program,se,E,M,Re,be.terrainData)),Re.u_is_halo=0}ro(de.buffers,be.segments,n,l,de.program,se,E,M,de.uniformValues,be.terrainData)}}function ro(l,t,n,s,u,p,f,_,y,v){const E=s.context;u.draw(E,E.gl.TRIANGLES,p,f,_,Vt.disabled,y,v,n.id,l.layoutVertexBuffer,l.indexBuffer,t,n.paint,s.transform.zoom,l.programConfigurations.get(n.id),l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer)}function no(l,t,n,s,u,p,f){const _=l.context.gl,y=n.paint.get("fill-pattern"),v=y&&y.constantOr(1),E=n.getCrossfadeParameters();let M,z,V,$,U;f?(z=v&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",M=_.LINES):(z=v?"fillPattern":"fill",M=_.TRIANGLES);for(const H of s){const Q=t.getTile(H);if(v&&!Q.patternsLoaded())continue;const ne=Q.getBucket(n);if(!ne)continue;const G=ne.programConfigurations.get(n.id),le=l.useProgram(z,G),se=l.style.terrain&&l.style.terrain.getTerrainData(H);v&&(l.context.activeTexture.set(_.TEXTURE0),Q.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),G.updatePaintBuffers(E));const me=y.constantOr(null);if(me&&Q.imageAtlas){const de=Q.imageAtlas,Re=de.patternPositions[me.to.toString()],Ce=de.patternPositions[me.from.toString()];Re&&Ce&&G.setConstantPatternPositions(Re,Ce)}const ge=se?H:null,be=l.translatePosMatrix(ge?ge.posMatrix:H.posMatrix,Q,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(f){$=ne.indexBuffer2,U=ne.segments2;const de=[_.drawingBufferWidth,_.drawingBufferHeight];V=z==="fillOutlinePattern"&&v?fa(be,l,E,Q,de):da(be,de)}else $=ne.indexBuffer,U=ne.segments,V=v?us(be,l,E,Q):Mo(be);le.draw(l.context,M,u,l.stencilModeForClipping(H),p,Vt.disabled,V,se,n.id,ne.layoutVertexBuffer,$,U,n.paint,l.transform.zoom,G)}}function oo(l,t,n,s,u,p,f){const _=l.context,y=_.gl,v=n.paint.get("fill-extrusion-pattern"),E=v.constantOr(1),M=n.getCrossfadeParameters(),z=n.paint.get("fill-extrusion-opacity");for(const V of s){const $=t.getTile(V),U=$.getBucket(n);if(!U)continue;const H=l.style.terrain&&l.style.terrain.getTerrainData(V),Q=U.programConfigurations.get(n.id),ne=l.useProgram(E?"fillExtrusionPattern":"fillExtrusion",Q);E&&(l.context.activeTexture.set(y.TEXTURE0),$.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),Q.updatePaintBuffers(M));const G=v.constantOr(null);if(G&&$.imageAtlas){const ge=$.imageAtlas,be=ge.patternPositions[G.to.toString()],de=ge.patternPositions[G.from.toString()];be&&de&&Q.setConstantPatternPositions(be,de)}const le=l.translatePosMatrix(V.posMatrix,$,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),se=n.paint.get("fill-extrusion-vertical-gradient"),me=E?Pl(le,l,se,z,V,M,$):cs(le,l,se,z);ne.draw(_,_.gl.TRIANGLES,u,p,f,Vt.backCCW,me,H,n.id,U.layoutVertexBuffer,U.indexBuffer,U.segments,n.paint,l.transform.zoom,Q,l.style.terrain&&U.centroidVertexBuffer)}}function Ss(l,t,n,s,u,p,f){const _=l.context,y=_.gl,v=n.fbo;if(!v)return;const E=l.useProgram("hillshade"),M=l.style.terrain&&l.style.terrain.getTerrainData(t);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment.get()),E.draw(_,y.TRIANGLES,u,p,f,Vt.disabled,((z,V,$,U)=>{const H=$.paint.get("hillshade-shadow-color"),Q=$.paint.get("hillshade-highlight-color"),ne=$.paint.get("hillshade-accent-color");let G=$.paint.get("hillshade-illumination-direction")*(Math.PI/180);$.paint.get("hillshade-illumination-anchor")==="viewport"&&(G-=z.transform.angle);const le=!z.options.moving;return{u_matrix:U?U.posMatrix:z.transform.calculatePosMatrix(V.tileID.toUnwrapped(),le),u_image:0,u_latrange:zo(0,V.tileID),u_light:[$.paint.get("hillshade-exaggeration"),G],u_shadow:H,u_highlight:Q,u_accent:ne}})(l,n,s,M?t:null),M,s.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments)}function Aa(l,t,n,s,u,p){const f=l.context,_=f.gl,y=t.dem;if(y&&y.data){const v=y.dim,E=y.stride,M=y.getPixels();if(f.activeTexture.set(_.TEXTURE1),f.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||l.getTileTexture(E),t.demTexture){const V=t.demTexture;V.update(M,{premultiply:!1}),V.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else t.demTexture=new Ue(f,M,_.RGBA,{premultiply:!1}),t.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);f.activeTexture.set(_.TEXTURE0);let z=t.fbo;if(!z){const V=new Ue(f,{width:v,height:v,data:null},_.RGBA);V.bind(_.LINEAR,_.CLAMP_TO_EDGE),z=t.fbo=f.createFramebuffer(v,v,!0),z.colorAttachment.set(V.texture)}f.bindFramebuffer.set(z.framebuffer),f.viewport.set([0,0,v,v]),l.useProgram("hillshadePrepare").draw(f,_.TRIANGLES,s,u,p,Vt.disabled,((V,$)=>{const U=$.stride,H=a.create();return a.ortho(H,0,a.EXTENT,-a.EXTENT,0,0,1),a.translate(H,H,[0,-a.EXTENT,0]),{u_matrix:H,u_image:1,u_dimension:[U,U],u_zoom:V.overscaledZ,u_unpack:$.getUnpackVector()}})(t.tileID,y),null,n.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Vo(l,t,n,s,u,p){const f=s.paint.get("raster-fade-duration");if(!p&&f>0){const _=a.exported.now(),y=(_-l.timeAdded)/f,v=t?(_-t.timeAdded)/f:-1,E=n.getSource(),M=u.coveringZoomLevel({tileSize:E.tileSize,roundZoom:E.roundZoom}),z=!t||Math.abs(t.tileID.overscaledZ-M)>Math.abs(l.tileID.overscaledZ-M),V=z&&l.refreshedUponExpiration?1:a.clamp(z?y:1-v,0,1);return l.refreshedUponExpiration&&y>=1&&(l.refreshedUponExpiration=!1),t?{opacity:1,mix:1-V}:{opacity:V,mix:0}}return{opacity:1,mix:0}}const No=new a.Color(1,0,0,1),rr=new a.Color(0,1,0,1),Ma=new a.Color(0,0,1,1),Is=new a.Color(1,0,1,1),Pa=new a.Color(0,1,1,1);function nn(l,t,n,s){Dn(l,0,t+n/2,l.transform.width,n,s)}function so(l,t,n,s){Dn(l,t-n/2,0,n,l.transform.height,s)}function Dn(l,t,n,s,u,p){const f=l.context,_=f.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*l.pixelRatio,n*l.pixelRatio,s*l.pixelRatio,u*l.pixelRatio),f.clear({color:p}),_.disable(_.SCISSOR_TEST)}function Gl(l,t,n){const s=l.context,u=s.gl,p=n.posMatrix,f=l.useProgram("debug"),_=mt.disabled,y=Bt.disabled,v=l.colorModeForRenderPass(),E="$debug",M=l.style.terrain&&l.style.terrain.getTerrainData(n);s.activeTexture.set(u.TEXTURE0),l.emptyTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE);const z=t.getTileByID(n.key).latestRawTileData,V=Math.floor((z&&z.byteLength||0)/1024),$=t.getTile(n).tileSize,U=512/Math.min($,512)*(n.overscaledZ/l.transform.zoom)*.5;let H=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(H+=` => ${n.overscaledZ}`),function(Q,ne){Q.initDebugOverlayCanvas();const G=Q.debugOverlayCanvas,le=Q.context.gl,se=Q.debugOverlayCanvas.getContext("2d");se.clearRect(0,0,G.width,G.height),se.shadowColor="white",se.shadowBlur=2,se.lineWidth=1.5,se.strokeStyle="white",se.textBaseline="top",se.font="bold 36px Open Sans, sans-serif",se.fillText(ne,5,5),se.strokeText(ne,5,5),Q.debugOverlayTexture.update(G),Q.debugOverlayTexture.bind(le.LINEAR,le.CLAMP_TO_EDGE)}(l,`${H} ${V}kB`),f.draw(s,u.TRIANGLES,_,y,Ft.alphaBlended,Vt.disabled,Jn(p,a.Color.transparent,U),null,E,l.debugBuffer,l.quadTriangleIndexBuffer,l.debugSegments),f.draw(s,u.LINE_STRIP,_,y,v,Vt.disabled,Jn(p,a.Color.red),M,E,l.debugBuffer,l.tileBorderIndexBuffer,l.debugSegments)}function Go(l,t,n){const s=l.context,u=s.gl,p=l.colorModeForRenderPass(),f=new mt(u.LEQUAL,mt.ReadWrite,l.depthRangeFor3D),_=l.useProgram("terrain"),y=t.getTerrainMesh(),v=t.getTerrainData(n.tileID);s.bindFramebuffer.set(null),s.viewport.set([0,0,l.width,l.height]),s.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,t.getRTTFramebuffer().colorAttachment.get());const E=l.transform.calculatePosMatrix(n.tileID.toUnwrapped());_.draw(s,u.TRIANGLES,f,Bt.disabled,p,Vt.backCCW,{u_matrix:E,u_texture:0},v,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}function za(l,t,n,s){const u=l.context,p=n.tileSize*t.qualityFactor;n.textures[s]||(n.textures[s]=l.getTileTexture(p)||new Ue(u,{width:p,height:p,data:null},u.gl.RGBA),n.textures[s].bind(u.gl.LINEAR,u.gl.CLAMP_TO_EDGE),s===0&&t.sourceCache.renderHistory.unshift(n.tileID.key));const f=t.getRTTFramebuffer();f.colorAttachment.set(n.textures[s].texture),u.bindFramebuffer.set(f.framebuffer),u.viewport.set([0,0,p,p])}class ka{constructor(t){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=t,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=t.style.terrain.sourceCache.getRenderableTiles(),this._init()}_init(){const t=this.painter.style,n=t.terrain;for(const s in t.sourceCaches){this._coordsDescendingInv[s]={};const u=t.sourceCaches[s].getVisibleCoordinates();for(const p of u){const f=n.sourceCache.getTerrainCoords(p);for(const _ in f)this._coordsDescendingInv[s][_]||(this._coordsDescendingInv[s][_]=[]),this._coordsDescendingInv[s][_].push(f[_])}}for(const s of t._order){const u=t._layers[s],p=u.source;if(this._renderToTexture[u.type]&&!this._coordsDescendingInvStr[p]){this._coordsDescendingInvStr[p]={};for(const f in this._coordsDescendingInv[p])this._coordsDescendingInvStr[p][f]=this._coordsDescendingInv[p][f].map(_=>_.key).sort().join()}}return this._renderableTiles.forEach(s=>{for(const u in this._coordsDescendingInvStr){const p=this._coordsDescendingInvStr[u][s.tileID.key];p&&p!==s.textureCoords[u]&&s.clearTextures(this.painter),n.needsRerender(u,s.tileID)&&s.clearTextures(this.painter)}this._rerender[s.tileID.key]=!s.textures.length}),n.clearRerenderCache(),n.sourceCache.removeOutdated(this.painter),this}renderLayer(t){const n=t.type,s=this.painter,u=s.style._order,p=s.currentLayer,f=p+1===u.length;if(this._renderToTexture[n]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(u[p]),!f))return!0;if(this._renderToTexture[this._prevType]||n==="hillshade"||this._renderToTexture[n]&&f){this._prevType=n;const _=this._stacks.length-1,y=this._stacks[_]||[];for(const v of this._renderableTiles){if(za(s,s.style.terrain,v,_),this._rerender[v.tileID.key]){s.context.clear({color:a.Color.transparent});for(let E=0;E<y.length;E++){const M=s.style._layers[y[E]],z=M.source?this._coordsDescendingInv[M.source][v.tileID.key]:[v.tileID];s._renderTileClippingMasks(M,z),s.renderLayer(s,s.style.sourceCaches[M.source],M,z),M.source&&(v.textureCoords[M.source]=this._coordsDescendingInvStr[M.source][v.tileID.key])}}Go(s,s.style.terrain,v)}if(n==="hillshade"){this._stacks.push([u[p]]);for(const v of this._renderableTiles){const E=this._coordsDescendingInv[t.source][v.tileID.key];za(s,s.style.terrain,v,this._stacks.length-1),s.context.clear({color:a.Color.transparent}),s._renderTileClippingMasks(t,E),s.renderLayer(s,s.style.sourceCaches[t.source],t,E),Go(s,s.style.terrain,v)}return!0}return this._renderToTexture[n]}return!1}}const ao={symbol:function(l,t,n,s,u){if(l.renderPass!=="translucent")return;const p=Bt.disabled,f=l.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(_,y,v,E,M,z,V){const $=y.transform,U=M==="map",H=z==="map";for(const Q of _){const ne=E.getTile(Q),G=ne.getBucket(v);if(!G||!G.text||!G.text.segments.get().length)continue;const le=a.evaluateSizeForZoom(G.textSizeData,$.zoom),se=Jt(ne,1,y.transform.zoom),me=Jr(Q.posMatrix,H,U,y.transform,se),ge=v.layout.get("icon-text-fit")!=="none"&&G.hasIconData();if(le){const be=Math.pow(2,$.zoom-ne.tileID.overscaledZ);Ca(G,U,H,V,$,me,Q.posMatrix,be,le,ge,y.style.terrain?(de,Re)=>y.style.terrain.getElevation(Q,de,Re):null)}}}(s,l,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),u),n.paint.get("icon-opacity").constantOr(1)!==0&&Uo(l,t,n,s,!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"),p,f),n.paint.get("text-opacity").constantOr(1)!==0&&Uo(l,t,n,s,!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"),p,f),t.map.showCollisionBoxes&&(kn(l,t,n,s,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),kn(l,t,n,s,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(l,t,n,s){if(l.renderPass!=="translucent")return;const u=n.paint.get("circle-opacity"),p=n.paint.get("circle-stroke-width"),f=n.paint.get("circle-stroke-opacity"),_=!n.layout.get("circle-sort-key").isConstant();if(u.constantOr(1)===0&&(p.constantOr(1)===0||f.constantOr(1)===0))return;const y=l.context,v=y.gl,E=l.depthModeForSublayer(0,mt.ReadOnly),M=Bt.disabled,z=l.colorModeForRenderPass(),V=[];for(let $=0;$<s.length;$++){const U=s[$],H=t.getTile(U),Q=H.getBucket(n);if(!Q)continue;const ne=Q.programConfigurations.get(n.id),G=l.useProgram("circle",ne),le=Q.layoutVertexBuffer,se=Q.indexBuffer,me=l.style.terrain&&l.style.terrain.getTerrainData(U),ge={programConfiguration:ne,program:G,layoutVertexBuffer:le,indexBuffer:se,uniformValues:ma(l,U,H,n),terrainData:me};if(_){const be=Q.segments.get();for(const de of be)V.push({segments:new a.SegmentVector([de]),sortKey:de.sortKey,state:ge})}else V.push({segments:Q.segments,sortKey:0,state:ge})}_&&V.sort(($,U)=>$.sortKey-U.sortKey);for(const $ of V){const{programConfiguration:U,program:H,layoutVertexBuffer:Q,indexBuffer:ne,uniformValues:G,terrainData:le}=$.state;H.draw(y,v.TRIANGLES,E,M,z,Vt.disabled,G,le,n.id,Q,ne,$.segments,n.paint,l.transform.zoom,U)}},heatmap:function(l,t,n,s){if(n.paint.get("heatmap-opacity")!==0)if(l.renderPass==="offscreen"){const u=l.context,p=u.gl,f=Bt.disabled,_=new Ft([p.ONE,p.ONE],a.Color.transparent,[!0,!0,!0,!0]);(function(y,v,E){const M=y.gl;y.activeTexture.set(M.TEXTURE1),y.viewport.set([0,0,v.width/4,v.height/4]);let z=E.heatmapFbo;if(z)M.bindTexture(M.TEXTURE_2D,z.colorAttachment.get()),y.bindFramebuffer.set(z.framebuffer);else{const V=M.createTexture();M.bindTexture(M.TEXTURE_2D,V),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_S,M.CLAMP_TO_EDGE),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_T,M.CLAMP_TO_EDGE),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MIN_FILTER,M.LINEAR),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MAG_FILTER,M.LINEAR),z=E.heatmapFbo=y.createFramebuffer(v.width/4,v.height/4,!1),function($,U,H,Q){const ne=$.gl;ne.texImage2D(ne.TEXTURE_2D,0,ne.RGBA,U.width/4,U.height/4,0,ne.RGBA,$.extRenderToTextureHalfFloat?$.extTextureHalfFloat.HALF_FLOAT_OES:ne.UNSIGNED_BYTE,null),Q.colorAttachment.set(H)}(y,v,V,z)}})(u,l,n),u.clear({color:a.Color.transparent});for(let y=0;y<s.length;y++){const v=s[y];if(t.hasRenderableParent(v))continue;const E=t.getTile(v),M=E.getBucket(n);if(!M)continue;const z=M.programConfigurations.get(n.id),V=l.useProgram("heatmap",z),{zoom:$}=l.transform;V.draw(u,p.TRIANGLES,mt.disabled,f,_,Vt.disabled,Po(v.posMatrix,E,$,n.paint.get("heatmap-intensity")),null,n.id,M.layoutVertexBuffer,M.indexBuffer,M.segments,n.paint,l.transform.zoom,z)}u.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.colorModeForRenderPass()),function(u,p){const f=u.context,_=f.gl,y=p.heatmapFbo;if(!y)return;f.activeTexture.set(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,y.colorAttachment.get()),f.activeTexture.set(_.TEXTURE1);let v=p.colorRampTexture;v||(v=p.colorRampTexture=new Ue(f,p.colorRamp,_.RGBA)),v.bind(_.LINEAR,_.CLAMP_TO_EDGE),u.useProgram("heatmapTexture").draw(f,_.TRIANGLES,mt.disabled,Bt.disabled,u.colorModeForRenderPass(),Vt.disabled,((E,M,z,V)=>{const $=a.create();a.ortho($,0,E.width,E.height,0,0,1);const U=E.context.gl;return{u_matrix:$,u_world:[U.drawingBufferWidth,U.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:M.paint.get("heatmap-opacity")}})(u,p),null,p.id,u.viewportBuffer,u.quadTriangleIndexBuffer,u.viewportSegments,p.paint,u.transform.zoom)}(l,n))},line:function(l,t,n,s){if(l.renderPass!=="translucent")return;const u=n.paint.get("line-opacity"),p=n.paint.get("line-width");if(u.constantOr(1)===0||p.constantOr(1)===0)return;const f=l.depthModeForSublayer(0,mt.ReadOnly),_=l.colorModeForRenderPass(),y=n.paint.get("line-dasharray"),v=n.paint.get("line-pattern"),E=v.constantOr(1),M=n.paint.get("line-gradient"),z=n.getCrossfadeParameters(),V=E?"linePattern":y?"lineSDF":M?"lineGradient":"line",$=l.context,U=$.gl;let H=!0;for(const Q of s){const ne=t.getTile(Q);if(E&&!ne.patternsLoaded())continue;const G=ne.getBucket(n);if(!G)continue;const le=G.programConfigurations.get(n.id),se=l.context.program.get(),me=l.useProgram(V,le),ge=H||me.program!==se,be=l.style.terrain&&l.style.terrain.getTerrainData(Q),de=v.constantOr(null);if(de&&ne.imageAtlas){const Be=ne.imageAtlas,st=Be.patternPositions[de.to.toString()],ht=Be.patternPositions[de.from.toString()];st&&ht&&le.setConstantPatternPositions(st,ht)}const Re=be?Q:null,Ce=E?ko(l,ne,n,z,Re):y?Yn(l,ne,n,y,z,Re):M?hs(l,ne,n,G.lineClipsArray.length,Re):An(l,ne,n,Re);if(E)$.activeTexture.set(U.TEXTURE0),ne.imageAtlasTexture.bind(U.LINEAR,U.CLAMP_TO_EDGE),le.updatePaintBuffers(z);else if(y&&(ge||l.lineAtlas.dirty))$.activeTexture.set(U.TEXTURE0),l.lineAtlas.bind($);else if(M){const Be=G.gradients[n.id];let st=Be.texture;if(n.gradientVersion!==Be.version){let ht=256;if(n.stepInterpolant){const We=t.getSource().maxzoom,At=Q.canonical.z===We?Math.ceil(1<<l.transform.maxZoom-Q.canonical.z):1;ht=a.clamp(a.nextPowerOfTwo(G.maxLineLength/a.EXTENT*1024*At),256,$.maxTextureSize)}Be.gradient=a.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:ht,image:Be.gradient||void 0,clips:G.lineClipsArray}),Be.texture?Be.texture.update(Be.gradient):Be.texture=new Ue($,Be.gradient,U.RGBA),Be.version=n.gradientVersion,st=Be.texture}$.activeTexture.set(U.TEXTURE0),st.bind(n.stepInterpolant?U.NEAREST:U.LINEAR,U.CLAMP_TO_EDGE)}me.draw($,U.TRIANGLES,f,l.stencilModeForClipping(Q),_,Vt.disabled,Ce,be,n.id,G.layoutVertexBuffer,G.indexBuffer,G.segments,n.paint,l.transform.zoom,le,G.layoutVertexBuffer2),H=!1}},fill:function(l,t,n,s){const u=n.paint.get("fill-color"),p=n.paint.get("fill-opacity");if(p.constantOr(1)===0)return;const f=l.colorModeForRenderPass(),_=n.paint.get("fill-pattern"),y=l.opaquePassEnabledForLayer()&&!_.constantOr(1)&&u.constantOr(a.Color.transparent).a===1&&p.constantOr(0)===1?"opaque":"translucent";if(l.renderPass===y){const v=l.depthModeForSublayer(1,l.renderPass==="opaque"?mt.ReadWrite:mt.ReadOnly);no(l,t,n,s,v,f,!1)}if(l.renderPass==="translucent"&&n.paint.get("fill-antialias")){const v=l.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,mt.ReadOnly);no(l,t,n,s,v,f,!0)}},"fill-extrusion":function(l,t,n,s){const u=n.paint.get("fill-extrusion-opacity");if(u!==0&&l.renderPass==="translucent"){const p=new mt(l.context.gl.LEQUAL,mt.ReadWrite,l.depthRangeFor3D);if(u!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))oo(l,t,n,s,p,Bt.disabled,Ft.disabled),oo(l,t,n,s,p,l.stencilModeFor3D(),l.colorModeForRenderPass());else{const f=l.colorModeForRenderPass();oo(l,t,n,s,p,Bt.disabled,f)}}},hillshade:function(l,t,n,s){if(l.renderPass!=="offscreen"&&l.renderPass!=="translucent")return;const u=l.context,p=l.depthModeForSublayer(0,mt.ReadOnly),f=l.colorModeForRenderPass(),[_,y]=l.renderPass==="translucent"?l.stencilConfigForOverlap(s):[{},s];for(const v of y){const E=t.getTile(v);E.needsHillshadePrepare!==void 0&&E.needsHillshadePrepare&&l.renderPass==="offscreen"?Aa(l,E,n,p,Bt.disabled,f):l.renderPass==="translucent"&&Ss(l,v,E,n,p,_[v.overscaledZ],f)}u.viewport.set([0,0,l.width,l.height])},raster:function(l,t,n,s){if(l.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!s.length)return;const u=l.context,p=u.gl,f=t.getSource(),_=l.useProgram("raster"),y=l.colorModeForRenderPass(),[v,E]=f instanceof Ci?[{},s]:l.stencilConfigForOverlap(s),M=E[E.length-1].overscaledZ,z=!l.options.moving;for(const V of E){const $=l.depthModeForSublayer(V.overscaledZ-M,n.paint.get("raster-opacity")===1?mt.ReadWrite:mt.ReadOnly,p.LESS),U=t.getTile(V);U.registerFadeDuration(n.paint.get("raster-fade-duration"));const H=t.findLoadedParent(V,0),Q=Vo(U,H,t,n,l.transform,l.style.terrain);let ne,G;const le=n.paint.get("raster-resampling")==="nearest"?p.NEAREST:p.LINEAR;u.activeTexture.set(p.TEXTURE0),U.texture.bind(le,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),u.activeTexture.set(p.TEXTURE1),H?(H.texture.bind(le,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),ne=Math.pow(2,H.tileID.overscaledZ-U.tileID.overscaledZ),G=[U.tileID.canonical.x*ne%1,U.tileID.canonical.y*ne%1]):U.texture.bind(le,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST);const se=l.style.terrain&&l.style.terrain.getTerrainData(V),me=se?V:null,ge=me?me.posMatrix:l.transform.calculatePosMatrix(V.toUnwrapped(),z),be=ga(ge,G||[0,0],ne||1,Q,n);f instanceof Ci?_.draw(u,p.TRIANGLES,$,Bt.disabled,y,Vt.disabled,be,se,n.id,f.boundsBuffer,l.quadTriangleIndexBuffer,f.boundsSegments):_.draw(u,p.TRIANGLES,$,v[V.overscaledZ],y,Vt.disabled,be,se,n.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments)}},background:function(l,t,n,s){const u=n.paint.get("background-color"),p=n.paint.get("background-opacity");if(p===0)return;const f=l.context,_=f.gl,y=l.transform,v=y.tileSize,E=n.paint.get("background-pattern");if(l.isPatternMissing(E))return;const M=!E&&u.a===1&&p===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass!==M)return;const z=Bt.disabled,V=l.depthModeForSublayer(0,M==="opaque"?mt.ReadWrite:mt.ReadOnly),$=l.colorModeForRenderPass(),U=l.useProgram(E?"backgroundPattern":"background"),H=s||y.coveringTiles({tileSize:v,terrain:l.style.terrain});E&&(f.activeTexture.set(_.TEXTURE0),l.imageManager.bind(l.context));const Q=n.getCrossfadeParameters();for(const ne of H){const G=s?ne.posMatrix:l.transform.calculatePosMatrix(ne.toUnwrapped()),le=E?kl(G,p,l,E,{tileID:ne,tileSize:v},Q):zl(G,p,u),se=l.style.terrain&&l.style.terrain.getTerrainData(ne);U.draw(f,_.TRIANGLES,V,z,$,Vt.disabled,le,se,n.id,l.tileExtentBuffer,l.quadTriangleIndexBuffer,l.tileExtentSegments)}},debug:function(l,t,n){for(let s=0;s<n.length;s++)Gl(l,t,n[s])},custom:function(l,t,n){const s=l.context,u=n.implementation;if(l.renderPass==="offscreen"){const p=u.prerender;p&&(l.setCustomLayerDefaults(),s.setColorMode(l.colorModeForRenderPass()),p.call(u,s.gl,l.transform.customLayerMatrix()),s.setDirty(),l.setBaseState())}else if(l.renderPass==="translucent"){l.setCustomLayerDefaults(),s.setColorMode(l.colorModeForRenderPass()),s.setStencilMode(Bt.disabled);const p=u.renderingMode==="3d"?new mt(l.context.gl.LEQUAL,mt.ReadWrite,l.depthRangeFor3D):l.depthModeForSublayer(0,mt.ReadOnly);s.setDepthMode(p),u.render(s.gl,l.transform.customLayerMatrix()),s.setDirty(),l.setBaseState(),s.bindFramebuffer.set(null)}}};class Cs{constructor(t,n){this.context=new Ia(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:a.create(),renderTime:0},this.setup(),this.numSublayers=Mi.maxUnderzooming+Mi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Qe,this.gpuTimers={}}resize(t,n,s){if(this.width=t*s,this.height=n*s,this.pixelRatio=s,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const u of this.style._order)this.style._layers[u].resize()}setup(){const t=this.context,n=new a.PosArray;n.emplaceBack(0,0),n.emplaceBack(a.EXTENT,0),n.emplaceBack(0,a.EXTENT),n.emplaceBack(a.EXTENT,a.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,vt.members),this.tileExtentSegments=a.SegmentVector.simpleSegment(0,0,4,2);const s=new a.PosArray;s.emplaceBack(0,0),s.emplaceBack(a.EXTENT,0),s.emplaceBack(0,a.EXTENT),s.emplaceBack(a.EXTENT,a.EXTENT),this.debugBuffer=t.createVertexBuffer(s,vt.members),this.debugSegments=a.SegmentVector.simpleSegment(0,0,4,5);const u=new a.RasterBoundsArray;u.emplaceBack(0,0,0,0),u.emplaceBack(a.EXTENT,0,a.EXTENT,0),u.emplaceBack(0,a.EXTENT,0,a.EXTENT),u.emplaceBack(a.EXTENT,a.EXTENT,a.EXTENT,a.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(u,wi.members),this.rasterBoundsSegments=a.SegmentVector.simpleSegment(0,0,4,2);const p=new a.PosArray;p.emplaceBack(0,0),p.emplaceBack(1,0),p.emplaceBack(0,1),p.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(p,vt.members),this.viewportSegments=a.SegmentVector.simpleSegment(0,0,4,2);const f=new a.LineStripIndexArray;f.emplaceBack(0),f.emplaceBack(1),f.emplaceBack(3),f.emplaceBack(2),f.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(f);const _=new a.TriangleIndexArray;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_),this.emptyTexture=new Ue(t,{width:1,height:1,data:new Uint8Array([0,0,0,0])},t.gl.RGBA);const y=this.context.gl;this.stencilClearMode=new Bt({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=a.create();a.ortho(s,0,this.width,this.height,0,0,1),a.scale(s,s,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,mt.disabled,this.stencilClearMode,Ft.disabled,Vt.disabled,Cn(s),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const s=this.context,u=s.gl;this.nextStencilID+n.length>256&&this.clearStencil(),s.setColorMode(Ft.disabled),s.setDepthMode(mt.disabled);const p=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const f of n){const _=this._tileClippingMaskIDs[f.key]=this.nextStencilID++,y=this.style.terrain&&this.style.terrain.getTerrainData(f);p.draw(s,u.TRIANGLES,mt.disabled,new Bt({func:u.ALWAYS,mask:0},_,255,u.KEEP,u.KEEP,u.REPLACE),Ft.disabled,Vt.disabled,Cn(f.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new Bt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Bt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,s=t.sort((f,_)=>_.overscaledZ-f.overscaledZ),u=s[s.length-1].overscaledZ,p=s[0].overscaledZ-u+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const f={};for(let _=0;_<p;_++)f[_+u]=new Bt({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[f,s]}return[{[u]:Bt.disabled},s]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Ft([t.CONSTANT_COLOR,t.ONE],new a.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ft.unblended:Ft.alphaBlended}depthModeForSublayer(t,n,s){if(!this.opaquePassEnabledForLayer())return mt.disabled;const u=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new mt(s||this.context.gl.LEQUAL,n,[u,u])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(a.exported.now()),this.imageManager.beginFrame();const s=this.style._order,u=this.style.sourceCaches,p=this.style.terrain&&new ka(this);for(const v in u){const E=u[v];E.used&&E.prepare(this.context)}const f={},_={},y={};for(const v in u){const E=u[v];f[v]=E.getVisibleCoordinates(),_[v]=f[v].slice().reverse(),y[v]=E.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let v=0;v<s.length;v++)if(this.style._layers[s[v]].is3D()){this.opaquePassCutoff=v;break}if(p){this.opaquePassCutoff=0;const v=this.style.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!a.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||v.length)&&(a.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(E,M){const z=E.context,V=z.gl,$=Ft.unblended,U=new mt(V.LEQUAL,mt.ReadWrite,[0,1]),H=M.getTerrainMesh(),Q=M.sourceCache.getRenderableTiles(),ne=E.useProgram("terrainDepth");z.bindFramebuffer.set(M.getFramebuffer("depth").framebuffer),z.viewport.set([0,0,E.width/devicePixelRatio,E.height/devicePixelRatio]),z.clear({color:a.Color.transparent,depth:1});for(const G of Q){const le=M.getTerrainData(G.tileID),se=E.transform.calculatePosMatrix(G.tileID.toUnwrapped());ne.draw(z,V.TRIANGLES,U,Bt.disabled,$,Vt.backCCW,{u_matrix:se},le,"terrain",H.vertexBuffer,H.indexBuffer,H.segments)}z.bindFramebuffer.set(null),z.viewport.set([0,0,E.width,E.height])}(this,this.style.terrain),function(E,M){const z=E.context,V=z.gl,$=Ft.unblended,U=new mt(V.LEQUAL,mt.ReadWrite,[0,1]),H=M.getTerrainMesh(),Q=M.getCoordsTexture(),ne=M.sourceCache.getRenderableTiles(),G=E.useProgram("terrainCoords");z.bindFramebuffer.set(M.getFramebuffer("coords").framebuffer),z.viewport.set([0,0,E.width/devicePixelRatio,E.height/devicePixelRatio]),z.clear({color:a.Color.transparent,depth:1}),M.coordsIndex=[];for(const le of ne){const se=M.getTerrainData(le.tileID);z.activeTexture.set(V.TEXTURE0),V.bindTexture(V.TEXTURE_2D,Q.texture);const me=E.transform.calculatePosMatrix(le.tileID.toUnwrapped());G.draw(z,V.TRIANGLES,U,Bt.disabled,$,Vt.backCCW,{u_matrix:me,u_terrain_coords_id:(255-M.coordsIndex.length)/255,u_texture:0},se,"terrain",H.vertexBuffer,H.indexBuffer,H.segments),M.coordsIndex.push(le.tileID.key)}z.bindFramebuffer.set(null),z.viewport.set([0,0,E.width,E.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(const v of s){const E=this.style._layers[v];if(!E.hasOffscreenPass()||E.isHidden(this.transform.zoom))continue;const M=_[E.source];(E.type==="custom"||M.length)&&this.renderLayer(this,u[E.source],E,M)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?a.Color.black:a.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!p)for(this.renderPass="opaque",this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){const v=this.style._layers[s[this.currentLayer]],E=u[v.source],M=f[v.source];this._renderTileClippingMasks(v,M),this.renderLayer(this,E,v,M)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){const v=this.style._layers[s[this.currentLayer]],E=u[v.source];if(p&&p.renderLayer(v))continue;const M=(v.type==="symbol"?y:_)[v.source];this._renderTileClippingMasks(v,f[v.source]),this.renderLayer(this,E,v,M)}if(this.options.showTileBoundaries){let v,E;Object.values(this.style._layers).forEach(M=>{M.source&&!M.isHidden(this.transform.zoom)&&(M.source!==(E&&E.id)&&(E=this.style.sourceCaches[M.source]),(!v||v.getSource().maxzoom<E.getSource().maxzoom)&&(v=E))}),v&&ao.debug(this,v,v.getVisibleCoordinates())}this.options.showPadding&&function(v){const E=v.transform.padding;nn(v,v.transform.height-(E.top||0),3,No),nn(v,E.bottom||0,3,rr),so(v,E.left||0,3,Ma),so(v,v.transform.width-(E.right||0),3,Is);const M=v.transform.centerPoint;(function(z,V,$,U){Dn(z,V-1,$-10,2,20,U),Dn(z,V-10,$-1,20,2,U)})(v,M.x,v.transform.height-M.y,Pa)}(this),this.context.setDefault()}renderLayer(t,n,s,u){s.isHidden(this.transform.zoom)||(s.type==="background"||s.type==="custom"||(u||[]).length)&&(this.id=s.id,this.gpuTimingStart(s),ao[s.type](t,n,s,u,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const n=this.context.extTimerQuery;let s=this.gpuTimers[t.id];s||(s=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:n.createQueryEXT()}),s.calls++,n.beginQueryEXT(n.TIME_ELAPSED_EXT,s.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}queryGpuTimers(t){const n={};for(const s in t){const u=t[s],p=this.context.extTimerQuery,f=p.getQueryObjectEXT(u.query,p.QUERY_RESULT_EXT)/1e6;p.deleteQueryEXT(u.query),n[s]=f}return n}translatePosMatrix(t,n,s,u,p){if(!s[0]&&!s[1])return t;const f=p?u==="map"?this.transform.angle:0:u==="viewport"?-this.transform.angle:0;if(f){const v=Math.sin(f),E=Math.cos(f);s=[s[0]*E-s[1]*v,s[0]*v+s[1]*E]}const _=[p?s[0]:Jt(n,s[0],this.transform.zoom),p?s[1]:Jt(n,s[1],this.transform.zoom),0],y=new Float32Array(16);return a.translate(y,t,_),y}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):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()),s=this.imageManager.getPattern(t.to.toString());return!n||!s}useProgram(t,n){this.cache=this.cache||{};const s=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.terrain?"/terrain":"");return this.cache[s]||(this.cache[s]=new ha(this.context,t,Kn[t],n,ds[t],this._showOverdrawInspector,this.style.terrain)),this.cache[s]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Ue(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class qo{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,s){const u=Math.pow(2,s),p=[[-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(_=>{const y=1/(_=a.transformMat4([],_,t))[3]/n*u;return a.mul$1(_,_,[y,y,1/_[3],y])}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const y=a.sub([],p[_[0]],p[_[1]]),v=a.sub([],p[_[2]],p[_[1]]),E=a.normalize([],a.cross([],y,v)),M=-a.dot(E,p[_[1]]);return E.concat(M)});return new qo(p,f)}}class lo{constructor(t,n){this.min=t,this.max=n,this.center=a.scale$1([],a.add([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],s=a.clone$2(this.min),u=a.clone$2(this.max);for(let p=0;p<n.length;p++)s[p]=n[p]?this.min[p]:this.center[p],u[p]=n[p]?this.center[p]:this.max[p];return u[2]=this.max[2],new lo(s,u)}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]}intersects(t){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let s=!0;for(let u=0;u<t.planes.length;u++){const p=t.planes[u];let f=0;for(let _=0;_<n.length;_++)a.dot$1(p,n[_])>=0&&f++;if(f===0)return 0;f!==n.length&&(s=!1)}if(s)return 2;for(let u=0;u<3;u++){let p=Number.MAX_VALUE,f=-Number.MAX_VALUE;for(let _=0;_<t.points.length;_++){const y=t.points[_][u]-this.min[u];p=Math.min(p,y),f=Math.max(f,y)}if(f<0||p>this.max[u]-this.min[u])return 0}return 1}}class Ln{constructor(t=0,n=0,s=0,u=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(s)||s<0||isNaN(u)||u<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=s,this.right=u}interpolate(t,n,s){return n.top!=null&&t.top!=null&&(this.top=a.number(t.top,n.top,s)),n.bottom!=null&&t.bottom!=null&&(this.bottom=a.number(t.bottom,n.bottom,s)),n.left!=null&&t.left!=null&&(this.left=a.number(t.left,n.left,s)),n.right!=null&&t.right!=null&&(this.right=a.number(t.right,n.right,s)),this}getCenter(t,n){const s=a.clamp((this.left+t-this.right)/2,0,t),u=a.clamp((this.top+n-this.bottom)/2,0,n);return new a.pointGeometry(s,u)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Ln(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class co{constructor(t,n,s,u,p){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=p===void 0||!!p,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=s==null?0:s,this._maxPitch=u==null?60:u,this.setMaxBounds(),this.width=0,this.height=0,this._center=new a.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Ln,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new co(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t._elevation=this._elevation,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-a.wrap(t,-180,180)*Math.PI/180;var s;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(s=new a.ARRAY_TYPE(4),a.ARRAY_TYPE!=Float32Array&&(s[1]=0,s[2]=0),s[0]=1,s[3]=1,s),function(u,p,f){var _=p[0],y=p[1],v=p[2],E=p[3],M=Math.sin(f),z=Math.cos(f);u[0]=_*z+v*M,u[1]=y*z+E*M,u[2]=_*-M+v*z,u[3]=y*-M+E*z}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=a.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.scale=this.zoomScale(n),this.tileZoom=Math.floor(n),this.zoomFraction=n-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(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)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,s){this._unmodified=!1,this._edgeInsets.interpolate(t,n,s),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new a.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const s=this.pointCoordinate(new a.pointGeometry(0,0)),u=this.pointCoordinate(new a.pointGeometry(this.width,0)),p=this.pointCoordinate(new a.pointGeometry(this.width,this.height)),f=this.pointCoordinate(new a.pointGeometry(0,this.height)),_=Math.floor(Math.min(s.x,u.x,p.x,f.x)),y=Math.floor(Math.max(s.x,u.x,p.x,f.x)),v=1;for(let E=_-v;E<=y+v;E++)E!==0&&n.push(new a.UnwrappedTileID(E,t))}return n}coveringTiles(t){var n,s;let u=this.coveringZoomLevel(t);const p=u;if(t.minzoom!==void 0&&u<t.minzoom)return[];t.maxzoom!==void 0&&u>t.maxzoom&&(u=t.maxzoom);const f=this.pointCoordinate(this.getCameraPoint()),_=a.MercatorCoordinate.fromLngLat(this.center),y=Math.pow(2,u),v=[y*f.x,y*f.y,0],E=[y*_.x,y*_.y,0],M=qo.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,u);let z=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(z=u);const V=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,$=G=>({aabb:new lo([G*y,0,0],[(G+1)*y,y,0]),zoom:0,x:0,y:0,wrap:G,fullyVisible:!1}),U=[],H=[],Q=u,ne=t.reparseOverscaled?p:u;if(this._renderWorldCopies)for(let G=1;G<=3;G++)U.push($(-G)),U.push($(G));for(U.push($(0));U.length>0;){const G=U.pop(),le=G.x,se=G.y;let me=G.fullyVisible;if(!me){const Be=G.aabb.intersects(M);if(Be===0)continue;me=Be===2}const ge=t.terrain?v:E,be=G.aabb.distanceX(ge),de=G.aabb.distanceY(ge),Re=Math.max(Math.abs(be),Math.abs(de)),Ce=V+(1<<Q-G.zoom)-2;if(G.zoom===Q||Re>Ce&&G.zoom>=z){const Be=Q-G.zoom,st=v[0]-.5-(le<<Be),ht=v[1]-.5-(se<<Be);H.push({tileID:new a.OverscaledTileID(G.zoom===Q?ne:G.zoom,G.wrap,G.zoom,le,se),distanceSq:a.sqrLen([E[0]-.5-le,E[1]-.5-se]),tileDistanceToCamera:Math.sqrt(st*st+ht*ht)})}else for(let Be=0;Be<4;Be++){const st=(le<<1)+Be%2,ht=(se<<1)+(Be>>1),We=G.zoom+1;let At=G.aabb.quadrant(Be);if(t.terrain){const Mt=new a.OverscaledTileID(We,G.wrap,We,st,ht),_t=t.terrain.getMinMaxElevation(Mt),wt=(n=_t.minElevation)!==null&&n!==void 0?n:this.elevation,zt=(s=_t.maxElevation)!==null&&s!==void 0?s:this.elevation;At=new lo([At.min[0],At.min[1],wt],[At.max[0],At.max[1],zt])}U.push({aabb:At,zoom:We,x:st,y:ht,wrap:G.wrap,fullyVisible:me})}}return H.sort((G,le)=>G.distanceSq-le.distanceSq).map(G=>G.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=a.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new a.pointGeometry(a.mercatorXfromLng(t.lng)*this.worldSize,a.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new a.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0)}getElevation(t,n){const s=a.MercatorCoordinate.fromLngLat(t),u=(1<<this.tileZoom)*a.EXTENT,p=s.x*u,f=s.y*u,_=Math.floor(p/a.EXTENT),y=Math.floor(f/a.EXTENT),v=new a.OverscaledTileID(this.tileZoom,0,this.tileZoom,_,y);return n.getElevation(v,p%a.EXTENT,f%a.EXTENT,a.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.pointLocation(this.centerPoint,t),s=this.getElevation(n,t);if(!(this.elevation-s))return;const u=this.getCameraPosition(),p=a.MercatorCoordinate.fromLngLat(u.lngLat,u.altitude),f=a.MercatorCoordinate.fromLngLat(n,s),_=p.x-f.x,y=p.y-f.y,v=p.z-f.z,E=Math.sqrt(_*_+y*y+v*v),M=this.scaleZoom(this.cameraToCenterDistance/E/this.tileSize);this._elevation=s,this._center=n,this.zoom=M}setLocationAtPoint(t,n){const s=this.pointCoordinate(n),u=this.pointCoordinate(this.centerPoint),p=this.locationCoordinate(t),f=new a.MercatorCoordinate(p.x-(s.x-u.x),p.y-(s.y-u.y));this.center=this.coordinateLocation(f),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),this.getElevation(t,n),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return a.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const z=n.pointCoordinate(t);if(z!=null)return z}const s=[t.x,t.y,0,1],u=[t.x,t.y,1,1];a.transformMat4(s,s,this.pixelMatrixInverse),a.transformMat4(u,u,this.pixelMatrixInverse);const p=s[3],f=u[3],_=s[1]/p,y=u[1]/f,v=s[2]/p,E=u[2]/f,M=v===E?0:(0-v)/(E-v);return new a.MercatorCoordinate(a.number(s[0]/p,u[0]/f,M)/this.worldSize,a.number(_,y,M)/this.worldSize)}coordinatePoint(t,n=0,s=this.pixelMatrix){const u=[t.x*this.worldSize,t.y*this.worldSize,n,1];return a.transformMat4(u,u,s),new a.pointGeometry(u[0]/u[3],u[1]/u[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new a.LngLatBounds().extend(this.pointLocation(new a.pointGeometry(0,t))).extend(this.pointLocation(new a.pointGeometry(this.width,t))).extend(this.pointLocation(new a.pointGeometry(this.width,this.height))).extend(this.pointLocation(new a.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new a.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const s=t.key,u=n?this._alignedPosMatrixCache:this._posMatrixCache;if(u[s])return u[s];const p=t.canonical,f=this.worldSize/this.zoomScale(p.z),_=p.x+Math.pow(2,p.z)*t.wrap,y=a.identity(new Float64Array(16));return a.translate(y,y,[_*f,p.y*f,0]),a.scale(y,y,[f/a.EXTENT,f/a.EXTENT,1]),a.multiply(y,n?this.alignedProjMatrix:this.projMatrix,y),u[s]=new Float32Array(y),u[s]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,s,u,p=-90,f=90,_=-180,y=180;const v=this.size,E=this._unmodified;if(this.latRange){const V=this.latRange;p=a.mercatorYfromLat(V[1])*this.worldSize,f=a.mercatorYfromLat(V[0])*this.worldSize,t=f-p<v.y?v.y/(f-p):0}if(this.lngRange){const V=this.lngRange;_=a.wrap(a.mercatorXfromLng(V[0])*this.worldSize,0,this.worldSize),y=a.wrap(a.mercatorXfromLng(V[1])*this.worldSize,0,this.worldSize),y<_&&(y+=this.worldSize),n=y-_<v.x?v.x/(y-_):0}const M=this.point,z=Math.max(n||0,t||0);if(z)return this.center=this.unproject(new a.pointGeometry(n?(y+_)/2:M.x,t?(f+p)/2:M.y)),this.zoom+=this.scaleZoom(z),this._unmodified=E,void(this._constraining=!1);if(this.latRange){const V=M.y,$=v.y/2;V-$<p&&(u=p+$),V+$>f&&(u=f-$)}if(this.lngRange){const V=(_+y)/2,$=a.wrap(M.x,V-this.worldSize/2,V+this.worldSize/2),U=v.x/2;$-U<_&&(s=_+U),$+U>y&&(s=y-U)}s===void 0&&u===void 0||(this.center=this.unproject(new a.pointGeometry(s!==void 0?s:M.x,u!==void 0?u:M.y)).wrap()),this._unmodified=E,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,s=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=a.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let u=a.identity(new Float64Array(16));a.scale(u,u,[this.width/2,-this.height/2,1]),a.translate(u,u,[1,-1,0]),this.labelPlaneMatrix=u,u=a.identity(new Float64Array(16)),a.scale(u,u,[1,-1,1]),a.translate(u,u,[-1,-1,0]),a.scale(u,u,[2/this.width,2/this.height,1]),this.glCoordMatrix=u,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const p=Math.PI/2+this._pitch,f=this._fov*(.5+t.y/this.height),_=Math.sin(f)*this.cameraToSeaLevelDistance/Math.sin(a.clamp(Math.PI-p-f,.01,Math.PI-.01)),y=this.getHorizon(),v=2*Math.atan(y/this.cameraToCenterDistance)*(.5+t.y/(2*y)),E=Math.sin(v)*this.cameraToSeaLevelDistance/Math.sin(a.clamp(Math.PI-p-v,.01,Math.PI-.01)),M=Math.cos(Math.PI/2-this._pitch)*_+this.cameraToSeaLevelDistance,z=Math.cos(Math.PI/2-this._pitch)*E+this.cameraToSeaLevelDistance,V=1.01*Math.min(M,z),$=this.height/50;u=new Float64Array(16),a.perspective(u,this._fov,this.width/this.height,$,V),u[8]=2*-t.x/this.width,u[9]=2*t.y/this.height,a.scale(u,u,[1,-1,1]),a.translate(u,u,[0,0,-this.cameraToCenterDistance]),a.rotateX(u,u,this._pitch),a.rotateZ(u,u,this.angle),a.translate(u,u,[-n,-s,0]),this.mercatorMatrix=a.scale([],u,[this.worldSize,this.worldSize,this.worldSize]),a.scale(u,u,[1,1,this._pixelPerMeter]),this.pixelMatrix=a.multiply(new Float64Array(16),this.labelPlaneMatrix,u),a.translate(u,u,[0,0,-this.elevation]),this.projMatrix=u,this.invProjMatrix=a.invert([],u),this.pixelMatrix3D=a.multiply(new Float64Array(16),this.labelPlaneMatrix,u);const U=this.width%2/2,H=this.height%2/2,Q=Math.cos(this.angle),ne=Math.sin(this.angle),G=n-Math.round(n)+Q*U+ne*H,le=s-Math.round(s)+Q*H+ne*U,se=new Float64Array(u);if(a.translate(se,se,[G>.5?G-1:G,le>.5?le-1:le,0]),this.alignedProjMatrix=se,u=a.invert(new Float64Array(16),this.pixelMatrix),!u)throw new Error("failed to invert matrix");this.pixelMatrixInverse=u,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new a.pointGeometry(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return a.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.pointGeometry(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let s=n.x,u=n.y,p=n.x,f=n.y;for(const _ of t)s=Math.min(s,_.x),u=Math.min(u,_.y),p=Math.max(p,_.x),f=Math.max(f,_.y);return[new a.pointGeometry(s,u),new a.pointGeometry(p,u),new a.pointGeometry(p,f),new a.pointGeometry(s,f),new a.pointGeometry(s,u)]}}}class Da{constructor(t){this._hashName=t&&encodeURIComponent(t),a.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(n,s){let u=!1,p=null;const f=()=>{p=null,u&&(n(),p=setTimeout(f,300),u=!1)};return()=>(u=!0,p||f(),p)}(this._updateHashUnthrottled.bind(this))}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()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,u=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,u),f=Math.round(n.lng*p)/p,_=Math.round(n.lat*p)/p,y=this._map.getBearing(),v=this._map.getPitch();let E="";if(E+=t?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(y||v)&&(E+="/"+Math.round(10*y)/10),v&&(E+=`/${Math.round(v)}`),this._hashName){const M=this._hashName;let z=!1;const V=window.location.hash.slice(1).split("&").map($=>{const U=$.split("=")[0];return U===M?(z=!0,`${U}=${E}`):$}).filter($=>$);return z||V.push(`${M}=${E}`),`#${V.join("&")}`}return`#${E}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(s=>s.split("=")).forEach(s=>{s[0]===this._hashName&&(n=s)}),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(n=>isNaN(n))){const n=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:n,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch{}}}const uo={linearity:.3,easing:a.bezier(0,0,.3,1)},La=a.extend({deceleration:2500,maxSpeed:1400},uo),Ra=a.extend({deceleration:20,maxSpeed:1400},uo),Ba=a.extend({deceleration:1e3,maxSpeed:360},uo),Rn=a.extend({deceleration:1e3,maxSpeed:90},uo);class Fa{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=a.exported.now();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,pan:new a.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)n.zoom+=p.zoomDelta||0,n.bearing+=p.bearingDelta||0,n.pitch+=p.pitchDelta||0,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,u={};if(n.pan.mag()){const p=po(n.pan.mag(),s,a.extend({},La,t||{}));u.offset=n.pan.mult(p.amount/n.pan.mag()),u.center=this._map.transform.center,ho(u,p)}if(n.zoom){const p=po(n.zoom,s,Ra);u.zoom=this._map.transform.zoom+p.amount,ho(u,p)}if(n.bearing){const p=po(n.bearing,s,Ba);u.bearing=this._map.transform.bearing+a.clamp(p.amount,-179,179),ho(u,p)}if(n.pitch){const p=po(n.pitch,s,Rn);u.pitch=this._map.transform.pitch+p.amount,ho(u,p)}if(u.zoom||u.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;u.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),a.extend(u,{noMoveStart:!0})}}function ho(l,t){(!l.duration||l.duration<t.duration)&&(l.duration=t.duration,l.easing=t.easing)}function po(l,t,n){const{maxSpeed:s,linearity:u,deceleration:p}=n,f=a.clamp(l*u/(t/1e3),-s,s),_=Math.abs(f)/(p*u);return{easing:n.easing,duration:1e3*_,amount:f*(_/2)}}class Vi extends a.Event{constructor(t,n,s,u={}){const p=ie.mousePos(n.getCanvasContainer(),s),f=n.unproject(p);super(t,a.extend({point:p,lngLat:f,originalEvent:s},u)),this._defaultPrevented=!1,this.target=n}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class fo extends a.Event{constructor(t,n,s){const u=t==="touchend"?s.changedTouches:s.touches,p=ie.touchPos(n.getCanvasContainer(),u),f=p.map(y=>n.unproject(y)),_=p.reduce((y,v,E,M)=>y.add(v.div(M.length)),new a.pointGeometry(0,0));super(t,{points:p,point:_,lngLats:f,lngLat:n.unproject(_),originalEvent:s}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Ni extends a.Event{constructor(t,n,s){super(t,{originalEvent:s}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class ql{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Ni(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Vi(t.type,this._map,t))}mouseup(t){this._map.fire(new Vi(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Vi(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Vi(t.type,this._map,t))}mouseover(t){this._map.fire(new Vi(t.type,this._map,t))}mouseout(t){this._map.fire(new Vi(t.type,this._map,t))}touchstart(t){return this._firePreventable(new fo(t.type,this._map,t))}touchmove(t){this._map.fire(new fo(t.type,this._map,t))}touchend(t){this._map.fire(new fo(t.type,this._map,t))}touchcancel(t){this._map.fire(new fo(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vr{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Vi(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Vi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Vi(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Oa{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}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&&(ie.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const s=n;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const u=this._startPos;this._lastPos=s,this._box||(this._box=ie.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const p=Math.min(u.x,s.x),f=Math.max(u.x,s.x),_=Math.min(u.y,s.y),y=Math.max(u.y,s.y);ie.setTransform(this._box,`translate(${p}px,${_}px)`),this._box.style.width=f-p+"px",this._box.style.height=y-_+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const s=this._startPos,u=n;if(this.reset(),ie.suppressClick(),s.x!==u.x||s.y!==u.y)return this._map.fire(new a.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(s,u,this._map.getBearing(),{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","mapboxgl-crosshair"),this._box&&(ie.remove(this._box),this._box=null),ie.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new a.Event(t,{originalEvent:n}))}}function Ir(l,t){if(l.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${l.length}, points ${t.length}`);const n={};for(let s=0;s<l.length;s++)n[l[s].identifier]=t[s];return n}class mo{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),s.length===this.numTouches&&(this.centroid=function(u){const p=new a.pointGeometry(0,0);for(const f of u)p._add(f);return p.div(u.length)}(n),this.touches=Ir(s,n)))}touchmove(t,n,s){if(this.aborted||!this.centroid)return;const u=Ir(s,n);for(const p in this.touches){const f=this.touches[p],_=u[p];(!_||_.dist(f)>30)&&(this.aborted=!0)}}touchend(t,n,s){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const u=!this.aborted&&this.centroid;if(this.reset(),u)return u}}}class As{constructor(t){this.singleTap=new mo(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,s){this.singleTap.touchstart(t,n,s)}touchmove(t,n,s){this.singleTap.touchmove(t,n,s)}touchend(t,n,s){const u=this.singleTap.touchend(t,n,s);if(u){const p=t.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(u)<30;if(p&&f||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=u,this.count===this.numTaps)return this.reset(),u}}}class Zl{constructor(){this._zoomIn=new As({numTouches:1,numTaps:2}),this._zoomOut=new As({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,s){this._zoomIn.touchstart(t,n,s),this._zoomOut.touchstart(t,n,s)}touchmove(t,n,s){this._zoomIn.touchmove(t,n,s),this._zoomOut.touchmove(t,n,s)}touchend(t,n,s){const u=this._zoomIn.touchend(t,n,s),p=this._zoomOut.touchend(t,n,s);return u?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:f=>f.easeTo({duration:300,zoom:f.getZoom()+1,around:f.unproject(u)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:f=>f.easeTo({duration:300,zoom:f.getZoom()-1,around:f.unproject(p)},{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}}const jl={0:1,2:2};class Zo{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(t,n){return!1}_move(t,n){return{}}mousedown(t,n){if(this._lastPoint)return;const s=ie.mouseButton(t);this._correctButton(t,s)&&(this._lastPoint=n,this._eventButton=s)}mousemoveWindow(t,n){const s=this._lastPoint;if(s){if(t.preventDefault(),function(u,p){const f=jl[p];return u.buttons===void 0||(u.buttons&f)!==f}(t,this._eventButton))this.reset();else if(this._moved||!(n.dist(s)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(s,n)}}mouseupWindow(t){this._lastPoint&&ie.mouseButton(t)===this._eventButton&&(this._moved&&ie.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class go extends Zo{mousedown(t,n){super.mousedown(t,n),this._lastPoint&&(this._active=!0)}_correctButton(t,n){return n===0&&!t.ctrlKey}_move(t,n){return{around:n,panDelta:n.sub(t)}}}class Cr extends Zo{_correctButton(t,n){return n===0&&t.ctrlKey||n===2}_move(t,n){const s=.8*(n.x-t.x);if(s)return this._active=!0,{bearingDelta:s}}contextmenu(t){t.preventDefault()}}class Oe extends Zo{_correctButton(t,n){return n===0&&t.ctrlKey||n===2}_move(t,n){const s=-.5*(n.y-t.y);if(s)return this._active=!0,{pitchDelta:s}}contextmenu(t){t.preventDefault()}}class $a{constructor(t,n){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new a.pointGeometry(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,s){return this._calculateTransform(t,n,s)}touchmove(t,n,s){if(this._map._cooperativeGestures&&(this._minTouches===2&&s.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,s.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(s.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,n,s)}touchend(t,n,s){this._calculateTransform(t,n,s),this._active&&s.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,s){s.length>0&&(this._active=!0);const u=Ir(s,n),p=new a.pointGeometry(0,0),f=new a.pointGeometry(0,0);let _=0;for(const v in u){const E=u[v],M=this._touches[v];M&&(p._add(E),f._add(E.sub(M)),_++,u[v]=E)}if(this._touches=u,_<this._minTouches||!f.mag())return;const y=f.div(_);return this._sum._add(y),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(_),panDelta:y}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class on{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(t){}_move(t,n,s){return{}}touchstart(t,n,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,s){if(!this._firstTwoTouches)return;t.preventDefault();const[u,p]=this._firstTwoTouches,f=Nr(s,n,u),_=Nr(s,n,p);if(!f||!_)return;const y=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],y,t)}touchend(t,n,s){if(!this._firstTwoTouches)return;const[u,p]=this._firstTwoTouches,f=Nr(s,n,u),_=Nr(s,n,p);f&&_||(this._active&&ie.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 Nr(l,t,n){for(let s=0;s<l.length;s++)if(l[s].identifier===n)return t[s]}function Ms(l,t){return Math.log(l/t)/Math.LN2}class ze extends on{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const s=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Ms(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Ms(this._distance,s),pinchAround:n}}}function jo(l,t){return 180*l.angleWith(t)/Math.PI}class Xl extends on{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){const s=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:jo(this._vector,s),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,s=jo(t,this._startVector);return Math.abs(s)<n}}function Ps(l){return Math.abs(l.y)>Math.abs(l.x)}class zs extends on{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,s){super.touchstart(t,n,s),this._currentTouchCount=s.length}_start(t){this._lastPoints=t,Ps(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,s){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const u=t[0].sub(this._lastPoints[0]),p=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(u,p,s.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(u.y+p.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,s){if(this._valid!==void 0)return this._valid;const u=t.mag()>=2,p=n.mag()>=2;if(!u&&!p)return;if(!u||!p)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const f=t.y>0==n.y>0;return Ps(t)&&Ps(n)&&f}}const Ua={panStep:100,bearingStep:15,pitchStep:10};class Va{constructor(){const t=Ua;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,s=0,u=0,p=0,f=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?s=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?s=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?u=1:(t.preventDefault(),f=-1);break;case 40:t.shiftKey?u=-1:(t.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,u=0),{cameraAnimation:_=>{const y=_.getZoom();_.easeTo({duration:300,easeId:"keyboardHandler",easing:Wl,zoom:n?Math.round(y)+n*(t.shiftKey?2:1):y,bearing:_.getBearing()+s*this._bearingStep,pitch:_.getPitch()+u*this._pitchStep,offset:[-p*this._panStep,-f*this._panStep],center:_.getCenter()},{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 Wl(l){return l*(2-l)}const Na=4.000244140625;class ks{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,a.bindAll(["_onTimeout"],this)}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)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const s=a.exported.now(),u=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,n!==0&&n%Na==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":u>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(u*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()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=ie.mousePos(this._el,t);this._around=a.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>Na?this._wheelZoomRate:this._defaultZoomRate;let y=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&y!==0&&(y=1/y);const v=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(v*y))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,s=this._startZoom,u=this._easing;let p,f=!1;if(this._type==="wheel"&&s&&u){const _=Math.min((a.exported.now()-this._lastWheelEventTime)/200,1),y=u(_);p=a.number(s,n,y),_<1?this._frameId||(this._frameId=!0):f=!0}else p=n,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!f,zoomDelta:p-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=a.ease;if(this._prevEase){const s=this._prevEase,u=(a.exported.now()-s.start)/s.duration,p=s.easing(u+.01)-s.easing(u),f=.27/Math.sqrt(p*p+1e-4)*.01,_=Math.sqrt(.0729-f*f);n=a.bezier(f,_,.25,1)}return this._prevEase={start:a.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class Ds{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 Ls{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:s.getZoom()+(t.shiftKey?-1:1),around:s.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Rs{constructor(){this._tap=new As({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,n,s){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?s.length>0&&(this._swipePoint=n[0],this._swipeTouch=s[0].identifier):this._tap.touchstart(t,n,s))}touchmove(t,n,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const u=n[0],p=u.y-this._swipePoint.y;return this._swipePoint=u,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,n,s)}touchend(t,n,s){this._tapTime?this._swipePoint&&s.length===0&&this.reset():this._tap.touchend(t,n,s)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Pi{constructor(t,n,s){this._el=t,this._mousePan=n,this._touchPan=s}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Gr{constructor(t,n,s){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=s}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Ga{constructor(t,n,s,u){this._el=t,this._touchZoom=n,this._touchRotate=s,this._tapDragZoom=u,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","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Bn=l=>l.zoom||l.drag||l.pitch||l.rotate;class Bs extends a.Event{}function _o(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}class qa{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Fa(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),a.bindAll(["handleEvent","handleWindowEvent"],this);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[u,p,f]of this._listeners)ie.addEventListener(u,p,u===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[t,n,s]of this._listeners)ie.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(t){const n=this._map,s=n.getCanvasContainer();this._add("mapEvent",new ql(n,t));const u=n.boxZoom=new Oa(n,t);this._add("boxZoom",u);const p=new Zl,f=new Ls;n.doubleClickZoom=new Ds(f,p),this._add("tapZoom",p),this._add("clickZoom",f);const _=new Rs;this._add("tapDragZoom",_);const y=n.touchPitch=new zs(n);this._add("touchPitch",y);const v=new Cr(t),E=new Oe(t);n.dragRotate=new Gr(t,v,E),this._add("mouseRotate",v,["mousePitch"]),this._add("mousePitch",E,["mouseRotate"]);const M=new go(t),z=new $a(t,n);n.dragPan=new Pi(s,M,z),this._add("mousePan",M),this._add("touchPan",z,["touchZoom","touchRotate"]);const V=new Xl,$=new ze;n.touchZoomRotate=new Ga(s,$,V,_),this._add("touchRotate",V,["touchPan","touchZoom"]),this._add("touchZoom",$,["touchPan","touchRotate"]);const U=n.scrollZoom=new ks(n,this);this._add("scrollZoom",U,["mousePan"]);const H=n.keyboard=new Va;this._add("keyboard",H),this._add("blockableMapEvent",new Vr(n));for(const Q of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[Q]&&n[Q].enable(t[Q])}_add(t,n,s){this._handlers.push({handlerName:t,handler:n,allowed:s}),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 Boolean(Bn(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,n,s){for(const u in t)if(u!==s&&(!n||n.indexOf(u)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const s of t)this._el.contains(s.target)&&n.push(s);return n}handleEvent(t,n){if(t.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const s=t.type==="renderFrame"?void 0:t,u={needsRenderFrame:!1},p={},f={},_=t.touches,y=_?this._getMapTouches(_):void 0,v=y?ie.touchPos(this._el,y):ie.mousePos(this._el,t);for(const{handlerName:z,handler:V,allowed:$}of this._handlers){if(!V.isEnabled())continue;let U;this._blockedByActive(f,$,z)?V.reset():V[n||t.type]&&(U=V[n||t.type](t,v,y),this.mergeHandlerResult(u,p,U,z,s),U&&U.needsRenderFrame&&this._triggerRenderFrame()),(U||V.isActive())&&(f[z]=V)}const E={};for(const z in this._previousActiveHandlers)f[z]||(E[z]=s);this._previousActiveHandlers=f,(Object.keys(E).length||_o(u))&&(this._changes.push([u,p,E]),this._triggerRenderFrame()),(Object.keys(f).length||_o(u))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:M}=u;M&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],M(this._map))}mergeHandlerResult(t,n,s,u,p){if(!s)return;a.extend(t,s);const f={handlerName:u,originalEvent:s.originalEvent||p};s.zoomDelta!==void 0&&(n.zoom=f),s.panDelta!==void 0&&(n.drag=f),s.pitchDelta!==void 0&&(n.pitch=f),s.bearingDelta!==void 0&&(n.rotate=f)}_applyChanges(){const t={},n={},s={};for(const[u,p,f]of this._changes)u.panDelta&&(t.panDelta=(t.panDelta||new a.pointGeometry(0,0))._add(u.panDelta)),u.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+u.zoomDelta),u.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+u.bearingDelta),u.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+u.pitchDelta),u.around!==void 0&&(t.around=u.around),u.pinchAround!==void 0&&(t.pinchAround=u.pinchAround),u.noInertia&&(t.noInertia=u.noInertia),a.extend(n,p),a.extend(s,f);this._updateMapTransform(t,n,s),this._changes=[]}_updateMapTransform(t,n,s){const u=this._map,p=u.transform,f=u.style&&u.style.terrain;if(!(_o(t)||f&&this._drag))return this._fireEvents(n,s,!0);let{panDelta:_,zoomDelta:y,bearingDelta:v,pitchDelta:E,around:M,pinchAround:z}=t;z!==void 0&&(M=z),u._stop(!0),M=M||u.transform.centerPoint;const V=p.pointLocation(_?M.sub(_):M);v&&(p.bearing+=v),E&&(p.pitch+=E),y&&(p.zoom+=y),f?n.drag&&!this._drag?(this._drag={center:p.centerPoint,lngLat:p.pointLocation(M),point:M,handlerName:n.drag.handlerName},u.fire(new a.Event("freezeElevation",{freeze:!0}))):this._drag&&s[this._drag.handlerName]?(u.fire(new a.Event("freezeElevation",{freeze:!1})),this._drag=null):n.drag&&this._drag&&(p.center=p.pointLocation(p.centerPoint.sub(_))):p.setLocationAtPoint(V,M),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,s,!0)}_fireEvents(t,n,s){const u=Bn(this._eventsInProgress),p=Bn(t),f={};for(const E in t){const{originalEvent:M}=t[E];this._eventsInProgress[E]||(f[`${E}start`]=M),this._eventsInProgress[E]=t[E]}!u&&p&&this._fireEvent("movestart",p.originalEvent);for(const E in f)this._fireEvent(E,f[E]);p&&this._fireEvent("move",p.originalEvent);for(const E in t){const{originalEvent:M}=t[E];this._fireEvent(E,M)}const _={};let y;for(const E in this._eventsInProgress){const{handlerName:M,originalEvent:z}=this._eventsInProgress[E];this._handlersById[M].isActive()||(delete this._eventsInProgress[E],y=n[M]||z,_[`${E}end`]=y)}for(const E in _)this._fireEvent(E,_[E]);const v=Bn(this._eventsInProgress);if(s&&(u||p)&&!v){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),M=z=>z!==0&&-this._bearingSnap<z&&z<this._bearingSnap;E?(M(E.bearing||this._map.getBearing())&&(E.bearing=0),this._map.easeTo(E,{originalEvent:y})):(this._map.fire(new a.Event("moveend",{originalEvent:y})),M(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new a.Event(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Bs("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Ji={extend:(l,...t)=>a.extend(l,...t),run(l){l()},logToElement(l,t=!1,n="log"){const s=window.document.getElementById(n);s&&(t&&(s.innerHTML=""),s.innerHTML+=`<br>${l}`)}};class Nt extends a.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,a.bindAll(["_renderFrameCallback"],this)}getCenter(){return new a.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,s){return t=a.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,a.extend({offset:t},n),s)}panTo(t,n,s){return this.easeTo(a.extend({center:t},n),s)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,s){return this.easeTo(a.extend({zoom:t},n),s)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}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,s){return this.easeTo(a.extend({bearing:t},n),s)}resetNorth(t,n){return this.rotateTo(0,a.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(a.extend({bearing:0,pitch: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}cameraForBounds(t,n){t=a.LngLatBounds.convert(t);const s=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),s,n)}_cameraForBoxAndBearing(t,n,s,u){const p={top:0,bottom:0,right:0,left:0};if(typeof(u=a.extend({padding:p,offset:[0,0],maxZoom:this.transform.maxZoom},u)).padding=="number"){const se=u.padding;u.padding={top:se,bottom:se,right:se,left:se}}u.padding=a.extend(p,u.padding);const f=this.transform,_=f.padding,y=f.project(a.LngLat.convert(t)),v=f.project(a.LngLat.convert(n)),E=y.rotate(-s*Math.PI/180),M=v.rotate(-s*Math.PI/180),z=new a.pointGeometry(Math.max(E.x,M.x),Math.max(E.y,M.y)),V=new a.pointGeometry(Math.min(E.x,M.x),Math.min(E.y,M.y)),$=z.sub(V),U=(f.width-(_.left+_.right+u.padding.left+u.padding.right))/$.x,H=(f.height-(_.top+_.bottom+u.padding.top+u.padding.bottom))/$.y;if(H<0||U<0)return void a.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const Q=Math.min(f.scaleZoom(f.scale*Math.min(U,H)),u.maxZoom),ne=a.pointGeometry.convert(u.offset),G=new a.pointGeometry((u.padding.left-u.padding.right)/2,(u.padding.top-u.padding.bottom)/2).rotate(s*Math.PI/180),le=ne.add(G).mult(f.scale/f.zoomScale(Q));return{center:f.unproject(y.add(v).div(2).sub(le)),zoom:Q,bearing:s}}fitBounds(t,n,s){return this._fitInternal(this.cameraForBounds(t,n),n,s)}fitScreenCoordinates(t,n,s,u,p){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(a.pointGeometry.convert(t)),this.transform.pointLocation(a.pointGeometry.convert(n)),s,u),u,p)}_fitInternal(t,n,s){return t?(delete(n=a.extend(t,n)).padding,n.linear?this.easeTo(n,s):this.flyTo(n,s)):this}jumpTo(t,n){this.stop();const s=this.transform;let u=!1,p=!1,f=!1;return"zoom"in t&&s.zoom!==+t.zoom&&(u=!0,s.zoom=+t.zoom),t.center!==void 0&&(s.center=a.LngLat.convert(t.center)),"bearing"in t&&s.bearing!==+t.bearing&&(p=!0,s.bearing=+t.bearing),"pitch"in t&&s.pitch!==+t.pitch&&(f=!0,s.pitch=+t.pitch),t.padding==null||s.isPaddingEqual(t.padding)||(s.padding=t.padding),this.fire(new a.Event("movestart",n)).fire(new a.Event("move",n)),u&&this.fire(new a.Event("zoomstart",n)).fire(new a.Event("zoom",n)).fire(new a.Event("zoomend",n)),p&&this.fire(new a.Event("rotatestart",n)).fire(new a.Event("rotate",n)).fire(new a.Event("rotateend",n)),f&&this.fire(new a.Event("pitchstart",n)).fire(new a.Event("pitch",n)).fire(new a.Event("pitchend",n)),this.fire(new a.Event("moveend",n))}calculateCameraOptionsFromTo(t,n,s,u=0){const p=a.MercatorCoordinate.fromLngLat(t,n),f=a.MercatorCoordinate.fromLngLat(s,u),_=f.x-p.x,y=f.y-p.y,v=f.z-p.z,E=Math.hypot(_,y,v);if(E===0)throw new Error("Can't calculate camera options with same From and To");const M=Math.hypot(_,y),z=this.transform.scaleZoom(this.transform.cameraToCenterDistance/E/this.transform.tileSize),V=180*Math.atan2(_,-y)/Math.PI;let $=180*Math.acos(M/E)/Math.PI;return $=v<0?90-$:90+$,{center:f.toLngLat(),zoom:z,pitch:$,bearing:V}}easeTo(t,n){this._stop(!1,t.easeId),((t=a.extend({offset:[0,0],duration:500,easing:a.ease},t)).animate===!1||!t.essential&&a.exported.prefersReducedMotion)&&(t.duration=0);const s=this.transform,u=this.getZoom(),p=this.getBearing(),f=this.getPitch(),_=this.getPadding(),y="zoom"in t?+t.zoom:u,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,E="pitch"in t?+t.pitch:f,M="padding"in t?t.padding:s.padding,z=a.pointGeometry.convert(t.offset);let V=s.centerPoint.add(z);const $=s.pointLocation(V),U=a.LngLat.convert(t.center||$);this._normalizeCenter(U);const H=s.project($),Q=s.project(U).sub(H),ne=s.zoomScale(y-u);let G,le;t.around&&(G=a.LngLat.convert(t.around),le=s.locationPoint(G));const se={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||y!==u,this._rotating=this._rotating||p!==v,this._pitching=this._pitching||E!==f,this._padding=!s.isPaddingEqual(M),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,se),this._ease(me=>{if(this._zooming&&(s.zoom=a.number(u,y,me)),this._rotating&&(s.bearing=a.number(p,v,me)),this._pitching&&(s.pitch=a.number(f,E,me)),this._padding&&(s.interpolatePadding(_,M,me),V=s.centerPoint.add(z)),G)s.setLocationAtPoint(G,le);else{const ge=s.zoomScale(s.zoom-u),be=y>u?Math.min(2,ne):Math.max(.5,ne),de=Math.pow(be,1-me),Re=s.unproject(H.add(Q.mult(me*de)).mult(ge));s.setLocationAtPoint(s.renderWorldCopies?Re.wrap():Re,V)}this._fireMoveEvents(n)},me=>{this._afterEase(n,me)},t),this}_prepareEase(t,n,s={}){this._moving=!0,this.fire(new a.Event("freezeElevation",{freeze:!0})),n||s.moving||this.fire(new a.Event("movestart",t)),this._zooming&&!s.zooming&&this.fire(new a.Event("zoomstart",t)),this._rotating&&!s.rotating&&this.fire(new a.Event("rotatestart",t)),this._pitching&&!s.pitching&&this.fire(new a.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new a.Event("move",t)),this._zooming&&this.fire(new a.Event("zoom",t)),this._rotating&&this.fire(new a.Event("rotate",t)),this._pitching&&this.fire(new a.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId,this.fire(new a.Event("freezeElevation",{freeze:!1}));const s=this._zooming,u=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,s&&this.fire(new a.Event("zoomend",t)),u&&this.fire(new a.Event("rotateend",t)),p&&this.fire(new a.Event("pitchend",t)),this.fire(new a.Event("moveend",t))}flyTo(t,n){if(!t.essential&&a.exported.prefersReducedMotion){const We=a.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(We,n)}this.stop(),t=a.extend({offset:[0,0],speed:1.2,curve:1.42,easing:a.ease},t);const s=this.transform,u=this.getZoom(),p=this.getBearing(),f=this.getPitch(),_=this.getPadding(),y="zoom"in t?a.clamp(+t.zoom,s.minZoom,s.maxZoom):u,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,E="pitch"in t?+t.pitch:f,M="padding"in t?t.padding:s.padding,z=s.zoomScale(y-u),V=a.pointGeometry.convert(t.offset);let $=s.centerPoint.add(V);const U=s.pointLocation($),H=a.LngLat.convert(t.center||U);this._normalizeCenter(H);const Q=s.project(U),ne=s.project(H).sub(Q);let G=t.curve;const le=Math.max(s.width,s.height),se=le/z,me=ne.mag();if("minZoom"in t){const We=a.clamp(Math.min(t.minZoom,u,y),s.minZoom,s.maxZoom),At=le/s.zoomScale(We-u);G=Math.sqrt(At/me*2)}const ge=G*G;function be(We){const At=(se*se-le*le+(We?-1:1)*ge*ge*me*me)/(2*(We?se:le)*ge*me);return Math.log(Math.sqrt(At*At+1)-At)}function de(We){return(Math.exp(We)-Math.exp(-We))/2}function Re(We){return(Math.exp(We)+Math.exp(-We))/2}const Ce=be(0);let Be=function(We){return Re(Ce)/Re(Ce+G*We)},st=function(We){return le*((Re(Ce)*(de(At=Ce+G*We)/Re(At))-de(Ce))/ge)/me;var At},ht=(be(1)-Ce)/G;if(Math.abs(me)<1e-6||!isFinite(ht)){if(Math.abs(le-se)<1e-6)return this.easeTo(t,n);const We=se<le?-1:1;ht=Math.abs(Math.log(se/le))/G,st=function(){return 0},Be=function(At){return Math.exp(We*G*At)}}return t.duration="duration"in t?+t.duration:1e3*ht/("screenSpeed"in t?+t.screenSpeed/G:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=p!==v,this._pitching=E!==f,this._padding=!s.isPaddingEqual(M),this._prepareEase(n,!1),this._ease(We=>{const At=We*ht,Mt=1/Be(At);s.zoom=We===1?y:u+s.scaleZoom(Mt),this._rotating&&(s.bearing=a.number(p,v,We)),this._pitching&&(s.pitch=a.number(f,E,We)),this._padding&&(s.interpolatePadding(_,M,We),$=s.centerPoint.add(V));const _t=We===1?H:s.unproject(Q.add(ne.mult(st(At))).mult(Mt));s.setLocationAtPoint(s.renderWorldCopies?_t.wrap():_t,$),this._fireMoveEvents(n)},()=>this._afterEase(n),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const s=this._onEaseEnd;delete this._onEaseEnd,s.call(this,n)}if(!t){const s=this.handlers;s&&s.stop(!1)}return this}_ease(t,n,s){s.animate===!1||s.duration===0?(t(1),n()):(this._easeStart=a.exported.now(),this._easeOptions=s,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((a.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=a.wrap(t,-180,180);const s=Math.abs(t-n);return Math.abs(t-360-n)<s&&(t-=360),Math.abs(t+360-n)<s&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(!n.renderWorldCopies||n.lngRange)return;const s=t.lng-n.center.lng;t.lng+=s>180?-360:s<-180?360:0}}class yo{constructor(t={}){this.options=t,a.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=ie.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=ie.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ie.create("div","maplibregl-ctrl-attrib-inner mapboxgl-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(){ie.remove(this._container),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 s=this._map._getUIString(`AttributionControl.${n}`);t.title=s,t.setAttribute("aria-label",s)}_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","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"&&t.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(u=>typeof u!="string"?"":u)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const u=this._map.style.stylesheet;this.styleOwner=u.owner,this.styleId=u.id}const n=this._map.style.sourceCaches;for(const u in n){const p=n[u];if(p.used||p.usedForTerrain){const f=p.getSource();f.attribution&&t.indexOf(f.attribution)<0&&t.push(f.attribution)}}t=t.filter(u=>String(u).trim()),t.sort((u,p)=>u.length-p.length),t=t.filter((u,p)=>{for(let f=p+1;f<t.length;f++)if(t[f].indexOf(u)>=0)return!1;return!0});const s=t.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,t.length?(this._innerContainer.innerHTML=s,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_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","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class Xo{constructor(t={}){this.options=t,a.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=ie.create("div","maplibregl-ctrl mapboxgl-ctrl");const n=ie.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){ie.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&n.classList.add("maplibregl-compact","mapboxgl-compact"):n.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class Za{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,s=n?this._queue.concat(n):this._queue;for(const u of s)if(u.id===t)return void(u.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 s of n)if(!s.cancelled&&(s.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const ja={"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":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"},Xa={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},Hl={showCompass:!0,showZoom:!0,visualizePitch:!1};class mr{constructor(t,n,s=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new Cr({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,s&&(this.mousePitch=new Oe({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),a.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),ie.addEventListener(n,"mousedown",this.mousedown),ie.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),ie.addEventListener(n,"touchmove",this.touchmove),ie.addEventListener(n,"touchend",this.touchend),ie.addEventListener(n,"touchcancel",this.reset)}down(t,n){this.mouseRotate.mousedown(t,n),this.mousePitch&&this.mousePitch.mousedown(t,n),ie.disableDrag()}move(t,n){const s=this.map,u=this.mouseRotate.mousemoveWindow(t,n);if(u&&u.bearingDelta&&s.setBearing(s.getBearing()+u.bearingDelta),this.mousePitch){const p=this.mousePitch.mousemoveWindow(t,n);p&&p.pitchDelta&&s.setPitch(s.getPitch()+p.pitchDelta)}}off(){const t=this.element;ie.removeEventListener(t,"mousedown",this.mousedown),ie.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),ie.removeEventListener(t,"touchmove",this.touchmove),ie.removeEventListener(t,"touchend",this.touchend),ie.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){ie.enableDrag(),ie.removeEventListener(window,"mousemove",this.mousemove),ie.removeEventListener(window,"mouseup",this.mouseup)}mousedown(t){this.down(a.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),ie.mousePos(this.element,t)),ie.addEventListener(window,"mousemove",this.mousemove),ie.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.move(t,ie.mousePos(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ie.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=ie.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function xo(l,t,n){if(l=new a.LngLat(l.lng,l.lat),t){const s=new a.LngLat(l.lng-360,l.lat),u=new a.LngLat(l.lng+360,l.lat),p=n.locationPoint(l).distSqr(t);n.locationPoint(s).distSqr(t)<p?l=s:n.locationPoint(u).distSqr(t)<p&&(l=u)}for(;Math.abs(l.lng-n.center.lng)>180;){const s=n.locationPoint(l);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;l.lng>n.center.lng?l.lng-=360:l.lng+=360}return l}const Ze={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 Ye(l,t,n){const s=l.classList;for(const u in Ze)s.remove(`maplibregl-${n}-anchor-${u}`,`mapboxgl-${n}-anchor-${u}`);s.add(`maplibregl-${n}-anchor-${t}`,`mapboxgl-${n}-anchor-${t}`)}class Fn extends a.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=a.extend({element:t},n)),a.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=a.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=ie.create("div"),this._element.setAttribute("aria-label","Map marker");const s=ie.createNS("http://www.w3.org/2000/svg","svg"),u=41,p=27;s.setAttributeNS(null,"display","block"),s.setAttributeNS(null,"height",`${u}px`),s.setAttributeNS(null,"width",`${p}px`),s.setAttributeNS(null,"viewBox",`0 0 ${p} ${u}`);const f=ie.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 _=ie.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"fill-rule","nonzero");const y=ie.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.setAttributeNS(null,"fill","#000000");const v=[{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 ne of v){const G=ie.createNS("http://www.w3.org/2000/svg","ellipse");G.setAttributeNS(null,"opacity","0.04"),G.setAttributeNS(null,"cx","10.5"),G.setAttributeNS(null,"cy","5.80029008"),G.setAttributeNS(null,"rx",ne.rx),G.setAttributeNS(null,"ry",ne.ry),y.appendChild(G)}const E=ie.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"fill",this._color);const M=ie.createNS("http://www.w3.org/2000/svg","path");M.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"),E.appendChild(M);const z=ie.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"opacity","0.25"),z.setAttributeNS(null,"fill","#000000");const V=ie.createNS("http://www.w3.org/2000/svg","path");V.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"),z.appendChild(V);const $=ie.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"transform","translate(6.0, 7.0)"),$.setAttributeNS(null,"fill","#FFFFFF");const U=ie.createNS("http://www.w3.org/2000/svg","g");U.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=ie.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const Q=ie.createNS("http://www.w3.org/2000/svg","circle");Q.setAttributeNS(null,"fill","#FFFFFF"),Q.setAttributeNS(null,"cx","5.5"),Q.setAttributeNS(null,"cy","5.5"),Q.setAttributeNS(null,"r","5.4999962"),U.appendChild(H),U.appendChild(Q),_.appendChild(y),_.appendChild(E),_.appendChild(z),_.appendChild($),_.appendChild(U),s.appendChild(_),s.setAttributeNS(null,"height",u*this._scale+"px"),s.setAttributeNS(null,"width",p*this._scale+"px"),this._element.appendChild(s),this._offset=a.pointGeometry.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",s=>{s.preventDefault()}),this._element.addEventListener("mousedown",s=>{s.preventDefault()}),Ye(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),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("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),ie.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=a.LngLat.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 u=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[u,-1*(38.1-13.5+u)],"bottom-right":[-u,-1*(38.1-13.5+u)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const n=t.code,s=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&s!==32&&s!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,s=this._element;this._popup&&(n===s||s.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=xo(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let s="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?s="rotateX(0deg)":this._pitchAlignment==="map"&&(s=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!=="moveend"||(this._pos=this._pos.round()),ie.setTransform(this._element,`${Ze[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${s} ${n}`),this._map.style&&this._map.style.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const u=this._map.unproject(this._pos),p=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=u.distanceTo(this._lngLat)>20*p?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(t){return this._offset=a.pointGeometry.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=t.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 a.Event("dragstart"))),this.fire(new a.Event("drag")))}_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 a.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.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))}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}}const Fs={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let qr,mi=0,Zr=!1;const gr={maxWidth:100,unit:"metric"};function Wa(l,t,n){const s=n&&n.maxWidth||100,u=l._container.clientHeight/2,p=l.unproject([0,u]),f=l.unproject([s,u]),_=p.distanceTo(f);if(n&&n.unit==="imperial"){const y=3.2808*_;y>5280?jr(t,s,y/5280,l._getUIString("ScaleControl.Miles")):jr(t,s,y,l._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?jr(t,s,_/1852,l._getUIString("ScaleControl.NauticalMiles")):_>=1e3?jr(t,s,_/1e3,l._getUIString("ScaleControl.Kilometers")):jr(t,s,_,l._getUIString("ScaleControl.Meters"))}function jr(l,t,n,s){const u=function(p){const f=Math.pow(10,`${Math.floor(p)}`.length-1);let _=p/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(y){const v=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*v)/v}(_),f*_}(n);l.style.width=t*(u/n)+"px",l.innerHTML=`${u}&nbsp;${s}`}const Xt={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Yt=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Os(l){if(l){if(typeof l=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(l,2)));return{center:new a.pointGeometry(0,0),top:new a.pointGeometry(0,l),"top-left":new a.pointGeometry(t,t),"top-right":new a.pointGeometry(-t,t),bottom:new a.pointGeometry(0,-l),"bottom-left":new a.pointGeometry(t,-t),"bottom-right":new a.pointGeometry(-t,-t),left:new a.pointGeometry(l,0),right:new a.pointGeometry(-l,0)}}if(l instanceof a.pointGeometry||Array.isArray(l)){const t=a.pointGeometry.convert(l);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:a.pointGeometry.convert(l.center||[0,0]),top:a.pointGeometry.convert(l.top||[0,0]),"top-left":a.pointGeometry.convert(l["top-left"]||[0,0]),"top-right":a.pointGeometry.convert(l["top-right"]||[0,0]),bottom:a.pointGeometry.convert(l.bottom||[0,0]),"bottom-left":a.pointGeometry.convert(l["bottom-left"]||[0,0]),"bottom-right":a.pointGeometry.convert(l["bottom-right"]||[0,0]),left:a.pointGeometry.convert(l.left||[0,0]),right:a.pointGeometry.convert(l.right||[0,0])}}return Os(new a.pointGeometry(0,0))}const sn={supported:Y,setRTLTextPlugin:a.setRTLTextPlugin,getRTLTextPluginStatus:a.getRTLTextPluginStatus,Map:class extends Nt{constructor(l){var t;if(a.PerformanceUtils.mark(a.PerformanceMarkers.create),(l=a.extend({},Xa,l)).minZoom!=null&&l.maxZoom!=null&&l.minZoom>l.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(l.minPitch!=null&&l.maxPitch!=null&&l.minPitch>l.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(l.minPitch!=null&&l.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(l.maxPitch!=null&&l.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new co(l.minZoom,l.maxZoom,l.minPitch,l.maxPitch,l.renderWorldCopies),{bearingSnap:l.bearingSnap}),this._interactive=l.interactive,this._cooperativeGestures=l.cooperativeGestures,this._maxTileCacheSize=l.maxTileCacheSize,this._failIfMajorPerformanceCaveat=l.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=l.preserveDrawingBuffer,this._antialias=l.antialias,this._trackResize=l.trackResize,this._bearingSnap=l.bearingSnap,this._refreshExpiredTiles=l.refreshExpiredTiles,this._fadeDuration=l.fadeDuration,this._crossSourceCollisions=l.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=l.collectResourceTiming,this._renderTaskQueue=new Za,this._controls=[],this._mapId=a.uniqueId(),this._locale=a.extend({},ja,l.locale),this._clickTolerance=l.clickTolerance,this._pixelRatio=(t=l.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this._requestManager=new Ge(l.transformRequest),typeof l.container=="string"){if(this._container=document.getElementById(l.container),!this._container)throw new Error(`Container '${l.container}' not found.`)}else{if(!(l.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=l.container}if(l.maxBounds&&this.setMaxBounds(l.maxBounds),a.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),typeof window!="undefined"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new qa(this,l),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=l.hash&&new Da(typeof l.hash=="string"&&l.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch}),l.bounds&&(this.resize(),this.fitBounds(l.bounds,a.extend({},l.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=l.localIdeographFontFamily,l.style&&this.setStyle(l.style,{localIdeographFontFamily:l.localIdeographFontFamily}),l.attributionControl&&this.addControl(new yo({customAttribution:l.customAttribution})),l.maplibreLogo&&this.addControl(new Xo,l.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new a.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new a.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new a.Event("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(l,t){if(t===void 0&&(t=l.getDefaultPosition?l.getDefaultPosition():"top-right"),!l||!l.onAdd)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=l.onAdd(this);this._controls.push(l);const s=this._controlPositions[t];return t.indexOf("bottom")!==-1?s.insertBefore(n,s.firstChild):s.appendChild(n),this}removeControl(l){if(!l||!l.onRemove)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(l);return t>-1&&this._controls.splice(t,1),l.onRemove(this),this}hasControl(l){return this._controls.indexOf(l)>-1}calculateCameraOptionsFromTo(l,t,n,s){return s==null&&this.style.terrain&&(s=this.transform.getElevation(n,this.style.terrain)),super.calculateCameraOptionsFromTo(l,t,n,s)}resize(l){const t=this._containerDimensions(),n=t[0],s=t[1];this._resizeCanvas(n,s,this.getPixelRatio()),this.transform.resize(n,s),this.painter.resize(n,s,this.getPixelRatio());const u=!this._moving;return u&&(this.stop(),this.fire(new a.Event("movestart",l)).fire(new a.Event("move",l))),this.fire(new a.Event("resize",l)),u&&this.fire(new a.Event("moveend",l)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(l){const[t,n]=this._containerDimensions();this._pixelRatio=l,this._resizeCanvas(t,n,l),this.painter.resize(t,n,l)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(l){return this.transform.setMaxBounds(a.LngLatBounds.convert(l)),this._update()}setMinZoom(l){if((l=l==null?-2:l)>=-2&&l<=this.transform.maxZoom)return this.transform.minZoom=l,this._update(),this.getZoom()<l&&this.setZoom(l),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(l){if((l=l==null?22:l)>=this.transform.minZoom)return this.transform.maxZoom=l,this._update(),this.getZoom()>l&&this.setZoom(l),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(l){if((l=l==null?0:l)<0)throw new Error("minPitch must be greater than or equal to 0");if(l>=0&&l<=this.transform.maxPitch)return this.transform.minPitch=l,this._update(),this.getPitch()<l&&this.setPitch(l),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(l){if((l=l==null?60:l)>85)throw new Error("maxPitch must be less than or equal to 85");if(l>=this.transform.minPitch)return this.transform.maxPitch=l,this._update(),this.getPitch()>l&&this.setPitch(l),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(l){return this.transform.renderWorldCopies=l,this._update()}project(l){return this.transform.locationPoint(a.LngLat.convert(l),this.style&&this.style.terrain)}unproject(l){return this.transform.pointLocation(a.pointGeometry.convert(l),this.style&&this.style.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(l,t,n){if(l==="mouseenter"||l==="mouseover"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:p=>{const f=this.getLayer(t)?this.queryRenderedFeatures(p.point,{layers:[t]}):[];f.length?s||(s=!0,n.call(this,new Vi(l,this,p.originalEvent,{features:f}))):s=!1},mouseout:()=>{s=!1}}}}if(l==="mouseleave"||l==="mouseout"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:f=>{(this.getLayer(t)?this.queryRenderedFeatures(f.point,{layers:[t]}):[]).length?s=!0:s&&(s=!1,n.call(this,new Vi(l,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,n.call(this,new Vi(l,this,f.originalEvent)))}}}}{const s=u=>{const p=this.getLayer(t)?this.queryRenderedFeatures(u.point,{layers:[t]}):[];p.length&&(u.features=p,n.call(this,u),delete u.features)};return{layer:t,listener:n,delegates:{[l]:s}}}}on(l,t,n){if(n===void 0)return super.on(l,t);const s=this._createDelegatedListener(l,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[l]=this._delegatedListeners[l]||[],this._delegatedListeners[l].push(s);for(const u in s.delegates)this.on(u,s.delegates[u]);return this}once(l,t,n){if(n===void 0)return super.once(l,t);const s=this._createDelegatedListener(l,t,n);for(const u in s.delegates)this.once(u,s.delegates[u]);return this}off(l,t,n){return n===void 0?super.off(l,t):(this._delegatedListeners&&this._delegatedListeners[l]&&(s=>{const u=this._delegatedListeners[l];for(let p=0;p<u.length;p++){const f=u[p];if(f.layer===t&&f.listener===n){for(const _ in f.delegates)this.off(_,f.delegates[_]);return u.splice(p,1),this}}})(),this)}queryRenderedFeatures(l,t){if(!this.style)return[];let n;if(t!==void 0||l===void 0||l instanceof a.pointGeometry||Array.isArray(l)||(t=l,l=void 0),t=t||{},(l=l||[[0,0],[this.transform.width,this.transform.height]])instanceof a.pointGeometry||typeof l[0]=="number")n=[a.pointGeometry.convert(l)];else{const s=a.pointGeometry.convert(l[0]),u=a.pointGeometry.convert(l[1]);n=[s,new a.pointGeometry(u.x,s.y),u,new a.pointGeometry(s.x,u.y),s]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(l,t){return this.style.querySourceFeatures(l,t)}setStyle(l,t){return(t=a.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&l?(this._diffStyle(l,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(l,t))}setTransformRequest(l){return this._requestManager.setTransformRequest(l),this}_getUIString(l){const t=this._locale[l];if(t==null)throw new Error(`Missing UI string '${l}'`);return t}_updateStyle(l,t){return this.style&&(this.style.setEventedParent(null),this.style._remove()),l?(this.style=new _i(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof l=="string"?this.style.loadURL(l):this.style.loadJSON(l),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new _i(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(l,t){if(typeof l=="string"){const n=this._requestManager.transformRequest(l,a.ResourceType.Style);a.getJSON(n,(s,u)=>{s?this.fire(new a.ErrorEvent(s)):u&&this._updateDiff(u,t)})}else typeof l=="object"&&this._updateDiff(l,t)}_updateDiff(l,t){try{this.style.setState(l)&&this._update(!0)}catch(n){a.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(l,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():a.warnOnce("There is no style added to the map.")}addSource(l,t){return this._lazyInitEmptyStyle(),this.style.addSource(l,t),this._update(!0)}isSourceLoaded(l){const t=this.style&&this.style.sourceCaches[l];if(t!==void 0)return t.loaded();this.fire(new a.ErrorEvent(new Error(`There is no source with ID '${l}'`)))}setTerrain(l){return this.style.setTerrain(l),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){const l=this.style&&this.style.sourceCaches;for(const t in l){const n=l[t]._tiles;for(const s in n){const u=n[s];if(u.state!=="loaded"&&u.state!=="errored")return!1}}return!0}addSourceType(l,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(l,t,n)}removeSource(l){return this.style.removeSource(l),this._update(!0)}getSource(l){return this.style.getSource(l)}addImage(l,t,{pixelRatio:n=1,sdf:s=!1,stretchX:u,stretchY:p,content:f}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||a.isImageBitmap(t)){const{width:_,height:y,data:v}=a.exported.getImageData(t);this.style.addImage(l,{data:new a.RGBAImage({width:_,height:y},v),pixelRatio:n,stretchX:u,stretchY:p,content:f,sdf:s,version:0})}else{if(t.width===void 0||t.height===void 0)return this.fire(new a.ErrorEvent(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:_,height:y,data:v}=t,E=t;this.style.addImage(l,{data:new a.RGBAImage({width:_,height:y},new Uint8Array(v)),pixelRatio:n,stretchX:u,stretchY:p,content:f,sdf:s,version:0,userImage:E}),E.onAdd&&E.onAdd(this,l)}}}updateImage(l,t){const n=this.style.getImage(l);if(!n)return this.fire(new a.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=t instanceof HTMLImageElement||a.isImageBitmap(t)?a.exported.getImageData(t):t,{width:u,height:p,data:f}=s;if(u===void 0||p===void 0)return this.fire(new a.ErrorEvent(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(u!==n.data.width||p!==n.data.height)return this.fire(new a.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(t instanceof HTMLImageElement||a.isImageBitmap(t));n.data.replace(f,_),this.style.updateImage(l,n)}hasImage(l){return l?!!this.style.getImage(l):(this.fire(new a.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(l){this.style.removeImage(l)}loadImage(l,t){a.getImage(this._requestManager.transformRequest(l,a.ResourceType.Image),t)}listImages(){return this.style.listImages()}addLayer(l,t){return this._lazyInitEmptyStyle(),this.style.addLayer(l,t),this._update(!0)}moveLayer(l,t){return this.style.moveLayer(l,t),this._update(!0)}removeLayer(l){return this.style.removeLayer(l),this._update(!0)}getLayer(l){return this.style.getLayer(l)}setLayerZoomRange(l,t,n){return this.style.setLayerZoomRange(l,t,n),this._update(!0)}setFilter(l,t,n={}){return this.style.setFilter(l,t,n),this._update(!0)}getFilter(l){return this.style.getFilter(l)}setPaintProperty(l,t,n,s={}){return this.style.setPaintProperty(l,t,n,s),this._update(!0)}getPaintProperty(l,t){return this.style.getPaintProperty(l,t)}setLayoutProperty(l,t,n,s={}){return this.style.setLayoutProperty(l,t,n,s),this._update(!0)}getLayoutProperty(l,t){return this.style.getLayoutProperty(l,t)}setLight(l,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(l,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(l,t){return this.style.setFeatureState(l,t),this._update()}removeFeatureState(l,t){return this.style.removeFeatureState(l,t),this._update()}getFeatureState(l){return this.style.getFeatureState(l)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let l=0,t=0;return this._container&&(l=this._container.clientWidth||400,t=this._container.clientHeight||300),[l,t]}_setupContainer(){const l=this._container;l.classList.add("maplibregl-map","mapboxgl-map");const t=this._canvasContainer=ie.create("div","maplibregl-canvas-container mapboxgl-canvas-container",l);this._interactive&&t.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=ie.create("canvas","maplibregl-canvas mapboxgl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions();this._resizeCanvas(n[0],n[1],this.getPixelRatio());const s=this._controlContainer=ie.create("div","maplibregl-control-container mapboxgl-control-container",l),u=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(p=>{u[p]=ie.create("div",`maplibregl-ctrl-${p} mapboxgl-ctrl-${p}`,s)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const l=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=ie.create("div","maplibregl-cooperative-gesture-screen",l);let t="Control",n=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(n=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map",t="Meta"),this._cooperativeGesturesScreen.innerHTML=`
577
577
  <div class="maplibregl-desktop-message">${n}</div>
578
578
  <div class="maplibregl-mobile-message">${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>
579
- `,document.addEventListener("keydown",s=>{s.key===t&&(this._metaPress=!0)}),document.addEventListener("keyup",s=>{s.key===t&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",s=>{this._onCooperativeGesture(s,this._metaPress,1)},!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan")}_resizeCanvas(l,t,n){this._canvas.width=n*l,this._canvas.height=n*t,this._canvas.style.width=`${l}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const l=a.extend({},Y.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl",l)||this._canvas.getContext("experimental-webgl",l);t?(this.painter=new As(t,this.transform),a.exported$1.testSupport(t)):this.fire(new a.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(l){l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.Event("webglcontextlost",{originalEvent:l}))}_contextRestored(l){this._setupPainter(),this.resize(),this._update(),this.fire(new a.Event("webglcontextrestored",{originalEvent:l}))}_onMapScroll(l){if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(l,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(l){return this.style?(this._styleDirty=this._styleDirty||l,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(l){return this._update(),this._renderTaskQueue.add(l)}_cancelRenderFrame(l){this._renderTaskQueue.remove(l)}_render(l){let t,n=0;const s=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(t=s.createQueryEXT(),s.beginQueryEXT(s.TIME_ELAPSED_EXT,t),n=a.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(l),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const f=this.transform.zoom,_=a.exported.now();this.style.zoomHistory.update(f,_);const y=new a.EvaluationParameters(f,{now:_,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),v=y.crossFadingFactor();v===1&&v===this._crossFadingFactor||(u=!0,this._crossFadingFactor=v),this.style.update(y)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new a.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,a.PerformanceUtils.mark(a.PerformanceMarkers.load),this.fire(new a.Event("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const f=a.exported.now()-n;s.endQueryEXT(s.TIME_ELAPSED_EXT,t),setTimeout(()=>{const _=s.getQueryObjectEXT(t,s.QUERY_RESULT_EXT)/1e6;s.deleteQueryEXT(t),this.fire(new a.Event("gpu-timing-frame",{cpuTime:f,gpuTime:_}))},50)}if(this.listens("gpu-timing-layer")){const f=this.painter.collectGpuTimers();setTimeout(()=>{const _=this.painter.queryGpuTimers(f);this.fire(new a.Event("gpu-timing-layer",{layerTimes:_}))},50)}const p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new a.Event("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,a.PerformanceUtils.mark(a.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window!="undefined"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const l=this.painter.context.gl.getExtension("WEBGL_lose_context");l&&l.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),te.remove(this._canvasContainer),te.remove(this._controlContainer),this._cooperativeGestures&&te.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),a.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new a.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=a.exported.frame(l=>{a.PerformanceUtils.frame(l),this._frame=null,this._render(l)}))}_onWindowOnline(){this._update()}_onWindowResize(l){this._trackResize&&this.resize({originalEvent:l})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(l){this._showTileBoundaries!==l&&(this._showTileBoundaries=l,this._update())}get showPadding(){return!!this._showPadding}set showPadding(l){this._showPadding!==l&&(this._showPadding=l,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(l){this._showCollisionBoxes!==l&&(this._showCollisionBoxes=l,l?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(l){this._showOverdrawInspector!==l&&(this._showOverdrawInspector=l,this._update())}get repaint(){return!!this._repaint}set repaint(l){this._repaint!==l&&(this._repaint=l,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(l){this._vertices=l,this._update()}_setCacheLimits(l,t){a.setCacheLimits(l,t)}get version(){return"2.4.0"}},NavigationControl:class{constructor(l){this.options=a.extend({},Xl,l),this._container=te.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(a.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),te.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),te.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(a.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=te.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const l=this._map.getZoom(),t=l===this._map.getMaxZoom(),n=l===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const l=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=l}onAdd(l){return this._map=l,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._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new dr(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){te.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(l,t){const n=te.create("button",l,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(l,t){const n=this._map._getUIString(`NavigationControl.${t}`);l.title=n,l.setAttribute("aria-label",n)}},GeolocateControl:class extends a.Evented{constructor(l){super(),this.options=a.extend({},Os,l),a.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(l){var t;return this._map=l,this._container=te.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),t=this._setupUI,Gr!==void 0?t(Gr):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{Gr=n.state!=="denied",t(Gr)}):(Gr=!!window.navigator.geolocation,t(Gr)),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(),te.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,_i=0,qr=!1}_isOutOfMapMaxBounds(l){const t=this._map.getMaxBounds(),n=l.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","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(l){if(this._map){if(this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new a.Event("outofmaxbounds",l)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=l,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(l),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(l),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new a.Event("geolocate",l)),this._finish()}}_updateCamera(l){const t=new a.LngLat(l.coords.longitude,l.coords.latitude),n=l.coords.accuracy,s=this._map.getBearing(),u=a.extend({bearing:s},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),u,{geolocateSource:!0})}_updateMarker(l){if(l){const t=new a.LngLat(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=l.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const l=this._map._container.clientHeight/2,t=this._map.unproject([0,l]),n=this._map.unproject([1,l]),s=t.distanceTo(n),u=Math.ceil(2*this._accuracy/s);this._circleElement.style.width=`${u}px`,this._circleElement.style.height=`${u}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(l){if(this._map){if(this.options.trackUserLocation)if(l.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(l.code===3&&qr)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new a.Event("error",l)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(l){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=te.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),te.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",l===!1){a.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=te.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new Bn(this._dotElement),this._circleElement=te.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Bn({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new a.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return a.warnOnce("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 a.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":_i--,qr=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new a.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-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 l;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),_i++,_i>1?(l={maximumAge:6e5,timeout:0},qr=!0):(l=this.options.positionOptions,qr=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,l)}}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","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:_o,LogoControl:Zo,ScaleControl:class{constructor(l){this.options=a.extend({},fr,l),a.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Ka(this._map,this._container,this.options)}onAdd(l){return this._map=l,this._container=te.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",l.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){te.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(l){this.options.unit=l,Ka(this._map,this._container,this.options)}},FullscreenControl:class{constructor(l){this._fullscreen=!1,l&&l.container&&(l.container instanceof HTMLElement?this._container=l.container:a.warnOnce("Full screen control 'container' must be a DOM element.")),a.bindAll(["_onClickFullscreen","_changeIcon"],this),"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(l){return this._map=l,this._container||(this._container=this._map.getContainer()),this._controlContainer=te.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){te.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const l=this._fullscreenButton=te.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);te.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",l).setAttribute("aria-hidden","true"),l.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const l=this._getTitle();this._fullscreenButton.setAttribute("aria-label",l),this._fullscreenButton.title=l}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},TerrainControl:class{constructor(l){this.options=l,a.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(l){return this._map=l,this._container=te.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=te.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),te.create("span","maplibregl-ctrl-icon mapboxgl-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(){te.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends a.Evented{constructor(l){super(),this.options=a.extend(Object.create(Jt),l),a.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(l){return this._map&&this.remove(),this._map=l,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new a.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&te.remove(this._content),this._container&&(te.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new a.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(l){return this._lngLat=a.LngLat.convert(l),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(l){return this.setDOMContent(document.createTextNode(l))}setHTML(l){const t=document.createDocumentFragment(),n=document.createElement("body");let s;for(n.innerHTML=l;s=n.firstChild,s;)t.appendChild(s);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(l){return this.options.maxWidth=l,this._update(),this}setDOMContent(l){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=te.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(l),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(l){this._container&&this._container.classList.add(l)}removeClassName(l){this._container&&this._container.classList.remove(l)}setOffset(l){return this.options.offset=l,this._update(),this}toggleClassName(l){if(this._container)return this._container.classList.toggle(l)}_createCloseButton(){this.options.closeButton&&(this._closeButton=te.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(l){this._update(l.point)}_onMouseMove(l){this._update(l.point)}_onDrag(l){this._update(l.point)}_update(l){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=te.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=te.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(p=>this._container.classList.add(p)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=yo(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!l))return;const t=this._pos=this._trackPointer&&l?l:this._map.project(this._lngLat);let n=this.options.anchor;const s=Us(this.options.offset);if(!n){const p=this._container.offsetWidth,f=this._container.offsetHeight;let _;_=t.y+s.bottom.y<f?["top"]:t.y>this._map.transform.height-f?["bottom"]:[],t.x<p/2?_.push("left"):t.x>this._map.transform.width-p/2&&_.push("right"),n=_.length===0?"bottom":_.join("-")}const u=t.add(s[n]).round();te.setTransform(this._container,`${qe[n]} translate(${u.x}px,${u.y}px)`),Je(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const l=this._container.querySelector(ii);l&&l.focus()}_onClose(){this.remove()}},Marker:Bn,Style:bi,LngLat:a.LngLat,LngLatBounds:a.LngLatBounds,Point:a.pointGeometry,MercatorCoordinate:a.MercatorCoordinate,Evented:a.Evented,AJAXError:a.AJAXError,config:a.config,CanvasSource:Hr,GeoJSONSource:vi,ImageSource:Ii,RasterDEMTileSource:He,RasterTileSource:Ht,VectorTileSource:ei,VideoSource:Di,prewarm:function(){xn().acquire(vr)},clearPrewarmedResources:function(){const l=Rr;l&&(l.isPreloaded()&&l.numActive()===1?(l.release(vr),Rr=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()"))},get version(){return"2.4.0"},get workerCount(){return $i.workerCount},set workerCount(l){$i.workerCount=l},get maxParallelImageRequests(){return a.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(l){a.config.MAX_PARALLEL_IMAGE_REQUESTS=l},clearStorage(l){a.clearTileCache(l)},workerUrl:"",addProtocol(l,t){a.config.REGISTERED_PROTOCOLS[l]=t},removeProtocol(l){delete a.config.REGISTERED_PROTOCOLS[l]}};return Yi.extend(on,{isSafari:a.isSafari,getPerformanceMetrics:a.PerformanceUtils.getPerformanceMetrics}),on});var ne=B;return ne})})(lp);var gm=lp.exports;function up(b,C,A){A===void 0&&(A={});var D={type:"Feature"};return(A.id===0||A.id)&&(D.id=A.id),A.bbox&&(D.bbox=A.bbox),D.properties=C||{},D.geometry=b,D}function kh(b,C,A){if(A===void 0&&(A={}),!b)throw new Error("coordinates is required");if(!Array.isArray(b))throw new Error("coordinates must be an Array");if(b.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Dh(b[0])||!Dh(b[1]))throw new Error("coordinates must contain numbers");var D={type:"Point",coordinates:b};return up(D,C,A)}function _m(b,C,A){A===void 0&&(A={});var D={type:"MultiPoint",coordinates:b};return up(D,C,A)}function Dh(b){return!isNaN(b)&&b!==null&&!Array.isArray(b)}function hp(b,C,A){if(b!==null)for(var D,B,G,ne,a,Y,ie,pe=0,ue=0,te,ke=b.type,Se=ke==="FeatureCollection",Ie=ke==="Feature",Ye=Se?b.features.length:1,tt=0;tt<Ye;tt++){ie=Se?b.features[tt].geometry:Ie?b.geometry:b,te=ie?ie.type==="GeometryCollection":!1,a=te?ie.geometries.length:1;for(var Qe=0;Qe<a;Qe++){var dt=0,It=0;if(ne=te?ie.geometries[Qe]:ie,ne!==null){Y=ne.coordinates;var ht=ne.type;switch(pe=A&&(ht==="Polygon"||ht==="MultiPolygon")?1:0,ht){case null:break;case"Point":if(C(Y,ue,tt,dt,It)===!1)return!1;ue++,dt++;break;case"LineString":case"MultiPoint":for(D=0;D<Y.length;D++){if(C(Y[D],ue,tt,dt,It)===!1)return!1;ue++,ht==="MultiPoint"&&dt++}ht==="LineString"&&dt++;break;case"Polygon":case"MultiLineString":for(D=0;D<Y.length;D++){for(B=0;B<Y[D].length-pe;B++){if(C(Y[D][B],ue,tt,dt,It)===!1)return!1;ue++}ht==="MultiLineString"&&dt++,ht==="Polygon"&&It++}ht==="Polygon"&&dt++;break;case"MultiPolygon":for(D=0;D<Y.length;D++){for(It=0,B=0;B<Y[D].length;B++){for(G=0;G<Y[D][B].length-pe;G++){if(C(Y[D][B][G],ue,tt,dt,It)===!1)return!1;ue++}It++}dt++}break;case"GeometryCollection":for(D=0;D<ne.geometries.length;D++)if(hp(ne.geometries[D],C,A)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Uc(b){var C=[1/0,1/0,-1/0,-1/0];return hp(b,function(A){C[0]>A[0]&&(C[0]=A[0]),C[1]>A[1]&&(C[1]=A[1]),C[2]<A[0]&&(C[2]=A[0]),C[3]<A[1]&&(C[3]=A[1])}),C}Uc.default=Uc;function $c(b,C,A,D,B,G){if(B-D<=A)return;const ne=D+B>>1;pp(b,C,ne,D,B,G%2),$c(b,C,A,D,ne-1,G+1),$c(b,C,A,ne+1,B,G+1)}function pp(b,C,A,D,B,G){for(;B>D;){if(B-D>600){const ie=B-D+1,pe=A-D+1,ue=Math.log(ie),te=.5*Math.exp(2*ue/3),ke=.5*Math.sqrt(ue*te*(ie-te)/ie)*(pe-ie/2<0?-1:1),Se=Math.max(D,Math.floor(A-pe*te/ie+ke)),Ie=Math.min(B,Math.floor(A+(ie-pe)*te/ie+ke));pp(b,C,A,Se,Ie,G)}const ne=C[2*A+G];let a=D,Y=B;for(sa(b,C,D,A),C[2*B+G]>ne&&sa(b,C,D,B);a<Y;){for(sa(b,C,a,Y),a++,Y--;C[2*a+G]<ne;)a++;for(;C[2*Y+G]>ne;)Y--}C[2*D+G]===ne?sa(b,C,D,Y):(Y++,sa(b,C,Y,B)),Y<=A&&(D=Y+1),A<=Y&&(B=Y-1)}}function sa(b,C,A,D){Bc(b,A,D),Bc(C,2*A,2*D),Bc(C,2*A+1,2*D+1)}function Bc(b,C,A){const D=b[C];b[C]=b[A],b[A]=D}function ym(b,C,A,D,B,G,ne){const a=[0,b.length-1,0],Y=[];let ie,pe;for(;a.length;){const ue=a.pop(),te=a.pop(),ke=a.pop();if(te-ke<=ne){for(let Ye=ke;Ye<=te;Ye++)ie=C[2*Ye],pe=C[2*Ye+1],ie>=A&&ie<=B&&pe>=D&&pe<=G&&Y.push(b[Ye]);continue}const Se=Math.floor((ke+te)/2);ie=C[2*Se],pe=C[2*Se+1],ie>=A&&ie<=B&&pe>=D&&pe<=G&&Y.push(b[Se]);const Ie=(ue+1)%2;(ue===0?A<=ie:D<=pe)&&(a.push(ke),a.push(Se-1),a.push(Ie)),(ue===0?B>=ie:G>=pe)&&(a.push(Se+1),a.push(te),a.push(Ie))}return Y}function xm(b,C,A,D,B,G){const ne=[0,b.length-1,0],a=[],Y=B*B;for(;ne.length;){const ie=ne.pop(),pe=ne.pop(),ue=ne.pop();if(pe-ue<=G){for(let Ye=ue;Ye<=pe;Ye++)Lh(C[2*Ye],C[2*Ye+1],A,D)<=Y&&a.push(b[Ye]);continue}const te=Math.floor((ue+pe)/2),ke=C[2*te],Se=C[2*te+1];Lh(ke,Se,A,D)<=Y&&a.push(b[te]);const Ie=(ie+1)%2;(ie===0?A-B<=ke:D-B<=Se)&&(ne.push(ue),ne.push(te-1),ne.push(Ie)),(ie===0?A+B>=ke:D+B>=Se)&&(ne.push(te+1),ne.push(pe),ne.push(Ie))}return a}function Lh(b,C,A,D){const B=b-A,G=C-D;return B*B+G*G}const vm=b=>b[0],bm=b=>b[1];class Rh{constructor(C,A=vm,D=bm,B=64,G=Float64Array){this.nodeSize=B,this.points=C;const ne=C.length<65536?Uint16Array:Uint32Array,a=this.ids=new ne(C.length),Y=this.coords=new G(C.length*2);for(let ie=0;ie<C.length;ie++)a[ie]=ie,Y[2*ie]=A(C[ie]),Y[2*ie+1]=D(C[ie]);$c(a,Y,B,0,a.length-1,0)}range(C,A,D,B){return ym(this.ids,this.coords,C,A,D,B,this.nodeSize)}within(C,A,D){return xm(this.ids,this.coords,C,A,D,this.nodeSize)}}const wm={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:b=>b},El=Math.fround||(b=>C=>(b[0]=+C,b[0]))(new Float32Array(1));class Tm{constructor(C){this.options=la(Object.create(wm),C),this.trees=new Array(this.options.maxZoom+1)}load(C){const{log:A,minZoom:D,maxZoom:B,nodeSize:G}=this.options;A&&console.time("total time");const ne=`prepare ${C.length} points`;A&&console.time(ne),this.points=C;let a=[];for(let Y=0;Y<C.length;Y++)!C[Y].geometry||a.push(Sm(C[Y],Y));this.trees[B+1]=new Rh(a,Fh,Oh,G,Float32Array),A&&console.timeEnd(ne);for(let Y=B;Y>=D;Y--){const ie=+Date.now();a=this._cluster(a,Y),this.trees[Y]=new Rh(a,Fh,Oh,G,Float32Array),A&&console.log("z%d: %d clusters in %dms",Y,a.length,+Date.now()-ie)}return A&&console.timeEnd("total time"),this}getClusters(C,A){let D=((C[0]+180)%360+360)%360-180;const B=Math.max(-90,Math.min(90,C[1]));let G=C[2]===180?180:((C[2]+180)%360+360)%360-180;const ne=Math.max(-90,Math.min(90,C[3]));if(C[2]-C[0]>=360)D=-180,G=180;else if(D>G){const pe=this.getClusters([D,B,180,ne],A),ue=this.getClusters([-180,B,G,ne],A);return pe.concat(ue)}const a=this.trees[this._limitZoom(A)],Y=a.range(bl(D),wl(ne),bl(G),wl(B)),ie=[];for(const pe of Y){const ue=a.points[pe];ie.push(ue.numPoints?Bh(ue):this.points[ue.index])}return ie}getChildren(C){const A=this._getOriginId(C),D=this._getOriginZoom(C),B="No cluster with the specified id.",G=this.trees[D];if(!G)throw new Error(B);const ne=G.points[A];if(!ne)throw new Error(B);const a=this.options.radius/(this.options.extent*Math.pow(2,D-1)),Y=G.within(ne.x,ne.y,a),ie=[];for(const pe of Y){const ue=G.points[pe];ue.parentId===C&&ie.push(ue.numPoints?Bh(ue):this.points[ue.index])}if(ie.length===0)throw new Error(B);return ie}getLeaves(C,A,D){A=A||10,D=D||0;const B=[];return this._appendLeaves(B,C,A,D,0),B}getTile(C,A,D){const B=this.trees[this._limitZoom(C)],G=Math.pow(2,C),{extent:ne,radius:a}=this.options,Y=a/ne,ie=(D-Y)/G,pe=(D+1+Y)/G,ue={features:[]};return this._addTileFeatures(B.range((A-Y)/G,ie,(A+1+Y)/G,pe),B.points,A,D,G,ue),A===0&&this._addTileFeatures(B.range(1-Y/G,ie,1,pe),B.points,G,D,G,ue),A===G-1&&this._addTileFeatures(B.range(0,ie,Y/G,pe),B.points,-1,D,G,ue),ue.features.length?ue:null}getClusterExpansionZoom(C){let A=this._getOriginZoom(C)-1;for(;A<=this.options.maxZoom;){const D=this.getChildren(C);if(A++,D.length!==1)break;C=D[0].properties.cluster_id}return A}_appendLeaves(C,A,D,B,G){const ne=this.getChildren(A);for(const a of ne){const Y=a.properties;if(Y&&Y.cluster?G+Y.point_count<=B?G+=Y.point_count:G=this._appendLeaves(C,Y.cluster_id,D,B,G):G<B?G++:C.push(a),C.length===D)break}return G}_addTileFeatures(C,A,D,B,G,ne){for(const a of C){const Y=A[a],ie=Y.numPoints;let pe,ue,te;if(ie)pe=dp(Y),ue=Y.x,te=Y.y;else{const Ie=this.points[Y.index];pe=Ie.properties,ue=bl(Ie.geometry.coordinates[0]),te=wl(Ie.geometry.coordinates[1])}const ke={type:1,geometry:[[Math.round(this.options.extent*(ue*G-D)),Math.round(this.options.extent*(te*G-B))]],tags:pe};let Se;ie?Se=Y.id:this.options.generateId?Se=Y.index:this.points[Y.index].id&&(Se=this.points[Y.index].id),Se!==void 0&&(ke.id=Se),ne.features.push(ke)}}_limitZoom(C){return Math.max(this.options.minZoom,Math.min(Math.floor(+C),this.options.maxZoom+1))}_cluster(C,A){const D=[],{radius:B,extent:G,reduce:ne,minPoints:a}=this.options,Y=B/(G*Math.pow(2,A));for(let ie=0;ie<C.length;ie++){const pe=C[ie];if(pe.zoom<=A)continue;pe.zoom=A;const ue=this.trees[A+1],te=ue.within(pe.x,pe.y,Y),ke=pe.numPoints||1;let Se=ke;for(const Ie of te){const Ye=ue.points[Ie];Ye.zoom>A&&(Se+=Ye.numPoints||1)}if(Se>ke&&Se>=a){let Ie=pe.x*ke,Ye=pe.y*ke,tt=ne&&ke>1?this._map(pe,!0):null;const Qe=(ie<<5)+(A+1)+this.points.length;for(const dt of te){const It=ue.points[dt];if(It.zoom<=A)continue;It.zoom=A;const ht=It.numPoints||1;Ie+=It.x*ht,Ye+=It.y*ht,It.parentId=Qe,ne&&(tt||(tt=this._map(pe,!0)),ne(tt,this._map(It)))}pe.parentId=Qe,D.push(Em(Ie/Se,Ye/Se,Qe,Se,tt))}else if(D.push(pe),Se>1)for(const Ie of te){const Ye=ue.points[Ie];Ye.zoom<=A||(Ye.zoom=A,D.push(Ye))}}return D}_getOriginId(C){return C-this.points.length>>5}_getOriginZoom(C){return(C-this.points.length)%32}_map(C,A){if(C.numPoints)return A?la({},C.properties):C.properties;const D=this.points[C.index].properties,B=this.options.map(D);return A&&B===D?la({},B):B}}function Em(b,C,A,D,B){return{x:El(b),y:El(C),zoom:1/0,id:A,parentId:-1,numPoints:D,properties:B}}function Sm(b,C){const[A,D]=b.geometry.coordinates;return{x:El(bl(A)),y:El(wl(D)),zoom:1/0,index:C,parentId:-1}}function Bh(b){return{type:"Feature",id:b.id,properties:dp(b),geometry:{type:"Point",coordinates:[Im(b.x),Cm(b.y)]}}}function dp(b){const C=b.numPoints,A=C>=1e4?`${Math.round(C/1e3)}k`:C>=1e3?`${Math.round(C/100)/10}k`:C;return la(la({},b.properties),{cluster:!0,cluster_id:b.id,point_count:C,point_count_abbreviated:A})}function bl(b){return b/360+.5}function wl(b){const C=Math.sin(b*Math.PI/180),A=.5-.25*Math.log((1+C)/(1-C))/Math.PI;return A<0?0:A>1?1:A}function Im(b){return(b-.5)*360}function Cm(b){const C=(180-b*360)*Math.PI/180;return 360*Math.atan(Math.exp(C))/Math.PI-90}function la(b,C){for(const A in C)b[A]=C[A];return b}function Fh(b){return b.x}function Oh(b){return b.y}var Uh=Object.prototype.hasOwnProperty;function $h(b,C,A){for(A of b.keys())if(So(A,C))return A}function So(b,C){var A,D,B;if(b===C)return!0;if(b&&C&&(A=b.constructor)===C.constructor){if(A===Date)return b.getTime()===C.getTime();if(A===RegExp)return b.toString()===C.toString();if(A===Array){if((D=b.length)===C.length)for(;D--&&So(b[D],C[D]););return D===-1}if(A===Set){if(b.size!==C.size)return!1;for(D of b)if(B=D,B&&typeof B=="object"&&(B=$h(C,B),!B)||!C.has(B))return!1;return!0}if(A===Map){if(b.size!==C.size)return!1;for(D of b)if(B=D[0],B&&typeof B=="object"&&(B=$h(C,B),!B)||!So(D[1],C.get(B)))return!1;return!0}if(A===ArrayBuffer)b=new Uint8Array(b),C=new Uint8Array(C);else if(A===DataView){if((D=b.byteLength)===C.byteLength)for(;D--&&b.getInt8(D)===C.getInt8(D););return D===-1}if(ArrayBuffer.isView(b)){if((D=b.byteLength)===C.byteLength)for(;D--&&b[D]===C[D];);return D===-1}if(!A||typeof b=="object"){D=0;for(A in b)if(Uh.call(b,A)&&++D&&!Uh.call(C,A)||!(A in C)||!So(b[A],C[A]))return!1;return Object.keys(C).length===D}}return b!==b&&C!==C}function Am(b){var C=ve.exports.useRef(b),A=ve.exports.useRef(0);return So(b,C.current)||(C.current=b,A.current+=1),ve.exports.useMemo(function(){return C.current},[A.current])}function Mm(b,C){return ve.exports.useEffect(b,Am(C))}var Pm=function(C){var A=C.points,D=C.bounds,B=C.zoom,G=C.options,ne=ve.exports.useRef(),a=ve.exports.useRef(),Y=ve.exports.useState([]),ie=Y[0],pe=Y[1],ue=Math.round(B);return Mm(function(){(!ne.current||!So(a.current,A)||!So(ne.current.options,G))&&(ne.current=new Tm(G),ne.current.load(A)),D&&pe(ne.current.getClusters(D,ue)),a.current=A},[A,D,ue,G]),{clusters:ie,supercluster:ne.current}};const zm={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0},km=()=>{const[b,C]=ve.exports.useState(null),[A,D]=ve.exports.useState(zm),B=ve.exports.useMemo(()=>new window.ResizeObserver(G=>{if(G[0]){const{x:ne,y:a,width:Y,height:ie,top:pe,left:ue,bottom:te,right:ke}=G[0].contentRect;D({x:ne,y:a,width:Y,height:ie,top:pe,left:ue,bottom:te,right:ke})}}),[]);return ve.exports.useLayoutEffect(()=>{if(!!b)return B.observe(b),()=>{B.disconnect()}},[b]),[C,A,b]};var Dm="Expected a function",Vh=0/0,Lm="[object Symbol]",Rm=/^\s+|\s+$/g,Bm=/^[-+]0x[0-9a-f]+$/i,Fm=/^0b[01]+$/i,Om=/^0o[0-7]+$/i,Um=parseInt,$m=typeof aa=="object"&&aa&&aa.Object===Object&&aa,Vm=typeof self=="object"&&self&&self.Object===Object&&self,Nm=$m||Vm||Function("return this")(),Gm=Object.prototype,qm=Gm.toString,Zm=Math.max,jm=Math.min,Fc=function(){return Nm.Date.now()};function Xm(b,C,A){var D,B,G,ne,a,Y,ie=0,pe=!1,ue=!1,te=!0;if(typeof b!="function")throw new TypeError(Dm);C=Nh(C)||0,Vc(A)&&(pe=!!A.leading,ue="maxWait"in A,G=ue?Zm(Nh(A.maxWait)||0,C):G,te="trailing"in A?!!A.trailing:te);function ke(xt){var Xt=D,gt=B;return D=B=void 0,ie=xt,ne=b.apply(gt,Xt),ne}function Se(xt){return ie=xt,a=setTimeout(tt,C),pe?ke(xt):ne}function Ie(xt){var Xt=xt-Y,gt=xt-ie,xi=C-Xt;return ue?jm(xi,G-gt):xi}function Ye(xt){var Xt=xt-Y,gt=xt-ie;return Y===void 0||Xt>=C||Xt<0||ue&&gt>=G}function tt(){var xt=Fc();if(Ye(xt))return Qe(xt);a=setTimeout(tt,Ie(xt))}function Qe(xt){return a=void 0,te&&D?ke(xt):(D=B=void 0,ne)}function dt(){a!==void 0&&clearTimeout(a),ie=0,D=Y=B=a=void 0}function It(){return a===void 0?ne:Qe(Fc())}function ht(){var xt=Fc(),Xt=Ye(xt);if(D=arguments,B=this,Y=xt,Xt){if(a===void 0)return Se(Y);if(ue)return a=setTimeout(tt,C),ke(Y)}return a===void 0&&(a=setTimeout(tt,C)),ne}return ht.cancel=dt,ht.flush=It,ht}function Vc(b){var C=typeof b;return!!b&&(C=="object"||C=="function")}function Wm(b){return!!b&&typeof b=="object"}function Hm(b){return typeof b=="symbol"||Wm(b)&&qm.call(b)==Lm}function Nh(b){if(typeof b=="number")return b;if(Hm(b))return Vh;if(Vc(b)){var C=typeof b.valueOf=="function"?b.valueOf():b;b=Vc(C)?C+"":C}if(typeof b!="string")return b===0?b:+b;b=b.replace(Rm,"");var A=Fm.test(b);return A||Om.test(b)?Um(b.slice(2),A?2:8):Bm.test(b)?Vh:+b}var Km=Xm;const fp=()=>{const[b,C]=ve.exports.useState(!1);return ve.exports.useLayoutEffect(()=>{const A=()=>{C(window.innerWidth<Lf.screenSizes.mobileL)};return window.addEventListener("resize",Km(A,250)),A(),()=>window.removeEventListener("resize",A)},[]),b},Gh=mi.div`
580
- overflow-y: auto;
581
- `,Jm=mi.div`
582
- position: absolute;
583
- top: ${St["--ll-spacing-medium"]};
584
- left: ${St["--ll-spacing-medium"]};
585
- width: 360px;
586
- max-height: calc(100% - 2 * ${St["--ll-spacing-medium"]});
587
- z-index: 1;
588
- border-radius: ${St["--ll-border-radius-medium"]};
589
- box-shadow: rgba(0, 0, 0, 0.15) 0px 3px 8px;
590
- background-color: #fff;
591
- overflow: hidden;
592
- display: flex;
593
- flex-direction: column;
594
- background-color: ${St["--ll-color-background"]};
595
- border: 1px solid ${St["--ll-color-border"]};
596
- `,Ym=mi.div`
579
+ `,document.addEventListener("keydown",s=>{s.key===t&&(this._metaPress=!0)}),document.addEventListener("keyup",s=>{s.key===t&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",s=>{this._onCooperativeGesture(s,this._metaPress,1)},!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan")}_resizeCanvas(l,t,n){this._canvas.width=n*l,this._canvas.height=n*t,this._canvas.style.width=`${l}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const l=a.extend({},Y.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl",l)||this._canvas.getContext("experimental-webgl",l);t?(this.painter=new Cs(t,this.transform),a.exported$1.testSupport(t)):this.fire(new a.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(l){l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.Event("webglcontextlost",{originalEvent:l}))}_contextRestored(l){this._setupPainter(),this.resize(),this._update(),this.fire(new a.Event("webglcontextrestored",{originalEvent:l}))}_onMapScroll(l){if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(l,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(l){return this.style?(this._styleDirty=this._styleDirty||l,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(l){return this._update(),this._renderTaskQueue.add(l)}_cancelRenderFrame(l){this._renderTaskQueue.remove(l)}_render(l){let t,n=0;const s=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(t=s.createQueryEXT(),s.beginQueryEXT(s.TIME_ELAPSED_EXT,t),n=a.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(l),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const f=this.transform.zoom,_=a.exported.now();this.style.zoomHistory.update(f,_);const y=new a.EvaluationParameters(f,{now:_,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),v=y.crossFadingFactor();v===1&&v===this._crossFadingFactor||(u=!0,this._crossFadingFactor=v),this.style.update(y)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new a.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,a.PerformanceUtils.mark(a.PerformanceMarkers.load),this.fire(new a.Event("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const f=a.exported.now()-n;s.endQueryEXT(s.TIME_ELAPSED_EXT,t),setTimeout(()=>{const _=s.getQueryObjectEXT(t,s.QUERY_RESULT_EXT)/1e6;s.deleteQueryEXT(t),this.fire(new a.Event("gpu-timing-frame",{cpuTime:f,gpuTime:_}))},50)}if(this.listens("gpu-timing-layer")){const f=this.painter.collectGpuTimers();setTimeout(()=>{const _=this.painter.queryGpuTimers(f);this.fire(new a.Event("gpu-timing-layer",{layerTimes:_}))},50)}const p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new a.Event("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,a.PerformanceUtils.mark(a.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window!="undefined"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const l=this.painter.context.gl.getExtension("WEBGL_lose_context");l&&l.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ie.remove(this._canvasContainer),ie.remove(this._controlContainer),this._cooperativeGestures&&ie.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),a.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new a.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=a.exported.frame(l=>{a.PerformanceUtils.frame(l),this._frame=null,this._render(l)}))}_onWindowOnline(){this._update()}_onWindowResize(l){this._trackResize&&this.resize({originalEvent:l})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(l){this._showTileBoundaries!==l&&(this._showTileBoundaries=l,this._update())}get showPadding(){return!!this._showPadding}set showPadding(l){this._showPadding!==l&&(this._showPadding=l,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(l){this._showCollisionBoxes!==l&&(this._showCollisionBoxes=l,l?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(l){this._showOverdrawInspector!==l&&(this._showOverdrawInspector=l,this._update())}get repaint(){return!!this._repaint}set repaint(l){this._repaint!==l&&(this._repaint=l,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(l){this._vertices=l,this._update()}_setCacheLimits(l,t){a.setCacheLimits(l,t)}get version(){return"2.4.0"}},NavigationControl:class{constructor(l){this.options=a.extend({},Hl,l),this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(a.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),ie.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),ie.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(a.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=ie.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const l=this._map.getZoom(),t=l===this._map.getMaxZoom(),n=l===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const l=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=l}onAdd(l){return this._map=l,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._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new mr(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ie.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(l,t){const n=ie.create("button",l,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(l,t){const n=this._map._getUIString(`NavigationControl.${t}`);l.title=n,l.setAttribute("aria-label",n)}},GeolocateControl:class extends a.Evented{constructor(l){super(),this.options=a.extend({},Fs,l),a.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(l){var t;return this._map=l,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),t=this._setupUI,qr!==void 0?t(qr):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{qr=n.state!=="denied",t(qr)}):(qr=!!window.navigator.geolocation,t(qr)),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(),ie.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,mi=0,Zr=!1}_isOutOfMapMaxBounds(l){const t=this._map.getMaxBounds(),n=l.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","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(l){if(this._map){if(this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new a.Event("outofmaxbounds",l)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=l,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(l),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(l),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new a.Event("geolocate",l)),this._finish()}}_updateCamera(l){const t=new a.LngLat(l.coords.longitude,l.coords.latitude),n=l.coords.accuracy,s=this._map.getBearing(),u=a.extend({bearing:s},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),u,{geolocateSource:!0})}_updateMarker(l){if(l){const t=new a.LngLat(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=l.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const l=this._map._container.clientHeight/2,t=this._map.unproject([0,l]),n=this._map.unproject([1,l]),s=t.distanceTo(n),u=Math.ceil(2*this._accuracy/s);this._circleElement.style.width=`${u}px`,this._circleElement.style.height=`${u}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(l){if(this._map){if(this.options.trackUserLocation)if(l.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(l.code===3&&Zr)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new a.Event("error",l)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(l){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=ie.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),ie.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",l===!1){a.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ie.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new Fn(this._dotElement),this._circleElement=ie.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Fn({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new a.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return a.warnOnce("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 a.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":mi--,Zr=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new a.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-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 l;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),mi++,mi>1?(l={maximumAge:6e5,timeout:0},Zr=!0):(l=this.options.positionOptions,Zr=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,l)}}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","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:yo,LogoControl:Xo,ScaleControl:class{constructor(l){this.options=a.extend({},gr,l),a.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Wa(this._map,this._container,this.options)}onAdd(l){return this._map=l,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",l.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ie.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(l){this.options.unit=l,Wa(this._map,this._container,this.options)}},FullscreenControl:class{constructor(l){this._fullscreen=!1,l&&l.container&&(l.container instanceof HTMLElement?this._container=l.container:a.warnOnce("Full screen control 'container' must be a DOM element.")),a.bindAll(["_onClickFullscreen","_changeIcon"],this),"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(l){return this._map=l,this._container||(this._container=this._map.getContainer()),this._controlContainer=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){ie.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const l=this._fullscreenButton=ie.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);ie.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",l).setAttribute("aria-hidden","true"),l.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const l=this._getTitle();this._fullscreenButton.setAttribute("aria-label",l),this._fullscreenButton.title=l}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},TerrainControl:class{constructor(l){this.options=l,a.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(l){return this._map=l,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=ie.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),ie.create("span","maplibregl-ctrl-icon mapboxgl-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(){ie.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends a.Evented{constructor(l){super(),this.options=a.extend(Object.create(Xt),l),a.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(l){return this._map&&this.remove(),this._map=l,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new a.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&ie.remove(this._content),this._container&&(ie.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new a.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(l){return this._lngLat=a.LngLat.convert(l),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(l){return this.setDOMContent(document.createTextNode(l))}setHTML(l){const t=document.createDocumentFragment(),n=document.createElement("body");let s;for(n.innerHTML=l;s=n.firstChild,s;)t.appendChild(s);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(l){return this.options.maxWidth=l,this._update(),this}setDOMContent(l){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ie.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(l),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(l){this._container&&this._container.classList.add(l)}removeClassName(l){this._container&&this._container.classList.remove(l)}setOffset(l){return this.options.offset=l,this._update(),this}toggleClassName(l){if(this._container)return this._container.classList.toggle(l)}_createCloseButton(){this.options.closeButton&&(this._closeButton=ie.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(l){this._update(l.point)}_onMouseMove(l){this._update(l.point)}_onDrag(l){this._update(l.point)}_update(l){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=ie.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=ie.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(p=>this._container.classList.add(p)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=xo(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!l))return;const t=this._pos=this._trackPointer&&l?l:this._map.project(this._lngLat);let n=this.options.anchor;const s=Os(this.options.offset);if(!n){const p=this._container.offsetWidth,f=this._container.offsetHeight;let _;_=t.y+s.bottom.y<f?["top"]:t.y>this._map.transform.height-f?["bottom"]:[],t.x<p/2?_.push("left"):t.x>this._map.transform.width-p/2&&_.push("right"),n=_.length===0?"bottom":_.join("-")}const u=t.add(s[n]).round();ie.setTransform(this._container,`${Ze[n]} translate(${u.x}px,${u.y}px)`),Ye(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const l=this._container.querySelector(Yt);l&&l.focus()}_onClose(){this.remove()}},Marker:Fn,Style:_i,LngLat:a.LngLat,LngLatBounds:a.LngLatBounds,Point:a.pointGeometry,MercatorCoordinate:a.MercatorCoordinate,Evented:a.Evented,AJAXError:a.AJAXError,config:a.config,CanvasSource:Kr,GeoJSONSource:Bi,ImageSource:Ci,RasterDEMTileSource:Xe,RasterTileSource:pi,VectorTileSource:Rt,VideoSource:Ai,prewarm:function(){vn().acquire(br)},clearPrewarmedResources:function(){const l=Br;l&&(l.isPreloaded()&&l.numActive()===1?(l.release(br),Br=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()"))},get version(){return"2.4.0"},get workerCount(){return Fi.workerCount},set workerCount(l){Fi.workerCount=l},get maxParallelImageRequests(){return a.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(l){a.config.MAX_PARALLEL_IMAGE_REQUESTS=l},clearStorage(l){a.clearTileCache(l)},workerUrl:"",addProtocol(l,t){a.config.REGISTERED_PROTOCOLS[l]=t},removeProtocol(l){delete a.config.REGISTERED_PROTOCOLS[l]}};return Ji.extend(sn,{isSafari:a.isSafari,getPerformanceMetrics:a.PerformanceUtils.getPerformanceMetrics}),sn});var oe=F;return oe})})(rp);var sm=rp.exports;function op(b,I,A){A===void 0&&(A={});var D={type:"Feature"};return(A.id===0||A.id)&&(D.id=A.id),A.bbox&&(D.bbox=A.bbox),D.properties=I||{},D.geometry=b,D}function Dh(b,I,A){if(A===void 0&&(A={}),!b)throw new Error("coordinates is required");if(!Array.isArray(b))throw new Error("coordinates must be an Array");if(b.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Lh(b[0])||!Lh(b[1]))throw new Error("coordinates must contain numbers");var D={type:"Point",coordinates:b};return op(D,I,A)}function am(b,I,A){A===void 0&&(A={});var D={type:"MultiPoint",coordinates:b};return op(D,I,A)}function Lh(b){return!isNaN(b)&&b!==null&&!Array.isArray(b)}function sp(b,I,A){if(b!==null)for(var D,F,N,oe,a,Y,te,fe=0,ue=0,ie,Ge=b.type,$e=Ge==="FeatureCollection",Ue=Ge==="Feature",et=$e?b.features.length:1,Ke=0;Ke<et;Ke++){te=$e?b.features[Ke].geometry:Ue?b.geometry:b,ie=te?te.type==="GeometryCollection":!1,a=ie?te.geometries.length:1;for(var tt=0;tt<a;tt++){var lt=0,It=0;if(oe=ie?te.geometries[tt]:te,oe!==null){Y=oe.coordinates;var at=oe.type;switch(fe=A&&(at==="Polygon"||at==="MultiPolygon")?1:0,at){case null:break;case"Point":if(I(Y,ue,Ke,lt,It)===!1)return!1;ue++,lt++;break;case"LineString":case"MultiPoint":for(D=0;D<Y.length;D++){if(I(Y[D],ue,Ke,lt,It)===!1)return!1;ue++,at==="MultiPoint"&&lt++}at==="LineString"&&lt++;break;case"Polygon":case"MultiLineString":for(D=0;D<Y.length;D++){for(F=0;F<Y[D].length-fe;F++){if(I(Y[D][F],ue,Ke,lt,It)===!1)return!1;ue++}at==="MultiLineString"&&lt++,at==="Polygon"&&It++}at==="Polygon"&&lt++;break;case"MultiPolygon":for(D=0;D<Y.length;D++){for(It=0,F=0;F<Y[D].length;F++){for(N=0;N<Y[D][F].length-fe;N++){if(I(Y[D][F][N],ue,Ke,lt,It)===!1)return!1;ue++}It++}lt++}break;case"GeometryCollection":for(D=0;D<oe.geometries.length;D++)if(sp(oe.geometries[D],I,A)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Uc(b){var I=[1/0,1/0,-1/0,-1/0];return sp(b,function(A){I[0]>A[0]&&(I[0]=A[0]),I[1]>A[1]&&(I[1]=A[1]),I[2]<A[0]&&(I[2]=A[0]),I[3]<A[1]&&(I[3]=A[1])}),I}Uc.default=Uc;const lm={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0},cm=()=>{const[b,I]=Te.exports.useState(null),[A,D]=Te.exports.useState(lm),F=Te.exports.useMemo(()=>new window.ResizeObserver(N=>{if(N[0]){const{x:oe,y:a,width:Y,height:te,top:fe,left:ue,bottom:ie,right:Ge}=N[0].contentRect;D({x:oe,y:a,width:Y,height:te,top:fe,left:ue,bottom:ie,right:Ge})}}),[]);return Te.exports.useLayoutEffect(()=>{if(!!b)return F.observe(b),()=>{F.disconnect()}},[b]),[I,A,b]};var um="Expected a function",Rh=0/0,hm="[object Symbol]",pm=/^\s+|\s+$/g,dm=/^[-+]0x[0-9a-f]+$/i,fm=/^0b[01]+$/i,mm=/^0o[0-7]+$/i,gm=parseInt,_m=typeof sa=="object"&&sa&&sa.Object===Object&&sa,ym=typeof self=="object"&&self&&self.Object===Object&&self,xm=_m||ym||Function("return this")(),vm=Object.prototype,bm=vm.toString,wm=Math.max,Tm=Math.min,Bc=function(){return xm.Date.now()};function Em(b,I,A){var D,F,N,oe,a,Y,te=0,fe=!1,ue=!1,ie=!0;if(typeof b!="function")throw new TypeError(um);I=Bh(I)||0,Vc(A)&&(fe=!!A.leading,ue="maxWait"in A,N=ue?wm(Bh(A.maxWait)||0,I):N,ie="trailing"in A?!!A.trailing:ie);function Ge(gt){var ti=D,Kt=F;return D=F=void 0,te=gt,oe=b.apply(Kt,ti),oe}function $e(gt){return te=gt,a=setTimeout(Ke,I),fe?Ge(gt):oe}function Ue(gt){var ti=gt-Y,Kt=gt-te,ur=I-ti;return ue?Tm(ur,N-Kt):ur}function et(gt){var ti=gt-Y,Kt=gt-te;return Y===void 0||ti>=I||ti<0||ue&&Kt>=N}function Ke(){var gt=Bc();if(et(gt))return tt(gt);a=setTimeout(Ke,Ue(gt))}function tt(gt){return a=void 0,ie&&D?Ge(gt):(D=F=void 0,oe)}function lt(){a!==void 0&&clearTimeout(a),te=0,D=Y=F=a=void 0}function It(){return a===void 0?oe:tt(Bc())}function at(){var gt=Bc(),ti=et(gt);if(D=arguments,F=this,Y=gt,ti){if(a===void 0)return $e(Y);if(ue)return a=setTimeout(Ke,I),Ge(Y)}return a===void 0&&(a=setTimeout(Ke,I)),oe}return at.cancel=lt,at.flush=It,at}function Vc(b){var I=typeof b;return!!b&&(I=="object"||I=="function")}function Sm(b){return!!b&&typeof b=="object"}function Im(b){return typeof b=="symbol"||Sm(b)&&bm.call(b)==hm}function Bh(b){if(typeof b=="number")return b;if(Im(b))return Rh;if(Vc(b)){var I=typeof b.valueOf=="function"?b.valueOf():b;b=Vc(I)?I+"":I}if(typeof b!="string")return b===0?b:+b;b=b.replace(pm,"");var A=fm.test(b);return A||mm.test(b)?gm(b.slice(2),A?2:8):dm.test(b)?Rh:+b}var Cm=Em;const Am=()=>{const[b,I]=Te.exports.useState(!1);return Te.exports.useLayoutEffect(()=>{const A=()=>{I(window.innerWidth<Sf.screenSizes.mobileL)};return window.addEventListener("resize",Cm(A,250)),A(),()=>window.removeEventListener("resize",A)},[]),b},ap={all:()=>["pois"],list:b=>[...ap.all(),b]},{scorePois:Mm}=Co.Constants;function lp(){var a;const{client:b}=El(),{sdkState:I}=Sl(),A=qc(I.options,250),{activeScore:D}=Zn(),F=D?Mm[D]:void 0,oe={...Te.exports.useMemo(()=>A!=null&&A.marker?A.marker:{lat:A==null?void 0:A.lat,lng:A==null?void 0:A.lng},[A]),limit:10,radius:2e3,include:F};return Zc(ap.list(oe),async()=>b.getPois(oe),{enabled:!!oe&&!!((a=oe.include)!=null&&a.length)&&!!oe.lat&&!!oe.lng})}const cp={all:()=>["schools"],list:b=>[...cp.all(),b]};function up(){const{client:b}=El(),{sdkState:I}=Sl(),A=qc(I.options,250),F={...Te.exports.useMemo(()=>A!=null&&A.marker?A.marker:{lat:A==null?void 0:A.lat,lng:A==null?void 0:A.lng},[A]),limit:10,radius:2e3};return Zc(cp.list(F),async()=>b.getSchools(F),{enabled:!!F&&!!F.lat&&!!F.lng})}const hp=nt.createContext({}),pp=()=>Te.exports.useContext(hp),Pm=({children:b,mapRef:I,mapPadding:A})=>Se(hp.Provider,{value:{mapRef:I,mapPadding:A},children:b}),dp=nt.memo(({marker:b})=>Se($c,{latitude:b.lat,longitude:b.lng,style:{zIndex:1},children:Se(If.Root,{options:{style:"pin"}})}));dp.displayName="Pin";function Nc(b,I,A,D,F,N){if(F-D<=A)return;const oe=D+F>>1;fp(b,I,oe,D,F,N%2),Nc(b,I,A,D,oe-1,N+1),Nc(b,I,A,oe+1,F,N+1)}function fp(b,I,A,D,F,N){for(;F>D;){if(F-D>600){const te=F-D+1,fe=A-D+1,ue=Math.log(te),ie=.5*Math.exp(2*ue/3),Ge=.5*Math.sqrt(ue*ie*(te-ie)/te)*(fe-te/2<0?-1:1),$e=Math.max(D,Math.floor(A-fe*ie/te+Ge)),Ue=Math.min(F,Math.floor(A+(te-fe)*ie/te+Ge));fp(b,I,A,$e,Ue,N)}const oe=I[2*A+N];let a=D,Y=F;for(na(b,I,D,A),I[2*F+N]>oe&&na(b,I,D,F);a<Y;){for(na(b,I,a,Y),a++,Y--;I[2*a+N]<oe;)a++;for(;I[2*Y+N]>oe;)Y--}I[2*D+N]===oe?na(b,I,D,Y):(Y++,na(b,I,Y,F)),Y<=A&&(D=Y+1),A<=Y&&(F=Y-1)}}function na(b,I,A,D){Fc(b,A,D),Fc(I,2*A,2*D),Fc(I,2*A+1,2*D+1)}function Fc(b,I,A){const D=b[I];b[I]=b[A],b[A]=D}function zm(b,I,A,D,F,N,oe){const a=[0,b.length-1,0],Y=[];let te,fe;for(;a.length;){const ue=a.pop(),ie=a.pop(),Ge=a.pop();if(ie-Ge<=oe){for(let et=Ge;et<=ie;et++)te=I[2*et],fe=I[2*et+1],te>=A&&te<=F&&fe>=D&&fe<=N&&Y.push(b[et]);continue}const $e=Math.floor((Ge+ie)/2);te=I[2*$e],fe=I[2*$e+1],te>=A&&te<=F&&fe>=D&&fe<=N&&Y.push(b[$e]);const Ue=(ue+1)%2;(ue===0?A<=te:D<=fe)&&(a.push(Ge),a.push($e-1),a.push(Ue)),(ue===0?F>=te:N>=fe)&&(a.push($e+1),a.push(ie),a.push(Ue))}return Y}function km(b,I,A,D,F,N){const oe=[0,b.length-1,0],a=[],Y=F*F;for(;oe.length;){const te=oe.pop(),fe=oe.pop(),ue=oe.pop();if(fe-ue<=N){for(let et=ue;et<=fe;et++)Fh(I[2*et],I[2*et+1],A,D)<=Y&&a.push(b[et]);continue}const ie=Math.floor((ue+fe)/2),Ge=I[2*ie],$e=I[2*ie+1];Fh(Ge,$e,A,D)<=Y&&a.push(b[ie]);const Ue=(te+1)%2;(te===0?A-F<=Ge:D-F<=$e)&&(oe.push(ue),oe.push(ie-1),oe.push(Ue)),(te===0?A+F>=Ge:D+F>=$e)&&(oe.push(ie+1),oe.push(fe),oe.push(Ue))}return a}function Fh(b,I,A,D){const F=b-A,N=I-D;return F*F+N*N}const Dm=b=>b[0],Lm=b=>b[1];class Oh{constructor(I,A=Dm,D=Lm,F=64,N=Float64Array){this.nodeSize=F,this.points=I;const oe=I.length<65536?Uint16Array:Uint32Array,a=this.ids=new oe(I.length),Y=this.coords=new N(I.length*2);for(let te=0;te<I.length;te++)a[te]=te,Y[2*te]=A(I[te]),Y[2*te+1]=D(I[te]);Nc(a,Y,F,0,a.length-1,0)}range(I,A,D,F){return zm(this.ids,this.coords,I,A,D,F,this.nodeSize)}within(I,A,D){return km(this.ids,this.coords,I,A,D,this.nodeSize)}}const Rm={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:b=>b},wl=Math.fround||(b=>I=>(b[0]=+I,b[0]))(new Float32Array(1));class Bm{constructor(I){this.options=aa(Object.create(Rm),I),this.trees=new Array(this.options.maxZoom+1)}load(I){const{log:A,minZoom:D,maxZoom:F,nodeSize:N}=this.options;A&&console.time("total time");const oe=`prepare ${I.length} points`;A&&console.time(oe),this.points=I;let a=[];for(let Y=0;Y<I.length;Y++)!I[Y].geometry||a.push(Om(I[Y],Y));this.trees[F+1]=new Oh(a,Uh,Vh,N,Float32Array),A&&console.timeEnd(oe);for(let Y=F;Y>=D;Y--){const te=+Date.now();a=this._cluster(a,Y),this.trees[Y]=new Oh(a,Uh,Vh,N,Float32Array),A&&console.log("z%d: %d clusters in %dms",Y,a.length,+Date.now()-te)}return A&&console.timeEnd("total time"),this}getClusters(I,A){let D=((I[0]+180)%360+360)%360-180;const F=Math.max(-90,Math.min(90,I[1]));let N=I[2]===180?180:((I[2]+180)%360+360)%360-180;const oe=Math.max(-90,Math.min(90,I[3]));if(I[2]-I[0]>=360)D=-180,N=180;else if(D>N){const fe=this.getClusters([D,F,180,oe],A),ue=this.getClusters([-180,F,N,oe],A);return fe.concat(ue)}const a=this.trees[this._limitZoom(A)],Y=a.range(xl(D),vl(oe),xl(N),vl(F)),te=[];for(const fe of Y){const ue=a.points[fe];te.push(ue.numPoints?$h(ue):this.points[ue.index])}return te}getChildren(I){const A=this._getOriginId(I),D=this._getOriginZoom(I),F="No cluster with the specified id.",N=this.trees[D];if(!N)throw new Error(F);const oe=N.points[A];if(!oe)throw new Error(F);const a=this.options.radius/(this.options.extent*Math.pow(2,D-1)),Y=N.within(oe.x,oe.y,a),te=[];for(const fe of Y){const ue=N.points[fe];ue.parentId===I&&te.push(ue.numPoints?$h(ue):this.points[ue.index])}if(te.length===0)throw new Error(F);return te}getLeaves(I,A,D){A=A||10,D=D||0;const F=[];return this._appendLeaves(F,I,A,D,0),F}getTile(I,A,D){const F=this.trees[this._limitZoom(I)],N=Math.pow(2,I),{extent:oe,radius:a}=this.options,Y=a/oe,te=(D-Y)/N,fe=(D+1+Y)/N,ue={features:[]};return this._addTileFeatures(F.range((A-Y)/N,te,(A+1+Y)/N,fe),F.points,A,D,N,ue),A===0&&this._addTileFeatures(F.range(1-Y/N,te,1,fe),F.points,N,D,N,ue),A===N-1&&this._addTileFeatures(F.range(0,te,Y/N,fe),F.points,-1,D,N,ue),ue.features.length?ue:null}getClusterExpansionZoom(I){let A=this._getOriginZoom(I)-1;for(;A<=this.options.maxZoom;){const D=this.getChildren(I);if(A++,D.length!==1)break;I=D[0].properties.cluster_id}return A}_appendLeaves(I,A,D,F,N){const oe=this.getChildren(A);for(const a of oe){const Y=a.properties;if(Y&&Y.cluster?N+Y.point_count<=F?N+=Y.point_count:N=this._appendLeaves(I,Y.cluster_id,D,F,N):N<F?N++:I.push(a),I.length===D)break}return N}_addTileFeatures(I,A,D,F,N,oe){for(const a of I){const Y=A[a],te=Y.numPoints;let fe,ue,ie;if(te)fe=mp(Y),ue=Y.x,ie=Y.y;else{const Ue=this.points[Y.index];fe=Ue.properties,ue=xl(Ue.geometry.coordinates[0]),ie=vl(Ue.geometry.coordinates[1])}const Ge={type:1,geometry:[[Math.round(this.options.extent*(ue*N-D)),Math.round(this.options.extent*(ie*N-F))]],tags:fe};let $e;te?$e=Y.id:this.options.generateId?$e=Y.index:this.points[Y.index].id&&($e=this.points[Y.index].id),$e!==void 0&&(Ge.id=$e),oe.features.push(Ge)}}_limitZoom(I){return Math.max(this.options.minZoom,Math.min(Math.floor(+I),this.options.maxZoom+1))}_cluster(I,A){const D=[],{radius:F,extent:N,reduce:oe,minPoints:a}=this.options,Y=F/(N*Math.pow(2,A));for(let te=0;te<I.length;te++){const fe=I[te];if(fe.zoom<=A)continue;fe.zoom=A;const ue=this.trees[A+1],ie=ue.within(fe.x,fe.y,Y),Ge=fe.numPoints||1;let $e=Ge;for(const Ue of ie){const et=ue.points[Ue];et.zoom>A&&($e+=et.numPoints||1)}if($e>Ge&&$e>=a){let Ue=fe.x*Ge,et=fe.y*Ge,Ke=oe&&Ge>1?this._map(fe,!0):null;const tt=(te<<5)+(A+1)+this.points.length;for(const lt of ie){const It=ue.points[lt];if(It.zoom<=A)continue;It.zoom=A;const at=It.numPoints||1;Ue+=It.x*at,et+=It.y*at,It.parentId=tt,oe&&(Ke||(Ke=this._map(fe,!0)),oe(Ke,this._map(It)))}fe.parentId=tt,D.push(Fm(Ue/$e,et/$e,tt,$e,Ke))}else if(D.push(fe),$e>1)for(const Ue of ie){const et=ue.points[Ue];et.zoom<=A||(et.zoom=A,D.push(et))}}return D}_getOriginId(I){return I-this.points.length>>5}_getOriginZoom(I){return(I-this.points.length)%32}_map(I,A){if(I.numPoints)return A?aa({},I.properties):I.properties;const D=this.points[I.index].properties,F=this.options.map(D);return A&&F===D?aa({},F):F}}function Fm(b,I,A,D,F){return{x:wl(b),y:wl(I),zoom:1/0,id:A,parentId:-1,numPoints:D,properties:F}}function Om(b,I){const[A,D]=b.geometry.coordinates;return{x:wl(xl(A)),y:wl(vl(D)),zoom:1/0,index:I,parentId:-1}}function $h(b){return{type:"Feature",id:b.id,properties:mp(b),geometry:{type:"Point",coordinates:[$m(b.x),Um(b.y)]}}}function mp(b){const I=b.numPoints,A=I>=1e4?`${Math.round(I/1e3)}k`:I>=1e3?`${Math.round(I/100)/10}k`:I;return aa(aa({},b.properties),{cluster:!0,cluster_id:b.id,point_count:I,point_count_abbreviated:A})}function xl(b){return b/360+.5}function vl(b){const I=Math.sin(b*Math.PI/180),A=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return A<0?0:A>1?1:A}function $m(b){return(b-.5)*360}function Um(b){const I=(180-b*360)*Math.PI/180;return 360*Math.atan(Math.exp(I))/Math.PI-90}function aa(b,I){for(const A in I)b[A]=I[A];return b}function Uh(b){return b.x}function Vh(b){return b.y}var Nh=Object.prototype.hasOwnProperty;function Gh(b,I,A){for(A of b.keys())if(Io(A,I))return A}function Io(b,I){var A,D,F;if(b===I)return!0;if(b&&I&&(A=b.constructor)===I.constructor){if(A===Date)return b.getTime()===I.getTime();if(A===RegExp)return b.toString()===I.toString();if(A===Array){if((D=b.length)===I.length)for(;D--&&Io(b[D],I[D]););return D===-1}if(A===Set){if(b.size!==I.size)return!1;for(D of b)if(F=D,F&&typeof F=="object"&&(F=Gh(I,F),!F)||!I.has(F))return!1;return!0}if(A===Map){if(b.size!==I.size)return!1;for(D of b)if(F=D[0],F&&typeof F=="object"&&(F=Gh(I,F),!F)||!Io(D[1],I.get(F)))return!1;return!0}if(A===ArrayBuffer)b=new Uint8Array(b),I=new Uint8Array(I);else if(A===DataView){if((D=b.byteLength)===I.byteLength)for(;D--&&b.getInt8(D)===I.getInt8(D););return D===-1}if(ArrayBuffer.isView(b)){if((D=b.byteLength)===I.byteLength)for(;D--&&b[D]===I[D];);return D===-1}if(!A||typeof b=="object"){D=0;for(A in b)if(Nh.call(b,A)&&++D&&!Nh.call(I,A)||!(A in I)||!Io(b[A],I[A]))return!1;return Object.keys(I).length===D}}return b!==b&&I!==I}function Vm(b){var I=Te.exports.useRef(b),A=Te.exports.useRef(0);return Io(b,I.current)||(I.current=b,A.current+=1),Te.exports.useMemo(function(){return I.current},[A.current])}function Nm(b,I){return Te.exports.useEffect(b,Vm(I))}var Gm=function(I){var A=I.points,D=I.bounds,F=I.zoom,N=I.options,oe=Te.exports.useRef(),a=Te.exports.useRef(),Y=Te.exports.useState([]),te=Y[0],fe=Y[1],ue=Math.round(F);return Nm(function(){(!oe.current||!Io(a.current,A)||!Io(oe.current.options,N))&&(oe.current=new Bm(N),oe.current.load(A)),D&&fe(oe.current.getClusters(D,ue)),a.current=A},[A,D,ue,N]),{clusters:te,supercluster:oe.current}};const qm=Zt.div`
580
+ border-radius: 50%;
581
+ background: linear-gradient(
582
+ to top,
583
+ ${Tt["--ll-color-primary-variant1"]},
584
+ ${Tt["--ll-color-primary"]}
585
+ );
586
+ color: ${Tt["--ll-color-on-primary"]};
587
+ height: ${({diameter:b})=>b}px;
588
+ width: ${({diameter:b})=>b}px;
597
589
  display: flex;
598
590
  justify-content: center;
599
- padding: ${St["--ll-spacing-small"]};
600
- `,Qm=mi.div`
601
- padding: ${St["--ll-spacing-x-small"]};
602
- border-bottom: 1px solid ${St["--ll-color-border"]};
603
- `,eg=mi(Jh.div)`
604
- position: absolute;
605
- bottom: 0;
606
- left: 0;
607
- right: 0;
608
- max-height: calc(100% - 100px);
609
- overflow: ${({isOpen:b})=>b?"auto":"hidden"};
610
- border-radius: ${St["--ll-border-radius-medium"]}
611
- ${St["--ll-border-radius-medium"]} 0 0;
612
- box-shadow: rgb(0 0 0 / 15%) 0px -3px 8px;
613
- background-color: #fff;
614
- z-index: 2;
615
- overflow: hidden;
591
+ align-items: center;
592
+ line-height: 1;
593
+ font-family: ${Tt["--ll-font-family"]};
594
+ font-size: ${({diameter:b})=>b/2.5}px;
595
+ border: 2px solid #fff;
596
+ box-shadow: ${Tt["--ll-shadow-small"]};
597
+ cursor: default;
598
+ `,Zm=({cluster:b,pointsCount:I,onClick:A})=>{const D=b.properties.point_count,F=20+D/I*25;return Se(qm,{diameter:F,onClick:()=>A&&A(b),children:b.properties.point_count})};function jm(b){return b.properties.cluster!==void 0}const gp=nt.memo(({rect:b,zoom:I,mapRef:A,points:D,isMobile:F,activePOI:N,hoveredPOI:oe,isMapMoving:a,setActivePOI:Y})=>{var ie;const te=(ie=A==null?void 0:A.current)==null?void 0:ie.getMap().getBounds().toArray().flat(),{clusters:fe,supercluster:ue}=Gm({points:D,bounds:te,zoom:I,options:{radius:50,maxZoom:18}});return Se(Il,{children:fe.map((Ge,$e)=>{const[Ue,et]=Ge.geometry.coordinates;if(jm(Ge))return Se($c,{latitude:et,longitude:Ue,children:Se(Zm,{cluster:Ge,pointsCount:D.length,onClick:()=>{var gt;const at=Math.min(ue.getClusterExpansionZoom(Ge.id),20);(gt=A.current)==null||gt.flyTo({zoom:at,center:[Ue,et],duration:1e3})}})},`cluster-${Ge.id}`);const{poi:Ke,type:tt}=Ge.properties,lt=N===Ke,It=oe===Ke;return Se($c,{latitude:Ke.lat,longitude:Ke.lng,style:{zIndex:lt?1:0},children:Ri(Lc.Root,{options:{type:tt,poi:Ke,isOpen:a?!1:lt,isHovered:It,side:"top",collisionPadding:F?{top:b.height+32,bottom:os*2,left:os*2,right:os*2}:{left:b.width+32,right:os*2,top:os*2,bottom:os*2}},onChange:at=>{at.type==="open-change"&&at.data&&Y(Ke)},children:[Se(Lc.Marker,{}),Se(Lc.Content,{})]})},`${Ke.name}-${Ke.lat}-${Ke.lng}-${$e}`)})})});gp.displayName="Markers";const _p={all:()=>["scores"],list:b=>[..._p.all(),b]};function Hc(b){const{client:I}=El(),{sdkState:A}=Sl(),D=qc(A.options,250),N={...Te.exports.useMemo(()=>D!=null&&D.marker?D.marker:{lat:D==null?void 0:D.lat,lng:D==null?void 0:D.lng},[D]),geographyLevels:["10","30"],locationScoresRounding:!1,include:b};return Zc(_p.list(N),async()=>I.getScores(N),{enabled:!!N})}const Xm=Zt.div`
599
+ padding: ${Tt["--ll-spacing-small"]} ${Tt["--ll-spacing-medium"]};
600
+ background-color: ${Tt["--ll-color-surface"]};
616
601
  display: flex;
617
602
  flex-direction: column;
618
- background-color: ${St["--ll-color-background"]};
619
- border: 1px solid ${St["--ll-color-border"]};
620
- `,tg=mi.div`
621
- display: flex;
622
- justify-content: center;
623
- padding: ${St["--ll-spacing-small"]};
624
- `,ig=mi.div`
625
- position: absolute;
626
- top: ${St["--ll-spacing-x-small"]};
627
- left: ${St["--ll-spacing-x-small"]};
628
- right: ${St["--ll-spacing-x-small"]};
629
- padding: ${St["--ll-spacing-x-small"]};
630
- background-color: ${St["--ll-color-background"]};
631
- border-radius: ${St["--ll-border-radius-medium"]};
632
- box-shadow: rgba(0, 0, 0, 0.15) 0px 3px 8px;
633
- z-index: 1;
634
- `,rg=mi.div`
635
- height: 30px;
636
- width: 100%;
637
- position: relative;
638
-
639
- &:after {
640
- content: "";
641
- position: absolute;
642
- left: 50%;
643
- top: 50%;
644
- transform: translate(-50%, -50%);
645
- height: 4px;
646
- width: 40px;
647
- background-color: ${St["--ll-color-surface"]};
648
- }
649
- `,ng=mi(Jh.div)`
650
- display: flex;
651
- justify-content: center;
652
- `;function og(b){const C=b+"CollectionProvider",[A,D]=Gc(C),[B,G]=A(C,{collectionRef:{current:null},itemMap:new Map}),ne=ke=>{const{scope:Se,children:Ie}=ke,Ye=st.useRef(null),tt=st.useRef(new Map).current;return st.createElement(B,{scope:Se,itemMap:tt,collectionRef:Ye},Ie)},a=b+"CollectionSlot",Y=st.forwardRef((ke,Se)=>{const{scope:Ie,children:Ye}=ke,tt=G(a,Ie),Qe=Tl(Se,tt.collectionRef);return st.createElement(Eh,{ref:Qe},Ye)}),ie=b+"CollectionItemSlot",pe="data-radix-collection-item",ue=st.forwardRef((ke,Se)=>{const{scope:Ie,children:Ye,...tt}=ke,Qe=st.useRef(null),dt=Tl(Se,Qe),It=G(ie,Ie);return st.useEffect(()=>(It.itemMap.set(Qe,{ref:Qe,...tt}),()=>void It.itemMap.delete(Qe))),st.createElement(Eh,{[pe]:"",ref:dt},Ye)});function te(ke){const Se=G(b+"CollectionConsumer",ke);return st.useCallback(()=>{const Ye=Se.collectionRef.current;if(!Ye)return[];const tt=Array.from(Ye.querySelectorAll(`[${pe}]`));return Array.from(Se.itemMap.values()).sort((It,ht)=>tt.indexOf(It.ref.current)-tt.indexOf(ht.ref.current))},[Se.collectionRef,Se.itemMap])}return[{Provider:ne,Slot:Y,ItemSlot:ue},te,D]}const mp="Collapsible",[sg,gp]=Gc(mp),[ag,Kc]=sg(mp),lg=ve.exports.forwardRef((b,C)=>{const{__scopeCollapsible:A,open:D,defaultOpen:B,disabled:G,onOpenChange:ne,...a}=b,[Y=!1,ie]=Wc({prop:D,defaultProp:B,onChange:ne});return ve.exports.createElement(ag,{scope:A,disabled:G,contentId:ip(),open:Y,onOpenToggle:ve.exports.useCallback(()=>ie(pe=>!pe),[ie])},ve.exports.createElement(ca.div,cr({"data-state":Jc(Y),"data-disabled":G?"":void 0},a,{ref:C})))}),cg="CollapsibleTrigger",ug=ve.exports.forwardRef((b,C)=>{const{__scopeCollapsible:A,...D}=b,B=Kc(cg,A);return ve.exports.createElement(ca.button,cr({type:"button","aria-controls":B.contentId,"aria-expanded":B.open||!1,"data-state":Jc(B.open),"data-disabled":B.disabled?"":void 0,disabled:B.disabled},D,{ref:C,onClick:Yh(b.onClick,B.onOpenToggle)}))}),_p="CollapsibleContent",hg=ve.exports.forwardRef((b,C)=>{const{forceMount:A,...D}=b,B=Kc(_p,b.__scopeCollapsible);return ve.exports.createElement(Rf,{present:A||B.open},({present:G})=>ve.exports.createElement(pg,cr({},D,{ref:C,present:G})))}),pg=ve.exports.forwardRef((b,C)=>{const{__scopeCollapsible:A,present:D,children:B,...G}=b,ne=Kc(_p,A),[a,Y]=ve.exports.useState(D),ie=ve.exports.useRef(null),pe=Tl(C,ie),ue=ve.exports.useRef(0),te=ue.current,ke=ve.exports.useRef(0),Se=ke.current,Ie=ne.open||a,Ye=ve.exports.useRef(Ie),tt=ve.exports.useRef();return ve.exports.useEffect(()=>{const Qe=requestAnimationFrame(()=>Ye.current=!1);return()=>cancelAnimationFrame(Qe)},[]),Xh(()=>{const Qe=ie.current;if(Qe){tt.current=tt.current||{transitionDuration:Qe.style.transitionDuration,animationDuration:Qe.style.animationDuration,animationFillMode:Qe.style.animationFillMode},Qe.style.transitionDuration="0s",Qe.style.animationDuration="0s",Qe.style.animationFillMode="none";const dt=Qe.getBoundingClientRect();ue.current=dt.height,ke.current=dt.width,Ye.current||(Qe.style.transitionDuration=tt.current.transitionDuration,Qe.style.animationDuration=tt.current.animationDuration,Qe.style.animationFillMode=tt.current.animationFillMode),Y(D)}},[ne.open,D]),ve.exports.createElement(ca.div,cr({"data-state":Jc(ne.open),"data-disabled":ne.disabled?"":void 0,id:ne.contentId,hidden:!Ie},G,{ref:pe,style:{["--radix-collapsible-content-height"]:te?`${te}px`:void 0,["--radix-collapsible-content-width"]:Se?`${Se}px`:void 0,...b.style}}),Ie&&B)});function Jc(b){return b?"open":"closed"}const dg=lg,fg=ug,mg=hg,pa="Accordion",gg=["Home","End","ArrowDown","ArrowUp"],[Yc,_g,yg]=og(pa),[Cl,n_]=Gc(pa,[yg,gp]),Qc=gp(),yp=st.forwardRef((b,C)=>{const{type:A,...D}=b,B=D,G=D;return st.createElement(Yc.Provider,{scope:b.__scopeAccordion},A==="multiple"?st.createElement(wg,cr({},G,{ref:C})):st.createElement(bg,cr({},B,{ref:C})))});yp.propTypes={type(b){const C=b.value||b.defaultValue;return b.type&&!["single","multiple"].includes(b.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):b.type==="multiple"&&typeof C=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):b.type==="single"&&Array.isArray(C)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[xp,xg]=Cl(pa),[vp,vg]=Cl(pa,{collapsible:!1}),bg=st.forwardRef((b,C)=>{const{value:A,defaultValue:D,onValueChange:B=()=>{},collapsible:G=!1,...ne}=b,[a,Y]=Wc({prop:A,defaultProp:D,onChange:B});return st.createElement(xp,{scope:b.__scopeAccordion,value:a?[a]:[],onItemOpen:Y,onItemClose:st.useCallback(()=>G&&Y(""),[G,Y])},st.createElement(vp,{scope:b.__scopeAccordion,collapsible:G},st.createElement(bp,cr({},ne,{ref:C}))))}),wg=st.forwardRef((b,C)=>{const{value:A,defaultValue:D,onValueChange:B=()=>{},...G}=b,[ne=[],a]=Wc({prop:A,defaultProp:D,onChange:B}),Y=st.useCallback(pe=>a((ue=[])=>[...ue,pe]),[a]),ie=st.useCallback(pe=>a((ue=[])=>ue.filter(te=>te!==pe)),[a]);return st.createElement(xp,{scope:b.__scopeAccordion,value:ne,onItemOpen:Y,onItemClose:ie},st.createElement(vp,{scope:b.__scopeAccordion,collapsible:!0},st.createElement(bp,cr({},G,{ref:C}))))}),[Tg,Eg]=Cl(pa),bp=st.forwardRef((b,C)=>{const{__scopeAccordion:A,disabled:D,...B}=b,G=st.useRef(null),ne=Tl(G,C),a=_g(A),Y=Yh(b.onKeyDown,ie=>{var pe;if(!gg.includes(ie.key))return;const ue=ie.target,te=a().filter(tt=>{var Qe;return!((Qe=tt.ref.current)!==null&&Qe!==void 0&&Qe.disabled)}),ke=te.findIndex(tt=>tt.ref.current===ue),Se=te.length;if(ke===-1)return;ie.preventDefault();let Ie=ke;switch(ie.key){case"Home":Ie=0;break;case"End":Ie=Se-1;break;case"ArrowDown":Ie=ke+1;break;case"ArrowUp":Ie=ke-1,Ie<0&&(Ie=Se-1);break}const Ye=Ie%Se;(pe=te[Ye].ref.current)===null||pe===void 0||pe.focus()});return st.createElement(Tg,{scope:A,disabled:D},st.createElement(Yc.Slot,{scope:A},st.createElement(ca.div,cr({},B,{ref:ne,onKeyDown:D?void 0:Y}))))}),Nc="AccordionItem",[Sg,eu]=Cl(Nc),Ig=st.forwardRef((b,C)=>{const{__scopeAccordion:A,value:D,...B}=b,G=Eg(Nc,A),ne=xg(Nc,A),a=Qc(A),Y=ip(),ie=D&&ne.value.includes(D)||!1,pe=G.disabled||b.disabled;return st.createElement(Sg,{scope:A,open:ie,disabled:pe,triggerId:Y},st.createElement(dg,cr({"data-state":ie?"open":"closed"},a,B,{ref:C,disabled:pe,open:ie,onOpenChange:ue=>{ue?ne.onItemOpen(D):ne.onItemClose(D)}})))}),Cg="AccordionHeader",Ag=st.forwardRef((b,C)=>{const{__scopeAccordion:A,...D}=b,B=eu(Cg,A);return st.createElement(ca.h3,cr({"data-state":kg(B.open),"data-disabled":B.disabled?"":void 0},D,{ref:C}))}),qh="AccordionTrigger",Mg=st.forwardRef((b,C)=>{const{__scopeAccordion:A,...D}=b,B=eu(qh,A),G=vg(qh,A),ne=Qc(A);return st.createElement(Yc.ItemSlot,{scope:A},st.createElement(fg,cr({"aria-disabled":B.open&&!G.collapsible||void 0,id:B.triggerId},ne,D,{ref:C})))}),Pg="AccordionContent",zg=st.forwardRef((b,C)=>{const{__scopeAccordion:A,...D}=b,B=eu(Pg,A),G=Qc(A);return st.createElement(mg,cr({role:"region","aria-labelledby":B.triggerId},G,D,{ref:C,style:{["--radix-accordion-content-height"]:"var(--radix-collapsible-content-height)",["--radix-accordion-content-width"]:"var(--radix-collapsible-content-width)",...b.style}}))});function kg(b){return b?"open":"closed"}const Dg=yp,Lg=Ig,Rg=Ag,Bg=Mg,Fg=zg,wp={all:()=>["scores"],list:b=>[...wp.all(),b]};function Og(b){const{client:C}=ua(),{sdkState:A}=Sl(),D=qc(A.options,250),G={...ve.exports.useMemo(()=>D!=null&&D.marker?D.marker:{lat:D==null?void 0:D.lat,lng:D==null?void 0:D.lng},[D]),geographyLevels:["10","30"],locationScoresRounding:!1,include:b};return Zc(wp.list(G),async()=>C.getScores(G),{enabled:!!G})}const Ug=b=>ve.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...b},ve.exports.createElement("path",{d:"M9.99984 6L8.58984 7.41L13.1698 12L8.58984 16.59L9.99984 18L15.9998 12L9.99984 6Z"})),Tp={all:()=>["schools"],list:b=>[...Tp.all(),b]};function Ep(){const{client:b}=ua(),{sdkState:C}=Sl(),A=qc(C.options,250),B={...ve.exports.useMemo(()=>A!=null&&A.marker?A.marker:{lat:A==null?void 0:A.lat,lng:A==null?void 0:A.lng},[A]),limit:10,radius:2e3};return Zc(Tp.list(B),async()=>b.getSchools(B),{enabled:!!B&&!!B.lat&&!!B.lng})}const $g=Qh({from:{height:0},to:{height:"var(--radix-accordion-content-height)"}}),Vg=Qh({from:{height:"var(--radix-accordion-content-height)"},to:{height:0}}),Ng=mi(Rg)`
603
+ overflow: hidden;
604
+ flex: 1;
605
+ `,Wm=Zt.div`
606
+ display: grid;
607
+ grid-template-columns: min-content 1fr;
608
+ grid-gap: ${Tt["--ll-spacing-medium"]};
609
+ margin-bottom: ${Tt["--ll-spacing-medium"]};
610
+ `,Hm=Zt.div`
611
+ overflow: auto;
612
+ `;function Km(b){const I=b+"CollectionProvider",[A,D]=jc(I),[F,N]=A(I,{collectionRef:{current:null},itemMap:new Map}),oe=Ge=>{const{scope:$e,children:Ue}=Ge,et=nt.useRef(null),Ke=nt.useRef(new Map).current;return nt.createElement(F,{scope:$e,itemMap:Ke,collectionRef:et},Ue)},a=b+"CollectionSlot",Y=nt.forwardRef((Ge,$e)=>{const{scope:Ue,children:et}=Ge,Ke=N(a,Ue),tt=bl($e,Ke.collectionRef);return nt.createElement(Sh,{ref:tt},et)}),te=b+"CollectionItemSlot",fe="data-radix-collection-item",ue=nt.forwardRef((Ge,$e)=>{const{scope:Ue,children:et,...Ke}=Ge,tt=nt.useRef(null),lt=bl($e,tt),It=N(te,Ue);return nt.useEffect(()=>(It.itemMap.set(tt,{ref:tt,...Ke}),()=>void It.itemMap.delete(tt))),nt.createElement(Sh,{[fe]:"",ref:lt},et)});function ie(Ge){const $e=N(b+"CollectionConsumer",Ge);return nt.useCallback(()=>{const et=$e.collectionRef.current;if(!et)return[];const Ke=Array.from(et.querySelectorAll(`[${fe}]`));return Array.from($e.itemMap.values()).sort((It,at)=>Ke.indexOf(It.ref.current)-Ke.indexOf(at.ref.current))},[$e.collectionRef,$e.itemMap])}return[{Provider:oe,Slot:Y,ItemSlot:ue},ie,D]}const yp="Collapsible",[Jm,xp]=jc(yp),[Ym,Kc]=Jm(yp),Qm=Te.exports.forwardRef((b,I)=>{const{__scopeCollapsible:A,open:D,defaultOpen:F,disabled:N,onOpenChange:oe,...a}=b,[Y=!1,te]=Xc({prop:D,defaultProp:F,onChange:oe});return Te.exports.createElement(Ym,{scope:A,disabled:N,contentId:Yh(),open:Y,onOpenToggle:Te.exports.useCallback(()=>te(fe=>!fe),[te])},Te.exports.createElement(la.div,cr({"data-state":Jc(Y),"data-disabled":N?"":void 0},a,{ref:I})))}),eg="CollapsibleTrigger",tg=Te.exports.forwardRef((b,I)=>{const{__scopeCollapsible:A,...D}=b,F=Kc(eg,A);return Te.exports.createElement(la.button,cr({type:"button","aria-controls":F.contentId,"aria-expanded":F.open||!1,"data-state":Jc(F.open),"data-disabled":F.disabled?"":void 0,disabled:F.disabled},D,{ref:I,onClick:Hh(b.onClick,F.onOpenToggle)}))}),vp="CollapsibleContent",ig=Te.exports.forwardRef((b,I)=>{const{forceMount:A,...D}=b,F=Kc(vp,b.__scopeCollapsible);return Te.exports.createElement(Cf,{present:A||F.open},({present:N})=>Te.exports.createElement(rg,cr({},D,{ref:I,present:N})))}),rg=Te.exports.forwardRef((b,I)=>{const{__scopeCollapsible:A,present:D,children:F,...N}=b,oe=Kc(vp,A),[a,Y]=Te.exports.useState(D),te=Te.exports.useRef(null),fe=bl(I,te),ue=Te.exports.useRef(0),ie=ue.current,Ge=Te.exports.useRef(0),$e=Ge.current,Ue=oe.open||a,et=Te.exports.useRef(Ue),Ke=Te.exports.useRef();return Te.exports.useEffect(()=>{const tt=requestAnimationFrame(()=>et.current=!1);return()=>cancelAnimationFrame(tt)},[]),jh(()=>{const tt=te.current;if(tt){Ke.current=Ke.current||{transitionDuration:tt.style.transitionDuration,animationDuration:tt.style.animationDuration,animationFillMode:tt.style.animationFillMode},tt.style.transitionDuration="0s",tt.style.animationDuration="0s",tt.style.animationFillMode="none";const lt=tt.getBoundingClientRect();ue.current=lt.height,Ge.current=lt.width,et.current||(tt.style.transitionDuration=Ke.current.transitionDuration,tt.style.animationDuration=Ke.current.animationDuration,tt.style.animationFillMode=Ke.current.animationFillMode),Y(D)}},[oe.open,D]),Te.exports.createElement(la.div,cr({"data-state":Jc(oe.open),"data-disabled":oe.disabled?"":void 0,id:oe.contentId,hidden:!Ue},N,{ref:fe,style:{["--radix-collapsible-content-height"]:ie?`${ie}px`:void 0,["--radix-collapsible-content-width"]:$e?`${$e}px`:void 0,...b.style}}),Ue&&F)});function Jc(b){return b?"open":"closed"}const ng=Qm,og=tg,sg=ig,ua="Accordion",ag=["Home","End","ArrowDown","ArrowUp"],[Yc,lg,cg]=Km(ua),[Ml,i_]=jc(ua,[cg,xp]),Qc=xp(),bp=nt.forwardRef((b,I)=>{const{type:A,...D}=b,F=D,N=D;return nt.createElement(Yc.Provider,{scope:b.__scopeAccordion},A==="multiple"?nt.createElement(dg,cr({},N,{ref:I})):nt.createElement(pg,cr({},F,{ref:I})))});bp.propTypes={type(b){const I=b.value||b.defaultValue;return b.type&&!["single","multiple"].includes(b.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):b.type==="multiple"&&typeof I=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):b.type==="single"&&Array.isArray(I)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[wp,ug]=Ml(ua),[Tp,hg]=Ml(ua,{collapsible:!1}),pg=nt.forwardRef((b,I)=>{const{value:A,defaultValue:D,onValueChange:F=()=>{},collapsible:N=!1,...oe}=b,[a,Y]=Xc({prop:A,defaultProp:D,onChange:F});return nt.createElement(wp,{scope:b.__scopeAccordion,value:a?[a]:[],onItemOpen:Y,onItemClose:nt.useCallback(()=>N&&Y(""),[N,Y])},nt.createElement(Tp,{scope:b.__scopeAccordion,collapsible:N},nt.createElement(Ep,cr({},oe,{ref:I}))))}),dg=nt.forwardRef((b,I)=>{const{value:A,defaultValue:D,onValueChange:F=()=>{},...N}=b,[oe=[],a]=Xc({prop:A,defaultProp:D,onChange:F}),Y=nt.useCallback(fe=>a((ue=[])=>[...ue,fe]),[a]),te=nt.useCallback(fe=>a((ue=[])=>ue.filter(ie=>ie!==fe)),[a]);return nt.createElement(wp,{scope:b.__scopeAccordion,value:oe,onItemOpen:Y,onItemClose:te},nt.createElement(Tp,{scope:b.__scopeAccordion,collapsible:!0},nt.createElement(Ep,cr({},N,{ref:I}))))}),[fg,mg]=Ml(ua),Ep=nt.forwardRef((b,I)=>{const{__scopeAccordion:A,disabled:D,...F}=b,N=nt.useRef(null),oe=bl(N,I),a=lg(A),Y=Hh(b.onKeyDown,te=>{var fe;if(!ag.includes(te.key))return;const ue=te.target,ie=a().filter(Ke=>{var tt;return!((tt=Ke.ref.current)!==null&&tt!==void 0&&tt.disabled)}),Ge=ie.findIndex(Ke=>Ke.ref.current===ue),$e=ie.length;if(Ge===-1)return;te.preventDefault();let Ue=Ge;switch(te.key){case"Home":Ue=0;break;case"End":Ue=$e-1;break;case"ArrowDown":Ue=Ge+1;break;case"ArrowUp":Ue=Ge-1,Ue<0&&(Ue=$e-1);break}const et=Ue%$e;(fe=ie[et].ref.current)===null||fe===void 0||fe.focus()});return nt.createElement(fg,{scope:A,disabled:D},nt.createElement(Yc.Slot,{scope:A},nt.createElement(la.div,cr({},F,{ref:oe,onKeyDown:D?void 0:Y}))))}),Gc="AccordionItem",[gg,eu]=Ml(Gc),_g=nt.forwardRef((b,I)=>{const{__scopeAccordion:A,value:D,...F}=b,N=mg(Gc,A),oe=ug(Gc,A),a=Qc(A),Y=Yh(),te=D&&oe.value.includes(D)||!1,fe=N.disabled||b.disabled;return nt.createElement(gg,{scope:A,open:te,disabled:fe,triggerId:Y},nt.createElement(ng,cr({"data-state":te?"open":"closed"},a,F,{ref:I,disabled:fe,open:te,onOpenChange:ue=>{ue?oe.onItemOpen(D):oe.onItemClose(D)}})))}),yg="AccordionHeader",xg=nt.forwardRef((b,I)=>{const{__scopeAccordion:A,...D}=b,F=eu(yg,A);return nt.createElement(la.h3,cr({"data-state":Tg(F.open),"data-disabled":F.disabled?"":void 0},D,{ref:I}))}),qh="AccordionTrigger",vg=nt.forwardRef((b,I)=>{const{__scopeAccordion:A,...D}=b,F=eu(qh,A),N=hg(qh,A),oe=Qc(A);return nt.createElement(Yc.ItemSlot,{scope:A},nt.createElement(og,cr({"aria-disabled":F.open&&!N.collapsible||void 0,id:F.triggerId},oe,D,{ref:I})))}),bg="AccordionContent",wg=nt.forwardRef((b,I)=>{const{__scopeAccordion:A,...D}=b,F=eu(bg,A),N=Qc(A);return nt.createElement(sg,cr({role:"region","aria-labelledby":F.triggerId},N,D,{ref:I,style:{["--radix-accordion-content-height"]:"var(--radix-collapsible-content-height)",["--radix-accordion-content-width"]:"var(--radix-collapsible-content-width)",...b.style}}))});function Tg(b){return b?"open":"closed"}const Eg=bp,Sg=_g,Ig=xg,Cg=vg,Ag=wg,Mg=Kh({from:{height:0},to:{height:"var(--radix-accordion-content-height)"}}),Pg=Kh({from:{height:"var(--radix-accordion-content-height)"},to:{height:0}}),zg=Zt(Ig)`
653
613
  margin: 0;
654
- `,Sp=mi(Bg)`
614
+ `,Sp=Zt(Cg)`
655
615
  background: none;
656
616
  border: none;
657
617
  display: flex;
658
618
  align-items: center;
659
619
  width: 100%;
660
- padding: ${St["--ll-spacing-x-small"]} 0;
661
- `,Gg=mi(Fg)`
662
- background-color: ${St["--ll-color-surface"]};
620
+ padding: ${Tt["--ll-spacing-x-small"]} 0;
621
+ `,kg=Zt(Ag)`
622
+ background-color: ${Tt["--ll-color-surface"]};
663
623
  position: relative;
664
624
  z-index: 1;
665
625
  overflow: hidden;
666
- margin-left: calc(-1 * ${St["--ll-spacing-medium"]});
667
- margin-right: calc(-1 * ${St["--ll-spacing-medium"]});
626
+ margin-left: calc(-1 * ${Tt["--ll-spacing-medium"]});
627
+ margin-right: calc(-1 * ${Tt["--ll-spacing-medium"]});
668
628
 
669
629
  [data-state="open"] & {
670
- animation: ${$g} 300ms cubic-bezier(0.87, 0, 0.13, 1);
630
+ animation: ${Mg} 300ms cubic-bezier(0.87, 0, 0.13, 1);
671
631
  }
672
632
 
673
633
  [data-state="closed"] & {
674
- animation: ${Vg} 300ms cubic-bezier(0.87, 0, 0.13, 1);
634
+ animation: ${Pg} 300ms cubic-bezier(0.87, 0, 0.13, 1);
675
635
  }
676
- `,qg=mi.div`
677
- padding: ${St["--ll-spacing-medium"]};
678
- `,Zg=mi.span`
636
+ `,Dg=Zt.div`
637
+ padding: ${Tt["--ll-spacing-medium"]};
638
+ `,Lg=Zt.span`
679
639
  ${Sp}[data-state=open] & {
680
640
  transform: rotate(90deg);
681
641
  } ;
682
- `;mi.div`
642
+ `;Zt.div`
683
643
  display: flex;
684
644
  align-items: flex-start;
685
645
  justify-content: space-between;
686
- `;const tu=mi.div`
687
- margin: ${St["--ll-spacing-small"]} 0;
688
- `,jg=mi.div`
689
- margin-top: ${St["--ll-spacing-large"]};
646
+ `;const tu=Zt.div`
647
+ margin: ${Tt["--ll-spacing-small"]} 0;
648
+ `,Rg=Zt.div`
649
+ margin-top: ${Tt["--ll-spacing-large"]};
690
650
 
691
651
  &:empty {
692
652
  margin: 0;
693
653
  }
694
- `,Ip=st.createContext({}),Cp=()=>ve.exports.useContext(Ip),Xg=({children:b,mapRef:C,mapPadding:A})=>Ze(Ip.Provider,{value:{mapRef:C,mapPadding:A},children:b}),Wg=({score:b})=>{const{data:C,isLoading:A}=Ep(),{activePOI:D,setActivePOI:B,hoveredPOI:G,setHoveredPOI:ne}=as(),{mapRef:a,mapPadding:Y}=Cp();return A?Ze(jc,{children:[...Array(10)].map(ie=>Ze(tu,{children:Ze(Xc,{height:"34px",width:"100%"})},ie))}):C?Ze(ep.Root,{options:{type:"school",data:C==null?void 0:C[b],activePOI:D,hoveredPOI:G},onChange:ie=>{var pe;if(ie.type==="poi-click"){const ue=ie.data;B(ue),ue&&((pe=a.current)==null||pe.flyTo({zoom:18,center:[ue.lng,ue.lat],duration:1e3,padding:Y}))}ie.type==="poi-hover"&&ne(ie.data)}}):null},Ap={all:()=>["pois"],list:b=>[...Ap.all(),b]},{scorePois:Hg}=os.Constants;function Mp(){var a;const{client:b}=ua(),{sdkState:C}=Sl(),A=qc(C.options,250),{activeScore:D}=as(),B=Hg[D],ne={...ve.exports.useMemo(()=>A!=null&&A.marker?A.marker:{lat:A==null?void 0:A.lat,lng:A==null?void 0:A.lng},[A]),limit:10,radius:2e3,include:B};return Zc(Ap.list(ne),async()=>b.getPois(ne),{enabled:!!ne&&!!((a=ne.include)!=null&&a.length)&&!!ne.lat&&!!ne.lng})}const Pp=st.memo(({result:b,poi:C})=>{const{activePOI:A,setActivePOI:D,hoveredPOI:B,setHoveredPOI:G}=as(),{mapRef:ne,mapPadding:a}=Cp();return!b.data||!b.data[C]?null:Ze(os.Content,{options:{value:C},children:Ze(ep.Root,{options:{type:"poi",data:b.data[C],activePOI:A,hoveredPOI:B},onChange:Y=>{var ie;if(Y.type==="poi-click"){const pe=Y.data;D(pe),pe&&((ie=ne.current)==null||ie.flyTo({zoom:18,center:[pe.lng,pe.lat],duration:1e3,padding:a}))}Y.type==="poi-hover"&&G(Y.data)}})},C)});Pp.displayName="POI";const zp=st.memo(({include:b})=>{const C=Mp();return C.isLoading&&b.length?Ze(jc,{children:[...Array(10)].map((A,D)=>Ze(tu,{children:Ze(Xc,{height:"34px",width:"100%"})},D))}):C.data?xr(os.Root,{options:{include:b},children:[Ze(os.Tabs,{}),b.map(A=>Ze(Pp,{poi:A,result:C},A))]}):null});zp.displayName="POIs";const{scorePois:Kg}=os.Constants,kp=st.memo(({score:b,scoresResult:{isLoading:C,data:A}})=>C?Ze(tu,{children:Ze(Xc,{height:"34px",width:"100%"},b)}):Ze(Lg,{value:b,children:xr(rs.Root,{options:{score:b,data:A},children:[Ze(Ng,{children:xr(Sp,{children:[Ze(Zg,{children:Ze(Bf,{SVGElement:Ug,fill:St["--ll-color-on-background-variant1"]})}),Ze(vl,{spacing:"--ll-spacing-small"}),Ze(rs.Icon,{}),Ze(vl,{spacing:"--ll-spacing-small"}),Ze(rs.Title,{}),Ze(vl,{}),Ze(rs.Badge,{})]})}),Ze(Gg,{children:xr(qg,{children:[Ze(rs.Description,{}),Ze(rs.BarChart,{}),Ze(jg,{children:b==="high_schools"||b==="primary_schools"?Ze(Wg,{score:b}):Ze(zp,{include:Kg[b]})})]})})]})},b));kp.displayName="Score";const Jg=mi.div`
695
- padding: ${St["--ll-spacing-small"]} ${St["--ll-spacing-medium"]};
696
- `,Yg=mi.div`
654
+ `,Ip=nt.memo(({result:b,poi:I})=>{const{activePOI:A,setActivePOI:D,hoveredPOI:F,setHoveredPOI:N}=Zn(),{mapRef:oe,mapPadding:a}=pp();return!b.data||!b.data[I]?null:Se(Co.Content,{options:{value:I},children:Se(Jh.Root,{options:{type:"poi",data:b.data[I],activePOI:A,hoveredPOI:F},onChange:Y=>{var te;if(Y.type==="poi-click"){const fe=Y.data;D(fe);const ue=window.innerWidth-a.left,ie=window.innerWidth/2,Ge=ue/2+a.left-ie;fe&&((te=oe.current)==null||te.flyTo({zoom:18,center:[fe.lng,fe.lat],duration:1e3,offset:[Ge,0]}))}Y.type==="poi-hover"&&N(Y.data)}})},I)});Ip.displayName="POI";const iu=nt.memo(({include:b})=>{const I=lp();return I.isLoading&&b.length?Se(Il,{children:[...Array(10)].map((A,D)=>Se(tu,{children:Se(Cl,{height:"34px",width:"100%"})},D))}):I.data?Ri(Co.Root,{options:{include:b},children:[Se(Co.Tabs,{}),b.map(A=>Se(Ip,{poi:A,result:I},A))]}):null});iu.displayName="POIs";const Cp=({score:b})=>{const{data:I,isLoading:A}=up(),{activePOI:D,setActivePOI:F,hoveredPOI:N,setHoveredPOI:oe}=Zn(),{mapRef:a,mapPadding:Y}=pp();return A?Se(Il,{children:[...Array(10)].map(te=>Se(tu,{children:Se(Cl,{height:"34px",width:"100%"})},te))}):I?Se(Jh.Root,{options:{type:"school",data:I==null?void 0:I[b],activePOI:D,hoveredPOI:N},onChange:te=>{var fe;if(te.type==="poi-click"){const ue=te.data;F(ue);const ie=window.innerWidth-Y.left,Ge=window.innerWidth/2,$e=ie/2+Y.left-Ge;ue&&((fe=a.current)==null||fe.easeTo({zoom:18,center:[ue.lng,ue.lat],duration:1e3,offset:[$e,0]}))}te.type==="poi-hover"&&oe(te.data)}}):null},{scorePois:Zh}=Co.Constants,Bg=()=>{const{activeCategory:b,activeScore:I,showMobileList:A}=Zn(),D=Tl.find(a=>a.value===b),{data:F,isLoading:N}=Hc(D.scores),oe=a=>!A||!Zh[a].length?null:a==="high_schools"||a==="primary_schools"?Se(Cp,{score:a}):Se(iu,{include:Zh[a]});return I&&(F==null?void 0:F.location[I])?N?Se("div",{children:"Loading"}):Se(tr.Root,{options:{score:I,data:F},children:Ri(Xm,{children:[Ri(Wm,{children:[Se(tr.Badge,{}),Se(tr.BarChart,{})]}),Se(tr.Description,{}),Se(Hm,{children:oe(I)})]})}):null},Fg=Zt.div`
655
+ display: flex;
656
+ flex-direction: column;
657
+ `,Og=Zt.div`
658
+ display: flex;
659
+ `,$g=Zt.button`
660
+ position: relative;
661
+ display: flex;
662
+ flex-direction: column;
663
+ justify-content: center;
664
+ align-items: center;
665
+ background: none;
666
+ border: none;
667
+ width: 108px;
668
+ margin: 0;
669
+ padding: 0;
670
+ margin: 0 4px;
671
+ `,Ug=Zt.div`
672
+ position: absolute;
673
+ top: -6px;
674
+ right: 4px;
675
+ border: 2px solid ${Tt["--ll-color-background"]};
676
+ border-radius: 6px;
677
+ `,Vg=({category:b})=>{const{data:I,isLoading:A}=Hc(b.scores),{activeScore:D,setActiveScore:F,setActiveCategory:N,setShowMobileList:oe}=Zn();return A?Se(Cl,{height:"34px",width:"50px"}):Se(Ih.Root,{options:{scoreCategory:b.value},children:Ri(Fg,{children:[Se(Ih.Title,{options:{variant:"caption2",color:"--ll-color-disabled",weight:"--ll-font-weight-bold"}}),Se(Og,{children:b.scores.map(a=>{const Y=a===D,te=Y?"--ll-color-primary":"--ll-color-disabled";return Se(tr.Root,{options:{score:a,data:I},children:Ri($g,{onClick:()=>{oe(!1),N(b.value),F(a)},children:[Se(tr.Icon,{options:{color:te}}),Se(tr.Title,{options:{variant:"caption1",color:te,noWrap:!0,noMargin:!0,weight:"--ll-font-weight-bold"}}),Se(Ug,{children:Se(tr.Badge,{options:{variant:"small",isPrimary:Y}})})]})},a)})})]})},b.value)},Ng=Zt.div`
678
+ position: absolute;
679
+ top: 0;
680
+ left: 0;
681
+ right: 0;
682
+ bottom: ${({showMobileList:b})=>b&&0};
683
+ z-index: 3;
684
+ box-shadow: rgba(0, 0, 0, 0.15) 0px 3px 8px;
685
+ background-color: #fff;
686
+ overflow: hidden;
687
+ display: flex;
688
+ flex-direction: column;
689
+ background-color: ${Tt["--ll-color-background"]};
690
+ border: 1px solid ${Tt["--ll-color-border"]};
691
+ `,Gg=Zt.div`
692
+ display: flex;
693
+ overflow-x: scroll;
694
+ padding: ${Tt["--ll-spacing-xx-small"]} ${Tt["--ll-spacing-medium"]};
695
+ flex-shrink: 0;
696
+ `,Ap=nt.forwardRef(({showMobileList:b},I)=>Ri(Ng,{ref:I,showMobileList:b,children:[Se(Gg,{children:Tl.map(A=>Se(Vg,{category:A},A.value))}),Se(Bg,{})]}));Ap.displayName="MobileScores";const qg=b=>Te.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...b},Te.exports.createElement("path",{d:"M9.99984 6L8.58984 7.41L13.1698 12L8.58984 16.59L9.99984 18L15.9998 12L9.99984 6Z"})),{scorePois:Zg}=Co.Constants,Mp=nt.memo(({score:b,isLoading:I,data:A})=>I?Se(tu,{children:Se(Cl,{height:"34px",width:"100%"},b)}):Se(Sg,{value:b,children:Ri(tr.Root,{options:{score:b,data:A},children:[Se(zg,{children:Ri(Sp,{children:[Se(Lg,{children:Se(Af,{SVGElement:qg,fill:Tt["--ll-color-on-background-variant1"]})}),Se(oa,{spacing:"--ll-spacing-small"}),Se(tr.Icon,{}),Se(oa,{spacing:"--ll-spacing-small"}),Se(tr.Title,{}),Se(oa,{}),Se(tr.Badge,{})]})}),Se(kg,{children:Ri(Dg,{children:[Se(tr.Description,{}),Se(oa,{vertical:!0,spacing:"--ll-spacing-small"}),Se(tr.BarChart,{}),Se(Rg,{children:b==="high_schools"||b==="primary_schools"?Se(Cp,{score:b}):Se(iu,{include:Zg[b]})})]})})]})},b));Mp.displayName="Score";const jg=Zt.div`
697
+ padding: ${Tt["--ll-spacing-small"]} ${Tt["--ll-spacing-medium"]};
698
+ `,Xg=Zt.div`
697
699
  display: flex;
698
700
  justify-content: space-between;
699
701
  align-items: center;
700
- `,Zh=({tabContent:b})=>{var ne;const{client:C}=ua(),A=Og(b.scores),{activeScore:D,setActiveScore:B}=as(),G=ve.exports.useMemo(()=>C.options.locale==="fr"?"Aucune donn\xE9e disponible pour cet emplacement.":"No data available for this location.",[C.options.locale]);return Ze(Dg,{value:D,onValueChange:a=>B(a),type:"single",collapsible:!0,children:xr(Jg,{children:[xr(Yg,{children:[Ze(Gn.Title,{variant:"h4",noMargin:!0,weight:"--ll-font-weight-medium"}),A.isFetching&&!A.isLoading&&Ze(Ff,{size:"small"})]}),Ze(vl,{spacing:"--ll-spacing-small",vertical:!0}),!A.isFetching&&!Object.keys(((ne=A.data)==null?void 0:ne.location)||{}).length&&Ze(tp,{color:"--ll-color-on-background-variant1",children:G}),b.scores.map(a=>Ze(kp,{score:a,scoresResult:A},a))]})})},Dp=st.forwardRef(({rect:b},C)=>{const[A,D]=ve.exports.useState(!0),B=fp(),{client:G}=ua(),{activeCategory:ne,setActiveCategory:a}=as(),Y={open:{y:0},closed:{y:b.height-60}},ie={closed:{opacity:1},open:{opacity:0}},pe=ve.exports.useMemo(()=>G.options.locale==="fr"?"Explorez le quartier":"Explore neighbourhood insights",[G.options.locale]),ue=()=>xr(jc,{children:[Ze(ig,{children:Ze(Gn.Tabs,{})}),xr(eg,{ref:C,isOpen:A,animate:A?"open":"closed",variants:Y,drag:"y",dragMomentum:!1,dragConstraints:{top:0,bottom:200},dragElastic:{top:.1,bottom:.8},dragSnapToOrigin:!0,onDragEnd:(ke,Se)=>{if(Se.offset.y>50){D(!1);return}Se.offset.y<-50&&D(!0)},children:[Ze(rg,{}),xr(Gh,{children:[!A&&Ze(jf,{children:Ze(ng,{variants:ie,animate:A?"open":"closed",children:Ze(tp,{children:pe})})}),Gn.Constants.tabsContent.map(ke=>Ze(Gn.Content,{options:{value:ke.value},children:Ze(Zh,{tabContent:ke},ke.value)},ke.value))]}),Ze(tg,{children:Ze(Sh.Root,{})})]})]}),te=()=>xr(Jm,{ref:C,children:[Ze(Qm,{children:Ze(Gn.Tabs,{})}),Ze(Gh,{children:Gn.Constants.tabsContent.map(ke=>Ze(Gn.Content,{options:{value:ke.value},children:Ze(Zh,{tabContent:ke},ke.value)},ke.value))}),Ze(Ym,{children:Ze(Sh.Root,{})})]});return Ze(Gn.Root,{options:{currentTab:ne},onChange:ke=>{a(ke.data),D(!0)},children:B?ue():te()})});Dp.displayName="Scores";const Qg=mi.div`
701
- border-radius: 50%;
702
- background: linear-gradient(
703
- to top,
704
- ${St["--ll-color-primary-variant1"]},
705
- ${St["--ll-color-primary"]}
706
- );
707
- color: ${St["--ll-color-on-primary"]};
708
- height: ${({diameter:b})=>b}px;
709
- width: ${({diameter:b})=>b}px;
702
+ `,Pp=nt.memo(({locale:b,data:I,isLoading:A,isFetching:D,tabContent:F})=>{const N=Te.exports.useMemo(()=>b==="fr"?"Aucune donn\xE9e disponible pour cet emplacement.":"No data available for this location.",[b]);return Ri(jg,{children:[Ri(Xg,{children:[Se(yl.Title,{options:{variant:"h4",noMargin:!0,weight:"--ll-font-weight-medium"}}),D&&!A&&Se(Mf,{size:"small"})]}),Se(oa,{spacing:"--ll-spacing-small",vertical:!0}),!D&&!Object.keys((I==null?void 0:I.location)||{}).length&&Se(Pf,{color:"--ll-color-on-background-variant1",children:N}),F.scores.map(oe=>Se(Mp,{score:oe,data:I,isLoading:A},oe))]})});Pp.displayName="ScoreCategory";const zp=nt.memo(({tabContent:b})=>{const{client:I}=El(),{data:A,isLoading:D,isFetching:F}=Hc(b.scores),{activeScore:N,setActiveScore:oe}=Zn();return Se(Eg,{value:N,onValueChange:a=>{oe(a)},type:"single",collapsible:!0,children:Se(Pp,{data:A,isLoading:D,isFetching:F,tabContent:b,locale:I.options.locale})})});zp.displayName="ScoreCategoryAccordion";const Wg=Zt.div`
703
+ overflow-y: auto;
704
+ `,Hg=Zt.div`
705
+ position: absolute;
706
+ top: ${Tt["--ll-spacing-medium"]};
707
+ left: ${Tt["--ll-spacing-medium"]};
708
+ width: 360px;
709
+ max-height: calc(100% - 2 * ${Tt["--ll-spacing-medium"]});
710
+ z-index: 1;
711
+ border-radius: ${Tt["--ll-border-radius-medium"]};
712
+ box-shadow: rgba(0, 0, 0, 0.15) 0px 3px 8px;
713
+ background-color: #fff;
714
+ overflow: hidden;
715
+ display: flex;
716
+ flex-direction: column;
717
+ background-color: ${Tt["--ll-color-background"]};
718
+ border: 1px solid ${Tt["--ll-color-border"]};
719
+ `;Zt.div`
710
720
  display: flex;
711
721
  justify-content: center;
712
- align-items: center;
713
- line-height: 1;
714
- font-family: ${St["--ll-font-family"]};
715
- font-size: ${({diameter:b})=>b/2.5}px;
716
- border: 2px solid #fff;
717
- box-shadow: ${St["--ll-shadow-small"]};
718
- cursor: default;
719
- `,e_=({cluster:b,pointsCount:C,onClick:A})=>{const D=b.properties.point_count,B=20+D/C*25;return Ze(Qg,{diameter:B,onClick:()=>A&&A(b),children:b.properties.point_count})},{scorePois:jh}=os.Constants;function t_(b){return b.properties.cluster!==void 0}const i_=()=>{var Xt,gt,xi,zi;const{sdkState:b,setSdkState:C}=Sl(),{activeScore:A,activePOI:D,setActivePOI:B,hoveredPOI:G}=as(),ne=fp(),a=Mp(),Y=Ep(),ie=((gt=(Xt=b==null?void 0:b.globalOptions)==null?void 0:Xt.appearance)==null?void 0:gt.theme)==="night"?"streets-dark":"streets",[pe,ue]=ve.exports.useState(!1),te=ve.exports.useMemo(()=>{var _t;return(A==="high_schools"||A==="primary_schools")&&!Y.isFetching?{[A]:((_t=Y==null?void 0:Y.data)==null?void 0:_t[A])||[]}:!(jh[A]&&jh[A].length)&&!a.isFetching?{[A]:[]}:a.data},[a.data,Y.data,A]),ke=ve.exports.useMemo(()=>te?Object.entries(te).map(([Wt,ei])=>ei.map(Ht=>kh([Ht.lng,Ht.lat],{poi:Ht,type:Wt}))).flat().filter((Wt,ei,Ht)=>Ht.findIndex(Kt=>["lat","lng","name"].every(He=>Kt.properties.poi[He]===Wt.properties.poi[He]))===ei):[],[te]),Se=ve.exports.useMemo(()=>{var Wt,ei,Ht;const _t=((Wt=b==null?void 0:b.options)==null?void 0:Wt.marker)&&kh([(ei=b==null?void 0:b.options)==null?void 0:ei.marker.lng,(Ht=b==null?void 0:b.options)==null?void 0:Ht.marker.lat]);return[...ke,..._t?[_t]:[]]},[ke,(xi=b==null?void 0:b.options)==null?void 0:xi.marker]),Ie=ve.exports.useRef(),[Ye,tt]=km(),Qe=ve.exports.useMemo(()=>{const _t=ne?25:50;return{top:_t,bottom:_t,left:ne?_t:tt.width+32+_t,right:_t}},[ne,tt.width]),dt=(zi=Ie==null?void 0:Ie.current)==null?void 0:zi.getMap().getBounds().toArray().flat(),{clusters:It,supercluster:ht}=Pm({points:ke,bounds:dt,zoom:b.options.zoom,options:{radius:50,maxZoom:18}}),xt=_t=>{C({...b,options:{...b.options,lat:_t.viewState.latitude,lng:_t.viewState.longitude,zoom:_t.viewState.zoom,bearing:_t.viewState.bearing,pitch:_t.viewState.pitch}})};return ve.exports.useEffect(()=>{var He,vi;if(!Se.length||!((He=b.options)!=null&&He.marker))return;const _t=_m(Se.map(({geometry:ki})=>[ki.coordinates[1],ki.coordinates[0]])),[Wt,ei,Ht,Kt]=Uc(_t);(vi=Ie==null?void 0:Ie.current)==null||vi.fitBounds([[ei,Wt],[Kt,Ht]],{maxZoom:17,padding:Qe,duration:1e3})},[Se,Qe]),b.options?Ze(Xg,{mapRef:Ie,mapPadding:Qe,children:xr(Hc,{ref:Ie,mapLib:gm,latitude:b.options.lat,longitude:b.options.lng,zoom:b.options.zoom,pitch:b.options.pitch,bearing:b.options.bearing,style:{height:"100vh",width:"100vw"},mapStyle:`https://api.maptiler.com/maps/${ie}/style.json?key=KJ8IWUkGS9G824exx27J`,onMove:xt,cooperativeGestures:b.options.cooperativeGestures,onMoveStart:()=>ue(!0),onMoveEnd:()=>ue(!1),children:[Ze(fm,{showCompass:!0,style:ne?{marginTop:"85px",marginRight:"8px"}:{marginTop:"16px",marginRight:"16px"}}),b.options.marker&&Ze(Rc,{latitude:b.options.marker.lat,longitude:b.options.marker.lng,style:{zIndex:1},children:Ze(Of.Root,{options:{style:"pin"}})}),It.map((_t,Wt)=>{const[ei,Ht]=_t.geometry.coordinates;if(t_(_t))return Ze(Rc,{latitude:Ht,longitude:ei,children:Ze(e_,{cluster:_t,pointsCount:ke.length,onClick:()=>{var Di;const Ii=Math.min(ht.getClusterExpansionZoom(_t.id),20);(Di=Ie.current)==null||Di.flyTo({zoom:Ii,center:[ei,Ht],duration:1e3})}})},`cluster-${_t.id}`);const{poi:Kt,type:He}=_t.properties,vi=D===Kt,ki=G===Kt;return Ze(Rc,{latitude:Kt.lat,longitude:Kt.lng,style:{zIndex:vi?1:0},children:xr(kc.Root,{options:{type:He,poi:Kt,isOpen:pe?!1:vi,isHovered:ki,side:"top",collisionPadding:ne?{top:65,bottom:65,left:oa*2,right:oa*2}:{left:tt.width+32,right:oa*2,top:oa*2,bottom:oa*2}},onChange:Ii=>{Ii.type==="open-change"&&B(vi?void 0:Kt)},children:[Ze(kc.Marker,{}),Ze(kc.Content,{})]})},`${Kt.name}-${Kt.lat}-${Kt.lng}-${Wt}`)}),Ze(Dp,{ref:Ye,rect:tt})]})}):Ze("div",{children:"No options provided."})},o_=()=>Ze(Xf,{children:Ze(i_,{})});export{o_ as default};
722
+ padding: ${Tt["--ll-spacing-small"]};
723
+ `;const Kg=Zt.div`
724
+ padding: ${Tt["--ll-spacing-x-small"]};
725
+ border-bottom: 1px solid ${Tt["--ll-color-border"]};
726
+ `,Jg=Zt.div`
727
+ display: flex;
728
+ justify-content: center;
729
+ padding: ${Tt["--ll-spacing-small"]};
730
+ background-color: ${Tt["--ll-color-background"]};
731
+ `,kp=()=>Se(Jg,{children:Se(zf.Root,{})}),Dp=nt.forwardRef((b,I)=>{const{activeCategory:A,setActiveCategory:D,setShowMobileList:F}=Zn();return Se(yl.Root,{options:{currentTab:A},onChange:N=>{D(N.data)},children:Ri(Hg,{ref:I,children:[Se(Kg,{children:Se(yl.Tabs,{})}),Se(Wg,{children:Tl.map(N=>Se(yl.Content,{options:{value:N.value},children:Se(zp,{tabContent:N},N.value)},N.value))}),Se(kp,{})]})})});Dp.displayName="DesktopScores";const Yg=Zt.div`
732
+ position: relative;
733
+ display: flex;
734
+ flex-direction: column;
735
+ height: 100vh;
736
+ `,Qg=Zt.div`
737
+ position: absolute;
738
+ bottom: 86px;
739
+ left: 50%;
740
+ transform: translateX(-50%);
741
+ z-index: 3;
742
+ box-shadow: ${Tt["--ll-shadow-medium"]};
743
+ `,{scorePois:Oc}=Co.Constants,e_=()=>{var ur,Wi,hr,Hi;const{sdkState:b,setSdkState:I}=Sl(),{activeScore:A,activePOI:D,setActivePOI:F,hoveredPOI:N,showMobileList:oe,setShowMobileList:a}=Zn(),Y=Am(),te=lp(),fe=up(),ue=((Wi=(ur=b==null?void 0:b.globalOptions)==null?void 0:ur.appearance)==null?void 0:Wi.theme)==="night"?"streets-dark":"streets",[ie,Ge]=Te.exports.useState(!1),$e=Te.exports.useMemo(()=>{var Rt;return(A==="high_schools"||A==="primary_schools")&&!fe.isFetching?{[A]:((Rt=fe==null?void 0:fe.data)==null?void 0:Rt[A])||[]}:!(A&&Oc[A]&&Oc[A].length)&&!te.isFetching?{[A]:[]}:te.data},[te.data,fe.data,A]),Ue=Te.exports.useMemo(()=>$e?Object.entries($e).map(([pi,di])=>di.map(Xe=>Dh([Xe.lng,Xe.lat],{poi:Xe,type:pi}))).flat().filter((pi,di,Xe)=>Xe.findIndex(Bi=>["lat","lng","name"].every(wi=>Bi.properties.poi[wi]===pi.properties.poi[wi]))===di):[],[$e]),et=Te.exports.useMemo(()=>{var pi,di,Xe;const Rt=((pi=b==null?void 0:b.options)==null?void 0:pi.marker)&&Dh([(di=b==null?void 0:b.options)==null?void 0:di.marker.lng,(Xe=b==null?void 0:b.options)==null?void 0:Xe.marker.lat]);return[...Ue,...Rt?[Rt]:[]]},[Ue,(hr=b==null?void 0:b.options)==null?void 0:hr.marker]),Ke=Te.exports.useRef(),[tt,lt]=cm(),It=Te.exports.useMemo(()=>({top:25+lt.height,bottom:25,left:25,right:25}),[lt.height]),at=Te.exports.useMemo(()=>({top:50,bottom:50,left:lt.width+32+50,right:50}),[lt.width]),gt=Y?It:at,ti=Rt=>{I({...b,options:{...b.options,lat:Rt.viewState.latitude,lng:Rt.viewState.longitude,zoom:Rt.viewState.zoom,bearing:Rt.viewState.bearing,pitch:Rt.viewState.pitch}})};Te.exports.useEffect(()=>{var wi,Ci;if(!et.length||!((wi=b.options)!=null&&wi.marker))return;const Rt=am(et.map(({geometry:Ai})=>[Ai.coordinates[1],Ai.coordinates[0]])),[pi,di,Xe,Bi]=Uc(Rt);(Ci=Ke==null?void 0:Ke.current)==null||Ci.fitBounds([[di,pi],[Bi,Xe]],{maxZoom:17,padding:gt,duration:1e3})},[et,gt]);const Kt=Te.exports.useMemo(()=>{const{locale:Rt}=b.globalOptions;return oe?Rt==="en"?"Show Map":"Montrer la carte":Rt==="en"?"Show List":"Montrer la liste"},[(Hi=b.globalOptions)==null?void 0:Hi.locale,oe]);return b.options?Se(Pm,{mapRef:Ke,mapPadding:gt,children:Ri(Yg,{children:[Ri(Wc,{ref:Ke,mapLib:sm,latitude:b.options.lat,longitude:b.options.lng,zoom:b.options.zoom,pitch:b.options.pitch,bearing:b.options.bearing,style:{flex:1,width:"100vw"},mapStyle:`https://api.maptiler.com/maps/${ue}/style.json?key=KJ8IWUkGS9G824exx27J`,onMove:ti,cooperativeGestures:b.options.cooperativeGestures,onMoveStart:()=>Ge(!0),onMoveEnd:()=>Ge(!1),children:[Se(nm,{showCompass:!0,style:{marginTop:Y?16+lt.height:16,marginRight:16}}),b.options.marker&&Se(dp,{marker:b.options.marker}),Se(gp,{rect:lt,zoom:b.options.zoom,mapRef:Ke,points:Ue,isMobile:Y,activePOI:D,hoveredPOI:N,isMapMoving:ie,setActivePOI:F}),Y?Se(Ap,{ref:tt,showMobileList:oe}):Se(Dp,{ref:tt})]}),Y&&Ri(Il,{children:[Se(Qg,{children:A&&!!Oc[A].length&&Se(kf,{onClick:()=>a(Rt=>!Rt),size:"small",children:Kt})}),Se(kp,{})]})]})}):Se("div",{children:"No options provided."})},r_=()=>Se(Ff,{children:Se(e_,{})});export{r_ as default};