ol-mbtiles
Version:
MBTiles format reader for Openlayers
1 lines • 63.5 kB
JavaScript
"use strict";(self.webpackChunkol_mbtiles=self.webpackChunkol_mbtiles||[]).push([[957],{957:(t,e,i)=>{i.d(e,{A:()=>ft});var s=i(588),n=i(1078),o=i(2703),r=i(6514),l=i(6933),a=i(915),h=i(7295),c=i(1580),d=i(6361);const g=class{drawCustom(t,e,i,s,n){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}};var u=i(8774);const _={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},f=[_.FILL],x=[_.STROKE],S=[_.BEGIN_PATH],p=[_.CLOSE_PATH],m=_,y=class extends g{constructor(t,e,i,s){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=s,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map((function(t){return t*e}))}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,n=this.coordinates;let o=n.length;for(let r=0,l=t.length;r<l;r+=e)s[0]=t[r],s[1]=t[r+1],(0,a.Ym)(i,s)&&(n[o++]=s[0],n[o++]=s[1]);return o}appendFlatLineCoordinates(t,e,i,s,n,o){const r=this.coordinates;let l=r.length;const h=this.getBufferedMaxExtent();o&&(e+=s);let d=t[e],g=t[e+1];const u=this.tmpCoordinate_;let _,f,x,S=!0;for(_=e+s;_<i;_+=s)u[0]=t[_],u[1]=t[_+1],x=(0,a.vz)(h,u),x!==f?(S&&(r[l++]=d,r[l++]=g,S=!1),r[l++]=u[0],r[l++]=u[1]):x===c.A.INTERSECTING?(r[l++]=u[0],r[l++]=u[1],S=!1):S=!0,d=u[0],g=u[1],f=x;return(n&&S||_===e+s)&&(r[l++]=d,r[l++]=g),l}drawCustomCoordinates_(t,e,i,s,n){for(let o=0,r=i.length;o<r;++o){const r=i[o],l=this.appendFlatLineCoordinates(t,e,r,s,!1,!1);n.push(l),e=r}return e}drawCustom(t,e,i,s,n){this.beginGeometry(t,e,n);const o=t.getType(),r=t.getStride(),l=this.coordinates.length;let a,h,c,g,u;switch(o){case"MultiPolygon":a=t.getOrientedFlatCoordinates(),g=[];const e=t.getEndss();u=0;for(let t=0,i=e.length;t<i;++t){const i=[];u=this.drawCustomCoordinates_(a,u,e[t],r,i),g.push(i)}this.instructions.push([m.CUSTOM,l,g,t,i,d.Dz,n]),this.hitDetectionInstructions.push([m.CUSTOM,l,g,t,s||i,d.Dz,n]);break;case"Polygon":case"MultiLineString":c=[],a="Polygon"==o?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),u=this.drawCustomCoordinates_(a,0,t.getEnds(),r,c),this.instructions.push([m.CUSTOM,l,c,t,i,d.cD,n]),this.hitDetectionInstructions.push([m.CUSTOM,l,c,t,s||i,d.cD,n]);break;case"LineString":case"Circle":a=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(a,0,a.length,r,!1,!1),this.instructions.push([m.CUSTOM,l,h,t,i,d.n2,n]),this.hitDetectionInstructions.push([m.CUSTOM,l,h,t,s||i,d.n2,n]);break;case"MultiPoint":a=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(a,r),h>l&&(this.instructions.push([m.CUSTOM,l,h,t,i,d.n2,n]),this.hitDetectionInstructions.push([m.CUSTOM,l,h,t,s||i,d.n2,n]));break;case"Point":a=t.getFlatCoordinates(),this.coordinates.push(a[0],a[1]),h=this.coordinates.length,this.instructions.push([m.CUSTOM,l,h,t,i,void 0,n]),this.hitDetectionInstructions.push([m.CUSTOM,l,h,t,s||i,void 0,n])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[m.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[m.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let s,n,o=-1;for(e=0;e<i;++e)s=t[e],n=s[0],n==m.END_GEOMETRY?o=e:n==m.BEGIN_GEOMETRY&&(s[2]=e,(0,r.gI)(this.hitDetectionInstructions,o,e),o=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&"object"==typeof i&&"src"in i?this.pixelRatio:1,e.fillStyle=(0,h.F)(i||u.qY)}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=(0,h.F)(i||u.NT);const s=t.getLineCap();e.lineCap=void 0!==s?s:u._m;const n=t.getLineDash();e.lineDash=n?n.slice():u.Oq;const o=t.getLineDashOffset();e.lineDashOffset=o||u.vk;const r=t.getLineJoin();e.lineJoin=void 0!==r?r:u._K;const l=t.getWidth();e.lineWidth=void 0!==l?l:u.aq;const a=t.getMiterLimit();e.miterLimit=void 0!==a?a:u.eL,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[m.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[m.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,s=t.lineCap,n=t.lineDash,o=t.lineDashOffset,l=t.lineJoin,a=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=s||n!=t.currentLineDash&&!(0,r.aI)(t.currentLineDash,n)||t.currentLineDashOffset!=o||t.currentLineJoin!=l||t.currentLineWidth!=a||t.currentMiterLimit!=h)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=s,t.currentLineDash=n,t.currentLineDashOffset=o,t.currentLineJoin=l,t.currentLineWidth=a,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[m.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=(0,a.o8)(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;(0,a.r)(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}};var T=i(3671);const C=class extends y{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinatess_(t,e,i,s){const n=this.state,o=void 0!==n.fillStyle,r=void 0!==n.strokeStyle,l=i.length;this.instructions.push(S),this.hitDetectionInstructions.push(S);for(let n=0;n<l;++n){const o=i[n],l=this.coordinates.length,a=this.appendFlatLineCoordinates(t,e,o,s,!0,!r),h=[m.MOVE_TO_LINE_TO,l,a];this.instructions.push(h),this.hitDetectionInstructions.push(h),r&&(this.instructions.push(p),this.hitDetectionInstructions.push(p)),e=o}return o&&(this.instructions.push(f),this.hitDetectionInstructions.push(f)),r&&(this.instructions.push(x),this.hitDetectionInstructions.push(x)),e}drawCircle(t,e,i){const s=this.state,n=s.fillStyle,o=s.strokeStyle;if(void 0===n&&void 0===o)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==s.fillStyle&&this.hitDetectionInstructions.push([m.SET_FILL_STYLE,u.qY]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([m.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,u.Oq,u.vk]);const r=t.getFlatCoordinates(),l=t.getStride(),a=this.coordinates.length;this.appendFlatLineCoordinates(r,0,r.length,l,!1,!1);const h=[m.CIRCLE,a];this.instructions.push(S,h),this.hitDetectionInstructions.push(S,h),void 0!==s.fillStyle&&(this.instructions.push(f),this.hitDetectionInstructions.push(f)),void 0!==s.strokeStyle&&(this.instructions.push(x),this.hitDetectionInstructions.push(x)),this.endGeometry(e)}drawPolygon(t,e,i){const s=this.state,n=s.fillStyle,o=s.strokeStyle;if(void 0===n&&void 0===o)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==s.fillStyle&&this.hitDetectionInstructions.push([m.SET_FILL_STYLE,u.qY]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([m.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,u.Oq,u.vk]);const r=t.getEnds(),l=t.getOrientedFlatCoordinates(),a=t.getStride();this.drawFlatCoordinatess_(l,0,r,a),this.endGeometry(e)}drawMultiPolygon(t,e,i){const s=this.state,n=s.fillStyle,o=s.strokeStyle;if(void 0===n&&void 0===o)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==s.fillStyle&&this.hitDetectionInstructions.push([m.SET_FILL_STYLE,u.qY]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([m.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,u.Oq,u.vk]);const r=t.getEndss(),l=t.getOrientedFlatCoordinates(),a=t.getStride();let h=0;for(let t=0,e=r.length;t<e;++t)h=this.drawFlatCoordinatess_(l,h,r[t],a);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(0!==t){const e=this.coordinates;for(let i=0,s=e.length;i<s;++i)e[i]=(0,T.n$)(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;void 0!==t.fillStyle&&this.updateFillStyle(t,this.createFill),void 0!==t.strokeStyle&&this.updateStrokeStyle(t,this.applyStroke)}};var v=i(1597);function I(t,e,i,s,n){const o=[];let r=i,l=0,a=e.slice(i,2);for(;l<t&&r+n<s;){const[i,s]=a.slice(-2),h=e[r+n],c=e[r+n+1],d=Math.sqrt((h-i)*(h-i)+(c-s)*(c-s));if(l+=d,l>=t){const e=(t-l+d)/d,g=(0,v.Cc)(i,h,e),u=(0,v.Cc)(s,c,e);a.push(g,u),o.push(a),a=[g,u],l==t&&(r+=n),l=0}else if(l<t)a.push(e[r+n],e[r+n+1]),r+=n;else{const t=d-l,e=(0,v.Cc)(i,h,t/d),g=(0,v.Cc)(s,c,t/d);a.push(e,g),o.push(a),a=[e,g],l=0,r+=n}}return l>0&&o.push(a),o}function R(t,e,i,s,n){let o,r,l,a,h,c,d,g,u,_,f=i,x=i,S=0,p=0,m=i;for(r=i;r<s;r+=n){const i=e[r],s=e[r+1];void 0!==h&&(u=i-h,_=s-c,a=Math.sqrt(u*u+_*_),void 0!==d&&(p+=l,o=Math.acos((d*u+g*_)/(l*a)),o>t&&(p>S&&(S=p,f=m,x=r),p=0,m=r-n)),l=a,d=u,g=_),h=i,c=s}return p+=a,p>S?[m,r]:[f,x]}var k=i(4087);const w={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},L={Circle:C,Default:y,Image:class extends y{constructor(t,e,i,s){super(t,e,i,s),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!(0,a.Ym)(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),n=t.getStride(),o=this.coordinates.length,r=this.appendFlatPointCoordinates(s,n);this.instructions.push([m.DRAW_IMAGE,o,r,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,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.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([m.DRAW_IMAGE,o,r,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),n=[];for(let e=0,i=s.length;e<i;e+=t.getStride())this.maxExtent&&!(0,a.Ym)(this.maxExtent,s.slice(e,e+2))||n.push(s[e],s[e+1]);const o=this.coordinates.length,r=this.appendFlatPointCoordinates(n,2);this.instructions.push([m.DRAW_IMAGE,o,r,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,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.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([m.DRAW_IMAGE,o,r,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){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,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),s=t.getSize(),n=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=s[1],this.opacity_=t.getOpacity(),this.originX_=n[0],this.originY_=n[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=s[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},LineString:class extends y{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinates_(t,e,i,s){const n=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,s,!1,!1),r=[m.MOVE_TO_LINE_TO,n,o];return this.instructions.push(r),this.hitDetectionInstructions.push(r),i}drawLineString(t,e,i){const s=this.state,n=s.strokeStyle,o=s.lineWidth;if(void 0===n||void 0===o)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([m.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,u.Oq,u.vk],S);const r=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(r,0,r.length,l),this.hitDetectionInstructions.push(x),this.endGeometry(e)}drawMultiLineString(t,e,i){const s=this.state,n=s.strokeStyle,o=s.lineWidth;if(void 0===n||void 0===o)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([m.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,u.Oq,u.vk],S);const r=t.getEnds(),l=t.getFlatCoordinates(),a=t.getStride();let h=0;for(let t=0,e=r.length;t<e;++t)h=this.drawFlatCoordinates_(l,h,r[t],a);this.hitDetectionInstructions.push(x),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(x),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(x),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(S)}},Polygon:C,Text:class extends y{constructor(t,e,i,s){super(t,e,i,s),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[u.qY]={fillStyle:u.qY},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const s=this.textFillState_,n=this.textStrokeState_,o=this.textState_;if(""===this.text_||!o||!s&&!n)return;const r=this.coordinates;let l=r.length;const h=t.getType();let c=null,d=t.getStride();if("line"!==o.placement||"LineString"!=h&&"MultiLineString"!=h&&"Polygon"!=h&&"MultiPolygon"!=h){let s=o.overflow?null:[];switch(h){case"Point":case"MultiPoint":c=t.getFlatCoordinates();break;case"LineString":c=t.getFlatMidpoint();break;case"Circle":c=t.getCenter();break;case"MultiLineString":c=t.getFlatMidpoints(),d=2;break;case"Polygon":c=t.getFlatInteriorPoint(),o.overflow||s.push(c[2]/this.resolution),d=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();c=[];for(let t=0,i=e.length;t<i;t+=3)o.overflow||s.push(e[t+2]/this.resolution),c.push(e[t],e[t+1]);if(0===c.length)return;d=2}const n=this.appendFlatPointCoordinates(c,d);if(n===l)return;if(s&&(n-l)/2!=c.length/d){let t=l/2;s=s.filter(((e,i)=>{const s=r[2*(t+i)]===c[i*d]&&r[2*(t+i)+1]===c[i*d+1];return s||--t,s}))}this.saveTextStates_();const a=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,g=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(t,e,i);let _=o.padding;if(_!=u.Tq&&(o.scale[0]<0||o.scale[1]<0)){let t=o.padding[0],e=o.padding[1],i=o.padding[2],s=o.padding[3];o.scale[0]<0&&(e=-e,s=-s),o.scale[1]<0&&(t=-t,i=-i),_=[t,e,i,s]}const f=this.pixelRatio;this.instructions.push([m.DRAW_IMAGE,l,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,_==u.Tq?u.Tq:_.map((function(t){return t*f})),a,g,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,s]);const x=1/f,S=a?a.slice(0):null;S&&(S[1]=u.qY),this.hitDetectionInstructions.push([m.DRAW_IMAGE,l,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[x,x],NaN,this.declutterMode_,this.declutterImageWithText_,_,S,g,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?u.qY:this.fillKey_,this.textOffsetX_,this.textOffsetY_,s]),this.endGeometry(e)}else{if(!(0,a.HY)(this.maxExtent,t.getExtent()))return;let s;if(c=t.getFlatCoordinates(),"LineString"==h)s=[c.length];else if("MultiLineString"==h)s=t.getEnds();else if("Polygon"==h)s=t.getEnds().slice(0,1);else if("MultiPolygon"==h){const e=t.getEndss();s=[];for(let t=0,i=e.length;t<i;++t)s.push(e[t][0])}this.beginGeometry(t,e,i);const n=o.repeat,g=n?void 0:o.textAlign;let u=0;for(let t=0,e=s.length;t<e;++t){let e;e=n?I(n*this.resolution,c,u,s[t],d):[c.slice(u,s[t])];for(let i=0,n=e.length;i<n;++i){const n=e[i];let a=0,h=n.length;if(null==g){const t=R(o.maxAngle,n,0,n.length,2);a=t[0],h=t[1]}for(let t=a;t<h;t+=d)r.push(n[t],n[t+1]);const c=r.length;u=s[t],this.drawChars_(l,c),l=c}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,s=this.strokeKey_;t&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const n=this.textKey_;n in this.textStates||(this.textStates[n]={font:e.font,textAlign:e.textAlign||u.MY,justify:e.justify,textBaseline:e.textBaseline||u.M8,scale:e.scale});const o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,s=this.textState_,n=this.strokeKey_,o=this.textKey_,r=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,a=w[s.textBaseline],h=this.textOffsetY_*l,c=this.text_,d=i?i.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([m.DRAW_CHARS,t,e,a,s.overflow,r,s.maxAngle,l,h,n,d*l,c,o,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([m.DRAW_CHARS,t,e,a,s.overflow,r?u.qY:r,s.maxAngle,l,h,n,d*l,c,o,1/l,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let i,s,n;if(t){const e=t.getFill();e?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=(0,h.F)(e.getColor()||u.qY)):(s=null,this.textFillState_=s);const o=t.getStroke();if(o){n=this.textStrokeState_,n||(n={},this.textStrokeState_=n);const t=o.getLineDash(),e=o.getLineDashOffset(),i=o.getWidth(),s=o.getMiterLimit();n.lineCap=o.getLineCap()||u._m,n.lineDash=t?t.slice():u.Oq,n.lineDashOffset=void 0===e?u.vk:e,n.lineJoin=o.getLineJoin()||u._K,n.lineWidth=void 0===i?u.aq:i,n.miterLimit=void 0===s?u.eL:s,n.strokeStyle=(0,h.F)(o.getColor()||u.NT)}else n=null,this.textStrokeState_=n;i=this.textState_;const r=t.getFont()||u.ZV;(0,u.fZ)(r);const l=t.getScaleArray();i.overflow=t.getOverflow(),i.font=r,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||u.M8,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||u.Tq,i.scale=void 0===l?[1,1]:l;const a=t.getOffsetX(),c=t.getOffsetY(),d=t.getRotateWithView(),g=t.getKeepUpright(),_=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===a?0:a,this.textOffsetY_=void 0===c?0:c,this.textRotateWithView_=void 0!==d&&d,this.textKeepUpright_=void 0===g||g,this.textRotation_=void 0===_?0:_,this.strokeKey_=n?("string"==typeof n.strokeStyle?n.strokeStyle:(0,k.v6)(n.strokeStyle))+n.lineCap+n.lineDashOffset+"|"+n.lineWidth+n.lineJoin+n.miterLimit+"["+n.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=s&&s.fillStyle?"string"==typeof s.fillStyle?s.fillStyle:"|"+(0,k.v6)(s.fillStyle):""}else this.text_="";this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}},E=class{constructor(t,e,i,s){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=s,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const s in i){const n=i[s].finish();t[e][s]=n}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let s=this.buildersByZIndex_[i];void 0===s&&(s={},this.buildersByZIndex_[i]=s);let n=s[e];return void 0===n&&(n=new(0,L[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=n),n}};var D=i(8711),O=i(7622),M=i(3530),F=i(9703),b=i(904);function A(t,e,i,s,n,o,r,l,a,h,c,d,g=!0){let u=t[e],_=t[e+1],f=0,x=0,S=0,p=0;function m(){f=u,x=_,u=t[e+=s],_=t[e+1],p+=S,S=Math.sqrt((u-f)*(u-f)+(_-x)*(_-x))}do{m()}while(e<i-s&&p+S<o);let y=0===S?0:(o-p)/S;const T=(0,v.Cc)(f,u,y),C=(0,v.Cc)(x,_,y),I=e-s,R=p,k=o+l*a(h,n,c);for(;e<i-s&&p+S<k;)m();y=0===S?0:(k-p)/S;const w=(0,v.Cc)(f,u,y),L=(0,v.Cc)(x,_,y);let E=!1;if(g)if(d){const t=[T,C,w,L];(0,O.e$)(t,0,4,2,d,t,t),E=t[0]>t[2]}else E=T>w;const D=Math.PI,M=[],F=I+s===e;let b;if(S=0,p=R,u=t[e=I],_=t[e+1],F){m(),b=Math.atan2(_-x,u-f),E&&(b+=b>0?-D:D);const t=(w+T)/2,e=(L+C)/2;return M[0]=[t,e,(k-o)/2,b,n],M}for(let t=0,d=(n=n.replace(/\n/g," ")).length;t<d;){m();let g=Math.atan2(_-x,u-f);if(E&&(g+=g>0?-D:D),void 0!==b){let t=g-b;if(t+=t>D?-2*D:t<-D?2*D:0,Math.abs(t)>r)return null}b=g;const T=t;let C=0;for(;t<d;++t){const r=l*a(h,n[E?d-t-1:t],c);if(e+s<i&&p+S<o+C+r/2)break;C+=r}if(t===T)continue;const I=E?n.substring(d-T,d-t):n.substring(T,t);y=0===S?0:(o+C/2-p)/S;const R=(0,v.Cc)(f,u,y),k=(0,v.Cc)(x,_,y);M.push([R,k,C/2,g,I]),o+=C}return M}var P=i(808);const G=(0,a.S5)(),W=[],Y=[],B=[],N=[];function q(t){return t[3].declutterBox}const Z=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function X(t,e){return"start"===e?e=Z.test(t)?"right":"left":"end"===e&&(e=Z.test(t)?"left":"right"),w[e]}function H(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}const K=class{constructor(t,e,i,s,n){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=(0,F.vt)(),this.hitDetectionInstructions=s.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=s.fillStates||{},this.strokeStates=s.strokeStates||{},this.textStates=s.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=n?new P.A:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,s){const n=t+e+i+s;if(this.labels_[n])return this.labels_[n];const o=s?this.strokeStates[s]:null,r=i?this.fillStates[i]:null,l=this.textStates[e],a=this.pixelRatio,h=[l.scale[0]*a,l.scale[1]*a],c=l.justify?w[l.justify]:X(Array.isArray(t)?t[0]:t,l.textAlign||u.MY),d=s&&o.lineWidth?o.lineWidth:0,g=Array.isArray(t)?t:String(t).split("\n").reduce(H,[]),{width:_,height:f,widths:x,heights:S,lineWidths:p}=(0,u.jT)(l,g),m=_+d,y=[],T=(m+2)*h[0],C=(f+d)*h[1],v={width:T<0?Math.floor(T):Math.ceil(T),height:C<0?Math.floor(C):Math.ceil(C),contextInstructions:y};1==h[0]&&1==h[1]||y.push("scale",h),s&&(y.push("strokeStyle",o.strokeStyle),y.push("lineWidth",d),y.push("lineCap",o.lineCap),y.push("lineJoin",o.lineJoin),y.push("miterLimit",o.miterLimit),y.push("setLineDash",[o.lineDash]),y.push("lineDashOffset",o.lineDashOffset)),i&&y.push("fillStyle",r.fillStyle),y.push("textBaseline","middle"),y.push("textAlign","center");const I=.5-c;let R=c*m+I*d;const k=[],L=[];let E,D=0,O=0,M=0,F=0;for(let t=0,e=g.length;t<e;t+=2){const e=g[t];if("\n"===e){O+=D,D=0,R=c*m+I*d,++F;continue}const n=g[t+1]||l.font;n!==E&&(s&&k.push("font",n),i&&L.push("font",n),E=n),D=Math.max(D,S[M]);const o=[e,R+I*x[M]+c*(x[M]-p[F]),.5*(d+D)+O];R+=x[M],s&&k.push("strokeText",o),i&&L.push("fillText",o),++M}return Array.prototype.push.apply(y,k),Array.prototype.push.apply(y,L),this.labels_[n]=v,v}replayTextBackground_(t,e,i,s,n,o,r){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,s),t.lineTo.apply(t,n),t.lineTo.apply(t,e),o&&(this.alignAndScaleFill_=o[2],t.fillStyle=o[1],this.fill_(t)),r&&(this.setStrokeStyle_(t,r),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,s,n,o,r,l,h,c,d,g,u,_,f,x){let S=i-(r*=g[0]),p=s-(l*=g[1]);const m=n+h>t?t-h:n,y=o+c>e?e-c:o,T=_[3]+m*g[0]+_[1],C=_[0]+y*g[1]+_[2],v=S-_[3],I=p-_[0];let R;return(f||0!==d)&&(W[0]=v,N[0]=v,W[1]=I,Y[1]=I,Y[0]=v+T,B[0]=Y[0],B[1]=I+C,N[1]=B[1]),0!==d?(R=(0,F.Zz)((0,F.vt)(),i,s,1,1,d,-i,-s),(0,F.Bb)(R,W),(0,F.Bb)(R,Y),(0,F.Bb)(R,B),(0,F.Bb)(R,N),(0,a.N)(Math.min(W[0],Y[0],B[0],N[0]),Math.min(W[1],Y[1],B[1],N[1]),Math.max(W[0],Y[0],B[0],N[0]),Math.max(W[1],Y[1],B[1],N[1]),G)):(0,a.N)(Math.min(v,v+T),Math.min(I,I+C),Math.max(v,v+T),Math.max(I,I+C),G),u&&(S=Math.round(S),p=Math.round(p)),{drawImageX:S,drawImageY:p,drawImageW:m,drawImageH:y,originX:h,originY:c,declutterBox:{minX:G[0],minY:G[1],maxX:G[2],maxY:G[3],value:x},canvasTransform:R,scale:g}}replayImageOrLabel_(t,e,i,s,n,o,r){const l=!(!o&&!r),a=s.declutterBox,h=r?r[2]*s.scale[0]/2:0;return a.minX-h<=e[0]&&a.maxX+h>=0&&a.minY-h<=e[1]&&a.maxY+h>=0&&(l&&this.replayTextBackground_(t,W,Y,B,N,o,r),(0,u.Jw)(t,s.canvasTransform,n,i,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=(0,F.Bb)(this.renderedTransform_,[0,0]),s=512*this.pixelRatio;t.save(),t.translate(i[0]%s,i[1]%s),1!==e&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,i,s){const n=this.textStates[e],o=this.createLabel(t,e,s,i),r=this.strokeStates[i],l=this.pixelRatio,a=X(Array.isArray(t)?t[0]:t,n.textAlign||u.MY),h=w[n.textBaseline||u.M8],c=r&&r.lineWidth?r.lineWidth:0;return{label:o,anchorX:a*(o.width/l-2*n.scale[0])+2*(.5-a)*c,anchorY:h*o.height/l+2*(.5-h)*c}}execute_(t,e,i,s,n,o,l,h){const c=this.zIndexContext_;let d;this.pixelCoordinates_&&(0,r.aI)(i,this.renderedTransform_)?d=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),d=(0,O.Rc)(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),(0,F.k3)(this.renderedTransform_,i));let g=0;const _=s.length;let f,x,S,p,y,T,C,v,I,R,k,w,L,E=0,D=0,M=0;const P=this.coordinateCache_,G=this.viewRotation_,W=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,Y={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:G},B=this.instructions!=s||this.overlaps?0:200;let N,Z,H,K;for(;g<_;){const i=s[g];switch(i[0]){case m.BEGIN_GEOMETRY:N=i[1],K=i[3],N.getGeometry()?void 0===l||(0,a.HY)(l,K.getExtent())?++g:g=i[2]+1:g=i[2],c&&(c.zIndex=i[4]);break;case m.BEGIN_PATH:D>B&&(this.fill_(t),D=0),M>B&&(t.stroke(),M=0),D||M||(t.beginPath(),y=NaN,T=NaN),++g;break;case m.CIRCLE:E=i[1];const s=d[E],r=d[E+1],_=d[E+2]-s,O=d[E+3]-r,F=Math.sqrt(_*_+O*O);t.moveTo(s+F,r),t.arc(s,r,F,0,2*Math.PI,!0),++g;break;case m.CLOSE_PATH:t.closePath(),++g;break;case m.CUSTOM:E=i[1],f=i[2];const J=i[3],V=i[4],j=i[5];Y.geometry=J,Y.feature=N,g in P||(P[g]=[]);const z=P[g];j?j(d,E,f,2,z):(z[0]=d[E],z[1]=d[E+1],z.length=2),c&&(c.zIndex=i[6]),V(z,Y),++g;break;case m.DRAW_IMAGE:E=i[1],f=i[2],I=i[3],x=i[4],S=i[5];let U=i[6];const $=i[7],Q=i[8],tt=i[9],et=i[10];let it=i[11];const st=i[12];let nt=i[13];p=i[14]||"declutter";const ot=i[15];if(!I&&i.length>=20){R=i[19],k=i[20],w=i[21],L=i[22];const t=this.drawLabelWithPointPlacement_(R,k,w,L);I=t.label,i[3]=I;const e=i[23];x=(t.anchorX-e)*this.pixelRatio,i[4]=x;const s=i[24];S=(t.anchorY-s)*this.pixelRatio,i[5]=S,U=I.height,i[6]=U,nt=I.width,i[13]=nt}let rt,lt,at,ht;i.length>25&&(rt=i[25]),i.length>17?(lt=i[16],at=i[17],ht=i[18]):(lt=u.Tq,at=null,ht=null),et&&W?it+=G:et||W||(it-=G);let ct=0;for(;E<f;E+=2){if(rt&&rt[ct++]<nt/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(I.width,I.height,d[E],d[E+1],nt,U,x,S,Q,tt,it,st,n,lt,!!at||!!ht,N),s=[t,e,I,i,$,at,ht];if(h){let t,e,n,o,r;if(ot){const i=f-E;if(!ot[i]){ot[i]={args:s,declutterMode:p};continue}const o=ot[i];t=o.args,e=o.declutterMode,delete ot[i],n=q(t)}if(!t||"declutter"===e&&h.collides(n)||(o=!0),"declutter"===p&&h.collides(i.declutterBox)||(r=!0),"declutter"===e&&"declutter"===p){const t=o&&r;o=t,r=t}o&&("none"!==e&&h.insert(n),this.replayImageOrLabel_.apply(this,t)),r&&("none"!==p&&h.insert(i.declutterBox),this.replayImageOrLabel_.apply(this,s))}else this.replayImageOrLabel_.apply(this,s)}++g;break;case m.DRAW_CHARS:const dt=i[1],gt=i[2],ut=i[3],_t=i[4];L=i[5];const ft=i[6],xt=i[7],St=i[8];w=i[9];const pt=i[10];R=i[11],k=i[12];const mt=[i[13],i[13]];p=i[14]||"declutter";const yt=i[15],Tt=this.textStates[k],Ct=Tt.font,vt=[Tt.scale[0]*xt,Tt.scale[1]*xt];let It;Ct in this.widths_?It=this.widths_[Ct]:(It={},this.widths_[Ct]=It);const Rt=(0,b.k)(d,dt,gt,2),kt=Math.abs(vt[0])*(0,u.TA)(Ct,R,It);if(_t||kt<=Rt){const i=A(d,dt,gt,2,R,(Rt-kt)*X(R,this.textStates[k].textAlign),ft,Math.abs(vt[0]),u.TA,Ct,It,W?0:this.viewRotation_,yt);t:if(i){const s=[];let n,o,r,l,a;if(w)for(n=0,o=i.length;n<o;++n){a=i[n],r=a[4],l=this.createLabel(r,k,"",w),x=a[2]+(vt[0]<0?-pt:pt),S=ut*l.height+2*(.5-ut)*pt*vt[1]/vt[0]-St;const o=this.calculateImageOrLabelDimensions_(l.width,l.height,a[0],a[1],l.width,l.height,x,S,0,0,a[3],mt,!1,u.Tq,!1,N);if(h&&"declutter"===p&&h.collides(o.declutterBox))break t;s.push([t,e,l,o,1,null,null])}if(L)for(n=0,o=i.length;n<o;++n){a=i[n],r=a[4],l=this.createLabel(r,k,L,""),x=a[2],S=ut*l.height-St;const o=this.calculateImageOrLabelDimensions_(l.width,l.height,a[0],a[1],l.width,l.height,x,S,0,0,a[3],mt,!1,u.Tq,!1,N);if(h&&"declutter"===p&&h.collides(o.declutterBox))break t;s.push([t,e,l,o,1,null,null])}h&&"none"!==p&&h.load(s.map(q));for(let t=0,e=s.length;t<e;++t)this.replayImageOrLabel_.apply(this,s[t])}}++g;break;case m.END_GEOMETRY:if(void 0!==o){N=i[1];const t=o(N,K,p);if(t)return t}++g;break;case m.FILL:B?D++:this.fill_(t),++g;break;case m.MOVE_TO_LINE_TO:for(E=i[1],f=i[2],Z=d[E],H=d[E+1],t.moveTo(Z,H),y=Z+.5|0,T=H+.5|0,E+=2;E<f;E+=2)Z=d[E],H=d[E+1],C=Z+.5|0,v=H+.5|0,E!=f-2&&C===y&&v===T||(t.lineTo(Z,H),y=C,T=v);++g;break;case m.SET_FILL_STYLE:this.alignAndScaleFill_=i[2],D&&(this.fill_(t),D=0,M&&(t.stroke(),M=0)),t.fillStyle=i[1],++g;break;case m.SET_STROKE_STYLE:M&&(t.stroke(),M=0),this.setStrokeStyle_(t,i),++g;break;case m.STROKE:B?M++:t.stroke(),++g;break;default:++g}}D&&this.fill_(t),M&&t.stroke()}execute(t,e,i,s,n,o){this.viewRotation_=s,this.execute_(t,e,i,this.instructions,n,void 0,void 0,o)}executeHitDetection(t,e,i,s,n){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,s,n)}},J=["Polygon","Circle","LineString","Image","Text","Default"],V=["Image","Text"];J.filter((t=>!V.includes(t)));const j={},z=class{constructor(t,e,i,s,n,o,r){this.maxExtent_=t,this.overlaps_=s,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=(0,F.vt)(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(n,r)}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 s=this.executorsByZIndex_[i];void 0===s&&(s={},this.executorsByZIndex_[i]=s);const n=t[i];for(const t in n){const i=n[t];s[t]=new K(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,s=t.length;e<s;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,s,n,o){const l=2*(s=Math.round(s))+1,h=(0,F.Zz)(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-i,-t[0],-t[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=(0,D.Y)(l,l,void 0,{willReadFrequently:!0}));const d=this.hitDetectionContext_;let g;d.canvas.width!==l||d.canvas.height!==l?(d.canvas.width=l,d.canvas.height=l):c||d.clearRect(0,0,l,l),void 0!==this.renderBuffer_&&(g=(0,a.S5)(),(0,a.$C)(g,t),(0,a.r)(g,e*(this.renderBuffer_+s),g));const u=function(t){if(void 0!==j[t])return j[t];const e=2*t+1,i=t*t,s=new Array(i+1);for(let n=0;n<=t;++n)for(let o=0;o<=t;++o){const r=n*n+o*o;if(r>i)break;let l=s[r];l||(l=[],s[r]=l),l.push(4*((t+n)*e+(t+o))+3),n>0&&l.push(4*((t-n)*e+(t+o))+3),o>0&&(l.push(4*((t+n)*e+(t-o))+3),n>0&&l.push(4*((t-n)*e+(t-o))+3))}const n=[];for(let t=0,e=s.length;t<e;++t)s[t]&&n.push(...s[t]);return j[t]=n,n}(s);let _;function f(t,e,i){const r=d.getImageData(0,0,l,l).data;for(let a=0,h=u.length;a<h;a++)if(r[u[a]]>0){if(!o||"none"===i||"Image"!==_&&"Text"!==_||o.includes(t)){const i=(u[a]-3)/4,o=s-i%l,r=s-(i/l|0),h=n(t,e,o*o+r*r);if(h)return h}d.clearRect(0,0,l,l);break}}const x=Object.keys(this.executorsByZIndex_).map(Number);let S,p,m,y,T;for(x.sort(r.V_),S=x.length-1;S>=0;--S){const t=x[S].toString();for(m=this.executorsByZIndex_[t],p=J.length-1;p>=0;--p)if(_=J[p],y=m[_],void 0!==y&&(T=y.executeHitDetection(d,h,i,f,g),T))return T}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],s=e[1],n=e[2],o=e[3],r=[i,s,i,o,n,o,n,s];return(0,O.Rc)(r,0,8,2,t,r),r}isEmpty(){return(0,M.p)(this.executorsByZIndex_)}execute(t,e,i,s,n,o,l){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(l?r.rG:r.V_),o=o||J;const h=J.length;for(let r=0,c=a.length;r<c;++r){const c=a[r].toString(),d=this.executorsByZIndex_[c];for(let c=0,g=o.length;c<g;++c){const g=o[c],u=d[g];if(void 0!==u){const o=null===l?void 0:u.getZIndexContext(),d=o?o.getContext():t,_=this.maxExtent_&&"Image"!==g&&"Text"!==g;if(_&&(d.save(),this.clip(d,i)),o&&"Text"!==g&&"Image"!==g?o.pushFunction((t=>u.execute(t,e,i,s,n,l))):u.execute(d,e,i,s,n,l),_&&d.restore(),o){o.offset();const t=a[r]*h+c;this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(o)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(r.V_);for(let i=0,s=e.length;i<s;++i)t[e[i]].forEach((t=>{t.draw(this.renderedContext_),t.clear()})),t[e[i]].length=0}};i(6438);var U=i(9700),$=i(4774);const Q=class extends g{constructor(t,e,i,s,n,o,r){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=s,this.transformRotation_=s?(0,v.Mg)(Math.atan2(s[1],s[0]),10):0,this.viewRotation_=n,this.squaredTolerance_=o,this.userTransform_=r,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_=(0,F.vt)()}drawImages_(t,e,i,s){if(!this.image_)return;const n=(0,O.Rc)(t,e,i,s,this.transform_,this.pixelCoordinates_),o=this.context_,r=this.tmpLocalTransform_,l=o.globalAlpha;1!=this.imageOpacity_&&(o.globalAlpha=l*this.imageOpacity_);let a=this.imageRotation_;0===this.transformRotation_&&(a-=this.viewRotation_),this.imageRotateWithView_&&(a+=this.viewRotation_);for(let t=0,e=n.length;t<e;t+=2){const e=n[t]-this.imageAnchorX_,i=n[t+1]-this.imageAnchorY_;if(0!==a||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const t=e+this.imageAnchorX_,s=i+this.imageAnchorY_;(0,F.Zz)(r,t,s,1,1,a,-t,-s),o.save(),o.transform.apply(o,r),o.translate(t,s),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,i,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(o.globalAlpha=l)}drawText_(t,e,i,s){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const n=(0,O.Rc)(t,e,i,s,this.transform_,this.pixelCoordinates_),o=this.context_;let r=this.textRotation_;for(0===this.transformRotation_&&(r-=this.viewRotation_),this.textRotateWithView_&&(r+=this.viewRotation_);e<i;e+=s){const t=n[e]+this.textOffsetX_,i=n[e+1]+this.textOffsetY_;0!==r||1!=this.textScale_[0]||1!=this.textScale_[1]?(o.save(),o.translate(t-this.textOffsetX_,i-this.textOffsetY_),o.rotate(r),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,t,i),this.textFillState_&&o.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,s,n){const o=this.context_,r=(0,O.Rc)(t,e,i,s,this.transform_,this.pixelCoordinates_);o.moveTo(r[0],r[1]);let l=r.length;n&&(l-=2);for(let t=2;t<l;t+=2)o.lineTo(r[t],r[t+1]);return n&&o.closePath(),i}drawRings_(t,e,i,s){for(let n=0,o=i.length;n<o;++n)e=this.moveToLineTo_(t,e,i[n],s,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),(0,a.HY)(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=(0,$.v7)(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],s=e[3]-e[1],n=Math.sqrt(i*i+s*s),o=this.context_;o.beginPath(),o.arc(e[0],e[1],n,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t)}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let t=0,i=e.length;t<i;++t)this.drawGeometry(e[t])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),(0,a.HY)(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1),e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if((0,a.HY)(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let s=0;const n=t.getEnds(),o=t.getStride();e.beginPath();for(let t=0,e=n.length;t<e;++t)s=this.moveToLineTo_(i,s,n[t],o,!1);e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoints();this.drawText_(e,0,e.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),(0,a.HY)(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),(0,a.HY)(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let s=0;const n=t.getEndss(),o=t.getStride();e.beginPath();for(let t=0,e=n.length;t<e;++t){const e=n[t];s=this.drawRings_(i,s,e,o)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),(0,r.aI)(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,s=t.textAlign?t.textAlign:u.MY;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=s&&(i.textAlign=s,e.textAlign=s),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=s,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:s,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(t){const e=t.getColor();this.fillState_={fillStyle:(0,h.F)(e||u.qY)}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),s=e.getLineDash(),n=e.getLineDashOffset(),o=e.getLineJoin(),r=e.getWidth(),l=e.getMiterLimit(),a=s||u.Oq;this.strokeState_={lineCap:void 0!==i?i:u._m,lineDash:1===this.pixelRatio_?a:a.map((t=>t*this.pixelRatio_)),lineDashOffset:(n||u.vk)*this.pixelRatio_,lineJoin:void 0!==o?o:u._K,lineWidth:(void 0!==r?r:u.aq)*this.pixelRatio_,miterLimit:void 0!==l?l:u.eL,strokeStyle:(0,h.F)(t||u.NT)}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),s=t.getAnchor(),n=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*i,this.imageAnchorY_=s[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=n[0],this.imageOriginY_=n[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[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:(0,h.F)(t||u.qY)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),s=i.getLineDash(),n=i.getLineDashOffset(),o=i.getLineJoin(),r=i.getWidth(),l=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:u._m,lineDash:s||u.Oq,lineDashOffset:n||u.vk,lineJoin:void 0!==o?o:u._K,lineWidth:void 0!==r?r:u.aq,miterLimit:void 0!==l?l:u.eL,strokeStyle:(0,h.F)(t||u.NT)}}else this.textStrokeState_=null;const s=t.getFont(),n=t.getOffsetX(),o=t.getOffsetY(),r=t.getRotateWithView(),l=t.getRotation(),a=t.getScaleArray(),c=t.getText(),d=t.getTextAlign(),g=t.getTextBaseline();this.textState_={font:void 0!==s?s:u.ZV,textAlign:void 0!==d?d:u.MY,textBaseline:void 0!==g?g:u.M8},this.text_=void 0!==c?Array.isArray(c)?c.reduce(((t,e,i)=>t+(i%2?" ":e)),""):c:"",this.textOffsetX_=void 0!==n?this.pixelRatio_*n:0,this.textOffsetY_=void 0!==o?this.pixelRatio_*o:0,this.textRotateWithView_=void 0!==r&&r,this.textRotation_=void 0!==l?l:0,this.textScale_=[this.pixelRatio_*a[0],this.pixelRatio_*a[1]]}else this.text_=""}},tt=.5;var et=i(6782),it=i(6141);const st={Point:function(t,e,i,s,n,o){const r=i.getImage(),l=i.getText(),a=l&&l.getText(),h=o&&r&&a?{}:void 0;if(r){if(r.getImageState()!=it.A.LOADED)return;const o=t.getBuilder(i.getZIndex(),"Image");o.setImageStyle(r,h),o.drawPoint(e,s,n)}if(a){const o=t.getBuilder(i.getZIndex(),"Text");o.setTextStyle(l,h),o.drawText(e,s,n)}},LineString:function(t,e,i,s,n){const o=i.getStroke();if(o){const r=t.getBuilder(i.getZIndex(),"LineString");r.setFillStrokeStyle(null,o),r.drawLineString(e,s,n)}const r=i.getText();if(r&&r.getText()){const o=t.getBuilder(i.getZIndex(),"Text");o.setTextStyle(r),o.drawText(e,s,n)}},Polygon:function(t,e,i,s,n){const o=i.getFill(),r=i.getStroke();if(o||r){const l=t.getBuilder(i.getZIndex(),"Polygon");l.setFillStrokeStyle(o,r),l.drawPolygon(e,s,n)}const l=i.getText();if(l&&l.getText()){const o=t.getBuilder(i.getZIndex(),"Text");o.setTextStyle(l),o.drawText(e,s,n)}},MultiPoint:function(t,e,i,s,n,o){const r=i.getImage(),l=r&&0!==r.getOpacity(),a=i.getText(),h=a&&a.getText(),c=o&&l&&h?{}:void 0;if(l){if(r.getImageState()!=it.A.LOADED)return;const o=t.getBuilder(i.getZIndex(),"Image");o.setImageStyle(r,c),o.drawMultiPoint(e,s,n)}if(h){const o=t.getBuilder(i.getZIndex(),"Text");o.setTextStyle(a,c),o.drawText(e,s,n)}},MultiLineString:function(t,e,i,s,n){const o=i.getStroke();if(o){const r=t.getBuilder(i.getZIndex(),"LineString");r.setFillStrokeStyle(null,o),r.drawMultiLineString(e,s,n)}const r=i.getText();if(r&&r.getText()){const o=t.getBuilder(i.getZIndex(),"Text");o.setTextStyle(r),o.drawText(e,s,n)}},MultiPolygon:function(t,e,i,s,n){const o=i.getFill(),r=i.getStroke();if(r||o){const l=t.getBuilder(i.getZIndex(),"Polygon");l.setFillStrokeStyle(o,r),l.drawMultiPolygon(e,s,n)}const l=i.getText();if(l&&l.getText()){const o=t.getBuilder(i.getZIndex(),"Text");o.setTextStyle(l),o.drawText(e,s,n)}},GeometryCollection:function(t,e,i,s,n,o){const r=e.getGeometriesArray();let l,a;for(l=0,a=r.length;l<a;++l)(0,st[r[l].getType()])(t,r[l],i,s,n,o)},Circle:function(t,e,i,s,n){const o=i.getFill(),r=i.getStroke();if(o||r){const l=t.getBuilder(i.getZIndex(),"Circle");l.setFillStrokeStyle(o,r),l.drawCircle(e,s,n)}const l=i.getText();if(l&&l.getText()){const n=t.getBuilder(i.getZIndex(),"Text");n.setTextStyle(l),n.drawText(e,s)}}};function nt(t,e){const i=function(t,e){return