O&&(this.fill_(t),M=0),L>O&&(t.stroke(),L=0),M||L||(t.beginPath(),y=NaN,x=NaN),++d;break;case hp.CIRCLE:b=i[1];const n=h[b],c=h[b+1],u=h[b+2]-n,g=h[b+3]-c,z=Math.sqrt(u*u+g*g);t.moveTo(n+z,c),t.arc(n,c,z,0,2*Math.PI,!0),++d;break;case hp.CLOSE_PATH:t.closePath(),++d;break;case hp.CUSTOM:b=i[1],p=i[2];const j=i[3],W=i[4],V=i[5];F.geometry=j,F.feature=D,d in I||(I[d]=[]);const B=I[d];V?V(h,b,p,2,B):(B[0]=h[b],B[1]=h[b+1],B.length=2),l&&(l.zIndex=i[6]),W(B,F),++d;break;case hp.DRAW_IMAGE:b=i[1],p=i[2],w=i[3],f=i[4],m=i[5];let Z=i[6];const X=i[7],U=i[8],K=i[9],H=i[10];let q=i[11];const $=i[12];let J=i[13];_=i[14]||"declutter";const Q=i[15];if(!w&&i.length>=20){C=i[19],E=i[20],R=i[21],T=i[22];const t=this.drawLabelWithPointPlacement_(C,E,R,T);w=t.label,i[3]=w;const e=i[23];f=(t.anchorX-e)*this.pixelRatio,i[4]=f;const n=i[24];m=(t.anchorY-n)*this.pixelRatio,i[5]=m,Z=w.height,i[6]=Z,J=w.width,i[13]=J}let tt,et,it,nt;i.length>25&&(tt=i[25]),i.length>17?(et=i[16],it=i[17],nt=i[18]):(et=ln,it=null,nt=null),H&&A?q+=P:H||A||(q-=P);let st=0;for(;b!Pp.includes(t)),Fp={},Op=class{constructor(t,e,i,n,s,r,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=r,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,o)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const s=t[i];for(const t in s){const i=s[t];n[t]=new Lp(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,n=t.length;ei)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+s)*e+(t+r))+3),s>0&&a.push(4*((t-s)*e+(t+r))+3),r>0&&(a.push(4*((t+s)*e+(t-r))+3),s>0&&a.push(4*((t-s)*e+(t-r))+3))}const s=[];for(let t=0,e=n.length;t0){if(!r||"none"===i||"Image"!==g&&"Text"!==g||r.includes(t)){const i=(d[l]-3)/4,r=n-i%o,a=n-(i/o|0),h=s(t,e,r*r+a*a);if(h)return h}h.clearRect(0,0,o,o);break}}const f=Object.keys(this.executorsByZIndex_).map(Number);let m,_,y,x,v;for(f.sort(mi),m=f.length-1;m>=0;--m){const t=f[m].toString();for(y=this.executorsByZIndex_[t],_=Ip.length-1;_>=0;--_)if(g=Ip[_],x=y[g],void 0!==x&&(v=x.executeHitDetection(h,a,i,p,c),v))return v}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],s=e[2],r=e[3],o=[i,n,i,r,s,r,s,n];return hs(o,0,8,2,t,o),o}isEmpty(){return bi(this.executorsByZIndex_)}execute(t,e,i,n,s,r,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?_i:mi),r=r||Ip;const l=Ip.length;for(let h=0,c=a.length;hg.execute(t,e,i,n,s,o)):g.execute(c,e,i,n,s,o),u&&c.restore(),r){r.offset();const t=a[h]*l+Ip.indexOf(d);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(r)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(mi);for(let i=0,n=e.length;i{t.draw(this.renderedContext_),t.clear()}),t[e[i]].length=0}},Dp=class extends np{constructor(t,e,i,n,s,r,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?J(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=r,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=[1,0,0,1,0,0]}drawImages_(t,e,i,n){if(!this.image_)return;const s=hs(t,e,i,n,this.transform_,this.pixelCoordinates_),r=this.context_,o=this.tmpLocalTransform_,a=r.globalAlpha;1!=this.imageOpacity_&&(r.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=s.length;tt*this.pixelRatio_),lineDashOffset:(s||0)*this.pixelRatio_,lineJoin:void 0!==r?r:sn,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:zi(t||rn)}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),s=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const r=t.getScaleArray();this.imageScale_=[r[0]*this.pixelRatio_/i,r[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:zi(t||tn)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),s=i.getLineDashOffset(),r=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:en,lineDash:n||nn,lineDashOffset:s||0,lineJoin:void 0!==r?r:sn,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:zi(t||rn)}}else this.textStrokeState_=null;const n=t.getFont(),s=t.getOffsetX(),r=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),h=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==n?n:Qi,textAlign:void 0!==c?c:on,textBaseline:void 0!==u?u:an},this.text_=void 0!==h?Array.isArray(h)?h.reduce((t,e,i)=>t+(i%2?" ":e),""):h:"",this.textOffsetX_=void 0!==s?this.pixelRatio_*s:0,this.textOffsetY_=void 0!==r?this.pixelRatio_*r:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}},kp=.5;function Gp(t,e,i,n,s,r,o,a,l){const h=l?ye(s):s,c=Oe(t[0]*kp,t[1]*kp);c.imageSmoothingEnabled=!1;const u=c.canvas,d=new Dp(c,kp,s,null,o,a,l?he(fe(),l):null),g=i.length,p=Math.floor(16777215/g),f={};for(let t=1;t<=g;++t){const e=i[t-1],s=e.getStyleFunction()||n;if(!s)continue;let o=s(e,r);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*p).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;t0;return u&&Promise.all(l).then(()=>s(null)),function(t,e,i,n,s,r,o){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,s);i.getRenderer()?Bp(t,l,i,e,o):(0,zp[l.getType()])(t,l,i,e,o,r)}(t,e,i,n,r,o,a),u}function Bp(t,e,i,n,s){if("GeometryCollection"==e.getType()){const r=e.getGeometries();for(let e=0,o=r.length;e{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,s=this.renderedProjection_,r=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*kp,h=t[1]*kp;a.push(this.getRenderTransform(e,i,n,kp,l,h,0).slice());const c=o.getSource(),u=s.getExtent();if(c.getWrapX()&&s.canWrapX()&&!f(u,r)){let t=r[0];const s=z(u);let o,c=0;for(;tu[2];)++c,o=s*c,a.push(this.getRenderTransform(e,i,n,kp,l,h,o).slice()),t-=s}const d=fe();this.hitDetectionImageData_=Gp(t,a,this.renderedFeatures_,o.getStyleFunction(),r,i,n,jp(i,this.renderedPixelRatio_),d?s:null)}e(Np(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,s){if(!this.replayGroup_)return;const r=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={},c=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,r,a,i,function(t,e,i){const r=o(t),a=h[r];if(a){if(!0!==a&&it.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[0],s=t.viewHints[1],r=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!r&&n||!o&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,c=l.resolution,d=t.pixelRatio,g=e.getRevision(),p=e.getRenderBuffer();let m=e.getRenderOrder();void 0===m&&(m=Yp);const _=l.center.slice(),y=u(a,p*c),x=y.slice(),v=[y.slice()],S=h.getExtent();if(i.getWrapX()&&h.canWrapX()&&!f(S,t.extent)){const t=z(S),e=Math.max(z(y)/2,t);y[0]=S[0]-e,y[2]=S[2]+e,lt(_,h);const i=V(v[0],h);i[0]S[0]&&i[2]>S[2]&&v.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedRevision_==g&&this.renderedRenderOrder_==m&&this.renderedFrameDeclutter_===!!t.declutter&&f(this.wrappedRenderedExtent_,y))return Si(this.renderedExtent_,x)||(this.hitDetectionImageData_=null,this.renderedExtent_=x),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const w=new _p(Wp(c,d),y,c,d),C=fe();let E;if(C){for(let t=0,e=v.length;t{let n;const s=t.getStyleFunction()||e.getStyleFunction();if(s&&(n=s(t,c)),n){const e=this.renderFeature(t,R,n,w,E,this.getLayer().getDeclutter(),i);T=T&&!e}},M=ye(y),L=i.getFeaturesInExtent(M);m&&L.sort(m);for(let t=0,e=L.length;t=200&&a.status<300){const t=e.getType();try{let n;"text"==t||"json"==t?n=a.responseText:"xml"==t?n=a.responseXML||a.responseText:"arraybuffer"==t&&(n=a.response),n?r(e.readFeatures(n,{extent:i,featureProjection:s}),e.readProjection(n)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function Kp(t,e){return function(i,n,s,r,o){Up(t,e,i,n,s,(t,e)=>{this.addFeatures(t),void 0!==r&&r(t)},()=>{this.changed(),void 0!==o&&o()})}}function Hp(t,e){return[[-1/0,-1/0,1/0,1/0]]}const qp=[1,0,0,1,0,0];class $p{constructor(t,e,i,n,s,r){this.styleFunction,this.extent_,this.id_=r,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=s,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?v(this.flatCoordinates_):S(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=P(this.getExtent());this.flatInteriorPoints_=Ys(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=$s(this.flatCoordinates_,this.ends_),e=qu(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=js(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=ju(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let n=0,s=i.length;n{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=Ms(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=Ls(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=As(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new $p(this.type_,i,n,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}$p.prototype.getFlatCoordinates=$p.prototype.getOrientedFlatCoordinates;const Jp=$p,Qp=class{constructor(t){this.rbush_=new Go(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[o(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,s=e.length;n{e||(e=!0,this.addFeature(t.element),e=!1)}),t.addEventListener(ur,t=>{e||(e=!0,this.removeFeature(t.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_)this.featureChangeKeys_[t].forEach(Ai);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(t=>{this.removeFeatureInternal(t)});for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new nf("clear");this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(i){const n=i.getGeometry();if(n instanceof Jp||n.intersectsCoordinate(t))return e(i)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){const n=i.getGeometry();if(n instanceof Jp||n.intersectsExtent(t)){const t=e(i);if(t)return t}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),bi(this.nullGeometryFeatures_)||vi(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(t){e.push(t)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const i=B(t,e);return[].concat(...i.map(t=>this.featuresRtree_.getInExtent(t)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let s=null;const r=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||wi,this.featuresRtree_.forEachInExtent(a,function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof Jp?0:e.closestPointXY(i,n,r,o),o{--this.loadingExtentsCount_,this.dispatchEvent(new nf("featuresloadend",void 0,t))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new nf("featuresloaderror"))}),n.insert(r,{extent:r.slice()}))}this.loading=!(this.loader_.length<4)&&this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=e.forEachInExtent(t,function(e){if(w(e.extent,t))return e});i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,n=t.length;it.getMaxZoom()&&(l=t.getMaxZoom()),t.moveTo([a[0],a[1]],l,r)}else t.zoomToExtent(a,r)}t.selectFeature(o)}}else t.selectFeature(null)},getSelectedFeaturePos:function(){return t.getSelectedFeaturePos()},getSelectedFeatureProps:function(e){var i=t.getSelectedFeatureProps(e);return i&&i.id&&(i=this.getFeaturePropsByID(i.id)),i},featureHasPos:function(t){var e=f.getSource().getFeatureById(t);if(e&&e.getGeometry()&&e.getGeometry().getExtent()){var i=e.getGeometry().getExtent();return 0!=i[0]||0!=i[1]}return!1},setFeatureSelected:function(t,e){var i=f.getSource().getFeatureById(t);i&&i.setSelected(e)},setFeatureVisible:function(t,e){void 0===e&&(e=!0);var i=f.getSource().getFeatureById(t);i&&i.setVisible(e)},setFeatureSelectable:function(t,e){var i=f.getSource().getFeatureById(t);i&&i.setSelectable(e)},zoomToFeatureBounds:function(e,i){i=null==i?500:i;var n=f.getSource().getFeatureById(e);if(n){var s=n.getGeometry().getExtent();t.zoomToExtent(s,i)}},getMapOptions:function(t){var e=f.getSource().getFeatureById(t);return e?e.getMapOptions():null},setMapOptions:function(t,e){var i=f.getSource().getFeatureById(t);i&&i.setMapOptions(e)},redraw:function(){f.changed()},getAttribution:function(t){return f.getSource().getAttributions()},setAttribution:function(t){f.getSource().setAttributions([t])},setToolTipFunction:function(t){m=t},getToolTipFunction:function(){return m},setAssociatedLayer:function(t){y=t},getAssociatedLayer:function(){return y},associateWithLayer:function(t){y=t,t.setAssociatedLayer(v)},setVisible:function(t){f.setVisible(t)},set:function(t,e,i){f.set(t,e,i)},drawMostRelevant:function(e,i,s){if(0!=v.size()){var r=n().maps.Style.scaleLabelSize(i,t.getZoom()),o=t.getSize()[0],a=t.getSize()[1],l=Math.ceil(o/(28*r)),h=Math.ceil(a/(9*r)),c=t.getBounds();if(c){var u=c[0],g=c[1],p=c[2],m=c[3];u>p&&(Math.abs(u)>Math.abs(p)?u=-20037508.34:p=20037508.34);var _=v.getBounds(),y=_[0],x=_[1],S=_[2]+1,w=_[3]+1;if(y>u||SC&&(l=Math.ceil(o*(N-C)/(p-u)/(28*r))),u=C,p=N}(x>g||wC&&(h=Math.ceil(a*(N-C)/(m-g)/(9*r))),g=C,m=N);for(var E=(p-u)/(l-1e-4),R=(m-g)/(h-1e-4),T=new Array(l),b=0;b=0;b--){var P=f.array[b].getBounds(),A=Math.floor((P[0]-u)/E),F=Math.floor((P[1]-g)/R);A>=0&&F>=0&&A2){var D=T[b][M].getBounds(),k=2,G=[];if((D[2]-D[0])*(D[3]-D[1])k;){var N;(N=T[b][M][T[b][M].length-1]).isSelected()?(G.push(T[b][M].pop()),k--):I.push(T[b][M].pop())}if(G.length>0)for(var z=0;z0)for(b=0;b(i.maxViz?i.maxViz:13)?null:t<=2?"R2":t<=4?"R4":t<=6?"R6":t<=8?"R8":t<=10?"R10":"R12"}:function(t,e){return e?t<=(i.minViz?i.minViz:2)?null:t<=4?"R5":t<=6?"R4":t<=8?"R3":t<=9?"R2":t<=(i.maxViz?i.maxViz:13)?"R1":null:null};function y(){if(!n().isBot()){var e=t.getBounds(),s=t.getZoom(),o=_(s,g);r&&r(o);var a=l;if(l!=o&&(o&&u[o].setVisible(!0),l=o),o){for(var d=i.useFb?i.fbdist[o]:i.dist[o],p=ge(e,t.getProj(),i.proj),f=Math.floor(p[0]/d),m=Math.floor(p[1]/d),y=Math.floor(p[2]/d),v=Math.floor(p[3]/d),S=[],w=[],C=Date.now(),E=p[0],R=!1,T=f;T<=y;T++){var b=T;b*d>=180&&(R||(E=-E,T--,y++,R=!0),b=Math.floor(E/d),b++);for(var M=m;M<=v;M++)h[o][b+"_"+M]||c[o][b+"_"+M]&&!(C-c[o][b+"_"+M]>5e3)||(c[o][b+"_"+M]=C,S.push(b),w.push(M),S.length>=i.maxReq&&(x(o,S,w),S=[],w=[]));E+=d}S.length>0&&x(o,S,w)}a!=l&&a&&setTimeout(function(){a!=l&&u[a].setVisible(!1)},i.vizDelay)}}function x(t,s,r){if(i.useFb)return void(n().fbdb&&function(t,s,r){let o=[],a={};for(let t=0;t0){let e={objs:[],res:1e4};s.forEach(function(n){let s=null,r=n.data().c;for(let t=0;t0&&(i.tiles[e].res=i.res,u[t].addData(i.tiles[e]),o&&o(u[t]),u[t].redraw()),h[t][i.tiles[e].xi+"_"+i.tiles[e].yi]=!0}).fail(function(){n().log("cp.GridLayer.requestTiles: error for "+e+t+" at "+l+"/"+c)})}var v={start:function(){g=!0,p?y():(p=!0,y(),t.onViewChangeEnd?t.onViewChangeEnd(y):t.onViewChange(y))},setVisible:function(t){g=t,p&&y()},setMode:function(t){var e=i.useFb?i.fbdist:i.dist;for(var n in e)u[n].setMode(t)},setZoomToLevel:function(t){_=t,p&&y()},isGridLayer:!0};return v},n().maps.GridLayer;const rf={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},of={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]},af=class extends Uc{constructor(t,e){super(t,e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=[1,0,0,1,0,0],this.tileClipContexts_=null}drawTile(t,e,i,n,s,r,o,a){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,i,n,s,r,o,a)}getTile(t,e,i,n){const s=this.getOrCreateTile(t,e,i,n);if(!s)return null;const r=n.viewState.resolution,o=n.viewHints;return!(!o[0]&&!o[1])&&s.wantedResolution||(s.wantedResolution=r),s}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const n=this.getLayer(),s=n.getRevision(),r=n.getRenderOrder()||null,a=t.wantedResolution,l=t.getReplayState(n);if(!l.dirty&&l.renderedResolution===a&&l.renderedRevision==s&&l.renderedRenderOrder==r)return;const h=n.getSource(),c=!!n.getDeclutter(),d=h.getTileGrid(),g=h.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),p=h.getSourceTiles(e,i,t),f=o(n);delete t.hitDetectionImageData[f],t.executorGroups[f]=[],l.dirty=!1;for(let i=0,s=p.length;it.value):null;let x;t:for(let e=0,n=f.length;e{const n=this.getLayer(),s=n.getSource(),r=this.renderedProjection,a=r.getExtent(),l=this.renderedResolution,h=s.getTileGridForProjection(r),c=ns(this.renderedPixelToCoordinateTransform_,t.slice()),u=h.getTileCoordForCoordAndResolution(c,l).toString(),d=this.renderedTiles.find(t=>t.tileCoord.toString()===u&&2===t.getState());if(!d||d.loadingSourceTiles>0)return void e([]);s.getWrapX()&&r.canWrapX()&&!f(a,h.getTileCoordExtent(d.tileCoord))&<(c,r);const g=o(n),p=G(h.getTileCoordExtent(d.wrappedTileCoord)),m=[(c[0]-p[0])/l,(p[1]-c[1])/l],_=d.getSourceTiles().reduce((t,e)=>t.concat(e.getFeatures()),[]);let y=d.hitDetectionImageData[g];if(!y){const t=Sn(h.getTileSize(h.getZForResolution(l,s.zDirection))),e=this.renderedRotation_;y=Gp(t,[this.getRenderTransform(h.getTileCoordCenter(d.wrappedTileCoord),l,0,kp,t[0]*kp,t[1]*kp,0)],_,n.getStyleFunction(),h.getTileCoordExtent(d.wrappedTileCoord),d.getReplayState(n).renderedResolution,e),d.hitDetectionImageData[g]=y}e(Np(m,_,y))})}getFeaturesInExtent(t){const e=[],i=this.getTileCache();if(0===i.getCount())return e;const n=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),s=n.getZForResolution(this.renderedResolution),r={};return i.forEach(i=>{if(i.tileCoord[0]!==s||2!==i.getState())return;const o=i.getSourceTiles();for(let i=0,s=o.length;i=0;--e)n[e].execute(this.context,a,this.getTileRenderTransform(i,t),t.viewState.rotation,r,Pp,h)}i.globalAlpha=n}renderDeferredInternal(t){const e=this.renderedTiles,i=o(this.getLayer()),n=e.reduce((t,e,n)=>(e.executorGroups[i].forEach(e=>t.push({executorGroup:e,index:n})),t),[]),s=n.map(({executorGroup:t})=>t.getDeferredZIndexContexts()),r={};for(let t=0,e=n.length;t{s.forEach((e,i)=>{e[t]&&(e[t].forEach(t=>{const{executorGroup:e,index:s}=n[i],r=e.getRenderedContext(),o=r.globalAlpha;r.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[s];a&&a.draw(r),t.draw(r),a&&r.restore(),r.globalAlpha=o,t.clear()}),e[t].length=0)})})}getTileRenderTransform(t,e){const i=e.pixelRatio,n=e.viewState,s=n.center,r=n.resolution,o=n.rotation,a=e.size,l=Math.round(a[0]*i),h=Math.round(a[1]*i),c=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),u=t.tileCoord,d=c.getTileCoordExtent(t.wrappedTileCoord),g=c.getTileCoordExtent(u,this.tempExtent)[0]-d[0];return es(ss(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(s,r,o,i,l,h,g))}postRender(t,e){const i=e.viewHints,n=!(i[0]||i[1]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const s=this.getLayer(),r=s.getRenderMode(),a=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const l=s.getDeclutter(),h=l?of[r].filter(t=>!Pp.includes(t)):of[r],c=e.viewState,u=c.rotation,d=s.getSource(),g=d.getTileGridForProjection(c.projection).getZForResolution(c.resolution,d.zDirection),p=this.renderedTiles,f=[],m=[],_=[],y=o(s);let x=!0;for(let i=p.length-1;i>=0;--i){const r=p[i];x=x&&!r.getReplayState(s).dirty;const o=r.executorGroups[y].filter(t=>t.hasExecutors(h));if(0===o.length)continue;const a=this.getTileRenderTransform(r,e),c=r.tileCoord[0];let d=!1;const v=o[0].getClipCoords(a);let S,w=t;if(v){S=new Nc,w=S.getContext();for(let t=0,e=f.length;t{const s=this.tileUrlFunction(n,t,e);this.sourceTiles_[s]||(this.sourceTiles_[s]=new this.tileClass(n,s?0:4,s,this.format_,this.tileLoadFunction));const r=this.sourceTiles_[s];i.sourceTiles.push(r),this.tileKeysBySourceTileUrl_[s]||(this.tileKeysBySourceTileUrl_[s]=[]),this.tileKeysBySourceTileUrl_[s].push(i.getKey());const o=r.getState();if(o<2){const t=e=>{this.handleTileChange(e);const n=r.getState();if(2===n||3===n){const e=r.getKey();e in i.errorTileKeys?2===r.getState()&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,3===n?i.errorTileKeys[e]=!0:r.removeEventListener(li,t),0===i.loadingSourceTiles&&i.setState(bi(i.errorTileKeys)?2:3)}};r.addEventListener(li,t),i.loadingSourceTiles++}0===o&&(r.extent=l.getTileCoordExtent(n),r.projection=e,r.resolution=l.getResolution(n[0]),r.load())}),i.loadingSourceTiles||i.setState(i.sourceTiles.some(t=>3===t.getState())?3:2)}return i.sourceTiles}removeSourceTiles(t){const e=t.getKey(),i=t.sourceTiles;for(let t=0,n=i.length;t{h=h&&!this.tileUrlFunction(t,n,s)})}const c=new cf(r,h?4:0,o,this.getSourceTiles.bind(this,n,s),this.removeSourceTiles.bind(this));return c.key=this.getKey(),c}getTileGridForProjection(t){const e=t.getCode();let i=this.tileGrids_[e];if(!i){const n=this.getProjection();Te(null===n||le(n,t),"A VectorTile source can only be rendered if it has a projection compatible with the view projection.");const s=this.tileGrid,r=s.getResolutions().slice(),o=r.map(function(t,e){return s.getOrigin(e)}),a=r.map(function(t,e){return s.getTileSize(e)}),l=43;for(let t=r.length;t>3,s=this.pos;this.type=7&i,t(n,e,this),this.pos===s&&this.skip(i)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*pf;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*pf;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let i,n;return n=e[this.pos++],i=127&n,n<128?i:(n=e[this.pos++],i|=(127&n)<<7,n<128?i:(n=e[this.pos++],i|=(127&n)<<14,n<128?i:(n=e[this.pos++],i|=(127&n)<<21,n<128?i:(n=e[this.pos],i|=(15&n)<<28,function(t,e,i){const n=i.buf;let s,r;if(r=n[i.pos++],s=(112&r)>>4,r<128)return yf(t,s,e);if(r=n[i.pos++],s|=(127&r)<<3,r<128)return yf(t,s,e);if(r=n[i.pos++],s|=(127&r)<<10,r<128)return yf(t,s,e);if(r=n[i.pos++],s|=(127&r)<<17,r<128)return yf(t,s,e);if(r=n[i.pos++],s|=(127&r)<<24,r<128)return yf(t,s,e);if(r=n[i.pos++],s|=(1&r)<<31,r<128)return yf(t,s,e);throw new Error("Expected varint not more than 10 bytes")}(i,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&mf?mf.decode(this.buf.subarray(e,t)):function(t,e,i){let n="",s=e;for(;s239?4:e>223?3:e>191?2:1;if(s+h>i)break;1===h?e<128&&(l=e):2===h?(r=t[s+1],128==(192&r)&&(l=(31&e)<<6|63&r,l<=127&&(l=null))):3===h?(r=t[s+1],o=t[s+2],128==(192&r)&&128==(192&o)&&(l=(15&e)<<12|(63&r)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===h&&(r=t[s+1],o=t[s+2],a=t[s+3],128==(192&r)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&r)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,h=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),s+=h}return n}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const i=this.readPackedEnd();for(;this.pos127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e268435455||t<0?function(t,e){let i,n;if(t>=0?(i=t%4294967296|0,n=t/4294967296|0):(i=~(-t%4294967296),n=~(-t/4294967296),4294967295^i?i=i+1|0:(i=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){const i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(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(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,i){for(let n,s,r=0;r55295&&n<57344){if(!s){n>56319||r+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):s=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,s=n;continue}n=s-55296<<10|n-56320|65536,s=null}else s&&(t[i++]=239,t[i++]=191,t[i++]=189,s=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);const i=this.pos-e;i>=128&&xf(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let i=0;i=128&&xf(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(t,e,i){this.writeTag(t,2),this.writeRawMessage(e,i)}writePackedVarint(t,e){e.length&&this.writeMessage(t,vf,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,Sf,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,Ef,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,wf,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,Cf,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,Rf,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,Tf,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,bf,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,Mf,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function yf(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function xf(t,e,i){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(let e=i.pos-1;e>=t;e--)i.buf[e+n]=i.buf[e]}function vf(t,e){for(let i=0;i>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(n)}}function Pf(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos>3}if(o--,1===r||2===r)a+=t.readSVarint(),l+=t.readSVarint(),1===r&&h>c&&(n.push(h),c=h),i.push(a,l),h+=2;else{if(7!==r)throw new Error("Invalid command found in the PBF");h>c&&(i.push(i[c],i[c+1]),h+=2)}}h>c&&(n.push(h),c=h)}createFeature_(t,e,i){const n=e.type;if(0===n)return null;let s;const r=e.properties;let o;this.idProperty_?(o=r[this.idProperty_],delete r[this.idProperty_]):o=e.id,r[this.layerName_]=e.layer.name;const a=[],l=[];this.readRawGeometry_(t,e,a,l);const h=function(t,e){let i;return 1===t?i=1===e?"Point":"MultiPoint":2===t?i=1===e?"LineString":"MultiLineString":3===t&&(i="Polygon"),i}(n,l.length);if(this.featureClass===Jp)s=new this.featureClass(h,a,l,2,r,o),s.transform(i.dataProjection);else{let t;if("Polygon"==h){const e=$s(a,l);t=e.length>1?new Ju(a,"XY",e):new Qs(a,"XY",l)}else t="Point"===h?new ks(a,"XY"):"LineString"===h?new Zu(a,"XY"):"MultiPoint"===h?new Hu(a,"XY"):"MultiLineString"===h?new Uu(a,"XY",l):null;s=new(0,this.featureClass),this.geometryName_&&s.setGeometryName(this.geometryName_);const e=td(t,!1,i);s.setGeometry(e),void 0!==o&&s.setId(o),s.setProperties(r,!0)}return s}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_,n=se((e=this.adaptOptions(e)).dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const s=new _f(t),r=s.readFields(Lf,{}),o=[];for(const t in r){if(i&&!i.includes(t))continue;const a=r[t],l=a?[0,0,a.extent,a.extent]:null;n.setExtent(l);for(let t=0,i=a.length;t
Die größten Städte
Die deutschen Bundesländer und alle Städte mit mehr als 50.000 Einwohnern.
Schätzung/Zensus 1990, 2001, 2011, 2022, 2024
Verwaltungsgliederung
Die Einwohnerzahlen der Bundesländer und Kreise in Deutschland.
Schätzung/Zensus 1990, 2001, 2011, 2022, 2024
Urbane Gebiete
Alle urbanen Gebiete in Deutschland mit mehr als 15.000 Einwohnern.
Zensus 2011, 2022, Schätzung 2024
Zensusbevölkerung
Die Bundesländer sowie alle Städte und Gemeinden mit mehr als 7.500 Einwohnern.
Zensus 1970, 1987, 2011, 2022
Top 10 Cities
Die Top-10-Städte Deutschlands und der deutschen Bundesländer (englisch).
Schätzung 2024