!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ol={})}(this,(function(t){"use strict";function e(){return function(){throw new Error("Unimplemented abstract method.")}()}var r=0;function n(t){return t.ol_uid||(t.ol_uid=String(++r))}var i,o=(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},i(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=function(t){function e(e){var r=this,n="Assertion failed. See https://openlayers.org/en/"+("v"+"6.10.0".split("-")[0])+"/doc/errors/#"+e+" for details.";return(r=t.call(this,n)||this).code=e,r.name="AssertionError",r.message=n,r}return o(e,t),e}(Error),s=function(){function t(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}return t.prototype.preventDefault=function(){this.defaultPrevented=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t}(),l="propertychange",u=function(){function t(){this.disposed=!1}return t.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposeInternal())},t.prototype.disposeInternal=function(){},t}();function h(t,e){return t>e?1:t=0}function p(t,e,r){var n=t.length;if(t[0]<=e)return 0;if(e<=t[n-1])return n-1;var i=void 0;if(r>0){for(i=1;i0?i-1:i:t[i-1]-e0)},e.prototype.removeEventListener=function(t,e){var r=this.listeners_&&this.listeners_[t];if(r){var n=r.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(r[n]=v,++this.pendingRemovals_[t]):(r.splice(n,1),0===r.length&&delete this.listeners_[t]))}},e}(u),T="change",b="error",R="contextmenu",P="click",O="dblclick",F="dragenter",I="dragover",L="drop",M="keydown",A="keypress",D="load",k="resize",j="touchmove",G="wheel";function N(t,e,r,n,i){if(n&&n!==t&&(r=r.bind(n)),i){var o=r;r=function(){t.removeEventListener(e,r),o.apply(this,arguments)}}var a={target:t,type:e,listener:r};return t.addEventListener(e,r),a}function B(t,e,r,n){return N(t,e,r,n,!0)}function z(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),x(t))}var U=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),V=function(t){function e(){var e=t.call(this)||this;return e.on=e.onInternal,e.once=e.onceInternal,e.un=e.unInternal,e.revision_=0,e}return U(e,t),e.prototype.changed=function(){++this.revision_,this.dispatchEvent(T)},e.prototype.getRevision=function(){return this.revision_},e.prototype.onInternal=function(t,e){if(Array.isArray(t)){for(var r=t.length,n=new Array(r),i=0;i0;)this.pop()},e.prototype.extend=function(t){for(var e=0,r=t.length;ei&&(l|=Zt),so&&(l|=Kt),l===Wt&&(l=Yt),l}function oe(){return[1/0,1/0,-1/0,-1/0]}function ae(t,e,r,n,i){return i?(i[0]=t,i[1]=e,i[2]=r,i[3]=n,i):[t,e,r,n]}function se(t){return ae(1/0,1/0,-1/0,-1/0,t)}function le(t,e){var r=t[0],n=t[1];return ae(r,n,r,n,e)}function ue(t,e,r,n,i){return fe(se(i),t,e,r,n)}function he(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function ce(t,e){return e[0]t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function pe(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function fe(t,e,r,n,i){for(;re[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Pe(t){return t[2]1)for(var o=t[2]-t[0],a=t[3]-t[1],s=0;s1?(r=i,n=o):l>0&&(r+=a*l,n+=s*l)}return De(t,e,r,n)}function De(t,e,r,n){var i=r-t,o=n-e;return i*i+o*o}function ke(t){return 180*t/Math.PI}function je(t){return t*Math.PI/180}function Ge(t,e){var r=t%e;return r*e<0?r+e:r}function Ne(t,e,r){return t+r*(e-t)}function Be(t,e){var r=Math.pow(10,e);return Math.round(t*r)/r}function ze(t,e){return Math.round(Be(t,e))}function Ue(t,e){return Math.floor(Be(t,e))}function Ve(t,e){return Math.ceil(Be(t,e))}var Xe=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),We=6378137,Ye=Math.PI*We,Ke=[-Ye,-Ye,Ye,Ye],Ze=[-180,-85,180,85],He=We*Math.log(Math.tan(Math.PI/2)),qe=function(t){function e(e){return t.call(this,{code:e,units:St.METERS,extent:Ke,global:!0,worldExtent:Ze,getPointResolution:function(t,e){return t/Le(e[1]/We)}})||this}return Xe(e,t),e}(Fe),Je=[new qe("EPSG:3857"),new qe("EPSG:102100"),new qe("EPSG:102113"),new qe("EPSG:900913"),new qe("http://www.opengis.net/def/crs/EPSG/0/3857"),new qe("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Qe(t,e,r){var n=t.length,i=r>1?r:2,o=e;void 0===o&&(o=i>2?t.slice():new Array(n));for(var a=0;aHe?s=He:s<-He&&(s=-He),o[a+1]=s}return o}function $e(t,e,r){var n=t.length,i=r>1?r:2,o=e;void 0===o&&(o=i>2?t.slice():new Array(n));for(var a=0;aa)return 1;if(a>o)return-1}return 0}function dr(t,e){var r,n,i=t[0],o=t[1],a=e[0],s=e[1],l=a[0],u=a[1],h=s[0],c=s[1],p=h-l,f=c-u,d=0===p&&0===f?0:(p*(i-l)+f*(o-u))/(p*p+f*f||0);return d<=0?(r=l,n=u):d>=1?(r=h,n=c):(r=l+d*p,n=u+d*f),[r,n]}function gr(t,e){for(var r=!0,n=t.length-1;n>=0;--n)if(t[n]!=e[n]){r=!1;break}return r}function _r(t,e){var r=Math.cos(e),n=Math.sin(e),i=t[0]*r-t[1]*n,o=t[1]*r+t[0]*n;return t[0]=i,t[1]=o,t}function yr(t,e){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n}function vr(t,e){return Math.sqrt(yr(t,e))}function mr(t,e){return yr(t,dr(t,e))}function xr(t,e){if(e.canWrapX()){var r=be(e.getExtent()),n=function(t,e,r){var n=e.getExtent(),i=0;if(e.canWrapX()&&(t[0]n[2])){var o=r||be(n);i=Math.floor((t[0]-n[0])/o)}return i}(t,e,r);n&&(t[0]-=n*r)}return t}function wr(t,e,r){var n;if(void 0!==e){for(var i=0,o=t.length;i1)s=r;else{if(p>0){for(var f=0;fi&&(i=u),o=s,a=l}return i}function Qr(t,e,r,n,i){for(var o=0,a=r.length;o0;){for(var c=u.pop(),p=u.pop(),f=0,d=t[p],g=t[p+1],_=t[c],y=t[c+1],v=p+n;vf&&(h=v,f=m)}f>i&&(l[(h-e)/n]=1,p+n0&&g>f)&&(d<0&&_0&&_>d)?(s=c,l=p):(o[a++]=s,o[a++]=l,u=s,h=l,s=c,l=p)}}return o[a++]=s,o[a++]=l,a}function ln(t,e,r,n,i,o,a,s){for(var l=0,u=r.length;lo&&(u-s)*(o-l)-(i-s)*(h-l)>0&&a++:h<=o&&(u-s)*(o-l)-(i-s)*(h-l)<0&&a--,s=u,l=h}return 0!==a}function Sn(t,e,r,n,i,o){if(0===r.length)return!1;if(!wn(t,e,r[0],n,i,o))return!1;for(var a=1,s=r.length;aw&&Sn(t,e,r,n,u=(c+p)/2,g)&&(x=u,w=S),c=p}return isNaN(x)&&(x=i[o]),a?(a.push(x,g,w),a):[x,g,w]}function En(t,e,r,n,i){for(var o=[],a=0,s=r.length;a=i[0]&&o[2]<=i[2]||(o[1]>=i[1]&&o[3]<=i[3]||Tn(t,e,r,n,(function(t,e){return function(t,e,r){var n=!1,i=ie(t,e),o=ie(t,r);if(i===Yt||o===Yt)n=!0;else{var a=t[0],s=t[1],l=t[2],u=t[3],h=e[0],c=e[1],p=r[0],f=r[1],d=(f-c)/(p-h),g=void 0,_=void 0;o&Kt&&!(i&Kt)&&(n=(g=p-(f-u)/d)>=a&&g<=l),n||!(o&Zt)||i&Zt||(n=(_=f-(p-l)*d)>=s&&_<=u),n||!(o&Ht)||i&Ht||(n=(g=p-(f-s)/d)>=a&&g<=l),n||!(o&qt)||i&qt||(n=(_=f-(p-a)*d)>=s&&_<=u)}return n}(i,t,e)})))))}function Rn(t,e,r,n,i){if(!function(t,e,r,n,i){return!!(bn(t,e,r,n,i)||wn(t,e,r,n,i[0],i[1])||wn(t,e,r,n,i[0],i[3])||wn(t,e,r,n,i[2],i[1])||wn(t,e,r,n,i[2],i[3]))}(t,e,r[0],n,i))return!1;if(1===r.length)return!0;for(var o=1,a=r.length;o0}function Fn(t,e,r,n,i){for(var o=void 0!==i&&i,a=0,s=r.length;a>1)],e))<0?a=n+1:(s=n,l=!i);return l?a:~a}(d,v);m<0?(l=(v-d[-m-2])/(d[-m-1]-d[-m-2]),s=e+(-m-2)*n):s=e+m*n}var x=a>1?a:2,w=o||new Array(x);for(g=0;g>1;i0&&t[1]>0}function ni(t,e,r){return void 0===r&&(r=[0,0]),r[0]=t[0]*e+.5|0,r[1]=t[1]*e+.5|0,r}function ii(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}var oi=function(){function t(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=ii(t.scale),this.displacement_=t.displacement}return t.prototype.clone=function(){var e=this.getScale();return new t({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()})},t.prototype.getOpacity=function(){return this.opacity_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getScaleArray=function(){return this.scaleArray_},t.prototype.getDisplacement=function(){return this.displacement_},t.prototype.getAnchor=function(){return e()},t.prototype.getImage=function(t){return e()},t.prototype.getHitDetectionImage=function(){return e()},t.prototype.getPixelRatio=function(t){return 1},t.prototype.getImageState=function(){return e()},t.prototype.getImageSize=function(){return e()},t.prototype.getOrigin=function(){return e()},t.prototype.getSize=function(){return e()},t.prototype.setDisplacement=function(t){this.displacement_=t},t.prototype.setOpacity=function(t){this.opacity_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t,this.scaleArray_=ii(t)},t.prototype.listenImageChange=function(t){e()},t.prototype.load=function(){e()},t.prototype.unlistenImageChange=function(t){e()},t}(),ai=oi,si=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,li=/^([a-z]*)$|^hsla?\(.*\)$/i;function ui(t){return"string"==typeof t?t:di(t)}function hi(t){var e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);var r=getComputedStyle(e).color;return document.body.removeChild(e),r}return""}var ci=function(){var t={},e=0;return function(r){var n;if(t.hasOwnProperty(r))n=t[r];else{if(e>=1024){var i=0;for(var o in t)0==(3&i++)&&(delete t[o],--e)}n=function(t){var e,r,n,i,o;li.exec(t)&&(t=hi(t));if(si.exec(t)){var a=t.length-1,s=void 0;s=a<=4?1:2;var l=4===a||8===a;e=parseInt(t.substr(1+0*s,s),16),r=parseInt(t.substr(1+1*s,s),16),n=parseInt(t.substr(1+2*s,s),16),i=l?parseInt(t.substr(1+3*s,s),16):255,1==s&&(e=(e<<4)+e,r=(r<<4)+r,n=(n<<4)+n,l&&(i=(i<<4)+i)),o=[e,r,n,i/255]}else 0==t.indexOf("rgba(")?fi(o=t.slice(5,-1).split(",").map(Number)):0==t.indexOf("rgb(")?((o=t.slice(4,-1).split(",").map(Number)).push(1),fi(o)):nt(!1,14);return o}(r),t[r]=n,++e}return n}}();function pi(t){return Array.isArray(t)?t:ci(t)}function fi(t){return t[0]=Ie(t[0]+.5|0,0,255),t[1]=Ie(t[1]+.5|0,0,255),t[2]=Ie(t[2]+.5|0,0,255),t[3]=Ie(t[3],0,1),t}function di(t){var e=t[0];e!=(0|e)&&(e=e+.5|0);var r=t[1];r!=(0|r)&&(r=r+.5|0);var n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+r+","+n+","+(void 0===t[3]?1:Math.round(100*t[3])/100)+")"}function gi(t){return Array.isArray(t)?di(t):t}function _i(t,e,r,n){var i;return i=r&&r.length?r.shift():Ot?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(i.width=t),e&&(i.height=e),i.getContext("2d",n)}function yi(t,e){var r=e.parentNode;r&&r.replaceChild(t,e)}function vi(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}var mi="ol-hidden",xi="ol-unselectable",wi="ol-control",Si="ol-collapsed",Ci=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z]+?)\\s*$"].join(""),"i"),Ei=["style","variant","weight","size","lineHeight","family"],Ti=function(t){var e=t.match(Ci);if(!e)return null;for(var r={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"},n=0,i=Ei.length;n=t.maxResolution)return!1;var n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}var Oo=Ro;function Fo(t,e,r,n,i){Io(t,e,r||0,n||t.length-1,i||Mo)}function Io(t,e,r,n,i){for(;n>r;){if(n-r>600){var o=n-r+1,a=e-r+1,s=Math.log(o),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);Io(t,e,Math.max(r,Math.floor(e-a*l/o+u)),Math.min(n,Math.floor(e+(o-a)*l/o+u)),i)}var h=t[e],c=r,p=n;for(Lo(t,r,e),i(t[n],h)>0&&Lo(t,r,n);c0;)p--}0===i(t[r],h)?Lo(t,r,p):Lo(t,++p,n),p<=e&&(r=p+1),e<=p&&(n=p-1)}}function Lo(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Mo(t,e){return te?1:0}class Ao{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const r=[];if(!Wo(t,e))return r;const n=this.toBBox,i=[];for(;e;){for(let o=0;o=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(n,i,e)}_split(t,e){const r=t[e],n=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,n);const o=this._chooseSplitIndex(r,i,n),a=Yo(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,ko(r,this.toBBox),ko(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(r,a)}_splitRoot(t,e){this.data=Yo([t,e]),this.data.height=t.height+1,this.data.leaf=!1,ko(this.data,this.toBBox)}_chooseSplitIndex(t,e,r){let n,i=1/0,o=1/0;for(let a=e;a<=r-e;a++){const e=jo(t,0,a,this.toBBox),s=jo(t,a,r,this.toBBox),l=Vo(e,s),u=zo(e)+zo(s);l=e;n--){const e=t.children[n];Go(a,t.leaf?i(e):e),s+=Uo(a)}return s}_adjustParentBBoxes(t,e,r){for(let n=r;n>=0;n--)Go(e[n],t)}_condense(t){for(let e,r=t.length-1;r>=0;r--)0===t[r].children.length?r>0?(e=t[r-1].children,e.splice(e.indexOf(t[r]),1)):this.clear():ko(t[r],this.toBBox)}}function Do(t,e,r){if(!r)return e.indexOf(t);for(let n=0;n=t.minX&&e.maxY>=t.minY}function Yo(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Ko(t,e,r,n,i){const o=[e,r];for(;o.length;){if((r=o.pop())-(e=o.pop())<=n)continue;const a=e+Math.ceil((r-e)/n/2)*n;Fo(t,a,e,r,i),o.push(e,a,a,r)}}var Zo=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ho="renderOrder",qo=function(t){function e(e){var r=this,n=e||{},i=m({},n);return delete i.style,delete i.renderBuffer,delete i.updateWhileAnimating,delete i.updateWhileInteracting,(r=t.call(this,i)||this).declutter_=void 0!==n.declutter&&n.declutter,r.renderBuffer_=void 0!==n.renderBuffer?n.renderBuffer:100,r.style_=null,r.styleFunction_=void 0,r.setStyle(n.style),r.updateWhileAnimating_=void 0!==n.updateWhileAnimating&&n.updateWhileAnimating,r.updateWhileInteracting_=void 0!==n.updateWhileInteracting&&n.updateWhileInteracting,r}return Zo(e,t),e.prototype.getDeclutter=function(){return this.declutter_},e.prototype.getFeatures=function(e){return t.prototype.getFeatures.call(this,e)},e.prototype.getRenderBuffer=function(){return this.renderBuffer_},e.prototype.getRenderOrder=function(){return this.get(Ho)},e.prototype.getStyle=function(){return this.style_},e.prototype.getStyleFunction=function(){return this.styleFunction_},e.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_},e.prototype.getUpdateWhileInteracting=function(){return this.updateWhileInteracting_},e.prototype.renderDeclutter=function(t){t.declutterTree||(t.declutterTree=new Ao(9)),this.getRenderer().renderDeclutter(t)},e.prototype.setRenderOrder=function(t){this.set(Ho,t)},e.prototype.setStyle=function(t){this.style_=void 0!==t?t:eo,this.styleFunction_=null===t?void 0:function(t){var e;if("function"==typeof t)e=t;else{var r;Array.isArray(t)?r=t:(nt("function"==typeof t.getZIndex,41),r=[t]),e=function(){return r}}return e}(this.style_),this.changed()},e}(Oo),Jo={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},Qo=[Jo.FILL],$o=[Jo.STROKE],ta=[Jo.BEGIN_PATH],ea=[Jo.CLOSE_PATH],ra=Jo,na=function(){function t(){}return t.prototype.drawCustom=function(t,e,r,n){},t.prototype.drawGeometry=function(t){},t.prototype.setStyle=function(t){},t.prototype.drawCircle=function(t,e){},t.prototype.drawFeature=function(t,e){},t.prototype.drawGeometryCollection=function(t,e){},t.prototype.drawLineString=function(t,e){},t.prototype.drawMultiLineString=function(t,e){},t.prototype.drawMultiPoint=function(t,e){},t.prototype.drawMultiPolygon=function(t,e){},t.prototype.drawPoint=function(t,e){},t.prototype.drawPolygon=function(t,e){},t.prototype.drawText=function(t,e){},t.prototype.setFillStrokeStyle=function(t,e){},t.prototype.setImageStyle=function(t,e){},t.prototype.setTextStyle=function(t,e){},t}(),ia=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),oa=function(t){function e(e,r,n,i){var o=t.call(this)||this;return o.tolerance=e,o.maxExtent=r,o.pixelRatio=i,o.maxLineWidth=0,o.resolution=n,o.beginGeometryInstruction1_=null,o.beginGeometryInstruction2_=null,o.bufferedMaxExtent_=null,o.instructions=[],o.coordinates=[],o.tmpCoordinate_=[],o.hitDetectionInstructions=[],o.state={},o}return ia(e,t),e.prototype.applyPixelRatio=function(t){var e=this.pixelRatio;return 1==e?t:t.map((function(t){return t*e}))},e.prototype.appendFlatPointCoordinates=function(t,e){for(var r=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,i=this.coordinates,o=i.length,a=0,s=t.length;ac&&(this.instructions.push([ra.CUSTOM,c,o,t,r,un]),this.hitDetectionInstructions.push([ra.CUSTOM,c,o,t,n||r,un]));break;case ct:i=t.getFlatCoordinates(),this.coordinates.push(i[0],i[1]),o=this.coordinates.length,this.instructions.push([ra.CUSTOM,c,o,t,r]),this.hitDetectionInstructions.push([ra.CUSTOM,c,o,t,n||r])}this.endGeometry(e)},e.prototype.beginGeometry=function(t,e){this.beginGeometryInstruction1_=[ra.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[ra.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},e.prototype.finish=function(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}},e.prototype.reverseHitDetectionInstructions=function(){var t,e=this.hitDetectionInstructions;e.reverse();var r,n,i=e.length,o=-1;for(t=0;tthis.maxLineWidth&&(this.maxLineWidth=r.lineWidth,this.bufferedMaxExtent_=null)}else r.strokeStyle=void 0,r.lineCap=void 0,r.lineDash=null,r.lineDashOffset=void 0,r.lineJoin=void 0,r.lineWidth=void 0,r.miterLimit=void 0},e.prototype.createFill=function(t){var e=t.fillStyle,r=[ra.SET_FILL_STYLE,e];return"string"!=typeof e&&r.push(!0),r},e.prototype.applyStroke=function(t){this.instructions.push(this.createStroke(t))},e.prototype.createStroke=function(t){return[ra.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]},e.prototype.updateFillStyle=function(t,e){var r=t.fillStyle;"string"==typeof r&&t.currentFillStyle==r||(void 0!==r&&this.instructions.push(e.call(this,t)),t.currentFillStyle=r)},e.prototype.updateStrokeStyle=function(t,e){var r=t.strokeStyle,n=t.lineCap,i=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,s=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=r||t.currentLineCap!=n||i!=t.currentLineDash&&!g(t.currentLineDash,i)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=s||t.currentMiterLimit!=l)&&(void 0!==r&&e.call(this,t),t.currentStrokeStyle=r,t.currentLineCap=n,t.currentLineDash=i,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=s,t.currentMiterLimit=l)},e.prototype.endGeometry=function(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var e=[ra.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)},e.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=$t(this.maxExtent),this.maxLineWidth>0)){var t=this.resolution*(this.maxLineWidth+1)/2;Qt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},e}(na),aa=oa,sa=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),la=function(t){function e(e,r,n,i){var o=t.call(this,e,r,n,i)||this;return o.hitDetectionImage_=null,o.image_=null,o.imagePixelRatio_=void 0,o.anchorX_=void 0,o.anchorY_=void 0,o.height_=void 0,o.opacity_=void 0,o.originX_=void 0,o.originY_=void 0,o.rotateWithView_=void 0,o.rotation_=void 0,o.scale_=void 0,o.width_=void 0,o.declutterImageWithText_=void 0,o}return sa(e,t),e.prototype.drawPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var r=t.getFlatCoordinates(),n=t.getStride(),i=this.coordinates.length,o=this.appendFlatPointCoordinates(r,n);this.instructions.push([ra.DRAW_IMAGE,i,o,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([ra.DRAW_IMAGE,i,o,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(e)}},e.prototype.drawMultiPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var r=t.getFlatCoordinates(),n=t.getStride(),i=this.coordinates.length,o=this.appendFlatPointCoordinates(r,n);this.instructions.push([ra.DRAW_IMAGE,i,o,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([ra.DRAW_IMAGE,i,o,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(e)}},e.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,t.prototype.finish.call(this)},e.prototype.setImageStyle=function(t,e){var r=t.getAnchor(),n=t.getSize(),i=t.getHitDetectionImage(),o=t.getImage(this.pixelRatio),a=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=r[0],this.anchorY_=r[1],this.hitDetectionImage_=i,this.image_=o,this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=a[0]*this.imagePixelRatio_,this.originY_=a[1]*this.imagePixelRatio_,this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterImageWithText_=e},e}(aa),ua=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ha=function(t){function e(e,r,n,i){return t.call(this,e,r,n,i)||this}return ua(e,t),e.prototype.drawFlatCoordinates_=function(t,e,r,n){var i=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,r,n,!1,!1),a=[ra.MOVE_TO_LINE_TO,i,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),r},e.prototype.drawLineString=function(t,e){var r=this.state,n=r.strokeStyle,i=r.lineWidth;if(void 0!==n&&void 0!==i){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([ra.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Fi,0],ta);var o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push($o),this.endGeometry(e)}},e.prototype.drawMultiLineString=function(t,e){var r=this.state,n=r.strokeStyle,i=r.lineWidth;if(void 0!==n&&void 0!==i){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([ra.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset],ta);for(var o=t.getEnds(),a=t.getFlatCoordinates(),s=t.getStride(),l=0,u=0,h=o.length;ut&&(y>_&&(_=y,d=v,g=o),y=0,v=o-i)),a=s,h=p,c=f),l=m,u=x}return(y+=s)>_?[v,o]:[d,g]}var _a=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ya={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},va=function(t){function e(e,r,n,i){var o=t.call(this,e,r,n,i)||this;return o.labels_=null,o.text_="",o.textOffsetX_=0,o.textOffsetY_=0,o.textRotateWithView_=void 0,o.textRotation_=0,o.textFillState_=null,o.fillStates={},o.textStrokeState_=null,o.strokeStates={},o.textState_={},o.textStates={},o.textKey_="",o.fillKey_="",o.strokeKey_="",o.declutterImageWithText_=void 0,o}return _a(e,t),e.prototype.finish=function(){var e=t.prototype.finish.call(this);return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e},e.prototype.drawText=function(t,e){var r=this.textFillState_,n=this.textStrokeState_,i=this.textState_;if(""!==this.text_&&i&&(r||n)){var o=this.coordinates,a=o.length,s=t.getType(),l=null,u=t.getStride();if(i.placement!==ao||s!=pt&&s!=_t&&s!=dt&&s!=yt){var h=i.overflow?null:[];switch(s){case ct:case gt:l=t.getFlatCoordinates();break;case pt:l=t.getFlatMidpoint();break;case mt:l=t.getCenter();break;case _t:l=t.getFlatMidpoints(),u=2;break;case dt:l=t.getFlatInteriorPoint(),i.overflow||h.push(l[2]/this.resolution),u=3;break;case yt:var c=t.getFlatInteriorPoints();l=[];for(S=0,C=c.length;SP[2]}else T=x>b;var O,F=Math.PI,I=[],L=S+n===e;if(_=0,y=C,p=t[e=S],f=t[e+1],L){v(),O=Math.atan2(f-g,p-d),T&&(O+=O>0?-F:F);var M=(b+x)/2,A=(R+w)/2;return I[0]=[M,A,(E-o)/2,O,i],I}for(var D=0,k=i.length;D0?-F:F),void 0!==O){var G=j-O;if(G+=G>F?-2*F:G<-F?2*F:0,Math.abs(G)>a)return null}O=j;for(var N=D,B=0;Dt?t-l:i,x=o+u>e?e-u:o,w=f[3]+m*c[0]+f[1],S=f[0]+x*c[1]+f[2],C=y-f[3],E=v-f[0];return(d||0!==h)&&(ja[0]=C,Ba[0]=C,ja[1]=E,Ga[1]=E,Ga[0]=C+w,Na[0]=Ga[0],Na[1]=E+S,Ba[1]=Na[1]),0!==h?(kt(_=Gt([1,0,0,1,0,0],r,n,1,1,h,-r,-n),ja),kt(_,Ga),kt(_,Na),kt(_,Ba),ae(Math.min(ja[0],Ga[0],Na[0],Ba[0]),Math.min(ja[1],Ga[1],Na[1],Ba[1]),Math.max(ja[0],Ga[0],Na[0],Ba[0]),Math.max(ja[1],Ga[1],Na[1],Ba[1]),ka)):ae(Math.min(C,C+w),Math.min(E,E+S),Math.max(C,C+w),Math.max(E,E+S),ka),p&&(y=Math.round(y),v=Math.round(v)),{drawImageX:y,drawImageY:v,drawImageW:m,drawImageH:x,originX:l,originY:u,declutterBox:{minX:ka[0],minY:ka[1],maxX:ka[2],maxY:ka[3],value:g},canvasTransform:_,scale:c}},t.prototype.replayImageOrLabel_=function(t,e,r,n,i,o,a){var s=!(!o&&!a),l=n.declutterBox,u=t.canvas,h=a?a[2]*n.scale[0]/2:0;return l.minX-h<=u.width/e&&l.maxX+h>=0&&l.minY-h<=u.height/e&&l.maxY+h>=0&&(s&&this.replayTextBackground_(t,ja,Ga,Na,Ba,o,a),Yi(t,n.canvasTransform,i,r,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0},t.prototype.fill_=function(t){if(this.alignFill_){var e=kt(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;t.save(),t.translate(e[0]%r,e[1]%r),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()},t.prototype.setStrokeStyle_=function(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.setLineDash&&(t.lineDashOffset=e[7],t.setLineDash(e[6]))},t.prototype.drawLabelWithPointPlacement_=function(t,e,r,n){var i=this.textStates[e],o=this.createLabel(t,e,n,r),a=this.strokeStates[r],s=this.pixelRatio,l=Va(t,i.textAlign||Mi),u=ya[i.textBaseline||Ai],h=a&&a.lineWidth?a.lineWidth:0;return{label:o,anchorX:l*(o.width/s-2*i.scale[0])+2*(.5-l)*h,anchorY:u*o.height/s+2*(.5-u)*h}},t.prototype.execute_=function(t,e,r,n,i,o,a,s){var l,u,h;this.pixelCoordinates_&&g(r,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),l=Nr(this.coordinates,0,this.coordinates.length,2,r,this.pixelCoordinates_),u=this.renderedTransform_,h=r,u[0]=h[0],u[1]=h[1],u[2]=h[2],u[3]=h[3],u[4]=h[4],u[5]=h[5]);for(var c,p,f,d,_,y,v,m,x,w,S,C,E,T,b,R,P=0,O=n.length,F=0,I=0,L=0,M=null,A=null,D=this.coordinateCache_,k=this.viewRotation_,j=Math.round(1e12*Math.atan2(-r[1],r[0]))/1e12,G={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:k},N=this.instructions!=n||this.overlaps?0:200;PN&&(this.fill_(t),I=0),L>N&&(t.stroke(),L=0),I||L||(t.beginPath(),d=NaN,_=NaN),++P;break;case ra.CIRCLE:var z=l[F=B[1]],U=l[F+1],V=l[F+2]-z,X=l[F+3]-U,W=Math.sqrt(V*V+X*X);t.moveTo(z+W,U),t.arc(z,U,W,0,2*Math.PI,!0),++P;break;case ra.CLOSE_PATH:t.closePath(),++P;break;case ra.CUSTOM:F=B[1],c=B[2];var Y=B[3],K=B[4],Z=6==B.length?B[5]:void 0;G.geometry=Y,G.feature=E,P in D||(D[P]=[]);var H=D[P];Z?Z(l,F,c,2,H):(H[0]=l[F],H[1]=l[F+1],H.length=2),K(H,G),++P;break;case ra.DRAW_IMAGE:F=B[1],c=B[2],m=B[3],p=B[4],f=B[5];var q=B[6],J=B[7],Q=B[8],$=B[9],tt=B[10],et=B[11],rt=B[12],nt=B[13],it=B[14];if(!m&&B.length>=19){x=B[18],w=B[19],S=B[20],C=B[21];var ot=this.drawLabelWithPointPlacement_(x,w,S,C);m=ot.label,B[3]=m;var at=B[22];p=(ot.anchorX-at)*this.pixelRatio,B[4]=p;var st=B[23];f=(ot.anchorY-st)*this.pixelRatio,B[5]=f,q=m.height,B[6]=q,nt=m.width,B[13]=nt}var lt=void 0;B.length>24&&(lt=B[24]);var ut=void 0,ht=void 0,ct=void 0;B.length>16?(ut=B[15],ht=B[16],ct=B[17]):(ut=Di,ht=!1,ct=!1),tt&&j?et+=k:tt||j||(et-=k);for(var pt=0;Fr)break;var s=n[a];s||(s=[],n[a]=s),s.push(4*((t+i)*e+(t+o))+3),i>0&&s.push(4*((t-i)*e+(t+o))+3),o>0&&(s.push(4*((t+i)*e+(t-o))+3),i>0&&s.push(4*((t-i)*e+(t-o))+3))}for(var l=[],u=(i=0,n.length);i0){if(!o||p!==Ia&&p!==Aa||-1!==o.indexOf(t)){var u=(f[s]-3)/4,h=n-u%a,d=n-(u/a|0),g=i(t,e,h*h+d*d);if(g)return g}c.clearRect(0,0,a,a);break}}var g,_,y,v,m,x=Object.keys(this.executorsByZIndex_).map(Number);for(x.sort(h),g=x.length-1;g>=0;--g){var w=x[g].toString();for(y=this.executorsByZIndex_[w],_=Ya.length-1;_>=0;--_)if(void 0!==(v=y[p=Ya[_]])&&(m=v.executeHitDetection(c,s,r,d,u)))return m}},t.prototype.getClipCoords=function(t){var e=this.maxExtent_;if(!e)return null;var r=e[0],n=e[1],i=e[2],o=e[3],a=[r,n,r,o,i,o,i,n];return Nr(a,0,8,2,t,a),a},t.prototype.isEmpty=function(){return S(this.executorsByZIndex_)},t.prototype.execute=function(t,e,r,n,i,o,a){var s=Object.keys(this.executorsByZIndex_).map(Number);s.sort(h),this.maxExtent_&&(t.save(),this.clip(t,r));var l,u,c,p,f,d,g=o||Ya;for(a&&s.reverse(),l=0,u=s.length;lthis.maxCacheSize_},t.prototype.expire=function(){if(this.canExpireCache()){var t=0;for(var e in this.cache_){var r=this.cache_[e];0!=(3&t++)||r.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}},t.prototype.get=function(t,e,r){var n=ss(t,e,r);return n in this.cache_?this.cache_[n]:null},t.prototype.set=function(t,e,r,n){var i=ss(t,e,r);this.cache_[i]=n,++this.cacheSize_},t.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()},t}()),us=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),hs=function(t){function r(e,r,n,i){var o=t.call(this)||this;return o.extent=e,o.pixelRatio_=n,o.resolution=r,o.state=i,o}return us(r,t),r.prototype.changed=function(){this.dispatchEvent(T)},r.prototype.getExtent=function(){return this.extent},r.prototype.getImage=function(){return e()},r.prototype.getPixelRatio=function(){return this.pixelRatio_},r.prototype.getResolution=function(){return this.resolution},r.prototype.getState=function(){return this.state},r.prototype.load=function(){e()},r}(E),cs=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function ps(t,e,r){var n=t,i=!0,o=!1,a=!1,s=[B(n,D,(function(){a=!0,o||e()}))];return n.src&&Ft?(o=!0,n.decode().then((function(){i&&e()})).catch((function(t){i&&(a?e():r())}))):s.push(B(n,b,r)),function(){i=!1,s.forEach(z)}}var fs=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r,n,qn)||this;return s.src_=i,s.image_=new Image,null!==o&&(s.image_.crossOrigin=o),s.unlisten_=null,s.state=qn,s.imageLoadFunction_=a,s}return cs(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.handleImageError_=function(){this.state=$n,this.unlistenImage_(),this.changed()},e.prototype.handleImageLoad_=function(){void 0===this.resolution&&(this.resolution=Se(this.extent)/this.image_.height),this.state=Qn,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state!=qn&&this.state!=$n||(this.state=Jn,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=ps(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.setImage=function(t){this.image_=t,this.resolution=Se(this.extent)/this.image_.height},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(hs),ds=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),gs=null,_s=function(t){function e(e,r,n,i,o,a){var s=t.call(this)||this;return s.hitDetectionImage_=null,s.image_=e||new Image,null!==i&&(s.image_.crossOrigin=i),s.canvas_={},s.color_=a,s.unlisten_=null,s.imageState_=o,s.size_=n,s.src_=r,s.tainted_,s}return ds(e,t),e.prototype.isTainted_=function(){if(void 0===this.tainted_&&this.imageState_===Qn){gs||(gs=_i(1,1)),gs.drawImage(this.image_,0,0);try{gs.getImageData(0,0,1,1),this.tainted_=!1}catch(t){gs=null,this.tainted_=!0}}return!0===this.tainted_},e.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(T)},e.prototype.handleImageError_=function(){this.imageState_=$n,this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.handleImageLoad_=function(){this.imageState_=Qn,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_()},e.prototype.getImage=function(t){return this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_},e.prototype.getPixelRatio=function(t){return this.replaceColor_(t),this.canvas_[t]?t:1},e.prototype.getImageState=function(){return this.imageState_},e.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var t=this.size_[0],e=this.size_[1],r=_i(t,e);r.fillRect(0,0,t,e),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},e.prototype.getSize=function(){return this.size_},e.prototype.getSrc=function(){return this.src_},e.prototype.load=function(){if(this.imageState_==qn){this.imageState_=Jn;try{this.image_.src=this.src_}catch(t){this.handleImageError_()}this.unlisten_=ps(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},e.prototype.replaceColor_=function(t){if(this.color_&&!this.canvas_[t]&&this.imageState_===Qn){var e=document.createElement("canvas");this.canvas_[t]=e,e.width=Math.ceil(this.image_.width*t),e.height=Math.ceil(this.image_.height*t);var r=e.getContext("2d");if(r.scale(t,t),r.drawImage(this.image_,0,0),r.globalCompositeOperation="multiply","multiply"===r.globalCompositeOperation||this.isTainted_())r.fillStyle=ui(this.color_),r.fillRect(0,0,e.width/t,e.height/t),r.globalCompositeOperation="destination-in",r.drawImage(this.image_,0,0);else{for(var n=r.getImageData(0,0,e.width,e.height),i=n.data,o=this.color_[0]/255,a=this.color_[1]/255,s=this.color_[2]/255,l=this.color_[3],u=0,h=i.length;u0,6);var p=void 0!==i.src?qn:Qn;return r.color_=void 0!==i.color?pi(i.color):null,r.iconImage_=function(t,e,r,n,i,o){var a=ls.get(e,n,o);return a||(a=new _s(t,e,r,n,i,o),ls.set(e,n,o,a)),a}(u,c,h,r.crossOrigin_,p,r.color_),r.offset_=void 0!==i.offset?i.offset:[0,0],r.offsetOrigin_=void 0!==i.offsetOrigin?i.offsetOrigin:os,r.origin_=null,r.size_=void 0!==i.size?i.size:null,r}return ys(e,t),e.prototype.clone=function(){var t=this.getScale();return new e({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,crossOrigin:this.crossOrigin_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,src:this.getSrc(),offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,size:null!==this.size_?this.size_.slice():void 0,opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},e.prototype.getAnchor=function(){var t=this.normalizedAnchor_;if(!t){t=this.anchor_;var e=this.getSize();if(this.anchorXUnits_==es||this.anchorYUnits_==es){if(!e)return null;t=this.anchor_.slice(),this.anchorXUnits_==es&&(t[0]*=e[0]),this.anchorYUnits_==es&&(t[1]*=e[1])}if(this.anchorOrigin_!=os){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),this.anchorOrigin_!=as&&this.anchorOrigin_!=is||(t[0]=-t[0]+e[0]),this.anchorOrigin_!=ns&&this.anchorOrigin_!=is||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}var r=this.getDisplacement();return[t[0]-r[0],t[1]+r[1]]},e.prototype.setAnchor=function(t){this.anchor_=t,this.normalizedAnchor_=null},e.prototype.getColor=function(){return this.color_},e.prototype.getImage=function(t){return this.iconImage_.getImage(t)},e.prototype.getPixelRatio=function(t){return this.iconImage_.getPixelRatio(t)},e.prototype.getImageSize=function(){return this.iconImage_.getSize()},e.prototype.getImageState=function(){return this.iconImage_.getImageState()},e.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},e.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var t=this.offset_;if(this.offsetOrigin_!=os){var e=this.getSize(),r=this.iconImage_.getSize();if(!e||!r)return null;t=t.slice(),this.offsetOrigin_!=as&&this.offsetOrigin_!=is||(t[0]=r[0]-e[0]-t[0]),this.offsetOrigin_!=ns&&this.offsetOrigin_!=is||(t[1]=r[1]-e[1]-t[1])}return this.origin_=t,this.origin_},e.prototype.getSrc=function(){return this.iconImage_.getSrc()},e.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},e.prototype.listenImageChange=function(t){this.iconImage_.addEventListener(T,t)},e.prototype.load=function(){this.iconImage_.load()},e.prototype.unlistenImageChange=function(t){this.iconImage_.removeEventListener(T,t)},e}(ai),ms=vs,xs=.5;function ws(t,e,r,n,i,o,a){var s=_i(t[0]*xs,t[1]*xs);s.imageSmoothingEnabled=!1;for(var l=s.canvas,u=new ts(s,xs,i,null,a),c=r.length,p=Math.floor(16777215/c),f={},d=1;d<=c;++d){var g=r[d-1],_=g.getStyleFunction()||n;if(n){var y=_(g,o);if(y){Array.isArray(y)||(y=[y]);for(var v="#"+("000000"+(d*p).toString(16)).slice(-6),m=0,x=y.length;mf[2];)y=g*++_,u.push(this.getRenderTransform(n,i,o,xs,h,c,y).slice()),d-=g}this.hitDetectionImageData_=ws(r,u,this.renderedFeatures_,l.getStyleFunction(),s,i,o)}e(Ss(t,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},e.prototype.forEachFeatureAtCoordinate=function(t,e,r,i,o){var a=this;if(this.replayGroup_){var s,l=e.viewState.resolution,u=e.viewState.rotation,h=this.getLayer(),c={},p=function(t,e,r){var a=n(t),s=c[a];if(s){if(!0!==s&&r=r[2])){var i=be(r),o=Math.floor((n[0]-r[0])/i)*i;t[0]-=o,t[2]-=o}return t}(m[0],u);C[0]x[0]&&C[2]>x[2]&&m.push([C[0]-w,C[1],C[2]-w,C[3]])}if(!this.dirty_&&this.renderedResolution_==h&&this.renderedRevision_==p&&this.renderedRenderOrder_==d&&re(this.wrappedRenderedExtent_,y))return g(this.renderedExtent_,v)||(this.hitDetectionImageData_=null,this.renderedExtent_=v),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var E,T=new xa(bs(h,c),y,h,c);this.getLayer().getDeclutter()&&(E=new xa(bs(h,c),y,h,c));for(var b=0,R=m.length;b=200&&s.status<300){var n=e.getType(),l=void 0;n==Ks||n==Zs?l=s.responseText:n==Hs?(l=s.responseXML)||(l=(new DOMParser).parseFromString(s.responseText,"application/xml")):n==Ys&&(l=s.response),l?o(e.readFeatures(l,{extent:r,featureProjection:i}),e.readProjection(l)):a()}else a()},s.onerror=a,s.send()}function Js(t,e){return function(r,n,i,o,a){var s=this;qs(t,e,r,n,i,(function(t,e){s.addFeatures(t),void 0!==o&&o(t)}),a||v)}}var Qs=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),$s=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.feature=r,i.features=n,i}return Qs(e,t),e}(s),tl=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{attributions:n.attributions,projection:void 0,state:Eo,wrapX:void 0===n.wrapX||n.wrapX})||this).on,r.once,r.un,r.loader_=v,r.format_=n.format,r.overlaps_=void 0===n.overlaps||n.overlaps,r.url_=n.url,void 0!==n.loader?r.loader_=n.loader:void 0!==r.url_&&(nt(r.format_,7),r.loader_=Js(r.url_,r.format_)),r.strategy_=void 0!==n.strategy?n.strategy:Ws;var i,o,a=void 0===n.useSpatialIndex||n.useSpatialIndex;return r.featuresRtree_=a?new As:null,r.loadedExtentsRtree_=new As,r.loadingExtentsCount_=0,r.nullGeometryFeatures_={},r.idIndex_={},r.uidIndex_={},r.featureChangeKeys_={},r.featuresCollection_=null,Array.isArray(n.features)?o=n.features:n.features&&(o=(i=n.features).getArray()),a||void 0!==i||(i=new rt(o)),void 0!==o&&r.addFeaturesInternal(o),void 0!==i&&r.bindFeaturesCollection_(i),r}return Qs(e,t),e.prototype.addFeature=function(t){this.addFeatureInternal(t),this.changed()},e.prototype.addFeatureInternal=function(t){var e=n(t);if(this.addToIndex_(e,t)){this.setupChangeEvents_(e,t);var r=t.getGeometry();if(r){var i=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(i,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new $s(Gs,t))}else this.featuresCollection_&&this.featuresCollection_.remove(t)},e.prototype.setupChangeEvents_=function(t,e){this.featureChangeKeys_[t]=[N(e,T,this.handleFeatureChange_,this),N(e,l,this.handleFeatureChange_,this)]},e.prototype.addToIndex_=function(t,e){var r=!0,n=e.getId();return void 0!==n&&(n.toString()in this.idIndex_?r=!1:this.idIndex_[n.toString()]=e),r&&(nt(!(t in this.uidIndex_),30),this.uidIndex_[t]=e),r},e.prototype.addFeatures=function(t){this.addFeaturesInternal(t),this.changed()},e.prototype.addFeaturesInternal=function(t){for(var e=[],r=[],i=[],o=0,a=t.length;o0},e.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),t.prototype.refresh.call(this)},e.prototype.removeLoadedExtent=function(t){var e,r=this.loadedExtentsRtree_;r.forEachInExtent(t,(function(r){if(he(r.extent,t))return e=r,!0})),e&&r.remove(e)},e.prototype.removeFeature=function(t){if(t){var e=n(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t)&&this.changed()}},e.prototype.removeFeatureInternal=function(t){var e=n(t),r=this.featureChangeKeys_[e];if(r){r.forEach(z),delete this.featureChangeKeys_[e];var i=t.getId();return void 0!==i&&delete this.idIndex_[i.toString()],delete this.uidIndex_[e],this.dispatchEvent(new $s(zs,t)),t}},e.prototype.removeFromIdIndex_=function(t){var e=!1;for(var r in this.idIndex_)if(this.idIndex_[r]===t){delete this.idIndex_[r],e=!0;break}return e},e.prototype.setLoader=function(t){this.loader_=t},e.prototype.setUrl=function(t){nt(this.format_,7),this.url_=t,this.setLoader(Js(t,this.format_))},e}(js),el=0,rl=1,nl=2,il=3,ol=4;function al(t){return Math.pow(t,3)}function sl(t){return 1-al(1-t)}function ll(t){return 3*t*t-2*t*t*t}function ul(t){return t}var hl=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),cl=function(t){function r(e,r,n){var i=t.call(this)||this,o=n||{};return i.tileCoord=e,i.state=r,i.interimTile=null,i.key="",i.transition_=void 0===o.transition?250:o.transition,i.transitionStarts_={},i.interpolate=!!o.interpolate,i}return hl(r,t),r.prototype.changed=function(){this.dispatchEvent(T)},r.prototype.release=function(){},r.prototype.getKey=function(){return this.key+"/"+this.tileCoord},r.prototype.getInterimTile=function(){if(!this.interimTile)return this;var t=this.interimTile;do{if(t.getState()==nl)return this.transition_=0,t;t=t.interimTile}while(t);return this},r.prototype.refreshInterimChain=function(){if(this.interimTile){var t=this.interimTile,e=this;do{if(t.getState()==nl){t.interimTile=null;break}t.getState()==rl?e=t:t.getState()==el?e.interimTile=t.interimTile:e=t,t=e.interimTile}while(t)}},r.prototype.getTileCoord=function(){return this.tileCoord},r.prototype.getState=function(){return this.state},r.prototype.setState=function(t){if(this.state!==il&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()},r.prototype.load=function(){e()},r.prototype.getAlpha=function(t,e){if(!this.transition_)return 1;var r=this.transitionStarts_[t];if(r){if(-1===r)return 1}else r=e,this.transitionStarts_[t]=r;var n=e-r+1e3/60;return n>=this.transition_?1:al(n/this.transition_)},r.prototype.inTransition=function(t){return!!this.transition_&&-1!==this.transitionStarts_[t]},r.prototype.endTransition=function(t){this.transition_&&(this.transitionStarts_[t]=-1)},r}(E),pl=cl,fl=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var dl=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r,a)||this;return s.crossOrigin_=i,s.src_=n,s.key=n,s.image_=new Image,null!==i&&(s.image_.crossOrigin=i),s.unlisten_=null,s.tileLoadFunction_=o,s}return fl(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.setImage=function(t){this.image_=t,this.state=nl,this.unlistenImage_(),this.changed()},e.prototype.handleImageError_=function(){var t;this.state=il,this.unlistenImage_(),this.image_=((t=_i(1,1)).fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas),this.changed()},e.prototype.handleImageLoad_=function(){var t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=nl:this.state=ol,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state==il&&(this.state=el,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==el&&(this.state=rl,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=ps(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(pl),gl=function(){function t(t,e,r){this.decay_=t,this.minVelocity_=e,this.delay_=r,this.points_=[],this.angle_=0,this.initialVelocity_=0}return t.prototype.begin=function(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0},t.prototype.update=function(t,e){this.points_.push(t,e,Date.now())},t.prototype.end=function(){if(this.points_.length<6)return!1;var t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[r+2]>t;)r-=3;var n=this.points_[e+2]-this.points_[r+2];if(n<1e3/60)return!1;var i=this.points_[e]-this.points_[r],o=this.points_[e+1]-this.points_[r+1];return this.angle_=Math.atan2(o,i),this.initialVelocity_=Math.sqrt(i*i+o*o)/n,this.initialVelocity_>this.minVelocity_},t.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_},t.prototype.getAngle=function(){return this.angle_},t}(),_l=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),yl=function(t){function r(e){var r=t.call(this)||this;return r.map_=e,r}return _l(r,t),r.prototype.dispatchRenderEvent=function(t,r){e()},r.prototype.calculateMatrices2D=function(t){var e=t.viewState,r=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;Gt(r,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Nt(n,r)},r.prototype.forEachFeatureAtCoordinate=function(t,e,r,n,i,o,a,s){var l,u=e.viewState;function h(t,e,r,n){return i.call(o,e,t?r:null,n)}var c=u.projection,p=xr(t.slice(),c),f=[[0,0]];if(c.canWrapX()&&n){var d=be(c.getExtent());f.push([-d,0],[d,0])}for(var g=e.layerStatesArray,_=g.length,y=[],v=[],m=0;m=0;--x){var w=g[x],S=w.layer;if(S.hasRenderer()&&Po(w,u)&&a.call(s,S)){var C=S.getRenderer(),E=S.getSource();if(C&&E){var T=E.getWrapX()?p:t,b=h.bind(null,w.managed);v[0]=T[0]+f[m][0],v[1]=T[1]+f[m][1],l=C.forEachFeatureAtCoordinate(v,e,r,b,y)}if(l)return l}}if(0!==y.length){var R=1/y.length;return y.forEach((function(t,e){return t.distanceSq+=e*R})),y.sort((function(t,e){return t.distanceSq-e.distanceSq})),y.some((function(t){return l=t.callback(t.feature,t.layer,t.geometry)})),l}},r.prototype.forEachLayerAtPixel=function(t,r,n,i,o){return e()},r.prototype.hasFeatureAtCoordinate=function(t,e,r,n,i,o){return void 0!==this.forEachFeatureAtCoordinate(t,e,r,n,_,this,i,o)},r.prototype.getMap=function(){return this.map_},r.prototype.renderFrame=function(t){e()},r.prototype.scheduleExpireIconCache=function(t){ls.canExpireCache()&&t.postRenderFunctions.push(vl)},r}(u);function vl(t,e){ls.expire()}var ml=yl,xl=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),wl=function(t){function e(e){var r=t.call(this,e)||this;r.fontChangeListenerKey_=N(ki,l,e.redrawText.bind(e)),r.element_=document.createElement("div");var n=r.element_.style;n.position="absolute",n.width="100%",n.height="100%",n.zIndex="0",r.element_.className="ol-unselectable ol-layers";var i=e.getViewport();return i.insertBefore(r.element_,i.firstChild||null),r.children_=[],r.renderedVisible_=!0,r}return xl(e,t),e.prototype.dispatchRenderEvent=function(t,e){var r=this.getMap();if(r.hasListener(t)){var n=new Ta(t,void 0,e);r.dispatchEvent(n)}},e.prototype.disposeInternal=function(){z(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),t.prototype.disposeInternal.call(this)},e.prototype.renderFrame=function(t){if(t){this.calculateMatrices2D(t),this.dispatchRenderEvent(Nn,t);var e=t.layerStatesArray.sort((function(t,e){return t.zIndex-e.zIndex})),r=t.viewState;this.children_.length=0;for(var n=[],i=null,o=0,a=e.length;o=0;--o)n[o].renderDeclutter(t);!function(t,e){for(var r=t.childNodes,n=0;;++n){var i=r[n],o=e[n];if(!i&&!o)break;i!==o&&(i?o?t.insertBefore(o,i):(t.removeChild(i),--n):t.appendChild(o))}}(this.element_,this.children_),this.dispatchRenderEvent(Bn,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}else this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1)},e.prototype.forEachLayerAtPixel=function(t,e,r,n,i){for(var o=e.viewState,a=e.layerStatesArray,s=a.length-1;s>=0;--s){var l=a[s],u=l.layer;if(u.hasRenderer()&&Po(l,o)&&i(u)){var h=u.getRenderer().getDataAtPixel(t,e,r);if(h){var c=n(u,h);if(c)return c}}}},e}(ml),Sl=wl,Cl=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),El=function(t){function e(e,r){var n=t.call(this,e)||this;return n.layer=r,n}return Cl(e,t),e}(s),Tl="layers",bl=function(t){function e(e){var r=this,n=e||{},i=m({},n);delete i.layers;var o=n.layers;return(r=t.call(this,i)||this).on,r.once,r.un,r.layersListenerKeys_=[],r.listenerKeys_={},r.addChangeListener(Tl,r.handleLayersChanged_),o?Array.isArray(o)?o=new rt(o.slice(),{unique:!0}):nt("function"==typeof o.getArray,43):o=new rt(void 0,{unique:!0}),r.setLayers(o),r}return Cl(e,t),e.prototype.handleLayerChange_=function(){this.changed()},e.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(z),this.layersListenerKeys_.length=0;var t=this.getLayers();for(var e in this.layersListenerKeys_.push(N(t,J,this.handleLayersAdd_,this),N(t,Q,this.handleLayersRemove_,this)),this.listenerKeys_)this.listenerKeys_[e].forEach(z);x(this.listenerKeys_);for(var r=t.getArray(),n=0,i=r.length;nthis.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_},e.prototype.disposeInternal=function(){this.relayedListenerKey_&&(z(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(j,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(z(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(z),this.dragListenerKeys_.length=0,this.element_=null,t.prototype.disposeInternal.call(this)},e}(E),jl="postrender",Gl="movestart",Nl="moveend",Bl="layergroup",zl="size",Ul="target",Vl="view",Xl=1/0,Wl=function(){function t(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}return t.prototype.clear=function(){this.elements_.length=0,this.priorities_.length=0,x(this.queuedElements_)},t.prototype.dequeue=function(){var t=this.elements_,e=this.priorities_,r=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));var n=this.keyFunction_(r);return delete this.queuedElements_[n],r},t.prototype.enqueue=function(t){nt(!(this.keyFunction_(t)in this.queuedElements_),31);var e=this.priorityFunction_(t);return e!=Xl&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)},t.prototype.getCount=function(){return this.elements_.length},t.prototype.getLeftChildIndex_=function(t){return 2*t+1},t.prototype.getRightChildIndex_=function(t){return 2*t+2},t.prototype.getParentIndex_=function(t){return t-1>>1},t.prototype.heapify_=function(){var t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)},t.prototype.isEmpty=function(){return 0===this.elements_.length},t.prototype.isKeyQueued=function(t){return t in this.queuedElements_},t.prototype.isQueued=function(t){return this.isKeyQueued(this.keyFunction_(t))},t.prototype.siftUp_=function(t){for(var e=this.elements_,r=this.priorities_,n=e.length,i=e[t],o=r[t],a=t;t>1;){var s=this.getLeftChildIndex_(t),l=this.getRightChildIndex_(t),u=lt;){var a=this.getParentIndex_(e);if(!(n[a]>o))break;r[e]=r[a],n[e]=n[a],e=a}r[e]=i,n[e]=o},t.prototype.reprioritize=function(){var t,e,r,n=this.priorityFunction_,i=this.elements_,o=this.priorities_,a=0,s=i.length;for(e=0;e0;)n=(r=this.dequeue()[0]).getKey(),r.getState()!==el||n in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[n]=!0,++this.tilesLoading_,++i,r.load())},e}(Wl);var Zl={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"},Hl=256;function ql(t,e,r){return function(n,i,o,a,s){if(n){var l=e?0:o[0]*i,u=e?0:o[1]*i,h=s?s[0]:0,c=s?s[1]:0,p=t[0]+l/2+h,f=t[2]-l/2+h,d=t[1]+u/2+c,g=t[3]-u/2+c;p>f&&(f=p=(f+p)/2),d>g&&(g=d=(g+d)/2);var _=Ie(n[0],p,f),y=Ie(n[1],d,g),v=30*i;return a&&r&&(_+=-v*Math.log(1+Math.max(0,p-n[0])/v)+v*Math.log(1+Math.max(0,n[0]-f)/v),y+=-v*Math.log(1+Math.max(0,d-n[1])/v)+v*Math.log(1+Math.max(0,n[1]-g)/v)),[_,y]}}}function Jl(t){return t}function Ql(t,e,r,n){var i=be(e)/r[0],o=Se(e)/r[1];return n?Math.min(t,Math.max(i,o)):Math.min(t,Math.min(i,o))}function $l(t,e,r){var n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,r&&(n=Math.max(n,r),n/=Math.log(1+50*Math.max(0,r/t-1))/50+1),Ie(n,r/2,2*e)}function tu(t,e,r,n,i){return function(o,a,s,l){if(void 0!==o){var u=n?Ql(t,n,s,i):t;return(void 0===r||r)&&l?$l(o,u,e):Ie(o,e,u)}}}function eu(t){return void 0!==t?0:void 0}function ru(t){return void 0!==t?t:void 0}var nu=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),iu=function(t){function e(e){var r=t.call(this)||this;r.on,r.once,r.un;var n=m({},e);return r.hints_=[0,0],r.animations_=[],r.updateAnimationKey_,r.projection_=Rr(n.projection,"EPSG:3857"),r.viewportSize_=[100,100],r.targetCenter_=null,r.targetResolution_,r.targetRotation_,r.nextCenter_=null,r.nextResolution_,r.nextRotation_,r.cancelAnchor_=void 0,n.center&&(n.center=kr(n.center,r.projection_)),n.extent&&(n.extent=Gr(n.extent,r.projection_)),r.applyOptions_(n),r}return nu(e,t),e.prototype.applyOptions_=function(t){var e=m({},t);for(var r in Zl)delete e[r];this.setProperties(e,!0);var n=function(t){var e,r,n,i=28,o=2,a=void 0!==t.minZoom?t.minZoom:0,s=void 0!==t.maxZoom?t.maxZoom:i,l=void 0!==t.zoomFactor?t.zoomFactor:o,u=void 0!==t.multiWorld&&t.multiWorld,h=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,c=void 0!==t.showFullExtent&&t.showFullExtent,f=Rr(t.projection,"EPSG:3857"),d=f.getExtent(),g=t.constrainOnlyCenter,_=t.extent;u||_||!f.isGlobal()||(g=!1,_=d);if(void 0!==t.resolutions){var y=t.resolutions;r=y[a],n=void 0!==y[s]?y[s]:y[y.length-1],e=t.constrainResolution?function(t,e,r,n){return function(i,o,a,s){if(void 0!==i){var l=t[0],u=t[t.length-1],h=r?Ql(l,r,a,n):l;if(s)return void 0===e||e?$l(i,h,u):Ie(i,u,h);var c=Math.min(h,i),f=Math.floor(p(t,c,o));return t[f]>h&&f1&&"function"==typeof arguments[r-1]&&(e=arguments[r-1],--r);for(var n=0;n0},e.prototype.getInteracting=function(){return this.hints_[Ja]>0},e.prototype.cancelAnimations=function(){var t;this.setHint(qa,-this.hints_[qa]);for(var e=0,r=this.animations_.length;e=0;--r){for(var n=this.animations_[r],i=!0,o=0,a=n.length;o0?l/s.duration:1;u>=1?(s.complete=!0,u=1):i=!1;var h=s.easing(u);if(s.sourceCenter){var c=s.sourceCenter[0],p=s.sourceCenter[1],f=s.targetCenter[0],d=s.targetCenter[1];this.nextCenter_=s.targetCenter;var g=c+h*(f-c),_=p+h*(d-p);this.targetCenter_=[g,_]}if(s.sourceResolution&&s.targetResolution){var y=1===h?s.targetResolution:s.sourceResolution+h*(s.targetResolution-s.sourceResolution);if(s.anchor){var v=this.getViewportSize_(this.getRotation()),m=this.constraints_.resolution(y,0,v,!0);this.targetCenter_=this.calculateCenterZoom(m,s.anchor)}this.nextResolution_=s.targetResolution,this.targetResolution_=y,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){var x=1===h?Ge(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+h*(s.targetRotation-s.sourceRotation);if(s.anchor){var w=this.constraints_.rotation(x,!0);this.targetCenter_=this.calculateCenterRotate(w,s.anchor)}this.nextRotation_=s.targetRotation,this.targetRotation_=x}if(this.applyTargetState_(!0),e=!0,!s.complete)break}}if(i){this.animations_[r]=null,this.setHint(qa,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;var S=n[0].callback;S&&ou(S,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}},e.prototype.calculateCenterRotate=function(t,e){var r,n,i,o=this.getCenterInternal();return void 0!==o&&(_r(r=[o[0]-e[0],o[1]-e[1]],t-this.getRotation()),i=e,(n=r)[0]+=+i[0],n[1]+=+i[1]),r},e.prototype.calculateCenterZoom=function(t,e){var r,n=this.getCenterInternal(),i=this.getResolution();void 0!==n&&void 0!==i&&(r=[e[0]-t*(e[0]-n[0])/i,e[1]-t*(e[1]-n[1])/i]);return r},e.prototype.getViewportSize_=function(t){var e=this.viewportSize_;if(t){var r=e[0],n=e[1];return[Math.abs(r*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(r*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e},e.prototype.setViewportSize=function(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)},e.prototype.getCenter=function(){var t=this.getCenterInternal();return t?Dr(t,this.getProjection()):t},e.prototype.getCenterInternal=function(){return this.get(Zl.CENTER)},e.prototype.getConstraints=function(){return this.constraints_},e.prototype.getConstrainResolution=function(){return this.get("constrainResolution")},e.prototype.getHints=function(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()},e.prototype.calculateExtent=function(t){return jr(this.calculateExtentInternal(t),this.getProjection())},e.prototype.calculateExtentInternal=function(t){var e=t||this.getViewportSizeMinusPadding_(),r=this.getCenterInternal();nt(r,1);var n=this.getResolution();nt(void 0!==n,2);var i=this.getRotation();return nt(void 0!==i,3),we(r,n,i,e)},e.prototype.getMaxResolution=function(){return this.maxResolution_},e.prototype.getMinResolution=function(){return this.minResolution_},e.prototype.getMaxZoom=function(){return this.getZoomForResolution(this.minResolution_)},e.prototype.setMaxZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))},e.prototype.getMinZoom=function(){return this.getZoomForResolution(this.maxResolution_)},e.prototype.setMinZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))},e.prototype.setConstrainResolution=function(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))},e.prototype.getProjection=function(){return this.projection_},e.prototype.getResolution=function(){return this.get(Zl.RESOLUTION)},e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.getResolutionForExtent=function(t,e){return this.getResolutionForExtentInternal(Gr(t,this.getProjection()),e)},e.prototype.getResolutionForExtentInternal=function(t,e){var r=e||this.getViewportSizeMinusPadding_(),n=be(t)/r[0],i=Se(t)/r[1];return Math.max(n,i)},e.prototype.getResolutionForValueFunction=function(t){var e=t||2,r=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,i=Math.log(r/n)/Math.log(e);return function(t){return r/Math.pow(e,t*i)}},e.prototype.getRotation=function(){return this.get(Zl.ROTATION)},e.prototype.getValueForResolutionFunction=function(t){var e=Math.log(t||2),r=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,i=Math.log(r/n)/e;return function(t){return Math.log(r/t)/e/i}},e.prototype.getViewportSizeMinusPadding_=function(t){var e=this.getViewportSize_(t),r=this.padding_;return r&&(e=[e[0]-r[1]-r[3],e[1]-r[0]-r[2]]),e},e.prototype.getState=function(){var t=this.getProjection(),e=this.getResolution(),r=this.getRotation(),n=this.getCenterInternal(),i=this.padding_;if(i){var o=this.getViewportSizeMinusPadding_();n=su(n,this.getViewportSize_(),[o[0]/2+i[3],o[1]/2+i[0]],e,r)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:r,zoom:this.getZoom()}},e.prototype.getZoom=function(){var t,e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t},e.prototype.getZoomForResolution=function(t){var e,r,n=this.minZoom_||0;if(this.resolutions_){var i=p(this.resolutions_,t,1);n=i,e=this.resolutions_[i],r=i==this.resolutions_.length-1?2:e/this.resolutions_[i+1]}else e=this.maxResolution_,r=this.zoomFactor_;return n+Math.log(e/t)/Math.log(r)},e.prototype.getResolutionForZoom=function(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;var e=Ie(Math.floor(t),0,this.resolutions_.length-2),r=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(r,Ie(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)},e.prototype.fit=function(t,e){var r;if(nt(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t))nt(!Pe(t),25),r=Dn(n=Gr(t,this.getProjection()));else if(t.getType()===mt){var n;(r=Dn(n=Gr(t.getExtent(),this.getProjection()))).rotate(this.getRotation(),me(n))}else{r=t}this.fitInternal(r,e)},e.prototype.rotatedExtentForGeometry=function(t){for(var e=this.getRotation(),r=Math.cos(e),n=Math.sin(-e),i=t.getFlatCoordinates(),o=t.getStride(),a=1/0,s=1/0,l=-1/0,u=-1/0,h=0,c=i.length;h=0;s--){var l=a[s];if(l.getMap()===this&&l.getActive()&&this.getTargetElement())if(!l.handleEvent(t)||t.propagationStopped)break}}},e.prototype.handlePostRender=function(){var t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){var r=this.maxTilesLoading_,n=r;if(t){var i=t.viewHints;if(i[qa]||i[Ja]){var o=Date.now()-t.time>8;r=o?0:8,n=o?0:2}}e.getTilesLoading()0;if(this.renderedVisible_!=r&&(this.element.style.display=r?"":"none",this.renderedVisible_=r),!g(e,this.renderedAttributions_)){!function(t){for(;t.lastChild;)t.removeChild(t.lastChild)}(this.ulElement_);for(var n=0,i=e.length;n0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:sl}):t.setRotation(0))}},e.prototype.render=function(t){var e=t.frameState;if(e){var r=e.viewState.rotation;if(r!=this.rotation_){var n="rotate("+r+"rad)";if(this.autoHide_){var i=this.element.classList.contains(mi);i||0!==r?i&&0!==r&&this.element.classList.remove(mi):this.element.classList.add(mi)}this.label_.style.transform=n}this.rotation_=r}},e}(gu),Su=wu,Cu=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Eu=function(t){function e(e){var r=this,n=e||{};r=t.call(this,{element:document.createElement("div"),target:n.target})||this;var i=void 0!==n.className?n.className:"ol-zoom",o=void 0!==n.delta?n.delta:1,a=void 0!==n.zoomInClassName?n.zoomInClassName:i+"-in",s=void 0!==n.zoomOutClassName?n.zoomOutClassName:i+"-out",l=void 0!==n.zoomInLabel?n.zoomInLabel:"+",u=void 0!==n.zoomOutLabel?n.zoomOutLabel:"–",h=void 0!==n.zoomInTipLabel?n.zoomInTipLabel:"Zoom in",c=void 0!==n.zoomOutTipLabel?n.zoomOutTipLabel:"Zoom out",p=document.createElement("button");p.className=a,p.setAttribute("type","button"),p.title=h,p.appendChild("string"==typeof l?document.createTextNode(l):l),p.addEventListener(P,r.handleClick_.bind(r,o),!1);var f=document.createElement("button");f.className=s,f.setAttribute("type","button"),f.title=c,f.appendChild("string"==typeof u?document.createTextNode(u):u),f.addEventListener(P,r.handleClick_.bind(r,-o),!1);var d=i+" "+"ol-unselectable "+wi,g=r.element;return g.className=d,g.appendChild(p),g.appendChild(f),r.duration_=void 0!==n.duration?n.duration:250,r}return Cu(e,t),e.prototype.handleClick_=function(t,e){e.preventDefault(),this.zoomByDelta_(t)},e.prototype.zoomByDelta_=function(t){var e=this.getMap().getView();if(e){var r=e.getZoom();if(void 0!==r){var n=e.getConstrainedZoom(r+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:sl})):e.setZoom(n)}}},e}(gu),Tu=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),bu="units",Ru="degrees",Pu="imperial",Ou="nautical",Fu="metric",Iu="us",Lu=[1,2,5],Mu=25.4/.28,Au=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).on,r.once,r.un,r.innerElement_=document.createElement("div"),r.innerElement_.className=i+"-inner",r.element.className=i+" "+xi,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.addChangeListener(bu,r.handleUnitsChanged_),r.setUnits(n.units||Fu),r.scaleBar_=n.bar||!1,r.scaleBarSteps_=n.steps||4,r.scaleBarText_=n.text||!1,r.dpi_=n.dpi||void 0,r}return Tu(e,t),e.prototype.getUnits=function(){return this.get(bu)},e.prototype.handleUnitsChanged_=function(){this.updateElement_()},e.prototype.setUnits=function(t){this.set(bu,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==Ru?St.DEGREES:St.METERS,o=Tr(r,t.resolution,e,i),a=this.minWidth_*(this.dpi_||Mu)/Mu,s=a*o,l="";if(n==Ru){var u=wt[St.DEGREES];(s*=u)=a)break;++d}f=this.scaleBar_?this.createScaleBar(c,h,l):h.toFixed(p<0?-p:0)+" "+l,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=Tr(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center),e=this.dpi_||Mu,r=this.viewState_.projection.getMetersPerUnit();return parseFloat(t.toString())*r*(1e3/25.4)*e},e.prototype.render=function(t){var e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()},e}(gu),Du=Au;var ku="active",ju=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Gu(t,e,r,n){var i=t.getZoom();if(void 0!==i){var o=t.getConstrainedZoom(i+e),a=t.getResolutionForZoom(o);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:a,anchor:r,duration:void 0!==n?n:250,easing:sl})}}var Nu=function(t){function e(e){var r=t.call(this)||this;return r.on,r.once,r.un,e&&e.handleEvent&&(r.handleEvent=e.handleEvent),r.map_=null,r.setActive(!0),r}return ju(e,t),e.prototype.getActive=function(){return this.get(ku)},e.prototype.getMap=function(){return this.map_},e.prototype.handleEvent=function(t){return!0},e.prototype.setActive=function(t){this.set(ku,t)},e.prototype.setMap=function(t){this.map_=t},e}(q),Bu=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),zu=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.delta_=n.delta?n.delta:1,r.duration_=void 0!==n.duration?n.duration:250,r}return Bu(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==Ll.DBLCLICK){var r=t.originalEvent,n=t.map,i=t.coordinate,o=r.shiftKey?-this.delta_:this.delta_;Gu(n.getView(),o,i,this.duration_),r.preventDefault(),e=!0}return!e},e}(Nu),Uu=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Vu(t){for(var e=t.length,r=0,n=0,i=0;i0}}else if(t.type==Ll.POINTERDOWN){var n=this.handleDownEvent(t);this.handlingDownUpSequence=n,e=this.stopDown(n)}else t.type==Ll.POINTERMOVE&&this.handleMoveEvent(t);return!e},e.prototype.handleMoveEvent=function(t){},e.prototype.handleUpEvent=function(t){return!1},e.prototype.stopDown=function(t){return t},e.prototype.updateTrackedPointers_=function(t){if(function(t){var e=t.type;return e===Ll.POINTERDOWN||e===Ll.POINTERDRAG||e===Ll.POINTERUP}(t)){var e=t.originalEvent,r=e.pointerId.toString();t.type==Ll.POINTERUP?delete this.trackedPointers_[r]:(t.type==Ll.POINTERDOWN||r in this.trackedPointers_)&&(this.trackedPointers_[r]=e),this.targetPointers=w(this.trackedPointers_)}},e}(Nu);function Wu(t){var e=arguments;return function(t){for(var r=!0,n=0,i=e.length;n0&&this.condition_(t)){var e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1},e}(Xu),oh=ih,ah=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),sh=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{stopDown:y})||this).condition_=n.condition?n.condition:Yu,r.lastAngle_=void 0,r.duration_=void 0!==n.duration?n.duration:250,r}return ah(e,t),e.prototype.handleDragEvent=function(t){if(eh(t)){var e=t.map,r=e.getView();if(r.getConstraints().rotation!==eu){var n=e.getSize(),i=t.pixel,o=Math.atan2(n[1]/2-i[1],i[0]-n[0]/2);if(void 0!==this.lastAngle_){var a=o-this.lastAngle_;r.adjustRotationInternal(-a)}this.lastAngle_=o}}},e.prototype.handleUpEvent=function(t){return!eh(t)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){return!!eh(t)&&(!(!Hu(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))},e}(Xu),lh=sh,uh=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),hh=function(t){function e(e){var r=t.call(this)||this;return r.geometry_=null,r.element_=document.createElement("div"),r.element_.style.position="absolute",r.element_.style.pointerEvents="auto",r.element_.className="ol-box "+e,r.map_=null,r.startPixel_=null,r.endPixel_=null,r}return uh(e,t),e.prototype.disposeInternal=function(){this.setMap(null)},e.prototype.render_=function(){var t=this.startPixel_,e=this.endPixel_,r="px",n=this.element_.style;n.left=Math.min(t[0],e[0])+r,n.top=Math.min(t[1],e[1])+r,n.width=Math.abs(e[0]-t[0])+r,n.height=Math.abs(e[1]-t[1])+r},e.prototype.setMap=function(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);var e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)},e.prototype.setPixels=function(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()},e.prototype.createOrUpdateGeometry=function(){var t=this.startPixel_,e=this.endPixel_,r=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new An([r])},e.prototype.getGeometry=function(){return this.geometry_},e}(u),ch=hh,ph=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),fh="boxstart",dh="boxdrag",gh="boxend",_h="boxcancel",yh=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.coordinate=r,i.mapBrowserEvent=n,i}return ph(e,t),e}(s),vh=function(t){function e(e){var r=t.call(this)||this;r.on,r.once,r.un;var n=e||{};return r.box_=new ch(n.className||"ol-dragbox"),r.minArea_=void 0!==n.minArea?n.minArea:64,n.onBoxEnd&&(r.onBoxEnd=n.onBoxEnd),r.startPixel_=null,r.condition_=n.condition?n.condition:Hu,r.boxEndCondition_=n.boxEndCondition?n.boxEndCondition:r.defaultBoxEndCondition,r}return ph(e,t),e.prototype.defaultBoxEndCondition=function(t,e,r){var n=r[0]-e[0],i=r[1]-e[1];return n*n+i*i>=this.minArea_},e.prototype.getGeometry=function(){return this.box_.getGeometry()},e.prototype.handleDragEvent=function(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new yh(dh,t.coordinate,t))},e.prototype.handleUpEvent=function(t){this.box_.setMap(null);var e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new yh(e?gh:_h,t.coordinate,t)),!1},e.prototype.handleDownEvent=function(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new yh(fh,t.coordinate,t)),!0)},e.prototype.onBoxEnd=function(t){},e}(Xu),mh=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xh=function(t){function e(e){var r=this,n=e||{},i=n.condition?n.condition:$u;return(r=t.call(this,{condition:i,className:n.className||"ol-dragzoom",minArea:n.minArea})||this).duration_=void 0!==n.duration?n.duration:200,r.out_=void 0!==n.out&&n.out,r}return mh(e,t),e.prototype.onBoxEnd=function(t){var e=this.getMap().getView(),r=this.getGeometry();if(this.out_){var n=e.rotatedExtentForGeometry(r),i=e.getResolutionForExtentInternal(n),o=e.getResolution()/i;(r=r.clone()).scale(o*o)}e.fitInternal(r,{duration:this.duration_,easing:sl})},e}(vh),wh=37,Sh=38,Ch=39,Eh=40,Th=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),bh=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.defaultCondition_=function(t){return Qu(t)&&th(t)},r.condition_=void 0!==n.condition?n.condition:r.defaultCondition_,r.duration_=void 0!==n.duration?n.duration:100,r.pixelDelta_=void 0!==n.pixelDelta?n.pixelDelta:128,r}return Th(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==M){var r=t.originalEvent,n=r.keyCode;if(this.condition_(t)&&(n==Eh||n==wh||n==Ch||n==Sh)){var i=t.map.getView(),o=i.getResolution()*this.pixelDelta_,a=0,s=0;n==Eh?s=-o:n==wh?a=-o:n==Ch?a=o:s=o;var l=[a,s];_r(l,i.getRotation()),function(t,e,r){var n=t.getCenterInternal();if(n){var i=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==r?r:250,easing:ul,center:t.getConstrainedCenter(i)})}}(i,l,this.duration_),r.preventDefault(),e=!0}}return!e},e}(Nu),Rh=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ph=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.condition_=n.condition?n.condition:th,r.delta_=n.delta?n.delta:1,r.duration_=void 0!==n.duration?n.duration:100,r}return Rh(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==M||t.type==A){var r=t.originalEvent,n=r.charCode;if(this.condition_(t)&&(n=="+".charCodeAt(0)||n=="-".charCodeAt(0))){var i=t.map,o=n=="+".charCodeAt(0)?this.delta_:-this.delta_;Gu(i.getView(),o,void 0,this.duration_),r.preventDefault(),e=!0}}return!e},e}(Nu),Oh=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Fh="trackpad",Ih="wheel",Lh=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,n)||this).totalDelta_=0,r.lastDelta_=0,r.maxDelta_=void 0!==n.maxDelta?n.maxDelta:1,r.duration_=void 0!==n.duration?n.duration:250,r.timeout_=void 0!==n.timeout?n.timeout:80,r.useAnchor_=void 0===n.useAnchor||n.useAnchor,r.constrainResolution_=void 0!==n.constrainResolution&&n.constrainResolution;var i=n.condition?n.condition:Zu;return r.condition_=n.onFocusOnly?Wu(Ku,i):i,r.lastAnchor_=null,r.startTime_=void 0,r.timeoutId_,r.mode_=void 0,r.trackpadEventGap_=400,r.trackpadTimeoutId_,r.deltaPerZoom_=300,r}return Oh(e,t),e.prototype.endInteraction_=function(){this.trackpadTimeoutId_=void 0,this.getMap().getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;if(t.type!==G)return!0;var e,r=t.map,n=t.originalEvent;if(n.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==G&&(e=n.deltaY,Et&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(e/=Pt),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(e*=40)),0===e)return!1;this.lastDelta_=e;var i=Date.now();void 0===this.startTime_&&(this.startTime_=i),(!this.mode_||i-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(e)<4?Fh:Ih);var o=r.getView();if(this.mode_===Fh&&!o.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),o.adjustZoom(-e/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=i,!1;this.totalDelta_+=e;var a=Math.max(this.timeout_-(i-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,r),a),!1},e.prototype.handleWheelZoom_=function(t){var e=t.getView();e.getAnimating()&&e.cancelAnimations();var r=-Ie(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(r=r?r>0?1:-1:0),Gu(e,r,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0},e.prototype.setMouseAnchor=function(t){this.useAnchor_=t,t||(this.lastAnchor_=null)},e}(Nu),Mh=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ah=function(t){function e(e){var r=this,n=e||{},i=n;return i.stopDown||(i.stopDown=y),(r=t.call(this,i)||this).anchor_=null,r.lastAngle_=void 0,r.rotating_=!1,r.rotationDelta_=0,r.threshold_=void 0!==n.threshold?n.threshold:.3,r.duration_=void 0!==n.duration?n.duration:250,r}return Mh(e,t),e.prototype.handleDragEvent=function(t){var e=0,r=this.targetPointers[0],n=this.targetPointers[1],i=Math.atan2(n.clientY-r.clientY,n.clientX-r.clientX);if(void 0!==this.lastAngle_){var o=i-this.lastAngle_;this.rotationDelta_+=o,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=o}this.lastAngle_=i;var a=t.map,s=a.getView();if(s.getConstraints().rotation!==eu){var l=a.getViewport().getBoundingClientRect(),u=Vu(this.targetPointers);u[0]-=l.left,u[1]-=l.top,this.anchor_=a.getCoordinateFromPixelInternal(u),this.rotating_&&(a.render(),s.adjustRotationInternal(e,this.anchor_))}},e.prototype.handleUpEvent=function(t){return!(this.targetPointers.length<2)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}(Xu),Dh=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),kh=function(t){function e(e){var r=this,n=e||{},i=n;return i.stopDown||(i.stopDown=y),(r=t.call(this,i)||this).anchor_=null,r.duration_=void 0!==n.duration?n.duration:400,r.lastDistance_=void 0,r.lastScaleDelta_=1,r}return Dh(e,t),e.prototype.handleDragEvent=function(t){var e=1,r=this.targetPointers[0],n=this.targetPointers[1],i=r.clientX-n.clientX,o=r.clientY-n.clientY,a=Math.sqrt(i*i+o*o);void 0!==this.lastDistance_&&(e=this.lastDistance_/a),this.lastDistance_=a;var s=t.map,l=s.getView();1!=e&&(this.lastScaleDelta_=e);var u=s.getViewport().getBoundingClientRect(),h=Vu(this.targetPointers);h[0]-=u.left,h[1]-=u.top,this.anchor_=s.getCoordinateFromPixelInternal(h),s.render(),l.adjustResolutionInternal(e,this.anchor_)},e.prototype.handleUpEvent=function(t){if(this.targetPointers.length<2){var e=t.map.getView(),r=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,r),!1}return!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}(Xu),jh=kh,Gh=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Nh="addfeatures",Bh=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.features=n,o.file=r,o.projection=i,o}return Gh(e,t),e}(s),zh=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{handleEvent:_})||this).on,r.once,r.un,r.readAsBuffer_=!1,r.formats_=[];for(var i=n.formatConstructors?n.formatConstructors:[],o=0,a=i.length;o0){this.source_&&(this.source_.clear(),this.source_.addFeatures(c)),this.dispatchEvent(new Bh(Nh,t,c,o));break}}},e.prototype.registerListeners_=function(){var t=this.getMap();if(t){var e=this.target?this.target:t.getViewport();this.dropListenKeys_=[N(e,L,this.handleDrop,this),N(e,F,this.handleStop,this),N(e,I,this.handleStop,this),N(e,L,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(z),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!!eh(t)&&(!!this.condition_(t)&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0))},e}(Xu),Wh=Xh,Yh=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Kh=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 Yh(e,t),e.prototype.clone=function(){var t=new e(this.flatCoordinates.slice(),void 0,this.layout);return t.applyProperties(this),t},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]||ge(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===Ll.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(e.coordinate),n=!1):this.freehand_&&e.type===Ll.POINTERDOWN?n=!1:r&&this.getPointerCount()<2?(n=e.type===Ll.POINTERMOVE)&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):("mouse"===e.originalEvent.pointerType||e.type===Ll.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(e):e.type===Ll.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.coordinate),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(function(){this.handlePointerMove_(new Il(Ll.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;if(0===this.getPointerCount())if(this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t),this.shouldHandle_){var r=!this.finishCoordinate_;r&&this.startDrawing_(t.coordinate),!r&&this.freehand_?this.finishDrawing():this.freehand_||r&&this.mode_!==ac||(this.atFinish_(t.pixel)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t.coordinate)),e=!1}else this.freehand_&&this.abortDrawing();return!e&&this.stopClick_&&t.preventDefault(),e},e.prototype.handlePointerMove_=function(t){if(this.pointerType_=t.originalEvent.pointerType,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.coordinate):this.createOrUpdateSketchPoint_(t.coordinate.slice())},e.prototype.atFinish_=function(t){var e=!1;if(this.sketchFeature_){var r=!1,n=[this.finishCoordinate_],i=this.mode_;if(i===ac)e=!0;else if(i===uc)e=2===this.sketchCoords_.length;else if(i===sc)r=this.sketchCoords_.length>this.minPoints_;else if(i===lc){var o=this.sketchCoords_;r=o[0].length>this.minPoints_,n=[o[0][0],o[0][o[0].length-2]]}if(r)for(var a=this.getMap(),s=0,l=n.length;s=this.maxPoints_&&(this.freehand_?r.pop():e=!0),r.push(t.slice()),this.geometryFunction_(r,n,i)):o===lc&&((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.createOrUpdateSketchPoint_(t.slice()),this.updateSketchFeatures_(),e&&this.finishDrawing()},e.prototype.removeLastPoint=function(){if(this.sketchFeature_){var t,e=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection(),n=this.mode_;if(n===sc||n===uc){if((t=this.sketchCoords_).splice(-2,1),t.length>=2){this.finishCoordinate_=t[t.length-2].slice();var i=this.finishCoordinate_.slice();t[t.length-1]=i,this.createOrUpdateSketchPoint_(i)}this.geometryFunction_(t,e,r),e.getType()===dt&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(e)}else if(n===lc){(t=this.sketchCoords_[0]).splice(-2,1);var o=this.sketchLine_.getGeometry();if(t.length>=2){i=t[t.length-2].slice();t[t.length-1]=i,this.createOrUpdateSketchPoint_(i)}o.setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,r)}1===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_===sc?(e.pop(),this.geometryFunction_(e,r,n)):this.mode_===lc&&(e[0].pop(),this.geometryFunction_(e,r,n),e=r.getCoordinates()),this.type_===gt?t.setGeometry(new tc([e])):this.type_===_t?t.setGeometry(new Jh([e])):this.type_===yt&&t.setGeometry(new ic([e])),this.dispatchEvent(new fc(cc,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 fc(pc,t))},e.prototype.appendCoordinates=function(t){var e,r=this.mode_,n=!this.sketchFeature_;if(n&&this.startDrawing_(t[0]),r===sc||r===uc)e=this.sketchCoords_;else{if(r!==lc)return;e=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]}n&&e.shift(),e.pop();for(var 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(Dn(t)):e.setGeometry(void 0):(e=new at(t?Dn(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 at(new mn(t)),this.vertexFeature_=e,this.vertexOverlay_.getSource().addFeature(e));return e},e.prototype.handleEvent=function(e){return!e.originalEvent||!this.condition_(e)||(e.type!=Ll.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_=wc(o(i)):null!==a?this.pointerHandler_=Sc(o([a,n[1]]),o([a,n[3]])):null!==s&&(this.pointerHandler_=Sc(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_=wc(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!==_e(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 jr(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 vc(this.extent_))},e}(Xu),Ec=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Tc=[0,0,0,0],bc=[],Rc="modifystart",Pc="modifyend",Oc=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.features=r,i.mapBrowserEvent=n,i}return Ec(e,t),e}(s),Fc=function(t){function e(e){var r,n=t.call(this,e)||this;if(n.on,n.once,n.un,n.boundHandleFeatureChange_=n.handleFeatureChange_.bind(n),n.condition_=e.condition?e.condition:rh,n.defaultDeleteCondition_=function(t){return function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey}(t)&&Ju(t)},n.deleteCondition_=e.deleteCondition?e.deleteCondition:n.defaultDeleteCondition_,n.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:Zu,n.vertexFeature_=null,n.vertexSegments_=null,n.lastPixel_=[0,0],n.ignoreNextSingleClick_=!1,n.featuresBeingModified_=null,n.rBush_=new As,n.pixelTolerance_=void 0!==e.pixelTolerance?e.pixelTolerance:10,n.snappedToVertex_=!1,n.changingFeature_=!1,n.dragSegments_=[],n.overlay_=new Ms({source:new tl({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:Ac(),updateWhileAnimating:!0,updateWhileInteracting:!0}),n.SEGMENT_WRITERS_={Point:n.writePointGeometry_.bind(n),LineString:n.writeLineStringGeometry_.bind(n),LinearRing:n.writeLineStringGeometry_.bind(n),Polygon:n.writePolygonGeometry_.bind(n),MultiPoint:n.writeMultiPointGeometry_.bind(n),MultiLineString:n.writeMultiLineStringGeometry_.bind(n),MultiPolygon:n.writeMultiPolygonGeometry_.bind(n),Circle:n.writeCircleGeometry_.bind(n),GeometryCollection:n.writeGeometryCollectionGeometry_.bind(n)},n.source_=null,n.hitDetection_=null,e.features?r=e.features:e.source&&(n.source_=e.source,r=new rt(n.source_.getFeatures()),n.source_.addEventListener(Gs,n.handleSourceAdd_.bind(n)),n.source_.addEventListener(zs,n.handleSourceRemove_.bind(n))),!r)throw new Error("The modify interaction requires features, a source or a layer");return e.hitDetection&&(n.hitDetection_=e.hitDetection),n.features_=r,n.features_.forEach(n.addFeature_.bind(n)),n.features_.addEventListener(J,n.handleFeatureAdd_.bind(n)),n.features_.addEventListener(Q,n.handleFeatureRemove_.bind(n)),n.lastPointerEvent_=null,n.delta_=[0,0],n.snapToPointer_=void 0===e.snapToPointer?!n.hitDetection_:e.snapToPointer,n}return Ec(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(T,this.boundHandleFeatureChange_)},e.prototype.willModifyFeatures_=function(t,e){if(!this.featuresBeingModified_){this.featuresBeingModified_=new rt;for(var r=this.featuresBeingModified_.getArray(),n=0,i=e.length;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;--_)this.insertVertex_(o[_],a)}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()===mt){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(le(i),o);var s=n;this.rBush_.update(s.getExtent(),a)}else this.rBush_.update(Jt(r.segment),r)}return this.featuresBeingModified_&&(this.dispatchEvent(new Oc(Pc,this.featuresBeingModified_,t)),this.featuresBeingModified_=null),!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 i,o,a=this,s=r||e.getCoordinateFromPixel(t),l=e.getView().getProjection();if(this.hitDetection_){var u="object"==typeof this.hitDetection_?function(t){return t===a.hitDetection_}:void 0;e.forEachFeatureAtPixel(t,(function(t,e,r){if((r=r||t.getGeometry()).getType()===ct&&c(a.features_.getArray(),t)){o=r;var n=r.getFlatCoordinates().slice(0,2);i=[{feature:t,geometry:r,segment:[n,n]}]}return!0}),{layerFilter:u})}if(!i){var h=jr(Qt(Gr(le(s,Tc)),e.getView().getResolution()*this.pixelTolerance_,Tc));i=this.rBush_.getInExtent(h)}if(i&&i.length>0){var p=i.sort((function(t,e){return Lc(s,t,l)-Lc(s,e,l)}))[0],f=p.segment,d=Mc(s,p,l),g=e.getPixelFromCoordinate(d),_=vr(t,g);if(o||_<=this.pixelTolerance_){var y={};if(y[n(f)]=!0,this.snapToPointer_||(this.delta_[0]=d[0]-s[0],this.delta_[1]=d[1]-s[1]),p.geometry.getType()===mt&&1===p.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(d,[p.feature],[p.geometry]);else{var v=e.getPixelFromCoordinate(f[0]),m=e.getPixelFromCoordinate(f[1]),x=yr(g,v),w=yr(g,m);_=Math.sqrt(Math.min(x,w)),this.snappedToVertex_=_<=this.pixelTolerance_,this.snappedToVertex_&&(d=x>w?f[1]:f[0]),this.createOrUpdateVertexFeature_(d,[p.feature],[p.geometry]);var S={};S[n(p.geometry)]=!0;for(var C=1,E=i.length;C=0;--o)c=n((h=(r=p[o])[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(u=f[c].right,s=f[c].left,(l=(a=f[c].index)-1)<0&&(l=0),t=e=(i=(h=void 0!==s?s:u).geometry).getCoordinates(),d=!1,i.getType()){case _t:e[h.depth[0]].length>2&&(e[h.depth[0]].splice(a,1),d=!0);break;case pt:e.length>2&&(e.splice(a,1),d=!0);break;case yt:t=t[h.depth[1]];case dt:(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]),l=t.length-1))}if(d){this.setGeometryCoordinates_(i,e);var g=[];if(void 0!==s&&(this.rBush_.remove(s),g.push(s.segment[0])),void 0!==u&&(this.rBush_.remove(u),g.push(u.segment[1])),void 0!==s&&void 0!==u){var _={depth:h.depth,feature:h.feature,geometry:h.geometry,index:l,segment:g};this.rBush_.insert(Jt(_.segment),_)}this.updateSegmentIndices_(i,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||g(i.depth,r))&&i.index>e&&(i.index+=n)}))},e}(Xu);function Ic(t,e){return t.index-e.index}function Lc(t,e,r){var n=e.geometry;if(n.getType()===mt){var i=n;if(1===e.index){null;var o=yr(i.getCenter(),kr(t)),a=Math.sqrt(o)-i.getRadius();return a*a}}var s=kr(t);return bc[0]=kr(e.segment[0]),bc[1]=kr(e.segment[1]),mr(s,bc)}function Mc(t,e,r){var n=e.geometry;if(n.getType()===mt&&1===e.index){var i=n;return Dr(i.getClosestPoint(kr(t)))}var o=kr(t);return bc[0]=kr(e.segment[0]),bc[1]=kr(e.segment[1]),Dr(dr(o,bc))}function Ac(){var t=ro();return function(e,r){return t[ct]}}var Dc=Fc,kc=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),jc="select",Gc=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 kc(e,t),e}(s),Nc={},Bc=function(t){function e(e){var r=t.call(this)||this;r.on,r.once,r.un;var n,i,o=e||{};if(r.boundAddFeature_=r.addFeature_.bind(r),r.boundRemoveFeature_=r.removeFeature_.bind(r),r.condition_=o.condition?o.condition:Ju,r.addCondition_=o.addCondition?o.addCondition:qu,r.removeCondition_=o.removeCondition?o.removeCondition:qu,r.toggleCondition_=o.toggleCondition?o.toggleCondition:$u,r.multi_=!!o.multi&&o.multi,r.filter_=o.filter?o.filter:_,r.hitTolerance_=o.hitTolerance?o.hitTolerance:0,r.style_=void 0!==o.style?o.style:(d((n=ro())[dt],n[pt]),d(n[vt],n[pt]),function(t){return t.getGeometry()?n[t.getGeometry().getType()]:null}),r.features_=o.features||new rt,o.layers)if("function"==typeof o.layers)i=o.layers;else{var a=o.layers;i=function(t){return c(a,t)}}else i=_;return r.layerFilter_=i,r.featureLayerAssociation_={},r}return kc(e,t),e.prototype.addFeatureLayerAssociation_=function(t,e){this.featureLayerAssociation_[n(t)]=e},e.prototype.getFeatures=function(){return this.features_},e.prototype.getHitTolerance=function(){return this.hitTolerance_},e.prototype.getLayer=function(t){return this.featureLayerAssociation_[n(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(J,this.boundAddFeature_),this.features_.addEventListener(Q,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(J,this.boundAddFeature_),this.features_.removeEventListener(Q,this.boundRemoveFeature_))},e.prototype.addFeature_=function(t){var e=t.element;if(this.style_&&this.applySelectedStyle_(e),!this.getLayer(e)){var r=this.getMap().getAllLayers().find((function(t){if(t instanceof Ms&&t.getSource()&&t.getSource().hasFeature(e))return t}));r&&this.addFeatureLayerAssociation_(e,r)}},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=n(t);e in Nc||(Nc[e]=t.getStyle()),t.setStyle(this.style_)},e.prototype.restorePreviousStyle_=function(t){for(var r=this.getMap().getInteractions().getArray(),i=r.length-1;i>=0;--i){var o=r[i];if(o!==this&&o instanceof e&&o.getStyle()&&-1!==o.getFeatures().getArray().lastIndexOf(t))return void t.setStyle(o.getStyle())}var a=n(t);t.setStyle(Nc[a]),delete Nc[a]},e.prototype.removeFeatureLayerAssociation_=function(t){delete this.featureLayerAssociation_[n(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=[],l=[];if(i){x(this.featureLayerAssociation_),o.forEachFeatureAtPixel(t.pixel,function(t,e){if(this.filter_(t,e))return this.addFeatureLayerAssociation_(t,e),l.push(t),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var u=a.getLength()-1;u>=0;--u){var h=a.item(u),p=l.indexOf(h);p>-1?l.splice(p,1):(a.remove(h),s.push(h))}0!==l.length&&a.extend(l)}else{o.forEachFeatureAtPixel(t.pixel,function(t,i){if(this.filter_(t,i))return!e&&!n||c(a.getArray(),t)?(r||n)&&c(a.getArray(),t)&&(s.push(t),this.removeFeatureLayerAssociation_(t)):(this.addFeatureLayerAssociation_(t,i),l.push(t)),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var f=s.length-1;f>=0;--f)a.remove(s[f]);a.extend(l)}return(l.length>0||s.length>0)&&this.dispatchEvent(new Gc(jc,l,s,t)),!0},e}(Nu);var zc=Bc,Uc=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Vc(t){return t.feature?t.feature:t.element?t.element:void 0}var Xc=[],Wc=function(t){function e(e){var r=this,n=e||{},i=n;return i.handleDownEvent||(i.handleDownEvent=_),i.stopDown||(i.stopDown=y),(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 As,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 Uc(e,t),e.prototype.addFeature=function(t,e){var r=void 0===e||e,i=n(t),o=t.getGeometry();if(o){var a=this.SEGMENT_WRITERS_[o.getType()];a&&(this.indexedFeaturesExtents_[i]=o.getExtent([1/0,1/0,-1/0,-1/0]),a(t,o))}r&&(this.featureChangeListenerKeys_[i]=N(t,T,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=Vc(t);this.addFeature(e)},e.prototype.handleFeatureRemove_=function(t){var e=Vc(t);this.removeFeature(e)},e.prototype.handleFeatureChange_=function(t){var e=t.target;if(this.handlingDownUpSequence){var r=n(e);r in this.pendingFeatures_||(this.pendingFeatures_[r]=e)}else this.updateFeature_(e)},e.prototype.handleUpEvent=function(t){var e=w(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,i=n(t),o=this.indexedFeaturesExtents_[i];if(o){var a=this.rBush_,s=[];a.forEachInExtent(o,(function(e){t===e.feature&&s.push(e)}));for(var l=s.length-1;l>=0;--l)a.remove(s[l])}r&&(z(this.featureChangeListenerKeys_[i]),delete this.featureChangeListenerKeys_[i])},e.prototype.setMap=function(e){var r=this.getMap(),n=this.featuresListenerKeys_,i=this.getFeatures_();r&&(n.forEach(z),n.length=0,i.forEach(this.forEachFeatureRemove_.bind(this))),t.prototype.setMap.call(this,e),e&&(this.features_?n.push(N(this.features_,J,this.handleFeatureAdd_,this),N(this.features_,Q,this.handleFeatureRemove_,this)):this.source_&&n.push(N(this.source_,Gs,this.handleFeatureAdd_,this),N(this.source_,zs,this.handleFeatureRemove_,this)),i.forEach(this.forEachFeatureAdd_.bind(this)))},e.prototype.snapTo=function(t,e,r){var n=Jt([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()!==mt})));var o=!1,a=null,s=null;if(0===i.length)return{snapped:o,vertex:a,vertexPixel:s};r.getView().getProjection();for(var l,u=kr(e),h=1/0,c=0;cv?d[1]:d[0],s=r.getPixelFromCoordinate(a))}else if(this.edge_){var m=l.feature.getGeometry().getType()===mt;if(m){var x=l.feature.getGeometry();null,a=Dr(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 l=Math.sqrt(a*a+s*s);return[i+r*a/l,o+r*s/l]}(u,x))}else Xc[0]=kr(d[0]),Xc[1]=kr(d[1]),a=Dr(dr(u,Xc));if(vr(t,s=r.getPixelFromCoordinate(a))<=this.pixelTolerance_&&(o=!0,this.vertex_&&!m)){g=r.getPixelFromCoordinate(d[0]),_=r.getPixelFromCoordinate(d[1]),y=yr(s,g),v=yr(s,_);Math.sqrt(Math.min(y,v))<=this.pixelTolerance_&&(a=y>v?d[1]:d[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){this.getMap().getView().getProjection();for(var r=kn(e).getCoordinates()[0],n=0,i=r.length-1;n0&&this.getCount()>this.highWaterMark},t.prototype.clear=function(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null},t.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)},t.prototype.forEach=function(t){for(var e=this.oldest_;e;)t(e.value_,e.key_,this),e=e.newer},t.prototype.get=function(t,e){var r=this.entries_[t];return nt(void 0!==r,15),r===this.newest_||(r===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(r.newer.older=r.older,r.older.newer=r.newer),r.newer=null,r.older=this.newest_,this.newest_.newer=r,this.newest_=r),r.value_},t.prototype.remove=function(t){var e=this.entries_[t];return nt(void 0!==e,15),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_},t.prototype.getCount=function(){return this.count_},t.prototype.getKeys=function(){var t,e=new Array(this.count_),r=0;for(t=this.newest_;t;t=t.older)e[r++]=t.key_;return e},t.prototype.getValues=function(){var t,e=new Array(this.count_),r=0;for(t=this.newest_;t;t=t.older)e[r++]=t.value_;return e},t.prototype.peekLast=function(){return this.oldest_.value_},t.prototype.peekLastKey=function(){return this.oldest_.key_},t.prototype.peekFirstKey=function(){return this.newest_.key_},t.prototype.pop=function(){var t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_},t.prototype.replace=function(t,e){this.get(t),this.entries_[t].value_=e},t.prototype.set=function(t,e){nt(!(t in this.entries_),16);var r={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=r:this.oldest_=r,this.newest_=r,this.entries_[t]=r,++this.count_},t.prototype.setSize=function(t){this.highWaterMark=t},t}();function op(t,e,r,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=r,n):[t,e,r]}function ap(t,e,r){return t+"/"+e+"/"+r}function sp(t){return ap(t[0],t[1],t[2])}function lp(t){return t.split("/").map(Number)}function up(t){return(t[1]<this.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)},t.prototype.getHeight=function(){return this.maxY-this.minY+1},t.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]},t.prototype.getWidth=function(){return this.maxX-this.minX+1},t.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY},t}();function dp(t,e,r,n,i){return void 0!==i?(i.minX=t,i.maxX=e,i.minY=r,i.maxY=n,i):new fp(t,e,r,n)}var gp=fp,_p=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),yp=[],vp=function(t){function e(e,r,n,i){var o=t.call(this,e,r,{transition:0})||this;return o.context_={},o.executorGroups={},o.declutterExecutorGroups={},o.loadingSourceTiles=0,o.hitDetectionImageData={},o.replayState_={},o.sourceTiles=[],o.errorTileKeys={},o.wantedResolution,o.getSourceTiles=i.bind(void 0,o),o.wrappedTileCoord=n,o}return _p(e,t),e.prototype.getContext=function(t){var e=n(t);return e in this.context_||(this.context_[e]=_i(1,1,yp)),this.context_[e]},e.prototype.hasContext=function(t){return n(t)in this.context_},e.prototype.getImage=function(t){return this.hasContext(t)?this.getContext(t).canvas:null},e.prototype.getReplayState=function(t){var e=n(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]},e.prototype.load=function(){this.getSourceTiles()},e.prototype.release=function(){for(var e in this.context_)yp.push(this.context_[e].canvas),delete this.context_[e];t.prototype.release.call(this)},e}(pl),mp=vp,xp=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),wp=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r,a)||this;return s.extent=null,s.format_=i,s.features_=null,s.loader_,s.projection=null,s.resolution,s.tileLoadFunction_=o,s.url_=n,s.key=n,s}return xp(e,t),e.prototype.getFormat=function(){return this.format_},e.prototype.getFeatures=function(){return this.features_},e.prototype.load=function(){this.state==el&&(this.setState(rl),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))},e.prototype.onLoad=function(t,e){this.setFeatures(t)},e.prototype.onError=function(){this.setState(il)},e.prototype.setFeatures=function(t){this.features_=t,this.setState(nl)},e.prototype.setLoader=function(t){this.loader_=t},e}(pl),Sp=wp;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function Cp(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})})),e}var Ep={exports:{}},Tp=Cp(_u),bp=Cp(Y),Rp=Cp(Rl);!function(t,e){t.exports=function(t,e,r){t="default"in t?t.default:t,r="default"in r?r.default:r;var n=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},i=function(){function t(t,e){for(var r=0;re.getMaxResolution()||y=0?t:"children"}}]),u}(t);return window.ol&&window.ol.control&&(window.ol.control.LayerSwitcher=u),u}(Tp,bp,Rp)}(Ep);var Pp=Ep.exports,Op=function(){function t(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return t.prototype.getReadOptions=function(t,e){var r;if(e){var n=e.dataProjection?Er(e.dataProjection):this.readProjection(t);e.extent&&n&&n.getUnits()===St.TILE_PIXELS&&(n=Er(n)).setWorldExtent(e.extent),r={dataProjection:n,featureProjection:e.featureProjection}}return this.adaptOptions(r)},t.prototype.adaptOptions=function(t){return m({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},t)},t.prototype.getType=function(){return e()},t.prototype.readFeature=function(t,r){return e()},t.prototype.readFeatures=function(t,r){return e()},t.prototype.readGeometry=function(t,r){return e()},t.prototype.readProjection=function(t){return e()},t.prototype.writeFeature=function(t,r){return e()},t.prototype.writeFeatures=function(t,r){return e()},t.prototype.writeGeometry=function(t,r){return e()},t}(),Fp=Op;function Ip(t,e,r){var n,i=r?Er(r.featureProjection):null,o=r?Er(r.dataProjection):null;if(n=i&&o&&!Pr(i,o)?(e?t.clone():t).transform(e?i:o,e?o:i):t,e&&r&&void 0!==r.decimals){var a=Math.pow(10,r.decimals);n===t&&(n=t.clone()),n.applyTransform((function(t){for(var e=0,r=t.length;e0?r[0]:null},r.prototype.readFeatureFromNode=function(t,e){return null},r.prototype.readFeatures=function(t,e){if(t){if("string"==typeof t){var r=Zp(t);return this.readFeaturesFromDocument(r,e)}return Kp(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}return[]},r.prototype.readFeaturesFromDocument=function(t,e){for(var r=[],n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&d(r,this.readFeaturesFromNode(n,e));return r},r.prototype.readFeaturesFromNode=function(t,r){return e()},r.prototype.readGeometry=function(t,e){if(t){if("string"==typeof t){var r=Zp(t);return this.readGeometryFromDocument(r,e)}return Kp(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}return null},r.prototype.readGeometryFromDocument=function(t,e){return null},r.prototype.readGeometryFromNode=function(t,e){return null},r.prototype.readProjection=function(t){if(t){if("string"==typeof t){var e=Zp(t);return this.readProjectionFromDocument(e)}return Kp(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}return null},r.prototype.readProjectionFromDocument=function(t){return this.dataProjection},r.prototype.readProjectionFromNode=function(t){return this.dataProjection},r.prototype.writeFeature=function(t,e){var r=this.writeFeatureNode(t,e);return this.xmlSerializer_.serializeToString(r)},r.prototype.writeFeatureNode=function(t,e){return null},r.prototype.writeFeatures=function(t,e){var r=this.writeFeaturesNode(t,e);return this.xmlSerializer_.serializeToString(r)},r.prototype.writeFeaturesNode=function(t,e){return null},r.prototype.writeGeometry=function(t,e){var r=this.writeGeometryNode(t,e);return this.xmlSerializer_.serializeToString(r)},r.prototype.writeGeometryNode=function(t,e){return null},r}(Fp),ff=pf;function df(t){var e,r=Wp(t,!1);return(e=/^\s*(true|1)|(false|0)\s*$/.exec(r))?void 0!==e[1]||!1:void 0}function gf(t){var e,r=Wp(t,!1);return(e=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(r))?parseFloat(e[1]):void 0}function _f(t){return Wp(t,!1).trim()}function yf(t,e){mf(t,e?"1":"0")}function vf(t,e){var r=e.toPrecision();t.appendChild(hf().createTextNode(r))}function mf(t,e){t.appendChild(hf().createTextNode(e))}var xf,wf,Sf,Cf,Ef,Tf,bf,Rf,Pf,Of=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ff=["http://www.google.com/kml/ext/2.2"],If=[null,"http://earth.google.com/kml/2.0","http://earth.google.com/kml/2.1","http://earth.google.com/kml/2.2","http://www.opengis.net/kml/2.2"],Lf={fraction:es,pixels:rs,insetPixels:rs},Mf=nf(If,{ExtendedData:Rd,Region:Pd,MultiGeometry:Qp(vd,"geometry"),LineString:Qp(gd,"geometry"),LinearRing:Qp(_d,"geometry"),Point:Qp(md,"geometry"),Polygon:Qp(wd,"geometry"),Style:Qp(Cd),StyleMap:function(t,e){var r=ed.call(this,t,e);if(!r)return;var n=e[e.length-1];Array.isArray(r)?n.Style=r:"string"==typeof r?n.styleUrl=r:nt(!1,38)},address:Qp(_f),description:Qp(_f),name:Qp(_f),open:Qp(df),phoneNumber:Qp(_f),styleUrl:Qp(Qf),visibility:Qp(df)},nf(Ff,{MultiTrack:Qp((function(t,e){var r=af([],ld,t,e);if(!r)return;return new Jh(r)}),"geometry"),Track:Qp(hd,"geometry")})),Af=nf(If,{ExtendedData:Rd,Region:Pd,Link:function(t,e){of(Df,t,e)},address:Qp(_f),description:Qp(_f),name:Qp(_f),open:Qp(df),phoneNumber:Qp(_f),visibility:Qp(df)}),Df=nf(If,{href:Qp(Jf)}),kf=nf(If,{LatLonAltBox:function(t,e){var r=af({},Id,t,e);if(!r)return;var n=e[e.length-1],i=[parseFloat(r.west),parseFloat(r.south),parseFloat(r.east),parseFloat(r.north)];n.extent=i,n.altitudeMode=r.altitudeMode,n.minAltitude=parseFloat(r.minAltitude),n.maxAltitude=parseFloat(r.maxAltitude)},Lod:function(t,e){var r=af({},Ld,t,e);if(!r)return;var n=e[e.length-1];n.minLodPixels=parseFloat(r.minLodPixels),n.maxLodPixels=parseFloat(r.maxLodPixels),n.minFadeExtent=parseFloat(r.minFadeExtent),n.maxFadeExtent=parseFloat(r.maxFadeExtent)}}),jf=nf(If,["Document","Placemark"]),Gf=nf(If,{Document:$p((function(t,e,r){sf({node:t},jd,Gd,e,r,void 0,this)})),Placemark:$p(lg)}),Nf=null,Bf=null,zf=null,Uf=null,Vf=null,Xf=null;function Wf(t){return 32/Math.min(t[0],t[1])}function Yf(t){return t}var Kf=function(t){function e(e){var r=t.call(this)||this,n=e||{};return Xf||(Nf=new Un({color:xf=[255,255,255,1]}),Tf="https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png",Bf=new ms({anchor:wf=[20,2],anchorOrigin:ns,anchorXUnits:Sf=rs,anchorYUnits:Cf=rs,crossOrigin:"anonymous",rotation:0,scale:Wf(Ef=[64,64]),size:Ef,src:Tf}),bf="NO_IMAGE",zf=new Hn({color:xf,width:1}),Rf=new Hn({color:[51,51,51,1],width:2}),Uf=new lo({font:"bold 16px Helvetica",fill:Nf,stroke:Rf,scale:.8}),Vf=new io({fill:Nf,image:Bf,text:Uf,stroke:zf,zIndex:0}),Xf=[Vf]),r.dataProjection=Er("EPSG:4326"),r.defaultStyle_=n.defaultStyle?n.defaultStyle:Xf,r.extractStyles_=void 0===n.extractStyles||n.extractStyles,r.writeStyles_=void 0===n.writeStyles||n.writeStyles,r.sharedStyles_={},r.showPointNames_=void 0===n.showPointNames||n.showPointNames,r.crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:"anonymous",r.iconUrlFunction_=n.iconUrlFunction?n.iconUrlFunction:Yf,r.supportedMediaTypes=["application/vnd.google-earth.kml+xml"],r}return Of(e,t),e.prototype.readDocumentOrFolder_=function(t,e){var r=af([],nf(If,{Document:Hp(this.readDocumentOrFolder_,this),Folder:Hp(this.readDocumentOrFolder_,this),Placemark:qp(this.readPlacemark_,this),Style:this.readSharedStyle_.bind(this),StyleMap:this.readSharedStyleMap_.bind(this)}),t,e,this);return r||void 0},e.prototype.readPlacemark_=function(t,e){var r=af({geometry:null},Mf,t,e,this);if(r){var n=new at,i=t.getAttribute("id");null!==i&&n.setId(i);var o=e[0],a=r.geometry;if(a&&Ip(a,!1,o),n.setGeometry(a),delete r.geometry,this.extractStyles_){var s=function(t,e,r,n,i){return function(o,a){var s=i,l="",u=[];if(s){var h=o.getGeometry();if(h){var c=h.getType();c===vt?(u=h.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e===ct||e===gt})),s=u.length>0):s=c===ct||c===gt}}s&&(l=o.get("name"),(s=s&&!!l)&&l.search(/&[^&]+;/)>-1&&(Pf||(Pf=document.createElement("textarea")),Pf.innerHTML=l,l=Pf.value));var p=r;if(t?p=t:e&&(p=Zf(e,r,n)),s){var f=function(t,e){var r=[0,0],n="start",i=t.getImage();if(i){var o=i.getSize();if(o&&2==o.length){var a=i.getScaleArray(),s=i.getAnchor();r[0]=a[0]*(o[0]-s[0]),r[1]=a[1]*(o[1]/2-s[1]),n="left"}}var l=t.getText();l?((l=l.clone()).setFont(l.getFont()||Uf.getFont()),l.setScale(l.getScale()||Uf.getScale()),l.setFill(l.getFill()||Uf.getFill()),l.setStroke(l.getStroke()||Rf)):l=Uf.clone();return l.setText(e),l.setOffsetX(r[0]),l.setOffsetY(r[1]),l.setTextAlign(n),new io({image:i,text:l})}(p[0],l);return u.length>0?(f.setGeometry(new Gp(u)),[f,new io({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=Cd.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=ed.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(!c(If,t.namespaceURI))return null;var r=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return r||null},e.prototype.readFeaturesFromNode=function(t,e){if(!c(If,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&&d(r,a)}return r}return[]},e.prototype.readName=function(t){if(t){if("string"==typeof t){var e=Zp(t);return this.readNameFromDocument(e)}return Kp(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(c(If,e.namespaceURI)&&"name"==e.localName)return _f(e);for(e=t.firstElementChild;e;e=e.nextElementSibling){var r=e.localName;if(c(If,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=Zp(t);d(e,this.readNetworkLinksFromDocument(r))}else Kp(t)?d(e,this.readNetworkLinksFromDocument(t)):d(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&&d(e,this.readNetworkLinksFromNode(r));return e},e.prototype.readNetworkLinksFromNode=function(t){for(var e=[],r=t.firstElementChild;r;r=r.nextElementSibling)if(c(If,r.namespaceURI)&&"NetworkLink"==r.localName){var n=af({},Af,r,[]);e.push(n)}for(r=t.firstElementChild;r;r=r.nextElementSibling){var i=r.localName;!c(If,r.namespaceURI)||"Document"!=i&&"Folder"!=i&&"kml"!=i||d(e,this.readNetworkLinksFromNode(r))}return e},e.prototype.readRegion=function(t){var e=[];if("string"==typeof t){var r=Zp(t);d(e,this.readRegionFromDocument(r))}else Kp(t)?d(e,this.readRegionFromDocument(t)):d(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&&d(e,this.readRegionFromNode(r));return e},e.prototype.readRegionFromNode=function(t){for(var e=[],r=t.firstElementChild;r;r=r.nextElementSibling)if(c(If,r.namespaceURI)&&"Region"==r.localName){var n=af({},kf,r,[]);e.push(n)}for(r=t.firstElementChild;r;r=r.nextElementSibling){var i=r.localName;!c(If,r.namespaceURI)||"Document"!=i&&"Folder"!=i&&"kml"!=i||d(e,this.readRegionFromNode(r))}return e},e.prototype.writeFeaturesNode=function(t,e){e=this.adaptOptions(e);var r=Xp(If[4],"kml"),n="http://www.w3.org/2000/xmlns/";r.setAttributeNS(n,"xmlns:gx",Ff[0]),r.setAttributeNS(n,"xmlns:xsi",Vp),r.setAttributeNS(Vp,"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=jf[r.namespaceURI],s=rf(o,a);return sf(i,Gf,ef,s,[e],a,this),r},e}(ff);function Zf(t,e,r){return Array.isArray(t)?t:"string"==typeof t?Zf(r[t],e,r):e}function Hf(t){var e=Wp(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 qf(t){var e=Wp(t,!1),r=[];e=e.replace(/\s*,\s*/g,",");for(var n,i=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?),([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|,|$)(?:([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|$))?\s*/i;n=i.exec(e);){var o=parseFloat(n[1]),a=parseFloat(n[2]),s=n[3]?parseFloat(n[3]):0;r.push(o,a,s),e=e.substr(n[0].length)}if(""===e)return r}function Jf(t){var e=Wp(t,!1).trim(),r=t.baseURI;return r&&"about:blank"!=r||(r=window.location.href),r?new URL(e,r).href:e}function Qf(t){var e=Wp(t,!1).trim().replace(/^(?!.*#)/,"#"),r=t.baseURI;return r&&"about:blank"!=r||(r=window.location.href),r?new URL(e,r).href:e}function $f(t){return gf(t)}var td=nf(If,{Pair:function(t,e){var r=af({},Od,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 ed(t,e){return af(void 0,td,t,e,this)}var rd=nf(If,{Icon:Qp((function(t,e){var r=af({},cd,t,e);return r||null})),color:Qp(Hf),heading:Qp(gf),hotSpot:Qp((function(t){var e,r=t.getAttribute("xunits"),n=t.getAttribute("yunits");return e="insetPixels"!==r?"insetPixels"!==n?ns:os:"insetPixels"!==n?is:as,{x:parseFloat(t.getAttribute("x")),xunits:Lf[r],y:parseFloat(t.getAttribute("y")),yunits:Lf[n],origin:e}})),scale:Qp($f)});var nd=nf(If,{color:Qp(Hf),scale:Qp($f)});var id=nf(If,{color:Qp(Hf),width:Qp(gf)});var od=nf(If,{color:Qp(Hf),fill:Qp(df),outline:Qp(df)});var ad=nf(If,{coordinates:Jp(qf)});function sd(t,e){return af(null,ad,t,e)}var ld=nf(Ff,{Track:qp(hd)});var ud=nf(If,{when:function(t,e){var r=e[e.length-1].whens,n=Wp(t,!1),i=Date.parse(n);r.push(isNaN(i)?0:i)}},nf(Ff,{coord:function(t,e){var r=e[e.length-1].coordinates,n=Wp(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])}else r.push([])}}));function hd(t,e){var r=af({coordinates:[],whens:[]},ud,t,e);if(r){for(var n=[],i=r.coordinates,o=r.whens,a=0,s=Math.min(i.length,o.length);a0){var n=e[e.length-1];n.push.apply(n,r)}},outerBoundaryIs:function(t,e){var r=af(void 0,Ad,t,e);if(r){e[e.length-1][0]=r}}});function wd(t,e){var r=af({},dd,t,e),n=af([null],xd,t,e);if(n&&n[0]){for(var i=n[0],o=[i.length],a=1,s=n.length;a0,h=l.href;h?n=h:u&&(n=Tf);var c,p=ns,f=r.hotSpot;f?(i=[f.x,f.y],o=f.xunits,a=f.yunits,p=f.origin):/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(n)&&(/pushpin/.test(n)?(i=wf,o=Sf,a=Cf):/arrow-reverse/.test(n)?(i=[54,42],o=Sf,a=Cf):/paddle/.test(n)&&(i=[32,1],o=Sf,a=Cf));var d,g=l.x,_=l.y;void 0!==g&&void 0!==_&&(c=[g,_]);var y,v=l.w,m=l.h;void 0!==v&&void 0!==m&&(d=[v,m]);var x=r.heading;void 0!==x&&(y=je(x));var w=r.scale,S=r.color;if(u){n==Tf&&(d=Ef);var C=new ms({anchor:i,anchorOrigin:p,anchorXUnits:o,anchorYUnits:a,crossOrigin:this.crossOrigin_,offset:c,offsetOrigin:ns,rotation:y,scale:w,size:d,src:this.iconUrlFunction_(n),color:S}),E=C.getScaleArray()[0],T=C.getSize();if(null===T){var b=C.getImageState();if(b===qn||b===Jn){var R=function(){var t=C.getImageState();if(t!==qn&&t!==Jn){var e=C.getSize();if(e&&2==e.length){var r=Wf(e);C.setScale(E*r)}C.unlistenImageChange(R)}};C.listenImageChange(R),b===qn&&C.load()}}else if(2==T.length){var P=Wf(T);C.setScale(E*P)}s.imageStyle=C}else s.imageStyle=bf}},LabelStyle:function(t,e){var r=af({},nd,t,e);if(r){var n=e[e.length-1],i=new lo({fill:new Un({color:"color"in r?r.color:xf}),scale:r.scale});n.textStyle=i}},LineStyle:function(t,e){var r=af({},id,t,e);if(r){var n=e[e.length-1],i=new Hn({color:"color"in r?r.color:xf,width:"width"in r?r.width:1});n.strokeStyle=i}},PolyStyle:function(t,e){var r=af({},od,t,e);if(r){var n=e[e.length-1],i=new Un({color:"color"in r?r.color:xf});n.fillStyle=i;var o=r.fill;void 0!==o&&(n.fill=o);var a=r.outline;void 0!==a&&(n.outline=a)}}});function Cd(t,e){var r=af({},Sd,t,e,this);if(!r)return null;var n,i="fillStyle"in r?r.fillStyle:Nf,o=r.fill;void 0===o||o||(i=null),"imageStyle"in r?r.imageStyle!=bf&&(n=r.imageStyle):n=Bf;var a="textStyle"in r?r.textStyle:Uf,s="strokeStyle"in r?r.strokeStyle:zf,l=r.outline;return void 0===l||l?[new io({fill:i,image:n,stroke:s,text:a,zIndex:void 0})]:[new io({geometry:function(t){var e=t.getGeometry(),r=e.getType();return r===vt?new Gp(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e!==dt&&e!==yt}))):r!==dt&&r!==yt?e:void 0},fill:i,image:n,stroke:s,text:a,zIndex:void 0}),new io({geometry:function(t){var e=t.getGeometry(),r=e.getType();return r===vt?new Gp(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e===dt||e===yt}))):r===dt||r===yt?e:void 0},fill:i,stroke:null,zIndex:void 0})]}function Ed(t,e){var r,n,i,o=e.length,a=new Array(e.length),s=new Array(e.length),l=new Array(e.length);r=!1,n=!1,i=!1;for(var u=0;u0){var y=rf(i,a);sf(n,og,sg,[{names:a,values:y}],r)}var v=r[0],m=e.getGeometry();m&&(m=Ip(m,!0,v)),sf(n,og,qd,[m],r)}var ug=nf(If,["extrude","tessellate","altitudeMode","coordinates"]),hg=nf(If,{extrude:$p(yf),tessellate:$p(yf),altitudeMode:$p(mf),coordinates:$p((function(t,e,r){var n,i=r[r.length-1],o=i.layout,a=i.stride;o==st||o==ut?n=2:o==lt||o==ht?n=3:nt(!1,34);var s=e.length,l="";if(s>0){l+=e[0];for(var u=1;u */ read:function(t,e,r,n,i){var o,a,s=8*i-n-1,l=(1<>1,h=-7,c=r?i-1:0,p=r?-1:1,f=t[e+c];for(c+=p,o=f&(1<<-h)-1,f>>=-h,h+=s;h>0;o=256*o+t[e+c],c+=p,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=256*a+t[e+c],c+=p,h-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=u}return(f?-1:1)*a*Math.pow(2,o-n)},write:function(t,e,r,n,i,o){var a,s,l,u=8*o-i-1,h=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+c>=1?p/l:p*Math.pow(2,1-c))*l>=2&&(a++,l/=2),a+c>=h?(s=0,a=h):a+c>=1?(s=(e*l-1)*Math.pow(2,i),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=255&s,f+=d,s/=256,i-=8);for(a=a<0;t[r+f]=255&a,f+=d,a/=256,u-=8);t[r+f-d]|=128*g}},Cg=Tg,Eg=Sg;function Tg(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Tg.Varint=0,Tg.Fixed64=1,Tg.Bytes=2,Tg.Fixed32=5;var bg=4294967296,Rg=1/bg,Pg="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Og(t){return t.type===Tg.Bytes?t.readVarint()+t.pos:t.pos+1}function Fg(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Ig(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function Lg(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function Vg(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}Tg.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos>3,o=this.pos;this.type=7&n,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=zg(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Vg(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=zg(this.buf,this.pos)+zg(this.buf,this.pos+4)*bg;return this.pos+=8,t},readSFixed64:function(){var t=zg(this.buf,this.pos)+Vg(this.buf,this.pos+4)*bg;return this.pos+=8,t},readFloat:function(){var t=Eg.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Eg.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,o=r.buf;if(i=o[r.pos++],n=(112&i)>>4,i<128)return Fg(t,n,e);if(i=o[r.pos++],n|=(127&i)<<3,i<128)return Fg(t,n,e);if(i=o[r.pos++],n|=(127&i)<<10,i<128)return Fg(t,n,e);if(i=o[r.pos++],n|=(127&i)<<17,i<128)return Fg(t,n,e);if(i=o[r.pos++],n|=(127&i)<<24,i<128)return Fg(t,n,e);if(i=o[r.pos++],n|=(1&i)<<31,i<128)return Fg(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Pg?function(t,e,r){return Pg.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){var n="",i=e;for(;i239?4:l>223?3:l>191?2:1;if(i+h>r)break;1===h?l<128&&(u=l):2===h?128==(192&(o=t[i+1]))&&(u=(31&l)<<6|63&o)<=127&&(u=null):3===h?(o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&((u=(15&l)<<12|(63&o)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===h&&(o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&((u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,h=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=h}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Tg.Bytes)return t.push(this.readVarint(e));var r=Og(this);for(t=t||[];this.pos127;);else if(e===Tg.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Tg.Fixed32)this.pos+=4;else{if(e!==Tg.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos]=127&t}(r,0,e),function(t,e){var r=(7&t)<<4;if(e.buf[e.pos++]|=r|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,o=0;o55295&&n<57344){if(!i){n>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&Ig(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Eg.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Eg.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&Ig(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,Tg.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Lg,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Mg,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,kg,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Ag,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Dg,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,jg,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Gg,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Ng,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Bg,e)},writeBytesField:function(t,e){this.writeTag(t,Tg.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Tg.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Tg.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Tg.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Tg.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Tg.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Tg.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Tg.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Tg.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Tg.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Xg=[1,0,0,1,0,0],Wg=function(){function t(t,e,r,n,i){this.styleFunction,this.extent_,this.id_=i,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=r,this.properties_=n}return t.prototype.get=function(t){return this.properties_[t]},t.prototype.getExtent=function(){return this.extent_||(this.extent_=this.type_===ct?le(this.flatCoordinates_):ue(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_},t.prototype.getFlatInteriorPoint=function(){if(!this.flatInteriorPoints_){var t=me(this.getExtent());this.flatInteriorPoints_=Cn(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_},t.prototype.getFlatInteriorPoints=function(){if(!this.flatInteriorPoints_){var t=ec(this.flatCoordinates_,0,this.ends_,2);this.flatInteriorPoints_=En(this.flatCoordinates_,0,this.ends_,2,t)}return this.flatInteriorPoints_},t.prototype.getFlatMidpoint=function(){return this.flatMidpoints_||(this.flatMidpoints_=Vn(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_},t.prototype.getFlatMidpoints=function(){if(!this.flatMidpoints_){this.flatMidpoints_=[];for(var t=this.flatCoordinates_,e=0,r=this.ends_,n=0,i=r.length;n>3}a--,1===o||2===o?(s+=t.readSVarint(),l+=t.readSVarint(),1===o&&u>h&&(n.push(u),h=u),r.push(s,l),u+=2):7===o?u>h&&(r.push(r[h],r[h+1]),u+=2):nt(!1,59)}u>h&&(n.push(u),h=u)},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=[],l=[];this.readRawGeometry_(t,e,s,l);var u=function(t,e){var r;1===t?r=1===e?ct:gt:2===t?r=1===e?pt:_t:3===t&&(r=dt);return r}(i,l.length);if(this.featureClass_===Yg)(n=new this.featureClass_(u,s,l,a,o)).transform(r.dataProjection);else{var h=void 0;if(u==dt){for(var c=[],p=0,f=0,d=0,g=l.length;d1?new ic(s,st,c):new An(s,st,l)}else h=u===ct?new mn(s,st):u===pt?new Zn(s,st):u===dt?new An(s,st,l):u===gt?new tc(s,st):u===_t?new Jh(s,st,l):null;n=new(0,this.featureClass_),this.geometryName_&&n.setGeometryName(this.geometryName_);var y=Ip(h,!1,r);n.setGeometry(y),n.setId(o),n.setProperties(a,!0)}return n},e.prototype.getType=function(){return Ys},e.prototype.readFeatures=function(t,e){var r=this.layers_,n=this.adaptOptions(e),i=Er(n.dataProjection);i.setWorldExtent(n.extent),n.dataProjection=i;var o=new Cg(t),a=o.readFields(Hg,{}),s=[];for(var l in a)if(!r||-1!=r.indexOf(l)){var u=a[l],h=u?[0,0,u.extent,u.extent]:null;i.setExtent(h);for(var c=0,p=u.length;c>3)?r.readString():2===t?r.readFloat():3===t?r.readDouble():4===t?r.readVarint64():5===t?r.readVarint():6===t?r.readSVarint():7===t?r.readBoolean():null;e.values.push(n)}}function Jg(t,e,r){if(1==t)e.id=r.readVarint();else if(2==t)for(var n=r.readVarint()+r.pos;r.pos0))){var r=o_(e.canvas).getExtension("WEBGL_lose_context");r&&r.loseContext(),delete C_[t]}}(this.canvasCacheKey_),delete this.gl_,delete this.canvas_},e.prototype.prepareDraw=function(t,e){var r=this.getGL(),n=this.getCanvas(),i=t.size,o=t.pixelRatio;n.width=i[0]*o,n.height=i[1]*o,n.style.width=i[0]+"px",n.style.height=i[1]+"px",r.useProgram(this.currentProgram_);for(var a=this.postProcessPasses_.length-1;a>=0;a--)this.postProcessPasses_[a].init(t);r.bindTexture(r.TEXTURE_2D,null),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r.enable(r.BLEND),r.blendFunc(r.ONE,e?r.ZERO:r.ONE_MINUS_SRC_ALPHA),r.useProgram(this.currentProgram_),this.applyFrameState(t),this.applyUniforms(t)},e.prototype.prepareDrawToRenderTarget=function(t,e,r){var n=this.getGL(),i=e.getSize();n.bindFramebuffer(n.FRAMEBUFFER,e.getFramebuffer()),n.viewport(0,0,i[0],i[1]),n.bindTexture(n.TEXTURE_2D,e.getTexture()),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.ONE,r?n.ZERO:n.ONE_MINUS_SRC_ALPHA),n.useProgram(this.currentProgram_),this.applyFrameState(t),this.applyUniforms(t)},e.prototype.drawElements=function(t,e){var r=this.getGL();this.getExtension("OES_element_index_uint");var n=r.UNSIGNED_INT,i=e-t,o=4*t;r.drawElements(r.TRIANGLES,i,n,o)},e.prototype.finalizeDraw=function(t,e,r){for(var n=0,i=this.postProcessPasses_.length;nthis.size_[0]||e>=this.size_[1])return L_[0]=0,L_[1]=0,L_[2]=0,L_[3]=0,L_;this.readAll();var r=Math.floor(t)+(this.size_[1]-Math.floor(e)-1)*this.size_[0];return L_[0]=this.data_[4*r],L_[1]=this.data_[4*r+1],L_[2]=this.data_[4*r+2],L_[3]=this.data_[4*r+3],L_},t.prototype.getTexture=function(){return this.texture_},t.prototype.getFramebuffer=function(){return this.framebuffer_},t.prototype.updateSize_=function(){var t=this.size_,e=this.helper_.getGL();this.texture_=this.helper_.createTexture(t,null,this.texture_),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer_),e.viewport(0,0,t[0],t[1]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.texture_,0),this.data_=new Uint8Array(t[0]*t[1]*4)},t}();var A_=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),D_=function(t){function e(e,r){var i=this,o=r.uniforms||{},a=[1,0,0,1,0,0];o[__]=a,(i=t.call(this,e,{uniforms:o,postProcesses:r.postProcesses})||this).sourceRevision_=-1,i.verticesBuffer_=new u_(t_,n_),i.hitVerticesBuffer_=new u_(t_,n_),i.indicesBuffer_=new u_(e_,n_),i.vertexShader_=r.vertexShader,i.fragmentShader_=r.fragmentShader,i.program_,i.hitDetectionEnabled_=!(!r.hitFragmentShader||!r.hitVertexShader),i.hitVertexShader_=r.hitVertexShader,i.hitFragmentShader_=r.hitFragmentShader,i.hitProgram_;var s,l,u=r.attributes?r.attributes.map((function(t){return{name:"a_"+t.name,size:1,type:S_.FLOAT}})):[];i.attributes=[{name:"a_position",size:2,type:S_.FLOAT},{name:"a_index",size:1,type:S_.FLOAT}].concat(u),i.hitDetectionAttributes=[{name:"a_position",size:2,type:S_.FLOAT},{name:"a_index",size:1,type:S_.FLOAT},{name:"a_hitColor",size:4,type:S_.FLOAT},{name:"a_featureUid",size:1,type:S_.FLOAT}].concat(u),i.customAttributes=r.attributes?r.attributes:[],i.previousExtent_=[1/0,1/0,-1/0,-1/0],i.currentTransform_=a,i.renderTransform_=[1,0,0,1,0,0],i.invertRenderTransform_=[1,0,0,1,0,0],i.renderInstructions_=new Float32Array(0),i.hitRenderInstructions_=new Float32Array(0),i.hitRenderTarget_,i.worker_=(s=new Blob(['var e="function"==typeof Object.assign?Object.assign:function(e,n){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1,o=arguments.length;r=.5&&R>=.5){var P=T[4],O=T[5],F=a.opacity,I=void 0;1!==F&&(I=v.globalAlpha,v.globalAlpha=F),v.drawImage(E,0,0,+E.width,+E.height,Math.round(P),Math.round(O),Math.round(b),Math.round(R)),1!==F&&(v.globalAlpha=I)}return this.postRender(v,t),w&&v.restore(),y!==x.style.transform&&(x.style.transform=y),this.container},e}(Pa),Z_=K_,H_=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),q_=function(t){function e(e){return t.call(this,e)||this}return H_(e,t),e.prototype.createRenderer=function(){return new Z_(this)},e}(X_),J_=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Q_=function(t){function e(e){var r=t.call(this,e)||this;return r.extentChanged=!0,r.renderedExtent_=null,r.renderedPixelRatio,r.renderedProjection=null,r.renderedRevision,r.renderedTiles=[],r.newTiles_=!1,r.tmpExtent=[1/0,1/0,-1/0,-1/0],r.tmpTileRange_=new gp(0,0,0,0),r}return J_(e,t),e.prototype.isDrawableTile=function(t){var e=this.getLayer(),r=t.getState(),n=e.getUseInterimTilesOnError();return r==nl||r==ol||r==il&&!n},e.prototype.getTile=function(t,e,r,n){var i=n.pixelRatio,o=n.viewState.projection,a=this.getLayer(),s=a.getSource().getTile(t,e,r,i,o);return s.getState()==il&&(a.getUseInterimTilesOnError()?a.getPreload()>0&&(this.newTiles_=!0):s.setState(nl)),this.isDrawableTile(s)||(s=s.getInterimTile()),s},e.prototype.loadedTileCallback=function(e,r,n){return!!this.isDrawableTile(n)&&t.prototype.loadedTileCallback.call(this,e,r,n)},e.prototype.prepareFrame=function(t){return!!this.getLayer().getSource()},e.prototype.renderFrame=function(t,e){var r=t.layerStatesArray[t.layerIndex],i=t.viewState,o=i.projection,a=i.resolution,s=i.center,l=i.rotation,u=t.pixelRatio,c=this.getLayer(),p=c.getSource(),f=p.getRevision(),d=p.getTileGridForProjection(o),g=d.getZForResolution(a,p.zDirection),_=d.getResolution(g),y=t.extent,v=r.extent&&Gr(r.extent);v&&(y=Ce(y,Gr(r.extent)));var x=p.getTilePixelRatio(u),w=Math.round(t.size[0]*x),S=Math.round(t.size[1]*x);if(l){var C=Math.round(Math.sqrt(w*w+S*S));w=C,S=C}var E=_*w/2/x,T=_*S/2/x,b=[s[0]-E,s[1]-T,s[0]+E,s[1]+T],R=d.getTileRangeForExtentAndZ(y,g),P={};P[g]={};var O=this.createLoadedTileFinder(p,o,P),F=this.tmpExtent,I=this.tmpTileRange_;this.newTiles_=!1;for(var L=R.minX;L<=R.maxX;++L)for(var M=R.minY;M<=R.maxY;++M){var A=this.getTile(g,L,M,t);if(this.isDrawableTile(A)){var D=n(this);if(A.getState()==nl){P[g][A.tileCoord.toString()]=A;var k=A.inTransition(D);this.newTiles_||!k&&-1!==this.renderedTiles.indexOf(A)||(this.newTiles_=!0)}if(1===A.getAlpha(D,t.time))continue}var j=d.getTileCoordChildTileRange(A.tileCoord,I,F),G=!1;j&&(G=O(g+1,j)),G||d.forEachTileCoordParentTileRange(A.tileCoord,O,I,F)}var N=_/a;Gt(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/x,1/x,l,-w/2,-S/2);var B=Bt(this.pixelTransform);this.useContainer(e,B,r.opacity,this.getBackground(t));var z=this.context,U=z.canvas;Nt(this.inversePixelTransform,this.pixelTransform),Gt(this.tempTransform,w/2,S/2,N,N,0,-w/2,-S/2),U.width!=w||U.height!=S?(U.width=w,U.height=S):this.containerReused||z.clearRect(0,0,w,S),v&&this.clipUnrotated(z,t,v),p.getInterpolate()||m(z,W_),this.preRender(z,t),this.renderedTiles.length=0;var V,X,W,Y=Object.keys(P).map(Number);Y.sort(h),1!==r.opacity||this.containerReused&&!p.getOpaque(t.viewState.projection)?(V=[],X=[]):Y=Y.reverse();for(var K=Y.length-1;K>=0;--K){var Z=Y[K],H=p.getTilePixelSize(Z,u,o),q=d.getResolution(Z)/_,J=H[0]*q*N,Q=H[1]*q*N,$=d.getTileCoordForCoordAndZ(Ee(b),Z),tt=d.getTileCoordExtent($),et=kt(this.tempTransform,[x*(tt[0]-b[0])/_,x*(b[3]-tt[3])/_]),rt=x*p.getGutterForProjection(o),nt=P[Z];for(var it in nt){var ot=(A=nt[it]).tileCoord,at=$[1]-ot[1],st=Math.round(et[0]-(at-1)*J),lt=$[2]-ot[2],ut=Math.round(et[1]-(lt-1)*Q),ht=st-(L=Math.round(et[0]-at*J)),ct=ut-(M=Math.round(et[1]-lt*Q)),pt=g===Z;if(!(k=pt&&1!==A.getAlpha(n(this),t.time)))if(V){z.save(),W=[L,M,L+ht,M,L+ht,M+ct,L,M+ct];for(var ft=0,dt=V.length;ft0)e([]);else{var y=Ee(c.getTileCoordExtent(i.wrappedTileCoord)),v=[(p[0]-y[0])/h,(y[1]-p[1])/h],m=i.getSourceTiles().reduce((function(t,e){return t.concat(e.getFeatures())}),[]),x=i.hitDetectionImageData[a];if(!x&&!this.animatingOrInteracting_){var w=ii(c.getTileSize(c.getZForResolution(h))),S=this.renderedRotation_;x=ws(w,[this.getRenderTransform(c.getTileCoordCenter(i.wrappedTileCoord),h,0,xs,w[0]*xs,w[1]*xs,0)],m,o.getStyleFunction(),c.getTileCoordExtent(i.wrappedTileCoord),i.getReplayState(o).renderedResolution,S),i.hitDetectionImageData[a]=x}e(Ss(v,m,x))}}.bind(this))},e.prototype.handleFontsChanged=function(){var t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()},e.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()},e.prototype.renderDeclutter=function(t){var e=this.context,r=e.globalAlpha;e.globalAlpha=this.getLayer().getOpacity();for(var i=t.viewHints,o=!(i[qa]||i[Ja]),a=this.renderedTiles,s=0,l=a.length;s=0;--c)h[c].execute(this.context,1,this.getTileRenderTransform(u,t),t.viewState.rotation,o,void 0,t.declutterTree)}e.globalAlpha=r},e.prototype.getTileRenderTransform=function(t,e){var r=e.pixelRatio,n=e.viewState,i=n.center,o=n.resolution,a=n.rotation,s=e.size,l=Math.round(s[0]*r),u=Math.round(s[1]*r),h=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),c=t.tileCoord,p=h.getTileCoordExtent(t.wrappedTileCoord),f=h.getTileCoordExtent(c,this.tmpExtent)[0]-p[0];return At(jt(this.inversePixelTransform.slice(),1/r,1/r),this.getRenderTransform(i,o,a,r,l,u,f))},e.prototype.renderFrame=function(e,r){var i=e.viewHints,o=!(i[qa]||i[Ja]);t.prototype.renderFrame.call(this,e,r),this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation;var a=this.getLayer(),s=a.getRenderMode(),l=this.context,u=l.globalAlpha;l.globalAlpha=a.getOpacity();for(var h=oy[s],c=e.viewState.rotation,p=this.renderedTiles,f=[],d=[],g=p.length-1;g>=0;--g)for(var _=p[g],y=this.getTileRenderTransform(_,e),v=_.executorGroups[n(a)],m=!1,x=0,w=v.length;x0||r&&0===o)}))),17),!t.origins)for(var o=0,a=this.resolutions_.length-1;o=this.minZoom;){if(e(s,2===this.zoomFactor_?dp(i=Math.floor(i/2),i,o=Math.floor(o/2),o,r):this.getTileRangeForExtentAndZ(a,s,r)))return!0;--s}return!1},t.prototype.getExtent=function(){return this.extent_},t.prototype.getMaxZoom=function(){return this.maxZoom},t.prototype.getMinZoom=function(){return this.minZoom},t.prototype.getOrigin=function(t){return this.origin_?this.origin_:this.origins_[t]},t.prototype.getResolution=function(t){return this.resolutions_[t]},t.prototype.getResolutions=function(){return this.resolutions_},t.prototype.getTileCoordChildTileRange=function(t,e,r){if(t[0]this.maxZoom||e0?n:Math.max(a/s[0],o/s[1]),u=i+1,h=new Array(u),c=0;cr||r>e.getMaxZoom())return!1;var o=e.getFullTileRange(r);return!o||o.containsXY(n,i)}(t,n)?t:null},r.prototype.clear=function(){this.tileCache.clear()},r.prototype.refresh=function(){this.clear(),t.prototype.refresh.call(this)},r.prototype.updateCacheSize=function(t,e){var r=this.getTileCacheForProjection(e);t>r.highWaterMark&&(r.highWaterMark=t)},r.prototype.useTile=function(t,e,r,n){},r}(js),Ty=function(t){function e(e,r){var n=t.call(this,e)||this;return n.tile=r,n}return Cy(e,t),e}(s),by=Ey;function Ry(t,e){var r=/\{z\}/g,n=/\{x\}/g,i=/\{y\}/g,o=/\{-y\}/g;return function(a,s,l){return a?t.replace(r,a[0].toString()).replace(n,a[1].toString()).replace(i,a[2].toString()).replace(o,(function(){var t=a[0],r=e.getFullTileRange(t);return nt(r,55),(r.getHeight()-a[2]-1).toString()})):void 0}}function Py(t){return 1===t.length?t[0]:function(e,r,n){if(e){var i=Ge(up(e),t.length);return t[i](e,r,n)}}}var Oy=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Fy=function(t){function e(r){var n=t.call(this,{attributions:r.attributions,cacheSize:r.cacheSize,opaque:r.opaque,projection:r.projection,state:r.state,tileGrid:r.tileGrid,tilePixelRatio:r.tilePixelRatio,wrapX:r.wrapX,transition:r.transition,interpolate:r.interpolate,key:r.key,attributionsCollapsible:r.attributionsCollapsible,zDirection:r.zDirection})||this;return n.generateTileUrlFunction_=n.tileUrlFunction===e.prototype.tileUrlFunction,n.tileLoadFunction=r.tileLoadFunction,r.tileUrlFunction&&(n.tileUrlFunction=r.tileUrlFunction),n.urls=null,r.urls?n.setUrls(r.urls):r.url&&n.setUrl(r.url),n.tileLoadingKeys_={},n}return Oy(e,t),e.prototype.getTileLoadFunction=function(){return this.tileLoadFunction},e.prototype.getTileUrlFunction=function(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction},e.prototype.getUrls=function(){return this.urls},e.prototype.handleTileChange=function(t){var e,r=t.target,i=n(r),o=r.getState();o==rl?(this.tileLoadingKeys_[i]=!0,e=py):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],e=o==il?dy:o==nl?fy:void 0),null!=e&&this.dispatchEvent(new Ty(e,r))},e.prototype.setTileLoadFunction=function(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()},e.prototype.setTileUrlFunction=function(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==e?this.setKey(e):this.changed()},e.prototype.setUrl=function(t){var e=function(t){var e=[],r=/\{([a-z])-([a-z])\}/.exec(t);if(r){var n=r[1].charCodeAt(0),i=r[2].charCodeAt(0),o=void 0;for(o=n;o<=i;++o)e.push(t.replace(r[0],String.fromCharCode(o)));return e}if(r=/\{(\d+)-(\d+)\}/.exec(t)){for(var a=parseInt(r[2],10),s=parseInt(r[1],10);s<=a;s++)e.push(t.replace(r[0],s.toString()));return e}return e.push(t),e}(t);this.urls=e,this.setUrls(e)},e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(function(t,e){for(var r=t.length,n=new Array(r),i=0;ithis.sourceWorldWidth_/2){var e=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];e[0][0]-y>this.sourceWorldWidth_/2&&(e[0][0]-=this.sourceWorldWidth_),e[1][0]-y>this.sourceWorldWidth_/2&&(e[1][0]-=this.sourceWorldWidth_),e[2][0]-y>this.sourceWorldWidth_/2&&(e[2][0]-=this.sourceWorldWidth_);var r=Math.min(e[0][0],e[1][0],e[2][0]);Math.max(e[0][0],e[1][0],e[2][0])-r.5&&h<1,f=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_)f=be(Jt([t,e,r,n]))/this.targetWorldWidth_>.25||f;!p&&this.sourceProj_.isGlobal()&&h&&(f=h>.25||f)}if(!(!f&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3]))||Re(u,this.maxSourceExtent_)){var d=0;if(!(f||isFinite(i[0])&&isFinite(i[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])&&isFinite(s[0])&&isFinite(s[1])))if(l>0)f=!0;else if(1!=(d=(isFinite(i[0])&&isFinite(i[1])?0:8)+(isFinite(o[0])&&isFinite(o[1])?0:4)+(isFinite(a[0])&&isFinite(a[1])?0:2)+(isFinite(s[0])&&isFinite(s[1])?0:1))&&2!=d&&4!=d&&8!=d)return;if(l>0){if(!f){var g=[(t[0]+r[0])/2,(t[1]+r[1])/2],_=this.transformInv_(g),y=void 0;if(p)y=(Ge(i[0],c)+Ge(a[0],c))/2-Ge(_[0],c);else y=(i[0]+a[0])/2-_[0];var v=(i[1]+a[1])/2-_[1];f=y*y+v*v>this.errorThresholdSquared_}if(f){if(Math.abs(t[0]-r[0])<=Math.abs(t[1]-r[1])){var m=[(e[0]+r[0])/2,(e[1]+r[1])/2],x=this.transformInv_(m),w=[(n[0]+t[0])/2,(n[1]+t[1])/2],S=this.transformInv_(w);this.addQuad_(t,e,m,w,i,o,x,S,l-1),this.addQuad_(w,m,r,n,S,x,a,s,l-1)}else{var C=[(t[0]+e[0])/2,(t[1]+e[1])/2],E=this.transformInv_(C),T=[(r[0]+n[0])/2,(r[1]+n[1])/2],b=this.transformInv_(T);this.addQuad_(t,C,T,n,i,E,b,s,l-1),this.addQuad_(C,e,r,T,E,o,a,b,l-1)}return}}if(p){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&d)&&this.addTriangle_(t,r,n,i,a,s),0==(14&d)&&this.addTriangle_(t,r,e,i,a,o),d&&(0==(13&d)&&this.addTriangle_(e,n,t,o,s,i),0==(7&d)&&this.addTriangle_(e,n,r,o,s,a))}},t.prototype.calculateSourceExtent=function(){var t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,r,n){var i=e.source;pe(t,i[0]),pe(t,i[1]),pe(t,i[2])})),t},t.prototype.getTriangles=function(){return this.triangles_},t}();function jy(t,e,r,n,i){t.beginPath(),t.moveTo(0,0),t.lineTo(e,r),t.lineTo(n,i),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(r,i)),t.restore()}function Gy(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Ny(t,e,r,n){var i=Ir(r,e,t),o=Tr(e,n,r),a=e.getMetersPerUnit();void 0!==a&&(o*=a);var s=t.getMetersPerUnit();void 0!==s&&(o/=s);var l=t.getExtent();if(!l||ee(l,i)){var u=Tr(t,o,i)/o;isFinite(u)&&u>0&&(o/=u)}return o}function By(t,e,r,n,i,o,a,s,l,u,h,c){var p=_i(Math.round(r*t),Math.round(r*e));if(c||m(p,W_),0===l.length)return p.canvas;function f(t){return Math.round(t*r)/r}p.scale(r,r),p.globalCompositeOperation="lighter";var d=[1/0,1/0,-1/0,-1/0];l.forEach((function(t,e,r){ce(d,t.extent)}));var g=be(d),_=Se(d),y=_i(Math.round(r*g/n),Math.round(r*_/n));c||m(y,W_);var v=r/n;l.forEach((function(t,e,r){var n=t.extent[0]-d[0],i=-(t.extent[3]-d[3]),o=be(t.extent),a=Se(t.extent);t.image.width>0&&t.image.height>0&&y.drawImage(t.image,u,u,t.image.width-2*u,t.image.height-2*u,n*v,i*v,o*v,a*v)}));var x=Ee(a);return s.getTriangles().forEach((function(t,e,i){var a=t.source,s=t.target,l=a[0][0],u=a[0][1],h=a[1][0],g=a[1][1],_=a[2][0],v=a[2][1],m=f((s[0][0]-x[0])/o),w=f(-(s[0][1]-x[1])/o),S=f((s[1][0]-x[0])/o),C=f(-(s[1][1]-x[1])/o),E=f((s[2][0]-x[0])/o),T=f(-(s[2][1]-x[1])/o),b=l,R=u;l=0,u=0;var P=function(t){for(var e=t.length,r=0;ri&&(i=a,n=o)}if(0===i)return null;var s=t[n];t[n]=t[r],t[r]=s;for(var l=r+1;l=0;p--){c[p]=t[p][e]/t[p][p];for(var f=p-1;f>=0;f--)t[f][e]-=t[f][p]*c[p]}return c}([[h-=b,g-=R,0,0,S-m],[_-=b,v-=R,0,0,E-m],[0,0,h,g,C-w],[0,0,_,v,T-w]]);if(P){if(p.save(),p.beginPath(),function(){if(void 0===Dy){var t=document.createElement("canvas").getContext("2d");t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",jy(t,4,5,4,0),jy(t,4,5,0,5);var e=t.getImageData(0,0,3,3).data;Dy=Gy(e,0)||Gy(e,4)||Gy(e,8)}return Dy}()||!c){p.moveTo(S,C);for(var O=m-S,F=w-C,I=0;I<4;I++)p.lineTo(S+f((I+1)*O/4),C+f(I*F/3)),3!=I&&p.lineTo(S+f((I+1)*O/4),C+f((I+1)*F/3));p.lineTo(E,T)}else p.moveTo(S,C),p.lineTo(m,w),p.lineTo(E,T);p.clip(),p.transform(P[0],P[2],P[1],P[3],m,w),p.translate(d[0]-b,d[3]-R),p.scale(n/r,-n/r),p.drawImage(y.canvas,0,0),p.restore()}})),h&&(p.save(),p.globalCompositeOperation="source-over",p.strokeStyle="black",p.lineWidth=1,s.getTriangles().forEach((function(t,e,r){var n=t.target,i=(n[0][0]-x[0])/o,a=-(n[0][1]-x[1])/o,s=(n[1][0]-x[0])/o,l=-(n[1][1]-x[1])/o,u=(n[2][0]-x[0])/o,h=-(n[2][1]-x[1])/o;p.beginPath(),p.moveTo(s,l),p.lineTo(i,a),p.lineTo(u,h),p.closePath(),p.stroke()})),p.restore()),p.canvas}var 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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Uy=function(t){function e(e,r,n,i,o,a,s,l,u,h,c,p){var f=t.call(this,o,el,{interpolate:!!p})||this;f.renderEdges_=void 0!==c&&c,f.pixelRatio_=s,f.gutter_=l,f.canvas_=null,f.sourceTileGrid_=r,f.targetTileGrid_=i,f.wrappedTileCoord_=a||o,f.sourceTiles_=[],f.sourcesListenerKeys_=null,f.sourceZ_=0;var d=i.getTileCoordExtent(f.wrappedTileCoord_),g=f.targetTileGrid_.getExtent(),_=f.sourceTileGrid_.getExtent(),y=g?Ce(d,g):d;if(0===_e(y))return f.state=ol,f;var v=e.getExtent();v&&(_=_?Ce(_,v):v);var m=i.getResolution(f.wrappedTileCoord_[0]),x=function(t,e,r,n){var i=me(r),o=Ny(t,e,i,n);return(!isFinite(o)||o<=0)&&ge(r,(function(r){return o=Ny(t,e,r,n),isFinite(o)&&o>0})),o}(e,n,y,m);if(!isFinite(x)||x<=0)return f.state=ol,f;var w=void 0!==h?h:.5;if(f.triangulation_=new ky(e,n,y,_,x*w,m),0===f.triangulation_.getTriangles().length)return f.state=ol,f;f.sourceZ_=r.getZForResolution(x);var S=f.triangulation_.calculateSourceExtent();if(_&&(e.canWrapX()?(S[1]=Ie(S[1],_[1],_[3]),S[3]=Ie(S[3],_[1],_[3])):S=Ce(S,_)),_e(S)){for(var C=r.getTileRangeForExtentAndZ(S,f.sourceZ_),E=C.minX;E<=C.maxX;E++)for(var T=C.minY;T<=C.maxY;T++){var b=u(f.sourceZ_,E,T,s);b&&f.sourceTiles_.push(b)}0===f.sourceTiles_.length&&(f.state=ol)}else f.state=ol;return f}return zy(e,t),e.prototype.getImage=function(){return this.canvas_},e.prototype.reproject_=function(){var t=[];if(this.sourceTiles_.forEach(function(e,r,n){e&&e.getState()==nl&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.sourceTiles_.length=0,0===t.length)this.state=il;else{var e=this.wrappedTileCoord_[0],r=this.targetTileGrid_.getTileSize(e),n="number"==typeof r?r:r[0],i="number"==typeof r?r:r[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),s=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=By(n,i,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,s,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=nl}this.changed()},e.prototype.load=function(){if(this.state==el){this.state=rl,this.changed();var t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(e,r,n){var i=e.getState();if(i==el||i==rl){t++;var o=N(e,T,(function(r){var n=e.getState();n!=nl&&n!=il&&n!=ol||(z(o),0===--t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(o)}}.bind(this)),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function(t,e,r){t.getState()==el&&t.load()}))}},e.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(z),this.sourcesListenerKeys_=null},e}(pl),Vy=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");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){var r=this,n=void 0===e.imageSmoothing||e.imageSmoothing;return void 0!==e.interpolate&&(n=e.interpolate),(r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:Wy,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:n,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection})||this).crossOrigin=void 0!==e.crossOrigin?e.crossOrigin:null,r.tileClass=void 0!==e.tileClass?e.tileClass:dl,r.tileCacheForProjection={},r.tileGridForProjection={},r.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,r.renderReprojectionEdges_=!1,r}return Vy(e,t),e.prototype.canExpireCache=function(){if(this.tileCache.canExpireCache())return!0;for(var t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1},e.prototype.expireCache=function(t,e){var r=this.getTileCacheForProjection(t);for(var n in this.tileCache.expireCache(this.tileCache==r?e:{}),this.tileCacheForProjection){var i=this.tileCacheForProjection[n];i.expireCache(i==r?e:{})}},e.prototype.getGutterForProjection=function(t){return this.getProjection()&&t&&!Pr(this.getProjection(),t)?0:this.getGutter()},e.prototype.getGutter=function(){return 0},e.prototype.getKey=function(){var e=t.prototype.getKey.call(this);return this.getInterpolate()||(e+=":disable-interpolation"),e},e.prototype.getOpaque=function(e){return!(this.getProjection()&&e&&!Pr(this.getProjection(),e))&&t.prototype.getOpaque.call(this,e)},e.prototype.getTileGridForProjection=function(t){var e=this.getProjection();if(!this.tileGrid||e&&!Pr(e,t)){var r=n(t);return r in this.tileGridForProjection||(this.tileGridForProjection[r]=vy(t)),this.tileGridForProjection[r]}return this.tileGrid},e.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();if(!e||Pr(e,t))return this.tileCache;var r=n(t);return r in this.tileCacheForProjection||(this.tileCacheForProjection[r]=new pp(this.tileCache.highWaterMark)),this.tileCacheForProjection[r]},e.prototype.createTile_=function(t,e,r,n,i,o){var a=[t,e,r],s=this.getTileCoordForTileUrlFunction(a,i),l=s?this.tileUrlFunction(s,n,i):void 0,u=new this.tileClass(a,void 0!==l?el:ol,void 0!==l?l:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return u.key=o,u.addEventListener(T,this.handleTileChange.bind(this)),u},e.prototype.getTile=function(t,e,r,n,i){var o=this.getProjection();if(o&&i&&!Pr(o,i)){var a=this.getTileCacheForProjection(i),s=[t,e,r],l=void 0,u=sp(s);a.containsKey(u)&&(l=a.get(u));var h=this.getKey();if(l&&l.key==h)return l;var c=this.getTileGridForProjection(o),p=this.getTileGridForProjection(i),f=this.getTileCoordForTileUrlFunction(s,i),d=new Uy(o,c,i,p,s,f,this.getTilePixelRatio(n),this.getGutter(),function(t,e,r,n){return this.getTileInternal(t,e,r,n,o)}.bind(this),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.getInterpolate());return d.key=h,l?(d.interimTile=l,d.refreshInterimChain(),a.replace(u,d)):a.set(u,d),d}return this.getTileInternal(t,e,r,n,o||i)},e.prototype.getTileInternal=function(t,e,r,n,i){var o=null,a=ap(t,e,r),s=this.getKey();if(this.tileCache.containsKey(a)){if((o=this.tileCache.get(a)).key!=s){var l=o;o=this.createTile_(t,e,r,n,i,s),l.getState()==el?o.interimTile=l.interimTile:o.interimTile=l,o.refreshInterimChain(),this.tileCache.replace(a,o)}}else o=this.createTile_(t,e,r,n,i,s),this.tileCache.set(a,o);return o},e.prototype.setRenderReprojectionEdges=function(t){if(this.renderReprojectionEdges_!=t){for(var e in this.renderReprojectionEdges_=t,this.tileCacheForProjection)this.tileCacheForProjection[e].clear();this.changed()}},e.prototype.setTileGridForProjection=function(t,e){var r=Er(t);if(r){var i=n(r);i in this.tileGridForProjection||(this.tileGridForProjection[i]=e)}},e}(Fy);function Wy(t,e){t.getImage().src=e}var Yy=Xy,Ky=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();!function(t){function e(e){var r=this,n="Unexpected response status: "+e.status;return(r=t.call(this,n)||this).name="ResponseError",r.response=e,r}Ky(e,t)}(Error),function(t){function e(e){var r=t.call(this,"Failed to issue request")||this;return r.name="ClientError",r.client=e,r}Ky(e,t)}(Error);var 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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Hy=function(t){function e(e){var r=this,n=e||{},i=m({},n);return delete i.preload,delete i.useInterimTilesOnError,(r=t.call(this,i)||this).on,r.once,r.un,r.setPreload(void 0!==n.preload?n.preload:0),r.setUseInterimTilesOnError(void 0===n.useInterimTilesOnError||n.useInterimTilesOnError),r}return Zy(e,t),e.prototype.getPreload=function(){return this.get(ly)},e.prototype.setPreload=function(t){this.set(ly,t)},e.prototype.getUseInterimTilesOnError=function(){return this.get(uy)},e.prototype.setUseInterimTilesOnError=function(t){this.set(uy,t)},e}(Oo),qy=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Jy=function(t){function e(e){return t.call(this,e)||this}return qy(e,t),e.prototype.createRenderer=function(){return new $_(this)},e}(Hy),Qy=function(){function t(t,e){this.name=t,this.data=e,this.texture_=null}return t.prototype.getTexture=function(t){if(!this.texture_){var e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.data.length/4,1,0,t.RGBA,t.UNSIGNED_BYTE,this.data),this.texture_=e}return this.texture_},t}(),$y=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function tv(t,e,r){var n=r?t.LINEAR:t.NEAREST;t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n)}function ev(t,e,r,n,i,o){var a=t.getGL();tv(a,e,o);var s,l,u=r.byteLength/n[1],h=1;switch(u%8==0?h=8:u%4==0?h=4:u%2==0&&(h=2),i){case 1:s=a.LUMINANCE;break;case 2:s=a.LUMINANCE_ALPHA;break;case 3:s=a.RGB;break;case 4:s=a.RGBA;break;default:throw new Error("Unsupported number of bands: "+i)}r instanceof Float32Array?(l=a.FLOAT,t.getExtension("OES_texture_float"),t.getExtension("OES_texture_float_linear")):l=a.UNSIGNED_BYTE;var c=a.getParameter(a.UNPACK_ALIGNMENT);a.pixelStorei(a.UNPACK_ALIGNMENT,h),a.texImage2D(a.TEXTURE_2D,0,s,n[0],n[1],0,s,l,r),a.pixelStorei(a.UNPACK_ALIGNMENT,c)}var rv=function(t){function e(e,r,n){var i=t.call(this)||this;i.tile,i.textures=[],i.handleTileChange_=i.handleTileChange_.bind(i),i.size=ii(r.getTileSize(e.tileCoord[0])),i.bandCount=NaN,i.helper_=n;var o=new u_(t_,r_);return o.fromArray([0,1,1,1,1,0,0,0]),n.flushBufferData(o),i.coords=o,i.setTile(e),i}return $y(e,t),e.prototype.setTile=function(t){t!==this.tile&&(this.tile&&this.tile.removeEventListener(T,this.handleTileChange_),this.tile=t,this.textures.length=0,this.loaded=t.getState()===nl,this.loaded?this.uploadTile_():t.addEventListener(T,this.handleTileChange_))},e.prototype.uploadTile_=function(){var t=this.helper_,e=t.getGL(),r=this.tile;if(r instanceof dl||r instanceof Uy){var n=e.createTexture();return this.textures.push(n),this.bandCount=4,void function(t,e,r,n){tv(t,e,n),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r)}(e,n,r.getImage(),r.interpolate)}var i=r.getData(),o=i instanceof Float32Array,a=this.size[0]*this.size[1],s=o?Float32Array:Uint8Array,l=s.BYTES_PER_ELEMENT,u=i.byteLength/this.size[1];this.bandCount=Math.floor(u/l/this.size[0]);var h=Math.ceil(this.bandCount/4);if(1===h){n=e.createTexture();return this.textures.push(n),void ev(t,n,i,this.size,this.bandCount,r.interpolate)}for(var c=new Array(h),p=0;p=x;--w){if(this.findAltTiles_(o,m,w,l))break}}this.helper.useProgram(this.program_),this.helper.prepareDraw(t,!g);for(var S=Object.keys(l).map(Number).sort(h),C=r.center[0],E=r.center[1],T=0,b=S.length;T4)throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.");return"vec"+t.length+"("+t.map(Rv).join(", ")+")"}function Ov(t,e){return void 0===t.stringLiteralsMap[e]&&(t.stringLiteralsMap[e]=Object.keys(t.stringLiteralsMap).length),t.stringLiteralsMap[e]}function Fv(t,e,r){if(Array.isArray(e)&&"string"==typeof e[0]){var n=Tv[e[0]];if(void 0===n)throw new Error("Unrecognized expression operator: "+JSON.stringify(e));return n.toGlsl(t,e.slice(1),r)}var i,o=bv(e);if((o&vv)>0)return Rv(e);if((o&wv)>0)return e.toString();if((o&mv)>0&&(void 0===r||r==mv))return function(t,e){return Rv(Ov(t,e))}(t,e.toString());if((o&xv)>0&&(void 0===r||r==xv))return(i=pi(e).slice()).length<4&&i.push(1),Pv(i.map((function(t,e){return e<3?t/255:t})));if((o&Sv)>0)return Pv(e);throw new Error("Unexpected expression "+e+" (expected type "+r+")")}function Iv(t){if(!(bv(t)&vv))throw new Error("A numeric value was expected, got "+JSON.stringify(t)+" instead")}function Lv(t){for(var e=0;ee)throw new Error("At most "+e+" arguments were expected, got "+t.length+" instead")}function Gv(t){if(t.length%2!=0)throw new Error("An even amount of arguments was expected, got "+t+" instead")}function Nv(t,e){if(Me(e)%1!=0)throw new Error("Could not infer only one type from the following expression: "+JSON.stringify(t))}function Bv(t){return"u_var_"+t}Tv.get={getReturnType:function(t){return Cv},toGlsl:function(t,e){Dv(e,1),Mv(e[0]);var r=e[0].toString();return-1===t.attributes.indexOf(r)&&t.attributes.push(r),(t.inFragmentShader?"v_":"a_")+r}},Tv.var={getReturnType:function(t){return Cv},toGlsl:function(t,e){Dv(e,1),Mv(e[0]);var r=e[0].toString();return-1===t.variables.indexOf(r)&&t.variables.push(r),Bv(r)}};Tv.palette={getReturnType:function(t){return xv},toGlsl:function(t,e){Dv(e,2),Iv(e[0]);var r=Fv(t,e[0]),n=e[1];if(!Array.isArray(n))throw new Error("The second argument of palette must be an array");for(var i=n.length,o=new Uint8Array(4*i),a=0;a"]={getReturnType:function(t){return wv},toGlsl:function(t,e){return Dv(e,2),Lv(e),"("+Fv(t,e[0])+" > "+Fv(t,e[1])+")"}},Tv[">="]={getReturnType:function(t){return wv},toGlsl:function(t,e){return Dv(e,2),Lv(e),"("+Fv(t,e[0])+" >= "+Fv(t,e[1])+")"}},Tv["<"]={getReturnType:function(t){return wv},toGlsl:function(t,e){return Dv(e,2),Lv(e),"("+Fv(t,e[0])+" < "+Fv(t,e[1])+")"}},Tv["<="]={getReturnType:function(t){return wv},toGlsl:function(t,e){return Dv(e,2),Lv(e),"("+Fv(t,e[0])+" <= "+Fv(t,e[1])+")"}},Tv["=="]=Uv("=="),Tv["!="]=Uv("!="),Tv["!"]={getReturnType:function(t){return wv},toGlsl:function(t,e){return Dv(e,1),Av(e[0]),"(!"+Fv(t,e[0])+")"}},Tv.all=Vv("&&"),Tv.any=Vv("||"),Tv.between={getReturnType:function(t){return wv},toGlsl:function(t,e){Dv(e,3),Lv(e);var r=Fv(t,e[1]),n=Fv(t,e[2]),i=Fv(t,e[0]);return"("+i+" >= "+r+" && "+i+" <= "+n+")"}},Tv.array={getReturnType:function(t){return Sv},toGlsl:function(t,e){kv(e,2),jv(e,4),Lv(e);var r=e.map((function(e){return Fv(t,e,vv)}));return"vec"+e.length+"("+r.join(", ")+")"}},Tv.color={getReturnType:function(t){return xv},toGlsl:function(t,e){kv(e,3),jv(e,4),Lv(e);var r=e;3===e.length&&r.push(1);var n=e.map((function(e,r){return Fv(t,e,vv)+(r<3?" / 255.0":"")}));return"vec"+e.length+"("+n.join(", ")+")"}},Tv.interpolate={getReturnType:function(t){for(var e=xv|vv,r=3;r=1;l-=2){s="("+o+" == "+Fv(t,e[l])+" ? "+Fv(t,e[l+1],i)+" : "+(s||a)+")"}return s}},Tv.case={getReturnType:function(t){for(var e=Cv,r=1;r=0;o-=2){s="("+Fv(t,e[o])+" ? "+Fv(t,e[o+1],i)+" : "+(s||a)+")"}return s}};var Xv=function(){function t(){this.uniforms=[],this.attributes=[],this.varyings=[],this.sizeExpression="vec2(1.0)",this.rotationExpression="0.0",this.offsetExpression="vec2(0.0)",this.colorExpression="vec4(1.0)",this.texCoordExpression="vec4(0.0, 0.0, 1.0, 1.0)",this.discardExpression="false",this.rotateWithView=!1}return t.prototype.addUniform=function(t){return this.uniforms.push(t),this},t.prototype.addAttribute=function(t){return this.attributes.push(t),this},t.prototype.addVarying=function(t,e,r){return this.varyings.push({name:t,type:e,expression:r}),this},t.prototype.setSizeExpression=function(t){return this.sizeExpression=t,this},t.prototype.setRotationExpression=function(t){return this.rotationExpression=t,this},t.prototype.setSymbolOffsetExpression=function(t){return this.offsetExpression=t,this},t.prototype.setColorExpression=function(t){return this.colorExpression=t,this},t.prototype.setTextureCoordinateExpression=function(t){return this.texCoordExpression=t,this},t.prototype.setFragmentDiscardExpression=function(t){return this.discardExpression=t,this},t.prototype.setSymbolRotateWithView=function(t){return this.rotateWithView=t,this},t.prototype.getSizeExpression=function(){return this.sizeExpression},t.prototype.getOffsetExpression=function(){return this.offsetExpression},t.prototype.getColorExpression=function(){return this.colorExpression},t.prototype.getTextureCoordinateExpression=function(){return this.texCoordExpression},t.prototype.getFragmentDiscardExpression=function(){return this.discardExpression},t.prototype.getSymbolVertexShader=function(t){var e=this.rotateWithView?"u_offsetScaleMatrix * u_offsetRotateMatrix":"u_offsetScaleMatrix",r=this.attributes,n=this.varyings;return t&&(r=r.concat("vec4 a_hitColor"),n=n.concat({name:"v_hitColor",type:"vec4",expression:"a_hitColor"})),"precision mediump float;\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\n"+this.uniforms.map((function(t){return"uniform "+t+";"})).join("\n")+"\nattribute vec2 a_position;\nattribute float a_index;\n"+r.map((function(t){return"attribute "+t+";"})).join("\n")+"\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\n"+n.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")+"\nvoid main(void) {\n mat4 offsetMatrix = "+e+";\n vec2 halfSize = "+this.sizeExpression+" * 0.5;\n vec2 offset = "+this.offsetExpression+";\n float angle = "+this.rotationExpression+";\n float offsetX;\n float offsetY;\n if (a_index == 0.0) {\n offsetX = (offset.x - halfSize.x) * cos(angle) + (offset.y - halfSize.y) * sin(angle);\n offsetY = (offset.y - halfSize.y) * cos(angle) - (offset.x - halfSize.x) * sin(angle);\n } else if (a_index == 1.0) {\n offsetX = (offset.x + halfSize.x) * cos(angle) + (offset.y - halfSize.y) * sin(angle);\n offsetY = (offset.y - halfSize.y) * cos(angle) - (offset.x + halfSize.x) * sin(angle);\n } else if (a_index == 2.0) {\n offsetX = (offset.x + halfSize.x) * cos(angle) + (offset.y + halfSize.y) * sin(angle);\n offsetY = (offset.y + halfSize.y) * cos(angle) - (offset.x + halfSize.x) * sin(angle);\n } else {\n offsetX = (offset.x - halfSize.x) * cos(angle) + (offset.y + halfSize.y) * sin(angle);\n offsetY = (offset.y + halfSize.y) * cos(angle) - (offset.x - halfSize.x) * sin(angle);\n }\n vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n vec4 texCoord = "+this.texCoordExpression+";\n float u = a_index == 0.0 || a_index == 3.0 ? texCoord.s : texCoord.p;\n float v = a_index == 2.0 || a_index == 3.0 ? texCoord.t : texCoord.q;\n v_texCoord = vec2(u, v);\n u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;\n v = a_index == 2.0 || a_index == 3.0 ? 0.0 : 1.0;\n v_quadCoord = vec2(u, v);\n"+n.map((function(t){return" "+t.name+" = "+t.expression+";"})).join("\n")+"\n}"},t.prototype.getSymbolFragmentShader=function(t){var e=t?" if (gl_FragColor.a < 0.1) { discard; } gl_FragColor = v_hitColor;":"",r=this.varyings;return t&&(r=r.concat({name:"v_hitColor",type:"vec4",expression:"a_hitColor"})),"precision mediump float;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\n"+this.uniforms.map((function(t){return"uniform "+t+";"})).join("\n")+"\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\n"+r.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")+"\nvoid main(void) {\n if ("+this.discardExpression+") { discard; }\n gl_FragColor = "+this.colorExpression+";\n gl_FragColor.rgb *= gl_FragColor.a;\n"+e+"\n}"},t}();var Wv=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Yv=function(t){function e(e){var r=this,n=m({},e);return(r=t.call(this,n)||this).parseResult_=function(t){var e=t.symbol,r=void 0!==e.size?e.size:1,n=e.color||"white",i=e.textureCoord||[0,0,1,1],o=e.offset||[0,0],a=void 0!==e.opacity?e.opacity:1,s=void 0!==e.rotation?e.rotation:0,l={inFragmentShader:!1,variables:[],attributes:[],stringLiteralsMap:{},functions:{}},u=Fv(l,r,Sv|vv),h=Fv(l,o,Sv),c=Fv(l,i,Sv),p=Fv(l,s,vv),f={inFragmentShader:!0,variables:l.variables,attributes:[],stringLiteralsMap:l.stringLiteralsMap,functions:{}},d=Fv(f,n,xv),g=Fv(f,a,vv),_="1.0",y="vec2("+Fv(f,r,Sv|vv)+").x";switch(e.symbolType){case"square":case"image":break;case"circle":_="(1.0-smoothstep(1.-4./"+y+",1.,dot(v_quadCoord-.5,v_quadCoord-.5)*4.))";break;case"triangle":var v="(v_quadCoord*2.-1.)",m="(atan("+v+".x,"+v+".y))";_="(1.0-smoothstep(.5-3./"+y+",.5,cos(floor(.5+"+m+"/2.094395102)*2.094395102-"+m+")*length("+v+")))";break;default:throw new Error("Unexpected symbol type: "+e.symbolType)}var x=(new Xv).setSizeExpression("vec2("+u+")").setRotationExpression(p).setSymbolOffsetExpression(h).setTextureCoordinateExpression(c).setSymbolRotateWithView(!!e.rotateWithView).setColorExpression("vec4("+d+".rgb, "+d+".a * "+g+" * "+_+")");if(t.filter){var w=Fv(f,t.filter,wv);x.setFragmentDiscardExpression("!"+w)}var S={};if(f.variables.forEach((function(e){var r=Bv(e);x.addUniform("float "+r),S[r]=function(){if(!t.variables||void 0===t.variables[e])throw new Error("The following variable is missing from the style: "+e);var r=t.variables[e];return"string"==typeof r&&(r=Ov(l,r)),void 0!==r?r:-9999999}})),"image"===e.symbolType&&e.src){var C=new Image;C.src=e.src,x.addUniform("sampler2D u_texture").setColorExpression(x.getColorExpression()+" * texture2D(u_texture, v_texCoord)"),S.u_texture=C}return f.attributes.forEach((function(t){-1===l.attributes.indexOf(t)&&l.attributes.push(t),x.addVarying("v_"+t,"float","a_"+t)})),l.attributes.forEach((function(t){x.addAttribute("float a_"+t)})),{builder:x,attributes:l.attributes.map((function(t){return{name:t,callback:function(e,r){var n=r[t];return"string"==typeof n&&(n=Ov(l,n)),void 0!==n?n:-9999999}}})),uniforms:S}}(e.style),r.hitDetectionDisabled_=!!e.disableHitDetection,r}return Wv(e,t),e.prototype.createRenderer=function(){return new k_(this,{vertexShader:this.parseResult_.builder.getSymbolVertexShader(),fragmentShader:this.parseResult_.builder.getSymbolFragmentShader(),hitVertexShader:!this.hitDetectionDisabled_&&this.parseResult_.builder.getSymbolVertexShader(!0),hitFragmentShader:!this.hitDetectionDisabled_&&this.parseResult_.builder.getSymbolFragmentShader(!0),uniforms:this.parseResult_.uniforms,attributes:this.parseResult_.attributes})},e}(Oo),Kv=Yv,Zv=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var Hv=function(t){function e(e){var r=this,i=void 0!==e.hidpi&&e.hidpi,o=void 0===e.imageSmoothing||e.imageSmoothing;return void 0!==e.interpolate&&(o=e.interpolate),(r=t.call(this,{cacheSize:e.cacheSize,crossOrigin:"anonymous",interpolate:o,opaque:!0,projection:Er("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:Co,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:i?2:1,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition,zDirection:e.zDirection})||this).hidpi_=i,r.culture_=void 0!==e.culture?e.culture:"en-us",r.maxZoom_=void 0!==e.maxZoom?e.maxZoom:-1,r.apiKey_=e.key,r.imagerySet_=e.imagerySet,function(t,e,r,i){var o=document.createElement("script"),a="olc_"+n(e);function s(){delete window[a],o.parentNode.removeChild(o)}o.async=!0,o.src=t+(-1==t.indexOf("?")?"?":"&")+(i||"callback")+"="+a;var l=setTimeout((function(){s(),r&&r()}),1e4);window[a]=function(t){clearTimeout(l),s(),e(t)},document.getElementsByTagName("head")[0].appendChild(o)}("https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+r.imagerySet_+"?uriScheme=https&include=ImageryProviders&key="+r.apiKey_+"&c="+r.culture_,r.handleImageryMetadataResponse.bind(r),void 0,"jsonp"),r}return Zv(e,t),e.prototype.getApiKey=function(){return this.apiKey_},e.prototype.getImagerySet=function(){return this.imagerySet_},e.prototype.handleImageryMetadataResponse=function(t){if(200==t.statusCode&&"OK"==t.statusDescription&&"ValidCredentials"==t.authenticationResultCode&&1==t.resourceSets.length&&1==t.resourceSets[0].resources.length){var e=t.resourceSets[0].resources[0],r=-1==this.maxZoom_?e.zoomMax:this.maxZoom_,n=Sy(this.getProjection()),i=this.hidpi_?2:1,o=e.imageWidth==e.imageHeight?e.imageWidth/i:[e.imageWidth/i,e.imageHeight/i],a=my({extent:n,minZoom:e.zoomMin,maxZoom:r,tileSize:o});this.tileGrid=a;var s=this.culture_,l=this.hidpi_;if(this.tileUrlFunction=Py(e.imageUrlSubdomains.map((function(t){var r=[0,0,0],n=e.imageUrl.replace("{subdomain}",t).replace("{culture}",s);return function(t,e,i){if(t){op(t[0],t[1],t[2],r);var o=n;return l&&(o+="&dpi=d1&device=mobile"),o.replace("{quadkey}",function(t){var e,r,n=t[0],i=new Array(n),o=1<>=1;return i.join("")}(r))}}}))),e.imageryProviders){var u=Or(Er("EPSG:4326"),this.getProjection());this.setAttributions(function(t){var r=[],n=t.viewState,i=this.getTileGrid(),o=i.getZForResolution(n.resolution,this.zDirection),a=i.getTileCoordForCoordAndZ(n.center,o)[0];return e.imageryProviders.map((function(e){for(var n=!1,i=e.coverageAreas,o=0,s=i.length;o=l.zoomMin&&a<=l.zoomMax){var h=l.bbox;if(Re(Oe([h[1],h[0],h[3],h[2]],u),t.extent)){n=!0;break}}}n&&r.push(e.attribution)})),r.push('Terms of Use'),r}.bind(this))}this.setState(Eo)}else this.setState(To)},e}(Yy),qv=Hv,Jv=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Qv=function(t){function e(e){var r=e||{},n=void 0===r.imageSmoothing||r.imageSmoothing;void 0!==r.interpolate&&(n=r.interpolate);var i=void 0!==r.projection?r.projection:"EPSG:3857",o=void 0!==r.tileGrid?r.tileGrid:my({extent:Sy(i),maxResolution:r.maxResolution,maxZoom:r.maxZoom,minZoom:r.minZoom,tileSize:r.tileSize});return t.call(this,{attributions:r.attributions,cacheSize:r.cacheSize,crossOrigin:r.crossOrigin,interpolate:n,opaque:r.opaque,projection:i,reprojectionErrorThreshold:r.reprojectionErrorThreshold,tileGrid:o,tileLoadFunction:r.tileLoadFunction,tilePixelRatio:r.tilePixelRatio,tileUrlFunction:r.tileUrlFunction,url:r.url,urls:r.urls,wrapX:void 0===r.wrapX||r.wrapX,transition:r.transition,attributionsCollapsible:r.attributionsCollapsible,zDirection:r.zDirection})||this}return Jv(e,t),e}(Yy),$v=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),tm=function(t){function e(e,r,n,i,o,a,s){var l=this,u=e.getExtent(),h=r.getExtent(),c=h?Ce(n,h):n,p=Ny(e,r,me(c),i),f=new ky(e,r,c,u,.5*p,i),d=a(f.calculateSourceExtent(),p,o),g=d?qn:ti,_=d?d.getPixelRatio():1;return(l=t.call(this,n,i,_,g)||this).targetProj_=r,l.maxSourceExtent_=u,l.triangulation_=f,l.targetResolution_=i,l.targetExtent_=n,l.sourceImage_=d,l.sourcePixelRatio_=_,l.interpolate_=s,l.canvas_=null,l.sourceListenerKey_=null,l}return $v(e,t),e.prototype.disposeInternal=function(){this.state==Jn&&this.unlistenSource_(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.canvas_},e.prototype.getProjection=function(){return this.targetProj_},e.prototype.reproject_=function(){var t=this.sourceImage_.getState();if(t==Qn){var e=be(this.targetExtent_)/this.targetResolution_,r=Se(this.targetExtent_)/this.targetResolution_;this.canvas_=By(e,r,this.sourcePixelRatio_,this.sourceImage_.getResolution(),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_)}this.state=t,this.changed()},e.prototype.load=function(){if(this.state==qn){this.state=Jn,this.changed();var t=this.sourceImage_.getState();t==Qn||t==$n?this.reproject_():(this.sourceListenerKey_=N(this.sourceImage_,T,(function(t){var e=this.sourceImage_.getState();e!=Qn&&e!=$n||(this.unlistenSource_(),this.reproject_())}),this),this.sourceImage_.load())}},e.prototype.unlistenSource_=function(){z(this.sourceListenerKey_),this.sourceListenerKey_=null},e}(hs),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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),rm="imageloadstart",nm="imageloadend",im="imageloaderror",om=function(t){function e(e,r){var n=t.call(this,e)||this;return n.image=r,n}return em(e,t),e}(s);function am(t,e){t.getImage().src=e}var sm=function(t){function r(e){var r=this,n=void 0===e.imageSmoothing||e.imageSmoothing;return void 0!==e.interpolate&&(n=e.interpolate),(r=t.call(this,{attributions:e.attributions,projection:e.projection,state:e.state,interpolate:n})||this).on,r.once,r.un,r.resolutions_=void 0!==e.resolutions?e.resolutions:null,r.reprojectedImage_=null,r.reprojectedRevision_=0,r}return em(r,t),r.prototype.getResolutions=function(){return this.resolutions_},r.prototype.findNearestResolution=function(t){if(this.resolutions_){var e=p(this.resolutions_,t,0);t=this.resolutions_[e]}return t},r.prototype.getImage=function(t,e,r,n){var i=this.getProjection();if(i&&n&&!Pr(i,n)){if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Pr(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&he(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new tm(i,n,t,e,r,function(t,e,r){return this.getImageInternal(t,e,r,i)}.bind(this),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}return i&&(n=i),this.getImageInternal(t,e,r,n)},r.prototype.getImageInternal=function(t,r,n,i){return e()},r.prototype.handleImageChange=function(t){var e=t.target;switch(e.getState()){case Jn:this.loading=!0,this.dispatchEvent(new om(rm,e));break;case Qn:this.loading=!1,this.dispatchEvent(new om(nm,e));break;case $n:this.loading=!1,this.dispatchEvent(new om(im,e))}},r}(js);function lm(t,e){var r=[];Object.keys(e).forEach((function(t){null!==e[t]&&void 0!==e[t]&&r.push(t+"="+encodeURIComponent(e[t]))}));var n=r.join("&");return(t=-1===(t=t.replace(/[?&]$/,"")).indexOf("?")?t+"?":t+"&")+n}var um="1.3.0",hm="carmentaserver",cm="geoserver",pm="mapserver",fm="qgis",dm=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),gm=[101,101],_m=function(t){function e(e){var r=this,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;return void 0!==n.interpolate&&(i=n.interpolate),(r=t.call(this,{attributions:n.attributions,interpolate:i,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:am,r.params_=n.params||{},r.v13_=!0,r.updateV13_(),r.serverType_=n.serverType,r.hidpi_=void 0===n.hidpi||n.hidpi,r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return dm(e,t),e.prototype.getFeatureInfoUrl=function(t,e,r,n){if(void 0!==this.url_){var i=Er(r),o=this.getProjection();o&&o!==i&&(e=Ny(o,i,t,e),t=Ir(t,i,o));var a=we(t,e,0,gm),s={SERVICE:"WMS",VERSION:um,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};m(s,this.params_,n);var l=Ue((t[0]-a[0])/e,4),u=Ue((a[3]-t[1])/e,4);return s[this.v13_?"I":"X"]=l,s[this.v13_?"J":"Y"]=u,this.getRequestUrl_(a,gm,1,o||i,s)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.url_){var r={SERVICE:"WMS",VERSION:um,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var n=this.params_.LAYERS;if(!(!Array.isArray(n)||1===n.length))return;r.LAYER=n}if(void 0!==t){var i=this.getProjection()?this.getProjection().getMetersPerUnit():1;r.SCALE=t*i/28e-5}return m(r,e),lm(this.url_,r)}},e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),1==r||this.hidpi_&&void 0!==this.serverType_||(r=1);var i=e/r,o=me(t),a=we(o,i,0,[Ve(be(t)/i,4),Ve(Se(t)/i,4)]),s=we(o,i,0,[Ve(this.ratio_*be(t)/i,4),Ve(this.ratio_*Se(t)/i,4)]),l=this.image_;if(l&&this.renderedRevision_==this.getRevision()&&l.getResolution()==e&&l.getPixelRatio()==r&&re(l.getExtent(),a))return l;var u={SERVICE:"WMS",VERSION:um,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};m(u,this.params_),this.imageSize_[0]=ze(be(s)/i,4),this.imageSize_[1]=ze(Se(s)/i,4);var h=this.getRequestUrl_(s,this.imageSize_,r,n,u);return this.image_=new fs(s,e,r,h,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(T,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){if(nt(void 0!==this.url_,9),i[this.v13_?"CRS":"SRS"]=n.getCode(),"STYLES"in this.params_||(i.STYLES=""),1!=r)switch(this.serverType_){case cm:var o=90*r+.5|0;"FORMAT_OPTIONS"in i?i.FORMAT_OPTIONS+=";dpi:"+o:i.FORMAT_OPTIONS="dpi:"+o;break;case pm:i.MAP_RESOLUTION=90*r;break;case hm:case fm:i.DPI=90*r;break;default:nt(!1,8)}i.WIDTH=e[0],i.HEIGHT=e[1];var a,s=n.getAxisOrientation();return a=this.v13_&&"ne"==s.substr(0,2)?[t[1],t[0],t[3],t[2]]:t,i.BBOX=a.join(","),lm(this.url_,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){m(this.params_,t),this.updateV13_(),this.image_=null,this.changed()},e.prototype.updateV13_=function(){var t=this.params_.VERSION||um;this.v13_=fr(t,"1.3")>=0},e}(sm),ym=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),vm=function(t){function e(e){var r,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;void 0!==n.interpolate&&(i=n.interpolate),r=void 0!==n.attributions?n.attributions:['© OpenStreetMap contributors.'];var o=void 0!==n.crossOrigin?n.crossOrigin:"anonymous",a=void 0!==n.url?n.url:"https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png";return t.call(this,{attributions:r,attributionsCollapsible:!1,cacheSize:n.cacheSize,crossOrigin:o,interpolate:i,maxZoom:void 0!==n.maxZoom?n.maxZoom:19,opaque:void 0===n.opaque||n.opaque,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileLoadFunction:n.tileLoadFunction,transition:n.transition,url:a,wrapX:n.wrapX,zDirection:n.zDirection})||this}return ym(e,t),e}(Qv),mm=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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xm=function(t){function e(e){var r=this,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;void 0!==n.interpolate&&(i=n.interpolate);var o=n.params||{},a=!("TRANSPARENT"in o)||o.TRANSPARENT;return(r=t.call(this,{attributions:n.attributions,attributionsCollapsible:n.attributionsCollapsible,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,interpolate:i,opaque:!a,projection:n.projection,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileClass:n.tileClass,tileGrid:n.tileGrid,tileLoadFunction:n.tileLoadFunction,url:n.url,urls:n.urls,wrapX:void 0===n.wrapX||n.wrapX,transition:n.transition,zDirection:n.zDirection})||this).gutter_=void 0!==n.gutter?n.gutter:0,r.params_=o,r.v13_=!0,r.serverType_=n.serverType,r.hidpi_=void 0===n.hidpi||n.hidpi,r.tmpExtent_=[1/0,1/0,-1/0,-1/0],r.updateV13_(),r.setKey(r.getKeyForParams_()),r}return mm(e,t),e.prototype.getFeatureInfoUrl=function(t,e,r,n){var i=Er(r),o=this.getProjection(),a=this.getTileGrid();a||(a=this.getTileGridForProjection(i));var s=a.getZForResolution(e,this.zDirection),l=a.getTileCoordForCoordAndZ(t,s);if(!(a.getResolutions().length<=l[0])){var u=a.getResolution(l[0]),h=a.getTileCoordExtent(l,this.tmpExtent_),c=ii(a.getTileSize(l[0]),this.tmpSize),p=this.gutter_;0!==p&&(c=ei(c,p,this.tmpSize),h=Qt(h,u*p,h)),o&&o!==i&&(u=Ny(o,i,t,u),h=function(t,e,r,n){return Oe(t,Fr(e,r),void 0,n)}(h,i,o),t=Ir(t,i,o));var f={SERVICE:"WMS",VERSION:um,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};m(f,this.params_,n);var d=Math.floor((t[0]-h[0])/u),g=Math.floor((h[3]-t[1])/u);return f[this.v13_?"I":"X"]=d,f[this.v13_?"J":"Y"]=g,this.getRequestUrl_(l,c,h,1,o||i,f)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.urls[0]){var r={SERVICE:"WMS",VERSION:um,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var n=this.params_.LAYERS;if(!(!Array.isArray(n)||1===n.length))return;r.LAYER=n}if(void 0!==t){var i=this.getProjection()?this.getProjection().getMetersPerUnit():1;r.SCALE=t*i/28e-5}return m(r,e),lm(this.urls[0],r)}},e.prototype.getGutter=function(){return this.gutter_},e.prototype.getParams=function(){return this.params_},e.prototype.getRequestUrl_=function(t,e,r,n,i,o){var a=this.urls;if(a){if(o.WIDTH=e[0],o.HEIGHT=e[1],o[this.v13_?"CRS":"SRS"]=i.getCode(),"STYLES"in this.params_||(o.STYLES=""),1!=n)switch(this.serverType_){case cm:var s=90*n+.5|0;"FORMAT_OPTIONS"in o?o.FORMAT_OPTIONS+=";dpi:"+s:o.FORMAT_OPTIONS="dpi:"+s;break;case pm:o.MAP_RESOLUTION=90*n;break;case hm:case fm:o.DPI=90*n;break;default:nt(!1,52)}var l,u=i.getAxisOrientation(),h=r;if(this.v13_&&"ne"==u.substr(0,2)){var c=void 0;c=r[0],h[0]=r[1],h[1]=c,c=r[2],h[2]=r[3],h[3]=c}if(o.BBOX=h.join(","),1==a.length)l=a[0];else l=a[Ge(up(t),a.length)];return lm(l,o)}},e.prototype.getTilePixelRatio=function(t){return this.hidpi_&&void 0!==this.serverType_?t:1},e.prototype.getKeyForParams_=function(){var t=0,e=[];for(var r in this.params_)e[t++]=r+"-"+this.params_[r];return e.join("/")},e.prototype.updateParams=function(t){m(this.params_,t),this.updateV13_(),this.setKey(this.getKeyForParams_())},e.prototype.updateV13_=function(){var t=this.params_.VERSION||um;this.v13_=fr(t,"1.3")>=0},e.prototype.tileUrlFunction=function(t,e,r){var n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(r)),!(n.getResolutions().length<=t[0])){1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);var i=n.getResolution(t[0]),o=n.getTileCoordExtent(t,this.tmpExtent_),a=ii(n.getTileSize(t[0]),this.tmpSize),s=this.gutter_;0!==s&&(a=ei(a,s,this.tmpSize),o=Qt(o,i*s,o)),1!=e&&(a=ni(a,e,this.tmpSize));var l={SERVICE:"WMS",VERSION:um,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return m(l,this.params_),this.getRequestUrl_(t,a,o,e,r,l)}},e}(Yy),wm=xm;W.unByKey=X;let Sm={Control:gu,Zoom:Eu,Attribution:mu,ScaleLine:Du,LayerSwitcher:Pp},Cm={GeoJSON:Up,KML:wg,MVT:$g},Em={Group:bl,Tile:Jy,Vector:Ms,VectorTile:cy,WebGLPoints:Kv,Heatmap:U_,Image:q_},Tm={toLonLat:function(t,e){var r=Ir(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),n=r[0];return(n<-180||n>180)&&(r[0]=Ge(n+180,360)-180),r},fromLonLat:function(t,e){return Ir(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}},bm={LineString:Zn,Point:mn,MultiPoint:tc},Rm={Icon:ms,Style:io,Text:lo,Stroke:Hn,Fill:Un,Circle:Qi},Pm={OSM:vm,XYZ:Qv,TileWMS:wm,BingMaps:qv,Vector:tl,VectorTile:My,ImageWMS:_m};t.Collection=rt,t.Feature=at,t.Map=np,t.Observable=W,t.View=lu,t.control=Sm,t.format=Cm,t.geom=bm,t.interaction=ep,t.layer=Em,t.proj=Tm,t.source=Pm,t.sphere=pr,t.style=Rm,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=ol-custom.js.map