mobility-toolbox-js 2.0.0-beta.54 → 2.0.0-beta.55
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.
- package/common/mixins/RealtimeLayerMixin.d.ts +7 -4
- package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -1
- package/common/mixins/RealtimeLayerMixin.js +32 -3
- package/mapbox/layers/RealtimeLayer.d.ts +3 -1
- package/mapbox/layers/RealtimeLayer.d.ts.map +1 -1
- package/mbt.js +20 -2
- package/mbt.js.map +2 -2
- package/mbt.min.js +1 -1
- package/mbt.min.js.map +2 -2
- package/ol/layers/RealtimeLayer.d.ts +4 -3
- package/ol/layers/RealtimeLayer.d.ts.map +1 -1
- package/package.json +1 -1
package/mbt.min.js
CHANGED
|
@@ -1079,5 +1079,5 @@ uniform ${se} ${pe} u_${xe};
|
|
|
1079
1079
|
`||N===V){s=Math.max(s,P),r.push(P),P=0,z+=F;continue}var _e=h[N+1]||y.font,Se=rg(_e,me);n.push(Se),P+=Se;var Ue=Sw(_e);u.push(Ue),F=Math.max(F,Ue)}return{width:s,height:z,widths:n,heights:u,lineWidths:r}}function Vx(y,h,n,u,r,s,P,z,F,N,V){y.save(),n!==1&&(y.globalAlpha*=n),h&&y.setTransform.apply(y,h),u.contextInstructions?(y.translate(F,N),y.scale(V[0],V[1]),Iw(u,y)):V[0]<0||V[1]<0?(y.translate(F,N),y.scale(V[0],V[1]),y.drawImage(u,r,s,P,z,0,0,P,z)):y.drawImage(u,r,s,P,z,F,N,P*V[0],z*V[1]),y.restore()}function Iw(y,h){for(var n=y.contextInstructions,u=0,r=n.length;u<r;u+=2)Array.isArray(n[u+1])?h[n[u]].apply(h,n[u+1]):h[n[u]]=n[u+1]}var Cw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Aw=function(y){Cw(h,y);function h(n){var u=this,r=n.rotateWithView!==void 0?n.rotateWithView:!1;return u=y.call(this,{opacity:1,rotateWithView:r,rotation:n.rotation!==void 0?n.rotation:0,scale:n.scale!==void 0?n.scale:1,displacement:n.displacement!==void 0?n.displacement:[0,0]})||this,u.canvas_=void 0,u.hitDetectionCanvas_=null,u.fill_=n.fill!==void 0?n.fill:null,u.origin_=[0,0],u.points_=n.points,u.radius_=n.radius!==void 0?n.radius:n.radius1,u.radius2_=n.radius2,u.angle_=n.angle!==void 0?n.angle:0,u.stroke_=n.stroke!==void 0?n.stroke:null,u.size_=null,u.renderOptions_=null,u.render(),u}return h.prototype.clone=function(){var n=this.getScale(),u=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(n)?n.slice():n,displacement:this.getDisplacement().slice()});return u.setOpacity(this.getOpacity()),u},h.prototype.getAnchor=function(){var n=this.size_;if(!n)return null;var u=this.getDisplacement();return[n[0]/2-u[0],n[1]/2+u[1]]},h.prototype.getAngle=function(){return this.angle_},h.prototype.getFill=function(){return this.fill_},h.prototype.getHitDetectionImage=function(){return this.hitDetectionCanvas_||this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_},h.prototype.getImage=function(n){var u=this.canvas_[n];if(!u){var r=this.renderOptions_,s=Ja(r.size*n,r.size*n);this.draw_(r,s,n),u=s.canvas,this.canvas_[n]=u}return u},h.prototype.getPixelRatio=function(n){return n},h.prototype.getImageSize=function(){return this.size_},h.prototype.getImageState=function(){return qi.LOADED},h.prototype.getOrigin=function(){return this.origin_},h.prototype.getPoints=function(){return this.points_},h.prototype.getRadius=function(){return this.radius_},h.prototype.getRadius2=function(){return this.radius2_},h.prototype.getSize=function(){return this.size_},h.prototype.getStroke=function(){return this.stroke_},h.prototype.listenImageChange=function(n){},h.prototype.load=function(){},h.prototype.unlistenImageChange=function(n){},h.prototype.calculateLineJoinSize_=function(n,u,r){if(u===0||this.points_===1/0||n!=="bevel"&&n!=="miter")return u;var s=this.radius_,P=this.radius2_===void 0?s:this.radius2_;if(s<P){var z=s;s=P,P=z}var F=this.radius2_===void 0?this.points_:this.points_*2,N=2*Math.PI/F,V=P*Math.sin(N),me=Math.sqrt(P*P-V*V),_e=s-me,Se=Math.sqrt(V*V+_e*_e),Ue=Se/V;if(n==="miter"&&Ue<=r)return Ue*u;var He=u/2/Ue,Ie=u/2*(_e/Se),Ge=Math.sqrt((s+He)*(s+He)+Ie*Ie),et=Ge-s;if(this.radius2_===void 0||n==="bevel")return et*2;var rt=s*Math.sin(N),_t=Math.sqrt(s*s-rt*rt),yt=P-_t,ct=Math.sqrt(rt*rt+yt*yt),Tt=ct/rt;if(Tt<=r){var St=Tt*u/2-P-s;return 2*Math.max(et,St)}return et*2},h.prototype.createRenderOptions=function(){var n=Iu,u=0,r=null,s=0,P,z=0;this.stroke_&&(P=this.stroke_.getColor(),P===null&&(P=fc),P=Ts(P),z=this.stroke_.getWidth(),z===void 0&&(z=mc),r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset(),n=this.stroke_.getLineJoin(),n===void 0&&(n=Iu),u=this.stroke_.getMiterLimit(),u===void 0&&(u=pc));var F=this.calculateLineJoinSize_(n,z,u),N=Math.max(this.radius_,this.radius2_||0),V=Math.ceil(2*N+F);return{strokeStyle:P,strokeWidth:z,size:V,lineDash:r,lineDashOffset:s,lineJoin:n,miterLimit:u}},h.prototype.render=function(){this.renderOptions_=this.createRenderOptions();var n=this.renderOptions_.size;this.canvas_={},this.size_=[n,n]},h.prototype.draw_=function(n,u,r){if(u.scale(r,r),u.translate(n.size/2,n.size/2),this.createPath_(u),this.fill_){var s=this.fill_.getColor();s===null&&(s=Ss),u.fillStyle=Ts(s),u.fill()}this.stroke_&&(u.strokeStyle=n.strokeStyle,u.lineWidth=n.strokeWidth,u.setLineDash&&n.lineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.miterLimit=n.miterLimit,u.stroke())},h.prototype.createHitDetectionCanvas_=function(n){if(this.fill_){var u=this.fill_.getColor(),r=0;if(typeof u=="string"&&(u=Jh(u)),u===null?r=1:Array.isArray(u)&&(r=u.length===4?u[3]:1),r===0){var s=Ja(n.size,n.size);this.hitDetectionCanvas_=s.canvas,this.drawHitDetectionCanvas_(n,s)}}this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.getImage(1))},h.prototype.createPath_=function(n){var u=this.points_,r=this.radius_;if(u===1/0)n.arc(0,0,r,0,2*Math.PI);else{var s=this.radius2_===void 0?r:this.radius2_;this.radius2_!==void 0&&(u*=2);for(var P=this.angle_-Math.PI/2,z=2*Math.PI/u,F=0;F<u;F++){var N=P+F*z,V=F%2===0?r:s;n.lineTo(V*Math.cos(N),V*Math.sin(N))}n.closePath()}},h.prototype.drawHitDetectionCanvas_=function(n,u){u.translate(n.size/2,n.size/2),this.createPath_(u),u.fillStyle=Ss,u.fill(),this.stroke_&&(u.strokeStyle=n.strokeStyle,u.lineWidth=n.strokeWidth,n.lineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.miterLimit=n.miterLimit,u.stroke())},h}(eg),Gx=Aw;var Pw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Mw=function(y){Pw(h,y);function h(n){var u=n||{};return y.call(this,{points:1/0,fill:u.fill,radius:u.radius,stroke:u.stroke,scale:u.scale!==void 0?u.scale:1,rotation:u.rotation!==void 0?u.rotation:0,rotateWithView:u.rotateWithView!==void 0?u.rotateWithView:!1,displacement:u.displacement!==void 0?u.displacement:[0,0]})||this}return h.prototype.clone=function(){var n=this.getScale(),u=new h({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(n)?n.slice():n,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()});return u.setOpacity(this.getOpacity()),u},h.prototype.setRadius=function(n){this.radius_=n,this.render()},h}(Gx),xl=Mw;var lf=function(){function y(h){var n=h||{};this.geometry_=null,this.geometryFunction_=jx,n.geometry!==void 0&&this.setGeometry(n.geometry),this.fill_=n.fill!==void 0?n.fill:null,this.image_=n.image!==void 0?n.image:null,this.renderer_=n.renderer!==void 0?n.renderer:null,this.hitDetectionRenderer_=n.hitDetectionRenderer!==void 0?n.hitDetectionRenderer:null,this.stroke_=n.stroke!==void 0?n.stroke:null,this.text_=n.text!==void 0?n.text:null,this.zIndex_=n.zIndex}return y.prototype.clone=function(){var h=this.getGeometry();return h&&typeof h=="object"&&(h=h.clone()),new y({geometry:h,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer(),stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})},y.prototype.getRenderer=function(){return this.renderer_},y.prototype.setRenderer=function(h){this.renderer_=h},y.prototype.setHitDetectionRenderer=function(h){this.hitDetectionRenderer_=h},y.prototype.getHitDetectionRenderer=function(){return this.hitDetectionRenderer_},y.prototype.getGeometry=function(){return this.geometry_},y.prototype.getGeometryFunction=function(){return this.geometryFunction_},y.prototype.getFill=function(){return this.fill_},y.prototype.setFill=function(h){this.fill_=h},y.prototype.getImage=function(){return this.image_},y.prototype.setImage=function(h){this.image_=h},y.prototype.getStroke=function(){return this.stroke_},y.prototype.setStroke=function(h){this.stroke_=h},y.prototype.getText=function(){return this.text_},y.prototype.setText=function(h){this.text_=h},y.prototype.getZIndex=function(){return this.zIndex_},y.prototype.setGeometry=function(h){typeof h=="function"?this.geometryFunction_=h:typeof h=="string"?this.geometryFunction_=function(n){return n.get(h)}:h?h!==void 0&&(this.geometryFunction_=function(){return h}):this.geometryFunction_=jx,this.geometry_=h},y.prototype.setZIndex=function(h){this.zIndex_=h},y}();function qx(y){var h;if(typeof y=="function")h=y;else{var n;if(Array.isArray(y))n=y;else{En(typeof y.getZIndex=="function",41);var u=y;n=[u]}h=function(){return n}}return h}var i_=null;function Zx(y,h){if(!i_){var n=new Ks({color:"rgba(255,255,255,0.4)"}),u=new va({color:"#3399CC",width:1.25});i_=[new lf({image:new xl({fill:n,stroke:u,radius:5}),fill:n,stroke:u})]}return i_}function Xx(){var y={},h=[255,255,255,1],n=[0,153,255,1],u=3;return y[Mt.POLYGON]=[new lf({fill:new Ks({color:[255,255,255,.5]})})],y[Mt.MULTI_POLYGON]=y[Mt.POLYGON],y[Mt.LINE_STRING]=[new lf({stroke:new va({color:h,width:u+2})}),new lf({stroke:new va({color:n,width:u})})],y[Mt.MULTI_LINE_STRING]=y[Mt.LINE_STRING],y[Mt.CIRCLE]=y[Mt.POLYGON].concat(y[Mt.LINE_STRING]),y[Mt.POINT]=[new lf({image:new xl({radius:u*2,fill:new Ks({color:n}),stroke:new va({color:h,width:u/2})}),zIndex:1/0})],y[Mt.MULTI_POINT]=y[Mt.POINT],y[Mt.GEOMETRY_COLLECTION]=y[Mt.POLYGON].concat(y[Mt.LINE_STRING],y[Mt.POINT]),y}function jx(y){return y.getGeometry()}var Wl=lf;var Wx={POINT:"point",LINE:"line"};var Kx=Gp(a_(),1);var kw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),$x={RENDER_ORDER:"renderOrder"},Lw=function(y){kw(h,y);function h(n){var u=this,r=n||{},s=Ra({},r);return delete s.style,delete s.renderBuffer,delete s.updateWhileAnimating,delete s.updateWhileInteracting,u=y.call(this,s)||this,u.declutter_=r.declutter!==void 0?r.declutter:!1,u.renderBuffer_=r.renderBuffer!==void 0?r.renderBuffer:100,u.style_=null,u.styleFunction_=void 0,u.setStyle(r.style),u.updateWhileAnimating_=r.updateWhileAnimating!==void 0?r.updateWhileAnimating:!1,u.updateWhileInteracting_=r.updateWhileInteracting!==void 0?r.updateWhileInteracting:!1,u}return h.prototype.getDeclutter=function(){return this.declutter_},h.prototype.getFeatures=function(n){return y.prototype.getFeatures.call(this,n)},h.prototype.getRenderBuffer=function(){return this.renderBuffer_},h.prototype.getRenderOrder=function(){return this.get($x.RENDER_ORDER)},h.prototype.getStyle=function(){return this.style_},h.prototype.getStyleFunction=function(){return this.styleFunction_},h.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_},h.prototype.getUpdateWhileInteracting=function(){return this.updateWhileInteracting_},h.prototype.renderDeclutter=function(n){n.declutterTree||(n.declutterTree=new Kx.default(9)),this.getRenderer().renderDeclutter(n)},h.prototype.setRenderOrder=function(n){this.set($x.RENDER_ORDER,n)},h.prototype.setStyle=function(n){this.style_=n!==void 0?n:Zx,this.styleFunction_=n===null?void 0:qx(this.style_),this.changed()},h}(Hh),Hx=Lw;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],Cu=[md.STROKE],gc=[md.BEGIN_PATH],s_=[md.CLOSE_PATH],qr=md;var Rw=function(){function y(){}return y.prototype.drawCustom=function(h,n,u,r){},y.prototype.drawGeometry=function(h){},y.prototype.setStyle=function(h){},y.prototype.drawCircle=function(h,n){},y.prototype.drawFeature=function(h,n){},y.prototype.drawGeometryCollection=function(h,n){},y.prototype.drawLineString=function(h,n){},y.prototype.drawMultiLineString=function(h,n){},y.prototype.drawMultiPoint=function(h,n){},y.prototype.drawMultiPolygon=function(h,n){},y.prototype.drawPoint=function(h,n){},y.prototype.drawPolygon=function(h,n){},y.prototype.drawText=function(h,n){},y.prototype.setFillStrokeStyle=function(h,n){},y.prototype.setImageStyle=function(h,n){},y.prototype.setTextStyle=function(h,n){},y}(),ng=Rw;var zw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Dw=function(y){zw(h,y);function h(n,u,r,s){var P=y.call(this)||this;return P.tolerance=n,P.maxExtent=u,P.pixelRatio=s,P.maxLineWidth=0,P.resolution=r,P.beginGeometryInstruction1_=null,P.beginGeometryInstruction2_=null,P.bufferedMaxExtent_=null,P.instructions=[],P.coordinates=[],P.tmpCoordinate_=[],P.hitDetectionInstructions=[],P.state={},P}return h.prototype.applyPixelRatio=function(n){var u=this.pixelRatio;return u==1?n:n.map(function(r){return r*u})},h.prototype.appendFlatPointCoordinates=function(n,u){for(var r=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,P=this.coordinates,z=P.length,F=0,N=n.length;F<N;F+=u)s[0]=n[F],s[1]=n[F+1],Kp(r,s)&&(P[z++]=s[0],P[z++]=s[1]);return z},h.prototype.appendFlatLineCoordinates=function(n,u,r,s,P,z){var F=this.coordinates,N=F.length,V=this.getBufferedMaxExtent();z&&(u+=s);var me=n[u],_e=n[u+1],Se=this.tmpCoordinate_,Ue=!0,He,Ie,Ge;for(He=u+s;He<r;He+=s)Se[0]=n[He],Se[1]=n[He+1],Ge=Bm(V,Se),Ge!==Ie?(Ue&&(F[N++]=me,F[N++]=_e,Ue=!1),F[N++]=Se[0],F[N++]=Se[1]):Ge===ko.INTERSECTING?(F[N++]=Se[0],F[N++]=Se[1],Ue=!1):Ue=!0,me=Se[0],_e=Se[1],Ie=Ge;return(P&&Ue||He===u+s)&&(F[N++]=me,F[N++]=_e),N},h.prototype.drawCustomCoordinates_=function(n,u,r,s,P){for(var z=0,F=r.length;z<F;++z){var N=r[z],V=this.appendFlatLineCoordinates(n,u,N,s,!1,!1);P.push(V),u=N}return u},h.prototype.drawCustom=function(n,u,r,s){this.beginGeometry(n,u);var P=n.getType(),z=n.getStride(),F=this.coordinates.length,N,V,me,_e,Se;switch(P){case Mt.MULTI_POLYGON:N=n.getOrientedFlatCoordinates(),_e=[];var Ue=n.getEndss();Se=0;for(var He=0,Ie=Ue.length;He<Ie;++He){var Ge=[];Se=this.drawCustomCoordinates_(N,Se,Ue[He],z,Ge),_e.push(Ge)}this.instructions.push([qr.CUSTOM,F,_e,n,r,hd]),this.hitDetectionInstructions.push([qr.CUSTOM,F,_e,n,s||r,hd]);break;case Mt.POLYGON:case Mt.MULTI_LINE_STRING:me=[],N=P==Mt.POLYGON?n.getOrientedFlatCoordinates():n.getFlatCoordinates(),Se=this.drawCustomCoordinates_(N,0,n.getEnds(),z,me),this.instructions.push([qr.CUSTOM,F,me,n,r,ph]),this.hitDetectionInstructions.push([qr.CUSTOM,F,me,n,s||r,ph]);break;case Mt.LINE_STRING:case Mt.CIRCLE:N=n.getFlatCoordinates(),V=this.appendFlatLineCoordinates(N,0,N.length,z,!1,!1),this.instructions.push([qr.CUSTOM,F,V,n,r,vl]),this.hitDetectionInstructions.push([qr.CUSTOM,F,V,n,s||r,vl]);break;case Mt.MULTI_POINT:N=n.getFlatCoordinates(),V=this.appendFlatPointCoordinates(N,z),V>F&&(this.instructions.push([qr.CUSTOM,F,V,n,r,vl]),this.hitDetectionInstructions.push([qr.CUSTOM,F,V,n,s||r,vl]));break;case Mt.POINT:N=n.getFlatCoordinates(),this.coordinates.push(N[0],N[1]),V=this.coordinates.length,this.instructions.push([qr.CUSTOM,F,V,n,r]),this.hitDetectionInstructions.push([qr.CUSTOM,F,V,n,s||r]);break;default:}this.endGeometry(u)},h.prototype.beginGeometry=function(n,u){this.beginGeometryInstruction1_=[qr.BEGIN_GEOMETRY,u,0,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[qr.BEGIN_GEOMETRY,u,0,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},h.prototype.finish=function(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}},h.prototype.reverseHitDetectionInstructions=function(){var n=this.hitDetectionInstructions;n.reverse();var u,r=n.length,s,P,z=-1;for(u=0;u<r;++u)s=n[u],P=s[0],P==qr.END_GEOMETRY?z=u:P==qr.BEGIN_GEOMETRY&&(s[2]=u,vv(this.hitDetectionInstructions,z,u),z=-1)},h.prototype.setFillStrokeStyle=function(n,u){var r=this.state;if(n){var s=n.getColor();r.fillStyle=Ts(s||Ss)}else r.fillStyle=void 0;if(u){var P=u.getColor();r.strokeStyle=Ts(P||fc);var z=u.getLineCap();r.lineCap=z!==void 0?z:Qh;var F=u.getLineDash();r.lineDash=F?F.slice():cc;var N=u.getLineDashOffset();r.lineDashOffset=N||hc;var V=u.getLineJoin();r.lineJoin=V!==void 0?V:Iu;var me=u.getWidth();r.lineWidth=me!==void 0?me:mc;var _e=u.getMiterLimit();r.miterLimit=_e!==void 0?_e:pc,r.lineWidth>this.maxLineWidth&&(this.maxLineWidth=r.lineWidth,this.bufferedMaxExtent_=null)}else r.strokeStyle=void 0,r.lineCap=void 0,r.lineDash=null,r.lineDashOffset=void 0,r.lineJoin=void 0,r.lineWidth=void 0,r.miterLimit=void 0},h.prototype.createFill=function(n){var u=n.fillStyle,r=[qr.SET_FILL_STYLE,u];return typeof u!="string"&&r.push(!0),r},h.prototype.applyStroke=function(n){this.instructions.push(this.createStroke(n))},h.prototype.createStroke=function(n){return[qr.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth*this.pixelRatio,n.lineCap,n.lineJoin,n.miterLimit,this.applyPixelRatio(n.lineDash),n.lineDashOffset*this.pixelRatio]},h.prototype.updateFillStyle=function(n,u){var r=n.fillStyle;(typeof r!="string"||n.currentFillStyle!=r)&&(r!==void 0&&this.instructions.push(u.call(this,n)),n.currentFillStyle=r)},h.prototype.updateStrokeStyle=function(n,u){var r=n.strokeStyle,s=n.lineCap,P=n.lineDash,z=n.lineDashOffset,F=n.lineJoin,N=n.lineWidth,V=n.miterLimit;(n.currentStrokeStyle!=r||n.currentLineCap!=s||P!=n.currentLineDash&&!_s(n.currentLineDash,P)||n.currentLineDashOffset!=z||n.currentLineJoin!=F||n.currentLineWidth!=N||n.currentMiterLimit!=V)&&(r!==void 0&&u.call(this,n),n.currentStrokeStyle=r,n.currentLineCap=s,n.currentLineDash=P,n.currentLineDashOffset=z,n.currentLineJoin=F,n.currentLineWidth=N,n.currentMiterLimit=V)},h.prototype.endGeometry=function(n){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var u=[qr.END_GEOMETRY,n];this.instructions.push(u),this.hitDetectionInstructions.push(u)},h.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=qv(this.maxExtent),this.maxLineWidth>0)){var n=this.resolution*(this.maxLineWidth+1)/2;yl(this.bufferedMaxExtent_,n,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},h}(ng),Au=Dw;var Ow=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Fw=function(y){Ow(h,y);function h(n,u,r,s){var P=y.call(this,n,u,r,s)||this;return P.hitDetectionImage_=null,P.image_=null,P.imagePixelRatio_=void 0,P.anchorX_=void 0,P.anchorY_=void 0,P.height_=void 0,P.opacity_=void 0,P.originX_=void 0,P.originY_=void 0,P.rotateWithView_=void 0,P.rotation_=void 0,P.scale_=void 0,P.width_=void 0,P.declutterImageWithText_=void 0,P}return h.prototype.drawPoint=function(n,u){if(!!this.image_){this.beginGeometry(n,u);var r=n.getFlatCoordinates(),s=n.getStride(),P=this.coordinates.length,z=this.appendFlatPointCoordinates(r,s);this.instructions.push([qr.DRAW_IMAGE,P,z,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,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.declutterImageWithText_]),this.hitDetectionInstructions.push([qr.DRAW_IMAGE,P,z,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(u)}},h.prototype.drawMultiPoint=function(n,u){if(!!this.image_){this.beginGeometry(n,u);var r=n.getFlatCoordinates(),s=n.getStride(),P=this.coordinates.length,z=this.appendFlatPointCoordinates(r,s);this.instructions.push([qr.DRAW_IMAGE,P,z,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,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.declutterImageWithText_]),this.hitDetectionInstructions.push([qr.DRAW_IMAGE,P,z,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(u)}},h.prototype.finish=function(){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,y.prototype.finish.call(this)},h.prototype.setImageStyle=function(n,u){var r=n.getAnchor(),s=n.getSize(),P=n.getHitDetectionImage(),z=n.getImage(this.pixelRatio),F=n.getOrigin();this.imagePixelRatio_=n.getPixelRatio(this.pixelRatio),this.anchorX_=r[0],this.anchorY_=r[1],this.hitDetectionImage_=P,this.image_=z,this.height_=s[1],this.opacity_=n.getOpacity(),this.originX_=F[0]*this.imagePixelRatio_,this.originY_=F[1]*this.imagePixelRatio_,this.rotateWithView_=n.getRotateWithView(),this.rotation_=n.getRotation(),this.scale_=n.getScaleArray(),this.width_=s[0],this.declutterImageWithText_=u},h}(Au),Yx=Fw;var Bw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Uw=function(y){Bw(h,y);function h(n,u,r,s){return y.call(this,n,u,r,s)||this}return h.prototype.drawFlatCoordinates_=function(n,u,r,s){var P=this.coordinates.length,z=this.appendFlatLineCoordinates(n,u,r,s,!1,!1),F=[qr.MOVE_TO_LINE_TO,P,z];return this.instructions.push(F),this.hitDetectionInstructions.push(F),r},h.prototype.drawLineString=function(n,u){var r=this.state,s=r.strokeStyle,P=r.lineWidth;if(!(s===void 0||P===void 0)){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(n,u),this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,cc,hc],gc);var z=n.getFlatCoordinates(),F=n.getStride();this.drawFlatCoordinates_(z,0,z.length,F),this.hitDetectionInstructions.push(Cu),this.endGeometry(u)}},h.prototype.drawMultiLineString=function(n,u){var r=this.state,s=r.strokeStyle,P=r.lineWidth;if(!(s===void 0||P===void 0)){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(n,u),this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset],gc);for(var z=n.getEnds(),F=n.getFlatCoordinates(),N=n.getStride(),V=0,me=0,_e=z.length;me<_e;++me)V=this.drawFlatCoordinates_(F,V,z[me],N);this.hitDetectionInstructions.push(Cu),this.endGeometry(u)}},h.prototype.finish=function(){var n=this.state;return n.lastStroke!=null&&n.lastStroke!=this.coordinates.length&&this.instructions.push(Cu),this.reverseHitDetectionInstructions(),this.state=null,y.prototype.finish.call(this)},h.prototype.applyStroke=function(n){n.lastStroke!=null&&n.lastStroke!=this.coordinates.length&&(this.instructions.push(Cu),n.lastStroke=this.coordinates.length),n.lastStroke=0,y.prototype.applyStroke.call(this,n),this.instructions.push(gc)},h}(Au),Jx=Uw;var Nw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Vw=function(y){Nw(h,y);function h(n,u,r,s){return y.call(this,n,u,r,s)||this}return h.prototype.drawFlatCoordinatess_=function(n,u,r,s){var P=this.state,z=P.fillStyle!==void 0,F=P.strokeStyle!==void 0,N=r.length;this.instructions.push(gc),this.hitDetectionInstructions.push(gc);for(var V=0;V<N;++V){var me=r[V],_e=this.coordinates.length,Se=this.appendFlatLineCoordinates(n,u,me,s,!0,!F),Ue=[qr.MOVE_TO_LINE_TO,_e,Se];this.instructions.push(Ue),this.hitDetectionInstructions.push(Ue),F&&(this.instructions.push(s_),this.hitDetectionInstructions.push(s_)),u=me}return z&&(this.instructions.push(gd),this.hitDetectionInstructions.push(gd)),F&&(this.instructions.push(Cu),this.hitDetectionInstructions.push(Cu)),u},h.prototype.drawCircle=function(n,u){var r=this.state,s=r.fillStyle,P=r.strokeStyle;if(!(s===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(n,u),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_FILL_STYLE,Ss]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset]);var z=n.getFlatCoordinates(),F=n.getStride(),N=this.coordinates.length;this.appendFlatLineCoordinates(z,0,z.length,F,!1,!1);var V=[qr.CIRCLE,N];this.instructions.push(gc,V),this.hitDetectionInstructions.push(gc,V),r.fillStyle!==void 0&&(this.instructions.push(gd),this.hitDetectionInstructions.push(gd)),r.strokeStyle!==void 0&&(this.instructions.push(Cu),this.hitDetectionInstructions.push(Cu)),this.endGeometry(u)}},h.prototype.drawPolygon=function(n,u){var r=this.state,s=r.fillStyle,P=r.strokeStyle;if(!(s===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(n,u),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_FILL_STYLE,Ss]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset]);var z=n.getEnds(),F=n.getOrientedFlatCoordinates(),N=n.getStride();this.drawFlatCoordinatess_(F,0,z,N),this.endGeometry(u)}},h.prototype.drawMultiPolygon=function(n,u){var r=this.state,s=r.fillStyle,P=r.strokeStyle;if(!(s===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(n,u),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_FILL_STYLE,Ss]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset]);for(var z=n.getEndss(),F=n.getOrientedFlatCoordinates(),N=n.getStride(),V=0,me=0,_e=z.length;me<_e;++me)V=this.drawFlatCoordinatess_(F,V,z[me],N);this.endGeometry(u)}},h.prototype.finish=function(){this.reverseHitDetectionInstructions(),this.state=null;var n=this.tolerance;if(n!==0)for(var u=this.coordinates,r=0,s=u.length;r<s;++r)u[r]=hh(u[r],n);return y.prototype.finish.call(this)},h.prototype.setFillStrokeStyles_=function(){var n=this.state,u=n.fillStyle;u!==void 0&&this.updateFillStyle(n,this.createFill),n.strokeStyle!==void 0&&this.updateStrokeStyle(n,this.applyStroke)},h}(Au),l_=Vw;function Qx(y,h,n,u,r){var s=n,P=n,z=0,F=0,N=n,V,me,_e,Se,Ue,He,Ie,Ge,et,rt;for(me=n;me<u;me+=r){var _t=h[me],yt=h[me+1];Ue!==void 0&&(et=_t-Ue,rt=yt-He,Se=Math.sqrt(et*et+rt*rt),Ie!==void 0&&(F+=_e,V=Math.acos((Ie*et+Ge*rt)/(_e*Se)),V>y&&(F>z&&(z=F,s=N,P=me),F=0,N=me-r)),_e=Se,Ie=et,Ge=rt),Ue=_t,He=yt}return F+=Se,F>z?[N,me]:[s,P]}var Gw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),yd={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},jw=function(y){Gw(h,y);function h(n,u,r,s){var P=y.call(this,n,u,r,s)||this;return P.labels_=null,P.text_="",P.textOffsetX_=0,P.textOffsetY_=0,P.textRotateWithView_=void 0,P.textRotation_=0,P.textFillState_=null,P.fillStates={},P.textStrokeState_=null,P.strokeStates={},P.textState_={},P.textStates={},P.textKey_="",P.fillKey_="",P.strokeKey_="",P.declutterImageWithText_=void 0,P}return h.prototype.finish=function(){var n=y.prototype.finish.call(this);return n.textStates=this.textStates,n.fillStates=this.fillStates,n.strokeStates=this.strokeStates,n},h.prototype.drawText=function(n,u){var r=this.textFillState_,s=this.textStrokeState_,P=this.textState_;if(!(this.text_===""||!P||!r&&!s)){var z=this.coordinates,F=z.length,N=n.getType(),V=null,me=n.getStride();if(P.placement===Wx.LINE&&(N==Mt.LINE_STRING||N==Mt.MULTI_LINE_STRING||N==Mt.POLYGON||N==Mt.MULTI_POLYGON)){if(!Lo(this.getBufferedMaxExtent(),n.getExtent()))return;var _e=void 0;if(V=n.getFlatCoordinates(),N==Mt.LINE_STRING)_e=[V.length];else if(N==Mt.MULTI_LINE_STRING)_e=n.getEnds();else if(N==Mt.POLYGON)_e=n.getEnds().slice(0,1);else if(N==Mt.MULTI_POLYGON){var Se=n.getEndss();_e=[];for(var Ue=0,He=Se.length;Ue<He;++Ue)_e.push(Se[Ue][0])}this.beginGeometry(n,u);for(var Ie=P.textAlign,Ge=0,et=void 0,rt=0,_t=_e.length;rt<_t;++rt){if(Ie==null){var yt=Qx(P.maxAngle,V,Ge,_e[rt],me);Ge=yt[0],et=yt[1]}else et=_e[rt];for(var Ue=Ge;Ue<et;Ue+=me)z.push(V[Ue],V[Ue+1]);var ct=z.length;Ge=_e[rt],this.drawChars_(F,ct),F=ct}this.endGeometry(u)}else{var Tt=P.overflow?null:[];switch(N){case Mt.POINT:case Mt.MULTI_POINT:V=n.getFlatCoordinates();break;case Mt.LINE_STRING:V=n.getFlatMidpoint();break;case Mt.CIRCLE:V=n.getCenter();break;case Mt.MULTI_LINE_STRING:V=n.getFlatMidpoints(),me=2;break;case Mt.POLYGON:V=n.getFlatInteriorPoint(),P.overflow||Tt.push(V[2]/this.resolution),me=3;break;case Mt.MULTI_POLYGON:var St=n.getFlatInteriorPoints();V=[];for(var Ue=0,He=St.length;Ue<He;Ue+=3)P.overflow||Tt.push(St[Ue+2]/this.resolution),V.push(St[Ue],St[Ue+1]);if(V.length===0)return;me=2;break;default:}var ct=this.appendFlatPointCoordinates(V,me);if(ct===F)return;if(Tt&&(ct-F)/2!==V.length/me){var Lt=F/2;Tt=Tt.filter(function(br,Sr){var xr=z[(Lt+Sr)*2]===V[Sr*me]&&z[(Lt+Sr)*2+1]===V[Sr*me+1];return xr||--Lt,xr})}this.saveTextStates_(),(P.backgroundFill||P.backgroundStroke)&&(this.setFillStrokeStyle(P.backgroundFill,P.backgroundStroke),P.backgroundFill&&(this.updateFillStyle(this.state,this.createFill),this.hitDetectionInstructions.push(this.createFill(this.state))),P.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(n,u);var nr=P.padding;if(nr!=dc&&(P.scale[0]<0||P.scale[1]<0)){var jt=P.padding[0],Jt=P.padding[1],or=P.padding[2],At=P.padding[3];P.scale[0]<0&&(Jt=-Jt,At=-At),P.scale[1]<0&&(jt=-jt,or=-or),nr=[jt,Jt,or,At]}var Vr=this.pixelRatio;this.instructions.push([qr.DRAW_IMAGE,F,ct,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterImageWithText_,nr==dc?dc:nr.map(function(br){return br*Vr}),!!P.backgroundFill,!!P.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,Tt]);var Er=1/Vr;this.hitDetectionInstructions.push([qr.DRAW_IMAGE,F,ct,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[Er,Er],NaN,this.declutterImageWithText_,nr,!!P.backgroundFill,!!P.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,Tt]),this.endGeometry(u)}}},h.prototype.saveTextStates_=function(){var n=this.textStrokeState_,u=this.textState_,r=this.textFillState_,s=this.strokeKey_;n&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:n.strokeStyle,lineCap:n.lineCap,lineDashOffset:n.lineDashOffset,lineWidth:n.lineWidth,lineJoin:n.lineJoin,miterLimit:n.miterLimit,lineDash:n.lineDash}));var P=this.textKey_;P in this.textStates||(this.textStates[P]={font:u.font,textAlign:u.textAlign||mh,textBaseline:u.textBaseline||ep,scale:u.scale});var z=this.fillKey_;r&&(z in this.fillStates||(this.fillStates[z]={fillStyle:r.fillStyle}))},h.prototype.drawChars_=function(n,u){var r=this.textStrokeState_,s=this.textState_,P=this.strokeKey_,z=this.textKey_,F=this.fillKey_;this.saveTextStates_();var N=this.pixelRatio,V=yd[s.textBaseline],me=this.textOffsetY_*N,_e=this.text_,Se=r?r.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([qr.DRAW_CHARS,n,u,V,s.overflow,F,s.maxAngle,N,me,P,Se*N,_e,z,1]),this.hitDetectionInstructions.push([qr.DRAW_CHARS,n,u,V,s.overflow,F,s.maxAngle,1,me,P,Se,_e,z,1/N])},h.prototype.setTextStyle=function(n,u){var r,s,P;if(!n)this.text_="";else{var z=n.getFill();z?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=Ts(z.getColor()||Ss)):(s=null,this.textFillState_=s);var F=n.getStroke();if(!F)P=null,this.textStrokeState_=P;else{P=this.textStrokeState_,P||(P={},this.textStrokeState_=P);var N=F.getLineDash(),V=F.getLineDashOffset(),me=F.getWidth(),_e=F.getMiterLimit();P.lineCap=F.getLineCap()||Qh,P.lineDash=N?N.slice():cc,P.lineDashOffset=V===void 0?hc:V,P.lineJoin=F.getLineJoin()||Iu,P.lineWidth=me===void 0?mc:me,P.miterLimit=_e===void 0?pc:_e,P.strokeStyle=Ts(F.getColor()||fc)}r=this.textState_;var Se=n.getFont()||ig;Bx(Se);var Ue=n.getScaleArray();r.overflow=n.getOverflow(),r.font=Se,r.maxAngle=n.getMaxAngle(),r.placement=n.getPlacement(),r.textAlign=n.getTextAlign(),r.textBaseline=n.getTextBaseline()||ep,r.backgroundFill=n.getBackgroundFill(),r.backgroundStroke=n.getBackgroundStroke(),r.padding=n.getPadding()||dc,r.scale=Ue===void 0?[1,1]:Ue;var He=n.getOffsetX(),Ie=n.getOffsetY(),Ge=n.getRotateWithView(),et=n.getRotation();this.text_=n.getText()||"",this.textOffsetX_=He===void 0?0:He,this.textOffsetY_=Ie===void 0?0:Ie,this.textRotateWithView_=Ge===void 0?!1:Ge,this.textRotation_=et===void 0?0:et,this.strokeKey_=P?(typeof P.strokeStyle=="string"?P.strokeStyle:Ai(P.strokeStyle))+P.lineCap+P.lineDashOffset+"|"+P.lineWidth+P.lineJoin+P.miterLimit+"["+P.lineDash.join()+"]":"",this.textKey_=r.font+r.scale+(r.textAlign||"?")+(r.textBaseline||"?"),this.fillKey_=s?typeof s.fillStyle=="string"?s.fillStyle:"|"+Ai(s.fillStyle):""}this.declutterImageWithText_=u},h}(Au),e0=jw;var qw={Circle:l_,Default:Au,Image:Yx,LineString:Jx,Polygon:l_,Text:e0},Zw=function(){function y(h,n,u,r){this.tolerance_=h,this.maxExtent_=n,this.pixelRatio_=r,this.resolution_=u,this.buildersByZIndex_={}}return y.prototype.finish=function(){var h={};for(var n in this.buildersByZIndex_){h[n]=h[n]||{};var u=this.buildersByZIndex_[n];for(var r in u){var s=u[r].finish();h[n][r]=s}}return h},y.prototype.getBuilder=function(h,n){var u=h!==void 0?h.toString():"0",r=this.buildersByZIndex_[u];r===void 0&&(r={},this.buildersByZIndex_[u]=r);var s=r[n];if(s===void 0){var P=qw[n];s=new P(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[n]=s}return s},y}(),u_=Zw;var Xw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Ww=function(y){Xw(h,y);function h(n){var u=y.call(this)||this;return u.ready=!0,u.boundHandleImageChange_=u.handleImageChange_.bind(u),u.layer_=n,u.declutterExecutorGroup=null,u}return h.prototype.getFeatures=function(n){return jr()},h.prototype.getData=function(n){return null},h.prototype.prepareFrame=function(n){return jr()},h.prototype.renderFrame=function(n,u){return jr()},h.prototype.loadedTileCallback=function(n,u,r){n[u]||(n[u]={}),n[u][r.tileCoord.toString()]=r},h.prototype.createLoadedTileFinder=function(n,u,r){return function(s,P){var z=this.loadedTileCallback.bind(this,r,s);return n.forEachLoadedTile(u,s,P,z)}.bind(this)},h.prototype.forEachFeatureAtCoordinate=function(n,u,r,s,P){},h.prototype.getDataAtPixel=function(n,u,r){return null},h.prototype.getLayer=function(){return this.layer_},h.prototype.handleFontsChanged=function(){},h.prototype.handleImageChange_=function(n){var u=n.target;u.getState()===qi.LOADED&&this.renderIfReadyAndVisible()},h.prototype.loadImage=function(n){var u=n.getState();return u!=qi.LOADED&&u!=qi.ERROR&&n.addEventListener(Ji.CHANGE,this.boundHandleImageChange_),u==qi.IDLE&&(n.load(),u=n.getState()),u==qi.LOADED},h.prototype.renderIfReadyAndVisible=function(){var n=this.getLayer();n.getVisible()&&n.getSourceState()==Su.READY&&n.changed()},h.prototype.disposeInternal=function(){delete this.layer_,y.prototype.disposeInternal.call(this)},h}(Mm),t0=Ww;var $w=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Kw=function(y){$w(h,y);function h(n,u,r,s){var P=y.call(this,n)||this;return P.inversePixelTransform=u,P.frameState=r,P.context=s,P}return h}(sn),r0=Kw;var Hw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),_d=null;function Yw(){var y=document.createElement("canvas");y.width=1,y.height=1,_d=y.getContext("2d")}var Jw=function(y){Hw(h,y);function h(n){var u=y.call(this,n)||this;return u.container=null,u.renderedResolution,u.tempTransform=za(),u.pixelTransform=za(),u.inversePixelTransform=za(),u.context=null,u.containerReused=!1,u.pixelContext_=null,u.frameState=null,u}return h.prototype.getImageData=function(n,u,r){_d||Yw(),_d.clearRect(0,0,1,1);var s;try{_d.drawImage(n,u,r,1,1,0,0,1,1),s=_d.getImageData(0,0,1,1).data}catch{return null}return s},h.prototype.getBackground=function(n){var u=this.getLayer(),r=u.getBackground();return typeof r=="function"&&(r=r(n.viewState.resolution)),r||void 0},h.prototype.useContainer=function(n,u,r,s){var P=this.getLayer().getClassName(),z,F;if(n&&n.className===P&&n.style.opacity===""&&r===1&&(!s||n.style.backgroundColor&&_s(Jh(n.style.backgroundColor),Jh(s)))){var N=n.firstElementChild;N instanceof HTMLCanvasElement&&(F=N.getContext("2d"))}if(F&&F.canvas.style.transform===u?(this.container=n,this.context=F,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){z=document.createElement("div"),z.className=P;var V=z.style;V.position="absolute",V.width="100%",V.height="100%",s&&(V.backgroundColor=s),F=Ja();var N=F.canvas;z.appendChild(N),V=N.style,V.position="absolute",V.left="0",V.transformOrigin="top left",this.container=z,this.context=F}},h.prototype.clipUnrotated=function(n,u,r){var s=xy(r),P=by(r),z=vy(r),F=_y(r);bo(u.coordinateToPixelTransform,s),bo(u.coordinateToPixelTransform,P),bo(u.coordinateToPixelTransform,z),bo(u.coordinateToPixelTransform,F);var N=this.inversePixelTransform;bo(N,s),bo(N,P),bo(N,z),bo(N,F),n.save(),n.beginPath(),n.moveTo(Math.round(s[0]),Math.round(s[1])),n.lineTo(Math.round(P[0]),Math.round(P[1])),n.lineTo(Math.round(z[0]),Math.round(z[1])),n.lineTo(Math.round(F[0]),Math.round(F[1])),n.clip()},h.prototype.dispatchRenderEvent_=function(n,u,r){var s=this.getLayer();if(s.hasListener(n)){var P=new r0(n,this.inversePixelTransform,r,u);s.dispatchEvent(P)}},h.prototype.preRender=function(n,u){this.frameState=u,this.dispatchRenderEvent_(nd.PRERENDER,n,u)},h.prototype.postRender=function(n,u){this.dispatchRenderEvent_(nd.POSTRENDER,n,u)},h.prototype.getRenderTransform=function(n,u,r,s,P,z,F){var N=P/2,V=z/2,me=s/u,_e=-me,Se=-n[0]+F,Ue=-n[1];return vs(this.tempTransform,N,V,me,_e,-r,Se,Ue)},h.prototype.getDataAtPixel=function(n,u,r){var s=bo(this.inversePixelTransform,n.slice()),P=this.context,z=this.getLayer(),F=z.getExtent();if(F){var N=bo(u.pixelToCoordinateTransform,n.slice());if(!Kp(F,N))return null}var V=Math.round(s[0]),me=Math.round(s[1]),_e=this.pixelContext_;if(!_e){var Se=document.createElement("canvas");Se.width=1,Se.height=1,_e=Se.getContext("2d"),this.pixelContext_=_e}_e.clearRect(0,0,1,1);var Ue;try{_e.drawImage(P.canvas,V,me,1,1,0,0,1,1),Ue=_e.getImageData(0,0,1,1).data}catch(He){return He.name==="SecurityError"?(this.pixelContext_=null,new Uint8Array):Ue}return Ue[3]===0?null:Ue},h.prototype.disposeInternal=function(){delete this.frameState,y.prototype.disposeInternal.call(this)},h}(t0),i0=Jw;var On={CIRCLE:"Circle",DEFAULT:"Default",IMAGE:"Image",LINE_STRING:"LineString",POLYGON:"Polygon",TEXT:"Text"};function n0(y,h,n,u,r,s,P,z,F,N,V,me){var _e=y[h],Se=y[h+1],Ue=0,He=0,Ie=0,Ge=0;function et(){Ue=_e,He=Se,h+=u,_e=y[h],Se=y[h+1],Ge+=Ie,Ie=Math.sqrt((_e-Ue)*(_e-Ue)+(Se-He)*(Se-He))}do et();while(h<n-u&&Ge+Ie<s);for(var rt=Ie===0?0:(s-Ge)/Ie,_t=gl(Ue,_e,rt),yt=gl(He,Se,rt),ct=h-u,Tt=Ge,St=s+z*F(N,r,V);h<n-u&&Ge+Ie<St;)et();rt=Ie===0?0:(St-Ge)/Ie;var Lt=gl(Ue,_e,rt),nr=gl(He,Se,rt),jt;if(me){var Jt=[_t,yt,Lt,nr];Wm(Jt,0,4,2,me,Jt,Jt),jt=Jt[0]>Jt[2]}else jt=_t>Lt;var or=Math.PI,At=[],Vr=ct+u===h;h=ct,Ie=0,Ge=Tt,_e=y[h],Se=y[h+1];var Er;if(Vr){et(),Er=Math.atan2(Se-He,_e-Ue),jt&&(Er+=Er>0?-or:or);var zr=(Lt+_t)/2,br=(nr+yt)/2;return At[0]=[zr,br,(St-s)/2,Er,r],At}for(var Sr=0,xr=r.length;Sr<xr;){et();var Qr=Math.atan2(Se-He,_e-Ue);if(jt&&(Qr+=Qr>0?-or:or),Er!==void 0){var Vt=Qr-Er;if(Vt+=Vt>or?-2*or:Vt<-or?2*or:0,Math.abs(Vt)>P)return null}Er=Qr;for(var Yr=Sr,vi=0;Sr<xr;++Sr){var di=jt?xr-Sr-1:Sr,en=z*F(N,r[di],V);if(h+u<n&&Ge+Ie<s+vi+en/2)break;vi+=en}if(Sr!==Yr){var Br=jt?r.substring(xr-Yr,xr-Sr):r.substring(Yr,Sr);rt=Ie===0?0:(s+vi/2-Ge)/Ie;var zr=gl(Ue,_e,rt),br=gl(He,Se,rt);At.push([zr,br,vi/2,Qr,Br]),s+=vi}}return At}var uf=Ya(),gh=[],yc=[],_c=[],yh=[];function o0(y){return y[3].declutterBox}var Qw=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function a0(y,h){return(h==="start"||h==="end")&&!Qw.test(y)&&(h=h==="start"?"left":"right"),yd[h]}function e2(y,h,n){return n>0&&y.push(`
|
|
1080
1080
|
`,""),y.push(h,""),y}var t2=function(){function y(h,n,u,r){this.overlaps=u,this.pixelRatio=n,this.resolution=h,this.alignFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=za(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={}}return y.prototype.createLabel=function(h,n,u,r){var s=h+n+u+r;if(this.labels_[s])return this.labels_[s];var P=r?this.strokeStates[r]:null,z=u?this.fillStates[u]:null,F=this.textStates[n],N=this.pixelRatio,V=[F.scale[0]*N,F.scale[1]*N],me=Array.isArray(h),_e=a0(me?h[0]:h,F.textAlign||mh),Se=r&&P.lineWidth?P.lineWidth:0,Ue=me?h:h.split(`
|
|
1081
1081
|
`).reduce(e2,[]),He=Nx(F,Ue),Ie=He.width,Ge=He.height,et=He.widths,rt=He.heights,_t=He.lineWidths,yt=Ie+Se,ct=[],Tt=(yt+2)*V[0],St=(Ge+Se)*V[1],Lt={width:Tt<0?Math.floor(Tt):Math.ceil(Tt),height:St<0?Math.floor(St):Math.ceil(St),contextInstructions:ct};if((V[0]!=1||V[1]!=1)&&ct.push("scale",V),r){ct.push("strokeStyle",P.strokeStyle),ct.push("lineWidth",Se),ct.push("lineCap",P.lineCap),ct.push("lineJoin",P.lineJoin),ct.push("miterLimit",P.miterLimit);var nr=ah?OffscreenCanvasRenderingContext2D:CanvasRenderingContext2D;nr.prototype.setLineDash&&(ct.push("setLineDash",[P.lineDash]),ct.push("lineDashOffset",P.lineDashOffset))}u&&ct.push("fillStyle",z.fillStyle),ct.push("textBaseline","middle"),ct.push("textAlign","center");for(var jt=.5-_e,Jt=_e*yt+jt*Se,or=[],At=[],Vr=0,Er=0,zr=0,br=0,Sr,xr=0,Qr=Ue.length;xr<Qr;xr+=2){var Vt=Ue[xr];if(Vt===`
|
|
1082
|
-
`){Er+=Vr,Vr=0,Jt=_e*yt+jt*Se,++br;continue}var Yr=Ue[xr+1]||F.font;Yr!==Sr&&(r&&or.push("font",Yr),u&&At.push("font",Yr),Sr=Yr),Vr=Math.max(Vr,rt[zr]);var vi=[Vt,Jt+jt*et[zr]+_e*(et[zr]-_t[br]),.5*(Se+Vr)+Er];Jt+=et[zr],r&&or.push("strokeText",vi),u&&At.push("fillText",vi),++zr}return Array.prototype.push.apply(ct,or),Array.prototype.push.apply(ct,At),this.labels_[s]=Lt,Lt},y.prototype.replayTextBackground_=function(h,n,u,r,s,P,z){h.beginPath(),h.moveTo.apply(h,n),h.lineTo.apply(h,u),h.lineTo.apply(h,r),h.lineTo.apply(h,s),h.lineTo.apply(h,n),P&&(this.alignFill_=P[2],this.fill_(h)),z&&(this.setStrokeStyle_(h,z),h.stroke())},y.prototype.calculateImageOrLabelDimensions_=function(h,n,u,r,s,P,z,F,N,V,me,_e,Se,Ue,He,Ie){z*=_e[0],F*=_e[1];var Ge=u-z,et=r-F,rt=s+N>h?h-N:s,_t=P+V>n?n-V:P,yt=Ue[3]+rt*_e[0]+Ue[1],ct=Ue[0]+_t*_e[1]+Ue[2],Tt=Ge-Ue[3],St=et-Ue[0];(He||me!==0)&&(gh[0]=Tt,yh[0]=Tt,gh[1]=St,yc[1]=St,yc[0]=Tt+yt,_c[0]=yc[0],_c[1]=St+ct,yh[1]=_c[1]);var Lt;return me!==0?(Lt=vs(za(),u,r,1,1,me,-u,-r),bo(Lt,gh),bo(Lt,yc),bo(Lt,_c),bo(Lt,yh),sh(Math.min(gh[0],yc[0],_c[0],yh[0]),Math.min(gh[1],yc[1],_c[1],yh[1]),Math.max(gh[0],yc[0],_c[0],yh[0]),Math.max(gh[1],yc[1],_c[1],yh[1]),uf)):sh(Math.min(Tt,Tt+yt),Math.min(St,St+ct),Math.max(Tt,Tt+yt),Math.max(St,St+ct),uf),Se&&(Ge=Math.round(Ge),et=Math.round(et)),{drawImageX:Ge,drawImageY:et,drawImageW:rt,drawImageH:_t,originX:N,originY:V,declutterBox:{minX:uf[0],minY:uf[1],maxX:uf[2],maxY:uf[3],value:Ie},canvasTransform:Lt,scale:_e}},y.prototype.replayImageOrLabel_=function(h,n,u,r,s,P,z){var F=!!(P||z),N=r.declutterBox,V=h.canvas,me=z?z[2]*r.scale[0]/2:0,_e=N.minX-me<=V.width/n&&N.maxX+me>=0&&N.minY-me<=V.height/n&&N.maxY+me>=0;return _e&&(F&&this.replayTextBackground_(h,gh,yc,_c,yh,P,z),Vx(h,r.canvasTransform,s,u,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0},y.prototype.fill_=function(h){if(this.alignFill_){var n=bo(this.renderedTransform_,[0,0]),u=512*this.pixelRatio;h.save(),h.translate(n[0]%u,n[1]%u),h.rotate(this.viewRotation_)}h.fill(),this.alignFill_&&h.restore()},y.prototype.setStrokeStyle_=function(h,n){h.strokeStyle=n[1],h.lineWidth=n[2],h.lineCap=n[3],h.lineJoin=n[4],h.miterLimit=n[5],h.setLineDash&&(h.lineDashOffset=n[7],h.setLineDash(n[6]))},y.prototype.drawLabelWithPointPlacement_=function(h,n,u,r){var s=this.textStates[n],P=this.createLabel(h,n,r,u),z=this.strokeStates[u],F=this.pixelRatio,N=a0(Array.isArray(h)?h[0]:h,s.textAlign||mh),V=yd[s.textBaseline||ep],me=z&&z.lineWidth?z.lineWidth:0,_e=P.width/F-2*s.scale[0],Se=N*_e+2*(.5-N)*me,Ue=V*P.height/F+2*(.5-V)*me;return{label:P,anchorX:Se,anchorY:Ue}},y.prototype.execute_=function(h,n,u,r,s,P,z,F){var N;this.pixelCoordinates_&&_s(u,this.renderedTransform_)?N=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),N=_l(this.coordinates,0,this.coordinates.length,2,u,this.pixelCoordinates_),Mv(this.renderedTransform_,u));for(var V=0,me=r.length,_e=0,Se,Ue,He,Ie,Ge,et,rt,_t,yt,ct,Tt,St,Lt=0,nr=0,jt=null,Jt=null,or=this.coordinateCache_,At=this.viewRotation_,Vr=Math.round(Math.atan2(-u[1],u[0])*1e12)/1e12,Er={context:h,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:At},zr=this.instructions!=r||this.overlaps?0:200,br,Sr,xr,Qr;V<me;){var Vt=r[V],Yr=Vt[0];switch(Yr){case qr.BEGIN_GEOMETRY:br=Vt[1],Qr=Vt[3],br.getGeometry()?z!==void 0&&!Lo(z,Qr.getExtent())?V=Vt[2]+1:++V:V=Vt[2];break;case qr.BEGIN_PATH:Lt>zr&&(this.fill_(h),Lt=0),nr>zr&&(h.stroke(),nr=0),!Lt&&!nr&&(h.beginPath(),Ie=NaN,Ge=NaN),++V;break;case qr.CIRCLE:_e=Vt[1];var vi=N[_e],di=N[_e+1],en=N[_e+2],Br=N[_e+3],Li=en-vi,Mn=Br-di,Ni=Math.sqrt(Li*Li+Mn*Mn);h.moveTo(vi+Ni,di),h.arc(vi,di,Ni,0,2*Math.PI,!0),++V;break;case qr.CLOSE_PATH:h.closePath(),++V;break;case qr.CUSTOM:_e=Vt[1],Se=Vt[2];var Cr=Vt[3],Xn=Vt[4],Zi=Vt.length==6?Vt[5]:void 0;Er.geometry=Cr,Er.feature=br,V in or||(or[V]=[]);var ln=or[V];Zi?Zi(N,_e,Se,2,ln):(ln[0]=N[_e],ln[1]=N[_e+1],ln.length=2),Xn(ln,Er),++V;break;case qr.DRAW_IMAGE:_e=Vt[1],Se=Vt[2],_t=Vt[3],Ue=Vt[4],He=Vt[5];var qo=Vt[6],Wn=Vt[7],Jr=Vt[8],un=Vt[9],$n=Vt[10],Kn=Vt[11],Fn=Vt[12],Xi=Vt[13],gn=Vt[14];if(!_t&&Vt.length>=19){yt=Vt[18],ct=Vt[19],Tt=Vt[20],St=Vt[21];var Tn=this.drawLabelWithPointPlacement_(yt,ct,Tt,St);_t=Tn.label,Vt[3]=_t;var wo=Vt[22];Ue=(Tn.anchorX-wo)*this.pixelRatio,Vt[4]=Ue;var wt=Vt[23];He=(Tn.anchorY-wt)*this.pixelRatio,Vt[5]=He,qo=_t.height,Vt[6]=qo,Xi=_t.width,Vt[13]=Xi}var Wt=void 0;Vt.length>24&&(Wt=Vt[24]);var ho=void 0,yn=void 0,Xr=void 0;Vt.length>16?(ho=Vt[15],yn=Vt[16],Xr=Vt[17]):(ho=dc,yn=!1,Xr=!1),$n&&Vr?Kn+=At:!$n&&!Vr&&(Kn-=At);for(var kn=0;_e<Se;_e+=2)if(!(Wt&&Wt[kn++]<Xi/this.pixelRatio)){var Oi=this.calculateImageOrLabelDimensions_(_t.width,_t.height,N[_e],N[_e+1],Xi,qo,Ue,He,Jr,un,Kn,Fn,s,ho,yn||Xr,br),dn=[h,n,_t,Oi,Wn,yn?jt:null,Xr?Jt:null],Hn=void 0,Zt=void 0;if(F&&gn){var Ur=Se-_e;if(!gn[Ur]){gn[Ur]=dn;continue}if(Hn=gn[Ur],delete gn[Ur],Zt=o0(Hn),F.collides(Zt))continue}F&&F.collides(Oi.declutterBox)||(Hn&&(F&&F.insert(Zt),this.replayImageOrLabel_.apply(this,Hn)),F&&F.insert(Oi.declutterBox),this.replayImageOrLabel_.apply(this,dn))}++V;break;case qr.DRAW_CHARS:var Dr=Vt[1],Vi=Vt[2],Sn=Vt[3],Ar=Vt[4];St=Vt[5];var ro=Vt[6],Wi=Vt[7],bi=Vt[8];Tt=Vt[9];var te=Vt[10];yt=Vt[11],ct=Vt[12];var he=[Vt[13],Vt[13]],de=this.textStates[ct],Te=de.font,Re=[de.scale[0]*Wi,de.scale[1]*Wi],We=void 0;Te in this.widths_?We=this.widths_[Te]:(We={},this.widths_[Te]=We);var Je=Qm(N,Dr,Vi,2),we=Math.abs(Re[0])*r_(Te,yt,We);if(Ar||we<=Je){var Ne=this.textStates[ct].textAlign,ie=(Je-we)*yd[Ne],X=n0(N,Dr,Vi,2,yt,ie,ro,Math.abs(Re[0]),r_,Te,We,Vr?0:this.viewRotation_);e:if(X){var J=[],re=void 0,le=void 0,Ae=void 0,ke=void 0,ge=void 0;if(Tt)for(re=0,le=X.length;re<le;++re){ge=X[re],Ae=ge[4],ke=this.createLabel(Ae,ct,"",Tt),Ue=ge[2]+(Re[0]<0?-te:te),He=Sn*ke.height+(.5-Sn)*2*te*Re[1]/Re[0]-bi;var Oi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ue,He,0,0,ge[3],he,!1,dc,!1,br);if(F&&F.collides(Oi.declutterBox))break e;J.push([h,n,ke,Oi,1,null,null])}if(St)for(re=0,le=X.length;re<le;++re){ge=X[re],Ae=ge[4],ke=this.createLabel(Ae,ct,St,""),Ue=ge[2],He=Sn*ke.height-bi;var Oi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ue,He,0,0,ge[3],he,!1,dc,!1,br);if(F&&F.collides(Oi.declutterBox))break e;J.push([h,n,ke,Oi,1,null,null])}F&&F.load(J.map(o0));for(var Ce=0,Le=J.length;Ce<Le;++Ce)this.replayImageOrLabel_.apply(this,J[Ce])}}++V;break;case qr.END_GEOMETRY:if(P!==void 0){br=Vt[1];var Ke=P(br,Qr);if(Ke)return Ke}++V;break;case qr.FILL:zr?Lt++:this.fill_(h),++V;break;case qr.MOVE_TO_LINE_TO:for(_e=Vt[1],Se=Vt[2],Sr=N[_e],xr=N[_e+1],et=Sr+.5|0,rt=xr+.5|0,(et!==Ie||rt!==Ge)&&(h.moveTo(Sr,xr),Ie=et,Ge=rt),_e+=2;_e<Se;_e+=2)Sr=N[_e],xr=N[_e+1],et=Sr+.5|0,rt=xr+.5|0,(_e==Se-2||et!==Ie||rt!==Ge)&&(h.lineTo(Sr,xr),Ie=et,Ge=rt);++V;break;case qr.SET_FILL_STYLE:jt=Vt,this.alignFill_=Vt[2],Lt&&(this.fill_(h),Lt=0,nr&&(h.stroke(),nr=0)),h.fillStyle=Vt[1],++V;break;case qr.SET_STROKE_STYLE:Jt=Vt,nr&&(h.stroke(),nr=0),this.setStrokeStyle_(h,Vt),++V;break;case qr.STROKE:zr?nr++:h.stroke(),++V;break;default:++V;break}}Lt&&this.fill_(h),nr&&h.stroke()},y.prototype.execute=function(h,n,u,r,s,P){this.viewRotation_=r,this.execute_(h,n,u,this.instructions,s,void 0,void 0,P)},y.prototype.executeHitDetection=function(h,n,u,r,s){return this.viewRotation_=u,this.execute_(h,1,n,this.hitDetectionInstructions,!0,r,s)},y}(),s0=t2;var c_=[On.POLYGON,On.CIRCLE,On.LINE_STRING,On.IMAGE,On.TEXT,On.DEFAULT],r2=function(){function y(h,n,u,r,s,P){this.maxExtent_=h,this.overlaps_=r,this.pixelRatio_=u,this.resolution_=n,this.renderBuffer_=P,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=za(),this.createExecutors_(s)}return y.prototype.clip=function(h,n){var u=this.getClipCoords(n);h.beginPath(),h.moveTo(u[0],u[1]),h.lineTo(u[2],u[3]),h.lineTo(u[4],u[5]),h.lineTo(u[6],u[7]),h.clip()},y.prototype.createExecutors_=function(h){for(var n in h){var u=this.executorsByZIndex_[n];u===void 0&&(u={},this.executorsByZIndex_[n]=u);var r=h[n];for(var s in r){var P=r[s];u[s]=new s0(this.resolution_,this.pixelRatio_,this.overlaps_,P)}}},y.prototype.hasExecutors=function(h){for(var n in this.executorsByZIndex_)for(var u=this.executorsByZIndex_[n],r=0,s=h.length;r<s;++r)if(h[r]in u)return!0;return!1},y.prototype.forEachFeatureAtCoordinate=function(h,n,u,r,s,P){r=Math.round(r);var z=r*2+1,F=vs(this.hitDetectionTransform_,r+.5,r+.5,1/n,-1/n,-u,-h[0],-h[1]),N=!this.hitDetectionContext_;N&&(this.hitDetectionContext_=Ja(z,z));var V=this.hitDetectionContext_;V.canvas.width!==z||V.canvas.height!==z?(V.canvas.width=z,V.canvas.height=z):N||V.clearRect(0,0,z,z);var me;this.renderBuffer_!==void 0&&(me=Ya(),gy(me,h),yl(me,n*(this.renderBuffer_+r),me));var _e=i2(r),Se;function Ue(ct,Tt){for(var St=V.getImageData(0,0,z,z).data,Lt=0,nr=_e.length;Lt<nr;Lt++)if(St[_e[Lt]]>0){if(!P||Se!==On.IMAGE&&Se!==On.TEXT||P.indexOf(ct)!==-1){var jt=(_e[Lt]-3)/4,Jt=r-jt%z,or=r-(jt/z|0),At=s(ct,Tt,Jt*Jt+or*or);if(At)return At}V.clearRect(0,0,z,z);break}}var He=Object.keys(this.executorsByZIndex_).map(Number);He.sort(rh);var Ie,Ge,et,rt,_t;for(Ie=He.length-1;Ie>=0;--Ie){var yt=He[Ie].toString();for(et=this.executorsByZIndex_[yt],Ge=c_.length-1;Ge>=0;--Ge)if(Se=c_[Ge],rt=et[Se],rt!==void 0&&(_t=rt.executeHitDetection(V,F,u,Ue,me),_t))return _t}},y.prototype.getClipCoords=function(h){var n=this.maxExtent_;if(!n)return null;var u=n[0],r=n[1],s=n[2],P=n[3],z=[u,r,u,P,s,P,s,r];return _l(z,0,8,2,h,z),z},y.prototype.isEmpty=function(){return Vl(this.executorsByZIndex_)},y.prototype.execute=function(h,n,u,r,s,P,z){var F=Object.keys(this.executorsByZIndex_).map(Number);F.sort(rh),this.maxExtent_&&(h.save(),this.clip(h,u));var N=P||c_,V,me,_e,Se,Ue,He;for(z&&F.reverse(),V=0,me=F.length;V<me;++V){var Ie=F[V].toString();for(Ue=this.executorsByZIndex_[Ie],_e=0,Se=N.length;_e<Se;++_e){var Ge=N[_e];He=Ue[Ge],He!==void 0&&He.execute(h,n,u,r,s,z)}}this.maxExtent_&&h.restore()},y}(),h_={};function i2(y){if(h_[y]!==void 0)return h_[y];for(var h=y*2+1,n=y*y,u=new Array(n+1),r=0;r<=y;++r)for(var s=0;s<=y;++s){var P=r*r+s*s;if(P>n)break;var z=u[P];z||(z=[],u[P]=z),z.push(((y+r)*h+(y+s))*4+3),r>0&&z.push(((y-r)*h+(y+s))*4+3),s>0&&(z.push(((y+r)*h+(y-s))*4+3),r>0&&z.push(((y-r)*h+(y-s))*4+3))}for(var F=[],r=0,N=u.length;r<N;++r)u[r]&&F.push.apply(F,u[r]);return h_[y]=F,F}var p_=r2;var vd={ANIMATING:0,INTERACTING:1};var n2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),o2=function(y){n2(h,y);function h(n,u,r,s,P,z,F){var N=y.call(this)||this;return N.context_=n,N.pixelRatio_=u,N.extent_=r,N.transform_=s,N.viewRotation_=P,N.squaredTolerance_=z,N.userTransform_=F,N.contextFillState_=null,N.contextStrokeState_=null,N.contextTextState_=null,N.fillState_=null,N.strokeState_=null,N.image_=null,N.imageAnchorX_=0,N.imageAnchorY_=0,N.imageHeight_=0,N.imageOpacity_=0,N.imageOriginX_=0,N.imageOriginY_=0,N.imageRotateWithView_=!1,N.imageRotation_=0,N.imageScale_=[0,0],N.imageWidth_=0,N.text_="",N.textOffsetX_=0,N.textOffsetY_=0,N.textRotateWithView_=!1,N.textRotation_=0,N.textScale_=[0,0],N.textFillState_=null,N.textStrokeState_=null,N.textState_=null,N.pixelCoordinates_=[],N.tmpLocalTransform_=za(),N}return h.prototype.drawImages_=function(n,u,r,s){if(!!this.image_){var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.tmpLocalTransform_,N=z.globalAlpha;this.imageOpacity_!=1&&(z.globalAlpha=N*this.imageOpacity_);var V=this.imageRotation_;this.imageRotateWithView_&&(V+=this.viewRotation_);for(var me=0,_e=P.length;me<_e;me+=2){var Se=P[me]-this.imageAnchorX_,Ue=P[me+1]-this.imageAnchorY_;if(V!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){var He=Se+this.imageAnchorX_,Ie=Ue+this.imageAnchorY_;vs(F,He,Ie,1,1,V,-He,-Ie),z.setTransform.apply(z,F),z.translate(He,Ie),z.scale(this.imageScale_[0],this.imageScale_[1]),z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),z.setTransform(1,0,0,1,0,0)}else z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,Se,Ue,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(z.globalAlpha=N)}},h.prototype.drawText_=function(n,u,r,s){if(!(!this.textState_||this.text_==="")){this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.textRotation_;for(this.textRotateWithView_&&(F+=this.viewRotation_);u<r;u+=s){var N=P[u]+this.textOffsetX_,V=P[u+1]+this.textOffsetY_;if(F!==0||this.textScale_[0]!=1||this.textScale_[1]!=1){var me=vs(this.tmpLocalTransform_,N,V,1,1,F,-N,-V);z.setTransform.apply(z,me),z.translate(N,V),z.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&z.strokeText(this.text_,0,0),this.textFillState_&&z.fillText(this.text_,0,0),z.setTransform(1,0,0,1,0,0)}else this.textStrokeState_&&z.strokeText(this.text_,N,V),this.textFillState_&&z.fillText(this.text_,N,V)}}},h.prototype.moveToLineTo_=function(n,u,r,s,P){var z=this.context_,F=_l(n,u,r,s,this.transform_,this.pixelCoordinates_);z.moveTo(F[0],F[1]);var N=F.length;P&&(N-=2);for(var V=2;V<N;V+=2)z.lineTo(F[V],F[V+1]);return P&&z.closePath(),r},h.prototype.drawRings_=function(n,u,r,s){for(var P=0,z=r.length;P<z;++P)u=this.moveToLineTo_(n,u,r[P],s,!0);return u},h.prototype.drawCircle=function(n){if(!!Lo(this.extent_,n.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=gx(n,this.transform_,this.pixelCoordinates_),r=u[2]-u[0],s=u[3]-u[1],P=Math.sqrt(r*r+s*s),z=this.context_;z.beginPath(),z.arc(u[0],u[1],P,0,2*Math.PI),this.fillState_&&z.fill(),this.strokeState_&&z.stroke()}this.text_!==""&&this.drawText_(n.getCenter(),0,2,2)}},h.prototype.setStyle=function(n){this.setFillStrokeStyle(n.getFill(),n.getStroke()),this.setImageStyle(n.getImage()),this.setTextStyle(n.getText())},h.prototype.setTransform=function(n){this.transform_=n},h.prototype.drawGeometry=function(n){var u=n.getType();switch(u){case Mt.POINT:this.drawPoint(n);break;case Mt.LINE_STRING:this.drawLineString(n);break;case Mt.POLYGON:this.drawPolygon(n);break;case Mt.MULTI_POINT:this.drawMultiPoint(n);break;case Mt.MULTI_LINE_STRING:this.drawMultiLineString(n);break;case Mt.MULTI_POLYGON:this.drawMultiPolygon(n);break;case Mt.GEOMETRY_COLLECTION:this.drawGeometryCollection(n);break;case Mt.CIRCLE:this.drawCircle(n);break;default:}},h.prototype.drawFeature=function(n,u){var r=u.getGeometryFunction()(n);!r||!Lo(this.extent_,r.getExtent())||(this.setStyle(u),this.drawGeometry(r))},h.prototype.drawGeometryCollection=function(n){for(var u=n.getGeometriesArray(),r=0,s=u.length;r<s;++r)this.drawGeometry(u[r])},h.prototype.drawPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},h.prototype.drawMultiPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},h.prototype.drawLineString=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lo(this.extent_,n.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getFlatCoordinates();u.beginPath(),this.moveToLineTo_(r,0,r.length,n.getStride(),!1),u.stroke()}if(this.text_!==""){var s=n.getFlatMidpoint();this.drawText_(s,0,2,2)}}},h.prototype.drawMultiLineString=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getExtent();if(!!Lo(this.extent_,u)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var r=this.context_,s=n.getFlatCoordinates(),P=0,z=n.getEnds(),F=n.getStride();r.beginPath();for(var N=0,V=z.length;N<V;++N)P=this.moveToLineTo_(s,P,z[N],F,!1);r.stroke()}if(this.text_!==""){var me=n.getFlatMidpoints();this.drawText_(me,0,me.length,2)}}},h.prototype.drawPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lo(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_;u.beginPath(),this.drawRings_(n.getOrientedFlatCoordinates(),0,n.getEnds(),n.getStride()),this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var r=n.getFlatInteriorPoint();this.drawText_(r,0,2,2)}}},h.prototype.drawMultiPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lo(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getOrientedFlatCoordinates(),s=0,P=n.getEndss(),z=n.getStride();u.beginPath();for(var F=0,N=P.length;F<N;++F){var V=P[F];s=this.drawRings_(r,s,V,z)}this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var me=n.getFlatInteriorPoints();this.drawText_(me,0,me.length,2)}}},h.prototype.setContextFillState_=function(n){var u=this.context_,r=this.contextFillState_;r?r.fillStyle!=n.fillStyle&&(r.fillStyle=n.fillStyle,u.fillStyle=n.fillStyle):(u.fillStyle=n.fillStyle,this.contextFillState_={fillStyle:n.fillStyle})},h.prototype.setContextStrokeState_=function(n){var u=this.context_,r=this.contextStrokeState_;r?(r.lineCap!=n.lineCap&&(r.lineCap=n.lineCap,u.lineCap=n.lineCap),u.setLineDash&&(_s(r.lineDash,n.lineDash)||u.setLineDash(r.lineDash=n.lineDash),r.lineDashOffset!=n.lineDashOffset&&(r.lineDashOffset=n.lineDashOffset,u.lineDashOffset=n.lineDashOffset)),r.lineJoin!=n.lineJoin&&(r.lineJoin=n.lineJoin,u.lineJoin=n.lineJoin),r.lineWidth!=n.lineWidth&&(r.lineWidth=n.lineWidth,u.lineWidth=n.lineWidth),r.miterLimit!=n.miterLimit&&(r.miterLimit=n.miterLimit,u.miterLimit=n.miterLimit),r.strokeStyle!=n.strokeStyle&&(r.strokeStyle=n.strokeStyle,u.strokeStyle=n.strokeStyle)):(u.lineCap=n.lineCap,u.setLineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.lineWidth=n.lineWidth,u.miterLimit=n.miterLimit,u.strokeStyle=n.strokeStyle,this.contextStrokeState_={lineCap:n.lineCap,lineDash:n.lineDash,lineDashOffset:n.lineDashOffset,lineJoin:n.lineJoin,lineWidth:n.lineWidth,miterLimit:n.miterLimit,strokeStyle:n.strokeStyle})},h.prototype.setContextTextState_=function(n){var u=this.context_,r=this.contextTextState_,s=n.textAlign?n.textAlign:mh;r?(r.font!=n.font&&(r.font=n.font,u.font=n.font),r.textAlign!=s&&(r.textAlign=s,u.textAlign=s),r.textBaseline!=n.textBaseline&&(r.textBaseline=n.textBaseline,u.textBaseline=n.textBaseline)):(u.font=n.font,u.textAlign=s,u.textBaseline=n.textBaseline,this.contextTextState_={font:n.font,textAlign:s,textBaseline:n.textBaseline})},h.prototype.setFillStrokeStyle=function(n,u){var r=this;if(!n)this.fillState_=null;else{var s=n.getColor();this.fillState_={fillStyle:Ts(s||Ss)}}if(!u)this.strokeState_=null;else{var P=u.getColor(),z=u.getLineCap(),F=u.getLineDash(),N=u.getLineDashOffset(),V=u.getLineJoin(),me=u.getWidth(),_e=u.getMiterLimit(),Se=F||cc;this.strokeState_={lineCap:z!==void 0?z:Qh,lineDash:this.pixelRatio_===1?Se:Se.map(function(Ue){return Ue*r.pixelRatio_}),lineDashOffset:(N||hc)*this.pixelRatio_,lineJoin:V!==void 0?V:Iu,lineWidth:(me!==void 0?me:mc)*this.pixelRatio_,miterLimit:_e!==void 0?_e:pc,strokeStyle:Ts(P||fc)}}},h.prototype.setImageStyle=function(n){var u;if(!n||!(u=n.getSize())){this.image_=null;return}var r=n.getAnchor(),s=n.getOrigin();this.image_=n.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*this.pixelRatio_,this.imageAnchorY_=r[1]*this.pixelRatio_,this.imageHeight_=u[1]*this.pixelRatio_,this.imageOpacity_=n.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=n.getRotateWithView(),this.imageRotation_=n.getRotation(),this.imageScale_=n.getScaleArray(),this.imageWidth_=u[0]*this.pixelRatio_},h.prototype.setTextStyle=function(n){if(!n)this.text_="";else{var u=n.getFill();if(!u)this.textFillState_=null;else{var r=u.getColor();this.textFillState_={fillStyle:Ts(r||Ss)}}var s=n.getStroke();if(!s)this.textStrokeState_=null;else{var P=s.getColor(),z=s.getLineCap(),F=s.getLineDash(),N=s.getLineDashOffset(),V=s.getLineJoin(),me=s.getWidth(),_e=s.getMiterLimit();this.textStrokeState_={lineCap:z!==void 0?z:Qh,lineDash:F||cc,lineDashOffset:N||hc,lineJoin:V!==void 0?V:Iu,lineWidth:me!==void 0?me:mc,miterLimit:_e!==void 0?_e:pc,strokeStyle:Ts(P||fc)}}var Se=n.getFont(),Ue=n.getOffsetX(),He=n.getOffsetY(),Ie=n.getRotateWithView(),Ge=n.getRotation(),et=n.getScaleArray(),rt=n.getText(),_t=n.getTextAlign(),yt=n.getTextBaseline();this.textState_={font:Se!==void 0?Se:ig,textAlign:_t!==void 0?_t:mh,textBaseline:yt!==void 0?yt:ep},this.text_=rt!==void 0?Array.isArray(rt)?rt.reduce(function(ct,Tt,St){return ct+=St%2?" ":Tt},""):rt:"",this.textOffsetX_=Ue!==void 0?this.pixelRatio_*Ue:0,this.textOffsetY_=He!==void 0?this.pixelRatio_*He:0,this.textRotateWithView_=Ie!==void 0?Ie:!1,this.textRotation_=Ge!==void 0?Ge:0,this.textScale_=[this.pixelRatio_*et[0],this.pixelRatio_*et[1]]}},h}(ng),l0=o2;var Pu={FRACTION:"fraction",PIXELS:"pixels"};var Hs={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var a2=function(){function y(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return y.prototype.clear=function(){this.cache_={},this.cacheSize_=0},y.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},y.prototype.expire=function(){if(this.canExpireCache()){var h=0;for(var n in this.cache_){var u=this.cache_[n];(h++&3)===0&&!u.hasListener()&&(delete this.cache_[n],--this.cacheSize_)}}},y.prototype.get=function(h,n,u){var r=u0(h,n,u);return r in this.cache_?this.cache_[r]:null},y.prototype.set=function(h,n,u,r){var s=u0(h,n,u);this.cache_[s]=r,++this.cacheSize_},y.prototype.setSize=function(h){this.maxCacheSize_=h,this.expire()},y}();function u0(y,h,n){var u=n?tg(n):"null";return h+":"+y+":"+u}var f_=new a2;var s2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),l2=function(y){s2(h,y);function h(n,u,r,s){var P=y.call(this)||this;return P.extent=n,P.pixelRatio_=r,P.resolution=u,P.state=s,P}return h.prototype.changed=function(){this.dispatchEvent(Ji.CHANGE)},h.prototype.getExtent=function(){return this.extent},h.prototype.getImage=function(){return jr()},h.prototype.getPixelRatio=function(){return this.pixelRatio_},h.prototype.getResolution=function(){return this.resolution},h.prototype.getState=function(){return this.state},h.prototype.load=function(){jr()},h}(nh),c0=l2;var u2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),dL=function(y){u2(h,y);function h(n,u,r,s,P,z){var F=y.call(this,n,u,r,qi.IDLE)||this;return F.src_=s,F.image_=new Image,P!==null&&(F.image_.crossOrigin=P),F.unlisten_=null,F.state=qi.IDLE,F.imageLoadFunction_=z,F}return h.prototype.getImage=function(){return this.image_},h.prototype.handleImageError_=function(){this.state=qi.ERROR,this.unlistenImage_(),this.changed()},h.prototype.handleImageLoad_=function(){this.resolution===void 0&&(this.resolution=Eu(this.extent)/this.image_.height),this.state=qi.LOADED,this.unlistenImage_(),this.changed()},h.prototype.load=function(){(this.state==qi.IDLE||this.state==qi.ERROR)&&(this.state=qi.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=d_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},h.prototype.setImage=function(n){this.image_=n,this.resolution=Eu(this.extent)/this.image_.height},h.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},h}(c0);function d_(y,h,n){var u=y,r=!0,s=!1,P=!1,z=[qp(u,Ji.LOAD,function(){P=!0,s||h()})];return u.src&&Av?(s=!0,u.decode().then(function(){r&&h()}).catch(function(F){r&&(P?h():n())})):z.push(qp(u,Ji.ERROR,n)),function(){r=!1,z.forEach(Po)}}var c2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),xd=null,h2=function(y){c2(h,y);function h(n,u,r,s,P,z){var F=y.call(this)||this;return F.hitDetectionImage_=null,F.image_=n||new Image,s!==null&&(F.image_.crossOrigin=s),F.canvas_={},F.color_=z,F.unlisten_=null,F.imageState_=P,F.size_=r,F.src_=u,F.tainted_,F}return h.prototype.isTainted_=function(){if(this.tainted_===void 0&&this.imageState_===qi.LOADED){xd||(xd=Ja(1,1)),xd.drawImage(this.image_,0,0);try{xd.getImageData(0,0,1,1),this.tainted_=!1}catch{xd=null,this.tainted_=!0}}return this.tainted_===!0},h.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(Ji.CHANGE)},h.prototype.handleImageError_=function(){this.imageState_=qi.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},h.prototype.handleImageLoad_=function(){this.imageState_=qi.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()},h.prototype.getImage=function(n){return this.replaceColor_(n),this.canvas_[n]?this.canvas_[n]:this.image_},h.prototype.getPixelRatio=function(n){return this.replaceColor_(n),this.canvas_[n]?n:1},h.prototype.getImageState=function(){return this.imageState_},h.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var n=this.size_[0],u=this.size_[1],r=Ja(n,u);r.fillRect(0,0,n,u),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},h.prototype.getSize=function(){return this.size_},h.prototype.getSrc=function(){return this.src_},h.prototype.load=function(){if(this.imageState_==qi.IDLE){this.imageState_=qi.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=d_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},h.prototype.replaceColor_=function(n){if(!(!this.color_||this.canvas_[n]||this.imageState_!==qi.LOADED)){var u=document.createElement("canvas");this.canvas_[n]=u,u.width=Math.ceil(this.image_.width*n),u.height=Math.ceil(this.image_.height*n);var r=u.getContext("2d");if(r.scale(n,n),r.drawImage(this.image_,0,0),r.globalCompositeOperation="multiply",r.globalCompositeOperation==="multiply"||this.isTainted_())r.fillStyle=tg(this.color_),r.fillRect(0,0,u.width/n,u.height/n),r.globalCompositeOperation="destination-in",r.drawImage(this.image_,0,0);else{for(var s=r.getImageData(0,0,u.width,u.height),P=s.data,z=this.color_[0]/255,F=this.color_[1]/255,N=this.color_[2]/255,V=this.color_[3],me=0,_e=P.length;me<_e;me+=4)P[me]*=z,P[me+1]*=F,P[me+2]*=N,P[me+3]*=V;r.putImageData(s,0,0)}}},h.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},h}(nh);function h0(y,h,n,u,r,s){var P=f_.get(h,u,s);return P||(P=new h2(y,h,n,u,r,s),f_.set(h,u,s,P)),P}var p2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),f2=function(y){p2(h,y);function h(n){var u=this,r=n||{},s=r.opacity!==void 0?r.opacity:1,P=r.rotation!==void 0?r.rotation:0,z=r.scale!==void 0?r.scale:1,F=r.rotateWithView!==void 0?r.rotateWithView:!1;u=y.call(this,{opacity:s,rotation:P,scale:z,displacement:r.displacement!==void 0?r.displacement:[0,0],rotateWithView:F})||this,u.anchor_=r.anchor!==void 0?r.anchor:[.5,.5],u.normalizedAnchor_=null,u.anchorOrigin_=r.anchorOrigin!==void 0?r.anchorOrigin:Hs.TOP_LEFT,u.anchorXUnits_=r.anchorXUnits!==void 0?r.anchorXUnits:Pu.FRACTION,u.anchorYUnits_=r.anchorYUnits!==void 0?r.anchorYUnits:Pu.FRACTION,u.crossOrigin_=r.crossOrigin!==void 0?r.crossOrigin:null;var N=r.img!==void 0?r.img:null;u.imgSize_=r.imgSize;var V=r.src;En(!(V!==void 0&&N),4),En(!N||N&&u.imgSize_,5),(V===void 0||V.length===0)&&N&&(V=N.src||Ai(N)),En(V!==void 0&&V.length>0,6);var me=r.src!==void 0?qi.IDLE:qi.LOADED;return u.color_=r.color!==void 0?Jh(r.color):null,u.iconImage_=h0(N,V,u.imgSize_!==void 0?u.imgSize_:null,u.crossOrigin_,me,u.color_),u.offset_=r.offset!==void 0?r.offset:[0,0],u.offsetOrigin_=r.offsetOrigin!==void 0?r.offsetOrigin:Hs.TOP_LEFT,u.origin_=null,u.size_=r.size!==void 0?r.size:null,u}return h.prototype.clone=function(){var n=this.getScale();return 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_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:Array.isArray(n)?n.slice():n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc()})},h.prototype.getAnchor=function(){var n=this.normalizedAnchor_;if(!n){n=this.anchor_;var u=this.getSize();if(this.anchorXUnits_==Pu.FRACTION||this.anchorYUnits_==Pu.FRACTION){if(!u)return null;n=this.anchor_.slice(),this.anchorXUnits_==Pu.FRACTION&&(n[0]*=u[0]),this.anchorYUnits_==Pu.FRACTION&&(n[1]*=u[1])}if(this.anchorOrigin_!=Hs.TOP_LEFT){if(!u)return null;n===this.anchor_&&(n=this.anchor_.slice()),(this.anchorOrigin_==Hs.TOP_RIGHT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(n[0]=-n[0]+u[0]),(this.anchorOrigin_==Hs.BOTTOM_LEFT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(n[1]=-n[1]+u[1])}this.normalizedAnchor_=n}var r=this.getDisplacement();return[n[0]-r[0],n[1]+r[1]]},h.prototype.setAnchor=function(n){this.anchor_=n,this.normalizedAnchor_=null},h.prototype.getColor=function(){return this.color_},h.prototype.getImage=function(n){return this.iconImage_.getImage(n)},h.prototype.getPixelRatio=function(n){return this.iconImage_.getPixelRatio(n)},h.prototype.getImageSize=function(){return this.iconImage_.getSize()},h.prototype.getImageState=function(){return this.iconImage_.getImageState()},h.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},h.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var n=this.offset_;if(this.offsetOrigin_!=Hs.TOP_LEFT){var u=this.getSize(),r=this.iconImage_.getSize();if(!u||!r)return null;n=n.slice(),(this.offsetOrigin_==Hs.TOP_RIGHT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(n[0]=r[0]-u[0]-n[0]),(this.offsetOrigin_==Hs.BOTTOM_LEFT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(n[1]=r[1]-u[1]-n[1])}return this.origin_=n,this.origin_},h.prototype.getSrc=function(){return this.iconImage_.getSrc()},h.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},h.prototype.listenImageChange=function(n){this.iconImage_.addEventListener(Ji.CHANGE,n)},h.prototype.load=function(){this.iconImage_.load()},h.prototype.unlistenImageChange=function(n){this.iconImage_.removeEventListener(Ji.CHANGE,n)},h}(eg),m_=f2;var $l=.5;function p0(y,h,n,u,r,s,P){var z=y[0]*$l,F=y[1]*$l,N=Ja(z,F);N.imageSmoothingEnabled=!1;for(var V=N.canvas,me=new l0(N,$l,r,null,P),_e=n.length,Se=Math.floor((256*256*256-1)/_e),Ue={},He=1;He<=_e;++He){var Ie=n[He-1],Ge=Ie.getStyleFunction()||u;if(!!u){var et=Ge(Ie,s);if(!!et){Array.isArray(et)||(et=[et]);for(var rt=He*Se,_t="#"+("000000"+rt.toString(16)).slice(-6),yt=0,ct=et.length;yt<ct;++yt){var Tt=et[yt],St=Tt.getGeometryFunction()(Ie);if(!(!St||!Lo(r,St.getExtent()))){var Lt=Tt.clone(),nr=Lt.getFill();nr&&nr.setColor(_t);var jt=Lt.getStroke();jt&&(jt.setColor(_t),jt.setLineDash(null)),Lt.setText(void 0);var Jt=Tt.getImage();if(Jt&&Jt.getOpacity()!==0){var or=Jt.getImageSize();if(!or)continue;var At=Ja(or[0],or[1],void 0,{alpha:!1}),Vr=At.canvas;At.fillStyle=_t,At.fillRect(0,0,Vr.width,Vr.height),Lt.setImage(new m_({img:Vr,imgSize:or,anchor:Jt.getAnchor(),anchorXUnits:Pu.PIXELS,anchorYUnits:Pu.PIXELS,offset:Jt.getOrigin(),opacity:1,size:Jt.getSize(),scale:Jt.getScale(),rotation:Jt.getRotation(),rotateWithView:Jt.getRotateWithView()}))}var Er=Lt.getZIndex()||0,zr=Ue[Er];zr||(zr={},Ue[Er]=zr,zr[Mt.POLYGON]=[],zr[Mt.CIRCLE]=[],zr[Mt.LINE_STRING]=[],zr[Mt.POINT]=[]),zr[St.getType().replace("Multi","")].push(St,Lt)}}}}}for(var br=Object.keys(Ue).map(Number).sort(rh),He=0,Sr=br.length;He<Sr;++He){var zr=Ue[br[He]];for(var xr in zr)for(var Qr=zr[xr],yt=0,ct=Qr.length;yt<ct;yt+=2){me.setStyle(Qr[yt+1]);for(var Vt=0,Yr=h.length;Vt<Yr;++Vt)me.setTransform(h[Vt]),me.drawGeometry(Qr[yt])}}return N.getImageData(0,0,V.width,V.height)}function f0(y,h,n){var u=[];if(n){var r=Math.floor(Math.round(y[0])*$l),s=Math.floor(Math.round(y[1])*$l),P=(jl(r,0,n.width-1)+jl(s,0,n.height-1)*n.width)*4,z=n.data[P],F=n.data[P+1],N=n.data[P+2],V=N+256*(F+256*z),me=Math.floor((256*256*256-1)/h.length);V&&V%me===0&&u.push(h[V/me-1])}return u}var d2=.5,d0={Point:b2,LineString:_2,Polygon:E2,MultiPoint:w2,MultiLineString:v2,MultiPolygon:x2,GeometryCollection:y2,Circle:m2};function m0(y,h){return parseInt(Ai(y),10)-parseInt(Ai(h),10)}function g0(y,h){var n=og(y,h);return n*n}function og(y,h){return d2*y/h}function m2(y,h,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),On.CIRCLE);z.setFillStrokeStyle(s,P),z.drawCircle(h,u)}var F=n.getText();if(F&&F.getText()){var N=(r||y).getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(F),N.drawText(h,u)}}function g_(y,h,n,u,r,s,P){var z=!1,F=n.getImage();if(F){var N=F.getImageState();N==qi.LOADED||N==qi.ERROR?F.unlistenImageChange(r):(N==qi.IDLE&&F.load(),N=F.getImageState(),F.listenImageChange(r),z=!0)}return g2(y,h,n,u,s,P),z}function g2(y,h,n,u,r,s){var P=n.getGeometryFunction()(h);if(!!P){var z=P.simplifyTransformed(u,r),F=n.getRenderer();if(F)y0(y,z,n,h);else{var N=d0[z.getType()];N(y,z,n,h,s)}}}function y0(y,h,n,u){if(h.getType()==Mt.GEOMETRY_COLLECTION){for(var r=h.getGeometries(),s=0,P=r.length;s<P;++s)y0(y,r[s],n,u);return}var z=y.getBuilder(n.getZIndex(),On.DEFAULT);z.drawCustom(h,u,n.getRenderer(),n.getHitDetectionRenderer())}function y2(y,h,n,u,r){var s=h.getGeometriesArray(),P,z;for(P=0,z=s.length;P<z;++P){var F=d0[s[P].getType()];F(y,s[P],n,u,r)}}function _2(y,h,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),On.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawLineString(h,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),On.TEXT);F.setTextStyle(z),F.drawText(h,u)}}function v2(y,h,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),On.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawMultiLineString(h,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),On.TEXT);F.setTextStyle(z),F.drawText(h,u)}}function x2(y,h,n,u,r){var s=n.getFill(),P=n.getStroke();if(P||s){var z=y.getBuilder(n.getZIndex(),On.POLYGON);z.setFillStrokeStyle(s,P),z.drawMultiPolygon(h,u)}var F=n.getText();if(F&&F.getText()){var N=(r||y).getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(F),N.drawText(h,u)}}function b2(y,h,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(y=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=qi.LOADED)return;var F=y.getBuilder(n.getZIndex(),On.IMAGE);F.setImageStyle(s,z),F.drawPoint(h,u)}if(P&&P.getText()){var N=y.getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(P,z),N.drawText(h,u)}}function w2(y,h,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(y=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=qi.LOADED)return;var F=y.getBuilder(n.getZIndex(),On.IMAGE);F.setImageStyle(s,z),F.drawMultiPoint(h,u)}if(P&&P.getText()){var N=(r||y).getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(P,z),N.drawText(h,u)}}function E2(y,h,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),On.POLYGON);z.setFillStrokeStyle(s,P),z.drawPolygon(h,u)}var F=n.getText();if(F&&F.getText()){var N=(r||y).getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(F),N.drawText(h,u)}}var T2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),S2=function(y){T2(h,y);function h(n){var u=y.call(this,n)||this;return u.boundHandleStyleImageChange_=u.handleStyleImageChange_.bind(u),u.animatingOrInteracting_,u.dirty_=!1,u.hitDetectionImageData_=null,u.renderedFeatures_=null,u.renderedRevision_=-1,u.renderedResolution_=NaN,u.renderedExtent_=Ya(),u.wrappedRenderedExtent_=Ya(),u.renderedRotation_,u.renderedCenter_=null,u.renderedProjection_=null,u.renderedRenderOrder_=null,u.replayGroup_=null,u.replayGroupChanged=!0,u.declutterExecutorGroup=null,u.clipping=!0,u}return h.prototype.renderWorlds=function(n,u,r){var s=u.extent,P=u.viewState,z=P.center,F=P.resolution,N=P.projection,V=P.rotation,me=N.getExtent(),_e=this.getLayer().getSource(),Se=u.pixelRatio,Ue=u.viewHints,He=!(Ue[vd.ANIMATING]||Ue[vd.INTERACTING]),Ie=this.context,Ge=Math.round(u.size[0]*Se),et=Math.round(u.size[1]*Se),rt=_e.getWrapX()&&N.canWrapX(),_t=rt?bs(me):null,yt=rt?Math.ceil((s[2]-me[2])/_t)+1:1,ct=rt?Math.floor((s[0]-me[0])/_t):0;do{var Tt=this.getRenderTransform(z,F,V,Se,Ge,et,ct*_t);n.execute(Ie,1,Tt,V,He,void 0,r)}while(++ct<yt)},h.prototype.renderDeclutter=function(n){this.declutterExecutorGroup&&this.renderWorlds(this.declutterExecutorGroup,n,n.declutterTree)},h.prototype.renderFrame=function(n,u){var r=n.pixelRatio,s=n.layerStatesArray[n.layerIndex];kv(this.pixelTransform,1/r,1/r),Rv(this.inversePixelTransform,this.pixelTransform);var P=py(this.pixelTransform);this.useContainer(u,P,s.opacity,this.getBackground(n));var z=this.context,F=z.canvas,N=this.replayGroup_,V=this.declutterExecutorGroup;if((!N||N.isEmpty())&&(!V||V.isEmpty()))return null;var me=Math.round(n.size[0]*r),_e=Math.round(n.size[1]*r);F.width!=me||F.height!=_e?(F.width=me,F.height=_e,F.style.transform!==P&&(F.style.transform=P)):this.containerReused||z.clearRect(0,0,me,_e),this.preRender(z,n);var Se=n.viewState,Ue=Se.projection,He=!1,Ie=!0;if(s.extent&&this.clipping){var Ge=rd(s.extent,Ue);Ie=Lo(Ge,n.extent),He=Ie&&!sc(Ge,n.extent),He&&this.clipUnrotated(z,n,Ge)}Ie&&this.renderWorlds(N,n),He&&z.restore(),this.postRender(z,n);var et=Fx(s.opacity),rt=this.container;return et!==rt.style.opacity&&(rt.style.opacity=et),this.renderedRotation_!==Se.rotation&&(this.renderedRotation_=Se.rotation,this.hitDetectionImageData_=null),this.container},h.prototype.getFeatures=function(n){return new Promise(function(u){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var r=[this.context.canvas.width,this.context.canvas.height];bo(this.pixelTransform,r);var s=this.renderedCenter_,P=this.renderedResolution_,z=this.renderedRotation_,F=this.renderedProjection_,N=this.wrappedRenderedExtent_,V=this.getLayer(),me=[],_e=r[0]*$l,Se=r[1]*$l;me.push(this.getRenderTransform(s,P,z,$l,_e,Se,0).slice());var Ue=V.getSource(),He=F.getExtent();if(Ue.getWrapX()&&F.canWrapX()&&!sc(He,N)){for(var Ie=N[0],Ge=bs(He),et=0,rt=void 0;Ie<He[0];)--et,rt=Ge*et,me.push(this.getRenderTransform(s,P,z,$l,_e,Se,rt).slice()),Ie+=Ge;for(et=0,Ie=N[2];Ie>He[2];)++et,rt=Ge*et,me.push(this.getRenderTransform(s,P,z,$l,_e,Se,rt).slice()),Ie-=Ge}this.hitDetectionImageData_=p0(r,me,this.renderedFeatures_,V.getStyleFunction(),N,P,z)}u(f0(n,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},h.prototype.forEachFeatureAtCoordinate=function(n,u,r,s,P){var z=this;if(!!this.replayGroup_){var F=u.viewState.resolution,N=u.viewState.rotation,V=this.getLayer(),me={},_e=function(He,Ie,Ge){var et=Ai(He),rt=me[et];if(rt){if(rt!==!0&&Ge<rt.distanceSq){if(Ge===0)return me[et]=!0,P.splice(P.lastIndexOf(rt),1),s(He,V,Ie);rt.geometry=Ie,rt.distanceSq=Ge}}else{if(Ge===0)return me[et]=!0,s(He,V,Ie);P.push(me[et]={feature:He,layer:V,geometry:Ie,distanceSq:Ge,callback:s})}},Se,Ue=[this.replayGroup_];return this.declutterExecutorGroup&&Ue.push(this.declutterExecutorGroup),Ue.some(function(He){return Se=He.forEachFeatureAtCoordinate(n,F,N,r,_e,He===z.declutterExecutorGroup&&u.declutterTree?u.declutterTree.all().map(function(Ie){return Ie.value}):null)}),Se}},h.prototype.handleFontsChanged=function(){var n=this.getLayer();n.getVisible()&&this.replayGroup_&&n.changed()},h.prototype.handleStyleImageChange_=function(n){this.renderIfReadyAndVisible()},h.prototype.prepareFrame=function(n){var u=this.getLayer(),r=u.getSource();if(!r)return!1;var s=n.viewHints[vd.ANIMATING],P=n.viewHints[vd.INTERACTING],z=u.getUpdateWhileAnimating(),F=u.getUpdateWhileInteracting();if(!this.dirty_&&!z&&s||!F&&P)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var N=n.extent,V=n.viewState,me=V.projection,_e=V.resolution,Se=n.pixelRatio,Ue=u.getRevision(),He=u.getRenderBuffer(),Ie=u.getRenderOrder();Ie===void 0&&(Ie=m0);var Ge=V.center.slice(),et=yl(N,He*_e),rt=et.slice(),_t=[et.slice()],yt=me.getExtent();if(r.getWrapX()&&me.canWrapX()&&!sc(yt,n.extent)){var ct=bs(yt),Tt=Math.max(bs(et)/2,ct);et[0]=yt[0]-Tt,et[2]=yt[2]+Tt,Qv(Ge,me);var St=Yv(_t[0],me);St[0]<yt[0]&&St[2]<yt[2]?_t.push([St[0]+ct,St[1],St[2]+ct,St[3]]):St[0]>yt[0]&&St[2]>yt[2]&&_t.push([St[0]-ct,St[1],St[2]-ct,St[3]])}if(!this.dirty_&&this.renderedResolution_==_e&&this.renderedRevision_==Ue&&this.renderedRenderOrder_==Ie&&sc(this.wrappedRenderedExtent_,et))return _s(this.renderedExtent_,rt)||(this.hitDetectionImageData_=null,this.renderedExtent_=rt),this.renderedCenter_=Ge,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var Lt=new u_(og(_e,Se),et,_e,Se),nr;this.getLayer().getDeclutter()&&(nr=new u_(og(_e,Se),et,_e,Se));var jt=uh(),Jt;if(jt){for(var or=0,At=_t.length;or<At;++or){var Vr=_t[or],Er=Qp(Vr,me);r.loadFeatures(Er,ix(_e,me),jt)}Jt=Vm(jt,me)}else for(var or=0,At=_t.length;or<At;++or)r.loadFeatures(_t[or],_e,me);var zr=g0(_e,Se),br=function(Yr){var vi,di=Yr.getStyleFunction()||u.getStyleFunction();if(di&&(vi=di(Yr,_e)),vi){var en=this.renderFeature(Yr,zr,vi,Lt,Jt,nr);this.dirty_=this.dirty_||en}}.bind(this),Sr=Qp(et,me),xr=r.getFeaturesInExtent(Sr);Ie&&xr.sort(Ie);for(var or=0,At=xr.length;or<At;++or)br(xr[or]);this.renderedFeatures_=xr;var Qr=Lt.finish(),Vt=new p_(et,_e,Se,r.getOverlaps(),Qr,u.getRenderBuffer());return nr&&(this.declutterExecutorGroup=new p_(et,_e,Se,r.getOverlaps(),nr.finish(),u.getRenderBuffer())),this.renderedResolution_=_e,this.renderedRevision_=Ue,this.renderedRenderOrder_=Ie,this.renderedExtent_=rt,this.wrappedRenderedExtent_=et,this.renderedCenter_=Ge,this.renderedProjection_=me,this.replayGroup_=Vt,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0},h.prototype.renderFeature=function(n,u,r,s,P,z){if(!r)return!1;var F=!1;if(Array.isArray(r))for(var N=0,V=r.length;N<V;++N)F=g_(s,n,r[N],u,this.boundHandleStyleImageChange_,P,z)||F;else F=g_(s,n,r,u,this.boundHandleStyleImageChange_,P,z);return F},h}(i0),_0=S2;var I2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),C2=function(y){I2(h,y);function h(n){return y.call(this,n)||this}return h.prototype.createRenderer=function(){return new _0(this)},h}(Hx),tp=C2;var v0=Gp(a_(),1);var A2=function(){function y(h){this.rbush_=new v0.default(h),this.items_={}}return y.prototype.insert=function(h,n){var u={minX:h[0],minY:h[1],maxX:h[2],maxY:h[3],value:n};this.rbush_.insert(u),this.items_[Ai(n)]=u},y.prototype.load=function(h,n){for(var u=new Array(n.length),r=0,s=n.length;r<s;r++){var P=h[r],z=n[r],F={minX:P[0],minY:P[1],maxX:P[2],maxY:P[3],value:z};u[r]=F,this.items_[Ai(z)]=F}this.rbush_.load(u)},y.prototype.remove=function(h){var n=Ai(h),u=this.items_[n];return delete this.items_[n],this.rbush_.remove(u)!==null},y.prototype.update=function(h,n){var u=this.items_[Ai(n)],r=[u.minX,u.minY,u.maxX,u.maxY];Nm(r,h)||(this.remove(n),this.insert(h,n))},y.prototype.getAll=function(){var h=this.rbush_.all();return h.map(function(n){return n.value})},y.prototype.getInExtent=function(h){var n={minX:h[0],minY:h[1],maxX:h[2],maxY:h[3]},u=this.rbush_.search(n);return u.map(function(r){return r.value})},y.prototype.forEach=function(h){return this.forEach_(this.getAll(),h)},y.prototype.forEachInExtent=function(h,n){return this.forEach_(this.getInExtent(h),n)},y.prototype.forEach_=function(h,n){for(var u,r=0,s=h.length;r<s;r++)if(u=n(h[r]),u)return u;return u},y.prototype.isEmpty=function(){return Vl(this.items_)},y.prototype.clear=function(){this.rbush_.clear(),this.items_={}},y.prototype.getExtent=function(h){var n=this.rbush_.toJSON();return sh(n.minX,n.minY,n.maxX,n.maxY,h)},y.prototype.concat=function(h){this.rbush_.load(h.rbush_.all());for(var n in h.items_)this.items_[n]=h.items_[n]},y}(),bd=A2;var P2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),M2=function(y){P2(h,y);function h(n){var u=y.call(this)||this;u.projection=ya(n.projection),u.attributions_=x0(n.attributions),u.attributionsCollapsible_=n.attributionsCollapsible!==void 0?n.attributionsCollapsible:!0,u.loading=!1,u.state_=n.state!==void 0?n.state:Su.READY,u.wrapX_=n.wrapX!==void 0?n.wrapX:!1,u.interpolate_=!!n.interpolate,u.viewResolver=null,u.viewRejector=null;var r=u;return u.viewPromise_=new Promise(function(s,P){r.viewResolver=s,r.viewRejector=P}),u}return h.prototype.getAttributions=function(){return this.attributions_},h.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},h.prototype.getProjection=function(){return this.projection},h.prototype.getResolutions=function(){return jr()},h.prototype.getView=function(){return this.viewPromise_},h.prototype.getState=function(){return this.state_},h.prototype.getWrapX=function(){return this.wrapX_},h.prototype.getInterpolate=function(){return this.interpolate_},h.prototype.refresh=function(){this.changed()},h.prototype.setAttributions=function(n){this.attributions_=x0(n),this.changed()},h.prototype.setState=function(n){this.state_=n,this.changed()},h}(Mo);function x0(y){return y?Array.isArray(y)?function(h){return y}:typeof y=="function"?y:function(h){return[y]}:null}var cf=M2;var Qa={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function b0(y,h){return[[-1/0,-1/0,1/0,1/0]]}var _h={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var k2=!1;function L2(y,h,n,u,r,s,P){var z=new XMLHttpRequest;z.open("GET",typeof y=="function"?y(n,u,r):y,!0),h.getType()==_h.ARRAY_BUFFER&&(z.responseType="arraybuffer"),z.withCredentials=k2,z.onload=function(F){if(!z.status||z.status>=200&&z.status<300){var N=h.getType(),V=void 0;N==_h.JSON||N==_h.TEXT?V=z.responseText:N==_h.XML?(V=z.responseXML,V||(V=new DOMParser().parseFromString(z.responseText,"application/xml"))):N==_h.ARRAY_BUFFER&&(V=z.response),V?s(h.readFeatures(V,{extent:n,featureProjection:r}),h.readProjection(V)):P()}else P()},z.onerror=P,z.send()}function y_(y,h){return function(n,u,r,s,P){var z=this;L2(y,h,n,u,r,function(F,N){z.addFeatures(F),s!==void 0&&s(F)},P||qh)}}var w0=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),vh=function(y){w0(h,y);function h(n,u,r){var s=y.call(this,n)||this;return s.feature=u,s.features=r,s}return h}(sn);var R2=function(y){w0(h,y);function h(n){var u=this,r=n||{};u=y.call(this,{attributions:r.attributions,interpolate:!0,projection:void 0,state:Su.READY,wrapX:r.wrapX!==void 0?r.wrapX:!0})||this,u.on,u.once,u.un,u.loader_=qh,u.format_=r.format,u.overlaps_=r.overlaps===void 0?!0:r.overlaps,u.url_=r.url,r.loader!==void 0?u.loader_=r.loader:u.url_!==void 0&&(En(u.format_,7),u.loader_=y_(u.url_,u.format_)),u.strategy_=r.strategy!==void 0?r.strategy:b0;var s=r.useSpatialIndex!==void 0?r.useSpatialIndex:!0;u.featuresRtree_=s?new bd:null,u.loadedExtentsRtree_=new bd,u.loadingExtentsCount_=0,u.nullGeometryFeatures_={},u.idIndex_={},u.uidIndex_={},u.featureChangeKeys_={},u.featuresCollection_=null;var P,z;return Array.isArray(r.features)?z=r.features:r.features&&(P=r.features,z=P.getArray()),!s&&P===void 0&&(P=new ch(z)),z!==void 0&&u.addFeaturesInternal(z),P!==void 0&&u.bindFeaturesCollection_(P),u}return h.prototype.addFeature=function(n){this.addFeatureInternal(n),this.changed()},h.prototype.addFeatureInternal=function(n){var u=Ai(n);if(!this.addToIndex_(u,n)){this.featuresCollection_&&this.featuresCollection_.remove(n);return}this.setupChangeEvents_(u,n);var r=n.getGeometry();if(r){var s=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,n)}else this.nullGeometryFeatures_[u]=n;this.dispatchEvent(new vh(Qa.ADDFEATURE,n))},h.prototype.setupChangeEvents_=function(n,u){this.featureChangeKeys_[n]=[uo(u,Ji.CHANGE,this.handleFeatureChange_,this),uo(u,jp.PROPERTYCHANGE,this.handleFeatureChange_,this)]},h.prototype.addToIndex_=function(n,u){var r=!0,s=u.getId();return s!==void 0&&(s.toString()in this.idIndex_?r=!1:this.idIndex_[s.toString()]=u),r&&(En(!(n in this.uidIndex_),30),this.uidIndex_[n]=u),r},h.prototype.addFeatures=function(n){this.addFeaturesInternal(n),this.changed()},h.prototype.addFeaturesInternal=function(n){for(var u=[],r=[],s=[],P=0,z=n.length;P<z;P++){var F=n[P],N=Ai(F);this.addToIndex_(N,F)&&r.push(F)}for(var P=0,V=r.length;P<V;P++){var F=r[P],N=Ai(F);this.setupChangeEvents_(N,F);var me=F.getGeometry();if(me){var _e=me.getExtent();u.push(_e),s.push(F)}else this.nullGeometryFeatures_[N]=F}if(this.featuresRtree_&&this.featuresRtree_.load(u,s),this.hasListener(Qa.ADDFEATURE))for(var P=0,Se=r.length;P<Se;P++)this.dispatchEvent(new vh(Qa.ADDFEATURE,r[P]))},h.prototype.bindFeaturesCollection_=function(n){var u=!1;this.addEventListener(Qa.ADDFEATURE,function(r){u||(u=!0,n.push(r.feature),u=!1)}),this.addEventListener(Qa.REMOVEFEATURE,function(r){u||(u=!0,n.remove(r.feature),u=!1)}),n.addEventListener(ws.ADD,function(r){u||(u=!0,this.addFeature(r.element),u=!1)}.bind(this)),n.addEventListener(ws.REMOVE,function(r){u||(u=!0,this.removeFeature(r.element),u=!1)}.bind(this)),this.featuresCollection_=n},h.prototype.clear=function(n){if(n){for(var u in this.featureChangeKeys_){var r=this.featureChangeKeys_[u];r.forEach(Po)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){var s=function(F){this.removeFeatureInternal(F)}.bind(this);this.featuresRtree_.forEach(s);for(var P in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[P])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};var z=new vh(Qa.CLEAR);this.dispatchEvent(z),this.changed()},h.prototype.forEachFeature=function(n){if(this.featuresRtree_)return this.featuresRtree_.forEach(n);this.featuresCollection_&&this.featuresCollection_.forEach(n)},h.prototype.forEachFeatureAtCoordinateDirect=function(n,u){var r=[n[0],n[1],n[0],n[1]];return this.forEachFeatureInExtent(r,function(s){var P=s.getGeometry();if(P.intersectsCoordinate(n))return u(s)})},h.prototype.forEachFeatureInExtent=function(n,u){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(n,u);this.featuresCollection_&&this.featuresCollection_.forEach(u)},h.prototype.forEachFeatureIntersectingExtent=function(n,u){return this.forEachFeatureInExtent(n,function(r){var s=r.getGeometry();if(s.intersectsExtent(n)){var P=u(r);if(P)return P}})},h.prototype.getFeaturesCollection=function(){return this.featuresCollection_},h.prototype.getFeatures=function(){var n;return this.featuresCollection_?n=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(n=this.featuresRtree_.getAll(),Vl(this.nullGeometryFeatures_)||Ka(n,Am(this.nullGeometryFeatures_))),n},h.prototype.getFeaturesAtCoordinate=function(n){var u=[];return this.forEachFeatureAtCoordinateDirect(n,function(r){u.push(r)}),u},h.prototype.getFeaturesInExtent=function(n){return this.featuresRtree_?this.featuresRtree_.getInExtent(n):this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]},h.prototype.getClosestFeatureToCoordinate=function(n,u){var r=n[0],s=n[1],P=null,z=[NaN,NaN],F=1/0,N=[-1/0,-1/0,1/0,1/0],V=u||Cm;return this.featuresRtree_.forEachInExtent(N,function(me){if(V(me)){var _e=me.getGeometry(),Se=F;if(F=_e.closestPointXY(r,s,z,F),F<Se){P=me;var Ue=Math.sqrt(F);N[0]=r-Ue,N[1]=s-Ue,N[2]=r+Ue,N[3]=s+Ue}}}),P},h.prototype.getExtent=function(n){return this.featuresRtree_.getExtent(n)},h.prototype.getFeatureById=function(n){var u=this.idIndex_[n.toString()];return u!==void 0?u:null},h.prototype.getFeatureByUid=function(n){var u=this.uidIndex_[n];return u!==void 0?u:null},h.prototype.getFormat=function(){return this.format_},h.prototype.getOverlaps=function(){return this.overlaps_},h.prototype.getUrl=function(){return this.url_},h.prototype.handleFeatureChange_=function(n){var u=n.target,r=Ai(u),s=u.getGeometry();if(!s)r in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(u),this.nullGeometryFeatures_[r]=u);else{var P=s.getExtent();r in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[r],this.featuresRtree_&&this.featuresRtree_.insert(P,u)):this.featuresRtree_&&this.featuresRtree_.update(P,u)}var z=u.getId();if(z!==void 0){var F=z.toString();this.idIndex_[F]!==u&&(this.removeFromIdIndex_(u),this.idIndex_[F]=u)}else this.removeFromIdIndex_(u),this.uidIndex_[r]=u;this.changed(),this.dispatchEvent(new vh(Qa.CHANGEFEATURE,u))},h.prototype.hasFeature=function(n){var u=n.getId();return u!==void 0?u in this.idIndex_:Ai(n)in this.uidIndex_},h.prototype.isEmpty=function(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Vl(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0},h.prototype.loadFeatures=function(n,u,r){for(var s=this.loadedExtentsRtree_,P=this.strategy_(n,u,r),z=function(me,_e){var Se=P[me],Ue=s.forEachInExtent(Se,function(He){return sc(He.extent,Se)});Ue||(++F.loadingExtentsCount_,F.dispatchEvent(new vh(Qa.FEATURESLOADSTART)),F.loader_.call(F,Se,u,r,function(He){--this.loadingExtentsCount_,this.dispatchEvent(new vh(Qa.FEATURESLOADEND,void 0,He))}.bind(F),function(){--this.loadingExtentsCount_,this.dispatchEvent(new vh(Qa.FEATURESLOADERROR))}.bind(F)),s.insert(Se,{extent:Se.slice()}))},F=this,N=0,V=P.length;N<V;++N)z(N,V);this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0},h.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),y.prototype.refresh.call(this)},h.prototype.removeLoadedExtent=function(n){var u=this.loadedExtentsRtree_,r;u.forEachInExtent(n,function(s){if(Nm(s.extent,n))return r=s,!0}),r&&u.remove(r)},h.prototype.removeFeature=function(n){if(!!n){var u=Ai(n);u in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[u]:this.featuresRtree_&&this.featuresRtree_.remove(n);var r=this.removeFeatureInternal(n);r&&this.changed()}},h.prototype.removeFeatureInternal=function(n){var u=Ai(n),r=this.featureChangeKeys_[u];if(!!r){r.forEach(Po),delete this.featureChangeKeys_[u];var s=n.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[u],this.dispatchEvent(new vh(Qa.REMOVEFEATURE,n)),n}},h.prototype.removeFromIdIndex_=function(n){var u=!1;for(var r in this.idIndex_)if(this.idIndex_[r]===n){delete this.idIndex_[r],u=!0;break}return u},h.prototype.setLoader=function(n){this.loader_=n},h.prototype.setUrl=function(n){En(this.format_,7),this.url_=n,this.setLoader(y_(n,this.format_))},h}(cf),rp=R2;var E0=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),hf=function(y){E0(h,y);function h(n,u){var r=y.call(this,n)||this;return r.layer=u,r}return h}(sn);var __={LAYERS:"layers"},z2=function(y){E0(h,y);function h(n){var u=this,r=n||{},s=Ra({},r);delete s.layers;var P=r.layers;return u=y.call(this,s)||this,u.on,u.once,u.un,u.layersListenerKeys_=[],u.listenerKeys_={},u.addChangeListener(__.LAYERS,u.handleLayersChanged_),P?Array.isArray(P)?P=new ch(P.slice(),{unique:!0}):En(typeof P.getArray=="function",43):P=new ch(void 0,{unique:!0}),u.setLayers(P),u}return h.prototype.handleLayerChange_=function(){this.changed()},h.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(Po),this.layersListenerKeys_.length=0;var n=this.getLayers();this.layersListenerKeys_.push(uo(n,ws.ADD,this.handleLayersAdd_,this),uo(n,ws.REMOVE,this.handleLayersRemove_,this));for(var u in this.listenerKeys_)this.listenerKeys_[u].forEach(Po);ih(this.listenerKeys_);for(var r=n.getArray(),s=0,P=r.length;s<P;s++){var z=r[s];this.registerLayerListeners_(z),this.dispatchEvent(new hf("addlayer",z))}this.changed()},h.prototype.registerLayerListeners_=function(n){var u=[uo(n,jp.PROPERTYCHANGE,this.handleLayerChange_,this),uo(n,Ji.CHANGE,this.handleLayerChange_,this)];n instanceof h&&u.push(uo(n,"addlayer",this.handleLayerGroupAdd_,this),uo(n,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[Ai(n)]=u},h.prototype.handleLayerGroupAdd_=function(n){this.dispatchEvent(new hf("addlayer",n.layer))},h.prototype.handleLayerGroupRemove_=function(n){this.dispatchEvent(new hf("removelayer",n.layer))},h.prototype.handleLayersAdd_=function(n){var u=n.element;this.registerLayerListeners_(u),this.dispatchEvent(new hf("addlayer",u)),this.changed()},h.prototype.handleLayersRemove_=function(n){var u=n.element,r=Ai(u);this.listenerKeys_[r].forEach(Po),delete this.listenerKeys_[r],this.dispatchEvent(new hf("removelayer",u)),this.changed()},h.prototype.getLayers=function(){return this.get(__.LAYERS)},h.prototype.setLayers=function(n){var u=this.getLayers();if(u)for(var r=u.getArray(),s=0,P=r.length;s<P;++s)this.dispatchEvent(new hf("removelayer",r[s]));this.set(__.LAYERS,n)},h.prototype.getLayersArray=function(n){var u=n!==void 0?n:[];return this.getLayers().forEach(function(r){r.getLayersArray(u)}),u},h.prototype.getLayerStatesArray=function(n){var u=n!==void 0?n:[],r=u.length;this.getLayers().forEach(function(V){V.getLayerStatesArray(u)});var s=this.getLayerState(),P=s.zIndex;!n&&s.zIndex===void 0&&(P=0);for(var z=r,F=u.length;z<F;z++){var N=u[z];N.opacity*=s.opacity,N.visible=N.visible&&s.visible,N.maxResolution=Math.min(N.maxResolution,s.maxResolution),N.minResolution=Math.max(N.minResolution,s.minResolution),N.minZoom=Math.max(N.minZoom,s.minZoom),N.maxZoom=Math.min(N.maxZoom,s.maxZoom),s.extent!==void 0&&(N.extent!==void 0?N.extent=Wv(N.extent,s.extent):N.extent=s.extent),N.zIndex===void 0&&(N.zIndex=P)}return u},h.prototype.getSourceState=function(){return Su.READY},h}(qm),v_=z2;var na={SINGLECLICK:"singleclick",CLICK:Ji.CLICK,DBLCLICK:Ji.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var x_={ACTIVE:"active"};var D2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),O2=function(y){D2(h,y);function h(n){var u=y.call(this)||this;return u.on,u.once,u.un,n&&n.handleEvent&&(u.handleEvent=n.handleEvent),u.map_=null,u.setActive(!0),u}return h.prototype.getActive=function(){return this.get(x_.ACTIVE)},h.prototype.getMap=function(){return this.map_},h.prototype.handleEvent=function(n){return!0},h.prototype.setActive=function(n){this.set(x_.ACTIVE,n)},h.prototype.setMap=function(n){this.map_=n},h}(Mo);var T0=O2;var F2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),B2=function(y){F2(h,y);function h(n){var u=this,r=n||{};return u=y.call(this,r)||this,r.handleDownEvent&&(u.handleDownEvent=r.handleDownEvent),r.handleDragEvent&&(u.handleDragEvent=r.handleDragEvent),r.handleMoveEvent&&(u.handleMoveEvent=r.handleMoveEvent),r.handleUpEvent&&(u.handleUpEvent=r.handleUpEvent),r.stopDown&&(u.stopDown=r.stopDown),u.handlingDownUpSequence=!1,u.trackedPointers_={},u.targetPointers=[],u}return h.prototype.getPointerCount=function(){return this.targetPointers.length},h.prototype.handleDownEvent=function(n){return!1},h.prototype.handleDragEvent=function(n){},h.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;var u=!1;if(this.updateTrackedPointers_(n),this.handlingDownUpSequence){if(n.type==na.POINTERDRAG)this.handleDragEvent(n),n.originalEvent.preventDefault();else if(n.type==na.POINTERUP){var r=this.handleUpEvent(n);this.handlingDownUpSequence=r&&this.targetPointers.length>0}}else if(n.type==na.POINTERDOWN){var s=this.handleDownEvent(n);this.handlingDownUpSequence=s,u=this.stopDown(s)}else n.type==na.POINTERMOVE&&this.handleMoveEvent(n);return!u},h.prototype.handleMoveEvent=function(n){},h.prototype.handleUpEvent=function(n){return!1},h.prototype.stopDown=function(n){return n},h.prototype.updateTrackedPointers_=function(n){if(U2(n)){var u=n.originalEvent,r=u.pointerId.toString();n.type==na.POINTERUP?delete this.trackedPointers_[r]:n.type==na.POINTERDOWN?this.trackedPointers_[r]=u:r in this.trackedPointers_&&(this.trackedPointers_[r]=u),this.targetPointers=Am(this.trackedPointers_)}},h}(T0);function U2(y){var h=y.type;return h===na.POINTERDOWN||h===na.POINTERDRAG||h===na.POINTERUP}var S0=B2;var I0=function(y){var h=y.originalEvent;return h.altKey&&!(h.metaKey||h.ctrlKey)&&!h.shiftKey};var C0=Cm,A0=function(y){return y.type==na.CLICK};var P0=function(y){return y.type==na.SINGLECLICK};var M0=function(y){var h=y.originalEvent;return En(h!==void 0,56),h.isPrimary&&h.button===0};var N2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),V2=function(y){N2(h,y);function h(n,u,r){var s=y.call(this)||this;if(s.ends_=[],s.maxDelta_=-1,s.maxDeltaRevision_=-1,Array.isArray(n[0]))s.setCoordinates(n,u);else if(u!==void 0&&r)s.setFlatCoordinates(u,n),s.ends_=r;else{for(var P=s.getLayout(),z=n,F=[],N=[],V=0,me=z.length;V<me;++V){var _e=z[V];V===0&&(P=_e.getLayout()),Ka(F,_e.getFlatCoordinates()),N.push(F.length)}s.setFlatCoordinates(P,F),s.ends_=N}return s}return h.prototype.appendLineString=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n.getFlatCoordinates().slice()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},h.prototype.clone=function(){var n=new h(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return n.applyProperties(this),n},h.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ad(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ld(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,n,u,r,s))},h.prototype.getCoordinateAtM=function(n,u,r){if(this.layout!=Pn.XYM&&this.layout!=Pn.XYZM||this.flatCoordinates.length===0)return null;var s=u!==void 0?u:!1,P=r!==void 0?r:!1;return zx(this.flatCoordinates,0,this.ends_,this.stride,n,s,P)},h.prototype.getCoordinates=function(){return ph(this.flatCoordinates,0,this.ends_,this.stride)},h.prototype.getEnds=function(){return this.ends_},h.prototype.getLineString=function(n){return n<0||this.ends_.length<=n?null:new uc(this.flatCoordinates.slice(n===0?0:this.ends_[n-1],this.ends_[n]),this.layout)},h.prototype.getLineStrings=function(){for(var n=this.flatCoordinates,u=this.ends_,r=this.layout,s=[],P=0,z=0,F=u.length;z<F;++z){var N=u[z],V=new uc(n.slice(P,N),r);s.push(V),P=N}return s},h.prototype.getFlatMidpoints=function(){for(var n=[],u=this.flatCoordinates,r=0,s=this.ends_,P=this.stride,z=0,F=s.length;z<F;++z){var N=s[z],V=Jm(u,r,N,P,.5);Ka(n,V),r=N}return n},h.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=wx(this.flatCoordinates,0,this.ends_,this.stride,n,u,0,r),new h(u,Pn.XY,r)},h.prototype.getType=function(){return Mt.MULTI_LINE_STRING},h.prototype.intersectsExtent=function(n){return Ax(this.flatCoordinates,0,this.ends_,this.stride,n)},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=ud(this.flatCoordinates,0,n,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},h}(Es),k0=V2;var G2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),j2=function(y){G2(h,y);function h(n,u){var r=y.call(this)||this;return u&&!Array.isArray(n[0])?r.setFlatCoordinates(u,n):r.setCoordinates(n,u),r}return h.prototype.appendPoint=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n.getFlatCoordinates()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.changed()},h.prototype.clone=function(){var n=new h(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},h.prototype.closestPointXY=function(n,u,r,s){if(s<xs(this.getExtent(),n,u))return s;for(var P=this.flatCoordinates,z=this.stride,F=0,N=P.length;F<N;F+=z){var V=ql(n,u,P[F],P[F+1]);if(V<s){s=V;for(var me=0;me<z;++me)r[me]=P[F+me];r.length=z}}return s},h.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},h.prototype.getPoint=function(n){var u=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return n<0||u<=n?null:new _a(this.flatCoordinates.slice(n*this.stride,(n+1)*this.stride),this.layout)},h.prototype.getPoints=function(){for(var n=this.flatCoordinates,u=this.layout,r=this.stride,s=[],P=0,z=n.length;P<z;P+=r){var F=new _a(n.slice(P,P+r),u);s.push(F)}return s},h.prototype.getType=function(){return Mt.MULTI_POINT},h.prototype.intersectsExtent=function(n){for(var u=this.flatCoordinates,r=this.stride,s=0,P=u.length;s<P;s+=r){var z=u[s],F=u[s+1];if(Qf(n,z,F))return!0}return!1},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Yh(this.flatCoordinates,0,n,this.stride),this.changed()},h}(Es),ag=j2;function L0(y,h,n,u){for(var r=[],s=Ya(),P=0,z=n.length;P<z;++P){var F=n[P];s=Um(y,h,F[0],u),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),h=F[F.length-1]}return r}var q2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Z2=function(y){q2(h,y);function h(n,u,r){var s=y.call(this)||this;if(s.endss_=[],s.flatInteriorPointsRevision_=-1,s.flatInteriorPoints_=null,s.maxDelta_=-1,s.maxDeltaRevision_=-1,s.orientedRevision_=-1,s.orientedFlatCoordinates_=null,!r&&!Array.isArray(n[0])){for(var P=s.getLayout(),z=n,F=[],N=[],V=0,me=z.length;V<me;++V){var _e=z[V];V===0&&(P=_e.getLayout());for(var Se=F.length,Ue=_e.getEnds(),He=0,Ie=Ue.length;He<Ie;++He)Ue[He]+=Se;Ka(F,_e.getFlatCoordinates()),N.push(Ue)}u=P,n=F,r=N}return u!==void 0&&r?(s.setFlatCoordinates(u,n),s.endss_=r):s.setCoordinates(n,u),s}return h.prototype.appendPolygon=function(n){var u;if(!this.flatCoordinates)this.flatCoordinates=n.getFlatCoordinates().slice(),u=n.getEnds().slice(),this.endss_.push();else{var r=this.flatCoordinates.length;Ka(this.flatCoordinates,n.getFlatCoordinates()),u=n.getEnds().slice();for(var s=0,P=u.length;s<P;++s)u[s]+=r}this.endss_.push(u),this.changed()},h.prototype.clone=function(){for(var n=this.endss_.length,u=new Array(n),r=0;r<n;++r)u[r]=this.endss_[r].slice();var s=new h(this.flatCoordinates.slice(),this.layout,u);return s.applyProperties(this),s},h.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(_x(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),vx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,n,u,r,s))},h.prototype.containsXY=function(n,u){return Ix(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n,u)},h.prototype.getArea=function(){return Tx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)},h.prototype.getCoordinates=function(n){var u;return n!==void 0?(u=this.getOrientedFlatCoordinates().slice(),Ky(u,0,this.endss_,this.stride,n)):u=this.flatCoordinates,hd(u,0,this.endss_,this.stride)},h.prototype.getEndss=function(){return this.endss_},h.prototype.getFlatInteriorPoints=function(){if(this.flatInteriorPointsRevision_!=this.getRevision()){var n=L0(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Cx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_},h.prototype.getInteriorPoints=function(){return new ag(this.getFlatInteriorPoints().slice(),Pn.XYM)},h.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var n=this.flatCoordinates;Lx(n,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=n:(this.orientedFlatCoordinates_=n.slice(),this.orientedFlatCoordinates_.length=Ky(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},h.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=Ex(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(n),u,0,r),new h(u,Pn.XY,r)},h.prototype.getPolygon=function(n){if(n<0||this.endss_.length<=n)return null;var u;if(n===0)u=0;else{var r=this.endss_[n-1];u=r[r.length-1]}var s=this.endss_[n].slice(),P=s[s.length-1];if(u!==0)for(var z=0,F=s.length;z<F;++z)s[z]-=u;return new dd(this.flatCoordinates.slice(u,P),this.layout,s)},h.prototype.getPolygons=function(){for(var n=this.layout,u=this.flatCoordinates,r=this.endss_,s=[],P=0,z=0,F=r.length;z<F;++z){var N=r[z].slice(),V=N[N.length-1];if(P!==0)for(var me=0,_e=N.length;me<_e;++me)N[me]-=P;var Se=new dd(u.slice(P,V),n,N);s.push(Se),P=V}return s},h.prototype.getType=function(){return Mt.MULTI_POLYGON},h.prototype.intersectsExtent=function(n){return Px(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n)},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,3),this.flatCoordinates||(this.flatCoordinates=[]);var r=bx(this.flatCoordinates,0,n,this.stride,this.endss_);if(r.length===0)this.flatCoordinates.length=0;else{var s=r[r.length-1];this.flatCoordinates.length=s.length===0?0:s[s.length-1]}this.changed()},h}(Es),R0=Z2;var B0=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),z0=0,wd=1,D0=[0,0,0,0],pf=[],b_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},w_=function(y){B0(h,y);function h(n,u,r){var s=y.call(this,n)||this;return s.features=u,s.mapBrowserEvent=r,s}return h}(sn);var X2=function(y){B0(h,y);function h(n){var u=y.call(this,n)||this;u.on,u.once,u.un,u.boundHandleFeatureChange_=u.handleFeatureChange_.bind(u),u.condition_=n.condition?n.condition:M0,u.defaultDeleteCondition_=function(s){return I0(s)&&P0(s)},u.deleteCondition_=n.deleteCondition?n.deleteCondition:u.defaultDeleteCondition_,u.insertVertexCondition_=n.insertVertexCondition?n.insertVertexCondition:C0,u.vertexFeature_=null,u.vertexSegments_=null,u.lastPixel_=[0,0],u.ignoreNextSingleClick_=!1,u.featuresBeingModified_=null,u.rBush_=new bd,u.pixelTolerance_=n.pixelTolerance!==void 0?n.pixelTolerance:10,u.snappedToVertex_=!1,u.changingFeature_=!1,u.dragSegments_=[],u.overlay_=new tp({source:new rp({useSpatialIndex:!1,wrapX:!!n.wrapX}),style:n.style?n.style:$2(),updateWhileAnimating:!0,updateWhileInteracting:!0}),u.SEGMENT_WRITERS_={Point:u.writePointGeometry_.bind(u),LineString:u.writeLineStringGeometry_.bind(u),LinearRing:u.writeLineStringGeometry_.bind(u),Polygon:u.writePolygonGeometry_.bind(u),MultiPoint:u.writeMultiPointGeometry_.bind(u),MultiLineString:u.writeMultiLineStringGeometry_.bind(u),MultiPolygon:u.writeMultiPolygonGeometry_.bind(u),Circle:u.writeCircleGeometry_.bind(u),GeometryCollection:u.writeGeometryCollectionGeometry_.bind(u)},u.source_=null,u.hitDetection_=null;var r;if(n.features?r=n.features:n.source&&(u.source_=n.source,r=new ch(u.source_.getFeatures()),u.source_.addEventListener(Qa.ADDFEATURE,u.handleSourceAdd_.bind(u)),u.source_.addEventListener(Qa.REMOVEFEATURE,u.handleSourceRemove_.bind(u))),!r)throw new Error("The modify interaction requires features, a source or a layer");return n.hitDetection&&(u.hitDetection_=n.hitDetection),u.features_=r,u.features_.forEach(u.addFeature_.bind(u)),u.features_.addEventListener(ws.ADD,u.handleFeatureAdd_.bind(u)),u.features_.addEventListener(ws.REMOVE,u.handleFeatureRemove_.bind(u)),u.lastPointerEvent_=null,u.delta_=[0,0],u.snapToPointer_=n.snapToPointer===void 0?!u.hitDetection_:n.snapToPointer,u}return h.prototype.addFeature_=function(n){var u=n.getGeometry();if(u){var r=this.SEGMENT_WRITERS_[u.getType()];r&&r(n,u)}var s=this.getMap();s&&s.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,s),n.addEventListener(Ji.CHANGE,this.boundHandleFeatureChange_)},h.prototype.willModifyFeatures_=function(n,u){if(!this.featuresBeingModified_){this.featuresBeingModified_=new ch;for(var r=this.featuresBeingModified_.getArray(),s=0,P=u.length;s<P;++s)for(var z=u[s],F=0,N=z.length;F<N;++F){var V=z[F].feature;V&&r.indexOf(V)===-1&&this.featuresBeingModified_.push(V)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new w_(b_.MODIFYSTART,this.featuresBeingModified_,n))}},h.prototype.removeFeature_=function(n){this.removeFeatureSegmentData_(n),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.removeEventListener(Ji.CHANGE,this.boundHandleFeatureChange_)},h.prototype.removeFeatureSegmentData_=function(n){var u=this.rBush_,r=[];u.forEach(function(F){n===F.feature&&r.push(F)});for(var s=r.length-1;s>=0;--s){for(var P=r[s],z=this.dragSegments_.length-1;z>=0;--z)this.dragSegments_[z][0]===P&&this.dragSegments_.splice(z,1);u.remove(P)}},h.prototype.setActive=function(n){this.vertexFeature_&&!n&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),y.prototype.setActive.call(this,n)},h.prototype.setMap=function(n){this.overlay_.setMap(n),y.prototype.setMap.call(this,n)},h.prototype.getOverlay=function(){return this.overlay_},h.prototype.handleSourceAdd_=function(n){n.feature&&this.features_.push(n.feature)},h.prototype.handleSourceRemove_=function(n){n.feature&&this.features_.remove(n.feature)},h.prototype.handleFeatureAdd_=function(n){this.addFeature_(n.element)},h.prototype.handleFeatureChange_=function(n){if(!this.changingFeature_){var u=n.target;this.removeFeature_(u),this.addFeature_(u)}},h.prototype.handleFeatureRemove_=function(n){var u=n.element;this.removeFeature_(u)},h.prototype.writePointGeometry_=function(n,u){var r=u.getCoordinates(),s={feature:n,geometry:u,segment:[r,r]};this.rBush_.insert(u.getExtent(),s)},h.prototype.writeMultiPointGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s){var z=r[s],F={feature:n,geometry:u,depth:[s],index:s,segment:[z,z]};this.rBush_.insert(u.getExtent(),F)}},h.prototype.writeLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length-1;s<P;++s){var z=r.slice(s,s+2),F={feature:n,geometry:u,index:s,segment:z};this.rBush_.insert(wu(z),F)}},h.prototype.writeMultiLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length-1;F<N;++F){var V=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:V};this.rBush_.insert(wu(V),me)}},h.prototype.writePolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length-1;F<N;++F){var V=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:V};this.rBush_.insert(wu(V),me)}},h.prototype.writeMultiPolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length;F<N;++F)for(var V=z[F],me=0,_e=V.length-1;me<_e;++me){var Se=V.slice(me,me+2),Ue={feature:n,geometry:u,depth:[F,s],index:me,segment:Se};this.rBush_.insert(wu(Se),Ue)}},h.prototype.writeCircleGeometry_=function(n,u){var r=u.getCenter(),s={feature:n,geometry:u,index:z0,segment:[r,r]},P={feature:n,geometry:u,index:wd,segment:[r,r]},z=[s,P];s.featureSegments=z,P.featureSegments=z,this.rBush_.insert(Yp(r),s);var F=u,N=uh();if(N&&this.getMap()){var V=this.getMap().getView().getProjection();F=F.clone().transform(N,V),F=Hy(F).transform(V,N)}this.rBush_.insert(F.getExtent(),P)},h.prototype.writeGeometryCollectionGeometry_=function(n,u){for(var r=u.getGeometriesArray(),s=0;s<r.length;++s){var P=r[s],z=this.SEGMENT_WRITERS_[P.getType()];z(n,P)}},h.prototype.createOrUpdateVertexFeature_=function(n,u,r){var s=this.vertexFeature_;if(!s)s=new lc(new _a(n)),this.vertexFeature_=s,this.overlay_.getSource().addFeature(s);else{var P=s.getGeometry();P.setCoordinates(n)}return s.set("features",u),s.set("geometries",r),s},h.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;this.lastPointerEvent_=n;var u;return!n.map.getView().getInteracting()&&n.type==na.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(n),this.vertexFeature_&&this.deleteCondition_(n)&&(n.type!=na.SINGLECLICK||!this.ignoreNextSingleClick_?u=this.removePoint():u=!0),n.type==na.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),y.prototype.handleEvent.call(this,n)&&!u},h.prototype.handleDragEvent=function(n){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(n,this.dragSegments_);for(var u=[n.coordinate[0]+this.delta_[0],n.coordinate[1]+this.delta_[1]],r=[],s=[],P=0,z=this.dragSegments_.length;P<z;++P){var F=this.dragSegments_[P],N=F[0],V=N.feature;r.indexOf(V)===-1&&r.push(V);var me=N.geometry;s.indexOf(me)===-1&&s.push(me);for(var _e=N.depth,Se=void 0,Ue=N.segment,He=F[1];u.length<me.getStride();)u.push(Ue[He][u.length]);switch(me.getType()){case Mt.POINT:Se=u,Ue[0]=u,Ue[1]=u;break;case Mt.MULTI_POINT:Se=me.getCoordinates(),Se[N.index]=u,Ue[0]=u,Ue[1]=u;break;case Mt.LINE_STRING:Se=me.getCoordinates(),Se[N.index+He]=u,Ue[He]=u;break;case Mt.MULTI_LINE_STRING:Se=me.getCoordinates(),Se[_e[0]][N.index+He]=u,Ue[He]=u;break;case Mt.POLYGON:Se=me.getCoordinates(),Se[_e[0]][N.index+He]=u,Ue[He]=u;break;case Mt.MULTI_POLYGON:Se=me.getCoordinates(),Se[_e[1]][_e[0]][N.index+He]=u,Ue[He]=u;break;case Mt.CIRCLE:if(Ue[0]=u,Ue[1]=u,N.index===z0)this.changingFeature_=!0,me.setCenter(u),this.changingFeature_=!1;else{this.changingFeature_=!0;var Ie=n.map.getView().getProjection(),Ge=Ey(Xl(me.getCenter(),Ie),Xl(u,Ie)),et=uh();if(et){var rt=me.clone().transform(et,Ie);rt.setRadius(Ge),Ge=rt.transform(Ie,et).getRadius()}me.setRadius(Ge),this.changingFeature_=!1}break;default:}Se&&this.setGeometryCoordinates_(me,Se)}this.createOrUpdateVertexFeature_(u,r,s)},h.prototype.handleDownEvent=function(n){if(!this.condition_(n))return!1;var u=n.coordinate;this.handlePointerAtPixel_(n.pixel,n.map,u),this.dragSegments_.length=0,this.featuresBeingModified_=null;var r=this.vertexFeature_;if(r){var s=n.map.getView().getProjection(),P=[],z=r.getGeometry().getCoordinates(),F=wu([z]),N=this.rBush_.getInExtent(F),V={};N.sort(W2);for(var me=0,_e=N.length;me<_e;++me){var Se=N[me],Ue=Se.segment,He=Ai(Se.geometry),Ie=Se.depth;if(Ie&&(He+="-"+Ie.join("-")),V[He]||(V[He]=new Array(2)),Se.geometry.getType()===Mt.CIRCLE&&Se.index===wd){var Ge=F0(u,Se,s);Tu(Ge,z)&&!V[He][0]&&(this.dragSegments_.push([Se,0]),V[He][0]=Se);continue}if(Tu(Ue[0],z)&&!V[He][0]){this.dragSegments_.push([Se,0]),V[He][0]=Se;continue}if(Tu(Ue[1],z)&&!V[He][1]){if((Se.geometry.getType()===Mt.LINE_STRING||Se.geometry.getType()===Mt.MULTI_LINE_STRING)&&V[He][0]&&V[He][0].index===0)continue;this.dragSegments_.push([Se,1]),V[He][1]=Se;continue}Ai(Ue)in this.vertexSegments_&&!V[He][0]&&!V[He][1]&&this.insertVertexCondition_(n)&&P.push(Se)}P.length&&this.willModifyFeatures_(n,[P]);for(var et=P.length-1;et>=0;--et)this.insertVertex_(P[et],z)}return!!this.vertexFeature_},h.prototype.handleUpEvent=function(n){for(var u=this.dragSegments_.length-1;u>=0;--u){var r=this.dragSegments_[u][0],s=r.geometry;if(s.getType()===Mt.CIRCLE){var P=s.getCenter(),z=r.featureSegments[0],F=r.featureSegments[1];z.segment[0]=P,z.segment[1]=P,F.segment[0]=P,F.segment[1]=P,this.rBush_.update(Yp(P),z);var N=s,V=uh();if(V){var me=n.map.getView().getProjection();N=N.clone().transform(V,me),N=Hy(N).transform(me,V)}this.rBush_.update(N.getExtent(),F)}else this.rBush_.update(wu(r.segment),r)}return this.featuresBeingModified_&&(this.dispatchEvent(new w_(b_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null),!1},h.prototype.handlePointerMove_=function(n){this.lastPixel_=n.pixel,this.handlePointerAtPixel_(n.pixel,n.map,n.coordinate)},h.prototype.handlePointerAtPixel_=function(n,u,r){var s=this,P=r||u.getCoordinateFromPixel(n),z=u.getView().getProjection(),F=function(At,Vr){return O0(P,At,z)-O0(P,Vr,z)},N,V;if(this.hitDetection_){var me=typeof this.hitDetection_=="object"?function(At){return At===s.hitDetection_}:void 0;u.forEachFeatureAtPixel(n,function(At,Vr,Er){if(Er=Er||At.getGeometry(),Er.getType()===Mt.POINT&&_v(s.features_.getArray(),At)){V=Er;var zr=Er.getFlatCoordinates().slice(0,2);N=[{feature:At,geometry:Er,segment:[zr,zr]}]}return!0},{layerFilter:me})}if(!N){var _e=rd(Yp(P,D0),z),Se=u.getView().getResolution()*this.pixelTolerance_,Ue=Qp(yl(_e,Se,D0),z);N=this.rBush_.getInExtent(Ue)}if(N&&N.length>0){var He=N.sort(F)[0],Ie=He.segment,Ge=F0(P,He,z),et=u.getPixelFromCoordinate(Ge),rt=Ey(n,et);if(V||rt<=this.pixelTolerance_){var _t={};if(_t[Ai(Ie)]=!0,this.snapToPointer_||(this.delta_[0]=Ge[0]-P[0],this.delta_[1]=Ge[1]-P[1]),He.geometry.getType()===Mt.CIRCLE&&He.index===wd)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(Ge,[He.feature],[He.geometry]);else{var yt=u.getPixelFromCoordinate(Ie[0]),ct=u.getPixelFromCoordinate(Ie[1]),Tt=Jp(et,yt),St=Jp(et,ct);rt=Math.sqrt(Math.min(Tt,St)),this.snappedToVertex_=rt<=this.pixelTolerance_,this.snappedToVertex_&&(Ge=Tt>St?Ie[1]:Ie[0]),this.createOrUpdateVertexFeature_(Ge,[He.feature],[He.geometry]);var Lt={};Lt[Ai(He.geometry)]=!0;for(var nr=1,jt=N.length;nr<jt;++nr){var Jt=N[nr].segment;if(Tu(Ie[0],Jt[0])&&Tu(Ie[1],Jt[1])||Tu(Ie[0],Jt[1])&&Tu(Ie[1],Jt[0])){var or=Ai(N[nr].geometry);or in Lt||(Lt[or]=!0,_t[Ai(Jt)]=!0)}else break}}this.vertexSegments_=_t;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},h.prototype.insertVertex_=function(n,u){for(var r=n.segment,s=n.feature,P=n.geometry,z=n.depth,F=n.index,N;u.length<P.getStride();)u.push(0);switch(P.getType()){case Mt.MULTI_LINE_STRING:N=P.getCoordinates(),N[z[0]].splice(F+1,0,u);break;case Mt.POLYGON:N=P.getCoordinates(),N[z[0]].splice(F+1,0,u);break;case Mt.MULTI_POLYGON:N=P.getCoordinates(),N[z[1]][z[0]].splice(F+1,0,u);break;case Mt.LINE_STRING:N=P.getCoordinates(),N.splice(F+1,0,u);break;default:return}this.setGeometryCoordinates_(P,N);var V=this.rBush_;V.remove(n),this.updateSegmentIndices_(P,F,z,1);var me={segment:[r[0],u],feature:s,geometry:P,depth:z,index:F};V.insert(wu(me.segment),me),this.dragSegments_.push([me,1]);var _e={segment:[u,r[1]],feature:s,geometry:P,depth:z,index:F+1};V.insert(wu(_e.segment),_e),this.dragSegments_.push([_e,0]),this.ignoreNextSingleClick_=!0},h.prototype.removePoint=function(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=na.POINTERDRAG){var n=this.lastPointerEvent_;this.willModifyFeatures_(n,this.dragSegments_);var u=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new w_(b_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null,u}return!1},h.prototype.removeVertex_=function(){var n=this.dragSegments_,u={},r=!1,s,P,z,F,N,V,me,_e,Se,Ue,He;for(N=n.length-1;N>=0;--N)z=n[N],Ue=z[0],He=Ai(Ue.feature),Ue.depth&&(He+="-"+Ue.depth.join("-")),He in u||(u[He]={}),z[1]===0?(u[He].right=Ue,u[He].index=Ue.index):z[1]==1&&(u[He].left=Ue,u[He].index=Ue.index+1);for(He in u){switch(Se=u[He].right,me=u[He].left,V=u[He].index,_e=V-1,me!==void 0?Ue=me:Ue=Se,_e<0&&(_e=0),F=Ue.geometry,P=F.getCoordinates(),s=P,r=!1,F.getType()){case Mt.MULTI_LINE_STRING:P[Ue.depth[0]].length>2&&(P[Ue.depth[0]].splice(V,1),r=!0);break;case Mt.LINE_STRING:P.length>2&&(P.splice(V,1),r=!0);break;case Mt.MULTI_POLYGON:s=s[Ue.depth[1]];case Mt.POLYGON:s=s[Ue.depth[0]],s.length>4&&(V==s.length-1&&(V=0),s.splice(V,1),r=!0,V===0&&(s.pop(),s.push(s[0]),_e=s.length-1));break;default:}if(r){this.setGeometryCoordinates_(F,P);var Ie=[];if(me!==void 0&&(this.rBush_.remove(me),Ie.push(me.segment[0])),Se!==void 0&&(this.rBush_.remove(Se),Ie.push(Se.segment[1])),me!==void 0&&Se!==void 0){var Ge={depth:Ue.depth,feature:Ue.feature,geometry:Ue.geometry,index:_e,segment:Ie};this.rBush_.insert(wu(Ge.segment),Ge)}this.updateSegmentIndices_(F,V,Ue.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.length=0}}return r},h.prototype.setGeometryCoordinates_=function(n,u){this.changingFeature_=!0,n.setCoordinates(u),this.changingFeature_=!1},h.prototype.updateSegmentIndices_=function(n,u,r,s){this.rBush_.forEachInExtent(n.getExtent(),function(P){P.geometry===n&&(r===void 0||P.depth===void 0||_s(P.depth,r))&&P.index>u&&(P.index+=s)})},h}(S0);function W2(y,h){return y.index-h.index}function O0(y,h,n){var u=h.geometry;if(u.getType()===Mt.CIRCLE){var r=u;if(h.index===wd){var s=uh();s&&(r=r.clone().transform(s,n));var P=Jp(r.getCenter(),Xl(y,n)),z=Math.sqrt(P)-r.getRadius();return z*z}}var F=Xl(y,n);return pf[0]=Xl(h.segment[0],n),pf[1]=Xl(h.segment[1],n),Jv(F,pf)}function F0(y,h,n){var u=h.geometry;if(u.getType()===Mt.CIRCLE&&h.index===wd){var r=u,s=uh();return s&&(r=r.clone().transform(s,n)),Iy(r.getClosestPoint(Xl(y,n)),n)}var P=Xl(y,n);return pf[0]=Xl(h.segment[0],n),pf[1]=Xl(h.segment[1],n),Iy(wy(P,pf),n)}function $2(){var y=Xx();return function(h,n){return y[Mt.POINT]}}var E_=X2;var K2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),H2=function(y){K2(h,y);function h(n){var u=y.call(this)||this;return u.geometries_=n||null,u.changeEventsKeys_=[],u.listenGeometriesChange_(),u}return h.prototype.unlistenGeometriesChange_=function(){this.changeEventsKeys_.forEach(Po),this.changeEventsKeys_.length=0},h.prototype.listenGeometriesChange_=function(){if(!!this.geometries_)for(var n=0,u=this.geometries_.length;n<u;++n)this.changeEventsKeys_.push(uo(this.geometries_[n],Ji.CHANGE,this.changed,this))},h.prototype.clone=function(){var n=new h(null);return n.setGeometries(this.geometries_),n.applyProperties(this),n},h.prototype.closestPointXY=function(n,u,r,s){if(s<xs(this.getExtent(),n,u))return s;for(var P=this.geometries_,z=0,F=P.length;z<F;++z)s=P[z].closestPointXY(n,u,r,s);return s},h.prototype.containsXY=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)if(r[s].containsXY(n,u))return!0;return!1},h.prototype.computeExtent=function(n){Hp(n);for(var u=this.geometries_,r=0,s=u.length;r<s;++r)Zv(n,u[r].getExtent());return n},h.prototype.getGeometries=function(){return U0(this.geometries_)},h.prototype.getGeometriesArray=function(){return this.geometries_},h.prototype.getGeometriesArrayRecursive=function(){for(var n=[],u=this.geometries_,r=0,s=u.length;r<s;++r)u[r].getType()===this.getType()?n=n.concat(u[r].getGeometriesArrayRecursive()):n.push(u[r]);return n},h.prototype.getSimplifiedGeometry=function(n){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),n<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&n<this.simplifiedGeometryMaxMinSquaredTolerance)return this;for(var u=[],r=this.geometries_,s=!1,P=0,z=r.length;P<z;++P){var F=r[P],N=F.getSimplifiedGeometry(n);u.push(N),N!==F&&(s=!0)}if(s){var V=new h(null);return V.setGeometriesArray(u),V}else return this.simplifiedGeometryMaxMinSquaredTolerance=n,this},h.prototype.getType=function(){return Mt.GEOMETRY_COLLECTION},h.prototype.intersectsExtent=function(n){for(var u=this.geometries_,r=0,s=u.length;r<s;++r)if(u[r].intersectsExtent(n))return!0;return!1},h.prototype.isEmpty=function(){return this.geometries_.length===0},h.prototype.rotate=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].rotate(n,u);this.changed()},h.prototype.scale=function(n,u,r){var s=r;s||(s=$h(this.getExtent()));for(var P=this.geometries_,z=0,F=P.length;z<F;++z)P[z].scale(n,u,s);this.changed()},h.prototype.setGeometries=function(n){this.setGeometriesArray(U0(n))},h.prototype.setGeometriesArray=function(n){this.unlistenGeometriesChange_(),this.geometries_=n,this.listenGeometriesChange_(),this.changed()},h.prototype.applyTransform=function(n){for(var u=this.geometries_,r=0,s=u.length;r<s;++r)u[r].applyTransform(n);this.changed()},h.prototype.translate=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].translate(n,u);this.changed()},h.prototype.disposeInternal=function(){this.unlistenGeometriesChange_(),y.prototype.disposeInternal.call(this)},h}($m);function U0(y){for(var h=[],n=0,u=y.length;n<u;++n)h.push(y[n].clone());return h}var N0=H2;var Y2=function(){function y(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return y.prototype.getReadOptions=function(h,n){var u;if(n){var r=n.dataProjection?ya(n.dataProjection):this.readProjection(h);n.extent&&r&&r.getUnits()===ac.TILE_PIXELS&&(r=ya(r),r.setWorldExtent(n.extent)),u={dataProjection:r,featureProjection:n.featureProjection}}return this.adaptOptions(u)},y.prototype.adaptOptions=function(h){return Ra({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},h)},y.prototype.getType=function(){return jr()},y.prototype.readFeature=function(h,n){return jr()},y.prototype.readFeatures=function(h,n){return jr()},y.prototype.readGeometry=function(h,n){return jr()},y.prototype.readProjection=function(h){return jr()},y.prototype.writeFeature=function(h,n){return jr()},y.prototype.writeFeatures=function(h,n){return jr()},y.prototype.writeGeometry=function(h,n){return jr()},y}(),V0=Y2;function T_(y,h,n){var u=n?ya(n.featureProjection):null,r=n?ya(n.dataProjection):null,s;if(u&&r&&!rx(u,r)?s=(h?y.clone():y).transform(h?u:r,h?r:u):s=y,h&&n&&n.decimals!==void 0){var P=Math.pow(10,n.decimals),z=function(F){for(var N=0,V=F.length;N<V;++N)F[N]=Math.round(F[N]*P)/P;return F};s===y&&(s=y.clone()),s.applyTransform(z)}return s}var J2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Q2=function(y){J2(h,y);function h(){return y.call(this)||this}return h.prototype.getType=function(){return _h.JSON},h.prototype.readFeature=function(n,u){return this.readFeatureFromObject(sg(n),this.getReadOptions(n,u))},h.prototype.readFeatures=function(n,u){return this.readFeaturesFromObject(sg(n),this.getReadOptions(n,u))},h.prototype.readFeatureFromObject=function(n,u){return jr()},h.prototype.readFeaturesFromObject=function(n,u){return jr()},h.prototype.readGeometry=function(n,u){return this.readGeometryFromObject(sg(n),this.getReadOptions(n,u))},h.prototype.readGeometryFromObject=function(n,u){return jr()},h.prototype.readProjection=function(n){return this.readProjectionFromObject(sg(n))},h.prototype.readProjectionFromObject=function(n){return jr()},h.prototype.writeFeature=function(n,u){return JSON.stringify(this.writeFeatureObject(n,u))},h.prototype.writeFeatureObject=function(n,u){return jr()},h.prototype.writeFeatures=function(n,u){return JSON.stringify(this.writeFeaturesObject(n,u))},h.prototype.writeFeaturesObject=function(n,u){return jr()},h.prototype.writeGeometry=function(n,u){return JSON.stringify(this.writeGeometryObject(n,u))},h.prototype.writeGeometryObject=function(n,u){return jr()},h}(V0);function sg(y){if(typeof y=="string"){var h=JSON.parse(y);return h||null}else return y!==null?y:null}var G0=Q2;var eE=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),tE=function(y){eE(h,y);function h(n){var u=this,r=n||{};return u=y.call(this)||this,u.dataProjection=ya(r.dataProjection?r.dataProjection:"EPSG:4326"),r.featureProjection&&(u.defaultFeatureProjection=ya(r.featureProjection)),u.geometryName_=r.geometryName,u.extractGeometryName_=r.extractGeometryName,u.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"],u}return h.prototype.readFeatureFromObject=function(n,u){var r=null;n.type==="Feature"?r=n:r={type:"Feature",geometry:n,properties:null};var s=S_(r.geometry,u),P=new lc;return this.geometryName_?P.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in r!==void 0&&P.setGeometryName(r.geometry_name),P.setGeometry(s),"id"in r&&P.setId(r.id),r.properties&&P.setProperties(r.properties,!0),P},h.prototype.readFeaturesFromObject=function(n,u){var r=n,s=null;if(r.type==="FeatureCollection"){var P=n;s=[];for(var z=P.features,F=0,N=z.length;F<N;++F)s.push(this.readFeatureFromObject(z[F],u))}else s=[this.readFeatureFromObject(n,u)];return s},h.prototype.readGeometryFromObject=function(n,u){return S_(n,u)},h.prototype.readProjectionFromObject=function(n){var u=n.crs,r;return u?u.type=="name"?r=ya(u.properties.name):u.type==="EPSG"?r=ya("EPSG:"+u.properties.code):En(!1,36):r=this.dataProjection,r},h.prototype.writeFeatureObject=function(n,u){u=this.adaptOptions(u);var r={type:"Feature",geometry:null,properties:null},s=n.getId();if(s!==void 0&&(r.id=s),!n.hasProperties())return r;var P=n.getProperties(),z=n.getGeometry();return z&&(r.geometry=I_(z,u),delete P[n.getGeometryName()]),Vl(P)||(r.properties=P),r},h.prototype.writeFeaturesObject=function(n,u){u=this.adaptOptions(u);for(var r=[],s=0,P=n.length;s<P;++s)r.push(this.writeFeatureObject(n[s],u));return{type:"FeatureCollection",features:r}},h.prototype.writeGeometryObject=function(n,u){return I_(n,this.adaptOptions(u))},h}(G0);function S_(y,h){if(!y)return null;var n;switch(y.type){case Mt.POINT:{n=iE(y);break}case Mt.LINE_STRING:{n=nE(y);break}case Mt.POLYGON:{n=lE(y);break}case Mt.MULTI_POINT:{n=aE(y);break}case Mt.MULTI_LINE_STRING:{n=oE(y);break}case Mt.MULTI_POLYGON:{n=sE(y);break}case Mt.GEOMETRY_COLLECTION:{n=rE(y);break}default:throw new Error("Unsupported GeoJSON type: "+y.type)}return T_(n,!1,h)}function rE(y,h){var n=y.geometries.map(function(u){return S_(u,h)});return new N0(n)}function iE(y){return new _a(y.coordinates)}function nE(y){return new uc(y.coordinates)}function oE(y){return new k0(y.coordinates)}function aE(y){return new ag(y.coordinates)}function sE(y){return new R0(y.coordinates)}function lE(y){return new dd(y.coordinates)}function I_(y,h){y=T_(y,!0,h);var n=y.getType(),u;switch(n){case Mt.POINT:{u=dE(y,h);break}case Mt.LINE_STRING:{u=cE(y,h);break}case Mt.POLYGON:{u=mE(y,h);break}case Mt.MULTI_POINT:{u=pE(y,h);break}case Mt.MULTI_LINE_STRING:{u=hE(y,h);break}case Mt.MULTI_POLYGON:{u=fE(y,h);break}case Mt.GEOMETRY_COLLECTION:{u=uE(y,h);break}case Mt.CIRCLE:{u={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+n)}return u}function uE(y,h){var n=y.getGeometriesArray().map(function(u){var r=Ra({},h);return delete r.featureProjection,I_(u,r)});return{type:"GeometryCollection",geometries:n}}function cE(y,h){return{type:"LineString",coordinates:y.getCoordinates()}}function hE(y,h){return{type:"MultiLineString",coordinates:y.getCoordinates()}}function pE(y,h){return{type:"MultiPoint",coordinates:y.getCoordinates()}}function fE(y,h){var n;return h&&(n=h.rightHanded),{type:"MultiPolygon",coordinates:y.getCoordinates(n)}}function dE(y,h){return{type:"Point",coordinates:y.getCoordinates()}}function mE(y,h){var n;return h&&(n=h.rightHanded),{type:"Polygon",coordinates:y.getCoordinates(n)}}var bl=tE;var lg,gE=new Uint8Array(16);function C_(){if(!lg&&(lg=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!lg))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return lg(gE)}var j0=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function yE(y){return typeof y=="string"&&j0.test(y)}var q0=yE;var xa=[];for(ug=0;ug<256;++ug)xa.push((ug+256).toString(16).substr(1));var ug;function _E(y){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(xa[y[h+0]]+xa[y[h+1]]+xa[y[h+2]]+xa[y[h+3]]+"-"+xa[y[h+4]]+xa[y[h+5]]+"-"+xa[y[h+6]]+xa[y[h+7]]+"-"+xa[y[h+8]]+xa[y[h+9]]+"-"+xa[y[h+10]]+xa[y[h+11]]+xa[y[h+12]]+xa[y[h+13]]+xa[y[h+14]]+xa[y[h+15]]).toLowerCase();if(!q0(n))throw TypeError("Stringified UUID is invalid");return n}var Z0=_E;function vE(y,h,n){y=y||{};var u=y.random||(y.rng||C_)();if(u[6]=u[6]&15|64,u[8]=u[8]&63|128,h){n=n||0;for(var r=0;r<16;++r)h[n+r]=u[r];return h}return Z0(u)}var A_=vE;var ip=class extends Mo{constructor(n={}){super();this.properties={};this.options={};this.defineProperties(n),n.properties&&this.setProperties(n.properties),this.options=n,this.visible=n.visible===void 0?!0:!!n.visible,this.group=n.group,this.copyrights=n.copyrights,this.children=n.children,this.on("change:visible:group",u=>{this.group===u.target.group&&this!==u.target&&this.visible?this.visible=!1:this.children&&this.children.forEach(r=>r.dispatchEvent(u))})}defineProperties(n={}){let{name:u,key:r,properties:s,hitTolerance:P}={...n},z=A_();Object.defineProperties(this,{name:{value:u},key:{value:r||u||z},group:{get:()=>this.get("group"),set:F=>{this.set("group",F)}},copyrights:{get:()=>this.get("copyrights"),set:F=>{let N=F&&!Array.isArray(F)?[F]:F;this.set("copyrights",N||[])}},options:{value:n},map:{writable:!0},visible:{get:()=>this.get("visible"),set:F=>{if(F!==this.visible)if(this.set("visible",F),this.visible){if(this.parent&&(this.parent.visible=!0),this.children&&!this.children.some(N=>N.visible)&&this.children.forEach(N=>{N.visible=!0}),this.parent&&this.group){let N=this.parent;for(;N.parent;)N=N.parent;let V=new sn("change:visible:group");V.target=this,N.dispatchEvent(V)}}else this.visible||(this.children&&this.children.forEach(N=>{N.visible=!1}),this.parent&&this.parent.visible&&this.parent.children&&!this.parent.children.find(N=>N.visible)&&(this.parent.visible=!1))}},disabled:{get:()=>this.get("disabled"),set:F=>{this.set("disabled",F)}},parent:{value:null,writable:!0},children:{get:()=>this.get("children")||[],set:F=>{(this.children||[]).forEach(N=>{N.parent=void 0}),Array.isArray(F)&&F.forEach(N=>{N.parent=this}),this.set("children",F||[])}},hitTolerance:{value:P||5,writable:!0},properties:{value:{...s||{}}}})}attachToMap(n){this.detachFromMap(),this.map=n,this.children&&this.children.forEach(u=>{u.attachToMap(n)})}detachFromMap(){this.map=void 0}getFeatureInfoAtCoordinate(n,u){return console.error("getFeatureInfoAtCoordinate must be implemented by inheriting layers",this.key),Promise.resolve({layer:this,features:[],coordinate:n})}flat(){return Kf(this)}};function xE(y){return class extends y{constructor(n={}){super(n);let{userInteractions:u=!0,userClickInteractions:r=!0,userHoverInteractions:s=!0,defaultUserInteractions:P=!0}=n;this.userInteractions=u,this.userClickInteractions=r,this.userHoverInteractions=s,this.defaultUserInteractions=P,this.userClickCallbacks=[],this.userHoverCallbacks=[],this.userClickEventsKeys=[],this.userHoverEventsKeys=[],this.onUserClickCallback=this.onUserClickCallback.bind(this),this.onUserMoveCallback=this.onUserMoveCallback.bind(this);let{onClick:z,onHover:F}=n;this.userInteractions&&this.userClickInteractions&&z&&this.onClick(z),this.userInteractions&&this.userHoverInteractions&&F&&this.onHover(F)}attachToMap(n){super.attachToMap(n),this.userInteractions&&this.defaultUserInteractions&&this.userClickInteractions&&this.onFeatureClick&&this.onClick(this.onFeatureClick),this.userInteractions&&this.defaultUserInteractions&&this.userHoverInteractions&&this.onFeatureHover&&this.onHover(this.onFeatureHover),this.listenEvents()}detachFromMap(){this.unlistenEvents(),super.detachFromMap()}listenEvents(){this.unlistenEvents(),this.userClickCallbacks.forEach(n=>{this.userClickEventsKeys.push(this.on("user:click",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))}),this.userHoverCallbacks.forEach(n=>{this.userHoverEventsKeys.push(this.on("user:hover",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))})}unlistenEvents(){Ha(this.userClickEventsKeys),Ha(this.userHoverEventsKeys),this.userClickEventsKeys=[],this.userHoverEventsKeys=[]}onClick(n){this.userClickCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}onHover(n){this.userHoverCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}unClick(n){let u=this.userClickCallbacks.indexOf(n);u===-1&&(this.userClickCallbacks=this.userClickCallbacks.slice(u,1),this.map&&this.listenEvents())}unHover(n){let u=this.userHoverCallbacks.indexOf(n);u===-1&&(this.userHoverCallbacks=this.userHoverCallbacks.slice(u,1),this.map&&this.listenEvents())}onUserClickCallback(n){let u=n.coordinate||co(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new sn("user:click");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}onUserMoveCallback(n){let u=n.coordinate||co(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new sn("user:hover");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}activateUserInteractions(){}deactivateUserInteractions(){}}}var cg=xE;var Ed=class extends cg(ip){constructor(n){super(n);this.olLayer&&this.olLayer.setVisible(this.visible)}defineProperties(n){super.defineProperties(n),Object.defineProperties(this,{olLayer:{value:n.olLayer,writable:!0},olListenersKeys:{value:[]}})}attachToMap(n){if(super.attachToMap(n),!!this.map&&(this.olLayer&&!this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.addLayer(this.olLayer),this.olListenersKeys.push(this.on("change:visible",()=>{this.olLayer&&this.olLayer.setVisible(this.visible)})),this.olListenersKeys.push(this.map.getLayers().on("remove",u=>{u.element===this.olLayer&&this.detachFromMap()})),this.toggleVisibleListeners(),this.olListenersKeys.push(this.on("change:visible",this.toggleVisibleListeners)),this.copyrights&&this.olLayer)){let u=this.copyrights||[];this.olLayer.getLayers?this.olLayer.getLayers().getArray().forEach(r=>{r.getSource&&r.getSource()?.setAttributions(u)}):this.olLayer.getSource&&this.olLayer.getSource()?.setAttributions(u)}}detachFromMap(){this.deactivateUserInteractions(),Ha(this.olListenersKeys),this.olLayer&&this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.removeLayer(this.olLayer),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&(this.singleClickListenerKey=this.map.on("singleclick",this.onUserClickCallback),this.olListenersKeys.push(this.singleClickListenerKey)),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&(this.pointerMoveListenerKey=this.map.on("pointermove",this.onUserMoveCallback))}deactivateUserInteractions(){Ha([this.pointerMoveListenerKey,this.singleClickListenerKey])}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}clone(n){return new Ed({...this.options,...n})}},Is=Ed;var X0=new xl({radius:6,fill:new Ks({color:[255,0,0,1]}),stroke:new va({color:[0,0,0,1],width:1})}),bE=new Wl({stroke:new va({color:[0,0,0,1],width:5})}),wE=new Wl({image:X0,stroke:new va({color:[255,0,0,1],width:3})}),EE=new Wl({image:X0,stroke:new va({color:[255,0,0,1],width:3,lineDash:[1,10]})}),TE=(y,h)=>{let n=y.get("minResolution"),u=y.get("maxResolution"),r=h<=n&&h>u;return n&&u&&!r?[]:y.get("mot")!=="foot"?[bE,wE]:[EE]},Td=class extends Is{constructor(n){super(n);this.options={};this.olLayer=n.olLayer||new tp({source:new rp,style:n.style||TE})}clone(n){return new Td({...this.options,...n})}},hg=Td;var SE=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,W0=/^([\d.]+),([\d.]+)$/,$0=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,pg="stop-fetch",K0=y=>{let h=[];return y.forEach(n=>{let u=n.getGeometry()?.getCoordinates();u?.length&&h.push(...u)}),h},Sd=class extends af{constructor(n={}){super(n);this.viaPoints=[];this.loading=!1;this.graphs=[];this.modify=!0;this.useRawViaPoints=!1;this.snapToClosestStation=!1;this.cacheStationData={};this.abortControllers={};this.segments=[];this.format=new bl({featureProjection:"EPSG:3857"});this.initialRouteDrag={};Object.defineProperties(this,{mot:{get:()=>this.get("mot"),set:u=>{u&&(this.set("mot",u),this.viaPoints&&this.drawRoute())}},loading:{get:()=>this.get("loading"),set:u=>{this.set("loading",u)}},modify:{get:()=>this.get("modify"),set:u=>{this.set("modify",u)}}}),this.loading=!1,this.graphs=n.graphs||[["osm",0,99]],this.mot=n.mot||"bus",this.modify=n.modify!==!1,this.routingApiParams=n.routingApiParams,this.useRawViaPoints=n.useRawViaPoints||!1,this.snapToClosestStation=n.snapToClosestStation||!1,this.apiKey=n.apiKey,this.stopsApiKey=n.stopsApiKey||this.apiKey,this.stopsApiUrl=n.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new Zf({...n}),this.routingLayer=n.routingLayer||new hg({name:"routing-layer",style:n.style}),this.onRouteError=n.onRouteError||(u=>{this.dispatchEvent(new sn("change:route")),this.reset(),console.error(u)}),this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.createModifyInteraction()}static getGraphsResolutions(n,u){let r=u.getView();return n.map(([,s,P])=>[r.getResolutionForZoom(s),r.getResolutionForZoom(P||s+1)])}addViaPoint(n,u=-1,r=0){this.viaPoints.splice(u===-1?this.viaPoints.length:u,r,n),this.drawRoute(),this.dispatchEvent(new sn("change:route"))}removeViaPoint(n=(this.viaPoints||[]).length-1){this.viaPoints.length&&this.viaPoints[n]&&this.viaPoints.splice(n,1),this.drawRoute(),this.dispatchEvent(new sn("change:route"))}setViaPoints(n){this.viaPoints=[...n],this.drawRoute(),this.dispatchEvent(new sn("change:route"))}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer?.olLayer?.getSource()?.clear(),this.dispatchEvent(new sn("change:route"))}abortRequests(){this.graphs.forEach(n=>{let u=n[0];this.abortControllers[u]&&this.abortControllers[u].abort(),this.abortControllers[u]=new AbortController}),this.abortControllers[pg]?.abort(),this.abortControllers[pg]=new AbortController,this.loading=!1}drawRoute(){if(this.abortRequests(),this.routingLayer?.olLayer?.getSource()?.clear(),!this.viaPoints.length)return null;if(this.viaPoints.length===1)return this.drawViaPoint(this.viaPoints[0],0,this.abortControllers[pg]);let n=this.viaPoints.map(u=>{if(Array.isArray(u)){let r=this.map?.getView().getProjection(),[s,P]=lh(u,r);return this.snapToClosestStation?[`@${P}`,s]:[P,s]}return this.useRawViaPoints?u:`!${u}`});return this.loading=!0,this.routingLayer?.olLayer?.getSource()?.clear(),this.viaPoints.forEach((u,r)=>this.drawViaPoint(u,r,this.abortControllers[pg])),Promise.all(this.graphs.map(([u],r)=>{let{signal:s}=this.abortControllers[u];return this.api?this.api.route({graph:u,via:`${n.join("|")}`,mot:this.mot,"resolve-hops":!1,elevation:!1,"coord-radius":100,"coord-punish":1e3,...this.routingApiParams||{}},{signal:s}).then(P=>{if(this.segments=this.format.readFeatures(P),this.mot==="foot"){let N=this.segments.reduce((V,me)=>{let _e=me.get("trg");return V.find(Se=>Se[0]===_e[0]&&Se[1]===_e[1])?V:[...V,_e]},[]);this.segments=N.map(V=>{let me=this.segments.filter(Se=>{let Ue=Se.get("trg");return Ue[0]===V[0]&&Ue[1]===V[1]}),_e=K0(me);return new lc({geometry:new uc(_e)})})}let z=K0(this.segments),F=new lc({geometry:new uc(z)});F.set("graph",u),F.set("mot",this.mot),this.graphsResolutions&&this.graphsResolutions[r]?.length>=2&&(F.set("minResolution",this.graphsResolutions[r][0]),F.set("maxResolution",this.graphsResolutions[r][1])),this.routingLayer?.olLayer?.getSource()?.addFeature(F),this.loading=!1}).catch(P=>{P.name!=="AbortError"&&(this.segments=[],this.dispatchEvent(new sn("error")),this.onRouteError(P,this),this.loading=!1)}):Promise.resolve([])}))}drawViaPoint(n,u,r){let s=new lc;if(s.set("viaPointIdx",u),Array.isArray(n))return s.setGeometry(new _a(n)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s);if(!this.useRawViaPoints||$0.test(n)){let V,me;return this.useRawViaPoints?[,V,,me]=$0.exec(n)||[]:[V,me]=n.split("$"),fetch(`${this.stopsApiUrl}lookup/${V}?key=${this.stopsApiKey}`,{signal:r.signal}).then(_e=>_e.json()).then(_e=>{let{coordinates:Se}=_e.features[0].geometry;return this.cacheStationData[n]=co(Se),s.set("viaPointTrack",me),s.setGeometry(new _a(co(Se))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(_e=>{_e.name!=="AbortError"&&(this.dispatchEvent(new sn("error")),this.onRouteError(_e,this),this.loading=!1)})}if(this.useRawViaPoints&&W0.test(n)){let[V,me]=W0.exec(n)||[],_e=co([parseFloat(me),parseFloat(V)],this.map?.getView().getProjection());return s.setGeometry(new _a(_e)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s)}let[,P,,z,F,,N]=SE.exec(n)||[];if(F&&z){let V=co([parseFloat(F),parseFloat(z)],this.map?.getView().getProjection());return s.set("viaPointTrack",N),s.setGeometry(new _a(V)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s)}return P?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${P}&limit=1`,{signal:r.signal}).then(V=>V.json()).then(V=>{let{coordinates:me}=V.features[0].geometry;return this.cacheStationData[n]=co(me),s.set("viaPointTrack",N),s.setGeometry(new _a(co(me))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(V=>(this.dispatchEvent(new sn("error")),this.onRouteError(V,this),this.loading=!1,null)):Promise.resolve(null)}onMapClick(n){let r=n.target.getFeaturesAtPixel(n.pixel).find(s=>s.getGeometry()?.getType()===Mt.POINT&&s.get("viaPointIdx")!==void 0);if(r){this.removeViaPoint(r.get("viaPointIdx"));return}this.addViaPoint(n.coordinate)}onModifyStart(n){let u=-1,r=n.features.getArray().find(P=>P.getGeometry()?.getType()===Mt.LINE_STRING);if(r&&r.getGeometry()&&n.mapBrowserEvent.coordinate){let P=yl(new _a(r.getGeometry()?.getClosestPoint(n.mapBrowserEvent.coordinate)).getExtent(),.001);u=this.segments.findIndex(z=>z.getGeometry()?.intersectsExtent(P))}let s=(n.features.getArray().filter(P=>P.getGeometry()?.getType()===Mt.POINT)||[])[0];this.initialRouteDrag={viaPoint:s,oldRoute:r&&r.clone(),segmentIndex:u}}onModifyEnd(n){let u=n.mapBrowserEvent.coordinate,{oldRoute:r,viaPoint:s,segmentIndex:P}=this.initialRouteDrag||{};return s?this.addViaPoint(u,s.get("viaPointIdx"),1):r?P===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(u,(P||0)+1):this.addViaPoint(u,0,1)}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 E_({source:this.routingLayer?.olLayer?.getSource()||void 0,pixelTolerance:4,hitDetection:this.routingLayer?.olLayer,deleteCondition:n=>{let r=n.target.getFeaturesAtPixel(n.pixel,{hitTolerance:5}).find(s=>s.getGeometry()?.getType()===Mt.POINT&&s.get("index"));return A0(n)&&r?(this.removeViaPoint(r.get("index")),!0):!1}}),this.modifyInteraction.on("modifystart",this.onModifyStart),this.modifyInteraction.on("modifyend",this.onModifyEnd),this.modifyInteraction.setActive(!1)}addListeners(){!this.modify||(this.removeListeners(),this.onMapClickKey=this.map?.on("singleclick",this.onMapClick))}removeListeners(){this.onMapClickKey&&Ha(this.onMapClickKey)}activate(){super.activate(),this.map&&(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.graphsResolutions=Sd.getGraphsResolutions(this.graphs,this.map),this.modifyInteraction&&this.map.removeInteraction(this.modifyInteraction),this.routingLayer?.attachToMap(this.map),this.modifyInteraction&&this.map.addInteraction(this.modifyInteraction),this.modifyInteraction?.setActive(this.modify),this.addListeners())}deactivate(){this.map&&(this.routingLayer?.detachFromMap(),this.modifyInteraction&&this.map.removeInteraction(this.modifyInteraction),this.removeListeners(),this.reset())}render(){}},H0=Sd;var P_=class extends af{constructor(n){super(n);let{apiParams:u,apiKey:r,url:s,placeholder:P}=n||{};this.apiParams={limit:20,...u||{}},this.placeholder=P||"Search for a stop...";let z={apiKey:r};s&&(z.url=s),this.api=new Xf(z),this.abortController=new AbortController}deactivate(){}render(n){let u=n?.features||[];!this.suggestionsElt||(this.suggestionsElt.style.display=u.length?"block":"none",this.suggestionsElt.innerHTML="",u.forEach(r=>{let s=document.createElement("div");s.innerHTML=r?.properties?.name,s.onclick=()=>{this.onSuggestionClick(r)},Object.assign(s.style,{padding:"5px 12px"}),this.suggestionsElt?.appendChild(s)}))}createDefaultElement(){this.element=document.createElement("div"),this.element.id="mbt-search",Object.assign(this.element.style,{position:"absolute",top:0,left:"50px",margin:"10px",display:"flex",flexDirection:"column",width:"320px"}),this.inputElt=document.createElement("input"),this.inputElt.type="text",this.inputElt.placeholder=this.placeholder,this.inputElt.autocomplete="off",this.inputElt.onkeyup=n=>{this.abortController?.abort(),this.abortController=new AbortController,this.search(n.target.value,this.abortController)},Object.assign(this.inputElt.style,{padding:"10px 30px 10px 10px"}),this.element.appendChild(this.inputElt),this.suggestionsElt=document.createElement("div"),Object.assign(this.suggestionsElt.style,{backgroundColor:"white",overflowY:"auto",cursor:"pointer"}),this.element.appendChild(this.suggestionsElt),this.clearElt=document.createElement("div"),Object.assign(this.clearElt.style,{display:"none",position:"absolute",right:"0",padding:"0 10px",fontSize:"200%",cursor:"pointer"}),this.clearElt.innerHTML="\xD7",this.clearElt.onclick=()=>this.clear(),this.element.appendChild(this.clearElt)}search(n,u){return(n!==void 0||n!==null)&&(this.apiParams.q=n),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,u&&{signal:u.signal}).then(r=>{this.render(r)}).catch(()=>{this.render()})}onSuggestionClick(n){}clear(){!this.suggestionsElt||!this.inputElt||!this.clearElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}},Y0=P_;var M_=class extends Y0{onSuggestionClick(h){let n=co(h.geometry.coordinates);this.map.getView().setCenter(n)}},J0=M_;var e1=Gp(Q0());var R_=class extends Is{constructor(n){super(n);this.olLayer=new Hh({source:new cf({}),render:this.getOlLayerRender()}),this.styleUrl=n.url,this.apiKey=n.apiKey,this.apiKeyName=n.apiKeyName||"key",this.updateAttribution=this.updateAttribution.bind(this)}attachToMap(n){super.attachToMap(n),this.map&&(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.loadMbMap())}detachFromMap(){this.mbMap&&(this.mbMap.off("idle",this.updateAttribution),this.mbMap.triggerRepaint=()=>{},this.mbMap.remove(),this.mbMap=void 0),this.loaded=!1,super.detachFromMap()}loadMbMap(){if(this.olListenersKeys.push(this.map?.on("change:target",()=>{this.loadMbMap()})),!this.map?.getTargetElement())return;if(!this.visible){this.olListenersKeys.push(this.once("change:visible",()=>{this.loadMbMap()}));return}let n=document.createElement("div");if(n.style.position="absolute",n.style.width="100%",n.style.height="100%",!this.styleUrl){console.error(`No styleUrl defined for mapbox layer: ${this.styleUrl}`);return}!this.apiKey&&!this.styleUrl?.includes(this.apiKeyName)&&console.error(`No apiKey defined for mapbox layer with style url to ${this.styleUrl}`);let u=this.getMapboxMapClass();this.mbMap=new u({style:Zh(this.styleUrl,{[this.apiKeyName]:this.apiKey}).toString(),container:n,interactive:!1,trackResize:!1,attributionControl:!1,...this.options.mapOptions||{}}),this.mbMap.once("load",()=>{this.loaded=!0,this.dispatchEvent(new sn("load"))}),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(n){let u=oc(n.target)||[];this.copyrights?.toString()!==u.toString()&&(this.copyrights=u,this.olLayer?.getSource()?.setAttributions(u))}getFeatureInfoAtCoordinate(n,u){if(!u||!this.format||!this.mbMap||!this.mbMap.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=n&&this.mbMap.project(lh(n)),s;if(this.hitTolerance){let{x:z,y:F}=r;s=[{x:z-this.hitTolerance,y:F-this.hitTolerance},{x:z+this.hitTolerance,y:F+this.hitTolerance}]}let P=this.mbMap.queryRenderedFeatures(s||r,u).map(z=>{let F=this.format.readFeature(z);return F&&F.set("mapboxFeature",z),F});return Promise.resolve({layer:this,features:P,coordinate:n})}getOlLayerRender(){console.error("This function must be implemented in subclasses");let n=document.createElement("div");return()=>n}getMapboxMapClass(){return console.error("This function must be implemented in subclasses"),null}},fg=R_;var np=class extends fg{attachToMap(n){super.attachToMap(n),this.map&&this.olListenersKeys.push(this.map.on("change:size",()=>{try{this.mbMap&&this.mbMap.resize()}catch(u){console.warn(u)}}))}loadMbMap(){let[n,u]=this.map?.getView().getCenter()||[];if((!n||!u)&&(n=0,u=0),this.renderState={center:[n,u],zoom:void 0,rotation:void 0,visible:void 0,opacity:void 0,size:[0,0]},super.loadMbMap(),!this.mbMap)return;this.mbMap.once("load",()=>{!this.mbMap||(this.mbMap.resize(),this.copyrights=oc(this.mbMap)||[],this.olLayer?.getSource()?.setAttributions(this.copyrights))});let r=this.mbMap.getCanvas();r&&(this.options.tabIndex?r.setAttribute("tabindex",`${this.options.tabIndex}`):r.removeAttribute("tabindex"))}getOlLayerRender(){return tf(this)}getMapboxMapClass(){return e1.Map}clone(n){return new np({...this.options,...n})}};var i1=Gp(r1());var op=class extends fg{getOlLayerRender(){return ef(this)}getMapboxMapClass(){return i1.Map}clone(n){return new op({...this.options,...n})}};var Id=class extends Is{constructor(n){super(n);this.mapboxLayer=n.mapboxLayer,this.disabled=!1,this.styleLayersFilter=n.styleLayersFilter,this.beforeId=n.beforeId,this.featureInfoFilter=n.featureInfoFilter||(u=>u),this.queryRenderedLayersFilter=n.queryRenderedLayersFilter,this.highlightedFeatures=[],this.selectedFeatures=[],this.styleLayers=(n.styleLayer?[n.styleLayer]:n.styleLayers)||[],this.addStyleLayers=this.addStyleLayers.bind(this),this.onLoad=this.onLoad.bind(this),n.filters&&(this.addDynamicFilters=()=>{this.setFilter(typeof n.filters=="function"?n.filters(this):n.filters)}),!this.styleLayersFilter&&this.styleLayers&&(this.styleLayersFilter=u=>!!this.styleLayers?.find(r=>u.id===r.id))}attachToMap(n){if(this.mapboxLayer&&!this.mapboxLayer.map&&this.mapboxLayer?.attachToMap(n),super.attachToMap(n),!this.map||!this.mapboxLayer)return;let{mbMap:u}=this.mapboxLayer;if(!u){this.olListenersKeys.push(this.map.on("change:target",()=>{this.attachToMap(n)}));return}this.mapboxLayer.loaded||u.isStyleLoaded()||u.loaded()?this.onLoad():u.once("load",this.onLoad),this.olListenersKeys.push(this.on("change:visible",r=>{this.applyLayoutVisibility(r)})),this.olListenersKeys.push(this.mapboxLayer.on("load",()=>{this.onLoad()}))}detachFromMap(){if(this.mapboxLayer?.mbMap){let{mbMap:n}=this.mapboxLayer;n.off("load",this.onLoad),this.removeStyleLayers()}super.detachFromMap()}addStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r,source:s}=u;n.getSource(s)&&r&&!n.getLayer(r)&&n.addLayer(u,this.beforeId)}),this.applyLayoutVisibility()}removeStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r}=u;r&&n.getLayer(r)&&n.removeLayer(r)})}onLoad(){if(this.addStyleLayers(),this.addDynamicFilters&&this.addDynamicFilters(),!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer,u=n.getStyle();if(u&&this.styleLayersFilter){let r=u.layers.filter(this.styleLayersFilter);this.disabled=!r.length}}getFeatureInfoAtCoordinate(n){if(!this.mapboxLayer?.mbMap)return Promise.resolve({coordinate:n,features:[],layer:this});let{mbMap:u}=this.mapboxLayer;if(!u.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=this.styleLayers||[];return this.styleLayersFilter&&(r=u.getStyle().layers.filter(this.styleLayersFilter)),this.queryRenderedLayersFilter&&(r=u.getStyle().layers.filter(this.queryRenderedLayersFilter)),this.mapboxLayer.getFeatureInfoAtCoordinate(n,{layers:r.map(s=>s&&s.id),validate:!1}).then(s=>{let P=s.features.filter(z=>this.featureInfoFilter(z,this.map?.getView().getResolution()));return this.highlight(P),{...s,features:P,layer:this}})}setFilter(n){if(!this.mapboxLayer?.mbMap)return;let{mbMap:u}=this.mapboxLayer;this.styleLayers.forEach(({id:r})=>{r&&n&&u.getLayer(r)&&u.setFilter(r,n)})}setHoverState(n,u){if(!this.mapboxLayer?.mbMap)return;let{mbMap:r}=this.mapboxLayer;!n||!r||n.forEach(s=>{let{source:P,sourceLayer:z}=s.get("mapboxFeature")||{};if(!P&&!z||!s.getId()){s.getId()||console.warn("No feature's id found. To use the feature state functionnality, tiles must be generated with --generate-ids. See https://github.com/mapbox/tippecanoe#adding-calculated-attributes.",s.getId(),s.getProperties());return}r.setFeatureState({id:s.getId(),source:P,sourceLayer:z},{hover:u})})}select(n=[]){this.setHoverState(this.selectedFeatures||[],!1),this.selectedFeatures=n,this.setHoverState(this.selectedFeatures||[],!0)}highlight(n=[]){let u=this.highlightedFeatures?.filter(r=>!(this.selectedFeatures||[]).map(s=>s.getId()).includes(r.getId()))||[];this.setHoverState(u,!1),this.highlightedFeatures=n,this.setHoverState(this.highlightedFeatures,!0)}applyLayoutVisibility(n){let{visible:u}=this,r=this.styleLayersFilter;if(!this.mapboxLayer?.mbMap)return;let{mbMap:s}=this.mapboxLayer,P=s.getStyle();if(!!P&&r){let z=u?"visible":"none";for(let F=0;F<P.layers.length;F+=1){let N=P.layers[F];r(N)&&s.getLayer(N.id)&&s.setLayoutProperty(N.id,"visibility",z)}}}clone(n){return new Id({...this.options,...n})}},n1=Id;var U_=Gp(l1()),N_=Gp(f1());function aT(y){return class extends y{constructor(u){super({hitTolerance:10,...u});this.debug=u.debug||!1,this.mode=u.mode||ia.TOPOGRAPHIC,this.api=u.api||new $f(u),this.tenant=u.tenant||"",this.minZoomNonTrain=u.minZoomNonTrain||9,this.minZoomInterpolation=u.minZoomInterpolation||8,this.format=new bl,this.generalizationLevelByZoom=u.generalizationLevelByZoom||[5,5,5,5,5,5,5,5,10,30,30,100,100,100],this.getGeneralizationLevelByZoom=r=>u.getGeneralizationLevelByZoom&&u.getGeneralizationLevelByZoom(r,this.generalizationLevelByZoom)||this.generalizationLevelByZoom[r],this.renderTimeIntervalByZoom=u.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=>u.getRenderTimeIntervalByZoom&&u.getRenderTimeIntervalByZoom(r,this.renderTimeIntervalByZoom)||this.renderTimeIntervalByZoom[r],this.isUpdateBboxOnMoveEnd=u.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,N_.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,U_.default)(this.renderTrajectoriesInternal,50,{leading:!0,trailing:!0,maxWait:5e3}),this.onFeatureHover=this.onFeatureHover.bind(this),this.onFeatureClick=this.onFeatureClick.bind(this),this.renderTrajectoriesInternal=this.renderTrajectoriesInternal.bind(this),this.onTrajectoryMessage=this.onTrajectoryMessage.bind(this),this.onDeleteTrajectoryMessage=this.onDeleteTrajectoryMessage.bind(this),this.onDocumentVisibilityChange=this.onDocumentVisibilityChange.bind(this)}defineProperties(u){let{style:r,speed:s,pixelRatio:P,hoverVehicleId:z,selectedVehicleId:F,filter:N,sort:V,time:me,live:_e,canvas:Se,styleOptions:Ue}=u,He=s||1,Ie=me||new Date;super.defineProperties(u),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{value:Se||document.createElement("canvas")},style:{value:r||Kh},styleOptions:{value:{...rf,...Ue||{}}},speed:{get:()=>He,set:Ge=>{He=Ge,this.start()}},filter:{value:N,writable:!0},sort:{value:V,writable:!0},live:{value:_e===!1?_e:!0,writable:!0},time:{get:()=>Ie,set:Ge=>{Ie=Ge&&Ge.getTime?Ge:new Date(Ge),this.renderTrajectories()}},trajectories:{value:{},writable:!0},hoverVehicleId:{value:z,writable:!0},selectedVehicleId:{value:F,writable:!0},pixelRatio:{value:P||(typeof window<"u"?window.devicePixelRatio:1),writable:!0},useRequestAnimationFrame:{value:u.useRequestAnimationFrame||!1,writable:!0},useThrottle:{value:u.useThrottle!==!1,writable:!0},useDebounce:{value:u.useDebounce||!1,writable:!0}})}attachToMap(u){super.attachToMap(u),this.visible&&this.start(),this.visibilityRef=this.on("change:visible",r=>{r.target.visible?this.start():this.stop()}),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),Ha(this.visibilityRef),this.canvas&&(this.canvas.getContext("2d")?.clearRect(0,0,this.canvas.width,this.canvas.height),super.detachFromMap())}start(){this.stop(),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()}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()}stopUpdateTime(){this.updateTimeInterval&&(clearInterval(this.updateTimeInterval),this.updateTimeInterval=void 0)}renderTrajectoriesInternal(u,r=!1){if(!this.map||!this.trajectories)return!1;let s=this.live?Date.now():this.time?.getTime(),P=Object.values(this.trajectories);return this.sort&&P.sort(this.sort),!this.canvas||!this.style||(this.renderState=Hf(this.canvas,P,this.style,{...u,pixelRatio:this.pixelRatio||1,time:s},{filter:this.filter,noInterpolate:(u.zoom||0)<this.minZoomInterpolation?!0:r,hoverVehicleId:this.hoverVehicleId,selectedVehicleId:this.selectedVehicleId,...this.styleOptions})),!0}renderTrajectories(u,r){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=void 0),u&&(!r&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(u,r)}):!r&&this.useDebounce?this.debounceRenderTrajectories(u,r):!r&&this.useThrottle?this.throttleRenderTrajectories(u,r):this.renderTrajectoriesInternal(u,r))}setBbox(u,r){if(this.trajectories&&u&&r){let P=Object.keys(this.trajectories);for(let z=P.length-1;z>=0;z-=1)this.purgeTrajectory(this.trajectories[P[z]],u,r)}if(!u)return;let s=[...u];this.isUpdateBboxOnMoveEnd&&r&&(s.push(r),this.tenant&&s.push(`tenant=${this.tenant}`),this.generalizationLevel=this.getGeneralizationLevelByZoom(r),this.generalizationLevel&&s.push(`gen=${this.generalizationLevel}`)),this.api.bbox=s}setMode(u){this.mode!==u&&(this.mode=u,this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd))}getRefreshTimeInMs(u=0){let r=u!==void 0?Math.round(u):-1,s=this.getRenderTimeIntervalByZoom(r)||25,P=Math.max(25,s/(this.speed||1)),z=Math.min(P,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,N_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,U_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0,maxWait:5e3})),this.api?.buffer){let[,F]=this.api.buffer;this.api.buffer=[z,F]}return P}getVehicle(u){return this.trajectories&&Object.values(this.trajectories).filter(u)||[]}getFeatureInfoAtCoordinate(u,r){let{resolution:s,nb:P}=r,z=yl([...u,...u],this.hitTolerance*s),F=Object.values(this.trajectories||{});this.sort&&(F=F.sort(this.sort));let N=[];for(let V=0;V<F.length&&(F[V].properties.coordinate&&Kp(z,F[V].properties.coordinate)&&N.push(F[V]),N.length!==P);V+=1);return Promise.resolve({layer:this,features:N.map(V=>this.format.readFeature(V)),coordinate:u})}getTrajectoryInfos(u){let r=[this.api.getStopSequence(u),this.api.getFullTrajectory(u,this.mode,this.generalizationLevel)];return Promise.all(r).then(([s,P])=>({stopSequence:s,fullTrajectory:P}))}purgeTrajectory(u,r,s){let{type:P,bounds:z}=u.properties;return!Lo(r,z)||P!=="rail"&&s<(this.minZoomNonTrain||9)?(this.removeTrajectory(u),!0):!1}addTrajectory(u){this.filter&&!this.filter(u)||(this.trajectories||(this.trajectories={}),this.trajectories[u.properties.train_id]=u,this.renderTrajectories())}removeTrajectory(u){let r;typeof u!="string"?r=u?.properties?.train_id:r=u,this.trajectories&&delete this.trajectories[r]}onZoomEnd(){this.startUpdateTime()}onDocumentVisibilityChange(){!this.visible||(document.hidden?this.stop():this.start())}onTrajectoryMessage(u){if(!u.content)return;let r=u.content,{geometry:s,properties:{train_id:P,time_since_update:z,raw_coordinates:F}}=r;z<0||this.purgeTrajectory(r)||(this.debug&&this.mode===ia.TOPOGRAPHIC&&F?r.properties.olGeometry={type:"Point",coordinates:co(F,this.map.getView().getProjection())}:r.properties.olGeometry=this.format.readGeometry(s),r.properties.timeOffset=Date.now()-u.timestamp,this.addTrajectory(r))}onDeleteTrajectoryMessage(u){!u.content||this.removeTrajectory(u.content)}onFeatureHover(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.hoverVehicleId!==z&&(this.hoverVehicleId=z,this.renderTrajectories(!0))}onFeatureClick(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.selectedVehicleId!==z&&(this.selectedVehicleId=z,this.selectedVehicle=P,this.renderTrajectories(!0))}}}var mg=aT;var sT=new Wl({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),lT=(y,h,n)=>{let u="#ffffff",r=y.get("type"),s=y.get("stroke");return s&&s[0]!=="#"&&(s=`#${s}`),u=s||n?.getBgColor(r),u=/#ffffff/i.test(u)?"#ff0000":u,[sT,new Wl({zIndex:3,image:new xl({radius:4,fill:new Ks({color:u})}),stroke:new va({color:u,width:4})})]},gg=lT;var uT=new Wl({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),cT=new Wl({zIndex:3,image:new xl({radius:4,fill:new Ks({color:"#a0a0a0"})}),stroke:new va({color:"#a0a0a0",width:4})}),hT=()=>[uT,cT],d1=hT;var pT=new bl,Cd=class extends mg(Is){constructor(h){super({...h}),this.olLayer=h.olLayer||new v_({layers:[new tp({source:new rp({features:[]}),style:(n,u)=>(h.fullTrajectoryStyle||gg)(n,u,this.styleOptions)}),new Hh({source:new cf({}),render:n=>{if(this.container||(this.container=document.createElement("div"),this.container.style.position="absolute",this.container.style.width="100%",this.container.style.height="100%",this.transformContainer=document.createElement("div"),this.transformContainer.style.position="absolute",this.transformContainer.style.width="100%",this.transformContainer.style.height="100%",this.container.appendChild(this.transformContainer),this.canvas&&(this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0",this.canvas.style.transformOrigin="top left",this.transformContainer.appendChild(this.canvas))),this.renderedViewState){let{center:u,resolution:r,rotation:s}=n.viewState,{center:P,resolution:z,rotation:F}=this.renderedViewState;if(z/r>=3)this.canvas?.getContext("2d")?.clearRect(0,0,this.canvas?.width,this.canvas?.height);else{let N=this.map.getPixelFromCoordinate(P),V=this.map.getPixelFromCoordinate(u);this.transformContainer.style.transform=Lv(N[0]-V[0],N[1]-V[1],z/r,z/r,s-F,0,0)}}return this.container}})]}),this.vectorLayer=this.olLayer.getLayers().item(0),this.renderState={center:[0,0],zoom:void 0,rotation:0}}attachToMap(h){super.attachToMap(h),this.map&&this.olListenersKeys.push(...this.map.on(["moveend","change:target"],n=>{let u=(n.map||n.target).getView();if(u.getAnimating()||u.getInteracting())return;let r=u.getZoom();this.currentZoom!==r&&this.onZoomEnd(),this.currentZoom=r,this.onMoveEnd(n)}))}detachFromMap(){super.detachFromMap(),this.container=null}hasFeatureInfoAtCoordinate(h){if(this.map&&this.canvas){let n=this.canvas.getContext("2d"),u=this.map.getPixelFromCoordinate(h);return!!n?.getImageData(u[0]*(this.pixelRatio||1),u[1]*(this.pixelRatio||1),1,1).data[3]}return!1}renderTrajectories(h){if(!this.map)return;let n=this.map.getView();super.renderTrajectories({size:this.map.getSize(),center:this.map.getView().getCenter(),extent:n.calculateExtent(),resolution:n.getResolution(),rotation:n.getRotation(),zoom:n.getZoom(),pixelRatio:this.pixelRatio},h)}renderTrajectoriesInternal(h,n){if(!this.map)return!1;let u=!1;return u=this.map.getView().getAnimating()||this.map.getView().getInteracting()?!1:super.renderTrajectoriesInternal(h,n),u&&(this.renderedViewState={...h},this.transformContainer&&(this.transformContainer.style.transform="")),u}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getView().getZoom())}getFeatureInfoAtCoordinate(h,n={}){let u=this.map.getView().getResolution();return super.getFeatureInfoAtCoordinate(h,{resolution:u,...n})}onMoveEnd(h){this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.userClickInteractions&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}onZoomEnd(){super.onZoomEnd()}onFeatureHover(h,n,u){super.onFeatureHover(h,n,u),this.map.getTargetElement().style.cursor=h.length?"pointer":"auto"}onFeatureClick(h,n,u){super.onFeatureClick(h,n,u),!h.length&&this.vectorLayer&&this.vectorLayer.getSource().clear(),this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}purgeTrajectory(h,n,u){return super.purgeTrajectory(h,n||this.map.getView().calculateExtent(),u||this.map.getView().getZoom())}setBbox(h,n){let u=h,r=n;!u&&this.isUpdateBboxOnMoveEnd&&(u=h||this.map.getView().calculateExtent(),r=Math.floor(this.map.getView().getZoom())),super.setBbox(u,r)}highlightTrajectory(h){this.api.getFullTrajectory(h,this.mode,this.generalizationLevel).then(n=>{let u=n.content;if(this.vectorLayer.getSource().clear(),!u||!u.features||!u.features.length)return;let r=pT.readFeatures(u);this.vectorLayer.getSource().addFeatures(r)})}clone(h){return new Cd({...this.options,...h})}},m1=Cd;var Ad=class extends Is{getFeatureInfoAtCoordinate(h){let n=[];if(this.map){let u=this.map.getPixelFromCoordinate(h);n=this.map.getFeaturesAtPixel(u,{layerFilter:r=>r===this.olLayer,hitTolerance:this.hitTolerance})}return Promise.resolve({features:n,layer:this,coordinate:h})}clone(h){return new Ad({...this.options,...h})}},g1=Ad;var Pd=class extends Is{constructor(n){super(n);this.abortController=new AbortController,this.format=new bl}getFeatureInfoUrl(n){if(!this.map)return;let u=this.map.getView().getProjection(),r=this.map.getView().getResolution();if(r&&u&&this.olLayer?.getSource()?.getFeatureInfoUrl)return this.olLayer?.getSource()?.getFeatureInfoUrl(n,r,u,{info_format:"application/json",query_layers:this.olLayer?.getSource()?.getParams().layers})}getFeatureInfoAtCoordinate(n){this.abortController?.abort(),this.abortController=new AbortController;let{signal:u}=this.abortController,r=this.getFeatureInfoUrl(n);return r?fetch(r,{signal:u}).then(s=>s.json()).then(s=>s.features).then(s=>({layer:this,coordinate:n,features:s.map(P=>this.format.readFeature(P))})).catch(()=>Promise.resolve({features:[],coordinate:n,layer:this})):(console.error("No url for the WMS layer."),Promise.resolve({features:[],coordinate:n,layer:this}))}clone(n){return new Pd({...this.options,...n})}},y1=Pd;var bg={};oy(bg,{CopyrightControl:()=>_1,Layer:()=>_g,RealtimeAPI:()=>$f,RealtimeLayer:()=>L1,RealtimeModes:()=>ia,RoutingAPI:()=>Zf,StopsAPI:()=>Xf,createRealtimeFilters:()=>cy,debounceDeparturesMessages:()=>Cy,debounceWebsocketMessages:()=>Wf,getCircleCanvas:()=>Dy,getDelayBgCanvas:()=>Ry,getDelayTextCanvas:()=>zy,getHoursAndMinutes:()=>Cv,getLayersAsFlatArray:()=>Kf,getMapboxMapCopyrights:()=>oc,getMapboxRender:()=>tf,getMaplibreRender:()=>ef,getMercatorResolution:()=>xg,getSourceCoordinates:()=>Ld,getTextCanvas:()=>Oy,getUTCDateString:()=>Sv,getUTCTimeString:()=>Iv,getUrlWithParams:()=>Zh,pad:()=>Rm,realtimeConfig:()=>rf,realtimeDefaultStyle:()=>Kh,realtimeDelayStyle:()=>Fy,realtimeSimpleStyle:()=>By,removeDuplicate:()=>Xh,renderTrajectories:()=>Hf,sortAndFilterDepartures:()=>id,sortByDelay:()=>hy});var V_=class extends Zm{constructor(h){super(h),this.render=this.render.bind(this)}activate(){super.activate(),this.map&&(this.map.on("sourcedata",this.render),this.map.on("styledata",this.render),this.map.on("idle",this.render))}deactivate(){this.map&&(this.map.off("sourcedata",this.render),this.map.off("styledata",this.render),this.map.off("idle",this.render)),super.deactivate()}getCopyrights(){return oc(this.map)}},_1=V_;var Md=class extends cg(ip){attachToMap(n){super.attachToMap(n),!!this.map&&this.userInteractions&&(this.toggleVisibleListeners(),this.onChangeVisibleKey=this.on("change:visible",this.toggleVisibleListeners))}detachFromMap(){this.map&&(this.deactivateUserInteractions(),Ha(this.onChangeVisibleKey)),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&this.map.on("click",this.onUserClickCallback),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&this.map.on("mousemove",this.onUserMoveCallback)}deactivateUserInteractions(){this.map&&(this.map.off("mousemove",this.onUserMoveCallback),this.map.off("click",this.onUserClickCallback))}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}getMercatorExtent(){let n=this.map.getBounds().toArray();return td([...n[0],...n[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(n){return new Md({...this.options,...n})}},_g=Md;var jo=63710088e-1,v1={centimeters:jo*100,centimetres:jo*100,degrees:jo/111325,feet:jo*3.28084,inches:jo*39.37,kilometers:jo/1e3,kilometres:jo/1e3,meters:jo,metres:jo,miles:jo/1609.344,millimeters:jo*1e3,millimetres:jo*1e3,nauticalmiles:jo/1852,radians:1,yards:jo*1.0936},k5={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/jo,yards:1.0936133};function x1(y,h,n){n===void 0&&(n={});var u={type:"Feature"};return(n.id===0||n.id)&&(u.id=n.id),n.bbox&&(u.bbox=n.bbox),u.properties=h||{},u.geometry=y,u}function xh(y,h,n){if(n===void 0&&(n={}),!y)throw new Error("coordinates is required");if(!Array.isArray(y))throw new Error("coordinates must be an Array");if(y.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!G_(y[0])||!G_(y[1]))throw new Error("coordinates must contain numbers");var u={type:"Point",coordinates:y};return x1(u,h,n)}function fT(y,h){h===void 0&&(h="kilometers");var n=v1[h];if(!n)throw new Error(h+" units is invalid");return y*n}function dT(y,h){h===void 0&&(h="kilometers");var n=v1[h];if(!n)throw new Error(h+" units is invalid");return y/n}function b1(y){var h=y%(2*Math.PI);return h*180/Math.PI}function ap(y){var h=y%360;return h*Math.PI/180}function vg(y,h,n){if(h===void 0&&(h="kilometers"),n===void 0&&(n="kilometers"),!(y>=0))throw new Error("length must be a positive number");return fT(dT(y,h),n)}function G_(y){return!isNaN(y)&&y!==null&&!Array.isArray(y)}function j_(y){return!!y&&y.constructor===Object}function kd(y,h,n){if(y!==null)for(var u,r,s,P,z,F,N,V=0,me=0,_e,Se=y.type,Ue=Se==="FeatureCollection",He=Se==="Feature",Ie=Ue?y.features.length:1,Ge=0;Ge<Ie;Ge++){N=Ue?y.features[Ge].geometry:He?y.geometry:y,_e=N?N.type==="GeometryCollection":!1,z=_e?N.geometries.length:1;for(var et=0;et<z;et++){var rt=0,_t=0;if(P=_e?N.geometries[et]:N,P!==null){F=P.coordinates;var yt=P.type;switch(V=n&&(yt==="Polygon"||yt==="MultiPolygon")?1:0,yt){case null:break;case"Point":if(h(F,me,Ge,rt,_t)===!1)return!1;me++,rt++;break;case"LineString":case"MultiPoint":for(u=0;u<F.length;u++){if(h(F[u],me,Ge,rt,_t)===!1)return!1;me++,yt==="MultiPoint"&&rt++}yt==="LineString"&&rt++;break;case"Polygon":case"MultiLineString":for(u=0;u<F.length;u++){for(r=0;r<F[u].length-V;r++){if(h(F[u][r],me,Ge,rt,_t)===!1)return!1;me++}yt==="MultiLineString"&&rt++,yt==="Polygon"&&_t++}yt==="Polygon"&&rt++;break;case"MultiPolygon":for(u=0;u<F.length;u++){for(_t=0,r=0;r<F[u].length;r++){for(s=0;s<F[u][r].length-V;s++){if(h(F[u][r][s],me,Ge,rt,_t)===!1)return!1;me++}_t++}rt++}break;case"GeometryCollection":for(u=0;u<P.geometries.length;u++)if(kd(P.geometries[u],h,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function mT(y,h){h===void 0&&(h={});var n=0,u=0,r=0;return kd(y,function(s){n+=s[0],u+=s[1],r++},!0),xh([n/r,u/r],h.properties)}var w1=mT;function Mu(y){if(!y)throw new Error("coord is required");if(!Array.isArray(y)){if(y.type==="Feature"&&y.geometry!==null&&y.geometry.type==="Point")return y.geometry.coordinates;if(y.type==="Point")return y.coordinates}if(Array.isArray(y)&&y.length>=2&&!Array.isArray(y[0])&&!Array.isArray(y[1]))return y;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function E1(y){if(Array.isArray(y))return y;if(y.type==="Feature"){if(y.geometry!==null)return y.geometry.coordinates}else if(y.coordinates)return y.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function gT(y,h,n){n===void 0&&(n={});var u;n.final?u=T1(Mu(h),Mu(y)):u=T1(Mu(y),Mu(h));var r=u>180?-(360-u):u;return r}function T1(y,h){var n=ap(y[1]),u=ap(h[1]),r=ap(h[0]-y[0]);r>Math.PI&&(r-=2*Math.PI),r<-Math.PI&&(r+=2*Math.PI);var s=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)),P=Math.atan2(r,s);return(b1(P)+360)%360}var S1=gT;function yT(y,h,n){n===void 0&&(n={});var u=Mu(y),r=Mu(h);r[0]+=r[0]-u[0]>180?-360:u[0]-r[0]>180?360:0;var s=_T(u,r),P=vg(s,"meters",n.units);return P}function _T(y,h,n){n=n===void 0?jo:Number(n);var u=n,r=y[1]*Math.PI/180,s=h[1]*Math.PI/180,P=s-r,z=Math.abs(h[0]-y[0])*Math.PI/180;z>Math.PI&&(z-=2*Math.PI);var F=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(r/2+Math.PI/4)),N=Math.abs(F)>1e-11?P/F:Math.cos(r),V=Math.sqrt(P*P+N*N*z*z),me=V*u;return me}var I1=yT;function vT(y,h,n,u){u===void 0&&(u={});var r=h<0,s=vg(Math.abs(h),u.units,"meters");r&&(s=-Math.abs(s));var P=Mu(y),z=xT(P,s,n);return z[0]+=z[0]-P[0]>180?-360:P[0]-z[0]>180?360:0,xh(z,u.properties)}function xT(y,h,n,u){u=u===void 0?jo:Number(u);var r=h/u,s=y[0]*Math.PI/180,P=ap(y[1]),z=ap(n),F=r*Math.cos(z),N=P+F;Math.abs(N)>Math.PI/2&&(N=N>0?Math.PI-N:-Math.PI-N);var V=Math.log(Math.tan(N/2+Math.PI/4)/Math.tan(P/2+Math.PI/4)),me=Math.abs(V)>1e-11?F/V:Math.cos(P),_e=r*Math.sin(z)/me,Se=s+_e;return[(Se*180/Math.PI+540)%360-180,N*180/Math.PI]}var C1=vT;function bT(y){if(!y)throw new Error("geojson is required");switch(y.type){case"Feature":return A1(y);case"FeatureCollection":return wT(y);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return q_(y);default:throw new Error("unknown GeoJSON type")}}function A1(y){var h={type:"Feature"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:h[n]=y[n]}}),h.properties=P1(y.properties),h.geometry=q_(y.geometry),h}function P1(y){var h={};return y&&Object.keys(y).forEach(function(n){var u=y[n];typeof u=="object"?u===null?h[n]=null:Array.isArray(u)?h[n]=u.map(function(r){return r}):h[n]=P1(u):h[n]=u}),h}function wT(y){var h={type:"FeatureCollection"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"features":return;default:h[n]=y[n]}}),h.features=y.features.map(function(n){return A1(n)}),h}function q_(y){var h={type:y.type};return y.bbox&&(h.bbox=y.bbox),y.type==="GeometryCollection"?(h.geometries=y.geometries.map(function(n){return q_(n)}),h):(h.coordinates=M1(y.coordinates),h)}function M1(y){var h=y;return typeof h[0]!="object"?h.slice():h.map(function(n){return M1(n)})}var k1=bT;function ET(y,h,n){if(n=n||{},!j_(n))throw new Error("options is invalid");var u=n.pivot,r=n.mutate;if(!y)throw new Error("geojson is required");if(h==null||isNaN(h))throw new Error("angle is required");return h===0||(u||(u=w1(y)),(r===!1||r===void 0)&&(y=k1(y)),kd(y,function(s){var P=S1(u,s),z=P+h,F=I1(u,s),N=E1(C1(u,F,z));s[0]=N[0],s[1]=N[1]})),y}var Z_=ET;var TT=(y,h=1)=>{let{width:n,height:u}=y.getCanvas(),r=y.unproject({x:0,y:0}),s=y.unproject({x:0,y:u/h}),P=y.unproject({x:n/h,y:u/h}),z=y.unproject({x:n/h,y:0});return[[r.lng,r.lat],[z.lng,z.lat],[P.lng,P.lat],[s.lng,s.lat]]},Ld=TT;var ST=y=>{let h=y.getBounds().toArray(),n=co(h[0]),u=co(h[1]),r=[...n,...u],{width:s,height:P}=y.getCanvas(),z=bs(r)/s,F=Eu(r)/P;return Math.max(z,F)},xg=ST;var X_=class extends mg(_g){constructor(h={}){super({...h}),this.onLoad=this.onLoad.bind(this),this.onMove=this.onMove.bind(this),this.onMoveEnd=this.onMoveEnd.bind(this),this.onZoomEnd=this.onZoomEnd.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this)}attachToMap(h,n){!h||(super.attachToMap(h),this.source={type:"canvas",canvas:this.canvas,coordinates:Ld(h,this.pixelRatio),animate:!0,attribution:this.copyrights&&this.copyrights.join(", ")},this.beforeId=n,this.layer={id:this.key,type:"raster",source:this.key,layout:{visibility:this.visible?"visible":"none"},paint:{"raster-opacity":1,"raster-fade-duration":0,"raster-resampling":"nearest"}},h.isStyleLoaded()&&this.onLoad(),this.map.on("load",this.onLoad),this.listeners=[this.on("change:visible",this.onVisibilityChange)])}detachFromMap(){this.map&&(this.map.off("load",this.onLoad),this.listeners.forEach(h=>{Ha(h)}),this.map.style&&this.map.getLayer(this.key)&&this.map.removeLayer(this.key),this.map.style&&this.map.getSource(this.key)&&this.map.removeSource(this.key)),super.detachFromMap()}start(){super.start(),this.map.on("move",this.onMove),this.map.on("moveend",this.onMoveEnd),this.map.on("zoomend",this.onZoomEnd)}stop(){super.stop(),this.map&&(this.map.off("move",this.onMove),this.map.off("moveend",this.onMoveEnd),this.map.off("zoomend",this.onZoomEnd))}onLoad(){this.map.getSource(this.key)||this.map.addSource(this.key,this.source),this.map.getLayer(this.key)||this.map.addLayer(this.layer,this.beforeId)}onUserMoveCallback(h){super.onUserMoveCallback({coordinate:co(h.lngLat.toArray()),...h})}renderTrajectories(h=!1){if(!this.map)return;this.pixelRatio||(this.pixelRatio=1);let{width:n,height:u}=this.map.getCanvas(),r=this.map.getCenter(),s=this.map.unproject({x:0,y:u/this.pixelRatio}),P=this.map.unproject({x:n/this.pixelRatio,y:0}),z=Z_(xh([s.lng,s.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,F=Z_(xh([P.lng,P.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,N=[...co(z),...co(F)],V=bs(N)/(n/this.pixelRatio),me=Eu(N)/(u/this.pixelRatio),_e=Math.max(V,me),Se={size:[n/this.pixelRatio,u/this.pixelRatio],center:co([r.lng,r.lat]),extent:N,resolution:_e,zoom:this.map.getZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(Se,h)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(h,n={}){let u=xg(this.map);return super.getFeatureInfoAtCoordinate(h,{resolution:u,...n})}onVisibilityChange(){this.visible&&!this.map.getLayer(this.key)?this.map.addLayer(this.layer,this.beforeId):this.map.getLayer(this.key)&&this.map.removeLayer(this.key)}purgeTrajectory(h,n,u){return super.purgeTrajectory(h,n||this.getMercatorExtent(),u||Math.floor(this.map.getZoom()+1))}setBbox(h,n){let u=h,r=n;!u&&this.isUpdateBboxOnMoveEnd&&(u=h||this.getMercatorExtent(),r=Math.floor(this.getOlZoom())),super.setBbox(u,r)}onMove(){this.renderTrajectories()}renderTrajectoriesInternal(h,n=!1){let u=super.renderTrajectoriesInternal(h,n);if(u&&this.map.style){let r=Ld(this.map,this.pixelRatio),s=this.map.getSource(this.key);s&&s.setCoordinates(r)}return u}onMoveEnd(){this.renderTrajectories(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox()}onFeatureHover(h,n,u){super.onFeatureHover(h,n,u),this.map.getCanvasContainer().style.cursor=h.length?"pointer":"auto"}},L1=X_;var W_={ol:yg,mapbox:bg};typeof window<"u"&&(window.mbt=W_);var L3=W_;})();
|
|
1082
|
+
`){Er+=Vr,Vr=0,Jt=_e*yt+jt*Se,++br;continue}var Yr=Ue[xr+1]||F.font;Yr!==Sr&&(r&&or.push("font",Yr),u&&At.push("font",Yr),Sr=Yr),Vr=Math.max(Vr,rt[zr]);var vi=[Vt,Jt+jt*et[zr]+_e*(et[zr]-_t[br]),.5*(Se+Vr)+Er];Jt+=et[zr],r&&or.push("strokeText",vi),u&&At.push("fillText",vi),++zr}return Array.prototype.push.apply(ct,or),Array.prototype.push.apply(ct,At),this.labels_[s]=Lt,Lt},y.prototype.replayTextBackground_=function(h,n,u,r,s,P,z){h.beginPath(),h.moveTo.apply(h,n),h.lineTo.apply(h,u),h.lineTo.apply(h,r),h.lineTo.apply(h,s),h.lineTo.apply(h,n),P&&(this.alignFill_=P[2],this.fill_(h)),z&&(this.setStrokeStyle_(h,z),h.stroke())},y.prototype.calculateImageOrLabelDimensions_=function(h,n,u,r,s,P,z,F,N,V,me,_e,Se,Ue,He,Ie){z*=_e[0],F*=_e[1];var Ge=u-z,et=r-F,rt=s+N>h?h-N:s,_t=P+V>n?n-V:P,yt=Ue[3]+rt*_e[0]+Ue[1],ct=Ue[0]+_t*_e[1]+Ue[2],Tt=Ge-Ue[3],St=et-Ue[0];(He||me!==0)&&(gh[0]=Tt,yh[0]=Tt,gh[1]=St,yc[1]=St,yc[0]=Tt+yt,_c[0]=yc[0],_c[1]=St+ct,yh[1]=_c[1]);var Lt;return me!==0?(Lt=vs(za(),u,r,1,1,me,-u,-r),bo(Lt,gh),bo(Lt,yc),bo(Lt,_c),bo(Lt,yh),sh(Math.min(gh[0],yc[0],_c[0],yh[0]),Math.min(gh[1],yc[1],_c[1],yh[1]),Math.max(gh[0],yc[0],_c[0],yh[0]),Math.max(gh[1],yc[1],_c[1],yh[1]),uf)):sh(Math.min(Tt,Tt+yt),Math.min(St,St+ct),Math.max(Tt,Tt+yt),Math.max(St,St+ct),uf),Se&&(Ge=Math.round(Ge),et=Math.round(et)),{drawImageX:Ge,drawImageY:et,drawImageW:rt,drawImageH:_t,originX:N,originY:V,declutterBox:{minX:uf[0],minY:uf[1],maxX:uf[2],maxY:uf[3],value:Ie},canvasTransform:Lt,scale:_e}},y.prototype.replayImageOrLabel_=function(h,n,u,r,s,P,z){var F=!!(P||z),N=r.declutterBox,V=h.canvas,me=z?z[2]*r.scale[0]/2:0,_e=N.minX-me<=V.width/n&&N.maxX+me>=0&&N.minY-me<=V.height/n&&N.maxY+me>=0;return _e&&(F&&this.replayTextBackground_(h,gh,yc,_c,yh,P,z),Vx(h,r.canvasTransform,s,u,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0},y.prototype.fill_=function(h){if(this.alignFill_){var n=bo(this.renderedTransform_,[0,0]),u=512*this.pixelRatio;h.save(),h.translate(n[0]%u,n[1]%u),h.rotate(this.viewRotation_)}h.fill(),this.alignFill_&&h.restore()},y.prototype.setStrokeStyle_=function(h,n){h.strokeStyle=n[1],h.lineWidth=n[2],h.lineCap=n[3],h.lineJoin=n[4],h.miterLimit=n[5],h.setLineDash&&(h.lineDashOffset=n[7],h.setLineDash(n[6]))},y.prototype.drawLabelWithPointPlacement_=function(h,n,u,r){var s=this.textStates[n],P=this.createLabel(h,n,r,u),z=this.strokeStates[u],F=this.pixelRatio,N=a0(Array.isArray(h)?h[0]:h,s.textAlign||mh),V=yd[s.textBaseline||ep],me=z&&z.lineWidth?z.lineWidth:0,_e=P.width/F-2*s.scale[0],Se=N*_e+2*(.5-N)*me,Ue=V*P.height/F+2*(.5-V)*me;return{label:P,anchorX:Se,anchorY:Ue}},y.prototype.execute_=function(h,n,u,r,s,P,z,F){var N;this.pixelCoordinates_&&_s(u,this.renderedTransform_)?N=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),N=_l(this.coordinates,0,this.coordinates.length,2,u,this.pixelCoordinates_),Mv(this.renderedTransform_,u));for(var V=0,me=r.length,_e=0,Se,Ue,He,Ie,Ge,et,rt,_t,yt,ct,Tt,St,Lt=0,nr=0,jt=null,Jt=null,or=this.coordinateCache_,At=this.viewRotation_,Vr=Math.round(Math.atan2(-u[1],u[0])*1e12)/1e12,Er={context:h,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:At},zr=this.instructions!=r||this.overlaps?0:200,br,Sr,xr,Qr;V<me;){var Vt=r[V],Yr=Vt[0];switch(Yr){case qr.BEGIN_GEOMETRY:br=Vt[1],Qr=Vt[3],br.getGeometry()?z!==void 0&&!Lo(z,Qr.getExtent())?V=Vt[2]+1:++V:V=Vt[2];break;case qr.BEGIN_PATH:Lt>zr&&(this.fill_(h),Lt=0),nr>zr&&(h.stroke(),nr=0),!Lt&&!nr&&(h.beginPath(),Ie=NaN,Ge=NaN),++V;break;case qr.CIRCLE:_e=Vt[1];var vi=N[_e],di=N[_e+1],en=N[_e+2],Br=N[_e+3],Li=en-vi,Mn=Br-di,Ni=Math.sqrt(Li*Li+Mn*Mn);h.moveTo(vi+Ni,di),h.arc(vi,di,Ni,0,2*Math.PI,!0),++V;break;case qr.CLOSE_PATH:h.closePath(),++V;break;case qr.CUSTOM:_e=Vt[1],Se=Vt[2];var Cr=Vt[3],Xn=Vt[4],Zi=Vt.length==6?Vt[5]:void 0;Er.geometry=Cr,Er.feature=br,V in or||(or[V]=[]);var ln=or[V];Zi?Zi(N,_e,Se,2,ln):(ln[0]=N[_e],ln[1]=N[_e+1],ln.length=2),Xn(ln,Er),++V;break;case qr.DRAW_IMAGE:_e=Vt[1],Se=Vt[2],_t=Vt[3],Ue=Vt[4],He=Vt[5];var qo=Vt[6],Wn=Vt[7],Jr=Vt[8],un=Vt[9],$n=Vt[10],Kn=Vt[11],Fn=Vt[12],Xi=Vt[13],gn=Vt[14];if(!_t&&Vt.length>=19){yt=Vt[18],ct=Vt[19],Tt=Vt[20],St=Vt[21];var Tn=this.drawLabelWithPointPlacement_(yt,ct,Tt,St);_t=Tn.label,Vt[3]=_t;var wo=Vt[22];Ue=(Tn.anchorX-wo)*this.pixelRatio,Vt[4]=Ue;var wt=Vt[23];He=(Tn.anchorY-wt)*this.pixelRatio,Vt[5]=He,qo=_t.height,Vt[6]=qo,Xi=_t.width,Vt[13]=Xi}var Wt=void 0;Vt.length>24&&(Wt=Vt[24]);var ho=void 0,yn=void 0,Xr=void 0;Vt.length>16?(ho=Vt[15],yn=Vt[16],Xr=Vt[17]):(ho=dc,yn=!1,Xr=!1),$n&&Vr?Kn+=At:!$n&&!Vr&&(Kn-=At);for(var kn=0;_e<Se;_e+=2)if(!(Wt&&Wt[kn++]<Xi/this.pixelRatio)){var Oi=this.calculateImageOrLabelDimensions_(_t.width,_t.height,N[_e],N[_e+1],Xi,qo,Ue,He,Jr,un,Kn,Fn,s,ho,yn||Xr,br),dn=[h,n,_t,Oi,Wn,yn?jt:null,Xr?Jt:null],Hn=void 0,Zt=void 0;if(F&&gn){var Ur=Se-_e;if(!gn[Ur]){gn[Ur]=dn;continue}if(Hn=gn[Ur],delete gn[Ur],Zt=o0(Hn),F.collides(Zt))continue}F&&F.collides(Oi.declutterBox)||(Hn&&(F&&F.insert(Zt),this.replayImageOrLabel_.apply(this,Hn)),F&&F.insert(Oi.declutterBox),this.replayImageOrLabel_.apply(this,dn))}++V;break;case qr.DRAW_CHARS:var Dr=Vt[1],Vi=Vt[2],Sn=Vt[3],Ar=Vt[4];St=Vt[5];var ro=Vt[6],Wi=Vt[7],bi=Vt[8];Tt=Vt[9];var te=Vt[10];yt=Vt[11],ct=Vt[12];var he=[Vt[13],Vt[13]],de=this.textStates[ct],Te=de.font,Re=[de.scale[0]*Wi,de.scale[1]*Wi],We=void 0;Te in this.widths_?We=this.widths_[Te]:(We={},this.widths_[Te]=We);var Je=Qm(N,Dr,Vi,2),we=Math.abs(Re[0])*r_(Te,yt,We);if(Ar||we<=Je){var Ne=this.textStates[ct].textAlign,ie=(Je-we)*yd[Ne],X=n0(N,Dr,Vi,2,yt,ie,ro,Math.abs(Re[0]),r_,Te,We,Vr?0:this.viewRotation_);e:if(X){var J=[],re=void 0,le=void 0,Ae=void 0,ke=void 0,ge=void 0;if(Tt)for(re=0,le=X.length;re<le;++re){ge=X[re],Ae=ge[4],ke=this.createLabel(Ae,ct,"",Tt),Ue=ge[2]+(Re[0]<0?-te:te),He=Sn*ke.height+(.5-Sn)*2*te*Re[1]/Re[0]-bi;var Oi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ue,He,0,0,ge[3],he,!1,dc,!1,br);if(F&&F.collides(Oi.declutterBox))break e;J.push([h,n,ke,Oi,1,null,null])}if(St)for(re=0,le=X.length;re<le;++re){ge=X[re],Ae=ge[4],ke=this.createLabel(Ae,ct,St,""),Ue=ge[2],He=Sn*ke.height-bi;var Oi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ue,He,0,0,ge[3],he,!1,dc,!1,br);if(F&&F.collides(Oi.declutterBox))break e;J.push([h,n,ke,Oi,1,null,null])}F&&F.load(J.map(o0));for(var Ce=0,Le=J.length;Ce<Le;++Ce)this.replayImageOrLabel_.apply(this,J[Ce])}}++V;break;case qr.END_GEOMETRY:if(P!==void 0){br=Vt[1];var Ke=P(br,Qr);if(Ke)return Ke}++V;break;case qr.FILL:zr?Lt++:this.fill_(h),++V;break;case qr.MOVE_TO_LINE_TO:for(_e=Vt[1],Se=Vt[2],Sr=N[_e],xr=N[_e+1],et=Sr+.5|0,rt=xr+.5|0,(et!==Ie||rt!==Ge)&&(h.moveTo(Sr,xr),Ie=et,Ge=rt),_e+=2;_e<Se;_e+=2)Sr=N[_e],xr=N[_e+1],et=Sr+.5|0,rt=xr+.5|0,(_e==Se-2||et!==Ie||rt!==Ge)&&(h.lineTo(Sr,xr),Ie=et,Ge=rt);++V;break;case qr.SET_FILL_STYLE:jt=Vt,this.alignFill_=Vt[2],Lt&&(this.fill_(h),Lt=0,nr&&(h.stroke(),nr=0)),h.fillStyle=Vt[1],++V;break;case qr.SET_STROKE_STYLE:Jt=Vt,nr&&(h.stroke(),nr=0),this.setStrokeStyle_(h,Vt),++V;break;case qr.STROKE:zr?nr++:h.stroke(),++V;break;default:++V;break}}Lt&&this.fill_(h),nr&&h.stroke()},y.prototype.execute=function(h,n,u,r,s,P){this.viewRotation_=r,this.execute_(h,n,u,this.instructions,s,void 0,void 0,P)},y.prototype.executeHitDetection=function(h,n,u,r,s){return this.viewRotation_=u,this.execute_(h,1,n,this.hitDetectionInstructions,!0,r,s)},y}(),s0=t2;var c_=[On.POLYGON,On.CIRCLE,On.LINE_STRING,On.IMAGE,On.TEXT,On.DEFAULT],r2=function(){function y(h,n,u,r,s,P){this.maxExtent_=h,this.overlaps_=r,this.pixelRatio_=u,this.resolution_=n,this.renderBuffer_=P,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=za(),this.createExecutors_(s)}return y.prototype.clip=function(h,n){var u=this.getClipCoords(n);h.beginPath(),h.moveTo(u[0],u[1]),h.lineTo(u[2],u[3]),h.lineTo(u[4],u[5]),h.lineTo(u[6],u[7]),h.clip()},y.prototype.createExecutors_=function(h){for(var n in h){var u=this.executorsByZIndex_[n];u===void 0&&(u={},this.executorsByZIndex_[n]=u);var r=h[n];for(var s in r){var P=r[s];u[s]=new s0(this.resolution_,this.pixelRatio_,this.overlaps_,P)}}},y.prototype.hasExecutors=function(h){for(var n in this.executorsByZIndex_)for(var u=this.executorsByZIndex_[n],r=0,s=h.length;r<s;++r)if(h[r]in u)return!0;return!1},y.prototype.forEachFeatureAtCoordinate=function(h,n,u,r,s,P){r=Math.round(r);var z=r*2+1,F=vs(this.hitDetectionTransform_,r+.5,r+.5,1/n,-1/n,-u,-h[0],-h[1]),N=!this.hitDetectionContext_;N&&(this.hitDetectionContext_=Ja(z,z));var V=this.hitDetectionContext_;V.canvas.width!==z||V.canvas.height!==z?(V.canvas.width=z,V.canvas.height=z):N||V.clearRect(0,0,z,z);var me;this.renderBuffer_!==void 0&&(me=Ya(),gy(me,h),yl(me,n*(this.renderBuffer_+r),me));var _e=i2(r),Se;function Ue(ct,Tt){for(var St=V.getImageData(0,0,z,z).data,Lt=0,nr=_e.length;Lt<nr;Lt++)if(St[_e[Lt]]>0){if(!P||Se!==On.IMAGE&&Se!==On.TEXT||P.indexOf(ct)!==-1){var jt=(_e[Lt]-3)/4,Jt=r-jt%z,or=r-(jt/z|0),At=s(ct,Tt,Jt*Jt+or*or);if(At)return At}V.clearRect(0,0,z,z);break}}var He=Object.keys(this.executorsByZIndex_).map(Number);He.sort(rh);var Ie,Ge,et,rt,_t;for(Ie=He.length-1;Ie>=0;--Ie){var yt=He[Ie].toString();for(et=this.executorsByZIndex_[yt],Ge=c_.length-1;Ge>=0;--Ge)if(Se=c_[Ge],rt=et[Se],rt!==void 0&&(_t=rt.executeHitDetection(V,F,u,Ue,me),_t))return _t}},y.prototype.getClipCoords=function(h){var n=this.maxExtent_;if(!n)return null;var u=n[0],r=n[1],s=n[2],P=n[3],z=[u,r,u,P,s,P,s,r];return _l(z,0,8,2,h,z),z},y.prototype.isEmpty=function(){return Vl(this.executorsByZIndex_)},y.prototype.execute=function(h,n,u,r,s,P,z){var F=Object.keys(this.executorsByZIndex_).map(Number);F.sort(rh),this.maxExtent_&&(h.save(),this.clip(h,u));var N=P||c_,V,me,_e,Se,Ue,He;for(z&&F.reverse(),V=0,me=F.length;V<me;++V){var Ie=F[V].toString();for(Ue=this.executorsByZIndex_[Ie],_e=0,Se=N.length;_e<Se;++_e){var Ge=N[_e];He=Ue[Ge],He!==void 0&&He.execute(h,n,u,r,s,z)}}this.maxExtent_&&h.restore()},y}(),h_={};function i2(y){if(h_[y]!==void 0)return h_[y];for(var h=y*2+1,n=y*y,u=new Array(n+1),r=0;r<=y;++r)for(var s=0;s<=y;++s){var P=r*r+s*s;if(P>n)break;var z=u[P];z||(z=[],u[P]=z),z.push(((y+r)*h+(y+s))*4+3),r>0&&z.push(((y-r)*h+(y+s))*4+3),s>0&&(z.push(((y+r)*h+(y-s))*4+3),r>0&&z.push(((y-r)*h+(y-s))*4+3))}for(var F=[],r=0,N=u.length;r<N;++r)u[r]&&F.push.apply(F,u[r]);return h_[y]=F,F}var p_=r2;var vd={ANIMATING:0,INTERACTING:1};var n2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),o2=function(y){n2(h,y);function h(n,u,r,s,P,z,F){var N=y.call(this)||this;return N.context_=n,N.pixelRatio_=u,N.extent_=r,N.transform_=s,N.viewRotation_=P,N.squaredTolerance_=z,N.userTransform_=F,N.contextFillState_=null,N.contextStrokeState_=null,N.contextTextState_=null,N.fillState_=null,N.strokeState_=null,N.image_=null,N.imageAnchorX_=0,N.imageAnchorY_=0,N.imageHeight_=0,N.imageOpacity_=0,N.imageOriginX_=0,N.imageOriginY_=0,N.imageRotateWithView_=!1,N.imageRotation_=0,N.imageScale_=[0,0],N.imageWidth_=0,N.text_="",N.textOffsetX_=0,N.textOffsetY_=0,N.textRotateWithView_=!1,N.textRotation_=0,N.textScale_=[0,0],N.textFillState_=null,N.textStrokeState_=null,N.textState_=null,N.pixelCoordinates_=[],N.tmpLocalTransform_=za(),N}return h.prototype.drawImages_=function(n,u,r,s){if(!!this.image_){var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.tmpLocalTransform_,N=z.globalAlpha;this.imageOpacity_!=1&&(z.globalAlpha=N*this.imageOpacity_);var V=this.imageRotation_;this.imageRotateWithView_&&(V+=this.viewRotation_);for(var me=0,_e=P.length;me<_e;me+=2){var Se=P[me]-this.imageAnchorX_,Ue=P[me+1]-this.imageAnchorY_;if(V!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){var He=Se+this.imageAnchorX_,Ie=Ue+this.imageAnchorY_;vs(F,He,Ie,1,1,V,-He,-Ie),z.setTransform.apply(z,F),z.translate(He,Ie),z.scale(this.imageScale_[0],this.imageScale_[1]),z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),z.setTransform(1,0,0,1,0,0)}else z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,Se,Ue,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(z.globalAlpha=N)}},h.prototype.drawText_=function(n,u,r,s){if(!(!this.textState_||this.text_==="")){this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.textRotation_;for(this.textRotateWithView_&&(F+=this.viewRotation_);u<r;u+=s){var N=P[u]+this.textOffsetX_,V=P[u+1]+this.textOffsetY_;if(F!==0||this.textScale_[0]!=1||this.textScale_[1]!=1){var me=vs(this.tmpLocalTransform_,N,V,1,1,F,-N,-V);z.setTransform.apply(z,me),z.translate(N,V),z.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&z.strokeText(this.text_,0,0),this.textFillState_&&z.fillText(this.text_,0,0),z.setTransform(1,0,0,1,0,0)}else this.textStrokeState_&&z.strokeText(this.text_,N,V),this.textFillState_&&z.fillText(this.text_,N,V)}}},h.prototype.moveToLineTo_=function(n,u,r,s,P){var z=this.context_,F=_l(n,u,r,s,this.transform_,this.pixelCoordinates_);z.moveTo(F[0],F[1]);var N=F.length;P&&(N-=2);for(var V=2;V<N;V+=2)z.lineTo(F[V],F[V+1]);return P&&z.closePath(),r},h.prototype.drawRings_=function(n,u,r,s){for(var P=0,z=r.length;P<z;++P)u=this.moveToLineTo_(n,u,r[P],s,!0);return u},h.prototype.drawCircle=function(n){if(!!Lo(this.extent_,n.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=gx(n,this.transform_,this.pixelCoordinates_),r=u[2]-u[0],s=u[3]-u[1],P=Math.sqrt(r*r+s*s),z=this.context_;z.beginPath(),z.arc(u[0],u[1],P,0,2*Math.PI),this.fillState_&&z.fill(),this.strokeState_&&z.stroke()}this.text_!==""&&this.drawText_(n.getCenter(),0,2,2)}},h.prototype.setStyle=function(n){this.setFillStrokeStyle(n.getFill(),n.getStroke()),this.setImageStyle(n.getImage()),this.setTextStyle(n.getText())},h.prototype.setTransform=function(n){this.transform_=n},h.prototype.drawGeometry=function(n){var u=n.getType();switch(u){case Mt.POINT:this.drawPoint(n);break;case Mt.LINE_STRING:this.drawLineString(n);break;case Mt.POLYGON:this.drawPolygon(n);break;case Mt.MULTI_POINT:this.drawMultiPoint(n);break;case Mt.MULTI_LINE_STRING:this.drawMultiLineString(n);break;case Mt.MULTI_POLYGON:this.drawMultiPolygon(n);break;case Mt.GEOMETRY_COLLECTION:this.drawGeometryCollection(n);break;case Mt.CIRCLE:this.drawCircle(n);break;default:}},h.prototype.drawFeature=function(n,u){var r=u.getGeometryFunction()(n);!r||!Lo(this.extent_,r.getExtent())||(this.setStyle(u),this.drawGeometry(r))},h.prototype.drawGeometryCollection=function(n){for(var u=n.getGeometriesArray(),r=0,s=u.length;r<s;++r)this.drawGeometry(u[r])},h.prototype.drawPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},h.prototype.drawMultiPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},h.prototype.drawLineString=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lo(this.extent_,n.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getFlatCoordinates();u.beginPath(),this.moveToLineTo_(r,0,r.length,n.getStride(),!1),u.stroke()}if(this.text_!==""){var s=n.getFlatMidpoint();this.drawText_(s,0,2,2)}}},h.prototype.drawMultiLineString=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getExtent();if(!!Lo(this.extent_,u)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var r=this.context_,s=n.getFlatCoordinates(),P=0,z=n.getEnds(),F=n.getStride();r.beginPath();for(var N=0,V=z.length;N<V;++N)P=this.moveToLineTo_(s,P,z[N],F,!1);r.stroke()}if(this.text_!==""){var me=n.getFlatMidpoints();this.drawText_(me,0,me.length,2)}}},h.prototype.drawPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lo(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_;u.beginPath(),this.drawRings_(n.getOrientedFlatCoordinates(),0,n.getEnds(),n.getStride()),this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var r=n.getFlatInteriorPoint();this.drawText_(r,0,2,2)}}},h.prototype.drawMultiPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Lo(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getOrientedFlatCoordinates(),s=0,P=n.getEndss(),z=n.getStride();u.beginPath();for(var F=0,N=P.length;F<N;++F){var V=P[F];s=this.drawRings_(r,s,V,z)}this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var me=n.getFlatInteriorPoints();this.drawText_(me,0,me.length,2)}}},h.prototype.setContextFillState_=function(n){var u=this.context_,r=this.contextFillState_;r?r.fillStyle!=n.fillStyle&&(r.fillStyle=n.fillStyle,u.fillStyle=n.fillStyle):(u.fillStyle=n.fillStyle,this.contextFillState_={fillStyle:n.fillStyle})},h.prototype.setContextStrokeState_=function(n){var u=this.context_,r=this.contextStrokeState_;r?(r.lineCap!=n.lineCap&&(r.lineCap=n.lineCap,u.lineCap=n.lineCap),u.setLineDash&&(_s(r.lineDash,n.lineDash)||u.setLineDash(r.lineDash=n.lineDash),r.lineDashOffset!=n.lineDashOffset&&(r.lineDashOffset=n.lineDashOffset,u.lineDashOffset=n.lineDashOffset)),r.lineJoin!=n.lineJoin&&(r.lineJoin=n.lineJoin,u.lineJoin=n.lineJoin),r.lineWidth!=n.lineWidth&&(r.lineWidth=n.lineWidth,u.lineWidth=n.lineWidth),r.miterLimit!=n.miterLimit&&(r.miterLimit=n.miterLimit,u.miterLimit=n.miterLimit),r.strokeStyle!=n.strokeStyle&&(r.strokeStyle=n.strokeStyle,u.strokeStyle=n.strokeStyle)):(u.lineCap=n.lineCap,u.setLineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.lineWidth=n.lineWidth,u.miterLimit=n.miterLimit,u.strokeStyle=n.strokeStyle,this.contextStrokeState_={lineCap:n.lineCap,lineDash:n.lineDash,lineDashOffset:n.lineDashOffset,lineJoin:n.lineJoin,lineWidth:n.lineWidth,miterLimit:n.miterLimit,strokeStyle:n.strokeStyle})},h.prototype.setContextTextState_=function(n){var u=this.context_,r=this.contextTextState_,s=n.textAlign?n.textAlign:mh;r?(r.font!=n.font&&(r.font=n.font,u.font=n.font),r.textAlign!=s&&(r.textAlign=s,u.textAlign=s),r.textBaseline!=n.textBaseline&&(r.textBaseline=n.textBaseline,u.textBaseline=n.textBaseline)):(u.font=n.font,u.textAlign=s,u.textBaseline=n.textBaseline,this.contextTextState_={font:n.font,textAlign:s,textBaseline:n.textBaseline})},h.prototype.setFillStrokeStyle=function(n,u){var r=this;if(!n)this.fillState_=null;else{var s=n.getColor();this.fillState_={fillStyle:Ts(s||Ss)}}if(!u)this.strokeState_=null;else{var P=u.getColor(),z=u.getLineCap(),F=u.getLineDash(),N=u.getLineDashOffset(),V=u.getLineJoin(),me=u.getWidth(),_e=u.getMiterLimit(),Se=F||cc;this.strokeState_={lineCap:z!==void 0?z:Qh,lineDash:this.pixelRatio_===1?Se:Se.map(function(Ue){return Ue*r.pixelRatio_}),lineDashOffset:(N||hc)*this.pixelRatio_,lineJoin:V!==void 0?V:Iu,lineWidth:(me!==void 0?me:mc)*this.pixelRatio_,miterLimit:_e!==void 0?_e:pc,strokeStyle:Ts(P||fc)}}},h.prototype.setImageStyle=function(n){var u;if(!n||!(u=n.getSize())){this.image_=null;return}var r=n.getAnchor(),s=n.getOrigin();this.image_=n.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*this.pixelRatio_,this.imageAnchorY_=r[1]*this.pixelRatio_,this.imageHeight_=u[1]*this.pixelRatio_,this.imageOpacity_=n.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=n.getRotateWithView(),this.imageRotation_=n.getRotation(),this.imageScale_=n.getScaleArray(),this.imageWidth_=u[0]*this.pixelRatio_},h.prototype.setTextStyle=function(n){if(!n)this.text_="";else{var u=n.getFill();if(!u)this.textFillState_=null;else{var r=u.getColor();this.textFillState_={fillStyle:Ts(r||Ss)}}var s=n.getStroke();if(!s)this.textStrokeState_=null;else{var P=s.getColor(),z=s.getLineCap(),F=s.getLineDash(),N=s.getLineDashOffset(),V=s.getLineJoin(),me=s.getWidth(),_e=s.getMiterLimit();this.textStrokeState_={lineCap:z!==void 0?z:Qh,lineDash:F||cc,lineDashOffset:N||hc,lineJoin:V!==void 0?V:Iu,lineWidth:me!==void 0?me:mc,miterLimit:_e!==void 0?_e:pc,strokeStyle:Ts(P||fc)}}var Se=n.getFont(),Ue=n.getOffsetX(),He=n.getOffsetY(),Ie=n.getRotateWithView(),Ge=n.getRotation(),et=n.getScaleArray(),rt=n.getText(),_t=n.getTextAlign(),yt=n.getTextBaseline();this.textState_={font:Se!==void 0?Se:ig,textAlign:_t!==void 0?_t:mh,textBaseline:yt!==void 0?yt:ep},this.text_=rt!==void 0?Array.isArray(rt)?rt.reduce(function(ct,Tt,St){return ct+=St%2?" ":Tt},""):rt:"",this.textOffsetX_=Ue!==void 0?this.pixelRatio_*Ue:0,this.textOffsetY_=He!==void 0?this.pixelRatio_*He:0,this.textRotateWithView_=Ie!==void 0?Ie:!1,this.textRotation_=Ge!==void 0?Ge:0,this.textScale_=[this.pixelRatio_*et[0],this.pixelRatio_*et[1]]}},h}(ng),l0=o2;var Pu={FRACTION:"fraction",PIXELS:"pixels"};var Hs={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var a2=function(){function y(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return y.prototype.clear=function(){this.cache_={},this.cacheSize_=0},y.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},y.prototype.expire=function(){if(this.canExpireCache()){var h=0;for(var n in this.cache_){var u=this.cache_[n];(h++&3)===0&&!u.hasListener()&&(delete this.cache_[n],--this.cacheSize_)}}},y.prototype.get=function(h,n,u){var r=u0(h,n,u);return r in this.cache_?this.cache_[r]:null},y.prototype.set=function(h,n,u,r){var s=u0(h,n,u);this.cache_[s]=r,++this.cacheSize_},y.prototype.setSize=function(h){this.maxCacheSize_=h,this.expire()},y}();function u0(y,h,n){var u=n?tg(n):"null";return h+":"+y+":"+u}var f_=new a2;var s2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),l2=function(y){s2(h,y);function h(n,u,r,s){var P=y.call(this)||this;return P.extent=n,P.pixelRatio_=r,P.resolution=u,P.state=s,P}return h.prototype.changed=function(){this.dispatchEvent(Ji.CHANGE)},h.prototype.getExtent=function(){return this.extent},h.prototype.getImage=function(){return jr()},h.prototype.getPixelRatio=function(){return this.pixelRatio_},h.prototype.getResolution=function(){return this.resolution},h.prototype.getState=function(){return this.state},h.prototype.load=function(){jr()},h}(nh),c0=l2;var u2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),dL=function(y){u2(h,y);function h(n,u,r,s,P,z){var F=y.call(this,n,u,r,qi.IDLE)||this;return F.src_=s,F.image_=new Image,P!==null&&(F.image_.crossOrigin=P),F.unlisten_=null,F.state=qi.IDLE,F.imageLoadFunction_=z,F}return h.prototype.getImage=function(){return this.image_},h.prototype.handleImageError_=function(){this.state=qi.ERROR,this.unlistenImage_(),this.changed()},h.prototype.handleImageLoad_=function(){this.resolution===void 0&&(this.resolution=Eu(this.extent)/this.image_.height),this.state=qi.LOADED,this.unlistenImage_(),this.changed()},h.prototype.load=function(){(this.state==qi.IDLE||this.state==qi.ERROR)&&(this.state=qi.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=d_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},h.prototype.setImage=function(n){this.image_=n,this.resolution=Eu(this.extent)/this.image_.height},h.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},h}(c0);function d_(y,h,n){var u=y,r=!0,s=!1,P=!1,z=[qp(u,Ji.LOAD,function(){P=!0,s||h()})];return u.src&&Av?(s=!0,u.decode().then(function(){r&&h()}).catch(function(F){r&&(P?h():n())})):z.push(qp(u,Ji.ERROR,n)),function(){r=!1,z.forEach(Po)}}var c2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),xd=null,h2=function(y){c2(h,y);function h(n,u,r,s,P,z){var F=y.call(this)||this;return F.hitDetectionImage_=null,F.image_=n||new Image,s!==null&&(F.image_.crossOrigin=s),F.canvas_={},F.color_=z,F.unlisten_=null,F.imageState_=P,F.size_=r,F.src_=u,F.tainted_,F}return h.prototype.isTainted_=function(){if(this.tainted_===void 0&&this.imageState_===qi.LOADED){xd||(xd=Ja(1,1)),xd.drawImage(this.image_,0,0);try{xd.getImageData(0,0,1,1),this.tainted_=!1}catch{xd=null,this.tainted_=!0}}return this.tainted_===!0},h.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(Ji.CHANGE)},h.prototype.handleImageError_=function(){this.imageState_=qi.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},h.prototype.handleImageLoad_=function(){this.imageState_=qi.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()},h.prototype.getImage=function(n){return this.replaceColor_(n),this.canvas_[n]?this.canvas_[n]:this.image_},h.prototype.getPixelRatio=function(n){return this.replaceColor_(n),this.canvas_[n]?n:1},h.prototype.getImageState=function(){return this.imageState_},h.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var n=this.size_[0],u=this.size_[1],r=Ja(n,u);r.fillRect(0,0,n,u),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},h.prototype.getSize=function(){return this.size_},h.prototype.getSrc=function(){return this.src_},h.prototype.load=function(){if(this.imageState_==qi.IDLE){this.imageState_=qi.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=d_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},h.prototype.replaceColor_=function(n){if(!(!this.color_||this.canvas_[n]||this.imageState_!==qi.LOADED)){var u=document.createElement("canvas");this.canvas_[n]=u,u.width=Math.ceil(this.image_.width*n),u.height=Math.ceil(this.image_.height*n);var r=u.getContext("2d");if(r.scale(n,n),r.drawImage(this.image_,0,0),r.globalCompositeOperation="multiply",r.globalCompositeOperation==="multiply"||this.isTainted_())r.fillStyle=tg(this.color_),r.fillRect(0,0,u.width/n,u.height/n),r.globalCompositeOperation="destination-in",r.drawImage(this.image_,0,0);else{for(var s=r.getImageData(0,0,u.width,u.height),P=s.data,z=this.color_[0]/255,F=this.color_[1]/255,N=this.color_[2]/255,V=this.color_[3],me=0,_e=P.length;me<_e;me+=4)P[me]*=z,P[me+1]*=F,P[me+2]*=N,P[me+3]*=V;r.putImageData(s,0,0)}}},h.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},h}(nh);function h0(y,h,n,u,r,s){var P=f_.get(h,u,s);return P||(P=new h2(y,h,n,u,r,s),f_.set(h,u,s,P)),P}var p2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),f2=function(y){p2(h,y);function h(n){var u=this,r=n||{},s=r.opacity!==void 0?r.opacity:1,P=r.rotation!==void 0?r.rotation:0,z=r.scale!==void 0?r.scale:1,F=r.rotateWithView!==void 0?r.rotateWithView:!1;u=y.call(this,{opacity:s,rotation:P,scale:z,displacement:r.displacement!==void 0?r.displacement:[0,0],rotateWithView:F})||this,u.anchor_=r.anchor!==void 0?r.anchor:[.5,.5],u.normalizedAnchor_=null,u.anchorOrigin_=r.anchorOrigin!==void 0?r.anchorOrigin:Hs.TOP_LEFT,u.anchorXUnits_=r.anchorXUnits!==void 0?r.anchorXUnits:Pu.FRACTION,u.anchorYUnits_=r.anchorYUnits!==void 0?r.anchorYUnits:Pu.FRACTION,u.crossOrigin_=r.crossOrigin!==void 0?r.crossOrigin:null;var N=r.img!==void 0?r.img:null;u.imgSize_=r.imgSize;var V=r.src;En(!(V!==void 0&&N),4),En(!N||N&&u.imgSize_,5),(V===void 0||V.length===0)&&N&&(V=N.src||Ai(N)),En(V!==void 0&&V.length>0,6);var me=r.src!==void 0?qi.IDLE:qi.LOADED;return u.color_=r.color!==void 0?Jh(r.color):null,u.iconImage_=h0(N,V,u.imgSize_!==void 0?u.imgSize_:null,u.crossOrigin_,me,u.color_),u.offset_=r.offset!==void 0?r.offset:[0,0],u.offsetOrigin_=r.offsetOrigin!==void 0?r.offsetOrigin:Hs.TOP_LEFT,u.origin_=null,u.size_=r.size!==void 0?r.size:null,u}return h.prototype.clone=function(){var n=this.getScale();return 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_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:Array.isArray(n)?n.slice():n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc()})},h.prototype.getAnchor=function(){var n=this.normalizedAnchor_;if(!n){n=this.anchor_;var u=this.getSize();if(this.anchorXUnits_==Pu.FRACTION||this.anchorYUnits_==Pu.FRACTION){if(!u)return null;n=this.anchor_.slice(),this.anchorXUnits_==Pu.FRACTION&&(n[0]*=u[0]),this.anchorYUnits_==Pu.FRACTION&&(n[1]*=u[1])}if(this.anchorOrigin_!=Hs.TOP_LEFT){if(!u)return null;n===this.anchor_&&(n=this.anchor_.slice()),(this.anchorOrigin_==Hs.TOP_RIGHT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(n[0]=-n[0]+u[0]),(this.anchorOrigin_==Hs.BOTTOM_LEFT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(n[1]=-n[1]+u[1])}this.normalizedAnchor_=n}var r=this.getDisplacement();return[n[0]-r[0],n[1]+r[1]]},h.prototype.setAnchor=function(n){this.anchor_=n,this.normalizedAnchor_=null},h.prototype.getColor=function(){return this.color_},h.prototype.getImage=function(n){return this.iconImage_.getImage(n)},h.prototype.getPixelRatio=function(n){return this.iconImage_.getPixelRatio(n)},h.prototype.getImageSize=function(){return this.iconImage_.getSize()},h.prototype.getImageState=function(){return this.iconImage_.getImageState()},h.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},h.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var n=this.offset_;if(this.offsetOrigin_!=Hs.TOP_LEFT){var u=this.getSize(),r=this.iconImage_.getSize();if(!u||!r)return null;n=n.slice(),(this.offsetOrigin_==Hs.TOP_RIGHT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(n[0]=r[0]-u[0]-n[0]),(this.offsetOrigin_==Hs.BOTTOM_LEFT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(n[1]=r[1]-u[1]-n[1])}return this.origin_=n,this.origin_},h.prototype.getSrc=function(){return this.iconImage_.getSrc()},h.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},h.prototype.listenImageChange=function(n){this.iconImage_.addEventListener(Ji.CHANGE,n)},h.prototype.load=function(){this.iconImage_.load()},h.prototype.unlistenImageChange=function(n){this.iconImage_.removeEventListener(Ji.CHANGE,n)},h}(eg),m_=f2;var $l=.5;function p0(y,h,n,u,r,s,P){var z=y[0]*$l,F=y[1]*$l,N=Ja(z,F);N.imageSmoothingEnabled=!1;for(var V=N.canvas,me=new l0(N,$l,r,null,P),_e=n.length,Se=Math.floor((256*256*256-1)/_e),Ue={},He=1;He<=_e;++He){var Ie=n[He-1],Ge=Ie.getStyleFunction()||u;if(!!u){var et=Ge(Ie,s);if(!!et){Array.isArray(et)||(et=[et]);for(var rt=He*Se,_t="#"+("000000"+rt.toString(16)).slice(-6),yt=0,ct=et.length;yt<ct;++yt){var Tt=et[yt],St=Tt.getGeometryFunction()(Ie);if(!(!St||!Lo(r,St.getExtent()))){var Lt=Tt.clone(),nr=Lt.getFill();nr&&nr.setColor(_t);var jt=Lt.getStroke();jt&&(jt.setColor(_t),jt.setLineDash(null)),Lt.setText(void 0);var Jt=Tt.getImage();if(Jt&&Jt.getOpacity()!==0){var or=Jt.getImageSize();if(!or)continue;var At=Ja(or[0],or[1],void 0,{alpha:!1}),Vr=At.canvas;At.fillStyle=_t,At.fillRect(0,0,Vr.width,Vr.height),Lt.setImage(new m_({img:Vr,imgSize:or,anchor:Jt.getAnchor(),anchorXUnits:Pu.PIXELS,anchorYUnits:Pu.PIXELS,offset:Jt.getOrigin(),opacity:1,size:Jt.getSize(),scale:Jt.getScale(),rotation:Jt.getRotation(),rotateWithView:Jt.getRotateWithView()}))}var Er=Lt.getZIndex()||0,zr=Ue[Er];zr||(zr={},Ue[Er]=zr,zr[Mt.POLYGON]=[],zr[Mt.CIRCLE]=[],zr[Mt.LINE_STRING]=[],zr[Mt.POINT]=[]),zr[St.getType().replace("Multi","")].push(St,Lt)}}}}}for(var br=Object.keys(Ue).map(Number).sort(rh),He=0,Sr=br.length;He<Sr;++He){var zr=Ue[br[He]];for(var xr in zr)for(var Qr=zr[xr],yt=0,ct=Qr.length;yt<ct;yt+=2){me.setStyle(Qr[yt+1]);for(var Vt=0,Yr=h.length;Vt<Yr;++Vt)me.setTransform(h[Vt]),me.drawGeometry(Qr[yt])}}return N.getImageData(0,0,V.width,V.height)}function f0(y,h,n){var u=[];if(n){var r=Math.floor(Math.round(y[0])*$l),s=Math.floor(Math.round(y[1])*$l),P=(jl(r,0,n.width-1)+jl(s,0,n.height-1)*n.width)*4,z=n.data[P],F=n.data[P+1],N=n.data[P+2],V=N+256*(F+256*z),me=Math.floor((256*256*256-1)/h.length);V&&V%me===0&&u.push(h[V/me-1])}return u}var d2=.5,d0={Point:b2,LineString:_2,Polygon:E2,MultiPoint:w2,MultiLineString:v2,MultiPolygon:x2,GeometryCollection:y2,Circle:m2};function m0(y,h){return parseInt(Ai(y),10)-parseInt(Ai(h),10)}function g0(y,h){var n=og(y,h);return n*n}function og(y,h){return d2*y/h}function m2(y,h,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),On.CIRCLE);z.setFillStrokeStyle(s,P),z.drawCircle(h,u)}var F=n.getText();if(F&&F.getText()){var N=(r||y).getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(F),N.drawText(h,u)}}function g_(y,h,n,u,r,s,P){var z=!1,F=n.getImage();if(F){var N=F.getImageState();N==qi.LOADED||N==qi.ERROR?F.unlistenImageChange(r):(N==qi.IDLE&&F.load(),N=F.getImageState(),F.listenImageChange(r),z=!0)}return g2(y,h,n,u,s,P),z}function g2(y,h,n,u,r,s){var P=n.getGeometryFunction()(h);if(!!P){var z=P.simplifyTransformed(u,r),F=n.getRenderer();if(F)y0(y,z,n,h);else{var N=d0[z.getType()];N(y,z,n,h,s)}}}function y0(y,h,n,u){if(h.getType()==Mt.GEOMETRY_COLLECTION){for(var r=h.getGeometries(),s=0,P=r.length;s<P;++s)y0(y,r[s],n,u);return}var z=y.getBuilder(n.getZIndex(),On.DEFAULT);z.drawCustom(h,u,n.getRenderer(),n.getHitDetectionRenderer())}function y2(y,h,n,u,r){var s=h.getGeometriesArray(),P,z;for(P=0,z=s.length;P<z;++P){var F=d0[s[P].getType()];F(y,s[P],n,u,r)}}function _2(y,h,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),On.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawLineString(h,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),On.TEXT);F.setTextStyle(z),F.drawText(h,u)}}function v2(y,h,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),On.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawMultiLineString(h,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),On.TEXT);F.setTextStyle(z),F.drawText(h,u)}}function x2(y,h,n,u,r){var s=n.getFill(),P=n.getStroke();if(P||s){var z=y.getBuilder(n.getZIndex(),On.POLYGON);z.setFillStrokeStyle(s,P),z.drawMultiPolygon(h,u)}var F=n.getText();if(F&&F.getText()){var N=(r||y).getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(F),N.drawText(h,u)}}function b2(y,h,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(y=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=qi.LOADED)return;var F=y.getBuilder(n.getZIndex(),On.IMAGE);F.setImageStyle(s,z),F.drawPoint(h,u)}if(P&&P.getText()){var N=y.getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(P,z),N.drawText(h,u)}}function w2(y,h,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(y=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=qi.LOADED)return;var F=y.getBuilder(n.getZIndex(),On.IMAGE);F.setImageStyle(s,z),F.drawMultiPoint(h,u)}if(P&&P.getText()){var N=(r||y).getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(P,z),N.drawText(h,u)}}function E2(y,h,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),On.POLYGON);z.setFillStrokeStyle(s,P),z.drawPolygon(h,u)}var F=n.getText();if(F&&F.getText()){var N=(r||y).getBuilder(n.getZIndex(),On.TEXT);N.setTextStyle(F),N.drawText(h,u)}}var T2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),S2=function(y){T2(h,y);function h(n){var u=y.call(this,n)||this;return u.boundHandleStyleImageChange_=u.handleStyleImageChange_.bind(u),u.animatingOrInteracting_,u.dirty_=!1,u.hitDetectionImageData_=null,u.renderedFeatures_=null,u.renderedRevision_=-1,u.renderedResolution_=NaN,u.renderedExtent_=Ya(),u.wrappedRenderedExtent_=Ya(),u.renderedRotation_,u.renderedCenter_=null,u.renderedProjection_=null,u.renderedRenderOrder_=null,u.replayGroup_=null,u.replayGroupChanged=!0,u.declutterExecutorGroup=null,u.clipping=!0,u}return h.prototype.renderWorlds=function(n,u,r){var s=u.extent,P=u.viewState,z=P.center,F=P.resolution,N=P.projection,V=P.rotation,me=N.getExtent(),_e=this.getLayer().getSource(),Se=u.pixelRatio,Ue=u.viewHints,He=!(Ue[vd.ANIMATING]||Ue[vd.INTERACTING]),Ie=this.context,Ge=Math.round(u.size[0]*Se),et=Math.round(u.size[1]*Se),rt=_e.getWrapX()&&N.canWrapX(),_t=rt?bs(me):null,yt=rt?Math.ceil((s[2]-me[2])/_t)+1:1,ct=rt?Math.floor((s[0]-me[0])/_t):0;do{var Tt=this.getRenderTransform(z,F,V,Se,Ge,et,ct*_t);n.execute(Ie,1,Tt,V,He,void 0,r)}while(++ct<yt)},h.prototype.renderDeclutter=function(n){this.declutterExecutorGroup&&this.renderWorlds(this.declutterExecutorGroup,n,n.declutterTree)},h.prototype.renderFrame=function(n,u){var r=n.pixelRatio,s=n.layerStatesArray[n.layerIndex];kv(this.pixelTransform,1/r,1/r),Rv(this.inversePixelTransform,this.pixelTransform);var P=py(this.pixelTransform);this.useContainer(u,P,s.opacity,this.getBackground(n));var z=this.context,F=z.canvas,N=this.replayGroup_,V=this.declutterExecutorGroup;if((!N||N.isEmpty())&&(!V||V.isEmpty()))return null;var me=Math.round(n.size[0]*r),_e=Math.round(n.size[1]*r);F.width!=me||F.height!=_e?(F.width=me,F.height=_e,F.style.transform!==P&&(F.style.transform=P)):this.containerReused||z.clearRect(0,0,me,_e),this.preRender(z,n);var Se=n.viewState,Ue=Se.projection,He=!1,Ie=!0;if(s.extent&&this.clipping){var Ge=rd(s.extent,Ue);Ie=Lo(Ge,n.extent),He=Ie&&!sc(Ge,n.extent),He&&this.clipUnrotated(z,n,Ge)}Ie&&this.renderWorlds(N,n),He&&z.restore(),this.postRender(z,n);var et=Fx(s.opacity),rt=this.container;return et!==rt.style.opacity&&(rt.style.opacity=et),this.renderedRotation_!==Se.rotation&&(this.renderedRotation_=Se.rotation,this.hitDetectionImageData_=null),this.container},h.prototype.getFeatures=function(n){return new Promise(function(u){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var r=[this.context.canvas.width,this.context.canvas.height];bo(this.pixelTransform,r);var s=this.renderedCenter_,P=this.renderedResolution_,z=this.renderedRotation_,F=this.renderedProjection_,N=this.wrappedRenderedExtent_,V=this.getLayer(),me=[],_e=r[0]*$l,Se=r[1]*$l;me.push(this.getRenderTransform(s,P,z,$l,_e,Se,0).slice());var Ue=V.getSource(),He=F.getExtent();if(Ue.getWrapX()&&F.canWrapX()&&!sc(He,N)){for(var Ie=N[0],Ge=bs(He),et=0,rt=void 0;Ie<He[0];)--et,rt=Ge*et,me.push(this.getRenderTransform(s,P,z,$l,_e,Se,rt).slice()),Ie+=Ge;for(et=0,Ie=N[2];Ie>He[2];)++et,rt=Ge*et,me.push(this.getRenderTransform(s,P,z,$l,_e,Se,rt).slice()),Ie-=Ge}this.hitDetectionImageData_=p0(r,me,this.renderedFeatures_,V.getStyleFunction(),N,P,z)}u(f0(n,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},h.prototype.forEachFeatureAtCoordinate=function(n,u,r,s,P){var z=this;if(!!this.replayGroup_){var F=u.viewState.resolution,N=u.viewState.rotation,V=this.getLayer(),me={},_e=function(He,Ie,Ge){var et=Ai(He),rt=me[et];if(rt){if(rt!==!0&&Ge<rt.distanceSq){if(Ge===0)return me[et]=!0,P.splice(P.lastIndexOf(rt),1),s(He,V,Ie);rt.geometry=Ie,rt.distanceSq=Ge}}else{if(Ge===0)return me[et]=!0,s(He,V,Ie);P.push(me[et]={feature:He,layer:V,geometry:Ie,distanceSq:Ge,callback:s})}},Se,Ue=[this.replayGroup_];return this.declutterExecutorGroup&&Ue.push(this.declutterExecutorGroup),Ue.some(function(He){return Se=He.forEachFeatureAtCoordinate(n,F,N,r,_e,He===z.declutterExecutorGroup&&u.declutterTree?u.declutterTree.all().map(function(Ie){return Ie.value}):null)}),Se}},h.prototype.handleFontsChanged=function(){var n=this.getLayer();n.getVisible()&&this.replayGroup_&&n.changed()},h.prototype.handleStyleImageChange_=function(n){this.renderIfReadyAndVisible()},h.prototype.prepareFrame=function(n){var u=this.getLayer(),r=u.getSource();if(!r)return!1;var s=n.viewHints[vd.ANIMATING],P=n.viewHints[vd.INTERACTING],z=u.getUpdateWhileAnimating(),F=u.getUpdateWhileInteracting();if(!this.dirty_&&!z&&s||!F&&P)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var N=n.extent,V=n.viewState,me=V.projection,_e=V.resolution,Se=n.pixelRatio,Ue=u.getRevision(),He=u.getRenderBuffer(),Ie=u.getRenderOrder();Ie===void 0&&(Ie=m0);var Ge=V.center.slice(),et=yl(N,He*_e),rt=et.slice(),_t=[et.slice()],yt=me.getExtent();if(r.getWrapX()&&me.canWrapX()&&!sc(yt,n.extent)){var ct=bs(yt),Tt=Math.max(bs(et)/2,ct);et[0]=yt[0]-Tt,et[2]=yt[2]+Tt,Qv(Ge,me);var St=Yv(_t[0],me);St[0]<yt[0]&&St[2]<yt[2]?_t.push([St[0]+ct,St[1],St[2]+ct,St[3]]):St[0]>yt[0]&&St[2]>yt[2]&&_t.push([St[0]-ct,St[1],St[2]-ct,St[3]])}if(!this.dirty_&&this.renderedResolution_==_e&&this.renderedRevision_==Ue&&this.renderedRenderOrder_==Ie&&sc(this.wrappedRenderedExtent_,et))return _s(this.renderedExtent_,rt)||(this.hitDetectionImageData_=null,this.renderedExtent_=rt),this.renderedCenter_=Ge,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var Lt=new u_(og(_e,Se),et,_e,Se),nr;this.getLayer().getDeclutter()&&(nr=new u_(og(_e,Se),et,_e,Se));var jt=uh(),Jt;if(jt){for(var or=0,At=_t.length;or<At;++or){var Vr=_t[or],Er=Qp(Vr,me);r.loadFeatures(Er,ix(_e,me),jt)}Jt=Vm(jt,me)}else for(var or=0,At=_t.length;or<At;++or)r.loadFeatures(_t[or],_e,me);var zr=g0(_e,Se),br=function(Yr){var vi,di=Yr.getStyleFunction()||u.getStyleFunction();if(di&&(vi=di(Yr,_e)),vi){var en=this.renderFeature(Yr,zr,vi,Lt,Jt,nr);this.dirty_=this.dirty_||en}}.bind(this),Sr=Qp(et,me),xr=r.getFeaturesInExtent(Sr);Ie&&xr.sort(Ie);for(var or=0,At=xr.length;or<At;++or)br(xr[or]);this.renderedFeatures_=xr;var Qr=Lt.finish(),Vt=new p_(et,_e,Se,r.getOverlaps(),Qr,u.getRenderBuffer());return nr&&(this.declutterExecutorGroup=new p_(et,_e,Se,r.getOverlaps(),nr.finish(),u.getRenderBuffer())),this.renderedResolution_=_e,this.renderedRevision_=Ue,this.renderedRenderOrder_=Ie,this.renderedExtent_=rt,this.wrappedRenderedExtent_=et,this.renderedCenter_=Ge,this.renderedProjection_=me,this.replayGroup_=Vt,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0},h.prototype.renderFeature=function(n,u,r,s,P,z){if(!r)return!1;var F=!1;if(Array.isArray(r))for(var N=0,V=r.length;N<V;++N)F=g_(s,n,r[N],u,this.boundHandleStyleImageChange_,P,z)||F;else F=g_(s,n,r,u,this.boundHandleStyleImageChange_,P,z);return F},h}(i0),_0=S2;var I2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),C2=function(y){I2(h,y);function h(n){return y.call(this,n)||this}return h.prototype.createRenderer=function(){return new _0(this)},h}(Hx),tp=C2;var v0=Gp(a_(),1);var A2=function(){function y(h){this.rbush_=new v0.default(h),this.items_={}}return y.prototype.insert=function(h,n){var u={minX:h[0],minY:h[1],maxX:h[2],maxY:h[3],value:n};this.rbush_.insert(u),this.items_[Ai(n)]=u},y.prototype.load=function(h,n){for(var u=new Array(n.length),r=0,s=n.length;r<s;r++){var P=h[r],z=n[r],F={minX:P[0],minY:P[1],maxX:P[2],maxY:P[3],value:z};u[r]=F,this.items_[Ai(z)]=F}this.rbush_.load(u)},y.prototype.remove=function(h){var n=Ai(h),u=this.items_[n];return delete this.items_[n],this.rbush_.remove(u)!==null},y.prototype.update=function(h,n){var u=this.items_[Ai(n)],r=[u.minX,u.minY,u.maxX,u.maxY];Nm(r,h)||(this.remove(n),this.insert(h,n))},y.prototype.getAll=function(){var h=this.rbush_.all();return h.map(function(n){return n.value})},y.prototype.getInExtent=function(h){var n={minX:h[0],minY:h[1],maxX:h[2],maxY:h[3]},u=this.rbush_.search(n);return u.map(function(r){return r.value})},y.prototype.forEach=function(h){return this.forEach_(this.getAll(),h)},y.prototype.forEachInExtent=function(h,n){return this.forEach_(this.getInExtent(h),n)},y.prototype.forEach_=function(h,n){for(var u,r=0,s=h.length;r<s;r++)if(u=n(h[r]),u)return u;return u},y.prototype.isEmpty=function(){return Vl(this.items_)},y.prototype.clear=function(){this.rbush_.clear(),this.items_={}},y.prototype.getExtent=function(h){var n=this.rbush_.toJSON();return sh(n.minX,n.minY,n.maxX,n.maxY,h)},y.prototype.concat=function(h){this.rbush_.load(h.rbush_.all());for(var n in h.items_)this.items_[n]=h.items_[n]},y}(),bd=A2;var P2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),M2=function(y){P2(h,y);function h(n){var u=y.call(this)||this;u.projection=ya(n.projection),u.attributions_=x0(n.attributions),u.attributionsCollapsible_=n.attributionsCollapsible!==void 0?n.attributionsCollapsible:!0,u.loading=!1,u.state_=n.state!==void 0?n.state:Su.READY,u.wrapX_=n.wrapX!==void 0?n.wrapX:!1,u.interpolate_=!!n.interpolate,u.viewResolver=null,u.viewRejector=null;var r=u;return u.viewPromise_=new Promise(function(s,P){r.viewResolver=s,r.viewRejector=P}),u}return h.prototype.getAttributions=function(){return this.attributions_},h.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},h.prototype.getProjection=function(){return this.projection},h.prototype.getResolutions=function(){return jr()},h.prototype.getView=function(){return this.viewPromise_},h.prototype.getState=function(){return this.state_},h.prototype.getWrapX=function(){return this.wrapX_},h.prototype.getInterpolate=function(){return this.interpolate_},h.prototype.refresh=function(){this.changed()},h.prototype.setAttributions=function(n){this.attributions_=x0(n),this.changed()},h.prototype.setState=function(n){this.state_=n,this.changed()},h}(Mo);function x0(y){return y?Array.isArray(y)?function(h){return y}:typeof y=="function"?y:function(h){return[y]}:null}var cf=M2;var Qa={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function b0(y,h){return[[-1/0,-1/0,1/0,1/0]]}var _h={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var k2=!1;function L2(y,h,n,u,r,s,P){var z=new XMLHttpRequest;z.open("GET",typeof y=="function"?y(n,u,r):y,!0),h.getType()==_h.ARRAY_BUFFER&&(z.responseType="arraybuffer"),z.withCredentials=k2,z.onload=function(F){if(!z.status||z.status>=200&&z.status<300){var N=h.getType(),V=void 0;N==_h.JSON||N==_h.TEXT?V=z.responseText:N==_h.XML?(V=z.responseXML,V||(V=new DOMParser().parseFromString(z.responseText,"application/xml"))):N==_h.ARRAY_BUFFER&&(V=z.response),V?s(h.readFeatures(V,{extent:n,featureProjection:r}),h.readProjection(V)):P()}else P()},z.onerror=P,z.send()}function y_(y,h){return function(n,u,r,s,P){var z=this;L2(y,h,n,u,r,function(F,N){z.addFeatures(F),s!==void 0&&s(F)},P||qh)}}var w0=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),vh=function(y){w0(h,y);function h(n,u,r){var s=y.call(this,n)||this;return s.feature=u,s.features=r,s}return h}(sn);var R2=function(y){w0(h,y);function h(n){var u=this,r=n||{};u=y.call(this,{attributions:r.attributions,interpolate:!0,projection:void 0,state:Su.READY,wrapX:r.wrapX!==void 0?r.wrapX:!0})||this,u.on,u.once,u.un,u.loader_=qh,u.format_=r.format,u.overlaps_=r.overlaps===void 0?!0:r.overlaps,u.url_=r.url,r.loader!==void 0?u.loader_=r.loader:u.url_!==void 0&&(En(u.format_,7),u.loader_=y_(u.url_,u.format_)),u.strategy_=r.strategy!==void 0?r.strategy:b0;var s=r.useSpatialIndex!==void 0?r.useSpatialIndex:!0;u.featuresRtree_=s?new bd:null,u.loadedExtentsRtree_=new bd,u.loadingExtentsCount_=0,u.nullGeometryFeatures_={},u.idIndex_={},u.uidIndex_={},u.featureChangeKeys_={},u.featuresCollection_=null;var P,z;return Array.isArray(r.features)?z=r.features:r.features&&(P=r.features,z=P.getArray()),!s&&P===void 0&&(P=new ch(z)),z!==void 0&&u.addFeaturesInternal(z),P!==void 0&&u.bindFeaturesCollection_(P),u}return h.prototype.addFeature=function(n){this.addFeatureInternal(n),this.changed()},h.prototype.addFeatureInternal=function(n){var u=Ai(n);if(!this.addToIndex_(u,n)){this.featuresCollection_&&this.featuresCollection_.remove(n);return}this.setupChangeEvents_(u,n);var r=n.getGeometry();if(r){var s=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,n)}else this.nullGeometryFeatures_[u]=n;this.dispatchEvent(new vh(Qa.ADDFEATURE,n))},h.prototype.setupChangeEvents_=function(n,u){this.featureChangeKeys_[n]=[uo(u,Ji.CHANGE,this.handleFeatureChange_,this),uo(u,jp.PROPERTYCHANGE,this.handleFeatureChange_,this)]},h.prototype.addToIndex_=function(n,u){var r=!0,s=u.getId();return s!==void 0&&(s.toString()in this.idIndex_?r=!1:this.idIndex_[s.toString()]=u),r&&(En(!(n in this.uidIndex_),30),this.uidIndex_[n]=u),r},h.prototype.addFeatures=function(n){this.addFeaturesInternal(n),this.changed()},h.prototype.addFeaturesInternal=function(n){for(var u=[],r=[],s=[],P=0,z=n.length;P<z;P++){var F=n[P],N=Ai(F);this.addToIndex_(N,F)&&r.push(F)}for(var P=0,V=r.length;P<V;P++){var F=r[P],N=Ai(F);this.setupChangeEvents_(N,F);var me=F.getGeometry();if(me){var _e=me.getExtent();u.push(_e),s.push(F)}else this.nullGeometryFeatures_[N]=F}if(this.featuresRtree_&&this.featuresRtree_.load(u,s),this.hasListener(Qa.ADDFEATURE))for(var P=0,Se=r.length;P<Se;P++)this.dispatchEvent(new vh(Qa.ADDFEATURE,r[P]))},h.prototype.bindFeaturesCollection_=function(n){var u=!1;this.addEventListener(Qa.ADDFEATURE,function(r){u||(u=!0,n.push(r.feature),u=!1)}),this.addEventListener(Qa.REMOVEFEATURE,function(r){u||(u=!0,n.remove(r.feature),u=!1)}),n.addEventListener(ws.ADD,function(r){u||(u=!0,this.addFeature(r.element),u=!1)}.bind(this)),n.addEventListener(ws.REMOVE,function(r){u||(u=!0,this.removeFeature(r.element),u=!1)}.bind(this)),this.featuresCollection_=n},h.prototype.clear=function(n){if(n){for(var u in this.featureChangeKeys_){var r=this.featureChangeKeys_[u];r.forEach(Po)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){var s=function(F){this.removeFeatureInternal(F)}.bind(this);this.featuresRtree_.forEach(s);for(var P in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[P])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};var z=new vh(Qa.CLEAR);this.dispatchEvent(z),this.changed()},h.prototype.forEachFeature=function(n){if(this.featuresRtree_)return this.featuresRtree_.forEach(n);this.featuresCollection_&&this.featuresCollection_.forEach(n)},h.prototype.forEachFeatureAtCoordinateDirect=function(n,u){var r=[n[0],n[1],n[0],n[1]];return this.forEachFeatureInExtent(r,function(s){var P=s.getGeometry();if(P.intersectsCoordinate(n))return u(s)})},h.prototype.forEachFeatureInExtent=function(n,u){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(n,u);this.featuresCollection_&&this.featuresCollection_.forEach(u)},h.prototype.forEachFeatureIntersectingExtent=function(n,u){return this.forEachFeatureInExtent(n,function(r){var s=r.getGeometry();if(s.intersectsExtent(n)){var P=u(r);if(P)return P}})},h.prototype.getFeaturesCollection=function(){return this.featuresCollection_},h.prototype.getFeatures=function(){var n;return this.featuresCollection_?n=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(n=this.featuresRtree_.getAll(),Vl(this.nullGeometryFeatures_)||Ka(n,Am(this.nullGeometryFeatures_))),n},h.prototype.getFeaturesAtCoordinate=function(n){var u=[];return this.forEachFeatureAtCoordinateDirect(n,function(r){u.push(r)}),u},h.prototype.getFeaturesInExtent=function(n){return this.featuresRtree_?this.featuresRtree_.getInExtent(n):this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]},h.prototype.getClosestFeatureToCoordinate=function(n,u){var r=n[0],s=n[1],P=null,z=[NaN,NaN],F=1/0,N=[-1/0,-1/0,1/0,1/0],V=u||Cm;return this.featuresRtree_.forEachInExtent(N,function(me){if(V(me)){var _e=me.getGeometry(),Se=F;if(F=_e.closestPointXY(r,s,z,F),F<Se){P=me;var Ue=Math.sqrt(F);N[0]=r-Ue,N[1]=s-Ue,N[2]=r+Ue,N[3]=s+Ue}}}),P},h.prototype.getExtent=function(n){return this.featuresRtree_.getExtent(n)},h.prototype.getFeatureById=function(n){var u=this.idIndex_[n.toString()];return u!==void 0?u:null},h.prototype.getFeatureByUid=function(n){var u=this.uidIndex_[n];return u!==void 0?u:null},h.prototype.getFormat=function(){return this.format_},h.prototype.getOverlaps=function(){return this.overlaps_},h.prototype.getUrl=function(){return this.url_},h.prototype.handleFeatureChange_=function(n){var u=n.target,r=Ai(u),s=u.getGeometry();if(!s)r in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(u),this.nullGeometryFeatures_[r]=u);else{var P=s.getExtent();r in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[r],this.featuresRtree_&&this.featuresRtree_.insert(P,u)):this.featuresRtree_&&this.featuresRtree_.update(P,u)}var z=u.getId();if(z!==void 0){var F=z.toString();this.idIndex_[F]!==u&&(this.removeFromIdIndex_(u),this.idIndex_[F]=u)}else this.removeFromIdIndex_(u),this.uidIndex_[r]=u;this.changed(),this.dispatchEvent(new vh(Qa.CHANGEFEATURE,u))},h.prototype.hasFeature=function(n){var u=n.getId();return u!==void 0?u in this.idIndex_:Ai(n)in this.uidIndex_},h.prototype.isEmpty=function(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Vl(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0},h.prototype.loadFeatures=function(n,u,r){for(var s=this.loadedExtentsRtree_,P=this.strategy_(n,u,r),z=function(me,_e){var Se=P[me],Ue=s.forEachInExtent(Se,function(He){return sc(He.extent,Se)});Ue||(++F.loadingExtentsCount_,F.dispatchEvent(new vh(Qa.FEATURESLOADSTART)),F.loader_.call(F,Se,u,r,function(He){--this.loadingExtentsCount_,this.dispatchEvent(new vh(Qa.FEATURESLOADEND,void 0,He))}.bind(F),function(){--this.loadingExtentsCount_,this.dispatchEvent(new vh(Qa.FEATURESLOADERROR))}.bind(F)),s.insert(Se,{extent:Se.slice()}))},F=this,N=0,V=P.length;N<V;++N)z(N,V);this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0},h.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),y.prototype.refresh.call(this)},h.prototype.removeLoadedExtent=function(n){var u=this.loadedExtentsRtree_,r;u.forEachInExtent(n,function(s){if(Nm(s.extent,n))return r=s,!0}),r&&u.remove(r)},h.prototype.removeFeature=function(n){if(!!n){var u=Ai(n);u in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[u]:this.featuresRtree_&&this.featuresRtree_.remove(n);var r=this.removeFeatureInternal(n);r&&this.changed()}},h.prototype.removeFeatureInternal=function(n){var u=Ai(n),r=this.featureChangeKeys_[u];if(!!r){r.forEach(Po),delete this.featureChangeKeys_[u];var s=n.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[u],this.dispatchEvent(new vh(Qa.REMOVEFEATURE,n)),n}},h.prototype.removeFromIdIndex_=function(n){var u=!1;for(var r in this.idIndex_)if(this.idIndex_[r]===n){delete this.idIndex_[r],u=!0;break}return u},h.prototype.setLoader=function(n){this.loader_=n},h.prototype.setUrl=function(n){En(this.format_,7),this.url_=n,this.setLoader(y_(n,this.format_))},h}(cf),rp=R2;var E0=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),hf=function(y){E0(h,y);function h(n,u){var r=y.call(this,n)||this;return r.layer=u,r}return h}(sn);var __={LAYERS:"layers"},z2=function(y){E0(h,y);function h(n){var u=this,r=n||{},s=Ra({},r);delete s.layers;var P=r.layers;return u=y.call(this,s)||this,u.on,u.once,u.un,u.layersListenerKeys_=[],u.listenerKeys_={},u.addChangeListener(__.LAYERS,u.handleLayersChanged_),P?Array.isArray(P)?P=new ch(P.slice(),{unique:!0}):En(typeof P.getArray=="function",43):P=new ch(void 0,{unique:!0}),u.setLayers(P),u}return h.prototype.handleLayerChange_=function(){this.changed()},h.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(Po),this.layersListenerKeys_.length=0;var n=this.getLayers();this.layersListenerKeys_.push(uo(n,ws.ADD,this.handleLayersAdd_,this),uo(n,ws.REMOVE,this.handleLayersRemove_,this));for(var u in this.listenerKeys_)this.listenerKeys_[u].forEach(Po);ih(this.listenerKeys_);for(var r=n.getArray(),s=0,P=r.length;s<P;s++){var z=r[s];this.registerLayerListeners_(z),this.dispatchEvent(new hf("addlayer",z))}this.changed()},h.prototype.registerLayerListeners_=function(n){var u=[uo(n,jp.PROPERTYCHANGE,this.handleLayerChange_,this),uo(n,Ji.CHANGE,this.handleLayerChange_,this)];n instanceof h&&u.push(uo(n,"addlayer",this.handleLayerGroupAdd_,this),uo(n,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[Ai(n)]=u},h.prototype.handleLayerGroupAdd_=function(n){this.dispatchEvent(new hf("addlayer",n.layer))},h.prototype.handleLayerGroupRemove_=function(n){this.dispatchEvent(new hf("removelayer",n.layer))},h.prototype.handleLayersAdd_=function(n){var u=n.element;this.registerLayerListeners_(u),this.dispatchEvent(new hf("addlayer",u)),this.changed()},h.prototype.handleLayersRemove_=function(n){var u=n.element,r=Ai(u);this.listenerKeys_[r].forEach(Po),delete this.listenerKeys_[r],this.dispatchEvent(new hf("removelayer",u)),this.changed()},h.prototype.getLayers=function(){return this.get(__.LAYERS)},h.prototype.setLayers=function(n){var u=this.getLayers();if(u)for(var r=u.getArray(),s=0,P=r.length;s<P;++s)this.dispatchEvent(new hf("removelayer",r[s]));this.set(__.LAYERS,n)},h.prototype.getLayersArray=function(n){var u=n!==void 0?n:[];return this.getLayers().forEach(function(r){r.getLayersArray(u)}),u},h.prototype.getLayerStatesArray=function(n){var u=n!==void 0?n:[],r=u.length;this.getLayers().forEach(function(V){V.getLayerStatesArray(u)});var s=this.getLayerState(),P=s.zIndex;!n&&s.zIndex===void 0&&(P=0);for(var z=r,F=u.length;z<F;z++){var N=u[z];N.opacity*=s.opacity,N.visible=N.visible&&s.visible,N.maxResolution=Math.min(N.maxResolution,s.maxResolution),N.minResolution=Math.max(N.minResolution,s.minResolution),N.minZoom=Math.max(N.minZoom,s.minZoom),N.maxZoom=Math.min(N.maxZoom,s.maxZoom),s.extent!==void 0&&(N.extent!==void 0?N.extent=Wv(N.extent,s.extent):N.extent=s.extent),N.zIndex===void 0&&(N.zIndex=P)}return u},h.prototype.getSourceState=function(){return Su.READY},h}(qm),v_=z2;var na={SINGLECLICK:"singleclick",CLICK:Ji.CLICK,DBLCLICK:Ji.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var x_={ACTIVE:"active"};var D2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),O2=function(y){D2(h,y);function h(n){var u=y.call(this)||this;return u.on,u.once,u.un,n&&n.handleEvent&&(u.handleEvent=n.handleEvent),u.map_=null,u.setActive(!0),u}return h.prototype.getActive=function(){return this.get(x_.ACTIVE)},h.prototype.getMap=function(){return this.map_},h.prototype.handleEvent=function(n){return!0},h.prototype.setActive=function(n){this.set(x_.ACTIVE,n)},h.prototype.setMap=function(n){this.map_=n},h}(Mo);var T0=O2;var F2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),B2=function(y){F2(h,y);function h(n){var u=this,r=n||{};return u=y.call(this,r)||this,r.handleDownEvent&&(u.handleDownEvent=r.handleDownEvent),r.handleDragEvent&&(u.handleDragEvent=r.handleDragEvent),r.handleMoveEvent&&(u.handleMoveEvent=r.handleMoveEvent),r.handleUpEvent&&(u.handleUpEvent=r.handleUpEvent),r.stopDown&&(u.stopDown=r.stopDown),u.handlingDownUpSequence=!1,u.trackedPointers_={},u.targetPointers=[],u}return h.prototype.getPointerCount=function(){return this.targetPointers.length},h.prototype.handleDownEvent=function(n){return!1},h.prototype.handleDragEvent=function(n){},h.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;var u=!1;if(this.updateTrackedPointers_(n),this.handlingDownUpSequence){if(n.type==na.POINTERDRAG)this.handleDragEvent(n),n.originalEvent.preventDefault();else if(n.type==na.POINTERUP){var r=this.handleUpEvent(n);this.handlingDownUpSequence=r&&this.targetPointers.length>0}}else if(n.type==na.POINTERDOWN){var s=this.handleDownEvent(n);this.handlingDownUpSequence=s,u=this.stopDown(s)}else n.type==na.POINTERMOVE&&this.handleMoveEvent(n);return!u},h.prototype.handleMoveEvent=function(n){},h.prototype.handleUpEvent=function(n){return!1},h.prototype.stopDown=function(n){return n},h.prototype.updateTrackedPointers_=function(n){if(U2(n)){var u=n.originalEvent,r=u.pointerId.toString();n.type==na.POINTERUP?delete this.trackedPointers_[r]:n.type==na.POINTERDOWN?this.trackedPointers_[r]=u:r in this.trackedPointers_&&(this.trackedPointers_[r]=u),this.targetPointers=Am(this.trackedPointers_)}},h}(T0);function U2(y){var h=y.type;return h===na.POINTERDOWN||h===na.POINTERDRAG||h===na.POINTERUP}var S0=B2;var I0=function(y){var h=y.originalEvent;return h.altKey&&!(h.metaKey||h.ctrlKey)&&!h.shiftKey};var C0=Cm,A0=function(y){return y.type==na.CLICK};var P0=function(y){return y.type==na.SINGLECLICK};var M0=function(y){var h=y.originalEvent;return En(h!==void 0,56),h.isPrimary&&h.button===0};var N2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),V2=function(y){N2(h,y);function h(n,u,r){var s=y.call(this)||this;if(s.ends_=[],s.maxDelta_=-1,s.maxDeltaRevision_=-1,Array.isArray(n[0]))s.setCoordinates(n,u);else if(u!==void 0&&r)s.setFlatCoordinates(u,n),s.ends_=r;else{for(var P=s.getLayout(),z=n,F=[],N=[],V=0,me=z.length;V<me;++V){var _e=z[V];V===0&&(P=_e.getLayout()),Ka(F,_e.getFlatCoordinates()),N.push(F.length)}s.setFlatCoordinates(P,F),s.ends_=N}return s}return h.prototype.appendLineString=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n.getFlatCoordinates().slice()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},h.prototype.clone=function(){var n=new h(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return n.applyProperties(this),n},h.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ad(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ld(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,n,u,r,s))},h.prototype.getCoordinateAtM=function(n,u,r){if(this.layout!=Pn.XYM&&this.layout!=Pn.XYZM||this.flatCoordinates.length===0)return null;var s=u!==void 0?u:!1,P=r!==void 0?r:!1;return zx(this.flatCoordinates,0,this.ends_,this.stride,n,s,P)},h.prototype.getCoordinates=function(){return ph(this.flatCoordinates,0,this.ends_,this.stride)},h.prototype.getEnds=function(){return this.ends_},h.prototype.getLineString=function(n){return n<0||this.ends_.length<=n?null:new uc(this.flatCoordinates.slice(n===0?0:this.ends_[n-1],this.ends_[n]),this.layout)},h.prototype.getLineStrings=function(){for(var n=this.flatCoordinates,u=this.ends_,r=this.layout,s=[],P=0,z=0,F=u.length;z<F;++z){var N=u[z],V=new uc(n.slice(P,N),r);s.push(V),P=N}return s},h.prototype.getFlatMidpoints=function(){for(var n=[],u=this.flatCoordinates,r=0,s=this.ends_,P=this.stride,z=0,F=s.length;z<F;++z){var N=s[z],V=Jm(u,r,N,P,.5);Ka(n,V),r=N}return n},h.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=wx(this.flatCoordinates,0,this.ends_,this.stride,n,u,0,r),new h(u,Pn.XY,r)},h.prototype.getType=function(){return Mt.MULTI_LINE_STRING},h.prototype.intersectsExtent=function(n){return Ax(this.flatCoordinates,0,this.ends_,this.stride,n)},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=ud(this.flatCoordinates,0,n,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},h}(Es),k0=V2;var G2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),j2=function(y){G2(h,y);function h(n,u){var r=y.call(this)||this;return u&&!Array.isArray(n[0])?r.setFlatCoordinates(u,n):r.setCoordinates(n,u),r}return h.prototype.appendPoint=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n.getFlatCoordinates()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.changed()},h.prototype.clone=function(){var n=new h(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},h.prototype.closestPointXY=function(n,u,r,s){if(s<xs(this.getExtent(),n,u))return s;for(var P=this.flatCoordinates,z=this.stride,F=0,N=P.length;F<N;F+=z){var V=ql(n,u,P[F],P[F+1]);if(V<s){s=V;for(var me=0;me<z;++me)r[me]=P[F+me];r.length=z}}return s},h.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},h.prototype.getPoint=function(n){var u=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return n<0||u<=n?null:new _a(this.flatCoordinates.slice(n*this.stride,(n+1)*this.stride),this.layout)},h.prototype.getPoints=function(){for(var n=this.flatCoordinates,u=this.layout,r=this.stride,s=[],P=0,z=n.length;P<z;P+=r){var F=new _a(n.slice(P,P+r),u);s.push(F)}return s},h.prototype.getType=function(){return Mt.MULTI_POINT},h.prototype.intersectsExtent=function(n){for(var u=this.flatCoordinates,r=this.stride,s=0,P=u.length;s<P;s+=r){var z=u[s],F=u[s+1];if(Qf(n,z,F))return!0}return!1},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Yh(this.flatCoordinates,0,n,this.stride),this.changed()},h}(Es),ag=j2;function L0(y,h,n,u){for(var r=[],s=Ya(),P=0,z=n.length;P<z;++P){var F=n[P];s=Um(y,h,F[0],u),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),h=F[F.length-1]}return r}var q2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Z2=function(y){q2(h,y);function h(n,u,r){var s=y.call(this)||this;if(s.endss_=[],s.flatInteriorPointsRevision_=-1,s.flatInteriorPoints_=null,s.maxDelta_=-1,s.maxDeltaRevision_=-1,s.orientedRevision_=-1,s.orientedFlatCoordinates_=null,!r&&!Array.isArray(n[0])){for(var P=s.getLayout(),z=n,F=[],N=[],V=0,me=z.length;V<me;++V){var _e=z[V];V===0&&(P=_e.getLayout());for(var Se=F.length,Ue=_e.getEnds(),He=0,Ie=Ue.length;He<Ie;++He)Ue[He]+=Se;Ka(F,_e.getFlatCoordinates()),N.push(Ue)}u=P,n=F,r=N}return u!==void 0&&r?(s.setFlatCoordinates(u,n),s.endss_=r):s.setCoordinates(n,u),s}return h.prototype.appendPolygon=function(n){var u;if(!this.flatCoordinates)this.flatCoordinates=n.getFlatCoordinates().slice(),u=n.getEnds().slice(),this.endss_.push();else{var r=this.flatCoordinates.length;Ka(this.flatCoordinates,n.getFlatCoordinates()),u=n.getEnds().slice();for(var s=0,P=u.length;s<P;++s)u[s]+=r}this.endss_.push(u),this.changed()},h.prototype.clone=function(){for(var n=this.endss_.length,u=new Array(n),r=0;r<n;++r)u[r]=this.endss_[r].slice();var s=new h(this.flatCoordinates.slice(),this.layout,u);return s.applyProperties(this),s},h.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(_x(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),vx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,n,u,r,s))},h.prototype.containsXY=function(n,u){return Ix(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n,u)},h.prototype.getArea=function(){return Tx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)},h.prototype.getCoordinates=function(n){var u;return n!==void 0?(u=this.getOrientedFlatCoordinates().slice(),Ky(u,0,this.endss_,this.stride,n)):u=this.flatCoordinates,hd(u,0,this.endss_,this.stride)},h.prototype.getEndss=function(){return this.endss_},h.prototype.getFlatInteriorPoints=function(){if(this.flatInteriorPointsRevision_!=this.getRevision()){var n=L0(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Cx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_},h.prototype.getInteriorPoints=function(){return new ag(this.getFlatInteriorPoints().slice(),Pn.XYM)},h.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var n=this.flatCoordinates;Lx(n,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=n:(this.orientedFlatCoordinates_=n.slice(),this.orientedFlatCoordinates_.length=Ky(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},h.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=Ex(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(n),u,0,r),new h(u,Pn.XY,r)},h.prototype.getPolygon=function(n){if(n<0||this.endss_.length<=n)return null;var u;if(n===0)u=0;else{var r=this.endss_[n-1];u=r[r.length-1]}var s=this.endss_[n].slice(),P=s[s.length-1];if(u!==0)for(var z=0,F=s.length;z<F;++z)s[z]-=u;return new dd(this.flatCoordinates.slice(u,P),this.layout,s)},h.prototype.getPolygons=function(){for(var n=this.layout,u=this.flatCoordinates,r=this.endss_,s=[],P=0,z=0,F=r.length;z<F;++z){var N=r[z].slice(),V=N[N.length-1];if(P!==0)for(var me=0,_e=N.length;me<_e;++me)N[me]-=P;var Se=new dd(u.slice(P,V),n,N);s.push(Se),P=V}return s},h.prototype.getType=function(){return Mt.MULTI_POLYGON},h.prototype.intersectsExtent=function(n){return Px(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n)},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,3),this.flatCoordinates||(this.flatCoordinates=[]);var r=bx(this.flatCoordinates,0,n,this.stride,this.endss_);if(r.length===0)this.flatCoordinates.length=0;else{var s=r[r.length-1];this.flatCoordinates.length=s.length===0?0:s[s.length-1]}this.changed()},h}(Es),R0=Z2;var B0=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),z0=0,wd=1,D0=[0,0,0,0],pf=[],b_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},w_=function(y){B0(h,y);function h(n,u,r){var s=y.call(this,n)||this;return s.features=u,s.mapBrowserEvent=r,s}return h}(sn);var X2=function(y){B0(h,y);function h(n){var u=y.call(this,n)||this;u.on,u.once,u.un,u.boundHandleFeatureChange_=u.handleFeatureChange_.bind(u),u.condition_=n.condition?n.condition:M0,u.defaultDeleteCondition_=function(s){return I0(s)&&P0(s)},u.deleteCondition_=n.deleteCondition?n.deleteCondition:u.defaultDeleteCondition_,u.insertVertexCondition_=n.insertVertexCondition?n.insertVertexCondition:C0,u.vertexFeature_=null,u.vertexSegments_=null,u.lastPixel_=[0,0],u.ignoreNextSingleClick_=!1,u.featuresBeingModified_=null,u.rBush_=new bd,u.pixelTolerance_=n.pixelTolerance!==void 0?n.pixelTolerance:10,u.snappedToVertex_=!1,u.changingFeature_=!1,u.dragSegments_=[],u.overlay_=new tp({source:new rp({useSpatialIndex:!1,wrapX:!!n.wrapX}),style:n.style?n.style:$2(),updateWhileAnimating:!0,updateWhileInteracting:!0}),u.SEGMENT_WRITERS_={Point:u.writePointGeometry_.bind(u),LineString:u.writeLineStringGeometry_.bind(u),LinearRing:u.writeLineStringGeometry_.bind(u),Polygon:u.writePolygonGeometry_.bind(u),MultiPoint:u.writeMultiPointGeometry_.bind(u),MultiLineString:u.writeMultiLineStringGeometry_.bind(u),MultiPolygon:u.writeMultiPolygonGeometry_.bind(u),Circle:u.writeCircleGeometry_.bind(u),GeometryCollection:u.writeGeometryCollectionGeometry_.bind(u)},u.source_=null,u.hitDetection_=null;var r;if(n.features?r=n.features:n.source&&(u.source_=n.source,r=new ch(u.source_.getFeatures()),u.source_.addEventListener(Qa.ADDFEATURE,u.handleSourceAdd_.bind(u)),u.source_.addEventListener(Qa.REMOVEFEATURE,u.handleSourceRemove_.bind(u))),!r)throw new Error("The modify interaction requires features, a source or a layer");return n.hitDetection&&(u.hitDetection_=n.hitDetection),u.features_=r,u.features_.forEach(u.addFeature_.bind(u)),u.features_.addEventListener(ws.ADD,u.handleFeatureAdd_.bind(u)),u.features_.addEventListener(ws.REMOVE,u.handleFeatureRemove_.bind(u)),u.lastPointerEvent_=null,u.delta_=[0,0],u.snapToPointer_=n.snapToPointer===void 0?!u.hitDetection_:n.snapToPointer,u}return h.prototype.addFeature_=function(n){var u=n.getGeometry();if(u){var r=this.SEGMENT_WRITERS_[u.getType()];r&&r(n,u)}var s=this.getMap();s&&s.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,s),n.addEventListener(Ji.CHANGE,this.boundHandleFeatureChange_)},h.prototype.willModifyFeatures_=function(n,u){if(!this.featuresBeingModified_){this.featuresBeingModified_=new ch;for(var r=this.featuresBeingModified_.getArray(),s=0,P=u.length;s<P;++s)for(var z=u[s],F=0,N=z.length;F<N;++F){var V=z[F].feature;V&&r.indexOf(V)===-1&&this.featuresBeingModified_.push(V)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new w_(b_.MODIFYSTART,this.featuresBeingModified_,n))}},h.prototype.removeFeature_=function(n){this.removeFeatureSegmentData_(n),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.removeEventListener(Ji.CHANGE,this.boundHandleFeatureChange_)},h.prototype.removeFeatureSegmentData_=function(n){var u=this.rBush_,r=[];u.forEach(function(F){n===F.feature&&r.push(F)});for(var s=r.length-1;s>=0;--s){for(var P=r[s],z=this.dragSegments_.length-1;z>=0;--z)this.dragSegments_[z][0]===P&&this.dragSegments_.splice(z,1);u.remove(P)}},h.prototype.setActive=function(n){this.vertexFeature_&&!n&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),y.prototype.setActive.call(this,n)},h.prototype.setMap=function(n){this.overlay_.setMap(n),y.prototype.setMap.call(this,n)},h.prototype.getOverlay=function(){return this.overlay_},h.prototype.handleSourceAdd_=function(n){n.feature&&this.features_.push(n.feature)},h.prototype.handleSourceRemove_=function(n){n.feature&&this.features_.remove(n.feature)},h.prototype.handleFeatureAdd_=function(n){this.addFeature_(n.element)},h.prototype.handleFeatureChange_=function(n){if(!this.changingFeature_){var u=n.target;this.removeFeature_(u),this.addFeature_(u)}},h.prototype.handleFeatureRemove_=function(n){var u=n.element;this.removeFeature_(u)},h.prototype.writePointGeometry_=function(n,u){var r=u.getCoordinates(),s={feature:n,geometry:u,segment:[r,r]};this.rBush_.insert(u.getExtent(),s)},h.prototype.writeMultiPointGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s){var z=r[s],F={feature:n,geometry:u,depth:[s],index:s,segment:[z,z]};this.rBush_.insert(u.getExtent(),F)}},h.prototype.writeLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length-1;s<P;++s){var z=r.slice(s,s+2),F={feature:n,geometry:u,index:s,segment:z};this.rBush_.insert(wu(z),F)}},h.prototype.writeMultiLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length-1;F<N;++F){var V=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:V};this.rBush_.insert(wu(V),me)}},h.prototype.writePolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length-1;F<N;++F){var V=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:V};this.rBush_.insert(wu(V),me)}},h.prototype.writeMultiPolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length;F<N;++F)for(var V=z[F],me=0,_e=V.length-1;me<_e;++me){var Se=V.slice(me,me+2),Ue={feature:n,geometry:u,depth:[F,s],index:me,segment:Se};this.rBush_.insert(wu(Se),Ue)}},h.prototype.writeCircleGeometry_=function(n,u){var r=u.getCenter(),s={feature:n,geometry:u,index:z0,segment:[r,r]},P={feature:n,geometry:u,index:wd,segment:[r,r]},z=[s,P];s.featureSegments=z,P.featureSegments=z,this.rBush_.insert(Yp(r),s);var F=u,N=uh();if(N&&this.getMap()){var V=this.getMap().getView().getProjection();F=F.clone().transform(N,V),F=Hy(F).transform(V,N)}this.rBush_.insert(F.getExtent(),P)},h.prototype.writeGeometryCollectionGeometry_=function(n,u){for(var r=u.getGeometriesArray(),s=0;s<r.length;++s){var P=r[s],z=this.SEGMENT_WRITERS_[P.getType()];z(n,P)}},h.prototype.createOrUpdateVertexFeature_=function(n,u,r){var s=this.vertexFeature_;if(!s)s=new lc(new _a(n)),this.vertexFeature_=s,this.overlay_.getSource().addFeature(s);else{var P=s.getGeometry();P.setCoordinates(n)}return s.set("features",u),s.set("geometries",r),s},h.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;this.lastPointerEvent_=n;var u;return!n.map.getView().getInteracting()&&n.type==na.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(n),this.vertexFeature_&&this.deleteCondition_(n)&&(n.type!=na.SINGLECLICK||!this.ignoreNextSingleClick_?u=this.removePoint():u=!0),n.type==na.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),y.prototype.handleEvent.call(this,n)&&!u},h.prototype.handleDragEvent=function(n){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(n,this.dragSegments_);for(var u=[n.coordinate[0]+this.delta_[0],n.coordinate[1]+this.delta_[1]],r=[],s=[],P=0,z=this.dragSegments_.length;P<z;++P){var F=this.dragSegments_[P],N=F[0],V=N.feature;r.indexOf(V)===-1&&r.push(V);var me=N.geometry;s.indexOf(me)===-1&&s.push(me);for(var _e=N.depth,Se=void 0,Ue=N.segment,He=F[1];u.length<me.getStride();)u.push(Ue[He][u.length]);switch(me.getType()){case Mt.POINT:Se=u,Ue[0]=u,Ue[1]=u;break;case Mt.MULTI_POINT:Se=me.getCoordinates(),Se[N.index]=u,Ue[0]=u,Ue[1]=u;break;case Mt.LINE_STRING:Se=me.getCoordinates(),Se[N.index+He]=u,Ue[He]=u;break;case Mt.MULTI_LINE_STRING:Se=me.getCoordinates(),Se[_e[0]][N.index+He]=u,Ue[He]=u;break;case Mt.POLYGON:Se=me.getCoordinates(),Se[_e[0]][N.index+He]=u,Ue[He]=u;break;case Mt.MULTI_POLYGON:Se=me.getCoordinates(),Se[_e[1]][_e[0]][N.index+He]=u,Ue[He]=u;break;case Mt.CIRCLE:if(Ue[0]=u,Ue[1]=u,N.index===z0)this.changingFeature_=!0,me.setCenter(u),this.changingFeature_=!1;else{this.changingFeature_=!0;var Ie=n.map.getView().getProjection(),Ge=Ey(Xl(me.getCenter(),Ie),Xl(u,Ie)),et=uh();if(et){var rt=me.clone().transform(et,Ie);rt.setRadius(Ge),Ge=rt.transform(Ie,et).getRadius()}me.setRadius(Ge),this.changingFeature_=!1}break;default:}Se&&this.setGeometryCoordinates_(me,Se)}this.createOrUpdateVertexFeature_(u,r,s)},h.prototype.handleDownEvent=function(n){if(!this.condition_(n))return!1;var u=n.coordinate;this.handlePointerAtPixel_(n.pixel,n.map,u),this.dragSegments_.length=0,this.featuresBeingModified_=null;var r=this.vertexFeature_;if(r){var s=n.map.getView().getProjection(),P=[],z=r.getGeometry().getCoordinates(),F=wu([z]),N=this.rBush_.getInExtent(F),V={};N.sort(W2);for(var me=0,_e=N.length;me<_e;++me){var Se=N[me],Ue=Se.segment,He=Ai(Se.geometry),Ie=Se.depth;if(Ie&&(He+="-"+Ie.join("-")),V[He]||(V[He]=new Array(2)),Se.geometry.getType()===Mt.CIRCLE&&Se.index===wd){var Ge=F0(u,Se,s);Tu(Ge,z)&&!V[He][0]&&(this.dragSegments_.push([Se,0]),V[He][0]=Se);continue}if(Tu(Ue[0],z)&&!V[He][0]){this.dragSegments_.push([Se,0]),V[He][0]=Se;continue}if(Tu(Ue[1],z)&&!V[He][1]){if((Se.geometry.getType()===Mt.LINE_STRING||Se.geometry.getType()===Mt.MULTI_LINE_STRING)&&V[He][0]&&V[He][0].index===0)continue;this.dragSegments_.push([Se,1]),V[He][1]=Se;continue}Ai(Ue)in this.vertexSegments_&&!V[He][0]&&!V[He][1]&&this.insertVertexCondition_(n)&&P.push(Se)}P.length&&this.willModifyFeatures_(n,[P]);for(var et=P.length-1;et>=0;--et)this.insertVertex_(P[et],z)}return!!this.vertexFeature_},h.prototype.handleUpEvent=function(n){for(var u=this.dragSegments_.length-1;u>=0;--u){var r=this.dragSegments_[u][0],s=r.geometry;if(s.getType()===Mt.CIRCLE){var P=s.getCenter(),z=r.featureSegments[0],F=r.featureSegments[1];z.segment[0]=P,z.segment[1]=P,F.segment[0]=P,F.segment[1]=P,this.rBush_.update(Yp(P),z);var N=s,V=uh();if(V){var me=n.map.getView().getProjection();N=N.clone().transform(V,me),N=Hy(N).transform(me,V)}this.rBush_.update(N.getExtent(),F)}else this.rBush_.update(wu(r.segment),r)}return this.featuresBeingModified_&&(this.dispatchEvent(new w_(b_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null),!1},h.prototype.handlePointerMove_=function(n){this.lastPixel_=n.pixel,this.handlePointerAtPixel_(n.pixel,n.map,n.coordinate)},h.prototype.handlePointerAtPixel_=function(n,u,r){var s=this,P=r||u.getCoordinateFromPixel(n),z=u.getView().getProjection(),F=function(At,Vr){return O0(P,At,z)-O0(P,Vr,z)},N,V;if(this.hitDetection_){var me=typeof this.hitDetection_=="object"?function(At){return At===s.hitDetection_}:void 0;u.forEachFeatureAtPixel(n,function(At,Vr,Er){if(Er=Er||At.getGeometry(),Er.getType()===Mt.POINT&&_v(s.features_.getArray(),At)){V=Er;var zr=Er.getFlatCoordinates().slice(0,2);N=[{feature:At,geometry:Er,segment:[zr,zr]}]}return!0},{layerFilter:me})}if(!N){var _e=rd(Yp(P,D0),z),Se=u.getView().getResolution()*this.pixelTolerance_,Ue=Qp(yl(_e,Se,D0),z);N=this.rBush_.getInExtent(Ue)}if(N&&N.length>0){var He=N.sort(F)[0],Ie=He.segment,Ge=F0(P,He,z),et=u.getPixelFromCoordinate(Ge),rt=Ey(n,et);if(V||rt<=this.pixelTolerance_){var _t={};if(_t[Ai(Ie)]=!0,this.snapToPointer_||(this.delta_[0]=Ge[0]-P[0],this.delta_[1]=Ge[1]-P[1]),He.geometry.getType()===Mt.CIRCLE&&He.index===wd)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(Ge,[He.feature],[He.geometry]);else{var yt=u.getPixelFromCoordinate(Ie[0]),ct=u.getPixelFromCoordinate(Ie[1]),Tt=Jp(et,yt),St=Jp(et,ct);rt=Math.sqrt(Math.min(Tt,St)),this.snappedToVertex_=rt<=this.pixelTolerance_,this.snappedToVertex_&&(Ge=Tt>St?Ie[1]:Ie[0]),this.createOrUpdateVertexFeature_(Ge,[He.feature],[He.geometry]);var Lt={};Lt[Ai(He.geometry)]=!0;for(var nr=1,jt=N.length;nr<jt;++nr){var Jt=N[nr].segment;if(Tu(Ie[0],Jt[0])&&Tu(Ie[1],Jt[1])||Tu(Ie[0],Jt[1])&&Tu(Ie[1],Jt[0])){var or=Ai(N[nr].geometry);or in Lt||(Lt[or]=!0,_t[Ai(Jt)]=!0)}else break}}this.vertexSegments_=_t;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},h.prototype.insertVertex_=function(n,u){for(var r=n.segment,s=n.feature,P=n.geometry,z=n.depth,F=n.index,N;u.length<P.getStride();)u.push(0);switch(P.getType()){case Mt.MULTI_LINE_STRING:N=P.getCoordinates(),N[z[0]].splice(F+1,0,u);break;case Mt.POLYGON:N=P.getCoordinates(),N[z[0]].splice(F+1,0,u);break;case Mt.MULTI_POLYGON:N=P.getCoordinates(),N[z[1]][z[0]].splice(F+1,0,u);break;case Mt.LINE_STRING:N=P.getCoordinates(),N.splice(F+1,0,u);break;default:return}this.setGeometryCoordinates_(P,N);var V=this.rBush_;V.remove(n),this.updateSegmentIndices_(P,F,z,1);var me={segment:[r[0],u],feature:s,geometry:P,depth:z,index:F};V.insert(wu(me.segment),me),this.dragSegments_.push([me,1]);var _e={segment:[u,r[1]],feature:s,geometry:P,depth:z,index:F+1};V.insert(wu(_e.segment),_e),this.dragSegments_.push([_e,0]),this.ignoreNextSingleClick_=!0},h.prototype.removePoint=function(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=na.POINTERDRAG){var n=this.lastPointerEvent_;this.willModifyFeatures_(n,this.dragSegments_);var u=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new w_(b_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null,u}return!1},h.prototype.removeVertex_=function(){var n=this.dragSegments_,u={},r=!1,s,P,z,F,N,V,me,_e,Se,Ue,He;for(N=n.length-1;N>=0;--N)z=n[N],Ue=z[0],He=Ai(Ue.feature),Ue.depth&&(He+="-"+Ue.depth.join("-")),He in u||(u[He]={}),z[1]===0?(u[He].right=Ue,u[He].index=Ue.index):z[1]==1&&(u[He].left=Ue,u[He].index=Ue.index+1);for(He in u){switch(Se=u[He].right,me=u[He].left,V=u[He].index,_e=V-1,me!==void 0?Ue=me:Ue=Se,_e<0&&(_e=0),F=Ue.geometry,P=F.getCoordinates(),s=P,r=!1,F.getType()){case Mt.MULTI_LINE_STRING:P[Ue.depth[0]].length>2&&(P[Ue.depth[0]].splice(V,1),r=!0);break;case Mt.LINE_STRING:P.length>2&&(P.splice(V,1),r=!0);break;case Mt.MULTI_POLYGON:s=s[Ue.depth[1]];case Mt.POLYGON:s=s[Ue.depth[0]],s.length>4&&(V==s.length-1&&(V=0),s.splice(V,1),r=!0,V===0&&(s.pop(),s.push(s[0]),_e=s.length-1));break;default:}if(r){this.setGeometryCoordinates_(F,P);var Ie=[];if(me!==void 0&&(this.rBush_.remove(me),Ie.push(me.segment[0])),Se!==void 0&&(this.rBush_.remove(Se),Ie.push(Se.segment[1])),me!==void 0&&Se!==void 0){var Ge={depth:Ue.depth,feature:Ue.feature,geometry:Ue.geometry,index:_e,segment:Ie};this.rBush_.insert(wu(Ge.segment),Ge)}this.updateSegmentIndices_(F,V,Ue.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.length=0}}return r},h.prototype.setGeometryCoordinates_=function(n,u){this.changingFeature_=!0,n.setCoordinates(u),this.changingFeature_=!1},h.prototype.updateSegmentIndices_=function(n,u,r,s){this.rBush_.forEachInExtent(n.getExtent(),function(P){P.geometry===n&&(r===void 0||P.depth===void 0||_s(P.depth,r))&&P.index>u&&(P.index+=s)})},h}(S0);function W2(y,h){return y.index-h.index}function O0(y,h,n){var u=h.geometry;if(u.getType()===Mt.CIRCLE){var r=u;if(h.index===wd){var s=uh();s&&(r=r.clone().transform(s,n));var P=Jp(r.getCenter(),Xl(y,n)),z=Math.sqrt(P)-r.getRadius();return z*z}}var F=Xl(y,n);return pf[0]=Xl(h.segment[0],n),pf[1]=Xl(h.segment[1],n),Jv(F,pf)}function F0(y,h,n){var u=h.geometry;if(u.getType()===Mt.CIRCLE&&h.index===wd){var r=u,s=uh();return s&&(r=r.clone().transform(s,n)),Iy(r.getClosestPoint(Xl(y,n)),n)}var P=Xl(y,n);return pf[0]=Xl(h.segment[0],n),pf[1]=Xl(h.segment[1],n),Iy(wy(P,pf),n)}function $2(){var y=Xx();return function(h,n){return y[Mt.POINT]}}var E_=X2;var K2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),H2=function(y){K2(h,y);function h(n){var u=y.call(this)||this;return u.geometries_=n||null,u.changeEventsKeys_=[],u.listenGeometriesChange_(),u}return h.prototype.unlistenGeometriesChange_=function(){this.changeEventsKeys_.forEach(Po),this.changeEventsKeys_.length=0},h.prototype.listenGeometriesChange_=function(){if(!!this.geometries_)for(var n=0,u=this.geometries_.length;n<u;++n)this.changeEventsKeys_.push(uo(this.geometries_[n],Ji.CHANGE,this.changed,this))},h.prototype.clone=function(){var n=new h(null);return n.setGeometries(this.geometries_),n.applyProperties(this),n},h.prototype.closestPointXY=function(n,u,r,s){if(s<xs(this.getExtent(),n,u))return s;for(var P=this.geometries_,z=0,F=P.length;z<F;++z)s=P[z].closestPointXY(n,u,r,s);return s},h.prototype.containsXY=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)if(r[s].containsXY(n,u))return!0;return!1},h.prototype.computeExtent=function(n){Hp(n);for(var u=this.geometries_,r=0,s=u.length;r<s;++r)Zv(n,u[r].getExtent());return n},h.prototype.getGeometries=function(){return U0(this.geometries_)},h.prototype.getGeometriesArray=function(){return this.geometries_},h.prototype.getGeometriesArrayRecursive=function(){for(var n=[],u=this.geometries_,r=0,s=u.length;r<s;++r)u[r].getType()===this.getType()?n=n.concat(u[r].getGeometriesArrayRecursive()):n.push(u[r]);return n},h.prototype.getSimplifiedGeometry=function(n){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),n<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&n<this.simplifiedGeometryMaxMinSquaredTolerance)return this;for(var u=[],r=this.geometries_,s=!1,P=0,z=r.length;P<z;++P){var F=r[P],N=F.getSimplifiedGeometry(n);u.push(N),N!==F&&(s=!0)}if(s){var V=new h(null);return V.setGeometriesArray(u),V}else return this.simplifiedGeometryMaxMinSquaredTolerance=n,this},h.prototype.getType=function(){return Mt.GEOMETRY_COLLECTION},h.prototype.intersectsExtent=function(n){for(var u=this.geometries_,r=0,s=u.length;r<s;++r)if(u[r].intersectsExtent(n))return!0;return!1},h.prototype.isEmpty=function(){return this.geometries_.length===0},h.prototype.rotate=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].rotate(n,u);this.changed()},h.prototype.scale=function(n,u,r){var s=r;s||(s=$h(this.getExtent()));for(var P=this.geometries_,z=0,F=P.length;z<F;++z)P[z].scale(n,u,s);this.changed()},h.prototype.setGeometries=function(n){this.setGeometriesArray(U0(n))},h.prototype.setGeometriesArray=function(n){this.unlistenGeometriesChange_(),this.geometries_=n,this.listenGeometriesChange_(),this.changed()},h.prototype.applyTransform=function(n){for(var u=this.geometries_,r=0,s=u.length;r<s;++r)u[r].applyTransform(n);this.changed()},h.prototype.translate=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].translate(n,u);this.changed()},h.prototype.disposeInternal=function(){this.unlistenGeometriesChange_(),y.prototype.disposeInternal.call(this)},h}($m);function U0(y){for(var h=[],n=0,u=y.length;n<u;++n)h.push(y[n].clone());return h}var N0=H2;var Y2=function(){function y(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return y.prototype.getReadOptions=function(h,n){var u;if(n){var r=n.dataProjection?ya(n.dataProjection):this.readProjection(h);n.extent&&r&&r.getUnits()===ac.TILE_PIXELS&&(r=ya(r),r.setWorldExtent(n.extent)),u={dataProjection:r,featureProjection:n.featureProjection}}return this.adaptOptions(u)},y.prototype.adaptOptions=function(h){return Ra({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},h)},y.prototype.getType=function(){return jr()},y.prototype.readFeature=function(h,n){return jr()},y.prototype.readFeatures=function(h,n){return jr()},y.prototype.readGeometry=function(h,n){return jr()},y.prototype.readProjection=function(h){return jr()},y.prototype.writeFeature=function(h,n){return jr()},y.prototype.writeFeatures=function(h,n){return jr()},y.prototype.writeGeometry=function(h,n){return jr()},y}(),V0=Y2;function T_(y,h,n){var u=n?ya(n.featureProjection):null,r=n?ya(n.dataProjection):null,s;if(u&&r&&!rx(u,r)?s=(h?y.clone():y).transform(h?u:r,h?r:u):s=y,h&&n&&n.decimals!==void 0){var P=Math.pow(10,n.decimals),z=function(F){for(var N=0,V=F.length;N<V;++N)F[N]=Math.round(F[N]*P)/P;return F};s===y&&(s=y.clone()),s.applyTransform(z)}return s}var J2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Q2=function(y){J2(h,y);function h(){return y.call(this)||this}return h.prototype.getType=function(){return _h.JSON},h.prototype.readFeature=function(n,u){return this.readFeatureFromObject(sg(n),this.getReadOptions(n,u))},h.prototype.readFeatures=function(n,u){return this.readFeaturesFromObject(sg(n),this.getReadOptions(n,u))},h.prototype.readFeatureFromObject=function(n,u){return jr()},h.prototype.readFeaturesFromObject=function(n,u){return jr()},h.prototype.readGeometry=function(n,u){return this.readGeometryFromObject(sg(n),this.getReadOptions(n,u))},h.prototype.readGeometryFromObject=function(n,u){return jr()},h.prototype.readProjection=function(n){return this.readProjectionFromObject(sg(n))},h.prototype.readProjectionFromObject=function(n){return jr()},h.prototype.writeFeature=function(n,u){return JSON.stringify(this.writeFeatureObject(n,u))},h.prototype.writeFeatureObject=function(n,u){return jr()},h.prototype.writeFeatures=function(n,u){return JSON.stringify(this.writeFeaturesObject(n,u))},h.prototype.writeFeaturesObject=function(n,u){return jr()},h.prototype.writeGeometry=function(n,u){return JSON.stringify(this.writeGeometryObject(n,u))},h.prototype.writeGeometryObject=function(n,u){return jr()},h}(V0);function sg(y){if(typeof y=="string"){var h=JSON.parse(y);return h||null}else return y!==null?y:null}var G0=Q2;var eE=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),tE=function(y){eE(h,y);function h(n){var u=this,r=n||{};return u=y.call(this)||this,u.dataProjection=ya(r.dataProjection?r.dataProjection:"EPSG:4326"),r.featureProjection&&(u.defaultFeatureProjection=ya(r.featureProjection)),u.geometryName_=r.geometryName,u.extractGeometryName_=r.extractGeometryName,u.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"],u}return h.prototype.readFeatureFromObject=function(n,u){var r=null;n.type==="Feature"?r=n:r={type:"Feature",geometry:n,properties:null};var s=S_(r.geometry,u),P=new lc;return this.geometryName_?P.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in r!==void 0&&P.setGeometryName(r.geometry_name),P.setGeometry(s),"id"in r&&P.setId(r.id),r.properties&&P.setProperties(r.properties,!0),P},h.prototype.readFeaturesFromObject=function(n,u){var r=n,s=null;if(r.type==="FeatureCollection"){var P=n;s=[];for(var z=P.features,F=0,N=z.length;F<N;++F)s.push(this.readFeatureFromObject(z[F],u))}else s=[this.readFeatureFromObject(n,u)];return s},h.prototype.readGeometryFromObject=function(n,u){return S_(n,u)},h.prototype.readProjectionFromObject=function(n){var u=n.crs,r;return u?u.type=="name"?r=ya(u.properties.name):u.type==="EPSG"?r=ya("EPSG:"+u.properties.code):En(!1,36):r=this.dataProjection,r},h.prototype.writeFeatureObject=function(n,u){u=this.adaptOptions(u);var r={type:"Feature",geometry:null,properties:null},s=n.getId();if(s!==void 0&&(r.id=s),!n.hasProperties())return r;var P=n.getProperties(),z=n.getGeometry();return z&&(r.geometry=I_(z,u),delete P[n.getGeometryName()]),Vl(P)||(r.properties=P),r},h.prototype.writeFeaturesObject=function(n,u){u=this.adaptOptions(u);for(var r=[],s=0,P=n.length;s<P;++s)r.push(this.writeFeatureObject(n[s],u));return{type:"FeatureCollection",features:r}},h.prototype.writeGeometryObject=function(n,u){return I_(n,this.adaptOptions(u))},h}(G0);function S_(y,h){if(!y)return null;var n;switch(y.type){case Mt.POINT:{n=iE(y);break}case Mt.LINE_STRING:{n=nE(y);break}case Mt.POLYGON:{n=lE(y);break}case Mt.MULTI_POINT:{n=aE(y);break}case Mt.MULTI_LINE_STRING:{n=oE(y);break}case Mt.MULTI_POLYGON:{n=sE(y);break}case Mt.GEOMETRY_COLLECTION:{n=rE(y);break}default:throw new Error("Unsupported GeoJSON type: "+y.type)}return T_(n,!1,h)}function rE(y,h){var n=y.geometries.map(function(u){return S_(u,h)});return new N0(n)}function iE(y){return new _a(y.coordinates)}function nE(y){return new uc(y.coordinates)}function oE(y){return new k0(y.coordinates)}function aE(y){return new ag(y.coordinates)}function sE(y){return new R0(y.coordinates)}function lE(y){return new dd(y.coordinates)}function I_(y,h){y=T_(y,!0,h);var n=y.getType(),u;switch(n){case Mt.POINT:{u=dE(y,h);break}case Mt.LINE_STRING:{u=cE(y,h);break}case Mt.POLYGON:{u=mE(y,h);break}case Mt.MULTI_POINT:{u=pE(y,h);break}case Mt.MULTI_LINE_STRING:{u=hE(y,h);break}case Mt.MULTI_POLYGON:{u=fE(y,h);break}case Mt.GEOMETRY_COLLECTION:{u=uE(y,h);break}case Mt.CIRCLE:{u={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+n)}return u}function uE(y,h){var n=y.getGeometriesArray().map(function(u){var r=Ra({},h);return delete r.featureProjection,I_(u,r)});return{type:"GeometryCollection",geometries:n}}function cE(y,h){return{type:"LineString",coordinates:y.getCoordinates()}}function hE(y,h){return{type:"MultiLineString",coordinates:y.getCoordinates()}}function pE(y,h){return{type:"MultiPoint",coordinates:y.getCoordinates()}}function fE(y,h){var n;return h&&(n=h.rightHanded),{type:"MultiPolygon",coordinates:y.getCoordinates(n)}}function dE(y,h){return{type:"Point",coordinates:y.getCoordinates()}}function mE(y,h){var n;return h&&(n=h.rightHanded),{type:"Polygon",coordinates:y.getCoordinates(n)}}var bl=tE;var lg,gE=new Uint8Array(16);function C_(){if(!lg&&(lg=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!lg))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return lg(gE)}var j0=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function yE(y){return typeof y=="string"&&j0.test(y)}var q0=yE;var xa=[];for(ug=0;ug<256;++ug)xa.push((ug+256).toString(16).substr(1));var ug;function _E(y){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(xa[y[h+0]]+xa[y[h+1]]+xa[y[h+2]]+xa[y[h+3]]+"-"+xa[y[h+4]]+xa[y[h+5]]+"-"+xa[y[h+6]]+xa[y[h+7]]+"-"+xa[y[h+8]]+xa[y[h+9]]+"-"+xa[y[h+10]]+xa[y[h+11]]+xa[y[h+12]]+xa[y[h+13]]+xa[y[h+14]]+xa[y[h+15]]).toLowerCase();if(!q0(n))throw TypeError("Stringified UUID is invalid");return n}var Z0=_E;function vE(y,h,n){y=y||{};var u=y.random||(y.rng||C_)();if(u[6]=u[6]&15|64,u[8]=u[8]&63|128,h){n=n||0;for(var r=0;r<16;++r)h[n+r]=u[r];return h}return Z0(u)}var A_=vE;var ip=class extends Mo{constructor(n={}){super();this.properties={};this.options={};this.defineProperties(n),n.properties&&this.setProperties(n.properties),this.options=n,this.visible=n.visible===void 0?!0:!!n.visible,this.group=n.group,this.copyrights=n.copyrights,this.children=n.children,this.on("change:visible:group",u=>{this.group===u.target.group&&this!==u.target&&this.visible?this.visible=!1:this.children&&this.children.forEach(r=>r.dispatchEvent(u))})}defineProperties(n={}){let{name:u,key:r,properties:s,hitTolerance:P}={...n},z=A_();Object.defineProperties(this,{name:{value:u},key:{value:r||u||z},group:{get:()=>this.get("group"),set:F=>{this.set("group",F)}},copyrights:{get:()=>this.get("copyrights"),set:F=>{let N=F&&!Array.isArray(F)?[F]:F;this.set("copyrights",N||[])}},options:{value:n},map:{writable:!0},visible:{get:()=>this.get("visible"),set:F=>{if(F!==this.visible)if(this.set("visible",F),this.visible){if(this.parent&&(this.parent.visible=!0),this.children&&!this.children.some(N=>N.visible)&&this.children.forEach(N=>{N.visible=!0}),this.parent&&this.group){let N=this.parent;for(;N.parent;)N=N.parent;let V=new sn("change:visible:group");V.target=this,N.dispatchEvent(V)}}else this.visible||(this.children&&this.children.forEach(N=>{N.visible=!1}),this.parent&&this.parent.visible&&this.parent.children&&!this.parent.children.find(N=>N.visible)&&(this.parent.visible=!1))}},disabled:{get:()=>this.get("disabled"),set:F=>{this.set("disabled",F)}},parent:{value:null,writable:!0},children:{get:()=>this.get("children")||[],set:F=>{(this.children||[]).forEach(N=>{N.parent=void 0}),Array.isArray(F)&&F.forEach(N=>{N.parent=this}),this.set("children",F||[])}},hitTolerance:{value:P||5,writable:!0},properties:{value:{...s||{}}}})}attachToMap(n){this.detachFromMap(),this.map=n,this.children&&this.children.forEach(u=>{u.attachToMap(n)})}detachFromMap(){this.map=void 0}getFeatureInfoAtCoordinate(n,u){return console.error("getFeatureInfoAtCoordinate must be implemented by inheriting layers",this.key),Promise.resolve({layer:this,features:[],coordinate:n})}flat(){return Kf(this)}};function xE(y){return class extends y{constructor(n={}){super(n);let{userInteractions:u=!0,userClickInteractions:r=!0,userHoverInteractions:s=!0,defaultUserInteractions:P=!0}=n;this.userInteractions=u,this.userClickInteractions=r,this.userHoverInteractions=s,this.defaultUserInteractions=P,this.userClickCallbacks=[],this.userHoverCallbacks=[],this.userClickEventsKeys=[],this.userHoverEventsKeys=[],this.onUserClickCallback=this.onUserClickCallback.bind(this),this.onUserMoveCallback=this.onUserMoveCallback.bind(this);let{onClick:z,onHover:F}=n;this.userInteractions&&this.userClickInteractions&&z&&this.onClick(z),this.userInteractions&&this.userHoverInteractions&&F&&this.onHover(F)}attachToMap(n){super.attachToMap(n),this.userInteractions&&this.defaultUserInteractions&&this.userClickInteractions&&this.onFeatureClick&&this.onClick(this.onFeatureClick),this.userInteractions&&this.defaultUserInteractions&&this.userHoverInteractions&&this.onFeatureHover&&this.onHover(this.onFeatureHover),this.listenEvents()}detachFromMap(){this.unlistenEvents(),super.detachFromMap()}listenEvents(){this.unlistenEvents(),this.userClickCallbacks.forEach(n=>{this.userClickEventsKeys.push(this.on("user:click",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))}),this.userHoverCallbacks.forEach(n=>{this.userHoverEventsKeys.push(this.on("user:hover",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))})}unlistenEvents(){Ha(this.userClickEventsKeys),Ha(this.userHoverEventsKeys),this.userClickEventsKeys=[],this.userHoverEventsKeys=[]}onClick(n){this.userClickCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}onHover(n){this.userHoverCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}unClick(n){let u=this.userClickCallbacks.indexOf(n);u===-1&&(this.userClickCallbacks=this.userClickCallbacks.slice(u,1),this.map&&this.listenEvents())}unHover(n){let u=this.userHoverCallbacks.indexOf(n);u===-1&&(this.userHoverCallbacks=this.userHoverCallbacks.slice(u,1),this.map&&this.listenEvents())}onUserClickCallback(n){let u=n.coordinate||co(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new sn("user:click");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}onUserMoveCallback(n){let u=n.coordinate||co(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new sn("user:hover");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}activateUserInteractions(){}deactivateUserInteractions(){}}}var cg=xE;var Ed=class extends cg(ip){constructor(n){super(n);this.olLayer&&this.olLayer.setVisible(this.visible)}defineProperties(n){super.defineProperties(n),Object.defineProperties(this,{olLayer:{value:n.olLayer,writable:!0},olListenersKeys:{value:[]}})}attachToMap(n){if(super.attachToMap(n),!!this.map&&(this.olLayer&&!this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.addLayer(this.olLayer),this.olListenersKeys.push(this.on("change:visible",()=>{this.olLayer&&this.olLayer.setVisible(this.visible)})),this.olListenersKeys.push(this.map.getLayers().on("remove",u=>{u.element===this.olLayer&&this.detachFromMap()})),this.toggleVisibleListeners(),this.olListenersKeys.push(this.on("change:visible",this.toggleVisibleListeners)),this.copyrights&&this.olLayer)){let u=this.copyrights||[];this.olLayer.getLayers?this.olLayer.getLayers().getArray().forEach(r=>{r.getSource&&r.getSource()?.setAttributions(u)}):this.olLayer.getSource&&this.olLayer.getSource()?.setAttributions(u)}}detachFromMap(){this.deactivateUserInteractions(),Ha(this.olListenersKeys),this.olLayer&&this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.removeLayer(this.olLayer),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&(this.singleClickListenerKey=this.map.on("singleclick",this.onUserClickCallback),this.olListenersKeys.push(this.singleClickListenerKey)),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&(this.pointerMoveListenerKey=this.map.on("pointermove",this.onUserMoveCallback))}deactivateUserInteractions(){Ha([this.pointerMoveListenerKey,this.singleClickListenerKey])}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}clone(n){return new Ed({...this.options,...n})}},Is=Ed;var X0=new xl({radius:6,fill:new Ks({color:[255,0,0,1]}),stroke:new va({color:[0,0,0,1],width:1})}),bE=new Wl({stroke:new va({color:[0,0,0,1],width:5})}),wE=new Wl({image:X0,stroke:new va({color:[255,0,0,1],width:3})}),EE=new Wl({image:X0,stroke:new va({color:[255,0,0,1],width:3,lineDash:[1,10]})}),TE=(y,h)=>{let n=y.get("minResolution"),u=y.get("maxResolution"),r=h<=n&&h>u;return n&&u&&!r?[]:y.get("mot")!=="foot"?[bE,wE]:[EE]},Td=class extends Is{constructor(n){super(n);this.options={};this.olLayer=n.olLayer||new tp({source:new rp,style:n.style||TE})}clone(n){return new Td({...this.options,...n})}},hg=Td;var SE=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,W0=/^([\d.]+),([\d.]+)$/,$0=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,pg="stop-fetch",K0=y=>{let h=[];return y.forEach(n=>{let u=n.getGeometry()?.getCoordinates();u?.length&&h.push(...u)}),h},Sd=class extends af{constructor(n={}){super(n);this.viaPoints=[];this.loading=!1;this.graphs=[];this.modify=!0;this.useRawViaPoints=!1;this.snapToClosestStation=!1;this.cacheStationData={};this.abortControllers={};this.segments=[];this.format=new bl({featureProjection:"EPSG:3857"});this.initialRouteDrag={};Object.defineProperties(this,{mot:{get:()=>this.get("mot"),set:u=>{u&&(this.set("mot",u),this.viaPoints&&this.drawRoute())}},loading:{get:()=>this.get("loading"),set:u=>{this.set("loading",u)}},modify:{get:()=>this.get("modify"),set:u=>{this.set("modify",u)}}}),this.loading=!1,this.graphs=n.graphs||[["osm",0,99]],this.mot=n.mot||"bus",this.modify=n.modify!==!1,this.routingApiParams=n.routingApiParams,this.useRawViaPoints=n.useRawViaPoints||!1,this.snapToClosestStation=n.snapToClosestStation||!1,this.apiKey=n.apiKey,this.stopsApiKey=n.stopsApiKey||this.apiKey,this.stopsApiUrl=n.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new Zf({...n}),this.routingLayer=n.routingLayer||new hg({name:"routing-layer",style:n.style}),this.onRouteError=n.onRouteError||(u=>{this.dispatchEvent(new sn("change:route")),this.reset(),console.error(u)}),this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.createModifyInteraction()}static getGraphsResolutions(n,u){let r=u.getView();return n.map(([,s,P])=>[r.getResolutionForZoom(s),r.getResolutionForZoom(P||s+1)])}addViaPoint(n,u=-1,r=0){this.viaPoints.splice(u===-1?this.viaPoints.length:u,r,n),this.drawRoute(),this.dispatchEvent(new sn("change:route"))}removeViaPoint(n=(this.viaPoints||[]).length-1){this.viaPoints.length&&this.viaPoints[n]&&this.viaPoints.splice(n,1),this.drawRoute(),this.dispatchEvent(new sn("change:route"))}setViaPoints(n){this.viaPoints=[...n],this.drawRoute(),this.dispatchEvent(new sn("change:route"))}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer?.olLayer?.getSource()?.clear(),this.dispatchEvent(new sn("change:route"))}abortRequests(){this.graphs.forEach(n=>{let u=n[0];this.abortControllers[u]&&this.abortControllers[u].abort(),this.abortControllers[u]=new AbortController}),this.abortControllers[pg]?.abort(),this.abortControllers[pg]=new AbortController,this.loading=!1}drawRoute(){if(this.abortRequests(),this.routingLayer?.olLayer?.getSource()?.clear(),!this.viaPoints.length)return null;if(this.viaPoints.length===1)return this.drawViaPoint(this.viaPoints[0],0,this.abortControllers[pg]);let n=this.viaPoints.map(u=>{if(Array.isArray(u)){let r=this.map?.getView().getProjection(),[s,P]=lh(u,r);return this.snapToClosestStation?[`@${P}`,s]:[P,s]}return this.useRawViaPoints?u:`!${u}`});return this.loading=!0,this.routingLayer?.olLayer?.getSource()?.clear(),this.viaPoints.forEach((u,r)=>this.drawViaPoint(u,r,this.abortControllers[pg])),Promise.all(this.graphs.map(([u],r)=>{let{signal:s}=this.abortControllers[u];return this.api?this.api.route({graph:u,via:`${n.join("|")}`,mot:this.mot,"resolve-hops":!1,elevation:!1,"coord-radius":100,"coord-punish":1e3,...this.routingApiParams||{}},{signal:s}).then(P=>{if(this.segments=this.format.readFeatures(P),this.mot==="foot"){let N=this.segments.reduce((V,me)=>{let _e=me.get("trg");return V.find(Se=>Se[0]===_e[0]&&Se[1]===_e[1])?V:[...V,_e]},[]);this.segments=N.map(V=>{let me=this.segments.filter(Se=>{let Ue=Se.get("trg");return Ue[0]===V[0]&&Ue[1]===V[1]}),_e=K0(me);return new lc({geometry:new uc(_e)})})}let z=K0(this.segments),F=new lc({geometry:new uc(z)});F.set("graph",u),F.set("mot",this.mot),this.graphsResolutions&&this.graphsResolutions[r]?.length>=2&&(F.set("minResolution",this.graphsResolutions[r][0]),F.set("maxResolution",this.graphsResolutions[r][1])),this.routingLayer?.olLayer?.getSource()?.addFeature(F),this.loading=!1}).catch(P=>{P.name!=="AbortError"&&(this.segments=[],this.dispatchEvent(new sn("error")),this.onRouteError(P,this),this.loading=!1)}):Promise.resolve([])}))}drawViaPoint(n,u,r){let s=new lc;if(s.set("viaPointIdx",u),Array.isArray(n))return s.setGeometry(new _a(n)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s);if(!this.useRawViaPoints||$0.test(n)){let V,me;return this.useRawViaPoints?[,V,,me]=$0.exec(n)||[]:[V,me]=n.split("$"),fetch(`${this.stopsApiUrl}lookup/${V}?key=${this.stopsApiKey}`,{signal:r.signal}).then(_e=>_e.json()).then(_e=>{let{coordinates:Se}=_e.features[0].geometry;return this.cacheStationData[n]=co(Se),s.set("viaPointTrack",me),s.setGeometry(new _a(co(Se))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(_e=>{_e.name!=="AbortError"&&(this.dispatchEvent(new sn("error")),this.onRouteError(_e,this),this.loading=!1)})}if(this.useRawViaPoints&&W0.test(n)){let[V,me]=W0.exec(n)||[],_e=co([parseFloat(me),parseFloat(V)],this.map?.getView().getProjection());return s.setGeometry(new _a(_e)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s)}let[,P,,z,F,,N]=SE.exec(n)||[];if(F&&z){let V=co([parseFloat(F),parseFloat(z)],this.map?.getView().getProjection());return s.set("viaPointTrack",N),s.setGeometry(new _a(V)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s)}return P?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${P}&limit=1`,{signal:r.signal}).then(V=>V.json()).then(V=>{let{coordinates:me}=V.features[0].geometry;return this.cacheStationData[n]=co(me),s.set("viaPointTrack",N),s.setGeometry(new _a(co(me))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(V=>(this.dispatchEvent(new sn("error")),this.onRouteError(V,this),this.loading=!1,null)):Promise.resolve(null)}onMapClick(n){let r=n.target.getFeaturesAtPixel(n.pixel).find(s=>s.getGeometry()?.getType()===Mt.POINT&&s.get("viaPointIdx")!==void 0);if(r){this.removeViaPoint(r.get("viaPointIdx"));return}this.addViaPoint(n.coordinate)}onModifyStart(n){let u=-1,r=n.features.getArray().find(P=>P.getGeometry()?.getType()===Mt.LINE_STRING);if(r&&r.getGeometry()&&n.mapBrowserEvent.coordinate){let P=yl(new _a(r.getGeometry()?.getClosestPoint(n.mapBrowserEvent.coordinate)).getExtent(),.001);u=this.segments.findIndex(z=>z.getGeometry()?.intersectsExtent(P))}let s=(n.features.getArray().filter(P=>P.getGeometry()?.getType()===Mt.POINT)||[])[0];this.initialRouteDrag={viaPoint:s,oldRoute:r&&r.clone(),segmentIndex:u}}onModifyEnd(n){let u=n.mapBrowserEvent.coordinate,{oldRoute:r,viaPoint:s,segmentIndex:P}=this.initialRouteDrag||{};return s?this.addViaPoint(u,s.get("viaPointIdx"),1):r?P===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(u,(P||0)+1):this.addViaPoint(u,0,1)}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 E_({source:this.routingLayer?.olLayer?.getSource()||void 0,pixelTolerance:4,hitDetection:this.routingLayer?.olLayer,deleteCondition:n=>{let r=n.target.getFeaturesAtPixel(n.pixel,{hitTolerance:5}).find(s=>s.getGeometry()?.getType()===Mt.POINT&&s.get("index"));return A0(n)&&r?(this.removeViaPoint(r.get("index")),!0):!1}}),this.modifyInteraction.on("modifystart",this.onModifyStart),this.modifyInteraction.on("modifyend",this.onModifyEnd),this.modifyInteraction.setActive(!1)}addListeners(){!this.modify||(this.removeListeners(),this.onMapClickKey=this.map?.on("singleclick",this.onMapClick))}removeListeners(){this.onMapClickKey&&Ha(this.onMapClickKey)}activate(){super.activate(),this.map&&(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.graphsResolutions=Sd.getGraphsResolutions(this.graphs,this.map),this.modifyInteraction&&this.map.removeInteraction(this.modifyInteraction),this.routingLayer?.attachToMap(this.map),this.modifyInteraction&&this.map.addInteraction(this.modifyInteraction),this.modifyInteraction?.setActive(this.modify),this.addListeners())}deactivate(){this.map&&(this.routingLayer?.detachFromMap(),this.modifyInteraction&&this.map.removeInteraction(this.modifyInteraction),this.removeListeners(),this.reset())}render(){}},H0=Sd;var P_=class extends af{constructor(n){super(n);let{apiParams:u,apiKey:r,url:s,placeholder:P}=n||{};this.apiParams={limit:20,...u||{}},this.placeholder=P||"Search for a stop...";let z={apiKey:r};s&&(z.url=s),this.api=new Xf(z),this.abortController=new AbortController}deactivate(){}render(n){let u=n?.features||[];!this.suggestionsElt||(this.suggestionsElt.style.display=u.length?"block":"none",this.suggestionsElt.innerHTML="",u.forEach(r=>{let s=document.createElement("div");s.innerHTML=r?.properties?.name,s.onclick=()=>{this.onSuggestionClick(r)},Object.assign(s.style,{padding:"5px 12px"}),this.suggestionsElt?.appendChild(s)}))}createDefaultElement(){this.element=document.createElement("div"),this.element.id="mbt-search",Object.assign(this.element.style,{position:"absolute",top:0,left:"50px",margin:"10px",display:"flex",flexDirection:"column",width:"320px"}),this.inputElt=document.createElement("input"),this.inputElt.type="text",this.inputElt.placeholder=this.placeholder,this.inputElt.autocomplete="off",this.inputElt.onkeyup=n=>{this.abortController?.abort(),this.abortController=new AbortController,this.search(n.target.value,this.abortController)},Object.assign(this.inputElt.style,{padding:"10px 30px 10px 10px"}),this.element.appendChild(this.inputElt),this.suggestionsElt=document.createElement("div"),Object.assign(this.suggestionsElt.style,{backgroundColor:"white",overflowY:"auto",cursor:"pointer"}),this.element.appendChild(this.suggestionsElt),this.clearElt=document.createElement("div"),Object.assign(this.clearElt.style,{display:"none",position:"absolute",right:"0",padding:"0 10px",fontSize:"200%",cursor:"pointer"}),this.clearElt.innerHTML="\xD7",this.clearElt.onclick=()=>this.clear(),this.element.appendChild(this.clearElt)}search(n,u){return(n!==void 0||n!==null)&&(this.apiParams.q=n),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,u&&{signal:u.signal}).then(r=>{this.render(r)}).catch(()=>{this.render()})}onSuggestionClick(n){}clear(){!this.suggestionsElt||!this.inputElt||!this.clearElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}},Y0=P_;var M_=class extends Y0{onSuggestionClick(h){let n=co(h.geometry.coordinates);this.map.getView().setCenter(n)}},J0=M_;var e1=Gp(Q0());var R_=class extends Is{constructor(n){super(n);this.olLayer=new Hh({source:new cf({}),render:this.getOlLayerRender()}),this.styleUrl=n.url,this.apiKey=n.apiKey,this.apiKeyName=n.apiKeyName||"key",this.updateAttribution=this.updateAttribution.bind(this)}attachToMap(n){super.attachToMap(n),this.map&&(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.loadMbMap())}detachFromMap(){this.mbMap&&(this.mbMap.off("idle",this.updateAttribution),this.mbMap.triggerRepaint=()=>{},this.mbMap.remove(),this.mbMap=void 0),this.loaded=!1,super.detachFromMap()}loadMbMap(){if(this.olListenersKeys.push(this.map?.on("change:target",()=>{this.loadMbMap()})),!this.map?.getTargetElement())return;if(!this.visible){this.olListenersKeys.push(this.once("change:visible",()=>{this.loadMbMap()}));return}let n=document.createElement("div");if(n.style.position="absolute",n.style.width="100%",n.style.height="100%",!this.styleUrl){console.error(`No styleUrl defined for mapbox layer: ${this.styleUrl}`);return}!this.apiKey&&!this.styleUrl?.includes(this.apiKeyName)&&console.error(`No apiKey defined for mapbox layer with style url to ${this.styleUrl}`);let u=this.getMapboxMapClass();this.mbMap=new u({style:Zh(this.styleUrl,{[this.apiKeyName]:this.apiKey}).toString(),container:n,interactive:!1,trackResize:!1,attributionControl:!1,...this.options.mapOptions||{}}),this.mbMap.once("load",()=>{this.loaded=!0,this.dispatchEvent(new sn("load"))}),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(n){let u=oc(n.target)||[];this.copyrights?.toString()!==u.toString()&&(this.copyrights=u,this.olLayer?.getSource()?.setAttributions(u))}getFeatureInfoAtCoordinate(n,u){if(!u||!this.format||!this.mbMap||!this.mbMap.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=n&&this.mbMap.project(lh(n)),s;if(this.hitTolerance){let{x:z,y:F}=r;s=[{x:z-this.hitTolerance,y:F-this.hitTolerance},{x:z+this.hitTolerance,y:F+this.hitTolerance}]}let P=this.mbMap.queryRenderedFeatures(s||r,u).map(z=>{let F=this.format.readFeature(z);return F&&F.set("mapboxFeature",z),F});return Promise.resolve({layer:this,features:P,coordinate:n})}getOlLayerRender(){console.error("This function must be implemented in subclasses");let n=document.createElement("div");return()=>n}getMapboxMapClass(){return console.error("This function must be implemented in subclasses"),null}},fg=R_;var np=class extends fg{attachToMap(n){super.attachToMap(n),this.map&&this.olListenersKeys.push(this.map.on("change:size",()=>{try{this.mbMap&&this.mbMap.resize()}catch(u){console.warn(u)}}))}loadMbMap(){let[n,u]=this.map?.getView().getCenter()||[];if((!n||!u)&&(n=0,u=0),this.renderState={center:[n,u],zoom:void 0,rotation:void 0,visible:void 0,opacity:void 0,size:[0,0]},super.loadMbMap(),!this.mbMap)return;this.mbMap.once("load",()=>{!this.mbMap||(this.mbMap.resize(),this.copyrights=oc(this.mbMap)||[],this.olLayer?.getSource()?.setAttributions(this.copyrights))});let r=this.mbMap.getCanvas();r&&(this.options.tabIndex?r.setAttribute("tabindex",`${this.options.tabIndex}`):r.removeAttribute("tabindex"))}getOlLayerRender(){return tf(this)}getMapboxMapClass(){return e1.Map}clone(n){return new np({...this.options,...n})}};var i1=Gp(r1());var op=class extends fg{getOlLayerRender(){return ef(this)}getMapboxMapClass(){return i1.Map}clone(n){return new op({...this.options,...n})}};var Id=class extends Is{constructor(n){super(n);this.mapboxLayer=n.mapboxLayer,this.disabled=!1,this.styleLayersFilter=n.styleLayersFilter,this.beforeId=n.beforeId,this.featureInfoFilter=n.featureInfoFilter||(u=>u),this.queryRenderedLayersFilter=n.queryRenderedLayersFilter,this.highlightedFeatures=[],this.selectedFeatures=[],this.styleLayers=(n.styleLayer?[n.styleLayer]:n.styleLayers)||[],this.addStyleLayers=this.addStyleLayers.bind(this),this.onLoad=this.onLoad.bind(this),n.filters&&(this.addDynamicFilters=()=>{this.setFilter(typeof n.filters=="function"?n.filters(this):n.filters)}),!this.styleLayersFilter&&this.styleLayers&&(this.styleLayersFilter=u=>!!this.styleLayers?.find(r=>u.id===r.id))}attachToMap(n){if(this.mapboxLayer&&!this.mapboxLayer.map&&this.mapboxLayer?.attachToMap(n),super.attachToMap(n),!this.map||!this.mapboxLayer)return;let{mbMap:u}=this.mapboxLayer;if(!u){this.olListenersKeys.push(this.map.on("change:target",()=>{this.attachToMap(n)}));return}this.mapboxLayer.loaded||u.isStyleLoaded()||u.loaded()?this.onLoad():u.once("load",this.onLoad),this.olListenersKeys.push(this.on("change:visible",r=>{this.applyLayoutVisibility(r)})),this.olListenersKeys.push(this.mapboxLayer.on("load",()=>{this.onLoad()}))}detachFromMap(){if(this.mapboxLayer?.mbMap){let{mbMap:n}=this.mapboxLayer;n.off("load",this.onLoad),this.removeStyleLayers()}super.detachFromMap()}addStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r,source:s}=u;n.getSource(s)&&r&&!n.getLayer(r)&&n.addLayer(u,this.beforeId)}),this.applyLayoutVisibility()}removeStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r}=u;r&&n.getLayer(r)&&n.removeLayer(r)})}onLoad(){if(this.addStyleLayers(),this.addDynamicFilters&&this.addDynamicFilters(),!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer,u=n.getStyle();if(u&&this.styleLayersFilter){let r=u.layers.filter(this.styleLayersFilter);this.disabled=!r.length}}getFeatureInfoAtCoordinate(n){if(!this.mapboxLayer?.mbMap)return Promise.resolve({coordinate:n,features:[],layer:this});let{mbMap:u}=this.mapboxLayer;if(!u.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=this.styleLayers||[];return this.styleLayersFilter&&(r=u.getStyle().layers.filter(this.styleLayersFilter)),this.queryRenderedLayersFilter&&(r=u.getStyle().layers.filter(this.queryRenderedLayersFilter)),this.mapboxLayer.getFeatureInfoAtCoordinate(n,{layers:r.map(s=>s&&s.id),validate:!1}).then(s=>{let P=s.features.filter(z=>this.featureInfoFilter(z,this.map?.getView().getResolution()));return this.highlight(P),{...s,features:P,layer:this}})}setFilter(n){if(!this.mapboxLayer?.mbMap)return;let{mbMap:u}=this.mapboxLayer;this.styleLayers.forEach(({id:r})=>{r&&n&&u.getLayer(r)&&u.setFilter(r,n)})}setHoverState(n,u){if(!this.mapboxLayer?.mbMap)return;let{mbMap:r}=this.mapboxLayer;!n||!r||n.forEach(s=>{let{source:P,sourceLayer:z}=s.get("mapboxFeature")||{};if(!P&&!z||!s.getId()){s.getId()||console.warn("No feature's id found. To use the feature state functionnality, tiles must be generated with --generate-ids. See https://github.com/mapbox/tippecanoe#adding-calculated-attributes.",s.getId(),s.getProperties());return}r.setFeatureState({id:s.getId(),source:P,sourceLayer:z},{hover:u})})}select(n=[]){this.setHoverState(this.selectedFeatures||[],!1),this.selectedFeatures=n,this.setHoverState(this.selectedFeatures||[],!0)}highlight(n=[]){let u=this.highlightedFeatures?.filter(r=>!(this.selectedFeatures||[]).map(s=>s.getId()).includes(r.getId()))||[];this.setHoverState(u,!1),this.highlightedFeatures=n,this.setHoverState(this.highlightedFeatures,!0)}applyLayoutVisibility(n){let{visible:u}=this,r=this.styleLayersFilter;if(!this.mapboxLayer?.mbMap)return;let{mbMap:s}=this.mapboxLayer,P=s.getStyle();if(!!P&&r){let z=u?"visible":"none";for(let F=0;F<P.layers.length;F+=1){let N=P.layers[F];r(N)&&s.getLayer(N.id)&&s.setLayoutProperty(N.id,"visibility",z)}}}clone(n){return new Id({...this.options,...n})}},n1=Id;var U_=Gp(l1()),N_=Gp(f1());function aT(y){return class extends y{constructor(u){super({hitTolerance:10,...u});this.debug=u.debug||!1,this.mode=u.mode||ia.TOPOGRAPHIC,this.api=u.api||new $f(u),this.tenant=u.tenant||"",this.minZoomInterpolation=u.minZoomInterpolation||8,this.format=new bl;let r=["tram","subway","rail","bus","ferry","cablecar","gondola","funicular","coach"];this.motsByZoom=u.motsByZoom||[r],this.getMotsByZoom=s=>u.getMotsByZoom&&u.getMotsByZoom(s,this.motsByZoom)||this.motsByZoom[s]||this.motsByZoom[this.motsByZoom.length-1],this.generalizationLevelByZoom=u.generalizationLevelByZoom||[5,5,5,5,5,5,5,5,10,30,30,100,100,100],this.getGeneralizationLevelByZoom=s=>u.getGeneralizationLevelByZoom&&u.getGeneralizationLevelByZoom(s,this.generalizationLevelByZoom)||this.generalizationLevelByZoom[s],this.renderTimeIntervalByZoom=u.renderTimeIntervalByZoom||[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],this.getRenderTimeIntervalByZoom=s=>u.getRenderTimeIntervalByZoom&&u.getRenderTimeIntervalByZoom(s,this.renderTimeIntervalByZoom)||this.renderTimeIntervalByZoom[s],this.isUpdateBboxOnMoveEnd=u.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,N_.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,U_.default)(this.renderTrajectoriesInternal,50,{leading:!0,trailing:!0,maxWait:5e3}),this.onFeatureHover=this.onFeatureHover.bind(this),this.onFeatureClick=this.onFeatureClick.bind(this),this.renderTrajectoriesInternal=this.renderTrajectoriesInternal.bind(this),this.onTrajectoryMessage=this.onTrajectoryMessage.bind(this),this.onDeleteTrajectoryMessage=this.onDeleteTrajectoryMessage.bind(this),this.onDocumentVisibilityChange=this.onDocumentVisibilityChange.bind(this)}defineProperties(u){let{style:r,speed:s,pixelRatio:P,hoverVehicleId:z,selectedVehicleId:F,filter:N,sort:V,time:me,live:_e,canvas:Se,styleOptions:Ue}=u,He=s||1,Ie=me||new Date;super.defineProperties(u),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{value:Se||document.createElement("canvas")},style:{value:r||Kh},styleOptions:{value:{...rf,...Ue||{}}},speed:{get:()=>He,set:Ge=>{He=Ge,this.start()}},filter:{value:N,writable:!0},sort:{value:V,writable:!0},live:{value:_e===!1?_e:!0,writable:!0},time:{get:()=>Ie,set:Ge=>{Ie=Ge&&Ge.getTime?Ge:new Date(Ge),this.renderTrajectories()}},trajectories:{value:{},writable:!0},hoverVehicleId:{value:z,writable:!0},selectedVehicleId:{value:F,writable:!0},pixelRatio:{value:P||(typeof window<"u"?window.devicePixelRatio:1),writable:!0},useRequestAnimationFrame:{value:u.useRequestAnimationFrame||!1,writable:!0},useThrottle:{value:u.useThrottle!==!1,writable:!0},useDebounce:{value:u.useDebounce||!1,writable:!0}})}attachToMap(u){super.attachToMap(u),this.visible&&this.start(),this.visibilityRef=this.on("change:visible",r=>{r.target.visible?this.start():this.stop()}),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),Ha(this.visibilityRef),this.canvas&&(this.canvas.getContext("2d")?.clearRect(0,0,this.canvas.width,this.canvas.height),super.detachFromMap())}start(){this.stop(),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()}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()}stopUpdateTime(){this.updateTimeInterval&&(clearInterval(this.updateTimeInterval),this.updateTimeInterval=void 0)}renderTrajectoriesInternal(u,r=!1){if(!this.map||!this.trajectories)return!1;let s=this.live?Date.now():this.time?.getTime(),P=Object.values(this.trajectories);return this.sort&&P.sort(this.sort),!this.canvas||!this.style||(this.renderState=Hf(this.canvas,P,this.style,{...u,pixelRatio:this.pixelRatio||1,time:s},{filter:this.filter,noInterpolate:(u.zoom||0)<this.minZoomInterpolation?!0:r,hoverVehicleId:this.hoverVehicleId,selectedVehicleId:this.selectedVehicleId,...this.styleOptions})),!0}renderTrajectories(u,r){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=void 0),u&&(!r&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(u,r)}):!r&&this.useDebounce?this.debounceRenderTrajectories(u,r):!r&&this.useThrottle?this.throttleRenderTrajectories(u,r):this.renderTrajectoriesInternal(u,r))}setBbox(u,r){if(this.trajectories&&u&&r){let P=Object.keys(this.trajectories);for(let z=P.length-1;z>=0;z-=1)this.purgeTrajectory(this.trajectories[P[z]],u,r)}if(!u)return;let s=[...u];this.isUpdateBboxOnMoveEnd&&r&&(s.push(r),this.tenant&&s.push(`tenant=${this.tenant}`),this.generalizationLevel=this.getGeneralizationLevelByZoom(r),this.generalizationLevel&&s.push(`gen=${this.generalizationLevel}`),this.mots=this.getMotsByZoom(r),this.mots&&s.push(`mots=${this.mots}`)),this.api.bbox=s}setMode(u){this.mode!==u&&(this.mode=u,this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd))}getRefreshTimeInMs(u=0){let r=u!==void 0?Math.round(u):-1,s=this.getRenderTimeIntervalByZoom(r)||25,P=Math.max(25,s/(this.speed||1)),z=Math.min(P,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,N_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,U_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0,maxWait:5e3})),this.api?.buffer){let[,F]=this.api.buffer;this.api.buffer=[z,F]}return P}getVehicle(u){return this.trajectories&&Object.values(this.trajectories).filter(u)||[]}getFeatureInfoAtCoordinate(u,r){let{resolution:s,nb:P}=r,z=yl([...u,...u],this.hitTolerance*s),F=Object.values(this.trajectories||{});this.sort&&(F=F.sort(this.sort));let N=[];for(let V=0;V<F.length&&(F[V].properties.coordinate&&Kp(z,F[V].properties.coordinate)&&N.push(F[V]),N.length!==P);V+=1);return Promise.resolve({layer:this,features:N.map(V=>this.format.readFeature(V)),coordinate:u})}getTrajectoryInfos(u){let r=[this.api.getStopSequence(u),this.api.getFullTrajectory(u,this.mode,this.generalizationLevel)];return Promise.all(r).then(([s,P])=>({stopSequence:s,fullTrajectory:P}))}purgeTrajectory(u,r,s){let{type:P,bounds:z}=u.properties;return!Lo(r,z)||!this.mots?.includes(P)||P!=="rail"&&s<9?(this.removeTrajectory(u),!0):!1}addTrajectory(u){this.filter&&!this.filter(u)||(this.trajectories||(this.trajectories={}),this.trajectories[u.properties.train_id]=u,this.renderTrajectories())}removeTrajectory(u){let r;typeof u!="string"?r=u?.properties?.train_id:r=u,this.trajectories&&delete this.trajectories[r]}onZoomEnd(){this.startUpdateTime()}onDocumentVisibilityChange(){!this.visible||(document.hidden?this.stop():this.start())}onTrajectoryMessage(u){if(!u.content)return;let r=u.content,{geometry:s,properties:{train_id:P,time_since_update:z,raw_coordinates:F}}=r;z<0||this.purgeTrajectory(r)||(this.debug&&this.mode===ia.TOPOGRAPHIC&&F?r.properties.olGeometry={type:"Point",coordinates:co(F,this.map.getView().getProjection())}:r.properties.olGeometry=this.format.readGeometry(s),r.properties.timeOffset=Date.now()-u.timestamp,this.addTrajectory(r))}onDeleteTrajectoryMessage(u){!u.content||this.removeTrajectory(u.content)}onFeatureHover(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.hoverVehicleId!==z&&(this.hoverVehicleId=z,this.renderTrajectories(!0))}onFeatureClick(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.selectedVehicleId!==z&&(this.selectedVehicleId=z,this.selectedVehicle=P,this.renderTrajectories(!0))}}}var mg=aT;var sT=new Wl({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),lT=(y,h,n)=>{let u="#ffffff",r=y.get("type"),s=y.get("stroke");return s&&s[0]!=="#"&&(s=`#${s}`),u=s||n?.getBgColor(r),u=/#ffffff/i.test(u)?"#ff0000":u,[sT,new Wl({zIndex:3,image:new xl({radius:4,fill:new Ks({color:u})}),stroke:new va({color:u,width:4})})]},gg=lT;var uT=new Wl({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),cT=new Wl({zIndex:3,image:new xl({radius:4,fill:new Ks({color:"#a0a0a0"})}),stroke:new va({color:"#a0a0a0",width:4})}),hT=()=>[uT,cT],d1=hT;var pT=new bl,Cd=class extends mg(Is){constructor(h){super({...h}),this.olLayer=h.olLayer||new v_({layers:[new tp({source:new rp({features:[]}),style:(n,u)=>(h.fullTrajectoryStyle||gg)(n,u,this.styleOptions)}),new Hh({source:new cf({}),render:n=>{if(this.container||(this.container=document.createElement("div"),this.container.style.position="absolute",this.container.style.width="100%",this.container.style.height="100%",this.transformContainer=document.createElement("div"),this.transformContainer.style.position="absolute",this.transformContainer.style.width="100%",this.transformContainer.style.height="100%",this.container.appendChild(this.transformContainer),this.canvas&&(this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0",this.canvas.style.transformOrigin="top left",this.transformContainer.appendChild(this.canvas))),this.renderedViewState){let{center:u,resolution:r,rotation:s}=n.viewState,{center:P,resolution:z,rotation:F}=this.renderedViewState;if(z/r>=3)this.canvas?.getContext("2d")?.clearRect(0,0,this.canvas?.width,this.canvas?.height);else{let N=this.map.getPixelFromCoordinate(P),V=this.map.getPixelFromCoordinate(u);this.transformContainer.style.transform=Lv(N[0]-V[0],N[1]-V[1],z/r,z/r,s-F,0,0)}}return this.container}})]}),this.vectorLayer=this.olLayer.getLayers().item(0),this.renderState={center:[0,0],zoom:void 0,rotation:0}}attachToMap(h){super.attachToMap(h),this.map&&this.olListenersKeys.push(...this.map.on(["moveend","change:target"],n=>{let u=(n.map||n.target).getView();if(u.getAnimating()||u.getInteracting())return;let r=u.getZoom();this.currentZoom!==r&&this.onZoomEnd(),this.currentZoom=r,this.onMoveEnd(n)}))}detachFromMap(){super.detachFromMap(),this.container=null}hasFeatureInfoAtCoordinate(h){if(this.map&&this.canvas){let n=this.canvas.getContext("2d"),u=this.map.getPixelFromCoordinate(h);return!!n?.getImageData(u[0]*(this.pixelRatio||1),u[1]*(this.pixelRatio||1),1,1).data[3]}return!1}renderTrajectories(h){if(!this.map)return;let n=this.map.getView();super.renderTrajectories({size:this.map.getSize(),center:this.map.getView().getCenter(),extent:n.calculateExtent(),resolution:n.getResolution(),rotation:n.getRotation(),zoom:n.getZoom(),pixelRatio:this.pixelRatio},h)}renderTrajectoriesInternal(h,n){if(!this.map)return!1;let u=!1;return u=this.map.getView().getAnimating()||this.map.getView().getInteracting()?!1:super.renderTrajectoriesInternal(h,n),u&&(this.renderedViewState={...h},this.transformContainer&&(this.transformContainer.style.transform="")),u}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getView().getZoom())}getFeatureInfoAtCoordinate(h,n={}){let u=this.map.getView().getResolution();return super.getFeatureInfoAtCoordinate(h,{resolution:u,...n})}onMoveEnd(h){this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.userClickInteractions&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}onZoomEnd(){super.onZoomEnd()}onFeatureHover(h,n,u){super.onFeatureHover(h,n,u),this.map.getTargetElement().style.cursor=h.length?"pointer":"auto"}onFeatureClick(h,n,u){super.onFeatureClick(h,n,u),!h.length&&this.vectorLayer&&this.vectorLayer.getSource().clear(),this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}purgeTrajectory(h,n,u){return super.purgeTrajectory(h,n||this.map.getView().calculateExtent(),u||this.map.getView().getZoom())}setBbox(h,n){let u=h,r=n;!u&&this.isUpdateBboxOnMoveEnd&&(u=h||this.map.getView().calculateExtent(),r=Math.floor(this.map.getView().getZoom())),super.setBbox(u,r)}highlightTrajectory(h){this.api.getFullTrajectory(h,this.mode,this.generalizationLevel).then(n=>{let u=n.content;if(this.vectorLayer.getSource().clear(),!u||!u.features||!u.features.length)return;let r=pT.readFeatures(u);this.vectorLayer.getSource().addFeatures(r)})}clone(h){return new Cd({...this.options,...h})}},m1=Cd;var Ad=class extends Is{getFeatureInfoAtCoordinate(h){let n=[];if(this.map){let u=this.map.getPixelFromCoordinate(h);n=this.map.getFeaturesAtPixel(u,{layerFilter:r=>r===this.olLayer,hitTolerance:this.hitTolerance})}return Promise.resolve({features:n,layer:this,coordinate:h})}clone(h){return new Ad({...this.options,...h})}},g1=Ad;var Pd=class extends Is{constructor(n){super(n);this.abortController=new AbortController,this.format=new bl}getFeatureInfoUrl(n){if(!this.map)return;let u=this.map.getView().getProjection(),r=this.map.getView().getResolution();if(r&&u&&this.olLayer?.getSource()?.getFeatureInfoUrl)return this.olLayer?.getSource()?.getFeatureInfoUrl(n,r,u,{info_format:"application/json",query_layers:this.olLayer?.getSource()?.getParams().layers})}getFeatureInfoAtCoordinate(n){this.abortController?.abort(),this.abortController=new AbortController;let{signal:u}=this.abortController,r=this.getFeatureInfoUrl(n);return r?fetch(r,{signal:u}).then(s=>s.json()).then(s=>s.features).then(s=>({layer:this,coordinate:n,features:s.map(P=>this.format.readFeature(P))})).catch(()=>Promise.resolve({features:[],coordinate:n,layer:this})):(console.error("No url for the WMS layer."),Promise.resolve({features:[],coordinate:n,layer:this}))}clone(n){return new Pd({...this.options,...n})}},y1=Pd;var bg={};oy(bg,{CopyrightControl:()=>_1,Layer:()=>_g,RealtimeAPI:()=>$f,RealtimeLayer:()=>L1,RealtimeModes:()=>ia,RoutingAPI:()=>Zf,StopsAPI:()=>Xf,createRealtimeFilters:()=>cy,debounceDeparturesMessages:()=>Cy,debounceWebsocketMessages:()=>Wf,getCircleCanvas:()=>Dy,getDelayBgCanvas:()=>Ry,getDelayTextCanvas:()=>zy,getHoursAndMinutes:()=>Cv,getLayersAsFlatArray:()=>Kf,getMapboxMapCopyrights:()=>oc,getMapboxRender:()=>tf,getMaplibreRender:()=>ef,getMercatorResolution:()=>xg,getSourceCoordinates:()=>Ld,getTextCanvas:()=>Oy,getUTCDateString:()=>Sv,getUTCTimeString:()=>Iv,getUrlWithParams:()=>Zh,pad:()=>Rm,realtimeConfig:()=>rf,realtimeDefaultStyle:()=>Kh,realtimeDelayStyle:()=>Fy,realtimeSimpleStyle:()=>By,removeDuplicate:()=>Xh,renderTrajectories:()=>Hf,sortAndFilterDepartures:()=>id,sortByDelay:()=>hy});var V_=class extends Zm{constructor(h){super(h),this.render=this.render.bind(this)}activate(){super.activate(),this.map&&(this.map.on("sourcedata",this.render),this.map.on("styledata",this.render),this.map.on("idle",this.render))}deactivate(){this.map&&(this.map.off("sourcedata",this.render),this.map.off("styledata",this.render),this.map.off("idle",this.render)),super.deactivate()}getCopyrights(){return oc(this.map)}},_1=V_;var Md=class extends cg(ip){attachToMap(n){super.attachToMap(n),!!this.map&&this.userInteractions&&(this.toggleVisibleListeners(),this.onChangeVisibleKey=this.on("change:visible",this.toggleVisibleListeners))}detachFromMap(){this.map&&(this.deactivateUserInteractions(),Ha(this.onChangeVisibleKey)),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&this.map.on("click",this.onUserClickCallback),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&this.map.on("mousemove",this.onUserMoveCallback)}deactivateUserInteractions(){this.map&&(this.map.off("mousemove",this.onUserMoveCallback),this.map.off("click",this.onUserClickCallback))}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}getMercatorExtent(){let n=this.map.getBounds().toArray();return td([...n[0],...n[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(n){return new Md({...this.options,...n})}},_g=Md;var jo=63710088e-1,v1={centimeters:jo*100,centimetres:jo*100,degrees:jo/111325,feet:jo*3.28084,inches:jo*39.37,kilometers:jo/1e3,kilometres:jo/1e3,meters:jo,metres:jo,miles:jo/1609.344,millimeters:jo*1e3,millimetres:jo*1e3,nauticalmiles:jo/1852,radians:1,yards:jo*1.0936},k5={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/jo,yards:1.0936133};function x1(y,h,n){n===void 0&&(n={});var u={type:"Feature"};return(n.id===0||n.id)&&(u.id=n.id),n.bbox&&(u.bbox=n.bbox),u.properties=h||{},u.geometry=y,u}function xh(y,h,n){if(n===void 0&&(n={}),!y)throw new Error("coordinates is required");if(!Array.isArray(y))throw new Error("coordinates must be an Array");if(y.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!G_(y[0])||!G_(y[1]))throw new Error("coordinates must contain numbers");var u={type:"Point",coordinates:y};return x1(u,h,n)}function fT(y,h){h===void 0&&(h="kilometers");var n=v1[h];if(!n)throw new Error(h+" units is invalid");return y*n}function dT(y,h){h===void 0&&(h="kilometers");var n=v1[h];if(!n)throw new Error(h+" units is invalid");return y/n}function b1(y){var h=y%(2*Math.PI);return h*180/Math.PI}function ap(y){var h=y%360;return h*Math.PI/180}function vg(y,h,n){if(h===void 0&&(h="kilometers"),n===void 0&&(n="kilometers"),!(y>=0))throw new Error("length must be a positive number");return fT(dT(y,h),n)}function G_(y){return!isNaN(y)&&y!==null&&!Array.isArray(y)}function j_(y){return!!y&&y.constructor===Object}function kd(y,h,n){if(y!==null)for(var u,r,s,P,z,F,N,V=0,me=0,_e,Se=y.type,Ue=Se==="FeatureCollection",He=Se==="Feature",Ie=Ue?y.features.length:1,Ge=0;Ge<Ie;Ge++){N=Ue?y.features[Ge].geometry:He?y.geometry:y,_e=N?N.type==="GeometryCollection":!1,z=_e?N.geometries.length:1;for(var et=0;et<z;et++){var rt=0,_t=0;if(P=_e?N.geometries[et]:N,P!==null){F=P.coordinates;var yt=P.type;switch(V=n&&(yt==="Polygon"||yt==="MultiPolygon")?1:0,yt){case null:break;case"Point":if(h(F,me,Ge,rt,_t)===!1)return!1;me++,rt++;break;case"LineString":case"MultiPoint":for(u=0;u<F.length;u++){if(h(F[u],me,Ge,rt,_t)===!1)return!1;me++,yt==="MultiPoint"&&rt++}yt==="LineString"&&rt++;break;case"Polygon":case"MultiLineString":for(u=0;u<F.length;u++){for(r=0;r<F[u].length-V;r++){if(h(F[u][r],me,Ge,rt,_t)===!1)return!1;me++}yt==="MultiLineString"&&rt++,yt==="Polygon"&&_t++}yt==="Polygon"&&rt++;break;case"MultiPolygon":for(u=0;u<F.length;u++){for(_t=0,r=0;r<F[u].length;r++){for(s=0;s<F[u][r].length-V;s++){if(h(F[u][r][s],me,Ge,rt,_t)===!1)return!1;me++}_t++}rt++}break;case"GeometryCollection":for(u=0;u<P.geometries.length;u++)if(kd(P.geometries[u],h,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function mT(y,h){h===void 0&&(h={});var n=0,u=0,r=0;return kd(y,function(s){n+=s[0],u+=s[1],r++},!0),xh([n/r,u/r],h.properties)}var w1=mT;function Mu(y){if(!y)throw new Error("coord is required");if(!Array.isArray(y)){if(y.type==="Feature"&&y.geometry!==null&&y.geometry.type==="Point")return y.geometry.coordinates;if(y.type==="Point")return y.coordinates}if(Array.isArray(y)&&y.length>=2&&!Array.isArray(y[0])&&!Array.isArray(y[1]))return y;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function E1(y){if(Array.isArray(y))return y;if(y.type==="Feature"){if(y.geometry!==null)return y.geometry.coordinates}else if(y.coordinates)return y.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function gT(y,h,n){n===void 0&&(n={});var u;n.final?u=T1(Mu(h),Mu(y)):u=T1(Mu(y),Mu(h));var r=u>180?-(360-u):u;return r}function T1(y,h){var n=ap(y[1]),u=ap(h[1]),r=ap(h[0]-y[0]);r>Math.PI&&(r-=2*Math.PI),r<-Math.PI&&(r+=2*Math.PI);var s=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)),P=Math.atan2(r,s);return(b1(P)+360)%360}var S1=gT;function yT(y,h,n){n===void 0&&(n={});var u=Mu(y),r=Mu(h);r[0]+=r[0]-u[0]>180?-360:u[0]-r[0]>180?360:0;var s=_T(u,r),P=vg(s,"meters",n.units);return P}function _T(y,h,n){n=n===void 0?jo:Number(n);var u=n,r=y[1]*Math.PI/180,s=h[1]*Math.PI/180,P=s-r,z=Math.abs(h[0]-y[0])*Math.PI/180;z>Math.PI&&(z-=2*Math.PI);var F=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(r/2+Math.PI/4)),N=Math.abs(F)>1e-11?P/F:Math.cos(r),V=Math.sqrt(P*P+N*N*z*z),me=V*u;return me}var I1=yT;function vT(y,h,n,u){u===void 0&&(u={});var r=h<0,s=vg(Math.abs(h),u.units,"meters");r&&(s=-Math.abs(s));var P=Mu(y),z=xT(P,s,n);return z[0]+=z[0]-P[0]>180?-360:P[0]-z[0]>180?360:0,xh(z,u.properties)}function xT(y,h,n,u){u=u===void 0?jo:Number(u);var r=h/u,s=y[0]*Math.PI/180,P=ap(y[1]),z=ap(n),F=r*Math.cos(z),N=P+F;Math.abs(N)>Math.PI/2&&(N=N>0?Math.PI-N:-Math.PI-N);var V=Math.log(Math.tan(N/2+Math.PI/4)/Math.tan(P/2+Math.PI/4)),me=Math.abs(V)>1e-11?F/V:Math.cos(P),_e=r*Math.sin(z)/me,Se=s+_e;return[(Se*180/Math.PI+540)%360-180,N*180/Math.PI]}var C1=vT;function bT(y){if(!y)throw new Error("geojson is required");switch(y.type){case"Feature":return A1(y);case"FeatureCollection":return wT(y);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return q_(y);default:throw new Error("unknown GeoJSON type")}}function A1(y){var h={type:"Feature"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:h[n]=y[n]}}),h.properties=P1(y.properties),h.geometry=q_(y.geometry),h}function P1(y){var h={};return y&&Object.keys(y).forEach(function(n){var u=y[n];typeof u=="object"?u===null?h[n]=null:Array.isArray(u)?h[n]=u.map(function(r){return r}):h[n]=P1(u):h[n]=u}),h}function wT(y){var h={type:"FeatureCollection"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"features":return;default:h[n]=y[n]}}),h.features=y.features.map(function(n){return A1(n)}),h}function q_(y){var h={type:y.type};return y.bbox&&(h.bbox=y.bbox),y.type==="GeometryCollection"?(h.geometries=y.geometries.map(function(n){return q_(n)}),h):(h.coordinates=M1(y.coordinates),h)}function M1(y){var h=y;return typeof h[0]!="object"?h.slice():h.map(function(n){return M1(n)})}var k1=bT;function ET(y,h,n){if(n=n||{},!j_(n))throw new Error("options is invalid");var u=n.pivot,r=n.mutate;if(!y)throw new Error("geojson is required");if(h==null||isNaN(h))throw new Error("angle is required");return h===0||(u||(u=w1(y)),(r===!1||r===void 0)&&(y=k1(y)),kd(y,function(s){var P=S1(u,s),z=P+h,F=I1(u,s),N=E1(C1(u,F,z));s[0]=N[0],s[1]=N[1]})),y}var Z_=ET;var TT=(y,h=1)=>{let{width:n,height:u}=y.getCanvas(),r=y.unproject({x:0,y:0}),s=y.unproject({x:0,y:u/h}),P=y.unproject({x:n/h,y:u/h}),z=y.unproject({x:n/h,y:0});return[[r.lng,r.lat],[z.lng,z.lat],[P.lng,P.lat],[s.lng,s.lat]]},Ld=TT;var ST=y=>{let h=y.getBounds().toArray(),n=co(h[0]),u=co(h[1]),r=[...n,...u],{width:s,height:P}=y.getCanvas(),z=bs(r)/s,F=Eu(r)/P;return Math.max(z,F)},xg=ST;var X_=class extends mg(_g){constructor(h={}){super({...h}),this.onLoad=this.onLoad.bind(this),this.onMove=this.onMove.bind(this),this.onMoveEnd=this.onMoveEnd.bind(this),this.onZoomEnd=this.onZoomEnd.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this)}attachToMap(h,n){!h||(super.attachToMap(h),this.source={type:"canvas",canvas:this.canvas,coordinates:Ld(h,this.pixelRatio),animate:!0,attribution:this.copyrights&&this.copyrights.join(", ")},this.beforeId=n,this.layer={id:this.key,type:"raster",source:this.key,layout:{visibility:this.visible?"visible":"none"},paint:{"raster-opacity":1,"raster-fade-duration":0,"raster-resampling":"nearest"}},h.isStyleLoaded()&&this.onLoad(),this.map.on("load",this.onLoad),this.listeners=[this.on("change:visible",this.onVisibilityChange)])}detachFromMap(){this.map&&(this.map.off("load",this.onLoad),this.listeners.forEach(h=>{Ha(h)}),this.map.style&&this.map.getLayer(this.key)&&this.map.removeLayer(this.key),this.map.style&&this.map.getSource(this.key)&&this.map.removeSource(this.key)),super.detachFromMap()}start(){super.start(),this.map.on("move",this.onMove),this.map.on("moveend",this.onMoveEnd),this.map.on("zoomend",this.onZoomEnd)}stop(){super.stop(),this.map&&(this.map.off("move",this.onMove),this.map.off("moveend",this.onMoveEnd),this.map.off("zoomend",this.onZoomEnd))}onLoad(){this.map.getSource(this.key)||this.map.addSource(this.key,this.source),this.map.getLayer(this.key)||this.map.addLayer(this.layer,this.beforeId)}onUserMoveCallback(h){super.onUserMoveCallback({coordinate:co(h.lngLat.toArray()),...h})}renderTrajectories(h=!1){if(!this.map)return;this.pixelRatio||(this.pixelRatio=1);let{width:n,height:u}=this.map.getCanvas(),r=this.map.getCenter(),s=this.map.unproject({x:0,y:u/this.pixelRatio}),P=this.map.unproject({x:n/this.pixelRatio,y:0}),z=Z_(xh([s.lng,s.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,F=Z_(xh([P.lng,P.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,N=[...co(z),...co(F)],V=bs(N)/(n/this.pixelRatio),me=Eu(N)/(u/this.pixelRatio),_e=Math.max(V,me),Se={size:[n/this.pixelRatio,u/this.pixelRatio],center:co([r.lng,r.lat]),extent:N,resolution:_e,zoom:this.map.getZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(Se,h)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(h,n={}){let u=xg(this.map);return super.getFeatureInfoAtCoordinate(h,{resolution:u,...n})}onVisibilityChange(){this.visible&&!this.map.getLayer(this.key)?this.map.addLayer(this.layer,this.beforeId):this.map.getLayer(this.key)&&this.map.removeLayer(this.key)}purgeTrajectory(h,n,u){return super.purgeTrajectory(h,n||this.getMercatorExtent(),u||Math.floor(this.map.getZoom()+1))}setBbox(h,n){let u=h,r=n;!u&&this.isUpdateBboxOnMoveEnd&&(u=h||this.getMercatorExtent(),r=Math.floor(this.getOlZoom())),super.setBbox(u,r)}onMove(){this.renderTrajectories()}renderTrajectoriesInternal(h,n=!1){let u=super.renderTrajectoriesInternal(h,n);if(u&&this.map.style){let r=Ld(this.map,this.pixelRatio),s=this.map.getSource(this.key);s&&s.setCoordinates(r)}return u}onMoveEnd(){this.renderTrajectories(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox()}onFeatureHover(h,n,u){super.onFeatureHover(h,n,u),this.map.getCanvasContainer().style.cursor=h.length?"pointer":"auto"}},L1=X_;var W_={ol:yg,mapbox:bg};typeof window<"u"&&(window.mbt=W_);var L3=W_;})();
|
|
1083
1083
|
//# sourceMappingURL=mbt.min.js.map
|