mobility-toolbox-js 3.1.1-beta.4 → 3.1.1-beta.6

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 (153) hide show
  1. package/index.d.ts +9 -0
  2. package/mbt.js +413 -411
  3. package/mbt.js.map +4 -4
  4. package/mbt.min.js +3 -3
  5. package/mbt.min.js.map +4 -4
  6. package/package.json +7 -7
  7. package/src/index.d.ts +14 -9
  8. package/.eslintrc.d.ts +0 -27
  9. package/.eslintrc.js +0 -32
  10. package/types/index.d.ts +0 -13
  11. package/{src/api → api}/HttpAPI.d.ts +0 -0
  12. package/{src/api → api}/HttpAPI.js +0 -0
  13. package/{src/api → api}/RealtimeAPI.d.ts +0 -0
  14. package/{src/api → api}/RealtimeAPI.js +0 -0
  15. package/{src/api → api}/RoutingAPI.d.ts +0 -0
  16. package/{src/api → api}/RoutingAPI.js +0 -0
  17. package/{src/api → api}/StopsAPI.d.ts +0 -0
  18. package/{src/api → api}/StopsAPI.js +0 -0
  19. package/{src/api → api}/WebSocketAPI.d.ts +0 -0
  20. package/{src/api → api}/WebSocketAPI.js +0 -0
  21. package/{src/api → api}/index.d.ts +0 -0
  22. package/{src/api → api}/index.js +0 -0
  23. package/{src/api → api}/typedefs.d.ts +0 -0
  24. package/{src/api → api}/typedefs.js +0 -0
  25. package/{src/common → common}/controls/StopFinderControlCommon.d.ts +0 -0
  26. package/{src/common → common}/controls/StopFinderControlCommon.js +0 -0
  27. package/{src/common → common}/index.d.ts +0 -0
  28. package/{src/common → common}/index.js +0 -0
  29. package/{src/common → common}/styles/index.d.ts +0 -0
  30. package/{src/common → common}/styles/index.js +0 -0
  31. package/{src/common → common}/styles/realtimeDefaultStyle.d.ts +0 -0
  32. package/{src/common → common}/styles/realtimeDefaultStyle.js +0 -0
  33. package/{src/common → common}/styles/realtimeDelayStyle.d.ts +0 -0
  34. package/{src/common → common}/styles/realtimeDelayStyle.js +0 -0
  35. package/{src/common → common}/styles/realtimeHeadingStyle.d.ts +0 -0
  36. package/{src/common → common}/styles/realtimeHeadingStyle.js +0 -0
  37. package/{src/common → common}/styles/realtimeSimpleStyle.d.ts +0 -0
  38. package/{src/common → common}/styles/realtimeSimpleStyle.js +0 -0
  39. package/{src/common → common}/typedefs.d.ts +0 -0
  40. package/{src/common → common}/typedefs.js +0 -0
  41. package/{src/common → common}/utils/RealtimeEngine.d.ts +0 -0
  42. package/{src/common → common}/utils/RealtimeEngine.js +0 -0
  43. package/{src/common → common}/utils/compareDepartures.d.ts +0 -0
  44. package/{src/common → common}/utils/compareDepartures.js +0 -0
  45. package/{src/common → common}/utils/constants.d.ts +0 -0
  46. package/{src/common → common}/utils/constants.js +0 -0
  47. package/{src/common → common}/utils/createCanvas.d.ts +0 -0
  48. package/{src/common → common}/utils/createCanvas.js +0 -0
  49. package/{src/common → common}/utils/createDefaultCopyrightElt.d.ts +0 -0
  50. package/{src/common → common}/utils/createDefaultCopyrightElt.js +0 -0
  51. package/{src/common → common}/utils/createDefaultStopFinderElt.d.ts +0 -0
  52. package/{src/common → common}/utils/createDefaultStopFinderElt.js +0 -0
  53. package/{src/common → common}/utils/createRealtimeFilters.d.ts +0 -0
  54. package/{src/common → common}/utils/createRealtimeFilters.js +0 -0
  55. package/{src/common → common}/utils/debounceDeparturesMessages.d.ts +0 -0
  56. package/{src/common → common}/utils/debounceDeparturesMessages.js +0 -0
  57. package/{src/common → common}/utils/debounceWebsocketMessages.d.ts +0 -0
  58. package/{src/common → common}/utils/debounceWebsocketMessages.js +0 -0
  59. package/{src/common → common}/utils/getLayersAsFlatArray.d.ts +0 -0
  60. package/{src/common → common}/utils/getLayersAsFlatArray.js +0 -0
  61. package/{src/common → common}/utils/getMapGlCopyrights.d.ts +0 -0
  62. package/{src/common → common}/utils/getMapGlCopyrights.js +0 -0
  63. package/{src/common → common}/utils/getRealtimeModeSuffix.d.ts +0 -0
  64. package/{src/common → common}/utils/getRealtimeModeSuffix.js +0 -0
  65. package/{src/common → common}/utils/getUrlWithParams.d.ts +0 -0
  66. package/{src/common → common}/utils/getUrlWithParams.js +0 -0
  67. package/{src/common → common}/utils/getVehiclePosition.d.ts +0 -0
  68. package/{src/common → common}/utils/getVehiclePosition.js +0 -0
  69. package/{src/common → common}/utils/index.d.ts +0 -0
  70. package/{src/common → common}/utils/index.js +0 -0
  71. package/{src/common → common}/utils/realtimeConfig.d.ts +0 -0
  72. package/{src/common → common}/utils/realtimeConfig.js +0 -0
  73. package/{src/common → common}/utils/removeDuplicate.d.ts +0 -0
  74. package/{src/common → common}/utils/removeDuplicate.js +0 -0
  75. package/{src/common → common}/utils/renderTrajectories.d.ts +0 -0
  76. package/{src/common → common}/utils/renderTrajectories.js +0 -0
  77. package/{src/common → common}/utils/sortAndFilterDepartures.d.ts +0 -0
  78. package/{src/common → common}/utils/sortAndFilterDepartures.js +0 -0
  79. package/{src/common → common}/utils/sortByDelay.d.ts +0 -0
  80. package/{src/common → common}/utils/sortByDelay.js +0 -0
  81. package/{src/common → common}/utils/timeUtils.d.ts +0 -0
  82. package/{src/common → common}/utils/timeUtils.js +0 -0
  83. package/{src/common → common}/utils/toMercatorExtent.d.ts +0 -0
  84. package/{src/common → common}/utils/toMercatorExtent.js +0 -0
  85. package/{src/iife.d.ts → iife.d.ts} +0 -0
  86. package/{src/iife.js → iife.js} +0 -0
  87. package/{src/index.js → index.js} +0 -0
  88. package/{src/maplibre → maplibre}/controls/CopyrightControl.d.ts +0 -0
  89. package/{src/maplibre → maplibre}/controls/CopyrightControl.js +0 -0
  90. package/{src/maplibre → maplibre}/controls/index.d.ts +0 -0
  91. package/{src/maplibre → maplibre}/controls/index.js +0 -0
  92. package/{src/maplibre → maplibre}/index.d.ts +0 -0
  93. package/{src/maplibre → maplibre}/index.js +0 -0
  94. package/{src/maplibre → maplibre}/layers/Layer.d.ts +0 -0
  95. package/{src/maplibre → maplibre}/layers/Layer.js +0 -0
  96. package/{src/maplibre → maplibre}/layers/RealtimeLayer.d.ts +0 -0
  97. package/{src/maplibre → maplibre}/layers/RealtimeLayer.js +0 -0
  98. package/{src/maplibre → maplibre}/layers/index.d.ts +0 -0
  99. package/{src/maplibre → maplibre}/layers/index.js +0 -0
  100. package/{src/maplibre → maplibre}/utils/getMercatorResolution.d.ts +0 -0
  101. package/{src/maplibre → maplibre}/utils/getMercatorResolution.js +0 -0
  102. package/{src/maplibre → maplibre}/utils/getSourceCoordinates.d.ts +0 -0
  103. package/{src/maplibre → maplibre}/utils/getSourceCoordinates.js +0 -0
  104. package/{src/maplibre → maplibre}/utils/index.d.ts +0 -0
  105. package/{src/maplibre → maplibre}/utils/index.js +0 -0
  106. package/{src/ol → ol}/controls/CopyrightControl.d.ts +0 -0
  107. package/{src/ol → ol}/controls/CopyrightControl.js +0 -0
  108. package/{src/ol → ol}/controls/RoutingControl.d.ts +0 -0
  109. package/{src/ol → ol}/controls/RoutingControl.js +0 -0
  110. package/{src/ol → ol}/controls/StopFinderControl.d.ts +0 -0
  111. package/{src/ol → ol}/controls/StopFinderControl.js +0 -0
  112. package/{src/ol → ol}/controls/index.d.ts +0 -0
  113. package/{src/ol → ol}/controls/index.js +0 -0
  114. package/{src/ol → ol}/index.d.ts +0 -0
  115. package/{src/ol → ol}/index.js +0 -0
  116. package/{src/ol → ol}/layers/Layer.d.ts +0 -0
  117. package/{src/ol → ol}/layers/Layer.js +0 -0
  118. package/{src/ol → ol}/layers/MaplibreLayer.d.ts +0 -0
  119. package/{src/ol → ol}/layers/MaplibreLayer.js +0 -0
  120. package/{src/ol → ol}/layers/MaplibreStyleLayer.d.ts +0 -0
  121. package/{src/ol → ol}/layers/MaplibreStyleLayer.js +0 -0
  122. package/{src/ol → ol}/layers/RealtimeLayer.d.ts +0 -0
  123. package/{src/ol → ol}/layers/RealtimeLayer.js +0 -0
  124. package/{src/ol → ol}/layers/VectorLayer.d.ts +0 -0
  125. package/{src/ol → ol}/layers/VectorLayer.js +0 -0
  126. package/{src/ol → ol}/layers/index.d.ts +1 -1
  127. package/{src/ol → ol}/layers/index.js +2 -2
  128. /package/{src/ol → ol}/renderers/MaplibreLayerRenderer.d.ts +0 -0
  129. /package/{src/ol → ol}/renderers/MaplibreLayerRenderer.js +0 -0
  130. /package/{src/ol → ol}/renderers/MaplibreStyleLayerRenderer.d.ts +0 -0
  131. /package/{src/ol → ol}/renderers/MaplibreStyleLayerRenderer.js +0 -0
  132. /package/{src/ol → ol}/renderers/RealtimeLayerRenderer.d.ts +0 -0
  133. /package/{src/ol → ol}/renderers/RealtimeLayerRenderer.js +0 -0
  134. /package/{src/ol → ol}/styles/fullTrajectoryDelayStyle.d.ts +0 -0
  135. /package/{src/ol → ol}/styles/fullTrajectoryDelayStyle.js +0 -0
  136. /package/{src/ol → ol}/styles/fullTrajectoryStyle.d.ts +0 -0
  137. /package/{src/ol → ol}/styles/fullTrajectoryStyle.js +0 -0
  138. /package/{src/ol → ol}/styles/index.d.ts +0 -0
  139. /package/{src/ol → ol}/styles/index.js +0 -0
  140. /package/{src/ol → ol}/styles/routingStyle.d.ts +0 -0
  141. /package/{src/ol → ol}/styles/routingStyle.js +0 -0
  142. /package/{src/ol → ol}/utils/defineDeprecatedProperties.d.ts +0 -0
  143. /package/{src/ol → ol}/utils/defineDeprecatedProperties.js +0 -0
  144. /package/{src/ol → ol}/utils/getFeatureInfoAtCoordinate.d.ts +0 -0
  145. /package/{src/ol → ol}/utils/getFeatureInfoAtCoordinate.js +0 -0
  146. /package/{src/ol → ol}/utils/index.d.ts +0 -0
  147. /package/{src/ol → ol}/utils/index.js +0 -0
  148. /package/{src/setupTests.d.ts → setupTests.d.ts} +0 -0
  149. /package/{src/setupTests.js → setupTests.js} +0 -0
  150. /package/{types → src}/common.d.ts +0 -0
  151. /package/{types → src}/realtime.d.ts +0 -0
  152. /package/{types → src}/routing.d.ts +0 -0
  153. /package/{types → src}/stops.d.ts +0 -0
package/mbt.min.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{var j2=Object.create;var ug=Object.defineProperty;var N2=Object.getOwnPropertyDescriptor;var G2=Object.getOwnPropertyNames;var V2=Object.getPrototypeOf,U2=Object.prototype.hasOwnProperty;var Np=(h,t)=>()=>(t||h((t={exports:{}}).exports,t),t.exports),dg=(h,t)=>{for(var r in t)ug(h,r,{get:t[r],enumerable:!0})},Z2=(h,t,r,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of G2(t))!U2.call(h,c)&&c!==r&&ug(h,c,{get:()=>t[c],enumerable:!(l=N2(t,c))||l.enumerable});return h};var Us=(h,t,r)=>(r=h!=null?j2(V2(h)):{},Z2(t||!h||!h.__esModule?ug(r,"default",{value:h,enumerable:!0}):r,h));var Qb=Np((aD,Jb)=>{"use strict";Jb.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var d0=Np((h0,u0)=>{(function(h,t){typeof h0=="object"&&typeof u0<"u"?u0.exports=t():typeof define=="function"&&define.amd?define(t):(h=typeof globalThis<"u"?globalThis:h||self,h.maplibregl=t())})(h0,function(){"use strict";var h={},t={};function r(c,n,x){if(t[c]=x,c==="index"){var b="var sharedModule = {}; ("+t.shared+")(sharedModule); ("+t.worker+")(sharedModule);",S={};return t.shared(S),t.index(h,S),typeof window<"u"&&h.setWorkerUrl(window.URL.createObjectURL(new Blob([b],{type:"text/javascript"}))),h}}r("shared",["exports"],function(c){"use strict";function n(a,i,o,u){return new(o||(o=Promise))(function(f,_){function y(I){try{C(u.next(I))}catch(L){_(L)}}function w(I){try{C(u.throw(I))}catch(L){_(L)}}function C(I){var L;I.done?f(I.value):(L=I.value,L instanceof o?L:new o(function(k){k(L)})).then(y,w)}C((u=u.apply(a,i||[])).next())})}function x(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var b,S;function R(){if(S)return b;function a(i,o){this.x=i,this.y=o}return S=1,b=a,a.prototype={clone:function(){return new a(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,o){return this.clone()._rotateAround(i,o)},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 o=i.x-this.x,u=i.y-this.y;return o*o+u*u},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,o){return Math.atan2(this.x*o-this.y*i,this.x*i+this.y*o)},_matMult:function(i){var o=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=o,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 o=Math.cos(i),u=Math.sin(i),f=u*this.x+o*this.y;return this.x=o*this.x-u*this.y,this.y=f,this},_rotateAround:function(i,o){var u=Math.cos(i),f=Math.sin(i),_=o.y+f*(this.x-o.x)+u*(this.y-o.y);return this.x=o.x+u*(this.x-o.x)-f*(this.y-o.y),this.y=_,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},a.convert=function(i){return i instanceof a?i:Array.isArray(i)?new a(i[0],i[1]):i},b}typeof SuppressedError=="function"&&SuppressedError;var E,A,z=x(R()),W=function(){if(A)return E;function a(i,o,u,f){this.cx=3*i,this.bx=3*(u-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(f-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=o,this.p2x=u,this.p2y=f}return A=1,E=a,a.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,o){if(o===void 0&&(o=1e-6),i<0)return 0;if(i>1)return 1;for(var u=i,f=0;f<8;f++){var _=this.sampleCurveX(u)-i;if(Math.abs(_)<o)return u;var y=this.sampleCurveDerivativeX(u);if(Math.abs(y)<1e-6)break;u-=_/y}var w=0,C=1;for(u=i,f=0;f<20&&(_=this.sampleCurveX(u),!(Math.abs(_-i)<o));f++)i>_?w=u:C=u,u=.5*(C-w)+w;return u},solve:function(i,o){return this.sampleCurveY(this.solveCurveX(i,o))}},E}(),re=x(W);let me,ge;function be(){return me==null&&(me=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),me}function ve(){if(ge==null&&(ge=!1,be())){let i=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(i){for(let u=0;u<5*5;u++){let f=4*u;i.fillStyle=`rgb(${f},${f+1},${f+2})`,i.fillRect(u%5,Math.floor(u/5),1,1)}let o=i.getImageData(0,0,5,5).data;for(let u=0;u<5*5*4;u++)if(u%4!=3&&o[u]!==u){ge=!0;break}}}return ge||!1}var De,ke=1e-6,je=typeof Float32Array<"u"?Float32Array:Array;function Re(){var a=new je(9);return je!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[5]=0,a[6]=0,a[7]=0),a[0]=1,a[4]=1,a[8]=1,a}function tt(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a}function Je(){var a=new je(3);return je!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0),a}function He(a,i,o){var u=new je(3);return u[0]=a,u[1]=i,u[2]=o,u}function ot(a,i,o){var u=i[0],f=i[1],_=i[2],y=i[3];return a[0]=o[0]*u+o[4]*f+o[8]*_+o[12]*y,a[1]=o[1]*u+o[5]*f+o[9]*_+o[13]*y,a[2]=o[2]*u+o[6]*f+o[10]*_+o[14]*y,a[3]=o[3]*u+o[7]*f+o[11]*_+o[15]*y,a}function vt(){var a=new je(4);return je!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0),a[3]=1,a}function ct(){var a=new je(2);return je!=Float32Array&&(a[0]=0,a[1]=0),a}function It(a,i){var o=new je(2);return o[0]=a,o[1]=i,o}Math.hypot||(Math.hypot=function(){for(var a=0,i=arguments.length;i--;)a+=arguments[i]*arguments[i];return Math.sqrt(a)}),Je(),De=new je(4),je!=Float32Array&&(De[0]=0,De[1]=0,De[2]=0,De[3]=0),Je(),He(1,0,0),He(0,1,0),vt(),vt(),Re(),ct();let ut=8192;function yt(a,i,o){return i*(ut/(a.tileSize*Math.pow(2,o-a.tileID.overscaledZ)))}function xt(a,i){return(a%i+i)%i}function dt(a,i,o){return a*(1-o)+i*o}function St(a){if(a<=0)return 0;if(a>=1)return 1;let i=a*a,o=i*a;return 4*(a<.5?o:3*(a-i)+o-.75)}function qt(a,i,o,u){let f=new re(a,i,o,u);return _=>f.solve(_)}let Ft=qt(.25,.1,.25,1);function Pt(a,i,o){return Math.min(o,Math.max(i,a))}function jt(a,i,o){let u=o-i,f=((a-i)%u+u)%u+i;return f===i?o:f}function $t(a,...i){for(let o of i)for(let u in o)a[u]=o[u];return a}let et=1;function Bi(a,i,o){let u={};for(let f in a)u[f]=i.call(this,a[f],f,a);return u}function Ai(a,i,o){let u={};for(let f in a)i.call(this,a[f],f,a)&&(u[f]=a[f]);return u}function Ci(a){return Array.isArray(a)?a.map(Ci):typeof a=="object"&&a?Bi(a,Ci):a}let en={};function _i(a){en[a]||(typeof console<"u"&&console.warn(a),en[a]=!0)}function ti(a,i,o){return(o.y-a.y)*(i.x-a.x)>(i.y-a.y)*(o.x-a.x)}function tn(a){return typeof WorkerGlobalScope<"u"&&a!==void 0&&a instanceof WorkerGlobalScope}let oi=null;function gn(a){return typeof ImageBitmap<"u"&&a instanceof ImageBitmap}let Ln="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Tr(a,i,o,u,f){return n(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let _=new VideoFrame(a,{timestamp:0});try{let y=_?.format;if(!y||!y.startsWith("BGR")&&!y.startsWith("RGB"))throw new Error(`Unrecognized format ${y}`);let w=y.startsWith("BGR"),C=new Uint8ClampedArray(u*f*4);if(yield _.copyTo(C,function(I,L,k,B,N){let G=4*Math.max(1,0),U=(Math.max(0,k)-k)*B*4+G,Y=4*B,te=Math.max(0,L),de=Math.max(0,k);return{rect:{x:te,y:de,width:Math.min(I.width,L+B)-te,height:Math.min(I.height,k+N)-de},layout:[{offset:U,stride:Y}]}}(a,i,o,u,f)),w)for(let I=0;I<C.length;I+=4){let L=C[I];C[I]=C[I+2],C[I+2]=L}return C}finally{_.close()}})}let $i,yi;function Li(a){return a/Math.PI*180}let rn="AbortError";function kn(){return new Error(rn)}let nn={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Dn(a){return nn.REGISTERED_PROTOCOLS[a.substring(0,a.indexOf("://"))]}let Qn="global-dispatcher";class Nr extends Error{constructor(i,o,u,f){super(`AJAXError: ${o} (${i}): ${u}`),this.status=i,this.statusText=o,this.url=u,this.body=f}}let sn=()=>tn(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,on=function(a,i){if(/:\/\//.test(a.url)&&!/^https?:|^file:/.test(a.url)){let u=Dn(a.url);if(u)return u(a,i);if(tn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:a,targetMapId:Qn},i)}if(!(/^file:/.test(o=a.url)||/^file:/.test(sn())&&!/^\w+:/.test(o))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(u,f){return n(this,void 0,void 0,function*(){let _=new Request(u.url,{method:u.method||"GET",body:u.body,credentials:u.credentials,headers:u.headers,cache:u.cache,referrer:sn(),signal:f.signal}),y,w;u.type!=="json"||_.headers.has("Accept")||_.headers.set("Accept","application/json");try{y=yield fetch(_)}catch(I){throw new Nr(0,I.message,u.url,new Blob)}if(!y.ok){let I=yield y.blob();throw new Nr(y.status,y.statusText,u.url,I)}w=u.type==="arrayBuffer"||u.type==="image"?y.arrayBuffer():u.type==="json"?y.json():y.text();let C=yield w;if(f.signal.aborted)throw kn();return{data:C,cacheControl:y.headers.get("Cache-Control"),expires:y.headers.get("Expires")}})}(a,i);if(tn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:a,mustQueue:!0,targetMapId:Qn},i)}var o;return function(u,f){return new Promise((_,y)=>{var w;let C=new XMLHttpRequest;C.open(u.method||"GET",u.url,!0),u.type!=="arrayBuffer"&&u.type!=="image"||(C.responseType="arraybuffer");for(let I in u.headers)C.setRequestHeader(I,u.headers[I]);u.type==="json"&&(C.responseType="text",!((w=u.headers)===null||w===void 0)&&w.Accept||C.setRequestHeader("Accept","application/json")),C.withCredentials=u.credentials==="include",C.onerror=()=>{y(new Error(C.statusText))},C.onload=()=>{if(!f.signal.aborted)if((C.status>=200&&C.status<300||C.status===0)&&C.response!==null){let I=C.response;if(u.type==="json")try{I=JSON.parse(C.response)}catch(L){return void y(L)}_({data:I,cacheControl:C.getResponseHeader("Cache-Control"),expires:C.getResponseHeader("Expires")})}else{let I=new Blob([C.response],{type:C.getResponseHeader("Content-Type")});y(new Nr(C.status,C.statusText,u.url,I))}},f.signal.addEventListener("abort",()=>{C.abort(),y(kn())}),C.send(u.body)})}(a,i)};function Fn(a){if(!a||a.indexOf("://")<=0||a.indexOf("data:image/")===0||a.indexOf("blob:")===0)return!0;let i=new URL(a),o=window.location;return i.protocol===o.protocol&&i.host===o.host}function an(a,i,o){o[a]&&o[a].indexOf(i)!==-1||(o[a]=o[a]||[],o[a].push(i))}function zn(a,i,o){if(o&&o[a]){let u=o[a].indexOf(i);u!==-1&&o[a].splice(u,1)}}class zs{constructor(i,o={}){$t(this,o),this.type=i}}class Os extends zs{constructor(i,o={}){super("error",$t({error:i},o))}}class On{on(i,o){return this._listeners=this._listeners||{},an(i,o,this._listeners),{unsubscribe:()=>{this.off(i,o)}}}off(i,o){return zn(i,o,this._listeners),zn(i,o,this._oneTimeListeners),this}once(i,o){return o?(this._oneTimeListeners=this._oneTimeListeners||{},an(i,o,this._oneTimeListeners),this):new Promise(u=>this.once(i,u))}fire(i,o){typeof i=="string"&&(i=new zs(i,o||{}));let u=i.type;if(this.listens(u)){i.target=this;let f=this._listeners&&this._listeners[u]?this._listeners[u].slice():[];for(let w of f)w.call(this,i);let _=this._oneTimeListeners&&this._oneTimeListeners[u]?this._oneTimeListeners[u].slice():[];for(let w of _)zn(u,w,this._oneTimeListeners),w.call(this,i);let y=this._eventedParent;y&&($t(i,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),y.fire(i))}else i instanceof Os&&console.error(i.error);return this}listens(i){return this._listeners&&this._listeners[i]&&this._listeners[i].length>0||this._oneTimeListeners&&this._oneTimeListeners[i]&&this._oneTimeListeners[i].length>0||this._eventedParent&&this._eventedParent.listens(i)}setEventedParent(i,o){return this._eventedParent=i,this._eventedParentData=o,this}}var K={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},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:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},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-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","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":{}}},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}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_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"}}};let Z=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function $(a,i){let o={};for(let u in a)u!=="ref"&&(o[u]=a[u]);return Z.forEach(u=>{u in i&&(o[u]=i[u])}),o}function X(a,i){if(Array.isArray(a)){if(!Array.isArray(i)||a.length!==i.length)return!1;for(let o=0;o<a.length;o++)if(!X(a[o],i[o]))return!1;return!0}if(typeof a=="object"&&a!==null&&i!==null){if(typeof i!="object"||Object.keys(a).length!==Object.keys(i).length)return!1;for(let o in a)if(!X(a[o],i[o]))return!1;return!0}return a===i}function ne(a,i){a.push(i)}function he(a,i,o){ne(o,{command:"addSource",args:[a,i[a]]})}function ye(a,i,o){ne(i,{command:"removeSource",args:[a]}),o[a]=!0}function Te(a,i,o,u){ye(a,o,u),he(a,i,o)}function _e(a,i,o){let u;for(u in a[o])if(Object.prototype.hasOwnProperty.call(a[o],u)&&u!=="data"&&!X(a[o][u],i[o][u]))return!1;for(u in i[o])if(Object.prototype.hasOwnProperty.call(i[o],u)&&u!=="data"&&!X(a[o][u],i[o][u]))return!1;return!0}function Ee(a,i,o,u,f,_){a=a||{},i=i||{};for(let y in a)Object.prototype.hasOwnProperty.call(a,y)&&(X(a[y],i[y])||o.push({command:_,args:[u,y,i[y],f]}));for(let y in i)Object.prototype.hasOwnProperty.call(i,y)&&!Object.prototype.hasOwnProperty.call(a,y)&&(X(a[y],i[y])||o.push({command:_,args:[u,y,i[y],f]}))}function Ie(a){return a.id}function xe(a,i){return a[i.id]=i,a}class pe{constructor(i,o,u,f){this.message=(i?`${i}: `:"")+u,f&&(this.identifier=f),o!=null&&o.__line__&&(this.line=o.__line__)}}function Xe(a,...i){for(let o of i)for(let u in o)a[u]=o[u];return a}class Ue extends Error{constructor(i,o){super(o),this.message=o,this.key=i}}class ht{constructor(i,o=[]){this.parent=i,this.bindings={};for(let[u,f]of o)this.bindings[u]=f}concat(i){return new ht(this,i)}get(i){if(this.bindings[i])return this.bindings[i];if(this.parent)return this.parent.get(i);throw new Error(`${i} not found in scope.`)}has(i){return!!this.bindings[i]||!!this.parent&&this.parent.has(i)}}let pt={kind:"null"},Pe={kind:"number"},We={kind:"string"},Qe={kind:"boolean"},wt={kind:"color"},mt={kind:"projectionDefinition"},nt={kind:"object"},Ke={kind:"value"},ai={kind:"collator"},Bs={kind:"formatted"},ji={kind:"padding"},ki={kind:"resolvedImage"},li={kind:"variableAnchorOffsetCollection"};function ln(a,i){return{kind:"array",itemType:a,N:i}}function ci(a){if(a.kind==="array"){let i=ci(a.itemType);return typeof a.N=="number"?`array<${i}, ${a.N}>`:a.itemType.kind==="value"?"array":`array<${i}>`}return a.kind}let Ia=[pt,Pe,We,Qe,wt,mt,Bs,nt,ln(Ke),ji,ki,li];function jo(a,i){if(i.kind==="error")return null;if(a.kind==="array"){if(i.kind==="array"&&(i.N===0&&i.itemType.kind==="value"||!jo(a.itemType,i.itemType))&&(typeof a.N!="number"||a.N===i.N))return null}else{if(a.kind===i.kind)return null;if(a.kind==="value"){for(let o of Ia)if(!jo(o,i))return null}}return`Expected ${ci(a)} but found ${ci(i)} instead.`}function Qc(a,i){return i.some(o=>o.kind===a.kind)}function to(a,i){return i.some(o=>o==="null"?a===null:o==="array"?Array.isArray(a):o==="object"?a&&!Array.isArray(a)&&typeof a=="object":o===typeof a)}function io(a,i){return a.kind==="array"&&i.kind==="array"?a.itemType.kind===i.itemType.kind&&typeof a.N=="number":a.kind===i.kind}let Id=.96422,eh=.82521,Ed=4/29,No=6/29,Pd=3*No*No,tm=No*No*No,im=Math.PI/180,rm=180/Math.PI;function Rd(a){return(a%=360)<0&&(a+=360),a}function th([a,i,o,u]){let f,_,y=ih((.2225045*(a=ro(a))+.7168786*(i=ro(i))+.0606169*(o=ro(o)))/1);a===i&&i===o?f=_=y:(f=ih((.4360747*a+.3850649*i+.1430804*o)/Id),_=ih((.0139322*a+.0971045*i+.7141733*o)/eh));let w=116*y-16;return[w<0?0:w,500*(f-y),200*(y-_),u]}function ro(a){return a<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)}function ih(a){return a>tm?Math.pow(a,1/3):a/Pd+Ed}function Ad([a,i,o,u]){let f=(a+16)/116,_=isNaN(i)?f:f+i/500,y=isNaN(o)?f:f-o/200;return f=1*rh(f),_=Id*rh(_),y=eh*rh(y),[no(3.1338561*_-1.6168667*f-.4906146*y),no(-.9787684*_+1.9161415*f+.033454*y),no(.0719453*_-.2289914*f+1.4052427*y),u]}function no(a){return(a=a<=.00304?12.92*a:1.055*Math.pow(a,1/2.4)-.055)<0?0:a>1?1:a}function rh(a){return a>No?a*a*a:Pd*(a-Ed)}function Ll(a){return parseInt(a.padEnd(2,a),16)/255}function Ld(a,i){return so(i?a/100:a,0,1)}function so(a,i,o){return Math.min(Math.max(i,a),o)}function nh(a){return!a.some(Number.isNaN)}let es={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function At(a,i,o){return a+o*(i-a)}function ts(a,i,o){return a.map((u,f)=>At(u,i[f],o))}class Lt{constructor(i,o,u,f=1,_=!0){this.r=i,this.g=o,this.b=u,this.a=f,_||(this.r*=f,this.g*=f,this.b*=f,f||this.overwriteGetter("rgb",[i,o,u,f]))}static parse(i){if(i instanceof Lt)return i;if(typeof i!="string")return;let o=function(u){if((u=u.toLowerCase().trim())==="transparent")return[0,0,0,0];let f=es[u];if(f){let[y,w,C]=f;return[y/255,w/255,C/255,1]}if(u.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(u)){let y=u.length<6?1:2,w=1;return[Ll(u.slice(w,w+=y)),Ll(u.slice(w,w+=y)),Ll(u.slice(w,w+=y)),Ll(u.slice(w,w+y)||"ff")]}if(u.startsWith("rgb")){let y=u.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(y){let[w,C,I,L,k,B,N,G,U,Y,te,de]=y,se=[L||" ",N||" ",Y].join("");if(se===" "||se===" /"||se===",,"||se===",,,"){let j=[I,B,U].join(""),H=j==="%%%"?100:j===""?255:0;if(H){let oe=[so(+C/H,0,1),so(+k/H,0,1),so(+G/H,0,1),te?Ld(+te,de):1];if(nh(oe))return oe}}return}}let _=u.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(_){let[y,w,C,I,L,k,B,N,G]=_,U=[C||" ",L||" ",B].join("");if(U===" "||U===" /"||U===",,"||U===",,,"){let Y=[+w,so(+I,0,100),so(+k,0,100),N?Ld(+N,G):1];if(nh(Y))return function([te,de,se,j]){function H(oe){let Se=(oe+te/30)%12,Ge=de*Math.min(se,1-se);return se-Ge*Math.max(-1,Math.min(Se-3,9-Se,1))}return te=Rd(te),de/=100,se/=100,[H(0),H(8),H(4),j]}(Y)}}}(i);return o?new Lt(...o,!1):void 0}get rgb(){let{r:i,g:o,b:u,a:f}=this,_=f||1/0;return this.overwriteGetter("rgb",[i/_,o/_,u/_,f])}get hcl(){return this.overwriteGetter("hcl",function(i){let[o,u,f,_]=th(i),y=Math.sqrt(u*u+f*f);return[Math.round(1e4*y)?Rd(Math.atan2(f,u)*rm):NaN,y,o,_]}(this.rgb))}get lab(){return this.overwriteGetter("lab",th(this.rgb))}overwriteGetter(i,o){return Object.defineProperty(this,i,{value:o}),o}toString(){let[i,o,u,f]=this.rgb;return`rgba(${[i,o,u].map(_=>Math.round(255*_)).join(",")},${f})`}static interpolate(i,o,u,f="rgb"){switch(f){case"rgb":{let[_,y,w,C]=ts(i.rgb,o.rgb,u);return new Lt(_,y,w,C,!1)}case"hcl":{let[_,y,w,C]=i.hcl,[I,L,k,B]=o.hcl,N,G;if(isNaN(_)||isNaN(I))isNaN(_)?isNaN(I)?N=NaN:(N=I,w!==1&&w!==0||(G=L)):(N=_,k!==1&&k!==0||(G=y));else{let se=I-_;I>_&&se>180?se-=360:I<_&&_-I>180&&(se+=360),N=_+u*se}let[U,Y,te,de]=function([se,j,H,oe]){return se=isNaN(se)?0:se*im,Ad([H,Math.cos(se)*j,Math.sin(se)*j,oe])}([N,G??At(y,L,u),At(w,k,u),At(C,B,u)]);return new Lt(U,Y,te,de,!1)}case"lab":{let[_,y,w,C]=Ad(ts(i.lab,o.lab,u));return new Lt(_,y,w,C,!1)}}}}Lt.black=new Lt(0,0,0,1),Lt.white=new Lt(1,1,1,1),Lt.transparent=new Lt(0,0,0,0),Lt.red=new Lt(1,0,0,1);class kl{constructor(i,o,u){this.sensitivity=i?o?"variant":"case":o?"accent":"base",this.locale=u,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(i,o){return this.collator.compare(i,o)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Dl{constructor(i,o,u,f,_){this.text=i,this.image=o,this.scale=u,this.fontStack=f,this.textColor=_}}class Cr{constructor(i){this.sections=i}static fromString(i){return new Cr([new Dl(i,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(i=>i.text.length!==0||i.image&&i.image.name.length!==0)}static factory(i){return i instanceof Cr?i:Cr.fromString(i)}toString(){return this.sections.length===0?"":this.sections.map(i=>i.text).join("")}}class pi{constructor(i){this.values=i.slice()}static parse(i){if(i instanceof pi)return i;if(typeof i=="number")return new pi([i,i,i,i]);if(Array.isArray(i)&&!(i.length<1||i.length>4)){for(let o of i)if(typeof o!="number")return;switch(i.length){case 1:i=[i[0],i[0],i[0],i[0]];break;case 2:i=[i[0],i[1],i[0],i[1]];break;case 3:i=[i[0],i[1],i[2],i[1]]}return new pi(i)}}toString(){return JSON.stringify(this.values)}static interpolate(i,o,u){return new pi(ts(i.values,o.values,u))}}class hi{constructor(i){this.name="ExpressionEvaluationError",this.message=i}toJSON(){return this.message}}let Fl=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class ur{constructor(i){this.values=i.slice()}static parse(i){if(i instanceof ur)return i;if(Array.isArray(i)&&!(i.length<1)&&i.length%2==0){for(let o=0;o<i.length;o+=2){let u=i[o],f=i[o+1];if(typeof u!="string"||!Fl.has(u)||!Array.isArray(f)||f.length!==2||typeof f[0]!="number"||typeof f[1]!="number")return}return new ur(i)}}toString(){return JSON.stringify(this.values)}static interpolate(i,o,u){let f=i.values,_=o.values;if(f.length!==_.length)throw new hi(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${o.toString()}`);let y=[];for(let w=0;w<f.length;w+=2){if(f[w]!==_[w])throw new hi(`Cannot interpolate values containing mismatched anchors. from[${w}]: ${f[w]}, to[${w}]: ${_[w]}`);y.push(f[w]);let[C,I]=f[w+1],[L,k]=_[w+1];y.push([At(C,L,u),At(I,k,u)])}return new ur(y)}}class Gr{constructor(i){this.name=i.name,this.available=i.available}toString(){return this.name}static fromString(i){return i?new Gr({name:i,available:!1}):null}}class tr{constructor(i,o,u){this.from=i,this.to=o,this.transition=u}static interpolate(i,o,u){return new tr(i,o,u)}static parse(i){return i instanceof tr?i:Array.isArray(i)&&i.length===3&&typeof i[0]=="string"&&typeof i[1]=="string"&&typeof i[2]=="number"?new tr(i[0],i[1],i[2]):typeof i=="object"&&typeof i.from=="string"&&typeof i.to=="string"&&typeof i.transition=="number"?new tr(i.from,i.to,i.transition):typeof i=="string"?new tr(i,i,1):void 0}}function Ea(a,i,o,u){return typeof a=="number"&&a>=0&&a<=255&&typeof i=="number"&&i>=0&&i<=255&&typeof o=="number"&&o>=0&&o<=255?u===void 0||typeof u=="number"&&u>=0&&u<=1?null:`Invalid rgba value [${[a,i,o,u].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof u=="number"?[a,i,o,u]:[a,i,o]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Go(a){if(a===null||typeof a=="string"||typeof a=="boolean"||typeof a=="number"||a instanceof tr||a instanceof Lt||a instanceof kl||a instanceof Cr||a instanceof pi||a instanceof ur||a instanceof Gr)return!0;if(Array.isArray(a)){for(let i of a)if(!Go(i))return!1;return!0}if(typeof a=="object"){for(let i in a)if(!Go(a[i]))return!1;return!0}return!1}function wi(a){if(a===null)return pt;if(typeof a=="string")return We;if(typeof a=="boolean")return Qe;if(typeof a=="number")return Pe;if(a instanceof Lt)return wt;if(a instanceof tr)return mt;if(a instanceof kl)return ai;if(a instanceof Cr)return Bs;if(a instanceof pi)return ji;if(a instanceof ur)return li;if(a instanceof Gr)return ki;if(Array.isArray(a)){let i=a.length,o;for(let u of a){let f=wi(u);if(o){if(o===f)continue;o=Ke;break}o=f}return ln(o||Ke,i)}return nt}function Bn(a){let i=typeof a;return a===null?"":i==="string"||i==="number"||i==="boolean"?String(a):a instanceof Lt||a instanceof tr||a instanceof Cr||a instanceof pi||a instanceof ur||a instanceof Gr?a.toString():JSON.stringify(a)}class oo{constructor(i,o){this.type=i,this.value=o}static parse(i,o){if(i.length!==2)return o.error(`'literal' expression requires exactly one argument, but found ${i.length-1} instead.`);if(!Go(i[1]))return o.error("invalid value");let u=i[1],f=wi(u),_=o.expectedType;return f.kind!=="array"||f.N!==0||!_||_.kind!=="array"||typeof _.N=="number"&&_.N!==0||(f=_),new oo(f,u)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}let ao={string:We,number:Pe,boolean:Qe,object:nt};class dr{constructor(i,o){this.type=i,this.args=o}static parse(i,o){if(i.length<2)return o.error("Expected at least one argument.");let u,f=1,_=i[0];if(_==="array"){let w,C;if(i.length>2){let I=i[1];if(typeof I!="string"||!(I in ao)||I==="object")return o.error('The item type argument of "array" must be one of string, number, boolean',1);w=ao[I],f++}else w=Ke;if(i.length>3){if(i[2]!==null&&(typeof i[2]!="number"||i[2]<0||i[2]!==Math.floor(i[2])))return o.error('The length argument to "array" must be a positive integer literal',2);C=i[2],f++}u=ln(w,C)}else{if(!ao[_])throw new Error(`Types doesn't contain name = ${_}`);u=ao[_]}let y=[];for(;f<i.length;f++){let w=o.parse(i[f],f,Ke);if(!w)return null;y.push(w)}return new dr(u,y)}evaluate(i){for(let o=0;o<this.args.length;o++){let u=this.args[o].evaluate(i);if(!jo(this.type,wi(u)))return u;if(o===this.args.length-1)throw new hi(`Expected value to be of type ${ci(this.type)}, but found ${ci(wi(u))} instead.`)}throw new Error}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}}let sh={"to-boolean":Qe,"to-color":wt,"to-number":Pe,"to-string":We};class _s{constructor(i,o){this.type=i,this.args=o}static parse(i,o){if(i.length<2)return o.error("Expected at least one argument.");let u=i[0];if(!sh[u])throw new Error(`Can't parse ${u} as it is not part of the known types`);if((u==="to-boolean"||u==="to-string")&&i.length!==2)return o.error("Expected one argument.");let f=sh[u],_=[];for(let y=1;y<i.length;y++){let w=o.parse(i[y],y,Ke);if(!w)return null;_.push(w)}return new _s(f,_)}evaluate(i){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(i);case"color":{let o,u;for(let f of this.args){if(o=f.evaluate(i),u=null,o instanceof Lt)return o;if(typeof o=="string"){let _=i.parseColor(o);if(_)return _}else if(Array.isArray(o)&&(u=o.length<3||o.length>4?`Invalid rgba value ${JSON.stringify(o)}: expected an array containing either three or four numeric values.`:Ea(o[0],o[1],o[2],o[3]),!u))return new Lt(o[0]/255,o[1]/255,o[2]/255,o[3])}throw new hi(u||`Could not parse color from value '${typeof o=="string"?o:JSON.stringify(o)}'`)}case"padding":{let o;for(let u of this.args){o=u.evaluate(i);let f=pi.parse(o);if(f)return f}throw new hi(`Could not parse padding from value '${typeof o=="string"?o:JSON.stringify(o)}'`)}case"variableAnchorOffsetCollection":{let o;for(let u of this.args){o=u.evaluate(i);let f=ur.parse(o);if(f)return f}throw new hi(`Could not parse variableAnchorOffsetCollection from value '${typeof o=="string"?o:JSON.stringify(o)}'`)}case"number":{let o=null;for(let u of this.args){if(o=u.evaluate(i),o===null)return 0;let f=Number(o);if(!isNaN(f))return f}throw new hi(`Could not convert ${JSON.stringify(o)} to number.`)}case"formatted":return Cr.fromString(Bn(this.args[0].evaluate(i)));case"resolvedImage":return Gr.fromString(Bn(this.args[0].evaluate(i)));case"projectionDefinition":return this.args[0].evaluate(i);default:return Bn(this.args[0].evaluate(i))}}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}}let kd=["Unknown","Point","LineString","Polygon"];class Pa{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"?kd[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(i){let o=this._parseColorCache[i];return o||(o=this._parseColorCache[i]=Lt.parse(i)),o}}class Jt{constructor(i,o,u=[],f,_=new ht,y=[]){this.registry=i,this.path=u,this.key=u.map(w=>`[${w}]`).join(""),this.scope=_,this.errors=y,this.expectedType=f,this._isConstant=o}parse(i,o,u,f,_={}){return o?this.concat(o,u,f)._parse(i,_):this._parse(i,_)}_parse(i,o){function u(f,_,y){return y==="assert"?new dr(_,[f]):y==="coerce"?new _s(_,[f]):f}if(i!==null&&typeof i!="string"&&typeof i!="boolean"&&typeof i!="number"||(i=["literal",i]),Array.isArray(i)){if(i.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let f=i[0];if(typeof f!="string")return this.error(`Expression name must be a string, but found ${typeof f} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let _=this.registry[f];if(_){let y=_.parse(i,this);if(!y)return null;if(this.expectedType){let w=this.expectedType,C=y.type;if(w.kind!=="string"&&w.kind!=="number"&&w.kind!=="boolean"&&w.kind!=="object"&&w.kind!=="array"||C.kind!=="value")if(w.kind!=="projectionDefinition"||C.kind!=="string"&&C.kind!=="array")if(w.kind!=="color"&&w.kind!=="formatted"&&w.kind!=="resolvedImage"||C.kind!=="value"&&C.kind!=="string")if(w.kind!=="padding"||C.kind!=="value"&&C.kind!=="number"&&C.kind!=="array")if(w.kind!=="variableAnchorOffsetCollection"||C.kind!=="value"&&C.kind!=="array"){if(this.checkSubtype(w,C))return null}else y=u(y,w,o.typeAnnotation||"coerce");else y=u(y,w,o.typeAnnotation||"coerce");else y=u(y,w,o.typeAnnotation||"coerce");else y=u(y,w,o.typeAnnotation||"coerce");else y=u(y,w,o.typeAnnotation||"assert")}if(!(y instanceof oo)&&y.type.kind!=="resolvedImage"&&this._isConstant(y)){let w=new Pa;try{y=new oo(y.type,y.evaluate(w))}catch(C){return this.error(C.message),null}}return y}return this.error(`Unknown expression "${f}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(i===void 0?"'undefined' value invalid. Use null instead.":typeof i=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof i} instead.`)}concat(i,o,u){let f=typeof i=="number"?this.path.concat(i):this.path,_=u?this.scope.concat(u):this.scope;return new Jt(this.registry,this._isConstant,f,o||null,_,this.errors)}error(i,...o){let u=`${this.key}${o.map(f=>`[${f}]`).join("")}`;this.errors.push(new Ue(u,i))}checkSubtype(i,o){let u=jo(i,o);return u&&this.error(u),u}}class Vo{constructor(i,o){this.type=o.type,this.bindings=[].concat(i),this.result=o}evaluate(i){return this.result.evaluate(i)}eachChild(i){for(let o of this.bindings)i(o[1]);i(this.result)}static parse(i,o){if(i.length<4)return o.error(`Expected at least 3 arguments, but found ${i.length-1} instead.`);let u=[];for(let _=1;_<i.length-1;_+=2){let y=i[_];if(typeof y!="string")return o.error(`Expected string, but found ${typeof y} instead.`,_);if(/[^a-zA-Z0-9_]/.test(y))return o.error("Variable names must contain only alphanumeric characters or '_'.",_);let w=o.parse(i[_+1],_+1);if(!w)return null;u.push([y,w])}let f=o.parse(i[i.length-1],i.length-1,o.expectedType,u);return f?new Vo(u,f):null}outputDefined(){return this.result.outputDefined()}}class Ot{constructor(i,o){this.type=o.type,this.name=i,this.boundExpression=o}static parse(i,o){if(i.length!==2||typeof i[1]!="string")return o.error("'var' expression requires exactly one string literal argument.");let u=i[1];return o.scope.has(u)?new Ot(u,o.scope.get(u)):o.error(`Unknown variable "${u}". Make sure "${u}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(i){return this.boundExpression.evaluate(i)}eachChild(){}outputDefined(){return!1}}class Rt{constructor(i,o,u){this.type=i,this.index=o,this.input=u}static parse(i,o){if(i.length!==3)return o.error(`Expected 2 arguments, but found ${i.length-1} instead.`);let u=o.parse(i[1],1,Pe),f=o.parse(i[2],2,ln(o.expectedType||Ke));return u&&f?new Rt(f.type.itemType,u,f):null}evaluate(i){let o=this.index.evaluate(i),u=this.input.evaluate(i);if(o<0)throw new hi(`Array index out of bounds: ${o} < 0.`);if(o>=u.length)throw new hi(`Array index out of bounds: ${o} > ${u.length-1}.`);if(o!==Math.floor(o))throw new hi(`Array index must be an integer, but found ${o} instead.`);return u[o]}eachChild(i){i(this.index),i(this.input)}outputDefined(){return!1}}class Ra{constructor(i,o){this.type=Qe,this.needle=i,this.haystack=o}static parse(i,o){if(i.length!==3)return o.error(`Expected 2 arguments, but found ${i.length-1} instead.`);let u=o.parse(i[1],1,Ke),f=o.parse(i[2],2,Ke);return u&&f?Qc(u.type,[Qe,We,Pe,pt,Ke])?new Ra(u,f):o.error(`Expected first argument to be of type boolean, string, number or null, but found ${ci(u.type)} instead`):null}evaluate(i){let o=this.needle.evaluate(i),u=this.haystack.evaluate(i);if(!u)return!1;if(!to(o,["boolean","string","number","null"]))throw new hi(`Expected first argument to be of type boolean, string, number or null, but found ${ci(wi(o))} instead.`);if(!to(u,["string","array"]))throw new hi(`Expected second argument to be of type array or string, but found ${ci(wi(u))} instead.`);return u.indexOf(o)>=0}eachChild(i){i(this.needle),i(this.haystack)}outputDefined(){return!0}}class Bt{constructor(i,o,u){this.type=Pe,this.needle=i,this.haystack=o,this.fromIndex=u}static parse(i,o){if(i.length<=2||i.length>=5)return o.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);let u=o.parse(i[1],1,Ke),f=o.parse(i[2],2,Ke);if(!u||!f)return null;if(!Qc(u.type,[Qe,We,Pe,pt,Ke]))return o.error(`Expected first argument to be of type boolean, string, number or null, but found ${ci(u.type)} instead`);if(i.length===4){let _=o.parse(i[3],3,Pe);return _?new Bt(u,f,_):null}return new Bt(u,f)}evaluate(i){let o=this.needle.evaluate(i),u=this.haystack.evaluate(i);if(!to(o,["boolean","string","number","null"]))throw new hi(`Expected first argument to be of type boolean, string, number or null, but found ${ci(wi(o))} instead.`);let f;if(this.fromIndex&&(f=this.fromIndex.evaluate(i)),to(u,["string"])){let _=u.indexOf(o,f);return _===-1?-1:[...u.slice(0,_)].length}if(to(u,["array"]))return u.indexOf(o,f);throw new hi(`Expected second argument to be of type array or string, but found ${ci(wi(u))} instead.`)}eachChild(i){i(this.needle),i(this.haystack),this.fromIndex&&i(this.fromIndex)}outputDefined(){return!1}}class Aa{constructor(i,o,u,f,_,y){this.inputType=i,this.type=o,this.input=u,this.cases=f,this.outputs=_,this.otherwise=y}static parse(i,o){if(i.length<5)return o.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if(i.length%2!=1)return o.error("Expected an even number of arguments.");let u,f;o.expectedType&&o.expectedType.kind!=="value"&&(f=o.expectedType);let _={},y=[];for(let I=2;I<i.length-1;I+=2){let L=i[I],k=i[I+1];Array.isArray(L)||(L=[L]);let B=o.concat(I);if(L.length===0)return B.error("Expected at least one branch label.");for(let G of L){if(typeof G!="number"&&typeof G!="string")return B.error("Branch labels must be numbers or strings.");if(typeof G=="number"&&Math.abs(G)>Number.MAX_SAFE_INTEGER)return B.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof G=="number"&&Math.floor(G)!==G)return B.error("Numeric branch labels must be integer values.");if(u){if(B.checkSubtype(u,wi(G)))return null}else u=wi(G);if(_[String(G)]!==void 0)return B.error("Branch labels must be unique.");_[String(G)]=y.length}let N=o.parse(k,I,f);if(!N)return null;f=f||N.type,y.push(N)}let w=o.parse(i[1],1,Ke);if(!w)return null;let C=o.parse(i[i.length-1],i.length-1,f);return C?w.type.kind!=="value"&&o.concat(1).checkSubtype(u,w.type)?null:new Aa(u,f,w,_,y,C):null}evaluate(i){let o=this.input.evaluate(i);return(wi(o)===this.inputType&&this.outputs[this.cases[o]]||this.otherwise).evaluate(i)}eachChild(i){i(this.input),this.outputs.forEach(i),i(this.otherwise)}outputDefined(){return this.outputs.every(i=>i.outputDefined())&&this.otherwise.outputDefined()}}class jn{constructor(i,o,u){this.type=i,this.branches=o,this.otherwise=u}static parse(i,o){if(i.length<4)return o.error(`Expected at least 3 arguments, but found only ${i.length-1}.`);if(i.length%2!=0)return o.error("Expected an odd number of arguments.");let u;o.expectedType&&o.expectedType.kind!=="value"&&(u=o.expectedType);let f=[];for(let y=1;y<i.length-1;y+=2){let w=o.parse(i[y],y,Qe);if(!w)return null;let C=o.parse(i[y+1],y+1,u);if(!C)return null;f.push([w,C]),u=u||C.type}let _=o.parse(i[i.length-1],i.length-1,u);if(!_)return null;if(!u)throw new Error("Can't infer output type");return new jn(u,f,_)}evaluate(i){for(let[o,u]of this.branches)if(o.evaluate(i))return u.evaluate(i);return this.otherwise.evaluate(i)}eachChild(i){for(let[o,u]of this.branches)i(o),i(u);i(this.otherwise)}outputDefined(){return this.branches.every(([i,o])=>o.outputDefined())&&this.otherwise.outputDefined()}}class Uo{constructor(i,o,u,f){this.type=i,this.input=o,this.beginIndex=u,this.endIndex=f}static parse(i,o){if(i.length<=2||i.length>=5)return o.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);let u=o.parse(i[1],1,Ke),f=o.parse(i[2],2,Pe);if(!u||!f)return null;if(!Qc(u.type,[ln(Ke),We,Ke]))return o.error(`Expected first argument to be of type array or string, but found ${ci(u.type)} instead`);if(i.length===4){let _=o.parse(i[3],3,Pe);return _?new Uo(u.type,u,f,_):null}return new Uo(u.type,u,f)}evaluate(i){let o=this.input.evaluate(i),u=this.beginIndex.evaluate(i),f;if(this.endIndex&&(f=this.endIndex.evaluate(i)),to(o,["string"]))return[...o].slice(u,f).join("");if(to(o,["array"]))return o.slice(u,f);throw new hi(`Expected first argument to be of type array or string, but found ${ci(wi(o))} instead.`)}eachChild(i){i(this.input),i(this.beginIndex),this.endIndex&&i(this.endIndex)}outputDefined(){return!1}}function La(a,i){let o=a.length-1,u,f,_=0,y=o,w=0;for(;_<=y;)if(w=Math.floor((_+y)/2),u=a[w],f=a[w+1],u<=i){if(w===o||i<f)return w;_=w+1}else{if(!(u>i))throw new hi("Input is not a number.");y=w-1}return 0}class Zo{constructor(i,o,u){this.type=i,this.input=o,this.labels=[],this.outputs=[];for(let[f,_]of u)this.labels.push(f),this.outputs.push(_)}static parse(i,o){if(i.length-1<4)return o.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return o.error("Expected an even number of arguments.");let u=o.parse(i[1],1,Pe);if(!u)return null;let f=[],_=null;o.expectedType&&o.expectedType.kind!=="value"&&(_=o.expectedType);for(let y=1;y<i.length;y+=2){let w=y===1?-1/0:i[y],C=i[y+1],I=y,L=y+1;if(typeof w!="number")return o.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',I);if(f.length&&f[f.length-1][0]>=w)return o.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',I);let k=o.parse(C,L,_);if(!k)return null;_=_||k.type,f.push([w,k])}return new Zo(_,u,f)}evaluate(i){let o=this.labels,u=this.outputs;if(o.length===1)return u[0].evaluate(i);let f=this.input.evaluate(i);if(f<=o[0])return u[0].evaluate(i);let _=o.length;return f>=o[_-1]?u[_-1].evaluate(i):u[La(o,f)].evaluate(i)}eachChild(i){i(this.input);for(let o of this.outputs)i(o)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}}function oh(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var zl,Dd,Fd=function(){if(Dd)return zl;function a(i,o,u,f){this.cx=3*i,this.bx=3*(u-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(f-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=o,this.p2x=u,this.p2y=f}return Dd=1,zl=a,a.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,o){if(o===void 0&&(o=1e-6),i<0)return 0;if(i>1)return 1;for(var u=i,f=0;f<8;f++){var _=this.sampleCurveX(u)-i;if(Math.abs(_)<o)return u;var y=this.sampleCurveDerivativeX(u);if(Math.abs(y)<1e-6)break;u-=_/y}var w=0,C=1;for(u=i,f=0;f<20&&(_=this.sampleCurveX(u),!(Math.abs(_-i)<o));f++)i>_?w=u:C=u,u=.5*(C-w)+w;return u},solve:function(i,o){return this.sampleCurveY(this.solveCurveX(i,o))}},zl}(),zd=oh(Fd);class ir{constructor(i,o,u,f,_){this.type=i,this.operator=o,this.interpolation=u,this.input=f,this.labels=[],this.outputs=[];for(let[y,w]of _)this.labels.push(y),this.outputs.push(w)}static interpolationFactor(i,o,u,f){let _=0;if(i.name==="exponential")_=Xi(o,i.base,u,f);else if(i.name==="linear")_=Xi(o,1,u,f);else if(i.name==="cubic-bezier"){let y=i.controlPoints;_=new zd(y[0],y[1],y[2],y[3]).solve(Xi(o,1,u,f))}return _}static parse(i,o){let[u,f,_,...y]=i;if(!Array.isArray(f)||f.length===0)return o.error("Expected an interpolation type expression.",1);if(f[0]==="linear")f={name:"linear"};else if(f[0]==="exponential"){let I=f[1];if(typeof I!="number")return o.error("Exponential interpolation requires a numeric base.",1,1);f={name:"exponential",base:I}}else{if(f[0]!=="cubic-bezier")return o.error(`Unknown interpolation type ${String(f[0])}`,1,0);{let I=f.slice(1);if(I.length!==4||I.some(L=>typeof L!="number"||L<0||L>1))return o.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);f={name:"cubic-bezier",controlPoints:I}}}if(i.length-1<4)return o.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return o.error("Expected an even number of arguments.");if(_=o.parse(_,2,Pe),!_)return null;let w=[],C=null;u==="interpolate-hcl"||u==="interpolate-lab"?C=wt:o.expectedType&&o.expectedType.kind!=="value"&&(C=o.expectedType);for(let I=0;I<y.length;I+=2){let L=y[I],k=y[I+1],B=I+3,N=I+4;if(typeof L!="number")return o.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',B);if(w.length&&w[w.length-1][0]>=L)return o.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',B);let G=o.parse(k,N,C);if(!G)return null;C=C||G.type,w.push([L,G])}return io(C,Pe)||io(C,mt)||io(C,wt)||io(C,ji)||io(C,li)||io(C,ln(Pe))?new ir(C,u,f,_,w):o.error(`Type ${ci(C)} is not interpolatable.`)}evaluate(i){let o=this.labels,u=this.outputs;if(o.length===1)return u[0].evaluate(i);let f=this.input.evaluate(i);if(f<=o[0])return u[0].evaluate(i);let _=o.length;if(f>=o[_-1])return u[_-1].evaluate(i);let y=La(o,f),w=ir.interpolationFactor(this.interpolation,f,o[y],o[y+1]),C=u[y].evaluate(i),I=u[y+1].evaluate(i);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return At(C,I,w);case"color":return Lt.interpolate(C,I,w);case"padding":return pi.interpolate(C,I,w);case"variableAnchorOffsetCollection":return ur.interpolate(C,I,w);case"array":return ts(C,I,w);case"projectionDefinition":return tr.interpolate(C,I,w)}case"interpolate-hcl":return Lt.interpolate(C,I,w,"hcl");case"interpolate-lab":return Lt.interpolate(C,I,w,"lab")}}eachChild(i){i(this.input);for(let o of this.outputs)i(o)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}}function Xi(a,i,o,u){let f=u-o,_=a-o;return f===0?0:i===1?_/f:(Math.pow(i,_)-1)/(Math.pow(i,f)-1)}let cn={color:Lt.interpolate,number:At,padding:pi.interpolate,variableAnchorOffsetCollection:ur.interpolate,array:ts};class ka{constructor(i,o){this.type=i,this.args=o}static parse(i,o){if(i.length<2)return o.error("Expected at least one argument.");let u=null,f=o.expectedType;f&&f.kind!=="value"&&(u=f);let _=[];for(let w of i.slice(1)){let C=o.parse(w,1+_.length,u,void 0,{typeAnnotation:"omit"});if(!C)return null;u=u||C.type,_.push(C)}if(!u)throw new Error("No output type");let y=f&&_.some(w=>jo(f,w.type));return new ka(y?Ke:u,_)}evaluate(i){let o,u=null,f=0;for(let _ of this.args)if(f++,u=_.evaluate(i),u&&u instanceof Gr&&!u.available&&(o||(o=u.name),u=null,f===this.args.length&&(u=o)),u!==null)break;return u}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}}function Da(a,i){return a==="=="||a==="!="?i.kind==="boolean"||i.kind==="string"||i.kind==="number"||i.kind==="null"||i.kind==="value":i.kind==="string"||i.kind==="number"||i.kind==="value"}function Ni(a,i,o,u){return u.compare(i,o)===0}function lo(a,i,o){let u=a!=="=="&&a!=="!=";return class ww{constructor(_,y,w){this.type=Qe,this.lhs=_,this.rhs=y,this.collator=w,this.hasUntypedArgument=_.type.kind==="value"||y.type.kind==="value"}static parse(_,y){if(_.length!==3&&_.length!==4)return y.error("Expected two or three arguments.");let w=_[0],C=y.parse(_[1],1,Ke);if(!C)return null;if(!Da(w,C.type))return y.concat(1).error(`"${w}" comparisons are not supported for type '${ci(C.type)}'.`);let I=y.parse(_[2],2,Ke);if(!I)return null;if(!Da(w,I.type))return y.concat(2).error(`"${w}" comparisons are not supported for type '${ci(I.type)}'.`);if(C.type.kind!==I.type.kind&&C.type.kind!=="value"&&I.type.kind!=="value")return y.error(`Cannot compare types '${ci(C.type)}' and '${ci(I.type)}'.`);u&&(C.type.kind==="value"&&I.type.kind!=="value"?C=new dr(I.type,[C]):C.type.kind!=="value"&&I.type.kind==="value"&&(I=new dr(C.type,[I])));let L=null;if(_.length===4){if(C.type.kind!=="string"&&I.type.kind!=="string"&&C.type.kind!=="value"&&I.type.kind!=="value")return y.error("Cannot use collator to compare non-string types.");if(L=y.parse(_[3],3,ai),!L)return null}return new ww(C,I,L)}evaluate(_){let y=this.lhs.evaluate(_),w=this.rhs.evaluate(_);if(u&&this.hasUntypedArgument){let C=wi(y),I=wi(w);if(C.kind!==I.kind||C.kind!=="string"&&C.kind!=="number")throw new hi(`Expected arguments for "${a}" to be (string, string) or (number, number), but found (${C.kind}, ${I.kind}) instead.`)}if(this.collator&&!u&&this.hasUntypedArgument){let C=wi(y),I=wi(w);if(C.kind!=="string"||I.kind!=="string")return i(_,y,w)}return this.collator?o(_,y,w,this.collator.evaluate(_)):i(_,y,w)}eachChild(_){_(this.lhs),_(this.rhs),this.collator&&_(this.collator)}outputDefined(){return!0}}}let ah=lo("==",function(a,i,o){return i===o},Ni),Od=lo("!=",function(a,i,o){return i!==o},function(a,i,o,u){return!Ni(0,i,o,u)}),nm=lo("<",function(a,i,o){return i<o},function(a,i,o,u){return u.compare(i,o)<0}),Ol=lo(">",function(a,i,o){return i>o},function(a,i,o,u){return u.compare(i,o)>0}),lh=lo("<=",function(a,i,o){return i<=o},function(a,i,o,u){return u.compare(i,o)<=0}),sm=lo(">=",function(a,i,o){return i>=o},function(a,i,o,u){return u.compare(i,o)>=0});class co{constructor(i,o,u){this.type=ai,this.locale=u,this.caseSensitive=i,this.diacriticSensitive=o}static parse(i,o){if(i.length!==2)return o.error("Expected one argument.");let u=i[1];if(typeof u!="object"||Array.isArray(u))return o.error("Collator options argument must be an object.");let f=o.parse(u["case-sensitive"]!==void 0&&u["case-sensitive"],1,Qe);if(!f)return null;let _=o.parse(u["diacritic-sensitive"]!==void 0&&u["diacritic-sensitive"],1,Qe);if(!_)return null;let y=null;return u.locale&&(y=o.parse(u.locale,1,We),!y)?null:new co(f,_,y)}evaluate(i){return new kl(this.caseSensitive.evaluate(i),this.diacriticSensitive.evaluate(i),this.locale?this.locale.evaluate(i):null)}eachChild(i){i(this.caseSensitive),i(this.diacriticSensitive),this.locale&&i(this.locale)}outputDefined(){return!1}}class qo{constructor(i,o,u,f,_){this.type=We,this.number=i,this.locale=o,this.currency=u,this.minFractionDigits=f,this.maxFractionDigits=_}static parse(i,o){if(i.length!==3)return o.error("Expected two arguments.");let u=o.parse(i[1],1,Pe);if(!u)return null;let f=i[2];if(typeof f!="object"||Array.isArray(f))return o.error("NumberFormat options argument must be an object.");let _=null;if(f.locale&&(_=o.parse(f.locale,1,We),!_))return null;let y=null;if(f.currency&&(y=o.parse(f.currency,1,We),!y))return null;let w=null;if(f["min-fraction-digits"]&&(w=o.parse(f["min-fraction-digits"],1,Pe),!w))return null;let C=null;return f["max-fraction-digits"]&&(C=o.parse(f["max-fraction-digits"],1,Pe),!C)?null:new qo(u,_,y,w,C)}evaluate(i){return new Intl.NumberFormat(this.locale?this.locale.evaluate(i):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(i):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(i):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(i):void 0}).format(this.number.evaluate(i))}eachChild(i){i(this.number),this.locale&&i(this.locale),this.currency&&i(this.currency),this.minFractionDigits&&i(this.minFractionDigits),this.maxFractionDigits&&i(this.maxFractionDigits)}outputDefined(){return!1}}class Vr{constructor(i){this.type=Bs,this.sections=i}static parse(i,o){if(i.length<2)return o.error("Expected at least one argument.");let u=i[1];if(!Array.isArray(u)&&typeof u=="object")return o.error("First argument must be an image or text section.");let f=[],_=!1;for(let y=1;y<=i.length-1;++y){let w=i[y];if(_&&typeof w=="object"&&!Array.isArray(w)){_=!1;let C=null;if(w["font-scale"]&&(C=o.parse(w["font-scale"],1,Pe),!C))return null;let I=null;if(w["text-font"]&&(I=o.parse(w["text-font"],1,ln(We)),!I))return null;let L=null;if(w["text-color"]&&(L=o.parse(w["text-color"],1,wt),!L))return null;let k=f[f.length-1];k.scale=C,k.font=I,k.textColor=L}else{let C=o.parse(i[y],1,Ke);if(!C)return null;let I=C.type.kind;if(I!=="string"&&I!=="value"&&I!=="null"&&I!=="resolvedImage")return o.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");_=!0,f.push({content:C,scale:null,font:null,textColor:null})}}return new Vr(f)}evaluate(i){return new Cr(this.sections.map(o=>{let u=o.content.evaluate(i);return wi(u)===ki?new Dl("",u,null,null,null):new Dl(Bn(u),null,o.scale?o.scale.evaluate(i):null,o.font?o.font.evaluate(i).join(","):null,o.textColor?o.textColor.evaluate(i):null)}))}eachChild(i){for(let o of this.sections)i(o.content),o.scale&&i(o.scale),o.font&&i(o.font),o.textColor&&i(o.textColor)}outputDefined(){return!1}}class Bl{constructor(i){this.type=ki,this.input=i}static parse(i,o){if(i.length!==2)return o.error("Expected two arguments.");let u=o.parse(i[1],1,We);return u?new Bl(u):o.error("No image name provided.")}evaluate(i){let o=this.input.evaluate(i),u=Gr.fromString(o);return u&&i.availableImages&&(u.available=i.availableImages.indexOf(o)>-1),u}eachChild(i){i(this.input)}outputDefined(){return!1}}class Wo{constructor(i){this.type=Pe,this.input=i}static parse(i,o){if(i.length!==2)return o.error(`Expected 1 argument, but found ${i.length-1} instead.`);let u=o.parse(i[1],1);return u?u.type.kind!=="array"&&u.type.kind!=="string"&&u.type.kind!=="value"?o.error(`Expected argument of type string or array, but found ${ci(u.type)} instead.`):new Wo(u):null}evaluate(i){let o=this.input.evaluate(i);if(typeof o=="string")return[...o].length;if(Array.isArray(o))return o.length;throw new hi(`Expected value to be of type string or array, but found ${ci(wi(o))} instead.`)}eachChild(i){i(this.input)}outputDefined(){return!1}}let is=8192;function ch(a,i){let o=(180+a[0])/360,u=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a[1]*Math.PI/360)))/360,f=Math.pow(2,i.z);return[Math.round(o*f*is),Math.round(u*f*is)]}function hh(a,i){let o=Math.pow(2,i.z);return[(f=(a[0]/is+i.x)/o,360*f-180),(u=(a[1]/is+i.y)/o,360/Math.PI*Math.atan(Math.exp((180-360*u)*Math.PI/180))-90)];var u,f}function Fa(a,i){a[0]=Math.min(a[0],i[0]),a[1]=Math.min(a[1],i[1]),a[2]=Math.max(a[2],i[0]),a[3]=Math.max(a[3],i[1])}function za(a,i){return!(a[0]<=i[0]||a[2]>=i[2]||a[1]<=i[1]||a[3]>=i[3])}function om(a,i,o){let u=a[0]-i[0],f=a[1]-i[1],_=a[0]-o[0],y=a[1]-o[1];return u*y-_*f==0&&u*_<=0&&f*y<=0}function ho(a,i,o,u){return(f=[u[0]-o[0],u[1]-o[1]])[0]*(_=[i[0]-a[0],i[1]-a[1]])[1]-f[1]*_[0]!=0&&!(!Gd(a,i,o,u)||!Gd(o,u,a,i));var f,_}function am(a,i,o){for(let u of o)for(let f=0;f<u.length-1;++f)if(ho(a,i,u[f],u[f+1]))return!0;return!1}function uo(a,i,o=!1){let u=!1;for(let w of i)for(let C=0;C<w.length-1;C++){if(om(a,w[C],w[C+1]))return o;(_=w[C])[1]>(f=a)[1]!=(y=w[C+1])[1]>f[1]&&f[0]<(y[0]-_[0])*(f[1]-_[1])/(y[1]-_[1])+_[0]&&(u=!u)}var f,_,y;return u}function Bd(a,i){for(let o of i)if(uo(a,o))return!0;return!1}function jd(a,i){for(let o of a)if(!uo(o,i))return!1;for(let o=0;o<a.length-1;++o)if(am(a[o],a[o+1],i))return!1;return!0}function Nd(a,i){for(let o of i)if(jd(a,o))return!0;return!1}function Gd(a,i,o,u){let f=u[0]-o[0],_=u[1]-o[1],y=(a[0]-o[0])*_-f*(a[1]-o[1]),w=(i[0]-o[0])*_-f*(i[1]-o[1]);return y>0&&w<0||y<0&&w>0}function uh(a,i,o){let u=[];for(let f=0;f<a.length;f++){let _=[];for(let y=0;y<a[f].length;y++){let w=ch(a[f][y],o);Fa(i,w),_.push(w)}u.push(_)}return u}function Vd(a,i,o){let u=[];for(let f=0;f<a.length;f++){let _=uh(a[f],i,o);u.push(_)}return u}function Ud(a,i,o,u){if(a[0]<o[0]||a[0]>o[2]){let f=.5*u,_=a[0]-o[0]>f?-u:o[0]-a[0]>f?u:0;_===0&&(_=a[0]-o[2]>f?-u:o[2]-a[0]>f?u:0),a[0]+=_}Fa(i,a)}function Zd(a,i,o,u){let f=Math.pow(2,u.z)*is,_=[u.x*is,u.y*is],y=[];for(let w of a)for(let C of w){let I=[C.x+_[0],C.y+_[1]];Ud(I,i,o,f),y.push(I)}return y}function dh(a,i,o,u){let f=Math.pow(2,u.z)*is,_=[u.x*is,u.y*is],y=[];for(let C of a){let I=[];for(let L of C){let k=[L.x+_[0],L.y+_[1]];Fa(i,k),I.push(k)}y.push(I)}if(i[2]-i[0]<=f/2){(w=i)[0]=w[1]=1/0,w[2]=w[3]=-1/0;for(let C of y)for(let I of C)Ud(I,i,o,f)}var w;return y}class js{constructor(i,o){this.type=Qe,this.geojson=i,this.geometries=o}static parse(i,o){if(i.length!==2)return o.error(`'within' expression requires exactly one argument, but found ${i.length-1} instead.`);if(Go(i[1])){let u=i[1];if(u.type==="FeatureCollection"){let f=[];for(let _ of u.features){let{type:y,coordinates:w}=_.geometry;y==="Polygon"&&f.push(w),y==="MultiPolygon"&&f.push(...w)}if(f.length)return new js(u,{type:"MultiPolygon",coordinates:f})}else if(u.type==="Feature"){let f=u.geometry.type;if(f==="Polygon"||f==="MultiPolygon")return new js(u,u.geometry)}else if(u.type==="Polygon"||u.type==="MultiPolygon")return new js(u,u)}return o.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(i){if(i.geometry()!=null&&i.canonicalID()!=null){if(i.geometryType()==="Point")return function(o,u){let f=[1/0,1/0,-1/0,-1/0],_=[1/0,1/0,-1/0,-1/0],y=o.canonicalID();if(u.type==="Polygon"){let w=uh(u.coordinates,_,y),C=Zd(o.geometry(),f,_,y);if(!za(f,_))return!1;for(let I of C)if(!uo(I,w))return!1}if(u.type==="MultiPolygon"){let w=Vd(u.coordinates,_,y),C=Zd(o.geometry(),f,_,y);if(!za(f,_))return!1;for(let I of C)if(!Bd(I,w))return!1}return!0}(i,this.geometries);if(i.geometryType()==="LineString")return function(o,u){let f=[1/0,1/0,-1/0,-1/0],_=[1/0,1/0,-1/0,-1/0],y=o.canonicalID();if(u.type==="Polygon"){let w=uh(u.coordinates,_,y),C=dh(o.geometry(),f,_,y);if(!za(f,_))return!1;for(let I of C)if(!jd(I,w))return!1}if(u.type==="MultiPolygon"){let w=Vd(u.coordinates,_,y),C=dh(o.geometry(),f,_,y);if(!za(f,_))return!1;for(let I of C)if(!Nd(I,w))return!1}return!0}(i,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let ph=class{constructor(a=[],i=(o,u)=>o<u?-1:o>u?1:0){if(this.data=a,this.length=this.data.length,this.compare=i,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(a){this.data.push(a),this._up(this.length++)}pop(){if(this.length===0)return;let a=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),a}peek(){return this.data[0]}_up(a){let{data:i,compare:o}=this,u=i[a];for(;a>0;){let f=a-1>>1,_=i[f];if(o(u,_)>=0)break;i[a]=_,a=f}i[a]=u}_down(a){let{data:i,compare:o}=this,u=this.length>>1,f=i[a];for(;a<u;){let _=1+(a<<1),y=_+1;if(y<this.length&&o(i[y],i[_])<0&&(_=y),o(i[_],f)>=0)break;i[a]=i[_],a=_}i[a]=f}};function qd(a,i,o=0,u=a.length-1,f=lm){for(;u>o;){if(u-o>600){let C=u-o+1,I=i-o+1,L=Math.log(C),k=.5*Math.exp(2*L/3),B=.5*Math.sqrt(L*k*(C-k)/C)*(I-C/2<0?-1:1);qd(a,i,Math.max(o,Math.floor(i-I*k/C+B)),Math.min(u,Math.floor(i+(C-I)*k/C+B)),f)}let _=a[i],y=o,w=u;for(Oa(a,o,i),f(a[u],_)>0&&Oa(a,o,u);y<w;){for(Oa(a,y,w),y++,w--;f(a[y],_)<0;)y++;for(;f(a[w],_)>0;)w--}f(a[o],_)===0?Oa(a,o,w):(w++,Oa(a,w,u)),w<=i&&(o=w+1),i<=w&&(u=w-1)}}function Oa(a,i,o){let u=a[i];a[i]=a[o],a[o]=u}function lm(a,i){return a<i?-1:a>i?1:0}function $o(a,i){if(a.length<=1)return[a];let o=[],u,f;for(let _ of a){let y=hm(_);y!==0&&(_.area=Math.abs(y),f===void 0&&(f=y<0),f===y<0?(u&&o.push(u),u=[_]):u.push(_))}if(u&&o.push(u),i>1)for(let _=0;_<o.length;_++)o[_].length<=i||(qd(o[_],i,1,o[_].length-1,cm),o[_]=o[_].slice(0,i));return o}function cm(a,i){return i.area-a.area}function hm(a){let i=0;for(let o,u,f=0,_=a.length,y=_-1;f<_;y=f++)o=a[f],u=a[y],i+=(u.x-o.x)*(o.y+u.y);return i}let Wd=1/298.257223563,fh=Wd*(2-Wd),mh=Math.PI/180;class gh{constructor(i){let o=6378.137*mh*1e3,u=Math.cos(i*mh),f=1/(1-fh*(1-u*u)),_=Math.sqrt(f);this.kx=o*_*u,this.ky=o*_*f*(1-fh)}distance(i,o){let u=this.wrap(i[0]-o[0])*this.kx,f=(i[1]-o[1])*this.ky;return Math.sqrt(u*u+f*f)}pointOnLine(i,o){let u,f,_,y,w=1/0;for(let C=0;C<i.length-1;C++){let I=i[C][0],L=i[C][1],k=this.wrap(i[C+1][0]-I)*this.kx,B=(i[C+1][1]-L)*this.ky,N=0;k===0&&B===0||(N=(this.wrap(o[0]-I)*this.kx*k+(o[1]-L)*this.ky*B)/(k*k+B*B),N>1?(I=i[C+1][0],L=i[C+1][1]):N>0&&(I+=k/this.kx*N,L+=B/this.ky*N)),k=this.wrap(o[0]-I)*this.kx,B=(o[1]-L)*this.ky;let G=k*k+B*B;G<w&&(w=G,u=I,f=L,_=C,y=N)}return{point:[u,f],index:_,t:Math.max(0,Math.min(1,y))}}wrap(i){for(;i<-180;)i+=360;for(;i>180;)i-=360;return i}}function $d(a,i){return i[0]-a[0]}function Ba(a){return a[1]-a[0]+1}function rs(a,i){return a[1]>=a[0]&&a[1]<i}function _h(a,i){if(a[0]>a[1])return[null,null];let o=Ba(a);if(i){if(o===2)return[a,null];let f=Math.floor(o/2);return[[a[0],a[0]+f],[a[0]+f,a[1]]]}if(o===1)return[a,null];let u=Math.floor(o/2)-1;return[[a[0],a[0]+u],[a[0]+u+1,a[1]]]}function yh(a,i){if(!rs(i,a.length))return[1/0,1/0,-1/0,-1/0];let o=[1/0,1/0,-1/0,-1/0];for(let u=i[0];u<=i[1];++u)Fa(o,a[u]);return o}function xh(a){let i=[1/0,1/0,-1/0,-1/0];for(let o of a)for(let u of o)Fa(i,u);return i}function vh(a){return a[0]!==-1/0&&a[1]!==-1/0&&a[2]!==1/0&&a[3]!==1/0}function bh(a,i,o){if(!vh(a)||!vh(i))return NaN;let u=0,f=0;return a[2]<i[0]&&(u=i[0]-a[2]),a[0]>i[2]&&(u=a[0]-i[2]),a[1]>i[3]&&(f=a[1]-i[3]),a[3]<i[1]&&(f=i[1]-a[3]),o.distance([0,0],[u,f])}function po(a,i,o){let u=o.pointOnLine(i,a);return o.distance(a,u.point)}function wh(a,i,o,u,f){let _=Math.min(po(a,[o,u],f),po(i,[o,u],f)),y=Math.min(po(o,[a,i],f),po(u,[a,i],f));return Math.min(_,y)}function um(a,i,o,u,f){if(!rs(i,a.length)||!rs(u,o.length))return 1/0;let _=1/0;for(let y=i[0];y<i[1];++y){let w=a[y],C=a[y+1];for(let I=u[0];I<u[1];++I){let L=o[I],k=o[I+1];if(ho(w,C,L,k))return 0;_=Math.min(_,wh(w,C,L,k,f))}}return _}function Wt(a,i,o,u,f){if(!rs(i,a.length)||!rs(u,o.length))return NaN;let _=1/0;for(let y=i[0];y<=i[1];++y)for(let w=u[0];w<=u[1];++w)if(_=Math.min(_,f.distance(a[y],o[w])),_===0)return _;return _}function dm(a,i,o){if(uo(a,i,!0))return 0;let u=1/0;for(let f of i){let _=f[0],y=f[f.length-1];if(_!==y&&(u=Math.min(u,po(a,[y,_],o)),u===0))return u;let w=o.pointOnLine(f,a);if(u=Math.min(u,o.distance(a,w.point)),u===0)return u}return u}function pm(a,i,o,u){if(!rs(i,a.length))return NaN;for(let _=i[0];_<=i[1];++_)if(uo(a[_],o,!0))return 0;let f=1/0;for(let _=i[0];_<i[1];++_){let y=a[_],w=a[_+1];for(let C of o)for(let I=0,L=C.length,k=L-1;I<L;k=I++){let B=C[k],N=C[I];if(ho(y,w,B,N))return 0;f=Math.min(f,wh(y,w,B,N,u))}}return f}function Xd(a,i){for(let o of a)for(let u of o)if(uo(u,i,!0))return!0;return!1}function fm(a,i,o,u=1/0){let f=xh(a),_=xh(i);if(u!==1/0&&bh(f,_,o)>=u)return u;if(za(f,_)){if(Xd(a,i))return 0}else if(Xd(i,a))return 0;let y=1/0;for(let w of a)for(let C=0,I=w.length,L=I-1;C<I;L=C++){let k=w[L],B=w[C];for(let N of i)for(let G=0,U=N.length,Y=U-1;G<U;Y=G++){let te=N[Y],de=N[G];if(ho(k,B,te,de))return 0;y=Math.min(y,wh(k,B,te,de,o))}}return y}function Hd(a,i,o,u,f,_){if(!_)return;let y=bh(yh(u,_),f,o);y<i&&a.push([y,_,[0,0]])}function jl(a,i,o,u,f,_,y){if(!_||!y)return;let w=bh(yh(u,_),yh(f,y),o);w<i&&a.push([w,_,y])}function Nl(a,i,o,u,f=1/0){let _=Math.min(u.distance(a[0],o[0][0]),f);if(_===0)return _;let y=new ph([[0,[0,a.length-1],[0,0]]],$d),w=xh(o);for(;y.length>0;){let C=y.pop();if(C[0]>=_)continue;let I=C[1],L=i?50:100;if(Ba(I)<=L){if(!rs(I,a.length))return NaN;if(i){let k=pm(a,I,o,u);if(isNaN(k)||k===0)return k;_=Math.min(_,k)}else for(let k=I[0];k<=I[1];++k){let B=dm(a[k],o,u);if(_=Math.min(_,B),_===0)return 0}}else{let k=_h(I,i);Hd(y,_,u,a,w,k[0]),Hd(y,_,u,a,w,k[1])}}return _}function Gl(a,i,o,u,f,_=1/0){let y=Math.min(_,f.distance(a[0],o[0]));if(y===0)return y;let w=new ph([[0,[0,a.length-1],[0,o.length-1]]],$d);for(;w.length>0;){let C=w.pop();if(C[0]>=y)continue;let I=C[1],L=C[2],k=i?50:100,B=u?50:100;if(Ba(I)<=k&&Ba(L)<=B){if(!rs(I,a.length)&&rs(L,o.length))return NaN;let N;if(i&&u)N=um(a,I,o,L,f),y=Math.min(y,N);else if(i&&!u){let G=a.slice(I[0],I[1]+1);for(let U=L[0];U<=L[1];++U)if(N=po(o[U],G,f),y=Math.min(y,N),y===0)return y}else if(!i&&u){let G=o.slice(L[0],L[1]+1);for(let U=I[0];U<=I[1];++U)if(N=po(a[U],G,f),y=Math.min(y,N),y===0)return y}else N=Wt(a,I,o,L,f),y=Math.min(y,N)}else{let N=_h(I,i),G=_h(L,u);jl(w,y,f,a,o,N[0],G[0]),jl(w,y,f,a,o,N[0],G[1]),jl(w,y,f,a,o,N[1],G[0]),jl(w,y,f,a,o,N[1],G[1])}}return y}function Sh(a){return a.type==="MultiPolygon"?a.coordinates.map(i=>({type:"Polygon",coordinates:i})):a.type==="MultiLineString"?a.coordinates.map(i=>({type:"LineString",coordinates:i})):a.type==="MultiPoint"?a.coordinates.map(i=>({type:"Point",coordinates:i})):[a]}class fo{constructor(i,o){this.type=Pe,this.geojson=i,this.geometries=o}static parse(i,o){if(i.length!==2)return o.error(`'distance' expression requires exactly one argument, but found ${i.length-1} instead.`);if(Go(i[1])){let u=i[1];if(u.type==="FeatureCollection")return new fo(u,u.features.map(f=>Sh(f.geometry)).flat());if(u.type==="Feature")return new fo(u,Sh(u.geometry));if("type"in u&&"coordinates"in u)return new fo(u,Sh(u))}return o.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(i){if(i.geometry()!=null&&i.canonicalID()!=null){if(i.geometryType()==="Point")return function(o,u){let f=o.geometry(),_=f.flat().map(C=>hh([C.x,C.y],o.canonical));if(f.length===0)return NaN;let y=new gh(_[0][1]),w=1/0;for(let C of u){switch(C.type){case"Point":w=Math.min(w,Gl(_,!1,[C.coordinates],!1,y,w));break;case"LineString":w=Math.min(w,Gl(_,!1,C.coordinates,!0,y,w));break;case"Polygon":w=Math.min(w,Nl(_,!1,C.coordinates,y,w))}if(w===0)return w}return w}(i,this.geometries);if(i.geometryType()==="LineString")return function(o,u){let f=o.geometry(),_=f.flat().map(C=>hh([C.x,C.y],o.canonical));if(f.length===0)return NaN;let y=new gh(_[0][1]),w=1/0;for(let C of u){switch(C.type){case"Point":w=Math.min(w,Gl(_,!0,[C.coordinates],!1,y,w));break;case"LineString":w=Math.min(w,Gl(_,!0,C.coordinates,!0,y,w));break;case"Polygon":w=Math.min(w,Nl(_,!0,C.coordinates,y,w))}if(w===0)return w}return w}(i,this.geometries);if(i.geometryType()==="Polygon")return function(o,u){let f=o.geometry();if(f.length===0||f[0].length===0)return NaN;let _=$o(f,0).map(C=>C.map(I=>I.map(L=>hh([L.x,L.y],o.canonical)))),y=new gh(_[0][0][0][1]),w=1/0;for(let C of u)for(let I of _){switch(C.type){case"Point":w=Math.min(w,Nl([C.coordinates],!1,I,y,w));break;case"LineString":w=Math.min(w,Nl(C.coordinates,!0,I,y,w));break;case"Polygon":w=Math.min(w,fm(I,C.coordinates,y,w))}if(w===0)return w}return w}(i,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}let Xo={"==":ah,"!=":Od,">":Ol,"<":nm,">=":sm,"<=":lh,array:dr,at:Rt,boolean:dr,case:jn,coalesce:ka,collator:co,format:Vr,image:Bl,in:Ra,"index-of":Bt,interpolate:ir,"interpolate-hcl":ir,"interpolate-lab":ir,length:Wo,let:Vo,literal:oo,match:Aa,number:dr,"number-format":qo,object:dr,slice:Uo,step:Zo,string:dr,"to-boolean":_s,"to-color":_s,"to-number":_s,"to-string":_s,var:Ot,within:js,distance:fo};class _n{constructor(i,o,u,f){this.name=i,this.type=o,this._evaluate=u,this.args=f}evaluate(i){return this._evaluate(i,this.args)}eachChild(i){this.args.forEach(i)}outputDefined(){return!1}static parse(i,o){let u=i[0],f=_n.definitions[u];if(!f)return o.error(`Unknown expression "${u}". If you wanted a literal array, use ["literal", [...]].`,0);let _=Array.isArray(f)?f[0]:f.type,y=Array.isArray(f)?[[f[1],f[2]]]:f.overloads,w=y.filter(([I])=>!Array.isArray(I)||I.length===i.length-1),C=null;for(let[I,L]of w){C=new Jt(o.registry,Vl,o.path,null,o.scope);let k=[],B=!1;for(let N=1;N<i.length;N++){let G=i[N],U=Array.isArray(I)?I[N-1]:I.type,Y=C.parse(G,1+k.length,U);if(!Y){B=!0;break}k.push(Y)}if(!B)if(Array.isArray(I)&&I.length!==k.length)C.error(`Expected ${I.length} arguments, but found ${k.length} instead.`);else{for(let N=0;N<k.length;N++){let G=Array.isArray(I)?I[N]:I.type,U=k[N];C.concat(N+1).checkSubtype(G,U.type)}if(C.errors.length===0)return new _n(u,_,L,k)}}if(w.length===1)o.errors.push(...C.errors);else{let I=(w.length?w:y).map(([k])=>{return B=k,Array.isArray(B)?`(${B.map(ci).join(", ")})`:`(${ci(B.type)}...)`;var B}).join(" | "),L=[];for(let k=1;k<i.length;k++){let B=o.parse(i[k],1+L.length);if(!B)return null;L.push(ci(B.type))}o.error(`Expected arguments of type ${I}, but found (${L.join(", ")}) instead.`)}return null}static register(i,o){_n.definitions=o;for(let u in o)i[u]=_n}}function Yd(a,[i,o,u,f]){i=i.evaluate(a),o=o.evaluate(a),u=u.evaluate(a);let _=f?f.evaluate(a):1,y=Ea(i,o,u,_);if(y)throw new hi(y);return new Lt(i/255,o/255,u/255,_,!1)}function Kd(a,i){return a in i}function Th(a,i){let o=i[a];return o===void 0?null:o}function mo(a){return{type:a}}function Vl(a){if(a instanceof Ot)return Vl(a.boundExpression);if(a instanceof _n&&a.name==="error"||a instanceof co||a instanceof js||a instanceof fo)return!1;let i=a instanceof _s||a instanceof dr,o=!0;return a.eachChild(u=>{o=i?o&&Vl(u):o&&u instanceof oo}),!!o&&Ul(a)&&Zl(a,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Ul(a){if(a instanceof _n&&(a.name==="get"&&a.args.length===1||a.name==="feature-state"||a.name==="has"&&a.args.length===1||a.name==="properties"||a.name==="geometry-type"||a.name==="id"||/^filter-/.test(a.name))||a instanceof js||a instanceof fo)return!1;let i=!0;return a.eachChild(o=>{i&&!Ul(o)&&(i=!1)}),i}function ja(a){if(a instanceof _n&&a.name==="feature-state")return!1;let i=!0;return a.eachChild(o=>{i&&!ja(o)&&(i=!1)}),i}function Zl(a,i){if(a instanceof _n&&i.indexOf(a.name)>=0)return!1;let o=!0;return a.eachChild(u=>{o&&!Zl(u,i)&&(o=!1)}),o}function Jd(a){return{result:"success",value:a}}function Ho(a){return{result:"error",value:a}}function Yo(a){return a["property-type"]==="data-driven"||a["property-type"]==="cross-faded-data-driven"}function Qd(a){return!!a.expression&&a.expression.parameters.indexOf("zoom")>-1}function Ch(a){return!!a.expression&&a.expression.interpolated}function Nt(a){return a instanceof Number?"number":a instanceof String?"string":a instanceof Boolean?"boolean":Array.isArray(a)?"array":a===null?"null":typeof a}function ql(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)}function mm(a){return a}function ep(a,i){let o=i.type==="color",u=a.stops&&typeof a.stops[0][0]=="object",f=u||!(u||a.property!==void 0),_=a.type||(Ch(i)?"exponential":"interval");if(o||i.type==="padding"){let L=o?Lt.parse:pi.parse;(a=Xe({},a)).stops&&(a.stops=a.stops.map(k=>[k[0],L(k[1])])),a.default=L(a.default?a.default:i.default)}if(a.colorSpace&&(y=a.colorSpace)!=="rgb"&&y!=="hcl"&&y!=="lab")throw new Error(`Unknown color space: "${a.colorSpace}"`);var y;let w,C,I;if(_==="exponential")w=tp;else if(_==="interval")w=Mh;else if(_==="categorical"){w=gm,C=Object.create(null);for(let L of a.stops)C[L[0]]=L[1];I=typeof a.stops[0][0]}else{if(_!=="identity")throw new Error(`Unknown function type "${_}"`);w=_m}if(u){let L={},k=[];for(let G=0;G<a.stops.length;G++){let U=a.stops[G],Y=U[0].zoom;L[Y]===void 0&&(L[Y]={zoom:Y,type:a.type,property:a.property,default:a.default,stops:[]},k.push(Y)),L[Y].stops.push([U[0].value,U[1]])}let B=[];for(let G of k)B.push([L[G].zoom,ep(L[G],i)]);let N={name:"linear"};return{kind:"composite",interpolationType:N,interpolationFactor:ir.interpolationFactor.bind(void 0,N),zoomStops:B.map(G=>G[0]),evaluate:({zoom:G},U)=>tp({stops:B,base:a.base},i,G).evaluate(G,U)}}if(f){let L=_==="exponential"?{name:"exponential",base:a.base!==void 0?a.base:1}:null;return{kind:"camera",interpolationType:L,interpolationFactor:ir.interpolationFactor.bind(void 0,L),zoomStops:a.stops.map(k=>k[0]),evaluate:({zoom:k})=>w(a,i,k,C,I)}}return{kind:"source",evaluate(L,k){let B=k&&k.properties?k.properties[a.property]:void 0;return B===void 0?Na(a.default,i.default):w(a,i,B,C,I)}}}function Na(a,i,o){return a!==void 0?a:i!==void 0?i:o!==void 0?o:void 0}function gm(a,i,o,u,f){return Na(typeof o===f?u[o]:void 0,a.default,i.default)}function Mh(a,i,o){if(Nt(o)!=="number")return Na(a.default,i.default);let u=a.stops.length;if(u===1||o<=a.stops[0][0])return a.stops[0][1];if(o>=a.stops[u-1][0])return a.stops[u-1][1];let f=La(a.stops.map(_=>_[0]),o);return a.stops[f][1]}function tp(a,i,o){let u=a.base!==void 0?a.base:1;if(Nt(o)!=="number")return Na(a.default,i.default);let f=a.stops.length;if(f===1||o<=a.stops[0][0])return a.stops[0][1];if(o>=a.stops[f-1][0])return a.stops[f-1][1];let _=La(a.stops.map(L=>L[0]),o),y=function(L,k,B,N){let G=N-B,U=L-B;return G===0?0:k===1?U/G:(Math.pow(k,U)-1)/(Math.pow(k,G)-1)}(o,u,a.stops[_][0],a.stops[_+1][0]),w=a.stops[_][1],C=a.stops[_+1][1],I=cn[i.type]||mm;return typeof w.evaluate=="function"?{evaluate(...L){let k=w.evaluate.apply(void 0,L),B=C.evaluate.apply(void 0,L);if(k!==void 0&&B!==void 0)return I(k,B,y,a.colorSpace)}}:I(w,C,y,a.colorSpace)}function _m(a,i,o){switch(i.type){case"color":o=Lt.parse(o);break;case"formatted":o=Cr.fromString(o.toString());break;case"resolvedImage":o=Gr.fromString(o.toString());break;case"padding":o=pi.parse(o);break;default:Nt(o)===i.type||i.type==="enum"&&i.values[o]||(o=void 0)}return Na(o,a.default,i.default)}_n.register(Xo,{error:[{kind:"error"},[We],(a,[i])=>{throw new hi(i.evaluate(a))}],typeof:[We,[Ke],(a,[i])=>ci(wi(i.evaluate(a)))],"to-rgba":[ln(Pe,4),[wt],(a,[i])=>{let[o,u,f,_]=i.evaluate(a).rgb;return[255*o,255*u,255*f,_]}],rgb:[wt,[Pe,Pe,Pe],Yd],rgba:[wt,[Pe,Pe,Pe,Pe],Yd],has:{type:Qe,overloads:[[[We],(a,[i])=>Kd(i.evaluate(a),a.properties())],[[We,nt],(a,[i,o])=>Kd(i.evaluate(a),o.evaluate(a))]]},get:{type:Ke,overloads:[[[We],(a,[i])=>Th(i.evaluate(a),a.properties())],[[We,nt],(a,[i,o])=>Th(i.evaluate(a),o.evaluate(a))]]},"feature-state":[Ke,[We],(a,[i])=>Th(i.evaluate(a),a.featureState||{})],properties:[nt,[],a=>a.properties()],"geometry-type":[We,[],a=>a.geometryType()],id:[Ke,[],a=>a.id()],zoom:[Pe,[],a=>a.globals.zoom],"heatmap-density":[Pe,[],a=>a.globals.heatmapDensity||0],"line-progress":[Pe,[],a=>a.globals.lineProgress||0],accumulated:[Ke,[],a=>a.globals.accumulated===void 0?null:a.globals.accumulated],"+":[Pe,mo(Pe),(a,i)=>{let o=0;for(let u of i)o+=u.evaluate(a);return o}],"*":[Pe,mo(Pe),(a,i)=>{let o=1;for(let u of i)o*=u.evaluate(a);return o}],"-":{type:Pe,overloads:[[[Pe,Pe],(a,[i,o])=>i.evaluate(a)-o.evaluate(a)],[[Pe],(a,[i])=>-i.evaluate(a)]]},"/":[Pe,[Pe,Pe],(a,[i,o])=>i.evaluate(a)/o.evaluate(a)],"%":[Pe,[Pe,Pe],(a,[i,o])=>i.evaluate(a)%o.evaluate(a)],ln2:[Pe,[],()=>Math.LN2],pi:[Pe,[],()=>Math.PI],e:[Pe,[],()=>Math.E],"^":[Pe,[Pe,Pe],(a,[i,o])=>Math.pow(i.evaluate(a),o.evaluate(a))],sqrt:[Pe,[Pe],(a,[i])=>Math.sqrt(i.evaluate(a))],log10:[Pe,[Pe],(a,[i])=>Math.log(i.evaluate(a))/Math.LN10],ln:[Pe,[Pe],(a,[i])=>Math.log(i.evaluate(a))],log2:[Pe,[Pe],(a,[i])=>Math.log(i.evaluate(a))/Math.LN2],sin:[Pe,[Pe],(a,[i])=>Math.sin(i.evaluate(a))],cos:[Pe,[Pe],(a,[i])=>Math.cos(i.evaluate(a))],tan:[Pe,[Pe],(a,[i])=>Math.tan(i.evaluate(a))],asin:[Pe,[Pe],(a,[i])=>Math.asin(i.evaluate(a))],acos:[Pe,[Pe],(a,[i])=>Math.acos(i.evaluate(a))],atan:[Pe,[Pe],(a,[i])=>Math.atan(i.evaluate(a))],min:[Pe,mo(Pe),(a,i)=>Math.min(...i.map(o=>o.evaluate(a)))],max:[Pe,mo(Pe),(a,i)=>Math.max(...i.map(o=>o.evaluate(a)))],abs:[Pe,[Pe],(a,[i])=>Math.abs(i.evaluate(a))],round:[Pe,[Pe],(a,[i])=>{let o=i.evaluate(a);return o<0?-Math.round(-o):Math.round(o)}],floor:[Pe,[Pe],(a,[i])=>Math.floor(i.evaluate(a))],ceil:[Pe,[Pe],(a,[i])=>Math.ceil(i.evaluate(a))],"filter-==":[Qe,[We,Ke],(a,[i,o])=>a.properties()[i.value]===o.value],"filter-id-==":[Qe,[Ke],(a,[i])=>a.id()===i.value],"filter-type-==":[Qe,[We],(a,[i])=>a.geometryType()===i.value],"filter-<":[Qe,[We,Ke],(a,[i,o])=>{let u=a.properties()[i.value],f=o.value;return typeof u==typeof f&&u<f}],"filter-id-<":[Qe,[Ke],(a,[i])=>{let o=a.id(),u=i.value;return typeof o==typeof u&&o<u}],"filter->":[Qe,[We,Ke],(a,[i,o])=>{let u=a.properties()[i.value],f=o.value;return typeof u==typeof f&&u>f}],"filter-id->":[Qe,[Ke],(a,[i])=>{let o=a.id(),u=i.value;return typeof o==typeof u&&o>u}],"filter-<=":[Qe,[We,Ke],(a,[i,o])=>{let u=a.properties()[i.value],f=o.value;return typeof u==typeof f&&u<=f}],"filter-id-<=":[Qe,[Ke],(a,[i])=>{let o=a.id(),u=i.value;return typeof o==typeof u&&o<=u}],"filter->=":[Qe,[We,Ke],(a,[i,o])=>{let u=a.properties()[i.value],f=o.value;return typeof u==typeof f&&u>=f}],"filter-id->=":[Qe,[Ke],(a,[i])=>{let o=a.id(),u=i.value;return typeof o==typeof u&&o>=u}],"filter-has":[Qe,[Ke],(a,[i])=>i.value in a.properties()],"filter-has-id":[Qe,[],a=>a.id()!==null&&a.id()!==void 0],"filter-type-in":[Qe,[ln(We)],(a,[i])=>i.value.indexOf(a.geometryType())>=0],"filter-id-in":[Qe,[ln(Ke)],(a,[i])=>i.value.indexOf(a.id())>=0],"filter-in-small":[Qe,[We,ln(Ke)],(a,[i,o])=>o.value.indexOf(a.properties()[i.value])>=0],"filter-in-large":[Qe,[We,ln(Ke)],(a,[i,o])=>function(u,f,_,y){for(;_<=y;){let w=_+y>>1;if(f[w]===u)return!0;f[w]>u?y=w-1:_=w+1}return!1}(a.properties()[i.value],o.value,0,o.value.length-1)],all:{type:Qe,overloads:[[[Qe,Qe],(a,[i,o])=>i.evaluate(a)&&o.evaluate(a)],[mo(Qe),(a,i)=>{for(let o of i)if(!o.evaluate(a))return!1;return!0}]]},any:{type:Qe,overloads:[[[Qe,Qe],(a,[i,o])=>i.evaluate(a)||o.evaluate(a)],[mo(Qe),(a,i)=>{for(let o of i)if(o.evaluate(a))return!0;return!1}]]},"!":[Qe,[Qe],(a,[i])=>!i.evaluate(a)],"is-supported-script":[Qe,[We],(a,[i])=>{let o=a.globals&&a.globals.isSupportedScript;return!o||o(i.evaluate(a))}],upcase:[We,[We],(a,[i])=>i.evaluate(a).toUpperCase()],downcase:[We,[We],(a,[i])=>i.evaluate(a).toLowerCase()],concat:[We,mo(Ke),(a,i)=>i.map(o=>Bn(o.evaluate(a))).join("")],"resolved-locale":[We,[ai],(a,[i])=>i.evaluate(a).resolvedLocale()]});class Ih{constructor(i,o){var u;this.expression=i,this._warningHistory={},this._evaluator=new Pa,this._defaultValue=o?(u=o).type==="color"&&ql(u.default)?new Lt(0,0,0,0):u.type==="color"?Lt.parse(u.default)||null:u.type==="padding"?pi.parse(u.default)||null:u.type==="variableAnchorOffsetCollection"?ur.parse(u.default)||null:u.type==="projectionDefinition"?tr.parse(u.default)||null:u.default===void 0?null:u.default:null,this._enumValues=o&&o.type==="enum"?o.values:null}evaluateWithoutErrorHandling(i,o,u,f,_,y){return this._evaluator.globals=i,this._evaluator.feature=o,this._evaluator.featureState=u,this._evaluator.canonical=f,this._evaluator.availableImages=_||null,this._evaluator.formattedSection=y,this.expression.evaluate(this._evaluator)}evaluate(i,o,u,f,_,y){this._evaluator.globals=i,this._evaluator.feature=o||null,this._evaluator.featureState=u||null,this._evaluator.canonical=f,this._evaluator.availableImages=_||null,this._evaluator.formattedSection=y||null;try{let w=this.expression.evaluate(this._evaluator);if(w==null||typeof w=="number"&&w!=w)return this._defaultValue;if(this._enumValues&&!(w in this._enumValues))throw new hi(`Expected value to be one of ${Object.keys(this._enumValues).map(C=>JSON.stringify(C)).join(", ")}, but found ${JSON.stringify(w)} instead.`);return w}catch(w){return this._warningHistory[w.message]||(this._warningHistory[w.message]=!0,typeof console<"u"&&console.warn(w.message)),this._defaultValue}}}function Ga(a){return Array.isArray(a)&&a.length>0&&typeof a[0]=="string"&&a[0]in Xo}function Wl(a,i){let o=new Jt(Xo,Vl,[],i?function(f){let _={color:wt,string:We,number:Pe,enum:We,boolean:Qe,formatted:Bs,padding:ji,projectionDefinition:mt,resolvedImage:ki,variableAnchorOffsetCollection:li};return f.type==="array"?ln(_[f.value]||Ke,f.length):_[f.type]}(i):void 0),u=o.parse(a,void 0,void 0,void 0,i&&i.type==="string"?{typeAnnotation:"coerce"}:void 0);return u?Jd(new Ih(u,i)):Ho(o.errors)}class Eh{constructor(i,o){this.kind=i,this._styleExpression=o,this.isStateDependent=i!=="constant"&&!ja(o.expression)}evaluateWithoutErrorHandling(i,o,u,f,_,y){return this._styleExpression.evaluateWithoutErrorHandling(i,o,u,f,_,y)}evaluate(i,o,u,f,_,y){return this._styleExpression.evaluate(i,o,u,f,_,y)}}class Ko{constructor(i,o,u,f){this.kind=i,this.zoomStops=u,this._styleExpression=o,this.isStateDependent=i!=="camera"&&!ja(o.expression),this.interpolationType=f}evaluateWithoutErrorHandling(i,o,u,f,_,y){return this._styleExpression.evaluateWithoutErrorHandling(i,o,u,f,_,y)}evaluate(i,o,u,f,_,y){return this._styleExpression.evaluate(i,o,u,f,_,y)}interpolationFactor(i,o,u){return this.interpolationType?ir.interpolationFactor(this.interpolationType,i,o,u):0}}function Ph(a,i){let o=Wl(a,i);if(o.result==="error")return o;let u=o.value.expression,f=Ul(u);if(!f&&!Yo(i))return Ho([new Ue("","data expressions not supported")]);let _=Zl(u,["zoom"]);if(!_&&!Qd(i))return Ho([new Ue("","zoom expressions not supported")]);let y=Xl(u);return y||_?y instanceof Ue?Ho([y]):y instanceof ir&&!Ch(i)?Ho([new Ue("",'"interpolate" expressions cannot be used with this property')]):Jd(y?new Ko(f?"camera":"composite",o.value,y.labels,y instanceof ir?y.interpolation:void 0):new Eh(f?"constant":"source",o.value)):Ho([new Ue("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class $l{constructor(i,o){this._parameters=i,this._specification=o,Xe(this,ep(this._parameters,this._specification))}static deserialize(i){return new $l(i._parameters,i._specification)}static serialize(i){return{_parameters:i._parameters,_specification:i._specification}}}function Xl(a){let i=null;if(a instanceof Vo)i=Xl(a.result);else if(a instanceof ka){for(let o of a.args)if(i=Xl(o),i)break}else(a instanceof Zo||a instanceof ir)&&a.input instanceof _n&&a.input.name==="zoom"&&(i=a);return i instanceof Ue||a.eachChild(o=>{let u=Xl(o);u instanceof Ue?i=u:!i&&u?i=new Ue("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):i&&u&&i!==u&&(i=new Ue("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),i}function Rh(a){if(a===!0||a===!1)return!0;if(!Array.isArray(a)||a.length===0)return!1;switch(a[0]){case"has":return a.length>=2&&a[1]!=="$id"&&a[1]!=="$type";case"in":return a.length>=3&&(typeof a[1]!="string"||Array.isArray(a[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return a.length!==3||Array.isArray(a[1])||Array.isArray(a[2]);case"any":case"all":for(let i of a.slice(1))if(!Rh(i)&&typeof i!="boolean")return!1;return!0;default:return!0}}let ym={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ah(a){if(a==null)return{filter:()=>!0,needGeometry:!1};Rh(a)||(a=Hl(a));let i=Wl(a,ym);if(i.result==="error")throw new Error(i.value.map(o=>`${o.key}: ${o.message}`).join(", "));return{filter:(o,u,f)=>i.value.evaluate(o,u,{},f),needGeometry:Lh(a)}}function ip(a,i){return a<i?-1:a>i?1:0}function Lh(a){if(!Array.isArray(a))return!1;if(a[0]==="within"||a[0]==="distance")return!0;for(let i=1;i<a.length;i++)if(Lh(a[i]))return!0;return!1}function Hl(a){if(!a)return!0;let i=a[0];return a.length<=1?i!=="any":i==="=="?kh(a[1],a[2],"=="):i==="!="?Va(kh(a[1],a[2],"==")):i==="<"||i===">"||i==="<="||i===">="?kh(a[1],a[2],i):i==="any"?(o=a.slice(1),["any"].concat(o.map(Hl))):i==="all"?["all"].concat(a.slice(1).map(Hl)):i==="none"?["all"].concat(a.slice(1).map(Hl).map(Va)):i==="in"?Dh(a[1],a.slice(2)):i==="!in"?Va(Dh(a[1],a.slice(2))):i==="has"?Fh(a[1]):i!=="!has"||Va(Fh(a[1]));var o}function kh(a,i,o){switch(a){case"$type":return[`filter-type-${o}`,i];case"$id":return[`filter-id-${o}`,i];default:return[`filter-${o}`,a,i]}}function Dh(a,i){if(i.length===0)return!1;switch(a){case"$type":return["filter-type-in",["literal",i]];case"$id":return["filter-id-in",["literal",i]];default:return i.length>200&&!i.some(o=>typeof o!=typeof i[0])?["filter-in-large",a,["literal",i.sort(ip)]]:["filter-in-small",a,["literal",i]]}}function Fh(a){switch(a){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",a]}}function Va(a){return["!",a]}function Yl(a){let i=typeof a;if(i==="number"||i==="boolean"||i==="string"||a==null)return JSON.stringify(a);if(Array.isArray(a)){let f="[";for(let _ of a)f+=`${Yl(_)},`;return`${f}]`}let o=Object.keys(a).sort(),u="{";for(let f=0;f<o.length;f++)u+=`${JSON.stringify(o[f])}:${Yl(a[o[f]])},`;return`${u}}`}function zh(a){let i="";for(let o of Z)i+=`/${Yl(a[o])}`;return i}function Kl(a){let i=a.value;return i?[new pe(a.key,i,"constants have been deprecated as of v8")]:[]}function fi(a){return a instanceof Number||a instanceof String||a instanceof Boolean?a.valueOf():a}function ns(a){if(Array.isArray(a))return a.map(ns);if(a instanceof Object&&!(a instanceof Number||a instanceof String||a instanceof Boolean)){let i={};for(let o in a)i[o]=ns(a[o]);return i}return fi(a)}function yn(a){let i=a.key,o=a.value,u=a.valueSpec||{},f=a.objectElementValidators||{},_=a.style,y=a.styleSpec,w=a.validateSpec,C=[],I=Nt(o);if(I!=="object")return[new pe(i,o,`object expected, ${I} found`)];for(let L in o){let k=L.split(".")[0],B=u[k]||u["*"],N;if(f[k])N=f[k];else if(u[k])N=w;else if(f["*"])N=f["*"];else{if(!u["*"]){C.push(new pe(i,o[L],`unknown property "${L}"`));continue}N=w}C=C.concat(N({key:(i&&`${i}.`)+L,value:o[L],valueSpec:B,style:_,styleSpec:y,object:o,objectKey:L,validateSpec:w},o))}for(let L in u)f[L]||u[L].required&&u[L].default===void 0&&o[L]===void 0&&C.push(new pe(i,o,`missing required property "${L}"`));return C}function Oh(a){let i=a.value,o=a.valueSpec,u=a.style,f=a.styleSpec,_=a.key,y=a.arrayElementValidator||a.validateSpec;if(Nt(i)!=="array")return[new pe(_,i,`array expected, ${Nt(i)} found`)];if(o.length&&i.length!==o.length)return[new pe(_,i,`array length ${o.length} expected, length ${i.length} found`)];if(o["min-length"]&&i.length<o["min-length"])return[new pe(_,i,`array length at least ${o["min-length"]} expected, length ${i.length} found`)];let w={type:o.value,values:o.values};f.$version<7&&(w.function=o.function),Nt(o.value)==="object"&&(w=o.value);let C=[];for(let I=0;I<i.length;I++)C=C.concat(y({array:i,arrayIndex:I,value:i[I],valueSpec:w,validateSpec:a.validateSpec,style:u,styleSpec:f,key:`${_}[${I}]`}));return C}function Bh(a){let i=a.key,o=a.value,u=a.valueSpec,f=Nt(o);return f==="number"&&o!=o&&(f="NaN"),f!=="number"?[new pe(i,o,`number expected, ${f} found`)]:"minimum"in u&&o<u.minimum?[new pe(i,o,`${o} is less than the minimum value ${u.minimum}`)]:"maximum"in u&&o>u.maximum?[new pe(i,o,`${o} is greater than the maximum value ${u.maximum}`)]:[]}function rp(a){let i=a.valueSpec,o=fi(a.value.type),u,f,_,y={},w=o!=="categorical"&&a.value.property===void 0,C=!w,I=Nt(a.value.stops)==="array"&&Nt(a.value.stops[0])==="array"&&Nt(a.value.stops[0][0])==="object",L=yn({key:a.key,value:a.value,valueSpec:a.styleSpec.function,validateSpec:a.validateSpec,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{stops:function(N){if(o==="identity")return[new pe(N.key,N.value,'identity function may not have a "stops" property')];let G=[],U=N.value;return G=G.concat(Oh({key:N.key,value:U,valueSpec:N.valueSpec,validateSpec:N.validateSpec,style:N.style,styleSpec:N.styleSpec,arrayElementValidator:k})),Nt(U)==="array"&&U.length===0&&G.push(new pe(N.key,U,"array must have at least one stop")),G},default:function(N){return N.validateSpec({key:N.key,value:N.value,valueSpec:i,validateSpec:N.validateSpec,style:N.style,styleSpec:N.styleSpec})}}});return o==="identity"&&w&&L.push(new pe(a.key,a.value,'missing required property "property"')),o==="identity"||a.value.stops||L.push(new pe(a.key,a.value,'missing required property "stops"')),o==="exponential"&&a.valueSpec.expression&&!Ch(a.valueSpec)&&L.push(new pe(a.key,a.value,"exponential functions not supported")),a.styleSpec.$version>=8&&(C&&!Yo(a.valueSpec)?L.push(new pe(a.key,a.value,"property functions not supported")):w&&!Qd(a.valueSpec)&&L.push(new pe(a.key,a.value,"zoom functions not supported"))),o!=="categorical"&&!I||a.value.property!==void 0||L.push(new pe(a.key,a.value,'"property" property is required')),L;function k(N){let G=[],U=N.value,Y=N.key;if(Nt(U)!=="array")return[new pe(Y,U,`array expected, ${Nt(U)} found`)];if(U.length!==2)return[new pe(Y,U,`array length 2 expected, length ${U.length} found`)];if(I){if(Nt(U[0])!=="object")return[new pe(Y,U,`object expected, ${Nt(U[0])} found`)];if(U[0].zoom===void 0)return[new pe(Y,U,"object stop key must have zoom")];if(U[0].value===void 0)return[new pe(Y,U,"object stop key must have value")];if(_&&_>fi(U[0].zoom))return[new pe(Y,U[0].zoom,"stop zoom values must appear in ascending order")];fi(U[0].zoom)!==_&&(_=fi(U[0].zoom),f=void 0,y={}),G=G.concat(yn({key:`${Y}[0]`,value:U[0],valueSpec:{zoom:{}},validateSpec:N.validateSpec,style:N.style,styleSpec:N.styleSpec,objectElementValidators:{zoom:Bh,value:B}}))}else G=G.concat(B({key:`${Y}[0]`,value:U[0],valueSpec:{},validateSpec:N.validateSpec,style:N.style,styleSpec:N.styleSpec},U));return Ga(ns(U[1]))?G.concat([new pe(`${Y}[1]`,U[1],"expressions are not allowed in function stops.")]):G.concat(N.validateSpec({key:`${Y}[1]`,value:U[1],valueSpec:i,validateSpec:N.validateSpec,style:N.style,styleSpec:N.styleSpec}))}function B(N,G){let U=Nt(N.value),Y=fi(N.value),te=N.value!==null?N.value:G;if(u){if(U!==u)return[new pe(N.key,te,`${U} stop domain type must match previous stop domain type ${u}`)]}else u=U;if(U!=="number"&&U!=="string"&&U!=="boolean")return[new pe(N.key,te,"stop domain value must be a number, string, or boolean")];if(U!=="number"&&o!=="categorical"){let de=`number expected, ${U} found`;return Yo(i)&&o===void 0&&(de+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new pe(N.key,te,de)]}return o!=="categorical"||U!=="number"||isFinite(Y)&&Math.floor(Y)===Y?o!=="categorical"&&U==="number"&&f!==void 0&&Y<f?[new pe(N.key,te,"stop domain values must appear in ascending order")]:(f=Y,o==="categorical"&&Y in y?[new pe(N.key,te,"stop domain values must be unique")]:(y[Y]=!0,[])):[new pe(N.key,te,`integer expected, found ${Y}`)]}}function Jo(a){let i=(a.expressionContext==="property"?Ph:Wl)(ns(a.value),a.valueSpec);if(i.result==="error")return i.value.map(u=>new pe(`${a.key}${u.key}`,a.value,u.message));let o=i.value.expression||i.value._styleExpression.expression;if(a.expressionContext==="property"&&a.propertyKey==="text-font"&&!o.outputDefined())return[new pe(a.key,a.value,`Invalid data expression for "${a.propertyKey}". Output values must be contained as literals within the expression.`)];if(a.expressionContext==="property"&&a.propertyType==="layout"&&!ja(o))return[new pe(a.key,a.value,'"feature-state" data expressions are not supported with layout properties.')];if(a.expressionContext==="filter"&&!ja(o))return[new pe(a.key,a.value,'"feature-state" data expressions are not supported with filters.')];if(a.expressionContext&&a.expressionContext.indexOf("cluster")===0){if(!Zl(o,["zoom","feature-state"]))return[new pe(a.key,a.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(a.expressionContext==="cluster-initial"&&!Ul(o))return[new pe(a.key,a.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ua(a){let i=a.key,o=a.value,u=a.valueSpec,f=[];return Array.isArray(u.values)?u.values.indexOf(fi(o))===-1&&f.push(new pe(i,o,`expected one of [${u.values.join(", ")}], ${JSON.stringify(o)} found`)):Object.keys(u.values).indexOf(fi(o))===-1&&f.push(new pe(i,o,`expected one of [${Object.keys(u.values).join(", ")}], ${JSON.stringify(o)} found`)),f}function Jl(a){return Rh(ns(a.value))?Jo(Xe({},a,{expressionContext:"filter",valueSpec:{value:"boolean"}})):jh(a)}function jh(a){let i=a.value,o=a.key;if(Nt(i)!=="array")return[new pe(o,i,`array expected, ${Nt(i)} found`)];let u=a.styleSpec,f,_=[];if(i.length<1)return[new pe(o,i,"filter array must have at least 1 element")];switch(_=_.concat(Ua({key:`${o}[0]`,value:i[0],valueSpec:u.filter_operator,style:a.style,styleSpec:a.styleSpec})),fi(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&fi(i[1])==="$type"&&_.push(new pe(o,i,`"$type" cannot be use with operator "${i[0]}"`));case"==":case"!=":i.length!==3&&_.push(new pe(o,i,`filter array for operator "${i[0]}" must have 3 elements`));case"in":case"!in":i.length>=2&&(f=Nt(i[1]),f!=="string"&&_.push(new pe(`${o}[1]`,i[1],`string expected, ${f} found`)));for(let y=2;y<i.length;y++)f=Nt(i[y]),fi(i[1])==="$type"?_=_.concat(Ua({key:`${o}[${y}]`,value:i[y],valueSpec:u.geometry_type,style:a.style,styleSpec:a.styleSpec})):f!=="string"&&f!=="number"&&f!=="boolean"&&_.push(new pe(`${o}[${y}]`,i[y],`string, number, or boolean expected, ${f} found`));break;case"any":case"all":case"none":for(let y=1;y<i.length;y++)_=_.concat(jh({key:`${o}[${y}]`,value:i[y],style:a.style,styleSpec:a.styleSpec}));break;case"has":case"!has":f=Nt(i[1]),i.length!==2?_.push(new pe(o,i,`filter array for "${i[0]}" operator must have 2 elements`)):f!=="string"&&_.push(new pe(`${o}[1]`,i[1],`string expected, ${f} found`))}return _}function Za(a,i){let o=a.key,u=a.validateSpec,f=a.style,_=a.styleSpec,y=a.value,w=a.objectKey,C=_[`${i}_${a.layerType}`];if(!C)return[];let I=w.match(/^(.*)-transition$/);if(i==="paint"&&I&&C[I[1]]&&C[I[1]].transition)return u({key:o,value:y,valueSpec:_.transition,style:f,styleSpec:_});let L=a.valueSpec||C[w];if(!L)return[new pe(o,y,`unknown property "${w}"`)];let k;if(Nt(y)==="string"&&Yo(L)&&!L.tokens&&(k=/^{([^}]+)}$/.exec(y)))return[new pe(o,y,`"${w}" does not support interpolation syntax
1
+ "use strict";(()=>{var j2=Object.create;var ug=Object.defineProperty;var N2=Object.getOwnPropertyDescriptor;var G2=Object.getOwnPropertyNames;var V2=Object.getPrototypeOf,U2=Object.prototype.hasOwnProperty;var Np=(h,t)=>()=>(t||h((t={exports:{}}).exports,t),t.exports),dg=(h,t)=>{for(var r in t)ug(h,r,{get:t[r],enumerable:!0})},Z2=(h,t,r,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of G2(t))!U2.call(h,c)&&c!==r&&ug(h,c,{get:()=>t[c],enumerable:!(l=N2(t,c))||l.enumerable});return h};var Us=(h,t,r)=>(r=h!=null?j2(V2(h)):{},Z2(t||!h||!h.__esModule?ug(r,"default",{value:h,enumerable:!0}):r,h));var Qb=Np((aD,Jb)=>{"use strict";Jb.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var Pl=Np((aj,Tw)=>{var FM="Expected a function",ww=NaN,zM="[object Symbol]",OM=/^\s+|\s+$/g,BM=/^[-+]0x[0-9a-f]+$/i,jM=/^0b[01]+$/i,NM=/^0o[0-7]+$/i,GM=parseInt,VM=typeof global=="object"&&global&&global.Object===Object&&global,UM=typeof self=="object"&&self&&self.Object===Object&&self,ZM=VM||UM||Function("return this")(),qM=Object.prototype,WM=qM.toString,$M=Math.max,XM=Math.min,h0=function(){return ZM.Date.now()};function HM(h,t,r){var l,c,n,x,b,S,R=0,E=!1,A=!1,z=!0;if(typeof h!="function")throw new TypeError(FM);t=Sw(t)||0,u0(r)&&(E=!!r.leading,A="maxWait"in r,n=A?$M(Sw(r.maxWait)||0,t):n,z="trailing"in r?!!r.trailing:z);function W(Re){var tt=l,Je=c;return l=c=void 0,R=Re,x=h.apply(Je,tt),x}function re(Re){return R=Re,b=setTimeout(be,t),E?W(Re):x}function me(Re){var tt=Re-S,Je=Re-R,He=t-tt;return A?XM(He,n-Je):He}function ge(Re){var tt=Re-S,Je=Re-R;return S===void 0||tt>=t||tt<0||A&&Je>=n}function be(){var Re=h0();if(ge(Re))return ve(Re);b=setTimeout(be,me(Re))}function ve(Re){return b=void 0,z&&l?W(Re):(l=c=void 0,x)}function De(){b!==void 0&&clearTimeout(b),R=0,l=S=c=b=void 0}function ke(){return b===void 0?x:ve(h0())}function je(){var Re=h0(),tt=ge(Re);if(l=arguments,c=this,S=Re,tt){if(b===void 0)return re(S);if(A)return b=setTimeout(be,t),W(S)}return b===void 0&&(b=setTimeout(be,t)),x}return je.cancel=De,je.flush=ke,je}function u0(h){var t=typeof h;return!!h&&(t=="object"||t=="function")}function YM(h){return!!h&&typeof h=="object"}function KM(h){return typeof h=="symbol"||YM(h)&&WM.call(h)==zM}function Sw(h){if(typeof h=="number")return h;if(KM(h))return ww;if(u0(h)){var t=typeof h.valueOf=="function"?h.valueOf():h;h=u0(t)?t+"":t}if(typeof h!="string")return h===0?h:+h;h=h.replace(OM,"");var r=jM.test(h);return r||NM.test(h)?GM(h.slice(2),r?2:8):BM.test(h)?ww:+h}Tw.exports=HM});var g0=Np((f0,m0)=>{(function(h,t){typeof f0=="object"&&typeof m0<"u"?m0.exports=t():typeof define=="function"&&define.amd?define(t):(h=typeof globalThis<"u"?globalThis:h||self,h.maplibregl=t())})(f0,function(){"use strict";var h={},t={};function r(c,n,x){if(t[c]=x,c==="index"){var b="var sharedModule = {}; ("+t.shared+")(sharedModule); ("+t.worker+")(sharedModule);",S={};return t.shared(S),t.index(h,S),typeof window<"u"&&h.setWorkerUrl(window.URL.createObjectURL(new Blob([b],{type:"text/javascript"}))),h}}r("shared",["exports"],function(c){"use strict";function n(a,i,o,u){return new(o||(o=Promise))(function(f,_){function y(I){try{C(u.next(I))}catch(L){_(L)}}function w(I){try{C(u.throw(I))}catch(L){_(L)}}function C(I){var L;I.done?f(I.value):(L=I.value,L instanceof o?L:new o(function(k){k(L)})).then(y,w)}C((u=u.apply(a,i||[])).next())})}function x(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var b,S;function R(){if(S)return b;function a(i,o){this.x=i,this.y=o}return S=1,b=a,a.prototype={clone:function(){return new a(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,o){return this.clone()._rotateAround(i,o)},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 o=i.x-this.x,u=i.y-this.y;return o*o+u*u},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,o){return Math.atan2(this.x*o-this.y*i,this.x*i+this.y*o)},_matMult:function(i){var o=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=o,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 o=Math.cos(i),u=Math.sin(i),f=u*this.x+o*this.y;return this.x=o*this.x-u*this.y,this.y=f,this},_rotateAround:function(i,o){var u=Math.cos(i),f=Math.sin(i),_=o.y+f*(this.x-o.x)+u*(this.y-o.y);return this.x=o.x+u*(this.x-o.x)-f*(this.y-o.y),this.y=_,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},a.convert=function(i){return i instanceof a?i:Array.isArray(i)?new a(i[0],i[1]):i},b}typeof SuppressedError=="function"&&SuppressedError;var E,A,z=x(R()),W=function(){if(A)return E;function a(i,o,u,f){this.cx=3*i,this.bx=3*(u-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(f-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=o,this.p2x=u,this.p2y=f}return A=1,E=a,a.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,o){if(o===void 0&&(o=1e-6),i<0)return 0;if(i>1)return 1;for(var u=i,f=0;f<8;f++){var _=this.sampleCurveX(u)-i;if(Math.abs(_)<o)return u;var y=this.sampleCurveDerivativeX(u);if(Math.abs(y)<1e-6)break;u-=_/y}var w=0,C=1;for(u=i,f=0;f<20&&(_=this.sampleCurveX(u),!(Math.abs(_-i)<o));f++)i>_?w=u:C=u,u=.5*(C-w)+w;return u},solve:function(i,o){return this.sampleCurveY(this.solveCurveX(i,o))}},E}(),re=x(W);let me,ge;function be(){return me==null&&(me=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),me}function ve(){if(ge==null&&(ge=!1,be())){let i=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(i){for(let u=0;u<5*5;u++){let f=4*u;i.fillStyle=`rgb(${f},${f+1},${f+2})`,i.fillRect(u%5,Math.floor(u/5),1,1)}let o=i.getImageData(0,0,5,5).data;for(let u=0;u<5*5*4;u++)if(u%4!=3&&o[u]!==u){ge=!0;break}}}return ge||!1}var De,ke=1e-6,je=typeof Float32Array<"u"?Float32Array:Array;function Re(){var a=new je(9);return je!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[5]=0,a[6]=0,a[7]=0),a[0]=1,a[4]=1,a[8]=1,a}function tt(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a}function Je(){var a=new je(3);return je!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0),a}function He(a,i,o){var u=new je(3);return u[0]=a,u[1]=i,u[2]=o,u}function ot(a,i,o){var u=i[0],f=i[1],_=i[2],y=i[3];return a[0]=o[0]*u+o[4]*f+o[8]*_+o[12]*y,a[1]=o[1]*u+o[5]*f+o[9]*_+o[13]*y,a[2]=o[2]*u+o[6]*f+o[10]*_+o[14]*y,a[3]=o[3]*u+o[7]*f+o[11]*_+o[15]*y,a}function vt(){var a=new je(4);return je!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0),a[3]=1,a}function ct(){var a=new je(2);return je!=Float32Array&&(a[0]=0,a[1]=0),a}function It(a,i){var o=new je(2);return o[0]=a,o[1]=i,o}Math.hypot||(Math.hypot=function(){for(var a=0,i=arguments.length;i--;)a+=arguments[i]*arguments[i];return Math.sqrt(a)}),Je(),De=new je(4),je!=Float32Array&&(De[0]=0,De[1]=0,De[2]=0,De[3]=0),Je(),He(1,0,0),He(0,1,0),vt(),vt(),Re(),ct();let ut=8192;function yt(a,i,o){return i*(ut/(a.tileSize*Math.pow(2,o-a.tileID.overscaledZ)))}function xt(a,i){return(a%i+i)%i}function dt(a,i,o){return a*(1-o)+i*o}function St(a){if(a<=0)return 0;if(a>=1)return 1;let i=a*a,o=i*a;return 4*(a<.5?o:3*(a-i)+o-.75)}function qt(a,i,o,u){let f=new re(a,i,o,u);return _=>f.solve(_)}let Ft=qt(.25,.1,.25,1);function Pt(a,i,o){return Math.min(o,Math.max(i,a))}function jt(a,i,o){let u=o-i,f=((a-i)%u+u)%u+i;return f===i?o:f}function $t(a,...i){for(let o of i)for(let u in o)a[u]=o[u];return a}let et=1;function Bi(a,i,o){let u={};for(let f in a)u[f]=i.call(this,a[f],f,a);return u}function Ai(a,i,o){let u={};for(let f in a)i.call(this,a[f],f,a)&&(u[f]=a[f]);return u}function Ci(a){return Array.isArray(a)?a.map(Ci):typeof a=="object"&&a?Bi(a,Ci):a}let en={};function _i(a){en[a]||(typeof console<"u"&&console.warn(a),en[a]=!0)}function ti(a,i,o){return(o.y-a.y)*(i.x-a.x)>(i.y-a.y)*(o.x-a.x)}function tn(a){return typeof WorkerGlobalScope<"u"&&a!==void 0&&a instanceof WorkerGlobalScope}let oi=null;function gn(a){return typeof ImageBitmap<"u"&&a instanceof ImageBitmap}let Ln="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Tr(a,i,o,u,f){return n(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let _=new VideoFrame(a,{timestamp:0});try{let y=_?.format;if(!y||!y.startsWith("BGR")&&!y.startsWith("RGB"))throw new Error(`Unrecognized format ${y}`);let w=y.startsWith("BGR"),C=new Uint8ClampedArray(u*f*4);if(yield _.copyTo(C,function(I,L,k,B,N){let G=4*Math.max(1,0),U=(Math.max(0,k)-k)*B*4+G,Y=4*B,te=Math.max(0,L),de=Math.max(0,k);return{rect:{x:te,y:de,width:Math.min(I.width,L+B)-te,height:Math.min(I.height,k+N)-de},layout:[{offset:U,stride:Y}]}}(a,i,o,u,f)),w)for(let I=0;I<C.length;I+=4){let L=C[I];C[I]=C[I+2],C[I+2]=L}return C}finally{_.close()}})}let $i,yi;function Li(a){return a/Math.PI*180}let rn="AbortError";function kn(){return new Error(rn)}let nn={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Dn(a){return nn.REGISTERED_PROTOCOLS[a.substring(0,a.indexOf("://"))]}let Qn="global-dispatcher";class Nr extends Error{constructor(i,o,u,f){super(`AJAXError: ${o} (${i}): ${u}`),this.status=i,this.statusText=o,this.url=u,this.body=f}}let sn=()=>tn(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,on=function(a,i){if(/:\/\//.test(a.url)&&!/^https?:|^file:/.test(a.url)){let u=Dn(a.url);if(u)return u(a,i);if(tn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:a,targetMapId:Qn},i)}if(!(/^file:/.test(o=a.url)||/^file:/.test(sn())&&!/^\w+:/.test(o))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(u,f){return n(this,void 0,void 0,function*(){let _=new Request(u.url,{method:u.method||"GET",body:u.body,credentials:u.credentials,headers:u.headers,cache:u.cache,referrer:sn(),signal:f.signal}),y,w;u.type!=="json"||_.headers.has("Accept")||_.headers.set("Accept","application/json");try{y=yield fetch(_)}catch(I){throw new Nr(0,I.message,u.url,new Blob)}if(!y.ok){let I=yield y.blob();throw new Nr(y.status,y.statusText,u.url,I)}w=u.type==="arrayBuffer"||u.type==="image"?y.arrayBuffer():u.type==="json"?y.json():y.text();let C=yield w;if(f.signal.aborted)throw kn();return{data:C,cacheControl:y.headers.get("Cache-Control"),expires:y.headers.get("Expires")}})}(a,i);if(tn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:a,mustQueue:!0,targetMapId:Qn},i)}var o;return function(u,f){return new Promise((_,y)=>{var w;let C=new XMLHttpRequest;C.open(u.method||"GET",u.url,!0),u.type!=="arrayBuffer"&&u.type!=="image"||(C.responseType="arraybuffer");for(let I in u.headers)C.setRequestHeader(I,u.headers[I]);u.type==="json"&&(C.responseType="text",!((w=u.headers)===null||w===void 0)&&w.Accept||C.setRequestHeader("Accept","application/json")),C.withCredentials=u.credentials==="include",C.onerror=()=>{y(new Error(C.statusText))},C.onload=()=>{if(!f.signal.aborted)if((C.status>=200&&C.status<300||C.status===0)&&C.response!==null){let I=C.response;if(u.type==="json")try{I=JSON.parse(C.response)}catch(L){return void y(L)}_({data:I,cacheControl:C.getResponseHeader("Cache-Control"),expires:C.getResponseHeader("Expires")})}else{let I=new Blob([C.response],{type:C.getResponseHeader("Content-Type")});y(new Nr(C.status,C.statusText,u.url,I))}},f.signal.addEventListener("abort",()=>{C.abort(),y(kn())}),C.send(u.body)})}(a,i)};function Fn(a){if(!a||a.indexOf("://")<=0||a.indexOf("data:image/")===0||a.indexOf("blob:")===0)return!0;let i=new URL(a),o=window.location;return i.protocol===o.protocol&&i.host===o.host}function an(a,i,o){o[a]&&o[a].indexOf(i)!==-1||(o[a]=o[a]||[],o[a].push(i))}function zn(a,i,o){if(o&&o[a]){let u=o[a].indexOf(i);u!==-1&&o[a].splice(u,1)}}class zs{constructor(i,o={}){$t(this,o),this.type=i}}class Os extends zs{constructor(i,o={}){super("error",$t({error:i},o))}}class On{on(i,o){return this._listeners=this._listeners||{},an(i,o,this._listeners),{unsubscribe:()=>{this.off(i,o)}}}off(i,o){return zn(i,o,this._listeners),zn(i,o,this._oneTimeListeners),this}once(i,o){return o?(this._oneTimeListeners=this._oneTimeListeners||{},an(i,o,this._oneTimeListeners),this):new Promise(u=>this.once(i,u))}fire(i,o){typeof i=="string"&&(i=new zs(i,o||{}));let u=i.type;if(this.listens(u)){i.target=this;let f=this._listeners&&this._listeners[u]?this._listeners[u].slice():[];for(let w of f)w.call(this,i);let _=this._oneTimeListeners&&this._oneTimeListeners[u]?this._oneTimeListeners[u].slice():[];for(let w of _)zn(u,w,this._oneTimeListeners),w.call(this,i);let y=this._eventedParent;y&&($t(i,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),y.fire(i))}else i instanceof Os&&console.error(i.error);return this}listens(i){return this._listeners&&this._listeners[i]&&this._listeners[i].length>0||this._oneTimeListeners&&this._oneTimeListeners[i]&&this._oneTimeListeners[i].length>0||this._eventedParent&&this._eventedParent.listens(i)}setEventedParent(i,o){return this._eventedParent=i,this._eventedParentData=o,this}}var K={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},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:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},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-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","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":{}}},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}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_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"}}};let Z=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function $(a,i){let o={};for(let u in a)u!=="ref"&&(o[u]=a[u]);return Z.forEach(u=>{u in i&&(o[u]=i[u])}),o}function X(a,i){if(Array.isArray(a)){if(!Array.isArray(i)||a.length!==i.length)return!1;for(let o=0;o<a.length;o++)if(!X(a[o],i[o]))return!1;return!0}if(typeof a=="object"&&a!==null&&i!==null){if(typeof i!="object"||Object.keys(a).length!==Object.keys(i).length)return!1;for(let o in a)if(!X(a[o],i[o]))return!1;return!0}return a===i}function ne(a,i){a.push(i)}function he(a,i,o){ne(o,{command:"addSource",args:[a,i[a]]})}function ye(a,i,o){ne(i,{command:"removeSource",args:[a]}),o[a]=!0}function Te(a,i,o,u){ye(a,o,u),he(a,i,o)}function _e(a,i,o){let u;for(u in a[o])if(Object.prototype.hasOwnProperty.call(a[o],u)&&u!=="data"&&!X(a[o][u],i[o][u]))return!1;for(u in i[o])if(Object.prototype.hasOwnProperty.call(i[o],u)&&u!=="data"&&!X(a[o][u],i[o][u]))return!1;return!0}function Ee(a,i,o,u,f,_){a=a||{},i=i||{};for(let y in a)Object.prototype.hasOwnProperty.call(a,y)&&(X(a[y],i[y])||o.push({command:_,args:[u,y,i[y],f]}));for(let y in i)Object.prototype.hasOwnProperty.call(i,y)&&!Object.prototype.hasOwnProperty.call(a,y)&&(X(a[y],i[y])||o.push({command:_,args:[u,y,i[y],f]}))}function Ie(a){return a.id}function xe(a,i){return a[i.id]=i,a}class pe{constructor(i,o,u,f){this.message=(i?`${i}: `:"")+u,f&&(this.identifier=f),o!=null&&o.__line__&&(this.line=o.__line__)}}function Xe(a,...i){for(let o of i)for(let u in o)a[u]=o[u];return a}class Ue extends Error{constructor(i,o){super(o),this.message=o,this.key=i}}class ht{constructor(i,o=[]){this.parent=i,this.bindings={};for(let[u,f]of o)this.bindings[u]=f}concat(i){return new ht(this,i)}get(i){if(this.bindings[i])return this.bindings[i];if(this.parent)return this.parent.get(i);throw new Error(`${i} not found in scope.`)}has(i){return!!this.bindings[i]||!!this.parent&&this.parent.has(i)}}let pt={kind:"null"},Pe={kind:"number"},We={kind:"string"},Qe={kind:"boolean"},wt={kind:"color"},mt={kind:"projectionDefinition"},nt={kind:"object"},Ke={kind:"value"},ai={kind:"collator"},Bs={kind:"formatted"},ji={kind:"padding"},ki={kind:"resolvedImage"},li={kind:"variableAnchorOffsetCollection"};function ln(a,i){return{kind:"array",itemType:a,N:i}}function ci(a){if(a.kind==="array"){let i=ci(a.itemType);return typeof a.N=="number"?`array<${i}, ${a.N}>`:a.itemType.kind==="value"?"array":`array<${i}>`}return a.kind}let Ia=[pt,Pe,We,Qe,wt,mt,Bs,nt,ln(Ke),ji,ki,li];function jo(a,i){if(i.kind==="error")return null;if(a.kind==="array"){if(i.kind==="array"&&(i.N===0&&i.itemType.kind==="value"||!jo(a.itemType,i.itemType))&&(typeof a.N!="number"||a.N===i.N))return null}else{if(a.kind===i.kind)return null;if(a.kind==="value"){for(let o of Ia)if(!jo(o,i))return null}}return`Expected ${ci(a)} but found ${ci(i)} instead.`}function Qc(a,i){return i.some(o=>o.kind===a.kind)}function to(a,i){return i.some(o=>o==="null"?a===null:o==="array"?Array.isArray(a):o==="object"?a&&!Array.isArray(a)&&typeof a=="object":o===typeof a)}function io(a,i){return a.kind==="array"&&i.kind==="array"?a.itemType.kind===i.itemType.kind&&typeof a.N=="number":a.kind===i.kind}let Id=.96422,eh=.82521,Ed=4/29,No=6/29,Pd=3*No*No,tm=No*No*No,im=Math.PI/180,rm=180/Math.PI;function Rd(a){return(a%=360)<0&&(a+=360),a}function th([a,i,o,u]){let f,_,y=ih((.2225045*(a=ro(a))+.7168786*(i=ro(i))+.0606169*(o=ro(o)))/1);a===i&&i===o?f=_=y:(f=ih((.4360747*a+.3850649*i+.1430804*o)/Id),_=ih((.0139322*a+.0971045*i+.7141733*o)/eh));let w=116*y-16;return[w<0?0:w,500*(f-y),200*(y-_),u]}function ro(a){return a<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)}function ih(a){return a>tm?Math.pow(a,1/3):a/Pd+Ed}function Ad([a,i,o,u]){let f=(a+16)/116,_=isNaN(i)?f:f+i/500,y=isNaN(o)?f:f-o/200;return f=1*rh(f),_=Id*rh(_),y=eh*rh(y),[no(3.1338561*_-1.6168667*f-.4906146*y),no(-.9787684*_+1.9161415*f+.033454*y),no(.0719453*_-.2289914*f+1.4052427*y),u]}function no(a){return(a=a<=.00304?12.92*a:1.055*Math.pow(a,1/2.4)-.055)<0?0:a>1?1:a}function rh(a){return a>No?a*a*a:Pd*(a-Ed)}function Ll(a){return parseInt(a.padEnd(2,a),16)/255}function Ld(a,i){return so(i?a/100:a,0,1)}function so(a,i,o){return Math.min(Math.max(i,a),o)}function nh(a){return!a.some(Number.isNaN)}let es={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function At(a,i,o){return a+o*(i-a)}function ts(a,i,o){return a.map((u,f)=>At(u,i[f],o))}class Lt{constructor(i,o,u,f=1,_=!0){this.r=i,this.g=o,this.b=u,this.a=f,_||(this.r*=f,this.g*=f,this.b*=f,f||this.overwriteGetter("rgb",[i,o,u,f]))}static parse(i){if(i instanceof Lt)return i;if(typeof i!="string")return;let o=function(u){if((u=u.toLowerCase().trim())==="transparent")return[0,0,0,0];let f=es[u];if(f){let[y,w,C]=f;return[y/255,w/255,C/255,1]}if(u.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(u)){let y=u.length<6?1:2,w=1;return[Ll(u.slice(w,w+=y)),Ll(u.slice(w,w+=y)),Ll(u.slice(w,w+=y)),Ll(u.slice(w,w+y)||"ff")]}if(u.startsWith("rgb")){let y=u.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(y){let[w,C,I,L,k,B,N,G,U,Y,te,de]=y,se=[L||" ",N||" ",Y].join("");if(se===" "||se===" /"||se===",,"||se===",,,"){let j=[I,B,U].join(""),H=j==="%%%"?100:j===""?255:0;if(H){let oe=[so(+C/H,0,1),so(+k/H,0,1),so(+G/H,0,1),te?Ld(+te,de):1];if(nh(oe))return oe}}return}}let _=u.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(_){let[y,w,C,I,L,k,B,N,G]=_,U=[C||" ",L||" ",B].join("");if(U===" "||U===" /"||U===",,"||U===",,,"){let Y=[+w,so(+I,0,100),so(+k,0,100),N?Ld(+N,G):1];if(nh(Y))return function([te,de,se,j]){function H(oe){let Se=(oe+te/30)%12,Ge=de*Math.min(se,1-se);return se-Ge*Math.max(-1,Math.min(Se-3,9-Se,1))}return te=Rd(te),de/=100,se/=100,[H(0),H(8),H(4),j]}(Y)}}}(i);return o?new Lt(...o,!1):void 0}get rgb(){let{r:i,g:o,b:u,a:f}=this,_=f||1/0;return this.overwriteGetter("rgb",[i/_,o/_,u/_,f])}get hcl(){return this.overwriteGetter("hcl",function(i){let[o,u,f,_]=th(i),y=Math.sqrt(u*u+f*f);return[Math.round(1e4*y)?Rd(Math.atan2(f,u)*rm):NaN,y,o,_]}(this.rgb))}get lab(){return this.overwriteGetter("lab",th(this.rgb))}overwriteGetter(i,o){return Object.defineProperty(this,i,{value:o}),o}toString(){let[i,o,u,f]=this.rgb;return`rgba(${[i,o,u].map(_=>Math.round(255*_)).join(",")},${f})`}static interpolate(i,o,u,f="rgb"){switch(f){case"rgb":{let[_,y,w,C]=ts(i.rgb,o.rgb,u);return new Lt(_,y,w,C,!1)}case"hcl":{let[_,y,w,C]=i.hcl,[I,L,k,B]=o.hcl,N,G;if(isNaN(_)||isNaN(I))isNaN(_)?isNaN(I)?N=NaN:(N=I,w!==1&&w!==0||(G=L)):(N=_,k!==1&&k!==0||(G=y));else{let se=I-_;I>_&&se>180?se-=360:I<_&&_-I>180&&(se+=360),N=_+u*se}let[U,Y,te,de]=function([se,j,H,oe]){return se=isNaN(se)?0:se*im,Ad([H,Math.cos(se)*j,Math.sin(se)*j,oe])}([N,G??At(y,L,u),At(w,k,u),At(C,B,u)]);return new Lt(U,Y,te,de,!1)}case"lab":{let[_,y,w,C]=Ad(ts(i.lab,o.lab,u));return new Lt(_,y,w,C,!1)}}}}Lt.black=new Lt(0,0,0,1),Lt.white=new Lt(1,1,1,1),Lt.transparent=new Lt(0,0,0,0),Lt.red=new Lt(1,0,0,1);class kl{constructor(i,o,u){this.sensitivity=i?o?"variant":"case":o?"accent":"base",this.locale=u,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(i,o){return this.collator.compare(i,o)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Dl{constructor(i,o,u,f,_){this.text=i,this.image=o,this.scale=u,this.fontStack=f,this.textColor=_}}class Cr{constructor(i){this.sections=i}static fromString(i){return new Cr([new Dl(i,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(i=>i.text.length!==0||i.image&&i.image.name.length!==0)}static factory(i){return i instanceof Cr?i:Cr.fromString(i)}toString(){return this.sections.length===0?"":this.sections.map(i=>i.text).join("")}}class pi{constructor(i){this.values=i.slice()}static parse(i){if(i instanceof pi)return i;if(typeof i=="number")return new pi([i,i,i,i]);if(Array.isArray(i)&&!(i.length<1||i.length>4)){for(let o of i)if(typeof o!="number")return;switch(i.length){case 1:i=[i[0],i[0],i[0],i[0]];break;case 2:i=[i[0],i[1],i[0],i[1]];break;case 3:i=[i[0],i[1],i[2],i[1]]}return new pi(i)}}toString(){return JSON.stringify(this.values)}static interpolate(i,o,u){return new pi(ts(i.values,o.values,u))}}class hi{constructor(i){this.name="ExpressionEvaluationError",this.message=i}toJSON(){return this.message}}let Fl=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class ur{constructor(i){this.values=i.slice()}static parse(i){if(i instanceof ur)return i;if(Array.isArray(i)&&!(i.length<1)&&i.length%2==0){for(let o=0;o<i.length;o+=2){let u=i[o],f=i[o+1];if(typeof u!="string"||!Fl.has(u)||!Array.isArray(f)||f.length!==2||typeof f[0]!="number"||typeof f[1]!="number")return}return new ur(i)}}toString(){return JSON.stringify(this.values)}static interpolate(i,o,u){let f=i.values,_=o.values;if(f.length!==_.length)throw new hi(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${o.toString()}`);let y=[];for(let w=0;w<f.length;w+=2){if(f[w]!==_[w])throw new hi(`Cannot interpolate values containing mismatched anchors. from[${w}]: ${f[w]}, to[${w}]: ${_[w]}`);y.push(f[w]);let[C,I]=f[w+1],[L,k]=_[w+1];y.push([At(C,L,u),At(I,k,u)])}return new ur(y)}}class Gr{constructor(i){this.name=i.name,this.available=i.available}toString(){return this.name}static fromString(i){return i?new Gr({name:i,available:!1}):null}}class tr{constructor(i,o,u){this.from=i,this.to=o,this.transition=u}static interpolate(i,o,u){return new tr(i,o,u)}static parse(i){return i instanceof tr?i:Array.isArray(i)&&i.length===3&&typeof i[0]=="string"&&typeof i[1]=="string"&&typeof i[2]=="number"?new tr(i[0],i[1],i[2]):typeof i=="object"&&typeof i.from=="string"&&typeof i.to=="string"&&typeof i.transition=="number"?new tr(i.from,i.to,i.transition):typeof i=="string"?new tr(i,i,1):void 0}}function Ea(a,i,o,u){return typeof a=="number"&&a>=0&&a<=255&&typeof i=="number"&&i>=0&&i<=255&&typeof o=="number"&&o>=0&&o<=255?u===void 0||typeof u=="number"&&u>=0&&u<=1?null:`Invalid rgba value [${[a,i,o,u].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof u=="number"?[a,i,o,u]:[a,i,o]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Go(a){if(a===null||typeof a=="string"||typeof a=="boolean"||typeof a=="number"||a instanceof tr||a instanceof Lt||a instanceof kl||a instanceof Cr||a instanceof pi||a instanceof ur||a instanceof Gr)return!0;if(Array.isArray(a)){for(let i of a)if(!Go(i))return!1;return!0}if(typeof a=="object"){for(let i in a)if(!Go(a[i]))return!1;return!0}return!1}function wi(a){if(a===null)return pt;if(typeof a=="string")return We;if(typeof a=="boolean")return Qe;if(typeof a=="number")return Pe;if(a instanceof Lt)return wt;if(a instanceof tr)return mt;if(a instanceof kl)return ai;if(a instanceof Cr)return Bs;if(a instanceof pi)return ji;if(a instanceof ur)return li;if(a instanceof Gr)return ki;if(Array.isArray(a)){let i=a.length,o;for(let u of a){let f=wi(u);if(o){if(o===f)continue;o=Ke;break}o=f}return ln(o||Ke,i)}return nt}function Bn(a){let i=typeof a;return a===null?"":i==="string"||i==="number"||i==="boolean"?String(a):a instanceof Lt||a instanceof tr||a instanceof Cr||a instanceof pi||a instanceof ur||a instanceof Gr?a.toString():JSON.stringify(a)}class oo{constructor(i,o){this.type=i,this.value=o}static parse(i,o){if(i.length!==2)return o.error(`'literal' expression requires exactly one argument, but found ${i.length-1} instead.`);if(!Go(i[1]))return o.error("invalid value");let u=i[1],f=wi(u),_=o.expectedType;return f.kind!=="array"||f.N!==0||!_||_.kind!=="array"||typeof _.N=="number"&&_.N!==0||(f=_),new oo(f,u)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}let ao={string:We,number:Pe,boolean:Qe,object:nt};class dr{constructor(i,o){this.type=i,this.args=o}static parse(i,o){if(i.length<2)return o.error("Expected at least one argument.");let u,f=1,_=i[0];if(_==="array"){let w,C;if(i.length>2){let I=i[1];if(typeof I!="string"||!(I in ao)||I==="object")return o.error('The item type argument of "array" must be one of string, number, boolean',1);w=ao[I],f++}else w=Ke;if(i.length>3){if(i[2]!==null&&(typeof i[2]!="number"||i[2]<0||i[2]!==Math.floor(i[2])))return o.error('The length argument to "array" must be a positive integer literal',2);C=i[2],f++}u=ln(w,C)}else{if(!ao[_])throw new Error(`Types doesn't contain name = ${_}`);u=ao[_]}let y=[];for(;f<i.length;f++){let w=o.parse(i[f],f,Ke);if(!w)return null;y.push(w)}return new dr(u,y)}evaluate(i){for(let o=0;o<this.args.length;o++){let u=this.args[o].evaluate(i);if(!jo(this.type,wi(u)))return u;if(o===this.args.length-1)throw new hi(`Expected value to be of type ${ci(this.type)}, but found ${ci(wi(u))} instead.`)}throw new Error}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}}let sh={"to-boolean":Qe,"to-color":wt,"to-number":Pe,"to-string":We};class _s{constructor(i,o){this.type=i,this.args=o}static parse(i,o){if(i.length<2)return o.error("Expected at least one argument.");let u=i[0];if(!sh[u])throw new Error(`Can't parse ${u} as it is not part of the known types`);if((u==="to-boolean"||u==="to-string")&&i.length!==2)return o.error("Expected one argument.");let f=sh[u],_=[];for(let y=1;y<i.length;y++){let w=o.parse(i[y],y,Ke);if(!w)return null;_.push(w)}return new _s(f,_)}evaluate(i){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(i);case"color":{let o,u;for(let f of this.args){if(o=f.evaluate(i),u=null,o instanceof Lt)return o;if(typeof o=="string"){let _=i.parseColor(o);if(_)return _}else if(Array.isArray(o)&&(u=o.length<3||o.length>4?`Invalid rgba value ${JSON.stringify(o)}: expected an array containing either three or four numeric values.`:Ea(o[0],o[1],o[2],o[3]),!u))return new Lt(o[0]/255,o[1]/255,o[2]/255,o[3])}throw new hi(u||`Could not parse color from value '${typeof o=="string"?o:JSON.stringify(o)}'`)}case"padding":{let o;for(let u of this.args){o=u.evaluate(i);let f=pi.parse(o);if(f)return f}throw new hi(`Could not parse padding from value '${typeof o=="string"?o:JSON.stringify(o)}'`)}case"variableAnchorOffsetCollection":{let o;for(let u of this.args){o=u.evaluate(i);let f=ur.parse(o);if(f)return f}throw new hi(`Could not parse variableAnchorOffsetCollection from value '${typeof o=="string"?o:JSON.stringify(o)}'`)}case"number":{let o=null;for(let u of this.args){if(o=u.evaluate(i),o===null)return 0;let f=Number(o);if(!isNaN(f))return f}throw new hi(`Could not convert ${JSON.stringify(o)} to number.`)}case"formatted":return Cr.fromString(Bn(this.args[0].evaluate(i)));case"resolvedImage":return Gr.fromString(Bn(this.args[0].evaluate(i)));case"projectionDefinition":return this.args[0].evaluate(i);default:return Bn(this.args[0].evaluate(i))}}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}}let kd=["Unknown","Point","LineString","Polygon"];class Pa{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"?kd[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(i){let o=this._parseColorCache[i];return o||(o=this._parseColorCache[i]=Lt.parse(i)),o}}class Jt{constructor(i,o,u=[],f,_=new ht,y=[]){this.registry=i,this.path=u,this.key=u.map(w=>`[${w}]`).join(""),this.scope=_,this.errors=y,this.expectedType=f,this._isConstant=o}parse(i,o,u,f,_={}){return o?this.concat(o,u,f)._parse(i,_):this._parse(i,_)}_parse(i,o){function u(f,_,y){return y==="assert"?new dr(_,[f]):y==="coerce"?new _s(_,[f]):f}if(i!==null&&typeof i!="string"&&typeof i!="boolean"&&typeof i!="number"||(i=["literal",i]),Array.isArray(i)){if(i.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let f=i[0];if(typeof f!="string")return this.error(`Expression name must be a string, but found ${typeof f} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let _=this.registry[f];if(_){let y=_.parse(i,this);if(!y)return null;if(this.expectedType){let w=this.expectedType,C=y.type;if(w.kind!=="string"&&w.kind!=="number"&&w.kind!=="boolean"&&w.kind!=="object"&&w.kind!=="array"||C.kind!=="value")if(w.kind!=="projectionDefinition"||C.kind!=="string"&&C.kind!=="array")if(w.kind!=="color"&&w.kind!=="formatted"&&w.kind!=="resolvedImage"||C.kind!=="value"&&C.kind!=="string")if(w.kind!=="padding"||C.kind!=="value"&&C.kind!=="number"&&C.kind!=="array")if(w.kind!=="variableAnchorOffsetCollection"||C.kind!=="value"&&C.kind!=="array"){if(this.checkSubtype(w,C))return null}else y=u(y,w,o.typeAnnotation||"coerce");else y=u(y,w,o.typeAnnotation||"coerce");else y=u(y,w,o.typeAnnotation||"coerce");else y=u(y,w,o.typeAnnotation||"coerce");else y=u(y,w,o.typeAnnotation||"assert")}if(!(y instanceof oo)&&y.type.kind!=="resolvedImage"&&this._isConstant(y)){let w=new Pa;try{y=new oo(y.type,y.evaluate(w))}catch(C){return this.error(C.message),null}}return y}return this.error(`Unknown expression "${f}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(i===void 0?"'undefined' value invalid. Use null instead.":typeof i=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof i} instead.`)}concat(i,o,u){let f=typeof i=="number"?this.path.concat(i):this.path,_=u?this.scope.concat(u):this.scope;return new Jt(this.registry,this._isConstant,f,o||null,_,this.errors)}error(i,...o){let u=`${this.key}${o.map(f=>`[${f}]`).join("")}`;this.errors.push(new Ue(u,i))}checkSubtype(i,o){let u=jo(i,o);return u&&this.error(u),u}}class Vo{constructor(i,o){this.type=o.type,this.bindings=[].concat(i),this.result=o}evaluate(i){return this.result.evaluate(i)}eachChild(i){for(let o of this.bindings)i(o[1]);i(this.result)}static parse(i,o){if(i.length<4)return o.error(`Expected at least 3 arguments, but found ${i.length-1} instead.`);let u=[];for(let _=1;_<i.length-1;_+=2){let y=i[_];if(typeof y!="string")return o.error(`Expected string, but found ${typeof y} instead.`,_);if(/[^a-zA-Z0-9_]/.test(y))return o.error("Variable names must contain only alphanumeric characters or '_'.",_);let w=o.parse(i[_+1],_+1);if(!w)return null;u.push([y,w])}let f=o.parse(i[i.length-1],i.length-1,o.expectedType,u);return f?new Vo(u,f):null}outputDefined(){return this.result.outputDefined()}}class Ot{constructor(i,o){this.type=o.type,this.name=i,this.boundExpression=o}static parse(i,o){if(i.length!==2||typeof i[1]!="string")return o.error("'var' expression requires exactly one string literal argument.");let u=i[1];return o.scope.has(u)?new Ot(u,o.scope.get(u)):o.error(`Unknown variable "${u}". Make sure "${u}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(i){return this.boundExpression.evaluate(i)}eachChild(){}outputDefined(){return!1}}class Rt{constructor(i,o,u){this.type=i,this.index=o,this.input=u}static parse(i,o){if(i.length!==3)return o.error(`Expected 2 arguments, but found ${i.length-1} instead.`);let u=o.parse(i[1],1,Pe),f=o.parse(i[2],2,ln(o.expectedType||Ke));return u&&f?new Rt(f.type.itemType,u,f):null}evaluate(i){let o=this.index.evaluate(i),u=this.input.evaluate(i);if(o<0)throw new hi(`Array index out of bounds: ${o} < 0.`);if(o>=u.length)throw new hi(`Array index out of bounds: ${o} > ${u.length-1}.`);if(o!==Math.floor(o))throw new hi(`Array index must be an integer, but found ${o} instead.`);return u[o]}eachChild(i){i(this.index),i(this.input)}outputDefined(){return!1}}class Ra{constructor(i,o){this.type=Qe,this.needle=i,this.haystack=o}static parse(i,o){if(i.length!==3)return o.error(`Expected 2 arguments, but found ${i.length-1} instead.`);let u=o.parse(i[1],1,Ke),f=o.parse(i[2],2,Ke);return u&&f?Qc(u.type,[Qe,We,Pe,pt,Ke])?new Ra(u,f):o.error(`Expected first argument to be of type boolean, string, number or null, but found ${ci(u.type)} instead`):null}evaluate(i){let o=this.needle.evaluate(i),u=this.haystack.evaluate(i);if(!u)return!1;if(!to(o,["boolean","string","number","null"]))throw new hi(`Expected first argument to be of type boolean, string, number or null, but found ${ci(wi(o))} instead.`);if(!to(u,["string","array"]))throw new hi(`Expected second argument to be of type array or string, but found ${ci(wi(u))} instead.`);return u.indexOf(o)>=0}eachChild(i){i(this.needle),i(this.haystack)}outputDefined(){return!0}}class Bt{constructor(i,o,u){this.type=Pe,this.needle=i,this.haystack=o,this.fromIndex=u}static parse(i,o){if(i.length<=2||i.length>=5)return o.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);let u=o.parse(i[1],1,Ke),f=o.parse(i[2],2,Ke);if(!u||!f)return null;if(!Qc(u.type,[Qe,We,Pe,pt,Ke]))return o.error(`Expected first argument to be of type boolean, string, number or null, but found ${ci(u.type)} instead`);if(i.length===4){let _=o.parse(i[3],3,Pe);return _?new Bt(u,f,_):null}return new Bt(u,f)}evaluate(i){let o=this.needle.evaluate(i),u=this.haystack.evaluate(i);if(!to(o,["boolean","string","number","null"]))throw new hi(`Expected first argument to be of type boolean, string, number or null, but found ${ci(wi(o))} instead.`);let f;if(this.fromIndex&&(f=this.fromIndex.evaluate(i)),to(u,["string"])){let _=u.indexOf(o,f);return _===-1?-1:[...u.slice(0,_)].length}if(to(u,["array"]))return u.indexOf(o,f);throw new hi(`Expected second argument to be of type array or string, but found ${ci(wi(u))} instead.`)}eachChild(i){i(this.needle),i(this.haystack),this.fromIndex&&i(this.fromIndex)}outputDefined(){return!1}}class Aa{constructor(i,o,u,f,_,y){this.inputType=i,this.type=o,this.input=u,this.cases=f,this.outputs=_,this.otherwise=y}static parse(i,o){if(i.length<5)return o.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if(i.length%2!=1)return o.error("Expected an even number of arguments.");let u,f;o.expectedType&&o.expectedType.kind!=="value"&&(f=o.expectedType);let _={},y=[];for(let I=2;I<i.length-1;I+=2){let L=i[I],k=i[I+1];Array.isArray(L)||(L=[L]);let B=o.concat(I);if(L.length===0)return B.error("Expected at least one branch label.");for(let G of L){if(typeof G!="number"&&typeof G!="string")return B.error("Branch labels must be numbers or strings.");if(typeof G=="number"&&Math.abs(G)>Number.MAX_SAFE_INTEGER)return B.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof G=="number"&&Math.floor(G)!==G)return B.error("Numeric branch labels must be integer values.");if(u){if(B.checkSubtype(u,wi(G)))return null}else u=wi(G);if(_[String(G)]!==void 0)return B.error("Branch labels must be unique.");_[String(G)]=y.length}let N=o.parse(k,I,f);if(!N)return null;f=f||N.type,y.push(N)}let w=o.parse(i[1],1,Ke);if(!w)return null;let C=o.parse(i[i.length-1],i.length-1,f);return C?w.type.kind!=="value"&&o.concat(1).checkSubtype(u,w.type)?null:new Aa(u,f,w,_,y,C):null}evaluate(i){let o=this.input.evaluate(i);return(wi(o)===this.inputType&&this.outputs[this.cases[o]]||this.otherwise).evaluate(i)}eachChild(i){i(this.input),this.outputs.forEach(i),i(this.otherwise)}outputDefined(){return this.outputs.every(i=>i.outputDefined())&&this.otherwise.outputDefined()}}class jn{constructor(i,o,u){this.type=i,this.branches=o,this.otherwise=u}static parse(i,o){if(i.length<4)return o.error(`Expected at least 3 arguments, but found only ${i.length-1}.`);if(i.length%2!=0)return o.error("Expected an odd number of arguments.");let u;o.expectedType&&o.expectedType.kind!=="value"&&(u=o.expectedType);let f=[];for(let y=1;y<i.length-1;y+=2){let w=o.parse(i[y],y,Qe);if(!w)return null;let C=o.parse(i[y+1],y+1,u);if(!C)return null;f.push([w,C]),u=u||C.type}let _=o.parse(i[i.length-1],i.length-1,u);if(!_)return null;if(!u)throw new Error("Can't infer output type");return new jn(u,f,_)}evaluate(i){for(let[o,u]of this.branches)if(o.evaluate(i))return u.evaluate(i);return this.otherwise.evaluate(i)}eachChild(i){for(let[o,u]of this.branches)i(o),i(u);i(this.otherwise)}outputDefined(){return this.branches.every(([i,o])=>o.outputDefined())&&this.otherwise.outputDefined()}}class Uo{constructor(i,o,u,f){this.type=i,this.input=o,this.beginIndex=u,this.endIndex=f}static parse(i,o){if(i.length<=2||i.length>=5)return o.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);let u=o.parse(i[1],1,Ke),f=o.parse(i[2],2,Pe);if(!u||!f)return null;if(!Qc(u.type,[ln(Ke),We,Ke]))return o.error(`Expected first argument to be of type array or string, but found ${ci(u.type)} instead`);if(i.length===4){let _=o.parse(i[3],3,Pe);return _?new Uo(u.type,u,f,_):null}return new Uo(u.type,u,f)}evaluate(i){let o=this.input.evaluate(i),u=this.beginIndex.evaluate(i),f;if(this.endIndex&&(f=this.endIndex.evaluate(i)),to(o,["string"]))return[...o].slice(u,f).join("");if(to(o,["array"]))return o.slice(u,f);throw new hi(`Expected first argument to be of type array or string, but found ${ci(wi(o))} instead.`)}eachChild(i){i(this.input),i(this.beginIndex),this.endIndex&&i(this.endIndex)}outputDefined(){return!1}}function La(a,i){let o=a.length-1,u,f,_=0,y=o,w=0;for(;_<=y;)if(w=Math.floor((_+y)/2),u=a[w],f=a[w+1],u<=i){if(w===o||i<f)return w;_=w+1}else{if(!(u>i))throw new hi("Input is not a number.");y=w-1}return 0}class Zo{constructor(i,o,u){this.type=i,this.input=o,this.labels=[],this.outputs=[];for(let[f,_]of u)this.labels.push(f),this.outputs.push(_)}static parse(i,o){if(i.length-1<4)return o.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return o.error("Expected an even number of arguments.");let u=o.parse(i[1],1,Pe);if(!u)return null;let f=[],_=null;o.expectedType&&o.expectedType.kind!=="value"&&(_=o.expectedType);for(let y=1;y<i.length;y+=2){let w=y===1?-1/0:i[y],C=i[y+1],I=y,L=y+1;if(typeof w!="number")return o.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',I);if(f.length&&f[f.length-1][0]>=w)return o.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',I);let k=o.parse(C,L,_);if(!k)return null;_=_||k.type,f.push([w,k])}return new Zo(_,u,f)}evaluate(i){let o=this.labels,u=this.outputs;if(o.length===1)return u[0].evaluate(i);let f=this.input.evaluate(i);if(f<=o[0])return u[0].evaluate(i);let _=o.length;return f>=o[_-1]?u[_-1].evaluate(i):u[La(o,f)].evaluate(i)}eachChild(i){i(this.input);for(let o of this.outputs)i(o)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}}function oh(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var zl,Dd,Fd=function(){if(Dd)return zl;function a(i,o,u,f){this.cx=3*i,this.bx=3*(u-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(f-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=o,this.p2x=u,this.p2y=f}return Dd=1,zl=a,a.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,o){if(o===void 0&&(o=1e-6),i<0)return 0;if(i>1)return 1;for(var u=i,f=0;f<8;f++){var _=this.sampleCurveX(u)-i;if(Math.abs(_)<o)return u;var y=this.sampleCurveDerivativeX(u);if(Math.abs(y)<1e-6)break;u-=_/y}var w=0,C=1;for(u=i,f=0;f<20&&(_=this.sampleCurveX(u),!(Math.abs(_-i)<o));f++)i>_?w=u:C=u,u=.5*(C-w)+w;return u},solve:function(i,o){return this.sampleCurveY(this.solveCurveX(i,o))}},zl}(),zd=oh(Fd);class ir{constructor(i,o,u,f,_){this.type=i,this.operator=o,this.interpolation=u,this.input=f,this.labels=[],this.outputs=[];for(let[y,w]of _)this.labels.push(y),this.outputs.push(w)}static interpolationFactor(i,o,u,f){let _=0;if(i.name==="exponential")_=Xi(o,i.base,u,f);else if(i.name==="linear")_=Xi(o,1,u,f);else if(i.name==="cubic-bezier"){let y=i.controlPoints;_=new zd(y[0],y[1],y[2],y[3]).solve(Xi(o,1,u,f))}return _}static parse(i,o){let[u,f,_,...y]=i;if(!Array.isArray(f)||f.length===0)return o.error("Expected an interpolation type expression.",1);if(f[0]==="linear")f={name:"linear"};else if(f[0]==="exponential"){let I=f[1];if(typeof I!="number")return o.error("Exponential interpolation requires a numeric base.",1,1);f={name:"exponential",base:I}}else{if(f[0]!=="cubic-bezier")return o.error(`Unknown interpolation type ${String(f[0])}`,1,0);{let I=f.slice(1);if(I.length!==4||I.some(L=>typeof L!="number"||L<0||L>1))return o.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);f={name:"cubic-bezier",controlPoints:I}}}if(i.length-1<4)return o.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return o.error("Expected an even number of arguments.");if(_=o.parse(_,2,Pe),!_)return null;let w=[],C=null;u==="interpolate-hcl"||u==="interpolate-lab"?C=wt:o.expectedType&&o.expectedType.kind!=="value"&&(C=o.expectedType);for(let I=0;I<y.length;I+=2){let L=y[I],k=y[I+1],B=I+3,N=I+4;if(typeof L!="number")return o.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',B);if(w.length&&w[w.length-1][0]>=L)return o.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',B);let G=o.parse(k,N,C);if(!G)return null;C=C||G.type,w.push([L,G])}return io(C,Pe)||io(C,mt)||io(C,wt)||io(C,ji)||io(C,li)||io(C,ln(Pe))?new ir(C,u,f,_,w):o.error(`Type ${ci(C)} is not interpolatable.`)}evaluate(i){let o=this.labels,u=this.outputs;if(o.length===1)return u[0].evaluate(i);let f=this.input.evaluate(i);if(f<=o[0])return u[0].evaluate(i);let _=o.length;if(f>=o[_-1])return u[_-1].evaluate(i);let y=La(o,f),w=ir.interpolationFactor(this.interpolation,f,o[y],o[y+1]),C=u[y].evaluate(i),I=u[y+1].evaluate(i);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return At(C,I,w);case"color":return Lt.interpolate(C,I,w);case"padding":return pi.interpolate(C,I,w);case"variableAnchorOffsetCollection":return ur.interpolate(C,I,w);case"array":return ts(C,I,w);case"projectionDefinition":return tr.interpolate(C,I,w)}case"interpolate-hcl":return Lt.interpolate(C,I,w,"hcl");case"interpolate-lab":return Lt.interpolate(C,I,w,"lab")}}eachChild(i){i(this.input);for(let o of this.outputs)i(o)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}}function Xi(a,i,o,u){let f=u-o,_=a-o;return f===0?0:i===1?_/f:(Math.pow(i,_)-1)/(Math.pow(i,f)-1)}let cn={color:Lt.interpolate,number:At,padding:pi.interpolate,variableAnchorOffsetCollection:ur.interpolate,array:ts};class ka{constructor(i,o){this.type=i,this.args=o}static parse(i,o){if(i.length<2)return o.error("Expected at least one argument.");let u=null,f=o.expectedType;f&&f.kind!=="value"&&(u=f);let _=[];for(let w of i.slice(1)){let C=o.parse(w,1+_.length,u,void 0,{typeAnnotation:"omit"});if(!C)return null;u=u||C.type,_.push(C)}if(!u)throw new Error("No output type");let y=f&&_.some(w=>jo(f,w.type));return new ka(y?Ke:u,_)}evaluate(i){let o,u=null,f=0;for(let _ of this.args)if(f++,u=_.evaluate(i),u&&u instanceof Gr&&!u.available&&(o||(o=u.name),u=null,f===this.args.length&&(u=o)),u!==null)break;return u}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}}function Da(a,i){return a==="=="||a==="!="?i.kind==="boolean"||i.kind==="string"||i.kind==="number"||i.kind==="null"||i.kind==="value":i.kind==="string"||i.kind==="number"||i.kind==="value"}function Ni(a,i,o,u){return u.compare(i,o)===0}function lo(a,i,o){let u=a!=="=="&&a!=="!=";return class Ew{constructor(_,y,w){this.type=Qe,this.lhs=_,this.rhs=y,this.collator=w,this.hasUntypedArgument=_.type.kind==="value"||y.type.kind==="value"}static parse(_,y){if(_.length!==3&&_.length!==4)return y.error("Expected two or three arguments.");let w=_[0],C=y.parse(_[1],1,Ke);if(!C)return null;if(!Da(w,C.type))return y.concat(1).error(`"${w}" comparisons are not supported for type '${ci(C.type)}'.`);let I=y.parse(_[2],2,Ke);if(!I)return null;if(!Da(w,I.type))return y.concat(2).error(`"${w}" comparisons are not supported for type '${ci(I.type)}'.`);if(C.type.kind!==I.type.kind&&C.type.kind!=="value"&&I.type.kind!=="value")return y.error(`Cannot compare types '${ci(C.type)}' and '${ci(I.type)}'.`);u&&(C.type.kind==="value"&&I.type.kind!=="value"?C=new dr(I.type,[C]):C.type.kind!=="value"&&I.type.kind==="value"&&(I=new dr(C.type,[I])));let L=null;if(_.length===4){if(C.type.kind!=="string"&&I.type.kind!=="string"&&C.type.kind!=="value"&&I.type.kind!=="value")return y.error("Cannot use collator to compare non-string types.");if(L=y.parse(_[3],3,ai),!L)return null}return new Ew(C,I,L)}evaluate(_){let y=this.lhs.evaluate(_),w=this.rhs.evaluate(_);if(u&&this.hasUntypedArgument){let C=wi(y),I=wi(w);if(C.kind!==I.kind||C.kind!=="string"&&C.kind!=="number")throw new hi(`Expected arguments for "${a}" to be (string, string) or (number, number), but found (${C.kind}, ${I.kind}) instead.`)}if(this.collator&&!u&&this.hasUntypedArgument){let C=wi(y),I=wi(w);if(C.kind!=="string"||I.kind!=="string")return i(_,y,w)}return this.collator?o(_,y,w,this.collator.evaluate(_)):i(_,y,w)}eachChild(_){_(this.lhs),_(this.rhs),this.collator&&_(this.collator)}outputDefined(){return!0}}}let ah=lo("==",function(a,i,o){return i===o},Ni),Od=lo("!=",function(a,i,o){return i!==o},function(a,i,o,u){return!Ni(0,i,o,u)}),nm=lo("<",function(a,i,o){return i<o},function(a,i,o,u){return u.compare(i,o)<0}),Ol=lo(">",function(a,i,o){return i>o},function(a,i,o,u){return u.compare(i,o)>0}),lh=lo("<=",function(a,i,o){return i<=o},function(a,i,o,u){return u.compare(i,o)<=0}),sm=lo(">=",function(a,i,o){return i>=o},function(a,i,o,u){return u.compare(i,o)>=0});class co{constructor(i,o,u){this.type=ai,this.locale=u,this.caseSensitive=i,this.diacriticSensitive=o}static parse(i,o){if(i.length!==2)return o.error("Expected one argument.");let u=i[1];if(typeof u!="object"||Array.isArray(u))return o.error("Collator options argument must be an object.");let f=o.parse(u["case-sensitive"]!==void 0&&u["case-sensitive"],1,Qe);if(!f)return null;let _=o.parse(u["diacritic-sensitive"]!==void 0&&u["diacritic-sensitive"],1,Qe);if(!_)return null;let y=null;return u.locale&&(y=o.parse(u.locale,1,We),!y)?null:new co(f,_,y)}evaluate(i){return new kl(this.caseSensitive.evaluate(i),this.diacriticSensitive.evaluate(i),this.locale?this.locale.evaluate(i):null)}eachChild(i){i(this.caseSensitive),i(this.diacriticSensitive),this.locale&&i(this.locale)}outputDefined(){return!1}}class qo{constructor(i,o,u,f,_){this.type=We,this.number=i,this.locale=o,this.currency=u,this.minFractionDigits=f,this.maxFractionDigits=_}static parse(i,o){if(i.length!==3)return o.error("Expected two arguments.");let u=o.parse(i[1],1,Pe);if(!u)return null;let f=i[2];if(typeof f!="object"||Array.isArray(f))return o.error("NumberFormat options argument must be an object.");let _=null;if(f.locale&&(_=o.parse(f.locale,1,We),!_))return null;let y=null;if(f.currency&&(y=o.parse(f.currency,1,We),!y))return null;let w=null;if(f["min-fraction-digits"]&&(w=o.parse(f["min-fraction-digits"],1,Pe),!w))return null;let C=null;return f["max-fraction-digits"]&&(C=o.parse(f["max-fraction-digits"],1,Pe),!C)?null:new qo(u,_,y,w,C)}evaluate(i){return new Intl.NumberFormat(this.locale?this.locale.evaluate(i):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(i):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(i):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(i):void 0}).format(this.number.evaluate(i))}eachChild(i){i(this.number),this.locale&&i(this.locale),this.currency&&i(this.currency),this.minFractionDigits&&i(this.minFractionDigits),this.maxFractionDigits&&i(this.maxFractionDigits)}outputDefined(){return!1}}class Vr{constructor(i){this.type=Bs,this.sections=i}static parse(i,o){if(i.length<2)return o.error("Expected at least one argument.");let u=i[1];if(!Array.isArray(u)&&typeof u=="object")return o.error("First argument must be an image or text section.");let f=[],_=!1;for(let y=1;y<=i.length-1;++y){let w=i[y];if(_&&typeof w=="object"&&!Array.isArray(w)){_=!1;let C=null;if(w["font-scale"]&&(C=o.parse(w["font-scale"],1,Pe),!C))return null;let I=null;if(w["text-font"]&&(I=o.parse(w["text-font"],1,ln(We)),!I))return null;let L=null;if(w["text-color"]&&(L=o.parse(w["text-color"],1,wt),!L))return null;let k=f[f.length-1];k.scale=C,k.font=I,k.textColor=L}else{let C=o.parse(i[y],1,Ke);if(!C)return null;let I=C.type.kind;if(I!=="string"&&I!=="value"&&I!=="null"&&I!=="resolvedImage")return o.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");_=!0,f.push({content:C,scale:null,font:null,textColor:null})}}return new Vr(f)}evaluate(i){return new Cr(this.sections.map(o=>{let u=o.content.evaluate(i);return wi(u)===ki?new Dl("",u,null,null,null):new Dl(Bn(u),null,o.scale?o.scale.evaluate(i):null,o.font?o.font.evaluate(i).join(","):null,o.textColor?o.textColor.evaluate(i):null)}))}eachChild(i){for(let o of this.sections)i(o.content),o.scale&&i(o.scale),o.font&&i(o.font),o.textColor&&i(o.textColor)}outputDefined(){return!1}}class Bl{constructor(i){this.type=ki,this.input=i}static parse(i,o){if(i.length!==2)return o.error("Expected two arguments.");let u=o.parse(i[1],1,We);return u?new Bl(u):o.error("No image name provided.")}evaluate(i){let o=this.input.evaluate(i),u=Gr.fromString(o);return u&&i.availableImages&&(u.available=i.availableImages.indexOf(o)>-1),u}eachChild(i){i(this.input)}outputDefined(){return!1}}class Wo{constructor(i){this.type=Pe,this.input=i}static parse(i,o){if(i.length!==2)return o.error(`Expected 1 argument, but found ${i.length-1} instead.`);let u=o.parse(i[1],1);return u?u.type.kind!=="array"&&u.type.kind!=="string"&&u.type.kind!=="value"?o.error(`Expected argument of type string or array, but found ${ci(u.type)} instead.`):new Wo(u):null}evaluate(i){let o=this.input.evaluate(i);if(typeof o=="string")return[...o].length;if(Array.isArray(o))return o.length;throw new hi(`Expected value to be of type string or array, but found ${ci(wi(o))} instead.`)}eachChild(i){i(this.input)}outputDefined(){return!1}}let is=8192;function ch(a,i){let o=(180+a[0])/360,u=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a[1]*Math.PI/360)))/360,f=Math.pow(2,i.z);return[Math.round(o*f*is),Math.round(u*f*is)]}function hh(a,i){let o=Math.pow(2,i.z);return[(f=(a[0]/is+i.x)/o,360*f-180),(u=(a[1]/is+i.y)/o,360/Math.PI*Math.atan(Math.exp((180-360*u)*Math.PI/180))-90)];var u,f}function Fa(a,i){a[0]=Math.min(a[0],i[0]),a[1]=Math.min(a[1],i[1]),a[2]=Math.max(a[2],i[0]),a[3]=Math.max(a[3],i[1])}function za(a,i){return!(a[0]<=i[0]||a[2]>=i[2]||a[1]<=i[1]||a[3]>=i[3])}function om(a,i,o){let u=a[0]-i[0],f=a[1]-i[1],_=a[0]-o[0],y=a[1]-o[1];return u*y-_*f==0&&u*_<=0&&f*y<=0}function ho(a,i,o,u){return(f=[u[0]-o[0],u[1]-o[1]])[0]*(_=[i[0]-a[0],i[1]-a[1]])[1]-f[1]*_[0]!=0&&!(!Gd(a,i,o,u)||!Gd(o,u,a,i));var f,_}function am(a,i,o){for(let u of o)for(let f=0;f<u.length-1;++f)if(ho(a,i,u[f],u[f+1]))return!0;return!1}function uo(a,i,o=!1){let u=!1;for(let w of i)for(let C=0;C<w.length-1;C++){if(om(a,w[C],w[C+1]))return o;(_=w[C])[1]>(f=a)[1]!=(y=w[C+1])[1]>f[1]&&f[0]<(y[0]-_[0])*(f[1]-_[1])/(y[1]-_[1])+_[0]&&(u=!u)}var f,_,y;return u}function Bd(a,i){for(let o of i)if(uo(a,o))return!0;return!1}function jd(a,i){for(let o of a)if(!uo(o,i))return!1;for(let o=0;o<a.length-1;++o)if(am(a[o],a[o+1],i))return!1;return!0}function Nd(a,i){for(let o of i)if(jd(a,o))return!0;return!1}function Gd(a,i,o,u){let f=u[0]-o[0],_=u[1]-o[1],y=(a[0]-o[0])*_-f*(a[1]-o[1]),w=(i[0]-o[0])*_-f*(i[1]-o[1]);return y>0&&w<0||y<0&&w>0}function uh(a,i,o){let u=[];for(let f=0;f<a.length;f++){let _=[];for(let y=0;y<a[f].length;y++){let w=ch(a[f][y],o);Fa(i,w),_.push(w)}u.push(_)}return u}function Vd(a,i,o){let u=[];for(let f=0;f<a.length;f++){let _=uh(a[f],i,o);u.push(_)}return u}function Ud(a,i,o,u){if(a[0]<o[0]||a[0]>o[2]){let f=.5*u,_=a[0]-o[0]>f?-u:o[0]-a[0]>f?u:0;_===0&&(_=a[0]-o[2]>f?-u:o[2]-a[0]>f?u:0),a[0]+=_}Fa(i,a)}function Zd(a,i,o,u){let f=Math.pow(2,u.z)*is,_=[u.x*is,u.y*is],y=[];for(let w of a)for(let C of w){let I=[C.x+_[0],C.y+_[1]];Ud(I,i,o,f),y.push(I)}return y}function dh(a,i,o,u){let f=Math.pow(2,u.z)*is,_=[u.x*is,u.y*is],y=[];for(let C of a){let I=[];for(let L of C){let k=[L.x+_[0],L.y+_[1]];Fa(i,k),I.push(k)}y.push(I)}if(i[2]-i[0]<=f/2){(w=i)[0]=w[1]=1/0,w[2]=w[3]=-1/0;for(let C of y)for(let I of C)Ud(I,i,o,f)}var w;return y}class js{constructor(i,o){this.type=Qe,this.geojson=i,this.geometries=o}static parse(i,o){if(i.length!==2)return o.error(`'within' expression requires exactly one argument, but found ${i.length-1} instead.`);if(Go(i[1])){let u=i[1];if(u.type==="FeatureCollection"){let f=[];for(let _ of u.features){let{type:y,coordinates:w}=_.geometry;y==="Polygon"&&f.push(w),y==="MultiPolygon"&&f.push(...w)}if(f.length)return new js(u,{type:"MultiPolygon",coordinates:f})}else if(u.type==="Feature"){let f=u.geometry.type;if(f==="Polygon"||f==="MultiPolygon")return new js(u,u.geometry)}else if(u.type==="Polygon"||u.type==="MultiPolygon")return new js(u,u)}return o.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(i){if(i.geometry()!=null&&i.canonicalID()!=null){if(i.geometryType()==="Point")return function(o,u){let f=[1/0,1/0,-1/0,-1/0],_=[1/0,1/0,-1/0,-1/0],y=o.canonicalID();if(u.type==="Polygon"){let w=uh(u.coordinates,_,y),C=Zd(o.geometry(),f,_,y);if(!za(f,_))return!1;for(let I of C)if(!uo(I,w))return!1}if(u.type==="MultiPolygon"){let w=Vd(u.coordinates,_,y),C=Zd(o.geometry(),f,_,y);if(!za(f,_))return!1;for(let I of C)if(!Bd(I,w))return!1}return!0}(i,this.geometries);if(i.geometryType()==="LineString")return function(o,u){let f=[1/0,1/0,-1/0,-1/0],_=[1/0,1/0,-1/0,-1/0],y=o.canonicalID();if(u.type==="Polygon"){let w=uh(u.coordinates,_,y),C=dh(o.geometry(),f,_,y);if(!za(f,_))return!1;for(let I of C)if(!jd(I,w))return!1}if(u.type==="MultiPolygon"){let w=Vd(u.coordinates,_,y),C=dh(o.geometry(),f,_,y);if(!za(f,_))return!1;for(let I of C)if(!Nd(I,w))return!1}return!0}(i,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let ph=class{constructor(a=[],i=(o,u)=>o<u?-1:o>u?1:0){if(this.data=a,this.length=this.data.length,this.compare=i,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(a){this.data.push(a),this._up(this.length++)}pop(){if(this.length===0)return;let a=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),a}peek(){return this.data[0]}_up(a){let{data:i,compare:o}=this,u=i[a];for(;a>0;){let f=a-1>>1,_=i[f];if(o(u,_)>=0)break;i[a]=_,a=f}i[a]=u}_down(a){let{data:i,compare:o}=this,u=this.length>>1,f=i[a];for(;a<u;){let _=1+(a<<1),y=_+1;if(y<this.length&&o(i[y],i[_])<0&&(_=y),o(i[_],f)>=0)break;i[a]=i[_],a=_}i[a]=f}};function qd(a,i,o=0,u=a.length-1,f=lm){for(;u>o;){if(u-o>600){let C=u-o+1,I=i-o+1,L=Math.log(C),k=.5*Math.exp(2*L/3),B=.5*Math.sqrt(L*k*(C-k)/C)*(I-C/2<0?-1:1);qd(a,i,Math.max(o,Math.floor(i-I*k/C+B)),Math.min(u,Math.floor(i+(C-I)*k/C+B)),f)}let _=a[i],y=o,w=u;for(Oa(a,o,i),f(a[u],_)>0&&Oa(a,o,u);y<w;){for(Oa(a,y,w),y++,w--;f(a[y],_)<0;)y++;for(;f(a[w],_)>0;)w--}f(a[o],_)===0?Oa(a,o,w):(w++,Oa(a,w,u)),w<=i&&(o=w+1),i<=w&&(u=w-1)}}function Oa(a,i,o){let u=a[i];a[i]=a[o],a[o]=u}function lm(a,i){return a<i?-1:a>i?1:0}function $o(a,i){if(a.length<=1)return[a];let o=[],u,f;for(let _ of a){let y=hm(_);y!==0&&(_.area=Math.abs(y),f===void 0&&(f=y<0),f===y<0?(u&&o.push(u),u=[_]):u.push(_))}if(u&&o.push(u),i>1)for(let _=0;_<o.length;_++)o[_].length<=i||(qd(o[_],i,1,o[_].length-1,cm),o[_]=o[_].slice(0,i));return o}function cm(a,i){return i.area-a.area}function hm(a){let i=0;for(let o,u,f=0,_=a.length,y=_-1;f<_;y=f++)o=a[f],u=a[y],i+=(u.x-o.x)*(o.y+u.y);return i}let Wd=1/298.257223563,fh=Wd*(2-Wd),mh=Math.PI/180;class gh{constructor(i){let o=6378.137*mh*1e3,u=Math.cos(i*mh),f=1/(1-fh*(1-u*u)),_=Math.sqrt(f);this.kx=o*_*u,this.ky=o*_*f*(1-fh)}distance(i,o){let u=this.wrap(i[0]-o[0])*this.kx,f=(i[1]-o[1])*this.ky;return Math.sqrt(u*u+f*f)}pointOnLine(i,o){let u,f,_,y,w=1/0;for(let C=0;C<i.length-1;C++){let I=i[C][0],L=i[C][1],k=this.wrap(i[C+1][0]-I)*this.kx,B=(i[C+1][1]-L)*this.ky,N=0;k===0&&B===0||(N=(this.wrap(o[0]-I)*this.kx*k+(o[1]-L)*this.ky*B)/(k*k+B*B),N>1?(I=i[C+1][0],L=i[C+1][1]):N>0&&(I+=k/this.kx*N,L+=B/this.ky*N)),k=this.wrap(o[0]-I)*this.kx,B=(o[1]-L)*this.ky;let G=k*k+B*B;G<w&&(w=G,u=I,f=L,_=C,y=N)}return{point:[u,f],index:_,t:Math.max(0,Math.min(1,y))}}wrap(i){for(;i<-180;)i+=360;for(;i>180;)i-=360;return i}}function $d(a,i){return i[0]-a[0]}function Ba(a){return a[1]-a[0]+1}function rs(a,i){return a[1]>=a[0]&&a[1]<i}function _h(a,i){if(a[0]>a[1])return[null,null];let o=Ba(a);if(i){if(o===2)return[a,null];let f=Math.floor(o/2);return[[a[0],a[0]+f],[a[0]+f,a[1]]]}if(o===1)return[a,null];let u=Math.floor(o/2)-1;return[[a[0],a[0]+u],[a[0]+u+1,a[1]]]}function yh(a,i){if(!rs(i,a.length))return[1/0,1/0,-1/0,-1/0];let o=[1/0,1/0,-1/0,-1/0];for(let u=i[0];u<=i[1];++u)Fa(o,a[u]);return o}function xh(a){let i=[1/0,1/0,-1/0,-1/0];for(let o of a)for(let u of o)Fa(i,u);return i}function vh(a){return a[0]!==-1/0&&a[1]!==-1/0&&a[2]!==1/0&&a[3]!==1/0}function bh(a,i,o){if(!vh(a)||!vh(i))return NaN;let u=0,f=0;return a[2]<i[0]&&(u=i[0]-a[2]),a[0]>i[2]&&(u=a[0]-i[2]),a[1]>i[3]&&(f=a[1]-i[3]),a[3]<i[1]&&(f=i[1]-a[3]),o.distance([0,0],[u,f])}function po(a,i,o){let u=o.pointOnLine(i,a);return o.distance(a,u.point)}function wh(a,i,o,u,f){let _=Math.min(po(a,[o,u],f),po(i,[o,u],f)),y=Math.min(po(o,[a,i],f),po(u,[a,i],f));return Math.min(_,y)}function um(a,i,o,u,f){if(!rs(i,a.length)||!rs(u,o.length))return 1/0;let _=1/0;for(let y=i[0];y<i[1];++y){let w=a[y],C=a[y+1];for(let I=u[0];I<u[1];++I){let L=o[I],k=o[I+1];if(ho(w,C,L,k))return 0;_=Math.min(_,wh(w,C,L,k,f))}}return _}function Wt(a,i,o,u,f){if(!rs(i,a.length)||!rs(u,o.length))return NaN;let _=1/0;for(let y=i[0];y<=i[1];++y)for(let w=u[0];w<=u[1];++w)if(_=Math.min(_,f.distance(a[y],o[w])),_===0)return _;return _}function dm(a,i,o){if(uo(a,i,!0))return 0;let u=1/0;for(let f of i){let _=f[0],y=f[f.length-1];if(_!==y&&(u=Math.min(u,po(a,[y,_],o)),u===0))return u;let w=o.pointOnLine(f,a);if(u=Math.min(u,o.distance(a,w.point)),u===0)return u}return u}function pm(a,i,o,u){if(!rs(i,a.length))return NaN;for(let _=i[0];_<=i[1];++_)if(uo(a[_],o,!0))return 0;let f=1/0;for(let _=i[0];_<i[1];++_){let y=a[_],w=a[_+1];for(let C of o)for(let I=0,L=C.length,k=L-1;I<L;k=I++){let B=C[k],N=C[I];if(ho(y,w,B,N))return 0;f=Math.min(f,wh(y,w,B,N,u))}}return f}function Xd(a,i){for(let o of a)for(let u of o)if(uo(u,i,!0))return!0;return!1}function fm(a,i,o,u=1/0){let f=xh(a),_=xh(i);if(u!==1/0&&bh(f,_,o)>=u)return u;if(za(f,_)){if(Xd(a,i))return 0}else if(Xd(i,a))return 0;let y=1/0;for(let w of a)for(let C=0,I=w.length,L=I-1;C<I;L=C++){let k=w[L],B=w[C];for(let N of i)for(let G=0,U=N.length,Y=U-1;G<U;Y=G++){let te=N[Y],de=N[G];if(ho(k,B,te,de))return 0;y=Math.min(y,wh(k,B,te,de,o))}}return y}function Hd(a,i,o,u,f,_){if(!_)return;let y=bh(yh(u,_),f,o);y<i&&a.push([y,_,[0,0]])}function jl(a,i,o,u,f,_,y){if(!_||!y)return;let w=bh(yh(u,_),yh(f,y),o);w<i&&a.push([w,_,y])}function Nl(a,i,o,u,f=1/0){let _=Math.min(u.distance(a[0],o[0][0]),f);if(_===0)return _;let y=new ph([[0,[0,a.length-1],[0,0]]],$d),w=xh(o);for(;y.length>0;){let C=y.pop();if(C[0]>=_)continue;let I=C[1],L=i?50:100;if(Ba(I)<=L){if(!rs(I,a.length))return NaN;if(i){let k=pm(a,I,o,u);if(isNaN(k)||k===0)return k;_=Math.min(_,k)}else for(let k=I[0];k<=I[1];++k){let B=dm(a[k],o,u);if(_=Math.min(_,B),_===0)return 0}}else{let k=_h(I,i);Hd(y,_,u,a,w,k[0]),Hd(y,_,u,a,w,k[1])}}return _}function Gl(a,i,o,u,f,_=1/0){let y=Math.min(_,f.distance(a[0],o[0]));if(y===0)return y;let w=new ph([[0,[0,a.length-1],[0,o.length-1]]],$d);for(;w.length>0;){let C=w.pop();if(C[0]>=y)continue;let I=C[1],L=C[2],k=i?50:100,B=u?50:100;if(Ba(I)<=k&&Ba(L)<=B){if(!rs(I,a.length)&&rs(L,o.length))return NaN;let N;if(i&&u)N=um(a,I,o,L,f),y=Math.min(y,N);else if(i&&!u){let G=a.slice(I[0],I[1]+1);for(let U=L[0];U<=L[1];++U)if(N=po(o[U],G,f),y=Math.min(y,N),y===0)return y}else if(!i&&u){let G=o.slice(L[0],L[1]+1);for(let U=I[0];U<=I[1];++U)if(N=po(a[U],G,f),y=Math.min(y,N),y===0)return y}else N=Wt(a,I,o,L,f),y=Math.min(y,N)}else{let N=_h(I,i),G=_h(L,u);jl(w,y,f,a,o,N[0],G[0]),jl(w,y,f,a,o,N[0],G[1]),jl(w,y,f,a,o,N[1],G[0]),jl(w,y,f,a,o,N[1],G[1])}}return y}function Sh(a){return a.type==="MultiPolygon"?a.coordinates.map(i=>({type:"Polygon",coordinates:i})):a.type==="MultiLineString"?a.coordinates.map(i=>({type:"LineString",coordinates:i})):a.type==="MultiPoint"?a.coordinates.map(i=>({type:"Point",coordinates:i})):[a]}class fo{constructor(i,o){this.type=Pe,this.geojson=i,this.geometries=o}static parse(i,o){if(i.length!==2)return o.error(`'distance' expression requires exactly one argument, but found ${i.length-1} instead.`);if(Go(i[1])){let u=i[1];if(u.type==="FeatureCollection")return new fo(u,u.features.map(f=>Sh(f.geometry)).flat());if(u.type==="Feature")return new fo(u,Sh(u.geometry));if("type"in u&&"coordinates"in u)return new fo(u,Sh(u))}return o.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(i){if(i.geometry()!=null&&i.canonicalID()!=null){if(i.geometryType()==="Point")return function(o,u){let f=o.geometry(),_=f.flat().map(C=>hh([C.x,C.y],o.canonical));if(f.length===0)return NaN;let y=new gh(_[0][1]),w=1/0;for(let C of u){switch(C.type){case"Point":w=Math.min(w,Gl(_,!1,[C.coordinates],!1,y,w));break;case"LineString":w=Math.min(w,Gl(_,!1,C.coordinates,!0,y,w));break;case"Polygon":w=Math.min(w,Nl(_,!1,C.coordinates,y,w))}if(w===0)return w}return w}(i,this.geometries);if(i.geometryType()==="LineString")return function(o,u){let f=o.geometry(),_=f.flat().map(C=>hh([C.x,C.y],o.canonical));if(f.length===0)return NaN;let y=new gh(_[0][1]),w=1/0;for(let C of u){switch(C.type){case"Point":w=Math.min(w,Gl(_,!0,[C.coordinates],!1,y,w));break;case"LineString":w=Math.min(w,Gl(_,!0,C.coordinates,!0,y,w));break;case"Polygon":w=Math.min(w,Nl(_,!0,C.coordinates,y,w))}if(w===0)return w}return w}(i,this.geometries);if(i.geometryType()==="Polygon")return function(o,u){let f=o.geometry();if(f.length===0||f[0].length===0)return NaN;let _=$o(f,0).map(C=>C.map(I=>I.map(L=>hh([L.x,L.y],o.canonical)))),y=new gh(_[0][0][0][1]),w=1/0;for(let C of u)for(let I of _){switch(C.type){case"Point":w=Math.min(w,Nl([C.coordinates],!1,I,y,w));break;case"LineString":w=Math.min(w,Nl(C.coordinates,!0,I,y,w));break;case"Polygon":w=Math.min(w,fm(I,C.coordinates,y,w))}if(w===0)return w}return w}(i,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}let Xo={"==":ah,"!=":Od,">":Ol,"<":nm,">=":sm,"<=":lh,array:dr,at:Rt,boolean:dr,case:jn,coalesce:ka,collator:co,format:Vr,image:Bl,in:Ra,"index-of":Bt,interpolate:ir,"interpolate-hcl":ir,"interpolate-lab":ir,length:Wo,let:Vo,literal:oo,match:Aa,number:dr,"number-format":qo,object:dr,slice:Uo,step:Zo,string:dr,"to-boolean":_s,"to-color":_s,"to-number":_s,"to-string":_s,var:Ot,within:js,distance:fo};class _n{constructor(i,o,u,f){this.name=i,this.type=o,this._evaluate=u,this.args=f}evaluate(i){return this._evaluate(i,this.args)}eachChild(i){this.args.forEach(i)}outputDefined(){return!1}static parse(i,o){let u=i[0],f=_n.definitions[u];if(!f)return o.error(`Unknown expression "${u}". If you wanted a literal array, use ["literal", [...]].`,0);let _=Array.isArray(f)?f[0]:f.type,y=Array.isArray(f)?[[f[1],f[2]]]:f.overloads,w=y.filter(([I])=>!Array.isArray(I)||I.length===i.length-1),C=null;for(let[I,L]of w){C=new Jt(o.registry,Vl,o.path,null,o.scope);let k=[],B=!1;for(let N=1;N<i.length;N++){let G=i[N],U=Array.isArray(I)?I[N-1]:I.type,Y=C.parse(G,1+k.length,U);if(!Y){B=!0;break}k.push(Y)}if(!B)if(Array.isArray(I)&&I.length!==k.length)C.error(`Expected ${I.length} arguments, but found ${k.length} instead.`);else{for(let N=0;N<k.length;N++){let G=Array.isArray(I)?I[N]:I.type,U=k[N];C.concat(N+1).checkSubtype(G,U.type)}if(C.errors.length===0)return new _n(u,_,L,k)}}if(w.length===1)o.errors.push(...C.errors);else{let I=(w.length?w:y).map(([k])=>{return B=k,Array.isArray(B)?`(${B.map(ci).join(", ")})`:`(${ci(B.type)}...)`;var B}).join(" | "),L=[];for(let k=1;k<i.length;k++){let B=o.parse(i[k],1+L.length);if(!B)return null;L.push(ci(B.type))}o.error(`Expected arguments of type ${I}, but found (${L.join(", ")}) instead.`)}return null}static register(i,o){_n.definitions=o;for(let u in o)i[u]=_n}}function Yd(a,[i,o,u,f]){i=i.evaluate(a),o=o.evaluate(a),u=u.evaluate(a);let _=f?f.evaluate(a):1,y=Ea(i,o,u,_);if(y)throw new hi(y);return new Lt(i/255,o/255,u/255,_,!1)}function Kd(a,i){return a in i}function Th(a,i){let o=i[a];return o===void 0?null:o}function mo(a){return{type:a}}function Vl(a){if(a instanceof Ot)return Vl(a.boundExpression);if(a instanceof _n&&a.name==="error"||a instanceof co||a instanceof js||a instanceof fo)return!1;let i=a instanceof _s||a instanceof dr,o=!0;return a.eachChild(u=>{o=i?o&&Vl(u):o&&u instanceof oo}),!!o&&Ul(a)&&Zl(a,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Ul(a){if(a instanceof _n&&(a.name==="get"&&a.args.length===1||a.name==="feature-state"||a.name==="has"&&a.args.length===1||a.name==="properties"||a.name==="geometry-type"||a.name==="id"||/^filter-/.test(a.name))||a instanceof js||a instanceof fo)return!1;let i=!0;return a.eachChild(o=>{i&&!Ul(o)&&(i=!1)}),i}function ja(a){if(a instanceof _n&&a.name==="feature-state")return!1;let i=!0;return a.eachChild(o=>{i&&!ja(o)&&(i=!1)}),i}function Zl(a,i){if(a instanceof _n&&i.indexOf(a.name)>=0)return!1;let o=!0;return a.eachChild(u=>{o&&!Zl(u,i)&&(o=!1)}),o}function Jd(a){return{result:"success",value:a}}function Ho(a){return{result:"error",value:a}}function Yo(a){return a["property-type"]==="data-driven"||a["property-type"]==="cross-faded-data-driven"}function Qd(a){return!!a.expression&&a.expression.parameters.indexOf("zoom")>-1}function Ch(a){return!!a.expression&&a.expression.interpolated}function Nt(a){return a instanceof Number?"number":a instanceof String?"string":a instanceof Boolean?"boolean":Array.isArray(a)?"array":a===null?"null":typeof a}function ql(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)}function mm(a){return a}function ep(a,i){let o=i.type==="color",u=a.stops&&typeof a.stops[0][0]=="object",f=u||!(u||a.property!==void 0),_=a.type||(Ch(i)?"exponential":"interval");if(o||i.type==="padding"){let L=o?Lt.parse:pi.parse;(a=Xe({},a)).stops&&(a.stops=a.stops.map(k=>[k[0],L(k[1])])),a.default=L(a.default?a.default:i.default)}if(a.colorSpace&&(y=a.colorSpace)!=="rgb"&&y!=="hcl"&&y!=="lab")throw new Error(`Unknown color space: "${a.colorSpace}"`);var y;let w,C,I;if(_==="exponential")w=tp;else if(_==="interval")w=Mh;else if(_==="categorical"){w=gm,C=Object.create(null);for(let L of a.stops)C[L[0]]=L[1];I=typeof a.stops[0][0]}else{if(_!=="identity")throw new Error(`Unknown function type "${_}"`);w=_m}if(u){let L={},k=[];for(let G=0;G<a.stops.length;G++){let U=a.stops[G],Y=U[0].zoom;L[Y]===void 0&&(L[Y]={zoom:Y,type:a.type,property:a.property,default:a.default,stops:[]},k.push(Y)),L[Y].stops.push([U[0].value,U[1]])}let B=[];for(let G of k)B.push([L[G].zoom,ep(L[G],i)]);let N={name:"linear"};return{kind:"composite",interpolationType:N,interpolationFactor:ir.interpolationFactor.bind(void 0,N),zoomStops:B.map(G=>G[0]),evaluate:({zoom:G},U)=>tp({stops:B,base:a.base},i,G).evaluate(G,U)}}if(f){let L=_==="exponential"?{name:"exponential",base:a.base!==void 0?a.base:1}:null;return{kind:"camera",interpolationType:L,interpolationFactor:ir.interpolationFactor.bind(void 0,L),zoomStops:a.stops.map(k=>k[0]),evaluate:({zoom:k})=>w(a,i,k,C,I)}}return{kind:"source",evaluate(L,k){let B=k&&k.properties?k.properties[a.property]:void 0;return B===void 0?Na(a.default,i.default):w(a,i,B,C,I)}}}function Na(a,i,o){return a!==void 0?a:i!==void 0?i:o!==void 0?o:void 0}function gm(a,i,o,u,f){return Na(typeof o===f?u[o]:void 0,a.default,i.default)}function Mh(a,i,o){if(Nt(o)!=="number")return Na(a.default,i.default);let u=a.stops.length;if(u===1||o<=a.stops[0][0])return a.stops[0][1];if(o>=a.stops[u-1][0])return a.stops[u-1][1];let f=La(a.stops.map(_=>_[0]),o);return a.stops[f][1]}function tp(a,i,o){let u=a.base!==void 0?a.base:1;if(Nt(o)!=="number")return Na(a.default,i.default);let f=a.stops.length;if(f===1||o<=a.stops[0][0])return a.stops[0][1];if(o>=a.stops[f-1][0])return a.stops[f-1][1];let _=La(a.stops.map(L=>L[0]),o),y=function(L,k,B,N){let G=N-B,U=L-B;return G===0?0:k===1?U/G:(Math.pow(k,U)-1)/(Math.pow(k,G)-1)}(o,u,a.stops[_][0],a.stops[_+1][0]),w=a.stops[_][1],C=a.stops[_+1][1],I=cn[i.type]||mm;return typeof w.evaluate=="function"?{evaluate(...L){let k=w.evaluate.apply(void 0,L),B=C.evaluate.apply(void 0,L);if(k!==void 0&&B!==void 0)return I(k,B,y,a.colorSpace)}}:I(w,C,y,a.colorSpace)}function _m(a,i,o){switch(i.type){case"color":o=Lt.parse(o);break;case"formatted":o=Cr.fromString(o.toString());break;case"resolvedImage":o=Gr.fromString(o.toString());break;case"padding":o=pi.parse(o);break;default:Nt(o)===i.type||i.type==="enum"&&i.values[o]||(o=void 0)}return Na(o,a.default,i.default)}_n.register(Xo,{error:[{kind:"error"},[We],(a,[i])=>{throw new hi(i.evaluate(a))}],typeof:[We,[Ke],(a,[i])=>ci(wi(i.evaluate(a)))],"to-rgba":[ln(Pe,4),[wt],(a,[i])=>{let[o,u,f,_]=i.evaluate(a).rgb;return[255*o,255*u,255*f,_]}],rgb:[wt,[Pe,Pe,Pe],Yd],rgba:[wt,[Pe,Pe,Pe,Pe],Yd],has:{type:Qe,overloads:[[[We],(a,[i])=>Kd(i.evaluate(a),a.properties())],[[We,nt],(a,[i,o])=>Kd(i.evaluate(a),o.evaluate(a))]]},get:{type:Ke,overloads:[[[We],(a,[i])=>Th(i.evaluate(a),a.properties())],[[We,nt],(a,[i,o])=>Th(i.evaluate(a),o.evaluate(a))]]},"feature-state":[Ke,[We],(a,[i])=>Th(i.evaluate(a),a.featureState||{})],properties:[nt,[],a=>a.properties()],"geometry-type":[We,[],a=>a.geometryType()],id:[Ke,[],a=>a.id()],zoom:[Pe,[],a=>a.globals.zoom],"heatmap-density":[Pe,[],a=>a.globals.heatmapDensity||0],"line-progress":[Pe,[],a=>a.globals.lineProgress||0],accumulated:[Ke,[],a=>a.globals.accumulated===void 0?null:a.globals.accumulated],"+":[Pe,mo(Pe),(a,i)=>{let o=0;for(let u of i)o+=u.evaluate(a);return o}],"*":[Pe,mo(Pe),(a,i)=>{let o=1;for(let u of i)o*=u.evaluate(a);return o}],"-":{type:Pe,overloads:[[[Pe,Pe],(a,[i,o])=>i.evaluate(a)-o.evaluate(a)],[[Pe],(a,[i])=>-i.evaluate(a)]]},"/":[Pe,[Pe,Pe],(a,[i,o])=>i.evaluate(a)/o.evaluate(a)],"%":[Pe,[Pe,Pe],(a,[i,o])=>i.evaluate(a)%o.evaluate(a)],ln2:[Pe,[],()=>Math.LN2],pi:[Pe,[],()=>Math.PI],e:[Pe,[],()=>Math.E],"^":[Pe,[Pe,Pe],(a,[i,o])=>Math.pow(i.evaluate(a),o.evaluate(a))],sqrt:[Pe,[Pe],(a,[i])=>Math.sqrt(i.evaluate(a))],log10:[Pe,[Pe],(a,[i])=>Math.log(i.evaluate(a))/Math.LN10],ln:[Pe,[Pe],(a,[i])=>Math.log(i.evaluate(a))],log2:[Pe,[Pe],(a,[i])=>Math.log(i.evaluate(a))/Math.LN2],sin:[Pe,[Pe],(a,[i])=>Math.sin(i.evaluate(a))],cos:[Pe,[Pe],(a,[i])=>Math.cos(i.evaluate(a))],tan:[Pe,[Pe],(a,[i])=>Math.tan(i.evaluate(a))],asin:[Pe,[Pe],(a,[i])=>Math.asin(i.evaluate(a))],acos:[Pe,[Pe],(a,[i])=>Math.acos(i.evaluate(a))],atan:[Pe,[Pe],(a,[i])=>Math.atan(i.evaluate(a))],min:[Pe,mo(Pe),(a,i)=>Math.min(...i.map(o=>o.evaluate(a)))],max:[Pe,mo(Pe),(a,i)=>Math.max(...i.map(o=>o.evaluate(a)))],abs:[Pe,[Pe],(a,[i])=>Math.abs(i.evaluate(a))],round:[Pe,[Pe],(a,[i])=>{let o=i.evaluate(a);return o<0?-Math.round(-o):Math.round(o)}],floor:[Pe,[Pe],(a,[i])=>Math.floor(i.evaluate(a))],ceil:[Pe,[Pe],(a,[i])=>Math.ceil(i.evaluate(a))],"filter-==":[Qe,[We,Ke],(a,[i,o])=>a.properties()[i.value]===o.value],"filter-id-==":[Qe,[Ke],(a,[i])=>a.id()===i.value],"filter-type-==":[Qe,[We],(a,[i])=>a.geometryType()===i.value],"filter-<":[Qe,[We,Ke],(a,[i,o])=>{let u=a.properties()[i.value],f=o.value;return typeof u==typeof f&&u<f}],"filter-id-<":[Qe,[Ke],(a,[i])=>{let o=a.id(),u=i.value;return typeof o==typeof u&&o<u}],"filter->":[Qe,[We,Ke],(a,[i,o])=>{let u=a.properties()[i.value],f=o.value;return typeof u==typeof f&&u>f}],"filter-id->":[Qe,[Ke],(a,[i])=>{let o=a.id(),u=i.value;return typeof o==typeof u&&o>u}],"filter-<=":[Qe,[We,Ke],(a,[i,o])=>{let u=a.properties()[i.value],f=o.value;return typeof u==typeof f&&u<=f}],"filter-id-<=":[Qe,[Ke],(a,[i])=>{let o=a.id(),u=i.value;return typeof o==typeof u&&o<=u}],"filter->=":[Qe,[We,Ke],(a,[i,o])=>{let u=a.properties()[i.value],f=o.value;return typeof u==typeof f&&u>=f}],"filter-id->=":[Qe,[Ke],(a,[i])=>{let o=a.id(),u=i.value;return typeof o==typeof u&&o>=u}],"filter-has":[Qe,[Ke],(a,[i])=>i.value in a.properties()],"filter-has-id":[Qe,[],a=>a.id()!==null&&a.id()!==void 0],"filter-type-in":[Qe,[ln(We)],(a,[i])=>i.value.indexOf(a.geometryType())>=0],"filter-id-in":[Qe,[ln(Ke)],(a,[i])=>i.value.indexOf(a.id())>=0],"filter-in-small":[Qe,[We,ln(Ke)],(a,[i,o])=>o.value.indexOf(a.properties()[i.value])>=0],"filter-in-large":[Qe,[We,ln(Ke)],(a,[i,o])=>function(u,f,_,y){for(;_<=y;){let w=_+y>>1;if(f[w]===u)return!0;f[w]>u?y=w-1:_=w+1}return!1}(a.properties()[i.value],o.value,0,o.value.length-1)],all:{type:Qe,overloads:[[[Qe,Qe],(a,[i,o])=>i.evaluate(a)&&o.evaluate(a)],[mo(Qe),(a,i)=>{for(let o of i)if(!o.evaluate(a))return!1;return!0}]]},any:{type:Qe,overloads:[[[Qe,Qe],(a,[i,o])=>i.evaluate(a)||o.evaluate(a)],[mo(Qe),(a,i)=>{for(let o of i)if(o.evaluate(a))return!0;return!1}]]},"!":[Qe,[Qe],(a,[i])=>!i.evaluate(a)],"is-supported-script":[Qe,[We],(a,[i])=>{let o=a.globals&&a.globals.isSupportedScript;return!o||o(i.evaluate(a))}],upcase:[We,[We],(a,[i])=>i.evaluate(a).toUpperCase()],downcase:[We,[We],(a,[i])=>i.evaluate(a).toLowerCase()],concat:[We,mo(Ke),(a,i)=>i.map(o=>Bn(o.evaluate(a))).join("")],"resolved-locale":[We,[ai],(a,[i])=>i.evaluate(a).resolvedLocale()]});class Ih{constructor(i,o){var u;this.expression=i,this._warningHistory={},this._evaluator=new Pa,this._defaultValue=o?(u=o).type==="color"&&ql(u.default)?new Lt(0,0,0,0):u.type==="color"?Lt.parse(u.default)||null:u.type==="padding"?pi.parse(u.default)||null:u.type==="variableAnchorOffsetCollection"?ur.parse(u.default)||null:u.type==="projectionDefinition"?tr.parse(u.default)||null:u.default===void 0?null:u.default:null,this._enumValues=o&&o.type==="enum"?o.values:null}evaluateWithoutErrorHandling(i,o,u,f,_,y){return this._evaluator.globals=i,this._evaluator.feature=o,this._evaluator.featureState=u,this._evaluator.canonical=f,this._evaluator.availableImages=_||null,this._evaluator.formattedSection=y,this.expression.evaluate(this._evaluator)}evaluate(i,o,u,f,_,y){this._evaluator.globals=i,this._evaluator.feature=o||null,this._evaluator.featureState=u||null,this._evaluator.canonical=f,this._evaluator.availableImages=_||null,this._evaluator.formattedSection=y||null;try{let w=this.expression.evaluate(this._evaluator);if(w==null||typeof w=="number"&&w!=w)return this._defaultValue;if(this._enumValues&&!(w in this._enumValues))throw new hi(`Expected value to be one of ${Object.keys(this._enumValues).map(C=>JSON.stringify(C)).join(", ")}, but found ${JSON.stringify(w)} instead.`);return w}catch(w){return this._warningHistory[w.message]||(this._warningHistory[w.message]=!0,typeof console<"u"&&console.warn(w.message)),this._defaultValue}}}function Ga(a){return Array.isArray(a)&&a.length>0&&typeof a[0]=="string"&&a[0]in Xo}function Wl(a,i){let o=new Jt(Xo,Vl,[],i?function(f){let _={color:wt,string:We,number:Pe,enum:We,boolean:Qe,formatted:Bs,padding:ji,projectionDefinition:mt,resolvedImage:ki,variableAnchorOffsetCollection:li};return f.type==="array"?ln(_[f.value]||Ke,f.length):_[f.type]}(i):void 0),u=o.parse(a,void 0,void 0,void 0,i&&i.type==="string"?{typeAnnotation:"coerce"}:void 0);return u?Jd(new Ih(u,i)):Ho(o.errors)}class Eh{constructor(i,o){this.kind=i,this._styleExpression=o,this.isStateDependent=i!=="constant"&&!ja(o.expression)}evaluateWithoutErrorHandling(i,o,u,f,_,y){return this._styleExpression.evaluateWithoutErrorHandling(i,o,u,f,_,y)}evaluate(i,o,u,f,_,y){return this._styleExpression.evaluate(i,o,u,f,_,y)}}class Ko{constructor(i,o,u,f){this.kind=i,this.zoomStops=u,this._styleExpression=o,this.isStateDependent=i!=="camera"&&!ja(o.expression),this.interpolationType=f}evaluateWithoutErrorHandling(i,o,u,f,_,y){return this._styleExpression.evaluateWithoutErrorHandling(i,o,u,f,_,y)}evaluate(i,o,u,f,_,y){return this._styleExpression.evaluate(i,o,u,f,_,y)}interpolationFactor(i,o,u){return this.interpolationType?ir.interpolationFactor(this.interpolationType,i,o,u):0}}function Ph(a,i){let o=Wl(a,i);if(o.result==="error")return o;let u=o.value.expression,f=Ul(u);if(!f&&!Yo(i))return Ho([new Ue("","data expressions not supported")]);let _=Zl(u,["zoom"]);if(!_&&!Qd(i))return Ho([new Ue("","zoom expressions not supported")]);let y=Xl(u);return y||_?y instanceof Ue?Ho([y]):y instanceof ir&&!Ch(i)?Ho([new Ue("",'"interpolate" expressions cannot be used with this property')]):Jd(y?new Ko(f?"camera":"composite",o.value,y.labels,y instanceof ir?y.interpolation:void 0):new Eh(f?"constant":"source",o.value)):Ho([new Ue("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class $l{constructor(i,o){this._parameters=i,this._specification=o,Xe(this,ep(this._parameters,this._specification))}static deserialize(i){return new $l(i._parameters,i._specification)}static serialize(i){return{_parameters:i._parameters,_specification:i._specification}}}function Xl(a){let i=null;if(a instanceof Vo)i=Xl(a.result);else if(a instanceof ka){for(let o of a.args)if(i=Xl(o),i)break}else(a instanceof Zo||a instanceof ir)&&a.input instanceof _n&&a.input.name==="zoom"&&(i=a);return i instanceof Ue||a.eachChild(o=>{let u=Xl(o);u instanceof Ue?i=u:!i&&u?i=new Ue("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):i&&u&&i!==u&&(i=new Ue("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),i}function Rh(a){if(a===!0||a===!1)return!0;if(!Array.isArray(a)||a.length===0)return!1;switch(a[0]){case"has":return a.length>=2&&a[1]!=="$id"&&a[1]!=="$type";case"in":return a.length>=3&&(typeof a[1]!="string"||Array.isArray(a[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return a.length!==3||Array.isArray(a[1])||Array.isArray(a[2]);case"any":case"all":for(let i of a.slice(1))if(!Rh(i)&&typeof i!="boolean")return!1;return!0;default:return!0}}let ym={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ah(a){if(a==null)return{filter:()=>!0,needGeometry:!1};Rh(a)||(a=Hl(a));let i=Wl(a,ym);if(i.result==="error")throw new Error(i.value.map(o=>`${o.key}: ${o.message}`).join(", "));return{filter:(o,u,f)=>i.value.evaluate(o,u,{},f),needGeometry:Lh(a)}}function ip(a,i){return a<i?-1:a>i?1:0}function Lh(a){if(!Array.isArray(a))return!1;if(a[0]==="within"||a[0]==="distance")return!0;for(let i=1;i<a.length;i++)if(Lh(a[i]))return!0;return!1}function Hl(a){if(!a)return!0;let i=a[0];return a.length<=1?i!=="any":i==="=="?kh(a[1],a[2],"=="):i==="!="?Va(kh(a[1],a[2],"==")):i==="<"||i===">"||i==="<="||i===">="?kh(a[1],a[2],i):i==="any"?(o=a.slice(1),["any"].concat(o.map(Hl))):i==="all"?["all"].concat(a.slice(1).map(Hl)):i==="none"?["all"].concat(a.slice(1).map(Hl).map(Va)):i==="in"?Dh(a[1],a.slice(2)):i==="!in"?Va(Dh(a[1],a.slice(2))):i==="has"?Fh(a[1]):i!=="!has"||Va(Fh(a[1]));var o}function kh(a,i,o){switch(a){case"$type":return[`filter-type-${o}`,i];case"$id":return[`filter-id-${o}`,i];default:return[`filter-${o}`,a,i]}}function Dh(a,i){if(i.length===0)return!1;switch(a){case"$type":return["filter-type-in",["literal",i]];case"$id":return["filter-id-in",["literal",i]];default:return i.length>200&&!i.some(o=>typeof o!=typeof i[0])?["filter-in-large",a,["literal",i.sort(ip)]]:["filter-in-small",a,["literal",i]]}}function Fh(a){switch(a){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",a]}}function Va(a){return["!",a]}function Yl(a){let i=typeof a;if(i==="number"||i==="boolean"||i==="string"||a==null)return JSON.stringify(a);if(Array.isArray(a)){let f="[";for(let _ of a)f+=`${Yl(_)},`;return`${f}]`}let o=Object.keys(a).sort(),u="{";for(let f=0;f<o.length;f++)u+=`${JSON.stringify(o[f])}:${Yl(a[o[f]])},`;return`${u}}`}function zh(a){let i="";for(let o of Z)i+=`/${Yl(a[o])}`;return i}function Kl(a){let i=a.value;return i?[new pe(a.key,i,"constants have been deprecated as of v8")]:[]}function fi(a){return a instanceof Number||a instanceof String||a instanceof Boolean?a.valueOf():a}function ns(a){if(Array.isArray(a))return a.map(ns);if(a instanceof Object&&!(a instanceof Number||a instanceof String||a instanceof Boolean)){let i={};for(let o in a)i[o]=ns(a[o]);return i}return fi(a)}function yn(a){let i=a.key,o=a.value,u=a.valueSpec||{},f=a.objectElementValidators||{},_=a.style,y=a.styleSpec,w=a.validateSpec,C=[],I=Nt(o);if(I!=="object")return[new pe(i,o,`object expected, ${I} found`)];for(let L in o){let k=L.split(".")[0],B=u[k]||u["*"],N;if(f[k])N=f[k];else if(u[k])N=w;else if(f["*"])N=f["*"];else{if(!u["*"]){C.push(new pe(i,o[L],`unknown property "${L}"`));continue}N=w}C=C.concat(N({key:(i&&`${i}.`)+L,value:o[L],valueSpec:B,style:_,styleSpec:y,object:o,objectKey:L,validateSpec:w},o))}for(let L in u)f[L]||u[L].required&&u[L].default===void 0&&o[L]===void 0&&C.push(new pe(i,o,`missing required property "${L}"`));return C}function Oh(a){let i=a.value,o=a.valueSpec,u=a.style,f=a.styleSpec,_=a.key,y=a.arrayElementValidator||a.validateSpec;if(Nt(i)!=="array")return[new pe(_,i,`array expected, ${Nt(i)} found`)];if(o.length&&i.length!==o.length)return[new pe(_,i,`array length ${o.length} expected, length ${i.length} found`)];if(o["min-length"]&&i.length<o["min-length"])return[new pe(_,i,`array length at least ${o["min-length"]} expected, length ${i.length} found`)];let w={type:o.value,values:o.values};f.$version<7&&(w.function=o.function),Nt(o.value)==="object"&&(w=o.value);let C=[];for(let I=0;I<i.length;I++)C=C.concat(y({array:i,arrayIndex:I,value:i[I],valueSpec:w,validateSpec:a.validateSpec,style:u,styleSpec:f,key:`${_}[${I}]`}));return C}function Bh(a){let i=a.key,o=a.value,u=a.valueSpec,f=Nt(o);return f==="number"&&o!=o&&(f="NaN"),f!=="number"?[new pe(i,o,`number expected, ${f} found`)]:"minimum"in u&&o<u.minimum?[new pe(i,o,`${o} is less than the minimum value ${u.minimum}`)]:"maximum"in u&&o>u.maximum?[new pe(i,o,`${o} is greater than the maximum value ${u.maximum}`)]:[]}function rp(a){let i=a.valueSpec,o=fi(a.value.type),u,f,_,y={},w=o!=="categorical"&&a.value.property===void 0,C=!w,I=Nt(a.value.stops)==="array"&&Nt(a.value.stops[0])==="array"&&Nt(a.value.stops[0][0])==="object",L=yn({key:a.key,value:a.value,valueSpec:a.styleSpec.function,validateSpec:a.validateSpec,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{stops:function(N){if(o==="identity")return[new pe(N.key,N.value,'identity function may not have a "stops" property')];let G=[],U=N.value;return G=G.concat(Oh({key:N.key,value:U,valueSpec:N.valueSpec,validateSpec:N.validateSpec,style:N.style,styleSpec:N.styleSpec,arrayElementValidator:k})),Nt(U)==="array"&&U.length===0&&G.push(new pe(N.key,U,"array must have at least one stop")),G},default:function(N){return N.validateSpec({key:N.key,value:N.value,valueSpec:i,validateSpec:N.validateSpec,style:N.style,styleSpec:N.styleSpec})}}});return o==="identity"&&w&&L.push(new pe(a.key,a.value,'missing required property "property"')),o==="identity"||a.value.stops||L.push(new pe(a.key,a.value,'missing required property "stops"')),o==="exponential"&&a.valueSpec.expression&&!Ch(a.valueSpec)&&L.push(new pe(a.key,a.value,"exponential functions not supported")),a.styleSpec.$version>=8&&(C&&!Yo(a.valueSpec)?L.push(new pe(a.key,a.value,"property functions not supported")):w&&!Qd(a.valueSpec)&&L.push(new pe(a.key,a.value,"zoom functions not supported"))),o!=="categorical"&&!I||a.value.property!==void 0||L.push(new pe(a.key,a.value,'"property" property is required')),L;function k(N){let G=[],U=N.value,Y=N.key;if(Nt(U)!=="array")return[new pe(Y,U,`array expected, ${Nt(U)} found`)];if(U.length!==2)return[new pe(Y,U,`array length 2 expected, length ${U.length} found`)];if(I){if(Nt(U[0])!=="object")return[new pe(Y,U,`object expected, ${Nt(U[0])} found`)];if(U[0].zoom===void 0)return[new pe(Y,U,"object stop key must have zoom")];if(U[0].value===void 0)return[new pe(Y,U,"object stop key must have value")];if(_&&_>fi(U[0].zoom))return[new pe(Y,U[0].zoom,"stop zoom values must appear in ascending order")];fi(U[0].zoom)!==_&&(_=fi(U[0].zoom),f=void 0,y={}),G=G.concat(yn({key:`${Y}[0]`,value:U[0],valueSpec:{zoom:{}},validateSpec:N.validateSpec,style:N.style,styleSpec:N.styleSpec,objectElementValidators:{zoom:Bh,value:B}}))}else G=G.concat(B({key:`${Y}[0]`,value:U[0],valueSpec:{},validateSpec:N.validateSpec,style:N.style,styleSpec:N.styleSpec},U));return Ga(ns(U[1]))?G.concat([new pe(`${Y}[1]`,U[1],"expressions are not allowed in function stops.")]):G.concat(N.validateSpec({key:`${Y}[1]`,value:U[1],valueSpec:i,validateSpec:N.validateSpec,style:N.style,styleSpec:N.styleSpec}))}function B(N,G){let U=Nt(N.value),Y=fi(N.value),te=N.value!==null?N.value:G;if(u){if(U!==u)return[new pe(N.key,te,`${U} stop domain type must match previous stop domain type ${u}`)]}else u=U;if(U!=="number"&&U!=="string"&&U!=="boolean")return[new pe(N.key,te,"stop domain value must be a number, string, or boolean")];if(U!=="number"&&o!=="categorical"){let de=`number expected, ${U} found`;return Yo(i)&&o===void 0&&(de+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new pe(N.key,te,de)]}return o!=="categorical"||U!=="number"||isFinite(Y)&&Math.floor(Y)===Y?o!=="categorical"&&U==="number"&&f!==void 0&&Y<f?[new pe(N.key,te,"stop domain values must appear in ascending order")]:(f=Y,o==="categorical"&&Y in y?[new pe(N.key,te,"stop domain values must be unique")]:(y[Y]=!0,[])):[new pe(N.key,te,`integer expected, found ${Y}`)]}}function Jo(a){let i=(a.expressionContext==="property"?Ph:Wl)(ns(a.value),a.valueSpec);if(i.result==="error")return i.value.map(u=>new pe(`${a.key}${u.key}`,a.value,u.message));let o=i.value.expression||i.value._styleExpression.expression;if(a.expressionContext==="property"&&a.propertyKey==="text-font"&&!o.outputDefined())return[new pe(a.key,a.value,`Invalid data expression for "${a.propertyKey}". Output values must be contained as literals within the expression.`)];if(a.expressionContext==="property"&&a.propertyType==="layout"&&!ja(o))return[new pe(a.key,a.value,'"feature-state" data expressions are not supported with layout properties.')];if(a.expressionContext==="filter"&&!ja(o))return[new pe(a.key,a.value,'"feature-state" data expressions are not supported with filters.')];if(a.expressionContext&&a.expressionContext.indexOf("cluster")===0){if(!Zl(o,["zoom","feature-state"]))return[new pe(a.key,a.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(a.expressionContext==="cluster-initial"&&!Ul(o))return[new pe(a.key,a.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ua(a){let i=a.key,o=a.value,u=a.valueSpec,f=[];return Array.isArray(u.values)?u.values.indexOf(fi(o))===-1&&f.push(new pe(i,o,`expected one of [${u.values.join(", ")}], ${JSON.stringify(o)} found`)):Object.keys(u.values).indexOf(fi(o))===-1&&f.push(new pe(i,o,`expected one of [${Object.keys(u.values).join(", ")}], ${JSON.stringify(o)} found`)),f}function Jl(a){return Rh(ns(a.value))?Jo(Xe({},a,{expressionContext:"filter",valueSpec:{value:"boolean"}})):jh(a)}function jh(a){let i=a.value,o=a.key;if(Nt(i)!=="array")return[new pe(o,i,`array expected, ${Nt(i)} found`)];let u=a.styleSpec,f,_=[];if(i.length<1)return[new pe(o,i,"filter array must have at least 1 element")];switch(_=_.concat(Ua({key:`${o}[0]`,value:i[0],valueSpec:u.filter_operator,style:a.style,styleSpec:a.styleSpec})),fi(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&fi(i[1])==="$type"&&_.push(new pe(o,i,`"$type" cannot be use with operator "${i[0]}"`));case"==":case"!=":i.length!==3&&_.push(new pe(o,i,`filter array for operator "${i[0]}" must have 3 elements`));case"in":case"!in":i.length>=2&&(f=Nt(i[1]),f!=="string"&&_.push(new pe(`${o}[1]`,i[1],`string expected, ${f} found`)));for(let y=2;y<i.length;y++)f=Nt(i[y]),fi(i[1])==="$type"?_=_.concat(Ua({key:`${o}[${y}]`,value:i[y],valueSpec:u.geometry_type,style:a.style,styleSpec:a.styleSpec})):f!=="string"&&f!=="number"&&f!=="boolean"&&_.push(new pe(`${o}[${y}]`,i[y],`string, number, or boolean expected, ${f} found`));break;case"any":case"all":case"none":for(let y=1;y<i.length;y++)_=_.concat(jh({key:`${o}[${y}]`,value:i[y],style:a.style,styleSpec:a.styleSpec}));break;case"has":case"!has":f=Nt(i[1]),i.length!==2?_.push(new pe(o,i,`filter array for "${i[0]}" operator must have 2 elements`)):f!=="string"&&_.push(new pe(`${o}[1]`,i[1],`string expected, ${f} found`))}return _}function Za(a,i){let o=a.key,u=a.validateSpec,f=a.style,_=a.styleSpec,y=a.value,w=a.objectKey,C=_[`${i}_${a.layerType}`];if(!C)return[];let I=w.match(/^(.*)-transition$/);if(i==="paint"&&I&&C[I[1]]&&C[I[1]].transition)return u({key:o,value:y,valueSpec:_.transition,style:f,styleSpec:_});let L=a.valueSpec||C[w];if(!L)return[new pe(o,y,`unknown property "${w}"`)];let k;if(Nt(y)==="string"&&Yo(L)&&!L.tokens&&(k=/^{([^}]+)}$/.exec(y)))return[new pe(o,y,`"${w}" does not support interpolation syntax
2
2
  Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(k[1])} }\`.`)];let B=[];return a.layerType==="symbol"&&(w==="text-field"&&f&&!f.glyphs&&B.push(new pe(o,y,'use of "text-field" requires a style "glyphs" property')),w==="text-font"&&ql(ns(y))&&fi(y.type)==="identity"&&B.push(new pe(o,y,'"text-font" does not support identity functions'))),B.concat(u({key:a.key,value:y,valueSpec:L,style:f,styleSpec:_,expressionContext:"property",propertyType:i,propertyKey:w}))}function np(a){return Za(a,"paint")}function Nh(a){return Za(a,"layout")}function Gh(a){let i=[],o=a.value,u=a.key,f=a.style,_=a.styleSpec;o.type||o.ref||i.push(new pe(u,o,'either "type" or "ref" is required'));let y=fi(o.type),w=fi(o.ref);if(o.id){let C=fi(o.id);for(let I=0;I<a.arrayIndex;I++){let L=f.layers[I];fi(L.id)===C&&i.push(new pe(u,o.id,`duplicate layer id "${o.id}", previously used at line ${L.id.__line__}`))}}if("ref"in o){let C;["type","source","source-layer","filter","layout"].forEach(I=>{I in o&&i.push(new pe(u,o[I],`"${I}" is prohibited for ref layers`))}),f.layers.forEach(I=>{fi(I.id)===w&&(C=I)}),C?C.ref?i.push(new pe(u,o.ref,"ref cannot reference another ref layer")):y=fi(C.type):i.push(new pe(u,o.ref,`ref layer "${w}" not found`))}else if(y!=="background")if(o.source){let C=f.sources&&f.sources[o.source],I=C&&fi(C.type);C?I==="vector"&&y==="raster"?i.push(new pe(u,o.source,`layer "${o.id}" requires a raster source`)):I!=="raster-dem"&&y==="hillshade"?i.push(new pe(u,o.source,`layer "${o.id}" requires a raster-dem source`)):I==="raster"&&y!=="raster"?i.push(new pe(u,o.source,`layer "${o.id}" requires a vector source`)):I!=="vector"||o["source-layer"]?I==="raster-dem"&&y!=="hillshade"?i.push(new pe(u,o.source,"raster-dem source can only be used with layer type 'hillshade'.")):y!=="line"||!o.paint||!o.paint["line-gradient"]||I==="geojson"&&C.lineMetrics||i.push(new pe(u,o,`layer "${o.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):i.push(new pe(u,o,`layer "${o.id}" must specify a "source-layer"`)):i.push(new pe(u,o.source,`source "${o.source}" not found`))}else i.push(new pe(u,o,'missing required property "source"'));return i=i.concat(yn({key:u,value:o,valueSpec:_.layer,style:a.style,styleSpec:a.styleSpec,validateSpec:a.validateSpec,objectElementValidators:{"*":()=>[],type:()=>a.validateSpec({key:`${u}.type`,value:o.type,valueSpec:_.layer.type,style:a.style,styleSpec:a.styleSpec,validateSpec:a.validateSpec,object:o,objectKey:"type"}),filter:Jl,layout:C=>yn({layer:o,key:C.key,value:C.value,style:C.style,styleSpec:C.styleSpec,validateSpec:C.validateSpec,objectElementValidators:{"*":I=>Nh(Xe({layerType:y},I))}}),paint:C=>yn({layer:o,key:C.key,value:C.value,style:C.style,styleSpec:C.styleSpec,validateSpec:C.validateSpec,objectElementValidators:{"*":I=>np(Xe({layerType:y},I))}})}})),i}function go(a){let i=a.value,o=a.key,u=Nt(i);return u!=="string"?[new pe(o,i,`string expected, ${u} found`)]:[]}let Vh={promoteId:function({key:a,value:i}){if(Nt(i)==="string")return go({key:a,value:i});{let o=[];for(let u in i)o.push(...go({key:`${a}.${u}`,value:i[u]}));return o}}};function Uh(a){let i=a.value,o=a.key,u=a.styleSpec,f=a.style,_=a.validateSpec;if(!i.type)return[new pe(o,i,'"type" is required')];let y=fi(i.type),w;switch(y){case"vector":case"raster":return w=yn({key:o,value:i,valueSpec:u[`source_${y.replace("-","_")}`],style:a.style,styleSpec:u,objectElementValidators:Vh,validateSpec:_}),w;case"raster-dem":return w=function(C){var I;let L=(I=C.sourceName)!==null&&I!==void 0?I:"",k=C.value,B=C.styleSpec,N=B.source_raster_dem,G=C.style,U=[],Y=Nt(k);if(k===void 0)return U;if(Y!=="object")return U.push(new pe("source_raster_dem",k,`object expected, ${Y} found`)),U;let te=fi(k.encoding)==="custom",de=["redFactor","greenFactor","blueFactor","baseShift"],se=C.value.encoding?`"${C.value.encoding}"`:"Default";for(let j in k)!te&&de.includes(j)?U.push(new pe(j,k[j],`In "${L}": "${j}" is only valid when "encoding" is set to "custom". ${se} encoding found`)):N[j]?U=U.concat(C.validateSpec({key:j,value:k[j],valueSpec:N[j],validateSpec:C.validateSpec,style:G,styleSpec:B})):U.push(new pe(j,k[j],`unknown property "${j}"`));return U}({sourceName:o,value:i,style:a.style,styleSpec:u,validateSpec:_}),w;case"geojson":if(w=yn({key:o,value:i,valueSpec:u.source_geojson,style:f,styleSpec:u,validateSpec:_,objectElementValidators:Vh}),i.cluster)for(let C in i.clusterProperties){let[I,L]=i.clusterProperties[C],k=typeof I=="string"?[I,["accumulated"],["get",C]]:I;w.push(...Jo({key:`${o}.${C}.map`,value:L,validateSpec:_,expressionContext:"cluster-map"})),w.push(...Jo({key:`${o}.${C}.reduce`,value:k,validateSpec:_,expressionContext:"cluster-reduce"}))}return w;case"video":return yn({key:o,value:i,valueSpec:u.source_video,style:f,validateSpec:_,styleSpec:u});case"image":return yn({key:o,value:i,valueSpec:u.source_image,style:f,validateSpec:_,styleSpec:u});case"canvas":return[new pe(o,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ua({key:`${o}.type`,value:i.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:f,validateSpec:_,styleSpec:u})}}function Qo(a){let i=a.value,o=a.styleSpec,u=o.light,f=a.style,_=[],y=Nt(i);if(i===void 0)return _;if(y!=="object")return _=_.concat([new pe("light",i,`object expected, ${y} found`)]),_;for(let w in i){let C=w.match(/^(.*)-transition$/);_=_.concat(C&&u[C[1]]&&u[C[1]].transition?a.validateSpec({key:w,value:i[w],valueSpec:o.transition,validateSpec:a.validateSpec,style:f,styleSpec:o}):u[w]?a.validateSpec({key:w,value:i[w],valueSpec:u[w],validateSpec:a.validateSpec,style:f,styleSpec:o}):[new pe(w,i[w],`unknown property "${w}"`)])}return _}function sp(a){let i=a.value,o=a.styleSpec,u=o.sky,f=a.style,_=Nt(i);if(i===void 0)return[];if(_!=="object")return[new pe("sky",i,`object expected, ${_} found`)];let y=[];for(let w in i)y=y.concat(u[w]?a.validateSpec({key:w,value:i[w],valueSpec:u[w],style:f,styleSpec:o}):[new pe(w,i[w],`unknown property "${w}"`)]);return y}function op(a){let i=a.value,o=a.styleSpec,u=o.terrain,f=a.style,_=[],y=Nt(i);if(i===void 0)return _;if(y!=="object")return _=_.concat([new pe("terrain",i,`object expected, ${y} found`)]),_;for(let w in i)_=_.concat(u[w]?a.validateSpec({key:w,value:i[w],valueSpec:u[w],validateSpec:a.validateSpec,style:f,styleSpec:o}):[new pe(w,i[w],`unknown property "${w}"`)]);return _}function ap(a){let i=[],o=a.value,u=a.key;if(Array.isArray(o)){let f=[],_=[];for(let y in o)o[y].id&&f.includes(o[y].id)&&i.push(new pe(u,o,`all the sprites' ids must be unique, but ${o[y].id} is duplicated`)),f.push(o[y].id),o[y].url&&_.includes(o[y].url)&&i.push(new pe(u,o,`all the sprites' URLs must be unique, but ${o[y].url} is duplicated`)),_.push(o[y].url),i=i.concat(yn({key:`${u}[${y}]`,value:o[y],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:a.validateSpec}));return i}return go({key:u,value:o})}let lp={"*":()=>[],array:Oh,boolean:function(a){let i=a.value,o=a.key,u=Nt(i);return u!=="boolean"?[new pe(o,i,`boolean expected, ${u} found`)]:[]},number:Bh,color:function(a){let i=a.key,o=a.value,u=Nt(o);return u!=="string"?[new pe(i,o,`color expected, ${u} found`)]:Lt.parse(String(o))?[]:[new pe(i,o,`color expected, "${o}" found`)]},constants:Kl,enum:Ua,filter:Jl,function:rp,layer:Gh,object:yn,source:Uh,light:Qo,sky:sp,terrain:op,projection:function(a){let i=a.value,o=a.styleSpec,u=o.projection,f=a.style,_=Nt(i);if(i===void 0)return[];if(_!=="object")return[new pe("projection",i,`object expected, ${_} found`)];let y=[];for(let w in i)y=y.concat(u[w]?a.validateSpec({key:w,value:i[w],valueSpec:u[w],style:f,styleSpec:o}):[new pe(w,i[w],`unknown property "${w}"`)]);return y},projectionDefinition:function(a){let i=a.key,o=a.value;o=o instanceof String?o.valueOf():o;let u=Nt(o);return u!=="array"||function(f){return Array.isArray(f)&&f.length===3&&typeof f[0]=="string"&&typeof f[1]=="string"&&typeof f[2]=="number"}(o)||function(f){return!!["interpolate","step","literal"].includes(f[0])}(o)?["array","string"].includes(u)?[]:[new pe(i,o,`projection expected, invalid type "${u}" found`)]:[new pe(i,o,`projection expected, invalid array ${JSON.stringify(o)} found`)]},string:go,formatted:function(a){return go(a).length===0?[]:Jo(a)},resolvedImage:function(a){return go(a).length===0?[]:Jo(a)},padding:function(a){let i=a.key,o=a.value;if(Nt(o)==="array"){if(o.length<1||o.length>4)return[new pe(i,o,`padding requires 1 to 4 values; ${o.length} values found`)];let u={type:"number"},f=[];for(let _=0;_<o.length;_++)f=f.concat(a.validateSpec({key:`${i}[${_}]`,value:o[_],validateSpec:a.validateSpec,valueSpec:u}));return f}return Bh({key:i,value:o,valueSpec:{}})},variableAnchorOffsetCollection:function(a){let i=a.key,o=a.value,u=Nt(o),f=a.styleSpec;if(u!=="array"||o.length<1||o.length%2!=0)return[new pe(i,o,"variableAnchorOffsetCollection requires a non-empty array of even length")];let _=[];for(let y=0;y<o.length;y+=2)_=_.concat(Ua({key:`${i}[${y}]`,value:o[y],valueSpec:f.layout_symbol["text-anchor"]})),_=_.concat(Oh({key:`${i}[${y+1}]`,value:o[y+1],valueSpec:{length:2,value:"number"},validateSpec:a.validateSpec,style:a.style,styleSpec:f}));return _},sprite:ap};function qa(a){let i=a.value,o=a.valueSpec,u=a.styleSpec;return a.validateSpec=qa,o.expression&&ql(fi(i))?rp(a):o.expression&&Ga(ns(i))?Jo(a):o.type&&lp[o.type]?lp[o.type](a):yn(Xe({},a,{valueSpec:o.type?u[o.type]:o}))}function cp(a){let i=a.value,o=a.key,u=go(a);return u.length||(i.indexOf("{fontstack}")===-1&&u.push(new pe(o,i,'"glyphs" url must include a "{fontstack}" token')),i.indexOf("{range}")===-1&&u.push(new pe(o,i,'"glyphs" url must include a "{range}" token'))),u}function Mr(a,i=K){let o=[];return o=o.concat(qa({key:"",value:a,valueSpec:i.$root,styleSpec:i,style:a,validateSpec:qa,objectElementValidators:{glyphs:cp,"*":()=>[]}})),a.constants&&(o=o.concat(Kl({key:"constants",value:a.constants,style:a,styleSpec:i,validateSpec:qa}))),Zr(o)}function Ur(a){return function(i){return a({...i,validateSpec:qa})}}function Zr(a){return[].concat(a).sort((i,o)=>i.line-o.line)}function qr(a){return function(...i){return Zr(a.apply(this,i))}}Mr.source=qr(Ur(Uh)),Mr.sprite=qr(Ur(ap)),Mr.glyphs=qr(Ur(cp)),Mr.light=qr(Ur(Qo)),Mr.sky=qr(Ur(sp)),Mr.terrain=qr(Ur(op)),Mr.layer=qr(Ur(Gh)),Mr.filter=qr(Ur(Jl)),Mr.paintProperty=qr(Ur(np)),Mr.layoutProperty=qr(Ur(Nh));let _o=Mr,xm=_o.light,vm=_o.sky,Wa=_o.paintProperty,hp=_o.layoutProperty;function Ql(a,i){let o=!1;if(i&&i.length)for(let u of i)a.fire(new Os(new Error(u.message))),o=!0;return o}class $a{constructor(i,o,u){let f=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;let y=new Int32Array(this.arrayBuffer);i=y[0],this.d=(o=y[1])+2*(u=y[2]);for(let C=0;C<this.d*this.d;C++){let I=y[3+C],L=y[3+C+1];f.push(I===L?null:y.subarray(I,L))}let w=y[3+f.length+1];this.keys=y.subarray(y[3+f.length],w),this.bboxes=y.subarray(w),this.insert=this._insertReadonly}else{this.d=o+2*u;for(let y=0;y<this.d*this.d;y++)f.push([]);this.keys=[],this.bboxes=[]}this.n=o,this.extent=i,this.padding=u,this.scale=o/i,this.uid=0;let _=u/o*i;this.min=-_,this.max=i+_}insert(i,o,u,f,_){this._forEachCell(o,u,f,_,this._insertCell,this.uid++,void 0,void 0),this.keys.push(i),this.bboxes.push(o),this.bboxes.push(u),this.bboxes.push(f),this.bboxes.push(_)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(i,o,u,f,_,y){this.cells[_].push(y)}query(i,o,u,f,_){let y=this.min,w=this.max;if(i<=y&&o<=y&&w<=u&&w<=f&&!_)return Array.prototype.slice.call(this.keys);{let C=[];return this._forEachCell(i,o,u,f,this._queryCell,C,{},_),C}}_queryCell(i,o,u,f,_,y,w,C){let I=this.cells[_];if(I!==null){let L=this.keys,k=this.bboxes;for(let B=0;B<I.length;B++){let N=I[B];if(w[N]===void 0){let G=4*N;(C?C(k[G+0],k[G+1],k[G+2],k[G+3]):i<=k[G+2]&&o<=k[G+3]&&u>=k[G+0]&&f>=k[G+1])?(w[N]=!0,y.push(L[N])):w[N]=!1}}}}_forEachCell(i,o,u,f,_,y,w,C){let I=this._convertToCellCoord(i),L=this._convertToCellCoord(o),k=this._convertToCellCoord(u),B=this._convertToCellCoord(f);for(let N=I;N<=k;N++)for(let G=L;G<=B;G++){let U=this.d*G+N;if((!C||C(this._convertFromCellCoord(N),this._convertFromCellCoord(G),this._convertFromCellCoord(N+1),this._convertFromCellCoord(G+1)))&&_.call(this,i,o,u,f,U,y,w,C))return}}_convertFromCellCoord(i){return(i-this.padding)/this.scale}_convertToCellCoord(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let i=this.cells,o=3+this.cells.length+1+1,u=0;for(let y=0;y<this.cells.length;y++)u+=this.cells[y].length;let f=new Int32Array(o+u+this.keys.length+this.bboxes.length);f[0]=this.extent,f[1]=this.n,f[2]=this.padding;let _=o;for(let y=0;y<i.length;y++){let w=i[y];f[3+y]=_,f.set(w,_),_+=w.length}return f[3+i.length]=_,f.set(this.keys,_),_+=this.keys.length,f[3+i.length+1]=_,f.set(this.bboxes,_),_+=this.bboxes.length,f.buffer}static serialize(i,o){let u=i.toArrayBuffer();return o&&o.push(u),{buffer:u}}static deserialize(i){return new $a(i.buffer)}}let Nn={};function it(a,i,o={}){if(Nn[a])throw new Error(`${a} is already registered.`);Object.defineProperty(i,"_classRegistryKey",{value:a,writeable:!1}),Nn[a]={klass:i,omit:o.omit||[],shallow:o.shallow||[]}}it("Object",Object),it("TransferableGridIndex",$a),it("Color",Lt),it("Error",Error),it("AJAXError",Nr),it("ResolvedImage",Gr),it("StylePropertyFunction",$l),it("StyleExpression",Ih,{omit:["_evaluator"]}),it("ZoomDependentExpression",Ko),it("ZoomConstantExpression",Eh),it("CompoundExpression",_n,{omit:["_evaluate"]});for(let a in Xo)Xo[a]._classRegistryKey||it(`Expression_${a}`,Xo[a]);function ea(a){return a&&typeof ArrayBuffer<"u"&&(a instanceof ArrayBuffer||a.constructor&&a.constructor.name==="ArrayBuffer")}function Zh(a){return a.$name||a.constructor._classRegistryKey}function ta(a){return!function(i){if(i===null||typeof i!="object")return!1;let o=Zh(i);return!(!o||o==="Object")}(a)&&(a==null||typeof a=="boolean"||typeof a=="number"||typeof a=="string"||a instanceof Boolean||a instanceof Number||a instanceof String||a instanceof Date||a instanceof RegExp||a instanceof Blob||a instanceof Error||ea(a)||gn(a)||ArrayBuffer.isView(a)||a instanceof ImageData)}function Xa(a,i){if(ta(a))return(ea(a)||gn(a))&&i&&i.push(a),ArrayBuffer.isView(a)&&i&&i.push(a.buffer),a instanceof ImageData&&i&&i.push(a.data.buffer),a;if(Array.isArray(a)){let _=[];for(let y of a)_.push(Xa(y,i));return _}if(typeof a!="object")throw new Error("can't serialize object of type "+typeof a);let o=Zh(a);if(!o)throw new Error(`can't serialize object of unregistered class ${a.constructor.name}`);if(!Nn[o])throw new Error(`${o} is not registered.`);let{klass:u}=Nn[o],f=u.serialize?u.serialize(a,i):{};if(u.serialize){if(i&&f===i[i.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let _ in a){if(!a.hasOwnProperty(_)||Nn[o].omit.indexOf(_)>=0)continue;let y=a[_];f[_]=Nn[o].shallow.indexOf(_)>=0?y:Xa(y,i)}a instanceof Error&&(f.message=a.message)}if(f.$name)throw new Error("$name property is reserved for worker serialization logic.");return o!=="Object"&&(f.$name=o),f}function Ha(a){if(ta(a))return a;if(Array.isArray(a))return a.map(Ha);if(typeof a!="object")throw new Error("can't deserialize object of type "+typeof a);let i=Zh(a)||"Object";if(!Nn[i])throw new Error(`can't deserialize unregistered class ${i}`);let{klass:o}=Nn[i];if(!o)throw new Error(`can't deserialize unregistered class ${i}`);if(o.deserialize)return o.deserialize(a);let u=Object.create(o.prototype);for(let f of Object.keys(a)){if(f==="$name")continue;let _=a[f];u[f]=Nn[i].shallow.indexOf(f)>=0?_:Ha(_)}return u}class Ya{constructor(){this.first=!0}update(i,o){let u=Math.floor(i);return this.first?(this.first=!1,this.lastIntegerZoom=u,this.lastIntegerZoomTime=0,this.lastZoom=i,this.lastFloorZoom=u,!0):(this.lastFloorZoom>u?(this.lastIntegerZoom=u+1,this.lastIntegerZoomTime=o):this.lastFloorZoom<u&&(this.lastIntegerZoom=u,this.lastIntegerZoomTime=o),i!==this.lastZoom&&(this.lastZoom=i,this.lastFloorZoom=u,!0))}}let zt={"Latin-1 Supplement":a=>a>=128&&a<=255,"Hangul Jamo":a=>a>=4352&&a<=4607,Khmer:a=>a>=6016&&a<=6143,"General Punctuation":a=>a>=8192&&a<=8303,"Letterlike Symbols":a=>a>=8448&&a<=8527,"Number Forms":a=>a>=8528&&a<=8591,"Miscellaneous Technical":a=>a>=8960&&a<=9215,"Control Pictures":a=>a>=9216&&a<=9279,"Optical Character Recognition":a=>a>=9280&&a<=9311,"Enclosed Alphanumerics":a=>a>=9312&&a<=9471,"Geometric Shapes":a=>a>=9632&&a<=9727,"Miscellaneous Symbols":a=>a>=9728&&a<=9983,"Miscellaneous Symbols and Arrows":a=>a>=11008&&a<=11263,"Ideographic Description Characters":a=>a>=12272&&a<=12287,"CJK Symbols and Punctuation":a=>a>=12288&&a<=12351,Katakana:a=>a>=12448&&a<=12543,Kanbun:a=>a>=12688&&a<=12703,"CJK Strokes":a=>a>=12736&&a<=12783,"Enclosed CJK Letters and Months":a=>a>=12800&&a<=13055,"CJK Compatibility":a=>a>=13056&&a<=13311,"Yijing Hexagram Symbols":a=>a>=19904&&a<=19967,"Private Use Area":a=>a>=57344&&a<=63743,"Vertical Forms":a=>a>=65040&&a<=65055,"CJK Compatibility Forms":a=>a>=65072&&a<=65103,"Small Form Variants":a=>a>=65104&&a<=65135,"Halfwidth and Fullwidth Forms":a=>a>=65280&&a<=65519};function Ka(a){for(let i of a)if(Ja(i.charCodeAt(0)))return!0;return!1}function ec(a){for(let i of a)if(!dp(i.charCodeAt(0)))return!1;return!0}function tc(a){let i=a.map(o=>{try{return new RegExp(`\\p{sc=${o}}`,"u").source}catch{return null}}).filter(o=>o);return new RegExp(i.join("|"),"u")}let up=tc(["Arab","Dupl","Mong","Ougr","Syrc"]);function dp(a){return!up.test(String.fromCodePoint(a))}let qh=tc(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Ja(a){return!(a!==746&&a!==747&&(a<4352||!(zt["CJK Compatibility Forms"](a)&&!(a>=65097&&a<=65103)||zt["CJK Compatibility"](a)||zt["CJK Strokes"](a)||!(!zt["CJK Symbols and Punctuation"](a)||a>=12296&&a<=12305||a>=12308&&a<=12319||a===12336)||zt["Enclosed CJK Letters and Months"](a)||zt["Ideographic Description Characters"](a)||zt.Kanbun(a)||zt.Katakana(a)&&a!==12540||!(!zt["Halfwidth and Fullwidth Forms"](a)||a===65288||a===65289||a===65293||a>=65306&&a<=65310||a===65339||a===65341||a===65343||a>=65371&&a<=65503||a===65507||a>=65512&&a<=65519)||!(!zt["Small Form Variants"](a)||a>=65112&&a<=65118||a>=65123&&a<=65126)||zt["Vertical Forms"](a)||zt["Yijing Hexagram Symbols"](a)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(a))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(a))||qh.test(String.fromCodePoint(a)))))}function Wh(a){return!(Ja(a)||function(i){return!!(zt["Latin-1 Supplement"](i)&&(i===167||i===169||i===174||i===177||i===188||i===189||i===190||i===215||i===247)||zt["General Punctuation"](i)&&(i===8214||i===8224||i===8225||i===8240||i===8241||i===8251||i===8252||i===8258||i===8263||i===8264||i===8265||i===8273)||zt["Letterlike Symbols"](i)||zt["Number Forms"](i)||zt["Miscellaneous Technical"](i)&&(i>=8960&&i<=8967||i>=8972&&i<=8991||i>=8996&&i<=9e3||i===9003||i>=9085&&i<=9114||i>=9150&&i<=9165||i===9167||i>=9169&&i<=9179||i>=9186&&i<=9215)||zt["Control Pictures"](i)&&i!==9251||zt["Optical Character Recognition"](i)||zt["Enclosed Alphanumerics"](i)||zt["Geometric Shapes"](i)||zt["Miscellaneous Symbols"](i)&&!(i>=9754&&i<=9759)||zt["Miscellaneous Symbols and Arrows"](i)&&(i>=11026&&i<=11055||i>=11088&&i<=11097||i>=11192&&i<=11243)||zt["CJK Symbols and Punctuation"](i)||zt.Katakana(i)||zt["Private Use Area"](i)||zt["CJK Compatibility Forms"](i)||zt["Small Form Variants"](i)||zt["Halfwidth and Fullwidth Forms"](i)||i===8734||i===8756||i===8757||i>=9984&&i<=10087||i>=10102&&i<=10131||i===65532||i===65533)}(a))}let bm=tc(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function $h(a){return bm.test(String.fromCodePoint(a))}function wm(a,i){return!(!i&&$h(a)||a>=2304&&a<=3583||a>=3840&&a<=4255||zt.Khmer(a))}function pp(a){for(let i of a)if($h(i.charCodeAt(0)))return!0;return!1}let ys=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(a){this.pluginStatus=a.pluginStatus,this.pluginURL=a.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(a){if(ys.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=a.applyArabicShaping,this.processBidirectionalText=a.processBidirectionalText,this.processStyledBidirectionalText=a.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(a,i){return n(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(a.pluginStatus!=="loading")return this.setState(a),a;let o=a.pluginURL,u=new Promise(_=>{this.loadScriptResolve=_});i(o);let f=new Promise(_=>setTimeout(()=>_(),this.TIMEOUT));if(yield Promise.race([u,f]),this.isParsed()){let _={pluginStatus:"loaded",pluginURL:o};return this.setState(_),_}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${o}`)})}};class ii{constructor(i,o){this.zoom=i,o?(this.now=o.now,this.fadeDuration=o.fadeDuration,this.zoomHistory=o.zoomHistory,this.transition=o.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ya,this.transition={})}isSupportedScript(i){return function(o,u){for(let f of o)if(!wm(f.charCodeAt(0),u))return!1;return!0}(i,ys.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let i=this.zoom,o=i-Math.floor(i),u=this.crossFadingFactor();return i>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:o+(1-o)*u}:{fromScale:.5,toScale:1,t:1-(1-u)*o}}}class ic{constructor(i,o){this.property=i,this.value=o,this.expression=function(u,f){if(ql(u))return new $l(u,f);if(Ga(u)){let _=Ph(u,f);if(_.result==="error")throw new Error(_.value.map(y=>`${y.key}: ${y.message}`).join(", "));return _.value}{let _=u;return f.type==="color"&&typeof u=="string"?_=Lt.parse(u):f.type!=="padding"||typeof u!="number"&&!Array.isArray(u)?f.type==="variableAnchorOffsetCollection"&&Array.isArray(u)?_=ur.parse(u):f.type==="projectionDefinition"&&typeof u=="string"&&(_=tr.parse(u)):_=pi.parse(u),{kind:"constant",evaluate:()=>_}}}(o===void 0?i.specification.default:o,i.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(i,o,u){return this.property.possiblyEvaluate(this,i,o,u)}}class Xh{constructor(i){this.property=i,this.value=new ic(i,void 0)}transitioned(i,o){return new Yh(this.property,this.value,o,$t({},i.transition,this.transition),i.now)}untransitioned(){return new Yh(this.property,this.value,null,{},0)}}class Hh{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitionablePropertyValues)}getValue(i){return Ci(this._values[i].value.value)}setValue(i,o){Object.prototype.hasOwnProperty.call(this._values,i)||(this._values[i]=new Xh(this._values[i].property)),this._values[i].value=new ic(this._values[i].property,o===null?void 0:Ci(o))}getTransition(i){return Ci(this._values[i].transition)}setTransition(i,o){Object.prototype.hasOwnProperty.call(this._values,i)||(this._values[i]=new Xh(this._values[i].property)),this._values[i].transition=Ci(o)||void 0}serialize(){let i={};for(let o of Object.keys(this._values)){let u=this.getValue(o);u!==void 0&&(i[o]=u);let f=this.getTransition(o);f!==void 0&&(i[`${o}-transition`]=f)}return i}transitioned(i,o){let u=new Kh(this._properties);for(let f of Object.keys(this._values))u._values[f]=this._values[f].transitioned(i,o._values[f]);return u}untransitioned(){let i=new Kh(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].untransitioned();return i}}class Yh{constructor(i,o,u,f,_){this.property=i,this.value=o,this.begin=_+f.delay||0,this.end=this.begin+f.duration||0,i.specification.transition&&(f.delay||f.duration)&&(this.prior=u)}possiblyEvaluate(i,o,u){let f=i.now||0,_=this.value.possiblyEvaluate(i,o,u),y=this.prior;if(y){if(f>this.end)return this.prior=null,_;if(this.value.isDataDriven())return this.prior=null,_;if(f<this.begin)return y.possiblyEvaluate(i,o,u);{let w=(f-this.begin)/(this.end-this.begin);return this.property.interpolate(y.possiblyEvaluate(i,o,u),_,St(w))}}return _}}class Kh{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitioningPropertyValues)}possiblyEvaluate(i,o,u){let f=new rc(this._properties);for(let _ of Object.keys(this._values))f._values[_]=this._values[_].possiblyEvaluate(i,o,u);return f}hasTransition(){for(let i of Object.keys(this._values))if(this._values[i].prior)return!0;return!1}}class fp{constructor(i){this._properties=i,this._values=Object.create(i.defaultPropertyValues)}hasValue(i){return this._values[i].value!==void 0}getValue(i){return Ci(this._values[i].value)}setValue(i,o){this._values[i]=new ic(this._values[i].property,o===null?void 0:Ci(o))}serialize(){let i={};for(let o of Object.keys(this._values)){let u=this.getValue(o);u!==void 0&&(i[o]=u)}return i}possiblyEvaluate(i,o,u){let f=new rc(this._properties);for(let _ of Object.keys(this._values))f._values[_]=this._values[_].possiblyEvaluate(i,o,u);return f}}class hn{constructor(i,o,u){this.property=i,this.value=o,this.parameters=u}isConstant(){return this.value.kind==="constant"}constantOr(i){return this.value.kind==="constant"?this.value.value:i}evaluate(i,o,u,f){return this.property.evaluate(this.value,this.parameters,i,o,u,f)}}class rc{constructor(i){this._properties=i,this._values=Object.create(i.defaultPossiblyEvaluatedValues)}get(i){return this._values[i]}}class lt{constructor(i){this.specification=i}possiblyEvaluate(i,o){if(i.isDataDriven())throw new Error("Value should not be data driven");return i.expression.evaluate(o)}interpolate(i,o,u){let f=cn[this.specification.type];return f?f(i,o,u):i}}class _t{constructor(i,o){this.specification=i,this.overrides=o}possiblyEvaluate(i,o,u,f){return new hn(this,i.expression.kind==="constant"||i.expression.kind==="camera"?{kind:"constant",value:i.expression.evaluate(o,null,{},u,f)}:i.expression,o)}interpolate(i,o,u){if(i.value.kind!=="constant"||o.value.kind!=="constant")return i;if(i.value.value===void 0||o.value.value===void 0)return new hn(this,{kind:"constant",value:void 0},i.parameters);let f=cn[this.specification.type];if(f){let _=f(i.value.value,o.value.value,u);return new hn(this,{kind:"constant",value:_},i.parameters)}return i}evaluate(i,o,u,f,_,y){return i.kind==="constant"?i.value:i.evaluate(o,u,f,_,y)}}class nc extends _t{possiblyEvaluate(i,o,u,f){if(i.value===void 0)return new hn(this,{kind:"constant",value:void 0},o);if(i.expression.kind==="constant"){let _=i.expression.evaluate(o,null,{},u,f),y=i.property.specification.type==="resolvedImage"&&typeof _!="string"?_.name:_,w=this._calculate(y,y,y,o);return new hn(this,{kind:"constant",value:w},o)}if(i.expression.kind==="camera"){let _=this._calculate(i.expression.evaluate({zoom:o.zoom-1}),i.expression.evaluate({zoom:o.zoom}),i.expression.evaluate({zoom:o.zoom+1}),o);return new hn(this,{kind:"constant",value:_},o)}return new hn(this,i.expression,o)}evaluate(i,o,u,f,_,y){if(i.kind==="source"){let w=i.evaluate(o,u,f,_,y);return this._calculate(w,w,w,o)}return i.kind==="composite"?this._calculate(i.evaluate({zoom:Math.floor(o.zoom)-1},u,f),i.evaluate({zoom:Math.floor(o.zoom)},u,f),i.evaluate({zoom:Math.floor(o.zoom)+1},u,f),o):i.value}_calculate(i,o,u,f){return f.zoom>f.zoomHistory.lastIntegerZoom?{from:i,to:o}:{from:u,to:o}}interpolate(i){return i}}class sc{constructor(i){this.specification=i}possiblyEvaluate(i,o,u,f){if(i.value!==void 0){if(i.expression.kind==="constant"){let _=i.expression.evaluate(o,null,{},u,f);return this._calculate(_,_,_,o)}return this._calculate(i.expression.evaluate(new ii(Math.floor(o.zoom-1),o)),i.expression.evaluate(new ii(Math.floor(o.zoom),o)),i.expression.evaluate(new ii(Math.floor(o.zoom+1),o)),o)}}_calculate(i,o,u,f){return f.zoom>f.zoomHistory.lastIntegerZoom?{from:i,to:o}:{from:u,to:o}}interpolate(i){return i}}class oc{constructor(i){this.specification=i}possiblyEvaluate(i,o,u,f){return!!i.expression.evaluate(o,null,{},u,f)}interpolate(){return!1}}class Ir{constructor(i){this.properties=i,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let o in i){let u=i[o];u.specification.overridable&&this.overridableProperties.push(o);let f=this.defaultPropertyValues[o]=new ic(u,void 0),_=this.defaultTransitionablePropertyValues[o]=new Xh(u);this.defaultTransitioningPropertyValues[o]=_.untransitioned(),this.defaultPossiblyEvaluatedValues[o]=f.possiblyEvaluate({})}}}it("DataDrivenProperty",_t),it("DataConstantProperty",lt),it("CrossFadedDataDrivenProperty",nc),it("CrossFadedProperty",sc),it("ColorRampProperty",oc);let mp="-transition";class ss extends On{constructor(i,o){if(super(),this.id=i.id,this.type=i.type,this._featureFilter={filter:()=>!0,needGeometry:!1},i.type!=="custom"&&(this.metadata=i.metadata,this.minzoom=i.minzoom,this.maxzoom=i.maxzoom,i.type!=="background"&&(this.source=i.source,this.sourceLayer=i["source-layer"],this.filter=i.filter),o.layout&&(this._unevaluatedLayout=new fp(o.layout)),o.paint)){this._transitionablePaint=new Hh(o.paint);for(let u in i.paint)this.setPaintProperty(u,i.paint[u],{validate:!1});for(let u in i.layout)this.setLayoutProperty(u,i.layout[u],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new rc(o.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(i){return i==="visibility"?this.visibility:this._unevaluatedLayout.getValue(i)}setLayoutProperty(i,o,u={}){o!=null&&this._validate(hp,`layers.${this.id}.layout.${i}`,i,o,u)||(i!=="visibility"?this._unevaluatedLayout.setValue(i,o):this.visibility=o)}getPaintProperty(i){return i.endsWith(mp)?this._transitionablePaint.getTransition(i.slice(0,-11)):this._transitionablePaint.getValue(i)}setPaintProperty(i,o,u={}){if(o!=null&&this._validate(Wa,`layers.${this.id}.paint.${i}`,i,o,u))return!1;if(i.endsWith(mp))return this._transitionablePaint.setTransition(i.slice(0,-11),o||void 0),!1;{let f=this._transitionablePaint._values[i],_=f.property.specification["property-type"]==="cross-faded-data-driven",y=f.value.isDataDriven(),w=f.value;this._transitionablePaint.setValue(i,o),this._handleSpecialPaintPropertyUpdate(i);let C=this._transitionablePaint._values[i].value;return C.isDataDriven()||y||_||this._handleOverridablePaintPropertyUpdate(i,w,C)}}_handleSpecialPaintPropertyUpdate(i){}_handleOverridablePaintPropertyUpdate(i,o,u){return!1}isHidden(i){return!!(this.minzoom&&i<this.minzoom)||!!(this.maxzoom&&i>=this.maxzoom)||this.visibility==="none"}updateTransitions(i){this._transitioningPaint=this._transitionablePaint.transitioned(i,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(i,o){i.getCrossfadeParameters&&(this._crossfadeParameters=i.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(i,void 0,o)),this.paint=this._transitioningPaint.possiblyEvaluate(i,void 0,o)}serialize(){let i={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(i.layout=i.layout||{},i.layout.visibility=this.visibility),Ai(i,(o,u)=>!(o===void 0||u==="layout"&&!Object.keys(o).length||u==="paint"&&!Object.keys(o).length))}_validate(i,o,u,f,_={}){return(!_||_.validate!==!1)&&Ql(this,i.call(_o,{key:o,layerType:this.type,objectKey:u,value:f,styleSpec:K,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let i in this.paint._values){let o=this.paint.get(i);if(o instanceof hn&&Yo(o.property.specification)&&(o.value.kind==="source"||o.value.kind==="composite")&&o.value.isStateDependent)return!0}return!1}}let Sm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Qa{constructor(i,o){this._structArray=i,this._pos1=o*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class xi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(i,o){return i._trim(),o&&(i.isTransferred=!0,o.push(i.arrayBuffer)),{length:i.length,arrayBuffer:i.arrayBuffer}}static deserialize(i){let o=Object.create(this.prototype);return o.arrayBuffer=i.arrayBuffer,o.length=i.length,o.capacity=i.arrayBuffer.byteLength/o.bytesPerElement,o._refreshViews(),o}_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(i){this.reserve(i),this.length=i}reserve(i){if(i>this.capacity){this.capacity=Math.max(i,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let o=this.uint8;this._refreshViews(),o&&this.uint8.set(o)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ri(a,i=1){let o=0,u=0;return{members:a.map(f=>{let _=Sm[f.type].BYTES_PER_ELEMENT,y=o=gp(o,Math.max(i,_)),w=f.components||1;return u=Math.max(u,_),o+=_*w,{name:f.name,type:f.type,components:w,offset:y}}),size:gp(o,Math.max(u,i)),alignment:i}}function gp(a,i){return Math.ceil(a/i)*i}class el extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,o){let u=this.length;return this.resize(u+1),this.emplace(u,i,o)}emplace(i,o,u){let f=2*i;return this.int16[f+0]=o,this.int16[f+1]=u,i}}el.prototype.bytesPerElement=4,it("StructArrayLayout2i4",el);class ac extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,o,u){let f=this.length;return this.resize(f+1),this.emplace(f,i,o,u)}emplace(i,o,u,f){let _=3*i;return this.int16[_+0]=o,this.int16[_+1]=u,this.int16[_+2]=f,i}}ac.prototype.bytesPerElement=6,it("StructArrayLayout3i6",ac);class lc extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,o,u,f){let _=this.length;return this.resize(_+1),this.emplace(_,i,o,u,f)}emplace(i,o,u,f,_){let y=4*i;return this.int16[y+0]=o,this.int16[y+1]=u,this.int16[y+2]=f,this.int16[y+3]=_,i}}lc.prototype.bytesPerElement=8,it("StructArrayLayout4i8",lc);class Jh extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,o,u,f,_,y){let w=this.length;return this.resize(w+1),this.emplace(w,i,o,u,f,_,y)}emplace(i,o,u,f,_,y,w){let C=6*i;return this.int16[C+0]=o,this.int16[C+1]=u,this.int16[C+2]=f,this.int16[C+3]=_,this.int16[C+4]=y,this.int16[C+5]=w,i}}Jh.prototype.bytesPerElement=12,it("StructArrayLayout2i4i12",Jh);class Qh extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,o,u,f,_,y){let w=this.length;return this.resize(w+1),this.emplace(w,i,o,u,f,_,y)}emplace(i,o,u,f,_,y,w){let C=4*i,I=8*i;return this.int16[C+0]=o,this.int16[C+1]=u,this.uint8[I+4]=f,this.uint8[I+5]=_,this.uint8[I+6]=y,this.uint8[I+7]=w,i}}Qh.prototype.bytesPerElement=8,it("StructArrayLayout2i4ub8",Qh);class Gn extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,o){let u=this.length;return this.resize(u+1),this.emplace(u,i,o)}emplace(i,o,u){let f=2*i;return this.float32[f+0]=o,this.float32[f+1]=u,i}}Gn.prototype.bytesPerElement=8,it("StructArrayLayout2f8",Gn);class cc extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,o,u,f,_,y,w,C,I,L){let k=this.length;return this.resize(k+1),this.emplace(k,i,o,u,f,_,y,w,C,I,L)}emplace(i,o,u,f,_,y,w,C,I,L,k){let B=10*i;return this.uint16[B+0]=o,this.uint16[B+1]=u,this.uint16[B+2]=f,this.uint16[B+3]=_,this.uint16[B+4]=y,this.uint16[B+5]=w,this.uint16[B+6]=C,this.uint16[B+7]=I,this.uint16[B+8]=L,this.uint16[B+9]=k,i}}cc.prototype.bytesPerElement=20,it("StructArrayLayout10ui20",cc);class tl extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,o,u,f,_,y,w,C,I,L,k,B){let N=this.length;return this.resize(N+1),this.emplace(N,i,o,u,f,_,y,w,C,I,L,k,B)}emplace(i,o,u,f,_,y,w,C,I,L,k,B,N){let G=12*i;return this.int16[G+0]=o,this.int16[G+1]=u,this.int16[G+2]=f,this.int16[G+3]=_,this.uint16[G+4]=y,this.uint16[G+5]=w,this.uint16[G+6]=C,this.uint16[G+7]=I,this.int16[G+8]=L,this.int16[G+9]=k,this.int16[G+10]=B,this.int16[G+11]=N,i}}tl.prototype.bytesPerElement=24,it("StructArrayLayout4i4ui4i24",tl);class hc extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,o,u){let f=this.length;return this.resize(f+1),this.emplace(f,i,o,u)}emplace(i,o,u,f){let _=3*i;return this.float32[_+0]=o,this.float32[_+1]=u,this.float32[_+2]=f,i}}hc.prototype.bytesPerElement=12,it("StructArrayLayout3f12",hc);class il extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i){let o=this.length;return this.resize(o+1),this.emplace(o,i)}emplace(i,o){return this.uint32[1*i+0]=o,i}}il.prototype.bytesPerElement=4,it("StructArrayLayout1ul4",il);class eu extends xi{_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(i,o,u,f,_,y,w,C,I){let L=this.length;return this.resize(L+1),this.emplace(L,i,o,u,f,_,y,w,C,I)}emplace(i,o,u,f,_,y,w,C,I,L){let k=10*i,B=5*i;return this.int16[k+0]=o,this.int16[k+1]=u,this.int16[k+2]=f,this.int16[k+3]=_,this.int16[k+4]=y,this.int16[k+5]=w,this.uint32[B+3]=C,this.uint16[k+8]=I,this.uint16[k+9]=L,i}}eu.prototype.bytesPerElement=20,it("StructArrayLayout6i1ul2ui20",eu);class ia extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,o,u,f,_,y){let w=this.length;return this.resize(w+1),this.emplace(w,i,o,u,f,_,y)}emplace(i,o,u,f,_,y,w){let C=6*i;return this.int16[C+0]=o,this.int16[C+1]=u,this.int16[C+2]=f,this.int16[C+3]=_,this.int16[C+4]=y,this.int16[C+5]=w,i}}ia.prototype.bytesPerElement=12,it("StructArrayLayout2i2i2i12",ia);class yo extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,o,u,f,_){let y=this.length;return this.resize(y+1),this.emplace(y,i,o,u,f,_)}emplace(i,o,u,f,_,y){let w=4*i,C=8*i;return this.float32[w+0]=o,this.float32[w+1]=u,this.float32[w+2]=f,this.int16[C+6]=_,this.int16[C+7]=y,i}}yo.prototype.bytesPerElement=16,it("StructArrayLayout2f1f2i16",yo);class tu extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,o,u,f,_,y){let w=this.length;return this.resize(w+1),this.emplace(w,i,o,u,f,_,y)}emplace(i,o,u,f,_,y,w){let C=16*i,I=4*i,L=8*i;return this.uint8[C+0]=o,this.uint8[C+1]=u,this.float32[I+1]=f,this.float32[I+2]=_,this.int16[L+6]=y,this.int16[L+7]=w,i}}tu.prototype.bytesPerElement=16,it("StructArrayLayout2ub2f2i16",tu);class rl extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,o,u){let f=this.length;return this.resize(f+1),this.emplace(f,i,o,u)}emplace(i,o,u,f){let _=3*i;return this.uint16[_+0]=o,this.uint16[_+1]=u,this.uint16[_+2]=f,i}}rl.prototype.bytesPerElement=6,it("StructArrayLayout3ui6",rl);class xo extends xi{_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(i,o,u,f,_,y,w,C,I,L,k,B,N,G,U,Y,te){let de=this.length;return this.resize(de+1),this.emplace(de,i,o,u,f,_,y,w,C,I,L,k,B,N,G,U,Y,te)}emplace(i,o,u,f,_,y,w,C,I,L,k,B,N,G,U,Y,te,de){let se=24*i,j=12*i,H=48*i;return this.int16[se+0]=o,this.int16[se+1]=u,this.uint16[se+2]=f,this.uint16[se+3]=_,this.uint32[j+2]=y,this.uint32[j+3]=w,this.uint32[j+4]=C,this.uint16[se+10]=I,this.uint16[se+11]=L,this.uint16[se+12]=k,this.float32[j+7]=B,this.float32[j+8]=N,this.uint8[H+36]=G,this.uint8[H+37]=U,this.uint8[H+38]=Y,this.uint32[j+10]=te,this.int16[se+22]=de,i}}xo.prototype.bytesPerElement=48,it("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",xo);class iu extends xi{_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(i,o,u,f,_,y,w,C,I,L,k,B,N,G,U,Y,te,de,se,j,H,oe,Se,Ge,Me,Le,Ze,Ve){let qe=this.length;return this.resize(qe+1),this.emplace(qe,i,o,u,f,_,y,w,C,I,L,k,B,N,G,U,Y,te,de,se,j,H,oe,Se,Ge,Me,Le,Ze,Ve)}emplace(i,o,u,f,_,y,w,C,I,L,k,B,N,G,U,Y,te,de,se,j,H,oe,Se,Ge,Me,Le,Ze,Ve,qe){let Be=32*i,rt=16*i;return this.int16[Be+0]=o,this.int16[Be+1]=u,this.int16[Be+2]=f,this.int16[Be+3]=_,this.int16[Be+4]=y,this.int16[Be+5]=w,this.int16[Be+6]=C,this.int16[Be+7]=I,this.uint16[Be+8]=L,this.uint16[Be+9]=k,this.uint16[Be+10]=B,this.uint16[Be+11]=N,this.uint16[Be+12]=G,this.uint16[Be+13]=U,this.uint16[Be+14]=Y,this.uint16[Be+15]=te,this.uint16[Be+16]=de,this.uint16[Be+17]=se,this.uint16[Be+18]=j,this.uint16[Be+19]=H,this.uint16[Be+20]=oe,this.uint16[Be+21]=Se,this.uint16[Be+22]=Ge,this.uint32[rt+12]=Me,this.float32[rt+13]=Le,this.float32[rt+14]=Ze,this.uint16[Be+30]=Ve,this.uint16[Be+31]=qe,i}}iu.prototype.bytesPerElement=64,it("StructArrayLayout8i15ui1ul2f2ui64",iu);class uc extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i){let o=this.length;return this.resize(o+1),this.emplace(o,i)}emplace(i,o){return this.float32[1*i+0]=o,i}}uc.prototype.bytesPerElement=4,it("StructArrayLayout1f4",uc);class dc extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,o,u){let f=this.length;return this.resize(f+1),this.emplace(f,i,o,u)}emplace(i,o,u,f){let _=3*i;return this.uint16[6*i+0]=o,this.float32[_+1]=u,this.float32[_+2]=f,i}}dc.prototype.bytesPerElement=12,it("StructArrayLayout1ui2f12",dc);class ru extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,o,u){let f=this.length;return this.resize(f+1),this.emplace(f,i,o,u)}emplace(i,o,u,f){let _=4*i;return this.uint32[2*i+0]=o,this.uint16[_+2]=u,this.uint16[_+3]=f,i}}ru.prototype.bytesPerElement=8,it("StructArrayLayout1ul2ui8",ru);class m extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,o){let u=this.length;return this.resize(u+1),this.emplace(u,i,o)}emplace(i,o,u){let f=2*i;return this.uint16[f+0]=o,this.uint16[f+1]=u,i}}m.prototype.bytesPerElement=4,it("StructArrayLayout2ui4",m);class e extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i){let o=this.length;return this.resize(o+1),this.emplace(o,i)}emplace(i,o){return this.uint16[1*i+0]=o,i}}e.prototype.bytesPerElement=2,it("StructArrayLayout1ui2",e);class s extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,o,u,f){let _=this.length;return this.resize(_+1),this.emplace(_,i,o,u,f)}emplace(i,o,u,f,_){let y=4*i;return this.float32[y+0]=o,this.float32[y+1]=u,this.float32[y+2]=f,this.float32[y+3]=_,i}}s.prototype.bytesPerElement=16,it("StructArrayLayout4f16",s);class d extends Qa{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new z(this.anchorPointX,this.anchorPointY)}}d.prototype.size=20;class p extends eu{get(i){return new d(this,i)}}it("CollisionBoxArray",p);class g extends Qa{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(i){this._structArray.uint8[this._pos1+37]=i}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(i){this._structArray.uint8[this._pos1+38]=i}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(i){this._structArray.uint32[this._pos4+10]=i}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}g.prototype.size=48;class v extends xo{get(i){return new g(this,i)}}it("PlacedSymbolArray",v);class T extends Qa{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(i){this._structArray.uint32[this._pos4+12]=i}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}T.prototype.size=64;class M extends iu{get(i){return new T(this,i)}}it("SymbolInstanceArray",M);class P extends uc{getoffsetX(i){return this.float32[1*i+0]}}it("GlyphOffsetArray",P);class D extends ac{getx(i){return this.int16[3*i+0]}gety(i){return this.int16[3*i+1]}gettileUnitDistanceFromAnchor(i){return this.int16[3*i+2]}}it("SymbolLineVertexArray",D);class F extends Qa{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}F.prototype.size=12;class O extends dc{get(i){return new F(this,i)}}it("TextAnchorOffsetArray",O);class V extends Qa{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]}}V.prototype.size=8;class q extends ru{get(i){return new V(this,i)}}it("FeatureIndexArray",q);class Q extends el{}class J extends el{}class ee extends el{}class ie extends Jh{}class ae extends Qh{}class le extends Gn{}class ce extends cc{}class fe extends tl{}class ue extends hc{}class we extends il{}class Ce extends ia{}class ze extends tu{}class Fe extends rl{}class Ae extends m{}let Ye=ri([{name:"a_pos",components:2,type:"Int16"}],4),{members:$e}=Ye;class Oe{constructor(i=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=i}prepareSegment(i,o,u,f){let _=this.segments[this.segments.length-1];return i>Oe.MAX_VERTEX_ARRAY_LENGTH&&_i(`Max vertices per segment is ${Oe.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${i}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Oe.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!_||_.vertexLength+i>Oe.MAX_VERTEX_ARRAY_LENGTH||_.sortKey!==f?this.createNewSegment(o,u,f):_}createNewSegment(i,o,u){let f={vertexOffset:i.length,primitiveOffset:o.length,vertexLength:0,primitiveLength:0,vaos:{}};return u!==void 0&&(f.sortKey=u),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(f),f}getOrCreateLatestSegment(i,o,u){return this.prepareSegment(0,i,o,u)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let i of this.segments)for(let o in i.vaos)i.vaos[o].destroy()}static simpleSegment(i,o,u,f){return new Oe([{vertexOffset:i,primitiveOffset:o,vertexLength:u,primitiveLength:f,vaos:{},sortKey:0}])}}function st(a,i){return 256*(a=Pt(Math.floor(a),0,255))+Pt(Math.floor(i),0,255)}Oe.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,it("SegmentVector",Oe);let Ct=ri([{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 Vt,ui,Ht,Qt={exports:{}},ni={exports:{}},Xt={exports:{}},ei=function(){if(Ht)return Qt.exports;Ht=1;var a=(Vt||(Vt=1,ni.exports=function(o,u){var f,_,y,w,C,I,L,k;for(_=o.length-(f=3&o.length),y=u,C=3432918353,I=461845907,k=0;k<_;)L=255&o.charCodeAt(k)|(255&o.charCodeAt(++k))<<8|(255&o.charCodeAt(++k))<<16|(255&o.charCodeAt(++k))<<24,++k,y=27492+(65535&(w=5*(65535&(y=(y^=L=(65535&(L=(L=(65535&L)*C+(((L>>>16)*C&65535)<<16)&4294967295)<<15|L>>>17))*I+(((L>>>16)*I&65535)<<16)&4294967295)<<13|y>>>19))+((5*(y>>>16)&65535)<<16)&4294967295))+((58964+(w>>>16)&65535)<<16);switch(L=0,f){case 3:L^=(255&o.charCodeAt(k+2))<<16;case 2:L^=(255&o.charCodeAt(k+1))<<8;case 1:y^=L=(65535&(L=(L=(65535&(L^=255&o.charCodeAt(k)))*C+(((L>>>16)*C&65535)<<16)&4294967295)<<15|L>>>17))*I+(((L>>>16)*I&65535)<<16)&4294967295}return y^=o.length,y=2246822507*(65535&(y^=y>>>16))+((2246822507*(y>>>16)&65535)<<16)&4294967295,y=3266489909*(65535&(y^=y>>>13))+((3266489909*(y>>>16)&65535)<<16)&4294967295,(y^=y>>>16)>>>0}),ni.exports),i=(ui||(ui=1,Xt.exports=function(o,u){for(var f,_=o.length,y=u^_,w=0;_>=4;)f=1540483477*(65535&(f=255&o.charCodeAt(w)|(255&o.charCodeAt(++w))<<8|(255&o.charCodeAt(++w))<<16|(255&o.charCodeAt(++w))<<24))+((1540483477*(f>>>16)&65535)<<16),y=1540483477*(65535&y)+((1540483477*(y>>>16)&65535)<<16)^(f=1540483477*(65535&(f^=f>>>24))+((1540483477*(f>>>16)&65535)<<16)),_-=4,++w;switch(_){case 3:y^=(255&o.charCodeAt(w+2))<<16;case 2:y^=(255&o.charCodeAt(w+1))<<8;case 1:y=1540483477*(65535&(y^=255&o.charCodeAt(w)))+((1540483477*(y>>>16)&65535)<<16)}return y=1540483477*(65535&(y^=y>>>13))+((1540483477*(y>>>16)&65535)<<16),(y^=y>>>15)>>>0}),Xt.exports);return Qt.exports=a,Qt.exports.murmur3=a,Qt.exports.murmur2=i,Qt.exports}(),Gi=x(ei);class Mi{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(i,o,u,f){this.ids.push(Hi(i)),this.positions.push(o,u,f)}getPositions(i){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let o=Hi(i),u=0,f=this.ids.length-1;for(;u<f;){let y=u+f>>1;this.ids[y]>=o?f=y:u=y+1}let _=[];for(;this.ids[u]===o;)_.push({index:this.positions[3*u],start:this.positions[3*u+1],end:this.positions[3*u+2]}),u++;return _}static serialize(i,o){let u=new Float64Array(i.ids),f=new Uint32Array(i.positions);return pr(u,f,0,u.length-1),o&&o.push(u.buffer,f.buffer),{ids:u,positions:f}}static deserialize(i){let o=new Mi;return o.ids=i.ids,o.positions=i.positions,o.indexed=!0,o}}function Hi(a){let i=+a;return!isNaN(i)&&i<=Number.MAX_SAFE_INTEGER?i:Gi(String(a))}function pr(a,i,o,u){for(;o<u;){let f=a[o+u>>1],_=o-1,y=u+1;for(;;){do _++;while(a[_]<f);do y--;while(a[y]>f);if(_>=y)break;os(a,_,y),os(i,3*_,3*y),os(i,3*_+1,3*y+1),os(i,3*_+2,3*y+2)}y-o<u-y?(pr(a,i,o,y),o=y+1):(pr(a,i,y+1,u),u=y)}}function os(a,i,o){let u=a[i];a[i]=a[o],a[o]=u}it("FeaturePositionMap",Mi);class un{constructor(i,o){this.gl=i.gl,this.location=o}}class as extends un{constructor(i,o){super(i,o),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1f(this.location,i))}}class vo extends un{constructor(i,o){super(i,o),this.current=[0,0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]&&i[3]===this.current[3]||(this.current=i,this.gl.uniform4f(this.location,i[0],i[1],i[2],i[3]))}}class nl extends un{constructor(i,o){super(i,o),this.current=Lt.transparent}set(i){i.r===this.current.r&&i.g===this.current.g&&i.b===this.current.b&&i.a===this.current.a||(this.current=i,this.gl.uniform4f(this.location,i.r,i.g,i.b,i.a))}}let pc=new Float32Array(16);function Ns(a){return[st(255*a.r,255*a.g),st(255*a.b,255*a.a)]}class fr{constructor(i,o,u){this.value=i,this.uniformNames=o.map(f=>`u_${f}`),this.type=u}setUniform(i,o,u){i.set(u.constantOr(this.value))}getBinding(i,o,u){return this.type==="color"?new nl(i,o):new as(i,o)}}class dn{constructor(i,o){this.uniformNames=o.map(u=>`u_${u}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(i,o){this.pixelRatioFrom=o.pixelRatio,this.pixelRatioTo=i.pixelRatio,this.patternFrom=o.tlbr,this.patternTo=i.tlbr}setUniform(i,o,u,f){let _=f==="u_pattern_to"?this.patternTo:f==="u_pattern_from"?this.patternFrom:f==="u_pixel_ratio_to"?this.pixelRatioTo:f==="u_pixel_ratio_from"?this.pixelRatioFrom:null;_&&i.set(_)}getBinding(i,o,u){return u.substr(0,9)==="u_pattern"?new vo(i,o):new as(i,o)}}class Er{constructor(i,o,u,f){this.expression=i,this.type=u,this.maxValue=0,this.paintVertexAttributes=o.map(_=>({name:`a_${_}`,type:"Float32",components:u==="color"?2:1,offset:0})),this.paintVertexArray=new f}populatePaintArray(i,o,u,f,_){let y=this.paintVertexArray.length,w=this.expression.evaluate(new ii(0),o,{},f,[],_);this.paintVertexArray.resize(i),this._setPaintValue(y,i,w)}updatePaintArray(i,o,u,f){let _=this.expression.evaluate({zoom:0},u,f);this._setPaintValue(i,o,_)}_setPaintValue(i,o,u){if(this.type==="color"){let f=Ns(u);for(let _=i;_<o;_++)this.paintVertexArray.emplace(_,f[0],f[1])}else{for(let f=i;f<o;f++)this.paintVertexArray.emplace(f,u);this.maxValue=Math.max(this.maxValue,Math.abs(u))}}upload(i){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=i.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Pr{constructor(i,o,u,f,_,y){this.expression=i,this.uniformNames=o.map(w=>`u_${w}_t`),this.type=u,this.useIntegerZoom=f,this.zoom=_,this.maxValue=0,this.paintVertexAttributes=o.map(w=>({name:`a_${w}`,type:"Float32",components:u==="color"?4:2,offset:0})),this.paintVertexArray=new y}populatePaintArray(i,o,u,f,_){let y=this.expression.evaluate(new ii(this.zoom),o,{},f,[],_),w=this.expression.evaluate(new ii(this.zoom+1),o,{},f,[],_),C=this.paintVertexArray.length;this.paintVertexArray.resize(i),this._setPaintValue(C,i,y,w)}updatePaintArray(i,o,u,f){let _=this.expression.evaluate({zoom:this.zoom},u,f),y=this.expression.evaluate({zoom:this.zoom+1},u,f);this._setPaintValue(i,o,_,y)}_setPaintValue(i,o,u,f){if(this.type==="color"){let _=Ns(u),y=Ns(f);for(let w=i;w<o;w++)this.paintVertexArray.emplace(w,_[0],_[1],y[0],y[1])}else{for(let _=i;_<o;_++)this.paintVertexArray.emplace(_,u,f);this.maxValue=Math.max(this.maxValue,Math.abs(u),Math.abs(f))}}upload(i){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=i.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(i,o){let u=this.useIntegerZoom?Math.floor(o.zoom):o.zoom,f=Pt(this.expression.interpolationFactor(u,this.zoom,this.zoom+1),0,1);i.set(f)}getBinding(i,o,u){return new as(i,o)}}class si{constructor(i,o,u,f,_,y){this.expression=i,this.type=o,this.useIntegerZoom=u,this.zoom=f,this.layerId=y,this.zoomInPaintVertexArray=new _,this.zoomOutPaintVertexArray=new _}populatePaintArray(i,o,u){let f=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(i),this.zoomOutPaintVertexArray.resize(i),this._setPaintValues(f,i,o.patterns&&o.patterns[this.layerId],u)}updatePaintArray(i,o,u,f,_){this._setPaintValues(i,o,u.patterns&&u.patterns[this.layerId],_)}_setPaintValues(i,o,u,f){if(!f||!u)return;let{min:_,mid:y,max:w}=u,C=f[_],I=f[y],L=f[w];if(C&&I&&L)for(let k=i;k<o;k++)this.zoomInPaintVertexArray.emplace(k,I.tl[0],I.tl[1],I.br[0],I.br[1],C.tl[0],C.tl[1],C.br[0],C.br[1],I.pixelRatio,C.pixelRatio),this.zoomOutPaintVertexArray.emplace(k,I.tl[0],I.tl[1],I.br[0],I.br[1],L.tl[0],L.tl[1],L.br[0],L.br[1],I.pixelRatio,L.pixelRatio)}upload(i){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=i.createVertexBuffer(this.zoomInPaintVertexArray,Ct.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=i.createVertexBuffer(this.zoomOutPaintVertexArray,Ct.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Vi{constructor(i,o,u){this.binders={},this._buffers=[];let f=[];for(let _ in i.paint._values){if(!u(_))continue;let y=i.paint.get(_);if(!(y instanceof hn&&Yo(y.property.specification)))continue;let w=Ki(_,i.type),C=y.value,I=y.property.specification.type,L=y.property.useIntegerZoom,k=y.property.specification["property-type"],B=k==="cross-faded"||k==="cross-faded-data-driven";if(C.kind==="constant")this.binders[_]=B?new dn(C.value,w):new fr(C.value,w,I),f.push(`/u_${_}`);else if(C.kind==="source"||B){let N=_p(_,I,"source");this.binders[_]=B?new si(C,I,L,o,N,i.id):new Er(C,w,I,N),f.push(`/a_${_}`)}else{let N=_p(_,I,"composite");this.binders[_]=new Pr(C,w,I,L,o,N),f.push(`/z_${_}`)}}this.cacheKey=f.sort().join("")}getMaxValue(i){let o=this.binders[i];return o instanceof Er||o instanceof Pr?o.maxValue:0}populatePaintArrays(i,o,u,f,_){for(let y in this.binders){let w=this.binders[y];(w instanceof Er||w instanceof Pr||w instanceof si)&&w.populatePaintArray(i,o,u,f,_)}}setConstantPatternPositions(i,o){for(let u in this.binders){let f=this.binders[u];f instanceof dn&&f.setConstantPatternPositions(i,o)}}updatePaintArrays(i,o,u,f,_){let y=!1;for(let w in i){let C=o.getPositions(w);for(let I of C){let L=u.feature(I.index);for(let k in this.binders){let B=this.binders[k];if((B instanceof Er||B instanceof Pr||B instanceof si)&&B.expression.isStateDependent===!0){let N=f.paint.get(k);B.expression=N.value,B.updatePaintArray(I.start,I.end,L,i[w],_),y=!0}}}}return y}defines(){let i=[];for(let o in this.binders){let u=this.binders[o];(u instanceof fr||u instanceof dn)&&i.push(...u.uniformNames.map(f=>`#define HAS_UNIFORM_${f}`))}return i}getBinderAttributes(){let i=[];for(let o in this.binders){let u=this.binders[o];if(u instanceof Er||u instanceof Pr)for(let f=0;f<u.paintVertexAttributes.length;f++)i.push(u.paintVertexAttributes[f].name);else if(u instanceof si)for(let f=0;f<Ct.members.length;f++)i.push(Ct.members[f].name)}return i}getBinderUniforms(){let i=[];for(let o in this.binders){let u=this.binders[o];if(u instanceof fr||u instanceof dn||u instanceof Pr)for(let f of u.uniformNames)i.push(f)}return i}getPaintVertexBuffers(){return this._buffers}getUniforms(i,o){let u=[];for(let f in this.binders){let _=this.binders[f];if(_ instanceof fr||_ instanceof dn||_ instanceof Pr){for(let y of _.uniformNames)if(o[y]){let w=_.getBinding(i,o[y],y);u.push({name:y,property:f,binding:w})}}}return u}setUniforms(i,o,u,f){for(let{name:_,property:y,binding:w}of o)this.binders[y].setUniform(w,f,u.get(y),_)}updatePaintBuffers(i){this._buffers=[];for(let o in this.binders){let u=this.binders[o];if(i&&u instanceof si){let f=i.fromScale===2?u.zoomInPaintVertexBuffer:u.zoomOutPaintVertexBuffer;f&&this._buffers.push(f)}else(u instanceof Er||u instanceof Pr)&&u.paintVertexBuffer&&this._buffers.push(u.paintVertexBuffer)}}upload(i){for(let o in this.binders){let u=this.binders[o];(u instanceof Er||u instanceof Pr||u instanceof si)&&u.upload(i)}this.updatePaintBuffers()}destroy(){for(let i in this.binders){let o=this.binders[i];(o instanceof Er||o instanceof Pr||o instanceof si)&&o.destroy()}}}class Yi{constructor(i,o,u=()=>!0){this.programConfigurations={};for(let f of i)this.programConfigurations[f.id]=new Vi(f,o,u);this.needsUpload=!1,this._featureMap=new Mi,this._bufferOffset=0}populatePaintArrays(i,o,u,f,_,y){for(let w in this.programConfigurations)this.programConfigurations[w].populatePaintArrays(i,o,f,_,y);o.id!==void 0&&this._featureMap.add(o.id,u,this._bufferOffset,i),this._bufferOffset=i,this.needsUpload=!0}updatePaintArrays(i,o,u,f){for(let _ of u)this.needsUpload=this.programConfigurations[_.id].updatePaintArrays(i,this._featureMap,o,_,f)||this.needsUpload}get(i){return this.programConfigurations[i]}upload(i){if(this.needsUpload){for(let o in this.programConfigurations)this.programConfigurations[o].upload(i);this.needsUpload=!1}}destroy(){for(let i in this.programConfigurations)this.programConfigurations[i].destroy()}}function Ki(a,i){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"]}[a]||[a.replace(`${i}-`,"").replace(/-/g,"_")]}function _p(a,i,o){let u={color:{source:Gn,composite:s},number:{source:uc,composite:Gn}},f=function(_){return{"line-pattern":{source:ce,composite:ce},"fill-pattern":{source:ce,composite:ce},"fill-extrusion-pattern":{source:ce,composite:ce}}[_]}(a);return f&&f[o]||u[i][o]}it("ConstantBinder",fr),it("CrossFadedConstantBinder",dn),it("SourceExpressionBinder",Er),it("CrossFadedCompositeBinder",si),it("CompositeExpressionBinder",Pr),it("ProgramConfiguration",Vi,{omit:["_buffers"]}),it("ProgramConfigurationSet",Yi);let nu=Math.pow(2,14)-1,yp=-nu-1;function bo(a){let i=ut/a.extent,o=a.loadGeometry();for(let u=0;u<o.length;u++){let f=o[u];for(let _=0;_<f.length;_++){let y=f[_],w=Math.round(y.x*i),C=Math.round(y.y*i);y.x=Pt(w,yp,nu),y.y=Pt(C,yp,nu),(w<y.x||w>y.x+1||C<y.y||C>y.y+1)&&_i("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return o}function wo(a,i){return{type:a.type,id:a.id,properties:a.properties,geometry:i?bo(a):[]}}let xp=-32768;function So(a,i,o,u,f){a.emplaceBack(xp+8*i+u,xp+8*o+f)}class fc{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(o=>o.id),this.index=i.index,this.hasPattern=!1,this.layoutVertexArray=new J,this.indexArray=new Fe,this.segments=new Oe,this.programConfigurations=new Yi(i.layers,i.zoom),this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id)}populate(i,o,u){let f=this.layers[0],_=[],y=null,w=!1,C=f.type==="heatmap";if(f.type==="circle"){let L=f;y=L.layout.get("circle-sort-key"),w=!y.isConstant(),C=C||L.paint.get("circle-pitch-alignment")==="map"}let I=C?o.subdivisionGranularity.circle:1;for(let{feature:L,id:k,index:B,sourceLayerIndex:N}of i){let G=this.layers[0]._featureFilter.needGeometry,U=wo(L,G);if(!this.layers[0]._featureFilter.filter(new ii(this.zoom),U,u))continue;let Y=w?y.evaluate(U,{},u):void 0,te={id:k,properties:L.properties,type:L.type,sourceLayerIndex:N,index:B,geometry:G?U.geometry:bo(L),patterns:{},sortKey:Y};_.push(te)}w&&_.sort((L,k)=>L.sortKey-k.sortKey);for(let L of _){let{geometry:k,index:B,sourceLayerIndex:N}=L,G=i[B].feature;this.addFeature(L,k,B,u,I),o.featureIndex.insert(G,k,B,N,this.index)}}update(i,o,u){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,o,this.stateDependentLayers,u)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,$e),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(i,o,u,f,_=1){let y;switch(_){case 1:y=[0,7];break;case 3:y=[0,2,5,7];break;case 5:y=[0,1,3,4,6,7];break;case 7:y=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${_}; valid values are 1, 3, 5, 7.`)}let w=y.length;for(let C of o)for(let I of C){let L=I.x,k=I.y;if(L<0||L>=ut||k<0||k>=ut)continue;let B=this.segments.prepareSegment(w*w,this.layoutVertexArray,this.indexArray,i.sortKey),N=B.vertexLength;for(let G=0;G<w;G++)for(let U=0;U<w;U++)So(this.layoutVertexArray,L,k,y[U],y[G]);for(let G=0;G<w-1;G++)for(let U=0;U<w-1;U++){let Y=N+G*w+U,te=N+(G+1)*w+U;this.indexArray.emplaceBack(Y,te+1,Y+1),this.indexArray.emplaceBack(Y,te,te+1)}B.vertexLength+=w*w,B.primitiveLength+=(w-1)*(w-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,u,{},f)}}function su(a,i){for(let o=0;o<a.length;o++)if(gc(i,a[o]))return!0;for(let o=0;o<i.length;o++)if(gc(a,i[o]))return!0;return!!sl(a,i)}function vp(a,i,o){return!!gc(a,i)||!!Tm(i,a,o)}function mc(a,i){if(a.length===1)return V0(i,a[0]);for(let o=0;o<i.length;o++){let u=i[o];for(let f=0;f<u.length;f++)if(gc(a,u[f]))return!0}for(let o=0;o<a.length;o++)if(V0(i,a[o]))return!0;for(let o=0;o<i.length;o++)if(sl(a,i[o]))return!0;return!1}function bp(a,i,o){if(a.length>1){if(sl(a,i))return!0;for(let u=0;u<i.length;u++)if(Tm(i[u],a,o))return!0}for(let u=0;u<a.length;u++)if(Tm(a[u],i,o))return!0;return!1}function sl(a,i){if(a.length===0||i.length===0)return!1;for(let o=0;o<a.length-1;o++){let u=a[o],f=a[o+1];for(let _=0;_<i.length-1;_++)if(hS(u,f,i[_],i[_+1]))return!0}return!1}function hS(a,i,o,u){return ti(a,o,u)!==ti(i,o,u)&&ti(a,i,o)!==ti(a,i,u)}function Tm(a,i,o){let u=o*o;if(i.length===1)return a.distSqr(i[0])<u;for(let f=1;f<i.length;f++)if(G0(a,i[f-1],i[f])<u)return!0;return!1}function G0(a,i,o){let u=i.distSqr(o);if(u===0)return a.distSqr(i);let f=((a.x-i.x)*(o.x-i.x)+(a.y-i.y)*(o.y-i.y))/u;return a.distSqr(f<0?i:f>1?o:o.sub(i)._mult(f)._add(i))}function V0(a,i){let o,u,f,_=!1;for(let y=0;y<a.length;y++){o=a[y];for(let w=0,C=o.length-1;w<o.length;C=w++)u=o[w],f=o[C],u.y>i.y!=f.y>i.y&&i.x<(f.x-u.x)*(i.y-u.y)/(f.y-u.y)+u.x&&(_=!_)}return _}function gc(a,i){let o=!1;for(let u=0,f=a.length-1;u<a.length;f=u++){let _=a[u],y=a[f];_.y>i.y!=y.y>i.y&&i.x<(y.x-_.x)*(i.y-_.y)/(y.y-_.y)+_.x&&(o=!o)}return o}function uS(a,i,o){let u=o[0],f=o[2];if(a.x<u.x&&i.x<u.x||a.x>f.x&&i.x>f.x||a.y<u.y&&i.y<u.y||a.y>f.y&&i.y>f.y)return!1;let _=ti(a,i,o[0]);return _!==ti(a,i,o[1])||_!==ti(a,i,o[2])||_!==ti(a,i,o[3])}function ou(a,i,o){let u=i.paint.get(a).value;return u.kind==="constant"?u.value:o.programConfigurations.get(i.id).getMaxValue(a)}function wp(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])}function Sp(a,i,o,u,f){if(!i[0]&&!i[1])return a;let _=z.convert(i)._mult(f);o==="viewport"&&_._rotate(-u);let y=[];for(let w=0;w<a.length;w++)y.push(a[w].sub(_));return y}let U0,Z0;it("CircleBucket",fc,{omit:["layers"]});var dS={get paint(){return Z0=Z0||new Ir({"circle-radius":new _t(K.paint_circle["circle-radius"]),"circle-color":new _t(K.paint_circle["circle-color"]),"circle-blur":new _t(K.paint_circle["circle-blur"]),"circle-opacity":new _t(K.paint_circle["circle-opacity"]),"circle-translate":new lt(K.paint_circle["circle-translate"]),"circle-translate-anchor":new lt(K.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new lt(K.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new lt(K.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new _t(K.paint_circle["circle-stroke-width"]),"circle-stroke-color":new _t(K.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new _t(K.paint_circle["circle-stroke-opacity"])})},get layout(){return U0=U0||new Ir({"circle-sort-key":new _t(K.layout_circle["circle-sort-key"])})}};class pS extends ss{constructor(i){super(i,dS)}createBucket(i){return new fc(i)}queryRadius(i){let o=i;return ou("circle-radius",this,o)+ou("circle-stroke-width",this,o)+wp(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:i,feature:o,featureState:u,geometry:f,transform:_,pixelsToTileUnits:y,pixelPosMatrix:w}){let C=Sp(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-_.bearingInRadians,y),I=this.paint.get("circle-radius").evaluate(o,u)+this.paint.get("circle-stroke-width").evaluate(o,u),L=this.paint.get("circle-pitch-alignment")==="map",k=L?C:function(N,G){return N.map(U=>q0(U,G))}(C,w),B=L?I*y:I;for(let N of f)for(let G of N){let U=L?G:q0(G,w),Y=B,te=ot([],[G.x,G.y,0,1],w);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?Y*=te[3]/_.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(Y*=_.cameraToCenterDistance/te[3]),vp(k,U,Y))return!0}return!1}}function q0(a,i){let o=ot([],[a.x,a.y,0,1],i);return new z(o[0]/o[3],o[1]/o[3])}class W0 extends fc{}let $0;it("HeatmapBucket",W0,{omit:["layers"]});var fS={get paint(){return $0=$0||new Ir({"heatmap-radius":new _t(K.paint_heatmap["heatmap-radius"]),"heatmap-weight":new _t(K.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new lt(K.paint_heatmap["heatmap-intensity"]),"heatmap-color":new oc(K.paint_heatmap["heatmap-color"]),"heatmap-opacity":new lt(K.paint_heatmap["heatmap-opacity"])})}};function Cm(a,{width:i,height:o},u,f){if(f){if(f instanceof Uint8ClampedArray)f=new Uint8Array(f.buffer);else if(f.length!==i*o*u)throw new RangeError(`mismatched image size. expected: ${f.length} but got: ${i*o*u}`)}else f=new Uint8Array(i*o*u);return a.width=i,a.height=o,a.data=f,a}function X0(a,{width:i,height:o},u){if(i===a.width&&o===a.height)return;let f=Cm({},{width:i,height:o},u);Mm(a,f,{x:0,y:0},{x:0,y:0},{width:Math.min(a.width,i),height:Math.min(a.height,o)},u),a.width=i,a.height=o,a.data=f.data}function Mm(a,i,o,u,f,_){if(f.width===0||f.height===0)return i;if(f.width>a.width||f.height>a.height||o.x>a.width-f.width||o.y>a.height-f.height)throw new RangeError("out of range source coordinates for image copy");if(f.width>i.width||f.height>i.height||u.x>i.width-f.width||u.y>i.height-f.height)throw new RangeError("out of range destination coordinates for image copy");let y=a.data,w=i.data;if(y===w)throw new Error("srcData equals dstData, so image is already copied");for(let C=0;C<f.height;C++){let I=((o.y+C)*a.width+o.x)*_,L=((u.y+C)*i.width+u.x)*_;for(let k=0;k<f.width*_;k++)w[L+k]=y[I+k]}return i}class au{constructor(i,o){Cm(this,i,1,o)}resize(i){X0(this,i,1)}clone(){return new au({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(i,o,u,f,_){Mm(i,o,u,f,_,1)}}class Vn{constructor(i,o){Cm(this,i,4,o)}resize(i){X0(this,i,4)}replace(i,o){o?this.data.set(i):this.data=i instanceof Uint8ClampedArray?new Uint8Array(i.buffer):i}clone(){return new Vn({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(i,o,u,f,_){Mm(i,o,u,f,_,4)}}function H0(a){let i={},o=a.resolution||256,u=a.clips?a.clips.length:1,f=a.image||new Vn({width:o,height:u});if(Math.log(o)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${o}`);let _=(y,w,C)=>{i[a.evaluationKey]=C;let I=a.expression.evaluate(i);f.data[y+w+0]=Math.floor(255*I.r/I.a),f.data[y+w+1]=Math.floor(255*I.g/I.a),f.data[y+w+2]=Math.floor(255*I.b/I.a),f.data[y+w+3]=Math.floor(255*I.a)};if(a.clips)for(let y=0,w=0;y<u;++y,w+=4*o)for(let C=0,I=0;C<o;C++,I+=4){let L=C/(o-1),{start:k,end:B}=a.clips[y];_(w,I,k*(1-L)+B*L)}else for(let y=0,w=0;y<o;y++,w+=4)_(0,w,y/(o-1));return f}it("AlphaImage",au),it("RGBAImage",Vn);let Im="big-fb";class mS extends ss{createBucket(i){return new W0(i)}constructor(i){super(i,fS),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=H0({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Im)&&this.heatmapFbos.delete(Im)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let Y0;var gS={get paint(){return Y0=Y0||new Ir({"hillshade-illumination-direction":new lt(K.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new lt(K.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new lt(K.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new lt(K.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new lt(K.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new lt(K.paint_hillshade["hillshade-accent-color"])})}};class _S extends ss{constructor(i){super(i,gS)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}let yS=ri([{name:"a_pos",components:2,type:"Int16"}],4),{members:xS}=yS;function Em(a,i,o){let u=o.patternDependencies,f=!1;for(let _ of i){let y=_.paint.get(`${a}-pattern`);y.isConstant()||(f=!0);let w=y.constantOr(null);w&&(f=!0,u[w.to]=!0,u[w.from]=!0)}return f}function Pm(a,i,o,u,f){let _=f.patternDependencies;for(let y of i){let w=y.paint.get(`${a}-pattern`).value;if(w.kind!=="constant"){let C=w.evaluate({zoom:u-1},o,{},f.availableImages),I=w.evaluate({zoom:u},o,{},f.availableImages),L=w.evaluate({zoom:u+1},o,{},f.availableImages);C=C&&C.name?C.name:C,I=I&&I.name?I.name:I,L=L&&L.name?L.name:L,_[C]=!0,_[I]=!0,_[L]=!0,o.patterns[y.id]={min:C,mid:I,max:L}}}return o}function K0(a,i,o,u,f){let _;if(f===function(y,w,C,I){let L=0;for(let k=w,B=C-I;k<C;k+=I)L+=(y[B]-y[k])*(y[k+1]+y[B+1]),B=k;return L}(a,i,o,u)>0)for(let y=i;y<o;y+=u)_=tx(y/u|0,a[y],a[y+1],_);else for(let y=o-u;y>=i;y-=u)_=tx(y/u|0,a[y],a[y+1],_);return _&&_c(_,_.next)&&(uu(_),_=_.next),_}function ol(a,i){if(!a)return a;i||(i=a);let o,u=a;do if(o=!1,u.steiner||!_c(u,u.next)&&Ii(u.prev,u,u.next)!==0)u=u.next;else{if(uu(u),u=i=u.prev,u===u.next)break;o=!0}while(o||u!==i);return i}function lu(a,i,o,u,f,_,y){if(!a)return;!y&&_&&function(C,I,L,k){let B=C;do B.z===0&&(B.z=Rm(B.x,B.y,I,L,k)),B.prevZ=B.prev,B.nextZ=B.next,B=B.next;while(B!==C);B.prevZ.nextZ=null,B.prevZ=null,function(N){let G,U=1;do{let Y,te=N;N=null;let de=null;for(G=0;te;){G++;let se=te,j=0;for(let oe=0;oe<U&&(j++,se=se.nextZ,se);oe++);let H=U;for(;j>0||H>0&&se;)j!==0&&(H===0||!se||te.z<=se.z)?(Y=te,te=te.nextZ,j--):(Y=se,se=se.nextZ,H--),de?de.nextZ=Y:N=Y,Y.prevZ=de,de=Y;te=se}de.nextZ=null,U*=2}while(G>1)}(B)}(a,u,f,_);let w=a;for(;a.prev!==a.next;){let C=a.prev,I=a.next;if(_?bS(a,u,f,_):vS(a))i.push(C.i,a.i,I.i),uu(a),a=I.next,w=I.next;else if((a=I)===w){y?y===1?lu(a=wS(ol(a),i),i,o,u,f,_,2):y===2&&SS(a,i,o,u,f,_):lu(ol(a),i,o,u,f,_,1);break}}}function vS(a){let i=a.prev,o=a,u=a.next;if(Ii(i,o,u)>=0)return!1;let f=i.x,_=o.x,y=u.x,w=i.y,C=o.y,I=u.y,L=Math.min(f,_,y),k=Math.min(w,C,I),B=Math.max(f,_,y),N=Math.max(w,C,I),G=u.next;for(;G!==i;){if(G.x>=L&&G.x<=B&&G.y>=k&&G.y<=N&&cu(f,w,_,C,y,I,G.x,G.y)&&Ii(G.prev,G,G.next)>=0)return!1;G=G.next}return!0}function bS(a,i,o,u){let f=a.prev,_=a,y=a.next;if(Ii(f,_,y)>=0)return!1;let w=f.x,C=_.x,I=y.x,L=f.y,k=_.y,B=y.y,N=Math.min(w,C,I),G=Math.min(L,k,B),U=Math.max(w,C,I),Y=Math.max(L,k,B),te=Rm(N,G,i,o,u),de=Rm(U,Y,i,o,u),se=a.prevZ,j=a.nextZ;for(;se&&se.z>=te&&j&&j.z<=de;){if(se.x>=N&&se.x<=U&&se.y>=G&&se.y<=Y&&se!==f&&se!==y&&cu(w,L,C,k,I,B,se.x,se.y)&&Ii(se.prev,se,se.next)>=0||(se=se.prevZ,j.x>=N&&j.x<=U&&j.y>=G&&j.y<=Y&&j!==f&&j!==y&&cu(w,L,C,k,I,B,j.x,j.y)&&Ii(j.prev,j,j.next)>=0))return!1;j=j.nextZ}for(;se&&se.z>=te;){if(se.x>=N&&se.x<=U&&se.y>=G&&se.y<=Y&&se!==f&&se!==y&&cu(w,L,C,k,I,B,se.x,se.y)&&Ii(se.prev,se,se.next)>=0)return!1;se=se.prevZ}for(;j&&j.z<=de;){if(j.x>=N&&j.x<=U&&j.y>=G&&j.y<=Y&&j!==f&&j!==y&&cu(w,L,C,k,I,B,j.x,j.y)&&Ii(j.prev,j,j.next)>=0)return!1;j=j.nextZ}return!0}function wS(a,i){let o=a;do{let u=o.prev,f=o.next.next;!_c(u,f)&&Q0(u,o,o.next,f)&&hu(u,f)&&hu(f,u)&&(i.push(u.i,o.i,f.i),uu(o),uu(o.next),o=a=f),o=o.next}while(o!==a);return ol(o)}function SS(a,i,o,u,f,_){let y=a;do{let w=y.next.next;for(;w!==y.prev;){if(y.i!==w.i&&ES(y,w)){let C=ex(y,w);return y=ol(y,y.next),C=ol(C,C.next),lu(y,i,o,u,f,_,0),void lu(C,i,o,u,f,_,0)}w=w.next}y=y.next}while(y!==a)}function TS(a,i){let o=a.x-i.x;return o===0&&(o=a.y-i.y,o===0)&&(o=(a.next.y-a.y)/(a.next.x-a.x)-(i.next.y-i.y)/(i.next.x-i.x)),o}function CS(a,i){let o=function(f,_){let y=_,w=f.x,C=f.y,I,L=-1/0;if(_c(f,y))return y;do{if(_c(f,y.next))return y.next;if(C<=y.y&&C>=y.next.y&&y.next.y!==y.y){let U=y.x+(C-y.y)*(y.next.x-y.x)/(y.next.y-y.y);if(U<=w&&U>L&&(L=U,I=y.x<y.next.x?y:y.next,U===w))return I}y=y.next}while(y!==_);if(!I)return null;let k=I,B=I.x,N=I.y,G=1/0;y=I;do{if(w>=y.x&&y.x>=B&&w!==y.x&&J0(C<N?w:L,C,B,N,C<N?L:w,C,y.x,y.y)){let U=Math.abs(C-y.y)/(w-y.x);hu(y,f)&&(U<G||U===G&&(y.x>I.x||y.x===I.x&&MS(I,y)))&&(I=y,G=U)}y=y.next}while(y!==k);return I}(a,i);if(!o)return i;let u=ex(o,a);return ol(u,u.next),ol(o,o.next)}function MS(a,i){return Ii(a.prev,a,i.prev)<0&&Ii(i.next,a,a.next)<0}function Rm(a,i,o,u,f){return(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=(a-o)*f|0)|a<<8))|a<<4))|a<<2))|a<<1))|(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-u)*f|0)|i<<8))|i<<4))|i<<2))|i<<1))<<1}function IS(a){let i=a,o=a;do(i.x<o.x||i.x===o.x&&i.y<o.y)&&(o=i),i=i.next;while(i!==a);return o}function J0(a,i,o,u,f,_,y,w){return(f-y)*(i-w)>=(a-y)*(_-w)&&(a-y)*(u-w)>=(o-y)*(i-w)&&(o-y)*(_-w)>=(f-y)*(u-w)}function cu(a,i,o,u,f,_,y,w){return!(a===y&&i===w)&&J0(a,i,o,u,f,_,y,w)}function ES(a,i){return a.next.i!==i.i&&a.prev.i!==i.i&&!function(o,u){let f=o;do{if(f.i!==o.i&&f.next.i!==o.i&&f.i!==u.i&&f.next.i!==u.i&&Q0(f,f.next,o,u))return!0;f=f.next}while(f!==o);return!1}(a,i)&&(hu(a,i)&&hu(i,a)&&function(o,u){let f=o,_=!1,y=(o.x+u.x)/2,w=(o.y+u.y)/2;do f.y>w!=f.next.y>w&&f.next.y!==f.y&&y<(f.next.x-f.x)*(w-f.y)/(f.next.y-f.y)+f.x&&(_=!_),f=f.next;while(f!==o);return _}(a,i)&&(Ii(a.prev,a,i.prev)||Ii(a,i.prev,i))||_c(a,i)&&Ii(a.prev,a,a.next)>0&&Ii(i.prev,i,i.next)>0)}function Ii(a,i,o){return(i.y-a.y)*(o.x-i.x)-(i.x-a.x)*(o.y-i.y)}function _c(a,i){return a.x===i.x&&a.y===i.y}function Q0(a,i,o,u){let f=Cp(Ii(a,i,o)),_=Cp(Ii(a,i,u)),y=Cp(Ii(o,u,a)),w=Cp(Ii(o,u,i));return f!==_&&y!==w||!(f!==0||!Tp(a,o,i))||!(_!==0||!Tp(a,u,i))||!(y!==0||!Tp(o,a,u))||!(w!==0||!Tp(o,i,u))}function Tp(a,i,o){return i.x<=Math.max(a.x,o.x)&&i.x>=Math.min(a.x,o.x)&&i.y<=Math.max(a.y,o.y)&&i.y>=Math.min(a.y,o.y)}function Cp(a){return a>0?1:a<0?-1:0}function hu(a,i){return Ii(a.prev,a,a.next)<0?Ii(a,i,a.next)>=0&&Ii(a,a.prev,i)>=0:Ii(a,i,a.prev)<0||Ii(a,a.next,i)<0}function ex(a,i){let o=Am(a.i,a.x,a.y),u=Am(i.i,i.x,i.y),f=a.next,_=i.prev;return a.next=i,i.prev=a,o.next=f,f.prev=o,u.next=o,o.prev=u,_.next=u,u.prev=_,u}function tx(a,i,o,u){let f=Am(a,i,o);return u?(f.next=u.next,f.prev=u,u.next.prev=f,u.next=f):(f.prev=f,f.next=f),f}function uu(a){a.next.prev=a.prev,a.prev.next=a.next,a.prevZ&&(a.prevZ.nextZ=a.nextZ),a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function Am(a,i,o){return{i:a,x:i,y:o,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class yc{constructor(i,o){if(o>i)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=i,this._minGranularity=o}getGranularityForZoomLevel(i){return Math.max(Math.floor(this._baseZoomGranularity/(1<<i)),this._minGranularity,1)}}class Mp{constructor(i){this.fill=i.fill,this.line=i.line,this.tile=i.tile,this.stencil=i.stencil,this.circle=i.circle}}Mp.noSubdivision=new Mp({fill:new yc(0,0),line:new yc(0,0),tile:new yc(0,0),stencil:new yc(0,0),circle:1}),it("SubdivisionGranularityExpression",yc),it("SubdivisionGranularitySetting",Mp);let xc=-32768,du=32767;class PS{constructor(i,o){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=i,this._granularityCellSize=ut/i,this._canonical=o}_getKey(i,o){return(i+=32768)<<16|(o+=32768)<<0}_vertexToIndex(i,o){if(i<-32768||o<-32768||i>32767||o>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");let u=0|Math.round(i),f=0|Math.round(o),_=this._getKey(u,f);if(this._vertexDictionary.has(_))return this._vertexDictionary.get(_);let y=this._vertexBuffer.length/2;return this._vertexDictionary.set(_,y),this._vertexBuffer.push(u,f),y}_subdivideTrianglesScanline(i){if(this._granularity<2)return function(f,_){let y=[];for(let w=0;w<_.length;w+=3){let C=_[w],I=_[w+1],L=_[w+2],k=f[2*C],B=f[2*C+1];(f[2*I]-k)*(f[2*L+1]-B)-(f[2*I+1]-B)*(f[2*L]-k)>0?(y.push(C),y.push(L),y.push(I)):(y.push(C),y.push(I),y.push(L))}return y}(this._vertexBuffer,i);let o=[],u=i.length;for(let f=0;f<u;f+=3){let _=[i[f+0],i[f+1],i[f+2]],y=[this._vertexBuffer[2*i[f+0]+0],this._vertexBuffer[2*i[f+0]+1],this._vertexBuffer[2*i[f+1]+0],this._vertexBuffer[2*i[f+1]+1],this._vertexBuffer[2*i[f+2]+0],this._vertexBuffer[2*i[f+2]+1]],w=1/0,C=1/0,I=-1/0,L=-1/0;for(let U=0;U<3;U++){let Y=y[2*U],te=y[2*U+1];w=Math.min(w,Y),I=Math.max(I,Y),C=Math.min(C,te),L=Math.max(L,te)}if(w===I||C===L)continue;let k=Math.floor(w/this._granularityCellSize),B=Math.ceil(I/this._granularityCellSize),N=Math.floor(C/this._granularityCellSize),G=Math.ceil(L/this._granularityCellSize);if(k!==B||N!==G)for(let U=N;U<G;U++){let Y=this._scanlineGenerateVertexRingForCellRow(U,y,_);RS(this._vertexBuffer,Y,o)}else o.push(..._)}return o}_scanlineGenerateVertexRingForCellRow(i,o,u){let f=i*this._granularityCellSize,_=f+this._granularityCellSize,y=[];for(let w=0;w<3;w++){let C=o[2*w],I=o[2*w+1],L=o[2*(w+1)%6],k=o[(2*(w+1)+1)%6],B=o[2*(w+2)%6],N=o[(2*(w+2)+1)%6],G=L-C,U=k-I,Y=G===0,te=U===0,de=(f-I)/U,se=(_-I)/U,j=Math.min(de,se),H=Math.max(de,se);if(!te&&(j>=1||H<=0)||te&&(I<f||I>_)){k>=f&&k<=_&&y.push(u[(w+1)%3]);continue}!te&&j>0&&y.push(this._vertexToIndex(C+G*j,I+U*j));let oe=C+G*Math.max(j,0),Se=C+G*Math.min(H,1);Y||this._generateIntraEdgeVertices(y,C,I,L,k,oe,Se),!te&&H<1&&y.push(this._vertexToIndex(C+G*H,I+U*H)),(te||k>=f&&k<=_)&&y.push(u[(w+1)%3]),!te&&(k<=f||k>=_)&&this._generateInterEdgeVertices(y,C,I,L,k,B,N,Se,f,_)}return y}_generateIntraEdgeVertices(i,o,u,f,_,y,w){let C=f-o,I=_-u,L=I===0,k=L?Math.min(o,f):Math.min(y,w),B=L?Math.max(o,f):Math.max(y,w),N=Math.floor(k/this._granularityCellSize)+1,G=Math.ceil(B/this._granularityCellSize)-1;if(L?o<f:y<w)for(let U=N;U<=G;U++){let Y=U*this._granularityCellSize;i.push(this._vertexToIndex(Y,u+I*(Y-o)/C))}else for(let U=G;U>=N;U--){let Y=U*this._granularityCellSize;i.push(this._vertexToIndex(Y,u+I*(Y-o)/C))}}_generateInterEdgeVertices(i,o,u,f,_,y,w,C,I,L){let k=_-u,B=y-f,N=w-_,G=(I-_)/N,U=(L-_)/N,Y=Math.min(G,U),te=Math.max(G,U),de=f+B*Y,se=Math.floor(Math.min(de,C)/this._granularityCellSize)+1,j=Math.ceil(Math.max(de,C)/this._granularityCellSize)-1,H=C<de,oe=N===0;if(oe&&(w===I||w===L))return;if(oe||Y>=1||te<=0){let Ge=u-w,Me=y+(o-y)*Math.min((I-w)/Ge,(L-w)/Ge);se=Math.floor(Math.min(Me,C)/this._granularityCellSize)+1,j=Math.ceil(Math.max(Me,C)/this._granularityCellSize)-1,H=C<Me}let Se=k>0?L:I;if(H)for(let Ge=se;Ge<=j;Ge++)i.push(this._vertexToIndex(Ge*this._granularityCellSize,Se));else for(let Ge=j;Ge>=se;Ge--)i.push(this._vertexToIndex(Ge*this._granularityCellSize,Se))}_generateOutline(i){let o=[];for(let u of i){let f=al(u,this._granularity,!0),_=this._pointArrayToIndices(f),y=[];for(let w=1;w<_.length;w++)y.push(_[w-1]),y.push(_[w]);o.push(y)}return o}_handlePoles(i){let o=!1,u=!1;this._canonical&&(this._canonical.y===0&&(o=!0),this._canonical.y===(1<<this._canonical.z)-1&&(u=!0)),(o||u)&&this._fillPoles(i,o,u)}_ensureNoPoleVertices(){let i=this._vertexBuffer;for(let o=0;o<i.length;o+=2){let u=i[o+1];u===xc&&(i[o+1]=-32767),u===du&&(i[o+1]=32766)}}_generatePoleQuad(i,o,u,f,_,y){f>_!=(y===xc)?(i.push(o),i.push(u),i.push(this._vertexToIndex(f,y)),i.push(u),i.push(this._vertexToIndex(_,y)),i.push(this._vertexToIndex(f,y))):(i.push(u),i.push(o),i.push(this._vertexToIndex(f,y)),i.push(this._vertexToIndex(_,y)),i.push(u),i.push(this._vertexToIndex(f,y)))}_fillPoles(i,o,u){let f=this._vertexBuffer,_=ut,y=i.length;for(let w=2;w<y;w+=3){let C=i[w-2],I=i[w-1],L=i[w],k=f[2*C],B=f[2*C+1],N=f[2*I],G=f[2*I+1],U=f[2*L],Y=f[2*L+1];o&&(B===0&&G===0&&this._generatePoleQuad(i,C,I,k,N,xc),G===0&&Y===0&&this._generatePoleQuad(i,I,L,N,U,xc),Y===0&&B===0&&this._generatePoleQuad(i,L,C,U,k,xc)),u&&(B===_&&G===_&&this._generatePoleQuad(i,C,I,k,N,du),G===_&&Y===_&&this._generatePoleQuad(i,I,L,N,U,du),Y===_&&B===_&&this._generatePoleQuad(i,L,C,U,k,du))}}_initializeVertices(i){for(let o=0;o<i.length;o+=2)this._vertexToIndex(i[o],i[o+1])}subdividePolygonInternal(i,o){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:u,holeIndices:f}=function(w){let C=[],I=[];for(let L of w)if(L.length!==0){L!==w[0]&&C.push(I.length/2);for(let k=0;k<L.length;k++)I.push(L[k].x),I.push(L[k].y)}return{flattened:I,holeIndices:C}}(i),_;this._initializeVertices(u);try{let w=function(I,L,k=2){let B=L&&L.length,N=B?L[0]*k:I.length,G=K0(I,0,N,k,!0),U=[];if(!G||G.next===G.prev)return U;let Y,te,de;if(B&&(G=function(se,j,H,oe){let Se=[];for(let Ge=0,Me=j.length;Ge<Me;Ge++){let Le=K0(se,j[Ge]*oe,Ge<Me-1?j[Ge+1]*oe:se.length,oe,!1);Le===Le.next&&(Le.steiner=!0),Se.push(IS(Le))}Se.sort(TS);for(let Ge=0;Ge<Se.length;Ge++)H=CS(Se[Ge],H);return H}(I,L,G,k)),I.length>80*k){Y=1/0,te=1/0;let se=-1/0,j=-1/0;for(let H=k;H<N;H+=k){let oe=I[H],Se=I[H+1];oe<Y&&(Y=oe),Se<te&&(te=Se),oe>se&&(se=oe),Se>j&&(j=Se)}de=Math.max(se-Y,j-te),de=de!==0?32767/de:0}return lu(G,U,k,Y,te,de,0),U}(u,f),C=this._convertIndices(u,w);_=this._subdivideTrianglesScanline(C)}catch(w){console.error(w)}let y=[];return o&&(y=this._generateOutline(i)),this._ensureNoPoleVertices(),this._handlePoles(_),{verticesFlattened:this._vertexBuffer,indicesTriangles:_,indicesLineList:y}}_convertIndices(i,o){let u=[];for(let f=0;f<o.length;f++)u.push(this._vertexToIndex(i[2*o[f]],i[2*o[f]+1]));return u}_pointArrayToIndices(i){let o=[];for(let u=0;u<i.length;u++){let f=i[u];o.push(this._vertexToIndex(f.x,f.y))}return o}}function ix(a,i,o,u=!0){return new PS(o,i).subdividePolygonInternal(a,u)}function al(a,i,o=!1){if(!a||a.length<1)return[];if(a.length<2)return[];let u=a[0],f=a[a.length-1],_=o&&(u.x!==f.x||u.y!==f.y);if(i<2)return _?[...a,a[0]]:[...a];let y=Math.floor(ut/i),w=[];w.push(new z(a[0].x,a[0].y));let C=a.length,I=_?C:C-1;for(let L=0;L<I;L++){let k=a[L],B=L<C-1?a[L+1]:a[0],N=k.x,G=k.y,U=B.x,Y=B.y,te=N!==U,de=G!==Y;if(!te&&!de)continue;let se=U-N,j=Y-G,H=Math.abs(se),oe=Math.abs(j),Se=N,Ge=G;for(;;){let Le=se>0?(Math.floor(Se/y)+1)*y:(Math.ceil(Se/y)-1)*y,Ze=j>0?(Math.floor(Ge/y)+1)*y:(Math.ceil(Ge/y)-1)*y,Ve=Math.abs(Se-Le),qe=Math.abs(Ge-Ze),Be=Math.abs(Se-U),rt=Math.abs(Ge-Y),gt=te?Ve/H:Number.POSITIVE_INFINITY,ft=de?qe/oe:Number.POSITIVE_INFINITY;if((Be<=Ve||!te)&&(rt<=qe||!de))break;if(gt<ft&&te||!de){Se=Le,Ge+=j*gt;let at=new z(Se,Math.round(Ge));w[w.length-1].x===at.x&&w[w.length-1].y===at.y||w.push(at)}else{Se+=se*ft,Ge=Ze;let at=new z(Math.round(Se),Ge);w[w.length-1].x===at.x&&w[w.length-1].y===at.y||w.push(at)}}let Me=new z(U,Y);w[w.length-1].x===Me.x&&w[w.length-1].y===Me.y||w.push(Me)}return w}function RS(a,i,o){if(i.length===0)throw new Error("Subdivision vertex ring is empty.");let u=0,f=a[2*i[0]];for(let C=1;C<i.length;C++){let I=a[2*i[C]];I<f&&(f=I,u=C)}let _=i.length,y=u,w=(y+1)%_;for(;;){let C=y-1>=0?y-1:_-1,I=(w+1)%_,L=a[2*i[C]],k=a[2*i[I]],B=a[2*i[y]],N=a[2*i[y]+1],G=a[2*i[w]+1],U=!1;if(L<k)U=!0;else if(L>k)U=!1;else{let Y=G-N,te=-(a[2*i[w]]-B),de=N<G?1:-1;((L-B)*Y+(a[2*i[C]+1]-N)*te)*de>((k-B)*Y+(a[2*i[I]+1]-N)*te)*de&&(U=!0)}if(U){let Y=i[C],te=i[y],de=i[w];Y!==te&&Y!==de&&te!==de&&o.push(de,te,Y),y--,y<0&&(y=_-1)}else{let Y=i[I],te=i[y],de=i[w];Y!==te&&Y!==de&&te!==de&&o.push(de,te,Y),w++,w>=_&&(w=0)}if(C===I)break}}function rx(a,i,o,u,f,_,y,w,C){let I=f.length/2,L=y&&w&&C;if(I<Oe.MAX_VERTEX_ARRAY_LENGTH){let k=i.prepareSegment(I,o,u),B=k.vertexLength;for(let U=0;U<_.length;U+=3)u.emplaceBack(B+_[U],B+_[U+1],B+_[U+2]);let N,G;k.vertexLength+=I,k.primitiveLength+=_.length/3,L&&(G=y.prepareSegment(I,o,w),N=G.vertexLength,G.vertexLength+=I);for(let U=0;U<f.length;U+=2)a(f[U],f[U+1]);if(L)for(let U=0;U<C.length;U++){let Y=C[U];for(let te=1;te<Y.length;te+=2)w.emplaceBack(N+Y[te-1],N+Y[te]);G.primitiveLength+=Y.length/2}}else(function(k,B,N,G,U,Y){let te=[];for(let oe=0;oe<G.length/2;oe++)te.push(-1);let de={count:0},se=0,j=k.getOrCreateLatestSegment(B,N),H=j.vertexLength;for(let oe=2;oe<U.length;oe+=3){let Se=U[oe-2],Ge=U[oe-1],Me=U[oe],Le=te[Se]<se,Ze=te[Ge]<se,Ve=te[Me]<se;j.vertexLength+((Le?1:0)+(Ze?1:0)+(Ve?1:0))>Oe.MAX_VERTEX_ARRAY_LENGTH&&(j=k.createNewSegment(B,N),se=de.count,Le=!0,Ze=!0,Ve=!0,H=0);let qe=pu(te,G,Y,de,Se,Le,j),Be=pu(te,G,Y,de,Ge,Ze,j),rt=pu(te,G,Y,de,Me,Ve,j);N.emplaceBack(H+qe-se,H+Be-se,H+rt-se),j.primitiveLength++}})(i,o,u,f,_,a),L&&function(k,B,N,G,U,Y){let te=[];for(let oe=0;oe<G.length/2;oe++)te.push(-1);let de={count:0},se=0,j=k.getOrCreateLatestSegment(B,N),H=j.vertexLength;for(let oe=0;oe<U.length;oe++){let Se=U[oe];for(let Ge=1;Ge<U[oe].length;Ge+=2){let Me=Se[Ge-1],Le=Se[Ge],Ze=te[Me]<se,Ve=te[Le]<se;j.vertexLength+((Ze?1:0)+(Ve?1:0))>Oe.MAX_VERTEX_ARRAY_LENGTH&&(j=k.createNewSegment(B,N),se=de.count,Ze=!0,Ve=!0,H=0);let qe=pu(te,G,Y,de,Me,Ze,j),Be=pu(te,G,Y,de,Le,Ve,j);N.emplaceBack(H+qe-se,H+Be-se),j.primitiveLength++}}}(y,o,w,f,C,a),i.forceNewSegmentOnNextPrepare(),y?.forceNewSegmentOnNextPrepare()}function pu(a,i,o,u,f,_,y){if(_){let w=u.count;return o(i[2*f],i[2*f+1]),a[f]=u.count,u.count++,y.vertexLength++,w}return a[f]}class Lm{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(o=>o.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ee,this.indexArray=new Fe,this.indexArray2=new Ae,this.programConfigurations=new Yi(i.layers,i.zoom),this.segments=new Oe,this.segments2=new Oe,this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id)}populate(i,o,u){this.hasPattern=Em("fill",this.layers,o);let f=this.layers[0].layout.get("fill-sort-key"),_=!f.isConstant(),y=[];for(let{feature:w,id:C,index:I,sourceLayerIndex:L}of i){let k=this.layers[0]._featureFilter.needGeometry,B=wo(w,k);if(!this.layers[0]._featureFilter.filter(new ii(this.zoom),B,u))continue;let N=_?f.evaluate(B,{},u,o.availableImages):void 0,G={id:C,properties:w.properties,type:w.type,sourceLayerIndex:L,index:I,geometry:k?B.geometry:bo(w),patterns:{},sortKey:N};y.push(G)}_&&y.sort((w,C)=>w.sortKey-C.sortKey);for(let w of y){let{geometry:C,index:I,sourceLayerIndex:L}=w;if(this.hasPattern){let k=Pm("fill",this.layers,w,this.zoom,o);this.patternFeatures.push(k)}else this.addFeature(w,C,I,u,{},o.subdivisionGranularity);o.featureIndex.insert(i[I].feature,C,I,L,this.index)}}update(i,o,u){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,o,this.stateDependentLayers,u)}addFeatures(i,o,u){for(let f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,o,u,i.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,xS),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.indexBuffer2=i.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(i),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(i,o,u,f,_,y){for(let w of $o(o,500)){let C=ix(w,f,y.fill.getGranularityForZoomLevel(f.z)),I=this.layoutVertexArray;rx((L,k)=>{I.emplaceBack(L,k)},this.segments,this.layoutVertexArray,this.indexArray,C.verticesFlattened,C.indicesTriangles,this.segments2,this.indexArray2,C.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,u,_,f)}}let nx,sx;it("FillBucket",Lm,{omit:["layers","patternFeatures"]});var AS={get paint(){return sx=sx||new Ir({"fill-antialias":new lt(K.paint_fill["fill-antialias"]),"fill-opacity":new _t(K.paint_fill["fill-opacity"]),"fill-color":new _t(K.paint_fill["fill-color"]),"fill-outline-color":new _t(K.paint_fill["fill-outline-color"]),"fill-translate":new lt(K.paint_fill["fill-translate"]),"fill-translate-anchor":new lt(K.paint_fill["fill-translate-anchor"]),"fill-pattern":new nc(K.paint_fill["fill-pattern"])})},get layout(){return nx=nx||new Ir({"fill-sort-key":new _t(K.layout_fill["fill-sort-key"])})}};class LS extends ss{constructor(i){super(i,AS)}recalculate(i,o){super.recalculate(i,o);let u=this.paint._values["fill-outline-color"];u.value.kind==="constant"&&u.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new Lm(i)}queryRadius(){return wp(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:i,geometry:o,transform:u,pixelsToTileUnits:f}){return mc(Sp(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-u.bearingInRadians,f),o)}isTileClipped(){return!0}}let kS=ri([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),DS=ri([{name:"a_centroid",components:2,type:"Int16"}],4),{members:FS}=kS;var km,ox,Dm,ax,Fm,lx,cx,Ip={};function hx(){if(ox)return km;ox=1;var a=R();function i(f,_,y,w,C){this.properties={},this.extent=y,this.type=0,this._pbf=f,this._geometry=-1,this._keys=w,this._values=C,f.readFields(o,this,_)}function o(f,_,y){f==1?_.id=y.readVarint():f==2?function(w,C){for(var I=w.readVarint()+w.pos;w.pos<I;){var L=C._keys[w.readVarint()],k=C._values[w.readVarint()];C.properties[L]=k}}(y,_):f==3?_.type=y.readVarint():f==4&&(_._geometry=y.pos)}function u(f){for(var _,y,w=0,C=0,I=f.length,L=I-1;C<I;L=C++)w+=((y=f[L]).x-(_=f[C]).x)*(_.y+y.y);return w}return km=i,i.types=["Unknown","Point","LineString","Polygon"],i.prototype.loadGeometry=function(){var f=this._pbf;f.pos=this._geometry;for(var _,y=f.readVarint()+f.pos,w=1,C=0,I=0,L=0,k=[];f.pos<y;){if(C<=0){var B=f.readVarint();w=7&B,C=B>>3}if(C--,w===1||w===2)I+=f.readSVarint(),L+=f.readSVarint(),w===1&&(_&&k.push(_),_=[]),_.push(new a(I,L));else{if(w!==7)throw new Error("unknown command "+w);_&&_.push(_[0].clone())}}return _&&k.push(_),k},i.prototype.bbox=function(){var f=this._pbf;f.pos=this._geometry;for(var _=f.readVarint()+f.pos,y=1,w=0,C=0,I=0,L=1/0,k=-1/0,B=1/0,N=-1/0;f.pos<_;){if(w<=0){var G=f.readVarint();y=7&G,w=G>>3}if(w--,y===1||y===2)(C+=f.readSVarint())<L&&(L=C),C>k&&(k=C),(I+=f.readSVarint())<B&&(B=I),I>N&&(N=I);else if(y!==7)throw new Error("unknown command "+y)}return[L,B,k,N]},i.prototype.toGeoJSON=function(f,_,y){var w,C,I=this.extent*Math.pow(2,y),L=this.extent*f,k=this.extent*_,B=this.loadGeometry(),N=i.types[this.type];function G(te){for(var de=0;de<te.length;de++){var se=te[de];te[de]=[360*(se.x+L)/I-180,360/Math.PI*Math.atan(Math.exp((180-360*(se.y+k)/I)*Math.PI/180))-90]}}switch(this.type){case 1:var U=[];for(w=0;w<B.length;w++)U[w]=B[w][0];G(B=U);break;case 2:for(w=0;w<B.length;w++)G(B[w]);break;case 3:for(B=function(te){var de=te.length;if(de<=1)return[te];for(var se,j,H=[],oe=0;oe<de;oe++){var Se=u(te[oe]);Se!==0&&(j===void 0&&(j=Se<0),j===Se<0?(se&&H.push(se),se=[te[oe]]):se.push(te[oe]))}return se&&H.push(se),H}(B),w=0;w<B.length;w++)for(C=0;C<B[w].length;C++)G(B[w][C])}B.length===1?B=B[0]:N="Multi"+N;var Y={type:"Feature",geometry:{type:N,coordinates:B},properties:this.properties};return"id"in this&&(Y.id=this.id),Y},km}function ux(){if(ax)return Dm;ax=1;var a=hx();function i(u,f){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=u,this._keys=[],this._values=[],this._features=[],u.readFields(o,this,f),this.length=this._features.length}function o(u,f,_){u===15?f.version=_.readVarint():u===1?f.name=_.readString():u===5?f.extent=_.readVarint():u===2?f._features.push(_.pos):u===3?f._keys.push(_.readString()):u===4&&f._values.push(function(y){for(var w=null,C=y.readVarint()+y.pos;y.pos<C;){var I=y.readVarint()>>3;w=I===1?y.readString():I===2?y.readFloat():I===3?y.readDouble():I===4?y.readVarint64():I===5?y.readVarint():I===6?y.readSVarint():I===7?y.readBoolean():null}return w}(_))}return Dm=i,i.prototype.feature=function(u){if(u<0||u>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[u];var f=this._pbf.readVarint()+this._pbf.pos;return new a(this._pbf,f,this.extent,this._keys,this._values)},Dm}function dx(){return cx||(cx=1,Ip.VectorTile=function(){if(lx)return Fm;lx=1;var a=ux();function i(o,u,f){if(o===3){var _=new a(f,f.readVarint()+f.pos);_.length&&(u[_.name]=_)}}return Fm=function(o,u){this.layers=o.readFields(i,{},u)},Fm}(),Ip.VectorTileFeature=hx(),Ip.VectorTileLayer=ux()),Ip}var fu=x(dx());let zS=fu.VectorTileFeature.types,zm=Math.pow(2,13);function mu(a,i,o,u,f,_,y,w){a.emplaceBack(i,o,2*Math.floor(u*zm)+y,f*zm*2,_*zm*2,Math.round(w))}class Om{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(o=>o.id),this.index=i.index,this.hasPattern=!1,this.layoutVertexArray=new ie,this.centroidVertexArray=new Q,this.indexArray=new Fe,this.programConfigurations=new Yi(i.layers,i.zoom),this.segments=new Oe,this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id)}populate(i,o,u){this.features=[],this.hasPattern=Em("fill-extrusion",this.layers,o);for(let{feature:f,id:_,index:y,sourceLayerIndex:w}of i){let C=this.layers[0]._featureFilter.needGeometry,I=wo(f,C);if(!this.layers[0]._featureFilter.filter(new ii(this.zoom),I,u))continue;let L={id:_,sourceLayerIndex:w,index:y,geometry:C?I.geometry:bo(f),properties:f.properties,type:f.type,patterns:{}};this.hasPattern?this.features.push(Pm("fill-extrusion",this.layers,L,this.zoom,o)):this.addFeature(L,L.geometry,y,u,{},o.subdivisionGranularity),o.featureIndex.insert(f,L.geometry,y,w,this.index,!0)}}addFeatures(i,o,u){for(let f of this.features){let{geometry:_}=f;this.addFeature(f,_,f.index,o,u,i.subdivisionGranularity)}}update(i,o,u){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,o,this.stateDependentLayers,u)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,FS),this.centroidVertexBuffer=i.createVertexBuffer(this.centroidVertexArray,DS.members,!0),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(i,o,u,f,_,y){for(let w of $o(o,500)){let C={x:0,y:0,sampleCount:0},I=this.layoutVertexArray.length;this.processPolygon(C,f,i,w,y);let L=this.layoutVertexArray.length-I,k=Math.floor(C.x/C.sampleCount),B=Math.floor(C.y/C.sampleCount);for(let N=0;N<L;N++)this.centroidVertexArray.emplaceBack(k,B)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,u,_,f)}processPolygon(i,o,u,f,_){if(f.length<1||px(f[0]))return;for(let k of f)k.length!==0&&OS(i,k);let y={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},w=_.fill.getGranularityForZoomLevel(o.z),C=zS[u.type]==="Polygon";for(let k of f){if(k.length===0||px(k))continue;let B=al(k,w,C);this._generateSideFaces(B,y)}if(!C)return;let I=ix(f,o,w,!1),L=this.layoutVertexArray;rx((k,B)=>{mu(L,k,B,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,I.verticesFlattened,I.indicesTriangles)}_generateSideFaces(i,o){let u=0;for(let f=1;f<i.length;f++){let _=i[f],y=i[f-1];if(BS(_,y))continue;o.segment.vertexLength+4>Oe.MAX_VERTEX_ARRAY_LENGTH&&(o.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let w=_.sub(y)._perp()._unit(),C=y.dist(_);u+C>32768&&(u=0),mu(this.layoutVertexArray,_.x,_.y,w.x,w.y,0,0,u),mu(this.layoutVertexArray,_.x,_.y,w.x,w.y,0,1,u),u+=C,mu(this.layoutVertexArray,y.x,y.y,w.x,w.y,0,0,u),mu(this.layoutVertexArray,y.x,y.y,w.x,w.y,0,1,u);let I=o.segment.vertexLength;this.indexArray.emplaceBack(I,I+2,I+1),this.indexArray.emplaceBack(I+1,I+2,I+3),o.segment.vertexLength+=4,o.segment.primitiveLength+=2}}}function OS(a,i){for(let o=0;o<i.length;o++){let u=i[o];o===i.length-1&&i[0].x===u.x&&i[0].y===u.y||(a.x+=u.x,a.y+=u.y,a.sampleCount++)}}function BS(a,i){return a.x===i.x&&(a.x<0||a.x>ut)||a.y===i.y&&(a.y<0||a.y>ut)}function px(a){return a.every(i=>i.x<0)||a.every(i=>i.x>ut)||a.every(i=>i.y<0)||a.every(i=>i.y>ut)}let fx;it("FillExtrusionBucket",Om,{omit:["layers","features"]});var jS={get paint(){return fx=fx||new Ir({"fill-extrusion-opacity":new lt(K["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new _t(K["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new lt(K["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new lt(K["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new nc(K["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new _t(K["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new _t(K["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new lt(K["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class NS extends ss{constructor(i){super(i,jS)}createBucket(i){return new Om(i)}queryRadius(){return wp(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:i,feature:o,featureState:u,geometry:f,transform:_,pixelsToTileUnits:y,pixelPosMatrix:w}){let C=Sp(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-_.bearingInRadians,y),I=this.paint.get("fill-extrusion-height").evaluate(o,u),L=this.paint.get("fill-extrusion-base").evaluate(o,u),k=function(N,G,U){let Y=[];for(let te of N){let de=[te.x,te.y,0,1];ot(de,de,G),Y.push(new z(de[0]/de[3],de[1]/de[3]))}return Y}(C,w),B=function(N,G,U,Y){let te=[],de=[],se=Y[8]*G,j=Y[9]*G,H=Y[10]*G,oe=Y[11]*G,Se=Y[8]*U,Ge=Y[9]*U,Me=Y[10]*U,Le=Y[11]*U;for(let Ze of N){let Ve=[],qe=[];for(let Be of Ze){let rt=Be.x,gt=Be.y,ft=Y[0]*rt+Y[4]*gt+Y[12],at=Y[1]*rt+Y[5]*gt+Y[13],kt=Y[2]*rt+Y[6]*gt+Y[14],vi=Y[3]*rt+Y[7]*gt+Y[15],Zi=kt+H,rr=vi+oe,ls=ft+Se,Wr=at+Ge,nr=kt+Me,gr=vi+Le,Si=new z((ft+se)/rr,(at+j)/rr);Si.z=Zi/rr,Ve.push(Si);let qi=new z(ls/gr,Wr/gr);qi.z=nr/gr,qe.push(qi)}te.push(Ve),de.push(qe)}return[te,de]}(f,L,I,w);return function(N,G,U){let Y=1/0;mc(U,G)&&(Y=mx(U,G[0]));for(let te=0;te<G.length;te++){let de=G[te],se=N[te];for(let j=0;j<de.length-1;j++){let H=de[j],oe=[H,de[j+1],se[j+1],se[j],H];su(U,oe)&&(Y=Math.min(Y,mx(U,oe)))}}return Y!==1/0&&Y}(B[0],B[1],k)}}function gu(a,i){return a.x*i.x+a.y*i.y}function mx(a,i){if(a.length===1){let o=0,u=i[o++],f;for(;!f||u.equals(f);)if(f=i[o++],!f)return 1/0;for(;o<i.length;o++){let _=i[o],y=a[0],w=f.sub(u),C=_.sub(u),I=y.sub(u),L=gu(w,w),k=gu(w,C),B=gu(C,C),N=gu(I,w),G=gu(I,C),U=L*B-k*k,Y=(B*N-k*G)/U,te=(L*G-k*N)/U,de=u.z*(1-Y-te)+f.z*Y+_.z*te;if(isFinite(de))return de}return 1/0}{let o=1/0;for(let u of i)o=Math.min(o,u.z);return o}}let GS=ri([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:VS}=GS,US=ri([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:ZS}=US,qS=fu.VectorTileFeature.types,WS=Math.cos(Math.PI/180*37.5),gx=Math.pow(2,14)/.5;class Bm{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(o=>o.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(o=>{this.gradients[o.id]={}}),this.layoutVertexArray=new ae,this.layoutVertexArray2=new le,this.indexArray=new Fe,this.programConfigurations=new Yi(i.layers,i.zoom),this.segments=new Oe,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id)}populate(i,o,u){this.hasPattern=Em("line",this.layers,o);let f=this.layers[0].layout.get("line-sort-key"),_=!f.isConstant(),y=[];for(let{feature:w,id:C,index:I,sourceLayerIndex:L}of i){let k=this.layers[0]._featureFilter.needGeometry,B=wo(w,k);if(!this.layers[0]._featureFilter.filter(new ii(this.zoom),B,u))continue;let N=_?f.evaluate(B,{},u):void 0,G={id:C,properties:w.properties,type:w.type,sourceLayerIndex:L,index:I,geometry:k?B.geometry:bo(w),patterns:{},sortKey:N};y.push(G)}_&&y.sort((w,C)=>w.sortKey-C.sortKey);for(let w of y){let{geometry:C,index:I,sourceLayerIndex:L}=w;if(this.hasPattern){let k=Pm("line",this.layers,w,this.zoom,o);this.patternFeatures.push(k)}else this.addFeature(w,C,I,u,{},o.subdivisionGranularity);o.featureIndex.insert(i[I].feature,C,I,L,this.index)}}update(i,o,u){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,o,this.stateDependentLayers,u)}addFeatures(i,o,u){for(let f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,o,u,i.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=i.createVertexBuffer(this.layoutVertexArray2,ZS)),this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,VS),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(i){if(i.properties&&Object.prototype.hasOwnProperty.call(i.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(i.properties,"mapbox_clip_end"))return{start:+i.properties.mapbox_clip_start,end:+i.properties.mapbox_clip_end}}addFeature(i,o,u,f,_,y){let w=this.layers[0].layout,C=w.get("line-join").evaluate(i,{}),I=w.get("line-cap"),L=w.get("line-miter-limit"),k=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(i);for(let B of o)this.addLine(B,i,C,I,L,k,f,y);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,u,_,f)}addLine(i,o,u,f,_,y,w,C){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,i=al(i,w?C.line.getGranularityForZoomLevel(w.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let se=0;se<i.length-1;se++)this.totalDistance+=i[se].dist(i[se+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let I=qS[o.type]==="Polygon",L=i.length;for(;L>=2&&i[L-1].equals(i[L-2]);)L--;let k=0;for(;k<L-1&&i[k].equals(i[k+1]);)k++;if(L<(I?3:2))return;u==="bevel"&&(_=1.05);let B=this.overscaling<=16?15*ut/(512*this.overscaling):0,N=this.segments.prepareSegment(10*L,this.layoutVertexArray,this.indexArray),G,U,Y,te,de;this.e1=this.e2=-1,I&&(G=i[L-2],de=i[k].sub(G)._unit()._perp());for(let se=k;se<L;se++){if(Y=se===L-1?I?i[k+1]:void 0:i[se+1],Y&&i[se].equals(Y))continue;de&&(te=de),G&&(U=G),G=i[se],de=Y?Y.sub(G)._unit()._perp():te,te=te||de;let j=te.add(de);j.x===0&&j.y===0||j._unit();let H=te.x*de.x+te.y*de.y,oe=j.x*de.x+j.y*de.y,Se=oe!==0?1/oe:1/0,Ge=2*Math.sqrt(2-2*oe),Me=oe<WS&&U&&Y,Le=te.x*de.y-te.y*de.x>0;if(Me&&se>k){let qe=G.dist(U);if(qe>2*B){let Be=G.sub(G.sub(U)._mult(B/qe)._round());this.updateDistance(U,Be),this.addCurrentVertex(Be,te,0,0,N),U=Be}}let Ze=U&&Y,Ve=Ze?u:I?"butt":f;if(Ze&&Ve==="round"&&(Se<y?Ve="miter":Se<=2&&(Ve="fakeround")),Ve==="miter"&&Se>_&&(Ve="bevel"),Ve==="bevel"&&(Se>2&&(Ve="flipbevel"),Se<_&&(Ve="miter")),U&&this.updateDistance(U,G),Ve==="miter")j._mult(Se),this.addCurrentVertex(G,j,0,0,N);else if(Ve==="flipbevel"){if(Se>100)j=de.mult(-1);else{let qe=Se*te.add(de).mag()/te.sub(de).mag();j._perp()._mult(qe*(Le?-1:1))}this.addCurrentVertex(G,j,0,0,N),this.addCurrentVertex(G,j.mult(-1),0,0,N)}else if(Ve==="bevel"||Ve==="fakeround"){let qe=-Math.sqrt(Se*Se-1),Be=Le?qe:0,rt=Le?0:qe;if(U&&this.addCurrentVertex(G,te,Be,rt,N),Ve==="fakeround"){let gt=Math.round(180*Ge/Math.PI/20);for(let ft=1;ft<gt;ft++){let at=ft/gt;if(at!==.5){let vi=at-.5;at+=at*vi*(at-1)*((1.0904+H*(H*(3.55645-1.43519*H)-3.2452))*vi*vi+(.848013+H*(.215638*H-1.06021)))}let kt=de.sub(te)._mult(at)._add(te)._unit()._mult(Le?-1:1);this.addHalfVertex(G,kt.x,kt.y,!1,Le,0,N)}}Y&&this.addCurrentVertex(G,de,-Be,-rt,N)}else if(Ve==="butt")this.addCurrentVertex(G,j,0,0,N);else if(Ve==="square"){let qe=U?1:-1;this.addCurrentVertex(G,j,qe,qe,N)}else Ve==="round"&&(U&&(this.addCurrentVertex(G,te,0,0,N),this.addCurrentVertex(G,te,1,1,N,!0)),Y&&(this.addCurrentVertex(G,de,-1,-1,N,!0),this.addCurrentVertex(G,de,0,0,N)));if(Me&&se<L-1){let qe=G.dist(Y);if(qe>2*B){let Be=G.add(Y.sub(G)._mult(B/qe)._round());this.updateDistance(G,Be),this.addCurrentVertex(Be,de,0,0,N),G=Be}}}}addCurrentVertex(i,o,u,f,_,y=!1){let w=o.y*f-o.x,C=-o.y-o.x*f;this.addHalfVertex(i,o.x+o.y*u,o.y-o.x*u,y,!1,u,_),this.addHalfVertex(i,w,C,y,!0,-f,_),this.distance>gx/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(i,o,u,f,_,y))}addHalfVertex({x:i,y:o},u,f,_,y,w,C){let I=.5*(this.lineClips?this.scaledDistance*(gx-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((i<<1)+(_?1:0),(o<<1)+(y?1:0),Math.round(63*u)+128,Math.round(63*f)+128,1+(w===0?0:w<0?-1:1)|(63&I)<<2,I>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let L=C.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,L,this.e2),C.primitiveLength++),y?this.e2=L:this.e1=L}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(i,o){this.distance+=i.dist(o),this.updateScaledDistance()}}let _x,yx;it("LineBucket",Bm,{omit:["layers","patternFeatures"]});var xx={get paint(){return yx=yx||new Ir({"line-opacity":new _t(K.paint_line["line-opacity"]),"line-color":new _t(K.paint_line["line-color"]),"line-translate":new lt(K.paint_line["line-translate"]),"line-translate-anchor":new lt(K.paint_line["line-translate-anchor"]),"line-width":new _t(K.paint_line["line-width"]),"line-gap-width":new _t(K.paint_line["line-gap-width"]),"line-offset":new _t(K.paint_line["line-offset"]),"line-blur":new _t(K.paint_line["line-blur"]),"line-dasharray":new sc(K.paint_line["line-dasharray"]),"line-pattern":new nc(K.paint_line["line-pattern"]),"line-gradient":new oc(K.paint_line["line-gradient"])})},get layout(){return _x=_x||new Ir({"line-cap":new lt(K.layout_line["line-cap"]),"line-join":new _t(K.layout_line["line-join"]),"line-miter-limit":new lt(K.layout_line["line-miter-limit"]),"line-round-limit":new lt(K.layout_line["line-round-limit"]),"line-sort-key":new _t(K.layout_line["line-sort-key"])})}};class $S extends _t{possiblyEvaluate(i,o){return o=new ii(Math.floor(o.zoom),{now:o.now,fadeDuration:o.fadeDuration,zoomHistory:o.zoomHistory,transition:o.transition}),super.possiblyEvaluate(i,o)}evaluate(i,o,u,f){return o=$t({},o,{zoom:Math.floor(o.zoom)}),super.evaluate(i,o,u,f)}}let Ep;class XS extends ss{constructor(i){super(i,xx),this.gradientVersion=0,Ep||(Ep=new $S(xx.paint.properties["line-width"].specification),Ep.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(i){if(i==="line-gradient"){let o=this.gradientExpression();this.stepInterpolant=!!function(u){return u._styleExpression!==void 0}(o)&&o._styleExpression.expression instanceof Zo,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,o){super.recalculate(i,o),this.paint._values["line-floorwidth"]=Ep.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new Bm(i)}queryRadius(i){let o=i,u=vx(ou("line-width",this,o),ou("line-gap-width",this,o)),f=ou("line-offset",this,o);return u/2+Math.abs(f)+wp(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:i,feature:o,featureState:u,geometry:f,transform:_,pixelsToTileUnits:y}){let w=Sp(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-_.bearingInRadians,y),C=y/2*vx(this.paint.get("line-width").evaluate(o,u),this.paint.get("line-gap-width").evaluate(o,u)),I=this.paint.get("line-offset").evaluate(o,u);return I&&(f=function(L,k){let B=[];for(let N=0;N<L.length;N++){let G=L[N],U=[];for(let Y=0;Y<G.length;Y++){let te=G[Y-1],de=G[Y],se=G[Y+1],j=Y===0?new z(0,0):de.sub(te)._unit()._perp(),H=Y===G.length-1?new z(0,0):se.sub(de)._unit()._perp(),oe=j._add(H)._unit(),Se=oe.x*H.x+oe.y*H.y;Se!==0&&oe._mult(1/Se),U.push(oe._mult(k)._add(de))}B.push(U)}return B}(f,I*y)),function(L,k,B){for(let N=0;N<k.length;N++){let G=k[N];if(L.length>=3){for(let U=0;U<G.length;U++)if(gc(L,G[U]))return!0}if(bp(L,G,B))return!0}return!1}(w,f,C)}isTileClipped(){return!0}}function vx(a,i){return i>0?i+2*a:a}let HS=ri([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),YS=ri([{name:"a_projected_pos",components:3,type:"Float32"}],4);ri([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let KS=ri([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ri([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let bx=ri([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),JS=ri([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function QS(a,i,o){return a.sections.forEach(u=>{u.text=function(f,_,y){let w=_.layout.get("text-transform").evaluate(y,{});return w==="uppercase"?f=f.toLocaleUpperCase():w==="lowercase"&&(f=f.toLocaleLowerCase()),ys.applyArabicShaping&&(f=ys.applyArabicShaping(f)),f}(u.text,i,o)}),a}ri([{name:"triangle",components:3,type:"Uint16"}]),ri([{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"}]),ri([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),ri([{type:"Float32",name:"offsetX"}]),ri([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ri([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let _u={"!":"\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 wx,jm,Sx,Ui=24,Nm={};function e2(){return wx||(wx=1,Nm.read=function(a,i,o,u,f){var _,y,w=8*f-u-1,C=(1<<w)-1,I=C>>1,L=-7,k=o?f-1:0,B=o?-1:1,N=a[i+k];for(k+=B,_=N&(1<<-L)-1,N>>=-L,L+=w;L>0;_=256*_+a[i+k],k+=B,L-=8);for(y=_&(1<<-L)-1,_>>=-L,L+=u;L>0;y=256*y+a[i+k],k+=B,L-=8);if(_===0)_=1-I;else{if(_===C)return y?NaN:1/0*(N?-1:1);y+=Math.pow(2,u),_-=I}return(N?-1:1)*y*Math.pow(2,_-u)},Nm.write=function(a,i,o,u,f,_){var y,w,C,I=8*_-f-1,L=(1<<I)-1,k=L>>1,B=f===23?Math.pow(2,-24)-Math.pow(2,-77):0,N=u?0:_-1,G=u?1:-1,U=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(w=isNaN(i)?1:0,y=L):(y=Math.floor(Math.log(i)/Math.LN2),i*(C=Math.pow(2,-y))<1&&(y--,C*=2),(i+=y+k>=1?B/C:B*Math.pow(2,1-k))*C>=2&&(y++,C/=2),y+k>=L?(w=0,y=L):y+k>=1?(w=(i*C-1)*Math.pow(2,f),y+=k):(w=i*Math.pow(2,k-1)*Math.pow(2,f),y=0));f>=8;a[o+N]=255&w,N+=G,w/=256,f-=8);for(y=y<<f|w,I+=f;I>0;a[o+N]=255&y,N+=G,y/=256,I-=8);a[o+N-G]|=128*U}),Nm}function Tx(){if(Sx)return jm;Sx=1,jm=i;var a=e2();function i(j){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(j)?j:new Uint8Array(j||0),this.pos=0,this.type=0,this.length=this.buf.length}i.Varint=0,i.Fixed64=1,i.Bytes=2,i.Fixed32=5;var o=4294967296,u=1/o,f=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function _(j){return j.type===i.Bytes?j.readVarint()+j.pos:j.pos+1}function y(j,H,oe){return oe?4294967296*H+(j>>>0):4294967296*(H>>>0)+(j>>>0)}function w(j,H,oe){var Se=H<=16383?1:H<=2097151?2:H<=268435455?3:Math.floor(Math.log(H)/(7*Math.LN2));oe.realloc(Se);for(var Ge=oe.pos-1;Ge>=j;Ge--)oe.buf[Ge+Se]=oe.buf[Ge]}function C(j,H){for(var oe=0;oe<j.length;oe++)H.writeVarint(j[oe])}function I(j,H){for(var oe=0;oe<j.length;oe++)H.writeSVarint(j[oe])}function L(j,H){for(var oe=0;oe<j.length;oe++)H.writeFloat(j[oe])}function k(j,H){for(var oe=0;oe<j.length;oe++)H.writeDouble(j[oe])}function B(j,H){for(var oe=0;oe<j.length;oe++)H.writeBoolean(j[oe])}function N(j,H){for(var oe=0;oe<j.length;oe++)H.writeFixed32(j[oe])}function G(j,H){for(var oe=0;oe<j.length;oe++)H.writeSFixed32(j[oe])}function U(j,H){for(var oe=0;oe<j.length;oe++)H.writeFixed64(j[oe])}function Y(j,H){for(var oe=0;oe<j.length;oe++)H.writeSFixed64(j[oe])}function te(j,H){return(j[H]|j[H+1]<<8|j[H+2]<<16)+16777216*j[H+3]}function de(j,H,oe){j[oe]=H,j[oe+1]=H>>>8,j[oe+2]=H>>>16,j[oe+3]=H>>>24}function se(j,H){return(j[H]|j[H+1]<<8|j[H+2]<<16)+(j[H+3]<<24)}return i.prototype={destroy:function(){this.buf=null},readFields:function(j,H,oe){for(oe=oe||this.length;this.pos<oe;){var Se=this.readVarint(),Ge=Se>>3,Me=this.pos;this.type=7&Se,j(Ge,H,this),this.pos===Me&&this.skip(Se)}return H},readMessage:function(j,H){return this.readFields(j,H,this.readVarint()+this.pos)},readFixed32:function(){var j=te(this.buf,this.pos);return this.pos+=4,j},readSFixed32:function(){var j=se(this.buf,this.pos);return this.pos+=4,j},readFixed64:function(){var j=te(this.buf,this.pos)+te(this.buf,this.pos+4)*o;return this.pos+=8,j},readSFixed64:function(){var j=te(this.buf,this.pos)+se(this.buf,this.pos+4)*o;return this.pos+=8,j},readFloat:function(){var j=a.read(this.buf,this.pos,!0,23,4);return this.pos+=4,j},readDouble:function(){var j=a.read(this.buf,this.pos,!0,52,8);return this.pos+=8,j},readVarint:function(j){var H,oe,Se=this.buf;return H=127&(oe=Se[this.pos++]),oe<128?H:(H|=(127&(oe=Se[this.pos++]))<<7,oe<128?H:(H|=(127&(oe=Se[this.pos++]))<<14,oe<128?H:(H|=(127&(oe=Se[this.pos++]))<<21,oe<128?H:function(Ge,Me,Le){var Ze,Ve,qe=Le.buf;if(Ze=(112&(Ve=qe[Le.pos++]))>>4,Ve<128||(Ze|=(127&(Ve=qe[Le.pos++]))<<3,Ve<128)||(Ze|=(127&(Ve=qe[Le.pos++]))<<10,Ve<128)||(Ze|=(127&(Ve=qe[Le.pos++]))<<17,Ve<128)||(Ze|=(127&(Ve=qe[Le.pos++]))<<24,Ve<128)||(Ze|=(1&(Ve=qe[Le.pos++]))<<31,Ve<128))return y(Ge,Ze,Me);throw new Error("Expected varint not more than 10 bytes")}(H|=(15&(oe=Se[this.pos]))<<28,j,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var j=this.readVarint();return j%2==1?(j+1)/-2:j/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var j=this.readVarint()+this.pos,H=this.pos;return this.pos=j,j-H>=12&&f?function(oe,Se,Ge){return f.decode(oe.subarray(Se,Ge))}(this.buf,H,j):function(oe,Se,Ge){for(var Me="",Le=Se;Le<Ge;){var Ze,Ve,qe,Be=oe[Le],rt=null,gt=Be>239?4:Be>223?3:Be>191?2:1;if(Le+gt>Ge)break;gt===1?Be<128&&(rt=Be):gt===2?(192&(Ze=oe[Le+1]))==128&&(rt=(31&Be)<<6|63&Ze)<=127&&(rt=null):gt===3?(Ve=oe[Le+2],(192&(Ze=oe[Le+1]))==128&&(192&Ve)==128&&((rt=(15&Be)<<12|(63&Ze)<<6|63&Ve)<=2047||rt>=55296&&rt<=57343)&&(rt=null)):gt===4&&(Ve=oe[Le+2],qe=oe[Le+3],(192&(Ze=oe[Le+1]))==128&&(192&Ve)==128&&(192&qe)==128&&((rt=(15&Be)<<18|(63&Ze)<<12|(63&Ve)<<6|63&qe)<=65535||rt>=1114112)&&(rt=null)),rt===null?(rt=65533,gt=1):rt>65535&&(rt-=65536,Me+=String.fromCharCode(rt>>>10&1023|55296),rt=56320|1023&rt),Me+=String.fromCharCode(rt),Le+=gt}return Me}(this.buf,H,j)},readBytes:function(){var j=this.readVarint()+this.pos,H=this.buf.subarray(this.pos,j);return this.pos=j,H},readPackedVarint:function(j,H){if(this.type!==i.Bytes)return j.push(this.readVarint(H));var oe=_(this);for(j=j||[];this.pos<oe;)j.push(this.readVarint(H));return j},readPackedSVarint:function(j){if(this.type!==i.Bytes)return j.push(this.readSVarint());var H=_(this);for(j=j||[];this.pos<H;)j.push(this.readSVarint());return j},readPackedBoolean:function(j){if(this.type!==i.Bytes)return j.push(this.readBoolean());var H=_(this);for(j=j||[];this.pos<H;)j.push(this.readBoolean());return j},readPackedFloat:function(j){if(this.type!==i.Bytes)return j.push(this.readFloat());var H=_(this);for(j=j||[];this.pos<H;)j.push(this.readFloat());return j},readPackedDouble:function(j){if(this.type!==i.Bytes)return j.push(this.readDouble());var H=_(this);for(j=j||[];this.pos<H;)j.push(this.readDouble());return j},readPackedFixed32:function(j){if(this.type!==i.Bytes)return j.push(this.readFixed32());var H=_(this);for(j=j||[];this.pos<H;)j.push(this.readFixed32());return j},readPackedSFixed32:function(j){if(this.type!==i.Bytes)return j.push(this.readSFixed32());var H=_(this);for(j=j||[];this.pos<H;)j.push(this.readSFixed32());return j},readPackedFixed64:function(j){if(this.type!==i.Bytes)return j.push(this.readFixed64());var H=_(this);for(j=j||[];this.pos<H;)j.push(this.readFixed64());return j},readPackedSFixed64:function(j){if(this.type!==i.Bytes)return j.push(this.readSFixed64());var H=_(this);for(j=j||[];this.pos<H;)j.push(this.readSFixed64());return j},skip:function(j){var H=7&j;if(H===i.Varint)for(;this.buf[this.pos++]>127;);else if(H===i.Bytes)this.pos=this.readVarint()+this.pos;else if(H===i.Fixed32)this.pos+=4;else{if(H!==i.Fixed64)throw new Error("Unimplemented type: "+H);this.pos+=8}},writeTag:function(j,H){this.writeVarint(j<<3|H)},realloc:function(j){for(var H=this.length||16;H<this.pos+j;)H*=2;if(H!==this.length){var oe=new Uint8Array(H);oe.set(this.buf),this.buf=oe,this.length=H}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(j){this.realloc(4),de(this.buf,j,this.pos),this.pos+=4},writeSFixed32:function(j){this.realloc(4),de(this.buf,j,this.pos),this.pos+=4},writeFixed64:function(j){this.realloc(8),de(this.buf,-1&j,this.pos),de(this.buf,Math.floor(j*u),this.pos+4),this.pos+=8},writeSFixed64:function(j){this.realloc(8),de(this.buf,-1&j,this.pos),de(this.buf,Math.floor(j*u),this.pos+4),this.pos+=8},writeVarint:function(j){(j=+j||0)>268435455||j<0?function(H,oe){var Se,Ge;if(H>=0?(Se=H%4294967296|0,Ge=H/4294967296|0):(Ge=~(-H/4294967296),4294967295^(Se=~(-H%4294967296))?Se=Se+1|0:(Se=0,Ge=Ge+1|0)),H>=18446744073709552e3||H<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");oe.realloc(10),function(Me,Le,Ze){Ze.buf[Ze.pos++]=127&Me|128,Me>>>=7,Ze.buf[Ze.pos++]=127&Me|128,Me>>>=7,Ze.buf[Ze.pos++]=127&Me|128,Me>>>=7,Ze.buf[Ze.pos++]=127&Me|128,Ze.buf[Ze.pos]=127&(Me>>>=7)}(Se,0,oe),function(Me,Le){var Ze=(7&Me)<<4;Le.buf[Le.pos++]|=Ze|((Me>>>=3)?128:0),Me&&(Le.buf[Le.pos++]=127&Me|((Me>>>=7)?128:0),Me&&(Le.buf[Le.pos++]=127&Me|((Me>>>=7)?128:0),Me&&(Le.buf[Le.pos++]=127&Me|((Me>>>=7)?128:0),Me&&(Le.buf[Le.pos++]=127&Me|((Me>>>=7)?128:0),Me&&(Le.buf[Le.pos++]=127&Me)))))}(Ge,oe)}(j,this):(this.realloc(4),this.buf[this.pos++]=127&j|(j>127?128:0),j<=127||(this.buf[this.pos++]=127&(j>>>=7)|(j>127?128:0),j<=127||(this.buf[this.pos++]=127&(j>>>=7)|(j>127?128:0),j<=127||(this.buf[this.pos++]=j>>>7&127))))},writeSVarint:function(j){this.writeVarint(j<0?2*-j-1:2*j)},writeBoolean:function(j){this.writeVarint(!!j)},writeString:function(j){j=String(j),this.realloc(4*j.length),this.pos++;var H=this.pos;this.pos=function(Se,Ge,Me){for(var Le,Ze,Ve=0;Ve<Ge.length;Ve++){if((Le=Ge.charCodeAt(Ve))>55295&&Le<57344){if(!Ze){Le>56319||Ve+1===Ge.length?(Se[Me++]=239,Se[Me++]=191,Se[Me++]=189):Ze=Le;continue}if(Le<56320){Se[Me++]=239,Se[Me++]=191,Se[Me++]=189,Ze=Le;continue}Le=Ze-55296<<10|Le-56320|65536,Ze=null}else Ze&&(Se[Me++]=239,Se[Me++]=191,Se[Me++]=189,Ze=null);Le<128?Se[Me++]=Le:(Le<2048?Se[Me++]=Le>>6|192:(Le<65536?Se[Me++]=Le>>12|224:(Se[Me++]=Le>>18|240,Se[Me++]=Le>>12&63|128),Se[Me++]=Le>>6&63|128),Se[Me++]=63&Le|128)}return Me}(this.buf,j,this.pos);var oe=this.pos-H;oe>=128&&w(H,oe,this),this.pos=H-1,this.writeVarint(oe),this.pos+=oe},writeFloat:function(j){this.realloc(4),a.write(this.buf,j,this.pos,!0,23,4),this.pos+=4},writeDouble:function(j){this.realloc(8),a.write(this.buf,j,this.pos,!0,52,8),this.pos+=8},writeBytes:function(j){var H=j.length;this.writeVarint(H),this.realloc(H);for(var oe=0;oe<H;oe++)this.buf[this.pos++]=j[oe]},writeRawMessage:function(j,H){this.pos++;var oe=this.pos;j(H,this);var Se=this.pos-oe;Se>=128&&w(oe,Se,this),this.pos=oe-1,this.writeVarint(Se),this.pos+=Se},writeMessage:function(j,H,oe){this.writeTag(j,i.Bytes),this.writeRawMessage(H,oe)},writePackedVarint:function(j,H){H.length&&this.writeMessage(j,C,H)},writePackedSVarint:function(j,H){H.length&&this.writeMessage(j,I,H)},writePackedBoolean:function(j,H){H.length&&this.writeMessage(j,B,H)},writePackedFloat:function(j,H){H.length&&this.writeMessage(j,L,H)},writePackedDouble:function(j,H){H.length&&this.writeMessage(j,k,H)},writePackedFixed32:function(j,H){H.length&&this.writeMessage(j,N,H)},writePackedSFixed32:function(j,H){H.length&&this.writeMessage(j,G,H)},writePackedFixed64:function(j,H){H.length&&this.writeMessage(j,U,H)},writePackedSFixed64:function(j,H){H.length&&this.writeMessage(j,Y,H)},writeBytesField:function(j,H){this.writeTag(j,i.Bytes),this.writeBytes(H)},writeFixed32Field:function(j,H){this.writeTag(j,i.Fixed32),this.writeFixed32(H)},writeSFixed32Field:function(j,H){this.writeTag(j,i.Fixed32),this.writeSFixed32(H)},writeFixed64Field:function(j,H){this.writeTag(j,i.Fixed64),this.writeFixed64(H)},writeSFixed64Field:function(j,H){this.writeTag(j,i.Fixed64),this.writeSFixed64(H)},writeVarintField:function(j,H){this.writeTag(j,i.Varint),this.writeVarint(H)},writeSVarintField:function(j,H){this.writeTag(j,i.Varint),this.writeSVarint(H)},writeStringField:function(j,H){this.writeTag(j,i.Bytes),this.writeString(H)},writeFloatField:function(j,H){this.writeTag(j,i.Fixed32),this.writeFloat(H)},writeDoubleField:function(j,H){this.writeTag(j,i.Fixed64),this.writeDouble(H)},writeBooleanField:function(j,H){this.writeVarintField(j,!!H)}},jm}var Gm=x(Tx());let Vm=3;function t2(a,i,o){a===1&&o.readMessage(i2,i)}function i2(a,i,o){if(a===3){let{id:u,bitmap:f,width:_,height:y,left:w,top:C,advance:I}=o.readMessage(r2,{});i.push({id:u,bitmap:new au({width:_+2*Vm,height:y+2*Vm},f),metrics:{width:_,height:y,left:w,top:C,advance:I}})}}function r2(a,i,o){a===1?i.id=o.readVarint():a===2?i.bitmap=o.readBytes():a===3?i.width=o.readVarint():a===4?i.height=o.readVarint():a===5?i.left=o.readSVarint():a===6?i.top=o.readSVarint():a===7&&(i.advance=o.readVarint())}let n2=Vm;function Cx(a){let i=0,o=0;for(let y of a)i+=y.w*y.h,o=Math.max(o,y.w);a.sort((y,w)=>w.h-y.h);let u=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(i/.95)),o),h:1/0}],f=0,_=0;for(let y of a)for(let w=u.length-1;w>=0;w--){let C=u[w];if(!(y.w>C.w||y.h>C.h)){if(y.x=C.x,y.y=C.y,_=Math.max(_,y.y+y.h),f=Math.max(f,y.x+y.w),y.w===C.w&&y.h===C.h){let I=u.pop();w<u.length&&(u[w]=I)}else y.h===C.h?(C.x+=y.w,C.w-=y.w):y.w===C.w?(C.y+=y.h,C.h-=y.h):(u.push({x:C.x+y.w,y:C.y,w:C.w-y.w,h:y.h}),C.y+=y.h,C.h-=y.h);break}}return{w:f,h:_,fill:i/(f*_)||0}}let pn=1;class Um{constructor(i,{pixelRatio:o,version:u,stretchX:f,stretchY:_,content:y,textFitWidth:w,textFitHeight:C}){this.paddedRect=i,this.pixelRatio=o,this.stretchX=f,this.stretchY=_,this.content=y,this.version=u,this.textFitWidth=w,this.textFitHeight=C}get tl(){return[this.paddedRect.x+pn,this.paddedRect.y+pn]}get br(){return[this.paddedRect.x+this.paddedRect.w-pn,this.paddedRect.y+this.paddedRect.h-pn]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*pn)/this.pixelRatio,(this.paddedRect.h-2*pn)/this.pixelRatio]}}class Mx{constructor(i,o){let u={},f={};this.haveRenderCallbacks=[];let _=[];this.addImages(i,u,_),this.addImages(o,f,_);let{w:y,h:w}=Cx(_),C=new Vn({width:y||1,height:w||1});for(let I in i){let L=i[I],k=u[I].paddedRect;Vn.copy(L.data,C,{x:0,y:0},{x:k.x+pn,y:k.y+pn},L.data)}for(let I in o){let L=o[I],k=f[I].paddedRect,B=k.x+pn,N=k.y+pn,G=L.data.width,U=L.data.height;Vn.copy(L.data,C,{x:0,y:0},{x:B,y:N},L.data),Vn.copy(L.data,C,{x:0,y:U-1},{x:B,y:N-1},{width:G,height:1}),Vn.copy(L.data,C,{x:0,y:0},{x:B,y:N+U},{width:G,height:1}),Vn.copy(L.data,C,{x:G-1,y:0},{x:B-1,y:N},{width:1,height:U}),Vn.copy(L.data,C,{x:0,y:0},{x:B+G,y:N},{width:1,height:U})}this.image=C,this.iconPositions=u,this.patternPositions=f}addImages(i,o,u){for(let f in i){let _=i[f],y={x:0,y:0,w:_.data.width+2*pn,h:_.data.height+2*pn};u.push(y),o[f]=new Um(y,_),_.hasRenderCallback&&this.haveRenderCallbacks.push(f)}}patchUpdatedImages(i,o){i.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let u in i.updatedImages)this.patchUpdatedImage(this.iconPositions[u],i.getImage(u),o),this.patchUpdatedImage(this.patternPositions[u],i.getImage(u),o)}patchUpdatedImage(i,o,u){if(!i||!o||i.version===o.version)return;i.version=o.version;let[f,_]=i.tl;u.update(o.data,void 0,{x:f,y:_})}}var ra;it("ImagePosition",Um),it("ImageAtlas",Mx),c.ai=void 0,(ra=c.ai||(c.ai={}))[ra.none=0]="none",ra[ra.horizontal=1]="horizontal",ra[ra.vertical=2]="vertical",ra[ra.horizontalOnly=3]="horizontalOnly";let yu=-17;class xu{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(i,o){let u=new xu;return u.scale=i||1,u.fontStack=o,u}static forImage(i){let o=new xu;return o.imageName=i,o}}class vc{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(i,o){let u=new vc;for(let f=0;f<i.sections.length;f++){let _=i.sections[f];_.image?u.addImageSection(_):u.addTextSection(_,o)}return u}length(){return this.text.length}getSection(i){return this.sections[this.sectionIndex[i]]}getSectionIndex(i){return this.sectionIndex[i]}getCharCode(i){return this.text.charCodeAt(i)}verticalizePunctuation(){this.text=function(i){let o="";for(let u=0;u<i.length;u++){let f=i.charCodeAt(u+1)||null,_=i.charCodeAt(u-1)||null;o+=f&&Wh(f)&&!_u[i[u+1]]||_&&Wh(_)&&!_u[i[u-1]]||!_u[i[u]]?i[u]:_u[i[u]]}return o}(this.text)}trim(){let i=0;for(let u=0;u<this.text.length&&Rp[this.text.charCodeAt(u)];u++)i++;let o=this.text.length;for(let u=this.text.length-1;u>=0&&u>=i&&Rp[this.text.charCodeAt(u)];u--)o--;this.text=this.text.substring(i,o),this.sectionIndex=this.sectionIndex.slice(i,o)}substring(i,o){let u=new vc;return u.text=this.text.substring(i,o),u.sectionIndex=this.sectionIndex.slice(i,o),u.sections=this.sections,u}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((i,o)=>Math.max(i,this.sections[o].scale),0)}addTextSection(i,o){this.text+=i.text,this.sections.push(xu.forText(i.scale,i.fontStack||o));let u=this.sections.length-1;for(let f=0;f<i.text.length;++f)this.sectionIndex.push(u)}addImageSection(i){let o=i.image?i.image.name:"";if(o.length===0)return void _i("Can't add FormattedSection with an empty image.");let u=this.getNextImageSectionCharCode();u?(this.text+=String.fromCharCode(u),this.sections.push(xu.forImage(o)),this.sectionIndex.push(this.sections.length-1)):_i("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Pp(a,i,o,u,f,_,y,w,C,I,L,k,B,N,G){let U=vc.fromFeature(a,f),Y;k===c.ai.vertical&&U.verticalizePunctuation();let{processBidirectionalText:te,processStyledBidirectionalText:de}=ys;if(te&&U.sections.length===1){Y=[];let H=te(U.toString(),Zm(U,I,_,i,u,N));for(let oe of H){let Se=new vc;Se.text=oe,Se.sections=U.sections;for(let Ge=0;Ge<oe.length;Ge++)Se.sectionIndex.push(0);Y.push(Se)}}else if(de){Y=[];let H=de(U.text,U.sectionIndex,Zm(U,I,_,i,u,N));for(let oe of H){let Se=new vc;Se.text=oe[0],Se.sectionIndex=oe[1],Se.sections=U.sections,Y.push(Se)}}else Y=function(H,oe){let Se=[],Ge=H.text,Me=0;for(let Le of oe)Se.push(H.substring(Me,Le)),Me=Le;return Me<Ge.length&&Se.push(H.substring(Me,Ge.length)),Se}(U,Zm(U,I,_,i,u,N));let se=[],j={positionedLines:se,text:U.toString(),top:L[1],bottom:L[1],left:L[0],right:L[0],writingMode:k,iconsInText:!1,verticalizable:!1};return function(H,oe,Se,Ge,Me,Le,Ze,Ve,qe,Be,rt,gt){let ft=0,at=yu,kt=0,vi=0,Zi=Ve==="right"?1:Ve==="left"?0:.5,rr=0;for(let Si of Me){Si.trim();let qi=Si.getMaxScale(),$r=(qi-1)*Ui,Xr={positionedGlyphs:[],lineOffset:0};H.positionedLines[rr]=Xr;let Hr=Xr.positionedGlyphs,Wi=0;if(!Si.length()){at+=Le,++rr;continue}for(let fn=0;fn<Si.length();fn++){let Ut=Si.getSection(fn),_r=Si.getSectionIndex(fn),mi=Si.getCharCode(fn),bi=0,Ji=null,ll=null,qn=null,Bp=Ui,cs=!(qe===c.ai.horizontal||!rt&&!Ja(mi)||rt&&(Rp[mi]||(ls=mi,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(ls)))));if(Ut.imageName){let xn=Ge[Ut.imageName];if(!xn)continue;qn=Ut.imageName,H.iconsInText=H.iconsInText||!0,ll=xn.paddedRect;let sr=xn.displaySize;Ut.scale=Ut.scale*Ui/gt,Ji={width:sr[0],height:sr[1],left:pn,top:-3,advance:cs?sr[1]:sr[0]},bi=$r+(Ui-sr[1]*Ut.scale),Bp=Ji.advance;let Wn=cs?sr[0]*Ut.scale-Ui*qi:sr[1]*Ut.scale-Ui*qi;Wn>0&&Wn>Wi&&(Wi=Wn)}else{let xn=Se[Ut.fontStack],sr=xn&&xn[mi];if(sr&&sr.rect)ll=sr.rect,Ji=sr.metrics;else{let Wn=oe[Ut.fontStack],To=Wn&&Wn[mi];if(!To)continue;Ji=To.metrics}bi=(qi-Ut.scale)*Ui}cs?(H.verticalizable=!0,Hr.push({glyph:mi,imageName:qn,x:ft,y:at+bi,vertical:cs,scale:Ut.scale,fontStack:Ut.fontStack,sectionIndex:_r,metrics:Ji,rect:ll}),ft+=Bp*Ut.scale+Be):(Hr.push({glyph:mi,imageName:qn,x:ft,y:at+bi,vertical:cs,scale:Ut.scale,fontStack:Ut.fontStack,sectionIndex:_r,metrics:Ji,rect:ll}),ft+=Ji.advance*Ut.scale+Be)}Hr.length!==0&&(kt=Math.max(ft-Be,kt),l2(Hr,0,Hr.length-1,Zi,Wi)),ft=0;let Zn=Le*qi+Wi;Xr.lineOffset=Math.max(Wi,$r),at+=Zn,vi=Math.max(Zn,vi),++rr}var ls;let Wr=at-yu,{horizontalAlign:nr,verticalAlign:gr}=qm(Ze);(function(Si,qi,$r,Xr,Hr,Wi,Zn,fn,Ut){let _r=(qi-$r)*Hr,mi=0;mi=Wi!==Zn?-fn*Xr-yu:(-Xr*Ut+.5)*Zn;for(let bi of Si)for(let Ji of bi.positionedGlyphs)Ji.x+=_r,Ji.y+=mi})(H.positionedLines,Zi,nr,gr,kt,vi,Le,Wr,Me.length),H.top+=-gr*Wr,H.bottom=H.top+Wr,H.left+=-nr*kt,H.right=H.left+kt}(j,i,o,u,Y,y,w,C,k,I,B,G),!function(H){for(let oe of H)if(oe.positionedGlyphs.length!==0)return!1;return!0}(se)&&j}let Rp={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},s2={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},o2={40:!0};function Ix(a,i,o,u,f,_){if(i.imageName){let y=u[i.imageName];return y?y.displaySize[0]*i.scale*Ui/_+f:0}{let y=o[i.fontStack],w=y&&y[a];return w?w.metrics.advance*i.scale+f:0}}function Ex(a,i,o,u){let f=Math.pow(a-i,2);return u?a<i?f/2:2*f:f+Math.abs(o)*o}function a2(a,i,o){let u=0;return a===10&&(u-=1e4),o&&(u+=150),a!==40&&a!==65288||(u+=50),i!==41&&i!==65289||(u+=50),u}function Px(a,i,o,u,f,_){let y=null,w=Ex(i,o,f,_);for(let C of u){let I=Ex(i-C.x,o,f,_)+C.badness;I<=w&&(y=C,w=I)}return{index:a,x:i,priorBreak:y,badness:w}}function Rx(a){return a?Rx(a.priorBreak).concat(a.index):[]}function Zm(a,i,o,u,f,_){if(!a)return[];let y=[],w=function(k,B,N,G,U,Y){let te=0;for(let de=0;de<k.length();de++){let se=k.getSection(de);te+=Ix(k.getCharCode(de),se,G,U,B,Y)}return te/Math.max(1,Math.ceil(te/N))}(a,i,o,u,f,_),C=a.text.indexOf("\u200B")>=0,I=0;for(let k=0;k<a.length();k++){let B=a.getSection(k),N=a.getCharCode(k);if(Rp[N]||(I+=Ix(N,B,u,f,i,_)),k<a.length()-1){let G=!((L=N)<11904)&&(!!zt["CJK Compatibility Forms"](L)||!!zt["CJK Compatibility"](L)||!!zt["CJK Strokes"](L)||!!zt["CJK Symbols and Punctuation"](L)||!!zt["Enclosed CJK Letters and Months"](L)||!!zt["Halfwidth and Fullwidth Forms"](L)||!!zt["Ideographic Description Characters"](L)||!!zt["Vertical Forms"](L)||qh.test(String.fromCodePoint(L)));(s2[N]||G||B.imageName||k!==a.length()-2&&o2[a.getCharCode(k+1)])&&y.push(Px(k+1,I,w,y,a2(N,a.getCharCode(k+1),G&&C),!1))}}var L;return Rx(Px(a.length(),I,w,y,0,!0))}function qm(a){let i=.5,o=.5;switch(a){case"right":case"top-right":case"bottom-right":i=1;break;case"left":case"top-left":case"bottom-left":i=0}switch(a){case"bottom":case"bottom-right":case"bottom-left":o=1;break;case"top":case"top-right":case"top-left":o=0}return{horizontalAlign:i,verticalAlign:o}}function l2(a,i,o,u,f){if(!u&&!f)return;let _=a[o],y=(a[o].x+_.metrics.advance*_.scale)*u;for(let w=i;w<=o;w++)a[w].x-=y,a[w].y+=f}function c2(a,i,o){let{horizontalAlign:u,verticalAlign:f}=qm(o),_=i[0]-a.displaySize[0]*u,y=i[1]-a.displaySize[1]*f;return{image:a,top:y,bottom:y+a.displaySize[1],left:_,right:_+a.displaySize[0]}}function Ax(a){var i,o;let u=a.left,f=a.top,_=a.right-u,y=a.bottom-f,w=(i=a.image.textFitWidth)!==null&&i!==void 0?i:"stretchOrShrink",C=(o=a.image.textFitHeight)!==null&&o!==void 0?o:"stretchOrShrink",I=(a.image.content[2]-a.image.content[0])/(a.image.content[3]-a.image.content[1]);if(C==="proportional"){if(w==="stretchOnly"&&_/y<I||w==="proportional"){let L=Math.ceil(y*I);u*=L/_,_=L}}else if(w==="proportional"&&C==="stretchOnly"&&I!==0&&_/y>I){let L=Math.ceil(_/I);f*=L/y,y=L}return{x1:u,y1:f,x2:u+_,y2:f+y}}function Lx(a,i,o,u,f,_){let y=a.image,w;if(y.content){let Y=y.content,te=y.pixelRatio||1;w=[Y[0]/te,Y[1]/te,y.displaySize[0]-Y[2]/te,y.displaySize[1]-Y[3]/te]}let C=i.left*_,I=i.right*_,L,k,B,N;o==="width"||o==="both"?(N=f[0]+C-u[3],k=f[0]+I+u[1]):(N=f[0]+(C+I-y.displaySize[0])/2,k=N+y.displaySize[0]);let G=i.top*_,U=i.bottom*_;return o==="height"||o==="both"?(L=f[1]+G-u[0],B=f[1]+U+u[2]):(L=f[1]+(G+U-y.displaySize[1])/2,B=L+y.displaySize[1]),{image:y,top:L,right:k,bottom:B,left:N,collisionPadding:w}}let vu=255,Gs=128,na=vu*Gs;function kx(a,i){let{expression:o}=i;if(o.kind==="constant")return{kind:"constant",layoutSize:o.evaluate(new ii(a+1))};if(o.kind==="source")return{kind:"source"};{let{zoomStops:u,interpolationType:f}=o,_=0;for(;_<u.length&&u[_]<=a;)_++;_=Math.max(0,_-1);let y=_;for(;y<u.length&&u[y]<a+1;)y++;y=Math.min(u.length-1,y);let w=u[_],C=u[y];return o.kind==="composite"?{kind:"composite",minZoom:w,maxZoom:C,interpolationType:f}:{kind:"camera",minZoom:w,maxZoom:C,minSize:o.evaluate(new ii(w)),maxSize:o.evaluate(new ii(C)),interpolationType:f}}}function Wm(a,i,o){let u="never",f=a.get(i);return f?u=f:a.get(o)&&(u="always"),u}let h2=fu.VectorTileFeature.types,u2=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ap(a,i,o,u,f,_,y,w,C,I,L,k,B){let N=w?Math.min(na,Math.round(w[0])):0,G=w?Math.min(na,Math.round(w[1])):0;a.emplaceBack(i,o,Math.round(32*u),Math.round(32*f),_,y,(N<<1)+(C?1:0),G,16*I,16*L,256*k,256*B)}function $m(a,i,o){a.emplaceBack(i.x,i.y,o),a.emplaceBack(i.x,i.y,o),a.emplaceBack(i.x,i.y,o),a.emplaceBack(i.x,i.y,o)}function d2(a){for(let i of a.sections)if(pp(i.text))return!0;return!1}class Xm{constructor(i){this.layoutVertexArray=new fe,this.indexArray=new Fe,this.programConfigurations=i,this.segments=new Oe,this.dynamicLayoutVertexArray=new ue,this.opacityVertexArray=new we,this.hasVisibleVertices=!1,this.placedSymbolArray=new v}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(i,o,u,f){this.isEmpty()||(u&&(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,HS.members),this.indexBuffer=i.createIndexBuffer(this.indexArray,o),this.dynamicLayoutVertexBuffer=i.createVertexBuffer(this.dynamicLayoutVertexArray,YS.members,!0),this.opacityVertexBuffer=i.createVertexBuffer(this.opacityVertexArray,u2,!0),this.opacityVertexBuffer.itemSize=1),(u||f)&&this.programConfigurations.upload(i))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}it("SymbolBuffers",Xm);class Hm{constructor(i,o,u){this.layoutVertexArray=new i,this.layoutAttributes=o,this.indexArray=new u,this.segments=new Oe,this.collisionVertexArray=new ze}upload(i){this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=i.createVertexBuffer(this.collisionVertexArray,KS.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}it("CollisionBuffers",Hm);class bc{constructor(i){this.collisionBoxArray=i.collisionBoxArray,this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(y=>y.id),this.index=i.index,this.pixelRatio=i.pixelRatio,this.sourceLayerIndex=i.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let o=this.layers[0]._unevaluatedLayout._values;this.textSizeData=kx(this.zoom,o["text-size"]),this.iconSizeData=kx(this.zoom,o["icon-size"]);let u=this.layers[0].layout,f=u.get("symbol-sort-key"),_=u.get("symbol-z-order");this.canOverlap=Wm(u,"text-overlap","text-allow-overlap")!=="never"||Wm(u,"icon-overlap","icon-allow-overlap")!=="never"||u.get("text-ignore-placement")||u.get("icon-ignore-placement"),this.sortFeaturesByKey=_!=="viewport-y"&&!f.isConstant(),this.sortFeaturesByY=(_==="viewport-y"||_==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,u.get("symbol-placement")==="point"&&(this.writingModes=u.get("text-writing-mode").map(y=>c.ai[y])),this.stateDependentLayerIds=this.layers.filter(y=>y.isStateDependent()).map(y=>y.id),this.sourceID=i.sourceID}createArrays(){this.text=new Xm(new Yi(this.layers,this.zoom,i=>/^text/.test(i))),this.icon=new Xm(new Yi(this.layers,this.zoom,i=>/^icon/.test(i))),this.glyphOffsetArray=new P,this.lineVertexArray=new D,this.symbolInstances=new M,this.textAnchorOffsets=new O}calculateGlyphDependencies(i,o,u,f,_){for(let y=0;y<i.length;y++)if(o[i.charCodeAt(y)]=!0,(u||f)&&_){let w=_u[i.charAt(y)];w&&(o[w.charCodeAt(0)]=!0)}}populate(i,o,u){let f=this.layers[0],_=f.layout,y=_.get("text-font"),w=_.get("text-field"),C=_.get("icon-image"),I=(w.value.kind!=="constant"||w.value.value instanceof Cr&&!w.value.value.isEmpty()||w.value.value.toString().length>0)&&(y.value.kind!=="constant"||y.value.value.length>0),L=C.value.kind!=="constant"||!!C.value.value||Object.keys(C.parameters).length>0,k=_.get("symbol-sort-key");if(this.features=[],!I&&!L)return;let B=o.iconDependencies,N=o.glyphDependencies,G=o.availableImages,U=new ii(this.zoom);for(let{feature:Y,id:te,index:de,sourceLayerIndex:se}of i){let j=f._featureFilter.needGeometry,H=wo(Y,j);if(!f._featureFilter.filter(U,H,u))continue;let oe,Se;if(j||(H.geometry=bo(Y)),I){let Me=f.getValueAndResolveTokens("text-field",H,u,G),Le=Cr.factory(Me),Ze=this.hasRTLText=this.hasRTLText||d2(Le);(!Ze||ys.getRTLTextPluginStatus()==="unavailable"||Ze&&ys.isParsed())&&(oe=QS(Le,f,H))}if(L){let Me=f.getValueAndResolveTokens("icon-image",H,u,G);Se=Me instanceof Gr?Me:Gr.fromString(Me)}if(!oe&&!Se)continue;let Ge=this.sortFeaturesByKey?k.evaluate(H,{},u):void 0;if(this.features.push({id:te,text:oe,icon:Se,index:de,sourceLayerIndex:se,geometry:H.geometry,properties:Y.properties,type:h2[Y.type],sortKey:Ge}),Se&&(B[Se.name]=!0),oe){let Me=y.evaluate(H,{},u).join(","),Le=_.get("text-rotation-alignment")!=="viewport"&&_.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(c.ai.vertical)>=0;for(let Ze of oe.sections)if(Ze.image)B[Ze.image.name]=!0;else{let Ve=Ka(oe.toString()),qe=Ze.fontStack||Me,Be=N[qe]=N[qe]||{};this.calculateGlyphDependencies(Ze.text,Be,Le,this.allowVerticalPlacement,Ve)}}}_.get("symbol-placement")==="line"&&(this.features=function(Y){let te={},de={},se=[],j=0;function H(Me){se.push(Y[Me]),j++}function oe(Me,Le,Ze){let Ve=de[Me];return delete de[Me],de[Le]=Ve,se[Ve].geometry[0].pop(),se[Ve].geometry[0]=se[Ve].geometry[0].concat(Ze[0]),Ve}function Se(Me,Le,Ze){let Ve=te[Le];return delete te[Le],te[Me]=Ve,se[Ve].geometry[0].shift(),se[Ve].geometry[0]=Ze[0].concat(se[Ve].geometry[0]),Ve}function Ge(Me,Le,Ze){let Ve=Ze?Le[0][Le[0].length-1]:Le[0][0];return`${Me}:${Ve.x}:${Ve.y}`}for(let Me=0;Me<Y.length;Me++){let Le=Y[Me],Ze=Le.geometry,Ve=Le.text?Le.text.toString():null;if(!Ve){H(Me);continue}let qe=Ge(Ve,Ze),Be=Ge(Ve,Ze,!0);if(qe in de&&Be in te&&de[qe]!==te[Be]){let rt=Se(qe,Be,Ze),gt=oe(qe,Be,se[rt].geometry);delete te[qe],delete de[Be],de[Ge(Ve,se[gt].geometry,!0)]=gt,se[rt].geometry=null}else qe in de?oe(qe,Be,Ze):Be in te?Se(qe,Be,Ze):(H(Me),te[qe]=j-1,de[Be]=j-1)}return se.filter(Me=>Me.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((Y,te)=>Y.sortKey-te.sortKey)}update(i,o,u){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(i,o,this.layers,u),this.icon.programConfigurations.updatePaintArrays(i,o,this.layers,u))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(i){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(i),this.iconCollisionBox.upload(i)),this.text.upload(i,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(i,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(i,o){let u=this.lineVertexArray.length;if(i.segment!==void 0){let f=i.dist(o[i.segment+1]),_=i.dist(o[i.segment]),y={};for(let w=i.segment+1;w<o.length;w++)y[w]={x:o[w].x,y:o[w].y,tileUnitDistanceFromAnchor:f},w<o.length-1&&(f+=o[w+1].dist(o[w]));for(let w=i.segment||0;w>=0;w--)y[w]={x:o[w].x,y:o[w].y,tileUnitDistanceFromAnchor:_},w>0&&(_+=o[w-1].dist(o[w]));for(let w=0;w<o.length;w++){let C=y[w];this.lineVertexArray.emplaceBack(C.x,C.y,C.tileUnitDistanceFromAnchor)}}return{lineStartIndex:u,lineLength:this.lineVertexArray.length-u}}addSymbols(i,o,u,f,_,y,w,C,I,L,k,B){let N=i.indexArray,G=i.layoutVertexArray,U=i.segments.prepareSegment(4*o.length,G,N,this.canOverlap?y.sortKey:void 0),Y=this.glyphOffsetArray.length,te=U.vertexLength,de=this.allowVerticalPlacement&&w===c.ai.vertical?Math.PI/2:0,se=y.text&&y.text.sections;for(let j=0;j<o.length;j++){let{tl:H,tr:oe,bl:Se,br:Ge,tex:Me,pixelOffsetTL:Le,pixelOffsetBR:Ze,minFontScaleX:Ve,minFontScaleY:qe,glyphOffset:Be,isSDF:rt,sectionIndex:gt}=o[j],ft=U.vertexLength,at=Be[1];Ap(G,C.x,C.y,H.x,at+H.y,Me.x,Me.y,u,rt,Le.x,Le.y,Ve,qe),Ap(G,C.x,C.y,oe.x,at+oe.y,Me.x+Me.w,Me.y,u,rt,Ze.x,Le.y,Ve,qe),Ap(G,C.x,C.y,Se.x,at+Se.y,Me.x,Me.y+Me.h,u,rt,Le.x,Ze.y,Ve,qe),Ap(G,C.x,C.y,Ge.x,at+Ge.y,Me.x+Me.w,Me.y+Me.h,u,rt,Ze.x,Ze.y,Ve,qe),$m(i.dynamicLayoutVertexArray,C,de),N.emplaceBack(ft,ft+2,ft+1),N.emplaceBack(ft+1,ft+2,ft+3),U.vertexLength+=4,U.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Be[0]),j!==o.length-1&&gt===o[j+1].sectionIndex||i.programConfigurations.populatePaintArrays(G.length,y,y.index,{},B,se&&se[gt])}i.placedSymbolArray.emplaceBack(C.x,C.y,Y,this.glyphOffsetArray.length-Y,te,I,L,C.segment,u?u[0]:0,u?u[1]:0,f[0],f[1],w,0,!1,0,k)}_addCollisionDebugVertex(i,o,u,f,_,y){return o.emplaceBack(0,0),i.emplaceBack(u.x,u.y,f,_,Math.round(y.x),Math.round(y.y))}addCollisionDebugVertices(i,o,u,f,_,y,w){let C=_.segments.prepareSegment(4,_.layoutVertexArray,_.indexArray),I=C.vertexLength,L=_.layoutVertexArray,k=_.collisionVertexArray,B=w.anchorX,N=w.anchorY;this._addCollisionDebugVertex(L,k,y,B,N,new z(i,o)),this._addCollisionDebugVertex(L,k,y,B,N,new z(u,o)),this._addCollisionDebugVertex(L,k,y,B,N,new z(u,f)),this._addCollisionDebugVertex(L,k,y,B,N,new z(i,f)),C.vertexLength+=4;let G=_.indexArray;G.emplaceBack(I,I+1),G.emplaceBack(I+1,I+2),G.emplaceBack(I+2,I+3),G.emplaceBack(I+3,I),C.primitiveLength+=4}addDebugCollisionBoxes(i,o,u,f){for(let _=i;_<o;_++){let y=this.collisionBoxArray.get(_);this.addCollisionDebugVertices(y.x1,y.y1,y.x2,y.y2,f?this.textCollisionBox:this.iconCollisionBox,y.anchorPoint,u)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Hm(Ce,bx.members,Ae),this.iconCollisionBox=new Hm(Ce,bx.members,Ae);for(let i=0;i<this.symbolInstances.length;i++){let o=this.symbolInstances.get(i);this.addDebugCollisionBoxes(o.textBoxStartIndex,o.textBoxEndIndex,o,!0),this.addDebugCollisionBoxes(o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o,!0),this.addDebugCollisionBoxes(o.iconBoxStartIndex,o.iconBoxEndIndex,o,!1),this.addDebugCollisionBoxes(o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex,o,!1)}}_deserializeCollisionBoxesForSymbol(i,o,u,f,_,y,w,C,I){let L={};for(let k=o;k<u;k++){let B=i.get(k);L.textBox={x1:B.x1,y1:B.y1,x2:B.x2,y2:B.y2,anchorPointX:B.anchorPointX,anchorPointY:B.anchorPointY},L.textFeatureIndex=B.featureIndex;break}for(let k=f;k<_;k++){let B=i.get(k);L.verticalTextBox={x1:B.x1,y1:B.y1,x2:B.x2,y2:B.y2,anchorPointX:B.anchorPointX,anchorPointY:B.anchorPointY},L.verticalTextFeatureIndex=B.featureIndex;break}for(let k=y;k<w;k++){let B=i.get(k);L.iconBox={x1:B.x1,y1:B.y1,x2:B.x2,y2:B.y2,anchorPointX:B.anchorPointX,anchorPointY:B.anchorPointY},L.iconFeatureIndex=B.featureIndex;break}for(let k=C;k<I;k++){let B=i.get(k);L.verticalIconBox={x1:B.x1,y1:B.y1,x2:B.x2,y2:B.y2,anchorPointX:B.anchorPointX,anchorPointY:B.anchorPointY},L.verticalIconFeatureIndex=B.featureIndex;break}return L}deserializeCollisionBoxes(i){this.collisionArrays=[];for(let o=0;o<this.symbolInstances.length;o++){let u=this.symbolInstances.get(o);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(i,u.textBoxStartIndex,u.textBoxEndIndex,u.verticalTextBoxStartIndex,u.verticalTextBoxEndIndex,u.iconBoxStartIndex,u.iconBoxEndIndex,u.verticalIconBoxStartIndex,u.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(i,o){let u=i.placedSymbolArray.get(o),f=u.vertexStartIndex+4*u.numGlyphs;for(let _=u.vertexStartIndex;_<f;_+=4)i.indexArray.emplaceBack(_,_+2,_+1),i.indexArray.emplaceBack(_+1,_+2,_+3)}getSortedSymbolIndexes(i){if(this.sortedAngle===i&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let o=Math.sin(i),u=Math.cos(i),f=[],_=[],y=[];for(let w=0;w<this.symbolInstances.length;++w){y.push(w);let C=this.symbolInstances.get(w);f.push(0|Math.round(o*C.anchorX+u*C.anchorY)),_.push(C.featureIndex)}return y.sort((w,C)=>f[w]-f[C]||_[C]-_[w]),y}addToSortKeyRanges(i,o){let u=this.sortKeyRanges[this.sortKeyRanges.length-1];u&&u.sortKey===o?u.symbolInstanceEnd=i+1:this.sortKeyRanges.push({sortKey:o,symbolInstanceStart:i,symbolInstanceEnd:i+1})}sortFeatures(i){if(this.sortFeaturesByY&&this.sortedAngle!==i&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(i),this.sortedAngle=i,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let o of this.symbolInstanceIndexes){let u=this.symbolInstances.get(o);this.featureSortOrder.push(u.featureIndex),[u.rightJustifiedTextSymbolIndex,u.centerJustifiedTextSymbolIndex,u.leftJustifiedTextSymbolIndex].forEach((f,_,y)=>{f>=0&&y.indexOf(f)===_&&this.addIndicesForPlacedSymbol(this.text,f)}),u.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,u.verticalPlacedTextSymbolIndex),u.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,u.placedIconSymbolIndex),u.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,u.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Dx,Fx;it("SymbolBucket",bc,{omit:["layers","collisionBoxArray","features","compareText"]}),bc.MAX_GLYPHS=65535,bc.addDynamicAttributes=$m;var Ym={get paint(){return Fx=Fx||new Ir({"icon-opacity":new _t(K.paint_symbol["icon-opacity"]),"icon-color":new _t(K.paint_symbol["icon-color"]),"icon-halo-color":new _t(K.paint_symbol["icon-halo-color"]),"icon-halo-width":new _t(K.paint_symbol["icon-halo-width"]),"icon-halo-blur":new _t(K.paint_symbol["icon-halo-blur"]),"icon-translate":new lt(K.paint_symbol["icon-translate"]),"icon-translate-anchor":new lt(K.paint_symbol["icon-translate-anchor"]),"text-opacity":new _t(K.paint_symbol["text-opacity"]),"text-color":new _t(K.paint_symbol["text-color"],{runtimeType:wt,getOverride:a=>a.textColor,hasOverride:a=>!!a.textColor}),"text-halo-color":new _t(K.paint_symbol["text-halo-color"]),"text-halo-width":new _t(K.paint_symbol["text-halo-width"]),"text-halo-blur":new _t(K.paint_symbol["text-halo-blur"]),"text-translate":new lt(K.paint_symbol["text-translate"]),"text-translate-anchor":new lt(K.paint_symbol["text-translate-anchor"])})},get layout(){return Dx=Dx||new Ir({"symbol-placement":new lt(K.layout_symbol["symbol-placement"]),"symbol-spacing":new lt(K.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new lt(K.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new _t(K.layout_symbol["symbol-sort-key"]),"symbol-z-order":new lt(K.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new lt(K.layout_symbol["icon-allow-overlap"]),"icon-overlap":new lt(K.layout_symbol["icon-overlap"]),"icon-ignore-placement":new lt(K.layout_symbol["icon-ignore-placement"]),"icon-optional":new lt(K.layout_symbol["icon-optional"]),"icon-rotation-alignment":new lt(K.layout_symbol["icon-rotation-alignment"]),"icon-size":new _t(K.layout_symbol["icon-size"]),"icon-text-fit":new lt(K.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new lt(K.layout_symbol["icon-text-fit-padding"]),"icon-image":new _t(K.layout_symbol["icon-image"]),"icon-rotate":new _t(K.layout_symbol["icon-rotate"]),"icon-padding":new _t(K.layout_symbol["icon-padding"]),"icon-keep-upright":new lt(K.layout_symbol["icon-keep-upright"]),"icon-offset":new _t(K.layout_symbol["icon-offset"]),"icon-anchor":new _t(K.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new lt(K.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new lt(K.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new lt(K.layout_symbol["text-rotation-alignment"]),"text-field":new _t(K.layout_symbol["text-field"]),"text-font":new _t(K.layout_symbol["text-font"]),"text-size":new _t(K.layout_symbol["text-size"]),"text-max-width":new _t(K.layout_symbol["text-max-width"]),"text-line-height":new lt(K.layout_symbol["text-line-height"]),"text-letter-spacing":new _t(K.layout_symbol["text-letter-spacing"]),"text-justify":new _t(K.layout_symbol["text-justify"]),"text-radial-offset":new _t(K.layout_symbol["text-radial-offset"]),"text-variable-anchor":new lt(K.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new _t(K.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new _t(K.layout_symbol["text-anchor"]),"text-max-angle":new lt(K.layout_symbol["text-max-angle"]),"text-writing-mode":new lt(K.layout_symbol["text-writing-mode"]),"text-rotate":new _t(K.layout_symbol["text-rotate"]),"text-padding":new lt(K.layout_symbol["text-padding"]),"text-keep-upright":new lt(K.layout_symbol["text-keep-upright"]),"text-transform":new _t(K.layout_symbol["text-transform"]),"text-offset":new _t(K.layout_symbol["text-offset"]),"text-allow-overlap":new lt(K.layout_symbol["text-allow-overlap"]),"text-overlap":new lt(K.layout_symbol["text-overlap"]),"text-ignore-placement":new lt(K.layout_symbol["text-ignore-placement"]),"text-optional":new lt(K.layout_symbol["text-optional"])})}};class zx{constructor(i){if(i.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=i.property.overrides?i.property.overrides.runtimeType:pt,this.defaultValue=i}evaluate(i){if(i.formattedSection){let o=this.defaultValue.property.overrides;if(o&&o.hasOverride(i.formattedSection))return o.getOverride(i.formattedSection)}return i.feature&&i.featureState?this.defaultValue.evaluate(i.feature,i.featureState):this.defaultValue.property.specification.default}eachChild(i){this.defaultValue.isConstant()||i(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}it("FormatSectionOverride",zx,{omit:["defaultValue"]});class Lp extends ss{constructor(i){super(i,Ym)}recalculate(i,o){if(super.recalculate(i,o),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let u=this.layout.get("text-writing-mode");if(u){let f=[];for(let _ of u)f.indexOf(_)<0&&f.push(_);this.layout._values["text-writing-mode"]=f}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(i,o,u,f){let _=this.layout.get(i).evaluate(o,{},u,f),y=this._unevaluatedLayout._values[i];return y.isDataDriven()||Ga(y.value)||!_?_:function(w,C){return C.replace(/{([^{}]+)}/g,(I,L)=>w&&L in w?String(w[L]):"")}(o.properties,_)}createBucket(i){return new bc(i)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let i of Ym.paint.overridableProperties){if(!Lp.hasPaintOverride(this.layout,i))continue;let o=this.paint.get(i),u=new zx(o),f=new Ih(u,o.property.specification),_=null;_=o.value.kind==="constant"||o.value.kind==="source"?new Eh("source",f):new Ko("composite",f,o.value.zoomStops),this.paint._values[i]=new hn(o.property,_,o.parameters)}}_handleOverridablePaintPropertyUpdate(i,o,u){return!(!this.layout||o.isDataDriven()||u.isDataDriven())&&Lp.hasPaintOverride(this.layout,i)}static hasPaintOverride(i,o){let u=i.get("text-field"),f=Ym.paint.properties[o],_=!1,y=w=>{for(let C of w)if(f.overrides&&f.overrides.hasOverride(C))return void(_=!0)};if(u.value.kind==="constant"&&u.value.value instanceof Cr)y(u.value.value.sections);else if(u.value.kind==="source"){let w=I=>{_||(I instanceof oo&&wi(I.value)===Bs?y(I.value.sections):I instanceof Vr?y(I.sections):I.eachChild(w))},C=u.value;C._styleExpression&&w(C._styleExpression.expression)}return _}}let Ox;var p2={get paint(){return Ox=Ox||new Ir({"background-color":new lt(K.paint_background["background-color"]),"background-pattern":new sc(K.paint_background["background-pattern"]),"background-opacity":new lt(K.paint_background["background-opacity"])})}};class f2 extends ss{constructor(i){super(i,p2)}}let Bx;var m2={get paint(){return Bx=Bx||new Ir({"raster-opacity":new lt(K.paint_raster["raster-opacity"]),"raster-hue-rotate":new lt(K.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new lt(K.paint_raster["raster-brightness-min"]),"raster-brightness-max":new lt(K.paint_raster["raster-brightness-max"]),"raster-saturation":new lt(K.paint_raster["raster-saturation"]),"raster-contrast":new lt(K.paint_raster["raster-contrast"]),"raster-resampling":new lt(K.paint_raster["raster-resampling"]),"raster-fade-duration":new lt(K.paint_raster["raster-fade-duration"])})}};class g2 extends ss{constructor(i){super(i,m2)}}class _2 extends ss{constructor(i){super(i,{}),this.onAdd=o=>{this.implementation.onAdd&&this.implementation.onAdd(o,o.painter.context.gl)},this.onRemove=o=>{this.implementation.onRemove&&this.implementation.onRemove(o,o.painter.context.gl)},this.implementation=i}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class y2{constructor(i){this._methodToThrottle=i,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let Km=63710088e-1;class sa{constructor(i,o){if(isNaN(i)||isNaN(o))throw new Error(`Invalid LngLat object: (${i}, ${o})`);if(this.lng=+i,this.lat=+o,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new sa(jt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(i){let o=Math.PI/180,u=this.lat*o,f=i.lat*o,_=Math.sin(u)*Math.sin(f)+Math.cos(u)*Math.cos(f)*Math.cos((i.lng-this.lng)*o);return Km*Math.acos(Math.min(_,1))}static convert(i){if(i instanceof sa)return i;if(Array.isArray(i)&&(i.length===2||i.length===3))return new sa(Number(i[0]),Number(i[1]));if(!Array.isArray(i)&&typeof i=="object"&&i!==null)return new sa(Number("lng"in i?i.lng:i.lon),Number(i.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>]")}}let jx=2*Math.PI*Km;function Nx(a){return jx*Math.cos(a*Math.PI/180)}function Gx(a){return(180+a)/360}function Vx(a){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a*Math.PI/360)))/360}function Ux(a,i){return a/Nx(i)}function Jm(a){return 360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90}function Zx(a,i){return a*Nx(Jm(i))}class bu{constructor(i,o,u=0){this.x=+i,this.y=+o,this.z=+u}static fromLngLat(i,o=0){let u=sa.convert(i);return new bu(Gx(u.lng),Vx(u.lat),Ux(o,u.lat))}toLngLat(){return new sa(360*this.x-180,Jm(this.y))}toAltitude(){return Zx(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/jx*(i=Jm(this.y),1/Math.cos(i*Math.PI/180));var i}}function qx(a,i,o){var u=2*Math.PI*6378137/256/Math.pow(2,o);return[a*u-2*Math.PI*6378137/2,i*u-2*Math.PI*6378137/2]}class Qm{constructor(i,o,u){if(!function(f,_,y){return!(f<0||f>25||y<0||y>=Math.pow(2,f)||_<0||_>=Math.pow(2,f))}(i,o,u))throw new Error(`x=${o}, y=${u}, z=${i} outside of bounds. 0<=x<${Math.pow(2,i)}, 0<=y<${Math.pow(2,i)} 0<=z<=25 `);this.z=i,this.x=o,this.y=u,this.key=wc(0,i,i,o,u)}equals(i){return this.z===i.z&&this.x===i.x&&this.y===i.y}url(i,o,u){let f=(y=this.y,w=this.z,C=qx(256*(_=this.x),256*(y=Math.pow(2,w)-y-1),w),I=qx(256*(_+1),256*(y+1),w),C[0]+","+C[1]+","+I[0]+","+I[1]);var _,y,w,C,I;let L=function(k,B,N){let G,U="";for(let Y=k;Y>0;Y--)G=1<<Y-1,U+=(B&G?1:0)+(N&G?2:0);return U}(this.z,this.x,this.y);return i[(this.x+this.y)%i.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(u==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,o>1?"@2x":"").replace(/{quadkey}/g,L).replace(/{bbox-epsg-3857}/g,f)}isChildOf(i){let o=this.z-i.z;return o>0&&i.x===this.x>>o&&i.y===this.y>>o}getTilePoint(i){let o=Math.pow(2,this.z);return new z((i.x*o-this.x)*ut,(i.y*o-this.y)*ut)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Wx{constructor(i,o){this.wrap=i,this.canonical=o,this.key=wc(i,o.z,o.z,o.x,o.y)}}class Un{constructor(i,o,u,f,_){if(this.terrainRttPosMatrix32f=null,i<u)throw new Error(`overscaledZ should be >= z; overscaledZ = ${i}; z = ${u}`);this.overscaledZ=i,this.wrap=o,this.canonical=new Qm(u,+f,+_),this.key=wc(o,i,u,f,_)}clone(){return new Un(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(i){return this.overscaledZ===i.overscaledZ&&this.wrap===i.wrap&&this.canonical.equals(i.canonical)}scaledTo(i){if(i>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${i}; overscaledZ = ${this.overscaledZ}`);let o=this.canonical.z-i;return i>this.canonical.z?new Un(i,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Un(i,this.wrap,i,this.canonical.x>>o,this.canonical.y>>o)}calculateScaledKey(i,o){if(i>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${i}; overscaledZ = ${this.overscaledZ}`);let u=this.canonical.z-i;return i>this.canonical.z?wc(this.wrap*+o,i,this.canonical.z,this.canonical.x,this.canonical.y):wc(this.wrap*+o,i,i,this.canonical.x>>u,this.canonical.y>>u)}isChildOf(i){if(i.wrap!==this.wrap)return!1;let o=this.canonical.z-i.canonical.z;return i.overscaledZ===0||i.overscaledZ<this.overscaledZ&&i.canonical.x===this.canonical.x>>o&&i.canonical.y===this.canonical.y>>o}children(i){if(this.overscaledZ>=i)return[new Un(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let o=this.canonical.z+1,u=2*this.canonical.x,f=2*this.canonical.y;return[new Un(o,this.wrap,o,u,f),new Un(o,this.wrap,o,u+1,f),new Un(o,this.wrap,o,u,f+1),new Un(o,this.wrap,o,u+1,f+1)]}isLessThan(i){return this.wrap<i.wrap||!(this.wrap>i.wrap)&&(this.overscaledZ<i.overscaledZ||!(this.overscaledZ>i.overscaledZ)&&(this.canonical.x<i.canonical.x||!(this.canonical.x>i.canonical.x)&&this.canonical.y<i.canonical.y))}wrapped(){return new Un(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(i){return new Un(this.overscaledZ,i,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Wx(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(i){return this.canonical.getTilePoint(new bu(i.x-this.wrap,i.y))}}function wc(a,i,o,u,f){(a*=2)<0&&(a=-1*a-1);let _=1<<o;return(_*_*a+_*f+u).toString(36)+o.toString(36)+i.toString(36)}it("CanonicalTileID",Qm),it("OverscaledTileID",Un,{omit:["terrainRttPosMatrix32f"]});class $x{constructor(i,o,u,f=1,_=1,y=1,w=0){if(this.uid=i,o.height!==o.width)throw new RangeError("DEM tiles must be square");if(u&&!["mapbox","terrarium","custom"].includes(u))return void _i(`"${u}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=o.height;let C=this.dim=o.height-2;switch(this.data=new Uint32Array(o.data.buffer),u){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=f,this.greenFactor=_,this.blueFactor=y,this.baseShift=w;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let I=0;I<C;I++)this.data[this._idx(-1,I)]=this.data[this._idx(0,I)],this.data[this._idx(C,I)]=this.data[this._idx(C-1,I)],this.data[this._idx(I,-1)]=this.data[this._idx(I,0)],this.data[this._idx(I,C)]=this.data[this._idx(I,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 I=0;I<C;I++)for(let L=0;L<C;L++){let k=this.get(I,L);k>this.max&&(this.max=k),k<this.min&&(this.min=k)}}get(i,o){let u=new Uint8Array(this.data.buffer),f=4*this._idx(i,o);return this.unpack(u[f],u[f+1],u[f+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(i,o){if(i<-1||i>=this.dim+1||o<-1||o>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(o+1)*this.stride+(i+1)}unpack(i,o,u){return i*this.redFactor+o*this.greenFactor+u*this.blueFactor-this.baseShift}getPixels(){return new Vn({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(i,o,u){if(this.dim!==i.dim)throw new Error("dem dimension mismatch");let f=o*this.dim,_=o*this.dim+this.dim,y=u*this.dim,w=u*this.dim+this.dim;switch(o){case-1:f=_-1;break;case 1:_=f+1}switch(u){case-1:y=w-1;break;case 1:w=y+1}let C=-o*this.dim,I=-u*this.dim;for(let L=y;L<w;L++)for(let k=f;k<_;k++)this.data[this._idx(k,L)]=i.data[this._idx(k+C,L+I)]}}it("DEMData",$x);class Xx{constructor(i){this._stringToNumber={},this._numberToString=[];for(let o=0;o<i.length;o++){let u=i[o];this._stringToNumber[u]=o,this._numberToString[o]=u}}encode(i){return this._stringToNumber[i]}decode(i){if(i>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${i} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[i]}}class Hx{constructor(i,o,u,f,_){this.type="Feature",this._vectorTileFeature=i,i._z=o,i._x=u,i._y=f,this.properties=i.properties,this.id=_}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(i){this._geometry=i}toJSON(){let i={geometry:this.geometry};for(let o in this)o!=="_geometry"&&o!=="_vectorTileFeature"&&(i[o]=this[o]);return i}}class Yx{constructor(i,o){this.tileID=i,this.x=i.canonical.x,this.y=i.canonical.y,this.z=i.canonical.z,this.grid=new $a(ut,16,0),this.grid3D=new $a(ut,16,0),this.featureIndexArray=new q,this.promoteId=o}insert(i,o,u,f,_,y){let w=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(u,f,_);let C=y?this.grid3D:this.grid;for(let I=0;I<o.length;I++){let L=o[I],k=[1/0,1/0,-1/0,-1/0];for(let B=0;B<L.length;B++){let N=L[B];k[0]=Math.min(k[0],N.x),k[1]=Math.min(k[1],N.y),k[2]=Math.max(k[2],N.x),k[3]=Math.max(k[3],N.y)}k[0]<ut&&k[1]<ut&&k[2]>=0&&k[3]>=0&&C.insert(w,k[0],k[1],k[2],k[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new fu.VectorTile(new Gm(this.rawTileData)).layers,this.sourceLayerCoder=new Xx(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(i,o,u,f){this.loadVTLayers();let _=i.params,y=ut/i.tileSize/i.scale,w=Ah(_.filter),C=i.queryGeometry,I=i.queryPadding*y,L=Jx(C),k=this.grid.query(L.minX-I,L.minY-I,L.maxX+I,L.maxY+I),B=Jx(i.cameraQueryGeometry),N=this.grid3D.query(B.minX-I,B.minY-I,B.maxX+I,B.maxY+I,(Y,te,de,se)=>function(j,H,oe,Se,Ge){for(let Le of j)if(H<=Le.x&&oe<=Le.y&&Se>=Le.x&&Ge>=Le.y)return!0;let Me=[new z(H,oe),new z(H,Ge),new z(Se,Ge),new z(Se,oe)];if(j.length>2){for(let Le of Me)if(gc(j,Le))return!0}for(let Le=0;Le<j.length-1;Le++)if(uS(j[Le],j[Le+1],Me))return!0;return!1}(i.cameraQueryGeometry,Y-I,te-I,de+I,se+I));for(let Y of N)k.push(Y);k.sort(x2);let G={},U;for(let Y=0;Y<k.length;Y++){let te=k[Y];if(te===U)continue;U=te;let de=this.featureIndexArray.get(te),se=null;this.loadMatchingFeature(G,de.bucketIndex,de.sourceLayerIndex,de.featureIndex,w,_.layers,_.availableImages,o,u,f,(j,H,oe)=>(se||(se=bo(j)),H.queryIntersectsFeature({queryGeometry:C,feature:j,featureState:oe,geometry:se,zoom:this.z,transform:i.transform,pixelsToTileUnits:y,pixelPosMatrix:i.pixelPosMatrix})))}return G}loadMatchingFeature(i,o,u,f,_,y,w,C,I,L,k){let B=this.bucketLayerIDs[o];if(y&&!B.some(Y=>y.has(Y)))return;let N=this.sourceLayerCoder.decode(u),G=this.vtLayers[N].feature(f);if(_.needGeometry){let Y=wo(G,!0);if(!_.filter(new ii(this.tileID.overscaledZ),Y,this.tileID.canonical))return}else if(!_.filter(new ii(this.tileID.overscaledZ),G))return;let U=this.getId(G,N);for(let Y=0;Y<B.length;Y++){let te=B[Y];if(y&&!y.has(te))continue;let de=C[te];if(!de)continue;let se={};U&&L&&(se=L.getState(de.sourceLayer||"_geojsonTileLayer",U));let j=$t({},I[te]);j.paint=Kx(j.paint,de.paint,G,se,w),j.layout=Kx(j.layout,de.layout,G,se,w);let H=!k||k(G,de,se);if(!H)continue;let oe=new Hx(G,this.z,this.x,this.y,U);oe.layer=j;let Se=i[te];Se===void 0&&(Se=i[te]=[]),Se.push({featureIndex:f,feature:oe,intersectionZ:H})}}lookupSymbolFeatures(i,o,u,f,_,y,w,C){let I={};this.loadVTLayers();let L=Ah(_);for(let k of i)this.loadMatchingFeature(I,u,f,k,L,y,w,C,o);return I}hasLayer(i){for(let o of this.bucketLayerIDs)for(let u of o)if(i===u)return!0;return!1}getId(i,o){var u;let f=i.id;return this.promoteId&&(f=i.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[o]],typeof f=="boolean"&&(f=Number(f)),f===void 0&&(!((u=i.properties)===null||u===void 0)&&u.cluster)&&this.promoteId&&(f=Number(i.properties.cluster_id))),f}}function Kx(a,i,o,u,f){return Bi(a,(_,y)=>{let w=i instanceof rc?i.get(y):null;return w&&w.evaluate?w.evaluate(o,u,f):w})}function Jx(a){let i=1/0,o=1/0,u=-1/0,f=-1/0;for(let _ of a)i=Math.min(i,_.x),o=Math.min(o,_.y),u=Math.max(u,_.x),f=Math.max(f,_.y);return{minX:i,minY:o,maxX:u,maxY:f}}function x2(a,i){return i-a}function Qx(a,i,o,u,f){let _=[];for(let y=0;y<a.length;y++){let w=a[y],C;for(let I=0;I<w.length-1;I++){let L=w[I],k=w[I+1];L.x<i&&k.x<i||(L.x<i?L=new z(i,L.y+(i-L.x)/(k.x-L.x)*(k.y-L.y))._round():k.x<i&&(k=new z(i,L.y+(i-L.x)/(k.x-L.x)*(k.y-L.y))._round()),L.y<o&&k.y<o||(L.y<o?L=new z(L.x+(o-L.y)/(k.y-L.y)*(k.x-L.x),o)._round():k.y<o&&(k=new z(L.x+(o-L.y)/(k.y-L.y)*(k.x-L.x),o)._round()),L.x>=u&&k.x>=u||(L.x>=u?L=new z(u,L.y+(u-L.x)/(k.x-L.x)*(k.y-L.y))._round():k.x>=u&&(k=new z(u,L.y+(u-L.x)/(k.x-L.x)*(k.y-L.y))._round()),L.y>=f&&k.y>=f||(L.y>=f?L=new z(L.x+(f-L.y)/(k.y-L.y)*(k.x-L.x),f)._round():k.y>=f&&(k=new z(L.x+(f-L.y)/(k.y-L.y)*(k.x-L.x),f)._round()),C&&L.equals(C[C.length-1])||(C=[L],_.push(C)),C.push(k)))))}}return _}it("FeatureIndex",Yx,{omit:["rawTileData","sourceLayerCoder"]});class oa extends z{constructor(i,o,u,f){super(i,o),this.angle=u,f!==void 0&&(this.segment=f)}clone(){return new oa(this.x,this.y,this.angle,this.segment)}}function ev(a,i,o,u,f){if(i.segment===void 0||o===0)return!0;let _=i,y=i.segment+1,w=0;for(;w>-o/2;){if(y--,y<0)return!1;w-=a[y].dist(_),_=a[y]}w+=a[y].dist(a[y+1]),y++;let C=[],I=0;for(;w<o/2;){let L=a[y],k=a[y+1];if(!k)return!1;let B=a[y-1].angleTo(L)-L.angleTo(k);for(B=Math.abs((B+3*Math.PI)%(2*Math.PI)-Math.PI),C.push({distance:w,angleDelta:B}),I+=B;w-C[0].distance>u;)I-=C.shift().angleDelta;if(I>f)return!1;y++,w+=L.dist(k)}return!0}function tv(a){let i=0;for(let o=0;o<a.length-1;o++)i+=a[o].dist(a[o+1]);return i}function iv(a,i,o){return a?.6*i*o:0}function rv(a,i){return Math.max(a?a.right-a.left:0,i?i.right-i.left:0)}function v2(a,i,o,u,f,_){let y=iv(o,f,_),w=rv(o,u)*_,C=0,I=tv(a)/2;for(let L=0;L<a.length-1;L++){let k=a[L],B=a[L+1],N=k.dist(B);if(C+N>I){let G=(I-C)/N,U=cn.number(k.x,B.x,G),Y=cn.number(k.y,B.y,G),te=new oa(U,Y,B.angleTo(k),L);return te._round(),!y||ev(a,te,w,y,i)?te:void 0}C+=N}}function b2(a,i,o,u,f,_,y,w,C){let I=iv(u,_,y),L=rv(u,f),k=L*y,B=a[0].x===0||a[0].x===C||a[0].y===0||a[0].y===C;return i-k<i/4&&(i=k+i/4),nv(a,B?i/2*w%i:(L/2+2*_)*y*w%i,i,I,o,k,B,!1,C)}function nv(a,i,o,u,f,_,y,w,C){let I=_/2,L=tv(a),k=0,B=i-o,N=[];for(let G=0;G<a.length-1;G++){let U=a[G],Y=a[G+1],te=U.dist(Y),de=Y.angleTo(U);for(;B+o<k+te;){B+=o;let se=(B-k)/te,j=cn.number(U.x,Y.x,se),H=cn.number(U.y,Y.y,se);if(j>=0&&j<C&&H>=0&&H<C&&B-I>=0&&B+I<=L){let oe=new oa(j,H,de,G);oe._round(),u&&!ev(a,oe,_,u,f)||N.push(oe)}}k+=te}return w||N.length||y||(N=nv(a,k/2,o,u,f,_,y,!0,C)),N}it("Anchor",oa);let wu=pn;function sv(a,i,o,u){let f=[],_=a.image,y=_.pixelRatio,w=_.paddedRect.w-2*wu,C=_.paddedRect.h-2*wu,I={x1:a.left,y1:a.top,x2:a.right,y2:a.bottom},L=_.stretchX||[[0,w]],k=_.stretchY||[[0,C]],B=(Be,rt)=>Be+rt[1]-rt[0],N=L.reduce(B,0),G=k.reduce(B,0),U=w-N,Y=C-G,te=0,de=N,se=0,j=G,H=0,oe=U,Se=0,Ge=Y;if(_.content&&u){let Be=_.content,rt=Be[2]-Be[0],gt=Be[3]-Be[1];(_.textFitWidth||_.textFitHeight)&&(I=Ax(a)),te=kp(L,0,Be[0]),se=kp(k,0,Be[1]),de=kp(L,Be[0],Be[2]),j=kp(k,Be[1],Be[3]),H=Be[0]-te,Se=Be[1]-se,oe=rt-de,Ge=gt-j}let Me=I.x1,Le=I.y1,Ze=I.x2-Me,Ve=I.y2-Le,qe=(Be,rt,gt,ft)=>{let at=Dp(Be.stretch-te,de,Ze,Me),kt=Fp(Be.fixed-H,oe,Be.stretch,N),vi=Dp(rt.stretch-se,j,Ve,Le),Zi=Fp(rt.fixed-Se,Ge,rt.stretch,G),rr=Dp(gt.stretch-te,de,Ze,Me),ls=Fp(gt.fixed-H,oe,gt.stretch,N),Wr=Dp(ft.stretch-se,j,Ve,Le),nr=Fp(ft.fixed-Se,Ge,ft.stretch,G),gr=new z(at,vi),Si=new z(rr,vi),qi=new z(rr,Wr),$r=new z(at,Wr),Xr=new z(kt/y,Zi/y),Hr=new z(ls/y,nr/y),Wi=i*Math.PI/180;if(Wi){let Ut=Math.sin(Wi),_r=Math.cos(Wi),mi=[_r,-Ut,Ut,_r];gr._matMult(mi),Si._matMult(mi),$r._matMult(mi),qi._matMult(mi)}let Zn=Be.stretch+Be.fixed,fn=rt.stretch+rt.fixed;return{tl:gr,tr:Si,bl:$r,br:qi,tex:{x:_.paddedRect.x+wu+Zn,y:_.paddedRect.y+wu+fn,w:gt.stretch+gt.fixed-Zn,h:ft.stretch+ft.fixed-fn},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Xr,pixelOffsetBR:Hr,minFontScaleX:oe/y/Ze,minFontScaleY:Ge/y/Ve,isSDF:o}};if(u&&(_.stretchX||_.stretchY)){let Be=ov(L,U,N),rt=ov(k,Y,G);for(let gt=0;gt<Be.length-1;gt++){let ft=Be[gt],at=Be[gt+1];for(let kt=0;kt<rt.length-1;kt++)f.push(qe(ft,rt[kt],at,rt[kt+1]))}}else f.push(qe({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:w+1},{fixed:0,stretch:C+1}));return f}function kp(a,i,o){let u=0;for(let f of a)u+=Math.max(i,Math.min(o,f[1]))-Math.max(i,Math.min(o,f[0]));return u}function ov(a,i,o){let u=[{fixed:-1,stretch:0}];for(let[f,_]of a){let y=u[u.length-1];u.push({fixed:f-y.stretch,stretch:y.stretch}),u.push({fixed:f-y.stretch,stretch:y.stretch+(_-f)})}return u.push({fixed:i+wu,stretch:o}),u}function Dp(a,i,o,u){return a/i*o+u}function Fp(a,i,o,u){return a-i*o/u}class zp{constructor(i,o,u,f,_,y,w,C,I,L){var k;if(this.boxStartIndex=i.length,I){let B=y.top,N=y.bottom,G=y.collisionPadding;G&&(B-=G[1],N+=G[3]);let U=N-B;U>0&&(U=Math.max(10,U),this.circleDiameter=U)}else{let B=!((k=y.image)===null||k===void 0)&&k.content&&(y.image.textFitWidth||y.image.textFitHeight)?Ax(y):{x1:y.left,y1:y.top,x2:y.right,y2:y.bottom};B.y1=B.y1*w-C[0],B.y2=B.y2*w+C[2],B.x1=B.x1*w-C[3],B.x2=B.x2*w+C[1];let N=y.collisionPadding;if(N&&(B.x1-=N[0]*w,B.y1-=N[1]*w,B.x2+=N[2]*w,B.y2+=N[3]*w),L){let G=new z(B.x1,B.y1),U=new z(B.x2,B.y1),Y=new z(B.x1,B.y2),te=new z(B.x2,B.y2),de=L*Math.PI/180;G._rotate(de),U._rotate(de),Y._rotate(de),te._rotate(de),B.x1=Math.min(G.x,U.x,Y.x,te.x),B.x2=Math.max(G.x,U.x,Y.x,te.x),B.y1=Math.min(G.y,U.y,Y.y,te.y),B.y2=Math.max(G.y,U.y,Y.y,te.y)}i.emplaceBack(o.x,o.y,B.x1,B.y1,B.x2,B.y2,u,f,_)}this.boxEndIndex=i.length}}class w2{constructor(i=[],o=(u,f)=>u<f?-1:u>f?1:0){if(this.data=i,this.length=this.data.length,this.compare=o,this.length>0)for(let u=(this.length>>1)-1;u>=0;u--)this._down(u)}push(i){this.data.push(i),this._up(this.length++)}pop(){if(this.length===0)return;let i=this.data[0],o=this.data.pop();return--this.length>0&&(this.data[0]=o,this._down(0)),i}peek(){return this.data[0]}_up(i){let{data:o,compare:u}=this,f=o[i];for(;i>0;){let _=i-1>>1,y=o[_];if(u(f,y)>=0)break;o[i]=y,i=_}o[i]=f}_down(i){let{data:o,compare:u}=this,f=this.length>>1,_=o[i];for(;i<f;){let y=1+(i<<1),w=y+1;if(w<this.length&&u(o[w],o[y])<0&&(y=w),u(o[y],_)>=0)break;o[i]=o[y],i=y}o[i]=_}}function S2(a,i=1,o=!1){let u=1/0,f=1/0,_=-1/0,y=-1/0,w=a[0];for(let N=0;N<w.length;N++){let G=w[N];(!N||G.x<u)&&(u=G.x),(!N||G.y<f)&&(f=G.y),(!N||G.x>_)&&(_=G.x),(!N||G.y>y)&&(y=G.y)}let C=Math.min(_-u,y-f),I=C/2,L=new w2([],T2);if(C===0)return new z(u,f);for(let N=u;N<_;N+=C)for(let G=f;G<y;G+=C)L.push(new Sc(N+I,G+I,I,a));let k=function(N){let G=0,U=0,Y=0,te=N[0];for(let de=0,se=te.length,j=se-1;de<se;j=de++){let H=te[de],oe=te[j],Se=H.x*oe.y-oe.x*H.y;U+=(H.x+oe.x)*Se,Y+=(H.y+oe.y)*Se,G+=3*Se}return new Sc(U/G,Y/G,0,N)}(a),B=L.length;for(;L.length;){let N=L.pop();(N.d>k.d||!k.d)&&(k=N,o&&console.log("found best %d after %d probes",Math.round(1e4*N.d)/1e4,B)),N.max-k.d<=i||(I=N.h/2,L.push(new Sc(N.p.x-I,N.p.y-I,I,a)),L.push(new Sc(N.p.x+I,N.p.y-I,I,a)),L.push(new Sc(N.p.x-I,N.p.y+I,I,a)),L.push(new Sc(N.p.x+I,N.p.y+I,I,a)),B+=4)}return o&&(console.log(`num probes: ${B}`),console.log(`best distance: ${k.d}`)),k.p}function T2(a,i){return i.max-a.max}function Sc(a,i,o,u){this.p=new z(a,i),this.h=o,this.d=function(f,_){let y=!1,w=1/0;for(let C=0;C<_.length;C++){let I=_[C];for(let L=0,k=I.length,B=k-1;L<k;B=L++){let N=I[L],G=I[B];N.y>f.y!=G.y>f.y&&f.x<(G.x-N.x)*(f.y-N.y)/(G.y-N.y)+N.x&&(y=!y),w=Math.min(w,G0(f,N,G))}}return(y?1:-1)*Math.sqrt(w)}(this.p,u),this.max=this.d+this.h*Math.SQRT2}var mr;c.av=void 0,(mr=c.av||(c.av={}))[mr.center=1]="center",mr[mr.left=2]="left",mr[mr.right=3]="right",mr[mr.top=4]="top",mr[mr.bottom=5]="bottom",mr[mr["top-left"]=6]="top-left",mr[mr["top-right"]=7]="top-right",mr[mr["bottom-left"]=8]="bottom-left",mr[mr["bottom-right"]=9]="bottom-right";let aa=7,eg=Number.POSITIVE_INFINITY;function av(a,i){return i[1]!==eg?function(o,u,f){let _=0,y=0;switch(u=Math.abs(u),f=Math.abs(f),o){case"top-right":case"top-left":case"top":y=f-aa;break;case"bottom-right":case"bottom-left":case"bottom":y=-f+aa}switch(o){case"top-right":case"bottom-right":case"right":_=-u;break;case"top-left":case"bottom-left":case"left":_=u}return[_,y]}(a,i[0],i[1]):function(o,u){let f=0,_=0;u<0&&(u=0);let y=u/Math.SQRT2;switch(o){case"top-right":case"top-left":_=y-aa;break;case"bottom-right":case"bottom-left":_=-y+aa;break;case"bottom":_=-u+aa;break;case"top":_=u-aa}switch(o){case"top-right":case"bottom-right":f=-y;break;case"top-left":case"bottom-left":f=y;break;case"left":f=u;break;case"right":f=-u}return[f,_]}(a,i[0])}function lv(a,i,o){var u;let f=a.layout,_=(u=f.get("text-variable-anchor-offset"))===null||u===void 0?void 0:u.evaluate(i,{},o);if(_){let w=_.values,C=[];for(let I=0;I<w.length;I+=2){let L=C[I]=w[I],k=w[I+1].map(B=>B*Ui);L.startsWith("top")?k[1]-=aa:L.startsWith("bottom")&&(k[1]+=aa),C[I+1]=k}return new ur(C)}let y=f.get("text-variable-anchor");if(y){let w;w=a._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[f.get("text-radial-offset").evaluate(i,{},o)*Ui,eg]:f.get("text-offset").evaluate(i,{},o).map(I=>I*Ui);let C=[];for(let I of y)C.push(I,av(I,w));return new ur(C)}return null}function tg(a){switch(a){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function C2(a,i,o,u,f,_,y,w,C,I,L,k){let B=_.textMaxSize.evaluate(i,{});B===void 0&&(B=y);let N=a.layers[0].layout,G=N.get("icon-offset").evaluate(i,{},L),U=hv(o.horizontal),Y=y/24,te=a.tilePixelRatio*Y,de=a.tilePixelRatio*B/24,se=a.tilePixelRatio*w,j=a.tilePixelRatio*N.get("symbol-spacing"),H=N.get("text-padding")*a.tilePixelRatio,oe=function(gt,ft,at,kt=1){let vi=gt.get("icon-padding").evaluate(ft,{},at),Zi=vi&&vi.values;return[Zi[0]*kt,Zi[1]*kt,Zi[2]*kt,Zi[3]*kt]}(N,i,L,a.tilePixelRatio),Se=N.get("text-max-angle")/180*Math.PI,Ge=N.get("text-rotation-alignment")!=="viewport"&&N.get("symbol-placement")!=="point",Me=N.get("icon-rotation-alignment")==="map"&&N.get("symbol-placement")!=="point",Le=N.get("symbol-placement"),Ze=j/2,Ve=N.get("icon-text-fit"),qe;u&&Ve!=="none"&&(a.allowVerticalPlacement&&o.vertical&&(qe=Lx(u,o.vertical,Ve,N.get("icon-text-fit-padding"),G,Y)),U&&(u=Lx(u,U,Ve,N.get("icon-text-fit-padding"),G,Y)));let Be=L?k.line.getGranularityForZoomLevel(L.z):1,rt=(gt,ft)=>{ft.x<0||ft.x>=ut||ft.y<0||ft.y>=ut||function(at,kt,vi,Zi,rr,ls,Wr,nr,gr,Si,qi,$r,Xr,Hr,Wi,Zn,fn,Ut,_r,mi,bi,Ji,ll,qn,Bp){let cs=at.addToLineVertexArray(kt,vi),xn,sr,Wn,To,fv=0,mv=0,gv=0,_v=0,cg=-1,hg=-1,Co={},yv=Gi("");if(at.allowVerticalPlacement&&Zi.vertical){let Rr=nr.layout.get("text-rotate").evaluate(bi,{},qn)+90;Wn=new zp(gr,kt,Si,qi,$r,Zi.vertical,Xr,Hr,Wi,Rr),Wr&&(To=new zp(gr,kt,Si,qi,$r,Wr,fn,Ut,Wi,Rr))}if(rr){let Rr=nr.layout.get("icon-rotate").evaluate(bi,{}),$n=nr.layout.get("icon-text-fit")!=="none",cl=sv(rr,Rr,ll,$n),vs=Wr?sv(Wr,Rr,ll,$n):void 0;sr=new zp(gr,kt,Si,qi,$r,rr,fn,Ut,!1,Rr),fv=4*cl.length;let hl=at.iconSizeData,Vs=null;hl.kind==="source"?(Vs=[Gs*nr.layout.get("icon-size").evaluate(bi,{})],Vs[0]>na&&_i(`${at.layerIds[0]}: Value for "icon-size" is >= ${vu}. Reduce your "icon-size".`)):hl.kind==="composite"&&(Vs=[Gs*Ji.compositeIconSizes[0].evaluate(bi,{},qn),Gs*Ji.compositeIconSizes[1].evaluate(bi,{},qn)],(Vs[0]>na||Vs[1]>na)&&_i(`${at.layerIds[0]}: Value for "icon-size" is >= ${vu}. Reduce your "icon-size".`)),at.addSymbols(at.icon,cl,Vs,mi,_r,bi,c.ai.none,kt,cs.lineStartIndex,cs.lineLength,-1,qn),cg=at.icon.placedSymbolArray.length-1,vs&&(mv=4*vs.length,at.addSymbols(at.icon,vs,Vs,mi,_r,bi,c.ai.vertical,kt,cs.lineStartIndex,cs.lineLength,-1,qn),hg=at.icon.placedSymbolArray.length-1)}let xv=Object.keys(Zi.horizontal);for(let Rr of xv){let $n=Zi.horizontal[Rr];if(!xn){yv=Gi($n.text);let vs=nr.layout.get("text-rotate").evaluate(bi,{},qn);xn=new zp(gr,kt,Si,qi,$r,$n,Xr,Hr,Wi,vs)}let cl=$n.positionedLines.length===1;if(gv+=cv(at,kt,$n,ls,nr,Wi,bi,Zn,cs,Zi.vertical?c.ai.horizontal:c.ai.horizontalOnly,cl?xv:[Rr],Co,cg,Ji,qn),cl)break}Zi.vertical&&(_v+=cv(at,kt,Zi.vertical,ls,nr,Wi,bi,Zn,cs,c.ai.vertical,["vertical"],Co,hg,Ji,qn));let E2=xn?xn.boxStartIndex:at.collisionBoxArray.length,P2=xn?xn.boxEndIndex:at.collisionBoxArray.length,R2=Wn?Wn.boxStartIndex:at.collisionBoxArray.length,A2=Wn?Wn.boxEndIndex:at.collisionBoxArray.length,L2=sr?sr.boxStartIndex:at.collisionBoxArray.length,k2=sr?sr.boxEndIndex:at.collisionBoxArray.length,D2=To?To.boxStartIndex:at.collisionBoxArray.length,F2=To?To.boxEndIndex:at.collisionBoxArray.length,xs=-1,jp=(Rr,$n)=>Rr&&Rr.circleDiameter?Math.max(Rr.circleDiameter,$n):$n;xs=jp(xn,xs),xs=jp(Wn,xs),xs=jp(sr,xs),xs=jp(To,xs);let vv=xs>-1?1:0;vv&&(xs*=Bp/Ui),at.glyphOffsetArray.length>=bc.MAX_GLYPHS&&_i("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),bi.sortKey!==void 0&&at.addToSortKeyRanges(at.symbolInstances.length,bi.sortKey);let z2=lv(nr,bi,qn),[O2,B2]=function(Rr,$n){let cl=Rr.length,vs=$n?.values;if(vs?.length>0)for(let hl=0;hl<vs.length;hl+=2){let Vs=vs[hl+1];Rr.emplaceBack(c.av[vs[hl]],Vs[0],Vs[1])}return[cl,Rr.length]}(at.textAnchorOffsets,z2);at.symbolInstances.emplaceBack(kt.x,kt.y,Co.right>=0?Co.right:-1,Co.center>=0?Co.center:-1,Co.left>=0?Co.left:-1,Co.vertical||-1,cg,hg,yv,E2,P2,R2,A2,L2,k2,D2,F2,Si,gv,_v,fv,mv,vv,0,Xr,xs,O2,B2)}(a,ft,gt,o,u,f,qe,a.layers[0],a.collisionBoxArray,i.index,i.sourceLayerIndex,a.index,te,[H,H,H,H],Ge,C,se,oe,Me,G,i,_,I,L,y)};if(Le==="line")for(let gt of Qx(i.geometry,0,0,ut,ut)){let ft=al(gt,Be),at=b2(ft,j,Se,o.vertical||U,u,24,de,a.overscaling,ut);for(let kt of at)U&&M2(a,U.text,Ze,kt)||rt(ft,kt)}else if(Le==="line-center"){for(let gt of i.geometry)if(gt.length>1){let ft=al(gt,Be),at=v2(ft,Se,o.vertical||U,u,24,de);at&&rt(ft,at)}}else if(i.type==="Polygon")for(let gt of $o(i.geometry,0)){let ft=S2(gt,16);rt(al(gt[0],Be,!0),new oa(ft.x,ft.y,0))}else if(i.type==="LineString")for(let gt of i.geometry){let ft=al(gt,Be);rt(ft,new oa(ft[0].x,ft[0].y,0))}else if(i.type==="Point")for(let gt of i.geometry)for(let ft of gt)rt([ft],new oa(ft.x,ft.y,0))}function cv(a,i,o,u,f,_,y,w,C,I,L,k,B,N,G){let U=function(de,se,j,H,oe,Se,Ge,Me){let Le=H.layout.get("text-rotate").evaluate(Se,{})*Math.PI/180,Ze=[];for(let Ve of se.positionedLines)for(let qe of Ve.positionedGlyphs){if(!qe.rect)continue;let Be=qe.rect||{},rt=n2+1,gt=!0,ft=1,at=0,kt=(oe||Me)&&qe.vertical,vi=qe.metrics.advance*qe.scale/2;if(Me&&se.verticalizable&&(at=Ve.lineOffset/2-(qe.imageName?-(Ui-qe.metrics.width*qe.scale)/2:(qe.scale-1)*Ui)),qe.imageName){let Ut=Ge[qe.imageName];gt=Ut.sdf,ft=Ut.pixelRatio,rt=pn/ft}let Zi=oe?[qe.x+vi,qe.y]:[0,0],rr=oe?[0,0]:[qe.x+vi+j[0],qe.y+j[1]-at],ls=[0,0];kt&&(ls=rr,rr=[0,0]);let Wr=qe.metrics.isDoubleResolution?2:1,nr=(qe.metrics.left-rt)*qe.scale-vi+rr[0],gr=(-qe.metrics.top-rt)*qe.scale+rr[1],Si=nr+Be.w/Wr*qe.scale/ft,qi=gr+Be.h/Wr*qe.scale/ft,$r=new z(nr,gr),Xr=new z(Si,gr),Hr=new z(nr,qi),Wi=new z(Si,qi);if(kt){let Ut=new z(-vi,vi-yu),_r=-Math.PI/2,mi=Ui/2-vi,bi=new z(5-yu-mi,-(qe.imageName?mi:0)),Ji=new z(...ls);$r._rotateAround(_r,Ut)._add(bi)._add(Ji),Xr._rotateAround(_r,Ut)._add(bi)._add(Ji),Hr._rotateAround(_r,Ut)._add(bi)._add(Ji),Wi._rotateAround(_r,Ut)._add(bi)._add(Ji)}if(Le){let Ut=Math.sin(Le),_r=Math.cos(Le),mi=[_r,-Ut,Ut,_r];$r._matMult(mi),Xr._matMult(mi),Hr._matMult(mi),Wi._matMult(mi)}let Zn=new z(0,0),fn=new z(0,0);Ze.push({tl:$r,tr:Xr,bl:Hr,br:Wi,tex:Be,writingMode:se.writingMode,glyphOffset:Zi,sectionIndex:qe.sectionIndex,isSDF:gt,pixelOffsetTL:Zn,pixelOffsetBR:fn,minFontScaleX:0,minFontScaleY:0})}return Ze}(0,o,w,f,_,y,u,a.allowVerticalPlacement),Y=a.textSizeData,te=null;Y.kind==="source"?(te=[Gs*f.layout.get("text-size").evaluate(y,{})],te[0]>na&&_i(`${a.layerIds[0]}: Value for "text-size" is >= ${vu}. Reduce your "text-size".`)):Y.kind==="composite"&&(te=[Gs*N.compositeTextSizes[0].evaluate(y,{},G),Gs*N.compositeTextSizes[1].evaluate(y,{},G)],(te[0]>na||te[1]>na)&&_i(`${a.layerIds[0]}: Value for "text-size" is >= ${vu}. Reduce your "text-size".`)),a.addSymbols(a.text,U,te,w,_,y,I,i,C.lineStartIndex,C.lineLength,B,G);for(let de of L)k[de]=a.text.placedSymbolArray.length-1;return 4*U.length}function hv(a){for(let i in a)return a[i];return null}function M2(a,i,o,u){let f=a.compareText;if(i in f){let _=f[i];for(let y=_.length-1;y>=0;y--)if(u.dist(_[y])<o)return!0}else f[i]=[];return f[i].push(u),!1}let uv=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class ig{static from(i){if(!(i instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[o,u]=new Uint8Array(i,0,2);if(o!==219)throw new Error("Data does not appear to be in a KDBush format.");let f=u>>4;if(f!==1)throw new Error(`Got v${f} data when expected v1.`);let _=uv[15&u];if(!_)throw new Error("Unrecognized array type.");let[y]=new Uint16Array(i,2,1),[w]=new Uint32Array(i,4,1);return new ig(w,y,_,i)}constructor(i,o=64,u=Float64Array,f){if(isNaN(i)||i<0)throw new Error(`Unpexpected numItems value: ${i}.`);this.numItems=+i,this.nodeSize=Math.min(Math.max(+o,2),65535),this.ArrayType=u,this.IndexArrayType=i<65536?Uint16Array:Uint32Array;let _=uv.indexOf(this.ArrayType),y=2*i*this.ArrayType.BYTES_PER_ELEMENT,w=i*this.IndexArrayType.BYTES_PER_ELEMENT,C=(8-w%8)%8;if(_<0)throw new Error(`Unexpected typed array class: ${u}.`);f&&f instanceof ArrayBuffer?(this.data=f,this.ids=new this.IndexArrayType(this.data,8,i),this.coords=new this.ArrayType(this.data,8+w+C,2*i),this._pos=2*i,this._finished=!0):(this.data=new ArrayBuffer(8+y+w+C),this.ids=new this.IndexArrayType(this.data,8,i),this.coords=new this.ArrayType(this.data,8+w+C,2*i),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+_]),new Uint16Array(this.data,2,1)[0]=o,new Uint32Array(this.data,4,1)[0]=i)}add(i,o){let u=this._pos>>1;return this.ids[u]=u,this.coords[this._pos++]=i,this.coords[this._pos++]=o,u}finish(){let i=this._pos>>1;if(i!==this.numItems)throw new Error(`Added ${i} items when expected ${this.numItems}.`);return rg(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(i,o,u,f){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:_,coords:y,nodeSize:w}=this,C=[0,_.length-1,0],I=[];for(;C.length;){let L=C.pop()||0,k=C.pop()||0,B=C.pop()||0;if(k-B<=w){for(let Y=B;Y<=k;Y++){let te=y[2*Y],de=y[2*Y+1];te>=i&&te<=u&&de>=o&&de<=f&&I.push(_[Y])}continue}let N=B+k>>1,G=y[2*N],U=y[2*N+1];G>=i&&G<=u&&U>=o&&U<=f&&I.push(_[N]),(L===0?i<=G:o<=U)&&(C.push(B),C.push(N-1),C.push(1-L)),(L===0?u>=G:f>=U)&&(C.push(N+1),C.push(k),C.push(1-L))}return I}within(i,o,u){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:f,coords:_,nodeSize:y}=this,w=[0,f.length-1,0],C=[],I=u*u;for(;w.length;){let L=w.pop()||0,k=w.pop()||0,B=w.pop()||0;if(k-B<=y){for(let Y=B;Y<=k;Y++)pv(_[2*Y],_[2*Y+1],i,o)<=I&&C.push(f[Y]);continue}let N=B+k>>1,G=_[2*N],U=_[2*N+1];pv(G,U,i,o)<=I&&C.push(f[N]),(L===0?i-u<=G:o-u<=U)&&(w.push(B),w.push(N-1),w.push(1-L)),(L===0?i+u>=G:o+u>=U)&&(w.push(N+1),w.push(k),w.push(1-L))}return C}}function rg(a,i,o,u,f,_){if(f-u<=o)return;let y=u+f>>1;dv(a,i,y,u,f,_),rg(a,i,o,u,y-1,1-_),rg(a,i,o,y+1,f,1-_)}function dv(a,i,o,u,f,_){for(;f>u;){if(f-u>600){let I=f-u+1,L=o-u+1,k=Math.log(I),B=.5*Math.exp(2*k/3),N=.5*Math.sqrt(k*B*(I-B)/I)*(L-I/2<0?-1:1);dv(a,i,o,Math.max(u,Math.floor(o-L*B/I+N)),Math.min(f,Math.floor(o+(I-L)*B/I+N)),_)}let y=i[2*o+_],w=u,C=f;for(Su(a,i,u,o),i[2*f+_]>y&&Su(a,i,u,f);w<C;){for(Su(a,i,w,C),w++,C--;i[2*w+_]<y;)w++;for(;i[2*C+_]>y;)C--}i[2*u+_]===y?Su(a,i,u,C):(C++,Su(a,i,C,f)),C<=o&&(u=C+1),o<=C&&(f=C-1)}}function Su(a,i,o,u){ng(a,o,u),ng(i,2*o,2*u),ng(i,2*o+1,2*u+1)}function ng(a,i,o){let u=a[i];a[i]=a[o],a[o]=u}function pv(a,i,o,u){let f=a-o,_=i-u;return f*f+_*_}var sg;c.ce=void 0,(sg=c.ce||(c.ce={})).create="create",sg.load="load",sg.fullLoad="fullLoad";let Op=null,Tu=[],og=1e3/60,ag="loadTime",lg="fullLoadTime",I2={mark(a){performance.mark(a)},frame(a){let i=a;Op!=null&&Tu.push(i-Op),Op=i},clearMetrics(){Op=null,Tu=[],performance.clearMeasures(ag),performance.clearMeasures(lg);for(let a in c.ce)performance.clearMarks(c.ce[a])},getPerformanceMetrics(){performance.measure(ag,c.ce.create,c.ce.load),performance.measure(lg,c.ce.create,c.ce.fullLoad);let a=performance.getEntriesByName(ag)[0].duration,i=performance.getEntriesByName(lg)[0].duration,o=Tu.length,u=1/(Tu.reduce((_,y)=>_+y,0)/o/1e3),f=Tu.filter(_=>_>og).reduce((_,y)=>_+(y-og)/og,0);return{loadTime:a,fullLoadTime:i,fps:u,percentDroppedFrames:f/(o+f)*100,totalFrames:o}}};c.$=pe,c.A=je,c.B=vm,c.C=function(a){if(oi==null){let i=a.navigator?a.navigator.userAgent:null;oi=!!a.safari||!(!i||!(/\b(iPad|iPhone|iPod)\b/.test(i)||i.match("Safari")&&!i.match("Chrome")))}return oi},c.D=lt,c.E=On,c.F=class{constructor(a,i){this.target=a,this.mapId=i,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new y2(()=>this.process()),this.subscription=function(o,u,f,_){return o.addEventListener(u,f,!1),{unsubscribe:()=>{o.removeEventListener(u,f,!1)}}}(this.target,"message",o=>this.receive(o)),this.globalScope=tn(self)?a:window}registerMessageHandler(a,i){this.messageHandlers[a]=i}sendAsync(a,i){return new Promise((o,u)=>{let f=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[f]={resolve:o,reject:u},i&&i.signal.addEventListener("abort",()=>{delete this.resolveRejects[f];let w={id:f,type:"<cancel>",origin:location.origin,targetMapId:a.targetMapId,sourceMapId:this.mapId};this.target.postMessage(w)},{once:!0});let _=[],y=Object.assign(Object.assign({},a),{id:f,sourceMapId:this.mapId,origin:location.origin,data:Xa(a.data,_)});this.target.postMessage(y,{transfer:_})})}receive(a){let i=a.data,o=i.id;if(!(i.origin!=="file://"&&location.origin!=="file://"&&i.origin!=="resource://android"&&location.origin!=="resource://android"&&i.origin!==location.origin||i.targetMapId&&this.mapId!==i.targetMapId)){if(i.type==="<cancel>"){delete this.tasks[o];let u=this.abortControllers[o];return delete this.abortControllers[o],void(u&&u.abort())}if(tn(self)||i.mustQueue)return this.tasks[o]=i,this.taskQueue.push(o),void this.invoker.trigger();this.processTask(o,i)}}process(){if(this.taskQueue.length===0)return;let a=this.taskQueue.shift(),i=this.tasks[a];delete this.tasks[a],this.taskQueue.length>0&&this.invoker.trigger(),i&&this.processTask(a,i)}processTask(a,i){return n(this,void 0,void 0,function*(){if(i.type==="<response>"){let f=this.resolveRejects[a];return delete this.resolveRejects[a],f?void(i.error?f.reject(Ha(i.error)):f.resolve(Ha(i.data))):void 0}if(!this.messageHandlers[i.type])return void this.completeTask(a,new Error(`Could not find a registered handler for ${i.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let o=Ha(i.data),u=new AbortController;this.abortControllers[a]=u;try{let f=yield this.messageHandlers[i.type](i.sourceMapId,o,u);this.completeTask(a,null,f)}catch(f){this.completeTask(a,f)}})}completeTask(a,i,o){let u=[];delete this.abortControllers[a];let f={id:a,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:i?Xa(i):null,data:Xa(o,u)};this.target.postMessage(f,{transfer:u})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},c.G=Qn,c.H=function(){var a=new je(16);return je!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=0,a[12]=0,a[13]=0,a[14]=0),a[0]=1,a[5]=1,a[10]=1,a[15]=1,a},c.I=Um,c.J=function(a,i,o){var u,f,_,y,w,C,I,L,k,B,N,G,U=o[0],Y=o[1],te=o[2];return i===a?(a[12]=i[0]*U+i[4]*Y+i[8]*te+i[12],a[13]=i[1]*U+i[5]*Y+i[9]*te+i[13],a[14]=i[2]*U+i[6]*Y+i[10]*te+i[14],a[15]=i[3]*U+i[7]*Y+i[11]*te+i[15]):(f=i[1],_=i[2],y=i[3],w=i[4],C=i[5],I=i[6],L=i[7],k=i[8],B=i[9],N=i[10],G=i[11],a[0]=u=i[0],a[1]=f,a[2]=_,a[3]=y,a[4]=w,a[5]=C,a[6]=I,a[7]=L,a[8]=k,a[9]=B,a[10]=N,a[11]=G,a[12]=u*U+w*Y+k*te+i[12],a[13]=f*U+C*Y+B*te+i[13],a[14]=_*U+I*Y+N*te+i[14],a[15]=y*U+L*Y+G*te+i[15]),a},c.K=function(a,i,o){var u=o[0],f=o[1],_=o[2];return a[0]=i[0]*u,a[1]=i[1]*u,a[2]=i[2]*u,a[3]=i[3]*u,a[4]=i[4]*f,a[5]=i[5]*f,a[6]=i[6]*f,a[7]=i[7]*f,a[8]=i[8]*_,a[9]=i[9]*_,a[10]=i[10]*_,a[11]=i[11]*_,a[12]=i[12],a[13]=i[13],a[14]=i[14],a[15]=i[15],a},c.L=function(a,i,o){var u=i[0],f=i[1],_=i[2],y=i[3],w=i[4],C=i[5],I=i[6],L=i[7],k=i[8],B=i[9],N=i[10],G=i[11],U=i[12],Y=i[13],te=i[14],de=i[15],se=o[0],j=o[1],H=o[2],oe=o[3];return a[0]=se*u+j*w+H*k+oe*U,a[1]=se*f+j*C+H*B+oe*Y,a[2]=se*_+j*I+H*N+oe*te,a[3]=se*y+j*L+H*G+oe*de,a[4]=(se=o[4])*u+(j=o[5])*w+(H=o[6])*k+(oe=o[7])*U,a[5]=se*f+j*C+H*B+oe*Y,a[6]=se*_+j*I+H*N+oe*te,a[7]=se*y+j*L+H*G+oe*de,a[8]=(se=o[8])*u+(j=o[9])*w+(H=o[10])*k+(oe=o[11])*U,a[9]=se*f+j*C+H*B+oe*Y,a[10]=se*_+j*I+H*N+oe*te,a[11]=se*y+j*L+H*G+oe*de,a[12]=(se=o[12])*u+(j=o[13])*w+(H=o[14])*k+(oe=o[15])*U,a[13]=se*f+j*C+H*B+oe*Y,a[14]=se*_+j*I+H*N+oe*te,a[15]=se*y+j*L+H*G+oe*de,a},c.M=function(a,i){let o={};for(let u=0;u<i.length;u++){let f=i[u];f in a&&(o[f]=a[f])}return o},c.N=sa,c.O=Gx,c.P=z,c.Q=Vx,c.R=Vn,c.S=Un,c.T=Hh,c.U=be,c.V=ve,c.W=Tr,c.X=ut,c.Y=bu,c.Z=Qm,c._=n,c.a=nn,c.a$=function(){return new Float64Array(16)},c.a0=a=>{let i=window.document.createElement("video");return i.muted=!0,new Promise(o=>{i.onloadstart=()=>{o(i)};for(let u of a){let f=window.document.createElement("source");Fn(u)||(i.crossOrigin="Anonymous"),f.src=u,i.appendChild(f)}})},c.a1=function(){return et++},c.a2=p,c.a3=bc,c.a4=Ah,c.a5=wo,c.a6=Hx,c.a7=function(a){let i={};if(a.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(o,u,f,_)=>{let y=f||_;return i[u]=!y||y.toLowerCase(),""}),i["max-age"]){let o=parseInt(i["max-age"],10);isNaN(o)?delete i["max-age"]:i["max-age"]=o}return i},c.a8=function(a){return Math.log(a)/Math.LN2},c.a9=function(a){var i=a[0],o=a[1];return i*i+o*o},c.aA=ri,c.aB=Mp,c.aC=Q,c.aD=Oe,c.aE=Fe,c.aF=85.051129,c.aG=function(a){return Math.pow(2,a)},c.aH=Ux,c.aI=jt,c.aJ=Li,c.aK=Zx,c.aL=function(a,i,o){return a[0]=i[0]*o,a[1]=i[1]*o,a[2]=i[2]*o,a},c.aM=function(a,i,o){return a[0]=i[0]+o[0],a[1]=i[1]+o[1],a[2]=i[2]+o[2],a},c.aN=function(a){var i=new je(3);return i[0]=a[0],i[1]=a[1],i[2]=a[2],i},c.aO=function(a,i,o){return a[0]=i[0]*o[0],a[1]=i[1]*o[1],a[2]=i[2]*o[2],a[3]=i[3]*o[3],a},c.aP=function(a,i,o){return a[0]=i[0]-o[0],a[1]=i[1]-o[1],a[2]=i[2]-o[2],a},c.aQ=function(a,i){var o=i[0],u=i[1],f=i[2],_=o*o+u*u+f*f;return _>0&&(_=1/Math.sqrt(_)),a[0]=i[0]*_,a[1]=i[1]*_,a[2]=i[2]*_,a},c.aR=function(a,i,o){var u=i[0],f=i[1],_=i[2],y=o[0],w=o[1],C=o[2];return a[0]=f*C-_*w,a[1]=_*y-u*C,a[2]=u*w-f*y,a},c.aS=function(a,i){return a[0]*i[0]+a[1]*i[1]+a[2]*i[2]},c.aT=Wx,c.aU=wc,c.aV=function(a,i,o,u,f){var _,y=1/Math.tan(i/2);return a[0]=y/o,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=y,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=-1,a[12]=0,a[13]=0,a[15]=0,f!=null&&f!==1/0?(a[10]=(f+u)*(_=1/(u-f)),a[14]=2*f*u*_):(a[10]=-1,a[14]=-2*u),a},c.aW=function(a){var i=new je(16);return i[0]=a[0],i[1]=a[1],i[2]=a[2],i[3]=a[3],i[4]=a[4],i[5]=a[5],i[6]=a[6],i[7]=a[7],i[8]=a[8],i[9]=a[9],i[10]=a[10],i[11]=a[11],i[12]=a[12],i[13]=a[13],i[14]=a[14],i[15]=a[15],i},c.aX=function(a,i,o){var u=Math.sin(o),f=Math.cos(o),_=i[0],y=i[1],w=i[2],C=i[3],I=i[4],L=i[5],k=i[6],B=i[7];return i!==a&&(a[8]=i[8],a[9]=i[9],a[10]=i[10],a[11]=i[11],a[12]=i[12],a[13]=i[13],a[14]=i[14],a[15]=i[15]),a[0]=_*f+I*u,a[1]=y*f+L*u,a[2]=w*f+k*u,a[3]=C*f+B*u,a[4]=I*f-_*u,a[5]=L*f-y*u,a[6]=k*f-w*u,a[7]=B*f-C*u,a},c.aY=function(a,i,o){var u=Math.sin(o),f=Math.cos(o),_=i[4],y=i[5],w=i[6],C=i[7],I=i[8],L=i[9],k=i[10],B=i[11];return i!==a&&(a[0]=i[0],a[1]=i[1],a[2]=i[2],a[3]=i[3],a[12]=i[12],a[13]=i[13],a[14]=i[14],a[15]=i[15]),a[4]=_*f+I*u,a[5]=y*f+L*u,a[6]=w*f+k*u,a[7]=C*f+B*u,a[8]=I*f-_*u,a[9]=L*f-y*u,a[10]=k*f-w*u,a[11]=B*f-C*u,a},c.aZ=function(){let a=new Float32Array(16);return tt(a),a},c.a_=function(){let a=new Float64Array(16);return tt(a),a},c.aa=function(a){return a*Math.PI/180},c.ab=Pt,c.ac=function(a,i){let o=[];for(let u in a)u in i||o.push(u);return o},c.ad=ct,c.ae=function(a){return Math.hypot(a[0],a[1])},c.af=function(a){return a[0]=0,a[1]=0,a},c.ag=function(a,i,o){return a[0]=i[0]*o,a[1]=i[1]*o,a},c.ah=function(a,i){let o=0,u=0;if(a.kind==="constant")u=a.layoutSize;else if(a.kind!=="source"){let{interpolationType:f,minZoom:_,maxZoom:y}=a,w=f?Pt(ir.interpolationFactor(f,i,_,y),0,1):0;a.kind==="camera"?u=cn.number(a.minSize,a.maxSize,w):o=w}return{uSizeT:o,uSize:u}},c.aj=function(a,{uSize:i,uSizeT:o},{lowerSize:u,upperSize:f}){return a.kind==="source"?u/Gs:a.kind==="composite"?cn.number(u/Gs,f/Gs,o):i},c.ak=$m,c.al=ot,c.am=function(a,i,o,u){let f=i.y-a.y,_=i.x-a.x,y=u.y-o.y,w=u.x-o.x,C=y*_-w*f;if(C===0)return null;let I=(w*(a.y-o.y)-y*(a.x-o.x))/C;return new z(a.x+I*_,a.y+I*f)},c.an=function(a,i){var o=i[0],u=i[1],f=i[2],_=i[3],y=i[4],w=i[5],C=i[6],I=i[7],L=i[8],k=i[9],B=i[10],N=i[11],G=i[12],U=i[13],Y=i[14],te=i[15],de=o*w-u*y,se=o*C-f*y,j=o*I-_*y,H=u*C-f*w,oe=u*I-_*w,Se=f*I-_*C,Ge=L*U-k*G,Me=L*Y-B*G,Le=L*te-N*G,Ze=k*Y-B*U,Ve=k*te-N*U,qe=B*te-N*Y,Be=de*qe-se*Ve+j*Ze+H*Le-oe*Me+Se*Ge;return Be?(a[0]=(w*qe-C*Ve+I*Ze)*(Be=1/Be),a[1]=(f*Ve-u*qe-_*Ze)*Be,a[2]=(U*Se-Y*oe+te*H)*Be,a[3]=(B*oe-k*Se-N*H)*Be,a[4]=(C*Le-y*qe-I*Me)*Be,a[5]=(o*qe-f*Le+_*Me)*Be,a[6]=(Y*j-G*Se-te*se)*Be,a[7]=(L*Se-B*j+N*se)*Be,a[8]=(y*Ve-w*Le+I*Ge)*Be,a[9]=(u*Le-o*Ve-_*Ge)*Be,a[10]=(G*oe-U*j+te*de)*Be,a[11]=(k*j-L*oe-N*de)*Be,a[12]=(w*Me-y*Ze-C*Ge)*Be,a[13]=(o*Ze-u*Me+f*Ge)*Be,a[14]=(U*se-G*H-Y*de)*Be,a[15]=(L*H-k*se+B*de)*Be,a):null},c.ao=Qx,c.ap=su,c.aq=tt,c.ar=function(a){let i=1/0,o=1/0,u=-1/0,f=-1/0;for(let _ of a)i=Math.min(i,_.x),o=Math.min(o,_.y),u=Math.max(u,_.x),f=Math.max(f,_.y);return[i,o,u,f]},c.as=Ui,c.at=yt,c.au=function(a,i,o,u,f=!1){if(!o[0]&&!o[1])return[0,0];let _=f?u==="map"?-a.bearingInRadians:0:u==="viewport"?a.bearingInRadians:0;if(_){let y=Math.sin(_),w=Math.cos(_);o=[o[0]*w-o[1]*y,o[0]*y+o[1]*w]}return[f?o[0]:yt(i,o[0],a.zoom),f?o[1]:yt(i,o[1],a.zoom)]},c.aw=Wm,c.ax=tg,c.ay=qm,c.az=ig,c.b=gn,c.b$=a=>a.type==="line",c.b0=function(a,i,o){let u=new Float64Array(4);return function(f,_,y,w){var C=.5*Math.PI/180;_*=C,y*=C,w*=C;var I=Math.sin(_),L=Math.cos(_),k=Math.sin(y),B=Math.cos(y),N=Math.sin(w),G=Math.cos(w);f[0]=I*B*G-L*k*N,f[1]=L*k*G+I*B*N,f[2]=L*B*N-I*k*G,f[3]=L*B*G+I*k*N}(u,a,i-90,o),u},c.b1=function(a,i,o,u){var f,_,y,w,C,I=i[0],L=i[1],k=i[2],B=i[3],N=o[0],G=o[1],U=o[2],Y=o[3];return(_=I*N+L*G+k*U+B*Y)<0&&(_=-_,N=-N,G=-G,U=-U,Y=-Y),1-_>ke?(f=Math.acos(_),y=Math.sin(f),w=Math.sin((1-u)*f)/y,C=Math.sin(u*f)/y):(w=1-u,C=u),a[0]=w*I+C*N,a[1]=w*L+C*G,a[2]=w*k+C*U,a[3]=w*B+C*Y,a},c.b2=function(a){let i=new Float64Array(9);var o,u,f,_,y,w,C,I,L,k,B,N,G,U,Y,te,de,se;k=(f=(u=a)[0])*(C=f+f),B=(_=u[1])*C,G=(y=u[2])*C,U=y*(I=_+_),te=(w=u[3])*C,de=w*I,se=w*(L=y+y),(o=i)[0]=1-(N=_*I)-(Y=y*L),o[3]=B-se,o[6]=G+de,o[1]=B+se,o[4]=1-k-Y,o[7]=U-te,o[2]=G-de,o[5]=U+te,o[8]=1-k-N;let j=Li(-Math.asin(Pt(i[2],-1,1))),H,oe;return Math.hypot(i[5],i[8])<.001?(H=0,oe=-Li(Math.atan2(i[3],i[4]))):(H=Li(i[5]===0&&i[8]===0?0:Math.atan2(i[5],i[8])),oe=Li(i[1]===0&&i[0]===0?0:Math.atan2(i[1],i[0]))),{roll:H,pitch:j+90,bearing:oe}},c.b3=function(a,i){return a.roll==i.roll&&a.pitch==i.pitch&&a.bearing==i.bearing},c.b4=Lt,c.b5=as,c.b6=xc,c.b7=du,c.b8=yc,c.b9=dt,c.bA=Bi,c.bB=Ai,c.bC=class extends un{constructor(a,i){super(a,i),this.current=0}set(a){this.current!==a&&(this.current=a,this.gl.uniform1i(this.location,a))}},c.bD=class extends un{constructor(a,i){super(a,i),this.current=pc}set(a){if(a[12]!==this.current[12]||a[0]!==this.current[0])return this.current=a,void this.gl.uniformMatrix4fv(this.location,!1,a);for(let i=1;i<16;i++)if(a[i]!==this.current[i]){this.current=a,this.gl.uniformMatrix4fv(this.location,!1,a);break}}},c.bE=vo,c.bF=nl,c.bG=class extends un{constructor(a,i){super(a,i),this.current=[0,0,0]}set(a){a[0]===this.current[0]&&a[1]===this.current[1]&&a[2]===this.current[2]||(this.current=a,this.gl.uniform3f(this.location,a[0],a[1],a[2]))}},c.bH=class extends un{constructor(a,i){super(a,i),this.current=[0,0]}set(a){a[0]===this.current[0]&&a[1]===this.current[1]||(this.current=a,this.gl.uniform2f(this.location,a[0],a[1]))}},c.bI=Re,c.bJ=function(a,i){var o=Math.sin(i),u=Math.cos(i);return a[0]=u,a[1]=o,a[2]=0,a[3]=-o,a[4]=u,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},c.bK=function(a,i,o){var u=i[0],f=i[1],_=i[2];return a[0]=u*o[0]+f*o[3]+_*o[6],a[1]=u*o[1]+f*o[4]+_*o[7],a[2]=u*o[2]+f*o[5]+_*o[8],a},c.bL=function(a,i,o,u,f,_,y){var w=1/(i-o),C=1/(u-f),I=1/(_-y);return a[0]=-2*w,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=-2*C,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2*I,a[11]=0,a[12]=(i+o)*w,a[13]=(f+u)*C,a[14]=(y+_)*I,a[15]=1,a},c.bM=class extends yo{},c.bN=JS,c.bO=class extends rl{},c.bP=Im,c.bQ=function(a){return a<=1?1:Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))},c.bR=H0,c.bS=function(a,i,o){var u=i[0],f=i[1],_=i[2],y=o[3]*u+o[7]*f+o[11]*_+o[15];return a[0]=(o[0]*u+o[4]*f+o[8]*_+o[12])/(y=y||1),a[1]=(o[1]*u+o[5]*f+o[9]*_+o[13])/y,a[2]=(o[2]*u+o[6]*f+o[10]*_+o[14])/y,a},c.bT=class extends lc{},c.bU=class extends e{},c.bV=function(a,i){return a[0]===i[0]&&a[1]===i[1]&&a[2]===i[2]&&a[3]===i[3]&&a[4]===i[4]&&a[5]===i[5]&&a[6]===i[6]&&a[7]===i[7]&&a[8]===i[8]&&a[9]===i[9]&&a[10]===i[10]&&a[11]===i[11]&&a[12]===i[12]&&a[13]===i[13]&&a[14]===i[14]&&a[15]===i[15]},c.bW=function(a,i){var o=a[0],u=a[1],f=a[2],_=a[3],y=a[4],w=a[5],C=a[6],I=a[7],L=a[8],k=a[9],B=a[10],N=a[11],G=a[12],U=a[13],Y=a[14],te=a[15],de=i[0],se=i[1],j=i[2],H=i[3],oe=i[4],Se=i[5],Ge=i[6],Me=i[7],Le=i[8],Ze=i[9],Ve=i[10],qe=i[11],Be=i[12],rt=i[13],gt=i[14],ft=i[15];return Math.abs(o-de)<=ke*Math.max(1,Math.abs(o),Math.abs(de))&&Math.abs(u-se)<=ke*Math.max(1,Math.abs(u),Math.abs(se))&&Math.abs(f-j)<=ke*Math.max(1,Math.abs(f),Math.abs(j))&&Math.abs(_-H)<=ke*Math.max(1,Math.abs(_),Math.abs(H))&&Math.abs(y-oe)<=ke*Math.max(1,Math.abs(y),Math.abs(oe))&&Math.abs(w-Se)<=ke*Math.max(1,Math.abs(w),Math.abs(Se))&&Math.abs(C-Ge)<=ke*Math.max(1,Math.abs(C),Math.abs(Ge))&&Math.abs(I-Me)<=ke*Math.max(1,Math.abs(I),Math.abs(Me))&&Math.abs(L-Le)<=ke*Math.max(1,Math.abs(L),Math.abs(Le))&&Math.abs(k-Ze)<=ke*Math.max(1,Math.abs(k),Math.abs(Ze))&&Math.abs(B-Ve)<=ke*Math.max(1,Math.abs(B),Math.abs(Ve))&&Math.abs(N-qe)<=ke*Math.max(1,Math.abs(N),Math.abs(qe))&&Math.abs(G-Be)<=ke*Math.max(1,Math.abs(G),Math.abs(Be))&&Math.abs(U-rt)<=ke*Math.max(1,Math.abs(U),Math.abs(rt))&&Math.abs(Y-gt)<=ke*Math.max(1,Math.abs(Y),Math.abs(gt))&&Math.abs(te-ft)<=ke*Math.max(1,Math.abs(te),Math.abs(ft))},c.bX=function(a,i){return a[0]=i[0],a[1]=i[1],a[2]=i[2],a[3]=i[3],a[4]=i[4],a[5]=i[5],a[6]=i[6],a[7]=i[7],a[8]=i[8],a[9]=i[9],a[10]=i[10],a[11]=i[11],a[12]=i[12],a[13]=i[13],a[14]=i[14],a[15]=i[15],a},c.bY=a=>a.type==="symbol",c.bZ=a=>a.type==="circle",c.b_=a=>a.type==="heatmap",c.ba=St,c.bb=tr,c.bc=function(a,i,o,u,f){return dt(u,f,Pt((a-i)/(o-i),0,1))},c.bd=xt,c.be=function(){return new Float64Array(4)},c.bf=function(){return new Float64Array(3)},c.bg=function(a,i,o,u){var f=[],_=[];return f[0]=i[0]-o[0],f[1]=i[1]-o[1],f[2]=i[2]-o[2],_[0]=f[0]*Math.cos(u)-f[1]*Math.sin(u),_[1]=f[0]*Math.sin(u)+f[1]*Math.cos(u),_[2]=f[2],a[0]=_[0]+o[0],a[1]=_[1]+o[1],a[2]=_[2]+o[2],a},c.bh=function(a,i,o,u){var f=[],_=[];return f[0]=i[0]-o[0],f[1]=i[1]-o[1],f[2]=i[2]-o[2],_[0]=f[0],_[1]=f[1]*Math.cos(u)-f[2]*Math.sin(u),_[2]=f[1]*Math.sin(u)+f[2]*Math.cos(u),a[0]=_[0]+o[0],a[1]=_[1]+o[1],a[2]=_[2]+o[2],a},c.bi=function(a,i,o,u){var f=[],_=[];return f[0]=i[0]-o[0],f[1]=i[1]-o[1],f[2]=i[2]-o[2],_[0]=f[2]*Math.sin(u)+f[0]*Math.cos(u),_[1]=f[1],_[2]=f[2]*Math.cos(u)-f[0]*Math.sin(u),a[0]=_[0]+o[0],a[1]=_[1]+o[1],a[2]=_[2]+o[2],a},c.bj=function(a,i,o){var u=Math.sin(o),f=Math.cos(o),_=i[0],y=i[1],w=i[2],C=i[3],I=i[8],L=i[9],k=i[10],B=i[11];return i!==a&&(a[4]=i[4],a[5]=i[5],a[6]=i[6],a[7]=i[7],a[12]=i[12],a[13]=i[13],a[14]=i[14],a[15]=i[15]),a[0]=_*f-I*u,a[1]=y*f-L*u,a[2]=w*f-k*u,a[3]=C*f-B*u,a[8]=_*u+I*f,a[9]=y*u+L*f,a[10]=w*u+k*f,a[11]=C*u+B*f,a},c.bk=function(a,i){let o=xt(a,360),u=xt(i,360),f=u-o,_=u>o?f-360:f+360;return Math.abs(f)<Math.abs(_)?f:_},c.bl=function(a){return a[0]=0,a[1]=0,a[2]=0,a},c.bm=function(a,i,o,u){let f=Math.sqrt(a*a+i*i),_=Math.sqrt(o*o+u*u);a/=f,i/=f,o/=_,u/=_;let y=Math.acos(a*o+i*u);return-i*o+a*u>0?y:-y},c.bn=function(a,i){return a[0]*i[0]+a[1]*i[1]+a[2]*i[2]+a[3]},c.bo=Km,c.bp=function(a,i){let o=xt(a,2*Math.PI),u=xt(i,2*Math.PI);return Math.min(Math.abs(o-u),Math.abs(o-u+2*Math.PI),Math.abs(o-u-2*Math.PI))},c.bq=function(a){return Math.hypot(a[0],a[1],a[2])},c.br=function(){let a={},i=K.$version;for(let o in K.$root){let u=K.$root[o];if(u.required){let f=null;f=o==="version"?i:u.type==="array"?[]:{},f!=null&&(a[o]=f)}}return a},c.bs=Ya,c.bt=sn,c.bu=function(a){a=a.slice();let i=Object.create(null);for(let o=0;o<a.length;o++)i[a[o].id]=a[o];for(let o=0;o<a.length;o++)"ref"in a[o]&&(a[o]=$(a[o],i[a[o].ref]));return a},c.bv=function(a){if(a.type==="custom")return new _2(a);switch(a.type){case"background":return new f2(a);case"circle":return new pS(a);case"fill":return new LS(a);case"fill-extrusion":return new NS(a);case"heatmap":return new mS(a);case"hillshade":return new _S(a);case"line":return new XS(a);case"raster":return new g2(a);case"symbol":return new Lp(a)}},c.bw=Ci,c.bx=function(a,i){if(!a)return[{command:"setStyle",args:[i]}];let o=[];try{if(!X(a.version,i.version))return[{command:"setStyle",args:[i]}];X(a.center,i.center)||o.push({command:"setCenter",args:[i.center]}),X(a.centerAltitude,i.centerAltitude)||o.push({command:"setCenterAltitude",args:[i.centerAltitude]}),X(a.zoom,i.zoom)||o.push({command:"setZoom",args:[i.zoom]}),X(a.bearing,i.bearing)||o.push({command:"setBearing",args:[i.bearing]}),X(a.pitch,i.pitch)||o.push({command:"setPitch",args:[i.pitch]}),X(a.roll,i.roll)||o.push({command:"setRoll",args:[i.roll]}),X(a.sprite,i.sprite)||o.push({command:"setSprite",args:[i.sprite]}),X(a.glyphs,i.glyphs)||o.push({command:"setGlyphs",args:[i.glyphs]}),X(a.transition,i.transition)||o.push({command:"setTransition",args:[i.transition]}),X(a.light,i.light)||o.push({command:"setLight",args:[i.light]}),X(a.terrain,i.terrain)||o.push({command:"setTerrain",args:[i.terrain]}),X(a.sky,i.sky)||o.push({command:"setSky",args:[i.sky]}),X(a.projection,i.projection)||o.push({command:"setProjection",args:[i.projection]});let u={},f=[];(function(y,w,C,I){let L;for(L in w=w||{},y=y||{})Object.prototype.hasOwnProperty.call(y,L)&&(Object.prototype.hasOwnProperty.call(w,L)||ye(L,C,I));for(L in w)Object.prototype.hasOwnProperty.call(w,L)&&(Object.prototype.hasOwnProperty.call(y,L)?X(y[L],w[L])||(y[L].type==="geojson"&&w[L].type==="geojson"&&_e(y,w,L)?ne(C,{command:"setGeoJSONSourceData",args:[L,w[L].data]}):Te(L,w,C,I)):he(L,w,C))})(a.sources,i.sources,f,u);let _=[];a.layers&&a.layers.forEach(y=>{"source"in y&&u[y.source]?o.push({command:"removeLayer",args:[y.id]}):_.push(y)}),o=o.concat(f),function(y,w,C){w=w||[];let I=(y=y||[]).map(Ie),L=w.map(Ie),k=y.reduce(xe,{}),B=w.reduce(xe,{}),N=I.slice(),G=Object.create(null),U,Y,te,de,se;for(let j=0,H=0;j<I.length;j++)U=I[j],Object.prototype.hasOwnProperty.call(B,U)?H++:(ne(C,{command:"removeLayer",args:[U]}),N.splice(N.indexOf(U,H),1));for(let j=0,H=0;j<L.length;j++)U=L[L.length-1-j],N[N.length-1-j]!==U&&(Object.prototype.hasOwnProperty.call(k,U)?(ne(C,{command:"removeLayer",args:[U]}),N.splice(N.lastIndexOf(U,N.length-H),1)):H++,de=N[N.length-j],ne(C,{command:"addLayer",args:[B[U],de]}),N.splice(N.length-j,0,U),G[U]=!0);for(let j=0;j<L.length;j++)if(U=L[j],Y=k[U],te=B[U],!G[U]&&!X(Y,te))if(X(Y.source,te.source)&&X(Y["source-layer"],te["source-layer"])&&X(Y.type,te.type)){for(se in Ee(Y.layout,te.layout,C,U,null,"setLayoutProperty"),Ee(Y.paint,te.paint,C,U,null,"setPaintProperty"),X(Y.filter,te.filter)||ne(C,{command:"setFilter",args:[U,te.filter]}),X(Y.minzoom,te.minzoom)&&X(Y.maxzoom,te.maxzoom)||ne(C,{command:"setLayerZoomRange",args:[U,te.minzoom,te.maxzoom]}),Y)Object.prototype.hasOwnProperty.call(Y,se)&&se!=="layout"&&se!=="paint"&&se!=="filter"&&se!=="metadata"&&se!=="minzoom"&&se!=="maxzoom"&&(se.indexOf("paint.")===0?Ee(Y[se],te[se],C,U,se.slice(6),"setPaintProperty"):X(Y[se],te[se])||ne(C,{command:"setLayerProperty",args:[U,se,te[se]]}));for(se in te)Object.prototype.hasOwnProperty.call(te,se)&&!Object.prototype.hasOwnProperty.call(Y,se)&&se!=="layout"&&se!=="paint"&&se!=="filter"&&se!=="metadata"&&se!=="minzoom"&&se!=="maxzoom"&&(se.indexOf("paint.")===0?Ee(Y[se],te[se],C,U,se.slice(6),"setPaintProperty"):X(Y[se],te[se])||ne(C,{command:"setLayerProperty",args:[U,se,te[se]]}))}else ne(C,{command:"removeLayer",args:[U]}),de=N[N.lastIndexOf(U)+1],ne(C,{command:"addLayer",args:[te,de]})}(_,i.layers,o)}catch(u){console.warn("Unable to compute style diff:",u),o=[{command:"setStyle",args:[i]}]}return o},c.by=function(a){let i=[],o=a.id;return o===void 0&&i.push({message:`layers.${o}: missing required property "id"`}),a.render===void 0&&i.push({message:`layers.${o}: missing required method "render"`}),a.renderingMode&&a.renderingMode!=="2d"&&a.renderingMode!=="3d"&&i.push({message:`layers.${o}: property "renderingMode" must be either "2d" or "3d"`}),i},c.bz=function a(i,o){if(Array.isArray(i)){if(!Array.isArray(o)||i.length!==o.length)return!1;for(let u=0;u<i.length;u++)if(!a(i[u],o[u]))return!1;return!0}if(typeof i=="object"&&i!==null&&o!==null){if(typeof o!="object"||Object.keys(i).length!==Object.keys(o).length)return!1;for(let u in i)if(!a(i[u],o[u]))return!1;return!0}return i===o},c.c=kn,c.c0=a=>a.type==="fill",c.c1=a=>a.type==="fill-extrusion",c.c2=a=>a.type==="hillshade",c.c3=a=>a.type==="raster",c.c4=a=>a.type==="background",c.c5=a=>a.type==="custom",c.c6=qt,c.c7=function(a,i,o){let u=It(i.x-o.x,i.y-o.y),f=It(a.x-o.x,a.y-o.y);var _,y;return Li(Math.atan2(u[0]*f[1]-u[1]*f[0],(_=u)[0]*(y=f)[0]+_[1]*y[1]))},c.c8=Ft,c.c9=function(a,i,o){var u=i[0],f=i[1];return a[0]=o[0]*u+o[4]*f+o[12],a[1]=o[1]*u+o[5]*f+o[13],a},c.cA=Tx,c.cB=Wl,c.cC=ys,c.ca=function(a,i){let{x:o,y:u}=bu.fromLngLat(i);return!(a<0||a>25||u<0||u>=1||o<0||o>=1)},c.cb=function(a,i){return a[0]=i[0],a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=i[1],a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=i[2],a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},c.cc=class extends ac{},c.cd=I2,c.cf=function(a){return a.message===rn},c.cg=Nr,c.ch=function(a,i){nn.REGISTERED_PROTOCOLS[a]=i},c.ci=function(a){delete nn.REGISTERED_PROTOCOLS[a]},c.cj=function(a,i){let o={};for(let f=0;f<a.length;f++){let _=i&&i[a[f].id]||zh(a[f]);i&&(i[a[f].id]=_);let y=o[_];y||(y=o[_]=[]),y.push(a[f])}let u=[];for(let f in o)u.push(o[f]);return u},c.ck=it,c.cl=Xx,c.cm=Yx,c.cn=Mx,c.co=function(a){a.bucket.createArrays(),a.bucket.tilePixelRatio=ut/(512*a.bucket.overscaling),a.bucket.compareText={},a.bucket.iconsNeedLinear=!1;let i=a.bucket.layers[0],o=i.layout,u=i._unevaluatedLayout._values,f={layoutIconSize:u["icon-size"].possiblyEvaluate(new ii(a.bucket.zoom+1),a.canonical),layoutTextSize:u["text-size"].possiblyEvaluate(new ii(a.bucket.zoom+1),a.canonical),textMaxSize:u["text-size"].possiblyEvaluate(new ii(18))};if(a.bucket.textSizeData.kind==="composite"){let{minZoom:I,maxZoom:L}=a.bucket.textSizeData;f.compositeTextSizes=[u["text-size"].possiblyEvaluate(new ii(I),a.canonical),u["text-size"].possiblyEvaluate(new ii(L),a.canonical)]}if(a.bucket.iconSizeData.kind==="composite"){let{minZoom:I,maxZoom:L}=a.bucket.iconSizeData;f.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new ii(I),a.canonical),u["icon-size"].possiblyEvaluate(new ii(L),a.canonical)]}let _=o.get("text-line-height")*Ui,y=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point",w=o.get("text-keep-upright"),C=o.get("text-size");for(let I of a.bucket.features){let L=o.get("text-font").evaluate(I,{},a.canonical).join(","),k=C.evaluate(I,{},a.canonical),B=f.layoutTextSize.evaluate(I,{},a.canonical),N=f.layoutIconSize.evaluate(I,{},a.canonical),G={horizontal:{},vertical:void 0},U=I.text,Y,te=[0,0];if(U){let j=U.toString(),H=o.get("text-letter-spacing").evaluate(I,{},a.canonical)*Ui,oe=ec(j)?H:0,Se=o.get("text-anchor").evaluate(I,{},a.canonical),Ge=lv(i,I,a.canonical);if(!Ge){let Ve=o.get("text-radial-offset").evaluate(I,{},a.canonical);te=Ve?av(Se,[Ve*Ui,eg]):o.get("text-offset").evaluate(I,{},a.canonical).map(qe=>qe*Ui)}let Me=y?"center":o.get("text-justify").evaluate(I,{},a.canonical),Le=o.get("symbol-placement")==="point"?o.get("text-max-width").evaluate(I,{},a.canonical)*Ui:1/0,Ze=()=>{a.bucket.allowVerticalPlacement&&Ka(j)&&(G.vertical=Pp(U,a.glyphMap,a.glyphPositions,a.imagePositions,L,Le,_,Se,"left",oe,te,c.ai.vertical,!0,B,k))};if(!y&&Ge){let Ve=new Set;if(Me==="auto")for(let Be=0;Be<Ge.values.length;Be+=2)Ve.add(tg(Ge.values[Be]));else Ve.add(Me);let qe=!1;for(let Be of Ve)if(!G.horizontal[Be])if(qe)G.horizontal[Be]=G.horizontal[0];else{let rt=Pp(U,a.glyphMap,a.glyphPositions,a.imagePositions,L,Le,_,"center",Be,oe,te,c.ai.horizontal,!1,B,k);rt&&(G.horizontal[Be]=rt,qe=rt.positionedLines.length===1)}Ze()}else{Me==="auto"&&(Me=tg(Se));let Ve=Pp(U,a.glyphMap,a.glyphPositions,a.imagePositions,L,Le,_,Se,Me,oe,te,c.ai.horizontal,!1,B,k);Ve&&(G.horizontal[Me]=Ve),Ze(),Ka(j)&&y&&w&&(G.vertical=Pp(U,a.glyphMap,a.glyphPositions,a.imagePositions,L,Le,_,Se,Me,oe,te,c.ai.vertical,!1,B,k))}}let de=!1;if(I.icon&&I.icon.name){let j=a.imageMap[I.icon.name];j&&(Y=c2(a.imagePositions[I.icon.name],o.get("icon-offset").evaluate(I,{},a.canonical),o.get("icon-anchor").evaluate(I,{},a.canonical)),de=!!j.sdf,a.bucket.sdfIcons===void 0?a.bucket.sdfIcons=de:a.bucket.sdfIcons!==de&&_i("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(j.pixelRatio!==a.bucket.pixelRatio||o.get("icon-rotate").constantOr(1)!==0)&&(a.bucket.iconsNeedLinear=!0))}let se=hv(G.horizontal)||G.vertical;a.bucket.iconsInText=!!se&&se.iconsInText,(se||Y)&&C2(a.bucket,I,G,Y,a.imageMap,f,B,N,te,de,a.canonical,a.subdivisionGranularity)}a.showCollisionBoxes&&a.bucket.generateCollisionDebugBuffers()},c.cp=Bm,c.cq=Lm,c.cr=Om,c.cs=fu,c.ct=Gm,c.cu=class{constructor(a){this._marks={start:[a.url,"start"].join("#"),end:[a.url,"end"].join("#"),measure:a.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let a=performance.getEntriesByName(this._marks.measure);return a.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),a=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),a}},c.cv=function(a,i,o,u,f){return n(this,void 0,void 0,function*(){if(ve())try{return yield Tr(a,i,o,u,f)}catch{}return function(_,y,w,C,I){let L=_.width,k=_.height;$i&&yi||($i=new OffscreenCanvas(L,k),yi=$i.getContext("2d",{willReadFrequently:!0})),$i.width=L,$i.height=k,yi.drawImage(_,0,0,L,k);let B=yi.getImageData(y,w,C,I);return yi.clearRect(0,0,L,k),B.data}(a,i,o,u,f)})},c.cw=$x,c.cx=x,c.cy=R,c.cz=dx,c.d=a=>n(void 0,void 0,void 0,function*(){if(a.byteLength===0)return createImageBitmap(new ImageData(1,1));let i=new Blob([new Uint8Array(a)],{type:"image/png"});try{return createImageBitmap(i)}catch(o){throw new Error(`Could not load image because of ${o.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),c.e=$t,c.f=a=>new Promise((i,o)=>{let u=new Image;u.onload=()=>{i(u),URL.revokeObjectURL(u.src),u.onload=null,window.requestAnimationFrame(()=>{u.src=Ln})},u.onerror=()=>o(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."));let f=new Blob([new Uint8Array(a)],{type:"image/png"});u.src=a.byteLength?URL.createObjectURL(f):Ln}),c.g=Dn,c.h=(a,i)=>on($t(a,{type:"json"}),i),c.i=tn,c.j=Os,c.k=zs,c.l=(a,i)=>on($t(a,{type:"arrayBuffer"}),i),c.m=on,c.n=function(a){return new Gm(a).readFields(t2,[])},c.o=au,c.p=Cx,c.q=Ir,c.r=xm,c.s=Fn,c.t=Ql,c.u=_o,c.v=K,c.w=_i,c.x=function([a,i,o]){return i+=90,i*=Math.PI/180,o*=Math.PI/180,{x:a*Math.cos(i)*Math.sin(o),y:a*Math.sin(i)*Math.sin(o),z:a*Math.cos(o)}},c.y=cn,c.z=ii}),r("worker",["./shared"],function(c){"use strict";class n{constructor(Z){this.keyCache={},Z&&this.replace(Z)}replace(Z){this._layerConfigs={},this._layers={},this.update(Z,[])}update(Z,$){for(let ne of Z){this._layerConfigs[ne.id]=ne;let he=this._layers[ne.id]=c.bv(ne);he._featureFilter=c.a4(he.filter),this.keyCache[ne.id]&&delete this.keyCache[ne.id]}for(let ne of $)delete this.keyCache[ne],delete this._layerConfigs[ne],delete this._layers[ne];this.familiesBySource={};let X=c.cj(Object.values(this._layerConfigs),this.keyCache);for(let ne of X){let he=ne.map(xe=>this._layers[xe.id]),ye=he[0];if(ye.visibility==="none")continue;let Te=ye.source||"",_e=this.familiesBySource[Te];_e||(_e=this.familiesBySource[Te]={});let Ee=ye.sourceLayer||"_geojsonTileLayer",Ie=_e[Ee];Ie||(Ie=_e[Ee]=[]),Ie.push(he)}}}class x{constructor(Z){let $={},X=[];for(let Te in Z){let _e=Z[Te],Ee=$[Te]={};for(let Ie in _e){let xe=_e[+Ie];if(!xe||xe.bitmap.width===0||xe.bitmap.height===0)continue;let pe={x:0,y:0,w:xe.bitmap.width+2,h:xe.bitmap.height+2};X.push(pe),Ee[Ie]={rect:pe,metrics:xe.metrics}}}let{w:ne,h:he}=c.p(X),ye=new c.o({width:ne||1,height:he||1});for(let Te in Z){let _e=Z[Te];for(let Ee in _e){let Ie=_e[+Ee];if(!Ie||Ie.bitmap.width===0||Ie.bitmap.height===0)continue;let xe=$[Te][Ee].rect;c.o.copy(Ie.bitmap,ye,{x:0,y:0},{x:xe.x+1,y:xe.y+1},Ie.bitmap)}}this.image=ye,this.positions=$}}c.ck("GlyphAtlas",x);class b{constructor(Z){this.tileID=new c.S(Z.tileID.overscaledZ,Z.tileID.wrap,Z.tileID.canonical.z,Z.tileID.canonical.x,Z.tileID.canonical.y),this.uid=Z.uid,this.zoom=Z.zoom,this.pixelRatio=Z.pixelRatio,this.tileSize=Z.tileSize,this.source=Z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=Z.showCollisionBoxes,this.collectResourceTiming=!!Z.collectResourceTiming,this.returnDependencies=!!Z.returnDependencies,this.promoteId=Z.promoteId,this.inFlightDependencies=[]}parse(Z,$,X,ne,he){return c._(this,void 0,void 0,function*(){this.status="parsing",this.data=Z,this.collisionBoxArray=new c.a2;let ye=new c.cl(Object.keys(Z.layers).sort()),Te=new c.cm(this.tileID,this.promoteId);Te.bucketLayerIDs=[];let _e={},Ee={featureIndex:Te,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:X,subdivisionGranularity:he},Ie=$.familiesBySource[this.source];for(let nt in Ie){let Ke=Z.layers[nt];if(!Ke)continue;Ke.version===1&&c.w(`Vector tile source "${this.source}" layer "${nt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let ai=ye.encode(nt),Bs=[];for(let ji=0;ji<Ke.length;ji++){let ki=Ke.feature(ji),li=Te.getId(ki,nt);Bs.push({feature:ki,id:li,index:ji,sourceLayerIndex:ai})}for(let ji of Ie[nt]){let ki=ji[0];ki.source!==this.source&&c.w(`layer.source = ${ki.source} does not equal this.source = ${this.source}`),ki.minzoom&&this.zoom<Math.floor(ki.minzoom)||ki.maxzoom&&this.zoom>=ki.maxzoom||ki.visibility!=="none"&&(S(ji,this.zoom,X),(_e[ki.id]=ki.createBucket({index:Te.bucketLayerIDs.length,layers:ji,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:ai,sourceID:this.source})).populate(Bs,Ee,this.tileID.canonical),Te.bucketLayerIDs.push(ji.map(li=>li.id)))}}let xe=c.bA(Ee.glyphDependencies,nt=>Object.keys(nt).map(Number));this.inFlightDependencies.forEach(nt=>nt?.abort()),this.inFlightDependencies=[];let pe=Promise.resolve({});if(Object.keys(xe).length){let nt=new AbortController;this.inFlightDependencies.push(nt),pe=ne.sendAsync({type:"GG",data:{stacks:xe,source:this.source,tileID:this.tileID,type:"glyphs"}},nt)}let Xe=Object.keys(Ee.iconDependencies),Ue=Promise.resolve({});if(Xe.length){let nt=new AbortController;this.inFlightDependencies.push(nt),Ue=ne.sendAsync({type:"GI",data:{icons:Xe,source:this.source,tileID:this.tileID,type:"icons"}},nt)}let ht=Object.keys(Ee.patternDependencies),pt=Promise.resolve({});if(ht.length){let nt=new AbortController;this.inFlightDependencies.push(nt),pt=ne.sendAsync({type:"GI",data:{icons:ht,source:this.source,tileID:this.tileID,type:"patterns"}},nt)}let[Pe,We,Qe]=yield Promise.all([pe,Ue,pt]),wt=new x(Pe),mt=new c.cn(We,Qe);for(let nt in _e){let Ke=_e[nt];Ke instanceof c.a3?(S(Ke.layers,this.zoom,X),c.co({bucket:Ke,glyphMap:Pe,glyphPositions:wt.positions,imageMap:We,imagePositions:mt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:Ee.subdivisionGranularity})):Ke.hasPattern&&(Ke instanceof c.cp||Ke instanceof c.cq||Ke instanceof c.cr)&&(S(Ke.layers,this.zoom,X),Ke.addFeatures(Ee,this.tileID.canonical,mt.patternPositions))}return this.status="done",{buckets:Object.values(_e).filter(nt=>!nt.isEmpty()),featureIndex:Te,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:wt.image,imageAtlas:mt,glyphMap:this.returnDependencies?Pe:null,iconMap:this.returnDependencies?We:null,glyphPositions:this.returnDependencies?wt.positions:null}})}}function S(K,Z,$){let X=new c.z(Z);for(let ne of K)ne.recalculate(X,$)}class R{constructor(Z,$,X){this.actor=Z,this.layerIndex=$,this.availableImages=X,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(Z,$){return c._(this,void 0,void 0,function*(){let X=yield c.l(Z.request,$);try{return{vectorTile:new c.cs.VectorTile(new c.ct(X.data)),rawData:X.data,cacheControl:X.cacheControl,expires:X.expires}}catch(ne){let he=new Uint8Array(X.data),ye=`Unable to parse the tile at ${Z.request.url}, `;throw ye+=he[0]===31&&he[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ne.message}`,new Error(ye)}})}loadTile(Z){return c._(this,void 0,void 0,function*(){let $=Z.uid,X=!!(Z&&Z.request&&Z.request.collectResourceTiming)&&new c.cu(Z.request),ne=new b(Z);this.loading[$]=ne;let he=new AbortController;ne.abort=he;try{let ye=yield this.loadVectorTile(Z,he);if(delete this.loading[$],!ye)return null;let Te=ye.rawData,_e={};ye.expires&&(_e.expires=ye.expires),ye.cacheControl&&(_e.cacheControl=ye.cacheControl);let Ee={};if(X){let xe=X.finish();xe&&(Ee.resourceTiming=JSON.parse(JSON.stringify(xe)))}ne.vectorTile=ye.vectorTile;let Ie=ne.parse(ye.vectorTile,this.layerIndex,this.availableImages,this.actor,Z.subdivisionGranularity);this.loaded[$]=ne,this.fetching[$]={rawTileData:Te,cacheControl:_e,resourceTiming:Ee};try{let xe=yield Ie;return c.e({rawTileData:Te.slice(0)},xe,_e,Ee)}finally{delete this.fetching[$]}}catch(ye){throw delete this.loading[$],ne.status="done",this.loaded[$]=ne,ye}})}reloadTile(Z){return c._(this,void 0,void 0,function*(){let $=Z.uid;if(!this.loaded||!this.loaded[$])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let X=this.loaded[$];if(X.showCollisionBoxes=Z.showCollisionBoxes,X.status==="parsing"){let ne=yield X.parse(X.vectorTile,this.layerIndex,this.availableImages,this.actor,Z.subdivisionGranularity),he;if(this.fetching[$]){let{rawTileData:ye,cacheControl:Te,resourceTiming:_e}=this.fetching[$];delete this.fetching[$],he=c.e({rawTileData:ye.slice(0)},ne,Te,_e)}else he=ne;return he}if(X.status==="done"&&X.vectorTile)return X.parse(X.vectorTile,this.layerIndex,this.availableImages,this.actor,Z.subdivisionGranularity)})}abortTile(Z){return c._(this,void 0,void 0,function*(){let $=this.loading,X=Z.uid;$&&$[X]&&$[X].abort&&($[X].abort.abort(),delete $[X])})}removeTile(Z){return c._(this,void 0,void 0,function*(){this.loaded&&this.loaded[Z.uid]&&delete this.loaded[Z.uid]})}}class E{constructor(){this.loaded={}}loadTile(Z){return c._(this,void 0,void 0,function*(){let{uid:$,encoding:X,rawImageData:ne,redFactor:he,greenFactor:ye,blueFactor:Te,baseShift:_e}=Z,Ee=ne.width+2,Ie=ne.height+2,xe=c.b(ne)?new c.R({width:Ee,height:Ie},yield c.cv(ne,-1,-1,Ee,Ie)):ne,pe=new c.cw($,xe,X,he,ye,Te,_e);return this.loaded=this.loaded||{},this.loaded[$]=pe,pe})}removeTile(Z){let $=this.loaded,X=Z.uid;$&&$[X]&&delete $[X]}}var A,z,W=function(){if(z)return A;function K($,X){if($.length!==0){Z($[0],X);for(var ne=1;ne<$.length;ne++)Z($[ne],!X)}}function Z($,X){for(var ne=0,he=0,ye=0,Te=$.length,_e=Te-1;ye<Te;_e=ye++){var Ee=($[ye][0]-$[_e][0])*($[_e][1]+$[ye][1]),Ie=ne+Ee;he+=Math.abs(ne)>=Math.abs(Ee)?ne-Ie+Ee:Ee-Ie+ne,ne=Ie}ne+he>=0!=!!X&&$.reverse()}return z=1,A=function $(X,ne){var he,ye=X&&X.type;if(ye==="FeatureCollection")for(he=0;he<X.features.length;he++)$(X.features[he],ne);else if(ye==="GeometryCollection")for(he=0;he<X.geometries.length;he++)$(X.geometries[he],ne);else if(ye==="Feature")$(X.geometry,ne);else if(ye==="Polygon")K(X.coordinates,ne);else if(ye==="MultiPolygon")for(he=0;he<X.coordinates.length;he++)K(X.coordinates[he],ne);return X}}(),re=c.cx(W);let me=c.cs.VectorTileFeature.prototype.toGeoJSON;class ge{constructor(Z){this._feature=Z,this.extent=c.X,this.type=Z.type,this.properties=Z.tags,"id"in Z&&!isNaN(Z.id)&&(this.id=parseInt(Z.id,10))}loadGeometry(){if(this._feature.type===1){let Z=[];for(let $ of this._feature.geometry)Z.push([new c.P($[0],$[1])]);return Z}{let Z=[];for(let $ of this._feature.geometry){let X=[];for(let ne of $)X.push(new c.P(ne[0],ne[1]));Z.push(X)}return Z}}toGeoJSON(Z,$,X){return me.call(this,Z,$,X)}}class be{constructor(Z){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=c.X,this.length=Z.length,this._features=Z}feature(Z){return new ge(this._features[Z])}}var ve,De,ke,je={exports:{}},Re=function(){if(ke)return je.exports;ke=1;var K=c.cA(),Z=function(){if(De)return ve;De=1;var Ie=c.cy(),xe=c.cz().VectorTileFeature;function pe(Ue,ht){this.options=ht||{},this.features=Ue,this.length=Ue.length}function Xe(Ue,ht){this.id=typeof Ue.id=="number"?Ue.id:void 0,this.type=Ue.type,this.rawGeometry=Ue.type===1?[Ue.geometry]:Ue.geometry,this.properties=Ue.tags,this.extent=ht||4096}return ve=pe,pe.prototype.feature=function(Ue){return new Xe(this.features[Ue],this.options.extent)},Xe.prototype.loadGeometry=function(){var Ue=this.rawGeometry;this.geometry=[];for(var ht=0;ht<Ue.length;ht++){for(var pt=Ue[ht],Pe=[],We=0;We<pt.length;We++)Pe.push(new Ie(pt[We][0],pt[We][1]));this.geometry.push(Pe)}return this.geometry},Xe.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Ue=this.geometry,ht=1/0,pt=-1/0,Pe=1/0,We=-1/0,Qe=0;Qe<Ue.length;Qe++)for(var wt=Ue[Qe],mt=0;mt<wt.length;mt++){var nt=wt[mt];ht=Math.min(ht,nt.x),pt=Math.max(pt,nt.x),Pe=Math.min(Pe,nt.y),We=Math.max(We,nt.y)}return[ht,Pe,pt,We]},Xe.prototype.toGeoJSON=xe.prototype.toGeoJSON,ve}();function $(Ie){var xe=new K;return function(pe,Xe){for(var Ue in pe.layers)Xe.writeMessage(3,X,pe.layers[Ue])}(Ie,xe),xe.finish()}function X(Ie,xe){var pe;xe.writeVarintField(15,Ie.version||1),xe.writeStringField(1,Ie.name||""),xe.writeVarintField(5,Ie.extent||4096);var Xe={keys:[],values:[],keycache:{},valuecache:{}};for(pe=0;pe<Ie.length;pe++)Xe.feature=Ie.feature(pe),xe.writeMessage(2,ne,Xe);var Ue=Xe.keys;for(pe=0;pe<Ue.length;pe++)xe.writeStringField(3,Ue[pe]);var ht=Xe.values;for(pe=0;pe<ht.length;pe++)xe.writeMessage(4,Ee,ht[pe])}function ne(Ie,xe){var pe=Ie.feature;pe.id!==void 0&&xe.writeVarintField(1,pe.id),xe.writeMessage(2,he,Ie),xe.writeVarintField(3,pe.type),xe.writeMessage(4,_e,pe)}function he(Ie,xe){var pe=Ie.feature,Xe=Ie.keys,Ue=Ie.values,ht=Ie.keycache,pt=Ie.valuecache;for(var Pe in pe.properties){var We=pe.properties[Pe],Qe=ht[Pe];if(We!==null){Qe===void 0&&(Xe.push(Pe),ht[Pe]=Qe=Xe.length-1),xe.writeVarint(Qe);var wt=typeof We;wt!=="string"&&wt!=="boolean"&&wt!=="number"&&(We=JSON.stringify(We));var mt=wt+":"+We,nt=pt[mt];nt===void 0&&(Ue.push(We),pt[mt]=nt=Ue.length-1),xe.writeVarint(nt)}}}function ye(Ie,xe){return(xe<<3)+(7&Ie)}function Te(Ie){return Ie<<1^Ie>>31}function _e(Ie,xe){for(var pe=Ie.loadGeometry(),Xe=Ie.type,Ue=0,ht=0,pt=pe.length,Pe=0;Pe<pt;Pe++){var We=pe[Pe],Qe=1;Xe===1&&(Qe=We.length),xe.writeVarint(ye(1,Qe));for(var wt=Xe===3?We.length-1:We.length,mt=0;mt<wt;mt++){mt===1&&Xe!==1&&xe.writeVarint(ye(2,wt-1));var nt=We[mt].x-Ue,Ke=We[mt].y-ht;xe.writeVarint(Te(nt)),xe.writeVarint(Te(Ke)),Ue+=nt,ht+=Ke}Xe===3&&xe.writeVarint(ye(7,1))}}function Ee(Ie,xe){var pe=typeof Ie;pe==="string"?xe.writeStringField(1,Ie):pe==="boolean"?xe.writeBooleanField(7,Ie):pe==="number"&&(Ie%1!=0?xe.writeDoubleField(3,Ie):Ie<0?xe.writeSVarintField(6,Ie):xe.writeVarintField(5,Ie))}return je.exports=$,je.exports.fromVectorTileJs=$,je.exports.fromGeojsonVt=function(Ie,xe){xe=xe||{};var pe={};for(var Xe in Ie)pe[Xe]=new Z(Ie[Xe].features,xe),pe[Xe].name=Xe,pe[Xe].version=xe.version,pe[Xe].extent=xe.extent;return $({layers:pe})},je.exports.GeoJSONWrapper=Z,je.exports}(),tt=c.cx(Re);let Je={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:K=>K},He=Math.fround||(ot=new Float32Array(1),K=>(ot[0]=+K,ot[0]));var ot;let vt=3,ct=5,It=6;class ut{constructor(Z){this.options=Object.assign(Object.create(Je),Z),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(Z){let{log:$,minZoom:X,maxZoom:ne}=this.options;$&&console.time("total time");let he=`prepare ${Z.length} points`;$&&console.time(he),this.points=Z;let ye=[];for(let _e=0;_e<Z.length;_e++){let Ee=Z[_e];if(!Ee.geometry)continue;let[Ie,xe]=Ee.geometry.coordinates,pe=He(dt(Ie)),Xe=He(St(xe));ye.push(pe,Xe,1/0,_e,-1,1),this.options.reduce&&ye.push(0)}let Te=this.trees[ne+1]=this._createTree(ye);$&&console.timeEnd(he);for(let _e=ne;_e>=X;_e--){let Ee=+Date.now();Te=this.trees[_e]=this._createTree(this._cluster(Te,_e)),$&&console.log("z%d: %d clusters in %dms",_e,Te.numItems,+Date.now()-Ee)}return $&&console.timeEnd("total time"),this}getClusters(Z,$){let X=((Z[0]+180)%360+360)%360-180,ne=Math.max(-90,Math.min(90,Z[1])),he=Z[2]===180?180:((Z[2]+180)%360+360)%360-180,ye=Math.max(-90,Math.min(90,Z[3]));if(Z[2]-Z[0]>=360)X=-180,he=180;else if(X>he){let xe=this.getClusters([X,ne,180,ye],$),pe=this.getClusters([-180,ne,he,ye],$);return xe.concat(pe)}let Te=this.trees[this._limitZoom($)],_e=Te.range(dt(X),St(ye),dt(he),St(ne)),Ee=Te.data,Ie=[];for(let xe of _e){let pe=this.stride*xe;Ie.push(Ee[pe+ct]>1?yt(Ee,pe,this.clusterProps):this.points[Ee[pe+vt]])}return Ie}getChildren(Z){let $=this._getOriginId(Z),X=this._getOriginZoom(Z),ne="No cluster with the specified id.",he=this.trees[X];if(!he)throw new Error(ne);let ye=he.data;if($*this.stride>=ye.length)throw new Error(ne);let Te=this.options.radius/(this.options.extent*Math.pow(2,X-1)),_e=he.within(ye[$*this.stride],ye[$*this.stride+1],Te),Ee=[];for(let Ie of _e){let xe=Ie*this.stride;ye[xe+4]===Z&&Ee.push(ye[xe+ct]>1?yt(ye,xe,this.clusterProps):this.points[ye[xe+vt]])}if(Ee.length===0)throw new Error(ne);return Ee}getLeaves(Z,$,X){let ne=[];return this._appendLeaves(ne,Z,$=$||10,X=X||0,0),ne}getTile(Z,$,X){let ne=this.trees[this._limitZoom(Z)],he=Math.pow(2,Z),{extent:ye,radius:Te}=this.options,_e=Te/ye,Ee=(X-_e)/he,Ie=(X+1+_e)/he,xe={features:[]};return this._addTileFeatures(ne.range(($-_e)/he,Ee,($+1+_e)/he,Ie),ne.data,$,X,he,xe),$===0&&this._addTileFeatures(ne.range(1-_e/he,Ee,1,Ie),ne.data,he,X,he,xe),$===he-1&&this._addTileFeatures(ne.range(0,Ee,_e/he,Ie),ne.data,-1,X,he,xe),xe.features.length?xe:null}getClusterExpansionZoom(Z){let $=this._getOriginZoom(Z)-1;for(;$<=this.options.maxZoom;){let X=this.getChildren(Z);if($++,X.length!==1)break;Z=X[0].properties.cluster_id}return $}_appendLeaves(Z,$,X,ne,he){let ye=this.getChildren($);for(let Te of ye){let _e=Te.properties;if(_e&&_e.cluster?he+_e.point_count<=ne?he+=_e.point_count:he=this._appendLeaves(Z,_e.cluster_id,X,ne,he):he<ne?he++:Z.push(Te),Z.length===X)break}return he}_createTree(Z){let $=new c.az(Z.length/this.stride|0,this.options.nodeSize,Float32Array);for(let X=0;X<Z.length;X+=this.stride)$.add(Z[X],Z[X+1]);return $.finish(),$.data=Z,$}_addTileFeatures(Z,$,X,ne,he,ye){for(let Te of Z){let _e=Te*this.stride,Ee=$[_e+ct]>1,Ie,xe,pe;if(Ee)Ie=xt($,_e,this.clusterProps),xe=$[_e],pe=$[_e+1];else{let ht=this.points[$[_e+vt]];Ie=ht.properties;let[pt,Pe]=ht.geometry.coordinates;xe=dt(pt),pe=St(Pe)}let Xe={type:1,geometry:[[Math.round(this.options.extent*(xe*he-X)),Math.round(this.options.extent*(pe*he-ne))]],tags:Ie},Ue;Ue=Ee||this.options.generateId?$[_e+vt]:this.points[$[_e+vt]].id,Ue!==void 0&&(Xe.id=Ue),ye.features.push(Xe)}}_limitZoom(Z){return Math.max(this.options.minZoom,Math.min(Math.floor(+Z),this.options.maxZoom+1))}_cluster(Z,$){let{radius:X,extent:ne,reduce:he,minPoints:ye}=this.options,Te=X/(ne*Math.pow(2,$)),_e=Z.data,Ee=[],Ie=this.stride;for(let xe=0;xe<_e.length;xe+=Ie){if(_e[xe+2]<=$)continue;_e[xe+2]=$;let pe=_e[xe],Xe=_e[xe+1],Ue=Z.within(_e[xe],_e[xe+1],Te),ht=_e[xe+ct],pt=ht;for(let Pe of Ue){let We=Pe*Ie;_e[We+2]>$&&(pt+=_e[We+ct])}if(pt>ht&&pt>=ye){let Pe,We=pe*ht,Qe=Xe*ht,wt=-1,mt=((xe/Ie|0)<<5)+($+1)+this.points.length;for(let nt of Ue){let Ke=nt*Ie;if(_e[Ke+2]<=$)continue;_e[Ke+2]=$;let ai=_e[Ke+ct];We+=_e[Ke]*ai,Qe+=_e[Ke+1]*ai,_e[Ke+4]=mt,he&&(Pe||(Pe=this._map(_e,xe,!0),wt=this.clusterProps.length,this.clusterProps.push(Pe)),he(Pe,this._map(_e,Ke)))}_e[xe+4]=mt,Ee.push(We/pt,Qe/pt,1/0,mt,-1,pt),he&&Ee.push(wt)}else{for(let Pe=0;Pe<Ie;Pe++)Ee.push(_e[xe+Pe]);if(pt>1)for(let Pe of Ue){let We=Pe*Ie;if(!(_e[We+2]<=$)){_e[We+2]=$;for(let Qe=0;Qe<Ie;Qe++)Ee.push(_e[We+Qe])}}}}return Ee}_getOriginId(Z){return Z-this.points.length>>5}_getOriginZoom(Z){return(Z-this.points.length)%32}_map(Z,$,X){if(Z[$+ct]>1){let ye=this.clusterProps[Z[$+It]];return X?Object.assign({},ye):ye}let ne=this.points[Z[$+vt]].properties,he=this.options.map(ne);return X&&he===ne?Object.assign({},he):he}}function yt(K,Z,$){return{type:"Feature",id:K[Z+vt],properties:xt(K,Z,$),geometry:{type:"Point",coordinates:[(X=K[Z],360*(X-.5)),qt(K[Z+1])]}};var X}function xt(K,Z,$){let X=K[Z+ct],ne=X>=1e4?`${Math.round(X/1e3)}k`:X>=1e3?Math.round(X/100)/10+"k":X,he=K[Z+It],ye=he===-1?{}:Object.assign({},$[he]);return Object.assign(ye,{cluster:!0,cluster_id:K[Z+vt],point_count:X,point_count_abbreviated:ne})}function dt(K){return K/360+.5}function St(K){let Z=Math.sin(K*Math.PI/180),$=.5-.25*Math.log((1+Z)/(1-Z))/Math.PI;return $<0?0:$>1?1:$}function qt(K){let Z=(180-360*K)*Math.PI/180;return 360*Math.atan(Math.exp(Z))/Math.PI-90}function Ft(K,Z,$,X){let ne=X,he=Z+($-Z>>1),ye,Te=$-Z,_e=K[Z],Ee=K[Z+1],Ie=K[$],xe=K[$+1];for(let pe=Z+3;pe<$;pe+=3){let Xe=Pt(K[pe],K[pe+1],_e,Ee,Ie,xe);if(Xe>ne)ye=pe,ne=Xe;else if(Xe===ne){let Ue=Math.abs(pe-he);Ue<Te&&(ye=pe,Te=Ue)}}ne>X&&(ye-Z>3&&Ft(K,Z,ye,X),K[ye+2]=ne,$-ye>3&&Ft(K,ye,$,X))}function Pt(K,Z,$,X,ne,he){let ye=ne-$,Te=he-X;if(ye!==0||Te!==0){let _e=((K-$)*ye+(Z-X)*Te)/(ye*ye+Te*Te);_e>1?($=ne,X=he):_e>0&&($+=ye*_e,X+=Te*_e)}return ye=K-$,Te=Z-X,ye*ye+Te*Te}function jt(K,Z,$,X){let ne={id:K??null,type:Z,geometry:$,tags:X,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(Z==="Point"||Z==="MultiPoint"||Z==="LineString")$t(ne,$);else if(Z==="Polygon")$t(ne,$[0]);else if(Z==="MultiLineString")for(let he of $)$t(ne,he);else if(Z==="MultiPolygon")for(let he of $)$t(ne,he[0]);return ne}function $t(K,Z){for(let $=0;$<Z.length;$+=3)K.minX=Math.min(K.minX,Z[$]),K.minY=Math.min(K.minY,Z[$+1]),K.maxX=Math.max(K.maxX,Z[$]),K.maxY=Math.max(K.maxY,Z[$+1])}function et(K,Z,$,X){if(!Z.geometry)return;let ne=Z.geometry.coordinates;if(ne&&ne.length===0)return;let he=Z.geometry.type,ye=Math.pow($.tolerance/((1<<$.maxZoom)*$.extent),2),Te=[],_e=Z.id;if($.promoteId?_e=Z.properties[$.promoteId]:$.generateId&&(_e=X||0),he==="Point")Bi(ne,Te);else if(he==="MultiPoint")for(let Ee of ne)Bi(Ee,Te);else if(he==="LineString")Ai(ne,Te,ye,!1);else if(he==="MultiLineString"){if($.lineMetrics){for(let Ee of ne)Te=[],Ai(Ee,Te,ye,!1),K.push(jt(_e,"LineString",Te,Z.properties));return}Ci(ne,Te,ye,!1)}else if(he==="Polygon")Ci(ne,Te,ye,!0);else{if(he!=="MultiPolygon"){if(he==="GeometryCollection"){for(let Ee of Z.geometry.geometries)et(K,{id:_e,geometry:Ee,properties:Z.properties},$,X);return}throw new Error("Input data is not a valid GeoJSON object.")}for(let Ee of ne){let Ie=[];Ci(Ee,Ie,ye,!0),Te.push(Ie)}}K.push(jt(_e,he,Te,Z.properties))}function Bi(K,Z){Z.push(en(K[0]),_i(K[1]),0)}function Ai(K,Z,$,X){let ne,he,ye=0;for(let _e=0;_e<K.length;_e++){let Ee=en(K[_e][0]),Ie=_i(K[_e][1]);Z.push(Ee,Ie,0),_e>0&&(ye+=X?(ne*Ie-Ee*he)/2:Math.sqrt(Math.pow(Ee-ne,2)+Math.pow(Ie-he,2))),ne=Ee,he=Ie}let Te=Z.length-3;Z[2]=1,Ft(Z,0,Te,$),Z[Te+2]=1,Z.size=Math.abs(ye),Z.start=0,Z.end=Z.size}function Ci(K,Z,$,X){for(let ne=0;ne<K.length;ne++){let he=[];Ai(K[ne],he,$,X),Z.push(he)}}function en(K){return K/360+.5}function _i(K){let Z=Math.sin(K*Math.PI/180),$=.5-.25*Math.log((1+Z)/(1-Z))/Math.PI;return $<0?0:$>1?1:$}function ti(K,Z,$,X,ne,he,ye,Te){if(X/=Z,he>=($/=Z)&&ye<X)return K;if(ye<$||he>=X)return null;let _e=[];for(let Ee of K){let Ie=Ee.geometry,xe=Ee.type,pe=ne===0?Ee.minX:Ee.minY,Xe=ne===0?Ee.maxX:Ee.maxY;if(pe>=$&&Xe<X){_e.push(Ee);continue}if(Xe<$||pe>=X)continue;let Ue=[];if(xe==="Point"||xe==="MultiPoint")tn(Ie,Ue,$,X,ne);else if(xe==="LineString")oi(Ie,Ue,$,X,ne,!1,Te.lineMetrics);else if(xe==="MultiLineString")Ln(Ie,Ue,$,X,ne,!1);else if(xe==="Polygon")Ln(Ie,Ue,$,X,ne,!0);else if(xe==="MultiPolygon")for(let ht of Ie){let pt=[];Ln(ht,pt,$,X,ne,!0),pt.length&&Ue.push(pt)}if(Ue.length){if(Te.lineMetrics&&xe==="LineString"){for(let ht of Ue)_e.push(jt(Ee.id,xe,ht,Ee.tags));continue}xe!=="LineString"&&xe!=="MultiLineString"||(Ue.length===1?(xe="LineString",Ue=Ue[0]):xe="MultiLineString"),xe!=="Point"&&xe!=="MultiPoint"||(xe=Ue.length===3?"Point":"MultiPoint"),_e.push(jt(Ee.id,xe,Ue,Ee.tags))}}return _e.length?_e:null}function tn(K,Z,$,X,ne){for(let he=0;he<K.length;he+=3){let ye=K[he+ne];ye>=$&&ye<=X&&Tr(Z,K[he],K[he+1],K[he+2])}}function oi(K,Z,$,X,ne,he,ye){let Te=gn(K),_e=ne===0?$i:yi,Ee,Ie,xe=K.start;for(let pt=0;pt<K.length-3;pt+=3){let Pe=K[pt],We=K[pt+1],Qe=K[pt+2],wt=K[pt+3],mt=K[pt+4],nt=ne===0?Pe:We,Ke=ne===0?wt:mt,ai=!1;ye&&(Ee=Math.sqrt(Math.pow(Pe-wt,2)+Math.pow(We-mt,2))),nt<$?Ke>$&&(Ie=_e(Te,Pe,We,wt,mt,$),ye&&(Te.start=xe+Ee*Ie)):nt>X?Ke<X&&(Ie=_e(Te,Pe,We,wt,mt,X),ye&&(Te.start=xe+Ee*Ie)):Tr(Te,Pe,We,Qe),Ke<$&&nt>=$&&(Ie=_e(Te,Pe,We,wt,mt,$),ai=!0),Ke>X&&nt<=X&&(Ie=_e(Te,Pe,We,wt,mt,X),ai=!0),!he&&ai&&(ye&&(Te.end=xe+Ee*Ie),Z.push(Te),Te=gn(K)),ye&&(xe+=Ee)}let pe=K.length-3,Xe=K[pe],Ue=K[pe+1],ht=ne===0?Xe:Ue;ht>=$&&ht<=X&&Tr(Te,Xe,Ue,K[pe+2]),pe=Te.length-3,he&&pe>=3&&(Te[pe]!==Te[0]||Te[pe+1]!==Te[1])&&Tr(Te,Te[0],Te[1],Te[2]),Te.length&&Z.push(Te)}function gn(K){let Z=[];return Z.size=K.size,Z.start=K.start,Z.end=K.end,Z}function Ln(K,Z,$,X,ne,he){for(let ye of K)oi(ye,Z,$,X,ne,he,!1)}function Tr(K,Z,$,X){K.push(Z,$,X)}function $i(K,Z,$,X,ne,he){let ye=(he-Z)/(X-Z);return Tr(K,he,$+(ne-$)*ye,1),ye}function yi(K,Z,$,X,ne,he){let ye=(he-$)/(ne-$);return Tr(K,Z+(X-Z)*ye,he,1),ye}function Li(K,Z){let $=[];for(let X=0;X<K.length;X++){let ne=K[X],he=ne.type,ye;if(he==="Point"||he==="MultiPoint"||he==="LineString")ye=rn(ne.geometry,Z);else if(he==="MultiLineString"||he==="Polygon"){ye=[];for(let Te of ne.geometry)ye.push(rn(Te,Z))}else if(he==="MultiPolygon"){ye=[];for(let Te of ne.geometry){let _e=[];for(let Ee of Te)_e.push(rn(Ee,Z));ye.push(_e)}}$.push(jt(ne.id,he,ye,ne.tags))}return $}function rn(K,Z){let $=[];$.size=K.size,K.start!==void 0&&($.start=K.start,$.end=K.end);for(let X=0;X<K.length;X+=3)$.push(K[X]+Z,K[X+1],K[X+2]);return $}function kn(K,Z){if(K.transformed)return K;let $=1<<K.z,X=K.x,ne=K.y;for(let he of K.features){let ye=he.geometry,Te=he.type;if(he.geometry=[],Te===1)for(let _e=0;_e<ye.length;_e+=2)he.geometry.push(nn(ye[_e],ye[_e+1],Z,$,X,ne));else for(let _e=0;_e<ye.length;_e++){let Ee=[];for(let Ie=0;Ie<ye[_e].length;Ie+=2)Ee.push(nn(ye[_e][Ie],ye[_e][Ie+1],Z,$,X,ne));he.geometry.push(Ee)}}return K.transformed=!0,K}function nn(K,Z,$,X,ne,he){return[Math.round($*(K*X-ne)),Math.round($*(Z*X-he))]}function Dn(K,Z,$,X,ne){let he=Z===ne.maxZoom?0:ne.tolerance/((1<<Z)*ne.extent),ye={features:[],numPoints:0,numSimplified:0,numFeatures:K.length,source:null,x:$,y:X,z:Z,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let Te of K)Qn(ye,Te,he,ne);return ye}function Qn(K,Z,$,X){let ne=Z.geometry,he=Z.type,ye=[];if(K.minX=Math.min(K.minX,Z.minX),K.minY=Math.min(K.minY,Z.minY),K.maxX=Math.max(K.maxX,Z.maxX),K.maxY=Math.max(K.maxY,Z.maxY),he==="Point"||he==="MultiPoint")for(let Te=0;Te<ne.length;Te+=3)ye.push(ne[Te],ne[Te+1]),K.numPoints++,K.numSimplified++;else if(he==="LineString")Nr(ye,ne,K,$,!1,!1);else if(he==="MultiLineString"||he==="Polygon")for(let Te=0;Te<ne.length;Te++)Nr(ye,ne[Te],K,$,he==="Polygon",Te===0);else if(he==="MultiPolygon")for(let Te=0;Te<ne.length;Te++){let _e=ne[Te];for(let Ee=0;Ee<_e.length;Ee++)Nr(ye,_e[Ee],K,$,!0,Ee===0)}if(ye.length){let Te=Z.tags||null;if(he==="LineString"&&X.lineMetrics){Te={};for(let Ee in Z.tags)Te[Ee]=Z.tags[Ee];Te.mapbox_clip_start=ne.start/ne.size,Te.mapbox_clip_end=ne.end/ne.size}let _e={geometry:ye,type:he==="Polygon"||he==="MultiPolygon"?3:he==="LineString"||he==="MultiLineString"?2:1,tags:Te};Z.id!==null&&(_e.id=Z.id),K.features.push(_e)}}function Nr(K,Z,$,X,ne,he){let ye=X*X;if(X>0&&Z.size<(ne?ye:X))return void($.numPoints+=Z.length/3);let Te=[];for(let _e=0;_e<Z.length;_e+=3)(X===0||Z[_e+2]>ye)&&($.numSimplified++,Te.push(Z[_e],Z[_e+1])),$.numPoints++;ne&&function(_e,Ee){let Ie=0;for(let xe=0,pe=_e.length,Xe=pe-2;xe<pe;Xe=xe,xe+=2)Ie+=(_e[xe]-_e[Xe])*(_e[xe+1]+_e[Xe+1]);if(Ie>0===Ee)for(let xe=0,pe=_e.length;xe<pe/2;xe+=2){let Xe=_e[xe],Ue=_e[xe+1];_e[xe]=_e[pe-2-xe],_e[xe+1]=_e[pe-1-xe],_e[pe-2-xe]=Xe,_e[pe-1-xe]=Ue}}(Te,he),K.push(Te)}let sn={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class on{constructor(Z,$){let X=($=this.options=function(he,ye){for(let Te in ye)he[Te]=ye[Te];return he}(Object.create(sn),$)).debug;if(X&&console.time("preprocess data"),$.maxZoom<0||$.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if($.promoteId&&$.generateId)throw new Error("promoteId and generateId cannot be used together.");let ne=function(he,ye){let Te=[];if(he.type==="FeatureCollection")for(let _e=0;_e<he.features.length;_e++)et(Te,he.features[_e],ye,_e);else et(Te,he.type==="Feature"?he:{geometry:he},ye);return Te}(Z,$);this.tiles={},this.tileCoords=[],X&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",$.indexMaxZoom,$.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ne=function(he,ye){let Te=ye.buffer/ye.extent,_e=he,Ee=ti(he,1,-1-Te,Te,0,-1,2,ye),Ie=ti(he,1,1-Te,2+Te,0,-1,2,ye);return(Ee||Ie)&&(_e=ti(he,1,-Te,1+Te,0,-1,2,ye)||[],Ee&&(_e=Li(Ee,1).concat(_e)),Ie&&(_e=_e.concat(Li(Ie,-1)))),_e}(ne,$),ne.length&&this.splitTile(ne,0,0,0),X&&(ne.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)))}splitTile(Z,$,X,ne,he,ye,Te){let _e=[Z,$,X,ne],Ee=this.options,Ie=Ee.debug;for(;_e.length;){ne=_e.pop(),X=_e.pop(),$=_e.pop(),Z=_e.pop();let xe=1<<$,pe=Fn($,X,ne),Xe=this.tiles[pe];if(!Xe&&(Ie>1&&console.time("creation"),Xe=this.tiles[pe]=Dn(Z,$,X,ne,Ee),this.tileCoords.push({z:$,x:X,y:ne}),Ie)){Ie>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",$,X,ne,Xe.numFeatures,Xe.numPoints,Xe.numSimplified),console.timeEnd("creation"));let ai=`z${$}`;this.stats[ai]=(this.stats[ai]||0)+1,this.total++}if(Xe.source=Z,he==null){if($===Ee.indexMaxZoom||Xe.numPoints<=Ee.indexMaxPoints)continue}else{if($===Ee.maxZoom||$===he)continue;if(he!=null){let ai=he-$;if(X!==ye>>ai||ne!==Te>>ai)continue}}if(Xe.source=null,Z.length===0)continue;Ie>1&&console.time("clipping");let Ue=.5*Ee.buffer/Ee.extent,ht=.5-Ue,pt=.5+Ue,Pe=1+Ue,We=null,Qe=null,wt=null,mt=null,nt=ti(Z,xe,X-Ue,X+pt,0,Xe.minX,Xe.maxX,Ee),Ke=ti(Z,xe,X+ht,X+Pe,0,Xe.minX,Xe.maxX,Ee);Z=null,nt&&(We=ti(nt,xe,ne-Ue,ne+pt,1,Xe.minY,Xe.maxY,Ee),Qe=ti(nt,xe,ne+ht,ne+Pe,1,Xe.minY,Xe.maxY,Ee),nt=null),Ke&&(wt=ti(Ke,xe,ne-Ue,ne+pt,1,Xe.minY,Xe.maxY,Ee),mt=ti(Ke,xe,ne+ht,ne+Pe,1,Xe.minY,Xe.maxY,Ee),Ke=null),Ie>1&&console.timeEnd("clipping"),_e.push(We||[],$+1,2*X,2*ne),_e.push(Qe||[],$+1,2*X,2*ne+1),_e.push(wt||[],$+1,2*X+1,2*ne),_e.push(mt||[],$+1,2*X+1,2*ne+1)}}getTile(Z,$,X){Z=+Z,$=+$,X=+X;let ne=this.options,{extent:he,debug:ye}=ne;if(Z<0||Z>24)return null;let Te=1<<Z,_e=Fn(Z,$=$+Te&Te-1,X);if(this.tiles[_e])return kn(this.tiles[_e],he);ye>1&&console.log("drilling down to z%d-%d-%d",Z,$,X);let Ee,Ie=Z,xe=$,pe=X;for(;!Ee&&Ie>0;)Ie--,xe>>=1,pe>>=1,Ee=this.tiles[Fn(Ie,xe,pe)];return Ee&&Ee.source?(ye>1&&(console.log("found parent tile z%d-%d-%d",Ie,xe,pe),console.time("drilling down")),this.splitTile(Ee.source,Ie,xe,pe,Z,$,X),ye>1&&console.timeEnd("drilling down"),this.tiles[_e]?kn(this.tiles[_e],he):null):null}}function Fn(K,Z,$){return 32*((1<<K)*$+Z)+K}function an(K,Z){return Z?K.properties[Z]:K.id}function zn(K,Z){if(K==null)return!0;if(K.type==="Feature")return an(K,Z)!=null;if(K.type==="FeatureCollection"){let $=new Set;for(let X of K.features){let ne=an(X,Z);if(ne==null||$.has(ne))return!1;$.add(ne)}return!0}return!1}function zs(K,Z){let $=new Map;if(K!=null)if(K.type==="Feature")$.set(an(K,Z),K);else for(let X of K.features)$.set(an(X,Z),X);return $}class Os extends R{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(Z,$){return c._(this,void 0,void 0,function*(){let X=Z.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");let ne=this._geoJSONIndex.getTile(X.z,X.x,X.y);if(!ne)return null;let he=new be(ne.features),ye=tt(he);return ye.byteOffset===0&&ye.byteLength===ye.buffer.byteLength||(ye=new Uint8Array(ye)),{vectorTile:he,rawData:ye.buffer}})}loadData(Z){return c._(this,void 0,void 0,function*(){var $;($=this._pendingRequest)===null||$===void 0||$.abort();let X=!!(Z&&Z.request&&Z.request.collectResourceTiming)&&new c.cu(Z.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(Z,this._pendingRequest),this._geoJSONIndex=Z.cluster?new ut(function({superclusterOptions:ye,clusterProperties:Te}){if(!Te||!ye)return ye;let _e={},Ee={},Ie={accumulated:null,zoom:0},xe={properties:null},pe=Object.keys(Te);for(let Xe of pe){let[Ue,ht]=Te[Xe],pt=c.cB(ht),Pe=c.cB(typeof Ue=="string"?[Ue,["accumulated"],["get",Xe]]:Ue);_e[Xe]=pt.value,Ee[Xe]=Pe.value}return ye.map=Xe=>{xe.properties=Xe;let Ue={};for(let ht of pe)Ue[ht]=_e[ht].evaluate(Ie,xe);return Ue},ye.reduce=(Xe,Ue)=>{xe.properties=Ue;for(let ht of pe)Ie.accumulated=Xe[ht],Xe[ht]=Ee[ht].evaluate(Ie,xe)},ye}(Z)).load((yield this._pendingData).features):(ne=yield this._pendingData,new on(ne,Z.geojsonVtOptions)),this.loaded={};let he={};if(X){let ye=X.finish();ye&&(he.resourceTiming={},he.resourceTiming[Z.source]=JSON.parse(JSON.stringify(ye)))}return he}catch(he){if(delete this._pendingRequest,c.cf(he))return{abandoned:!0};throw he}var ne})}getData(){return c._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(Z){let $=this.loaded;return $&&$[Z.uid]?super.reloadTile(Z):this.loadTile(Z)}loadAndProcessGeoJSON(Z,$){return c._(this,void 0,void 0,function*(){let X=yield this.loadGeoJSON(Z,$);if(delete this._pendingRequest,typeof X!="object")throw new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`);if(re(X,!0),Z.filter){let ne=c.cB(Z.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ne.result==="error")throw new Error(ne.value.map(ye=>`${ye.key}: ${ye.message}`).join(", "));X={type:"FeatureCollection",features:X.features.filter(ye=>ne.value.evaluate({zoom:0},ye))}}return X})}loadGeoJSON(Z,$){return c._(this,void 0,void 0,function*(){let{promoteId:X}=Z;if(Z.request){let ne=yield c.h(Z.request,$);return this._dataUpdateable=zn(ne.data,X)?zs(ne.data,X):void 0,ne.data}if(typeof Z.data=="string")try{let ne=JSON.parse(Z.data);return this._dataUpdateable=zn(ne,X)?zs(ne,X):void 0,ne}catch{throw new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`)}if(!Z.dataDiff)throw new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${Z.source}`);return function(ne,he,ye){var Te,_e,Ee,Ie;if(he.removeAll&&ne.clear(),he.remove)for(let xe of he.remove)ne.delete(xe);if(he.add)for(let xe of he.add){let pe=an(xe,ye);pe!=null&&ne.set(pe,xe)}if(he.update)for(let xe of he.update){let pe=ne.get(xe.id);if(pe==null)continue;let Xe=!xe.removeAllProperties&&(((Te=xe.removeProperties)===null||Te===void 0?void 0:Te.length)>0||((_e=xe.addOrUpdateProperties)===null||_e===void 0?void 0:_e.length)>0);if((xe.newGeometry||xe.removeAllProperties||Xe)&&(pe=Object.assign({},pe),ne.set(xe.id,pe),Xe&&(pe.properties=Object.assign({},pe.properties))),xe.newGeometry&&(pe.geometry=xe.newGeometry),xe.removeAllProperties)pe.properties={};else if(((Ee=xe.removeProperties)===null||Ee===void 0?void 0:Ee.length)>0)for(let Ue of xe.removeProperties)Object.prototype.hasOwnProperty.call(pe.properties,Ue)&&delete pe.properties[Ue];if(((Ie=xe.addOrUpdateProperties)===null||Ie===void 0?void 0:Ie.length)>0)for(let{key:Ue,value:ht}of xe.addOrUpdateProperties)pe.properties[Ue]=ht}}(this._dataUpdateable,Z.dataDiff,X),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(Z){return c._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(Z){return this._geoJSONIndex.getClusterExpansionZoom(Z.clusterId)}getClusterChildren(Z){return this._geoJSONIndex.getChildren(Z.clusterId)}getClusterLeaves(Z){return this._geoJSONIndex.getLeaves(Z.clusterId,Z.limit,Z.offset)}}class On{constructor(Z){this.self=Z,this.actor=new c.F(Z),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=($,X)=>{if(this.externalWorkerSourceTypes[$])throw new Error(`Worker source with name "${$}" already registered.`);this.externalWorkerSourceTypes[$]=X},this.self.addProtocol=c.ch,this.self.removeProtocol=c.ci,this.self.registerRTLTextPlugin=$=>{c.cC.setMethods($)},this.actor.registerMessageHandler("LDT",($,X)=>this._getDEMWorkerSource($,X.source).loadTile(X)),this.actor.registerMessageHandler("RDT",($,X)=>c._(this,void 0,void 0,function*(){this._getDEMWorkerSource($,X.source).removeTile(X)})),this.actor.registerMessageHandler("GCEZ",($,X)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource($,X.type,X.source).getClusterExpansionZoom(X)})),this.actor.registerMessageHandler("GCC",($,X)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource($,X.type,X.source).getClusterChildren(X)})),this.actor.registerMessageHandler("GCL",($,X)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource($,X.type,X.source).getClusterLeaves(X)})),this.actor.registerMessageHandler("LD",($,X)=>this._getWorkerSource($,X.type,X.source).loadData(X)),this.actor.registerMessageHandler("GD",($,X)=>this._getWorkerSource($,X.type,X.source).getData()),this.actor.registerMessageHandler("LT",($,X)=>this._getWorkerSource($,X.type,X.source).loadTile(X)),this.actor.registerMessageHandler("RT",($,X)=>this._getWorkerSource($,X.type,X.source).reloadTile(X)),this.actor.registerMessageHandler("AT",($,X)=>this._getWorkerSource($,X.type,X.source).abortTile(X)),this.actor.registerMessageHandler("RMT",($,X)=>this._getWorkerSource($,X.type,X.source).removeTile(X)),this.actor.registerMessageHandler("RS",($,X)=>c._(this,void 0,void 0,function*(){if(!this.workerSources[$]||!this.workerSources[$][X.type]||!this.workerSources[$][X.type][X.source])return;let ne=this.workerSources[$][X.type][X.source];delete this.workerSources[$][X.type][X.source],ne.removeSource!==void 0&&ne.removeSource(X)})),this.actor.registerMessageHandler("RM",$=>c._(this,void 0,void 0,function*(){delete this.layerIndexes[$],delete this.availableImages[$],delete this.workerSources[$],delete this.demWorkerSources[$]})),this.actor.registerMessageHandler("SR",($,X)=>c._(this,void 0,void 0,function*(){this.referrer=X})),this.actor.registerMessageHandler("SRPS",($,X)=>this._syncRTLPluginState($,X)),this.actor.registerMessageHandler("IS",($,X)=>c._(this,void 0,void 0,function*(){this.self.importScripts(X)})),this.actor.registerMessageHandler("SI",($,X)=>this._setImages($,X)),this.actor.registerMessageHandler("UL",($,X)=>c._(this,void 0,void 0,function*(){this._getLayerIndex($).update(X.layers,X.removedIds)})),this.actor.registerMessageHandler("SL",($,X)=>c._(this,void 0,void 0,function*(){this._getLayerIndex($).replace(X)}))}_setImages(Z,$){return c._(this,void 0,void 0,function*(){this.availableImages[Z]=$;for(let X in this.workerSources[Z]){let ne=this.workerSources[Z][X];for(let he in ne)ne[he].availableImages=$}})}_syncRTLPluginState(Z,$){return c._(this,void 0,void 0,function*(){return yield c.cC.syncState($,this.self.importScripts)})}_getAvailableImages(Z){let $=this.availableImages[Z];return $||($=[]),$}_getLayerIndex(Z){let $=this.layerIndexes[Z];return $||($=this.layerIndexes[Z]=new n),$}_getWorkerSource(Z,$,X){if(this.workerSources[Z]||(this.workerSources[Z]={}),this.workerSources[Z][$]||(this.workerSources[Z][$]={}),!this.workerSources[Z][$][X]){let ne={sendAsync:(he,ye)=>(he.targetMapId=Z,this.actor.sendAsync(he,ye))};switch($){case"vector":this.workerSources[Z][$][X]=new R(ne,this._getLayerIndex(Z),this._getAvailableImages(Z));break;case"geojson":this.workerSources[Z][$][X]=new Os(ne,this._getLayerIndex(Z),this._getAvailableImages(Z));break;default:this.workerSources[Z][$][X]=new this.externalWorkerSourceTypes[$](ne,this._getLayerIndex(Z),this._getAvailableImages(Z))}}return this.workerSources[Z][$][X]}_getDEMWorkerSource(Z,$){return this.demWorkerSources[Z]||(this.demWorkerSources[Z]={}),this.demWorkerSources[Z][$]||(this.demWorkerSources[Z][$]=new E),this.demWorkerSources[Z][$]}}return c.i(self)&&(self.worker=new On(self)),On}),r("index",["exports","./shared"],function(c,n){"use strict";var x="5.0.1";function b(){var m=new n.A(4);return n.A!=Float32Array&&(m[1]=0,m[2]=0),m[0]=1,m[3]=1,m}let S,R,E={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:m=>new Promise((e,s)=>{let d=requestAnimationFrame(e);m.signal.addEventListener("abort",()=>{cancelAnimationFrame(d),s(n.c())})}),getImageData(m,e=0){return this.getImageCanvasContext(m).getImageData(-e,-e,m.width+2*e,m.height+2*e)},getImageCanvasContext(m){let e=window.document.createElement("canvas"),s=e.getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("failed to create canvas 2d context");return e.width=m.width,e.height=m.height,s.drawImage(m,0,0,m.width,m.height),s},resolveURL:m=>(S||(S=document.createElement("a")),S.href=m,S.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(R==null&&(R=matchMedia("(prefers-reduced-motion: reduce)")),R.matches)}};class A{static testProp(e){if(!A.docStyle)return e[0];for(let s=0;s<e.length;s++)if(e[s]in A.docStyle)return e[s];return e[0]}static create(e,s,d){let p=window.document.createElement(e);return s!==void 0&&(p.className=s),d&&d.appendChild(p),p}static createNS(e,s){return window.document.createElementNS(e,s)}static disableDrag(){A.docStyle&&A.selectProp&&(A.userSelect=A.docStyle[A.selectProp],A.docStyle[A.selectProp]="none")}static enableDrag(){A.docStyle&&A.selectProp&&(A.docStyle[A.selectProp]=A.userSelect)}static setTransform(e,s){e.style[A.transformProp]=s}static addEventListener(e,s,d,p={}){e.addEventListener(s,d,"passive"in p?p:p.capture)}static removeEventListener(e,s,d,p={}){e.removeEventListener(s,d,"passive"in p?p:p.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",A.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",A.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",A.suppressClickInternal,!0)},0)}static getScale(e){let s=e.getBoundingClientRect();return{x:s.width/e.offsetWidth||1,y:s.height/e.offsetHeight||1,boundingClientRect:s}}static getPoint(e,s,d){let p=s.boundingClientRect;return new n.P((d.clientX-p.left)/s.x-e.clientLeft,(d.clientY-p.top)/s.y-e.clientTop)}static mousePos(e,s){let d=A.getScale(e);return A.getPoint(e,d,s)}static touchPos(e,s){let d=[],p=A.getScale(e);for(let g=0;g<s.length;g++)d.push(A.getPoint(e,p,s[g]));return d}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}static sanitize(e){let s=new DOMParser().parseFromString(e,"text/html").body||document.createElement("body"),d=s.querySelectorAll("script");for(let p of d)p.remove();return A.clean(s),s.innerHTML}static isPossiblyDangerous(e,s){let d=s.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!d.includes("javascript:")&&!d.includes("data:"))||!!e.startsWith("on")||void 0}static clean(e){let s=e.children;for(let d of s)A.removeAttributes(d),A.clean(d)}static removeAttributes(e){for(let{name:s,value:d}of e.attributes)A.isPossiblyDangerous(s,d)&&e.removeAttribute(s)}}A.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,A.selectProp=A.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),A.transformProp=A.testProp(["transform","WebkitTransform"]);let z={supported:!1,testSupport:function(m){!me&&re&&(ge?be(m):W=m)}},W,re,me=!1,ge=!1;function be(m){let e=m.createTexture();m.bindTexture(m.TEXTURE_2D,e);try{if(m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,re),m.isContextLost())return;z.supported=!0}catch{}m.deleteTexture(e),me=!0}var ve;typeof document<"u"&&(re=document.createElement("img"),re.onload=()=>{W&&be(W),W=null,ge=!0},re.onerror=()=>{me=!0,W=null},re.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(m){let e,s,d,p;m.resetRequestQueue=()=>{e=[],s=0,d=0,p={}},m.addThrottleControl=M=>{let P=d++;return p[P]=M,P},m.removeThrottleControl=M=>{delete p[M],v()},m.getImage=(M,P,D=!0)=>new Promise((F,O)=>{z.supported&&(M.headers||(M.headers={}),M.headers.accept="image/webp,*/*"),n.e(M,{type:"image"}),e.push({abortController:P,requestParameters:M,supportImageRefresh:D,state:"queued",onError:V=>{O(V)},onSuccess:V=>{F(V)}}),v()});let g=M=>n._(this,void 0,void 0,function*(){M.state="running";let{requestParameters:P,supportImageRefresh:D,onError:F,onSuccess:O,abortController:V}=M,q=D===!1&&!n.i(self)&&!n.g(P.url)&&(!P.headers||Object.keys(P.headers).reduce((ee,ie)=>ee&&ie==="accept",!0));s++;let Q=q?T(P,V):n.m(P,V);try{let ee=yield Q;delete M.abortController,M.state="completed",ee.data instanceof HTMLImageElement||n.b(ee.data)?O(ee):ee.data&&O({data:yield(J=ee.data,typeof createImageBitmap=="function"?n.d(J):n.f(J)),cacheControl:ee.cacheControl,expires:ee.expires})}catch(ee){delete M.abortController,F(ee)}finally{s--,v()}var J}),v=()=>{let M=(()=>{for(let P of Object.keys(p))if(p[P]())return!0;return!1})()?n.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:n.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let P=s;P<M&&e.length>0;P++){let D=e.shift();D.abortController.signal.aborted?P--:g(D)}},T=(M,P)=>new Promise((D,F)=>{let O=new Image,V=M.url,q=M.credentials;q&&q==="include"?O.crossOrigin="use-credentials":(q&&q==="same-origin"||!n.s(V))&&(O.crossOrigin="anonymous"),P.signal.addEventListener("abort",()=>{O.src="",F(n.c())}),O.fetchPriority="high",O.onload=()=>{O.onerror=O.onload=null,D({data:O})},O.onerror=()=>{O.onerror=O.onload=null,P.signal.aborted||F(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."))},O.src=V})}(ve||(ve={})),ve.resetRequestQueue();class De{constructor(e){this._transformRequestFn=e}transformRequest(e,s){return this._transformRequestFn&&this._transformRequestFn(e,s)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function ke(m){let e=[];if(typeof m=="string")e.push({id:"default",url:m});else if(m&&m.length>0){let s=[];for(let{id:d,url:p}of m){let g=`${d}${p}`;s.indexOf(g)===-1&&(s.push(g),e.push({id:d,url:p}))}}return e}function je(m,e,s){try{let d=new URL(m);return d.pathname+=`${e}${s}`,d.toString()}catch{throw new Error(`Invalid sprite URL "${m}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}class Re{constructor(e,s,d,p){this.context=e,this.format=d,this.texture=e.gl.createTexture(),this.update(s,p)}update(e,s,d){let{width:p,height:g}=e,v=!(this.size&&this.size[0]===p&&this.size[1]===g||d),{context:T}=this,{gl:M}=T;if(this.useMipmap=!!(s&&s.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),T.pixelStoreUnpackFlipY.set(!1),T.pixelStoreUnpack.set(1),T.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!s||s.premultiply!==!1)),v)this.size=[p,g],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||n.b(e)?M.texImage2D(M.TEXTURE_2D,0,this.format,this.format,M.UNSIGNED_BYTE,e):M.texImage2D(M.TEXTURE_2D,0,this.format,p,g,0,this.format,M.UNSIGNED_BYTE,e.data);else{let{x:P,y:D}=d||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||n.b(e)?M.texSubImage2D(M.TEXTURE_2D,0,P,D,M.RGBA,M.UNSIGNED_BYTE,e):M.texSubImage2D(M.TEXTURE_2D,0,P,D,p,g,M.RGBA,M.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&M.generateMipmap(M.TEXTURE_2D)}bind(e,s,d){let{context:p}=this,{gl:g}=p;g.bindTexture(g.TEXTURE_2D,this.texture),d!==g.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(d=g.LINEAR),e!==this.filter&&(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,e),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,d||e),this.filter=e),s!==this.wrap&&(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,s),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,s),this.wrap=s)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function tt(m){let{userImage:e}=m;return!!(e&&e.render&&e.render())&&(m.data.replace(new Uint8Array(e.data.buffer)),!0)}class Je extends n.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new n.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:s,promiseResolve:d}of this.requestors)d(this._getImagesForIds(s));this.requestors=[]}}getImage(e){let s=this.images[e];if(s&&!s.data&&s.spriteData){let d=s.spriteData;s.data=new n.R({width:d.width,height:d.height},d.context.getImageData(d.x,d.y,d.width,d.height).data),s.spriteData=null}return s}addImage(e,s){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,s)&&(this.images[e]=s)}_validate(e,s){let d=!0,p=s.data||s.spriteData;return this._validateStretch(s.stretchX,p&&p.width)||(this.fire(new n.j(new Error(`Image "${e}" has invalid "stretchX" value`))),d=!1),this._validateStretch(s.stretchY,p&&p.height)||(this.fire(new n.j(new Error(`Image "${e}" has invalid "stretchY" value`))),d=!1),this._validateContent(s.content,s)||(this.fire(new n.j(new Error(`Image "${e}" has invalid "content" value`))),d=!1),d}_validateStretch(e,s){if(!e)return!0;let d=0;for(let p of e){if(p[0]<d||p[1]<p[0]||s<p[1])return!1;d=p[1]}return!0}_validateContent(e,s){if(!e)return!0;if(e.length!==4)return!1;let d=s.spriteData,p=d&&d.width||s.data.width,g=d&&d.height||s.data.height;return!(e[0]<0||p<e[0]||e[1]<0||g<e[1]||e[2]<0||p<e[2]||e[3]<0||g<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,s,d=!0){let p=this.getImage(e);if(d&&(p.data.width!==s.data.width||p.data.height!==s.data.height))throw new Error(`size mismatch between old image (${p.data.width}x${p.data.height}) and new image (${s.data.width}x${s.data.height}).`);s.version=p.version+1,this.images[e]=s,this.updatedImages[e]=!0}removeImage(e){let s=this.images[e];delete this.images[e],delete this.patterns[e],s.userImage&&s.userImage.onRemove&&s.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((s,d)=>{let p=!0;if(!this.isLoaded())for(let g of e)this.images[g]||(p=!1);this.isLoaded()||p?s(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:s})})}_getImagesForIds(e){let s={};for(let d of e){let p=this.getImage(d);p||(this.fire(new n.k("styleimagemissing",{id:d})),p=this.getImage(d)),p?s[d]={data:p.data.clone(),pixelRatio:p.pixelRatio,sdf:p.sdf,version:p.version,stretchX:p.stretchX,stretchY:p.stretchY,content:p.content,textFitWidth:p.textFitWidth,textFitHeight:p.textFitHeight,hasRenderCallback:!!(p.userImage&&p.userImage.render)}:n.w(`Image "${d}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return s}getPixelSize(){let{width:e,height:s}=this.atlasImage;return{width:e,height:s}}getPattern(e){let s=this.patterns[e],d=this.getImage(e);if(!d)return null;if(s&&s.position.version===d.version)return s.position;if(s)s.position.version=d.version;else{let p={w:d.data.width+2,h:d.data.height+2,x:0,y:0},g=new n.I(p,d);this.patterns[e]={bin:p,position:g}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let s=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Re(e,this.atlasImage,s.RGBA),this.atlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let g in this.patterns)e.push(this.patterns[g].bin);let{w:s,h:d}=n.p(e),p=this.atlasImage;p.resize({width:s||1,height:d||1});for(let g in this.patterns){let{bin:v}=this.patterns[g],T=v.x+1,M=v.y+1,P=this.getImage(g).data,D=P.width,F=P.height;n.R.copy(P,p,{x:0,y:0},{x:T,y:M},{width:D,height:F}),n.R.copy(P,p,{x:0,y:F-1},{x:T,y:M-1},{width:D,height:1}),n.R.copy(P,p,{x:0,y:0},{x:T,y:M+F},{width:D,height:1}),n.R.copy(P,p,{x:D-1,y:0},{x:T-1,y:M},{width:1,height:F}),n.R.copy(P,p,{x:0,y:0},{x:T+D,y:M},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let s of e){if(this.callbackDispatchedThisFrame[s])continue;this.callbackDispatchedThisFrame[s]=!0;let d=this.getImage(s);d||n.w(`Image with ID: "${s}" was not found`),tt(d)&&this.updateImage(s,d)}}}let He=1e20;function ot(m,e,s,d,p,g,v,T,M){for(let P=e;P<e+d;P++)vt(m,s*g+P,g,p,v,T,M);for(let P=s;P<s+p;P++)vt(m,P*g+e,1,d,v,T,M)}function vt(m,e,s,d,p,g,v){g[0]=0,v[0]=-1e20,v[1]=He,p[0]=m[e];for(let T=1,M=0,P=0;T<d;T++){p[T]=m[e+T*s];let D=T*T;do{let F=g[M];P=(p[T]-p[F]+D-F*F)/(T-F)/2}while(P<=v[M]&&--M>-1);M++,g[M]=T,v[M]=P,v[M+1]=He}for(let T=0,M=0;T<d;T++){for(;v[M+1]<T;)M++;let P=g[M],D=T-P;m[e+T*s]=p[P]+D*D}}class ct{constructor(e,s){this.requestManager=e,this.localIdeographFontFamily=s,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return n._(this,void 0,void 0,function*(){let s=[];for(let g in e)for(let v of e[g])s.push(this._getAndCacheGlyphsPromise(g,v));let d=yield Promise.all(s),p={};for(let{stack:g,id:v,glyph:T}of d)p[g]||(p[g]={}),p[g][v]=T&&{id:T.id,bitmap:T.bitmap.clone(),metrics:T.metrics};return p})}_getAndCacheGlyphsPromise(e,s){return n._(this,void 0,void 0,function*(){let d=this.entries[e];d||(d=this.entries[e]={glyphs:{},requests:{},ranges:{}});let p=d.glyphs[s];if(p!==void 0)return{stack:e,id:s,glyph:p};if(p=this._tinySDF(d,e,s),p)return d.glyphs[s]=p,{stack:e,id:s,glyph:p};let g=Math.floor(s/256);if(256*g>65535)throw new Error("glyphs > 65535 not supported");if(d.ranges[g])return{stack:e,id:s,glyph:p};if(!this.url)throw new Error("glyphsUrl is not set");if(!d.requests[g]){let T=ct.loadGlyphRange(e,g,this.url,this.requestManager);d.requests[g]=T}let v=yield d.requests[g];for(let T in v)this._doesCharSupportLocalGlyph(+T)||(d.glyphs[+T]=v[+T]);return d.ranges[g]=!0,{stack:e,id:s,glyph:v[s]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))}_tinySDF(e,s,d){let p=this.localIdeographFontFamily;if(!p||!this._doesCharSupportLocalGlyph(d))return;let g=e.tinySDF;if(!g){let T="400";/bold/i.test(s)?T="900":/medium/i.test(s)?T="500":/light/i.test(s)&&(T="200"),g=e.tinySDF=new ct.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:p,fontWeight:T})}let v=g.draw(String.fromCharCode(d));return{id:d,bitmap:new n.o({width:v.width||60,height:v.height||60},v.data),metrics:{width:v.glyphWidth/2||24,height:v.glyphHeight/2||24,left:v.glyphLeft/2+.5||0,top:v.glyphTop/2-27.5||-8,advance:v.glyphAdvance/2||24,isDoubleResolution:!0}}}}ct.loadGlyphRange=function(m,e,s,d){return n._(this,void 0,void 0,function*(){let p=256*e,g=p+255,v=d.transformRequest(s.replace("{fontstack}",m).replace("{range}",`${p}-${g}`),"Glyphs"),T=yield n.l(v,new AbortController);if(!T||!T.data)throw new Error(`Could not load glyph range. range: ${e}, ${p}-${g}`);let M={};for(let P of n.n(T.data))M[P.id]=P;return M})},ct.TinySDF=class{constructor({fontSize:m=24,buffer:e=3,radius:s=8,cutoff:d=.25,fontFamily:p="sans-serif",fontWeight:g="normal",fontStyle:v="normal"}={}){this.buffer=e,this.cutoff=d,this.radius=s;let T=this.size=m+4*e,M=this._createCanvas(T),P=this.ctx=M.getContext("2d",{willReadFrequently:!0});P.font=`${v} ${g} ${m}px ${p}`,P.textBaseline="alphabetic",P.textAlign="left",P.fillStyle="black",this.gridOuter=new Float64Array(T*T),this.gridInner=new Float64Array(T*T),this.f=new Float64Array(T),this.z=new Float64Array(T+1),this.v=new Uint16Array(T)}_createCanvas(m){let e=document.createElement("canvas");return e.width=e.height=m,e}draw(m){let{width:e,actualBoundingBoxAscent:s,actualBoundingBoxDescent:d,actualBoundingBoxLeft:p,actualBoundingBoxRight:g}=this.ctx.measureText(m),v=Math.ceil(s),T=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(g-p))),M=Math.min(this.size-this.buffer,v+Math.ceil(d)),P=T+2*this.buffer,D=M+2*this.buffer,F=Math.max(P*D,0),O=new Uint8ClampedArray(F),V={data:O,width:P,height:D,glyphWidth:T,glyphHeight:M,glyphTop:v,glyphLeft:0,glyphAdvance:e};if(T===0||M===0)return V;let{ctx:q,buffer:Q,gridInner:J,gridOuter:ee}=this;q.clearRect(Q,Q,T,M),q.fillText(m,Q,Q+v);let ie=q.getImageData(Q,Q,T,M);ee.fill(He,0,F),J.fill(0,0,F);for(let ae=0;ae<M;ae++)for(let le=0;le<T;le++){let ce=ie.data[4*(ae*T+le)+3]/255;if(ce===0)continue;let fe=(ae+Q)*P+le+Q;if(ce===1)ee[fe]=0,J[fe]=He;else{let ue=.5-ce;ee[fe]=ue>0?ue*ue:0,J[fe]=ue<0?ue*ue:0}}ot(ee,0,0,P,D,P,this.f,this.v,this.z),ot(J,Q,Q,T,M,P,this.f,this.v,this.z);for(let ae=0;ae<F;ae++){let le=Math.sqrt(ee[ae])-Math.sqrt(J[ae]);O[ae]=Math.round(255-255*(le/this.radius+this.cutoff))}return V}};class It{constructor(){this.specification=n.v.light.position}possiblyEvaluate(e,s){return n.x(e.expression.evaluate(s))}interpolate(e,s,d){return{x:n.y.number(e.x,s.x,d),y:n.y.number(e.y,s.y,d),z:n.y.number(e.z,s.z,d)}}}let ut;class yt extends n.E{constructor(e){super(),ut=ut||new n.q({anchor:new n.D(n.v.light.anchor),position:new It,color:new n.D(n.v.light.color),intensity:new n.D(n.v.light.intensity)}),this._transitionable=new n.T(ut),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,s={}){if(!this._validate(n.r,e,s))for(let d in e){let p=e[d];d.endsWith("-transition")?this._transitionable.setTransition(d.slice(0,-11),p):this._transitionable.setValue(d,p)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,s,d){return(!d||d.validate!==!1)&&n.t(this,e.call(n.u,{value:s,style:{glyphs:!0,sprite:!0},styleSpec:n.v}))}}let xt=new n.q({"sky-color":new n.D(n.v.sky["sky-color"]),"horizon-color":new n.D(n.v.sky["horizon-color"]),"fog-color":new n.D(n.v.sky["fog-color"]),"fog-ground-blend":new n.D(n.v.sky["fog-ground-blend"]),"horizon-fog-blend":new n.D(n.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new n.D(n.v.sky["sky-horizon-blend"]),"atmosphere-blend":new n.D(n.v.sky["atmosphere-blend"])});class dt extends n.E{constructor(e){super(),this._transitionable=new n.T(xt),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new n.z(0))}setSky(e,s={}){if(!this._validate(n.B,e,s)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(let d in e){let p=e[d];d.endsWith("-transition")?this._transitionable.setTransition(d.slice(0,-11),p):this._transitionable.setValue(d,p)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,s,d={}){return d?.validate!==!1&&n.t(this,e.call(n.u,n.e({value:s,style:{glyphs:!0,sprite:!0},styleSpec:n.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class St{constructor(e,s){this.width=e,this.height=s,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,s){let d=e.join(",")+String(s);return this.dashEntry[d]||(this.dashEntry[d]=this.addDash(e,s)),this.dashEntry[d]}getDashRanges(e,s,d){let p=[],g=e.length%2==1?-e[e.length-1]*d:0,v=e[0]*d,T=!0;p.push({left:g,right:v,isDash:T,zeroLength:e[0]===0});let M=e[0];for(let P=1;P<e.length;P++){T=!T;let D=e[P];g=M*d,M+=D,v=M*d,p.push({left:g,right:v,isDash:T,zeroLength:D===0})}return p}addRoundDash(e,s,d){let p=s/2;for(let g=-d;g<=d;g++){let v=this.width*(this.nextRow+d+g),T=0,M=e[T];for(let P=0;P<this.width;P++){P/M.right>1&&(M=e[++T]);let D=Math.abs(P-M.left),F=Math.abs(P-M.right),O=Math.min(D,F),V,q=g/d*(p+1);if(M.isDash){let Q=p-Math.abs(q);V=Math.sqrt(O*O+Q*Q)}else V=p-Math.sqrt(O*O+q*q);this.data[v+P]=Math.max(0,Math.min(255,V+128))}}}addRegularDash(e){for(let T=e.length-1;T>=0;--T){let M=e[T],P=e[T+1];M.zeroLength?e.splice(T,1):P&&P.isDash===M.isDash&&(P.left=M.left,e.splice(T,1))}let s=e[0],d=e[e.length-1];s.isDash===d.isDash&&(s.left=d.left-this.width,d.right=s.right+this.width);let p=this.width*this.nextRow,g=0,v=e[g];for(let T=0;T<this.width;T++){T/v.right>1&&(v=e[++g]);let M=Math.abs(T-v.left),P=Math.abs(T-v.right),D=Math.min(M,P);this.data[p+T]=Math.max(0,Math.min(255,(v.isDash?D:-D)+128))}}addDash(e,s){let d=s?7:0,p=2*d+1;if(this.nextRow+p>this.height)return n.w("LineAtlas out of space"),null;let g=0;for(let T=0;T<e.length;T++)g+=e[T];if(g!==0){let T=this.width/g,M=this.getDashRanges(e,this.width,T);s?this.addRoundDash(M,T,d):this.addRegularDash(M)}let v={y:(this.nextRow+d+.5)/this.height,height:2*d/this.height,width:g};return this.nextRow+=p,this.dirty=!0,v}bind(e){let s=e.gl;this.texture?(s.bindTexture(s.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,s.texSubImage2D(s.TEXTURE_2D,0,0,0,this.width,this.height,s.ALPHA,s.UNSIGNED_BYTE,this.data))):(this.texture=s.createTexture(),s.bindTexture(s.TEXTURE_2D,this.texture),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.REPEAT),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.REPEAT),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texImage2D(s.TEXTURE_2D,0,s.ALPHA,this.width,this.height,0,s.ALPHA,s.UNSIGNED_BYTE,this.data))}}let qt="maplibre_preloaded_worker_pool";class Ft{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Ft.workerCount;)this.workers.push(new Worker(n.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(s=>{s.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[qt]}numActive(){return Object.keys(this.active).length}}let Pt=Math.floor(E.hardwareConcurrency/2),jt,$t;function et(){return jt||(jt=new Ft),jt}Ft.workerCount=n.C(globalThis)?Math.max(Math.min(Pt,3),1):1;class Bi{constructor(e,s){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=s;let d=this.workerPool.acquire(s);for(let p=0;p<d.length;p++){let g=new n.F(d[p],s);g.name=`Worker ${p}`,this.actors.push(g)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,s){let d=[];for(let p of this.actors)d.push(p.sendAsync({type:e,data:s}));return Promise.all(d)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(s=>{s.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,s){for(let d of this.actors)d.registerMessageHandler(e,s)}}function Ai(){return $t||($t=new Bi(et(),n.G),$t.registerMessageHandler("GR",(m,e,s)=>n.m(e,s))),$t}function Ci(m,e){let s=n.H();return n.J(s,s,[1,1,0]),n.K(s,s,[.5*m.width,.5*m.height,1]),m.calculatePosMatrix?n.L(s,s,m.calculatePosMatrix(e.toUnwrapped())):s}function en(m,e,s,d,p,g){var v;let T=function(F,O,V){if(F)for(let q of F){let Q=O[q];if(Q&&Q.source===V&&Q.type==="fill-extrusion")return!0}else for(let q in O){let Q=O[q];if(Q.source===V&&Q.type==="fill-extrusion")return!0}return!1}((v=p?.layers)!==null&&v!==void 0?v:null,e,m.id),M=g.maxPitchScaleFactor(),P=m.tilesIn(d,M,T);P.sort(_i);let D=[];for(let F of P)D.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(e,s,m._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,p,g,M,Ci(m.transform,F.tileID))});return function(F,O){for(let V in F)for(let q of F[V])ti(q,O);return F}(function(F){let O={},V={};for(let q of F){let Q=q.queryResults,J=q.wrappedTileID,ee=V[J]=V[J]||{};for(let ie in Q){let ae=Q[ie],le=ee[ie]=ee[ie]||{},ce=O[ie]=O[ie]||[];for(let fe of ae)le[fe.featureIndex]||(le[fe.featureIndex]=!0,ce.push(fe))}}return O}(D),m)}function _i(m,e){let s=m.tileID,d=e.tileID;return s.overscaledZ-d.overscaledZ||s.canonical.y-d.canonical.y||s.wrap-d.wrap||s.canonical.x-d.canonical.x}function ti(m,e){let s=m.feature,d=e.getFeatureState(s.layer["source-layer"],s.id);s.source=s.layer.source,s.layer["source-layer"]&&(s.sourceLayer=s.layer["source-layer"]),s.state=d}function tn(m,e,s){return n._(this,void 0,void 0,function*(){let d=m;if(m.url?d=(yield n.h(e.transformRequest(m.url,"Source"),s)).data:yield E.frameAsync(s),!d)return null;let p=n.M(n.e(d,m),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in d&&d.vector_layers&&(p.vectorLayerIds=d.vector_layers.map(g=>g.id)),p})}class oi{constructor(e,s){e&&(s?this.setSouthWest(e).setNorthEast(s):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof n.N?new n.N(e.lng,e.lat):n.N.convert(e),this}setSouthWest(e){return this._sw=e instanceof n.N?new n.N(e.lng,e.lat):n.N.convert(e),this}extend(e){let s=this._sw,d=this._ne,p,g;if(e instanceof n.N)p=e,g=e;else{if(!(e instanceof oi))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(oi.convert(e)):this.extend(n.N.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(n.N.convert(e)):this;if(p=e._sw,g=e._ne,!p||!g)return this}return s||d?(s.lng=Math.min(p.lng,s.lng),s.lat=Math.min(p.lat,s.lat),d.lng=Math.max(g.lng,d.lng),d.lat=Math.max(g.lat,d.lat)):(this._sw=new n.N(p.lng,p.lat),this._ne=new n.N(g.lng,g.lat)),this}getCenter(){return new n.N((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 n.N(this.getWest(),this.getNorth())}getSouthEast(){return new n.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:s,lat:d}=n.N.convert(e),p=this._sw.lng<=s&&s<=this._ne.lng;return this._sw.lng>this._ne.lng&&(p=this._sw.lng>=s&&s>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&p}static convert(e){return e instanceof oi?e:e&&new oi(e)}static fromLngLat(e,s=0){let d=360*s/40075017,p=d/Math.cos(Math.PI/180*e.lat);return new oi(new n.N(e.lng-p,e.lat-d),new n.N(e.lng+p,e.lat+d))}adjustAntiMeridian(){let e=new n.N(this._sw.lng,this._sw.lat),s=new n.N(this._ne.lng,this._ne.lat);return new oi(e,e.lng>s.lng?new n.N(s.lng+360,s.lat):s)}}class gn{constructor(e,s,d){this.bounds=oi.convert(this.validateBounds(e)),this.minzoom=s||0,this.maxzoom=d||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let s=Math.pow(2,e.z),d=Math.floor(n.O(this.bounds.getWest())*s),p=Math.floor(n.Q(this.bounds.getNorth())*s),g=Math.ceil(n.O(this.bounds.getEast())*s),v=Math.ceil(n.Q(this.bounds.getSouth())*s);return e.x>=d&&e.x<g&&e.y>=p&&e.y<v}}class Ln extends n.E{constructor(e,s,d,p){if(super(),this.id=e,this.dispatcher=d,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,n.e(this,n.M(s,["url","scheme","tileSize","promoteId"])),this._options=n.e({type:"vector"},s),this._collectResourceTiming=s.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(p)}load(){return n._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new n.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=yield tn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(n.e(this,e),e.bounds&&(this.tileBounds=new gn(e.bounds,this.minzoom,this.maxzoom)),this.fire(new n.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new n.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new n.j(e))}})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return n.e({},this._options)}loadTile(e){return n._(this,void 0,void 0,function*(){let s=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d={request:this.map._requestManager.transformRequest(s,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};d.request.collectResourceTiming=this._collectResourceTiming;let p="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((g,v)=>{e.reloadPromise={resolve:g,reject:v}})}else e.actor=this.dispatcher.getActor(),p="LT";e.abortController=new AbortController;try{let g=yield e.actor.sendAsync({type:p,data:d},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,g)}catch(g){if(delete e.abortController,e.aborted)return;if(g&&g.status!==404)throw g;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,s){if(s&&s.resourceTiming&&(e.resourceTiming=s.resourceTiming),s&&this.map._refreshExpiredTiles&&e.setExpiryData(s),e.loadVectorData(s,this.map.painter),e.reloadPromise){let d=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(d.resolve).catch(d.reject)}}abortTile(e){return n._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return n._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Tr extends n.E{constructor(e,s,d,p){super(),this.id=e,this.dispatcher=d,this.setEventedParent(p),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=n.e({type:"raster"},s),n.e(this,n.M(s,["url","scheme","tileSize"]))}load(){return n._(this,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new n.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let s=yield tn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,s&&(n.e(this,s),s.bounds&&(this.tileBounds=new gn(s.bounds,this.minzoom,this.maxzoom)),this.fire(new n.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new n.k("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(s){this._tileJSONRequest=null,this.fire(new n.j(s))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return n.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return n._(this,void 0,void 0,function*(){let s=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let d=yield ve.getImage(this.map._requestManager.transformRequest(s,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(d&&d.data){this.map._refreshExpiredTiles&&d.cacheControl&&d.expires&&e.setExpiryData({cacheControl:d.cacheControl,expires:d.expires});let p=this.map.painter.context,g=p.gl,v=d.data;e.texture=this.map.painter.getTileTexture(v.width),e.texture?e.texture.update(v,{useMipmap:!0}):(e.texture=new Re(p,v,g.RGBA,{useMipmap:!0}),e.texture.bind(g.LINEAR,g.CLAMP_TO_EDGE,g.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(d){if(delete e.abortController,e.aborted)e.state="unloaded";else if(d)throw e.state="errored",d}})}abortTile(e){return n._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return n._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class $i extends Tr{constructor(e,s,d,p){super(e,s,d,p),this.type="raster-dem",this.maxzoom=22,this._options=n.e({type:"raster-dem"},s),this.encoding=s.encoding||"mapbox",this.redFactor=s.redFactor,this.greenFactor=s.greenFactor,this.blueFactor=s.blueFactor,this.baseShift=s.baseShift}loadTile(e){return n._(this,void 0,void 0,function*(){let s=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d=this.map._requestManager.transformRequest(s,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let p=yield ve.getImage(d,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(p&&p.data){let g=p.data;this.map._refreshExpiredTiles&&p.cacheControl&&p.expires&&e.setExpiryData({cacheControl:p.cacheControl,expires:p.expires});let v=n.b(g)&&n.U()?g:yield this.readImageNow(g),T={type:this.type,uid:e.uid,source:this.id,rawImageData:v,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();let M=yield e.actor.sendAsync({type:"LDT",data:T});e.dem=M,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(p){if(delete e.abortController,e.aborted)e.state="unloaded";else if(p)throw e.state="errored",p}})}readImageNow(e){return n._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&n.V()){let s=e.width+2,d=e.height+2;try{return new n.R({width:s,height:d},yield n.W(e,-1,-1,s,d))}catch{}}return E.getImageData(e,1)})}_getNeighboringTiles(e){let s=e.canonical,d=Math.pow(2,s.z),p=(s.x-1+d)%d,g=s.x===0?e.wrap-1:e.wrap,v=(s.x+1+d)%d,T=s.x+1===d?e.wrap+1:e.wrap,M={};return M[new n.S(e.overscaledZ,g,s.z,p,s.y).key]={backfilled:!1},M[new n.S(e.overscaledZ,T,s.z,v,s.y).key]={backfilled:!1},s.y>0&&(M[new n.S(e.overscaledZ,g,s.z,p,s.y-1).key]={backfilled:!1},M[new n.S(e.overscaledZ,e.wrap,s.z,s.x,s.y-1).key]={backfilled:!1},M[new n.S(e.overscaledZ,T,s.z,v,s.y-1).key]={backfilled:!1}),s.y+1<d&&(M[new n.S(e.overscaledZ,g,s.z,p,s.y+1).key]={backfilled:!1},M[new n.S(e.overscaledZ,e.wrap,s.z,s.x,s.y+1).key]={backfilled:!1},M[new n.S(e.overscaledZ,T,s.z,v,s.y+1).key]={backfilled:!1}),M}unloadTile(e){return n._(this,void 0,void 0,function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))})}}class yi extends n.E{constructor(e,s,d,p){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=d.getActor(),this.setEventedParent(p),this._data=s.data,this._options=n.e({},s),this._collectResourceTiming=s.collectResourceTiming,s.maxzoom!==void 0&&(this.maxzoom=s.maxzoom),s.type&&(this.type=s.type),s.attribution&&(this.attribution=s.attribution),this.promoteId=s.promoteId,s.clusterMaxZoom!==void 0&&this.maxzoom<=s.clusterMaxZoom&&n.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${s.clusterMaxZoom}".`),this.workerOptions=n.e({source:this.id,cluster:s.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(s.buffer!==void 0?s.buffer:128),tolerance:this._pixelsToTileUnits(s.tolerance!==void 0?s.tolerance:.375),extent:n.X,maxZoom:this.maxzoom,lineMetrics:s.lineMetrics||!1,generateId:s.generateId||!1},superclusterOptions:{maxZoom:s.clusterMaxZoom!==void 0?s.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,s.clusterMinPoints||2),extent:n.X,radius:this._pixelsToTileUnits(s.clusterRadius||50),log:!1,generateId:s.generateId||!1},clusterProperties:s.clusterProperties,filter:s.filter},s.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(n.X/this.tileSize)}load(){return n._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}getData(){return n._(this,void 0,void 0,function*(){let e=n.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,s,d){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:s,offset:d}})}_updateWorkerData(e){return n._(this,void 0,void 0,function*(){let s=n.e({type:this.type},this.workerOptions);e?s.dataDiff=e:typeof this._data=="string"?(s.request=this.map._requestManager.transformRequest(E.resolveURL(this._data),"Source"),s.request.collectResourceTiming=this._collectResourceTiming):s.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new n.k("dataloading",{dataType:"source"}));try{let d=yield this.actor.sendAsync({type:"LD",data:s});if(this._pendingLoads--,this._removed||d.abandoned)return void this.fire(new n.k("dataabort",{dataType:"source"}));let p=null;d.resourceTiming&&d.resourceTiming[this.id]&&(p=d.resourceTiming[this.id].slice(0));let g={dataType:"source"};this._collectResourceTiming&&p&&p.length>0&&n.e(g,{resourceTiming:p}),this.fire(new n.k("data",Object.assign(Object.assign({},g),{sourceDataType:"metadata"}))),this.fire(new n.k("data",Object.assign(Object.assign({},g),{sourceDataType:"content"})))}catch(d){if(this._pendingLoads--,this._removed)return void this.fire(new n.k("dataabort",{dataType:"source"}));this.fire(new n.j(d))}})}loaded(){return this._pendingLoads===0}loadTile(e){return n._(this,void 0,void 0,function*(){let s=e.actor?"RT":"LT";e.actor=this.actor;let d={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;let p=yield this.actor.sendAsync({type:s,data:d},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(p,this.map.painter,s==="RT")})}abortTile(e){return n._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return n._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return n.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class Li extends n.E{constructor(e,s,d,p){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=d,this.coordinates=s.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(p),this.options=s}load(e){return n._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new n.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let s=yield ve.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,s&&s.data&&(this.image=s.data,e&&(this.coordinates=e),this._finishLoading())}catch(s){this._request=null,this._loaded=!0,this.fire(new n.j(s))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new n.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;let s=e.map(n.Y.fromLngLat);var d;return this.tileID=function(p){let g=1/0,v=1/0,T=-1/0,M=-1/0;for(let O of p)g=Math.min(g,O.x),v=Math.min(v,O.y),T=Math.max(T,O.x),M=Math.max(M,O.y);let P=Math.max(T-g,M-v),D=Math.max(0,Math.floor(-Math.log(P)/Math.LN2)),F=Math.pow(2,D);return new n.Z(D,Math.floor((g+T)/2*F),Math.floor((v+M)/2*F))}(s),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=s.map(p=>this.tileID.getTilePoint(p)._round()),this.flippedWindingOrder=((d=this.tileCoords)[1].x-d[0].x)*(d[2].y-d[0].y)-(d[1].y-d[0].y)*(d[2].x-d[0].x)<0,this.fire(new n.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,s=e.gl;this.texture||(this.texture=new Re(e,this.image,s.RGBA),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE));let d=!1;for(let p in this.tiles){let g=this.tiles[p];g.state!=="loaded"&&(g.state="loaded",g.texture=this.texture,d=!0)}d&&this.fire(new n.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return n._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class rn extends Li{constructor(e,s,d,p){super(e,s,d,p),this.roundZoom=!0,this.type="video",this.options=s}load(){return n._(this,void 0,void 0,function*(){this._loaded=!1;let e=this.options;this.urls=[];for(let s of e.urls)this.urls.push(this.map._requestManager.transformRequest(s,"Source").url);try{let s=yield n.a0(this.urls);if(this._loaded=!0,!s)return;this.video=s,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(s){this.fire(new n.j(s))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let s=this.video.seekable;e<s.start(0)||e>s.end(0)?this.fire(new n.j(new n.$(`sources.${this.id}`,null,`Playback for this video can be set only between the ${s.start(0)} and ${s.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,s=e.gl;this.texture?this.video.paused||(this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),s.texSubImage2D(s.TEXTURE_2D,0,0,0,s.RGBA,s.UNSIGNED_BYTE,this.video)):(this.texture=new Re(e,this.video,s.RGBA),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE));let d=!1;for(let p in this.tiles){let g=this.tiles[p];g.state!=="loaded"&&(g.state="loaded",g.texture=this.texture,d=!0)}d&&this.fire(new n.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class kn extends Li{constructor(e,s,d,p){super(e,s,d,p),s.coordinates?Array.isArray(s.coordinates)&&s.coordinates.length===4&&!s.coordinates.some(g=>!Array.isArray(g)||g.length!==2||g.some(v=>typeof v!="number"))||this.fire(new n.j(new n.$(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new n.j(new n.$(`sources.${e}`,null,'missing required property "coordinates"'))),s.animate&&typeof s.animate!="boolean"&&this.fire(new n.j(new n.$(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),s.canvas?typeof s.canvas=="string"||s.canvas instanceof HTMLCanvasElement||this.fire(new n.j(new n.$(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new n.j(new n.$(`sources.${e}`,null,'missing required property "canvas"'))),this.options=s,this.animate=s.animate===void 0||s.animate}load(){return n._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new n.j(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(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let s=this.map.painter.context,d=s.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Re(s,this.canvas,d.RGBA,{premultiply:!0});let p=!1;for(let g in this.tiles){let v=this.tiles[g];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,p=!0)}p&&this.fire(new n.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}let nn={},Dn=m=>{switch(m){case"geojson":return yi;case"image":return Li;case"raster":return Tr;case"raster-dem":return $i;case"vector":return Ln;case"video":return rn;case"canvas":return kn}return nn[m]},Qn="RTLPluginLoaded";class Nr extends n.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Ai()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(s=>{throw this.status="error",s})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return n._(this,arguments,void 0,function*(s,d=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=E.resolveURL(s),!this.url)throw new Error(`requested url ${s} is invalid`);if(this.status==="unavailable"){if(!d)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return n._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new n.k(Qn))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let sn=null;function on(){return sn||(sn=new Nr),sn}class Fn{constructor(e,s){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=n.a1(),this.uses=0,this.tileSize=s,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){let s=e+this.timeAdded;s<this.fadeEndTime||(this.fadeEndTime=s)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,s,d){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(p,g){let v={};if(!g)return v;for(let T of p){let M=T.layerIds.map(P=>g.getLayer(P)).filter(Boolean);if(M.length!==0){T.layers=M,T.stateDependentLayerIds&&(T.stateDependentLayers=T.stateDependentLayerIds.map(P=>M.filter(D=>D.id===P)[0]));for(let P of M)v[P.id]=T}}return v}(e.buckets,s?.style),this.hasSymbolBuckets=!1;for(let p in this.buckets){let g=this.buckets[p];if(g instanceof n.a3){if(this.hasSymbolBuckets=!0,!d)break;g.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let p in this.buckets){let g=this.buckets[p];if(g instanceof n.a3&&g.hasRTLText){this.hasRTLText=!0,on().lazyLoad();break}}this.queryPadding=0;for(let p in this.buckets){let g=this.buckets[p];this.queryPadding=Math.max(this.queryPadding,s.style.getLayer(p).queryRadius(g))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new n.a2}unloadVectorData(){for(let e in this.buckets)this.buckets[e].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(e){return this.buckets[e.id]}upload(e){for(let d in this.buckets){let p=this.buckets[d];p.uploadPending()&&p.upload(e)}let s=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Re(e,this.imageAtlas.image,s.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Re(e,this.glyphAtlasImage,s.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,s,d,p,g,v,T,M,P,D){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:p,cameraQueryGeometry:g,scale:v,tileSize:this.tileSize,pixelPosMatrix:D,transform:M,params:T,queryPadding:this.queryPadding*P},e,s,d):{}}querySourceFeatures(e,s){let d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;let p=d.loadVTLayers(),g=s&&s.sourceLayer?s.sourceLayer:"",v=p._geojsonTileLayer||p[g];if(!v)return;let T=n.a4(s&&s.filter),{z:M,x:P,y:D}=this.tileID.canonical,F={z:M,x:P,y:D};for(let O=0;O<v.length;O++){let V=v.feature(O);if(T.needGeometry){let J=n.a5(V,!0);if(!T.filter(new n.z(this.tileID.overscaledZ),J,this.tileID.canonical))continue}else if(!T.filter(new n.z(this.tileID.overscaledZ),V))continue;let q=d.getId(V,g),Q=new n.a6(V,M,P,D,q);Q.tile=F,e.push(Q)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let s=this.expirationTime;if(e.cacheControl){let d=n.a7(e.cacheControl);d["max-age"]&&(this.expirationTime=Date.now()+1e3*d["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let d=Date.now(),p=!1;if(this.expirationTime>d)p=!1;else if(s)if(this.expirationTime<s)p=!0;else{let g=this.expirationTime-s;g?this.expirationTime=d+Math.max(g,3e4):p=!0}else p=!0;p?(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(e,s){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;let d=this.latestFeatureIndex.loadVTLayers();for(let p in this.buckets){if(!s.style.hasLayer(p))continue;let g=this.buckets[p],v=g.layers[0].sourceLayer||"_geojsonTileLayer",T=d[v],M=e[v];if(!T||!M||Object.keys(M).length===0)continue;g.update(M,T,this.imageAtlas&&this.imageAtlas.patternPositions||{});let P=s&&s.style&&s.style.getLayer(p);P&&(this.queryPadding=Math.max(this.queryPadding,P.queryRadius(g)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<E.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=E.now()+e}setDependencies(e,s){let d={};for(let p of s)d[p]=!0;this.dependencies[e]=d}hasDependency(e,s){for(let d of e){let p=this.dependencies[d];if(p){for(let g of s)if(p[g])return!0}}return!1}}class an{constructor(e,s){this.max=e,this.onRemove=s,this.reset()}reset(){for(let e in this.data)for(let s of this.data[e])s.timeout&&clearTimeout(s.timeout),this.onRemove(s.value);return this.data={},this.order=[],this}add(e,s,d){let p=e.wrapped().key;this.data[p]===void 0&&(this.data[p]=[]);let g={value:s,timeout:void 0};if(d!==void 0&&(g.timeout=setTimeout(()=>{this.remove(e,g)},d)),this.data[p].push(g),this.order.push(p),this.order.length>this.max){let v=this._getAndRemoveByKey(this.order[0]);v&&this.onRemove(v)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let s=this.data[e].shift();return s.timeout&&clearTimeout(s.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),s.value}getByKey(e){let s=this.data[e];return s?s[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,s){if(!this.has(e))return this;let d=e.wrapped().key,p=s===void 0?0:this.data[d].indexOf(s),g=this.data[d][p];return this.data[d].splice(p,1),g.timeout&&clearTimeout(g.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(g.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let s=this._getAndRemoveByKey(this.order[0]);s&&this.onRemove(s)}return this}filter(e){let s=[];for(let d in this.data)for(let p of this.data[d])e(p.value)||s.push(p);for(let d of s)this.remove(d.value.tileID,d)}}class zn{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,s,d){let p=String(s);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][p]=this.stateChanges[e][p]||{},n.e(this.stateChanges[e][p],d),this.deletedStates[e]===null){this.deletedStates[e]={};for(let g in this.state[e])g!==p&&(this.deletedStates[e][g]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][p]===null){this.deletedStates[e][p]={};for(let g in this.state[e][p])d[g]||(this.deletedStates[e][p][g]=null)}else for(let g in d)this.deletedStates[e]&&this.deletedStates[e][p]&&this.deletedStates[e][p][g]===null&&delete this.deletedStates[e][p][g]}removeFeatureState(e,s,d){if(this.deletedStates[e]===null)return;let p=String(s);if(this.deletedStates[e]=this.deletedStates[e]||{},d&&s!==void 0)this.deletedStates[e][p]!==null&&(this.deletedStates[e][p]=this.deletedStates[e][p]||{},this.deletedStates[e][p][d]=null);else if(s!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][p])for(d in this.deletedStates[e][p]={},this.stateChanges[e][p])this.deletedStates[e][p][d]=null;else this.deletedStates[e][p]=null;else this.deletedStates[e]=null}getState(e,s){let d=String(s),p=n.e({},(this.state[e]||{})[d],(this.stateChanges[e]||{})[d]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let g=this.deletedStates[e][s];if(g===null)return{};for(let v in g)delete p[v]}return p}initializeTileState(e,s){e.setFeatureState(this.state,s)}coalesceChanges(e,s){let d={};for(let p in this.stateChanges){this.state[p]=this.state[p]||{};let g={};for(let v in this.stateChanges[p])this.state[p][v]||(this.state[p][v]={}),n.e(this.state[p][v],this.stateChanges[p][v]),g[v]=this.state[p][v];d[p]=g}for(let p in this.deletedStates){this.state[p]=this.state[p]||{};let g={};if(this.deletedStates[p]===null)for(let v in this.state[p])g[v]={},this.state[p][v]={};else for(let v in this.deletedStates[p]){if(this.deletedStates[p][v]===null)this.state[p][v]={};else for(let T of Object.keys(this.deletedStates[p][v]))delete this.state[p][v][T];g[v]=this.state[p][v]}d[p]=d[p]||{},n.e(d[p],g)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(let p in e)e[p].setFeatureState(d,s)}}function zs(m,e,s){let d=e.intersectsFrustum(m);if(!s)return d;let p=e.intersectsPlane(s);return d===0||p===0?0:d===2&&p===2?2:1}function Os(m,e,s,d,p){let g=m,v=Math.atan(e/s),T=Math.hypot(e,s);return g=m+n.a8(d/T/Math.max(.5,Math.cos(n.aa(p/2)))),g+=1*n.a8(Math.cos(v))/2,g+=n.ab(m-g,-0,0),g}function On(m,e){let s=(e.roundZoom?Math.round:Math.floor)(m.zoom+n.a8(m.tileSize/e.tileSize));return Math.max(0,s)}function K(m,e){let s=m.getCameraFrustum(),d=m.getClippingPlane(),p=m.screenPointToMercatorCoordinate(m.getCameraPoint()),g=n.Y.fromLngLat(m.center,m.elevation);p.z=g.z+Math.cos(m.pitchInRadians)*m.cameraToCenterDistance/m.worldSize;let v=m.getCoveringTilesDetailsProvider(),T=v.allowVariableZoom(m,e),M=On(m,e),P=e.minzoom||0,D=e.maxzoom!==void 0?e.maxzoom:m.maxZoom,F=Math.min(Math.max(0,M),D),O=Math.pow(2,F),V=[O*p.x,O*p.y,0],q=[O*g.x,O*g.y,0],Q=Math.hypot(g.x-p.x,g.y-p.y),J=Math.abs(g.z-p.z),ee=Math.hypot(Q,J),ie=ce=>({zoom:0,x:0,y:0,wrap:ce,fullyVisible:!1}),ae=[],le=[];if(m.renderWorldCopies&&v.allowWorldCopies())for(let ce=1;ce<=3;ce++)ae.push(ie(-ce)),ae.push(ie(ce));for(ae.push(ie(0));ae.length>0;){let ce=ae.pop(),fe=ce.x,ue=ce.y,we=ce.fullyVisible,Ce={x:fe,y:ue,z:ce.zoom},ze=v.getTileAABB(Ce,ce.wrap,m.elevation,e);if(!we){let $e=zs(s,ze,d);if($e===0)continue;we=$e===2}let Fe=v.distanceToTile2d(p.x,p.y,Ce,ze),Ae=M;T&&(Ae=(e.calculateTileZoom||Os)(m.zoom+n.a8(m.tileSize/e.tileSize),Fe,J,ee,m.fov)),Ae=(e.roundZoom?Math.round:Math.floor)(Ae),Ae=Math.max(0,Ae);let Ye=Math.min(Ae,D);if(ce.wrap=v.getWrap(g,Ce,ce.wrap),ce.zoom>=Ye){if(ce.zoom<P)continue;let $e=F-ce.zoom,Oe=V[0]-.5-(fe<<$e),st=V[1]-.5-(ue<<$e),Ct=e.reparseOverscaled?Math.max(ce.zoom,Ae):ce.zoom;le.push({tileID:new n.S(ce.zoom===D?Ct:ce.zoom,ce.wrap,ce.zoom,fe,ue),distanceSq:n.a9([q[0]-.5-fe,q[1]-.5-ue]),tileDistanceToCamera:Math.sqrt(Oe*Oe+st*st)})}else for(let $e=0;$e<4;$e++)ae.push({zoom:ce.zoom+1,x:(fe<<1)+$e%2,y:(ue<<1)+($e>>1),wrap:ce.wrap,fullyVisible:we})}return le.sort((ce,fe)=>ce.distanceSq-fe.distanceSq).map(ce=>ce.tileID)}class Z extends n.E{constructor(e,s,d){super(),this.id=e,this.dispatcher=d,this.on("data",p=>this._dataHandler(p)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((p,g,v,T)=>{let M=new(Dn(g.type))(p,g,v,T);if(M.id!==p)throw new Error(`Expected Source id to be ${p} instead of ${M.id}`);return M})(e,s,d,this),this._tiles={},this._cache=new an(0,p=>this._unloadTile(p)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new zn,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let e in this._tiles){let s=this._tiles[e];if(s.state!=="loaded"&&s.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,s,d){return n._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,s,d)}catch(p){e.state="errored",p.status!==404?this._source.fire(new n.j(p,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new n.k("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let s in this._tiles){let d=this._tiles[s];d.upload(e),d.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort($).map(e=>e.key)}getRenderableIds(e){let s=[];for(let d in this._tiles)this._isIdRenderable(d,e)&&s.push(this._tiles[d]);return e?s.sort((d,p)=>{let g=d.tileID,v=p.tileID,T=new n.P(g.canonical.x,g.canonical.y)._rotate(-this.transform.bearingInRadians),M=new n.P(v.canonical.x,v.canonical.y)._rotate(-this.transform.bearingInRadians);return g.overscaledZ-v.overscaledZ||M.y-T.y||M.x-T.x}).map(d=>d.tileID.key):s.map(d=>d.tileID).sort($).map(d=>d.key)}hasRenderableParent(e){let s=this.findLoadedParent(e,0);return!!s&&this._isIdRenderable(s.tileID.key)}_isIdRenderable(e,s){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(s||!this._tiles[e].holdingForFade())}reload(e){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let s in this._tiles)(e||this._tiles[s].state!=="errored")&&this._reloadTile(s,"reloading")}}_reloadTile(e,s){return n._(this,void 0,void 0,function*(){let d=this._tiles[e];d&&(d.state!=="loading"&&(d.state=s),yield this._loadTile(d,e,s))})}_tileLoaded(e,s,d){e.timeAdded=E.now(),d==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(s,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new n.k("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let s=this.getRenderableIds();for(let p=0;p<s.length;p++){let g=s[p];if(e.neighboringTiles&&e.neighboringTiles[g]){let v=this.getTileByID(g);d(e,v),d(v,e)}}function d(p,g){p.needsHillshadePrepare=!0,p.needsTerrainPrepare=!0;let v=g.tileID.canonical.x-p.tileID.canonical.x,T=g.tileID.canonical.y-p.tileID.canonical.y,M=Math.pow(2,p.tileID.canonical.z),P=g.tileID.key;v===0&&T===0||Math.abs(T)>1||(Math.abs(v)>1&&(Math.abs(v+M)===1?v+=M:Math.abs(v-M)===1&&(v-=M)),g.dem&&p.dem&&(p.dem.backfillBorder(g.dem,v,T),p.neighboringTiles&&p.neighboringTiles[P]&&(p.neighboringTiles[P].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,s,d,p){for(let g in this._tiles){let v=this._tiles[g];if(p[g]||!v.hasData()||v.tileID.overscaledZ<=s||v.tileID.overscaledZ>d)continue;let T=v.tileID;for(;v&&v.tileID.overscaledZ>s+1;){let P=v.tileID.scaledTo(v.tileID.overscaledZ-1);v=this._tiles[P.key],v&&v.hasData()&&(T=P)}let M=T;for(;M.overscaledZ>s;)if(M=M.scaledTo(M.overscaledZ-1),e[M.key]||e[M.canonical.key]){p[T.key]=T;break}}}findLoadedParent(e,s){if(e.key in this._loadedParentTiles){let d=this._loadedParentTiles[e.key];return d&&d.tileID.overscaledZ>=s?d:null}for(let d=e.overscaledZ-1;d>=s;d--){let p=e.scaledTo(d),g=this._getLoadedTile(p);if(g)return g}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){let s=this._tiles[e.key];return s&&s.hasData()?s:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let s=Math.ceil(e.width/this._source.tileSize)+1,d=Math.ceil(e.height/this._source.tileSize)+1,p=Math.floor(s*d*(this._maxTileCacheZoomLevels===null?n.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),g=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,p):p;this._cache.setMaxSize(g)}handleWrapJump(e){let s=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,s){let d={};for(let p in this._tiles){let g=this._tiles[p];g.tileID=g.tileID.unwrapTo(g.tileID.wrap+s),d[g.tileID.key]=g}this._tiles=d;for(let p in this._timers)clearTimeout(this._timers[p]),delete this._timers[p];for(let p in this._tiles)this._setTileReloadTimer(p,this._tiles[p])}}_updateCoveredAndRetainedTiles(e,s,d,p,g,v){let T={},M={},P=Object.keys(e),D=E.now();for(let F of P){let O=e[F],V=this._tiles[F];if(!V||V.fadeEndTime!==0&&V.fadeEndTime<=D)continue;let q=this.findLoadedParent(O,s),Q=this.findLoadedSibling(O),J=q||Q||null;J&&(this._addTile(J.tileID),T[J.tileID.key]=J.tileID),M[F]=O}this._retainLoadedChildren(M,p,d,e);for(let F in T)e[F]||(this._coveredTiles[F]=!0,e[F]=T[F]);if(v){let F={},O={};for(let V of g)this._tiles[V.key].hasData()?F[V.key]=V:O[V.key]=V;for(let V in O){let q=O[V].children(this._source.maxzoom);this._tiles[q[0].key]&&this._tiles[q[1].key]&&this._tiles[q[2].key]&&this._tiles[q[3].key]&&(F[q[0].key]=e[q[0].key]=q[0],F[q[1].key]=e[q[1].key]=q[1],F[q[2].key]=e[q[2].key]=q[2],F[q[3].key]=e[q[3].key]=q[3],delete O[V])}for(let V in O){let q=O[V],Q=this.findLoadedParent(q,this._source.minzoom),J=this.findLoadedSibling(q),ee=Q||J||null;if(ee){F[ee.tileID.key]=e[ee.tileID.key]=ee.tileID;for(let ie in F)F[ie].isChildOf(ee.tileID)&&delete F[ie]}}for(let V in this._tiles)F[V]||(this._coveredTiles[V]=!0)}}update(e,s){if(!this._sourceLoaded||this._paused)return;let d;this.transform=e,this.terrain=s,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?d=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(D=>new n.S(D.canonical.z,D.wrap,D.canonical.z,D.canonical.x,D.canonical.y)):(d=K(e,{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:s,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(d=d.filter(D=>this._source.hasTile(D)))):d=[];let p=On(e,this._source),g=Math.max(p-Z.maxOverzooming,this._source.minzoom),v=Math.max(p+Z.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let D={};for(let F of d)if(F.canonical.z>this._source.minzoom){let O=F.scaledTo(F.canonical.z-1);D[O.key]=O;let V=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));D[V.key]=V}d=d.concat(Object.values(D))}let T=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,T&&this.fire(new n.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let M=this._updateRetainedTiles(d,p);X(this._source.type)&&this._updateCoveredAndRetainedTiles(M,g,v,p,d,s);for(let D in M)this._tiles[D].clearFadeHold();let P=n.ac(this._tiles,M);for(let D of P){let F=this._tiles[D];F.hasSymbolBuckets&&!F.holdingForFade()?F.setHoldDuration(this.map._fadeDuration):F.hasSymbolBuckets&&!F.symbolFadeFinished()||this._removeTile(D)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,s){var d;let p={},g={},v=Math.max(s-Z.maxOverzooming,this._source.minzoom),T=Math.max(s+Z.maxUnderzooming,this._source.minzoom),M={};for(let P of e){let D=this._addTile(P);p[P.key]=P,D.hasData()||s<this._source.maxzoom&&(M[P.key]=P)}this._retainLoadedChildren(M,s,T,p);for(let P of e){let D=this._tiles[P.key];if(D.hasData())continue;if(s+1>this._source.maxzoom){let O=P.children(this._source.maxzoom)[0],V=this.getTile(O);if(V&&V.hasData()){p[O.key]=O;continue}}else{let O=P.children(this._source.maxzoom);if(p[O[0].key]&&p[O[1].key]&&p[O[2].key]&&p[O[3].key])continue}let F=D.wasRequested();for(let O=P.overscaledZ-1;O>=v;--O){let V=P.scaledTo(O);if(g[V.key])break;if(g[V.key]=!0,D=this.getTile(V),!D&&F&&(D=this._addTile(V)),D){let q=D.hasData();if((q||!(!((d=this.map)===null||d===void 0)&&d.cancelPendingTileRequestsWhileZooming)||F)&&(p[V.key]=V),F=D.wasRequested(),q)break}}}return p}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let s=[],d,p=this._tiles[e].tileID;for(;p.overscaledZ>0;){if(p.key in this._loadedParentTiles){d=this._loadedParentTiles[p.key];break}s.push(p.key);let g=p.scaledTo(p.overscaledZ-1);if(d=this._getLoadedTile(g),d)break;p=g}for(let g of s)this._loadedParentTiles[g]=d}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let e in this._tiles){let s=this._tiles[e].tileID,d=this._getLoadedTile(s);this._loadedSiblingTiles[s.key]=d}}_addTile(e){let s=this._tiles[e.key];if(s)return s;s=this._cache.getAndRemove(e),s&&(this._setTileReloadTimer(e.key,s),s.tileID=e,this._state.initializeTileState(s,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,s)));let d=s;return s||(s=new Fn(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(s,e.key,s.state)),s.uses++,this._tiles[e.key]=s,d||this._source.fire(new n.k("dataloading",{tile:s,coord:s.tileID,dataType:"source"})),s}_setTileReloadTimer(e,s){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let d=s.getExpiryTimeout();d&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},d))}_removeTile(e){let s=this._tiles[e];s&&(s.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),s.uses>0||(s.hasData()&&s.state!=="reloading"?this._cache.add(s.tileID,s,s.getExpiryTimeout()):(s.aborted=!0,this._abortTile(s),this._unloadTile(s))))}_dataHandler(e){let s=e.sourceDataType;e.dataType==="source"&&s==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&s==="content"&&(this.reload(e.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,s,d){let p=[],g=this.transform;if(!g)return p;let v=d?g.getCameraQueryGeometry(e):e,T=e.map(q=>g.screenPointToMercatorCoordinate(q,this.terrain)),M=v.map(q=>g.screenPointToMercatorCoordinate(q,this.terrain)),P=this.getIds(),D=1/0,F=1/0,O=-1/0,V=-1/0;for(let q of M)D=Math.min(D,q.x),F=Math.min(F,q.y),O=Math.max(O,q.x),V=Math.max(V,q.y);for(let q=0;q<P.length;q++){let Q=this._tiles[P[q]];if(Q.holdingForFade())continue;let J=Q.tileID,ee=Math.pow(2,g.zoom-Q.tileID.overscaledZ),ie=s*Q.queryPadding*n.X/Q.tileSize/ee,ae=[J.getTilePoint(new n.Y(D,F)),J.getTilePoint(new n.Y(O,V))];if(ae[0].x-ie<n.X&&ae[0].y-ie<n.X&&ae[1].x+ie>=0&&ae[1].y+ie>=0){let le=T.map(fe=>J.getTilePoint(fe)),ce=M.map(fe=>J.getTilePoint(fe));p.push({tile:Q,tileID:J,queryGeometry:le,cameraQueryGeometry:ce,scale:ee})}}return p}getVisibleCoordinates(e){let s=this.getRenderableIds(e).map(d=>this._tiles[d].tileID);return this.transform&&this.transform.populateCache(s),s}hasTransition(){if(this._source.hasTransition())return!0;if(X(this._source.type)){let e=E.now();for(let s in this._tiles)if(this._tiles[s].fadeEndTime>=e)return!0}return!1}setFeatureState(e,s,d){this._state.updateState(e=e||"_geojsonTileLayer",s,d)}removeFeatureState(e,s,d){this._state.removeFeatureState(e=e||"_geojsonTileLayer",s,d)}getFeatureState(e,s){return this._state.getState(e=e||"_geojsonTileLayer",s)}setDependencies(e,s,d){let p=this._tiles[e];p&&p.setDependencies(s,d)}reloadTilesForDependencies(e,s){for(let d in this._tiles)this._tiles[d].hasDependency(e,s)&&this._reloadTile(d,"reloading");this._cache.filter(d=>!d.hasDependency(e,s))}}function $(m,e){let s=Math.abs(2*m.wrap)-+(m.wrap<0),d=Math.abs(2*e.wrap)-+(e.wrap<0);return m.overscaledZ-e.overscaledZ||d-s||e.canonical.y-m.canonical.y||e.canonical.x-m.canonical.x}function X(m){return m==="raster"||m==="image"||m==="video"}Z.maxOverzooming=10,Z.maxUnderzooming=3;class ne{constructor(e,s){this.reset(e,s)}reset(e,s){this.points=e||[],this._distances=[0];for(let d=1;d<this.points.length;d++)this._distances[d]=this._distances[d-1]+this.points[d].dist(this.points[d-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(s||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=n.ab(e,0,1);let s=1,d=this._distances[s],p=e*this.paddedLength+this.padding;for(;d<p&&s<this._distances.length;)d=this._distances[++s];let g=s-1,v=this._distances[g],T=d-v,M=T>0?(p-v)/T:0;return this.points[g].mult(1-M).add(this.points[s].mult(M))}}function he(m,e){let s=!0;return m==="always"||m!=="never"&&e!=="never"||(s=!1),s}class ye{constructor(e,s,d){let p=this.boxCells=[],g=this.circleCells=[];this.xCellCount=Math.ceil(e/d),this.yCellCount=Math.ceil(s/d);for(let v=0;v<this.xCellCount*this.yCellCount;v++)p.push([]),g.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=s,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/s,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,s,d,p,g){this._forEachCell(s,d,p,g,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(s),this.bboxes.push(d),this.bboxes.push(p),this.bboxes.push(g)}insertCircle(e,s,d,p){this._forEachCell(s-p,d-p,s+p,d+p,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(s),this.circles.push(d),this.circles.push(p)}_insertBoxCell(e,s,d,p,g,v){this.boxCells[g].push(v)}_insertCircleCell(e,s,d,p,g,v){this.circleCells[g].push(v)}_query(e,s,d,p,g,v,T){if(d<0||e>this.width||p<0||s>this.height)return[];let M=[];if(e<=0&&s<=0&&this.width<=d&&this.height<=p){if(g)return[{key:null,x1:e,y1:s,x2:d,y2:p}];for(let P=0;P<this.boxKeys.length;P++)M.push({key:this.boxKeys[P],x1:this.bboxes[4*P],y1:this.bboxes[4*P+1],x2:this.bboxes[4*P+2],y2:this.bboxes[4*P+3]});for(let P=0;P<this.circleKeys.length;P++){let D=this.circles[3*P],F=this.circles[3*P+1],O=this.circles[3*P+2];M.push({key:this.circleKeys[P],x1:D-O,y1:F-O,x2:D+O,y2:F+O})}}else this._forEachCell(e,s,d,p,this._queryCell,M,{hitTest:g,overlapMode:v,seenUids:{box:{},circle:{}}},T);return M}query(e,s,d,p){return this._query(e,s,d,p,!1,null)}hitTest(e,s,d,p,g,v){return this._query(e,s,d,p,!0,g,v).length>0}hitTestCircle(e,s,d,p,g){let v=e-d,T=e+d,M=s-d,P=s+d;if(T<0||v>this.width||P<0||M>this.height)return!1;let D=[];return this._forEachCell(v,M,T,P,this._queryCellCircle,D,{hitTest:!0,overlapMode:p,circle:{x:e,y:s,radius:d},seenUids:{box:{},circle:{}}},g),D.length>0}_queryCell(e,s,d,p,g,v,T,M){let{seenUids:P,hitTest:D,overlapMode:F}=T,O=this.boxCells[g];if(O!==null){let q=this.bboxes;for(let Q of O)if(!P.box[Q]){P.box[Q]=!0;let J=4*Q,ee=this.boxKeys[Q];if(e<=q[J+2]&&s<=q[J+3]&&d>=q[J+0]&&p>=q[J+1]&&(!M||M(ee))&&(!D||!he(F,ee.overlapMode))&&(v.push({key:ee,x1:q[J],y1:q[J+1],x2:q[J+2],y2:q[J+3]}),D))return!0}}let V=this.circleCells[g];if(V!==null){let q=this.circles;for(let Q of V)if(!P.circle[Q]){P.circle[Q]=!0;let J=3*Q,ee=this.circleKeys[Q];if(this._circleAndRectCollide(q[J],q[J+1],q[J+2],e,s,d,p)&&(!M||M(ee))&&(!D||!he(F,ee.overlapMode))){let ie=q[J],ae=q[J+1],le=q[J+2];if(v.push({key:ee,x1:ie-le,y1:ae-le,x2:ie+le,y2:ae+le}),D)return!0}}}return!1}_queryCellCircle(e,s,d,p,g,v,T,M){let{circle:P,seenUids:D,overlapMode:F}=T,O=this.boxCells[g];if(O!==null){let q=this.bboxes;for(let Q of O)if(!D.box[Q]){D.box[Q]=!0;let J=4*Q,ee=this.boxKeys[Q];if(this._circleAndRectCollide(P.x,P.y,P.radius,q[J+0],q[J+1],q[J+2],q[J+3])&&(!M||M(ee))&&!he(F,ee.overlapMode))return v.push(!0),!0}}let V=this.circleCells[g];if(V!==null){let q=this.circles;for(let Q of V)if(!D.circle[Q]){D.circle[Q]=!0;let J=3*Q,ee=this.circleKeys[Q];if(this._circlesCollide(q[J],q[J+1],q[J+2],P.x,P.y,P.radius)&&(!M||M(ee))&&!he(F,ee.overlapMode))return v.push(!0),!0}}}_forEachCell(e,s,d,p,g,v,T,M){let P=this._convertToXCellCoord(e),D=this._convertToYCellCoord(s),F=this._convertToXCellCoord(d),O=this._convertToYCellCoord(p);for(let V=P;V<=F;V++)for(let q=D;q<=O;q++)if(g.call(this,e,s,d,p,this.xCellCount*q+V,v,T,M))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,s,d,p,g,v){let T=p-e,M=g-s,P=d+v;return P*P>T*T+M*M}_circleAndRectCollide(e,s,d,p,g,v,T){let M=(v-p)/2,P=Math.abs(e-(p+M));if(P>M+d)return!1;let D=(T-g)/2,F=Math.abs(s-(g+D));if(F>D+d)return!1;if(P<=M||F<=D)return!0;let O=P-M,V=F-D;return O*O+V*V<=d*d}}function Te(m,e,s){let d=n.H();if(!m){let{vecSouth:F,vecEast:O}=Ee(e),V=b();V[0]=O[0],V[1]=O[1],V[2]=F[0],V[3]=F[1],p=V,(D=(v=(g=V)[0])*(P=g[3])-(M=g[2])*(T=g[1]))&&(p[0]=P*(D=1/D),p[1]=-T*D,p[2]=-M*D,p[3]=v*D),d[0]=V[0],d[1]=V[1],d[4]=V[2],d[5]=V[3]}var p,g,v,T,M,P,D;return n.K(d,d,[1/s,1/s,1]),d}function _e(m,e,s,d){if(m){let p=n.H();if(!e){let{vecSouth:g,vecEast:v}=Ee(s);p[0]=v[0],p[1]=v[1],p[4]=g[0],p[5]=g[1]}return n.K(p,p,[d,d,1]),p}return s.pixelsToClipSpaceMatrix}function Ee(m){let e=Math.cos(m.rollInRadians),s=Math.sin(m.rollInRadians),d=Math.cos(m.pitchInRadians),p=Math.cos(m.bearingInRadians),g=Math.sin(m.bearingInRadians),v=n.ad();v[0]=-p*d*s-g*e,v[1]=-g*d*s+p*e;let T=n.ae(v);T<1e-9?n.af(v):n.ag(v,v,1/T);let M=n.ad();M[0]=p*d*e-g*s,M[1]=g*d*e+p*s;let P=n.ae(M);return P<1e-9?n.af(M):n.ag(M,M,1/P),{vecEast:M,vecSouth:v}}function Ie(m,e,s,d){let p;d?(p=[m,e,d(m,e),1],n.al(p,p,s)):(p=[m,e,0,1],ki(p,p,s));let g=p[3];return{point:new n.P(p[0]/g,p[1]/g),signedDistanceFromCamera:g,isOccluded:!1}}function xe(m,e){return .5+m/e*.5}function pe(m,e){return m.x>=-e[0]&&m.x<=e[0]&&m.y>=-e[1]&&m.y<=e[1]}function Xe(m,e,s,d,p,g,v,T,M,P,D,F,O){let V=s?m.textSizeData:m.iconSizeData,q=n.ah(V,e.transform.zoom),Q=[256/e.width*2+1,256/e.height*2+1],J=s?m.text.dynamicLayoutVertexArray:m.icon.dynamicLayoutVertexArray;J.clear();let ee=m.lineVertexArray,ie=s?m.text.placedSymbolArray:m.icon.placedSymbolArray,ae=e.transform.width/e.transform.height,le=!1;for(let ce=0;ce<ie.length;ce++){let fe=ie.get(ce);if(fe.hidden||fe.writingMode===n.ai.vertical&&!le){ji(fe.numGlyphs,J);continue}le=!1;let ue=new n.P(fe.anchorX,fe.anchorY),we={getElevation:O,pitchedLabelPlaneMatrix:d,lineVertexArray:ee,pitchWithMap:g,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:ue,unwrappedTileID:M,width:P,height:D,translation:F},Ce=mt(fe.anchorX,fe.anchorY,we);if(!pe(Ce.point,Q)){ji(fe.numGlyphs,J);continue}let ze=xe(e.transform.cameraToCenterDistance,Ce.signedDistanceFromCamera),Fe=n.aj(V,q,fe),Ae=g?Fe*e.transform.getPitchedTextCorrection(fe.anchorX,fe.anchorY,M)/ze:Fe*ze,Ye=pt({projectionContext:we,pitchedLabelPlaneMatrixInverse:p,symbol:fe,fontSize:Ae,flip:!1,keepUpright:v,glyphOffsetArray:m.glyphOffsetArray,dynamicLayoutVertexArray:J,aspectRatio:ae,rotateToLine:T});le=Ye.useVertical,(Ye.notEnoughRoom||le||Ye.needsFlipping&&pt({projectionContext:we,pitchedLabelPlaneMatrixInverse:p,symbol:fe,fontSize:Ae,flip:!0,keepUpright:v,glyphOffsetArray:m.glyphOffsetArray,dynamicLayoutVertexArray:J,aspectRatio:ae,rotateToLine:T}).notEnoughRoom)&&ji(fe.numGlyphs,J)}s?m.text.dynamicLayoutVertexBuffer.updateData(J):m.icon.dynamicLayoutVertexBuffer.updateData(J)}function Ue(m,e,s,d,p,g,v,T){let M=g.glyphStartIndex+g.numGlyphs,P=g.lineStartIndex,D=g.lineStartIndex+g.lineLength,F=e.getoffsetX(g.glyphStartIndex),O=e.getoffsetX(M-1),V=ai(m*F,s,d,p,g.segment,P,D,T,v);if(!V)return null;let q=ai(m*O,s,d,p,g.segment,P,D,T,v);return q?T.projectionCache.anyProjectionOccluded?null:{first:V,last:q}:null}function ht(m,e,s,d){return m===n.ai.horizontal&&Math.abs(s.y-e.y)>Math.abs(s.x-e.x)*d?{useVertical:!0}:(m===n.ai.vertical?e.y<s.y:e.x>s.x)?{needsFlipping:!0}:null}function pt(m){let{projectionContext:e,pitchedLabelPlaneMatrixInverse:s,symbol:d,fontSize:p,flip:g,keepUpright:v,glyphOffsetArray:T,dynamicLayoutVertexArray:M,aspectRatio:P,rotateToLine:D}=m,F=p/24,O=d.lineOffsetX*F,V=d.lineOffsetY*F,q;if(d.numGlyphs>1){let Q=d.glyphStartIndex+d.numGlyphs,J=d.lineStartIndex,ee=d.lineStartIndex+d.lineLength,ie=Ue(F,T,O,V,g,d,D,e);if(!ie)return{notEnoughRoom:!0};let ae=wt(ie.first.point.x,ie.first.point.y,e,s),le=wt(ie.last.point.x,ie.last.point.y,e,s);if(v&&!g){let ce=ht(d.writingMode,ae,le,P);if(ce)return ce}q=[ie.first];for(let ce=d.glyphStartIndex+1;ce<Q-1;ce++)q.push(ai(F*T.getoffsetX(ce),O,V,g,d.segment,J,ee,e,D));q.push(ie.last)}else{if(v&&!g){let J=Qe(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,ee=d.lineStartIndex+d.segment+1,ie=new n.P(e.lineVertexArray.getx(ee),e.lineVertexArray.gety(ee)),ae=Qe(ie.x,ie.y,e),le=ae.signedDistanceFromCamera>0?ae.point:Pe(e.tileAnchorPoint,ie,J,1,e),ce=wt(J.x,J.y,e,s),fe=wt(le.x,le.y,e,s),ue=ht(d.writingMode,ce,fe,P);if(ue)return ue}let Q=ai(F*T.getoffsetX(d.glyphStartIndex),O,V,g,d.segment,d.lineStartIndex,d.lineStartIndex+d.lineLength,e,D);if(!Q||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};q=[Q]}for(let Q of q)n.ak(M,Q.point,Q.angle);return{}}function Pe(m,e,s,d,p){let g=m.add(m.sub(e)._unit()),v=Qe(g.x,g.y,p).point,T=s.sub(v);return s.add(T._mult(d/T.mag()))}function We(m,e,s){let d=e.projectionCache;if(d.projections[m])return d.projections[m];let p=new n.P(e.lineVertexArray.getx(m),e.lineVertexArray.gety(m)),g=Qe(p.x,p.y,e);if(g.signedDistanceFromCamera>0)return d.projections[m]=g.point,d.anyProjectionOccluded=d.anyProjectionOccluded||g.isOccluded,g.point;let v=m-s.direction;return Pe(s.distanceFromAnchor===0?e.tileAnchorPoint:new n.P(e.lineVertexArray.getx(v),e.lineVertexArray.gety(v)),p,s.previousVertex,s.absOffsetX-s.distanceFromAnchor+1,e)}function Qe(m,e,s){let d=m+s.translation[0],p=e+s.translation[1],g;return s.pitchWithMap?(g=Ie(d,p,s.pitchedLabelPlaneMatrix,s.getElevation),g.isOccluded=!1):(g=s.transform.projectTileCoordinates(d,p,s.unwrappedTileID,s.getElevation),g.point.x=(.5*g.point.x+.5)*s.width,g.point.y=(.5*-g.point.y+.5)*s.height),g}function wt(m,e,s,d){if(s.pitchWithMap){let p=[m,e,0,1];return n.al(p,p,d),s.transform.projectTileCoordinates(p[0]/p[3],p[1]/p[3],s.unwrappedTileID,s.getElevation).point}return{x:m/s.width*2-1,y:e/s.height*2-1}}function mt(m,e,s){return s.transform.projectTileCoordinates(m,e,s.unwrappedTileID,s.getElevation)}function nt(m,e,s){return m._unit()._perp()._mult(e*s)}function Ke(m,e,s,d,p,g,v,T,M){if(T.projectionCache.offsets[m])return T.projectionCache.offsets[m];let P=s.add(e);if(m+M.direction<d||m+M.direction>=p)return T.projectionCache.offsets[m]=P,P;let D=We(m+M.direction,T,M),F=nt(D.sub(s),v,M.direction),O=s.add(F),V=D.add(F);return T.projectionCache.offsets[m]=n.am(g,P,O,V)||P,T.projectionCache.offsets[m]}function ai(m,e,s,d,p,g,v,T,M){let P=d?m-e:m+e,D=P>0?1:-1,F=0;d&&(D*=-1,F=Math.PI),D<0&&(F+=Math.PI);let O,V=D>0?g+p:g+p+1;T.projectionCache.cachedAnchorPoint?O=T.projectionCache.cachedAnchorPoint:(O=Qe(T.tileAnchorPoint.x,T.tileAnchorPoint.y,T).point,T.projectionCache.cachedAnchorPoint=O);let q,Q,J=O,ee=O,ie=0,ae=0,le=Math.abs(P),ce=[],fe;for(;ie+ae<=le;){if(V+=D,V<g||V>=v)return null;ie+=ae,ee=J,Q=q;let Ce={absOffsetX:le,direction:D,distanceFromAnchor:ie,previousVertex:ee};if(J=We(V,T,Ce),s===0)ce.push(ee),fe=J.sub(ee);else{let ze,Fe=J.sub(ee);ze=Fe.mag()===0?nt(We(V+D,T,Ce).sub(J),s,D):nt(Fe,s,D),Q||(Q=ee.add(ze)),q=Ke(V,ze,J,g,v,Q,s,T,Ce),ce.push(Q),fe=q.sub(Q)}ae=fe.mag()}let ue=fe._mult((le-ie)/ae)._add(Q||ee),we=F+Math.atan2(J.y-ee.y,J.x-ee.x);return ce.push(ue),{point:ue,angle:M?we:0,path:ce}}let Bs=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ji(m,e){for(let s=0;s<m;s++){let d=e.length;e.resize(d+4),e.float32.set(Bs,3*d)}}function ki(m,e,s){let d=e[0],p=e[1];return m[0]=s[0]*d+s[4]*p+s[12],m[1]=s[1]*d+s[5]*p+s[13],m[3]=s[3]*d+s[7]*p+s[15],m}let li=100;class ln{constructor(e,s=new ye(e.width+200,e.height+200,25),d=new ye(e.width+200,e.height+200,25)){this.transform=e,this.grid=s,this.ignoredGrid=d,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+li,this.screenBottomBoundary=e.height+li,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,s,d,p,g,v,T,M,P,D,F,O){let V=this.projectAndGetPerspectiveRatio(e.anchorPointX+M[0],e.anchorPointY+M[1],g,D,O),q=d*V.perspectiveRatio,Q;if(v||T)Q=this._projectCollisionBox(e,q,p,g,v,T,M,V,D,F,O);else{let fe=V.x+(F?F.x*q:0),ue=V.y+(F?F.y*q:0);Q={allPointsOccluded:!1,box:[fe+e.x1*q,ue+e.y1*q,fe+e.x2*q,ue+e.y2*q]}}let[J,ee,ie,ae]=Q.box,le=v?Q.allPointsOccluded:V.isOccluded,ce=le;return ce||(ce=V.perspectiveRatio<this.perspectiveRatioCutoff),ce||(ce=!this.isInsideGrid(J,ee,ie,ae)),ce||s!=="always"&&this.grid.hitTest(J,ee,ie,ae,s,P)?{box:[J,ee,ie,ae],placeable:!1,offscreen:!1,occluded:le}:{box:[J,ee,ie,ae],placeable:!0,offscreen:this.isOffscreen(J,ee,ie,ae),occluded:le}}placeCollisionCircles(e,s,d,p,g,v,T,M,P,D,F,O,V,q){let Q=[],J=new n.P(s.anchorX,s.anchorY),ee=this.getPerspectiveRatio(J.x,J.y,v,q),ie=(P?g*this.transform.getPitchedTextCorrection(s.anchorX,s.anchorY,v)/ee:g*ee)/n.as,ae={getElevation:q,pitchedLabelPlaneMatrix:T,lineVertexArray:d,pitchWithMap:P,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:J,unwrappedTileID:v,width:this.transform.width,height:this.transform.height,translation:V},le=Ue(ie,p,s.lineOffsetX*ie,s.lineOffsetY*ie,!1,s,!1,ae),ce=!1,fe=!1,ue=!0;if(le){let we=.5*F*ee+O,Ce=new n.P(-100,-100),ze=new n.P(this.screenRightBoundary,this.screenBottomBoundary),Fe=new ne,Ae=le.first,Ye=le.last,$e=[];for(let Ct=Ae.path.length-1;Ct>=1;Ct--)$e.push(Ae.path[Ct]);for(let Ct=1;Ct<Ye.path.length;Ct++)$e.push(Ye.path[Ct]);let Oe=2.5*we;if(P){let Ct=this.projectPathToScreenSpace($e,ae);$e=Ct.some(Vt=>Vt.signedDistanceFromCamera<=0)?[]:Ct.map(Vt=>Vt.point)}let st=[];if($e.length>0){let Ct=$e[0].clone(),Vt=$e[0].clone();for(let ui=1;ui<$e.length;ui++)Ct.x=Math.min(Ct.x,$e[ui].x),Ct.y=Math.min(Ct.y,$e[ui].y),Vt.x=Math.max(Vt.x,$e[ui].x),Vt.y=Math.max(Vt.y,$e[ui].y);st=Ct.x>=Ce.x&&Vt.x<=ze.x&&Ct.y>=Ce.y&&Vt.y<=ze.y?[$e]:Vt.x<Ce.x||Ct.x>ze.x||Vt.y<Ce.y||Ct.y>ze.y?[]:n.ao([$e],Ce.x,Ce.y,ze.x,ze.y)}for(let Ct of st){Fe.reset(Ct,.25*we);let Vt=0;Vt=Fe.length<=.5*we?1:Math.ceil(Fe.paddedLength/Oe)+1;for(let ui=0;ui<Vt;ui++){let Ht=ui/Math.max(Vt-1,1),Qt=Fe.lerp(Ht),ni=Qt.x+li,Xt=Qt.y+li;Q.push(ni,Xt,we,0);let ei=ni-we,Gi=Xt-we,Mi=ni+we,Hi=Xt+we;if(ue=ue&&this.isOffscreen(ei,Gi,Mi,Hi),fe=fe||this.isInsideGrid(ei,Gi,Mi,Hi),e!=="always"&&this.grid.hitTestCircle(ni,Xt,we,e,D)&&(ce=!0,!M))return{circles:[],offscreen:!1,collisionDetected:ce}}}}return{circles:!M&&ce||!fe||ee<this.perspectiveRatioCutoff?[]:Q,offscreen:ue,collisionDetected:ce}}projectPathToScreenSpace(e,s){let d=function(p,g){let v=n.H();return n.an(v,g.pitchedLabelPlaneMatrix),p.map(T=>{let M=Ie(T.x,T.y,v,g.getElevation),P=g.transform.projectTileCoordinates(M.point.x,M.point.y,g.unwrappedTileID,g.getElevation);return P.point.x=(.5*P.point.x+.5)*g.width,P.point.y=(.5*-P.point.y+.5)*g.height,P})}(e,s);return function(p){let g=0,v=0,T=0,M=0;for(let P=0;P<p.length;P++)p[P].isOccluded?(T=P+1,M=0):(M++,M>v&&(v=M,g=T));return p.slice(g,g+v)}(d)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let s=[],d=1/0,p=1/0,g=-1/0,v=-1/0;for(let D of e){let F=new n.P(D.x+li,D.y+li);d=Math.min(d,F.x),p=Math.min(p,F.y),g=Math.max(g,F.x),v=Math.max(v,F.y),s.push(F)}let T=this.grid.query(d,p,g,v).concat(this.ignoredGrid.query(d,p,g,v)),M={},P={};for(let D of T){let F=D.key;if(M[F.bucketInstanceId]===void 0&&(M[F.bucketInstanceId]={}),M[F.bucketInstanceId][F.featureIndex])continue;let O=[new n.P(D.x1,D.y1),new n.P(D.x2,D.y1),new n.P(D.x2,D.y2),new n.P(D.x1,D.y2)];n.ap(s,O)&&(M[F.bucketInstanceId][F.featureIndex]=!0,P[F.bucketInstanceId]===void 0&&(P[F.bucketInstanceId]=[]),P[F.bucketInstanceId].push(F.featureIndex))}return P}insertCollisionBox(e,s,d,p,g,v){(d?this.ignoredGrid:this.grid).insert({bucketInstanceId:p,featureIndex:g,collisionGroupID:v,overlapMode:s},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,s,d,p,g,v){let T=d?this.ignoredGrid:this.grid,M={bucketInstanceId:p,featureIndex:g,collisionGroupID:v,overlapMode:s};for(let P=0;P<e.length;P+=4)T.insertCircle(M,e[P],e[P+1],e[P+2])}projectAndGetPerspectiveRatio(e,s,d,p,g){if(g){let v;p?(v=[e,s,p(e,s),1],n.al(v,v,g)):(v=[e,s,0,1],ki(v,v,g));let T=v[3];return{x:(v[0]/T+1)/2*this.transform.width+li,y:(-v[1]/T+1)/2*this.transform.height+li,perspectiveRatio:.5+this.transform.cameraToCenterDistance/T*.5,isOccluded:!1,signedDistanceFromCamera:T}}{let v=this.transform.projectTileCoordinates(e,s,d,p);return{x:(v.point.x+1)/2*this.transform.width+li,y:(1-v.point.y)/2*this.transform.height+li,perspectiveRatio:.5+this.transform.cameraToCenterDistance/v.signedDistanceFromCamera*.5,isOccluded:v.isOccluded,signedDistanceFromCamera:v.signedDistanceFromCamera}}}getPerspectiveRatio(e,s,d,p){let g=this.transform.projectTileCoordinates(e,s,d,p);return .5+this.transform.cameraToCenterDistance/g.signedDistanceFromCamera*.5}isOffscreen(e,s,d,p){return d<li||e>=this.screenRightBoundary||p<li||s>this.screenBottomBoundary}isInsideGrid(e,s,d,p){return d>=0&&e<this.gridRightBoundary&&p>=0&&s<this.gridBottomBoundary}getViewportMatrix(){let e=n.aq([]);return n.J(e,e,[-100,-100,0]),e}_projectCollisionBox(e,s,d,p,g,v,T,M,P,D,F){let O=1,V=0,q=0,Q=1,J=e.anchorPointX+T[0],ee=e.anchorPointY+T[1];if(v&&!g){let $e=this.projectAndGetPerspectiveRatio(J+1,ee,p,P,F),Oe=$e.x-M.x,st=Math.atan(($e.y-M.y)/Oe)+(Oe<0?Math.PI:0),Ct=Math.sin(st),Vt=Math.cos(st);O=Vt,V=Ct,q=-Ct,Q=Vt}else if(!v&&g){let $e=Ee(this.transform);O=$e.vecEast[0],V=$e.vecEast[1],q=$e.vecSouth[0],Q=$e.vecSouth[1]}let ie=M.x,ae=M.y,le=s;g&&(ie=J,ae=ee,le=Math.pow(2,-(this.transform.zoom-d.overscaledZ)),le*=this.transform.getPitchedTextCorrection(J,ee,p),D||(le*=n.ab(.5+M.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),D&&(ie+=O*D.x*le+q*D.y*le,ae+=V*D.x*le+Q*D.y*le);let ce=e.x1*le,fe=e.x2*le,ue=(ce+fe)/2,we=e.y1*le,Ce=e.y2*le,ze=(we+Ce)/2,Fe=[{offsetX:ce,offsetY:we},{offsetX:ue,offsetY:we},{offsetX:fe,offsetY:we},{offsetX:fe,offsetY:ze},{offsetX:fe,offsetY:Ce},{offsetX:ue,offsetY:Ce},{offsetX:ce,offsetY:Ce},{offsetX:ce,offsetY:ze}],Ae=[];for(let{offsetX:$e,offsetY:Oe}of Fe)Ae.push(new n.P(ie+O*$e+q*Oe,ae+V*$e+Q*Oe));let Ye=!1;if(g){let $e=Ae.map(Oe=>this.projectAndGetPerspectiveRatio(Oe.x,Oe.y,p,P,F));Ye=$e.some(Oe=>!Oe.isOccluded),Ae=$e.map(Oe=>new n.P(Oe.x,Oe.y))}else Ye=!0;return{box:n.ar(Ae),allPointsOccluded:!Ye}}}class ci{constructor(e,s,d,p){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?s:-s))):p&&d?1:0,this.placed=d}isHidden(){return this.opacity===0&&!this.placed}}class Ia{constructor(e,s,d,p,g){this.text=new ci(e?e.text:null,s,d,g),this.icon=new ci(e?e.icon:null,s,p,g)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class jo{constructor(e,s,d){this.text=e,this.icon=s,this.skipFade=d}}class Qc{constructor(e,s,d,p,g){this.bucketInstanceId=e,this.featureIndex=s,this.sourceLayerIndex=d,this.bucketIndex=p,this.tileID=g}}class to{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let s=++this.maxGroupID;this.collisionGroups[e]={ID:s,predicate:d=>d.collisionGroupID===s}}return this.collisionGroups[e]}}function io(m,e,s,d,p){let{horizontalAlign:g,verticalAlign:v}=n.ay(m);return new n.P(-(g-.5)*e+d[0]*p,-(v-.5)*s+d[1]*p)}class Id{constructor(e,s,d,p,g){this.transform=e.clone(),this.terrain=s,this.collisionIndex=new ln(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new to(p),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=g,g&&(g.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let s=this.terrain;return s?(d,p)=>s.getElevation(e,d,p):null}getBucketParts(e,s,d,p){let g=d.getBucket(s),v=d.latestFeatureIndex;if(!g||!v||s.id!==g.layerIds[0])return;let T=d.collisionBoxArray,M=g.layers[0].layout,P=g.layers[0].paint,D=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),F=d.tileSize/n.X,O=d.tileID.toUnwrapped(),V=M.get("text-rotation-alignment")==="map",q=n.at(d,1,this.transform.zoom),Q=n.au(this.collisionIndex.transform,d,P.get("text-translate"),P.get("text-translate-anchor")),J=n.au(this.collisionIndex.transform,d,P.get("icon-translate"),P.get("icon-translate-anchor")),ee=Te(V,this.transform,q);this.retainedQueryData[g.bucketInstanceId]=new Qc(g.bucketInstanceId,v,g.sourceLayerIndex,g.index,d.tileID);let ie={bucket:g,layout:M,translationText:Q,translationIcon:J,unwrappedTileID:O,pitchedLabelPlaneMatrix:ee,scale:D,textPixelRatio:F,holdingForFade:d.holdingForFade(),collisionBoxArray:T,partiallyEvaluatedTextSize:n.ah(g.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(g.sourceID)};if(p)for(let ae of g.sortKeyRanges){let{sortKey:le,symbolInstanceStart:ce,symbolInstanceEnd:fe}=ae;e.push({sortKey:le,symbolInstanceStart:ce,symbolInstanceEnd:fe,parameters:ie})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:g.symbolInstances.length,parameters:ie})}attemptAnchorPlacement(e,s,d,p,g,v,T,M,P,D,F,O,V,q,Q,J,ee,ie,ae,le){let ce=n.av[e.textAnchor],fe=[e.textOffset0,e.textOffset1],ue=io(ce,d,p,fe,g),we=this.collisionIndex.placeCollisionBox(s,O,M,P,D,T,v,J,F.predicate,ae,ue,le);if((!ie||this.collisionIndex.placeCollisionBox(ie,O,M,P,D,T,v,ee,F.predicate,ae,ue,le).placeable)&&we.placeable){let Ce;if(this.prevPlacement&&this.prevPlacement.variableOffsets[V.crossTileID]&&this.prevPlacement.placements[V.crossTileID]&&this.prevPlacement.placements[V.crossTileID].text&&(Ce=this.prevPlacement.variableOffsets[V.crossTileID].anchor),V.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[V.crossTileID]={textOffset:fe,width:d,height:p,anchor:ce,textBoxScale:g,prevAnchor:Ce},this.markUsedJustification(q,ce,V,Q),q.allowVerticalPlacement&&(this.markUsedOrientation(q,Q,V),this.placedOrientations[V.crossTileID]=Q),{shift:ue,placedGlyphBoxes:we}}}placeLayerBucketPart(e,s,d){let{bucket:p,layout:g,translationText:v,translationIcon:T,unwrappedTileID:M,pitchedLabelPlaneMatrix:P,textPixelRatio:D,holdingForFade:F,collisionBoxArray:O,partiallyEvaluatedTextSize:V,collisionGroup:q}=e.parameters,Q=g.get("text-optional"),J=g.get("icon-optional"),ee=n.aw(g,"text-overlap","text-allow-overlap"),ie=ee==="always",ae=n.aw(g,"icon-overlap","icon-allow-overlap"),le=ae==="always",ce=g.get("text-rotation-alignment")==="map",fe=g.get("text-pitch-alignment")==="map",ue=g.get("icon-text-fit")!=="none",we=g.get("symbol-z-order")==="viewport-y",Ce=ie&&(le||!p.hasIconData()||J),ze=le&&(ie||!p.hasTextData()||Q);!p.collisionArrays&&O&&p.deserializeCollisionBoxes(O);let Fe=this.retainedQueryData[p.bucketInstanceId].tileID,Ae=this._getTerrainElevationFunc(Fe),Ye=this.transform.getFastPathSimpleProjectionMatrix(Fe),$e=(Oe,st,Ct)=>{var Vt,ui;if(s[Oe.crossTileID])return;if(F)return void(this.placements[Oe.crossTileID]=new jo(!1,!1,!1));let Ht=!1,Qt=!1,ni=!0,Xt=null,ei={box:null,placeable:!1,offscreen:null,occluded:!1},Gi={box:null,placeable:!1,offscreen:null},Mi=null,Hi=null,pr=null,os=0,un=0,as=0;st.textFeatureIndex?os=st.textFeatureIndex:Oe.useRuntimeCollisionCircles&&(os=Oe.featureIndex),st.verticalTextFeatureIndex&&(un=st.verticalTextFeatureIndex);let vo=st.textBox;if(vo){let fr=si=>{let Vi=n.ai.horizontal;if(p.allowVerticalPlacement&&!si&&this.prevPlacement){let Yi=this.prevPlacement.placedOrientations[Oe.crossTileID];Yi&&(this.placedOrientations[Oe.crossTileID]=Yi,Vi=Yi,this.markUsedOrientation(p,Vi,Oe))}return Vi},dn=(si,Vi)=>{if(p.allowVerticalPlacement&&Oe.numVerticalGlyphVertices>0&&st.verticalTextBox){for(let Yi of p.writingModes)if(Yi===n.ai.vertical?(ei=Vi(),Gi=ei):ei=si(),ei&&ei.placeable)break}else ei=si()},Er=Oe.textAnchorOffsetStartIndex,Pr=Oe.textAnchorOffsetEndIndex;if(Pr===Er){let si=(Vi,Yi)=>{let Ki=this.collisionIndex.placeCollisionBox(Vi,ee,D,Fe,M,fe,ce,v,q.predicate,Ae,void 0,Ye);return Ki&&Ki.placeable&&(this.markUsedOrientation(p,Yi,Oe),this.placedOrientations[Oe.crossTileID]=Yi),Ki};dn(()=>si(vo,n.ai.horizontal),()=>{let Vi=st.verticalTextBox;return p.allowVerticalPlacement&&Oe.numVerticalGlyphVertices>0&&Vi?si(Vi,n.ai.vertical):{box:null,offscreen:null}}),fr(ei&&ei.placeable)}else{let si=n.av[(ui=(Vt=this.prevPlacement)===null||Vt===void 0?void 0:Vt.variableOffsets[Oe.crossTileID])===null||ui===void 0?void 0:ui.anchor],Vi=(Ki,_p,nu)=>{let yp=Ki.x2-Ki.x1,bo=Ki.y2-Ki.y1,wo=Oe.textBoxScale,xp=ue&&ae==="never"?_p:null,So=null,fc=ee==="never"?1:2,su="never";si&&fc++;for(let vp=0;vp<fc;vp++){for(let mc=Er;mc<Pr;mc++){let bp=p.textAnchorOffsets.get(mc);if(si&&bp.textAnchor!==si)continue;let sl=this.attemptAnchorPlacement(bp,Ki,yp,bo,wo,ce,fe,D,Fe,M,q,su,Oe,p,nu,v,T,xp,Ae);if(sl&&(So=sl.placedGlyphBoxes,So&&So.placeable))return Ht=!0,Xt=sl.shift,So}si?si=null:su=ee}return d&&!So&&(So={box:this.collisionIndex.placeCollisionBox(vo,"always",D,Fe,M,fe,ce,v,q.predicate,Ae,void 0,Ye).box,offscreen:!1,placeable:!1,occluded:!1}),So};dn(()=>Vi(vo,st.iconBox,n.ai.horizontal),()=>{let Ki=st.verticalTextBox;return p.allowVerticalPlacement&&(!ei||!ei.placeable)&&Oe.numVerticalGlyphVertices>0&&Ki?Vi(Ki,st.verticalIconBox,n.ai.vertical):{box:null,occluded:!0,offscreen:null}}),ei&&(Ht=ei.placeable,ni=ei.offscreen);let Yi=fr(ei&&ei.placeable);if(!Ht&&this.prevPlacement){let Ki=this.prevPlacement.variableOffsets[Oe.crossTileID];Ki&&(this.variableOffsets[Oe.crossTileID]=Ki,this.markUsedJustification(p,Ki.anchor,Oe,Yi))}}}if(Mi=ei,Ht=Mi&&Mi.placeable,ni=Mi&&Mi.offscreen,Oe.useRuntimeCollisionCircles){let fr=p.text.placedSymbolArray.get(Oe.centerJustifiedTextSymbolIndex),dn=n.aj(p.textSizeData,V,fr),Er=g.get("text-padding");Hi=this.collisionIndex.placeCollisionCircles(ee,fr,p.lineVertexArray,p.glyphOffsetArray,dn,M,P,d,fe,q.predicate,Oe.collisionCircleDiameter,Er,v,Ae),Hi.circles.length&&Hi.collisionDetected&&!d&&n.w("Collisions detected, but collision boxes are not shown"),Ht=ie||Hi.circles.length>0&&!Hi.collisionDetected,ni=ni&&Hi.offscreen}if(st.iconFeatureIndex&&(as=st.iconFeatureIndex),st.iconBox){let fr=dn=>this.collisionIndex.placeCollisionBox(dn,ae,D,Fe,M,fe,ce,T,q.predicate,Ae,ue&&Xt?Xt:void 0,Ye);Gi&&Gi.placeable&&st.verticalIconBox?(pr=fr(st.verticalIconBox),Qt=pr.placeable):(pr=fr(st.iconBox),Qt=pr.placeable),ni=ni&&pr.offscreen}let nl=Q||Oe.numHorizontalGlyphVertices===0&&Oe.numVerticalGlyphVertices===0,pc=J||Oe.numIconVertices===0;nl||pc?pc?nl||(Qt=Qt&&Ht):Ht=Qt&&Ht:Qt=Ht=Qt&&Ht;let Ns=Qt&&pr.placeable;if(Ht&&Mi.placeable&&this.collisionIndex.insertCollisionBox(Mi.box,ee,g.get("text-ignore-placement"),p.bucketInstanceId,Gi&&Gi.placeable&&un?un:os,q.ID),Ns&&this.collisionIndex.insertCollisionBox(pr.box,ae,g.get("icon-ignore-placement"),p.bucketInstanceId,as,q.ID),Hi&&Ht&&this.collisionIndex.insertCollisionCircles(Hi.circles,ee,g.get("text-ignore-placement"),p.bucketInstanceId,os,q.ID),d&&this.storeCollisionData(p.bucketInstanceId,Ct,st,Mi,pr,Hi),Oe.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(p.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Oe.crossTileID]=new jo((Ht||Ce)&&!Mi?.occluded,(Qt||ze)&&!pr?.occluded,ni||p.justReloaded),s[Oe.crossTileID]=!0};if(we){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let Oe=p.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let st=Oe.length-1;st>=0;--st){let Ct=Oe[st];$e(p.symbolInstances.get(Ct),p.collisionArrays[Ct],Ct)}}else for(let Oe=e.symbolInstanceStart;Oe<e.symbolInstanceEnd;Oe++)$e(p.symbolInstances.get(Oe),p.collisionArrays[Oe],Oe);p.justReloaded=!1}storeCollisionData(e,s,d,p,g,v){if(d.textBox||d.iconBox){let T,M;this.collisionBoxArrays.has(e)?T=this.collisionBoxArrays.get(e):(T=new Map,this.collisionBoxArrays.set(e,T)),T.has(s)?M=T.get(s):(M={text:null,icon:null},T.set(s,M)),d.textBox&&(M.text=p.box),d.iconBox&&(M.icon=g.box)}if(v){let T=this.collisionCircleArrays[e];T===void 0&&(T=this.collisionCircleArrays[e]=[]);for(let M=0;M<v.circles.length;M+=4)T.push(v.circles[M+0]-li),T.push(v.circles[M+1]-li),T.push(v.circles[M+2]),T.push(v.collisionDetected?1:0)}}markUsedJustification(e,s,d,p){let g;g=p===n.ai.vertical?d.verticalPlacedTextSymbolIndex:{left:d.leftJustifiedTextSymbolIndex,center:d.centerJustifiedTextSymbolIndex,right:d.rightJustifiedTextSymbolIndex}[n.ax(s)];let v=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex,d.verticalPlacedTextSymbolIndex];for(let T of v)T>=0&&(e.text.placedSymbolArray.get(T).crossTileID=g>=0&&T!==g?0:d.crossTileID)}markUsedOrientation(e,s,d){let p=s===n.ai.horizontal||s===n.ai.horizontalOnly?s:0,g=s===n.ai.vertical?s:0,v=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(let T of v)e.text.placedSymbolArray.get(T).placedOrientation=p;d.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=g)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let s=this.prevPlacement,d=!1;this.prevZoomAdjustment=s?s.zoomAdjustment(this.transform.zoom):0;let p=s?s.symbolFadeChange(e):1,g=s?s.opacities:{},v=s?s.variableOffsets:{},T=s?s.placedOrientations:{};for(let M in this.placements){let P=this.placements[M],D=g[M];D?(this.opacities[M]=new Ia(D,p,P.text,P.icon),d=d||P.text!==D.text.placed||P.icon!==D.icon.placed):(this.opacities[M]=new Ia(null,p,P.text,P.icon,P.skipFade),d=d||P.text||P.icon)}for(let M in g){let P=g[M];if(!this.opacities[M]){let D=new Ia(P,p,!1,!1);D.isHidden()||(this.opacities[M]=D,d=d||P.text.placed||P.icon.placed)}}for(let M in v)this.variableOffsets[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.variableOffsets[M]=v[M]);for(let M in T)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=T[M]);if(s&&s.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");d?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=s?s.lastPlacementChangeTime:e)}updateLayerOpacities(e,s){let d={};for(let p of s){let g=p.getBucket(e);g&&p.latestFeatureIndex&&e.id===g.layerIds[0]&&this.updateBucketOpacities(g,p.tileID,d,p.collisionBoxArray)}}updateBucketOpacities(e,s,d,p){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let g=e.layers[0],v=g.layout,T=new Ia(null,0,!1,!1,!0),M=v.get("text-allow-overlap"),P=v.get("icon-allow-overlap"),D=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"),F=v.get("text-rotation-alignment")==="map",O=v.get("text-pitch-alignment")==="map",V=v.get("icon-text-fit")!=="none",q=new Ia(null,0,M&&(P||!e.hasIconData()||v.get("icon-optional")),P&&(M||!e.hasTextData()||v.get("text-optional")),!0);!e.collisionArrays&&p&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(p);let Q=(ee,ie,ae)=>{for(let le=0;le<ie/4;le++)ee.opacityVertexArray.emplaceBack(ae);ee.hasVisibleVertices=ee.hasVisibleVertices||ae!==ro},J=this.collisionBoxArrays.get(e.bucketInstanceId);for(let ee=0;ee<e.symbolInstances.length;ee++){let ie=e.symbolInstances.get(ee),{numHorizontalGlyphVertices:ae,numVerticalGlyphVertices:le,crossTileID:ce}=ie,fe=this.opacities[ce];d[ce]?fe=T:fe||(fe=q,this.opacities[ce]=fe),d[ce]=!0;let ue=ie.numIconVertices>0,we=this.placedOrientations[ie.crossTileID],Ce=we===n.ai.vertical,ze=we===n.ai.horizontal||we===n.ai.horizontalOnly;if(ae>0||le>0){let Ae=th(fe.text);Q(e.text,ae,Ce?ro:Ae),Q(e.text,le,ze?ro:Ae);let Ye=fe.text.isHidden();[ie.rightJustifiedTextSymbolIndex,ie.centerJustifiedTextSymbolIndex,ie.leftJustifiedTextSymbolIndex].forEach(st=>{st>=0&&(e.text.placedSymbolArray.get(st).hidden=Ye||Ce?1:0)}),ie.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(ie.verticalPlacedTextSymbolIndex).hidden=Ye||ze?1:0);let $e=this.variableOffsets[ie.crossTileID];$e&&this.markUsedJustification(e,$e.anchor,ie,we);let Oe=this.placedOrientations[ie.crossTileID];Oe&&(this.markUsedJustification(e,"left",ie,Oe),this.markUsedOrientation(e,Oe,ie))}if(ue){let Ae=th(fe.icon),Ye=!(V&&ie.verticalPlacedIconSymbolIndex&&Ce);ie.placedIconSymbolIndex>=0&&(Q(e.icon,ie.numIconVertices,Ye?Ae:ro),e.icon.placedSymbolArray.get(ie.placedIconSymbolIndex).hidden=fe.icon.isHidden()),ie.verticalPlacedIconSymbolIndex>=0&&(Q(e.icon,ie.numVerticalIconVertices,Ye?ro:Ae),e.icon.placedSymbolArray.get(ie.verticalPlacedIconSymbolIndex).hidden=fe.icon.isHidden())}let Fe=J&&J.has(ee)?J.get(ee):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let Ae=e.collisionArrays[ee];if(Ae){let Ye=new n.P(0,0);if(Ae.textBox||Ae.verticalTextBox){let $e=!0;if(D){let Oe=this.variableOffsets[ce];Oe?(Ye=io(Oe.anchor,Oe.width,Oe.height,Oe.textOffset,Oe.textBoxScale),F&&Ye._rotate(O?-this.transform.bearingInRadians:this.transform.bearingInRadians)):$e=!1}if(Ae.textBox||Ae.verticalTextBox){let Oe;Ae.textBox&&(Oe=Ce),Ae.verticalTextBox&&(Oe=ze),eh(e.textCollisionBox.collisionVertexArray,fe.text.placed,!$e||Oe,Fe.text,Ye.x,Ye.y)}}if(Ae.iconBox||Ae.verticalIconBox){let $e=!!(!ze&&Ae.verticalIconBox),Oe;Ae.iconBox&&(Oe=$e),Ae.verticalIconBox&&(Oe=!$e),eh(e.iconCollisionBox.collisionVertexArray,fe.icon.placed,Oe,Fe.icon,V?Ye.x:0,V?Ye.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,s){let d=this.zoomAtLastRecencyCheck===s?1-this.zoomAdjustment(s):1;return this.zoomAtLastRecencyCheck=s,this.commitTime+this.fadeDuration*d>e}setStale(){this.stale=!0}}function eh(m,e,s,d,p,g){d&&d.length!==0||(d=[0,0,0,0]);let v=d[0]-li,T=d[1]-li,M=d[2]-li,P=d[3]-li;m.emplaceBack(e?1:0,s?1:0,p||0,g||0,v,T),m.emplaceBack(e?1:0,s?1:0,p||0,g||0,M,T),m.emplaceBack(e?1:0,s?1:0,p||0,g||0,M,P),m.emplaceBack(e?1:0,s?1:0,p||0,g||0,v,P)}let Ed=Math.pow(2,25),No=Math.pow(2,24),Pd=Math.pow(2,17),tm=Math.pow(2,16),im=Math.pow(2,9),rm=Math.pow(2,8),Rd=Math.pow(2,1);function th(m){if(m.opacity===0&&!m.placed)return 0;if(m.opacity===1&&m.placed)return 4294967295;let e=m.placed?1:0,s=Math.floor(127*m.opacity);return s*Ed+e*No+s*Pd+e*tm+s*im+e*rm+s*Rd+e}let ro=0;class ih{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,s,d,p,g){let v=this._bucketParts;for(;this._currentTileIndex<e.length;)if(s.getBucketParts(v,p,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,g())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,v.sort((T,M)=>T.sortKey-M.sortKey));this._currentPartIndex<v.length;)if(s.placeLayerBucketPart(v[this._currentPartIndex],this._seenCrossTileIDs,d),this._currentPartIndex++,g())return!0;return!1}}class Ad{constructor(e,s,d,p,g,v,T,M){this.placement=new Id(e,s,v,T,M),this._currentPlacementIndex=d.length-1,this._forceFullPlacement=p,this._showCollisionBoxes=g,this._done=!1}isDone(){return this._done}continuePlacement(e,s,d){let p=E.now(),g=()=>!this._forceFullPlacement&&E.now()-p>2;for(;this._currentPlacementIndex>=0;){let v=s[e[this._currentPlacementIndex]],T=this.placement.collisionIndex.transform.zoom;if(v.type==="symbol"&&(!v.minzoom||v.minzoom<=T)&&(!v.maxzoom||v.maxzoom>T)){if(this._inProgressLayer||(this._inProgressLayer=new ih(v)),this._inProgressLayer.continuePlacement(d[v.source],this.placement,this._showCollisionBoxes,v,g))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let no=512/n.X/2;class rh{constructor(e,s,d){this.tileID=e,this.bucketInstanceId=d,this._symbolsByKey={};let p=new Map;for(let g=0;g<s.length;g++){let v=s.get(g),T=v.key,M=p.get(T);M?M.push(v):p.set(T,[v])}for(let[g,v]of p){let T={positions:v.map(M=>({x:Math.floor(M.anchorX*no),y:Math.floor(M.anchorY*no)})),crossTileIDs:v.map(M=>M.crossTileID)};if(T.positions.length>128){let M=new n.az(T.positions.length,16,Uint16Array);for(let{x:P,y:D}of T.positions)M.add(P,D);M.finish(),delete T.positions,T.index=M}this._symbolsByKey[g]=T}}getScaledCoordinates(e,s){let{x:d,y:p,z:g}=this.tileID.canonical,{x:v,y:T,z:M}=s.canonical,P=no/Math.pow(2,M-g),D=(T*n.X+e.anchorY)*P,F=p*n.X*no;return{x:Math.floor((v*n.X+e.anchorX)*P-d*n.X*no),y:Math.floor(D-F)}}findMatches(e,s,d){let p=this.tileID.canonical.z<s.canonical.z?1:Math.pow(2,this.tileID.canonical.z-s.canonical.z);for(let g=0;g<e.length;g++){let v=e.get(g);if(v.crossTileID)continue;let T=this._symbolsByKey[v.key];if(!T)continue;let M=this.getScaledCoordinates(v,s);if(T.index){let P=T.index.range(M.x-p,M.y-p,M.x+p,M.y+p).sort();for(let D of P){let F=T.crossTileIDs[D];if(!d[F]){d[F]=!0,v.crossTileID=F;break}}}else if(T.positions)for(let P=0;P<T.positions.length;P++){let D=T.positions[P],F=T.crossTileIDs[P];if(Math.abs(D.x-M.x)<=p&&Math.abs(D.y-M.y)<=p&&!d[F]){d[F]=!0,v.crossTileID=F;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class Ll{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ld{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let s=Math.round((e-this.lng)/360);if(s!==0)for(let d in this.indexes){let p=this.indexes[d],g={};for(let v in p){let T=p[v];T.tileID=T.tileID.unwrapTo(T.tileID.wrap+s),g[T.tileID.key]=T}this.indexes[d]=g}this.lng=e}addBucket(e,s,d){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===s.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let g=0;g<s.symbolInstances.length;g++)s.symbolInstances.get(g).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let p=this.usedCrossTileIDs[e.overscaledZ];for(let g in this.indexes){let v=this.indexes[g];if(Number(g)>e.overscaledZ)for(let T in v){let M=v[T];M.tileID.isChildOf(e)&&M.findMatches(s.symbolInstances,e,p)}else{let T=v[e.scaledTo(Number(g)).key];T&&T.findMatches(s.symbolInstances,e,p)}}for(let g=0;g<s.symbolInstances.length;g++){let v=s.symbolInstances.get(g);v.crossTileID||(v.crossTileID=d.generate(),p[v.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new rh(e,s.symbolInstances,s.bucketInstanceId),!0}removeBucketCrossTileIDs(e,s){for(let d of s.getCrossTileIDsLists())for(let p of d)delete this.usedCrossTileIDs[e][p]}removeStaleBuckets(e){let s=!1;for(let d in this.indexes){let p=this.indexes[d];for(let g in p)e[p[g].bucketInstanceId]||(this.removeBucketCrossTileIDs(d,p[g]),delete p[g],s=!0)}return s}}class so{constructor(){this.layerIndexes={},this.crossTileIDs=new Ll,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,s,d){let p=this.layerIndexes[e.id];p===void 0&&(p=this.layerIndexes[e.id]=new Ld);let g=!1,v={};p.handleWrapJump(d);for(let T of s){let M=T.getBucket(e);M&&e.id===M.layerIds[0]&&(M.bucketInstanceId||(M.bucketInstanceId=++this.maxBucketInstanceId),p.addBucket(T.tileID,M,this.crossTileIDs)&&(g=!0),v[M.bucketInstanceId]=!0)}return p.removeStaleBuckets(v)&&(g=!0),g}pruneUnusedLayers(e){let s={};e.forEach(d=>{s[d]=!0});for(let d in this.layerIndexes)s[d]||delete this.layerIndexes[d]}}var nh="void main() {fragColor=vec4(1.0);}";let es={prelude:At(`#ifdef GL_ES
3
3
  precision mediump float;
4
4
  #else
@@ -722,7 +722,7 @@ uniform ${D} ${F} u_${O};
722
722
  `),ce=ae.concat(es.prelude.vertexSource,T.vertexSource,s.vertexSource).join(`
723
723
  `);jn(P)||(le=function(Ce){return Ce.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(le),ce=function(Ce){return Ce.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(ce));let fe=P.createShader(P.FRAGMENT_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(fe,le),P.compileShader(fe),!P.getShaderParameter(fe,P.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${P.getShaderInfoLog(fe)}`);P.attachShader(this.program,fe);let ue=P.createShader(P.VERTEX_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(ue,ce),P.compileShader(ue),!P.getShaderParameter(ue,P.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${P.getShaderInfoLog(ue)}`);P.attachShader(this.program,ue),this.attributes={};let we={};this.numAttributes=O.length;for(let Ce=0;Ce<this.numAttributes;Ce++)O[Ce]&&(P.bindAttribLocation(this.program,Ce,O[Ce]),this.attributes[O[Ce]]=Ce);if(P.linkProgram(this.program),!P.getProgramParameter(this.program,P.LINK_STATUS))throw new Error(`Program failed to link: ${P.getProgramInfoLog(this.program)}`);P.deleteShader(ue),P.deleteShader(fe);for(let Ce=0;Ce<ie.length;Ce++){let ze=ie[Ce];if(ze&&!we[ze]){let Fe=P.getUniformLocation(this.program,ze);Fe&&(we[ze]=Fe)}}this.fixedUniforms=p(e,we),this.terrainUniforms=((Ce,ze)=>({u_depth:new n.bC(Ce,ze.u_depth),u_terrain:new n.bC(Ce,ze.u_terrain),u_terrain_dim:new n.b5(Ce,ze.u_terrain_dim),u_terrain_matrix:new n.bD(Ce,ze.u_terrain_matrix),u_terrain_unpack:new n.bE(Ce,ze.u_terrain_unpack),u_terrain_exaggeration:new n.b5(Ce,ze.u_terrain_exaggeration)}))(e,we),this.projectionUniforms=((Ce,ze)=>({u_projection_matrix:new n.bD(Ce,ze.u_projection_matrix),u_projection_tile_mercator_coords:new n.bE(Ce,ze.u_projection_tile_mercator_coords),u_projection_clipping_plane:new n.bE(Ce,ze.u_projection_clipping_plane),u_projection_transition:new n.b5(Ce,ze.u_projection_transition),u_projection_fallback_matrix:new n.bD(Ce,ze.u_projection_fallback_matrix)}))(e,we),this.binderUniforms=d?d.getUniforms(e,we):[]}draw(e,s,d,p,g,v,T,M,P,D,F,O,V,q,Q,J,ee,ie,ae){let le=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(d),e.setStencilMode(p),e.setColorMode(g),e.setCullFace(v),M){e.activeTexture.set(le.TEXTURE2),le.bindTexture(le.TEXTURE_2D,M.depthTexture),e.activeTexture.set(le.TEXTURE3),le.bindTexture(le.TEXTURE_2D,M.texture);for(let fe in this.terrainUniforms)this.terrainUniforms[fe].set(M[fe])}if(P)for(let fe in P)this.projectionUniforms[om[fe]].set(P[fe]);if(T)for(let fe in this.fixedUniforms)this.fixedUniforms[fe].set(T[fe]);J&&J.setUniforms(e,this.binderUniforms,q,{zoom:Q});let ce=0;switch(s){case le.LINES:ce=2;break;case le.TRIANGLES:ce=3;break;case le.LINE_STRIP:ce=1}for(let fe of V.get()){let ue=fe.vaos||(fe.vaos={});(ue[D]||(ue[D]=new Fa)).bind(e,this,F,J?J.getPaintVertexBuffers():[],O,fe.vertexOffset,ee,ie,ae),le.drawElements(s,fe.primitiveLength*ce,le.UNSIGNED_SHORT,fe.primitiveOffset*ce*2)}}}function uo(m,e,s){let d=1/n.at(s,1,e.transform.tileZoom),p=Math.pow(2,s.tileID.overscaledZ),g=s.tileSize*Math.pow(2,e.transform.tileZoom)/p,v=g*(s.tileID.canonical.x+s.tileID.wrap*p),T=g*s.tileID.canonical.y;return{u_image:0,u_texsize:s.imageAtlasTexture.size,u_scale:[d,m.fromScale,m.toScale],u_fade:m.t,u_pixel_coord_upper:[v>>16,T>>16],u_pixel_coord_lower:[65535&v,65535&T]}}let Bd=(m,e,s,d)=>{let p=m.style.light,g=p.properties.get("position"),v=[g.x,g.y,g.z],T=n.bI();p.properties.get("anchor")==="viewport"&&n.bJ(T,m.transform.bearingInRadians),n.bK(v,v,T);let M=m.transform.transformLightDirection(v),P=p.properties.get("color");return{u_lightpos:v,u_lightpos_globe:M,u_lightintensity:p.properties.get("intensity"),u_lightcolor:[P.r,P.g,P.b],u_vertical_gradient:+e,u_opacity:s,u_fill_translate:d}},jd=(m,e,s,d,p,g,v)=>n.e(Bd(m,e,s,d),uo(g,m,v),{u_height_factor:-Math.pow(2,p.overscaledZ)/v.tileSize/8}),Nd=(m,e,s,d)=>n.e(uo(e,m,s),{u_fill_translate:d}),Gd=(m,e)=>({u_world:m,u_fill_translate:e}),uh=(m,e,s,d,p)=>n.e(Nd(m,e,s,p),{u_world:d}),Vd=(m,e,s,d,p)=>{let g=m.transform,v,T,M=0;if(s.paint.get("circle-pitch-alignment")==="map"){let P=n.at(e,1,g.zoom);v=!0,T=[P,P],M=P/(n.X*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*p}else v=!1,T=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(s.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+v,u_device_pixel_ratio:m.pixelRatio,u_extrude_scale:T,u_globe_extrude_scale:M,u_translate:d}},Ud=m=>({u_pixel_extrude_scale:[1/m.width,1/m.height]}),Zd=m=>({u_viewport_size:[m.width,m.height]}),dh=(m,e=1)=>({u_color:m,u_overlay:0,u_overlay_scale:e}),js=(m,e,s,d)=>{let p=n.at(m,1,e)/(n.X*Math.pow(2,m.tileID.overscaledZ))*2*Math.PI*d;return{u_extrude_scale:n.at(m,1,e),u_intensity:s,u_globe_extrude_scale:p}},ph=(m,e,s,d)=>{let p=n.H();n.bL(p,0,m.width,m.height,0,0,1);let g=m.context.gl;return{u_matrix:p,u_world:[g.drawingBufferWidth,g.drawingBufferHeight],u_image:s,u_color_ramp:d,u_opacity:e.paint.get("heatmap-opacity")}},qd=(m,e,s)=>{let d=s.paint.get("hillshade-shadow-color"),p=s.paint.get("hillshade-highlight-color"),g=s.paint.get("hillshade-accent-color"),v=s.paint.get("hillshade-illumination-direction")*(Math.PI/180);return s.paint.get("hillshade-illumination-anchor")==="viewport"&&(v+=m.transform.bearingInRadians),{u_image:0,u_latrange:lm(0,e.tileID),u_light:[s.paint.get("hillshade-exaggeration"),v],u_shadow:d,u_highlight:p,u_accent:g}},Oa=(m,e)=>{let s=e.stride,d=n.H();return n.bL(d,0,n.X,-8192,0,0,1),n.J(d,d,[0,-8192,0]),{u_matrix:d,u_image:1,u_dimension:[s,s],u_zoom:m.overscaledZ,u_unpack:e.getUnpackVector()}};function lm(m,e){let s=Math.pow(2,e.canonical.z),d=e.canonical.y;return[new n.Y(0,d/s).toLngLat().lat,new n.Y(0,(d+1)/s).toLngLat().lat]}let $o=(m,e,s,d)=>{let p=m.transform;return{u_translation:mh(m,e,s),u_ratio:d/n.at(e,1,p.zoom),u_device_pixel_ratio:m.pixelRatio,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},cm=(m,e,s,d,p)=>n.e($o(m,e,s,d),{u_image:0,u_image_height:p}),hm=(m,e,s,d,p)=>{let g=m.transform,v=fh(e,g);return{u_translation:mh(m,e,s),u_texsize:e.imageAtlasTexture.size,u_ratio:d/n.at(e,1,g.zoom),u_device_pixel_ratio:m.pixelRatio,u_image:0,u_scale:[v,p.fromScale,p.toScale],u_fade:p.t,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},Wd=(m,e,s,d,p,g)=>{let v=m.lineAtlas,T=fh(e,m.transform),M=s.layout.get("line-cap")==="round",P=v.getDash(p.from,M),D=v.getDash(p.to,M),F=P.width*g.fromScale,O=D.width*g.toScale;return n.e($o(m,e,s,d),{u_patternscale_a:[T/F,-P.height/2],u_patternscale_b:[T/O,-D.height/2],u_sdfgamma:v.width/(256*Math.min(F,O)*m.pixelRatio)/2,u_image:0,u_tex_y_a:P.y,u_tex_y_b:D.y,u_mix:g.t})};function fh(m,e){return 1/n.at(m,1,e.tileZoom)}function mh(m,e,s){return n.au(m.transform,e,s.paint.get("line-translate"),s.paint.get("line-translate-anchor"))}let gh=(m,e,s,d,p)=>{return{u_tl_parent:m,u_scale_parent:e,u_buffer_scale:1,u_fade_t:s.mix,u_opacity:s.opacity*d.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:d.paint.get("raster-brightness-min"),u_brightness_high:d.paint.get("raster-brightness-max"),u_saturation_factor:(v=d.paint.get("raster-saturation"),v>0?1-1/(1.001-v):-v),u_contrast_factor:(g=d.paint.get("raster-contrast"),g>0?1/(1-g):1+g),u_spin_weights:$d(d.paint.get("raster-hue-rotate")),u_coords_top:[p[0].x,p[0].y,p[1].x,p[1].y],u_coords_bottom:[p[3].x,p[3].y,p[2].x,p[2].y]};var g,v};function $d(m){m*=Math.PI/180;let e=Math.sin(m),s=Math.cos(m);return[(2*s+1)/3,(-Math.sqrt(3)*e-s+1)/3,(Math.sqrt(3)*e-s+1)/3]}let Ba=(m,e,s,d,p,g,v,T,M,P,D,F,O)=>{let V=v.transform;return{u_is_size_zoom_constant:+(m==="constant"||m==="source"),u_is_size_feature_constant:+(m==="constant"||m==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:V.cameraToCenterDistance,u_pitch:V.pitch/360*2*Math.PI,u_rotate_symbol:+s,u_aspect_ratio:V.width/V.height,u_fade_change:v.options.fadeDuration?v.symbolFadeChange:1,u_label_plane_matrix:T,u_coord_matrix:M,u_is_text:+D,u_pitch_with_map:+d,u_is_along_line:p,u_is_variable_anchor:g,u_texsize:F,u_texture:0,u_translation:P,u_pitched_scale:O}},rs=(m,e,s,d,p,g,v,T,M,P,D,F,O,V)=>{let q=v.transform;return n.e(Ba(m,e,s,d,p,g,v,T,M,P,D,F,V),{u_gamma_scale:d?Math.cos(q.pitch*Math.PI/180)*q.cameraToCenterDistance:1,u_device_pixel_ratio:v.pixelRatio,u_is_halo:1})},_h=(m,e,s,d,p,g,v,T,M,P,D,F,O)=>n.e(rs(m,e,s,d,p,g,v,T,M,P,!0,D,0,O),{u_texsize_icon:F,u_texture_icon:1}),yh=(m,e)=>({u_opacity:m,u_color:e}),xh=(m,e,s,d,p)=>n.e(function(g,v,T,M){let P=T.imageManager.getPattern(g.from.toString()),D=T.imageManager.getPattern(g.to.toString()),{width:F,height:O}=T.imageManager.getPixelSize(),V=Math.pow(2,M.tileID.overscaledZ),q=M.tileSize*Math.pow(2,T.transform.tileZoom)/V,Q=q*(M.tileID.canonical.x+M.tileID.wrap*V),J=q*M.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:P.tl,u_pattern_br_a:P.br,u_pattern_tl_b:D.tl,u_pattern_br_b:D.br,u_texsize:[F,O],u_mix:v.t,u_pattern_size_a:P.displaySize,u_pattern_size_b:D.displaySize,u_scale_a:v.fromScale,u_scale_b:v.toScale,u_tile_units_to_pixels:1/n.at(M,1,T.transform.tileZoom),u_pixel_coord_upper:[Q>>16,J>>16],u_pixel_coord_lower:[65535&Q,65535&J]}}(s,p,e,d),{u_opacity:m}),vh=(m,e)=>{},bh={fillExtrusion:(m,e)=>({u_lightpos:new n.bG(m,e.u_lightpos),u_lightpos_globe:new n.bG(m,e.u_lightpos_globe),u_lightintensity:new n.b5(m,e.u_lightintensity),u_lightcolor:new n.bG(m,e.u_lightcolor),u_vertical_gradient:new n.b5(m,e.u_vertical_gradient),u_opacity:new n.b5(m,e.u_opacity),u_fill_translate:new n.bH(m,e.u_fill_translate)}),fillExtrusionPattern:(m,e)=>({u_lightpos:new n.bG(m,e.u_lightpos),u_lightpos_globe:new n.bG(m,e.u_lightpos_globe),u_lightintensity:new n.b5(m,e.u_lightintensity),u_lightcolor:new n.bG(m,e.u_lightcolor),u_vertical_gradient:new n.b5(m,e.u_vertical_gradient),u_height_factor:new n.b5(m,e.u_height_factor),u_opacity:new n.b5(m,e.u_opacity),u_fill_translate:new n.bH(m,e.u_fill_translate),u_image:new n.bC(m,e.u_image),u_texsize:new n.bH(m,e.u_texsize),u_pixel_coord_upper:new n.bH(m,e.u_pixel_coord_upper),u_pixel_coord_lower:new n.bH(m,e.u_pixel_coord_lower),u_scale:new n.bG(m,e.u_scale),u_fade:new n.b5(m,e.u_fade)}),fill:(m,e)=>({u_fill_translate:new n.bH(m,e.u_fill_translate)}),fillPattern:(m,e)=>({u_image:new n.bC(m,e.u_image),u_texsize:new n.bH(m,e.u_texsize),u_pixel_coord_upper:new n.bH(m,e.u_pixel_coord_upper),u_pixel_coord_lower:new n.bH(m,e.u_pixel_coord_lower),u_scale:new n.bG(m,e.u_scale),u_fade:new n.b5(m,e.u_fade),u_fill_translate:new n.bH(m,e.u_fill_translate)}),fillOutline:(m,e)=>({u_world:new n.bH(m,e.u_world),u_fill_translate:new n.bH(m,e.u_fill_translate)}),fillOutlinePattern:(m,e)=>({u_world:new n.bH(m,e.u_world),u_image:new n.bC(m,e.u_image),u_texsize:new n.bH(m,e.u_texsize),u_pixel_coord_upper:new n.bH(m,e.u_pixel_coord_upper),u_pixel_coord_lower:new n.bH(m,e.u_pixel_coord_lower),u_scale:new n.bG(m,e.u_scale),u_fade:new n.b5(m,e.u_fade),u_fill_translate:new n.bH(m,e.u_fill_translate)}),circle:(m,e)=>({u_camera_to_center_distance:new n.b5(m,e.u_camera_to_center_distance),u_scale_with_map:new n.bC(m,e.u_scale_with_map),u_pitch_with_map:new n.bC(m,e.u_pitch_with_map),u_extrude_scale:new n.bH(m,e.u_extrude_scale),u_device_pixel_ratio:new n.b5(m,e.u_device_pixel_ratio),u_globe_extrude_scale:new n.b5(m,e.u_globe_extrude_scale),u_translate:new n.bH(m,e.u_translate)}),collisionBox:(m,e)=>({u_pixel_extrude_scale:new n.bH(m,e.u_pixel_extrude_scale)}),collisionCircle:(m,e)=>({u_viewport_size:new n.bH(m,e.u_viewport_size)}),debug:(m,e)=>({u_color:new n.bF(m,e.u_color),u_overlay:new n.bC(m,e.u_overlay),u_overlay_scale:new n.b5(m,e.u_overlay_scale)}),depth:vh,clippingMask:vh,heatmap:(m,e)=>({u_extrude_scale:new n.b5(m,e.u_extrude_scale),u_intensity:new n.b5(m,e.u_intensity),u_globe_extrude_scale:new n.b5(m,e.u_globe_extrude_scale)}),heatmapTexture:(m,e)=>({u_matrix:new n.bD(m,e.u_matrix),u_world:new n.bH(m,e.u_world),u_image:new n.bC(m,e.u_image),u_color_ramp:new n.bC(m,e.u_color_ramp),u_opacity:new n.b5(m,e.u_opacity)}),hillshade:(m,e)=>({u_image:new n.bC(m,e.u_image),u_latrange:new n.bH(m,e.u_latrange),u_light:new n.bH(m,e.u_light),u_shadow:new n.bF(m,e.u_shadow),u_highlight:new n.bF(m,e.u_highlight),u_accent:new n.bF(m,e.u_accent)}),hillshadePrepare:(m,e)=>({u_matrix:new n.bD(m,e.u_matrix),u_image:new n.bC(m,e.u_image),u_dimension:new n.bH(m,e.u_dimension),u_zoom:new n.b5(m,e.u_zoom),u_unpack:new n.bE(m,e.u_unpack)}),line:(m,e)=>({u_translation:new n.bH(m,e.u_translation),u_ratio:new n.b5(m,e.u_ratio),u_device_pixel_ratio:new n.b5(m,e.u_device_pixel_ratio),u_units_to_pixels:new n.bH(m,e.u_units_to_pixels)}),lineGradient:(m,e)=>({u_translation:new n.bH(m,e.u_translation),u_ratio:new n.b5(m,e.u_ratio),u_device_pixel_ratio:new n.b5(m,e.u_device_pixel_ratio),u_units_to_pixels:new n.bH(m,e.u_units_to_pixels),u_image:new n.bC(m,e.u_image),u_image_height:new n.b5(m,e.u_image_height)}),linePattern:(m,e)=>({u_translation:new n.bH(m,e.u_translation),u_texsize:new n.bH(m,e.u_texsize),u_ratio:new n.b5(m,e.u_ratio),u_device_pixel_ratio:new n.b5(m,e.u_device_pixel_ratio),u_image:new n.bC(m,e.u_image),u_units_to_pixels:new n.bH(m,e.u_units_to_pixels),u_scale:new n.bG(m,e.u_scale),u_fade:new n.b5(m,e.u_fade)}),lineSDF:(m,e)=>({u_translation:new n.bH(m,e.u_translation),u_ratio:new n.b5(m,e.u_ratio),u_device_pixel_ratio:new n.b5(m,e.u_device_pixel_ratio),u_units_to_pixels:new n.bH(m,e.u_units_to_pixels),u_patternscale_a:new n.bH(m,e.u_patternscale_a),u_patternscale_b:new n.bH(m,e.u_patternscale_b),u_sdfgamma:new n.b5(m,e.u_sdfgamma),u_image:new n.bC(m,e.u_image),u_tex_y_a:new n.b5(m,e.u_tex_y_a),u_tex_y_b:new n.b5(m,e.u_tex_y_b),u_mix:new n.b5(m,e.u_mix)}),raster:(m,e)=>({u_tl_parent:new n.bH(m,e.u_tl_parent),u_scale_parent:new n.b5(m,e.u_scale_parent),u_buffer_scale:new n.b5(m,e.u_buffer_scale),u_fade_t:new n.b5(m,e.u_fade_t),u_opacity:new n.b5(m,e.u_opacity),u_image0:new n.bC(m,e.u_image0),u_image1:new n.bC(m,e.u_image1),u_brightness_low:new n.b5(m,e.u_brightness_low),u_brightness_high:new n.b5(m,e.u_brightness_high),u_saturation_factor:new n.b5(m,e.u_saturation_factor),u_contrast_factor:new n.b5(m,e.u_contrast_factor),u_spin_weights:new n.bG(m,e.u_spin_weights),u_coords_top:new n.bE(m,e.u_coords_top),u_coords_bottom:new n.bE(m,e.u_coords_bottom)}),symbolIcon:(m,e)=>({u_is_size_zoom_constant:new n.bC(m,e.u_is_size_zoom_constant),u_is_size_feature_constant:new n.bC(m,e.u_is_size_feature_constant),u_size_t:new n.b5(m,e.u_size_t),u_size:new n.b5(m,e.u_size),u_camera_to_center_distance:new n.b5(m,e.u_camera_to_center_distance),u_pitch:new n.b5(m,e.u_pitch),u_rotate_symbol:new n.bC(m,e.u_rotate_symbol),u_aspect_ratio:new n.b5(m,e.u_aspect_ratio),u_fade_change:new n.b5(m,e.u_fade_change),u_label_plane_matrix:new n.bD(m,e.u_label_plane_matrix),u_coord_matrix:new n.bD(m,e.u_coord_matrix),u_is_text:new n.bC(m,e.u_is_text),u_pitch_with_map:new n.bC(m,e.u_pitch_with_map),u_is_along_line:new n.bC(m,e.u_is_along_line),u_is_variable_anchor:new n.bC(m,e.u_is_variable_anchor),u_texsize:new n.bH(m,e.u_texsize),u_texture:new n.bC(m,e.u_texture),u_translation:new n.bH(m,e.u_translation),u_pitched_scale:new n.b5(m,e.u_pitched_scale)}),symbolSDF:(m,e)=>({u_is_size_zoom_constant:new n.bC(m,e.u_is_size_zoom_constant),u_is_size_feature_constant:new n.bC(m,e.u_is_size_feature_constant),u_size_t:new n.b5(m,e.u_size_t),u_size:new n.b5(m,e.u_size),u_camera_to_center_distance:new n.b5(m,e.u_camera_to_center_distance),u_pitch:new n.b5(m,e.u_pitch),u_rotate_symbol:new n.bC(m,e.u_rotate_symbol),u_aspect_ratio:new n.b5(m,e.u_aspect_ratio),u_fade_change:new n.b5(m,e.u_fade_change),u_label_plane_matrix:new n.bD(m,e.u_label_plane_matrix),u_coord_matrix:new n.bD(m,e.u_coord_matrix),u_is_text:new n.bC(m,e.u_is_text),u_pitch_with_map:new n.bC(m,e.u_pitch_with_map),u_is_along_line:new n.bC(m,e.u_is_along_line),u_is_variable_anchor:new n.bC(m,e.u_is_variable_anchor),u_texsize:new n.bH(m,e.u_texsize),u_texture:new n.bC(m,e.u_texture),u_gamma_scale:new n.b5(m,e.u_gamma_scale),u_device_pixel_ratio:new n.b5(m,e.u_device_pixel_ratio),u_is_halo:new n.bC(m,e.u_is_halo),u_translation:new n.bH(m,e.u_translation),u_pitched_scale:new n.b5(m,e.u_pitched_scale)}),symbolTextAndIcon:(m,e)=>({u_is_size_zoom_constant:new n.bC(m,e.u_is_size_zoom_constant),u_is_size_feature_constant:new n.bC(m,e.u_is_size_feature_constant),u_size_t:new n.b5(m,e.u_size_t),u_size:new n.b5(m,e.u_size),u_camera_to_center_distance:new n.b5(m,e.u_camera_to_center_distance),u_pitch:new n.b5(m,e.u_pitch),u_rotate_symbol:new n.bC(m,e.u_rotate_symbol),u_aspect_ratio:new n.b5(m,e.u_aspect_ratio),u_fade_change:new n.b5(m,e.u_fade_change),u_label_plane_matrix:new n.bD(m,e.u_label_plane_matrix),u_coord_matrix:new n.bD(m,e.u_coord_matrix),u_is_text:new n.bC(m,e.u_is_text),u_pitch_with_map:new n.bC(m,e.u_pitch_with_map),u_is_along_line:new n.bC(m,e.u_is_along_line),u_is_variable_anchor:new n.bC(m,e.u_is_variable_anchor),u_texsize:new n.bH(m,e.u_texsize),u_texsize_icon:new n.bH(m,e.u_texsize_icon),u_texture:new n.bC(m,e.u_texture),u_texture_icon:new n.bC(m,e.u_texture_icon),u_gamma_scale:new n.b5(m,e.u_gamma_scale),u_device_pixel_ratio:new n.b5(m,e.u_device_pixel_ratio),u_is_halo:new n.bC(m,e.u_is_halo),u_translation:new n.bH(m,e.u_translation),u_pitched_scale:new n.b5(m,e.u_pitched_scale)}),background:(m,e)=>({u_opacity:new n.b5(m,e.u_opacity),u_color:new n.bF(m,e.u_color)}),backgroundPattern:(m,e)=>({u_opacity:new n.b5(m,e.u_opacity),u_image:new n.bC(m,e.u_image),u_pattern_tl_a:new n.bH(m,e.u_pattern_tl_a),u_pattern_br_a:new n.bH(m,e.u_pattern_br_a),u_pattern_tl_b:new n.bH(m,e.u_pattern_tl_b),u_pattern_br_b:new n.bH(m,e.u_pattern_br_b),u_texsize:new n.bH(m,e.u_texsize),u_mix:new n.b5(m,e.u_mix),u_pattern_size_a:new n.bH(m,e.u_pattern_size_a),u_pattern_size_b:new n.bH(m,e.u_pattern_size_b),u_scale_a:new n.b5(m,e.u_scale_a),u_scale_b:new n.b5(m,e.u_scale_b),u_pixel_coord_upper:new n.bH(m,e.u_pixel_coord_upper),u_pixel_coord_lower:new n.bH(m,e.u_pixel_coord_lower),u_tile_units_to_pixels:new n.b5(m,e.u_tile_units_to_pixels)}),terrain:(m,e)=>({u_texture:new n.bC(m,e.u_texture),u_ele_delta:new n.b5(m,e.u_ele_delta),u_fog_matrix:new n.bD(m,e.u_fog_matrix),u_fog_color:new n.bF(m,e.u_fog_color),u_fog_ground_blend:new n.b5(m,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new n.b5(m,e.u_fog_ground_blend_opacity),u_horizon_color:new n.bF(m,e.u_horizon_color),u_horizon_fog_blend:new n.b5(m,e.u_horizon_fog_blend),u_is_globe_mode:new n.b5(m,e.u_is_globe_mode)}),terrainDepth:(m,e)=>({u_ele_delta:new n.b5(m,e.u_ele_delta)}),terrainCoords:(m,e)=>({u_texture:new n.bC(m,e.u_texture),u_terrain_coords_id:new n.b5(m,e.u_terrain_coords_id),u_ele_delta:new n.b5(m,e.u_ele_delta)}),projectionErrorMeasurement:(m,e)=>({u_input:new n.b5(m,e.u_input),u_output_expected:new n.b5(m,e.u_output_expected)}),atmosphere:(m,e)=>({u_sun_pos:new n.bG(m,e.u_sun_pos),u_atmosphere_blend:new n.b5(m,e.u_atmosphere_blend),u_globe_position:new n.bG(m,e.u_globe_position),u_globe_radius:new n.b5(m,e.u_globe_radius),u_inv_proj_matrix:new n.bD(m,e.u_inv_proj_matrix)}),sky:(m,e)=>({u_sky_color:new n.bF(m,e.u_sky_color),u_horizon_color:new n.bF(m,e.u_horizon_color),u_horizon:new n.bH(m,e.u_horizon),u_horizon_normal:new n.bH(m,e.u_horizon_normal),u_sky_horizon_blend:new n.b5(m,e.u_sky_horizon_blend),u_sky_blend:new n.b5(m,e.u_sky_blend)})};class po{constructor(e,s,d){this.context=e;let p=e.gl;this.buffer=p.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let s=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),s.bufferSubData(s.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let wh={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class um{constructor(e,s,d,p){this.length=s.length,this.attributes=d,this.itemSize=s.bytesPerElement,this.dynamicDraw=p,this.context=e;let g=e.gl;this.buffer=g.createBuffer(),e.bindVertexBuffer.set(this.buffer),g.bufferData(g.ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let s=this.context.gl;this.bind(),s.bufferSubData(s.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,s){for(let d=0;d<this.attributes.length;d++){let p=s.attributes[this.attributes[d].name];p!==void 0&&e.enableVertexAttribArray(p)}}setVertexAttribPointers(e,s,d){for(let p=0;p<this.attributes.length;p++){let g=this.attributes[p],v=s.attributes[g.name];v!==void 0&&e.vertexAttribPointer(v,g.components,e[wh[g.type]],!1,this.itemSize,g.offset+this.itemSize*(d||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Wt{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class dm extends Wt{getDefault(){return n.b4.transparent}set(e){let s=this.current;(e.r!==s.r||e.g!==s.g||e.b!==s.b||e.a!==s.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class pm extends Wt{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Xd extends Wt{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class fm extends Wt{getDefault(){return[!0,!0,!0,!0]}set(e){let s=this.current;(e[0]!==s[0]||e[1]!==s[1]||e[2]!==s[2]||e[3]!==s[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Hd extends Wt{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class jl extends Wt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Nl extends Wt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let s=this.current;(e.func!==s.func||e.ref!==s.ref||e.mask!==s.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class Gl extends Wt{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let s=this.current;(e[0]!==s[0]||e[1]!==s[1]||e[2]!==s[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Sh extends Wt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;e?s.enable(s.STENCIL_TEST):s.disable(s.STENCIL_TEST),this.current=e,this.dirty=!1}}class fo extends Wt{getDefault(){return[0,1]}set(e){let s=this.current;(e[0]!==s[0]||e[1]!==s[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class Xo extends Wt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;e?s.enable(s.DEPTH_TEST):s.disable(s.DEPTH_TEST),this.current=e,this.dirty=!1}}class _n extends Wt{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Yd extends Wt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;e?s.enable(s.BLEND):s.disable(s.BLEND),this.current=e,this.dirty=!1}}class Kd extends Wt{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let s=this.current;(e[0]!==s[0]||e[1]!==s[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class Th extends Wt{getDefault(){return n.b4.transparent}set(e){let s=this.current;(e.r!==s.r||e.g!==s.g||e.b!==s.b||e.a!==s.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class mo extends Wt{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class Vl extends Wt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;e?s.enable(s.CULL_FACE):s.disable(s.CULL_FACE),this.current=e,this.dirty=!1}}class Ul extends Wt{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class ja extends Wt{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class Zl extends Wt{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Jd extends Wt{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Ho extends Wt{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let s=this.current;(e[0]!==s[0]||e[1]!==s[1]||e[2]!==s[2]||e[3]!==s[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Yo extends Wt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.bindFramebuffer(s.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Qd extends Wt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.bindRenderbuffer(s.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Ch extends Wt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.bindTexture(s.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class Nt extends Wt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.bindBuffer(s.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class ql extends Wt{getDefault(){return null}set(e){let s=this.gl;s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class mm extends Wt{getDefault(){return null}set(e){var s;if(e===this.current&&!this.dirty)return;let d=this.gl;jn(d)?d.bindVertexArray(e):(s=d.getExtension("OES_vertex_array_object"))===null||s===void 0||s.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class ep extends Wt{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Na extends Wt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class gm extends Wt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class Mh extends Wt{constructor(e,s){super(e),this.context=e,this.parent=s}getDefault(){return null}}class tp extends Mh{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let s=this.gl;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class _m extends Mh{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let s=this.gl;s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Ih extends Mh{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let s=this.gl;s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,e),this.current=e,this.dirty=!1}}let Ga="Framebuffer is not complete";class Wl{constructor(e,s,d,p,g){this.context=e,this.width=s,this.height=d;let v=e.gl,T=this.framebuffer=v.createFramebuffer();if(this.colorAttachment=new tp(e,T),p)this.depthAttachment=g?new Ih(e,T):new _m(e,T);else if(g)throw new Error("Stencil cannot be set without depth");if(v.checkFramebufferStatus(v.FRAMEBUFFER)!==v.FRAMEBUFFER_COMPLETE)throw new Error(Ga)}destroy(){let e=this.context.gl,s=this.colorAttachment.get();if(s&&e.deleteTexture(s),this.depthAttachment){let d=this.depthAttachment.get();d&&e.deleteRenderbuffer(d)}e.deleteFramebuffer(this.framebuffer)}}class Eh{constructor(e){var s,d;if(this.gl=e,this.clearColor=new dm(this),this.clearDepth=new pm(this),this.clearStencil=new Xd(this),this.colorMask=new fm(this),this.depthMask=new Hd(this),this.stencilMask=new jl(this),this.stencilFunc=new Nl(this),this.stencilOp=new Gl(this),this.stencilTest=new Sh(this),this.depthRange=new fo(this),this.depthTest=new Xo(this),this.depthFunc=new _n(this),this.blend=new Yd(this),this.blendFunc=new Kd(this),this.blendColor=new Th(this),this.blendEquation=new mo(this),this.cullFace=new Vl(this),this.cullFaceSide=new Ul(this),this.frontFace=new ja(this),this.program=new Zl(this),this.activeTexture=new Jd(this),this.viewport=new Ho(this),this.bindFramebuffer=new Yo(this),this.bindRenderbuffer=new Qd(this),this.bindTexture=new Ch(this),this.bindVertexBuffer=new Nt(this),this.bindElementBuffer=new ql(this),this.bindVertexArray=new mm(this),this.pixelStoreUnpack=new ep(this),this.pixelStoreUnpackPremultiplyAlpha=new Na(this),this.pixelStoreUnpackFlipY=new gm(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),jn(e)){this.HALF_FLOAT=e.HALF_FLOAT;let p=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(s=e.RGBA16F)!==null&&s!==void 0?s:p?.RGBA16F_EXT,this.RGB16F=(d=e.RGB16F)!==null&&d!==void 0?d:p?.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");let p=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=p?.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,s){return new po(this,e,s)}createVertexBuffer(e,s,d){return new um(this,e,s,d)}createRenderbuffer(e,s,d){let p=this.gl,g=p.createRenderbuffer();return this.bindRenderbuffer.set(g),p.renderbufferStorage(p.RENDERBUFFER,e,s,d),this.bindRenderbuffer.set(null),g}createFramebuffer(e,s,d,p){return new Wl(this,e,s,d,p)}clear({color:e,depth:s,stencil:d}){let p=this.gl,g=0;e&&(g|=p.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),s!==void 0&&(g|=p.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(s),this.depthMask.set(!0)),d!==void 0&&(g|=p.STENCIL_BUFFER_BIT,this.clearStencil.set(d),this.stencilMask.set(255)),p.clear(g)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){n.bz(e.blendFunction,Jt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return jn(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))===null||e===void 0?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var s;return jn(this.gl)?this.gl.deleteVertexArray(e):(s=this.gl.getExtension("OES_vertex_array_object"))===null||s===void 0?void 0:s.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}let Ko;function Ph(m,e,s,d,p){let g=m.context,v=m.transform,T=g.gl,M=m.useProgram("collisionBox"),P=[],D=0,F=0;for(let ee=0;ee<d.length;ee++){let ie=d[ee],ae=e.getTile(ie).getBucket(s);if(!ae)continue;let le=p?ae.textCollisionBox:ae.iconCollisionBox,ce=ae.collisionCircleArray;ce.length>0&&(P.push({circleArray:ce,circleOffset:F,coord:ie}),D+=ce.length/4,F=D),le&&M.draw(g,T.LINES,Rt.disabled,Bt.disabled,m.colorModeForRenderPass(),Ot.disabled,Ud(m.transform),m.style.map.terrain&&m.style.map.terrain.getTerrainData(ie),v.getProjectionData({overscaledTileID:ie,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),s.id,le.layoutVertexBuffer,le.indexBuffer,le.segments,null,m.transform.zoom,null,null,le.collisionVertexBuffer)}if(!p||!P.length)return;let O=m.useProgram("collisionCircle"),V=new n.bM;V.resize(4*D),V._trim();let q=0;for(let ee of P)for(let ie=0;ie<ee.circleArray.length/4;ie++){let ae=4*ie,le=ee.circleArray[ae+0],ce=ee.circleArray[ae+1],fe=ee.circleArray[ae+2],ue=ee.circleArray[ae+3];V.emplace(q++,le,ce,fe,ue,0),V.emplace(q++,le,ce,fe,ue,1),V.emplace(q++,le,ce,fe,ue,2),V.emplace(q++,le,ce,fe,ue,3)}(!Ko||Ko.length<2*D)&&(Ko=function(ee){let ie=2*ee,ae=new n.bO;ae.resize(ie),ae._trim();for(let le=0;le<ie;le++){let ce=6*le;ae.uint16[ce+0]=4*le+0,ae.uint16[ce+1]=4*le+1,ae.uint16[ce+2]=4*le+2,ae.uint16[ce+3]=4*le+2,ae.uint16[ce+4]=4*le+3,ae.uint16[ce+5]=4*le+0}return ae}(D));let Q=g.createIndexBuffer(Ko,!0),J=g.createVertexBuffer(V,n.bN.members,!0);for(let ee of P){let ie=Zd(m.transform);O.draw(g,T.TRIANGLES,Rt.disabled,Bt.disabled,m.colorModeForRenderPass(),Ot.disabled,ie,m.style.map.terrain&&m.style.map.terrain.getTerrainData(ee.coord),null,s.id,J,Q,n.aD.simpleSegment(0,2*ee.circleOffset,ee.circleArray.length,ee.circleArray.length/2),null,m.transform.zoom,null,null,null)}J.destroy(),Q.destroy()}let $l=n.aq(new Float32Array(16));function Xl(m,e,s,d,p,g){let{horizontalAlign:v,verticalAlign:T}=n.ay(m);return new n.P((-(v-.5)*e/p+d[0])*g,(-(T-.5)*s/p+d[1])*g)}function Rh(m,e,s,d,p,g){let v=e.tileAnchorPoint.add(new n.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let T=d.mult(g);s||(T=T.rotate(-p));let M=v.add(T);return Ie(M.x,M.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(s){let T=Qe(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(m),M=Math.atan(T.y/T.x)+(T.x<0?Math.PI:0);return m.add(d.rotate(M))}return m.add(d)}function ym(m,e,s,d,p,g,v,T,M,P,D,F){let O=m.text.placedSymbolArray,V=m.text.dynamicLayoutVertexArray,q=m.icon.dynamicLayoutVertexArray,Q={};V.clear();for(let J=0;J<O.length;J++){let ee=O.get(J),ie=ee.hidden||!ee.crossTileID||m.allowVerticalPlacement&&!ee.placedOrientation?null:d[ee.crossTileID];if(ie){let ae=new n.P(ee.anchorX,ee.anchorY),le={getElevation:F,width:p.width,height:p.height,pitchedLabelPlaneMatrix:g,lineVertexArray:null,pitchWithMap:s,transform:p,projectionCache:null,tileAnchorPoint:ae,translation:P,unwrappedTileID:D},ce=s?mt(ae.x,ae.y,le):Qe(ae.x,ae.y,le),fe=xe(p.cameraToCenterDistance,ce.signedDistanceFromCamera),ue=n.aj(m.textSizeData,T,ee)*fe/n.as;s&&(ue*=m.tilePixelRatio/v);let{width:we,height:Ce,anchor:ze,textOffset:Fe,textBoxScale:Ae}=ie,Ye=Xl(ze,we,Ce,Fe,Ae,ue),$e=p.getPitchedTextCorrection(ae.x+P[0],ae.y+P[1],D),Oe=Rh(ce.point,le,e,Ye,-p.bearingInRadians,$e),st=m.allowVerticalPlacement&&ee.placedOrientation===n.ai.vertical?Math.PI/2:0;for(let Ct=0;Ct<ee.numGlyphs;Ct++)n.ak(V,Oe,st);M&&ee.associatedIconIndex>=0&&(Q[ee.associatedIconIndex]={shiftedAnchor:Oe,angle:st})}else ji(ee.numGlyphs,V)}if(M){q.clear();let J=m.icon.placedSymbolArray;for(let ee=0;ee<J.length;ee++){let ie=J.get(ee);if(ie.hidden)ji(ie.numGlyphs,q);else{let ae=Q[ee];if(ae)for(let le=0;le<ie.numGlyphs;le++)n.ak(q,ae.shiftedAnchor,ae.angle);else ji(ie.numGlyphs,q)}}m.icon.dynamicLayoutVertexBuffer.updateData(q)}m.text.dynamicLayoutVertexBuffer.updateData(V)}function Ah(m,e,s){return s.iconsInText&&e?"symbolTextAndIcon":m?"symbolSDF":"symbolIcon"}function ip(m,e,s,d,p,g,v,T,M,P,D,F,O){let V=m.context,q=V.gl,Q=m.transform,J=T==="map",ee=M==="map",ie=T!=="viewport"&&s.layout.get("symbol-placement")!=="point",ae=J&&!ee&&!ie,le=!s.layout.get("symbol-sort-key").isConstant(),ce=!1,fe=m.getDepthModeForSublayer(0,Rt.ReadOnly),ue=s._unevaluatedLayout.hasValue("text-variable-anchor")||s._unevaluatedLayout.hasValue("text-variable-anchor-offset"),we=[],Ce=Q.getCircleRadiusCorrection();for(let ze of d){let Fe=e.getTile(ze),Ae=Fe.getBucket(s);if(!Ae)continue;let Ye=p?Ae.text:Ae.icon;if(!Ye||!Ye.segments.get().length||!Ye.hasVisibleVertices)continue;let $e=Ye.programConfigurations.get(s.id),Oe=p||Ae.sdfIcons,st=p?Ae.textSizeData:Ae.iconSizeData,Ct=ee||Q.pitch!==0,Vt=m.useProgram(Ah(Oe,p,Ae),$e),ui=n.ah(st,Q.zoom),Ht=m.style.map.terrain&&m.style.map.terrain.getTerrainData(ze),Qt,ni,Xt,ei,Gi=[0,0],Mi=null;if(p)ni=Fe.glyphAtlasTexture,Xt=q.LINEAR,Qt=Fe.glyphAtlasTexture.size,Ae.iconsInText&&(Gi=Fe.imageAtlasTexture.size,Mi=Fe.imageAtlasTexture,ei=Ct||m.options.rotating||m.options.zooming||st.kind==="composite"||st.kind==="camera"?q.LINEAR:q.NEAREST);else{let si=s.layout.get("icon-size").constantOr(0)!==1||Ae.iconsNeedLinear;ni=Fe.imageAtlasTexture,Xt=Oe||m.options.rotating||m.options.zooming||si||Ct?q.LINEAR:q.NEAREST,Qt=Fe.imageAtlasTexture.size}let Hi=n.at(Fe,1,m.transform.zoom),pr=Te(J,m.transform,Hi),os=n.H();n.an(os,pr);let un=_e(ee,J,m.transform,Hi),as=n.au(Q,Fe,g,v),vo=Q.getProjectionData({overscaledTileID:ze,applyGlobeMatrix:!O,applyTerrainMatrix:!0}),nl=ue&&Ae.hasTextData(),pc=s.layout.get("icon-text-fit")!=="none"&&nl&&Ae.hasIconData();if(ie){let si=m.style.map.terrain?(Yi,Ki)=>m.style.map.terrain.getElevation(ze,Yi,Ki):null,Vi=s.layout.get("text-rotation-alignment")==="map";Xe(Ae,m,p,pr,os,ee,P,Vi,ze.toUnwrapped(),Q.width,Q.height,as,si)}let Ns=p&&ue||pc,fr=ie||Ns?$l:ee?pr:m.transform.clipSpaceToPixelsMatrix,dn=Oe&&s.paint.get(p?"text-halo-width":"icon-halo-width").constantOr(1)!==0,Er;Er=Oe?Ae.iconsInText?_h(st.kind,ui,ae,ee,ie,Ns,m,fr,un,as,Qt,Gi,Ce):rs(st.kind,ui,ae,ee,ie,Ns,m,fr,un,as,p,Qt,0,Ce):Ba(st.kind,ui,ae,ee,ie,Ns,m,fr,un,as,p,Qt,Ce);let Pr={program:Vt,buffers:Ye,uniformValues:Er,projectionData:vo,atlasTexture:ni,atlasTextureIcon:Mi,atlasInterpolation:Xt,atlasInterpolationIcon:ei,isSDF:Oe,hasHalo:dn};if(le&&Ae.canOverlap){ce=!0;let si=Ye.segments.get();for(let Vi of si)we.push({segments:new n.aD([Vi]),sortKey:Vi.sortKey,state:Pr,terrainData:Ht})}else we.push({segments:Ye.segments,sortKey:0,state:Pr,terrainData:Ht})}ce&&we.sort((ze,Fe)=>ze.sortKey-Fe.sortKey);for(let ze of we){let Fe=ze.state;if(V.activeTexture.set(q.TEXTURE0),Fe.atlasTexture.bind(Fe.atlasInterpolation,q.CLAMP_TO_EDGE),Fe.atlasTextureIcon&&(V.activeTexture.set(q.TEXTURE1),Fe.atlasTextureIcon&&Fe.atlasTextureIcon.bind(Fe.atlasInterpolationIcon,q.CLAMP_TO_EDGE)),Fe.isSDF){let Ae=Fe.uniformValues;Fe.hasHalo&&(Ae.u_is_halo=1,Lh(Fe.buffers,ze.segments,s,m,Fe.program,fe,D,F,Ae,Fe.projectionData,ze.terrainData)),Ae.u_is_halo=0}Lh(Fe.buffers,ze.segments,s,m,Fe.program,fe,D,F,Fe.uniformValues,Fe.projectionData,ze.terrainData)}}function Lh(m,e,s,d,p,g,v,T,M,P,D){let F=d.context;p.draw(F,F.gl.TRIANGLES,g,v,T,Ot.backCCW,M,D,P,s.id,m.layoutVertexBuffer,m.indexBuffer,e,s.paint,d.transform.zoom,m.programConfigurations.get(s.id),m.dynamicLayoutVertexBuffer,m.opacityVertexBuffer)}function Hl(m,e,s,d,p){let g=m.context,v=g.gl,T=Bt.disabled,M=new Jt([v.ONE,v.ONE],n.b4.transparent,[!0,!0,!0,!0]),P=e.getBucket(s);if(!P)return;let D=d.key,F=s.heatmapFbos.get(D);F||(F=Dh(g,e.tileSize,e.tileSize),s.heatmapFbos.set(D,F)),g.bindFramebuffer.set(F.framebuffer),g.viewport.set([0,0,e.tileSize,e.tileSize]),g.clear({color:n.b4.transparent});let O=P.programConfigurations.get(s.id),V=m.useProgram("heatmap",O,!p),q=m.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),Q=m.style.map.terrain.getTerrainData(d);V.draw(g,v.TRIANGLES,Rt.disabled,T,M,Ot.disabled,js(e,m.transform.zoom,s.paint.get("heatmap-intensity"),1),Q,q,s.id,P.layoutVertexBuffer,P.indexBuffer,P.segments,s.paint,m.transform.zoom,O)}function kh(m,e,s,d,p){let g=m.context,v=g.gl,T=m.transform;g.setColorMode(m.colorModeForRenderPass());let M=Fh(g,e),P=s.key,D=e.heatmapFbos.get(P);if(!D)return;g.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,D.colorAttachment.get()),g.activeTexture.set(v.TEXTURE1),M.bind(v.LINEAR,v.CLAMP_TO_EDGE);let F=T.getProjectionData({overscaledTileID:s,applyTerrainMatrix:p,applyGlobeMatrix:!d});m.useProgram("heatmapTexture").draw(g,v.TRIANGLES,Rt.disabled,Bt.disabled,m.colorModeForRenderPass(),Ot.disabled,ph(m,e,0,1),null,F,e.id,m.rasterBoundsBuffer,m.quadTriangleIndexBuffer,m.rasterBoundsSegments,e.paint,T.zoom),D.destroy(),e.heatmapFbos.delete(P)}function Dh(m,e,s){var d,p;let g=m.gl,v=g.createTexture();g.bindTexture(g.TEXTURE_2D,v),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,g.LINEAR),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,g.LINEAR);let T=(d=m.HALF_FLOAT)!==null&&d!==void 0?d:g.UNSIGNED_BYTE,M=(p=m.RGBA16F)!==null&&p!==void 0?p:g.RGBA;g.texImage2D(g.TEXTURE_2D,0,M,e,s,0,g.RGBA,T,null);let P=m.createFramebuffer(e,s,!1,!1);return P.colorAttachment.set(v),P}function Fh(m,e){return e.colorRampTexture||(e.colorRampTexture=new Re(m,e.colorRamp,m.gl.RGBA)),e.colorRampTexture}function Va(m,e,s,d,p){if(!s||!d||!d.imageAtlas)return;let g=d.imageAtlas.patternPositions,v=g[s.to.toString()],T=g[s.from.toString()];if(!v&&T&&(v=T),!T&&v&&(T=v),!v||!T){let M=p.getPaintProperty(e);v=g[M],T=g[M]}v&&T&&m.setConstantPatternPositions(v,T)}function Yl(m,e,s,d,p,g,v,T){let M=m.context.gl,P="fill-pattern",D=s.paint.get(P),F=D&&D.constantOr(1),O=s.getCrossfadeParameters(),V,q,Q,J,ee,ie=m.transform,ae=s.paint.get("fill-translate"),le=s.paint.get("fill-translate-anchor");v?(q=F&&!s.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",V=M.LINES):(q=F?"fillPattern":"fill",V=M.TRIANGLES);let ce=D.constantOr(null);for(let fe of d){let ue=e.getTile(fe);if(F&&!ue.patternsLoaded())continue;let we=ue.getBucket(s);if(!we)continue;let Ce=we.programConfigurations.get(s.id),ze=m.useProgram(q,Ce),Fe=m.style.map.terrain&&m.style.map.terrain.getTerrainData(fe);F&&(m.context.activeTexture.set(M.TEXTURE0),ue.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),Ce.updatePaintBuffers(O)),Va(Ce,P,ce,ue,s);let Ae=ie.getProjectionData({overscaledTileID:fe,applyGlobeMatrix:!T,applyTerrainMatrix:!0}),Ye=n.au(ie,ue,ae,le);if(v){J=we.indexBuffer2,ee=we.segments2;let Oe=[M.drawingBufferWidth,M.drawingBufferHeight];Q=q==="fillOutlinePattern"&&F?uh(m,O,ue,Oe,Ye):Gd(Oe,Ye)}else J=we.indexBuffer,ee=we.segments,Q=F?Nd(m,O,ue,Ye):{u_fill_translate:Ye};let $e;if(m.renderPass==="translucent"&&T){let[Oe]=m.getStencilConfigForOverlapAndUpdateStencilID(d);$e=Oe[fe.overscaledZ]}else $e=m.stencilModeForClipping(fe);ze.draw(m.context,V,p,$e,g,Ot.backCCW,Q,Fe,Ae,s.id,we.layoutVertexBuffer,J,ee,s.paint,m.transform.zoom,Ce)}}function zh(m,e,s,d,p,g,v,T){let M=m.context,P=M.gl,D="fill-extrusion-pattern",F=s.paint.get(D),O=F.constantOr(1),V=s.getCrossfadeParameters(),q=s.paint.get("fill-extrusion-opacity"),Q=F.constantOr(null),J=m.transform;for(let ee of d){let ie=e.getTile(ee),ae=ie.getBucket(s);if(!ae)continue;let le=m.style.map.terrain&&m.style.map.terrain.getTerrainData(ee),ce=ae.programConfigurations.get(s.id),fe=m.useProgram(O?"fillExtrusionPattern":"fillExtrusion",ce);O&&(m.context.activeTexture.set(P.TEXTURE0),ie.imageAtlasTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),ce.updatePaintBuffers(V));let ue=J.getProjectionData({overscaledTileID:ee,applyGlobeMatrix:!T,applyTerrainMatrix:!0});Va(ce,D,Q,ie,s);let we=n.au(J,ie,s.paint.get("fill-extrusion-translate"),s.paint.get("fill-extrusion-translate-anchor")),Ce=s.paint.get("fill-extrusion-vertical-gradient"),ze=O?jd(m,Ce,q,we,ee,V,ie):Bd(m,Ce,q,we);fe.draw(M,M.gl.TRIANGLES,p,g,v,Ot.backCCW,ze,le,ue,s.id,ae.layoutVertexBuffer,ae.indexBuffer,ae.segments,s.paint,m.transform.zoom,ce,m.style.map.terrain&&ae.centroidVertexBuffer)}}function Kl(m,e,s,d,p,g,v,T,M){var P;let D=m.style.projection,F=m.context,O=m.transform,V=F.gl,q=m.useProgram("hillshade"),Q=!m.options.moving;for(let J of d){let ee=e.getTile(J),ie=ee.fbo;if(!ie)continue;let ae=D.getMeshFromTileID(F,J.canonical,T,!0,"raster"),le=(P=m.style.map.terrain)===null||P===void 0?void 0:P.getTerrainData(J);F.activeTexture.set(V.TEXTURE0),V.bindTexture(V.TEXTURE_2D,ie.colorAttachment.get());let ce=O.getProjectionData({overscaledTileID:J,aligned:Q,applyGlobeMatrix:!M,applyTerrainMatrix:!0});q.draw(F,V.TRIANGLES,g,p[J.overscaledZ],v,Ot.backCCW,qd(m,ee,s),le,ce,s.id,ae.vertexBuffer,ae.indexBuffer,ae.segments)}}let fi=[new n.P(0,0),new n.P(n.X,0),new n.P(n.X,n.X),new n.P(0,n.X)];function ns(m,e,s,d,p,g,v,T,M=!1,P=!1){let D=d[d.length-1].overscaledZ,F=m.context,O=F.gl,V=m.useProgram("raster"),q=m.transform,Q=m.style.projection,J=m.colorModeForRenderPass(),ee=!m.options.moving;for(let ie of d){let ae=m.getDepthModeForSublayer(ie.overscaledZ-D,s.paint.get("raster-opacity")===1?Rt.ReadWrite:Rt.ReadOnly,O.LESS),le=e.getTile(ie);le.registerFadeDuration(s.paint.get("raster-fade-duration"));let ce=e.findLoadedParent(ie,0),fe=e.findLoadedSibling(ie),ue=yn(le,ce||fe||null,e,s,m.transform,m.style.map.terrain),we,Ce,ze=s.paint.get("raster-resampling")==="nearest"?O.NEAREST:O.LINEAR;F.activeTexture.set(O.TEXTURE0),le.texture.bind(ze,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),F.activeTexture.set(O.TEXTURE1),ce?(ce.texture.bind(ze,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),we=Math.pow(2,ce.tileID.overscaledZ-le.tileID.overscaledZ),Ce=[le.tileID.canonical.x*we%1,le.tileID.canonical.y*we%1]):le.texture.bind(ze,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),le.texture.useMipmap&&F.extTextureFilterAnisotropic&&m.transform.pitch>20&&O.texParameterf(O.TEXTURE_2D,F.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,F.extTextureFilterAnisotropicMax);let Fe=m.style.map.terrain&&m.style.map.terrain.getTerrainData(ie),Ae=q.getProjectionData({overscaledTileID:ie,aligned:ee,applyGlobeMatrix:!P,applyTerrainMatrix:!0}),Ye=gh(Ce||[0,0],we||1,ue,s,T),$e=Q.getMeshFromTileID(F,ie.canonical,g,v,"raster");V.draw(F,O.TRIANGLES,ae,p?p[ie.overscaledZ]:Bt.disabled,J,M?Ot.frontCCW:Ot.backCCW,Ye,Fe,Ae,s.id,$e.vertexBuffer,$e.indexBuffer,$e.segments)}}function yn(m,e,s,d,p,g){let v=d.paint.get("raster-fade-duration");if(!g&&v>0){let T=E.now(),M=(T-m.timeAdded)/v,P=e?(T-e.timeAdded)/v:-1,D=s.getSource(),F=On(p,{tileSize:D.tileSize,roundZoom:D.roundZoom}),O=!e||Math.abs(e.tileID.overscaledZ-F)>Math.abs(m.tileID.overscaledZ-F),V=O&&m.refreshedUponExpiration?1:n.ab(O?M:1-P,0,1);return m.refreshedUponExpiration&&M>=1&&(m.refreshedUponExpiration=!1),e?{opacity:1,mix:1-V}:{opacity:V,mix:0}}return{opacity:1,mix:0}}let Oh=new n.b4(1,0,0,1),Bh=new n.b4(0,1,0,1),rp=new n.b4(0,0,1,1),Jo=new n.b4(1,0,1,1),Ua=new n.b4(0,1,1,1);function Jl(m,e,s,d){Za(m,0,e+s/2,m.transform.width,s,d)}function jh(m,e,s,d){Za(m,e-s/2,0,s,m.transform.height,d)}function Za(m,e,s,d,p,g){let v=m.context,T=v.gl;T.enable(T.SCISSOR_TEST),T.scissor(e*m.pixelRatio,s*m.pixelRatio,d*m.pixelRatio,p*m.pixelRatio),v.clear({color:g}),T.disable(T.SCISSOR_TEST)}function np(m,e,s){let d=m.context,p=d.gl,g=m.useProgram("debug"),v=Rt.disabled,T=Bt.disabled,M=m.colorModeForRenderPass(),P="$debug",D=m.style.map.terrain&&m.style.map.terrain.getTerrainData(s);d.activeTexture.set(p.TEXTURE0);let F=e.getTileByID(s.key).latestRawTileData,O=Math.floor((F&&F.byteLength||0)/1024),V=e.getTile(s).tileSize,q=512/Math.min(V,512)*(s.overscaledZ/m.transform.zoom)*.5,Q=s.canonical.toString();s.overscaledZ!==s.canonical.z&&(Q+=` => ${s.overscaledZ}`),function(ee,ie){ee.initDebugOverlayCanvas();let ae=ee.debugOverlayCanvas,le=ee.context.gl,ce=ee.debugOverlayCanvas.getContext("2d");ce.clearRect(0,0,ae.width,ae.height),ce.shadowColor="white",ce.shadowBlur=2,ce.lineWidth=1.5,ce.strokeStyle="white",ce.textBaseline="top",ce.font="bold 36px Open Sans, sans-serif",ce.fillText(ie,5,5),ce.strokeText(ie,5,5),ee.debugOverlayTexture.update(ae),ee.debugOverlayTexture.bind(le.LINEAR,le.CLAMP_TO_EDGE)}(m,`${Q} ${O}kB`);let J=m.transform.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!0,applyTerrainMatrix:!0});g.draw(d,p.TRIANGLES,v,T,Jt.alphaBlended,Ot.disabled,dh(n.b4.transparent,q),null,J,P,m.debugBuffer,m.quadTriangleIndexBuffer,m.debugSegments),g.draw(d,p.LINE_STRIP,v,T,M,Ot.disabled,dh(n.b4.red),D,J,P,m.debugBuffer,m.tileBorderIndexBuffer,m.debugSegments)}function Nh(m,e,s,d){let{isRenderingGlobe:p}=d,g=m.context,v=g.gl,T=m.transform,M=m.colorModeForRenderPass(),P=m.getDepthModeFor3D(),D=m.useProgram("terrain");g.bindFramebuffer.set(null),g.viewport.set([0,0,m.width,m.height]);for(let F of s){let O=e.getTerrainMesh(F.tileID),V=m.renderToTexture.getTexture(F),q=e.getTerrainData(F.tileID);g.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,V.texture);let Q=e.getMeshFrameDelta(T.zoom),J=T.calculateFogMatrix(F.tileID.toUnwrapped()),ee=za(Q,J,m.style.sky,T.pitch,p),ie=T.getProjectionData({overscaledTileID:F.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});D.draw(g,v.TRIANGLES,P,Bt.disabled,M,Ot.backCCW,ee,q,ie,"terrain",O.vertexBuffer,O.indexBuffer,O.segments)}}function Gh(m,e){if(!e.mesh){let s=new n.aC;s.emplaceBack(-1,-1),s.emplaceBack(1,-1),s.emplaceBack(1,1),s.emplaceBack(-1,1);let d=new n.aE;d.emplaceBack(0,1,2),d.emplaceBack(0,2,3),e.mesh=new ts(m.createVertexBuffer(s,Lt.members),m.createIndexBuffer(d),n.aD.simpleSegment(0,0,s.length,d.length))}return e.mesh}class go{constructor(e,s){this.context=new Eh(e),this.transform=s,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:n.aq(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Z.maxUnderzooming+Z.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new so}resize(e,s,d){if(this.width=Math.floor(e*d),this.height=Math.floor(s*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let p of this.style._order)this.style._layers[p].resize()}setup(){let e=this.context,s=new n.aC;s.emplaceBack(0,0),s.emplaceBack(n.X,0),s.emplaceBack(0,n.X),s.emplaceBack(n.X,n.X),this.tileExtentBuffer=e.createVertexBuffer(s,Lt.members),this.tileExtentSegments=n.aD.simpleSegment(0,0,4,2);let d=new n.aC;d.emplaceBack(0,0),d.emplaceBack(n.X,0),d.emplaceBack(0,n.X),d.emplaceBack(n.X,n.X),this.debugBuffer=e.createVertexBuffer(d,Lt.members),this.debugSegments=n.aD.simpleSegment(0,0,4,5);let p=new n.bT;p.emplaceBack(0,0,0,0),p.emplaceBack(n.X,0,n.X,0),p.emplaceBack(0,n.X,0,n.X),p.emplaceBack(n.X,n.X,n.X,n.X),this.rasterBoundsBuffer=e.createVertexBuffer(p,hh.members),this.rasterBoundsSegments=n.aD.simpleSegment(0,0,4,2);let g=new n.aC;g.emplaceBack(0,0),g.emplaceBack(n.X,0),g.emplaceBack(0,n.X),g.emplaceBack(n.X,n.X),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(g,Lt.members),this.rasterBoundsSegmentsPosOnly=n.aD.simpleSegment(0,0,4,5);let v=new n.aC;v.emplaceBack(0,0),v.emplaceBack(1,0),v.emplaceBack(0,1),v.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(v,Lt.members),this.viewportSegments=n.aD.simpleSegment(0,0,4,2);let T=new n.bU;T.emplaceBack(0),T.emplaceBack(1),T.emplaceBack(3),T.emplaceBack(2),T.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(T);let M=new n.aE;M.emplaceBack(1,0,2),M.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(M);let P=this.context.gl;this.stencilClearMode=new Bt({func:P.ALWAYS,mask:0},0,255,P.ZERO,P.ZERO,P.ZERO),this.tileExtentMesh=new ts(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,s=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let d=n.H();n.bL(d,0,this.width,this.height,0,0,1),n.K(d,d,[s.drawingBufferWidth,s.drawingBufferHeight,0]);let p={mainMatrix:d,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:d};this.useProgram("clippingMask",null,!0).draw(e,s.TRIANGLES,Rt.disabled,this.stencilClearMode,Jt.disabled,Ot.disabled,null,null,p,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,s,d){if(this.currentStencilSource===e.source||!e.isTileClipped()||!s||!s.length)return;this.currentStencilSource=e.source,this.nextStencilID+s.length>256&&this.clearStencil();let p=this.context;p.setColorMode(Jt.disabled),p.setDepthMode(Rt.disabled);let g={};for(let v of s)g[v.key]=this.nextStencilID++;this._renderTileMasks(g,s,d,!0),this._renderTileMasks(g,s,d,!1),this._tileClippingMaskIDs=g}_renderTileMasks(e,s,d,p){let g=this.context,v=g.gl,T=this.style.projection,M=this.transform,P=this.useProgram("clippingMask");for(let D of s){let F=e[D.key],O=this.style.map.terrain&&this.style.map.terrain.getTerrainData(D),V=T.getMeshFromTileID(this.context,D.canonical,p,!0,"stencil"),q=M.getProjectionData({overscaledTileID:D,applyGlobeMatrix:!0,applyTerrainMatrix:!0});P.draw(g,v.TRIANGLES,Rt.disabled,new Bt({func:v.ALWAYS,mask:0},F,255,v.KEEP,v.KEEP,v.REPLACE),Jt.disabled,d?Ot.disabled:Ot.backCCW,null,O,q,"$clipping",V.vertexBuffer,V.indexBuffer,V.segments)}}_renderTilesDepthBuffer(){let e=this.context,s=e.gl,d=this.style.projection,p=this.transform,g=this.useProgram("depth"),v=this.getDepthModeFor3D(),T=K(p,{tileSize:p.tileSize});for(let M of T){let P=this.style.map.terrain&&this.style.map.terrain.getTerrainData(M),D=d.getMeshFromTileID(this.context,M.canonical,!0,!0,"raster"),F=p.getProjectionData({overscaledTileID:M,applyGlobeMatrix:!0,applyTerrainMatrix:!0});g.draw(e,s.TRIANGLES,v,Bt.disabled,Jt.disabled,Ot.backCCW,null,P,F,"$clipping",D.vertexBuffer,D.indexBuffer,D.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,s=this.context.gl;return new Bt({func:s.NOTEQUAL,mask:255},e,255,s.KEEP,s.KEEP,s.REPLACE)}stencilModeForClipping(e){let s=this.context.gl;return new Bt({func:s.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,s.KEEP,s.KEEP,s.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let s=this.context.gl,d=e.sort((v,T)=>T.overscaledZ-v.overscaledZ),p=d[d.length-1].overscaledZ,g=d[0].overscaledZ-p+1;if(g>1){this.currentStencilSource=void 0,this.nextStencilID+g>256&&this.clearStencil();let v={};for(let T=0;T<g;T++)v[T+p]=new Bt({func:s.GEQUAL,mask:255},T+this.nextStencilID,255,s.KEEP,s.KEEP,s.REPLACE);return this.nextStencilID+=g,[v,d]}return[{[p]:Bt.disabled},d]}stencilConfigForOverlapTwoPass(e){let s=this.context.gl,d=e.sort((v,T)=>T.overscaledZ-v.overscaledZ),p=d[d.length-1].overscaledZ,g=d[0].overscaledZ-p+1;if(this.clearStencil(),g>1){let v={},T={};for(let M=0;M<g;M++)v[M+p]=new Bt({func:s.GREATER,mask:255},g+1+M,255,s.KEEP,s.KEEP,s.REPLACE),T[M+p]=new Bt({func:s.GREATER,mask:255},1+M,255,s.KEEP,s.KEEP,s.REPLACE);return this.nextStencilID=2*g+1,[v,T,d]}return this.nextStencilID=3,[{[p]:new Bt({func:s.GREATER,mask:255},2,255,s.KEEP,s.KEEP,s.REPLACE)},{[p]:new Bt({func:s.GREATER,mask:255},1,255,s.KEEP,s.KEEP,s.REPLACE)},d]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new Jt([e.CONSTANT_COLOR,e.ONE],new n.b4(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Jt.unblended:Jt.alphaBlended}getDepthModeForSublayer(e,s,d){if(!this.opaquePassEnabledForLayer())return Rt.disabled;let p=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Rt(d||this.context.gl.LEQUAL,s,[p,p])}getDepthModeFor3D(){return new Rt(this.context.gl.LEQUAL,Rt.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,s){var d,p;this.style=e,this.options=s,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(E.now()),this.imageManager.beginFrame();let g=this.style._order,v=this.style.sourceCaches,T={},M={},P={},D={isRenderingToTexture:!1,isRenderingGlobe:((d=e.projection)===null||d===void 0?void 0:d.transitionState)>0};for(let O in v){let V=v[O];V.used&&V.prepare(this.context),T[O]=V.getVisibleCoordinates(!1),M[O]=T[O].slice().reverse(),P[O]=V.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let O=0;O<g.length;O++)if(this.style._layers[g[O]].is3D()){this.opaquePassCutoff=O;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let O of g){let V=this.style._layers[O];if(!V.hasOffscreenPass()||V.isHidden(this.transform.zoom))continue;let q=M[V.source];(V.type==="custom"||q.length)&&this.renderLayer(this,v[V.source],V,q,D)}if((p=this.style.projection)===null||p===void 0||p.updateGPUdependent({context:this.context,useProgram:O=>this.useProgram(O)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:s.showOverdrawInspector?n.b4.black:n.b4.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(O,V){let q=O.context,Q=q.gl,J=((fe,ue,we)=>{let Ce=Math.cos(ue.rollInRadians),ze=Math.sin(ue.rollInRadians),Fe=Fl(ue),Ae=ue.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:fe.properties.get("sky-color"),u_horizon_color:fe.properties.get("horizon-color"),u_horizon:[(ue.width/2-Fe*ze)*we,(ue.height/2+Fe*Ce)*we],u_horizon_normal:[-ze,Ce],u_sky_horizon_blend:fe.properties.get("sky-horizon-blend")*ue.height/2*we,u_sky_blend:Ae}})(V,O.style.map.transform,O.pixelRatio),ee=new Rt(Q.LEQUAL,Rt.ReadWrite,[0,1]),ie=Bt.disabled,ae=O.colorModeForRenderPass(),le=O.useProgram("sky"),ce=Gh(q,V);le.draw(q,Q.TRIANGLES,ee,ie,ae,Ot.disabled,J,null,void 0,"sky",ce.vertexBuffer,ce.indexBuffer,ce.segments)}(this,this.style.sky),this._showOverdrawInspector=s.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=g.length-1;this.currentLayer>=0;this.currentLayer--){let O=this.style._layers[g[this.currentLayer]],V=v[O.source],q=T[O.source];this._renderTileClippingMasks(O,q,!1),this.renderLayer(this,V,O,q,D)}this.renderPass="translucent";let F=!1;for(this.currentLayer=0;this.currentLayer<g.length;this.currentLayer++){let O=this.style._layers[g[this.currentLayer]],V=v[O.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(O,D))continue;this.opaquePassEnabledForLayer()||F||(F=!0,D.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let q=(O.type==="symbol"?P:M)[O.source];this._renderTileClippingMasks(O,T[O.source],!1),this.renderLayer(this,V,O,q,D)}if(D.isRenderingGlobe&&function(O,V,q){let Q=O.context,J=Q.gl,ee=O.useProgram("atmosphere"),ie=new Rt(J.LEQUAL,Rt.ReadOnly,[0,1]),ae=O.transform,le=function(Ae,Ye){let $e=Ae.properties.get("position"),Oe=[-$e.x,-$e.y,-$e.z],st=n.aq(new Float64Array(16));return Ae.properties.get("anchor")==="map"&&(n.aX(st,st,Ye.rollInRadians),n.aY(st,st,-Ye.pitchInRadians),n.aX(st,st,Ye.bearingInRadians),n.aY(st,st,Ye.center.lat*Math.PI/180),n.bj(st,st,-Ye.center.lng*Math.PI/180)),n.bS(Oe,Oe,st),Oe}(q,O.transform),ce=ae.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),fe=V.properties.get("atmosphere-blend")*ce.projectionTransition;if(fe===0)return;let ue=cn(ae.worldSize,ae.center.lat),we=ae.inverseProjectionMatrix,Ce=new Float64Array(4);Ce[3]=1,n.al(Ce,Ce,ae.modelViewProjectionMatrix),Ce[0]/=Ce[3],Ce[1]/=Ce[3],Ce[2]/=Ce[3],Ce[3]=1,n.al(Ce,Ce,we),Ce[0]/=Ce[3],Ce[1]/=Ce[3],Ce[2]/=Ce[3],Ce[3]=1;let ze=((Ae,Ye,$e,Oe,st)=>({u_sun_pos:Ae,u_atmosphere_blend:Ye,u_globe_position:$e,u_globe_radius:Oe,u_inv_proj_matrix:st}))(le,fe,[Ce[0],Ce[1],Ce[2]],ue,we),Fe=Gh(Q,V);ee.draw(Q,J.TRIANGLES,ie,Bt.disabled,Jt.alphaBlended,Ot.disabled,ze,null,null,"atmosphere",Fe.vertexBuffer,Fe.indexBuffer,Fe.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let O=function(V,q){let Q=null,J=Object.values(V._layers).flatMap(le=>le.source&&!le.isHidden(q)?[V.sourceCaches[le.source]]:[]),ee=J.filter(le=>le.getSource().type==="vector"),ie=J.filter(le=>le.getSource().type!=="vector"),ae=le=>{(!Q||Q.getSource().maxzoom<le.getSource().maxzoom)&&(Q=le)};return ee.forEach(le=>ae(le)),Q||ie.forEach(le=>ae(le)),Q}(this.style,this.transform.zoom);O&&function(V,q,Q){for(let J=0;J<Q.length;J++)np(V,q,Q[J])}(this,O,O.getVisibleCoordinates())}this.options.showPadding&&function(O){let V=O.transform.padding;Jl(O,O.transform.height-(V.top||0),3,Oh),Jl(O,V.bottom||0,3,Bh),jh(O,V.left||0,3,rp),jh(O,O.transform.width-(V.right||0),3,Jo);let q=O.transform.centerPoint;(function(Q,J,ee,ie){Za(Q,J-1,ee-10,2,20,ie),Za(Q,J-10,ee-1,20,2,ie)})(O,q.x,O.transform.height-q.y,Ua)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;let s=this.terrainFacilitator.matrix,d=this.transform.modelViewProjectionMatrix,p=this.terrainFacilitator.dirty;p||(p=e?!n.bV(s,d):!n.bW(s,d)),p||(p=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),p&&(n.bX(s,d),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(g,v){let T=g.context,M=T.gl,P=g.transform,D=Jt.unblended,F=new Rt(M.LEQUAL,Rt.ReadWrite,[0,1]),O=v.sourceCache.getRenderableTiles(),V=g.useProgram("terrainDepth");T.bindFramebuffer.set(v.getFramebuffer("depth").framebuffer),T.viewport.set([0,0,g.width/devicePixelRatio,g.height/devicePixelRatio]),T.clear({color:n.b4.transparent,depth:1});for(let q of O){let Q=v.getTerrainMesh(q.tileID),J=v.getTerrainData(q.tileID),ee=P.getProjectionData({overscaledTileID:q.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),ie={u_ele_delta:v.getMeshFrameDelta(P.zoom)};V.draw(T,M.TRIANGLES,F,Bt.disabled,D,Ot.backCCW,ie,J,ee,"terrain",Q.vertexBuffer,Q.indexBuffer,Q.segments)}T.bindFramebuffer.set(null),T.viewport.set([0,0,g.width,g.height])}(this,this.style.map.terrain),function(g,v){let T=g.context,M=T.gl,P=g.transform,D=Jt.unblended,F=new Rt(M.LEQUAL,Rt.ReadWrite,[0,1]),O=v.getCoordsTexture(),V=v.sourceCache.getRenderableTiles(),q=g.useProgram("terrainCoords");T.bindFramebuffer.set(v.getFramebuffer("coords").framebuffer),T.viewport.set([0,0,g.width/devicePixelRatio,g.height/devicePixelRatio]),T.clear({color:n.b4.transparent,depth:1}),v.coordsIndex=[];for(let Q of V){let J=v.getTerrainMesh(Q.tileID),ee=v.getTerrainData(Q.tileID);T.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,O.texture);let ie={u_terrain_coords_id:(255-v.coordsIndex.length)/255,u_texture:0,u_ele_delta:v.getMeshFrameDelta(P.zoom)},ae=P.getProjectionData({overscaledTileID:Q.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});q.draw(T,M.TRIANGLES,F,Bt.disabled,D,Ot.backCCW,ie,ee,ae,"terrain",J.vertexBuffer,J.indexBuffer,J.segments),v.coordsIndex.push(Q.tileID.key)}T.bindFramebuffer.set(null),T.viewport.set([0,0,g.width,g.height])}(this,this.style.map.terrain))}renderLayer(e,s,d,p,g){d.isHidden(this.transform.zoom)||(d.type==="background"||d.type==="custom"||(p||[]).length)&&(this.id=d.id,n.bY(d)?function(v,T,M,P,D,F){if(v.renderPass!=="translucent")return;let{isRenderingToTexture:O}=F,V=Bt.disabled,q=v.colorModeForRenderPass();(M._unevaluatedLayout.hasValue("text-variable-anchor")||M._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(Q,J,ee,ie,ae,le,ce,fe,ue){let we=J.transform,Ce=J.style.map.terrain,ze=ae==="map",Fe=le==="map";for(let Ae of Q){let Ye=ie.getTile(Ae),$e=Ye.getBucket(ee);if(!$e||!$e.text||!$e.text.segments.get().length)continue;let Oe=n.ah($e.textSizeData,we.zoom),st=n.at(Ye,1,J.transform.zoom),Ct=Te(ze,J.transform,st),Vt=ee.layout.get("icon-text-fit")!=="none"&&$e.hasIconData();{let ui=Math.pow(2,we.zoom-Ye.tileID.overscaledZ),Ht=Ce?(Qt,ni)=>Ce.getElevation(Ae,Qt,ni):null;ym($e,ze,Fe,ue,we,Ct,ui,Oe,Vt,n.au(we,Ye,ce,fe),Ae.toUnwrapped(),Ht)}}}(P,v,M,T,M.layout.get("text-rotation-alignment"),M.layout.get("text-pitch-alignment"),M.paint.get("text-translate"),M.paint.get("text-translate-anchor"),D),M.paint.get("icon-opacity").constantOr(1)!==0&&ip(v,T,M,P,!1,M.paint.get("icon-translate"),M.paint.get("icon-translate-anchor"),M.layout.get("icon-rotation-alignment"),M.layout.get("icon-pitch-alignment"),M.layout.get("icon-keep-upright"),V,q,O),M.paint.get("text-opacity").constantOr(1)!==0&&ip(v,T,M,P,!0,M.paint.get("text-translate"),M.paint.get("text-translate-anchor"),M.layout.get("text-rotation-alignment"),M.layout.get("text-pitch-alignment"),M.layout.get("text-keep-upright"),V,q,O),T.map.showCollisionBoxes&&(Ph(v,T,M,P,!0),Ph(v,T,M,P,!1))}(e,s,d,p,this.style.placement.variableOffsets,g):n.bZ(d)?function(v,T,M,P,D){if(v.renderPass!=="translucent")return;let{isRenderingToTexture:F}=D,O=M.paint.get("circle-opacity"),V=M.paint.get("circle-stroke-width"),q=M.paint.get("circle-stroke-opacity"),Q=!M.layout.get("circle-sort-key").isConstant();if(O.constantOr(1)===0&&(V.constantOr(1)===0||q.constantOr(1)===0))return;let J=v.context,ee=J.gl,ie=v.transform,ae=v.getDepthModeForSublayer(0,Rt.ReadOnly),le=Bt.disabled,ce=v.colorModeForRenderPass(),fe=[],ue=ie.getCircleRadiusCorrection();for(let we=0;we<P.length;we++){let Ce=P[we],ze=T.getTile(Ce),Fe=ze.getBucket(M);if(!Fe)continue;let Ae=M.paint.get("circle-translate"),Ye=M.paint.get("circle-translate-anchor"),$e=n.au(ie,ze,Ae,Ye),Oe=Fe.programConfigurations.get(M.id),st=v.useProgram("circle",Oe),Ct=Fe.layoutVertexBuffer,Vt=Fe.indexBuffer,ui=v.style.map.terrain&&v.style.map.terrain.getTerrainData(Ce),Ht={programConfiguration:Oe,program:st,layoutVertexBuffer:Ct,indexBuffer:Vt,uniformValues:Vd(v,ze,M,$e,ue),terrainData:ui,projectionData:ie.getProjectionData({overscaledTileID:Ce,applyGlobeMatrix:!F,applyTerrainMatrix:!0})};if(Q){let Qt=Fe.segments.get();for(let ni of Qt)fe.push({segments:new n.aD([ni]),sortKey:ni.sortKey,state:Ht})}else fe.push({segments:Fe.segments,sortKey:0,state:Ht})}Q&&fe.sort((we,Ce)=>we.sortKey-Ce.sortKey);for(let we of fe){let{programConfiguration:Ce,program:ze,layoutVertexBuffer:Fe,indexBuffer:Ae,uniformValues:Ye,terrainData:$e,projectionData:Oe}=we.state;ze.draw(J,ee.TRIANGLES,ae,le,ce,Ot.backCCW,Ye,$e,Oe,M.id,Fe,Ae,we.segments,M.paint,v.transform.zoom,Ce)}}(e,s,d,p,g):n.b_(d)?function(v,T,M,P,D){if(M.paint.get("heatmap-opacity")===0)return;let F=v.context,{isRenderingToTexture:O,isRenderingGlobe:V}=D;if(v.style.map.terrain){for(let q of P){let Q=T.getTile(q);T.hasRenderableParent(q)||(v.renderPass==="offscreen"?Hl(v,Q,M,q,V):v.renderPass==="translucent"&&kh(v,M,q,O,V))}F.viewport.set([0,0,v.width,v.height])}else v.renderPass==="offscreen"?function(q,Q,J,ee){let ie=q.context,ae=ie.gl,le=q.transform,ce=Bt.disabled,fe=new Jt([ae.ONE,ae.ONE],n.b4.transparent,[!0,!0,!0,!0]);(function(ue,we,Ce){let ze=ue.gl;ue.activeTexture.set(ze.TEXTURE1),ue.viewport.set([0,0,we.width/4,we.height/4]);let Fe=Ce.heatmapFbos.get(n.bP);Fe?(ze.bindTexture(ze.TEXTURE_2D,Fe.colorAttachment.get()),ue.bindFramebuffer.set(Fe.framebuffer)):(Fe=Dh(ue,we.width/4,we.height/4),Ce.heatmapFbos.set(n.bP,Fe))})(ie,q,J),ie.clear({color:n.b4.transparent});for(let ue=0;ue<ee.length;ue++){let we=ee[ue];if(Q.hasRenderableParent(we))continue;let Ce=Q.getTile(we),ze=Ce.getBucket(J);if(!ze)continue;let Fe=ze.programConfigurations.get(J.id),Ae=q.useProgram("heatmap",Fe),Ye=le.getProjectionData({overscaledTileID:we,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),$e=le.getCircleRadiusCorrection();Ae.draw(ie,ae.TRIANGLES,Rt.disabled,ce,fe,Ot.backCCW,js(Ce,le.zoom,J.paint.get("heatmap-intensity"),$e),null,Ye,J.id,ze.layoutVertexBuffer,ze.indexBuffer,ze.segments,J.paint,le.zoom,Fe)}ie.viewport.set([0,0,q.width,q.height])}(v,T,M,P):v.renderPass==="translucent"&&function(q,Q){let J=q.context,ee=J.gl;J.setColorMode(q.colorModeForRenderPass());let ie=Q.heatmapFbos.get(n.bP);ie&&(J.activeTexture.set(ee.TEXTURE0),ee.bindTexture(ee.TEXTURE_2D,ie.colorAttachment.get()),J.activeTexture.set(ee.TEXTURE1),Fh(J,Q).bind(ee.LINEAR,ee.CLAMP_TO_EDGE),q.useProgram("heatmapTexture").draw(J,ee.TRIANGLES,Rt.disabled,Bt.disabled,q.colorModeForRenderPass(),Ot.disabled,ph(q,Q,0,1),null,null,Q.id,q.viewportBuffer,q.quadTriangleIndexBuffer,q.viewportSegments,Q.paint,q.transform.zoom))}(v,M)}(e,s,d,p,g):n.b$(d)?function(v,T,M,P,D){if(v.renderPass!=="translucent")return;let{isRenderingToTexture:F}=D,O=M.paint.get("line-opacity"),V=M.paint.get("line-width");if(O.constantOr(1)===0||V.constantOr(1)===0)return;let q=v.getDepthModeForSublayer(0,Rt.ReadOnly),Q=v.colorModeForRenderPass(),J=M.paint.get("line-dasharray"),ee=M.paint.get("line-pattern"),ie=ee.constantOr(1),ae=M.paint.get("line-gradient"),le=M.getCrossfadeParameters(),ce=ie?"linePattern":J?"lineSDF":ae?"lineGradient":"line",fe=v.context,ue=fe.gl,we=v.transform,Ce=!0;for(let ze of P){let Fe=T.getTile(ze);if(ie&&!Fe.patternsLoaded())continue;let Ae=Fe.getBucket(M);if(!Ae)continue;let Ye=Ae.programConfigurations.get(M.id),$e=v.context.program.get(),Oe=v.useProgram(ce,Ye),st=Ce||Oe.program!==$e,Ct=v.style.map.terrain&&v.style.map.terrain.getTerrainData(ze),Vt=ee.constantOr(null);if(Vt&&Fe.imageAtlas){let Xt=Fe.imageAtlas,ei=Xt.patternPositions[Vt.to.toString()],Gi=Xt.patternPositions[Vt.from.toString()];ei&&Gi&&Ye.setConstantPatternPositions(ei,Gi)}let ui=we.getProjectionData({overscaledTileID:ze,applyGlobeMatrix:!F,applyTerrainMatrix:!0}),Ht=we.getPixelScale(),Qt=ie?hm(v,Fe,M,Ht,le):J?Wd(v,Fe,M,Ht,J,le):ae?cm(v,Fe,M,Ht,Ae.lineClipsArray.length):$o(v,Fe,M,Ht);if(ie)fe.activeTexture.set(ue.TEXTURE0),Fe.imageAtlasTexture.bind(ue.LINEAR,ue.CLAMP_TO_EDGE),Ye.updatePaintBuffers(le);else if(J&&(st||v.lineAtlas.dirty))fe.activeTexture.set(ue.TEXTURE0),v.lineAtlas.bind(fe);else if(ae){let Xt=Ae.gradients[M.id],ei=Xt.texture;if(M.gradientVersion!==Xt.version){let Gi=256;if(M.stepInterpolant){let Mi=T.getSource().maxzoom,Hi=ze.canonical.z===Mi?Math.ceil(1<<v.transform.maxZoom-ze.canonical.z):1;Gi=n.ab(n.bQ(Ae.maxLineLength/n.X*1024*Hi),256,fe.maxTextureSize)}Xt.gradient=n.bR({expression:M.gradientExpression(),evaluationKey:"lineProgress",resolution:Gi,image:Xt.gradient||void 0,clips:Ae.lineClipsArray}),Xt.texture?Xt.texture.update(Xt.gradient):Xt.texture=new Re(fe,Xt.gradient,ue.RGBA),Xt.version=M.gradientVersion,ei=Xt.texture}fe.activeTexture.set(ue.TEXTURE0),ei.bind(M.stepInterpolant?ue.NEAREST:ue.LINEAR,ue.CLAMP_TO_EDGE)}let ni;if(F){let[Xt]=v.getStencilConfigForOverlapAndUpdateStencilID(P);ni=Xt[ze.overscaledZ]}else ni=v.stencilModeForClipping(ze);Oe.draw(fe,ue.TRIANGLES,q,ni,Q,Ot.disabled,Qt,Ct,ui,M.id,Ae.layoutVertexBuffer,Ae.indexBuffer,Ae.segments,M.paint,v.transform.zoom,Ye,Ae.layoutVertexBuffer2),Ce=!1}}(e,s,d,p,g):n.c0(d)?function(v,T,M,P,D){let F=M.paint.get("fill-color"),O=M.paint.get("fill-opacity");if(O.constantOr(1)===0)return;let{isRenderingToTexture:V}=D,q=v.colorModeForRenderPass(),Q=M.paint.get("fill-pattern"),J=v.opaquePassEnabledForLayer()&&!Q.constantOr(1)&&F.constantOr(n.b4.transparent).a===1&&O.constantOr(0)===1?"opaque":"translucent";if(v.renderPass===J){let ee=v.getDepthModeForSublayer(1,v.renderPass==="opaque"?Rt.ReadWrite:Rt.ReadOnly);Yl(v,T,M,P,ee,q,!1,V)}if(v.renderPass==="translucent"&&M.paint.get("fill-antialias")){let ee=v.getDepthModeForSublayer(M.getPaintProperty("fill-outline-color")?2:0,Rt.ReadOnly);Yl(v,T,M,P,ee,q,!0,V)}}(e,s,d,p,g):n.c1(d)?function(v,T,M,P,D){let F=M.paint.get("fill-extrusion-opacity");if(F===0)return;let{isRenderingToTexture:O}=D;if(v.renderPass==="translucent"){let V=new Rt(v.context.gl.LEQUAL,Rt.ReadWrite,v.depthRangeFor3D);if(F!==1||M.paint.get("fill-extrusion-pattern").constantOr(1))zh(v,T,M,P,V,Bt.disabled,Jt.disabled,O),zh(v,T,M,P,V,v.stencilModeFor3D(),v.colorModeForRenderPass(),O);else{let q=v.colorModeForRenderPass();zh(v,T,M,P,V,Bt.disabled,q,O)}}}(e,s,d,p,g):n.c2(d)?function(v,T,M,P,D){if(v.renderPass!=="offscreen"&&v.renderPass!=="translucent")return;let{isRenderingToTexture:F}=D,O=v.context,V=v.style.projection.useSubdivision,q=v.getDepthModeForSublayer(0,Rt.ReadOnly),Q=v.colorModeForRenderPass();if(v.renderPass==="offscreen")(function(J,ee,ie,ae,le,ce,fe){let ue=J.context,we=ue.gl;for(let Ce of ie){let ze=ee.getTile(Ce),Fe=ze.dem;if(!Fe||!Fe.data||!ze.needsHillshadePrepare)continue;let Ae=Fe.dim,Ye=Fe.stride,$e=Fe.getPixels();if(ue.activeTexture.set(we.TEXTURE1),ue.pixelStoreUnpackPremultiplyAlpha.set(!1),ze.demTexture=ze.demTexture||J.getTileTexture(Ye),ze.demTexture){let st=ze.demTexture;st.update($e,{premultiply:!1}),st.bind(we.NEAREST,we.CLAMP_TO_EDGE)}else ze.demTexture=new Re(ue,$e,we.RGBA,{premultiply:!1}),ze.demTexture.bind(we.NEAREST,we.CLAMP_TO_EDGE);ue.activeTexture.set(we.TEXTURE0);let Oe=ze.fbo;if(!Oe){let st=new Re(ue,{width:Ae,height:Ae,data:null},we.RGBA);st.bind(we.LINEAR,we.CLAMP_TO_EDGE),Oe=ze.fbo=ue.createFramebuffer(Ae,Ae,!0,!1),Oe.colorAttachment.set(st.texture)}ue.bindFramebuffer.set(Oe.framebuffer),ue.viewport.set([0,0,Ae,Ae]),J.useProgram("hillshadePrepare").draw(ue,we.TRIANGLES,le,ce,fe,Ot.disabled,Oa(ze.tileID,Fe),null,null,ae.id,J.rasterBoundsBuffer,J.quadTriangleIndexBuffer,J.rasterBoundsSegments),ze.needsHillshadePrepare=!1}})(v,T,P,M,q,Bt.disabled,Q),O.viewport.set([0,0,v.width,v.height]);else if(v.renderPass==="translucent")if(V){let[J,ee,ie]=v.stencilConfigForOverlapTwoPass(P);Kl(v,T,M,ie,J,q,Q,!1,F),Kl(v,T,M,ie,ee,q,Q,!0,F)}else{let[J,ee]=v.getStencilConfigForOverlapAndUpdateStencilID(P);Kl(v,T,M,ee,J,q,Q,!1,F)}}(e,s,d,p,g):n.c3(d)?function(v,T,M,P,D){if(v.renderPass!=="translucent"||M.paint.get("raster-opacity")===0||!P.length)return;let{isRenderingToTexture:F}=D,O=T.getSource(),V=v.style.projection.useSubdivision;if(O instanceof Li)ns(v,T,M,P,null,!1,!1,O.tileCoords,O.flippedWindingOrder,F);else if(V){let[q,Q,J]=v.stencilConfigForOverlapTwoPass(P);ns(v,T,M,J,q,!1,!0,fi,!1,F),ns(v,T,M,J,Q,!0,!0,fi,!1,F)}else{let[q,Q]=v.getStencilConfigForOverlapAndUpdateStencilID(P);ns(v,T,M,Q,q,!1,!0,fi,!1,F)}}(e,s,d,p,g):n.c4(d)?function(v,T,M,P,D){let F=M.paint.get("background-color"),O=M.paint.get("background-opacity");if(O===0)return;let{isRenderingToTexture:V}=D,q=v.context,Q=q.gl,J=v.style.projection,ee=v.transform,ie=ee.tileSize,ae=M.paint.get("background-pattern");if(v.isPatternMissing(ae))return;let le=!ae&&F.a===1&&O===1&&v.opaquePassEnabledForLayer()?"opaque":"translucent";if(v.renderPass!==le)return;let ce=Bt.disabled,fe=v.getDepthModeForSublayer(0,le==="opaque"?Rt.ReadWrite:Rt.ReadOnly),ue=v.colorModeForRenderPass(),we=v.useProgram(ae?"backgroundPattern":"background"),Ce=P||K(ee,{tileSize:ie,terrain:v.style.map.terrain});ae&&(q.activeTexture.set(Q.TEXTURE0),v.imageManager.bind(v.context));let ze=M.getCrossfadeParameters();for(let Fe of Ce){let Ae=ee.getProjectionData({overscaledTileID:Fe,applyGlobeMatrix:!V,applyTerrainMatrix:!0}),Ye=ae?xh(O,v,ae,{tileID:Fe,tileSize:ie},ze):yh(O,F),$e=v.style.map.terrain&&v.style.map.terrain.getTerrainData(Fe),Oe=J.getMeshFromTileID(q,Fe.canonical,!1,!0,"raster");we.draw(q,Q.TRIANGLES,fe,ce,ue,Ot.backCCW,Ye,$e,Ae,M.id,Oe.vertexBuffer,Oe.indexBuffer,Oe.segments)}}(e,0,d,p,g):n.c5(d)&&function(v,T,M,P){let{isRenderingGlobe:D}=P,F=v.context,O=M.implementation,V=v.style.projection,q=v.transform,Q=q.getProjectionDataForCustomLayer(D),J={farZ:q.farZ,nearZ:q.nearZ,fov:q.fov*Math.PI/180,modelViewProjectionMatrix:q.modelViewProjectionMatrix,projectionMatrix:q.projectionMatrix,shaderData:{variantName:V.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
724
724
  uniform mat4 u_projection_matrix;
725
- ${V.shaderPreludeCode.vertexSource}`,define:V.shaderDefine},defaultProjectionData:Q},ee=O.renderingMode?O.renderingMode:"2d";if(v.renderPass==="offscreen"){let ie=O.prerender;ie&&(v.setCustomLayerDefaults(),F.setColorMode(v.colorModeForRenderPass()),ie.call(O,F.gl,J),F.setDirty(),v.setBaseState())}else if(v.renderPass==="translucent"){v.setCustomLayerDefaults(),F.setColorMode(v.colorModeForRenderPass()),F.setStencilMode(Bt.disabled);let ie=ee==="3d"?v.getDepthModeFor3D():v.getDepthModeForSublayer(0,Rt.ReadOnly);F.setDepthMode(ie),O.render(F.gl,J),F.setDirty(),v.setBaseState(),F.bindFramebuffer.set(null)}}(e,0,d,g))}saveTileTexture(e){let s=this._tileTextures[e.size[0]];s?s.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let s=this._tileTextures[e];return s&&s.length>0?s.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let s=this.imageManager.getPattern(e.from.toString()),d=this.imageManager.getPattern(e.to.toString());return!s||!d}useProgram(e,s,d=!1){this.cache=this.cache||{};let p=!!this.style.map.terrain,g=this.style.projection,v=e+(s?s.cacheKey:"")+`/${d?Dl:g.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(p?"/terrain":"");return this.cache[v]||(this.cache[v]=new am(this.context,es[e],s,bh[e],this._showOverdrawInspector,p,d?es.projectionMercator:g.shaderPreludeCode,d?kl:g.shaderDefine)),this.cache[v]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Re(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:s}=this.context.gl;return this.width!==e||this.height!==s}}function Vh(m,e){let s,d=!1,p=null,g=null,v=()=>{p=null,d&&(m.apply(g,s),p=setTimeout(v,e),d=!1)};return(...T)=>(d=!0,g=this,s=T,p||v(),p)}class Uh{constructor(e){this._getCurrentHash=()=>{let s=window.location.hash.replace("#","");if(this._hashName){let d;return s.split("&").map(p=>p.split("=")).forEach(p=>{p[0]===this._hashName&&(d=p)}),(d&&d[1]||"").split("/")}return s.split("/")},this._onHashChange=()=>{let s=this._getCurrentHash();if(!this._isValidHash(s))return!1;let d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(s[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+s[2],+s[1]],zoom:+s[0],bearing:d,pitch:+(s[4]||0)}),!0},this._updateHashUnthrottled=()=>{let s=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,s)},this._removeHash=()=>{let s=this._getCurrentHash();if(s.length===0)return;let d=s.join("/"),p=d;p.split("&").length>0&&(p=p.split("&")[0]),this._hashName&&(p=`${this._hashName}=${d}`);let g=window.location.hash.replace(p,"");g.startsWith("#&")?g=g.slice(0,1)+g.slice(2):g==="#"&&(g="");let v=window.location.href.replace(/(#.+)?$/,g);v=v.replace("&&","&"),window.history.replaceState(window.history.state,null,v)},this._updateHash=Vh(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){let s=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,p=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),g=Math.pow(10,p),v=Math.round(s.lng*g)/g,T=Math.round(s.lat*g)/g,M=this._map.getBearing(),P=this._map.getPitch(),D="";if(D+=e?`/${v}/${T}/${d}`:`${d}/${T}/${v}`,(M||P)&&(D+="/"+Math.round(10*M)/10),P&&(D+=`/${Math.round(P)}`),this._hashName){let F=this._hashName,O=!1,V=window.location.hash.slice(1).split("&").map(q=>{let Q=q.split("=")[0];return Q===F?(O=!0,`${Q}=${D}`):q}).filter(q=>q);return O||V.push(`${F}=${D}`),`#${V.join("&")}`}return`#${D}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new n.N(+e[2],+e[1])}catch{return!1}let s=+e[0],d=+(e[3]||0),p=+(e[4]||0);return s>=this._map.getMinZoom()&&s<=this._map.getMaxZoom()&&d>=0&&d<=180&&p>=this._map.getMinPitch()&&p<=this._map.getMaxPitch()}}let Qo={linearity:.3,easing:n.c6(0,0,.3,1)},sp=n.e({deceleration:2500,maxSpeed:1400},Qo),op=n.e({deceleration:20,maxSpeed:1400},Qo),ap=n.e({deceleration:1e3,maxSpeed:360},Qo),lp=n.e({deceleration:1e3,maxSpeed:90},Qo),qa=n.e({deceleration:1e3,maxSpeed:360},Qo);class cp{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:E.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,s=E.now();for(;e.length>0&&s-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let s={zoom:0,bearing:0,pitch:0,roll:0,pan:new n.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:g}of this._inertiaBuffer)s.zoom+=g.zoomDelta||0,s.bearing+=g.bearingDelta||0,s.pitch+=g.pitchDelta||0,s.roll+=g.rollDelta||0,g.panDelta&&s.pan._add(g.panDelta),g.around&&(s.around=g.around),g.pinchAround&&(s.pinchAround=g.pinchAround);let d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,p={};if(s.pan.mag()){let g=Ur(s.pan.mag(),d,n.e({},sp,e||{})),v=s.pan.mult(g.amount/s.pan.mag()),T=this._map.cameraHelper.handlePanInertia(v,this._map.transform);p.center=T.easingCenter,p.offset=T.easingOffset,Mr(p,g)}if(s.zoom){let g=Ur(s.zoom,d,op);p.zoom=this._map.transform.zoom+g.amount,Mr(p,g)}if(s.bearing){let g=Ur(s.bearing,d,ap);p.bearing=this._map.transform.bearing+n.ab(g.amount,-179,179),Mr(p,g)}if(s.pitch){let g=Ur(s.pitch,d,lp);p.pitch=this._map.transform.pitch+g.amount,Mr(p,g)}if(s.roll){let g=Ur(s.roll,d,qa);p.roll=this._map.transform.roll+n.ab(g.amount,-179,179),Mr(p,g)}if(p.zoom||p.bearing){let g=s.pinchAround===void 0?s.around:s.pinchAround;p.around=g?this._map.unproject(g):this._map.getCenter()}return this.clear(),n.e(p,{noMoveStart:!0})}}function Mr(m,e){(!m.duration||m.duration<e.duration)&&(m.duration=e.duration,m.easing=e.easing)}function Ur(m,e,s){let{maxSpeed:d,linearity:p,deceleration:g}=s,v=n.ab(m*p/(e/1e3),-d,d),T=Math.abs(v)/(g*p);return{easing:s.easing,duration:1e3*T,amount:v*(T/2)}}class Zr extends n.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,s,d,p={}){let g=A.mousePos(s.getCanvas(),d),v=s.unproject(g);super(e,n.e({point:g,lngLat:v,originalEvent:d},p)),this._defaultPrevented=!1,this.target=s}}class qr extends n.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,s,d){let p=e==="touchend"?d.changedTouches:d.touches,g=A.touchPos(s.getCanvasContainer(),p),v=g.map(M=>s.unproject(M)),T=g.reduce((M,P,D,F)=>M.add(P.div(F.length)),new n.P(0,0));super(e,{points:g,point:T,lngLats:v,lngLat:s.unproject(T),originalEvent:d}),this._defaultPrevented=!1}}class _o extends n.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,s,d){super(e,{originalEvent:d}),this._defaultPrevented=!1}}class xm{constructor(e,s){this._map=e,this._clickTolerance=s.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new _o(e.type,this._map,e))}mousedown(e,s){return this._mousedownPos=s,this._firePreventable(new Zr(e.type,this._map,e))}mouseup(e){this._map.fire(new Zr(e.type,this._map,e))}click(e,s){this._mousedownPos&&this._mousedownPos.dist(s)>=this._clickTolerance||this._map.fire(new Zr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Zr(e.type,this._map,e))}mouseover(e){this._map.fire(new Zr(e.type,this._map,e))}mouseout(e){this._map.fire(new Zr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new qr(e.type,this._map,e))}touchmove(e){this._map.fire(new qr(e.type,this._map,e))}touchend(e){this._map.fire(new qr(e.type,this._map,e))}touchcancel(e){this._map.fire(new qr(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class vm{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Zr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Zr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Zr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Wa{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(n.P.convert(e),this._map.terrain)}}class hp{constructor(e,s){this._map=e,this._tr=new Wa(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=s.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,s){this.isEnabled()&&e.shiftKey&&e.button===0&&(A.disableDrag(),this._startPos=this._lastPos=s,this._active=!0)}mousemoveWindow(e,s){if(!this._active)return;let d=s;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)<this._clickTolerance)return;let p=this._startPos;this._lastPos=d,this._box||(this._box=A.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let g=Math.min(p.x,d.x),v=Math.max(p.x,d.x),T=Math.min(p.y,d.y),M=Math.max(p.y,d.y);A.setTransform(this._box,`translate(${g}px,${T}px)`),this._box.style.width=v-g+"px",this._box.style.height=M-T+"px"}mouseupWindow(e,s){if(!this._active||e.button!==0)return;let d=this._startPos,p=s;if(this.reset(),A.suppressClick(),d.x!==p.x||d.y!==p.y)return this._map.fire(new n.k("boxzoomend",{originalEvent:e})),{cameraAnimation:g=>g.fitScreenCoordinates(d,p,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(A.remove(this._box),this._box=null),A.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,s){return this._map.fire(new n.k(e,{originalEvent:s}))}}function Ql(m,e){if(m.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${m.length}, points ${e.length}`);let s={};for(let d=0;d<m.length;d++)s[m[d].identifier]=e[d];return s}class $a{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,s,d){(this.centroid||d.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),d.length===this.numTouches&&(this.centroid=function(p){let g=new n.P(0,0);for(let v of p)g._add(v);return g.div(p.length)}(s),this.touches=Ql(d,s)))}touchmove(e,s,d){if(this.aborted||!this.centroid)return;let p=Ql(d,s);for(let g in this.touches){let v=p[g];(!v||v.dist(this.touches[g])>30)&&(this.aborted=!0)}}touchend(e,s,d){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){let p=!this.aborted&&this.centroid;if(this.reset(),p)return p}}}class Nn{constructor(e){this.singleTap=new $a(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,s,d){this.singleTap.touchstart(e,s,d)}touchmove(e,s,d){this.singleTap.touchmove(e,s,d)}touchend(e,s,d){let p=this.singleTap.touchend(e,s,d);if(p){let g=e.timeStamp-this.lastTime<500,v=!this.lastTap||this.lastTap.dist(p)<30;if(g&&v||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=p,this.count===this.numTaps)return this.reset(),p}}}class it{constructor(e){this._tr=new Wa(e),this._zoomIn=new Nn({numTouches:1,numTaps:2}),this._zoomOut=new Nn({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,s,d){this._zoomIn.touchstart(e,s,d),this._zoomOut.touchstart(e,s,d)}touchmove(e,s,d){this._zoomIn.touchmove(e,s,d),this._zoomOut.touchmove(e,s,d)}touchend(e,s,d){let p=this._zoomIn.touchend(e,s,d),g=this._zoomOut.touchend(e,s,d),v=this._tr;return p?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:v.zoom+1,around:v.unproject(p)},{originalEvent:e})}):g?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:v.zoom-1,around:v.unproject(g)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ea{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let s=this._moveFunction(...e);if(s.bearingDelta||s.pitchDelta||s.rollDelta||s.around||s.panDelta)return this._active=!0,s}dragStart(e,s){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(s)?s[0]:s,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,s){if(!this.isEnabled())return;let d=this._lastPoint;if(!d)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);let p=Array.isArray(s)?s[0]:s;return!this._moved&&p.dist(d)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=p,this._move(d,p))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&A.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}let Zh={0:1,2:2};class ta{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){let s=A.mouseButton(e);this._eventButton=s}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(s,d){let p=Zh[d];return s.buttons===void 0||(s.buttons&p)!==p}(e,this._eventButton)}isValidEndEvent(e){return A.mouseButton(e)===this._eventButton}}class Xa{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class Ha{constructor(e=new ta({checkCorrectEvent:()=>!0}),s=new Xa){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=s}_executeRelevantHandler(e,s,d){return e instanceof MouseEvent?s(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?d(e):void 0}startMove(e){this._executeRelevantHandler(e,s=>this.mouseMoveStateManager.startMove(s),s=>this.oneFingerTouchMoveStateManager.startMove(s))}endMove(e){this._executeRelevantHandler(e,s=>this.mouseMoveStateManager.endMove(s),s=>this.oneFingerTouchMoveStateManager.endMove(s))}isValidStartEvent(e){return this._executeRelevantHandler(e,s=>this.mouseMoveStateManager.isValidStartEvent(s),s=>this.oneFingerTouchMoveStateManager.isValidStartEvent(s))}isValidMoveEvent(e){return this._executeRelevantHandler(e,s=>this.mouseMoveStateManager.isValidMoveEvent(s),s=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(s))}isValidEndEvent(e){return this._executeRelevantHandler(e,s=>this.mouseMoveStateManager.isValidEndEvent(s),s=>this.oneFingerTouchMoveStateManager.isValidEndEvent(s))}}let Ya=m=>{m.mousedown=m.dragStart,m.mousemoveWindow=m.dragMove,m.mouseup=m.dragEnd,m.contextmenu=e=>{e.preventDefault()}};class zt{constructor(e,s){this._clickTolerance=e.clickTolerance||1,this._map=s,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new n.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,s,d){return this._calculateTransform(e,s,d)}touchmove(e,s,d){if(this._active){if(!this._shouldBePrevented(d.length))return e.preventDefault(),this._calculateTransform(e,s,d);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,s,d){this._calculateTransform(e,s,d),this._active&&this._shouldBePrevented(d.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,s,d){d.length>0&&(this._active=!0);let p=Ql(d,s),g=new n.P(0,0),v=new n.P(0,0),T=0;for(let P in p){let D=p[P],F=this._touches[P];F&&(g._add(D),v._add(D.sub(F)),T++,p[P]=D)}if(this._touches=p,this._shouldBePrevented(T)||!v.mag())return;let M=v.div(T);return this._sum._add(M),this._sum.mag()<this._clickTolerance?void 0:{around:g.div(T),panDelta:M}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ka{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,s,d){this._firstTwoTouches||d.length<2||(this._firstTwoTouches=[d[0].identifier,d[1].identifier],this._start([s[0],s[1]]))}touchmove(e,s,d){if(!this._firstTwoTouches)return;e.preventDefault();let[p,g]=this._firstTwoTouches,v=ec(d,s,p),T=ec(d,s,g);if(!v||!T)return;let M=this._aroundCenter?null:v.add(T).div(2);return this._move([v,T],M,e)}touchend(e,s,d){if(!this._firstTwoTouches)return;let[p,g]=this._firstTwoTouches,v=ec(d,s,p),T=ec(d,s,g);v&&T||(this._active&&A.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function ec(m,e,s){for(let d=0;d<m.length;d++)if(m[d].identifier===s)return e[d]}function tc(m,e){return Math.log(m/e)/Math.LN2}class up extends Ka{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,s){let d=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(tc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:tc(this._distance,d),pinchAround:s}}}function dp(m,e){return 180*m.angleWith(e)/Math.PI}class qh extends Ka{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,s,d){let p=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:dp(this._vector,p),pinchAround:s}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let s=25/(Math.PI*this._minDiameter)*360,d=dp(e,this._startVector);return Math.abs(d)<s}}function Ja(m){return Math.abs(m.y)>Math.abs(m.x)}class Wh extends Ka{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,s,d){super.touchstart(e,s,d),this._currentTouchCount=d.length}_start(e){this._lastPoints=e,Ja(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,s,d){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let p=e[0].sub(this._lastPoints[0]),g=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(p,g,d.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(p.y+g.y)/2*-.5}):void 0}gestureBeginsVertically(e,s,d){if(this._valid!==void 0)return this._valid;let p=e.mag()>=2,g=s.mag()>=2;if(!p&&!g)return;if(!p||!g)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;let v=e.y>0==s.y>0;return Ja(e)&&Ja(s)&&v}}let bm={panStep:100,bearingStep:15,pitchStep:10};class $h{constructor(e){this._tr=new Wa(e);let s=bm;this._panStep=s.panStep,this._bearingStep=s.bearingStep,this._pitchStep=s.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let s=0,d=0,p=0,g=0,v=0;switch(e.keyCode){case 61:case 107:case 171:case 187:s=1;break;case 189:case 109:case 173:s=-1;break;case 37:e.shiftKey?d=-1:(e.preventDefault(),g=-1);break;case 39:e.shiftKey?d=1:(e.preventDefault(),g=1);break;case 38:e.shiftKey?p=1:(e.preventDefault(),v=-1);break;case 40:e.shiftKey?p=-1:(e.preventDefault(),v=1);break;default:return}return this._rotationDisabled&&(d=0,p=0),{cameraAnimation:T=>{let M=this._tr;T.easeTo({duration:300,easeId:"keyboardHandler",easing:wm,zoom:s?Math.round(M.zoom)+s*(e.shiftKey?2:1):M.zoom,bearing:M.bearing+d*this._bearingStep,pitch:M.pitch+p*this._pitchStep,offset:[-g*this._panStep,-v*this._panStep],center:M.center},{originalEvent:e})}}}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 wm(m){return m*(2-m)}let pp=4.000244140625;class ys{constructor(e,s){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=e,this._tr=new Wa(e),this._triggerRenderFrame=s,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let s=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,d=E.now(),p=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,s!==0&&s%pp==0?this._type="wheel":s!==0&&Math.abs(s)<4?this._type="trackpad":p>400?(this._type=null,this._lastValue=s,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(p*s)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,s+=this._lastValue)),e.shiftKey&&s&&(s/=4),this._type&&(this._lastWheelEvent=e,this._delta-=s,this._active||this._start(e)),e.preventDefault()}_start(e){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);let s=A.mousePos(this._map.getCanvas(),e),d=this._tr;this._aroundPoint=this._aroundCenter?d.transform.locationToScreenPoint(n.N.convert(d.center)):s,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){let T=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=T),typeof this._targetZoom=="number"&&(this._targetZoom+=T)}if(this._delta!==0){let T=this._type==="wheel"&&Math.abs(this._delta)>pp?this._wheelZoomRate:this._defaultZoomRate,M=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&M!==0&&(M=1/M);let P=typeof this._targetZoom!="number"?e.scale:n.aG(this._targetZoom);this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,n.a8(P*M))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let s=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,d=this._startZoom,p=this._easing,g,v=!1;if(this._type==="wheel"&&d&&p){let T=E.now()-this._lastWheelEventTime,M=Math.min((T+5)/200,1),P=p(M);g=n.y.number(d,s,P),M<1?this._frameId||(this._frameId=!0):v=!0}else g=s,v=!0;return this._active=!0,v&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=g,{noInertia:!0,needsRenderFrame:!v,zoomDelta:g-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let s=n.c8;if(this._prevEase){let d=this._prevEase,p=(E.now()-d.start)/d.duration,g=d.easing(p+.01)-d.easing(p),v=.27/Math.sqrt(g*g+1e-4)*.01,T=Math.sqrt(.0729-v*v);s=n.c6(v,T,.25,1)}return this._prevEase={start:E.now(),duration:e,easing:s},s}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ii{constructor(e,s){this._clickZoom=e,this._tapZoom=s}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 ic{constructor(e){this._tr=new Wa(e),this.reset()}reset(){this._active=!1}dblclick(e,s){return e.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(s)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Xh{constructor(){this._tap=new Nn({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,s,d){if(!this._swipePoint)if(this._tapTime){let p=s[0],g=e.timeStamp-this._tapTime<500,v=this._tapPoint.dist(p)<30;g&&v?d.length>0&&(this._swipePoint=p,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(e,s,d)}touchmove(e,s,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;let p=s[0],g=p.y-this._swipePoint.y;return this._swipePoint=p,e.preventDefault(),this._active=!0,{zoomDelta:g/128}}}else this._tap.touchmove(e,s,d)}touchend(e,s,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{let p=this._tap.touchend(e,s,d);p&&(this._tapTime=e.timeStamp,this._tapPoint=p)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Hh{constructor(e,s,d){this._el=e,this._mousePan=s,this._touchPan=d}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Yh{constructor(e,s,d,p){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=s,this._mousePitch=d,this._mouseRoll=p}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Kh{constructor(e,s,d,p){this._el=e,this._touchZoom=s,this._touchRotate=d,this._tapDragZoom=p,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class fp{constructor(e,s){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=s,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=A.create("div","maplibregl-cooperative-gesture-screen",e);let s=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(s=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let d=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),p=document.createElement("div");p.className="maplibregl-desktop-message",p.textContent=s,this._container.appendChild(p);let g=document.createElement("div");g.className="maplibregl-mobile-message",g.textContent=d,this._container.appendChild(g),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(A.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,s){this._enabled&&(this._map.fire(new n.k("cooperativegestureprevented",{gestureType:e,originalEvent:s})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}let hn=m=>m.zoom||m.drag||m.roll||m.pitch||m.rotate;class rc extends n.k{}function lt(m){return m.panDelta&&m.panDelta.mag()||m.zoomDelta||m.bearingDelta||m.pitchDelta||m.rollDelta}class _t{constructor(e,s){this.handleWindowEvent=p=>{this.handleEvent(p,`${p.type}Window`)},this.handleEvent=(p,g)=>{if(p.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let v=p.type==="renderFrame"?void 0:p,T={needsRenderFrame:!1},M={},P={},D=p.touches,F=D?this._getMapTouches(D):void 0,O=F?A.touchPos(this._map.getCanvas(),F):A.mousePos(this._map.getCanvas(),p);for(let{handlerName:Q,handler:J,allowed:ee}of this._handlers){if(!J.isEnabled())continue;let ie;this._blockedByActive(P,ee,Q)?J.reset():J[g||p.type]&&(ie=J[g||p.type](p,O,F),this.mergeHandlerResult(T,M,ie,Q,v),ie&&ie.needsRenderFrame&&this._triggerRenderFrame()),(ie||J.isActive())&&(P[Q]=J)}let V={};for(let Q in this._previousActiveHandlers)P[Q]||(V[Q]=v);this._previousActiveHandlers=P,(Object.keys(V).length||lt(T))&&(this._changes.push([T,M,V]),this._triggerRenderFrame()),(Object.keys(P).length||lt(T))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:q}=T;q&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],q(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new cp(e),this._bearingSnap=s.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(s);let d=this._el;this._listeners=[[d,"touchstart",{passive:!0}],[d,"touchmove",{passive:!1}],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1}],[d,"keyup",void 0],[d,"wheel",{passive:!1}],[d,"contextmenu",void 0],[window,"blur",void 0]];for(let[p,g,v]of this._listeners)A.addEventListener(p,g,p===document?this.handleWindowEvent:this.handleEvent,v)}destroy(){for(let[e,s,d]of this._listeners)A.removeEventListener(e,s,e===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(e){let s=this._map,d=s.getCanvasContainer();this._add("mapEvent",new xm(s,e));let p=s.boxZoom=new hp(s,e);this._add("boxZoom",p),e.interactive&&e.boxZoom&&p.enable();let g=s.cooperativeGestures=new fp(s,e.cooperativeGestures);this._add("cooperativeGestures",g),e.cooperativeGestures&&g.enable();let v=new it(s),T=new ic(s);s.doubleClickZoom=new ii(T,v),this._add("tapZoom",v),this._add("clickZoom",T),e.interactive&&e.doubleClickZoom&&s.doubleClickZoom.enable();let M=new Xh;this._add("tapDragZoom",M);let P=s.touchPitch=new Wh(s);this._add("touchPitch",P),e.interactive&&e.touchPitch&&s.touchPitch.enable(e.touchPitch);let D=()=>s.project(s.getCenter()),F=function({enable:le,clickTolerance:ce,aroundCenter:fe=!0,minPixelCenterThreshold:ue=100,rotateDegreesPerPixelMoved:we=.8},Ce){let ze=new ta({checkCorrectEvent:Fe=>A.mouseButton(Fe)===0&&Fe.ctrlKey||A.mouseButton(Fe)===2&&!Fe.ctrlKey});return new ea({clickTolerance:ce,move:(Fe,Ae)=>{let Ye=Ce();if(fe&&Math.abs(Ye.y-Fe.y)>ue)return{bearingDelta:n.c7(new n.P(Fe.x,Ae.y),Ae,Ye)};let $e=(Ae.x-Fe.x)*we;return fe&&Ae.y<Ye.y&&($e=-$e),{bearingDelta:$e}},moveStateManager:ze,enable:le,assignEvents:Ya})}(e,D),O=function({enable:le,clickTolerance:ce,pitchDegreesPerPixelMoved:fe=-.5}){let ue=new ta({checkCorrectEvent:we=>A.mouseButton(we)===0&&we.ctrlKey||A.mouseButton(we)===2});return new ea({clickTolerance:ce,move:(we,Ce)=>({pitchDelta:(Ce.y-we.y)*fe}),moveStateManager:ue,enable:le,assignEvents:Ya})}(e),V=function({enable:le,clickTolerance:ce,rollDegreesPerPixelMoved:fe=.3},ue){let we=new ta({checkCorrectEvent:Ce=>A.mouseButton(Ce)===2&&Ce.ctrlKey});return new ea({clickTolerance:ce,move:(Ce,ze)=>{let Fe=ue(),Ae=(ze.x-Ce.x)*fe;return ze.y<Fe.y&&(Ae=-Ae),{rollDelta:Ae}},moveStateManager:we,enable:le,assignEvents:Ya})}(e,D);s.dragRotate=new Yh(e,F,O,V),this._add("mouseRotate",F,["mousePitch"]),this._add("mousePitch",O,["mouseRotate","mouseRoll"]),this._add("mouseRoll",V,["mousePitch"]),e.interactive&&e.dragRotate&&s.dragRotate.enable();let q=function({enable:le,clickTolerance:ce}){let fe=new ta({checkCorrectEvent:ue=>A.mouseButton(ue)===0&&!ue.ctrlKey});return new ea({clickTolerance:ce,move:(ue,we)=>({around:we,panDelta:we.sub(ue)}),activateOnStart:!0,moveStateManager:fe,enable:le,assignEvents:Ya})}(e),Q=new zt(e,s);s.dragPan=new Hh(d,q,Q),this._add("mousePan",q),this._add("touchPan",Q,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&s.dragPan.enable(e.dragPan);let J=new qh,ee=new up;s.touchZoomRotate=new Kh(d,ee,J,M),this._add("touchRotate",J,["touchPan","touchZoom"]),this._add("touchZoom",ee,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&s.touchZoomRotate.enable(e.touchZoomRotate);let ie=s.scrollZoom=new ys(s,()=>this._triggerRenderFrame());this._add("scrollZoom",ie,["mousePan"]),e.interactive&&e.scrollZoom&&s.scrollZoom.enable(e.scrollZoom);let ae=s.keyboard=new $h(s);this._add("keyboard",ae),e.interactive&&e.keyboard&&s.keyboard.enable(),this._add("blockableMapEvent",new vm(s))}_add(e,s,d){this._handlers.push({handlerName:e,handler:s,allowed:d}),this._handlersById[e]=s}stop(e){if(!this._updatingCamera){for(let{handler:s}of this._handlers)s.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!hn(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,s,d){for(let p in e)if(p!==d&&(!s||s.indexOf(p)<0))return!0;return!1}_getMapTouches(e){let s=[];for(let d of e)this._el.contains(d.target)&&s.push(d);return s}mergeHandlerResult(e,s,d,p,g){if(!d)return;n.e(e,d);let v={handlerName:p,originalEvent:d.originalEvent||g};d.zoomDelta!==void 0&&(s.zoom=v),d.panDelta!==void 0&&(s.drag=v),d.rollDelta!==void 0&&(s.roll=v),d.pitchDelta!==void 0&&(s.pitch=v),d.bearingDelta!==void 0&&(s.rotate=v)}_applyChanges(){let e={},s={},d={};for(let[p,g,v]of this._changes)p.panDelta&&(e.panDelta=(e.panDelta||new n.P(0,0))._add(p.panDelta)),p.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+p.zoomDelta),p.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+p.bearingDelta),p.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+p.pitchDelta),p.rollDelta&&(e.rollDelta=(e.rollDelta||0)+p.rollDelta),p.around!==void 0&&(e.around=p.around),p.pinchAround!==void 0&&(e.pinchAround=p.pinchAround),p.noInertia&&(e.noInertia=p.noInertia),n.e(s,g),n.e(d,v);this._updateMapTransform(e,s,d),this._changes=[]}_updateMapTransform(e,s,d){let p=this._map,g=p._getTransformForUpdate(),v=p.terrain;if(!(lt(e)||v&&this._terrainMovement))return this._fireEvents(s,d,!0);p._stop(!0);let{panDelta:T,zoomDelta:M,bearingDelta:P,pitchDelta:D,rollDelta:F,around:O,pinchAround:V}=e;V!==void 0&&(O=V),O=O||p.transform.centerPoint,v&&!g.isPointOnMapSurface(O)&&(O=g.centerPoint);let q={panDelta:T,zoomDelta:M,rollDelta:F,pitchDelta:D,bearingDelta:P,around:O};this._map.cameraHelper.useGlobeControls&&!g.isPointOnMapSurface(O)&&(O=g.centerPoint);let Q=O.distSqr(g.centerPoint)<.01?g.center:g.screenPointToLocation(T?O.sub(T):O);v?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(q,g),this._terrainMovement||!s.drag&&!s.zoom?s.drag&&this._terrainMovement?g.setCenter(g.screenPointToLocation(g.centerPoint.sub(T))):this._map.cameraHelper.handleMapControlsPan(q,g,Q):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(q,g,Q))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(q,g),this._map.cameraHelper.handleMapControlsPan(q,g,Q)),p._applyUpdatedTransform(g),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(s,d,!0)}_fireEvents(e,s,d){let p=hn(this._eventsInProgress),g=hn(e),v={};for(let F in e){let{originalEvent:O}=e[F];this._eventsInProgress[F]||(v[`${F}start`]=O),this._eventsInProgress[F]=e[F]}!p&&g&&this._fireEvent("movestart",g.originalEvent);for(let F in v)this._fireEvent(F,v[F]);g&&this._fireEvent("move",g.originalEvent);for(let F in e){let{originalEvent:O}=e[F];this._fireEvent(F,O)}let T={},M;for(let F in this._eventsInProgress){let{handlerName:O,originalEvent:V}=this._eventsInProgress[F];this._handlersById[O].isActive()||(delete this._eventsInProgress[F],M=s[O]||V,T[`${F}end`]=M)}for(let F in T)this._fireEvent(F,T[F]);let P=hn(this._eventsInProgress),D=(p||g)&&!P;if(D&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let F=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&F.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(F)}if(d&&D){this._updatingCamera=!0;let F=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),O=V=>V!==0&&-this._bearingSnap<V&&V<this._bearingSnap;!F||!F.essential&&E.prefersReducedMotion?(this._map.fire(new n.k("moveend",{originalEvent:M})),O(this._map.getBearing())&&this._map.resetNorth()):(O(F.bearing||this._map.getBearing())&&(F.bearing=0),F.freezeElevation=!0,this._map.easeTo(F,{originalEvent:M})),this._updatingCamera=!1}}_fireEvent(e,s){this._map.fire(new n.k(e,s?{originalEvent:s}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new rc("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class nc extends n.E{constructor(e,s,d){super(),this._renderFrameCallback=()=>{let p=Math.min((E.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(p)),p<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=d.bearingSnap,this.cameraHelper=s,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,s){e.apply(this.transform),this.transform=e,this.cameraHelper=s}getCenter(){return new n.N(this.transform.center.lng,this.transform.center.lat)}setCenter(e,s){return this.jumpTo({center:e},s)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,s){return this.jumpTo({elevation:e},s),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,s,d){return e=n.P.convert(e).mult(-1),this.panTo(this.transform.center,n.e({offset:e},s),d)}panTo(e,s,d){return this.easeTo(n.e({center:e},s),d)}getZoom(){return this.transform.zoom}setZoom(e,s){return this.jumpTo({zoom:e},s),this}zoomTo(e,s,d){return this.easeTo(n.e({zoom:e},s),d)}zoomIn(e,s){return this.zoomTo(this.getZoom()+1,e,s),this}zoomOut(e,s){return this.zoomTo(this.getZoom()-1,e,s),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,s){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new n.k("movestart",s)).fire(new n.k("move",s)).fire(new n.k("moveend",s))),this}getBearing(){return this.transform.bearing}setBearing(e,s){return this.jumpTo({bearing:e},s),this}getPadding(){return this.transform.padding}setPadding(e,s){return this.jumpTo({padding:e},s),this}rotateTo(e,s,d){return this.easeTo(n.e({bearing:e},s),d)}resetNorth(e,s){return this.rotateTo(0,n.e({duration:1e3},e),s),this}resetNorthPitch(e,s){return this.easeTo(n.e({bearing:0,pitch:0,roll:0,duration:1e3},e),s),this}snapToNorth(e,s){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,s):this}getPitch(){return this.transform.pitch}setPitch(e,s){return this.jumpTo({pitch:e},s),this}getRoll(){return this.transform.roll}setRoll(e,s){return this.jumpTo({roll:e},s),this}cameraForBounds(e,s){e=oi.convert(e).adjustAntiMeridian();let d=s&&s.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),d,s)}_cameraForBoxAndBearing(e,s,d,p){let g={top:0,bottom:0,right:0,left:0};if(typeof(p=n.e({padding:g,offset:[0,0],maxZoom:this.transform.maxZoom},p)).padding=="number"){let P=p.padding;p.padding={top:P,bottom:P,right:P,left:P}}let v=n.e(g,p.padding);p.padding=v;let T=this.transform,M=new oi(e,s);return this.cameraHelper.cameraForBoxAndBearing(p,v,M,d,T)}fitBounds(e,s,d){return this._fitInternal(this.cameraForBounds(e,s),s,d)}fitScreenCoordinates(e,s,d,p,g){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(n.P.convert(e)),this.transform.screenPointToLocation(n.P.convert(s)),d,p),p,g)}_fitInternal(e,s,d){return e?(delete(s=n.e(e,s)).padding,s.linear?this.easeTo(s,d):this.flyTo(s,d)):this}jumpTo(e,s){this.stop();let d=this._getTransformForUpdate(),p=!1,g=!1,v=!1,T=d.zoom;this.cameraHelper.handleJumpToCenterZoom(d,e);let M=d.zoom!==T;return"elevation"in e&&d.elevation!==+e.elevation&&d.setElevation(+e.elevation),"bearing"in e&&d.bearing!==+e.bearing&&(p=!0,d.setBearing(+e.bearing)),"pitch"in e&&d.pitch!==+e.pitch&&(g=!0,d.setPitch(+e.pitch)),"roll"in e&&d.roll!==+e.roll&&(v=!0,d.setRoll(+e.roll)),e.padding==null||d.isPaddingEqual(e.padding)||d.setPadding(e.padding),this._applyUpdatedTransform(d),this.fire(new n.k("movestart",s)).fire(new n.k("move",s)),M&&this.fire(new n.k("zoomstart",s)).fire(new n.k("zoom",s)).fire(new n.k("zoomend",s)),p&&this.fire(new n.k("rotatestart",s)).fire(new n.k("rotate",s)).fire(new n.k("rotateend",s)),g&&this.fire(new n.k("pitchstart",s)).fire(new n.k("pitch",s)).fire(new n.k("pitchend",s)),v&&this.fire(new n.k("rollstart",s)).fire(new n.k("roll",s)).fire(new n.k("rollend",s)),this.fire(new n.k("moveend",s))}calculateCameraOptionsFromTo(e,s,d,p=0){let g=n.Y.fromLngLat(e,s),v=n.Y.fromLngLat(d,p),T=v.x-g.x,M=v.y-g.y,P=v.z-g.z,D=Math.hypot(T,M,P);if(D===0)throw new Error("Can't calculate camera options with same From and To");let F=Math.hypot(T,M),O=n.a8(this.transform.cameraToCenterDistance/D/this.transform.tileSize),V=180*Math.atan2(T,-M)/Math.PI,q=180*Math.acos(F/D)/Math.PI;return q=P<0?90-q:90+q,{center:v.toLngLat(),elevation:p,zoom:O,pitch:q,bearing:V}}calculateCameraOptionsFromCameraLngLatAltRotation(e,s,d,p,g){let v=this.transform.calculateCenterFromCameraLngLatAlt(e,s,d,p);return{center:v.center,elevation:v.elevation,zoom:v.zoom,bearing:d,pitch:p,roll:g}}easeTo(e,s){this._stop(!1,e.easeId),((e=n.e({offset:[0,0],duration:500,easing:n.c8},e)).animate===!1||!e.essential&&E.prefersReducedMotion)&&(e.duration=0);let d=this._getTransformForUpdate(),p=this.getBearing(),g=d.pitch,v=d.roll,T="bearing"in e?this._normalizeBearing(e.bearing,p):p,M="pitch"in e?+e.pitch:g,P="roll"in e?this._normalizeBearing(e.roll,v):v,D="padding"in e?e.padding:d.padding,F=n.P.convert(e.offset),O,V;e.around&&(O=n.N.convert(e.around),V=d.locationToScreenPoint(O));let q={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},Q=this.cameraHelper.handleEaseTo(d,{bearing:T,pitch:M,roll:P,padding:D,around:O,aroundPoint:V,offsetAsPoint:F,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||p!==T,this._pitching=this._pitching||M!==g,this._rolling=this._rolling||P!==v,this._padding=!d.isPaddingEqual(D),this._zooming=this._zooming||Q.isZooming,this._easeId=e.easeId,this._prepareEase(s,e.noMoveStart,q),this.terrain&&this._prepareElevation(Q.elevationCenter),this._ease(J=>{Q.easeFunc(J),this.terrain&&!e.freezeElevation&&this._updateElevation(J),this._applyUpdatedTransform(d),this._fireMoveEvents(s)},J=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(s,J)},e),this}_prepareEase(e,s,d={}){this._moving=!0,s||d.moving||this.fire(new n.k("movestart",e)),this._zooming&&!d.zooming&&this.fire(new n.k("zoomstart",e)),this._rotating&&!d.rotating&&this.fire(new n.k("rotatestart",e)),this._pitching&&!d.pitching&&this.fire(new n.k("pitchstart",e)),this._rolling&&!d.rolling&&this.fire(new n.k("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let s=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&s!==this._elevationTarget){let d=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(d-(s-(d*e+this._elevationStart))/(1-e)),this._elevationTarget=s}this.transform.setElevation(n.y.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};let s=e.getCameraLngLat(),d=e.getCameraAltitude(),p=this.terrain?this.terrain.getElevationForLngLatZoom(s,e.zoom):0;if(d<p){let g=this.calculateCameraOptionsFromTo(s,p,e.center,e.elevation);return{pitch:g.pitch,zoom:g.zoom}}return{}}_applyUpdatedTransform(e){let s=[];if(s.push(p=>this._elevateCameraIfInsideTerrain(p)),this.transformCameraUpdate&&s.push(p=>this.transformCameraUpdate(p)),!s.length)return;let d=e.clone();for(let p of s){let g=d.clone(),{center:v,zoom:T,roll:M,pitch:P,bearing:D,elevation:F}=p(g);v&&g.setCenter(v),F!==void 0&&g.setElevation(F),T!==void 0&&g.setZoom(T),M!==void 0&&g.setRoll(M),P!==void 0&&g.setPitch(P),D!==void 0&&g.setBearing(D),d.apply(g)}this.transform.apply(d)}_fireMoveEvents(e){this.fire(new n.k("move",e)),this._zooming&&this.fire(new n.k("zoom",e)),this._rotating&&this.fire(new n.k("rotate",e)),this._pitching&&this.fire(new n.k("pitch",e)),this._rolling&&this.fire(new n.k("roll",e))}_afterEase(e,s){if(this._easeId&&s&&this._easeId===s)return;delete this._easeId;let d=this._zooming,p=this._rotating,g=this._pitching,v=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,d&&this.fire(new n.k("zoomend",e)),p&&this.fire(new n.k("rotateend",e)),g&&this.fire(new n.k("pitchend",e)),v&&this.fire(new n.k("rollend",e)),this.fire(new n.k("moveend",e))}flyTo(e,s){if(!e.essential&&E.prefersReducedMotion){let Ae=n.M(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(Ae,s)}this.stop(),e=n.e({offset:[0,0],speed:1.2,curve:1.42,easing:n.c8},e);let d=this._getTransformForUpdate(),p=d.bearing,g=d.pitch,v=d.roll,T=d.padding,M="bearing"in e?this._normalizeBearing(e.bearing,p):p,P="pitch"in e?+e.pitch:g,D="roll"in e?this._normalizeBearing(e.roll,v):v,F="padding"in e?e.padding:d.padding,O=n.P.convert(e.offset),V=d.centerPoint.add(O),q=d.screenPointToLocation(V),Q=this.cameraHelper.handleFlyTo(d,{bearing:M,pitch:P,roll:D,padding:F,locationAtOffset:q,offsetAsPoint:O,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),J=e.curve,ee=Math.max(d.width,d.height),ie=ee/Q.scaleOfZoom,ae=Q.pixelPathLength;typeof Q.scaleOfMinZoom=="number"&&(J=Math.sqrt(ee/Q.scaleOfMinZoom/ae*2));let le=J*J;function ce(Ae){let Ye=(ie*ie-ee*ee+(Ae?-1:1)*le*le*ae*ae)/(2*(Ae?ie:ee)*le*ae);return Math.log(Math.sqrt(Ye*Ye+1)-Ye)}function fe(Ae){return(Math.exp(Ae)-Math.exp(-Ae))/2}function ue(Ae){return(Math.exp(Ae)+Math.exp(-Ae))/2}let we=ce(!1),Ce=function(Ae){return ue(we)/ue(we+J*Ae)},ze=function(Ae){return ee*((ue(we)*(fe(Ye=we+J*Ae)/ue(Ye))-fe(we))/le)/ae;var Ye},Fe=(ce(!0)-we)/J;if(Math.abs(ae)<2e-6||!isFinite(Fe)){if(Math.abs(ee-ie)<1e-6)return this.easeTo(e,s);let Ae=ie<ee?-1:1;Fe=Math.abs(Math.log(ie/ee))/J,ze=()=>0,Ce=Ye=>Math.exp(Ae*J*Ye)}return e.duration="duration"in e?+e.duration:1e3*Fe/("screenSpeed"in e?+e.screenSpeed/J:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=p!==M,this._pitching=P!==g,this._rolling=D!==v,this._padding=!d.isPaddingEqual(F),this._prepareEase(s,!1),this.terrain&&this._prepareElevation(Q.targetCenter),this._ease(Ae=>{let Ye=Ae*Fe,$e=1/Ce(Ye),Oe=ze(Ye);this._rotating&&d.setBearing(n.y.number(p,M,Ae)),this._pitching&&d.setPitch(n.y.number(g,P,Ae)),this._rolling&&d.setRoll(n.y.number(v,D,Ae)),this._padding&&(d.interpolatePadding(T,F,Ae),V=d.centerPoint.add(O)),Q.easeFunc(Ae,$e,Oe,V),this.terrain&&!e.freezeElevation&&this._updateElevation(Ae),this._applyUpdatedTransform(d),this._fireMoveEvents(s)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(s)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,s){var d;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let p=this._onEaseEnd;delete this._onEaseEnd,p.call(this,s)}return e||(d=this.handlers)===null||d===void 0||d.stop(!1),this}_ease(e,s,d){d.animate===!1||d.duration===0?(e(1),s()):(this._easeStart=E.now(),this._easeOptions=d,this._onEaseFrame=e,this._onEaseEnd=s,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,s){e=n.aI(e,-180,180);let d=Math.abs(e-s);return Math.abs(e-360-s)<d&&(e-=360),Math.abs(e+360-s)<d&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(n.N.convert(e),this.transform.tileZoom):null}}let sc={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class oc{constructor(e=sc){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=s=>{!s||s.sourceDataType!=="metadata"&&s.sourceDataType!=="visibility"&&s.dataType!=="style"&&s.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=A.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=A.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=A.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){A.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._sanitizedAttributionHTML=void 0}_setElementTitle(e,s){let d=this._map._getUIString(`AttributionControl.${s}`);e.title=d,e.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(p=>typeof p!="string"?"":p)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let p=this._map.style.stylesheet;this.styleOwner=p.owner,this.styleId=p.id}let s=this._map.style.sourceCaches;for(let p in s){let g=s[p];if(g.used||g.usedForTerrain){let v=g.getSource();v.attribution&&e.indexOf(v.attribution)<0&&e.push(v.attribution)}}e=e.filter(p=>String(p).trim()),e.sort((p,g)=>p.length-g.length),e=e.filter((p,g)=>{for(let v=g+1;v<e.length;v++)if(e[v].indexOf(p)>=0)return!1;return!0});let d=e.join(" | ");d!==this._sanitizedAttributionHTML&&(this._sanitizedAttributionHTML=A.sanitize(d),e.length?(this._innerContainer.innerHTML=this._sanitizedAttributionHTML,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Ir{constructor(e={}){this._updateCompact=()=>{let s=this._container.children;if(s.length){let d=s[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=A.create("div","maplibregl-ctrl");let s=A.create("a","maplibregl-ctrl-logo");return s.target="_blank",s.rel="noopener nofollow",s.href="https://maplibre.org/",s.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),s.setAttribute("rel","noopener nofollow"),this._container.appendChild(s),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){A.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class mp{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let s=++this._id;return this._queue.push({callback:e,id:s,cancelled:!1}),s}remove(e){let s=this._currentlyRunning,d=s?this._queue.concat(s):this._queue;for(let p of d)if(p.id===e)return void(p.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let s=this._currentlyRunning=this._queue;this._queue=[];for(let d of s)if(!d.cancelled&&(d.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var ss=n.aA([{name:"a_pos3d",type:"Int16",components:3}]);class Sm extends n.E{constructor(e){super(),this._lastTilesetChange=E.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,s){this.sourceCache.update(e,s),this._renderableTilesKeys=[];let d={};for(let p of K(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:s,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))d[p.key]=!0,this._renderableTilesKeys.push(p.key),this._tiles[p.key]||(p.terrainRttPosMatrix32f=new Float64Array(16),n.bL(p.terrainRttPosMatrix32f,0,n.X,n.X,0,0,1),this._tiles[p.key]=new Fn(p,this.tileSize),this._lastTilesetChange=E.now());for(let p in this._tiles)d[p]||delete this._tiles[p]}freeRtt(e){for(let s in this._tiles){let d=this._tiles[s];(!e||d.tileID.equals(e)||d.tileID.isChildOf(e)||e.isChildOf(d.tileID))&&(d.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){let s={};for(let d of this._renderableTilesKeys){let p=this._tiles[d].tileID,g=e.clone(),v=n.a$();if(p.canonical.equals(e.canonical))n.bL(v,0,n.X,n.X,0,0,1);else if(p.canonical.isChildOf(e.canonical)){let T=p.canonical.z-e.canonical.z,M=p.canonical.x-(p.canonical.x>>T<<T),P=p.canonical.y-(p.canonical.y>>T<<T),D=n.X>>T;n.bL(v,0,D,D,0,0,1),n.J(v,v,[-M*D,-P*D,0])}else{if(!e.canonical.isChildOf(p.canonical))continue;{let T=e.canonical.z-p.canonical.z,M=e.canonical.x-(e.canonical.x>>T<<T),P=e.canonical.y-(e.canonical.y>>T<<T),D=n.X>>T;n.bL(v,0,n.X,n.X,0,0,1),n.J(v,v,[M*D,P*D,0]),n.K(v,v,[1/2**T,1/2**T,0])}}g.terrainRttPosMatrix32f=new Float32Array(v),s[d]=g}return s}getSourceTile(e,s){let d=this.sourceCache._source,p=e.overscaledZ-this.deltaZoom;if(p>d.maxzoom&&(p=d.maxzoom),p<d.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(p).key);let g=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!g||!g.dem)&&s)for(;p>=d.minzoom&&(!g||!g.dem);)g=this.sourceCache.getTileByID(e.scaledTo(p--).key);return g}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}}class Qa{constructor(e,s,d){this._meshCache={},this.painter=e,this.sourceCache=new Sm(s),this.options=d,this.exaggeration=typeof d.exaggeration=="number"?d.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,s,d,p=n.X){var g;if(!(s>=0&&s<p&&d>=0&&d<p))return 0;let v=this.getTerrainData(e),T=(g=v.tile)===null||g===void 0?void 0:g.dem;if(!T)return 0;let M=n.c9([],[s/p*n.X,d/p*n.X],v.u_terrain_matrix),P=[M[0]*T.dim,M[1]*T.dim],D=Math.floor(P[0]),F=Math.floor(P[1]),O=P[0]-D,V=P[1]-F;return T.get(D,F)*(1-O)*(1-V)+T.get(D+1,F)*O*(1-V)+T.get(D,F+1)*(1-O)*V+T.get(D+1,F+1)*O*V}getElevationForLngLatZoom(e,s){if(!n.ca(s,e.wrap()))return 0;let{tileID:d,mercatorX:p,mercatorY:g}=this._getOverscaledTileIDFromLngLatZoom(e,s);return this.getElevation(d,p%n.X,g%n.X,n.X)}getElevation(e,s,d,p=n.X){return this.getDEMElevation(e,s,d,p)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){let p=this.painter.context,g=new n.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Re(p,g,p.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Re(p,new n.R({width:1,height:1}),p.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(p.gl.NEAREST,p.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=n.aq([])}let s=this.sourceCache.getSourceTile(e,!0);if(s&&s.dem&&(!s.demTexture||s.needsTerrainPrepare)){let p=this.painter.context;s.demTexture=this.painter.getTileTexture(s.dem.stride),s.demTexture?s.demTexture.update(s.dem.getPixels(),{premultiply:!1}):s.demTexture=new Re(p,s.dem.getPixels(),p.gl.RGBA,{premultiply:!1}),s.demTexture.bind(p.gl.NEAREST,p.gl.CLAMP_TO_EDGE),s.needsTerrainPrepare=!1}let d=s&&s+s.tileID.key+e.key;if(d&&!this._demMatrixCache[d]){let p=this.sourceCache.sourceCache._source.maxzoom,g=e.canonical.z-s.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=p?g=e.canonical.z-p:n.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let v=e.canonical.x-(e.canonical.x>>g<<g),T=e.canonical.y-(e.canonical.y>>g<<g),M=n.cb(new Float64Array(16),[1/(n.X<<g),1/(n.X<<g),0]);n.J(M,M,[v*n.X,T*n.X,0]),this._demMatrixCache[e.key]={matrix:M,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:s&&s.dem&&s.dem.dim||1,u_terrain_matrix:d?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:s&&s.dem&&s.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(s&&s.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:s}}getFramebuffer(e){let s=this.painter,d=s.width/devicePixelRatio,p=s.height/devicePixelRatio;return!this._fbo||this._fbo.width===d&&this._fbo.height===p||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Re(s.context,{width:d,height:p,data:null},s.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(s.context.gl.NEAREST,s.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Re(s.context,{width:d,height:p,data:null},s.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(s.context.gl.NEAREST,s.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=s.context.createFramebuffer(d,p,!0,!1),this._fbo.depthAttachment.set(s.context.createRenderbuffer(s.context.gl.DEPTH_COMPONENT16,d,p))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let s=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let g=0,v=0;g<this._coordsTextureSize;g++)for(let T=0;T<this._coordsTextureSize;T++,v+=4)s[v+0]=255&T,s[v+1]=255&g,s[v+2]=T>>8<<4|g>>8,s[v+3]=0;let d=new n.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(s.buffer)),p=new Re(e,d,e.gl.RGBA,{premultiply:!1});return p.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=p,p}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);let s=new Uint8Array(4),d=this.painter.context,p=d.gl,g=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),v=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),T=Math.round(this.painter.height/devicePixelRatio);d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),p.readPixels(g,T-v-1,1,1,p.RGBA,p.UNSIGNED_BYTE,s),d.bindFramebuffer.set(null);let M=s[0]+(s[2]>>4<<8),P=s[1]+((15&s[2])<<8),D=this.coordsIndex[255-s[3]],F=D&&this.sourceCache.getTileByID(D);if(!F)return null;let O=this._coordsTextureSize,V=(1<<F.tileID.canonical.z)*O;return new n.Y((F.tileID.canonical.x*O+M)/V+F.tileID.wrap,(F.tileID.canonical.y*O+P)/V,this.getElevation(F.tileID,M,P,O))}depthAtPoint(e){let s=new Uint8Array(4),d=this.painter.context,p=d.gl;return d.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),p.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,p.RGBA,p.UNSIGNED_BYTE,s),d.bindFramebuffer.set(null),(s[0]/16777216+s[1]/65536+s[2]/256+s[3])/256}getTerrainMesh(e){var s;let d=((s=this.painter.style.projection)===null||s===void 0?void 0:s.transitionState)>0,p=d&&e.canonical.y===0,g=d&&e.canonical.y===(1<<e.canonical.z)-1,v=`m_${p?"n":""}_${g?"s":""}`;if(this._meshCache[v])return this._meshCache[v];let T=this.painter.context,M=new n.cc,P=new n.aE,D=this.meshSize,F=n.X/D,O=D*D;for(let ue=0;ue<=D;ue++)for(let we=0;we<=D;we++)M.emplaceBack(we*F,ue*F,0);for(let ue=0;ue<O;ue+=D+1)for(let we=0;we<D;we++)P.emplaceBack(we+ue,D+we+ue+1,D+we+ue+2),P.emplaceBack(we+ue,D+we+ue+2,we+ue+1);let V=M.length,q=V+(D+1),Q=(D+1)*D,J=p?n.b6:0,ee=p?0:1,ie=g?n.b7:n.X,ae=g?0:1;for(let ue=0;ue<=D;ue++)M.emplaceBack(ue*F,J,ee);for(let ue=0;ue<=D;ue++)M.emplaceBack(ue*F,ie,ae);for(let ue=0;ue<D;ue++)P.emplaceBack(Q+ue,q+ue,q+ue+1),P.emplaceBack(Q+ue,q+ue+1,Q+ue+1),P.emplaceBack(0+ue,V+ue+1,V+ue),P.emplaceBack(0+ue,0+ue+1,V+ue+1);let le=M.length,ce=le+2*(D+1);for(let ue of[0,1])for(let we=0;we<=D;we++)for(let Ce of[0,1])M.emplaceBack(ue*n.X,we*F,Ce);for(let ue=0;ue<2*D;ue+=2)P.emplaceBack(le+ue,le+ue+1,le+ue+3),P.emplaceBack(le+ue,le+ue+3,le+ue+2),P.emplaceBack(ce+ue,ce+ue+3,ce+ue+1),P.emplaceBack(ce+ue,ce+ue+2,ce+ue+3);let fe=new ts(T.createVertexBuffer(M,ss.members),T.createIndexBuffer(P),n.aD.simpleSegment(0,0,M.length,P.length));return this._meshCache[v]=fe,fe}getMeshFrameDelta(e){return 2*Math.PI*n.bo/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,s){var d;let{tileID:p}=this._getOverscaledTileIDFromLngLatZoom(e,s);return(d=this.getMinMaxElevation(p).minElevation)!==null&&d!==void 0?d:0}getMinMaxElevation(e){let s=this.getTerrainData(e).tile,d={minElevation:null,maxElevation:null};return s&&s.dem&&(d.minElevation=s.dem.min*this.exaggeration,d.maxElevation=s.dem.max*this.exaggeration),d}_getOverscaledTileIDFromLngLatZoom(e,s){let d=n.Y.fromLngLat(e.wrap()),p=(1<<s)*n.X,g=d.x*p,v=d.y*p,T=Math.floor(g/n.X),M=Math.floor(v/n.X);return{tileID:new n.S(s,0,s,T,M),mercatorX:g,mercatorY:v}}}class xi{constructor(e,s,d){this._context=e,this._size=s,this._tileSize=d,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){let s=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),d=new Re(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return d.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),s.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),s.colorAttachment.set(d.texture),{id:e,fbo:s,texture:d,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(s=>e.id!==s),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let s of this._recentlyUsed)if(!this._objects[s].inUse)return this._objects[s];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(e=>!e.inUse)===!1}}let ri={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class gp{constructor(e,s){this.painter=e,this.terrain=s,this.pool=new xi(e.context,30,s.sourceCache.tileSize*s.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,s){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(d=>!e._layers[d].isHidden(s)),this._coordsAscending={};for(let d in e.sourceCaches){this._coordsAscending[d]={};let p=e.sourceCaches[d].getVisibleCoordinates();for(let g of p){let v=this.terrain.sourceCache.getTerrainCoords(g);for(let T in v)this._coordsAscending[d][T]||(this._coordsAscending[d][T]=[]),this._coordsAscending[d][T].push(v[T])}}this._coordsAscendingStr={};for(let d of e._order){let p=e._layers[d],g=p.source;if(ri[p.type]&&!this._coordsAscendingStr[g]){this._coordsAscendingStr[g]={};for(let v in this._coordsAscending[g])this._coordsAscendingStr[g][v]=this._coordsAscending[g][v].map(T=>T.key).sort().join()}}for(let d of this._renderableTiles)for(let p in this._coordsAscendingStr){let g=this._coordsAscendingStr[p][d.tileID.key];g&&g!==d.rttCoords[p]&&(d.rtt=[])}}renderLayer(e,s){if(e.isHidden(this.painter.transform.zoom))return!1;let d=Object.assign(Object.assign({},s),{isRenderingToTexture:!0}),p=e.type,g=this.painter,v=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(ri[p]&&(this._prevType&&ri[this._prevType]||this._stacks.push([]),this._prevType=p,this._stacks[this._stacks.length-1].push(e.id),!v))return!0;if(ri[this._prevType]||ri[p]&&v){this._prevType=p;let T=this._stacks.length-1,M=this._stacks[T]||[];for(let P of this._renderableTiles){if(this.pool.isFull()&&(Nh(this.painter,this.terrain,this._rttTiles,d),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(P),P.rtt[T]){let F=this.pool.getObjectForId(P.rtt[T].id);if(F.stamp===P.rtt[T].stamp){this.pool.useObject(F);continue}}let D=this.pool.getOrCreateFreeObject();this.pool.useObject(D),this.pool.stampObject(D),P.rtt[T]={id:D.id,stamp:D.stamp},g.context.bindFramebuffer.set(D.fbo.framebuffer),g.context.clear({color:n.b4.transparent,stencil:0}),g.currentStencilSource=void 0;for(let F=0;F<M.length;F++){let O=g.style._layers[M[F]],V=O.source?this._coordsAscending[O.source][P.tileID.key]:[P.tileID];g.context.viewport.set([0,0,D.fbo.width,D.fbo.height]),g._renderTileClippingMasks(O,V,!0),g.renderLayer(g,g.style.sourceCaches[O.source],O,V,d),O.source&&(P.rttCoords[O.source]=this._coordsAscendingStr[O.source][P.tileID.key])}}return Nh(this.painter,this.terrain,this._rttTiles,d),this._rttTiles=[],this.pool.freeAllObjects(),ri[p]}return!1}}let el={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},ac=x,lc={hash:!1,interactive:!0,bearingSnap:7,attributionControl:sc,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:n.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},Jh={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Qh{constructor(e,s,d=!1){this.mousedown=g=>{this.startMove(g,A.mousePos(this.element,g)),A.addEventListener(window,"mousemove",this.mousemove),A.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=g=>{this.move(g,A.mousePos(this.element,g))},this.mouseup=g=>{this._rotatePitchHanlder.dragEnd(g),this.offTemp()},this.touchstart=g=>{g.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=A.touchPos(this.element,g.targetTouches)[0],this.startMove(g,this._startPos),A.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),A.addEventListener(window,"touchend",this.touchend))},this.touchmove=g=>{g.targetTouches.length!==1?this.reset():(this._lastPos=A.touchPos(this.element,g.targetTouches)[0],this.move(g,this._lastPos))},this.touchend=g=>{g.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=s;let p=new Ha;this._rotatePitchHanlder=new ea({clickTolerance:3,move:(g,v)=>{let T=s.getBoundingClientRect(),M=new n.P((T.bottom-T.top)/2,(T.right-T.left)/2);return{bearingDelta:n.c7(new n.P(g.x,v.y),v,M),pitchDelta:d?-.5*(v.y-g.y):void 0}},moveStateManager:p,enable:!0,assignEvents:()=>{}}),this.map=e,A.addEventListener(s,"mousedown",this.mousedown),A.addEventListener(s,"touchstart",this.touchstart,{passive:!1}),A.addEventListener(s,"touchcancel",this.reset)}startMove(e,s){this._rotatePitchHanlder.dragStart(e,s),A.disableDrag()}move(e,s){let d=this.map,{bearingDelta:p,pitchDelta:g}=this._rotatePitchHanlder.dragMove(e,s)||{};p&&d.setBearing(d.getBearing()+p),g&&d.setPitch(d.getPitch()+g)}off(){let e=this.element;A.removeEventListener(e,"mousedown",this.mousedown),A.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),A.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),A.removeEventListener(window,"touchend",this.touchend),A.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){A.enableDrag(),A.removeEventListener(window,"mousemove",this.mousemove),A.removeEventListener(window,"mouseup",this.mouseup),A.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),A.removeEventListener(window,"touchend",this.touchend)}}let Gn;function cc(m,e,s){let d=new n.N(m.lng,m.lat);if(m=new n.N(m.lng,m.lat),e){let p=new n.N(m.lng-360,m.lat),g=new n.N(m.lng+360,m.lat),v=s.locationToScreenPoint(m).distSqr(e);s.locationToScreenPoint(p).distSqr(e)<v?m=p:s.locationToScreenPoint(g).distSqr(e)<v&&(m=g)}for(;Math.abs(m.lng-s.center.lng)>180;){let p=s.locationToScreenPoint(m);if(p.x>=0&&p.y>=0&&p.x<=s.width&&p.y<=s.height)break;m.lng>s.center.lng?m.lng-=360:m.lng+=360}return m.lng!==d.lng&&s.isPointOnMapSurface(s.locationToScreenPoint(m))?m:d}let tl={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 hc(m,e,s){let d=m.classList;for(let p in tl)d.remove(`maplibregl-${s}-anchor-${p}`);d.add(`maplibregl-${s}-anchor-${e}`)}class il extends n.E{constructor(e){if(super(),this._onKeyPress=s=>{let d=s.code,p=s.charCode||s.keyCode;d!=="Space"&&d!=="Enter"&&p!==32&&p!==13||this.togglePopup()},this._onMapClick=s=>{let d=s.originalEvent.target,p=this._element;this._popup&&(d===p||p.contains(d))&&this.togglePopup()},this._update=s=>{var d;if(!this._map)return;let p=this._map.loaded()&&!this._map.isMoving();(s?.type==="terrain"||s?.type==="render"&&!p)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?cc(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let g="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?g=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(g=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let v="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?v="rotateX(0deg)":this._pitchAlignment==="map"&&(v=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||s&&s.type!=="moveend"||(this._pos=this._pos.round()),A.setTransform(this._element,`${tl[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${v} ${g}`),E.frameAsync(new AbortController).then(()=>{this._updateOpacity(s&&s.type==="moveend")}).catch(()=>{})},this._onMove=s=>{if(!this._isDragging){let d=this._clickTolerance||this._map._clickTolerance;this._isDragging=s.point.dist(this._pointerdownPos)>=d}this._isDragging&&(this._pos=s.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 n.k("dragstart"))),this.fire(new n.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new n.k("dragend")),this._state="inactive"},this._addDragHandler=s=>{this._element.contains(s.originalEvent.target)&&(s.preventDefault(),this._positionDelta=s.point.sub(this._pos).add(this._offset),this._pointerdownPos=s.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(e?.opacity,e?.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=n.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=A.create("div");let s=A.createNS("http://www.w3.org/2000/svg","svg"),d=41,p=27;s.setAttributeNS(null,"display","block"),s.setAttributeNS(null,"height",`${d}px`),s.setAttributeNS(null,"width",`${p}px`),s.setAttributeNS(null,"viewBox",`0 0 ${p} ${d}`);let g=A.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"stroke","none"),g.setAttributeNS(null,"stroke-width","1"),g.setAttributeNS(null,"fill","none"),g.setAttributeNS(null,"fill-rule","evenodd");let v=A.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"fill-rule","nonzero");let T=A.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"transform","translate(3.0, 29.0)"),T.setAttributeNS(null,"fill","#000000");let M=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let ee of M){let ie=A.createNS("http://www.w3.org/2000/svg","ellipse");ie.setAttributeNS(null,"opacity","0.04"),ie.setAttributeNS(null,"cx","10.5"),ie.setAttributeNS(null,"cy","5.80029008"),ie.setAttributeNS(null,"rx",ee.rx),ie.setAttributeNS(null,"ry",ee.ry),T.appendChild(ie)}let P=A.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"fill",this._color);let D=A.createNS("http://www.w3.org/2000/svg","path");D.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"),P.appendChild(D);let F=A.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");let O=A.createNS("http://www.w3.org/2000/svg","path");O.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"),F.appendChild(O);let V=A.createNS("http://www.w3.org/2000/svg","g");V.setAttributeNS(null,"transform","translate(6.0, 7.0)"),V.setAttributeNS(null,"fill","#FFFFFF");let q=A.createNS("http://www.w3.org/2000/svg","g");q.setAttributeNS(null,"transform","translate(8.0, 8.0)");let Q=A.createNS("http://www.w3.org/2000/svg","circle");Q.setAttributeNS(null,"fill","#000000"),Q.setAttributeNS(null,"opacity","0.25"),Q.setAttributeNS(null,"cx","5.5"),Q.setAttributeNS(null,"cy","5.5"),Q.setAttributeNS(null,"r","5.4999962");let J=A.createNS("http://www.w3.org/2000/svg","circle");J.setAttributeNS(null,"fill","#FFFFFF"),J.setAttributeNS(null,"cx","5.5"),J.setAttributeNS(null,"cy","5.5"),J.setAttributeNS(null,"r","5.4999962"),q.appendChild(Q),q.appendChild(J),v.appendChild(T),v.appendChild(P),v.appendChild(F),v.appendChild(V),v.appendChild(q),s.appendChild(v),s.setAttributeNS(null,"height",d*this._scale+"px"),s.setAttributeNS(null,"width",p*this._scale+"px"),this._element.appendChild(s),this._offset=n.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",s=>{s.preventDefault()}),this._element.addEventListener("mousedown",s=>{s.preventDefault()}),hc(this._element,this._anchor,"marker"),e&&e.className)for(let s of e.className.split(" "))this._element.classList.add(s);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",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("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),A.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=n.N.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let p=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[p,-1*(38.1-13.5+p)],"bottom-right":[-p,-1*(38.1-13.5+p)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){let e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var s,d;if(!(!((s=this._map)===null||s===void 0)&&s.terrain)){let F=this._map.transform.isLocationOccluded(this._lngLat)?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==F&&(this._element.style.opacity=F))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let p=this._map,g=p.terrain.depthAtPoint(this._pos),v=p.terrain.getElevationForLngLatZoom(this._lngLat,p.transform.tileZoom);if(p.transform.lngLatToCameraDepth(this._lngLat,v)-g<.006)return void(this._element.style.opacity=this._opacity);let T=-this._offset.y/p.transform.pixelsPerMeter,M=Math.sin(p.getPitch()*Math.PI/180)*T,P=p.terrain.depthAtPoint(new n.P(this._pos.x,this._pos.y-this._offset.y)),D=p.transform.lngLatToCameraDepth(this._lngLat,v+M)-P>.006;!((d=this._popup)===null||d===void 0)&&d.isOpen()&&D&&this._popup.remove(),this._element.style.opacity=D?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=n.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,s){return e===void 0&&s===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),s!==void 0&&(this._opacityWhenCovered=s),this._map&&this._updateOpacity(!0),this}}let eu={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},ia=0,yo=!1,tu={maxWidth:100,unit:"metric"};function rl(m,e,s){let d=s&&s.maxWidth||100,p=m._container.clientHeight/2,g=m._container.clientWidth/2,v=m.unproject([g-d/2,p]),T=m.unproject([g+d/2,p]),M=Math.round(m.project(T).x-m.project(v).x),P=Math.min(d,M,m._container.clientWidth),D=v.distanceTo(T);if(s&&s.unit==="imperial"){let F=3.2808*D;F>5280?xo(e,P,F/5280,m._getUIString("ScaleControl.Miles")):xo(e,P,F,m._getUIString("ScaleControl.Feet"))}else s&&s.unit==="nautical"?xo(e,P,D/1852,m._getUIString("ScaleControl.NauticalMiles")):D>=1e3?xo(e,P,D/1e3,m._getUIString("ScaleControl.Kilometers")):xo(e,P,D,m._getUIString("ScaleControl.Meters"))}function xo(m,e,s,d){let p=function(g){let v=Math.pow(10,`${Math.floor(g)}`.length-1),T=g/v;return T=T>=10?10:T>=5?5:T>=3?3:T>=2?2:T>=1?1:function(M){let P=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*P)/P}(T),v*T}(s);m.style.width=e*(p/s)+"px",m.innerHTML=`${p}&nbsp;${d}`}let iu={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},uc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function dc(m){if(m){if(typeof m=="number"){let e=Math.round(Math.abs(m)/Math.SQRT2);return{center:new n.P(0,0),top:new n.P(0,m),"top-left":new n.P(e,e),"top-right":new n.P(-e,e),bottom:new n.P(0,-m),"bottom-left":new n.P(e,-e),"bottom-right":new n.P(-e,-e),left:new n.P(m,0),right:new n.P(-m,0)}}if(m instanceof n.P||Array.isArray(m)){let e=n.P.convert(m);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:n.P.convert(m.center||[0,0]),top:n.P.convert(m.top||[0,0]),"top-left":n.P.convert(m["top-left"]||[0,0]),"top-right":n.P.convert(m["top-right"]||[0,0]),bottom:n.P.convert(m.bottom||[0,0]),"bottom-left":n.P.convert(m["bottom-left"]||[0,0]),"bottom-right":n.P.convert(m["bottom-right"]||[0,0]),left:n.P.convert(m.left||[0,0]),right:n.P.convert(m.right||[0,0])}}return dc(new n.P(0,0))}let ru=x;c.AJAXError=n.cg,c.Event=n.k,c.Evented=n.E,c.LngLat=n.N,c.MercatorCoordinate=n.Y,c.Point=n.P,c.addProtocol=n.ch,c.config=n.a,c.removeProtocol=n.ci,c.AttributionControl=oc,c.BoxZoomHandler=hp,c.CanvasSource=kn,c.CooperativeGesturesHandler=fp,c.DoubleClickZoomHandler=ii,c.DragPanHandler=Hh,c.DragRotateHandler=Yh,c.EdgeInsets=tr,c.FullscreenControl=class extends n.E{constructor(m={}){super(),this._onFullscreenChange=()=>{var e;let s=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=s?.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)s=s.shadowRoot.fullscreenElement;s===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,m&&m.container&&(m.container instanceof HTMLElement?this._container=m.container:n.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(m){return this._map=m,this._container||(this._container=this._map.getContainer()),this._controlContainer=A.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){A.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let m=this._fullscreenButton=A.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);A.create("span","maplibregl-ctrl-icon",m).setAttribute("aria-hidden","true"),m.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let m=this._getTitle();this._fullscreenButton.setAttribute("aria-label",m),this._fullscreenButton.title=m}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new n.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new n.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){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._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},c.GeoJSONSource=yi,c.GeolocateControl=class extends n.E{constructor(m){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new n.k("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new n.k("geolocate",e)),this._finish()}},this._updateCamera=e=>{let s=new n.N(e.coords.longitude,e.coords.latitude),d=e.coords.accuracy,p=this._map.getBearing(),g=n.e({bearing:p},this.options.fitBoundsOptions),v=oi.fromLngLat(s,d);this._map.fitBounds(v,g,{geolocateSource:!0})},this._updateMarker=e=>{if(e){let s=new n.N(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(s).addTo(this._map),this._userLocationDotMarker.setLngLat(s).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(this.options.trackUserLocation)if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&yo)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new n.k("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=A.create("button","maplibregl-ctrl-geolocate",this._container),A.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){n.w("Geolocation support is not available so the GeolocateControl will be disabled.");let s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s)}else{let s=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=A.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new il({element:this._dotElement}),this._circleElement=A.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new il({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",s=>{s.geolocateSource||this._watchState!=="ACTIVE_LOCK"||s.originalEvent&&s.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new n.k("trackuserlocationend")),this.fire(new n.k("userlocationlostfocus")))})}},this.options=n.e({},eu,m)}onAdd(m){return this._map=m,this._container=A.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return n._(this,arguments,void 0,function*(e=!1){if(Gn!==void 0&&!e)return Gn;if(window.navigator.permissions===void 0)return Gn=!!window.navigator.geolocation,Gn;try{Gn=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Gn=!!window.navigator.geolocation}return Gn})}().then(e=>this._finishSetupUI(e)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),A.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ia=0,yo=!1}_isOutOfMapMaxBounds(m){let e=this._map.getMaxBounds(),s=m.coords;return e&&(s.longitude<e.getWest()||s.longitude>e.getEast()||s.latitude<e.getSouth()||s.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){let m=this._map.getBounds(),e=m.getSouthEast(),s=m.getNorthEast(),d=e.distanceTo(s),p=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${p}px`,this._circleElement.style.height=`${p}px`}trigger(){if(!this._setup)return n.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new n.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ia--,yo=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new n.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new n.k("trackuserlocationstart")),this.fire(new n.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let m;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ia++,ia>1?(m={maximumAge:6e5,timeout:0},yo=!0):(m=this.options.positionOptions,yo=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,m)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},c.GlobeControl=class{constructor(){this._toggleProjection=()=>{var m;let e=(m=this._map.getProjection())===null||m===void 0?void 0:m.type;this._map.setProjection(e!=="mercator"&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var m;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((m=this._map.getProjection())===null||m===void 0?void 0:m.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(m){return this._map=m,this._container=A.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=A.create("button","maplibregl-ctrl-globe",this._container),A.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){A.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},c.Hash=Uh,c.ImageSource=Li,c.KeyboardHandler=$h,c.LngLatBounds=oi,c.LogoControl=Ir,c.Map=class extends nc{constructor(m){var e,s;n.cd.mark(n.ce.create);let d=Object.assign(Object.assign(Object.assign({},lc),m),{canvasContextAttributes:Object.assign(Object.assign({},lc.canvasContextAttributes),m.canvasContextAttributes)});if(d.minZoom!=null&&d.maxZoom!=null&&d.minZoom>d.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(d.minPitch!=null&&d.maxPitch!=null&&d.minPitch>d.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(d.minPitch!=null&&d.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(d.maxPitch!=null&&d.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");let p=new dr,g=new Pa;if(d.minZoom!==void 0&&p.setMinZoom(d.minZoom),d.maxZoom!==void 0&&p.setMaxZoom(d.maxZoom),d.minPitch!==void 0&&p.setMinPitch(d.minPitch),d.maxPitch!==void 0&&p.setMaxPitch(d.maxPitch),d.renderWorldCopies!==void 0&&p.setRenderWorldCopies(d.renderWorldCopies),super(p,g,{bearingSnap:d.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new mp,this._controls=[],this._mapId=n.a1(),this._contextLost=T=>{T.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new n.k("webglcontextlost",{originalEvent:T}))},this._contextRestored=T=>{this._setupPainter(),this.resize(),this._update(),this.fire(new n.k("webglcontextrestored",{originalEvent:T}))},this._onMapScroll=T=>{if(T.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=d.interactive,this._maxTileCacheSize=d.maxTileCacheSize,this._maxTileCacheZoomLevels=d.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},d.canvasContextAttributes),this._trackResize=d.trackResize===!0,this._bearingSnap=d.bearingSnap,this._centerClampedToGround=d.centerClampedToGround,this._refreshExpiredTiles=d.refreshExpiredTiles===!0,this._fadeDuration=d.fadeDuration,this._crossSourceCollisions=d.crossSourceCollisions===!0,this._collectResourceTiming=d.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},el),d.locale),this._clickTolerance=d.clickTolerance,this._overridePixelRatio=d.pixelRatio,this._maxCanvasSize=d.maxCanvasSize,this.transformCameraUpdate=d.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=d.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=ve.addThrottleControl(()=>this.isMoving()),this._requestManager=new De(d.transformRequest),typeof d.container=="string"){if(this._container=document.getElementById(d.container),!this._container)throw new Error(`Container '${d.container}' not found.`)}else{if(!(d.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=d.container}if(d.maxBounds&&this.setMaxBounds(d.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let T=!1,M=Vh(P=>{this._trackResize&&!this._removed&&(this.resize(P),this.redraw())},50);this._resizeObserver=new ResizeObserver(P=>{T?M(P):T=!0}),this._resizeObserver.observe(this._container)}this.handlers=new _t(this,d),this._hash=d.hash&&new Uh(typeof d.hash=="string"&&d.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:d.center,elevation:d.elevation,zoom:d.zoom,bearing:d.bearing,pitch:d.pitch,roll:d.roll}),d.bounds&&(this.resize(),this.fitBounds(d.bounds,n.e({},d.fitBoundsOptions,{duration:0}))));let v=typeof d.style=="string"||((s=(e=d.style)===null||e===void 0?void 0:e.projection)===null||s===void 0?void 0:s.type)!=="globe";this.resize(null,v),this._localIdeographFontFamily=d.localIdeographFontFamily,this._validateStyle=d.validateStyle,d.style&&this.setStyle(d.style,{localIdeographFontFamily:d.localIdeographFontFamily}),d.attributionControl&&this.addControl(new oc(typeof d.attributionControl=="boolean"?void 0:d.attributionControl)),d.maplibreLogo&&this.addControl(new Ir,d.logoPosition),this.on("style.load",()=>{if(v||this._resizeTransform(),this.transform.unmodified){let T=n.M(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(T)}}),this.on("data",T=>{this._update(T.dataType==="style"),this.fire(new n.k(`${T.dataType}data`,T))}),this.on("dataloading",T=>{this.fire(new n.k(`${T.dataType}dataloading`,T))}),this.on("dataabort",T=>{this.fire(new n.k("sourcedataabort",T))})}_getMapId(){return this._mapId}addControl(m,e){if(e===void 0&&(e=m.getDefaultPosition?m.getDefaultPosition():"top-right"),!m||!m.onAdd)return this.fire(new n.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let s=m.onAdd(this);this._controls.push(m);let d=this._controlPositions[e];return e.indexOf("bottom")!==-1?d.insertBefore(s,d.firstChild):d.appendChild(s),this}removeControl(m){if(!m||!m.onRemove)return this.fire(new n.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let e=this._controls.indexOf(m);return e>-1&&this._controls.splice(e,1),m.onRemove(this),this}hasControl(m){return this._controls.indexOf(m)>-1}calculateCameraOptionsFromTo(m,e,s,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(m,e,s,d)}resize(m,e=!0){let[s,d]=this._containerDimensions(),p=this._getClampedPixelRatio(s,d);if(this._resizeCanvas(s,d,p),this.painter.resize(s,d,p),this.painter.overLimit()){let v=this.painter.context.gl;this._maxCanvasSize=[v.drawingBufferWidth,v.drawingBufferHeight];let T=this._getClampedPixelRatio(s,d);this._resizeCanvas(s,d,T),this.painter.resize(s,d,T)}this._resizeTransform(e);let g=!this._moving;return g&&(this.stop(),this.fire(new n.k("movestart",m)).fire(new n.k("move",m))),this.fire(new n.k("resize",m)),g&&this.fire(new n.k("moveend",m)),this}_resizeTransform(m=!0){var e;let[s,d]=this._containerDimensions();this.transform.resize(s,d,m),(e=this._requestedCameraState)===null||e===void 0||e.resize(s,d,m)}_getClampedPixelRatio(m,e){let{0:s,1:d}=this._maxCanvasSize,p=this.getPixelRatio(),g=m*p,v=e*p;return Math.min(g>s?s/g:1,v>d?d/v:1)*p}getPixelRatio(){var m;return(m=this._overridePixelRatio)!==null&&m!==void 0?m:devicePixelRatio}setPixelRatio(m){this._overridePixelRatio=m,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(m){return this.transform.setMaxBounds(oi.convert(m)),this._update()}setMinZoom(m){if((m=m??-2)>=-2&&m<=this.transform.maxZoom)return this.transform.setMinZoom(m),this._update(),this.getZoom()<m&&this.setZoom(m),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(m){if((m=m??22)>=this.transform.minZoom)return this.transform.setMaxZoom(m),this._update(),this.getZoom()>m&&this.setZoom(m),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(m){if((m=m??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(m>=0&&m<=this.transform.maxPitch)return this.transform.setMinPitch(m),this._update(),this.getPitch()<m&&this.setPitch(m),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(m){if((m=m??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(m>=this.transform.minPitch)return this.transform.setMaxPitch(m),this._update(),this.getPitch()>m&&this.setPitch(m),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(m){return this.transform.setRenderWorldCopies(m),this._update()}project(m){return this.transform.locationToScreenPoint(n.N.convert(m),this.style&&this.terrain)}unproject(m){return this.transform.screenPointToLocation(n.P.convert(m),this.terrain)}isMoving(){var m;return this._moving||((m=this.handlers)===null||m===void 0?void 0:m.isMoving())}isZooming(){var m;return this._zooming||((m=this.handlers)===null||m===void 0?void 0:m.isZooming())}isRotating(){var m;return this._rotating||((m=this.handlers)===null||m===void 0?void 0:m.isRotating())}_createDelegatedListener(m,e,s){if(m==="mouseenter"||m==="mouseover"){let d=!1;return{layers:e,listener:s,delegates:{mousemove:g=>{let v=e.filter(M=>this.getLayer(M)),T=v.length!==0?this.queryRenderedFeatures(g.point,{layers:v}):[];T.length?d||(d=!0,s.call(this,new Zr(m,this,g.originalEvent,{features:T}))):d=!1},mouseout:()=>{d=!1}}}}if(m==="mouseleave"||m==="mouseout"){let d=!1;return{layers:e,listener:s,delegates:{mousemove:v=>{let T=e.filter(M=>this.getLayer(M));(T.length!==0?this.queryRenderedFeatures(v.point,{layers:T}):[]).length?d=!0:d&&(d=!1,s.call(this,new Zr(m,this,v.originalEvent)))},mouseout:v=>{d&&(d=!1,s.call(this,new Zr(m,this,v.originalEvent)))}}}}{let d=p=>{let g=e.filter(T=>this.getLayer(T)),v=g.length!==0?this.queryRenderedFeatures(p.point,{layers:g}):[];v.length&&(p.features=v,s.call(this,p),delete p.features)};return{layers:e,listener:s,delegates:{[m]:d}}}}_saveDelegatedListener(m,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[m]=this._delegatedListeners[m]||[],this._delegatedListeners[m].push(e)}_removeDelegatedListener(m,e,s){if(!this._delegatedListeners||!this._delegatedListeners[m])return;let d=this._delegatedListeners[m];for(let p=0;p<d.length;p++){let g=d[p];if(g.listener===s&&g.layers.length===e.length&&g.layers.every(v=>e.includes(v))){for(let v in g.delegates)this.off(v,g.delegates[v]);return void d.splice(p,1)}}}on(m,e,s){if(s===void 0)return super.on(m,e);let d=typeof e=="string"?[e]:e,p=this._createDelegatedListener(m,d,s);this._saveDelegatedListener(m,p);for(let g in p.delegates)this.on(g,p.delegates[g]);return{unsubscribe:()=>{this._removeDelegatedListener(m,d,s)}}}once(m,e,s){if(s===void 0)return super.once(m,e);let d=typeof e=="string"?[e]:e,p=this._createDelegatedListener(m,d,s);for(let g in p.delegates){let v=p.delegates[g];p.delegates[g]=(...T)=>{this._removeDelegatedListener(m,d,s),v(...T)}}this._saveDelegatedListener(m,p);for(let g in p.delegates)this.once(g,p.delegates[g]);return this}off(m,e,s){return s===void 0?super.off(m,e):(this._removeDelegatedListener(m,typeof e=="string"?[e]:e,s),this)}queryRenderedFeatures(m,e){if(!this.style)return[];let s,d=m instanceof n.P||Array.isArray(m),p=d?m:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(d?{}:m)||{},p instanceof n.P||typeof p[0]=="number")s=[n.P.convert(p)];else{let g=n.P.convert(p[0]),v=n.P.convert(p[1]);s=[g,new n.P(v.x,g.y),v,new n.P(g.x,v.y),g]}return this.style.queryRenderedFeatures(s,e,this.transform)}querySourceFeatures(m,e){return this.style.querySourceFeatures(m,e)}setStyle(m,e){return(e=n.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&m?(this._diffStyle(m,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(m,e))}setTransformRequest(m){return this._requestManager.setTransformRequest(m),this}_getUIString(m){let e=this._locale[m];if(e==null)throw new Error(`Missing UI string '${m}'`);return e}_updateStyle(m,e){var s,d;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(m,e));let p=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!m)),m?(this.style=new ch(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof m=="string"?this.style.loadURL(m,e,p):this.style.loadJSON(m,e,p),this):((d=(s=this.style)===null||s===void 0?void 0:s.projection)===null||d===void 0||d.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new ch(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(m,e){if(typeof m=="string"){let s=this._requestManager.transformRequest(m,"Style");n.h(s,new AbortController).then(d=>{this._updateDiff(d.data,e)}).catch(d=>{d&&this.fire(new n.j(d))})}else typeof m=="object"&&this._updateDiff(m,e)}_updateDiff(m,e){try{this.style.setState(m,e)&&this._update(!0)}catch(s){n.w(`Unable to perform style diff: ${s.message||s.error||s}. Rebuilding the style from scratch.`),this._updateStyle(m,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():n.w("There is no style added to the map.")}addSource(m,e){return this._lazyInitEmptyStyle(),this.style.addSource(m,e),this._update(!0)}isSourceLoaded(m){let e=this.style&&this.style.sourceCaches[m];if(e!==void 0)return e.loaded();this.fire(new n.j(new Error(`There is no source with ID '${m}'`)))}setTerrain(m){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),m){let e=this.style.sourceCaches[m.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${m.source}`);this.terrain===null&&e.reload();for(let s in this.style._layers){let d=this.style._layers[s];d.type==="hillshade"&&d.source===m.source&&n.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Qa(this.painter,e,m),this.painter.renderToTexture=new gp(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=s=>{s.dataType==="style"?this.terrain.sourceCache.freeRtt():s.dataType==="source"&&s.tile&&(s.sourceId!==m.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),this.terrain.sourceCache.freeRtt(s.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new n.k("terrain",{terrain:m})),this}getTerrain(){var m,e;return(e=(m=this.terrain)===null||m===void 0?void 0:m.options)!==null&&e!==void 0?e:null}areTilesLoaded(){let m=this.style&&this.style.sourceCaches;for(let e in m){let s=m[e]._tiles;for(let d in s){let p=s[d];if(p.state!=="loaded"&&p.state!=="errored")return!1}}return!0}removeSource(m){return this.style.removeSource(m),this._update(!0)}getSource(m){return this.style.getSource(m)}addImage(m,e,s={}){let{pixelRatio:d=1,sdf:p=!1,stretchX:g,stretchY:v,content:T,textFitWidth:M,textFitHeight:P}=s;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||n.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new n.j(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`")));{let{width:D,height:F,data:O}=e,V=e;return this.style.addImage(m,{data:new n.R({width:D,height:F},new Uint8Array(O)),pixelRatio:d,stretchX:g,stretchY:v,content:T,textFitWidth:M,textFitHeight:P,sdf:p,version:0,userImage:V}),V.onAdd&&V.onAdd(this,m),this}}{let{width:D,height:F,data:O}=E.getImageData(e);this.style.addImage(m,{data:new n.R({width:D,height:F},O),pixelRatio:d,stretchX:g,stretchY:v,content:T,textFitWidth:M,textFitHeight:P,sdf:p,version:0})}}updateImage(m,e){let s=this.style.getImage(m);if(!s)return this.fire(new n.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let d=e instanceof HTMLImageElement||n.b(e)?E.getImageData(e):e,{width:p,height:g,data:v}=d;if(p===void 0||g===void 0)return this.fire(new n.j(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(p!==s.data.width||g!==s.data.height)return this.fire(new n.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));let T=!(e instanceof HTMLImageElement||n.b(e));return s.data.replace(v,T),this.style.updateImage(m,s),this}getImage(m){return this.style.getImage(m)}hasImage(m){return m?!!this.style.getImage(m):(this.fire(new n.j(new Error("Missing required image id"))),!1)}removeImage(m){this.style.removeImage(m)}loadImage(m){return ve.getImage(this._requestManager.transformRequest(m,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(m,e){return this._lazyInitEmptyStyle(),this.style.addLayer(m,e),this._update(!0)}moveLayer(m,e){return this.style.moveLayer(m,e),this._update(!0)}removeLayer(m){return this.style.removeLayer(m),this._update(!0)}getLayer(m){return this.style.getLayer(m)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(m,e,s){return this.style.setLayerZoomRange(m,e,s),this._update(!0)}setFilter(m,e,s={}){return this.style.setFilter(m,e,s),this._update(!0)}getFilter(m){return this.style.getFilter(m)}setPaintProperty(m,e,s,d={}){return this.style.setPaintProperty(m,e,s,d),this._update(!0)}getPaintProperty(m,e){return this.style.getPaintProperty(m,e)}setLayoutProperty(m,e,s,d={}){return this.style.setLayoutProperty(m,e,s,d),this._update(!0)}getLayoutProperty(m,e){return this.style.getLayoutProperty(m,e)}setGlyphs(m,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(m,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(m,e,s={}){return this._lazyInitEmptyStyle(),this.style.addSprite(m,e,s,d=>{d||this._update(!0)}),this}removeSprite(m){return this._lazyInitEmptyStyle(),this.style.removeSprite(m),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(m,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(m,e,s=>{s||this._update(!0)}),this}setLight(m,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(m,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(m,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(m,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(m,e){return this.style.setFeatureState(m,e),this._update()}removeFeatureState(m,e){return this.style.removeFeatureState(m,e),this._update()}getFeatureState(m){return this.style.getFeatureState(m)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let m=0,e=0;return this._container&&(m=this._container.clientWidth||400,e=this._container.clientHeight||300),[m,e]}_setupContainer(){let m=this._container;m.classList.add("maplibregl-map");let e=this._canvasContainer=A.create("div","maplibregl-canvas-container",m);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=A.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let s=this._containerDimensions(),d=this._getClampedPixelRatio(s[0],s[1]);this._resizeCanvas(s[0],s[1],d);let p=this._controlContainer=A.create("div","maplibregl-control-container",m),g=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(v=>{g[v]=A.create("div",`maplibregl-ctrl-${v} `,p)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(m,e,s){this._canvas.width=Math.floor(s*m),this._canvas.height=Math.floor(s*e),this._canvas.style.width=`${m}px`,this._canvas.style.height=`${e}px`}_setupPainter(){let m=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),e=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{e={requestedAttributes:m},d&&(e.statusMessage=d.statusMessage,e.type=d.type)},{once:!0});let s=null;if(s=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,m):this._canvas.getContext("webgl2",m)||this._canvas.getContext("webgl",m),!s){let d="Failed to initialize WebGL";throw e?(e.message=d,new Error(JSON.stringify(e))):new Error(d)}this.painter=new go(s,this.transform),z.testSupport(s)}migrateProjection(m,e){super.migrateProjection(m,e),this.painter.transform=m,this.fire(new n.k("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(m){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||m,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(m){return this._update(),this._renderTaskQueue.add(m)}_cancelRenderFrame(m){this._renderTaskQueue.remove(m)}_render(m){var e,s,d,p,g;let v=this._idleTriggered?this._fadeDuration:0,T=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(m),this._removed)return;let M=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let F=this.transform.zoom,O=E.now();this.style.zoomHistory.update(F,O);let V=new n.z(F,{now:O,fadeDuration:v,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),q=V.crossFadingFactor();q===1&&q===this._crossFadingFactor||(M=!0,this._crossFadingFactor=q),this.style.update(V)}let P=((s=this.style.projection)===null||s===void 0?void 0:s.transitionState)>0!==T;(d=this.style.projection)===null||d===void 0||d.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((p=this.style.projection)===null||p===void 0?void 0:p.transitionState,(g=this.style.projection)===null||g===void 0?void 0:g.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||P)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,v,this._crossSourceCollisions,P),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:v,showPadding:this.showPadding}),this.fire(new n.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,n.cd.mark(n.ce.load),this.fire(new n.k("load"))),this.style&&(this.style.hasTransitions()||M)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let D=this._sourcesDirty||this._styleDirty||this._placementDirty;return D||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new n.k("idle")),!this._loaded||this._fullyLoaded||D||(this._fullyLoaded=!0,n.cd.mark(n.ce.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var m;this._hash&&this._hash.remove();for(let s of this._controls)s.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),ve.removeThrottleControl(this._imageQueueHandle),(m=this._resizeObserver)===null||m===void 0||m.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e?.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),A.remove(this._canvasContainer),A.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),n.cd.clearMetrics(),this._removed=!0,this.fire(new n.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(m=>{n.cd.frame(m),this._frameRequest=null,this._render(m)}).catch(m=>{if(!n.cf(m)&&!function(e){return e.message===Ga}(m))throw m}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(m){this._showTileBoundaries!==m&&(this._showTileBoundaries=m,this._update())}get showPadding(){return!!this._showPadding}set showPadding(m){this._showPadding!==m&&(this._showPadding=m,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(m){this._showCollisionBoxes!==m&&(this._showCollisionBoxes=m,m?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(m){this._showOverdrawInspector!==m&&(this._showOverdrawInspector=m,this._update())}get repaint(){return!!this._repaint}set repaint(m){this._repaint!==m&&(this._repaint=m,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(m){this._vertices=m,this._update()}get version(){return ac}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(m){return this._lazyInitEmptyStyle(),this.style.setProjection(m),this._update(!0)}},c.MapMouseEvent=Zr,c.MapTouchEvent=qr,c.MapWheelEvent=_o,c.Marker=il,c.NavigationControl=class{constructor(m){this._updateZoomButtons=()=>{let e=this._map.getZoom(),s=e===this._map.getMaxZoom(),d=e===this._map.getMinZoom();this._zoomInButton.disabled=s,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",s.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,s)=>{let d=this._map._getUIString(`NavigationControl.${s}`);e.title=d,e.setAttribute("aria-label",d)},this.options=n.e({},Jh,m),this._container=A.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),A.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),A.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=A.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(m){return this._map=m,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Qh(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){A.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.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(m,e){let s=A.create("button",m,this._container);return s.type="button",s.addEventListener("click",e),s}},c.Popup=class extends n.E{constructor(m){super(),this.remove=()=>(this._content&&A.remove(this._content),this._container&&(A.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),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new n.k("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{var s;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=A.create("div","maplibregl-popup",this._map.getContainer()),this._tip=A.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let T of this.options.className.split(" "))this._container.classList.add(T);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?cc(this._lngLat,this._flatPos,this._map.transform):(s=this._lngLat)===null||s===void 0?void 0:s.wrap(),this._trackPointer&&!e)return;let d=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let p=this.options.anchor,g=dc(this.options.offset);if(!p){let T=this._container.offsetWidth,M=this._container.offsetHeight,P;P=d.y+g.bottom.y<M?["top"]:d.y>this._map.transform.height-M?["bottom"]:[],d.x<T/2?P.push("left"):d.x>this._map.transform.width-T/2&&P.push("right"),p=P.length===0?"bottom":P.join("-")}let v=d.add(g[p]);this.options.subpixelPositioning||(v=v.round()),A.setTransform(this._container,`${tl[p]} translate(${v.x}px,${v.y}px)`),hc(this._container,p,"popup")},this._onClose=()=>{this.remove()},this.options=n.e(Object.create(iu),m)}addTo(m){return this._map&&this.remove(),this._map=m,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"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new n.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(m){return this._lngLat=n.N.convert(m),this._pos=null,this._flatPos=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"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(m){return this.setDOMContent(document.createTextNode(m))}setHTML(m){let e=document.createDocumentFragment(),s=document.createElement("body"),d;for(s.innerHTML=m;d=s.firstChild,d;)e.appendChild(d);return this.setDOMContent(e)}getMaxWidth(){var m;return(m=this._container)===null||m===void 0?void 0:m.style.maxWidth}setMaxWidth(m){return this.options.maxWidth=m,this._update(),this}setDOMContent(m){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=A.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(m),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(m){return this._container&&this._container.classList.add(m),this}removeClassName(m){return this._container&&this._container.classList.remove(m),this}setOffset(m){return this.options.offset=m,this._update(),this}toggleClassName(m){if(this._container)return this._container.classList.toggle(m)}setSubpixelPositioning(m){this.options.subpixelPositioning=m}_createCloseButton(){this.options.closeButton&&(this._closeButton=A.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let m=this._container.querySelector(uc);m&&m.focus()}},c.RasterDEMTileSource=$i,c.RasterTileSource=Tr,c.ScaleControl=class{constructor(m){this._onMove=()=>{rl(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,rl(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},tu),m)}getDefaultPosition(){return"bottom-left"}onAdd(m){return this._map=m,this._container=A.create("div","maplibregl-ctrl maplibregl-ctrl-scale",m.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){A.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},c.ScrollZoomHandler=ys,c.Style=ch,c.TerrainControl=class{constructor(m){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=m}onAdd(m){return this._map=m,this._container=A.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=A.create("button","maplibregl-ctrl-terrain",this._container),A.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){A.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},c.TwoFingersTouchPitchHandler=Wh,c.TwoFingersTouchRotateHandler=qh,c.TwoFingersTouchZoomHandler=up,c.TwoFingersTouchZoomRotateHandler=Kh,c.VectorTileSource=Ln,c.VideoSource=rn,c.addSourceType=(m,e)=>n._(void 0,void 0,void 0,function*(){if(Dn(m))throw new Error(`A source type called "${m}" already exists.`);((s,d)=>{nn[s]=d})(m,e)}),c.clearPrewarmedResources=function(){let m=jt;m&&(m.isPreloaded()&&m.numActive()===1?(m.release(qt),jt=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()"))},c.createTileMesh=Zo,c.getMaxParallelImageRequests=function(){return n.a.MAX_PARALLEL_IMAGE_REQUESTS},c.getRTLTextPluginStatus=function(){return on().getRTLTextPluginStatus()},c.getVersion=function(){return ru},c.getWorkerCount=function(){return Ft.workerCount},c.getWorkerUrl=function(){return n.a.WORKER_URL},c.importScriptInWorkers=function(m){return Ai().broadcast("IS",m)},c.prewarm=function(){et().acquire(qt)},c.setMaxParallelImageRequests=function(m){n.a.MAX_PARALLEL_IMAGE_REQUESTS=m},c.setRTLTextPlugin=function(m,e){return on().setRTLTextPlugin(m,e)},c.setWorkerCount=function(m){Ft.workerCount=m},c.setWorkerUrl=function(m){n.a.WORKER_URL=m}});var l=h;return l})});var Pl=Np((Yj,Mw)=>{var jM="Expected a function",Tw=NaN,NM="[object Symbol]",GM=/^\s+|\s+$/g,VM=/^[-+]0x[0-9a-f]+$/i,UM=/^0b[01]+$/i,ZM=/^0o[0-7]+$/i,qM=parseInt,WM=typeof global=="object"&&global&&global.Object===Object&&global,$M=typeof self=="object"&&self&&self.Object===Object&&self,XM=WM||$M||Function("return this")(),HM=Object.prototype,YM=HM.toString,KM=Math.max,JM=Math.min,m0=function(){return XM.Date.now()};function QM(h,t,r){var l,c,n,x,b,S,R=0,E=!1,A=!1,z=!0;if(typeof h!="function")throw new TypeError(jM);t=Cw(t)||0,g0(r)&&(E=!!r.leading,A="maxWait"in r,n=A?KM(Cw(r.maxWait)||0,t):n,z="trailing"in r?!!r.trailing:z);function W(Re){var tt=l,Je=c;return l=c=void 0,R=Re,x=h.apply(Je,tt),x}function re(Re){return R=Re,b=setTimeout(be,t),E?W(Re):x}function me(Re){var tt=Re-S,Je=Re-R,He=t-tt;return A?JM(He,n-Je):He}function ge(Re){var tt=Re-S,Je=Re-R;return S===void 0||tt>=t||tt<0||A&&Je>=n}function be(){var Re=m0();if(ge(Re))return ve(Re);b=setTimeout(be,me(Re))}function ve(Re){return b=void 0,z&&l?W(Re):(l=c=void 0,x)}function De(){b!==void 0&&clearTimeout(b),R=0,l=S=c=b=void 0}function ke(){return b===void 0?x:ve(m0())}function je(){var Re=m0(),tt=ge(Re);if(l=arguments,c=this,S=Re,tt){if(b===void 0)return re(S);if(A)return b=setTimeout(be,t),W(S)}return b===void 0&&(b=setTimeout(be,t)),x}return je.cancel=De,je.flush=ke,je}function g0(h){var t=typeof h;return!!h&&(t=="object"||t=="function")}function eI(h){return!!h&&typeof h=="object"}function tI(h){return typeof h=="symbol"||eI(h)&&YM.call(h)==NM}function Cw(h){if(typeof h=="number")return h;if(tI(h))return Tw;if(g0(h)){var t=typeof h.valueOf=="function"?h.valueOf():h;h=g0(t)?t+"":t}if(typeof h!="string")return h===0?h:+h;h=h.replace(GM,"");var r=UM.test(h);return r||ZM.test(h)?qM(h.slice(2),r?2:8):VM.test(h)?Tw:+h}Mw.exports=QM});var zw=Np((v4,Fw)=>{var Dw="Expected a function",Lw=NaN,nI="[object Symbol]",sI=/^\s+|\s+$/g,oI=/^[-+]0x[0-9a-f]+$/i,aI=/^0b[01]+$/i,lI=/^0o[0-7]+$/i,cI=parseInt,hI=typeof global=="object"&&global&&global.Object===Object&&global,uI=typeof self=="object"&&self&&self.Object===Object&&self,dI=hI||uI||Function("return this")(),pI=Object.prototype,fI=pI.toString,mI=Math.max,gI=Math.min,w0=function(){return dI.Date.now()};function _I(h,t,r){var l,c,n,x,b,S,R=0,E=!1,A=!1,z=!0;if(typeof h!="function")throw new TypeError(Dw);t=kw(t)||0,Wf(r)&&(E=!!r.leading,A="maxWait"in r,n=A?mI(kw(r.maxWait)||0,t):n,z="trailing"in r?!!r.trailing:z);function W(Re){var tt=l,Je=c;return l=c=void 0,R=Re,x=h.apply(Je,tt),x}function re(Re){return R=Re,b=setTimeout(be,t),E?W(Re):x}function me(Re){var tt=Re-S,Je=Re-R,He=t-tt;return A?gI(He,n-Je):He}function ge(Re){var tt=Re-S,Je=Re-R;return S===void 0||tt>=t||tt<0||A&&Je>=n}function be(){var Re=w0();if(ge(Re))return ve(Re);b=setTimeout(be,me(Re))}function ve(Re){return b=void 0,z&&l?W(Re):(l=c=void 0,x)}function De(){b!==void 0&&clearTimeout(b),R=0,l=S=c=b=void 0}function ke(){return b===void 0?x:ve(w0())}function je(){var Re=w0(),tt=ge(Re);if(l=arguments,c=this,S=Re,tt){if(b===void 0)return re(S);if(A)return b=setTimeout(be,t),W(S)}return b===void 0&&(b=setTimeout(be,t)),x}return je.cancel=De,je.flush=ke,je}function yI(h,t,r){var l=!0,c=!0;if(typeof h!="function")throw new TypeError(Dw);return Wf(r)&&(l="leading"in r?!!r.leading:l,c="trailing"in r?!!r.trailing:c),_I(h,t,{leading:l,maxWait:t,trailing:c})}function Wf(h){var t=typeof h;return!!h&&(t=="object"||t=="function")}function xI(h){return!!h&&typeof h=="object"}function vI(h){return typeof h=="symbol"||xI(h)&&fI.call(h)==nI}function kw(h){if(typeof h=="number")return h;if(vI(h))return Lw;if(Wf(h)){var t=typeof h.valueOf=="function"?h.valueOf():h;h=Wf(t)?t+"":t}if(typeof h!="string")return h===0?h:+h;h=h.replace(sI,"");var r=aI.test(h);return r||lI.test(h)?cI(h.slice(2),r?2:8):oI.test(h)?Lw:+h}Fw.exports=yI});var Yf={};dg(Yf,{CopyrightControl:()=>Xb,Layer:()=>Hf,MaplibreLayer:()=>Pw,MaplibreStyleLayer:()=>Aw,RealtimeAPI:()=>Mu,RealtimeLayer:()=>Nw,RealtimeModes:()=>or,RoutingAPI:()=>Iu,RoutingControl:()=>yw,StopFinderControl:()=>bw,StopsAPI:()=>Eu,VECTOR_TILE_FEATURE_PROPERTY:()=>Bc,VectorLayer:()=>Uw,compareDepartures:()=>Ku,createCanvas:()=>ws,createRealtimeFilters:()=>Pg,debounceDeparturesMessages:()=>T_,debounceWebsocketMessages:()=>Cu,fullTrajectoryDelayStyle:()=>Ow,fullTrajectoryStyle:()=>Xf,getCircleCanvas:()=>Cg,getDelayBgCanvas:()=>Sg,getDelayTextCanvas:()=>Tg,getFeatureInfoAtCoordinate:()=>Zw,getHoursAndMinutes:()=>Cv,getLayersAsFlatArray:()=>Ru,getMapGlCopyrights:()=>Pu,getTextCanvas:()=>Mg,getUTCDateString:()=>Sv,getUTCTimeString:()=>Tv,getUrlWithParams:()=>ul,getVehiclePosition:()=>Hu,pad:()=>Up,realtimeConfig:()=>Oc,realtimeDefaultStyle:()=>dl,realtimeDelayStyle:()=>Ig,realtimeSimpleStyle:()=>Eg,removeDuplicate:()=>pl,renderTrajectories:()=>Yu,routingStyle:()=>jw,sortAndFilterDepartures:()=>Ju,sortByDelay:()=>Rg});var q2=(h,t,r=100)=>{let l={},c={},n=[];return x=>{let{content:b,source:S}=x;l[S]&&window.clearTimeout(l[S]),t?c[t(b)]=b:n.push(b),l[S]=window.setTimeout(()=>{let R=t?Object.values(c):n;h(R)},r)}},Cu=q2;var W2=(h,t)=>h===t.SCHEMATIC?"_schematic":"",bs=W2;var pg=class h{constructor(){this.defineProperties()}static getRequestString(t,r={}){let l=`${t} ${r.channel}`;return l+=r.args?` ${r.args}`:"",l+=r.id?` ${r.id}`:"",l.trim()}addEvents(t,r){this.websocket&&(this.websocket.addEventListener("message",t),r&&(this.websocket.addEventListener("error",r),this.websocket.addEventListener("close",r)))}close(){this.websocket&&(this.open||this.connecting)&&(this.websocket.onclose=()=>{},this.websocket.close(),this.messagesOnOpen=[])}connect(t,r=()=>{}){if(!t){this.websocket?.close();return}if(this.websocket){if(this.websocket.url===t&&(this.open||this.connecting))return;this.websocket.url!==t&&(this.open||this.connecting)&&this.websocket.close()}this.websocket=new WebSocket(t),this.open?(r(),this.subscribePreviousSubscriptions()):this.websocket.addEventListener("open",()=>{r(),this.subscribePreviousSubscriptions()})}defineProperties(){Object.defineProperties(this,{closed:{get:()=>!this.websocket||this.websocket.readyState===this.websocket.CLOSED},closing:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.CLOSING)},connecting:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.CONNECTING)},messagesOnOpen:{value:[],writable:!0},open:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.OPEN)},subscribed:{value:{},writable:!0},subscriptions:{value:[],writable:!0}})}get(t,r,l){let c=h.getRequestString("GET",t);this.send(c);let n=E=>(...A)=>{E(...A);let z=this.requests.findIndex(me=>c===me.requestString&&r===me.cb),{onErrorCb:W,onMessageCb:re}=this.requests[z];this.removeEvents(re,W),this.requests.splice(z,1)},{onErrorCb:x,onMessageCb:b}=this.listen(t,n(r),l&&n(l));this.requests||(this.requests=[]);let S=this.requests.findIndex(E=>c===E.requestString&&r===E.cb),R={cb:r,errorCb:l,onErrorCb:x,onMessageCb:b,params:t,requestString:c};S>-1?this.requests[S]=R:this.requests.push(R)}listen(t,r,l){this.unlisten(t,r);let c=n=>{let x;try{x=JSON.parse(n.data)}catch(R){console.error("WebSocket: unable to parse JSON data",R,n.data);return}let b=t.channel;b+=t.args?` ${t.args}`:"";let S;x.source==="buffer"?S=x.content:S=[x],S.forEach(R=>{R?.source===b&&(!t.id||t.id===x.client_reference)&&r(R)})};return this.addEvents(c,l),{onErrorCb:l,onMessageCb:c}}removeEvents(t,r){this.websocket&&(this.websocket.removeEventListener("message",t),r&&(this.websocket.removeEventListener("error",r),this.websocket.removeEventListener("close",r)))}send(t){if(!this.websocket||this.closed||this.closing)return;let r=()=>{this.websocket?.send(t)};this.open?this.messagesOnOpen.includes(t)||r():this.messagesOnOpen.includes(t)||(this.messagesOnOpen.push(t),this.websocket.addEventListener("open",()=>{this.messagesOnOpen=[],r()}),this.websocket.addEventListener("close",()=>{this.messagesOnOpen=[]}))}subscribe(t,r,l,c=!1){let{onErrorCb:n,onMessageCb:x}=this.listen(t,r,l),b=h.getRequestString("",t),S=this.subscriptions.findIndex(E=>t.channel===E.params.channel&&r===E.cb),R={cb:r,errorCb:l,onErrorCb:n,onMessageCb:x,params:t,quiet:c};S>-1?this.subscriptions[S]=R:this.subscriptions.push(R),this.subscribed[b]||(R.quiet||(this.send(`GET ${b}`),this.send(`SUB ${b}`)),this.subscribed[b]=!0)}subscribePreviousSubscriptions(){Object.keys(this.subscribed).forEach(t=>{this.subscribed[t]=!1}),[...this.subscriptions].forEach(t=>{this.subscribe(t.params,t.cb,t.errorCb,t.quiet)})}unlisten(t,r){[...this.subscriptions||[],...this.requests||[]].filter(l=>l.params.channel===t.channel&&(!r||l.cb===r)).forEach(({onErrorCb:l,onMessageCb:c})=>{this.removeEvents(c,l)})}unsubscribe(t,r){let l=this.subscriptions.filter(c=>c.params.channel===t&&(!r||c.cb===r));l.forEach(({onErrorCb:c,onMessageCb:n})=>{this.removeEvents(n,c)}),this.subscriptions=this.subscriptions.filter(c=>c.params.channel!==t||r&&c.cb!==r),t&&this.subscribed[t]&&!this.subscriptions.find(c=>c.params.channel===t)&&l.find(c=>!c.quiet)&&(this.send(`DEL ${t}`),this.subscribed[t]=!1)}},bv=pg;var or={RAW:"raw",SCHEMATIC:"schematic",TOPOGRAPHIC:"topographic"},fg=class{constructor(t={}){this.version="2";let r=t;typeof t=="string"&&(r={url:t});let{apiKey:l}=r,{url:c}=r,n=new bv,x="";l&&!c?.includes("key=")&&(x=`?key=${l}`),this._url=(c||"wss://api.geops.io/tracker-ws/v1/")+x,this._buffer=r.buffer||[100,100],this._bbox=r.bbox,this.version=r.version||"2",this.pingIntervalMs=r.pingIntervalMs||1e4,this.reconnectTimeoutMs=r.reconnectTimeoutMs||100,this.wsApi=n}get bbox(){return this._bbox}set bbox(t){JSON.stringify(t)!==JSON.stringify(this._bbox)&&(this._bbox=t,this.wsApi&&this._bbox&&this.wsApi.send(`BBOX ${this._bbox.join(" ")}`))}get buffer(){return this._buffer}set buffer(t){JSON.stringify(t)!==JSON.stringify(this._buffer)&&(this._buffer=t,this.wsApi&&this._buffer&&this.wsApi.send(`BUFFER ${this._buffer.join(" ")}`))}get url(){return this._url}set url(t){this._url!==t&&(this._url=t,(this.wsApi.open||this.wsApi.connecting)&&this.open())}close(){this.wsApi.close()}get(t){let r=t;return typeof t=="string"&&(r={channel:t}),new Promise((l,c)=>{this.wsApi.get(r,l,c)})}getFullTrajectory(t,r,l){let c="";this.version==="1"&&(c=bs(r,or));let n=[`full_trajectory${c}`];return t&&n.push(t),(!r||r===or.TOPOGRAPHIC)&&l&&n.push(`gen${l}`),this.get(n.join("_"))}getStation(t,r){let l={args:t,channel:`station${bs(r,or)}`};return this.get(l)}getStations(t,r=100){return new Promise(l=>{this.get(`station${bs(t,or)}`).then(Cu(l,void 0,r))})}getStopSequence(t){return this.get(`stopsequence_${t}`)}getTrajectory(t,r){return this.get(`partial_trajectory${bs(r,or)}_${t}`)}onClose(){window.clearTimeout(this.pingInterval),window.clearTimeout(this.reconnectTimeout),this.reconnectTimeoutMs&&(this.reconnectTimeout=window.setTimeout(()=>this.open(),this.reconnectTimeoutMs))}onOpen(){this.bbox&&this.wsApi.send(`BBOX ${this.bbox.join(" ")}`),this.buffer&&this.wsApi.send(`BUFFER ${this.buffer.join(" ")}`),this.pingIntervalMs&&(window.clearInterval(this.pingInterval),this.pingInterval=window.setInterval(()=>{this.wsApi.send("PING")},this.pingIntervalMs))}open(){this.wsApi.connect(this.url,this.onOpen.bind(this)),this.wsApi.websocket&&(this.wsApi.websocket.onclose=()=>{this.onClose()})}reset(){this.wsApi.send("RESET")}subscribe(t,r,l=()=>{},c=!1){!t||!r||this.wsApi.subscribe({channel:t},r,l,c)}subscribeDeletedVehicles(t,r,l=()=>{},c=!1){this.unsubscribeDeletedVehicles(r);let n="";this.version==="1"&&(n=bs(t,or)),this.subscribe(`deleted_vehicles${n}`,r,l,c)}subscribeDepartures(t,r,l=()=>{},c=!1){this.subscribeTimetable(t,r,l,c)}subscribeDisruptions(t,r,l=()=>{},c=!1){this.subscribeNewsticker(t,r,l,c)}subscribeExtraGeoms(t,r=()=>{},l=!1){this.subscribe("extra_geoms",t,r,l)}subscribeFullTrajectory(t,r,l,c=()=>{},n=!1){let x="";this.version==="1"&&(x=bs(r,or)),this.subscribe(`full_trajectory${x}_${t}`,l,c,n)}subscribeHealthCheck(t,r=()=>{},l=!1){this.subscribe("healthcheck",t,r,l)}subscribeNewsticker(t,r,l=()=>{},c=!1){this.subscribe(`${t}_newsticker`,r,l,c)}subscribeStations(t,r,l=()=>{},c=!1){this.subscribe(`station${bs(t,or)}`,r,l,c)}subscribeStopSequence(t,r,l=()=>{},c=!1){this.subscribe(`stopsequence_${t}`,r,l,c)}subscribeTimetable(t,r,l=()=>{},c=!1){this.subscribe(`timetable_${t}`,r,l,c)}subscribeTrajectory(t,r,l=()=>{},c=!1){this.unsubscribeTrajectory(r);let n="";this.version==="1"&&(n=bs(t,or)),this.subscribe(`trajectory${n}`,r,l,c)}unsubscribe(t,r="",l){let c=bs(or.SCHEMATIC,or),n=bs(or.TOPOGRAPHIC,or);this.wsApi.unsubscribe(`${t}${c}${r||""}`,l),this.wsApi.unsubscribe(`${t}${n}${r||""}`,l)}unsubscribeDeletedVehicles(t){this.unsubscribe("deleted_vehicles","",t)}unsubscribeDepartures(t,r){this.unsubscribeTimetable(t,r)}unsubscribeDisruptions(t,r){this.unsubscribeNewsticker(t,r)}unsubscribeExtraGeoms(t){this.unsubscribe("extra_geoms","",t)}unsubscribeFullTrajectory(t,r){this.unsubscribe("full_trajectory",`_${t}`,r)}unsubscribeHealthCheck(t){this.unsubscribe("healthcheck","",t)}unsubscribeNewsticker(t,r){this.unsubscribe(`${t}_newsticker`,"",r)}unsubscribeStations(t){this.unsubscribe("station","",t)}unsubscribeStopSequence(t,r){this.unsubscribe("stopsequence",`_${t}`,r)}unsubscribeTimetable(t,r){this.unsubscribe(`timetable_${t}`,"",r)}unsubscribeTrajectory(t){this.unsubscribe("trajectory","",t)}},Mu=fg;var $2=(h,t)=>{let r=new URL(h);return Object.entries(t||{}).forEach(([c,n])=>{n!=null&&r.searchParams.set(c,n)}),r},ul=$2;var mg=class{constructor(t){this.url=t.url,this.apiKey=t.apiKey}async fetch(t,r,l){if(!this.url)throw new Error(`No url defined for request to ${this.url}/${t}`);if(!this.url&&!this.apiKey&&!this.url.includes("key="))throw new Error(`No apiKey defined for request to ${this.url}`);let c=r||{},n=ul(`${this.url}${t||""}`,{key:this.apiKey,...c}),b=await(await fetch(n.toString(),l)).json();if(b.error)throw new Error(b.error);return b}},Gp=mg;var gg=class extends Gp{constructor(t={}){super({url:"https://api.geops.io/routing/v1/",...t})}route(t,r){return this.fetch("",t,r)}},Iu=gg;var _g=class extends Gp{constructor(t={}){super({...t,url:t.url||"https://api.geops.io/stops/v1/"})}search(t,r){return this.fetch("",t,r)}},Eu=_g;var X2=(h,t)=>{let r=null;return typeof window>"u"?null:(typeof document<"u"&&document?.createElement?(r=document.createElement("canvas"),r.width=h,r.height=t):OffscreenCanvas?r=new OffscreenCanvas(h,t):console.error("We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported"),r)},ws=X2;var yg={},Sg=(h,t,r)=>{let l=`${h}, ${t}, ${r}`;if(!yg[l]){let c=ws(h*2,h*2);if(c){let n=c.getContext("2d");if(!n)return null;n.beginPath(),n.arc(h,h,t,0,2*Math.PI,!1),n.fillStyle=r,n.filter="blur(1px)",n.fill(),yg[l]=c}}return yg[l]},xg={},Tg=(h,t,r,l,c="#000",n=1)=>{let x=`${h}, ${r}, ${l}, ${c}, ${n}`;if(!xg[x]){let b=ws(Math.ceil(h.length*t),Math.ceil(t+8*n));if(b){let S=b.getContext("2d");if(!S)return null;S.font=r,S.textAlign="left",S.textBaseline="middle",S.font=r,S.fillStyle=l,S.strokeStyle=c,S.lineWidth=1.5*n,S.strokeText(h,0,t),S.fillText(h,0,t),xg[x]=b}}return xg[x]},vg={},Cg=(h,t,r,l,c,n)=>{let x=`${h}, ${t}, ${r}, ${l}, ${c}, ${n}`;if(!vg[x]){let b=ws(h*2,h*2);if(b){let S=b.getContext("2d");if(!S)return null;S.fillStyle=r,l&&(S.lineWidth=1*n,S.strokeStyle="#000000"),S.beginPath(),S.arc(h,h,t,0,2*Math.PI,!1),S.fill(),c&&S.setLineDash([5,3]),l&&S.stroke(),vg[x]=b}}return vg[x]},bg={},Mg=(h,t,r,l,c,n,x,b)=>{let S=`${h}, ${t}, ${r}, ${l},${c}, ${n}, ${x}`;if(!bg[S]){let R=ws(t*2,t*2);if(R){let E=R.getContext("2d");if(!E)return null;n&&(E.save(),E.textBaseline="middle",E.textAlign="center",E.font=b(r+2,h),E.strokeStyle=c,E.strokeText(h,t,t),E.restore()),E.textBaseline="middle",E.textAlign="center",E.fillStyle=l,E.font=b(r,h),E.strokeStyle=c,E.strokeText(h,t,t),E.fillText(h,t,t),bg[S]=R}}return bg[S]},wg={},H2=(h,t,r)=>{let{delayDisplay:l=3e5,delayOutlineColor:c="#000",getBgColor:n=()=>"#000",getDelayColor:x=()=>"#000",getDelayFont:b=jt=>`bold ${jt}px arial, sans-serif`,getDelayText:S=()=>null,getMaxRadiusForStrokeAndDelay:R=()=>7,getMaxRadiusForText:E=()=>10,getRadius:A=()=>0,getText:z=jt=>jt,getTextColor:W=()=>"#000",getTextFont:re=jt=>`bold ${jt}px arial, sans-serif`,getTextSize:me=()=>14,hoverVehicleId:ge,selectedVehicleId:be,useDelayStyle:ve}=r,{pixelRatio:De=1,zoom:ke}=t,{type:je}=h.properties,{delay:Re,line:tt,operator_provides_realtime_journey:Je,state:He,train_id:ot}=h.properties,{color:vt,name:ct,text_color:It}=tt||{};ct=z(ct);let ut=He==="JOURNEY_CANCELLED";je||(je="Rail"),ct||(ct="I"),It||(It="#000000"),vt&&!vt.startsWith("#")&&(vt=`#${vt}`),It.startsWith("#")||(It=`#${It}`);let yt=Math.min(Math.floor(ke||1),16),xt=!!(ge&&ge===ot),dt=!!(be&&be===ot),St=A(je,yt)*De,qt=St>=R()*De;(xt||dt)&&(St=qt?St+5*De:14*De);let Ft=St>E()*De,Pt=`${St}${xt||dt}`;if(ve?(Pt+=`${Je}${Re}`,qt&&(Pt+=`${ut}`)):(Pt+=`${vt||je}`,qt&&(Pt+=`${ut}${Re}`)),Ft&&(Pt+=`${ct}${It}`),!wg[Pt]){if(St===0)return null;let jt=1*De,$t=St+2*De,et=St*2,Bi=$t*2+jt*2,Ai=Bi/2,Ci=null;qt&&Re!==null&&(Ci=Sg(Ai,$t,x(Re,ut)));let en=null,_i=0;if(qt&&(xt||(Re||0)>=l||ut)){_i=Math.max(ut?19:14,Math.min(ut?19:17,St*1.2))*De;let yi=S(Re,ut);yi&&(en=Tg(yi,_i,b(_i,yi),x(Re,ut,!0),c,De))}let ti;ve?ti=x(Re,ut):ti=vt||n(je);let gn=Cg(Ai,St,ti,qt||xt||dt,!!qt&&!!ve&&Re===null&&Je==="yes",De),Ln=Bi+(en?.width||0)*2,$i=ws(Ln,Bi);if($i){let yi=$i.getContext("2d");if(!yi)return null;let Li=en?.width||0;Ci&&yi.drawImage(Ci,Li,0),gn&&yi.drawImage(gn,Li,0);let rn=null;if(Ft){let kn=Math.max(St,10),nn=me(yi,et,ct,kn,re),Dn=ve?"#000000":It||W(je);rn=Mg(ct,Ai,nn,Dn,ti,!!ve&&Re===null&&Je==="yes",De,re)}rn&&yi.drawImage(rn,Li,0),en&&yi.drawImage(en,Li+Math.ceil(Ai+$t)+jt,Math.ceil(Ai-_i)),wg[Pt]=$i}}return wg[Pt]},dl=H2;var Y2=(h,t,r)=>dl(h,t,{...r,useDelayStyle:!0}),Ig=Y2;var Vp,K2=()=>{if(!Vp){Vp=ws(15,15);let h=Vp?.getContext("2d");h&&(h.arc(8,8,5,0,2*Math.PI,!1),h.fillStyle="#8ED6FF",h.fill(),h.lineWidth=3,h.strokeStyle="black",h.stroke(),h.lineWidth=3)}return Vp},Eg=K2;var J2=h=>{let t=h.filter(n=>n!=null&&n.trim&&n.trim()),r=t.map(n=>n.toLowerCase());return[...new Set(r)].map(n=>t.find(x=>x.toLowerCase()===n))},pl=J2;var Q2=h=>{if(!h)return[];let{style:t}=h;if(!t)return[];let{sourceCaches:r}=t,l=[];return Object.values(r).forEach(c=>{if(c.used){let n=c.getSource(),x=n.attribution||n.options?.attribution;x&&(l=l.concat(x.replace(/&copy;/g,"\xA9").split(/(<a.*?<\/a>)/)))}}),pl(l)},Pu=Q2;var eT=(h,t,r,l)=>{let c=[];if(!h&&!t&&!r&&!l)return null;if(l){let n=typeof l=="string"?[l]:l,x=b=>{let S=b.properties.name||b.properties.line&&b.properties.line.name||"";return S?n.some(R=>new RegExp(R,"i").test(S)):!1};c.push(x)}if(h){let x=(typeof h=="string"?h.split(","):h).map(S=>S.replace(/\s+/g,"").toUpperCase()),b=S=>{let{line:R,name:E}=S.properties,A=(E||R&&R.name||"").toUpperCase();return A?x.includes(A):!1};c.push(b)}if(t){let x=(typeof t=="string"?t.split(","):t).map(S=>parseInt(S,10)),b=S=>{let R=S.properties.route_identifier||S.properties.routeIdentifier||"",E=parseInt(R.split(".")[0],10);return x.includes(E)};c.push(b)}if(r){let n=typeof r=="string"?[r]:r,x=b=>n.some(S=>{let R=b.properties.operator||b.properties.tenant||"";return new RegExp(S,"i").test(R)});c.push(x)}return c.length?n=>{for(let x=0;x<c.length;x+=1)if(!c[x](n))return!1;return!0}:null},Pg=eT;var wv=h=>{let t=h;Array.isArray(t)||(t=[h]);let r=[];return t.forEach(l=>{r.push(l);let c=l.children||l.get("children")||l.getLayers?.()?.getArray();r=r.concat(wv(c||[]))}),r},Ru=wv;var Sv=(h=new Date)=>{let t=(h.getUTCMonth()+1).toString();t=t.length===1?`0${t}`:t;let r=h.getUTCDate().toString();return r=r.length===1?`0${r}`:r,[h.getUTCFullYear(),t,r].join("")},Tv=h=>[h.getUTCHours(),h.getUTCMinutes(),`${h.getUTCSeconds()}.${h.getUTCMilliseconds()}`].join(":"),Up=h=>h<10?`0${h}`:`${h}`,Cv=h=>{if(!h||h<=0)return"";let t=new Date(h);return`${Up(t.getHours())}:${Up(t.getMinutes())}`};var tT=(h,t)=>{let r=h.properties,l=t.properties;return r.delay===null&&l.delay!==null?1:l.delay===null&&r.delay!==null?-1:r.cancelled&&!l.cancelled?l.delay<18e4?-1:1:l.cancelled&&!r.cancelled?r.delay<18e4?1:-1:l.delay-r.delay},Rg=tT;function di(h,t){if(!h)throw new Error(t)}var OE=new Array(6);function yr(){return[1,0,0,1,0,0]}function Iv(h,t){return h[0]=t[0],h[1]=t[1],h[2]=t[2],h[3]=t[3],h[4]=t[4],h[5]=t[5],h}function Ar(h,t){let r=t[0],l=t[1];return t[0]=h[0]*r+h[2]*l+h[4],t[1]=h[1]*r+h[3]*l+h[5],t}function Yr(h,t,r,l,c,n,x,b){let S=Math.sin(n),R=Math.cos(n);return h[0]=l*R,h[1]=c*S,h[2]=-l*S,h[3]=c*R,h[4]=x*l*R-b*l*S+t,h[5]=x*c*S+b*c*R+r,h}function Ev(h,t,r,l,c,n,x){return Ag(Yr(yr(),h,t,r,l,c,n,x))}function Pv(h,t){let r=iT(t);di(r!==0,"Transformation matrix cannot be inverted");let l=t[0],c=t[1],n=t[2],x=t[3],b=t[4],S=t[5];return h[0]=x/r,h[1]=-c/r,h[2]=-n/r,h[3]=l/r,h[4]=(n*S-x*b)/r,h[5]=-(l*S-c*b)/r,h}function iT(h){return h[0]*h[3]-h[1]*h[2]}var Mv=[1e6,1e6,1e6,1e6,2,2];function Ag(h){return"matrix("+h.map((r,l)=>Math.round(r*Mv[l])/Mv[l]).join(", ")+")"}var Lg=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Ei=Lg;var Zp={PROPERTYCHANGE:"propertychange"};var kg=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},Rv=kg;function Av(h,t,r){let l,c;r=r||Ss;let n=0,x=h.length,b=!1;for(;n<x;)l=n+(x-n>>1),c=+r(h[l],t),c<0?n=l+1:(x=l,b=!c);return b?n:~n}function Ss(h,t){return h>t?1:h<t?-1:0}function Lv(h,t){return h<t?1:h>t?-1:0}function qp(h,t,r){if(h[0]<=t)return 0;let l=h.length;if(t<=h[l-1])return l-1;if(typeof r=="function"){for(let c=1;c<l;++c){let n=h[c];if(n===t)return c;if(n<t)return r(t,h[c-1],n)>0?c-1:c}return l-1}if(r>0){for(let c=1;c<l;++c)if(h[c]<t)return c-1;return l-1}if(r<0){for(let c=1;c<l;++c)if(h[c]<=t)return c;return l-1}for(let c=1;c<l;++c){if(h[c]==t)return c;if(h[c]<t)return h[c-1]-t<t-h[c]?c-1:c}return l-1}function kv(h,t,r){for(;t<r;){let l=h[t];h[t]=h[r],h[r]=l,++t,--r}}function Lr(h,t){let r=Array.isArray(t)?t:[t],l=r.length;for(let c=0;c<l;c++)h[h.length]=r[c]}function vn(h,t){let r=h.length;if(r!==t.length)return!1;for(let l=0;l<r;l++)if(h[l]!==t[l])return!1;return!0}function Wp(){return!0}function Ts(){}function $p(h){let t,r,l;return function(){let c=Array.prototype.slice.call(arguments);return(!r||this!==l||!vn(c,r))&&(l=this,r=c,t=h.apply(this,arguments)),t}}function Tc(h){for(let t in h)delete h[t]}function Xn(h){let t;for(t in h)return!1;return!t}var Dg=class extends Rv{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,r){if(!t||!r)return;let l=this.listeners_||(this.listeners_={}),c=l[t]||(l[t]=[]);c.includes(r)||c.push(r)}dispatchEvent(t){let r=typeof t=="string",l=r?t:t.type,c=this.listeners_&&this.listeners_[l];if(!c)return;let n=r?new Ei(t):t;n.target||(n.target=this.eventTarget_||this);let x=this.dispatching_||(this.dispatching_={}),b=this.pendingRemovals_||(this.pendingRemovals_={});l in x||(x[l]=0,b[l]=0),++x[l];let S;for(let R=0,E=c.length;R<E;++R)if("handleEvent"in c[R]?S=c[R].handleEvent(n):S=c[R].call(this,n),S===!1||n.propagationStopped){S=!1;break}if(--x[l]===0){let R=b[l];for(delete b[l];R--;)this.removeEventListener(l,Ts);delete x[l]}return S}disposeInternal(){this.listeners_&&Tc(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,r){if(!this.listeners_)return;let l=this.listeners_[t];if(!l)return;let c=l.indexOf(r);c!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(l[c]=Ts,++this.pendingRemovals_[t]):(l.splice(c,1),l.length===0&&delete this.listeners_[t]))}},Xp=Dg;var gi={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function kr(h,t,r,l,c){if(c){let x=r;r=function(){h.removeEventListener(t,r),x.apply(l??this,arguments)}}else l&&l!==h&&(r=r.bind(l));let n={target:h,type:t,listener:r};return h.addEventListener(t,r),n}function Fg(h,t,r,l){return kr(h,t,r,l,!0)}function Kr(h){h&&h.target&&(h.target.removeEventListener(h.type,h.listener),Tc(h))}var Cc=class extends Xp{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(gi.CHANGE)}getRevision(){return this.revision_}onInternal(t,r){if(Array.isArray(t)){let l=t.length,c=new Array(l);for(let n=0;n<l;++n)c[n]=kr(this,t[n],r);return c}return kr(this,t,r)}onceInternal(t,r){let l;if(Array.isArray(t)){let c=t.length;l=new Array(c);for(let n=0;n<c;++n)l[n]=Fg(this,t[n],r)}else l=Fg(this,t,r);return r.ol_key=l,l}unInternal(t,r){let l=r.ol_key;if(l)Cs(l);else if(Array.isArray(t))for(let c=0,n=t.length;c<n;++c)this.removeEventListener(t[c],r);else this.removeEventListener(t,r)}};Cc.prototype.on;Cc.prototype.once;Cc.prototype.un;function Cs(h){if(Array.isArray(h))for(let t=0,r=h.length;t<r;++t)Kr(h[t]);else Kr(h)}var Hp=Cc;function Tt(){throw new Error("Unimplemented abstract method.")}var rT=0;function Gt(h){return h.ol_uid||(h.ol_uid=String(++rT))}var Yp=class extends Ei{constructor(t,r,l){super(t),this.key=r,this.oldValue=l}},zg=class extends Hp{constructor(t){super(),this.on,this.once,this.un,Gt(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let r;return this.values_&&this.values_.hasOwnProperty(t)&&(r=this.values_[t]),r}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,r){let l;l=`change:${t}`,this.hasListener(l)&&this.dispatchEvent(new Yp(l,t,r)),l=Zp.PROPERTYCHANGE,this.hasListener(l)&&this.dispatchEvent(new Yp(l,t,r))}addChangeListener(t,r){this.addEventListener(`change:${t}`,r)}removeChangeListener(t,r){this.removeEventListener(`change:${t}`,r)}set(t,r,l){let c=this.values_||(this.values_={});if(l)c[t]=r;else{let n=c[t];c[t]=r,n!==r&&this.notify(t,n)}}setProperties(t,r){for(let l in t)this.set(l,t[l],r)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,r){if(this.values_&&t in this.values_){let l=this.values_[t];delete this.values_[t],Xn(this.values_)&&(this.values_=null),r||this.notify(t,l)}}},xr=zg;var Qi={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function hs(h){let t=wn();for(let r=0,l=h.length;r<l;++r)Og(t,h[r]);return t}function nT(h,t,r){let l=Math.min.apply(null,h),c=Math.min.apply(null,t),n=Math.max.apply(null,h),x=Math.max.apply(null,t);return Io(l,c,n,x,r)}function us(h,t,r){return r?(r[0]=h[0]-t,r[1]=h[1]-t,r[2]=h[2]+t,r[3]=h[3]+t,r):[h[0]-t,h[1]-t,h[2]+t,h[3]+t]}function Dv(h,t){return t?(t[0]=h[0],t[1]=h[1],t[2]=h[2],t[3]=h[3],t):h.slice()}function bn(h,t,r){let l,c;return t<h[0]?l=h[0]-t:h[2]<t?l=t-h[2]:l=0,r<h[1]?c=h[1]-r:h[3]<r?c=r-h[3]:c=0,l*l+c*c}function fl(h,t){return Au(h,t[0],t[1])}function Mo(h,t){return h[0]<=t[0]&&t[2]<=h[2]&&h[1]<=t[1]&&t[3]<=h[3]}function Au(h,t,r){return h[0]<=t&&t<=h[2]&&h[1]<=r&&r<=h[3]}function Kp(h,t){let r=h[0],l=h[1],c=h[2],n=h[3],x=t[0],b=t[1],S=Qi.UNKNOWN;return x<r?S=S|Qi.LEFT:x>c&&(S=S|Qi.RIGHT),b<l?S=S|Qi.BELOW:b>n&&(S=S|Qi.ABOVE),S===Qi.UNKNOWN&&(S=Qi.INTERSECTING),S}function wn(){return[1/0,1/0,-1/0,-1/0]}function Io(h,t,r,l,c){return c?(c[0]=h,c[1]=t,c[2]=r,c[3]=l,c):[h,t,r,l]}function Mc(h){return Io(1/0,1/0,-1/0,-1/0,h)}function la(h,t){let r=h[0],l=h[1];return Io(r,l,r,l,t)}function Ic(h,t,r,l,c){let n=Mc(c);return Bg(n,h,t,r,l)}function Jp(h,t){return h[0]==t[0]&&h[2]==t[2]&&h[1]==t[1]&&h[3]==t[3]}function Fv(h,t){return t[0]<h[0]&&(h[0]=t[0]),t[2]>h[2]&&(h[2]=t[2]),t[1]<h[1]&&(h[1]=t[1]),t[3]>h[3]&&(h[3]=t[3]),h}function Og(h,t){t[0]<h[0]&&(h[0]=t[0]),t[0]>h[2]&&(h[2]=t[0]),t[1]<h[1]&&(h[1]=t[1]),t[1]>h[3]&&(h[3]=t[1])}function Bg(h,t,r,l,c){for(;r<l;r+=c)sT(h,t[r],t[r+1]);return h}function sT(h,t,r){h[0]=Math.min(h[0],t),h[1]=Math.min(h[1],r),h[2]=Math.max(h[2],t),h[3]=Math.max(h[3],r)}function zv(h,t){let r;return r=t(jg(h)),r||(r=t(Ng(h)),r)||(r=t(Vg(h)),r)||(r=t(Gg(h)),r)?r:!1}function jg(h){return[h[0],h[1]]}function Ng(h){return[h[2],h[1]]}function ds(h){return[(h[0]+h[2])/2,(h[1]+h[3])/2]}function Ov(h,t,r,l,c){let[n,x,b,S,R,E,A,z]=oT(h,t,r,l);return Io(Math.min(n,b,R,A),Math.min(x,S,E,z),Math.max(n,b,R,A),Math.max(x,S,E,z),c)}function oT(h,t,r,l){let c=t*l[0]/2,n=t*l[1]/2,x=Math.cos(r),b=Math.sin(r),S=c*x,R=c*b,E=n*x,A=n*b,z=h[0],W=h[1];return[z-S+A,W-R-E,z-S-A,W-R+E,z+S-A,W+R+E,z+S+A,W+R-E,z-S+A,W-R-E]}function ar(h){return h[3]-h[1]}function Gg(h){return[h[0],h[3]]}function Vg(h){return[h[2],h[3]]}function Ti(h){return h[2]-h[0]}function er(h,t){return h[0]<=t[2]&&h[2]>=t[0]&&h[1]<=t[3]&&h[3]>=t[1]}function Lu(h){return h[2]<h[0]||h[3]<h[1]}function Bv(h,t){return t?(t[0]=h[0],t[1]=h[1],t[2]=h[2],t[3]=h[3],t):h}function jv(h,t,r){let l=!1,c=Kp(h,t),n=Kp(h,r);if(c===Qi.INTERSECTING||n===Qi.INTERSECTING)l=!0;else{let x=h[0],b=h[1],S=h[2],R=h[3],E=t[0],A=t[1],z=r[0],W=r[1],re=(W-A)/(z-E),me,ge;n&Qi.ABOVE&&!(c&Qi.ABOVE)&&(me=z-(W-R)/re,l=me>=x&&me<=S),!l&&n&Qi.RIGHT&&!(c&Qi.RIGHT)&&(ge=W-(z-S)*re,l=ge>=b&&ge<=R),!l&&n&Qi.BELOW&&!(c&Qi.BELOW)&&(me=z-(W-b)/re,l=me>=x&&me<=S),!l&&n&Qi.LEFT&&!(c&Qi.LEFT)&&(ge=W-(z-x)*re,l=ge>=b&&ge<=R)}return l}function Nv(h,t,r,l){if(Lu(h))return Mc(r);let c=[];if(l>1){let b=h[2]-h[0],S=h[3]-h[1];for(let R=0;R<l;++R)c.push(h[0]+b*R/l,h[1],h[2],h[1]+S*R/l,h[2]-b*R/l,h[3],h[0],h[3]-S*R/l)}else c=[h[0],h[1],h[2],h[1],h[2],h[3],h[0],h[3]];t(c,c,2);let n=[],x=[];for(let b=0,S=c.length;b<S;b+=2)n.push(c[b]),x.push(c[b+1]);return nT(n,x,r)}function Ug(h,t){let r=t.getExtent(),l=ds(h);if(t.canWrapX()&&(l[0]<r[0]||l[0]>=r[2])){let c=Ti(r),x=Math.floor((l[0]-r[0])/c)*c;h[0]-=x,h[2]-=x}return h}function Gv(h,t,r){if(t.canWrapX()){let l=t.getExtent();if(!isFinite(h[0])||!isFinite(h[2]))return[[l[0],h[1],l[2],h[3]]];Ug(h,t);let c=Ti(l);if(Ti(h)>c&&!r)return[[l[0],h[1],l[2],h[3]]];if(h[0]<l[0])return[[h[0]+c,h[1],l[2],h[3]],[l[0],h[1],h[2],h[3]]];if(h[2]>l[2])return[[h[0],h[1],l[2],h[3]],[l[0],h[1],h[2]-c,h[3]]]}return[h]}var ku={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var Zg=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||ku[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!!(t&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!!(this.global_&&t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}},Ec=Zg;var Du=6378137,Pc=Math.PI*Du,aT=[-Pc,-Pc,Pc,Pc],lT=[-180,-85,180,85],Qp=Du*Math.log(Math.tan(Math.PI/2)),ca=class extends Ec{constructor(t){super({code:t,units:"m",extent:aT,global:!0,worldExtent:lT,getPointResolution:function(r,l){return r/Math.cosh(l[1]/Du)}})}},qg=[new ca("EPSG:3857"),new ca("EPSG:102100"),new ca("EPSG:102113"),new ca("EPSG:900913"),new ca("http://www.opengis.net/def/crs/EPSG/0/3857"),new ca("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Vv(h,t,r,l){let c=h.length;r=r>1?r:2,l=l??r,t===void 0&&(r>2?t=h.slice():t=new Array(c));for(let n=0;n<c;n+=l){t[n]=Pc*h[n]/180;let x=Du*Math.log(Math.tan(Math.PI*(+h[n+1]+90)/360));x>Qp?x=Qp:x<-Qp&&(x=-Qp),t[n+1]=x}return t}function Uv(h,t,r,l){let c=h.length;r=r>1?r:2,l=l??r,t===void 0&&(r>2?t=h.slice():t=new Array(c));for(let n=0;n<c;n+=l)t[n]=180*h[n]/Pc,t[n+1]=360*Math.atan(Math.exp(h[n+1]/Du))/Math.PI-90;return t}var cT=6378137,Zv=[-180,-90,180,90],hT=Math.PI*cT/180,Eo=class extends Ec{constructor(t,r){super({code:t,units:"degrees",extent:Zv,axisOrientation:r,global:!0,metersPerUnit:hT,worldExtent:Zv})}},Wg=[new Eo("CRS:84"),new Eo("EPSG:4326","neu"),new Eo("urn:ogc:def:crs:OGC:1.3:CRS84"),new Eo("urn:ogc:def:crs:OGC:2:84"),new Eo("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Eo("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Eo("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var $g={};function qv(h){return $g[h]||$g[h.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Wv(h,t){$g[h]=t}var Rc={};function Ac(h,t,r){let l=h.getCode(),c=t.getCode();l in Rc||(Rc[l]={}),Rc[l][c]=r}function ef(h,t){return h in Rc&&t in Rc[h]?Rc[h][t]:null}function Pi(h,t,r){return Math.min(Math.max(h,t),r)}function $v(h,t,r,l,c,n){let x=c-r,b=n-l;if(x!==0||b!==0){let S=((h-r)*x+(t-l)*b)/(x*x+b*b);S>1?(r=c,l=n):S>0&&(r+=x*S,l+=b*S)}return Ms(h,t,r,l)}function Ms(h,t,r,l){let c=r-h,n=l-t;return c*c+n*n}function Fu(h){return h*180/Math.PI}function ml(h){return h*Math.PI/180}function gl(h,t){let r=h%t;return r*t<0?r+t:r}function Dr(h,t,r){return h+r*(t-h)}function Xv(h,t){let r=Math.pow(10,t);return Math.round(h*r)/r}function tf(h,t,r){if(h>=t&&h<r)return h;let l=r-t;return((h-t)%l+l)%l+t}function Hv(h,t){return h[0]+=+t[0],h[1]+=+t[1],h}function Xg(h,t){let r=h[0],l=h[1],c=t[0],n=t[1],x=c[0],b=c[1],S=n[0],R=n[1],E=S-x,A=R-b,z=E===0&&A===0?0:(E*(r-x)+A*(l-b))/(E*E+A*A||0),W,re;return z<=0?(W=x,re=b):z>=1?(W=S,re=R):(W=x+z*E,re=b+z*A),[W,re]}function lr(h,t){let r=!0;for(let l=h.length-1;l>=0;--l)if(h[l]!=t[l]){r=!1;break}return r}function Yv(h,t){let r=Math.cos(t),l=Math.sin(t),c=h[0]*r-h[1]*l,n=h[1]*r+h[0]*l;return h[0]=c,h[1]=n,h}function Lc(h,t){let r=h[0]-t[0],l=h[1]-t[1];return r*r+l*l}function Hg(h,t){return Math.sqrt(Lc(h,t))}function Kv(h,t){return Lc(h,Xg(h,t))}function Jv(h,t){if(t.canWrapX()){let r=Ti(t.getExtent()),l=Qv(h,t,r);l&&(h[0]-=l*r)}return h}function Qv(h,t,r){let l=t.getExtent(),c=0;return t.canWrapX()&&(h[0]<l[0]||h[0]>l[2])&&(r=r||Ti(l),c=Math.floor((h[0]-l[0])/r)),c}var rf=.9996,ps=.00669438,sf=ps*ps,of=sf*ps,_l=ps/(1-ps),eb=Math.sqrt(1-ps),kc=(1-eb)/(1+eb),nb=kc*kc,Yg=nb*kc,Kg=Yg*kc,sb=Kg*kc,ob=1-ps/4-3*sf/64-5*of/256,uT=3*ps/8+3*sf/32+45*of/1024,dT=15*sf/256+45*of/1024,pT=35*of/3072,fT=3/2*kc-27/32*Yg+269/512*sb,mT=21/16*nb-55/32*Kg,gT=151/96*Yg-417/128*sb,_T=1097/512*Kg,nf=6378137;function yT(h,t,r){let l=h-5e5,x=(r.north?t:t-1e7)/rf/(nf*ob),b=x+fT*Math.sin(2*x)+mT*Math.sin(4*x)+gT*Math.sin(6*x)+_T*Math.sin(8*x),S=Math.sin(b),R=S*S,E=Math.cos(b),A=S/E,z=A*A,W=z*z,re=1-ps*R,me=Math.sqrt(1-ps*R),ge=nf/me,be=(1-ps)/re,ve=_l*E**2,De=ve*ve,ke=l/(ge*rf),je=ke*ke,Re=je*ke,tt=Re*ke,Je=tt*ke,He=Je*ke,ot=b-A/be*(je/2-tt/24*(5+3*z+10*ve-4*De-9*_l))+He/720*(61+90*z+298*ve+45*W-252*_l-3*De),vt=(ke-Re/6*(1+2*z+ve)+Je/120*(5-2*ve+28*z-3*De+8*_l+24*W))/E;return vt=tf(vt+ml(ab(r.number)),-Math.PI,Math.PI),[Fu(vt),Fu(ot)]}var tb=-80,ib=84,xT=-180,vT=180;function bT(h,t,r){h=tf(h,xT,vT),t<tb?t=tb:t>ib&&(t=ib);let l=ml(t),c=Math.sin(l),n=Math.cos(l),x=c/n,b=x*x,S=b*b,R=ml(h),E=ab(r.number),A=ml(E),z=nf/Math.sqrt(1-ps*c**2),W=_l*n**2,re=n*tf(R-A,-Math.PI,Math.PI),me=re*re,ge=me*re,be=ge*re,ve=be*re,De=ve*re,ke=nf*(ob*l-uT*Math.sin(2*l)+dT*Math.sin(4*l)-pT*Math.sin(6*l)),je=rf*z*(re+ge/6*(1-b+W)+ve/120*(5-18*b+S+72*W-58*_l))+5e5,Re=rf*(ke+z*x*(me/2+be/24*(5-b+9*W+4*W**2)+De/720*(61-58*b+S+600*W-330*_l)));return r.north||(Re+=1e7),[je,Re]}function ab(h){return(h-1)*6-180+3}var wT=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function lb(h){let t=0;for(let c of wT){let n=h.match(c);if(n){t=parseInt(n[1]);break}}if(!t)return null;let r=0,l=!1;return t>32700&&t<32761?r=t-32700:t>32600&&t<32661&&(l=!0,r=t-32600),r?{number:r,north:l}:null}function rb(h,t){return function(r,l,c,n){let x=r.length;c=c>1?c:2,n=n??c,l||(c>2?l=r.slice():l=new Array(x));for(let b=0;b<x;b+=n){let S=r[b],R=r[b+1],E=h(S,R,t);l[b]=E[0],l[b+1]=E[1]}return l}}function cb(h){return lb(h)?new Ec({code:h,units:"m"}):null}function hb(h){let t=lb(h.getCode());return t?{forward:rb(bT,t),inverse:rb(yT,t)}:null}var ub={info:1,warn:2,error:3,none:4},ST=ub.info;function db(...h){ST>ub.warn||console.warn(...h)}var TT=[hb],CT=[cb];var Qg=!0;function t_(h){Qg=!(h===void 0?!0:h)}function i_(h,t){if(t!==void 0){for(let r=0,l=h.length;r<l;++r)t[r]=h[r];t=t}else t=h.slice();return t}function e_(h){Wv(h.getCode(),h),Ac(h,h,i_)}function MT(h){h.forEach(e_)}function Ri(h){if(typeof h!="string")return h;let t=qv(h);if(t)return t;for(let r of CT){let l=r(h);if(l)return l}return null}function pb(h){MT(h),h.forEach(function(t){h.forEach(function(r){t!==r&&Ac(t,r,i_)})})}function IT(h,t,r,l){h.forEach(function(c){t.forEach(function(n){Ac(c,n,r),Ac(n,c,l)})})}function af(h,t){return h?typeof h=="string"?Ri(h):h:Ri(t)}function vr(h,t){return t_(),lf(h,"EPSG:4326",t!==void 0?t:"EPSG:3857")}function yl(h,t){let r=lf(h,t!==void 0?t:"EPSG:3857","EPSG:4326"),l=r[0];return(l<-180||l>180)&&(r[0]=gl(l+180,360)-180),r}function fb(h,t){if(h===t)return!0;let r=h.getUnits()===t.getUnits();return(h.getCode()===t.getCode()||Dc(h,t)===i_)&&r}function Dc(h,t){let r=h.getCode(),l=t.getCode(),c=ef(r,l);if(c)return c;let n=null,x=null;for(let S of TT)n||(n=S(h)),x||(x=S(t));if(!n&&!x)return null;let b="EPSG:4326";if(x)if(n)c=Jg(n.inverse,x.forward);else{let S=ef(r,b);S&&(c=Jg(S,x.forward))}else{let S=ef(b,l);S&&(c=Jg(n.inverse,S))}return c&&(e_(h),e_(t),Ac(h,t,c)),c}function Jg(h,t){return function(r,l,c,n){return l=h(r,l,c,n),t(l,l,c,n)}}function xl(h,t){let r=Ri(h),l=Ri(t);return Dc(r,l)}function lf(h,t,r){let l=xl(t,r);if(!l){let c=Ri(t).getCode(),n=Ri(r).getCode();throw new Error(`No transform available between ${c} and ${n}`)}return l(h,void 0,h.length)}function r_(h,t,r,l){let c=xl(t,r);return Nv(h,c,void 0,l)}var Is=null;function Hn(){return Is}function ha(h,t){return Is?lf(h,t,Is):h}function Di(h,t){return Is?lf(h,Is,t):(Qg&&!lr(h,[0,0])&&h[0]>=-180&&h[0]<=180&&h[1]>=-90&&h[1]<=90&&(Qg=!1,db("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),h)}function Zs(h,t){return Is?r_(h,t,Is):h}function qs(h,t){return Is?r_(h,Is,t):h}function mb(h,t){if(!Is)return h;let r=Ri(t).getMetersPerUnit(),l=Is.getMetersPerUnit();return r&&l?h*r/l:h}function ET(){pb(qg),pb(Wg),IT(Wg,qg,Vv,Uv)}ET();function Sn(h,t,r,l,c,n,x){n=n||[],x=x||2;let b=0;for(let S=t;S<r;S+=l){let R=h[S],E=h[S+1];n[b++]=c[0]*R+c[2]*E+c[4],n[b++]=c[1]*R+c[3]*E+c[5];for(let A=2;A<x;A++)n[b++]=h[S+A]}return n&&n.length!=b&&(n.length=b),n}function cf(h,t,r,l,c,n,x){x=x||[];let b=Math.cos(c),S=Math.sin(c),R=n[0],E=n[1],A=0;for(let z=t;z<r;z+=l){let W=h[z]-R,re=h[z+1]-E;x[A++]=R+W*b-re*S,x[A++]=E+W*S+re*b;for(let me=z+2;me<z+l;++me)x[A++]=h[me]}return x&&x.length!=A&&(x.length=A),x}function gb(h,t,r,l,c,n,x,b){b=b||[];let S=x[0],R=x[1],E=0;for(let A=t;A<r;A+=l){let z=h[A]-S,W=h[A+1]-R;b[E++]=S+c*z,b[E++]=R+n*W;for(let re=A+2;re<A+l;++re)b[E++]=h[re]}return b&&b.length!=E&&(b.length=E),b}function _b(h,t,r,l,c,n,x){x=x||[];let b=0;for(let S=t;S<r;S+=l){x[b++]=h[S]+c,x[b++]=h[S+1]+n;for(let R=S+2;R<S+l;++R)x[b++]=h[R]}return x&&x.length!=b&&(x.length=b),x}var yb=yr(),n_=class extends xr{constructor(){super(),this.extent_=wn(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=$p((t,r,l)=>{if(!l)return this.getSimplifiedGeometry(r);let c=this.clone();return c.applyTransform(l),c.getSimplifiedGeometry(r)})}simplifyTransformed(t,r){return this.simplifyTransformedInternal(this.getRevision(),t,r)}clone(){return Tt()}closestPointXY(t,r,l,c){return Tt()}containsXY(t,r){let l=this.getClosestPoint([t,r]);return l[0]===t&&l[1]===r}getClosestPoint(t,r){return r=r||[NaN,NaN],this.closestPointXY(t[0],t[1],r,1/0),r}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return Tt()}getExtent(t){if(this.extentRevision_!=this.getRevision()){let r=this.computeExtent(this.extent_);(isNaN(r[0])||isNaN(r[1]))&&Mc(r),this.extentRevision_=this.getRevision()}return Bv(this.extent_,t)}rotate(t,r){Tt()}scale(t,r,l){Tt()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return Tt()}getType(){return Tt()}applyTransform(t){Tt()}intersectsExtent(t){return Tt()}translate(t,r){Tt()}transform(t,r){let l=Ri(t),c=l.getUnits()=="tile-pixels"?function(n,x,b){let S=l.getExtent(),R=l.getWorldExtent(),E=ar(R)/ar(S);Yr(yb,R[0],R[3],E,-E,0,0,0);let A=Sn(n,0,n.length,b,yb,x),z=xl(l,r);return z?z(A,A,b):A}:xl(l,r);return this.applyTransform(c),this}},hf=n_;var s_=class extends hf{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Ic(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return Tt()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let r=this.getSimplifiedGeometryInternal(t);return r.getFlatCoordinates().length<this.flatCoordinates.length?r:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,r){this.stride=xb(t),this.layout=t,this.flatCoordinates=r}setCoordinates(t,r){Tt()}setLayout(t,r,l){let c;if(t)c=xb(t);else{for(let n=0;n<l;++n){if(r.length===0){this.layout="XY",this.stride=2;return}r=r[0]}c=r.length,t=ua(c)}this.layout=t,this.stride=c}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,r){let l=this.getFlatCoordinates();if(l){let c=this.getStride();cf(l,0,l.length,c,t,r,l),this.changed()}}scale(t,r,l){r===void 0&&(r=t),l||(l=ds(this.getExtent()));let c=this.getFlatCoordinates();if(c){let n=this.getStride();gb(c,0,c.length,n,t,r,l,c),this.changed()}}translate(t,r){let l=this.getFlatCoordinates();if(l){let c=this.getStride();_b(l,0,l.length,c,t,r,l),this.changed()}}};function ua(h){let t;return h==2?t="XY":h==3?t="XYZ":h==4&&(t="XYZM"),t}function xb(h){let t;return h=="XY"?t=2:h=="XYZ"||h=="XYM"?t=3:h=="XYZM"&&(t=4),t}function vb(h,t,r){let l=h.getFlatCoordinates();if(!l)return null;let c=h.getStride();return Sn(l,0,l.length,c,t,r)}var Fr=s_;function bb(h,t,r,l){for(let c=0,n=r.length;c<n;++c)h[t++]=r[c];return t}function vl(h,t,r,l){for(let c=0,n=r.length;c<n;++c){let x=r[c];for(let b=0;b<l;++b)h[t++]=x[b]}return t}function da(h,t,r,l,c){c=c||[];let n=0;for(let x=0,b=r.length;x<b;++x){let S=vl(h,t,r[x],l);c[n++]=S,t=S}return c.length=n,c}function uf(h,t,r,l,c){c=c||[];let n=0;for(let x=0,b=r.length;x<b;++x){let S=da(h,t,r[x],l,c[n]);S.length===0&&(S[0]=t),c[n++]=S,t=S[S.length-1]}return c.length=n,c}var a_=class h extends hf{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(Kr),this.changeEventsKeys_.length=0}listenGeometriesChange_(){let t=this.geometries_;for(let r=0,l=t.length;r<l;++r)this.changeEventsKeys_.push(kr(t[r],gi.CHANGE,this.changed,this))}clone(){let t=new h(o_(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,r,l,c){if(c<bn(this.getExtent(),t,r))return c;let n=this.geometries_;for(let x=0,b=n.length;x<b;++x)c=n[x].closestPointXY(t,r,l,c);return c}containsXY(t,r){let l=this.geometries_;for(let c=0,n=l.length;c<n;++c)if(l[c].containsXY(t,r))return!0;return!1}computeExtent(t){Mc(t);let r=this.geometries_;for(let l=0,c=r.length;l<c;++l)Fv(t,r[l].getExtent());return t}getGeometries(){return o_(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[],r=this.geometries_;for(let l=0,c=r.length;l<c;++l)r[l].getType()===this.getType()?t=t.concat(r[l].getGeometriesArrayRecursive()):t.push(r[l]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;let r=[],l=this.geometries_,c=!1;for(let n=0,x=l.length;n<x;++n){let b=l[n],S=b.getSimplifiedGeometry(t);r.push(S),S!==b&&(c=!0)}return c?new h(r):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return"GeometryCollection"}intersectsExtent(t){let r=this.geometries_;for(let l=0,c=r.length;l<c;++l)if(r[l].intersectsExtent(t))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(t,r){let l=this.geometries_;for(let c=0,n=l.length;c<n;++c)l[c].rotate(t,r);this.changed()}scale(t,r,l){l||(l=ds(this.getExtent()));let c=this.geometries_;for(let n=0,x=c.length;n<x;++n)c[n].scale(t,r,l);this.changed()}setGeometries(t){this.setGeometriesArray(o_(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){let r=this.geometries_;for(let l=0,c=r.length;l<c;++l)r[l].applyTransform(t);this.changed()}translate(t,r){let l=this.geometries_;for(let c=0,n=l.length;c<n;++c)l[c].translate(t,r);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}};function o_(h){return h.map(t=>t.clone())}var l_=a_;function wb(h,t,r,l,c,n,x){let b=h[t],S=h[t+1],R=h[r]-b,E=h[r+1]-S,A;if(R===0&&E===0)A=t;else{let z=((c-b)*R+(n-S)*E)/(R*R+E*E);if(z>1)A=r;else if(z>0){for(let W=0;W<l;++W)x[W]=Dr(h[t+W],h[r+W],z);x.length=l;return}else A=t}for(let z=0;z<l;++z)x[z]=h[A+z];x.length=l}function zu(h,t,r,l,c){let n=h[t],x=h[t+1];for(t+=l;t<r;t+=l){let b=h[t],S=h[t+1],R=Ms(n,x,b,S);R>c&&(c=R),n=b,x=S}return c}function Ou(h,t,r,l,c){for(let n=0,x=r.length;n<x;++n){let b=r[n];c=zu(h,t,b,l,c),t=b}return c}function Sb(h,t,r,l,c){for(let n=0,x=r.length;n<x;++n){let b=r[n];c=Ou(h,t,b,l,c),t=b[b.length-1]}return c}function Bu(h,t,r,l,c,n,x,b,S,R,E){if(t==r)return R;let A,z;if(c===0){if(z=Ms(x,b,h[t],h[t+1]),z<R){for(A=0;A<l;++A)S[A]=h[t+A];return S.length=l,z}return R}E=E||[NaN,NaN];let W=t+l;for(;W<r;)if(wb(h,W-l,W,l,x,b,E),z=Ms(x,b,E[0],E[1]),z<R){for(R=z,A=0;A<l;++A)S[A]=E[A];S.length=l,W+=l}else W+=l*Math.max((Math.sqrt(z)-Math.sqrt(R))/c|0,1);if(n&&(wb(h,r-l,t,l,x,b,E),z=Ms(x,b,E[0],E[1]),z<R)){for(R=z,A=0;A<l;++A)S[A]=E[A];S.length=l}return R}function ju(h,t,r,l,c,n,x,b,S,R,E){E=E||[NaN,NaN];for(let A=0,z=r.length;A<z;++A){let W=r[A];R=Bu(h,t,W,l,c,n,x,b,S,R,E),t=W}return R}function Tb(h,t,r,l,c,n,x,b,S,R,E){E=E||[NaN,NaN];for(let A=0,z=r.length;A<z;++A){let W=r[A];R=ju(h,t,W,l,c,n,x,b,S,R,E),t=W[W.length-1]}return R}function bl(h,t,r,l,c,n,x){let b=(r-t)/l;if(b<3){for(;t<r;t+=l)n[x++]=h[t],n[x++]=h[t+1];return x}let S=new Array(b);S[0]=1,S[b-1]=1;let R=[t,r-l],E=0;for(;R.length>0;){let A=R.pop(),z=R.pop(),W=0,re=h[z],me=h[z+1],ge=h[A],be=h[A+1];for(let ve=z+l;ve<A;ve+=l){let De=h[ve],ke=h[ve+1],je=$v(De,ke,re,me,ge,be);je>W&&(E=ve,W=je)}W>c&&(S[(E-t)/l]=1,z+l<E&&R.push(z,E),E+l<A&&R.push(E,A))}for(let A=0;A<b;++A)S[A]&&(n[x++]=h[t+A*l],n[x++]=h[t+A*l+1]);return x}function df(h,t,r,l,c,n,x,b){for(let S=0,R=r.length;S<R;++S){let E=r[S];x=bl(h,t,E,l,c,n,x),b.push(x),t=E}return x}function pa(h,t){return t*Math.round(h/t)}function PT(h,t,r,l,c,n,x){if(t==r)return x;let b=pa(h[t],c),S=pa(h[t+1],c);t+=l,n[x++]=b,n[x++]=S;let R,E;do if(R=pa(h[t],c),E=pa(h[t+1],c),t+=l,t==r)return n[x++]=R,n[x++]=E,x;while(R==b&&E==S);for(;t<r;){let A=pa(h[t],c),z=pa(h[t+1],c);if(t+=l,A==R&&z==E)continue;let W=R-b,re=E-S,me=A-b,ge=z-S;if(W*ge==re*me&&(W<0&&me<W||W==me||W>0&&me>W)&&(re<0&&ge<re||re==ge||re>0&&ge>re)){R=A,E=z;continue}n[x++]=R,n[x++]=E,b=R,S=E,R=A,E=z}return n[x++]=R,n[x++]=E,x}function Nu(h,t,r,l,c,n,x,b){for(let S=0,R=r.length;S<R;++S){let E=r[S];x=PT(h,t,E,l,c,n,x),b.push(x),t=E}return x}function Cb(h,t,r,l,c,n,x,b){for(let S=0,R=r.length;S<R;++S){let E=r[S],A=[];x=Nu(h,t,E,l,c,n,x,A),b.push(A),t=E[E.length-1]}return x}function fs(h,t,r,l,c){c=c!==void 0?c:[];let n=0;for(let x=t;x<r;x+=l)c[n++]=h.slice(x,x+l);return c.length=n,c}function fa(h,t,r,l,c){c=c!==void 0?c:[];let n=0;for(let x=0,b=r.length;x<b;++x){let S=r[x];c[n++]=fs(h,t,S,l,c[n]),t=S}return c.length=n,c}function Gu(h,t,r,l,c){c=c!==void 0?c:[];let n=0;for(let x=0,b=r.length;x<b;++x){let S=r[x];c[n++]=S.length===1&&S[0]===t?[]:fa(h,t,S,l,c[n]),t=S[S.length-1]}return c.length=n,c}function c_(h,t,r,l){let c=0,n=h[r-l],x=h[r-l+1],b=0,S=0;for(;t<r;t+=l){let R=h[t]-n,E=h[t+1]-x;c+=S*R-b*E,b=R,S=E}return c/2}function h_(h,t,r,l){let c=0;for(let n=0,x=r.length;n<x;++n){let b=r[n];c+=c_(h,t,b,l),t=b}return c}function Mb(h,t,r,l){let c=0;for(let n=0,x=r.length;n<x;++n){let b=r[n];c+=h_(h,t,b,l),t=b[b.length-1]}return c}var u_=class h extends Fr{constructor(t,r){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,r!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(r,t):this.setCoordinates(t,r)}clone(){return new h(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,r,l,c){return c<bn(this.getExtent(),t,r)?c:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(zu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Bu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,r,l,c))}getArea(){return c_(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return fs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){let r=[];return r.length=bl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,r,0),new h(r,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,r){this.setLayout(r,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=vl(this.flatCoordinates,0,t,this.stride),this.changed()}},d_=u_;function pf(h,t,r,l,c){let n;for(t+=l;t<r;t+=l)if(n=c(h.slice(t-l,t),h.slice(t,t+l)),n)return n;return!1}function wl(h,t,r,l,c,n,x){let b,S,R=(r-t)/l;if(R===1)b=t;else if(R===2)b=t,S=c;else if(R!==0){let E=h[t],A=h[t+1],z=0,W=[0];for(let ge=t+l;ge<r;ge+=l){let be=h[ge],ve=h[ge+1];z+=Math.sqrt((be-E)*(be-E)+(ve-A)*(ve-A)),W.push(z),E=be,A=ve}let re=c*z,me=Av(W,re);me<0?(S=(re-W[-me-2])/(W[-me-1]-W[-me-2]),b=t+(-me-2)*l):b=t+me*l}x=x>1?x:2,n=n||new Array(x);for(let E=0;E<x;++E)n[E]=b===void 0?NaN:S===void 0?h[b+E]:Dr(h[b+E],h[b+l+E],S);return n}function ff(h,t,r,l,c,n){if(r==t)return null;let x;if(c<h[t+l-1])return n?(x=h.slice(t,t+l),x[l-1]=c,x):null;if(h[r-1]<c)return n?(x=h.slice(r-l,r),x[l-1]=c,x):null;if(c==h[t+l-1])return h.slice(t,t+l);let b=t/l,S=r/l;for(;b<S;){let z=b+S>>1;c<h[(z+1)*l-1]?S=z:b=z+1}let R=h[b*l-1];if(c==R)return h.slice((b-1)*l,(b-1)*l+l);let E=h[(b+1)*l-1],A=(c-R)/(E-R);x=[];for(let z=0;z<l-1;++z)x.push(Dr(h[(b-1)*l+z],h[b*l+z],A));return x.push(c),x}function Ib(h,t,r,l,c,n,x){if(x)return ff(h,t,r[r.length-1],l,c,n);let b;if(c<h[l-1])return n?(b=h.slice(0,l),b[l-1]=c,b):null;if(h[h.length-1]<c)return n?(b=h.slice(h.length-l),b[l-1]=c,b):null;for(let S=0,R=r.length;S<R;++S){let E=r[S];if(t!=E){if(c<h[t+l-1])return null;if(c<=h[E-1])return ff(h,t,E,l,c,!1);t=E}}return null}function Eb(h,t,r,l,c){return!zv(c,function(x){return!ma(h,t,r,l,x[0],x[1])})}function ma(h,t,r,l,c,n){let x=0,b=h[r-l],S=h[r-l+1];for(;t<r;t+=l){let R=h[t],E=h[t+1];S<=n?E>n&&(R-b)*(n-S)-(c-b)*(E-S)>0&&x++:E<=n&&(R-b)*(n-S)-(c-b)*(E-S)<0&&x--,b=R,S=E}return x!==0}function Vu(h,t,r,l,c,n){if(r.length===0||!ma(h,t,r[0],l,c,n))return!1;for(let x=1,b=r.length;x<b;++x)if(ma(h,r[x-1],r[x],l,c,n))return!1;return!0}function Pb(h,t,r,l,c,n){if(r.length===0)return!1;for(let x=0,b=r.length;x<b;++x){let S=r[x];if(Vu(h,t,S,l,c,n))return!0;t=S[S.length-1]}return!1}function Uu(h,t,r,l,c){let n=Bg(wn(),h,t,r,l);return er(c,n)?Mo(c,n)||n[0]>=c[0]&&n[2]<=c[2]||n[1]>=c[1]&&n[3]<=c[3]?!0:pf(h,t,r,l,function(x,b){return jv(c,x,b)}):!1}function Rb(h,t,r,l,c){for(let n=0,x=r.length;n<x;++n){if(Uu(h,t,r[n],l,c))return!0;t=r[n]}return!1}function RT(h,t,r,l,c){return!!(Uu(h,t,r,l,c)||ma(h,t,r,l,c[0],c[1])||ma(h,t,r,l,c[0],c[3])||ma(h,t,r,l,c[2],c[1])||ma(h,t,r,l,c[2],c[3]))}function p_(h,t,r,l,c){if(!RT(h,t,r[0],l,c))return!1;if(r.length===1)return!0;for(let n=1,x=r.length;n<x;++n)if(Eb(h,r[n-1],r[n],l,c)&&!Uu(h,r[n-1],r[n],l,c))return!1;return!0}function Ab(h,t,r,l,c){for(let n=0,x=r.length;n<x;++n){let b=r[n];if(p_(h,t,b,l,c))return!0;t=b[b.length-1]}return!1}function mf(h,t,r,l){let c=h[t],n=h[t+1],x=0;for(let b=t+l;b<r;b+=l){let S=h[b],R=h[b+1];x+=Math.sqrt((S-c)*(S-c)+(R-n)*(R-n)),c=S,n=R}return x}var f_=class h extends Fr{constructor(t,r){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,r!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(r,t):this.setCoordinates(t,r)}appendCoordinate(t){Lr(this.flatCoordinates,t),this.changed()}clone(){let t=new h(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,r,l,c){return c<bn(this.getExtent(),t,r)?c:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(zu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Bu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,r,l,c))}forEachSegment(t){return pf(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,r){return this.layout!="XYM"&&this.layout!="XYZM"?null:(r=r!==void 0?r:!1,ff(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,r))}getCoordinates(){return fs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,r){return wl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,r,this.stride)}getLength(){return mf(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){let r=[];return r.length=bl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,r,0),new h(r,"XY")}getType(){return"LineString"}intersectsExtent(t){return Uu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,r){this.setLayout(r,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=vl(this.flatCoordinates,0,t,this.stride),this.changed()}},Es=f_;var m_=class h extends Fr{constructor(t,r,l){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,r);else if(r!==void 0&&l)this.setFlatCoordinates(r,t),this.ends_=l;else{let c=t,n=[],x=[];for(let S=0,R=c.length;S<R;++S){let E=c[S];Lr(n,E.getFlatCoordinates()),x.push(n.length)}let b=c.length===0?this.getLayout():c[0].getLayout();this.setFlatCoordinates(b,n),this.ends_=x}}appendLineString(t){Lr(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let t=new h(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,r,l,c){return c<bn(this.getExtent(),t,r)?c:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ou(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ju(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,r,l,c))}getCoordinateAtM(t,r,l){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(r=r!==void 0?r:!1,l=l!==void 0?l:!1,Ib(this.flatCoordinates,0,this.ends_,this.stride,t,r,l))}getCoordinates(){return fa(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new Es(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){let t=this.flatCoordinates,r=this.ends_,l=this.layout,c=[],n=0;for(let x=0,b=r.length;x<b;++x){let S=r[x],R=new Es(t.slice(n,S),l);c.push(R),n=S}return c}getFlatMidpoints(){let t=[],r=this.flatCoordinates,l=0,c=this.ends_,n=this.stride;for(let x=0,b=c.length;x<b;++x){let S=c[x],R=wl(r,l,S,n,.5);Lr(t,R),l=S}return t}getSimplifiedGeometryInternal(t){let r=[],l=[];return r.length=df(this.flatCoordinates,0,this.ends_,this.stride,t,r,0,l),new h(r,"XY",l)}getType(){return"MultiLineString"}intersectsExtent(t){return Rb(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,r){this.setLayout(r,t,2),this.flatCoordinates||(this.flatCoordinates=[]);let l=da(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=l.length===0?0:l[l.length-1],this.changed()}},g_=m_;var __=class h extends Fr{constructor(t,r){super(),this.setCoordinates(t,r)}clone(){let t=new h(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,r,l,c){let n=this.flatCoordinates,x=Ms(t,r,n[0],n[1]);if(x<c){let b=this.stride;for(let S=0;S<b;++S)l[S]=n[S];return l.length=b,x}return c}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return la(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Au(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,r){this.setLayout(r,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=bb(this.flatCoordinates,0,t,this.stride),this.changed()}},br=__;var y_=class h extends Fr{constructor(t,r){super(),r&&!Array.isArray(t[0])?this.setFlatCoordinates(r,t):this.setCoordinates(t,r)}appendPoint(t){Lr(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){let t=new h(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,r,l,c){if(c<bn(this.getExtent(),t,r))return c;let n=this.flatCoordinates,x=this.stride;for(let b=0,S=n.length;b<S;b+=x){let R=Ms(t,r,n[b],n[b+1]);if(R<c){c=R;for(let E=0;E<x;++E)l[E]=n[b+E];l.length=x}}return c}getCoordinates(){return fs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){let r=this.flatCoordinates.length/this.stride;return t<0||r<=t?null:new br(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){let t=this.flatCoordinates,r=this.layout,l=this.stride,c=[];for(let n=0,x=t.length;n<x;n+=l){let b=new br(t.slice(n,n+l),r);c.push(b)}return c}getType(){return"MultiPoint"}intersectsExtent(t){let r=this.flatCoordinates,l=this.stride;for(let c=0,n=r.length;c<n;c+=l){let x=r[c],b=r[c+1];if(Au(t,x,b))return!0}return!1}setCoordinates(t,r){this.setLayout(r,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=vl(this.flatCoordinates,0,t,this.stride),this.changed()}},Zu=y_;function qu(h,t,r,l,c,n,x){let b,S,R,E,A,z,W,re=c[n+1],me=[];for(let ve=0,De=r.length;ve<De;++ve){let ke=r[ve];for(E=h[ke-l],z=h[ke-l+1],b=t;b<ke;b+=l)A=h[b],W=h[b+1],(re<=z&&W<=re||z<=re&&re<=W)&&(R=(re-z)/(W-z)*(A-E)+E,me.push(R)),E=A,z=W}let ge=NaN,be=-1/0;for(me.sort(Ss),E=me[0],b=1,S=me.length;b<S;++b){A=me[b];let ve=Math.abs(A-E);ve>be&&(R=(E+A)/2,Vu(h,t,r,l,R,re)&&(ge=R,be=ve)),E=A}return isNaN(ge)&&(ge=c[n]),x?(x.push(ge,re,be),x):[ge,re,be]}function gf(h,t,r,l,c){let n=[];for(let x=0,b=r.length;x<b;++x){let S=r[x];n=qu(h,t,S,l,c,2*x,n),t=S[S.length-1]}return n}function Lb(h,t,r,l){for(;t<r-l;){for(let c=0;c<l;++c){let n=h[t+c];h[t+c]=h[r-l+c],h[r-l+c]=n}t+=l,r-=l}}function x_(h,t,r,l){let c=0,n=h[r-l],x=h[r-l+1];for(;t<r;t+=l){let b=h[t],S=h[t+1];c+=(b-n)*(S+x),n=b,x=S}return c===0?void 0:c>0}function Wu(h,t,r,l,c){c=c!==void 0?c:!1;for(let n=0,x=r.length;n<x;++n){let b=r[n],S=x_(h,t,b,l);if(n===0){if(c&&S||!c&&!S)return!1}else if(c&&!S||!c&&S)return!1;t=b}return!0}function _f(h,t,r,l,c){for(let n=0,x=r.length;n<x;++n){let b=r[n];if(!Wu(h,t,b,l,c))return!1;b.length&&(t=b[b.length-1])}return!0}function Fc(h,t,r,l,c){c=c!==void 0?c:!1;for(let n=0,x=r.length;n<x;++n){let b=r[n],S=x_(h,t,b,l);(n===0?c&&S||!c&&!S:c&&!S||!c&&S)&&Lb(h,t,b,l),t=b}return t}function $u(h,t,r,l,c){for(let n=0,x=r.length;n<x;++n)t=Fc(h,t,r[n],l,c);return t}function kb(h,t){let r=[],l=0,c=0,n;for(let x=0,b=t.length;x<b;++x){let S=t[x],R=x_(h,l,S,2);if(n===void 0&&(n=R),R===n)r.push(t.slice(c,x+1));else{if(r.length===0)continue;r[r.length-1].push(t[c])}c=x+1,l=S}return r}var Xu=class h extends Fr{constructor(t,r,l){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,r!==void 0&&l?(this.setFlatCoordinates(r,t),this.ends_=l):this.setCoordinates(t,r)}appendLinearRing(t){this.flatCoordinates?Lr(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let t=new h(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,r,l,c){return c<bn(this.getExtent(),t,r)?c:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ou(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ju(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,r,l,c))}containsXY(t,r){return Vu(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,r)}getArea(){return h_(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let r;return t!==void 0?(r=this.getOrientedFlatCoordinates().slice(),Fc(r,0,this.ends_,this.stride,t)):r=this.flatCoordinates,fa(r,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let t=ds(this.getExtent());this.flatInteriorPoint_=qu(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new br(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new d_(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){let t=this.layout,r=this.flatCoordinates,l=this.ends_,c=[],n=0;for(let x=0,b=l.length;x<b;++x){let S=l[x],R=new d_(r.slice(n,S),t);c.push(R),n=S}return c}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let t=this.flatCoordinates;Wu(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Fc(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let r=[],l=[];return r.length=Nu(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),r,0,l),new h(r,"XY",l)}getType(){return"Polygon"}intersectsExtent(t){return p_(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,r){this.setLayout(r,t,2),this.flatCoordinates||(this.flatCoordinates=[]);let l=da(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=l.length===0?0:l[l.length-1],this.changed()}},zc=Xu;function v_(h){if(Lu(h))throw new Error("Cannot create polygon from empty extent");let t=h[0],r=h[1],l=h[2],c=h[3],n=[t,r,t,c,l,c,l,r,t,r];return new Xu(n,"XY",[n.length])}function b_(h,t,r){t=t||32;let l=h.getStride(),c=h.getLayout(),n=h.getCenter(),x=l*(t+1),b=new Array(x);for(let E=0;E<x;E+=l){b[E]=0,b[E+1]=0;for(let A=2;A<l;A++)b[E+A]=n[A]}let S=[b.length],R=new Xu(b,c,S);return AT(R,n,h.getRadius(),r),R}function AT(h,t,r,l){let c=h.getFlatCoordinates(),n=h.getStride(),x=c.length/n-1,b=l||0;for(let S=0;S<=x;++S){let R=S*n,E=b+gl(S,x)*2*Math.PI/x;c[R]=t[0]+r*Math.cos(E),c[R+1]=t[1]+r*Math.sin(E)}h.changed()}function yf(h,t,r,l){let c=[],n=wn();for(let x=0,b=r.length;x<b;++x){let S=r[x];n=Ic(h,t,S[0],l),c.push((n[0]+n[2])/2,(n[1]+n[3])/2),t=S[S.length-1]}return c}var w_=class h extends Fr{constructor(t,r,l){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!l&&!Array.isArray(t[0])){let c=t,n=[],x=[];for(let b=0,S=c.length;b<S;++b){let R=c[b],E=n.length,A=R.getEnds();for(let z=0,W=A.length;z<W;++z)A[z]+=E;Lr(n,R.getFlatCoordinates()),x.push(A)}r=c.length===0?this.getLayout():c[0].getLayout(),t=n,l=x}r!==void 0&&l?(this.setFlatCoordinates(r,t),this.endss_=l):this.setCoordinates(t,r)}appendPolygon(t){let r;if(!this.flatCoordinates)this.flatCoordinates=t.getFlatCoordinates().slice(),r=t.getEnds().slice(),this.endss_.push();else{let l=this.flatCoordinates.length;Lr(this.flatCoordinates,t.getFlatCoordinates()),r=t.getEnds().slice();for(let c=0,n=r.length;c<n;++c)r[c]+=l}this.endss_.push(r),this.changed()}clone(){let t=this.endss_.length,r=new Array(t);for(let c=0;c<t;++c)r[c]=this.endss_[c].slice();let l=new h(this.flatCoordinates.slice(),this.layout,r);return l.applyProperties(this),l}closestPointXY(t,r,l,c){return c<bn(this.getExtent(),t,r)?c:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Sb(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Tb(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,r,l,c))}containsXY(t,r){return Pb(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,r)}getArea(){return Mb(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let r;return t!==void 0?(r=this.getOrientedFlatCoordinates().slice(),$u(r,0,this.endss_,this.stride,t)):r=this.flatCoordinates,Gu(r,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let t=yf(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=gf(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Zu(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let t=this.flatCoordinates;_f(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=$u(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let r=[],l=[];return r.length=Cb(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),r,0,l),new h(r,"XY",l)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let r;if(t===0)r=0;else{let n=this.endss_[t-1];r=n[n.length-1]}let l=this.endss_[t].slice(),c=l[l.length-1];if(r!==0)for(let n=0,x=l.length;n<x;++n)l[n]-=r;return new zc(this.flatCoordinates.slice(r,c),this.layout,l)}getPolygons(){let t=this.layout,r=this.flatCoordinates,l=this.endss_,c=[],n=0;for(let x=0,b=l.length;x<b;++x){let S=l[x].slice(),R=S[S.length-1];if(n!==0)for(let A=0,z=S.length;A<z;++A)S[A]-=n;let E=new zc(r.slice(n,R),t,S);c.push(E),n=R}return c}getType(){return"MultiPolygon"}intersectsExtent(t){return Ab(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,r){this.setLayout(r,t,3),this.flatCoordinates||(this.flatCoordinates=[]);let l=uf(this.flatCoordinates,0,t,this.stride,this.endss_);if(l.length===0)this.flatCoordinates.length=0;else{let c=l[l.length-1];this.flatCoordinates.length=c.length===0?0:c[c.length-1]}this.changed()}},S_=w_;var LT=(h,t,r)=>{let{coordinate:l,olGeometry:c,time_intervals:n}=t.properties,{coordinates:x,type:b}=t.geometry,S=c,R,E;if(c&&(b=S.getType(),x=S.getCoordinates()),r&&l)R=l;else if(b==="Point")R=x;else if(b==="LineString"){S||(S=new Es(x));let A=n||[[]],z=A[0],W=A[A.length-1];if(h<z[0])[,,E]=z,R=S.getFirstCoordinate();else if(h>W[0])[,,E]=W,R=S.getLastCoordinate();else for(let re=0;re<A.length-1;re+=1){let[me,ge]=A[re],[be,ve]=A[re+1];if(me<=h&&h<=be){let ke=Math.min((h-me)/(be-me),1)*(ve-ge)+ge;R=S.getCoordinateAt(ke),[,,E]=A[re];break}}}else console.error("This geometry type is not supported. Only Point or LineString are. Current geometry: ",S);return{coord:R,rotation:E}},Hu=LT;var kT=(h,t,r,l,c)=>{if(!h)return{renderedTrajectories:[]};let{center:n,pixelRatio:x=1,resolution:b,rotation:S=0,size:R=[],time:E=Date.now()}=l;if(!b||!n)return{renderedTrajectories:[]};let{filter:A,getScreenPixel:z=(He,ot)=>(ot.zoom||0)<12?He.map(vt=>Math.floor(vt)):He,hoverVehicleId:W,noInterpolate:re=!1,selectedVehicleId:me}=c,ge=h.getContext("2d");ge?.clearRect(0,0,h.width,h.height);let[be,ve]=R;be&&ve&&(h.width!==be*x||h.height!==ve*x)&&([h.width,h.height]=[be*x,ve*x]);let De=Yr(yr(),R[0]/2,R[1]/2,1/b,-1/b,-S,-n[0],-n[1]);h.style&&(h.style.width=`${h.width/x}px`,h.style.height=`${h.height/x}px`);let ke,je,Re,tt,Je=[];for(let He=t.length-1;He>=0;He-=1){let ot=t[He];if(A&&!A(ot))continue;let{timeOffset:vt,train_id:ct}=ot.properties,{coord:It,rotation:ut}=Hu(E-(vt||0),ot,re);if(t[He].properties.coordinate=It,t[He].properties.rotation=ut,!It)continue;let yt=Ar(De,[...It]);if(!yt||(yt=yt.map(dt=>dt*x),yt[0]<0||yt[0]>h.width||yt[1]<0||yt[1]>h.height))continue;let xt=r(ot,l,c);if(xt){if(W!==ct&&me!==ct){let[dt,St]=z([yt[0]-xt.width/2,yt[1]-xt.height/2],l);ge?.drawImage(xt,dt,St)}W&&W===ct&&(ke=xt,je=yt),me&&me===ct&&(Re=xt,tt=yt),Je.push(ot)}}return Re&&tt&&ge?.drawImage(Re,Math.floor(tt[0]-Re.width/2),Math.floor(tt[1]-Re.height/2)),ke&&je&&ge?.drawImage(ke,Math.floor(je[0]-ke.width/2),Math.floor(je[1]-ke.height/2)),{renderedTrajectories:Je}},Yu=kT;var DT=(h,t,r=!1)=>{let l=["HIDDEN","LEAVING","BOARDING"],c=h.has_fzo&&l.indexOf(h.state)>-1,n=t.has_fzo&&l.indexOf(t.state)>-1;if(c||n){if(c!==n)return c?-1:1;if(h.state!==t.state)return l.indexOf(h.state)-l.indexOf(t.state)}let x=null,b=null,S=Date.now();return r?(x=new Date(h.min_arrival_time||h.time).getTime()-S,b=new Date(t.min_arrival_time||t.time).getTime()-S):(x=new Date(h.time).getTime()-S,b=new Date(t.time).getTime()-S),x-b},Ku=DT;var FT=(h,t=!1,r=30)=>{let l=Object.keys(h).map(A=>h[A]);l.sort((A,z)=>Ku(A,z,t));let c=new Date;c.setMinutes(c.getMinutes()+r);let n=c.getTime(),x=new Date;x.setMinutes(x.getMinutes()-r);let b=x.getTime(),S=[],R=[],E=null;for(let A=l.length-1;A>=0;A-=1){let z={...l[A]},W=new Date(z.time).getTime();W>b&&W<n&&(z.state==="BOARDING"&&(R.includes(z.platform)?z.state="HIDDEN":R.push(z.platform)),E&&z.to[0]===E.to[0]&&Math.abs(W-E.time)<1e3&&z.line.name===E.line.name&&(z.state="HIDDEN"),/(STOP_CANCELLED|JOURNEY_CANCELLED)/.test(z.state)&&(z.cancelled=!0),E=z,E.time=W,S.unshift(z))}return S},Ju=FT;var zT=(h,t=!1,r=30,l=100)=>{let c={},n={};return x=>{let{source:b,content:S}=x;c[b]&&window.clearTimeout(c[b]),S&&(n[S.call_id]=S,c[b]=window.setTimeout(()=>{let R=Ju(n,t||!1,r);h(R)},l))}},T_=zT;var Oc={};dg(Oc,{MOTS_ALL:()=>jT,MOTS_ONLY_RAIL:()=>Ps,MOTS_WITHOUT_CABLE:()=>xf,MOTS_WITH_CABLE:()=>BT,bgColors:()=>Fb,getBgColor:()=>GT,getDelayColor:()=>ZT,getDelayText:()=>qT,getRadius:()=>NT,getTextColor:()=>VT,getTextSize:()=>UT,getTypeIndex:()=>vf,textColors:()=>zb,types:()=>Db});var OT=[[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15]],Ps=["rail"],BT=["cablecar","gondola","funicular","coach"],xf=["tram","subway","rail","bus"],jT=["tram","subway","rail","bus","ferry","cablecar","gondola","funicular","coach"],Db=[/^Tram/i,/^Subway( \/ Metro \/ S-Bahn)?/i,/^Train/i,/^Bus/i,/^Ferry/i,/^Cable ?Car/i,/^Gondola/i,/^Funicular/i,/^(Long distance bus|coach)/i,/^Rail/i],Fb=["#ffb400","#ff5400","#ff8080","#ea0000","#3000ff","#ffb400","#41a27b","#00d237","#b5b5b5","#ff8080"],zb=["#000000","#ffffff","#000000","#ffffff","#ffffff","#000000","#ffffff","#000000","#000000","#000000"],vf=h=>typeof h=="string"?Db.findIndex(t=>t.test(h)):h,NT=(h,t)=>{try{let r=vf(h||0);return OT[r][t]}catch{return 1}},GT=h=>{try{let t=vf(h);return Fb[t]}catch{return"#ffffff"}},VT=h=>{try{let t=vf(h);return zb[t]}catch{return"#ffffff"}},UT=(h,t,r,l,c)=>{if(!h)return 0;h.font=c(l,r);let n=h.measureText(r),x=25,b=0;for(;n.width>t-6&&b<x;)l-=.5,h.font=c(l,r),n=h.measureText(r),b+=1;return l},ZT=(h,t,r)=>t?r?"#ff0000":"#a0a0a0":h===null?"#a0a0a0":h>=36e5?"#ed004c":h>=5e5?"#e80000":h>=3e5?"#ff4a00":h>=18e4?"#f7bf00":"#00a00c",qT=(h,t)=>t?String.fromCodePoint(215):h>=36e5?`+${Math.round(h/36e5)}h`:h>=6e4?`+${Math.round(h/6e4)}m`:h>=1e3?`+${Math.round(h/1e3)}s`:h>0?`+${h}ms`:"";var Bc="vectorTileFeature";var Ob={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var C_=class extends xr{constructor(t){super();let r=t.element;r&&!t.target&&!r.style.pointerEvents&&(r.style.pointerEvents="auto"),this.element=r||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let r=0,l=this.listenerKeys.length;r<l;++r)Kr(this.listenerKeys[r]);if(this.listenerKeys.length=0,this.map_=t,t){let r=this.target_??t.getOverlayContainerStopEvent();this.element&&r.appendChild(this.element),this.render!==Ts&&this.listenerKeys.push(kr(t,Ob.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}},jc=C_;var Yt={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var M_=class extends xr{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;let r=Object.assign({},t);typeof t.properties=="object"&&(delete r.properties,Object.assign(r,t.properties)),r[Yt.OPACITY]=t.opacity!==void 0?t.opacity:1,di(typeof r[Yt.OPACITY]=="number","Layer opacity must be a number"),r[Yt.VISIBLE]=t.visible!==void 0?t.visible:!0,r[Yt.Z_INDEX]=t.zIndex,r[Yt.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,r[Yt.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,r[Yt.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,r[Yt.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=r.className!==void 0?r.className:"ol-layer",delete r.className,this.setProperties(r),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){let r=this.state_||{layer:this,managed:t===void 0?!0:t},l=this.getZIndex();return r.opacity=Pi(Math.round(this.getOpacity()*100)/100,0,1),r.visible=this.getVisible(),r.extent=this.getExtent(),r.zIndex=l===void 0&&!r.managed?1/0:l,r.maxResolution=this.getMaxResolution(),r.minResolution=Math.max(this.getMinResolution(),0),r.minZoom=this.getMinZoom(),r.maxZoom=this.getMaxZoom(),this.state_=r,r}getLayersArray(t){return Tt()}getLayerStatesArray(t){return Tt()}getExtent(){return this.get(Yt.EXTENT)}getMaxResolution(){return this.get(Yt.MAX_RESOLUTION)}getMinResolution(){return this.get(Yt.MIN_RESOLUTION)}getMinZoom(){return this.get(Yt.MIN_ZOOM)}getMaxZoom(){return this.get(Yt.MAX_ZOOM)}getOpacity(){return this.get(Yt.OPACITY)}getSourceState(){return Tt()}getVisible(){return this.get(Yt.VISIBLE)}getZIndex(){return this.get(Yt.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Yt.EXTENT,t)}setMaxResolution(t){this.set(Yt.MAX_RESOLUTION,t)}setMinResolution(t){this.set(Yt.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(Yt.MAX_ZOOM,t)}setMinZoom(t){this.set(Yt.MIN_ZOOM,t)}setOpacity(t){di(typeof t=="number","Layer opacity must be a number"),this.set(Yt.OPACITY,t)}setVisible(t){this.set(Yt.VISIBLE,t)}setZIndex(t){this.set(Yt.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},Bb=M_;var Ws={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var Tn={ANIMATING:0,INTERACTING:1};var ms={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function I_(h,t,r){return function(l,c,n,x,b){if(!l)return;if(!c&&!t)return l;let S=t?0:n[0]*c,R=t?0:n[1]*c,E=b?b[0]:0,A=b?b[1]:0,z=h[0]+S/2+E,W=h[2]-S/2+E,re=h[1]+R/2+A,me=h[3]-R/2+A;z>W&&(z=(W+z)/2,W=z),re>me&&(re=(me+re)/2,me=re);let ge=Pi(l[0],z,W),be=Pi(l[1],re,me);if(x&&r&&c){let ve=30*c;ge+=-ve*Math.log(1+Math.max(0,z-l[0])/ve)+ve*Math.log(1+Math.max(0,l[0]-W)/ve),be+=-ve*Math.log(1+Math.max(0,re-l[1])/ve)+ve*Math.log(1+Math.max(0,l[1]-me)/ve)}return[ge,be]}}function jb(h){return h}function E_(h,t,r,l){let c=Ti(t)/r[0],n=ar(t)/r[1];return l?Math.min(h,Math.max(c,n)):Math.min(h,Math.min(c,n))}function P_(h,t,r){let l=Math.min(h,t),c=50;return l*=Math.log(1+c*Math.max(0,h/t-1))/c+1,r&&(l=Math.max(l,r),l/=Math.log(1+c*Math.max(0,r/h-1))/c+1),Pi(l,r/2,t*2)}function Nb(h,t,r,l){return t=t!==void 0?t:!0,function(c,n,x,b){if(c!==void 0){let S=h[0],R=h[h.length-1],E=r?E_(S,r,x,l):S;if(b)return t?P_(c,E,R):Pi(c,R,E);let A=Math.min(E,c),z=Math.floor(qp(h,A,n));return h[z]>E&&z<h.length-1?h[z+1]:h[z]}}}function Gb(h,t,r,l,c,n){return l=l!==void 0?l:!0,r=r!==void 0?r:0,function(x,b,S,R){if(x!==void 0){let E=c?E_(t,c,S,n):t;if(R)return l?P_(x,E,r):Pi(x,r,E);let A=1e-9,z=Math.ceil(Math.log(t/E)/Math.log(h)-A),W=-b*(.5-A)+.5,re=Math.min(E,x),me=Math.floor(Math.log(t/re)/Math.log(h)+W),ge=Math.max(z,me),be=t/Math.pow(h,ge);return Pi(be,r,E)}}}function R_(h,t,r,l,c){return r=r!==void 0?r:!0,function(n,x,b,S){if(n!==void 0){let R=l?E_(h,l,b,c):h;return!r||!S?Pi(n,t,R):P_(n,R,t)}}}function Vb(h){if(h!==void 0)return 0}function A_(h){if(h!==void 0)return h}function Ub(h){let t=2*Math.PI/h;return function(r,l){if(l)return r;if(r!==void 0)return r=Math.floor(r/t+.5)*t,r}}function Zb(h){let t=h===void 0?ml(5):h;return function(r,l){return l||r===void 0?r:Math.abs(r)<=t?0:r}}function WT(h){return Math.pow(h,3)}function qb(h){return 1-WT(1-h)}function Wb(h){return 3*h*h-2*h*h*h}var L_=0,D_=class extends xr{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=af(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&t_(),t.center&&(t.center=Di(t.center,this.projection_)),t.extent&&(t.extent=qs(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){let r=Object.assign({},t);for(let b in ms)delete r[b];this.setProperties(r,!0);let l=XT(t);this.maxResolution_=l.maxResolution,this.minResolution_=l.minResolution,this.zoomFactor_=l.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=l.minZoom;let c=$T(t),n=l.constraint,x=HT(t);this.constraints_={center:c,resolution:n,rotation:x},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let r=this.padding_;this.padding_=t;let l=this.getCenterInternal();if(l){let c=t||[0,0,0,0];r=r||[0,0,0,0];let n=this.getResolution(),x=n/2*(c[3]-r[3]+r[1]-c[1]),b=n/2*(c[0]-r[0]+r[2]-c[2]);this.setCenterInternal([l[0]+x,l[1]-b])}}getUpdatedOptions_(t){let r=this.getProperties();return r.resolution!==void 0?r.resolution=this.getResolution():r.zoom=this.getZoom(),r.center=this.getCenterInternal(),r.rotation=this.getRotation(),Object.assign({},r,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let r=new Array(arguments.length);for(let l=0;l<r.length;++l){let c=arguments[l];c.center&&(c=Object.assign({},c),c.center=Di(c.center,this.getProjection())),c.anchor&&(c=Object.assign({},c),c.anchor=Di(c.anchor,this.getProjection())),r[l]=c}this.animateInternal.apply(this,r)}animateInternal(t){let r=arguments.length,l;r>1&&typeof arguments[r-1]=="function"&&(l=arguments[r-1],--r);let c=0;for(;c<r&&!this.isDef();++c){let E=arguments[c];E.center&&this.setCenterInternal(E.center),E.zoom!==void 0?this.setZoom(E.zoom):E.resolution&&this.setResolution(E.resolution),E.rotation!==void 0&&this.setRotation(E.rotation)}if(c===r){l&&bf(l,!0);return}let n=Date.now(),x=this.targetCenter_.slice(),b=this.targetResolution_,S=this.targetRotation_,R=[];for(;c<r;++c){let E=arguments[c],A={start:n,complete:!1,anchor:E.anchor,duration:E.duration!==void 0?E.duration:1e3,easing:E.easing||Wb,callback:l};if(E.center&&(A.sourceCenter=x,A.targetCenter=E.center.slice(),x=A.targetCenter),E.zoom!==void 0?(A.sourceResolution=b,A.targetResolution=this.getResolutionForZoom(E.zoom),b=A.targetResolution):E.resolution&&(A.sourceResolution=b,A.targetResolution=E.resolution,b=A.targetResolution),E.rotation!==void 0){A.sourceRotation=S;let z=gl(E.rotation-S+Math.PI,2*Math.PI)-Math.PI;A.targetRotation=S+z,S=A.targetRotation}YT(A)?A.complete=!0:n+=A.duration,R.push(A)}this.animations_.push(R),this.setHint(Tn.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Tn.ANIMATING]>0}getInteracting(){return this.hints_[Tn.INTERACTING]>0}cancelAnimations(){this.setHint(Tn.ANIMATING,-this.hints_[Tn.ANIMATING]);let t;for(let r=0,l=this.animations_.length;r<l;++r){let c=this.animations_[r];if(c[0].callback&&bf(c[0].callback,!1),!t)for(let n=0,x=c.length;n<x;++n){let b=c[n];if(!b.complete){t=b.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let t=Date.now(),r=!1;for(let l=this.animations_.length-1;l>=0;--l){let c=this.animations_[l],n=!0;for(let x=0,b=c.length;x<b;++x){let S=c[x];if(S.complete)continue;let R=t-S.start,E=S.duration>0?R/S.duration:1;E>=1?(S.complete=!0,E=1):n=!1;let A=S.easing(E);if(S.sourceCenter){let z=S.sourceCenter[0],W=S.sourceCenter[1],re=S.targetCenter[0],me=S.targetCenter[1];this.nextCenter_=S.targetCenter;let ge=z+A*(re-z),be=W+A*(me-W);this.targetCenter_=[ge,be]}if(S.sourceResolution&&S.targetResolution){let z=A===1?S.targetResolution:S.sourceResolution+A*(S.targetResolution-S.sourceResolution);if(S.anchor){let W=this.getViewportSize_(this.getRotation()),re=this.constraints_.resolution(z,0,W,!0);this.targetCenter_=this.calculateCenterZoom(re,S.anchor)}this.nextResolution_=S.targetResolution,this.targetResolution_=z,this.applyTargetState_(!0)}if(S.sourceRotation!==void 0&&S.targetRotation!==void 0){let z=A===1?gl(S.targetRotation+Math.PI,2*Math.PI)-Math.PI:S.sourceRotation+A*(S.targetRotation-S.sourceRotation);if(S.anchor){let W=this.constraints_.rotation(z,!0);this.targetCenter_=this.calculateCenterRotate(W,S.anchor)}this.nextRotation_=S.targetRotation,this.targetRotation_=z}if(this.applyTargetState_(!0),r=!0,!S.complete)break}if(n){this.animations_[l]=null,this.setHint(Tn.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let x=c[0].callback;x&&bf(x,!0)}}this.animations_=this.animations_.filter(Boolean),r&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,r){let l,c=this.getCenterInternal();return c!==void 0&&(l=[c[0]-r[0],c[1]-r[1]],Yv(l,t-this.getRotation()),Hv(l,r)),l}calculateCenterZoom(t,r){let l,c=this.getCenterInternal(),n=this.getResolution();if(c!==void 0&&n!==void 0){let x=r[0]-t*(r[0]-c[0])/n,b=r[1]-t*(r[1]-c[1])/n;l=[x,b]}return l}getViewportSize_(t){let r=this.viewportSize_;if(t){let l=r[0],c=r[1];return[Math.abs(l*Math.cos(t))+Math.abs(c*Math.sin(t)),Math.abs(l*Math.sin(t))+Math.abs(c*Math.cos(t))]}return r}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let t=this.getCenterInternal();return t&&ha(t,this.getProjection())}getCenterInternal(){return this.get(ms.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){let r=this.calculateExtentInternal(t);return Zs(r,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();let r=this.getCenterInternal();di(r,"The view center is not defined");let l=this.getResolution();di(l!==void 0,"The view resolution is not defined");let c=this.getRotation();return di(c!==void 0,"The view rotation is not defined"),Ov(r,l,c,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(ms.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,r){return this.getResolutionForExtentInternal(qs(t,this.getProjection()),r)}getResolutionForExtentInternal(t,r){r=r||this.getViewportSizeMinusPadding_();let l=Ti(t)/r[0],c=ar(t)/r[1];return Math.max(l,c)}getResolutionForValueFunction(t){t=t||2;let r=this.getConstrainedResolution(this.maxResolution_),l=this.minResolution_,c=Math.log(r/l)/Math.log(t);return function(n){return r/Math.pow(t,n*c)}}getRotation(){return this.get(ms.ROTATION)}getValueForResolutionFunction(t){let r=Math.log(t||2),l=this.getConstrainedResolution(this.maxResolution_),c=this.minResolution_,n=Math.log(l/c)/r;return function(x){return Math.log(l/x)/r/n}}getViewportSizeMinusPadding_(t){let r=this.getViewportSize_(t),l=this.padding_;return l&&(r=[r[0]-l[1]-l[3],r[1]-l[0]-l[2]]),r}getState(){let t=this.getProjection(),r=this.getResolution(),l=this.getRotation(),c=this.getCenterInternal(),n=this.padding_;if(n){let x=this.getViewportSizeMinusPadding_();c=k_(c,this.getViewportSize_(),[x[0]/2+n[3],x[1]/2+n[0]],r,l)}return{center:c.slice(0),projection:t!==void 0?t:null,resolution:r,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:l,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t,r=this.getResolution();return r!==void 0&&(t=this.getZoomForResolution(r)),t}getZoomForResolution(t){let r=this.minZoom_||0,l,c;if(this.resolutions_){let n=qp(this.resolutions_,t,1);r=n,l=this.resolutions_[n],n==this.resolutions_.length-1?c=2:c=l/this.resolutions_[n+1]}else l=this.maxResolution_,c=this.zoomFactor_;return r+Math.log(l/t)/Math.log(c)}getResolutionForZoom(t){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let r=Pi(Math.floor(t),0,this.resolutions_.length-2),l=this.resolutions_[r]/this.resolutions_[r+1];return this.resolutions_[r]/Math.pow(l,Pi(t-r,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,r){let l;if(di(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){di(!Lu(t),"Cannot fit empty extent provided as `geometry`");let c=qs(t,this.getProjection());l=v_(c)}else if(t.getType()==="Circle"){let c=qs(t.getExtent(),this.getProjection());l=v_(c),l.rotate(this.getRotation(),ds(c))}else{let c=Hn();c?l=t.clone().transform(c,this.getProjection()):l=t}this.fitInternal(l,r)}rotatedExtentForGeometry(t){let r=this.getRotation(),l=Math.cos(r),c=Math.sin(-r),n=t.getFlatCoordinates(),x=t.getStride(),b=1/0,S=1/0,R=-1/0,E=-1/0;for(let A=0,z=n.length;A<z;A+=x){let W=n[A]*l-n[A+1]*c,re=n[A]*c+n[A+1]*l;b=Math.min(b,W),S=Math.min(S,re),R=Math.max(R,W),E=Math.max(E,re)}return[b,S,R,E]}fitInternal(t,r){r=r||{};let l=r.size;l||(l=this.getViewportSizeMinusPadding_());let c=r.padding!==void 0?r.padding:[0,0,0,0],n=r.nearest!==void 0?r.nearest:!1,x;r.minResolution!==void 0?x=r.minResolution:r.maxZoom!==void 0?x=this.getResolutionForZoom(r.maxZoom):x=0;let b=this.rotatedExtentForGeometry(t),S=this.getResolutionForExtentInternal(b,[l[0]-c[1]-c[3],l[1]-c[0]-c[2]]);S=isNaN(S)?x:Math.max(S,x),S=this.getConstrainedResolution(S,n?0:1);let R=this.getRotation(),E=Math.sin(R),A=Math.cos(R),z=ds(b);z[0]+=(c[1]-c[3])/2*S,z[1]+=(c[0]-c[2])/2*S;let W=z[0]*A-z[1]*E,re=z[1]*A+z[0]*E,me=this.getConstrainedCenter([W,re],S),ge=r.callback?r.callback:Ts;r.duration!==void 0?this.animateInternal({resolution:S,center:me,duration:r.duration,easing:r.easing},ge):(this.targetResolution_=S,this.targetCenter_=me,this.applyTargetState_(!1,!0),bf(ge,!0))}centerOn(t,r,l){this.centerOnInternal(Di(t,this.getProjection()),r,l)}centerOnInternal(t,r,l){this.setCenterInternal(k_(t,r,l,this.getResolution(),this.getRotation()))}calculateCenterShift(t,r,l,c){let n,x=this.padding_;if(x&&t){let b=this.getViewportSizeMinusPadding_(-l),S=k_(t,c,[b[0]/2+x[3],b[1]/2+x[0]],r,l);n=[t[0]-S[0],t[1]-S[1]]}return n}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){let r=ha(this.targetCenter_,this.getProjection());this.setCenter([r[0]+t[0],r[1]+t[1]])}adjustCenterInternal(t){let r=this.targetCenter_;this.setCenterInternal([r[0]+t[0],r[1]+t[1]])}adjustResolution(t,r){r=r&&Di(r,this.getProjection()),this.adjustResolutionInternal(t,r)}adjustResolutionInternal(t,r){let l=this.getAnimating()||this.getInteracting(),c=this.getViewportSize_(this.getRotation()),n=this.constraints_.resolution(this.targetResolution_*t,0,c,l);r&&(this.targetCenter_=this.calculateCenterZoom(n,r)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,r){this.adjustResolution(Math.pow(this.zoomFactor_,-t),r)}adjustRotation(t,r){r&&(r=Di(r,this.getProjection())),this.adjustRotationInternal(t,r)}adjustRotationInternal(t,r){let l=this.getAnimating()||this.getInteracting(),c=this.constraints_.rotation(this.targetRotation_+t,l);r&&(this.targetCenter_=this.calculateCenterRotate(c,r)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&Di(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,r){return this.hints_[t]+=r,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,r){let l=this.getAnimating()||this.getInteracting()||r,c=this.constraints_.rotation(this.targetRotation_,l),n=this.getViewportSize_(c),x=this.constraints_.resolution(this.targetResolution_,0,n,l),b=this.constraints_.center(this.targetCenter_,x,n,l,this.calculateCenterShift(this.targetCenter_,x,c,n));this.get(ms.ROTATION)!==c&&this.set(ms.ROTATION,c),this.get(ms.RESOLUTION)!==x&&(this.set(ms.RESOLUTION,x),this.set("zoom",this.getZoom(),!0)),(!b||!this.get(ms.CENTER)||!lr(this.get(ms.CENTER),b))&&this.set(ms.CENTER,b),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,r,l){t=t!==void 0?t:200;let c=r||0,n=this.constraints_.rotation(this.targetRotation_),x=this.getViewportSize_(n),b=this.constraints_.resolution(this.targetResolution_,c,x),S=this.constraints_.center(this.targetCenter_,b,x,!1,this.calculateCenterShift(this.targetCenter_,b,n,x));if(t===0&&!this.cancelAnchor_){this.targetResolution_=b,this.targetRotation_=n,this.targetCenter_=S,this.applyTargetState_();return}l=l||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==b||this.getRotation()!==n||!this.getCenterInternal()||!lr(this.getCenterInternal(),S))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:n,center:S,resolution:b,duration:t,easing:qb,anchor:l}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Tn.INTERACTING,1)}endInteraction(t,r,l){l=l&&Di(l,this.getProjection()),this.endInteractionInternal(t,r,l)}endInteractionInternal(t,r,l){this.getInteracting()&&(this.setHint(Tn.INTERACTING,-1),this.resolveConstraints(t,r,l))}getConstrainedCenter(t,r){let l=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,r||this.getResolution(),l)}getConstrainedZoom(t,r){let l=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(l,r))}getConstrainedResolution(t,r){r=r||0;let l=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,r,l)}};function bf(h,t){setTimeout(function(){h(t)},0)}function $T(h){if(h.extent!==void 0){let r=h.smoothExtentConstraint!==void 0?h.smoothExtentConstraint:!0;return I_(h.extent,h.constrainOnlyCenter,r)}let t=af(h.projection,"EPSG:3857");if(h.multiWorld!==!0&&t.isGlobal()){let r=t.getExtent().slice();return r[0]=-1/0,r[2]=1/0,I_(r,!1,!1)}return jb}function XT(h){let t,r,l,x=h.minZoom!==void 0?h.minZoom:L_,b=h.maxZoom!==void 0?h.maxZoom:28,S=h.zoomFactor!==void 0?h.zoomFactor:2,R=h.multiWorld!==void 0?h.multiWorld:!1,E=h.smoothResolutionConstraint!==void 0?h.smoothResolutionConstraint:!0,A=h.showFullExtent!==void 0?h.showFullExtent:!1,z=af(h.projection,"EPSG:3857"),W=z.getExtent(),re=h.constrainOnlyCenter,me=h.extent;if(!R&&!me&&z.isGlobal()&&(re=!1,me=W),h.resolutions!==void 0){let ge=h.resolutions;r=ge[x],l=ge[b]!==void 0?ge[b]:ge[ge.length-1],h.constrainResolution?t=Nb(ge,E,!re&&me,A):t=R_(r,l,E,!re&&me,A)}else{let be=(W?Math.max(Ti(W),ar(W)):360*ku.degrees/z.getMetersPerUnit())/256/Math.pow(2,L_),ve=be/Math.pow(2,28-L_);r=h.maxResolution,r!==void 0?x=0:r=be/Math.pow(S,x),l=h.minResolution,l===void 0&&(h.maxZoom!==void 0?h.maxResolution!==void 0?l=r/Math.pow(S,b):l=be/Math.pow(S,b):l=ve),b=x+Math.floor(Math.log(r/l)/Math.log(S)),l=r/Math.pow(S,b-x),h.constrainResolution?t=Gb(S,r,l,E,!re&&me,A):t=R_(r,l,E,!re&&me,A)}return{constraint:t,maxResolution:r,minResolution:l,minZoom:x,zoomFactor:S}}function HT(h){if(h.enableRotation!==void 0?h.enableRotation:!0){let r=h.constrainRotation;return r===void 0||r===!0?Zb():r===!1?A_:typeof r=="number"?Ub(r):A_}return Vb}function YT(h){return!(h.sourceCenter&&h.targetCenter&&!lr(h.sourceCenter,h.targetCenter)||h.sourceResolution!==h.targetResolution||h.sourceRotation!==h.targetRotation)}function k_(h,t,r,l,c){let n=Math.cos(-c),x=Math.sin(-c),b=h[0]*n-h[1]*x,S=h[1]*n+h[0]*x;b+=(t[0]/2-r[0])*l,S+=(r[1]-t[1]/2)*l,x=-x;let R=b*n-S*x,E=S*n+b*x;return[R,E]}var F_=D_;var z_=class extends Bb{constructor(t){let r=Object.assign({},t);delete r.source,super(r),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(Yt.SOURCE,this.handleSourcePropertyChange_);let l=t.source?t.source:null;this.setSource(l)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(Yt.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(Kr(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let t=this.getSource();t&&(this.sourceChangeKey_=kr(t,gi.CHANGE,this.handleSourceChange_,this),t.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let r,l=this.getMapInternal();!t&&l&&(t=l.getView()),t instanceof F_?r={viewState:t.getState(),extent:t.calculateExtent()}:r=t,!r.layerStatesArray&&l&&(r.layerStatesArray=l.getLayerGroup().getLayerStatesArray());let c;if(r.layerStatesArray){if(c=r.layerStatesArray.find(x=>x.layer===this),!c)return!1}else c=this.getLayerState();let n=this.getExtent();return O_(c,r.viewState)&&(!n||er(n,r.extent))}getAttributions(t){if(!this.isVisible(t))return[];let r=this.getSource()?.getAttributions();if(!r)return[];let l=t instanceof F_?t.getViewStateAndExtent():t,c=r(l);return Array.isArray(c)||(c=[c]),c}render(t,r){let l=this.getRenderer();return l.prepareFrame(t)?(this.rendered=!0,l.renderFrame(t,r)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,r){}renderDeferred(t){let r=this.getRenderer();r&&r.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(Yt.MAP,t)}getMapInternal(){return this.get(Yt.MAP)}setMap(t){this.mapPrecomposeKey_&&(Kr(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(Kr(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=kr(t,Ws.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=kr(this,gi.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){let r=t.frameState.layerStatesArray,l=this.getLayerState(!1);di(!r.some(c=>c.layer===l.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),r.push(l)}setSource(t){this.set(Yt.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function O_(h,t){if(!h.visible)return!1;let r=t.resolution;if(r<h.minResolution||r>=h.maxResolution)return!1;let l=t.zoom;return l>h.minZoom&&l<=h.maxZoom}var Rs=z_;var KT=()=>{let h=document.createElement("div");return Object.assign(h.style,{position:"absolute",bottom:0,right:0,fontSize:".8rem",padding:"0 10px"}),h},$b=KT;var B_=class extends jc{constructor(t={}){let r=$b();r.className=t.className||"mbt-copyright",super({element:r,...t}),this.format=t.format||(l=>l?.join(" | "))}render({frameState:t}){if(!t){this.element.innerHTML="";return}let r=[];t?.layerStatesArray.forEach(c=>{let{layer:n}=c;if(t&&O_(c,t.viewState)&&(n?.getSource()?.getAttributions()&&(r=r.concat(n.getSource().getAttributions()(t))),n?.get("copyrights"))){let x=n.get("copyrights");x=Array.isArray(x)?x:[x],x?.length&&r.push(...x)}});let l=pl(r)||[];this.element.innerHTML=this.format(l)}},Xb=B_;var As={ADD:"add",REMOVE:"remove"};var Hb={LENGTH:"length"},Nc=class extends Ei{constructor(t,r,l){super(t),this.element=r,this.index=l}},j_=class extends xr{constructor(t,r){if(super(),this.on,this.once,this.un,r=r||{},this.unique_=!!r.unique,this.array_=t||[],this.unique_)for(let l=0,c=this.array_.length;l<c;++l)this.assertUnique_(this.array_[l],l);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let r=0,l=t.length;r<l;++r)this.push(t[r]);return this}forEach(t){let r=this.array_;for(let l=0,c=r.length;l<c;++l)t(r[l],l,r)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(Hb.LENGTH)}insertAt(t,r){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(r),this.array_.splice(t,0,r),this.updateLength_(),this.dispatchEvent(new Nc(As.ADD,r,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);let r=this.getLength();return this.insertAt(r,t),this.getLength()}remove(t){let r=this.array_;for(let l=0,c=r.length;l<c;++l)if(r[l]===t)return this.removeAt(l)}removeAt(t){if(t<0||t>=this.getLength())return;let r=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new Nc(As.REMOVE,r,t)),r}setAt(t,r){let l=this.getLength();if(t>=l){this.insertAt(t,r);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(r,t);let c=this.array_[t];this.array_[t]=r,this.dispatchEvent(new Nc(As.REMOVE,c,t)),this.dispatchEvent(new Nc(As.ADD,r,t))}updateLength_(){this.set(Hb.LENGTH,this.array_.length)}assertUnique_(t,r){for(let l=0,c=this.array_.length;l<c;++l)if(this.array_[l]===t&&l!==r)throw new Error("Duplicate item added to a unique collection")}},Qu=j_;var N_=class h extends xr{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if(typeof t.getSimplifiedGeometry=="function"){let r=t;this.setGeometry(r)}else{let r=t;this.setProperties(r)}}clone(){let t=new h(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());let r=this.getGeometry();r&&t.setGeometry(r.clone());let l=this.getStyle();return l&&t.setStyle(l),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(Kr(this.geometryChangeKey_),this.geometryChangeKey_=null);let t=this.getGeometry();t&&(this.geometryChangeKey_=kr(t,gi.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?JT(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}};function JT(h){if(typeof h=="function")return h;let t;return Array.isArray(h)?t=h:(di(typeof h.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[h]),function(){return t}}var gs=N_;var Mt={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};var Po={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]};var Sl={name:"xyz",min:[0,0,0],channel:["X","Y","Z"],alias:["XYZ","ciexyz","cie1931"]};Sl.whitepoint={2:{A:[109.85,100,35.585],C:[98.074,100,118.232],D50:[96.422,100,82.521],D55:[95.682,100,92.149],D65:[95.045592705167,100,108.9057750759878],D75:[94.972,100,122.638],F2:[99.187,100,67.395],F7:[95.044,100,108.755],F11:[100.966,100,64.37],E:[100,100,100]},10:{A:[111.144,100,35.2],C:[97.285,100,116.145],D50:[96.72,100,81.427],D55:[95.799,100,90.926],D65:[94.811,100,107.304],D75:[94.416,100,120.641],F2:[103.28,100,69.026],F7:[95.792,100,107.687],F11:[103.866,100,65.627],E:[100,100,100]}};Sl.max=Sl.whitepoint[2].D65;Sl.rgb=function(h,t){t=t||Sl.whitepoint[2].E;var r=h[0]/t[0],l=h[1]/t[1],c=h[2]/t[2],n,x,b;return n=r*3.240969941904521+l*-1.537383177570093+c*-.498610760293,x=r*-.96924363628087+l*1.87596750150772+c*.041555057407175,b=r*.055630079696993+l*-.20397695888897+c*1.056971514242878,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:n=n*12.92,x=x>.0031308?1.055*Math.pow(x,1/2.4)-.055:x=x*12.92,b=b>.0031308?1.055*Math.pow(b,1/2.4)-.055:b=b*12.92,n=Math.min(Math.max(0,n),1),x=Math.min(Math.max(0,x),1),b=Math.min(Math.max(0,b),1),[n*255,x*255,b*255]};Po.xyz=function(h,t){var r=h[0]/255,l=h[1]/255,c=h[2]/255;r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,l=l>.04045?Math.pow((l+.055)/1.055,2.4):l/12.92,c=c>.04045?Math.pow((c+.055)/1.055,2.4):c/12.92;var n=r*.41239079926595+l*.35758433938387+c*.18048078840183,x=r*.21263900587151+l*.71516867876775+c*.072192315360733,b=r*.019330818715591+l*.11919477979462+c*.95053215224966;return t=t||Sl.whitepoint[2].E,[n*t[0],x*t[1],b*t[2]]};var Cn=Sl;var wf={name:"luv",min:[0,-134,-140],max:[100,224,122],channel:["lightness","u","v"],alias:["LUV","cieluv","cie1976"],xyz:function(h,t,r){var l,c,n,x,b,S,R,E,A,z,W,re,me;if(n=h[0],x=h[1],b=h[2],n===0)return[0,0,0];var ge=.0011070564598794539;return t=t||"D65",r=r||2,A=Cn.whitepoint[r][t][0],z=Cn.whitepoint[r][t][1],W=Cn.whitepoint[r][t][2],re=4*A/(A+15*z+3*W),me=9*z/(A+15*z+3*W),l=x/(13*n)+re||0,c=b/(13*n)+me||0,R=n>8?z*Math.pow((n+16)/116,3):z*n*ge,S=R*9*l/(4*c)||0,E=R*(12-3*l-20*c)/(4*c)||0,[S,R,E]}};Cn.luv=function(h,t,r){var l,c,n,x,b,S,R,E,A,z,W,re,me,ge=.008856451679035631,be=903.2962962962961;t=t||"D65",r=r||2,A=Cn.whitepoint[r][t][0],z=Cn.whitepoint[r][t][1],W=Cn.whitepoint[r][t][2],re=4*A/(A+15*z+3*W),me=9*z/(A+15*z+3*W),S=h[0],R=h[1],E=h[2],l=4*S/(S+15*R+3*E)||0,c=9*R/(S+15*R+3*E)||0;var ve=R/z;return n=ve<=ge?be*ve:116*Math.pow(ve,1/3)-16,x=13*n*(l-re),b=13*n*(c-me),[n,x,b]};var Yb={name:"lchuv",channel:["lightness","chroma","hue"],alias:["LCHuv","cielchuv"],min:[0,0,0],max:[100,100,360],luv:function(h){var t=h[0],r=h[1],l=h[2],c,n,x;return x=l/360*2*Math.PI,c=r*Math.cos(x),n=r*Math.sin(x),[t,c,n]},xyz:function(h){return wf.xyz(Yb.luv(h))}},Kb=Yb;wf.lchuv=function(h){var t=h[0],r=h[1],l=h[2],c=Math.sqrt(r*r+l*l),n=Math.atan2(l,r),x=n*360/2/Math.PI;return x<0&&(x+=360),[t,c,x]};Cn.lchuv=function(h){return wf.lchuv(Cn.luv(h))};var G_=Us(Qb(),1),t1=QT,e1={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function QT(h){var t,r=[],l=1,c;if(typeof h=="number")return{space:"rgb",values:[h>>>16,(h&65280)>>>8,h&255],alpha:1};if(typeof h=="number")return{space:"rgb",values:[h>>>16,(h&65280)>>>8,h&255],alpha:1};if(h=String(h).toLowerCase(),G_.default[h])r=G_.default[h].slice(),c="rgb";else if(h==="transparent")l=0,c="rgb",r=[0,0,0];else if(h[0]==="#"){var n=h.slice(1),x=n.length,b=x<=4;l=1,b?(r=[parseInt(n[0]+n[0],16),parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16)],x===4&&(l=parseInt(n[3]+n[3],16)/255)):(r=[parseInt(n[0]+n[1],16),parseInt(n[2]+n[3],16),parseInt(n[4]+n[5],16)],x===8&&(l=parseInt(n[6]+n[7],16)/255)),r[0]||(r[0]=0),r[1]||(r[1]=0),r[2]||(r[2]=0),c="rgb"}else if(t=/^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(h)){var S=t[1];c=S.replace(/a$/,"");var R=c==="cmyk"?4:c==="gray"?1:3;r=t[2].trim().split(/\s*[,\/]\s*|\s+/),c==="color"&&(c=r.shift()),r=r.map(function(E,A){if(E[E.length-1]==="%")return E=parseFloat(E)/100,A===3?E:c==="rgb"?E*255:c[0]==="h"||c[0]==="l"&&!A?E*100:c==="lab"?E*125:c==="lch"?A<2?E*150:E*360:c[0]==="o"&&!A?E:c==="oklab"?E*.4:c==="oklch"?A<2?E*.4:E*360:E;if(c[A]==="h"||A===2&&c[c.length-1]==="h"){if(e1[E]!==void 0)return e1[E];if(E.endsWith("deg"))return parseFloat(E);if(E.endsWith("turn"))return parseFloat(E)*360;if(E.endsWith("grad"))return parseFloat(E)*360/400;if(E.endsWith("rad"))return parseFloat(E)*180/Math.PI}return E==="none"?0:parseFloat(E)}),l=r.length>R?r.pop():1}else/[0-9](?:\s|\/|,)/.test(h)&&(r=h.match(/([0-9]+)/g).map(function(E){return parseFloat(E)}),c=h.match(/([a-z])/ig)?.join("")?.toLowerCase()||"rgb");return{space:c,values:r,alpha:l}}var Sf={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(h){var t=h[0]/360,r=h[1]/100,l=h[2]/100,c,n,x,b,S,R=0;if(r===0)return S=l*255,[S,S,S];for(n=l<.5?l*(1+r):l+r-l*r,c=2*l-n,b=[0,0,0];R<3;)x=t+1/3*-(R-1),x<0?x++:x>1&&x--,S=6*x<1?c+(n-c)*6*x:2*x<1?n:3*x<2?c+(n-c)*(2/3-x)*6:c,b[R++]=S*255;return b}};Po.hsl=function(h){var t=h[0]/255,r=h[1]/255,l=h[2]/255,c=Math.min(t,r,l),n=Math.max(t,r,l),x=n-c,b,S,R;return n===c?b=0:t===n?b=(r-l)/x:r===n?b=2+(l-t)/x:l===n&&(b=4+(t-r)/x),b=Math.min(b*60,360),b<0&&(b+=360),R=(c+n)/2,n===c?S=0:R<=.5?S=x/(n+c):S=x/(2-n-c),[b,S*100,R*100]};function V_(h){Array.isArray(h)&&h.raw&&(h=String.raw(...arguments)),h instanceof Number&&(h=+h);var t,r,l,c=t1(h);if(!c.space)return[];let n=c.space[0]==="h"?Sf.min:Po.min,x=c.space[0]==="h"?Sf.max:Po.max;return t=Array(3),t[0]=Math.min(Math.max(c.values[0],n[0]),x[0]),t[1]=Math.min(Math.max(c.values[1],n[1]),x[1]),t[2]=Math.min(Math.max(c.values[2],n[2]),x[2]),c.space[0]==="h"&&(t=Sf.rgb(t)),t.push(Math.min(Math.max(c.alpha,0),1)),t}var Tf=[NaN,NaN,NaN,0];function i1(h){return typeof h=="string"?h:id(h)}var eC=1024,ed={},U_=0;function r1(h){if(h.length===4)return h;let t=h.slice();return t[3]=1,t}function Z_(h){let t=Cn.lchuv(Po.xyz(h));return t[3]=h[3],t}function n1(h){let t=Cn.rgb(Kb.xyz(h));return t[3]=h[3],t}function td(h){if(h==="none")return Tf;if(ed.hasOwnProperty(h))return ed[h];if(U_>=eC){let r=0;for(let l in ed)r++&3||(delete ed[l],--U_)}let t=V_(h);if(t.length!==4)throw new Error('failed to parse "'+h+'" as color');for(let r of t)if(isNaN(r))throw new Error('failed to parse "'+h+'" as color');return q_(t),ed[h]=t,++U_,t}function Ls(h){return Array.isArray(h)?h:td(h)}function q_(h){return h[0]=Pi(h[0]+.5|0,0,255),h[1]=Pi(h[1]+.5|0,0,255),h[2]=Pi(h[2]+.5|0,0,255),h[3]=Pi(h[3],0,1),h}function id(h){let t=h[0];t!=(t|0)&&(t=t+.5|0);let r=h[1];r!=(r|0)&&(r=r+.5|0);let l=h[2];l!=(l|0)&&(l=l+.5|0);let c=h[3]===void 0?1:Math.round(h[3]*1e3)/1e3;return"rgba("+t+","+r+","+l+","+c+")"}var ga=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",bD=ga.includes("firefox"),tC=ga.includes("safari")&&!ga.includes("chrom"),wD=tC&&(ga.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(ga)),SD=ga.includes("webkit")&&!ga.includes("edge"),TD=ga.includes("macintosh");var Cf=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,s1=typeof Image<"u"&&Image.prototype.decode;var CD=function(){let h=!1;try{let t=Object.defineProperty({},"passive",{get:function(){h=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return h}();function Fi(h,t,r,l){let c;return r&&r.length?c=r.shift():Cf?c=new OffscreenCanvas(h||300,t||300):c=document.createElement("canvas"),h&&(c.width=h),t&&(c.height=t),c.getContext("2d",l)}var W_;function Gc(){return W_||(W_=Fi(1,1)),W_}function o1(h){let t=h.canvas;t.width=1,t.height=1,h.clearRect(0,0,1,1)}function iC(h,t){return new Promise((r,l)=>{function c(){x(),r(h)}function n(){x(),l(new Error("Image load error"))}function x(){h.removeEventListener("load",c),h.removeEventListener("error",n)}h.addEventListener("load",c),h.addEventListener("error",n),t&&(h.src=t)})}function a1(h,t){return t&&(h.src=t),h.src&&s1?new Promise((r,l)=>h.decode().then(()=>r(h)).catch(c=>h.complete&&h.width?r(h):l(c))):iC(h)}var X_=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(let r in this.cache_){let l=this.cache_[r];!(t++&3)&&!l.hasListener()&&(delete this.cache_[r],delete this.patternCache_[r],--this.cacheSize_)}}}get(t,r,l){let c=$_(t,r,l);return c in this.cache_?this.cache_[c]:null}getPattern(t,r,l){let c=$_(t,r,l);return c in this.patternCache_?this.patternCache_[c]:null}set(t,r,l,c,n){let x=$_(t,r,l),b=x in this.cache_;this.cache_[x]=c,n&&(c.getImageState()===Mt.IDLE&&c.load(),c.getImageState()===Mt.LOADING?c.ready().then(()=>{this.patternCache_[x]=Gc().createPattern(c.getImage(1),"repeat")}):this.patternCache_[x]=Gc().createPattern(c.getImage(1),"repeat")),b||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};function $_(h,t,r){let l=r?Ls(r):"null";return t+":"+h+":"+l}var Yn=new X_;var rd=null,Mf=class extends Xp{constructor(t,r,l,c,n){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=l,this.canvas_={},this.color_=n,this.imageState_=c===void 0?Mt.IDLE:c,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=r,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Mt.LOADED){rd||(rd=Fi(1,1,void 0,{willReadFrequently:!0})),rd.drawImage(this.image_,0,0);try{rd.getImageData(0,0,1,1),this.tainted_=!1}catch{rd=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(gi.CHANGE)}handleImageError_(){this.imageState_=Mt.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Mt.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let t=this.size_[0],r=this.size_[1],l=Fi(t,r);l.fillRect(0,0,t,r),this.hitDetectionImage_=l.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Mt.IDLE){this.image_||this.initializeImage_(),this.imageState_=Mt.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&a1(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==Mt.LOADED)return;let r=this.image_,l=Fi(Math.ceil(r.width*t),Math.ceil(r.height*t)),c=l.canvas;l.scale(t,t),l.drawImage(r,0,0),l.globalCompositeOperation="multiply",l.fillStyle=i1(this.color_),l.fillRect(0,0,c.width/t,c.height/t),l.globalCompositeOperation="destination-in",l.drawImage(r,0,0),this.canvas_[t]=c}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===Mt.LOADED||this.imageState_===Mt.ERROR)t();else{let r=()=>{(this.imageState_===Mt.LOADED||this.imageState_===Mt.ERROR)&&(this.removeEventListener(gi.CHANGE,r),t())};this.addEventListener(gi.CHANGE,r)}})),this.ready_}};function Vc(h,t,r,l,c,n){let x=t===void 0?void 0:Yn.get(t,r,c);return x||(x=new Mf(h,h&&"src"in h?h.src||void 0:t,r,l,c),Yn.set(t,r,c,x,n)),n&&x&&!Yn.getPattern(t,r,c)&&Yn.set(t,r,c,x,n),x}var l1=Mf;var H_=class h{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,t.color!==void 0&&this.setColor(t.color)}clone(){let t=this.getColor();return new h({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(t!==null&&typeof t=="object"&&"src"in t){let r=Vc(null,t.src,"anonymous",void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));r.ready().then(()=>{this.patternImage_=null}),r.getImageState()===Mt.IDLE&&r.load(),r.getImageState()===Mt.LOADING&&(this.patternImage_=r)}this.color_=t}getKey(){let t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?Gt(t):typeof t=="object"&&"src"in t?t.src+":"+t.offset:Ls(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},zr=H_;var Y_=class h{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=t.lineDash!==void 0?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){let t=this.getColor();return new h({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}},cr=Y_;function $s(h,t){return Array.isArray(h)?h:(t===void 0?t=[h,h]:(t[0]=h,t[1]=h),t)}var K_=class h{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=$s(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){let t=this.getScale();return new h({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return Tt()}getImage(t){return Tt()}getHitDetectionImage(){return Tt()}getPixelRatio(t){return 1}getImageState(){return Tt()}getImageSize(){return Tt()}getOrigin(){return Tt()}getSize(){return Tt()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=$s(t)}listenImageChange(t){Tt()}load(){Tt()}unlistenImageChange(t){Tt()}ready(){return Promise.resolve()}},If=K_;function Mn(h){return h?Array.isArray(h)?id(h):typeof h=="object"&&"src"in h?rC(h):h:null}function rC(h){if(!h.offset||!h.size)return Yn.getPattern(h.src,"anonymous",h.color);let t=h.src+":"+h.offset,r=Yn.getPattern(t,void 0,h.color);if(r)return r;let l=Yn.get(h.src,"anonymous",null);if(l.getImageState()!==Mt.LOADED)return null;let c=Fi(h.size[0],h.size[1]);return c.drawImage(l.getImage(1),h.offset[0],h.offset[1],h.size[0],h.size[1],0,0,h.size[0],h.size[1]),Vc(c.canvas,t,void 0,Mt.LOADED,h.color,!0),Yn.getPattern(t,void 0,h.color)}var nC=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z]+?)\\s*$`].join(""),"i"),c1=["style","variant","weight","size","lineHeight","family"],J_=function(h){let t=h.match(nC);if(!t)return null;let r={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let l=0,c=c1.length;l<c;++l){let n=t[l+1];n!==void 0&&(r[c1[l]]=n)}return r.families=r.family.split(/,\s?/),r};var Pf="10px sans-serif",hr="#000",Xs="round",In=[],En=0,Hs="round",Ro=10,Ao="#000",ya="center",Tl="middle",Lo=[0,0,0,0],ko=1,_a=new xr,Uc=null,Q_,ey={},h1=function(){let t="32px ",r=["monospace","serif"],l=r.length,c="wmytzilWMYTZIL@#/&?$%10\uF013",n,x;function b(R,E,A){let z=!0;for(let W=0;W<l;++W){let re=r[W];if(x=Ef(R+" "+E+" "+t+re,c),A!=re){let me=Ef(R+" "+E+" "+t+A+","+re,c);z=z&&me!=x}}return!!z}function S(){let R=!0,E=_a.getKeys();for(let A=0,z=E.length;A<z;++A){let W=E[A];if(_a.get(W)<100){let[re,me,ge]=W.split(`
725
+ ${V.shaderPreludeCode.vertexSource}`,define:V.shaderDefine},defaultProjectionData:Q},ee=O.renderingMode?O.renderingMode:"2d";if(v.renderPass==="offscreen"){let ie=O.prerender;ie&&(v.setCustomLayerDefaults(),F.setColorMode(v.colorModeForRenderPass()),ie.call(O,F.gl,J),F.setDirty(),v.setBaseState())}else if(v.renderPass==="translucent"){v.setCustomLayerDefaults(),F.setColorMode(v.colorModeForRenderPass()),F.setStencilMode(Bt.disabled);let ie=ee==="3d"?v.getDepthModeFor3D():v.getDepthModeForSublayer(0,Rt.ReadOnly);F.setDepthMode(ie),O.render(F.gl,J),F.setDirty(),v.setBaseState(),F.bindFramebuffer.set(null)}}(e,0,d,g))}saveTileTexture(e){let s=this._tileTextures[e.size[0]];s?s.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let s=this._tileTextures[e];return s&&s.length>0?s.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let s=this.imageManager.getPattern(e.from.toString()),d=this.imageManager.getPattern(e.to.toString());return!s||!d}useProgram(e,s,d=!1){this.cache=this.cache||{};let p=!!this.style.map.terrain,g=this.style.projection,v=e+(s?s.cacheKey:"")+`/${d?Dl:g.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(p?"/terrain":"");return this.cache[v]||(this.cache[v]=new am(this.context,es[e],s,bh[e],this._showOverdrawInspector,p,d?es.projectionMercator:g.shaderPreludeCode,d?kl:g.shaderDefine)),this.cache[v]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Re(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:s}=this.context.gl;return this.width!==e||this.height!==s}}function Vh(m,e){let s,d=!1,p=null,g=null,v=()=>{p=null,d&&(m.apply(g,s),p=setTimeout(v,e),d=!1)};return(...T)=>(d=!0,g=this,s=T,p||v(),p)}class Uh{constructor(e){this._getCurrentHash=()=>{let s=window.location.hash.replace("#","");if(this._hashName){let d;return s.split("&").map(p=>p.split("=")).forEach(p=>{p[0]===this._hashName&&(d=p)}),(d&&d[1]||"").split("/")}return s.split("/")},this._onHashChange=()=>{let s=this._getCurrentHash();if(!this._isValidHash(s))return!1;let d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(s[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+s[2],+s[1]],zoom:+s[0],bearing:d,pitch:+(s[4]||0)}),!0},this._updateHashUnthrottled=()=>{let s=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,s)},this._removeHash=()=>{let s=this._getCurrentHash();if(s.length===0)return;let d=s.join("/"),p=d;p.split("&").length>0&&(p=p.split("&")[0]),this._hashName&&(p=`${this._hashName}=${d}`);let g=window.location.hash.replace(p,"");g.startsWith("#&")?g=g.slice(0,1)+g.slice(2):g==="#"&&(g="");let v=window.location.href.replace(/(#.+)?$/,g);v=v.replace("&&","&"),window.history.replaceState(window.history.state,null,v)},this._updateHash=Vh(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){let s=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,p=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),g=Math.pow(10,p),v=Math.round(s.lng*g)/g,T=Math.round(s.lat*g)/g,M=this._map.getBearing(),P=this._map.getPitch(),D="";if(D+=e?`/${v}/${T}/${d}`:`${d}/${T}/${v}`,(M||P)&&(D+="/"+Math.round(10*M)/10),P&&(D+=`/${Math.round(P)}`),this._hashName){let F=this._hashName,O=!1,V=window.location.hash.slice(1).split("&").map(q=>{let Q=q.split("=")[0];return Q===F?(O=!0,`${Q}=${D}`):q}).filter(q=>q);return O||V.push(`${F}=${D}`),`#${V.join("&")}`}return`#${D}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new n.N(+e[2],+e[1])}catch{return!1}let s=+e[0],d=+(e[3]||0),p=+(e[4]||0);return s>=this._map.getMinZoom()&&s<=this._map.getMaxZoom()&&d>=0&&d<=180&&p>=this._map.getMinPitch()&&p<=this._map.getMaxPitch()}}let Qo={linearity:.3,easing:n.c6(0,0,.3,1)},sp=n.e({deceleration:2500,maxSpeed:1400},Qo),op=n.e({deceleration:20,maxSpeed:1400},Qo),ap=n.e({deceleration:1e3,maxSpeed:360},Qo),lp=n.e({deceleration:1e3,maxSpeed:90},Qo),qa=n.e({deceleration:1e3,maxSpeed:360},Qo);class cp{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:E.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,s=E.now();for(;e.length>0&&s-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let s={zoom:0,bearing:0,pitch:0,roll:0,pan:new n.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:g}of this._inertiaBuffer)s.zoom+=g.zoomDelta||0,s.bearing+=g.bearingDelta||0,s.pitch+=g.pitchDelta||0,s.roll+=g.rollDelta||0,g.panDelta&&s.pan._add(g.panDelta),g.around&&(s.around=g.around),g.pinchAround&&(s.pinchAround=g.pinchAround);let d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,p={};if(s.pan.mag()){let g=Ur(s.pan.mag(),d,n.e({},sp,e||{})),v=s.pan.mult(g.amount/s.pan.mag()),T=this._map.cameraHelper.handlePanInertia(v,this._map.transform);p.center=T.easingCenter,p.offset=T.easingOffset,Mr(p,g)}if(s.zoom){let g=Ur(s.zoom,d,op);p.zoom=this._map.transform.zoom+g.amount,Mr(p,g)}if(s.bearing){let g=Ur(s.bearing,d,ap);p.bearing=this._map.transform.bearing+n.ab(g.amount,-179,179),Mr(p,g)}if(s.pitch){let g=Ur(s.pitch,d,lp);p.pitch=this._map.transform.pitch+g.amount,Mr(p,g)}if(s.roll){let g=Ur(s.roll,d,qa);p.roll=this._map.transform.roll+n.ab(g.amount,-179,179),Mr(p,g)}if(p.zoom||p.bearing){let g=s.pinchAround===void 0?s.around:s.pinchAround;p.around=g?this._map.unproject(g):this._map.getCenter()}return this.clear(),n.e(p,{noMoveStart:!0})}}function Mr(m,e){(!m.duration||m.duration<e.duration)&&(m.duration=e.duration,m.easing=e.easing)}function Ur(m,e,s){let{maxSpeed:d,linearity:p,deceleration:g}=s,v=n.ab(m*p/(e/1e3),-d,d),T=Math.abs(v)/(g*p);return{easing:s.easing,duration:1e3*T,amount:v*(T/2)}}class Zr extends n.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,s,d,p={}){let g=A.mousePos(s.getCanvas(),d),v=s.unproject(g);super(e,n.e({point:g,lngLat:v,originalEvent:d},p)),this._defaultPrevented=!1,this.target=s}}class qr extends n.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,s,d){let p=e==="touchend"?d.changedTouches:d.touches,g=A.touchPos(s.getCanvasContainer(),p),v=g.map(M=>s.unproject(M)),T=g.reduce((M,P,D,F)=>M.add(P.div(F.length)),new n.P(0,0));super(e,{points:g,point:T,lngLats:v,lngLat:s.unproject(T),originalEvent:d}),this._defaultPrevented=!1}}class _o extends n.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,s,d){super(e,{originalEvent:d}),this._defaultPrevented=!1}}class xm{constructor(e,s){this._map=e,this._clickTolerance=s.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new _o(e.type,this._map,e))}mousedown(e,s){return this._mousedownPos=s,this._firePreventable(new Zr(e.type,this._map,e))}mouseup(e){this._map.fire(new Zr(e.type,this._map,e))}click(e,s){this._mousedownPos&&this._mousedownPos.dist(s)>=this._clickTolerance||this._map.fire(new Zr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Zr(e.type,this._map,e))}mouseover(e){this._map.fire(new Zr(e.type,this._map,e))}mouseout(e){this._map.fire(new Zr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new qr(e.type,this._map,e))}touchmove(e){this._map.fire(new qr(e.type,this._map,e))}touchend(e){this._map.fire(new qr(e.type,this._map,e))}touchcancel(e){this._map.fire(new qr(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class vm{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Zr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Zr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Zr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Wa{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(n.P.convert(e),this._map.terrain)}}class hp{constructor(e,s){this._map=e,this._tr=new Wa(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=s.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,s){this.isEnabled()&&e.shiftKey&&e.button===0&&(A.disableDrag(),this._startPos=this._lastPos=s,this._active=!0)}mousemoveWindow(e,s){if(!this._active)return;let d=s;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)<this._clickTolerance)return;let p=this._startPos;this._lastPos=d,this._box||(this._box=A.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let g=Math.min(p.x,d.x),v=Math.max(p.x,d.x),T=Math.min(p.y,d.y),M=Math.max(p.y,d.y);A.setTransform(this._box,`translate(${g}px,${T}px)`),this._box.style.width=v-g+"px",this._box.style.height=M-T+"px"}mouseupWindow(e,s){if(!this._active||e.button!==0)return;let d=this._startPos,p=s;if(this.reset(),A.suppressClick(),d.x!==p.x||d.y!==p.y)return this._map.fire(new n.k("boxzoomend",{originalEvent:e})),{cameraAnimation:g=>g.fitScreenCoordinates(d,p,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(A.remove(this._box),this._box=null),A.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,s){return this._map.fire(new n.k(e,{originalEvent:s}))}}function Ql(m,e){if(m.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${m.length}, points ${e.length}`);let s={};for(let d=0;d<m.length;d++)s[m[d].identifier]=e[d];return s}class $a{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,s,d){(this.centroid||d.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),d.length===this.numTouches&&(this.centroid=function(p){let g=new n.P(0,0);for(let v of p)g._add(v);return g.div(p.length)}(s),this.touches=Ql(d,s)))}touchmove(e,s,d){if(this.aborted||!this.centroid)return;let p=Ql(d,s);for(let g in this.touches){let v=p[g];(!v||v.dist(this.touches[g])>30)&&(this.aborted=!0)}}touchend(e,s,d){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){let p=!this.aborted&&this.centroid;if(this.reset(),p)return p}}}class Nn{constructor(e){this.singleTap=new $a(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,s,d){this.singleTap.touchstart(e,s,d)}touchmove(e,s,d){this.singleTap.touchmove(e,s,d)}touchend(e,s,d){let p=this.singleTap.touchend(e,s,d);if(p){let g=e.timeStamp-this.lastTime<500,v=!this.lastTap||this.lastTap.dist(p)<30;if(g&&v||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=p,this.count===this.numTaps)return this.reset(),p}}}class it{constructor(e){this._tr=new Wa(e),this._zoomIn=new Nn({numTouches:1,numTaps:2}),this._zoomOut=new Nn({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,s,d){this._zoomIn.touchstart(e,s,d),this._zoomOut.touchstart(e,s,d)}touchmove(e,s,d){this._zoomIn.touchmove(e,s,d),this._zoomOut.touchmove(e,s,d)}touchend(e,s,d){let p=this._zoomIn.touchend(e,s,d),g=this._zoomOut.touchend(e,s,d),v=this._tr;return p?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:v.zoom+1,around:v.unproject(p)},{originalEvent:e})}):g?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:v.zoom-1,around:v.unproject(g)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ea{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let s=this._moveFunction(...e);if(s.bearingDelta||s.pitchDelta||s.rollDelta||s.around||s.panDelta)return this._active=!0,s}dragStart(e,s){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(s)?s[0]:s,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,s){if(!this.isEnabled())return;let d=this._lastPoint;if(!d)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);let p=Array.isArray(s)?s[0]:s;return!this._moved&&p.dist(d)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=p,this._move(d,p))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&A.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}let Zh={0:1,2:2};class ta{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){let s=A.mouseButton(e);this._eventButton=s}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(s,d){let p=Zh[d];return s.buttons===void 0||(s.buttons&p)!==p}(e,this._eventButton)}isValidEndEvent(e){return A.mouseButton(e)===this._eventButton}}class Xa{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class Ha{constructor(e=new ta({checkCorrectEvent:()=>!0}),s=new Xa){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=s}_executeRelevantHandler(e,s,d){return e instanceof MouseEvent?s(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?d(e):void 0}startMove(e){this._executeRelevantHandler(e,s=>this.mouseMoveStateManager.startMove(s),s=>this.oneFingerTouchMoveStateManager.startMove(s))}endMove(e){this._executeRelevantHandler(e,s=>this.mouseMoveStateManager.endMove(s),s=>this.oneFingerTouchMoveStateManager.endMove(s))}isValidStartEvent(e){return this._executeRelevantHandler(e,s=>this.mouseMoveStateManager.isValidStartEvent(s),s=>this.oneFingerTouchMoveStateManager.isValidStartEvent(s))}isValidMoveEvent(e){return this._executeRelevantHandler(e,s=>this.mouseMoveStateManager.isValidMoveEvent(s),s=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(s))}isValidEndEvent(e){return this._executeRelevantHandler(e,s=>this.mouseMoveStateManager.isValidEndEvent(s),s=>this.oneFingerTouchMoveStateManager.isValidEndEvent(s))}}let Ya=m=>{m.mousedown=m.dragStart,m.mousemoveWindow=m.dragMove,m.mouseup=m.dragEnd,m.contextmenu=e=>{e.preventDefault()}};class zt{constructor(e,s){this._clickTolerance=e.clickTolerance||1,this._map=s,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new n.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,s,d){return this._calculateTransform(e,s,d)}touchmove(e,s,d){if(this._active){if(!this._shouldBePrevented(d.length))return e.preventDefault(),this._calculateTransform(e,s,d);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,s,d){this._calculateTransform(e,s,d),this._active&&this._shouldBePrevented(d.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,s,d){d.length>0&&(this._active=!0);let p=Ql(d,s),g=new n.P(0,0),v=new n.P(0,0),T=0;for(let P in p){let D=p[P],F=this._touches[P];F&&(g._add(D),v._add(D.sub(F)),T++,p[P]=D)}if(this._touches=p,this._shouldBePrevented(T)||!v.mag())return;let M=v.div(T);return this._sum._add(M),this._sum.mag()<this._clickTolerance?void 0:{around:g.div(T),panDelta:M}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ka{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,s,d){this._firstTwoTouches||d.length<2||(this._firstTwoTouches=[d[0].identifier,d[1].identifier],this._start([s[0],s[1]]))}touchmove(e,s,d){if(!this._firstTwoTouches)return;e.preventDefault();let[p,g]=this._firstTwoTouches,v=ec(d,s,p),T=ec(d,s,g);if(!v||!T)return;let M=this._aroundCenter?null:v.add(T).div(2);return this._move([v,T],M,e)}touchend(e,s,d){if(!this._firstTwoTouches)return;let[p,g]=this._firstTwoTouches,v=ec(d,s,p),T=ec(d,s,g);v&&T||(this._active&&A.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function ec(m,e,s){for(let d=0;d<m.length;d++)if(m[d].identifier===s)return e[d]}function tc(m,e){return Math.log(m/e)/Math.LN2}class up extends Ka{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,s){let d=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(tc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:tc(this._distance,d),pinchAround:s}}}function dp(m,e){return 180*m.angleWith(e)/Math.PI}class qh extends Ka{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,s,d){let p=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:dp(this._vector,p),pinchAround:s}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let s=25/(Math.PI*this._minDiameter)*360,d=dp(e,this._startVector);return Math.abs(d)<s}}function Ja(m){return Math.abs(m.y)>Math.abs(m.x)}class Wh extends Ka{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,s,d){super.touchstart(e,s,d),this._currentTouchCount=d.length}_start(e){this._lastPoints=e,Ja(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,s,d){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let p=e[0].sub(this._lastPoints[0]),g=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(p,g,d.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(p.y+g.y)/2*-.5}):void 0}gestureBeginsVertically(e,s,d){if(this._valid!==void 0)return this._valid;let p=e.mag()>=2,g=s.mag()>=2;if(!p&&!g)return;if(!p||!g)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;let v=e.y>0==s.y>0;return Ja(e)&&Ja(s)&&v}}let bm={panStep:100,bearingStep:15,pitchStep:10};class $h{constructor(e){this._tr=new Wa(e);let s=bm;this._panStep=s.panStep,this._bearingStep=s.bearingStep,this._pitchStep=s.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let s=0,d=0,p=0,g=0,v=0;switch(e.keyCode){case 61:case 107:case 171:case 187:s=1;break;case 189:case 109:case 173:s=-1;break;case 37:e.shiftKey?d=-1:(e.preventDefault(),g=-1);break;case 39:e.shiftKey?d=1:(e.preventDefault(),g=1);break;case 38:e.shiftKey?p=1:(e.preventDefault(),v=-1);break;case 40:e.shiftKey?p=-1:(e.preventDefault(),v=1);break;default:return}return this._rotationDisabled&&(d=0,p=0),{cameraAnimation:T=>{let M=this._tr;T.easeTo({duration:300,easeId:"keyboardHandler",easing:wm,zoom:s?Math.round(M.zoom)+s*(e.shiftKey?2:1):M.zoom,bearing:M.bearing+d*this._bearingStep,pitch:M.pitch+p*this._pitchStep,offset:[-g*this._panStep,-v*this._panStep],center:M.center},{originalEvent:e})}}}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 wm(m){return m*(2-m)}let pp=4.000244140625;class ys{constructor(e,s){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=e,this._tr=new Wa(e),this._triggerRenderFrame=s,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let s=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,d=E.now(),p=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,s!==0&&s%pp==0?this._type="wheel":s!==0&&Math.abs(s)<4?this._type="trackpad":p>400?(this._type=null,this._lastValue=s,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(p*s)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,s+=this._lastValue)),e.shiftKey&&s&&(s/=4),this._type&&(this._lastWheelEvent=e,this._delta-=s,this._active||this._start(e)),e.preventDefault()}_start(e){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);let s=A.mousePos(this._map.getCanvas(),e),d=this._tr;this._aroundPoint=this._aroundCenter?d.transform.locationToScreenPoint(n.N.convert(d.center)):s,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){let T=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=T),typeof this._targetZoom=="number"&&(this._targetZoom+=T)}if(this._delta!==0){let T=this._type==="wheel"&&Math.abs(this._delta)>pp?this._wheelZoomRate:this._defaultZoomRate,M=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&M!==0&&(M=1/M);let P=typeof this._targetZoom!="number"?e.scale:n.aG(this._targetZoom);this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,n.a8(P*M))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let s=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,d=this._startZoom,p=this._easing,g,v=!1;if(this._type==="wheel"&&d&&p){let T=E.now()-this._lastWheelEventTime,M=Math.min((T+5)/200,1),P=p(M);g=n.y.number(d,s,P),M<1?this._frameId||(this._frameId=!0):v=!0}else g=s,v=!0;return this._active=!0,v&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=g,{noInertia:!0,needsRenderFrame:!v,zoomDelta:g-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let s=n.c8;if(this._prevEase){let d=this._prevEase,p=(E.now()-d.start)/d.duration,g=d.easing(p+.01)-d.easing(p),v=.27/Math.sqrt(g*g+1e-4)*.01,T=Math.sqrt(.0729-v*v);s=n.c6(v,T,.25,1)}return this._prevEase={start:E.now(),duration:e,easing:s},s}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ii{constructor(e,s){this._clickZoom=e,this._tapZoom=s}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 ic{constructor(e){this._tr=new Wa(e),this.reset()}reset(){this._active=!1}dblclick(e,s){return e.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(s)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Xh{constructor(){this._tap=new Nn({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,s,d){if(!this._swipePoint)if(this._tapTime){let p=s[0],g=e.timeStamp-this._tapTime<500,v=this._tapPoint.dist(p)<30;g&&v?d.length>0&&(this._swipePoint=p,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(e,s,d)}touchmove(e,s,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;let p=s[0],g=p.y-this._swipePoint.y;return this._swipePoint=p,e.preventDefault(),this._active=!0,{zoomDelta:g/128}}}else this._tap.touchmove(e,s,d)}touchend(e,s,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{let p=this._tap.touchend(e,s,d);p&&(this._tapTime=e.timeStamp,this._tapPoint=p)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Hh{constructor(e,s,d){this._el=e,this._mousePan=s,this._touchPan=d}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Yh{constructor(e,s,d,p){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=s,this._mousePitch=d,this._mouseRoll=p}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Kh{constructor(e,s,d,p){this._el=e,this._touchZoom=s,this._touchRotate=d,this._tapDragZoom=p,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class fp{constructor(e,s){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=s,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=A.create("div","maplibregl-cooperative-gesture-screen",e);let s=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(s=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let d=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),p=document.createElement("div");p.className="maplibregl-desktop-message",p.textContent=s,this._container.appendChild(p);let g=document.createElement("div");g.className="maplibregl-mobile-message",g.textContent=d,this._container.appendChild(g),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(A.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,s){this._enabled&&(this._map.fire(new n.k("cooperativegestureprevented",{gestureType:e,originalEvent:s})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}let hn=m=>m.zoom||m.drag||m.roll||m.pitch||m.rotate;class rc extends n.k{}function lt(m){return m.panDelta&&m.panDelta.mag()||m.zoomDelta||m.bearingDelta||m.pitchDelta||m.rollDelta}class _t{constructor(e,s){this.handleWindowEvent=p=>{this.handleEvent(p,`${p.type}Window`)},this.handleEvent=(p,g)=>{if(p.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let v=p.type==="renderFrame"?void 0:p,T={needsRenderFrame:!1},M={},P={},D=p.touches,F=D?this._getMapTouches(D):void 0,O=F?A.touchPos(this._map.getCanvas(),F):A.mousePos(this._map.getCanvas(),p);for(let{handlerName:Q,handler:J,allowed:ee}of this._handlers){if(!J.isEnabled())continue;let ie;this._blockedByActive(P,ee,Q)?J.reset():J[g||p.type]&&(ie=J[g||p.type](p,O,F),this.mergeHandlerResult(T,M,ie,Q,v),ie&&ie.needsRenderFrame&&this._triggerRenderFrame()),(ie||J.isActive())&&(P[Q]=J)}let V={};for(let Q in this._previousActiveHandlers)P[Q]||(V[Q]=v);this._previousActiveHandlers=P,(Object.keys(V).length||lt(T))&&(this._changes.push([T,M,V]),this._triggerRenderFrame()),(Object.keys(P).length||lt(T))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:q}=T;q&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],q(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new cp(e),this._bearingSnap=s.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(s);let d=this._el;this._listeners=[[d,"touchstart",{passive:!0}],[d,"touchmove",{passive:!1}],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1}],[d,"keyup",void 0],[d,"wheel",{passive:!1}],[d,"contextmenu",void 0],[window,"blur",void 0]];for(let[p,g,v]of this._listeners)A.addEventListener(p,g,p===document?this.handleWindowEvent:this.handleEvent,v)}destroy(){for(let[e,s,d]of this._listeners)A.removeEventListener(e,s,e===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(e){let s=this._map,d=s.getCanvasContainer();this._add("mapEvent",new xm(s,e));let p=s.boxZoom=new hp(s,e);this._add("boxZoom",p),e.interactive&&e.boxZoom&&p.enable();let g=s.cooperativeGestures=new fp(s,e.cooperativeGestures);this._add("cooperativeGestures",g),e.cooperativeGestures&&g.enable();let v=new it(s),T=new ic(s);s.doubleClickZoom=new ii(T,v),this._add("tapZoom",v),this._add("clickZoom",T),e.interactive&&e.doubleClickZoom&&s.doubleClickZoom.enable();let M=new Xh;this._add("tapDragZoom",M);let P=s.touchPitch=new Wh(s);this._add("touchPitch",P),e.interactive&&e.touchPitch&&s.touchPitch.enable(e.touchPitch);let D=()=>s.project(s.getCenter()),F=function({enable:le,clickTolerance:ce,aroundCenter:fe=!0,minPixelCenterThreshold:ue=100,rotateDegreesPerPixelMoved:we=.8},Ce){let ze=new ta({checkCorrectEvent:Fe=>A.mouseButton(Fe)===0&&Fe.ctrlKey||A.mouseButton(Fe)===2&&!Fe.ctrlKey});return new ea({clickTolerance:ce,move:(Fe,Ae)=>{let Ye=Ce();if(fe&&Math.abs(Ye.y-Fe.y)>ue)return{bearingDelta:n.c7(new n.P(Fe.x,Ae.y),Ae,Ye)};let $e=(Ae.x-Fe.x)*we;return fe&&Ae.y<Ye.y&&($e=-$e),{bearingDelta:$e}},moveStateManager:ze,enable:le,assignEvents:Ya})}(e,D),O=function({enable:le,clickTolerance:ce,pitchDegreesPerPixelMoved:fe=-.5}){let ue=new ta({checkCorrectEvent:we=>A.mouseButton(we)===0&&we.ctrlKey||A.mouseButton(we)===2});return new ea({clickTolerance:ce,move:(we,Ce)=>({pitchDelta:(Ce.y-we.y)*fe}),moveStateManager:ue,enable:le,assignEvents:Ya})}(e),V=function({enable:le,clickTolerance:ce,rollDegreesPerPixelMoved:fe=.3},ue){let we=new ta({checkCorrectEvent:Ce=>A.mouseButton(Ce)===2&&Ce.ctrlKey});return new ea({clickTolerance:ce,move:(Ce,ze)=>{let Fe=ue(),Ae=(ze.x-Ce.x)*fe;return ze.y<Fe.y&&(Ae=-Ae),{rollDelta:Ae}},moveStateManager:we,enable:le,assignEvents:Ya})}(e,D);s.dragRotate=new Yh(e,F,O,V),this._add("mouseRotate",F,["mousePitch"]),this._add("mousePitch",O,["mouseRotate","mouseRoll"]),this._add("mouseRoll",V,["mousePitch"]),e.interactive&&e.dragRotate&&s.dragRotate.enable();let q=function({enable:le,clickTolerance:ce}){let fe=new ta({checkCorrectEvent:ue=>A.mouseButton(ue)===0&&!ue.ctrlKey});return new ea({clickTolerance:ce,move:(ue,we)=>({around:we,panDelta:we.sub(ue)}),activateOnStart:!0,moveStateManager:fe,enable:le,assignEvents:Ya})}(e),Q=new zt(e,s);s.dragPan=new Hh(d,q,Q),this._add("mousePan",q),this._add("touchPan",Q,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&s.dragPan.enable(e.dragPan);let J=new qh,ee=new up;s.touchZoomRotate=new Kh(d,ee,J,M),this._add("touchRotate",J,["touchPan","touchZoom"]),this._add("touchZoom",ee,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&s.touchZoomRotate.enable(e.touchZoomRotate);let ie=s.scrollZoom=new ys(s,()=>this._triggerRenderFrame());this._add("scrollZoom",ie,["mousePan"]),e.interactive&&e.scrollZoom&&s.scrollZoom.enable(e.scrollZoom);let ae=s.keyboard=new $h(s);this._add("keyboard",ae),e.interactive&&e.keyboard&&s.keyboard.enable(),this._add("blockableMapEvent",new vm(s))}_add(e,s,d){this._handlers.push({handlerName:e,handler:s,allowed:d}),this._handlersById[e]=s}stop(e){if(!this._updatingCamera){for(let{handler:s}of this._handlers)s.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!hn(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,s,d){for(let p in e)if(p!==d&&(!s||s.indexOf(p)<0))return!0;return!1}_getMapTouches(e){let s=[];for(let d of e)this._el.contains(d.target)&&s.push(d);return s}mergeHandlerResult(e,s,d,p,g){if(!d)return;n.e(e,d);let v={handlerName:p,originalEvent:d.originalEvent||g};d.zoomDelta!==void 0&&(s.zoom=v),d.panDelta!==void 0&&(s.drag=v),d.rollDelta!==void 0&&(s.roll=v),d.pitchDelta!==void 0&&(s.pitch=v),d.bearingDelta!==void 0&&(s.rotate=v)}_applyChanges(){let e={},s={},d={};for(let[p,g,v]of this._changes)p.panDelta&&(e.panDelta=(e.panDelta||new n.P(0,0))._add(p.panDelta)),p.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+p.zoomDelta),p.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+p.bearingDelta),p.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+p.pitchDelta),p.rollDelta&&(e.rollDelta=(e.rollDelta||0)+p.rollDelta),p.around!==void 0&&(e.around=p.around),p.pinchAround!==void 0&&(e.pinchAround=p.pinchAround),p.noInertia&&(e.noInertia=p.noInertia),n.e(s,g),n.e(d,v);this._updateMapTransform(e,s,d),this._changes=[]}_updateMapTransform(e,s,d){let p=this._map,g=p._getTransformForUpdate(),v=p.terrain;if(!(lt(e)||v&&this._terrainMovement))return this._fireEvents(s,d,!0);p._stop(!0);let{panDelta:T,zoomDelta:M,bearingDelta:P,pitchDelta:D,rollDelta:F,around:O,pinchAround:V}=e;V!==void 0&&(O=V),O=O||p.transform.centerPoint,v&&!g.isPointOnMapSurface(O)&&(O=g.centerPoint);let q={panDelta:T,zoomDelta:M,rollDelta:F,pitchDelta:D,bearingDelta:P,around:O};this._map.cameraHelper.useGlobeControls&&!g.isPointOnMapSurface(O)&&(O=g.centerPoint);let Q=O.distSqr(g.centerPoint)<.01?g.center:g.screenPointToLocation(T?O.sub(T):O);v?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(q,g),this._terrainMovement||!s.drag&&!s.zoom?s.drag&&this._terrainMovement?g.setCenter(g.screenPointToLocation(g.centerPoint.sub(T))):this._map.cameraHelper.handleMapControlsPan(q,g,Q):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(q,g,Q))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(q,g),this._map.cameraHelper.handleMapControlsPan(q,g,Q)),p._applyUpdatedTransform(g),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(s,d,!0)}_fireEvents(e,s,d){let p=hn(this._eventsInProgress),g=hn(e),v={};for(let F in e){let{originalEvent:O}=e[F];this._eventsInProgress[F]||(v[`${F}start`]=O),this._eventsInProgress[F]=e[F]}!p&&g&&this._fireEvent("movestart",g.originalEvent);for(let F in v)this._fireEvent(F,v[F]);g&&this._fireEvent("move",g.originalEvent);for(let F in e){let{originalEvent:O}=e[F];this._fireEvent(F,O)}let T={},M;for(let F in this._eventsInProgress){let{handlerName:O,originalEvent:V}=this._eventsInProgress[F];this._handlersById[O].isActive()||(delete this._eventsInProgress[F],M=s[O]||V,T[`${F}end`]=M)}for(let F in T)this._fireEvent(F,T[F]);let P=hn(this._eventsInProgress),D=(p||g)&&!P;if(D&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let F=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&F.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(F)}if(d&&D){this._updatingCamera=!0;let F=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),O=V=>V!==0&&-this._bearingSnap<V&&V<this._bearingSnap;!F||!F.essential&&E.prefersReducedMotion?(this._map.fire(new n.k("moveend",{originalEvent:M})),O(this._map.getBearing())&&this._map.resetNorth()):(O(F.bearing||this._map.getBearing())&&(F.bearing=0),F.freezeElevation=!0,this._map.easeTo(F,{originalEvent:M})),this._updatingCamera=!1}}_fireEvent(e,s){this._map.fire(new n.k(e,s?{originalEvent:s}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new rc("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class nc extends n.E{constructor(e,s,d){super(),this._renderFrameCallback=()=>{let p=Math.min((E.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(p)),p<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=d.bearingSnap,this.cameraHelper=s,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,s){e.apply(this.transform),this.transform=e,this.cameraHelper=s}getCenter(){return new n.N(this.transform.center.lng,this.transform.center.lat)}setCenter(e,s){return this.jumpTo({center:e},s)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,s){return this.jumpTo({elevation:e},s),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,s,d){return e=n.P.convert(e).mult(-1),this.panTo(this.transform.center,n.e({offset:e},s),d)}panTo(e,s,d){return this.easeTo(n.e({center:e},s),d)}getZoom(){return this.transform.zoom}setZoom(e,s){return this.jumpTo({zoom:e},s),this}zoomTo(e,s,d){return this.easeTo(n.e({zoom:e},s),d)}zoomIn(e,s){return this.zoomTo(this.getZoom()+1,e,s),this}zoomOut(e,s){return this.zoomTo(this.getZoom()-1,e,s),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,s){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new n.k("movestart",s)).fire(new n.k("move",s)).fire(new n.k("moveend",s))),this}getBearing(){return this.transform.bearing}setBearing(e,s){return this.jumpTo({bearing:e},s),this}getPadding(){return this.transform.padding}setPadding(e,s){return this.jumpTo({padding:e},s),this}rotateTo(e,s,d){return this.easeTo(n.e({bearing:e},s),d)}resetNorth(e,s){return this.rotateTo(0,n.e({duration:1e3},e),s),this}resetNorthPitch(e,s){return this.easeTo(n.e({bearing:0,pitch:0,roll:0,duration:1e3},e),s),this}snapToNorth(e,s){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,s):this}getPitch(){return this.transform.pitch}setPitch(e,s){return this.jumpTo({pitch:e},s),this}getRoll(){return this.transform.roll}setRoll(e,s){return this.jumpTo({roll:e},s),this}cameraForBounds(e,s){e=oi.convert(e).adjustAntiMeridian();let d=s&&s.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),d,s)}_cameraForBoxAndBearing(e,s,d,p){let g={top:0,bottom:0,right:0,left:0};if(typeof(p=n.e({padding:g,offset:[0,0],maxZoom:this.transform.maxZoom},p)).padding=="number"){let P=p.padding;p.padding={top:P,bottom:P,right:P,left:P}}let v=n.e(g,p.padding);p.padding=v;let T=this.transform,M=new oi(e,s);return this.cameraHelper.cameraForBoxAndBearing(p,v,M,d,T)}fitBounds(e,s,d){return this._fitInternal(this.cameraForBounds(e,s),s,d)}fitScreenCoordinates(e,s,d,p,g){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(n.P.convert(e)),this.transform.screenPointToLocation(n.P.convert(s)),d,p),p,g)}_fitInternal(e,s,d){return e?(delete(s=n.e(e,s)).padding,s.linear?this.easeTo(s,d):this.flyTo(s,d)):this}jumpTo(e,s){this.stop();let d=this._getTransformForUpdate(),p=!1,g=!1,v=!1,T=d.zoom;this.cameraHelper.handleJumpToCenterZoom(d,e);let M=d.zoom!==T;return"elevation"in e&&d.elevation!==+e.elevation&&d.setElevation(+e.elevation),"bearing"in e&&d.bearing!==+e.bearing&&(p=!0,d.setBearing(+e.bearing)),"pitch"in e&&d.pitch!==+e.pitch&&(g=!0,d.setPitch(+e.pitch)),"roll"in e&&d.roll!==+e.roll&&(v=!0,d.setRoll(+e.roll)),e.padding==null||d.isPaddingEqual(e.padding)||d.setPadding(e.padding),this._applyUpdatedTransform(d),this.fire(new n.k("movestart",s)).fire(new n.k("move",s)),M&&this.fire(new n.k("zoomstart",s)).fire(new n.k("zoom",s)).fire(new n.k("zoomend",s)),p&&this.fire(new n.k("rotatestart",s)).fire(new n.k("rotate",s)).fire(new n.k("rotateend",s)),g&&this.fire(new n.k("pitchstart",s)).fire(new n.k("pitch",s)).fire(new n.k("pitchend",s)),v&&this.fire(new n.k("rollstart",s)).fire(new n.k("roll",s)).fire(new n.k("rollend",s)),this.fire(new n.k("moveend",s))}calculateCameraOptionsFromTo(e,s,d,p=0){let g=n.Y.fromLngLat(e,s),v=n.Y.fromLngLat(d,p),T=v.x-g.x,M=v.y-g.y,P=v.z-g.z,D=Math.hypot(T,M,P);if(D===0)throw new Error("Can't calculate camera options with same From and To");let F=Math.hypot(T,M),O=n.a8(this.transform.cameraToCenterDistance/D/this.transform.tileSize),V=180*Math.atan2(T,-M)/Math.PI,q=180*Math.acos(F/D)/Math.PI;return q=P<0?90-q:90+q,{center:v.toLngLat(),elevation:p,zoom:O,pitch:q,bearing:V}}calculateCameraOptionsFromCameraLngLatAltRotation(e,s,d,p,g){let v=this.transform.calculateCenterFromCameraLngLatAlt(e,s,d,p);return{center:v.center,elevation:v.elevation,zoom:v.zoom,bearing:d,pitch:p,roll:g}}easeTo(e,s){this._stop(!1,e.easeId),((e=n.e({offset:[0,0],duration:500,easing:n.c8},e)).animate===!1||!e.essential&&E.prefersReducedMotion)&&(e.duration=0);let d=this._getTransformForUpdate(),p=this.getBearing(),g=d.pitch,v=d.roll,T="bearing"in e?this._normalizeBearing(e.bearing,p):p,M="pitch"in e?+e.pitch:g,P="roll"in e?this._normalizeBearing(e.roll,v):v,D="padding"in e?e.padding:d.padding,F=n.P.convert(e.offset),O,V;e.around&&(O=n.N.convert(e.around),V=d.locationToScreenPoint(O));let q={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},Q=this.cameraHelper.handleEaseTo(d,{bearing:T,pitch:M,roll:P,padding:D,around:O,aroundPoint:V,offsetAsPoint:F,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||p!==T,this._pitching=this._pitching||M!==g,this._rolling=this._rolling||P!==v,this._padding=!d.isPaddingEqual(D),this._zooming=this._zooming||Q.isZooming,this._easeId=e.easeId,this._prepareEase(s,e.noMoveStart,q),this.terrain&&this._prepareElevation(Q.elevationCenter),this._ease(J=>{Q.easeFunc(J),this.terrain&&!e.freezeElevation&&this._updateElevation(J),this._applyUpdatedTransform(d),this._fireMoveEvents(s)},J=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(s,J)},e),this}_prepareEase(e,s,d={}){this._moving=!0,s||d.moving||this.fire(new n.k("movestart",e)),this._zooming&&!d.zooming&&this.fire(new n.k("zoomstart",e)),this._rotating&&!d.rotating&&this.fire(new n.k("rotatestart",e)),this._pitching&&!d.pitching&&this.fire(new n.k("pitchstart",e)),this._rolling&&!d.rolling&&this.fire(new n.k("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let s=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&s!==this._elevationTarget){let d=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(d-(s-(d*e+this._elevationStart))/(1-e)),this._elevationTarget=s}this.transform.setElevation(n.y.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};let s=e.getCameraLngLat(),d=e.getCameraAltitude(),p=this.terrain?this.terrain.getElevationForLngLatZoom(s,e.zoom):0;if(d<p){let g=this.calculateCameraOptionsFromTo(s,p,e.center,e.elevation);return{pitch:g.pitch,zoom:g.zoom}}return{}}_applyUpdatedTransform(e){let s=[];if(s.push(p=>this._elevateCameraIfInsideTerrain(p)),this.transformCameraUpdate&&s.push(p=>this.transformCameraUpdate(p)),!s.length)return;let d=e.clone();for(let p of s){let g=d.clone(),{center:v,zoom:T,roll:M,pitch:P,bearing:D,elevation:F}=p(g);v&&g.setCenter(v),F!==void 0&&g.setElevation(F),T!==void 0&&g.setZoom(T),M!==void 0&&g.setRoll(M),P!==void 0&&g.setPitch(P),D!==void 0&&g.setBearing(D),d.apply(g)}this.transform.apply(d)}_fireMoveEvents(e){this.fire(new n.k("move",e)),this._zooming&&this.fire(new n.k("zoom",e)),this._rotating&&this.fire(new n.k("rotate",e)),this._pitching&&this.fire(new n.k("pitch",e)),this._rolling&&this.fire(new n.k("roll",e))}_afterEase(e,s){if(this._easeId&&s&&this._easeId===s)return;delete this._easeId;let d=this._zooming,p=this._rotating,g=this._pitching,v=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,d&&this.fire(new n.k("zoomend",e)),p&&this.fire(new n.k("rotateend",e)),g&&this.fire(new n.k("pitchend",e)),v&&this.fire(new n.k("rollend",e)),this.fire(new n.k("moveend",e))}flyTo(e,s){if(!e.essential&&E.prefersReducedMotion){let Ae=n.M(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(Ae,s)}this.stop(),e=n.e({offset:[0,0],speed:1.2,curve:1.42,easing:n.c8},e);let d=this._getTransformForUpdate(),p=d.bearing,g=d.pitch,v=d.roll,T=d.padding,M="bearing"in e?this._normalizeBearing(e.bearing,p):p,P="pitch"in e?+e.pitch:g,D="roll"in e?this._normalizeBearing(e.roll,v):v,F="padding"in e?e.padding:d.padding,O=n.P.convert(e.offset),V=d.centerPoint.add(O),q=d.screenPointToLocation(V),Q=this.cameraHelper.handleFlyTo(d,{bearing:M,pitch:P,roll:D,padding:F,locationAtOffset:q,offsetAsPoint:O,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),J=e.curve,ee=Math.max(d.width,d.height),ie=ee/Q.scaleOfZoom,ae=Q.pixelPathLength;typeof Q.scaleOfMinZoom=="number"&&(J=Math.sqrt(ee/Q.scaleOfMinZoom/ae*2));let le=J*J;function ce(Ae){let Ye=(ie*ie-ee*ee+(Ae?-1:1)*le*le*ae*ae)/(2*(Ae?ie:ee)*le*ae);return Math.log(Math.sqrt(Ye*Ye+1)-Ye)}function fe(Ae){return(Math.exp(Ae)-Math.exp(-Ae))/2}function ue(Ae){return(Math.exp(Ae)+Math.exp(-Ae))/2}let we=ce(!1),Ce=function(Ae){return ue(we)/ue(we+J*Ae)},ze=function(Ae){return ee*((ue(we)*(fe(Ye=we+J*Ae)/ue(Ye))-fe(we))/le)/ae;var Ye},Fe=(ce(!0)-we)/J;if(Math.abs(ae)<2e-6||!isFinite(Fe)){if(Math.abs(ee-ie)<1e-6)return this.easeTo(e,s);let Ae=ie<ee?-1:1;Fe=Math.abs(Math.log(ie/ee))/J,ze=()=>0,Ce=Ye=>Math.exp(Ae*J*Ye)}return e.duration="duration"in e?+e.duration:1e3*Fe/("screenSpeed"in e?+e.screenSpeed/J:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=p!==M,this._pitching=P!==g,this._rolling=D!==v,this._padding=!d.isPaddingEqual(F),this._prepareEase(s,!1),this.terrain&&this._prepareElevation(Q.targetCenter),this._ease(Ae=>{let Ye=Ae*Fe,$e=1/Ce(Ye),Oe=ze(Ye);this._rotating&&d.setBearing(n.y.number(p,M,Ae)),this._pitching&&d.setPitch(n.y.number(g,P,Ae)),this._rolling&&d.setRoll(n.y.number(v,D,Ae)),this._padding&&(d.interpolatePadding(T,F,Ae),V=d.centerPoint.add(O)),Q.easeFunc(Ae,$e,Oe,V),this.terrain&&!e.freezeElevation&&this._updateElevation(Ae),this._applyUpdatedTransform(d),this._fireMoveEvents(s)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(s)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,s){var d;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let p=this._onEaseEnd;delete this._onEaseEnd,p.call(this,s)}return e||(d=this.handlers)===null||d===void 0||d.stop(!1),this}_ease(e,s,d){d.animate===!1||d.duration===0?(e(1),s()):(this._easeStart=E.now(),this._easeOptions=d,this._onEaseFrame=e,this._onEaseEnd=s,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,s){e=n.aI(e,-180,180);let d=Math.abs(e-s);return Math.abs(e-360-s)<d&&(e-=360),Math.abs(e+360-s)<d&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(n.N.convert(e),this.transform.tileZoom):null}}let sc={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class oc{constructor(e=sc){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=s=>{!s||s.sourceDataType!=="metadata"&&s.sourceDataType!=="visibility"&&s.dataType!=="style"&&s.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=A.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=A.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=A.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){A.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._sanitizedAttributionHTML=void 0}_setElementTitle(e,s){let d=this._map._getUIString(`AttributionControl.${s}`);e.title=d,e.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(p=>typeof p!="string"?"":p)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let p=this._map.style.stylesheet;this.styleOwner=p.owner,this.styleId=p.id}let s=this._map.style.sourceCaches;for(let p in s){let g=s[p];if(g.used||g.usedForTerrain){let v=g.getSource();v.attribution&&e.indexOf(v.attribution)<0&&e.push(v.attribution)}}e=e.filter(p=>String(p).trim()),e.sort((p,g)=>p.length-g.length),e=e.filter((p,g)=>{for(let v=g+1;v<e.length;v++)if(e[v].indexOf(p)>=0)return!1;return!0});let d=e.join(" | ");d!==this._sanitizedAttributionHTML&&(this._sanitizedAttributionHTML=A.sanitize(d),e.length?(this._innerContainer.innerHTML=this._sanitizedAttributionHTML,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Ir{constructor(e={}){this._updateCompact=()=>{let s=this._container.children;if(s.length){let d=s[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=A.create("div","maplibregl-ctrl");let s=A.create("a","maplibregl-ctrl-logo");return s.target="_blank",s.rel="noopener nofollow",s.href="https://maplibre.org/",s.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),s.setAttribute("rel","noopener nofollow"),this._container.appendChild(s),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){A.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class mp{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let s=++this._id;return this._queue.push({callback:e,id:s,cancelled:!1}),s}remove(e){let s=this._currentlyRunning,d=s?this._queue.concat(s):this._queue;for(let p of d)if(p.id===e)return void(p.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let s=this._currentlyRunning=this._queue;this._queue=[];for(let d of s)if(!d.cancelled&&(d.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var ss=n.aA([{name:"a_pos3d",type:"Int16",components:3}]);class Sm extends n.E{constructor(e){super(),this._lastTilesetChange=E.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,s){this.sourceCache.update(e,s),this._renderableTilesKeys=[];let d={};for(let p of K(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:s,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))d[p.key]=!0,this._renderableTilesKeys.push(p.key),this._tiles[p.key]||(p.terrainRttPosMatrix32f=new Float64Array(16),n.bL(p.terrainRttPosMatrix32f,0,n.X,n.X,0,0,1),this._tiles[p.key]=new Fn(p,this.tileSize),this._lastTilesetChange=E.now());for(let p in this._tiles)d[p]||delete this._tiles[p]}freeRtt(e){for(let s in this._tiles){let d=this._tiles[s];(!e||d.tileID.equals(e)||d.tileID.isChildOf(e)||e.isChildOf(d.tileID))&&(d.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){let s={};for(let d of this._renderableTilesKeys){let p=this._tiles[d].tileID,g=e.clone(),v=n.a$();if(p.canonical.equals(e.canonical))n.bL(v,0,n.X,n.X,0,0,1);else if(p.canonical.isChildOf(e.canonical)){let T=p.canonical.z-e.canonical.z,M=p.canonical.x-(p.canonical.x>>T<<T),P=p.canonical.y-(p.canonical.y>>T<<T),D=n.X>>T;n.bL(v,0,D,D,0,0,1),n.J(v,v,[-M*D,-P*D,0])}else{if(!e.canonical.isChildOf(p.canonical))continue;{let T=e.canonical.z-p.canonical.z,M=e.canonical.x-(e.canonical.x>>T<<T),P=e.canonical.y-(e.canonical.y>>T<<T),D=n.X>>T;n.bL(v,0,n.X,n.X,0,0,1),n.J(v,v,[M*D,P*D,0]),n.K(v,v,[1/2**T,1/2**T,0])}}g.terrainRttPosMatrix32f=new Float32Array(v),s[d]=g}return s}getSourceTile(e,s){let d=this.sourceCache._source,p=e.overscaledZ-this.deltaZoom;if(p>d.maxzoom&&(p=d.maxzoom),p<d.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(p).key);let g=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!g||!g.dem)&&s)for(;p>=d.minzoom&&(!g||!g.dem);)g=this.sourceCache.getTileByID(e.scaledTo(p--).key);return g}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}}class Qa{constructor(e,s,d){this._meshCache={},this.painter=e,this.sourceCache=new Sm(s),this.options=d,this.exaggeration=typeof d.exaggeration=="number"?d.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,s,d,p=n.X){var g;if(!(s>=0&&s<p&&d>=0&&d<p))return 0;let v=this.getTerrainData(e),T=(g=v.tile)===null||g===void 0?void 0:g.dem;if(!T)return 0;let M=n.c9([],[s/p*n.X,d/p*n.X],v.u_terrain_matrix),P=[M[0]*T.dim,M[1]*T.dim],D=Math.floor(P[0]),F=Math.floor(P[1]),O=P[0]-D,V=P[1]-F;return T.get(D,F)*(1-O)*(1-V)+T.get(D+1,F)*O*(1-V)+T.get(D,F+1)*(1-O)*V+T.get(D+1,F+1)*O*V}getElevationForLngLatZoom(e,s){if(!n.ca(s,e.wrap()))return 0;let{tileID:d,mercatorX:p,mercatorY:g}=this._getOverscaledTileIDFromLngLatZoom(e,s);return this.getElevation(d,p%n.X,g%n.X,n.X)}getElevation(e,s,d,p=n.X){return this.getDEMElevation(e,s,d,p)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){let p=this.painter.context,g=new n.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Re(p,g,p.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Re(p,new n.R({width:1,height:1}),p.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(p.gl.NEAREST,p.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=n.aq([])}let s=this.sourceCache.getSourceTile(e,!0);if(s&&s.dem&&(!s.demTexture||s.needsTerrainPrepare)){let p=this.painter.context;s.demTexture=this.painter.getTileTexture(s.dem.stride),s.demTexture?s.demTexture.update(s.dem.getPixels(),{premultiply:!1}):s.demTexture=new Re(p,s.dem.getPixels(),p.gl.RGBA,{premultiply:!1}),s.demTexture.bind(p.gl.NEAREST,p.gl.CLAMP_TO_EDGE),s.needsTerrainPrepare=!1}let d=s&&s+s.tileID.key+e.key;if(d&&!this._demMatrixCache[d]){let p=this.sourceCache.sourceCache._source.maxzoom,g=e.canonical.z-s.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=p?g=e.canonical.z-p:n.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let v=e.canonical.x-(e.canonical.x>>g<<g),T=e.canonical.y-(e.canonical.y>>g<<g),M=n.cb(new Float64Array(16),[1/(n.X<<g),1/(n.X<<g),0]);n.J(M,M,[v*n.X,T*n.X,0]),this._demMatrixCache[e.key]={matrix:M,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:s&&s.dem&&s.dem.dim||1,u_terrain_matrix:d?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:s&&s.dem&&s.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(s&&s.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:s}}getFramebuffer(e){let s=this.painter,d=s.width/devicePixelRatio,p=s.height/devicePixelRatio;return!this._fbo||this._fbo.width===d&&this._fbo.height===p||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Re(s.context,{width:d,height:p,data:null},s.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(s.context.gl.NEAREST,s.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Re(s.context,{width:d,height:p,data:null},s.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(s.context.gl.NEAREST,s.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=s.context.createFramebuffer(d,p,!0,!1),this._fbo.depthAttachment.set(s.context.createRenderbuffer(s.context.gl.DEPTH_COMPONENT16,d,p))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let s=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let g=0,v=0;g<this._coordsTextureSize;g++)for(let T=0;T<this._coordsTextureSize;T++,v+=4)s[v+0]=255&T,s[v+1]=255&g,s[v+2]=T>>8<<4|g>>8,s[v+3]=0;let d=new n.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(s.buffer)),p=new Re(e,d,e.gl.RGBA,{premultiply:!1});return p.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=p,p}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);let s=new Uint8Array(4),d=this.painter.context,p=d.gl,g=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),v=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),T=Math.round(this.painter.height/devicePixelRatio);d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),p.readPixels(g,T-v-1,1,1,p.RGBA,p.UNSIGNED_BYTE,s),d.bindFramebuffer.set(null);let M=s[0]+(s[2]>>4<<8),P=s[1]+((15&s[2])<<8),D=this.coordsIndex[255-s[3]],F=D&&this.sourceCache.getTileByID(D);if(!F)return null;let O=this._coordsTextureSize,V=(1<<F.tileID.canonical.z)*O;return new n.Y((F.tileID.canonical.x*O+M)/V+F.tileID.wrap,(F.tileID.canonical.y*O+P)/V,this.getElevation(F.tileID,M,P,O))}depthAtPoint(e){let s=new Uint8Array(4),d=this.painter.context,p=d.gl;return d.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),p.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,p.RGBA,p.UNSIGNED_BYTE,s),d.bindFramebuffer.set(null),(s[0]/16777216+s[1]/65536+s[2]/256+s[3])/256}getTerrainMesh(e){var s;let d=((s=this.painter.style.projection)===null||s===void 0?void 0:s.transitionState)>0,p=d&&e.canonical.y===0,g=d&&e.canonical.y===(1<<e.canonical.z)-1,v=`m_${p?"n":""}_${g?"s":""}`;if(this._meshCache[v])return this._meshCache[v];let T=this.painter.context,M=new n.cc,P=new n.aE,D=this.meshSize,F=n.X/D,O=D*D;for(let ue=0;ue<=D;ue++)for(let we=0;we<=D;we++)M.emplaceBack(we*F,ue*F,0);for(let ue=0;ue<O;ue+=D+1)for(let we=0;we<D;we++)P.emplaceBack(we+ue,D+we+ue+1,D+we+ue+2),P.emplaceBack(we+ue,D+we+ue+2,we+ue+1);let V=M.length,q=V+(D+1),Q=(D+1)*D,J=p?n.b6:0,ee=p?0:1,ie=g?n.b7:n.X,ae=g?0:1;for(let ue=0;ue<=D;ue++)M.emplaceBack(ue*F,J,ee);for(let ue=0;ue<=D;ue++)M.emplaceBack(ue*F,ie,ae);for(let ue=0;ue<D;ue++)P.emplaceBack(Q+ue,q+ue,q+ue+1),P.emplaceBack(Q+ue,q+ue+1,Q+ue+1),P.emplaceBack(0+ue,V+ue+1,V+ue),P.emplaceBack(0+ue,0+ue+1,V+ue+1);let le=M.length,ce=le+2*(D+1);for(let ue of[0,1])for(let we=0;we<=D;we++)for(let Ce of[0,1])M.emplaceBack(ue*n.X,we*F,Ce);for(let ue=0;ue<2*D;ue+=2)P.emplaceBack(le+ue,le+ue+1,le+ue+3),P.emplaceBack(le+ue,le+ue+3,le+ue+2),P.emplaceBack(ce+ue,ce+ue+3,ce+ue+1),P.emplaceBack(ce+ue,ce+ue+2,ce+ue+3);let fe=new ts(T.createVertexBuffer(M,ss.members),T.createIndexBuffer(P),n.aD.simpleSegment(0,0,M.length,P.length));return this._meshCache[v]=fe,fe}getMeshFrameDelta(e){return 2*Math.PI*n.bo/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,s){var d;let{tileID:p}=this._getOverscaledTileIDFromLngLatZoom(e,s);return(d=this.getMinMaxElevation(p).minElevation)!==null&&d!==void 0?d:0}getMinMaxElevation(e){let s=this.getTerrainData(e).tile,d={minElevation:null,maxElevation:null};return s&&s.dem&&(d.minElevation=s.dem.min*this.exaggeration,d.maxElevation=s.dem.max*this.exaggeration),d}_getOverscaledTileIDFromLngLatZoom(e,s){let d=n.Y.fromLngLat(e.wrap()),p=(1<<s)*n.X,g=d.x*p,v=d.y*p,T=Math.floor(g/n.X),M=Math.floor(v/n.X);return{tileID:new n.S(s,0,s,T,M),mercatorX:g,mercatorY:v}}}class xi{constructor(e,s,d){this._context=e,this._size=s,this._tileSize=d,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){let s=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),d=new Re(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return d.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),s.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),s.colorAttachment.set(d.texture),{id:e,fbo:s,texture:d,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(s=>e.id!==s),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let s of this._recentlyUsed)if(!this._objects[s].inUse)return this._objects[s];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(e=>!e.inUse)===!1}}let ri={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class gp{constructor(e,s){this.painter=e,this.terrain=s,this.pool=new xi(e.context,30,s.sourceCache.tileSize*s.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,s){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(d=>!e._layers[d].isHidden(s)),this._coordsAscending={};for(let d in e.sourceCaches){this._coordsAscending[d]={};let p=e.sourceCaches[d].getVisibleCoordinates();for(let g of p){let v=this.terrain.sourceCache.getTerrainCoords(g);for(let T in v)this._coordsAscending[d][T]||(this._coordsAscending[d][T]=[]),this._coordsAscending[d][T].push(v[T])}}this._coordsAscendingStr={};for(let d of e._order){let p=e._layers[d],g=p.source;if(ri[p.type]&&!this._coordsAscendingStr[g]){this._coordsAscendingStr[g]={};for(let v in this._coordsAscending[g])this._coordsAscendingStr[g][v]=this._coordsAscending[g][v].map(T=>T.key).sort().join()}}for(let d of this._renderableTiles)for(let p in this._coordsAscendingStr){let g=this._coordsAscendingStr[p][d.tileID.key];g&&g!==d.rttCoords[p]&&(d.rtt=[])}}renderLayer(e,s){if(e.isHidden(this.painter.transform.zoom))return!1;let d=Object.assign(Object.assign({},s),{isRenderingToTexture:!0}),p=e.type,g=this.painter,v=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(ri[p]&&(this._prevType&&ri[this._prevType]||this._stacks.push([]),this._prevType=p,this._stacks[this._stacks.length-1].push(e.id),!v))return!0;if(ri[this._prevType]||ri[p]&&v){this._prevType=p;let T=this._stacks.length-1,M=this._stacks[T]||[];for(let P of this._renderableTiles){if(this.pool.isFull()&&(Nh(this.painter,this.terrain,this._rttTiles,d),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(P),P.rtt[T]){let F=this.pool.getObjectForId(P.rtt[T].id);if(F.stamp===P.rtt[T].stamp){this.pool.useObject(F);continue}}let D=this.pool.getOrCreateFreeObject();this.pool.useObject(D),this.pool.stampObject(D),P.rtt[T]={id:D.id,stamp:D.stamp},g.context.bindFramebuffer.set(D.fbo.framebuffer),g.context.clear({color:n.b4.transparent,stencil:0}),g.currentStencilSource=void 0;for(let F=0;F<M.length;F++){let O=g.style._layers[M[F]],V=O.source?this._coordsAscending[O.source][P.tileID.key]:[P.tileID];g.context.viewport.set([0,0,D.fbo.width,D.fbo.height]),g._renderTileClippingMasks(O,V,!0),g.renderLayer(g,g.style.sourceCaches[O.source],O,V,d),O.source&&(P.rttCoords[O.source]=this._coordsAscendingStr[O.source][P.tileID.key])}}return Nh(this.painter,this.terrain,this._rttTiles,d),this._rttTiles=[],this.pool.freeAllObjects(),ri[p]}return!1}}let el={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},ac=x,lc={hash:!1,interactive:!0,bearingSnap:7,attributionControl:sc,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:n.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},Jh={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Qh{constructor(e,s,d=!1){this.mousedown=g=>{this.startMove(g,A.mousePos(this.element,g)),A.addEventListener(window,"mousemove",this.mousemove),A.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=g=>{this.move(g,A.mousePos(this.element,g))},this.mouseup=g=>{this._rotatePitchHanlder.dragEnd(g),this.offTemp()},this.touchstart=g=>{g.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=A.touchPos(this.element,g.targetTouches)[0],this.startMove(g,this._startPos),A.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),A.addEventListener(window,"touchend",this.touchend))},this.touchmove=g=>{g.targetTouches.length!==1?this.reset():(this._lastPos=A.touchPos(this.element,g.targetTouches)[0],this.move(g,this._lastPos))},this.touchend=g=>{g.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=s;let p=new Ha;this._rotatePitchHanlder=new ea({clickTolerance:3,move:(g,v)=>{let T=s.getBoundingClientRect(),M=new n.P((T.bottom-T.top)/2,(T.right-T.left)/2);return{bearingDelta:n.c7(new n.P(g.x,v.y),v,M),pitchDelta:d?-.5*(v.y-g.y):void 0}},moveStateManager:p,enable:!0,assignEvents:()=>{}}),this.map=e,A.addEventListener(s,"mousedown",this.mousedown),A.addEventListener(s,"touchstart",this.touchstart,{passive:!1}),A.addEventListener(s,"touchcancel",this.reset)}startMove(e,s){this._rotatePitchHanlder.dragStart(e,s),A.disableDrag()}move(e,s){let d=this.map,{bearingDelta:p,pitchDelta:g}=this._rotatePitchHanlder.dragMove(e,s)||{};p&&d.setBearing(d.getBearing()+p),g&&d.setPitch(d.getPitch()+g)}off(){let e=this.element;A.removeEventListener(e,"mousedown",this.mousedown),A.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),A.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),A.removeEventListener(window,"touchend",this.touchend),A.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){A.enableDrag(),A.removeEventListener(window,"mousemove",this.mousemove),A.removeEventListener(window,"mouseup",this.mouseup),A.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),A.removeEventListener(window,"touchend",this.touchend)}}let Gn;function cc(m,e,s){let d=new n.N(m.lng,m.lat);if(m=new n.N(m.lng,m.lat),e){let p=new n.N(m.lng-360,m.lat),g=new n.N(m.lng+360,m.lat),v=s.locationToScreenPoint(m).distSqr(e);s.locationToScreenPoint(p).distSqr(e)<v?m=p:s.locationToScreenPoint(g).distSqr(e)<v&&(m=g)}for(;Math.abs(m.lng-s.center.lng)>180;){let p=s.locationToScreenPoint(m);if(p.x>=0&&p.y>=0&&p.x<=s.width&&p.y<=s.height)break;m.lng>s.center.lng?m.lng-=360:m.lng+=360}return m.lng!==d.lng&&s.isPointOnMapSurface(s.locationToScreenPoint(m))?m:d}let tl={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 hc(m,e,s){let d=m.classList;for(let p in tl)d.remove(`maplibregl-${s}-anchor-${p}`);d.add(`maplibregl-${s}-anchor-${e}`)}class il extends n.E{constructor(e){if(super(),this._onKeyPress=s=>{let d=s.code,p=s.charCode||s.keyCode;d!=="Space"&&d!=="Enter"&&p!==32&&p!==13||this.togglePopup()},this._onMapClick=s=>{let d=s.originalEvent.target,p=this._element;this._popup&&(d===p||p.contains(d))&&this.togglePopup()},this._update=s=>{var d;if(!this._map)return;let p=this._map.loaded()&&!this._map.isMoving();(s?.type==="terrain"||s?.type==="render"&&!p)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?cc(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let g="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?g=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(g=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let v="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?v="rotateX(0deg)":this._pitchAlignment==="map"&&(v=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||s&&s.type!=="moveend"||(this._pos=this._pos.round()),A.setTransform(this._element,`${tl[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${v} ${g}`),E.frameAsync(new AbortController).then(()=>{this._updateOpacity(s&&s.type==="moveend")}).catch(()=>{})},this._onMove=s=>{if(!this._isDragging){let d=this._clickTolerance||this._map._clickTolerance;this._isDragging=s.point.dist(this._pointerdownPos)>=d}this._isDragging&&(this._pos=s.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 n.k("dragstart"))),this.fire(new n.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new n.k("dragend")),this._state="inactive"},this._addDragHandler=s=>{this._element.contains(s.originalEvent.target)&&(s.preventDefault(),this._positionDelta=s.point.sub(this._pos).add(this._offset),this._pointerdownPos=s.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(e?.opacity,e?.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=n.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=A.create("div");let s=A.createNS("http://www.w3.org/2000/svg","svg"),d=41,p=27;s.setAttributeNS(null,"display","block"),s.setAttributeNS(null,"height",`${d}px`),s.setAttributeNS(null,"width",`${p}px`),s.setAttributeNS(null,"viewBox",`0 0 ${p} ${d}`);let g=A.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"stroke","none"),g.setAttributeNS(null,"stroke-width","1"),g.setAttributeNS(null,"fill","none"),g.setAttributeNS(null,"fill-rule","evenodd");let v=A.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"fill-rule","nonzero");let T=A.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"transform","translate(3.0, 29.0)"),T.setAttributeNS(null,"fill","#000000");let M=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let ee of M){let ie=A.createNS("http://www.w3.org/2000/svg","ellipse");ie.setAttributeNS(null,"opacity","0.04"),ie.setAttributeNS(null,"cx","10.5"),ie.setAttributeNS(null,"cy","5.80029008"),ie.setAttributeNS(null,"rx",ee.rx),ie.setAttributeNS(null,"ry",ee.ry),T.appendChild(ie)}let P=A.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"fill",this._color);let D=A.createNS("http://www.w3.org/2000/svg","path");D.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"),P.appendChild(D);let F=A.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");let O=A.createNS("http://www.w3.org/2000/svg","path");O.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"),F.appendChild(O);let V=A.createNS("http://www.w3.org/2000/svg","g");V.setAttributeNS(null,"transform","translate(6.0, 7.0)"),V.setAttributeNS(null,"fill","#FFFFFF");let q=A.createNS("http://www.w3.org/2000/svg","g");q.setAttributeNS(null,"transform","translate(8.0, 8.0)");let Q=A.createNS("http://www.w3.org/2000/svg","circle");Q.setAttributeNS(null,"fill","#000000"),Q.setAttributeNS(null,"opacity","0.25"),Q.setAttributeNS(null,"cx","5.5"),Q.setAttributeNS(null,"cy","5.5"),Q.setAttributeNS(null,"r","5.4999962");let J=A.createNS("http://www.w3.org/2000/svg","circle");J.setAttributeNS(null,"fill","#FFFFFF"),J.setAttributeNS(null,"cx","5.5"),J.setAttributeNS(null,"cy","5.5"),J.setAttributeNS(null,"r","5.4999962"),q.appendChild(Q),q.appendChild(J),v.appendChild(T),v.appendChild(P),v.appendChild(F),v.appendChild(V),v.appendChild(q),s.appendChild(v),s.setAttributeNS(null,"height",d*this._scale+"px"),s.setAttributeNS(null,"width",p*this._scale+"px"),this._element.appendChild(s),this._offset=n.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",s=>{s.preventDefault()}),this._element.addEventListener("mousedown",s=>{s.preventDefault()}),hc(this._element,this._anchor,"marker"),e&&e.className)for(let s of e.className.split(" "))this._element.classList.add(s);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",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("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),A.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=n.N.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let p=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[p,-1*(38.1-13.5+p)],"bottom-right":[-p,-1*(38.1-13.5+p)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){let e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var s,d;if(!(!((s=this._map)===null||s===void 0)&&s.terrain)){let F=this._map.transform.isLocationOccluded(this._lngLat)?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==F&&(this._element.style.opacity=F))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let p=this._map,g=p.terrain.depthAtPoint(this._pos),v=p.terrain.getElevationForLngLatZoom(this._lngLat,p.transform.tileZoom);if(p.transform.lngLatToCameraDepth(this._lngLat,v)-g<.006)return void(this._element.style.opacity=this._opacity);let T=-this._offset.y/p.transform.pixelsPerMeter,M=Math.sin(p.getPitch()*Math.PI/180)*T,P=p.terrain.depthAtPoint(new n.P(this._pos.x,this._pos.y-this._offset.y)),D=p.transform.lngLatToCameraDepth(this._lngLat,v+M)-P>.006;!((d=this._popup)===null||d===void 0)&&d.isOpen()&&D&&this._popup.remove(),this._element.style.opacity=D?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=n.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,s){return e===void 0&&s===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),s!==void 0&&(this._opacityWhenCovered=s),this._map&&this._updateOpacity(!0),this}}let eu={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},ia=0,yo=!1,tu={maxWidth:100,unit:"metric"};function rl(m,e,s){let d=s&&s.maxWidth||100,p=m._container.clientHeight/2,g=m._container.clientWidth/2,v=m.unproject([g-d/2,p]),T=m.unproject([g+d/2,p]),M=Math.round(m.project(T).x-m.project(v).x),P=Math.min(d,M,m._container.clientWidth),D=v.distanceTo(T);if(s&&s.unit==="imperial"){let F=3.2808*D;F>5280?xo(e,P,F/5280,m._getUIString("ScaleControl.Miles")):xo(e,P,F,m._getUIString("ScaleControl.Feet"))}else s&&s.unit==="nautical"?xo(e,P,D/1852,m._getUIString("ScaleControl.NauticalMiles")):D>=1e3?xo(e,P,D/1e3,m._getUIString("ScaleControl.Kilometers")):xo(e,P,D,m._getUIString("ScaleControl.Meters"))}function xo(m,e,s,d){let p=function(g){let v=Math.pow(10,`${Math.floor(g)}`.length-1),T=g/v;return T=T>=10?10:T>=5?5:T>=3?3:T>=2?2:T>=1?1:function(M){let P=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*P)/P}(T),v*T}(s);m.style.width=e*(p/s)+"px",m.innerHTML=`${p}&nbsp;${d}`}let iu={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},uc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function dc(m){if(m){if(typeof m=="number"){let e=Math.round(Math.abs(m)/Math.SQRT2);return{center:new n.P(0,0),top:new n.P(0,m),"top-left":new n.P(e,e),"top-right":new n.P(-e,e),bottom:new n.P(0,-m),"bottom-left":new n.P(e,-e),"bottom-right":new n.P(-e,-e),left:new n.P(m,0),right:new n.P(-m,0)}}if(m instanceof n.P||Array.isArray(m)){let e=n.P.convert(m);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:n.P.convert(m.center||[0,0]),top:n.P.convert(m.top||[0,0]),"top-left":n.P.convert(m["top-left"]||[0,0]),"top-right":n.P.convert(m["top-right"]||[0,0]),bottom:n.P.convert(m.bottom||[0,0]),"bottom-left":n.P.convert(m["bottom-left"]||[0,0]),"bottom-right":n.P.convert(m["bottom-right"]||[0,0]),left:n.P.convert(m.left||[0,0]),right:n.P.convert(m.right||[0,0])}}return dc(new n.P(0,0))}let ru=x;c.AJAXError=n.cg,c.Event=n.k,c.Evented=n.E,c.LngLat=n.N,c.MercatorCoordinate=n.Y,c.Point=n.P,c.addProtocol=n.ch,c.config=n.a,c.removeProtocol=n.ci,c.AttributionControl=oc,c.BoxZoomHandler=hp,c.CanvasSource=kn,c.CooperativeGesturesHandler=fp,c.DoubleClickZoomHandler=ii,c.DragPanHandler=Hh,c.DragRotateHandler=Yh,c.EdgeInsets=tr,c.FullscreenControl=class extends n.E{constructor(m={}){super(),this._onFullscreenChange=()=>{var e;let s=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=s?.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)s=s.shadowRoot.fullscreenElement;s===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,m&&m.container&&(m.container instanceof HTMLElement?this._container=m.container:n.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(m){return this._map=m,this._container||(this._container=this._map.getContainer()),this._controlContainer=A.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){A.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let m=this._fullscreenButton=A.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);A.create("span","maplibregl-ctrl-icon",m).setAttribute("aria-hidden","true"),m.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let m=this._getTitle();this._fullscreenButton.setAttribute("aria-label",m),this._fullscreenButton.title=m}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new n.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new n.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){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._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},c.GeoJSONSource=yi,c.GeolocateControl=class extends n.E{constructor(m){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new n.k("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new n.k("geolocate",e)),this._finish()}},this._updateCamera=e=>{let s=new n.N(e.coords.longitude,e.coords.latitude),d=e.coords.accuracy,p=this._map.getBearing(),g=n.e({bearing:p},this.options.fitBoundsOptions),v=oi.fromLngLat(s,d);this._map.fitBounds(v,g,{geolocateSource:!0})},this._updateMarker=e=>{if(e){let s=new n.N(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(s).addTo(this._map),this._userLocationDotMarker.setLngLat(s).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(this.options.trackUserLocation)if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&yo)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new n.k("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=A.create("button","maplibregl-ctrl-geolocate",this._container),A.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){n.w("Geolocation support is not available so the GeolocateControl will be disabled.");let s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s)}else{let s=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=A.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new il({element:this._dotElement}),this._circleElement=A.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new il({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",s=>{s.geolocateSource||this._watchState!=="ACTIVE_LOCK"||s.originalEvent&&s.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new n.k("trackuserlocationend")),this.fire(new n.k("userlocationlostfocus")))})}},this.options=n.e({},eu,m)}onAdd(m){return this._map=m,this._container=A.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return n._(this,arguments,void 0,function*(e=!1){if(Gn!==void 0&&!e)return Gn;if(window.navigator.permissions===void 0)return Gn=!!window.navigator.geolocation,Gn;try{Gn=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Gn=!!window.navigator.geolocation}return Gn})}().then(e=>this._finishSetupUI(e)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),A.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ia=0,yo=!1}_isOutOfMapMaxBounds(m){let e=this._map.getMaxBounds(),s=m.coords;return e&&(s.longitude<e.getWest()||s.longitude>e.getEast()||s.latitude<e.getSouth()||s.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){let m=this._map.getBounds(),e=m.getSouthEast(),s=m.getNorthEast(),d=e.distanceTo(s),p=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${p}px`,this._circleElement.style.height=`${p}px`}trigger(){if(!this._setup)return n.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new n.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ia--,yo=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new n.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new n.k("trackuserlocationstart")),this.fire(new n.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let m;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ia++,ia>1?(m={maximumAge:6e5,timeout:0},yo=!0):(m=this.options.positionOptions,yo=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,m)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},c.GlobeControl=class{constructor(){this._toggleProjection=()=>{var m;let e=(m=this._map.getProjection())===null||m===void 0?void 0:m.type;this._map.setProjection(e!=="mercator"&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var m;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((m=this._map.getProjection())===null||m===void 0?void 0:m.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(m){return this._map=m,this._container=A.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=A.create("button","maplibregl-ctrl-globe",this._container),A.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){A.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},c.Hash=Uh,c.ImageSource=Li,c.KeyboardHandler=$h,c.LngLatBounds=oi,c.LogoControl=Ir,c.Map=class extends nc{constructor(m){var e,s;n.cd.mark(n.ce.create);let d=Object.assign(Object.assign(Object.assign({},lc),m),{canvasContextAttributes:Object.assign(Object.assign({},lc.canvasContextAttributes),m.canvasContextAttributes)});if(d.minZoom!=null&&d.maxZoom!=null&&d.minZoom>d.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(d.minPitch!=null&&d.maxPitch!=null&&d.minPitch>d.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(d.minPitch!=null&&d.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(d.maxPitch!=null&&d.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");let p=new dr,g=new Pa;if(d.minZoom!==void 0&&p.setMinZoom(d.minZoom),d.maxZoom!==void 0&&p.setMaxZoom(d.maxZoom),d.minPitch!==void 0&&p.setMinPitch(d.minPitch),d.maxPitch!==void 0&&p.setMaxPitch(d.maxPitch),d.renderWorldCopies!==void 0&&p.setRenderWorldCopies(d.renderWorldCopies),super(p,g,{bearingSnap:d.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new mp,this._controls=[],this._mapId=n.a1(),this._contextLost=T=>{T.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new n.k("webglcontextlost",{originalEvent:T}))},this._contextRestored=T=>{this._setupPainter(),this.resize(),this._update(),this.fire(new n.k("webglcontextrestored",{originalEvent:T}))},this._onMapScroll=T=>{if(T.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=d.interactive,this._maxTileCacheSize=d.maxTileCacheSize,this._maxTileCacheZoomLevels=d.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},d.canvasContextAttributes),this._trackResize=d.trackResize===!0,this._bearingSnap=d.bearingSnap,this._centerClampedToGround=d.centerClampedToGround,this._refreshExpiredTiles=d.refreshExpiredTiles===!0,this._fadeDuration=d.fadeDuration,this._crossSourceCollisions=d.crossSourceCollisions===!0,this._collectResourceTiming=d.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},el),d.locale),this._clickTolerance=d.clickTolerance,this._overridePixelRatio=d.pixelRatio,this._maxCanvasSize=d.maxCanvasSize,this.transformCameraUpdate=d.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=d.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=ve.addThrottleControl(()=>this.isMoving()),this._requestManager=new De(d.transformRequest),typeof d.container=="string"){if(this._container=document.getElementById(d.container),!this._container)throw new Error(`Container '${d.container}' not found.`)}else{if(!(d.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=d.container}if(d.maxBounds&&this.setMaxBounds(d.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let T=!1,M=Vh(P=>{this._trackResize&&!this._removed&&(this.resize(P),this.redraw())},50);this._resizeObserver=new ResizeObserver(P=>{T?M(P):T=!0}),this._resizeObserver.observe(this._container)}this.handlers=new _t(this,d),this._hash=d.hash&&new Uh(typeof d.hash=="string"&&d.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:d.center,elevation:d.elevation,zoom:d.zoom,bearing:d.bearing,pitch:d.pitch,roll:d.roll}),d.bounds&&(this.resize(),this.fitBounds(d.bounds,n.e({},d.fitBoundsOptions,{duration:0}))));let v=typeof d.style=="string"||((s=(e=d.style)===null||e===void 0?void 0:e.projection)===null||s===void 0?void 0:s.type)!=="globe";this.resize(null,v),this._localIdeographFontFamily=d.localIdeographFontFamily,this._validateStyle=d.validateStyle,d.style&&this.setStyle(d.style,{localIdeographFontFamily:d.localIdeographFontFamily}),d.attributionControl&&this.addControl(new oc(typeof d.attributionControl=="boolean"?void 0:d.attributionControl)),d.maplibreLogo&&this.addControl(new Ir,d.logoPosition),this.on("style.load",()=>{if(v||this._resizeTransform(),this.transform.unmodified){let T=n.M(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(T)}}),this.on("data",T=>{this._update(T.dataType==="style"),this.fire(new n.k(`${T.dataType}data`,T))}),this.on("dataloading",T=>{this.fire(new n.k(`${T.dataType}dataloading`,T))}),this.on("dataabort",T=>{this.fire(new n.k("sourcedataabort",T))})}_getMapId(){return this._mapId}addControl(m,e){if(e===void 0&&(e=m.getDefaultPosition?m.getDefaultPosition():"top-right"),!m||!m.onAdd)return this.fire(new n.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let s=m.onAdd(this);this._controls.push(m);let d=this._controlPositions[e];return e.indexOf("bottom")!==-1?d.insertBefore(s,d.firstChild):d.appendChild(s),this}removeControl(m){if(!m||!m.onRemove)return this.fire(new n.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let e=this._controls.indexOf(m);return e>-1&&this._controls.splice(e,1),m.onRemove(this),this}hasControl(m){return this._controls.indexOf(m)>-1}calculateCameraOptionsFromTo(m,e,s,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(m,e,s,d)}resize(m,e=!0){let[s,d]=this._containerDimensions(),p=this._getClampedPixelRatio(s,d);if(this._resizeCanvas(s,d,p),this.painter.resize(s,d,p),this.painter.overLimit()){let v=this.painter.context.gl;this._maxCanvasSize=[v.drawingBufferWidth,v.drawingBufferHeight];let T=this._getClampedPixelRatio(s,d);this._resizeCanvas(s,d,T),this.painter.resize(s,d,T)}this._resizeTransform(e);let g=!this._moving;return g&&(this.stop(),this.fire(new n.k("movestart",m)).fire(new n.k("move",m))),this.fire(new n.k("resize",m)),g&&this.fire(new n.k("moveend",m)),this}_resizeTransform(m=!0){var e;let[s,d]=this._containerDimensions();this.transform.resize(s,d,m),(e=this._requestedCameraState)===null||e===void 0||e.resize(s,d,m)}_getClampedPixelRatio(m,e){let{0:s,1:d}=this._maxCanvasSize,p=this.getPixelRatio(),g=m*p,v=e*p;return Math.min(g>s?s/g:1,v>d?d/v:1)*p}getPixelRatio(){var m;return(m=this._overridePixelRatio)!==null&&m!==void 0?m:devicePixelRatio}setPixelRatio(m){this._overridePixelRatio=m,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(m){return this.transform.setMaxBounds(oi.convert(m)),this._update()}setMinZoom(m){if((m=m??-2)>=-2&&m<=this.transform.maxZoom)return this.transform.setMinZoom(m),this._update(),this.getZoom()<m&&this.setZoom(m),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(m){if((m=m??22)>=this.transform.minZoom)return this.transform.setMaxZoom(m),this._update(),this.getZoom()>m&&this.setZoom(m),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(m){if((m=m??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(m>=0&&m<=this.transform.maxPitch)return this.transform.setMinPitch(m),this._update(),this.getPitch()<m&&this.setPitch(m),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(m){if((m=m??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(m>=this.transform.minPitch)return this.transform.setMaxPitch(m),this._update(),this.getPitch()>m&&this.setPitch(m),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(m){return this.transform.setRenderWorldCopies(m),this._update()}project(m){return this.transform.locationToScreenPoint(n.N.convert(m),this.style&&this.terrain)}unproject(m){return this.transform.screenPointToLocation(n.P.convert(m),this.terrain)}isMoving(){var m;return this._moving||((m=this.handlers)===null||m===void 0?void 0:m.isMoving())}isZooming(){var m;return this._zooming||((m=this.handlers)===null||m===void 0?void 0:m.isZooming())}isRotating(){var m;return this._rotating||((m=this.handlers)===null||m===void 0?void 0:m.isRotating())}_createDelegatedListener(m,e,s){if(m==="mouseenter"||m==="mouseover"){let d=!1;return{layers:e,listener:s,delegates:{mousemove:g=>{let v=e.filter(M=>this.getLayer(M)),T=v.length!==0?this.queryRenderedFeatures(g.point,{layers:v}):[];T.length?d||(d=!0,s.call(this,new Zr(m,this,g.originalEvent,{features:T}))):d=!1},mouseout:()=>{d=!1}}}}if(m==="mouseleave"||m==="mouseout"){let d=!1;return{layers:e,listener:s,delegates:{mousemove:v=>{let T=e.filter(M=>this.getLayer(M));(T.length!==0?this.queryRenderedFeatures(v.point,{layers:T}):[]).length?d=!0:d&&(d=!1,s.call(this,new Zr(m,this,v.originalEvent)))},mouseout:v=>{d&&(d=!1,s.call(this,new Zr(m,this,v.originalEvent)))}}}}{let d=p=>{let g=e.filter(T=>this.getLayer(T)),v=g.length!==0?this.queryRenderedFeatures(p.point,{layers:g}):[];v.length&&(p.features=v,s.call(this,p),delete p.features)};return{layers:e,listener:s,delegates:{[m]:d}}}}_saveDelegatedListener(m,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[m]=this._delegatedListeners[m]||[],this._delegatedListeners[m].push(e)}_removeDelegatedListener(m,e,s){if(!this._delegatedListeners||!this._delegatedListeners[m])return;let d=this._delegatedListeners[m];for(let p=0;p<d.length;p++){let g=d[p];if(g.listener===s&&g.layers.length===e.length&&g.layers.every(v=>e.includes(v))){for(let v in g.delegates)this.off(v,g.delegates[v]);return void d.splice(p,1)}}}on(m,e,s){if(s===void 0)return super.on(m,e);let d=typeof e=="string"?[e]:e,p=this._createDelegatedListener(m,d,s);this._saveDelegatedListener(m,p);for(let g in p.delegates)this.on(g,p.delegates[g]);return{unsubscribe:()=>{this._removeDelegatedListener(m,d,s)}}}once(m,e,s){if(s===void 0)return super.once(m,e);let d=typeof e=="string"?[e]:e,p=this._createDelegatedListener(m,d,s);for(let g in p.delegates){let v=p.delegates[g];p.delegates[g]=(...T)=>{this._removeDelegatedListener(m,d,s),v(...T)}}this._saveDelegatedListener(m,p);for(let g in p.delegates)this.once(g,p.delegates[g]);return this}off(m,e,s){return s===void 0?super.off(m,e):(this._removeDelegatedListener(m,typeof e=="string"?[e]:e,s),this)}queryRenderedFeatures(m,e){if(!this.style)return[];let s,d=m instanceof n.P||Array.isArray(m),p=d?m:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(d?{}:m)||{},p instanceof n.P||typeof p[0]=="number")s=[n.P.convert(p)];else{let g=n.P.convert(p[0]),v=n.P.convert(p[1]);s=[g,new n.P(v.x,g.y),v,new n.P(g.x,v.y),g]}return this.style.queryRenderedFeatures(s,e,this.transform)}querySourceFeatures(m,e){return this.style.querySourceFeatures(m,e)}setStyle(m,e){return(e=n.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&m?(this._diffStyle(m,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(m,e))}setTransformRequest(m){return this._requestManager.setTransformRequest(m),this}_getUIString(m){let e=this._locale[m];if(e==null)throw new Error(`Missing UI string '${m}'`);return e}_updateStyle(m,e){var s,d;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(m,e));let p=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!m)),m?(this.style=new ch(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof m=="string"?this.style.loadURL(m,e,p):this.style.loadJSON(m,e,p),this):((d=(s=this.style)===null||s===void 0?void 0:s.projection)===null||d===void 0||d.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new ch(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(m,e){if(typeof m=="string"){let s=this._requestManager.transformRequest(m,"Style");n.h(s,new AbortController).then(d=>{this._updateDiff(d.data,e)}).catch(d=>{d&&this.fire(new n.j(d))})}else typeof m=="object"&&this._updateDiff(m,e)}_updateDiff(m,e){try{this.style.setState(m,e)&&this._update(!0)}catch(s){n.w(`Unable to perform style diff: ${s.message||s.error||s}. Rebuilding the style from scratch.`),this._updateStyle(m,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():n.w("There is no style added to the map.")}addSource(m,e){return this._lazyInitEmptyStyle(),this.style.addSource(m,e),this._update(!0)}isSourceLoaded(m){let e=this.style&&this.style.sourceCaches[m];if(e!==void 0)return e.loaded();this.fire(new n.j(new Error(`There is no source with ID '${m}'`)))}setTerrain(m){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),m){let e=this.style.sourceCaches[m.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${m.source}`);this.terrain===null&&e.reload();for(let s in this.style._layers){let d=this.style._layers[s];d.type==="hillshade"&&d.source===m.source&&n.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Qa(this.painter,e,m),this.painter.renderToTexture=new gp(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=s=>{s.dataType==="style"?this.terrain.sourceCache.freeRtt():s.dataType==="source"&&s.tile&&(s.sourceId!==m.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),this.terrain.sourceCache.freeRtt(s.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new n.k("terrain",{terrain:m})),this}getTerrain(){var m,e;return(e=(m=this.terrain)===null||m===void 0?void 0:m.options)!==null&&e!==void 0?e:null}areTilesLoaded(){let m=this.style&&this.style.sourceCaches;for(let e in m){let s=m[e]._tiles;for(let d in s){let p=s[d];if(p.state!=="loaded"&&p.state!=="errored")return!1}}return!0}removeSource(m){return this.style.removeSource(m),this._update(!0)}getSource(m){return this.style.getSource(m)}addImage(m,e,s={}){let{pixelRatio:d=1,sdf:p=!1,stretchX:g,stretchY:v,content:T,textFitWidth:M,textFitHeight:P}=s;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||n.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new n.j(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`")));{let{width:D,height:F,data:O}=e,V=e;return this.style.addImage(m,{data:new n.R({width:D,height:F},new Uint8Array(O)),pixelRatio:d,stretchX:g,stretchY:v,content:T,textFitWidth:M,textFitHeight:P,sdf:p,version:0,userImage:V}),V.onAdd&&V.onAdd(this,m),this}}{let{width:D,height:F,data:O}=E.getImageData(e);this.style.addImage(m,{data:new n.R({width:D,height:F},O),pixelRatio:d,stretchX:g,stretchY:v,content:T,textFitWidth:M,textFitHeight:P,sdf:p,version:0})}}updateImage(m,e){let s=this.style.getImage(m);if(!s)return this.fire(new n.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let d=e instanceof HTMLImageElement||n.b(e)?E.getImageData(e):e,{width:p,height:g,data:v}=d;if(p===void 0||g===void 0)return this.fire(new n.j(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(p!==s.data.width||g!==s.data.height)return this.fire(new n.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));let T=!(e instanceof HTMLImageElement||n.b(e));return s.data.replace(v,T),this.style.updateImage(m,s),this}getImage(m){return this.style.getImage(m)}hasImage(m){return m?!!this.style.getImage(m):(this.fire(new n.j(new Error("Missing required image id"))),!1)}removeImage(m){this.style.removeImage(m)}loadImage(m){return ve.getImage(this._requestManager.transformRequest(m,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(m,e){return this._lazyInitEmptyStyle(),this.style.addLayer(m,e),this._update(!0)}moveLayer(m,e){return this.style.moveLayer(m,e),this._update(!0)}removeLayer(m){return this.style.removeLayer(m),this._update(!0)}getLayer(m){return this.style.getLayer(m)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(m,e,s){return this.style.setLayerZoomRange(m,e,s),this._update(!0)}setFilter(m,e,s={}){return this.style.setFilter(m,e,s),this._update(!0)}getFilter(m){return this.style.getFilter(m)}setPaintProperty(m,e,s,d={}){return this.style.setPaintProperty(m,e,s,d),this._update(!0)}getPaintProperty(m,e){return this.style.getPaintProperty(m,e)}setLayoutProperty(m,e,s,d={}){return this.style.setLayoutProperty(m,e,s,d),this._update(!0)}getLayoutProperty(m,e){return this.style.getLayoutProperty(m,e)}setGlyphs(m,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(m,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(m,e,s={}){return this._lazyInitEmptyStyle(),this.style.addSprite(m,e,s,d=>{d||this._update(!0)}),this}removeSprite(m){return this._lazyInitEmptyStyle(),this.style.removeSprite(m),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(m,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(m,e,s=>{s||this._update(!0)}),this}setLight(m,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(m,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(m,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(m,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(m,e){return this.style.setFeatureState(m,e),this._update()}removeFeatureState(m,e){return this.style.removeFeatureState(m,e),this._update()}getFeatureState(m){return this.style.getFeatureState(m)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let m=0,e=0;return this._container&&(m=this._container.clientWidth||400,e=this._container.clientHeight||300),[m,e]}_setupContainer(){let m=this._container;m.classList.add("maplibregl-map");let e=this._canvasContainer=A.create("div","maplibregl-canvas-container",m);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=A.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let s=this._containerDimensions(),d=this._getClampedPixelRatio(s[0],s[1]);this._resizeCanvas(s[0],s[1],d);let p=this._controlContainer=A.create("div","maplibregl-control-container",m),g=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(v=>{g[v]=A.create("div",`maplibregl-ctrl-${v} `,p)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(m,e,s){this._canvas.width=Math.floor(s*m),this._canvas.height=Math.floor(s*e),this._canvas.style.width=`${m}px`,this._canvas.style.height=`${e}px`}_setupPainter(){let m=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),e=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{e={requestedAttributes:m},d&&(e.statusMessage=d.statusMessage,e.type=d.type)},{once:!0});let s=null;if(s=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,m):this._canvas.getContext("webgl2",m)||this._canvas.getContext("webgl",m),!s){let d="Failed to initialize WebGL";throw e?(e.message=d,new Error(JSON.stringify(e))):new Error(d)}this.painter=new go(s,this.transform),z.testSupport(s)}migrateProjection(m,e){super.migrateProjection(m,e),this.painter.transform=m,this.fire(new n.k("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(m){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||m,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(m){return this._update(),this._renderTaskQueue.add(m)}_cancelRenderFrame(m){this._renderTaskQueue.remove(m)}_render(m){var e,s,d,p,g;let v=this._idleTriggered?this._fadeDuration:0,T=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(m),this._removed)return;let M=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let F=this.transform.zoom,O=E.now();this.style.zoomHistory.update(F,O);let V=new n.z(F,{now:O,fadeDuration:v,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),q=V.crossFadingFactor();q===1&&q===this._crossFadingFactor||(M=!0,this._crossFadingFactor=q),this.style.update(V)}let P=((s=this.style.projection)===null||s===void 0?void 0:s.transitionState)>0!==T;(d=this.style.projection)===null||d===void 0||d.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((p=this.style.projection)===null||p===void 0?void 0:p.transitionState,(g=this.style.projection)===null||g===void 0?void 0:g.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||P)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,v,this._crossSourceCollisions,P),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:v,showPadding:this.showPadding}),this.fire(new n.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,n.cd.mark(n.ce.load),this.fire(new n.k("load"))),this.style&&(this.style.hasTransitions()||M)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let D=this._sourcesDirty||this._styleDirty||this._placementDirty;return D||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new n.k("idle")),!this._loaded||this._fullyLoaded||D||(this._fullyLoaded=!0,n.cd.mark(n.ce.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var m;this._hash&&this._hash.remove();for(let s of this._controls)s.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),ve.removeThrottleControl(this._imageQueueHandle),(m=this._resizeObserver)===null||m===void 0||m.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e?.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),A.remove(this._canvasContainer),A.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),n.cd.clearMetrics(),this._removed=!0,this.fire(new n.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(m=>{n.cd.frame(m),this._frameRequest=null,this._render(m)}).catch(m=>{if(!n.cf(m)&&!function(e){return e.message===Ga}(m))throw m}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(m){this._showTileBoundaries!==m&&(this._showTileBoundaries=m,this._update())}get showPadding(){return!!this._showPadding}set showPadding(m){this._showPadding!==m&&(this._showPadding=m,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(m){this._showCollisionBoxes!==m&&(this._showCollisionBoxes=m,m?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(m){this._showOverdrawInspector!==m&&(this._showOverdrawInspector=m,this._update())}get repaint(){return!!this._repaint}set repaint(m){this._repaint!==m&&(this._repaint=m,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(m){this._vertices=m,this._update()}get version(){return ac}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(m){return this._lazyInitEmptyStyle(),this.style.setProjection(m),this._update(!0)}},c.MapMouseEvent=Zr,c.MapTouchEvent=qr,c.MapWheelEvent=_o,c.Marker=il,c.NavigationControl=class{constructor(m){this._updateZoomButtons=()=>{let e=this._map.getZoom(),s=e===this._map.getMaxZoom(),d=e===this._map.getMinZoom();this._zoomInButton.disabled=s,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",s.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,s)=>{let d=this._map._getUIString(`NavigationControl.${s}`);e.title=d,e.setAttribute("aria-label",d)},this.options=n.e({},Jh,m),this._container=A.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),A.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),A.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=A.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(m){return this._map=m,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Qh(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){A.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.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(m,e){let s=A.create("button",m,this._container);return s.type="button",s.addEventListener("click",e),s}},c.Popup=class extends n.E{constructor(m){super(),this.remove=()=>(this._content&&A.remove(this._content),this._container&&(A.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),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new n.k("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{var s;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=A.create("div","maplibregl-popup",this._map.getContainer()),this._tip=A.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let T of this.options.className.split(" "))this._container.classList.add(T);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?cc(this._lngLat,this._flatPos,this._map.transform):(s=this._lngLat)===null||s===void 0?void 0:s.wrap(),this._trackPointer&&!e)return;let d=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let p=this.options.anchor,g=dc(this.options.offset);if(!p){let T=this._container.offsetWidth,M=this._container.offsetHeight,P;P=d.y+g.bottom.y<M?["top"]:d.y>this._map.transform.height-M?["bottom"]:[],d.x<T/2?P.push("left"):d.x>this._map.transform.width-T/2&&P.push("right"),p=P.length===0?"bottom":P.join("-")}let v=d.add(g[p]);this.options.subpixelPositioning||(v=v.round()),A.setTransform(this._container,`${tl[p]} translate(${v.x}px,${v.y}px)`),hc(this._container,p,"popup")},this._onClose=()=>{this.remove()},this.options=n.e(Object.create(iu),m)}addTo(m){return this._map&&this.remove(),this._map=m,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"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new n.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(m){return this._lngLat=n.N.convert(m),this._pos=null,this._flatPos=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"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(m){return this.setDOMContent(document.createTextNode(m))}setHTML(m){let e=document.createDocumentFragment(),s=document.createElement("body"),d;for(s.innerHTML=m;d=s.firstChild,d;)e.appendChild(d);return this.setDOMContent(e)}getMaxWidth(){var m;return(m=this._container)===null||m===void 0?void 0:m.style.maxWidth}setMaxWidth(m){return this.options.maxWidth=m,this._update(),this}setDOMContent(m){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=A.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(m),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(m){return this._container&&this._container.classList.add(m),this}removeClassName(m){return this._container&&this._container.classList.remove(m),this}setOffset(m){return this.options.offset=m,this._update(),this}toggleClassName(m){if(this._container)return this._container.classList.toggle(m)}setSubpixelPositioning(m){this.options.subpixelPositioning=m}_createCloseButton(){this.options.closeButton&&(this._closeButton=A.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let m=this._container.querySelector(uc);m&&m.focus()}},c.RasterDEMTileSource=$i,c.RasterTileSource=Tr,c.ScaleControl=class{constructor(m){this._onMove=()=>{rl(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,rl(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},tu),m)}getDefaultPosition(){return"bottom-left"}onAdd(m){return this._map=m,this._container=A.create("div","maplibregl-ctrl maplibregl-ctrl-scale",m.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){A.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},c.ScrollZoomHandler=ys,c.Style=ch,c.TerrainControl=class{constructor(m){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=m}onAdd(m){return this._map=m,this._container=A.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=A.create("button","maplibregl-ctrl-terrain",this._container),A.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){A.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},c.TwoFingersTouchPitchHandler=Wh,c.TwoFingersTouchRotateHandler=qh,c.TwoFingersTouchZoomHandler=up,c.TwoFingersTouchZoomRotateHandler=Kh,c.VectorTileSource=Ln,c.VideoSource=rn,c.addSourceType=(m,e)=>n._(void 0,void 0,void 0,function*(){if(Dn(m))throw new Error(`A source type called "${m}" already exists.`);((s,d)=>{nn[s]=d})(m,e)}),c.clearPrewarmedResources=function(){let m=jt;m&&(m.isPreloaded()&&m.numActive()===1?(m.release(qt),jt=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()"))},c.createTileMesh=Zo,c.getMaxParallelImageRequests=function(){return n.a.MAX_PARALLEL_IMAGE_REQUESTS},c.getRTLTextPluginStatus=function(){return on().getRTLTextPluginStatus()},c.getVersion=function(){return ru},c.getWorkerCount=function(){return Ft.workerCount},c.getWorkerUrl=function(){return n.a.WORKER_URL},c.importScriptInWorkers=function(m){return Ai().broadcast("IS",m)},c.prewarm=function(){et().acquire(qt)},c.setMaxParallelImageRequests=function(m){n.a.MAX_PARALLEL_IMAGE_REQUESTS=m},c.setRTLTextPlugin=function(m,e){return on().setRTLTextPlugin(m,e)},c.setWorkerCount=function(m){Ft.workerCount=m},c.setWorkerUrl=function(m){n.a.WORKER_URL=m}});var l=h;return l})});var Bw=Np((T4,Ow)=>{var zw="Expected a function",Dw=NaN,nI="[object Symbol]",sI=/^\s+|\s+$/g,oI=/^[-+]0x[0-9a-f]+$/i,aI=/^0b[01]+$/i,lI=/^0o[0-7]+$/i,cI=parseInt,hI=typeof global=="object"&&global&&global.Object===Object&&global,uI=typeof self=="object"&&self&&self.Object===Object&&self,dI=hI||uI||Function("return this")(),pI=Object.prototype,fI=pI.toString,mI=Math.max,gI=Math.min,T0=function(){return dI.Date.now()};function _I(h,t,r){var l,c,n,x,b,S,R=0,E=!1,A=!1,z=!0;if(typeof h!="function")throw new TypeError(zw);t=Fw(t)||0,$f(r)&&(E=!!r.leading,A="maxWait"in r,n=A?mI(Fw(r.maxWait)||0,t):n,z="trailing"in r?!!r.trailing:z);function W(Re){var tt=l,Je=c;return l=c=void 0,R=Re,x=h.apply(Je,tt),x}function re(Re){return R=Re,b=setTimeout(be,t),E?W(Re):x}function me(Re){var tt=Re-S,Je=Re-R,He=t-tt;return A?gI(He,n-Je):He}function ge(Re){var tt=Re-S,Je=Re-R;return S===void 0||tt>=t||tt<0||A&&Je>=n}function be(){var Re=T0();if(ge(Re))return ve(Re);b=setTimeout(be,me(Re))}function ve(Re){return b=void 0,z&&l?W(Re):(l=c=void 0,x)}function De(){b!==void 0&&clearTimeout(b),R=0,l=S=c=b=void 0}function ke(){return b===void 0?x:ve(T0())}function je(){var Re=T0(),tt=ge(Re);if(l=arguments,c=this,S=Re,tt){if(b===void 0)return re(S);if(A)return b=setTimeout(be,t),W(S)}return b===void 0&&(b=setTimeout(be,t)),x}return je.cancel=De,je.flush=ke,je}function yI(h,t,r){var l=!0,c=!0;if(typeof h!="function")throw new TypeError(zw);return $f(r)&&(l="leading"in r?!!r.leading:l,c="trailing"in r?!!r.trailing:c),_I(h,t,{leading:l,maxWait:t,trailing:c})}function $f(h){var t=typeof h;return!!h&&(t=="object"||t=="function")}function xI(h){return!!h&&typeof h=="object"}function vI(h){return typeof h=="symbol"||xI(h)&&fI.call(h)==nI}function Fw(h){if(typeof h=="number")return h;if(vI(h))return Dw;if($f(h)){var t=typeof h.valueOf=="function"?h.valueOf():h;h=$f(t)?t+"":t}if(typeof h!="string")return h===0?h:+h;h=h.replace(sI,"");var r=aI.test(h);return r||lI.test(h)?cI(h.slice(2),r?2:8):oI.test(h)?Dw:+h}Ow.exports=yI});var Yf={};dg(Yf,{CopyrightControl:()=>Xb,Layer:()=>Wf,MaplibreLayer:()=>Aw,MaplibreStyleLayer:()=>kw,RealtimeAPI:()=>Mu,RealtimeLayer:()=>Vw,RealtimeModes:()=>or,RoutingAPI:()=>Iu,RoutingControl:()=>yw,StopFinderControl:()=>bw,StopsAPI:()=>Eu,VECTOR_TILE_FEATURE_PROPERTY:()=>Bc,VectorLayer:()=>Uw,compareDepartures:()=>Ku,createCanvas:()=>ws,createRealtimeFilters:()=>Pg,debounceDeparturesMessages:()=>T_,debounceWebsocketMessages:()=>Cu,fullTrajectoryDelayStyle:()=>jw,fullTrajectoryStyle:()=>Hf,getCircleCanvas:()=>Cg,getDelayBgCanvas:()=>Sg,getDelayTextCanvas:()=>Tg,getFeatureInfoAtCoordinate:()=>Zw,getHoursAndMinutes:()=>Cv,getLayersAsFlatArray:()=>Ru,getMapGlCopyrights:()=>Pu,getTextCanvas:()=>Mg,getUTCDateString:()=>Sv,getUTCTimeString:()=>Tv,getUrlWithParams:()=>ul,getVehiclePosition:()=>Hu,pad:()=>Up,realtimeConfig:()=>Oc,realtimeDefaultStyle:()=>dl,realtimeDelayStyle:()=>Ig,realtimeSimpleStyle:()=>Eg,removeDuplicate:()=>pl,renderTrajectories:()=>Yu,routingStyle:()=>Gw,sortAndFilterDepartures:()=>Ju,sortByDelay:()=>Rg});var q2=(h,t,r=100)=>{let l={},c={},n=[];return x=>{let{content:b,source:S}=x;l[S]&&window.clearTimeout(l[S]),t?c[t(b)]=b:n.push(b),l[S]=window.setTimeout(()=>{let R=t?Object.values(c):n;h(R)},r)}},Cu=q2;var W2=(h,t)=>h===t.SCHEMATIC?"_schematic":"",bs=W2;var pg=class h{constructor(){this.defineProperties()}static getRequestString(t,r={}){let l=`${t} ${r.channel}`;return l+=r.args?` ${r.args}`:"",l+=r.id?` ${r.id}`:"",l.trim()}addEvents(t,r){this.websocket&&(this.websocket.addEventListener("message",t),r&&(this.websocket.addEventListener("error",r),this.websocket.addEventListener("close",r)))}close(){this.websocket&&(this.open||this.connecting)&&(this.websocket.onclose=()=>{},this.websocket.close(),this.messagesOnOpen=[])}connect(t,r=()=>{}){if(!t){this.websocket?.close();return}if(this.websocket){if(this.websocket.url===t&&(this.open||this.connecting))return;this.websocket.url!==t&&(this.open||this.connecting)&&this.websocket.close()}this.websocket=new WebSocket(t),this.open?(r(),this.subscribePreviousSubscriptions()):this.websocket.addEventListener("open",()=>{r(),this.subscribePreviousSubscriptions()})}defineProperties(){Object.defineProperties(this,{closed:{get:()=>!this.websocket||this.websocket.readyState===this.websocket.CLOSED},closing:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.CLOSING)},connecting:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.CONNECTING)},messagesOnOpen:{value:[],writable:!0},open:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.OPEN)},subscribed:{value:{},writable:!0},subscriptions:{value:[],writable:!0}})}get(t,r,l){let c=h.getRequestString("GET",t);this.send(c);let n=E=>(...A)=>{E(...A);let z=this.requests.findIndex(me=>c===me.requestString&&r===me.cb),{onErrorCb:W,onMessageCb:re}=this.requests[z];this.removeEvents(re,W),this.requests.splice(z,1)},{onErrorCb:x,onMessageCb:b}=this.listen(t,n(r),l&&n(l));this.requests||(this.requests=[]);let S=this.requests.findIndex(E=>c===E.requestString&&r===E.cb),R={cb:r,errorCb:l,onErrorCb:x,onMessageCb:b,params:t,requestString:c};S>-1?this.requests[S]=R:this.requests.push(R)}listen(t,r,l){this.unlisten(t,r);let c=n=>{let x;try{x=JSON.parse(n.data)}catch(R){console.error("WebSocket: unable to parse JSON data",R,n.data);return}let b=t.channel;b+=t.args?` ${t.args}`:"";let S;x.source==="buffer"?S=x.content:S=[x],S.forEach(R=>{R?.source===b&&(!t.id||t.id===x.client_reference)&&r(R)})};return this.addEvents(c,l),{onErrorCb:l,onMessageCb:c}}removeEvents(t,r){this.websocket&&(this.websocket.removeEventListener("message",t),r&&(this.websocket.removeEventListener("error",r),this.websocket.removeEventListener("close",r)))}send(t){if(!this.websocket||this.closed||this.closing)return;let r=()=>{this.websocket?.send(t)};this.open?this.messagesOnOpen.includes(t)||r():this.messagesOnOpen.includes(t)||(this.messagesOnOpen.push(t),this.websocket.addEventListener("open",()=>{this.messagesOnOpen=[],r()}),this.websocket.addEventListener("close",()=>{this.messagesOnOpen=[]}))}subscribe(t,r,l,c=!1){let{onErrorCb:n,onMessageCb:x}=this.listen(t,r,l),b=h.getRequestString("",t),S=this.subscriptions.findIndex(E=>t.channel===E.params.channel&&r===E.cb),R={cb:r,errorCb:l,onErrorCb:n,onMessageCb:x,params:t,quiet:c};S>-1?this.subscriptions[S]=R:this.subscriptions.push(R),this.subscribed[b]||(R.quiet||(this.send(`GET ${b}`),this.send(`SUB ${b}`)),this.subscribed[b]=!0)}subscribePreviousSubscriptions(){Object.keys(this.subscribed).forEach(t=>{this.subscribed[t]=!1}),[...this.subscriptions].forEach(t=>{this.subscribe(t.params,t.cb,t.errorCb,t.quiet)})}unlisten(t,r){[...this.subscriptions||[],...this.requests||[]].filter(l=>l.params.channel===t.channel&&(!r||l.cb===r)).forEach(({onErrorCb:l,onMessageCb:c})=>{this.removeEvents(c,l)})}unsubscribe(t,r){let l=this.subscriptions.filter(c=>c.params.channel===t&&(!r||c.cb===r));l.forEach(({onErrorCb:c,onMessageCb:n})=>{this.removeEvents(n,c)}),this.subscriptions=this.subscriptions.filter(c=>c.params.channel!==t||r&&c.cb!==r),t&&this.subscribed[t]&&!this.subscriptions.find(c=>c.params.channel===t)&&l.find(c=>!c.quiet)&&(this.send(`DEL ${t}`),this.subscribed[t]=!1)}},bv=pg;var or={RAW:"raw",SCHEMATIC:"schematic",TOPOGRAPHIC:"topographic"},fg=class{constructor(t={}){this.version="2";let r=t;typeof t=="string"&&(r={url:t});let{apiKey:l}=r,{url:c}=r,n=new bv,x="";l&&!c?.includes("key=")&&(x=`?key=${l}`),this._url=(c||"wss://api.geops.io/tracker-ws/v1/")+x,this._buffer=r.buffer||[100,100],this._bbox=r.bbox,this.version=r.version||"2",this.pingIntervalMs=r.pingIntervalMs||1e4,this.reconnectTimeoutMs=r.reconnectTimeoutMs||100,this.wsApi=n}get bbox(){return this._bbox}set bbox(t){JSON.stringify(t)!==JSON.stringify(this._bbox)&&(this._bbox=t,this.wsApi&&this._bbox&&this.wsApi.send(`BBOX ${this._bbox.join(" ")}`))}get buffer(){return this._buffer}set buffer(t){JSON.stringify(t)!==JSON.stringify(this._buffer)&&(this._buffer=t,this.wsApi&&this._buffer&&this.wsApi.send(`BUFFER ${this._buffer.join(" ")}`))}get url(){return this._url}set url(t){this._url!==t&&(this._url=t,(this.wsApi.open||this.wsApi.connecting)&&this.open())}close(){this.wsApi.close()}get(t){let r=t;return typeof t=="string"&&(r={channel:t}),new Promise((l,c)=>{this.wsApi.get(r,l,c)})}getFullTrajectory(t,r,l){let c="";this.version==="1"&&(c=bs(r,or));let n=[`full_trajectory${c}`];return t&&n.push(t),(!r||r===or.TOPOGRAPHIC)&&l&&n.push(`gen${l}`),this.get(n.join("_"))}getStation(t,r){let l={args:t,channel:`station${bs(r,or)}`};return this.get(l)}getStations(t,r=100){return new Promise(l=>{this.get(`station${bs(t,or)}`).then(Cu(l,void 0,r))})}getStopSequence(t){return this.get(`stopsequence_${t}`)}getTrajectory(t,r){return this.get(`partial_trajectory${bs(r,or)}_${t}`)}onClose(){window.clearTimeout(this.pingInterval),window.clearTimeout(this.reconnectTimeout),this.reconnectTimeoutMs&&(this.reconnectTimeout=window.setTimeout(()=>this.open(),this.reconnectTimeoutMs))}onOpen(){this.bbox&&this.wsApi.send(`BBOX ${this.bbox.join(" ")}`),this.buffer&&this.wsApi.send(`BUFFER ${this.buffer.join(" ")}`),this.pingIntervalMs&&(window.clearInterval(this.pingInterval),this.pingInterval=window.setInterval(()=>{this.wsApi.send("PING")},this.pingIntervalMs))}open(){this.wsApi.connect(this.url,this.onOpen.bind(this)),this.wsApi.websocket&&(this.wsApi.websocket.onclose=()=>{this.onClose()})}reset(){this.wsApi.send("RESET")}subscribe(t,r,l=()=>{},c=!1){!t||!r||this.wsApi.subscribe({channel:t},r,l,c)}subscribeDeletedVehicles(t,r,l=()=>{},c=!1){this.unsubscribeDeletedVehicles(r);let n="";this.version==="1"&&(n=bs(t,or)),this.subscribe(`deleted_vehicles${n}`,r,l,c)}subscribeDepartures(t,r,l=()=>{},c=!1){this.subscribeTimetable(t,r,l,c)}subscribeDisruptions(t,r,l=()=>{},c=!1){this.subscribeNewsticker(t,r,l,c)}subscribeExtraGeoms(t,r=()=>{},l=!1){this.subscribe("extra_geoms",t,r,l)}subscribeFullTrajectory(t,r,l,c=()=>{},n=!1){let x="";this.version==="1"&&(x=bs(r,or)),this.subscribe(`full_trajectory${x}_${t}`,l,c,n)}subscribeHealthCheck(t,r=()=>{},l=!1){this.subscribe("healthcheck",t,r,l)}subscribeNewsticker(t,r,l=()=>{},c=!1){this.subscribe(`${t}_newsticker`,r,l,c)}subscribeStations(t,r,l=()=>{},c=!1){this.subscribe(`station${bs(t,or)}`,r,l,c)}subscribeStopSequence(t,r,l=()=>{},c=!1){this.subscribe(`stopsequence_${t}`,r,l,c)}subscribeTimetable(t,r,l=()=>{},c=!1){this.subscribe(`timetable_${t}`,r,l,c)}subscribeTrajectory(t,r,l=()=>{},c=!1){this.unsubscribeTrajectory(r);let n="";this.version==="1"&&(n=bs(t,or)),this.subscribe(`trajectory${n}`,r,l,c)}unsubscribe(t,r="",l){let c=bs(or.SCHEMATIC,or),n=bs(or.TOPOGRAPHIC,or);this.wsApi.unsubscribe(`${t}${c}${r||""}`,l),this.wsApi.unsubscribe(`${t}${n}${r||""}`,l)}unsubscribeDeletedVehicles(t){this.unsubscribe("deleted_vehicles","",t)}unsubscribeDepartures(t,r){this.unsubscribeTimetable(t,r)}unsubscribeDisruptions(t,r){this.unsubscribeNewsticker(t,r)}unsubscribeExtraGeoms(t){this.unsubscribe("extra_geoms","",t)}unsubscribeFullTrajectory(t,r){this.unsubscribe("full_trajectory",`_${t}`,r)}unsubscribeHealthCheck(t){this.unsubscribe("healthcheck","",t)}unsubscribeNewsticker(t,r){this.unsubscribe(`${t}_newsticker`,"",r)}unsubscribeStations(t){this.unsubscribe("station","",t)}unsubscribeStopSequence(t,r){this.unsubscribe("stopsequence",`_${t}`,r)}unsubscribeTimetable(t,r){this.unsubscribe(`timetable_${t}`,"",r)}unsubscribeTrajectory(t){this.unsubscribe("trajectory","",t)}},Mu=fg;var $2=(h,t)=>{let r=new URL(h);return Object.entries(t||{}).forEach(([c,n])=>{n!=null&&r.searchParams.set(c,n)}),r},ul=$2;var mg=class{constructor(t){this.url=t.url,this.apiKey=t.apiKey}async fetch(t,r,l){if(!this.url)throw new Error(`No url defined for request to ${this.url}/${t}`);if(!this.url&&!this.apiKey&&!this.url.includes("key="))throw new Error(`No apiKey defined for request to ${this.url}`);let c=r||{},n=ul(`${this.url}${t||""}`,{key:this.apiKey,...c}),b=await(await fetch(n.toString(),l)).json();if(b.error)throw new Error(b.error);return b}},Gp=mg;var gg=class extends Gp{constructor(t={}){super({url:"https://api.geops.io/routing/v1/",...t})}route(t,r){return this.fetch("",t,r)}},Iu=gg;var _g=class extends Gp{constructor(t={}){super({...t,url:t.url||"https://api.geops.io/stops/v1/"})}search(t,r){return this.fetch("",t,r)}},Eu=_g;var X2=(h,t)=>{let r=null;return typeof window>"u"?null:(typeof document<"u"&&document?.createElement?(r=document.createElement("canvas"),r.width=h,r.height=t):OffscreenCanvas?r=new OffscreenCanvas(h,t):console.error("We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported"),r)},ws=X2;var yg={},Sg=(h,t,r)=>{let l=`${h}, ${t}, ${r}`;if(!yg[l]){let c=ws(h*2,h*2);if(c){let n=c.getContext("2d");if(!n)return null;n.beginPath(),n.arc(h,h,t,0,2*Math.PI,!1),n.fillStyle=r,n.filter="blur(1px)",n.fill(),yg[l]=c}}return yg[l]},xg={},Tg=(h,t,r,l,c="#000",n=1)=>{let x=`${h}, ${r}, ${l}, ${c}, ${n}`;if(!xg[x]){let b=ws(Math.ceil(h.length*t),Math.ceil(t+8*n));if(b){let S=b.getContext("2d");if(!S)return null;S.font=r,S.textAlign="left",S.textBaseline="middle",S.font=r,S.fillStyle=l,S.strokeStyle=c,S.lineWidth=1.5*n,S.strokeText(h,0,t),S.fillText(h,0,t),xg[x]=b}}return xg[x]},vg={},Cg=(h,t,r,l,c,n)=>{let x=`${h}, ${t}, ${r}, ${l}, ${c}, ${n}`;if(!vg[x]){let b=ws(h*2,h*2);if(b){let S=b.getContext("2d");if(!S)return null;S.fillStyle=r,l&&(S.lineWidth=1*n,S.strokeStyle="#000000"),S.beginPath(),S.arc(h,h,t,0,2*Math.PI,!1),S.fill(),c&&S.setLineDash([5,3]),l&&S.stroke(),vg[x]=b}}return vg[x]},bg={},Mg=(h,t,r,l,c,n,x,b)=>{let S=`${h}, ${t}, ${r}, ${l},${c}, ${n}, ${x}`;if(!bg[S]){let R=ws(t*2,t*2);if(R){let E=R.getContext("2d");if(!E)return null;n&&(E.save(),E.textBaseline="middle",E.textAlign="center",E.font=b(r+2,h),E.strokeStyle=c,E.strokeText(h,t,t),E.restore()),E.textBaseline="middle",E.textAlign="center",E.fillStyle=l,E.font=b(r,h),E.strokeStyle=c,E.strokeText(h,t,t),E.fillText(h,t,t),bg[S]=R}}return bg[S]},wg={},H2=(h,t,r)=>{let{delayDisplay:l=3e5,delayOutlineColor:c="#000",getBgColor:n=()=>"#000",getDelayColor:x=()=>"#000",getDelayFont:b=jt=>`bold ${jt}px arial, sans-serif`,getDelayText:S=()=>null,getMaxRadiusForStrokeAndDelay:R=()=>7,getMaxRadiusForText:E=()=>10,getRadius:A=()=>0,getText:z=jt=>jt,getTextColor:W=()=>"#000",getTextFont:re=jt=>`bold ${jt}px arial, sans-serif`,getTextSize:me=()=>14,hoverVehicleId:ge,selectedVehicleId:be,useDelayStyle:ve}=r,{pixelRatio:De=1,zoom:ke}=t,{type:je}=h.properties,{delay:Re,line:tt,operator_provides_realtime_journey:Je,state:He,train_id:ot}=h.properties,{color:vt,name:ct,text_color:It}=tt||{};ct=z(ct);let ut=He==="JOURNEY_CANCELLED";je||(je="Rail"),ct||(ct="I"),It||(It="#000000"),vt&&!vt.startsWith("#")&&(vt=`#${vt}`),It.startsWith("#")||(It=`#${It}`);let yt=Math.min(Math.floor(ke||1),16),xt=!!(ge&&ge===ot),dt=!!(be&&be===ot),St=A(je,yt)*De,qt=St>=R()*De;(xt||dt)&&(St=qt?St+5*De:14*De);let Ft=St>E()*De,Pt=`${St}${xt||dt}`;if(ve?(Pt+=`${Je}${Re}`,qt&&(Pt+=`${ut}`)):(Pt+=`${vt||je}`,qt&&(Pt+=`${ut}${Re}`)),Ft&&(Pt+=`${ct}${It}`),!wg[Pt]){if(St===0)return null;let jt=1*De,$t=St+2*De,et=St*2,Bi=$t*2+jt*2,Ai=Bi/2,Ci=null;qt&&Re!==null&&(Ci=Sg(Ai,$t,x(Re,ut)));let en=null,_i=0;if(qt&&(xt||(Re||0)>=l||ut)){_i=Math.max(ut?19:14,Math.min(ut?19:17,St*1.2))*De;let yi=S(Re,ut);yi&&(en=Tg(yi,_i,b(_i,yi),x(Re,ut,!0),c,De))}let ti;ve?ti=x(Re,ut):ti=vt||n(je);let gn=Cg(Ai,St,ti,qt||xt||dt,!!qt&&!!ve&&Re===null&&Je==="yes",De),Ln=Bi+(en?.width||0)*2,$i=ws(Ln,Bi);if($i){let yi=$i.getContext("2d");if(!yi)return null;let Li=en?.width||0;Ci&&yi.drawImage(Ci,Li,0),gn&&yi.drawImage(gn,Li,0);let rn=null;if(Ft){let kn=Math.max(St,10),nn=me(yi,et,ct,kn,re),Dn=ve?"#000000":It||W(je);rn=Mg(ct,Ai,nn,Dn,ti,!!ve&&Re===null&&Je==="yes",De,re)}rn&&yi.drawImage(rn,Li,0),en&&yi.drawImage(en,Li+Math.ceil(Ai+$t)+jt,Math.ceil(Ai-_i)),wg[Pt]=$i}}return wg[Pt]},dl=H2;var Y2=(h,t,r)=>dl(h,t,{...r,useDelayStyle:!0}),Ig=Y2;var Vp,K2=()=>{if(!Vp){Vp=ws(15,15);let h=Vp?.getContext("2d");h&&(h.arc(8,8,5,0,2*Math.PI,!1),h.fillStyle="#8ED6FF",h.fill(),h.lineWidth=3,h.strokeStyle="black",h.stroke(),h.lineWidth=3)}return Vp},Eg=K2;var J2=h=>{let t=h.filter(n=>n!=null&&n.trim&&n.trim()),r=t.map(n=>n.toLowerCase());return[...new Set(r)].map(n=>t.find(x=>x.toLowerCase()===n))},pl=J2;var Q2=h=>{if(!h)return[];let{style:t}=h;if(!t)return[];let{sourceCaches:r}=t,l=[];return Object.values(r).forEach(c=>{if(c.used){let n=c.getSource(),x=n.attribution||n.options?.attribution;x&&(l=l.concat(x.replace(/&copy;/g,"\xA9").split(/(<a.*?<\/a>)/)))}}),pl(l)},Pu=Q2;var eT=(h,t,r,l)=>{let c=[];if(!h&&!t&&!r&&!l)return null;if(l){let n=typeof l=="string"?[l]:l,x=b=>{let S=b.properties.name||b.properties.line&&b.properties.line.name||"";return S?n.some(R=>new RegExp(R,"i").test(S)):!1};c.push(x)}if(h){let x=(typeof h=="string"?h.split(","):h).map(S=>S.replace(/\s+/g,"").toUpperCase()),b=S=>{let{line:R,name:E}=S.properties,A=(E||R&&R.name||"").toUpperCase();return A?x.includes(A):!1};c.push(b)}if(t){let x=(typeof t=="string"?t.split(","):t).map(S=>parseInt(S,10)),b=S=>{let R=S.properties.route_identifier||S.properties.routeIdentifier||"",E=parseInt(R.split(".")[0],10);return x.includes(E)};c.push(b)}if(r){let n=typeof r=="string"?[r]:r,x=b=>n.some(S=>{let R=b.properties.operator||b.properties.tenant||"";return new RegExp(S,"i").test(R)});c.push(x)}return c.length?n=>{for(let x=0;x<c.length;x+=1)if(!c[x](n))return!1;return!0}:null},Pg=eT;var wv=h=>{let t=h;Array.isArray(t)||(t=[h]);let r=[];return t.forEach(l=>{r.push(l);let c=l.children||l.get("children")||l.getLayers?.()?.getArray();r=r.concat(wv(c||[]))}),r},Ru=wv;var Sv=(h=new Date)=>{let t=(h.getUTCMonth()+1).toString();t=t.length===1?`0${t}`:t;let r=h.getUTCDate().toString();return r=r.length===1?`0${r}`:r,[h.getUTCFullYear(),t,r].join("")},Tv=h=>[h.getUTCHours(),h.getUTCMinutes(),`${h.getUTCSeconds()}.${h.getUTCMilliseconds()}`].join(":"),Up=h=>h<10?`0${h}`:`${h}`,Cv=h=>{if(!h||h<=0)return"";let t=new Date(h);return`${Up(t.getHours())}:${Up(t.getMinutes())}`};var tT=(h,t)=>{let r=h.properties,l=t.properties;return r.delay===null&&l.delay!==null?1:l.delay===null&&r.delay!==null?-1:r.cancelled&&!l.cancelled?l.delay<18e4?-1:1:l.cancelled&&!r.cancelled?r.delay<18e4?1:-1:l.delay-r.delay},Rg=tT;function di(h,t){if(!h)throw new Error(t)}var OE=new Array(6);function yr(){return[1,0,0,1,0,0]}function Iv(h,t){return h[0]=t[0],h[1]=t[1],h[2]=t[2],h[3]=t[3],h[4]=t[4],h[5]=t[5],h}function Ar(h,t){let r=t[0],l=t[1];return t[0]=h[0]*r+h[2]*l+h[4],t[1]=h[1]*r+h[3]*l+h[5],t}function Yr(h,t,r,l,c,n,x,b){let S=Math.sin(n),R=Math.cos(n);return h[0]=l*R,h[1]=c*S,h[2]=-l*S,h[3]=c*R,h[4]=x*l*R-b*l*S+t,h[5]=x*c*S+b*c*R+r,h}function Ev(h,t,r,l,c,n,x){return Ag(Yr(yr(),h,t,r,l,c,n,x))}function Pv(h,t){let r=iT(t);di(r!==0,"Transformation matrix cannot be inverted");let l=t[0],c=t[1],n=t[2],x=t[3],b=t[4],S=t[5];return h[0]=x/r,h[1]=-c/r,h[2]=-n/r,h[3]=l/r,h[4]=(n*S-x*b)/r,h[5]=-(l*S-c*b)/r,h}function iT(h){return h[0]*h[3]-h[1]*h[2]}var Mv=[1e6,1e6,1e6,1e6,2,2];function Ag(h){return"matrix("+h.map((r,l)=>Math.round(r*Mv[l])/Mv[l]).join(", ")+")"}var Lg=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Ei=Lg;var Zp={PROPERTYCHANGE:"propertychange"};var kg=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},Rv=kg;function Av(h,t,r){let l,c;r=r||Ss;let n=0,x=h.length,b=!1;for(;n<x;)l=n+(x-n>>1),c=+r(h[l],t),c<0?n=l+1:(x=l,b=!c);return b?n:~n}function Ss(h,t){return h>t?1:h<t?-1:0}function Lv(h,t){return h<t?1:h>t?-1:0}function qp(h,t,r){if(h[0]<=t)return 0;let l=h.length;if(t<=h[l-1])return l-1;if(typeof r=="function"){for(let c=1;c<l;++c){let n=h[c];if(n===t)return c;if(n<t)return r(t,h[c-1],n)>0?c-1:c}return l-1}if(r>0){for(let c=1;c<l;++c)if(h[c]<t)return c-1;return l-1}if(r<0){for(let c=1;c<l;++c)if(h[c]<=t)return c;return l-1}for(let c=1;c<l;++c){if(h[c]==t)return c;if(h[c]<t)return h[c-1]-t<t-h[c]?c-1:c}return l-1}function kv(h,t,r){for(;t<r;){let l=h[t];h[t]=h[r],h[r]=l,++t,--r}}function Lr(h,t){let r=Array.isArray(t)?t:[t],l=r.length;for(let c=0;c<l;c++)h[h.length]=r[c]}function vn(h,t){let r=h.length;if(r!==t.length)return!1;for(let l=0;l<r;l++)if(h[l]!==t[l])return!1;return!0}function Wp(){return!0}function Ts(){}function $p(h){let t,r,l;return function(){let c=Array.prototype.slice.call(arguments);return(!r||this!==l||!vn(c,r))&&(l=this,r=c,t=h.apply(this,arguments)),t}}function Tc(h){for(let t in h)delete h[t]}function Xn(h){let t;for(t in h)return!1;return!t}var Dg=class extends Rv{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,r){if(!t||!r)return;let l=this.listeners_||(this.listeners_={}),c=l[t]||(l[t]=[]);c.includes(r)||c.push(r)}dispatchEvent(t){let r=typeof t=="string",l=r?t:t.type,c=this.listeners_&&this.listeners_[l];if(!c)return;let n=r?new Ei(t):t;n.target||(n.target=this.eventTarget_||this);let x=this.dispatching_||(this.dispatching_={}),b=this.pendingRemovals_||(this.pendingRemovals_={});l in x||(x[l]=0,b[l]=0),++x[l];let S;for(let R=0,E=c.length;R<E;++R)if("handleEvent"in c[R]?S=c[R].handleEvent(n):S=c[R].call(this,n),S===!1||n.propagationStopped){S=!1;break}if(--x[l]===0){let R=b[l];for(delete b[l];R--;)this.removeEventListener(l,Ts);delete x[l]}return S}disposeInternal(){this.listeners_&&Tc(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,r){if(!this.listeners_)return;let l=this.listeners_[t];if(!l)return;let c=l.indexOf(r);c!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(l[c]=Ts,++this.pendingRemovals_[t]):(l.splice(c,1),l.length===0&&delete this.listeners_[t]))}},Xp=Dg;var gi={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function kr(h,t,r,l,c){if(c){let x=r;r=function(){h.removeEventListener(t,r),x.apply(l??this,arguments)}}else l&&l!==h&&(r=r.bind(l));let n={target:h,type:t,listener:r};return h.addEventListener(t,r),n}function Fg(h,t,r,l){return kr(h,t,r,l,!0)}function Kr(h){h&&h.target&&(h.target.removeEventListener(h.type,h.listener),Tc(h))}var Cc=class extends Xp{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(gi.CHANGE)}getRevision(){return this.revision_}onInternal(t,r){if(Array.isArray(t)){let l=t.length,c=new Array(l);for(let n=0;n<l;++n)c[n]=kr(this,t[n],r);return c}return kr(this,t,r)}onceInternal(t,r){let l;if(Array.isArray(t)){let c=t.length;l=new Array(c);for(let n=0;n<c;++n)l[n]=Fg(this,t[n],r)}else l=Fg(this,t,r);return r.ol_key=l,l}unInternal(t,r){let l=r.ol_key;if(l)Cs(l);else if(Array.isArray(t))for(let c=0,n=t.length;c<n;++c)this.removeEventListener(t[c],r);else this.removeEventListener(t,r)}};Cc.prototype.on;Cc.prototype.once;Cc.prototype.un;function Cs(h){if(Array.isArray(h))for(let t=0,r=h.length;t<r;++t)Kr(h[t]);else Kr(h)}var Hp=Cc;function Tt(){throw new Error("Unimplemented abstract method.")}var rT=0;function Gt(h){return h.ol_uid||(h.ol_uid=String(++rT))}var Yp=class extends Ei{constructor(t,r,l){super(t),this.key=r,this.oldValue=l}},zg=class extends Hp{constructor(t){super(),this.on,this.once,this.un,Gt(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let r;return this.values_&&this.values_.hasOwnProperty(t)&&(r=this.values_[t]),r}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,r){let l;l=`change:${t}`,this.hasListener(l)&&this.dispatchEvent(new Yp(l,t,r)),l=Zp.PROPERTYCHANGE,this.hasListener(l)&&this.dispatchEvent(new Yp(l,t,r))}addChangeListener(t,r){this.addEventListener(`change:${t}`,r)}removeChangeListener(t,r){this.removeEventListener(`change:${t}`,r)}set(t,r,l){let c=this.values_||(this.values_={});if(l)c[t]=r;else{let n=c[t];c[t]=r,n!==r&&this.notify(t,n)}}setProperties(t,r){for(let l in t)this.set(l,t[l],r)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,r){if(this.values_&&t in this.values_){let l=this.values_[t];delete this.values_[t],Xn(this.values_)&&(this.values_=null),r||this.notify(t,l)}}},xr=zg;var Qi={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function hs(h){let t=wn();for(let r=0,l=h.length;r<l;++r)Og(t,h[r]);return t}function nT(h,t,r){let l=Math.min.apply(null,h),c=Math.min.apply(null,t),n=Math.max.apply(null,h),x=Math.max.apply(null,t);return Io(l,c,n,x,r)}function us(h,t,r){return r?(r[0]=h[0]-t,r[1]=h[1]-t,r[2]=h[2]+t,r[3]=h[3]+t,r):[h[0]-t,h[1]-t,h[2]+t,h[3]+t]}function Dv(h,t){return t?(t[0]=h[0],t[1]=h[1],t[2]=h[2],t[3]=h[3],t):h.slice()}function bn(h,t,r){let l,c;return t<h[0]?l=h[0]-t:h[2]<t?l=t-h[2]:l=0,r<h[1]?c=h[1]-r:h[3]<r?c=r-h[3]:c=0,l*l+c*c}function fl(h,t){return Au(h,t[0],t[1])}function Mo(h,t){return h[0]<=t[0]&&t[2]<=h[2]&&h[1]<=t[1]&&t[3]<=h[3]}function Au(h,t,r){return h[0]<=t&&t<=h[2]&&h[1]<=r&&r<=h[3]}function Kp(h,t){let r=h[0],l=h[1],c=h[2],n=h[3],x=t[0],b=t[1],S=Qi.UNKNOWN;return x<r?S=S|Qi.LEFT:x>c&&(S=S|Qi.RIGHT),b<l?S=S|Qi.BELOW:b>n&&(S=S|Qi.ABOVE),S===Qi.UNKNOWN&&(S=Qi.INTERSECTING),S}function wn(){return[1/0,1/0,-1/0,-1/0]}function Io(h,t,r,l,c){return c?(c[0]=h,c[1]=t,c[2]=r,c[3]=l,c):[h,t,r,l]}function Mc(h){return Io(1/0,1/0,-1/0,-1/0,h)}function la(h,t){let r=h[0],l=h[1];return Io(r,l,r,l,t)}function Ic(h,t,r,l,c){let n=Mc(c);return Bg(n,h,t,r,l)}function Jp(h,t){return h[0]==t[0]&&h[2]==t[2]&&h[1]==t[1]&&h[3]==t[3]}function Fv(h,t){return t[0]<h[0]&&(h[0]=t[0]),t[2]>h[2]&&(h[2]=t[2]),t[1]<h[1]&&(h[1]=t[1]),t[3]>h[3]&&(h[3]=t[3]),h}function Og(h,t){t[0]<h[0]&&(h[0]=t[0]),t[0]>h[2]&&(h[2]=t[0]),t[1]<h[1]&&(h[1]=t[1]),t[1]>h[3]&&(h[3]=t[1])}function Bg(h,t,r,l,c){for(;r<l;r+=c)sT(h,t[r],t[r+1]);return h}function sT(h,t,r){h[0]=Math.min(h[0],t),h[1]=Math.min(h[1],r),h[2]=Math.max(h[2],t),h[3]=Math.max(h[3],r)}function zv(h,t){let r;return r=t(jg(h)),r||(r=t(Ng(h)),r)||(r=t(Vg(h)),r)||(r=t(Gg(h)),r)?r:!1}function jg(h){return[h[0],h[1]]}function Ng(h){return[h[2],h[1]]}function ds(h){return[(h[0]+h[2])/2,(h[1]+h[3])/2]}function Ov(h,t,r,l,c){let[n,x,b,S,R,E,A,z]=oT(h,t,r,l);return Io(Math.min(n,b,R,A),Math.min(x,S,E,z),Math.max(n,b,R,A),Math.max(x,S,E,z),c)}function oT(h,t,r,l){let c=t*l[0]/2,n=t*l[1]/2,x=Math.cos(r),b=Math.sin(r),S=c*x,R=c*b,E=n*x,A=n*b,z=h[0],W=h[1];return[z-S+A,W-R-E,z-S-A,W-R+E,z+S-A,W+R+E,z+S+A,W+R-E,z-S+A,W-R-E]}function ar(h){return h[3]-h[1]}function Gg(h){return[h[0],h[3]]}function Vg(h){return[h[2],h[3]]}function Ti(h){return h[2]-h[0]}function er(h,t){return h[0]<=t[2]&&h[2]>=t[0]&&h[1]<=t[3]&&h[3]>=t[1]}function Lu(h){return h[2]<h[0]||h[3]<h[1]}function Bv(h,t){return t?(t[0]=h[0],t[1]=h[1],t[2]=h[2],t[3]=h[3],t):h}function jv(h,t,r){let l=!1,c=Kp(h,t),n=Kp(h,r);if(c===Qi.INTERSECTING||n===Qi.INTERSECTING)l=!0;else{let x=h[0],b=h[1],S=h[2],R=h[3],E=t[0],A=t[1],z=r[0],W=r[1],re=(W-A)/(z-E),me,ge;n&Qi.ABOVE&&!(c&Qi.ABOVE)&&(me=z-(W-R)/re,l=me>=x&&me<=S),!l&&n&Qi.RIGHT&&!(c&Qi.RIGHT)&&(ge=W-(z-S)*re,l=ge>=b&&ge<=R),!l&&n&Qi.BELOW&&!(c&Qi.BELOW)&&(me=z-(W-b)/re,l=me>=x&&me<=S),!l&&n&Qi.LEFT&&!(c&Qi.LEFT)&&(ge=W-(z-x)*re,l=ge>=b&&ge<=R)}return l}function Nv(h,t,r,l){if(Lu(h))return Mc(r);let c=[];if(l>1){let b=h[2]-h[0],S=h[3]-h[1];for(let R=0;R<l;++R)c.push(h[0]+b*R/l,h[1],h[2],h[1]+S*R/l,h[2]-b*R/l,h[3],h[0],h[3]-S*R/l)}else c=[h[0],h[1],h[2],h[1],h[2],h[3],h[0],h[3]];t(c,c,2);let n=[],x=[];for(let b=0,S=c.length;b<S;b+=2)n.push(c[b]),x.push(c[b+1]);return nT(n,x,r)}function Ug(h,t){let r=t.getExtent(),l=ds(h);if(t.canWrapX()&&(l[0]<r[0]||l[0]>=r[2])){let c=Ti(r),x=Math.floor((l[0]-r[0])/c)*c;h[0]-=x,h[2]-=x}return h}function Gv(h,t,r){if(t.canWrapX()){let l=t.getExtent();if(!isFinite(h[0])||!isFinite(h[2]))return[[l[0],h[1],l[2],h[3]]];Ug(h,t);let c=Ti(l);if(Ti(h)>c&&!r)return[[l[0],h[1],l[2],h[3]]];if(h[0]<l[0])return[[h[0]+c,h[1],l[2],h[3]],[l[0],h[1],h[2],h[3]]];if(h[2]>l[2])return[[h[0],h[1],l[2],h[3]],[l[0],h[1],h[2]-c,h[3]]]}return[h]}var ku={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var Zg=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||ku[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!!(t&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!!(this.global_&&t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}},Ec=Zg;var Du=6378137,Pc=Math.PI*Du,aT=[-Pc,-Pc,Pc,Pc],lT=[-180,-85,180,85],Qp=Du*Math.log(Math.tan(Math.PI/2)),ca=class extends Ec{constructor(t){super({code:t,units:"m",extent:aT,global:!0,worldExtent:lT,getPointResolution:function(r,l){return r/Math.cosh(l[1]/Du)}})}},qg=[new ca("EPSG:3857"),new ca("EPSG:102100"),new ca("EPSG:102113"),new ca("EPSG:900913"),new ca("http://www.opengis.net/def/crs/EPSG/0/3857"),new ca("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Vv(h,t,r,l){let c=h.length;r=r>1?r:2,l=l??r,t===void 0&&(r>2?t=h.slice():t=new Array(c));for(let n=0;n<c;n+=l){t[n]=Pc*h[n]/180;let x=Du*Math.log(Math.tan(Math.PI*(+h[n+1]+90)/360));x>Qp?x=Qp:x<-Qp&&(x=-Qp),t[n+1]=x}return t}function Uv(h,t,r,l){let c=h.length;r=r>1?r:2,l=l??r,t===void 0&&(r>2?t=h.slice():t=new Array(c));for(let n=0;n<c;n+=l)t[n]=180*h[n]/Pc,t[n+1]=360*Math.atan(Math.exp(h[n+1]/Du))/Math.PI-90;return t}var cT=6378137,Zv=[-180,-90,180,90],hT=Math.PI*cT/180,Eo=class extends Ec{constructor(t,r){super({code:t,units:"degrees",extent:Zv,axisOrientation:r,global:!0,metersPerUnit:hT,worldExtent:Zv})}},Wg=[new Eo("CRS:84"),new Eo("EPSG:4326","neu"),new Eo("urn:ogc:def:crs:OGC:1.3:CRS84"),new Eo("urn:ogc:def:crs:OGC:2:84"),new Eo("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Eo("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Eo("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var $g={};function qv(h){return $g[h]||$g[h.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Wv(h,t){$g[h]=t}var Rc={};function Ac(h,t,r){let l=h.getCode(),c=t.getCode();l in Rc||(Rc[l]={}),Rc[l][c]=r}function ef(h,t){return h in Rc&&t in Rc[h]?Rc[h][t]:null}function Pi(h,t,r){return Math.min(Math.max(h,t),r)}function $v(h,t,r,l,c,n){let x=c-r,b=n-l;if(x!==0||b!==0){let S=((h-r)*x+(t-l)*b)/(x*x+b*b);S>1?(r=c,l=n):S>0&&(r+=x*S,l+=b*S)}return Ms(h,t,r,l)}function Ms(h,t,r,l){let c=r-h,n=l-t;return c*c+n*n}function Fu(h){return h*180/Math.PI}function ml(h){return h*Math.PI/180}function gl(h,t){let r=h%t;return r*t<0?r+t:r}function Dr(h,t,r){return h+r*(t-h)}function Xv(h,t){let r=Math.pow(10,t);return Math.round(h*r)/r}function tf(h,t,r){if(h>=t&&h<r)return h;let l=r-t;return((h-t)%l+l)%l+t}function Hv(h,t){return h[0]+=+t[0],h[1]+=+t[1],h}function Xg(h,t){let r=h[0],l=h[1],c=t[0],n=t[1],x=c[0],b=c[1],S=n[0],R=n[1],E=S-x,A=R-b,z=E===0&&A===0?0:(E*(r-x)+A*(l-b))/(E*E+A*A||0),W,re;return z<=0?(W=x,re=b):z>=1?(W=S,re=R):(W=x+z*E,re=b+z*A),[W,re]}function lr(h,t){let r=!0;for(let l=h.length-1;l>=0;--l)if(h[l]!=t[l]){r=!1;break}return r}function Yv(h,t){let r=Math.cos(t),l=Math.sin(t),c=h[0]*r-h[1]*l,n=h[1]*r+h[0]*l;return h[0]=c,h[1]=n,h}function Lc(h,t){let r=h[0]-t[0],l=h[1]-t[1];return r*r+l*l}function Hg(h,t){return Math.sqrt(Lc(h,t))}function Kv(h,t){return Lc(h,Xg(h,t))}function Jv(h,t){if(t.canWrapX()){let r=Ti(t.getExtent()),l=Qv(h,t,r);l&&(h[0]-=l*r)}return h}function Qv(h,t,r){let l=t.getExtent(),c=0;return t.canWrapX()&&(h[0]<l[0]||h[0]>l[2])&&(r=r||Ti(l),c=Math.floor((h[0]-l[0])/r)),c}var rf=.9996,ps=.00669438,sf=ps*ps,of=sf*ps,_l=ps/(1-ps),eb=Math.sqrt(1-ps),kc=(1-eb)/(1+eb),nb=kc*kc,Yg=nb*kc,Kg=Yg*kc,sb=Kg*kc,ob=1-ps/4-3*sf/64-5*of/256,uT=3*ps/8+3*sf/32+45*of/1024,dT=15*sf/256+45*of/1024,pT=35*of/3072,fT=3/2*kc-27/32*Yg+269/512*sb,mT=21/16*nb-55/32*Kg,gT=151/96*Yg-417/128*sb,_T=1097/512*Kg,nf=6378137;function yT(h,t,r){let l=h-5e5,x=(r.north?t:t-1e7)/rf/(nf*ob),b=x+fT*Math.sin(2*x)+mT*Math.sin(4*x)+gT*Math.sin(6*x)+_T*Math.sin(8*x),S=Math.sin(b),R=S*S,E=Math.cos(b),A=S/E,z=A*A,W=z*z,re=1-ps*R,me=Math.sqrt(1-ps*R),ge=nf/me,be=(1-ps)/re,ve=_l*E**2,De=ve*ve,ke=l/(ge*rf),je=ke*ke,Re=je*ke,tt=Re*ke,Je=tt*ke,He=Je*ke,ot=b-A/be*(je/2-tt/24*(5+3*z+10*ve-4*De-9*_l))+He/720*(61+90*z+298*ve+45*W-252*_l-3*De),vt=(ke-Re/6*(1+2*z+ve)+Je/120*(5-2*ve+28*z-3*De+8*_l+24*W))/E;return vt=tf(vt+ml(ab(r.number)),-Math.PI,Math.PI),[Fu(vt),Fu(ot)]}var tb=-80,ib=84,xT=-180,vT=180;function bT(h,t,r){h=tf(h,xT,vT),t<tb?t=tb:t>ib&&(t=ib);let l=ml(t),c=Math.sin(l),n=Math.cos(l),x=c/n,b=x*x,S=b*b,R=ml(h),E=ab(r.number),A=ml(E),z=nf/Math.sqrt(1-ps*c**2),W=_l*n**2,re=n*tf(R-A,-Math.PI,Math.PI),me=re*re,ge=me*re,be=ge*re,ve=be*re,De=ve*re,ke=nf*(ob*l-uT*Math.sin(2*l)+dT*Math.sin(4*l)-pT*Math.sin(6*l)),je=rf*z*(re+ge/6*(1-b+W)+ve/120*(5-18*b+S+72*W-58*_l))+5e5,Re=rf*(ke+z*x*(me/2+be/24*(5-b+9*W+4*W**2)+De/720*(61-58*b+S+600*W-330*_l)));return r.north||(Re+=1e7),[je,Re]}function ab(h){return(h-1)*6-180+3}var wT=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function lb(h){let t=0;for(let c of wT){let n=h.match(c);if(n){t=parseInt(n[1]);break}}if(!t)return null;let r=0,l=!1;return t>32700&&t<32761?r=t-32700:t>32600&&t<32661&&(l=!0,r=t-32600),r?{number:r,north:l}:null}function rb(h,t){return function(r,l,c,n){let x=r.length;c=c>1?c:2,n=n??c,l||(c>2?l=r.slice():l=new Array(x));for(let b=0;b<x;b+=n){let S=r[b],R=r[b+1],E=h(S,R,t);l[b]=E[0],l[b+1]=E[1]}return l}}function cb(h){return lb(h)?new Ec({code:h,units:"m"}):null}function hb(h){let t=lb(h.getCode());return t?{forward:rb(bT,t),inverse:rb(yT,t)}:null}var ub={info:1,warn:2,error:3,none:4},ST=ub.info;function db(...h){ST>ub.warn||console.warn(...h)}var TT=[hb],CT=[cb];var Qg=!0;function t_(h){Qg=!(h===void 0?!0:h)}function i_(h,t){if(t!==void 0){for(let r=0,l=h.length;r<l;++r)t[r]=h[r];t=t}else t=h.slice();return t}function e_(h){Wv(h.getCode(),h),Ac(h,h,i_)}function MT(h){h.forEach(e_)}function Ri(h){if(typeof h!="string")return h;let t=qv(h);if(t)return t;for(let r of CT){let l=r(h);if(l)return l}return null}function pb(h){MT(h),h.forEach(function(t){h.forEach(function(r){t!==r&&Ac(t,r,i_)})})}function IT(h,t,r,l){h.forEach(function(c){t.forEach(function(n){Ac(c,n,r),Ac(n,c,l)})})}function af(h,t){return h?typeof h=="string"?Ri(h):h:Ri(t)}function vr(h,t){return t_(),lf(h,"EPSG:4326",t!==void 0?t:"EPSG:3857")}function yl(h,t){let r=lf(h,t!==void 0?t:"EPSG:3857","EPSG:4326"),l=r[0];return(l<-180||l>180)&&(r[0]=gl(l+180,360)-180),r}function fb(h,t){if(h===t)return!0;let r=h.getUnits()===t.getUnits();return(h.getCode()===t.getCode()||Dc(h,t)===i_)&&r}function Dc(h,t){let r=h.getCode(),l=t.getCode(),c=ef(r,l);if(c)return c;let n=null,x=null;for(let S of TT)n||(n=S(h)),x||(x=S(t));if(!n&&!x)return null;let b="EPSG:4326";if(x)if(n)c=Jg(n.inverse,x.forward);else{let S=ef(r,b);S&&(c=Jg(S,x.forward))}else{let S=ef(b,l);S&&(c=Jg(n.inverse,S))}return c&&(e_(h),e_(t),Ac(h,t,c)),c}function Jg(h,t){return function(r,l,c,n){return l=h(r,l,c,n),t(l,l,c,n)}}function xl(h,t){let r=Ri(h),l=Ri(t);return Dc(r,l)}function lf(h,t,r){let l=xl(t,r);if(!l){let c=Ri(t).getCode(),n=Ri(r).getCode();throw new Error(`No transform available between ${c} and ${n}`)}return l(h,void 0,h.length)}function r_(h,t,r,l){let c=xl(t,r);return Nv(h,c,void 0,l)}var Is=null;function Hn(){return Is}function ha(h,t){return Is?lf(h,t,Is):h}function Di(h,t){return Is?lf(h,Is,t):(Qg&&!lr(h,[0,0])&&h[0]>=-180&&h[0]<=180&&h[1]>=-90&&h[1]<=90&&(Qg=!1,db("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),h)}function Zs(h,t){return Is?r_(h,t,Is):h}function qs(h,t){return Is?r_(h,Is,t):h}function mb(h,t){if(!Is)return h;let r=Ri(t).getMetersPerUnit(),l=Is.getMetersPerUnit();return r&&l?h*r/l:h}function ET(){pb(qg),pb(Wg),IT(Wg,qg,Vv,Uv)}ET();function Sn(h,t,r,l,c,n,x){n=n||[],x=x||2;let b=0;for(let S=t;S<r;S+=l){let R=h[S],E=h[S+1];n[b++]=c[0]*R+c[2]*E+c[4],n[b++]=c[1]*R+c[3]*E+c[5];for(let A=2;A<x;A++)n[b++]=h[S+A]}return n&&n.length!=b&&(n.length=b),n}function cf(h,t,r,l,c,n,x){x=x||[];let b=Math.cos(c),S=Math.sin(c),R=n[0],E=n[1],A=0;for(let z=t;z<r;z+=l){let W=h[z]-R,re=h[z+1]-E;x[A++]=R+W*b-re*S,x[A++]=E+W*S+re*b;for(let me=z+2;me<z+l;++me)x[A++]=h[me]}return x&&x.length!=A&&(x.length=A),x}function gb(h,t,r,l,c,n,x,b){b=b||[];let S=x[0],R=x[1],E=0;for(let A=t;A<r;A+=l){let z=h[A]-S,W=h[A+1]-R;b[E++]=S+c*z,b[E++]=R+n*W;for(let re=A+2;re<A+l;++re)b[E++]=h[re]}return b&&b.length!=E&&(b.length=E),b}function _b(h,t,r,l,c,n,x){x=x||[];let b=0;for(let S=t;S<r;S+=l){x[b++]=h[S]+c,x[b++]=h[S+1]+n;for(let R=S+2;R<S+l;++R)x[b++]=h[R]}return x&&x.length!=b&&(x.length=b),x}var yb=yr(),n_=class extends xr{constructor(){super(),this.extent_=wn(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=$p((t,r,l)=>{if(!l)return this.getSimplifiedGeometry(r);let c=this.clone();return c.applyTransform(l),c.getSimplifiedGeometry(r)})}simplifyTransformed(t,r){return this.simplifyTransformedInternal(this.getRevision(),t,r)}clone(){return Tt()}closestPointXY(t,r,l,c){return Tt()}containsXY(t,r){let l=this.getClosestPoint([t,r]);return l[0]===t&&l[1]===r}getClosestPoint(t,r){return r=r||[NaN,NaN],this.closestPointXY(t[0],t[1],r,1/0),r}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return Tt()}getExtent(t){if(this.extentRevision_!=this.getRevision()){let r=this.computeExtent(this.extent_);(isNaN(r[0])||isNaN(r[1]))&&Mc(r),this.extentRevision_=this.getRevision()}return Bv(this.extent_,t)}rotate(t,r){Tt()}scale(t,r,l){Tt()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return Tt()}getType(){return Tt()}applyTransform(t){Tt()}intersectsExtent(t){return Tt()}translate(t,r){Tt()}transform(t,r){let l=Ri(t),c=l.getUnits()=="tile-pixels"?function(n,x,b){let S=l.getExtent(),R=l.getWorldExtent(),E=ar(R)/ar(S);Yr(yb,R[0],R[3],E,-E,0,0,0);let A=Sn(n,0,n.length,b,yb,x),z=xl(l,r);return z?z(A,A,b):A}:xl(l,r);return this.applyTransform(c),this}},hf=n_;var s_=class extends hf{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Ic(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return Tt()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let r=this.getSimplifiedGeometryInternal(t);return r.getFlatCoordinates().length<this.flatCoordinates.length?r:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,r){this.stride=xb(t),this.layout=t,this.flatCoordinates=r}setCoordinates(t,r){Tt()}setLayout(t,r,l){let c;if(t)c=xb(t);else{for(let n=0;n<l;++n){if(r.length===0){this.layout="XY",this.stride=2;return}r=r[0]}c=r.length,t=ua(c)}this.layout=t,this.stride=c}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,r){let l=this.getFlatCoordinates();if(l){let c=this.getStride();cf(l,0,l.length,c,t,r,l),this.changed()}}scale(t,r,l){r===void 0&&(r=t),l||(l=ds(this.getExtent()));let c=this.getFlatCoordinates();if(c){let n=this.getStride();gb(c,0,c.length,n,t,r,l,c),this.changed()}}translate(t,r){let l=this.getFlatCoordinates();if(l){let c=this.getStride();_b(l,0,l.length,c,t,r,l),this.changed()}}};function ua(h){let t;return h==2?t="XY":h==3?t="XYZ":h==4&&(t="XYZM"),t}function xb(h){let t;return h=="XY"?t=2:h=="XYZ"||h=="XYM"?t=3:h=="XYZM"&&(t=4),t}function vb(h,t,r){let l=h.getFlatCoordinates();if(!l)return null;let c=h.getStride();return Sn(l,0,l.length,c,t,r)}var Fr=s_;function bb(h,t,r,l){for(let c=0,n=r.length;c<n;++c)h[t++]=r[c];return t}function vl(h,t,r,l){for(let c=0,n=r.length;c<n;++c){let x=r[c];for(let b=0;b<l;++b)h[t++]=x[b]}return t}function da(h,t,r,l,c){c=c||[];let n=0;for(let x=0,b=r.length;x<b;++x){let S=vl(h,t,r[x],l);c[n++]=S,t=S}return c.length=n,c}function uf(h,t,r,l,c){c=c||[];let n=0;for(let x=0,b=r.length;x<b;++x){let S=da(h,t,r[x],l,c[n]);S.length===0&&(S[0]=t),c[n++]=S,t=S[S.length-1]}return c.length=n,c}var a_=class h extends hf{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(Kr),this.changeEventsKeys_.length=0}listenGeometriesChange_(){let t=this.geometries_;for(let r=0,l=t.length;r<l;++r)this.changeEventsKeys_.push(kr(t[r],gi.CHANGE,this.changed,this))}clone(){let t=new h(o_(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,r,l,c){if(c<bn(this.getExtent(),t,r))return c;let n=this.geometries_;for(let x=0,b=n.length;x<b;++x)c=n[x].closestPointXY(t,r,l,c);return c}containsXY(t,r){let l=this.geometries_;for(let c=0,n=l.length;c<n;++c)if(l[c].containsXY(t,r))return!0;return!1}computeExtent(t){Mc(t);let r=this.geometries_;for(let l=0,c=r.length;l<c;++l)Fv(t,r[l].getExtent());return t}getGeometries(){return o_(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[],r=this.geometries_;for(let l=0,c=r.length;l<c;++l)r[l].getType()===this.getType()?t=t.concat(r[l].getGeometriesArrayRecursive()):t.push(r[l]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;let r=[],l=this.geometries_,c=!1;for(let n=0,x=l.length;n<x;++n){let b=l[n],S=b.getSimplifiedGeometry(t);r.push(S),S!==b&&(c=!0)}return c?new h(r):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return"GeometryCollection"}intersectsExtent(t){let r=this.geometries_;for(let l=0,c=r.length;l<c;++l)if(r[l].intersectsExtent(t))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(t,r){let l=this.geometries_;for(let c=0,n=l.length;c<n;++c)l[c].rotate(t,r);this.changed()}scale(t,r,l){l||(l=ds(this.getExtent()));let c=this.geometries_;for(let n=0,x=c.length;n<x;++n)c[n].scale(t,r,l);this.changed()}setGeometries(t){this.setGeometriesArray(o_(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){let r=this.geometries_;for(let l=0,c=r.length;l<c;++l)r[l].applyTransform(t);this.changed()}translate(t,r){let l=this.geometries_;for(let c=0,n=l.length;c<n;++c)l[c].translate(t,r);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}};function o_(h){return h.map(t=>t.clone())}var l_=a_;function wb(h,t,r,l,c,n,x){let b=h[t],S=h[t+1],R=h[r]-b,E=h[r+1]-S,A;if(R===0&&E===0)A=t;else{let z=((c-b)*R+(n-S)*E)/(R*R+E*E);if(z>1)A=r;else if(z>0){for(let W=0;W<l;++W)x[W]=Dr(h[t+W],h[r+W],z);x.length=l;return}else A=t}for(let z=0;z<l;++z)x[z]=h[A+z];x.length=l}function zu(h,t,r,l,c){let n=h[t],x=h[t+1];for(t+=l;t<r;t+=l){let b=h[t],S=h[t+1],R=Ms(n,x,b,S);R>c&&(c=R),n=b,x=S}return c}function Ou(h,t,r,l,c){for(let n=0,x=r.length;n<x;++n){let b=r[n];c=zu(h,t,b,l,c),t=b}return c}function Sb(h,t,r,l,c){for(let n=0,x=r.length;n<x;++n){let b=r[n];c=Ou(h,t,b,l,c),t=b[b.length-1]}return c}function Bu(h,t,r,l,c,n,x,b,S,R,E){if(t==r)return R;let A,z;if(c===0){if(z=Ms(x,b,h[t],h[t+1]),z<R){for(A=0;A<l;++A)S[A]=h[t+A];return S.length=l,z}return R}E=E||[NaN,NaN];let W=t+l;for(;W<r;)if(wb(h,W-l,W,l,x,b,E),z=Ms(x,b,E[0],E[1]),z<R){for(R=z,A=0;A<l;++A)S[A]=E[A];S.length=l,W+=l}else W+=l*Math.max((Math.sqrt(z)-Math.sqrt(R))/c|0,1);if(n&&(wb(h,r-l,t,l,x,b,E),z=Ms(x,b,E[0],E[1]),z<R)){for(R=z,A=0;A<l;++A)S[A]=E[A];S.length=l}return R}function ju(h,t,r,l,c,n,x,b,S,R,E){E=E||[NaN,NaN];for(let A=0,z=r.length;A<z;++A){let W=r[A];R=Bu(h,t,W,l,c,n,x,b,S,R,E),t=W}return R}function Tb(h,t,r,l,c,n,x,b,S,R,E){E=E||[NaN,NaN];for(let A=0,z=r.length;A<z;++A){let W=r[A];R=ju(h,t,W,l,c,n,x,b,S,R,E),t=W[W.length-1]}return R}function bl(h,t,r,l,c,n,x){let b=(r-t)/l;if(b<3){for(;t<r;t+=l)n[x++]=h[t],n[x++]=h[t+1];return x}let S=new Array(b);S[0]=1,S[b-1]=1;let R=[t,r-l],E=0;for(;R.length>0;){let A=R.pop(),z=R.pop(),W=0,re=h[z],me=h[z+1],ge=h[A],be=h[A+1];for(let ve=z+l;ve<A;ve+=l){let De=h[ve],ke=h[ve+1],je=$v(De,ke,re,me,ge,be);je>W&&(E=ve,W=je)}W>c&&(S[(E-t)/l]=1,z+l<E&&R.push(z,E),E+l<A&&R.push(E,A))}for(let A=0;A<b;++A)S[A]&&(n[x++]=h[t+A*l],n[x++]=h[t+A*l+1]);return x}function df(h,t,r,l,c,n,x,b){for(let S=0,R=r.length;S<R;++S){let E=r[S];x=bl(h,t,E,l,c,n,x),b.push(x),t=E}return x}function pa(h,t){return t*Math.round(h/t)}function PT(h,t,r,l,c,n,x){if(t==r)return x;let b=pa(h[t],c),S=pa(h[t+1],c);t+=l,n[x++]=b,n[x++]=S;let R,E;do if(R=pa(h[t],c),E=pa(h[t+1],c),t+=l,t==r)return n[x++]=R,n[x++]=E,x;while(R==b&&E==S);for(;t<r;){let A=pa(h[t],c),z=pa(h[t+1],c);if(t+=l,A==R&&z==E)continue;let W=R-b,re=E-S,me=A-b,ge=z-S;if(W*ge==re*me&&(W<0&&me<W||W==me||W>0&&me>W)&&(re<0&&ge<re||re==ge||re>0&&ge>re)){R=A,E=z;continue}n[x++]=R,n[x++]=E,b=R,S=E,R=A,E=z}return n[x++]=R,n[x++]=E,x}function Nu(h,t,r,l,c,n,x,b){for(let S=0,R=r.length;S<R;++S){let E=r[S];x=PT(h,t,E,l,c,n,x),b.push(x),t=E}return x}function Cb(h,t,r,l,c,n,x,b){for(let S=0,R=r.length;S<R;++S){let E=r[S],A=[];x=Nu(h,t,E,l,c,n,x,A),b.push(A),t=E[E.length-1]}return x}function fs(h,t,r,l,c){c=c!==void 0?c:[];let n=0;for(let x=t;x<r;x+=l)c[n++]=h.slice(x,x+l);return c.length=n,c}function fa(h,t,r,l,c){c=c!==void 0?c:[];let n=0;for(let x=0,b=r.length;x<b;++x){let S=r[x];c[n++]=fs(h,t,S,l,c[n]),t=S}return c.length=n,c}function Gu(h,t,r,l,c){c=c!==void 0?c:[];let n=0;for(let x=0,b=r.length;x<b;++x){let S=r[x];c[n++]=S.length===1&&S[0]===t?[]:fa(h,t,S,l,c[n]),t=S[S.length-1]}return c.length=n,c}function c_(h,t,r,l){let c=0,n=h[r-l],x=h[r-l+1],b=0,S=0;for(;t<r;t+=l){let R=h[t]-n,E=h[t+1]-x;c+=S*R-b*E,b=R,S=E}return c/2}function h_(h,t,r,l){let c=0;for(let n=0,x=r.length;n<x;++n){let b=r[n];c+=c_(h,t,b,l),t=b}return c}function Mb(h,t,r,l){let c=0;for(let n=0,x=r.length;n<x;++n){let b=r[n];c+=h_(h,t,b,l),t=b[b.length-1]}return c}var u_=class h extends Fr{constructor(t,r){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,r!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(r,t):this.setCoordinates(t,r)}clone(){return new h(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,r,l,c){return c<bn(this.getExtent(),t,r)?c:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(zu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Bu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,r,l,c))}getArea(){return c_(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return fs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){let r=[];return r.length=bl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,r,0),new h(r,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,r){this.setLayout(r,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=vl(this.flatCoordinates,0,t,this.stride),this.changed()}},d_=u_;function pf(h,t,r,l,c){let n;for(t+=l;t<r;t+=l)if(n=c(h.slice(t-l,t),h.slice(t,t+l)),n)return n;return!1}function wl(h,t,r,l,c,n,x){let b,S,R=(r-t)/l;if(R===1)b=t;else if(R===2)b=t,S=c;else if(R!==0){let E=h[t],A=h[t+1],z=0,W=[0];for(let ge=t+l;ge<r;ge+=l){let be=h[ge],ve=h[ge+1];z+=Math.sqrt((be-E)*(be-E)+(ve-A)*(ve-A)),W.push(z),E=be,A=ve}let re=c*z,me=Av(W,re);me<0?(S=(re-W[-me-2])/(W[-me-1]-W[-me-2]),b=t+(-me-2)*l):b=t+me*l}x=x>1?x:2,n=n||new Array(x);for(let E=0;E<x;++E)n[E]=b===void 0?NaN:S===void 0?h[b+E]:Dr(h[b+E],h[b+l+E],S);return n}function ff(h,t,r,l,c,n){if(r==t)return null;let x;if(c<h[t+l-1])return n?(x=h.slice(t,t+l),x[l-1]=c,x):null;if(h[r-1]<c)return n?(x=h.slice(r-l,r),x[l-1]=c,x):null;if(c==h[t+l-1])return h.slice(t,t+l);let b=t/l,S=r/l;for(;b<S;){let z=b+S>>1;c<h[(z+1)*l-1]?S=z:b=z+1}let R=h[b*l-1];if(c==R)return h.slice((b-1)*l,(b-1)*l+l);let E=h[(b+1)*l-1],A=(c-R)/(E-R);x=[];for(let z=0;z<l-1;++z)x.push(Dr(h[(b-1)*l+z],h[b*l+z],A));return x.push(c),x}function Ib(h,t,r,l,c,n,x){if(x)return ff(h,t,r[r.length-1],l,c,n);let b;if(c<h[l-1])return n?(b=h.slice(0,l),b[l-1]=c,b):null;if(h[h.length-1]<c)return n?(b=h.slice(h.length-l),b[l-1]=c,b):null;for(let S=0,R=r.length;S<R;++S){let E=r[S];if(t!=E){if(c<h[t+l-1])return null;if(c<=h[E-1])return ff(h,t,E,l,c,!1);t=E}}return null}function Eb(h,t,r,l,c){return!zv(c,function(x){return!ma(h,t,r,l,x[0],x[1])})}function ma(h,t,r,l,c,n){let x=0,b=h[r-l],S=h[r-l+1];for(;t<r;t+=l){let R=h[t],E=h[t+1];S<=n?E>n&&(R-b)*(n-S)-(c-b)*(E-S)>0&&x++:E<=n&&(R-b)*(n-S)-(c-b)*(E-S)<0&&x--,b=R,S=E}return x!==0}function Vu(h,t,r,l,c,n){if(r.length===0||!ma(h,t,r[0],l,c,n))return!1;for(let x=1,b=r.length;x<b;++x)if(ma(h,r[x-1],r[x],l,c,n))return!1;return!0}function Pb(h,t,r,l,c,n){if(r.length===0)return!1;for(let x=0,b=r.length;x<b;++x){let S=r[x];if(Vu(h,t,S,l,c,n))return!0;t=S[S.length-1]}return!1}function Uu(h,t,r,l,c){let n=Bg(wn(),h,t,r,l);return er(c,n)?Mo(c,n)||n[0]>=c[0]&&n[2]<=c[2]||n[1]>=c[1]&&n[3]<=c[3]?!0:pf(h,t,r,l,function(x,b){return jv(c,x,b)}):!1}function Rb(h,t,r,l,c){for(let n=0,x=r.length;n<x;++n){if(Uu(h,t,r[n],l,c))return!0;t=r[n]}return!1}function RT(h,t,r,l,c){return!!(Uu(h,t,r,l,c)||ma(h,t,r,l,c[0],c[1])||ma(h,t,r,l,c[0],c[3])||ma(h,t,r,l,c[2],c[1])||ma(h,t,r,l,c[2],c[3]))}function p_(h,t,r,l,c){if(!RT(h,t,r[0],l,c))return!1;if(r.length===1)return!0;for(let n=1,x=r.length;n<x;++n)if(Eb(h,r[n-1],r[n],l,c)&&!Uu(h,r[n-1],r[n],l,c))return!1;return!0}function Ab(h,t,r,l,c){for(let n=0,x=r.length;n<x;++n){let b=r[n];if(p_(h,t,b,l,c))return!0;t=b[b.length-1]}return!1}function mf(h,t,r,l){let c=h[t],n=h[t+1],x=0;for(let b=t+l;b<r;b+=l){let S=h[b],R=h[b+1];x+=Math.sqrt((S-c)*(S-c)+(R-n)*(R-n)),c=S,n=R}return x}var f_=class h extends Fr{constructor(t,r){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,r!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(r,t):this.setCoordinates(t,r)}appendCoordinate(t){Lr(this.flatCoordinates,t),this.changed()}clone(){let t=new h(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,r,l,c){return c<bn(this.getExtent(),t,r)?c:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(zu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Bu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,r,l,c))}forEachSegment(t){return pf(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,r){return this.layout!="XYM"&&this.layout!="XYZM"?null:(r=r!==void 0?r:!1,ff(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,r))}getCoordinates(){return fs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,r){return wl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,r,this.stride)}getLength(){return mf(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){let r=[];return r.length=bl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,r,0),new h(r,"XY")}getType(){return"LineString"}intersectsExtent(t){return Uu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,r){this.setLayout(r,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=vl(this.flatCoordinates,0,t,this.stride),this.changed()}},Es=f_;var m_=class h extends Fr{constructor(t,r,l){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,r);else if(r!==void 0&&l)this.setFlatCoordinates(r,t),this.ends_=l;else{let c=t,n=[],x=[];for(let S=0,R=c.length;S<R;++S){let E=c[S];Lr(n,E.getFlatCoordinates()),x.push(n.length)}let b=c.length===0?this.getLayout():c[0].getLayout();this.setFlatCoordinates(b,n),this.ends_=x}}appendLineString(t){Lr(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let t=new h(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,r,l,c){return c<bn(this.getExtent(),t,r)?c:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ou(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ju(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,r,l,c))}getCoordinateAtM(t,r,l){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(r=r!==void 0?r:!1,l=l!==void 0?l:!1,Ib(this.flatCoordinates,0,this.ends_,this.stride,t,r,l))}getCoordinates(){return fa(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new Es(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){let t=this.flatCoordinates,r=this.ends_,l=this.layout,c=[],n=0;for(let x=0,b=r.length;x<b;++x){let S=r[x],R=new Es(t.slice(n,S),l);c.push(R),n=S}return c}getFlatMidpoints(){let t=[],r=this.flatCoordinates,l=0,c=this.ends_,n=this.stride;for(let x=0,b=c.length;x<b;++x){let S=c[x],R=wl(r,l,S,n,.5);Lr(t,R),l=S}return t}getSimplifiedGeometryInternal(t){let r=[],l=[];return r.length=df(this.flatCoordinates,0,this.ends_,this.stride,t,r,0,l),new h(r,"XY",l)}getType(){return"MultiLineString"}intersectsExtent(t){return Rb(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,r){this.setLayout(r,t,2),this.flatCoordinates||(this.flatCoordinates=[]);let l=da(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=l.length===0?0:l[l.length-1],this.changed()}},g_=m_;var __=class h extends Fr{constructor(t,r){super(),this.setCoordinates(t,r)}clone(){let t=new h(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,r,l,c){let n=this.flatCoordinates,x=Ms(t,r,n[0],n[1]);if(x<c){let b=this.stride;for(let S=0;S<b;++S)l[S]=n[S];return l.length=b,x}return c}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return la(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Au(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,r){this.setLayout(r,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=bb(this.flatCoordinates,0,t,this.stride),this.changed()}},br=__;var y_=class h extends Fr{constructor(t,r){super(),r&&!Array.isArray(t[0])?this.setFlatCoordinates(r,t):this.setCoordinates(t,r)}appendPoint(t){Lr(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){let t=new h(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,r,l,c){if(c<bn(this.getExtent(),t,r))return c;let n=this.flatCoordinates,x=this.stride;for(let b=0,S=n.length;b<S;b+=x){let R=Ms(t,r,n[b],n[b+1]);if(R<c){c=R;for(let E=0;E<x;++E)l[E]=n[b+E];l.length=x}}return c}getCoordinates(){return fs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){let r=this.flatCoordinates.length/this.stride;return t<0||r<=t?null:new br(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){let t=this.flatCoordinates,r=this.layout,l=this.stride,c=[];for(let n=0,x=t.length;n<x;n+=l){let b=new br(t.slice(n,n+l),r);c.push(b)}return c}getType(){return"MultiPoint"}intersectsExtent(t){let r=this.flatCoordinates,l=this.stride;for(let c=0,n=r.length;c<n;c+=l){let x=r[c],b=r[c+1];if(Au(t,x,b))return!0}return!1}setCoordinates(t,r){this.setLayout(r,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=vl(this.flatCoordinates,0,t,this.stride),this.changed()}},Zu=y_;function qu(h,t,r,l,c,n,x){let b,S,R,E,A,z,W,re=c[n+1],me=[];for(let ve=0,De=r.length;ve<De;++ve){let ke=r[ve];for(E=h[ke-l],z=h[ke-l+1],b=t;b<ke;b+=l)A=h[b],W=h[b+1],(re<=z&&W<=re||z<=re&&re<=W)&&(R=(re-z)/(W-z)*(A-E)+E,me.push(R)),E=A,z=W}let ge=NaN,be=-1/0;for(me.sort(Ss),E=me[0],b=1,S=me.length;b<S;++b){A=me[b];let ve=Math.abs(A-E);ve>be&&(R=(E+A)/2,Vu(h,t,r,l,R,re)&&(ge=R,be=ve)),E=A}return isNaN(ge)&&(ge=c[n]),x?(x.push(ge,re,be),x):[ge,re,be]}function gf(h,t,r,l,c){let n=[];for(let x=0,b=r.length;x<b;++x){let S=r[x];n=qu(h,t,S,l,c,2*x,n),t=S[S.length-1]}return n}function Lb(h,t,r,l){for(;t<r-l;){for(let c=0;c<l;++c){let n=h[t+c];h[t+c]=h[r-l+c],h[r-l+c]=n}t+=l,r-=l}}function x_(h,t,r,l){let c=0,n=h[r-l],x=h[r-l+1];for(;t<r;t+=l){let b=h[t],S=h[t+1];c+=(b-n)*(S+x),n=b,x=S}return c===0?void 0:c>0}function Wu(h,t,r,l,c){c=c!==void 0?c:!1;for(let n=0,x=r.length;n<x;++n){let b=r[n],S=x_(h,t,b,l);if(n===0){if(c&&S||!c&&!S)return!1}else if(c&&!S||!c&&S)return!1;t=b}return!0}function _f(h,t,r,l,c){for(let n=0,x=r.length;n<x;++n){let b=r[n];if(!Wu(h,t,b,l,c))return!1;b.length&&(t=b[b.length-1])}return!0}function Fc(h,t,r,l,c){c=c!==void 0?c:!1;for(let n=0,x=r.length;n<x;++n){let b=r[n],S=x_(h,t,b,l);(n===0?c&&S||!c&&!S:c&&!S||!c&&S)&&Lb(h,t,b,l),t=b}return t}function $u(h,t,r,l,c){for(let n=0,x=r.length;n<x;++n)t=Fc(h,t,r[n],l,c);return t}function kb(h,t){let r=[],l=0,c=0,n;for(let x=0,b=t.length;x<b;++x){let S=t[x],R=x_(h,l,S,2);if(n===void 0&&(n=R),R===n)r.push(t.slice(c,x+1));else{if(r.length===0)continue;r[r.length-1].push(t[c])}c=x+1,l=S}return r}var Xu=class h extends Fr{constructor(t,r,l){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,r!==void 0&&l?(this.setFlatCoordinates(r,t),this.ends_=l):this.setCoordinates(t,r)}appendLinearRing(t){this.flatCoordinates?Lr(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let t=new h(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,r,l,c){return c<bn(this.getExtent(),t,r)?c:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ou(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ju(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,r,l,c))}containsXY(t,r){return Vu(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,r)}getArea(){return h_(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let r;return t!==void 0?(r=this.getOrientedFlatCoordinates().slice(),Fc(r,0,this.ends_,this.stride,t)):r=this.flatCoordinates,fa(r,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let t=ds(this.getExtent());this.flatInteriorPoint_=qu(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new br(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new d_(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){let t=this.layout,r=this.flatCoordinates,l=this.ends_,c=[],n=0;for(let x=0,b=l.length;x<b;++x){let S=l[x],R=new d_(r.slice(n,S),t);c.push(R),n=S}return c}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let t=this.flatCoordinates;Wu(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Fc(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let r=[],l=[];return r.length=Nu(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),r,0,l),new h(r,"XY",l)}getType(){return"Polygon"}intersectsExtent(t){return p_(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,r){this.setLayout(r,t,2),this.flatCoordinates||(this.flatCoordinates=[]);let l=da(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=l.length===0?0:l[l.length-1],this.changed()}},zc=Xu;function v_(h){if(Lu(h))throw new Error("Cannot create polygon from empty extent");let t=h[0],r=h[1],l=h[2],c=h[3],n=[t,r,t,c,l,c,l,r,t,r];return new Xu(n,"XY",[n.length])}function b_(h,t,r){t=t||32;let l=h.getStride(),c=h.getLayout(),n=h.getCenter(),x=l*(t+1),b=new Array(x);for(let E=0;E<x;E+=l){b[E]=0,b[E+1]=0;for(let A=2;A<l;A++)b[E+A]=n[A]}let S=[b.length],R=new Xu(b,c,S);return AT(R,n,h.getRadius(),r),R}function AT(h,t,r,l){let c=h.getFlatCoordinates(),n=h.getStride(),x=c.length/n-1,b=l||0;for(let S=0;S<=x;++S){let R=S*n,E=b+gl(S,x)*2*Math.PI/x;c[R]=t[0]+r*Math.cos(E),c[R+1]=t[1]+r*Math.sin(E)}h.changed()}function yf(h,t,r,l){let c=[],n=wn();for(let x=0,b=r.length;x<b;++x){let S=r[x];n=Ic(h,t,S[0],l),c.push((n[0]+n[2])/2,(n[1]+n[3])/2),t=S[S.length-1]}return c}var w_=class h extends Fr{constructor(t,r,l){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!l&&!Array.isArray(t[0])){let c=t,n=[],x=[];for(let b=0,S=c.length;b<S;++b){let R=c[b],E=n.length,A=R.getEnds();for(let z=0,W=A.length;z<W;++z)A[z]+=E;Lr(n,R.getFlatCoordinates()),x.push(A)}r=c.length===0?this.getLayout():c[0].getLayout(),t=n,l=x}r!==void 0&&l?(this.setFlatCoordinates(r,t),this.endss_=l):this.setCoordinates(t,r)}appendPolygon(t){let r;if(!this.flatCoordinates)this.flatCoordinates=t.getFlatCoordinates().slice(),r=t.getEnds().slice(),this.endss_.push();else{let l=this.flatCoordinates.length;Lr(this.flatCoordinates,t.getFlatCoordinates()),r=t.getEnds().slice();for(let c=0,n=r.length;c<n;++c)r[c]+=l}this.endss_.push(r),this.changed()}clone(){let t=this.endss_.length,r=new Array(t);for(let c=0;c<t;++c)r[c]=this.endss_[c].slice();let l=new h(this.flatCoordinates.slice(),this.layout,r);return l.applyProperties(this),l}closestPointXY(t,r,l,c){return c<bn(this.getExtent(),t,r)?c:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Sb(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Tb(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,r,l,c))}containsXY(t,r){return Pb(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,r)}getArea(){return Mb(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let r;return t!==void 0?(r=this.getOrientedFlatCoordinates().slice(),$u(r,0,this.endss_,this.stride,t)):r=this.flatCoordinates,Gu(r,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let t=yf(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=gf(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Zu(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let t=this.flatCoordinates;_f(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=$u(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let r=[],l=[];return r.length=Cb(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),r,0,l),new h(r,"XY",l)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let r;if(t===0)r=0;else{let n=this.endss_[t-1];r=n[n.length-1]}let l=this.endss_[t].slice(),c=l[l.length-1];if(r!==0)for(let n=0,x=l.length;n<x;++n)l[n]-=r;return new zc(this.flatCoordinates.slice(r,c),this.layout,l)}getPolygons(){let t=this.layout,r=this.flatCoordinates,l=this.endss_,c=[],n=0;for(let x=0,b=l.length;x<b;++x){let S=l[x].slice(),R=S[S.length-1];if(n!==0)for(let A=0,z=S.length;A<z;++A)S[A]-=n;let E=new zc(r.slice(n,R),t,S);c.push(E),n=R}return c}getType(){return"MultiPolygon"}intersectsExtent(t){return Ab(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,r){this.setLayout(r,t,3),this.flatCoordinates||(this.flatCoordinates=[]);let l=uf(this.flatCoordinates,0,t,this.stride,this.endss_);if(l.length===0)this.flatCoordinates.length=0;else{let c=l[l.length-1];this.flatCoordinates.length=c.length===0?0:c[c.length-1]}this.changed()}},S_=w_;var LT=(h,t,r)=>{let{coordinate:l,olGeometry:c,time_intervals:n}=t.properties,{coordinates:x,type:b}=t.geometry,S=c,R,E;if(c&&(b=S.getType(),x=S.getCoordinates()),r&&l)R=l;else if(b==="Point")R=x;else if(b==="LineString"){S||(S=new Es(x));let A=n||[[]],z=A[0],W=A[A.length-1];if(h<z[0])[,,E]=z,R=S.getFirstCoordinate();else if(h>W[0])[,,E]=W,R=S.getLastCoordinate();else for(let re=0;re<A.length-1;re+=1){let[me,ge]=A[re],[be,ve]=A[re+1];if(me<=h&&h<=be){let ke=Math.min((h-me)/(be-me),1)*(ve-ge)+ge;R=S.getCoordinateAt(ke),[,,E]=A[re];break}}}else console.error("This geometry type is not supported. Only Point or LineString are. Current geometry: ",S);return{coord:R,rotation:E}},Hu=LT;var kT=(h,t,r,l,c)=>{if(!h)return{renderedTrajectories:[]};let{center:n,pixelRatio:x=1,resolution:b,rotation:S=0,size:R=[],time:E=Date.now()}=l;if(!b||!n)return{renderedTrajectories:[]};let{filter:A,getScreenPixel:z=(He,ot)=>(ot.zoom||0)<12?He.map(vt=>Math.floor(vt)):He,hoverVehicleId:W,noInterpolate:re=!1,selectedVehicleId:me}=c,ge=h.getContext("2d");ge?.clearRect(0,0,h.width,h.height);let[be,ve]=R;be&&ve&&(h.width!==be*x||h.height!==ve*x)&&([h.width,h.height]=[be*x,ve*x]);let De=Yr(yr(),R[0]/2,R[1]/2,1/b,-1/b,-S,-n[0],-n[1]);h.style&&(h.style.width=`${h.width/x}px`,h.style.height=`${h.height/x}px`);let ke,je,Re,tt,Je=[];for(let He=t.length-1;He>=0;He-=1){let ot=t[He];if(A&&!A(ot))continue;let{timeOffset:vt,train_id:ct}=ot.properties,{coord:It,rotation:ut}=Hu(E-(vt||0),ot,re);if(t[He].properties.coordinate=It,t[He].properties.rotation=ut,!It)continue;let yt=Ar(De,[...It]);if(!yt||(yt=yt.map(dt=>dt*x),yt[0]<0||yt[0]>h.width||yt[1]<0||yt[1]>h.height))continue;let xt=r(ot,l,c);if(xt){if(W!==ct&&me!==ct){let[dt,St]=z([yt[0]-xt.width/2,yt[1]-xt.height/2],l);ge?.drawImage(xt,dt,St)}W&&W===ct&&(ke=xt,je=yt),me&&me===ct&&(Re=xt,tt=yt),Je.push(ot)}}return Re&&tt&&ge?.drawImage(Re,Math.floor(tt[0]-Re.width/2),Math.floor(tt[1]-Re.height/2)),ke&&je&&ge?.drawImage(ke,Math.floor(je[0]-ke.width/2),Math.floor(je[1]-ke.height/2)),{renderedTrajectories:Je}},Yu=kT;var DT=(h,t,r=!1)=>{let l=["HIDDEN","LEAVING","BOARDING"],c=h.has_fzo&&l.indexOf(h.state)>-1,n=t.has_fzo&&l.indexOf(t.state)>-1;if(c||n){if(c!==n)return c?-1:1;if(h.state!==t.state)return l.indexOf(h.state)-l.indexOf(t.state)}let x=null,b=null,S=Date.now();return r?(x=new Date(h.min_arrival_time||h.time).getTime()-S,b=new Date(t.min_arrival_time||t.time).getTime()-S):(x=new Date(h.time).getTime()-S,b=new Date(t.time).getTime()-S),x-b},Ku=DT;var FT=(h,t=!1,r=30)=>{let l=Object.keys(h).map(A=>h[A]);l.sort((A,z)=>Ku(A,z,t));let c=new Date;c.setMinutes(c.getMinutes()+r);let n=c.getTime(),x=new Date;x.setMinutes(x.getMinutes()-r);let b=x.getTime(),S=[],R=[],E=null;for(let A=l.length-1;A>=0;A-=1){let z={...l[A]},W=new Date(z.time).getTime();W>b&&W<n&&(z.state==="BOARDING"&&(R.includes(z.platform)?z.state="HIDDEN":R.push(z.platform)),E&&z.to[0]===E.to[0]&&Math.abs(W-E.time)<1e3&&z.line.name===E.line.name&&(z.state="HIDDEN"),/(STOP_CANCELLED|JOURNEY_CANCELLED)/.test(z.state)&&(z.cancelled=!0),E=z,E.time=W,S.unshift(z))}return S},Ju=FT;var zT=(h,t=!1,r=30,l=100)=>{let c={},n={};return x=>{let{source:b,content:S}=x;c[b]&&window.clearTimeout(c[b]),S&&(n[S.call_id]=S,c[b]=window.setTimeout(()=>{let R=Ju(n,t||!1,r);h(R)},l))}},T_=zT;var Oc={};dg(Oc,{MOTS_ALL:()=>jT,MOTS_ONLY_RAIL:()=>Ps,MOTS_WITHOUT_CABLE:()=>xf,MOTS_WITH_CABLE:()=>BT,bgColors:()=>Fb,getBgColor:()=>GT,getDelayColor:()=>ZT,getDelayText:()=>qT,getRadius:()=>NT,getTextColor:()=>VT,getTextSize:()=>UT,getTypeIndex:()=>vf,textColors:()=>zb,types:()=>Db});var OT=[[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15]],Ps=["rail"],BT=["cablecar","gondola","funicular","coach"],xf=["tram","subway","rail","bus"],jT=["tram","subway","rail","bus","ferry","cablecar","gondola","funicular","coach"],Db=[/^Tram/i,/^Subway( \/ Metro \/ S-Bahn)?/i,/^Train/i,/^Bus/i,/^Ferry/i,/^Cable ?Car/i,/^Gondola/i,/^Funicular/i,/^(Long distance bus|coach)/i,/^Rail/i],Fb=["#ffb400","#ff5400","#ff8080","#ea0000","#3000ff","#ffb400","#41a27b","#00d237","#b5b5b5","#ff8080"],zb=["#000000","#ffffff","#000000","#ffffff","#ffffff","#000000","#ffffff","#000000","#000000","#000000"],vf=h=>typeof h=="string"?Db.findIndex(t=>t.test(h)):h,NT=(h,t)=>{try{let r=vf(h||0);return OT[r][t]}catch{return 1}},GT=h=>{try{let t=vf(h);return Fb[t]}catch{return"#ffffff"}},VT=h=>{try{let t=vf(h);return zb[t]}catch{return"#ffffff"}},UT=(h,t,r,l,c)=>{if(!h)return 0;h.font=c(l,r);let n=h.measureText(r),x=25,b=0;for(;n.width>t-6&&b<x;)l-=.5,h.font=c(l,r),n=h.measureText(r),b+=1;return l},ZT=(h,t,r)=>t?r?"#ff0000":"#a0a0a0":h===null?"#a0a0a0":h>=36e5?"#ed004c":h>=5e5?"#e80000":h>=3e5?"#ff4a00":h>=18e4?"#f7bf00":"#00a00c",qT=(h,t)=>t?String.fromCodePoint(215):h>=36e5?`+${Math.round(h/36e5)}h`:h>=6e4?`+${Math.round(h/6e4)}m`:h>=1e3?`+${Math.round(h/1e3)}s`:h>0?`+${h}ms`:"";var Bc="vectorTileFeature";var Ob={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var C_=class extends xr{constructor(t){super();let r=t.element;r&&!t.target&&!r.style.pointerEvents&&(r.style.pointerEvents="auto"),this.element=r||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let r=0,l=this.listenerKeys.length;r<l;++r)Kr(this.listenerKeys[r]);if(this.listenerKeys.length=0,this.map_=t,t){let r=this.target_??t.getOverlayContainerStopEvent();this.element&&r.appendChild(this.element),this.render!==Ts&&this.listenerKeys.push(kr(t,Ob.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}},jc=C_;var Yt={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var M_=class extends xr{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;let r=Object.assign({},t);typeof t.properties=="object"&&(delete r.properties,Object.assign(r,t.properties)),r[Yt.OPACITY]=t.opacity!==void 0?t.opacity:1,di(typeof r[Yt.OPACITY]=="number","Layer opacity must be a number"),r[Yt.VISIBLE]=t.visible!==void 0?t.visible:!0,r[Yt.Z_INDEX]=t.zIndex,r[Yt.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,r[Yt.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,r[Yt.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,r[Yt.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=r.className!==void 0?r.className:"ol-layer",delete r.className,this.setProperties(r),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){let r=this.state_||{layer:this,managed:t===void 0?!0:t},l=this.getZIndex();return r.opacity=Pi(Math.round(this.getOpacity()*100)/100,0,1),r.visible=this.getVisible(),r.extent=this.getExtent(),r.zIndex=l===void 0&&!r.managed?1/0:l,r.maxResolution=this.getMaxResolution(),r.minResolution=Math.max(this.getMinResolution(),0),r.minZoom=this.getMinZoom(),r.maxZoom=this.getMaxZoom(),this.state_=r,r}getLayersArray(t){return Tt()}getLayerStatesArray(t){return Tt()}getExtent(){return this.get(Yt.EXTENT)}getMaxResolution(){return this.get(Yt.MAX_RESOLUTION)}getMinResolution(){return this.get(Yt.MIN_RESOLUTION)}getMinZoom(){return this.get(Yt.MIN_ZOOM)}getMaxZoom(){return this.get(Yt.MAX_ZOOM)}getOpacity(){return this.get(Yt.OPACITY)}getSourceState(){return Tt()}getVisible(){return this.get(Yt.VISIBLE)}getZIndex(){return this.get(Yt.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Yt.EXTENT,t)}setMaxResolution(t){this.set(Yt.MAX_RESOLUTION,t)}setMinResolution(t){this.set(Yt.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(Yt.MAX_ZOOM,t)}setMinZoom(t){this.set(Yt.MIN_ZOOM,t)}setOpacity(t){di(typeof t=="number","Layer opacity must be a number"),this.set(Yt.OPACITY,t)}setVisible(t){this.set(Yt.VISIBLE,t)}setZIndex(t){this.set(Yt.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},Bb=M_;var Ws={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var Tn={ANIMATING:0,INTERACTING:1};var ms={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function I_(h,t,r){return function(l,c,n,x,b){if(!l)return;if(!c&&!t)return l;let S=t?0:n[0]*c,R=t?0:n[1]*c,E=b?b[0]:0,A=b?b[1]:0,z=h[0]+S/2+E,W=h[2]-S/2+E,re=h[1]+R/2+A,me=h[3]-R/2+A;z>W&&(z=(W+z)/2,W=z),re>me&&(re=(me+re)/2,me=re);let ge=Pi(l[0],z,W),be=Pi(l[1],re,me);if(x&&r&&c){let ve=30*c;ge+=-ve*Math.log(1+Math.max(0,z-l[0])/ve)+ve*Math.log(1+Math.max(0,l[0]-W)/ve),be+=-ve*Math.log(1+Math.max(0,re-l[1])/ve)+ve*Math.log(1+Math.max(0,l[1]-me)/ve)}return[ge,be]}}function jb(h){return h}function E_(h,t,r,l){let c=Ti(t)/r[0],n=ar(t)/r[1];return l?Math.min(h,Math.max(c,n)):Math.min(h,Math.min(c,n))}function P_(h,t,r){let l=Math.min(h,t),c=50;return l*=Math.log(1+c*Math.max(0,h/t-1))/c+1,r&&(l=Math.max(l,r),l/=Math.log(1+c*Math.max(0,r/h-1))/c+1),Pi(l,r/2,t*2)}function Nb(h,t,r,l){return t=t!==void 0?t:!0,function(c,n,x,b){if(c!==void 0){let S=h[0],R=h[h.length-1],E=r?E_(S,r,x,l):S;if(b)return t?P_(c,E,R):Pi(c,R,E);let A=Math.min(E,c),z=Math.floor(qp(h,A,n));return h[z]>E&&z<h.length-1?h[z+1]:h[z]}}}function Gb(h,t,r,l,c,n){return l=l!==void 0?l:!0,r=r!==void 0?r:0,function(x,b,S,R){if(x!==void 0){let E=c?E_(t,c,S,n):t;if(R)return l?P_(x,E,r):Pi(x,r,E);let A=1e-9,z=Math.ceil(Math.log(t/E)/Math.log(h)-A),W=-b*(.5-A)+.5,re=Math.min(E,x),me=Math.floor(Math.log(t/re)/Math.log(h)+W),ge=Math.max(z,me),be=t/Math.pow(h,ge);return Pi(be,r,E)}}}function R_(h,t,r,l,c){return r=r!==void 0?r:!0,function(n,x,b,S){if(n!==void 0){let R=l?E_(h,l,b,c):h;return!r||!S?Pi(n,t,R):P_(n,R,t)}}}function Vb(h){if(h!==void 0)return 0}function A_(h){if(h!==void 0)return h}function Ub(h){let t=2*Math.PI/h;return function(r,l){if(l)return r;if(r!==void 0)return r=Math.floor(r/t+.5)*t,r}}function Zb(h){let t=h===void 0?ml(5):h;return function(r,l){return l||r===void 0?r:Math.abs(r)<=t?0:r}}function WT(h){return Math.pow(h,3)}function qb(h){return 1-WT(1-h)}function Wb(h){return 3*h*h-2*h*h*h}var L_=0,D_=class extends xr{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=af(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&t_(),t.center&&(t.center=Di(t.center,this.projection_)),t.extent&&(t.extent=qs(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){let r=Object.assign({},t);for(let b in ms)delete r[b];this.setProperties(r,!0);let l=XT(t);this.maxResolution_=l.maxResolution,this.minResolution_=l.minResolution,this.zoomFactor_=l.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=l.minZoom;let c=$T(t),n=l.constraint,x=HT(t);this.constraints_={center:c,resolution:n,rotation:x},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let r=this.padding_;this.padding_=t;let l=this.getCenterInternal();if(l){let c=t||[0,0,0,0];r=r||[0,0,0,0];let n=this.getResolution(),x=n/2*(c[3]-r[3]+r[1]-c[1]),b=n/2*(c[0]-r[0]+r[2]-c[2]);this.setCenterInternal([l[0]+x,l[1]-b])}}getUpdatedOptions_(t){let r=this.getProperties();return r.resolution!==void 0?r.resolution=this.getResolution():r.zoom=this.getZoom(),r.center=this.getCenterInternal(),r.rotation=this.getRotation(),Object.assign({},r,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let r=new Array(arguments.length);for(let l=0;l<r.length;++l){let c=arguments[l];c.center&&(c=Object.assign({},c),c.center=Di(c.center,this.getProjection())),c.anchor&&(c=Object.assign({},c),c.anchor=Di(c.anchor,this.getProjection())),r[l]=c}this.animateInternal.apply(this,r)}animateInternal(t){let r=arguments.length,l;r>1&&typeof arguments[r-1]=="function"&&(l=arguments[r-1],--r);let c=0;for(;c<r&&!this.isDef();++c){let E=arguments[c];E.center&&this.setCenterInternal(E.center),E.zoom!==void 0?this.setZoom(E.zoom):E.resolution&&this.setResolution(E.resolution),E.rotation!==void 0&&this.setRotation(E.rotation)}if(c===r){l&&bf(l,!0);return}let n=Date.now(),x=this.targetCenter_.slice(),b=this.targetResolution_,S=this.targetRotation_,R=[];for(;c<r;++c){let E=arguments[c],A={start:n,complete:!1,anchor:E.anchor,duration:E.duration!==void 0?E.duration:1e3,easing:E.easing||Wb,callback:l};if(E.center&&(A.sourceCenter=x,A.targetCenter=E.center.slice(),x=A.targetCenter),E.zoom!==void 0?(A.sourceResolution=b,A.targetResolution=this.getResolutionForZoom(E.zoom),b=A.targetResolution):E.resolution&&(A.sourceResolution=b,A.targetResolution=E.resolution,b=A.targetResolution),E.rotation!==void 0){A.sourceRotation=S;let z=gl(E.rotation-S+Math.PI,2*Math.PI)-Math.PI;A.targetRotation=S+z,S=A.targetRotation}YT(A)?A.complete=!0:n+=A.duration,R.push(A)}this.animations_.push(R),this.setHint(Tn.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Tn.ANIMATING]>0}getInteracting(){return this.hints_[Tn.INTERACTING]>0}cancelAnimations(){this.setHint(Tn.ANIMATING,-this.hints_[Tn.ANIMATING]);let t;for(let r=0,l=this.animations_.length;r<l;++r){let c=this.animations_[r];if(c[0].callback&&bf(c[0].callback,!1),!t)for(let n=0,x=c.length;n<x;++n){let b=c[n];if(!b.complete){t=b.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let t=Date.now(),r=!1;for(let l=this.animations_.length-1;l>=0;--l){let c=this.animations_[l],n=!0;for(let x=0,b=c.length;x<b;++x){let S=c[x];if(S.complete)continue;let R=t-S.start,E=S.duration>0?R/S.duration:1;E>=1?(S.complete=!0,E=1):n=!1;let A=S.easing(E);if(S.sourceCenter){let z=S.sourceCenter[0],W=S.sourceCenter[1],re=S.targetCenter[0],me=S.targetCenter[1];this.nextCenter_=S.targetCenter;let ge=z+A*(re-z),be=W+A*(me-W);this.targetCenter_=[ge,be]}if(S.sourceResolution&&S.targetResolution){let z=A===1?S.targetResolution:S.sourceResolution+A*(S.targetResolution-S.sourceResolution);if(S.anchor){let W=this.getViewportSize_(this.getRotation()),re=this.constraints_.resolution(z,0,W,!0);this.targetCenter_=this.calculateCenterZoom(re,S.anchor)}this.nextResolution_=S.targetResolution,this.targetResolution_=z,this.applyTargetState_(!0)}if(S.sourceRotation!==void 0&&S.targetRotation!==void 0){let z=A===1?gl(S.targetRotation+Math.PI,2*Math.PI)-Math.PI:S.sourceRotation+A*(S.targetRotation-S.sourceRotation);if(S.anchor){let W=this.constraints_.rotation(z,!0);this.targetCenter_=this.calculateCenterRotate(W,S.anchor)}this.nextRotation_=S.targetRotation,this.targetRotation_=z}if(this.applyTargetState_(!0),r=!0,!S.complete)break}if(n){this.animations_[l]=null,this.setHint(Tn.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let x=c[0].callback;x&&bf(x,!0)}}this.animations_=this.animations_.filter(Boolean),r&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,r){let l,c=this.getCenterInternal();return c!==void 0&&(l=[c[0]-r[0],c[1]-r[1]],Yv(l,t-this.getRotation()),Hv(l,r)),l}calculateCenterZoom(t,r){let l,c=this.getCenterInternal(),n=this.getResolution();if(c!==void 0&&n!==void 0){let x=r[0]-t*(r[0]-c[0])/n,b=r[1]-t*(r[1]-c[1])/n;l=[x,b]}return l}getViewportSize_(t){let r=this.viewportSize_;if(t){let l=r[0],c=r[1];return[Math.abs(l*Math.cos(t))+Math.abs(c*Math.sin(t)),Math.abs(l*Math.sin(t))+Math.abs(c*Math.cos(t))]}return r}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let t=this.getCenterInternal();return t&&ha(t,this.getProjection())}getCenterInternal(){return this.get(ms.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){let r=this.calculateExtentInternal(t);return Zs(r,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();let r=this.getCenterInternal();di(r,"The view center is not defined");let l=this.getResolution();di(l!==void 0,"The view resolution is not defined");let c=this.getRotation();return di(c!==void 0,"The view rotation is not defined"),Ov(r,l,c,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(ms.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,r){return this.getResolutionForExtentInternal(qs(t,this.getProjection()),r)}getResolutionForExtentInternal(t,r){r=r||this.getViewportSizeMinusPadding_();let l=Ti(t)/r[0],c=ar(t)/r[1];return Math.max(l,c)}getResolutionForValueFunction(t){t=t||2;let r=this.getConstrainedResolution(this.maxResolution_),l=this.minResolution_,c=Math.log(r/l)/Math.log(t);return function(n){return r/Math.pow(t,n*c)}}getRotation(){return this.get(ms.ROTATION)}getValueForResolutionFunction(t){let r=Math.log(t||2),l=this.getConstrainedResolution(this.maxResolution_),c=this.minResolution_,n=Math.log(l/c)/r;return function(x){return Math.log(l/x)/r/n}}getViewportSizeMinusPadding_(t){let r=this.getViewportSize_(t),l=this.padding_;return l&&(r=[r[0]-l[1]-l[3],r[1]-l[0]-l[2]]),r}getState(){let t=this.getProjection(),r=this.getResolution(),l=this.getRotation(),c=this.getCenterInternal(),n=this.padding_;if(n){let x=this.getViewportSizeMinusPadding_();c=k_(c,this.getViewportSize_(),[x[0]/2+n[3],x[1]/2+n[0]],r,l)}return{center:c.slice(0),projection:t!==void 0?t:null,resolution:r,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:l,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t,r=this.getResolution();return r!==void 0&&(t=this.getZoomForResolution(r)),t}getZoomForResolution(t){let r=this.minZoom_||0,l,c;if(this.resolutions_){let n=qp(this.resolutions_,t,1);r=n,l=this.resolutions_[n],n==this.resolutions_.length-1?c=2:c=l/this.resolutions_[n+1]}else l=this.maxResolution_,c=this.zoomFactor_;return r+Math.log(l/t)/Math.log(c)}getResolutionForZoom(t){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let r=Pi(Math.floor(t),0,this.resolutions_.length-2),l=this.resolutions_[r]/this.resolutions_[r+1];return this.resolutions_[r]/Math.pow(l,Pi(t-r,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,r){let l;if(di(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){di(!Lu(t),"Cannot fit empty extent provided as `geometry`");let c=qs(t,this.getProjection());l=v_(c)}else if(t.getType()==="Circle"){let c=qs(t.getExtent(),this.getProjection());l=v_(c),l.rotate(this.getRotation(),ds(c))}else{let c=Hn();c?l=t.clone().transform(c,this.getProjection()):l=t}this.fitInternal(l,r)}rotatedExtentForGeometry(t){let r=this.getRotation(),l=Math.cos(r),c=Math.sin(-r),n=t.getFlatCoordinates(),x=t.getStride(),b=1/0,S=1/0,R=-1/0,E=-1/0;for(let A=0,z=n.length;A<z;A+=x){let W=n[A]*l-n[A+1]*c,re=n[A]*c+n[A+1]*l;b=Math.min(b,W),S=Math.min(S,re),R=Math.max(R,W),E=Math.max(E,re)}return[b,S,R,E]}fitInternal(t,r){r=r||{};let l=r.size;l||(l=this.getViewportSizeMinusPadding_());let c=r.padding!==void 0?r.padding:[0,0,0,0],n=r.nearest!==void 0?r.nearest:!1,x;r.minResolution!==void 0?x=r.minResolution:r.maxZoom!==void 0?x=this.getResolutionForZoom(r.maxZoom):x=0;let b=this.rotatedExtentForGeometry(t),S=this.getResolutionForExtentInternal(b,[l[0]-c[1]-c[3],l[1]-c[0]-c[2]]);S=isNaN(S)?x:Math.max(S,x),S=this.getConstrainedResolution(S,n?0:1);let R=this.getRotation(),E=Math.sin(R),A=Math.cos(R),z=ds(b);z[0]+=(c[1]-c[3])/2*S,z[1]+=(c[0]-c[2])/2*S;let W=z[0]*A-z[1]*E,re=z[1]*A+z[0]*E,me=this.getConstrainedCenter([W,re],S),ge=r.callback?r.callback:Ts;r.duration!==void 0?this.animateInternal({resolution:S,center:me,duration:r.duration,easing:r.easing},ge):(this.targetResolution_=S,this.targetCenter_=me,this.applyTargetState_(!1,!0),bf(ge,!0))}centerOn(t,r,l){this.centerOnInternal(Di(t,this.getProjection()),r,l)}centerOnInternal(t,r,l){this.setCenterInternal(k_(t,r,l,this.getResolution(),this.getRotation()))}calculateCenterShift(t,r,l,c){let n,x=this.padding_;if(x&&t){let b=this.getViewportSizeMinusPadding_(-l),S=k_(t,c,[b[0]/2+x[3],b[1]/2+x[0]],r,l);n=[t[0]-S[0],t[1]-S[1]]}return n}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){let r=ha(this.targetCenter_,this.getProjection());this.setCenter([r[0]+t[0],r[1]+t[1]])}adjustCenterInternal(t){let r=this.targetCenter_;this.setCenterInternal([r[0]+t[0],r[1]+t[1]])}adjustResolution(t,r){r=r&&Di(r,this.getProjection()),this.adjustResolutionInternal(t,r)}adjustResolutionInternal(t,r){let l=this.getAnimating()||this.getInteracting(),c=this.getViewportSize_(this.getRotation()),n=this.constraints_.resolution(this.targetResolution_*t,0,c,l);r&&(this.targetCenter_=this.calculateCenterZoom(n,r)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,r){this.adjustResolution(Math.pow(this.zoomFactor_,-t),r)}adjustRotation(t,r){r&&(r=Di(r,this.getProjection())),this.adjustRotationInternal(t,r)}adjustRotationInternal(t,r){let l=this.getAnimating()||this.getInteracting(),c=this.constraints_.rotation(this.targetRotation_+t,l);r&&(this.targetCenter_=this.calculateCenterRotate(c,r)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&Di(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,r){return this.hints_[t]+=r,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,r){let l=this.getAnimating()||this.getInteracting()||r,c=this.constraints_.rotation(this.targetRotation_,l),n=this.getViewportSize_(c),x=this.constraints_.resolution(this.targetResolution_,0,n,l),b=this.constraints_.center(this.targetCenter_,x,n,l,this.calculateCenterShift(this.targetCenter_,x,c,n));this.get(ms.ROTATION)!==c&&this.set(ms.ROTATION,c),this.get(ms.RESOLUTION)!==x&&(this.set(ms.RESOLUTION,x),this.set("zoom",this.getZoom(),!0)),(!b||!this.get(ms.CENTER)||!lr(this.get(ms.CENTER),b))&&this.set(ms.CENTER,b),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,r,l){t=t!==void 0?t:200;let c=r||0,n=this.constraints_.rotation(this.targetRotation_),x=this.getViewportSize_(n),b=this.constraints_.resolution(this.targetResolution_,c,x),S=this.constraints_.center(this.targetCenter_,b,x,!1,this.calculateCenterShift(this.targetCenter_,b,n,x));if(t===0&&!this.cancelAnchor_){this.targetResolution_=b,this.targetRotation_=n,this.targetCenter_=S,this.applyTargetState_();return}l=l||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==b||this.getRotation()!==n||!this.getCenterInternal()||!lr(this.getCenterInternal(),S))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:n,center:S,resolution:b,duration:t,easing:qb,anchor:l}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Tn.INTERACTING,1)}endInteraction(t,r,l){l=l&&Di(l,this.getProjection()),this.endInteractionInternal(t,r,l)}endInteractionInternal(t,r,l){this.getInteracting()&&(this.setHint(Tn.INTERACTING,-1),this.resolveConstraints(t,r,l))}getConstrainedCenter(t,r){let l=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,r||this.getResolution(),l)}getConstrainedZoom(t,r){let l=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(l,r))}getConstrainedResolution(t,r){r=r||0;let l=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,r,l)}};function bf(h,t){setTimeout(function(){h(t)},0)}function $T(h){if(h.extent!==void 0){let r=h.smoothExtentConstraint!==void 0?h.smoothExtentConstraint:!0;return I_(h.extent,h.constrainOnlyCenter,r)}let t=af(h.projection,"EPSG:3857");if(h.multiWorld!==!0&&t.isGlobal()){let r=t.getExtent().slice();return r[0]=-1/0,r[2]=1/0,I_(r,!1,!1)}return jb}function XT(h){let t,r,l,x=h.minZoom!==void 0?h.minZoom:L_,b=h.maxZoom!==void 0?h.maxZoom:28,S=h.zoomFactor!==void 0?h.zoomFactor:2,R=h.multiWorld!==void 0?h.multiWorld:!1,E=h.smoothResolutionConstraint!==void 0?h.smoothResolutionConstraint:!0,A=h.showFullExtent!==void 0?h.showFullExtent:!1,z=af(h.projection,"EPSG:3857"),W=z.getExtent(),re=h.constrainOnlyCenter,me=h.extent;if(!R&&!me&&z.isGlobal()&&(re=!1,me=W),h.resolutions!==void 0){let ge=h.resolutions;r=ge[x],l=ge[b]!==void 0?ge[b]:ge[ge.length-1],h.constrainResolution?t=Nb(ge,E,!re&&me,A):t=R_(r,l,E,!re&&me,A)}else{let be=(W?Math.max(Ti(W),ar(W)):360*ku.degrees/z.getMetersPerUnit())/256/Math.pow(2,L_),ve=be/Math.pow(2,28-L_);r=h.maxResolution,r!==void 0?x=0:r=be/Math.pow(S,x),l=h.minResolution,l===void 0&&(h.maxZoom!==void 0?h.maxResolution!==void 0?l=r/Math.pow(S,b):l=be/Math.pow(S,b):l=ve),b=x+Math.floor(Math.log(r/l)/Math.log(S)),l=r/Math.pow(S,b-x),h.constrainResolution?t=Gb(S,r,l,E,!re&&me,A):t=R_(r,l,E,!re&&me,A)}return{constraint:t,maxResolution:r,minResolution:l,minZoom:x,zoomFactor:S}}function HT(h){if(h.enableRotation!==void 0?h.enableRotation:!0){let r=h.constrainRotation;return r===void 0||r===!0?Zb():r===!1?A_:typeof r=="number"?Ub(r):A_}return Vb}function YT(h){return!(h.sourceCenter&&h.targetCenter&&!lr(h.sourceCenter,h.targetCenter)||h.sourceResolution!==h.targetResolution||h.sourceRotation!==h.targetRotation)}function k_(h,t,r,l,c){let n=Math.cos(-c),x=Math.sin(-c),b=h[0]*n-h[1]*x,S=h[1]*n+h[0]*x;b+=(t[0]/2-r[0])*l,S+=(r[1]-t[1]/2)*l,x=-x;let R=b*n-S*x,E=S*n+b*x;return[R,E]}var F_=D_;var z_=class extends Bb{constructor(t){let r=Object.assign({},t);delete r.source,super(r),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(Yt.SOURCE,this.handleSourcePropertyChange_);let l=t.source?t.source:null;this.setSource(l)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(Yt.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(Kr(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let t=this.getSource();t&&(this.sourceChangeKey_=kr(t,gi.CHANGE,this.handleSourceChange_,this),t.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let r,l=this.getMapInternal();!t&&l&&(t=l.getView()),t instanceof F_?r={viewState:t.getState(),extent:t.calculateExtent()}:r=t,!r.layerStatesArray&&l&&(r.layerStatesArray=l.getLayerGroup().getLayerStatesArray());let c;if(r.layerStatesArray){if(c=r.layerStatesArray.find(x=>x.layer===this),!c)return!1}else c=this.getLayerState();let n=this.getExtent();return O_(c,r.viewState)&&(!n||er(n,r.extent))}getAttributions(t){if(!this.isVisible(t))return[];let r=this.getSource()?.getAttributions();if(!r)return[];let l=t instanceof F_?t.getViewStateAndExtent():t,c=r(l);return Array.isArray(c)||(c=[c]),c}render(t,r){let l=this.getRenderer();return l.prepareFrame(t)?(this.rendered=!0,l.renderFrame(t,r)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,r){}renderDeferred(t){let r=this.getRenderer();r&&r.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(Yt.MAP,t)}getMapInternal(){return this.get(Yt.MAP)}setMap(t){this.mapPrecomposeKey_&&(Kr(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(Kr(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=kr(t,Ws.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=kr(this,gi.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){let r=t.frameState.layerStatesArray,l=this.getLayerState(!1);di(!r.some(c=>c.layer===l.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),r.push(l)}setSource(t){this.set(Yt.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function O_(h,t){if(!h.visible)return!1;let r=t.resolution;if(r<h.minResolution||r>=h.maxResolution)return!1;let l=t.zoom;return l>h.minZoom&&l<=h.maxZoom}var Rs=z_;var KT=()=>{let h=document.createElement("div");return Object.assign(h.style,{position:"absolute",bottom:0,right:0,fontSize:".8rem",padding:"0 10px"}),h},$b=KT;var B_=class extends jc{constructor(t={}){let r=$b();r.className=t.className||"mbt-copyright",super({element:r,...t}),this.format=t.format||(l=>l?.join(" | "))}render({frameState:t}){if(!t){this.element.innerHTML="";return}let r=[];t?.layerStatesArray.forEach(c=>{let{layer:n}=c;if(t&&O_(c,t.viewState)&&(n?.getSource()?.getAttributions()&&(r=r.concat(n.getSource().getAttributions()(t))),n?.get("copyrights"))){let x=n.get("copyrights");x=Array.isArray(x)?x:[x],x?.length&&r.push(...x)}});let l=pl(r)||[];this.element.innerHTML=this.format(l)}},Xb=B_;var As={ADD:"add",REMOVE:"remove"};var Hb={LENGTH:"length"},Nc=class extends Ei{constructor(t,r,l){super(t),this.element=r,this.index=l}},j_=class extends xr{constructor(t,r){if(super(),this.on,this.once,this.un,r=r||{},this.unique_=!!r.unique,this.array_=t||[],this.unique_)for(let l=0,c=this.array_.length;l<c;++l)this.assertUnique_(this.array_[l],l);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let r=0,l=t.length;r<l;++r)this.push(t[r]);return this}forEach(t){let r=this.array_;for(let l=0,c=r.length;l<c;++l)t(r[l],l,r)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(Hb.LENGTH)}insertAt(t,r){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(r),this.array_.splice(t,0,r),this.updateLength_(),this.dispatchEvent(new Nc(As.ADD,r,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);let r=this.getLength();return this.insertAt(r,t),this.getLength()}remove(t){let r=this.array_;for(let l=0,c=r.length;l<c;++l)if(r[l]===t)return this.removeAt(l)}removeAt(t){if(t<0||t>=this.getLength())return;let r=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new Nc(As.REMOVE,r,t)),r}setAt(t,r){let l=this.getLength();if(t>=l){this.insertAt(t,r);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(r,t);let c=this.array_[t];this.array_[t]=r,this.dispatchEvent(new Nc(As.REMOVE,c,t)),this.dispatchEvent(new Nc(As.ADD,r,t))}updateLength_(){this.set(Hb.LENGTH,this.array_.length)}assertUnique_(t,r){for(let l=0,c=this.array_.length;l<c;++l)if(this.array_[l]===t&&l!==r)throw new Error("Duplicate item added to a unique collection")}},Qu=j_;var N_=class h extends xr{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if(typeof t.getSimplifiedGeometry=="function"){let r=t;this.setGeometry(r)}else{let r=t;this.setProperties(r)}}clone(){let t=new h(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());let r=this.getGeometry();r&&t.setGeometry(r.clone());let l=this.getStyle();return l&&t.setStyle(l),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(Kr(this.geometryChangeKey_),this.geometryChangeKey_=null);let t=this.getGeometry();t&&(this.geometryChangeKey_=kr(t,gi.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?JT(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}};function JT(h){if(typeof h=="function")return h;let t;return Array.isArray(h)?t=h:(di(typeof h.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[h]),function(){return t}}var gs=N_;var Mt={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};var Po={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]};var Sl={name:"xyz",min:[0,0,0],channel:["X","Y","Z"],alias:["XYZ","ciexyz","cie1931"]};Sl.whitepoint={2:{A:[109.85,100,35.585],C:[98.074,100,118.232],D50:[96.422,100,82.521],D55:[95.682,100,92.149],D65:[95.045592705167,100,108.9057750759878],D75:[94.972,100,122.638],F2:[99.187,100,67.395],F7:[95.044,100,108.755],F11:[100.966,100,64.37],E:[100,100,100]},10:{A:[111.144,100,35.2],C:[97.285,100,116.145],D50:[96.72,100,81.427],D55:[95.799,100,90.926],D65:[94.811,100,107.304],D75:[94.416,100,120.641],F2:[103.28,100,69.026],F7:[95.792,100,107.687],F11:[103.866,100,65.627],E:[100,100,100]}};Sl.max=Sl.whitepoint[2].D65;Sl.rgb=function(h,t){t=t||Sl.whitepoint[2].E;var r=h[0]/t[0],l=h[1]/t[1],c=h[2]/t[2],n,x,b;return n=r*3.240969941904521+l*-1.537383177570093+c*-.498610760293,x=r*-.96924363628087+l*1.87596750150772+c*.041555057407175,b=r*.055630079696993+l*-.20397695888897+c*1.056971514242878,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:n=n*12.92,x=x>.0031308?1.055*Math.pow(x,1/2.4)-.055:x=x*12.92,b=b>.0031308?1.055*Math.pow(b,1/2.4)-.055:b=b*12.92,n=Math.min(Math.max(0,n),1),x=Math.min(Math.max(0,x),1),b=Math.min(Math.max(0,b),1),[n*255,x*255,b*255]};Po.xyz=function(h,t){var r=h[0]/255,l=h[1]/255,c=h[2]/255;r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,l=l>.04045?Math.pow((l+.055)/1.055,2.4):l/12.92,c=c>.04045?Math.pow((c+.055)/1.055,2.4):c/12.92;var n=r*.41239079926595+l*.35758433938387+c*.18048078840183,x=r*.21263900587151+l*.71516867876775+c*.072192315360733,b=r*.019330818715591+l*.11919477979462+c*.95053215224966;return t=t||Sl.whitepoint[2].E,[n*t[0],x*t[1],b*t[2]]};var Cn=Sl;var wf={name:"luv",min:[0,-134,-140],max:[100,224,122],channel:["lightness","u","v"],alias:["LUV","cieluv","cie1976"],xyz:function(h,t,r){var l,c,n,x,b,S,R,E,A,z,W,re,me;if(n=h[0],x=h[1],b=h[2],n===0)return[0,0,0];var ge=.0011070564598794539;return t=t||"D65",r=r||2,A=Cn.whitepoint[r][t][0],z=Cn.whitepoint[r][t][1],W=Cn.whitepoint[r][t][2],re=4*A/(A+15*z+3*W),me=9*z/(A+15*z+3*W),l=x/(13*n)+re||0,c=b/(13*n)+me||0,R=n>8?z*Math.pow((n+16)/116,3):z*n*ge,S=R*9*l/(4*c)||0,E=R*(12-3*l-20*c)/(4*c)||0,[S,R,E]}};Cn.luv=function(h,t,r){var l,c,n,x,b,S,R,E,A,z,W,re,me,ge=.008856451679035631,be=903.2962962962961;t=t||"D65",r=r||2,A=Cn.whitepoint[r][t][0],z=Cn.whitepoint[r][t][1],W=Cn.whitepoint[r][t][2],re=4*A/(A+15*z+3*W),me=9*z/(A+15*z+3*W),S=h[0],R=h[1],E=h[2],l=4*S/(S+15*R+3*E)||0,c=9*R/(S+15*R+3*E)||0;var ve=R/z;return n=ve<=ge?be*ve:116*Math.pow(ve,1/3)-16,x=13*n*(l-re),b=13*n*(c-me),[n,x,b]};var Yb={name:"lchuv",channel:["lightness","chroma","hue"],alias:["LCHuv","cielchuv"],min:[0,0,0],max:[100,100,360],luv:function(h){var t=h[0],r=h[1],l=h[2],c,n,x;return x=l/360*2*Math.PI,c=r*Math.cos(x),n=r*Math.sin(x),[t,c,n]},xyz:function(h){return wf.xyz(Yb.luv(h))}},Kb=Yb;wf.lchuv=function(h){var t=h[0],r=h[1],l=h[2],c=Math.sqrt(r*r+l*l),n=Math.atan2(l,r),x=n*360/2/Math.PI;return x<0&&(x+=360),[t,c,x]};Cn.lchuv=function(h){return wf.lchuv(Cn.luv(h))};var G_=Us(Qb(),1),t1=QT,e1={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function QT(h){var t,r=[],l=1,c;if(typeof h=="number")return{space:"rgb",values:[h>>>16,(h&65280)>>>8,h&255],alpha:1};if(typeof h=="number")return{space:"rgb",values:[h>>>16,(h&65280)>>>8,h&255],alpha:1};if(h=String(h).toLowerCase(),G_.default[h])r=G_.default[h].slice(),c="rgb";else if(h==="transparent")l=0,c="rgb",r=[0,0,0];else if(h[0]==="#"){var n=h.slice(1),x=n.length,b=x<=4;l=1,b?(r=[parseInt(n[0]+n[0],16),parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16)],x===4&&(l=parseInt(n[3]+n[3],16)/255)):(r=[parseInt(n[0]+n[1],16),parseInt(n[2]+n[3],16),parseInt(n[4]+n[5],16)],x===8&&(l=parseInt(n[6]+n[7],16)/255)),r[0]||(r[0]=0),r[1]||(r[1]=0),r[2]||(r[2]=0),c="rgb"}else if(t=/^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(h)){var S=t[1];c=S.replace(/a$/,"");var R=c==="cmyk"?4:c==="gray"?1:3;r=t[2].trim().split(/\s*[,\/]\s*|\s+/),c==="color"&&(c=r.shift()),r=r.map(function(E,A){if(E[E.length-1]==="%")return E=parseFloat(E)/100,A===3?E:c==="rgb"?E*255:c[0]==="h"||c[0]==="l"&&!A?E*100:c==="lab"?E*125:c==="lch"?A<2?E*150:E*360:c[0]==="o"&&!A?E:c==="oklab"?E*.4:c==="oklch"?A<2?E*.4:E*360:E;if(c[A]==="h"||A===2&&c[c.length-1]==="h"){if(e1[E]!==void 0)return e1[E];if(E.endsWith("deg"))return parseFloat(E);if(E.endsWith("turn"))return parseFloat(E)*360;if(E.endsWith("grad"))return parseFloat(E)*360/400;if(E.endsWith("rad"))return parseFloat(E)*180/Math.PI}return E==="none"?0:parseFloat(E)}),l=r.length>R?r.pop():1}else/[0-9](?:\s|\/|,)/.test(h)&&(r=h.match(/([0-9]+)/g).map(function(E){return parseFloat(E)}),c=h.match(/([a-z])/ig)?.join("")?.toLowerCase()||"rgb");return{space:c,values:r,alpha:l}}var Sf={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(h){var t=h[0]/360,r=h[1]/100,l=h[2]/100,c,n,x,b,S,R=0;if(r===0)return S=l*255,[S,S,S];for(n=l<.5?l*(1+r):l+r-l*r,c=2*l-n,b=[0,0,0];R<3;)x=t+1/3*-(R-1),x<0?x++:x>1&&x--,S=6*x<1?c+(n-c)*6*x:2*x<1?n:3*x<2?c+(n-c)*(2/3-x)*6:c,b[R++]=S*255;return b}};Po.hsl=function(h){var t=h[0]/255,r=h[1]/255,l=h[2]/255,c=Math.min(t,r,l),n=Math.max(t,r,l),x=n-c,b,S,R;return n===c?b=0:t===n?b=(r-l)/x:r===n?b=2+(l-t)/x:l===n&&(b=4+(t-r)/x),b=Math.min(b*60,360),b<0&&(b+=360),R=(c+n)/2,n===c?S=0:R<=.5?S=x/(n+c):S=x/(2-n-c),[b,S*100,R*100]};function V_(h){Array.isArray(h)&&h.raw&&(h=String.raw(...arguments)),h instanceof Number&&(h=+h);var t,r,l,c=t1(h);if(!c.space)return[];let n=c.space[0]==="h"?Sf.min:Po.min,x=c.space[0]==="h"?Sf.max:Po.max;return t=Array(3),t[0]=Math.min(Math.max(c.values[0],n[0]),x[0]),t[1]=Math.min(Math.max(c.values[1],n[1]),x[1]),t[2]=Math.min(Math.max(c.values[2],n[2]),x[2]),c.space[0]==="h"&&(t=Sf.rgb(t)),t.push(Math.min(Math.max(c.alpha,0),1)),t}var Tf=[NaN,NaN,NaN,0];function i1(h){return typeof h=="string"?h:id(h)}var eC=1024,ed={},U_=0;function r1(h){if(h.length===4)return h;let t=h.slice();return t[3]=1,t}function Z_(h){let t=Cn.lchuv(Po.xyz(h));return t[3]=h[3],t}function n1(h){let t=Cn.rgb(Kb.xyz(h));return t[3]=h[3],t}function td(h){if(h==="none")return Tf;if(ed.hasOwnProperty(h))return ed[h];if(U_>=eC){let r=0;for(let l in ed)r++&3||(delete ed[l],--U_)}let t=V_(h);if(t.length!==4)throw new Error('failed to parse "'+h+'" as color');for(let r of t)if(isNaN(r))throw new Error('failed to parse "'+h+'" as color');return q_(t),ed[h]=t,++U_,t}function Ls(h){return Array.isArray(h)?h:td(h)}function q_(h){return h[0]=Pi(h[0]+.5|0,0,255),h[1]=Pi(h[1]+.5|0,0,255),h[2]=Pi(h[2]+.5|0,0,255),h[3]=Pi(h[3],0,1),h}function id(h){let t=h[0];t!=(t|0)&&(t=t+.5|0);let r=h[1];r!=(r|0)&&(r=r+.5|0);let l=h[2];l!=(l|0)&&(l=l+.5|0);let c=h[3]===void 0?1:Math.round(h[3]*1e3)/1e3;return"rgba("+t+","+r+","+l+","+c+")"}var ga=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",bD=ga.includes("firefox"),tC=ga.includes("safari")&&!ga.includes("chrom"),wD=tC&&(ga.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(ga)),SD=ga.includes("webkit")&&!ga.includes("edge"),TD=ga.includes("macintosh");var Cf=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,s1=typeof Image<"u"&&Image.prototype.decode;var CD=function(){let h=!1;try{let t=Object.defineProperty({},"passive",{get:function(){h=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return h}();function Fi(h,t,r,l){let c;return r&&r.length?c=r.shift():Cf?c=new OffscreenCanvas(h||300,t||300):c=document.createElement("canvas"),h&&(c.width=h),t&&(c.height=t),c.getContext("2d",l)}var W_;function Gc(){return W_||(W_=Fi(1,1)),W_}function o1(h){let t=h.canvas;t.width=1,t.height=1,h.clearRect(0,0,1,1)}function iC(h,t){return new Promise((r,l)=>{function c(){x(),r(h)}function n(){x(),l(new Error("Image load error"))}function x(){h.removeEventListener("load",c),h.removeEventListener("error",n)}h.addEventListener("load",c),h.addEventListener("error",n),t&&(h.src=t)})}function a1(h,t){return t&&(h.src=t),h.src&&s1?new Promise((r,l)=>h.decode().then(()=>r(h)).catch(c=>h.complete&&h.width?r(h):l(c))):iC(h)}var X_=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(let r in this.cache_){let l=this.cache_[r];!(t++&3)&&!l.hasListener()&&(delete this.cache_[r],delete this.patternCache_[r],--this.cacheSize_)}}}get(t,r,l){let c=$_(t,r,l);return c in this.cache_?this.cache_[c]:null}getPattern(t,r,l){let c=$_(t,r,l);return c in this.patternCache_?this.patternCache_[c]:null}set(t,r,l,c,n){let x=$_(t,r,l),b=x in this.cache_;this.cache_[x]=c,n&&(c.getImageState()===Mt.IDLE&&c.load(),c.getImageState()===Mt.LOADING?c.ready().then(()=>{this.patternCache_[x]=Gc().createPattern(c.getImage(1),"repeat")}):this.patternCache_[x]=Gc().createPattern(c.getImage(1),"repeat")),b||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};function $_(h,t,r){let l=r?Ls(r):"null";return t+":"+h+":"+l}var Yn=new X_;var rd=null,Mf=class extends Xp{constructor(t,r,l,c,n){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=l,this.canvas_={},this.color_=n,this.imageState_=c===void 0?Mt.IDLE:c,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=r,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Mt.LOADED){rd||(rd=Fi(1,1,void 0,{willReadFrequently:!0})),rd.drawImage(this.image_,0,0);try{rd.getImageData(0,0,1,1),this.tainted_=!1}catch{rd=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(gi.CHANGE)}handleImageError_(){this.imageState_=Mt.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Mt.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let t=this.size_[0],r=this.size_[1],l=Fi(t,r);l.fillRect(0,0,t,r),this.hitDetectionImage_=l.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Mt.IDLE){this.image_||this.initializeImage_(),this.imageState_=Mt.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&a1(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==Mt.LOADED)return;let r=this.image_,l=Fi(Math.ceil(r.width*t),Math.ceil(r.height*t)),c=l.canvas;l.scale(t,t),l.drawImage(r,0,0),l.globalCompositeOperation="multiply",l.fillStyle=i1(this.color_),l.fillRect(0,0,c.width/t,c.height/t),l.globalCompositeOperation="destination-in",l.drawImage(r,0,0),this.canvas_[t]=c}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===Mt.LOADED||this.imageState_===Mt.ERROR)t();else{let r=()=>{(this.imageState_===Mt.LOADED||this.imageState_===Mt.ERROR)&&(this.removeEventListener(gi.CHANGE,r),t())};this.addEventListener(gi.CHANGE,r)}})),this.ready_}};function Vc(h,t,r,l,c,n){let x=t===void 0?void 0:Yn.get(t,r,c);return x||(x=new Mf(h,h&&"src"in h?h.src||void 0:t,r,l,c),Yn.set(t,r,c,x,n)),n&&x&&!Yn.getPattern(t,r,c)&&Yn.set(t,r,c,x,n),x}var l1=Mf;var H_=class h{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,t.color!==void 0&&this.setColor(t.color)}clone(){let t=this.getColor();return new h({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(t!==null&&typeof t=="object"&&"src"in t){let r=Vc(null,t.src,"anonymous",void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));r.ready().then(()=>{this.patternImage_=null}),r.getImageState()===Mt.IDLE&&r.load(),r.getImageState()===Mt.LOADING&&(this.patternImage_=r)}this.color_=t}getKey(){let t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?Gt(t):typeof t=="object"&&"src"in t?t.src+":"+t.offset:Ls(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},zr=H_;var Y_=class h{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=t.lineDash!==void 0?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){let t=this.getColor();return new h({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}},cr=Y_;function $s(h,t){return Array.isArray(h)?h:(t===void 0?t=[h,h]:(t[0]=h,t[1]=h),t)}var K_=class h{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=$s(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){let t=this.getScale();return new h({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return Tt()}getImage(t){return Tt()}getHitDetectionImage(){return Tt()}getPixelRatio(t){return 1}getImageState(){return Tt()}getImageSize(){return Tt()}getOrigin(){return Tt()}getSize(){return Tt()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=$s(t)}listenImageChange(t){Tt()}load(){Tt()}unlistenImageChange(t){Tt()}ready(){return Promise.resolve()}},If=K_;function Mn(h){return h?Array.isArray(h)?id(h):typeof h=="object"&&"src"in h?rC(h):h:null}function rC(h){if(!h.offset||!h.size)return Yn.getPattern(h.src,"anonymous",h.color);let t=h.src+":"+h.offset,r=Yn.getPattern(t,void 0,h.color);if(r)return r;let l=Yn.get(h.src,"anonymous",null);if(l.getImageState()!==Mt.LOADED)return null;let c=Fi(h.size[0],h.size[1]);return c.drawImage(l.getImage(1),h.offset[0],h.offset[1],h.size[0],h.size[1],0,0,h.size[0],h.size[1]),Vc(c.canvas,t,void 0,Mt.LOADED,h.color,!0),Yn.getPattern(t,void 0,h.color)}var nC=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z]+?)\\s*$`].join(""),"i"),c1=["style","variant","weight","size","lineHeight","family"],J_=function(h){let t=h.match(nC);if(!t)return null;let r={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let l=0,c=c1.length;l<c;++l){let n=t[l+1];n!==void 0&&(r[c1[l]]=n)}return r.families=r.family.split(/,\s?/),r};var Pf="10px sans-serif",hr="#000",Xs="round",In=[],En=0,Hs="round",Ro=10,Ao="#000",ya="center",Tl="middle",Lo=[0,0,0,0],ko=1,_a=new xr,Uc=null,Q_,ey={},h1=function(){let t="32px ",r=["monospace","serif"],l=r.length,c="wmytzilWMYTZIL@#/&?$%10\uF013",n,x;function b(R,E,A){let z=!0;for(let W=0;W<l;++W){let re=r[W];if(x=Ef(R+" "+E+" "+t+re,c),A!=re){let me=Ef(R+" "+E+" "+t+A+","+re,c);z=z&&me!=x}}return!!z}function S(){let R=!0,E=_a.getKeys();for(let A=0,z=E.length;A<z;++A){let W=E[A];if(_a.get(W)<100){let[re,me,ge]=W.split(`
726
726
  `);b(re,me,ge)?(Tc(ey),Uc=null,Q_=void 0,_a.set(W,100)):(_a.set(W,_a.get(W)+1,!0),R=!1)}}R&&(clearInterval(n),n=void 0)}return function(R){let E=J_(R);if(!E)return;let A=E.families;for(let z=0,W=A.length;z<W;++z){let re=A[z],me=E.style+`
727
727
  `+E.weight+`
728
728
  `+re;_a.get(me)===void 0&&(_a.set(me,100,!0),b(E.style,E.weight,re)||(_a.set(me,0,!0),n===void 0&&(n=setInterval(S,32))))}}}(),sC=function(){let h;return function(t){let r=ey[t];if(r==null){if(Cf){let l=J_(t),c=u1(t,"\u017Dg");r=(isNaN(Number(l.lineHeight))?1.2:Number(l.lineHeight))*(c.actualBoundingBoxAscent+c.actualBoundingBoxDescent)}else h||(h=document.createElement("div"),h.innerHTML="M",h.style.minHeight="0",h.style.maxHeight="none",h.style.height="auto",h.style.padding="0",h.style.border="none",h.style.position="absolute",h.style.display="block",h.style.left="-99999px"),h.style.font=t,document.body.appendChild(h),r=h.offsetHeight,document.body.removeChild(h);ey[t]=r}return r}}();function u1(h,t){return Uc||(Uc=Fi(1,1)),h!=Q_&&(Uc.font=h,Q_=Uc.font),Uc.measureText(t)}function Ef(h,t){return u1(h,t).width}function ty(h,t,r){if(t in r)return r[t];let l=t.split(`
@@ -730,7 +730,7 @@ ${V.shaderPreludeCode.vertexSource}`,define:V.shaderDefine},defaultProjectionDat
730
730
  `||R===E){n=Math.max(n,x),c.push(x),x=0,b+=S,S=0;continue}let z=t[R+1]||h.font,W=Ef(z,A);r.push(W),x+=W;let re=sC(z);l.push(re),S=Math.max(S,re)}return{width:n,height:b,widths:r,heights:l,lineWidths:c}}function p1(h,t,r,l,c,n,x,b,S,R,E){h.save(),r!==1&&(h.globalAlpha===void 0?h.globalAlpha=A=>A.globalAlpha*=r:h.globalAlpha*=r),t&&h.transform.apply(h,t),l.contextInstructions?(h.translate(S,R),h.scale(E[0],E[1]),oC(l,h)):E[0]<0||E[1]<0?(h.translate(S,R),h.scale(E[0],E[1]),h.drawImage(l,c,n,x,b,0,0,x,b)):h.drawImage(l,c,n,x,b,S,R,x*E[0],b*E[1]),h.restore()}function oC(h,t){let r=h.contextInstructions;for(let l=0,c=r.length;l<c;l+=2)Array.isArray(r[l+1])?t[r[l]].apply(t,r[l+1]):t[r[l]]=r[l+1]}var iy=class h extends If{constructor(t){super({opacity:1,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,rotation:t.rotation!==void 0?t.rotation:0,scale:t.scale!==void 0?t.scale:1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Mt.LOADING:Mt.LOADED,this.imageState_===Mt.LOADING&&this.ready().then(()=>this.imageState_=Mt.LOADED),this.render()}clone(){let t=this.getScale(),r=new h({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return r.setOpacity(this.getOpacity()),r}getAnchor(){let t=this.size_,r=this.getDisplacement(),l=this.getScaleArray();return[t[0]/2-r[0]/l[0],t[1]/2+r[1]/l[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){let r=this.fill_?.getKey(),l=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${r}`+Object.values(this.renderOptions_).join(","),c=Yn.get(l,null,null)?.getImage(1);if(!c){let n=this.renderOptions_,x=Math.ceil(n.size*t),b=Fi(x,x);this.draw_(n,b,t),c=b.canvas,Yn.set(l,null,null,new l1(c,void 0,null,Mt.LOADED,null))}return c}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,r,l){if(r===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return r;let c=this.radius,n=this.radius2_===void 0?c:this.radius2_;if(c<n){let Re=c;c=n,n=Re}let x=this.radius2_===void 0?this.points_:this.points_*2,b=2*Math.PI/x,S=n*Math.sin(b),R=Math.sqrt(n*n-S*S),E=c-R,A=Math.sqrt(S*S+E*E),z=A/S;if(t==="miter"&&z<=l)return z*r;let W=r/2/z,re=r/2*(E/A),ge=Math.sqrt((c+W)*(c+W)+re*re)-c;if(this.radius2_===void 0||t==="bevel")return ge*2;let be=c*Math.sin(b),ve=Math.sqrt(c*c-be*be),De=n-ve,je=Math.sqrt(be*be+De*De)/be;if(je<=l){let Re=je*r/2-n-c;return 2*Math.max(ge,Re)}return ge*2}createRenderOptions(){let t=Xs,r=Hs,l=0,c=null,n=0,x,b=0;this.stroke_&&(x=Mn(this.stroke_.getColor()??Ao),b=this.stroke_.getWidth()??ko,c=this.stroke_.getLineDash(),n=this.stroke_.getLineDashOffset()??0,r=this.stroke_.getLineJoin()??Hs,t=this.stroke_.getLineCap()??Xs,l=this.stroke_.getMiterLimit()??Ro);let S=this.calculateLineJoinSize_(r,b,l),R=Math.max(this.radius,this.radius2_||0),E=Math.ceil(2*R+S);return{strokeStyle:x,strokeWidth:b,size:E,lineCap:t,lineDash:c,lineDashOffset:n,lineJoin:r,miterLimit:l}}render(){this.renderOptions_=this.createRenderOptions();let t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,r,l){if(r.scale(l,l),r.translate(t.size/2,t.size/2),this.createPath_(r),this.fill_){let c=this.fill_.getColor();c===null&&(c=hr),r.fillStyle=Mn(c),r.fill()}t.strokeStyle&&(r.strokeStyle=t.strokeStyle,r.lineWidth=t.strokeWidth,t.lineDash&&(r.setLineDash(t.lineDash),r.lineDashOffset=t.lineDashOffset),r.lineCap=t.lineCap,r.lineJoin=t.lineJoin,r.miterLimit=t.miterLimit,r.stroke())}createHitDetectionCanvas_(t){let r;if(this.fill_){let l=this.fill_.getColor(),c=0;typeof l=="string"&&(l=Ls(l)),l===null?c=1:Array.isArray(l)&&(c=l.length===4?l[3]:1),c===0&&(r=Fi(t.size,t.size),this.drawHitDetectionCanvas_(t,r))}return r?r.canvas:this.getImage(1)}createPath_(t){let r=this.points_,l=this.radius;if(r===1/0)t.arc(0,0,l,0,2*Math.PI);else{let c=this.radius2_===void 0?l:this.radius2_;this.radius2_!==void 0&&(r*=2);let n=this.angle_-Math.PI/2,x=2*Math.PI/r;for(let b=0;b<r;b++){let S=n+b*x,R=b%2===0?l:c;t.lineTo(R*Math.cos(S),R*Math.sin(S))}t.closePath()}}drawHitDetectionCanvas_(t,r){r.translate(t.size/2,t.size/2),this.createPath_(r),r.fillStyle=hr,r.fill(),t.strokeStyle&&(r.strokeStyle=t.strokeStyle,r.lineWidth=t.strokeWidth,t.lineDash&&(r.setLineDash(t.lineDash),r.lineDashOffset=t.lineDashOffset),r.lineJoin=t.lineJoin,r.miterLimit=t.miterLimit,r.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},Rf=iy;var ry=class h extends Rf{constructor(t){t=t||{radius:5},super({points:1/0,fill:t.fill,radius:t.radius,stroke:t.stroke,scale:t.scale!==void 0?t.scale:1,rotation:t.rotation!==void 0?t.rotation:0,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){let t=this.getScale(),r=new h({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return r.setOpacity(this.getOpacity()),r}setRadius(t){this.radius=t,this.render()}},Pn=ry;var xa=class h{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=f1,t.geometry!==void 0&&this.setGeometry(t.geometry),this.fill_=t.fill!==void 0?t.fill:null,this.image_=t.image!==void 0?t.image:null,this.renderer_=t.renderer!==void 0?t.renderer:null,this.hitDetectionRenderer_=t.hitDetectionRenderer!==void 0?t.hitDetectionRenderer:null,this.stroke_=t.stroke!==void 0?t.stroke:null,this.text_=t.text!==void 0?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&typeof t=="object"&&(t=t.clone()),new h({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){typeof t=="function"?this.geometryFunction_=t:typeof t=="string"?this.geometryFunction_=function(r){return r.get(t)}:t?t!==void 0&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=f1,this.geometry_=t}setZIndex(t){this.zIndex_=t}};function m1(h){let t;if(typeof h=="function")t=h;else{let r;Array.isArray(h)?r=h:(di(typeof h.getZIndex=="function","Expected an `Style` or an array of `Style`"),r=[h]),t=function(){return r}}return t}var ny=null;function sy(h,t){if(!ny){let r=new zr({color:"rgba(255,255,255,0.4)"}),l=new cr({color:"#3399CC",width:1.25});ny=[new xa({image:new Pn({fill:r,stroke:l,radius:5}),fill:r,stroke:l})]}return ny}function g1(){let h={},t=[255,255,255,1],r=[0,153,255,1],l=3;return h.Polygon=[new xa({fill:new zr({color:[255,255,255,.5]})})],h.MultiPolygon=h.Polygon,h.LineString=[new xa({stroke:new cr({color:t,width:l+2})}),new xa({stroke:new cr({color:r,width:l})})],h.MultiLineString=h.LineString,h.Circle=h.Polygon.concat(h.LineString),h.Point=[new xa({image:new Pn({radius:l*2,fill:new zr({color:r}),stroke:new cr({color:t,width:l/2})}),zIndex:1/0})],h.MultiPoint=h.Point,h.GeometryCollection=h.Polygon.concat(h.LineString,h.Point),h}function f1(h){return h.getGeometry()}var Or=xa;var aC="#333",oy=class h{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=$s(t.scale!==void 0?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=t.fill!==void 0?t.fill:new zr({color:aC}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding,this.declutterMode_=t.declutterMode}clone(){let t=this.getScale();return new h({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=$s(t!==void 0?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}},_1=oy;function Af(h,t,r=0,l=h.length-1,c=lC){for(;l>r;){if(l-r>600){let S=l-r+1,R=t-r+1,E=Math.log(S),A=.5*Math.exp(2*E/3),z=.5*Math.sqrt(E*A*(S-A)/S)*(R-S/2<0?-1:1),W=Math.max(r,Math.floor(t-R*A/S+z)),re=Math.min(l,Math.floor(t+(S-R)*A/S+z));Af(h,t,W,re,c)}let n=h[t],x=r,b=l;for(nd(h,r,t),c(h[l],n)>0&&nd(h,r,l);x<b;){for(nd(h,x,b),x++,b--;c(h[x],n)<0;)x++;for(;c(h[b],n)>0;)b--}c(h[r],n)===0?nd(h,r,b):(b++,nd(h,b,l)),b<=t&&(r=b+1),t<=b&&(l=b-1)}}function nd(h,t,r){let l=h[t];h[t]=h[r],h[r]=l}function lC(h,t){return h<t?-1:h>t?1:0}var Cl=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let r=this.data,l=[];if(!kf(t,r))return l;let c=this.toBBox,n=[];for(;r;){for(let x=0;x<r.children.length;x++){let b=r.children[x],S=r.leaf?c(b):b;kf(t,S)&&(r.leaf?l.push(b):ly(t,S)?this._all(b,l):n.push(b))}r=n.pop()}return l}collides(t){let r=this.data;if(!kf(t,r))return!1;let l=[];for(;r;){for(let c=0;c<r.children.length;c++){let n=r.children[c],x=r.leaf?this.toBBox(n):n;if(kf(t,x)){if(r.leaf||ly(t,x))return!0;l.push(n)}}r=l.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let l=0;l<t.length;l++)this.insert(t[l]);return this}let r=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=r;else if(this.data.height===r.height)this._splitRoot(this.data,r);else{if(this.data.height<r.height){let l=this.data;this.data=r,r=l}this._insert(r,this.data.height-r.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=qc([]),this}remove(t,r){if(!t)return this;let l=this.data,c=this.toBBox(t),n=[],x=[],b,S,R;for(;l||n.length;){if(l||(l=n.pop(),S=n[n.length-1],b=x.pop(),R=!0),l.leaf){let E=cC(t,l.children,r);if(E!==-1)return l.children.splice(E,1),n.push(l),this._condense(n),this}!R&&!l.leaf&&ly(l,c)?(n.push(l),x.push(b),b=0,S=l,l=l.children[0]):S?(b++,l=S.children[b],R=!1):l=null}return this}toBBox(t){return t}compareMinX(t,r){return t.minX-r.minX}compareMinY(t,r){return t.minY-r.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,r){let l=[];for(;t;)t.leaf?r.push(...t.children):l.push(...t.children),t=l.pop();return r}_build(t,r,l,c){let n=l-r+1,x=this._maxEntries,b;if(n<=x)return b=qc(t.slice(r,l+1)),Zc(b,this.toBBox),b;c||(c=Math.ceil(Math.log(n)/Math.log(x)),x=Math.ceil(n/Math.pow(x,c-1))),b=qc([]),b.leaf=!1,b.height=c;let S=Math.ceil(n/x),R=S*Math.ceil(Math.sqrt(x));y1(t,r,l,R,this.compareMinX);for(let E=r;E<=l;E+=R){let A=Math.min(E+R-1,l);y1(t,E,A,S,this.compareMinY);for(let z=E;z<=A;z+=S){let W=Math.min(z+S-1,A);b.children.push(this._build(t,z,W,c-1))}}return Zc(b,this.toBBox),b}_chooseSubtree(t,r,l,c){for(;c.push(r),!(r.leaf||c.length-1===l);){let n=1/0,x=1/0,b;for(let S=0;S<r.children.length;S++){let R=r.children[S],E=ay(R),A=dC(t,R)-E;A<x?(x=A,n=E<n?E:n,b=R):A===x&&E<n&&(n=E,b=R)}r=b||r.children[0]}return r}_insert(t,r,l){let c=l?t:this.toBBox(t),n=[],x=this._chooseSubtree(c,this.data,r,n);for(x.children.push(t),od(x,c);r>=0&&n[r].children.length>this._maxEntries;)this._split(n,r),r--;this._adjustParentBBoxes(c,n,r)}_split(t,r){let l=t[r],c=l.children.length,n=this._minEntries;this._chooseSplitAxis(l,n,c);let x=this._chooseSplitIndex(l,n,c),b=qc(l.children.splice(x,l.children.length-x));b.height=l.height,b.leaf=l.leaf,Zc(l,this.toBBox),Zc(b,this.toBBox),r?t[r-1].children.push(b):this._splitRoot(l,b)}_splitRoot(t,r){this.data=qc([t,r]),this.data.height=t.height+1,this.data.leaf=!1,Zc(this.data,this.toBBox)}_chooseSplitIndex(t,r,l){let c,n=1/0,x=1/0;for(let b=r;b<=l-r;b++){let S=sd(t,0,b,this.toBBox),R=sd(t,b,l,this.toBBox),E=pC(S,R),A=ay(S)+ay(R);E<n?(n=E,c=b,x=A<x?A:x):E===n&&A<x&&(x=A,c=b)}return c||l-r}_chooseSplitAxis(t,r,l){let c=t.leaf?this.compareMinX:hC,n=t.leaf?this.compareMinY:uC,x=this._allDistMargin(t,r,l,c),b=this._allDistMargin(t,r,l,n);x<b&&t.children.sort(c)}_allDistMargin(t,r,l,c){t.children.sort(c);let n=this.toBBox,x=sd(t,0,r,n),b=sd(t,l-r,l,n),S=Lf(x)+Lf(b);for(let R=r;R<l-r;R++){let E=t.children[R];od(x,t.leaf?n(E):E),S+=Lf(x)}for(let R=l-r-1;R>=r;R--){let E=t.children[R];od(b,t.leaf?n(E):E),S+=Lf(b)}return S}_adjustParentBBoxes(t,r,l){for(let c=l;c>=0;c--)od(r[c],t)}_condense(t){for(let r=t.length-1,l;r>=0;r--)t[r].children.length===0?r>0?(l=t[r-1].children,l.splice(l.indexOf(t[r]),1)):this.clear():Zc(t[r],this.toBBox)}};function cC(h,t,r){if(!r)return t.indexOf(h);for(let l=0;l<t.length;l++)if(r(h,t[l]))return l;return-1}function Zc(h,t){sd(h,0,h.children.length,t,h)}function sd(h,t,r,l,c){c||(c=qc(null)),c.minX=1/0,c.minY=1/0,c.maxX=-1/0,c.maxY=-1/0;for(let n=t;n<r;n++){let x=h.children[n];od(c,h.leaf?l(x):x)}return c}function od(h,t){return h.minX=Math.min(h.minX,t.minX),h.minY=Math.min(h.minY,t.minY),h.maxX=Math.max(h.maxX,t.maxX),h.maxY=Math.max(h.maxY,t.maxY),h}function hC(h,t){return h.minX-t.minX}function uC(h,t){return h.minY-t.minY}function ay(h){return(h.maxX-h.minX)*(h.maxY-h.minY)}function Lf(h){return h.maxX-h.minX+(h.maxY-h.minY)}function dC(h,t){return(Math.max(t.maxX,h.maxX)-Math.min(t.minX,h.minX))*(Math.max(t.maxY,h.maxY)-Math.min(t.minY,h.minY))}function pC(h,t){let r=Math.max(h.minX,t.minX),l=Math.max(h.minY,t.minY),c=Math.min(h.maxX,t.maxX),n=Math.min(h.maxY,t.maxY);return Math.max(0,c-r)*Math.max(0,n-l)}function ly(h,t){return h.minX<=t.minX&&h.minY<=t.minY&&t.maxX<=h.maxX&&t.maxY<=h.maxY}function kf(h,t){return t.minX<=h.maxX&&t.minY<=h.maxY&&t.maxX>=h.minX&&t.maxY>=h.minY}function qc(h){return{children:h,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function y1(h,t,r,l,c){let n=[t,r];for(;n.length;){if(r=n.pop(),t=n.pop(),r-t<=l)continue;let x=t+Math.ceil((r-t)/l/2)*l;Af(h,x,t,r,c),n.push(t,x,x,r)}}function x1(h,t,r,l){return r!==void 0&&l!==void 0?[r/h,l/t]:r!==void 0?r/h:l!==void 0?l/t:1}var cy=class h extends If{constructor(t){t=t||{};let r=t.opacity!==void 0?t.opacity:1,l=t.rotation!==void 0?t.rotation:0,c=t.scale!==void 0?t.scale:1,n=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:r,rotation:l,scale:c,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:n,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null;let x=t.img!==void 0?t.img:null,b=t.src;di(!(b!==void 0&&x),"`image` and `src` cannot be provided at the same time"),(b===void 0||b.length===0)&&x&&(b=x.src||Gt(x)),di(b!==void 0&&b.length>0,"A defined and non-empty `src` or `image` must be provided"),di(!((t.width!==void 0||t.height!==void 0)&&t.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let S;if(t.src!==void 0?S=Mt.IDLE:x!==void 0&&("complete"in x?x.complete?S=x.src?Mt.LOADED:Mt.IDLE:S=Mt.LOADING:S=Mt.LOADED),this.color_=t.color!==void 0?Ls(t.color):null,this.iconImage_=Vc(x,b,this.crossOrigin_,S,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,this.initialOptions_,t.width!==void 0||t.height!==void 0){let R,E;if(t.size)[R,E]=t.size;else{let A=this.getImage(1);if(A.width&&A.height)R=A.width,E=A.height;else if(A instanceof HTMLImageElement){this.initialOptions_=t;let z=()=>{if(this.unlistenImageChange(z),!this.initialOptions_)return;let W=this.iconImage_.getSize();this.setScale(x1(W[0],W[1],t.width,t.height))};this.listenImageChange(z);return}}R!==void 0&&this.setScale(x1(R,E,t.width,t.height))}}clone(){let t,r,l;return this.initialOptions_?(r=this.initialOptions_.width,l=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new h({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:r,height:l,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;let c=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!c)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=c[0]),this.anchorYUnits_=="fraction"&&(t[1]*=c[1])}if(this.anchorOrigin_!="top-left"){if(!c)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+c[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+c[1])}this.normalizedAnchor_=t}let r=this.getDisplacement(),l=this.getScaleArray();return[t[0]-r[0]/l[0],t[1]+r[1]/l[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){let r=this.getSize(),l=this.iconImage_.getSize();if(!r||!l)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=l[0]-r[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=l[1]-r[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==Mt.LOADED)return this.iconImage_.getSize()[0]*t[0]}getHeight(){let t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==Mt.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(gi.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(gi.CHANGE,t)}ready(){return this.iconImage_.ready()}},ad=cy;var Ml=0;var Jr=1<<Ml++,Zt=1<<Ml++,mn=1<<Ml++,Kn=1<<Ml++,ba=1<<Ml++,ld=1<<Ml++,Df=Math.pow(2,Ml)-1,uy={[Jr]:"boolean",[Zt]:"number",[mn]:"string",[Kn]:"color",[ba]:"number[]",[ld]:"size"},fC=Object.keys(uy).map(Number).sort(Ss);function mC(h){return h in uy}function cd(h){let t=[];for(let r of fC)hd(h,r)&&t.push(uy[r]);return t.length===0?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function hd(h,t){return(h&t)===t}function va(h,t){return h===t}var zi=class{constructor(t,r){if(!mC(t))throw new Error(`literal expressions must have a specific type, got ${cd(t)}`);this.type=t,this.value=r}},hy=class{constructor(t,r,...l){this.type=t,this.operator=r,this.args=l}};function dy(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1}}function wr(h,t,r){switch(typeof h){case"boolean":{if(va(t,mn))return new zi(mn,h?"true":"false");if(!hd(t,Jr))throw new Error(`got a boolean, but expected ${cd(t)}`);return new zi(Jr,h)}case"number":{if(va(t,ld))return new zi(ld,$s(h));if(va(t,Jr))return new zi(Jr,!!h);if(va(t,mn))return new zi(mn,h.toString());if(!hd(t,Zt))throw new Error(`got a number, but expected ${cd(t)}`);return new zi(Zt,h)}case"string":{if(va(t,Kn))return new zi(Kn,td(h));if(va(t,Jr))return new zi(Jr,!!h);if(!hd(t,mn))throw new Error(`got a string, but expected ${cd(t)}`);return new zi(mn,h)}default:}if(!Array.isArray(h))throw new Error("expression must be an array or a primitive value");if(h.length===0)throw new Error("empty expression");if(typeof h[0]=="string")return MC(h,t,r);for(let l of h)if(typeof l!="number")throw new Error("expected an array of numbers");if(va(t,ld)){if(h.length!==2)throw new Error(`expected an array of two values for a size, got ${h.length}`);return new zi(ld,h)}if(va(t,Kn)){if(h.length===3)return new zi(Kn,[...h,1]);if(h.length===4)return new zi(Kn,h);throw new Error(`expected an array of 3 or 4 values for a color, got ${h.length}`)}if(!hd(t,ba))throw new Error(`got an array of numbers, but expected ${cd(t)}`);return new zi(ba,h)}var Ne={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},gC={[Ne.Get]:Et(Dt(1,1/0),v1),[Ne.Var]:Et(Dt(1,1),_C),[Ne.Has]:Et(Dt(1,1/0),v1),[Ne.Id]:Et(yC,Wc),[Ne.Concat]:Et(Dt(2,1/0),Kt(mn)),[Ne.GeometryType]:Et(xC,Wc),[Ne.LineMetric]:Et(Wc),[Ne.Resolution]:Et(Wc),[Ne.Zoom]:Et(Wc),[Ne.Time]:Et(Wc),[Ne.Any]:Et(Dt(2,1/0),Kt(Jr)),[Ne.All]:Et(Dt(2,1/0),Kt(Jr)),[Ne.Not]:Et(Dt(1,1),Kt(Jr)),[Ne.Equal]:Et(Dt(2,2),Kt(Df)),[Ne.NotEqual]:Et(Dt(2,2),Kt(Df)),[Ne.GreaterThan]:Et(Dt(2,2),Kt(Zt)),[Ne.GreaterThanOrEqualTo]:Et(Dt(2,2),Kt(Zt)),[Ne.LessThan]:Et(Dt(2,2),Kt(Zt)),[Ne.LessThanOrEqualTo]:Et(Dt(2,2),Kt(Zt)),[Ne.Multiply]:Et(Dt(2,1/0),b1),[Ne.Coalesce]:Et(Dt(2,1/0),b1),[Ne.Divide]:Et(Dt(2,2),Kt(Zt)),[Ne.Add]:Et(Dt(2,1/0),Kt(Zt)),[Ne.Subtract]:Et(Dt(2,2),Kt(Zt)),[Ne.Clamp]:Et(Dt(3,3),Kt(Zt)),[Ne.Mod]:Et(Dt(2,2),Kt(Zt)),[Ne.Pow]:Et(Dt(2,2),Kt(Zt)),[Ne.Abs]:Et(Dt(1,1),Kt(Zt)),[Ne.Floor]:Et(Dt(1,1),Kt(Zt)),[Ne.Ceil]:Et(Dt(1,1),Kt(Zt)),[Ne.Round]:Et(Dt(1,1),Kt(Zt)),[Ne.Sin]:Et(Dt(1,1),Kt(Zt)),[Ne.Cos]:Et(Dt(1,1),Kt(Zt)),[Ne.Atan]:Et(Dt(1,2),Kt(Zt)),[Ne.Sqrt]:Et(Dt(1,1),Kt(Zt)),[Ne.Match]:Et(Dt(4,1/0),w1,bC),[Ne.Between]:Et(Dt(3,3),Kt(Zt)),[Ne.Interpolate]:Et(Dt(6,1/0),w1,wC),[Ne.Case]:Et(Dt(3,1/0),vC,SC),[Ne.In]:Et(Dt(2,2),TC),[Ne.Number]:Et(Dt(1,1/0),Kt(Df)),[Ne.String]:Et(Dt(1,1/0),Kt(Df)),[Ne.Array]:Et(Dt(1,1/0),Kt(Zt)),[Ne.Color]:Et(Dt(1,4),Kt(Zt)),[Ne.Band]:Et(Dt(1,3),Kt(Zt)),[Ne.Palette]:Et(Dt(2,2),CC),[Ne.ToString]:Et(Dt(1,1),Kt(Jr|Zt|mn|Kn))};function v1(h,t,r){let l=h.length-1,c=new Array(l);for(let n=0;n<l;++n){let x=h[n+1];switch(typeof x){case"number":{c[n]=new zi(Zt,x);break}case"string":{c[n]=new zi(mn,x);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${x}`)}n===0&&r.properties.add(String(x))}return c}function _C(h,t,r){let l=h[1];if(typeof l!="string")throw new Error("expected a string argument for var operation");return r.variables.add(l),[new zi(mn,l)]}function yC(h,t,r){r.featureId=!0}function xC(h,t,r){r.geometryType=!0}function Wc(h,t,r){let l=h[0];if(h.length!==1)throw new Error(`expected no arguments for ${l} operation`);return[]}function Dt(h,t){return function(r,l,c){let n=r[0],x=r.length-1;if(h===t){if(x!==h){let b=h===1?"":"s";throw new Error(`expected ${h} argument${b} for ${n}, got ${x}`)}}else if(x<h||x>t){let b=t===1/0?`${h} or more`:`${h} to ${t}`;throw new Error(`expected ${b} arguments for ${n}, got ${x}`)}}}function b1(h,t,r){let l=h.length-1,c=new Array(l);for(let n=0;n<l;++n){let x=wr(h[n+1],t,r);c[n]=x}return c}function Kt(h){return function(t,r,l){let c=t.length-1,n=new Array(c);for(let x=0;x<c;++x){let b=wr(t[x+1],h,l);n[x]=b}return n}}function vC(h,t,r){let l=h[0],c=h.length-1;if(c%2===0)throw new Error(`expected an odd number of arguments for ${l}, got ${c} instead`)}function w1(h,t,r){let l=h[0],c=h.length-1;if(c%2===1)throw new Error(`expected an even number of arguments for operation ${l}, got ${c} instead`)}function bC(h,t,r){let l=h.length-1,c=mn|Zt|Jr,n=wr(h[1],c,r),x=wr(h[h.length-1],t,r),b=new Array(l-2);for(let S=0;S<l-2;S+=2){try{let R=wr(h[S+2],n.type,r);b[S]=R}catch(R){throw new Error(`failed to parse argument ${S+1} of match expression: ${R.message}`)}try{let R=wr(h[S+3],x.type,r);b[S+1]=R}catch(R){throw new Error(`failed to parse argument ${S+2} of match expression: ${R.message}`)}}return[n,...b,x]}function wC(h,t,r){let l=h[1],c;switch(l[0]){case"linear":c=1;break;case"exponential":let S=l[1];if(typeof S!="number"||S<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(S)} instead`);c=S;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(l)}`)}let n=new zi(Zt,c),x;try{x=wr(h[2],Zt,r)}catch(S){throw new Error(`failed to parse argument 1 in interpolate expression: ${S.message}`)}let b=new Array(h.length-3);for(let S=0;S<b.length;S+=2){try{let R=wr(h[S+3],Zt,r);b[S]=R}catch(R){throw new Error(`failed to parse argument ${S+2} for interpolate expression: ${R.message}`)}try{let R=wr(h[S+4],t,r);b[S+1]=R}catch(R){throw new Error(`failed to parse argument ${S+3} for interpolate expression: ${R.message}`)}}return[n,x,...b]}function SC(h,t,r){let l=wr(h[h.length-1],t,r),c=new Array(h.length-1);for(let n=0;n<c.length-1;n+=2){try{let x=wr(h[n+1],Jr,r);c[n]=x}catch(x){throw new Error(`failed to parse argument ${n} of case expression: ${x.message}`)}try{let x=wr(h[n+2],l.type,r);c[n+1]=x}catch(x){throw new Error(`failed to parse argument ${n+1} of case expression: ${x.message}`)}}return c[c.length-1]=l,c}function TC(h,t,r){let l=h[2];if(!Array.isArray(l))throw new Error('the second argument for the "in" operator must be an array');let c;if(typeof l[0]=="string"){if(l[0]!=="literal")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(l[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');l=l[1],c=mn}else c=Zt;let n=new Array(l.length);for(let b=0;b<n.length;b++)try{let S=wr(l[b],c,r);n[b]=S}catch(S){throw new Error(`failed to parse haystack item ${b} for "in" expression: ${S.message}`)}return[wr(h[1],c,r),...n]}function CC(h,t,r){let l;try{l=wr(h[1],Zt,r)}catch(x){throw new Error(`failed to parse first argument in palette expression: ${x.message}`)}let c=h[2];if(!Array.isArray(c))throw new Error("the second argument of palette must be an array");let n=new Array(c.length);for(let x=0;x<n.length;x++){let b;try{b=wr(c[x],Kn,r)}catch(S){throw new Error(`failed to parse color at index ${x} in palette expression: ${S.message}`)}if(!(b instanceof zi))throw new Error(`the palette color at index ${x} must be a literal value`);n[x]=b}return[l,...n]}function Et(...h){return function(t,r,l){let c=t[0],n;for(let x=0;x<h.length;x++){let b=h[x](t,r,l);if(x==h.length-1){if(!b)throw new Error("expected last argument validator to return the parsed args");n=b}}return new hy(r,c,...n)}}function MC(h,t,r){let l=h[0],c=gC[l];if(!c)throw new Error(`unknown operator: ${l}`);return c(h,t,r)}function py(h){if(!h)return"";let t=h.getType();switch(t){case"Point":case"LineString":case"Polygon":return t;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return t.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return py(h.getGeometries()[0]);default:return""}}function fy(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Ys(h,t,r){let l=wr(h,t,r);return ks(l,r)}function ks(h,t){if(h instanceof zi){if(h.type===Kn&&typeof h.value=="string"){let l=td(h.value);return function(){return l}}return function(){return h.value}}let r=h.operator;switch(r){case Ne.Number:case Ne.String:case Ne.Coalesce:return IC(h,t);case Ne.Get:case Ne.Var:case Ne.Has:return EC(h,t);case Ne.Id:return l=>l.featureId;case Ne.GeometryType:return l=>l.geometryType;case Ne.Concat:{let l=h.args.map(c=>ks(c,t));return c=>"".concat(...l.map(n=>n(c).toString()))}case Ne.Resolution:return l=>l.resolution;case Ne.Any:case Ne.All:case Ne.Between:case Ne.In:case Ne.Not:return RC(h,t);case Ne.Equal:case Ne.NotEqual:case Ne.LessThan:case Ne.LessThanOrEqualTo:case Ne.GreaterThan:case Ne.GreaterThanOrEqualTo:return PC(h,t);case Ne.Multiply:case Ne.Divide:case Ne.Add:case Ne.Subtract:case Ne.Clamp:case Ne.Mod:case Ne.Pow:case Ne.Abs:case Ne.Floor:case Ne.Ceil:case Ne.Round:case Ne.Sin:case Ne.Cos:case Ne.Atan:case Ne.Sqrt:return AC(h,t);case Ne.Case:return LC(h,t);case Ne.Match:return kC(h,t);case Ne.Interpolate:return DC(h,t);case Ne.ToString:return FC(h,t);default:throw new Error(`Unsupported operator ${r}`)}}function IC(h,t){let r=h.operator,l=h.args.length,c=new Array(l);for(let n=0;n<l;++n)c[n]=ks(h.args[n],t);switch(r){case Ne.Coalesce:return n=>{for(let x=0;x<l;++x){let b=c[x](n);if(typeof b<"u"&&b!==null)return b}throw new Error("Expected one of the values to be non-null")};case Ne.Number:case Ne.String:return n=>{for(let x=0;x<l;++x){let b=c[x](n);if(typeof b===r)return b}throw new Error(`Expected one of the values to be a ${r}`)};default:throw new Error(`Unsupported assertion operator ${r}`)}}function EC(h,t){let l=h.args[0].value;switch(h.operator){case Ne.Get:return c=>{let n=h.args,x=c.properties[l];for(let b=1,S=n.length;b<S;++b){let E=n[b].value;x=x[E]}return x};case Ne.Var:return c=>c.variables[l];case Ne.Has:return c=>{let n=h.args;if(!(l in c.properties))return!1;let x=c.properties[l];for(let b=1,S=n.length;b<S;++b){let E=n[b].value;if(!x||!Object.hasOwn(x,E))return!1;x=x[E]}return!0};default:throw new Error(`Unsupported accessor operator ${h.operator}`)}}function PC(h,t){let r=h.operator,l=ks(h.args[0],t),c=ks(h.args[1],t);switch(r){case Ne.Equal:return n=>l(n)===c(n);case Ne.NotEqual:return n=>l(n)!==c(n);case Ne.LessThan:return n=>l(n)<c(n);case Ne.LessThanOrEqualTo:return n=>l(n)<=c(n);case Ne.GreaterThan:return n=>l(n)>c(n);case Ne.GreaterThanOrEqualTo:return n=>l(n)>=c(n);default:throw new Error(`Unsupported comparison operator ${r}`)}}function RC(h,t){let r=h.operator,l=h.args.length,c=new Array(l);for(let n=0;n<l;++n)c[n]=ks(h.args[n],t);switch(r){case Ne.Any:return n=>{for(let x=0;x<l;++x)if(c[x](n))return!0;return!1};case Ne.All:return n=>{for(let x=0;x<l;++x)if(!c[x](n))return!1;return!0};case Ne.Between:return n=>{let x=c[0](n),b=c[1](n),S=c[2](n);return x>=b&&x<=S};case Ne.In:return n=>{let x=c[0](n);for(let b=1;b<l;++b)if(x===c[b](n))return!0;return!1};case Ne.Not:return n=>!c[0](n);default:throw new Error(`Unsupported logical operator ${r}`)}}function AC(h,t){let r=h.operator,l=h.args.length,c=new Array(l);for(let n=0;n<l;++n)c[n]=ks(h.args[n],t);switch(r){case Ne.Multiply:return n=>{let x=1;for(let b=0;b<l;++b)x*=c[b](n);return x};case Ne.Divide:return n=>c[0](n)/c[1](n);case Ne.Add:return n=>{let x=0;for(let b=0;b<l;++b)x+=c[b](n);return x};case Ne.Subtract:return n=>c[0](n)-c[1](n);case Ne.Clamp:return n=>{let x=c[0](n),b=c[1](n);if(x<b)return b;let S=c[2](n);return x>S?S:x};case Ne.Mod:return n=>c[0](n)%c[1](n);case Ne.Pow:return n=>Math.pow(c[0](n),c[1](n));case Ne.Abs:return n=>Math.abs(c[0](n));case Ne.Floor:return n=>Math.floor(c[0](n));case Ne.Ceil:return n=>Math.ceil(c[0](n));case Ne.Round:return n=>Math.round(c[0](n));case Ne.Sin:return n=>Math.sin(c[0](n));case Ne.Cos:return n=>Math.cos(c[0](n));case Ne.Atan:return l===2?n=>Math.atan2(c[0](n),c[1](n)):n=>Math.atan(c[0](n));case Ne.Sqrt:return n=>Math.sqrt(c[0](n));default:throw new Error(`Unsupported numeric operator ${r}`)}}function LC(h,t){let r=h.args.length,l=new Array(r);for(let c=0;c<r;++c)l[c]=ks(h.args[c],t);return c=>{for(let n=0;n<r-1;n+=2)if(l[n](c))return l[n+1](c);return l[r-1](c)}}function kC(h,t){let r=h.args.length,l=new Array(r);for(let c=0;c<r;++c)l[c]=ks(h.args[c],t);return c=>{let n=l[0](c);for(let x=1;x<r;x+=2)if(n===l[x](c))return l[x+1](c);return l[r-1](c)}}function DC(h,t){let r=h.args.length,l=new Array(r);for(let c=0;c<r;++c)l[c]=ks(h.args[c],t);return c=>{let n=l[0](c),x=l[1](c),b,S;for(let R=2;R<r;R+=2){let E=l[R](c),A=l[R+1](c),z=Array.isArray(A);if(z&&(A=r1(A)),E>=x)return R===2?A:z?zC(n,x,b,S,E,A):ud(n,x,b,S,E,A);b=E,S=A}return S}}function FC(h,t){let r=h.operator,l=h.args.length,c=new Array(l);for(let n=0;n<l;++n)c[n]=ks(h.args[n],t);switch(r){case Ne.ToString:return n=>{let x=c[0](n);return h.args[0].type===Kn?id(x):x.toString()};default:throw new Error(`Unsupported convert operator ${r}`)}}function ud(h,t,r,l,c,n){let x=c-r;if(x===0)return l;let b=t-r,S=h===1?b/x:(Math.pow(h,b)-1)/(Math.pow(h,x)-1);return l+S*(n-l)}function zC(h,t,r,l,c,n){if(c-r===0)return l;let b=Z_(l),S=Z_(n),R=S[2]-b[2];R>180?R-=360:R<-180&&(R+=360);let E=[ud(h,t,r,b[0],c,S[0]),ud(h,t,r,b[1],c,S[1]),b[2]+ud(h,t,r,0,c,R),ud(h,t,r,l[3],c,n[3])];return q_(n1(E))}function OC(h){return!0}function M1(h){let t=dy(),r=BC(h,t),l=fy();return function(c,n){if(l.properties=c.getPropertiesInternal(),l.resolution=n,t.featureId){let x=c.getId();x!==void 0?l.featureId=x:l.featureId=null}return t.geometryType&&(l.geometryType=py(c.getGeometry())),r(l)}}function _y(h){let t=dy(),r=h.length,l=new Array(r);for(let x=0;x<r;++x)l[x]=my(h[x],t);let c=fy(),n=new Array(r);return function(x,b){if(c.properties=x.getPropertiesInternal(),c.resolution=b,t.featureId){let R=x.getId();R!==void 0?c.featureId=R:c.featureId=null}let S=0;for(let R=0;R<r;++R){let E=l[R](c);E&&(n[S]=E,S+=1)}return n.length=S,n}}function BC(h,t){let r=h.length,l=new Array(r);for(let c=0;c<r;++c){let n=h[c],x="filter"in n?Ys(n.filter,Jr,t):OC,b;if(Array.isArray(n.style)){let S=n.style.length;b=new Array(S);for(let R=0;R<S;++R)b[R]=my(n.style[R],t)}else b=[my(n.style,t)];l[c]={filter:x,styles:b}}return function(c){let n=[],x=!1;for(let b=0;b<r;++b){let S=l[b].filter;if(S(c)&&!(h[b].else&&x)){x=!0;for(let R of l[b].styles){let E=R(c);E&&n.push(E)}}}return n}}function my(h,t){let r=dd(h,"",t),l=pd(h,"",t),c=jC(h,t),n=NC(h,t),x=Rn(h,"z-index",t);if(!r&&!l&&!c&&!n&&!Xn(h))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(h));let b=new Or;return function(S){let R=!0;if(r){let E=r(S);E&&(R=!1),b.setFill(E)}if(l){let E=l(S);E&&(R=!1),b.setStroke(E)}if(c){let E=c(S);E&&(R=!1),b.setText(E)}if(n){let E=n(S);E&&(R=!1),b.setImage(E)}return x&&b.setZIndex(x(S)),R?null:b}}function dd(h,t,r){let l;if(t+"fill-pattern-src"in h)l=ZC(h,t+"fill-",r);else{if(h[t+"fill-color"]==="none")return n=>null;l=yy(h,t+"fill-color",r)}if(!l)return null;let c=new zr;return function(n){let x=l(n);return x===Tf?null:(c.setColor(x),c)}}function pd(h,t,r){let l=Rn(h,t+"stroke-width",r),c=yy(h,t+"stroke-color",r);if(!l&&!c)return null;let n=Do(h,t+"stroke-line-cap",r),x=Do(h,t+"stroke-line-join",r),b=I1(h,t+"stroke-line-dash",r),S=Rn(h,t+"stroke-line-dash-offset",r),R=Rn(h,t+"stroke-miter-limit",r),E=new cr;return function(A){if(c){let z=c(A);if(z===Tf)return null;E.setColor(z)}if(l&&E.setWidth(l(A)),n){let z=n(A);if(z!=="butt"&&z!=="round"&&z!=="square")throw new Error("Expected butt, round, or square line cap");E.setLineCap(z)}if(x){let z=x(A);if(z!=="bevel"&&z!=="round"&&z!=="miter")throw new Error("Expected bevel, round, or miter line join");E.setLineJoin(z)}return b&&E.setLineDash(b(A)),S&&E.setLineDashOffset(S(A)),R&&E.setMiterLimit(R(A)),E}}function jC(h,t){let r="text-",l=Do(h,r+"value",t);if(!l)return null;let c=dd(h,r,t),n=dd(h,r+"background-",t),x=pd(h,r,t),b=pd(h,r+"background-",t),S=Do(h,r+"font",t),R=Rn(h,r+"max-angle",t),E=Rn(h,r+"offset-x",t),A=Rn(h,r+"offset-y",t),z=$c(h,r+"overflow",t),W=Do(h,r+"placement",t),re=Rn(h,r+"repeat",t),me=Of(h,r+"scale",t),ge=$c(h,r+"rotate-with-view",t),be=Rn(h,r+"rotation",t),ve=Do(h,r+"align",t),De=Do(h,r+"justify",t),ke=Do(h,r+"baseline",t),je=$c(h,r+"keep-upright",t),Re=I1(h,r+"padding",t),tt=Bf(h,r+"declutter-mode"),Je=new _1({declutterMode:tt});return function(He){if(Je.setText(l(He)),c&&Je.setFill(c(He)),n&&Je.setBackgroundFill(n(He)),x&&Je.setStroke(x(He)),b&&Je.setBackgroundStroke(b(He)),S&&Je.setFont(S(He)),R&&Je.setMaxAngle(R(He)),E&&Je.setOffsetX(E(He)),A&&Je.setOffsetY(A(He)),z&&Je.setOverflow(z(He)),W){let ot=W(He);if(ot!=="point"&&ot!=="line")throw new Error("Expected point or line for text-placement");Je.setPlacement(ot)}if(re&&Je.setRepeat(re(He)),me&&Je.setScale(me(He)),ge&&Je.setRotateWithView(ge(He)),be&&Je.setRotation(be(He)),ve){let ot=ve(He);if(ot!=="left"&&ot!=="center"&&ot!=="right"&&ot!=="end"&&ot!=="start")throw new Error("Expected left, right, center, start, or end for text-align");Je.setTextAlign(ot)}if(De){let ot=De(He);if(ot!=="left"&&ot!=="right"&&ot!=="center")throw new Error("Expected left, right, or center for text-justify");Je.setJustify(ot)}if(ke){let ot=ke(He);if(ot!=="bottom"&&ot!=="top"&&ot!=="middle"&&ot!=="alphabetic"&&ot!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");Je.setTextBaseline(ot)}return Re&&Je.setPadding(Re(He)),je&&Je.setKeepUpright(je(He)),Je}}function NC(h,t){return"icon-src"in h?GC(h,t):"shape-points"in h?VC(h,t):"circle-radius"in h?UC(h,t):null}function GC(h,t){let r="icon-",l=r+"src",c=E1(h[l],l),n=Ff(h,r+"anchor",t),x=Of(h,r+"scale",t),b=Rn(h,r+"opacity",t),S=Ff(h,r+"displacement",t),R=Rn(h,r+"rotation",t),E=$c(h,r+"rotate-with-view",t),A=T1(h,r+"anchor-origin"),z=C1(h,r+"anchor-x-units"),W=C1(h,r+"anchor-y-units"),re=XC(h,r+"color"),me=WC(h,r+"cross-origin"),ge=$C(h,r+"offset"),be=T1(h,r+"offset-origin"),ve=zf(h,r+"width"),De=zf(h,r+"height"),ke=qC(h,r+"size"),je=Bf(h,r+"declutter-mode"),Re=new ad({src:c,anchorOrigin:A,anchorXUnits:z,anchorYUnits:W,color:re,crossOrigin:me,offset:ge,offsetOrigin:be,height:De,width:ve,size:ke,declutterMode:je});return function(tt){return b&&Re.setOpacity(b(tt)),S&&Re.setDisplacement(S(tt)),R&&Re.setRotation(R(tt)),E&&Re.setRotateWithView(E(tt)),x&&Re.setScale(x(tt)),n&&Re.setAnchor(n(tt)),Re}}function VC(h,t){let r="shape-",l=r+"points",c=r+"radius",n=gy(h[l],l),x=gy(h[c],c),b=dd(h,r,t),S=pd(h,r,t),R=Of(h,r+"scale",t),E=Ff(h,r+"displacement",t),A=Rn(h,r+"rotation",t),z=$c(h,r+"rotate-with-view",t),W=zf(h,r+"radius2"),re=zf(h,r+"angle"),me=Bf(h,r+"declutter-mode"),ge=new Rf({points:n,radius:x,radius2:W,angle:re,declutterMode:me});return function(be){return b&&ge.setFill(b(be)),S&&ge.setStroke(S(be)),E&&ge.setDisplacement(E(be)),A&&ge.setRotation(A(be)),z&&ge.setRotateWithView(z(be)),R&&ge.setScale(R(be)),ge}}function UC(h,t){let r="circle-",l=dd(h,r,t),c=pd(h,r,t),n=Rn(h,r+"radius",t),x=Of(h,r+"scale",t),b=Ff(h,r+"displacement",t),S=Rn(h,r+"rotation",t),R=$c(h,r+"rotate-with-view",t),E=Bf(h,r+"declutter-mode"),A=new Pn({radius:5,declutterMode:E});return function(z){return n&&A.setRadius(n(z)),l&&A.setFill(l(z)),c&&A.setStroke(c(z)),b&&A.setDisplacement(b(z)),S&&A.setRotation(S(z)),R&&A.setRotateWithView(R(z)),x&&A.setScale(x(z)),A}}function Rn(h,t,r){if(!(t in h))return;let l=Ys(h[t],Zt,r);return function(c){return gy(l(c),t)}}function Do(h,t,r){if(!(t in h))return null;let l=Ys(h[t],mn,r);return function(c){return E1(l(c),t)}}function ZC(h,t,r){let l=Do(h,t+"pattern-src",r),c=S1(h,t+"pattern-offset",r),n=S1(h,t+"pattern-size",r),x=yy(h,t+"color",r);return function(b){return{src:l(b),offset:c&&c(b),size:n&&n(b),color:x&&x(b)}}}function $c(h,t,r){if(!(t in h))return null;let l=Ys(h[t],Jr,r);return function(c){let n=l(c);if(typeof n!="boolean")throw new Error(`Expected a boolean for ${t}`);return n}}function yy(h,t,r){if(!(t in h))return null;let l=Ys(h[t],Kn,r);return function(c){return P1(l(c),t)}}function I1(h,t,r){if(!(t in h))return null;let l=Ys(h[t],ba,r);return function(c){return fd(l(c),t)}}function Ff(h,t,r){if(!(t in h))return null;let l=Ys(h[t],ba,r);return function(c){let n=fd(l(c),t);if(n.length!==2)throw new Error(`Expected two numbers for ${t}`);return n}}function S1(h,t,r){if(!(t in h))return null;let l=Ys(h[t],ba,r);return function(c){return R1(l(c),t)}}function Of(h,t,r){if(!(t in h))return null;let l=Ys(h[t],ba|Zt,r);return function(c){return HC(l(c),t)}}function zf(h,t){let r=h[t];if(r!==void 0){if(typeof r!="number")throw new Error(`Expected a number for ${t}`);return r}}function qC(h,t){let r=h[t];if(r!==void 0){if(typeof r=="number")return $s(r);if(!Array.isArray(r))throw new Error(`Expected a number or size array for ${t}`);if(r.length!==2||typeof r[0]!="number"||typeof r[1]!="number")throw new Error(`Expected a number or size array for ${t}`);return r}}function WC(h,t){let r=h[t];if(r!==void 0){if(typeof r!="string")throw new Error(`Expected a string for ${t}`);return r}}function T1(h,t){let r=h[t];if(r!==void 0){if(r!=="bottom-left"&&r!=="bottom-right"&&r!=="top-left"&&r!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return r}}function C1(h,t){let r=h[t];if(r!==void 0){if(r!=="pixels"&&r!=="fraction")throw new Error(`Expected pixels or fraction for ${t}`);return r}}function $C(h,t){let r=h[t];if(r!==void 0)return fd(r,t)}function Bf(h,t){let r=h[t];if(r!==void 0){if(typeof r!="string")throw new Error(`Expected a string for ${t}`);if(r!=="declutter"&&r!=="obstacle"&&r!=="none")throw new Error(`Expected declutter, obstacle, or none for ${t}`);return r}}function XC(h,t){let r=h[t];if(r!==void 0)return P1(r,t)}function fd(h,t){if(!Array.isArray(h))throw new Error(`Expected an array for ${t}`);let r=h.length;for(let l=0;l<r;++l)if(typeof h[l]!="number")throw new Error(`Expected an array of numbers for ${t}`);return h}function E1(h,t){if(typeof h!="string")throw new Error(`Expected a string for ${t}`);return h}function gy(h,t){if(typeof h!="number")throw new Error(`Expected a number for ${t}`);return h}function P1(h,t){if(typeof h=="string")return h;let r=fd(h,t),l=r.length;if(l<3||l>4)throw new Error(`Expected a color with 3 or 4 values for ${t}`);return r}function R1(h,t){let r=fd(h,t);if(r.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return r}function HC(h,t){return typeof h=="number"?h:R1(h,t)}var A1={RENDER_ORDER:"renderOrder"},xy=class extends Rs{constructor(t){t=t||{};let r=Object.assign({},t);delete r.style,delete r.renderBuffer,delete r.updateWhileAnimating,delete r.updateWhileInteracting,super(r),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(A1.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,r){let l=this.getDeclutter();l in t.declutter||(t.declutter[l]=new Cl(9)),this.getRenderer().renderDeclutter(t,r)}setRenderOrder(t){this.set(A1.RENDER_ORDER,t)}setStyle(t){this.style_=t===void 0?sy:t;let r=YC(t);this.styleFunction_=t===null?void 0:m1(r),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}};function YC(h){if(h===void 0)return sy;if(!h)return null;if(typeof h=="function"||h instanceof Or)return h;if(!Array.isArray(h))return _y([h]);if(h.length===0)return[];let t=h.length,r=h[0];if(r instanceof Or){let c=new Array(t);for(let n=0;n<t;++n){let x=h[n];if(!(x instanceof Or))throw new Error("Expected a list of style instances");c[n]=x}return c}if("style"in r){let c=new Array(t);for(let n=0;n<t;++n){let x=h[n];if(!("style"in x))throw new Error("Expected a list of rules with a style property");c[n]=x}return M1(c)}return _y(h)}var L1=xy;var md={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},gd=[md.FILL],Ks=[md.STROKE],Fo=[md.BEGIN_PATH],vy=[md.CLOSE_PATH],bt=md;var by=class{drawCustom(t,r,l,c,n){}drawGeometry(t){}setStyle(t){}drawCircle(t,r,l){}drawFeature(t,r,l){}drawGeometryCollection(t,r,l){}drawLineString(t,r,l){}drawMultiLineString(t,r,l){}drawMultiPoint(t,r,l){}drawMultiPolygon(t,r,l){}drawPoint(t,r,l){}drawPolygon(t,r,l){}drawText(t,r,l){}setFillStrokeStyle(t,r){}setImageStyle(t,r){}setTextStyle(t,r){}},jf=by;var wy=class extends jf{constructor(t,r,l,c){super(),this.tolerance=t,this.maxExtent=r,this.pixelRatio=c,this.maxLineWidth=0,this.resolution=l,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){let r=this.pixelRatio;return r==1?t:t.map(function(l){return l*r})}appendFlatPointCoordinates(t,r){let l=this.getBufferedMaxExtent(),c=this.tmpCoordinate_,n=this.coordinates,x=n.length;for(let b=0,S=t.length;b<S;b+=r)c[0]=t[b],c[1]=t[b+1],fl(l,c)&&(n[x++]=c[0],n[x++]=c[1]);return x}appendFlatLineCoordinates(t,r,l,c,n,x){let b=this.coordinates,S=b.length,R=this.getBufferedMaxExtent();x&&(r+=c);let E=t[r],A=t[r+1],z=this.tmpCoordinate_,W=!0,re,me,ge;for(re=r+c;re<l;re+=c)z[0]=t[re],z[1]=t[re+1],ge=Kp(R,z),ge!==me?(W&&(b[S++]=E,b[S++]=A,W=!1),b[S++]=z[0],b[S++]=z[1]):ge===Qi.INTERSECTING?(b[S++]=z[0],b[S++]=z[1],W=!1):W=!0,E=z[0],A=z[1],me=ge;return(n&&W||re===r+c)&&(b[S++]=E,b[S++]=A),S}drawCustomCoordinates_(t,r,l,c,n){for(let x=0,b=l.length;x<b;++x){let S=l[x],R=this.appendFlatLineCoordinates(t,r,S,c,!1,!1);n.push(R),r=S}return r}drawCustom(t,r,l,c,n){this.beginGeometry(t,r,n);let x=t.getType(),b=t.getStride(),S=this.coordinates.length,R,E,A,z,W;switch(x){case"MultiPolygon":R=t.getOrientedFlatCoordinates(),z=[];let re=t.getEndss();W=0;for(let me=0,ge=re.length;me<ge;++me){let be=[];W=this.drawCustomCoordinates_(R,W,re[me],b,be),z.push(be)}this.instructions.push([bt.CUSTOM,S,z,t,l,Gu,n]),this.hitDetectionInstructions.push([bt.CUSTOM,S,z,t,c||l,Gu,n]);break;case"Polygon":case"MultiLineString":A=[],R=x=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),W=this.drawCustomCoordinates_(R,0,t.getEnds(),b,A),this.instructions.push([bt.CUSTOM,S,A,t,l,fa,n]),this.hitDetectionInstructions.push([bt.CUSTOM,S,A,t,c||l,fa,n]);break;case"LineString":case"Circle":R=t.getFlatCoordinates(),E=this.appendFlatLineCoordinates(R,0,R.length,b,!1,!1),this.instructions.push([bt.CUSTOM,S,E,t,l,fs,n]),this.hitDetectionInstructions.push([bt.CUSTOM,S,E,t,c||l,fs,n]);break;case"MultiPoint":R=t.getFlatCoordinates(),E=this.appendFlatPointCoordinates(R,b),E>S&&(this.instructions.push([bt.CUSTOM,S,E,t,l,fs,n]),this.hitDetectionInstructions.push([bt.CUSTOM,S,E,t,c||l,fs,n]));break;case"Point":R=t.getFlatCoordinates(),this.coordinates.push(R[0],R[1]),E=this.coordinates.length,this.instructions.push([bt.CUSTOM,S,E,t,l,void 0,n]),this.hitDetectionInstructions.push([bt.CUSTOM,S,E,t,c||l,void 0,n]);break;default:}this.endGeometry(r)}beginGeometry(t,r,l){this.beginGeometryInstruction1_=[bt.BEGIN_GEOMETRY,r,0,t,l],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[bt.BEGIN_GEOMETRY,r,0,t,l],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let t=this.hitDetectionInstructions;t.reverse();let r,l=t.length,c,n,x=-1;for(r=0;r<l;++r)c=t[r],n=c[0],n==bt.END_GEOMETRY?x=r:n==bt.BEGIN_GEOMETRY&&(c[2]=r,kv(this.hitDetectionInstructions,x,r),x=-1)}setFillStrokeStyle(t,r){let l=this.state;if(t){let c=t.getColor();l.fillPatternScale=c&&typeof c=="object"&&"src"in c?this.pixelRatio:1,l.fillStyle=Mn(c||hr)}else l.fillStyle=void 0;if(r){let c=r.getColor();l.strokeStyle=Mn(c||Ao);let n=r.getLineCap();l.lineCap=n!==void 0?n:Xs;let x=r.getLineDash();l.lineDash=x?x.slice():In;let b=r.getLineDashOffset();l.lineDashOffset=b||En;let S=r.getLineJoin();l.lineJoin=S!==void 0?S:Hs;let R=r.getWidth();l.lineWidth=R!==void 0?R:ko;let E=r.getMiterLimit();l.miterLimit=E!==void 0?E:Ro,l.lineWidth>this.maxLineWidth&&(this.maxLineWidth=l.lineWidth,this.bufferedMaxExtent_=null)}else l.strokeStyle=void 0,l.lineCap=void 0,l.lineDash=null,l.lineDashOffset=void 0,l.lineJoin=void 0,l.lineWidth=void 0,l.miterLimit=void 0}createFill(t){let r=t.fillStyle,l=[bt.SET_FILL_STYLE,r];return typeof r!="string"&&l.push(t.fillPatternScale),l}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[bt.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,r){let l=t.fillStyle;(typeof l!="string"||t.currentFillStyle!=l)&&(l!==void 0&&this.instructions.push(r.call(this,t)),t.currentFillStyle=l)}updateStrokeStyle(t,r){let l=t.strokeStyle,c=t.lineCap,n=t.lineDash,x=t.lineDashOffset,b=t.lineJoin,S=t.lineWidth,R=t.miterLimit;(t.currentStrokeStyle!=l||t.currentLineCap!=c||n!=t.currentLineDash&&!vn(t.currentLineDash,n)||t.currentLineDashOffset!=x||t.currentLineJoin!=b||t.currentLineWidth!=S||t.currentMiterLimit!=R)&&(l!==void 0&&r.call(this,t),t.currentStrokeStyle=l,t.currentLineCap=c,t.currentLineDash=n,t.currentLineDashOffset=x,t.currentLineJoin=b,t.currentLineWidth=S,t.currentMiterLimit=R)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let r=[bt.END_GEOMETRY,t];this.instructions.push(r),this.hitDetectionInstructions.push(r)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Dv(this.maxExtent),this.maxLineWidth>0)){let t=this.resolution*(this.maxLineWidth+1)/2;us(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Js=wy;var Sy=class extends Js{constructor(t,r,l,c){super(t,r,l,c),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,r,l){if(!this.image_||this.maxExtent&&!fl(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,r,l);let c=t.getFlatCoordinates(),n=t.getStride(),x=this.coordinates.length,b=this.appendFlatPointCoordinates(c,n);this.instructions.push([bt.DRAW_IMAGE,x,b,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([bt.DRAW_IMAGE,x,b,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(r)}drawMultiPoint(t,r,l){if(!this.image_)return;this.beginGeometry(t,r,l);let c=t.getFlatCoordinates(),n=[];for(let S=0,R=c.length;S<R;S+=t.getStride())(!this.maxExtent||fl(this.maxExtent,c.slice(S,S+2)))&&n.push(c[S],c[S+1]);let x=this.coordinates.length,b=this.appendFlatPointCoordinates(n,2);this.instructions.push([bt.DRAW_IMAGE,x,b,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([bt.DRAW_IMAGE,x,b,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(r)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,r){let l=t.getAnchor(),c=t.getSize(),n=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=l[0],this.anchorY_=l[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=c[1],this.opacity_=t.getOpacity(),this.originX_=n[0],this.originY_=n[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=c[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=r}},k1=Sy;var Ty=class extends Js{constructor(t,r,l,c){super(t,r,l,c)}drawFlatCoordinates_(t,r,l,c){let n=this.coordinates.length,x=this.appendFlatLineCoordinates(t,r,l,c,!1,!1),b=[bt.MOVE_TO_LINE_TO,n,x];return this.instructions.push(b),this.hitDetectionInstructions.push(b),l}drawLineString(t,r,l){let c=this.state,n=c.strokeStyle,x=c.lineWidth;if(n===void 0||x===void 0)return;this.updateStrokeStyle(c,this.applyStroke),this.beginGeometry(t,r,l),this.hitDetectionInstructions.push([bt.SET_STROKE_STYLE,c.strokeStyle,c.lineWidth,c.lineCap,c.lineJoin,c.miterLimit,In,En],Fo);let b=t.getFlatCoordinates(),S=t.getStride();this.drawFlatCoordinates_(b,0,b.length,S),this.hitDetectionInstructions.push(Ks),this.endGeometry(r)}drawMultiLineString(t,r,l){let c=this.state,n=c.strokeStyle,x=c.lineWidth;if(n===void 0||x===void 0)return;this.updateStrokeStyle(c,this.applyStroke),this.beginGeometry(t,r,l),this.hitDetectionInstructions.push([bt.SET_STROKE_STYLE,c.strokeStyle,c.lineWidth,c.lineCap,c.lineJoin,c.miterLimit,In,En],Fo);let b=t.getEnds(),S=t.getFlatCoordinates(),R=t.getStride(),E=0;for(let A=0,z=b.length;A<z;++A)E=this.drawFlatCoordinates_(S,E,b[A],R);this.hitDetectionInstructions.push(Ks),this.endGeometry(r)}finish(){let t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Ks),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Ks),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Fo)}},D1=Ty;var Cy=class extends Js{constructor(t,r,l,c){super(t,r,l,c)}drawFlatCoordinatess_(t,r,l,c){let n=this.state,x=n.fillStyle!==void 0,b=n.strokeStyle!==void 0,S=l.length;this.instructions.push(Fo),this.hitDetectionInstructions.push(Fo);for(let R=0;R<S;++R){let E=l[R],A=this.coordinates.length,z=this.appendFlatLineCoordinates(t,r,E,c,!0,!b),W=[bt.MOVE_TO_LINE_TO,A,z];this.instructions.push(W),this.hitDetectionInstructions.push(W),b&&(this.instructions.push(vy),this.hitDetectionInstructions.push(vy)),r=E}return x&&(this.instructions.push(gd),this.hitDetectionInstructions.push(gd)),b&&(this.instructions.push(Ks),this.hitDetectionInstructions.push(Ks)),r}drawCircle(t,r,l){let c=this.state,n=c.fillStyle,x=c.strokeStyle;if(n===void 0&&x===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,r,l),c.fillStyle!==void 0&&this.hitDetectionInstructions.push([bt.SET_FILL_STYLE,hr]),c.strokeStyle!==void 0&&this.hitDetectionInstructions.push([bt.SET_STROKE_STYLE,c.strokeStyle,c.lineWidth,c.lineCap,c.lineJoin,c.miterLimit,In,En]);let b=t.getFlatCoordinates(),S=t.getStride(),R=this.coordinates.length;this.appendFlatLineCoordinates(b,0,b.length,S,!1,!1);let E=[bt.CIRCLE,R];this.instructions.push(Fo,E),this.hitDetectionInstructions.push(Fo,E),c.fillStyle!==void 0&&(this.instructions.push(gd),this.hitDetectionInstructions.push(gd)),c.strokeStyle!==void 0&&(this.instructions.push(Ks),this.hitDetectionInstructions.push(Ks)),this.endGeometry(r)}drawPolygon(t,r,l){let c=this.state,n=c.fillStyle,x=c.strokeStyle;if(n===void 0&&x===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,r,l),c.fillStyle!==void 0&&this.hitDetectionInstructions.push([bt.SET_FILL_STYLE,hr]),c.strokeStyle!==void 0&&this.hitDetectionInstructions.push([bt.SET_STROKE_STYLE,c.strokeStyle,c.lineWidth,c.lineCap,c.lineJoin,c.miterLimit,In,En]);let b=t.getEnds(),S=t.getOrientedFlatCoordinates(),R=t.getStride();this.drawFlatCoordinatess_(S,0,b,R),this.endGeometry(r)}drawMultiPolygon(t,r,l){let c=this.state,n=c.fillStyle,x=c.strokeStyle;if(n===void 0&&x===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,r,l),c.fillStyle!==void 0&&this.hitDetectionInstructions.push([bt.SET_FILL_STYLE,hr]),c.strokeStyle!==void 0&&this.hitDetectionInstructions.push([bt.SET_STROKE_STYLE,c.strokeStyle,c.lineWidth,c.lineCap,c.lineJoin,c.miterLimit,In,En]);let b=t.getEndss(),S=t.getOrientedFlatCoordinates(),R=t.getStride(),E=0;for(let A=0,z=b.length;A<z;++A)E=this.drawFlatCoordinatess_(S,E,b[A],R);this.endGeometry(r)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let t=this.tolerance;if(t!==0){let r=this.coordinates;for(let l=0,c=r.length;l<c;++l)r[l]=pa(r[l],t)}return super.finish()}setFillStrokeStyles_(){let t=this.state;t.fillStyle!==void 0&&this.updateFillStyle(t,this.createFill),t.strokeStyle!==void 0&&this.updateStrokeStyle(t,this.applyStroke)}},My=Cy;function F1(h,t,r,l,c){let n=[],x=r,b=0,S=t.slice(r,2);for(;b<h&&x+c<l;){let[R,E]=S.slice(-2),A=t[x+c],z=t[x+c+1],W=Math.sqrt((A-R)*(A-R)+(z-E)*(z-E));if(b+=W,b>=h){let re=(h-b+W)/W,me=Dr(R,A,re),ge=Dr(E,z,re);S.push(me,ge),n.push(S),S=[me,ge],b==h&&(x+=c),b=0}else if(b<h)S.push(t[x+c],t[x+c+1]),x+=c;else{let re=W-b,me=Dr(R,A,re/W),ge=Dr(E,z,re/W);S.push(me,ge),n.push(S),S=[me,ge],b=0,x+=c}}return b>0&&n.push(S),n}function z1(h,t,r,l,c){let n=r,x=r,b=0,S=0,R=r,E,A,z,W,re,me,ge,be,ve,De;for(A=r;A<l;A+=c){let ke=t[A],je=t[A+1];re!==void 0&&(ve=ke-re,De=je-me,W=Math.sqrt(ve*ve+De*De),ge!==void 0&&(S+=z,E=Math.acos((ge*ve+be*De)/(z*W)),E>h&&(S>b&&(b=S,n=R,x=A),S=0,R=A-c)),z=W,ge=ve,be=De),re=ke,me=je}return S+=W,S>b?[R,A]:[n,x]}var _d={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Iy=class extends Js{constructor(t,r,l,c){super(t,r,l,c),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[hr]={fillStyle:hr},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,r,l){let c=this.textFillState_,n=this.textStrokeState_,x=this.textState_;if(this.text_===""||!x||!c&&!n)return;let b=this.coordinates,S=b.length,R=t.getType(),E=null,A=t.getStride();if(x.placement==="line"&&(R=="LineString"||R=="MultiLineString"||R=="Polygon"||R=="MultiPolygon")){if(!er(this.maxExtent,t.getExtent()))return;let z;if(E=t.getFlatCoordinates(),R=="LineString")z=[E.length];else if(R=="MultiLineString")z=t.getEnds();else if(R=="Polygon")z=t.getEnds().slice(0,1);else if(R=="MultiPolygon"){let ge=t.getEndss();z=[];for(let be=0,ve=ge.length;be<ve;++be)z.push(ge[be][0])}this.beginGeometry(t,r,l);let W=x.repeat,re=W?void 0:x.textAlign,me=0;for(let ge=0,be=z.length;ge<be;++ge){let ve;W?ve=F1(W*this.resolution,E,me,z[ge],A):ve=[E.slice(me,z[ge])];for(let De=0,ke=ve.length;De<ke;++De){let je=ve[De],Re=0,tt=je.length;if(re==null){let He=z1(x.maxAngle,je,0,je.length,2);Re=He[0],tt=He[1]}for(let He=Re;He<tt;He+=A)b.push(je[He],je[He+1]);let Je=b.length;me=z[ge],this.drawChars_(S,Je),S=Je}}this.endGeometry(r)}else{let z=x.overflow?null:[];switch(R){case"Point":case"MultiPoint":E=t.getFlatCoordinates();break;case"LineString":E=t.getFlatMidpoint();break;case"Circle":E=t.getCenter();break;case"MultiLineString":E=t.getFlatMidpoints(),A=2;break;case"Polygon":E=t.getFlatInteriorPoint(),x.overflow||z.push(E[2]/this.resolution),A=3;break;case"MultiPolygon":let ve=t.getFlatInteriorPoints();E=[];for(let De=0,ke=ve.length;De<ke;De+=3)x.overflow||z.push(ve[De+2]/this.resolution),E.push(ve[De],ve[De+1]);if(E.length===0)return;A=2;break;default:}let W=this.appendFlatPointCoordinates(E,A);if(W===S)return;if(z&&(W-S)/2!==E.length/A){let ve=S/2;z=z.filter((De,ke)=>{let je=b[(ve+ke)*2]===E[ke*A]&&b[(ve+ke)*2+1]===E[ke*A+1];return je||--ve,je})}this.saveTextStates_(),(x.backgroundFill||x.backgroundStroke)&&(this.setFillStrokeStyle(x.backgroundFill,x.backgroundStroke),x.backgroundFill&&this.updateFillStyle(this.state,this.createFill),x.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,r,l);let re=x.padding;if(re!=Lo&&(x.scale[0]<0||x.scale[1]<0)){let ve=x.padding[0],De=x.padding[1],ke=x.padding[2],je=x.padding[3];x.scale[0]<0&&(De=-De,je=-je),x.scale[1]<0&&(ve=-ve,ke=-ke),re=[ve,De,ke,je]}let me=this.pixelRatio;this.instructions.push([bt.DRAW_IMAGE,S,W,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,re==Lo?Lo:re.map(function(ve){return ve*me}),!!x.backgroundFill,!!x.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,z]);let ge=1/me,be=this.state.fillStyle;x.backgroundFill&&(this.state.fillStyle=hr,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([bt.DRAW_IMAGE,S,W,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[ge,ge],NaN,this.declutterMode_,this.declutterImageWithText_,re,!!x.backgroundFill,!!x.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?hr:this.fillKey_,this.textOffsetX_,this.textOffsetY_,z]),x.backgroundFill&&(this.state.fillStyle=be,this.hitDetectionInstructions.push(this.createFill(this.state))),this.endGeometry(r)}}saveTextStates_(){let t=this.textStrokeState_,r=this.textState_,l=this.textFillState_,c=this.strokeKey_;t&&(c in this.strokeStates||(this.strokeStates[c]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));let n=this.textKey_;n in this.textStates||(this.textStates[n]={font:r.font,textAlign:r.textAlign||ya,justify:r.justify,textBaseline:r.textBaseline||Tl,scale:r.scale});let x=this.fillKey_;l&&(x in this.fillStates||(this.fillStates[x]={fillStyle:l.fillStyle}))}drawChars_(t,r){let l=this.textStrokeState_,c=this.textState_,n=this.strokeKey_,x=this.textKey_,b=this.fillKey_;this.saveTextStates_();let S=this.pixelRatio,R=_d[c.textBaseline],E=this.textOffsetY_*S,A=this.text_,z=l?l.lineWidth*Math.abs(c.scale[0])/2:0;this.instructions.push([bt.DRAW_CHARS,t,r,R,c.overflow,b,c.maxAngle,S,E,n,z*S,A,x,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([bt.DRAW_CHARS,t,r,R,c.overflow,b&&hr,c.maxAngle,S,E,n,z*S,A,x,1/S,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,r){let l,c,n;if(!t)this.text_="";else{let x=t.getFill();x?(c=this.textFillState_,c||(c={},this.textFillState_=c),c.fillStyle=Mn(x.getColor()||hr)):(c=null,this.textFillState_=c);let b=t.getStroke();if(!b)n=null,this.textStrokeState_=n;else{n=this.textStrokeState_,n||(n={},this.textStrokeState_=n);let me=b.getLineDash(),ge=b.getLineDashOffset(),be=b.getWidth(),ve=b.getMiterLimit();n.lineCap=b.getLineCap()||Xs,n.lineDash=me?me.slice():In,n.lineDashOffset=ge===void 0?En:ge,n.lineJoin=b.getLineJoin()||Hs,n.lineWidth=be===void 0?ko:be,n.miterLimit=ve===void 0?Ro:ve,n.strokeStyle=Mn(b.getColor()||Ao)}l=this.textState_;let S=t.getFont()||Pf;h1(S);let R=t.getScaleArray();l.overflow=t.getOverflow(),l.font=S,l.maxAngle=t.getMaxAngle(),l.placement=t.getPlacement(),l.textAlign=t.getTextAlign(),l.repeat=t.getRepeat(),l.justify=t.getJustify(),l.textBaseline=t.getTextBaseline()||Tl,l.backgroundFill=t.getBackgroundFill(),l.backgroundStroke=t.getBackgroundStroke(),l.padding=t.getPadding()||Lo,l.scale=R===void 0?[1,1]:R;let E=t.getOffsetX(),A=t.getOffsetY(),z=t.getRotateWithView(),W=t.getKeepUpright(),re=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=E===void 0?0:E,this.textOffsetY_=A===void 0?0:A,this.textRotateWithView_=z===void 0?!1:z,this.textKeepUpright_=W===void 0?!0:W,this.textRotation_=re===void 0?0:re,this.strokeKey_=n?(typeof n.strokeStyle=="string"?n.strokeStyle:Gt(n.strokeStyle))+n.lineCap+n.lineDashOffset+"|"+n.lineWidth+n.lineJoin+n.miterLimit+"["+n.lineDash.join()+"]":"",this.textKey_=l.font+l.scale+(l.textAlign||"?")+(l.repeat||"?")+(l.justify||"?")+(l.textBaseline||"?"),this.fillKey_=c&&c.fillStyle?typeof c.fillStyle=="string"?c.fillStyle:"|"+Gt(c.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=r}},O1=Iy;var KC={Circle:My,Default:Js,Image:k1,LineString:D1,Polygon:My,Text:O1},Ey=class{constructor(t,r,l,c){this.tolerance_=t,this.maxExtent_=r,this.pixelRatio_=c,this.resolution_=l,this.buildersByZIndex_={}}finish(){let t={};for(let r in this.buildersByZIndex_){t[r]=t[r]||{};let l=this.buildersByZIndex_[r];for(let c in l){let n=l[c].finish();t[r][c]=n}}return t}getBuilder(t,r){let l=t!==void 0?t.toString():"0",c=this.buildersByZIndex_[l];c===void 0&&(c={},this.buildersByZIndex_[l]=c);let n=c[r];if(n===void 0){let x=KC[r];n=new x(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),c[r]=n}return n}},B1=Ey;var JC=5,Py=class extends Hp{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=JC}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return Tt()}getData(t){return null}prepareFrame(t){return Tt()}renderFrame(t,r){return Tt()}forEachFeatureAtCoordinate(t,r,l,c,n){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){let r=t.target;(r.getState()===Mt.LOADED||r.getState()===Mt.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let r=t.getState();return r!=Mt.LOADED&&r!=Mt.ERROR&&t.addEventListener(gi.CHANGE,this.boundHandleImageChange_),r==Mt.IDLE&&(t.load(),r=t.getState()),r==Mt.LOADED}renderIfReadyAndVisible(){let t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}},wa=Py;var Ry=class extends Ei{constructor(t,r,l,c){super(t),this.inversePixelTransform=r,this.frameState=l,this.context=c}},j1=Ry;var Ay=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(Gc(),{get:(t,r)=>{if(typeof Gc()[r]=="function")return this.instructions_[this.zIndex+this.offset_]||(this.instructions_[this.zIndex+this.offset_]=[]),this.instructions_[this.zIndex+this.offset_].push(r),this.pushMethodArgs_},set:(t,r,l)=>(this.instructions_[this.zIndex+this.offset_]||(this.instructions_[this.zIndex+this.offset_]=[]),this.instructions_[this.zIndex+this.offset_].push(r,l),!0)})}pushMethodArgs_=(...t)=>(this.instructions_[this.zIndex+this.offset_].push(t),this);pushFunction(t){this.instructions_[this.zIndex+this.offset_].push(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(r=>{for(let l=0,c=r.length;l<c;++l){let n=r[l];if(typeof n=="function"){n(t);continue}let x=r[++l];if(typeof t[n]=="function")t[n](...x);else{if(typeof x=="function"){t[n]=x(t);continue}t[n]=x}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},Nf=Ay;var ky=[],Xc=null;function QC(){Xc=Fi(1,1,void 0,{willReadFrequently:!0})}var Ly=class extends wa{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=yr(),this.pixelTransform=yr(),this.inversePixelTransform=yr(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,r,l){Xc||QC(),Xc.clearRect(0,0,1,1);let c;try{Xc.drawImage(t,r,l,1,1,0,0,1,1),c=Xc.getImageData(0,0,1,1).data}catch{return Xc=null,null}return c}getBackground(t){let l=this.getLayer().getBackground();return typeof l=="function"&&(l=l(t.viewState.resolution)),l||void 0}useContainer(t,r,l){let c=this.getLayer().getClassName(),n,x;if(t&&t.className===c&&(!l||t&&t.style.backgroundColor&&vn(Ls(t.style.backgroundColor),Ls(l)))){let b=t.firstElementChild;b instanceof HTMLCanvasElement&&(x=b.getContext("2d"))}if(x&&x.canvas.style.transform===r?(this.container=t,this.context=x,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){n=document.createElement("div"),n.className=c;let b=n.style;b.position="absolute",b.width="100%",b.height="100%",x=Fi();let S=x.canvas;n.appendChild(S),b=S.style,b.position="absolute",b.left="0",b.transformOrigin="top left",this.container=n,this.context=x}!this.containerReused&&l&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=l)}clipUnrotated(t,r,l){let c=Gg(l),n=Vg(l),x=Ng(l),b=jg(l);Ar(r.coordinateToPixelTransform,c),Ar(r.coordinateToPixelTransform,n),Ar(r.coordinateToPixelTransform,x),Ar(r.coordinateToPixelTransform,b);let S=this.inversePixelTransform;Ar(S,c),Ar(S,n),Ar(S,x),Ar(S,b),t.save(),t.beginPath(),t.moveTo(Math.round(c[0]),Math.round(c[1])),t.lineTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(x[0]),Math.round(x[1])),t.lineTo(Math.round(b[0]),Math.round(b[1])),t.clip()}prepareContainer(t,r){let l=t.extent,c=t.viewState.resolution,n=t.viewState.rotation,x=t.pixelRatio,b=Math.round(Ti(l)/c*x),S=Math.round(ar(l)/c*x);Yr(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/x,1/x,n,-b/2,-S/2),Pv(this.inversePixelTransform,this.pixelTransform);let R=Ag(this.pixelTransform);if(this.useContainer(r,R,this.getBackground(t)),!this.containerReused){let E=this.context.canvas;E.width!=b||E.height!=S?(E.width=b,E.height=S):this.context.clearRect(0,0,b,S),R!==E.style.transform&&(E.style.transform=R)}}dispatchRenderEvent_(t,r,l){let c=this.getLayer();if(c.hasListener(t)){let n=new j1(t,this.inversePixelTransform,l,r);c.dispatchEvent(n)}}preRender(t,r){this.frameState=r,!r.declutter&&this.dispatchRenderEvent_(Ws.PRERENDER,t,r)}postRender(t,r){r.declutter||this.dispatchRenderEvent_(Ws.POSTRENDER,t,r)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Nf),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Ws.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Ws.POSTRENDER,this.context,t))}getRenderTransform(t,r,l,c,n,x,b){let S=n/2,R=x/2,E=c/r,A=-E,z=-t[0]+b,W=-t[1];return Yr(this.tempTransform,S,R,E,A,-l,z,W)}disposeInternal(){delete this.frameState,super.disposeInternal()}},Gf=Ly;function N1(h,t,r,l,c,n,x,b,S,R,E,A,z=!0){let W=h[t],re=h[t+1],me=0,ge=0,be=0,ve=0;function De(){me=W,ge=re,t+=l,W=h[t],re=h[t+1],ve+=be,be=Math.sqrt((W-me)*(W-me)+(re-ge)*(re-ge))}do De();while(t<r-l&&ve+be<n);let ke=be===0?0:(n-ve)/be,je=Dr(me,W,ke),Re=Dr(ge,re,ke),tt=t-l,Je=ve,He=n+b*S(R,c,E);for(;t<r-l&&ve+be<He;)De();ke=be===0?0:(He-ve)/be;let ot=Dr(me,W,ke),vt=Dr(ge,re,ke),ct=!1;if(z)if(A){let dt=[je,Re,ot,vt];cf(dt,0,4,2,A,dt,dt),ct=dt[0]>dt[2]}else ct=je>ot;let It=Math.PI,ut=[],yt=tt+l===t;t=tt,be=0,ve=Je,W=h[t],re=h[t+1];let xt;if(yt){De(),xt=Math.atan2(re-ge,W-me),ct&&(xt+=xt>0?-It:It);let dt=(ot+je)/2,St=(vt+Re)/2;return ut[0]=[dt,St,(He-n)/2,xt,c],ut}c=c.replace(/\n/g," ");for(let dt=0,St=c.length;dt<St;){De();let qt=Math.atan2(re-ge,W-me);if(ct&&(qt+=qt>0?-It:It),xt!==void 0){let Bi=qt-xt;if(Bi+=Bi>It?-2*It:Bi<-It?2*It:0,Math.abs(Bi)>x)return null}xt=qt;let Ft=dt,Pt=0;for(;dt<St;++dt){let Bi=ct?St-dt-1:dt,Ai=b*S(R,c[Bi],E);if(t+l<r&&ve+be<n+Pt+Ai/2)break;Pt+=Ai}if(dt===Ft)continue;let jt=ct?c.substring(St-Ft,St-dt):c.substring(Ft,dt);ke=be===0?0:(n+Pt/2-ve)/be;let $t=Dr(me,W,ke),et=Dr(ge,re,ke);ut.push([$t,et,Pt/2,qt,jt]),n+=Pt}return ut}var Hc=wn(),Sa=[],zo=[],Oo=[],Ta=[];function G1(h){return h[3].declutterBox}var V1=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function Dy(h,t){return t==="start"?t=V1.test(h)?"right":"left":t==="end"&&(t=V1.test(h)?"left":"right"),_d[t]}function eM(h,t,r){return r>0&&h.push(`
731
731
  `,""),h.push(t,""),h}var Fy=class{constructor(t,r,l,c,n){this.overlaps=l,this.pixelRatio=r,this.resolution=t,this.alignAndScaleFill_,this.instructions=c.instructions,this.coordinates=c.coordinates,this.coordinateCache_={},this.renderedTransform_=yr(),this.hitDetectionInstructions=c.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=c.fillStates||{},this.strokeStates=c.strokeStates||{},this.textStates=c.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=n?new Nf:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,r,l,c){let n=t+r+l+c;if(this.labels_[n])return this.labels_[n];let x=c?this.strokeStates[c]:null,b=l?this.fillStates[l]:null,S=this.textStates[r],R=this.pixelRatio,E=[S.scale[0]*R,S.scale[1]*R],A=S.justify?_d[S.justify]:Dy(Array.isArray(t)?t[0]:t,S.textAlign||ya),z=c&&x.lineWidth?x.lineWidth:0,W=Array.isArray(t)?t:String(t).split(`
732
732
  `).reduce(eM,[]),{width:re,height:me,widths:ge,heights:be,lineWidths:ve}=d1(S,W),De=re+z,ke=[],je=(De+2)*E[0],Re=(me+z)*E[1],tt={width:je<0?Math.floor(je):Math.ceil(je),height:Re<0?Math.floor(Re):Math.ceil(Re),contextInstructions:ke};(E[0]!=1||E[1]!=1)&&ke.push("scale",E),c&&(ke.push("strokeStyle",x.strokeStyle),ke.push("lineWidth",z),ke.push("lineCap",x.lineCap),ke.push("lineJoin",x.lineJoin),ke.push("miterLimit",x.miterLimit),ke.push("setLineDash",[x.lineDash]),ke.push("lineDashOffset",x.lineDashOffset)),l&&ke.push("fillStyle",b.fillStyle),ke.push("textBaseline","middle"),ke.push("textAlign","center");let Je=.5-A,He=A*De+Je*z,ot=[],vt=[],ct=0,It=0,ut=0,yt=0,xt;for(let dt=0,St=W.length;dt<St;dt+=2){let qt=W[dt];if(qt===`
733
- `){It+=ct,ct=0,He=A*De+Je*z,++yt;continue}let Ft=W[dt+1]||S.font;Ft!==xt&&(c&&ot.push("font",Ft),l&&vt.push("font",Ft),xt=Ft),ct=Math.max(ct,be[ut]);let Pt=[qt,He+Je*ge[ut]+A*(ge[ut]-ve[yt]),.5*(z+ct)+It];He+=ge[ut],c&&ot.push("strokeText",Pt),l&&vt.push("fillText",Pt),++ut}return Array.prototype.push.apply(ke,ot),Array.prototype.push.apply(ke,vt),this.labels_[n]=tt,tt}replayTextBackground_(t,r,l,c,n,x,b){t.beginPath(),t.moveTo.apply(t,r),t.lineTo.apply(t,l),t.lineTo.apply(t,c),t.lineTo.apply(t,n),t.lineTo.apply(t,r),x&&(this.alignAndScaleFill_=x[2],this.fill_(t)),b&&(this.setStrokeStyle_(t,b),t.stroke())}calculateImageOrLabelDimensions_(t,r,l,c,n,x,b,S,R,E,A,z,W,re,me,ge){b*=z[0],S*=z[1];let be=l-b,ve=c-S,De=n+R>t?t-R:n,ke=x+E>r?r-E:x,je=re[3]+De*z[0]+re[1],Re=re[0]+ke*z[1]+re[2],tt=be-re[3],Je=ve-re[0];(me||A!==0)&&(Sa[0]=tt,Ta[0]=tt,Sa[1]=Je,zo[1]=Je,zo[0]=tt+je,Oo[0]=zo[0],Oo[1]=Je+Re,Ta[1]=Oo[1]);let He;return A!==0?(He=Yr(yr(),l,c,1,1,A,-l,-c),Ar(He,Sa),Ar(He,zo),Ar(He,Oo),Ar(He,Ta),Io(Math.min(Sa[0],zo[0],Oo[0],Ta[0]),Math.min(Sa[1],zo[1],Oo[1],Ta[1]),Math.max(Sa[0],zo[0],Oo[0],Ta[0]),Math.max(Sa[1],zo[1],Oo[1],Ta[1]),Hc)):Io(Math.min(tt,tt+je),Math.min(Je,Je+Re),Math.max(tt,tt+je),Math.max(Je,Je+Re),Hc),W&&(be=Math.round(be),ve=Math.round(ve)),{drawImageX:be,drawImageY:ve,drawImageW:De,drawImageH:ke,originX:R,originY:E,declutterBox:{minX:Hc[0],minY:Hc[1],maxX:Hc[2],maxY:Hc[3],value:ge},canvasTransform:He,scale:z}}replayImageOrLabel_(t,r,l,c,n,x,b){let S=!!(x||b),R=c.declutterBox,E=b?b[2]*c.scale[0]/2:0;return R.minX-E<=r[0]&&R.maxX+E>=0&&R.minY-E<=r[1]&&R.maxY+E>=0&&(S&&this.replayTextBackground_(t,Sa,zo,Oo,Ta,x,b),p1(t,c.canvasTransform,n,l,c.originX,c.originY,c.drawImageW,c.drawImageH,c.drawImageX,c.drawImageY,c.scale)),!0}fill_(t){let r=this.alignAndScaleFill_;if(r){let l=Ar(this.renderedTransform_,[0,0]),c=512*this.pixelRatio;t.save(),t.translate(l[0]%c,l[1]%c),r!==1&&t.scale(r,r),t.rotate(this.viewRotation_)}t.fill(),r&&t.restore()}setStrokeStyle_(t,r){t.strokeStyle=r[1],t.lineWidth=r[2],t.lineCap=r[3],t.lineJoin=r[4],t.miterLimit=r[5],t.lineDashOffset=r[7],t.setLineDash(r[6])}drawLabelWithPointPlacement_(t,r,l,c){let n=this.textStates[r],x=this.createLabel(t,r,c,l),b=this.strokeStates[l],S=this.pixelRatio,R=Dy(Array.isArray(t)?t[0]:t,n.textAlign||ya),E=_d[n.textBaseline||Tl],A=b&&b.lineWidth?b.lineWidth:0,z=x.width/S-2*n.scale[0],W=R*z+2*(.5-R)*A,re=E*x.height/S+2*(.5-E)*A;return{label:x,anchorX:W,anchorY:re}}execute_(t,r,l,c,n,x,b,S){let R=this.zIndexContext_,E;this.pixelCoordinates_&&vn(l,this.renderedTransform_)?E=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),E=Sn(this.coordinates,0,this.coordinates.length,2,l,this.pixelCoordinates_),Iv(this.renderedTransform_,l));let A=0,z=c.length,W=0,re,me,ge,be,ve,De,ke,je,Re,tt,Je,He,ot,vt=0,ct=0,It=null,ut=null,yt=this.coordinateCache_,xt=this.viewRotation_,dt=Math.round(Math.atan2(-l[1],l[0])*1e12)/1e12,St={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:xt},qt=this.instructions!=c||this.overlaps?0:200,Ft,Pt,jt,$t;for(;A<z;){let et=c[A];switch(et[0]){case bt.BEGIN_GEOMETRY:Ft=et[1],$t=et[3],Ft.getGeometry()?b!==void 0&&!er(b,$t.getExtent())?A=et[2]+1:++A:A=et[2],R&&(R.zIndex=et[4]);break;case bt.BEGIN_PATH:vt>qt&&(this.fill_(t),vt=0),ct>qt&&(t.stroke(),ct=0),!vt&&!ct&&(t.beginPath(),ve=NaN,De=NaN),++A;break;case bt.CIRCLE:W=et[1];let Ai=E[W],Ci=E[W+1],en=E[W+2],_i=E[W+3],ti=en-Ai,tn=_i-Ci,oi=Math.sqrt(ti*ti+tn*tn);t.moveTo(Ai+oi,Ci),t.arc(Ai,Ci,oi,0,2*Math.PI,!0),++A;break;case bt.CLOSE_PATH:t.closePath(),++A;break;case bt.CUSTOM:W=et[1],re=et[2];let gn=et[3],Ln=et[4],Tr=et[5];St.geometry=gn,St.feature=Ft,A in yt||(yt[A]=[]);let $i=yt[A];Tr?Tr(E,W,re,2,$i):($i[0]=E[W],$i[1]=E[W+1],$i.length=2),R&&(R.zIndex=et[6]),Ln($i,St),++A;break;case bt.DRAW_IMAGE:W=et[1],re=et[2],Re=et[3],me=et[4],ge=et[5];let yi=et[6],Li=et[7],rn=et[8],kn=et[9],nn=et[10],Dn=et[11],Qn=et[12],Nr=et[13];be=et[14]||"declutter";let sn=et[15];if(!Re&&et.length>=20){tt=et[19],Je=et[20],He=et[21],ot=et[22];let Ue=this.drawLabelWithPointPlacement_(tt,Je,He,ot);Re=Ue.label,et[3]=Re;let ht=et[23];me=(Ue.anchorX-ht)*this.pixelRatio,et[4]=me;let pt=et[24];ge=(Ue.anchorY-pt)*this.pixelRatio,et[5]=ge,yi=Re.height,et[6]=yi,Nr=Re.width,et[13]=Nr}let on;et.length>25&&(on=et[25]);let Fn,an,zn;et.length>17?(Fn=et[16],an=et[17],zn=et[18]):(Fn=Lo,an=!1,zn=!1),nn&&dt?Dn+=xt:!nn&&!dt&&(Dn-=xt);let zs=0;for(;W<re;W+=2){if(on&&on[zs++]<Nr/this.pixelRatio)continue;let Ue=this.calculateImageOrLabelDimensions_(Re.width,Re.height,E[W],E[W+1],Nr,yi,me,ge,rn,kn,Dn,Qn,n,Fn,an||zn,Ft),ht=[t,r,Re,Ue,Li,an?It:null,zn?ut:null];if(S){let pt,Pe,We;if(sn){let mt=re-W;if(!sn[mt]){sn[mt]={args:ht,declutterMode:be};continue}let nt=sn[mt];pt=nt.args,Pe=nt.declutterMode,delete sn[mt],We=G1(pt)}let Qe,wt;if(pt&&(Pe!=="declutter"||!S.collides(We))&&(Qe=!0),(be!=="declutter"||!S.collides(Ue.declutterBox))&&(wt=!0),Pe==="declutter"&&be==="declutter"){let mt=Qe&&wt;Qe=mt,wt=mt}Qe&&(Pe!=="none"&&S.insert(We),this.replayImageOrLabel_.apply(this,pt)),wt&&(be!=="none"&&S.insert(Ue.declutterBox),this.replayImageOrLabel_.apply(this,ht))}else this.replayImageOrLabel_.apply(this,ht)}++A;break;case bt.DRAW_CHARS:let Os=et[1],On=et[2],K=et[3],Z=et[4];ot=et[5];let $=et[6],X=et[7],ne=et[8];He=et[9];let he=et[10];tt=et[11],Je=et[12];let ye=[et[13],et[13]];be=et[14]||"declutter";let Te=et[15],_e=this.textStates[Je],Ee=_e.font,Ie=[_e.scale[0]*X,_e.scale[1]*X],xe;Ee in this.widths_?xe=this.widths_[Ee]:(xe={},this.widths_[Ee]=xe);let pe=mf(E,Os,On,2),Xe=Math.abs(Ie[0])*ty(Ee,tt,xe);if(Z||Xe<=pe){let Ue=this.textStates[Je].textAlign,ht=(pe-Xe)*Dy(tt,Ue),pt=N1(E,Os,On,2,tt,ht,$,Math.abs(Ie[0]),ty,Ee,xe,dt?0:this.viewRotation_,Te);e:if(pt){let Pe=[],We,Qe,wt,mt,nt;if(He)for(We=0,Qe=pt.length;We<Qe;++We){nt=pt[We],wt=nt[4],mt=this.createLabel(wt,Je,"",He),me=nt[2]+(Ie[0]<0?-he:he),ge=K*mt.height+(.5-K)*2*he*Ie[1]/Ie[0]-ne;let Ke=this.calculateImageOrLabelDimensions_(mt.width,mt.height,nt[0],nt[1],mt.width,mt.height,me,ge,0,0,nt[3],ye,!1,Lo,!1,Ft);if(S&&be==="declutter"&&S.collides(Ke.declutterBox))break e;Pe.push([t,r,mt,Ke,1,null,null])}if(ot)for(We=0,Qe=pt.length;We<Qe;++We){nt=pt[We],wt=nt[4],mt=this.createLabel(wt,Je,ot,""),me=nt[2],ge=K*mt.height-ne;let Ke=this.calculateImageOrLabelDimensions_(mt.width,mt.height,nt[0],nt[1],mt.width,mt.height,me,ge,0,0,nt[3],ye,!1,Lo,!1,Ft);if(S&&be==="declutter"&&S.collides(Ke.declutterBox))break e;Pe.push([t,r,mt,Ke,1,null,null])}S&&be!=="none"&&S.load(Pe.map(G1));for(let Ke=0,ai=Pe.length;Ke<ai;++Ke)this.replayImageOrLabel_.apply(this,Pe[Ke])}}++A;break;case bt.END_GEOMETRY:if(x!==void 0){Ft=et[1];let Ue=x(Ft,$t,be);if(Ue)return Ue}++A;break;case bt.FILL:qt?vt++:this.fill_(t),++A;break;case bt.MOVE_TO_LINE_TO:for(W=et[1],re=et[2],Pt=E[W],jt=E[W+1],t.moveTo(Pt,jt),ve=Pt+.5|0,De=jt+.5|0,W+=2;W<re;W+=2)Pt=E[W],jt=E[W+1],ke=Pt+.5|0,je=jt+.5|0,(W==re-2||ke!==ve||je!==De)&&(t.lineTo(Pt,jt),ve=ke,De=je);++A;break;case bt.SET_FILL_STYLE:It=et,this.alignAndScaleFill_=et[2],vt&&(this.fill_(t),vt=0,ct&&(t.stroke(),ct=0)),t.fillStyle=et[1],++A;break;case bt.SET_STROKE_STYLE:ut=et,ct&&(t.stroke(),ct=0),this.setStrokeStyle_(t,et),++A;break;case bt.STROKE:qt?ct++:t.stroke(),++A;break;default:++A;break}}vt&&this.fill_(t),ct&&t.stroke()}execute(t,r,l,c,n,x){this.viewRotation_=c,this.execute_(t,r,l,this.instructions,n,void 0,void 0,x)}executeHitDetection(t,r,l,c,n){return this.viewRotation_=l,this.execute_(t,[t.canvas.width,t.canvas.height],r,this.hitDetectionInstructions,!0,c,n)}},U1=Fy;var Il=["Polygon","Circle","LineString","Image","Text","Default"],By=["Image","Text"],Z1=Il.filter(h=>!By.includes(h)),Oy=class{constructor(t,r,l,c,n,x,b){this.maxExtent_=t,this.overlaps_=c,this.pixelRatio_=l,this.resolution_=r,this.renderBuffer_=x,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=yr(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(n,b)}clip(t,r){let l=this.getClipCoords(r);t.beginPath(),t.moveTo(l[0],l[1]),t.lineTo(l[2],l[3]),t.lineTo(l[4],l[5]),t.lineTo(l[6],l[7]),t.clip()}createExecutors_(t,r){for(let l in t){let c=this.executorsByZIndex_[l];c===void 0&&(c={},this.executorsByZIndex_[l]=c);let n=t[l];for(let x in n){let b=n[x];c[x]=new U1(this.resolution_,this.pixelRatio_,this.overlaps_,b,r)}}}hasExecutors(t){for(let r in this.executorsByZIndex_){let l=this.executorsByZIndex_[r];for(let c=0,n=t.length;c<n;++c)if(t[c]in l)return!0}return!1}forEachFeatureAtCoordinate(t,r,l,c,n,x){c=Math.round(c);let b=c*2+1,S=Yr(this.hitDetectionTransform_,c+.5,c+.5,1/r,-1/r,-l,-t[0],-t[1]),R=!this.hitDetectionContext_;R&&(this.hitDetectionContext_=Fi(b,b,void 0,{willReadFrequently:!0}));let E=this.hitDetectionContext_;E.canvas.width!==b||E.canvas.height!==b?(E.canvas.width=b,E.canvas.height=b):R||E.clearRect(0,0,b,b);let A;this.renderBuffer_!==void 0&&(A=wn(),Og(A,t),us(A,r*(this.renderBuffer_+c),A));let z=tM(c),W;function re(je,Re,tt){let Je=E.getImageData(0,0,b,b).data;for(let He=0,ot=z.length;He<ot;He++)if(Je[z[He]]>0){if(!x||tt==="none"||W!=="Image"&&W!=="Text"||x.includes(je)){let vt=(z[He]-3)/4,ct=c-vt%b,It=c-(vt/b|0),ut=n(je,Re,ct*ct+It*It);if(ut)return ut}E.clearRect(0,0,b,b);break}}let me=Object.keys(this.executorsByZIndex_).map(Number);me.sort(Ss);let ge,be,ve,De,ke;for(ge=me.length-1;ge>=0;--ge){let je=me[ge].toString();for(ve=this.executorsByZIndex_[je],be=Il.length-1;be>=0;--be)if(W=Il[be],De=ve[W],De!==void 0&&(ke=De.executeHitDetection(E,S,l,re,A),ke))return ke}}getClipCoords(t){let r=this.maxExtent_;if(!r)return null;let l=r[0],c=r[1],n=r[2],x=r[3],b=[l,c,l,x,n,x,n,c];return Sn(b,0,8,2,t,b),b}isEmpty(){return Xn(this.executorsByZIndex_)}execute(t,r,l,c,n,x,b){let S=Object.keys(this.executorsByZIndex_).map(Number);S.sort(b?Lv:Ss),x=x||Il;let R=Il.length;for(let E=0,A=S.length;E<A;++E){let z=S[E].toString(),W=this.executorsByZIndex_[z];for(let re=0,me=x.length;re<me;++re){let ge=x[re],be=W[ge];if(be!==void 0){let ve=b===null?void 0:be.getZIndexContext(),De=ve?ve.getContext():t,ke=this.maxExtent_&&ge!=="Image"&&ge!=="Text";if(ke&&(De.save(),this.clip(De,l)),!ve||ge==="Text"||ge==="Image"?be.execute(De,r,l,c,n,b):ve.pushFunction(je=>be.execute(je,r,l,c,n,b)),ke&&De.restore(),ve){ve.offset();let je=S[E]*R+re;this.deferredZIndexContexts_[je]||(this.deferredZIndexContexts_[je]=[]),this.deferredZIndexContexts_[je].push(ve)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let t=this.deferredZIndexContexts_,r=Object.keys(t).map(Number).sort(Ss);for(let l=0,c=r.length;l<c;++l)t[r[l]].forEach(n=>{n.draw(this.renderedContext_),n.clear()}),t[r[l]].length=0}},zy={};function tM(h){if(zy[h]!==void 0)return zy[h];let t=h*2+1,r=h*h,l=new Array(r+1);for(let n=0;n<=h;++n)for(let x=0;x<=h;++x){let b=n*n+x*x;if(b>r)break;let S=l[b];S||(S=[],l[b]=S),S.push(((h+n)*t+(h+x))*4+3),n>0&&S.push(((h-n)*t+(h+x))*4+3),x>0&&(S.push(((h+n)*t+(h-x))*4+3),n>0&&S.push(((h-n)*t+(h-x))*4+3))}let c=[];for(let n=0,x=l.length;n<x;++n)l[n]&&c.push(...l[n]);return zy[h]=c,c}var q1=Oy;var jy=class extends jf{constructor(t,r,l,c,n,x,b){super(),this.context_=t,this.pixelRatio_=r,this.extent_=l,this.transform_=c,this.transformRotation_=c?Xv(Math.atan2(c[1],c[0]),10):0,this.viewRotation_=n,this.squaredTolerance_=x,this.userTransform_=b,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=yr()}drawImages_(t,r,l,c){if(!this.image_)return;let n=Sn(t,r,l,c,this.transform_,this.pixelCoordinates_),x=this.context_,b=this.tmpLocalTransform_,S=x.globalAlpha;this.imageOpacity_!=1&&(x.globalAlpha=S*this.imageOpacity_);let R=this.imageRotation_;this.transformRotation_===0&&(R-=this.viewRotation_),this.imageRotateWithView_&&(R+=this.viewRotation_);for(let E=0,A=n.length;E<A;E+=2){let z=n[E]-this.imageAnchorX_,W=n[E+1]-this.imageAnchorY_;if(R!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let re=z+this.imageAnchorX_,me=W+this.imageAnchorY_;Yr(b,re,me,1,1,R,-re,-me),x.save(),x.transform.apply(x,b),x.translate(re,me),x.scale(this.imageScale_[0],this.imageScale_[1]),x.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),x.restore()}else x.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,z,W,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(x.globalAlpha=S)}drawText_(t,r,l,c){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let n=Sn(t,r,l,c,this.transform_,this.pixelCoordinates_),x=this.context_,b=this.textRotation_;for(this.transformRotation_===0&&(b-=this.viewRotation_),this.textRotateWithView_&&(b+=this.viewRotation_);r<l;r+=c){let S=n[r]+this.textOffsetX_,R=n[r+1]+this.textOffsetY_;b!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(x.save(),x.translate(S-this.textOffsetX_,R-this.textOffsetY_),x.rotate(b),x.translate(this.textOffsetX_,this.textOffsetY_),x.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&x.strokeText(this.text_,0,0),this.textFillState_&&x.fillText(this.text_,0,0),x.restore()):(this.textStrokeState_&&x.strokeText(this.text_,S,R),this.textFillState_&&x.fillText(this.text_,S,R))}}moveToLineTo_(t,r,l,c,n){let x=this.context_,b=Sn(t,r,l,c,this.transform_,this.pixelCoordinates_);x.moveTo(b[0],b[1]);let S=b.length;n&&(S-=2);for(let R=2;R<S;R+=2)x.lineTo(b[R],b[R+1]);return n&&x.closePath(),l}drawRings_(t,r,l,c){for(let n=0,x=l.length;n<x;++n)r=this.moveToLineTo_(t,r,l[n],c,!0);return r}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!er(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let r=vb(t,this.transform_,this.pixelCoordinates_),l=r[2]-r[0],c=r[3]-r[1],n=Math.sqrt(l*l+c*c),x=this.context_;x.beginPath(),x.arc(r[0],r[1],n,0,2*Math.PI),this.fillState_&&x.fill(),this.strokeState_&&x.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t);break;default:}}drawFeature(t,r){let l=r.getGeometryFunction()(t);l&&(this.setStyle(r),this.drawGeometry(l))}drawGeometryCollection(t){let r=t.getGeometriesArray();for(let l=0,c=r.length;l<c;++l)this.drawGeometry(r[l])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let r=t.getFlatCoordinates(),l=t.getStride();this.image_&&this.drawImages_(r,0,r.length,l),this.text_!==""&&this.drawText_(r,0,r.length,l)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let r=t.getFlatCoordinates(),l=t.getStride();this.image_&&this.drawImages_(r,0,r.length,l),this.text_!==""&&this.drawText_(r,0,r.length,l)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!er(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let r=this.context_,l=t.getFlatCoordinates();r.beginPath(),this.moveToLineTo_(l,0,l.length,t.getStride(),!1),r.stroke()}if(this.text_!==""){let r=t.getFlatMidpoint();this.drawText_(r,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let r=t.getExtent();if(er(this.extent_,r)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let l=this.context_,c=t.getFlatCoordinates(),n=0,x=t.getEnds(),b=t.getStride();l.beginPath();for(let S=0,R=x.length;S<R;++S)n=this.moveToLineTo_(c,n,x[S],b,!1);l.stroke()}if(this.text_!==""){let l=t.getFlatMidpoints();this.drawText_(l,0,l.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!er(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let r=this.context_;r.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}if(this.text_!==""){let r=t.getFlatInteriorPoint();this.drawText_(r,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!er(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let r=this.context_,l=t.getOrientedFlatCoordinates(),c=0,n=t.getEndss(),x=t.getStride();r.beginPath();for(let b=0,S=n.length;b<S;++b){let R=n[b];c=this.drawRings_(l,c,R,x)}this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}if(this.text_!==""){let r=t.getFlatInteriorPoints();this.drawText_(r,0,r.length,2)}}}setContextFillState_(t){let r=this.context_,l=this.contextFillState_;l?l.fillStyle!=t.fillStyle&&(l.fillStyle=t.fillStyle,r.fillStyle=t.fillStyle):(r.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){let r=this.context_,l=this.contextStrokeState_;l?(l.lineCap!=t.lineCap&&(l.lineCap=t.lineCap,r.lineCap=t.lineCap),vn(l.lineDash,t.lineDash)||r.setLineDash(l.lineDash=t.lineDash),l.lineDashOffset!=t.lineDashOffset&&(l.lineDashOffset=t.lineDashOffset,r.lineDashOffset=t.lineDashOffset),l.lineJoin!=t.lineJoin&&(l.lineJoin=t.lineJoin,r.lineJoin=t.lineJoin),l.lineWidth!=t.lineWidth&&(l.lineWidth=t.lineWidth,r.lineWidth=t.lineWidth),l.miterLimit!=t.miterLimit&&(l.miterLimit=t.miterLimit,r.miterLimit=t.miterLimit),l.strokeStyle!=t.strokeStyle&&(l.strokeStyle=t.strokeStyle,r.strokeStyle=t.strokeStyle)):(r.lineCap=t.lineCap,r.setLineDash(t.lineDash),r.lineDashOffset=t.lineDashOffset,r.lineJoin=t.lineJoin,r.lineWidth=t.lineWidth,r.miterLimit=t.miterLimit,r.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){let r=this.context_,l=this.contextTextState_,c=t.textAlign?t.textAlign:ya;l?(l.font!=t.font&&(l.font=t.font,r.font=t.font),l.textAlign!=c&&(l.textAlign=c,r.textAlign=c),l.textBaseline!=t.textBaseline&&(l.textBaseline=t.textBaseline,r.textBaseline=t.textBaseline)):(r.font=t.font,r.textAlign=c,r.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:c,textBaseline:t.textBaseline})}setFillStrokeStyle(t,r){if(!t)this.fillState_=null;else{let l=t.getColor();this.fillState_={fillStyle:Mn(l||hr)}}if(!r)this.strokeState_=null;else{let l=r.getColor(),c=r.getLineCap(),n=r.getLineDash(),x=r.getLineDashOffset(),b=r.getLineJoin(),S=r.getWidth(),R=r.getMiterLimit(),E=n||In;this.strokeState_={lineCap:c!==void 0?c:Xs,lineDash:this.pixelRatio_===1?E:E.map(A=>A*this.pixelRatio_),lineDashOffset:(x||En)*this.pixelRatio_,lineJoin:b!==void 0?b:Hs,lineWidth:(S!==void 0?S:ko)*this.pixelRatio_,miterLimit:R!==void 0?R:Ro,strokeStyle:Mn(l||Ao)}}}setImageStyle(t){let r;if(!t||!(r=t.getSize())){this.image_=null;return}let l=t.getPixelRatio(this.pixelRatio_),c=t.getAnchor(),n=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=c[0]*l,this.imageAnchorY_=c[1]*l,this.imageHeight_=r[1]*l,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=n[0],this.imageOriginY_=n[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();let x=t.getScaleArray();this.imageScale_=[x[0]*this.pixelRatio_/l,x[1]*this.pixelRatio_/l],this.imageWidth_=r[0]*l}setTextStyle(t){if(!t)this.text_="";else{let r=t.getFill();if(!r)this.textFillState_=null;else{let W=r.getColor();this.textFillState_={fillStyle:Mn(W||hr)}}let l=t.getStroke();if(!l)this.textStrokeState_=null;else{let W=l.getColor(),re=l.getLineCap(),me=l.getLineDash(),ge=l.getLineDashOffset(),be=l.getLineJoin(),ve=l.getWidth(),De=l.getMiterLimit();this.textStrokeState_={lineCap:re!==void 0?re:Xs,lineDash:me||In,lineDashOffset:ge||En,lineJoin:be!==void 0?be:Hs,lineWidth:ve!==void 0?ve:ko,miterLimit:De!==void 0?De:Ro,strokeStyle:Mn(W||Ao)}}let c=t.getFont(),n=t.getOffsetX(),x=t.getOffsetY(),b=t.getRotateWithView(),S=t.getRotation(),R=t.getScaleArray(),E=t.getText(),A=t.getTextAlign(),z=t.getTextBaseline();this.textState_={font:c!==void 0?c:Pf,textAlign:A!==void 0?A:ya,textBaseline:z!==void 0?z:Tl},this.text_=E!==void 0?Array.isArray(E)?E.reduce((W,re,me)=>W+=me%2?" ":re,""):E:"",this.textOffsetX_=n!==void 0?this.pixelRatio_*n:0,this.textOffsetY_=x!==void 0?this.pixelRatio_*x:0,this.textRotateWithView_=b!==void 0?b:!1,this.textRotation_=S!==void 0?S:0,this.textScale_=[this.pixelRatio_*R[0],this.pixelRatio_*R[1]]}}},W1=jy;var Ds=.5;function $1(h,t,r,l,c,n,x,b,S){let R=S?Zs(c,S):c,E=h[0]*Ds,A=h[1]*Ds,z=Fi(E,A);z.imageSmoothingEnabled=!1;let W=z.canvas,re=new W1(z,Ds,c,null,x,b,S?Dc(Hn(),S):null),me=r.length,ge=Math.floor((256*256*256-1)/me),be={};for(let De=1;De<=me;++De){let ke=r[De-1],je=ke.getStyleFunction()||l;if(!je)continue;let Re=je(ke,n);if(!Re)continue;Array.isArray(Re)||(Re=[Re]);let Je=(De*ge).toString(16).padStart(7,"#00000");for(let He=0,ot=Re.length;He<ot;++He){let vt=Re[He],ct=vt.getGeometryFunction()(ke);if(!ct||!er(R,ct.getExtent()))continue;let It=vt.clone(),ut=It.getFill();ut&&ut.setColor(Je);let yt=It.getStroke();yt&&(yt.setColor(Je),yt.setLineDash(null)),It.setText(void 0);let xt=vt.getImage();if(xt){let Ft=xt.getImageSize();if(!Ft)continue;let Pt=Fi(Ft[0],Ft[1],void 0,{alpha:!1}),jt=Pt.canvas;Pt.fillStyle=Je,Pt.fillRect(0,0,jt.width,jt.height),It.setImage(new ad({img:jt,anchor:xt.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:xt.getOrigin(),opacity:1,size:xt.getSize(),scale:xt.getScale(),rotation:xt.getRotation(),rotateWithView:xt.getRotateWithView()}))}let dt=It.getZIndex()||0,St=be[dt];St||(St={},be[dt]=St,St.Polygon=[],St.Circle=[],St.LineString=[],St.Point=[]);let qt=ct.getType();if(qt==="GeometryCollection"){let Ft=ct.getGeometriesArrayRecursive();for(let Pt=0,jt=Ft.length;Pt<jt;++Pt){let $t=Ft[Pt];St[$t.getType().replace("Multi","")].push($t,It)}}else St[qt.replace("Multi","")].push(ct,It)}}let ve=Object.keys(be).map(Number).sort(Ss);for(let De=0,ke=ve.length;De<ke;++De){let je=be[ve[De]];for(let Re in je){let tt=je[Re];for(let Je=0,He=tt.length;Je<He;Je+=2){re.setStyle(tt[Je+1]);for(let ot=0,vt=t.length;ot<vt;++ot)re.setTransform(t[ot]),re.drawGeometry(tt[Je])}}}return z.getImageData(0,0,W.width,W.height)}function X1(h,t,r){let l=[];if(r){let c=Math.floor(Math.round(h[0])*Ds),n=Math.floor(Math.round(h[1])*Ds),x=(Pi(c,0,r.width-1)+Pi(n,0,r.height-1)*r.width)*4,b=r.data[x],S=r.data[x+1],E=r.data[x+2]+256*(S+256*b),A=Math.floor((256*256*256-1)/t.length);E&&E%A===0&&l.push(t[E/A-1])}return l}var iM=.5,H1={Point:cM,LineString:oM,Polygon:uM,MultiPoint:hM,MultiLineString:aM,MultiPolygon:lM,GeometryCollection:sM,Circle:rM};function Y1(h,t){return parseInt(Gt(h),10)-parseInt(Gt(t),10)}function Ny(h,t){let r=Gy(h,t);return r*r}function Gy(h,t){return iM*h/t}function rM(h,t,r,l,c){let n=r.getFill(),x=r.getStroke();if(n||x){let S=h.getBuilder(r.getZIndex(),"Circle");S.setFillStrokeStyle(n,x),S.drawCircle(t,l,c)}let b=r.getText();if(b&&b.getText()){let S=h.getBuilder(r.getZIndex(),"Text");S.setTextStyle(b),S.drawText(t,l)}}function Vy(h,t,r,l,c,n,x,b){let S=[],R=r.getImage();if(R){let z=!0,W=R.getImageState();W==Mt.LOADED||W==Mt.ERROR?z=!1:W==Mt.IDLE&&R.load(),z&&S.push(R.ready())}let E=r.getFill();E&&E.loading()&&S.push(E.ready());let A=S.length>0;return A&&Promise.all(S).then(()=>c(null)),nM(h,t,r,l,n,x,b),A}function nM(h,t,r,l,c,n,x){let b=r.getGeometryFunction()(t);if(!b)return;let S=b.simplifyTransformed(l,c);if(r.getRenderer())K1(h,S,r,t,x);else{let E=H1[S.getType()];E(h,S,r,t,x,n)}}function K1(h,t,r,l,c){if(t.getType()=="GeometryCollection"){let x=t.getGeometries();for(let b=0,S=x.length;b<S;++b)K1(h,x[b],r,l,c);return}h.getBuilder(r.getZIndex(),"Default").drawCustom(t,l,r.getRenderer(),r.getHitDetectionRenderer(),c)}function sM(h,t,r,l,c,n){let x=t.getGeometriesArray(),b,S;for(b=0,S=x.length;b<S;++b){let R=H1[x[b].getType()];R(h,x[b],r,l,c,n)}}function oM(h,t,r,l,c){let n=r.getStroke();if(n){let b=h.getBuilder(r.getZIndex(),"LineString");b.setFillStrokeStyle(null,n),b.drawLineString(t,l,c)}let x=r.getText();if(x&&x.getText()){let b=h.getBuilder(r.getZIndex(),"Text");b.setTextStyle(x),b.drawText(t,l,c)}}function aM(h,t,r,l,c){let n=r.getStroke();if(n){let b=h.getBuilder(r.getZIndex(),"LineString");b.setFillStrokeStyle(null,n),b.drawMultiLineString(t,l,c)}let x=r.getText();if(x&&x.getText()){let b=h.getBuilder(r.getZIndex(),"Text");b.setTextStyle(x),b.drawText(t,l,c)}}function lM(h,t,r,l,c){let n=r.getFill(),x=r.getStroke();if(x||n){let S=h.getBuilder(r.getZIndex(),"Polygon");S.setFillStrokeStyle(n,x),S.drawMultiPolygon(t,l,c)}let b=r.getText();if(b&&b.getText()){let S=h.getBuilder(r.getZIndex(),"Text");S.setTextStyle(b),S.drawText(t,l,c)}}function cM(h,t,r,l,c,n){let x=r.getImage(),b=r.getText(),S=b&&b.getText(),R=n&&x&&S?{}:void 0;if(x){if(x.getImageState()!=Mt.LOADED)return;let E=h.getBuilder(r.getZIndex(),"Image");E.setImageStyle(x,R),E.drawPoint(t,l,c)}if(S){let E=h.getBuilder(r.getZIndex(),"Text");E.setTextStyle(b,R),E.drawText(t,l,c)}}function hM(h,t,r,l,c,n){let x=r.getImage(),b=x&&x.getOpacity()!==0,S=r.getText(),R=S&&S.getText(),E=n&&b&&R?{}:void 0;if(b){if(x.getImageState()!=Mt.LOADED)return;let A=h.getBuilder(r.getZIndex(),"Image");A.setImageStyle(x,E),A.drawMultiPoint(t,l,c)}if(R){let A=h.getBuilder(r.getZIndex(),"Text");A.setTextStyle(S,E),A.drawText(t,l,c)}}function uM(h,t,r,l,c){let n=r.getFill(),x=r.getStroke();if(n||x){let S=h.getBuilder(r.getZIndex(),"Polygon");S.setFillStrokeStyle(n,x),S.drawPolygon(t,l,c)}let b=r.getText();if(b&&b.getText()){let S=h.getBuilder(r.getZIndex(),"Text");S.setTextStyle(b),S.drawText(t,l,c)}}var Uy=class extends Gf{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=wn(),this.wrappedRenderedExtent_=wn(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,r,l){let c=r.extent,n=r.viewState,x=n.center,b=n.resolution,S=n.projection,R=n.rotation,E=S.getExtent(),A=this.getLayer().getSource(),z=this.getLayer().getDeclutter(),W=r.pixelRatio,re=r.viewHints,me=!(re[Tn.ANIMATING]||re[Tn.INTERACTING]),ge=this.context,be=Math.round(Ti(c)/b*W),ve=Math.round(ar(c)/b*W),De=A.getWrapX()&&S.canWrapX(),ke=De?Ti(E):null,je=De?Math.ceil((c[2]-E[2])/ke)+1:1,Re=De?Math.floor((c[0]-E[0])/ke):0;do{let tt=this.getRenderTransform(x,b,0,W,be,ve,Re*ke);r.declutter&&(tt=tt.slice(0)),t.execute(ge,[ge.canvas.width,ge.canvas.height],tt,R,me,l===void 0?Il:l?By:Z1,l?z&&r.declutter[z]:void 0)}while(++Re<je)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Fi(this.context.canvas.width,this.context.canvas.height,ky))}resetDrawContext_(){if(this.opacity_!==1){let t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,o1(this.context),ky.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),this.resetDrawContext_())}renderFrame(t,r){let l=t.layerStatesArray[t.layerIndex];this.opacity_=l.opacity;let c=t.viewState;this.prepareContainer(t,r);let n=this.context,x=this.replayGroup_,b=x&&!x.isEmpty();if(!b&&!(this.getLayer().hasListener(Ws.PRERENDER)||this.getLayer().hasListener(Ws.POSTRENDER)))return null;this.setDrawContext_(),this.preRender(n,t);let S=c.projection;if(this.clipped_=!1,b&&l.extent&&this.clipping){let R=qs(l.extent,S);b=er(R,t.extent),this.clipped_=b&&!Mo(R,t.extent),this.clipped_&&this.clipUnrotated(n,t,R)}return b&&this.renderWorlds(x,t,this.getLayer().getDeclutter()?!1:void 0),!t.declutter&&this.clipped_&&n.restore(),this.postRender(n,t),this.renderedRotation_!==c.rotation&&(this.renderedRotation_=c.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(r=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let l=this.frameState.size.slice(),c=this.renderedCenter_,n=this.renderedResolution_,x=this.renderedRotation_,b=this.renderedProjection_,S=this.wrappedRenderedExtent_,R=this.getLayer(),E=[],A=l[0]*Ds,z=l[1]*Ds;E.push(this.getRenderTransform(c,n,x,Ds,A,z,0).slice());let W=R.getSource(),re=b.getExtent();if(W.getWrapX()&&b.canWrapX()&&!Mo(re,S)){let ge=S[0],be=Ti(re),ve=0,De;for(;ge<re[0];)--ve,De=be*ve,E.push(this.getRenderTransform(c,n,x,Ds,A,z,De).slice()),ge+=be;for(ve=0,ge=S[2];ge>re[2];)++ve,De=be*ve,E.push(this.getRenderTransform(c,n,x,Ds,A,z,De).slice()),ge-=be}let me=Hn();this.hitDetectionImageData_=$1(l,E,this.renderedFeatures_,R.getStyleFunction(),S,n,x,Ny(n,this.renderedPixelRatio_),me?b:null)}r(X1(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,r,l,c,n){if(!this.replayGroup_)return;let x=r.viewState.resolution,b=r.viewState.rotation,S=this.getLayer(),R={},E=function(z,W,re){let me=Gt(z),ge=R[me];if(ge){if(ge!==!0&&re<ge.distanceSq){if(re===0)return R[me]=!0,n.splice(n.lastIndexOf(ge),1),c(z,S,W);ge.geometry=W,ge.distanceSq=re}}else{if(re===0)return R[me]=!0,c(z,S,W);n.push(R[me]={feature:z,layer:S,geometry:W,distanceSq:re,callback:c})}},A=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,x,b,l,E,A?r.declutter[A].all().map(z=>z.value):null)}handleFontsChanged(){let t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){let r=this.getLayer(),l=r.getSource();if(!l)return!1;let c=t.viewHints[Tn.ANIMATING],n=t.viewHints[Tn.INTERACTING],x=r.getUpdateWhileAnimating(),b=r.getUpdateWhileInteracting();if(this.ready&&!x&&c||!b&&n)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let S=t.extent,R=t.viewState,E=R.projection,A=R.resolution,z=t.pixelRatio,W=r.getRevision(),re=r.getRenderBuffer(),me=r.getRenderOrder();me===void 0&&(me=Y1);let ge=R.center.slice(),be=us(S,re*A),ve=be.slice(),De=[be.slice()],ke=E.getExtent();if(l.getWrapX()&&E.canWrapX()&&!Mo(ke,t.extent)){let yt=Ti(ke),xt=Math.max(Ti(be)/2,yt);be[0]=ke[0]-xt,be[2]=ke[2]+xt,Jv(ge,E);let dt=Ug(De[0],E);dt[0]<ke[0]&&dt[2]<ke[2]?De.push([dt[0]+yt,dt[1],dt[2]+yt,dt[3]]):dt[0]>ke[0]&&dt[2]>ke[2]&&De.push([dt[0]-yt,dt[1],dt[2]-yt,dt[3]])}if(this.ready&&this.renderedResolution_==A&&this.renderedRevision_==W&&this.renderedRenderOrder_==me&&this.renderedFrameDeclutter_===!!t.declutter&&Mo(this.wrappedRenderedExtent_,be))return vn(this.renderedExtent_,ve)||(this.hitDetectionImageData_=null,this.renderedExtent_=ve),this.renderedCenter_=ge,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let je=new B1(Gy(A,z),be,A,z),Re=Hn(),tt;if(Re){for(let yt=0,xt=De.length;yt<xt;++yt){let dt=De[yt],St=Zs(dt,E);l.loadFeatures(St,mb(A,E),Re)}tt=Dc(Re,E)}else for(let yt=0,xt=De.length;yt<xt;++yt)l.loadFeatures(De[yt],A,E);let Je=Ny(A,z),He=!0,ot=(yt,xt)=>{let dt,St=yt.getStyleFunction()||r.getStyleFunction();if(St&&(dt=St(yt,A)),dt){let qt=this.renderFeature(yt,Je,dt,je,tt,this.getLayer().getDeclutter(),xt);He=He&&!qt}},vt=Zs(be,E),ct=l.getFeaturesInExtent(vt);me&&ct.sort(me);for(let yt=0,xt=ct.length;yt<xt;++yt)ot(ct[yt],yt);this.renderedFeatures_=ct,this.ready=He;let It=je.finish(),ut=new q1(be,A,z,l.getOverlaps(),It,r.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=A,this.renderedRevision_=W,this.renderedRenderOrder_=me,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=ve,this.wrappedRenderedExtent_=be,this.renderedCenter_=ge,this.renderedProjection_=E,this.renderedPixelRatio_=z,this.replayGroup_=ut,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,r,l,c,n,x,b){if(!l)return!1;let S=!1;if(Array.isArray(l))for(let R=0,E=l.length;R<E;++R)S=Vy(c,t,l[R],r,this.boundHandleStyleImageChange_,n,x,b)||S;else S=Vy(c,t,l,r,this.boundHandleStyleImageChange_,n,x,b);return S}},J1=Uy;var Zy=class extends L1{constructor(t){super(t)}createRenderer(){return new J1(this)}},Yc=Zy;var qy=class{constructor(t){this.rbush_=new Cl(t),this.items_={}}insert(t,r){let l={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:r};this.rbush_.insert(l),this.items_[Gt(r)]=l}load(t,r){let l=new Array(r.length);for(let c=0,n=r.length;c<n;c++){let x=t[c],b=r[c],S={minX:x[0],minY:x[1],maxX:x[2],maxY:x[3],value:b};l[c]=S,this.items_[Gt(b)]=S}this.rbush_.load(l)}remove(t){let r=Gt(t),l=this.items_[r];return delete this.items_[r],this.rbush_.remove(l)!==null}update(t,r){let l=this.items_[Gt(r)],c=[l.minX,l.minY,l.maxX,l.maxY];Jp(c,t)||(this.remove(r),this.insert(t,r))}getAll(){return this.rbush_.all().map(function(r){return r.value})}getInExtent(t){let r={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(r).map(function(c){return c.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,r){return this.forEach_(this.getInExtent(t),r)}forEach_(t,r){let l;for(let c=0,n=t.length;c<n;c++)if(l=r(t[c]),l)return l;return l}isEmpty(){return Xn(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){let r=this.rbush_.toJSON();return Io(r.minX,r.minY,r.maxX,r.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(let r in t.items_)this.items_[r]=t.items_[r]}},yd=qy;var Q1=yr(),xd=class h{constructor(t,r,l,c,n,x){this.styleFunction,this.extent_,this.id_=x,this.type_=t,this.flatCoordinates_=r,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=l||null,this.properties_=n,this.squaredTolerance_,this.stride_=c,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?la(this.flatCoordinates_):Ic(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let t=ds(this.getExtent());this.flatInteriorPoints_=qu(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let t=kb(this.flatCoordinates_,this.ends_),r=yf(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=gf(this.flatCoordinates_,0,t,2,r)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=wl(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let t=this.flatCoordinates_,r=0,l=this.ends_;for(let c=0,n=l.length;c<n;++c){let x=l[c],b=wl(t,r,x,2,.5);Lr(this.flatMidpoints_,b),r=x}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,r){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){t=Ri(t);let r=t.getExtent(),l=t.getWorldExtent();if(r&&l){let c=ar(l)/ar(r);Yr(Q1,l[0],l[3],c,-c,0,0,0),Sn(this.flatCoordinates_,0,this.flatCoordinates_.length,2,Q1,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new h(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=$p((t,r)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),r&&this.simplifiedGeometry_.applyTransform(r);let l=this.simplifiedGeometry_.getFlatCoordinates(),c;switch(this.type_){case"LineString":l.length=bl(l,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,l,0),c=[l.length];break;case"MultiLineString":c=[],l.length=df(l,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,l,0,c);break;case"Polygon":c=[],l.length=Nu(l,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),l,0,c);break;default:}return c&&(this.simplifiedGeometry_=new h(this.type_,l,c,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}};xd.prototype.getFlatCoordinates=xd.prototype.getOrientedFlatCoordinates;var Fs=xd;var Wy=class extends xr{constructor(t){super(),this.projection=Ri(t.projection),this.attributions_=ew(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;let r=this;this.viewPromise_=new Promise(function(l,c){r.viewResolver=l,r.viewRejector=c})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=ew(t),this.changed()}setState(t){this.state_=t,this.changed()}};function ew(h){return h?typeof h=="function"?h:(Array.isArray(h)||(h=[h]),t=>h):null}var Bo=Wy;var Qr={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function tw(h,t){return[[-1/0,-1/0,1/0,1/0]]}var dM=!1;function pM(h,t,r,l,c,n,x){let b=new XMLHttpRequest;b.open("GET",typeof h=="function"?h(r,l,c):h,!0),t.getType()=="arraybuffer"&&(b.responseType="arraybuffer"),b.withCredentials=dM,b.onload=function(S){if(!b.status||b.status>=200&&b.status<300){let R=t.getType();try{let E;R=="text"||R=="json"?E=b.responseText:R=="xml"?E=b.responseXML||b.responseText:R=="arraybuffer"&&(E=b.response),E?n(t.readFeatures(E,{extent:r,featureProjection:c}),t.readProjection(E)):x()}catch{x()}}else x()},b.onerror=x,b.send()}function $y(h,t){return function(r,l,c,n,x){let b=this;pM(h,t,r,l,c,function(S,R){b.addFeatures(S),n!==void 0&&n(S)},x||Ts)}}var Qs=class extends Ei{constructor(t,r,l){super(t),this.feature=r,this.features=l}},Xy=class extends Bo{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:t.wrapX!==void 0?t.wrapX:!0}),this.on,this.once,this.un,this.loader_=Ts,this.format_=t.format||null,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(di(this.format_,"`format` must be set when `url` is set"),this.loader_=$y(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:tw;let r=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=r?new yd:null,this.loadedExtentsRtree_=new yd,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let l,c;Array.isArray(t.features)?c=t.features:t.features&&(l=t.features,c=l.getArray()),!r&&l===void 0&&(l=new Qu(c)),c!==void 0&&this.addFeaturesInternal(c),l!==void 0&&this.bindFeaturesCollection_(l)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){let r=Gt(t);if(!this.addToIndex_(r,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(r,t);let l=t.getGeometry();if(l){let c=l.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(c,t)}else this.nullGeometryFeatures_[r]=t;this.dispatchEvent(new Qs(Qr.ADDFEATURE,t))}setupChangeEvents_(t,r){r instanceof Fs||(this.featureChangeKeys_[t]=[kr(r,gi.CHANGE,this.handleFeatureChange_,this),kr(r,Zp.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,r){let l=!0;if(r.getId()!==void 0){let c=String(r.getId());if(!(c in this.idIndex_))this.idIndex_[c]=r;else if(r instanceof Fs){let n=this.idIndex_[c];n instanceof Fs?Array.isArray(n)?n.push(r):this.idIndex_[c]=[n,r]:l=!1}else l=!1}return l&&(di(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=r),l}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){let r=[],l=[],c=[];for(let n=0,x=t.length;n<x;n++){let b=t[n],S=Gt(b);this.addToIndex_(S,b)&&l.push(b)}for(let n=0,x=l.length;n<x;n++){let b=l[n],S=Gt(b);this.setupChangeEvents_(S,b);let R=b.getGeometry();if(R){let E=R.getExtent();r.push(E),c.push(b)}else this.nullGeometryFeatures_[S]=b}if(this.featuresRtree_&&this.featuresRtree_.load(r,c),this.hasListener(Qr.ADDFEATURE))for(let n=0,x=l.length;n<x;n++)this.dispatchEvent(new Qs(Qr.ADDFEATURE,l[n]))}bindFeaturesCollection_(t){let r=!1;this.addEventListener(Qr.ADDFEATURE,function(l){r||(r=!0,t.push(l.feature),r=!1)}),this.addEventListener(Qr.REMOVEFEATURE,function(l){r||(r=!0,t.remove(l.feature),r=!1)}),t.addEventListener(As.ADD,l=>{r||(r=!0,this.addFeature(l.element),r=!1)}),t.addEventListener(As.REMOVE,l=>{r||(r=!0,this.removeFeature(l.element),r=!1)}),this.featuresCollection_=t}clear(t){if(t){for(let l in this.featureChangeKeys_)this.featureChangeKeys_[l].forEach(Kr);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(l=>{this.removeFeatureInternal(l)});for(let l in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[l])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let r=new Qs(Qr.CLEAR);this.dispatchEvent(r),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,r){let l=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(l,function(c){let n=c.getGeometry();if(n instanceof Fs||n.intersectsCoordinate(t))return r(c)})}forEachFeatureInExtent(t,r){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,r);this.featuresCollection_&&this.featuresCollection_.forEach(r)}forEachFeatureIntersectingExtent(t,r){return this.forEachFeatureInExtent(t,function(l){let c=l.getGeometry();if(c instanceof Fs||c.intersectsExtent(t)){let n=r(l);if(n)return n}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),Xn(this.nullGeometryFeatures_)||Lr(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){let r=[];return this.forEachFeatureAtCoordinateDirect(t,function(l){r.push(l)}),r}getFeaturesInExtent(t,r){if(this.featuresRtree_){if(!(r&&r.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);let c=Gv(t,r);return[].concat(...c.map(n=>this.featuresRtree_.getInExtent(n)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,r){let l=t[0],c=t[1],n=null,x=[NaN,NaN],b=1/0,S=[-1/0,-1/0,1/0,1/0];return r=r||Wp,this.featuresRtree_.forEachInExtent(S,function(R){if(r(R)){let E=R.getGeometry(),A=b;if(b=E instanceof Fs?0:E.closestPointXY(l,c,x,b),b<A){n=R;let z=Math.sqrt(b);S[0]=l-z,S[1]=c-z,S[2]=l+z,S[3]=c+z}}}),n}getExtent(t){return this.featuresRtree_.getExtent(t)}getFeatureById(t){let r=this.idIndex_[t.toString()];return r!==void 0?r:null}getFeatureByUid(t){let r=this.uidIndex_[t];return r!==void 0?r:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){let r=t.target,l=Gt(r),c=r.getGeometry();if(!c)l in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(r),this.nullGeometryFeatures_[l]=r);else{let x=c.getExtent();l in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[l],this.featuresRtree_&&this.featuresRtree_.insert(x,r)):this.featuresRtree_&&this.featuresRtree_.update(x,r)}let n=r.getId();if(n!==void 0){let x=n.toString();this.idIndex_[x]!==r&&(this.removeFromIdIndex_(r),this.idIndex_[x]=r)}else this.removeFromIdIndex_(r),this.uidIndex_[l]=r;this.changed(),this.dispatchEvent(new Qs(Qr.CHANGEFEATURE,r))}hasFeature(t){let r=t.getId();return r!==void 0?r in this.idIndex_:Gt(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Xn(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(t,r,l){let c=this.loadedExtentsRtree_,n=this.strategy_(t,r,l);for(let x=0,b=n.length;x<b;++x){let S=n[x];c.forEachInExtent(S,function(E){return Mo(E.extent,S)})||(++this.loadingExtentsCount_,this.dispatchEvent(new Qs(Qr.FEATURESLOADSTART)),this.loader_.call(this,S,r,l,E=>{--this.loadingExtentsCount_,this.dispatchEvent(new Qs(Qr.FEATURESLOADEND,void 0,E))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Qs(Qr.FEATURESLOADERROR))}),c.insert(S,{extent:S.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){let r=this.loadedExtentsRtree_,l=r.forEachInExtent(t,function(c){if(Jp(c.extent,t))return c});l&&r.remove(l)}removeFeatures(t){let r=!1;for(let l=0,c=t.length;l<c;++l)r=this.removeFeatureInternal(t[l])||r;r&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){let r=Gt(t);if(!(r in this.uidIndex_))return!1;r in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[r]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.featureChangeKeys_[r]?.forEach(Kr),delete this.featureChangeKeys_[r];let c=t.getId();if(c!==void 0){let n=c.toString(),x=this.idIndex_[n];x===t?delete this.idIndex_[n]:Array.isArray(x)&&(x.splice(x.indexOf(t),1),x.length===1&&(this.idIndex_[n]=x[0]))}return delete this.uidIndex_[r],this.hasListener(Qr.REMOVEFEATURE)&&this.dispatchEvent(new Qs(Qr.REMOVEFEATURE,t)),!0}removeFromIdIndex_(t){for(let r in this.idIndex_)if(this.idIndex_[r]===t){delete this.idIndex_[r];break}}setLoader(t){this.loader_=t}setUrl(t){di(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader($y(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}},El=Xy;var Jn={SINGLECLICK:"singleclick",CLICK:gi.CLICK,DBLCLICK:gi.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var Hy={ACTIVE:"active"};var Yy=class extends xr{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Hy.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Hy.ACTIVE,t)}setMap(t){this.map_=t}};var iw=Yy;var Ky=class extends iw{constructor(t){t=t||{},super(t),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let r=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==Jn.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==Jn.POINTERUP){let l=this.handleUpEvent(t);this.handlingDownUpSequence=l&&this.targetPointers.length>0}}else if(t.type==Jn.POINTERDOWN){let l=this.handleDownEvent(t);this.handlingDownUpSequence=l,r=this.stopDown(l)}else t.type==Jn.POINTERMOVE&&this.handleMoveEvent(t);return!r}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}};var rw=Ky;var nw=function(h){let t=h.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey};var sw=Wp,ow=function(h){return h.type==Jn.CLICK};var aw=function(h){return h.type==Jn.SINGLECLICK};var lw=function(h){let t=h.originalEvent;return di(t!==void 0,"mapBrowserEvent must originate from a pointer event"),t.isPrimary&&t.button===0};var Jy=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=gs,this.supportedMediaTypes=null}getReadOptions(t,r){if(r){let l=r.dataProjection?Ri(r.dataProjection):this.readProjection(t);r.extent&&l&&l.getUnits()==="tile-pixels"&&(l=Ri(l),l.setWorldExtent(r.extent)),r={dataProjection:l,featureProjection:r.featureProjection}}return this.adaptOptions(r)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return Tt()}readFeature(t,r){return Tt()}readFeatures(t,r){return Tt()}readGeometry(t,r){return Tt()}readProjection(t){return Tt()}writeFeature(t,r){return Tt()}writeFeatures(t,r){return Tt()}writeGeometry(t,r){return Tt()}},cw=Jy;function Vf(h,t,r){let l=r?Ri(r.featureProjection):null,c=r?Ri(r.dataProjection):null,n=h;if(l&&c&&!fb(l,c)){t&&(n=h.clone());let x=t?l:c,b=t?c:l;x.getUnits()==="tile-pixels"?n.transform(x,b):n.applyTransform(xl(x,b))}if(t&&r&&r.decimals!==void 0){let x=Math.pow(10,r.decimals),b=function(S){for(let R=0,E=S.length;R<E;++R)S[R]=Math.round(S[R]*x)/x;return S};n===h&&(n=h.clone()),n.applyTransform(b)}return n}var fM={Point:br,LineString:Es,Polygon:zc,MultiPoint:Zu,MultiLineString:g_,MultiPolygon:S_};function mM(h,t,r){return Array.isArray(t[0])?(_f(h,0,t,r)||(h=h.slice(),$u(h,0,t,r)),h):(Wu(h,0,t,r)||(h=h.slice(),Fc(h,0,t,r)),h)}function Qy(h,t){let r=h.geometry;if(!r)return[];if(Array.isArray(r))return r.map(n=>Qy({...h,geometry:n})).flat();let l=r.type==="MultiPolygon"?"Polygon":r.type;if(l==="GeometryCollection"||l==="Circle")throw new Error("Unsupported geometry type: "+l);let c=r.layout.length;return Vf(new Fs(l,l==="Polygon"?mM(r.flatCoordinates,r.ends,c):r.flatCoordinates,r.ends?.flat(),c,h.properties||{},h.id).enableSimplifyTransformed(),!1,t)}function Uf(h,t){if(!h)return null;if(Array.isArray(h)){let l=h.map(c=>Uf(c,t));return new l_(l)}let r=fM[h.type];return Vf(new r(h.flatCoordinates,h.layout,h.ends),!1,t)}var e0=class extends cw{constructor(){super()}getType(){return"json"}readFeature(t,r){return this.readFeatureFromObject(Zf(t),this.getReadOptions(t,r))}readFeatures(t,r){return this.readFeaturesFromObject(Zf(t),this.getReadOptions(t,r))}readFeatureFromObject(t,r){return Tt()}readFeaturesFromObject(t,r){return Tt()}readGeometry(t,r){return this.readGeometryFromObject(Zf(t),this.getReadOptions(t,r))}readGeometryFromObject(t,r){return Tt()}readProjection(t){return this.readProjectionFromObject(Zf(t))}readProjectionFromObject(t){return Tt()}writeFeature(t,r){return JSON.stringify(this.writeFeatureObject(t,r))}writeFeatureObject(t,r){return Tt()}writeFeatures(t,r){return JSON.stringify(this.writeFeaturesObject(t,r))}writeFeaturesObject(t,r){return Tt()}writeGeometry(t,r){return JSON.stringify(this.writeGeometryObject(t,r))}writeGeometryObject(t,r){return Tt()}};function Zf(h){if(typeof h=="string"){let t=JSON.parse(h);return t||null}return h!==null?h:null}var hw=e0;var t0=class extends hw{constructor(t){t=t||{},super(),this.dataProjection=Ri(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=Ri(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,r){let l=null;t.type==="Feature"?l=t:l={type:"Feature",geometry:t,properties:null};let c=r0(l.geometry,r);if(this.featureClass===Fs)return Qy({geometry:c,id:l.id,properties:l.properties},r);let n=new gs;return this.geometryName_?n.setGeometryName(this.geometryName_):this.extractGeometryName_&&l.geometry_name&&n.setGeometryName(l.geometry_name),n.setGeometry(Uf(c,r)),"id"in l&&n.setId(l.id),l.properties&&n.setProperties(l.properties,!0),n}readFeaturesFromObject(t,r){let l=t,c=null;if(l.type==="FeatureCollection"){let n=t;c=[];let x=n.features;for(let b=0,S=x.length;b<S;++b){let R=this.readFeatureFromObject(x[b],r);R&&c.push(R)}}else c=[this.readFeatureFromObject(t,r)];return c.flat()}readGeometryFromObject(t,r){return gM(t,r)}readProjectionFromObject(t){let r=t.crs,l;if(r)if(r.type=="name")l=Ri(r.properties.name);else if(r.type==="EPSG")l=Ri("EPSG:"+r.properties.code);else throw new Error("Unknown SRS type");else l=this.dataProjection;return l}writeFeatureObject(t,r){r=this.adaptOptions(r);let l={type:"Feature",geometry:null,properties:null},c=t.getId();if(c!==void 0&&(l.id=c),!t.hasProperties())return l;let n=t.getProperties(),x=t.getGeometry();return x&&(l.geometry=i0(x,r),delete n[t.getGeometryName()]),Xn(n)||(l.properties=n),l}writeFeaturesObject(t,r){r=this.adaptOptions(r);let l=[];for(let c=0,n=t.length;c<n;++c)l.push(this.writeFeatureObject(t[c],r));return{type:"FeatureCollection",features:l}}writeGeometryObject(t,r){return i0(t,this.adaptOptions(r))}};function r0(h,t){if(!h)return null;let r;switch(h.type){case"Point":{r=yM(h);break}case"LineString":{r=xM(h);break}case"Polygon":{r=SM(h);break}case"MultiPoint":{r=bM(h);break}case"MultiLineString":{r=vM(h);break}case"MultiPolygon":{r=wM(h);break}case"GeometryCollection":{r=_M(h);break}default:throw new Error("Unsupported GeoJSON type: "+h.type)}return r}function gM(h,t){let r=r0(h,t);return Uf(r,t)}function _M(h,t){return h.geometries.map(function(l){return r0(l,t)})}function yM(h){let t=h.coordinates;return{type:"Point",flatCoordinates:t,layout:ua(t.length)}}function xM(h){let t=h.coordinates,r=t.flat();return{type:"LineString",flatCoordinates:r,ends:[r.length],layout:ua(t[0]?.length||2)}}function vM(h){let t=h.coordinates,r=t[0]?.[0]?.length||2,l=[],c=da(l,0,t,r);return{type:"MultiLineString",flatCoordinates:l,ends:c,layout:ua(r)}}function bM(h){let t=h.coordinates;return{type:"MultiPoint",flatCoordinates:t.flat(),layout:ua(t[0]?.length||2)}}function wM(h){let t=h.coordinates,r=[],l=t[0]?.[0]?.[0].length||2,c=uf(r,0,t,l);return{type:"MultiPolygon",flatCoordinates:r,ends:c,layout:ua(l)}}function SM(h){let t=h.coordinates,r=[],l=t[0]?.[0]?.length,c=da(r,0,t,l);return{type:"Polygon",flatCoordinates:r,ends:c,layout:ua(l)}}function i0(h,t){h=Vf(h,!0,t);let r=h.getType(),l;switch(r){case"Point":{l=PM(h,t);break}case"LineString":{l=CM(h,t);break}case"Polygon":{l=RM(h,t);break}case"MultiPoint":{l=IM(h,t);break}case"MultiLineString":{l=MM(h,t);break}case"MultiPolygon":{l=EM(h,t);break}case"GeometryCollection":{l=TM(h,t);break}case"Circle":{l={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+r)}return l}function TM(h,t){return t=Object.assign({},t),delete t.featureProjection,{type:"GeometryCollection",geometries:h.getGeometriesArray().map(function(l){return i0(l,t)})}}function CM(h,t){return{type:"LineString",coordinates:h.getCoordinates()}}function MM(h,t){return{type:"MultiLineString",coordinates:h.getCoordinates()}}function IM(h,t){return{type:"MultiPoint",coordinates:h.getCoordinates()}}function EM(h,t){let r;return t&&(r=t.rightHanded),{type:"MultiPolygon",coordinates:h.getCoordinates(r)}}function PM(h,t){return{type:"Point",coordinates:h.getCoordinates()}}function RM(h,t){let r;return t&&(r=t.rightHanded),{type:"Polygon",coordinates:h.getCoordinates(r)}}var Sr=t0;var uw=0,vd=1,dw=[0,0,0,0],Kc=[],n0={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},bd=class extends Ei{constructor(t,r,l){super(t),this.features=r,this.mapBrowserEvent=l}},s0=class extends rw{constructor(t){super(t),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=t.condition?t.condition:lw,this.defaultDeleteCondition_=function(l){return nw(l)&&aw(l)},this.deleteCondition_=t.deleteCondition?t.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=t.insertVertexCondition?t.insertVertexCondition:sw,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new yd,this.pixelTolerance_=t.pixelTolerance!==void 0?t.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new Yc({source:new El({useSpatialIndex:!1,wrapX:!!t.wrapX}),style:t.style?t.style:LM(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.hitDetection_=null;let r;if(t.features?r=t.features:t.source&&(this.source_=t.source,r=new Qu(this.source_.getFeatures()),this.source_.addEventListener(Qr.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(Qr.REMOVEFEATURE,this.handleSourceRemove_.bind(this))),!r)throw new Error("The modify interaction requires features, a source or a layer");t.hitDetection&&(this.hitDetection_=t.hitDetection),this.features_=r,this.features_.forEach(this.addFeature_.bind(this)),this.features_.addEventListener(As.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(As.REMOVE,this.handleFeatureRemove_.bind(this)),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=t.snapToPointer===void 0?!this.hitDetection_:t.snapToPointer}addFeature_(t){let r=t.getGeometry();if(r){let c=this.SEGMENT_WRITERS_[r.getType()];c&&c(t,r)}let l=this.getMap();l&&l.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(l.getCoordinateFromPixel(this.lastPixel_)),t.addEventListener(gi.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(t,r){if(!this.featuresBeingModified_){this.featuresBeingModified_=new Qu;let l=this.featuresBeingModified_.getArray();for(let c=0,n=r.length;c<n;++c){let x=r[c].feature;x&&!l.includes(x)&&this.featuresBeingModified_.push(x)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new bd(n0.MODIFYSTART,this.featuresBeingModified_,t))}}removeFeature_(t){this.removeFeatureSegmentData_(t),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.removeEventListener(gi.CHANGE,this.boundHandleFeatureChange_)}removeFeatureSegmentData_(t){let r=this.rBush_,l=[];r.forEach(function(c){t===c.feature&&l.push(c)});for(let c=l.length-1;c>=0;--c){let n=l[c];for(let x=this.dragSegments_.length-1;x>=0;--x)this.dragSegments_[x][0]===n&&this.dragSegments_.splice(x,1);r.remove(n)}}setActive(t){this.vertexFeature_&&!t&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(t)}setMap(t){this.overlay_.setMap(t),super.setMap(t)}getOverlay(){return this.overlay_}handleSourceAdd_(t){t.feature&&this.features_.push(t.feature)}handleSourceRemove_(t){t.feature&&this.features_.remove(t.feature)}handleFeatureAdd_(t){this.addFeature_(t.element)}handleFeatureChange_(t){if(!this.changingFeature_){let r=t.target;this.removeFeature_(r),this.addFeature_(r)}}handleFeatureRemove_(t){this.removeFeature_(t.element)}writePointGeometry_(t,r){let l=r.getCoordinates(),c={feature:t,geometry:r,segment:[l,l]};this.rBush_.insert(r.getExtent(),c)}writeMultiPointGeometry_(t,r){let l=r.getCoordinates();for(let c=0,n=l.length;c<n;++c){let x=l[c],b={feature:t,geometry:r,depth:[c],index:c,segment:[x,x]};this.rBush_.insert(r.getExtent(),b)}}writeLineStringGeometry_(t,r){let l=r.getCoordinates();for(let c=0,n=l.length-1;c<n;++c){let x=l.slice(c,c+2),b={feature:t,geometry:r,index:c,segment:x};this.rBush_.insert(hs(x),b)}}writeMultiLineStringGeometry_(t,r){let l=r.getCoordinates();for(let c=0,n=l.length;c<n;++c){let x=l[c];for(let b=0,S=x.length-1;b<S;++b){let R=x.slice(b,b+2),E={feature:t,geometry:r,depth:[c],index:b,segment:R};this.rBush_.insert(hs(R),E)}}}writePolygonGeometry_(t,r){let l=r.getCoordinates();for(let c=0,n=l.length;c<n;++c){let x=l[c];for(let b=0,S=x.length-1;b<S;++b){let R=x.slice(b,b+2),E={feature:t,geometry:r,depth:[c],index:b,segment:R};this.rBush_.insert(hs(R),E)}}}writeMultiPolygonGeometry_(t,r){let l=r.getCoordinates();for(let c=0,n=l.length;c<n;++c){let x=l[c];for(let b=0,S=x.length;b<S;++b){let R=x[b];for(let E=0,A=R.length-1;E<A;++E){let z=R.slice(E,E+2),W={feature:t,geometry:r,depth:[b,c],index:E,segment:z};this.rBush_.insert(hs(z),W)}}}}writeCircleGeometry_(t,r){let l=r.getCenter(),c={feature:t,geometry:r,index:uw,segment:[l,l]},n={feature:t,geometry:r,index:vd,segment:[l,l]},x=[c,n];c.featureSegments=x,n.featureSegments=x,this.rBush_.insert(la(l),c);let b=r,S=Hn();if(S&&this.getMap()){let R=this.getMap().getView().getProjection();b=b.clone().transform(S,R),b=b_(b).transform(R,S)}this.rBush_.insert(b.getExtent(),n)}writeGeometryCollectionGeometry_(t,r){let l=r.getGeometriesArray();for(let c=0;c<l.length;++c){let n=l[c],x=this.SEGMENT_WRITERS_[n.getType()];x(t,n)}}createOrUpdateVertexFeature_(t,r,l,c){let n=this.vertexFeature_;return n?n.getGeometry().setCoordinates(t):(n=new gs(new br(t)),this.vertexFeature_=n,this.overlay_.getSource().addFeature(n)),n.set("features",r),n.set("geometries",l),n.set("existing",c),n}handleEvent(t){if(!t.originalEvent)return!0;this.lastPointerEvent_=t;let r;return!t.map.getView().getInteracting()&&t.type==Jn.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(t),this.vertexFeature_&&this.deleteCondition_(t)&&(t.type!=Jn.SINGLECLICK||!this.ignoreNextSingleClick_?r=this.removePoint():r=!0),t.type==Jn.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),super.handleEvent(t)&&!r}findInsertVerticesAndUpdateDragSegments_(t){this.handlePointerAtPixel_(t),this.dragSegments_.length=0,this.featuresBeingModified_=null;let r=this.vertexFeature_;if(!r)return;let l=this.getMap().getView().getProjection(),c=[],n=r.getGeometry().getCoordinates(),x=hs([n]),b=this.rBush_.getInExtent(x),S={};b.sort(AM);for(let R=0,E=b.length;R<E;++R){let A=b[R],z=A.segment,W=Gt(A.geometry),re=A.depth;if(re&&(W+="-"+re.join("-")),S[W]||(S[W]=new Array(2)),A.geometry.getType()==="Circle"&&A.index===vd){let me=fw(t,A,l);lr(me,n)&&!S[W][0]&&(this.dragSegments_.push([A,0]),S[W][0]=A);continue}if(lr(z[0],n)&&!S[W][0]){this.dragSegments_.push([A,0]),S[W][0]=A;continue}if(lr(z[1],n)&&!S[W][1]){if(S[W][0]&&S[W][0].index===0){let me=A.geometry.getCoordinates();switch(A.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":me=me[re[1]];case"Polygon":if(A.index!==me[re[0]].length-2)continue;break;default:}}this.dragSegments_.push([A,1]),S[W][1]=A;continue}Gt(z)in this.vertexSegments_&&!S[W][0]&&!S[W][1]&&c.push(A)}return c}handleDragEvent(t){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(t,this.dragSegments_.map(([n])=>n));let r=[t.coordinate[0]+this.delta_[0],t.coordinate[1]+this.delta_[1]],l=[],c=[];for(let n=0,x=this.dragSegments_.length;n<x;++n){let b=this.dragSegments_[n],S=b[0],R=S.feature;l.includes(R)||l.push(R);let E=S.geometry;c.includes(E)||c.push(E);let A=S.depth,z,W=S.segment,re=b[1];for(;r.length<E.getStride();)r.push(W[re][r.length]);switch(E.getType()){case"Point":z=r,W[0]=r,W[1]=r;break;case"MultiPoint":z=E.getCoordinates(),z[S.index]=r,W[0]=r,W[1]=r;break;case"LineString":z=E.getCoordinates(),z[S.index+re]=r,W[re]=r;break;case"MultiLineString":z=E.getCoordinates(),z[A[0]][S.index+re]=r,W[re]=r;break;case"Polygon":z=E.getCoordinates(),z[A[0]][S.index+re]=r,W[re]=r;break;case"MultiPolygon":z=E.getCoordinates(),z[A[1]][A[0]][S.index+re]=r,W[re]=r;break;case"Circle":let me=E;if(W[0]=r,W[1]=r,S.index===uw)this.changingFeature_=!0,me.setCenter(r),this.changingFeature_=!1;else{this.changingFeature_=!0;let ge=t.map.getView().getProjection(),be=Hg(Di(me.getCenter(),ge),Di(r,ge)),ve=Hn();if(ve){let De=me.clone().transform(ve,ge);De.setRadius(be),be=De.transform(ge,ve).getRadius()}me.setRadius(be),this.changingFeature_=!1}break;default:}z&&this.setGeometryCoordinates_(E,z)}this.createOrUpdateVertexFeature_(r,l,c,!0)}handleDownEvent(t){if(!this.condition_(t))return!1;let r=t.coordinate,l=this.findInsertVerticesAndUpdateDragSegments_(r);if(l?.length&&this.insertVertexCondition_(t)&&(this.willModifyFeatures_(t,l),this.vertexFeature_)){let c=this.vertexFeature_.getGeometry().getCoordinates();for(let n=l.length-1;n>=0;--n)this.insertVertex_(l[n],c);this.ignoreNextSingleClick_=!0}return!!this.vertexFeature_}handleUpEvent(t){for(let r=this.dragSegments_.length-1;r>=0;--r){let l=this.dragSegments_[r][0],c=l.geometry;if(c.getType()==="Circle"){let n=c,x=n.getCenter(),b=l.featureSegments[0],S=l.featureSegments[1];b.segment[0]=x,b.segment[1]=x,S.segment[0]=x,S.segment[1]=x,this.rBush_.update(la(x),b);let R=n,E=Hn();if(E){let A=t.map.getView().getProjection();R=R.clone().transform(E,A),R=b_(R).transform(A,E)}this.rBush_.update(R.getExtent(),S)}else this.rBush_.update(hs(l.segment),l)}return this.featuresBeingModified_&&(this.dispatchEvent(new bd(n0.MODIFYEND,this.featuresBeingModified_,t)),this.featuresBeingModified_=null),!1}handlePointerMove_(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.coordinate)}handlePointerAtPixel_(t){let r=this.getMap(),l=r.getPixelFromCoordinate(t),c=r.getView().getProjection(),n=function(S,R){return pw(t,S,c)-pw(t,R,c)},x,b;if(this.hitDetection_){let S=typeof this.hitDetection_=="object"?R=>R===this.hitDetection_:void 0;r.forEachFeatureAtPixel(l,(R,E,A)=>{A&&A.getType()==="Point"&&(A=new br(ha(A.getCoordinates(),c)));let z=A||R.getGeometry();if(z&&z.getType()==="Point"&&R instanceof gs&&this.features_.getArray().includes(R)){b=z;let W=R.getGeometry().getFlatCoordinates().slice(0,2);x=[{feature:R,geometry:b,segment:[W,W]}]}return!0},{layerFilter:S})}if(!x){let S=qs(la(t,dw),c),R=r.getView().getResolution()*this.pixelTolerance_,E=Zs(us(S,R,dw),c);x=this.rBush_.getInExtent(E)}if(x&&x.length>0){let S=x.sort(n)[0],R=S.segment,E=fw(t,S,c),A=r.getPixelFromCoordinate(E),z=Hg(l,A);if(b||z<=this.pixelTolerance_){let W={};if(W[Gt(R)]=!0,this.snapToPointer_||(this.delta_[0]=E[0]-t[0],this.delta_[1]=E[1]-t[1]),S.geometry.getType()==="Circle"&&S.index===vd)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(E,[S.feature],[S.geometry],this.snappedToVertex_);else{let re=r.getPixelFromCoordinate(R[0]),me=r.getPixelFromCoordinate(R[1]),ge=Lc(A,re),be=Lc(A,me);z=Math.sqrt(Math.min(ge,be)),this.snappedToVertex_=z<=this.pixelTolerance_,this.snappedToVertex_&&(E=ge>be?R[1]:R[0]),this.createOrUpdateVertexFeature_(E,[S.feature],[S.geometry],this.snappedToVertex_);let ve={};ve[Gt(S.geometry)]=!0;for(let De=1,ke=x.length;De<ke;++De){let je=x[De].segment;if(lr(R[0],je[0])&&lr(R[1],je[1])||lr(R[0],je[1])&&lr(R[1],je[0])){let Re=Gt(x[De].geometry);Re in ve||(ve[Re]=!0,W[Gt(je)]=!0)}else break}}this.vertexSegments_=W;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}insertVertex_(t,r){let l=t.segment,c=t.feature,n=t.geometry,x=t.depth,b=t.index,S;for(;r.length<n.getStride();)r.push(0);switch(n.getType()){case"MultiLineString":S=n.getCoordinates(),S[x[0]].splice(b+1,0,r);break;case"Polygon":S=n.getCoordinates(),S[x[0]].splice(b+1,0,r);break;case"MultiPolygon":S=n.getCoordinates(),S[x[1]][x[0]].splice(b+1,0,r);break;case"LineString":S=n.getCoordinates(),S.splice(b+1,0,r);break;default:return!1}this.setGeometryCoordinates_(n,S);let R=this.rBush_;R.remove(t),this.updateSegmentIndices_(n,b,x,1);let E={segment:[l[0],r],feature:c,geometry:n,depth:x,index:b};R.insert(hs(E.segment),E),this.dragSegments_.push([E,1]);let A={segment:[r,l[1]],feature:c,geometry:n,depth:x,index:b+1};return R.insert(hs(A.segment),A),this.dragSegments_.push([A,0]),!0}updatePointer_(t){return t&&this.findInsertVerticesAndUpdateDragSegments_(t),this.vertexFeature_?.getGeometry().getCoordinates()}getPoint(){let t=this.vertexFeature_?.getGeometry().getCoordinates();return t?ha(t,this.getMap().getView().getProjection()):null}canRemovePoint(){if(!this.vertexFeature_||this.vertexFeature_.get("geometries").every(l=>l.getType()==="Circle"||l.getType().endsWith("Point")))return!1;let t=this.vertexFeature_.getGeometry().getCoordinates();return this.rBush_.getInExtent(hs([t])).some(({segment:l})=>lr(l[0],t)||lr(l[1],t))}removePoint(t){if(t&&(t=Di(t,this.getMap().getView().getProjection()),this.updatePointer_(t)),!this.lastPointerEvent_||this.lastPointerEvent_&&this.lastPointerEvent_.type!=Jn.POINTERDRAG){let r=this.lastPointerEvent_;this.willModifyFeatures_(r,this.dragSegments_.map(([c])=>c));let l=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new bd(n0.MODIFYEND,this.featuresBeingModified_,r)),this.featuresBeingModified_=null,l}return!1}removeVertex_(){let t=this.dragSegments_,r={},l=!1,c,n,x,b,S,R,E,A,z,W,re;for(S=t.length-1;S>=0;--S)x=t[S],W=x[0],re=Gt(W.feature),W.depth&&(re+="-"+W.depth.join("-")),re in r||(r[re]={}),x[1]===0?(r[re].right=W,r[re].index=W.index):x[1]==1&&(r[re].left=W,r[re].index=W.index+1);for(re in r){switch(z=r[re].right,E=r[re].left,R=r[re].index,A=R-1,E!==void 0?W=E:W=z,A<0&&(A=0),b=W.geometry,n=b.getCoordinates(),c=n,l=!1,b.getType()){case"MultiLineString":n[W.depth[0]].length>2&&(n[W.depth[0]].splice(R,1),l=!0);break;case"LineString":n.length>2&&(n.splice(R,1),l=!0);break;case"MultiPolygon":c=c[W.depth[1]];case"Polygon":c=c[W.depth[0]],c.length>4&&(R==c.length-1&&(R=0),c.splice(R,1),l=!0,R===0&&(c.pop(),c.push(c[0]),A=c.length-1));break;default:}if(l){this.setGeometryCoordinates_(b,n);let me=[];if(E!==void 0&&(this.rBush_.remove(E),me.push(E.segment[0])),z!==void 0&&(this.rBush_.remove(z),me.push(z.segment[1])),E!==void 0&&z!==void 0){let ge={depth:W.depth,feature:W.feature,geometry:W.geometry,index:A,segment:me};this.rBush_.insert(hs(ge.segment),ge)}this.updateSegmentIndices_(b,R,W.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.length=0}}return l}canInsertPoint(){if(!this.vertexFeature_||this.vertexFeature_.get("geometries").every(l=>l.getType()==="Circle"||l.getType().endsWith("Point")))return!1;let t=this.vertexFeature_.getGeometry().getCoordinates();return this.rBush_.getInExtent(hs([t])).some(({segment:l})=>!(lr(l[0],t)||lr(l[1],t)))}insertPoint(t){let r=t?Di(t,this.getMap().getView().getProjection()):this.vertexFeature_?.getGeometry().getCoordinates();return r?this.findInsertVerticesAndUpdateDragSegments_(r).reduce((c,n)=>c||this.insertVertex_(n,r),!1):!1}setGeometryCoordinates_(t,r){this.changingFeature_=!0,t.setCoordinates(r),this.changingFeature_=!1}updateSegmentIndices_(t,r,l,c){this.rBush_.forEachInExtent(t.getExtent(),function(n){n.geometry===t&&(l===void 0||n.depth===void 0||vn(n.depth,l))&&n.index>r&&(n.index+=c)})}};function AM(h,t){return h.index-t.index}function pw(h,t,r){let l=t.geometry;if(l.getType()==="Circle"){let n=l;if(t.index===vd){let x=Hn();x&&(n=n.clone().transform(x,r));let b=Lc(n.getCenter(),Di(h,r)),S=Math.sqrt(b)-n.getRadius();return S*S}}let c=Di(h,r);return Kc[0]=Di(t.segment[0],r),Kc[1]=Di(t.segment[1],r),Kv(c,Kc)}function fw(h,t,r){let l=t.geometry;if(l.getType()==="Circle"&&t.index===vd){let n=l,x=Hn();return x&&(n=n.clone().transform(x,r)),ha(n.getClosestPoint(Di(h,r)),r)}let c=Di(h,r);return Kc[0]=Di(t.segment[0],r),Kc[1]=Di(t.segment[1],r),ha(Xg(c,Kc),r)}function LM(){let h=g1();return function(t,r){return h.Point}}var o0=s0;var kM=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,mw=/^([\d.]+),([\d.]+)$/,gw=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,qf="stop-fetch",_w=h=>{let t=[];return h.forEach(r=>{let l=r.getGeometry()?.getCoordinates();l?.length&&t.push(...l)}),t},a0=class h extends jc{constructor(r={}){super(r);this.abortControllers={};this.cacheStationData={};this.format=new Sr({featureProjection:"EPSG:3857"});this.graphs=[];this.initialRouteDrag={};this.segments=[];this.snapToClosestStation=!1;this.useRawViaPoints=!1;this.viaPoints=[];this.element||this.createDefaultElement(),this.loading=!1,this.active=r.active||!0,this.graphs=r.graphs||[["osm",0,99]],this.mot=r.mot||"bus",this.modify=r.modify!==!1,this.apiParams=r.apiParams,this.useRawViaPoints=r.useRawViaPoints||!1,this.snapToClosestStation=r.snapToClosestStation||!1,this.apiKey=r.apiKey,this.stopsApiKey=r.stopsApiKey||this.apiKey,this.stopsApiUrl=r.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new Iu({...r}),this.routingLayer=r.routingLayer||new Yc({source:new El,style:r.style}),this.onRouteError=r.onRouteError||(l=>{this.dispatchEvent(new Ei("change:route")),this.reset(),console.error(l)}),this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.createModifyInteraction(),this.on("propertychange",l=>{l.key==="active"&&this.onActiveChange(),l.key==="mot"&&this.viaPoints&&this.drawRoute()})}static getGraphsResolutions(r,l){let c=l.getView();return r.map(([,n,x])=>[c.getResolutionForZoom(n),c.getResolutionForZoom(x||n+1)])}abortRequests(){this.graphs.forEach(r=>{let l=r[0];this.abortControllers[l]&&this.abortControllers[l].abort(),this.abortControllers[l]=new AbortController}),this.abortControllers[qf]?.abort(),this.abortControllers[qf]=new AbortController,this.loading=!1}activate(){let r=this.getMap();r&&(this.format=new Sr({featureProjection:r.getView().getProjection()}),this.graphsResolutions=h.getGraphsResolutions(this.graphs,r),this.modifyInteraction&&r.removeInteraction(this.modifyInteraction),this.modifyInteraction&&r.addInteraction(this.modifyInteraction),this.modifyInteraction?.setActive(this.modify),this.addListeners())}addListeners(){this.modify&&(this.removeListeners(),this.onMapClickKey=this.getMap()?.on("singleclick",this.onMapClick))}addViaPoint(r,l=-1,c=0){this.viaPoints.splice(l===-1?this.viaPoints.length:l,c,r),this.drawRoute(),this.dispatchEvent(new Ei("change:route"))}createDefaultElement(){this.element=document.createElement("button"),this.element.id="ol-toggle-routing",this.element.innerHTML="Toggle Route Control",this.element.onclick=()=>this.active?this.deactivate():this.activate(),Object.assign(this.element.style,{position:"absolute",right:"10px",top:"10px"})}createModifyInteraction(){this.modifyInteraction=new o0({deleteCondition:r=>{let c=(r.target?.getFeaturesAtPixel(r.pixel,{hitTolerance:5})||[]).find(n=>n.getGeometry()?.getType()==="Point"&&n.get("index"));return ow(r)&&c?(this.removeViaPoint(c.get("index")),!0):!1},pixelTolerance:6,source:this.routingLayer?.getSource()||void 0}),this.modifyInteraction.on("modifystart",this.onModifyStart),this.modifyInteraction.on("modifyend",this.onModifyEnd),this.modifyInteraction.setActive(!1)}deactivate(){let r=this.getMap();r&&(this.modifyInteraction&&r.removeInteraction(this.modifyInteraction),this.removeListeners(),this.reset())}drawRoute(){if(this.abortRequests(),this.routingLayer?.getSource()?.clear(),!this.viaPoints.length)return null;if(this.viaPoints.length===1)return this.drawViaPoint(this.viaPoints[0],0,this.abortControllers[qf]);let r=this.viaPoints.map(l=>{if(Array.isArray(l)){let c=this.getMap()?.getView().getProjection(),[n,x]=yl(l,c);return this.snapToClosestStation?[`@${x}`,n]:[x,n]}return this.useRawViaPoints?l:`!${l}`});return this.loading=!0,this.viaPoints.forEach((l,c)=>{this.drawViaPoint(l,c,this.abortControllers[qf])}),Promise.all(this.graphs.map(([l],c)=>{let{signal:n}=this.abortControllers[l];return this.api?this.api.route({"coord-punish":1e3,"coord-radius":100,elevation:!1,graph:l,mot:this.mot,"resolve-hops":!1,via:`${r.join("|")}`,...this.apiParams||{}},{signal:n}).then(x=>{if(this.segments=this.format.readFeatures(x),this.mot==="foot"){let R=this.segments.reduce((E,A)=>{let z=A.get("trg");return E.find(W=>W[0]===z[0]&&W[1]===z[1])?E:[...E,z]},[]);this.segments=R.map(E=>{let A=this.segments.filter(W=>{let re=W.get("trg");return re[0]===E[0]&&re[1]===E[1]}),z=_w(A);return new gs({geometry:new Es(z)})})}let b=_w(this.segments),S=new gs({geometry:new Es(b)});S.set("graph",l),S.set("mot",this.mot),this.graphsResolutions&&this.graphsResolutions[c]?.length>=2&&(S.set("minResolution",this.graphsResolutions[c][0]),S.set("maxResolution",this.graphsResolutions[c][1])),this.routingLayer?.getSource()?.addFeature(S),this.loading=!1}).catch(x=>{/AbortError/.test(x.name)||(this.segments=[],this.dispatchEvent(new Ei("error")),this.onRouteError(x,this),this.loading=!1)}):Promise.resolve([])}))}drawViaPoint(r,l,c){let n=new gs;if(n.set("viaPointIdx",l),Array.isArray(r))return n.setGeometry(new br(r)),this.routingLayer?.getSource()?.addFeature(n),Promise.resolve(n);if(!this.useRawViaPoints||gw.test(r)){let E,A;return this.useRawViaPoints?[,E,,A]=gw.exec(r)||[]:[E,A]=r.split("$"),fetch(`${this.stopsApiUrl}lookup/${E}?key=${this.stopsApiKey}`,{signal:c.signal}).then(z=>z.json()).then(z=>{let{coordinates:W}=z?.features?.[0]?.geometry||{};return W||console.log("No coordinates found for station "+E,z),this.cacheStationData[r]=vr(W),n.set("viaPointTrack",A),n.setGeometry(new br(vr(W))),this.routingLayer?.getSource()?.addFeature(n),n}).catch(z=>{/AbortError/.test(z.message)||(this.dispatchEvent(new Ei("error")),this.onRouteError(z,this),this.routingLayer?.getSource()?.clear(),this.loading=!1)})}if(this.useRawViaPoints&&mw.test(r)){let[E,A]=mw.exec(r)||[];if(A&&E){let z=parseFloat(A),W=parseFloat(E),re=vr([z,W],this.getMap()?.getView().getProjection());return n.setGeometry(new br(re)),this.routingLayer?.getSource()?.addFeature(n),Promise.resolve(n)}}let[,x,,b,S,,R]=kM.exec(r)||[];if(S&&b){let E=vr([parseFloat(S),parseFloat(b)],this.getMap()?.getView().getProjection());return n.set("viaPointTrack",R),n.setGeometry(new br(E)),this.routingLayer?.getSource()?.addFeature(n),Promise.resolve(n)}return x?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${x}&limit=1`,{signal:c.signal}).then(E=>E.json()).then(E=>{let{coordinates:A}=E.features[0].geometry;return this.cacheStationData[r]=vr(A),n.set("viaPointTrack",R),n.setGeometry(new br(vr(A))),this.routingLayer?.getSource()?.addFeature(n),n}).catch(E=>(this.dispatchEvent(new Ei("error")),this.onRouteError(E,this),this.loading=!1,null)):Promise.resolve(null)}onActiveChange(){this.get("active")?this.activate():this.deactivate(),this.render()}onMapClick(r){let c=r.target.getFeaturesAtPixel(r.pixel,{hitTolerance:5,layerFilter:n=>n===this.routingLayer}).find(n=>n.getGeometry()?.getType()==="Point"&&n.get("viaPointIdx")!==void 0);if(c){this.removeViaPoint(c.get("viaPointIdx"));return}this.addViaPoint(r.coordinate)}onModifyEnd(r){let l=r.mapBrowserEvent.coordinate,{oldRoute:c,segmentIndex:n,viaPoint:x}=this.initialRouteDrag||{};return x?this.addViaPoint(l,x.get("viaPointIdx"),1):c?n===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(l,(n||0)+1):this.addViaPoint(l,0,1)}onModifyStart(r){let l=-1,c=r.features.getArray().find(x=>x.getGeometry()?.getType()==="LineString");if(c?.getGeometry()&&r.mapBrowserEvent.coordinate){let x=us(new br(c.getGeometry()?.getClosestPoint(r.mapBrowserEvent.coordinate)).getExtent(),.001);l=this.segments.findIndex(b=>b.getGeometry()?.intersectsExtent(x))}let n=(r.features.getArray().filter(x=>x.getGeometry()?.getType()==="Point")||[])[0];this.initialRouteDrag={oldRoute:c?.clone(),segmentIndex:l,viaPoint:n}}removeListeners(){this.onMapClickKey&&Cs(this.onMapClickKey)}removeViaPoint(r=(this.viaPoints||[]).length-1){this.viaPoints.length&&this.viaPoints[r]&&this.viaPoints.splice(r,1),this.drawRoute(),this.dispatchEvent(new Ei("change:route"))}render(){}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer?.getSource()?.clear(),this.dispatchEvent(new Ei("change:route"))}setMap(r){super.setMap(r),r&&this.active?this.activate():r||(this.active=!1)}setViaPoints(r){this.viaPoints=[...r],this.drawRoute(),this.dispatchEvent(new Ei("change:route"))}get active(){return this.get("active")}set active(r){this.set("active",r)}get loading(){return this.get("loading")}set loading(r){this.set("loading",r)}get modify(){return this.get("modify")}set modify(r){this.set("modify",r)}get mot(){return this.get("mot")}set mot(r){this.set("mot",r)}},yw=a0;var l0=class{constructor(t){let{apiKey:r,apiParams:l,placeholder:c,url:n}=t||{};this.apiParams={limit:20,...l||{}},this.placeholder=c||"Search for a stop...";let x={apiKey:r};n&&(x.url=n),this.api=new Eu(x),this.abortController=new AbortController,this.createElement(t),this.options=t}clear(){!this.suggestionsElt||!this.inputElt||!this.clearElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}createElement({element:t}){this.inputElt=document.createElement("input"),this.inputElt.type="text",this.inputElt.placeholder=this.placeholder,this.inputElt.autocomplete="off",this.inputElt.onkeyup=r=>{this.abortController?.abort(),this.abortController=new AbortController,this.search(r.target.value,this.abortController)},Object.assign(this.inputElt.style,{padding:"10px 30px 10px 10px"}),t.appendChild(this.inputElt),this.suggestionsElt=document.createElement("div"),Object.assign(this.suggestionsElt.style,{backgroundColor:"white",cursor:"pointer",overflowY:"auto"}),t.appendChild(this.suggestionsElt),this.clearElt=document.createElement("div"),Object.assign(this.clearElt.style,{cursor:"pointer",display:"none",fontSize:"200%",padding:"0 10px",position:"absolute",right:"0"}),this.clearElt.innerHTML="\xD7",this.clearElt.onclick=()=>this.clear(),t.appendChild(this.clearElt)}render(t){let r=t?.features||[];this.suggestionsElt&&(this.suggestionsElt.style.display=r.length?"block":"none",this.suggestionsElt.innerHTML="",r.forEach(l=>{let c=document.createElement("div");c.innerHTML=l?.properties?.name,c.onclick=n=>{this.options?.onSuggestionClick?.(l,n)},Object.assign(c.style,{padding:"5px 12px"}),this.suggestionsElt?.appendChild(c)}))}search(t,r){return(t!==void 0||t!==null)&&(this.apiParams.q=t),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,r&&{signal:r.signal}).then(l=>{this.render(l)}).catch(()=>{this.render()})}},xw=l0;var DM=()=>{let h=document.createElement("div");return Object.assign(h.style,{position:"absolute",top:0,left:"50px",margin:"10px",display:"flex",flexDirection:"column",width:"320px",maxHeight:"90%"}),h},vw=DM;var c0=class extends jc{constructor(t){let r=vw();r.className=t?.className||"mbt-stop-finder";let l={element:r,...t||{}};super(l),this.controller=new xw({onSuggestionClick:this.onSuggestionClick.bind(this),...l})}onSuggestionClick(t){let r=vr(t.geometry.coordinates);this.getMap()?.getView().setCenter(r)}search(t,r){return this.controller.search(t,r)}},bw=c0;var Sw=Us(d0(),1);var FM="vectorTileFeature",p0={"EPSG:3857":new Sr({featureProjection:"EPSG:3857"})},Ca=class extends wa{translateZoom;constructor(t,r){super(t),this.translateZoom=r}getFeaturesAtCoordinate(t,r=5){let l=this.getMapLibrePixels(t,r);if(!l)return[];let c=this.getLayer().get("queryRenderedFeaturesOptions")||{};return this.getLayer().mapLibreMap?.queryRenderedFeatures(l,c).map(x=>this.toOlFeature(x))||[]}prepareFrame(){return!0}renderFrame(t){let r=this.getLayer(),{mapLibreMap:l}=r,c=r.getMapInternal();if(!r||!c||!l)return null;let n=l.getCanvas(),{viewState:x}=t;l.jumpTo({center:yl(x.center,x.projection),zoom:(this.translateZoom?this.translateZoom(x.zoom):x.zoom)-1,bearing:Fu(-x.rotation)});let b=r.getOpacity().toString();return n&&b!==n.style.opacity&&(n.style.opacity=b),n.isConnected?zM(n,t)||l.resize():c.render(),l.redraw(),l.getContainer()}getFeatures(t){let r=this.getLayer().getMapInternal()?.getCoordinateFromPixel(t);return Promise.resolve(this.getFeaturesAtCoordinate(r))}forEachFeatureAtCoordinate(t,r,l,c){let n=this.getFeaturesAtCoordinate(t,l);return n.forEach(x=>{let b=x.getGeometry();b instanceof Fr&&c(x,this.getLayer(),b)}),n?.[0]}getMapLibrePixels(t,r){if(!t)return;let l=this.getLayer().mapLibreMap?.project(yl(t));if(l?.x===void 0||l?.y===void 0)return;let c=[l.x,l.y];if(r){let[n,x]=c;c=[[n-r,x-r],[n+r,x+r]]}return c}toOlFeature(t){let c=this.getLayer().getMapInternal()?.getView()?.getProjection()?.getCode()||"EPSG:3857";p0[c]||(p0[c]=new Sr({featureProjection:c}));let n=p0[c].readFeature(t);return n&&n.set(FM,t,!0),n}};function zM(h,t){return h.width===Math.floor(t.size[0]*t.pixelRatio)&&h.height===Math.floor(t.size[1]*t.pixelRatio)}var OM=h=>{if(!h)return[];let{style:t}=h;if(!t)return[];let{sourceCaches:r}=t,l=[];return Object.values(r).forEach(c=>{if(c.used){let{attribution:n}=c.getSource();n&&(l=l.concat(n.replace(/&copy;/g,"\xA9").split(/(<a.*?<\/a>)/)))}}),BM(l)},BM=h=>{let t=h.filter(c=>c!=null&&c.trim&&c.trim()),r=t.map(c=>c.toLowerCase());return[...new Set(r)].map(c=>t.find(n=>n.toLowerCase()===c))},f0=OM;var Jc=class extends Rs{mapLibreMap;loaded=!1;olListenersKeys=[];constructor(t){super({source:new Bo({attributions:()=>f0(this.mapLibreMap)}),...t})}disposeInternal(){Cs(this.olListenersKeys),this.loaded=!1,this.mapLibreMap&&(this.mapLibreMap.triggerRepaint=()=>{},this.mapLibreMap.remove()),super.disposeInternal()}setMapInternal(t){super.setMapInternal(t),t?this.loadMapLibreMap():this.dispose()}loadMapLibreMap(){this.loaded=!1;let t=this.getMapInternal();if(t&&this.olListenersKeys.push(t.on("change:target",this.loadMapLibreMap.bind(this))),!t?.getTargetElement())return;if(!this.getVisible()){this.olListenersKeys.push(this.once("change:visible",this.loadMapLibreMap.bind(this)));return}let r=document.createElement("div");r.style.position="absolute",r.style.width="100%",r.style.height="100%";let l=this.get("mapLibreOptions");this.mapLibreMap=new Sw.Map(Object.assign({},l,{container:r,attributionControl:!1,interactive:!1,trackResize:!1})),this.mapLibreMap.on("sourcedata",()=>{this.getSource()?.refresh()}),this.mapLibreMap.once("load",()=>{this.loaded=!0,this.dispatchEvent(new Ei("load"))})}createRenderer(){let t=this.get("translateZoom");return new Ca(this,t)}};var x0=Us(Pl());var wd=class extends Ca{constructor(r,l){super(r,l);this.ignoreNextRender=!1;this.setIsReady=this.setIsReady.bind(this),this.ignoreNextRender=!1}renderFrame(r){let l=this.getLayer(),{mapLibreMap:c}=l,n=l.getMapInternal();if(!l||!n||!c)return null;if(this.ready&&this.ignoreNextRender)return this.ignoreNextRender=!1,c?.getContainer();this.ready=!1,this.ignoreNextRender=!1,this.updateReadyState();let x=super.renderFrame(r);return c?.once("idle",this.setIsReady),x}setIsReady(){this.ready||(this.ready=!0,this.ignoreNextRender=!0,this.getLayer().changed())}updateReadyState(){this.getLayer()?.mapLibreMap?.off("idle",this.setIsReady),this.getLayer()?.mapLibreMap?.once("idle",this.setIsReady)}};var Iw=Us(Pl()),Oi=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(Oi=(0,Iw.default)(h=>{console.warn(h)},1e3));var iI=(h,t)=>{(t||[]).forEach(r=>{r.set("parent",void 0)}),(h.get("children")||[]).forEach(r=>{r.set("parent",void 0)})},rI=(h,t)=>{t.properties&&(Oi("Deprecated. Don't use properties options. Pass the values directly in options object."),h.setProperties(t.properties)),h.on("propertychange",r=>{if(r.key==="children"&&iI(r.target,r.oldValue),r.key==="map"){let l=r.target.get(r.key);l?(r.target.get("children")||[]).forEach(c=>{l.addLayer(c)}):r.oldValue&&(r.target.get("children")||[]).forEach(c=>{r.oldValue.removeLayer(c)})}}),h.set("options",t),h.set("children",t.children||[]),Object.defineProperties(h,{children:{get:()=>(Oi("Layer.children is deprecated. Use the Layer.get('children') method instead."),h.get("children")||[]),set:r=>{Oi("Layer.children is deprecated. Use the Layer.set('children', children) method instead."),h.set("children",r||[])}},copyrights:{get:()=>(Oi("Layer.copyrights is deprecated. Get the attributions from the source object"),h.get("copyrights")),set:r=>{Oi("Layer.copyrights is deprecated. Set the attributions to the source object.");let l=r&&!Array.isArray(r)?[r]:r;h.set("copyrights",l||[])}},disabled:{get(){return Oi("Layer.disabled is deprecated. Use the Layer.get('disabled') method instead."),h.get("disabled")},set(r){Oi("Layer.disabled is deprecated. Use the Layer.set('disabled', newValue) method instead."),h.set("disabled",r)}},group:{get(){return Oi("Layer.group is deprecated. Use the Layer.get('group') method instead."),h.get("group")}},hitTolerance:{get(){return Oi("Layer.hitTolerance is deprecated. Pass the hitTolerance when you request the features."),h.get("hitTolerance")||5},set(r){Oi("Layer.hitTolerance is deprecated. Pass the hitTolerance when you request the features."),h.set("hitTolerance",r)}},key:{get(){return Oi('Layer.key is deprecated. Use the Layer.get("key") method instead.'),h.get("key")||h.get("name")}},map:{get(){return Oi('Layer.map is deprecated. Use the Layer.get("map") method instead.'),h.getMapInternal()}},name:{get(){return Oi("Layer.name is deprecated. Use the Layer.get('name') method instead."),h.get("name")}},olLayer:{get(){return Oi("Layer.olLayer is deprecated. mobility-toolbox-js/ol layers inherits now from ol/layer/Layer class. obj getter is only a redirect to the current 'this' object."),h},set(){Oi("Layer.olLayer is deprecated. mobility-toolbox-js/ol layers inherits now from ol/layer/Layer class. obj setter has no effect.")}},options:{get(){return Oi('Layer.options is deprecated. Use the Layer.get("options") method instead.'),h.get("options")},set(r){return Oi('Layer.options is deprecated. Use the Layer.set("options", newValue) method instead.'),h.set("options",r)}},parent:{get(){return Oi("Layer.parent is deprecated. Use the Layer.get('parent') method instead."),h.get("parent")},set(r){Oi("Layer.parent is deprecated. Use the Layer.set('parent', parent) method instead."),h.set("parent",r)}},visible:{get(){return Oi("Layer.visible is deprecated. Use the Layer.getVisible() method instead."),h.getVisible()},set(r){Oi("Layer.visible is deprecated. Use the Layer.setVisible(newValue) method instead."),h.setVisible(r)}}})},Ma=rI;var Ew=(h,t,r,l)=>ul(`${h}/styles/${t}/style.json`,{[l]:r}).toString(),_0=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(_0=(0,x0.default)(h=>{console.warn(h)},1e3));var y0=class h extends Jc{constructor(r){let l={apiKeyName:"key",style:"travic_v2",url:"https://maps.geops.io",...r||{},mapLibreOptions:{...r.mapLibreOptions||{}}};!l.mapLibreOptions.style&&l.url?.includes("style.json")?l.mapLibreOptions.style=l.url:!l.mapLibreOptions.style&&l.apiKey&&l.style&&typeof l.style=="string"&&(l.mapLibreOptions.style=Ew(l.url,l.style,l.apiKey,l.apiKeyName));super(l);this.olEventsKeys=[];Ma(this,r),this.set("options",r)}set apiKey(r){this.set("apiKey",r)}get apiKey(){return this.get("apiKey")}set apiKeyName(r){this.set("apiKeyName",r)}get apiKeyName(){return this.get("apiKeyName")}get maplibreMap(){return _0("MaplibreLayer.maplibreMap is deprecated. Use layer.mapLibreMap."),this.mapLibreMap}get mbMap(){return _0("MaplibreLayer.mbMap is deprecated. Use layer.maplibreMap."),this.maplibreMap}get style(){return this.get("style")}set style(r){this.set("style",r)}get url(){return this.get("url")}set url(r){this.set("url",r)}attachToMap(){let r=(0,x0.default)(this.updateMaplibreMap.bind(this),150);r(),this.olEventsKeys.push(this.on("propertychange",l=>{/(url|style|apiKey|apiKeyName)/.test(l.key)&&r()}))}clone(r){return new h({...this.get("options")||{},...r||{}})}createRenderer(){return new wd(this)}detachFromMap(){Cs(this.olEventsKeys)}disposeInternal(){let r=this.getSource();super.disposeInternal(),this.setSource(r)}getStyle(){return this.style&&typeof this.style=="object"&&this.style.name&&this.style.version?this.style:this.url.includes("style.json")?this.url:this.get("options")?.mapLibreOptions?.style?this.get("options").mapLibreOptions.style:Ew(this.url,this.style,this.apiKey,this.apiKeyName)}setMapInternal(r){r?(super.setMapInternal(r),this.attachToMap()):(this.detachFromMap(),super.setMapInternal(r))}updateMaplibreMap(){try{this.mapLibreMap?.setStyle(this.getStyle(),{diff:!1})}catch(r){console.error("Error while updating MaplibreMap",r)}}},Pw=y0;var Rw=Us(Pl());var v0={"EPSG:3857":new Sr({featureProjection:"EPSG:3857"})},Sd=class extends wa{forEachFeatureAtCoordinate(t,r,l,c){let n=this.getFeaturesAtCoordinate(t,l);return n.forEach(x=>{c(x,this.layer_,x.getGeometry())}),n?.[0]}getFeatures(t){let r=this.getLayer()?.getMapInternal()?.getCoordinateFromPixel(t);return Promise.resolve(this.getFeaturesAtCoordinate(r))}getFeaturesAtCoordinate(t,r=5){if(!t)return[];let l=this.getLayer(),c=l.getMapInternal(),n=l.maplibreLayer.mapLibreMap,x=c?.getView()?.getProjection()?.getCode()||"EPSG:3857",b=[];if(v0[x]||(v0[x]=new Sr({featureProjection:x})),n?.isStyleLoaded()){let S=t&&n.project(yl(t));if(S?.x&&S?.y){let R=[S.x,S.y];if(r){let[A,z]=R;R=[[A-r,z-r],[A+r,z+r]]}let E=l.layers||[];l.layersFilter&&(E=n.getStyle().layers.filter(l.layersFilter)),l.queryRenderedLayersFilter&&(E=n.getStyle().layers.filter(l.queryRenderedLayersFilter)),b=n.queryRenderedFeatures(R,{layers:E.map(A=>A.id),validate:!1}).map(A=>{let z=v0[x].readFeature(A);return z&&z.set(Bc,A),z})}}return b}prepareFrame(){return!0}renderFrame(){return null}};var An=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(An=(0,Rw.default)((...h)=>{console.warn(...h)},1e3));var b0=class h extends Rs{constructor(r={mapLibreOptions:{style:{layers:[],sources:{},version:8}}}){r.mapboxLayer&&(An("options.mapboxLayer is deprecated. Use options.maplibreLayer instead."),r.maplibreLayer=r.mapboxLayer,delete r.mapboxLayer),r.styleLayers&&(An("options.styleLayers is deprecated. Use options.layers instead."),r.layers=r.styleLayers,delete r.styleLayers),r.styleLayersFilter&&(An("options.styleLayersFilter is deprecated. Use options.layersFilter instead."),r.layersFilter=r.styleLayersFilter,delete r.styleLayersFilter);super({source:new Bo({}),...r});this.highlightedFeatures=[];this.olEventsKeys=[];this.selectedFeatures=[];Ma(this,r),this.set("options",r),this.beforeId=r.beforeId,this.onLoad=this.onLoad.bind(this),!this.layersFilter&&this.layers&&(this.layersFilter=l=>!!this.layers.find(c=>l.id===c.id))}get beforeId(){return this.get("beforeId")}set beforeId(r){this.set("beforeId",r)}get layers(){return this.get("layers")}set layers(r){this.set("layers",r)}get layersFilter(){return this.get("layersFilter")}set layersFilter(r){this.set("layersFilter",r)}get mapboxLayer(){return An("Deprecated. Use maplibreLayer instead."),this.get("maplibreLayer")}get maplibreLayer(){return this.get("maplibreLayer")}set maplibreLayer(r){this.set("maplibreLayer",r)}get queryRenderedLayersFilter(){return this.get("queryRenderedLayersFilter")}set queryRenderedLayersFilter(r){this.set("queryRenderedLayersFilter",r)}get sources(){return this.get("sources")}set sources(r){this.set("sources",r)}get styleLayer(){return An("Deprecated. Use MaplibreStyleLayer.layer instead."),this.layers[0]}set styleLayer(r){An("MaplibreStyleLayer.styleLayer is deprecated. Use MaplibreStyleLayer.layer instead."),this.layers=[r]}get styleLayers(){return An("MaplibreStyleLayer.styleLayers is deprecated. Use MaplibreStyleLayer.layers instead."),this.layers}set styleLayers(r){An("MaplibreStyleLayer.styleLayers is deprecated. Use MaplibreStyleLayer.layers instead."),this.layers=r}addLayers(){if(!this.maplibreLayer?.mapLibreMap||!Array.isArray(this.layers))return;let{mapLibreMap:r}=this.maplibreLayer;r&&(this.layers.forEach(l=>{let{id:c,source:n}=l;(!n||n&&r.getSource(n))&&c&&!r.getLayer(c)&&r.addLayer(l,this.beforeId)}),this.applyLayoutVisibility())}addSources(){if(!this.maplibreLayer?.mapLibreMap||!this.sources)return;let{mapLibreMap:r}=this.maplibreLayer;r&&Object.entries(this.sources).forEach(([l,c])=>{r.getSource(l)||r.addSource(l,c)})}applyLayoutVisibility(r){if(!this.maplibreLayer?.mapLibreMap?.getStyle()||!this.layersFilter)return;let{mapLibreMap:l}=this.maplibreLayer,c=l.getStyle(),n=this.getVisible()?"visible":"none",x=c.layers||[];for(let b=0;b<x.length;b+=1){let S=x[b];if(this.layersFilter(S)){let{id:R}=S;l.getLayer(R)&&(l.setLayoutProperty(R,"visibility",n),(this.getMinZoom()||this.getMaxZoom())&&l.setLayerZoomRange(R,this.getMinZoom()?this.getMinZoom()-1:0,this.getMaxZoom()?this.getMaxZoom()-1:24))}}}attachToMap(r){if(!this.getMapInternal()||!this.maplibreLayer)return;let{mapLibreMap:c}=this.maplibreLayer;c&&(c.loaded()?this.onLoad():c.once("load",this.onLoad)),this.olEventsKeys.push(this.maplibreLayer.on("load",this.onLoad.bind(this)),this.on("change:visible",n=>{this.applyLayoutVisibility(n)}),this.on("propertychange",n=>{/(sources|layers|layersFilter|maplibreLayer|beforeId)/.test(n.key)&&(this.detachFromMap(),this.attachToMap(r))}),this.maplibreLayer.on("propertychange",n=>{n.key==="style"&&n.target.maplibreMap.once("styledata",()=>{n.target.maplibreMap.once("idle",()=>{this.onLoad()})})}))}clone(r){return new h({...this.get("options"),...r})}createRenderer(){return new Sd(this)}detachFromMap(){Cs(this.olEventsKeys),this.maplibreLayer?.mapLibreMap&&(this.maplibreLayer.mapLibreMap.off("load",this.onLoad),this.removeLayers(),this.removeSources())}getFeatureInfoAtCoordinate(r){if(An("Deprecated. getFeatureInfoAtCoordinate([layer], coordinate) from ol package instead."),!this.maplibreLayer?.mapLibreMap)return Promise.resolve({coordinate:r,features:[],layer:this});let{mapLibreMap:l}=this.maplibreLayer;if(!l.isStyleLoaded())return Promise.resolve({coordinate:r,features:[],layer:this});let c=this.layers||[];return this.layersFilter&&(c=l.getStyle().layers.filter(this.layersFilter),console.log(c)),this.queryRenderedLayersFilter&&(c=l.getStyle().layers.filter(this.queryRenderedLayersFilter)),Promise.resolve({coordinate:r,features:[],layer:this})}highlight(r=[]){An("Deprecated. Use layer.setFeatureState(features, {hover: true}) instead.");let l=this.highlightedFeatures?.filter(c=>!(this.selectedFeatures||[]).map(n=>n.getId()).includes(c.getId()))||[];this.setHoverState(l,!1),this.highlightedFeatures=r,this.setHoverState(this.highlightedFeatures,!0)}onLoad(){if(!this.maplibreLayer?.mapLibreMap)return;this.addSources(),this.addLayers();let{mapLibreMap:r}=this.maplibreLayer,l=r.getStyle();if(l?.layers&&this.layersFilter){let c=l.layers.filter(this.layersFilter);this.set("disabled",!c.length)}this.applyLayoutVisibility()}removeLayers(){if(!this.maplibreLayer?.mapLibreMap||!Array.isArray(this.layers))return;let{mapLibreMap:r}=this.maplibreLayer;r&&this.layers.forEach(l=>{let{id:c}=l;c&&r.getLayer(c)&&r.removeLayer(c)})}removeSources(){if(!this.maplibreLayer?.mapLibreMap||!this.sources)return;let{mapLibreMap:r}=this.maplibreLayer;r&&Object.keys(this.sources).forEach(l=>{r.getSource(l)&&r.removeSource(l)})}select(r=[]){An("Deprecated. Use layer.setFeatureState(features, {selected: true}) instead."),this.setHoverState(this.selectedFeatures||[],!1),this.selectedFeatures=r,this.setHoverState(this.selectedFeatures||[],!0)}setFeatureState(r,l){if(!this.maplibreLayer?.mapLibreMap||!r.length)return;let c=this.maplibreLayer.mapLibreMap;r.forEach(n=>{let{source:x,sourceLayer:b}=n.get(Bc)||{};if(!x&&!b||!n.getId()){n.getId()||An("No feature's id found. To use the feature state functionnality, tiles must be generated with --generate-ids. See https://github.com/Maplibre/tippecanoe#adding-calculated-attributes.",n.getProperties());return}c.setFeatureState({id:n.getId(),source:x,sourceLayer:b},l)})}setHoverState(r,l){An(`Deprecated. Use layer.setFeatureState(features, {hover: ${l}}) instead.`),this.setFeatureState(r,{hover:l})}setMapInternal(r){r?(super.setMapInternal(r),this.attachToMap(r)):(this.detachFromMap(),super.setMapInternal(r))}},Aw=b0;var M0=Us(Pl());var S0=Us(Pl()),T0=Us(zw());var C0=class{constructor(t){this.isIdle=!1;this.getViewState=()=>({});this.shouldRender=()=>!0;this._mode=t.mode||or.TOPOGRAPHIC,this._speed=t.speed||1,this._style=t.style||dl,this._time=t.time||new Date,this.api=t.api||new Mu(t),this.bboxParameters=t.bboxParameters,this.canvas=t.canvas||document.createElement("canvas"),this.debug=t.debug||!1,this.filter=t.filter,this.hoverVehicleId=t.hoverVehicleId,this.live=t.live!==!1,this.minZoomInterpolation=t.minZoomInterpolation||8,this.pixelRatio=t.pixelRatio||(typeof window<"u"?window.devicePixelRatio:1),this.selectedVehicleId=t.selectedVehicleId,this.sort=t.sort,this.styleOptions={...Oc,...t.styleOptions||{}},this.tenant=t.tenant||"",this.trajectories={},this.useDebounce=t.useDebounce||!1,this.useRequestAnimationFrame=t.useRequestAnimationFrame||!1,this.useThrottle=t.useThrottle!==!1,this.getViewState=t.getViewState||(()=>({})),this.shouldRender=t.shouldRender||(()=>!0),this.onRender=t.onRender,this.onIdle=t.onIdle,this.onStart=t.onStart,this.onStop=t.onStop,this.format=new Sr,this.motsByZoom=t.motsByZoom||[Ps,Ps,Ps,Ps,Ps,Ps,Ps,Ps,Ps,xf,xf],this.getMotsByZoom=r=>t.getMotsByZoom?t.getMotsByZoom(r,this.motsByZoom):this.motsByZoom[r],this.generalizationLevelByZoom=t.generalizationLevelByZoom||[],this.getGeneralizationLevelByZoom=r=>t.getGeneralizationLevelByZoom?t.getGeneralizationLevelByZoom(r,this.generalizationLevelByZoom):this.generalizationLevelByZoom[r],this.renderTimeIntervalByZoom=t.renderTimeIntervalByZoom||[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],this.getRenderTimeIntervalByZoom=r=>t.getRenderTimeIntervalByZoom?t.getRenderTimeIntervalByZoom(r,this.renderTimeIntervalByZoom):this.renderTimeIntervalByZoom[r],this.isUpdateBboxOnMoveEnd=t.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,T0.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,S0.default)(this.renderTrajectoriesInternal,50,{leading:!0,maxWait:5e3,trailing:!0}),this.renderState={center:[0,0],rotation:0,zoom:void 0},this.onTrajectoryMessage=this.onTrajectoryMessage.bind(this),this.onDeleteTrajectoryMessage=this.onDeleteTrajectoryMessage.bind(this),this.onDocumentVisibilityChange=this.onDocumentVisibilityChange.bind(this)}get mode(){return this._mode}set mode(t){t!==this._mode&&(this._mode=t,this.api?.wsApi?.open&&(this.stop(),this.start()))}get speed(){return this._speed}set speed(t){this._speed=t,this.start()}get style(){return this._style}set style(t){this._style=t,this.renderTrajectories()}get time(){return this._time}set time(t){this._time=t?.getTime?t:new Date(t),this.renderTrajectories()}addTrajectory(t){this.trajectories||(this.trajectories={});let r=t.properties.train_id;r!==void 0&&(this.trajectories[r]=t),this.renderTrajectories()}attachToMap(){document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){if(document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),this.canvas){let t=this.canvas.getContext("2d");t&&t.clearRect(0,0,this.canvas.width,this.canvas.height)}}getRefreshTimeInMs(){let r=this.getViewState().zoom||0,l=r!==void 0?Math.round(r):-1,c=this.getRenderTimeIntervalByZoom(l)||25,n=Math.max(25,c/(this.speed||1)),x=Math.min(n,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,T0.default)(this.renderTrajectoriesInternal,x,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,S0.default)(this.renderTrajectoriesInternal,x,{leading:!0,maxWait:5e3,trailing:!0})),this.api?.buffer){let[,b]=this.api.buffer;this.api.buffer=[x,b]}return n}getVehicles(t){return this.trajectories&&Object.values(this.trajectories).filter(t)||[]}getVehiclesAtCoordinate(t,r){let{resolution:l}=this.getViewState(),{hitTolerance:c,nb:n}=r||{},x=us([...t,...t],(c||5)*(l||1)),b=Object.values(this.trajectories||{});this.sort&&(b=b.sort(this.sort));let S=[];for(let R=0;R<b.length;R+=1){let{coordinate:E}=b[R].properties;if(E&&fl(x,E)&&S.push(b[R]),S.length===n)break}return{features:S,type:"FeatureCollection"}}onDeleteTrajectoryMessage(t){t.content&&this.removeTrajectory(t.content)}onDocumentVisibilityChange(){if(document.hidden)this.stop(),this.trajectories={};else{if(!this.getViewState().visible)return;this.start()}}onTrajectoryMessage(t){if(this.updateIdleState(),!t.content)return;let r=t.content,{geometry:l,properties:{raw_coordinates:c,time_since_update:n}}=r;n<0||this.purgeTrajectory(r)||(this.debug&&this.mode===or.TOPOGRAPHIC&&c?r.properties.olGeometry=this.format.readGeometry({coordinates:vr(c),type:"Point"}):r.properties.olGeometry=this.format.readGeometry(l),r.properties.timeOffset=Date.now()-t.timestamp,this.addTrajectory(r))}onZoomEnd(){this.startUpdateTime()}purgeOutOfDateTrajectories(){Object.entries(this.trajectories||{}).forEach(([t,r])=>{let l=r?.properties?.time_intervals;this.time&&l?.length&&l[l.length-1][0]<this.time.getTime()&&this.removeTrajectory(t)})}purgeTrajectory(t){let l=this.getViewState().extent,{bounds:c,type:n}=t.properties;return this.isUpdateBboxOnMoveEnd&&l&&!er(l,c)||this.mots&&!this.mots.includes(n)?(this.removeTrajectory(t),!0):!1}removeTrajectory(t){let r;typeof t!="string"?r=t?.properties?.train_id:r=t,r!==void 0&&this.trajectories&&delete this.trajectories[r]}renderTrajectories(t){let r=this.getViewState();this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=void 0),!(!r?.center||!r?.extent||!r?.size)&&(!t&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(r,t)}):!t&&this.useDebounce?this.debounceRenderTrajectories(r,t):!t&&this.useThrottle?this.throttleRenderTrajectories(r,t):this.renderTrajectoriesInternal(r,t))}renderTrajectoriesInternal(t,r=!1){if(!this.trajectories||!this.shouldRender())return!1;let l=this.live?Date.now():this.time?.getTime(),c=Object.values(this.trajectories);return this.sort&&c.sort(this.sort),!this.canvas||!this.style||(this.renderState=Yu(this.canvas,c,this.style,{...t,pixelRatio:this.pixelRatio||1,time:l},{filter:this.filter,hoverVehicleId:this.hoverVehicleId,noInterpolate:(t.zoom||0)<this.minZoomInterpolation?!0:r,selectedVehicleId:this.selectedVehicleId,...this.styleOptions}),this.onRender?.(this.renderState,t)),!0}setBbox(){this.updateIdleState();let t=this.getViewState(),r=t.extent,l=t.zoom||0;if(!r||Number.isNaN(l))return;if(this.trajectories&&r&&l){let E=Object.keys(this.trajectories);for(let A=E.length-1;A>=0;A-=1)this.purgeTrajectory(this.trajectories[E[A]])}let c=Math.floor(l);if(!r||Number.isNaN(c))return;let[n,x,b,S]=r,R=[Math.floor(n),Math.floor(x),Math.ceil(b),Math.ceil(S),c];this.generalizationLevel=this.getGeneralizationLevelByZoom(c),this.generalizationLevel&&R.push(`gen=${this.generalizationLevel}`),this.mots=this.getMotsByZoom(c),this.mots&&R.push(`mots=${this.mots}`),this.tenant&&R.push(`tenant=${this.tenant}`),this.mode!=="topographic"&&R.push(`channel_prefix=${this.mode}`),this.bboxParameters&&Object.entries(this.bboxParameters).forEach(([E,A])=>{R.push(`${E}=${A}`)}),this.api.bbox=R}start(){this.stop(),this.purgeOutOfDateTrajectories(),this.renderTrajectories(),this.startUpdateTime(),this.api.open(),this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.onStart&&this.onStart(this)}startUpdateTime(){this.stopUpdateTime(),this.updateTimeDelay=this.getRefreshTimeInMs()||0,this.updateTimeInterval=window.setInterval(()=>{this.live?this.time=new Date:this.time&&this.updateTimeDelay&&this.speed&&(this.time=new Date(this.time.getTime()+this.updateTimeDelay*this.speed))},this.updateTimeDelay)}stop(){this.api.unsubscribeTrajectory(this.onTrajectoryMessage),this.api.unsubscribeDeletedVehicles(this.onDeleteTrajectoryMessage),this.api.close(),this.onStop&&this.onStop(this)}stopUpdateTime(){this.updateTimeInterval&&(clearInterval(this.updateTimeInterval),this.updateTimeInterval=void 0)}updateIdleState(){this.isIdle=!1,clearTimeout(this._idleTimeout),this._idleTimeout=window.setTimeout(()=>{this.isIdle=!0,this.onIdle?.(this)},1e3)}},$f=C0;var bI=new Sr,Td=class extends Gf{forEachFeatureAtCoordinate(t,r,l,c){let n=this.getFeaturesAtCoordinate(t,l);return n.forEach(x=>{c(x,this.layer_,x.getGeometry())}),n?.[0]}getData(t){let r;try{let{pixelRatio:l}=this.getLayer();return r=this.canvas?.getContext("2d",{willReadFrequently:!0})?.getImageData(t[0]*(l||1),t[1]*(l||1),1,1).data||null,r}catch(l){console.error("error getting data",l)}return null}getFeatures(t){let r=this.getLayer()?.getMapInternal()?.getCoordinateFromPixel(t);return Promise.resolve(this.getFeaturesAtCoordinate(r))}getFeaturesAtCoordinate(t,r=5){if(!t)return[];let l=this.getLayer(),c=l.engine.getVehiclesAtCoordinate(t,{hitTolerance:r,nb:l.maxNbFeaturesRequested});return bI.readFeatures(c)}prepareFrame(){return!0}renderFrame(t){let{canvas:r,engine:l,renderedViewState:c}=this.getLayer();if(this.getLayer().engine.pixelRatio=t.pixelRatio,this.ready=!!l.renderState?.renderedTrajectories&&l.isIdle,this.container||(this.container=document.createElement("div"),this.container.className=this.getLayer().getClassName(),this.container.style.position="absolute",this.container.style.width="100%",this.container.style.height="100%",r instanceof HTMLCanvasElement&&(r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.transformOrigin="top left",this.container.appendChild(r))),c){let{center:n,resolution:x,rotation:b}=t.viewState,{center:S,resolution:R,rotation:E}=c;if(R/x>=3){let A=r?.getContext("2d");r?.width&&r?.height&&A?.clearRect(0,0,r.width,r.height)}else{let A=this.getLayer().getMapInternal(),z=A?.getPixelFromCoordinate(S),W=A?.getPixelFromCoordinate(n);z&&W&&(this.container.style.transform=Ev(z[0]-W[0],z[1]-W[1],R/x,R/x,b-E,0,0))}}return this.container}};var wI=new Or({image:new Pn({fill:new zr({color:"#000000"}),radius:5}),stroke:new cr({color:"#000000",width:6}),zIndex:2}),SI=(h,t,r)=>{let l="#ffffff",c=h.get("type"),n=h.get("stroke");return n&&n[0]!=="#"&&(n=`#${n}`),l=n||r?.getBgColor(c),l=/#ffffff/i.test(l)?"#ff0000":l,[wI,new Or({image:new Pn({fill:new zr({color:l}),radius:4}),stroke:new cr({color:l,width:4}),zIndex:3})]},Xf=SI;var TI=new Or({image:new Pn({fill:new zr({color:"#000000"}),radius:5}),stroke:new cr({color:"#000000",width:6}),zIndex:2}),CI=new Or({image:new Pn({fill:new zr({color:"#a0a0a0"}),radius:4}),stroke:new cr({color:"#a0a0a0",width:4}),zIndex:3}),MI=()=>[TI,CI],Ow=MI;var Bw=new Pn({fill:new zr({color:[255,0,0,1]}),radius:6,stroke:new cr({color:[0,0,0,1],width:1})}),II=new Or({stroke:new cr({color:[0,0,0,1],width:5})}),EI=new Or({image:Bw,stroke:new cr({color:[255,0,0,1],width:3})}),PI=new Or({image:Bw,stroke:new cr({color:[255,0,0,1],lineDash:[1,10],width:3})}),RI=(h,t)=>{let r=h.get("minResolution"),l=h.get("maxResolution"),c=t<=r&&t>l;if(r&&l&&!c)return[];let n=h?.getGeometry()?.getType()==="Point"?100:0,x=[II,EI];return h.get("mot")==="foot"&&(x=[PI]),x=x.map(S=>{let R=S.clone();return R.setZIndex(n),R}),x},jw=RI;var AI=new Sr,I0=class h extends Rs{constructor(r){super({source:new Bo({}),...r});this.allowRenderWhenAnimating=!1;this.maxNbFeaturesRequested=100;this.olEventsKeys=[];Ma(this,r),this.engine=new $f({getViewState:this.getViewState.bind(this),onIdle:this.onRealtimeEngineIdle.bind(this),onRender:this.onRealtimeEngineRender.bind(this),...r}),this.allowRenderWhenAnimating=!!r.allowRenderWhenAnimating,this.vectorLayer=new Yc({source:new El({features:[]}),style:(l,c)=>(r.fullTrajectoryStyle||Xf)(l,c,this.engine.styleOptions),updateWhileAnimating:this.allowRenderWhenAnimating,updateWhileInteracting:!0}),this.onZoomEndDebounced=(0,M0.default)(this.onZoomEnd,100),this.onMoveEndDebounced=(0,M0.default)(this.onMoveEnd,100)}get api(){return this.engine.api}set api(r){this.engine.api=r}get canvas(){return this.engine.canvas}get filter(){return this.engine.filter}set filter(r){this.engine.filter=r}get hoverVehicleId(){return this.engine.hoverVehicleId}set hoverVehicleId(r){this.engine.hoverVehicleId=r}get mode(){return this.engine.mode}set mode(r){this.engine.mode=r}get pixelRatio(){return this.engine.pixelRatio}get selectedVehicleId(){return this.engine.selectedVehicleId}set selectedVehicleId(r){this.engine.selectedVehicleId=r}get sort(){return this.engine.sort}set sort(r){this.engine.sort=r}get trajectories(){return this.engine.trajectories}attachToMap(){this.engine.attachToMap();let r=this.getMapInternal();r&&(this.getVisible()&&this.engine.start(),this.olEventsKeys.push(r.on("movestart",()=>{this.engine.isUpdateBboxOnMoveEnd&&this.engine.updateIdleState()}),...r.on(["moveend","change:target"],l=>{let c=(l.map||l.target).getView();if(!c||c?.getAnimating()||c?.getInteracting())return;let n=c.getZoom();this.currentZoom!==n&&this.onZoomEndDebounced(l),this.currentZoom=n,this.onMoveEndDebounced(l)}),this.on("change:visible",l=>{l.target.getVisible()?this.engine.start():this.engine.stop()}),this.on("propertychange",l=>{/(opacity|visible|zIndex|minResolution|maxResolution|minZoom|maxZoom)/.test(l.key)&&this.vectorLayer.set(l.key,l.target.get(l.key))})))}cleanVectorLayer(){this.vectorLayer?.getSource()?.clear(!0),this.vectorLayer.getMapInternal()?.removeLayer(this.vectorLayer)}clone(r){return new h({...this.get("options"),...r})}createRenderer(){return new Td(this)}detachFromMap(){Cs(this.olEventsKeys),this.getMapInternal()?.removeLayer(this.vectorLayer),this.engine.detachFromMap()}async getFullTrajectory(r){let l=await this.engine.api.getFullTrajectory(r,this.engine.mode,this.engine.getGeneralizationLevelByZoom(Math.floor(this.getMapInternal()?.getView()?.getZoom()||0)));return l?.content?.features?.length?AI.readFeatures(l?.content):[]}async getStopSequences(r){return(await this.engine.api.getStopSequence(r))?.content}async getTrajectoryInfos(r){let l=[this.getStopSequences(r),this.getFullTrajectory(r)],[c,n]=await Promise.all(l);return{fullTrajectory:n,stopSequences:c}}getVehicles(r){return this.engine.getVehicles(r)}getViewState(){let r=this.getMapInternal();if(!r?.getView())return{};let l=r.getView();return{center:l.getCenter(),extent:l.calculateExtent(),pixelRatio:this.engine.pixelRatio,resolution:l.getResolution(),rotation:l.getRotation(),size:r.getSize(),visible:this.getVisible(),zoom:l.getZoom()}}highlight(r){let l=r?.get("train_id");this.hoverVehicleId!==l&&(this.hoverVehicleId=l,this.engine.renderTrajectories(!0))}async highlightTrajectory(r){if(!r){this.cleanVectorLayer();return}let l=await this.getFullTrajectory(r);if(!l?.length){this.cleanVectorLayer();return}l.length&&this.vectorLayer?.getSource()?.addFeatures(l),this.vectorLayer.getMapInternal()&&this.vectorLayer.getMapInternal()!==this.getMapInternal()&&this.vectorLayer.getMapInternal()?.removeLayer(this.vectorLayer);let c=this.getZIndex();if(c!==void 0)this.vectorLayer.setZIndex(c-1),this.vectorLayer.getMapInternal()||this.getMapInternal()?.addLayer(this.vectorLayer);else if(!this.vectorLayer.getMapInternal()){let n=this.getMapInternal()?.getLayers().getArray().indexOf(this)||0;n&&this.getMapInternal()?.getLayers().insertAt(n,this.vectorLayer)}return l}onMoveEnd(){!this.engine.isUpdateBboxOnMoveEnd||!this.getVisible()||this.engine.setBbox()}onRealtimeEngineIdle(){this.changed()}onRealtimeEngineRender(r,l){this.renderedViewState={...l};let{container:c}=this.getRenderer();c&&(c.style.transform="")}onZoomEnd(){this.engine.onZoomEnd(),!(!this.engine.isUpdateBboxOnMoveEnd||!this.getVisible())&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}select(r){let l=r?.get("train_id");this.selectedVehicleId!==l&&(this.selectedVehicleId=l,this.engine.renderTrajectories(!0)),this.highlightTrajectory(l)}setMapInternal(r){r?(super.setMapInternal(r),this.attachToMap()):(this.detachFromMap(),super.setMapInternal(r))}shouldRender(){return this.allowRenderWhenAnimating?!1:this.getMapInternal()?.getView().getAnimating()||this.getMapInternal()?.getView().getInteracting()}start(){this.engine.start()}stop(){this.engine.stop()}},Nw=I0;var Gw=Us(Pl());var Vw=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(Vw=(0,Gw.default)(h=>{console.warn(h)},1e3));var E0=class extends wa{prepareFrame(){return!0}renderFrame(){return null}},P0=class h extends Rs{constructor(t){super(t),Ma(this,t),Vw("Layer is deprecated. Use an OpenLayers Layer instead.")}clone(t){return new h({...this.get("options")||{},...t||{}})}createRenderer(){return new E0(this)}},Hf=P0;var R0=class h extends Hf{clone(t){return new h({...this.get("options"),...t})}getFeatureInfoAtCoordinate(t){let r=[],l=this.getMapInternal();if(l){let c=l.getPixelFromCoordinate(t);r=l.getFeaturesAtPixel(c,{hitTolerance:this.get("hitTolerance")||5,layerFilter:n=>n===this})||[]}return Promise.resolve({coordinate:t,features:r,layer:this})}},Uw=R0;var LI=new Sr,kI=(h,t,r)=>{let l,{coordinate:c,params:n,projection:x,resolution:b}=t;return h&&b&&x&&(l=h.getFeatureInfoUrl(c,b,x,{info_format:"application/json",query_layers:h.getParams().layers,...n})),fetch(l,{signal:r.signal}).then(S=>S.json()).then(S=>LI.readFeatures(S)).catch(()=>[])},Cd={},DI=async(h,t,r=5)=>{Object.values(Cd).forEach(n=>{n?.abort()}),Cd={};let c=Ru(t).map(n=>{let x=n.getMapInternal(),b=x?.getView()?.getProjection()?.getCode(),S={coordinate:h,features:[],layer:n};if(!b)return Promise.resolve(S);if(n.getFeatureInfoAtCoordinate)return n.getFeatureInfoAtCoordinate(h);let R=n?.getSource();if(R?.getFeatureInfoUrl){let z=Gt(n);Cd[z]?.abort(),Cd[z]=new AbortController;let W=x?.getView()?.getResolution();return kI(R,{coordinate:h,params:{info_format:"application/json",query_layers:R.getParams().layers},projection:b,resolution:W},Cd[z]).then(re=>({coordinate:h,features:re,layer:n})).catch(()=>({coordinate:h,features:[],layer:n}))}let E=x?.getPixelFromCoordinate(h);if(!E)return Promise.resolve(S);let A=x?.getFeaturesAtPixel(E,{hitTolerance:n.get("hitTolerance")||r||5,layerFilter:z=>z===n});return Promise.resolve({coordinate:h,features:A,layer:n})});return Promise.all(c)},Zw=DI;var em={};dg(em,{CopyrightControl:()=>qw,Layer:()=>Kf,RealtimeAPI:()=>Mu,RealtimeLayer:()=>cS,RealtimeModes:()=>or,RoutingAPI:()=>Iu,StopsAPI:()=>Eu,VECTOR_TILE_FEATURE_PROPERTY:()=>Bc,compareDepartures:()=>Ku,createCanvas:()=>ws,createRealtimeFilters:()=>Pg,debounceDeparturesMessages:()=>T_,debounceWebsocketMessages:()=>Cu,getCircleCanvas:()=>Cg,getDelayBgCanvas:()=>Sg,getDelayTextCanvas:()=>Tg,getHoursAndMinutes:()=>Cv,getLayersAsFlatArray:()=>Ru,getMapGlCopyrights:()=>Pu,getMercatorResolution:()=>lS,getSourceCoordinates:()=>Qf,getTextCanvas:()=>Mg,getUTCDateString:()=>Sv,getUTCTimeString:()=>Tv,getUrlWithParams:()=>ul,getVehiclePosition:()=>Hu,pad:()=>Up,realtimeConfig:()=>Oc,realtimeDefaultStyle:()=>dl,realtimeDelayStyle:()=>Ig,realtimeSimpleStyle:()=>Eg,removeDuplicate:()=>pl,renderTrajectories:()=>Yu,sortAndFilterDepartures:()=>Ju,sortByDelay:()=>Rg});var FI=" | ",A0=class{constructor(t={}){this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this.map=t,this.container||(this.container=document.createElement("div")),this.render=this.render.bind(this),this.map.on("idle",this.render),this.map.on("sourcedata",this.render),this.map.on("styledata",this.render),this.render(),this.container}onRemove(){return this.container?.parentElement&&this.container.parentElement?.removeChild(this.container),this.map&&(this.map.off("sourcedata",this.render),this.map.off("styledata",this.render),this.map.off("idle",this.render)),this.map=void 0,this.container}render(){if(this.map&&this.container){let t=this.options?.separator||FI,r=this.options?.customAttribution||Pu(this.map),l=(Array.isArray(r)?r:[r]).join(t);this.container.innerHTML!==l&&(this.content=l,this.container.innerHTML=this.content)}}},qw=A0;var $w=Us(d0());var Br=[];for(let h=0;h<256;++h)Br.push((h+256).toString(16).slice(1));function Ww(h,t=0){return(Br[h[t+0]]+Br[h[t+1]]+Br[h[t+2]]+Br[h[t+3]]+"-"+Br[h[t+4]]+Br[h[t+5]]+"-"+Br[h[t+6]]+Br[h[t+7]]+"-"+Br[h[t+8]]+Br[h[t+9]]+"-"+Br[h[t+10]]+Br[h[t+11]]+Br[h[t+12]]+Br[h[t+13]]+Br[h[t+14]]+Br[h[t+15]]).toLowerCase()}var L0,zI=new Uint8Array(16);function k0(){if(!L0){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");L0=crypto.getRandomValues.bind(crypto)}return L0(zI)}var OI=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),D0={randomUUID:OI};function BI(h,t,r){if(D0.randomUUID&&!t&&!h)return D0.randomUUID();h=h||{};let l=h.random??h.rng?.()??k0();if(l.length<16)throw new Error("Random bytes length must be >= 16");if(l[6]=l[6]&15|64,l[8]=l[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let c=0;c<16;++c)t[r+c]=l[c];return t}return Ww(l)}var F0=BI;var z0=class extends $w.Evented{constructor(r={}){super();this.options={};this.type="custom";this.options=r,this.id=r.id||F0()}onAdd(r,l){this.map=r}onRemove(r,l){this.map=void 0}render(r){}},Kf=z0;var jr=63710088e-1,Hw={centimeters:jr*100,centimetres:jr*100,degrees:360/(2*Math.PI),feet:jr*3.28084,inches:jr*39.37,kilometers:jr/1e3,kilometres:jr/1e3,meters:jr,metres:jr,miles:jr/1609.344,millimeters:jr*1e3,millimetres:jr*1e3,nauticalmiles:jr/1852,radians:1,yards:jr*1.0936};function jI(h,t,r={}){let l={type:"Feature"};return(r.id===0||r.id)&&(l.id=r.id),r.bbox&&(l.bbox=r.bbox),l.properties=t||{},l.geometry=h,l}function Rl(h,t,r={}){if(!h)throw new Error("coordinates is required");if(!Array.isArray(h))throw new Error("coordinates must be an Array");if(h.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Xw(h[0])||!Xw(h[1]))throw new Error("coordinates must contain numbers");return jI({type:"Point",coordinates:h},t,r)}function NI(h,t="kilometers"){let r=Hw[t];if(!r)throw new Error(t+" units is invalid");return h*r}function GI(h,t="kilometers"){let r=Hw[t];if(!r)throw new Error(t+" units is invalid");return h/r}function Yw(h){return h%(2*Math.PI)*180/Math.PI}function Al(h){return h%360*Math.PI/180}function Jf(h,t="kilometers",r="kilometers"){if(!(h>=0))throw new Error("length must be a positive number");return NI(GI(h,t),r)}function Xw(h){return!isNaN(h)&&h!==null&&!Array.isArray(h)}function Kw(h){return h!==null&&typeof h=="object"&&!Array.isArray(h)}function Md(h,t,r){if(h!==null)for(var l,c,n,x,b,S,R,E=0,A=0,z,W=h.type,re=W==="FeatureCollection",me=W==="Feature",ge=re?h.features.length:1,be=0;be<ge;be++){R=re?h.features[be].geometry:me?h.geometry:h,z=R?R.type==="GeometryCollection":!1,b=z?R.geometries.length:1;for(var ve=0;ve<b;ve++){var De=0,ke=0;if(x=z?R.geometries[ve]:R,x!==null){S=x.coordinates;var je=x.type;switch(E=r&&(je==="Polygon"||je==="MultiPolygon")?1:0,je){case null:break;case"Point":if(t(S,A,be,De,ke)===!1)return!1;A++,De++;break;case"LineString":case"MultiPoint":for(l=0;l<S.length;l++){if(t(S[l],A,be,De,ke)===!1)return!1;A++,je==="MultiPoint"&&De++}je==="LineString"&&De++;break;case"Polygon":case"MultiLineString":for(l=0;l<S.length;l++){for(c=0;c<S[l].length-E;c++){if(t(S[l][c],A,be,De,ke)===!1)return!1;A++}je==="MultiLineString"&&De++,je==="Polygon"&&ke++}je==="Polygon"&&De++;break;case"MultiPolygon":for(l=0;l<S.length;l++){for(ke=0,c=0;c<S[l].length;c++){for(n=0;n<S[l][c].length-E;n++){if(t(S[l][c][n],A,be,De,ke)===!1)return!1;A++}ke++}De++}break;case"GeometryCollection":for(l=0;l<x.geometries.length;l++)if(Md(x.geometries[l],t,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Jw(h,t={}){let r=0,l=0,c=0;return Md(h,function(n){r+=n[0],l+=n[1],c++},!0),Rl([r/c,l/c],t.properties)}function eo(h){if(!h)throw new Error("coord is required");if(!Array.isArray(h)){if(h.type==="Feature"&&h.geometry!==null&&h.geometry.type==="Point")return[...h.geometry.coordinates];if(h.type==="Point")return[...h.coordinates]}if(Array.isArray(h)&&h.length>=2&&!Array.isArray(h[0])&&!Array.isArray(h[1]))return[...h];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Qw(h){if(Array.isArray(h))return h;if(h.type==="Feature"){if(h.geometry!==null)return h.geometry.coordinates}else if(h.coordinates)return h.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function tS(h,t,r={}){let l;return r.final?l=eS(eo(t),eo(h)):l=eS(eo(h),eo(t)),l>180?-(360-l):l}function eS(h,t){let r=Al(h[1]),l=Al(t[1]),c=Al(t[0]-h[0]);c>Math.PI&&(c-=2*Math.PI),c<-Math.PI&&(c+=2*Math.PI);let n=Math.log(Math.tan(l/2+Math.PI/4)/Math.tan(r/2+Math.PI/4)),x=Math.atan2(c,n);return(Yw(x)+360)%360}function iS(h,t,r={}){let l=eo(h),c=eo(t);c[0]+=c[0]-l[0]>180?-360:l[0]-c[0]>180?360:0;let n=VI(l,c);return Jf(n,"meters",r.units)}function VI(h,t,r){r=r===void 0?jr:Number(r);let l=r,c=h[1]*Math.PI/180,n=t[1]*Math.PI/180,x=n-c,b=Math.abs(t[0]-h[0])*Math.PI/180;b>Math.PI&&(b-=2*Math.PI);let S=Math.log(Math.tan(n/2+Math.PI/4)/Math.tan(c/2+Math.PI/4)),R=Math.abs(S)>1e-11?x/S:Math.cos(c);return Math.sqrt(x*x+R*R*b*b)*l}function rS(h,t,r,l={}){let c=t<0,n=Jf(Math.abs(t),l.units,"meters");c&&(n=-Math.abs(n));let x=eo(h),b=UI(x,n,r);return b[0]+=b[0]-x[0]>180?-360:x[0]-b[0]>180?360:0,Rl(b,l.properties)}function UI(h,t,r,l){l=l===void 0?jr:Number(l);let c=t/l,n=h[0]*Math.PI/180,x=Al(h[1]),b=Al(r),S=c*Math.cos(b),R=x+S;Math.abs(R)>Math.PI/2&&(R=R>0?Math.PI-R:-Math.PI-R);let E=Math.log(Math.tan(R/2+Math.PI/4)/Math.tan(x/2+Math.PI/4)),A=Math.abs(E)>1e-11?S/E:Math.cos(x),z=c*Math.sin(b)/A;return[((n+z)*180/Math.PI+540)%360-180,R*180/Math.PI]}function nS(h){if(!h)throw new Error("geojson is required");switch(h.type){case"Feature":return sS(h);case"FeatureCollection":return ZI(h);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return O0(h);default:throw new Error("unknown GeoJSON type")}}function sS(h){let t={type:"Feature"};return Object.keys(h).forEach(r=>{switch(r){case"type":case"properties":case"geometry":return;default:t[r]=h[r]}}),t.properties=oS(h.properties),h.geometry==null?t.geometry=null:t.geometry=O0(h.geometry),t}function oS(h){let t={};return h&&Object.keys(h).forEach(r=>{let l=h[r];typeof l=="object"?l===null?t[r]=null:Array.isArray(l)?t[r]=l.map(c=>c):t[r]=oS(l):t[r]=l}),t}function ZI(h){let t={type:"FeatureCollection"};return Object.keys(h).forEach(r=>{switch(r){case"type":case"features":return;default:t[r]=h[r]}}),t.features=h.features.map(r=>sS(r)),t}function O0(h){let t={type:h.type};return h.bbox&&(t.bbox=h.bbox),h.type==="GeometryCollection"?(t.geometries=h.geometries.map(r=>O0(r)),t):(t.coordinates=aS(h.coordinates),t)}function aS(h){let t=h;return typeof t[0]!="object"?t.slice():t.map(r=>aS(r))}function qI(h,t,r){if(r=r||{},!Kw(r))throw new Error("options is invalid");let l=r.pivot,c=r.mutate;if(!h)throw new Error("geojson is required");if(t==null||isNaN(t))throw new Error("angle is required");if(t===0)return h;let n=l??Jw(h);return(c===!1||c===void 0)&&(h=nS(h)),Md(h,function(x){let S=tS(n,x)+t,R=iS(n,x),E=Qw(rS(n,R,S));x[0]=E[0],x[1]=E[1]}),h}var B0=qI;var WI=(h,t=1)=>{let{height:r,width:l}=h.getCanvas(),c=h.unproject({x:0,y:0}),n=h.unproject({x:0,y:r/t}),x=h.unproject({x:l/t,y:r/t}),b=h.unproject({x:l/t,y:0});return[[c.lng,c.lat],[b.lng,b.lat],[x.lng,x.lat],[n.lng,n.lat]]},Qf=WI;var $I=h=>{let t=h.getBounds().toArray(),r=vr(t[0]),l=vr(t[1]),c=[...r,...l],{width:n,height:x}=h.getCanvas(),b=Ti(c)/n,S=ar(c)/x;return Math.max(b,S)},lS=$I;var j0=class extends Kf{get canvas(){return this.engine.canvas}get pixelRatio(){return this.engine.pixelRatio||1}set pixelRatio(t){this.engine.pixelRatio=t||1}#e;constructor(t={}){let r=t?.id||"realtime";super({...t,id:"realtime-custom-"+r}),this.#e=r,this.engine=new $f({getViewState:this.getViewState.bind(this),onRender:this.onRealtimeEngineRender.bind(this),...t}),this.sourceId=this.#e,this.source={animate:!0,attribution:t.attribution?.join(", "),canvas:this.canvas,coordinates:[[0,0],[1,1],[2,2],[0,0]],loaded:!0,type:"canvas"},this.layer={id:this.#e,layout:{visibility:"visible"},paint:{"raster-fade-duration":0,"raster-opacity":1,"raster-resampling":"nearest"},source:this.sourceId,type:"raster"},this.onLoad=this.onLoad.bind(this),this.onMove=this.onMove.bind(this),this.onMoveEnd=this.onMoveEnd.bind(this),this.onZoomEnd=this.onZoomEnd.bind(this)}getViewState(){if(!this.map)return{};this.pixelRatio||(this.pixelRatio=1);let{height:t,width:r}=this.map.getCanvas(),l=this.map.getCenter(),c=this.map.unproject({x:0,y:t/this.pixelRatio}),n=this.map.unproject({x:r/this.pixelRatio,y:0}),x=B0(Rl([c.lng,c.lat]),-this.map.getBearing(),{pivot:[l.lng,l.lat]}).geometry.coordinates,b=B0(Rl([n.lng,n.lat]),-this.map.getBearing(),{pivot:[l.lng,l.lat]}).geometry.coordinates,S=[...vr(x),...vr(b)],R=Ti(S)/(r/this.pixelRatio),E=ar(S)/(t/this.pixelRatio),A=Math.max(R,E);return{center:vr([l.lng,l.lat]),extent:S,pixelRatio:this.pixelRatio,resolution:A,rotation:-(this.map.getBearing()*Math.PI)/180,size:[r/this.pixelRatio,t/this.pixelRatio],visible:!0,zoom:this.map.getZoom()-1}}onAdd(t,r){super.onAdd(t,r),this.engine.attachToMap(),t.isStyleLoaded()&&this.onLoad(),t.on("load",this.onLoad)}onLoad(){this.map?.getSource(this.sourceId)||this.map?.addSource(this.sourceId,this.source),this.map?.getLayer(this.layer.id)||this.map?.addLayer(this.layer,this.id),this.start()}onMove(){this.engine.renderTrajectories()}onMoveEnd(){this.engine.renderTrajectories(),this.engine.isUpdateBboxOnMoveEnd&&this.engine.setBbox()}onRealtimeEngineRender(){if(this.map?.style){let t=Qf(this.map,this.pixelRatio),r=this.map.getSource(this.sourceId);r&&r.setCoordinates(t)}}onRemove(t,r){this.engine.detachFromMap(),this.stop(),t.off("load",this.onLoad),t.getLayer(this.layer.id)&&t.removeLayer(this.layer.id),t.getSource(this.sourceId)&&t.removeSource(this.sourceId),super.onRemove(t,r)}onZoomEnd(){this.engine.onZoomEnd()}start(){this.engine.start(),this.map?.on("move",this.onMove),this.map?.on("moveend",this.onMoveEnd),this.map?.on("zoomend",this.onZoomEnd)}stop(){this.engine.stop(),this.map?.off("move",this.onMove),this.map?.off("moveend",this.onMoveEnd),this.map?.off("zoomend",this.onZoomEnd)}},cS=j0;var N0={ol:Yf,maplibre:em};typeof window<"u"&&(window.mbt=N0);var V6=N0;})();
733
+ `){It+=ct,ct=0,He=A*De+Je*z,++yt;continue}let Ft=W[dt+1]||S.font;Ft!==xt&&(c&&ot.push("font",Ft),l&&vt.push("font",Ft),xt=Ft),ct=Math.max(ct,be[ut]);let Pt=[qt,He+Je*ge[ut]+A*(ge[ut]-ve[yt]),.5*(z+ct)+It];He+=ge[ut],c&&ot.push("strokeText",Pt),l&&vt.push("fillText",Pt),++ut}return Array.prototype.push.apply(ke,ot),Array.prototype.push.apply(ke,vt),this.labels_[n]=tt,tt}replayTextBackground_(t,r,l,c,n,x,b){t.beginPath(),t.moveTo.apply(t,r),t.lineTo.apply(t,l),t.lineTo.apply(t,c),t.lineTo.apply(t,n),t.lineTo.apply(t,r),x&&(this.alignAndScaleFill_=x[2],this.fill_(t)),b&&(this.setStrokeStyle_(t,b),t.stroke())}calculateImageOrLabelDimensions_(t,r,l,c,n,x,b,S,R,E,A,z,W,re,me,ge){b*=z[0],S*=z[1];let be=l-b,ve=c-S,De=n+R>t?t-R:n,ke=x+E>r?r-E:x,je=re[3]+De*z[0]+re[1],Re=re[0]+ke*z[1]+re[2],tt=be-re[3],Je=ve-re[0];(me||A!==0)&&(Sa[0]=tt,Ta[0]=tt,Sa[1]=Je,zo[1]=Je,zo[0]=tt+je,Oo[0]=zo[0],Oo[1]=Je+Re,Ta[1]=Oo[1]);let He;return A!==0?(He=Yr(yr(),l,c,1,1,A,-l,-c),Ar(He,Sa),Ar(He,zo),Ar(He,Oo),Ar(He,Ta),Io(Math.min(Sa[0],zo[0],Oo[0],Ta[0]),Math.min(Sa[1],zo[1],Oo[1],Ta[1]),Math.max(Sa[0],zo[0],Oo[0],Ta[0]),Math.max(Sa[1],zo[1],Oo[1],Ta[1]),Hc)):Io(Math.min(tt,tt+je),Math.min(Je,Je+Re),Math.max(tt,tt+je),Math.max(Je,Je+Re),Hc),W&&(be=Math.round(be),ve=Math.round(ve)),{drawImageX:be,drawImageY:ve,drawImageW:De,drawImageH:ke,originX:R,originY:E,declutterBox:{minX:Hc[0],minY:Hc[1],maxX:Hc[2],maxY:Hc[3],value:ge},canvasTransform:He,scale:z}}replayImageOrLabel_(t,r,l,c,n,x,b){let S=!!(x||b),R=c.declutterBox,E=b?b[2]*c.scale[0]/2:0;return R.minX-E<=r[0]&&R.maxX+E>=0&&R.minY-E<=r[1]&&R.maxY+E>=0&&(S&&this.replayTextBackground_(t,Sa,zo,Oo,Ta,x,b),p1(t,c.canvasTransform,n,l,c.originX,c.originY,c.drawImageW,c.drawImageH,c.drawImageX,c.drawImageY,c.scale)),!0}fill_(t){let r=this.alignAndScaleFill_;if(r){let l=Ar(this.renderedTransform_,[0,0]),c=512*this.pixelRatio;t.save(),t.translate(l[0]%c,l[1]%c),r!==1&&t.scale(r,r),t.rotate(this.viewRotation_)}t.fill(),r&&t.restore()}setStrokeStyle_(t,r){t.strokeStyle=r[1],t.lineWidth=r[2],t.lineCap=r[3],t.lineJoin=r[4],t.miterLimit=r[5],t.lineDashOffset=r[7],t.setLineDash(r[6])}drawLabelWithPointPlacement_(t,r,l,c){let n=this.textStates[r],x=this.createLabel(t,r,c,l),b=this.strokeStates[l],S=this.pixelRatio,R=Dy(Array.isArray(t)?t[0]:t,n.textAlign||ya),E=_d[n.textBaseline||Tl],A=b&&b.lineWidth?b.lineWidth:0,z=x.width/S-2*n.scale[0],W=R*z+2*(.5-R)*A,re=E*x.height/S+2*(.5-E)*A;return{label:x,anchorX:W,anchorY:re}}execute_(t,r,l,c,n,x,b,S){let R=this.zIndexContext_,E;this.pixelCoordinates_&&vn(l,this.renderedTransform_)?E=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),E=Sn(this.coordinates,0,this.coordinates.length,2,l,this.pixelCoordinates_),Iv(this.renderedTransform_,l));let A=0,z=c.length,W=0,re,me,ge,be,ve,De,ke,je,Re,tt,Je,He,ot,vt=0,ct=0,It=null,ut=null,yt=this.coordinateCache_,xt=this.viewRotation_,dt=Math.round(Math.atan2(-l[1],l[0])*1e12)/1e12,St={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:xt},qt=this.instructions!=c||this.overlaps?0:200,Ft,Pt,jt,$t;for(;A<z;){let et=c[A];switch(et[0]){case bt.BEGIN_GEOMETRY:Ft=et[1],$t=et[3],Ft.getGeometry()?b!==void 0&&!er(b,$t.getExtent())?A=et[2]+1:++A:A=et[2],R&&(R.zIndex=et[4]);break;case bt.BEGIN_PATH:vt>qt&&(this.fill_(t),vt=0),ct>qt&&(t.stroke(),ct=0),!vt&&!ct&&(t.beginPath(),ve=NaN,De=NaN),++A;break;case bt.CIRCLE:W=et[1];let Ai=E[W],Ci=E[W+1],en=E[W+2],_i=E[W+3],ti=en-Ai,tn=_i-Ci,oi=Math.sqrt(ti*ti+tn*tn);t.moveTo(Ai+oi,Ci),t.arc(Ai,Ci,oi,0,2*Math.PI,!0),++A;break;case bt.CLOSE_PATH:t.closePath(),++A;break;case bt.CUSTOM:W=et[1],re=et[2];let gn=et[3],Ln=et[4],Tr=et[5];St.geometry=gn,St.feature=Ft,A in yt||(yt[A]=[]);let $i=yt[A];Tr?Tr(E,W,re,2,$i):($i[0]=E[W],$i[1]=E[W+1],$i.length=2),R&&(R.zIndex=et[6]),Ln($i,St),++A;break;case bt.DRAW_IMAGE:W=et[1],re=et[2],Re=et[3],me=et[4],ge=et[5];let yi=et[6],Li=et[7],rn=et[8],kn=et[9],nn=et[10],Dn=et[11],Qn=et[12],Nr=et[13];be=et[14]||"declutter";let sn=et[15];if(!Re&&et.length>=20){tt=et[19],Je=et[20],He=et[21],ot=et[22];let Ue=this.drawLabelWithPointPlacement_(tt,Je,He,ot);Re=Ue.label,et[3]=Re;let ht=et[23];me=(Ue.anchorX-ht)*this.pixelRatio,et[4]=me;let pt=et[24];ge=(Ue.anchorY-pt)*this.pixelRatio,et[5]=ge,yi=Re.height,et[6]=yi,Nr=Re.width,et[13]=Nr}let on;et.length>25&&(on=et[25]);let Fn,an,zn;et.length>17?(Fn=et[16],an=et[17],zn=et[18]):(Fn=Lo,an=!1,zn=!1),nn&&dt?Dn+=xt:!nn&&!dt&&(Dn-=xt);let zs=0;for(;W<re;W+=2){if(on&&on[zs++]<Nr/this.pixelRatio)continue;let Ue=this.calculateImageOrLabelDimensions_(Re.width,Re.height,E[W],E[W+1],Nr,yi,me,ge,rn,kn,Dn,Qn,n,Fn,an||zn,Ft),ht=[t,r,Re,Ue,Li,an?It:null,zn?ut:null];if(S){let pt,Pe,We;if(sn){let mt=re-W;if(!sn[mt]){sn[mt]={args:ht,declutterMode:be};continue}let nt=sn[mt];pt=nt.args,Pe=nt.declutterMode,delete sn[mt],We=G1(pt)}let Qe,wt;if(pt&&(Pe!=="declutter"||!S.collides(We))&&(Qe=!0),(be!=="declutter"||!S.collides(Ue.declutterBox))&&(wt=!0),Pe==="declutter"&&be==="declutter"){let mt=Qe&&wt;Qe=mt,wt=mt}Qe&&(Pe!=="none"&&S.insert(We),this.replayImageOrLabel_.apply(this,pt)),wt&&(be!=="none"&&S.insert(Ue.declutterBox),this.replayImageOrLabel_.apply(this,ht))}else this.replayImageOrLabel_.apply(this,ht)}++A;break;case bt.DRAW_CHARS:let Os=et[1],On=et[2],K=et[3],Z=et[4];ot=et[5];let $=et[6],X=et[7],ne=et[8];He=et[9];let he=et[10];tt=et[11],Je=et[12];let ye=[et[13],et[13]];be=et[14]||"declutter";let Te=et[15],_e=this.textStates[Je],Ee=_e.font,Ie=[_e.scale[0]*X,_e.scale[1]*X],xe;Ee in this.widths_?xe=this.widths_[Ee]:(xe={},this.widths_[Ee]=xe);let pe=mf(E,Os,On,2),Xe=Math.abs(Ie[0])*ty(Ee,tt,xe);if(Z||Xe<=pe){let Ue=this.textStates[Je].textAlign,ht=(pe-Xe)*Dy(tt,Ue),pt=N1(E,Os,On,2,tt,ht,$,Math.abs(Ie[0]),ty,Ee,xe,dt?0:this.viewRotation_,Te);e:if(pt){let Pe=[],We,Qe,wt,mt,nt;if(He)for(We=0,Qe=pt.length;We<Qe;++We){nt=pt[We],wt=nt[4],mt=this.createLabel(wt,Je,"",He),me=nt[2]+(Ie[0]<0?-he:he),ge=K*mt.height+(.5-K)*2*he*Ie[1]/Ie[0]-ne;let Ke=this.calculateImageOrLabelDimensions_(mt.width,mt.height,nt[0],nt[1],mt.width,mt.height,me,ge,0,0,nt[3],ye,!1,Lo,!1,Ft);if(S&&be==="declutter"&&S.collides(Ke.declutterBox))break e;Pe.push([t,r,mt,Ke,1,null,null])}if(ot)for(We=0,Qe=pt.length;We<Qe;++We){nt=pt[We],wt=nt[4],mt=this.createLabel(wt,Je,ot,""),me=nt[2],ge=K*mt.height-ne;let Ke=this.calculateImageOrLabelDimensions_(mt.width,mt.height,nt[0],nt[1],mt.width,mt.height,me,ge,0,0,nt[3],ye,!1,Lo,!1,Ft);if(S&&be==="declutter"&&S.collides(Ke.declutterBox))break e;Pe.push([t,r,mt,Ke,1,null,null])}S&&be!=="none"&&S.load(Pe.map(G1));for(let Ke=0,ai=Pe.length;Ke<ai;++Ke)this.replayImageOrLabel_.apply(this,Pe[Ke])}}++A;break;case bt.END_GEOMETRY:if(x!==void 0){Ft=et[1];let Ue=x(Ft,$t,be);if(Ue)return Ue}++A;break;case bt.FILL:qt?vt++:this.fill_(t),++A;break;case bt.MOVE_TO_LINE_TO:for(W=et[1],re=et[2],Pt=E[W],jt=E[W+1],t.moveTo(Pt,jt),ve=Pt+.5|0,De=jt+.5|0,W+=2;W<re;W+=2)Pt=E[W],jt=E[W+1],ke=Pt+.5|0,je=jt+.5|0,(W==re-2||ke!==ve||je!==De)&&(t.lineTo(Pt,jt),ve=ke,De=je);++A;break;case bt.SET_FILL_STYLE:It=et,this.alignAndScaleFill_=et[2],vt&&(this.fill_(t),vt=0,ct&&(t.stroke(),ct=0)),t.fillStyle=et[1],++A;break;case bt.SET_STROKE_STYLE:ut=et,ct&&(t.stroke(),ct=0),this.setStrokeStyle_(t,et),++A;break;case bt.STROKE:qt?ct++:t.stroke(),++A;break;default:++A;break}}vt&&this.fill_(t),ct&&t.stroke()}execute(t,r,l,c,n,x){this.viewRotation_=c,this.execute_(t,r,l,this.instructions,n,void 0,void 0,x)}executeHitDetection(t,r,l,c,n){return this.viewRotation_=l,this.execute_(t,[t.canvas.width,t.canvas.height],r,this.hitDetectionInstructions,!0,c,n)}},U1=Fy;var Il=["Polygon","Circle","LineString","Image","Text","Default"],By=["Image","Text"],Z1=Il.filter(h=>!By.includes(h)),Oy=class{constructor(t,r,l,c,n,x,b){this.maxExtent_=t,this.overlaps_=c,this.pixelRatio_=l,this.resolution_=r,this.renderBuffer_=x,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=yr(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(n,b)}clip(t,r){let l=this.getClipCoords(r);t.beginPath(),t.moveTo(l[0],l[1]),t.lineTo(l[2],l[3]),t.lineTo(l[4],l[5]),t.lineTo(l[6],l[7]),t.clip()}createExecutors_(t,r){for(let l in t){let c=this.executorsByZIndex_[l];c===void 0&&(c={},this.executorsByZIndex_[l]=c);let n=t[l];for(let x in n){let b=n[x];c[x]=new U1(this.resolution_,this.pixelRatio_,this.overlaps_,b,r)}}}hasExecutors(t){for(let r in this.executorsByZIndex_){let l=this.executorsByZIndex_[r];for(let c=0,n=t.length;c<n;++c)if(t[c]in l)return!0}return!1}forEachFeatureAtCoordinate(t,r,l,c,n,x){c=Math.round(c);let b=c*2+1,S=Yr(this.hitDetectionTransform_,c+.5,c+.5,1/r,-1/r,-l,-t[0],-t[1]),R=!this.hitDetectionContext_;R&&(this.hitDetectionContext_=Fi(b,b,void 0,{willReadFrequently:!0}));let E=this.hitDetectionContext_;E.canvas.width!==b||E.canvas.height!==b?(E.canvas.width=b,E.canvas.height=b):R||E.clearRect(0,0,b,b);let A;this.renderBuffer_!==void 0&&(A=wn(),Og(A,t),us(A,r*(this.renderBuffer_+c),A));let z=tM(c),W;function re(je,Re,tt){let Je=E.getImageData(0,0,b,b).data;for(let He=0,ot=z.length;He<ot;He++)if(Je[z[He]]>0){if(!x||tt==="none"||W!=="Image"&&W!=="Text"||x.includes(je)){let vt=(z[He]-3)/4,ct=c-vt%b,It=c-(vt/b|0),ut=n(je,Re,ct*ct+It*It);if(ut)return ut}E.clearRect(0,0,b,b);break}}let me=Object.keys(this.executorsByZIndex_).map(Number);me.sort(Ss);let ge,be,ve,De,ke;for(ge=me.length-1;ge>=0;--ge){let je=me[ge].toString();for(ve=this.executorsByZIndex_[je],be=Il.length-1;be>=0;--be)if(W=Il[be],De=ve[W],De!==void 0&&(ke=De.executeHitDetection(E,S,l,re,A),ke))return ke}}getClipCoords(t){let r=this.maxExtent_;if(!r)return null;let l=r[0],c=r[1],n=r[2],x=r[3],b=[l,c,l,x,n,x,n,c];return Sn(b,0,8,2,t,b),b}isEmpty(){return Xn(this.executorsByZIndex_)}execute(t,r,l,c,n,x,b){let S=Object.keys(this.executorsByZIndex_).map(Number);S.sort(b?Lv:Ss),x=x||Il;let R=Il.length;for(let E=0,A=S.length;E<A;++E){let z=S[E].toString(),W=this.executorsByZIndex_[z];for(let re=0,me=x.length;re<me;++re){let ge=x[re],be=W[ge];if(be!==void 0){let ve=b===null?void 0:be.getZIndexContext(),De=ve?ve.getContext():t,ke=this.maxExtent_&&ge!=="Image"&&ge!=="Text";if(ke&&(De.save(),this.clip(De,l)),!ve||ge==="Text"||ge==="Image"?be.execute(De,r,l,c,n,b):ve.pushFunction(je=>be.execute(je,r,l,c,n,b)),ke&&De.restore(),ve){ve.offset();let je=S[E]*R+re;this.deferredZIndexContexts_[je]||(this.deferredZIndexContexts_[je]=[]),this.deferredZIndexContexts_[je].push(ve)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let t=this.deferredZIndexContexts_,r=Object.keys(t).map(Number).sort(Ss);for(let l=0,c=r.length;l<c;++l)t[r[l]].forEach(n=>{n.draw(this.renderedContext_),n.clear()}),t[r[l]].length=0}},zy={};function tM(h){if(zy[h]!==void 0)return zy[h];let t=h*2+1,r=h*h,l=new Array(r+1);for(let n=0;n<=h;++n)for(let x=0;x<=h;++x){let b=n*n+x*x;if(b>r)break;let S=l[b];S||(S=[],l[b]=S),S.push(((h+n)*t+(h+x))*4+3),n>0&&S.push(((h-n)*t+(h+x))*4+3),x>0&&(S.push(((h+n)*t+(h-x))*4+3),n>0&&S.push(((h-n)*t+(h-x))*4+3))}let c=[];for(let n=0,x=l.length;n<x;++n)l[n]&&c.push(...l[n]);return zy[h]=c,c}var q1=Oy;var jy=class extends jf{constructor(t,r,l,c,n,x,b){super(),this.context_=t,this.pixelRatio_=r,this.extent_=l,this.transform_=c,this.transformRotation_=c?Xv(Math.atan2(c[1],c[0]),10):0,this.viewRotation_=n,this.squaredTolerance_=x,this.userTransform_=b,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=yr()}drawImages_(t,r,l,c){if(!this.image_)return;let n=Sn(t,r,l,c,this.transform_,this.pixelCoordinates_),x=this.context_,b=this.tmpLocalTransform_,S=x.globalAlpha;this.imageOpacity_!=1&&(x.globalAlpha=S*this.imageOpacity_);let R=this.imageRotation_;this.transformRotation_===0&&(R-=this.viewRotation_),this.imageRotateWithView_&&(R+=this.viewRotation_);for(let E=0,A=n.length;E<A;E+=2){let z=n[E]-this.imageAnchorX_,W=n[E+1]-this.imageAnchorY_;if(R!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let re=z+this.imageAnchorX_,me=W+this.imageAnchorY_;Yr(b,re,me,1,1,R,-re,-me),x.save(),x.transform.apply(x,b),x.translate(re,me),x.scale(this.imageScale_[0],this.imageScale_[1]),x.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),x.restore()}else x.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,z,W,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(x.globalAlpha=S)}drawText_(t,r,l,c){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let n=Sn(t,r,l,c,this.transform_,this.pixelCoordinates_),x=this.context_,b=this.textRotation_;for(this.transformRotation_===0&&(b-=this.viewRotation_),this.textRotateWithView_&&(b+=this.viewRotation_);r<l;r+=c){let S=n[r]+this.textOffsetX_,R=n[r+1]+this.textOffsetY_;b!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(x.save(),x.translate(S-this.textOffsetX_,R-this.textOffsetY_),x.rotate(b),x.translate(this.textOffsetX_,this.textOffsetY_),x.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&x.strokeText(this.text_,0,0),this.textFillState_&&x.fillText(this.text_,0,0),x.restore()):(this.textStrokeState_&&x.strokeText(this.text_,S,R),this.textFillState_&&x.fillText(this.text_,S,R))}}moveToLineTo_(t,r,l,c,n){let x=this.context_,b=Sn(t,r,l,c,this.transform_,this.pixelCoordinates_);x.moveTo(b[0],b[1]);let S=b.length;n&&(S-=2);for(let R=2;R<S;R+=2)x.lineTo(b[R],b[R+1]);return n&&x.closePath(),l}drawRings_(t,r,l,c){for(let n=0,x=l.length;n<x;++n)r=this.moveToLineTo_(t,r,l[n],c,!0);return r}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!er(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let r=vb(t,this.transform_,this.pixelCoordinates_),l=r[2]-r[0],c=r[3]-r[1],n=Math.sqrt(l*l+c*c),x=this.context_;x.beginPath(),x.arc(r[0],r[1],n,0,2*Math.PI),this.fillState_&&x.fill(),this.strokeState_&&x.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t);break;default:}}drawFeature(t,r){let l=r.getGeometryFunction()(t);l&&(this.setStyle(r),this.drawGeometry(l))}drawGeometryCollection(t){let r=t.getGeometriesArray();for(let l=0,c=r.length;l<c;++l)this.drawGeometry(r[l])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let r=t.getFlatCoordinates(),l=t.getStride();this.image_&&this.drawImages_(r,0,r.length,l),this.text_!==""&&this.drawText_(r,0,r.length,l)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let r=t.getFlatCoordinates(),l=t.getStride();this.image_&&this.drawImages_(r,0,r.length,l),this.text_!==""&&this.drawText_(r,0,r.length,l)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!er(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let r=this.context_,l=t.getFlatCoordinates();r.beginPath(),this.moveToLineTo_(l,0,l.length,t.getStride(),!1),r.stroke()}if(this.text_!==""){let r=t.getFlatMidpoint();this.drawText_(r,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let r=t.getExtent();if(er(this.extent_,r)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let l=this.context_,c=t.getFlatCoordinates(),n=0,x=t.getEnds(),b=t.getStride();l.beginPath();for(let S=0,R=x.length;S<R;++S)n=this.moveToLineTo_(c,n,x[S],b,!1);l.stroke()}if(this.text_!==""){let l=t.getFlatMidpoints();this.drawText_(l,0,l.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!er(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let r=this.context_;r.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}if(this.text_!==""){let r=t.getFlatInteriorPoint();this.drawText_(r,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!er(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let r=this.context_,l=t.getOrientedFlatCoordinates(),c=0,n=t.getEndss(),x=t.getStride();r.beginPath();for(let b=0,S=n.length;b<S;++b){let R=n[b];c=this.drawRings_(l,c,R,x)}this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}if(this.text_!==""){let r=t.getFlatInteriorPoints();this.drawText_(r,0,r.length,2)}}}setContextFillState_(t){let r=this.context_,l=this.contextFillState_;l?l.fillStyle!=t.fillStyle&&(l.fillStyle=t.fillStyle,r.fillStyle=t.fillStyle):(r.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){let r=this.context_,l=this.contextStrokeState_;l?(l.lineCap!=t.lineCap&&(l.lineCap=t.lineCap,r.lineCap=t.lineCap),vn(l.lineDash,t.lineDash)||r.setLineDash(l.lineDash=t.lineDash),l.lineDashOffset!=t.lineDashOffset&&(l.lineDashOffset=t.lineDashOffset,r.lineDashOffset=t.lineDashOffset),l.lineJoin!=t.lineJoin&&(l.lineJoin=t.lineJoin,r.lineJoin=t.lineJoin),l.lineWidth!=t.lineWidth&&(l.lineWidth=t.lineWidth,r.lineWidth=t.lineWidth),l.miterLimit!=t.miterLimit&&(l.miterLimit=t.miterLimit,r.miterLimit=t.miterLimit),l.strokeStyle!=t.strokeStyle&&(l.strokeStyle=t.strokeStyle,r.strokeStyle=t.strokeStyle)):(r.lineCap=t.lineCap,r.setLineDash(t.lineDash),r.lineDashOffset=t.lineDashOffset,r.lineJoin=t.lineJoin,r.lineWidth=t.lineWidth,r.miterLimit=t.miterLimit,r.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){let r=this.context_,l=this.contextTextState_,c=t.textAlign?t.textAlign:ya;l?(l.font!=t.font&&(l.font=t.font,r.font=t.font),l.textAlign!=c&&(l.textAlign=c,r.textAlign=c),l.textBaseline!=t.textBaseline&&(l.textBaseline=t.textBaseline,r.textBaseline=t.textBaseline)):(r.font=t.font,r.textAlign=c,r.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:c,textBaseline:t.textBaseline})}setFillStrokeStyle(t,r){if(!t)this.fillState_=null;else{let l=t.getColor();this.fillState_={fillStyle:Mn(l||hr)}}if(!r)this.strokeState_=null;else{let l=r.getColor(),c=r.getLineCap(),n=r.getLineDash(),x=r.getLineDashOffset(),b=r.getLineJoin(),S=r.getWidth(),R=r.getMiterLimit(),E=n||In;this.strokeState_={lineCap:c!==void 0?c:Xs,lineDash:this.pixelRatio_===1?E:E.map(A=>A*this.pixelRatio_),lineDashOffset:(x||En)*this.pixelRatio_,lineJoin:b!==void 0?b:Hs,lineWidth:(S!==void 0?S:ko)*this.pixelRatio_,miterLimit:R!==void 0?R:Ro,strokeStyle:Mn(l||Ao)}}}setImageStyle(t){let r;if(!t||!(r=t.getSize())){this.image_=null;return}let l=t.getPixelRatio(this.pixelRatio_),c=t.getAnchor(),n=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=c[0]*l,this.imageAnchorY_=c[1]*l,this.imageHeight_=r[1]*l,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=n[0],this.imageOriginY_=n[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();let x=t.getScaleArray();this.imageScale_=[x[0]*this.pixelRatio_/l,x[1]*this.pixelRatio_/l],this.imageWidth_=r[0]*l}setTextStyle(t){if(!t)this.text_="";else{let r=t.getFill();if(!r)this.textFillState_=null;else{let W=r.getColor();this.textFillState_={fillStyle:Mn(W||hr)}}let l=t.getStroke();if(!l)this.textStrokeState_=null;else{let W=l.getColor(),re=l.getLineCap(),me=l.getLineDash(),ge=l.getLineDashOffset(),be=l.getLineJoin(),ve=l.getWidth(),De=l.getMiterLimit();this.textStrokeState_={lineCap:re!==void 0?re:Xs,lineDash:me||In,lineDashOffset:ge||En,lineJoin:be!==void 0?be:Hs,lineWidth:ve!==void 0?ve:ko,miterLimit:De!==void 0?De:Ro,strokeStyle:Mn(W||Ao)}}let c=t.getFont(),n=t.getOffsetX(),x=t.getOffsetY(),b=t.getRotateWithView(),S=t.getRotation(),R=t.getScaleArray(),E=t.getText(),A=t.getTextAlign(),z=t.getTextBaseline();this.textState_={font:c!==void 0?c:Pf,textAlign:A!==void 0?A:ya,textBaseline:z!==void 0?z:Tl},this.text_=E!==void 0?Array.isArray(E)?E.reduce((W,re,me)=>W+=me%2?" ":re,""):E:"",this.textOffsetX_=n!==void 0?this.pixelRatio_*n:0,this.textOffsetY_=x!==void 0?this.pixelRatio_*x:0,this.textRotateWithView_=b!==void 0?b:!1,this.textRotation_=S!==void 0?S:0,this.textScale_=[this.pixelRatio_*R[0],this.pixelRatio_*R[1]]}}},W1=jy;var Ds=.5;function $1(h,t,r,l,c,n,x,b,S){let R=S?Zs(c,S):c,E=h[0]*Ds,A=h[1]*Ds,z=Fi(E,A);z.imageSmoothingEnabled=!1;let W=z.canvas,re=new W1(z,Ds,c,null,x,b,S?Dc(Hn(),S):null),me=r.length,ge=Math.floor((256*256*256-1)/me),be={};for(let De=1;De<=me;++De){let ke=r[De-1],je=ke.getStyleFunction()||l;if(!je)continue;let Re=je(ke,n);if(!Re)continue;Array.isArray(Re)||(Re=[Re]);let Je=(De*ge).toString(16).padStart(7,"#00000");for(let He=0,ot=Re.length;He<ot;++He){let vt=Re[He],ct=vt.getGeometryFunction()(ke);if(!ct||!er(R,ct.getExtent()))continue;let It=vt.clone(),ut=It.getFill();ut&&ut.setColor(Je);let yt=It.getStroke();yt&&(yt.setColor(Je),yt.setLineDash(null)),It.setText(void 0);let xt=vt.getImage();if(xt){let Ft=xt.getImageSize();if(!Ft)continue;let Pt=Fi(Ft[0],Ft[1],void 0,{alpha:!1}),jt=Pt.canvas;Pt.fillStyle=Je,Pt.fillRect(0,0,jt.width,jt.height),It.setImage(new ad({img:jt,anchor:xt.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:xt.getOrigin(),opacity:1,size:xt.getSize(),scale:xt.getScale(),rotation:xt.getRotation(),rotateWithView:xt.getRotateWithView()}))}let dt=It.getZIndex()||0,St=be[dt];St||(St={},be[dt]=St,St.Polygon=[],St.Circle=[],St.LineString=[],St.Point=[]);let qt=ct.getType();if(qt==="GeometryCollection"){let Ft=ct.getGeometriesArrayRecursive();for(let Pt=0,jt=Ft.length;Pt<jt;++Pt){let $t=Ft[Pt];St[$t.getType().replace("Multi","")].push($t,It)}}else St[qt.replace("Multi","")].push(ct,It)}}let ve=Object.keys(be).map(Number).sort(Ss);for(let De=0,ke=ve.length;De<ke;++De){let je=be[ve[De]];for(let Re in je){let tt=je[Re];for(let Je=0,He=tt.length;Je<He;Je+=2){re.setStyle(tt[Je+1]);for(let ot=0,vt=t.length;ot<vt;++ot)re.setTransform(t[ot]),re.drawGeometry(tt[Je])}}}return z.getImageData(0,0,W.width,W.height)}function X1(h,t,r){let l=[];if(r){let c=Math.floor(Math.round(h[0])*Ds),n=Math.floor(Math.round(h[1])*Ds),x=(Pi(c,0,r.width-1)+Pi(n,0,r.height-1)*r.width)*4,b=r.data[x],S=r.data[x+1],E=r.data[x+2]+256*(S+256*b),A=Math.floor((256*256*256-1)/t.length);E&&E%A===0&&l.push(t[E/A-1])}return l}var iM=.5,H1={Point:cM,LineString:oM,Polygon:uM,MultiPoint:hM,MultiLineString:aM,MultiPolygon:lM,GeometryCollection:sM,Circle:rM};function Y1(h,t){return parseInt(Gt(h),10)-parseInt(Gt(t),10)}function Ny(h,t){let r=Gy(h,t);return r*r}function Gy(h,t){return iM*h/t}function rM(h,t,r,l,c){let n=r.getFill(),x=r.getStroke();if(n||x){let S=h.getBuilder(r.getZIndex(),"Circle");S.setFillStrokeStyle(n,x),S.drawCircle(t,l,c)}let b=r.getText();if(b&&b.getText()){let S=h.getBuilder(r.getZIndex(),"Text");S.setTextStyle(b),S.drawText(t,l)}}function Vy(h,t,r,l,c,n,x,b){let S=[],R=r.getImage();if(R){let z=!0,W=R.getImageState();W==Mt.LOADED||W==Mt.ERROR?z=!1:W==Mt.IDLE&&R.load(),z&&S.push(R.ready())}let E=r.getFill();E&&E.loading()&&S.push(E.ready());let A=S.length>0;return A&&Promise.all(S).then(()=>c(null)),nM(h,t,r,l,n,x,b),A}function nM(h,t,r,l,c,n,x){let b=r.getGeometryFunction()(t);if(!b)return;let S=b.simplifyTransformed(l,c);if(r.getRenderer())K1(h,S,r,t,x);else{let E=H1[S.getType()];E(h,S,r,t,x,n)}}function K1(h,t,r,l,c){if(t.getType()=="GeometryCollection"){let x=t.getGeometries();for(let b=0,S=x.length;b<S;++b)K1(h,x[b],r,l,c);return}h.getBuilder(r.getZIndex(),"Default").drawCustom(t,l,r.getRenderer(),r.getHitDetectionRenderer(),c)}function sM(h,t,r,l,c,n){let x=t.getGeometriesArray(),b,S;for(b=0,S=x.length;b<S;++b){let R=H1[x[b].getType()];R(h,x[b],r,l,c,n)}}function oM(h,t,r,l,c){let n=r.getStroke();if(n){let b=h.getBuilder(r.getZIndex(),"LineString");b.setFillStrokeStyle(null,n),b.drawLineString(t,l,c)}let x=r.getText();if(x&&x.getText()){let b=h.getBuilder(r.getZIndex(),"Text");b.setTextStyle(x),b.drawText(t,l,c)}}function aM(h,t,r,l,c){let n=r.getStroke();if(n){let b=h.getBuilder(r.getZIndex(),"LineString");b.setFillStrokeStyle(null,n),b.drawMultiLineString(t,l,c)}let x=r.getText();if(x&&x.getText()){let b=h.getBuilder(r.getZIndex(),"Text");b.setTextStyle(x),b.drawText(t,l,c)}}function lM(h,t,r,l,c){let n=r.getFill(),x=r.getStroke();if(x||n){let S=h.getBuilder(r.getZIndex(),"Polygon");S.setFillStrokeStyle(n,x),S.drawMultiPolygon(t,l,c)}let b=r.getText();if(b&&b.getText()){let S=h.getBuilder(r.getZIndex(),"Text");S.setTextStyle(b),S.drawText(t,l,c)}}function cM(h,t,r,l,c,n){let x=r.getImage(),b=r.getText(),S=b&&b.getText(),R=n&&x&&S?{}:void 0;if(x){if(x.getImageState()!=Mt.LOADED)return;let E=h.getBuilder(r.getZIndex(),"Image");E.setImageStyle(x,R),E.drawPoint(t,l,c)}if(S){let E=h.getBuilder(r.getZIndex(),"Text");E.setTextStyle(b,R),E.drawText(t,l,c)}}function hM(h,t,r,l,c,n){let x=r.getImage(),b=x&&x.getOpacity()!==0,S=r.getText(),R=S&&S.getText(),E=n&&b&&R?{}:void 0;if(b){if(x.getImageState()!=Mt.LOADED)return;let A=h.getBuilder(r.getZIndex(),"Image");A.setImageStyle(x,E),A.drawMultiPoint(t,l,c)}if(R){let A=h.getBuilder(r.getZIndex(),"Text");A.setTextStyle(S,E),A.drawText(t,l,c)}}function uM(h,t,r,l,c){let n=r.getFill(),x=r.getStroke();if(n||x){let S=h.getBuilder(r.getZIndex(),"Polygon");S.setFillStrokeStyle(n,x),S.drawPolygon(t,l,c)}let b=r.getText();if(b&&b.getText()){let S=h.getBuilder(r.getZIndex(),"Text");S.setTextStyle(b),S.drawText(t,l,c)}}var Uy=class extends Gf{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=wn(),this.wrappedRenderedExtent_=wn(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,r,l){let c=r.extent,n=r.viewState,x=n.center,b=n.resolution,S=n.projection,R=n.rotation,E=S.getExtent(),A=this.getLayer().getSource(),z=this.getLayer().getDeclutter(),W=r.pixelRatio,re=r.viewHints,me=!(re[Tn.ANIMATING]||re[Tn.INTERACTING]),ge=this.context,be=Math.round(Ti(c)/b*W),ve=Math.round(ar(c)/b*W),De=A.getWrapX()&&S.canWrapX(),ke=De?Ti(E):null,je=De?Math.ceil((c[2]-E[2])/ke)+1:1,Re=De?Math.floor((c[0]-E[0])/ke):0;do{let tt=this.getRenderTransform(x,b,0,W,be,ve,Re*ke);r.declutter&&(tt=tt.slice(0)),t.execute(ge,[ge.canvas.width,ge.canvas.height],tt,R,me,l===void 0?Il:l?By:Z1,l?z&&r.declutter[z]:void 0)}while(++Re<je)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Fi(this.context.canvas.width,this.context.canvas.height,ky))}resetDrawContext_(){if(this.opacity_!==1){let t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,o1(this.context),ky.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),this.resetDrawContext_())}renderFrame(t,r){let l=t.layerStatesArray[t.layerIndex];this.opacity_=l.opacity;let c=t.viewState;this.prepareContainer(t,r);let n=this.context,x=this.replayGroup_,b=x&&!x.isEmpty();if(!b&&!(this.getLayer().hasListener(Ws.PRERENDER)||this.getLayer().hasListener(Ws.POSTRENDER)))return null;this.setDrawContext_(),this.preRender(n,t);let S=c.projection;if(this.clipped_=!1,b&&l.extent&&this.clipping){let R=qs(l.extent,S);b=er(R,t.extent),this.clipped_=b&&!Mo(R,t.extent),this.clipped_&&this.clipUnrotated(n,t,R)}return b&&this.renderWorlds(x,t,this.getLayer().getDeclutter()?!1:void 0),!t.declutter&&this.clipped_&&n.restore(),this.postRender(n,t),this.renderedRotation_!==c.rotation&&(this.renderedRotation_=c.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(r=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let l=this.frameState.size.slice(),c=this.renderedCenter_,n=this.renderedResolution_,x=this.renderedRotation_,b=this.renderedProjection_,S=this.wrappedRenderedExtent_,R=this.getLayer(),E=[],A=l[0]*Ds,z=l[1]*Ds;E.push(this.getRenderTransform(c,n,x,Ds,A,z,0).slice());let W=R.getSource(),re=b.getExtent();if(W.getWrapX()&&b.canWrapX()&&!Mo(re,S)){let ge=S[0],be=Ti(re),ve=0,De;for(;ge<re[0];)--ve,De=be*ve,E.push(this.getRenderTransform(c,n,x,Ds,A,z,De).slice()),ge+=be;for(ve=0,ge=S[2];ge>re[2];)++ve,De=be*ve,E.push(this.getRenderTransform(c,n,x,Ds,A,z,De).slice()),ge-=be}let me=Hn();this.hitDetectionImageData_=$1(l,E,this.renderedFeatures_,R.getStyleFunction(),S,n,x,Ny(n,this.renderedPixelRatio_),me?b:null)}r(X1(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,r,l,c,n){if(!this.replayGroup_)return;let x=r.viewState.resolution,b=r.viewState.rotation,S=this.getLayer(),R={},E=function(z,W,re){let me=Gt(z),ge=R[me];if(ge){if(ge!==!0&&re<ge.distanceSq){if(re===0)return R[me]=!0,n.splice(n.lastIndexOf(ge),1),c(z,S,W);ge.geometry=W,ge.distanceSq=re}}else{if(re===0)return R[me]=!0,c(z,S,W);n.push(R[me]={feature:z,layer:S,geometry:W,distanceSq:re,callback:c})}},A=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,x,b,l,E,A?r.declutter[A].all().map(z=>z.value):null)}handleFontsChanged(){let t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){let r=this.getLayer(),l=r.getSource();if(!l)return!1;let c=t.viewHints[Tn.ANIMATING],n=t.viewHints[Tn.INTERACTING],x=r.getUpdateWhileAnimating(),b=r.getUpdateWhileInteracting();if(this.ready&&!x&&c||!b&&n)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let S=t.extent,R=t.viewState,E=R.projection,A=R.resolution,z=t.pixelRatio,W=r.getRevision(),re=r.getRenderBuffer(),me=r.getRenderOrder();me===void 0&&(me=Y1);let ge=R.center.slice(),be=us(S,re*A),ve=be.slice(),De=[be.slice()],ke=E.getExtent();if(l.getWrapX()&&E.canWrapX()&&!Mo(ke,t.extent)){let yt=Ti(ke),xt=Math.max(Ti(be)/2,yt);be[0]=ke[0]-xt,be[2]=ke[2]+xt,Jv(ge,E);let dt=Ug(De[0],E);dt[0]<ke[0]&&dt[2]<ke[2]?De.push([dt[0]+yt,dt[1],dt[2]+yt,dt[3]]):dt[0]>ke[0]&&dt[2]>ke[2]&&De.push([dt[0]-yt,dt[1],dt[2]-yt,dt[3]])}if(this.ready&&this.renderedResolution_==A&&this.renderedRevision_==W&&this.renderedRenderOrder_==me&&this.renderedFrameDeclutter_===!!t.declutter&&Mo(this.wrappedRenderedExtent_,be))return vn(this.renderedExtent_,ve)||(this.hitDetectionImageData_=null,this.renderedExtent_=ve),this.renderedCenter_=ge,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let je=new B1(Gy(A,z),be,A,z),Re=Hn(),tt;if(Re){for(let yt=0,xt=De.length;yt<xt;++yt){let dt=De[yt],St=Zs(dt,E);l.loadFeatures(St,mb(A,E),Re)}tt=Dc(Re,E)}else for(let yt=0,xt=De.length;yt<xt;++yt)l.loadFeatures(De[yt],A,E);let Je=Ny(A,z),He=!0,ot=(yt,xt)=>{let dt,St=yt.getStyleFunction()||r.getStyleFunction();if(St&&(dt=St(yt,A)),dt){let qt=this.renderFeature(yt,Je,dt,je,tt,this.getLayer().getDeclutter(),xt);He=He&&!qt}},vt=Zs(be,E),ct=l.getFeaturesInExtent(vt);me&&ct.sort(me);for(let yt=0,xt=ct.length;yt<xt;++yt)ot(ct[yt],yt);this.renderedFeatures_=ct,this.ready=He;let It=je.finish(),ut=new q1(be,A,z,l.getOverlaps(),It,r.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=A,this.renderedRevision_=W,this.renderedRenderOrder_=me,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=ve,this.wrappedRenderedExtent_=be,this.renderedCenter_=ge,this.renderedProjection_=E,this.renderedPixelRatio_=z,this.replayGroup_=ut,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,r,l,c,n,x,b){if(!l)return!1;let S=!1;if(Array.isArray(l))for(let R=0,E=l.length;R<E;++R)S=Vy(c,t,l[R],r,this.boundHandleStyleImageChange_,n,x,b)||S;else S=Vy(c,t,l,r,this.boundHandleStyleImageChange_,n,x,b);return S}},J1=Uy;var Zy=class extends L1{constructor(t){super(t)}createRenderer(){return new J1(this)}},Yc=Zy;var qy=class{constructor(t){this.rbush_=new Cl(t),this.items_={}}insert(t,r){let l={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:r};this.rbush_.insert(l),this.items_[Gt(r)]=l}load(t,r){let l=new Array(r.length);for(let c=0,n=r.length;c<n;c++){let x=t[c],b=r[c],S={minX:x[0],minY:x[1],maxX:x[2],maxY:x[3],value:b};l[c]=S,this.items_[Gt(b)]=S}this.rbush_.load(l)}remove(t){let r=Gt(t),l=this.items_[r];return delete this.items_[r],this.rbush_.remove(l)!==null}update(t,r){let l=this.items_[Gt(r)],c=[l.minX,l.minY,l.maxX,l.maxY];Jp(c,t)||(this.remove(r),this.insert(t,r))}getAll(){return this.rbush_.all().map(function(r){return r.value})}getInExtent(t){let r={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(r).map(function(c){return c.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,r){return this.forEach_(this.getInExtent(t),r)}forEach_(t,r){let l;for(let c=0,n=t.length;c<n;c++)if(l=r(t[c]),l)return l;return l}isEmpty(){return Xn(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){let r=this.rbush_.toJSON();return Io(r.minX,r.minY,r.maxX,r.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(let r in t.items_)this.items_[r]=t.items_[r]}},yd=qy;var Q1=yr(),xd=class h{constructor(t,r,l,c,n,x){this.styleFunction,this.extent_,this.id_=x,this.type_=t,this.flatCoordinates_=r,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=l||null,this.properties_=n,this.squaredTolerance_,this.stride_=c,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?la(this.flatCoordinates_):Ic(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let t=ds(this.getExtent());this.flatInteriorPoints_=qu(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let t=kb(this.flatCoordinates_,this.ends_),r=yf(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=gf(this.flatCoordinates_,0,t,2,r)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=wl(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let t=this.flatCoordinates_,r=0,l=this.ends_;for(let c=0,n=l.length;c<n;++c){let x=l[c],b=wl(t,r,x,2,.5);Lr(this.flatMidpoints_,b),r=x}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,r){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){t=Ri(t);let r=t.getExtent(),l=t.getWorldExtent();if(r&&l){let c=ar(l)/ar(r);Yr(Q1,l[0],l[3],c,-c,0,0,0),Sn(this.flatCoordinates_,0,this.flatCoordinates_.length,2,Q1,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new h(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=$p((t,r)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),r&&this.simplifiedGeometry_.applyTransform(r);let l=this.simplifiedGeometry_.getFlatCoordinates(),c;switch(this.type_){case"LineString":l.length=bl(l,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,l,0),c=[l.length];break;case"MultiLineString":c=[],l.length=df(l,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,l,0,c);break;case"Polygon":c=[],l.length=Nu(l,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),l,0,c);break;default:}return c&&(this.simplifiedGeometry_=new h(this.type_,l,c,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}};xd.prototype.getFlatCoordinates=xd.prototype.getOrientedFlatCoordinates;var Fs=xd;var Wy=class extends xr{constructor(t){super(),this.projection=Ri(t.projection),this.attributions_=ew(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;let r=this;this.viewPromise_=new Promise(function(l,c){r.viewResolver=l,r.viewRejector=c})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=ew(t),this.changed()}setState(t){this.state_=t,this.changed()}};function ew(h){return h?typeof h=="function"?h:(Array.isArray(h)||(h=[h]),t=>h):null}var Bo=Wy;var Qr={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function tw(h,t){return[[-1/0,-1/0,1/0,1/0]]}var dM=!1;function pM(h,t,r,l,c,n,x){let b=new XMLHttpRequest;b.open("GET",typeof h=="function"?h(r,l,c):h,!0),t.getType()=="arraybuffer"&&(b.responseType="arraybuffer"),b.withCredentials=dM,b.onload=function(S){if(!b.status||b.status>=200&&b.status<300){let R=t.getType();try{let E;R=="text"||R=="json"?E=b.responseText:R=="xml"?E=b.responseXML||b.responseText:R=="arraybuffer"&&(E=b.response),E?n(t.readFeatures(E,{extent:r,featureProjection:c}),t.readProjection(E)):x()}catch{x()}}else x()},b.onerror=x,b.send()}function $y(h,t){return function(r,l,c,n,x){let b=this;pM(h,t,r,l,c,function(S,R){b.addFeatures(S),n!==void 0&&n(S)},x||Ts)}}var Qs=class extends Ei{constructor(t,r,l){super(t),this.feature=r,this.features=l}},Xy=class extends Bo{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:t.wrapX!==void 0?t.wrapX:!0}),this.on,this.once,this.un,this.loader_=Ts,this.format_=t.format||null,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(di(this.format_,"`format` must be set when `url` is set"),this.loader_=$y(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:tw;let r=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=r?new yd:null,this.loadedExtentsRtree_=new yd,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let l,c;Array.isArray(t.features)?c=t.features:t.features&&(l=t.features,c=l.getArray()),!r&&l===void 0&&(l=new Qu(c)),c!==void 0&&this.addFeaturesInternal(c),l!==void 0&&this.bindFeaturesCollection_(l)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){let r=Gt(t);if(!this.addToIndex_(r,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(r,t);let l=t.getGeometry();if(l){let c=l.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(c,t)}else this.nullGeometryFeatures_[r]=t;this.dispatchEvent(new Qs(Qr.ADDFEATURE,t))}setupChangeEvents_(t,r){r instanceof Fs||(this.featureChangeKeys_[t]=[kr(r,gi.CHANGE,this.handleFeatureChange_,this),kr(r,Zp.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,r){let l=!0;if(r.getId()!==void 0){let c=String(r.getId());if(!(c in this.idIndex_))this.idIndex_[c]=r;else if(r instanceof Fs){let n=this.idIndex_[c];n instanceof Fs?Array.isArray(n)?n.push(r):this.idIndex_[c]=[n,r]:l=!1}else l=!1}return l&&(di(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=r),l}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){let r=[],l=[],c=[];for(let n=0,x=t.length;n<x;n++){let b=t[n],S=Gt(b);this.addToIndex_(S,b)&&l.push(b)}for(let n=0,x=l.length;n<x;n++){let b=l[n],S=Gt(b);this.setupChangeEvents_(S,b);let R=b.getGeometry();if(R){let E=R.getExtent();r.push(E),c.push(b)}else this.nullGeometryFeatures_[S]=b}if(this.featuresRtree_&&this.featuresRtree_.load(r,c),this.hasListener(Qr.ADDFEATURE))for(let n=0,x=l.length;n<x;n++)this.dispatchEvent(new Qs(Qr.ADDFEATURE,l[n]))}bindFeaturesCollection_(t){let r=!1;this.addEventListener(Qr.ADDFEATURE,function(l){r||(r=!0,t.push(l.feature),r=!1)}),this.addEventListener(Qr.REMOVEFEATURE,function(l){r||(r=!0,t.remove(l.feature),r=!1)}),t.addEventListener(As.ADD,l=>{r||(r=!0,this.addFeature(l.element),r=!1)}),t.addEventListener(As.REMOVE,l=>{r||(r=!0,this.removeFeature(l.element),r=!1)}),this.featuresCollection_=t}clear(t){if(t){for(let l in this.featureChangeKeys_)this.featureChangeKeys_[l].forEach(Kr);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(l=>{this.removeFeatureInternal(l)});for(let l in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[l])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let r=new Qs(Qr.CLEAR);this.dispatchEvent(r),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,r){let l=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(l,function(c){let n=c.getGeometry();if(n instanceof Fs||n.intersectsCoordinate(t))return r(c)})}forEachFeatureInExtent(t,r){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,r);this.featuresCollection_&&this.featuresCollection_.forEach(r)}forEachFeatureIntersectingExtent(t,r){return this.forEachFeatureInExtent(t,function(l){let c=l.getGeometry();if(c instanceof Fs||c.intersectsExtent(t)){let n=r(l);if(n)return n}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),Xn(this.nullGeometryFeatures_)||Lr(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){let r=[];return this.forEachFeatureAtCoordinateDirect(t,function(l){r.push(l)}),r}getFeaturesInExtent(t,r){if(this.featuresRtree_){if(!(r&&r.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);let c=Gv(t,r);return[].concat(...c.map(n=>this.featuresRtree_.getInExtent(n)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,r){let l=t[0],c=t[1],n=null,x=[NaN,NaN],b=1/0,S=[-1/0,-1/0,1/0,1/0];return r=r||Wp,this.featuresRtree_.forEachInExtent(S,function(R){if(r(R)){let E=R.getGeometry(),A=b;if(b=E instanceof Fs?0:E.closestPointXY(l,c,x,b),b<A){n=R;let z=Math.sqrt(b);S[0]=l-z,S[1]=c-z,S[2]=l+z,S[3]=c+z}}}),n}getExtent(t){return this.featuresRtree_.getExtent(t)}getFeatureById(t){let r=this.idIndex_[t.toString()];return r!==void 0?r:null}getFeatureByUid(t){let r=this.uidIndex_[t];return r!==void 0?r:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){let r=t.target,l=Gt(r),c=r.getGeometry();if(!c)l in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(r),this.nullGeometryFeatures_[l]=r);else{let x=c.getExtent();l in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[l],this.featuresRtree_&&this.featuresRtree_.insert(x,r)):this.featuresRtree_&&this.featuresRtree_.update(x,r)}let n=r.getId();if(n!==void 0){let x=n.toString();this.idIndex_[x]!==r&&(this.removeFromIdIndex_(r),this.idIndex_[x]=r)}else this.removeFromIdIndex_(r),this.uidIndex_[l]=r;this.changed(),this.dispatchEvent(new Qs(Qr.CHANGEFEATURE,r))}hasFeature(t){let r=t.getId();return r!==void 0?r in this.idIndex_:Gt(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Xn(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(t,r,l){let c=this.loadedExtentsRtree_,n=this.strategy_(t,r,l);for(let x=0,b=n.length;x<b;++x){let S=n[x];c.forEachInExtent(S,function(E){return Mo(E.extent,S)})||(++this.loadingExtentsCount_,this.dispatchEvent(new Qs(Qr.FEATURESLOADSTART)),this.loader_.call(this,S,r,l,E=>{--this.loadingExtentsCount_,this.dispatchEvent(new Qs(Qr.FEATURESLOADEND,void 0,E))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Qs(Qr.FEATURESLOADERROR))}),c.insert(S,{extent:S.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){let r=this.loadedExtentsRtree_,l=r.forEachInExtent(t,function(c){if(Jp(c.extent,t))return c});l&&r.remove(l)}removeFeatures(t){let r=!1;for(let l=0,c=t.length;l<c;++l)r=this.removeFeatureInternal(t[l])||r;r&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){let r=Gt(t);if(!(r in this.uidIndex_))return!1;r in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[r]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.featureChangeKeys_[r]?.forEach(Kr),delete this.featureChangeKeys_[r];let c=t.getId();if(c!==void 0){let n=c.toString(),x=this.idIndex_[n];x===t?delete this.idIndex_[n]:Array.isArray(x)&&(x.splice(x.indexOf(t),1),x.length===1&&(this.idIndex_[n]=x[0]))}return delete this.uidIndex_[r],this.hasListener(Qr.REMOVEFEATURE)&&this.dispatchEvent(new Qs(Qr.REMOVEFEATURE,t)),!0}removeFromIdIndex_(t){for(let r in this.idIndex_)if(this.idIndex_[r]===t){delete this.idIndex_[r];break}}setLoader(t){this.loader_=t}setUrl(t){di(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader($y(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}},El=Xy;var Jn={SINGLECLICK:"singleclick",CLICK:gi.CLICK,DBLCLICK:gi.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var Hy={ACTIVE:"active"};var Yy=class extends xr{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Hy.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Hy.ACTIVE,t)}setMap(t){this.map_=t}};var iw=Yy;var Ky=class extends iw{constructor(t){t=t||{},super(t),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let r=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==Jn.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==Jn.POINTERUP){let l=this.handleUpEvent(t);this.handlingDownUpSequence=l&&this.targetPointers.length>0}}else if(t.type==Jn.POINTERDOWN){let l=this.handleDownEvent(t);this.handlingDownUpSequence=l,r=this.stopDown(l)}else t.type==Jn.POINTERMOVE&&this.handleMoveEvent(t);return!r}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}};var rw=Ky;var nw=function(h){let t=h.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey};var sw=Wp,ow=function(h){return h.type==Jn.CLICK};var aw=function(h){return h.type==Jn.SINGLECLICK};var lw=function(h){let t=h.originalEvent;return di(t!==void 0,"mapBrowserEvent must originate from a pointer event"),t.isPrimary&&t.button===0};var Jy=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=gs,this.supportedMediaTypes=null}getReadOptions(t,r){if(r){let l=r.dataProjection?Ri(r.dataProjection):this.readProjection(t);r.extent&&l&&l.getUnits()==="tile-pixels"&&(l=Ri(l),l.setWorldExtent(r.extent)),r={dataProjection:l,featureProjection:r.featureProjection}}return this.adaptOptions(r)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return Tt()}readFeature(t,r){return Tt()}readFeatures(t,r){return Tt()}readGeometry(t,r){return Tt()}readProjection(t){return Tt()}writeFeature(t,r){return Tt()}writeFeatures(t,r){return Tt()}writeGeometry(t,r){return Tt()}},cw=Jy;function Vf(h,t,r){let l=r?Ri(r.featureProjection):null,c=r?Ri(r.dataProjection):null,n=h;if(l&&c&&!fb(l,c)){t&&(n=h.clone());let x=t?l:c,b=t?c:l;x.getUnits()==="tile-pixels"?n.transform(x,b):n.applyTransform(xl(x,b))}if(t&&r&&r.decimals!==void 0){let x=Math.pow(10,r.decimals),b=function(S){for(let R=0,E=S.length;R<E;++R)S[R]=Math.round(S[R]*x)/x;return S};n===h&&(n=h.clone()),n.applyTransform(b)}return n}var fM={Point:br,LineString:Es,Polygon:zc,MultiPoint:Zu,MultiLineString:g_,MultiPolygon:S_};function mM(h,t,r){return Array.isArray(t[0])?(_f(h,0,t,r)||(h=h.slice(),$u(h,0,t,r)),h):(Wu(h,0,t,r)||(h=h.slice(),Fc(h,0,t,r)),h)}function Qy(h,t){let r=h.geometry;if(!r)return[];if(Array.isArray(r))return r.map(n=>Qy({...h,geometry:n})).flat();let l=r.type==="MultiPolygon"?"Polygon":r.type;if(l==="GeometryCollection"||l==="Circle")throw new Error("Unsupported geometry type: "+l);let c=r.layout.length;return Vf(new Fs(l,l==="Polygon"?mM(r.flatCoordinates,r.ends,c):r.flatCoordinates,r.ends?.flat(),c,h.properties||{},h.id).enableSimplifyTransformed(),!1,t)}function Uf(h,t){if(!h)return null;if(Array.isArray(h)){let l=h.map(c=>Uf(c,t));return new l_(l)}let r=fM[h.type];return Vf(new r(h.flatCoordinates,h.layout,h.ends),!1,t)}var e0=class extends cw{constructor(){super()}getType(){return"json"}readFeature(t,r){return this.readFeatureFromObject(Zf(t),this.getReadOptions(t,r))}readFeatures(t,r){return this.readFeaturesFromObject(Zf(t),this.getReadOptions(t,r))}readFeatureFromObject(t,r){return Tt()}readFeaturesFromObject(t,r){return Tt()}readGeometry(t,r){return this.readGeometryFromObject(Zf(t),this.getReadOptions(t,r))}readGeometryFromObject(t,r){return Tt()}readProjection(t){return this.readProjectionFromObject(Zf(t))}readProjectionFromObject(t){return Tt()}writeFeature(t,r){return JSON.stringify(this.writeFeatureObject(t,r))}writeFeatureObject(t,r){return Tt()}writeFeatures(t,r){return JSON.stringify(this.writeFeaturesObject(t,r))}writeFeaturesObject(t,r){return Tt()}writeGeometry(t,r){return JSON.stringify(this.writeGeometryObject(t,r))}writeGeometryObject(t,r){return Tt()}};function Zf(h){if(typeof h=="string"){let t=JSON.parse(h);return t||null}return h!==null?h:null}var hw=e0;var t0=class extends hw{constructor(t){t=t||{},super(),this.dataProjection=Ri(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=Ri(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,r){let l=null;t.type==="Feature"?l=t:l={type:"Feature",geometry:t,properties:null};let c=r0(l.geometry,r);if(this.featureClass===Fs)return Qy({geometry:c,id:l.id,properties:l.properties},r);let n=new gs;return this.geometryName_?n.setGeometryName(this.geometryName_):this.extractGeometryName_&&l.geometry_name&&n.setGeometryName(l.geometry_name),n.setGeometry(Uf(c,r)),"id"in l&&n.setId(l.id),l.properties&&n.setProperties(l.properties,!0),n}readFeaturesFromObject(t,r){let l=t,c=null;if(l.type==="FeatureCollection"){let n=t;c=[];let x=n.features;for(let b=0,S=x.length;b<S;++b){let R=this.readFeatureFromObject(x[b],r);R&&c.push(R)}}else c=[this.readFeatureFromObject(t,r)];return c.flat()}readGeometryFromObject(t,r){return gM(t,r)}readProjectionFromObject(t){let r=t.crs,l;if(r)if(r.type=="name")l=Ri(r.properties.name);else if(r.type==="EPSG")l=Ri("EPSG:"+r.properties.code);else throw new Error("Unknown SRS type");else l=this.dataProjection;return l}writeFeatureObject(t,r){r=this.adaptOptions(r);let l={type:"Feature",geometry:null,properties:null},c=t.getId();if(c!==void 0&&(l.id=c),!t.hasProperties())return l;let n=t.getProperties(),x=t.getGeometry();return x&&(l.geometry=i0(x,r),delete n[t.getGeometryName()]),Xn(n)||(l.properties=n),l}writeFeaturesObject(t,r){r=this.adaptOptions(r);let l=[];for(let c=0,n=t.length;c<n;++c)l.push(this.writeFeatureObject(t[c],r));return{type:"FeatureCollection",features:l}}writeGeometryObject(t,r){return i0(t,this.adaptOptions(r))}};function r0(h,t){if(!h)return null;let r;switch(h.type){case"Point":{r=yM(h);break}case"LineString":{r=xM(h);break}case"Polygon":{r=SM(h);break}case"MultiPoint":{r=bM(h);break}case"MultiLineString":{r=vM(h);break}case"MultiPolygon":{r=wM(h);break}case"GeometryCollection":{r=_M(h);break}default:throw new Error("Unsupported GeoJSON type: "+h.type)}return r}function gM(h,t){let r=r0(h,t);return Uf(r,t)}function _M(h,t){return h.geometries.map(function(l){return r0(l,t)})}function yM(h){let t=h.coordinates;return{type:"Point",flatCoordinates:t,layout:ua(t.length)}}function xM(h){let t=h.coordinates,r=t.flat();return{type:"LineString",flatCoordinates:r,ends:[r.length],layout:ua(t[0]?.length||2)}}function vM(h){let t=h.coordinates,r=t[0]?.[0]?.length||2,l=[],c=da(l,0,t,r);return{type:"MultiLineString",flatCoordinates:l,ends:c,layout:ua(r)}}function bM(h){let t=h.coordinates;return{type:"MultiPoint",flatCoordinates:t.flat(),layout:ua(t[0]?.length||2)}}function wM(h){let t=h.coordinates,r=[],l=t[0]?.[0]?.[0].length||2,c=uf(r,0,t,l);return{type:"MultiPolygon",flatCoordinates:r,ends:c,layout:ua(l)}}function SM(h){let t=h.coordinates,r=[],l=t[0]?.[0]?.length,c=da(r,0,t,l);return{type:"Polygon",flatCoordinates:r,ends:c,layout:ua(l)}}function i0(h,t){h=Vf(h,!0,t);let r=h.getType(),l;switch(r){case"Point":{l=PM(h,t);break}case"LineString":{l=CM(h,t);break}case"Polygon":{l=RM(h,t);break}case"MultiPoint":{l=IM(h,t);break}case"MultiLineString":{l=MM(h,t);break}case"MultiPolygon":{l=EM(h,t);break}case"GeometryCollection":{l=TM(h,t);break}case"Circle":{l={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+r)}return l}function TM(h,t){return t=Object.assign({},t),delete t.featureProjection,{type:"GeometryCollection",geometries:h.getGeometriesArray().map(function(l){return i0(l,t)})}}function CM(h,t){return{type:"LineString",coordinates:h.getCoordinates()}}function MM(h,t){return{type:"MultiLineString",coordinates:h.getCoordinates()}}function IM(h,t){return{type:"MultiPoint",coordinates:h.getCoordinates()}}function EM(h,t){let r;return t&&(r=t.rightHanded),{type:"MultiPolygon",coordinates:h.getCoordinates(r)}}function PM(h,t){return{type:"Point",coordinates:h.getCoordinates()}}function RM(h,t){let r;return t&&(r=t.rightHanded),{type:"Polygon",coordinates:h.getCoordinates(r)}}var Sr=t0;var uw=0,vd=1,dw=[0,0,0,0],Kc=[],n0={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},bd=class extends Ei{constructor(t,r,l){super(t),this.features=r,this.mapBrowserEvent=l}},s0=class extends rw{constructor(t){super(t),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=t.condition?t.condition:lw,this.defaultDeleteCondition_=function(l){return nw(l)&&aw(l)},this.deleteCondition_=t.deleteCondition?t.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=t.insertVertexCondition?t.insertVertexCondition:sw,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new yd,this.pixelTolerance_=t.pixelTolerance!==void 0?t.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new Yc({source:new El({useSpatialIndex:!1,wrapX:!!t.wrapX}),style:t.style?t.style:LM(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.hitDetection_=null;let r;if(t.features?r=t.features:t.source&&(this.source_=t.source,r=new Qu(this.source_.getFeatures()),this.source_.addEventListener(Qr.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(Qr.REMOVEFEATURE,this.handleSourceRemove_.bind(this))),!r)throw new Error("The modify interaction requires features, a source or a layer");t.hitDetection&&(this.hitDetection_=t.hitDetection),this.features_=r,this.features_.forEach(this.addFeature_.bind(this)),this.features_.addEventListener(As.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(As.REMOVE,this.handleFeatureRemove_.bind(this)),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=t.snapToPointer===void 0?!this.hitDetection_:t.snapToPointer}addFeature_(t){let r=t.getGeometry();if(r){let c=this.SEGMENT_WRITERS_[r.getType()];c&&c(t,r)}let l=this.getMap();l&&l.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(l.getCoordinateFromPixel(this.lastPixel_)),t.addEventListener(gi.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(t,r){if(!this.featuresBeingModified_){this.featuresBeingModified_=new Qu;let l=this.featuresBeingModified_.getArray();for(let c=0,n=r.length;c<n;++c){let x=r[c].feature;x&&!l.includes(x)&&this.featuresBeingModified_.push(x)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new bd(n0.MODIFYSTART,this.featuresBeingModified_,t))}}removeFeature_(t){this.removeFeatureSegmentData_(t),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.removeEventListener(gi.CHANGE,this.boundHandleFeatureChange_)}removeFeatureSegmentData_(t){let r=this.rBush_,l=[];r.forEach(function(c){t===c.feature&&l.push(c)});for(let c=l.length-1;c>=0;--c){let n=l[c];for(let x=this.dragSegments_.length-1;x>=0;--x)this.dragSegments_[x][0]===n&&this.dragSegments_.splice(x,1);r.remove(n)}}setActive(t){this.vertexFeature_&&!t&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(t)}setMap(t){this.overlay_.setMap(t),super.setMap(t)}getOverlay(){return this.overlay_}handleSourceAdd_(t){t.feature&&this.features_.push(t.feature)}handleSourceRemove_(t){t.feature&&this.features_.remove(t.feature)}handleFeatureAdd_(t){this.addFeature_(t.element)}handleFeatureChange_(t){if(!this.changingFeature_){let r=t.target;this.removeFeature_(r),this.addFeature_(r)}}handleFeatureRemove_(t){this.removeFeature_(t.element)}writePointGeometry_(t,r){let l=r.getCoordinates(),c={feature:t,geometry:r,segment:[l,l]};this.rBush_.insert(r.getExtent(),c)}writeMultiPointGeometry_(t,r){let l=r.getCoordinates();for(let c=0,n=l.length;c<n;++c){let x=l[c],b={feature:t,geometry:r,depth:[c],index:c,segment:[x,x]};this.rBush_.insert(r.getExtent(),b)}}writeLineStringGeometry_(t,r){let l=r.getCoordinates();for(let c=0,n=l.length-1;c<n;++c){let x=l.slice(c,c+2),b={feature:t,geometry:r,index:c,segment:x};this.rBush_.insert(hs(x),b)}}writeMultiLineStringGeometry_(t,r){let l=r.getCoordinates();for(let c=0,n=l.length;c<n;++c){let x=l[c];for(let b=0,S=x.length-1;b<S;++b){let R=x.slice(b,b+2),E={feature:t,geometry:r,depth:[c],index:b,segment:R};this.rBush_.insert(hs(R),E)}}}writePolygonGeometry_(t,r){let l=r.getCoordinates();for(let c=0,n=l.length;c<n;++c){let x=l[c];for(let b=0,S=x.length-1;b<S;++b){let R=x.slice(b,b+2),E={feature:t,geometry:r,depth:[c],index:b,segment:R};this.rBush_.insert(hs(R),E)}}}writeMultiPolygonGeometry_(t,r){let l=r.getCoordinates();for(let c=0,n=l.length;c<n;++c){let x=l[c];for(let b=0,S=x.length;b<S;++b){let R=x[b];for(let E=0,A=R.length-1;E<A;++E){let z=R.slice(E,E+2),W={feature:t,geometry:r,depth:[b,c],index:E,segment:z};this.rBush_.insert(hs(z),W)}}}}writeCircleGeometry_(t,r){let l=r.getCenter(),c={feature:t,geometry:r,index:uw,segment:[l,l]},n={feature:t,geometry:r,index:vd,segment:[l,l]},x=[c,n];c.featureSegments=x,n.featureSegments=x,this.rBush_.insert(la(l),c);let b=r,S=Hn();if(S&&this.getMap()){let R=this.getMap().getView().getProjection();b=b.clone().transform(S,R),b=b_(b).transform(R,S)}this.rBush_.insert(b.getExtent(),n)}writeGeometryCollectionGeometry_(t,r){let l=r.getGeometriesArray();for(let c=0;c<l.length;++c){let n=l[c],x=this.SEGMENT_WRITERS_[n.getType()];x(t,n)}}createOrUpdateVertexFeature_(t,r,l,c){let n=this.vertexFeature_;return n?n.getGeometry().setCoordinates(t):(n=new gs(new br(t)),this.vertexFeature_=n,this.overlay_.getSource().addFeature(n)),n.set("features",r),n.set("geometries",l),n.set("existing",c),n}handleEvent(t){if(!t.originalEvent)return!0;this.lastPointerEvent_=t;let r;return!t.map.getView().getInteracting()&&t.type==Jn.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(t),this.vertexFeature_&&this.deleteCondition_(t)&&(t.type!=Jn.SINGLECLICK||!this.ignoreNextSingleClick_?r=this.removePoint():r=!0),t.type==Jn.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),super.handleEvent(t)&&!r}findInsertVerticesAndUpdateDragSegments_(t){this.handlePointerAtPixel_(t),this.dragSegments_.length=0,this.featuresBeingModified_=null;let r=this.vertexFeature_;if(!r)return;let l=this.getMap().getView().getProjection(),c=[],n=r.getGeometry().getCoordinates(),x=hs([n]),b=this.rBush_.getInExtent(x),S={};b.sort(AM);for(let R=0,E=b.length;R<E;++R){let A=b[R],z=A.segment,W=Gt(A.geometry),re=A.depth;if(re&&(W+="-"+re.join("-")),S[W]||(S[W]=new Array(2)),A.geometry.getType()==="Circle"&&A.index===vd){let me=fw(t,A,l);lr(me,n)&&!S[W][0]&&(this.dragSegments_.push([A,0]),S[W][0]=A);continue}if(lr(z[0],n)&&!S[W][0]){this.dragSegments_.push([A,0]),S[W][0]=A;continue}if(lr(z[1],n)&&!S[W][1]){if(S[W][0]&&S[W][0].index===0){let me=A.geometry.getCoordinates();switch(A.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":me=me[re[1]];case"Polygon":if(A.index!==me[re[0]].length-2)continue;break;default:}}this.dragSegments_.push([A,1]),S[W][1]=A;continue}Gt(z)in this.vertexSegments_&&!S[W][0]&&!S[W][1]&&c.push(A)}return c}handleDragEvent(t){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(t,this.dragSegments_.map(([n])=>n));let r=[t.coordinate[0]+this.delta_[0],t.coordinate[1]+this.delta_[1]],l=[],c=[];for(let n=0,x=this.dragSegments_.length;n<x;++n){let b=this.dragSegments_[n],S=b[0],R=S.feature;l.includes(R)||l.push(R);let E=S.geometry;c.includes(E)||c.push(E);let A=S.depth,z,W=S.segment,re=b[1];for(;r.length<E.getStride();)r.push(W[re][r.length]);switch(E.getType()){case"Point":z=r,W[0]=r,W[1]=r;break;case"MultiPoint":z=E.getCoordinates(),z[S.index]=r,W[0]=r,W[1]=r;break;case"LineString":z=E.getCoordinates(),z[S.index+re]=r,W[re]=r;break;case"MultiLineString":z=E.getCoordinates(),z[A[0]][S.index+re]=r,W[re]=r;break;case"Polygon":z=E.getCoordinates(),z[A[0]][S.index+re]=r,W[re]=r;break;case"MultiPolygon":z=E.getCoordinates(),z[A[1]][A[0]][S.index+re]=r,W[re]=r;break;case"Circle":let me=E;if(W[0]=r,W[1]=r,S.index===uw)this.changingFeature_=!0,me.setCenter(r),this.changingFeature_=!1;else{this.changingFeature_=!0;let ge=t.map.getView().getProjection(),be=Hg(Di(me.getCenter(),ge),Di(r,ge)),ve=Hn();if(ve){let De=me.clone().transform(ve,ge);De.setRadius(be),be=De.transform(ge,ve).getRadius()}me.setRadius(be),this.changingFeature_=!1}break;default:}z&&this.setGeometryCoordinates_(E,z)}this.createOrUpdateVertexFeature_(r,l,c,!0)}handleDownEvent(t){if(!this.condition_(t))return!1;let r=t.coordinate,l=this.findInsertVerticesAndUpdateDragSegments_(r);if(l?.length&&this.insertVertexCondition_(t)&&(this.willModifyFeatures_(t,l),this.vertexFeature_)){let c=this.vertexFeature_.getGeometry().getCoordinates();for(let n=l.length-1;n>=0;--n)this.insertVertex_(l[n],c);this.ignoreNextSingleClick_=!0}return!!this.vertexFeature_}handleUpEvent(t){for(let r=this.dragSegments_.length-1;r>=0;--r){let l=this.dragSegments_[r][0],c=l.geometry;if(c.getType()==="Circle"){let n=c,x=n.getCenter(),b=l.featureSegments[0],S=l.featureSegments[1];b.segment[0]=x,b.segment[1]=x,S.segment[0]=x,S.segment[1]=x,this.rBush_.update(la(x),b);let R=n,E=Hn();if(E){let A=t.map.getView().getProjection();R=R.clone().transform(E,A),R=b_(R).transform(A,E)}this.rBush_.update(R.getExtent(),S)}else this.rBush_.update(hs(l.segment),l)}return this.featuresBeingModified_&&(this.dispatchEvent(new bd(n0.MODIFYEND,this.featuresBeingModified_,t)),this.featuresBeingModified_=null),!1}handlePointerMove_(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.coordinate)}handlePointerAtPixel_(t){let r=this.getMap(),l=r.getPixelFromCoordinate(t),c=r.getView().getProjection(),n=function(S,R){return pw(t,S,c)-pw(t,R,c)},x,b;if(this.hitDetection_){let S=typeof this.hitDetection_=="object"?R=>R===this.hitDetection_:void 0;r.forEachFeatureAtPixel(l,(R,E,A)=>{A&&A.getType()==="Point"&&(A=new br(ha(A.getCoordinates(),c)));let z=A||R.getGeometry();if(z&&z.getType()==="Point"&&R instanceof gs&&this.features_.getArray().includes(R)){b=z;let W=R.getGeometry().getFlatCoordinates().slice(0,2);x=[{feature:R,geometry:b,segment:[W,W]}]}return!0},{layerFilter:S})}if(!x){let S=qs(la(t,dw),c),R=r.getView().getResolution()*this.pixelTolerance_,E=Zs(us(S,R,dw),c);x=this.rBush_.getInExtent(E)}if(x&&x.length>0){let S=x.sort(n)[0],R=S.segment,E=fw(t,S,c),A=r.getPixelFromCoordinate(E),z=Hg(l,A);if(b||z<=this.pixelTolerance_){let W={};if(W[Gt(R)]=!0,this.snapToPointer_||(this.delta_[0]=E[0]-t[0],this.delta_[1]=E[1]-t[1]),S.geometry.getType()==="Circle"&&S.index===vd)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(E,[S.feature],[S.geometry],this.snappedToVertex_);else{let re=r.getPixelFromCoordinate(R[0]),me=r.getPixelFromCoordinate(R[1]),ge=Lc(A,re),be=Lc(A,me);z=Math.sqrt(Math.min(ge,be)),this.snappedToVertex_=z<=this.pixelTolerance_,this.snappedToVertex_&&(E=ge>be?R[1]:R[0]),this.createOrUpdateVertexFeature_(E,[S.feature],[S.geometry],this.snappedToVertex_);let ve={};ve[Gt(S.geometry)]=!0;for(let De=1,ke=x.length;De<ke;++De){let je=x[De].segment;if(lr(R[0],je[0])&&lr(R[1],je[1])||lr(R[0],je[1])&&lr(R[1],je[0])){let Re=Gt(x[De].geometry);Re in ve||(ve[Re]=!0,W[Gt(je)]=!0)}else break}}this.vertexSegments_=W;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}insertVertex_(t,r){let l=t.segment,c=t.feature,n=t.geometry,x=t.depth,b=t.index,S;for(;r.length<n.getStride();)r.push(0);switch(n.getType()){case"MultiLineString":S=n.getCoordinates(),S[x[0]].splice(b+1,0,r);break;case"Polygon":S=n.getCoordinates(),S[x[0]].splice(b+1,0,r);break;case"MultiPolygon":S=n.getCoordinates(),S[x[1]][x[0]].splice(b+1,0,r);break;case"LineString":S=n.getCoordinates(),S.splice(b+1,0,r);break;default:return!1}this.setGeometryCoordinates_(n,S);let R=this.rBush_;R.remove(t),this.updateSegmentIndices_(n,b,x,1);let E={segment:[l[0],r],feature:c,geometry:n,depth:x,index:b};R.insert(hs(E.segment),E),this.dragSegments_.push([E,1]);let A={segment:[r,l[1]],feature:c,geometry:n,depth:x,index:b+1};return R.insert(hs(A.segment),A),this.dragSegments_.push([A,0]),!0}updatePointer_(t){return t&&this.findInsertVerticesAndUpdateDragSegments_(t),this.vertexFeature_?.getGeometry().getCoordinates()}getPoint(){let t=this.vertexFeature_?.getGeometry().getCoordinates();return t?ha(t,this.getMap().getView().getProjection()):null}canRemovePoint(){if(!this.vertexFeature_||this.vertexFeature_.get("geometries").every(l=>l.getType()==="Circle"||l.getType().endsWith("Point")))return!1;let t=this.vertexFeature_.getGeometry().getCoordinates();return this.rBush_.getInExtent(hs([t])).some(({segment:l})=>lr(l[0],t)||lr(l[1],t))}removePoint(t){if(t&&(t=Di(t,this.getMap().getView().getProjection()),this.updatePointer_(t)),!this.lastPointerEvent_||this.lastPointerEvent_&&this.lastPointerEvent_.type!=Jn.POINTERDRAG){let r=this.lastPointerEvent_;this.willModifyFeatures_(r,this.dragSegments_.map(([c])=>c));let l=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new bd(n0.MODIFYEND,this.featuresBeingModified_,r)),this.featuresBeingModified_=null,l}return!1}removeVertex_(){let t=this.dragSegments_,r={},l=!1,c,n,x,b,S,R,E,A,z,W,re;for(S=t.length-1;S>=0;--S)x=t[S],W=x[0],re=Gt(W.feature),W.depth&&(re+="-"+W.depth.join("-")),re in r||(r[re]={}),x[1]===0?(r[re].right=W,r[re].index=W.index):x[1]==1&&(r[re].left=W,r[re].index=W.index+1);for(re in r){switch(z=r[re].right,E=r[re].left,R=r[re].index,A=R-1,E!==void 0?W=E:W=z,A<0&&(A=0),b=W.geometry,n=b.getCoordinates(),c=n,l=!1,b.getType()){case"MultiLineString":n[W.depth[0]].length>2&&(n[W.depth[0]].splice(R,1),l=!0);break;case"LineString":n.length>2&&(n.splice(R,1),l=!0);break;case"MultiPolygon":c=c[W.depth[1]];case"Polygon":c=c[W.depth[0]],c.length>4&&(R==c.length-1&&(R=0),c.splice(R,1),l=!0,R===0&&(c.pop(),c.push(c[0]),A=c.length-1));break;default:}if(l){this.setGeometryCoordinates_(b,n);let me=[];if(E!==void 0&&(this.rBush_.remove(E),me.push(E.segment[0])),z!==void 0&&(this.rBush_.remove(z),me.push(z.segment[1])),E!==void 0&&z!==void 0){let ge={depth:W.depth,feature:W.feature,geometry:W.geometry,index:A,segment:me};this.rBush_.insert(hs(ge.segment),ge)}this.updateSegmentIndices_(b,R,W.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.length=0}}return l}canInsertPoint(){if(!this.vertexFeature_||this.vertexFeature_.get("geometries").every(l=>l.getType()==="Circle"||l.getType().endsWith("Point")))return!1;let t=this.vertexFeature_.getGeometry().getCoordinates();return this.rBush_.getInExtent(hs([t])).some(({segment:l})=>!(lr(l[0],t)||lr(l[1],t)))}insertPoint(t){let r=t?Di(t,this.getMap().getView().getProjection()):this.vertexFeature_?.getGeometry().getCoordinates();return r?this.findInsertVerticesAndUpdateDragSegments_(r).reduce((c,n)=>c||this.insertVertex_(n,r),!1):!1}setGeometryCoordinates_(t,r){this.changingFeature_=!0,t.setCoordinates(r),this.changingFeature_=!1}updateSegmentIndices_(t,r,l,c){this.rBush_.forEachInExtent(t.getExtent(),function(n){n.geometry===t&&(l===void 0||n.depth===void 0||vn(n.depth,l))&&n.index>r&&(n.index+=c)})}};function AM(h,t){return h.index-t.index}function pw(h,t,r){let l=t.geometry;if(l.getType()==="Circle"){let n=l;if(t.index===vd){let x=Hn();x&&(n=n.clone().transform(x,r));let b=Lc(n.getCenter(),Di(h,r)),S=Math.sqrt(b)-n.getRadius();return S*S}}let c=Di(h,r);return Kc[0]=Di(t.segment[0],r),Kc[1]=Di(t.segment[1],r),Kv(c,Kc)}function fw(h,t,r){let l=t.geometry;if(l.getType()==="Circle"&&t.index===vd){let n=l,x=Hn();return x&&(n=n.clone().transform(x,r)),ha(n.getClosestPoint(Di(h,r)),r)}let c=Di(h,r);return Kc[0]=Di(t.segment[0],r),Kc[1]=Di(t.segment[1],r),ha(Xg(c,Kc),r)}function LM(){let h=g1();return function(t,r){return h.Point}}var o0=s0;var kM=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,mw=/^([\d.]+),([\d.]+)$/,gw=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,qf="stop-fetch",_w=h=>{let t=[];return h.forEach(r=>{let l=r.getGeometry()?.getCoordinates();l?.length&&t.push(...l)}),t},a0=class h extends jc{constructor(r={}){super(r);this.abortControllers={};this.cacheStationData={};this.format=new Sr({featureProjection:"EPSG:3857"});this.graphs=[];this.initialRouteDrag={};this.segments=[];this.snapToClosestStation=!1;this.useRawViaPoints=!1;this.viaPoints=[];this.element||this.createDefaultElement(),this.loading=!1,this.active=r.active||!0,this.graphs=r.graphs||[["osm",0,99]],this.mot=r.mot||"bus",this.modify=r.modify!==!1,this.apiParams=r.apiParams,this.useRawViaPoints=r.useRawViaPoints||!1,this.snapToClosestStation=r.snapToClosestStation||!1,this.apiKey=r.apiKey,this.stopsApiKey=r.stopsApiKey||this.apiKey,this.stopsApiUrl=r.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new Iu({...r}),this.routingLayer=r.routingLayer||new Yc({source:new El,style:r.style}),this.onRouteError=r.onRouteError||(l=>{this.dispatchEvent(new Ei("change:route")),this.reset(),console.error(l)}),this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.createModifyInteraction(),this.on("propertychange",l=>{l.key==="active"&&this.onActiveChange(),l.key==="mot"&&this.viaPoints&&this.drawRoute()})}static getGraphsResolutions(r,l){let c=l.getView();return r.map(([,n,x])=>[c.getResolutionForZoom(n),c.getResolutionForZoom(x||n+1)])}abortRequests(){this.graphs.forEach(r=>{let l=r[0];this.abortControllers[l]&&this.abortControllers[l].abort(),this.abortControllers[l]=new AbortController}),this.abortControllers[qf]?.abort(),this.abortControllers[qf]=new AbortController,this.loading=!1}activate(){let r=this.getMap();r&&(this.format=new Sr({featureProjection:r.getView().getProjection()}),this.graphsResolutions=h.getGraphsResolutions(this.graphs,r),this.modifyInteraction&&r.removeInteraction(this.modifyInteraction),this.modifyInteraction&&r.addInteraction(this.modifyInteraction),this.modifyInteraction?.setActive(this.modify),this.addListeners())}addListeners(){this.modify&&(this.removeListeners(),this.onMapClickKey=this.getMap()?.on("singleclick",this.onMapClick))}addViaPoint(r,l=-1,c=0){this.viaPoints.splice(l===-1?this.viaPoints.length:l,c,r),this.drawRoute(),this.dispatchEvent(new Ei("change:route"))}createDefaultElement(){this.element=document.createElement("button"),this.element.id="ol-toggle-routing",this.element.innerHTML="Toggle Route Control",this.element.onclick=()=>this.active?this.deactivate():this.activate(),Object.assign(this.element.style,{position:"absolute",right:"10px",top:"10px"})}createModifyInteraction(){this.modifyInteraction=new o0({deleteCondition:r=>{let c=(r.target?.getFeaturesAtPixel(r.pixel,{hitTolerance:5})||[]).find(n=>n.getGeometry()?.getType()==="Point"&&n.get("index"));return ow(r)&&c?(this.removeViaPoint(c.get("index")),!0):!1},pixelTolerance:6,source:this.routingLayer?.getSource()||void 0}),this.modifyInteraction.on("modifystart",this.onModifyStart),this.modifyInteraction.on("modifyend",this.onModifyEnd),this.modifyInteraction.setActive(!1)}deactivate(){let r=this.getMap();r&&(this.modifyInteraction&&r.removeInteraction(this.modifyInteraction),this.removeListeners(),this.reset())}drawRoute(){if(this.abortRequests(),this.routingLayer?.getSource()?.clear(),!this.viaPoints.length)return null;if(this.viaPoints.length===1)return this.drawViaPoint(this.viaPoints[0],0,this.abortControllers[qf]);let r=this.viaPoints.map(l=>{if(Array.isArray(l)){let c=this.getMap()?.getView().getProjection(),[n,x]=yl(l,c);return this.snapToClosestStation?[`@${x}`,n]:[x,n]}return this.useRawViaPoints?l:`!${l}`});return this.loading=!0,this.viaPoints.forEach((l,c)=>{this.drawViaPoint(l,c,this.abortControllers[qf])}),Promise.all(this.graphs.map(([l],c)=>{let{signal:n}=this.abortControllers[l];return this.api?this.api.route({"coord-punish":1e3,"coord-radius":100,elevation:!1,graph:l,mot:this.mot,"resolve-hops":!1,via:`${r.join("|")}`,...this.apiParams||{}},{signal:n}).then(x=>{if(this.segments=this.format.readFeatures(x),this.mot==="foot"){let R=this.segments.reduce((E,A)=>{let z=A.get("trg");return E.find(W=>W[0]===z[0]&&W[1]===z[1])?E:[...E,z]},[]);this.segments=R.map(E=>{let A=this.segments.filter(W=>{let re=W.get("trg");return re[0]===E[0]&&re[1]===E[1]}),z=_w(A);return new gs({geometry:new Es(z)})})}let b=_w(this.segments),S=new gs({geometry:new Es(b)});S.set("graph",l),S.set("mot",this.mot),this.graphsResolutions&&this.graphsResolutions[c]?.length>=2&&(S.set("minResolution",this.graphsResolutions[c][0]),S.set("maxResolution",this.graphsResolutions[c][1])),this.routingLayer?.getSource()?.addFeature(S),this.loading=!1}).catch(x=>{/AbortError/.test(x.name)||(this.segments=[],this.dispatchEvent(new Ei("error")),this.onRouteError(x,this),this.loading=!1)}):Promise.resolve([])}))}drawViaPoint(r,l,c){let n=new gs;if(n.set("viaPointIdx",l),Array.isArray(r))return n.setGeometry(new br(r)),this.routingLayer?.getSource()?.addFeature(n),Promise.resolve(n);if(!this.useRawViaPoints||gw.test(r)){let E,A;return this.useRawViaPoints?[,E,,A]=gw.exec(r)||[]:[E,A]=r.split("$"),fetch(`${this.stopsApiUrl}lookup/${E}?key=${this.stopsApiKey}`,{signal:c.signal}).then(z=>z.json()).then(z=>{let{coordinates:W}=z?.features?.[0]?.geometry||{};return W||console.log("No coordinates found for station "+E,z),this.cacheStationData[r]=vr(W),n.set("viaPointTrack",A),n.setGeometry(new br(vr(W))),this.routingLayer?.getSource()?.addFeature(n),n}).catch(z=>{/AbortError/.test(z.message)||(this.dispatchEvent(new Ei("error")),this.onRouteError(z,this),this.routingLayer?.getSource()?.clear(),this.loading=!1)})}if(this.useRawViaPoints&&mw.test(r)){let[E,A]=mw.exec(r)||[];if(A&&E){let z=parseFloat(A),W=parseFloat(E),re=vr([z,W],this.getMap()?.getView().getProjection());return n.setGeometry(new br(re)),this.routingLayer?.getSource()?.addFeature(n),Promise.resolve(n)}}let[,x,,b,S,,R]=kM.exec(r)||[];if(S&&b){let E=vr([parseFloat(S),parseFloat(b)],this.getMap()?.getView().getProjection());return n.set("viaPointTrack",R),n.setGeometry(new br(E)),this.routingLayer?.getSource()?.addFeature(n),Promise.resolve(n)}return x?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${x}&limit=1`,{signal:c.signal}).then(E=>E.json()).then(E=>{let{coordinates:A}=E.features[0].geometry;return this.cacheStationData[r]=vr(A),n.set("viaPointTrack",R),n.setGeometry(new br(vr(A))),this.routingLayer?.getSource()?.addFeature(n),n}).catch(E=>(this.dispatchEvent(new Ei("error")),this.onRouteError(E,this),this.loading=!1,null)):Promise.resolve(null)}onActiveChange(){this.get("active")?this.activate():this.deactivate(),this.render()}onMapClick(r){let c=r.target.getFeaturesAtPixel(r.pixel,{hitTolerance:5,layerFilter:n=>n===this.routingLayer}).find(n=>n.getGeometry()?.getType()==="Point"&&n.get("viaPointIdx")!==void 0);if(c){this.removeViaPoint(c.get("viaPointIdx"));return}this.addViaPoint(r.coordinate)}onModifyEnd(r){let l=r.mapBrowserEvent.coordinate,{oldRoute:c,segmentIndex:n,viaPoint:x}=this.initialRouteDrag||{};return x?this.addViaPoint(l,x.get("viaPointIdx"),1):c?n===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(l,(n||0)+1):this.addViaPoint(l,0,1)}onModifyStart(r){let l=-1,c=r.features.getArray().find(x=>x.getGeometry()?.getType()==="LineString");if(c?.getGeometry()&&r.mapBrowserEvent.coordinate){let x=us(new br(c.getGeometry()?.getClosestPoint(r.mapBrowserEvent.coordinate)).getExtent(),.001);l=this.segments.findIndex(b=>b.getGeometry()?.intersectsExtent(x))}let n=(r.features.getArray().filter(x=>x.getGeometry()?.getType()==="Point")||[])[0];this.initialRouteDrag={oldRoute:c?.clone(),segmentIndex:l,viaPoint:n}}removeListeners(){this.onMapClickKey&&Cs(this.onMapClickKey)}removeViaPoint(r=(this.viaPoints||[]).length-1){this.viaPoints.length&&this.viaPoints[r]&&this.viaPoints.splice(r,1),this.drawRoute(),this.dispatchEvent(new Ei("change:route"))}render(){}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer?.getSource()?.clear(),this.dispatchEvent(new Ei("change:route"))}setMap(r){super.setMap(r),r&&this.active?this.activate():r||(this.active=!1)}setViaPoints(r){this.viaPoints=[...r],this.drawRoute(),this.dispatchEvent(new Ei("change:route"))}get active(){return this.get("active")}set active(r){this.set("active",r)}get loading(){return this.get("loading")}set loading(r){this.set("loading",r)}get modify(){return this.get("modify")}set modify(r){this.set("modify",r)}get mot(){return this.get("mot")}set mot(r){this.set("mot",r)}},yw=a0;var l0=class{constructor(t){let{apiKey:r,apiParams:l,placeholder:c,url:n}=t||{};this.apiParams={limit:20,...l||{}},this.placeholder=c||"Search for a stop...";let x={apiKey:r};n&&(x.url=n),this.api=new Eu(x),this.abortController=new AbortController,this.createElement(t),this.options=t}clear(){!this.suggestionsElt||!this.inputElt||!this.clearElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}createElement({element:t}){this.inputElt=document.createElement("input"),this.inputElt.type="text",this.inputElt.placeholder=this.placeholder,this.inputElt.autocomplete="off",this.inputElt.onkeyup=r=>{this.abortController?.abort(),this.abortController=new AbortController,this.search(r.target.value,this.abortController)},Object.assign(this.inputElt.style,{padding:"10px 30px 10px 10px"}),t.appendChild(this.inputElt),this.suggestionsElt=document.createElement("div"),Object.assign(this.suggestionsElt.style,{backgroundColor:"white",cursor:"pointer",overflowY:"auto"}),t.appendChild(this.suggestionsElt),this.clearElt=document.createElement("div"),Object.assign(this.clearElt.style,{cursor:"pointer",display:"none",fontSize:"200%",padding:"0 10px",position:"absolute",right:"0"}),this.clearElt.innerHTML="\xD7",this.clearElt.onclick=()=>this.clear(),t.appendChild(this.clearElt)}render(t){let r=t?.features||[];this.suggestionsElt&&(this.suggestionsElt.style.display=r.length?"block":"none",this.suggestionsElt.innerHTML="",r.forEach(l=>{let c=document.createElement("div");c.innerHTML=l?.properties?.name,c.onclick=n=>{this.options?.onSuggestionClick?.(l,n)},Object.assign(c.style,{padding:"5px 12px"}),this.suggestionsElt?.appendChild(c)}))}search(t,r){return(t!==void 0||t!==null)&&(this.apiParams.q=t),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,r&&{signal:r.signal}).then(l=>{this.render(l)}).catch(()=>{this.render()})}},xw=l0;var DM=()=>{let h=document.createElement("div");return Object.assign(h.style,{position:"absolute",top:0,left:"50px",margin:"10px",display:"flex",flexDirection:"column",width:"320px",maxHeight:"90%"}),h},vw=DM;var c0=class extends jc{constructor(t){let r=vw();r.className=t?.className||"mbt-stop-finder";let l={element:r,...t||{}};super(l),this.controller=new xw({onSuggestionClick:this.onSuggestionClick.bind(this),...l})}onSuggestionClick(t){let r=vr(t.geometry.coordinates);this.getMap()?.getView().setCenter(r)}search(t,r){return this.controller.search(t,r)}},bw=c0;var Mw=Us(Pl());var Cw=Us(Pl()),Oi=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(Oi=(0,Cw.default)(h=>{console.warn(h)},1e3));var JM=(h,t)=>{(t||[]).forEach(r=>{r.set("parent",void 0)}),(h.get("children")||[]).forEach(r=>{r.set("parent",void 0)})},QM=(h,t)=>{t.properties&&(Oi("Deprecated. Don't use properties options. Pass the values directly in options object."),h.setProperties(t.properties)),h.on("propertychange",r=>{if(r.key==="children"&&JM(r.target,r.oldValue),r.key==="map"){let l=r.target.get(r.key);l?(r.target.get("children")||[]).forEach(c=>{l.addLayer(c)}):r.oldValue&&(r.target.get("children")||[]).forEach(c=>{r.oldValue.removeLayer(c)})}}),h.set("options",t),h.set("children",t.children||[]),Object.defineProperties(h,{children:{get:()=>(Oi("Layer.children is deprecated. Use the Layer.get('children') method instead."),h.get("children")||[]),set:r=>{Oi("Layer.children is deprecated. Use the Layer.set('children', children) method instead."),h.set("children",r||[])}},copyrights:{get:()=>(Oi("Layer.copyrights is deprecated. Get the attributions from the source object"),h.get("copyrights")),set:r=>{Oi("Layer.copyrights is deprecated. Set the attributions to the source object.");let l=r&&!Array.isArray(r)?[r]:r;h.set("copyrights",l||[])}},disabled:{get(){return Oi("Layer.disabled is deprecated. Use the Layer.get('disabled') method instead."),h.get("disabled")},set(r){Oi("Layer.disabled is deprecated. Use the Layer.set('disabled', newValue) method instead."),h.set("disabled",r)}},group:{get(){return Oi("Layer.group is deprecated. Use the Layer.get('group') method instead."),h.get("group")}},hitTolerance:{get(){return Oi("Layer.hitTolerance is deprecated. Pass the hitTolerance when you request the features."),h.get("hitTolerance")||5},set(r){Oi("Layer.hitTolerance is deprecated. Pass the hitTolerance when you request the features."),h.set("hitTolerance",r)}},key:{get(){return Oi('Layer.key is deprecated. Use the Layer.get("key") method instead.'),h.get("key")||h.get("name")}},map:{get(){return Oi('Layer.map is deprecated. Use the Layer.get("map") method instead.'),h.getMapInternal()}},name:{get(){return Oi("Layer.name is deprecated. Use the Layer.get('name') method instead."),h.get("name")}},olLayer:{get(){return Oi("Layer.olLayer is deprecated. mobility-toolbox-js/ol layers inherits now from ol/layer/Layer class. obj getter is only a redirect to the current 'this' object."),h},set(){Oi("Layer.olLayer is deprecated. mobility-toolbox-js/ol layers inherits now from ol/layer/Layer class. obj setter has no effect.")}},options:{get(){return Oi('Layer.options is deprecated. Use the Layer.get("options") method instead.'),h.get("options")},set(r){return Oi('Layer.options is deprecated. Use the Layer.set("options", newValue) method instead.'),h.set("options",r)}},parent:{get(){return Oi("Layer.parent is deprecated. Use the Layer.get('parent') method instead."),h.get("parent")},set(r){Oi("Layer.parent is deprecated. Use the Layer.set('parent', parent) method instead."),h.set("parent",r)}},visible:{get(){return Oi("Layer.visible is deprecated. Use the Layer.getVisible() method instead."),h.getVisible()},set(r){Oi("Layer.visible is deprecated. Use the Layer.setVisible(newValue) method instead."),h.setVisible(r)}}})},Ca=QM;var Iw=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(Iw=(0,Mw.default)(h=>{console.warn(h)},1e3));var d0=class extends wa{prepareFrame(){return!0}renderFrame(){return null}},p0=class h extends Rs{constructor(t){super(t),Ca(this,t),Iw("Layer is deprecated. Use an OpenLayers Layer instead.")}clone(t){return new h({...this.get("options")||{},...t||{}})}createRenderer(){return new d0(this)}},Wf=p0;var Pw=Us(g0(),1);var eI="vectorTileFeature",_0={"EPSG:3857":new Sr({featureProjection:"EPSG:3857"})},Ma=class extends wa{translateZoom;constructor(t,r){super(t),this.translateZoom=r}getFeaturesAtCoordinate(t,r=5){let l=this.getMapLibrePixels(t,r);if(!l)return[];let c=this.getLayer().get("queryRenderedFeaturesOptions")||{};return this.getLayer().mapLibreMap?.queryRenderedFeatures(l,c).map(x=>this.toOlFeature(x))||[]}prepareFrame(){return!0}renderFrame(t){let r=this.getLayer(),{mapLibreMap:l}=r,c=r.getMapInternal();if(!r||!c||!l)return null;let n=l.getCanvas(),{viewState:x}=t;l.jumpTo({center:yl(x.center,x.projection),zoom:(this.translateZoom?this.translateZoom(x.zoom):x.zoom)-1,bearing:Fu(-x.rotation)});let b=r.getOpacity().toString();return n&&b!==n.style.opacity&&(n.style.opacity=b),n.isConnected?tI(n,t)||l.resize():c.render(),l.redraw(),l.getContainer()}getFeatures(t){let r=this.getLayer().getMapInternal()?.getCoordinateFromPixel(t);return Promise.resolve(this.getFeaturesAtCoordinate(r))}forEachFeatureAtCoordinate(t,r,l,c){let n=this.getFeaturesAtCoordinate(t,l);return n.forEach(x=>{let b=x.getGeometry();b instanceof Fr&&c(x,this.getLayer(),b)}),n?.[0]}getMapLibrePixels(t,r){if(!t)return;let l=this.getLayer().mapLibreMap?.project(yl(t));if(l?.x===void 0||l?.y===void 0)return;let c=[l.x,l.y];if(r){let[n,x]=c;c=[[n-r,x-r],[n+r,x+r]]}return c}toOlFeature(t){let c=this.getLayer().getMapInternal()?.getView()?.getProjection()?.getCode()||"EPSG:3857";_0[c]||(_0[c]=new Sr({featureProjection:c}));let n=_0[c].readFeature(t);return n&&n.set(eI,t,!0),n}};function tI(h,t){return h.width===Math.floor(t.size[0]*t.pixelRatio)&&h.height===Math.floor(t.size[1]*t.pixelRatio)}var iI=h=>{if(!h)return[];let{style:t}=h;if(!t)return[];let{sourceCaches:r}=t,l=[];return Object.values(r).forEach(c=>{if(c.used){let{attribution:n}=c.getSource();n&&(l=l.concat(n.replace(/&copy;/g,"\xA9").split(/(<a.*?<\/a>)/)))}}),rI(l)},rI=h=>{let t=h.filter(c=>c!=null&&c.trim&&c.trim()),r=t.map(c=>c.toLowerCase());return[...new Set(r)].map(c=>t.find(n=>n.toLowerCase()===c))},y0=iI;var Jc=class extends Rs{mapLibreMap;loaded=!1;olListenersKeys=[];constructor(t){super({source:new Bo({attributions:()=>y0(this.mapLibreMap)}),...t})}disposeInternal(){Cs(this.olListenersKeys),this.loaded=!1,this.mapLibreMap&&(this.mapLibreMap.triggerRepaint=()=>{},this.mapLibreMap.remove()),super.disposeInternal()}setMapInternal(t){super.setMapInternal(t),t?this.loadMapLibreMap():this.dispose()}loadMapLibreMap(){this.loaded=!1;let t=this.getMapInternal();if(t&&this.olListenersKeys.push(t.on("change:target",this.loadMapLibreMap.bind(this))),!t?.getTargetElement())return;if(!this.getVisible()){this.olListenersKeys.push(this.once("change:visible",this.loadMapLibreMap.bind(this)));return}let r=document.createElement("div");r.style.position="absolute",r.style.width="100%",r.style.height="100%";let l=this.get("mapLibreOptions");this.mapLibreMap=new Pw.Map(Object.assign({},l,{container:r,attributionControl:!1,interactive:!1,trackResize:!1})),this.mapLibreMap.on("sourcedata",()=>{this.getSource()?.refresh()}),this.mapLibreMap.once("load",()=>{this.loaded=!0,this.dispatchEvent(new Ei("load"))})}createRenderer(){let t=this.get("translateZoom");return new Ma(this,t)}};var b0=Us(Pl());var wd=class extends Ma{constructor(r,l){super(r,l);this.ignoreNextRender=!1;this.setIsReady=this.setIsReady.bind(this),this.ignoreNextRender=!1}renderFrame(r){let l=this.getLayer(),{mapLibreMap:c}=l,n=l.getMapInternal();if(!l||!n||!c)return null;if(this.ready&&this.ignoreNextRender)return this.ignoreNextRender=!1,c?.getContainer();this.ready=!1,this.ignoreNextRender=!1,this.updateReadyState();let x=super.renderFrame(r);return c?.once("idle",this.setIsReady),x}setIsReady(){this.ready||(this.ready=!0,this.ignoreNextRender=!0,this.getLayer().changed())}updateReadyState(){this.getLayer()?.mapLibreMap?.off("idle",this.setIsReady),this.getLayer()?.mapLibreMap?.once("idle",this.setIsReady)}};var Rw=(h,t,r,l)=>ul(`${h}/styles/${t}/style.json`,{[l]:r}).toString(),x0=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(x0=(0,b0.default)(h=>{console.warn(h)},1e3));var v0=class h extends Jc{constructor(r){let l={apiKeyName:"key",style:"travic_v2",url:"https://maps.geops.io",...r||{},mapLibreOptions:{...r.mapLibreOptions||{}}};!l.mapLibreOptions.style&&l.url?.includes("style.json")?l.mapLibreOptions.style=l.url:!l.mapLibreOptions.style&&l.apiKey&&l.style&&typeof l.style=="string"&&(l.mapLibreOptions.style=Rw(l.url,l.style,l.apiKey,l.apiKeyName));super(l);this.olEventsKeys=[];Ca(this,r),this.set("options",r)}set apiKey(r){this.set("apiKey",r)}get apiKey(){return this.get("apiKey")}set apiKeyName(r){this.set("apiKeyName",r)}get apiKeyName(){return this.get("apiKeyName")}get maplibreMap(){return x0("MaplibreLayer.maplibreMap is deprecated. Use layer.mapLibreMap."),this.mapLibreMap}get mbMap(){return x0("MaplibreLayer.mbMap is deprecated. Use layer.maplibreMap."),this.maplibreMap}get style(){return this.get("style")}set style(r){this.set("style",r)}get url(){return this.get("url")}set url(r){this.set("url",r)}attachToMap(){let r=(0,b0.default)(this.updateMaplibreMap.bind(this),150);r(),this.olEventsKeys.push(this.on("propertychange",l=>{/(url|style|apiKey|apiKeyName)/.test(l.key)&&r()}))}clone(r){return new h({...this.get("options")||{},...r||{}})}createRenderer(){return new wd(this)}detachFromMap(){Cs(this.olEventsKeys)}disposeInternal(){let r=this.getSource();super.disposeInternal(),this.setSource(r)}getStyle(){return this.style&&typeof this.style=="object"&&this.style.name&&this.style.version?this.style:this.url.includes("style.json")?this.url:this.get("options")?.mapLibreOptions?.style?this.get("options").mapLibreOptions.style:Rw(this.url,this.style,this.apiKey,this.apiKeyName)}setMapInternal(r){r?(super.setMapInternal(r),this.attachToMap()):(this.detachFromMap(),super.setMapInternal(r))}updateMaplibreMap(){try{this.mapLibreMap?.setStyle(this.getStyle(),{diff:!1})}catch(r){console.error("Error while updating MaplibreMap",r)}}},Aw=v0;var Lw=Us(Pl());var w0={"EPSG:3857":new Sr({featureProjection:"EPSG:3857"})},Sd=class extends wa{forEachFeatureAtCoordinate(t,r,l,c){let n=this.getFeaturesAtCoordinate(t,l);return n.forEach(x=>{c(x,this.layer_,x.getGeometry())}),n?.[0]}getFeatures(t){let r=this.getLayer()?.getMapInternal()?.getCoordinateFromPixel(t);return Promise.resolve(this.getFeaturesAtCoordinate(r))}getFeaturesAtCoordinate(t,r=5){if(!t)return[];let l=this.getLayer(),c=l.getMapInternal(),n=l.maplibreLayer.mapLibreMap,x=c?.getView()?.getProjection()?.getCode()||"EPSG:3857",b=[];if(w0[x]||(w0[x]=new Sr({featureProjection:x})),n?.isStyleLoaded()){let S=t&&n.project(yl(t));if(S?.x&&S?.y){let R=[S.x,S.y];if(r){let[A,z]=R;R=[[A-r,z-r],[A+r,z+r]]}let E=l.layers||[];l.layersFilter&&(E=n.getStyle().layers.filter(l.layersFilter)),l.queryRenderedLayersFilter&&(E=n.getStyle().layers.filter(l.queryRenderedLayersFilter)),b=n.queryRenderedFeatures(R,{layers:E.map(A=>A.id),validate:!1}).map(A=>{let z=w0[x].readFeature(A);return z&&z.set(Bc,A),z})}}return b}prepareFrame(){return!0}renderFrame(){return null}};var An=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(An=(0,Lw.default)((...h)=>{console.warn(...h)},1e3));var S0=class h extends Rs{constructor(r={mapLibreOptions:{style:{layers:[],sources:{},version:8}}}){r.mapboxLayer&&(An("options.mapboxLayer is deprecated. Use options.maplibreLayer instead."),r.maplibreLayer=r.mapboxLayer,delete r.mapboxLayer),r.styleLayers&&(An("options.styleLayers is deprecated. Use options.layers instead."),r.layers=r.styleLayers,delete r.styleLayers),r.styleLayersFilter&&(An("options.styleLayersFilter is deprecated. Use options.layersFilter instead."),r.layersFilter=r.styleLayersFilter,delete r.styleLayersFilter);super({source:new Bo({}),...r});this.highlightedFeatures=[];this.olEventsKeys=[];this.selectedFeatures=[];Ca(this,r),this.set("options",r),this.beforeId=r.beforeId,this.onLoad=this.onLoad.bind(this),!this.layersFilter&&this.layers&&(this.layersFilter=l=>!!this.layers.find(c=>l.id===c.id))}get beforeId(){return this.get("beforeId")}set beforeId(r){this.set("beforeId",r)}get layers(){return this.get("layers")}set layers(r){this.set("layers",r)}get layersFilter(){return this.get("layersFilter")}set layersFilter(r){this.set("layersFilter",r)}get mapboxLayer(){return An("Deprecated. Use maplibreLayer instead."),this.get("maplibreLayer")}get maplibreLayer(){return this.get("maplibreLayer")}set maplibreLayer(r){this.set("maplibreLayer",r)}get queryRenderedLayersFilter(){return this.get("queryRenderedLayersFilter")}set queryRenderedLayersFilter(r){this.set("queryRenderedLayersFilter",r)}get sources(){return this.get("sources")}set sources(r){this.set("sources",r)}get styleLayer(){return An("Deprecated. Use MaplibreStyleLayer.layer instead."),this.layers[0]}set styleLayer(r){An("MaplibreStyleLayer.styleLayer is deprecated. Use MaplibreStyleLayer.layer instead."),this.layers=[r]}get styleLayers(){return An("MaplibreStyleLayer.styleLayers is deprecated. Use MaplibreStyleLayer.layers instead."),this.layers}set styleLayers(r){An("MaplibreStyleLayer.styleLayers is deprecated. Use MaplibreStyleLayer.layers instead."),this.layers=r}addLayers(){if(!this.maplibreLayer?.mapLibreMap||!Array.isArray(this.layers))return;let{mapLibreMap:r}=this.maplibreLayer;r&&(this.layers.forEach(l=>{let{id:c,source:n}=l;(!n||n&&r.getSource(n))&&c&&!r.getLayer(c)&&r.addLayer(l,this.beforeId)}),this.applyLayoutVisibility())}addSources(){if(!this.maplibreLayer?.mapLibreMap||!this.sources)return;let{mapLibreMap:r}=this.maplibreLayer;r&&Object.entries(this.sources).forEach(([l,c])=>{r.getSource(l)||r.addSource(l,c)})}applyLayoutVisibility(r){if(!this.maplibreLayer?.mapLibreMap?.getStyle()||!this.layersFilter)return;let{mapLibreMap:l}=this.maplibreLayer,c=l.getStyle(),n=this.getVisible()?"visible":"none",x=c.layers||[];for(let b=0;b<x.length;b+=1){let S=x[b];if(this.layersFilter(S)){let{id:R}=S;l.getLayer(R)&&(l.setLayoutProperty(R,"visibility",n),(this.getMinZoom()||this.getMaxZoom())&&l.setLayerZoomRange(R,this.getMinZoom()?this.getMinZoom()-1:0,this.getMaxZoom()?this.getMaxZoom()-1:24))}}}attachToMap(r){if(!this.getMapInternal()||!this.maplibreLayer)return;let{mapLibreMap:c}=this.maplibreLayer;c&&(c.loaded()?this.onLoad():c.once("load",this.onLoad)),this.olEventsKeys.push(this.maplibreLayer.on("load",this.onLoad.bind(this)),this.on("change:visible",n=>{this.applyLayoutVisibility(n)}),this.on("propertychange",n=>{/(sources|layers|layersFilter|maplibreLayer|beforeId)/.test(n.key)&&(this.detachFromMap(),this.attachToMap(r))}),this.maplibreLayer.on("propertychange",n=>{n.key==="style"&&n.target.maplibreMap.once("styledata",()=>{n.target.maplibreMap.once("idle",()=>{this.onLoad()})})}))}clone(r){return new h({...this.get("options"),...r})}createRenderer(){return new Sd(this)}detachFromMap(){Cs(this.olEventsKeys),this.maplibreLayer?.mapLibreMap&&(this.maplibreLayer.mapLibreMap.off("load",this.onLoad),this.removeLayers(),this.removeSources())}getFeatureInfoAtCoordinate(r){if(An("Deprecated. getFeatureInfoAtCoordinate([layer], coordinate) from ol package instead."),!this.maplibreLayer?.mapLibreMap)return Promise.resolve({coordinate:r,features:[],layer:this});let{mapLibreMap:l}=this.maplibreLayer;if(!l.isStyleLoaded())return Promise.resolve({coordinate:r,features:[],layer:this});let c=this.layers||[];return this.layersFilter&&(c=l.getStyle().layers.filter(this.layersFilter),console.log(c)),this.queryRenderedLayersFilter&&(c=l.getStyle().layers.filter(this.queryRenderedLayersFilter)),Promise.resolve({coordinate:r,features:[],layer:this})}highlight(r=[]){An("Deprecated. Use layer.setFeatureState(features, {hover: true}) instead.");let l=this.highlightedFeatures?.filter(c=>!(this.selectedFeatures||[]).map(n=>n.getId()).includes(c.getId()))||[];this.setHoverState(l,!1),this.highlightedFeatures=r,this.setHoverState(this.highlightedFeatures,!0)}onLoad(){if(!this.maplibreLayer?.mapLibreMap)return;this.addSources(),this.addLayers();let{mapLibreMap:r}=this.maplibreLayer,l=r.getStyle();if(l?.layers&&this.layersFilter){let c=l.layers.filter(this.layersFilter);this.set("disabled",!c.length)}this.applyLayoutVisibility()}removeLayers(){if(!this.maplibreLayer?.mapLibreMap||!Array.isArray(this.layers))return;let{mapLibreMap:r}=this.maplibreLayer;r&&this.layers.forEach(l=>{let{id:c}=l;c&&r.getLayer(c)&&r.removeLayer(c)})}removeSources(){if(!this.maplibreLayer?.mapLibreMap||!this.sources)return;let{mapLibreMap:r}=this.maplibreLayer;r&&Object.keys(this.sources).forEach(l=>{r.getSource(l)&&r.removeSource(l)})}select(r=[]){An("Deprecated. Use layer.setFeatureState(features, {selected: true}) instead."),this.setHoverState(this.selectedFeatures||[],!1),this.selectedFeatures=r,this.setHoverState(this.selectedFeatures||[],!0)}setFeatureState(r,l){if(!this.maplibreLayer?.mapLibreMap||!r.length)return;let c=this.maplibreLayer.mapLibreMap;r.forEach(n=>{let{source:x,sourceLayer:b}=n.get(Bc)||{};if(!x&&!b||!n.getId()){n.getId()||An("No feature's id found. To use the feature state functionnality, tiles must be generated with --generate-ids. See https://github.com/Maplibre/tippecanoe#adding-calculated-attributes.",n.getProperties());return}c.setFeatureState({id:n.getId(),source:x,sourceLayer:b},l)})}setHoverState(r,l){An(`Deprecated. Use layer.setFeatureState(features, {hover: ${l}}) instead.`),this.setFeatureState(r,{hover:l})}setMapInternal(r){r?(super.setMapInternal(r),this.attachToMap(r)):(this.detachFromMap(),super.setMapInternal(r))}},kw=S0;var E0=Us(Pl());var C0=Us(Pl()),M0=Us(Bw());var I0=class{constructor(t){this.isIdle=!1;this.getViewState=()=>({});this.shouldRender=()=>!0;this._mode=t.mode||or.TOPOGRAPHIC,this._speed=t.speed||1,this._style=t.style||dl,this._time=t.time||new Date,this.api=t.api||new Mu(t),this.bboxParameters=t.bboxParameters,this.canvas=t.canvas||document.createElement("canvas"),this.debug=t.debug||!1,this.filter=t.filter,this.hoverVehicleId=t.hoverVehicleId,this.live=t.live!==!1,this.minZoomInterpolation=t.minZoomInterpolation||8,this.pixelRatio=t.pixelRatio||(typeof window<"u"?window.devicePixelRatio:1),this.selectedVehicleId=t.selectedVehicleId,this.sort=t.sort,this.styleOptions={...Oc,...t.styleOptions||{}},this.tenant=t.tenant||"",this.trajectories={},this.useDebounce=t.useDebounce||!1,this.useRequestAnimationFrame=t.useRequestAnimationFrame||!1,this.useThrottle=t.useThrottle!==!1,this.getViewState=t.getViewState||(()=>({})),this.shouldRender=t.shouldRender||(()=>!0),this.onRender=t.onRender,this.onIdle=t.onIdle,this.onStart=t.onStart,this.onStop=t.onStop,this.format=new Sr,this.motsByZoom=t.motsByZoom||[Ps,Ps,Ps,Ps,Ps,Ps,Ps,Ps,Ps,xf,xf],this.getMotsByZoom=r=>t.getMotsByZoom?t.getMotsByZoom(r,this.motsByZoom):this.motsByZoom[r],this.generalizationLevelByZoom=t.generalizationLevelByZoom||[],this.getGeneralizationLevelByZoom=r=>t.getGeneralizationLevelByZoom?t.getGeneralizationLevelByZoom(r,this.generalizationLevelByZoom):this.generalizationLevelByZoom[r],this.renderTimeIntervalByZoom=t.renderTimeIntervalByZoom||[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],this.getRenderTimeIntervalByZoom=r=>t.getRenderTimeIntervalByZoom?t.getRenderTimeIntervalByZoom(r,this.renderTimeIntervalByZoom):this.renderTimeIntervalByZoom[r],this.isUpdateBboxOnMoveEnd=t.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,M0.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,C0.default)(this.renderTrajectoriesInternal,50,{leading:!0,maxWait:5e3,trailing:!0}),this.renderState={center:[0,0],rotation:0,zoom:void 0},this.onTrajectoryMessage=this.onTrajectoryMessage.bind(this),this.onDeleteTrajectoryMessage=this.onDeleteTrajectoryMessage.bind(this),this.onDocumentVisibilityChange=this.onDocumentVisibilityChange.bind(this)}get mode(){return this._mode}set mode(t){t!==this._mode&&(this._mode=t,this.api?.wsApi?.open&&(this.stop(),this.start()))}get speed(){return this._speed}set speed(t){this._speed=t,this.start()}get style(){return this._style}set style(t){this._style=t,this.renderTrajectories()}get time(){return this._time}set time(t){this._time=t?.getTime?t:new Date(t),this.renderTrajectories()}addTrajectory(t){this.trajectories||(this.trajectories={});let r=t.properties.train_id;r!==void 0&&(this.trajectories[r]=t),this.renderTrajectories()}attachToMap(){document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){if(document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),this.canvas){let t=this.canvas.getContext("2d");t&&t.clearRect(0,0,this.canvas.width,this.canvas.height)}}getRefreshTimeInMs(){let r=this.getViewState().zoom||0,l=r!==void 0?Math.round(r):-1,c=this.getRenderTimeIntervalByZoom(l)||25,n=Math.max(25,c/(this.speed||1)),x=Math.min(n,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,M0.default)(this.renderTrajectoriesInternal,x,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,C0.default)(this.renderTrajectoriesInternal,x,{leading:!0,maxWait:5e3,trailing:!0})),this.api?.buffer){let[,b]=this.api.buffer;this.api.buffer=[x,b]}return n}getVehicles(t){return this.trajectories&&Object.values(this.trajectories).filter(t)||[]}getVehiclesAtCoordinate(t,r){let{resolution:l}=this.getViewState(),{hitTolerance:c,nb:n}=r||{},x=us([...t,...t],(c||5)*(l||1)),b=Object.values(this.trajectories||{});this.sort&&(b=b.sort(this.sort));let S=[];for(let R=0;R<b.length;R+=1){let{coordinate:E}=b[R].properties;if(E&&fl(x,E)&&S.push(b[R]),S.length===n)break}return{features:S,type:"FeatureCollection"}}onDeleteTrajectoryMessage(t){t.content&&this.removeTrajectory(t.content)}onDocumentVisibilityChange(){if(document.hidden)this.stop(),this.trajectories={};else{if(!this.getViewState().visible)return;this.start()}}onTrajectoryMessage(t){if(this.updateIdleState(),!t.content)return;let r=t.content,{geometry:l,properties:{raw_coordinates:c,time_since_update:n}}=r;n<0||this.purgeTrajectory(r)||(this.debug&&this.mode===or.TOPOGRAPHIC&&c?r.properties.olGeometry=this.format.readGeometry({coordinates:vr(c),type:"Point"}):r.properties.olGeometry=this.format.readGeometry(l),r.properties.timeOffset=Date.now()-t.timestamp,this.addTrajectory(r))}onZoomEnd(){this.startUpdateTime()}purgeOutOfDateTrajectories(){Object.entries(this.trajectories||{}).forEach(([t,r])=>{let l=r?.properties?.time_intervals;this.time&&l?.length&&l[l.length-1][0]<this.time.getTime()&&this.removeTrajectory(t)})}purgeTrajectory(t){let l=this.getViewState().extent,{bounds:c,type:n}=t.properties;return this.isUpdateBboxOnMoveEnd&&l&&!er(l,c)||this.mots&&!this.mots.includes(n)?(this.removeTrajectory(t),!0):!1}removeTrajectory(t){let r;typeof t!="string"?r=t?.properties?.train_id:r=t,r!==void 0&&this.trajectories&&delete this.trajectories[r]}renderTrajectories(t){let r=this.getViewState();this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=void 0),!(!r?.center||!r?.extent||!r?.size)&&(!t&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(r,t)}):!t&&this.useDebounce?this.debounceRenderTrajectories(r,t):!t&&this.useThrottle?this.throttleRenderTrajectories(r,t):this.renderTrajectoriesInternal(r,t))}renderTrajectoriesInternal(t,r=!1){if(!this.trajectories||!this.shouldRender())return!1;let l=this.live?Date.now():this.time?.getTime(),c=Object.values(this.trajectories);return this.sort&&c.sort(this.sort),!this.canvas||!this.style||(this.renderState=Yu(this.canvas,c,this.style,{...t,pixelRatio:this.pixelRatio||1,time:l},{filter:this.filter,hoverVehicleId:this.hoverVehicleId,noInterpolate:(t.zoom||0)<this.minZoomInterpolation?!0:r,selectedVehicleId:this.selectedVehicleId,...this.styleOptions}),this.onRender?.(this.renderState,t)),!0}setBbox(){this.updateIdleState();let t=this.getViewState(),r=t.extent,l=t.zoom||0;if(!r||Number.isNaN(l))return;if(this.trajectories&&r&&l){let E=Object.keys(this.trajectories);for(let A=E.length-1;A>=0;A-=1)this.purgeTrajectory(this.trajectories[E[A]])}let c=Math.floor(l);if(!r||Number.isNaN(c))return;let[n,x,b,S]=r,R=[Math.floor(n),Math.floor(x),Math.ceil(b),Math.ceil(S),c];this.generalizationLevel=this.getGeneralizationLevelByZoom(c),this.generalizationLevel&&R.push(`gen=${this.generalizationLevel}`),this.mots=this.getMotsByZoom(c),this.mots&&R.push(`mots=${this.mots}`),this.tenant&&R.push(`tenant=${this.tenant}`),this.mode!=="topographic"&&R.push(`channel_prefix=${this.mode}`),this.bboxParameters&&Object.entries(this.bboxParameters).forEach(([E,A])=>{R.push(`${E}=${A}`)}),this.api.bbox=R}start(){this.stop(),this.purgeOutOfDateTrajectories(),this.renderTrajectories(),this.startUpdateTime(),this.api.open(),this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.onStart&&this.onStart(this)}startUpdateTime(){this.stopUpdateTime(),this.updateTimeDelay=this.getRefreshTimeInMs()||0,this.updateTimeInterval=window.setInterval(()=>{this.live?this.time=new Date:this.time&&this.updateTimeDelay&&this.speed&&(this.time=new Date(this.time.getTime()+this.updateTimeDelay*this.speed))},this.updateTimeDelay)}stop(){this.api.unsubscribeTrajectory(this.onTrajectoryMessage),this.api.unsubscribeDeletedVehicles(this.onDeleteTrajectoryMessage),this.api.close(),this.onStop&&this.onStop(this)}stopUpdateTime(){this.updateTimeInterval&&(clearInterval(this.updateTimeInterval),this.updateTimeInterval=void 0)}updateIdleState(){this.isIdle=!1,clearTimeout(this._idleTimeout),this._idleTimeout=window.setTimeout(()=>{this.isIdle=!0,this.onIdle?.(this)},1e3)}},Xf=I0;var bI=new Sr,Td=class extends Gf{forEachFeatureAtCoordinate(t,r,l,c){let n=this.getFeaturesAtCoordinate(t,l);return n.forEach(x=>{c(x,this.layer_,x.getGeometry())}),n?.[0]}getData(t){let r;try{let{pixelRatio:l}=this.getLayer();return r=this.canvas?.getContext("2d",{willReadFrequently:!0})?.getImageData(t[0]*(l||1),t[1]*(l||1),1,1).data||null,r}catch(l){console.error("error getting data",l)}return null}getFeatures(t){let r=this.getLayer()?.getMapInternal()?.getCoordinateFromPixel(t);return Promise.resolve(this.getFeaturesAtCoordinate(r))}getFeaturesAtCoordinate(t,r=5){if(!t)return[];let l=this.getLayer(),c=l.engine.getVehiclesAtCoordinate(t,{hitTolerance:r,nb:l.maxNbFeaturesRequested});return bI.readFeatures(c)}prepareFrame(){return!0}renderFrame(t){let{canvas:r,engine:l,renderedViewState:c}=this.getLayer();if(this.getLayer().engine.pixelRatio=t.pixelRatio,this.ready=!!l.renderState?.renderedTrajectories&&l.isIdle,this.container||(this.container=document.createElement("div"),this.container.className=this.getLayer().getClassName(),this.container.style.position="absolute",this.container.style.width="100%",this.container.style.height="100%",r instanceof HTMLCanvasElement&&(r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.transformOrigin="top left",this.container.appendChild(r))),c){let{center:n,resolution:x,rotation:b}=t.viewState,{center:S,resolution:R,rotation:E}=c;if(R/x>=3){let A=r?.getContext("2d");r?.width&&r?.height&&A?.clearRect(0,0,r.width,r.height)}else{let A=this.getLayer().getMapInternal(),z=A?.getPixelFromCoordinate(S),W=A?.getPixelFromCoordinate(n);z&&W&&(this.container.style.transform=Ev(z[0]-W[0],z[1]-W[1],R/x,R/x,b-E,0,0))}}return this.container}};var wI=new Or({image:new Pn({fill:new zr({color:"#000000"}),radius:5}),stroke:new cr({color:"#000000",width:6}),zIndex:2}),SI=(h,t,r)=>{let l="#ffffff",c=h.get("type"),n=h.get("stroke");return n&&n[0]!=="#"&&(n=`#${n}`),l=n||r?.getBgColor(c),l=/#ffffff/i.test(l)?"#ff0000":l,[wI,new Or({image:new Pn({fill:new zr({color:l}),radius:4}),stroke:new cr({color:l,width:4}),zIndex:3})]},Hf=SI;var TI=new Or({image:new Pn({fill:new zr({color:"#000000"}),radius:5}),stroke:new cr({color:"#000000",width:6}),zIndex:2}),CI=new Or({image:new Pn({fill:new zr({color:"#a0a0a0"}),radius:4}),stroke:new cr({color:"#a0a0a0",width:4}),zIndex:3}),MI=()=>[TI,CI],jw=MI;var Nw=new Pn({fill:new zr({color:[255,0,0,1]}),radius:6,stroke:new cr({color:[0,0,0,1],width:1})}),II=new Or({stroke:new cr({color:[0,0,0,1],width:5})}),EI=new Or({image:Nw,stroke:new cr({color:[255,0,0,1],width:3})}),PI=new Or({image:Nw,stroke:new cr({color:[255,0,0,1],lineDash:[1,10],width:3})}),RI=(h,t)=>{let r=h.get("minResolution"),l=h.get("maxResolution"),c=t<=r&&t>l;if(r&&l&&!c)return[];let n=h?.getGeometry()?.getType()==="Point"?100:0,x=[II,EI];return h.get("mot")==="foot"&&(x=[PI]),x=x.map(S=>{let R=S.clone();return R.setZIndex(n),R}),x},Gw=RI;var AI=new Sr,P0=class h extends Rs{constructor(r){super({source:new Bo({}),...r});this.allowRenderWhenAnimating=!1;this.maxNbFeaturesRequested=100;this.olEventsKeys=[];Ca(this,r),this.engine=new Xf({getViewState:this.getViewState.bind(this),onIdle:this.onRealtimeEngineIdle.bind(this),onRender:this.onRealtimeEngineRender.bind(this),...r}),this.allowRenderWhenAnimating=!!r.allowRenderWhenAnimating,this.vectorLayer=new Yc({source:new El({features:[]}),style:(l,c)=>(r.fullTrajectoryStyle||Hf)(l,c,this.engine.styleOptions),updateWhileAnimating:this.allowRenderWhenAnimating,updateWhileInteracting:!0}),this.onZoomEndDebounced=(0,E0.default)(this.onZoomEnd,100),this.onMoveEndDebounced=(0,E0.default)(this.onMoveEnd,100)}get api(){return this.engine.api}set api(r){this.engine.api=r}get canvas(){return this.engine.canvas}get filter(){return this.engine.filter}set filter(r){this.engine.filter=r}get hoverVehicleId(){return this.engine.hoverVehicleId}set hoverVehicleId(r){this.engine.hoverVehicleId=r}get mode(){return this.engine.mode}set mode(r){this.engine.mode=r}get pixelRatio(){return this.engine.pixelRatio}get selectedVehicleId(){return this.engine.selectedVehicleId}set selectedVehicleId(r){this.engine.selectedVehicleId=r}get sort(){return this.engine.sort}set sort(r){this.engine.sort=r}get trajectories(){return this.engine.trajectories}attachToMap(){this.engine.attachToMap();let r=this.getMapInternal();r&&(this.getVisible()&&this.engine.start(),this.olEventsKeys.push(r.on("movestart",()=>{this.engine.isUpdateBboxOnMoveEnd&&this.engine.updateIdleState()}),...r.on(["moveend","change:target"],l=>{let c=(l.map||l.target).getView();if(!c||c?.getAnimating()||c?.getInteracting())return;let n=c.getZoom();this.currentZoom!==n&&this.onZoomEndDebounced(l),this.currentZoom=n,this.onMoveEndDebounced(l)}),this.on("change:visible",l=>{l.target.getVisible()?this.engine.start():this.engine.stop()}),this.on("propertychange",l=>{/(opacity|visible|zIndex|minResolution|maxResolution|minZoom|maxZoom)/.test(l.key)&&this.vectorLayer.set(l.key,l.target.get(l.key))})))}cleanVectorLayer(){this.vectorLayer?.getSource()?.clear(!0),this.vectorLayer.getMapInternal()?.removeLayer(this.vectorLayer)}clone(r){return new h({...this.get("options"),...r})}createRenderer(){return new Td(this)}detachFromMap(){Cs(this.olEventsKeys),this.getMapInternal()?.removeLayer(this.vectorLayer),this.engine.detachFromMap()}async getFullTrajectory(r){let l=await this.engine.api.getFullTrajectory(r,this.engine.mode,this.engine.getGeneralizationLevelByZoom(Math.floor(this.getMapInternal()?.getView()?.getZoom()||0)));return l?.content?.features?.length?AI.readFeatures(l?.content):[]}async getStopSequences(r){return(await this.engine.api.getStopSequence(r))?.content}async getTrajectoryInfos(r){let l=[this.getStopSequences(r),this.getFullTrajectory(r)],[c,n]=await Promise.all(l);return{fullTrajectory:n,stopSequences:c}}getVehicles(r){return this.engine.getVehicles(r)}getViewState(){let r=this.getMapInternal();if(!r?.getView())return{};let l=r.getView();return{center:l.getCenter(),extent:l.calculateExtent(),pixelRatio:this.engine.pixelRatio,resolution:l.getResolution(),rotation:l.getRotation(),size:r.getSize(),visible:this.getVisible(),zoom:l.getZoom()}}highlight(r){let l=r?.get("train_id");this.hoverVehicleId!==l&&(this.hoverVehicleId=l,this.engine.renderTrajectories(!0))}async highlightTrajectory(r){if(!r){this.cleanVectorLayer();return}let l=await this.getFullTrajectory(r);if(!l?.length){this.cleanVectorLayer();return}l.length&&this.vectorLayer?.getSource()?.addFeatures(l),this.vectorLayer.getMapInternal()&&this.vectorLayer.getMapInternal()!==this.getMapInternal()&&this.vectorLayer.getMapInternal()?.removeLayer(this.vectorLayer);let c=this.getZIndex();if(c!==void 0)this.vectorLayer.setZIndex(c-1),this.vectorLayer.getMapInternal()||this.getMapInternal()?.addLayer(this.vectorLayer);else if(!this.vectorLayer.getMapInternal()){let n=this.getMapInternal()?.getLayers().getArray().indexOf(this)||0;n&&this.getMapInternal()?.getLayers().insertAt(n,this.vectorLayer)}return l}onMoveEnd(){!this.engine.isUpdateBboxOnMoveEnd||!this.getVisible()||this.engine.setBbox()}onRealtimeEngineIdle(){this.changed()}onRealtimeEngineRender(r,l){this.renderedViewState={...l};let{container:c}=this.getRenderer();c&&(c.style.transform="")}onZoomEnd(){this.engine.onZoomEnd(),!(!this.engine.isUpdateBboxOnMoveEnd||!this.getVisible())&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}select(r){let l=r?.get("train_id");this.selectedVehicleId!==l&&(this.selectedVehicleId=l,this.engine.renderTrajectories(!0)),this.highlightTrajectory(l)}setMapInternal(r){r?(super.setMapInternal(r),this.attachToMap()):(this.detachFromMap(),super.setMapInternal(r))}shouldRender(){return this.allowRenderWhenAnimating?!1:this.getMapInternal()?.getView().getAnimating()||this.getMapInternal()?.getView().getInteracting()}start(){this.engine.start()}stop(){this.engine.stop()}},Vw=P0;var R0=class h extends Wf{clone(t){return new h({...this.get("options"),...t})}getFeatureInfoAtCoordinate(t){let r=[],l=this.getMapInternal();if(l){let c=l.getPixelFromCoordinate(t);r=l.getFeaturesAtPixel(c,{hitTolerance:this.get("hitTolerance")||5,layerFilter:n=>n===this})||[]}return Promise.resolve({coordinate:t,features:r,layer:this})}},Uw=R0;var LI=new Sr,kI=(h,t,r)=>{let l,{coordinate:c,params:n,projection:x,resolution:b}=t;return h&&b&&x&&(l=h.getFeatureInfoUrl(c,b,x,{info_format:"application/json",query_layers:h.getParams().layers,...n})),fetch(l,{signal:r.signal}).then(S=>S.json()).then(S=>LI.readFeatures(S)).catch(()=>[])},Cd={},DI=async(h,t,r=5)=>{Object.values(Cd).forEach(n=>{n?.abort()}),Cd={};let c=Ru(t).map(n=>{let x=n.getMapInternal(),b=x?.getView()?.getProjection()?.getCode(),S={coordinate:h,features:[],layer:n};if(!b)return Promise.resolve(S);if(n.getFeatureInfoAtCoordinate)return n.getFeatureInfoAtCoordinate(h);let R=n?.getSource();if(R?.getFeatureInfoUrl){let z=Gt(n);Cd[z]?.abort(),Cd[z]=new AbortController;let W=x?.getView()?.getResolution();return kI(R,{coordinate:h,params:{info_format:"application/json",query_layers:R.getParams().layers},projection:b,resolution:W},Cd[z]).then(re=>({coordinate:h,features:re,layer:n})).catch(()=>({coordinate:h,features:[],layer:n}))}let E=x?.getPixelFromCoordinate(h);if(!E)return Promise.resolve(S);let A=x?.getFeaturesAtPixel(E,{hitTolerance:n.get("hitTolerance")||r||5,layerFilter:z=>z===n});return Promise.resolve({coordinate:h,features:A,layer:n})});return Promise.all(c)},Zw=DI;var em={};dg(em,{CopyrightControl:()=>qw,Layer:()=>Kf,RealtimeAPI:()=>Mu,RealtimeLayer:()=>cS,RealtimeModes:()=>or,RoutingAPI:()=>Iu,StopsAPI:()=>Eu,VECTOR_TILE_FEATURE_PROPERTY:()=>Bc,compareDepartures:()=>Ku,createCanvas:()=>ws,createRealtimeFilters:()=>Pg,debounceDeparturesMessages:()=>T_,debounceWebsocketMessages:()=>Cu,getCircleCanvas:()=>Cg,getDelayBgCanvas:()=>Sg,getDelayTextCanvas:()=>Tg,getHoursAndMinutes:()=>Cv,getLayersAsFlatArray:()=>Ru,getMapGlCopyrights:()=>Pu,getMercatorResolution:()=>lS,getSourceCoordinates:()=>Qf,getTextCanvas:()=>Mg,getUTCDateString:()=>Sv,getUTCTimeString:()=>Tv,getUrlWithParams:()=>ul,getVehiclePosition:()=>Hu,pad:()=>Up,realtimeConfig:()=>Oc,realtimeDefaultStyle:()=>dl,realtimeDelayStyle:()=>Ig,realtimeSimpleStyle:()=>Eg,removeDuplicate:()=>pl,renderTrajectories:()=>Yu,sortAndFilterDepartures:()=>Ju,sortByDelay:()=>Rg});var FI=" | ",A0=class{constructor(t={}){this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this.map=t,this.container||(this.container=document.createElement("div")),this.render=this.render.bind(this),this.map.on("idle",this.render),this.map.on("sourcedata",this.render),this.map.on("styledata",this.render),this.render(),this.container}onRemove(){return this.container?.parentElement&&this.container.parentElement?.removeChild(this.container),this.map&&(this.map.off("sourcedata",this.render),this.map.off("styledata",this.render),this.map.off("idle",this.render)),this.map=void 0,this.container}render(){if(this.map&&this.container){let t=this.options?.separator||FI,r=this.options?.customAttribution||Pu(this.map),l=(Array.isArray(r)?r:[r]).join(t);this.container.innerHTML!==l&&(this.content=l,this.container.innerHTML=this.content)}}},qw=A0;var $w=Us(g0());var Br=[];for(let h=0;h<256;++h)Br.push((h+256).toString(16).slice(1));function Ww(h,t=0){return(Br[h[t+0]]+Br[h[t+1]]+Br[h[t+2]]+Br[h[t+3]]+"-"+Br[h[t+4]]+Br[h[t+5]]+"-"+Br[h[t+6]]+Br[h[t+7]]+"-"+Br[h[t+8]]+Br[h[t+9]]+"-"+Br[h[t+10]]+Br[h[t+11]]+Br[h[t+12]]+Br[h[t+13]]+Br[h[t+14]]+Br[h[t+15]]).toLowerCase()}var L0,zI=new Uint8Array(16);function k0(){if(!L0){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");L0=crypto.getRandomValues.bind(crypto)}return L0(zI)}var OI=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),D0={randomUUID:OI};function BI(h,t,r){if(D0.randomUUID&&!t&&!h)return D0.randomUUID();h=h||{};let l=h.random??h.rng?.()??k0();if(l.length<16)throw new Error("Random bytes length must be >= 16");if(l[6]=l[6]&15|64,l[8]=l[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let c=0;c<16;++c)t[r+c]=l[c];return t}return Ww(l)}var F0=BI;var z0=class extends $w.Evented{constructor(r={}){super();this.options={};this.type="custom";this.options=r,this.id=r.id||F0()}onAdd(r,l){this.map=r}onRemove(r,l){this.map=void 0}render(r){}},Kf=z0;var jr=63710088e-1,Hw={centimeters:jr*100,centimetres:jr*100,degrees:360/(2*Math.PI),feet:jr*3.28084,inches:jr*39.37,kilometers:jr/1e3,kilometres:jr/1e3,meters:jr,metres:jr,miles:jr/1609.344,millimeters:jr*1e3,millimetres:jr*1e3,nauticalmiles:jr/1852,radians:1,yards:jr*1.0936};function jI(h,t,r={}){let l={type:"Feature"};return(r.id===0||r.id)&&(l.id=r.id),r.bbox&&(l.bbox=r.bbox),l.properties=t||{},l.geometry=h,l}function Rl(h,t,r={}){if(!h)throw new Error("coordinates is required");if(!Array.isArray(h))throw new Error("coordinates must be an Array");if(h.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Xw(h[0])||!Xw(h[1]))throw new Error("coordinates must contain numbers");return jI({type:"Point",coordinates:h},t,r)}function NI(h,t="kilometers"){let r=Hw[t];if(!r)throw new Error(t+" units is invalid");return h*r}function GI(h,t="kilometers"){let r=Hw[t];if(!r)throw new Error(t+" units is invalid");return h/r}function Yw(h){return h%(2*Math.PI)*180/Math.PI}function Al(h){return h%360*Math.PI/180}function Jf(h,t="kilometers",r="kilometers"){if(!(h>=0))throw new Error("length must be a positive number");return NI(GI(h,t),r)}function Xw(h){return!isNaN(h)&&h!==null&&!Array.isArray(h)}function Kw(h){return h!==null&&typeof h=="object"&&!Array.isArray(h)}function Md(h,t,r){if(h!==null)for(var l,c,n,x,b,S,R,E=0,A=0,z,W=h.type,re=W==="FeatureCollection",me=W==="Feature",ge=re?h.features.length:1,be=0;be<ge;be++){R=re?h.features[be].geometry:me?h.geometry:h,z=R?R.type==="GeometryCollection":!1,b=z?R.geometries.length:1;for(var ve=0;ve<b;ve++){var De=0,ke=0;if(x=z?R.geometries[ve]:R,x!==null){S=x.coordinates;var je=x.type;switch(E=r&&(je==="Polygon"||je==="MultiPolygon")?1:0,je){case null:break;case"Point":if(t(S,A,be,De,ke)===!1)return!1;A++,De++;break;case"LineString":case"MultiPoint":for(l=0;l<S.length;l++){if(t(S[l],A,be,De,ke)===!1)return!1;A++,je==="MultiPoint"&&De++}je==="LineString"&&De++;break;case"Polygon":case"MultiLineString":for(l=0;l<S.length;l++){for(c=0;c<S[l].length-E;c++){if(t(S[l][c],A,be,De,ke)===!1)return!1;A++}je==="MultiLineString"&&De++,je==="Polygon"&&ke++}je==="Polygon"&&De++;break;case"MultiPolygon":for(l=0;l<S.length;l++){for(ke=0,c=0;c<S[l].length;c++){for(n=0;n<S[l][c].length-E;n++){if(t(S[l][c][n],A,be,De,ke)===!1)return!1;A++}ke++}De++}break;case"GeometryCollection":for(l=0;l<x.geometries.length;l++)if(Md(x.geometries[l],t,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Jw(h,t={}){let r=0,l=0,c=0;return Md(h,function(n){r+=n[0],l+=n[1],c++},!0),Rl([r/c,l/c],t.properties)}function eo(h){if(!h)throw new Error("coord is required");if(!Array.isArray(h)){if(h.type==="Feature"&&h.geometry!==null&&h.geometry.type==="Point")return[...h.geometry.coordinates];if(h.type==="Point")return[...h.coordinates]}if(Array.isArray(h)&&h.length>=2&&!Array.isArray(h[0])&&!Array.isArray(h[1]))return[...h];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Qw(h){if(Array.isArray(h))return h;if(h.type==="Feature"){if(h.geometry!==null)return h.geometry.coordinates}else if(h.coordinates)return h.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function tS(h,t,r={}){let l;return r.final?l=eS(eo(t),eo(h)):l=eS(eo(h),eo(t)),l>180?-(360-l):l}function eS(h,t){let r=Al(h[1]),l=Al(t[1]),c=Al(t[0]-h[0]);c>Math.PI&&(c-=2*Math.PI),c<-Math.PI&&(c+=2*Math.PI);let n=Math.log(Math.tan(l/2+Math.PI/4)/Math.tan(r/2+Math.PI/4)),x=Math.atan2(c,n);return(Yw(x)+360)%360}function iS(h,t,r={}){let l=eo(h),c=eo(t);c[0]+=c[0]-l[0]>180?-360:l[0]-c[0]>180?360:0;let n=VI(l,c);return Jf(n,"meters",r.units)}function VI(h,t,r){r=r===void 0?jr:Number(r);let l=r,c=h[1]*Math.PI/180,n=t[1]*Math.PI/180,x=n-c,b=Math.abs(t[0]-h[0])*Math.PI/180;b>Math.PI&&(b-=2*Math.PI);let S=Math.log(Math.tan(n/2+Math.PI/4)/Math.tan(c/2+Math.PI/4)),R=Math.abs(S)>1e-11?x/S:Math.cos(c);return Math.sqrt(x*x+R*R*b*b)*l}function rS(h,t,r,l={}){let c=t<0,n=Jf(Math.abs(t),l.units,"meters");c&&(n=-Math.abs(n));let x=eo(h),b=UI(x,n,r);return b[0]+=b[0]-x[0]>180?-360:x[0]-b[0]>180?360:0,Rl(b,l.properties)}function UI(h,t,r,l){l=l===void 0?jr:Number(l);let c=t/l,n=h[0]*Math.PI/180,x=Al(h[1]),b=Al(r),S=c*Math.cos(b),R=x+S;Math.abs(R)>Math.PI/2&&(R=R>0?Math.PI-R:-Math.PI-R);let E=Math.log(Math.tan(R/2+Math.PI/4)/Math.tan(x/2+Math.PI/4)),A=Math.abs(E)>1e-11?S/E:Math.cos(x),z=c*Math.sin(b)/A;return[((n+z)*180/Math.PI+540)%360-180,R*180/Math.PI]}function nS(h){if(!h)throw new Error("geojson is required");switch(h.type){case"Feature":return sS(h);case"FeatureCollection":return ZI(h);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return O0(h);default:throw new Error("unknown GeoJSON type")}}function sS(h){let t={type:"Feature"};return Object.keys(h).forEach(r=>{switch(r){case"type":case"properties":case"geometry":return;default:t[r]=h[r]}}),t.properties=oS(h.properties),h.geometry==null?t.geometry=null:t.geometry=O0(h.geometry),t}function oS(h){let t={};return h&&Object.keys(h).forEach(r=>{let l=h[r];typeof l=="object"?l===null?t[r]=null:Array.isArray(l)?t[r]=l.map(c=>c):t[r]=oS(l):t[r]=l}),t}function ZI(h){let t={type:"FeatureCollection"};return Object.keys(h).forEach(r=>{switch(r){case"type":case"features":return;default:t[r]=h[r]}}),t.features=h.features.map(r=>sS(r)),t}function O0(h){let t={type:h.type};return h.bbox&&(t.bbox=h.bbox),h.type==="GeometryCollection"?(t.geometries=h.geometries.map(r=>O0(r)),t):(t.coordinates=aS(h.coordinates),t)}function aS(h){let t=h;return typeof t[0]!="object"?t.slice():t.map(r=>aS(r))}function qI(h,t,r){if(r=r||{},!Kw(r))throw new Error("options is invalid");let l=r.pivot,c=r.mutate;if(!h)throw new Error("geojson is required");if(t==null||isNaN(t))throw new Error("angle is required");if(t===0)return h;let n=l??Jw(h);return(c===!1||c===void 0)&&(h=nS(h)),Md(h,function(x){let S=tS(n,x)+t,R=iS(n,x),E=Qw(rS(n,R,S));x[0]=E[0],x[1]=E[1]}),h}var B0=qI;var WI=(h,t=1)=>{let{height:r,width:l}=h.getCanvas(),c=h.unproject({x:0,y:0}),n=h.unproject({x:0,y:r/t}),x=h.unproject({x:l/t,y:r/t}),b=h.unproject({x:l/t,y:0});return[[c.lng,c.lat],[b.lng,b.lat],[x.lng,x.lat],[n.lng,n.lat]]},Qf=WI;var $I=h=>{let t=h.getBounds().toArray(),r=vr(t[0]),l=vr(t[1]),c=[...r,...l],{width:n,height:x}=h.getCanvas(),b=Ti(c)/n,S=ar(c)/x;return Math.max(b,S)},lS=$I;var j0=class extends Kf{get canvas(){return this.engine.canvas}get pixelRatio(){return this.engine.pixelRatio||1}set pixelRatio(t){this.engine.pixelRatio=t||1}#e;constructor(t={}){let r=t?.id||"realtime";super({...t,id:"realtime-custom-"+r}),this.#e=r,this.engine=new Xf({getViewState:this.getViewState.bind(this),onRender:this.onRealtimeEngineRender.bind(this),...t}),this.sourceId=this.#e,this.source={animate:!0,attribution:t.attribution?.join(", "),canvas:this.canvas,coordinates:[[0,0],[1,1],[2,2],[0,0]],loaded:!0,type:"canvas"},this.layer={id:this.#e,layout:{visibility:"visible"},paint:{"raster-fade-duration":0,"raster-opacity":1,"raster-resampling":"nearest"},source:this.sourceId,type:"raster"},this.onLoad=this.onLoad.bind(this),this.onMove=this.onMove.bind(this),this.onMoveEnd=this.onMoveEnd.bind(this),this.onZoomEnd=this.onZoomEnd.bind(this)}getViewState(){if(!this.map)return{};this.pixelRatio||(this.pixelRatio=1);let{height:t,width:r}=this.map.getCanvas(),l=this.map.getCenter(),c=this.map.unproject({x:0,y:t/this.pixelRatio}),n=this.map.unproject({x:r/this.pixelRatio,y:0}),x=B0(Rl([c.lng,c.lat]),-this.map.getBearing(),{pivot:[l.lng,l.lat]}).geometry.coordinates,b=B0(Rl([n.lng,n.lat]),-this.map.getBearing(),{pivot:[l.lng,l.lat]}).geometry.coordinates,S=[...vr(x),...vr(b)],R=Ti(S)/(r/this.pixelRatio),E=ar(S)/(t/this.pixelRatio),A=Math.max(R,E);return{center:vr([l.lng,l.lat]),extent:S,pixelRatio:this.pixelRatio,resolution:A,rotation:-(this.map.getBearing()*Math.PI)/180,size:[r/this.pixelRatio,t/this.pixelRatio],visible:!0,zoom:this.map.getZoom()-1}}onAdd(t,r){super.onAdd(t,r),this.engine.attachToMap(),t.isStyleLoaded()&&this.onLoad(),t.on("load",this.onLoad)}onLoad(){this.map?.getSource(this.sourceId)||this.map?.addSource(this.sourceId,this.source),this.map?.getLayer(this.layer.id)||this.map?.addLayer(this.layer,this.id),this.start()}onMove(){this.engine.renderTrajectories()}onMoveEnd(){this.engine.renderTrajectories(),this.engine.isUpdateBboxOnMoveEnd&&this.engine.setBbox()}onRealtimeEngineRender(){if(this.map?.style){let t=Qf(this.map,this.pixelRatio),r=this.map.getSource(this.sourceId);r&&r.setCoordinates(t)}}onRemove(t,r){this.engine.detachFromMap(),this.stop(),t.off("load",this.onLoad),t.getLayer(this.layer.id)&&t.removeLayer(this.layer.id),t.getSource(this.sourceId)&&t.removeSource(this.sourceId),super.onRemove(t,r)}onZoomEnd(){this.engine.onZoomEnd()}start(){this.engine.start(),this.map?.on("move",this.onMove),this.map?.on("moveend",this.onMoveEnd),this.map?.on("zoomend",this.onZoomEnd)}stop(){this.engine.stop(),this.map?.off("move",this.onMove),this.map?.off("moveend",this.onMoveEnd),this.map?.off("zoomend",this.onZoomEnd)}},cS=j0;var N0={ol:Yf,maplibre:em};typeof window<"u"&&(window.mbt=N0);var V6=N0;})();
734
734
  /*! Bundled license information:
735
735
 
736
736
  maplibre-gl/dist/maplibre-gl.js: