mobility-toolbox-js 2.0.0-beta.37 → 2.0.0-beta.38

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/mbt.min.js CHANGED
@@ -1004,5 +1004,5 @@ uniform ${et} ${ut} u_${vt};
1004
1004
  `||U===N){u=Math.max(u,P),i.push(P),P=0,D+=F;continue}var yt=l[U+1]||v.font,Tt=Um(yt,at);o.push(Tt),P+=Tt;var Lt=vw(yt);c.push(Lt),F=Math.max(F,Lt)}return{width:u,height:D,widths:o,heights:c,lineWidths:i}}function Rx(v,l,o,c,i,u,P,D,F,U,N){v.save(),o!==1&&(v.globalAlpha*=o),l&&v.setTransform.apply(v,l),c.contextInstructions?(v.translate(F,U),v.scale(N[0],N[1]),xw(c,v)):N[0]<0||N[1]<0?(v.translate(F,U),v.scale(N[0],N[1]),v.drawImage(c,i,u,P,D,0,0,P,D)):v.drawImage(c,i,u,P,D,F,U,P*N[0],D*N[1]),v.restore()}function xw(v,l){for(var o=v.contextInstructions,c=0,i=o.length;c<i;c+=2)Array.isArray(o[c+1])?l[o[c]].apply(l,o[c+1]):l[o[c]]=o[c+1]}var bw=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),ww=function(v){bw(l,v);function l(o){var c=this,i=o.rotateWithView!==void 0?o.rotateWithView:!1;return c=v.call(this,{opacity:1,rotateWithView:i,rotation:o.rotation!==void 0?o.rotation:0,scale:o.scale!==void 0?o.scale:1,displacement:o.displacement!==void 0?o.displacement:[0,0]})||this,c.canvas_=void 0,c.hitDetectionCanvas_=null,c.fill_=o.fill!==void 0?o.fill:null,c.origin_=[0,0],c.points_=o.points,c.radius_=o.radius!==void 0?o.radius:o.radius1,c.radius2_=o.radius2,c.angle_=o.angle!==void 0?o.angle:0,c.stroke_=o.stroke!==void 0?o.stroke:null,c.size_=null,c.renderOptions_=null,c.render(),c}return l.prototype.clone=function(){var o=this.getScale(),c=new l({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(o)?o.slice():o,displacement:this.getDisplacement().slice()});return c.setOpacity(this.getOpacity()),c},l.prototype.getAnchor=function(){var o=this.size_;if(!o)return null;var c=this.getDisplacement();return[o[0]/2-c[0],o[1]/2+c[1]]},l.prototype.getAngle=function(){return this.angle_},l.prototype.getFill=function(){return this.fill_},l.prototype.getHitDetectionImage=function(){return this.hitDetectionCanvas_||this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_},l.prototype.getImage=function(o){var c=this.canvas_[o];if(!c){var i=this.renderOptions_,u=Ga(i.size*o,i.size*o);this.draw_(i,u,o),c=u.canvas,this.canvas_[o]=c}return c},l.prototype.getPixelRatio=function(o){return o},l.prototype.getImageSize=function(){return this.size_},l.prototype.getImageState=function(){return zi.LOADED},l.prototype.getOrigin=function(){return this.origin_},l.prototype.getPoints=function(){return this.points_},l.prototype.getRadius=function(){return this.radius_},l.prototype.getRadius2=function(){return this.radius2_},l.prototype.getSize=function(){return this.size_},l.prototype.getStroke=function(){return this.stroke_},l.prototype.listenImageChange=function(o){},l.prototype.load=function(){},l.prototype.unlistenImageChange=function(o){},l.prototype.calculateLineJoinSize_=function(o,c,i){if(c===0||this.points_===1/0||o!=="bevel"&&o!=="miter")return c;var u=this.radius_,P=this.radius2_===void 0?u:this.radius2_;if(u<P){var D=u;u=P,P=D}var F=this.radius2_===void 0?this.points_:this.points_*2,U=2*Math.PI/F,N=P*Math.sin(U),at=Math.sqrt(P*P-N*N),yt=u-at,Tt=Math.sqrt(N*N+yt*yt),Lt=Tt/N;if(o==="miter"&&Lt<=i)return Lt*c;var Vt=c/2/Lt,wt=c/2*(yt/Tt),kt=Math.sqrt((u+Vt)*(u+Vt)+wt*wt),Zt=kt-u;if(this.radius2_===void 0||o==="bevel")return Zt*2;var Yt=u*Math.sin(U),le=Math.sqrt(u*u-Yt*Yt),ue=P-le,oe=Math.sqrt(Yt*Yt+ue*ue),ge=oe/Yt;if(ge<=i){var we=ge*c/2-P-u;return 2*Math.max(Zt,we)}return Zt*2},l.prototype.createRenderOptions=function(){var o=Lu,c=0,i=null,u=0,P,D=0;this.stroke_&&(P=this.stroke_.getColor(),P===null&&(P=bc),P=ds(P),D=this.stroke_.getWidth(),D===void 0&&(D=Ec),i=this.stroke_.getLineDash(),u=this.stroke_.getLineDashOffset(),o=this.stroke_.getLineJoin(),o===void 0&&(o=Lu),c=this.stroke_.getMiterLimit(),c===void 0&&(c=xc));var F=this.calculateLineJoinSize_(o,D,c),U=Math.max(this.radius_,this.radius2_||0),N=Math.ceil(2*U+F);return{strokeStyle:P,strokeWidth:D,size:N,lineDash:i,lineDashOffset:u,lineJoin:o,miterLimit:c}},l.prototype.render=function(){this.renderOptions_=this.createRenderOptions();var o=this.renderOptions_.size;this.canvas_={},this.size_=[o,o]},l.prototype.draw_=function(o,c,i){if(c.scale(i,i),c.translate(o.size/2,o.size/2),this.createPath_(c),this.fill_){var u=this.fill_.getColor();u===null&&(u=ms),c.fillStyle=ds(u),c.fill()}this.stroke_&&(c.strokeStyle=o.strokeStyle,c.lineWidth=o.strokeWidth,c.setLineDash&&o.lineDash&&(c.setLineDash(o.lineDash),c.lineDashOffset=o.lineDashOffset),c.lineJoin=o.lineJoin,c.miterLimit=o.miterLimit,c.stroke())},l.prototype.createHitDetectionCanvas_=function(o){if(this.fill_){var c=this.fill_.getColor(),i=0;if(typeof c=="string"&&(c=ep(c)),c===null?i=1:Array.isArray(c)&&(i=c.length===4?c[3]:1),i===0){var u=Ga(o.size,o.size);this.hitDetectionCanvas_=u.canvas,this.drawHitDetectionCanvas_(o,u)}}this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.getImage(1))},l.prototype.createPath_=function(o){var c=this.points_,i=this.radius_;if(c===1/0)o.arc(0,0,i,0,2*Math.PI);else{var u=this.radius2_===void 0?i:this.radius2_;this.radius2_!==void 0&&(c*=2);for(var P=this.angle_-Math.PI/2,D=2*Math.PI/c,F=0;F<c;F++){var U=P+F*D,N=F%2===0?i:u;o.lineTo(N*Math.cos(U),N*Math.sin(U))}o.closePath()}},l.prototype.drawHitDetectionCanvas_=function(o,c){c.translate(o.size/2,o.size/2),this.createPath_(c),c.fillStyle=ms,c.fill(),this.stroke_&&(c.strokeStyle=o.strokeStyle,c.lineWidth=o.strokeWidth,o.lineDash&&(c.setLineDash(o.lineDash),c.lineDashOffset=o.lineDashOffset),c.lineJoin=o.lineJoin,c.miterLimit=o.miterLimit,c.stroke())},l}(Fm),Dx=ww;var Ew=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),Sw=function(v){Ew(l,v);function l(o){var c=o||{};return v.call(this,{points:1/0,fill:c.fill,radius:c.radius,stroke:c.stroke,scale:c.scale!==void 0?c.scale:1,rotation:c.rotation!==void 0?c.rotation:0,rotateWithView:c.rotateWithView!==void 0?c.rotateWithView:!1,displacement:c.displacement!==void 0?c.displacement:[0,0]})||this}return l.prototype.clone=function(){var o=this.getScale(),c=new l({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(o)?o.slice():o,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()});return c.setOpacity(this.getOpacity()),c},l.prototype.setRadius=function(o){this.radius_=o,this.render()},l}(Dx),ol=Sw;var ef=function(){function v(l){var o=l||{};this.geometry_=null,this.geometryFunction_=Ox,o.geometry!==void 0&&this.setGeometry(o.geometry),this.fill_=o.fill!==void 0?o.fill:null,this.image_=o.image!==void 0?o.image:null,this.renderer_=o.renderer!==void 0?o.renderer:null,this.hitDetectionRenderer_=o.hitDetectionRenderer!==void 0?o.hitDetectionRenderer:null,this.stroke_=o.stroke!==void 0?o.stroke:null,this.text_=o.text!==void 0?o.text:null,this.zIndex_=o.zIndex}return v.prototype.clone=function(){var l=this.getGeometry();return l&&typeof l=="object"&&(l=l.clone()),new v({geometry:l,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()})},v.prototype.getRenderer=function(){return this.renderer_},v.prototype.setRenderer=function(l){this.renderer_=l},v.prototype.setHitDetectionRenderer=function(l){this.hitDetectionRenderer_=l},v.prototype.getHitDetectionRenderer=function(){return this.hitDetectionRenderer_},v.prototype.getGeometry=function(){return this.geometry_},v.prototype.getGeometryFunction=function(){return this.geometryFunction_},v.prototype.getFill=function(){return this.fill_},v.prototype.setFill=function(l){this.fill_=l},v.prototype.getImage=function(){return this.image_},v.prototype.setImage=function(l){this.image_=l},v.prototype.getStroke=function(){return this.stroke_},v.prototype.setStroke=function(l){this.stroke_=l},v.prototype.getText=function(){return this.text_},v.prototype.setText=function(l){this.text_=l},v.prototype.getZIndex=function(){return this.zIndex_},v.prototype.setGeometry=function(l){typeof l=="function"?this.geometryFunction_=l:typeof l=="string"?this.geometryFunction_=function(o){return o.get(l)}:l?l!==void 0&&(this.geometryFunction_=function(){return l}):this.geometryFunction_=Ox,this.geometry_=l},v.prototype.setZIndex=function(l){this.zIndex_=l},v}();function Fx(v){var l;if(typeof v=="function")l=v;else{var o;if(Array.isArray(v))o=v;else{fn(typeof v.getZIndex=="function",41);var c=v;o=[c]}l=function(){return o}}return l}var Ky=null;function Bx(v,l){if(!Ky){var o=new Ds({color:"rgba(255,255,255,0.4)"}),c=new ra({color:"#3399CC",width:1.25});Ky=[new ef({image:new ol({fill:o,stroke:c,radius:5}),fill:o,stroke:c})]}return Ky}function Ux(){var v={},l=[255,255,255,1],o=[0,153,255,1],c=3;return v[Ie.POLYGON]=[new ef({fill:new Ds({color:[255,255,255,.5]})})],v[Ie.MULTI_POLYGON]=v[Ie.POLYGON],v[Ie.LINE_STRING]=[new ef({stroke:new ra({color:l,width:c+2})}),new ef({stroke:new ra({color:o,width:c})})],v[Ie.MULTI_LINE_STRING]=v[Ie.LINE_STRING],v[Ie.CIRCLE]=v[Ie.POLYGON].concat(v[Ie.LINE_STRING]),v[Ie.POINT]=[new ef({image:new ol({radius:c*2,fill:new Ds({color:o}),stroke:new ra({color:l,width:c/2})}),zIndex:1/0})],v[Ie.MULTI_POINT]=v[Ie.POINT],v[Ie.GEOMETRY_COLLECTION]=v[Ie.POLYGON].concat(v[Ie.LINE_STRING],v[Ie.POINT]),v}function Ox(v){return v.getGeometry()}var Wl=ef;var Nx={POINT:"point",LINE:"line"};var Gx=Fp(Jy(),1);var Tw=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),Vx={RENDER_ORDER:"renderOrder"},Iw=function(v){Tw(l,v);function l(o){var c=this,i=o||{},u=_a({},i);return delete u.style,delete u.renderBuffer,delete u.updateWhileAnimating,delete u.updateWhileInteracting,c=v.call(this,u)||this,c.declutter_=i.declutter!==void 0?i.declutter:!1,c.renderBuffer_=i.renderBuffer!==void 0?i.renderBuffer:100,c.style_=null,c.styleFunction_=void 0,c.setStyle(i.style),c.updateWhileAnimating_=i.updateWhileAnimating!==void 0?i.updateWhileAnimating:!1,c.updateWhileInteracting_=i.updateWhileInteracting!==void 0?i.updateWhileInteracting:!1,c}return l.prototype.getDeclutter=function(){return this.declutter_},l.prototype.getFeatures=function(o){return v.prototype.getFeatures.call(this,o)},l.prototype.getRenderBuffer=function(){return this.renderBuffer_},l.prototype.getRenderOrder=function(){return this.get(Vx.RENDER_ORDER)},l.prototype.getStyle=function(){return this.style_},l.prototype.getStyleFunction=function(){return this.styleFunction_},l.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_},l.prototype.getUpdateWhileInteracting=function(){return this.updateWhileInteracting_},l.prototype.renderDeclutter=function(o){o.declutterTree||(o.declutterTree=new Gx.default(9)),this.getRenderer().renderDeclutter(o)},l.prototype.setRenderOrder=function(o){this.set(Vx.RENDER_ORDER,o)},l.prototype.setStyle=function(o){this.style_=o!==void 0?o:Bx,this.styleFunction_=o===null?void 0:Fx(this.style_),this.changed()},l}(Qh),jx=Iw;var hd={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},pd=[hd.FILL],ku=[hd.STROKE],Sc=[hd.BEGIN_PATH],Qy=[hd.CLOSE_PATH],Br=hd;var Cw=function(){function v(){}return v.prototype.drawCustom=function(l,o,c,i){},v.prototype.drawGeometry=function(l){},v.prototype.setStyle=function(l){},v.prototype.drawCircle=function(l,o){},v.prototype.drawFeature=function(l,o){},v.prototype.drawGeometryCollection=function(l,o){},v.prototype.drawLineString=function(l,o){},v.prototype.drawMultiLineString=function(l,o){},v.prototype.drawMultiPoint=function(l,o){},v.prototype.drawMultiPolygon=function(l,o){},v.prototype.drawPoint=function(l,o){},v.prototype.drawPolygon=function(l,o){},v.prototype.drawText=function(l,o){},v.prototype.setFillStrokeStyle=function(l,o){},v.prototype.setImageStyle=function(l,o){},v.prototype.setTextStyle=function(l,o){},v}(),Vm=Cw;var Aw=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),Pw=function(v){Aw(l,v);function l(o,c,i,u){var P=v.call(this)||this;return P.tolerance=o,P.maxExtent=c,P.pixelRatio=u,P.maxLineWidth=0,P.resolution=i,P.beginGeometryInstruction1_=null,P.beginGeometryInstruction2_=null,P.bufferedMaxExtent_=null,P.instructions=[],P.coordinates=[],P.tmpCoordinate_=[],P.hitDetectionInstructions=[],P.state={},P}return l.prototype.applyPixelRatio=function(o){var c=this.pixelRatio;return c==1?o:o.map(function(i){return i*c})},l.prototype.appendFlatPointCoordinates=function(o,c){for(var i=this.getBufferedMaxExtent(),u=this.tmpCoordinate_,P=this.coordinates,D=P.length,F=0,U=o.length;F<U;F+=c)u[0]=o[F],u[1]=o[F+1],qp(i,u)&&(P[D++]=u[0],P[D++]=u[1]);return D},l.prototype.appendFlatLineCoordinates=function(o,c,i,u,P,D){var F=this.coordinates,U=F.length,N=this.getBufferedMaxExtent();D&&(c+=u);var at=o[c],yt=o[c+1],Tt=this.tmpCoordinate_,Lt=!0,Vt,wt,kt;for(Vt=c+u;Vt<i;Vt+=u)Tt[0]=o[Vt],Tt[1]=o[Vt+1],kt=xm(N,Tt),kt!==wt?(Lt&&(F[U++]=at,F[U++]=yt,Lt=!1),F[U++]=Tt[0],F[U++]=Tt[1]):kt===Co.INTERSECTING?(F[U++]=Tt[0],F[U++]=Tt[1],Lt=!1):Lt=!0,at=Tt[0],yt=Tt[1],wt=kt;return(P&&Lt||Vt===c+u)&&(F[U++]=at,F[U++]=yt),U},l.prototype.drawCustomCoordinates_=function(o,c,i,u,P){for(var D=0,F=i.length;D<F;++D){var U=i[D],N=this.appendFlatLineCoordinates(o,c,U,u,!1,!1);P.push(N),c=U}return c},l.prototype.drawCustom=function(o,c,i,u){this.beginGeometry(o,c);var P=o.getType(),D=o.getStride(),F=this.coordinates.length,U,N,at,yt,Tt;switch(P){case Ie.MULTI_POLYGON:U=o.getOrientedFlatCoordinates(),yt=[];var Lt=o.getEndss();Tt=0;for(var Vt=0,wt=Lt.length;Vt<wt;++Vt){var kt=[];Tt=this.drawCustomCoordinates_(U,Tt,Lt[Vt],D,kt),yt.push(kt)}this.instructions.push([Br.CUSTOM,F,yt,o,i,sd]),this.hitDetectionInstructions.push([Br.CUSTOM,F,yt,o,u||i,sd]);break;case Ie.POLYGON:case Ie.MULTI_LINE_STRING:at=[],U=P==Ie.POLYGON?o.getOrientedFlatCoordinates():o.getFlatCoordinates(),Tt=this.drawCustomCoordinates_(U,0,o.getEnds(),D,at),this.instructions.push([Br.CUSTOM,F,at,o,i,fh]),this.hitDetectionInstructions.push([Br.CUSTOM,F,at,o,u||i,fh]);break;case Ie.LINE_STRING:case Ie.CIRCLE:U=o.getFlatCoordinates(),N=this.appendFlatLineCoordinates(U,0,U.length,D,!1,!1),this.instructions.push([Br.CUSTOM,F,N,o,i,nl]),this.hitDetectionInstructions.push([Br.CUSTOM,F,N,o,u||i,nl]);break;case Ie.MULTI_POINT:U=o.getFlatCoordinates(),N=this.appendFlatPointCoordinates(U,D),N>F&&(this.instructions.push([Br.CUSTOM,F,N,o,i,nl]),this.hitDetectionInstructions.push([Br.CUSTOM,F,N,o,u||i,nl]));break;case Ie.POINT:U=o.getFlatCoordinates(),this.coordinates.push(U[0],U[1]),N=this.coordinates.length,this.instructions.push([Br.CUSTOM,F,N,o,i]),this.hitDetectionInstructions.push([Br.CUSTOM,F,N,o,u||i]);break;default:}this.endGeometry(c)},l.prototype.beginGeometry=function(o,c){this.beginGeometryInstruction1_=[Br.BEGIN_GEOMETRY,c,0,o],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Br.BEGIN_GEOMETRY,c,0,o],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},l.prototype.finish=function(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}},l.prototype.reverseHitDetectionInstructions=function(){var o=this.hitDetectionInstructions;o.reverse();var c,i=o.length,u,P,D=-1;for(c=0;c<i;++c)u=o[c],P=u[0],P==Br.END_GEOMETRY?D=c:P==Br.BEGIN_GEOMETRY&&(u[2]=c,pv(this.hitDetectionInstructions,D,c),D=-1)},l.prototype.setFillStrokeStyle=function(o,c){var i=this.state;if(o){var u=o.getColor();i.fillStyle=ds(u||ms)}else i.fillStyle=void 0;if(c){var P=c.getColor();i.strokeStyle=ds(P||bc);var D=c.getLineCap();i.lineCap=D!==void 0?D:rp;var F=c.getLineDash();i.lineDash=F?F.slice():_c;var U=c.getLineDashOffset();i.lineDashOffset=U||vc;var N=c.getLineJoin();i.lineJoin=N!==void 0?N:Lu;var at=c.getWidth();i.lineWidth=at!==void 0?at:Ec;var yt=c.getMiterLimit();i.miterLimit=yt!==void 0?yt:xc,i.lineWidth>this.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0},l.prototype.createFill=function(o){var c=o.fillStyle,i=[Br.SET_FILL_STYLE,c];return typeof c!="string"&&i.push(!0),i},l.prototype.applyStroke=function(o){this.instructions.push(this.createStroke(o))},l.prototype.createStroke=function(o){return[Br.SET_STROKE_STYLE,o.strokeStyle,o.lineWidth*this.pixelRatio,o.lineCap,o.lineJoin,o.miterLimit,this.applyPixelRatio(o.lineDash),o.lineDashOffset*this.pixelRatio]},l.prototype.updateFillStyle=function(o,c){var i=o.fillStyle;(typeof i!="string"||o.currentFillStyle!=i)&&(i!==void 0&&this.instructions.push(c.call(this,o)),o.currentFillStyle=i)},l.prototype.updateStrokeStyle=function(o,c){var i=o.strokeStyle,u=o.lineCap,P=o.lineDash,D=o.lineDashOffset,F=o.lineJoin,U=o.lineWidth,N=o.miterLimit;(o.currentStrokeStyle!=i||o.currentLineCap!=u||P!=o.currentLineDash&&!ls(o.currentLineDash,P)||o.currentLineDashOffset!=D||o.currentLineJoin!=F||o.currentLineWidth!=U||o.currentMiterLimit!=N)&&(i!==void 0&&c.call(this,o),o.currentStrokeStyle=i,o.currentLineCap=u,o.currentLineDash=P,o.currentLineDashOffset=D,o.currentLineJoin=F,o.currentLineWidth=U,o.currentMiterLimit=N)},l.prototype.endGeometry=function(o){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var c=[Br.END_GEOMETRY,o];this.instructions.push(c),this.hitDetectionInstructions.push(c)},l.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Bv(this.maxExtent),this.maxLineWidth>0)){var o=this.resolution*(this.maxLineWidth+1)/2;rl(this.bufferedMaxExtent_,o,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},l}(Vm),zu=Pw;var Mw=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),Lw=function(v){Mw(l,v);function l(o,c,i,u){var P=v.call(this,o,c,i,u)||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 l.prototype.drawPoint=function(o,c){if(!!this.image_){this.beginGeometry(o,c);var i=o.getFlatCoordinates(),u=o.getStride(),P=this.coordinates.length,D=this.appendFlatPointCoordinates(i,u);this.instructions.push([Br.DRAW_IMAGE,P,D,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([Br.DRAW_IMAGE,P,D,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(c)}},l.prototype.drawMultiPoint=function(o,c){if(!!this.image_){this.beginGeometry(o,c);var i=o.getFlatCoordinates(),u=o.getStride(),P=this.coordinates.length,D=this.appendFlatPointCoordinates(i,u);this.instructions.push([Br.DRAW_IMAGE,P,D,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([Br.DRAW_IMAGE,P,D,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(c)}},l.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,v.prototype.finish.call(this)},l.prototype.setImageStyle=function(o,c){var i=o.getAnchor(),u=o.getSize(),P=o.getHitDetectionImage(),D=o.getImage(this.pixelRatio),F=o.getOrigin();this.imagePixelRatio_=o.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=P,this.image_=D,this.height_=u[1],this.opacity_=o.getOpacity(),this.originX_=F[0]*this.imagePixelRatio_,this.originY_=F[1]*this.imagePixelRatio_,this.rotateWithView_=o.getRotateWithView(),this.rotation_=o.getRotation(),this.scale_=o.getScaleArray(),this.width_=u[0],this.declutterImageWithText_=c},l}(zu),qx=Lw;var kw=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),zw=function(v){kw(l,v);function l(o,c,i,u){return v.call(this,o,c,i,u)||this}return l.prototype.drawFlatCoordinates_=function(o,c,i,u){var P=this.coordinates.length,D=this.appendFlatLineCoordinates(o,c,i,u,!1,!1),F=[Br.MOVE_TO_LINE_TO,P,D];return this.instructions.push(F),this.hitDetectionInstructions.push(F),i},l.prototype.drawLineString=function(o,c){var i=this.state,u=i.strokeStyle,P=i.lineWidth;if(!(u===void 0||P===void 0)){this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(o,c),this.hitDetectionInstructions.push([Br.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,_c,vc],Sc);var D=o.getFlatCoordinates(),F=o.getStride();this.drawFlatCoordinates_(D,0,D.length,F),this.hitDetectionInstructions.push(ku),this.endGeometry(c)}},l.prototype.drawMultiLineString=function(o,c){var i=this.state,u=i.strokeStyle,P=i.lineWidth;if(!(u===void 0||P===void 0)){this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(o,c),this.hitDetectionInstructions.push([Br.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],Sc);for(var D=o.getEnds(),F=o.getFlatCoordinates(),U=o.getStride(),N=0,at=0,yt=D.length;at<yt;++at)N=this.drawFlatCoordinates_(F,N,D[at],U);this.hitDetectionInstructions.push(ku),this.endGeometry(c)}},l.prototype.finish=function(){var o=this.state;return o.lastStroke!=null&&o.lastStroke!=this.coordinates.length&&this.instructions.push(ku),this.reverseHitDetectionInstructions(),this.state=null,v.prototype.finish.call(this)},l.prototype.applyStroke=function(o){o.lastStroke!=null&&o.lastStroke!=this.coordinates.length&&(this.instructions.push(ku),o.lastStroke=this.coordinates.length),o.lastStroke=0,v.prototype.applyStroke.call(this,o),this.instructions.push(Sc)},l}(zu),Zx=zw;var Rw=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),Dw=function(v){Rw(l,v);function l(o,c,i,u){return v.call(this,o,c,i,u)||this}return l.prototype.drawFlatCoordinatess_=function(o,c,i,u){var P=this.state,D=P.fillStyle!==void 0,F=P.strokeStyle!==void 0,U=i.length;this.instructions.push(Sc),this.hitDetectionInstructions.push(Sc);for(var N=0;N<U;++N){var at=i[N],yt=this.coordinates.length,Tt=this.appendFlatLineCoordinates(o,c,at,u,!0,!F),Lt=[Br.MOVE_TO_LINE_TO,yt,Tt];this.instructions.push(Lt),this.hitDetectionInstructions.push(Lt),F&&(this.instructions.push(Qy),this.hitDetectionInstructions.push(Qy)),c=at}return D&&(this.instructions.push(pd),this.hitDetectionInstructions.push(pd)),F&&(this.instructions.push(ku),this.hitDetectionInstructions.push(ku)),c},l.prototype.drawCircle=function(o,c){var i=this.state,u=i.fillStyle,P=i.strokeStyle;if(!(u===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(o,c),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([Br.SET_FILL_STYLE,ms]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([Br.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);var D=o.getFlatCoordinates(),F=o.getStride(),U=this.coordinates.length;this.appendFlatLineCoordinates(D,0,D.length,F,!1,!1);var N=[Br.CIRCLE,U];this.instructions.push(Sc,N),this.hitDetectionInstructions.push(Sc,N),i.fillStyle!==void 0&&(this.instructions.push(pd),this.hitDetectionInstructions.push(pd)),i.strokeStyle!==void 0&&(this.instructions.push(ku),this.hitDetectionInstructions.push(ku)),this.endGeometry(c)}},l.prototype.drawPolygon=function(o,c){var i=this.state,u=i.fillStyle,P=i.strokeStyle;if(!(u===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(o,c),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([Br.SET_FILL_STYLE,ms]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([Br.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);var D=o.getEnds(),F=o.getOrientedFlatCoordinates(),U=o.getStride();this.drawFlatCoordinatess_(F,0,D,U),this.endGeometry(c)}},l.prototype.drawMultiPolygon=function(o,c){var i=this.state,u=i.fillStyle,P=i.strokeStyle;if(!(u===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(o,c),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([Br.SET_FILL_STYLE,ms]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([Br.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);for(var D=o.getEndss(),F=o.getOrientedFlatCoordinates(),U=o.getStride(),N=0,at=0,yt=D.length;at<yt;++at)N=this.drawFlatCoordinatess_(F,N,D[at],U);this.endGeometry(c)}},l.prototype.finish=function(){this.reverseHitDetectionInstructions(),this.state=null;var o=this.tolerance;if(o!==0)for(var c=this.coordinates,i=0,u=c.length;i<u;++i)c[i]=ph(c[i],o);return v.prototype.finish.call(this)},l.prototype.setFillStrokeStyles_=function(){var o=this.state,c=o.fillStyle;c!==void 0&&this.updateFillStyle(o,this.createFill),o.strokeStyle!==void 0&&this.updateStrokeStyle(o,this.applyStroke)},l}(zu),t_=Dw;function Xx(v,l,o,c,i){var u=o,P=o,D=0,F=0,U=o,N,at,yt,Tt,Lt,Vt,wt,kt,Zt,Yt;for(at=o;at<c;at+=i){var le=l[at],ue=l[at+1];Lt!==void 0&&(Zt=le-Lt,Yt=ue-Vt,Tt=Math.sqrt(Zt*Zt+Yt*Yt),wt!==void 0&&(F+=yt,N=Math.acos((wt*Zt+kt*Yt)/(yt*Tt)),N>v&&(F>D&&(D=F,u=U,P=at),F=0,U=at-i)),yt=Tt,wt=Zt,kt=Yt),Lt=le,Vt=ue}return F+=Tt,F>D?[U,at]:[u,P]}var Ow=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),fd={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Fw=function(v){Ow(l,v);function l(o,c,i,u){var P=v.call(this,o,c,i,u)||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 l.prototype.finish=function(){var o=v.prototype.finish.call(this);return o.textStates=this.textStates,o.fillStates=this.fillStates,o.strokeStates=this.strokeStates,o},l.prototype.drawText=function(o,c){var i=this.textFillState_,u=this.textStrokeState_,P=this.textState_;if(!(this.text_===""||!P||!i&&!u)){var D=this.coordinates,F=D.length,U=o.getType(),N=null,at=o.getStride();if(P.placement===Nx.LINE&&(U==Ie.LINE_STRING||U==Ie.MULTI_LINE_STRING||U==Ie.POLYGON||U==Ie.MULTI_POLYGON)){if(!Ao(this.getBufferedMaxExtent(),o.getExtent()))return;var yt=void 0;if(N=o.getFlatCoordinates(),U==Ie.LINE_STRING)yt=[N.length];else if(U==Ie.MULTI_LINE_STRING)yt=o.getEnds();else if(U==Ie.POLYGON)yt=o.getEnds().slice(0,1);else if(U==Ie.MULTI_POLYGON){var Tt=o.getEndss();yt=[];for(var Lt=0,Vt=Tt.length;Lt<Vt;++Lt)yt.push(Tt[Lt][0])}this.beginGeometry(o,c);for(var wt=P.textAlign,kt=0,Zt=void 0,Yt=0,le=yt.length;Yt<le;++Yt){if(wt==null){var ue=Xx(P.maxAngle,N,kt,yt[Yt],at);kt=ue[0],Zt=ue[1]}else Zt=yt[Yt];for(var Lt=kt;Lt<Zt;Lt+=at)D.push(N[Lt],N[Lt+1]);var oe=D.length;kt=yt[Yt],this.drawChars_(F,oe),F=oe}this.endGeometry(c)}else{var ge=P.overflow?null:[];switch(U){case Ie.POINT:case Ie.MULTI_POINT:N=o.getFlatCoordinates();break;case Ie.LINE_STRING:N=o.getFlatMidpoint();break;case Ie.CIRCLE:N=o.getCenter();break;case Ie.MULTI_LINE_STRING:N=o.getFlatMidpoints(),at=2;break;case Ie.POLYGON:N=o.getFlatInteriorPoint(),P.overflow||ge.push(N[2]/this.resolution),at=3;break;case Ie.MULTI_POLYGON:var we=o.getFlatInteriorPoints();N=[];for(var Lt=0,Vt=we.length;Lt<Vt;Lt+=3)P.overflow||ge.push(we[Lt+2]/this.resolution),N.push(we[Lt],we[Lt+1]);if(N.length===0)return;at=2;break;default:}var oe=this.appendFlatPointCoordinates(N,at);if(oe===F)return;if(ge&&(oe-F)/2!==N.length/at){var Pe=F/2;ge=ge.filter(function(br,xr){var pr=D[(Pe+xr)*2]===N[xr*at]&&D[(Pe+xr)*2+1]===N[xr*at+1];return pr||--Pe,pr})}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(o,c);var ir=P.padding;if(ir!=wc&&(P.scale[0]<0||P.scale[1]<0)){var Be=P.padding[0],qe=P.padding[1],rr=P.padding[2],Ce=P.padding[3];P.scale[0]<0&&(qe=-qe,Ce=-Ce),P.scale[1]<0&&(Be=-Be,rr=-rr),ir=[Be,qe,rr,Ce]}var Lr=this.pixelRatio;this.instructions.push([Br.DRAW_IMAGE,F,oe,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterImageWithText_,ir==wc?wc:ir.map(function(br){return br*Lr}),!!P.backgroundFill,!!P.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,ge]);var yr=1/Lr;this.hitDetectionInstructions.push([Br.DRAW_IMAGE,F,oe,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[yr,yr],NaN,this.declutterImageWithText_,ir,!!P.backgroundFill,!!P.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,ge]),this.endGeometry(c)}}},l.prototype.saveTextStates_=function(){var o=this.textStrokeState_,c=this.textState_,i=this.textFillState_,u=this.strokeKey_;o&&(u in this.strokeStates||(this.strokeStates[u]={strokeStyle:o.strokeStyle,lineCap:o.lineCap,lineDashOffset:o.lineDashOffset,lineWidth:o.lineWidth,lineJoin:o.lineJoin,miterLimit:o.miterLimit,lineDash:o.lineDash}));var P=this.textKey_;P in this.textStates||(this.textStates[P]={font:c.font,textAlign:c.textAlign||gh,textBaseline:c.textBaseline||ip,scale:c.scale});var D=this.fillKey_;i&&(D in this.fillStates||(this.fillStates[D]={fillStyle:i.fillStyle}))},l.prototype.drawChars_=function(o,c){var i=this.textStrokeState_,u=this.textState_,P=this.strokeKey_,D=this.textKey_,F=this.fillKey_;this.saveTextStates_();var U=this.pixelRatio,N=fd[u.textBaseline],at=this.textOffsetY_*U,yt=this.text_,Tt=i?i.lineWidth*Math.abs(u.scale[0])/2:0;this.instructions.push([Br.DRAW_CHARS,o,c,N,u.overflow,F,u.maxAngle,U,at,P,Tt*U,yt,D,1]),this.hitDetectionInstructions.push([Br.DRAW_CHARS,o,c,N,u.overflow,F,u.maxAngle,1,at,P,Tt,yt,D,1/U])},l.prototype.setTextStyle=function(o,c){var i,u,P;if(!o)this.text_="";else{var D=o.getFill();D?(u=this.textFillState_,u||(u={},this.textFillState_=u),u.fillStyle=ds(D.getColor()||ms)):(u=null,this.textFillState_=u);var F=o.getStroke();if(!F)P=null,this.textStrokeState_=P;else{P=this.textStrokeState_,P||(P={},this.textStrokeState_=P);var U=F.getLineDash(),N=F.getLineDashOffset(),at=F.getWidth(),yt=F.getMiterLimit();P.lineCap=F.getLineCap()||rp,P.lineDash=U?U.slice():_c,P.lineDashOffset=N===void 0?vc:N,P.lineJoin=F.getLineJoin()||Lu,P.lineWidth=at===void 0?Ec:at,P.miterLimit=yt===void 0?xc:yt,P.strokeStyle=ds(F.getColor()||bc)}i=this.textState_;var Tt=o.getFont()||Nm;Lx(Tt);var Lt=o.getScaleArray();i.overflow=o.getOverflow(),i.font=Tt,i.maxAngle=o.getMaxAngle(),i.placement=o.getPlacement(),i.textAlign=o.getTextAlign(),i.textBaseline=o.getTextBaseline()||ip,i.backgroundFill=o.getBackgroundFill(),i.backgroundStroke=o.getBackgroundStroke(),i.padding=o.getPadding()||wc,i.scale=Lt===void 0?[1,1]:Lt;var Vt=o.getOffsetX(),wt=o.getOffsetY(),kt=o.getRotateWithView(),Zt=o.getRotation();this.text_=o.getText()||"",this.textOffsetX_=Vt===void 0?0:Vt,this.textOffsetY_=wt===void 0?0:wt,this.textRotateWithView_=kt===void 0?!1:kt,this.textRotation_=Zt===void 0?0:Zt,this.strokeKey_=P?(typeof P.strokeStyle=="string"?P.strokeStyle:wi(P.strokeStyle))+P.lineCap+P.lineDashOffset+"|"+P.lineWidth+P.lineJoin+P.miterLimit+"["+P.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.textBaseline||"?"),this.fillKey_=u?typeof u.fillStyle=="string"?u.fillStyle:"|"+wi(u.fillStyle):""}this.declutterImageWithText_=c},l}(zu),Wx=Fw;var Bw={Circle:t_,Default:zu,Image:qx,LineString:Zx,Polygon:t_,Text:Wx},Uw=function(){function v(l,o,c,i){this.tolerance_=l,this.maxExtent_=o,this.pixelRatio_=i,this.resolution_=c,this.buildersByZIndex_={}}return v.prototype.finish=function(){var l={};for(var o in this.buildersByZIndex_){l[o]=l[o]||{};var c=this.buildersByZIndex_[o];for(var i in c){var u=c[i].finish();l[o][i]=u}}return l},v.prototype.getBuilder=function(l,o){var c=l!==void 0?l.toString():"0",i=this.buildersByZIndex_[c];i===void 0&&(i={},this.buildersByZIndex_[c]=i);var u=i[o];if(u===void 0){var P=Bw[o];u=new P(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),i[o]=u}return u},v}(),e_=Uw;var Nw=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),Vw=function(v){Nw(l,v);function l(o){var c=v.call(this)||this;return c.ready=!0,c.boundHandleImageChange_=c.handleImageChange_.bind(c),c.layer_=o,c.declutterExecutorGroup=null,c}return l.prototype.getFeatures=function(o){return Fr()},l.prototype.getData=function(o){return null},l.prototype.prepareFrame=function(o){return Fr()},l.prototype.renderFrame=function(o,c){return Fr()},l.prototype.loadedTileCallback=function(o,c,i){o[c]||(o[c]={}),o[c][i.tileCoord.toString()]=i},l.prototype.createLoadedTileFinder=function(o,c,i){return function(u,P){var D=this.loadedTileCallback.bind(this,i,u);return o.forEachLoadedTile(c,u,P,D)}.bind(this)},l.prototype.forEachFeatureAtCoordinate=function(o,c,i,u,P){},l.prototype.getDataAtPixel=function(o,c,i){return null},l.prototype.getLayer=function(){return this.layer_},l.prototype.handleFontsChanged=function(){},l.prototype.handleImageChange_=function(o){var c=o.target;c.getState()===zi.LOADED&&this.renderIfReadyAndVisible()},l.prototype.loadImage=function(o){var c=o.getState();return c!=zi.LOADED&&c!=zi.ERROR&&o.addEventListener(Vi.CHANGE,this.boundHandleImageChange_),c==zi.IDLE&&(o.load(),c=o.getState()),c==zi.LOADED},l.prototype.renderIfReadyAndVisible=function(){var o=this.getLayer();o.getVisible()&&o.getSourceState()==Mu.READY&&o.changed()},l.prototype.disposeInternal=function(){delete this.layer_,v.prototype.disposeInternal.call(this)},l}(pm),$x=Vw;var Gw=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),jw=function(v){Gw(l,v);function l(o,c,i,u){var P=v.call(this,o)||this;return P.inversePixelTransform=c,P.frameState=i,P.context=u,P}return l}(ss),Kx=jw;var qw=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),dd=null;function Zw(){var v=document.createElement("canvas");v.width=1,v.height=1,dd=v.getContext("2d")}var Xw=function(v){qw(l,v);function l(o){var c=v.call(this,o)||this;return c.container=null,c.renderedResolution,c.tempTransform=va(),c.pixelTransform=va(),c.inversePixelTransform=va(),c.context=null,c.containerReused=!1,c.pixelContext_=null,c.frameState=null,c}return l.prototype.getImageData=function(o,c,i){dd||Zw(),dd.clearRect(0,0,1,1);var u;try{dd.drawImage(o,c,i,1,1,0,0,1,1),u=dd.getImageData(0,0,1,1).data}catch{return null}return u},l.prototype.getBackground=function(o){var c=this.getLayer(),i=c.getBackground();return typeof i=="function"&&(i=i(o.viewState.resolution)),i||void 0},l.prototype.useContainer=function(o,c,i,u){var P=this.getLayer().getClassName(),D,F;if(o&&o.className===P&&o.style.opacity===""&&i===1&&(!u||o.style.backgroundColor&&ls(ep(o.style.backgroundColor),ep(u)))){var U=o.firstElementChild;U instanceof HTMLCanvasElement&&(F=U.getContext("2d"))}if(F&&F.canvas.style.transform===c?(this.container=o,this.context=F,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){D=document.createElement("div"),D.className=P;var N=D.style;N.position="absolute",N.width="100%",N.height="100%",u&&(N.backgroundColor=u),F=Ga();var U=F.canvas;D.appendChild(U),N=U.style,N.position="absolute",N.left="0",N.transformOrigin="top left",this.container=D,this.context=F}},l.prototype.clipUnrotated=function(o,c,i){var u=my(i),P=gy(i),D=dy(i),F=fy(i);uo(c.coordinateToPixelTransform,u),uo(c.coordinateToPixelTransform,P),uo(c.coordinateToPixelTransform,D),uo(c.coordinateToPixelTransform,F);var U=this.inversePixelTransform;uo(U,u),uo(U,P),uo(U,D),uo(U,F),o.save(),o.beginPath(),o.moveTo(Math.round(u[0]),Math.round(u[1])),o.lineTo(Math.round(P[0]),Math.round(P[1])),o.lineTo(Math.round(D[0]),Math.round(D[1])),o.lineTo(Math.round(F[0]),Math.round(F[1])),o.clip()},l.prototype.dispatchRenderEvent_=function(o,c,i){var u=this.getLayer();if(u.hasListener(o)){var P=new Kx(o,this.inversePixelTransform,i,c);u.dispatchEvent(P)}},l.prototype.preRender=function(o,c){this.frameState=c,this.dispatchRenderEvent_(td.PRERENDER,o,c)},l.prototype.postRender=function(o,c){this.dispatchRenderEvent_(td.POSTRENDER,o,c)},l.prototype.getRenderTransform=function(o,c,i,u,P,D,F){var U=P/2,N=D/2,at=u/c,yt=-at,Tt=-o[0]+F,Lt=-o[1];return us(this.tempTransform,U,N,at,yt,-i,Tt,Lt)},l.prototype.getDataAtPixel=function(o,c,i){var u=uo(this.inversePixelTransform,o.slice()),P=this.context,D=this.getLayer(),F=D.getExtent();if(F){var U=uo(c.pixelToCoordinateTransform,o.slice());if(!qp(F,U))return null}var N=Math.round(u[0]),at=Math.round(u[1]),yt=this.pixelContext_;if(!yt){var Tt=document.createElement("canvas");Tt.width=1,Tt.height=1,yt=Tt.getContext("2d"),this.pixelContext_=yt}yt.clearRect(0,0,1,1);var Lt;try{yt.drawImage(P.canvas,N,at,1,1,0,0,1,1),Lt=yt.getImageData(0,0,1,1).data}catch(Vt){return Vt.name==="SecurityError"?(this.pixelContext_=null,new Uint8Array):Lt}return Lt[3]===0?null:Lt},l.prototype.disposeInternal=function(){delete this.frameState,v.prototype.disposeInternal.call(this)},l}($x),Yx=Xw;var zn={CIRCLE:"Circle",DEFAULT:"Default",IMAGE:"Image",LINE_STRING:"LineString",POLYGON:"Polygon",TEXT:"Text"};function Hx(v,l,o,c,i,u,P,D,F,U,N,at){var yt=v[l],Tt=v[l+1],Lt=0,Vt=0,wt=0,kt=0;function Zt(){Lt=yt,Vt=Tt,l+=c,yt=v[l],Tt=v[l+1],kt+=wt,wt=Math.sqrt((yt-Lt)*(yt-Lt)+(Tt-Vt)*(Tt-Vt))}do Zt();while(l<o-c&&kt+wt<u);for(var Yt=wt===0?0:(u-kt)/wt,le=el(Lt,yt,Yt),ue=el(Vt,Tt,Yt),oe=l-c,ge=kt,we=u+D*F(U,i,N);l<o-c&&kt+wt<we;)Zt();Yt=wt===0?0:(we-kt)/wt;var Pe=el(Lt,yt,Yt),ir=el(Vt,Tt,Yt),Be;if(at){var qe=[le,ue,Pe,ir];Mm(qe,0,4,2,at,qe,qe),Be=qe[0]>qe[2]}else Be=le>Pe;var rr=Math.PI,Ce=[],Lr=oe+c===l;l=oe,wt=0,kt=ge,yt=v[l],Tt=v[l+1];var yr;if(Lr){Zt(),yr=Math.atan2(Tt-Vt,yt-Lt),Be&&(yr+=yr>0?-rr:rr);var _r=(Pe+le)/2,br=(ir+ue)/2;return Ce[0]=[_r,br,(we-u)/2,yr,i],Ce}for(var xr=0,pr=i.length;xr<pr;){Zt();var $r=Math.atan2(Tt-Vt,yt-Lt);if(Be&&($r+=$r>0?-rr:rr),yr!==void 0){var Fe=$r-yr;if(Fe+=Fe>rr?-2*rr:Fe<-rr?2*rr:0,Math.abs(Fe)>P)return null}yr=$r;for(var ti=xr,oi=0;xr<pr;++xr){var ci=Be?pr-xr-1:xr,Ri=D*F(U,i[ci],N);if(l+c<o&&kt+wt<u+oi+Ri/2)break;oi+=Ri}if(xr!==ti){var Wr=Be?i.substring(pr-ti,pr-xr):i.substring(ti,xr);Yt=wt===0?0:(u+oi/2-kt)/wt;var _r=el(Lt,yt,Yt),br=el(Vt,Tt,Yt);Ce.push([_r,br,oi/2,$r,Wr]),u+=oi}}return Ce}var rf=Va(),yh=[],Tc=[],Ic=[],_h=[];function Jx(v){return v[3].declutterBox}var Ww=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 Qx(v,l){return(l==="start"||l==="end")&&!Ww.test(v)&&(l=l==="start"?"left":"right"),fd[l]}function $w(v,l,o){return o>0&&v.push(`
1005
1005
  `,""),v.push(l,""),v}var Kw=function(){function v(l,o,c,i){this.overlaps=c,this.pixelRatio=o,this.resolution=l,this.alignFill_,this.instructions=i.instructions,this.coordinates=i.coordinates,this.coordinateCache_={},this.renderedTransform_=va(),this.hitDetectionInstructions=i.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=i.fillStates||{},this.strokeStates=i.strokeStates||{},this.textStates=i.textStates||{},this.widths_={},this.labels_={}}return v.prototype.createLabel=function(l,o,c,i){var u=l+o+c+i;if(this.labels_[u])return this.labels_[u];var P=i?this.strokeStates[i]:null,D=c?this.fillStates[c]:null,F=this.textStates[o],U=this.pixelRatio,N=[F.scale[0]*U,F.scale[1]*U],at=Array.isArray(l),yt=Qx(at?l[0]:l,F.textAlign||gh),Tt=i&&P.lineWidth?P.lineWidth:0,Lt=at?l:l.split(`
1006
1006
  `).reduce($w,[]),Vt=zx(F,Lt),wt=Vt.width,kt=Vt.height,Zt=Vt.widths,Yt=Vt.heights,le=Vt.lineWidths,ue=wt+Tt,oe=[],ge=(ue+2)*N[0],we=(kt+Tt)*N[1],Pe={width:ge<0?Math.floor(ge):Math.ceil(ge),height:we<0?Math.floor(we):Math.ceil(we),contextInstructions:oe};if((N[0]!=1||N[1]!=1)&&oe.push("scale",N),i){oe.push("strokeStyle",P.strokeStyle),oe.push("lineWidth",Tt),oe.push("lineCap",P.lineCap),oe.push("lineJoin",P.lineJoin),oe.push("miterLimit",P.miterLimit);var ir=ah?OffscreenCanvasRenderingContext2D:CanvasRenderingContext2D;ir.prototype.setLineDash&&(oe.push("setLineDash",[P.lineDash]),oe.push("lineDashOffset",P.lineDashOffset))}c&&oe.push("fillStyle",D.fillStyle),oe.push("textBaseline","middle"),oe.push("textAlign","center");for(var Be=.5-yt,qe=yt*ue+Be*Tt,rr=[],Ce=[],Lr=0,yr=0,_r=0,br=0,xr,pr=0,$r=Lt.length;pr<$r;pr+=2){var Fe=Lt[pr];if(Fe===`
1007
- `){yr+=Lr,Lr=0,qe=yt*ue+Be*Tt,++br;continue}var ti=Lt[pr+1]||F.font;ti!==xr&&(i&&rr.push("font",ti),c&&Ce.push("font",ti),xr=ti),Lr=Math.max(Lr,Yt[_r]);var oi=[Fe,qe+Be*Zt[_r]+yt*(Zt[_r]-le[br]),.5*(Tt+Lr)+yr];qe+=Zt[_r],i&&rr.push("strokeText",oi),c&&Ce.push("fillText",oi),++_r}return Array.prototype.push.apply(oe,rr),Array.prototype.push.apply(oe,Ce),this.labels_[u]=Pe,Pe},v.prototype.replayTextBackground_=function(l,o,c,i,u,P,D){l.beginPath(),l.moveTo.apply(l,o),l.lineTo.apply(l,c),l.lineTo.apply(l,i),l.lineTo.apply(l,u),l.lineTo.apply(l,o),P&&(this.alignFill_=P[2],this.fill_(l)),D&&(this.setStrokeStyle_(l,D),l.stroke())},v.prototype.calculateImageOrLabelDimensions_=function(l,o,c,i,u,P,D,F,U,N,at,yt,Tt,Lt,Vt,wt){D*=yt[0],F*=yt[1];var kt=c-D,Zt=i-F,Yt=u+U>l?l-U:u,le=P+N>o?o-N:P,ue=Lt[3]+Yt*yt[0]+Lt[1],oe=Lt[0]+le*yt[1]+Lt[2],ge=kt-Lt[3],we=Zt-Lt[0];(Vt||at!==0)&&(yh[0]=ge,_h[0]=ge,yh[1]=we,Tc[1]=we,Tc[0]=ge+ue,Ic[0]=Tc[0],Ic[1]=we+oe,_h[1]=Ic[1]);var Pe;return at!==0?(Pe=us(va(),c,i,1,1,at,-c,-i),uo(Pe,yh),uo(Pe,Tc),uo(Pe,Ic),uo(Pe,_h),sh(Math.min(yh[0],Tc[0],Ic[0],_h[0]),Math.min(yh[1],Tc[1],Ic[1],_h[1]),Math.max(yh[0],Tc[0],Ic[0],_h[0]),Math.max(yh[1],Tc[1],Ic[1],_h[1]),rf)):sh(Math.min(ge,ge+ue),Math.min(we,we+oe),Math.max(ge,ge+ue),Math.max(we,we+oe),rf),Tt&&(kt=Math.round(kt),Zt=Math.round(Zt)),{drawImageX:kt,drawImageY:Zt,drawImageW:Yt,drawImageH:le,originX:U,originY:N,declutterBox:{minX:rf[0],minY:rf[1],maxX:rf[2],maxY:rf[3],value:wt},canvasTransform:Pe,scale:yt}},v.prototype.replayImageOrLabel_=function(l,o,c,i,u,P,D){var F=!!(P||D),U=i.declutterBox,N=l.canvas,at=D?D[2]*i.scale[0]/2:0,yt=U.minX-at<=N.width/o&&U.maxX+at>=0&&U.minY-at<=N.height/o&&U.maxY+at>=0;return yt&&(F&&this.replayTextBackground_(l,yh,Tc,Ic,_h,P,D),Rx(l,i.canvasTransform,u,c,i.originX,i.originY,i.drawImageW,i.drawImageH,i.drawImageX,i.drawImageY,i.scale)),!0},v.prototype.fill_=function(l){if(this.alignFill_){var o=uo(this.renderedTransform_,[0,0]),c=512*this.pixelRatio;l.save(),l.translate(o[0]%c,o[1]%c),l.rotate(this.viewRotation_)}l.fill(),this.alignFill_&&l.restore()},v.prototype.setStrokeStyle_=function(l,o){l.strokeStyle=o[1],l.lineWidth=o[2],l.lineCap=o[3],l.lineJoin=o[4],l.miterLimit=o[5],l.setLineDash&&(l.lineDashOffset=o[7],l.setLineDash(o[6]))},v.prototype.drawLabelWithPointPlacement_=function(l,o,c,i){var u=this.textStates[o],P=this.createLabel(l,o,i,c),D=this.strokeStates[c],F=this.pixelRatio,U=Qx(Array.isArray(l)?l[0]:l,u.textAlign||gh),N=fd[u.textBaseline||ip],at=D&&D.lineWidth?D.lineWidth:0,yt=P.width/F-2*u.scale[0],Tt=U*yt+2*(.5-U)*at,Lt=N*P.height/F+2*(.5-N)*at;return{label:P,anchorX:Tt,anchorY:Lt}},v.prototype.execute_=function(l,o,c,i,u,P,D,F){var U;this.pixelCoordinates_&&ls(c,this.renderedTransform_)?U=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),U=il(this.coordinates,0,this.coordinates.length,2,c,this.pixelCoordinates_),Sv(this.renderedTransform_,c));for(var N=0,at=i.length,yt=0,Tt,Lt,Vt,wt,kt,Zt,Yt,le,ue,oe,ge,we,Pe=0,ir=0,Be=null,qe=null,rr=this.coordinateCache_,Ce=this.viewRotation_,Lr=Math.round(Math.atan2(-c[1],c[0])*1e12)/1e12,yr={context:l,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:Ce},_r=this.instructions!=i||this.overlaps?0:200,br,xr,pr,$r;N<at;){var Fe=i[N],ti=Fe[0];switch(ti){case Br.BEGIN_GEOMETRY:br=Fe[1],$r=Fe[3],br.getGeometry()?D!==void 0&&!Ao(D,$r.getExtent())?N=Fe[2]+1:++N:N=Fe[2];break;case Br.BEGIN_PATH:Pe>_r&&(this.fill_(l),Pe=0),ir>_r&&(l.stroke(),ir=0),!Pe&&!ir&&(l.beginPath(),wt=NaN,kt=NaN),++N;break;case Br.CIRCLE:yt=Fe[1];var oi=U[yt],ci=U[yt+1],Ri=U[yt+2],Wr=U[yt+3],Di=Ri-oi,vn=Wr-ci,sn=Math.sqrt(Di*Di+vn*vn);l.moveTo(oi+sn,ci),l.arc(oi,ci,sn,0,2*Math.PI,!0),++N;break;case Br.CLOSE_PATH:l.closePath(),++N;break;case Br.CUSTOM:yt=Fe[1],Tt=Fe[2];var dr=Fe[3],xn=Fe[4],en=Fe.length==6?Fe[5]:void 0;yr.geometry=dr,yr.feature=br,N in rr||(rr[N]=[]);var ji=rr[N];en?en(U,yt,Tt,2,ji):(ji[0]=U[yt],ji[1]=U[yt+1],ji.length=2),xn(ji,yr),++N;break;case Br.DRAW_IMAGE:yt=Fe[1],Tt=Fe[2],le=Fe[3],Lt=Fe[4],Vt=Fe[5];var qn=Fe[6],Zn=Fe[7],io=Fe[8],Wi=Fe[9],bn=Fe[10],co=Fe[11],zr=Fe[12],$i=Fe[13],dn=Fe[14];if(!le&&Fe.length>=19){ue=Fe[18],oe=Fe[19],ge=Fe[20],we=Fe[21];var ln=this.drawLabelWithPointPlacement_(ue,oe,ge,we);le=ln.label,Fe[3]=le;var na=Fe[22];Lt=(ln.anchorX-na)*this.pixelRatio,Fe[4]=Lt;var fe=Fe[23];Vt=(ln.anchorY-fe)*this.pixelRatio,Fe[5]=Vt,qn=le.height,Fe[6]=qn,$i=le.width,Fe[13]=$i}var Ze=void 0;Fe.length>24&&(Ze=Fe[24]);var no=void 0,wn=void 0,ii=void 0;Fe.length>16?(no=Fe[15],wn=Fe[16],ii=Fe[17]):(no=wc,wn=!1,ii=!1),bn&&Lr?co+=Ce:!bn&&!Lr&&(co-=Ce);for(var En=0;yt<Tt;yt+=2)if(!(Ze&&Ze[En++]<$i/this.pixelRatio)){var Ei=this.calculateImageOrLabelDimensions_(le.width,le.height,U[yt],U[yt+1],$i,qn,Lt,Vt,io,Wi,co,zr,u,no,wn||ii,br),Xn=[l,o,le,Ei,Zn,wn?Be:null,ii?qe:null],ai=void 0,Ge=void 0;if(F&&dn){var Rr=Tt-yt;if(!dn[Rr]){dn[Rr]=Xn;continue}if(ai=dn[Rr],delete dn[Rr],Ge=Jx(ai),F.collides(Ge))continue}F&&F.collides(Ei.declutterBox)||(ai&&(F&&F.insert(Ge),this.replayImageOrLabel_.apply(this,ai)),F&&F.insert(Ei.declutterBox),this.replayImageOrLabel_.apply(this,Xn))}++N;break;case Br.DRAW_CHARS:var kr=Fe[1],qi=Fe[2],Ki=Fe[3],Tr=Fe[4];we=Fe[5];var ho=Fe[6],Rn=Fe[7],hi=Fe[8];ge=Fe[9];var Q=Fe[10];ue=Fe[11],oe=Fe[12];var it=[Fe[13],Fe[13]],st=this.textStates[oe],_t=st.font,It=[st.scale[0]*Rn,st.scale[1]*Rn],Bt=void 0;_t in this.widths_?Bt=this.widths_[_t]:(Bt={},this.widths_[_t]=Bt);var Gt=Om(U,kr,qi,2),dt=Math.abs(It[0])*$y(_t,ue,Bt);if(Tr||dt<=Gt){var zt=this.textStates[oe].textAlign,Qt=(Gt-dt)*fd[zt],nt=Hx(U,kr,qi,2,ue,Qt,ho,Math.abs(It[0]),$y,_t,Bt,Lr?0:this.viewRotation_);t:if(nt){var X=[],Z=void 0,rt=void 0,lt=void 0,gt=void 0,pt=void 0;if(ge)for(Z=0,rt=nt.length;Z<rt;++Z){pt=nt[Z],lt=pt[4],gt=this.createLabel(lt,oe,"",ge),Lt=pt[2]+(It[0]<0?-Q:Q),Vt=Ki*gt.height+(.5-Ki)*2*Q*It[1]/It[0]-hi;var Ei=this.calculateImageOrLabelDimensions_(gt.width,gt.height,pt[0],pt[1],gt.width,gt.height,Lt,Vt,0,0,pt[3],it,!1,wc,!1,br);if(F&&F.collides(Ei.declutterBox))break t;X.push([l,o,gt,Ei,1,null,null])}if(we)for(Z=0,rt=nt.length;Z<rt;++Z){pt=nt[Z],lt=pt[4],gt=this.createLabel(lt,oe,we,""),Lt=pt[2],Vt=Ki*gt.height-hi;var Ei=this.calculateImageOrLabelDimensions_(gt.width,gt.height,pt[0],pt[1],gt.width,gt.height,Lt,Vt,0,0,pt[3],it,!1,wc,!1,br);if(F&&F.collides(Ei.declutterBox))break t;X.push([l,o,gt,Ei,1,null,null])}F&&F.load(X.map(Jx));for(var St=0,Et=X.length;St<Et;++St)this.replayImageOrLabel_.apply(this,X[St])}}++N;break;case Br.END_GEOMETRY:if(P!==void 0){br=Fe[1];var Ct=P(br,$r);if(Ct)return Ct}++N;break;case Br.FILL:_r?Pe++:this.fill_(l),++N;break;case Br.MOVE_TO_LINE_TO:for(yt=Fe[1],Tt=Fe[2],xr=U[yt],pr=U[yt+1],Zt=xr+.5|0,Yt=pr+.5|0,(Zt!==wt||Yt!==kt)&&(l.moveTo(xr,pr),wt=Zt,kt=Yt),yt+=2;yt<Tt;yt+=2)xr=U[yt],pr=U[yt+1],Zt=xr+.5|0,Yt=pr+.5|0,(yt==Tt-2||Zt!==wt||Yt!==kt)&&(l.lineTo(xr,pr),wt=Zt,kt=Yt);++N;break;case Br.SET_FILL_STYLE:Be=Fe,this.alignFill_=Fe[2],Pe&&(this.fill_(l),Pe=0,ir&&(l.stroke(),ir=0)),l.fillStyle=Fe[1],++N;break;case Br.SET_STROKE_STYLE:qe=Fe,ir&&(l.stroke(),ir=0),this.setStrokeStyle_(l,Fe),++N;break;case Br.STROKE:_r?ir++:l.stroke(),++N;break;default:++N;break}}Pe&&this.fill_(l),ir&&l.stroke()},v.prototype.execute=function(l,o,c,i,u,P){this.viewRotation_=i,this.execute_(l,o,c,this.instructions,u,void 0,void 0,P)},v.prototype.executeHitDetection=function(l,o,c,i,u){return this.viewRotation_=c,this.execute_(l,1,o,this.hitDetectionInstructions,!0,i,u)},v}(),t0=Kw;var r_=[zn.POLYGON,zn.CIRCLE,zn.LINE_STRING,zn.IMAGE,zn.TEXT,zn.DEFAULT],Yw=function(){function v(l,o,c,i,u,P){this.maxExtent_=l,this.overlaps_=i,this.pixelRatio_=c,this.resolution_=o,this.renderBuffer_=P,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=va(),this.createExecutors_(u)}return v.prototype.clip=function(l,o){var c=this.getClipCoords(o);l.beginPath(),l.moveTo(c[0],c[1]),l.lineTo(c[2],c[3]),l.lineTo(c[4],c[5]),l.lineTo(c[6],c[7]),l.clip()},v.prototype.createExecutors_=function(l){for(var o in l){var c=this.executorsByZIndex_[o];c===void 0&&(c={},this.executorsByZIndex_[o]=c);var i=l[o];for(var u in i){var P=i[u];c[u]=new t0(this.resolution_,this.pixelRatio_,this.overlaps_,P)}}},v.prototype.hasExecutors=function(l){for(var o in this.executorsByZIndex_)for(var c=this.executorsByZIndex_[o],i=0,u=l.length;i<u;++i)if(l[i]in c)return!0;return!1},v.prototype.forEachFeatureAtCoordinate=function(l,o,c,i,u,P){i=Math.round(i);var D=i*2+1,F=us(this.hitDetectionTransform_,i+.5,i+.5,1/o,-1/o,-c,-l[0],-l[1]),U=!this.hitDetectionContext_;U&&(this.hitDetectionContext_=Ga(D,D));var N=this.hitDetectionContext_;N.canvas.width!==D||N.canvas.height!==D?(N.canvas.width=D,N.canvas.height=D):U||N.clearRect(0,0,D,D);var at;this.renderBuffer_!==void 0&&(at=Va(),hy(at,l),rl(at,o*(this.renderBuffer_+i),at));var yt=Hw(i),Tt;function Lt(oe,ge){for(var we=N.getImageData(0,0,D,D).data,Pe=0,ir=yt.length;Pe<ir;Pe++)if(we[yt[Pe]]>0){if(!P||Tt!==zn.IMAGE&&Tt!==zn.TEXT||P.indexOf(oe)!==-1){var Be=(yt[Pe]-3)/4,qe=i-Be%D,rr=i-(Be/D|0),Ce=u(oe,ge,qe*qe+rr*rr);if(Ce)return Ce}N.clearRect(0,0,D,D);break}}var Vt=Object.keys(this.executorsByZIndex_).map(Number);Vt.sort(rh);var wt,kt,Zt,Yt,le;for(wt=Vt.length-1;wt>=0;--wt){var ue=Vt[wt].toString();for(Zt=this.executorsByZIndex_[ue],kt=r_.length-1;kt>=0;--kt)if(Tt=r_[kt],Yt=Zt[Tt],Yt!==void 0&&(le=Yt.executeHitDetection(N,F,c,Lt,at),le))return le}},v.prototype.getClipCoords=function(l){var o=this.maxExtent_;if(!o)return null;var c=o[0],i=o[1],u=o[2],P=o[3],D=[c,i,c,P,u,P,u,i];return il(D,0,8,2,l,D),D},v.prototype.isEmpty=function(){return Vl(this.executorsByZIndex_)},v.prototype.execute=function(l,o,c,i,u,P,D){var F=Object.keys(this.executorsByZIndex_).map(Number);F.sort(rh),this.maxExtent_&&(l.save(),this.clip(l,c));var U=P||r_,N,at,yt,Tt,Lt,Vt;for(D&&F.reverse(),N=0,at=F.length;N<at;++N){var wt=F[N].toString();for(Lt=this.executorsByZIndex_[wt],yt=0,Tt=U.length;yt<Tt;++yt){var kt=U[yt];Vt=Lt[kt],Vt!==void 0&&Vt.execute(l,o,c,i,u,D)}}this.maxExtent_&&l.restore()},v}(),i_={};function Hw(v){if(i_[v]!==void 0)return i_[v];for(var l=v*2+1,o=v*v,c=new Array(o+1),i=0;i<=v;++i)for(var u=0;u<=v;++u){var P=i*i+u*u;if(P>o)break;var D=c[P];D||(D=[],c[P]=D),D.push(((v+i)*l+(v+u))*4+3),i>0&&D.push(((v-i)*l+(v+u))*4+3),u>0&&(D.push(((v+i)*l+(v-u))*4+3),i>0&&D.push(((v-i)*l+(v-u))*4+3))}for(var F=[],i=0,U=c.length;i<U;++i)c[i]&&F.push.apply(F,c[i]);return i_[v]=F,F}var n_=Yw;var md={ANIMATING:0,INTERACTING:1};var Jw=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),Qw=function(v){Jw(l,v);function l(o,c,i,u,P,D,F){var U=v.call(this)||this;return U.context_=o,U.pixelRatio_=c,U.extent_=i,U.transform_=u,U.viewRotation_=P,U.squaredTolerance_=D,U.userTransform_=F,U.contextFillState_=null,U.contextStrokeState_=null,U.contextTextState_=null,U.fillState_=null,U.strokeState_=null,U.image_=null,U.imageAnchorX_=0,U.imageAnchorY_=0,U.imageHeight_=0,U.imageOpacity_=0,U.imageOriginX_=0,U.imageOriginY_=0,U.imageRotateWithView_=!1,U.imageRotation_=0,U.imageScale_=[0,0],U.imageWidth_=0,U.text_="",U.textOffsetX_=0,U.textOffsetY_=0,U.textRotateWithView_=!1,U.textRotation_=0,U.textScale_=[0,0],U.textFillState_=null,U.textStrokeState_=null,U.textState_=null,U.pixelCoordinates_=[],U.tmpLocalTransform_=va(),U}return l.prototype.drawImages_=function(o,c,i,u){if(!!this.image_){var P=il(o,c,i,u,this.transform_,this.pixelCoordinates_),D=this.context_,F=this.tmpLocalTransform_,U=D.globalAlpha;this.imageOpacity_!=1&&(D.globalAlpha=U*this.imageOpacity_);var N=this.imageRotation_;this.imageRotateWithView_&&(N+=this.viewRotation_);for(var at=0,yt=P.length;at<yt;at+=2){var Tt=P[at]-this.imageAnchorX_,Lt=P[at+1]-this.imageAnchorY_;if(N!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){var Vt=Tt+this.imageAnchorX_,wt=Lt+this.imageAnchorY_;us(F,Vt,wt,1,1,N,-Vt,-wt),D.setTransform.apply(D,F),D.translate(Vt,wt),D.scale(this.imageScale_[0],this.imageScale_[1]),D.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),D.setTransform(1,0,0,1,0,0)}else D.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,Tt,Lt,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(D.globalAlpha=U)}},l.prototype.drawText_=function(o,c,i,u){if(!(!this.textState_||this.text_==="")){this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);var P=il(o,c,i,u,this.transform_,this.pixelCoordinates_),D=this.context_,F=this.textRotation_;for(this.textRotateWithView_&&(F+=this.viewRotation_);c<i;c+=u){var U=P[c]+this.textOffsetX_,N=P[c+1]+this.textOffsetY_;if(F!==0||this.textScale_[0]!=1||this.textScale_[1]!=1){var at=us(this.tmpLocalTransform_,U,N,1,1,F,-U,-N);D.setTransform.apply(D,at),D.translate(U,N),D.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&D.strokeText(this.text_,0,0),this.textFillState_&&D.fillText(this.text_,0,0),D.setTransform(1,0,0,1,0,0)}else this.textStrokeState_&&D.strokeText(this.text_,U,N),this.textFillState_&&D.fillText(this.text_,U,N)}}},l.prototype.moveToLineTo_=function(o,c,i,u,P){var D=this.context_,F=il(o,c,i,u,this.transform_,this.pixelCoordinates_);D.moveTo(F[0],F[1]);var U=F.length;P&&(U-=2);for(var N=2;N<U;N+=2)D.lineTo(F[N],F[N+1]);return P&&D.closePath(),i},l.prototype.drawRings_=function(o,c,i,u){for(var P=0,D=i.length;P<D;++P)c=this.moveToLineTo_(o,c,i[P],u,!0);return c},l.prototype.drawCircle=function(o){if(!!Ao(this.extent_,o.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var c=ux(o,this.transform_,this.pixelCoordinates_),i=c[2]-c[0],u=c[3]-c[1],P=Math.sqrt(i*i+u*u),D=this.context_;D.beginPath(),D.arc(c[0],c[1],P,0,2*Math.PI),this.fillState_&&D.fill(),this.strokeState_&&D.stroke()}this.text_!==""&&this.drawText_(o.getCenter(),0,2,2)}},l.prototype.setStyle=function(o){this.setFillStrokeStyle(o.getFill(),o.getStroke()),this.setImageStyle(o.getImage()),this.setTextStyle(o.getText())},l.prototype.setTransform=function(o){this.transform_=o},l.prototype.drawGeometry=function(o){var c=o.getType();switch(c){case Ie.POINT:this.drawPoint(o);break;case Ie.LINE_STRING:this.drawLineString(o);break;case Ie.POLYGON:this.drawPolygon(o);break;case Ie.MULTI_POINT:this.drawMultiPoint(o);break;case Ie.MULTI_LINE_STRING:this.drawMultiLineString(o);break;case Ie.MULTI_POLYGON:this.drawMultiPolygon(o);break;case Ie.GEOMETRY_COLLECTION:this.drawGeometryCollection(o);break;case Ie.CIRCLE:this.drawCircle(o);break;default:}},l.prototype.drawFeature=function(o,c){var i=c.getGeometryFunction()(o);!i||!Ao(this.extent_,i.getExtent())||(this.setStyle(c),this.drawGeometry(i))},l.prototype.drawGeometryCollection=function(o){for(var c=o.getGeometriesArray(),i=0,u=c.length;i<u;++i)this.drawGeometry(c[i])},l.prototype.drawPoint=function(o){this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var c=o.getFlatCoordinates(),i=o.getStride();this.image_&&this.drawImages_(c,0,c.length,i),this.text_!==""&&this.drawText_(c,0,c.length,i)},l.prototype.drawMultiPoint=function(o){this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var c=o.getFlatCoordinates(),i=o.getStride();this.image_&&this.drawImages_(c,0,c.length,i),this.text_!==""&&this.drawText_(c,0,c.length,i)},l.prototype.drawLineString=function(o){if(this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ao(this.extent_,o.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var c=this.context_,i=o.getFlatCoordinates();c.beginPath(),this.moveToLineTo_(i,0,i.length,o.getStride(),!1),c.stroke()}if(this.text_!==""){var u=o.getFlatMidpoint();this.drawText_(u,0,2,2)}}},l.prototype.drawMultiLineString=function(o){this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var c=o.getExtent();if(!!Ao(this.extent_,c)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var i=this.context_,u=o.getFlatCoordinates(),P=0,D=o.getEnds(),F=o.getStride();i.beginPath();for(var U=0,N=D.length;U<N;++U)P=this.moveToLineTo_(u,P,D[U],F,!1);i.stroke()}if(this.text_!==""){var at=o.getFlatMidpoints();this.drawText_(at,0,at.length,2)}}},l.prototype.drawPolygon=function(o){if(this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ao(this.extent_,o.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var c=this.context_;c.beginPath(),this.drawRings_(o.getOrientedFlatCoordinates(),0,o.getEnds(),o.getStride()),this.fillState_&&c.fill(),this.strokeState_&&c.stroke()}if(this.text_!==""){var i=o.getFlatInteriorPoint();this.drawText_(i,0,2,2)}}},l.prototype.drawMultiPolygon=function(o){if(this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ao(this.extent_,o.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var c=this.context_,i=o.getOrientedFlatCoordinates(),u=0,P=o.getEndss(),D=o.getStride();c.beginPath();for(var F=0,U=P.length;F<U;++F){var N=P[F];u=this.drawRings_(i,u,N,D)}this.fillState_&&c.fill(),this.strokeState_&&c.stroke()}if(this.text_!==""){var at=o.getFlatInteriorPoints();this.drawText_(at,0,at.length,2)}}},l.prototype.setContextFillState_=function(o){var c=this.context_,i=this.contextFillState_;i?i.fillStyle!=o.fillStyle&&(i.fillStyle=o.fillStyle,c.fillStyle=o.fillStyle):(c.fillStyle=o.fillStyle,this.contextFillState_={fillStyle:o.fillStyle})},l.prototype.setContextStrokeState_=function(o){var c=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=o.lineCap&&(i.lineCap=o.lineCap,c.lineCap=o.lineCap),c.setLineDash&&(ls(i.lineDash,o.lineDash)||c.setLineDash(i.lineDash=o.lineDash),i.lineDashOffset!=o.lineDashOffset&&(i.lineDashOffset=o.lineDashOffset,c.lineDashOffset=o.lineDashOffset)),i.lineJoin!=o.lineJoin&&(i.lineJoin=o.lineJoin,c.lineJoin=o.lineJoin),i.lineWidth!=o.lineWidth&&(i.lineWidth=o.lineWidth,c.lineWidth=o.lineWidth),i.miterLimit!=o.miterLimit&&(i.miterLimit=o.miterLimit,c.miterLimit=o.miterLimit),i.strokeStyle!=o.strokeStyle&&(i.strokeStyle=o.strokeStyle,c.strokeStyle=o.strokeStyle)):(c.lineCap=o.lineCap,c.setLineDash&&(c.setLineDash(o.lineDash),c.lineDashOffset=o.lineDashOffset),c.lineJoin=o.lineJoin,c.lineWidth=o.lineWidth,c.miterLimit=o.miterLimit,c.strokeStyle=o.strokeStyle,this.contextStrokeState_={lineCap:o.lineCap,lineDash:o.lineDash,lineDashOffset:o.lineDashOffset,lineJoin:o.lineJoin,lineWidth:o.lineWidth,miterLimit:o.miterLimit,strokeStyle:o.strokeStyle})},l.prototype.setContextTextState_=function(o){var c=this.context_,i=this.contextTextState_,u=o.textAlign?o.textAlign:gh;i?(i.font!=o.font&&(i.font=o.font,c.font=o.font),i.textAlign!=u&&(i.textAlign=u,c.textAlign=u),i.textBaseline!=o.textBaseline&&(i.textBaseline=o.textBaseline,c.textBaseline=o.textBaseline)):(c.font=o.font,c.textAlign=u,c.textBaseline=o.textBaseline,this.contextTextState_={font:o.font,textAlign:u,textBaseline:o.textBaseline})},l.prototype.setFillStrokeStyle=function(o,c){var i=this;if(!o)this.fillState_=null;else{var u=o.getColor();this.fillState_={fillStyle:ds(u||ms)}}if(!c)this.strokeState_=null;else{var P=c.getColor(),D=c.getLineCap(),F=c.getLineDash(),U=c.getLineDashOffset(),N=c.getLineJoin(),at=c.getWidth(),yt=c.getMiterLimit(),Tt=F||_c;this.strokeState_={lineCap:D!==void 0?D:rp,lineDash:this.pixelRatio_===1?Tt:Tt.map(function(Lt){return Lt*i.pixelRatio_}),lineDashOffset:(U||vc)*this.pixelRatio_,lineJoin:N!==void 0?N:Lu,lineWidth:(at!==void 0?at:Ec)*this.pixelRatio_,miterLimit:yt!==void 0?yt:xc,strokeStyle:ds(P||bc)}}},l.prototype.setImageStyle=function(o){var c;if(!o||!(c=o.getSize())){this.image_=null;return}var i=o.getAnchor(),u=o.getOrigin();this.image_=o.getImage(this.pixelRatio_),this.imageAnchorX_=i[0]*this.pixelRatio_,this.imageAnchorY_=i[1]*this.pixelRatio_,this.imageHeight_=c[1]*this.pixelRatio_,this.imageOpacity_=o.getOpacity(),this.imageOriginX_=u[0],this.imageOriginY_=u[1],this.imageRotateWithView_=o.getRotateWithView(),this.imageRotation_=o.getRotation(),this.imageScale_=o.getScaleArray(),this.imageWidth_=c[0]*this.pixelRatio_},l.prototype.setTextStyle=function(o){if(!o)this.text_="";else{var c=o.getFill();if(!c)this.textFillState_=null;else{var i=c.getColor();this.textFillState_={fillStyle:ds(i||ms)}}var u=o.getStroke();if(!u)this.textStrokeState_=null;else{var P=u.getColor(),D=u.getLineCap(),F=u.getLineDash(),U=u.getLineDashOffset(),N=u.getLineJoin(),at=u.getWidth(),yt=u.getMiterLimit();this.textStrokeState_={lineCap:D!==void 0?D:rp,lineDash:F||_c,lineDashOffset:U||vc,lineJoin:N!==void 0?N:Lu,lineWidth:at!==void 0?at:Ec,miterLimit:yt!==void 0?yt:xc,strokeStyle:ds(P||bc)}}var Tt=o.getFont(),Lt=o.getOffsetX(),Vt=o.getOffsetY(),wt=o.getRotateWithView(),kt=o.getRotation(),Zt=o.getScaleArray(),Yt=o.getText(),le=o.getTextAlign(),ue=o.getTextBaseline();this.textState_={font:Tt!==void 0?Tt:Nm,textAlign:le!==void 0?le:gh,textBaseline:ue!==void 0?ue:ip},this.text_=Yt!==void 0?Array.isArray(Yt)?Yt.reduce(function(oe,ge,we){return oe+=we%2?" ":ge},""):Yt:"",this.textOffsetX_=Lt!==void 0?this.pixelRatio_*Lt:0,this.textOffsetY_=Vt!==void 0?this.pixelRatio_*Vt:0,this.textRotateWithView_=wt!==void 0?wt:!1,this.textRotation_=kt!==void 0?kt:0,this.textScale_=[this.pixelRatio_*Zt[0],this.pixelRatio_*Zt[1]]}},l}(Vm),e0=Qw;var Ru={FRACTION:"fraction",PIXELS:"pixels"};var Os={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var t2=function(){function v(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return v.prototype.clear=function(){this.cache_={},this.cacheSize_=0},v.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},v.prototype.expire=function(){if(this.canExpireCache()){var l=0;for(var o in this.cache_){var c=this.cache_[o];(l++&3)===0&&!c.hasListener()&&(delete this.cache_[o],--this.cacheSize_)}}},v.prototype.get=function(l,o,c){var i=r0(l,o,c);return i in this.cache_?this.cache_[i]:null},v.prototype.set=function(l,o,c,i){var u=r0(l,o,c);this.cache_[u]=i,++this.cacheSize_},v.prototype.setSize=function(l){this.maxCacheSize_=l,this.expire()},v}();function r0(v,l,o){var c=o?Bm(o):"null";return l+":"+v+":"+c}var o_=new t2;var e2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),r2=function(v){e2(l,v);function l(o,c,i,u){var P=v.call(this)||this;return P.extent=o,P.pixelRatio_=i,P.resolution=c,P.state=u,P}return l.prototype.changed=function(){this.dispatchEvent(Vi.CHANGE)},l.prototype.getExtent=function(){return this.extent},l.prototype.getImage=function(){return Fr()},l.prototype.getPixelRatio=function(){return this.pixelRatio_},l.prototype.getResolution=function(){return this.resolution},l.prototype.getState=function(){return this.state},l.prototype.load=function(){Fr()},l}(nh),i0=r2;var i2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),ek=function(v){i2(l,v);function l(o,c,i,u,P,D){var F=v.call(this,o,c,i,zi.IDLE)||this;return F.src_=u,F.image_=new Image,P!==null&&(F.image_.crossOrigin=P),F.unlisten_=null,F.state=zi.IDLE,F.imageLoadFunction_=D,F}return l.prototype.getImage=function(){return this.image_},l.prototype.handleImageError_=function(){this.state=zi.ERROR,this.unlistenImage_(),this.changed()},l.prototype.handleImageLoad_=function(){this.resolution===void 0&&(this.resolution=Au(this.extent)/this.image_.height),this.state=zi.LOADED,this.unlistenImage_(),this.changed()},l.prototype.load=function(){(this.state==zi.IDLE||this.state==zi.ERROR)&&(this.state=zi.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=a_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},l.prototype.setImage=function(o){this.image_=o,this.resolution=Au(this.extent)/this.image_.height},l.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},l}(i0);function a_(v,l,o){var c=v,i=!0,u=!1,P=!1,D=[Up(c,Vi.LOAD,function(){P=!0,u||l()})];return c.src&&wv?(u=!0,c.decode().then(function(){i&&l()}).catch(function(F){i&&(P?l():o())})):D.push(Up(c,Vi.ERROR,o)),function(){i=!1,D.forEach(To)}}var n2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),gd=null,o2=function(v){n2(l,v);function l(o,c,i,u,P,D){var F=v.call(this)||this;return F.hitDetectionImage_=null,F.image_=o||new Image,u!==null&&(F.image_.crossOrigin=u),F.canvas_={},F.color_=D,F.unlisten_=null,F.imageState_=P,F.size_=i,F.src_=c,F.tainted_,F}return l.prototype.isTainted_=function(){if(this.tainted_===void 0&&this.imageState_===zi.LOADED){gd||(gd=Ga(1,1)),gd.drawImage(this.image_,0,0);try{gd.getImageData(0,0,1,1),this.tainted_=!1}catch{gd=null,this.tainted_=!0}}return this.tainted_===!0},l.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(Vi.CHANGE)},l.prototype.handleImageError_=function(){this.imageState_=zi.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},l.prototype.handleImageLoad_=function(){this.imageState_=zi.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_()},l.prototype.getImage=function(o){return this.replaceColor_(o),this.canvas_[o]?this.canvas_[o]:this.image_},l.prototype.getPixelRatio=function(o){return this.replaceColor_(o),this.canvas_[o]?o:1},l.prototype.getImageState=function(){return this.imageState_},l.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var o=this.size_[0],c=this.size_[1],i=Ga(o,c);i.fillRect(0,0,o,c),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},l.prototype.getSize=function(){return this.size_},l.prototype.getSrc=function(){return this.src_},l.prototype.load=function(){if(this.imageState_==zi.IDLE){this.imageState_=zi.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=a_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},l.prototype.replaceColor_=function(o){if(!(!this.color_||this.canvas_[o]||this.imageState_!==zi.LOADED)){var c=document.createElement("canvas");this.canvas_[o]=c,c.width=Math.ceil(this.image_.width*o),c.height=Math.ceil(this.image_.height*o);var i=c.getContext("2d");if(i.scale(o,o),i.drawImage(this.image_,0,0),i.globalCompositeOperation="multiply",i.globalCompositeOperation==="multiply"||this.isTainted_())i.fillStyle=Bm(this.color_),i.fillRect(0,0,c.width/o,c.height/o),i.globalCompositeOperation="destination-in",i.drawImage(this.image_,0,0);else{for(var u=i.getImageData(0,0,c.width,c.height),P=u.data,D=this.color_[0]/255,F=this.color_[1]/255,U=this.color_[2]/255,N=this.color_[3],at=0,yt=P.length;at<yt;at+=4)P[at]*=D,P[at+1]*=F,P[at+2]*=U,P[at+3]*=N;i.putImageData(u,0,0)}}},l.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},l}(nh);function n0(v,l,o,c,i,u){var P=o_.get(l,c,u);return P||(P=new o2(v,l,o,c,i,u),o_.set(l,c,u,P)),P}var a2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),s2=function(v){a2(l,v);function l(o){var c=this,i=o||{},u=i.opacity!==void 0?i.opacity:1,P=i.rotation!==void 0?i.rotation:0,D=i.scale!==void 0?i.scale:1,F=i.rotateWithView!==void 0?i.rotateWithView:!1;c=v.call(this,{opacity:u,rotation:P,scale:D,displacement:i.displacement!==void 0?i.displacement:[0,0],rotateWithView:F})||this,c.anchor_=i.anchor!==void 0?i.anchor:[.5,.5],c.normalizedAnchor_=null,c.anchorOrigin_=i.anchorOrigin!==void 0?i.anchorOrigin:Os.TOP_LEFT,c.anchorXUnits_=i.anchorXUnits!==void 0?i.anchorXUnits:Ru.FRACTION,c.anchorYUnits_=i.anchorYUnits!==void 0?i.anchorYUnits:Ru.FRACTION,c.crossOrigin_=i.crossOrigin!==void 0?i.crossOrigin:null;var U=i.img!==void 0?i.img:null;c.imgSize_=i.imgSize;var N=i.src;fn(!(N!==void 0&&U),4),fn(!U||U&&c.imgSize_,5),(N===void 0||N.length===0)&&U&&(N=U.src||wi(U)),fn(N!==void 0&&N.length>0,6);var at=i.src!==void 0?zi.IDLE:zi.LOADED;return c.color_=i.color!==void 0?ep(i.color):null,c.iconImage_=n0(U,N,c.imgSize_!==void 0?c.imgSize_:null,c.crossOrigin_,at,c.color_),c.offset_=i.offset!==void 0?i.offset:[0,0],c.offsetOrigin_=i.offsetOrigin!==void 0?i.offsetOrigin:Os.TOP_LEFT,c.origin_=null,c.size_=i.size!==void 0?i.size:null,c}return l.prototype.clone=function(){var o=this.getScale();return new l({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(o)?o.slice():o,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc()})},l.prototype.getAnchor=function(){var o=this.normalizedAnchor_;if(!o){o=this.anchor_;var c=this.getSize();if(this.anchorXUnits_==Ru.FRACTION||this.anchorYUnits_==Ru.FRACTION){if(!c)return null;o=this.anchor_.slice(),this.anchorXUnits_==Ru.FRACTION&&(o[0]*=c[0]),this.anchorYUnits_==Ru.FRACTION&&(o[1]*=c[1])}if(this.anchorOrigin_!=Os.TOP_LEFT){if(!c)return null;o===this.anchor_&&(o=this.anchor_.slice()),(this.anchorOrigin_==Os.TOP_RIGHT||this.anchorOrigin_==Os.BOTTOM_RIGHT)&&(o[0]=-o[0]+c[0]),(this.anchorOrigin_==Os.BOTTOM_LEFT||this.anchorOrigin_==Os.BOTTOM_RIGHT)&&(o[1]=-o[1]+c[1])}this.normalizedAnchor_=o}var i=this.getDisplacement();return[o[0]-i[0],o[1]+i[1]]},l.prototype.setAnchor=function(o){this.anchor_=o,this.normalizedAnchor_=null},l.prototype.getColor=function(){return this.color_},l.prototype.getImage=function(o){return this.iconImage_.getImage(o)},l.prototype.getPixelRatio=function(o){return this.iconImage_.getPixelRatio(o)},l.prototype.getImageSize=function(){return this.iconImage_.getSize()},l.prototype.getImageState=function(){return this.iconImage_.getImageState()},l.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},l.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var o=this.offset_;if(this.offsetOrigin_!=Os.TOP_LEFT){var c=this.getSize(),i=this.iconImage_.getSize();if(!c||!i)return null;o=o.slice(),(this.offsetOrigin_==Os.TOP_RIGHT||this.offsetOrigin_==Os.BOTTOM_RIGHT)&&(o[0]=i[0]-c[0]-o[0]),(this.offsetOrigin_==Os.BOTTOM_LEFT||this.offsetOrigin_==Os.BOTTOM_RIGHT)&&(o[1]=i[1]-c[1]-o[1])}return this.origin_=o,this.origin_},l.prototype.getSrc=function(){return this.iconImage_.getSrc()},l.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},l.prototype.listenImageChange=function(o){this.iconImage_.addEventListener(Vi.CHANGE,o)},l.prototype.load=function(){this.iconImage_.load()},l.prototype.unlistenImageChange=function(o){this.iconImage_.removeEventListener(Vi.CHANGE,o)},l}(Fm),s_=s2;var $l=.5;function o0(v,l,o,c,i,u,P){var D=v[0]*$l,F=v[1]*$l,U=Ga(D,F);U.imageSmoothingEnabled=!1;for(var N=U.canvas,at=new e0(U,$l,i,null,P),yt=o.length,Tt=Math.floor((256*256*256-1)/yt),Lt={},Vt=1;Vt<=yt;++Vt){var wt=o[Vt-1],kt=wt.getStyleFunction()||c;if(!!c){var Zt=kt(wt,u);if(!!Zt){Array.isArray(Zt)||(Zt=[Zt]);for(var Yt=Vt*Tt,le="#"+("000000"+Yt.toString(16)).slice(-6),ue=0,oe=Zt.length;ue<oe;++ue){var ge=Zt[ue],we=ge.getGeometryFunction()(wt);if(!(!we||!Ao(i,we.getExtent()))){var Pe=ge.clone(),ir=Pe.getFill();ir&&ir.setColor(le);var Be=Pe.getStroke();Be&&(Be.setColor(le),Be.setLineDash(null)),Pe.setText(void 0);var qe=ge.getImage();if(qe&&qe.getOpacity()!==0){var rr=qe.getImageSize();if(!rr)continue;var Ce=Ga(rr[0],rr[1],void 0,{alpha:!1}),Lr=Ce.canvas;Ce.fillStyle=le,Ce.fillRect(0,0,Lr.width,Lr.height),Pe.setImage(new s_({img:Lr,imgSize:rr,anchor:qe.getAnchor(),anchorXUnits:Ru.PIXELS,anchorYUnits:Ru.PIXELS,offset:qe.getOrigin(),opacity:1,size:qe.getSize(),scale:qe.getScale(),rotation:qe.getRotation(),rotateWithView:qe.getRotateWithView()}))}var yr=Pe.getZIndex()||0,_r=Lt[yr];_r||(_r={},Lt[yr]=_r,_r[Ie.POLYGON]=[],_r[Ie.CIRCLE]=[],_r[Ie.LINE_STRING]=[],_r[Ie.POINT]=[]),_r[we.getType().replace("Multi","")].push(we,Pe)}}}}}for(var br=Object.keys(Lt).map(Number).sort(rh),Vt=0,xr=br.length;Vt<xr;++Vt){var _r=Lt[br[Vt]];for(var pr in _r)for(var $r=_r[pr],ue=0,oe=$r.length;ue<oe;ue+=2){at.setStyle($r[ue+1]);for(var Fe=0,ti=l.length;Fe<ti;++Fe)at.setTransform(l[Fe]),at.drawGeometry($r[ue])}}return U.getImageData(0,0,N.width,N.height)}function a0(v,l,o){var c=[];if(o){var i=Math.floor(Math.round(v[0])*$l),u=Math.floor(Math.round(v[1])*$l),P=(jl(i,0,o.width-1)+jl(u,0,o.height-1)*o.width)*4,D=o.data[P],F=o.data[P+1],U=o.data[P+2],N=U+256*(F+256*D),at=Math.floor((256*256*256-1)/l.length);N&&N%at===0&&c.push(l[N/at-1])}return c}var l2=.5,s0={Point:m2,LineString:p2,Polygon:y2,MultiPoint:g2,MultiLineString:f2,MultiPolygon:d2,GeometryCollection:h2,Circle:u2};function l0(v,l){return parseInt(wi(v),10)-parseInt(wi(l),10)}function u0(v,l){var o=Gm(v,l);return o*o}function Gm(v,l){return l2*v/l}function u2(v,l,o,c,i){var u=o.getFill(),P=o.getStroke();if(u||P){var D=v.getBuilder(o.getZIndex(),zn.CIRCLE);D.setFillStrokeStyle(u,P),D.drawCircle(l,c)}var F=o.getText();if(F&&F.getText()){var U=(i||v).getBuilder(o.getZIndex(),zn.TEXT);U.setTextStyle(F),U.drawText(l,c)}}function l_(v,l,o,c,i,u,P){var D=!1,F=o.getImage();if(F){var U=F.getImageState();U==zi.LOADED||U==zi.ERROR?F.unlistenImageChange(i):(U==zi.IDLE&&F.load(),U=F.getImageState(),F.listenImageChange(i),D=!0)}return c2(v,l,o,c,u,P),D}function c2(v,l,o,c,i,u){var P=o.getGeometryFunction()(l);if(!!P){var D=P.simplifyTransformed(c,i),F=o.getRenderer();if(F)c0(v,D,o,l);else{var U=s0[D.getType()];U(v,D,o,l,u)}}}function c0(v,l,o,c){if(l.getType()==Ie.GEOMETRY_COLLECTION){for(var i=l.getGeometries(),u=0,P=i.length;u<P;++u)c0(v,i[u],o,c);return}var D=v.getBuilder(o.getZIndex(),zn.DEFAULT);D.drawCustom(l,c,o.getRenderer(),o.getHitDetectionRenderer())}function h2(v,l,o,c,i){var u=l.getGeometriesArray(),P,D;for(P=0,D=u.length;P<D;++P){var F=s0[u[P].getType()];F(v,u[P],o,c,i)}}function p2(v,l,o,c,i){var u=o.getStroke();if(u){var P=v.getBuilder(o.getZIndex(),zn.LINE_STRING);P.setFillStrokeStyle(null,u),P.drawLineString(l,c)}var D=o.getText();if(D&&D.getText()){var F=(i||v).getBuilder(o.getZIndex(),zn.TEXT);F.setTextStyle(D),F.drawText(l,c)}}function f2(v,l,o,c,i){var u=o.getStroke();if(u){var P=v.getBuilder(o.getZIndex(),zn.LINE_STRING);P.setFillStrokeStyle(null,u),P.drawMultiLineString(l,c)}var D=o.getText();if(D&&D.getText()){var F=(i||v).getBuilder(o.getZIndex(),zn.TEXT);F.setTextStyle(D),F.drawText(l,c)}}function d2(v,l,o,c,i){var u=o.getFill(),P=o.getStroke();if(P||u){var D=v.getBuilder(o.getZIndex(),zn.POLYGON);D.setFillStrokeStyle(u,P),D.drawMultiPolygon(l,c)}var F=o.getText();if(F&&F.getText()){var U=(i||v).getBuilder(o.getZIndex(),zn.TEXT);U.setTextStyle(F),U.drawText(l,c)}}function m2(v,l,o,c,i){var u=o.getImage(),P=o.getText(),D;if(i&&(v=i,D=u&&P&&P.getText()?{}:void 0),u){if(u.getImageState()!=zi.LOADED)return;var F=v.getBuilder(o.getZIndex(),zn.IMAGE);F.setImageStyle(u,D),F.drawPoint(l,c)}if(P&&P.getText()){var U=v.getBuilder(o.getZIndex(),zn.TEXT);U.setTextStyle(P,D),U.drawText(l,c)}}function g2(v,l,o,c,i){var u=o.getImage(),P=o.getText(),D;if(i&&(v=i,D=u&&P&&P.getText()?{}:void 0),u){if(u.getImageState()!=zi.LOADED)return;var F=v.getBuilder(o.getZIndex(),zn.IMAGE);F.setImageStyle(u,D),F.drawMultiPoint(l,c)}if(P&&P.getText()){var U=(i||v).getBuilder(o.getZIndex(),zn.TEXT);U.setTextStyle(P,D),U.drawText(l,c)}}function y2(v,l,o,c,i){var u=o.getFill(),P=o.getStroke();if(u||P){var D=v.getBuilder(o.getZIndex(),zn.POLYGON);D.setFillStrokeStyle(u,P),D.drawPolygon(l,c)}var F=o.getText();if(F&&F.getText()){var U=(i||v).getBuilder(o.getZIndex(),zn.TEXT);U.setTextStyle(F),U.drawText(l,c)}}var _2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),v2=function(v){_2(l,v);function l(o){var c=v.call(this,o)||this;return c.boundHandleStyleImageChange_=c.handleStyleImageChange_.bind(c),c.animatingOrInteracting_,c.dirty_=!1,c.hitDetectionImageData_=null,c.renderedFeatures_=null,c.renderedRevision_=-1,c.renderedResolution_=NaN,c.renderedExtent_=Va(),c.wrappedRenderedExtent_=Va(),c.renderedRotation_,c.renderedCenter_=null,c.renderedProjection_=null,c.renderedRenderOrder_=null,c.replayGroup_=null,c.replayGroupChanged=!0,c.declutterExecutorGroup=null,c.clipping=!0,c}return l.prototype.renderWorlds=function(o,c,i){var u=c.extent,P=c.viewState,D=P.center,F=P.resolution,U=P.projection,N=P.rotation,at=U.getExtent(),yt=this.getLayer().getSource(),Tt=c.pixelRatio,Lt=c.viewHints,Vt=!(Lt[md.ANIMATING]||Lt[md.INTERACTING]),wt=this.context,kt=Math.round(c.size[0]*Tt),Zt=Math.round(c.size[1]*Tt),Yt=yt.getWrapX()&&U.canWrapX(),le=Yt?hs(at):null,ue=Yt?Math.ceil((u[2]-at[2])/le)+1:1,oe=Yt?Math.floor((u[0]-at[0])/le):0;do{var ge=this.getRenderTransform(D,F,N,Tt,kt,Zt,oe*le);o.execute(wt,1,ge,N,Vt,void 0,i)}while(++oe<ue)},l.prototype.renderDeclutter=function(o){this.declutterExecutorGroup&&this.renderWorlds(this.declutterExecutorGroup,o,o.declutterTree)},l.prototype.renderFrame=function(o,c){var i=o.pixelRatio,u=o.layerStatesArray[o.layerIndex];Tv(this.pixelTransform,1/i,1/i),Cv(this.inversePixelTransform,this.pixelTransform);var P=sy(this.pixelTransform);this.useContainer(c,P,u.opacity,this.getBackground(o));var D=this.context,F=D.canvas,U=this.replayGroup_,N=this.declutterExecutorGroup;if((!U||U.isEmpty())&&(!N||N.isEmpty()))return null;var at=Math.round(o.size[0]*i),yt=Math.round(o.size[1]*i);F.width!=at||F.height!=yt?(F.width=at,F.height=yt,F.style.transform!==P&&(F.style.transform=P)):this.containerReused||D.clearRect(0,0,at,yt),this.preRender(D,o);var Tt=o.viewState,Lt=Tt.projection,Vt=!1,wt=!0;if(u.extent&&this.clipping){var kt=Qf(u.extent,Lt);wt=Ao(kt,o.extent),Vt=wt&&!mc(kt,o.extent),Vt&&this.clipUnrotated(D,o,kt)}wt&&this.renderWorlds(U,o),Vt&&D.restore(),this.postRender(D,o);var Zt=Mx(u.opacity),Yt=this.container;return Zt!==Yt.style.opacity&&(Yt.style.opacity=Zt),this.renderedRotation_!==Tt.rotation&&(this.renderedRotation_=Tt.rotation,this.hitDetectionImageData_=null),this.container},l.prototype.getFeatures=function(o){return new Promise(function(c){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var i=[this.context.canvas.width,this.context.canvas.height];uo(this.pixelTransform,i);var u=this.renderedCenter_,P=this.renderedResolution_,D=this.renderedRotation_,F=this.renderedProjection_,U=this.wrappedRenderedExtent_,N=this.getLayer(),at=[],yt=i[0]*$l,Tt=i[1]*$l;at.push(this.getRenderTransform(u,P,D,$l,yt,Tt,0).slice());var Lt=N.getSource(),Vt=F.getExtent();if(Lt.getWrapX()&&F.canWrapX()&&!mc(Vt,U)){for(var wt=U[0],kt=hs(Vt),Zt=0,Yt=void 0;wt<Vt[0];)--Zt,Yt=kt*Zt,at.push(this.getRenderTransform(u,P,D,$l,yt,Tt,Yt).slice()),wt+=kt;for(Zt=0,wt=U[2];wt>Vt[2];)++Zt,Yt=kt*Zt,at.push(this.getRenderTransform(u,P,D,$l,yt,Tt,Yt).slice()),wt-=kt}this.hitDetectionImageData_=o0(i,at,this.renderedFeatures_,N.getStyleFunction(),U,P,D)}c(a0(o,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},l.prototype.forEachFeatureAtCoordinate=function(o,c,i,u,P){var D=this;if(!!this.replayGroup_){var F=c.viewState.resolution,U=c.viewState.rotation,N=this.getLayer(),at={},yt=function(Vt,wt,kt){var Zt=wi(Vt),Yt=at[Zt];if(Yt){if(Yt!==!0&&kt<Yt.distanceSq){if(kt===0)return at[Zt]=!0,P.splice(P.lastIndexOf(Yt),1),u(Vt,N,wt);Yt.geometry=wt,Yt.distanceSq=kt}}else{if(kt===0)return at[Zt]=!0,u(Vt,N,wt);P.push(at[Zt]={feature:Vt,layer:N,geometry:wt,distanceSq:kt,callback:u})}},Tt,Lt=[this.replayGroup_];return this.declutterExecutorGroup&&Lt.push(this.declutterExecutorGroup),Lt.some(function(Vt){return Tt=Vt.forEachFeatureAtCoordinate(o,F,U,i,yt,Vt===D.declutterExecutorGroup&&c.declutterTree?c.declutterTree.all().map(function(wt){return wt.value}):null)}),Tt}},l.prototype.handleFontsChanged=function(){var o=this.getLayer();o.getVisible()&&this.replayGroup_&&o.changed()},l.prototype.handleStyleImageChange_=function(o){this.renderIfReadyAndVisible()},l.prototype.prepareFrame=function(o){var c=this.getLayer(),i=c.getSource();if(!i)return!1;var u=o.viewHints[md.ANIMATING],P=o.viewHints[md.INTERACTING],D=c.getUpdateWhileAnimating(),F=c.getUpdateWhileInteracting();if(!this.dirty_&&!D&&u||!F&&P)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var U=o.extent,N=o.viewState,at=N.projection,yt=N.resolution,Tt=o.pixelRatio,Lt=c.getRevision(),Vt=c.getRenderBuffer(),wt=c.getRenderOrder();wt===void 0&&(wt=l0);var kt=N.center.slice(),Zt=rl(U,Vt*yt),Yt=Zt.slice(),le=[Zt.slice()],ue=at.getExtent();if(i.getWrapX()&&at.canWrapX()&&!mc(ue,o.extent)){var oe=hs(ue),ge=Math.max(hs(Zt)/2,oe);Zt[0]=ue[0]-ge,Zt[2]=ue[2]+ge,Wv(kt,at);var we=Zv(le[0],at);we[0]<ue[0]&&we[2]<ue[2]?le.push([we[0]+oe,we[1],we[2]+oe,we[3]]):we[0]>ue[0]&&we[2]>ue[2]&&le.push([we[0]-oe,we[1],we[2]-oe,we[3]])}if(!this.dirty_&&this.renderedResolution_==yt&&this.renderedRevision_==Lt&&this.renderedRenderOrder_==wt&&mc(this.wrappedRenderedExtent_,Zt))return ls(this.renderedExtent_,Yt)||(this.hitDetectionImageData_=null,this.renderedExtent_=Yt),this.renderedCenter_=kt,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var Pe=new e_(Gm(yt,Tt),Zt,yt,Tt),ir;this.getLayer().getDeclutter()&&(ir=new e_(Gm(yt,Tt),Zt,yt,Tt));var Be=uh(),qe;if(Be){for(var rr=0,Ce=le.length;rr<Ce;++rr){var Lr=le[rr],yr=$p(Lr,at);i.loadFeatures(yr,Hv(yt,at),Be)}qe=Em(Be,at)}else for(var rr=0,Ce=le.length;rr<Ce;++rr)i.loadFeatures(le[rr],yt,at);var _r=u0(yt,Tt),br=function(ti){var oi,ci=ti.getStyleFunction()||c.getStyleFunction();if(ci&&(oi=ci(ti,yt)),oi){var Ri=this.renderFeature(ti,_r,oi,Pe,qe,ir);this.dirty_=this.dirty_||Ri}}.bind(this),xr=$p(Zt,at),pr=i.getFeaturesInExtent(xr);wt&&pr.sort(wt);for(var rr=0,Ce=pr.length;rr<Ce;++rr)br(pr[rr]);this.renderedFeatures_=pr;var $r=Pe.finish(),Fe=new n_(Zt,yt,Tt,i.getOverlaps(),$r,c.getRenderBuffer());return ir&&(this.declutterExecutorGroup=new n_(Zt,yt,Tt,i.getOverlaps(),ir.finish(),c.getRenderBuffer())),this.renderedResolution_=yt,this.renderedRevision_=Lt,this.renderedRenderOrder_=wt,this.renderedExtent_=Yt,this.wrappedRenderedExtent_=Zt,this.renderedCenter_=kt,this.renderedProjection_=at,this.replayGroup_=Fe,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0},l.prototype.renderFeature=function(o,c,i,u,P,D){if(!i)return!1;var F=!1;if(Array.isArray(i))for(var U=0,N=i.length;U<N;++U)F=l_(u,o,i[U],c,this.boundHandleStyleImageChange_,P,D)||F;else F=l_(u,o,i,c,this.boundHandleStyleImageChange_,P,D);return F},l}(Yx),h0=v2;var x2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),b2=function(v){x2(l,v);function l(o){return v.call(this,o)||this}return l.prototype.createRenderer=function(){return new h0(this)},l}(jx),np=b2;var p0=Fp(Jy(),1);var w2=function(){function v(l){this.rbush_=new p0.default(l),this.items_={}}return v.prototype.insert=function(l,o){var c={minX:l[0],minY:l[1],maxX:l[2],maxY:l[3],value:o};this.rbush_.insert(c),this.items_[wi(o)]=c},v.prototype.load=function(l,o){for(var c=new Array(o.length),i=0,u=o.length;i<u;i++){var P=l[i],D=o[i],F={minX:P[0],minY:P[1],maxX:P[2],maxY:P[3],value:D};c[i]=F,this.items_[wi(D)]=F}this.rbush_.load(c)},v.prototype.remove=function(l){var o=wi(l),c=this.items_[o];return delete this.items_[o],this.rbush_.remove(c)!==null},v.prototype.update=function(l,o){var c=this.items_[wi(o)],i=[c.minX,c.minY,c.maxX,c.maxY];wm(i,l)||(this.remove(o),this.insert(l,o))},v.prototype.getAll=function(){var l=this.rbush_.all();return l.map(function(o){return o.value})},v.prototype.getInExtent=function(l){var o={minX:l[0],minY:l[1],maxX:l[2],maxY:l[3]},c=this.rbush_.search(o);return c.map(function(i){return i.value})},v.prototype.forEach=function(l){return this.forEach_(this.getAll(),l)},v.prototype.forEachInExtent=function(l,o){return this.forEach_(this.getInExtent(l),o)},v.prototype.forEach_=function(l,o){for(var c,i=0,u=l.length;i<u;i++)if(c=o(l[i]),c)return c;return c},v.prototype.isEmpty=function(){return Vl(this.items_)},v.prototype.clear=function(){this.rbush_.clear(),this.items_={}},v.prototype.getExtent=function(l){var o=this.rbush_.toJSON();return sh(o.minX,o.minY,o.maxX,o.maxY,l)},v.prototype.concat=function(l){this.rbush_.load(l.rbush_.all());for(var o in l.items_)this.items_[o]=l.items_[o]},v}(),yd=w2;var E2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),S2=function(v){E2(l,v);function l(o){var c=v.call(this)||this;c.projection=ta(o.projection),c.attributions_=f0(o.attributions),c.attributionsCollapsible_=o.attributionsCollapsible!==void 0?o.attributionsCollapsible:!0,c.loading=!1,c.state_=o.state!==void 0?o.state:Mu.READY,c.wrapX_=o.wrapX!==void 0?o.wrapX:!1,c.interpolate_=!!o.interpolate,c.viewResolver=null,c.viewRejector=null;var i=c;return c.viewPromise_=new Promise(function(u,P){i.viewResolver=u,i.viewRejector=P}),c}return l.prototype.getAttributions=function(){return this.attributions_},l.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},l.prototype.getProjection=function(){return this.projection},l.prototype.getResolutions=function(){return Fr()},l.prototype.getView=function(){return this.viewPromise_},l.prototype.getState=function(){return this.state_},l.prototype.getWrapX=function(){return this.wrapX_},l.prototype.getInterpolate=function(){return this.interpolate_},l.prototype.refresh=function(){this.changed()},l.prototype.setAttributions=function(o){this.attributions_=f0(o),this.changed()},l.prototype.setState=function(o){this.state_=o,this.changed()},l}(Io);function f0(v){return v?Array.isArray(v)?function(l){return v}:typeof v=="function"?v:function(l){return[v]}:null}var nf=S2;var ja={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function d0(v,l){return[[-1/0,-1/0,1/0,1/0]]}var vh={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var T2=!1;function I2(v,l,o,c,i,u,P){var D=new XMLHttpRequest;D.open("GET",typeof v=="function"?v(o,c,i):v,!0),l.getType()==vh.ARRAY_BUFFER&&(D.responseType="arraybuffer"),D.withCredentials=T2,D.onload=function(F){if(!D.status||D.status>=200&&D.status<300){var U=l.getType(),N=void 0;U==vh.JSON||U==vh.TEXT?N=D.responseText:U==vh.XML?(N=D.responseXML,N||(N=new DOMParser().parseFromString(D.responseText,"application/xml"))):U==vh.ARRAY_BUFFER&&(N=D.response),N?u(l.readFeatures(N,{extent:o,featureProjection:i}),l.readProjection(N)):P()}else P()},D.onerror=P,D.send()}function u_(v,l){return function(o,c,i,u,P){var D=this;I2(v,l,o,c,i,function(F,U){D.addFeatures(F),u!==void 0&&u(F)},P||Wh)}}var m0=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),xh=function(v){m0(l,v);function l(o,c,i){var u=v.call(this,o)||this;return u.feature=c,u.features=i,u}return l}(ss);var C2=function(v){m0(l,v);function l(o){var c=this,i=o||{};c=v.call(this,{attributions:i.attributions,interpolate:!0,projection:void 0,state:Mu.READY,wrapX:i.wrapX!==void 0?i.wrapX:!0})||this,c.on,c.once,c.un,c.loader_=Wh,c.format_=i.format,c.overlaps_=i.overlaps===void 0?!0:i.overlaps,c.url_=i.url,i.loader!==void 0?c.loader_=i.loader:c.url_!==void 0&&(fn(c.format_,7),c.loader_=u_(c.url_,c.format_)),c.strategy_=i.strategy!==void 0?i.strategy:d0;var u=i.useSpatialIndex!==void 0?i.useSpatialIndex:!0;c.featuresRtree_=u?new yd:null,c.loadedExtentsRtree_=new yd,c.loadingExtentsCount_=0,c.nullGeometryFeatures_={},c.idIndex_={},c.uidIndex_={},c.featureChangeKeys_={},c.featuresCollection_=null;var P,D;return Array.isArray(i.features)?D=i.features:i.features&&(P=i.features,D=P.getArray()),!u&&P===void 0&&(P=new hh(D)),D!==void 0&&c.addFeaturesInternal(D),P!==void 0&&c.bindFeaturesCollection_(P),c}return l.prototype.addFeature=function(o){this.addFeatureInternal(o),this.changed()},l.prototype.addFeatureInternal=function(o){var c=wi(o);if(!this.addToIndex_(c,o)){this.featuresCollection_&&this.featuresCollection_.remove(o);return}this.setupChangeEvents_(c,o);var i=o.getGeometry();if(i){var u=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(u,o)}else this.nullGeometryFeatures_[c]=o;this.dispatchEvent(new xh(ja.ADDFEATURE,o))},l.prototype.setupChangeEvents_=function(o,c){this.featureChangeKeys_[o]=[eo(c,Vi.CHANGE,this.handleFeatureChange_,this),eo(c,Bp.PROPERTYCHANGE,this.handleFeatureChange_,this)]},l.prototype.addToIndex_=function(o,c){var i=!0,u=c.getId();return u!==void 0&&(u.toString()in this.idIndex_?i=!1:this.idIndex_[u.toString()]=c),i&&(fn(!(o in this.uidIndex_),30),this.uidIndex_[o]=c),i},l.prototype.addFeatures=function(o){this.addFeaturesInternal(o),this.changed()},l.prototype.addFeaturesInternal=function(o){for(var c=[],i=[],u=[],P=0,D=o.length;P<D;P++){var F=o[P],U=wi(F);this.addToIndex_(U,F)&&i.push(F)}for(var P=0,N=i.length;P<N;P++){var F=i[P],U=wi(F);this.setupChangeEvents_(U,F);var at=F.getGeometry();if(at){var yt=at.getExtent();c.push(yt),u.push(F)}else this.nullGeometryFeatures_[U]=F}if(this.featuresRtree_&&this.featuresRtree_.load(c,u),this.hasListener(ja.ADDFEATURE))for(var P=0,Tt=i.length;P<Tt;P++)this.dispatchEvent(new xh(ja.ADDFEATURE,i[P]))},l.prototype.bindFeaturesCollection_=function(o){var c=!1;this.addEventListener(ja.ADDFEATURE,function(i){c||(c=!0,o.push(i.feature),c=!1)}),this.addEventListener(ja.REMOVEFEATURE,function(i){c||(c=!0,o.remove(i.feature),c=!1)}),o.addEventListener(ps.ADD,function(i){c||(c=!0,this.addFeature(i.element),c=!1)}.bind(this)),o.addEventListener(ps.REMOVE,function(i){c||(c=!0,this.removeFeature(i.element),c=!1)}.bind(this)),this.featuresCollection_=o},l.prototype.clear=function(o){if(o){for(var c in this.featureChangeKeys_){var i=this.featureChangeKeys_[c];i.forEach(To)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){var u=function(F){this.removeFeatureInternal(F)}.bind(this);this.featuresRtree_.forEach(u);for(var P in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[P])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};var D=new xh(ja.CLEAR);this.dispatchEvent(D),this.changed()},l.prototype.forEachFeature=function(o){if(this.featuresRtree_)return this.featuresRtree_.forEach(o);this.featuresCollection_&&this.featuresCollection_.forEach(o)},l.prototype.forEachFeatureAtCoordinateDirect=function(o,c){var i=[o[0],o[1],o[0],o[1]];return this.forEachFeatureInExtent(i,function(u){var P=u.getGeometry();if(P.intersectsCoordinate(o))return c(u)})},l.prototype.forEachFeatureInExtent=function(o,c){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(o,c);this.featuresCollection_&&this.featuresCollection_.forEach(c)},l.prototype.forEachFeatureIntersectingExtent=function(o,c){return this.forEachFeatureInExtent(o,function(i){var u=i.getGeometry();if(u.intersectsExtent(o)){var P=c(i);if(P)return P}})},l.prototype.getFeaturesCollection=function(){return this.featuresCollection_},l.prototype.getFeatures=function(){var o;return this.featuresCollection_?o=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(o=this.featuresRtree_.getAll(),Vl(this.nullGeometryFeatures_)||Ua(o,cm(this.nullGeometryFeatures_))),o},l.prototype.getFeaturesAtCoordinate=function(o){var c=[];return this.forEachFeatureAtCoordinateDirect(o,function(i){c.push(i)}),c},l.prototype.getFeaturesInExtent=function(o){return this.featuresRtree_?this.featuresRtree_.getInExtent(o):this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]},l.prototype.getClosestFeatureToCoordinate=function(o,c){var i=o[0],u=o[1],P=null,D=[NaN,NaN],F=1/0,U=[-1/0,-1/0,1/0,1/0],N=c||um;return this.featuresRtree_.forEachInExtent(U,function(at){if(N(at)){var yt=at.getGeometry(),Tt=F;if(F=yt.closestPointXY(i,u,D,F),F<Tt){P=at;var Lt=Math.sqrt(F);U[0]=i-Lt,U[1]=u-Lt,U[2]=i+Lt,U[3]=u+Lt}}}),P},l.prototype.getExtent=function(o){return this.featuresRtree_.getExtent(o)},l.prototype.getFeatureById=function(o){var c=this.idIndex_[o.toString()];return c!==void 0?c:null},l.prototype.getFeatureByUid=function(o){var c=this.uidIndex_[o];return c!==void 0?c:null},l.prototype.getFormat=function(){return this.format_},l.prototype.getOverlaps=function(){return this.overlaps_},l.prototype.getUrl=function(){return this.url_},l.prototype.handleFeatureChange_=function(o){var c=o.target,i=wi(c),u=c.getGeometry();if(!u)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(c),this.nullGeometryFeatures_[i]=c);else{var P=u.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(P,c)):this.featuresRtree_&&this.featuresRtree_.update(P,c)}var D=c.getId();if(D!==void 0){var F=D.toString();this.idIndex_[F]!==c&&(this.removeFromIdIndex_(c),this.idIndex_[F]=c)}else this.removeFromIdIndex_(c),this.uidIndex_[i]=c;this.changed(),this.dispatchEvent(new xh(ja.CHANGEFEATURE,c))},l.prototype.hasFeature=function(o){var c=o.getId();return c!==void 0?c in this.idIndex_:wi(o)in this.uidIndex_},l.prototype.isEmpty=function(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Vl(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0},l.prototype.loadFeatures=function(o,c,i){for(var u=this.loadedExtentsRtree_,P=this.strategy_(o,c,i),D=function(at,yt){var Tt=P[at],Lt=u.forEachInExtent(Tt,function(Vt){return mc(Vt.extent,Tt)});Lt||(++F.loadingExtentsCount_,F.dispatchEvent(new xh(ja.FEATURESLOADSTART)),F.loader_.call(F,Tt,c,i,function(Vt){--this.loadingExtentsCount_,this.dispatchEvent(new xh(ja.FEATURESLOADEND,void 0,Vt))}.bind(F),function(){--this.loadingExtentsCount_,this.dispatchEvent(new xh(ja.FEATURESLOADERROR))}.bind(F)),u.insert(Tt,{extent:Tt.slice()}))},F=this,U=0,N=P.length;U<N;++U)D(U,N);this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0},l.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),v.prototype.refresh.call(this)},l.prototype.removeLoadedExtent=function(o){var c=this.loadedExtentsRtree_,i;c.forEachInExtent(o,function(u){if(wm(u.extent,o))return i=u,!0}),i&&c.remove(i)},l.prototype.removeFeature=function(o){if(!!o){var c=wi(o);c in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[c]:this.featuresRtree_&&this.featuresRtree_.remove(o);var i=this.removeFeatureInternal(o);i&&this.changed()}},l.prototype.removeFeatureInternal=function(o){var c=wi(o),i=this.featureChangeKeys_[c];if(!!i){i.forEach(To),delete this.featureChangeKeys_[c];var u=o.getId();return u!==void 0&&delete this.idIndex_[u.toString()],delete this.uidIndex_[c],this.dispatchEvent(new xh(ja.REMOVEFEATURE,o)),o}},l.prototype.removeFromIdIndex_=function(o){var c=!1;for(var i in this.idIndex_)if(this.idIndex_[i]===o){delete this.idIndex_[i],c=!0;break}return c},l.prototype.setLoader=function(o){this.loader_=o},l.prototype.setUrl=function(o){fn(this.format_,7),this.url_=o,this.setLoader(u_(o,this.format_))},l}(nf),op=C2;var g0=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),of=function(v){g0(l,v);function l(o,c){var i=v.call(this,o)||this;return i.layer=c,i}return l}(ss);var c_={LAYERS:"layers"},A2=function(v){g0(l,v);function l(o){var c=this,i=o||{},u=_a({},i);delete u.layers;var P=i.layers;return c=v.call(this,u)||this,c.on,c.once,c.un,c.layersListenerKeys_=[],c.listenerKeys_={},c.addChangeListener(c_.LAYERS,c.handleLayersChanged_),P?Array.isArray(P)?P=new hh(P.slice(),{unique:!0}):fn(typeof P.getArray=="function",43):P=new hh(void 0,{unique:!0}),c.setLayers(P),c}return l.prototype.handleLayerChange_=function(){this.changed()},l.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(To),this.layersListenerKeys_.length=0;var o=this.getLayers();this.layersListenerKeys_.push(eo(o,ps.ADD,this.handleLayersAdd_,this),eo(o,ps.REMOVE,this.handleLayersRemove_,this));for(var c in this.listenerKeys_)this.listenerKeys_[c].forEach(To);ih(this.listenerKeys_);for(var i=o.getArray(),u=0,P=i.length;u<P;u++){var D=i[u];this.registerLayerListeners_(D),this.dispatchEvent(new of("addlayer",D))}this.changed()},l.prototype.registerLayerListeners_=function(o){var c=[eo(o,Bp.PROPERTYCHANGE,this.handleLayerChange_,this),eo(o,Vi.CHANGE,this.handleLayerChange_,this)];o instanceof l&&c.push(eo(o,"addlayer",this.handleLayerGroupAdd_,this),eo(o,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[wi(o)]=c},l.prototype.handleLayerGroupAdd_=function(o){this.dispatchEvent(new of("addlayer",o.layer))},l.prototype.handleLayerGroupRemove_=function(o){this.dispatchEvent(new of("removelayer",o.layer))},l.prototype.handleLayersAdd_=function(o){var c=o.element;this.registerLayerListeners_(c),this.dispatchEvent(new of("addlayer",c)),this.changed()},l.prototype.handleLayersRemove_=function(o){var c=o.element,i=wi(c);this.listenerKeys_[i].forEach(To),delete this.listenerKeys_[i],this.dispatchEvent(new of("removelayer",c)),this.changed()},l.prototype.getLayers=function(){return this.get(c_.LAYERS)},l.prototype.setLayers=function(o){var c=this.getLayers();if(c)for(var i=c.getArray(),u=0,P=i.length;u<P;++u)this.dispatchEvent(new of("removelayer",i[u]));this.set(c_.LAYERS,o)},l.prototype.getLayersArray=function(o){var c=o!==void 0?o:[];return this.getLayers().forEach(function(i){i.getLayersArray(c)}),c},l.prototype.getLayerStatesArray=function(o){var c=o!==void 0?o:[],i=c.length;this.getLayers().forEach(function(N){N.getLayerStatesArray(c)});var u=this.getLayerState(),P=u.zIndex;!o&&u.zIndex===void 0&&(P=0);for(var D=i,F=c.length;D<F;D++){var U=c[D];U.opacity*=u.opacity,U.visible=U.visible&&u.visible,U.maxResolution=Math.min(U.maxResolution,u.maxResolution),U.minResolution=Math.max(U.minResolution,u.minResolution),U.minZoom=Math.max(U.minZoom,u.minZoom),U.maxZoom=Math.min(U.maxZoom,u.maxZoom),u.extent!==void 0&&(U.extent!==void 0?U.extent=Vv(U.extent,u.extent):U.extent=u.extent),U.zIndex===void 0&&(U.zIndex=P)}return c},l.prototype.getSourceState=function(){return Mu.READY},l}(Cm),h_=A2;var Xo={SINGLECLICK:"singleclick",CLICK:Vi.CLICK,DBLCLICK:Vi.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var p_={ACTIVE:"active"};var P2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),M2=function(v){P2(l,v);function l(o){var c=v.call(this)||this;return c.on,c.once,c.un,o&&o.handleEvent&&(c.handleEvent=o.handleEvent),c.map_=null,c.setActive(!0),c}return l.prototype.getActive=function(){return this.get(p_.ACTIVE)},l.prototype.getMap=function(){return this.map_},l.prototype.handleEvent=function(o){return!0},l.prototype.setActive=function(o){this.set(p_.ACTIVE,o)},l.prototype.setMap=function(o){this.map_=o},l}(Io);var y0=M2;var L2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),k2=function(v){L2(l,v);function l(o){var c=this,i=o||{};return c=v.call(this,i)||this,i.handleDownEvent&&(c.handleDownEvent=i.handleDownEvent),i.handleDragEvent&&(c.handleDragEvent=i.handleDragEvent),i.handleMoveEvent&&(c.handleMoveEvent=i.handleMoveEvent),i.handleUpEvent&&(c.handleUpEvent=i.handleUpEvent),i.stopDown&&(c.stopDown=i.stopDown),c.handlingDownUpSequence=!1,c.trackedPointers_={},c.targetPointers=[],c}return l.prototype.getPointerCount=function(){return this.targetPointers.length},l.prototype.handleDownEvent=function(o){return!1},l.prototype.handleDragEvent=function(o){},l.prototype.handleEvent=function(o){if(!o.originalEvent)return!0;var c=!1;if(this.updateTrackedPointers_(o),this.handlingDownUpSequence){if(o.type==Xo.POINTERDRAG)this.handleDragEvent(o),o.originalEvent.preventDefault();else if(o.type==Xo.POINTERUP){var i=this.handleUpEvent(o);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(o.type==Xo.POINTERDOWN){var u=this.handleDownEvent(o);this.handlingDownUpSequence=u,c=this.stopDown(u)}else o.type==Xo.POINTERMOVE&&this.handleMoveEvent(o);return!c},l.prototype.handleMoveEvent=function(o){},l.prototype.handleUpEvent=function(o){return!1},l.prototype.stopDown=function(o){return o},l.prototype.updateTrackedPointers_=function(o){if(z2(o)){var c=o.originalEvent,i=c.pointerId.toString();o.type==Xo.POINTERUP?delete this.trackedPointers_[i]:o.type==Xo.POINTERDOWN?this.trackedPointers_[i]=c:i in this.trackedPointers_&&(this.trackedPointers_[i]=c),this.targetPointers=cm(this.trackedPointers_)}},l}(y0);function z2(v){var l=v.type;return l===Xo.POINTERDOWN||l===Xo.POINTERDRAG||l===Xo.POINTERUP}var _0=k2;var v0=function(v){var l=v.originalEvent;return l.altKey&&!(l.metaKey||l.ctrlKey)&&!l.shiftKey};var x0=um,b0=function(v){return v.type==Xo.CLICK};var w0=function(v){return v.type==Xo.SINGLECLICK};var E0=function(v){var l=v.originalEvent;return fn(l!==void 0,56),l.isPrimary&&l.button===0};var R2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),D2=function(v){R2(l,v);function l(o,c,i){var u=v.call(this)||this;if(u.ends_=[],u.maxDelta_=-1,u.maxDeltaRevision_=-1,Array.isArray(o[0]))u.setCoordinates(o,c);else if(c!==void 0&&i)u.setFlatCoordinates(c,o),u.ends_=i;else{for(var P=u.getLayout(),D=o,F=[],U=[],N=0,at=D.length;N<at;++N){var yt=D[N];N===0&&(P=yt.getLayout()),Ua(F,yt.getFlatCoordinates()),U.push(F.length)}u.setFlatCoordinates(P,F),u.ends_=U}return u}return l.prototype.appendLineString=function(o){this.flatCoordinates?Ua(this.flatCoordinates,o.getFlatCoordinates().slice()):this.flatCoordinates=o.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},l.prototype.clone=function(){var o=new l(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return o.applyProperties(this),o},l.prototype.closestPointXY=function(o,c,i,u){return u<cs(this.getExtent(),o,c)?u:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(rd(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),nd(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,o,c,i,u))},l.prototype.getCoordinateAtM=function(o,c,i){if(this.layout!=_n.XYM&&this.layout!=_n.XYZM||this.flatCoordinates.length===0)return null;var u=c!==void 0?c:!1,P=i!==void 0?i:!1;return Cx(this.flatCoordinates,0,this.ends_,this.stride,o,u,P)},l.prototype.getCoordinates=function(){return fh(this.flatCoordinates,0,this.ends_,this.stride)},l.prototype.getEnds=function(){return this.ends_},l.prototype.getLineString=function(o){return o<0||this.ends_.length<=o?null:new yc(this.flatCoordinates.slice(o===0?0:this.ends_[o-1],this.ends_[o]),this.layout)},l.prototype.getLineStrings=function(){for(var o=this.flatCoordinates,c=this.ends_,i=this.layout,u=[],P=0,D=0,F=c.length;D<F;++D){var U=c[D],N=new yc(o.slice(P,U),i);u.push(N),P=U}return u},l.prototype.getFlatMidpoints=function(){for(var o=[],c=this.flatCoordinates,i=0,u=this.ends_,P=this.stride,D=0,F=u.length;D<F;++D){var U=u[D],N=Dm(c,i,U,P,.5);Ua(o,N),i=U}return o},l.prototype.getSimplifiedGeometryInternal=function(o){var c=[],i=[];return c.length=mx(this.flatCoordinates,0,this.ends_,this.stride,o,c,0,i),new l(c,_n.XY,i)},l.prototype.getType=function(){return Ie.MULTI_LINE_STRING},l.prototype.intersectsExtent=function(o){return bx(this.flatCoordinates,0,this.ends_,this.stride,o)},l.prototype.setCoordinates=function(o,c){this.setLayout(c,o,2),this.flatCoordinates||(this.flatCoordinates=[]);var i=od(this.flatCoordinates,0,o,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()},l}(fs),S0=D2;var O2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),F2=function(v){O2(l,v);function l(o,c){var i=v.call(this)||this;return c&&!Array.isArray(o[0])?i.setFlatCoordinates(c,o):i.setCoordinates(o,c),i}return l.prototype.appendPoint=function(o){this.flatCoordinates?Ua(this.flatCoordinates,o.getFlatCoordinates()):this.flatCoordinates=o.getFlatCoordinates().slice(),this.changed()},l.prototype.clone=function(){var o=new l(this.flatCoordinates.slice(),this.layout);return o.applyProperties(this),o},l.prototype.closestPointXY=function(o,c,i,u){if(u<cs(this.getExtent(),o,c))return u;for(var P=this.flatCoordinates,D=this.stride,F=0,U=P.length;F<U;F+=D){var N=ql(o,c,P[F],P[F+1]);if(N<u){u=N;for(var at=0;at<D;++at)i[at]=P[F+at];i.length=D}}return u},l.prototype.getCoordinates=function(){return nl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},l.prototype.getPoint=function(o){var c=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return o<0||c<=o?null:new ea(this.flatCoordinates.slice(o*this.stride,(o+1)*this.stride),this.layout)},l.prototype.getPoints=function(){for(var o=this.flatCoordinates,c=this.layout,i=this.stride,u=[],P=0,D=o.length;P<D;P+=i){var F=new ea(o.slice(P,P+i),c);u.push(F)}return u},l.prototype.getType=function(){return Ie.MULTI_POINT},l.prototype.intersectsExtent=function(o){for(var c=this.flatCoordinates,i=this.stride,u=0,P=c.length;u<P;u+=i){var D=c[u],F=c[u+1];if(Yf(o,D,F))return!0}return!1},l.prototype.setCoordinates=function(o,c){this.setLayout(c,o,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=tp(this.flatCoordinates,0,o,this.stride),this.changed()},l}(fs),jm=F2;function T0(v,l,o,c){for(var i=[],u=Va(),P=0,D=o.length;P<D;++P){var F=o[P];u=bm(v,l,F[0],c),i.push((u[0]+u[2])/2,(u[1]+u[3])/2),l=F[F.length-1]}return i}var B2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),U2=function(v){B2(l,v);function l(o,c,i){var u=v.call(this)||this;if(u.endss_=[],u.flatInteriorPointsRevision_=-1,u.flatInteriorPoints_=null,u.maxDelta_=-1,u.maxDeltaRevision_=-1,u.orientedRevision_=-1,u.orientedFlatCoordinates_=null,!i&&!Array.isArray(o[0])){for(var P=u.getLayout(),D=o,F=[],U=[],N=0,at=D.length;N<at;++N){var yt=D[N];N===0&&(P=yt.getLayout());for(var Tt=F.length,Lt=yt.getEnds(),Vt=0,wt=Lt.length;Vt<wt;++Vt)Lt[Vt]+=Tt;Ua(F,yt.getFlatCoordinates()),U.push(Lt)}c=P,o=F,i=U}return c!==void 0&&i?(u.setFlatCoordinates(c,o),u.endss_=i):u.setCoordinates(o,c),u}return l.prototype.appendPolygon=function(o){var c;if(!this.flatCoordinates)this.flatCoordinates=o.getFlatCoordinates().slice(),c=o.getEnds().slice(),this.endss_.push();else{var i=this.flatCoordinates.length;Ua(this.flatCoordinates,o.getFlatCoordinates()),c=o.getEnds().slice();for(var u=0,P=c.length;u<P;++u)c[u]+=i}this.endss_.push(c),this.changed()},l.prototype.clone=function(){for(var o=this.endss_.length,c=new Array(o),i=0;i<o;++i)c[i]=this.endss_[i].slice();var u=new l(this.flatCoordinates.slice(),this.layout,c);return u.applyProperties(this),u},l.prototype.closestPointXY=function(o,c,i,u){return u<cs(this.getExtent(),o,c)?u:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(hx(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),px(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,o,c,i,u))},l.prototype.containsXY=function(o,c){return vx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,o,c)},l.prototype.getArea=function(){return yx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)},l.prototype.getCoordinates=function(o){var c;return o!==void 0?(c=this.getOrientedFlatCoordinates().slice(),Vy(c,0,this.endss_,this.stride,o)):c=this.flatCoordinates,sd(c,0,this.endss_,this.stride)},l.prototype.getEndss=function(){return this.endss_},l.prototype.getFlatInteriorPoints=function(){if(this.flatInteriorPointsRevision_!=this.getRevision()){var o=T0(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=xx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,o),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_},l.prototype.getInteriorPoints=function(){return new jm(this.getFlatInteriorPoints().slice(),_n.XYM)},l.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var o=this.flatCoordinates;Tx(o,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=o:(this.orientedFlatCoordinates_=o.slice(),this.orientedFlatCoordinates_.length=Vy(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},l.prototype.getSimplifiedGeometryInternal=function(o){var c=[],i=[];return c.length=gx(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(o),c,0,i),new l(c,_n.XY,i)},l.prototype.getPolygon=function(o){if(o<0||this.endss_.length<=o)return null;var c;if(o===0)c=0;else{var i=this.endss_[o-1];c=i[i.length-1]}var u=this.endss_[o].slice(),P=u[u.length-1];if(c!==0)for(var D=0,F=u.length;D<F;++D)u[D]-=c;return new cd(this.flatCoordinates.slice(c,P),this.layout,u)},l.prototype.getPolygons=function(){for(var o=this.layout,c=this.flatCoordinates,i=this.endss_,u=[],P=0,D=0,F=i.length;D<F;++D){var U=i[D].slice(),N=U[U.length-1];if(P!==0)for(var at=0,yt=U.length;at<yt;++at)U[at]-=P;var Tt=new cd(c.slice(P,N),o,U);u.push(Tt),P=N}return u},l.prototype.getType=function(){return Ie.MULTI_POLYGON},l.prototype.intersectsExtent=function(o){return wx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,o)},l.prototype.setCoordinates=function(o,c){this.setLayout(c,o,3),this.flatCoordinates||(this.flatCoordinates=[]);var i=dx(this.flatCoordinates,0,o,this.stride,this.endss_);if(i.length===0)this.flatCoordinates.length=0;else{var u=i[i.length-1];this.flatCoordinates.length=u.length===0?0:u[u.length-1]}this.changed()},l}(fs),I0=U2;var L0=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),C0=0,_d=1,A0=[0,0,0,0],af=[],f_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},d_=function(v){L0(l,v);function l(o,c,i){var u=v.call(this,o)||this;return u.features=c,u.mapBrowserEvent=i,u}return l}(ss);var N2=function(v){L0(l,v);function l(o){var c=v.call(this,o)||this;c.on,c.once,c.un,c.boundHandleFeatureChange_=c.handleFeatureChange_.bind(c),c.condition_=o.condition?o.condition:E0,c.defaultDeleteCondition_=function(u){return v0(u)&&w0(u)},c.deleteCondition_=o.deleteCondition?o.deleteCondition:c.defaultDeleteCondition_,c.insertVertexCondition_=o.insertVertexCondition?o.insertVertexCondition:x0,c.vertexFeature_=null,c.vertexSegments_=null,c.lastPixel_=[0,0],c.ignoreNextSingleClick_=!1,c.featuresBeingModified_=null,c.rBush_=new yd,c.pixelTolerance_=o.pixelTolerance!==void 0?o.pixelTolerance:10,c.snappedToVertex_=!1,c.changingFeature_=!1,c.dragSegments_=[],c.overlay_=new np({source:new op({useSpatialIndex:!1,wrapX:!!o.wrapX}),style:o.style?o.style:G2(),updateWhileAnimating:!0,updateWhileInteracting:!0}),c.SEGMENT_WRITERS_={Point:c.writePointGeometry_.bind(c),LineString:c.writeLineStringGeometry_.bind(c),LinearRing:c.writeLineStringGeometry_.bind(c),Polygon:c.writePolygonGeometry_.bind(c),MultiPoint:c.writeMultiPointGeometry_.bind(c),MultiLineString:c.writeMultiLineStringGeometry_.bind(c),MultiPolygon:c.writeMultiPolygonGeometry_.bind(c),Circle:c.writeCircleGeometry_.bind(c),GeometryCollection:c.writeGeometryCollectionGeometry_.bind(c)},c.source_=null,c.hitDetection_=null;var i;if(o.features?i=o.features:o.source&&(c.source_=o.source,i=new hh(c.source_.getFeatures()),c.source_.addEventListener(ja.ADDFEATURE,c.handleSourceAdd_.bind(c)),c.source_.addEventListener(ja.REMOVEFEATURE,c.handleSourceRemove_.bind(c))),!i)throw new Error("The modify interaction requires features, a source or a layer");return o.hitDetection&&(c.hitDetection_=o.hitDetection),c.features_=i,c.features_.forEach(c.addFeature_.bind(c)),c.features_.addEventListener(ps.ADD,c.handleFeatureAdd_.bind(c)),c.features_.addEventListener(ps.REMOVE,c.handleFeatureRemove_.bind(c)),c.lastPointerEvent_=null,c.delta_=[0,0],c.snapToPointer_=o.snapToPointer===void 0?!c.hitDetection_:o.snapToPointer,c}return l.prototype.addFeature_=function(o){var c=o.getGeometry();if(c){var i=this.SEGMENT_WRITERS_[c.getType()];i&&i(o,c)}var u=this.getMap();u&&u.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,u),o.addEventListener(Vi.CHANGE,this.boundHandleFeatureChange_)},l.prototype.willModifyFeatures_=function(o,c){if(!this.featuresBeingModified_){this.featuresBeingModified_=new hh;for(var i=this.featuresBeingModified_.getArray(),u=0,P=c.length;u<P;++u)for(var D=c[u],F=0,U=D.length;F<U;++F){var N=D[F].feature;N&&i.indexOf(N)===-1&&this.featuresBeingModified_.push(N)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new d_(f_.MODIFYSTART,this.featuresBeingModified_,o))}},l.prototype.removeFeature_=function(o){this.removeFeatureSegmentData_(o),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),o.removeEventListener(Vi.CHANGE,this.boundHandleFeatureChange_)},l.prototype.removeFeatureSegmentData_=function(o){var c=this.rBush_,i=[];c.forEach(function(F){o===F.feature&&i.push(F)});for(var u=i.length-1;u>=0;--u){for(var P=i[u],D=this.dragSegments_.length-1;D>=0;--D)this.dragSegments_[D][0]===P&&this.dragSegments_.splice(D,1);c.remove(P)}},l.prototype.setActive=function(o){this.vertexFeature_&&!o&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),v.prototype.setActive.call(this,o)},l.prototype.setMap=function(o){this.overlay_.setMap(o),v.prototype.setMap.call(this,o)},l.prototype.getOverlay=function(){return this.overlay_},l.prototype.handleSourceAdd_=function(o){o.feature&&this.features_.push(o.feature)},l.prototype.handleSourceRemove_=function(o){o.feature&&this.features_.remove(o.feature)},l.prototype.handleFeatureAdd_=function(o){this.addFeature_(o.element)},l.prototype.handleFeatureChange_=function(o){if(!this.changingFeature_){var c=o.target;this.removeFeature_(c),this.addFeature_(c)}},l.prototype.handleFeatureRemove_=function(o){var c=o.element;this.removeFeature_(c)},l.prototype.writePointGeometry_=function(o,c){var i=c.getCoordinates(),u={feature:o,geometry:c,segment:[i,i]};this.rBush_.insert(c.getExtent(),u)},l.prototype.writeMultiPointGeometry_=function(o,c){for(var i=c.getCoordinates(),u=0,P=i.length;u<P;++u){var D=i[u],F={feature:o,geometry:c,depth:[u],index:u,segment:[D,D]};this.rBush_.insert(c.getExtent(),F)}},l.prototype.writeLineStringGeometry_=function(o,c){for(var i=c.getCoordinates(),u=0,P=i.length-1;u<P;++u){var D=i.slice(u,u+2),F={feature:o,geometry:c,index:u,segment:D};this.rBush_.insert(Cu(D),F)}},l.prototype.writeMultiLineStringGeometry_=function(o,c){for(var i=c.getCoordinates(),u=0,P=i.length;u<P;++u)for(var D=i[u],F=0,U=D.length-1;F<U;++F){var N=D.slice(F,F+2),at={feature:o,geometry:c,depth:[u],index:F,segment:N};this.rBush_.insert(Cu(N),at)}},l.prototype.writePolygonGeometry_=function(o,c){for(var i=c.getCoordinates(),u=0,P=i.length;u<P;++u)for(var D=i[u],F=0,U=D.length-1;F<U;++F){var N=D.slice(F,F+2),at={feature:o,geometry:c,depth:[u],index:F,segment:N};this.rBush_.insert(Cu(N),at)}},l.prototype.writeMultiPolygonGeometry_=function(o,c){for(var i=c.getCoordinates(),u=0,P=i.length;u<P;++u)for(var D=i[u],F=0,U=D.length;F<U;++F)for(var N=D[F],at=0,yt=N.length-1;at<yt;++at){var Tt=N.slice(at,at+2),Lt={feature:o,geometry:c,depth:[F,u],index:at,segment:Tt};this.rBush_.insert(Cu(Tt),Lt)}},l.prototype.writeCircleGeometry_=function(o,c){var i=c.getCenter(),u={feature:o,geometry:c,index:C0,segment:[i,i]},P={feature:o,geometry:c,index:_d,segment:[i,i]},D=[u,P];u.featureSegments=D,P.featureSegments=D,this.rBush_.insert(Xp(i),u);var F=c,U=uh();if(U&&this.getMap()){var N=this.getMap().getView().getProjection();F=F.clone().transform(U,N),F=Gy(F).transform(N,U)}this.rBush_.insert(F.getExtent(),P)},l.prototype.writeGeometryCollectionGeometry_=function(o,c){for(var i=c.getGeometriesArray(),u=0;u<i.length;++u){var P=i[u],D=this.SEGMENT_WRITERS_[P.getType()];D(o,P)}},l.prototype.createOrUpdateVertexFeature_=function(o,c,i){var u=this.vertexFeature_;if(!u)u=new gc(new ea(o)),this.vertexFeature_=u,this.overlay_.getSource().addFeature(u);else{var P=u.getGeometry();P.setCoordinates(o)}return u.set("features",c),u.set("geometries",i),u},l.prototype.handleEvent=function(o){if(!o.originalEvent)return!0;this.lastPointerEvent_=o;var c;return!o.map.getView().getInteracting()&&o.type==Xo.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(o),this.vertexFeature_&&this.deleteCondition_(o)&&(o.type!=Xo.SINGLECLICK||!this.ignoreNextSingleClick_?c=this.removePoint():c=!0),o.type==Xo.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),v.prototype.handleEvent.call(this,o)&&!c},l.prototype.handleDragEvent=function(o){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(o,this.dragSegments_);for(var c=[o.coordinate[0]+this.delta_[0],o.coordinate[1]+this.delta_[1]],i=[],u=[],P=0,D=this.dragSegments_.length;P<D;++P){var F=this.dragSegments_[P],U=F[0],N=U.feature;i.indexOf(N)===-1&&i.push(N);var at=U.geometry;u.indexOf(at)===-1&&u.push(at);for(var yt=U.depth,Tt=void 0,Lt=U.segment,Vt=F[1];c.length<at.getStride();)c.push(Lt[Vt][c.length]);switch(at.getType()){case Ie.POINT:Tt=c,Lt[0]=c,Lt[1]=c;break;case Ie.MULTI_POINT:Tt=at.getCoordinates(),Tt[U.index]=c,Lt[0]=c,Lt[1]=c;break;case Ie.LINE_STRING:Tt=at.getCoordinates(),Tt[U.index+Vt]=c,Lt[Vt]=c;break;case Ie.MULTI_LINE_STRING:Tt=at.getCoordinates(),Tt[yt[0]][U.index+Vt]=c,Lt[Vt]=c;break;case Ie.POLYGON:Tt=at.getCoordinates(),Tt[yt[0]][U.index+Vt]=c,Lt[Vt]=c;break;case Ie.MULTI_POLYGON:Tt=at.getCoordinates(),Tt[yt[1]][yt[0]][U.index+Vt]=c,Lt[Vt]=c;break;case Ie.CIRCLE:if(Lt[0]=c,Lt[1]=c,U.index===C0)this.changingFeature_=!0,at.setCenter(c),this.changingFeature_=!1;else{this.changingFeature_=!0;var wt=o.map.getView().getProjection(),kt=_y(Xl(at.getCenter(),wt),Xl(c,wt)),Zt=uh();if(Zt){var Yt=at.clone().transform(Zt,wt);Yt.setRadius(kt),kt=Yt.transform(wt,Zt).getRadius()}at.setRadius(kt),this.changingFeature_=!1}break;default:}Tt&&this.setGeometryCoordinates_(at,Tt)}this.createOrUpdateVertexFeature_(c,i,u)},l.prototype.handleDownEvent=function(o){if(!this.condition_(o))return!1;var c=o.coordinate;this.handlePointerAtPixel_(o.pixel,o.map,c),this.dragSegments_.length=0,this.featuresBeingModified_=null;var i=this.vertexFeature_;if(i){var u=o.map.getView().getProjection(),P=[],D=i.getGeometry().getCoordinates(),F=Cu([D]),U=this.rBush_.getInExtent(F),N={};U.sort(V2);for(var at=0,yt=U.length;at<yt;++at){var Tt=U[at],Lt=Tt.segment,Vt=wi(Tt.geometry),wt=Tt.depth;if(wt&&(Vt+="-"+wt.join("-")),N[Vt]||(N[Vt]=new Array(2)),Tt.geometry.getType()===Ie.CIRCLE&&Tt.index===_d){var kt=M0(c,Tt,u);Pu(kt,D)&&!N[Vt][0]&&(this.dragSegments_.push([Tt,0]),N[Vt][0]=Tt);continue}if(Pu(Lt[0],D)&&!N[Vt][0]){this.dragSegments_.push([Tt,0]),N[Vt][0]=Tt;continue}if(Pu(Lt[1],D)&&!N[Vt][1]){if((Tt.geometry.getType()===Ie.LINE_STRING||Tt.geometry.getType()===Ie.MULTI_LINE_STRING)&&N[Vt][0]&&N[Vt][0].index===0)continue;this.dragSegments_.push([Tt,1]),N[Vt][1]=Tt;continue}wi(Lt)in this.vertexSegments_&&!N[Vt][0]&&!N[Vt][1]&&this.insertVertexCondition_(o)&&P.push(Tt)}P.length&&this.willModifyFeatures_(o,[P]);for(var Zt=P.length-1;Zt>=0;--Zt)this.insertVertex_(P[Zt],D)}return!!this.vertexFeature_},l.prototype.handleUpEvent=function(o){for(var c=this.dragSegments_.length-1;c>=0;--c){var i=this.dragSegments_[c][0],u=i.geometry;if(u.getType()===Ie.CIRCLE){var P=u.getCenter(),D=i.featureSegments[0],F=i.featureSegments[1];D.segment[0]=P,D.segment[1]=P,F.segment[0]=P,F.segment[1]=P,this.rBush_.update(Xp(P),D);var U=u,N=uh();if(N){var at=o.map.getView().getProjection();U=U.clone().transform(N,at),U=Gy(U).transform(at,N)}this.rBush_.update(U.getExtent(),F)}else this.rBush_.update(Cu(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new d_(f_.MODIFYEND,this.featuresBeingModified_,o)),this.featuresBeingModified_=null),!1},l.prototype.handlePointerMove_=function(o){this.lastPixel_=o.pixel,this.handlePointerAtPixel_(o.pixel,o.map,o.coordinate)},l.prototype.handlePointerAtPixel_=function(o,c,i){var u=this,P=i||c.getCoordinateFromPixel(o),D=c.getView().getProjection(),F=function(Ce,Lr){return P0(P,Ce,D)-P0(P,Lr,D)},U,N;if(this.hitDetection_){var at=typeof this.hitDetection_=="object"?function(Ce){return Ce===u.hitDetection_}:void 0;c.forEachFeatureAtPixel(o,function(Ce,Lr,yr){if(yr=yr||Ce.getGeometry(),yr.getType()===Ie.POINT&&hv(u.features_.getArray(),Ce)){N=yr;var _r=yr.getFlatCoordinates().slice(0,2);U=[{feature:Ce,geometry:yr,segment:[_r,_r]}]}return!0},{layerFilter:at})}if(!U){var yt=Qf(Xp(P,A0),D),Tt=c.getView().getResolution()*this.pixelTolerance_,Lt=$p(rl(yt,Tt,A0),D);U=this.rBush_.getInExtent(Lt)}if(U&&U.length>0){var Vt=U.sort(F)[0],wt=Vt.segment,kt=M0(P,Vt,D),Zt=c.getPixelFromCoordinate(kt),Yt=_y(o,Zt);if(N||Yt<=this.pixelTolerance_){var le={};if(le[wi(wt)]=!0,this.snapToPointer_||(this.delta_[0]=kt[0]-P[0],this.delta_[1]=kt[1]-P[1]),Vt.geometry.getType()===Ie.CIRCLE&&Vt.index===_d)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(kt,[Vt.feature],[Vt.geometry]);else{var ue=c.getPixelFromCoordinate(wt[0]),oe=c.getPixelFromCoordinate(wt[1]),ge=Wp(Zt,ue),we=Wp(Zt,oe);Yt=Math.sqrt(Math.min(ge,we)),this.snappedToVertex_=Yt<=this.pixelTolerance_,this.snappedToVertex_&&(kt=ge>we?wt[1]:wt[0]),this.createOrUpdateVertexFeature_(kt,[Vt.feature],[Vt.geometry]);var Pe={};Pe[wi(Vt.geometry)]=!0;for(var ir=1,Be=U.length;ir<Be;++ir){var qe=U[ir].segment;if(Pu(wt[0],qe[0])&&Pu(wt[1],qe[1])||Pu(wt[0],qe[1])&&Pu(wt[1],qe[0])){var rr=wi(U[ir].geometry);rr in Pe||(Pe[rr]=!0,le[wi(qe)]=!0)}else break}}this.vertexSegments_=le;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},l.prototype.insertVertex_=function(o,c){for(var i=o.segment,u=o.feature,P=o.geometry,D=o.depth,F=o.index,U;c.length<P.getStride();)c.push(0);switch(P.getType()){case Ie.MULTI_LINE_STRING:U=P.getCoordinates(),U[D[0]].splice(F+1,0,c);break;case Ie.POLYGON:U=P.getCoordinates(),U[D[0]].splice(F+1,0,c);break;case Ie.MULTI_POLYGON:U=P.getCoordinates(),U[D[1]][D[0]].splice(F+1,0,c);break;case Ie.LINE_STRING:U=P.getCoordinates(),U.splice(F+1,0,c);break;default:return}this.setGeometryCoordinates_(P,U);var N=this.rBush_;N.remove(o),this.updateSegmentIndices_(P,F,D,1);var at={segment:[i[0],c],feature:u,geometry:P,depth:D,index:F};N.insert(Cu(at.segment),at),this.dragSegments_.push([at,1]);var yt={segment:[c,i[1]],feature:u,geometry:P,depth:D,index:F+1};N.insert(Cu(yt.segment),yt),this.dragSegments_.push([yt,0]),this.ignoreNextSingleClick_=!0},l.prototype.removePoint=function(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=Xo.POINTERDRAG){var o=this.lastPointerEvent_;this.willModifyFeatures_(o,this.dragSegments_);var c=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new d_(f_.MODIFYEND,this.featuresBeingModified_,o)),this.featuresBeingModified_=null,c}return!1},l.prototype.removeVertex_=function(){var o=this.dragSegments_,c={},i=!1,u,P,D,F,U,N,at,yt,Tt,Lt,Vt;for(U=o.length-1;U>=0;--U)D=o[U],Lt=D[0],Vt=wi(Lt.feature),Lt.depth&&(Vt+="-"+Lt.depth.join("-")),Vt in c||(c[Vt]={}),D[1]===0?(c[Vt].right=Lt,c[Vt].index=Lt.index):D[1]==1&&(c[Vt].left=Lt,c[Vt].index=Lt.index+1);for(Vt in c){switch(Tt=c[Vt].right,at=c[Vt].left,N=c[Vt].index,yt=N-1,at!==void 0?Lt=at:Lt=Tt,yt<0&&(yt=0),F=Lt.geometry,P=F.getCoordinates(),u=P,i=!1,F.getType()){case Ie.MULTI_LINE_STRING:P[Lt.depth[0]].length>2&&(P[Lt.depth[0]].splice(N,1),i=!0);break;case Ie.LINE_STRING:P.length>2&&(P.splice(N,1),i=!0);break;case Ie.MULTI_POLYGON:u=u[Lt.depth[1]];case Ie.POLYGON:u=u[Lt.depth[0]],u.length>4&&(N==u.length-1&&(N=0),u.splice(N,1),i=!0,N===0&&(u.pop(),u.push(u[0]),yt=u.length-1));break;default:}if(i){this.setGeometryCoordinates_(F,P);var wt=[];if(at!==void 0&&(this.rBush_.remove(at),wt.push(at.segment[0])),Tt!==void 0&&(this.rBush_.remove(Tt),wt.push(Tt.segment[1])),at!==void 0&&Tt!==void 0){var kt={depth:Lt.depth,feature:Lt.feature,geometry:Lt.geometry,index:yt,segment:wt};this.rBush_.insert(Cu(kt.segment),kt)}this.updateSegmentIndices_(F,N,Lt.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),o.length=0}}return i},l.prototype.setGeometryCoordinates_=function(o,c){this.changingFeature_=!0,o.setCoordinates(c),this.changingFeature_=!1},l.prototype.updateSegmentIndices_=function(o,c,i,u){this.rBush_.forEachInExtent(o.getExtent(),function(P){P.geometry===o&&(i===void 0||P.depth===void 0||ls(P.depth,i))&&P.index>c&&(P.index+=u)})},l}(_0);function V2(v,l){return v.index-l.index}function P0(v,l,o){var c=l.geometry;if(c.getType()===Ie.CIRCLE){var i=c;if(l.index===_d){var u=uh();u&&(i=i.clone().transform(u,o));var P=Wp(i.getCenter(),Xl(v,o)),D=Math.sqrt(P)-i.getRadius();return D*D}}var F=Xl(v,o);return af[0]=Xl(l.segment[0],o),af[1]=Xl(l.segment[1],o),Xv(F,af)}function M0(v,l,o){var c=l.geometry;if(c.getType()===Ie.CIRCLE&&l.index===_d){var i=c,u=uh();return u&&(i=i.clone().transform(u,o)),by(i.getClosestPoint(Xl(v,o)),o)}var P=Xl(v,o);return af[0]=Xl(l.segment[0],o),af[1]=Xl(l.segment[1],o),by(yy(P,af),o)}function G2(){var v=Ux();return function(l,o){return v[Ie.POINT]}}var m_=N2;var j2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),q2=function(v){j2(l,v);function l(o){var c=v.call(this)||this;return c.geometries_=o||null,c.changeEventsKeys_=[],c.listenGeometriesChange_(),c}return l.prototype.unlistenGeometriesChange_=function(){this.changeEventsKeys_.forEach(To),this.changeEventsKeys_.length=0},l.prototype.listenGeometriesChange_=function(){if(!!this.geometries_)for(var o=0,c=this.geometries_.length;o<c;++o)this.changeEventsKeys_.push(eo(this.geometries_[o],Vi.CHANGE,this.changed,this))},l.prototype.clone=function(){var o=new l(null);return o.setGeometries(this.geometries_),o.applyProperties(this),o},l.prototype.closestPointXY=function(o,c,i,u){if(u<cs(this.getExtent(),o,c))return u;for(var P=this.geometries_,D=0,F=P.length;D<F;++D)u=P[D].closestPointXY(o,c,i,u);return u},l.prototype.containsXY=function(o,c){for(var i=this.geometries_,u=0,P=i.length;u<P;++u)if(i[u].containsXY(o,c))return!0;return!1},l.prototype.computeExtent=function(o){Zp(o);for(var c=this.geometries_,i=0,u=c.length;i<u;++i)Uv(o,c[i].getExtent());return o},l.prototype.getGeometries=function(){return k0(this.geometries_)},l.prototype.getGeometriesArray=function(){return this.geometries_},l.prototype.getGeometriesArrayRecursive=function(){for(var o=[],c=this.geometries_,i=0,u=c.length;i<u;++i)c[i].getType()===this.getType()?o=o.concat(c[i].getGeometriesArrayRecursive()):o.push(c[i]);return o},l.prototype.getSimplifiedGeometry=function(o){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),o<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&o<this.simplifiedGeometryMaxMinSquaredTolerance)return this;for(var c=[],i=this.geometries_,u=!1,P=0,D=i.length;P<D;++P){var F=i[P],U=F.getSimplifiedGeometry(o);c.push(U),U!==F&&(u=!0)}if(u){var N=new l(null);return N.setGeometriesArray(c),N}else return this.simplifiedGeometryMaxMinSquaredTolerance=o,this},l.prototype.getType=function(){return Ie.GEOMETRY_COLLECTION},l.prototype.intersectsExtent=function(o){for(var c=this.geometries_,i=0,u=c.length;i<u;++i)if(c[i].intersectsExtent(o))return!0;return!1},l.prototype.isEmpty=function(){return this.geometries_.length===0},l.prototype.rotate=function(o,c){for(var i=this.geometries_,u=0,P=i.length;u<P;++u)i[u].rotate(o,c);this.changed()},l.prototype.scale=function(o,c,i){var u=i;u||(u=Hh(this.getExtent()));for(var P=this.geometries_,D=0,F=P.length;D<F;++D)P[D].scale(o,c,u);this.changed()},l.prototype.setGeometries=function(o){this.setGeometriesArray(k0(o))},l.prototype.setGeometriesArray=function(o){this.unlistenGeometriesChange_(),this.geometries_=o,this.listenGeometriesChange_(),this.changed()},l.prototype.applyTransform=function(o){for(var c=this.geometries_,i=0,u=c.length;i<u;++i)c[i].applyTransform(o);this.changed()},l.prototype.translate=function(o,c){for(var i=this.geometries_,u=0,P=i.length;u<P;++u)i[u].translate(o,c);this.changed()},l.prototype.disposeInternal=function(){this.unlistenGeometriesChange_(),v.prototype.disposeInternal.call(this)},l}(Lm);function k0(v){for(var l=[],o=0,c=v.length;o<c;++o)l.push(v[o].clone());return l}var z0=q2;var Z2=function(){function v(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return v.prototype.getReadOptions=function(l,o){var c;if(o){var i=o.dataProjection?ta(o.dataProjection):this.readProjection(l);o.extent&&i&&i.getUnits()===dc.TILE_PIXELS&&(i=ta(i),i.setWorldExtent(o.extent)),c={dataProjection:i,featureProjection:o.featureProjection}}return this.adaptOptions(c)},v.prototype.adaptOptions=function(l){return _a({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},l)},v.prototype.getType=function(){return Fr()},v.prototype.readFeature=function(l,o){return Fr()},v.prototype.readFeatures=function(l,o){return Fr()},v.prototype.readGeometry=function(l,o){return Fr()},v.prototype.readProjection=function(l){return Fr()},v.prototype.writeFeature=function(l,o){return Fr()},v.prototype.writeFeatures=function(l,o){return Fr()},v.prototype.writeGeometry=function(l,o){return Fr()},v}(),R0=Z2;function g_(v,l,o){var c=o?ta(o.featureProjection):null,i=o?ta(o.dataProjection):null,u;if(c&&i&&!Yv(c,i)?u=(l?v.clone():v).transform(l?c:i,l?i:c):u=v,l&&o&&o.decimals!==void 0){var P=Math.pow(10,o.decimals),D=function(F){for(var U=0,N=F.length;U<N;++U)F[U]=Math.round(F[U]*P)/P;return F};u===v&&(u=v.clone()),u.applyTransform(D)}return u}var X2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),W2=function(v){X2(l,v);function l(){return v.call(this)||this}return l.prototype.getType=function(){return vh.JSON},l.prototype.readFeature=function(o,c){return this.readFeatureFromObject(qm(o),this.getReadOptions(o,c))},l.prototype.readFeatures=function(o,c){return this.readFeaturesFromObject(qm(o),this.getReadOptions(o,c))},l.prototype.readFeatureFromObject=function(o,c){return Fr()},l.prototype.readFeaturesFromObject=function(o,c){return Fr()},l.prototype.readGeometry=function(o,c){return this.readGeometryFromObject(qm(o),this.getReadOptions(o,c))},l.prototype.readGeometryFromObject=function(o,c){return Fr()},l.prototype.readProjection=function(o){return this.readProjectionFromObject(qm(o))},l.prototype.readProjectionFromObject=function(o){return Fr()},l.prototype.writeFeature=function(o,c){return JSON.stringify(this.writeFeatureObject(o,c))},l.prototype.writeFeatureObject=function(o,c){return Fr()},l.prototype.writeFeatures=function(o,c){return JSON.stringify(this.writeFeaturesObject(o,c))},l.prototype.writeFeaturesObject=function(o,c){return Fr()},l.prototype.writeGeometry=function(o,c){return JSON.stringify(this.writeGeometryObject(o,c))},l.prototype.writeGeometryObject=function(o,c){return Fr()},l}(R0);function qm(v){if(typeof v=="string"){var l=JSON.parse(v);return l||null}else return v!==null?v:null}var D0=W2;var $2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),K2=function(v){$2(l,v);function l(o){var c=this,i=o||{};return c=v.call(this)||this,c.dataProjection=ta(i.dataProjection?i.dataProjection:"EPSG:4326"),i.featureProjection&&(c.defaultFeatureProjection=ta(i.featureProjection)),c.geometryName_=i.geometryName,c.extractGeometryName_=i.extractGeometryName,c.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"],c}return l.prototype.readFeatureFromObject=function(o,c){var i=null;o.type==="Feature"?i=o:i={type:"Feature",geometry:o,properties:null};var u=y_(i.geometry,c),P=new gc;return this.geometryName_?P.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in i!==void 0&&P.setGeometryName(i.geometry_name),P.setGeometry(u),"id"in i&&P.setId(i.id),i.properties&&P.setProperties(i.properties,!0),P},l.prototype.readFeaturesFromObject=function(o,c){var i=o,u=null;if(i.type==="FeatureCollection"){var P=o;u=[];for(var D=P.features,F=0,U=D.length;F<U;++F)u.push(this.readFeatureFromObject(D[F],c))}else u=[this.readFeatureFromObject(o,c)];return u},l.prototype.readGeometryFromObject=function(o,c){return y_(o,c)},l.prototype.readProjectionFromObject=function(o){var c=o.crs,i;return c?c.type=="name"?i=ta(c.properties.name):c.type==="EPSG"?i=ta("EPSG:"+c.properties.code):fn(!1,36):i=this.dataProjection,i},l.prototype.writeFeatureObject=function(o,c){c=this.adaptOptions(c);var i={type:"Feature",geometry:null,properties:null},u=o.getId();if(u!==void 0&&(i.id=u),!o.hasProperties())return i;var P=o.getProperties(),D=o.getGeometry();return D&&(i.geometry=__(D,c),delete P[o.getGeometryName()]),Vl(P)||(i.properties=P),i},l.prototype.writeFeaturesObject=function(o,c){c=this.adaptOptions(c);for(var i=[],u=0,P=o.length;u<P;++u)i.push(this.writeFeatureObject(o[u],c));return{type:"FeatureCollection",features:i}},l.prototype.writeGeometryObject=function(o,c){return __(o,this.adaptOptions(c))},l}(D0);function y_(v,l){if(!v)return null;var o;switch(v.type){case Ie.POINT:{o=H2(v);break}case Ie.LINE_STRING:{o=J2(v);break}case Ie.POLYGON:{o=rE(v);break}case Ie.MULTI_POINT:{o=tE(v);break}case Ie.MULTI_LINE_STRING:{o=Q2(v);break}case Ie.MULTI_POLYGON:{o=eE(v);break}case Ie.GEOMETRY_COLLECTION:{o=Y2(v);break}default:throw new Error("Unsupported GeoJSON type: "+v.type)}return g_(o,!1,l)}function Y2(v,l){var o=v.geometries.map(function(c){return y_(c,l)});return new z0(o)}function H2(v){return new ea(v.coordinates)}function J2(v){return new yc(v.coordinates)}function Q2(v){return new S0(v.coordinates)}function tE(v){return new jm(v.coordinates)}function eE(v){return new I0(v.coordinates)}function rE(v){return new cd(v.coordinates)}function __(v,l){v=g_(v,!0,l);var o=v.getType(),c;switch(o){case Ie.POINT:{c=lE(v,l);break}case Ie.LINE_STRING:{c=nE(v,l);break}case Ie.POLYGON:{c=uE(v,l);break}case Ie.MULTI_POINT:{c=aE(v,l);break}case Ie.MULTI_LINE_STRING:{c=oE(v,l);break}case Ie.MULTI_POLYGON:{c=sE(v,l);break}case Ie.GEOMETRY_COLLECTION:{c=iE(v,l);break}case Ie.CIRCLE:{c={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+o)}return c}function iE(v,l){var o=v.getGeometriesArray().map(function(c){var i=_a({},l);return delete i.featureProjection,__(c,i)});return{type:"GeometryCollection",geometries:o}}function nE(v,l){return{type:"LineString",coordinates:v.getCoordinates()}}function oE(v,l){return{type:"MultiLineString",coordinates:v.getCoordinates()}}function aE(v,l){return{type:"MultiPoint",coordinates:v.getCoordinates()}}function sE(v,l){var o;return l&&(o=l.rightHanded),{type:"MultiPolygon",coordinates:v.getCoordinates(o)}}function lE(v,l){return{type:"Point",coordinates:v.getCoordinates()}}function uE(v,l){var o;return l&&(o=l.rightHanded),{type:"Polygon",coordinates:v.getCoordinates(o)}}var al=K2;var Zm,cE=new Uint8Array(16);function v_(){if(!Zm&&(Zm=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Zm))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Zm(cE)}var O0=/^(?:[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 hE(v){return typeof v=="string"&&O0.test(v)}var F0=hE;var ia=[];for(Xm=0;Xm<256;++Xm)ia.push((Xm+256).toString(16).substr(1));var Xm;function pE(v){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=(ia[v[l+0]]+ia[v[l+1]]+ia[v[l+2]]+ia[v[l+3]]+"-"+ia[v[l+4]]+ia[v[l+5]]+"-"+ia[v[l+6]]+ia[v[l+7]]+"-"+ia[v[l+8]]+ia[v[l+9]]+"-"+ia[v[l+10]]+ia[v[l+11]]+ia[v[l+12]]+ia[v[l+13]]+ia[v[l+14]]+ia[v[l+15]]).toLowerCase();if(!F0(o))throw TypeError("Stringified UUID is invalid");return o}var B0=pE;function fE(v,l,o){v=v||{};var c=v.random||(v.rng||v_)();if(c[6]=c[6]&15|64,c[8]=c[8]&63|128,l){o=o||0;for(var i=0;i<16;++i)l[o+i]=c[i];return l}return B0(c)}var x_=fE;var ap=class extends Io{constructor(l={}){super(),this.defineProperties(l),this.setProperties(l.properties),this.visible=l.visible===void 0?!0:!!l.visible,this.group=l.group,this.copyrights=l.copyrights,this.children=l.children,this.on("change:visible:group",o=>{this.group===o.target.group&&this!==o.target&&this.visible?this.visible=!1:this.children&&this.children.forEach(c=>c.dispatchEvent(o))})}defineProperties(l){let{name:o,key:c,properties:i,hitTolerance:u}={...l},P=x_();Object.defineProperties(this,{name:{value:o},key:{value:c||P},group:{get:()=>this.get("group"),set:D=>{this.set("group",D)}},copyrights:{get:()=>this.get("copyrights"),set:D=>{let F=D&&!Array.isArray(D)?[D]:D;this.set("copyrights",F||[])}},options:{value:l},map:{writable:!0},visible:{get:()=>this.get("visible"),set:D=>{if(D!==this.visible)if(this.set("visible",D),this.visible){if(this.parent&&!this.parent.visible&&(this.parent.visible=!0),this.children&&this.children.find(F=>F.group)){let F=this.children.find(U=>!!U.group);F.visible=!0}if(this.parent&&this.group){let F=this.parent;for(;F.parent;)F=F.parent;F.dispatchEvent({type:"change:visible:group",target:this})}}else this.visible||this.parent&&this.parent.visible&&!this.parent.children.find(F=>F.visible)&&(this.parent.visible=!1)}},disabled:{get:()=>this.get("disabled"),set:D=>{this.set("disabled",D)}},parent:{value:null,writable:!0},children:{get:()=>this.get("children")||[],set:D=>{(this.children||[]).forEach(F=>{F.parent=null}),Array.isArray(D)&&D.forEach(F=>{F.parent=this}),this.set("children",D||[])}},hitTolerance:{value:u||5,writable:!0},properties:{value:{...i||{}}}})}attachToMap(l){this.detachFromMap(),this.map=l,this.children&&this.children.forEach(o=>{o.attachToMap(l)})}detachFromMap(){this.map=null}getFeatureInfoAtCoordinate(l,o){return console.error("getFeatureInfoAtCoordinate must be implemented by inheriting layers",this.key),Promise.resolve({layer:this,features:[],coordinate:l})}flat(){return Xf(this)}};var dE=v=>class extends v{constructor(l={}){super(l);let{userInteractions:o=!0,userClickInteractions:c=!0,userHoverInteractions:i=!0,defaultUserInteractions:u=!0}=l;this.userInteractions=o,this.userClickInteractions=c,this.userHoverInteractions=i,this.defaultUserInteractions=u,this.userClickCallbacks=[],this.userHoverCallbacks=[],this.userClickEventsKeys=[],this.userHoverEventsKeys=[],this.onUserClickCallback=this.onUserClickCallback.bind(this),this.onUserMoveCallback=this.onUserMoveCallback.bind(this);let{onClick:P,onHover:D}=l;this.userInteractions&&this.userClickInteractions&&P&&this.onClick(P),this.userInteractions&&this.userHoverInteractions&&D&&this.onHover(D)}attachToMap(l,o){super.attachToMap(l,o),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(l=>{this.userClickEventsKeys.push(this.on("user:click",({target:{features:o,layer:c,coordinate:i}})=>{l(o,c,i)}))}),this.userHoverCallbacks.forEach(l=>{this.userHoverEventsKeys.push(this.on("user:hover",({target:{features:o,layer:c,coordinate:i,event:u}})=>{l(o,c,i,u)}))})}unlistenEvents(){Na(this.userClickEventsKeys),Na(this.userHoverEventsKeys),this.userClickEventsKeys=[],this.userHoverEventsKeys=[]}onClick(l){this.userClickCallbacks.push(l),this.activateUserInteractions(),this.map&&this.listenEvents()}onHover(l){this.userHoverCallbacks.push(l),this.activateUserInteractions(),this.map&&this.listenEvents()}onUserClickCallback(l){let o=l.coordinate||ro(l.lngLat.toArray()),c={features:[],layer:this,coordinate:o,event:l};return this.getFeatureInfoAtCoordinate(o).then(i=>(this.dispatchEvent({type:"user:click",target:i}),i)).catch(()=>c)}onUserMoveCallback(l){let o=l.coordinate||ro(l.lngLat.toArray()),c={features:[],layer:this,coordinate:o,event:l};return this.getFeatureInfoAtCoordinate(o).then(i=>(this.dispatchEvent({type:"user:hover",target:i}),i)).catch(()=>c)}activateUserInteractions(){}deactivateUserInteractions(){}},Wm=dE;var vd=class extends Wm(ap){constructor(l){super(l),this.olLayer&&this.olLayer.setVisible(this.visible)}defineProperties(l){super.defineProperties(l),Object.defineProperties(this,{olLayer:{value:l.olLayer,writable:!0},olListenersKeys:{value:[]}})}attachToMap(l){if(super.attachToMap(l),!!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",o=>{o.element===this.olLayer&&this.detachFromMap()})),this.toggleVisibleListeners(),this.olListenersKeys.push(this.on("change:visible",this.toggleVisibleListeners)),this.copyrights&&this.olLayer)){let o=this.copyrights||[];this.olLayer.getLayers?this.olLayer.getLayers().getArray().forEach(c=>{c.getSource()?.setAttributions(o)}):this.olLayer.getSource&&this.olLayer.getSource()?.setAttributions(o)}}detachFromMap(){this.deactivateUserInteractions(),Na(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(){Na([this.pointerMoveListenerKey,this.singleClickListenerKey])}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}clone(l){return new vd({...this.options,...l})}},xa=vd;var U0=new ol({radius:6,fill:new Ds({color:[255,0,0,1]}),stroke:new ra({color:[0,0,0,1],width:1})}),mE=new Wl({stroke:new ra({color:[0,0,0,1],width:5})}),gE=new Wl({image:U0,stroke:new ra({color:[255,0,0,1],width:3})}),yE=new Wl({image:U0,stroke:new ra({color:[255,0,0,1],width:3,lineDash:[1,10]})}),_E=(v,l)=>{let o=v.get("minResolution"),c=v.get("maxResolution"),i=l<=o&&l>c;return o&&c&&!i?null:v.get("mot")!=="foot"?[mE,gE]:[yE]},xd=class extends xa{constructor(l={}){super(l),this.olLayer=l.olLayer||new np({source:new op,style:l.style||_E})}clone(l){return new xd({...this.options,...l})}},$m=xd;var vE=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,N0=/^([\d.]+),([\d.]+)$/,V0=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,Km="stop-fetch",G0=v=>{let l=[];return v.forEach(o=>{l.push(...o.getGeometry().getCoordinates())}),l},bd=class extends ch{constructor(l={}){super(l),Object.defineProperties(this,{mot:{get:()=>this.get("mot"),set:o=>{o&&(this.set("mot",o),this.viaPoints&&this.drawRoute())}},loading:{get:()=>this.get("loading"),set:o=>{this.set("loading",o)}},modify:{get:()=>this.get("modify"),set:o=>{this.set("modify",o)}}}),this.loading=!1,this.graphs=l.graphs||[["osm",0,99]],this.mot=l.mot||"bus",this.modify=l.modify!==!1,this.routingApiParams=l.routingApiParams||{},this.useRawViaPoints=l.useRawViaPoints||!1,this.snapToClosestStation=l.snapToClosestStation||!1,this.cacheStationData={},this.abortControllers=[],this.apiKey=l.apiKey,this.stopsApiKey=l.stopsApiKey||this.apiKey,this.segments=[],this.stopsApiUrl=l.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new jf({...l}),this.routingLayer=l.routingLayer||new $m({name:"routing-layer",style:l.style}),this.onRouteError=l.onRouteError||(o=>{this.dispatchEvent({type:"change:route",target:this}),this.reset(),console.error(o)}),this.viaPoints=[],this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.apiChangeListener=()=>this.drawRoute(),this.createModifyInteraction()}static getGraphsResolutions(l,o){let c=o.getView();return l.map(([,i,u])=>[c.getResolutionForZoom(i),c.getResolutionForZoom(u||i+1)])}addViaPoint(l,o=-1,c=0){this.viaPoints.splice(o===-1?this.viaPoints.length:o,c,l),this.drawRoute(),this.dispatchEvent({type:"change:route",target:this})}removeViaPoint(l=this.viaPoints.length-1){this.viaPoints.length&&this.viaPoints[l]&&this.viaPoints.splice(l,1),this.drawRoute(),this.dispatchEvent({type:"change:route",target:this})}setViaPoints(l){this.viaPoints=[...l],this.drawRoute(),this.dispatchEvent({type:"change:route",target:this})}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer.olLayer.getSource().clear(),this.dispatchEvent({type:"change:route",target:this})}abortRequests(){this.graphs.forEach(([l])=>{this.abortControllers[l]&&this.abortControllers[l].abort(),this.abortControllers[l]=new AbortController}),this.abortControllers[Km]?.abort(),this.abortControllers[Km]=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[Km]);let l=this.viaPoints.map(o=>{if(Array.isArray(o)){let c=this.map.getView().getProjection(),[i,u]=lh(o,c);return this.snapToClosestStation?[`@${u}`,i]:[u,i]}return this.useRawViaPoints?o:`!${o}`});return this.loading=!0,this.routingLayer.olLayer.getSource().clear(),this.viaPoints.forEach((o,c)=>this.drawViaPoint(o,c,this.abortControllers[Km])),Promise.all(this.graphs.map(([o],c)=>{let{signal:i}=this.abortControllers[o];return this.api.route({graph:o,via:`${l.join("|")}`,mot:`${this.mot}`,"resolve-hops":!1,elevation:!1,"coord-radius":100,"coord-punish":1e3,...this.routingApiParams},{signal:i}).then(u=>{if(this.segments=this.format.readFeatures(u),this.mot==="foot"){let F=this.segments.reduce((U,N)=>{let at=N.get("trg");return U.find(yt=>yt[0]===at[0]&&yt[1]===at[1])?U:[...U,at]},[]);this.segments=F.map(U=>{let N=this.segments.filter(yt=>{let Tt=yt.get("trg");return Tt[0]===U[0]&&Tt[1]===U[1]}),at=G0(N);return new gc({geometry:new yc(at)})})}let P=G0(this.segments),D=new gc({geometry:new yc(P)});D.set("graph",o),D.set("mot",this.mot),D.set("minResolution",this.graphsResolutions[c][0]),D.set("maxResolution",this.graphsResolutions[c][1]),this.routingLayer.olLayer.getSource().addFeature(D),this.loading=!1}).catch(u=>{u.name!=="AbortError"&&(this.segments=[],this.dispatchEvent({type:"error",target:this}),this.onRouteError(u,this),this.loading=!1)})}))}drawViaPoint(l,o,c){let i=new gc;if(i.set("viaPointIdx",o),Array.isArray(l))return i.setGeometry(new ea(l)),this.routingLayer.olLayer.getSource().addFeature(i),Promise.resolve(i);if(!this.useRawViaPoints||V0.test(l)){let U,N;return this.useRawViaPoints?[,U,,N]=V0.exec(l):[U,N]=l.split("$"),fetch(`${this.stopsApiUrl}lookup/${U}?key=${this.stopsApiKey}`,{signal:c.signal}).then(at=>at.json()).then(at=>{let{coordinates:yt}=at.features[0].geometry;return this.cacheStationData[l]=ro(yt),i.set("viaPointTrack",N),i.setGeometry(new ea(ro(yt))),this.routingLayer.olLayer.getSource().addFeature(i),i}).catch(at=>{at.name!=="AbortError"&&(this.dispatchEvent({type:"error",target:this}),this.onRouteError(at,this),this.loading=!1)})}if(this.useRawViaPoints&&N0.test(l)){let[U,N]=N0.exec(l),at=ro([parseFloat(N),parseFloat(U)],this.map.getView().getProjection());return i.setGeometry(new ea(at)),this.routingLayer.olLayer.getSource().addFeature(i),Promise.resolve(i)}let[,u,,P,D,,F]=vE.exec(l);if(D&&P){let U=ro([parseFloat(D),parseFloat(P)],this.map.getView().getProjection());return i.set("viaPointTrack",F),i.setGeometry(new ea(U)),this.routingLayer.olLayer.getSource().addFeature(i),Promise.resolve(i)}return u?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${u}&limit=1`,{signal:c.signal}).then(U=>U.json()).then(U=>{let{coordinates:N}=U.features[0].geometry;return this.cacheStationData[l]=ro(N),i.set("viaPointTrack",F),i.setGeometry(new ea(ro(N))),this.routingLayer.olLayer.getSource().addFeature(i),i}).catch(U=>(this.dispatchEvent({type:"error",target:this}),this.onRouteError(U,this),this.loading=!1,null)):Promise.resolve(null)}onMapClick(l){let c=l.target.getFeaturesAtPixel(l.pixel).find(i=>i.getGeometry()?.getType()===Ie.POINT&&i.get("viaPointIdx")!==void 0);if(c){this.removeViaPoint(c.get("viaPointIdx"));return}this.addViaPoint(l.coordinate)}onModifyStart(l){let o=-1,c=l.features.getArray().find(u=>u.getGeometry()?.getType()===Ie.LINE_STRING);if(c){let u=rl(new ea(c.getGeometry().getClosestPoint(l.mapBrowserEvent.coordinate)).getExtent(),.001);o=this.segments.findIndex(P=>P.getGeometry().intersectsExtent(u))}let i=(l.features.getArray().filter(u=>u.getGeometry()?.getType()===Ie.POINT)||[])[0];this.initialRouteDrag={viaPoint:i,oldRoute:c&&c.clone(),segmentIndex:o}}onModifyEnd(l){let o=l.mapBrowserEvent.coordinate,{oldRoute:c,viaPoint:i,segmentIndex:u}=this.initialRouteDrag;return i?this.addViaPoint(o,i.get("viaPointIdx"),1):c?u===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(o,u+1):this.addViaPoint(o,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 m_({source:this.routingLayer.olLayer.getSource(),pixelTolerance:4,hitDetection:this.routingLayer.olLayer,deleteCondition:l=>{let c=l.target.getFeaturesAtPixel(l.pixel,{hitTolerance:5}).find(i=>i.getGeometry()?.getType()===Ie.POINT&&i.get("index"));return b0(l)&&c?(this.removeViaPoint(c.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(){Na(this.onMapClickKey)}activate(){super.activate(),this.map?(this.format=new al({featureProjection:this.map.getView().getProjection()}),this.graphsResolutions=bd.getGraphsResolutions(this.graphs,this.map),this.map.removeInteraction(this.modifyInteraction),this.routingLayer.attachToMap(this.map),this.map.addInteraction(this.modifyInteraction),this.modifyInteraction.setActive(this.modify),this.addListeners()):(this.format=new al({featureProjection:"EPSG:3857"}),this.graphsResolutions=this.graphs)}deactivate(){this.map&&(this.routingLayer.detachFromMap(this.map),this.map.removeInteraction(this.modifyInteraction),this.removeListeners(),this.reset()),super.deactivate()}},j0=bd;var xE=v=>class extends v{constructor(l={}){super(l);let{apiParams:o,apiKey:c,url:i}=l;this.apiParams={limit:20,...o||{}},this.placeholder=l.placeholder||"Search for a stop...";let u={apiKey:c};i&&(u.url=i),this.api=new qf(u),this.abortController=new AbortController}render(l){let o=l?.features||[];!this.suggestionsElt||(this.suggestionsElt.style.display=o.length?"block":"none",this.suggestionsElt.innerHTML="",o.forEach(c=>{let{properties:i}=c,u=document.createElement("div");u.innerHTML=i.name,u.onclick=()=>{this.onSuggestionClick(c)},Object.assign(u.style,{padding:"5px 12px"}),this.suggestionsElt.appendChild(u)}))}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=l=>{this.abortController.abort(),this.abortController=new AbortController,this.search(l.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(l,o){return(l!==void 0||l!==null)&&(this.apiParams.q=l),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,o).then(c=>{this.render(c)}).catch(()=>{this.render()})}onSuggestionClick(l){}clear(){!this.suggestionsElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}},q0=xE;var b_=class extends q0(ch){onSuggestionClick({geometry:l}){let o=ro(l.coordinates);this.map.getView().setCenter(o)}},Z0=b_;var W0=Fp(X0());var bE=v=>class extends v{constructor(l={}){super(l),this.olLayer=new Qh({source:new nf({}),render:this.getOlLayerRender(this)}),this.styleUrl=l.url,this.apiKey=l.apiKey,this.apiKeyName=l.apiKeyName||"key",this.updateAttribution=this.updateAttribution.bind(this)}attachToMap(l){super.attachToMap(l),this.map&&(this.format=new al({featureProjection:this.map.getView().getProjection()}),this.loadMbMap())}detachFromMap(){this.mbMap&&(this.mbMap.off("idle",this.updateAttribution),this.mbMap.triggerRepaint=()=>{},this.mbMap.remove(),this.mbMap=null),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 l=document.createElement("div");l.style.position="absolute",l.style.width="100%",l.style.height="100%",!this.apiKey&&!this.styleUrl.includes(this.apiKeyName)&&console.error(`No apiKey defined for mapbox layer with style url to ${this.styleUrl}`);let o=this.getMapboxMapClass();this.mbMap=new o({style:$h(this.styleUrl,{[this.apiKeyName]:this.apiKey}).toString(),container:l,interactive:!1,trackResize:!1,attributionControl:!1,...this.options.mapOptions||{}}),this.mbMap.once("load",()=>{this.loaded=!0,this.dispatchEvent({type:"load",target:this})}),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(l){let o=fc(l.target)||[];this.copyrights?.toString()!==o.toString()&&(this.copyrights=o,this.olLayer.getSource()?.setAttributions(o))}getFeatureInfoAtCoordinate(l,o){if(!o||!this.format||!this.mbMap||!this.mbMap.isStyleLoaded())return Promise.resolve({coordinate:l,features:[],layer:this});let c=l&&this.mbMap.project(lh(l));if(this.hitTolerance){let{x:u,y:P}=c;c=[{x:u-this.hitTolerance,y:P-this.hitTolerance},{x:u+this.hitTolerance,y:P+this.hitTolerance}]}let i=this.mbMap.queryRenderedFeatures(c,o).map(u=>{let P=this.format.readFeature(u);return P&&P.set("mapboxFeature",u),P});return Promise.resolve({layer:this,features:i,coordinate:l})}},Ym=bE;var sp=class extends Ym(xa){attachToMap(l){super.attachToMap(l),!(!this.map||this.mbMap)&&this.olListenersKeys.push(this.map.on("change:size",()=>{try{this.mbMap&&this.mbMap.resize()}catch(o){console.warn(o)}}))}loadMbMap(){let[l,o]=this.map.getView().getCenter();(!l||!o)&&(l=0,o=0),this.renderState={center:[l,o],zoom:null,rotation:null,visible:null,opacity:null,size:[0,0]},super.loadMbMap(),this.mbMap.once("load",()=>{this.mbMap.resize(),this.copyrights=fc(this.mbMap)||[],this.olLayer.getSource()?.setAttributions(this.copyrights)});let c=this.mbMap.getCanvas();c&&(this.options.tabIndex?c.setAttribute("tabindex",this.options.tabIndex):c.removeAttribute("tabindex"))}getOlLayerRender(){return Yp(this)}getMapboxMapClass(){return W0.Map}clone(l){return new sp({...this.options,...l})}};var Y0=Fp(K0());var lp=class extends Ym(xa){getOlLayerRender(){return Kp(this)}getMapboxMapClass(){return Y0.Map}clone(l){return new lp({...this.options,...l})}};var wd=class extends xa{constructor(l={}){if(super(l),this.mapboxLayer=l.mapboxLayer,this.disabled=!1,this.styleLayersFilter=l.styleLayersFilter,this.beforeId=l.beforeId,this.featureInfoFilter=l.featureInfoFilter||(o=>o),this.queryRenderedLayersFilter=l.queryRenderedLayersFilter,this.highlightedFeatures=[],this.selectedFeatures=[],this.styleLayers=(l.styleLayer?[l.styleLayer]:l.styleLayers)||[],this.addStyleLayers=this.addStyleLayers.bind(this),this.onLoad=this.onLoad.bind(this),l.filters&&(this.addDynamicFilters=()=>{this.setFilter(typeof l.filters=="function"?l.filters(this):l.filters)}),!this.styleLayersFilter&&this.styleLayers){let o=this.styleLayers.map(c=>c.id);this.styleLayersFilter=c=>o.includes(c.id)}}attachToMap(l){if(this.mapboxLayer.map||this.mapboxLayer.attachToMap(l),super.attachToMap(l),!this.map)return;let{mbMap:o}=this.mapboxLayer;if(!o){this.olListenersKeys.push(this.map.on("change:target",()=>{this.attachToMap(l)}));return}this.mapboxLayer.loaded||o.isStyleLoaded()||o.loaded()?this.onLoad():o.once("load",this.onLoad),this.olListenersKeys.push(this.on("change:visible",c=>{this.applyLayoutVisibility(c)})),this.olListenersKeys.push(this.mapboxLayer.on("load",()=>{this.onLoad()}))}detachFromMap(l){let{mbMap:o}=this.mapboxLayer;o&&(o.off("load",this.onLoad),this.removeStyleLayers()),super.detachFromMap(l)}addStyleLayers(){let{mbMap:l}=this.mapboxLayer;!l||(this.styleLayers.forEach(o=>{let{id:c,source:i}=o;l.getSource(i)&&!l.getLayer(c)&&l.addLayer(o,this.beforeId)}),this.applyLayoutVisibility())}removeStyleLayers(){let{mbMap:l}=this.mapboxLayer;!l||this.styleLayers.forEach(o=>{l.getLayer(o.id)&&l.removeLayer(o.id)})}onLoad(){this.addStyleLayers(),this.addDynamicFilters&&this.addDynamicFilters();let{mbMap:l}=this.mapboxLayer,o=l.getStyle();if(o&&this.styleLayersFilter){let c=o.layers.filter(this.styleLayersFilter);this.disabled=!c.length}}getFeatureInfoAtCoordinate(l){let{mbMap:o}=this.mapboxLayer;if(!o||!o.isStyleLoaded())return Promise.resolve({coordinate:l,features:[],layer:this});let c=this.styleLayers||[];return this.styleLayersFilter&&(c=o.getStyle().layers.filter(this.styleLayersFilter)),this.queryRenderedLayersFilter&&(c=o.getStyle().layers.filter(this.queryRenderedLayersFilter)),this.mapboxLayer.getFeatureInfoAtCoordinate(l,{layers:c.map(i=>i&&i.id),validate:!1}).then(i=>{let u=i.features.filter(P=>this.featureInfoFilter(P,this.map.getView().getResolution()));return this.highlight(u),{...i,features:u,layer:this}})}setFilter(l){let{mbMap:o}=this.mapboxLayer;!o||this.styleLayers.forEach(({id:c})=>{o.getLayer(c)&&o.setFilter(c,l)})}setHoverState(l,o){let{mbMap:c}=this.mapboxLayer;!l||!c||l.forEach(i=>{let{source:u,sourceLayer:P}=i.get("mapboxFeature")||{};if(!u&&!P||!i.getId()){i.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.",i.getId(),i.getProperties());return}c.setFeatureState({id:i.getId(),source:u,sourceLayer:P},{hover:o})})}select(l=[]){this.setHoverState(this.selectedFeatures,!1),this.selectedFeatures=l,this.setHoverState(this.selectedFeatures,!0)}highlight(l=[]){let o=this.highlightedFeatures.filter(c=>!this.selectedFeatures.map(i=>i.getId()).includes(c.getId()));this.setHoverState(o,!1),this.highlightedFeatures=l,this.setHoverState(this.highlightedFeatures,!0)}applyLayoutVisibility(l){let{visible:o}=this,{mbMap:c}=this.mapboxLayer,i=this.styleLayersFilter;if(!c)return;let u=c.getStyle();if(!!u&&i){let P=o?"visible":"none";for(let D=0;D<u.layers.length;D+=1){let F=u.layers[D];i(F)&&c.getLayer(F.id)&&c.setLayoutProperty(F.id,"visibility",P)}}}clone(l){return new wd({...this.options,...l})}},H0=wd;var P_=Fp(e1()),M_=Fp(a1());var rS=v=>class extends v{constructor(l={}){super({hitTolerance:10,...l}),this.debug=l.debug,this.mode=l.mode||Zo.TOPOGRAPHIC,this.api=l.api||new Zf(l),this.tenant=l.tenant||"",this.minZoomNonTrain=l.minZoomNonTrain||9,this.minZoomInterpolation=l.minZoomInterpolation||8,this.format=new al,this.generalizationLevelByZoom=l.generalizationLevelByZoom||[5,5,5,5,5,5,5,5,10,30,30,100,100,100],this.getGeneralizationLevelByZoom=o=>l.getGeneralizationLevelByZoom&&l.getGeneralizationLevelByZoom(o,this.generalizationLevelByZoom)||this.generalizationLevelByZoom[o],this.renderTimeIntervalByZoom=l.renderTimeIntervalByZoom||[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],this.getRenderTimeIntervalByZoom=o=>l.getRenderTimeIntervalByZoom&&l.getRenderTimeIntervalByZoom(o,this.renderTimeIntervalByZoom)||this.renderTimeIntervalByZoom[o],this.isUpdateBboxOnMoveEnd=l.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,M_.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,P_.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(l){let{style:o,speed:c,pixelRatio:i,hoverVehicleId:u,selectedVehicleId:P,filter:D,sort:F,time:U,live:N,canvas:at,styleOptions:yt}=l,Tt=c||1,Lt=U||new Date;super.defineProperties(l),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{value:at||document.createElement("canvas")},style:{value:o||Jh},styleOptions:{value:{...Hp,...yt||{}}},speed:{get:()=>Tt,set:Vt=>{Tt=Vt,this.start()}},filter:{value:D,writable:!0},sort:{value:F,writable:!0},live:{value:N===!1?N:!0,writable:!0},time:{get:()=>Lt,set:Vt=>{Lt=Vt&&Vt.getTime?Vt:new Date(Vt),this.renderTrajectories()}},trajectories:{value:{},writable:!0},hoverVehicleId:{value:u,writable:!0},selectedVehicleId:{value:P,writable:!0},pixelRatio:{value:i||(typeof window<"u"?window.devicePixelRatio:1),writable:!0},useRequestAnimationFrame:{value:l.useRequestAnimationFrame||!1,writable:!0},useThrottle:{value:l.useThrottle!==!1,writable:!0},useDebounce:{value:l.useDebounce||!1,writable:!0}})}attachToMap(l){super.attachToMap(l),this.visible&&this.start(),this.visibilityRef=this.on("change:visible",o=>{o.target.visible?this.start():this.stop()}),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),Na(this.visibilityRef),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,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,this.isUpdateBboxOnMoveEnd),this.isUpdateBboxOnMoveEnd&&this.setBbox()}startUpdateTime(){this.stopUpdateTime(),this.updateTimeDelay=this.getRefreshTimeInMs(),this.updateTimeInterval=setInterval(()=>{this.time=this.live?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)}renderTrajectoriesInternal(l,o){if(!this.map)return!1;let c=this.live?Date.now():this.time,i=Object.values(this.trajectories);return this.sort&&i.sort(this.sort),this.renderState=Wf(this.canvas,i,this.style,{...l,pixelRatio:this.pixelRatio,time:c},{noInterpolate:l.zoom<this.minZoomInterpolation?!0:o,hoverVehicleId:this.hoverVehicleId,selectedVehicleId:this.selectedVehicleId,...this.styleOptions}),!0}renderTrajectories(l,o){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=null),!o&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(l,o)}):!o&&this.useDebounce?this.debounceRenderTrajectories(l,o):!o&&this.useThrottle?this.throttleRenderTrajectories(l,o):this.renderTrajectoriesInternal(l,o)}setBbox(l,o){let c=Object.keys(this.trajectories);for(let u=c.length-1;u>=0;u-=1)this.purgeTrajectory(this.trajectories[c[u]],l,o);let i=[...l];this.isUpdateBboxOnMoveEnd&&(i.push(o),this.tenant&&i.push(`tenant=${this.tenant}`),this.generalizationLevel=this.getGeneralizationLevelByZoom(o),this.generalizationLevel&&i.push(`gen=${this.generalizationLevel}`)),this.api.bbox=i}setMode(l){this.mode!==l&&(this.mode=l,this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,this.isUpdateBboxOnMoveEnd))}getRefreshTimeInMs(l){let o=Math.round(l),c=this.getRenderTimeIntervalByZoom(o)||25,i=Math.max(25,c/this.speed),u=Math.min(i,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,M_.default)(this.renderTrajectoriesInternal,u,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,P_.default)(this.renderTrajectoriesInternal,u,{leading:!0,trailing:!0,maxWait:5e3})),this.api?.buffer){let[,P]=this.api.buffer;this.api.buffer=[u,P]}return i}getVehicle(l){return Object.values(this.trajectories).filter(l)}getFeatureInfoAtCoordinate(l,o={}){let{resolution:c,nb:i}=o,u=rl([...l,...l],this.hitTolerance*c),P=Object.values(this.trajectories);this.sort&&(P=P.sort(this.sort));let D=[];for(let F=0;F<P.length&&(P[F].properties.coordinate&&qp(u,P[F].properties.coordinate)&&D.push(P[F]),D.length!==i);F+=1);return Promise.resolve({layer:this,features:D.map(F=>this.format.readFeature(F)),coordinate:l})}getTrajectoryInfos(l){let o=[this.api.getStopSequence(l,this.mode),this.api.getFullTrajectory(l,this.mode,this.generalizationLevel)];return Promise.all(o).then(([c,i])=>({stopSequence:c,fullTrajectory:i}))}purgeTrajectory(l,o,c){let{type:i,bounds:u,train_id:P}=l.properties;return!Ao(o,u)||i!=="rail"&&c<(this.minZoomNonTrain||9)?(this.removeTrajectory(P),!0):!1}addTrajectory(l){this.filter&&!this.filter(l)||(this.trajectories[l.properties.train_id]=l,this.renderTrajectories())}removeTrajectory(l){delete this.trajectories[l]}onZoomEnd(l){this.startUpdateTime()}onDocumentVisibilityChange(){!this.visible||(document.hidden?this.stop():this.start())}onTrajectoryMessage(l){if(!l.content)return;let o=l.content,{geometry:c,properties:{train_id:i,time_since_update:u,raw_coordinates:P}}=o;u<0||this.purgeTrajectory(o)||(this.debug&&this.mode===Zo.TOPOGRAPHIC&&P?o.properties.olGeometry={type:"Point",coordinates:ro(P,this.map.getView().getProjection())}:o.properties.olGeometry=this.format.readGeometry(c),o.properties.timeOffset=Date.now()-l.timestamp,this.addTrajectory(o))}onDeleteTrajectoryMessage(l){!l.content||this.removeTrajectory(l.content)}onFeatureHover(l,o,c){let[i]=l,u=null;i&&(u=i.get("train_id")),this.hoverVehicleId!==u&&(this.hoverVehicleId=u,this.renderTrajectories(!0))}onFeatureClick(l,o,c){let[i]=l,u=null;i&&(u=i.get("train_id")),this.selectedVehicleId!==u&&(this.selectedVehicleId=u,this.selectedVehicle=i,this.renderTrajectories(!0))}},Jm=rS;var iS=new Wl({zIndex:2,image:new ol({radius:5,fill:new Ds({color:"#000000"})}),stroke:new ra({color:"#000000",width:6})}),nS=(v,l,o)=>{let c="#ffffff",i=v.get("type"),u=v.get("stroke");return u&&u[0]!=="#"&&(u=`#${u}`),c=u||o?.getBgColor(i),c=/#ffffff/i.test(c)?"#ff0000":c,[iS,new Wl({zIndex:3,image:new ol({radius:4,fill:new Ds({color:c})}),stroke:new ra({color:c,width:4})})]},Qm=nS;var oS=new Wl({zIndex:2,image:new ol({radius:5,fill:new Ds({color:"#000000"})}),stroke:new ra({color:"#000000",width:6})}),aS=new Wl({zIndex:3,image:new ol({radius:4,fill:new Ds({color:"#a0a0a0"})}),stroke:new ra({color:"#a0a0a0",width:4})}),sS=()=>[oS,aS],s1=sS;var lS=new al,Ed=class extends Jm(xa){constructor(l={}){super({...l}),this.olLayer=l.olLayer||new h_({layers:[new np({source:new op({features:[]}),style:(o,c)=>(l.fullTrajectoryStyle||Qm)(o,c,this.styleOptions)}),new Qh({source:new nf({}),render:o=>{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.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:c,resolution:i,rotation:u}=o.viewState,{center:P,resolution:D,rotation:F}=this.renderedViewState;if(D/i>=3)this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height);else{let U=this.map.getPixelFromCoordinate(P),N=this.map.getPixelFromCoordinate(c);this.transformContainer.style.transform=Iv(U[0]-N[0],U[1]-N[1],D/i,D/i,u-F,0,0)}}return this.container}})]}),this.vectorLayer=this.olLayer.getLayers().item(0),this.renderState={center:[0,0],zoom:null,rotation:0}}attachToMap(l){super.attachToMap(l),this.map&&this.olListenersKeys.push(this.map.on(["moveend","change:target"],o=>{let c=this.map.getView();if(c.getAnimating()||c.getInteracting())return;let i=c.getZoom();this.currentZoom!==i&&this.onZoomEnd(o),this.currentZoom=i,this.onMoveEnd(o)}))}detachFromMap(){super.detachFromMap(),this.container=null}hasFeatureInfoAtCoordinate(l){if(this.map&&this.canvas){let o=this.canvas.getContext("2d"),c=this.map.getPixelFromCoordinate(l);return!!o.getImageData(c[0]*this.pixelRatio,c[1]*this.pixelRatio,1,1).data[3]}return!1}renderTrajectories(l){let o=this.map.getView();super.renderTrajectories({size:this.map.getSize(),center:this.map.getView().getCenter(),extent:o.calculateExtent(),resolution:o.getResolution(),rotation:o.getRotation(),zoom:o.getZoom(),pixelRatio:this.pixelRatio},l)}renderTrajectoriesInternal(l,o){if(!this.map)return!1;let c=!1;return c=this.map.getView().getAnimating()||this.map.getView().getInteracting()?!1:super.renderTrajectoriesInternal(l,o),c&&(this.renderedViewState={...l},this.transformContainer&&(this.transformContainer.style.transform="")),c}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getView().getZoom())}getFeatureInfoAtCoordinate(l,o={}){let c=this.map.getView().getResolution();return super.getFeatureInfoAtCoordinate(l,{resolution:c,...o})}onMoveEnd(){this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.userClickInteractions&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}onZoomEnd(l){super.onZoomEnd(l)}onFeatureHover(l,o,c){super.onFeatureHover(l,o,c),this.map.getTargetElement().style.cursor=l.length?"pointer":"auto"}onFeatureClick(l,o,c){super.onFeatureClick(l,o,c),!l.length&&this.vectorLayer&&this.vectorLayer.getSource().clear(),this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}purgeTrajectory(l,o,c){return super.purgeTrajectory(l,o||this.map.getView().calculateExtent(),c||this.map.getView().getZoom())}setBbox(l,o){let c=l,i=o;!c&&this.isUpdateBboxOnMoveEnd&&(c=l||this.map.getView().calculateExtent(),i=Math.floor(this.map.getView().getZoom())),super.setBbox(c,i)}highlightTrajectory(l){this.api.getFullTrajectory(l,this.mode,this.generalizationLevel).then(o=>{if(this.vectorLayer.getSource().clear(),!o||!o.features||!o.features.length)return;let i=lS.readFeatures(o);this.vectorLayer.getSource().addFeatures(i)})}clone(l){return new Ed({...this.options,...l})}},l1=Ed;var Sd=class extends xa{getFeatureInfoAtCoordinate(l){let o=[];if(this.map){let c=this.map.getPixelFromCoordinate(l);o=this.map.getFeaturesAtPixel(c,{layerFilter:i=>i===this.olLayer,hitTolerance:this.hitTolerance})}return Promise.resolve({features:o,layer:this,coordinate:l})}clone(l){return new Sd({...this.options,...l})}},u1=Sd;var Td=class extends xa{constructor(l={}){super(l),this.abortController=new AbortController,this.format=new al}getFeatureInfoUrl(l){let o=this.map.getView().getProjection(),c=this.map.getView().getResolution();return this.olLayer.getSource().getFeatureInfoUrl?this.olLayer.getSource().getFeatureInfoUrl(l,c,o,{info_format:"application/json",query_layers:this.olLayer.getSource().getParams().layers}):!1}getFeatureInfoAtCoordinate(l){this.abortController.abort(),this.abortController=new AbortController;let{signal:o}=this.abortController;return fetch(this.getFeatureInfoUrl(l),{signal:o}).then(c=>c.json()).then(c=>c.features).then(c=>({layer:this,coordinate:l,features:c.map(i=>this.format.readFeature(i))})).catch(()=>Promise.resolve({features:[],coordinate:l,layer:this}))}clone(l){return new Td({...this.options,...l})}},c1=Td;var ig={};Qg(ig,{CopyrightControl:()=>h1,Layer:()=>eg,RealtimeAPI:()=>Zf,RealtimeLayer:()=>I1,RealtimeModes:()=>Zo,RoutingAPI:()=>jf,StopsAPI:()=>qf,createTrackerFilters:()=>oy,getCircleCanvas:()=>Ay,getDelayBgCanvas:()=>Iy,getDelayTextCanvas:()=>Cy,getHoursAndMinutes:()=>bv,getLayersAsFlatArray:()=>Xf,getMapboxMapCopyrights:()=>fc,getMapboxRender:()=>Yp,getMaplibreRender:()=>Kp,getTextCanvas:()=>Py,getUTCDateString:()=>vv,getUTCTimeString:()=>xv,getUrlWithParams:()=>$h,pad:()=>mm,realtimeDefaultStyle:()=>Jh,realtimeDelayStyle:()=>My,realtimeSimpleStyle:()=>Ly,removeDuplicate:()=>Kh,renderTrajectories:()=>Wf,sortByDelay:()=>ay,trackerConfig:()=>Hp});var L_=class extends Am(ch){constructor(l){super(l),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 fc(this.map)}},h1=L_;var Id=class extends Wm(ap){attachToMap(l){super.attachToMap(l),!!this.map&&this.userInteractions&&(this.toggleVisibleListeners(),this.onChangeVisibleKey=this.on("change:visible",this.toggleVisibleListeners))}detachFromMap(){this.map&&(this.deactivateUserInteractions(),Na(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 l=this.map.getBounds().toArray();return Jf([...l[0],...l[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(l){return new Id({...this.options,...l})}},eg=Id;var Fo=63710088e-1,p1={centimeters:Fo*100,centimetres:Fo*100,degrees:Fo/111325,feet:Fo*3.28084,inches:Fo*39.37,kilometers:Fo/1e3,kilometres:Fo/1e3,meters:Fo,metres:Fo,miles:Fo/1609.344,millimeters:Fo*1e3,millimetres:Fo*1e3,nauticalmiles:Fo/1852,radians:1,yards:Fo*1.0936},s5={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/Fo,yards:1.0936133};function f1(v,l,o){o===void 0&&(o={});var c={type:"Feature"};return(o.id===0||o.id)&&(c.id=o.id),o.bbox&&(c.bbox=o.bbox),c.properties=l||{},c.geometry=v,c}function bh(v,l,o){if(o===void 0&&(o={}),!v)throw new Error("coordinates is required");if(!Array.isArray(v))throw new Error("coordinates must be an Array");if(v.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!k_(v[0])||!k_(v[1]))throw new Error("coordinates must contain numbers");var c={type:"Point",coordinates:v};return f1(c,l,o)}function uS(v,l){l===void 0&&(l="kilometers");var o=p1[l];if(!o)throw new Error(l+" units is invalid");return v*o}function cS(v,l){l===void 0&&(l="kilometers");var o=p1[l];if(!o)throw new Error(l+" units is invalid");return v/o}function d1(v){var l=v%(2*Math.PI);return l*180/Math.PI}function up(v){var l=v%360;return l*Math.PI/180}function rg(v,l,o){if(l===void 0&&(l="kilometers"),o===void 0&&(o="kilometers"),!(v>=0))throw new Error("length must be a positive number");return uS(cS(v,l),o)}function k_(v){return!isNaN(v)&&v!==null&&!Array.isArray(v)}function z_(v){return!!v&&v.constructor===Object}function Cd(v,l,o){if(v!==null)for(var c,i,u,P,D,F,U,N=0,at=0,yt,Tt=v.type,Lt=Tt==="FeatureCollection",Vt=Tt==="Feature",wt=Lt?v.features.length:1,kt=0;kt<wt;kt++){U=Lt?v.features[kt].geometry:Vt?v.geometry:v,yt=U?U.type==="GeometryCollection":!1,D=yt?U.geometries.length:1;for(var Zt=0;Zt<D;Zt++){var Yt=0,le=0;if(P=yt?U.geometries[Zt]:U,P!==null){F=P.coordinates;var ue=P.type;switch(N=o&&(ue==="Polygon"||ue==="MultiPolygon")?1:0,ue){case null:break;case"Point":if(l(F,at,kt,Yt,le)===!1)return!1;at++,Yt++;break;case"LineString":case"MultiPoint":for(c=0;c<F.length;c++){if(l(F[c],at,kt,Yt,le)===!1)return!1;at++,ue==="MultiPoint"&&Yt++}ue==="LineString"&&Yt++;break;case"Polygon":case"MultiLineString":for(c=0;c<F.length;c++){for(i=0;i<F[c].length-N;i++){if(l(F[c][i],at,kt,Yt,le)===!1)return!1;at++}ue==="MultiLineString"&&Yt++,ue==="Polygon"&&le++}ue==="Polygon"&&Yt++;break;case"MultiPolygon":for(c=0;c<F.length;c++){for(le=0,i=0;i<F[c].length;i++){for(u=0;u<F[c][i].length-N;u++){if(l(F[c][i][u],at,kt,Yt,le)===!1)return!1;at++}le++}Yt++}break;case"GeometryCollection":for(c=0;c<P.geometries.length;c++)if(Cd(P.geometries[c],l,o)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function hS(v,l){l===void 0&&(l={});var o=0,c=0,i=0;return Cd(v,function(u){o+=u[0],c+=u[1],i++},!0),bh([o/i,c/i],l.properties)}var m1=hS;function Du(v){if(!v)throw new Error("coord is required");if(!Array.isArray(v)){if(v.type==="Feature"&&v.geometry!==null&&v.geometry.type==="Point")return v.geometry.coordinates;if(v.type==="Point")return v.coordinates}if(Array.isArray(v)&&v.length>=2&&!Array.isArray(v[0])&&!Array.isArray(v[1]))return v;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function g1(v){if(Array.isArray(v))return v;if(v.type==="Feature"){if(v.geometry!==null)return v.geometry.coordinates}else if(v.coordinates)return v.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function pS(v,l,o){o===void 0&&(o={});var c;o.final?c=y1(Du(l),Du(v)):c=y1(Du(v),Du(l));var i=c>180?-(360-c):c;return i}function y1(v,l){var o=up(v[1]),c=up(l[1]),i=up(l[0]-v[0]);i>Math.PI&&(i-=2*Math.PI),i<-Math.PI&&(i+=2*Math.PI);var u=Math.log(Math.tan(c/2+Math.PI/4)/Math.tan(o/2+Math.PI/4)),P=Math.atan2(i,u);return(d1(P)+360)%360}var _1=pS;function fS(v,l,o){o===void 0&&(o={});var c=Du(v),i=Du(l);i[0]+=i[0]-c[0]>180?-360:c[0]-i[0]>180?360:0;var u=dS(c,i),P=rg(u,"meters",o.units);return P}function dS(v,l,o){o=o===void 0?Fo:Number(o);var c=o,i=v[1]*Math.PI/180,u=l[1]*Math.PI/180,P=u-i,D=Math.abs(l[0]-v[0])*Math.PI/180;D>Math.PI&&(D-=2*Math.PI);var F=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(i/2+Math.PI/4)),U=Math.abs(F)>1e-11?P/F:Math.cos(i),N=Math.sqrt(P*P+U*U*D*D),at=N*c;return at}var v1=fS;function mS(v,l,o,c){c===void 0&&(c={});var i=l<0,u=rg(Math.abs(l),c.units,"meters");i&&(u=-Math.abs(u));var P=Du(v),D=gS(P,u,o);return D[0]+=D[0]-P[0]>180?-360:P[0]-D[0]>180?360:0,bh(D,c.properties)}function gS(v,l,o,c){c=c===void 0?Fo:Number(c);var i=l/c,u=v[0]*Math.PI/180,P=up(v[1]),D=up(o),F=i*Math.cos(D),U=P+F;Math.abs(U)>Math.PI/2&&(U=U>0?Math.PI-U:-Math.PI-U);var N=Math.log(Math.tan(U/2+Math.PI/4)/Math.tan(P/2+Math.PI/4)),at=Math.abs(N)>1e-11?F/N:Math.cos(P),yt=i*Math.sin(D)/at,Tt=u+yt;return[(Tt*180/Math.PI+540)%360-180,U*180/Math.PI]}var x1=mS;function yS(v){if(!v)throw new Error("geojson is required");switch(v.type){case"Feature":return b1(v);case"FeatureCollection":return _S(v);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return R_(v);default:throw new Error("unknown GeoJSON type")}}function b1(v){var l={type:"Feature"};return Object.keys(v).forEach(function(o){switch(o){case"type":case"properties":case"geometry":return;default:l[o]=v[o]}}),l.properties=w1(v.properties),l.geometry=R_(v.geometry),l}function w1(v){var l={};return v&&Object.keys(v).forEach(function(o){var c=v[o];typeof c=="object"?c===null?l[o]=null:Array.isArray(c)?l[o]=c.map(function(i){return i}):l[o]=w1(c):l[o]=c}),l}function _S(v){var l={type:"FeatureCollection"};return Object.keys(v).forEach(function(o){switch(o){case"type":case"features":return;default:l[o]=v[o]}}),l.features=v.features.map(function(o){return b1(o)}),l}function R_(v){var l={type:v.type};return v.bbox&&(l.bbox=v.bbox),v.type==="GeometryCollection"?(l.geometries=v.geometries.map(function(o){return R_(o)}),l):(l.coordinates=E1(v.coordinates),l)}function E1(v){var l=v;return typeof l[0]!="object"?l.slice():l.map(function(o){return E1(o)})}var S1=yS;function vS(v,l,o){if(o=o||{},!z_(o))throw new Error("options is invalid");var c=o.pivot,i=o.mutate;if(!v)throw new Error("geojson is required");if(l==null||isNaN(l))throw new Error("angle is required");return l===0||(c||(c=m1(v)),(i===!1||i===void 0)&&(v=S1(v)),Cd(v,function(u){var P=_1(c,u),D=P+l,F=v1(c,u),U=g1(x1(c,F,D));u[0]=U[0],u[1]=U[1]})),v}var D_=vS;var T1=v=>{let l=v.getBounds().toArray(),o=ro(l[0]),c=ro(l[1]),i=[...o,...c],{width:u,height:P}=v.getCanvas(),D=hs(i)/u,F=Au(i)/P;return Math.max(D,F)},O_=(v,l)=>{let{width:o,height:c}=v.getCanvas(),i=v.unproject({x:0,y:0}),u=v.unproject({x:0,y:c/l}),P=v.unproject({x:o/l,y:c/l}),D=v.unproject({x:o/l,y:0});return[[i.lng,i.lat],[D.lng,D.lat],[P.lng,P.lat],[u.lng,u.lat]]};var F_=class extends Jm(eg){constructor(l={}){super({...l}),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(l,o){if(!l)return;let c=l.getCanvas();super.attachToMap(l,{width:c.width/this.pixelRatio,height:c.height/this.pixelRatio}),this.source={type:"canvas",canvas:this.canvas,coordinates:O_(l,this.pixelRatio),animate:!0,attribution:this.copyrights&&this.copyrights.join(", ")},this.beforeId=o,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"}},l.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(l=>{Na(l)}),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(l){super.onUserMoveCallback({coordinate:ro(l.lngLat.toArray()),...l})}renderTrajectories(l){if(!this.map)return;let{width:o,height:c}=this.map.getCanvas(),i=this.map.getCenter(),u=this.map.unproject({x:0,y:c/this.pixelRatio}),P=this.map.unproject({x:o/this.pixelRatio,y:0}),D=D_(bh([u.lng,u.lat]),-this.map.getBearing(),{pivot:[i.lng,i.lat]}).geometry.coordinates,F=D_(bh([P.lng,P.lat]),-this.map.getBearing(),{pivot:[i.lng,i.lat]}).geometry.coordinates,U=[...ro(D),...ro(F)],N=hs(U)/(o/this.pixelRatio),at=Au(U)/(c/this.pixelRatio),yt=Math.max(N,at),Tt={size:[o/this.pixelRatio,c/this.pixelRatio],center:ro([i.lng,i.lat]),extent:U,resolution:yt,zoom:this.map.getZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(Tt,l)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(l,o={}){let c=T1(this.map);return super.getFeatureInfoAtCoordinate(l,{resolution:c,...o})}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(l,o,c){return super.purgeTrajectory(l,o||this.getMercatorExtent(),c||Math.floor(this.map.getZoom()+1))}setBbox(l,o){let c=l,i=o;!c&&this.isUpdateBboxOnMoveEnd&&(c=l||this.getMercatorExtent(),i=Math.floor(this.getOlZoom())),super.setBbox(c,i)}onMove(){this.renderTrajectories()}renderTrajectoriesInternal(l,o){let c=super.renderTrajectoriesInternal(l,o);if(c&&this.map.style){let i=O_(this.map,this.pixelRatio),u=this.map.getSource(this.key);u&&u.setCoordinates(i)}return c}onMoveEnd(){this.renderTrajectories(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox()}onFeatureHover(l,o,c){super.onFeatureHover(l,o,c),this.map.getCanvasContainer().style.cursor=l.length?"pointer":"auto"}},I1=F_;var B_={ol:tg,mapbox:ig};typeof window<"u"&&(window.mbt=B_);var i3=B_;})();
1007
+ `){yr+=Lr,Lr=0,qe=yt*ue+Be*Tt,++br;continue}var ti=Lt[pr+1]||F.font;ti!==xr&&(i&&rr.push("font",ti),c&&Ce.push("font",ti),xr=ti),Lr=Math.max(Lr,Yt[_r]);var oi=[Fe,qe+Be*Zt[_r]+yt*(Zt[_r]-le[br]),.5*(Tt+Lr)+yr];qe+=Zt[_r],i&&rr.push("strokeText",oi),c&&Ce.push("fillText",oi),++_r}return Array.prototype.push.apply(oe,rr),Array.prototype.push.apply(oe,Ce),this.labels_[u]=Pe,Pe},v.prototype.replayTextBackground_=function(l,o,c,i,u,P,D){l.beginPath(),l.moveTo.apply(l,o),l.lineTo.apply(l,c),l.lineTo.apply(l,i),l.lineTo.apply(l,u),l.lineTo.apply(l,o),P&&(this.alignFill_=P[2],this.fill_(l)),D&&(this.setStrokeStyle_(l,D),l.stroke())},v.prototype.calculateImageOrLabelDimensions_=function(l,o,c,i,u,P,D,F,U,N,at,yt,Tt,Lt,Vt,wt){D*=yt[0],F*=yt[1];var kt=c-D,Zt=i-F,Yt=u+U>l?l-U:u,le=P+N>o?o-N:P,ue=Lt[3]+Yt*yt[0]+Lt[1],oe=Lt[0]+le*yt[1]+Lt[2],ge=kt-Lt[3],we=Zt-Lt[0];(Vt||at!==0)&&(yh[0]=ge,_h[0]=ge,yh[1]=we,Tc[1]=we,Tc[0]=ge+ue,Ic[0]=Tc[0],Ic[1]=we+oe,_h[1]=Ic[1]);var Pe;return at!==0?(Pe=us(va(),c,i,1,1,at,-c,-i),uo(Pe,yh),uo(Pe,Tc),uo(Pe,Ic),uo(Pe,_h),sh(Math.min(yh[0],Tc[0],Ic[0],_h[0]),Math.min(yh[1],Tc[1],Ic[1],_h[1]),Math.max(yh[0],Tc[0],Ic[0],_h[0]),Math.max(yh[1],Tc[1],Ic[1],_h[1]),rf)):sh(Math.min(ge,ge+ue),Math.min(we,we+oe),Math.max(ge,ge+ue),Math.max(we,we+oe),rf),Tt&&(kt=Math.round(kt),Zt=Math.round(Zt)),{drawImageX:kt,drawImageY:Zt,drawImageW:Yt,drawImageH:le,originX:U,originY:N,declutterBox:{minX:rf[0],minY:rf[1],maxX:rf[2],maxY:rf[3],value:wt},canvasTransform:Pe,scale:yt}},v.prototype.replayImageOrLabel_=function(l,o,c,i,u,P,D){var F=!!(P||D),U=i.declutterBox,N=l.canvas,at=D?D[2]*i.scale[0]/2:0,yt=U.minX-at<=N.width/o&&U.maxX+at>=0&&U.minY-at<=N.height/o&&U.maxY+at>=0;return yt&&(F&&this.replayTextBackground_(l,yh,Tc,Ic,_h,P,D),Rx(l,i.canvasTransform,u,c,i.originX,i.originY,i.drawImageW,i.drawImageH,i.drawImageX,i.drawImageY,i.scale)),!0},v.prototype.fill_=function(l){if(this.alignFill_){var o=uo(this.renderedTransform_,[0,0]),c=512*this.pixelRatio;l.save(),l.translate(o[0]%c,o[1]%c),l.rotate(this.viewRotation_)}l.fill(),this.alignFill_&&l.restore()},v.prototype.setStrokeStyle_=function(l,o){l.strokeStyle=o[1],l.lineWidth=o[2],l.lineCap=o[3],l.lineJoin=o[4],l.miterLimit=o[5],l.setLineDash&&(l.lineDashOffset=o[7],l.setLineDash(o[6]))},v.prototype.drawLabelWithPointPlacement_=function(l,o,c,i){var u=this.textStates[o],P=this.createLabel(l,o,i,c),D=this.strokeStates[c],F=this.pixelRatio,U=Qx(Array.isArray(l)?l[0]:l,u.textAlign||gh),N=fd[u.textBaseline||ip],at=D&&D.lineWidth?D.lineWidth:0,yt=P.width/F-2*u.scale[0],Tt=U*yt+2*(.5-U)*at,Lt=N*P.height/F+2*(.5-N)*at;return{label:P,anchorX:Tt,anchorY:Lt}},v.prototype.execute_=function(l,o,c,i,u,P,D,F){var U;this.pixelCoordinates_&&ls(c,this.renderedTransform_)?U=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),U=il(this.coordinates,0,this.coordinates.length,2,c,this.pixelCoordinates_),Sv(this.renderedTransform_,c));for(var N=0,at=i.length,yt=0,Tt,Lt,Vt,wt,kt,Zt,Yt,le,ue,oe,ge,we,Pe=0,ir=0,Be=null,qe=null,rr=this.coordinateCache_,Ce=this.viewRotation_,Lr=Math.round(Math.atan2(-c[1],c[0])*1e12)/1e12,yr={context:l,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:Ce},_r=this.instructions!=i||this.overlaps?0:200,br,xr,pr,$r;N<at;){var Fe=i[N],ti=Fe[0];switch(ti){case Br.BEGIN_GEOMETRY:br=Fe[1],$r=Fe[3],br.getGeometry()?D!==void 0&&!Ao(D,$r.getExtent())?N=Fe[2]+1:++N:N=Fe[2];break;case Br.BEGIN_PATH:Pe>_r&&(this.fill_(l),Pe=0),ir>_r&&(l.stroke(),ir=0),!Pe&&!ir&&(l.beginPath(),wt=NaN,kt=NaN),++N;break;case Br.CIRCLE:yt=Fe[1];var oi=U[yt],ci=U[yt+1],Ri=U[yt+2],Wr=U[yt+3],Di=Ri-oi,vn=Wr-ci,sn=Math.sqrt(Di*Di+vn*vn);l.moveTo(oi+sn,ci),l.arc(oi,ci,sn,0,2*Math.PI,!0),++N;break;case Br.CLOSE_PATH:l.closePath(),++N;break;case Br.CUSTOM:yt=Fe[1],Tt=Fe[2];var dr=Fe[3],xn=Fe[4],en=Fe.length==6?Fe[5]:void 0;yr.geometry=dr,yr.feature=br,N in rr||(rr[N]=[]);var ji=rr[N];en?en(U,yt,Tt,2,ji):(ji[0]=U[yt],ji[1]=U[yt+1],ji.length=2),xn(ji,yr),++N;break;case Br.DRAW_IMAGE:yt=Fe[1],Tt=Fe[2],le=Fe[3],Lt=Fe[4],Vt=Fe[5];var qn=Fe[6],Zn=Fe[7],io=Fe[8],Wi=Fe[9],bn=Fe[10],co=Fe[11],zr=Fe[12],$i=Fe[13],dn=Fe[14];if(!le&&Fe.length>=19){ue=Fe[18],oe=Fe[19],ge=Fe[20],we=Fe[21];var ln=this.drawLabelWithPointPlacement_(ue,oe,ge,we);le=ln.label,Fe[3]=le;var na=Fe[22];Lt=(ln.anchorX-na)*this.pixelRatio,Fe[4]=Lt;var fe=Fe[23];Vt=(ln.anchorY-fe)*this.pixelRatio,Fe[5]=Vt,qn=le.height,Fe[6]=qn,$i=le.width,Fe[13]=$i}var Ze=void 0;Fe.length>24&&(Ze=Fe[24]);var no=void 0,wn=void 0,ii=void 0;Fe.length>16?(no=Fe[15],wn=Fe[16],ii=Fe[17]):(no=wc,wn=!1,ii=!1),bn&&Lr?co+=Ce:!bn&&!Lr&&(co-=Ce);for(var En=0;yt<Tt;yt+=2)if(!(Ze&&Ze[En++]<$i/this.pixelRatio)){var Ei=this.calculateImageOrLabelDimensions_(le.width,le.height,U[yt],U[yt+1],$i,qn,Lt,Vt,io,Wi,co,zr,u,no,wn||ii,br),Xn=[l,o,le,Ei,Zn,wn?Be:null,ii?qe:null],ai=void 0,Ge=void 0;if(F&&dn){var Rr=Tt-yt;if(!dn[Rr]){dn[Rr]=Xn;continue}if(ai=dn[Rr],delete dn[Rr],Ge=Jx(ai),F.collides(Ge))continue}F&&F.collides(Ei.declutterBox)||(ai&&(F&&F.insert(Ge),this.replayImageOrLabel_.apply(this,ai)),F&&F.insert(Ei.declutterBox),this.replayImageOrLabel_.apply(this,Xn))}++N;break;case Br.DRAW_CHARS:var kr=Fe[1],qi=Fe[2],Ki=Fe[3],Tr=Fe[4];we=Fe[5];var ho=Fe[6],Rn=Fe[7],hi=Fe[8];ge=Fe[9];var Q=Fe[10];ue=Fe[11],oe=Fe[12];var it=[Fe[13],Fe[13]],st=this.textStates[oe],_t=st.font,It=[st.scale[0]*Rn,st.scale[1]*Rn],Bt=void 0;_t in this.widths_?Bt=this.widths_[_t]:(Bt={},this.widths_[_t]=Bt);var Gt=Om(U,kr,qi,2),dt=Math.abs(It[0])*$y(_t,ue,Bt);if(Tr||dt<=Gt){var zt=this.textStates[oe].textAlign,Qt=(Gt-dt)*fd[zt],nt=Hx(U,kr,qi,2,ue,Qt,ho,Math.abs(It[0]),$y,_t,Bt,Lr?0:this.viewRotation_);t:if(nt){var X=[],Z=void 0,rt=void 0,lt=void 0,gt=void 0,pt=void 0;if(ge)for(Z=0,rt=nt.length;Z<rt;++Z){pt=nt[Z],lt=pt[4],gt=this.createLabel(lt,oe,"",ge),Lt=pt[2]+(It[0]<0?-Q:Q),Vt=Ki*gt.height+(.5-Ki)*2*Q*It[1]/It[0]-hi;var Ei=this.calculateImageOrLabelDimensions_(gt.width,gt.height,pt[0],pt[1],gt.width,gt.height,Lt,Vt,0,0,pt[3],it,!1,wc,!1,br);if(F&&F.collides(Ei.declutterBox))break t;X.push([l,o,gt,Ei,1,null,null])}if(we)for(Z=0,rt=nt.length;Z<rt;++Z){pt=nt[Z],lt=pt[4],gt=this.createLabel(lt,oe,we,""),Lt=pt[2],Vt=Ki*gt.height-hi;var Ei=this.calculateImageOrLabelDimensions_(gt.width,gt.height,pt[0],pt[1],gt.width,gt.height,Lt,Vt,0,0,pt[3],it,!1,wc,!1,br);if(F&&F.collides(Ei.declutterBox))break t;X.push([l,o,gt,Ei,1,null,null])}F&&F.load(X.map(Jx));for(var St=0,Et=X.length;St<Et;++St)this.replayImageOrLabel_.apply(this,X[St])}}++N;break;case Br.END_GEOMETRY:if(P!==void 0){br=Fe[1];var Ct=P(br,$r);if(Ct)return Ct}++N;break;case Br.FILL:_r?Pe++:this.fill_(l),++N;break;case Br.MOVE_TO_LINE_TO:for(yt=Fe[1],Tt=Fe[2],xr=U[yt],pr=U[yt+1],Zt=xr+.5|0,Yt=pr+.5|0,(Zt!==wt||Yt!==kt)&&(l.moveTo(xr,pr),wt=Zt,kt=Yt),yt+=2;yt<Tt;yt+=2)xr=U[yt],pr=U[yt+1],Zt=xr+.5|0,Yt=pr+.5|0,(yt==Tt-2||Zt!==wt||Yt!==kt)&&(l.lineTo(xr,pr),wt=Zt,kt=Yt);++N;break;case Br.SET_FILL_STYLE:Be=Fe,this.alignFill_=Fe[2],Pe&&(this.fill_(l),Pe=0,ir&&(l.stroke(),ir=0)),l.fillStyle=Fe[1],++N;break;case Br.SET_STROKE_STYLE:qe=Fe,ir&&(l.stroke(),ir=0),this.setStrokeStyle_(l,Fe),++N;break;case Br.STROKE:_r?ir++:l.stroke(),++N;break;default:++N;break}}Pe&&this.fill_(l),ir&&l.stroke()},v.prototype.execute=function(l,o,c,i,u,P){this.viewRotation_=i,this.execute_(l,o,c,this.instructions,u,void 0,void 0,P)},v.prototype.executeHitDetection=function(l,o,c,i,u){return this.viewRotation_=c,this.execute_(l,1,o,this.hitDetectionInstructions,!0,i,u)},v}(),t0=Kw;var r_=[zn.POLYGON,zn.CIRCLE,zn.LINE_STRING,zn.IMAGE,zn.TEXT,zn.DEFAULT],Yw=function(){function v(l,o,c,i,u,P){this.maxExtent_=l,this.overlaps_=i,this.pixelRatio_=c,this.resolution_=o,this.renderBuffer_=P,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=va(),this.createExecutors_(u)}return v.prototype.clip=function(l,o){var c=this.getClipCoords(o);l.beginPath(),l.moveTo(c[0],c[1]),l.lineTo(c[2],c[3]),l.lineTo(c[4],c[5]),l.lineTo(c[6],c[7]),l.clip()},v.prototype.createExecutors_=function(l){for(var o in l){var c=this.executorsByZIndex_[o];c===void 0&&(c={},this.executorsByZIndex_[o]=c);var i=l[o];for(var u in i){var P=i[u];c[u]=new t0(this.resolution_,this.pixelRatio_,this.overlaps_,P)}}},v.prototype.hasExecutors=function(l){for(var o in this.executorsByZIndex_)for(var c=this.executorsByZIndex_[o],i=0,u=l.length;i<u;++i)if(l[i]in c)return!0;return!1},v.prototype.forEachFeatureAtCoordinate=function(l,o,c,i,u,P){i=Math.round(i);var D=i*2+1,F=us(this.hitDetectionTransform_,i+.5,i+.5,1/o,-1/o,-c,-l[0],-l[1]),U=!this.hitDetectionContext_;U&&(this.hitDetectionContext_=Ga(D,D));var N=this.hitDetectionContext_;N.canvas.width!==D||N.canvas.height!==D?(N.canvas.width=D,N.canvas.height=D):U||N.clearRect(0,0,D,D);var at;this.renderBuffer_!==void 0&&(at=Va(),hy(at,l),rl(at,o*(this.renderBuffer_+i),at));var yt=Hw(i),Tt;function Lt(oe,ge){for(var we=N.getImageData(0,0,D,D).data,Pe=0,ir=yt.length;Pe<ir;Pe++)if(we[yt[Pe]]>0){if(!P||Tt!==zn.IMAGE&&Tt!==zn.TEXT||P.indexOf(oe)!==-1){var Be=(yt[Pe]-3)/4,qe=i-Be%D,rr=i-(Be/D|0),Ce=u(oe,ge,qe*qe+rr*rr);if(Ce)return Ce}N.clearRect(0,0,D,D);break}}var Vt=Object.keys(this.executorsByZIndex_).map(Number);Vt.sort(rh);var wt,kt,Zt,Yt,le;for(wt=Vt.length-1;wt>=0;--wt){var ue=Vt[wt].toString();for(Zt=this.executorsByZIndex_[ue],kt=r_.length-1;kt>=0;--kt)if(Tt=r_[kt],Yt=Zt[Tt],Yt!==void 0&&(le=Yt.executeHitDetection(N,F,c,Lt,at),le))return le}},v.prototype.getClipCoords=function(l){var o=this.maxExtent_;if(!o)return null;var c=o[0],i=o[1],u=o[2],P=o[3],D=[c,i,c,P,u,P,u,i];return il(D,0,8,2,l,D),D},v.prototype.isEmpty=function(){return Vl(this.executorsByZIndex_)},v.prototype.execute=function(l,o,c,i,u,P,D){var F=Object.keys(this.executorsByZIndex_).map(Number);F.sort(rh),this.maxExtent_&&(l.save(),this.clip(l,c));var U=P||r_,N,at,yt,Tt,Lt,Vt;for(D&&F.reverse(),N=0,at=F.length;N<at;++N){var wt=F[N].toString();for(Lt=this.executorsByZIndex_[wt],yt=0,Tt=U.length;yt<Tt;++yt){var kt=U[yt];Vt=Lt[kt],Vt!==void 0&&Vt.execute(l,o,c,i,u,D)}}this.maxExtent_&&l.restore()},v}(),i_={};function Hw(v){if(i_[v]!==void 0)return i_[v];for(var l=v*2+1,o=v*v,c=new Array(o+1),i=0;i<=v;++i)for(var u=0;u<=v;++u){var P=i*i+u*u;if(P>o)break;var D=c[P];D||(D=[],c[P]=D),D.push(((v+i)*l+(v+u))*4+3),i>0&&D.push(((v-i)*l+(v+u))*4+3),u>0&&(D.push(((v+i)*l+(v-u))*4+3),i>0&&D.push(((v-i)*l+(v-u))*4+3))}for(var F=[],i=0,U=c.length;i<U;++i)c[i]&&F.push.apply(F,c[i]);return i_[v]=F,F}var n_=Yw;var md={ANIMATING:0,INTERACTING:1};var Jw=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),Qw=function(v){Jw(l,v);function l(o,c,i,u,P,D,F){var U=v.call(this)||this;return U.context_=o,U.pixelRatio_=c,U.extent_=i,U.transform_=u,U.viewRotation_=P,U.squaredTolerance_=D,U.userTransform_=F,U.contextFillState_=null,U.contextStrokeState_=null,U.contextTextState_=null,U.fillState_=null,U.strokeState_=null,U.image_=null,U.imageAnchorX_=0,U.imageAnchorY_=0,U.imageHeight_=0,U.imageOpacity_=0,U.imageOriginX_=0,U.imageOriginY_=0,U.imageRotateWithView_=!1,U.imageRotation_=0,U.imageScale_=[0,0],U.imageWidth_=0,U.text_="",U.textOffsetX_=0,U.textOffsetY_=0,U.textRotateWithView_=!1,U.textRotation_=0,U.textScale_=[0,0],U.textFillState_=null,U.textStrokeState_=null,U.textState_=null,U.pixelCoordinates_=[],U.tmpLocalTransform_=va(),U}return l.prototype.drawImages_=function(o,c,i,u){if(!!this.image_){var P=il(o,c,i,u,this.transform_,this.pixelCoordinates_),D=this.context_,F=this.tmpLocalTransform_,U=D.globalAlpha;this.imageOpacity_!=1&&(D.globalAlpha=U*this.imageOpacity_);var N=this.imageRotation_;this.imageRotateWithView_&&(N+=this.viewRotation_);for(var at=0,yt=P.length;at<yt;at+=2){var Tt=P[at]-this.imageAnchorX_,Lt=P[at+1]-this.imageAnchorY_;if(N!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){var Vt=Tt+this.imageAnchorX_,wt=Lt+this.imageAnchorY_;us(F,Vt,wt,1,1,N,-Vt,-wt),D.setTransform.apply(D,F),D.translate(Vt,wt),D.scale(this.imageScale_[0],this.imageScale_[1]),D.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),D.setTransform(1,0,0,1,0,0)}else D.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,Tt,Lt,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(D.globalAlpha=U)}},l.prototype.drawText_=function(o,c,i,u){if(!(!this.textState_||this.text_==="")){this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);var P=il(o,c,i,u,this.transform_,this.pixelCoordinates_),D=this.context_,F=this.textRotation_;for(this.textRotateWithView_&&(F+=this.viewRotation_);c<i;c+=u){var U=P[c]+this.textOffsetX_,N=P[c+1]+this.textOffsetY_;if(F!==0||this.textScale_[0]!=1||this.textScale_[1]!=1){var at=us(this.tmpLocalTransform_,U,N,1,1,F,-U,-N);D.setTransform.apply(D,at),D.translate(U,N),D.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&D.strokeText(this.text_,0,0),this.textFillState_&&D.fillText(this.text_,0,0),D.setTransform(1,0,0,1,0,0)}else this.textStrokeState_&&D.strokeText(this.text_,U,N),this.textFillState_&&D.fillText(this.text_,U,N)}}},l.prototype.moveToLineTo_=function(o,c,i,u,P){var D=this.context_,F=il(o,c,i,u,this.transform_,this.pixelCoordinates_);D.moveTo(F[0],F[1]);var U=F.length;P&&(U-=2);for(var N=2;N<U;N+=2)D.lineTo(F[N],F[N+1]);return P&&D.closePath(),i},l.prototype.drawRings_=function(o,c,i,u){for(var P=0,D=i.length;P<D;++P)c=this.moveToLineTo_(o,c,i[P],u,!0);return c},l.prototype.drawCircle=function(o){if(!!Ao(this.extent_,o.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var c=ux(o,this.transform_,this.pixelCoordinates_),i=c[2]-c[0],u=c[3]-c[1],P=Math.sqrt(i*i+u*u),D=this.context_;D.beginPath(),D.arc(c[0],c[1],P,0,2*Math.PI),this.fillState_&&D.fill(),this.strokeState_&&D.stroke()}this.text_!==""&&this.drawText_(o.getCenter(),0,2,2)}},l.prototype.setStyle=function(o){this.setFillStrokeStyle(o.getFill(),o.getStroke()),this.setImageStyle(o.getImage()),this.setTextStyle(o.getText())},l.prototype.setTransform=function(o){this.transform_=o},l.prototype.drawGeometry=function(o){var c=o.getType();switch(c){case Ie.POINT:this.drawPoint(o);break;case Ie.LINE_STRING:this.drawLineString(o);break;case Ie.POLYGON:this.drawPolygon(o);break;case Ie.MULTI_POINT:this.drawMultiPoint(o);break;case Ie.MULTI_LINE_STRING:this.drawMultiLineString(o);break;case Ie.MULTI_POLYGON:this.drawMultiPolygon(o);break;case Ie.GEOMETRY_COLLECTION:this.drawGeometryCollection(o);break;case Ie.CIRCLE:this.drawCircle(o);break;default:}},l.prototype.drawFeature=function(o,c){var i=c.getGeometryFunction()(o);!i||!Ao(this.extent_,i.getExtent())||(this.setStyle(c),this.drawGeometry(i))},l.prototype.drawGeometryCollection=function(o){for(var c=o.getGeometriesArray(),i=0,u=c.length;i<u;++i)this.drawGeometry(c[i])},l.prototype.drawPoint=function(o){this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var c=o.getFlatCoordinates(),i=o.getStride();this.image_&&this.drawImages_(c,0,c.length,i),this.text_!==""&&this.drawText_(c,0,c.length,i)},l.prototype.drawMultiPoint=function(o){this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var c=o.getFlatCoordinates(),i=o.getStride();this.image_&&this.drawImages_(c,0,c.length,i),this.text_!==""&&this.drawText_(c,0,c.length,i)},l.prototype.drawLineString=function(o){if(this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ao(this.extent_,o.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var c=this.context_,i=o.getFlatCoordinates();c.beginPath(),this.moveToLineTo_(i,0,i.length,o.getStride(),!1),c.stroke()}if(this.text_!==""){var u=o.getFlatMidpoint();this.drawText_(u,0,2,2)}}},l.prototype.drawMultiLineString=function(o){this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var c=o.getExtent();if(!!Ao(this.extent_,c)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var i=this.context_,u=o.getFlatCoordinates(),P=0,D=o.getEnds(),F=o.getStride();i.beginPath();for(var U=0,N=D.length;U<N;++U)P=this.moveToLineTo_(u,P,D[U],F,!1);i.stroke()}if(this.text_!==""){var at=o.getFlatMidpoints();this.drawText_(at,0,at.length,2)}}},l.prototype.drawPolygon=function(o){if(this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ao(this.extent_,o.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var c=this.context_;c.beginPath(),this.drawRings_(o.getOrientedFlatCoordinates(),0,o.getEnds(),o.getStride()),this.fillState_&&c.fill(),this.strokeState_&&c.stroke()}if(this.text_!==""){var i=o.getFlatInteriorPoint();this.drawText_(i,0,2,2)}}},l.prototype.drawMultiPolygon=function(o){if(this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ao(this.extent_,o.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var c=this.context_,i=o.getOrientedFlatCoordinates(),u=0,P=o.getEndss(),D=o.getStride();c.beginPath();for(var F=0,U=P.length;F<U;++F){var N=P[F];u=this.drawRings_(i,u,N,D)}this.fillState_&&c.fill(),this.strokeState_&&c.stroke()}if(this.text_!==""){var at=o.getFlatInteriorPoints();this.drawText_(at,0,at.length,2)}}},l.prototype.setContextFillState_=function(o){var c=this.context_,i=this.contextFillState_;i?i.fillStyle!=o.fillStyle&&(i.fillStyle=o.fillStyle,c.fillStyle=o.fillStyle):(c.fillStyle=o.fillStyle,this.contextFillState_={fillStyle:o.fillStyle})},l.prototype.setContextStrokeState_=function(o){var c=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=o.lineCap&&(i.lineCap=o.lineCap,c.lineCap=o.lineCap),c.setLineDash&&(ls(i.lineDash,o.lineDash)||c.setLineDash(i.lineDash=o.lineDash),i.lineDashOffset!=o.lineDashOffset&&(i.lineDashOffset=o.lineDashOffset,c.lineDashOffset=o.lineDashOffset)),i.lineJoin!=o.lineJoin&&(i.lineJoin=o.lineJoin,c.lineJoin=o.lineJoin),i.lineWidth!=o.lineWidth&&(i.lineWidth=o.lineWidth,c.lineWidth=o.lineWidth),i.miterLimit!=o.miterLimit&&(i.miterLimit=o.miterLimit,c.miterLimit=o.miterLimit),i.strokeStyle!=o.strokeStyle&&(i.strokeStyle=o.strokeStyle,c.strokeStyle=o.strokeStyle)):(c.lineCap=o.lineCap,c.setLineDash&&(c.setLineDash(o.lineDash),c.lineDashOffset=o.lineDashOffset),c.lineJoin=o.lineJoin,c.lineWidth=o.lineWidth,c.miterLimit=o.miterLimit,c.strokeStyle=o.strokeStyle,this.contextStrokeState_={lineCap:o.lineCap,lineDash:o.lineDash,lineDashOffset:o.lineDashOffset,lineJoin:o.lineJoin,lineWidth:o.lineWidth,miterLimit:o.miterLimit,strokeStyle:o.strokeStyle})},l.prototype.setContextTextState_=function(o){var c=this.context_,i=this.contextTextState_,u=o.textAlign?o.textAlign:gh;i?(i.font!=o.font&&(i.font=o.font,c.font=o.font),i.textAlign!=u&&(i.textAlign=u,c.textAlign=u),i.textBaseline!=o.textBaseline&&(i.textBaseline=o.textBaseline,c.textBaseline=o.textBaseline)):(c.font=o.font,c.textAlign=u,c.textBaseline=o.textBaseline,this.contextTextState_={font:o.font,textAlign:u,textBaseline:o.textBaseline})},l.prototype.setFillStrokeStyle=function(o,c){var i=this;if(!o)this.fillState_=null;else{var u=o.getColor();this.fillState_={fillStyle:ds(u||ms)}}if(!c)this.strokeState_=null;else{var P=c.getColor(),D=c.getLineCap(),F=c.getLineDash(),U=c.getLineDashOffset(),N=c.getLineJoin(),at=c.getWidth(),yt=c.getMiterLimit(),Tt=F||_c;this.strokeState_={lineCap:D!==void 0?D:rp,lineDash:this.pixelRatio_===1?Tt:Tt.map(function(Lt){return Lt*i.pixelRatio_}),lineDashOffset:(U||vc)*this.pixelRatio_,lineJoin:N!==void 0?N:Lu,lineWidth:(at!==void 0?at:Ec)*this.pixelRatio_,miterLimit:yt!==void 0?yt:xc,strokeStyle:ds(P||bc)}}},l.prototype.setImageStyle=function(o){var c;if(!o||!(c=o.getSize())){this.image_=null;return}var i=o.getAnchor(),u=o.getOrigin();this.image_=o.getImage(this.pixelRatio_),this.imageAnchorX_=i[0]*this.pixelRatio_,this.imageAnchorY_=i[1]*this.pixelRatio_,this.imageHeight_=c[1]*this.pixelRatio_,this.imageOpacity_=o.getOpacity(),this.imageOriginX_=u[0],this.imageOriginY_=u[1],this.imageRotateWithView_=o.getRotateWithView(),this.imageRotation_=o.getRotation(),this.imageScale_=o.getScaleArray(),this.imageWidth_=c[0]*this.pixelRatio_},l.prototype.setTextStyle=function(o){if(!o)this.text_="";else{var c=o.getFill();if(!c)this.textFillState_=null;else{var i=c.getColor();this.textFillState_={fillStyle:ds(i||ms)}}var u=o.getStroke();if(!u)this.textStrokeState_=null;else{var P=u.getColor(),D=u.getLineCap(),F=u.getLineDash(),U=u.getLineDashOffset(),N=u.getLineJoin(),at=u.getWidth(),yt=u.getMiterLimit();this.textStrokeState_={lineCap:D!==void 0?D:rp,lineDash:F||_c,lineDashOffset:U||vc,lineJoin:N!==void 0?N:Lu,lineWidth:at!==void 0?at:Ec,miterLimit:yt!==void 0?yt:xc,strokeStyle:ds(P||bc)}}var Tt=o.getFont(),Lt=o.getOffsetX(),Vt=o.getOffsetY(),wt=o.getRotateWithView(),kt=o.getRotation(),Zt=o.getScaleArray(),Yt=o.getText(),le=o.getTextAlign(),ue=o.getTextBaseline();this.textState_={font:Tt!==void 0?Tt:Nm,textAlign:le!==void 0?le:gh,textBaseline:ue!==void 0?ue:ip},this.text_=Yt!==void 0?Array.isArray(Yt)?Yt.reduce(function(oe,ge,we){return oe+=we%2?" ":ge},""):Yt:"",this.textOffsetX_=Lt!==void 0?this.pixelRatio_*Lt:0,this.textOffsetY_=Vt!==void 0?this.pixelRatio_*Vt:0,this.textRotateWithView_=wt!==void 0?wt:!1,this.textRotation_=kt!==void 0?kt:0,this.textScale_=[this.pixelRatio_*Zt[0],this.pixelRatio_*Zt[1]]}},l}(Vm),e0=Qw;var Ru={FRACTION:"fraction",PIXELS:"pixels"};var Os={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var t2=function(){function v(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return v.prototype.clear=function(){this.cache_={},this.cacheSize_=0},v.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},v.prototype.expire=function(){if(this.canExpireCache()){var l=0;for(var o in this.cache_){var c=this.cache_[o];(l++&3)===0&&!c.hasListener()&&(delete this.cache_[o],--this.cacheSize_)}}},v.prototype.get=function(l,o,c){var i=r0(l,o,c);return i in this.cache_?this.cache_[i]:null},v.prototype.set=function(l,o,c,i){var u=r0(l,o,c);this.cache_[u]=i,++this.cacheSize_},v.prototype.setSize=function(l){this.maxCacheSize_=l,this.expire()},v}();function r0(v,l,o){var c=o?Bm(o):"null";return l+":"+v+":"+c}var o_=new t2;var e2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),r2=function(v){e2(l,v);function l(o,c,i,u){var P=v.call(this)||this;return P.extent=o,P.pixelRatio_=i,P.resolution=c,P.state=u,P}return l.prototype.changed=function(){this.dispatchEvent(Vi.CHANGE)},l.prototype.getExtent=function(){return this.extent},l.prototype.getImage=function(){return Fr()},l.prototype.getPixelRatio=function(){return this.pixelRatio_},l.prototype.getResolution=function(){return this.resolution},l.prototype.getState=function(){return this.state},l.prototype.load=function(){Fr()},l}(nh),i0=r2;var i2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),ek=function(v){i2(l,v);function l(o,c,i,u,P,D){var F=v.call(this,o,c,i,zi.IDLE)||this;return F.src_=u,F.image_=new Image,P!==null&&(F.image_.crossOrigin=P),F.unlisten_=null,F.state=zi.IDLE,F.imageLoadFunction_=D,F}return l.prototype.getImage=function(){return this.image_},l.prototype.handleImageError_=function(){this.state=zi.ERROR,this.unlistenImage_(),this.changed()},l.prototype.handleImageLoad_=function(){this.resolution===void 0&&(this.resolution=Au(this.extent)/this.image_.height),this.state=zi.LOADED,this.unlistenImage_(),this.changed()},l.prototype.load=function(){(this.state==zi.IDLE||this.state==zi.ERROR)&&(this.state=zi.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=a_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},l.prototype.setImage=function(o){this.image_=o,this.resolution=Au(this.extent)/this.image_.height},l.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},l}(i0);function a_(v,l,o){var c=v,i=!0,u=!1,P=!1,D=[Up(c,Vi.LOAD,function(){P=!0,u||l()})];return c.src&&wv?(u=!0,c.decode().then(function(){i&&l()}).catch(function(F){i&&(P?l():o())})):D.push(Up(c,Vi.ERROR,o)),function(){i=!1,D.forEach(To)}}var n2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),gd=null,o2=function(v){n2(l,v);function l(o,c,i,u,P,D){var F=v.call(this)||this;return F.hitDetectionImage_=null,F.image_=o||new Image,u!==null&&(F.image_.crossOrigin=u),F.canvas_={},F.color_=D,F.unlisten_=null,F.imageState_=P,F.size_=i,F.src_=c,F.tainted_,F}return l.prototype.isTainted_=function(){if(this.tainted_===void 0&&this.imageState_===zi.LOADED){gd||(gd=Ga(1,1)),gd.drawImage(this.image_,0,0);try{gd.getImageData(0,0,1,1),this.tainted_=!1}catch{gd=null,this.tainted_=!0}}return this.tainted_===!0},l.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(Vi.CHANGE)},l.prototype.handleImageError_=function(){this.imageState_=zi.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},l.prototype.handleImageLoad_=function(){this.imageState_=zi.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_()},l.prototype.getImage=function(o){return this.replaceColor_(o),this.canvas_[o]?this.canvas_[o]:this.image_},l.prototype.getPixelRatio=function(o){return this.replaceColor_(o),this.canvas_[o]?o:1},l.prototype.getImageState=function(){return this.imageState_},l.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var o=this.size_[0],c=this.size_[1],i=Ga(o,c);i.fillRect(0,0,o,c),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},l.prototype.getSize=function(){return this.size_},l.prototype.getSrc=function(){return this.src_},l.prototype.load=function(){if(this.imageState_==zi.IDLE){this.imageState_=zi.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=a_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},l.prototype.replaceColor_=function(o){if(!(!this.color_||this.canvas_[o]||this.imageState_!==zi.LOADED)){var c=document.createElement("canvas");this.canvas_[o]=c,c.width=Math.ceil(this.image_.width*o),c.height=Math.ceil(this.image_.height*o);var i=c.getContext("2d");if(i.scale(o,o),i.drawImage(this.image_,0,0),i.globalCompositeOperation="multiply",i.globalCompositeOperation==="multiply"||this.isTainted_())i.fillStyle=Bm(this.color_),i.fillRect(0,0,c.width/o,c.height/o),i.globalCompositeOperation="destination-in",i.drawImage(this.image_,0,0);else{for(var u=i.getImageData(0,0,c.width,c.height),P=u.data,D=this.color_[0]/255,F=this.color_[1]/255,U=this.color_[2]/255,N=this.color_[3],at=0,yt=P.length;at<yt;at+=4)P[at]*=D,P[at+1]*=F,P[at+2]*=U,P[at+3]*=N;i.putImageData(u,0,0)}}},l.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},l}(nh);function n0(v,l,o,c,i,u){var P=o_.get(l,c,u);return P||(P=new o2(v,l,o,c,i,u),o_.set(l,c,u,P)),P}var a2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),s2=function(v){a2(l,v);function l(o){var c=this,i=o||{},u=i.opacity!==void 0?i.opacity:1,P=i.rotation!==void 0?i.rotation:0,D=i.scale!==void 0?i.scale:1,F=i.rotateWithView!==void 0?i.rotateWithView:!1;c=v.call(this,{opacity:u,rotation:P,scale:D,displacement:i.displacement!==void 0?i.displacement:[0,0],rotateWithView:F})||this,c.anchor_=i.anchor!==void 0?i.anchor:[.5,.5],c.normalizedAnchor_=null,c.anchorOrigin_=i.anchorOrigin!==void 0?i.anchorOrigin:Os.TOP_LEFT,c.anchorXUnits_=i.anchorXUnits!==void 0?i.anchorXUnits:Ru.FRACTION,c.anchorYUnits_=i.anchorYUnits!==void 0?i.anchorYUnits:Ru.FRACTION,c.crossOrigin_=i.crossOrigin!==void 0?i.crossOrigin:null;var U=i.img!==void 0?i.img:null;c.imgSize_=i.imgSize;var N=i.src;fn(!(N!==void 0&&U),4),fn(!U||U&&c.imgSize_,5),(N===void 0||N.length===0)&&U&&(N=U.src||wi(U)),fn(N!==void 0&&N.length>0,6);var at=i.src!==void 0?zi.IDLE:zi.LOADED;return c.color_=i.color!==void 0?ep(i.color):null,c.iconImage_=n0(U,N,c.imgSize_!==void 0?c.imgSize_:null,c.crossOrigin_,at,c.color_),c.offset_=i.offset!==void 0?i.offset:[0,0],c.offsetOrigin_=i.offsetOrigin!==void 0?i.offsetOrigin:Os.TOP_LEFT,c.origin_=null,c.size_=i.size!==void 0?i.size:null,c}return l.prototype.clone=function(){var o=this.getScale();return new l({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(o)?o.slice():o,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc()})},l.prototype.getAnchor=function(){var o=this.normalizedAnchor_;if(!o){o=this.anchor_;var c=this.getSize();if(this.anchorXUnits_==Ru.FRACTION||this.anchorYUnits_==Ru.FRACTION){if(!c)return null;o=this.anchor_.slice(),this.anchorXUnits_==Ru.FRACTION&&(o[0]*=c[0]),this.anchorYUnits_==Ru.FRACTION&&(o[1]*=c[1])}if(this.anchorOrigin_!=Os.TOP_LEFT){if(!c)return null;o===this.anchor_&&(o=this.anchor_.slice()),(this.anchorOrigin_==Os.TOP_RIGHT||this.anchorOrigin_==Os.BOTTOM_RIGHT)&&(o[0]=-o[0]+c[0]),(this.anchorOrigin_==Os.BOTTOM_LEFT||this.anchorOrigin_==Os.BOTTOM_RIGHT)&&(o[1]=-o[1]+c[1])}this.normalizedAnchor_=o}var i=this.getDisplacement();return[o[0]-i[0],o[1]+i[1]]},l.prototype.setAnchor=function(o){this.anchor_=o,this.normalizedAnchor_=null},l.prototype.getColor=function(){return this.color_},l.prototype.getImage=function(o){return this.iconImage_.getImage(o)},l.prototype.getPixelRatio=function(o){return this.iconImage_.getPixelRatio(o)},l.prototype.getImageSize=function(){return this.iconImage_.getSize()},l.prototype.getImageState=function(){return this.iconImage_.getImageState()},l.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},l.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var o=this.offset_;if(this.offsetOrigin_!=Os.TOP_LEFT){var c=this.getSize(),i=this.iconImage_.getSize();if(!c||!i)return null;o=o.slice(),(this.offsetOrigin_==Os.TOP_RIGHT||this.offsetOrigin_==Os.BOTTOM_RIGHT)&&(o[0]=i[0]-c[0]-o[0]),(this.offsetOrigin_==Os.BOTTOM_LEFT||this.offsetOrigin_==Os.BOTTOM_RIGHT)&&(o[1]=i[1]-c[1]-o[1])}return this.origin_=o,this.origin_},l.prototype.getSrc=function(){return this.iconImage_.getSrc()},l.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},l.prototype.listenImageChange=function(o){this.iconImage_.addEventListener(Vi.CHANGE,o)},l.prototype.load=function(){this.iconImage_.load()},l.prototype.unlistenImageChange=function(o){this.iconImage_.removeEventListener(Vi.CHANGE,o)},l}(Fm),s_=s2;var $l=.5;function o0(v,l,o,c,i,u,P){var D=v[0]*$l,F=v[1]*$l,U=Ga(D,F);U.imageSmoothingEnabled=!1;for(var N=U.canvas,at=new e0(U,$l,i,null,P),yt=o.length,Tt=Math.floor((256*256*256-1)/yt),Lt={},Vt=1;Vt<=yt;++Vt){var wt=o[Vt-1],kt=wt.getStyleFunction()||c;if(!!c){var Zt=kt(wt,u);if(!!Zt){Array.isArray(Zt)||(Zt=[Zt]);for(var Yt=Vt*Tt,le="#"+("000000"+Yt.toString(16)).slice(-6),ue=0,oe=Zt.length;ue<oe;++ue){var ge=Zt[ue],we=ge.getGeometryFunction()(wt);if(!(!we||!Ao(i,we.getExtent()))){var Pe=ge.clone(),ir=Pe.getFill();ir&&ir.setColor(le);var Be=Pe.getStroke();Be&&(Be.setColor(le),Be.setLineDash(null)),Pe.setText(void 0);var qe=ge.getImage();if(qe&&qe.getOpacity()!==0){var rr=qe.getImageSize();if(!rr)continue;var Ce=Ga(rr[0],rr[1],void 0,{alpha:!1}),Lr=Ce.canvas;Ce.fillStyle=le,Ce.fillRect(0,0,Lr.width,Lr.height),Pe.setImage(new s_({img:Lr,imgSize:rr,anchor:qe.getAnchor(),anchorXUnits:Ru.PIXELS,anchorYUnits:Ru.PIXELS,offset:qe.getOrigin(),opacity:1,size:qe.getSize(),scale:qe.getScale(),rotation:qe.getRotation(),rotateWithView:qe.getRotateWithView()}))}var yr=Pe.getZIndex()||0,_r=Lt[yr];_r||(_r={},Lt[yr]=_r,_r[Ie.POLYGON]=[],_r[Ie.CIRCLE]=[],_r[Ie.LINE_STRING]=[],_r[Ie.POINT]=[]),_r[we.getType().replace("Multi","")].push(we,Pe)}}}}}for(var br=Object.keys(Lt).map(Number).sort(rh),Vt=0,xr=br.length;Vt<xr;++Vt){var _r=Lt[br[Vt]];for(var pr in _r)for(var $r=_r[pr],ue=0,oe=$r.length;ue<oe;ue+=2){at.setStyle($r[ue+1]);for(var Fe=0,ti=l.length;Fe<ti;++Fe)at.setTransform(l[Fe]),at.drawGeometry($r[ue])}}return U.getImageData(0,0,N.width,N.height)}function a0(v,l,o){var c=[];if(o){var i=Math.floor(Math.round(v[0])*$l),u=Math.floor(Math.round(v[1])*$l),P=(jl(i,0,o.width-1)+jl(u,0,o.height-1)*o.width)*4,D=o.data[P],F=o.data[P+1],U=o.data[P+2],N=U+256*(F+256*D),at=Math.floor((256*256*256-1)/l.length);N&&N%at===0&&c.push(l[N/at-1])}return c}var l2=.5,s0={Point:m2,LineString:p2,Polygon:y2,MultiPoint:g2,MultiLineString:f2,MultiPolygon:d2,GeometryCollection:h2,Circle:u2};function l0(v,l){return parseInt(wi(v),10)-parseInt(wi(l),10)}function u0(v,l){var o=Gm(v,l);return o*o}function Gm(v,l){return l2*v/l}function u2(v,l,o,c,i){var u=o.getFill(),P=o.getStroke();if(u||P){var D=v.getBuilder(o.getZIndex(),zn.CIRCLE);D.setFillStrokeStyle(u,P),D.drawCircle(l,c)}var F=o.getText();if(F&&F.getText()){var U=(i||v).getBuilder(o.getZIndex(),zn.TEXT);U.setTextStyle(F),U.drawText(l,c)}}function l_(v,l,o,c,i,u,P){var D=!1,F=o.getImage();if(F){var U=F.getImageState();U==zi.LOADED||U==zi.ERROR?F.unlistenImageChange(i):(U==zi.IDLE&&F.load(),U=F.getImageState(),F.listenImageChange(i),D=!0)}return c2(v,l,o,c,u,P),D}function c2(v,l,o,c,i,u){var P=o.getGeometryFunction()(l);if(!!P){var D=P.simplifyTransformed(c,i),F=o.getRenderer();if(F)c0(v,D,o,l);else{var U=s0[D.getType()];U(v,D,o,l,u)}}}function c0(v,l,o,c){if(l.getType()==Ie.GEOMETRY_COLLECTION){for(var i=l.getGeometries(),u=0,P=i.length;u<P;++u)c0(v,i[u],o,c);return}var D=v.getBuilder(o.getZIndex(),zn.DEFAULT);D.drawCustom(l,c,o.getRenderer(),o.getHitDetectionRenderer())}function h2(v,l,o,c,i){var u=l.getGeometriesArray(),P,D;for(P=0,D=u.length;P<D;++P){var F=s0[u[P].getType()];F(v,u[P],o,c,i)}}function p2(v,l,o,c,i){var u=o.getStroke();if(u){var P=v.getBuilder(o.getZIndex(),zn.LINE_STRING);P.setFillStrokeStyle(null,u),P.drawLineString(l,c)}var D=o.getText();if(D&&D.getText()){var F=(i||v).getBuilder(o.getZIndex(),zn.TEXT);F.setTextStyle(D),F.drawText(l,c)}}function f2(v,l,o,c,i){var u=o.getStroke();if(u){var P=v.getBuilder(o.getZIndex(),zn.LINE_STRING);P.setFillStrokeStyle(null,u),P.drawMultiLineString(l,c)}var D=o.getText();if(D&&D.getText()){var F=(i||v).getBuilder(o.getZIndex(),zn.TEXT);F.setTextStyle(D),F.drawText(l,c)}}function d2(v,l,o,c,i){var u=o.getFill(),P=o.getStroke();if(P||u){var D=v.getBuilder(o.getZIndex(),zn.POLYGON);D.setFillStrokeStyle(u,P),D.drawMultiPolygon(l,c)}var F=o.getText();if(F&&F.getText()){var U=(i||v).getBuilder(o.getZIndex(),zn.TEXT);U.setTextStyle(F),U.drawText(l,c)}}function m2(v,l,o,c,i){var u=o.getImage(),P=o.getText(),D;if(i&&(v=i,D=u&&P&&P.getText()?{}:void 0),u){if(u.getImageState()!=zi.LOADED)return;var F=v.getBuilder(o.getZIndex(),zn.IMAGE);F.setImageStyle(u,D),F.drawPoint(l,c)}if(P&&P.getText()){var U=v.getBuilder(o.getZIndex(),zn.TEXT);U.setTextStyle(P,D),U.drawText(l,c)}}function g2(v,l,o,c,i){var u=o.getImage(),P=o.getText(),D;if(i&&(v=i,D=u&&P&&P.getText()?{}:void 0),u){if(u.getImageState()!=zi.LOADED)return;var F=v.getBuilder(o.getZIndex(),zn.IMAGE);F.setImageStyle(u,D),F.drawMultiPoint(l,c)}if(P&&P.getText()){var U=(i||v).getBuilder(o.getZIndex(),zn.TEXT);U.setTextStyle(P,D),U.drawText(l,c)}}function y2(v,l,o,c,i){var u=o.getFill(),P=o.getStroke();if(u||P){var D=v.getBuilder(o.getZIndex(),zn.POLYGON);D.setFillStrokeStyle(u,P),D.drawPolygon(l,c)}var F=o.getText();if(F&&F.getText()){var U=(i||v).getBuilder(o.getZIndex(),zn.TEXT);U.setTextStyle(F),U.drawText(l,c)}}var _2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),v2=function(v){_2(l,v);function l(o){var c=v.call(this,o)||this;return c.boundHandleStyleImageChange_=c.handleStyleImageChange_.bind(c),c.animatingOrInteracting_,c.dirty_=!1,c.hitDetectionImageData_=null,c.renderedFeatures_=null,c.renderedRevision_=-1,c.renderedResolution_=NaN,c.renderedExtent_=Va(),c.wrappedRenderedExtent_=Va(),c.renderedRotation_,c.renderedCenter_=null,c.renderedProjection_=null,c.renderedRenderOrder_=null,c.replayGroup_=null,c.replayGroupChanged=!0,c.declutterExecutorGroup=null,c.clipping=!0,c}return l.prototype.renderWorlds=function(o,c,i){var u=c.extent,P=c.viewState,D=P.center,F=P.resolution,U=P.projection,N=P.rotation,at=U.getExtent(),yt=this.getLayer().getSource(),Tt=c.pixelRatio,Lt=c.viewHints,Vt=!(Lt[md.ANIMATING]||Lt[md.INTERACTING]),wt=this.context,kt=Math.round(c.size[0]*Tt),Zt=Math.round(c.size[1]*Tt),Yt=yt.getWrapX()&&U.canWrapX(),le=Yt?hs(at):null,ue=Yt?Math.ceil((u[2]-at[2])/le)+1:1,oe=Yt?Math.floor((u[0]-at[0])/le):0;do{var ge=this.getRenderTransform(D,F,N,Tt,kt,Zt,oe*le);o.execute(wt,1,ge,N,Vt,void 0,i)}while(++oe<ue)},l.prototype.renderDeclutter=function(o){this.declutterExecutorGroup&&this.renderWorlds(this.declutterExecutorGroup,o,o.declutterTree)},l.prototype.renderFrame=function(o,c){var i=o.pixelRatio,u=o.layerStatesArray[o.layerIndex];Tv(this.pixelTransform,1/i,1/i),Cv(this.inversePixelTransform,this.pixelTransform);var P=sy(this.pixelTransform);this.useContainer(c,P,u.opacity,this.getBackground(o));var D=this.context,F=D.canvas,U=this.replayGroup_,N=this.declutterExecutorGroup;if((!U||U.isEmpty())&&(!N||N.isEmpty()))return null;var at=Math.round(o.size[0]*i),yt=Math.round(o.size[1]*i);F.width!=at||F.height!=yt?(F.width=at,F.height=yt,F.style.transform!==P&&(F.style.transform=P)):this.containerReused||D.clearRect(0,0,at,yt),this.preRender(D,o);var Tt=o.viewState,Lt=Tt.projection,Vt=!1,wt=!0;if(u.extent&&this.clipping){var kt=Qf(u.extent,Lt);wt=Ao(kt,o.extent),Vt=wt&&!mc(kt,o.extent),Vt&&this.clipUnrotated(D,o,kt)}wt&&this.renderWorlds(U,o),Vt&&D.restore(),this.postRender(D,o);var Zt=Mx(u.opacity),Yt=this.container;return Zt!==Yt.style.opacity&&(Yt.style.opacity=Zt),this.renderedRotation_!==Tt.rotation&&(this.renderedRotation_=Tt.rotation,this.hitDetectionImageData_=null),this.container},l.prototype.getFeatures=function(o){return new Promise(function(c){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var i=[this.context.canvas.width,this.context.canvas.height];uo(this.pixelTransform,i);var u=this.renderedCenter_,P=this.renderedResolution_,D=this.renderedRotation_,F=this.renderedProjection_,U=this.wrappedRenderedExtent_,N=this.getLayer(),at=[],yt=i[0]*$l,Tt=i[1]*$l;at.push(this.getRenderTransform(u,P,D,$l,yt,Tt,0).slice());var Lt=N.getSource(),Vt=F.getExtent();if(Lt.getWrapX()&&F.canWrapX()&&!mc(Vt,U)){for(var wt=U[0],kt=hs(Vt),Zt=0,Yt=void 0;wt<Vt[0];)--Zt,Yt=kt*Zt,at.push(this.getRenderTransform(u,P,D,$l,yt,Tt,Yt).slice()),wt+=kt;for(Zt=0,wt=U[2];wt>Vt[2];)++Zt,Yt=kt*Zt,at.push(this.getRenderTransform(u,P,D,$l,yt,Tt,Yt).slice()),wt-=kt}this.hitDetectionImageData_=o0(i,at,this.renderedFeatures_,N.getStyleFunction(),U,P,D)}c(a0(o,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},l.prototype.forEachFeatureAtCoordinate=function(o,c,i,u,P){var D=this;if(!!this.replayGroup_){var F=c.viewState.resolution,U=c.viewState.rotation,N=this.getLayer(),at={},yt=function(Vt,wt,kt){var Zt=wi(Vt),Yt=at[Zt];if(Yt){if(Yt!==!0&&kt<Yt.distanceSq){if(kt===0)return at[Zt]=!0,P.splice(P.lastIndexOf(Yt),1),u(Vt,N,wt);Yt.geometry=wt,Yt.distanceSq=kt}}else{if(kt===0)return at[Zt]=!0,u(Vt,N,wt);P.push(at[Zt]={feature:Vt,layer:N,geometry:wt,distanceSq:kt,callback:u})}},Tt,Lt=[this.replayGroup_];return this.declutterExecutorGroup&&Lt.push(this.declutterExecutorGroup),Lt.some(function(Vt){return Tt=Vt.forEachFeatureAtCoordinate(o,F,U,i,yt,Vt===D.declutterExecutorGroup&&c.declutterTree?c.declutterTree.all().map(function(wt){return wt.value}):null)}),Tt}},l.prototype.handleFontsChanged=function(){var o=this.getLayer();o.getVisible()&&this.replayGroup_&&o.changed()},l.prototype.handleStyleImageChange_=function(o){this.renderIfReadyAndVisible()},l.prototype.prepareFrame=function(o){var c=this.getLayer(),i=c.getSource();if(!i)return!1;var u=o.viewHints[md.ANIMATING],P=o.viewHints[md.INTERACTING],D=c.getUpdateWhileAnimating(),F=c.getUpdateWhileInteracting();if(!this.dirty_&&!D&&u||!F&&P)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var U=o.extent,N=o.viewState,at=N.projection,yt=N.resolution,Tt=o.pixelRatio,Lt=c.getRevision(),Vt=c.getRenderBuffer(),wt=c.getRenderOrder();wt===void 0&&(wt=l0);var kt=N.center.slice(),Zt=rl(U,Vt*yt),Yt=Zt.slice(),le=[Zt.slice()],ue=at.getExtent();if(i.getWrapX()&&at.canWrapX()&&!mc(ue,o.extent)){var oe=hs(ue),ge=Math.max(hs(Zt)/2,oe);Zt[0]=ue[0]-ge,Zt[2]=ue[2]+ge,Wv(kt,at);var we=Zv(le[0],at);we[0]<ue[0]&&we[2]<ue[2]?le.push([we[0]+oe,we[1],we[2]+oe,we[3]]):we[0]>ue[0]&&we[2]>ue[2]&&le.push([we[0]-oe,we[1],we[2]-oe,we[3]])}if(!this.dirty_&&this.renderedResolution_==yt&&this.renderedRevision_==Lt&&this.renderedRenderOrder_==wt&&mc(this.wrappedRenderedExtent_,Zt))return ls(this.renderedExtent_,Yt)||(this.hitDetectionImageData_=null,this.renderedExtent_=Yt),this.renderedCenter_=kt,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var Pe=new e_(Gm(yt,Tt),Zt,yt,Tt),ir;this.getLayer().getDeclutter()&&(ir=new e_(Gm(yt,Tt),Zt,yt,Tt));var Be=uh(),qe;if(Be){for(var rr=0,Ce=le.length;rr<Ce;++rr){var Lr=le[rr],yr=$p(Lr,at);i.loadFeatures(yr,Hv(yt,at),Be)}qe=Em(Be,at)}else for(var rr=0,Ce=le.length;rr<Ce;++rr)i.loadFeatures(le[rr],yt,at);var _r=u0(yt,Tt),br=function(ti){var oi,ci=ti.getStyleFunction()||c.getStyleFunction();if(ci&&(oi=ci(ti,yt)),oi){var Ri=this.renderFeature(ti,_r,oi,Pe,qe,ir);this.dirty_=this.dirty_||Ri}}.bind(this),xr=$p(Zt,at),pr=i.getFeaturesInExtent(xr);wt&&pr.sort(wt);for(var rr=0,Ce=pr.length;rr<Ce;++rr)br(pr[rr]);this.renderedFeatures_=pr;var $r=Pe.finish(),Fe=new n_(Zt,yt,Tt,i.getOverlaps(),$r,c.getRenderBuffer());return ir&&(this.declutterExecutorGroup=new n_(Zt,yt,Tt,i.getOverlaps(),ir.finish(),c.getRenderBuffer())),this.renderedResolution_=yt,this.renderedRevision_=Lt,this.renderedRenderOrder_=wt,this.renderedExtent_=Yt,this.wrappedRenderedExtent_=Zt,this.renderedCenter_=kt,this.renderedProjection_=at,this.replayGroup_=Fe,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0},l.prototype.renderFeature=function(o,c,i,u,P,D){if(!i)return!1;var F=!1;if(Array.isArray(i))for(var U=0,N=i.length;U<N;++U)F=l_(u,o,i[U],c,this.boundHandleStyleImageChange_,P,D)||F;else F=l_(u,o,i,c,this.boundHandleStyleImageChange_,P,D);return F},l}(Yx),h0=v2;var x2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),b2=function(v){x2(l,v);function l(o){return v.call(this,o)||this}return l.prototype.createRenderer=function(){return new h0(this)},l}(jx),np=b2;var p0=Fp(Jy(),1);var w2=function(){function v(l){this.rbush_=new p0.default(l),this.items_={}}return v.prototype.insert=function(l,o){var c={minX:l[0],minY:l[1],maxX:l[2],maxY:l[3],value:o};this.rbush_.insert(c),this.items_[wi(o)]=c},v.prototype.load=function(l,o){for(var c=new Array(o.length),i=0,u=o.length;i<u;i++){var P=l[i],D=o[i],F={minX:P[0],minY:P[1],maxX:P[2],maxY:P[3],value:D};c[i]=F,this.items_[wi(D)]=F}this.rbush_.load(c)},v.prototype.remove=function(l){var o=wi(l),c=this.items_[o];return delete this.items_[o],this.rbush_.remove(c)!==null},v.prototype.update=function(l,o){var c=this.items_[wi(o)],i=[c.minX,c.minY,c.maxX,c.maxY];wm(i,l)||(this.remove(o),this.insert(l,o))},v.prototype.getAll=function(){var l=this.rbush_.all();return l.map(function(o){return o.value})},v.prototype.getInExtent=function(l){var o={minX:l[0],minY:l[1],maxX:l[2],maxY:l[3]},c=this.rbush_.search(o);return c.map(function(i){return i.value})},v.prototype.forEach=function(l){return this.forEach_(this.getAll(),l)},v.prototype.forEachInExtent=function(l,o){return this.forEach_(this.getInExtent(l),o)},v.prototype.forEach_=function(l,o){for(var c,i=0,u=l.length;i<u;i++)if(c=o(l[i]),c)return c;return c},v.prototype.isEmpty=function(){return Vl(this.items_)},v.prototype.clear=function(){this.rbush_.clear(),this.items_={}},v.prototype.getExtent=function(l){var o=this.rbush_.toJSON();return sh(o.minX,o.minY,o.maxX,o.maxY,l)},v.prototype.concat=function(l){this.rbush_.load(l.rbush_.all());for(var o in l.items_)this.items_[o]=l.items_[o]},v}(),yd=w2;var E2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),S2=function(v){E2(l,v);function l(o){var c=v.call(this)||this;c.projection=ta(o.projection),c.attributions_=f0(o.attributions),c.attributionsCollapsible_=o.attributionsCollapsible!==void 0?o.attributionsCollapsible:!0,c.loading=!1,c.state_=o.state!==void 0?o.state:Mu.READY,c.wrapX_=o.wrapX!==void 0?o.wrapX:!1,c.interpolate_=!!o.interpolate,c.viewResolver=null,c.viewRejector=null;var i=c;return c.viewPromise_=new Promise(function(u,P){i.viewResolver=u,i.viewRejector=P}),c}return l.prototype.getAttributions=function(){return this.attributions_},l.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},l.prototype.getProjection=function(){return this.projection},l.prototype.getResolutions=function(){return Fr()},l.prototype.getView=function(){return this.viewPromise_},l.prototype.getState=function(){return this.state_},l.prototype.getWrapX=function(){return this.wrapX_},l.prototype.getInterpolate=function(){return this.interpolate_},l.prototype.refresh=function(){this.changed()},l.prototype.setAttributions=function(o){this.attributions_=f0(o),this.changed()},l.prototype.setState=function(o){this.state_=o,this.changed()},l}(Io);function f0(v){return v?Array.isArray(v)?function(l){return v}:typeof v=="function"?v:function(l){return[v]}:null}var nf=S2;var ja={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function d0(v,l){return[[-1/0,-1/0,1/0,1/0]]}var vh={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var T2=!1;function I2(v,l,o,c,i,u,P){var D=new XMLHttpRequest;D.open("GET",typeof v=="function"?v(o,c,i):v,!0),l.getType()==vh.ARRAY_BUFFER&&(D.responseType="arraybuffer"),D.withCredentials=T2,D.onload=function(F){if(!D.status||D.status>=200&&D.status<300){var U=l.getType(),N=void 0;U==vh.JSON||U==vh.TEXT?N=D.responseText:U==vh.XML?(N=D.responseXML,N||(N=new DOMParser().parseFromString(D.responseText,"application/xml"))):U==vh.ARRAY_BUFFER&&(N=D.response),N?u(l.readFeatures(N,{extent:o,featureProjection:i}),l.readProjection(N)):P()}else P()},D.onerror=P,D.send()}function u_(v,l){return function(o,c,i,u,P){var D=this;I2(v,l,o,c,i,function(F,U){D.addFeatures(F),u!==void 0&&u(F)},P||Wh)}}var m0=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),xh=function(v){m0(l,v);function l(o,c,i){var u=v.call(this,o)||this;return u.feature=c,u.features=i,u}return l}(ss);var C2=function(v){m0(l,v);function l(o){var c=this,i=o||{};c=v.call(this,{attributions:i.attributions,interpolate:!0,projection:void 0,state:Mu.READY,wrapX:i.wrapX!==void 0?i.wrapX:!0})||this,c.on,c.once,c.un,c.loader_=Wh,c.format_=i.format,c.overlaps_=i.overlaps===void 0?!0:i.overlaps,c.url_=i.url,i.loader!==void 0?c.loader_=i.loader:c.url_!==void 0&&(fn(c.format_,7),c.loader_=u_(c.url_,c.format_)),c.strategy_=i.strategy!==void 0?i.strategy:d0;var u=i.useSpatialIndex!==void 0?i.useSpatialIndex:!0;c.featuresRtree_=u?new yd:null,c.loadedExtentsRtree_=new yd,c.loadingExtentsCount_=0,c.nullGeometryFeatures_={},c.idIndex_={},c.uidIndex_={},c.featureChangeKeys_={},c.featuresCollection_=null;var P,D;return Array.isArray(i.features)?D=i.features:i.features&&(P=i.features,D=P.getArray()),!u&&P===void 0&&(P=new hh(D)),D!==void 0&&c.addFeaturesInternal(D),P!==void 0&&c.bindFeaturesCollection_(P),c}return l.prototype.addFeature=function(o){this.addFeatureInternal(o),this.changed()},l.prototype.addFeatureInternal=function(o){var c=wi(o);if(!this.addToIndex_(c,o)){this.featuresCollection_&&this.featuresCollection_.remove(o);return}this.setupChangeEvents_(c,o);var i=o.getGeometry();if(i){var u=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(u,o)}else this.nullGeometryFeatures_[c]=o;this.dispatchEvent(new xh(ja.ADDFEATURE,o))},l.prototype.setupChangeEvents_=function(o,c){this.featureChangeKeys_[o]=[eo(c,Vi.CHANGE,this.handleFeatureChange_,this),eo(c,Bp.PROPERTYCHANGE,this.handleFeatureChange_,this)]},l.prototype.addToIndex_=function(o,c){var i=!0,u=c.getId();return u!==void 0&&(u.toString()in this.idIndex_?i=!1:this.idIndex_[u.toString()]=c),i&&(fn(!(o in this.uidIndex_),30),this.uidIndex_[o]=c),i},l.prototype.addFeatures=function(o){this.addFeaturesInternal(o),this.changed()},l.prototype.addFeaturesInternal=function(o){for(var c=[],i=[],u=[],P=0,D=o.length;P<D;P++){var F=o[P],U=wi(F);this.addToIndex_(U,F)&&i.push(F)}for(var P=0,N=i.length;P<N;P++){var F=i[P],U=wi(F);this.setupChangeEvents_(U,F);var at=F.getGeometry();if(at){var yt=at.getExtent();c.push(yt),u.push(F)}else this.nullGeometryFeatures_[U]=F}if(this.featuresRtree_&&this.featuresRtree_.load(c,u),this.hasListener(ja.ADDFEATURE))for(var P=0,Tt=i.length;P<Tt;P++)this.dispatchEvent(new xh(ja.ADDFEATURE,i[P]))},l.prototype.bindFeaturesCollection_=function(o){var c=!1;this.addEventListener(ja.ADDFEATURE,function(i){c||(c=!0,o.push(i.feature),c=!1)}),this.addEventListener(ja.REMOVEFEATURE,function(i){c||(c=!0,o.remove(i.feature),c=!1)}),o.addEventListener(ps.ADD,function(i){c||(c=!0,this.addFeature(i.element),c=!1)}.bind(this)),o.addEventListener(ps.REMOVE,function(i){c||(c=!0,this.removeFeature(i.element),c=!1)}.bind(this)),this.featuresCollection_=o},l.prototype.clear=function(o){if(o){for(var c in this.featureChangeKeys_){var i=this.featureChangeKeys_[c];i.forEach(To)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){var u=function(F){this.removeFeatureInternal(F)}.bind(this);this.featuresRtree_.forEach(u);for(var P in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[P])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};var D=new xh(ja.CLEAR);this.dispatchEvent(D),this.changed()},l.prototype.forEachFeature=function(o){if(this.featuresRtree_)return this.featuresRtree_.forEach(o);this.featuresCollection_&&this.featuresCollection_.forEach(o)},l.prototype.forEachFeatureAtCoordinateDirect=function(o,c){var i=[o[0],o[1],o[0],o[1]];return this.forEachFeatureInExtent(i,function(u){var P=u.getGeometry();if(P.intersectsCoordinate(o))return c(u)})},l.prototype.forEachFeatureInExtent=function(o,c){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(o,c);this.featuresCollection_&&this.featuresCollection_.forEach(c)},l.prototype.forEachFeatureIntersectingExtent=function(o,c){return this.forEachFeatureInExtent(o,function(i){var u=i.getGeometry();if(u.intersectsExtent(o)){var P=c(i);if(P)return P}})},l.prototype.getFeaturesCollection=function(){return this.featuresCollection_},l.prototype.getFeatures=function(){var o;return this.featuresCollection_?o=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(o=this.featuresRtree_.getAll(),Vl(this.nullGeometryFeatures_)||Ua(o,cm(this.nullGeometryFeatures_))),o},l.prototype.getFeaturesAtCoordinate=function(o){var c=[];return this.forEachFeatureAtCoordinateDirect(o,function(i){c.push(i)}),c},l.prototype.getFeaturesInExtent=function(o){return this.featuresRtree_?this.featuresRtree_.getInExtent(o):this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]},l.prototype.getClosestFeatureToCoordinate=function(o,c){var i=o[0],u=o[1],P=null,D=[NaN,NaN],F=1/0,U=[-1/0,-1/0,1/0,1/0],N=c||um;return this.featuresRtree_.forEachInExtent(U,function(at){if(N(at)){var yt=at.getGeometry(),Tt=F;if(F=yt.closestPointXY(i,u,D,F),F<Tt){P=at;var Lt=Math.sqrt(F);U[0]=i-Lt,U[1]=u-Lt,U[2]=i+Lt,U[3]=u+Lt}}}),P},l.prototype.getExtent=function(o){return this.featuresRtree_.getExtent(o)},l.prototype.getFeatureById=function(o){var c=this.idIndex_[o.toString()];return c!==void 0?c:null},l.prototype.getFeatureByUid=function(o){var c=this.uidIndex_[o];return c!==void 0?c:null},l.prototype.getFormat=function(){return this.format_},l.prototype.getOverlaps=function(){return this.overlaps_},l.prototype.getUrl=function(){return this.url_},l.prototype.handleFeatureChange_=function(o){var c=o.target,i=wi(c),u=c.getGeometry();if(!u)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(c),this.nullGeometryFeatures_[i]=c);else{var P=u.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(P,c)):this.featuresRtree_&&this.featuresRtree_.update(P,c)}var D=c.getId();if(D!==void 0){var F=D.toString();this.idIndex_[F]!==c&&(this.removeFromIdIndex_(c),this.idIndex_[F]=c)}else this.removeFromIdIndex_(c),this.uidIndex_[i]=c;this.changed(),this.dispatchEvent(new xh(ja.CHANGEFEATURE,c))},l.prototype.hasFeature=function(o){var c=o.getId();return c!==void 0?c in this.idIndex_:wi(o)in this.uidIndex_},l.prototype.isEmpty=function(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Vl(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0},l.prototype.loadFeatures=function(o,c,i){for(var u=this.loadedExtentsRtree_,P=this.strategy_(o,c,i),D=function(at,yt){var Tt=P[at],Lt=u.forEachInExtent(Tt,function(Vt){return mc(Vt.extent,Tt)});Lt||(++F.loadingExtentsCount_,F.dispatchEvent(new xh(ja.FEATURESLOADSTART)),F.loader_.call(F,Tt,c,i,function(Vt){--this.loadingExtentsCount_,this.dispatchEvent(new xh(ja.FEATURESLOADEND,void 0,Vt))}.bind(F),function(){--this.loadingExtentsCount_,this.dispatchEvent(new xh(ja.FEATURESLOADERROR))}.bind(F)),u.insert(Tt,{extent:Tt.slice()}))},F=this,U=0,N=P.length;U<N;++U)D(U,N);this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0},l.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),v.prototype.refresh.call(this)},l.prototype.removeLoadedExtent=function(o){var c=this.loadedExtentsRtree_,i;c.forEachInExtent(o,function(u){if(wm(u.extent,o))return i=u,!0}),i&&c.remove(i)},l.prototype.removeFeature=function(o){if(!!o){var c=wi(o);c in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[c]:this.featuresRtree_&&this.featuresRtree_.remove(o);var i=this.removeFeatureInternal(o);i&&this.changed()}},l.prototype.removeFeatureInternal=function(o){var c=wi(o),i=this.featureChangeKeys_[c];if(!!i){i.forEach(To),delete this.featureChangeKeys_[c];var u=o.getId();return u!==void 0&&delete this.idIndex_[u.toString()],delete this.uidIndex_[c],this.dispatchEvent(new xh(ja.REMOVEFEATURE,o)),o}},l.prototype.removeFromIdIndex_=function(o){var c=!1;for(var i in this.idIndex_)if(this.idIndex_[i]===o){delete this.idIndex_[i],c=!0;break}return c},l.prototype.setLoader=function(o){this.loader_=o},l.prototype.setUrl=function(o){fn(this.format_,7),this.url_=o,this.setLoader(u_(o,this.format_))},l}(nf),op=C2;var g0=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),of=function(v){g0(l,v);function l(o,c){var i=v.call(this,o)||this;return i.layer=c,i}return l}(ss);var c_={LAYERS:"layers"},A2=function(v){g0(l,v);function l(o){var c=this,i=o||{},u=_a({},i);delete u.layers;var P=i.layers;return c=v.call(this,u)||this,c.on,c.once,c.un,c.layersListenerKeys_=[],c.listenerKeys_={},c.addChangeListener(c_.LAYERS,c.handleLayersChanged_),P?Array.isArray(P)?P=new hh(P.slice(),{unique:!0}):fn(typeof P.getArray=="function",43):P=new hh(void 0,{unique:!0}),c.setLayers(P),c}return l.prototype.handleLayerChange_=function(){this.changed()},l.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(To),this.layersListenerKeys_.length=0;var o=this.getLayers();this.layersListenerKeys_.push(eo(o,ps.ADD,this.handleLayersAdd_,this),eo(o,ps.REMOVE,this.handleLayersRemove_,this));for(var c in this.listenerKeys_)this.listenerKeys_[c].forEach(To);ih(this.listenerKeys_);for(var i=o.getArray(),u=0,P=i.length;u<P;u++){var D=i[u];this.registerLayerListeners_(D),this.dispatchEvent(new of("addlayer",D))}this.changed()},l.prototype.registerLayerListeners_=function(o){var c=[eo(o,Bp.PROPERTYCHANGE,this.handleLayerChange_,this),eo(o,Vi.CHANGE,this.handleLayerChange_,this)];o instanceof l&&c.push(eo(o,"addlayer",this.handleLayerGroupAdd_,this),eo(o,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[wi(o)]=c},l.prototype.handleLayerGroupAdd_=function(o){this.dispatchEvent(new of("addlayer",o.layer))},l.prototype.handleLayerGroupRemove_=function(o){this.dispatchEvent(new of("removelayer",o.layer))},l.prototype.handleLayersAdd_=function(o){var c=o.element;this.registerLayerListeners_(c),this.dispatchEvent(new of("addlayer",c)),this.changed()},l.prototype.handleLayersRemove_=function(o){var c=o.element,i=wi(c);this.listenerKeys_[i].forEach(To),delete this.listenerKeys_[i],this.dispatchEvent(new of("removelayer",c)),this.changed()},l.prototype.getLayers=function(){return this.get(c_.LAYERS)},l.prototype.setLayers=function(o){var c=this.getLayers();if(c)for(var i=c.getArray(),u=0,P=i.length;u<P;++u)this.dispatchEvent(new of("removelayer",i[u]));this.set(c_.LAYERS,o)},l.prototype.getLayersArray=function(o){var c=o!==void 0?o:[];return this.getLayers().forEach(function(i){i.getLayersArray(c)}),c},l.prototype.getLayerStatesArray=function(o){var c=o!==void 0?o:[],i=c.length;this.getLayers().forEach(function(N){N.getLayerStatesArray(c)});var u=this.getLayerState(),P=u.zIndex;!o&&u.zIndex===void 0&&(P=0);for(var D=i,F=c.length;D<F;D++){var U=c[D];U.opacity*=u.opacity,U.visible=U.visible&&u.visible,U.maxResolution=Math.min(U.maxResolution,u.maxResolution),U.minResolution=Math.max(U.minResolution,u.minResolution),U.minZoom=Math.max(U.minZoom,u.minZoom),U.maxZoom=Math.min(U.maxZoom,u.maxZoom),u.extent!==void 0&&(U.extent!==void 0?U.extent=Vv(U.extent,u.extent):U.extent=u.extent),U.zIndex===void 0&&(U.zIndex=P)}return c},l.prototype.getSourceState=function(){return Mu.READY},l}(Cm),h_=A2;var Xo={SINGLECLICK:"singleclick",CLICK:Vi.CLICK,DBLCLICK:Vi.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var p_={ACTIVE:"active"};var P2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),M2=function(v){P2(l,v);function l(o){var c=v.call(this)||this;return c.on,c.once,c.un,o&&o.handleEvent&&(c.handleEvent=o.handleEvent),c.map_=null,c.setActive(!0),c}return l.prototype.getActive=function(){return this.get(p_.ACTIVE)},l.prototype.getMap=function(){return this.map_},l.prototype.handleEvent=function(o){return!0},l.prototype.setActive=function(o){this.set(p_.ACTIVE,o)},l.prototype.setMap=function(o){this.map_=o},l}(Io);var y0=M2;var L2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),k2=function(v){L2(l,v);function l(o){var c=this,i=o||{};return c=v.call(this,i)||this,i.handleDownEvent&&(c.handleDownEvent=i.handleDownEvent),i.handleDragEvent&&(c.handleDragEvent=i.handleDragEvent),i.handleMoveEvent&&(c.handleMoveEvent=i.handleMoveEvent),i.handleUpEvent&&(c.handleUpEvent=i.handleUpEvent),i.stopDown&&(c.stopDown=i.stopDown),c.handlingDownUpSequence=!1,c.trackedPointers_={},c.targetPointers=[],c}return l.prototype.getPointerCount=function(){return this.targetPointers.length},l.prototype.handleDownEvent=function(o){return!1},l.prototype.handleDragEvent=function(o){},l.prototype.handleEvent=function(o){if(!o.originalEvent)return!0;var c=!1;if(this.updateTrackedPointers_(o),this.handlingDownUpSequence){if(o.type==Xo.POINTERDRAG)this.handleDragEvent(o),o.originalEvent.preventDefault();else if(o.type==Xo.POINTERUP){var i=this.handleUpEvent(o);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(o.type==Xo.POINTERDOWN){var u=this.handleDownEvent(o);this.handlingDownUpSequence=u,c=this.stopDown(u)}else o.type==Xo.POINTERMOVE&&this.handleMoveEvent(o);return!c},l.prototype.handleMoveEvent=function(o){},l.prototype.handleUpEvent=function(o){return!1},l.prototype.stopDown=function(o){return o},l.prototype.updateTrackedPointers_=function(o){if(z2(o)){var c=o.originalEvent,i=c.pointerId.toString();o.type==Xo.POINTERUP?delete this.trackedPointers_[i]:o.type==Xo.POINTERDOWN?this.trackedPointers_[i]=c:i in this.trackedPointers_&&(this.trackedPointers_[i]=c),this.targetPointers=cm(this.trackedPointers_)}},l}(y0);function z2(v){var l=v.type;return l===Xo.POINTERDOWN||l===Xo.POINTERDRAG||l===Xo.POINTERUP}var _0=k2;var v0=function(v){var l=v.originalEvent;return l.altKey&&!(l.metaKey||l.ctrlKey)&&!l.shiftKey};var x0=um,b0=function(v){return v.type==Xo.CLICK};var w0=function(v){return v.type==Xo.SINGLECLICK};var E0=function(v){var l=v.originalEvent;return fn(l!==void 0,56),l.isPrimary&&l.button===0};var R2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),D2=function(v){R2(l,v);function l(o,c,i){var u=v.call(this)||this;if(u.ends_=[],u.maxDelta_=-1,u.maxDeltaRevision_=-1,Array.isArray(o[0]))u.setCoordinates(o,c);else if(c!==void 0&&i)u.setFlatCoordinates(c,o),u.ends_=i;else{for(var P=u.getLayout(),D=o,F=[],U=[],N=0,at=D.length;N<at;++N){var yt=D[N];N===0&&(P=yt.getLayout()),Ua(F,yt.getFlatCoordinates()),U.push(F.length)}u.setFlatCoordinates(P,F),u.ends_=U}return u}return l.prototype.appendLineString=function(o){this.flatCoordinates?Ua(this.flatCoordinates,o.getFlatCoordinates().slice()):this.flatCoordinates=o.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},l.prototype.clone=function(){var o=new l(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return o.applyProperties(this),o},l.prototype.closestPointXY=function(o,c,i,u){return u<cs(this.getExtent(),o,c)?u:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(rd(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),nd(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,o,c,i,u))},l.prototype.getCoordinateAtM=function(o,c,i){if(this.layout!=_n.XYM&&this.layout!=_n.XYZM||this.flatCoordinates.length===0)return null;var u=c!==void 0?c:!1,P=i!==void 0?i:!1;return Cx(this.flatCoordinates,0,this.ends_,this.stride,o,u,P)},l.prototype.getCoordinates=function(){return fh(this.flatCoordinates,0,this.ends_,this.stride)},l.prototype.getEnds=function(){return this.ends_},l.prototype.getLineString=function(o){return o<0||this.ends_.length<=o?null:new yc(this.flatCoordinates.slice(o===0?0:this.ends_[o-1],this.ends_[o]),this.layout)},l.prototype.getLineStrings=function(){for(var o=this.flatCoordinates,c=this.ends_,i=this.layout,u=[],P=0,D=0,F=c.length;D<F;++D){var U=c[D],N=new yc(o.slice(P,U),i);u.push(N),P=U}return u},l.prototype.getFlatMidpoints=function(){for(var o=[],c=this.flatCoordinates,i=0,u=this.ends_,P=this.stride,D=0,F=u.length;D<F;++D){var U=u[D],N=Dm(c,i,U,P,.5);Ua(o,N),i=U}return o},l.prototype.getSimplifiedGeometryInternal=function(o){var c=[],i=[];return c.length=mx(this.flatCoordinates,0,this.ends_,this.stride,o,c,0,i),new l(c,_n.XY,i)},l.prototype.getType=function(){return Ie.MULTI_LINE_STRING},l.prototype.intersectsExtent=function(o){return bx(this.flatCoordinates,0,this.ends_,this.stride,o)},l.prototype.setCoordinates=function(o,c){this.setLayout(c,o,2),this.flatCoordinates||(this.flatCoordinates=[]);var i=od(this.flatCoordinates,0,o,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()},l}(fs),S0=D2;var O2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),F2=function(v){O2(l,v);function l(o,c){var i=v.call(this)||this;return c&&!Array.isArray(o[0])?i.setFlatCoordinates(c,o):i.setCoordinates(o,c),i}return l.prototype.appendPoint=function(o){this.flatCoordinates?Ua(this.flatCoordinates,o.getFlatCoordinates()):this.flatCoordinates=o.getFlatCoordinates().slice(),this.changed()},l.prototype.clone=function(){var o=new l(this.flatCoordinates.slice(),this.layout);return o.applyProperties(this),o},l.prototype.closestPointXY=function(o,c,i,u){if(u<cs(this.getExtent(),o,c))return u;for(var P=this.flatCoordinates,D=this.stride,F=0,U=P.length;F<U;F+=D){var N=ql(o,c,P[F],P[F+1]);if(N<u){u=N;for(var at=0;at<D;++at)i[at]=P[F+at];i.length=D}}return u},l.prototype.getCoordinates=function(){return nl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},l.prototype.getPoint=function(o){var c=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return o<0||c<=o?null:new ea(this.flatCoordinates.slice(o*this.stride,(o+1)*this.stride),this.layout)},l.prototype.getPoints=function(){for(var o=this.flatCoordinates,c=this.layout,i=this.stride,u=[],P=0,D=o.length;P<D;P+=i){var F=new ea(o.slice(P,P+i),c);u.push(F)}return u},l.prototype.getType=function(){return Ie.MULTI_POINT},l.prototype.intersectsExtent=function(o){for(var c=this.flatCoordinates,i=this.stride,u=0,P=c.length;u<P;u+=i){var D=c[u],F=c[u+1];if(Yf(o,D,F))return!0}return!1},l.prototype.setCoordinates=function(o,c){this.setLayout(c,o,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=tp(this.flatCoordinates,0,o,this.stride),this.changed()},l}(fs),jm=F2;function T0(v,l,o,c){for(var i=[],u=Va(),P=0,D=o.length;P<D;++P){var F=o[P];u=bm(v,l,F[0],c),i.push((u[0]+u[2])/2,(u[1]+u[3])/2),l=F[F.length-1]}return i}var B2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),U2=function(v){B2(l,v);function l(o,c,i){var u=v.call(this)||this;if(u.endss_=[],u.flatInteriorPointsRevision_=-1,u.flatInteriorPoints_=null,u.maxDelta_=-1,u.maxDeltaRevision_=-1,u.orientedRevision_=-1,u.orientedFlatCoordinates_=null,!i&&!Array.isArray(o[0])){for(var P=u.getLayout(),D=o,F=[],U=[],N=0,at=D.length;N<at;++N){var yt=D[N];N===0&&(P=yt.getLayout());for(var Tt=F.length,Lt=yt.getEnds(),Vt=0,wt=Lt.length;Vt<wt;++Vt)Lt[Vt]+=Tt;Ua(F,yt.getFlatCoordinates()),U.push(Lt)}c=P,o=F,i=U}return c!==void 0&&i?(u.setFlatCoordinates(c,o),u.endss_=i):u.setCoordinates(o,c),u}return l.prototype.appendPolygon=function(o){var c;if(!this.flatCoordinates)this.flatCoordinates=o.getFlatCoordinates().slice(),c=o.getEnds().slice(),this.endss_.push();else{var i=this.flatCoordinates.length;Ua(this.flatCoordinates,o.getFlatCoordinates()),c=o.getEnds().slice();for(var u=0,P=c.length;u<P;++u)c[u]+=i}this.endss_.push(c),this.changed()},l.prototype.clone=function(){for(var o=this.endss_.length,c=new Array(o),i=0;i<o;++i)c[i]=this.endss_[i].slice();var u=new l(this.flatCoordinates.slice(),this.layout,c);return u.applyProperties(this),u},l.prototype.closestPointXY=function(o,c,i,u){return u<cs(this.getExtent(),o,c)?u:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(hx(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),px(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,o,c,i,u))},l.prototype.containsXY=function(o,c){return vx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,o,c)},l.prototype.getArea=function(){return yx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)},l.prototype.getCoordinates=function(o){var c;return o!==void 0?(c=this.getOrientedFlatCoordinates().slice(),Vy(c,0,this.endss_,this.stride,o)):c=this.flatCoordinates,sd(c,0,this.endss_,this.stride)},l.prototype.getEndss=function(){return this.endss_},l.prototype.getFlatInteriorPoints=function(){if(this.flatInteriorPointsRevision_!=this.getRevision()){var o=T0(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=xx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,o),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_},l.prototype.getInteriorPoints=function(){return new jm(this.getFlatInteriorPoints().slice(),_n.XYM)},l.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var o=this.flatCoordinates;Tx(o,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=o:(this.orientedFlatCoordinates_=o.slice(),this.orientedFlatCoordinates_.length=Vy(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},l.prototype.getSimplifiedGeometryInternal=function(o){var c=[],i=[];return c.length=gx(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(o),c,0,i),new l(c,_n.XY,i)},l.prototype.getPolygon=function(o){if(o<0||this.endss_.length<=o)return null;var c;if(o===0)c=0;else{var i=this.endss_[o-1];c=i[i.length-1]}var u=this.endss_[o].slice(),P=u[u.length-1];if(c!==0)for(var D=0,F=u.length;D<F;++D)u[D]-=c;return new cd(this.flatCoordinates.slice(c,P),this.layout,u)},l.prototype.getPolygons=function(){for(var o=this.layout,c=this.flatCoordinates,i=this.endss_,u=[],P=0,D=0,F=i.length;D<F;++D){var U=i[D].slice(),N=U[U.length-1];if(P!==0)for(var at=0,yt=U.length;at<yt;++at)U[at]-=P;var Tt=new cd(c.slice(P,N),o,U);u.push(Tt),P=N}return u},l.prototype.getType=function(){return Ie.MULTI_POLYGON},l.prototype.intersectsExtent=function(o){return wx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,o)},l.prototype.setCoordinates=function(o,c){this.setLayout(c,o,3),this.flatCoordinates||(this.flatCoordinates=[]);var i=dx(this.flatCoordinates,0,o,this.stride,this.endss_);if(i.length===0)this.flatCoordinates.length=0;else{var u=i[i.length-1];this.flatCoordinates.length=u.length===0?0:u[u.length-1]}this.changed()},l}(fs),I0=U2;var L0=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),C0=0,_d=1,A0=[0,0,0,0],af=[],f_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},d_=function(v){L0(l,v);function l(o,c,i){var u=v.call(this,o)||this;return u.features=c,u.mapBrowserEvent=i,u}return l}(ss);var N2=function(v){L0(l,v);function l(o){var c=v.call(this,o)||this;c.on,c.once,c.un,c.boundHandleFeatureChange_=c.handleFeatureChange_.bind(c),c.condition_=o.condition?o.condition:E0,c.defaultDeleteCondition_=function(u){return v0(u)&&w0(u)},c.deleteCondition_=o.deleteCondition?o.deleteCondition:c.defaultDeleteCondition_,c.insertVertexCondition_=o.insertVertexCondition?o.insertVertexCondition:x0,c.vertexFeature_=null,c.vertexSegments_=null,c.lastPixel_=[0,0],c.ignoreNextSingleClick_=!1,c.featuresBeingModified_=null,c.rBush_=new yd,c.pixelTolerance_=o.pixelTolerance!==void 0?o.pixelTolerance:10,c.snappedToVertex_=!1,c.changingFeature_=!1,c.dragSegments_=[],c.overlay_=new np({source:new op({useSpatialIndex:!1,wrapX:!!o.wrapX}),style:o.style?o.style:G2(),updateWhileAnimating:!0,updateWhileInteracting:!0}),c.SEGMENT_WRITERS_={Point:c.writePointGeometry_.bind(c),LineString:c.writeLineStringGeometry_.bind(c),LinearRing:c.writeLineStringGeometry_.bind(c),Polygon:c.writePolygonGeometry_.bind(c),MultiPoint:c.writeMultiPointGeometry_.bind(c),MultiLineString:c.writeMultiLineStringGeometry_.bind(c),MultiPolygon:c.writeMultiPolygonGeometry_.bind(c),Circle:c.writeCircleGeometry_.bind(c),GeometryCollection:c.writeGeometryCollectionGeometry_.bind(c)},c.source_=null,c.hitDetection_=null;var i;if(o.features?i=o.features:o.source&&(c.source_=o.source,i=new hh(c.source_.getFeatures()),c.source_.addEventListener(ja.ADDFEATURE,c.handleSourceAdd_.bind(c)),c.source_.addEventListener(ja.REMOVEFEATURE,c.handleSourceRemove_.bind(c))),!i)throw new Error("The modify interaction requires features, a source or a layer");return o.hitDetection&&(c.hitDetection_=o.hitDetection),c.features_=i,c.features_.forEach(c.addFeature_.bind(c)),c.features_.addEventListener(ps.ADD,c.handleFeatureAdd_.bind(c)),c.features_.addEventListener(ps.REMOVE,c.handleFeatureRemove_.bind(c)),c.lastPointerEvent_=null,c.delta_=[0,0],c.snapToPointer_=o.snapToPointer===void 0?!c.hitDetection_:o.snapToPointer,c}return l.prototype.addFeature_=function(o){var c=o.getGeometry();if(c){var i=this.SEGMENT_WRITERS_[c.getType()];i&&i(o,c)}var u=this.getMap();u&&u.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,u),o.addEventListener(Vi.CHANGE,this.boundHandleFeatureChange_)},l.prototype.willModifyFeatures_=function(o,c){if(!this.featuresBeingModified_){this.featuresBeingModified_=new hh;for(var i=this.featuresBeingModified_.getArray(),u=0,P=c.length;u<P;++u)for(var D=c[u],F=0,U=D.length;F<U;++F){var N=D[F].feature;N&&i.indexOf(N)===-1&&this.featuresBeingModified_.push(N)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new d_(f_.MODIFYSTART,this.featuresBeingModified_,o))}},l.prototype.removeFeature_=function(o){this.removeFeatureSegmentData_(o),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),o.removeEventListener(Vi.CHANGE,this.boundHandleFeatureChange_)},l.prototype.removeFeatureSegmentData_=function(o){var c=this.rBush_,i=[];c.forEach(function(F){o===F.feature&&i.push(F)});for(var u=i.length-1;u>=0;--u){for(var P=i[u],D=this.dragSegments_.length-1;D>=0;--D)this.dragSegments_[D][0]===P&&this.dragSegments_.splice(D,1);c.remove(P)}},l.prototype.setActive=function(o){this.vertexFeature_&&!o&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),v.prototype.setActive.call(this,o)},l.prototype.setMap=function(o){this.overlay_.setMap(o),v.prototype.setMap.call(this,o)},l.prototype.getOverlay=function(){return this.overlay_},l.prototype.handleSourceAdd_=function(o){o.feature&&this.features_.push(o.feature)},l.prototype.handleSourceRemove_=function(o){o.feature&&this.features_.remove(o.feature)},l.prototype.handleFeatureAdd_=function(o){this.addFeature_(o.element)},l.prototype.handleFeatureChange_=function(o){if(!this.changingFeature_){var c=o.target;this.removeFeature_(c),this.addFeature_(c)}},l.prototype.handleFeatureRemove_=function(o){var c=o.element;this.removeFeature_(c)},l.prototype.writePointGeometry_=function(o,c){var i=c.getCoordinates(),u={feature:o,geometry:c,segment:[i,i]};this.rBush_.insert(c.getExtent(),u)},l.prototype.writeMultiPointGeometry_=function(o,c){for(var i=c.getCoordinates(),u=0,P=i.length;u<P;++u){var D=i[u],F={feature:o,geometry:c,depth:[u],index:u,segment:[D,D]};this.rBush_.insert(c.getExtent(),F)}},l.prototype.writeLineStringGeometry_=function(o,c){for(var i=c.getCoordinates(),u=0,P=i.length-1;u<P;++u){var D=i.slice(u,u+2),F={feature:o,geometry:c,index:u,segment:D};this.rBush_.insert(Cu(D),F)}},l.prototype.writeMultiLineStringGeometry_=function(o,c){for(var i=c.getCoordinates(),u=0,P=i.length;u<P;++u)for(var D=i[u],F=0,U=D.length-1;F<U;++F){var N=D.slice(F,F+2),at={feature:o,geometry:c,depth:[u],index:F,segment:N};this.rBush_.insert(Cu(N),at)}},l.prototype.writePolygonGeometry_=function(o,c){for(var i=c.getCoordinates(),u=0,P=i.length;u<P;++u)for(var D=i[u],F=0,U=D.length-1;F<U;++F){var N=D.slice(F,F+2),at={feature:o,geometry:c,depth:[u],index:F,segment:N};this.rBush_.insert(Cu(N),at)}},l.prototype.writeMultiPolygonGeometry_=function(o,c){for(var i=c.getCoordinates(),u=0,P=i.length;u<P;++u)for(var D=i[u],F=0,U=D.length;F<U;++F)for(var N=D[F],at=0,yt=N.length-1;at<yt;++at){var Tt=N.slice(at,at+2),Lt={feature:o,geometry:c,depth:[F,u],index:at,segment:Tt};this.rBush_.insert(Cu(Tt),Lt)}},l.prototype.writeCircleGeometry_=function(o,c){var i=c.getCenter(),u={feature:o,geometry:c,index:C0,segment:[i,i]},P={feature:o,geometry:c,index:_d,segment:[i,i]},D=[u,P];u.featureSegments=D,P.featureSegments=D,this.rBush_.insert(Xp(i),u);var F=c,U=uh();if(U&&this.getMap()){var N=this.getMap().getView().getProjection();F=F.clone().transform(U,N),F=Gy(F).transform(N,U)}this.rBush_.insert(F.getExtent(),P)},l.prototype.writeGeometryCollectionGeometry_=function(o,c){for(var i=c.getGeometriesArray(),u=0;u<i.length;++u){var P=i[u],D=this.SEGMENT_WRITERS_[P.getType()];D(o,P)}},l.prototype.createOrUpdateVertexFeature_=function(o,c,i){var u=this.vertexFeature_;if(!u)u=new gc(new ea(o)),this.vertexFeature_=u,this.overlay_.getSource().addFeature(u);else{var P=u.getGeometry();P.setCoordinates(o)}return u.set("features",c),u.set("geometries",i),u},l.prototype.handleEvent=function(o){if(!o.originalEvent)return!0;this.lastPointerEvent_=o;var c;return!o.map.getView().getInteracting()&&o.type==Xo.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(o),this.vertexFeature_&&this.deleteCondition_(o)&&(o.type!=Xo.SINGLECLICK||!this.ignoreNextSingleClick_?c=this.removePoint():c=!0),o.type==Xo.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),v.prototype.handleEvent.call(this,o)&&!c},l.prototype.handleDragEvent=function(o){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(o,this.dragSegments_);for(var c=[o.coordinate[0]+this.delta_[0],o.coordinate[1]+this.delta_[1]],i=[],u=[],P=0,D=this.dragSegments_.length;P<D;++P){var F=this.dragSegments_[P],U=F[0],N=U.feature;i.indexOf(N)===-1&&i.push(N);var at=U.geometry;u.indexOf(at)===-1&&u.push(at);for(var yt=U.depth,Tt=void 0,Lt=U.segment,Vt=F[1];c.length<at.getStride();)c.push(Lt[Vt][c.length]);switch(at.getType()){case Ie.POINT:Tt=c,Lt[0]=c,Lt[1]=c;break;case Ie.MULTI_POINT:Tt=at.getCoordinates(),Tt[U.index]=c,Lt[0]=c,Lt[1]=c;break;case Ie.LINE_STRING:Tt=at.getCoordinates(),Tt[U.index+Vt]=c,Lt[Vt]=c;break;case Ie.MULTI_LINE_STRING:Tt=at.getCoordinates(),Tt[yt[0]][U.index+Vt]=c,Lt[Vt]=c;break;case Ie.POLYGON:Tt=at.getCoordinates(),Tt[yt[0]][U.index+Vt]=c,Lt[Vt]=c;break;case Ie.MULTI_POLYGON:Tt=at.getCoordinates(),Tt[yt[1]][yt[0]][U.index+Vt]=c,Lt[Vt]=c;break;case Ie.CIRCLE:if(Lt[0]=c,Lt[1]=c,U.index===C0)this.changingFeature_=!0,at.setCenter(c),this.changingFeature_=!1;else{this.changingFeature_=!0;var wt=o.map.getView().getProjection(),kt=_y(Xl(at.getCenter(),wt),Xl(c,wt)),Zt=uh();if(Zt){var Yt=at.clone().transform(Zt,wt);Yt.setRadius(kt),kt=Yt.transform(wt,Zt).getRadius()}at.setRadius(kt),this.changingFeature_=!1}break;default:}Tt&&this.setGeometryCoordinates_(at,Tt)}this.createOrUpdateVertexFeature_(c,i,u)},l.prototype.handleDownEvent=function(o){if(!this.condition_(o))return!1;var c=o.coordinate;this.handlePointerAtPixel_(o.pixel,o.map,c),this.dragSegments_.length=0,this.featuresBeingModified_=null;var i=this.vertexFeature_;if(i){var u=o.map.getView().getProjection(),P=[],D=i.getGeometry().getCoordinates(),F=Cu([D]),U=this.rBush_.getInExtent(F),N={};U.sort(V2);for(var at=0,yt=U.length;at<yt;++at){var Tt=U[at],Lt=Tt.segment,Vt=wi(Tt.geometry),wt=Tt.depth;if(wt&&(Vt+="-"+wt.join("-")),N[Vt]||(N[Vt]=new Array(2)),Tt.geometry.getType()===Ie.CIRCLE&&Tt.index===_d){var kt=M0(c,Tt,u);Pu(kt,D)&&!N[Vt][0]&&(this.dragSegments_.push([Tt,0]),N[Vt][0]=Tt);continue}if(Pu(Lt[0],D)&&!N[Vt][0]){this.dragSegments_.push([Tt,0]),N[Vt][0]=Tt;continue}if(Pu(Lt[1],D)&&!N[Vt][1]){if((Tt.geometry.getType()===Ie.LINE_STRING||Tt.geometry.getType()===Ie.MULTI_LINE_STRING)&&N[Vt][0]&&N[Vt][0].index===0)continue;this.dragSegments_.push([Tt,1]),N[Vt][1]=Tt;continue}wi(Lt)in this.vertexSegments_&&!N[Vt][0]&&!N[Vt][1]&&this.insertVertexCondition_(o)&&P.push(Tt)}P.length&&this.willModifyFeatures_(o,[P]);for(var Zt=P.length-1;Zt>=0;--Zt)this.insertVertex_(P[Zt],D)}return!!this.vertexFeature_},l.prototype.handleUpEvent=function(o){for(var c=this.dragSegments_.length-1;c>=0;--c){var i=this.dragSegments_[c][0],u=i.geometry;if(u.getType()===Ie.CIRCLE){var P=u.getCenter(),D=i.featureSegments[0],F=i.featureSegments[1];D.segment[0]=P,D.segment[1]=P,F.segment[0]=P,F.segment[1]=P,this.rBush_.update(Xp(P),D);var U=u,N=uh();if(N){var at=o.map.getView().getProjection();U=U.clone().transform(N,at),U=Gy(U).transform(at,N)}this.rBush_.update(U.getExtent(),F)}else this.rBush_.update(Cu(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new d_(f_.MODIFYEND,this.featuresBeingModified_,o)),this.featuresBeingModified_=null),!1},l.prototype.handlePointerMove_=function(o){this.lastPixel_=o.pixel,this.handlePointerAtPixel_(o.pixel,o.map,o.coordinate)},l.prototype.handlePointerAtPixel_=function(o,c,i){var u=this,P=i||c.getCoordinateFromPixel(o),D=c.getView().getProjection(),F=function(Ce,Lr){return P0(P,Ce,D)-P0(P,Lr,D)},U,N;if(this.hitDetection_){var at=typeof this.hitDetection_=="object"?function(Ce){return Ce===u.hitDetection_}:void 0;c.forEachFeatureAtPixel(o,function(Ce,Lr,yr){if(yr=yr||Ce.getGeometry(),yr.getType()===Ie.POINT&&hv(u.features_.getArray(),Ce)){N=yr;var _r=yr.getFlatCoordinates().slice(0,2);U=[{feature:Ce,geometry:yr,segment:[_r,_r]}]}return!0},{layerFilter:at})}if(!U){var yt=Qf(Xp(P,A0),D),Tt=c.getView().getResolution()*this.pixelTolerance_,Lt=$p(rl(yt,Tt,A0),D);U=this.rBush_.getInExtent(Lt)}if(U&&U.length>0){var Vt=U.sort(F)[0],wt=Vt.segment,kt=M0(P,Vt,D),Zt=c.getPixelFromCoordinate(kt),Yt=_y(o,Zt);if(N||Yt<=this.pixelTolerance_){var le={};if(le[wi(wt)]=!0,this.snapToPointer_||(this.delta_[0]=kt[0]-P[0],this.delta_[1]=kt[1]-P[1]),Vt.geometry.getType()===Ie.CIRCLE&&Vt.index===_d)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(kt,[Vt.feature],[Vt.geometry]);else{var ue=c.getPixelFromCoordinate(wt[0]),oe=c.getPixelFromCoordinate(wt[1]),ge=Wp(Zt,ue),we=Wp(Zt,oe);Yt=Math.sqrt(Math.min(ge,we)),this.snappedToVertex_=Yt<=this.pixelTolerance_,this.snappedToVertex_&&(kt=ge>we?wt[1]:wt[0]),this.createOrUpdateVertexFeature_(kt,[Vt.feature],[Vt.geometry]);var Pe={};Pe[wi(Vt.geometry)]=!0;for(var ir=1,Be=U.length;ir<Be;++ir){var qe=U[ir].segment;if(Pu(wt[0],qe[0])&&Pu(wt[1],qe[1])||Pu(wt[0],qe[1])&&Pu(wt[1],qe[0])){var rr=wi(U[ir].geometry);rr in Pe||(Pe[rr]=!0,le[wi(qe)]=!0)}else break}}this.vertexSegments_=le;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},l.prototype.insertVertex_=function(o,c){for(var i=o.segment,u=o.feature,P=o.geometry,D=o.depth,F=o.index,U;c.length<P.getStride();)c.push(0);switch(P.getType()){case Ie.MULTI_LINE_STRING:U=P.getCoordinates(),U[D[0]].splice(F+1,0,c);break;case Ie.POLYGON:U=P.getCoordinates(),U[D[0]].splice(F+1,0,c);break;case Ie.MULTI_POLYGON:U=P.getCoordinates(),U[D[1]][D[0]].splice(F+1,0,c);break;case Ie.LINE_STRING:U=P.getCoordinates(),U.splice(F+1,0,c);break;default:return}this.setGeometryCoordinates_(P,U);var N=this.rBush_;N.remove(o),this.updateSegmentIndices_(P,F,D,1);var at={segment:[i[0],c],feature:u,geometry:P,depth:D,index:F};N.insert(Cu(at.segment),at),this.dragSegments_.push([at,1]);var yt={segment:[c,i[1]],feature:u,geometry:P,depth:D,index:F+1};N.insert(Cu(yt.segment),yt),this.dragSegments_.push([yt,0]),this.ignoreNextSingleClick_=!0},l.prototype.removePoint=function(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=Xo.POINTERDRAG){var o=this.lastPointerEvent_;this.willModifyFeatures_(o,this.dragSegments_);var c=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new d_(f_.MODIFYEND,this.featuresBeingModified_,o)),this.featuresBeingModified_=null,c}return!1},l.prototype.removeVertex_=function(){var o=this.dragSegments_,c={},i=!1,u,P,D,F,U,N,at,yt,Tt,Lt,Vt;for(U=o.length-1;U>=0;--U)D=o[U],Lt=D[0],Vt=wi(Lt.feature),Lt.depth&&(Vt+="-"+Lt.depth.join("-")),Vt in c||(c[Vt]={}),D[1]===0?(c[Vt].right=Lt,c[Vt].index=Lt.index):D[1]==1&&(c[Vt].left=Lt,c[Vt].index=Lt.index+1);for(Vt in c){switch(Tt=c[Vt].right,at=c[Vt].left,N=c[Vt].index,yt=N-1,at!==void 0?Lt=at:Lt=Tt,yt<0&&(yt=0),F=Lt.geometry,P=F.getCoordinates(),u=P,i=!1,F.getType()){case Ie.MULTI_LINE_STRING:P[Lt.depth[0]].length>2&&(P[Lt.depth[0]].splice(N,1),i=!0);break;case Ie.LINE_STRING:P.length>2&&(P.splice(N,1),i=!0);break;case Ie.MULTI_POLYGON:u=u[Lt.depth[1]];case Ie.POLYGON:u=u[Lt.depth[0]],u.length>4&&(N==u.length-1&&(N=0),u.splice(N,1),i=!0,N===0&&(u.pop(),u.push(u[0]),yt=u.length-1));break;default:}if(i){this.setGeometryCoordinates_(F,P);var wt=[];if(at!==void 0&&(this.rBush_.remove(at),wt.push(at.segment[0])),Tt!==void 0&&(this.rBush_.remove(Tt),wt.push(Tt.segment[1])),at!==void 0&&Tt!==void 0){var kt={depth:Lt.depth,feature:Lt.feature,geometry:Lt.geometry,index:yt,segment:wt};this.rBush_.insert(Cu(kt.segment),kt)}this.updateSegmentIndices_(F,N,Lt.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),o.length=0}}return i},l.prototype.setGeometryCoordinates_=function(o,c){this.changingFeature_=!0,o.setCoordinates(c),this.changingFeature_=!1},l.prototype.updateSegmentIndices_=function(o,c,i,u){this.rBush_.forEachInExtent(o.getExtent(),function(P){P.geometry===o&&(i===void 0||P.depth===void 0||ls(P.depth,i))&&P.index>c&&(P.index+=u)})},l}(_0);function V2(v,l){return v.index-l.index}function P0(v,l,o){var c=l.geometry;if(c.getType()===Ie.CIRCLE){var i=c;if(l.index===_d){var u=uh();u&&(i=i.clone().transform(u,o));var P=Wp(i.getCenter(),Xl(v,o)),D=Math.sqrt(P)-i.getRadius();return D*D}}var F=Xl(v,o);return af[0]=Xl(l.segment[0],o),af[1]=Xl(l.segment[1],o),Xv(F,af)}function M0(v,l,o){var c=l.geometry;if(c.getType()===Ie.CIRCLE&&l.index===_d){var i=c,u=uh();return u&&(i=i.clone().transform(u,o)),by(i.getClosestPoint(Xl(v,o)),o)}var P=Xl(v,o);return af[0]=Xl(l.segment[0],o),af[1]=Xl(l.segment[1],o),by(yy(P,af),o)}function G2(){var v=Ux();return function(l,o){return v[Ie.POINT]}}var m_=N2;var j2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),q2=function(v){j2(l,v);function l(o){var c=v.call(this)||this;return c.geometries_=o||null,c.changeEventsKeys_=[],c.listenGeometriesChange_(),c}return l.prototype.unlistenGeometriesChange_=function(){this.changeEventsKeys_.forEach(To),this.changeEventsKeys_.length=0},l.prototype.listenGeometriesChange_=function(){if(!!this.geometries_)for(var o=0,c=this.geometries_.length;o<c;++o)this.changeEventsKeys_.push(eo(this.geometries_[o],Vi.CHANGE,this.changed,this))},l.prototype.clone=function(){var o=new l(null);return o.setGeometries(this.geometries_),o.applyProperties(this),o},l.prototype.closestPointXY=function(o,c,i,u){if(u<cs(this.getExtent(),o,c))return u;for(var P=this.geometries_,D=0,F=P.length;D<F;++D)u=P[D].closestPointXY(o,c,i,u);return u},l.prototype.containsXY=function(o,c){for(var i=this.geometries_,u=0,P=i.length;u<P;++u)if(i[u].containsXY(o,c))return!0;return!1},l.prototype.computeExtent=function(o){Zp(o);for(var c=this.geometries_,i=0,u=c.length;i<u;++i)Uv(o,c[i].getExtent());return o},l.prototype.getGeometries=function(){return k0(this.geometries_)},l.prototype.getGeometriesArray=function(){return this.geometries_},l.prototype.getGeometriesArrayRecursive=function(){for(var o=[],c=this.geometries_,i=0,u=c.length;i<u;++i)c[i].getType()===this.getType()?o=o.concat(c[i].getGeometriesArrayRecursive()):o.push(c[i]);return o},l.prototype.getSimplifiedGeometry=function(o){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),o<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&o<this.simplifiedGeometryMaxMinSquaredTolerance)return this;for(var c=[],i=this.geometries_,u=!1,P=0,D=i.length;P<D;++P){var F=i[P],U=F.getSimplifiedGeometry(o);c.push(U),U!==F&&(u=!0)}if(u){var N=new l(null);return N.setGeometriesArray(c),N}else return this.simplifiedGeometryMaxMinSquaredTolerance=o,this},l.prototype.getType=function(){return Ie.GEOMETRY_COLLECTION},l.prototype.intersectsExtent=function(o){for(var c=this.geometries_,i=0,u=c.length;i<u;++i)if(c[i].intersectsExtent(o))return!0;return!1},l.prototype.isEmpty=function(){return this.geometries_.length===0},l.prototype.rotate=function(o,c){for(var i=this.geometries_,u=0,P=i.length;u<P;++u)i[u].rotate(o,c);this.changed()},l.prototype.scale=function(o,c,i){var u=i;u||(u=Hh(this.getExtent()));for(var P=this.geometries_,D=0,F=P.length;D<F;++D)P[D].scale(o,c,u);this.changed()},l.prototype.setGeometries=function(o){this.setGeometriesArray(k0(o))},l.prototype.setGeometriesArray=function(o){this.unlistenGeometriesChange_(),this.geometries_=o,this.listenGeometriesChange_(),this.changed()},l.prototype.applyTransform=function(o){for(var c=this.geometries_,i=0,u=c.length;i<u;++i)c[i].applyTransform(o);this.changed()},l.prototype.translate=function(o,c){for(var i=this.geometries_,u=0,P=i.length;u<P;++u)i[u].translate(o,c);this.changed()},l.prototype.disposeInternal=function(){this.unlistenGeometriesChange_(),v.prototype.disposeInternal.call(this)},l}(Lm);function k0(v){for(var l=[],o=0,c=v.length;o<c;++o)l.push(v[o].clone());return l}var z0=q2;var Z2=function(){function v(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return v.prototype.getReadOptions=function(l,o){var c;if(o){var i=o.dataProjection?ta(o.dataProjection):this.readProjection(l);o.extent&&i&&i.getUnits()===dc.TILE_PIXELS&&(i=ta(i),i.setWorldExtent(o.extent)),c={dataProjection:i,featureProjection:o.featureProjection}}return this.adaptOptions(c)},v.prototype.adaptOptions=function(l){return _a({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},l)},v.prototype.getType=function(){return Fr()},v.prototype.readFeature=function(l,o){return Fr()},v.prototype.readFeatures=function(l,o){return Fr()},v.prototype.readGeometry=function(l,o){return Fr()},v.prototype.readProjection=function(l){return Fr()},v.prototype.writeFeature=function(l,o){return Fr()},v.prototype.writeFeatures=function(l,o){return Fr()},v.prototype.writeGeometry=function(l,o){return Fr()},v}(),R0=Z2;function g_(v,l,o){var c=o?ta(o.featureProjection):null,i=o?ta(o.dataProjection):null,u;if(c&&i&&!Yv(c,i)?u=(l?v.clone():v).transform(l?c:i,l?i:c):u=v,l&&o&&o.decimals!==void 0){var P=Math.pow(10,o.decimals),D=function(F){for(var U=0,N=F.length;U<N;++U)F[U]=Math.round(F[U]*P)/P;return F};u===v&&(u=v.clone()),u.applyTransform(D)}return u}var X2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),W2=function(v){X2(l,v);function l(){return v.call(this)||this}return l.prototype.getType=function(){return vh.JSON},l.prototype.readFeature=function(o,c){return this.readFeatureFromObject(qm(o),this.getReadOptions(o,c))},l.prototype.readFeatures=function(o,c){return this.readFeaturesFromObject(qm(o),this.getReadOptions(o,c))},l.prototype.readFeatureFromObject=function(o,c){return Fr()},l.prototype.readFeaturesFromObject=function(o,c){return Fr()},l.prototype.readGeometry=function(o,c){return this.readGeometryFromObject(qm(o),this.getReadOptions(o,c))},l.prototype.readGeometryFromObject=function(o,c){return Fr()},l.prototype.readProjection=function(o){return this.readProjectionFromObject(qm(o))},l.prototype.readProjectionFromObject=function(o){return Fr()},l.prototype.writeFeature=function(o,c){return JSON.stringify(this.writeFeatureObject(o,c))},l.prototype.writeFeatureObject=function(o,c){return Fr()},l.prototype.writeFeatures=function(o,c){return JSON.stringify(this.writeFeaturesObject(o,c))},l.prototype.writeFeaturesObject=function(o,c){return Fr()},l.prototype.writeGeometry=function(o,c){return JSON.stringify(this.writeGeometryObject(o,c))},l.prototype.writeGeometryObject=function(o,c){return Fr()},l}(R0);function qm(v){if(typeof v=="string"){var l=JSON.parse(v);return l||null}else return v!==null?v:null}var D0=W2;var $2=function(){var v=function(l,o){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,i){c.__proto__=i}||function(c,i){for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(c[u]=i[u])},v(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");v(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),K2=function(v){$2(l,v);function l(o){var c=this,i=o||{};return c=v.call(this)||this,c.dataProjection=ta(i.dataProjection?i.dataProjection:"EPSG:4326"),i.featureProjection&&(c.defaultFeatureProjection=ta(i.featureProjection)),c.geometryName_=i.geometryName,c.extractGeometryName_=i.extractGeometryName,c.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"],c}return l.prototype.readFeatureFromObject=function(o,c){var i=null;o.type==="Feature"?i=o:i={type:"Feature",geometry:o,properties:null};var u=y_(i.geometry,c),P=new gc;return this.geometryName_?P.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in i!==void 0&&P.setGeometryName(i.geometry_name),P.setGeometry(u),"id"in i&&P.setId(i.id),i.properties&&P.setProperties(i.properties,!0),P},l.prototype.readFeaturesFromObject=function(o,c){var i=o,u=null;if(i.type==="FeatureCollection"){var P=o;u=[];for(var D=P.features,F=0,U=D.length;F<U;++F)u.push(this.readFeatureFromObject(D[F],c))}else u=[this.readFeatureFromObject(o,c)];return u},l.prototype.readGeometryFromObject=function(o,c){return y_(o,c)},l.prototype.readProjectionFromObject=function(o){var c=o.crs,i;return c?c.type=="name"?i=ta(c.properties.name):c.type==="EPSG"?i=ta("EPSG:"+c.properties.code):fn(!1,36):i=this.dataProjection,i},l.prototype.writeFeatureObject=function(o,c){c=this.adaptOptions(c);var i={type:"Feature",geometry:null,properties:null},u=o.getId();if(u!==void 0&&(i.id=u),!o.hasProperties())return i;var P=o.getProperties(),D=o.getGeometry();return D&&(i.geometry=__(D,c),delete P[o.getGeometryName()]),Vl(P)||(i.properties=P),i},l.prototype.writeFeaturesObject=function(o,c){c=this.adaptOptions(c);for(var i=[],u=0,P=o.length;u<P;++u)i.push(this.writeFeatureObject(o[u],c));return{type:"FeatureCollection",features:i}},l.prototype.writeGeometryObject=function(o,c){return __(o,this.adaptOptions(c))},l}(D0);function y_(v,l){if(!v)return null;var o;switch(v.type){case Ie.POINT:{o=H2(v);break}case Ie.LINE_STRING:{o=J2(v);break}case Ie.POLYGON:{o=rE(v);break}case Ie.MULTI_POINT:{o=tE(v);break}case Ie.MULTI_LINE_STRING:{o=Q2(v);break}case Ie.MULTI_POLYGON:{o=eE(v);break}case Ie.GEOMETRY_COLLECTION:{o=Y2(v);break}default:throw new Error("Unsupported GeoJSON type: "+v.type)}return g_(o,!1,l)}function Y2(v,l){var o=v.geometries.map(function(c){return y_(c,l)});return new z0(o)}function H2(v){return new ea(v.coordinates)}function J2(v){return new yc(v.coordinates)}function Q2(v){return new S0(v.coordinates)}function tE(v){return new jm(v.coordinates)}function eE(v){return new I0(v.coordinates)}function rE(v){return new cd(v.coordinates)}function __(v,l){v=g_(v,!0,l);var o=v.getType(),c;switch(o){case Ie.POINT:{c=lE(v,l);break}case Ie.LINE_STRING:{c=nE(v,l);break}case Ie.POLYGON:{c=uE(v,l);break}case Ie.MULTI_POINT:{c=aE(v,l);break}case Ie.MULTI_LINE_STRING:{c=oE(v,l);break}case Ie.MULTI_POLYGON:{c=sE(v,l);break}case Ie.GEOMETRY_COLLECTION:{c=iE(v,l);break}case Ie.CIRCLE:{c={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+o)}return c}function iE(v,l){var o=v.getGeometriesArray().map(function(c){var i=_a({},l);return delete i.featureProjection,__(c,i)});return{type:"GeometryCollection",geometries:o}}function nE(v,l){return{type:"LineString",coordinates:v.getCoordinates()}}function oE(v,l){return{type:"MultiLineString",coordinates:v.getCoordinates()}}function aE(v,l){return{type:"MultiPoint",coordinates:v.getCoordinates()}}function sE(v,l){var o;return l&&(o=l.rightHanded),{type:"MultiPolygon",coordinates:v.getCoordinates(o)}}function lE(v,l){return{type:"Point",coordinates:v.getCoordinates()}}function uE(v,l){var o;return l&&(o=l.rightHanded),{type:"Polygon",coordinates:v.getCoordinates(o)}}var al=K2;var Zm,cE=new Uint8Array(16);function v_(){if(!Zm&&(Zm=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Zm))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Zm(cE)}var O0=/^(?:[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 hE(v){return typeof v=="string"&&O0.test(v)}var F0=hE;var ia=[];for(Xm=0;Xm<256;++Xm)ia.push((Xm+256).toString(16).substr(1));var Xm;function pE(v){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=(ia[v[l+0]]+ia[v[l+1]]+ia[v[l+2]]+ia[v[l+3]]+"-"+ia[v[l+4]]+ia[v[l+5]]+"-"+ia[v[l+6]]+ia[v[l+7]]+"-"+ia[v[l+8]]+ia[v[l+9]]+"-"+ia[v[l+10]]+ia[v[l+11]]+ia[v[l+12]]+ia[v[l+13]]+ia[v[l+14]]+ia[v[l+15]]).toLowerCase();if(!F0(o))throw TypeError("Stringified UUID is invalid");return o}var B0=pE;function fE(v,l,o){v=v||{};var c=v.random||(v.rng||v_)();if(c[6]=c[6]&15|64,c[8]=c[8]&63|128,l){o=o||0;for(var i=0;i<16;++i)l[o+i]=c[i];return l}return B0(c)}var x_=fE;var ap=class extends Io{constructor(l={}){super(),this.defineProperties(l),this.setProperties(l.properties),this.visible=l.visible===void 0?!0:!!l.visible,this.group=l.group,this.copyrights=l.copyrights,this.children=l.children,this.on("change:visible:group",o=>{this.group===o.target.group&&this!==o.target&&this.visible?this.visible=!1:this.children&&this.children.forEach(c=>c.dispatchEvent(o))})}defineProperties(l){let{name:o,key:c,properties:i,hitTolerance:u}={...l},P=x_();Object.defineProperties(this,{name:{value:o},key:{value:c||P},group:{get:()=>this.get("group"),set:D=>{this.set("group",D)}},copyrights:{get:()=>this.get("copyrights"),set:D=>{let F=D&&!Array.isArray(D)?[D]:D;this.set("copyrights",F||[])}},options:{value:l},map:{writable:!0},visible:{get:()=>this.get("visible"),set:D=>{if(D!==this.visible)if(this.set("visible",D),this.visible){if(this.parent&&!this.parent.visible&&(this.parent.visible=!0),this.children&&this.children.find(F=>F.group)){let F=this.children.find(U=>!!U.group);F.visible=!0}if(this.parent&&this.group){let F=this.parent;for(;F.parent;)F=F.parent;F.dispatchEvent({type:"change:visible:group",target:this})}}else this.visible||this.parent&&this.parent.visible&&!this.parent.children.find(F=>F.visible)&&(this.parent.visible=!1)}},disabled:{get:()=>this.get("disabled"),set:D=>{this.set("disabled",D)}},parent:{value:null,writable:!0},children:{get:()=>this.get("children")||[],set:D=>{(this.children||[]).forEach(F=>{F.parent=null}),Array.isArray(D)&&D.forEach(F=>{F.parent=this}),this.set("children",D||[])}},hitTolerance:{value:u||5,writable:!0},properties:{value:{...i||{}}}})}attachToMap(l){this.detachFromMap(),this.map=l,this.children&&this.children.forEach(o=>{o.attachToMap(l)})}detachFromMap(){this.map=null}getFeatureInfoAtCoordinate(l,o){return console.error("getFeatureInfoAtCoordinate must be implemented by inheriting layers",this.key),Promise.resolve({layer:this,features:[],coordinate:l})}flat(){return Xf(this)}};var dE=v=>class extends v{constructor(l={}){super(l);let{userInteractions:o=!0,userClickInteractions:c=!0,userHoverInteractions:i=!0,defaultUserInteractions:u=!0}=l;this.userInteractions=o,this.userClickInteractions=c,this.userHoverInteractions=i,this.defaultUserInteractions=u,this.userClickCallbacks=[],this.userHoverCallbacks=[],this.userClickEventsKeys=[],this.userHoverEventsKeys=[],this.onUserClickCallback=this.onUserClickCallback.bind(this),this.onUserMoveCallback=this.onUserMoveCallback.bind(this);let{onClick:P,onHover:D}=l;this.userInteractions&&this.userClickInteractions&&P&&this.onClick(P),this.userInteractions&&this.userHoverInteractions&&D&&this.onHover(D)}attachToMap(l,o){super.attachToMap(l,o),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(l=>{this.userClickEventsKeys.push(this.on("user:click",({target:{features:o,layer:c,coordinate:i}})=>{l(o,c,i)}))}),this.userHoverCallbacks.forEach(l=>{this.userHoverEventsKeys.push(this.on("user:hover",({target:{features:o,layer:c,coordinate:i,event:u}})=>{l(o,c,i,u)}))})}unlistenEvents(){Na(this.userClickEventsKeys),Na(this.userHoverEventsKeys),this.userClickEventsKeys=[],this.userHoverEventsKeys=[]}onClick(l){this.userClickCallbacks.push(l),this.activateUserInteractions(),this.map&&this.listenEvents()}onHover(l){this.userHoverCallbacks.push(l),this.activateUserInteractions(),this.map&&this.listenEvents()}onUserClickCallback(l){let o=l.coordinate||ro(l.lngLat.toArray()),c={features:[],layer:this,coordinate:o,event:l};return this.getFeatureInfoAtCoordinate(o).then(i=>(this.dispatchEvent({type:"user:click",target:i}),i)).catch(()=>c)}onUserMoveCallback(l){let o=l.coordinate||ro(l.lngLat.toArray()),c={features:[],layer:this,coordinate:o,event:l};return this.getFeatureInfoAtCoordinate(o).then(i=>(this.dispatchEvent({type:"user:hover",target:i}),i)).catch(()=>c)}activateUserInteractions(){}deactivateUserInteractions(){}},Wm=dE;var vd=class extends Wm(ap){constructor(l){super(l),this.olLayer&&this.olLayer.setVisible(this.visible)}defineProperties(l){super.defineProperties(l),Object.defineProperties(this,{olLayer:{value:l.olLayer,writable:!0},olListenersKeys:{value:[]}})}attachToMap(l){if(super.attachToMap(l),!!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",o=>{o.element===this.olLayer&&this.detachFromMap()})),this.toggleVisibleListeners(),this.olListenersKeys.push(this.on("change:visible",this.toggleVisibleListeners)),this.copyrights&&this.olLayer)){let o=this.copyrights||[];this.olLayer.getLayers?this.olLayer.getLayers().getArray().forEach(c=>{c.getSource()?.setAttributions(o)}):this.olLayer.getSource&&this.olLayer.getSource()?.setAttributions(o)}}detachFromMap(){this.deactivateUserInteractions(),Na(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(){Na([this.pointerMoveListenerKey,this.singleClickListenerKey])}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}clone(l){return new vd({...this.options,...l})}},xa=vd;var U0=new ol({radius:6,fill:new Ds({color:[255,0,0,1]}),stroke:new ra({color:[0,0,0,1],width:1})}),mE=new Wl({stroke:new ra({color:[0,0,0,1],width:5})}),gE=new Wl({image:U0,stroke:new ra({color:[255,0,0,1],width:3})}),yE=new Wl({image:U0,stroke:new ra({color:[255,0,0,1],width:3,lineDash:[1,10]})}),_E=(v,l)=>{let o=v.get("minResolution"),c=v.get("maxResolution"),i=l<=o&&l>c;return o&&c&&!i?null:v.get("mot")!=="foot"?[mE,gE]:[yE]},xd=class extends xa{constructor(l={}){super(l),this.olLayer=l.olLayer||new np({source:new op,style:l.style||_E})}clone(l){return new xd({...this.options,...l})}},$m=xd;var vE=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,N0=/^([\d.]+),([\d.]+)$/,V0=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,Km="stop-fetch",G0=v=>{let l=[];return v.forEach(o=>{l.push(...o.getGeometry().getCoordinates())}),l},bd=class extends ch{constructor(l={}){super(l),Object.defineProperties(this,{mot:{get:()=>this.get("mot"),set:o=>{o&&(this.set("mot",o),this.viaPoints&&this.drawRoute())}},loading:{get:()=>this.get("loading"),set:o=>{this.set("loading",o)}},modify:{get:()=>this.get("modify"),set:o=>{this.set("modify",o)}}}),this.loading=!1,this.graphs=l.graphs||[["osm",0,99]],this.mot=l.mot||"bus",this.modify=l.modify!==!1,this.routingApiParams=l.routingApiParams||{},this.useRawViaPoints=l.useRawViaPoints||!1,this.snapToClosestStation=l.snapToClosestStation||!1,this.cacheStationData={},this.abortControllers=[],this.apiKey=l.apiKey,this.stopsApiKey=l.stopsApiKey||this.apiKey,this.segments=[],this.stopsApiUrl=l.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new jf({...l}),this.routingLayer=l.routingLayer||new $m({name:"routing-layer",style:l.style}),this.onRouteError=l.onRouteError||(o=>{this.dispatchEvent({type:"change:route",target:this}),this.reset(),console.error(o)}),this.viaPoints=[],this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.apiChangeListener=()=>this.drawRoute(),this.createModifyInteraction()}static getGraphsResolutions(l,o){let c=o.getView();return l.map(([,i,u])=>[c.getResolutionForZoom(i),c.getResolutionForZoom(u||i+1)])}addViaPoint(l,o=-1,c=0){this.viaPoints.splice(o===-1?this.viaPoints.length:o,c,l),this.drawRoute(),this.dispatchEvent({type:"change:route",target:this})}removeViaPoint(l=this.viaPoints.length-1){this.viaPoints.length&&this.viaPoints[l]&&this.viaPoints.splice(l,1),this.drawRoute(),this.dispatchEvent({type:"change:route",target:this})}setViaPoints(l){this.viaPoints=[...l],this.drawRoute(),this.dispatchEvent({type:"change:route",target:this})}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer.olLayer.getSource().clear(),this.dispatchEvent({type:"change:route",target:this})}abortRequests(){this.graphs.forEach(([l])=>{this.abortControllers[l]&&this.abortControllers[l].abort(),this.abortControllers[l]=new AbortController}),this.abortControllers[Km]?.abort(),this.abortControllers[Km]=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[Km]);let l=this.viaPoints.map(o=>{if(Array.isArray(o)){let c=this.map.getView().getProjection(),[i,u]=lh(o,c);return this.snapToClosestStation?[`@${u}`,i]:[u,i]}return this.useRawViaPoints?o:`!${o}`});return this.loading=!0,this.routingLayer.olLayer.getSource().clear(),this.viaPoints.forEach((o,c)=>this.drawViaPoint(o,c,this.abortControllers[Km])),Promise.all(this.graphs.map(([o],c)=>{let{signal:i}=this.abortControllers[o];return this.api.route({graph:o,via:`${l.join("|")}`,mot:`${this.mot}`,"resolve-hops":!1,elevation:!1,"coord-radius":100,"coord-punish":1e3,...this.routingApiParams},{signal:i}).then(u=>{if(this.segments=this.format.readFeatures(u),this.mot==="foot"){let F=this.segments.reduce((U,N)=>{let at=N.get("trg");return U.find(yt=>yt[0]===at[0]&&yt[1]===at[1])?U:[...U,at]},[]);this.segments=F.map(U=>{let N=this.segments.filter(yt=>{let Tt=yt.get("trg");return Tt[0]===U[0]&&Tt[1]===U[1]}),at=G0(N);return new gc({geometry:new yc(at)})})}let P=G0(this.segments),D=new gc({geometry:new yc(P)});D.set("graph",o),D.set("mot",this.mot),D.set("minResolution",this.graphsResolutions[c][0]),D.set("maxResolution",this.graphsResolutions[c][1]),this.routingLayer.olLayer.getSource().addFeature(D),this.loading=!1}).catch(u=>{u.name!=="AbortError"&&(this.segments=[],this.dispatchEvent({type:"error",target:this}),this.onRouteError(u,this),this.loading=!1)})}))}drawViaPoint(l,o,c){let i=new gc;if(i.set("viaPointIdx",o),Array.isArray(l))return i.setGeometry(new ea(l)),this.routingLayer.olLayer.getSource().addFeature(i),Promise.resolve(i);if(!this.useRawViaPoints||V0.test(l)){let U,N;return this.useRawViaPoints?[,U,,N]=V0.exec(l):[U,N]=l.split("$"),fetch(`${this.stopsApiUrl}lookup/${U}?key=${this.stopsApiKey}`,{signal:c.signal}).then(at=>at.json()).then(at=>{let{coordinates:yt}=at.features[0].geometry;return this.cacheStationData[l]=ro(yt),i.set("viaPointTrack",N),i.setGeometry(new ea(ro(yt))),this.routingLayer.olLayer.getSource().addFeature(i),i}).catch(at=>{at.name!=="AbortError"&&(this.dispatchEvent({type:"error",target:this}),this.onRouteError(at,this),this.loading=!1)})}if(this.useRawViaPoints&&N0.test(l)){let[U,N]=N0.exec(l),at=ro([parseFloat(N),parseFloat(U)],this.map.getView().getProjection());return i.setGeometry(new ea(at)),this.routingLayer.olLayer.getSource().addFeature(i),Promise.resolve(i)}let[,u,,P,D,,F]=vE.exec(l);if(D&&P){let U=ro([parseFloat(D),parseFloat(P)],this.map.getView().getProjection());return i.set("viaPointTrack",F),i.setGeometry(new ea(U)),this.routingLayer.olLayer.getSource().addFeature(i),Promise.resolve(i)}return u?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${u}&limit=1`,{signal:c.signal}).then(U=>U.json()).then(U=>{let{coordinates:N}=U.features[0].geometry;return this.cacheStationData[l]=ro(N),i.set("viaPointTrack",F),i.setGeometry(new ea(ro(N))),this.routingLayer.olLayer.getSource().addFeature(i),i}).catch(U=>(this.dispatchEvent({type:"error",target:this}),this.onRouteError(U,this),this.loading=!1,null)):Promise.resolve(null)}onMapClick(l){let c=l.target.getFeaturesAtPixel(l.pixel).find(i=>i.getGeometry()?.getType()===Ie.POINT&&i.get("viaPointIdx")!==void 0);if(c){this.removeViaPoint(c.get("viaPointIdx"));return}this.addViaPoint(l.coordinate)}onModifyStart(l){let o=-1,c=l.features.getArray().find(u=>u.getGeometry()?.getType()===Ie.LINE_STRING);if(c){let u=rl(new ea(c.getGeometry().getClosestPoint(l.mapBrowserEvent.coordinate)).getExtent(),.001);o=this.segments.findIndex(P=>P.getGeometry().intersectsExtent(u))}let i=(l.features.getArray().filter(u=>u.getGeometry()?.getType()===Ie.POINT)||[])[0];this.initialRouteDrag={viaPoint:i,oldRoute:c&&c.clone(),segmentIndex:o}}onModifyEnd(l){let o=l.mapBrowserEvent.coordinate,{oldRoute:c,viaPoint:i,segmentIndex:u}=this.initialRouteDrag;return i?this.addViaPoint(o,i.get("viaPointIdx"),1):c?u===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(o,u+1):this.addViaPoint(o,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 m_({source:this.routingLayer.olLayer.getSource(),pixelTolerance:4,hitDetection:this.routingLayer.olLayer,deleteCondition:l=>{let c=l.target.getFeaturesAtPixel(l.pixel,{hitTolerance:5}).find(i=>i.getGeometry()?.getType()===Ie.POINT&&i.get("index"));return b0(l)&&c?(this.removeViaPoint(c.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(){Na(this.onMapClickKey)}activate(){super.activate(),this.map?(this.format=new al({featureProjection:this.map.getView().getProjection()}),this.graphsResolutions=bd.getGraphsResolutions(this.graphs,this.map),this.map.removeInteraction(this.modifyInteraction),this.routingLayer.attachToMap(this.map),this.map.addInteraction(this.modifyInteraction),this.modifyInteraction.setActive(this.modify),this.addListeners()):(this.format=new al({featureProjection:"EPSG:3857"}),this.graphsResolutions=this.graphs)}deactivate(){this.map&&(this.routingLayer.detachFromMap(this.map),this.map.removeInteraction(this.modifyInteraction),this.removeListeners(),this.reset()),super.deactivate()}},j0=bd;var xE=v=>class extends v{constructor(l={}){super(l);let{apiParams:o,apiKey:c,url:i}=l;this.apiParams={limit:20,...o||{}},this.placeholder=l.placeholder||"Search for a stop...";let u={apiKey:c};i&&(u.url=i),this.api=new qf(u),this.abortController=new AbortController}render(l){let o=l?.features||[];!this.suggestionsElt||(this.suggestionsElt.style.display=o.length?"block":"none",this.suggestionsElt.innerHTML="",o.forEach(c=>{let{properties:i}=c,u=document.createElement("div");u.innerHTML=i.name,u.onclick=()=>{this.onSuggestionClick(c)},Object.assign(u.style,{padding:"5px 12px"}),this.suggestionsElt.appendChild(u)}))}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=l=>{this.abortController.abort(),this.abortController=new AbortController,this.search(l.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(l,o){return(l!==void 0||l!==null)&&(this.apiParams.q=l),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,o).then(c=>{this.render(c)}).catch(()=>{this.render()})}onSuggestionClick(l){}clear(){!this.suggestionsElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}},q0=xE;var b_=class extends q0(ch){onSuggestionClick({geometry:l}){let o=ro(l.coordinates);this.map.getView().setCenter(o)}},Z0=b_;var W0=Fp(X0());var bE=v=>class extends v{constructor(l={}){super(l),this.olLayer=new Qh({source:new nf({}),render:this.getOlLayerRender(this)}),this.styleUrl=l.url,this.apiKey=l.apiKey,this.apiKeyName=l.apiKeyName||"key",this.updateAttribution=this.updateAttribution.bind(this)}attachToMap(l){super.attachToMap(l),this.map&&(this.format=new al({featureProjection:this.map.getView().getProjection()}),this.loadMbMap())}detachFromMap(){this.mbMap&&(this.mbMap.off("idle",this.updateAttribution),this.mbMap.triggerRepaint=()=>{},this.mbMap.remove(),this.mbMap=null),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 l=document.createElement("div");l.style.position="absolute",l.style.width="100%",l.style.height="100%",!this.apiKey&&!this.styleUrl.includes(this.apiKeyName)&&console.error(`No apiKey defined for mapbox layer with style url to ${this.styleUrl}`);let o=this.getMapboxMapClass();this.mbMap=new o({style:$h(this.styleUrl,{[this.apiKeyName]:this.apiKey}).toString(),container:l,interactive:!1,trackResize:!1,attributionControl:!1,...this.options.mapOptions||{}}),this.mbMap.once("load",()=>{this.loaded=!0,this.dispatchEvent({type:"load",target:this})}),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(l){let o=fc(l.target)||[];this.copyrights?.toString()!==o.toString()&&(this.copyrights=o,this.olLayer.getSource()?.setAttributions(o))}getFeatureInfoAtCoordinate(l,o){if(!o||!this.format||!this.mbMap||!this.mbMap.isStyleLoaded())return Promise.resolve({coordinate:l,features:[],layer:this});let c=l&&this.mbMap.project(lh(l));if(this.hitTolerance){let{x:u,y:P}=c;c=[{x:u-this.hitTolerance,y:P-this.hitTolerance},{x:u+this.hitTolerance,y:P+this.hitTolerance}]}let i=this.mbMap.queryRenderedFeatures(c,o).map(u=>{let P=this.format.readFeature(u);return P&&P.set("mapboxFeature",u),P});return Promise.resolve({layer:this,features:i,coordinate:l})}},Ym=bE;var sp=class extends Ym(xa){attachToMap(l){super.attachToMap(l),!(!this.map||this.mbMap)&&this.olListenersKeys.push(this.map.on("change:size",()=>{try{this.mbMap&&this.mbMap.resize()}catch(o){console.warn(o)}}))}loadMbMap(){let[l,o]=this.map.getView().getCenter();if((!l||!o)&&(l=0,o=0),this.renderState={center:[l,o],zoom:null,rotation:null,visible:null,opacity:null,size:[0,0]},super.loadMbMap(),!this.mbMap)return;this.mbMap.once("load",()=>{this.mbMap.resize(),this.copyrights=fc(this.mbMap)||[],this.olLayer.getSource()?.setAttributions(this.copyrights)});let c=this.mbMap.getCanvas();c&&(this.options.tabIndex?c.setAttribute("tabindex",this.options.tabIndex):c.removeAttribute("tabindex"))}getOlLayerRender(){return Yp(this)}getMapboxMapClass(){return W0.Map}clone(l){return new sp({...this.options,...l})}};var Y0=Fp(K0());var lp=class extends Ym(xa){getOlLayerRender(){return Kp(this)}getMapboxMapClass(){return Y0.Map}clone(l){return new lp({...this.options,...l})}};var wd=class extends xa{constructor(l={}){if(super(l),this.mapboxLayer=l.mapboxLayer,this.disabled=!1,this.styleLayersFilter=l.styleLayersFilter,this.beforeId=l.beforeId,this.featureInfoFilter=l.featureInfoFilter||(o=>o),this.queryRenderedLayersFilter=l.queryRenderedLayersFilter,this.highlightedFeatures=[],this.selectedFeatures=[],this.styleLayers=(l.styleLayer?[l.styleLayer]:l.styleLayers)||[],this.addStyleLayers=this.addStyleLayers.bind(this),this.onLoad=this.onLoad.bind(this),l.filters&&(this.addDynamicFilters=()=>{this.setFilter(typeof l.filters=="function"?l.filters(this):l.filters)}),!this.styleLayersFilter&&this.styleLayers){let o=this.styleLayers.map(c=>c.id);this.styleLayersFilter=c=>o.includes(c.id)}}attachToMap(l){if(this.mapboxLayer.map||this.mapboxLayer.attachToMap(l),super.attachToMap(l),!this.map)return;let{mbMap:o}=this.mapboxLayer;if(!o){this.olListenersKeys.push(this.map.on("change:target",()=>{this.attachToMap(l)}));return}this.mapboxLayer.loaded||o.isStyleLoaded()||o.loaded()?this.onLoad():o.once("load",this.onLoad),this.olListenersKeys.push(this.on("change:visible",c=>{this.applyLayoutVisibility(c)})),this.olListenersKeys.push(this.mapboxLayer.on("load",()=>{this.onLoad()}))}detachFromMap(l){let{mbMap:o}=this.mapboxLayer;o&&(o.off("load",this.onLoad),this.removeStyleLayers()),super.detachFromMap(l)}addStyleLayers(){let{mbMap:l}=this.mapboxLayer;!l||(this.styleLayers.forEach(o=>{let{id:c,source:i}=o;l.getSource(i)&&!l.getLayer(c)&&l.addLayer(o,this.beforeId)}),this.applyLayoutVisibility())}removeStyleLayers(){let{mbMap:l}=this.mapboxLayer;!l||this.styleLayers.forEach(o=>{l.getLayer(o.id)&&l.removeLayer(o.id)})}onLoad(){this.addStyleLayers(),this.addDynamicFilters&&this.addDynamicFilters();let{mbMap:l}=this.mapboxLayer,o=l.getStyle();if(o&&this.styleLayersFilter){let c=o.layers.filter(this.styleLayersFilter);this.disabled=!c.length}}getFeatureInfoAtCoordinate(l){let{mbMap:o}=this.mapboxLayer;if(!o||!o.isStyleLoaded())return Promise.resolve({coordinate:l,features:[],layer:this});let c=this.styleLayers||[];return this.styleLayersFilter&&(c=o.getStyle().layers.filter(this.styleLayersFilter)),this.queryRenderedLayersFilter&&(c=o.getStyle().layers.filter(this.queryRenderedLayersFilter)),this.mapboxLayer.getFeatureInfoAtCoordinate(l,{layers:c.map(i=>i&&i.id),validate:!1}).then(i=>{let u=i.features.filter(P=>this.featureInfoFilter(P,this.map.getView().getResolution()));return this.highlight(u),{...i,features:u,layer:this}})}setFilter(l){let{mbMap:o}=this.mapboxLayer;!o||this.styleLayers.forEach(({id:c})=>{o.getLayer(c)&&o.setFilter(c,l)})}setHoverState(l,o){let{mbMap:c}=this.mapboxLayer;!l||!c||l.forEach(i=>{let{source:u,sourceLayer:P}=i.get("mapboxFeature")||{};if(!u&&!P||!i.getId()){i.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.",i.getId(),i.getProperties());return}c.setFeatureState({id:i.getId(),source:u,sourceLayer:P},{hover:o})})}select(l=[]){this.setHoverState(this.selectedFeatures,!1),this.selectedFeatures=l,this.setHoverState(this.selectedFeatures,!0)}highlight(l=[]){let o=this.highlightedFeatures.filter(c=>!this.selectedFeatures.map(i=>i.getId()).includes(c.getId()));this.setHoverState(o,!1),this.highlightedFeatures=l,this.setHoverState(this.highlightedFeatures,!0)}applyLayoutVisibility(l){let{visible:o}=this,{mbMap:c}=this.mapboxLayer,i=this.styleLayersFilter;if(!c)return;let u=c.getStyle();if(!!u&&i){let P=o?"visible":"none";for(let D=0;D<u.layers.length;D+=1){let F=u.layers[D];i(F)&&c.getLayer(F.id)&&c.setLayoutProperty(F.id,"visibility",P)}}}clone(l){return new wd({...this.options,...l})}},H0=wd;var P_=Fp(e1()),M_=Fp(a1());var rS=v=>class extends v{constructor(l={}){super({hitTolerance:10,...l}),this.debug=l.debug,this.mode=l.mode||Zo.TOPOGRAPHIC,this.api=l.api||new Zf(l),this.tenant=l.tenant||"",this.minZoomNonTrain=l.minZoomNonTrain||9,this.minZoomInterpolation=l.minZoomInterpolation||8,this.format=new al,this.generalizationLevelByZoom=l.generalizationLevelByZoom||[5,5,5,5,5,5,5,5,10,30,30,100,100,100],this.getGeneralizationLevelByZoom=o=>l.getGeneralizationLevelByZoom&&l.getGeneralizationLevelByZoom(o,this.generalizationLevelByZoom)||this.generalizationLevelByZoom[o],this.renderTimeIntervalByZoom=l.renderTimeIntervalByZoom||[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],this.getRenderTimeIntervalByZoom=o=>l.getRenderTimeIntervalByZoom&&l.getRenderTimeIntervalByZoom(o,this.renderTimeIntervalByZoom)||this.renderTimeIntervalByZoom[o],this.isUpdateBboxOnMoveEnd=l.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,M_.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,P_.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(l){let{style:o,speed:c,pixelRatio:i,hoverVehicleId:u,selectedVehicleId:P,filter:D,sort:F,time:U,live:N,canvas:at,styleOptions:yt}=l,Tt=c||1,Lt=U||new Date;super.defineProperties(l),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{value:at||document.createElement("canvas")},style:{value:o||Jh},styleOptions:{value:{...Hp,...yt||{}}},speed:{get:()=>Tt,set:Vt=>{Tt=Vt,this.start()}},filter:{value:D,writable:!0},sort:{value:F,writable:!0},live:{value:N===!1?N:!0,writable:!0},time:{get:()=>Lt,set:Vt=>{Lt=Vt&&Vt.getTime?Vt:new Date(Vt),this.renderTrajectories()}},trajectories:{value:{},writable:!0},hoverVehicleId:{value:u,writable:!0},selectedVehicleId:{value:P,writable:!0},pixelRatio:{value:i||(typeof window<"u"?window.devicePixelRatio:1),writable:!0},useRequestAnimationFrame:{value:l.useRequestAnimationFrame||!1,writable:!0},useThrottle:{value:l.useThrottle!==!1,writable:!0},useDebounce:{value:l.useDebounce||!1,writable:!0}})}attachToMap(l){super.attachToMap(l),this.visible&&this.start(),this.visibilityRef=this.on("change:visible",o=>{o.target.visible?this.start():this.stop()}),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),Na(this.visibilityRef),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,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,this.isUpdateBboxOnMoveEnd),this.isUpdateBboxOnMoveEnd&&this.setBbox()}startUpdateTime(){this.stopUpdateTime(),this.updateTimeDelay=this.getRefreshTimeInMs(),this.updateTimeInterval=setInterval(()=>{this.time=this.live?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)}renderTrajectoriesInternal(l,o){if(!this.map)return!1;let c=this.live?Date.now():this.time,i=Object.values(this.trajectories);return this.sort&&i.sort(this.sort),this.renderState=Wf(this.canvas,i,this.style,{...l,pixelRatio:this.pixelRatio,time:c},{noInterpolate:l.zoom<this.minZoomInterpolation?!0:o,hoverVehicleId:this.hoverVehicleId,selectedVehicleId:this.selectedVehicleId,...this.styleOptions}),!0}renderTrajectories(l,o){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=null),!o&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(l,o)}):!o&&this.useDebounce?this.debounceRenderTrajectories(l,o):!o&&this.useThrottle?this.throttleRenderTrajectories(l,o):this.renderTrajectoriesInternal(l,o)}setBbox(l,o){let c=Object.keys(this.trajectories);for(let u=c.length-1;u>=0;u-=1)this.purgeTrajectory(this.trajectories[c[u]],l,o);let i=[...l];this.isUpdateBboxOnMoveEnd&&(i.push(o),this.tenant&&i.push(`tenant=${this.tenant}`),this.generalizationLevel=this.getGeneralizationLevelByZoom(o),this.generalizationLevel&&i.push(`gen=${this.generalizationLevel}`)),this.api.bbox=i}setMode(l){this.mode!==l&&(this.mode=l,this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,this.isUpdateBboxOnMoveEnd))}getRefreshTimeInMs(l){let o=Math.round(l),c=this.getRenderTimeIntervalByZoom(o)||25,i=Math.max(25,c/this.speed),u=Math.min(i,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,M_.default)(this.renderTrajectoriesInternal,u,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,P_.default)(this.renderTrajectoriesInternal,u,{leading:!0,trailing:!0,maxWait:5e3})),this.api?.buffer){let[,P]=this.api.buffer;this.api.buffer=[u,P]}return i}getVehicle(l){return Object.values(this.trajectories).filter(l)}getFeatureInfoAtCoordinate(l,o={}){let{resolution:c,nb:i}=o,u=rl([...l,...l],this.hitTolerance*c),P=Object.values(this.trajectories);this.sort&&(P=P.sort(this.sort));let D=[];for(let F=0;F<P.length&&(P[F].properties.coordinate&&qp(u,P[F].properties.coordinate)&&D.push(P[F]),D.length!==i);F+=1);return Promise.resolve({layer:this,features:D.map(F=>this.format.readFeature(F)),coordinate:l})}getTrajectoryInfos(l){let o=[this.api.getStopSequence(l,this.mode),this.api.getFullTrajectory(l,this.mode,this.generalizationLevel)];return Promise.all(o).then(([c,i])=>({stopSequence:c,fullTrajectory:i}))}purgeTrajectory(l,o,c){let{type:i,bounds:u,train_id:P}=l.properties;return!Ao(o,u)||i!=="rail"&&c<(this.minZoomNonTrain||9)?(this.removeTrajectory(P),!0):!1}addTrajectory(l){this.filter&&!this.filter(l)||(this.trajectories[l.properties.train_id]=l,this.renderTrajectories())}removeTrajectory(l){delete this.trajectories[l]}onZoomEnd(l){this.startUpdateTime()}onDocumentVisibilityChange(){!this.visible||(document.hidden?this.stop():this.start())}onTrajectoryMessage(l){if(!l.content)return;let o=l.content,{geometry:c,properties:{train_id:i,time_since_update:u,raw_coordinates:P}}=o;u<0||this.purgeTrajectory(o)||(this.debug&&this.mode===Zo.TOPOGRAPHIC&&P?o.properties.olGeometry={type:"Point",coordinates:ro(P,this.map.getView().getProjection())}:o.properties.olGeometry=this.format.readGeometry(c),o.properties.timeOffset=Date.now()-l.timestamp,this.addTrajectory(o))}onDeleteTrajectoryMessage(l){!l.content||this.removeTrajectory(l.content)}onFeatureHover(l,o,c){let[i]=l,u=null;i&&(u=i.get("train_id")),this.hoverVehicleId!==u&&(this.hoverVehicleId=u,this.renderTrajectories(!0))}onFeatureClick(l,o,c){let[i]=l,u=null;i&&(u=i.get("train_id")),this.selectedVehicleId!==u&&(this.selectedVehicleId=u,this.selectedVehicle=i,this.renderTrajectories(!0))}},Jm=rS;var iS=new Wl({zIndex:2,image:new ol({radius:5,fill:new Ds({color:"#000000"})}),stroke:new ra({color:"#000000",width:6})}),nS=(v,l,o)=>{let c="#ffffff",i=v.get("type"),u=v.get("stroke");return u&&u[0]!=="#"&&(u=`#${u}`),c=u||o?.getBgColor(i),c=/#ffffff/i.test(c)?"#ff0000":c,[iS,new Wl({zIndex:3,image:new ol({radius:4,fill:new Ds({color:c})}),stroke:new ra({color:c,width:4})})]},Qm=nS;var oS=new Wl({zIndex:2,image:new ol({radius:5,fill:new Ds({color:"#000000"})}),stroke:new ra({color:"#000000",width:6})}),aS=new Wl({zIndex:3,image:new ol({radius:4,fill:new Ds({color:"#a0a0a0"})}),stroke:new ra({color:"#a0a0a0",width:4})}),sS=()=>[oS,aS],s1=sS;var lS=new al,Ed=class extends Jm(xa){constructor(l={}){super({...l}),this.olLayer=l.olLayer||new h_({layers:[new np({source:new op({features:[]}),style:(o,c)=>(l.fullTrajectoryStyle||Qm)(o,c,this.styleOptions)}),new Qh({source:new nf({}),render:o=>{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.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:c,resolution:i,rotation:u}=o.viewState,{center:P,resolution:D,rotation:F}=this.renderedViewState;if(D/i>=3)this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height);else{let U=this.map.getPixelFromCoordinate(P),N=this.map.getPixelFromCoordinate(c);this.transformContainer.style.transform=Iv(U[0]-N[0],U[1]-N[1],D/i,D/i,u-F,0,0)}}return this.container}})]}),this.vectorLayer=this.olLayer.getLayers().item(0),this.renderState={center:[0,0],zoom:null,rotation:0}}attachToMap(l){super.attachToMap(l),this.map&&this.olListenersKeys.push(this.map.on(["moveend","change:target"],o=>{let c=this.map.getView();if(c.getAnimating()||c.getInteracting())return;let i=c.getZoom();this.currentZoom!==i&&this.onZoomEnd(o),this.currentZoom=i,this.onMoveEnd(o)}))}detachFromMap(){super.detachFromMap(),this.container=null}hasFeatureInfoAtCoordinate(l){if(this.map&&this.canvas){let o=this.canvas.getContext("2d"),c=this.map.getPixelFromCoordinate(l);return!!o.getImageData(c[0]*this.pixelRatio,c[1]*this.pixelRatio,1,1).data[3]}return!1}renderTrajectories(l){let o=this.map.getView();super.renderTrajectories({size:this.map.getSize(),center:this.map.getView().getCenter(),extent:o.calculateExtent(),resolution:o.getResolution(),rotation:o.getRotation(),zoom:o.getZoom(),pixelRatio:this.pixelRatio},l)}renderTrajectoriesInternal(l,o){if(!this.map)return!1;let c=!1;return c=this.map.getView().getAnimating()||this.map.getView().getInteracting()?!1:super.renderTrajectoriesInternal(l,o),c&&(this.renderedViewState={...l},this.transformContainer&&(this.transformContainer.style.transform="")),c}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getView().getZoom())}getFeatureInfoAtCoordinate(l,o={}){let c=this.map.getView().getResolution();return super.getFeatureInfoAtCoordinate(l,{resolution:c,...o})}onMoveEnd(){this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.userClickInteractions&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}onZoomEnd(l){super.onZoomEnd(l)}onFeatureHover(l,o,c){super.onFeatureHover(l,o,c),this.map.getTargetElement().style.cursor=l.length?"pointer":"auto"}onFeatureClick(l,o,c){super.onFeatureClick(l,o,c),!l.length&&this.vectorLayer&&this.vectorLayer.getSource().clear(),this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}purgeTrajectory(l,o,c){return super.purgeTrajectory(l,o||this.map.getView().calculateExtent(),c||this.map.getView().getZoom())}setBbox(l,o){let c=l,i=o;!c&&this.isUpdateBboxOnMoveEnd&&(c=l||this.map.getView().calculateExtent(),i=Math.floor(this.map.getView().getZoom())),super.setBbox(c,i)}highlightTrajectory(l){this.api.getFullTrajectory(l,this.mode,this.generalizationLevel).then(o=>{if(this.vectorLayer.getSource().clear(),!o||!o.features||!o.features.length)return;let i=lS.readFeatures(o);this.vectorLayer.getSource().addFeatures(i)})}clone(l){return new Ed({...this.options,...l})}},l1=Ed;var Sd=class extends xa{getFeatureInfoAtCoordinate(l){let o=[];if(this.map){let c=this.map.getPixelFromCoordinate(l);o=this.map.getFeaturesAtPixel(c,{layerFilter:i=>i===this.olLayer,hitTolerance:this.hitTolerance})}return Promise.resolve({features:o,layer:this,coordinate:l})}clone(l){return new Sd({...this.options,...l})}},u1=Sd;var Td=class extends xa{constructor(l={}){super(l),this.abortController=new AbortController,this.format=new al}getFeatureInfoUrl(l){let o=this.map.getView().getProjection(),c=this.map.getView().getResolution();return this.olLayer.getSource().getFeatureInfoUrl?this.olLayer.getSource().getFeatureInfoUrl(l,c,o,{info_format:"application/json",query_layers:this.olLayer.getSource().getParams().layers}):!1}getFeatureInfoAtCoordinate(l){this.abortController.abort(),this.abortController=new AbortController;let{signal:o}=this.abortController;return fetch(this.getFeatureInfoUrl(l),{signal:o}).then(c=>c.json()).then(c=>c.features).then(c=>({layer:this,coordinate:l,features:c.map(i=>this.format.readFeature(i))})).catch(()=>Promise.resolve({features:[],coordinate:l,layer:this}))}clone(l){return new Td({...this.options,...l})}},c1=Td;var ig={};Qg(ig,{CopyrightControl:()=>h1,Layer:()=>eg,RealtimeAPI:()=>Zf,RealtimeLayer:()=>I1,RealtimeModes:()=>Zo,RoutingAPI:()=>jf,StopsAPI:()=>qf,createTrackerFilters:()=>oy,getCircleCanvas:()=>Ay,getDelayBgCanvas:()=>Iy,getDelayTextCanvas:()=>Cy,getHoursAndMinutes:()=>bv,getLayersAsFlatArray:()=>Xf,getMapboxMapCopyrights:()=>fc,getMapboxRender:()=>Yp,getMaplibreRender:()=>Kp,getTextCanvas:()=>Py,getUTCDateString:()=>vv,getUTCTimeString:()=>xv,getUrlWithParams:()=>$h,pad:()=>mm,realtimeDefaultStyle:()=>Jh,realtimeDelayStyle:()=>My,realtimeSimpleStyle:()=>Ly,removeDuplicate:()=>Kh,renderTrajectories:()=>Wf,sortByDelay:()=>ay,trackerConfig:()=>Hp});var L_=class extends Am(ch){constructor(l){super(l),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 fc(this.map)}},h1=L_;var Id=class extends Wm(ap){attachToMap(l){super.attachToMap(l),!!this.map&&this.userInteractions&&(this.toggleVisibleListeners(),this.onChangeVisibleKey=this.on("change:visible",this.toggleVisibleListeners))}detachFromMap(){this.map&&(this.deactivateUserInteractions(),Na(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 l=this.map.getBounds().toArray();return Jf([...l[0],...l[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(l){return new Id({...this.options,...l})}},eg=Id;var Fo=63710088e-1,p1={centimeters:Fo*100,centimetres:Fo*100,degrees:Fo/111325,feet:Fo*3.28084,inches:Fo*39.37,kilometers:Fo/1e3,kilometres:Fo/1e3,meters:Fo,metres:Fo,miles:Fo/1609.344,millimeters:Fo*1e3,millimetres:Fo*1e3,nauticalmiles:Fo/1852,radians:1,yards:Fo*1.0936},s5={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/Fo,yards:1.0936133};function f1(v,l,o){o===void 0&&(o={});var c={type:"Feature"};return(o.id===0||o.id)&&(c.id=o.id),o.bbox&&(c.bbox=o.bbox),c.properties=l||{},c.geometry=v,c}function bh(v,l,o){if(o===void 0&&(o={}),!v)throw new Error("coordinates is required");if(!Array.isArray(v))throw new Error("coordinates must be an Array");if(v.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!k_(v[0])||!k_(v[1]))throw new Error("coordinates must contain numbers");var c={type:"Point",coordinates:v};return f1(c,l,o)}function uS(v,l){l===void 0&&(l="kilometers");var o=p1[l];if(!o)throw new Error(l+" units is invalid");return v*o}function cS(v,l){l===void 0&&(l="kilometers");var o=p1[l];if(!o)throw new Error(l+" units is invalid");return v/o}function d1(v){var l=v%(2*Math.PI);return l*180/Math.PI}function up(v){var l=v%360;return l*Math.PI/180}function rg(v,l,o){if(l===void 0&&(l="kilometers"),o===void 0&&(o="kilometers"),!(v>=0))throw new Error("length must be a positive number");return uS(cS(v,l),o)}function k_(v){return!isNaN(v)&&v!==null&&!Array.isArray(v)}function z_(v){return!!v&&v.constructor===Object}function Cd(v,l,o){if(v!==null)for(var c,i,u,P,D,F,U,N=0,at=0,yt,Tt=v.type,Lt=Tt==="FeatureCollection",Vt=Tt==="Feature",wt=Lt?v.features.length:1,kt=0;kt<wt;kt++){U=Lt?v.features[kt].geometry:Vt?v.geometry:v,yt=U?U.type==="GeometryCollection":!1,D=yt?U.geometries.length:1;for(var Zt=0;Zt<D;Zt++){var Yt=0,le=0;if(P=yt?U.geometries[Zt]:U,P!==null){F=P.coordinates;var ue=P.type;switch(N=o&&(ue==="Polygon"||ue==="MultiPolygon")?1:0,ue){case null:break;case"Point":if(l(F,at,kt,Yt,le)===!1)return!1;at++,Yt++;break;case"LineString":case"MultiPoint":for(c=0;c<F.length;c++){if(l(F[c],at,kt,Yt,le)===!1)return!1;at++,ue==="MultiPoint"&&Yt++}ue==="LineString"&&Yt++;break;case"Polygon":case"MultiLineString":for(c=0;c<F.length;c++){for(i=0;i<F[c].length-N;i++){if(l(F[c][i],at,kt,Yt,le)===!1)return!1;at++}ue==="MultiLineString"&&Yt++,ue==="Polygon"&&le++}ue==="Polygon"&&Yt++;break;case"MultiPolygon":for(c=0;c<F.length;c++){for(le=0,i=0;i<F[c].length;i++){for(u=0;u<F[c][i].length-N;u++){if(l(F[c][i][u],at,kt,Yt,le)===!1)return!1;at++}le++}Yt++}break;case"GeometryCollection":for(c=0;c<P.geometries.length;c++)if(Cd(P.geometries[c],l,o)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function hS(v,l){l===void 0&&(l={});var o=0,c=0,i=0;return Cd(v,function(u){o+=u[0],c+=u[1],i++},!0),bh([o/i,c/i],l.properties)}var m1=hS;function Du(v){if(!v)throw new Error("coord is required");if(!Array.isArray(v)){if(v.type==="Feature"&&v.geometry!==null&&v.geometry.type==="Point")return v.geometry.coordinates;if(v.type==="Point")return v.coordinates}if(Array.isArray(v)&&v.length>=2&&!Array.isArray(v[0])&&!Array.isArray(v[1]))return v;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function g1(v){if(Array.isArray(v))return v;if(v.type==="Feature"){if(v.geometry!==null)return v.geometry.coordinates}else if(v.coordinates)return v.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function pS(v,l,o){o===void 0&&(o={});var c;o.final?c=y1(Du(l),Du(v)):c=y1(Du(v),Du(l));var i=c>180?-(360-c):c;return i}function y1(v,l){var o=up(v[1]),c=up(l[1]),i=up(l[0]-v[0]);i>Math.PI&&(i-=2*Math.PI),i<-Math.PI&&(i+=2*Math.PI);var u=Math.log(Math.tan(c/2+Math.PI/4)/Math.tan(o/2+Math.PI/4)),P=Math.atan2(i,u);return(d1(P)+360)%360}var _1=pS;function fS(v,l,o){o===void 0&&(o={});var c=Du(v),i=Du(l);i[0]+=i[0]-c[0]>180?-360:c[0]-i[0]>180?360:0;var u=dS(c,i),P=rg(u,"meters",o.units);return P}function dS(v,l,o){o=o===void 0?Fo:Number(o);var c=o,i=v[1]*Math.PI/180,u=l[1]*Math.PI/180,P=u-i,D=Math.abs(l[0]-v[0])*Math.PI/180;D>Math.PI&&(D-=2*Math.PI);var F=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(i/2+Math.PI/4)),U=Math.abs(F)>1e-11?P/F:Math.cos(i),N=Math.sqrt(P*P+U*U*D*D),at=N*c;return at}var v1=fS;function mS(v,l,o,c){c===void 0&&(c={});var i=l<0,u=rg(Math.abs(l),c.units,"meters");i&&(u=-Math.abs(u));var P=Du(v),D=gS(P,u,o);return D[0]+=D[0]-P[0]>180?-360:P[0]-D[0]>180?360:0,bh(D,c.properties)}function gS(v,l,o,c){c=c===void 0?Fo:Number(c);var i=l/c,u=v[0]*Math.PI/180,P=up(v[1]),D=up(o),F=i*Math.cos(D),U=P+F;Math.abs(U)>Math.PI/2&&(U=U>0?Math.PI-U:-Math.PI-U);var N=Math.log(Math.tan(U/2+Math.PI/4)/Math.tan(P/2+Math.PI/4)),at=Math.abs(N)>1e-11?F/N:Math.cos(P),yt=i*Math.sin(D)/at,Tt=u+yt;return[(Tt*180/Math.PI+540)%360-180,U*180/Math.PI]}var x1=mS;function yS(v){if(!v)throw new Error("geojson is required");switch(v.type){case"Feature":return b1(v);case"FeatureCollection":return _S(v);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return R_(v);default:throw new Error("unknown GeoJSON type")}}function b1(v){var l={type:"Feature"};return Object.keys(v).forEach(function(o){switch(o){case"type":case"properties":case"geometry":return;default:l[o]=v[o]}}),l.properties=w1(v.properties),l.geometry=R_(v.geometry),l}function w1(v){var l={};return v&&Object.keys(v).forEach(function(o){var c=v[o];typeof c=="object"?c===null?l[o]=null:Array.isArray(c)?l[o]=c.map(function(i){return i}):l[o]=w1(c):l[o]=c}),l}function _S(v){var l={type:"FeatureCollection"};return Object.keys(v).forEach(function(o){switch(o){case"type":case"features":return;default:l[o]=v[o]}}),l.features=v.features.map(function(o){return b1(o)}),l}function R_(v){var l={type:v.type};return v.bbox&&(l.bbox=v.bbox),v.type==="GeometryCollection"?(l.geometries=v.geometries.map(function(o){return R_(o)}),l):(l.coordinates=E1(v.coordinates),l)}function E1(v){var l=v;return typeof l[0]!="object"?l.slice():l.map(function(o){return E1(o)})}var S1=yS;function vS(v,l,o){if(o=o||{},!z_(o))throw new Error("options is invalid");var c=o.pivot,i=o.mutate;if(!v)throw new Error("geojson is required");if(l==null||isNaN(l))throw new Error("angle is required");return l===0||(c||(c=m1(v)),(i===!1||i===void 0)&&(v=S1(v)),Cd(v,function(u){var P=_1(c,u),D=P+l,F=v1(c,u),U=g1(x1(c,F,D));u[0]=U[0],u[1]=U[1]})),v}var D_=vS;var T1=v=>{let l=v.getBounds().toArray(),o=ro(l[0]),c=ro(l[1]),i=[...o,...c],{width:u,height:P}=v.getCanvas(),D=hs(i)/u,F=Au(i)/P;return Math.max(D,F)},O_=(v,l)=>{let{width:o,height:c}=v.getCanvas(),i=v.unproject({x:0,y:0}),u=v.unproject({x:0,y:c/l}),P=v.unproject({x:o/l,y:c/l}),D=v.unproject({x:o/l,y:0});return[[i.lng,i.lat],[D.lng,D.lat],[P.lng,P.lat],[u.lng,u.lat]]};var F_=class extends Jm(eg){constructor(l={}){super({...l}),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(l,o){if(!l)return;let c=l.getCanvas();super.attachToMap(l,{width:c.width/this.pixelRatio,height:c.height/this.pixelRatio}),this.source={type:"canvas",canvas:this.canvas,coordinates:O_(l,this.pixelRatio),animate:!0,attribution:this.copyrights&&this.copyrights.join(", ")},this.beforeId=o,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"}},l.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(l=>{Na(l)}),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(l){super.onUserMoveCallback({coordinate:ro(l.lngLat.toArray()),...l})}renderTrajectories(l){if(!this.map)return;let{width:o,height:c}=this.map.getCanvas(),i=this.map.getCenter(),u=this.map.unproject({x:0,y:c/this.pixelRatio}),P=this.map.unproject({x:o/this.pixelRatio,y:0}),D=D_(bh([u.lng,u.lat]),-this.map.getBearing(),{pivot:[i.lng,i.lat]}).geometry.coordinates,F=D_(bh([P.lng,P.lat]),-this.map.getBearing(),{pivot:[i.lng,i.lat]}).geometry.coordinates,U=[...ro(D),...ro(F)],N=hs(U)/(o/this.pixelRatio),at=Au(U)/(c/this.pixelRatio),yt=Math.max(N,at),Tt={size:[o/this.pixelRatio,c/this.pixelRatio],center:ro([i.lng,i.lat]),extent:U,resolution:yt,zoom:this.map.getZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(Tt,l)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(l,o={}){let c=T1(this.map);return super.getFeatureInfoAtCoordinate(l,{resolution:c,...o})}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(l,o,c){return super.purgeTrajectory(l,o||this.getMercatorExtent(),c||Math.floor(this.map.getZoom()+1))}setBbox(l,o){let c=l,i=o;!c&&this.isUpdateBboxOnMoveEnd&&(c=l||this.getMercatorExtent(),i=Math.floor(this.getOlZoom())),super.setBbox(c,i)}onMove(){this.renderTrajectories()}renderTrajectoriesInternal(l,o){let c=super.renderTrajectoriesInternal(l,o);if(c&&this.map.style){let i=O_(this.map,this.pixelRatio),u=this.map.getSource(this.key);u&&u.setCoordinates(i)}return c}onMoveEnd(){this.renderTrajectories(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox()}onFeatureHover(l,o,c){super.onFeatureHover(l,o,c),this.map.getCanvasContainer().style.cursor=l.length?"pointer":"auto"}},I1=F_;var B_={ol:tg,mapbox:ig};typeof window<"u"&&(window.mbt=B_);var i3=B_;})();
1008
1008
  //# sourceMappingURL=mbt.min.js.map