>3}a--,1===o||2===o?(s+=t.readSVarint(),u+=t.readSVarint(),1===o&&l>h&&(n.push(l),h=l),r.push(s,u),l+=2):7===o?l>h&&(r.push(r[h],r[h+1]),l+=2):lt(!1,59)}l>h&&(n.push(l),h=l)},e.prototype.createFeature_=function(t,e,r){var n,i=e.type;if(0===i)return null;var o,a=e.properties;this.idProperty_?(o=a[this.idProperty_],delete a[this.idProperty_]):o=e.id,a[this.layerName_]=e.layer.name;var s=[],u=[];this.readRawGeometry_(t,e,s,u);var l=function(t,e){var r;1===t?r=1===e?yt.POINT:yt.MULTI_POINT:2===t?r=1===e?yt.LINE_STRING:yt.MULTI_LINE_STRING:3===t&&(r=yt.POLYGON);return r}(i,u.length);if(this.featureClass_===tg)(n=new this.featureClass_(l,s,u,a,o)).transform(r.dataProjection,r.featureProjection);else{var h=void 0;if(l==yt.POLYGON){for(var c=[],p=0,f=0,d=0,g=u.length;d1?new Kd(s,pt,c):new Ln(s,pt,u)}else h=l===yt.POINT?new gn(s,pt):l===yt.LINE_STRING?new Cd(s,pt):l===yt.POLYGON?new Ln(s,pt,u):l===yt.MULTI_POINT?new qd(s,pt):l===yt.MULTI_LINE_STRING?new Vd(s,pt,u):null;n=new(0,this.featureClass_),this.geometryName_&&n.setGeometryName(this.geometryName_);var m=Ud(h,!1,r);n.setGeometry(m),n.setId(o),n.setProperties(a,!0)}return n},e.prototype.getType=function(){return yu},e.prototype.readFeatures=function(t,e){var r=this.layers_,n=this.adaptOptions(e),i=yr(n.dataProjection);i.setWorldExtent(n.extent),n.dataProjection=i;var o=new Jd.a(t),a=o.readFields(rg,{}),s=[];for(var u in a)if(!r||-1!=r.indexOf(u)){var l=a[u],h=l?[0,0,l.extent,l.extent]:null;i.setExtent(h);for(var c=0,p=l.length;c=.05){for(var r="",n=t.split("\n"),i=yg.slice(0,Math.round(e/.1)),o=0,a=n.length;o0&&(r+="\n"),r+=n[o].split("").join(i);return r}return t}function vg(){return gg||(gg=dg(1,1).getContext("2d")),gg}function _g(t,e){return vg().measureText(t).width+(t.length-1)*e}var bg={};to&&W(to,M,(function(){bg={}}));var xg,wg,Sg=cg.e.isFunction,Tg=cg.e.convertFunction,Eg=cg.c.isExpression,Cg=cg.c.createPropertyExpression,Pg={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},Rg={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},Og={},Ig={zoom:0},Lg={};function Mg(t,e,r,n,i){var o=t.id;Lg[o]||(Lg[o]={});var a=Lg[o];if(!a[r]){var s=(t[e]||Og)[r],u=cg.f[e+"_"+t.type][r];void 0===s&&(s=u.default);var l=Eg(s);if(!l&&Sg(s)&&(s=Tg(s,u),l=!0),l){var h=function(t,e){var r=Cg(t,e);if("error"===r.result)throw new Error(r.value.map((function(t){return t.key+": "+t.message})).join(", "));return r.value}(s,u);a[r]=h.evaluate.bind(h)}else"color"==u.type&&(s=cg.a.parse(s)),a[r]=function(){return s}}return Ig.zoom=n,a[r](Ig,i)}var Fg={};function Ag(t,e){if(t){if(0===t.a||0===e)return;var r=t.a;return e=void 0===e?1:e,"rgba("+Math.round(255*t.r/r)+","+Math.round(255*t.g/r)+","+Math.round(255*t.b/r)+","+r*e+")"}return t}var kg=/^([^]*)\{(.*)\}([^]*)$/;function Ng(t,e){var r;do{if(r=t.match(kg)){var n=e[r[2]]||"";t=r[1]+n+r[3]}}while(r);return t}var jg=function(t,e,r,n,i,o,a){if(void 0===n&&(n=fg),"string"==typeof e&&(e=JSON.parse(e)),8!=e.version)throw new Error("glStyle version 8 required.");var s,u;if(o)if("undefined"!=typeof Image){var l=new Image;l.crossOrigin="anonymous",l.onload=function(){s=l,u=[l.width,l.height],t.changed(),l.onload=null},l.src=o}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){var h=self;h.postMessage({action:"loadImage",src:o}),h.addEventListener("message",(function(t){"imageLoaded"===t.data.action&&t.data.src===o&&(s=t.data.image,u=[s.width,s.height])}))}for(var c,p=Object(cg.b)(e.layers),f={},d=[],g=0,y=p.length;g=g.maxzoom)return"continue";var _=g.filter;if(!_||function(t,e,r,n){return t in Fg||(Fg[t]=Object(cg.d)(e).filter),Ig.zoom=n,Fg[t](Ig,r)}(y,_,c,l)){var b=void 0,x=void 0,w=void 0,R=void 0,O=void 0,I=void 0,L=d.index;if(3==h&&"fill"==g.type)if(x=Mg(g,"paint","fill-opacity",l,c),"fill-pattern"in v){var M=Mg(g,"paint","fill-pattern",l,c);if(M){var F="string"==typeof M?Ng(M,r):M.toString();if(s&&i&&i[F]){++p,(I=P[p])&&I.getFill()&&!I.getStroke()&&!I.getText()||(I=P[p]=new lh({fill:new zl})),w=I.getFill(),I.setZIndex(L);var A=C[ut=F+"."+x];if(!A)(ct=(ht=dg((lt=i[F]).width,lt.height)).getContext("2d")).globalAlpha=x,ct.drawImage(s,lt.x,lt.y,lt.width,lt.height,0,0,lt.width,lt.height),A=ct.createPattern(ht,"repeat"),C[ut]=A;w.setColor(A)}}}else(b=Ag(Mg(g,"paint","fill-color",l,c),x))&&("fill-outline-color"in v&&(O=Ag(Mg(g,"paint","fill-outline-color",l,c),x)),O||(O=b),++p,(I=P[p])&&I.getFill()&&I.getStroke()&&!I.getText()||(I=P[p]=new lh({fill:new zl,stroke:new nh})),(w=I.getFill()).setColor(b),(R=I.getStroke()).setColor(O),R.setWidth(1),I.setZIndex(L));if(1!=h&&"line"==g.type){b=!("line-pattern"in v)&&"line-color"in v?Ag(Mg(g,"paint","line-color",l,c),Mg(g,"paint","line-opacity",l,c)):void 0;var k=Mg(g,"paint","line-width",l,c);b&&k>0&&(++p,(I=P[p])&&I.getStroke()&&!I.getFill()&&!I.getText()||(I=P[p]=new lh({stroke:new nh})),(R=I.getStroke()).setLineCap(Mg(g,"layout","line-cap",l,c)),R.setLineJoin(Mg(g,"layout","line-join",l,c)),R.setMiterLimit(Mg(g,"layout","line-miter-limit",l,c)),R.setColor(b),R.setWidth(k),R.setLineDash(v["line-dasharray"]?Mg(g,"paint","line-dasharray",l,c).map((function(t){return t*k})):null),I.setZIndex(L))}var N=!1,j=null,G=0,D=void 0,z=void 0,U=void 0;if((1==h||2==h)&&"icon-image"in m){var B=Mg(g,"layout","icon-image",l,c);if(B){D="string"==typeof B?Ng(B,r):B.toString();var Y=void 0;if(s&&i&&i[D]){var V=Mg(g,"layout","icon-rotation-alignment",l,c);if(2==h){var W=t.getGeometry();if(W.getFlatMidpoint||W.getFlatMidpoints){var q=W.getExtent();if(Math.sqrt(Math.max(Math.pow((q[2]-q[0])/e,2),Math.pow((q[3]-q[1])/e,2)))>150){var X="MultiLineString"===W.getType()?W.getFlatMidpoints():W.getFlatMidpoint();if(wg||(wg=new tg("Point",xg=[NaN,NaN],[],{},null)),Y=wg,xg[0]=X[0],xg[1]=X[1],"line"===(Lt=Mg(g,"layout","symbol-placement",l,c))&&"map"===V)for(var Z=W.getStride(),K=W.getFlatCoordinates(),H=0,J=K.length-Z;H=rt&&X[0]<=it&&X[1]>=nt&&X[1]<=ot){G=Math.atan2(Q-et,tt-$);break}}}}}if(2!==h||Y){++p,(I=P[p])&&I.getImage()&&!I.getFill()&&!I.getStroke()||(I=P[p]=new lh),I.setGeometry(Y);var at=Mg(g,"layout","icon-size",l,c),st=void 0!==v["icon-color"]?Mg(g,"paint","icon-color",l,c):null,ut=D+"."+at;if(null!==st&&(ut+="."+st),!(z=E[ut])){var lt=i[D];if(null!==st){var ht,ct;(ct=(ht=dg(lt.width,lt.height)).getContext("2d")).drawImage(s,lt.x,lt.y,lt.width,lt.height,0,0,lt.width,lt.height);for(var pt=ct.getImageData(0,0,ht.width,ht.height),ft=0,dt=pt.data.length;ft0?new nh({width:_t,color:mt}):void 0,fill:vt?new zl({color:vt}):void 0})),I.setImage(z),j=I.getText(),I.setText(void 0),I.setGeometry(void 0),I.setZIndex(L),N=!0}var xt=void 0;if("text-field"in m)xt=Ng(Mg(g,"layout","text-field",l,c).toString(),r).trim(),x=Mg(g,"paint","text-opacity",l,c);if(xt&&x&&!U){N||(++p,(I=P[p])&&I.getText()&&!I.getFill()&&!I.getStroke()||(I=P[p]=new lh),I.setImage(void 0),I.setGeometry(void 0)),I.getText()||I.setText(j||new ph({padding:[2,2,2,2]})),j=I.getText();var wt=Math.round(Mg(g,"layout","text-size",l,c)),St=Mg(g,"layout","text-font",l,c),Tt=Mg(g,"layout","text-line-height",l,c),Et=hg()(a?a(St):St,wt,Tt),Ct=m["text-transform"];"uppercase"==Ct?xt=xt.toUpperCase():"lowercase"==Ct&&(xt=xt.toLowerCase());var Pt=Mg(g,"layout","text-max-width",l,c),Rt=Mg(g,"layout","text-letter-spacing",l,c),Ot=2==h?mg(xt,Rt):function t(e,r,n,i){if(-1!==e.indexOf("\n")){for(var o=e.split("\n"),a=[],s=0,u=o.length;s1){var p=vg();p.font=r;var f=p.measureText("M").width*n,d="";for(a=[],s=0,u=c.length;s0?_g(a[s-1],i):1/0,_=s.7*f&&_g(x,i)<.6*f){var w=b.split(" "),S=w.pop();_g(S,i)<.2*f&&(a[s]=w.join(" "),a[s+1]=S+" "+x),u-=1}}h=a.join("\n")}else h=e;h=mg(h,i),bg[l]=h}return h}(xt,Et,Pt,Rt);j.setText(Ot),j.setFont(Et),j.setRotation(pg(Mg(g,"layout","text-rotate",l,c)));var It=Mg(g,"layout","text-anchor",l,c),Lt=N||1==h?"point":Mg(g,"layout","symbol-placement",l,c);j.setPlacement(Lt);var Mt=Mg(g,"paint","text-halo-width",l,c),Ft=Mg(g,"layout","text-offset",l,c),At=Mg(g,"paint","text-translate",l,c),kt=0,Nt=0;if("point"==Lt){var jt="center";-1!==It.indexOf("left")?(jt="left",Nt=Mt):-1!==It.indexOf("right")&&(jt="right",Nt=-Mt),j.setTextAlign(jt);var Gt=Mg(g,"layout","text-rotation-alignment",l,c);j.setRotateWithView("map"==Gt)}else j.setMaxAngle(pg(Mg(g,"layout","text-max-angle",l,c))*xt.length/Ot.length),j.setTextAlign(),j.setRotateWithView(!1);var Dt="middle";0==It.indexOf("bottom")?(Dt="bottom",kt=-Mt-.5*(Tt-1)*wt):0==It.indexOf("top")&&(Dt="top",kt=Mt+.5*(Tt-1)*wt),j.setTextBaseline(Dt),j.setOffsetX(Ft[0]*wt+Nt+At[0]),j.setOffsetY(Ft[1]*wt+kt+At[1]),T.setColor(Ag(Mg(g,"paint","text-color",l,c),x)),j.setFill(T);var zt=Ag(Mg(g,"paint","text-halo-color",l,c),x);if(zt){S.setColor(zt),Mt*=2;var Ut=.5*wt;S.setWidth(Mt<=Ut?Mt:Ut),j.setStroke(S)}else j.setStroke(void 0);var Bt=Mg(g,"layout","text-padding",l,c),Yt=j.getPadding();Bt!==Yt[0]&&(Yt[0]=Yt[1]=Yt[2]=Yt[3]=Bt),I.setZIndex(L)}}},g=0,y=o.length;g-1?(P.length=p+1,P):void 0}};return t.setStyle(R),t.set("mapbox-source",c),t.set("mapbox-layers",d),R},Gg=r(6),Dg=r.n(Gg),zg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Ug(t){for(var e=[],r=0,n=t.length;r2?n[2]:""):t+r}function ay(t,e,r,n,i){return new Promise((function(o,a){if("object"!=typeof e&&(e=JSON.parse(e)),8!=e.version)return a(new Error("glStyle version 8 required."));if(!(t instanceof Rd||t instanceof ug))return a(new Error("Can only apply to VectorLayer or VectorTileLayer"));var s,u,l;function h(){l||e.sprite&&!s?l?(t.setStyle(l),o()):a(new Error("Something went wrong trying to apply style.")):(l=jg(t,e,r,i,s,u,ry),t.getStyle()?o():a(new Error("Nothing to show for source ["+r+"]")))}if(e.sprite){var c=.5==(window.devicePixelRatio>=1.5?.5:1)?"@2x":"",p=oy(e.sprite,n,c+".json");fetch(p,{credentials:"same-origin"}).then((function(t){return t.ok||""===c?t:(p=oy(e.sprite,n,".json"),fetch(p,{credentials:"same-origin"}))})).then((function(t){if(t.ok)return t.json();a(new Error("Problem fetching sprite from "+p+": "+t.statusText))})).then((function(t){if(void 0===t||0===Object.keys(t).length)return a(new Error("No sprites found."));s=t,u=oy(e.sprite,n,c+".png"),h()})).catch((function(t){a(new Error("Sprites cannot be loaded: "+p+": "+t.message))}))}else h()}))}new Hg;var sy=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function uy(t){return 0!==t.indexOf("mapbox://")?"":t.slice("mapbox://".length)}var ly=function(t){function e(e){var r=t.call(this,L)||this;return r.error=e,r}return sy(e,t),e}(h),hy="vector",cy=function(t){function e(e){var r=this,n=!("declutter"in e)||e.declutter,i=new ff({state:Ci,format:new ag});return(r=t.call(this,{source:i,declutter:n,className:e.className,opacity:e.opacity,visible:e.visible,zIndex:e.zIndex,minResolution:e.minResolution,maxResolution:e.maxResolution,minZoom:e.minZoom,maxZoom:e.maxZoom,renderOrder:e.renderOrder,renderBuffer:e.renderBuffer,renderMode:e.renderMode,map:e.map,updateWhileAnimating:e.updateWhileAnimating,updateWhileInteracting:e.updateWhileInteracting,preload:e.preload,useInterimTilesOnError:e.useInterimTilesOnError})||this).sourceId=e.source,r.layers=e.layers,r.accessToken=e.accessToken,r.fetchStyle(e.styleUrl),r}return sy(e,t),e.prototype.fetchStyle=function(t){var e=this,r=function(t,e){var r=uy(t);if(!r)return t;if(0!==r.indexOf("styles/"))throw new Error("unexpected style url: "+t);return"https://api.mapbox.com/styles/v1/"+r.slice("styles/".length)+"?&access_token="+e}(t,this.accessToken);fetch(r).then((function(t){if(!t.ok)throw new Error("unexpected response when fetching style: "+t.status);return t.json()})).then((function(t){e.onStyleLoad(t)})).catch((function(t){e.handleError(t)}))},e.prototype.onStyleLoad=function(t){var e,r,n=this;if(this.layers){for(var i={},o=0;o0){this.source_&&(this.source_.clear(),this.source_.addFeatures(l)),this.dispatchEvent(new yy(gy,t,l,i));break}}},e.prototype.registerListeners_=function(){var t=this.getMap();if(t){var e=this.target?this.target:t.getViewport();this.dropListenKeys_=[W(e,G,this.handleDrop,this),W(e,N,this.handleStop,this),W(e,j,this.handleStop,this),W(e,G,this.handleStop,this)]}},e.prototype.setActive=function(e){!this.getActive()&&e&&this.registerListeners_(),this.getActive()&&!e&&this.unregisterListeners_(),t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.unregisterListeners_(),t.prototype.setMap.call(this,e),this.getActive()&&this.registerListeners_()},e.prototype.tryReadFeatures_=function(t,e,r){try{return t.readFeatures(e,r)}catch(t){return null}},e.prototype.unregisterListeners_=function(){this.dropListenKeys_&&(this.dropListenKeys_.forEach(X),this.dropListenKeys_=null)},e.prototype.handleDrop=function(t){for(var e=t.dataTransfer.files,r=0,n=e.length;r1?1:-1;return e.endInteraction(this.duration_,r),this.lastScaleDelta_=0,!1},e.prototype.handleDownEvent=function(t){return!!_s(t)&&(!!this.condition_(t)&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0))},e}(as),by=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xy=function(t){function e(e,r,n){var i=t.call(this)||this;if(void 0!==n&&void 0===r)i.setFlatCoordinates(n,e);else{var o=r||0;i.setCenterAndRadius(e,o,n)}return i}return by(e,t),e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),void 0,this.layout)},e.prototype.closestPointXY=function(t,e,r,n){var i=this.flatCoordinates,o=t-i[0],a=e-i[1],s=o*o+a*a;if(s=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||ie(t,this.intersectsCoordinate.bind(this)))}return!1},e.prototype.setCenter=function(t){var e=this.stride,r=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+r;for(var i=1;i=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,r=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0));return this.freehand_&&e.type===Ho.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(e.coordinate),n=!1):this.freehand_&&e.type===Ho.POINTERDOWN?n=!1:r?(n=e.type===Ho.POINTERMOVE)&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.preventDefault()):("mouse"==e.originalEvent.pointerType||e.type===Ho.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(e):e.type===Ho.DBLCLICK&&(n=!1),t.prototype.handleEvent.call(this,e)&&n},e.prototype.handleDownEvent=function(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(function(){this.handlePointerMove_(new Ko(Ho.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))}.bind(this),this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)},e.prototype.handleUpEvent=function(t){var e=!0;this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t);var r=this.mode_===Py;return this.shouldHandle_?(this.finishCoordinate_?this.freehand_||r?this.finishDrawing():this.atFinish_(t)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t.coordinate):(this.startDrawing_(t),this.mode_===Ty&&this.finishDrawing()),e=!1):this.freehand_&&this.abortDrawing(),!e&&this.stopClick_&&t.stopPropagation(),e},e.prototype.handlePointerMove_=function(t){if(this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){var e=this.downPx_,r=t.pixel,n=e[0]-r[0],i=e[1]-r[1],o=n*n+i*i;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return}this.finishCoordinate_?this.modifyDrawing_(t):this.createOrUpdateSketchPoint_(t)},e.prototype.atFinish_=function(t){var e=!1;if(this.sketchFeature_){var r=!1,n=[this.finishCoordinate_];if(this.mode_===Ey)r=this.sketchCoords_.length>this.minPoints_;else if(this.mode_===Cy){var i=this.sketchCoords_;r=i[0].length>this.minPoints_,n=[i[0][0],i[0][i[0].length-2]]}if(r)for(var o=t.map,a=0,s=n.length;a=this.maxPoints_&&(this.freehand_?r.pop():e=!0),r.push(t.slice()),this.geometryFunction_(r,n,i)):this.mode_===Cy&&((r=this.sketchCoords_[0]).length>=this.maxPoints_&&(this.freehand_?r.pop():e=!0),r.push(t.slice()),e&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,n,i)),this.updateSketchFeatures_(),e&&this.finishDrawing()},e.prototype.removeLastPoint=function(){if(this.sketchFeature_){var t,e=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection();this.mode_===Ey?((t=this.sketchCoords_).splice(-2,1),this.geometryFunction_(t,e,r),t.length>=2&&(this.finishCoordinate_=t[t.length-2].slice())):this.mode_===Cy&&((t=this.sketchCoords_[0]).splice(-2,1),this.sketchLine_.getGeometry().setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,r)),0===t.length&&this.abortDrawing(),this.updateSketchFeatures_()}},e.prototype.finishDrawing=function(){var t=this.abortDrawing_();if(t){var e=this.sketchCoords_,r=t.getGeometry(),n=this.getMap().getView().getProjection();this.mode_===Ey?(e.pop(),this.geometryFunction_(e,r,n)):this.mode_===Cy&&(e[0].pop(),this.geometryFunction_(e,r,n),e=r.getCoordinates()),this.type_===yt.MULTI_POINT?t.setGeometry(new qd([e])):this.type_===yt.MULTI_LINE_STRING?t.setGeometry(new Vd([e])):this.type_===yt.MULTI_POLYGON&&t.setGeometry(new Kd([e])),this.dispatchEvent(new Ly(Oy,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}},e.prototype.abortDrawing_=function(){this.finishCoordinate_=null;var t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),t},e.prototype.abortDrawing=function(){var t=this.abortDrawing_();t&&this.dispatchEvent(new Ly(Iy,t))},e.prototype.appendCoordinates=function(t){var e=this.mode_,r=[];e===Ey?r=this.sketchCoords_:e===Cy&&(r=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]);for(var n=r.pop(),i=0;ic?o[1]:o[0]),a}}return null},e.prototype.handlePointerMove_=function(t){var e=t.pixel,r=t.map,n=this.snapToVertex_(e,r);n||(n=r.getCoordinateFromPixelInternal(e)),this.createOrUpdatePointerFeature_(n)},e.prototype.createOrUpdateExtentFeature_=function(t){var e=this.extentFeature_;return e?t?e.setGeometry(Fn(t)):e.setGeometry(void 0):(e=new ct(t?Fn(t):{}),this.extentFeature_=e,this.extentOverlay_.getSource().addFeature(e)),e},e.prototype.createOrUpdatePointerFeature_=function(t){var e=this.vertexFeature_;e?e.getGeometry().setCoordinates(t):(e=new ct(new gn(t)),this.vertexFeature_=e,this.vertexOverlay_.getSource().addFeature(e));return e},e.prototype.handleEvent=function(e){return!e.originalEvent||!this.condition_(e)||(e.type!=Ho.POINTERMOVE||this.handlingDownUpSequence||this.handlePointerMove_(e),t.prototype.handleEvent.call(this,e),!1)},e.prototype.handleDownEvent=function(t){var e=t.pixel,r=t.map,n=this.getExtentInternal(),i=this.snapToVertex_(e,r),o=function(t){var e=null,r=null;return t[0]==n[0]?e=n[2]:t[0]==n[2]&&(e=n[0]),t[1]==n[1]?r=n[3]:t[1]==n[3]&&(r=n[1]),null!==e&&null!==r?[e,r]:null};if(i&&n){var a=i[0]==n[0]||i[0]==n[2]?i[0]:null,s=i[1]==n[1]||i[1]==n[3]?i[1]:null;null!==a&&null!==s?this.pointerHandler_=jy(o(i)):null!==a?this.pointerHandler_=Gy(o([a,n[1]]),o([a,n[3]])):null!==s&&(this.pointerHandler_=Gy(o([n[0],s]),o([n[2],s])))}else i=r.getCoordinateFromPixelInternal(e),this.setExtent([i[0],i[1],i[0],i[1]]),this.pointerHandler_=jy(i);return!0},e.prototype.handleDragEvent=function(t){if(this.pointerHandler_){var e=t.coordinate;this.setExtent(this.pointerHandler_(e)),this.createOrUpdatePointerFeature_(e)}},e.prototype.handleUpEvent=function(t){this.pointerHandler_=null;var e=this.getExtentInternal();return e&&0!==oe(e)||this.setExtent(null),!1},e.prototype.setMap=function(e){this.extentOverlay_.setMap(e),this.vertexOverlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getExtent=function(){return kr(this.getExtentInternal(),this.getMap().getView().getProjection())},e.prototype.getExtentInternal=function(){return this.extent_},e.prototype.setExtent=function(t){this.extent_=t||null,this.createOrUpdateExtentFeature_(t),this.dispatchEvent(new ky(this.extent_))},e}(as),zy=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Uy=[0,0,0,0],By=[],Yy="modifystart",Vy="modifyend",Wy=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.features=r,i.mapBrowserEvent=n,i}return zy(e,t),e}(h);function qy(t,e){return t.index-e.index}function Xy(t,e,r){var n=e.geometry;if(n.getType()===yt.CIRCLE){var i=n;if(1===e.index){var o=Mr();o&&(i=i.clone().transform(o,r));var a=sr(i.getCenter(),Ar(t,r)),s=Math.sqrt(a)-i.getRadius();return s*s}}var u=Ar(t,r);return By[0]=Ar(e.segment[0],r),By[1]=Ar(e.segment[1],r),lr(u,By)}function Zy(t,e,r){var n=e.geometry;if(n.getType()===yt.CIRCLE&&1===e.index){var i=n,o=Mr();return o&&(i=i.clone().transform(o,r)),Fr(i.getClosestPoint(Ar(t,r)),r)}var a=Ar(t,r);return By[0]=Ar(e.segment[0],r),By[1]=Ar(e.segment[1],r),Fr(er(a,By),r)}var Ky=function(t){function e(e){var r,n,i=t.call(this,e)||this;if(i.boundHandleFeatureChange_=i.handleFeatureChange_.bind(i),i.condition_=e.condition?e.condition:bs,i.defaultDeleteCondition_=function(t){return us(t)&&gs(t)},i.deleteCondition_=e.deleteCondition?e.deleteCondition:i.defaultDeleteCondition_,i.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:ps,i.vertexFeature_=null,i.vertexSegments_=null,i.lastPixel_=[0,0],i.ignoreNextSingleClick_=!1,i.modified_=!1,i.rBush_=new ic,i.pixelTolerance_=void 0!==e.pixelTolerance?e.pixelTolerance:10,i.snappedToVertex_=!1,i.changingFeature_=!1,i.dragSegments_=[],i.overlay_=new Rd({source:new cc({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:(r=sh(),function(t,e){return r[yt.POINT]}),updateWhileAnimating:!0,updateWhileInteracting:!0}),i.SEGMENT_WRITERS_={Point:i.writePointGeometry_.bind(i),LineString:i.writeLineStringGeometry_.bind(i),LinearRing:i.writeLineStringGeometry_.bind(i),Polygon:i.writePolygonGeometry_.bind(i),MultiPoint:i.writeMultiPointGeometry_.bind(i),MultiLineString:i.writeMultiLineStringGeometry_.bind(i),MultiPolygon:i.writeMultiPolygonGeometry_.bind(i),Circle:i.writeCircleGeometry_.bind(i),GeometryCollection:i.writeGeometryCollectionGeometry_.bind(i)},i.source_=null,e.source?(i.source_=e.source,n=new ut(i.source_.getFeatures()),i.source_.addEventListener(oc,i.handleSourceAdd_.bind(i)),i.source_.addEventListener(uc,i.handleSourceRemove_.bind(i))):n=e.features,!n)throw new Error("The modify interaction requires features or a source");return i.features_=n,i.features_.forEach(i.addFeature_.bind(i)),i.features_.addEventListener(nt,i.handleFeatureAdd_.bind(i)),i.features_.addEventListener(it,i.handleFeatureRemove_.bind(i)),i.lastPointerEvent_=null,i}return zy(e,t),e.prototype.addFeature_=function(t){var e=t.getGeometry();if(e){var r=this.SEGMENT_WRITERS_[e.getType()];r&&r(t,e)}var n=this.getMap();n&&n.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,n),t.addEventListener(I,this.boundHandleFeatureChange_)},e.prototype.willModifyFeatures_=function(t){this.modified_||(this.modified_=!0,this.dispatchEvent(new Wy(Yy,this.features_,t)))},e.prototype.removeFeature_=function(t){this.removeFeatureSegmentData_(t),this.vertexFeature_&&0===this.features_.getLength()&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.removeEventListener(I,this.boundHandleFeatureChange_)},e.prototype.removeFeatureSegmentData_=function(t){var e=this.rBush_,r=[];e.forEach((function(e){t===e.feature&&r.push(e)}));for(var n=r.length-1;n>=0;--n){for(var i=r[n],o=this.dragSegments_.length-1;o>=0;--o)this.dragSegments_[o][0]===i&&this.dragSegments_.splice(o,1);e.remove(i)}},e.prototype.setActive=function(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.overlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getOverlay=function(){return this.overlay_},e.prototype.handleSourceAdd_=function(t){t.feature&&this.features_.push(t.feature)},e.prototype.handleSourceRemove_=function(t){t.feature&&this.features_.remove(t.feature)},e.prototype.handleFeatureAdd_=function(t){this.addFeature_(t.element)},e.prototype.handleFeatureChange_=function(t){if(!this.changingFeature_){var e=t.target;this.removeFeature_(e),this.addFeature_(e)}},e.prototype.handleFeatureRemove_=function(t){var e=t.element;this.removeFeature_(e)},e.prototype.writePointGeometry_=function(t,e){var r=e.getCoordinates(),n={feature:t,geometry:e,segment:[r,r]};this.rBush_.insert(e.getExtent(),n)},e.prototype.writeMultiPointGeometry_=function(t,e){for(var r=e.getCoordinates(),n=0,i=r.length;n=0;--y)this.insertVertex_.apply(this,i[y])}return!!this.vertexFeature_},e.prototype.handleUpEvent=function(t){for(var e=this.dragSegments_.length-1;e>=0;--e){var r=this.dragSegments_[e][0],n=r.geometry;if(n.getType()===yt.CIRCLE){var i=n.getCenter(),o=r.featureSegments[0],a=r.featureSegments[1];o.segment[0]=i,o.segment[1]=i,a.segment[0]=i,a.segment[1]=i,this.rBush_.update(Ht(i),o);var s=n,u=Mr();if(u){var l=t.map.getView().getProjection();s=An(s=s.clone().transform(u,l)).transform(l,u)}this.rBush_.update(s.getExtent(),a)}else this.rBush_.update(Dt(r.segment),r)}return this.modified_&&(this.dispatchEvent(new Wy(Vy,this.features_,t)),this.modified_=!1),!1},e.prototype.handlePointerMove_=function(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map,t.coordinate)},e.prototype.handlePointerAtPixel_=function(t,e,r){var n=r||e.getCoordinateFromPixel(t),i=e.getView().getProjection(),a=kr(zt(Nr(Ht(n,Uy),i),e.getView().getResolution()*this.pixelTolerance_,Uy),i),s=this.rBush_.getInExtent(a);if(s.length>0){s.sort((function(t,e){return Xy(n,t,i)-Xy(n,e,i)}));var u=s[0],l=u.segment,h=Zy(n,u,i),c=e.getPixelFromCoordinate(h),p=ur(t,c);if(p<=this.pixelTolerance_){var f={};if(u.geometry.getType()===yt.CIRCLE&&1===u.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(h);else{var d=e.getPixelFromCoordinate(l[0]),g=e.getPixelFromCoordinate(l[1]),y=sr(c,d),m=sr(c,g);p=Math.sqrt(Math.min(y,m)),this.snappedToVertex_=p<=this.pixelTolerance_,this.snappedToVertex_&&(h=y>m?l[1]:l[0]),this.createOrUpdateVertexFeature_(h);for(var v=1,_=s.length;v<_;++v){var b=s[v].segment;if(!(ir(l[0],b[0])&&ir(l[1],b[1])||ir(l[0],b[1])&&ir(l[1],b[0])))break;f[o(b)]=!0}}return f[o(l)]=!0,void(this.vertexSegments_=f)}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},e.prototype.insertVertex_=function(t,e){for(var r,n=t.segment,i=t.feature,o=t.geometry,a=t.depth,s=t.index;e.length=0;--i)c=o((h=(r=p[i])[0]).feature),h.depth&&(c+="-"+h.depth.join("-")),c in f||(f[c]={}),0===r[1]?(f[c].right=h,f[c].index=h.index):1==r[1]&&(f[c].left=h,f[c].index=h.index+1);for(c in f){switch(l=f[c].right,s=f[c].left,(u=(a=f[c].index)-1)<0&&(u=0),t=e=(n=(h=void 0!==s?s:l).geometry).getCoordinates(),d=!1,n.getType()){case yt.MULTI_LINE_STRING:e[h.depth[0]].length>2&&(e[h.depth[0]].splice(a,1),d=!0);break;case yt.LINE_STRING:e.length>2&&(e.splice(a,1),d=!0);break;case yt.MULTI_POLYGON:t=t[h.depth[1]];case yt.POLYGON:(t=t[h.depth[0]]).length>4&&(a==t.length-1&&(a=0),t.splice(a,1),d=!0,0===a&&(t.pop(),t.push(t[0]),u=t.length-1))}if(d){this.setGeometryCoordinates_(n,e);var g=[];if(void 0!==s&&(this.rBush_.remove(s),g.push(s.segment[0])),void 0!==l&&(this.rBush_.remove(l),g.push(l.segment[1])),void 0!==s&&void 0!==l){var y={depth:h.depth,feature:h.feature,geometry:h.geometry,index:u,segment:g};this.rBush_.insert(Dt(y.segment),y)}this.updateSegmentIndices_(n,a,h.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),p.length=0}}return d},e.prototype.setGeometryCoordinates_=function(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1},e.prototype.updateSegmentIndices_=function(t,e,r,n){this.rBush_.forEachInExtent(t.getExtent(),(function(i){i.geometry===t&&(void 0===r||void 0===i.depth||_(i.depth,r))&&i.index>e&&(i.index+=n)}))},e}(as),Hy=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Jy="select",$y=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.selected=r,o.deselected=n,o.mapBrowserEvent=i,o}return Hy(e,t),e}(h),Qy={};var tm=function(t){function e(e){var r,n,i=t.call(this)||this,o=e||{};if(i.boundAddFeature_=i.addFeature_.bind(i),i.boundRemoveFeature_=i.removeFeature_.bind(i),i.condition_=o.condition?o.condition:gs,i.addCondition_=o.addCondition?o.addCondition:ds,i.removeCondition_=o.removeCondition?o.removeCondition:ds,i.toggleCondition_=o.toggleCondition?o.toggleCondition:ms,i.multi_=!!o.multi&&o.multi,i.filter_=o.filter?o.filter:x,i.hitTolerance_=o.hitTolerance?o.hitTolerance:0,i.style_=void 0!==o.style?o.style:(m((r=sh())[yt.POLYGON],r[yt.LINE_STRING]),m(r[yt.GEOMETRY_COLLECTION],r[yt.LINE_STRING]),function(t){return t.getGeometry()?r[t.getGeometry().getType()]:null}),i.features_=o.features||new ut,o.layers)if("function"==typeof o.layers)n=o.layers;else{var a=o.layers;n=function(t){return d(a,t)}}else n=x;return i.layerFilter_=n,i.featureLayerAssociation_={},i}return Hy(e,t),e.prototype.addFeatureLayerAssociation_=function(t,e){this.featureLayerAssociation_[o(t)]=e},e.prototype.getFeatures=function(){return this.features_},e.prototype.getHitTolerance=function(){return this.hitTolerance_},e.prototype.getLayer=function(t){return this.featureLayerAssociation_[o(t)]},e.prototype.setHitTolerance=function(t){this.hitTolerance_=t},e.prototype.setMap=function(e){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),t.prototype.setMap.call(this,e),e?(this.features_.addEventListener(nt,this.boundAddFeature_),this.features_.addEventListener(it,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(nt,this.boundAddFeature_),this.features_.removeEventListener(it,this.boundRemoveFeature_))},e.prototype.addFeature_=function(t){var e=t.element;this.style_&&this.applySelectedStyle_(e)},e.prototype.removeFeature_=function(t){var e=t.element;this.style_&&this.restorePreviousStyle_(e)},e.prototype.getStyle=function(){return this.style_},e.prototype.applySelectedStyle_=function(t){var e=o(t);e in Qy||(Qy[e]=t.getStyle()),t.setStyle(this.style_)},e.prototype.restorePreviousStyle_=function(t){var r=o(t),n=this.getMap().getInteractions().getArray().filter((function(r){return r instanceof e&&r.getStyle()&&-1!==r.getFeatures().getArray().indexOf(t)}));n.length>0?t.setStyle(n[n.length-1].getStyle()):(t.setStyle(Qy[r]),delete Qy[r])},e.prototype.removeFeatureLayerAssociation_=function(t){delete this.featureLayerAssociation_[o(t)]},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;var e=this.addCondition_(t),r=this.removeCondition_(t),n=this.toggleCondition_(t),i=!e&&!r&&!n,o=t.map,a=this.getFeatures(),s=[],u=[];if(i){E(this.featureLayerAssociation_),o.forEachFeatureAtPixel(t.pixel,function(t,e){if(this.filter_(t,e))return u.push(t),this.addFeatureLayerAssociation_(t,e),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var l=a.getLength()-1;l>=0;--l){var h=a.item(l),c=u.indexOf(h);c>-1?u.splice(c,1):(a.remove(h),s.push(h))}0!==u.length&&a.extend(u)}else{o.forEachFeatureAtPixel(t.pixel,function(t,i){if(this.filter_(t,i))return!e&&!n||d(a.getArray(),t)?(r||n)&&d(a.getArray(),t)&&(s.push(t),this.removeFeatureLayerAssociation_(t)):(u.push(t),this.addFeatureLayerAssociation_(t,i)),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var p=s.length-1;p>=0;--p)a.remove(s[p]);a.extend(u)}return(u.length>0||s.length>0)&&this.dispatchEvent(new $y(Jy,u,s,t)),!0},e}(es),em=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function rm(t){return t.feature?t.feature:t.element?t.element:void 0}var nm=[],im=function(t){function e(e){var r=this,n=e||{},i=n;return i.handleDownEvent||(i.handleDownEvent=x),i.stopDown||(i.stopDown=w),(r=t.call(this,i)||this).source_=n.source?n.source:null,r.vertex_=void 0===n.vertex||n.vertex,r.edge_=void 0===n.edge||n.edge,r.features_=n.features?n.features:null,r.featuresListenerKeys_=[],r.featureChangeListenerKeys_={},r.indexedFeaturesExtents_={},r.pendingFeatures_={},r.pixelTolerance_=void 0!==n.pixelTolerance?n.pixelTolerance:10,r.rBush_=new ic,r.SEGMENT_WRITERS_={Point:r.writePointGeometry_.bind(r),LineString:r.writeLineStringGeometry_.bind(r),LinearRing:r.writeLineStringGeometry_.bind(r),Polygon:r.writePolygonGeometry_.bind(r),MultiPoint:r.writeMultiPointGeometry_.bind(r),MultiLineString:r.writeMultiLineStringGeometry_.bind(r),MultiPolygon:r.writeMultiPolygonGeometry_.bind(r),GeometryCollection:r.writeGeometryCollectionGeometry_.bind(r),Circle:r.writeCircleGeometry_.bind(r)},r}return em(e,t),e.prototype.addFeature=function(t,e){var r=void 0===e||e,n=o(t),i=t.getGeometry();if(i){var a=this.SEGMENT_WRITERS_[i.getType()];a&&(this.indexedFeaturesExtents_[n]=i.getExtent([1/0,1/0,-1/0,-1/0]),a(t,i))}r&&(this.featureChangeListenerKeys_[n]=W(t,I,this.handleFeatureChange_,this))},e.prototype.forEachFeatureAdd_=function(t){this.addFeature(t)},e.prototype.forEachFeatureRemove_=function(t){this.removeFeature(t)},e.prototype.getFeatures_=function(){var t;return this.features_?t=this.features_:this.source_&&(t=this.source_.getFeatures()),t},e.prototype.handleEvent=function(e){var r=this.snapTo(e.pixel,e.coordinate,e.map);return r.snapped&&(e.coordinate=r.vertex.slice(0,2),e.pixel=r.vertexPixel),t.prototype.handleEvent.call(this,e)},e.prototype.handleFeatureAdd_=function(t){var e=rm(t);this.addFeature(e)},e.prototype.handleFeatureRemove_=function(t){var e=rm(t);this.removeFeature(e)},e.prototype.handleFeatureChange_=function(t){var e=t.target;if(this.handlingDownUpSequence){var r=o(e);r in this.pendingFeatures_||(this.pendingFeatures_[r]=e)}else this.updateFeature_(e)},e.prototype.handleUpEvent=function(t){var e=C(this.pendingFeatures_);return e.length&&(e.forEach(this.updateFeature_.bind(this)),this.pendingFeatures_={}),!1},e.prototype.removeFeature=function(t,e){var r=void 0===e||e,n=o(t),i=this.indexedFeaturesExtents_[n];if(i){var a=this.rBush_,s=[];a.forEachInExtent(i,(function(e){t===e.feature&&s.push(e)}));for(var u=s.length-1;u>=0;--u)a.remove(s[u])}r&&(X(this.featureChangeListenerKeys_[n]),delete this.featureChangeListenerKeys_[n])},e.prototype.setMap=function(e){var r=this.getMap(),n=this.featuresListenerKeys_,i=this.getFeatures_();r&&(n.forEach(X),n.length=0,i.forEach(this.forEachFeatureRemove_.bind(this))),t.prototype.setMap.call(this,e),e&&(this.features_?n.push(W(this.features_,nt,this.handleFeatureAdd_,this),W(this.features_,it,this.handleFeatureRemove_,this)):this.source_&&n.push(W(this.source_,oc,this.handleFeatureAdd_,this),W(this.source_,uc,this.handleFeatureRemove_,this)),i.forEach(this.forEachFeatureAdd_.bind(this)))},e.prototype.snapTo=function(t,e,r){var n=Dt([r.getCoordinateFromPixel([t[0]-this.pixelTolerance_,t[1]+this.pixelTolerance_]),r.getCoordinateFromPixel([t[0]+this.pixelTolerance_,t[1]-this.pixelTolerance_])]),i=this.rBush_.getInExtent(n);this.vertex_&&!this.edge_&&(i=i.filter((function(t){return t.feature.getGeometry().getType()!==yt.CIRCLE})));var o=!1,a=null,s=null;if(0===i.length)return{snapped:o,vertex:a,vertexPixel:s};for(var u,l=r.getView().getProjection(),h=Ar(e,l),c=1/0,p=0;p_?g[1]:g[0],s=r.getPixelFromCoordinate(a))}else if(this.edge_){var b=u.feature.getGeometry().getType()===yt.CIRCLE;if(b){var x=u.feature.getGeometry(),w=Mr();w&&(x=x.clone().transform(w,l)),a=Fr(function(t,e){var r=e.getRadius(),n=e.getCenter(),i=n[0],o=n[1],a=t[0]-i,s=t[1]-o;0===a&&0===s&&(a=1);var u=Math.sqrt(a*a+s*s);return[i+r*a/u,o+r*s/u]}(h,x),l)}else nm[0]=Ar(g[0],l),nm[1]=Ar(g[1],l),a=Fr(er(h,nm),l);if(ur(t,s=r.getPixelFromCoordinate(a))<=this.pixelTolerance_&&(o=!0,this.vertex_&&!b)){y=r.getPixelFromCoordinate(g[0]),m=r.getPixelFromCoordinate(g[1]),v=sr(s,y),_=sr(s,m);Math.sqrt(Math.min(v,_))<=this.pixelTolerance_&&(a=v>_?g[1]:g[0],s=r.getPixelFromCoordinate(a))}}return o&&(s=[Math.round(s[0]),Math.round(s[1])]),{snapped:o,vertex:a,vertexPixel:s}},e.prototype.updateFeature_=function(t){this.removeFeature(t,!1),this.addFeature(t,!1)},e.prototype.writeCircleGeometry_=function(t,e){var r=this.getMap().getView().getProjection(),n=e,i=Mr();i&&(n=n.clone().transform(i,r));var o=An(n);i&&o.transform(r,i);for(var a=o.getCoordinates()[0],s=0,u=a.length-1;s=0;r--){var l=o[r][0];if(Vt(new fn(l).getExtent(),new fn(s).getExtent())){o[r].push(s),u=!0;break}}u||o.push([s.reverse()])}return o}(o.rings,a);1===s.length?(i=yt.POLYGON,t=T({},t,((r={}).rings=s[0],r))):(i=yt.MULTI_POLYGON,t=T({},t,((n={}).rings=s,n)))}return Ud((0,pm[i])(t),!1,e)}function gm(t){var e=pt;return!0===t.hasZ&&!0===t.hasM?e=gt:!0===t.hasZ?e=ft:!0===t.hasM&&(e=dt),e}function ym(t){var e=t.getLayout();return{hasZ:e===ft||e===gt,hasM:e===dt||e===gt}}function mm(t,e){return(0,fm[t.getType()])(Ud(t,!0,e),e)}fm[yt.POINT]=function(t,e){var r,n=t.getCoordinates(),i=t.getLayout();i===ft?r={x:n[0],y:n[1],z:n[2]}:i===dt?r={x:n[0],y:n[1],m:n[2]}:i===gt?r={x:n[0],y:n[1],z:n[2],m:n[3]}:i===pt?r={x:n[0],y:n[1]}:lt(!1,34);return r},fm[yt.LINE_STRING]=function(t,e){var r=ym(t);return{hasZ:r.hasZ,hasM:r.hasM,paths:[t.getCoordinates()]}},fm[yt.POLYGON]=function(t,e){var r=ym(t);return{hasZ:r.hasZ,hasM:r.hasM,rings:t.getCoordinates(!1)}},fm[yt.MULTI_POINT]=function(t,e){var r=ym(t);return{hasZ:r.hasZ,hasM:r.hasM,points:t.getCoordinates()}},fm[yt.MULTI_LINE_STRING]=function(t,e){var r=ym(t);return{hasZ:r.hasZ,hasM:r.hasM,paths:t.getCoordinates()}},fm[yt.MULTI_POLYGON]=function(t,e){for(var r=ym(t),n=t.getCoordinates(!1),i=[],o=0;o=0;a--)i.push(n[o][a]);return{hasZ:r.hasZ,hasM:r.hasM,rings:i}};var vm=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this)||this).geometryName_=n.geometryName,r}return cm(e,t),e.prototype.readFeatureFromObject=function(t,e,r){var n=t,i=dm(n.geometry,e),o=new ct;if(this.geometryName_&&o.setGeometryName(this.geometryName_),o.setGeometry(i),n.attributes){o.setProperties(n.attributes,!0);var a=n.attributes[r];void 0!==a&&o.setId(a)}return o},e.prototype.readFeaturesFromObject=function(t,e){var r=e||{};if(t.features){for(var n=[],i=t.features,o=0,a=i.length;o0?r[0]:null},e.prototype.readFeatureFromNode=function(t,e){return null},e.prototype.readFeatures=function(t,e){if(t){if("string"==typeof t){var r=qu(t);return this.readFeaturesFromDocument(r,e)}return Wu(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}return[]},e.prototype.readFeaturesFromDocument=function(t,e){for(var r=[],n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&m(r,this.readFeaturesFromNode(n,e));return r},e.prototype.readFeaturesFromNode=function(t,e){return n()},e.prototype.readGeometry=function(t,e){if(t){if("string"==typeof t){var r=qu(t);return this.readGeometryFromDocument(r,e)}return Wu(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}return null},e.prototype.readGeometryFromDocument=function(t,e){return null},e.prototype.readGeometryFromNode=function(t,e){return null},e.prototype.readProjection=function(t){if(t){if("string"==typeof t){var e=qu(t);return this.readProjectionFromDocument(e)}return Wu(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}return null},e.prototype.readProjectionFromDocument=function(t){return this.dataProjection},e.prototype.readProjectionFromNode=function(t){return this.dataProjection},e.prototype.writeFeature=function(t,e){var r=this.writeFeatureNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeFeatureNode=function(t,e){return null},e.prototype.writeFeatures=function(t,e){var r=this.writeFeaturesNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeFeaturesNode=function(t,e){return null},e.prototype.writeGeometry=function(t,e){var r=this.writeGeometryNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeGeometryNode=function(t,e){return null},e}(zd),xm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),wm="http://www.opengis.net/gml",Sm=/^[\s\xa0]*$/,Tm=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.featureType=n.featureType,r.featureNS=n.featureNS,r.srsName=n.srsName,r.schemaLocation="",r.FEATURE_COLLECTION_PARSERS={},r.FEATURE_COLLECTION_PARSERS[r.namespace]={featureMember:Zu(r.readFeaturesInternal),featureMembers:Ku(r.readFeaturesInternal)},r}return xm(e,t),e.prototype.readFeaturesInternal=function(t,e){var r=t.localName,n=null;if("FeatureCollection"==r)n=ol([],this.FEATURE_COLLECTION_PARSERS,t,e,this);else if("featureMembers"==r||"featureMember"==r){var i=e[0],o=i.featureType,a=i.featureNS;if(!o&&t.childNodes){o=[],a={};for(var s=0,u=t.childNodes.length;s0){i[s]={_content_:i[s]};for(var l=0;l0:c===yt.POINT||c===yt.MULTI_POINT}}s&&(u=o.get("name"),(s=s&&!!u)&&u.search(/&[^&]+;/)>-1&&(g_||(g_=document.createElement("textarea")),g_.innerHTML=u,u=g_.value));var p=r;if(t?p=t:e&&(p=function t(e,r,n){return Array.isArray(e)?e:"string"==typeof e?(!(e in n)&&"#"+e in n&&(e="#"+e),t(n[e],r,n)):r}(e,r,n)),s){var f=function(t,e){var r=[0,0],n="start",i=t.getImage();if(i){var o=i.getImageSize();if(null===o&&(o=Dv),2==o.length){var a=i.getScaleArray();r[0]=a[0]*o[0]/2,r[1]=-a[1]*o[1]/2,n="left"}}var s=t.getText();s?((s=s.clone()).setFont(s.getFont()||f_.getFont()),s.setScale(s.getScale()||f_.getScale()),s.setFill(s.getFill()||f_.getFill()),s.setStroke(s.getStroke()||c_)):s=f_.clone();return s.setText(e),s.setOffsetX(r[0]),s.setOffsetY(r[1]),s.setTextAlign(n),new lh({image:i,text:s})}(p[0],u);return l.length>0?(f.setGeometry(new Bg(l)),[f,new lh({geometry:p[0].getGeometry(),image:null,fill:p[0].getFill(),stroke:p[0].getStroke(),text:null})].concat(p.slice(1))):f}return p}}(r.Style,r.styleUrl,this.defaultStyle_,this.sharedStyles_,this.showPointNames_);n.setStyle(s)}return delete r.Style,n.setProperties(r,!0),n}},e.prototype.readSharedStyle_=function(t,e){var r=t.getAttribute("id");if(null!==r){var n=W_.call(this,t,e);if(n){var i=void 0,o=t.baseURI;if(o&&"about:blank"!=o||(o=window.location.href),o)i=new URL("#"+r,o).href;else i="#"+r;this.sharedStyles_[i]=n}}},e.prototype.readSharedStyleMap_=function(t,e){var r=t.getAttribute("id");if(null!==r){var n=S_.call(this,t,e);if(n){var i,o=t.baseURI;if(o&&"about:blank"!=o||(o=window.location.href),o)i=new URL("#"+r,o).href;else i="#"+r;this.sharedStyles_[i]=n}}},e.prototype.readFeatureFromNode=function(t,e){if(!d(t_,t.namespaceURI))return null;var r=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return r||null},e.prototype.readFeaturesFromNode=function(t,e){if(!d(t_,t.namespaceURI))return[];var r,n=t.localName;if("Document"==n||"Folder"==n)return(r=this.readDocumentOrFolder_(t,[this.getReadOptions(t,e)]))||[];if("Placemark"==n){var i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i?[i]:[]}if("kml"==n){r=[];for(var o=t.firstElementChild;o;o=o.nextElementSibling){var a=this.readFeaturesFromNode(o,e);a&&m(r,a)}return r}return[]},e.prototype.readName=function(t){if(t){if("string"==typeof t){var e=qu(t);return this.readNameFromDocument(e)}return Wu(t)?this.readNameFromDocument(t):this.readNameFromNode(t)}},e.prototype.readNameFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE){var r=this.readNameFromNode(e);if(r)return r}},e.prototype.readNameFromNode=function(t){for(var e=t.firstElementChild;e;e=e.nextElementSibling)if(d(t_,e.namespaceURI)&&"name"==e.localName)return Fm(e);for(e=t.firstElementChild;e;e=e.nextElementSibling){var r=e.localName;if(d(t_,e.namespaceURI)&&("Document"==r||"Folder"==r||"Placemark"==r||"kml"==r)){var n=this.readNameFromNode(e);if(n)return n}}},e.prototype.readNetworkLinks=function(t){var e=[];if("string"==typeof t){var r=qu(t);m(e,this.readNetworkLinksFromDocument(r))}else Wu(t)?m(e,this.readNetworkLinksFromDocument(t)):m(e,this.readNetworkLinksFromNode(t));return e},e.prototype.readNetworkLinksFromDocument=function(t){for(var e=[],r=t.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&m(e,this.readNetworkLinksFromNode(r));return e},e.prototype.readNetworkLinksFromNode=function(t){for(var e=[],r=t.firstElementChild;r;r=r.nextElementSibling)if(d(t_,r.namespaceURI)&&"NetworkLink"==r.localName){var n=ol({},n_,r,[]);e.push(n)}for(r=t.firstElementChild;r;r=r.nextElementSibling){var i=r.localName;!d(t_,r.namespaceURI)||"Document"!=i&&"Folder"!=i&&"kml"!=i||m(e,this.readNetworkLinksFromNode(r))}return e},e.prototype.readRegion=function(t){var e=[];if("string"==typeof t){var r=qu(t);m(e,this.readRegionFromDocument(r))}else Wu(t)?m(e,this.readRegionFromDocument(t)):m(e,this.readRegionFromNode(t));return e},e.prototype.readRegionFromDocument=function(t){for(var e=[],r=t.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&m(e,this.readRegionFromNode(r));return e},e.prototype.readRegionFromNode=function(t){for(var e=[],r=t.firstElementChild;r;r=r.nextElementSibling)if(d(t_,r.namespaceURI)&&"Region"==r.localName){var n=ol({},o_,r,[]);e.push(n)}for(r=t.firstElementChild;r;r=r.nextElementSibling){var i=r.localName;!d(t_,r.namespaceURI)||"Document"!=i&&"Folder"!=i&&"kml"!=i||m(e,this.readRegionFromNode(r))}return e},e.prototype.writeFeaturesNode=function(t,e){e=this.adaptOptions(e);var r=Yu(t_[4],"kml"),n="http://www.w3.org/2000/xmlns/";r.setAttributeNS(n,"xmlns:gx",Qv[0]),r.setAttributeNS(n,"xmlns:xsi",Bu),r.setAttributeNS(Bu,"xsi:schemaLocation","http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd");var i={node:r},o={};t.length>1?o.Document=t:1==t.length&&(o.Placemark=t[0]);var a=a_[r.namespaceURI],s=rl(o,a);return sl(i,s_,el,s,[e],a,this),r},e}(bm);function v_(t){var e=Vu(t,!1),r=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e);if(r){var n=r[1];return[parseInt(n.substr(6,2),16),parseInt(n.substr(4,2),16),parseInt(n.substr(2,2),16),parseInt(n.substr(0,2),16)/255]}}function __(t){for(var e,r=Vu(t,!1),n=[],i=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?))?\s*/i;e=i.exec(r);){var o=parseFloat(e[1]),a=parseFloat(e[2]),s=e[3]?parseFloat(e[3]):0;n.push(o,a,s),r=r.substr(e[0].length)}if(""===r)return n}function b_(t){var e=Vu(t,!1).trim(),r=t.baseURI;return r&&"about:blank"!=r||(r=window.location.href),r?new URL(e,r).href:e}function x_(t){return Om(t)}var w_=nl(t_,{Pair:function(t,e){var r=ol({},J_,t,e,this);if(!r)return;var n=r.key;if(n&&"normal"==n){var i=r.styleUrl;i&&(e[e.length-1]=i);var o=r.Style;o&&(e[e.length-1]=o)}}});function S_(t,e){return ol(void 0,w_,t,e,this)}var T_=nl(t_,{Icon:Ju((function(t,e){var r=ol({},F_,t,e);return r||null})),color:Ju(v_),heading:Ju(Om),hotSpot:Ju((function(t){var e,r=t.getAttribute("xunits"),n=t.getAttribute("yunits");return e="insetPixels"!==r?"insetPixels"!==n?Yl:Wl:"insetPixels"!==n?Vl:ql,{x:parseFloat(t.getAttribute("x")),xunits:e_[r],y:parseFloat(t.getAttribute("y")),yunits:e_[n],origin:e}})),scale:Ju(x_)});var E_=nl(t_,{color:Ju(v_),scale:Ju(x_)});var C_=nl(t_,{color:Ju(v_),width:Ju(Om)});var P_=nl(t_,{color:Ju(v_),fill:Ju(Cm),outline:Ju(Cm)});var R_=nl(t_,{coordinates:Ku(__)});function O_(t,e){return ol(null,R_,t,e)}var I_=nl(Qv,{Track:Zu(M_)});var L_=nl(t_,{when:function(t,e){var r=e[e.length-1].whens,n=Vu(t,!1),i=Date.parse(n);r.push(isNaN(i)?0:i)}},nl(Qv,{coord:function(t,e){var r=e[e.length-1].flatCoordinates,n=Vu(t,!1),i=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(n);if(i){var o=parseFloat(i[1]),a=parseFloat(i[2]),s=parseFloat(i[3]);r.push(o,a,s,0)}else r.push(0,0,0,0)}}));function M_(t,e){var r=ol({flatCoordinates:[],whens:[]},L_,t,e);if(r){for(var n=r.flatCoordinates,i=r.whens,o=0,a=Math.min(n.length,i.length);o0,h=u.href;h?n=h:l&&(n=zv);var c,p=Yl,f=r.hotSpot;f?(i=[f.x,f.y],o=f.xunits,a=f.yunits,p=f.origin):n===zv?(i=Nv,o=jv,a=Gv):/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(n)&&(i=[.5,0],o=Ul,a=Ul);var d,g=u.x,y=u.y;void 0!==g&&void 0!==y&&(c=[g,y]);var m,v=u.w,_=u.h;void 0!==v&&void 0!==_&&(d=[v,_]);var b=r.heading;void 0!==b&&(m=Re(b));var x=r.scale,w=r.color;if(l){n==zv&&(d=Dv,void 0===x&&(x=Uv));var S=new rh({anchor:i,anchorOrigin:p,anchorXUnits:o,anchorYUnits:a,crossOrigin:this.crossOrigin_,offset:c,offsetOrigin:Yl,rotation:m,scale:x,size:d,src:n,color:w});s.imageStyle=S}else s.imageStyle=l_}},LabelStyle:function(t,e){var r=ol({},E_,t,e);if(r){var n=e[e.length-1],i=new ph({fill:new zl({color:"color"in r?r.color:kv}),scale:r.scale});n.textStyle=i}},LineStyle:function(t,e){var r=ol({},C_,t,e);if(r){var n=e[e.length-1],i=new nh({color:"color"in r?r.color:kv,width:"width"in r?r.width:1});n.strokeStyle=i}},PolyStyle:function(t,e){var r=ol({},P_,t,e);if(r){var n=e[e.length-1],i=new zl({color:"color"in r?r.color:kv});n.fillStyle=i;var o=r.fill;void 0!==o&&(n.fill=o);var a=r.outline;void 0!==a&&(n.outline=a)}}});function W_(t,e){var r=ol({},V_,t,e,this);if(!r)return null;var n,i="fillStyle"in r?r.fillStyle:u_,o=r.fill;void 0===o||o||(i=null),"imageStyle"in r?r.imageStyle!=l_&&(n=r.imageStyle):n=h_;var a="textStyle"in r?r.textStyle:f_,s="strokeStyle"in r?r.strokeStyle:p_,u=r.outline;return void 0===u||u?[new lh({fill:i,image:n,stroke:s,text:a,zIndex:void 0})]:[new lh({geometry:function(t){var e=t.getGeometry(),r=e.getType();return r===yt.GEOMETRY_COLLECTION?new Bg(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e!==yt.POLYGON&&e!==yt.MULTI_POLYGON}))):r!==yt.POLYGON&&r!==yt.MULTI_POLYGON?e:void 0},fill:i,image:n,stroke:s,text:a,zIndex:void 0}),new lh({geometry:function(t){var e=t.getGeometry(),r=e.getType();return r===yt.GEOMETRY_COLLECTION?new Bg(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e===yt.POLYGON||e===yt.MULTI_POLYGON}))):r===yt.POLYGON||r===yt.MULTI_POLYGON?e:void 0},fill:i,stroke:null,zIndex:void 0})]}function q_(t,e){var r,n,i,o=e.length,a=new Array(e.length),s=new Array(e.length),u=new Array(e.length);r=!1,n=!1,i=!1;for(var l=0;l0){var m=rl(i,a);sl(n,Pb,Ob,[{names:a,values:m}],r)}var v=r[0],_=e.getGeometry();_&&(_=Ud(_,!0,v)),sl(n,Pb,vb,[_],r)}var Lb=nl(t_,["extrude","tessellate","altitudeMode","coordinates"]),Mb=nl(t_,{extrude:$u(Am),tessellate:$u(Am),altitudeMode:$u(jm),coordinates:$u((function(t,e,r){var n,i=r[r.length-1],o=i.layout,a=i.stride;o==pt||o==dt?n=2:o==ft||o==gt?n=3:lt(!1,34);var s=e.length,u="";if(s>0){u+=e[0];for(var l=1;l>1):i>>1}return e}(t),i=0,o=n.length;i=32;)e=63+(32|31&t),r+=String.fromCharCode(e),t>>=5;return e=t+63,r+=String.fromCharCode(e)}var ox=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.dataProjection=yr("EPSG:4326"),r.factor_=n.factor?n.factor:1e5,r.geometryLayout_=n.geometryLayout?n.geometryLayout:pt,r}return Qb(e,t),e.prototype.readFeatureFromText=function(t,e){var r=this.readGeometryFromText(t,e);return new ct(r)},e.prototype.readFeaturesFromText=function(t,e){return[this.readFeatureFromText(t,e)]},e.prototype.readGeometryFromText=function(t,e){var r=Wr(this.geometryLayout_),n=ex(t,r,this.factor_);$b(n,0,n.length,r,n);var i=sn(n,0,n.length,r);return Ud(new Cd(i,this.geometryLayout_),!1,this.adaptOptions(e))},e.prototype.writeFeatureText=function(t,e){var r=t.getGeometry();return r?this.writeGeometryText(r,e):(lt(!1,40),"")},e.prototype.writeFeaturesText=function(t,e){return this.writeFeatureText(t[0],e)},e.prototype.writeGeometryText=function(t,e){var r=(t=Ud(t,!0,this.adaptOptions(e))).getFlatCoordinates(),n=t.getStride();return $b(r,0,r.length,n,r),tx(r,n,this.factor_)},e}(Bv),ax=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),sx=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.layerName_=n.layerName,r.layers_=n.layers?n.layers:null,r.dataProjection=yr(n.dataProjection?n.dataProjection:"EPSG:4326"),r}return ax(e,t),e.prototype.readFeaturesFromObject=function(t,e){if("Topology"==t.type){var r=t,n=void 0,i=null,o=null;r.transform&&(i=(n=r.transform).scale,o=n.translate);var a=r.arcs;n&&function(t,e,r){for(var n=0,i=t.length;n0&&i.pop(),n=r>=0?e[r]:e[~r].slice().reverse(),i.push.apply(i,n);for(var s=0,u=i.length;s=2,57),n}return yx(e,t),e}(gx),vx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),_x=function(t){function e(e){return t.call(this,"And",Array.prototype.slice.call(arguments))||this}return vx(e,t),e}(mx),bx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xx=function(t){function e(e,r,n){var i=t.call(this,"BBOX")||this;if(i.geometryName=e,i.extent=r,4!==r.length)throw new Error("Expected an extent with four values ([minX, minY, maxX, maxY])");return i.srsName=n,i}return bx(e,t),e}(gx),wx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Sx=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.geometryName=r||"the_geom",o.geometry=n,o.srsName=i,o}return wx(e,t),e}(gx),Tx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ex=function(t){function e(e,r,n){return t.call(this,"Contains",e,r,n)||this}return Tx(e,t),e}(Sx),Cx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Px=function(t){function e(e,r){var n=t.call(this,e)||this;return n.propertyName=r,n}return Cx(e,t),e}(gx),Rx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ox=function(t){function e(e,r,n){var i=t.call(this,"During",e)||this;return i.begin=r,i.end=n,i}return Rx(e,t),e}(Px),Ix=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Lx=function(t){function e(e,r,n,i){var o=t.call(this,e,r)||this;return o.expression=n,o.matchCase=i,o}return Ix(e,t),e}(Px),Mx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Fx=function(t){function e(e,r,n){return t.call(this,"PropertyIsEqualTo",e,r,n)||this}return Mx(e,t),e}(Lx),Ax=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),kx=function(t){function e(e,r){return t.call(this,"PropertyIsGreaterThan",e,r)||this}return Ax(e,t),e}(Lx),Nx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),jx=function(t){function e(e,r){return t.call(this,"PropertyIsGreaterThanOrEqualTo",e,r)||this}return Nx(e,t),e}(Lx),Gx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Dx=function(t){function e(e,r,n){return t.call(this,"Intersects",e,r,n)||this}return Gx(e,t),e}(Sx),zx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ux=function(t){function e(e,r,n){var i=t.call(this,"PropertyIsBetween",e)||this;return i.lowerBoundary=r,i.upperBoundary=n,i}return zx(e,t),e}(Px),Bx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Yx=function(t){function e(e,r,n,i,o,a){var s=t.call(this,"PropertyIsLike",e)||this;return s.pattern=r,s.wildCard=void 0!==n?n:"*",s.singleChar=void 0!==i?i:".",s.escapeChar=void 0!==o?o:"!",s.matchCase=a,s}return Bx(e,t),e}(Px),Vx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Wx=function(t){function e(e){return t.call(this,"PropertyIsNull",e)||this}return Vx(e,t),e}(Px),qx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Xx=function(t){function e(e,r){return t.call(this,"PropertyIsLessThan",e,r)||this}return qx(e,t),e}(Lx),Zx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Kx=function(t){function e(e,r){return t.call(this,"PropertyIsLessThanOrEqualTo",e,r)||this}return Zx(e,t),e}(Lx),Hx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Jx=function(t){function e(e){var r=t.call(this,"Not")||this;return r.condition=e,r}return Hx(e,t),e}(gx),$x=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Qx=function(t){function e(e,r,n){return t.call(this,"PropertyIsNotEqualTo",e,r,n)||this}return $x(e,t),e}(Lx),tw=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ew=function(t){function e(e){return t.call(this,"Or",Array.prototype.slice.call(arguments))||this}return tw(e,t),e}(mx),rw=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),nw=function(t){function e(e,r,n){return t.call(this,"Within",e,r,n)||this}return rw(e,t),e}(Sx);function iw(t){var e=[null].concat(Array.prototype.slice.call(arguments));return new(Function.prototype.bind.apply(_x,e))}function ow(t,e,r){return new xx(t,e,r)}var aw=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),sw={"http://www.opengis.net/gml":{boundedBy:Ju(Em.prototype.readGeometryElement,"bounds")}},uw={"http://www.opengis.net/wfs":{totalInserted:Ju(Lm),totalUpdated:Ju(Lm),totalDeleted:Ju(Lm)}},lw={"http://www.opengis.net/wfs":{TransactionSummary:Ju((function(t,e){return ol({},uw,t,e)}),"transactionSummary"),InsertResults:Ju((function(t,e){return ol([],vw,t,e)}),"insertIds")}},hw={"http://www.opengis.net/wfs":{PropertyName:$u(jm)}},cw={"http://www.opengis.net/wfs":{Insert:$u((function(t,e,r){var n=r[r.length-1],i=n.featureType,o=n.featureNS,a=n.gmlVersion,s=Yu(o,i);t.appendChild(s),2===a?Xm.prototype.writeFeatureElement(s,e,r):Um.prototype.writeFeatureElement(s,e,r)})),Update:$u((function(t,e,r){var n=r[r.length-1];lt(void 0!==e.getId(),27);var i=n.featureType,o=n.featurePrefix,a=n.featureNS,s=bw(o,i),u=e.getGeometryName();t.setAttribute("typeName",s),t.setAttributeNS(pw,"xmlns:"+o,a);var l=e.getId();if(void 0!==l){for(var h=e.getKeys(),c=[],p=0,f=h.length;p="a"&&t<="z"||t>="A"&&t<="Z"},t.prototype.isNumeric_=function(t,e){return t>="0"&&t<="9"||"."==t&&!(void 0!==e&&e)},t.prototype.isWhiteSpace_=function(t){return" "==t||"\t"==t||"\r"==t||"\n"==t},t.prototype.nextChar_=function(){return this.wkt.charAt(++this.index_)},t.prototype.nextToken=function(){var t,e=this.nextChar_(),r=this.index_,n=e;if("("==e)t=Fw;else if(","==e)t=Nw;else if(")"==e)t=Aw;else if(this.isNumeric_(e)||"-"==e)t=kw,n=this.readNumber_();else if(this.isAlpha_(e))t=Mw,n=this.readText_();else{if(this.isWhiteSpace_(e))return this.nextToken();if(""!==e)throw new Error("Unexpected character: "+e);t=jw}return{position:r,value:n,type:t}},t.prototype.readNumber_=function(){var t,e=this.index_,r=!1,n=!1;do{"."==t?r=!0:"e"!=t&&"E"!=t||(n=!0),t=this.nextChar_()}while(this.isNumeric_(t,r)||!n&&("e"==t||"E"==t)||n&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this.index_--))},t.prototype.readText_=function(){var t,e=this.index_;do{t=this.nextChar_()}while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()},t}(),Uw=function(){function t(t){this.lexer_=t,this.token_,this.layout_=pt}return t.prototype.consume_=function(){this.token_=this.lexer_.nextToken()},t.prototype.isTokenType=function(t){return this.token_.type==t},t.prototype.match=function(t){var e=this.isTokenType(t);return e&&this.consume_(),e},t.prototype.parse=function(){return this.consume_(),this.parseGeometry_()},t.prototype.parseGeometryLayout_=function(){var t=pt,e=this.token_;if(this.isTokenType(Mw)){var r=e.value;"Z"===r?t=ft:"M"===r?t=dt:"ZM"===r&&(t=gt),t!==pt&&this.consume_()}return t},t.prototype.parseGeometryCollectionText_=function(){if(this.match(Fw)){var t=[];do{t.push(this.parseGeometry_())}while(this.match(Nw));if(this.match(Aw))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parsePointText_=function(){if(this.match(Fw)){var t=this.parsePoint_();if(this.match(Aw))return t}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())},t.prototype.parseLineStringText_=function(){if(this.match(Fw)){var t=this.parsePointList_();if(this.match(Aw))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parsePolygonText_=function(){if(this.match(Fw)){var t=this.parseLineStringTextList_();if(this.match(Aw))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parseMultiPointText_=function(){if(this.match(Fw)){var t=void 0;if(t=this.token_.type==Fw?this.parsePointTextList_():this.parsePointList_(),this.match(Aw))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parseMultiLineStringText_=function(){if(this.match(Fw)){var t=this.parseLineStringTextList_();if(this.match(Aw))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parseMultiPolygonText_=function(){if(this.match(Fw)){var t=this.parsePolygonTextList_();if(this.match(Aw))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parsePoint_=function(){for(var t=[],e=this.layout_.length,r=0;r0&&(e+=" "+n)}return 0===r.length?e+" EMPTY":e+"("+r+")"}var Zw=Bw,Kw=function(){function t(){}return t.prototype.read=function(t){if(t){if("string"==typeof t){var e=qu(t);return this.readFromDocument(e)}return Wu(t)?this.readFromDocument(t):this.readFromNode(t)}return null},t.prototype.readFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readFromNode(e);return null},t.prototype.readFromNode=function(t){},t}();function Hw(t){return t.getAttributeNS("http://www.w3.org/1999/xlink","href")}var Jw=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),$w=[null,"http://www.opengis.net/wms"],Qw=nl($w,{Service:Ju((function(t,e){return ol({},rS,t,e)})),Capability:Ju((function(t,e){return ol({},tS,t,e)}))}),tS=nl($w,{Request:Ju((function(t,e){return ol({},hS,t,e)})),Exception:Ju((function(t,e){return ol([],aS,t,e)})),Layer:Ju((function(t,e){return ol({},sS,t,e)}))}),eS=function(t){function e(){var e=t.call(this)||this;return e.version=void 0,e}return Jw(e,t),e.prototype.readFromNode=function(t){this.version=t.getAttribute("version").trim();var e=ol({version:this.version},Qw,t,[]);return e||null},e}(Kw),rS=nl($w,{Name:Ju(Fm),Title:Ju(Fm),Abstract:Ju(Fm),KeywordList:Ju(bS),OnlineResource:Ju(Hw),ContactInformation:Ju((function(t,e){return ol({},nS,t,e)})),Fees:Ju(Fm),AccessConstraints:Ju(Fm),LayerLimit:Ju(Lm),MaxWidth:Ju(Lm),MaxHeight:Ju(Lm)}),nS=nl($w,{ContactPersonPrimary:Ju((function(t,e){return ol({},iS,t,e)})),ContactPosition:Ju(Fm),ContactAddress:Ju((function(t,e){return ol({},oS,t,e)})),ContactVoiceTelephone:Ju(Fm),ContactFacsimileTelephone:Ju(Fm),ContactElectronicMailAddress:Ju(Fm)}),iS=nl($w,{ContactPerson:Ju(Fm),ContactOrganization:Ju(Fm)}),oS=nl($w,{AddressType:Ju(Fm),Address:Ju(Fm),City:Ju(Fm),StateOrProvince:Ju(Fm),PostCode:Ju(Fm),Country:Ju(Fm)}),aS=nl($w,{Format:Zu(Fm)}),sS=nl($w,{Name:Ju(Fm),Title:Ju(Fm),Abstract:Ju(Fm),KeywordList:Ju(bS),CRS:Hu(Fm),EX_GeographicBoundingBox:Ju((function(t,e){var r=ol({},lS,t,e);if(!r)return;var n=r.westBoundLongitude,i=r.southBoundLatitude,o=r.eastBoundLongitude,a=r.northBoundLatitude;if(void 0===n||void 0===i||void 0===o||void 0===a)return;return[n,i,o,a]})),BoundingBox:Hu((function(t,e){var r=[Im(t.getAttribute("minx")),Im(t.getAttribute("miny")),Im(t.getAttribute("maxx")),Im(t.getAttribute("maxy"))],n=[Im(t.getAttribute("resx")),Im(t.getAttribute("resy"))];return{crs:t.getAttribute("CRS"),extent:r,res:n}})),Dimension:Hu((function(t,e){return{name:t.getAttribute("name"),units:t.getAttribute("units"),unitSymbol:t.getAttribute("unitSymbol"),default:t.getAttribute("default"),multipleValues:Pm(t.getAttribute("multipleValues")),nearestValue:Pm(t.getAttribute("nearestValue")),current:Pm(t.getAttribute("current")),values:Fm(t)}})),Attribution:Ju((function(t,e){return ol({},uS,t,e)})),AuthorityURL:Hu((function(t,e){var r=mS(t,e);if(r)return r.name=t.getAttribute("name"),r;return})),Identifier:Hu(Fm),MetadataURL:Hu((function(t,e){var r=mS(t,e);if(r)return r.type=t.getAttribute("type"),r;return})),DataURL:Hu(mS),FeatureListURL:Hu(mS),Style:Hu((function(t,e){return ol({},dS,t,e)})),MinScaleDenominator:Ju(Om),MaxScaleDenominator:Ju(Om),Layer:Hu((function(t,e){var r=e[e.length-1],n=ol({},sS,t,e);if(!n)return;var i=Pm(t.getAttribute("queryable"));void 0===i&&(i=r.queryable);n.queryable=void 0!==i&&i;var o=Mm(t.getAttribute("cascaded"));void 0===o&&(o=r.cascaded);n.cascaded=o;var a=Pm(t.getAttribute("opaque"));void 0===a&&(a=r.opaque);n.opaque=void 0!==a&&a;var s=Pm(t.getAttribute("noSubsets"));void 0===s&&(s=r.noSubsets);n.noSubsets=void 0!==s&&s;var u=Im(t.getAttribute("fixedWidth"));u||(u=r.fixedWidth);n.fixedWidth=u;var l=Im(t.getAttribute("fixedHeight"));l||(l=r.fixedHeight);n.fixedHeight=l,["Style","CRS","AuthorityURL"].forEach((function(t){if(t in r){var e=n[t]||[];n[t]=e.concat(r[t])}}));return["EX_GeographicBoundingBox","BoundingBox","Dimension","Attribution","MinScaleDenominator","MaxScaleDenominator"].forEach((function(t){if(!(t in n)){var e=r[t];n[t]=e}})),n}))}),uS=nl($w,{Title:Ju(Fm),OnlineResource:Ju(Hw),LogoURL:Ju(_S)}),lS=nl($w,{westBoundLongitude:Ju(Om),eastBoundLongitude:Ju(Om),southBoundLatitude:Ju(Om),northBoundLatitude:Ju(Om)}),hS=nl($w,{GetCapabilities:Ju(vS),GetMap:Ju(vS),GetFeatureInfo:Ju(vS)}),cS=nl($w,{Format:Hu(Fm),DCPType:Hu((function(t,e){return ol({},pS,t,e)}))}),pS=nl($w,{HTTP:Ju((function(t,e){return ol({},fS,t,e)}))}),fS=nl($w,{Get:Ju(mS),Post:Ju(mS)}),dS=nl($w,{Name:Ju(Fm),Title:Ju(Fm),Abstract:Ju(Fm),LegendURL:Hu(_S),StyleSheetURL:Ju(mS),StyleURL:Ju(mS)}),gS=nl($w,{Format:Ju(Fm),OnlineResource:Ju(Hw)}),yS=nl($w,{Keyword:Zu(Fm)});function mS(t,e){return ol({},gS,t,e)}function vS(t,e){return ol({},cS,t,e)}function _S(t,e){var r=mS(t,e);if(r){var n=[Mm(t.getAttribute("width")),Mm(t.getAttribute("height"))];return r.size=n,r}}function bS(t,e){return ol([],yS,t,e)}var xS=eS,wS=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),SS=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.featureNS_="http://mapserver.gis.umn.edu/mapserver",r.gmlFormat_=new Xm,r.layers_=n.layers?n.layers:null,r}return wS(e,t),e.prototype.getLayers=function(){return this.layers_},e.prototype.setLayers=function(t){this.layers_=t},e.prototype.readFeatures_=function(t,e){t.setAttribute("namespaceURI",this.featureNS_);var r=t.localName,n=[];if(0===t.childNodes.length)return n;if("msGMLOutput"==r)for(var i=0,o=t.childNodes.length;i.75*h||l>.75*c?this.resetExtent_():Vt(o,n)||this.recenter_()}}},e.prototype.resetExtent_=function(){var t=this.getMap(),e=this.ovmap_,r=t.getSize(),n=t.getView().calculateExtentInternal(r),i=e.getView(),o=Math.log(7.5)/Math.LN2;ve(n,1/(.1*Math.pow(2,o/2))),i.fitInternal(Fn(n))},e.prototype.recenter_=function(){var t=this.getMap(),e=this.ovmap_,r=t.getView();e.getView().setCenterInternal(r.getCenterInternal())},e.prototype.updateBox_=function(){var t=this.getMap(),e=this.ovmap_;if(t.isRendered()&&e.isRendered()){var r=t.getSize(),n=t.getView(),i=e.getView(),o=this.rotateWithView_?0:-n.getRotation(),a=this.boxOverlay_,s=this.boxOverlay_.getElement(),u=n.getCenterInternal(),l=n.getResolution(),h=i.getResolution(),c=r[0]*l/h,p=r[1]*l/h;if(a.setPosition(u),s){s.style.width=c+"px",s.style.height=p+"px";var f="rotate("+o+"rad)";s.style.transform=f}}},e.prototype.handleClick_=function(t){t.preventDefault(),this.handleToggle_()},e.prototype.handleToggle_=function(){this.element.classList.toggle("ol-collapsed"),this.collapsed_?Wi(this.collapseLabel_,this.label_):Wi(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_;var t=this.ovmap_;if(!this.collapsed_){if(t.isRendered())return this.viewExtent_=void 0,void t.render();t.updateSize(),this.resetExtent_(),q(t,na,(function(t){this.updateBox_()}),this)}},e.prototype.getCollapsible=function(){return this.collapsible_},e.prototype.setCollapsible=function(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())},e.prototype.setCollapsed=function(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()},e.prototype.getCollapsed=function(){return this.collapsed_},e.prototype.getRotateWithView=function(){return this.rotateWithView_},e.prototype.setRotateWithView=function(t){this.rotateWithView_!==t&&(this.rotateWithView_=t,0!==this.getMap().getView().getRotation()&&(this.rotateWithView_?this.handleRotationChanged_():this.ovmap_.getView().setRotation(0),this.viewExtent_=void 0,this.validateExtent_(),this.updateBox_()))},e.prototype.getOverviewMap=function(){return this.ovmap_},e.prototype.render=function(t){this.validateExtent_(),this.updateBox_()},e}(Va),vT=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),_T="degrees",bT="imperial",xT="nautical",wT="metric",ST="us",TT=[1,2,5],ET=function(t){function e(e){var r=this,n=e||{},i=void 0!==n.className?n.className:n.bar?"ol-scale-bar":"ol-scale-line";return(r=t.call(this,{element:document.createElement("div"),render:n.render,target:n.target})||this).innerElement_=document.createElement("div"),r.innerElement_.className=i+"-inner",r.element.className=i+" ol-unselectable",r.element.appendChild(r.innerElement_),r.viewState_=null,r.minWidth_=void 0!==n.minWidth?n.minWidth:64,r.renderedVisible_=!1,r.renderedWidth_=void 0,r.renderedHTML_="",r.addEventListener(et("units"),r.handleUnitsChanged_),r.setUnits(n.units||wT),r.scaleBar_=n.bar||!1,r.scaleBarSteps_=n.steps||4,r.scaleBarText_=n.text||!1,r.dpi_=n.dpi||void 0,r}return vT(e,t),e.prototype.getUnits=function(){return this.get("units")},e.prototype.handleUnitsChanged_=function(){this.updateElement_()},e.prototype.setUnits=function(t){this.set("units",t)},e.prototype.setDpi=function(t){this.dpi_=t},e.prototype.updateElement_=function(){var t=this.viewState_;if(t){var e=t.center,r=t.projection,n=this.getUnits(),i=n==_T?_t.DEGREES:_t.METERS,o=mr(r,t.resolution,e,i),a=this.minWidth_*(this.dpi_||25.4/.28)/(25.4/.28),s=a*o,u="";if(n==_T){var l=vt[_t.DEGREES];(s*=l)=a)break;++d}f=this.scaleBar_?this.createScaleBar(c,h,u):h.toFixed(p<0?-p:0)+" "+u,this.renderedHTML_!=f&&(this.innerElement_.innerHTML=f,this.renderedHTML_=f),this.renderedWidth_!=c&&(this.innerElement_.style.width=c+"px",this.renderedWidth_=c),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}else this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1)},e.prototype.createScaleBar=function(t,e,r){for(var n="1 : "+Math.round(this.getScaleForResolution()).toLocaleString(),i=[],o=t/this.scaleBarSteps_,a="#ffffff",s=0;s'+this.createMarker("relative",s)+(s%2==0||2===this.scaleBarSteps_?this.createStepText(s,t,!1,e,r):"")+""),s===this.scaleBarSteps_-1&&i.push(this.createStepText(s+1,t,!0,e,r)),a="#ffffff"===a?"#000000":"#ffffff";return''+(this.scaleBarText_?'
'+n+"
":"")+i.join("")+"
"},e.prototype.createMarker=function(t,e){return''},e.prototype.createStepText=function(t,e,r,n,i){var o=(0===t?0:Math.round(n/this.scaleBarSteps_*t*100)/100)+(0===t?"":" "+i);return''+o+"
"},e.prototype.getScaleForResolution=function(){var t=mr(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center),e=this.dpi_||25.4/.28,r=this.viewState_.projection.getMetersPerUnit();return parseFloat(t.toString())*r*39.37*e},e.prototype.render=function(t){var e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()},e}(Va),CT=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),PT=0,RT=1,OT=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{element:document.createElement("div"),render:n.render})||this).dragListenerKeys_=[],r.currentResolution_=void 0,r.direction_=PT,r.dragging_,r.heightLimit_=0,r.widthLimit_=0,r.startX_,r.startY_,r.thumbSize_=null,r.sliderInitialized_=!1,r.duration_=void 0!==n.duration?n.duration:200;var i=void 0!==n.className?n.className:"ol-zoomslider",o=document.createElement("button");o.setAttribute("type","button"),o.className=i+"-thumb ol-unselectable";var a=r.element;return a.className=i+" ol-unselectable ol-control",a.appendChild(o),a.addEventListener($o,r.handleDraggerStart_.bind(r),!1),a.addEventListener(Jo,r.handleDraggerDrag_.bind(r),!1),a.addEventListener(Qo,r.handleDraggerEnd_.bind(r),!1),a.addEventListener(A,r.handleContainerClick_.bind(r),!1),o.addEventListener(A,l,!1),r}return CT(e,t),e.prototype.setMap=function(e){t.prototype.setMap.call(this,e),e&&e.render()},e.prototype.initSlider_=function(){var t=this.element,e=t.offsetWidth,r=t.offsetHeight;if(0===e&&0===r)return this.sliderInitialized_=!1;var n=t.firstElementChild,i=getComputedStyle(n),o=n.offsetWidth+parseFloat(i.marginRight)+parseFloat(i.marginLeft),a=n.offsetHeight+parseFloat(i.marginTop)+parseFloat(i.marginBottom);return this.thumbSize_=[o,a],e>r?(this.direction_=RT,this.widthLimit_=e-o):(this.direction_=PT,this.heightLimit_=r-a),this.sliderInitialized_=!0},e.prototype.handleContainerClick_=function(t){var e=this.getMap().getView(),r=this.getRelativePosition_(t.offsetX-this.thumbSize_[0]/2,t.offsetY-this.thumbSize_[1]/2),n=this.getResolutionForPosition_(r),i=e.getConstrainedZoom(e.getZoomForResolution(n));e.animateInternal({zoom:i,duration:this.duration_,easing:La})},e.prototype.handleDraggerStart_=function(t){if(!this.dragging_&&t.target===this.element.firstElementChild){var e=this.element.firstElementChild;if(this.getMap().getView().beginInteraction(),this.startX_=t.clientX-parseFloat(e.style.left),this.startY_=t.clientY-parseFloat(e.style.top),this.dragging_=!0,0===this.dragListenerKeys_.length){var r=this.handleDraggerDrag_,n=this.handleDraggerEnd_;this.dragListenerKeys_.push(W(document,Jo,r,this),W(document,Qo,n,this))}}},e.prototype.handleDraggerDrag_=function(t){if(this.dragging_){var e=t.clientX-this.startX_,r=t.clientY-this.startY_,n=this.getRelativePosition_(e,r);this.currentResolution_=this.getResolutionForPosition_(n),this.getMap().getView().setResolution(this.currentResolution_)}},e.prototype.handleDraggerEnd_=function(t){this.dragging_&&(this.getMap().getView().endInteraction(),this.dragging_=!1,this.startX_=void 0,this.startY_=void 0,this.dragListenerKeys_.forEach(X),this.dragListenerKeys_.length=0)},e.prototype.setThumbPosition_=function(t){var e=this.getPositionForResolution_(t),r=this.element.firstElementChild;this.direction_==RT?r.style.left=this.widthLimit_*e+"px":r.style.top=this.heightLimit_*e+"px"},e.prototype.getRelativePosition_=function(t,e){return we(this.direction_===RT?t/this.widthLimit_:e/this.heightLimit_,0,1)},e.prototype.getResolutionForPosition_=function(t){return this.getMap().getView().getResolutionForValueFunction()(1-t)},e.prototype.getPositionForResolution_=function(t){return we(1-this.getMap().getView().getValueForResolutionFunction()(t),0,1)},e.prototype.render=function(t){if(t.frameState&&(this.sliderInitialized_||this.initSlider_())){var e=t.frameState.viewState.resolution;this.currentResolution_=e,this.setThumbPosition_(e)}},e}(Va),IT=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),LT=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{element:document.createElement("div"),target:n.target})||this).extent=n.extent?n.extent:null;var i=void 0!==n.className?n.className:"ol-zoom-extent",o=void 0!==n.label?n.label:"E",a=void 0!==n.tipLabel?n.tipLabel:"Fit to extent",s=document.createElement("button");s.setAttribute("type","button"),s.title=a,s.appendChild("string"==typeof o?document.createTextNode(o):o),s.addEventListener(A,r.handleClick_.bind(r),!1);var u=i+" ol-unselectable ol-control",l=r.element;return l.className=u,l.appendChild(s),r}return IT(e,t),e.prototype.handleClick_=function(t){t.preventDefault(),this.handleZoomToExtent()},e.prototype.handleZoomToExtent=function(){var t=this.getMap().getView(),e=this.extent?this.extent:t.getProjection().getExtent();t.fitInternal(Fn(e))},e}(Va),MT={array:{},color:{},colorlike:{},control:{},coordinate:{},easing:{},events:{}};MT.events.condition={},MT.extent={},MT.featureloader={},MT.format={},MT.format.filter={},MT.geom={},MT.has={},MT.interaction={},MT.layer={},MT.loadingstrategy={},MT.proj={},MT.proj.Units={},MT.proj.proj4={},MT.render={},MT.render.canvas={},MT.renderer={},MT.renderer.canvas={},MT.renderer.webgl={},MT.size={},MT.source={},MT.sphere={},MT.style={},MT.style.IconImageCache={},MT.tilegrid={},MT.transform={},MT.util={},MT.webgl={},MT.xml={},MT.Collection=ut,MT.Feature=ct,MT.Geolocation=Zn,MT.Kinetic=Kn,MT.Map=Qs,MT.Object=rt,MT.Observable=H,MT.Observable.unByKey=K,MT.Overlay=gu,MT.PluggableMap=Ba,MT.View=ja,MT.array.stableSort=function(t,e){var r,n=t.length,i=Array(t.length);for(r=0;r180)&&(r[0]=Oe(n+180,360)-180),r},MT.proj.transform=Cr,MT.proj.transformExtent=Pr,MT.render.VectorContext=Mi,MT.render.canvas.labelCache=to,MT.render.getRenderPixel=function(t,e){var r=e.slice(0);return Tt(t.inversePixelTransform.slice(),r),r},MT.render.getVectorContext=Ao,MT.render.toContext=function(t,e){var r=t.canvas,n=e||{},i=n.pixelRatio||Gi,o=n.size;o&&(r.width=o[0]*i,r.height=o[1]*i,r.style.width=o[0]+"px",r.style.height=o[1]+"px");var a=[0,0,r.width,r.height],s=Et([1,0,0,1,0,0],i,i);return new mo(t,i,a,s,0)},MT.renderer.Composite=Bo,MT.renderer.canvas.ImageLayer=gp,MT.renderer.canvas.TileLayer=Tp,MT.renderer.canvas.VectorImageLayer=gd,MT.renderer.canvas.VectorLayer=fd,MT.renderer.canvas.VectorTileLayer=wd,MT.renderer.webgl.PointsLayer=Of,MT.size.toSize=za,MT.source.BingMaps=Jh,MT.source.CartoDB=ec,MT.source.Cluster=fc,MT.source.IIIF=Lc,MT.source.Image=zc,MT.source.ImageArcGISRest=Yc,MT.source.ImageCanvas=Xc,MT.source.ImageMapGuide=Kc,MT.source.ImageStatic=Jc,MT.source.ImageWMS=ip,MT.source.OSM=sp,MT.source.OSM.ATTRIBUTION=ap,MT.source.Raster=Bp,MT.source.Source=Ah,MT.source.Stamen=Xp,MT.source.Tile=Gh,MT.source.TileArcGISRest=Kp,MT.source.TileDebug=$p,MT.source.TileImage=Zh,MT.source.TileJSON=tf,MT.source.TileWMS=rf,MT.source.UTFGrid=af,MT.source.Vector=cc,MT.source.VectorTile=ff,MT.source.WMTS=vf,MT.source.WMTS.optionsFromCapabilities=function(t,e){var r=v(t.Contents.Layer,(function(t,r,n){return t.Identifier==e.layer}));if(null===r)return null;var n,i=t.Contents.TileMatrixSet;(n=r.TileMatrixSetLink.length>1?b(r.TileMatrixSetLink,"projection"in e?function(t,r,n){var o=v(i,(function(e){return e.Identifier==t.TileMatrixSet})).SupportedCRS,a=yr(o.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||yr(o),s=yr(e.projection);return a&&s?Sr(a,s):o==e.projection}:function(t,r,n){return t.TileMatrixSet==e.matrixSet}):0)<0&&(n=0);var o=r.TileMatrixSetLink[n].TileMatrixSet,a=r.TileMatrixSetLink[n].TileMatrixSetLimits,s=r.Format[0];"format"in e&&(s=e.format),(n=b(r.Style,(function(t,r,n){return"style"in e?t.Title==e.style:t.isDefault})))<0&&(n=0);var u=r.Style[n].Identifier,l={};"Dimension"in r&&r.Dimension.forEach((function(t,e,r){var n=t.Identifier,i=t.Default;void 0===i&&(i=t.Value[0]),l[n]=i}));var h,c=v(t.Contents.TileMatrixSet,(function(t,e,r){return t.Identifier==o})),p=c.SupportedCRS;if(p&&(h=yr(p.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||yr(p)),"projection"in e){var f=yr(e.projection);f&&(h&&!Sr(f,h)||(h=f))}var g="ne"==h.getAxisOrientation().substr(0,2),y=c.TileMatrix[0],m={MinTileCol:0,MinTileRow:0,MaxTileCol:y.MatrixWidth-1,MaxTileRow:y.MatrixHeight-1};a&&(m=a[a.length-1],y=v(c.TileMatrix,(function(t){return t.Identifier===m.TileMatrix})));var _=28e-5*y.ScaleDenominator/h.getMetersPerUnit(),x=g?[y.TopLeftCorner[1],y.TopLeftCorner[0]]:y.TopLeftCorner,w=y.TileWidth*_,S=y.TileHeight*_,T=[x[0]+w*m.MinTileCol,x[1]-S*(1+m.MaxTileRow),x[0]+w*(1+m.MaxTileCol),x[1]-S*m.MinTileRow];null===h.getExtent()&&h.setExtent(T);var E=Al(c,T,a),C=[],P=e.requestEncoding;if(P=void 0!==P?P:"","OperationsMetadata"in t&&"GetTile"in t.OperationsMetadata)for(var R=t.OperationsMetadata.GetTile.DCP.HTTP.Get,O=0,I=R.length;O