mobility-toolbox-js 2.0.0-beta.30 → 2.0.0-beta.32
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/mapbox/layers/RealtimeLayer.js +1 -1
- package/mbt.js +1 -1
- package/mbt.js.map +2 -2
- package/mbt.min.js +1 -1
- package/mbt.min.js.map +2 -2
- package/package.json +1 -1
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 _t=l[U+1]||v.font,Ct=Fm(_t,at);o.push(Ct),P+=Ct;var kt=gw(_t);c.push(kt),F=Math.max(F,kt)}return{width:u,height:D,widths:o,heights:c,lineWidths:i}}function Lx(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]),yw(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 yw(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 _w=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){_w(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),_t=u-at,Ct=Math.sqrt(N*N+_t*_t),kt=Ct/N;if(o==="miter"&&kt<=i)return kt*c;var Vt=c/2/kt,wt=c/2*(_t/Ct),Lt=Math.sqrt((u+Vt)*(u+Vt)+wt*wt),Zt=Lt-u;if(this.radius2_===void 0||o==="bevel")return Zt*2;var Jt=u*Math.sin(U),se=Math.sqrt(u*u-Jt*Jt),ce=P-se,oe=Math.sqrt(Jt*Jt+ce*ce),ye=oe/Jt;if(ye<=i){var be=ye*c/2-P-u;return 2*Math.max(Zt,be)}return Zt*2},l.prototype.createRenderOptions=function(){var o=ku,c=0,i=null,u=0,P,D=0;this.stroke_&&(P=this.stroke_.getColor(),P===null&&(P=Ec),P=ds(P),D=this.stroke_.getWidth(),D===void 0&&(D=Tc),i=this.stroke_.getLineDash(),u=this.stroke_.getLineDashOffset(),o=this.stroke_.getLineJoin(),o===void 0&&(o=ku),c=this.stroke_.getMiterLimit(),c===void 0&&(c=wc));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=rp(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}(Dm),kx=vw;var xw=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)}}(),bw=function(v){xw(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}(kx),al=bw;var Qp=function(){function v(l){var o=l||{};this.geometry_=null,this.geometryFunction_=zx,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_=zx,this.geometry_=l},v.prototype.setZIndex=function(l){this.zIndex_=l},v}();function Rx(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 Xy=null;function Dx(v,l){if(!Xy){var o=new Os({color:"rgba(255,255,255,0.4)"}),c=new ra({color:"#3399CC",width:1.25});Xy=[new Qp({image:new al({fill:o,stroke:c,radius:5}),fill:o,stroke:c})]}return Xy}function Ox(){var v={},l=[255,255,255,1],o=[0,153,255,1],c=3;return v[Ie.POLYGON]=[new Qp({fill:new Os({color:[255,255,255,.5]})})],v[Ie.MULTI_POLYGON]=v[Ie.POLYGON],v[Ie.LINE_STRING]=[new Qp({stroke:new ra({color:l,width:c+2})}),new Qp({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 Qp({image:new al({radius:c*2,fill:new Os({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 zx(v){return v.getGeometry()}var Wl=Qp;var Fx={POINT:"point",LINE:"line"};var Ux=Bp(Ky(),1);var ww=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)}}(),Bx={RENDER_ORDER:"renderOrder"},Ew=function(v){ww(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(Bx.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 Ux.default(9)),this.getRenderer().renderDeclutter(o)},l.prototype.setRenderOrder=function(o){this.set(Bx.RENDER_ORDER,o)},l.prototype.setStyle=function(o){this.style_=o!==void 0?o:Dx,this.styleFunction_=o===null?void 0:Rx(this.style_),this.changed()},l}(mc),Nx=Ew;var ud={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},cd=[ud.FILL],zu=[ud.STROKE],Ic=[ud.BEGIN_PATH],Yy=[ud.CLOSE_PATH],Br=ud;var Sw=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}(),Um=Sw;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)}}(),Iw=function(v){Tw(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],_t=o[c+1],Ct=this.tmpCoordinate_,kt=!0,Vt,wt,Lt;for(Vt=c+u;Vt<i;Vt+=u)Ct[0]=o[Vt],Ct[1]=o[Vt+1],Lt=bm(N,Ct),Lt!==wt?(kt&&(F[U++]=at,F[U++]=_t,kt=!1),F[U++]=Ct[0],F[U++]=Ct[1]):Lt===Co.INTERSECTING?(F[U++]=Ct[0],F[U++]=Ct[1],kt=!1):kt=!0,at=Ct[0],_t=Ct[1],wt=Lt;return(P&&kt||Vt===c+u)&&(F[U++]=at,F[U++]=_t),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,_t,Ct;switch(P){case Ie.MULTI_POLYGON:U=o.getOrientedFlatCoordinates(),_t=[];var kt=o.getEndss();Ct=0;for(var Vt=0,wt=kt.length;Vt<wt;++Vt){var Lt=[];Ct=this.drawCustomCoordinates_(U,Ct,kt[Vt],D,Lt),_t.push(Lt)}this.instructions.push([Br.CUSTOM,F,_t,o,i,od]),this.hitDetectionInstructions.push([Br.CUSTOM,F,_t,o,u||i,od]);break;case Ie.POLYGON:case Ie.MULTI_LINE_STRING:at=[],U=P==Ie.POLYGON?o.getOrientedFlatCoordinates():o.getFlatCoordinates(),Ct=this.drawCustomCoordinates_(U,0,o.getEnds(),D,at),this.instructions.push([Br.CUSTOM,F,at,o,i,mh]),this.hitDetectionInstructions.push([Br.CUSTOM,F,at,o,u||i,mh]);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,ol]),this.hitDetectionInstructions.push([Br.CUSTOM,F,N,o,u||i,ol]);break;case Ie.MULTI_POINT:U=o.getFlatCoordinates(),N=this.appendFlatPointCoordinates(U,D),N>F&&(this.instructions.push([Br.CUSTOM,F,N,o,i,ol]),this.hitDetectionInstructions.push([Br.CUSTOM,F,N,o,u||i,ol]));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,uv(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||Ec);var D=c.getLineCap();i.lineCap=D!==void 0?D:ip;var F=c.getLineDash();i.lineDash=F?F.slice():xc;var U=c.getLineDashOffset();i.lineDashOffset=U||bc;var N=c.getLineJoin();i.lineJoin=N!==void 0?N:ku;var at=c.getWidth();i.lineWidth=at!==void 0?at:Tc;var _t=c.getMiterLimit();i.miterLimit=_t!==void 0?_t:wc,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_=Ov(this.maxExtent),this.maxLineWidth>0)){var o=this.resolution*(this.maxLineWidth+1)/2;il(this.bufferedMaxExtent_,o,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},l}(Um),Ru=Iw;var Cw=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)}}(),Aw=function(v){Cw(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}(Ru),Vx=Aw;var Pw=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)}}(),Mw=function(v){Pw(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,xc,bc],Ic);var D=o.getFlatCoordinates(),F=o.getStride();this.drawFlatCoordinates_(D,0,D.length,F),this.hitDetectionInstructions.push(zu),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],Ic);for(var D=o.getEnds(),F=o.getFlatCoordinates(),U=o.getStride(),N=0,at=0,_t=D.length;at<_t;++at)N=this.drawFlatCoordinates_(F,N,D[at],U);this.hitDetectionInstructions.push(zu),this.endGeometry(c)}},l.prototype.finish=function(){var o=this.state;return o.lastStroke!=null&&o.lastStroke!=this.coordinates.length&&this.instructions.push(zu),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(zu),o.lastStroke=this.coordinates.length),o.lastStroke=0,v.prototype.applyStroke.call(this,o),this.instructions.push(Ic)},l}(Ru),Gx=Mw;var Lw=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)}}(),kw=function(v){Lw(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(Ic),this.hitDetectionInstructions.push(Ic);for(var N=0;N<U;++N){var at=i[N],_t=this.coordinates.length,Ct=this.appendFlatLineCoordinates(o,c,at,u,!0,!F),kt=[Br.MOVE_TO_LINE_TO,_t,Ct];this.instructions.push(kt),this.hitDetectionInstructions.push(kt),F&&(this.instructions.push(Yy),this.hitDetectionInstructions.push(Yy)),c=at}return D&&(this.instructions.push(cd),this.hitDetectionInstructions.push(cd)),F&&(this.instructions.push(zu),this.hitDetectionInstructions.push(zu)),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(Ic,N),this.hitDetectionInstructions.push(Ic,N),i.fillStyle!==void 0&&(this.instructions.push(cd),this.hitDetectionInstructions.push(cd)),i.strokeStyle!==void 0&&(this.instructions.push(zu),this.hitDetectionInstructions.push(zu)),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,_t=D.length;at<_t;++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]=dh(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}(Ru),Hy=kw;function jx(v,l,o,c,i){var u=o,P=o,D=0,F=0,U=o,N,at,_t,Ct,kt,Vt,wt,Lt,Zt,Jt;for(at=o;at<c;at+=i){var se=l[at],ce=l[at+1];kt!==void 0&&(Zt=se-kt,Jt=ce-Vt,Ct=Math.sqrt(Zt*Zt+Jt*Jt),wt!==void 0&&(F+=_t,N=Math.acos((wt*Zt+Lt*Jt)/(_t*Ct)),N>v&&(F>D&&(D=F,u=U,P=at),F=0,U=at-i)),_t=Ct,wt=Zt,Lt=Jt),kt=se,Vt=ce}return F+=Ct,F>D?[U,at]:[u,P]}var zw=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)}}(),hd={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Rw=function(v){zw(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===Fx.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 _t=void 0;if(N=o.getFlatCoordinates(),U==Ie.LINE_STRING)_t=[N.length];else if(U==Ie.MULTI_LINE_STRING)_t=o.getEnds();else if(U==Ie.POLYGON)_t=o.getEnds().slice(0,1);else if(U==Ie.MULTI_POLYGON){var Ct=o.getEndss();_t=[];for(var kt=0,Vt=Ct.length;kt<Vt;++kt)_t.push(Ct[kt][0])}this.beginGeometry(o,c);for(var wt=P.textAlign,Lt=0,Zt=void 0,Jt=0,se=_t.length;Jt<se;++Jt){if(wt==null){var ce=jx(P.maxAngle,N,Lt,_t[Jt],at);Lt=ce[0],Zt=ce[1]}else Zt=_t[Jt];for(var kt=Lt;kt<Zt;kt+=at)D.push(N[kt],N[kt+1]);var oe=D.length;Lt=_t[Jt],this.drawChars_(F,oe),F=oe}this.endGeometry(c)}else{var ye=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||ye.push(N[2]/this.resolution),at=3;break;case Ie.MULTI_POLYGON:var be=o.getFlatInteriorPoints();N=[];for(var kt=0,Vt=be.length;kt<Vt;kt+=3)P.overflow||ye.push(be[kt+2]/this.resolution),N.push(be[kt],be[kt+1]);if(N.length===0)return;at=2;break;default:}var oe=this.appendFlatPointCoordinates(N,at);if(oe===F)return;if(ye&&(oe-F)/2!==N.length/at){var Me=F/2;ye=ye.filter(function(br,xr){var pr=D[(Me+xr)*2]===N[xr*at]&&D[(Me+xr)*2+1]===N[xr*at+1];return pr||--Me,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!=Sc&&(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==Sc?Sc:ir.map(function(br){return br*Lr}),!!P.backgroundFill,!!P.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,ye]);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_,ye]),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||_h,textBaseline:c.textBaseline||np,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=hd[u.textBaseline],at=this.textOffsetY_*U,_t=this.text_,Ct=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,Ct*U,_t,D,1]),this.hitDetectionInstructions.push([Br.DRAW_CHARS,o,c,N,u.overflow,F,u.maxAngle,1,at,P,Ct,_t,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(),_t=F.getMiterLimit();P.lineCap=F.getLineCap()||ip,P.lineDash=U?U.slice():xc,P.lineDashOffset=N===void 0?bc:N,P.lineJoin=F.getLineJoin()||ku,P.lineWidth=at===void 0?Tc:at,P.miterLimit=_t===void 0?wc:_t,P.strokeStyle=ds(F.getColor()||Ec)}i=this.textState_;var Ct=o.getFont()||Bm;Ax(Ct);var kt=o.getScaleArray();i.overflow=o.getOverflow(),i.font=Ct,i.maxAngle=o.getMaxAngle(),i.placement=o.getPlacement(),i.textAlign=o.getTextAlign(),i.textBaseline=o.getTextBaseline()||np,i.backgroundFill=o.getBackgroundFill(),i.backgroundStroke=o.getBackgroundStroke(),i.padding=o.getPadding()||Sc,i.scale=kt===void 0?[1,1]:kt;var Vt=o.getOffsetX(),wt=o.getOffsetY(),Lt=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_=Lt===void 0?!1:Lt,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}(Ru),qx=Rw;var Dw={Circle:Hy,Default:Ru,Image:Vx,LineString:Gx,Polygon:Hy,Text:qx},Ow=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=Dw[o];u=new P(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),i[o]=u}return u},v}(),Jy=Ow;var Fw=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)}}(),Bw=function(v){Fw(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()==Cu.READY&&o.changed()},l.prototype.disposeInternal=function(){delete this.layer_,v.prototype.disposeInternal.call(this)},l}(cm),Zx=Bw;var Uw=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)}}(),Nw=function(v){Uw(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),Xx=Nw;var Vw=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)}}(),pd=null;function Gw(){var v=document.createElement("canvas");v.width=1,v.height=1,pd=v.getContext("2d")}var jw=function(v){Vw(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){pd||Gw(),pd.clearRect(0,0,1,1);var u;try{pd.drawImage(o,c,i,1,1,0,0,1,1),u=pd.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(rp(o.style.backgroundColor),rp(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=by(i),P=wy(i),D=xy(i),F=vy(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 Xx(o,this.inversePixelTransform,i,c);u.dispatchEvent(P)}},l.prototype.preRender=function(o,c){this.frameState=c,this.dispatchRenderEvent_(Xf.PRERENDER,o,c)},l.prototype.postRender=function(o,c){this.dispatchRenderEvent_(Xf.POSTRENDER,o,c)},l.prototype.getRenderTransform=function(o,c,i,u,P,D,F){var U=P/2,N=D/2,at=u/c,_t=-at,Ct=-o[0]+F,kt=-o[1];return us(this.tempTransform,U,N,at,_t,-i,Ct,kt)},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]),_t=this.pixelContext_;if(!_t){var Ct=document.createElement("canvas");Ct.width=1,Ct.height=1,_t=Ct.getContext("2d"),this.pixelContext_=_t}_t.clearRect(0,0,1,1);var kt;try{_t.drawImage(P.canvas,N,at,1,1,0,0,1,1),kt=_t.getImageData(0,0,1,1).data}catch(Vt){return Vt.name==="SecurityError"?(this.pixelContext_=null,new Uint8Array):kt}return kt[3]===0?null:kt},l.prototype.disposeInternal=function(){delete this.frameState,v.prototype.disposeInternal.call(this)},l}(Zx),Wx=jw;var zn={CIRCLE:"Circle",DEFAULT:"Default",IMAGE:"Image",LINE_STRING:"LineString",POLYGON:"Polygon",TEXT:"Text"};function $x(v,l,o,c,i,u,P,D,F,U,N,at){var _t=v[l],Ct=v[l+1],kt=0,Vt=0,wt=0,Lt=0;function Zt(){kt=_t,Vt=Ct,l+=c,_t=v[l],Ct=v[l+1],Lt+=wt,wt=Math.sqrt((_t-kt)*(_t-kt)+(Ct-Vt)*(Ct-Vt))}do Zt();while(l<o-c&&Lt+wt<u);for(var Jt=wt===0?0:(u-Lt)/wt,se=rl(kt,_t,Jt),ce=rl(Vt,Ct,Jt),oe=l-c,ye=Lt,be=u+D*F(U,i,N);l<o-c&&Lt+wt<be;)Zt();Jt=wt===0?0:(be-Lt)/wt;var Me=rl(kt,_t,Jt),ir=rl(Vt,Ct,Jt),Be;if(at){var qe=[se,ce,Me,ir];Am(qe,0,4,2,at,qe,qe),Be=qe[0]>qe[2]}else Be=se>Me;var rr=Math.PI,Ce=[],Lr=oe+c===l;l=oe,wt=0,Lt=ye,_t=v[l],Ct=v[l+1];var yr;if(Lr){Zt(),yr=Math.atan2(Ct-Vt,_t-kt),Be&&(yr+=yr>0?-rr:rr);var _r=(Me+se)/2,br=(ir+ce)/2;return Ce[0]=[_r,br,(be-u)/2,yr,i],Ce}for(var xr=0,pr=i.length;xr<pr;){Zt();var $r=Math.atan2(Ct-Vt,_t-kt);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&&Lt+wt<u+oi+Ri/2)break;oi+=Ri}if(xr!==ti){var Wr=Be?i.substring(pr-ti,pr-xr):i.substring(ti,xr);Jt=wt===0?0:(u+oi/2-Lt)/wt;var _r=rl(kt,_t,Jt),br=rl(Vt,Ct,Jt);Ce.push([_r,br,oi/2,$r,Wr]),u+=oi}}return Ce}var tf=Va(),vh=[],Cc=[],Ac=[],xh=[];function Kx(v){return v[3].declutterBox}var qw=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function Yx(v,l){return(l==="start"||l==="end")&&!qw.test(v)&&(l=l==="start"?"left":"right"),hd[l]}function Zw(v,l,o){return o>0&&v.push(`
|
|
1005
1005
|
`,""),v.push(l,""),v}var Xw=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),_t=Yx(at?l[0]:l,F.textAlign||_h),Ct=i&&P.lineWidth?P.lineWidth:0,kt=at?l:l.split(`
|
|
1006
1006
|
`).reduce(Zw,[]),Vt=Mx(F,kt),wt=Vt.width,Lt=Vt.height,Zt=Vt.widths,Jt=Vt.heights,se=Vt.lineWidths,ce=wt+Ct,oe=[],ye=(ce+2)*N[0],be=(Lt+Ct)*N[1],Me={width:ye<0?Math.floor(ye):Math.ceil(ye),height:be<0?Math.floor(be):Math.ceil(be),contextInstructions:oe};if((N[0]!=1||N[1]!=1)&&oe.push("scale",N),i){oe.push("strokeStyle",P.strokeStyle),oe.push("lineWidth",Ct),oe.push("lineCap",P.lineCap),oe.push("lineJoin",P.lineJoin),oe.push("miterLimit",P.miterLimit);var ir=lh?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-_t,qe=_t*ce+Be*Ct,rr=[],Ce=[],Lr=0,yr=0,_r=0,br=0,xr,pr=0,$r=kt.length;pr<$r;pr+=2){var Fe=kt[pr];if(Fe===`
|
|
1007
|
-
`){yr+=Lr,Lr=0,qe=_t*ce+Be*Ct,++br;continue}var ti=kt[pr+1]||F.font;ti!==xr&&(i&&rr.push("font",ti),c&&Ce.push("font",ti),xr=ti),Lr=Math.max(Lr,Jt[_r]);var oi=[Fe,qe+Be*Zt[_r]+_t*(Zt[_r]-se[br]),.5*(Ct+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]=Me,Me},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,_t,Ct,kt,Vt,wt){D*=_t[0],F*=_t[1];var Lt=c-D,Zt=i-F,Jt=u+U>l?l-U:u,se=P+N>o?o-N:P,ce=kt[3]+Jt*_t[0]+kt[1],oe=kt[0]+se*_t[1]+kt[2],ye=Lt-kt[3],be=Zt-kt[0];(Vt||at!==0)&&(vh[0]=ye,xh[0]=ye,vh[1]=be,Cc[1]=be,Cc[0]=ye+ce,Ac[0]=Cc[0],Ac[1]=be+oe,xh[1]=Ac[1]);var Me;return at!==0?(Me=us(va(),c,i,1,1,at,-c,-i),uo(Me,vh),uo(Me,Cc),uo(Me,Ac),uo(Me,xh),hh(Math.min(vh[0],Cc[0],Ac[0],xh[0]),Math.min(vh[1],Cc[1],Ac[1],xh[1]),Math.max(vh[0],Cc[0],Ac[0],xh[0]),Math.max(vh[1],Cc[1],Ac[1],xh[1]),tf)):hh(Math.min(ye,ye+ce),Math.min(be,be+oe),Math.max(ye,ye+ce),Math.max(be,be+oe),tf),Ct&&(Lt=Math.round(Lt),Zt=Math.round(Zt)),{drawImageX:Lt,drawImageY:Zt,drawImageW:Jt,drawImageH:se,originX:U,originY:N,declutterBox:{minX:tf[0],minY:tf[1],maxX:tf[2],maxY:tf[3],value:wt},canvasTransform:Me,scale:_t}},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,_t=U.minX-at<=N.width/o&&U.maxX+at>=0&&U.minY-at<=N.height/o&&U.maxY+at>=0;return _t&&(F&&this.replayTextBackground_(l,vh,Cc,Ac,xh,P,D),Lx(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=Yx(Array.isArray(l)?l[0]:l,u.textAlign||_h),N=hd[u.textBaseline||np],at=D&&D.lineWidth?D.lineWidth:0,_t=P.width/F-2*u.scale[0],Ct=U*_t+2*(.5-U)*at,kt=N*P.height/F+2*(.5-N)*at;return{label:P,anchorX:Ct,anchorY:kt}},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=nl(this.coordinates,0,this.coordinates.length,2,c,this.pixelCoordinates_),bv(this.renderedTransform_,c));for(var N=0,at=i.length,_t=0,Ct,kt,Vt,wt,Lt,Zt,Jt,se,ce,oe,ye,be,Me=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:Me>_r&&(this.fill_(l),Me=0),ir>_r&&(l.stroke(),ir=0),!Me&&!ir&&(l.beginPath(),wt=NaN,Lt=NaN),++N;break;case Br.CIRCLE:_t=Fe[1];var oi=U[_t],ci=U[_t+1],Ri=U[_t+2],Wr=U[_t+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:_t=Fe[1],Ct=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,_t,Ct,2,ji):(ji[0]=U[_t],ji[1]=U[_t+1],ji.length=2),xn(ji,yr),++N;break;case Br.DRAW_IMAGE:_t=Fe[1],Ct=Fe[2],se=Fe[3],kt=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(!se&&Fe.length>=19){ce=Fe[18],oe=Fe[19],ye=Fe[20],be=Fe[21];var ln=this.drawLabelWithPointPlacement_(ce,oe,ye,be);se=ln.label,Fe[3]=se;var na=Fe[22];kt=(ln.anchorX-na)*this.pixelRatio,Fe[4]=kt;var fe=Fe[23];Vt=(ln.anchorY-fe)*this.pixelRatio,Fe[5]=Vt,qn=se.height,Fe[6]=qn,$i=se.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=Sc,wn=!1,ii=!1),bn&&Lr?co+=Ce:!bn&&!Lr&&(co-=Ce);for(var En=0;_t<Ct;_t+=2)if(!(Ze&&Ze[En++]<$i/this.pixelRatio)){var Ei=this.calculateImageOrLabelDimensions_(se.width,se.height,U[_t],U[_t+1],$i,qn,kt,Vt,io,Wi,co,zr,u,no,wn||ii,br),Xn=[l,o,se,Ei,Zn,wn?Be:null,ii?qe:null],ai=void 0,Ge=void 0;if(F&&dn){var Rr=Ct-_t;if(!dn[Rr]){dn[Rr]=Xn;continue}if(ai=dn[Rr],delete dn[Rr],Ge=Kx(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];be=Fe[5];var ho=Fe[6],Rn=Fe[7],hi=Fe[8];ye=Fe[9];var Q=Fe[10];ce=Fe[11],oe=Fe[12];var it=[Fe[13],Fe[13]],st=this.textStates[oe],yt=st.font,Tt=[st.scale[0]*Rn,st.scale[1]*Rn],Bt=void 0;yt in this.widths_?Bt=this.widths_[yt]:(Bt={},this.widths_[yt]=Bt);var Gt=Rm(U,kr,qi,2),dt=Math.abs(Tt[0])*Zy(yt,ce,Bt);if(Tr||dt<=Gt){var zt=this.textStates[oe].textAlign,Qt=(Gt-dt)*hd[zt],nt=$x(U,kr,qi,2,ce,Qt,ho,Math.abs(Tt[0]),Zy,yt,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(ye)for(Z=0,rt=nt.length;Z<rt;++Z){pt=nt[Z],lt=pt[4],gt=this.createLabel(lt,oe,"",ye),kt=pt[2]+(Tt[0]<0?-Q:Q),Vt=Ki*gt.height+(.5-Ki)*2*Q*Tt[1]/Tt[0]-hi;var Ei=this.calculateImageOrLabelDimensions_(gt.width,gt.height,pt[0],pt[1],gt.width,gt.height,kt,Vt,0,0,pt[3],it,!1,Sc,!1,br);if(F&&F.collides(Ei.declutterBox))break t;X.push([l,o,gt,Ei,1,null,null])}if(be)for(Z=0,rt=nt.length;Z<rt;++Z){pt=nt[Z],lt=pt[4],gt=this.createLabel(lt,oe,be,""),kt=pt[2],Vt=Ki*gt.height-hi;var Ei=this.calculateImageOrLabelDimensions_(gt.width,gt.height,pt[0],pt[1],gt.width,gt.height,kt,Vt,0,0,pt[3],it,!1,Sc,!1,br);if(F&&F.collides(Ei.declutterBox))break t;X.push([l,o,gt,Ei,1,null,null])}F&&F.load(X.map(Kx));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 It=P(br,$r);if(It)return It}++N;break;case Br.FILL:_r?Me++:this.fill_(l),++N;break;case Br.MOVE_TO_LINE_TO:for(_t=Fe[1],Ct=Fe[2],xr=U[_t],pr=U[_t+1],Zt=xr+.5|0,Jt=pr+.5|0,(Zt!==wt||Jt!==Lt)&&(l.moveTo(xr,pr),wt=Zt,Lt=Jt),_t+=2;_t<Ct;_t+=2)xr=U[_t],pr=U[_t+1],Zt=xr+.5|0,Jt=pr+.5|0,(_t==Ct-2||Zt!==wt||Jt!==Lt)&&(l.lineTo(xr,pr),wt=Zt,Lt=Jt);++N;break;case Br.SET_FILL_STYLE:Be=Fe,this.alignFill_=Fe[2],Me&&(this.fill_(l),Me=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}}Me&&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}(),Hx=Xw;var Qy=[zn.POLYGON,zn.CIRCLE,zn.LINE_STRING,zn.IMAGE,zn.TEXT,zn.DEFAULT],Ww=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 Hx(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(),yy(at,l),il(at,o*(this.renderBuffer_+i),at));var _t=$w(i),Ct;function kt(oe,ye){for(var be=N.getImageData(0,0,D,D).data,Me=0,ir=_t.length;Me<ir;Me++)if(be[_t[Me]]>0){if(!P||Ct!==zn.IMAGE&&Ct!==zn.TEXT||P.indexOf(oe)!==-1){var Be=(_t[Me]-3)/4,qe=i-Be%D,rr=i-(Be/D|0),Ce=u(oe,ye,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(nh);var wt,Lt,Zt,Jt,se;for(wt=Vt.length-1;wt>=0;--wt){var ce=Vt[wt].toString();for(Zt=this.executorsByZIndex_[ce],Lt=Qy.length-1;Lt>=0;--Lt)if(Ct=Qy[Lt],Jt=Zt[Ct],Jt!==void 0&&(se=Jt.executeHitDetection(N,F,c,kt,at),se))return se}},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 nl(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(nh),this.maxExtent_&&(l.save(),this.clip(l,c));var U=P||Qy,N,at,_t,Ct,kt,Vt;for(D&&F.reverse(),N=0,at=F.length;N<at;++N){var wt=F[N].toString();for(kt=this.executorsByZIndex_[wt],_t=0,Ct=U.length;_t<Ct;++_t){var Lt=U[_t];Vt=kt[Lt],Vt!==void 0&&Vt.execute(l,o,c,i,u,D)}}this.maxExtent_&&l.restore()},v}(),t_={};function $w(v){if(t_[v]!==void 0)return t_[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 t_[v]=F,F}var e_=Ww;var fd={ANIMATING:0,INTERACTING:1};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)}}(),Yw=function(v){Kw(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=nl(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,_t=P.length;at<_t;at+=2){var Ct=P[at]-this.imageAnchorX_,kt=P[at+1]-this.imageAnchorY_;if(N!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){var Vt=Ct+this.imageAnchorX_,wt=kt+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_,Ct,kt,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=nl(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=nl(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=ax(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:_h;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(),_t=c.getMiterLimit(),Ct=F||xc;this.strokeState_={lineCap:D!==void 0?D:ip,lineDash:this.pixelRatio_===1?Ct:Ct.map(function(kt){return kt*i.pixelRatio_}),lineDashOffset:(U||bc)*this.pixelRatio_,lineJoin:N!==void 0?N:ku,lineWidth:(at!==void 0?at:Tc)*this.pixelRatio_,miterLimit:_t!==void 0?_t:wc,strokeStyle:ds(P||Ec)}}},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(),_t=u.getMiterLimit();this.textStrokeState_={lineCap:D!==void 0?D:ip,lineDash:F||xc,lineDashOffset:U||bc,lineJoin:N!==void 0?N:ku,lineWidth:at!==void 0?at:Tc,miterLimit:_t!==void 0?_t:wc,strokeStyle:ds(P||Ec)}}var Ct=o.getFont(),kt=o.getOffsetX(),Vt=o.getOffsetY(),wt=o.getRotateWithView(),Lt=o.getRotation(),Zt=o.getScaleArray(),Jt=o.getText(),se=o.getTextAlign(),ce=o.getTextBaseline();this.textState_={font:Ct!==void 0?Ct:Bm,textAlign:se!==void 0?se:_h,textBaseline:ce!==void 0?ce:np},this.text_=Jt!==void 0?Array.isArray(Jt)?Jt.reduce(function(oe,ye,be){return oe+=be%2?" ":ye},""):Jt:"",this.textOffsetX_=kt!==void 0?this.pixelRatio_*kt:0,this.textOffsetY_=Vt!==void 0?this.pixelRatio_*Vt:0,this.textRotateWithView_=wt!==void 0?wt:!1,this.textRotation_=Lt!==void 0?Lt:0,this.textScale_=[this.pixelRatio_*Zt[0],this.pixelRatio_*Zt[1]]}},l}(Um),Jx=Yw;var Du={FRACTION:"fraction",PIXELS:"pixels"};var Fs={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var Hw=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=Qx(l,o,c);return i in this.cache_?this.cache_[i]:null},v.prototype.set=function(l,o,c,i){var u=Qx(l,o,c);this.cache_[u]=i,++this.cacheSize_},v.prototype.setSize=function(l){this.maxCacheSize_=l,this.expire()},v}();function Qx(v,l,o){var c=o?Om(o):"null";return l+":"+v+":"+c}var r_=new Hw;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){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}(ah),t0=Qw;var t2=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)}}(),qL=function(v){t2(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=Mu(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_=i_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},l.prototype.setImage=function(o){this.image_=o,this.resolution=Mu(this.extent)/this.image_.height},l.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},l}(t0);function i_(v,l,o){var c=v,i=!0,u=!1,P=!1,D=[Np(c,Vi.LOAD,function(){P=!0,u||l()})];return c.src&&vv?(u=!0,c.decode().then(function(){i&&l()}).catch(function(F){i&&(P?l():o())})):D.push(Np(c,Vi.ERROR,o)),function(){i=!1,D.forEach(To)}}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)}}(),dd=null,r2=function(v){e2(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){dd||(dd=Ga(1,1)),dd.drawImage(this.image_,0,0);try{dd.getImageData(0,0,1,1),this.tainted_=!1}catch{dd=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_=i_(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=Om(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,_t=P.length;at<_t;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}(ah);function e0(v,l,o,c,i,u){var P=r_.get(l,c,u);return P||(P=new r2(v,l,o,c,i,u),r_.set(l,c,u,P)),P}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)}}(),n2=function(v){i2(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:Fs.TOP_LEFT,c.anchorXUnits_=i.anchorXUnits!==void 0?i.anchorXUnits:Du.FRACTION,c.anchorYUnits_=i.anchorYUnits!==void 0?i.anchorYUnits:Du.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?rp(i.color):null,c.iconImage_=e0(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:Fs.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_==Du.FRACTION||this.anchorYUnits_==Du.FRACTION){if(!c)return null;o=this.anchor_.slice(),this.anchorXUnits_==Du.FRACTION&&(o[0]*=c[0]),this.anchorYUnits_==Du.FRACTION&&(o[1]*=c[1])}if(this.anchorOrigin_!=Fs.TOP_LEFT){if(!c)return null;o===this.anchor_&&(o=this.anchor_.slice()),(this.anchorOrigin_==Fs.TOP_RIGHT||this.anchorOrigin_==Fs.BOTTOM_RIGHT)&&(o[0]=-o[0]+c[0]),(this.anchorOrigin_==Fs.BOTTOM_LEFT||this.anchorOrigin_==Fs.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_!=Fs.TOP_LEFT){var c=this.getSize(),i=this.iconImage_.getSize();if(!c||!i)return null;o=o.slice(),(this.offsetOrigin_==Fs.TOP_RIGHT||this.offsetOrigin_==Fs.BOTTOM_RIGHT)&&(o[0]=i[0]-c[0]-o[0]),(this.offsetOrigin_==Fs.BOTTOM_LEFT||this.offsetOrigin_==Fs.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}(Dm),n_=n2;var $l=.5;function r0(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 Jx(U,$l,i,null,P),_t=o.length,Ct=Math.floor((256*256*256-1)/_t),kt={},Vt=1;Vt<=_t;++Vt){var wt=o[Vt-1],Lt=wt.getStyleFunction()||c;if(!!c){var Zt=Lt(wt,u);if(!!Zt){Array.isArray(Zt)||(Zt=[Zt]);for(var Jt=Vt*Ct,se="#"+("000000"+Jt.toString(16)).slice(-6),ce=0,oe=Zt.length;ce<oe;++ce){var ye=Zt[ce],be=ye.getGeometryFunction()(wt);if(!(!be||!Ao(i,be.getExtent()))){var Me=ye.clone(),ir=Me.getFill();ir&&ir.setColor(se);var Be=Me.getStroke();Be&&(Be.setColor(se),Be.setLineDash(null)),Me.setText(void 0);var qe=ye.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=se,Ce.fillRect(0,0,Lr.width,Lr.height),Me.setImage(new n_({img:Lr,imgSize:rr,anchor:qe.getAnchor(),anchorXUnits:Du.PIXELS,anchorYUnits:Du.PIXELS,offset:qe.getOrigin(),opacity:1,size:qe.getSize(),scale:qe.getScale(),rotation:qe.getRotation(),rotateWithView:qe.getRotateWithView()}))}var yr=Me.getZIndex()||0,_r=kt[yr];_r||(_r={},kt[yr]=_r,_r[Ie.POLYGON]=[],_r[Ie.CIRCLE]=[],_r[Ie.LINE_STRING]=[],_r[Ie.POINT]=[]),_r[be.getType().replace("Multi","")].push(be,Me)}}}}}for(var br=Object.keys(kt).map(Number).sort(nh),Vt=0,xr=br.length;Vt<xr;++Vt){var _r=kt[br[Vt]];for(var pr in _r)for(var $r=_r[pr],ce=0,oe=$r.length;ce<oe;ce+=2){at.setStyle($r[ce+1]);for(var Fe=0,ti=l.length;Fe<ti;++Fe)at.setTransform(l[Fe]),at.drawGeometry($r[ce])}}return U.getImageData(0,0,N.width,N.height)}function i0(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=(Gl(i,0,o.width-1)+Gl(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 o2=.5,n0={Point:p2,LineString:u2,Polygon:d2,MultiPoint:f2,MultiLineString:c2,MultiPolygon:h2,GeometryCollection:l2,Circle:a2};function o0(v,l){return parseInt(wi(v),10)-parseInt(wi(l),10)}function a0(v,l){var o=Nm(v,l);return o*o}function Nm(v,l){return o2*v/l}function a2(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 o_(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 s2(v,l,o,c,u,P),D}function s2(v,l,o,c,i,u){var P=o.getGeometryFunction()(l);if(!!P){var D=P.simplifyTransformed(c,i),F=o.getRenderer();if(F)s0(v,D,o,l);else{var U=n0[D.getType()];U(v,D,o,l,u)}}}function s0(v,l,o,c){if(l.getType()==Ie.GEOMETRY_COLLECTION){for(var i=l.getGeometries(),u=0,P=i.length;u<P;++u)s0(v,i[u],o,c);return}var D=v.getBuilder(o.getZIndex(),zn.DEFAULT);D.drawCustom(l,c,o.getRenderer(),o.getHitDetectionRenderer())}function l2(v,l,o,c,i){var u=l.getGeometriesArray(),P,D;for(P=0,D=u.length;P<D;++P){var F=n0[u[P].getType()];F(v,u[P],o,c,i)}}function u2(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 c2(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 h2(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 p2(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 f2(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 d2(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 m2=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)}}(),g2=function(v){m2(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(),_t=this.getLayer().getSource(),Ct=c.pixelRatio,kt=c.viewHints,Vt=!(kt[fd.ANIMATING]||kt[fd.INTERACTING]),wt=this.context,Lt=Math.round(c.size[0]*Ct),Zt=Math.round(c.size[1]*Ct),Jt=_t.getWrapX()&&U.canWrapX(),se=Jt?ps(at):null,ce=Jt?Math.ceil((u[2]-at[2])/se)+1:1,oe=Jt?Math.floor((u[0]-at[0])/se):0;do{var ye=this.getRenderTransform(D,F,N,Ct,Lt,Zt,oe*se);o.execute(wt,1,ye,N,Vt,void 0,i)}while(++oe<ce)},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];wv(this.pixelTransform,1/i,1/i),Sv(this.inversePixelTransform,this.pixelTransform);var P=ny(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),_t=Math.round(o.size[1]*i);F.width!=at||F.height!=_t?(F.width=at,F.height=_t,F.style.transform!==P&&(F.style.transform=P)):this.containerReused||D.clearRect(0,0,at,_t),this.preRender(D,o);var Ct=o.viewState,kt=Ct.projection,Vt=!1,wt=!0;if(u.extent&&this.clipping){var Lt=Jf(u.extent,kt);wt=Ao(Lt,o.extent),Vt=wt&&!_c(Lt,o.extent),Vt&&this.clipUnrotated(D,o,Lt)}wt&&this.renderWorlds(U,o),Vt&&D.restore(),this.postRender(D,o);var Zt=Cx(u.opacity),Jt=this.container;return Zt!==Jt.style.opacity&&(Jt.style.opacity=Zt),this.renderedRotation_!==Ct.rotation&&(this.renderedRotation_=Ct.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=[],_t=i[0]*$l,Ct=i[1]*$l;at.push(this.getRenderTransform(u,P,D,$l,_t,Ct,0).slice());var kt=N.getSource(),Vt=F.getExtent();if(kt.getWrapX()&&F.canWrapX()&&!_c(Vt,U)){for(var wt=U[0],Lt=ps(Vt),Zt=0,Jt=void 0;wt<Vt[0];)--Zt,Jt=Lt*Zt,at.push(this.getRenderTransform(u,P,D,$l,_t,Ct,Jt).slice()),wt+=Lt;for(Zt=0,wt=U[2];wt>Vt[2];)++Zt,Jt=Lt*Zt,at.push(this.getRenderTransform(u,P,D,$l,_t,Ct,Jt).slice()),wt-=Lt}this.hitDetectionImageData_=r0(i,at,this.renderedFeatures_,N.getStyleFunction(),U,P,D)}c(i0(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={},_t=function(Vt,wt,Lt){var Zt=wi(Vt),Jt=at[Zt];if(Jt){if(Jt!==!0&&Lt<Jt.distanceSq){if(Lt===0)return at[Zt]=!0,P.splice(P.lastIndexOf(Jt),1),u(Vt,N,wt);Jt.geometry=wt,Jt.distanceSq=Lt}}else{if(Lt===0)return at[Zt]=!0,u(Vt,N,wt);P.push(at[Zt]={feature:Vt,layer:N,geometry:wt,distanceSq:Lt,callback:u})}},Ct,kt=[this.replayGroup_];return this.declutterExecutorGroup&&kt.push(this.declutterExecutorGroup),kt.some(function(Vt){return Ct=Vt.forEachFeatureAtCoordinate(o,F,U,i,_t,Vt===D.declutterExecutorGroup&&c.declutterTree?c.declutterTree.all().map(function(wt){return wt.value}):null)}),Ct}},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[fd.ANIMATING],P=o.viewHints[fd.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,_t=N.resolution,Ct=o.pixelRatio,kt=c.getRevision(),Vt=c.getRenderBuffer(),wt=c.getRenderOrder();wt===void 0&&(wt=o0);var Lt=N.center.slice(),Zt=il(U,Vt*_t),Jt=Zt.slice(),se=[Zt.slice()],ce=at.getExtent();if(i.getWrapX()&&at.canWrapX()&&!_c(ce,o.extent)){var oe=ps(ce),ye=Math.max(ps(Zt)/2,oe);Zt[0]=ce[0]-ye,Zt[2]=ce[2]+ye,Hv(Lt,at);var be=jv(se[0],at);be[0]<ce[0]&&be[2]<ce[2]?se.push([be[0]+oe,be[1],be[2]+oe,be[3]]):be[0]>ce[0]&&be[2]>ce[2]&&se.push([be[0]-oe,be[1],be[2]-oe,be[3]])}if(!this.dirty_&&this.renderedResolution_==_t&&this.renderedRevision_==kt&&this.renderedRenderOrder_==wt&&_c(this.wrappedRenderedExtent_,Zt))return ls(this.renderedExtent_,Jt)||(this.hitDetectionImageData_=null,this.renderedExtent_=Jt),this.renderedCenter_=Lt,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var Me=new Jy(Nm(_t,Ct),Zt,_t,Ct),ir;this.getLayer().getDeclutter()&&(ir=new Jy(Nm(_t,Ct),Zt,_t,Ct));var Be=fh(),qe;if(Be){for(var rr=0,Ce=se.length;rr<Ce;++rr){var Lr=se[rr],yr=Hp(Lr,at);i.loadFeatures(yr,ex(_t,at),Be)}qe=Im(Be,at)}else for(var rr=0,Ce=se.length;rr<Ce;++rr)i.loadFeatures(se[rr],_t,at);var _r=a0(_t,Ct),br=function(ti){var oi,ci=ti.getStyleFunction()||c.getStyleFunction();if(ci&&(oi=ci(ti,_t)),oi){var Ri=this.renderFeature(ti,_r,oi,Me,qe,ir);this.dirty_=this.dirty_||Ri}}.bind(this),xr=Hp(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=Me.finish(),Fe=new e_(Zt,_t,Ct,i.getOverlaps(),$r,c.getRenderBuffer());return ir&&(this.declutterExecutorGroup=new e_(Zt,_t,Ct,i.getOverlaps(),ir.finish(),c.getRenderBuffer())),this.renderedResolution_=_t,this.renderedRevision_=kt,this.renderedRenderOrder_=wt,this.renderedExtent_=Jt,this.wrappedRenderedExtent_=Zt,this.renderedCenter_=Lt,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=o_(u,o,i[U],c,this.boundHandleStyleImageChange_,P,D)||F;else F=o_(u,o,i,c,this.boundHandleStyleImageChange_,P,D);return F},l}(Wx),l0=g2;var y2=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)}}(),_2=function(v){y2(l,v);function l(o){return v.call(this,o)||this}return l.prototype.createRenderer=function(){return new l0(this)},l}(Nx),op=_2;var u0=Bp(Ky(),1);var v2=function(){function v(l){this.rbush_=new u0.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];Em(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 hh(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}(),md=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){var c=v.call(this)||this;c.projection=ta(o.projection),c.attributions_=c0(o.attributions),c.attributionsCollapsible_=o.attributionsCollapsible!==void 0?o.attributionsCollapsible:!0,c.loading=!1,c.state_=o.state!==void 0?o.state:Cu.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_=c0(o),this.changed()},l.prototype.setState=function(o){this.state_=o,this.changed()},l}(Io);function c0(v){return v?Array.isArray(v)?function(l){return v}:typeof v=="function"?v:function(l){return[v]}:null}var bh=b2;var ja={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function h0(v,l){return[[-1/0,-1/0,1/0,1/0]]}var wh={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var w2=!1;function E2(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()==wh.ARRAY_BUFFER&&(D.responseType="arraybuffer"),D.withCredentials=w2,D.onload=function(F){if(!D.status||D.status>=200&&D.status<300){var U=l.getType(),N=void 0;U==wh.JSON||U==wh.TEXT?N=D.responseText:U==wh.XML?(N=D.responseXML,N||(N=new DOMParser().parseFromString(D.responseText,"application/xml"))):U==wh.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 a_(v,l){return function(o,c,i,u,P){var D=this;E2(v,l,o,c,i,function(F,U){D.addFeatures(F),u!==void 0&&u(F)},P||Yh)}}var p0=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)}}(),Eh=function(v){p0(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 S2=function(v){p0(l,v);function l(o){var c=this,i=o||{};c=v.call(this,{attributions:i.attributions,interpolate:!0,projection:void 0,state:Cu.READY,wrapX:i.wrapX!==void 0?i.wrapX:!0})||this,c.on,c.once,c.un,c.loader_=Yh,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_=a_(c.url_,c.format_)),c.strategy_=i.strategy!==void 0?i.strategy:h0;var u=i.useSpatialIndex!==void 0?i.useSpatialIndex:!0;c.featuresRtree_=u?new md:null,c.loadedExtentsRtree_=new md,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 ch(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 Eh(ja.ADDFEATURE,o))},l.prototype.setupChangeEvents_=function(o,c){this.featureChangeKeys_[o]=[eo(c,Vi.CHANGE,this.handleFeatureChange_,this),eo(c,Up.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 _t=at.getExtent();c.push(_t),u.push(F)}else this.nullGeometryFeatures_[U]=F}if(this.featuresRtree_&&this.featuresRtree_.load(c,u),this.hasListener(ja.ADDFEATURE))for(var P=0,Ct=i.length;P<Ct;P++)this.dispatchEvent(new Eh(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(cs.ADD,function(i){c||(c=!0,this.addFeature(i.element),c=!1)}.bind(this)),o.addEventListener(cs.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 Eh(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,lm(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||sm;return this.featuresRtree_.forEachInExtent(U,function(at){if(N(at)){var _t=at.getGeometry(),Ct=F;if(F=_t.closestPointXY(i,u,D,F),F<Ct){P=at;var kt=Math.sqrt(F);U[0]=i-kt,U[1]=u-kt,U[2]=i+kt,U[3]=u+kt}}}),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 Eh(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,_t){var Ct=P[at],kt=u.forEachInExtent(Ct,function(Vt){return _c(Vt.extent,Ct)});kt||(++F.loadingExtentsCount_,F.dispatchEvent(new Eh(ja.FEATURESLOADSTART)),F.loader_.call(F,Ct,c,i,function(Vt){--this.loadingExtentsCount_,this.dispatchEvent(new Eh(ja.FEATURESLOADEND,void 0,Vt))}.bind(F),function(){--this.loadingExtentsCount_,this.dispatchEvent(new Eh(ja.FEATURESLOADERROR))}.bind(F)),u.insert(Ct,{extent:Ct.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(Em(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 Eh(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(a_(o,this.format_))},l}(bh),ap=S2;var f0=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)}}(),ef=function(v){f0(l,v);function l(o,c){var i=v.call(this,o)||this;return i.layer=c,i}return l}(ss);var s_={LAYERS:"layers"},T2=function(v){f0(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(s_.LAYERS,c.handleLayersChanged_),P?Array.isArray(P)?P=new ch(P.slice(),{unique:!0}):fn(typeof P.getArray=="function",43):P=new ch(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,cs.ADD,this.handleLayersAdd_,this),eo(o,cs.REMOVE,this.handleLayersRemove_,this));for(var c in this.listenerKeys_)this.listenerKeys_[c].forEach(To);oh(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 ef("addlayer",D))}this.changed()},l.prototype.registerLayerListeners_=function(o){var c=[eo(o,Up.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 ef("addlayer",o.layer))},l.prototype.handleLayerGroupRemove_=function(o){this.dispatchEvent(new ef("removelayer",o.layer))},l.prototype.handleLayersAdd_=function(o){var c=o.element;this.registerLayerListeners_(c),this.dispatchEvent(new ef("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 ef("removelayer",c)),this.changed()},l.prototype.getLayers=function(){return this.get(s_.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 ef("removelayer",i[u]));this.set(s_.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=Uv(U.extent,u.extent):U.extent=u.extent),U.zIndex===void 0&&(U.zIndex=P)}return c},l.prototype.getSourceState=function(){return Cu.READY},l}(_m),l_=T2;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 u_={ACTIVE:"active"};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)}}(),C2=function(v){I2(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(u_.ACTIVE)},l.prototype.getMap=function(){return this.map_},l.prototype.handleEvent=function(o){return!0},l.prototype.setActive=function(o){this.set(u_.ACTIVE,o)},l.prototype.setMap=function(o){this.map_=o},l}(Io);var d0=C2;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)}}(),P2=function(v){A2(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(M2(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=lm(this.trackedPointers_)}},l}(d0);function M2(v){var l=v.type;return l===Xo.POINTERDOWN||l===Xo.POINTERDRAG||l===Xo.POINTERUP}var m0=P2;var g0=function(v){var l=v.originalEvent;return l.altKey&&!(l.metaKey||l.ctrlKey)&&!l.shiftKey};var y0=sm,_0=function(v){return v.type==Xo.CLICK};var v0=function(v){return v.type==Xo.SINGLECLICK};var x0=function(v){var l=v.originalEvent;return fn(l!==void 0,56),l.isPrimary&&l.button===0};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,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 _t=D[N];N===0&&(P=_t.getLayout()),Ua(F,_t.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<hs(this.getExtent(),o,c)?u:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(td(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),rd(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 Sx(this.flatCoordinates,0,this.ends_,this.stride,o,u,P)},l.prototype.getCoordinates=function(){return mh(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 vc(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 vc(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=zm(c,i,U,P,.5);Ua(o,N),i=U}return o},l.prototype.getSimplifiedGeometryInternal=function(o){var c=[],i=[];return c.length=px(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 _x(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=id(this.flatCoordinates,0,o,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()},l}(fs),b0=k2;var z2=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){z2(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<hs(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=jl(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 ol(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(Wf(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=ep(this.flatCoordinates,0,o,this.stride),this.changed()},l}(fs),Vm=R2;function w0(v,l,o,c){for(var i=[],u=Va(),P=0,D=o.length;P<D;++P){var F=o[P];u=wm(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 D2=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)}}(),O2=function(v){D2(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 _t=D[N];N===0&&(P=_t.getLayout());for(var Ct=F.length,kt=_t.getEnds(),Vt=0,wt=kt.length;Vt<wt;++Vt)kt[Vt]+=Ct;Ua(F,_t.getFlatCoordinates()),U.push(kt)}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<hs(this.getExtent(),o,c)?u:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(lx(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ux(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,o,c,i,u))},l.prototype.containsXY=function(o,c){return gx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,o,c)},l.prototype.getArea=function(){return dx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)},l.prototype.getCoordinates=function(o){var c;return o!==void 0?(c=this.getOrientedFlatCoordinates().slice(),By(c,0,this.endss_,this.stride,o)):c=this.flatCoordinates,od(c,0,this.endss_,this.stride)},l.prototype.getEndss=function(){return this.endss_},l.prototype.getFlatInteriorPoints=function(){if(this.flatInteriorPointsRevision_!=this.getRevision()){var o=w0(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=yx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,o),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_},l.prototype.getInteriorPoints=function(){return new Vm(this.getFlatInteriorPoints().slice(),_n.XYM)},l.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var o=this.flatCoordinates;wx(o,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=o:(this.orientedFlatCoordinates_=o.slice(),this.orientedFlatCoordinates_.length=By(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=fx(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 ld(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,_t=U.length;at<_t;++at)U[at]-=P;var Ct=new ld(c.slice(P,N),o,U);u.push(Ct),P=N}return u},l.prototype.getType=function(){return Ie.MULTI_POLYGON},l.prototype.intersectsExtent=function(o){return vx(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=hx(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),E0=O2;var A0=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)}}(),S0=0,gd=1,T0=[0,0,0,0],rf=[],c_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},h_=function(v){A0(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 F2=function(v){A0(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:x0,c.defaultDeleteCondition_=function(u){return g0(u)&&v0(u)},c.deleteCondition_=o.deleteCondition?o.deleteCondition:c.defaultDeleteCondition_,c.insertVertexCondition_=o.insertVertexCondition?o.insertVertexCondition:y0,c.vertexFeature_=null,c.vertexSegments_=null,c.lastPixel_=[0,0],c.ignoreNextSingleClick_=!1,c.featuresBeingModified_=null,c.rBush_=new md,c.pixelTolerance_=o.pixelTolerance!==void 0?o.pixelTolerance:10,c.snappedToVertex_=!1,c.changingFeature_=!1,c.dragSegments_=[],c.overlay_=new op({source:new ap({useSpatialIndex:!1,wrapX:!!o.wrapX}),style:o.style?o.style:U2(),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 ch(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(cs.ADD,c.handleFeatureAdd_.bind(c)),c.features_.addEventListener(cs.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 ch;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 h_(c_.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(Pu(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(Pu(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(Pu(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,_t=N.length-1;at<_t;++at){var Ct=N.slice(at,at+2),kt={feature:o,geometry:c,depth:[F,u],index:at,segment:Ct};this.rBush_.insert(Pu(Ct),kt)}},l.prototype.writeCircleGeometry_=function(o,c){var i=c.getCenter(),u={feature:o,geometry:c,index:S0,segment:[i,i]},P={feature:o,geometry:c,index:gd,segment:[i,i]},D=[u,P];u.featureSegments=D,P.featureSegments=D,this.rBush_.insert(Xp(i),u);var F=c,U=fh();if(U&&this.getMap()){var N=this.getMap().getView().getProjection();F=F.clone().transform(U,N),F=Uy(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 _t=U.depth,Ct=void 0,kt=U.segment,Vt=F[1];c.length<at.getStride();)c.push(kt[Vt][c.length]);switch(at.getType()){case Ie.POINT:Ct=c,kt[0]=c,kt[1]=c;break;case Ie.MULTI_POINT:Ct=at.getCoordinates(),Ct[U.index]=c,kt[0]=c,kt[1]=c;break;case Ie.LINE_STRING:Ct=at.getCoordinates(),Ct[U.index+Vt]=c,kt[Vt]=c;break;case Ie.MULTI_LINE_STRING:Ct=at.getCoordinates(),Ct[_t[0]][U.index+Vt]=c,kt[Vt]=c;break;case Ie.POLYGON:Ct=at.getCoordinates(),Ct[_t[0]][U.index+Vt]=c,kt[Vt]=c;break;case Ie.MULTI_POLYGON:Ct=at.getCoordinates(),Ct[_t[1]][_t[0]][U.index+Vt]=c,kt[Vt]=c;break;case Ie.CIRCLE:if(kt[0]=c,kt[1]=c,U.index===S0)this.changingFeature_=!0,at.setCenter(c),this.changingFeature_=!1;else{this.changingFeature_=!0;var wt=o.map.getView().getProjection(),Lt=Cy(Xl(at.getCenter(),wt),Xl(c,wt)),Zt=fh();if(Zt){var Jt=at.clone().transform(Zt,wt);Jt.setRadius(Lt),Lt=Jt.transform(wt,Zt).getRadius()}at.setRadius(Lt),this.changingFeature_=!1}break;default:}Ct&&this.setGeometryCoordinates_(at,Ct)}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=Pu([D]),U=this.rBush_.getInExtent(F),N={};U.sort(B2);for(var at=0,_t=U.length;at<_t;++at){var Ct=U[at],kt=Ct.segment,Vt=wi(Ct.geometry),wt=Ct.depth;if(wt&&(Vt+="-"+wt.join("-")),N[Vt]||(N[Vt]=new Array(2)),Ct.geometry.getType()===Ie.CIRCLE&&Ct.index===gd){var Lt=C0(c,Ct,u);Lu(Lt,D)&&!N[Vt][0]&&(this.dragSegments_.push([Ct,0]),N[Vt][0]=Ct);continue}if(Lu(kt[0],D)&&!N[Vt][0]){this.dragSegments_.push([Ct,0]),N[Vt][0]=Ct;continue}if(Lu(kt[1],D)&&!N[Vt][1]){if((Ct.geometry.getType()===Ie.LINE_STRING||Ct.geometry.getType()===Ie.MULTI_LINE_STRING)&&N[Vt][0]&&N[Vt][0].index===0)continue;this.dragSegments_.push([Ct,1]),N[Vt][1]=Ct;continue}wi(kt)in this.vertexSegments_&&!N[Vt][0]&&!N[Vt][1]&&this.insertVertexCondition_(o)&&P.push(Ct)}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=fh();if(N){var at=o.map.getView().getProjection();U=U.clone().transform(N,at),U=Uy(U).transform(at,N)}this.rBush_.update(U.getExtent(),F)}else this.rBush_.update(Pu(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new h_(c_.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 I0(P,Ce,D)-I0(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&&lv(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 _t=Jf(Xp(P,T0),D),Ct=c.getView().getResolution()*this.pixelTolerance_,kt=Hp(il(_t,Ct,T0),D);U=this.rBush_.getInExtent(kt)}if(U&&U.length>0){var Vt=U.sort(F)[0],wt=Vt.segment,Lt=C0(P,Vt,D),Zt=c.getPixelFromCoordinate(Lt),Jt=Cy(o,Zt);if(N||Jt<=this.pixelTolerance_){var se={};if(se[wi(wt)]=!0,this.snapToPointer_||(this.delta_[0]=Lt[0]-P[0],this.delta_[1]=Lt[1]-P[1]),Vt.geometry.getType()===Ie.CIRCLE&&Vt.index===gd)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(Lt,[Vt.feature],[Vt.geometry]);else{var ce=c.getPixelFromCoordinate(wt[0]),oe=c.getPixelFromCoordinate(wt[1]),ye=Yp(Zt,ce),be=Yp(Zt,oe);Jt=Math.sqrt(Math.min(ye,be)),this.snappedToVertex_=Jt<=this.pixelTolerance_,this.snappedToVertex_&&(Lt=ye>be?wt[1]:wt[0]),this.createOrUpdateVertexFeature_(Lt,[Vt.feature],[Vt.geometry]);var Me={};Me[wi(Vt.geometry)]=!0;for(var ir=1,Be=U.length;ir<Be;++ir){var qe=U[ir].segment;if(Lu(wt[0],qe[0])&&Lu(wt[1],qe[1])||Lu(wt[0],qe[1])&&Lu(wt[1],qe[0])){var rr=wi(U[ir].geometry);rr in Me||(Me[rr]=!0,se[wi(qe)]=!0)}else break}}this.vertexSegments_=se;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(Pu(at.segment),at),this.dragSegments_.push([at,1]);var _t={segment:[c,i[1]],feature:u,geometry:P,depth:D,index:F+1};N.insert(Pu(_t.segment),_t),this.dragSegments_.push([_t,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 h_(c_.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,_t,Ct,kt,Vt;for(U=o.length-1;U>=0;--U)D=o[U],kt=D[0],Vt=wi(kt.feature),kt.depth&&(Vt+="-"+kt.depth.join("-")),Vt in c||(c[Vt]={}),D[1]===0?(c[Vt].right=kt,c[Vt].index=kt.index):D[1]==1&&(c[Vt].left=kt,c[Vt].index=kt.index+1);for(Vt in c){switch(Ct=c[Vt].right,at=c[Vt].left,N=c[Vt].index,_t=N-1,at!==void 0?kt=at:kt=Ct,_t<0&&(_t=0),F=kt.geometry,P=F.getCoordinates(),u=P,i=!1,F.getType()){case Ie.MULTI_LINE_STRING:P[kt.depth[0]].length>2&&(P[kt.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[kt.depth[1]];case Ie.POLYGON:u=u[kt.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]),_t=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])),Ct!==void 0&&(this.rBush_.remove(Ct),wt.push(Ct.segment[1])),at!==void 0&&Ct!==void 0){var Lt={depth:kt.depth,feature:kt.feature,geometry:kt.geometry,index:_t,segment:wt};this.rBush_.insert(Pu(Lt.segment),Lt)}this.updateSegmentIndices_(F,N,kt.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}(m0);function B2(v,l){return v.index-l.index}function I0(v,l,o){var c=l.geometry;if(c.getType()===Ie.CIRCLE){var i=c;if(l.index===gd){var u=fh();u&&(i=i.clone().transform(u,o));var P=Yp(i.getCenter(),Xl(v,o)),D=Math.sqrt(P)-i.getRadius();return D*D}}var F=Xl(v,o);return rf[0]=Xl(l.segment[0],o),rf[1]=Xl(l.segment[1],o),Yv(F,rf)}function C0(v,l,o){var c=l.geometry;if(c.getType()===Ie.CIRCLE&&l.index===gd){var i=c,u=fh();return u&&(i=i.clone().transform(u,o)),My(i.getClosestPoint(Xl(v,o)),o)}var P=Xl(v,o);return rf[0]=Xl(l.segment[0],o),rf[1]=Xl(l.segment[1],o),My(Iy(P,rf),o)}function U2(){var v=Ox();return function(l,o){return v[Ie.POINT]}}var p_=F2;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)}}(),V2=function(v){N2(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<hs(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)Fv(o,c[i].getExtent());return o},l.prototype.getGeometries=function(){return P0(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=Qh(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(P0(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}(Pm);function P0(v){for(var l=[],o=0,c=v.length;o<c;++o)l.push(v[o].clone());return l}var M0=V2;var G2=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()===yc.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}(),L0=G2;function f_(v,l,o){var c=o?ta(o.featureProjection):null,i=o?ta(o.dataProjection):null,u;if(c&&i&&!tx(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 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(){return v.call(this)||this}return l.prototype.getType=function(){return wh.JSON},l.prototype.readFeature=function(o,c){return this.readFeatureFromObject(Gm(o),this.getReadOptions(o,c))},l.prototype.readFeatures=function(o,c){return this.readFeaturesFromObject(Gm(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(Gm(o),this.getReadOptions(o,c))},l.prototype.readGeometryFromObject=function(o,c){return Fr()},l.prototype.readProjection=function(o){return this.readProjectionFromObject(Gm(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}(L0);function Gm(v){if(typeof v=="string"){var l=JSON.parse(v);return l||null}else return v!==null?v:null}var k0=q2;var Z2=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)}}(),X2=function(v){Z2(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=d_(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 d_(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=m_(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 m_(o,this.adaptOptions(c))},l}(k0);function d_(v,l){if(!v)return null;var o;switch(v.type){case Ie.POINT:{o=$2(v);break}case Ie.LINE_STRING:{o=K2(v);break}case Ie.POLYGON:{o=Q2(v);break}case Ie.MULTI_POINT:{o=H2(v);break}case Ie.MULTI_LINE_STRING:{o=Y2(v);break}case Ie.MULTI_POLYGON:{o=J2(v);break}case Ie.GEOMETRY_COLLECTION:{o=W2(v);break}default:throw new Error("Unsupported GeoJSON type: "+v.type)}return f_(o,!1,l)}function W2(v,l){var o=v.geometries.map(function(c){return d_(c,l)});return new M0(o)}function $2(v){return new ea(v.coordinates)}function K2(v){return new vc(v.coordinates)}function Y2(v){return new b0(v.coordinates)}function H2(v){return new Vm(v.coordinates)}function J2(v){return new E0(v.coordinates)}function Q2(v){return new ld(v.coordinates)}function m_(v,l){v=f_(v,!0,l);var o=v.getType(),c;switch(o){case Ie.POINT:{c=oE(v,l);break}case Ie.LINE_STRING:{c=eE(v,l);break}case Ie.POLYGON:{c=aE(v,l);break}case Ie.MULTI_POINT:{c=iE(v,l);break}case Ie.MULTI_LINE_STRING:{c=rE(v,l);break}case Ie.MULTI_POLYGON:{c=nE(v,l);break}case Ie.GEOMETRY_COLLECTION:{c=tE(v,l);break}case Ie.CIRCLE:{c={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+o)}return c}function tE(v,l){var o=v.getGeometriesArray().map(function(c){var i=_a({},l);return delete i.featureProjection,m_(c,i)});return{type:"GeometryCollection",geometries:o}}function eE(v,l){return{type:"LineString",coordinates:v.getCoordinates()}}function rE(v,l){return{type:"MultiLineString",coordinates:v.getCoordinates()}}function iE(v,l){return{type:"MultiPoint",coordinates:v.getCoordinates()}}function nE(v,l){var o;return l&&(o=l.rightHanded),{type:"MultiPolygon",coordinates:v.getCoordinates(o)}}function oE(v,l){return{type:"Point",coordinates:v.getCoordinates()}}function aE(v,l){var o;return l&&(o=l.rightHanded),{type:"Polygon",coordinates:v.getCoordinates(o)}}var gs=X2;var jm,sE=new Uint8Array(16);function g_(){if(!jm&&(jm=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!jm))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return jm(sE)}var z0=/^(?:[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 lE(v){return typeof v=="string"&&z0.test(v)}var R0=lE;var ia=[];for(qm=0;qm<256;++qm)ia.push((qm+256).toString(16).substr(1));var qm;function uE(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(!R0(o))throw TypeError("Stringified UUID is invalid");return o}var D0=uE;function cE(v,l,o){v=v||{};var c=v.random||(v.rng||g_)();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 D0(c)}var y_=cE;var sp=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=y_();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 jf(this)}};var hE=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()}onHover(l){this.userHoverCallbacks.push(l),this.activateUserInteractions()}onUserClickCallback(l){let o={features:[],layer:this,coordinate:l.coordinate||ro(l.lngLat.toArray()),event:l};return this.getFeatureInfoAtCoordinate(l.coordinate).then(c=>(this.dispatchEvent({type:"user:click",target:c}),c)).catch(()=>o)}onUserMoveCallback(l){let o={features:[],layer:this,coordinate:l.coordinate||ro(l.lngLat.toArray()),event:l};return this.getFeatureInfoAtCoordinate(l.coordinate).then(c=>(this.dispatchEvent({type:"user:hover",target:c}),c)).catch(()=>o)}activateUserInteractions(){}deactivateUserInteractions(){}},Zm=hE;var yd=class extends Zm(sp){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 yd({...this.options,...l})}},xa=yd;var O0=new al({radius:6,fill:new Os({color:[255,0,0,1]}),stroke:new ra({color:[0,0,0,1],width:1})}),pE=new Wl({stroke:new ra({color:[0,0,0,1],width:5})}),fE=new Wl({image:O0,stroke:new ra({color:[255,0,0,1],width:3})}),dE=new Wl({image:O0,stroke:new ra({color:[255,0,0,1],width:3,lineDash:[1,10]})}),mE=(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"?[pE,fE]:[dE]},_d=class extends xa{constructor(l={}){super(l),this.olLayer=l.olLayer||new op({source:new ap,style:l.style||mE})}clone(l){return new _d({...this.options,...l})}},Xm=_d;var gE=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,F0=/^([\d.]+),([\d.]+)$/,B0=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,Wm="stop-fetch",U0=v=>{let l=[];return v.forEach(o=>{l.push(...o.getGeometry().getCoordinates())}),l},vd=class extends uh{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 Nf({...l}),this.routingLayer=l.routingLayer||new Xm({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[Wm]?.abort(),this.abortControllers[Wm]=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[Wm]);let l=this.viaPoints.map(o=>{if(Array.isArray(o)){let c=this.map.getView().getProjection(),[i,u]=ph(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[Wm])),Promise.all(this.graphs.map(([o],c)=>this.api.route({graph:o,via:`${l.join("|")}`,mot:`${this.mot}`,"resolve-hops":!1,elevation:!1,"coord-radius":100,"coord-punish":1e3,...this.routingApiParams},this.abortControllers[o]).then(i=>{if(this.segments=this.format.readFeatures(i),this.mot==="foot"){let D=this.segments.reduce((F,U)=>{let N=U.get("trg");return F.find(at=>at[0]===N[0]&&at[1]===N[1])?F:[...F,N]},[]);this.segments=D.map(F=>{let U=this.segments.filter(at=>{let _t=at.get("trg");return _t[0]===F[0]&&_t[1]===F[1]}),N=U0(U);return new gc({geometry:new vc(N)})})}let u=U0(this.segments),P=new gc({geometry:new vc(u)});P.set("graph",o),P.set("mot",this.mot),P.set("minResolution",this.graphsResolutions[c][0]),P.set("maxResolution",this.graphsResolutions[c][1]),this.routingLayer.olLayer.getSource().addFeature(P),this.loading=!1}).catch(i=>{i.name!=="AbortError"&&(this.segments=[],this.dispatchEvent({type:"error",target:this}),this.onRouteError(i,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||B0.test(l)){let U,N;return this.useRawViaPoints?[,U,,N]=B0.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:_t}=at.features[0].geometry;return this.cacheStationData[l]=ro(_t),i.set("viaPointTrack",N),i.setGeometry(new ea(ro(_t))),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&&F0.test(l)){let[U,N]=F0.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]=gE.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=il(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 p_({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 _0(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 gs({featureProjection:this.map.getView().getProjection()}),this.graphsResolutions=vd.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 gs({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()}},N0=vd;var yE=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 Vf(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")}},V0=yE;var __=class extends V0(uh){onSuggestionClick({geometry:l}){let o=ro(l.coordinates);this.map.getView().setCenter(o)}},G0=__;var q0=Bp(j0());var lp=class extends xa{constructor(l={}){let o=new mc({source:new bh({}),render:c=>{if(!this.map||!this.mbMap)return null;let i=!1,u=this.mbMap.getCanvas(),{viewState:P}=c,D=this.olLayer.getVisible();this.renderState.visible!==D&&(u.style.display=D?"block":"none",this.renderState.visible=D,u.style.position="absolute");let F=this.olLayer.getOpacity();this.renderState.opacity!==F&&(u.style.opacity=F,this.renderState.opacity=F);let{rotation:U}=P;this.renderState.rotation!==U&&(this.mbMap.rotateTo(-(U||0)*180/Math.PI,{animate:!1}),i=!0,this.renderState.rotation=U),(this.renderState.zoom!==P.zoom||this.renderState.center[0]!==P.center[0]||this.renderState.center[1]!==P.center[1])&&(this.mbMap.jumpTo({center:ph(P.center),zoom:P.zoom-1,animate:!1}),i=!0,this.renderState.zoom=P.zoom,this.renderState.center=P.center);let N=this.map.getSize();if((this.renderState.size[0]!==N[0]||this.renderState.size[1]!==N[1])&&(i=!0,this.renderState.size=N),this.mbMap&&this.mbMap.style&&this.mbMap.isStyleLoaded()&&i)try{this.mbMap._frame&&(this.mbMap._frame.cancel(),this.mbMap._frame=null),this.mbMap._render()}catch(at){console.warn(at)}return this.mbMap.getContainer()}});super({...l,olLayer:o}),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.mbMap)&&(this.format=new gs({featureProjection:this.map.getView().getProjection()}),this.loadMbMap(),this.olListenersKeys.push(this.map.on("change:size",()=>{try{this.mbMap&&this.mbMap.resize()}catch(o){console.warn(o)}})))}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,o]=this.map.getView().getCenter();(!l||!o)&&(l=0,o=0);let c=document.createElement("div");c.style.position="absolute",c.style.width="100%",c.style.height="100%",!this.apiKey&&!this.styleUrl.includes(this.apiKeyName)&&console.warn(`No apiKey is defined for request to ${this.styleUrl}`),this.mbMap=new q0.Map({style:dc(this.styleUrl,{[this.apiKeyName]:this.apiKey}).toString(),container:c,interactive:!1,trackResize:!1,attributionControl:!1,...this.options.mapOptions||{}}),this.renderState={center:[l,o],zoom:null,rotation:null,visible:null,opacity:null,size:[0,0]},this.mbMap.once("load",()=>{this.mbMap.resize(),this.loaded=!0,this.copyrights=Iu(this.mbMap)||[],this.olLayer.getSource()?.setAttributions(this.copyrights),this.dispatchEvent({type:"load",target:this})});let i=this.mbMap.getCanvas();i&&(this.options.tabIndex?i.setAttribute("tabindex",this.options.tabIndex):i.removeAttribute("tabindex")),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(l){let o=Iu(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(ph(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})}clone(l){return new lp({...this.options,...l})}};var W0=Bp(X0());var up=class extends xa{constructor(l={}){let o=new mc({source:new bh({}),render:c=>{if(!this.map||!this.mbMap)return null;let i=this.mbMap.getCanvas(),{viewState:u}=c,P=this.olLayer.getOpacity();return i.style.opacity=P,this.mbMap.jumpTo({center:ph(u.center),zoom:u.zoom-1,bearing:Lv(-u.rotation),animate:!1}),i.isConnected?(i.width!==c.size[0]||i.height!==c.size[1])&&this.mbMap.resize():this.map.render(),this.mbMap.redraw(),this.mbMap.getContainer()}});super({...l,olLayer:o}),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 gs({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.url}`),this.mbMap=new W0.Map({style:dc(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=Iu(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(ph(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})}clone(l){return new up({...this.options,...l})}};var xd=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 xd({...this.options,...l})}},$0=xd;var I_=Bp(J0()),C_=Bp(i1());var JE=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 Gf(l),this.tenant=l.tenant||"",this.minZoomNonTrain=l.minZoomNonTrain||9,this.minZoomInterpolation=l.minZoomInterpolation||8,this.format=new gs,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,C_.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,I_.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:_t}=l,Ct=c||1,kt=U||new Date;super.defineProperties(l),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{value:at||document.createElement("canvas")},style:{value:o||Jh},styleOptions:{value:{...Gp,..._t||{}}},speed:{get:()=>Ct,set:Vt=>{Ct=Vt,this.start()}},filter:{value:D,writable:!0},sort:{value:F,writable:!0},live:{value:N===!1?N:!0,writable:!0},time:{get:()=>kt,set:Vt=>{kt=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=qf(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,C_.default)(this.renderTrajectoriesInternal,u,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,I_.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=il([...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))}},Km=JE;var QE=new Wl({zIndex:2,image:new al({radius:5,fill:new Os({color:"#000000"})}),stroke:new ra({color:"#000000",width:6})}),tS=(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,[QE,new Wl({zIndex:3,image:new al({radius:4,fill:new Os({color:c})}),stroke:new ra({color:c,width:4})})]},Ym=tS;var eS=new Wl({zIndex:2,image:new al({radius:5,fill:new Os({color:"#000000"})}),stroke:new ra({color:"#000000",width:6})}),rS=new Wl({zIndex:3,image:new al({radius:4,fill:new Os({color:"#a0a0a0"})}),stroke:new ra({color:"#a0a0a0",width:4})}),iS=()=>[eS,rS],n1=iS;var nS=new gs,bd=class extends Km(xa){constructor(l={}){super({...l}),this.olLayer=l.olLayer||new l_({layers:[new op({source:new ap({features:[]}),style:(o,c)=>(l.fullTrajectoryStyle||Ym)(o,c,this.styleOptions)}),new mc({source:new bh({}),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=Ev(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=nS.readFeatures(o);this.vectorLayer.getSource().addFeatures(i)})}clone(l){return new bd({...this.options,...l})}},o1=bd;var wd=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 wd({...this.options,...l})}},a1=wd;var Ed=class extends xa{constructor(l={}){super(l),this.abortController=new AbortController,this.format=new gs}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 Ed({...this.options,...l})}},s1=Ed;var tg={};Yg(tg,{CopyrightControl:()=>l1,Layer:()=>Jm,RealtimeAPI:()=>Gf,RealtimeLayer:()=>E1,RealtimeModes:()=>Zo,RoutingAPI:()=>Nf,StopsAPI:()=>Vf,createTrackerFilters:()=>ry,getCircleCanvas:()=>hy,getDelayBgCanvas:()=>uy,getDelayTextCanvas:()=>cy,getHoursAndMinutes:()=>_v,getLayersAsFlatArray:()=>jf,getMapboxMapCopyrights:()=>Iu,getTextCanvas:()=>py,getUTCDateString:()=>gv,getUTCTimeString:()=>yv,getUrlWithParams:()=>dc,pad:()=>fm,realtimeDefaultStyle:()=>Jh,realtimeDelayStyle:()=>fy,realtimeSimpleStyle:()=>dy,removeDuplicate:()=>Hh,renderTrajectories:()=>qf,sortByDelay:()=>iy,trackerConfig:()=>Gp});var A_=class extends vm(uh){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 Iu(this.map)}},l1=A_;var Sd=class extends Zm(sp){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 Hf([...l[0],...l[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(l){return new Sd({...this.options,...l})}},Jm=Sd;var Fo=63710088e-1,u1={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},YB={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 c1(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 Sh(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(!P_(v[0])||!P_(v[1]))throw new Error("coordinates must contain numbers");var c={type:"Point",coordinates:v};return c1(c,l,o)}function oS(v,l){l===void 0&&(l="kilometers");var o=u1[l];if(!o)throw new Error(l+" units is invalid");return v*o}function aS(v,l){l===void 0&&(l="kilometers");var o=u1[l];if(!o)throw new Error(l+" units is invalid");return v/o}function h1(v){var l=v%(2*Math.PI);return l*180/Math.PI}function cp(v){var l=v%360;return l*Math.PI/180}function Qm(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 oS(aS(v,l),o)}function P_(v){return!isNaN(v)&&v!==null&&!Array.isArray(v)}function M_(v){return!!v&&v.constructor===Object}function Td(v,l,o){if(v!==null)for(var c,i,u,P,D,F,U,N=0,at=0,_t,Ct=v.type,kt=Ct==="FeatureCollection",Vt=Ct==="Feature",wt=kt?v.features.length:1,Lt=0;Lt<wt;Lt++){U=kt?v.features[Lt].geometry:Vt?v.geometry:v,_t=U?U.type==="GeometryCollection":!1,D=_t?U.geometries.length:1;for(var Zt=0;Zt<D;Zt++){var Jt=0,se=0;if(P=_t?U.geometries[Zt]:U,P!==null){F=P.coordinates;var ce=P.type;switch(N=o&&(ce==="Polygon"||ce==="MultiPolygon")?1:0,ce){case null:break;case"Point":if(l(F,at,Lt,Jt,se)===!1)return!1;at++,Jt++;break;case"LineString":case"MultiPoint":for(c=0;c<F.length;c++){if(l(F[c],at,Lt,Jt,se)===!1)return!1;at++,ce==="MultiPoint"&&Jt++}ce==="LineString"&&Jt++;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,Lt,Jt,se)===!1)return!1;at++}ce==="MultiLineString"&&Jt++,ce==="Polygon"&&se++}ce==="Polygon"&&Jt++;break;case"MultiPolygon":for(c=0;c<F.length;c++){for(se=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,Lt,Jt,se)===!1)return!1;at++}se++}Jt++}break;case"GeometryCollection":for(c=0;c<P.geometries.length;c++)if(Td(P.geometries[c],l,o)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function sS(v,l){l===void 0&&(l={});var o=0,c=0,i=0;return Td(v,function(u){o+=u[0],c+=u[1],i++},!0),Sh([o/i,c/i],l.properties)}var p1=sS;function Ou(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 f1(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 lS(v,l,o){o===void 0&&(o={});var c;o.final?c=d1(Ou(l),Ou(v)):c=d1(Ou(v),Ou(l));var i=c>180?-(360-c):c;return i}function d1(v,l){var o=cp(v[1]),c=cp(l[1]),i=cp(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(h1(P)+360)%360}var m1=lS;function uS(v,l,o){o===void 0&&(o={});var c=Ou(v),i=Ou(l);i[0]+=i[0]-c[0]>180?-360:c[0]-i[0]>180?360:0;var u=cS(c,i),P=Qm(u,"meters",o.units);return P}function cS(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 g1=uS;function hS(v,l,o,c){c===void 0&&(c={});var i=l<0,u=Qm(Math.abs(l),c.units,"meters");i&&(u=-Math.abs(u));var P=Ou(v),D=pS(P,u,o);return D[0]+=D[0]-P[0]>180?-360:P[0]-D[0]>180?360:0,Sh(D,c.properties)}function pS(v,l,o,c){c=c===void 0?Fo:Number(c);var i=l/c,u=v[0]*Math.PI/180,P=cp(v[1]),D=cp(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),_t=i*Math.sin(D)/at,Ct=u+_t;return[(Ct*180/Math.PI+540)%360-180,U*180/Math.PI]}var y1=hS;function fS(v){if(!v)throw new Error("geojson is required");switch(v.type){case"Feature":return _1(v);case"FeatureCollection":return dS(v);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return L_(v);default:throw new Error("unknown GeoJSON type")}}function _1(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=v1(v.properties),l.geometry=L_(v.geometry),l}function v1(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]=v1(c):l[o]=c}),l}function dS(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 _1(o)}),l}function L_(v){var l={type:v.type};return v.bbox&&(l.bbox=v.bbox),v.type==="GeometryCollection"?(l.geometries=v.geometries.map(function(o){return L_(o)}),l):(l.coordinates=x1(v.coordinates),l)}function x1(v){var l=v;return typeof l[0]!="object"?l.slice():l.map(function(o){return x1(o)})}var b1=fS;function mS(v,l,o){if(o=o||{},!M_(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=p1(v)),(i===!1||i===void 0)&&(v=b1(v)),Td(v,function(u){var P=m1(c,u),D=P+l,F=g1(c,u),U=f1(y1(c,F,D));u[0]=U[0],u[1]=U[1]})),v}var k_=mS;var w1=v=>{let l=v.getBounds().toArray(),o=ro(l[0]),c=ro(l[1]),i=[...o,...c],{width:u,height:P}=v.getCanvas(),D=ps(i)/u,F=Mu(i)/P;return Math.max(D,F)},z_=(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 R_=class extends Km(Jm){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:z_(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.getLayer(this.key)&&this.map.removeLayer(this.key),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=k_(Sh([u.lng,u.lat]),-this.map.getBearing(),{pivot:[i.lng,i.lat]}).geometry.coordinates,F=k_(Sh([P.lng,P.lat]),-this.map.getBearing(),{pivot:[i.lng,i.lat]}).geometry.coordinates,U=[...ro(D),...ro(F)],N=ps(U)/(o/this.pixelRatio),at=Mu(U)/(c/this.pixelRatio),_t=Math.max(N,at),Ct={size:[o/this.pixelRatio,c/this.pixelRatio],center:ro([i.lng,i.lat]),extent:U,resolution:_t,zoom:this.map.getZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(Ct,l)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(l,o={}){let c=w1(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){let i=z_(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"}},E1=R_;var D_={ol:Hm,mapbox:tg};typeof window<"u"&&(window.mbt=D_);var X5=D_;})();
|
|
1007
|
+
`){yr+=Lr,Lr=0,qe=_t*ce+Be*Ct,++br;continue}var ti=kt[pr+1]||F.font;ti!==xr&&(i&&rr.push("font",ti),c&&Ce.push("font",ti),xr=ti),Lr=Math.max(Lr,Jt[_r]);var oi=[Fe,qe+Be*Zt[_r]+_t*(Zt[_r]-se[br]),.5*(Ct+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]=Me,Me},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,_t,Ct,kt,Vt,wt){D*=_t[0],F*=_t[1];var Lt=c-D,Zt=i-F,Jt=u+U>l?l-U:u,se=P+N>o?o-N:P,ce=kt[3]+Jt*_t[0]+kt[1],oe=kt[0]+se*_t[1]+kt[2],ye=Lt-kt[3],be=Zt-kt[0];(Vt||at!==0)&&(vh[0]=ye,xh[0]=ye,vh[1]=be,Cc[1]=be,Cc[0]=ye+ce,Ac[0]=Cc[0],Ac[1]=be+oe,xh[1]=Ac[1]);var Me;return at!==0?(Me=us(va(),c,i,1,1,at,-c,-i),uo(Me,vh),uo(Me,Cc),uo(Me,Ac),uo(Me,xh),hh(Math.min(vh[0],Cc[0],Ac[0],xh[0]),Math.min(vh[1],Cc[1],Ac[1],xh[1]),Math.max(vh[0],Cc[0],Ac[0],xh[0]),Math.max(vh[1],Cc[1],Ac[1],xh[1]),tf)):hh(Math.min(ye,ye+ce),Math.min(be,be+oe),Math.max(ye,ye+ce),Math.max(be,be+oe),tf),Ct&&(Lt=Math.round(Lt),Zt=Math.round(Zt)),{drawImageX:Lt,drawImageY:Zt,drawImageW:Jt,drawImageH:se,originX:U,originY:N,declutterBox:{minX:tf[0],minY:tf[1],maxX:tf[2],maxY:tf[3],value:wt},canvasTransform:Me,scale:_t}},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,_t=U.minX-at<=N.width/o&&U.maxX+at>=0&&U.minY-at<=N.height/o&&U.maxY+at>=0;return _t&&(F&&this.replayTextBackground_(l,vh,Cc,Ac,xh,P,D),Lx(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=Yx(Array.isArray(l)?l[0]:l,u.textAlign||_h),N=hd[u.textBaseline||np],at=D&&D.lineWidth?D.lineWidth:0,_t=P.width/F-2*u.scale[0],Ct=U*_t+2*(.5-U)*at,kt=N*P.height/F+2*(.5-N)*at;return{label:P,anchorX:Ct,anchorY:kt}},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=nl(this.coordinates,0,this.coordinates.length,2,c,this.pixelCoordinates_),bv(this.renderedTransform_,c));for(var N=0,at=i.length,_t=0,Ct,kt,Vt,wt,Lt,Zt,Jt,se,ce,oe,ye,be,Me=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:Me>_r&&(this.fill_(l),Me=0),ir>_r&&(l.stroke(),ir=0),!Me&&!ir&&(l.beginPath(),wt=NaN,Lt=NaN),++N;break;case Br.CIRCLE:_t=Fe[1];var oi=U[_t],ci=U[_t+1],Ri=U[_t+2],Wr=U[_t+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:_t=Fe[1],Ct=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,_t,Ct,2,ji):(ji[0]=U[_t],ji[1]=U[_t+1],ji.length=2),xn(ji,yr),++N;break;case Br.DRAW_IMAGE:_t=Fe[1],Ct=Fe[2],se=Fe[3],kt=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(!se&&Fe.length>=19){ce=Fe[18],oe=Fe[19],ye=Fe[20],be=Fe[21];var ln=this.drawLabelWithPointPlacement_(ce,oe,ye,be);se=ln.label,Fe[3]=se;var na=Fe[22];kt=(ln.anchorX-na)*this.pixelRatio,Fe[4]=kt;var fe=Fe[23];Vt=(ln.anchorY-fe)*this.pixelRatio,Fe[5]=Vt,qn=se.height,Fe[6]=qn,$i=se.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=Sc,wn=!1,ii=!1),bn&&Lr?co+=Ce:!bn&&!Lr&&(co-=Ce);for(var En=0;_t<Ct;_t+=2)if(!(Ze&&Ze[En++]<$i/this.pixelRatio)){var Ei=this.calculateImageOrLabelDimensions_(se.width,se.height,U[_t],U[_t+1],$i,qn,kt,Vt,io,Wi,co,zr,u,no,wn||ii,br),Xn=[l,o,se,Ei,Zn,wn?Be:null,ii?qe:null],ai=void 0,Ge=void 0;if(F&&dn){var Rr=Ct-_t;if(!dn[Rr]){dn[Rr]=Xn;continue}if(ai=dn[Rr],delete dn[Rr],Ge=Kx(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];be=Fe[5];var ho=Fe[6],Rn=Fe[7],hi=Fe[8];ye=Fe[9];var Q=Fe[10];ce=Fe[11],oe=Fe[12];var it=[Fe[13],Fe[13]],st=this.textStates[oe],yt=st.font,Tt=[st.scale[0]*Rn,st.scale[1]*Rn],Bt=void 0;yt in this.widths_?Bt=this.widths_[yt]:(Bt={},this.widths_[yt]=Bt);var Gt=Rm(U,kr,qi,2),dt=Math.abs(Tt[0])*Zy(yt,ce,Bt);if(Tr||dt<=Gt){var zt=this.textStates[oe].textAlign,Qt=(Gt-dt)*hd[zt],nt=$x(U,kr,qi,2,ce,Qt,ho,Math.abs(Tt[0]),Zy,yt,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(ye)for(Z=0,rt=nt.length;Z<rt;++Z){pt=nt[Z],lt=pt[4],gt=this.createLabel(lt,oe,"",ye),kt=pt[2]+(Tt[0]<0?-Q:Q),Vt=Ki*gt.height+(.5-Ki)*2*Q*Tt[1]/Tt[0]-hi;var Ei=this.calculateImageOrLabelDimensions_(gt.width,gt.height,pt[0],pt[1],gt.width,gt.height,kt,Vt,0,0,pt[3],it,!1,Sc,!1,br);if(F&&F.collides(Ei.declutterBox))break t;X.push([l,o,gt,Ei,1,null,null])}if(be)for(Z=0,rt=nt.length;Z<rt;++Z){pt=nt[Z],lt=pt[4],gt=this.createLabel(lt,oe,be,""),kt=pt[2],Vt=Ki*gt.height-hi;var Ei=this.calculateImageOrLabelDimensions_(gt.width,gt.height,pt[0],pt[1],gt.width,gt.height,kt,Vt,0,0,pt[3],it,!1,Sc,!1,br);if(F&&F.collides(Ei.declutterBox))break t;X.push([l,o,gt,Ei,1,null,null])}F&&F.load(X.map(Kx));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 It=P(br,$r);if(It)return It}++N;break;case Br.FILL:_r?Me++:this.fill_(l),++N;break;case Br.MOVE_TO_LINE_TO:for(_t=Fe[1],Ct=Fe[2],xr=U[_t],pr=U[_t+1],Zt=xr+.5|0,Jt=pr+.5|0,(Zt!==wt||Jt!==Lt)&&(l.moveTo(xr,pr),wt=Zt,Lt=Jt),_t+=2;_t<Ct;_t+=2)xr=U[_t],pr=U[_t+1],Zt=xr+.5|0,Jt=pr+.5|0,(_t==Ct-2||Zt!==wt||Jt!==Lt)&&(l.lineTo(xr,pr),wt=Zt,Lt=Jt);++N;break;case Br.SET_FILL_STYLE:Be=Fe,this.alignFill_=Fe[2],Me&&(this.fill_(l),Me=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}}Me&&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}(),Hx=Xw;var Qy=[zn.POLYGON,zn.CIRCLE,zn.LINE_STRING,zn.IMAGE,zn.TEXT,zn.DEFAULT],Ww=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 Hx(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(),yy(at,l),il(at,o*(this.renderBuffer_+i),at));var _t=$w(i),Ct;function kt(oe,ye){for(var be=N.getImageData(0,0,D,D).data,Me=0,ir=_t.length;Me<ir;Me++)if(be[_t[Me]]>0){if(!P||Ct!==zn.IMAGE&&Ct!==zn.TEXT||P.indexOf(oe)!==-1){var Be=(_t[Me]-3)/4,qe=i-Be%D,rr=i-(Be/D|0),Ce=u(oe,ye,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(nh);var wt,Lt,Zt,Jt,se;for(wt=Vt.length-1;wt>=0;--wt){var ce=Vt[wt].toString();for(Zt=this.executorsByZIndex_[ce],Lt=Qy.length-1;Lt>=0;--Lt)if(Ct=Qy[Lt],Jt=Zt[Ct],Jt!==void 0&&(se=Jt.executeHitDetection(N,F,c,kt,at),se))return se}},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 nl(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(nh),this.maxExtent_&&(l.save(),this.clip(l,c));var U=P||Qy,N,at,_t,Ct,kt,Vt;for(D&&F.reverse(),N=0,at=F.length;N<at;++N){var wt=F[N].toString();for(kt=this.executorsByZIndex_[wt],_t=0,Ct=U.length;_t<Ct;++_t){var Lt=U[_t];Vt=kt[Lt],Vt!==void 0&&Vt.execute(l,o,c,i,u,D)}}this.maxExtent_&&l.restore()},v}(),t_={};function $w(v){if(t_[v]!==void 0)return t_[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 t_[v]=F,F}var e_=Ww;var fd={ANIMATING:0,INTERACTING:1};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)}}(),Yw=function(v){Kw(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=nl(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,_t=P.length;at<_t;at+=2){var Ct=P[at]-this.imageAnchorX_,kt=P[at+1]-this.imageAnchorY_;if(N!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){var Vt=Ct+this.imageAnchorX_,wt=kt+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_,Ct,kt,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=nl(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=nl(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=ax(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:_h;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(),_t=c.getMiterLimit(),Ct=F||xc;this.strokeState_={lineCap:D!==void 0?D:ip,lineDash:this.pixelRatio_===1?Ct:Ct.map(function(kt){return kt*i.pixelRatio_}),lineDashOffset:(U||bc)*this.pixelRatio_,lineJoin:N!==void 0?N:ku,lineWidth:(at!==void 0?at:Tc)*this.pixelRatio_,miterLimit:_t!==void 0?_t:wc,strokeStyle:ds(P||Ec)}}},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(),_t=u.getMiterLimit();this.textStrokeState_={lineCap:D!==void 0?D:ip,lineDash:F||xc,lineDashOffset:U||bc,lineJoin:N!==void 0?N:ku,lineWidth:at!==void 0?at:Tc,miterLimit:_t!==void 0?_t:wc,strokeStyle:ds(P||Ec)}}var Ct=o.getFont(),kt=o.getOffsetX(),Vt=o.getOffsetY(),wt=o.getRotateWithView(),Lt=o.getRotation(),Zt=o.getScaleArray(),Jt=o.getText(),se=o.getTextAlign(),ce=o.getTextBaseline();this.textState_={font:Ct!==void 0?Ct:Bm,textAlign:se!==void 0?se:_h,textBaseline:ce!==void 0?ce:np},this.text_=Jt!==void 0?Array.isArray(Jt)?Jt.reduce(function(oe,ye,be){return oe+=be%2?" ":ye},""):Jt:"",this.textOffsetX_=kt!==void 0?this.pixelRatio_*kt:0,this.textOffsetY_=Vt!==void 0?this.pixelRatio_*Vt:0,this.textRotateWithView_=wt!==void 0?wt:!1,this.textRotation_=Lt!==void 0?Lt:0,this.textScale_=[this.pixelRatio_*Zt[0],this.pixelRatio_*Zt[1]]}},l}(Um),Jx=Yw;var Du={FRACTION:"fraction",PIXELS:"pixels"};var Fs={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var Hw=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=Qx(l,o,c);return i in this.cache_?this.cache_[i]:null},v.prototype.set=function(l,o,c,i){var u=Qx(l,o,c);this.cache_[u]=i,++this.cacheSize_},v.prototype.setSize=function(l){this.maxCacheSize_=l,this.expire()},v}();function Qx(v,l,o){var c=o?Om(o):"null";return l+":"+v+":"+c}var r_=new Hw;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){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}(ah),t0=Qw;var t2=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)}}(),qL=function(v){t2(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=Mu(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_=i_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},l.prototype.setImage=function(o){this.image_=o,this.resolution=Mu(this.extent)/this.image_.height},l.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},l}(t0);function i_(v,l,o){var c=v,i=!0,u=!1,P=!1,D=[Np(c,Vi.LOAD,function(){P=!0,u||l()})];return c.src&&vv?(u=!0,c.decode().then(function(){i&&l()}).catch(function(F){i&&(P?l():o())})):D.push(Np(c,Vi.ERROR,o)),function(){i=!1,D.forEach(To)}}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)}}(),dd=null,r2=function(v){e2(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){dd||(dd=Ga(1,1)),dd.drawImage(this.image_,0,0);try{dd.getImageData(0,0,1,1),this.tainted_=!1}catch{dd=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_=i_(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=Om(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,_t=P.length;at<_t;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}(ah);function e0(v,l,o,c,i,u){var P=r_.get(l,c,u);return P||(P=new r2(v,l,o,c,i,u),r_.set(l,c,u,P)),P}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)}}(),n2=function(v){i2(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:Fs.TOP_LEFT,c.anchorXUnits_=i.anchorXUnits!==void 0?i.anchorXUnits:Du.FRACTION,c.anchorYUnits_=i.anchorYUnits!==void 0?i.anchorYUnits:Du.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?rp(i.color):null,c.iconImage_=e0(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:Fs.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_==Du.FRACTION||this.anchorYUnits_==Du.FRACTION){if(!c)return null;o=this.anchor_.slice(),this.anchorXUnits_==Du.FRACTION&&(o[0]*=c[0]),this.anchorYUnits_==Du.FRACTION&&(o[1]*=c[1])}if(this.anchorOrigin_!=Fs.TOP_LEFT){if(!c)return null;o===this.anchor_&&(o=this.anchor_.slice()),(this.anchorOrigin_==Fs.TOP_RIGHT||this.anchorOrigin_==Fs.BOTTOM_RIGHT)&&(o[0]=-o[0]+c[0]),(this.anchorOrigin_==Fs.BOTTOM_LEFT||this.anchorOrigin_==Fs.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_!=Fs.TOP_LEFT){var c=this.getSize(),i=this.iconImage_.getSize();if(!c||!i)return null;o=o.slice(),(this.offsetOrigin_==Fs.TOP_RIGHT||this.offsetOrigin_==Fs.BOTTOM_RIGHT)&&(o[0]=i[0]-c[0]-o[0]),(this.offsetOrigin_==Fs.BOTTOM_LEFT||this.offsetOrigin_==Fs.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}(Dm),n_=n2;var $l=.5;function r0(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 Jx(U,$l,i,null,P),_t=o.length,Ct=Math.floor((256*256*256-1)/_t),kt={},Vt=1;Vt<=_t;++Vt){var wt=o[Vt-1],Lt=wt.getStyleFunction()||c;if(!!c){var Zt=Lt(wt,u);if(!!Zt){Array.isArray(Zt)||(Zt=[Zt]);for(var Jt=Vt*Ct,se="#"+("000000"+Jt.toString(16)).slice(-6),ce=0,oe=Zt.length;ce<oe;++ce){var ye=Zt[ce],be=ye.getGeometryFunction()(wt);if(!(!be||!Ao(i,be.getExtent()))){var Me=ye.clone(),ir=Me.getFill();ir&&ir.setColor(se);var Be=Me.getStroke();Be&&(Be.setColor(se),Be.setLineDash(null)),Me.setText(void 0);var qe=ye.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=se,Ce.fillRect(0,0,Lr.width,Lr.height),Me.setImage(new n_({img:Lr,imgSize:rr,anchor:qe.getAnchor(),anchorXUnits:Du.PIXELS,anchorYUnits:Du.PIXELS,offset:qe.getOrigin(),opacity:1,size:qe.getSize(),scale:qe.getScale(),rotation:qe.getRotation(),rotateWithView:qe.getRotateWithView()}))}var yr=Me.getZIndex()||0,_r=kt[yr];_r||(_r={},kt[yr]=_r,_r[Ie.POLYGON]=[],_r[Ie.CIRCLE]=[],_r[Ie.LINE_STRING]=[],_r[Ie.POINT]=[]),_r[be.getType().replace("Multi","")].push(be,Me)}}}}}for(var br=Object.keys(kt).map(Number).sort(nh),Vt=0,xr=br.length;Vt<xr;++Vt){var _r=kt[br[Vt]];for(var pr in _r)for(var $r=_r[pr],ce=0,oe=$r.length;ce<oe;ce+=2){at.setStyle($r[ce+1]);for(var Fe=0,ti=l.length;Fe<ti;++Fe)at.setTransform(l[Fe]),at.drawGeometry($r[ce])}}return U.getImageData(0,0,N.width,N.height)}function i0(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=(Gl(i,0,o.width-1)+Gl(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 o2=.5,n0={Point:p2,LineString:u2,Polygon:d2,MultiPoint:f2,MultiLineString:c2,MultiPolygon:h2,GeometryCollection:l2,Circle:a2};function o0(v,l){return parseInt(wi(v),10)-parseInt(wi(l),10)}function a0(v,l){var o=Nm(v,l);return o*o}function Nm(v,l){return o2*v/l}function a2(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 o_(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 s2(v,l,o,c,u,P),D}function s2(v,l,o,c,i,u){var P=o.getGeometryFunction()(l);if(!!P){var D=P.simplifyTransformed(c,i),F=o.getRenderer();if(F)s0(v,D,o,l);else{var U=n0[D.getType()];U(v,D,o,l,u)}}}function s0(v,l,o,c){if(l.getType()==Ie.GEOMETRY_COLLECTION){for(var i=l.getGeometries(),u=0,P=i.length;u<P;++u)s0(v,i[u],o,c);return}var D=v.getBuilder(o.getZIndex(),zn.DEFAULT);D.drawCustom(l,c,o.getRenderer(),o.getHitDetectionRenderer())}function l2(v,l,o,c,i){var u=l.getGeometriesArray(),P,D;for(P=0,D=u.length;P<D;++P){var F=n0[u[P].getType()];F(v,u[P],o,c,i)}}function u2(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 c2(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 h2(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 p2(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 f2(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 d2(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 m2=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)}}(),g2=function(v){m2(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(),_t=this.getLayer().getSource(),Ct=c.pixelRatio,kt=c.viewHints,Vt=!(kt[fd.ANIMATING]||kt[fd.INTERACTING]),wt=this.context,Lt=Math.round(c.size[0]*Ct),Zt=Math.round(c.size[1]*Ct),Jt=_t.getWrapX()&&U.canWrapX(),se=Jt?ps(at):null,ce=Jt?Math.ceil((u[2]-at[2])/se)+1:1,oe=Jt?Math.floor((u[0]-at[0])/se):0;do{var ye=this.getRenderTransform(D,F,N,Ct,Lt,Zt,oe*se);o.execute(wt,1,ye,N,Vt,void 0,i)}while(++oe<ce)},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];wv(this.pixelTransform,1/i,1/i),Sv(this.inversePixelTransform,this.pixelTransform);var P=ny(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),_t=Math.round(o.size[1]*i);F.width!=at||F.height!=_t?(F.width=at,F.height=_t,F.style.transform!==P&&(F.style.transform=P)):this.containerReused||D.clearRect(0,0,at,_t),this.preRender(D,o);var Ct=o.viewState,kt=Ct.projection,Vt=!1,wt=!0;if(u.extent&&this.clipping){var Lt=Jf(u.extent,kt);wt=Ao(Lt,o.extent),Vt=wt&&!_c(Lt,o.extent),Vt&&this.clipUnrotated(D,o,Lt)}wt&&this.renderWorlds(U,o),Vt&&D.restore(),this.postRender(D,o);var Zt=Cx(u.opacity),Jt=this.container;return Zt!==Jt.style.opacity&&(Jt.style.opacity=Zt),this.renderedRotation_!==Ct.rotation&&(this.renderedRotation_=Ct.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=[],_t=i[0]*$l,Ct=i[1]*$l;at.push(this.getRenderTransform(u,P,D,$l,_t,Ct,0).slice());var kt=N.getSource(),Vt=F.getExtent();if(kt.getWrapX()&&F.canWrapX()&&!_c(Vt,U)){for(var wt=U[0],Lt=ps(Vt),Zt=0,Jt=void 0;wt<Vt[0];)--Zt,Jt=Lt*Zt,at.push(this.getRenderTransform(u,P,D,$l,_t,Ct,Jt).slice()),wt+=Lt;for(Zt=0,wt=U[2];wt>Vt[2];)++Zt,Jt=Lt*Zt,at.push(this.getRenderTransform(u,P,D,$l,_t,Ct,Jt).slice()),wt-=Lt}this.hitDetectionImageData_=r0(i,at,this.renderedFeatures_,N.getStyleFunction(),U,P,D)}c(i0(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={},_t=function(Vt,wt,Lt){var Zt=wi(Vt),Jt=at[Zt];if(Jt){if(Jt!==!0&&Lt<Jt.distanceSq){if(Lt===0)return at[Zt]=!0,P.splice(P.lastIndexOf(Jt),1),u(Vt,N,wt);Jt.geometry=wt,Jt.distanceSq=Lt}}else{if(Lt===0)return at[Zt]=!0,u(Vt,N,wt);P.push(at[Zt]={feature:Vt,layer:N,geometry:wt,distanceSq:Lt,callback:u})}},Ct,kt=[this.replayGroup_];return this.declutterExecutorGroup&&kt.push(this.declutterExecutorGroup),kt.some(function(Vt){return Ct=Vt.forEachFeatureAtCoordinate(o,F,U,i,_t,Vt===D.declutterExecutorGroup&&c.declutterTree?c.declutterTree.all().map(function(wt){return wt.value}):null)}),Ct}},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[fd.ANIMATING],P=o.viewHints[fd.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,_t=N.resolution,Ct=o.pixelRatio,kt=c.getRevision(),Vt=c.getRenderBuffer(),wt=c.getRenderOrder();wt===void 0&&(wt=o0);var Lt=N.center.slice(),Zt=il(U,Vt*_t),Jt=Zt.slice(),se=[Zt.slice()],ce=at.getExtent();if(i.getWrapX()&&at.canWrapX()&&!_c(ce,o.extent)){var oe=ps(ce),ye=Math.max(ps(Zt)/2,oe);Zt[0]=ce[0]-ye,Zt[2]=ce[2]+ye,Hv(Lt,at);var be=jv(se[0],at);be[0]<ce[0]&&be[2]<ce[2]?se.push([be[0]+oe,be[1],be[2]+oe,be[3]]):be[0]>ce[0]&&be[2]>ce[2]&&se.push([be[0]-oe,be[1],be[2]-oe,be[3]])}if(!this.dirty_&&this.renderedResolution_==_t&&this.renderedRevision_==kt&&this.renderedRenderOrder_==wt&&_c(this.wrappedRenderedExtent_,Zt))return ls(this.renderedExtent_,Jt)||(this.hitDetectionImageData_=null,this.renderedExtent_=Jt),this.renderedCenter_=Lt,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var Me=new Jy(Nm(_t,Ct),Zt,_t,Ct),ir;this.getLayer().getDeclutter()&&(ir=new Jy(Nm(_t,Ct),Zt,_t,Ct));var Be=fh(),qe;if(Be){for(var rr=0,Ce=se.length;rr<Ce;++rr){var Lr=se[rr],yr=Hp(Lr,at);i.loadFeatures(yr,ex(_t,at),Be)}qe=Im(Be,at)}else for(var rr=0,Ce=se.length;rr<Ce;++rr)i.loadFeatures(se[rr],_t,at);var _r=a0(_t,Ct),br=function(ti){var oi,ci=ti.getStyleFunction()||c.getStyleFunction();if(ci&&(oi=ci(ti,_t)),oi){var Ri=this.renderFeature(ti,_r,oi,Me,qe,ir);this.dirty_=this.dirty_||Ri}}.bind(this),xr=Hp(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=Me.finish(),Fe=new e_(Zt,_t,Ct,i.getOverlaps(),$r,c.getRenderBuffer());return ir&&(this.declutterExecutorGroup=new e_(Zt,_t,Ct,i.getOverlaps(),ir.finish(),c.getRenderBuffer())),this.renderedResolution_=_t,this.renderedRevision_=kt,this.renderedRenderOrder_=wt,this.renderedExtent_=Jt,this.wrappedRenderedExtent_=Zt,this.renderedCenter_=Lt,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=o_(u,o,i[U],c,this.boundHandleStyleImageChange_,P,D)||F;else F=o_(u,o,i,c,this.boundHandleStyleImageChange_,P,D);return F},l}(Wx),l0=g2;var y2=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)}}(),_2=function(v){y2(l,v);function l(o){return v.call(this,o)||this}return l.prototype.createRenderer=function(){return new l0(this)},l}(Nx),op=_2;var u0=Bp(Ky(),1);var v2=function(){function v(l){this.rbush_=new u0.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];Em(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 hh(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}(),md=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){var c=v.call(this)||this;c.projection=ta(o.projection),c.attributions_=c0(o.attributions),c.attributionsCollapsible_=o.attributionsCollapsible!==void 0?o.attributionsCollapsible:!0,c.loading=!1,c.state_=o.state!==void 0?o.state:Cu.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_=c0(o),this.changed()},l.prototype.setState=function(o){this.state_=o,this.changed()},l}(Io);function c0(v){return v?Array.isArray(v)?function(l){return v}:typeof v=="function"?v:function(l){return[v]}:null}var bh=b2;var ja={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function h0(v,l){return[[-1/0,-1/0,1/0,1/0]]}var wh={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var w2=!1;function E2(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()==wh.ARRAY_BUFFER&&(D.responseType="arraybuffer"),D.withCredentials=w2,D.onload=function(F){if(!D.status||D.status>=200&&D.status<300){var U=l.getType(),N=void 0;U==wh.JSON||U==wh.TEXT?N=D.responseText:U==wh.XML?(N=D.responseXML,N||(N=new DOMParser().parseFromString(D.responseText,"application/xml"))):U==wh.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 a_(v,l){return function(o,c,i,u,P){var D=this;E2(v,l,o,c,i,function(F,U){D.addFeatures(F),u!==void 0&&u(F)},P||Yh)}}var p0=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)}}(),Eh=function(v){p0(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 S2=function(v){p0(l,v);function l(o){var c=this,i=o||{};c=v.call(this,{attributions:i.attributions,interpolate:!0,projection:void 0,state:Cu.READY,wrapX:i.wrapX!==void 0?i.wrapX:!0})||this,c.on,c.once,c.un,c.loader_=Yh,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_=a_(c.url_,c.format_)),c.strategy_=i.strategy!==void 0?i.strategy:h0;var u=i.useSpatialIndex!==void 0?i.useSpatialIndex:!0;c.featuresRtree_=u?new md:null,c.loadedExtentsRtree_=new md,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 ch(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 Eh(ja.ADDFEATURE,o))},l.prototype.setupChangeEvents_=function(o,c){this.featureChangeKeys_[o]=[eo(c,Vi.CHANGE,this.handleFeatureChange_,this),eo(c,Up.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 _t=at.getExtent();c.push(_t),u.push(F)}else this.nullGeometryFeatures_[U]=F}if(this.featuresRtree_&&this.featuresRtree_.load(c,u),this.hasListener(ja.ADDFEATURE))for(var P=0,Ct=i.length;P<Ct;P++)this.dispatchEvent(new Eh(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(cs.ADD,function(i){c||(c=!0,this.addFeature(i.element),c=!1)}.bind(this)),o.addEventListener(cs.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 Eh(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,lm(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||sm;return this.featuresRtree_.forEachInExtent(U,function(at){if(N(at)){var _t=at.getGeometry(),Ct=F;if(F=_t.closestPointXY(i,u,D,F),F<Ct){P=at;var kt=Math.sqrt(F);U[0]=i-kt,U[1]=u-kt,U[2]=i+kt,U[3]=u+kt}}}),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 Eh(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,_t){var Ct=P[at],kt=u.forEachInExtent(Ct,function(Vt){return _c(Vt.extent,Ct)});kt||(++F.loadingExtentsCount_,F.dispatchEvent(new Eh(ja.FEATURESLOADSTART)),F.loader_.call(F,Ct,c,i,function(Vt){--this.loadingExtentsCount_,this.dispatchEvent(new Eh(ja.FEATURESLOADEND,void 0,Vt))}.bind(F),function(){--this.loadingExtentsCount_,this.dispatchEvent(new Eh(ja.FEATURESLOADERROR))}.bind(F)),u.insert(Ct,{extent:Ct.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(Em(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 Eh(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(a_(o,this.format_))},l}(bh),ap=S2;var f0=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)}}(),ef=function(v){f0(l,v);function l(o,c){var i=v.call(this,o)||this;return i.layer=c,i}return l}(ss);var s_={LAYERS:"layers"},T2=function(v){f0(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(s_.LAYERS,c.handleLayersChanged_),P?Array.isArray(P)?P=new ch(P.slice(),{unique:!0}):fn(typeof P.getArray=="function",43):P=new ch(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,cs.ADD,this.handleLayersAdd_,this),eo(o,cs.REMOVE,this.handleLayersRemove_,this));for(var c in this.listenerKeys_)this.listenerKeys_[c].forEach(To);oh(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 ef("addlayer",D))}this.changed()},l.prototype.registerLayerListeners_=function(o){var c=[eo(o,Up.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 ef("addlayer",o.layer))},l.prototype.handleLayerGroupRemove_=function(o){this.dispatchEvent(new ef("removelayer",o.layer))},l.prototype.handleLayersAdd_=function(o){var c=o.element;this.registerLayerListeners_(c),this.dispatchEvent(new ef("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 ef("removelayer",c)),this.changed()},l.prototype.getLayers=function(){return this.get(s_.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 ef("removelayer",i[u]));this.set(s_.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=Uv(U.extent,u.extent):U.extent=u.extent),U.zIndex===void 0&&(U.zIndex=P)}return c},l.prototype.getSourceState=function(){return Cu.READY},l}(_m),l_=T2;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 u_={ACTIVE:"active"};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)}}(),C2=function(v){I2(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(u_.ACTIVE)},l.prototype.getMap=function(){return this.map_},l.prototype.handleEvent=function(o){return!0},l.prototype.setActive=function(o){this.set(u_.ACTIVE,o)},l.prototype.setMap=function(o){this.map_=o},l}(Io);var d0=C2;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)}}(),P2=function(v){A2(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(M2(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=lm(this.trackedPointers_)}},l}(d0);function M2(v){var l=v.type;return l===Xo.POINTERDOWN||l===Xo.POINTERDRAG||l===Xo.POINTERUP}var m0=P2;var g0=function(v){var l=v.originalEvent;return l.altKey&&!(l.metaKey||l.ctrlKey)&&!l.shiftKey};var y0=sm,_0=function(v){return v.type==Xo.CLICK};var v0=function(v){return v.type==Xo.SINGLECLICK};var x0=function(v){var l=v.originalEvent;return fn(l!==void 0,56),l.isPrimary&&l.button===0};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,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 _t=D[N];N===0&&(P=_t.getLayout()),Ua(F,_t.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<hs(this.getExtent(),o,c)?u:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(td(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),rd(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 Sx(this.flatCoordinates,0,this.ends_,this.stride,o,u,P)},l.prototype.getCoordinates=function(){return mh(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 vc(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 vc(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=zm(c,i,U,P,.5);Ua(o,N),i=U}return o},l.prototype.getSimplifiedGeometryInternal=function(o){var c=[],i=[];return c.length=px(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 _x(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=id(this.flatCoordinates,0,o,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()},l}(fs),b0=k2;var z2=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){z2(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<hs(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=jl(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 ol(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(Wf(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=ep(this.flatCoordinates,0,o,this.stride),this.changed()},l}(fs),Vm=R2;function w0(v,l,o,c){for(var i=[],u=Va(),P=0,D=o.length;P<D;++P){var F=o[P];u=wm(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 D2=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)}}(),O2=function(v){D2(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 _t=D[N];N===0&&(P=_t.getLayout());for(var Ct=F.length,kt=_t.getEnds(),Vt=0,wt=kt.length;Vt<wt;++Vt)kt[Vt]+=Ct;Ua(F,_t.getFlatCoordinates()),U.push(kt)}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<hs(this.getExtent(),o,c)?u:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(lx(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ux(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,o,c,i,u))},l.prototype.containsXY=function(o,c){return gx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,o,c)},l.prototype.getArea=function(){return dx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)},l.prototype.getCoordinates=function(o){var c;return o!==void 0?(c=this.getOrientedFlatCoordinates().slice(),By(c,0,this.endss_,this.stride,o)):c=this.flatCoordinates,od(c,0,this.endss_,this.stride)},l.prototype.getEndss=function(){return this.endss_},l.prototype.getFlatInteriorPoints=function(){if(this.flatInteriorPointsRevision_!=this.getRevision()){var o=w0(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=yx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,o),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_},l.prototype.getInteriorPoints=function(){return new Vm(this.getFlatInteriorPoints().slice(),_n.XYM)},l.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var o=this.flatCoordinates;wx(o,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=o:(this.orientedFlatCoordinates_=o.slice(),this.orientedFlatCoordinates_.length=By(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=fx(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 ld(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,_t=U.length;at<_t;++at)U[at]-=P;var Ct=new ld(c.slice(P,N),o,U);u.push(Ct),P=N}return u},l.prototype.getType=function(){return Ie.MULTI_POLYGON},l.prototype.intersectsExtent=function(o){return vx(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=hx(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),E0=O2;var A0=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)}}(),S0=0,gd=1,T0=[0,0,0,0],rf=[],c_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},h_=function(v){A0(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 F2=function(v){A0(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:x0,c.defaultDeleteCondition_=function(u){return g0(u)&&v0(u)},c.deleteCondition_=o.deleteCondition?o.deleteCondition:c.defaultDeleteCondition_,c.insertVertexCondition_=o.insertVertexCondition?o.insertVertexCondition:y0,c.vertexFeature_=null,c.vertexSegments_=null,c.lastPixel_=[0,0],c.ignoreNextSingleClick_=!1,c.featuresBeingModified_=null,c.rBush_=new md,c.pixelTolerance_=o.pixelTolerance!==void 0?o.pixelTolerance:10,c.snappedToVertex_=!1,c.changingFeature_=!1,c.dragSegments_=[],c.overlay_=new op({source:new ap({useSpatialIndex:!1,wrapX:!!o.wrapX}),style:o.style?o.style:U2(),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 ch(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(cs.ADD,c.handleFeatureAdd_.bind(c)),c.features_.addEventListener(cs.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 ch;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 h_(c_.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(Pu(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(Pu(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(Pu(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,_t=N.length-1;at<_t;++at){var Ct=N.slice(at,at+2),kt={feature:o,geometry:c,depth:[F,u],index:at,segment:Ct};this.rBush_.insert(Pu(Ct),kt)}},l.prototype.writeCircleGeometry_=function(o,c){var i=c.getCenter(),u={feature:o,geometry:c,index:S0,segment:[i,i]},P={feature:o,geometry:c,index:gd,segment:[i,i]},D=[u,P];u.featureSegments=D,P.featureSegments=D,this.rBush_.insert(Xp(i),u);var F=c,U=fh();if(U&&this.getMap()){var N=this.getMap().getView().getProjection();F=F.clone().transform(U,N),F=Uy(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 _t=U.depth,Ct=void 0,kt=U.segment,Vt=F[1];c.length<at.getStride();)c.push(kt[Vt][c.length]);switch(at.getType()){case Ie.POINT:Ct=c,kt[0]=c,kt[1]=c;break;case Ie.MULTI_POINT:Ct=at.getCoordinates(),Ct[U.index]=c,kt[0]=c,kt[1]=c;break;case Ie.LINE_STRING:Ct=at.getCoordinates(),Ct[U.index+Vt]=c,kt[Vt]=c;break;case Ie.MULTI_LINE_STRING:Ct=at.getCoordinates(),Ct[_t[0]][U.index+Vt]=c,kt[Vt]=c;break;case Ie.POLYGON:Ct=at.getCoordinates(),Ct[_t[0]][U.index+Vt]=c,kt[Vt]=c;break;case Ie.MULTI_POLYGON:Ct=at.getCoordinates(),Ct[_t[1]][_t[0]][U.index+Vt]=c,kt[Vt]=c;break;case Ie.CIRCLE:if(kt[0]=c,kt[1]=c,U.index===S0)this.changingFeature_=!0,at.setCenter(c),this.changingFeature_=!1;else{this.changingFeature_=!0;var wt=o.map.getView().getProjection(),Lt=Cy(Xl(at.getCenter(),wt),Xl(c,wt)),Zt=fh();if(Zt){var Jt=at.clone().transform(Zt,wt);Jt.setRadius(Lt),Lt=Jt.transform(wt,Zt).getRadius()}at.setRadius(Lt),this.changingFeature_=!1}break;default:}Ct&&this.setGeometryCoordinates_(at,Ct)}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=Pu([D]),U=this.rBush_.getInExtent(F),N={};U.sort(B2);for(var at=0,_t=U.length;at<_t;++at){var Ct=U[at],kt=Ct.segment,Vt=wi(Ct.geometry),wt=Ct.depth;if(wt&&(Vt+="-"+wt.join("-")),N[Vt]||(N[Vt]=new Array(2)),Ct.geometry.getType()===Ie.CIRCLE&&Ct.index===gd){var Lt=C0(c,Ct,u);Lu(Lt,D)&&!N[Vt][0]&&(this.dragSegments_.push([Ct,0]),N[Vt][0]=Ct);continue}if(Lu(kt[0],D)&&!N[Vt][0]){this.dragSegments_.push([Ct,0]),N[Vt][0]=Ct;continue}if(Lu(kt[1],D)&&!N[Vt][1]){if((Ct.geometry.getType()===Ie.LINE_STRING||Ct.geometry.getType()===Ie.MULTI_LINE_STRING)&&N[Vt][0]&&N[Vt][0].index===0)continue;this.dragSegments_.push([Ct,1]),N[Vt][1]=Ct;continue}wi(kt)in this.vertexSegments_&&!N[Vt][0]&&!N[Vt][1]&&this.insertVertexCondition_(o)&&P.push(Ct)}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=fh();if(N){var at=o.map.getView().getProjection();U=U.clone().transform(N,at),U=Uy(U).transform(at,N)}this.rBush_.update(U.getExtent(),F)}else this.rBush_.update(Pu(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new h_(c_.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 I0(P,Ce,D)-I0(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&&lv(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 _t=Jf(Xp(P,T0),D),Ct=c.getView().getResolution()*this.pixelTolerance_,kt=Hp(il(_t,Ct,T0),D);U=this.rBush_.getInExtent(kt)}if(U&&U.length>0){var Vt=U.sort(F)[0],wt=Vt.segment,Lt=C0(P,Vt,D),Zt=c.getPixelFromCoordinate(Lt),Jt=Cy(o,Zt);if(N||Jt<=this.pixelTolerance_){var se={};if(se[wi(wt)]=!0,this.snapToPointer_||(this.delta_[0]=Lt[0]-P[0],this.delta_[1]=Lt[1]-P[1]),Vt.geometry.getType()===Ie.CIRCLE&&Vt.index===gd)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(Lt,[Vt.feature],[Vt.geometry]);else{var ce=c.getPixelFromCoordinate(wt[0]),oe=c.getPixelFromCoordinate(wt[1]),ye=Yp(Zt,ce),be=Yp(Zt,oe);Jt=Math.sqrt(Math.min(ye,be)),this.snappedToVertex_=Jt<=this.pixelTolerance_,this.snappedToVertex_&&(Lt=ye>be?wt[1]:wt[0]),this.createOrUpdateVertexFeature_(Lt,[Vt.feature],[Vt.geometry]);var Me={};Me[wi(Vt.geometry)]=!0;for(var ir=1,Be=U.length;ir<Be;++ir){var qe=U[ir].segment;if(Lu(wt[0],qe[0])&&Lu(wt[1],qe[1])||Lu(wt[0],qe[1])&&Lu(wt[1],qe[0])){var rr=wi(U[ir].geometry);rr in Me||(Me[rr]=!0,se[wi(qe)]=!0)}else break}}this.vertexSegments_=se;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(Pu(at.segment),at),this.dragSegments_.push([at,1]);var _t={segment:[c,i[1]],feature:u,geometry:P,depth:D,index:F+1};N.insert(Pu(_t.segment),_t),this.dragSegments_.push([_t,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 h_(c_.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,_t,Ct,kt,Vt;for(U=o.length-1;U>=0;--U)D=o[U],kt=D[0],Vt=wi(kt.feature),kt.depth&&(Vt+="-"+kt.depth.join("-")),Vt in c||(c[Vt]={}),D[1]===0?(c[Vt].right=kt,c[Vt].index=kt.index):D[1]==1&&(c[Vt].left=kt,c[Vt].index=kt.index+1);for(Vt in c){switch(Ct=c[Vt].right,at=c[Vt].left,N=c[Vt].index,_t=N-1,at!==void 0?kt=at:kt=Ct,_t<0&&(_t=0),F=kt.geometry,P=F.getCoordinates(),u=P,i=!1,F.getType()){case Ie.MULTI_LINE_STRING:P[kt.depth[0]].length>2&&(P[kt.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[kt.depth[1]];case Ie.POLYGON:u=u[kt.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]),_t=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])),Ct!==void 0&&(this.rBush_.remove(Ct),wt.push(Ct.segment[1])),at!==void 0&&Ct!==void 0){var Lt={depth:kt.depth,feature:kt.feature,geometry:kt.geometry,index:_t,segment:wt};this.rBush_.insert(Pu(Lt.segment),Lt)}this.updateSegmentIndices_(F,N,kt.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}(m0);function B2(v,l){return v.index-l.index}function I0(v,l,o){var c=l.geometry;if(c.getType()===Ie.CIRCLE){var i=c;if(l.index===gd){var u=fh();u&&(i=i.clone().transform(u,o));var P=Yp(i.getCenter(),Xl(v,o)),D=Math.sqrt(P)-i.getRadius();return D*D}}var F=Xl(v,o);return rf[0]=Xl(l.segment[0],o),rf[1]=Xl(l.segment[1],o),Yv(F,rf)}function C0(v,l,o){var c=l.geometry;if(c.getType()===Ie.CIRCLE&&l.index===gd){var i=c,u=fh();return u&&(i=i.clone().transform(u,o)),My(i.getClosestPoint(Xl(v,o)),o)}var P=Xl(v,o);return rf[0]=Xl(l.segment[0],o),rf[1]=Xl(l.segment[1],o),My(Iy(P,rf),o)}function U2(){var v=Ox();return function(l,o){return v[Ie.POINT]}}var p_=F2;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)}}(),V2=function(v){N2(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<hs(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)Fv(o,c[i].getExtent());return o},l.prototype.getGeometries=function(){return P0(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=Qh(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(P0(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}(Pm);function P0(v){for(var l=[],o=0,c=v.length;o<c;++o)l.push(v[o].clone());return l}var M0=V2;var G2=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()===yc.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}(),L0=G2;function f_(v,l,o){var c=o?ta(o.featureProjection):null,i=o?ta(o.dataProjection):null,u;if(c&&i&&!tx(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 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(){return v.call(this)||this}return l.prototype.getType=function(){return wh.JSON},l.prototype.readFeature=function(o,c){return this.readFeatureFromObject(Gm(o),this.getReadOptions(o,c))},l.prototype.readFeatures=function(o,c){return this.readFeaturesFromObject(Gm(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(Gm(o),this.getReadOptions(o,c))},l.prototype.readGeometryFromObject=function(o,c){return Fr()},l.prototype.readProjection=function(o){return this.readProjectionFromObject(Gm(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}(L0);function Gm(v){if(typeof v=="string"){var l=JSON.parse(v);return l||null}else return v!==null?v:null}var k0=q2;var Z2=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)}}(),X2=function(v){Z2(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=d_(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 d_(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=m_(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 m_(o,this.adaptOptions(c))},l}(k0);function d_(v,l){if(!v)return null;var o;switch(v.type){case Ie.POINT:{o=$2(v);break}case Ie.LINE_STRING:{o=K2(v);break}case Ie.POLYGON:{o=Q2(v);break}case Ie.MULTI_POINT:{o=H2(v);break}case Ie.MULTI_LINE_STRING:{o=Y2(v);break}case Ie.MULTI_POLYGON:{o=J2(v);break}case Ie.GEOMETRY_COLLECTION:{o=W2(v);break}default:throw new Error("Unsupported GeoJSON type: "+v.type)}return f_(o,!1,l)}function W2(v,l){var o=v.geometries.map(function(c){return d_(c,l)});return new M0(o)}function $2(v){return new ea(v.coordinates)}function K2(v){return new vc(v.coordinates)}function Y2(v){return new b0(v.coordinates)}function H2(v){return new Vm(v.coordinates)}function J2(v){return new E0(v.coordinates)}function Q2(v){return new ld(v.coordinates)}function m_(v,l){v=f_(v,!0,l);var o=v.getType(),c;switch(o){case Ie.POINT:{c=oE(v,l);break}case Ie.LINE_STRING:{c=eE(v,l);break}case Ie.POLYGON:{c=aE(v,l);break}case Ie.MULTI_POINT:{c=iE(v,l);break}case Ie.MULTI_LINE_STRING:{c=rE(v,l);break}case Ie.MULTI_POLYGON:{c=nE(v,l);break}case Ie.GEOMETRY_COLLECTION:{c=tE(v,l);break}case Ie.CIRCLE:{c={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+o)}return c}function tE(v,l){var o=v.getGeometriesArray().map(function(c){var i=_a({},l);return delete i.featureProjection,m_(c,i)});return{type:"GeometryCollection",geometries:o}}function eE(v,l){return{type:"LineString",coordinates:v.getCoordinates()}}function rE(v,l){return{type:"MultiLineString",coordinates:v.getCoordinates()}}function iE(v,l){return{type:"MultiPoint",coordinates:v.getCoordinates()}}function nE(v,l){var o;return l&&(o=l.rightHanded),{type:"MultiPolygon",coordinates:v.getCoordinates(o)}}function oE(v,l){return{type:"Point",coordinates:v.getCoordinates()}}function aE(v,l){var o;return l&&(o=l.rightHanded),{type:"Polygon",coordinates:v.getCoordinates(o)}}var gs=X2;var jm,sE=new Uint8Array(16);function g_(){if(!jm&&(jm=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!jm))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return jm(sE)}var z0=/^(?:[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 lE(v){return typeof v=="string"&&z0.test(v)}var R0=lE;var ia=[];for(qm=0;qm<256;++qm)ia.push((qm+256).toString(16).substr(1));var qm;function uE(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(!R0(o))throw TypeError("Stringified UUID is invalid");return o}var D0=uE;function cE(v,l,o){v=v||{};var c=v.random||(v.rng||g_)();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 D0(c)}var y_=cE;var sp=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=y_();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 jf(this)}};var hE=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()}onHover(l){this.userHoverCallbacks.push(l),this.activateUserInteractions()}onUserClickCallback(l){let o={features:[],layer:this,coordinate:l.coordinate||ro(l.lngLat.toArray()),event:l};return this.getFeatureInfoAtCoordinate(l.coordinate).then(c=>(this.dispatchEvent({type:"user:click",target:c}),c)).catch(()=>o)}onUserMoveCallback(l){let o={features:[],layer:this,coordinate:l.coordinate||ro(l.lngLat.toArray()),event:l};return this.getFeatureInfoAtCoordinate(l.coordinate).then(c=>(this.dispatchEvent({type:"user:hover",target:c}),c)).catch(()=>o)}activateUserInteractions(){}deactivateUserInteractions(){}},Zm=hE;var yd=class extends Zm(sp){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 yd({...this.options,...l})}},xa=yd;var O0=new al({radius:6,fill:new Os({color:[255,0,0,1]}),stroke:new ra({color:[0,0,0,1],width:1})}),pE=new Wl({stroke:new ra({color:[0,0,0,1],width:5})}),fE=new Wl({image:O0,stroke:new ra({color:[255,0,0,1],width:3})}),dE=new Wl({image:O0,stroke:new ra({color:[255,0,0,1],width:3,lineDash:[1,10]})}),mE=(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"?[pE,fE]:[dE]},_d=class extends xa{constructor(l={}){super(l),this.olLayer=l.olLayer||new op({source:new ap,style:l.style||mE})}clone(l){return new _d({...this.options,...l})}},Xm=_d;var gE=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,F0=/^([\d.]+),([\d.]+)$/,B0=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,Wm="stop-fetch",U0=v=>{let l=[];return v.forEach(o=>{l.push(...o.getGeometry().getCoordinates())}),l},vd=class extends uh{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 Nf({...l}),this.routingLayer=l.routingLayer||new Xm({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[Wm]?.abort(),this.abortControllers[Wm]=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[Wm]);let l=this.viaPoints.map(o=>{if(Array.isArray(o)){let c=this.map.getView().getProjection(),[i,u]=ph(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[Wm])),Promise.all(this.graphs.map(([o],c)=>this.api.route({graph:o,via:`${l.join("|")}`,mot:`${this.mot}`,"resolve-hops":!1,elevation:!1,"coord-radius":100,"coord-punish":1e3,...this.routingApiParams},this.abortControllers[o]).then(i=>{if(this.segments=this.format.readFeatures(i),this.mot==="foot"){let D=this.segments.reduce((F,U)=>{let N=U.get("trg");return F.find(at=>at[0]===N[0]&&at[1]===N[1])?F:[...F,N]},[]);this.segments=D.map(F=>{let U=this.segments.filter(at=>{let _t=at.get("trg");return _t[0]===F[0]&&_t[1]===F[1]}),N=U0(U);return new gc({geometry:new vc(N)})})}let u=U0(this.segments),P=new gc({geometry:new vc(u)});P.set("graph",o),P.set("mot",this.mot),P.set("minResolution",this.graphsResolutions[c][0]),P.set("maxResolution",this.graphsResolutions[c][1]),this.routingLayer.olLayer.getSource().addFeature(P),this.loading=!1}).catch(i=>{i.name!=="AbortError"&&(this.segments=[],this.dispatchEvent({type:"error",target:this}),this.onRouteError(i,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||B0.test(l)){let U,N;return this.useRawViaPoints?[,U,,N]=B0.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:_t}=at.features[0].geometry;return this.cacheStationData[l]=ro(_t),i.set("viaPointTrack",N),i.setGeometry(new ea(ro(_t))),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&&F0.test(l)){let[U,N]=F0.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]=gE.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=il(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 p_({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 _0(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 gs({featureProjection:this.map.getView().getProjection()}),this.graphsResolutions=vd.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 gs({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()}},N0=vd;var yE=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 Vf(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")}},V0=yE;var __=class extends V0(uh){onSuggestionClick({geometry:l}){let o=ro(l.coordinates);this.map.getView().setCenter(o)}},G0=__;var q0=Bp(j0());var lp=class extends xa{constructor(l={}){let o=new mc({source:new bh({}),render:c=>{if(!this.map||!this.mbMap)return null;let i=!1,u=this.mbMap.getCanvas(),{viewState:P}=c,D=this.olLayer.getVisible();this.renderState.visible!==D&&(u.style.display=D?"block":"none",this.renderState.visible=D,u.style.position="absolute");let F=this.olLayer.getOpacity();this.renderState.opacity!==F&&(u.style.opacity=F,this.renderState.opacity=F);let{rotation:U}=P;this.renderState.rotation!==U&&(this.mbMap.rotateTo(-(U||0)*180/Math.PI,{animate:!1}),i=!0,this.renderState.rotation=U),(this.renderState.zoom!==P.zoom||this.renderState.center[0]!==P.center[0]||this.renderState.center[1]!==P.center[1])&&(this.mbMap.jumpTo({center:ph(P.center),zoom:P.zoom-1,animate:!1}),i=!0,this.renderState.zoom=P.zoom,this.renderState.center=P.center);let N=this.map.getSize();if((this.renderState.size[0]!==N[0]||this.renderState.size[1]!==N[1])&&(i=!0,this.renderState.size=N),this.mbMap&&this.mbMap.style&&this.mbMap.isStyleLoaded()&&i)try{this.mbMap._frame&&(this.mbMap._frame.cancel(),this.mbMap._frame=null),this.mbMap._render()}catch(at){console.warn(at)}return this.mbMap.getContainer()}});super({...l,olLayer:o}),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.mbMap)&&(this.format=new gs({featureProjection:this.map.getView().getProjection()}),this.loadMbMap(),this.olListenersKeys.push(this.map.on("change:size",()=>{try{this.mbMap&&this.mbMap.resize()}catch(o){console.warn(o)}})))}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,o]=this.map.getView().getCenter();(!l||!o)&&(l=0,o=0);let c=document.createElement("div");c.style.position="absolute",c.style.width="100%",c.style.height="100%",!this.apiKey&&!this.styleUrl.includes(this.apiKeyName)&&console.warn(`No apiKey is defined for request to ${this.styleUrl}`),this.mbMap=new q0.Map({style:dc(this.styleUrl,{[this.apiKeyName]:this.apiKey}).toString(),container:c,interactive:!1,trackResize:!1,attributionControl:!1,...this.options.mapOptions||{}}),this.renderState={center:[l,o],zoom:null,rotation:null,visible:null,opacity:null,size:[0,0]},this.mbMap.once("load",()=>{this.mbMap.resize(),this.loaded=!0,this.copyrights=Iu(this.mbMap)||[],this.olLayer.getSource()?.setAttributions(this.copyrights),this.dispatchEvent({type:"load",target:this})});let i=this.mbMap.getCanvas();i&&(this.options.tabIndex?i.setAttribute("tabindex",this.options.tabIndex):i.removeAttribute("tabindex")),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(l){let o=Iu(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(ph(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})}clone(l){return new lp({...this.options,...l})}};var W0=Bp(X0());var up=class extends xa{constructor(l={}){let o=new mc({source:new bh({}),render:c=>{if(!this.map||!this.mbMap)return null;let i=this.mbMap.getCanvas(),{viewState:u}=c,P=this.olLayer.getOpacity();return i.style.opacity=P,this.mbMap.jumpTo({center:ph(u.center),zoom:u.zoom-1,bearing:Lv(-u.rotation),animate:!1}),i.isConnected?(i.width!==c.size[0]||i.height!==c.size[1])&&this.mbMap.resize():this.map.render(),this.mbMap.redraw(),this.mbMap.getContainer()}});super({...l,olLayer:o}),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 gs({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.url}`),this.mbMap=new W0.Map({style:dc(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=Iu(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(ph(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})}clone(l){return new up({...this.options,...l})}};var xd=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 xd({...this.options,...l})}},$0=xd;var I_=Bp(J0()),C_=Bp(i1());var JE=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 Gf(l),this.tenant=l.tenant||"",this.minZoomNonTrain=l.minZoomNonTrain||9,this.minZoomInterpolation=l.minZoomInterpolation||8,this.format=new gs,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,C_.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,I_.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:_t}=l,Ct=c||1,kt=U||new Date;super.defineProperties(l),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{value:at||document.createElement("canvas")},style:{value:o||Jh},styleOptions:{value:{...Gp,..._t||{}}},speed:{get:()=>Ct,set:Vt=>{Ct=Vt,this.start()}},filter:{value:D,writable:!0},sort:{value:F,writable:!0},live:{value:N===!1?N:!0,writable:!0},time:{get:()=>kt,set:Vt=>{kt=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=qf(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,C_.default)(this.renderTrajectoriesInternal,u,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,I_.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=il([...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))}},Km=JE;var QE=new Wl({zIndex:2,image:new al({radius:5,fill:new Os({color:"#000000"})}),stroke:new ra({color:"#000000",width:6})}),tS=(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,[QE,new Wl({zIndex:3,image:new al({radius:4,fill:new Os({color:c})}),stroke:new ra({color:c,width:4})})]},Ym=tS;var eS=new Wl({zIndex:2,image:new al({radius:5,fill:new Os({color:"#000000"})}),stroke:new ra({color:"#000000",width:6})}),rS=new Wl({zIndex:3,image:new al({radius:4,fill:new Os({color:"#a0a0a0"})}),stroke:new ra({color:"#a0a0a0",width:4})}),iS=()=>[eS,rS],n1=iS;var nS=new gs,bd=class extends Km(xa){constructor(l={}){super({...l}),this.olLayer=l.olLayer||new l_({layers:[new op({source:new ap({features:[]}),style:(o,c)=>(l.fullTrajectoryStyle||Ym)(o,c,this.styleOptions)}),new mc({source:new bh({}),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=Ev(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=nS.readFeatures(o);this.vectorLayer.getSource().addFeatures(i)})}clone(l){return new bd({...this.options,...l})}},o1=bd;var wd=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 wd({...this.options,...l})}},a1=wd;var Ed=class extends xa{constructor(l={}){super(l),this.abortController=new AbortController,this.format=new gs}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 Ed({...this.options,...l})}},s1=Ed;var tg={};Yg(tg,{CopyrightControl:()=>l1,Layer:()=>Jm,RealtimeAPI:()=>Gf,RealtimeLayer:()=>E1,RealtimeModes:()=>Zo,RoutingAPI:()=>Nf,StopsAPI:()=>Vf,createTrackerFilters:()=>ry,getCircleCanvas:()=>hy,getDelayBgCanvas:()=>uy,getDelayTextCanvas:()=>cy,getHoursAndMinutes:()=>_v,getLayersAsFlatArray:()=>jf,getMapboxMapCopyrights:()=>Iu,getTextCanvas:()=>py,getUTCDateString:()=>gv,getUTCTimeString:()=>yv,getUrlWithParams:()=>dc,pad:()=>fm,realtimeDefaultStyle:()=>Jh,realtimeDelayStyle:()=>fy,realtimeSimpleStyle:()=>dy,removeDuplicate:()=>Hh,renderTrajectories:()=>qf,sortByDelay:()=>iy,trackerConfig:()=>Gp});var A_=class extends vm(uh){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 Iu(this.map)}},l1=A_;var Sd=class extends Zm(sp){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 Hf([...l[0],...l[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(l){return new Sd({...this.options,...l})}},Jm=Sd;var Fo=63710088e-1,u1={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},YB={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 c1(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 Sh(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(!P_(v[0])||!P_(v[1]))throw new Error("coordinates must contain numbers");var c={type:"Point",coordinates:v};return c1(c,l,o)}function oS(v,l){l===void 0&&(l="kilometers");var o=u1[l];if(!o)throw new Error(l+" units is invalid");return v*o}function aS(v,l){l===void 0&&(l="kilometers");var o=u1[l];if(!o)throw new Error(l+" units is invalid");return v/o}function h1(v){var l=v%(2*Math.PI);return l*180/Math.PI}function cp(v){var l=v%360;return l*Math.PI/180}function Qm(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 oS(aS(v,l),o)}function P_(v){return!isNaN(v)&&v!==null&&!Array.isArray(v)}function M_(v){return!!v&&v.constructor===Object}function Td(v,l,o){if(v!==null)for(var c,i,u,P,D,F,U,N=0,at=0,_t,Ct=v.type,kt=Ct==="FeatureCollection",Vt=Ct==="Feature",wt=kt?v.features.length:1,Lt=0;Lt<wt;Lt++){U=kt?v.features[Lt].geometry:Vt?v.geometry:v,_t=U?U.type==="GeometryCollection":!1,D=_t?U.geometries.length:1;for(var Zt=0;Zt<D;Zt++){var Jt=0,se=0;if(P=_t?U.geometries[Zt]:U,P!==null){F=P.coordinates;var ce=P.type;switch(N=o&&(ce==="Polygon"||ce==="MultiPolygon")?1:0,ce){case null:break;case"Point":if(l(F,at,Lt,Jt,se)===!1)return!1;at++,Jt++;break;case"LineString":case"MultiPoint":for(c=0;c<F.length;c++){if(l(F[c],at,Lt,Jt,se)===!1)return!1;at++,ce==="MultiPoint"&&Jt++}ce==="LineString"&&Jt++;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,Lt,Jt,se)===!1)return!1;at++}ce==="MultiLineString"&&Jt++,ce==="Polygon"&&se++}ce==="Polygon"&&Jt++;break;case"MultiPolygon":for(c=0;c<F.length;c++){for(se=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,Lt,Jt,se)===!1)return!1;at++}se++}Jt++}break;case"GeometryCollection":for(c=0;c<P.geometries.length;c++)if(Td(P.geometries[c],l,o)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function sS(v,l){l===void 0&&(l={});var o=0,c=0,i=0;return Td(v,function(u){o+=u[0],c+=u[1],i++},!0),Sh([o/i,c/i],l.properties)}var p1=sS;function Ou(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 f1(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 lS(v,l,o){o===void 0&&(o={});var c;o.final?c=d1(Ou(l),Ou(v)):c=d1(Ou(v),Ou(l));var i=c>180?-(360-c):c;return i}function d1(v,l){var o=cp(v[1]),c=cp(l[1]),i=cp(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(h1(P)+360)%360}var m1=lS;function uS(v,l,o){o===void 0&&(o={});var c=Ou(v),i=Ou(l);i[0]+=i[0]-c[0]>180?-360:c[0]-i[0]>180?360:0;var u=cS(c,i),P=Qm(u,"meters",o.units);return P}function cS(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 g1=uS;function hS(v,l,o,c){c===void 0&&(c={});var i=l<0,u=Qm(Math.abs(l),c.units,"meters");i&&(u=-Math.abs(u));var P=Ou(v),D=pS(P,u,o);return D[0]+=D[0]-P[0]>180?-360:P[0]-D[0]>180?360:0,Sh(D,c.properties)}function pS(v,l,o,c){c=c===void 0?Fo:Number(c);var i=l/c,u=v[0]*Math.PI/180,P=cp(v[1]),D=cp(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),_t=i*Math.sin(D)/at,Ct=u+_t;return[(Ct*180/Math.PI+540)%360-180,U*180/Math.PI]}var y1=hS;function fS(v){if(!v)throw new Error("geojson is required");switch(v.type){case"Feature":return _1(v);case"FeatureCollection":return dS(v);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return L_(v);default:throw new Error("unknown GeoJSON type")}}function _1(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=v1(v.properties),l.geometry=L_(v.geometry),l}function v1(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]=v1(c):l[o]=c}),l}function dS(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 _1(o)}),l}function L_(v){var l={type:v.type};return v.bbox&&(l.bbox=v.bbox),v.type==="GeometryCollection"?(l.geometries=v.geometries.map(function(o){return L_(o)}),l):(l.coordinates=x1(v.coordinates),l)}function x1(v){var l=v;return typeof l[0]!="object"?l.slice():l.map(function(o){return x1(o)})}var b1=fS;function mS(v,l,o){if(o=o||{},!M_(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=p1(v)),(i===!1||i===void 0)&&(v=b1(v)),Td(v,function(u){var P=m1(c,u),D=P+l,F=g1(c,u),U=f1(y1(c,F,D));u[0]=U[0],u[1]=U[1]})),v}var k_=mS;var w1=v=>{let l=v.getBounds().toArray(),o=ro(l[0]),c=ro(l[1]),i=[...o,...c],{width:u,height:P}=v.getCanvas(),D=ps(i)/u,F=Mu(i)/P;return Math.max(D,F)},z_=(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 R_=class extends Km(Jm){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:z_(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.getLayer(this.key)&&this.map.removeLayer(this.key),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=k_(Sh([u.lng,u.lat]),-this.map.getBearing(),{pivot:[i.lng,i.lat]}).geometry.coordinates,F=k_(Sh([P.lng,P.lat]),-this.map.getBearing(),{pivot:[i.lng,i.lat]}).geometry.coordinates,U=[...ro(D),...ro(F)],N=ps(U)/(o/this.pixelRatio),at=Mu(U)/(c/this.pixelRatio),_t=Math.max(N,at),Ct={size:[o/this.pixelRatio,c/this.pixelRatio],center:ro([i.lng,i.lat]),extent:U,resolution:_t,zoom:this.map.getZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(Ct,l)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(l,o={}){let c=w1(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=z_(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"}},E1=R_;var D_={ol:Hm,mapbox:tg};typeof window<"u"&&(window.mbt=D_);var X5=D_;})();
|
|
1008
1008
|
//# sourceMappingURL=mbt.min.js.map
|