(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8594],{20714:bt=>{"use strict";bt.exports=function(ve,S){return S||(S={}),ve&&(ve=String(ve.__esModule?ve.default:ve),/^['"].*['"]$/.test(ve)&&(ve=ve.slice(1,-1)),S.hash&&(ve+=S.hash),/["'() \t\n]|(%20)/.test(ve)||S.needQuotes?'"'.concat(ve.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):ve)}},10:(bt,ve,S)=>{"use strict";S.d(ve,{q:()=>ee});var p=S(9892),te=S(66111),Xe=S(72648);const Ve=10,ee=({colorPalette:Me,min:Ae,max:U,display:ue,hoverValue:De,useStopsPercentage:rt})=>{const[I,R]=(0,te.useState)([]),[k,B]=(0,te.useState)({isShown:!1,value:0}),[C,X]=(0,te.useState)(null),Y=(0,Xe.l4)(),Q=kt(Y,I);(0,te.useEffect)(()=>{R(Ye({colorArray:Me,stops:Ve,useStopsPercentage:rt}))},[Me,rt]);const de=_e=>{const me=_e.nativeEvent.offsetX,Pe=_e.currentTarget.offsetWidth,je=Math.floor(me*100/Pe+1),Ke=Math.floor((U-Ae)*je/100+Ae);B({isShown:!0,value:Ke}),X(je)},le=()=>{B({isShown:!1,value:0})};return(0,te.useEffect)(()=>{X(De==null?null:Lt((De-Ae)/(U-Ae)))},[De,Ae,U]),te.createElement("div",{className:Q.scaleWrapper,onMouseMove:de,onMouseLeave:le},te.createElement("div",{className:Q.scaleGradient},ue&&(k.isShown||De!==void 0)&&te.createElement("div",{className:Q.followerContainer},te.createElement("div",{className:Q.follower,style:{left:`${C}%`}}))),ue&&te.createElement("div",{className:Q.followerContainer},te.createElement("div",{className:Q.legendValues},te.createElement("span",null,ue(Ae)),te.createElement("span",null,ue(U))),C!=null&&(k.isShown||De!==void 0)&&te.createElement("span",{className:Q.hoverValue,style:{left:`${C}%`}},ue(De??k.value))))},Ye=({colorArray:Me,stops:Ae,useStopsPercentage:U=!0})=>{const ue=Me.length;if(U&&ue<=20){const R=1/ue*100;let k=0;const B=[];for(const C of Me)k>0?B.push(`${C} ${k}%`):B.push(C),k+=R,B.push(`${C} ${k}%`);return B}const De=Me[ue-1],rt=Math.ceil(ue/Ae),I=new Set;for(let R=0;R<ue;R+=rt)I.add(Me[R]);return I.add(De),[...I]};function Lt(Me){return Me>1?100:Me<0?0:Me*100}const kt=(Me,Ae)=>({scaleWrapper:p.css`
    width: 100%;
    font-size: 11px;
    opacity: 1;
  `,scaleGradient:p.css`
    background: linear-gradient(90deg, ${Ae.join()});
    height: 10px;
    pointer-events: none;
  `,legendValues:p.css`
    display: flex;
    justify-content: space-between;
    pointer-events: none;
  `,hoverValue:p.css`
    position: absolute;
    margin-top: -14px;
    padding: 3px 15px;
    background: ${Me.colors.background.primary};
    transform: translateX(-50%);
  `,followerContainer:p.css`
    position: relative;
    pointer-events: none;
    white-space: nowrap;
  `,follower:p.css`
    position: absolute;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    transform: translateX(-50%) translateY(-50%);
    border: 2px solid ${Me.colors.text.primary};
    margin-top: 5px;
  `})},72243:(bt,ve,S)=>{"use strict";S.d(ve,{f:()=>Xe});var p=S(66111),te=S(15670);const Xe=({onChange:Ve,options:ee,label:Ye})=>p.createElement(te.b,{icon:"plus",label:Ye,variant:"secondary",options:ee,onChange:Ve,isFullWidth:!0})},92465:(bt,ve,S)=>{"use strict";S.d(ve,{M:()=>Ve});var p=S(66111),te=S(90748),Xe=S(43657);const Ve=({value:ee,context:Ye,onChange:Lt})=>{const kt=(0,p.useCallback)(Me=>{Lt(Me?.length?{id:te.E4.byRefId,options:Me}:void 0)},[Lt]);return p.createElement(Xe.O,{value:ee?.options,onChange:kt,data:Ye.data,placeholder:"Change filter"})}},515:(bt,ve,S)=>{"use strict";S.r(ve),S.d(ve,{plugin:()=>ou});var p=S(66111),te=S(36873),Xe=S(35645),Ve=S(91511),ee=S(9892),Ye=S(65788),Lt=S(51770),kt=S(15359),Me=S(36552),Ae=S(51862),U=S(29501),ue=S(68511);const De="units",rt=[1,2,5],I=25.4/.28;class R extends Me.Z{constructor(e){e=e||{};const t=document.createElement("div");t.style.pointerEvents="none",super({element:t,render:e.render,target:e.target}),this.on,this.once,this.un;const i=e.className!==void 0?e.className:e.bar?"ol-scale-bar":"ol-scale-line";this.innerElement_=document.createElement("div"),this.innerElement_.className=i+"-inner",this.element.className=i+" "+Ae.XV,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=e.minWidth!==void 0?e.minWidth:64,this.maxWidth_=e.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",this.addChangeListener(De,this.handleUnitsChanged_),this.setUnits(e.units||"metric"),this.scaleBar_=e.bar||!1,this.scaleBarSteps_=e.steps||4,this.scaleBarText_=e.text||!1,this.dpi_=e.dpi||void 0}getUnits(){return this.get(De)}handleUnitsChanged_(){this.updateElement_()}setUnits(e){this.set(De,e)}setDpi(e){this.dpi_=e}updateElement_(){const e=this.viewState_;if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const t=e.center,i=e.projection,n=this.getUnits(),s=n=="degrees"?"degrees":"m";let o=(0,U._Q)(i,e.resolution,t,s);const a=this.minWidth_*(this.dpi_||I)/I,l=this.maxWidth_!==void 0?this.maxWidth_*(this.dpi_||I)/I:void 0;let h=a*o,c="";if(n=="degrees"){const E=U.Wm.degrees;h*=E,h<E/60?(c="\u2033",o*=3600):h<E?(c="\u2032",o*=60):c="\xB0"}else n=="imperial"?h<.9144?(c="in",o/=.0254):h<1609.344?(c="ft",o/=.3048):(c="mi",o/=1609.344):n=="nautical"?(o/=1852,c="NM"):n=="metric"?h<.001?(c="\u03BCm",o*=1e6):h<1?(c="mm",o*=1e3):h<1e3?c="m":(c="km",o/=1e3):n=="us"?h<.9144?(c="in",o*=39.37):h<1609.344?(c="ft",o/=.30480061):(c="mi",o/=1609.3472):(0,ue.h)(!1,33);let u=3*Math.floor(Math.log(a*o)/Math.log(10)),d,g,f,m,_,v;for(;;){f=Math.floor(u/3);const E=Math.pow(10,f);if(d=rt[(u%3+3)%3]*E,g=Math.round(d/o),isNaN(g)){this.element.style.display="none",this.renderedVisible_=!1;return}if(l!==void 0&&g>=l){d=m,g=_,f=v;break}else if(g>=a)break;m=d,_=g,v=f,++u}const w=this.scaleBar_?this.createScaleBar(g,d,c):d.toFixed(f<0?-f:0)+" "+c;this.renderedHTML_!=w&&(this.innerElement_.innerHTML=w,this.renderedHTML_=w),this.renderedWidth_!=g&&(this.innerElement_.style.width=g+"px",this.renderedWidth_=g),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}createScaleBar(e,t,i){const n=this.getScaleForResolution(),s=n<1?Math.round(1/n).toLocaleString()+" : 1":"1 : "+Math.round(n).toLocaleString(),o=this.scaleBarSteps_,a=e/o,l=[this.createMarker("absolute")];for(let c=0;c<o;++c){const u=c%2===0?"ol-scale-singlebar-odd":"ol-scale-singlebar-even";l.push(`<div><div class="ol-scale-singlebar ${u}" style="width: ${a}px;"></div>`+this.createMarker("relative")+(c%2===0||o===2?this.createStepText(c,e,!1,t,i):"")+"</div>")}return l.push(this.createStepText(o,e,!0,t,i)),(this.scaleBarText_?`<div class="ol-scale-text" style="width: ${e}px;">`+s+"</div>":"")+l.join("")}createMarker(e){return`<div class="ol-scale-step-marker" style="position: ${e}; top: ${e==="absolute"?3:-10}px;"></div>`}createStepText(e,t,i,n,s){const a=(e===0?0:Math.round(n/this.scaleBarSteps_*e*100)/100)+(e===0?"":" "+s),l=e===0?-3:t/this.scaleBarSteps_*-1,h=e===0?0:t/this.scaleBarSteps_*2;return`<div class="ol-scale-step-text" style="margin-left: ${l}px;text-align: ${e===0?"left":"center"};min-width: ${h}px;left: ${i?t+"px":"unset"};">`+a+"</div>"}getScaleForResolution(){const e=(0,U._Q)(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m"),t=this.dpi_||I,i=1e3/25.4;return e*i*t}render(e){const t=e.frameState;t?this.viewState_=t.viewState:this.viewState_=null,this.updateElement_()}}const k=R;var B=S(12658),C=S(55839),X=S(60545),Y=S(53376),Q=S(23588),de=S(60325),le=S(45984),_e=S(72648);const me=({topRight1:r,topRight2:e,bottomLeft:t,blStyle:i})=>{const n=(r&&r.length>0)??!1,s=(0,_e.wW)(Pe(n));return p.createElement("div",{className:s.overlay},Boolean(r?.length)&&p.createElement("div",{className:s.TR1},r),Boolean(e?.length)&&p.createElement("div",{className:s.TR2},e),Boolean(t?.length)&&p.createElement("div",{className:s.BL,style:i},t))},Pe=r=>e=>({overlay:ee.css`
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 500;
    pointer-events: none;
  `,TR1:ee.css`
    right: 0.5em;
    pointer-events: auto;
    position: absolute;
    top: 0.5em;
  `,TR2:ee.css`
    position: absolute;
    top: ${r?"80":"8"}px;
    right: 8px;
    pointer-events: auto;
  `,BL:ee.css`
    position: absolute;
    bottom: 8px;
    left: 8px;
    pointer-events: auto;
  `});var je=S(29952),Ke=S(86922),dt=S(85511),x=S(20888),T=S(50796),y=S(82897),F=S(99098),b=S(30471),P=S(94893),D=S(2352),W=S(56206),re=S(86029),ne=S(16225);const Fe=({feature:r})=>{let e,t=0;if(!r)return null;if(e=r.get("frame"),e)t=r.get("rowIndex");else{const{geometry:i,...n}=r.getProperties();e=new re.i([n])}return p.createElement(ne.H,{data:e,rowIndex:t})},Se=({layers:r,activeTabIndex:e})=>{const t=(0,_e.wW)(Be),[i,n]=(0,p.useState)(new Map),s=(o,a)=>{n(new Map(i.set(o,a)))};return p.createElement(P.I,null,r.map((o,a)=>a===e&&p.createElement("div",{key:o.layer.getName()},p.createElement("div",null,o.features.map((l,h)=>{const c=l.getId()??h;return o.features.length>1?p.createElement(D.U,{key:c,collapsible:!0,label:pe(l,h),isOpen:i.get(c),onToggle:()=>{s(c,!i.get(c))},className:t.collapsibleRow},p.createElement(Fe,{feature:l})):p.createElement(Fe,{key:c,feature:l})})))))},pe=(r,e)=>{const t=["Name","name","Title","ID","id"];let i=r.getProperties(),n="";const s=r.get("frame");if(s){const o=r.get("rowIndex");for(const a of s.fields)if(a.type===F.fS.string){const l=(0,b.CZ)(a,s);n||(n=l),i[l]=a.values[o]}}for(let o of t){const a=i[o];if(a)return a}if(n)return p.createElement("span",null,n,": ",(0,W.Q)(i[n]));for(let o of Object.keys(i)){const a=i[o];if((0,y.isString)(a))return p.createElement("span",null,o,": ",(0,W.Q)(a))}return`Match: ${e+1}`},Be=r=>({collapsibleRow:ee.css`
    margin-bottom: 0;
  `});var Te=S(72142),ci=S(79841);const ui=({layers:r,setActiveTabIndex:e,activeTabIndex:t})=>p.createElement(Te.J,null,r&&r.map((i,n)=>p.createElement(ci.O,{key:n,label:i.layer.getName(),active:n===t,counter:i.features.length>1?i.features.length:null,onChangeTab:()=>{e(n)}}))),dn=({layers:r,onClose:e,isOpen:t})=>{const[i,n]=(0,p.useState)(0);return r?p.createElement(p.Fragment,null,t&&p.createElement(T.P,{style:{zIndex:1},onClick:e}),p.createElement(ui,{layers:r,setActiveTabIndex:n,activeTabIndex:i}),p.createElement(Se,{layers:r,activeTabIndex:i})):null},fn=({ttip:r,onClose:e,isOpen:t})=>{const i=(0,p.createRef)(),{overlayProps:n}=(0,Ke.Ir)({onClose:e,isDismissable:!0,isOpen:t},i),{dialogProps:s}=(0,je.R)({},i);return p.createElement(p.Fragment,null,r&&r.layers&&p.createElement(dt.h_,null,p.createElement(x.S,{position:{x:r.pageX,y:r.pageY},offset:{x:10,y:10},allowPointerEvents:!0},p.createElement("section",{ref:i,...n,...s},p.createElement(dn,{layers:r.layers,isOpen:t,onClose:e})))))};var fe=S(28550),xe=S(68183),nr=S(7804),di=S(47694);class ea extends p.PureComponent{constructor(e){super(e),this.style=ta(di.vc.theme2),this.updateViewState=()=>{const t=this.props.map.getView();this.setState({zoom:t.getZoom(),center:(0,U.vs)(t.getCenter(),t.getProjection(),"EPSG:4326")})},this.state={zoom:0,center:[0,0]}}componentDidMount(){this.props.map.on("moveend",this.updateViewState),this.updateViewState()}render(){const{zoom:e,center:t}=this.state;return p.createElement("div",{className:this.style.infoWrap,"aria-label":xe.wl.components.DebugOverlay.wrapper},p.createElement("table",null,p.createElement("tbody",null,p.createElement("tr",null,p.createElement("th",null,"Zoom:"),p.createElement("td",null,e?.toFixed(1))),p.createElement("tr",null,p.createElement("th",null,"Center:\xA0"),p.createElement("td",null,t[0].toFixed(5),", ",t[1].toFixed(5))))))}}const ta=(0,nr.B)(r=>({infoWrap:ee.css`
    color: ${r.colors.text.primary};
    background: ${(0,fe.Z)(r.components.panel.background).setAlpha(.7).toString()};
    border-radius: 2px;
    padding: 8px;
  `}));var gn=S(2594),mn=S(31403),pi=S(8581),ts=S(8180),ft=S(2703);const $e=[{value:"length",label:"Length",geometry:"LineString",units:[{label:"Metric (m/km)",value:"m",format:r=>(0,ft.Cf)("lengthm")(r)},{label:"Feet (ft)",value:"ft",format:r=>(0,ft.Cf)("lengthft")(r*3.28084)},{label:"Miles (mi)",value:"mi",format:r=>(0,ft.Cf)("lengthmi")(r/1609)},{label:"Nautical miles (nmi)",value:"nmi",format:r=>(0,ft.Cf)("nmi")(r/1852)}],getUnit:r=>{const e=$e[0].units;return r?.endsWith("2")&&(r=r.substring(0,r.length-1)),e.find(t=>t.value===r)??e[0]}},{value:"area",label:"Area",geometry:"Polygon",units:[{label:"Square Meters (m\xB2)",value:"m2",format:r=>(0,ft.Cf)("areaM2")(r)},{label:"Square Kilometers (km\xB2)",value:"km2",format:r=>(0,ft.q2)("km\xB2")(r*1e-6)},{label:"Square Feet (ft\xB2)",value:"ft2",format:r=>(0,ft.Cf)("areaF2")(r*10.76391)},{label:"Square Miles (mi\xB2)",value:"mi2",format:r=>(0,ft.Cf)("areaMI2")(r*3861e-10)},{label:"Acres",value:"acre2",format:r=>(0,ft.q2)("acre")(r*247105e-9)},{label:"Hectare",value:"hectare2",format:r=>(0,ft.q2)("ha")(r*1e-4)}],getUnit:r=>{const e=$e[1].units;return r?.endsWith("2")||(r+="2"),e.find(t=>t.value===r)??e[0]}}];var et=S(17792),Bt=S(63897),is=S(19220),_n=S(37368),pn=S(21268),ot=S(77403),tt=S(13298),gt=S(60505),sr=S(95075),rr=S(43788),J=S(14378),Ui=S(55864);class ia{constructor(e){this.rbush_=new rr(e),this.items_={}}insert(e,t){const i={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(i),this.items_[(0,J.sq)(t)]=i}load(e,t){const i=new Array(t.length);for(let n=0,s=t.length;n<s;n++){const o=e[n],a=t[n],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};i[n]=l,this.items_[(0,J.sq)(a)]=l}this.rbush_.load(i)}remove(e){const t=(0,J.sq)(e),i=this.items_[t];return delete this.items_[t],this.rbush_.remove(i)!==null}update(e,t){const i=this.items_[(0,J.sq)(t)],n=[i.minX,i.minY,i.maxX,i.maxY];(0,C.fS)(n,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){const t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(n){return n.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let i;for(let n=0,s=e.length;n<s;n++)if(i=t(e[n]),i)return i;return i}isEmpty(){return(0,Ui.x)(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){const t=this.rbush_.toJSON();return(0,C.T9)(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(const t in e.items_)this.items_[t]=e.items_[t]}}const ns=ia,Ne={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var or=S(1607);const Oe={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};var it=S(89074);class ss{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=(0,it.Pq)(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){const e=this.getScale();return new ss({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return(0,J.O3)()}getImage(e){return(0,J.O3)()}getHitDetectionImage(){return(0,J.O3)()}getPixelRatio(e){return 1}getImageState(){return(0,J.O3)()}getImageSize(){return(0,J.O3)()}getOrigin(){return(0,J.O3)()}getSize(){return(0,J.O3)()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=(0,it.Pq)(e)}listenImageChange(e){(0,J.O3)()}load(){(0,J.O3)()}unlistenImageChange(e){(0,J.O3)()}}const ar=ss;var mt=S(20381);function Ft(r){return Array.isArray(r)?(0,mt.BB)(r):r}var ke=S(93687),Z=S(24030);class rs extends ar{constructor(e){const t=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:1,rotateWithView:t,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.canvas_=void 0,this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius_=e.radius!==void 0?e.radius:e.radius1,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_=null,this.renderOptions_=null,this.render()}clone(){const e=this.getScale(),t=new rs({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){const e=this.size_;if(!e)return null;const t=this.getDisplacement(),i=this.getScaleArray();return[e[0]/2-t[0]/i[0],e[1]/2+t[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_}getImage(e){let t=this.canvas_[e];if(!t){const i=this.renderOptions_,n=(0,ke.E4)(i.size*e,i.size*e);this.draw_(i,n,e),t=n.canvas,this.canvas_[e]=t}return t}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return Oe.LOADED}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius_}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,i){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let n=this.radius_,s=this.radius2_===void 0?n:this.radius2_;if(n<s){const A=n;n=s,s=A}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),h=Math.sqrt(s*s-l*l),c=n-h,u=Math.sqrt(l*l+c*c),d=u/l;if(e==="miter"&&d<=i)return d*t;const g=t/2/d,f=t/2*(c/u),_=Math.sqrt((n+g)*(n+g)+f*f)-n;if(this.radius2_===void 0||e==="bevel")return _*2;const v=n*Math.sin(a),w=Math.sqrt(n*n-v*v),E=s-w,M=Math.sqrt(v*v+E*E)/v;if(M<=i){const A=M*t/2-s-n;return 2*Math.max(_,A)}return _*2}createRenderOptions(){let e=Z.rc,t=0,i=null,n=0,s,o=0;this.stroke_&&(s=this.stroke_.getColor(),s===null&&(s=Z.Tx),s=Ft(s),o=this.stroke_.getWidth(),o===void 0&&(o=Z.yC),i=this.stroke_.getLineDash(),n=this.stroke_.getLineDashOffset(),e=this.stroke_.getLineJoin(),e===void 0&&(e=Z.rc),t=this.stroke_.getMiterLimit(),t===void 0&&(t=Z.V4));const a=this.calculateLineJoinSize_(e,o,t),l=Math.max(this.radius_,this.radius2_||0),h=Math.ceil(2*l+a);return{strokeStyle:s,strokeWidth:o,size:h,lineDash:i,lineDashOffset:n,lineJoin:e,miterLimit:t}}render(){this.renderOptions_=this.createRenderOptions();const e=this.renderOptions_.size;this.canvas_={},this.size_=[e,e]}draw_(e,t,i){if(t.scale(i,i),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let n=this.fill_.getColor();n===null&&(n=Z.bL),t.fillStyle=Ft(n),t.fill()}this.stroke_&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){if(this.fill_){let t=this.fill_.getColor(),i=0;if(typeof t=="string"&&(t=(0,mt._2)(t)),t===null?i=1:Array.isArray(t)&&(i=t.length===4?t[3]:1),i===0){const n=(0,ke.E4)(e.size,e.size);this.hitDetectionCanvas_=n.canvas,this.drawHitDetectionCanvas_(e,n)}}this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.getImage(1))}createPath_(e){let t=this.points_;const i=this.radius_;if(t===1/0)e.arc(0,0,i,0,2*Math.PI);else{const n=this.radius2_===void 0?i:this.radius2_;this.radius2_!==void 0&&(t*=2);const s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){const l=s+a*o,h=a%2===0?i:n;e.lineTo(h*Math.cos(l),h*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=Z.bL,t.fill(),this.stroke_&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}}const He=rs;class os extends He{constructor(e){e=e||{radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale!==void 0?e.scale:1,rotation:e.rotation!==void 0?e.rotation:0,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){const e=this.getScale(),t=new os({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}setRadius(e){this.radius_=e,this.render()}}const Ct=os;class as{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null}clone(){const e=this.getColor();return new as({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){this.color_=e}}const Ie=as;class ls{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.width_=e.width}clone(){const e=this.getColor();return new ls({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setWidth(e){this.width_=e}}const Re=ls;class Ht{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=hr,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill!==void 0?e.fill:null,this.image_=e.image!==void 0?e.image:null,this.renderer_=e.renderer!==void 0?e.renderer:null,this.hitDetectionRenderer_=e.hitDetectionRenderer!==void 0?e.hitDetectionRenderer:null,this.stroke_=e.stroke!==void 0?e.stroke:null,this.text_=e.text!==void 0?e.text:null,this.zIndex_=e.zIndex}clone(){let e=this.getGeometry();return e&&typeof e=="object"&&(e=e.clone()),new Ht({geometry:e,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer(),stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e=="function"?this.geometryFunction_=e:typeof e=="string"?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=hr,this.geometry_=e}setZIndex(e){this.zIndex_=e}}function na(r){let e;if(typeof r=="function")e=r;else{let t;Array.isArray(r)?t=r:((0,ue.h)(typeof r.getZIndex=="function",41),t=[r]),e=function(){return t}}return e}let hs=null;function sa(r,e){if(!hs){const t=new Ie({color:"rgba(255,255,255,0.4)"}),i=new Re({color:"#3399CC",width:1.25});hs=[new Ht({image:new Ct({fill:t,stroke:i,radius:5}),fill:t,stroke:i})]}return hs}function lr(){const r={},e=[255,255,255,1],t=[0,153,255,1],i=3;return r.Polygon=[new Ht({fill:new Ie({color:[255,255,255,.5]})})],r.MultiPolygon=r.Polygon,r.LineString=[new Ht({stroke:new Re({color:e,width:i+2})}),new Ht({stroke:new Re({color:t,width:i})})],r.MultiLineString=r.LineString,r.Circle=r.Polygon.concat(r.LineString),r.Point=[new Ht({image:new Ct({radius:i*2,fill:new Ie({color:t}),stroke:new Re({color:e,width:i/2})}),zIndex:1/0})],r.MultiPoint=r.Point,r.GeometryCollection=r.Polygon.concat(r.LineString,r.Point),r}function hr(r){return r.getGeometry()}const ge=Ht;var cr=S(55837),ur=S(19870),dr=S(32458),Je=S(81115);class cu extends null{constructor(e,t,i,n,s,o){super(e,t,i,ImageState.IDLE),this.src_=n,this.image_=new Image,s!==null&&(this.image_.crossOrigin=s),this.unlisten_=null,this.state=ImageState.IDLE,this.imageLoadFunction_=o}getImage(){return this.image_}handleImageError_(){this.state=ImageState.ERROR,this.unlistenImage_(),this.changed()}handleImageLoad_(){this.resolution===void 0&&(this.resolution=getHeight(this.extent)/this.image_.height),this.state=ImageState.LOADED,this.unlistenImage_(),this.changed()}load(){(this.state==ImageState.IDLE||this.state==ImageState.ERROR)&&(this.state=ImageState.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=cs(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}setImage(e){this.image_=e,this.resolution=getHeight(this.extent)/this.image_.height}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function cs(r,e,t){const i=r;let n=!0,s=!1,o=!1;const a=[(0,Je.Vx)(i,ot.Z.LOAD,function(){o=!0,s||e()})];return i.src&&dr.Tp?(s=!0,i.decode().then(function(){n&&e()}).catch(function(l){n&&(o?e():t())})):a.push((0,Je.Vx)(i,ot.Z.ERROR,t)),function(){n=!1,a.forEach(Je.bN)}}const uu=null;let Xi=null;class ra extends cr.Z{constructor(e,t,i,n,s,o){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n,this.canvas_={},this.color_=o,this.unlisten_=null,this.imageState_=s,this.size_=i,this.src_=t,this.tainted_}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Oe.LOADED){Xi||(Xi=(0,ke.E4)(1,1,void 0,{willReadFrequently:!0})),Xi.drawImage(this.image_,0,0);try{Xi.getImageData(0,0,1,1),this.tainted_=!1}catch{Xi=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(ot.Z.CHANGE)}handleImageError_(){this.imageState_=Oe.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Oe.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const e=this.size_[0],t=this.size_[1],i=(0,ke.E4)(e,t);i.fillRect(0,0,e,t),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Oe.IDLE){this.image_||this.initializeImage_(),this.imageState_=Oe.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=cs(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Oe.LOADED)return;const t=this.image_,i=document.createElement("canvas");i.width=Math.ceil(t.width*e),i.height=Math.ceil(t.height*e);const n=i.getContext("2d");n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation="multiply",n.fillStyle=(0,mt.XC)(this.color_),n.fillRect(0,0,i.width/e,i.height/e),n.globalCompositeOperation="destination-in",n.drawImage(t,0,0),this.canvas_[e]=i}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function oa(r,e,t,i,n,s){let o=ur.c.get(e,i,s);return o||(o=new ra(r,e,t,i,n,s),ur.c.set(e,i,s,o)),o}const du=null;class us extends ar{constructor(e){e=e||{};const t=e.opacity!==void 0?e.opacity:1,i=e.rotation!==void 0?e.rotation:0,n=e.scale!==void 0?e.scale:1,s=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:i,scale:n,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:s,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null;const o=e.img!==void 0?e.img:null;this.imgSize_=e.imgSize;let a=e.src;(0,ue.h)(!(a!==void 0&&o),4),(0,ue.h)(!o||o&&this.imgSize_,5),(a===void 0||a.length===0)&&o&&(a=o.src||(0,J.sq)(o)),(0,ue.h)(a!==void 0&&a.length>0,6),(0,ue.h)(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),69);const l=e.src!==void 0?Oe.IDLE:Oe.LOADED;if(this.color_=e.color!==void 0?(0,mt._2)(e.color):null,this.iconImage_=oa(o,a,this.imgSize_!==void 0?this.imgSize_:null,this.crossOrigin_,l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,this.width_=e.width,this.height_=e.height,this.width_!==void 0||this.height_!==void 0){const h=this.getImage(1),c=()=>{this.updateScaleFromWidthAndHeight(this.width_,this.height_)};h.width>0?this.updateScaleFromWidthAndHeight(this.width_,this.height_):h.addEventListener("load",c)}}clone(){const e=this.getScale();return new us({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:Array.isArray(e)?e.slice():e,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode(),width:this.width_,height:this.height_})}updateScaleFromWidthAndHeight(e,t){const i=this.getImage(1);e!==void 0&&t!==void 0?super.setScale([e/i.width,t/i.height]):e!==void 0?super.setScale([e/i.width,e/i.width]):t!==void 0?super.setScale([t/i.height,t/i.height]):super.setScale([1,1])}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;const n=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!n)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=n[0]),this.anchorYUnits_=="fraction"&&(e[1]*=n[1])}if(this.anchorOrigin_!="top-left"){if(!n)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+n[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+n[1])}this.normalizedAnchor_=e}const t=this.getDisplacement(),i=this.getScaleArray();return[e[0]-t[0]/i[0],e[1]+t[1]/i[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){const t=this.getSize(),i=this.iconImage_.getSize();if(!t||!i)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=i[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=i[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){return this.width_}getHeight(){return this.height_}setWidth(e){this.width_=e,this.updateScaleFromWidthAndHeight(e,this.height_)}setHeight(e){this.height_=e,this.updateScaleFromWidthAndHeight(this.width_,e)}setScale(e){super.setScale(e);const t=this.getImage(1);if(t){const i=Array.isArray(e)?e[0]:e;i!==void 0&&(this.width_=i*t.width);const n=Array.isArray(e)?e[1]:e;n!==void 0&&(this.height_=n*t.height)}}listenImageChange(e){this.iconImage_.addEventListener(ot.Z.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(ot.Z.CHANGE,e)}}const xn=us,aa="#333";class ds{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.scaleArray_=(0,it.Pq)(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new Ie({color:aa}),this.maxAngle_=e.maxAngle!==void 0?e.maxAngle:Math.PI/4,this.placement_=e.placement!==void 0?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=e.stroke!==void 0?e.stroke:null,this.offsetX_=e.offsetX!==void 0?e.offsetX:0,this.offsetY_=e.offsetY!==void 0?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding}clone(){const e=this.getScale();return new ds({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRotateWithView(e){this.rotateWithView_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=(0,it.Pq)(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}}const xi=ds;function fr(r){return new ge({fill:Vi(r,""),stroke:Yi(r,""),text:la(r),image:ha(r)})}function Vi(r,e){const t=r[e+"fill-color"];if(t)return new Ie({color:t})}function Yi(r,e){const t=r[e+"stroke-width"],i=r[e+"stroke-color"];if(!(!t&&!i))return new Re({width:t,color:i,lineCap:r[e+"stroke-line-cap"],lineJoin:r[e+"stroke-line-join"],lineDash:r[e+"stroke-line-dash"],lineDashOffset:r[e+"stroke-line-dash-offset"],miterLimit:r[e+"stroke-miter-limit"]})}function la(r){const e=r["text-value"];return e?new xi({text:e,font:r["text-font"],maxAngle:r["text-max-angle"],offsetX:r["text-offset-x"],offsetY:r["text-offset-y"],overflow:r["text-overflow"],placement:r["text-placement"],scale:r["text-scale"],rotateWithView:r["text-rotate-with-view"],rotation:r["text-rotation"],textAlign:r["text-align"],justify:r["text-justify"],textBaseline:r["text-baseline"],padding:r["text-padding"],fill:Vi(r,"text-"),backgroundFill:Vi(r,"text-background-"),stroke:Yi(r,"text-"),backgroundStroke:Yi(r,"text-background-")}):void 0}function ha(r){const e=r["icon-src"],t=r["icon-img"];if(e||t)return new xn({src:e,img:t,imgSize:r["icon-img-size"],anchor:r["icon-anchor"],anchorOrigin:r["icon-anchor-origin"],anchorXUnits:r["icon-anchor-x-units"],anchorYUnits:r["icon-anchor-y-units"],color:r["icon-color"],crossOrigin:r["icon-cross-origin"],offset:r["icon-offset"],displacement:r["icon-displacement"],opacity:r["icon-opacity"],scale:r["icon-scale"],rotation:r["icon-rotation"],rotateWithView:r["icon-rotate-with-view"],size:r["icon-size"],declutterMode:r["icon-declutter-mode"]});const i=r["shape-points"];if(i){const s="shape-";return new He({points:i,fill:Vi(r,s),stroke:Yi(r,s),radius:r["shape-radius"],radius1:r["shape-radius1"],radius2:r["shape-radius2"],angle:r["shape-angle"],displacement:r["shape-displacement"],rotation:r["shape-rotation"],rotateWithView:r["shape-rotate-with-view"],scale:r["shape-scale"],declutterMode:r["shape-declutter-mode"]})}const n=r["circle-radius"];if(n){const s="circle-";return new Ct({radius:n,fill:Vi(r,s),stroke:Yi(r,s),displacement:r["circle-displacement"],scale:r["circle-scale"],rotation:r["circle-rotation"],rotateWithView:r["circle-rotate-with-view"],declutterMode:r["circle-declutter-mode"]})}}const gr={RENDER_ORDER:"renderOrder"};class ca extends or.Z{constructor(e){e=e||{};const t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter!==void 0?e.declutter:!1,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(gr.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e){e.declutterTree||(e.declutterTree=new rr(9)),this.getRenderer().renderDeclutter(e)}setRenderOrder(e){this.set(gr.RENDER_ORDER,e)}setStyle(e){let t;if(e===void 0)t=sa;else if(e===null)t=null;else if(typeof e=="function")t=e;else if(e instanceof ge)t=e;else if(Array.isArray(e)){const i=e.length,n=new Array(i);for(let s=0;s<i;++s){const o=e[s];o instanceof ge?n[s]=o:n[s]=fr(o)}t=n}else t=fr(e);this.style_=t,this.styleFunction_=e===null?void 0:na(this.style_),this.changed()}}const fs=ca,ji={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},yn=[ji.FILL],Kt=[ji.STROKE],fi=[ji.BEGIN_PATH],mr=[ji.CLOSE_PATH],se=ji;var ua=S(48233);class da{drawCustom(e,t,i,n){}drawGeometry(e){}setStyle(e){}drawCircle(e,t){}drawFeature(e,t){}drawGeometryCollection(e,t){}drawLineString(e,t){}drawMultiLineString(e,t){}drawMultiPoint(e,t){}drawMultiPolygon(e,t){}drawPoint(e,t){}drawPolygon(e,t){}drawText(e,t){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}}const _r=da;var qe=S(87826),$t=S(45622);class fa extends _r{constructor(e,t,i,n){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=n,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(e){const t=this.pixelRatio;return t==1?e:e.map(function(i){return i*t})}appendFlatPointCoordinates(e,t){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,s=this.coordinates;let o=s.length;for(let a=0,l=e.length;a<l;a+=t)n[0]=e[a],n[1]=e[a+1],(0,C.b8)(i,n)&&(s[o++]=n[0],s[o++]=n[1]);return o}appendFlatLineCoordinates(e,t,i,n,s,o){const a=this.coordinates;let l=a.length;const h=this.getBufferedMaxExtent();o&&(t+=n);let c=e[t],u=e[t+1];const d=this.tmpCoordinate_;let g=!0,f,m,_;for(f=t+n;f<i;f+=n)d[0]=e[f],d[1]=e[f+1],_=(0,C.pX)(h,d),_!==m?(g&&(a[l++]=c,a[l++]=u,g=!1),a[l++]=d[0],a[l++]=d[1]):_===ua.Z.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],g=!1):g=!0,c=d[0],u=d[1],m=_;return(s&&g||f===t+n)&&(a[l++]=c,a[l++]=u),l}drawCustomCoordinates_(e,t,i,n,s){for(let o=0,a=i.length;o<a;++o){const l=i[o],h=this.appendFlatLineCoordinates(e,t,l,n,!1,!1);s.push(h),t=l}return t}drawCustom(e,t,i,n){this.beginGeometry(e,t);const s=e.getType(),o=e.getStride(),a=this.coordinates.length;let l,h,c,u,d;switch(s){case"MultiPolygon":l=e.getOrientedFlatCoordinates(),u=[];const g=e.getEndss();d=0;for(let f=0,m=g.length;f<m;++f){const _=[];d=this.drawCustomCoordinates_(l,d,g[f],o,_),u.push(_)}this.instructions.push([se.CUSTOM,a,u,e,i,$t.ug]),this.hitDetectionInstructions.push([se.CUSTOM,a,u,e,n||i,$t.ug]);break;case"Polygon":case"MultiLineString":c=[],l=s=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,e.getEnds(),o,c),this.instructions.push([se.CUSTOM,a,c,e,i,$t.o1]),this.hitDetectionInstructions.push([se.CUSTOM,a,c,e,n||i,$t.o1]);break;case"LineString":case"Circle":l=e.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([se.CUSTOM,a,h,e,i,$t.Ml]),this.hitDetectionInstructions.push([se.CUSTOM,a,h,e,n||i,$t.Ml]);break;case"MultiPoint":l=e.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([se.CUSTOM,a,h,e,i,$t.Ml]),this.hitDetectionInstructions.push([se.CUSTOM,a,h,e,n||i,$t.Ml]));break;case"Point":l=e.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([se.CUSTOM,a,h,e,i]),this.hitDetectionInstructions.push([se.CUSTOM,a,h,e,n||i]);break;default:}this.endGeometry(t)}beginGeometry(e,t){this.beginGeometryInstruction1_=[se.BEGIN_GEOMETRY,t,0,e],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[se.BEGIN_GEOMETRY,t,0,e],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const e=this.hitDetectionInstructions;e.reverse();let t;const i=e.length;let n,s,o=-1;for(t=0;t<i;++t)n=e[t],s=n[0],s==se.END_GEOMETRY?o=t:s==se.BEGIN_GEOMETRY&&(n[2]=t,(0,qe.FZ)(this.hitDetectionInstructions,o,t),o=-1)}setFillStrokeStyle(e,t){const i=this.state;if(e){const n=e.getColor();i.fillStyle=Ft(n||Z.bL)}else i.fillStyle=void 0;if(t){const n=t.getColor();i.strokeStyle=Ft(n||Z.Tx);const s=t.getLineCap();i.lineCap=s!==void 0?s:Z.mb;const o=t.getLineDash();i.lineDash=o?o.slice():Z.X9;const a=t.getLineDashOffset();i.lineDashOffset=a||Z.He;const l=t.getLineJoin();i.lineJoin=l!==void 0?l:Z.rc;const h=t.getWidth();i.lineWidth=h!==void 0?h:Z.yC;const c=t.getMiterLimit();i.miterLimit=c!==void 0?c:Z.V4,i.lineWidth>this.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(e){const t=e.fillStyle,i=[se.SET_FILL_STYLE,t];return typeof t!="string"&&i.push(!0),i}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[se.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,this.applyPixelRatio(e.lineDash),e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){const i=e.fillStyle;(typeof i!="string"||e.currentFillStyle!=i)&&(i!==void 0&&this.instructions.push(t.call(this,e)),e.currentFillStyle=i)}updateStrokeStyle(e,t){const i=e.strokeStyle,n=e.lineCap,s=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,h=e.miterLimit;(e.currentStrokeStyle!=i||e.currentLineCap!=n||s!=e.currentLineDash&&!(0,qe.fS)(e.currentLineDash,s)||e.currentLineDashOffset!=o||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=h)&&(i!==void 0&&t.call(this,e),e.currentStrokeStyle=i,e.currentLineCap=n,e.currentLineDash=s,e.currentLineDashOffset=o,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=h)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const t=[se.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=(0,C.d9)(this.maxExtent),this.maxLineWidth>0)){const e=this.resolution*(this.maxLineWidth+1)/2;(0,C.f3)(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}const Hi=fa;class ga extends Hi{constructor(e,t,i,n){super(e,t,i,n),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(e,t){if(!this.image_)return;this.beginGeometry(e,t);const i=e.getFlatCoordinates(),n=e.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([se.DRAW_IMAGE,s,o,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([se.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t){if(!this.image_)return;this.beginGeometry(e,t);const i=e.getFlatCoordinates(),n=e.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([se.DRAW_IMAGE,s,o,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([se.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}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(e,t){const i=e.getAnchor(),n=e.getSize(),s=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=e.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=n[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}const ma=ga;class _a extends Hi{constructor(e,t,i,n){super(e,t,i,n)}drawFlatCoordinates_(e,t,i,n){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(e,t,i,n,!1,!1),a=[se.MOVE_TO_LINE_TO,s,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(e,t){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(n===void 0||s===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(e,t),this.hitDetectionInstructions.push([se.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Z.X9,Z.He],fi);const o=e.getFlatCoordinates(),a=e.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(Kt),this.endGeometry(t)}drawMultiLineString(e,t){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(n===void 0||s===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(e,t),this.hitDetectionInstructions.push([se.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],fi);const o=e.getEnds(),a=e.getFlatCoordinates(),l=e.getStride();let h=0;for(let c=0,u=o.length;c<u;++c)h=this.drawFlatCoordinates_(a,h,o[c],l);this.hitDetectionInstructions.push(Kt),this.endGeometry(t)}finish(){const e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Kt),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Kt),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(fi)}}const pa=_a;var xa=S(48101);class ya extends Hi{constructor(e,t,i,n){super(e,t,i,n)}drawFlatCoordinatess_(e,t,i,n){const s=this.state,o=s.fillStyle!==void 0,a=s.strokeStyle!==void 0,l=i.length;this.instructions.push(fi),this.hitDetectionInstructions.push(fi);for(let h=0;h<l;++h){const c=i[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(e,t,c,n,!0,!a),g=[se.MOVE_TO_LINE_TO,u,d];this.instructions.push(g),this.hitDetectionInstructions.push(g),a&&(this.instructions.push(mr),this.hitDetectionInstructions.push(mr)),t=c}return o&&(this.instructions.push(yn),this.hitDetectionInstructions.push(yn)),a&&(this.instructions.push(Kt),this.hitDetectionInstructions.push(Kt)),t}drawCircle(e,t){const i=this.state,n=i.fillStyle,s=i.strokeStyle;if(n===void 0&&s===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([se.SET_FILL_STYLE,Z.bL]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([se.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);const o=e.getFlatCoordinates(),a=e.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(o,0,o.length,a,!1,!1);const h=[se.CIRCLE,l];this.instructions.push(fi,h),this.hitDetectionInstructions.push(fi,h),i.fillStyle!==void 0&&(this.instructions.push(yn),this.hitDetectionInstructions.push(yn)),i.strokeStyle!==void 0&&(this.instructions.push(Kt),this.hitDetectionInstructions.push(Kt)),this.endGeometry(t)}drawPolygon(e,t){const i=this.state,n=i.fillStyle,s=i.strokeStyle;if(n===void 0&&s===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([se.SET_FILL_STYLE,Z.bL]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([se.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);const o=e.getEnds(),a=e.getOrientedFlatCoordinates(),l=e.getStride();this.drawFlatCoordinatess_(a,0,o,l),this.endGeometry(t)}drawMultiPolygon(e,t){const i=this.state,n=i.fillStyle,s=i.strokeStyle;if(n===void 0&&s===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([se.SET_FILL_STYLE,Z.bL]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([se.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);const o=e.getEndss(),a=e.getOrientedFlatCoordinates(),l=e.getStride();let h=0;for(let c=0,u=o.length;c<u;++c)h=this.drawFlatCoordinatess_(a,h,o[c],l);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const e=this.tolerance;if(e!==0){const t=this.coordinates;for(let i=0,n=t.length;i<n;++i)t[i]=(0,xa.uZ)(t[i],e)}return super.finish()}setFillStrokeStyles_(){const e=this.state;e.fillStyle!==void 0&&this.updateFillStyle(e,this.createFill),e.strokeStyle!==void 0&&this.updateStrokeStyle(e,this.applyStroke)}}const pr=ya;function va(r,e,t,i,n){let s=t,o=t,a=0,l=0,h=t,c,u,d,g,f,m,_,v,w,E;for(u=t;u<i;u+=n){const L=e[u],M=e[u+1];f!==void 0&&(w=L-f,E=M-m,g=Math.sqrt(w*w+E*E),_!==void 0&&(l+=d,c=Math.acos((_*w+v*E)/(d*g)),c>r&&(l>a&&(a=l,s=h,o=u),l=0,h=u-n)),d=g,_=w,v=E),f=L,m=M}return l+=g,l>a?[h,u]:[s,o]}const Ki={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class Ea extends Hi{constructor(e,t,i,n){super(e,t,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterImageWithText_=void 0}finish(){const e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t){const i=this.textFillState_,n=this.textStrokeState_,s=this.textState_;if(this.text_===""||!s||!i&&!n)return;const o=this.coordinates;let a=o.length;const l=e.getType();let h=null,c=e.getStride();if(s.placement==="line"&&(l=="LineString"||l=="MultiLineString"||l=="Polygon"||l=="MultiPolygon")){if(!(0,C.kK)(this.getBufferedMaxExtent(),e.getExtent()))return;let u;if(h=e.getFlatCoordinates(),l=="LineString")u=[h.length];else if(l=="MultiLineString")u=e.getEnds();else if(l=="Polygon")u=e.getEnds().slice(0,1);else if(l=="MultiPolygon"){const m=e.getEndss();u=[];for(let _=0,v=m.length;_<v;++_)u.push(m[_][0])}this.beginGeometry(e,t);const d=s.textAlign;let g=0,f;for(let m=0,_=u.length;m<_;++m){if(d==null){const w=va(s.maxAngle,h,g,u[m],c);g=w[0],f=w[1]}else f=u[m];for(let w=g;w<f;w+=c)o.push(h[w],h[w+1]);const v=o.length;g=u[m],this.drawChars_(a,v),a=v}this.endGeometry(t)}else{let u=s.overflow?null:[];switch(l){case"Point":case"MultiPoint":h=e.getFlatCoordinates();break;case"LineString":h=e.getFlatMidpoint();break;case"Circle":h=e.getCenter();break;case"MultiLineString":h=e.getFlatMidpoints(),c=2;break;case"Polygon":h=e.getFlatInteriorPoint(),s.overflow||u.push(h[2]/this.resolution),c=3;break;case"MultiPolygon":const _=e.getFlatInteriorPoints();h=[];for(let v=0,w=_.length;v<w;v+=3)s.overflow||u.push(_[v+2]/this.resolution),h.push(_[v],_[v+1]);if(h.length===0)return;c=2;break;default:}const d=this.appendFlatPointCoordinates(h,c);if(d===a)return;if(u&&(d-a)/2!==h.length/c){let _=a/2;u=u.filter((v,w)=>{const E=o[(_+w)*2]===h[w*c]&&o[(_+w)*2+1]===h[w*c+1];return E||--_,E})}this.saveTextStates_(),(s.backgroundFill||s.backgroundStroke)&&(this.setFillStrokeStyle(s.backgroundFill,s.backgroundStroke),s.backgroundFill&&(this.updateFillStyle(this.state,this.createFill),this.hitDetectionInstructions.push(this.createFill(this.state))),s.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(e,t);let g=s.padding;if(g!=Z.oB&&(s.scale[0]<0||s.scale[1]<0)){let _=s.padding[0],v=s.padding[1],w=s.padding[2],E=s.padding[3];s.scale[0]<0&&(v=-v,E=-E),s.scale[1]<0&&(_=-_,w=-w),g=[_,v,w,E]}const f=this.pixelRatio;this.instructions.push([se.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,g==Z.oB?Z.oB:g.map(function(_){return _*f}),!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]);const m=1/f;this.hitDetectionInstructions.push([se.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[m,m],NaN,void 0,this.declutterImageWithText_,g,!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]),this.endGeometry(t)}}saveTextStates_(){const e=this.textStrokeState_,t=this.textState_,i=this.textFillState_,n=this.strokeKey_;e&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));const s=this.textKey_;s in this.textStates||(this.textStates[s]={font:t.font,textAlign:t.textAlign||Z.PH,justify:t.justify,textBaseline:t.textBaseline||Z.ru,scale:t.scale});const o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(e,t){const i=this.textStrokeState_,n=this.textState_,s=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,h=Ki[n.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([se.DRAW_CHARS,e,t,h,n.overflow,a,n.maxAngle,l,c,s,d*l,u,o,1]),this.hitDetectionInstructions.push([se.DRAW_CHARS,e,t,h,n.overflow,a,n.maxAngle,1,c,s,d,u,o,1/l])}setTextStyle(e,t){let i,n,s;if(!e)this.text_="";else{const o=e.getFill();o?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=Ft(o.getColor()||Z.bL)):(n=null,this.textFillState_=n);const a=e.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);const f=a.getLineDash(),m=a.getLineDashOffset(),_=a.getWidth(),v=a.getMiterLimit();s.lineCap=a.getLineCap()||Z.mb,s.lineDash=f?f.slice():Z.X9,s.lineDashOffset=m===void 0?Z.He:m,s.lineJoin=a.getLineJoin()||Z.rc,s.lineWidth=_===void 0?Z.yC:_,s.miterLimit=v===void 0?Z.V4:v,s.strokeStyle=Ft(a.getColor()||Z.Tx)}i=this.textState_;const l=e.getFont()||Z.Df;(0,Z.Qx)(l);const h=e.getScaleArray();i.overflow=e.getOverflow(),i.font=l,i.maxAngle=e.getMaxAngle(),i.placement=e.getPlacement(),i.textAlign=e.getTextAlign(),i.justify=e.getJustify(),i.textBaseline=e.getTextBaseline()||Z.ru,i.backgroundFill=e.getBackgroundFill(),i.backgroundStroke=e.getBackgroundStroke(),i.padding=e.getPadding()||Z.oB,i.scale=h===void 0?[1,1]:h;const c=e.getOffsetX(),u=e.getOffsetY(),d=e.getRotateWithView(),g=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textRotation_=g===void 0?0:g,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:(0,J.sq)(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n?typeof n.fillStyle=="string"?n.fillStyle:"|"+(0,J.sq)(n.fillStyle):""}this.declutterImageWithText_=t}}const wa={Circle:pr,Default:Hi,Image:ma,LineString:pa,Polygon:pr,Text:Ea};class Ca{constructor(e,t,i,n){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const e={};for(const t in this.buildersByZIndex_){e[t]=e[t]||{};const i=this.buildersByZIndex_[t];for(const n in i){const s=i[n].finish();e[t][n]=s}}return e}getBuilder(e,t){const i=e!==void 0?e.toString():"0";let n=this.buildersByZIndex_[i];n===void 0&&(n={},this.buildersByZIndex_[i]=n);let s=n[t];if(s===void 0){const o=wa[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[t]=s}return s}}const xr=Ca;var gs=S(48616);class Sa extends gs.Z{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.declutterExecutorGroup=null}getFeatures(e){return(0,J.O3)()}getData(e){return null}prepareFrame(e){return(0,J.O3)()}renderFrame(e,t){return(0,J.O3)()}loadedTileCallback(e,t,i){e[t]||(e[t]={}),e[t][i.tileCoord.toString()]=i}createLoadedTileFinder(e,t,i){return(n,s)=>{const o=this.loadedTileCallback.bind(this,i,n);return e.forEachLoadedTile(t,n,s,o)}}forEachFeatureAtCoordinate(e,t,i,n,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){e.target.getState()===Oe.LOADED&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Oe.LOADED&&t!=Oe.ERROR&&e.addEventListener(ot.Z.CHANGE,this.boundHandleImageChange_),t==Oe.IDLE&&(e.load(),t=e.getState()),t==Oe.LOADED}renderIfReadyAndVisible(){const e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}const yr=Sa;var vn=S(70135),Jt=S(68766),q=S(14277);const vr=[];let yi=null;function Ta(){yi=(0,ke.E4)(1,1,void 0,{willReadFrequently:!0})}class Ia extends yr{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=(0,q.Ue)(),this.pixelTransform=(0,q.Ue)(),this.inversePixelTransform=(0,q.Ue)(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(e,t,i){yi||Ta(),yi.clearRect(0,0,1,1);let n;try{yi.drawImage(e,t,i,1,1,0,0,1,1),n=yi.getImageData(0,0,1,1).data}catch{return yi=null,null}return n}getBackground(e){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(e.viewState.resolution)),i||void 0}useContainer(e,t,i){const n=this.getLayer().getClassName();let s,o;if(e&&e.className===n&&(!i||e&&e.style.backgroundColor&&(0,qe.fS)((0,mt._2)(e.style.backgroundColor),(0,mt._2)(i)))){const a=e.firstElementChild;a instanceof HTMLCanvasElement&&(o=a.getContext("2d"))}if(o&&o.canvas.style.transform===t?(this.container=e,this.context=o,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){s=document.createElement("div"),s.className=n;let a=s.style;a.position="absolute",a.width="100%",a.height="100%",o=(0,ke.E4)();const l=o.canvas;s.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=s,this.context=o}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(e,t,i){const n=(0,C.rL)(i),s=(0,C.Xv)(i),o=(0,C.w$)(i),a=(0,C.hC)(i);(0,q.nn)(t.coordinateToPixelTransform,n),(0,q.nn)(t.coordinateToPixelTransform,s),(0,q.nn)(t.coordinateToPixelTransform,o),(0,q.nn)(t.coordinateToPixelTransform,a);const l=this.inversePixelTransform;(0,q.nn)(l,n),(0,q.nn)(l,s),(0,q.nn)(l,o),(0,q.nn)(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(n[0]),Math.round(n[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}dispatchRenderEvent_(e,t,i){const n=this.getLayer();if(n.hasListener(e)){const s=new vn.Z(e,this.inversePixelTransform,i,t);n.dispatchEvent(s)}}preRender(e,t){this.frameState=t,this.dispatchRenderEvent_(Jt.Z.PRERENDER,e,t)}postRender(e,t){this.dispatchRenderEvent_(Jt.Z.POSTRENDER,e,t)}getRenderTransform(e,t,i,n,s,o,a){const l=s/2,h=o/2,c=n/t,u=-c,d=-e[0]+a,g=-e[1];return(0,q.qC)(this.tempTransform,l,h,c,u,-i,d,g)}disposeInternal(){delete this.frameState,super.disposeInternal()}}const Er=Ia;var Ee=S(77808),qt=S(84594);function Ra(r,e,t,i,n,s,o,a,l,h,c,u){let d=r[e],g=r[e+1],f=0,m=0,_=0,v=0;function w(){f=d,m=g,e+=i,d=r[e],g=r[e+1],v+=_,_=Math.sqrt((d-f)*(d-f)+(g-m)*(g-m))}do w();while(e<t-i&&v+_<s);let E=_===0?0:(s-v)/_;const L=(0,Ee.t7)(f,d,E),M=(0,Ee.t7)(m,g,E),A=e-i,O=v,z=s+a*l(h,n,c);for(;e<t-i&&v+_<z;)w();E=_===0?0:(z-v)/_;const $=(0,Ee.t7)(f,d,E),K=(0,Ee.t7)(m,g,E);let he;if(u){const j=[L,M,$,K];(0,qt.U1)(j,0,4,2,u,j,j),he=j[0]>j[2]}else he=L>$;const ce=Math.PI,ie=[],be=A+i===e;e=A,_=0,v=O,d=r[e],g=r[e+1];let ae;if(be){w(),ae=Math.atan2(g-m,d-f),he&&(ae+=ae>0?-ce:ce);const j=($+L)/2,N=(K+M)/2;return ie[0]=[j,N,(z-s)/2,ae,n],ie}n=n.replace(/\n/g," ");for(let j=0,N=n.length;j<N;){w();let H=Math.atan2(g-m,d-f);if(he&&(H+=H>0?-ce:ce),ae!==void 0){let we=H-ae;if(we+=we>ce?-2*ce:we<-ce?2*ce:0,Math.abs(we)>o)return null}ae=H;const ye=j;let Ce=0;for(;j<N;++j){const we=he?N-j-1:j,Le=a*l(h,n[we],c);if(e+i<t&&v+_<s+Ce+Le/2)break;Ce+=Le}if(j===ye)continue;const We=he?n.substring(N-ye,N-j):n.substring(ye,j);E=_===0?0:(s+Ce/2-v)/_;const G=(0,Ee.t7)(f,d,E),ht=(0,Ee.t7)(m,g,E);ie.push([G,ht,Ce/2,H,We]),s+=Ce}return ie}var ba=S(10765);const vi=(0,C.lJ)(),Qt=[],Gt=[],zt=[],ei=[];function wr(r){return r[3].declutterBox}const La=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 Cr(r,e){return(e==="start"||e==="end")&&!La.test(r)&&(e=e==="start"?"left":"right"),Ki[e]}function Fa(r,e,t){return t>0&&r.push(`
`,""),r.push(e,""),r}class Ma{constructor(e,t,i,n){this.overlaps=i,this.pixelRatio=t,this.resolution=e,this.alignFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=(0,q.Ue)(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={}}createLabel(e,t,i,n){const s=e+t+i+n;if(this.labels_[s])return this.labels_[s];const o=n?this.strokeStates[n]:null,a=i?this.fillStates[i]:null,l=this.textStates[t],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=Array.isArray(e),d=l.justify?Ki[l.justify]:Cr(Array.isArray(e)?e[0]:e,l.textAlign||Z.PH),g=n&&o.lineWidth?o.lineWidth:0,f=u?e:e.split(`
`).reduce(Fa,[]),{width:m,height:_,widths:v,heights:w,lineWidths:E}=(0,Z.Zw)(l,f),L=m+g,M=[],A=(L+2)*c[0],O=(_+g)*c[1],z={width:A<0?Math.floor(A):Math.ceil(A),height:O<0?Math.floor(O):Math.ceil(O),contextInstructions:M};(c[0]!=1||c[1]!=1)&&M.push("scale",c),n&&(M.push("strokeStyle",o.strokeStyle),M.push("lineWidth",g),M.push("lineCap",o.lineCap),M.push("lineJoin",o.lineJoin),M.push("miterLimit",o.miterLimit),M.push("setLineDash",[o.lineDash]),M.push("lineDashOffset",o.lineDashOffset)),i&&M.push("fillStyle",a.fillStyle),M.push("textBaseline","middle"),M.push("textAlign","center");const $=.5-d;let K=d*L+$*g;const he=[],ce=[];let ie=0,be=0,ae=0,j=0,N;for(let H=0,ye=f.length;H<ye;H+=2){const Ce=f[H];if(Ce===`
`){be+=ie,ie=0,K=d*L+$*g,++j;continue}const We=f[H+1]||l.font;We!==N&&(n&&he.push("font",We),i&&ce.push("font",We),N=We),ie=Math.max(ie,w[ae]);const G=[Ce,K+$*v[ae]+d*(v[ae]-E[j]),.5*(g+ie)+be];K+=v[ae],n&&he.push("strokeText",G),i&&ce.push("fillText",G),++ae}return Array.prototype.push.apply(M,he),Array.prototype.push.apply(M,ce),this.labels_[s]=z,z}replayTextBackground_(e,t,i,n,s,o,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,i),e.lineTo.apply(e,n),e.lineTo.apply(e,s),e.lineTo.apply(e,t),o&&(this.alignFill_=o[2],this.fill_(e)),a&&(this.setStrokeStyle_(e,a),e.stroke())}calculateImageOrLabelDimensions_(e,t,i,n,s,o,a,l,h,c,u,d,g,f,m,_){a*=d[0],l*=d[1];let v=i-a,w=n-l;const E=s+h>e?e-h:s,L=o+c>t?t-c:o,M=f[3]+E*d[0]+f[1],A=f[0]+L*d[1]+f[2],O=v-f[3],z=w-f[0];(m||u!==0)&&(Qt[0]=O,ei[0]=O,Qt[1]=z,Gt[1]=z,Gt[0]=O+M,zt[0]=Gt[0],zt[1]=z+A,ei[1]=zt[1]);let $;return u!==0?($=(0,q.qC)((0,q.Ue)(),i,n,1,1,u,-i,-n),(0,q.nn)($,Qt),(0,q.nn)($,Gt),(0,q.nn)($,zt),(0,q.nn)($,ei),(0,C.T9)(Math.min(Qt[0],Gt[0],zt[0],ei[0]),Math.min(Qt[1],Gt[1],zt[1],ei[1]),Math.max(Qt[0],Gt[0],zt[0],ei[0]),Math.max(Qt[1],Gt[1],zt[1],ei[1]),vi)):(0,C.T9)(Math.min(O,O+M),Math.min(z,z+A),Math.max(O,O+M),Math.max(z,z+A),vi),g&&(v=Math.round(v),w=Math.round(w)),{drawImageX:v,drawImageY:w,drawImageW:E,drawImageH:L,originX:h,originY:c,declutterBox:{minX:vi[0],minY:vi[1],maxX:vi[2],maxY:vi[3],value:_},canvasTransform:$,scale:d}}replayImageOrLabel_(e,t,i,n,s,o,a){const l=!!(o||a),h=n.declutterBox,c=e.canvas,u=a?a[2]*n.scale[0]/2:0;return h.minX-u<=c.width/t&&h.maxX+u>=0&&h.minY-u<=c.height/t&&h.maxY+u>=0&&(l&&this.replayTextBackground_(e,Qt,Gt,zt,ei,o,a),(0,Z._f)(e,n.canvasTransform,s,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(e){if(this.alignFill_){const t=(0,q.nn)(this.renderedTransform_,[0,0]),i=512*this.pixelRatio;e.save(),e.translate(t[0]%i,t[1]%i),e.rotate(this.viewRotation_)}e.fill(),this.alignFill_&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6])}drawLabelWithPointPlacement_(e,t,i,n){const s=this.textStates[t],o=this.createLabel(e,t,n,i),a=this.strokeStates[i],l=this.pixelRatio,h=Cr(Array.isArray(e)?e[0]:e,s.textAlign||Z.PH),c=Ki[s.textBaseline||Z.ru],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*s.scale[0],g=h*d+2*(.5-h)*u,f=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:g,anchorY:f}}execute_(e,t,i,n,s,o,a,l){let h;this.pixelCoordinates_&&(0,qe.fS)(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=(0,qt.vT)(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),(0,q.lk)(this.renderedTransform_,i));let c=0;const u=n.length;let d=0,g,f,m,_,v,w,E,L,M,A,O,z,$=0,K=0,he=null,ce=null;const ie=this.coordinateCache_,be=this.viewRotation_,ae=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,j={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:be},N=this.instructions!=n||this.overlaps?0:200;let H,ye,Ce,We;for(;c<u;){const G=n[c];switch(G[0]){case se.BEGIN_GEOMETRY:H=G[1],We=G[3],H.getGeometry()?a!==void 0&&!(0,C.kK)(a,We.getExtent())?c=G[2]+1:++c:c=G[2];break;case se.BEGIN_PATH:$>N&&(this.fill_(e),$=0),K>N&&(e.stroke(),K=0),!$&&!K&&(e.beginPath(),_=NaN,v=NaN),++c;break;case se.CIRCLE:d=G[1];const we=h[d],Le=h[d+1],oi=h[d+2],Ot=h[d+3],Ue=oi-we,Xt=Ot-Le,Bi=Math.sqrt(Ue*Ue+Xt*Xt);e.moveTo(we+Bi,Le),e.arc(we,Le,Bi,0,2*Math.PI,!0),++c;break;case se.CLOSE_PATH:e.closePath(),++c;break;case se.CUSTOM:d=G[1],g=G[2];const jn=G[3],Gi=G[4],Hn=G.length==6?G[5]:void 0;j.geometry=jn,j.feature=H,c in ie||(ie[c]=[]);const ai=ie[c];Hn?Hn(h,d,g,2,ai):(ai[0]=h[d],ai[1]=h[d+1],ai.length=2),Gi(ai,j),++c;break;case se.DRAW_IMAGE:d=G[1],g=G[2],L=G[3],f=G[4],m=G[5];let ln=G[6];const li=G[7],Kn=G[8],$n=G[9],Jn=G[10];let zi=G[11];const Qs=G[12];let nt=G[13];const vt=G[14],Rt=G[15];if(!L&&G.length>=20){M=G[19],A=G[20],O=G[21],z=G[22];const ct=this.drawLabelWithPointPlacement_(M,A,O,z);L=ct.label,G[3]=L;const Zi=G[23];f=(ct.anchorX-Zi)*this.pixelRatio,G[4]=f;const Et=G[24];m=(ct.anchorY-Et)*this.pixelRatio,G[5]=m,ln=L.height,G[6]=ln,nt=L.width,G[13]=nt}let Vt;G.length>25&&(Vt=G[25]);let Wi,_i,hi;G.length>17?(Wi=G[16],_i=G[17],hi=G[18]):(Wi=Z.oB,_i=!1,hi=!1),Jn&&ae?zi+=be:!Jn&&!ae&&(zi-=be);let Ni=0;for(;d<g;d+=2){if(Vt&&Vt[Ni++]<nt/this.pixelRatio)continue;const ct=this.calculateImageOrLabelDimensions_(L.width,L.height,h[d],h[d+1],nt,ln,f,m,Kn,$n,zi,Qs,s,Wi,_i||hi,H),Zi=[e,t,L,ct,li,_i?he:null,hi?ce:null];if(l){if(vt==="none")continue;if(vt==="obstacle"){l.insert(ct.declutterBox);continue}else{let Et,Yt;if(Rt){const ut=g-d;if(!Rt[ut]){Rt[ut]=Zi;continue}if(Et=Rt[ut],delete Rt[ut],Yt=wr(Et),l.collides(Yt))continue}if(l.collides(ct.declutterBox))continue;Et&&(l.insert(Yt),this.replayImageOrLabel_.apply(this,Et)),l.insert(ct.declutterBox)}}this.replayImageOrLabel_.apply(this,Zi)}++c;break;case se.DRAW_CHARS:const qn=G[1],Qe=G[2],er=G[3],au=G[4];z=G[5];const lu=G[6],Ko=G[7],$o=G[8];O=G[9];const tr=G[10];M=G[11],A=G[12];const Jo=[G[13],G[13]],ir=this.textStates[A],hn=ir.font,cn=[ir.scale[0]*Ko,ir.scale[1]*Ko];let un;hn in this.widths_?un=this.widths_[hn]:(un={},this.widths_[hn]=un);const qo=(0,ba.W)(h,qn,Qe,2),Qo=Math.abs(cn[0])*(0,Z.Kd)(hn,M,un);if(au||Qo<=qo){const ct=this.textStates[A].textAlign,Zi=(qo-Qo)*Ki[ct],Et=Ra(h,qn,Qe,2,M,Zi,lu,Math.abs(cn[0]),Z.Kd,hn,un,ae?0:this.viewRotation_);e:if(Et){const Yt=[];let ut,Qn,es,st,wt;if(O)for(ut=0,Qn=Et.length;ut<Qn;++ut){wt=Et[ut],es=wt[4],st=this.createLabel(es,A,"",O),f=wt[2]+(cn[0]<0?-tr:tr),m=er*st.height+(.5-er)*2*tr*cn[1]/cn[0]-$o;const jt=this.calculateImageOrLabelDimensions_(st.width,st.height,wt[0],wt[1],st.width,st.height,f,m,0,0,wt[3],Jo,!1,Z.oB,!1,H);if(l&&l.collides(jt.declutterBox))break e;Yt.push([e,t,st,jt,1,null,null])}if(z)for(ut=0,Qn=Et.length;ut<Qn;++ut){wt=Et[ut],es=wt[4],st=this.createLabel(es,A,z,""),f=wt[2],m=er*st.height-$o;const jt=this.calculateImageOrLabelDimensions_(st.width,st.height,wt[0],wt[1],st.width,st.height,f,m,0,0,wt[3],Jo,!1,Z.oB,!1,H);if(l&&l.collides(jt.declutterBox))break e;Yt.push([e,t,st,jt,1,null,null])}l&&l.load(Yt.map(wr));for(let jt=0,hu=Yt.length;jt<hu;++jt)this.replayImageOrLabel_.apply(this,Yt[jt])}}++c;break;case se.END_GEOMETRY:if(o!==void 0){H=G[1];const ct=o(H,We);if(ct)return ct}++c;break;case se.FILL:N?$++:this.fill_(e),++c;break;case se.MOVE_TO_LINE_TO:for(d=G[1],g=G[2],ye=h[d],Ce=h[d+1],w=ye+.5|0,E=Ce+.5|0,(w!==_||E!==v)&&(e.moveTo(ye,Ce),_=w,v=E),d+=2;d<g;d+=2)ye=h[d],Ce=h[d+1],w=ye+.5|0,E=Ce+.5|0,(d==g-2||w!==_||E!==v)&&(e.lineTo(ye,Ce),_=w,v=E);++c;break;case se.SET_FILL_STYLE:he=G,this.alignFill_=G[2],$&&(this.fill_(e),$=0,K&&(e.stroke(),K=0)),e.fillStyle=G[1],++c;break;case se.SET_STROKE_STYLE:ce=G,K&&(e.stroke(),K=0),this.setStrokeStyle_(e,G),++c;break;case se.STROKE:N?K++:e.stroke(),++c;break;default:++c;break}}$&&this.fill_(e),K&&e.stroke()}execute(e,t,i,n,s,o){this.viewRotation_=n,this.execute_(e,t,i,this.instructions,s,void 0,void 0,o)}executeHitDetection(e,t,i,n,s){return this.viewRotation_=i,this.execute_(e,1,t,this.hitDetectionInstructions,!0,n,s)}}const Pa=Ma,ms=["Polygon","Circle","LineString","Image","Text","Default"];class Da{constructor(e,t,i,n,s,o){this.maxExtent_=e,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=(0,q.Ue)(),this.createExecutors_(s)}clip(e,t){const i=this.getClipCoords(t);e.beginPath(),e.moveTo(i[0],i[1]),e.lineTo(i[2],i[3]),e.lineTo(i[4],i[5]),e.lineTo(i[6],i[7]),e.clip()}createExecutors_(e){for(const t in e){let i=this.executorsByZIndex_[t];i===void 0&&(i={},this.executorsByZIndex_[t]=i);const n=e[t];for(const s in n){const o=n[s];i[s]=new Pa(this.resolution_,this.pixelRatio_,this.overlaps_,o)}}}hasExecutors(e){for(const t in this.executorsByZIndex_){const i=this.executorsByZIndex_[t];for(let n=0,s=e.length;n<s;++n)if(e[n]in i)return!0}return!1}forEachFeatureAtCoordinate(e,t,i,n,s,o){n=Math.round(n);const a=n*2+1,l=(0,q.qC)(this.hitDetectionTransform_,n+.5,n+.5,1/t,-1/t,-i,-e[0],-e[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=(0,ke.E4)(a,a,void 0,{willReadFrequently:!0}));const c=this.hitDetectionContext_;c.canvas.width!==a||c.canvas.height!==a?(c.canvas.width=a,c.canvas.height=a):h||c.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=(0,C.lJ)(),(0,C.Wj)(u,e),(0,C.f3)(u,t*(this.renderBuffer_+n),u));const d=Aa(n);let g;function f(M,A){const O=c.getImageData(0,0,a,a).data;for(let z=0,$=d.length;z<$;z++)if(O[d[z]]>0){if(!o||g!=="Image"&&g!=="Text"||o.includes(M)){const K=(d[z]-3)/4,he=n-K%a,ce=n-(K/a|0),ie=s(M,A,he*he+ce*ce);if(ie)return ie}c.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(qe.j2);let _,v,w,E,L;for(_=m.length-1;_>=0;--_){const M=m[_].toString();for(w=this.executorsByZIndex_[M],v=ms.length-1;v>=0;--v)if(g=ms[v],E=w[g],E!==void 0&&(L=E.executeHitDetection(c,l,i,f,u),L))return L}}getClipCoords(e){const t=this.maxExtent_;if(!t)return null;const i=t[0],n=t[1],s=t[2],o=t[3],a=[i,n,i,o,s,o,s,n];return(0,qt.vT)(a,0,8,2,e,a),a}isEmpty(){return(0,Ui.x)(this.executorsByZIndex_)}execute(e,t,i,n,s,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(qe.j2),this.maxExtent_&&(e.save(),this.clip(e,i)),o=o||ms;let h,c,u,d,g,f;for(a&&l.reverse(),h=0,c=l.length;h<c;++h){const m=l[h].toString();for(g=this.executorsByZIndex_[m],u=0,d=o.length;u<d;++u){const _=o[u];f=g[_],f!==void 0&&f.execute(e,t,i,n,s,a)}}this.maxExtent_&&e.restore()}}const _s={};function Aa(r){if(_s[r]!==void 0)return _s[r];const e=r*2+1,t=r*r,i=new Array(t+1);for(let s=0;s<=r;++s)for(let o=0;o<=r;++o){const a=s*s+o*o;if(a>t)break;let l=i[a];l||(l=[],i[a]=l),l.push(((r+s)*e+(r+o))*4+3),s>0&&l.push(((r-s)*e+(r+o))*4+3),o>0&&(l.push(((r+s)*e+(r-o))*4+3),s>0&&l.push(((r-s)*e+(r-o))*4+3))}const n=[];for(let s=0,o=i.length;s<o;++s)i[s]&&n.push(...i[s]);return _s[r]=n,n}const Sr=Da;var Ei=S(89375),$i=S(95230);class Oa extends _r{constructor(e,t,i,n,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=i,this.transform_=n,this.transformRotation_=n?(0,Ee.FH)(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=o,this.userTransform_=a,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,q.Ue)()}drawImages_(e,t,i,n){if(!this.image_)return;const s=(0,qt.vT)(e,t,i,n,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let h=this.imageRotation_;this.transformRotation_===0&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let c=0,u=s.length;c<u;c+=2){const d=s[c]-this.imageAnchorX_,g=s[c+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const f=d+this.imageAnchorX_,m=g+this.imageAnchorY_;(0,q.qC)(a,f,m,1,1,h,-f,-m),o.setTransform.apply(o,a),o.translate(f,m),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.setTransform(1,0,0,1,0,0)}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,g,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(e,t,i,n){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const s=(0,qt.vT)(e,t,i,n,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);t<i;t+=n){const l=s[t]+this.textOffsetX_,h=s[t+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.translate(l-this.textOffsetX_,h-this.textOffsetY_),o.rotate(a),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.setTransform(1,0,0,1,0,0)):(this.textStrokeState_&&o.strokeText(this.text_,l,h),this.textFillState_&&o.fillText(this.text_,l,h))}}moveToLineTo_(e,t,i,n,s){const o=this.context_,a=(0,qt.vT)(e,t,i,n,this.transform_,this.pixelCoordinates_);o.moveTo(a[0],a[1]);let l=a.length;s&&(l-=2);for(let h=2;h<l;h+=2)o.lineTo(a[h],a[h+1]);return s&&o.closePath(),i}drawRings_(e,t,i,n){for(let s=0,o=i.length;s<o;++s)t=this.moveToLineTo_(e,t,i[s],n,!0);return t}drawCircle(e){if((0,C.kK)(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=(0,$i.Kr)(e,this.transform_,this.pixelCoordinates_),i=t[2]-t[0],n=t[3]-t[1],s=Math.sqrt(i*i+n*n),o=this.context_;o.beginPath(),o.arc(t[0],t[1],s,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break;default:}}drawFeature(e,t){const i=t.getGeometryFunction()(e);!i||!(0,C.kK)(this.extent_,i.getExtent())||(this.setStyle(t),this.drawGeometry(i))}drawGeometryCollection(e){const t=e.getGeometriesArray();for(let i=0,n=t.length;i<n;++i)this.drawGeometry(t[i])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),i=e.getStride();this.image_&&this.drawImages_(t,0,t.length,i),this.text_!==""&&this.drawText_(t,0,t.length,i)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),i=e.getStride();this.image_&&this.drawImages_(t,0,t.length,i),this.text_!==""&&this.drawText_(t,0,t.length,i)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!(0,C.kK)(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const t=this.context_,i=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(i,0,i.length,e.getStride(),!1),t.stroke()}if(this.text_!==""){const t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getExtent();if((0,C.kK)(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const i=this.context_,n=e.getFlatCoordinates();let s=0;const o=e.getEnds(),a=e.getStride();i.beginPath();for(let l=0,h=o.length;l<h;++l)s=this.moveToLineTo_(n,s,o[l],a,!1);i.stroke()}if(this.text_!==""){const i=e.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!(0,C.kK)(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride()),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){const t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!(0,C.kK)(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=this.context_,i=e.getOrientedFlatCoordinates();let n=0;const s=e.getEndss(),o=e.getStride();t.beginPath();for(let a=0,l=s.length;a<l;++a){const h=s[a];n=this.drawRings_(i,n,h,o)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){const t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){const t=this.context_,i=this.contextFillState_;i?i.fillStyle!=e.fillStyle&&(i.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){const t=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=e.lineCap&&(i.lineCap=e.lineCap,t.lineCap=e.lineCap),(0,qe.fS)(i.lineDash,e.lineDash)||t.setLineDash(i.lineDash=e.lineDash),i.lineDashOffset!=e.lineDashOffset&&(i.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),i.lineJoin!=e.lineJoin&&(i.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),i.lineWidth!=e.lineWidth&&(i.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),i.miterLimit!=e.miterLimit&&(i.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),i.strokeStyle!=e.strokeStyle&&(i.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){const t=this.context_,i=this.contextTextState_,n=e.textAlign?e.textAlign:Z.PH;i?(i.font!=e.font&&(i.font=e.font,t.font=e.font),i.textAlign!=n&&(i.textAlign=n,t.textAlign=n),i.textBaseline!=e.textBaseline&&(i.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=n,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:n,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{const i=e.getColor();this.fillState_={fillStyle:Ft(i||Z.bL)}}if(!t)this.strokeState_=null;else{const i=t.getColor(),n=t.getLineCap(),s=t.getLineDash(),o=t.getLineDashOffset(),a=t.getLineJoin(),l=t.getWidth(),h=t.getMiterLimit(),c=s||Z.X9;this.strokeState_={lineCap:n!==void 0?n:Z.mb,lineDash:this.pixelRatio_===1?c:c.map(u=>u*this.pixelRatio_),lineDashOffset:(o||Z.He)*this.pixelRatio_,lineJoin:a!==void 0?a:Z.rc,lineWidth:(l!==void 0?l:Z.yC)*this.pixelRatio_,miterLimit:h!==void 0?h:Z.V4,strokeStyle:Ft(i||Z.Tx)}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}const i=e.getPixelRatio(this.pixelRatio_),n=e.getAnchor(),s=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=t[1]*i,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();const o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=t[0]*i}setTextStyle(e){if(!e)this.text_="";else{const t=e.getFill();if(!t)this.textFillState_=null;else{const g=t.getColor();this.textFillState_={fillStyle:Ft(g||Z.bL)}}const i=e.getStroke();if(!i)this.textStrokeState_=null;else{const g=i.getColor(),f=i.getLineCap(),m=i.getLineDash(),_=i.getLineDashOffset(),v=i.getLineJoin(),w=i.getWidth(),E=i.getMiterLimit();this.textStrokeState_={lineCap:f!==void 0?f:Z.mb,lineDash:m||Z.X9,lineDashOffset:_||Z.He,lineJoin:v!==void 0?v:Z.rc,lineWidth:w!==void 0?w:Z.yC,miterLimit:E!==void 0?E:Z.V4,strokeStyle:Ft(g||Z.Tx)}}const n=e.getFont(),s=e.getOffsetX(),o=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),h=e.getScaleArray(),c=e.getText(),u=e.getTextAlign(),d=e.getTextBaseline();this.textState_={font:n!==void 0?n:Z.Df,textAlign:u!==void 0?u:Z.PH,textBaseline:d!==void 0?d:Z.ru},this.text_=c!==void 0?Array.isArray(c)?c.reduce((g,f,m)=>g+=m%2?" ":f,""):c:"",this.textOffsetX_=s!==void 0?this.pixelRatio_*s:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}const ka=Oa,Mt=.5;function Ba(r,e,t,i,n,s,o){const a=r[0]*Mt,l=r[1]*Mt,h=(0,ke.E4)(a,l);h.imageSmoothingEnabled=!1;const c=h.canvas,u=new ka(h,Mt,n,null,o),d=t.length,g=Math.floor((256*256*256-1)/d),f={};for(let _=1;_<=d;++_){const v=t[_-1],w=v.getStyleFunction()||i;if(!i)continue;let E=w(v,s);if(!E)continue;Array.isArray(E)||(E=[E]);const M=(_*g).toString(16).padStart(7,"#00000");for(let A=0,O=E.length;A<O;++A){const z=E[A],$=z.getGeometryFunction()(v);if(!$||!(0,C.kK)(n,$.getExtent()))continue;const K=z.clone(),he=K.getFill();he&&he.setColor(M);const ce=K.getStroke();ce&&(ce.setColor(M),ce.setLineDash(null)),K.setText(void 0);const ie=z.getImage();if(ie&&ie.getOpacity()!==0){const N=ie.getImageSize();if(!N)continue;const H=(0,ke.E4)(N[0],N[1],void 0,{alpha:!1}),ye=H.canvas;H.fillStyle=M,H.fillRect(0,0,ye.width,ye.height),K.setImage(new xn({img:ye,imgSize:N,anchor:ie.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:ie.getOrigin(),opacity:1,size:ie.getSize(),scale:ie.getScale(),rotation:ie.getRotation(),rotateWithView:ie.getRotateWithView()}))}const be=K.getZIndex()||0;let ae=f[be];ae||(ae={},f[be]=ae,ae.Polygon=[],ae.Circle=[],ae.LineString=[],ae.Point=[]);const j=$.getType();if(j==="GeometryCollection"){const N=$.getGeometriesArrayRecursive();for(let H=0,ye=N.length;H<ye;++H){const Ce=N[H];ae[Ce.getType().replace("Multi","")].push(Ce,K)}}else ae[j.replace("Multi","")].push($,K)}}const m=Object.keys(f).map(Number).sort(qe.j2);for(let _=0,v=m.length;_<v;++_){const w=f[m[_]];for(const E in w){const L=w[E];for(let M=0,A=L.length;M<A;M+=2){u.setStyle(L[M+1]);for(let O=0,z=e.length;O<z;++O)u.setTransform(e[O]),u.drawGeometry(L[M])}}}return h.getImageData(0,0,c.width,c.height)}function Ga(r,e,t){const i=[];if(t){const n=Math.floor(Math.round(r[0])*Mt),s=Math.floor(Math.round(r[1])*Mt),o=((0,Ee.uZ)(n,0,t.width-1)+(0,Ee.uZ)(s,0,t.height-1)*t.width)*4,a=t.data[o],l=t.data[o+1],c=t.data[o+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/e.length);c&&c%u===0&&i.push(e[c/u-1])}return i}const za=.5,Tr={Point:Ha,LineString:Va,Polygon:$a,MultiPoint:Ka,MultiLineString:Ya,MultiPolygon:ja,GeometryCollection:Xa,Circle:Za};function Wa(r,e){return parseInt((0,J.sq)(r),10)-parseInt((0,J.sq)(e),10)}function Na(r,e){const t=ps(r,e);return t*t}function ps(r,e){return za*r/e}function Za(r,e,t,i,n){const s=t.getFill(),o=t.getStroke();if(s||o){const l=r.getBuilder(t.getZIndex(),"Circle");l.setFillStrokeStyle(s,o),l.drawCircle(e,i)}const a=t.getText();if(a&&a.getText()){const l=(n||r).getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,i)}}function Ir(r,e,t,i,n,s,o){let a=!1;const l=t.getImage();if(l){const h=l.getImageState();h==Oe.LOADED||h==Oe.ERROR?l.unlistenImageChange(n):(h==Oe.IDLE&&l.load(),l.listenImageChange(n),a=!0)}return Ua(r,e,t,i,s,o),a}function Ua(r,e,t,i,n,s){const o=t.getGeometryFunction()(e);if(!o)return;const a=o.simplifyTransformed(i,n);if(t.getRenderer())Rr(r,a,t,e);else{const h=Tr[a.getType()];h(r,a,t,e,s)}}function Rr(r,e,t,i){if(e.getType()=="GeometryCollection"){const s=e.getGeometries();for(let o=0,a=s.length;o<a;++o)Rr(r,s[o],t,i);return}r.getBuilder(t.getZIndex(),"Default").drawCustom(e,i,t.getRenderer(),t.getHitDetectionRenderer())}function Xa(r,e,t,i,n){const s=e.getGeometriesArray();let o,a;for(o=0,a=s.length;o<a;++o){const l=Tr[s[o].getType()];l(r,s[o],t,i,n)}}function Va(r,e,t,i,n){const s=t.getStroke();if(s){const a=r.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawLineString(e,i)}const o=t.getText();if(o&&o.getText()){const a=(n||r).getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,i)}}function Ya(r,e,t,i,n){const s=t.getStroke();if(s){const a=r.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawMultiLineString(e,i)}const o=t.getText();if(o&&o.getText()){const a=(n||r).getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,i)}}function ja(r,e,t,i,n){const s=t.getFill(),o=t.getStroke();if(o||s){const l=r.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawMultiPolygon(e,i)}const a=t.getText();if(a&&a.getText()){const l=(n||r).getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,i)}}function Ha(r,e,t,i,n){const s=t.getImage(),o=t.getText();let a;if(s){if(s.getImageState()!=Oe.LOADED)return;let l=r;if(n){const c=s.getDeclutterMode();if(c!=="none")if(l=n,c==="obstacle"){const u=r.getBuilder(t.getZIndex(),"Image");u.setImageStyle(s,a),u.drawPoint(e,i)}else o&&o.getText()&&(a={})}const h=l.getBuilder(t.getZIndex(),"Image");h.setImageStyle(s,a),h.drawPoint(e,i)}if(o&&o.getText()){let l=r;n&&(l=n);const h=l.getBuilder(t.getZIndex(),"Text");h.setTextStyle(o,a),h.drawText(e,i)}}function Ka(r,e,t,i,n){const s=t.getImage(),o=t.getText();let a;if(s){if(s.getImageState()!=Oe.LOADED)return;let l=r;if(n){const c=s.getDeclutterMode();if(c!=="none")if(l=n,c==="obstacle"){const u=r.getBuilder(t.getZIndex(),"Image");u.setImageStyle(s,a),u.drawMultiPoint(e,i)}else o&&o.getText()&&(a={})}const h=l.getBuilder(t.getZIndex(),"Image");h.setImageStyle(s,a),h.drawMultiPoint(e,i)}if(o&&o.getText()){let l=r;n&&(l=n);const h=l.getBuilder(t.getZIndex(),"Text");h.setTextStyle(o,a),h.drawText(e,i)}}function $a(r,e,t,i,n){const s=t.getFill(),o=t.getStroke();if(s||o){const l=r.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawPolygon(e,i)}const a=t.getText();if(a&&a.getText()){const l=(n||r).getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,i)}}var Ge=S(29637);class Ja extends Er{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=(0,C.lJ)(),this.wrappedRenderedExtent_=(0,C.lJ)(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedRenderOrder_=null,this.replayGroup_=null,this.replayGroupChanged=!0,this.declutterExecutorGroup=null,this.clipping=!0,this.compositionContext_=null,this.opacity_=1}renderWorlds(e,t,i){const n=t.extent,s=t.viewState,o=s.center,a=s.resolution,l=s.projection,h=s.rotation,c=l.getExtent(),u=this.getLayer().getSource(),d=t.pixelRatio,g=t.viewHints,f=!(g[Ei.Z.ANIMATING]||g[Ei.Z.INTERACTING]),m=this.compositionContext_,_=Math.round(t.size[0]*d),v=Math.round(t.size[1]*d),w=u.getWrapX()&&l.canWrapX(),E=w?(0,C.dz)(c):null,L=w?Math.ceil((n[2]-c[2])/E)+1:1;let M=w?Math.floor((n[0]-c[0])/E):0;do{const A=this.getRenderTransform(o,a,h,d,_,v,M*E);e.execute(m,1,A,h,f,void 0,i)}while(++M<L)}setupCompositionContext_(){if(this.opacity_!==1){const e=(0,ke.E4)(this.context.canvas.width,this.context.canvas.height,vr);this.compositionContext_=e}else this.compositionContext_=this.context}releaseCompositionContext_(){if(this.opacity_!==1){const e=this.context.globalAlpha;this.context.globalAlpha=this.opacity_,this.context.drawImage(this.compositionContext_.canvas,0,0),this.context.globalAlpha=e,(0,ke.jy)(this.compositionContext_),vr.push(this.compositionContext_.canvas),this.compositionContext_=null}}renderDeclutter(e){this.declutterExecutorGroup&&(this.setupCompositionContext_(),this.renderWorlds(this.declutterExecutorGroup,e,e.declutterTree),this.releaseCompositionContext_())}renderFrame(e,t){const i=e.pixelRatio,n=e.layerStatesArray[e.layerIndex];(0,q.n3)(this.pixelTransform,1/i,1/i),(0,q.nb)(this.inversePixelTransform,this.pixelTransform);const s=(0,q.BB)(this.pixelTransform);this.useContainer(t,s,this.getBackground(e));const o=this.context,a=o.canvas,l=this.replayGroup_,h=this.declutterExecutorGroup;if((!l||l.isEmpty())&&(!h||h.isEmpty()))return null;const c=Math.round(e.size[0]*i),u=Math.round(e.size[1]*i);a.width!=c||a.height!=u?(a.width=c,a.height=u,a.style.transform!==s&&(a.style.transform=s)):this.containerReused||o.clearRect(0,0,c,u),this.preRender(o,e);const d=e.viewState,g=d.projection;this.opacity_=n.opacity,this.setupCompositionContext_();let f=!1,m=!0;if(n.extent&&this.clipping){const _=(0,U.dY)(n.extent,g);m=(0,C.kK)(_,e.extent),f=m&&!(0,C.r4)(_,e.extent),f&&this.clipUnrotated(this.compositionContext_,e,_)}return m&&this.renderWorlds(l,e),f&&this.compositionContext_.restore(),this.releaseCompositionContext_(),this.postRender(o,e),this.renderedRotation_!==d.rotation&&(this.renderedRotation_=d.rotation,this.hitDetectionImageData_=null),this.container}getFeatures(e){return new Promise(t=>{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=[this.context.canvas.width,this.context.canvas.height];(0,q.nn)(this.pixelTransform,i);const n=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),c=[],u=i[0]*Mt,d=i[1]*Mt;c.push(this.getRenderTransform(n,s,o,Mt,u,d,0).slice());const g=h.getSource(),f=a.getExtent();if(g.getWrapX()&&a.canWrapX()&&!(0,C.r4)(f,l)){let m=l[0];const _=(0,C.dz)(f);let v=0,w;for(;m<f[0];)--v,w=_*v,c.push(this.getRenderTransform(n,s,o,Mt,u,d,w).slice()),m+=_;for(v=0,m=l[2];m>f[2];)++v,w=_*v,c.push(this.getRenderTransform(n,s,o,Mt,u,d,w).slice()),m-=_}this.hitDetectionImageData_=Ba(i,c,this.renderedFeatures_,h.getStyleFunction(),l,s,o)}t(Ga(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,i,n,s){if(!this.replayGroup_)return;const o=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),h={},c=function(g,f,m){const _=(0,J.sq)(g),v=h[_];if(v){if(v!==!0&&m<v.distanceSq){if(m===0)return h[_]=!0,s.splice(s.lastIndexOf(v),1),n(g,l,f);v.geometry=f,v.distanceSq=m}}else{if(m===0)return h[_]=!0,n(g,l,f);s.push(h[_]={feature:g,layer:l,geometry:f,distanceSq:m,callback:n})}};let u;const d=[this.replayGroup_];return this.declutterExecutorGroup&&d.push(this.declutterExecutorGroup),d.some(g=>u=g.forEachFeatureAtCoordinate(e,o,a,i,c,g===this.declutterExecutorGroup&&t.declutterTree?t.declutterTree.all().map(f=>f.value):null)),u}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){const t=this.getLayer(),i=t.getSource();if(!i)return!1;const n=e.viewHints[Ei.Z.ANIMATING],s=e.viewHints[Ei.Z.INTERACTING],o=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!o&&n||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=e.extent,h=e.viewState,c=h.projection,u=h.resolution,d=e.pixelRatio,g=t.getRevision(),f=t.getRenderBuffer();let m=t.getRenderOrder();m===void 0&&(m=Wa);const _=h.center.slice(),v=(0,C.f3)(l,f*u),w=v.slice(),E=[v.slice()],L=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!(0,C.r4)(L,e.extent)){const j=(0,C.dz)(L),N=Math.max((0,C.dz)(v)/2,j);v[0]=L[0]-N,v[2]=L[2]+N,(0,Ge.Cf)(_,c);const H=(0,C.Cf)(E[0],c);H[0]<L[0]&&H[2]<L[2]?E.push([H[0]+j,H[1],H[2]+j,H[3]]):H[0]>L[0]&&H[2]>L[2]&&E.push([H[0]-j,H[1],H[2]-j,H[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==g&&this.renderedRenderOrder_==m&&(0,C.r4)(this.wrappedRenderedExtent_,v))return(0,qe.fS)(this.renderedExtent_,w)||(this.hitDetectionImageData_=null,this.renderedExtent_=w),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const M=new xr(ps(u,d),v,u,d);let A;this.getLayer().getDeclutter()&&(A=new xr(ps(u,d),v,u,d));const O=(0,U.Cs)();let z;if(O){for(let j=0,N=E.length;j<N;++j){const H=E[j],ye=(0,U.Fj)(H,c);i.loadFeatures(ye,(0,U.on)(u,c),O)}z=(0,U.WO)(O,c)}else for(let j=0,N=E.length;j<N;++j)i.loadFeatures(E[j],u,c);const $=Na(u,d);let K=!0;const he=j=>{let N;const H=j.getStyleFunction()||t.getStyleFunction();if(H&&(N=H(j,u)),N){const ye=this.renderFeature(j,$,N,M,z,A);K=K&&!ye}},ce=(0,U.Fj)(v,c),ie=i.getFeaturesInExtent(ce);m&&ie.sort(m);for(let j=0,N=ie.length;j<N;++j)he(ie[j]);this.renderedFeatures_=ie,this.ready=K;const be=M.finish(),ae=new Sr(v,u,d,i.getOverlaps(),be,t.getRenderBuffer());return A&&(this.declutterExecutorGroup=new Sr(v,u,d,i.getOverlaps(),A.finish(),t.getRenderBuffer())),this.renderedResolution_=u,this.renderedRevision_=g,this.renderedRenderOrder_=m,this.renderedExtent_=w,this.wrappedRenderedExtent_=v,this.renderedCenter_=_,this.renderedProjection_=c,this.replayGroup_=ae,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,i,n,s,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=Ir(n,e,i[l],t,this.boundHandleStyleImageChange_,s,o)||a;else a=Ir(n,e,i,t,this.boundHandleStyleImageChange_,s,o);return a}}const qa=Ja;class Qa extends fs{constructor(e){super(e)}createRenderer(){return new qa(this)}}const ze=Qa;var el=S(19331),tl=S(71638);class il extends tl.Z{constructor(e){super(),this.projection=(0,U.U2)(e.projection),this.attributions_=br(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible!==void 0?e.attributionsCollapsible:!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;const t=this;this.viewPromise_=new Promise(function(i,n){t.viewResolver=i,t.viewRejector=n})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=br(e),this.changed()}setState(e){this.state_=e,this.changed()}}function br(r){return r?Array.isArray(r)?function(e){return r}:typeof r=="function"?r:function(e){return[r]}:null}const Lr=il;var Ji=S(10267);function Fr(r,e){return[[-1/0,-1/0,1/0,1/0]]}function gu(r,e){return[r]}function mu(r){return function(e,t,i){const n=r.getZForResolution(fromUserResolution(t,i)),s=r.getTileRangeForExtentAndZ(fromUserExtent(e,i),n),o=[],a=[n,0,0];for(a[1]=s.minX;a[1]<=s.maxX;++a[1])for(a[2]=s.minY;a[2]<=s.maxY;++a[2])o.push(toUserExtent(r.getTileCoordExtent(a),i));return o}}let Mr=!1;function nl(r,e,t,i,n,s,o){const a=new XMLHttpRequest;a.open("GET",typeof r=="function"?r(t,i,n):r,!0),e.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Mr,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const h=e.getType();let c;h=="json"||h=="text"?c=a.responseText:h=="xml"?(c=a.responseXML,c||(c=new DOMParser().parseFromString(a.responseText,"application/xml"))):h=="arraybuffer"&&(c=a.response),c?s(e.readFeatures(c,{extent:t,featureProjection:n}),e.readProjection(c)):o()}else o()},a.onerror=o,a.send()}function Pr(r,e){return function(t,i,n,s,o){const a=this;nl(r,e,t,i,n,function(l,h){a.addFeatures(l),s!==void 0&&s(l)},o||Ji.Zn)}}function _u(r){Mr=r}class ti extends pn.ZP{constructor(e,t,i){super(e),this.feature=t,this.features=i}}class sl extends Lr{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=Ji.Zn,this.format_=e.format,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&((0,ue.h)(this.format_,7),this.loader_=Pr(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:Fr;const t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new ns:null,this.loadedExtentsRtree_=new ns,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,n;Array.isArray(e.features)?n=e.features:e.features&&(i=e.features,n=i.getArray()),!t&&i===void 0&&(i=new is.Z(n)),n!==void 0&&this.addFeaturesInternal(n),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){const t=(0,J.sq)(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);const i=e.getGeometry();if(i){const n=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(n,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new ti(Ne.ADDFEATURE,e))}setupChangeEvents_(e,t){this.featureChangeKeys_[e]=[(0,Je.oL)(t,ot.Z.CHANGE,this.handleFeatureChange_,this),(0,Je.oL)(t,el.Z.PROPERTYCHANGE,this.handleFeatureChange_,this)]}addToIndex_(e,t){let i=!0;const n=t.getId();return n!==void 0&&(n.toString()in this.idIndex_?i=!1:this.idIndex_[n.toString()]=t),i&&((0,ue.h)(!(e in this.uidIndex_),30),this.uidIndex_[e]=t),i}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){const t=[],i=[],n=[];for(let s=0,o=e.length;s<o;s++){const a=e[s],l=(0,J.sq)(a);this.addToIndex_(l,a)&&i.push(a)}for(let s=0,o=i.length;s<o;s++){const a=i[s],l=(0,J.sq)(a);this.setupChangeEvents_(l,a);const h=a.getGeometry();if(h){const c=h.getExtent();t.push(c),n.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,n),this.hasListener(Ne.ADDFEATURE))for(let s=0,o=i.length;s<o;s++)this.dispatchEvent(new ti(Ne.ADDFEATURE,i[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(Ne.ADDFEATURE,function(i){t||(t=!0,e.push(i.feature),t=!1)}),this.addEventListener(Ne.REMOVEFEATURE,function(i){t||(t=!0,e.remove(i.feature),t=!1)}),e.addEventListener(_n.Z.ADD,i=>{t||(t=!0,this.addFeature(i.element),t=!1)}),e.addEventListener(_n.Z.REMOVE,i=>{t||(t=!0,this.removeFeature(i.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(const i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(Je.bN);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const i=n=>{this.removeFeatureInternal(n)};this.featuresRtree_.forEach(i);for(const n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const t=new ti(Ne.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){const i=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(i,function(n){if(n.getGeometry().intersectsCoordinate(e))return t(n)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(i){if(i.getGeometry().intersectsExtent(e)){const s=t(i);if(s)return s}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),(0,Ui.x)(this.nullGeometryFeatures_)||(0,qe.l7)(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){const t=[];return this.forEachFeatureAtCoordinateDirect(e,function(i){t.push(i)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);const n=(0,C.MV)(e,t);return[].concat(...n.map(s=>this.featuresRtree_.getInExtent(s)))}else if(this.featuresCollection_)return this.featuresCollection_.getArray().slice(0);return[]}getClosestFeatureToCoordinate(e,t){const i=e[0],n=e[1];let s=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return t=t||Ji.uX,this.featuresRtree_.forEachInExtent(l,function(h){if(t(h)){const c=h.getGeometry(),u=a;if(a=c.closestPointXY(i,n,o,a),a<u){s=h;const d=Math.sqrt(a);l[0]=i-d,l[1]=n-d,l[2]=i+d,l[3]=n+d}}}),s}getExtent(e){return this.featuresRtree_.getExtent(e)}getFeatureById(e){const t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){const t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){const t=e.target,i=(0,J.sq)(t),n=t.getGeometry();if(!n)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[i]=t);else{const o=n.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}const s=t.getId();if(s!==void 0){const o=s.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[i]=t;this.changed(),this.dispatchEvent(new ti(Ne.CHANGEFEATURE,t))}hasFeature(e){const t=e.getId();return t!==void 0?t in this.idIndex_:(0,J.sq)(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&(0,Ui.x)(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,i){const n=this.loadedExtentsRtree_,s=this.strategy_(e,t,i);for(let o=0,a=s.length;o<a;++o){const l=s[o];n.forEachInExtent(l,function(c){return(0,C.r4)(c.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new ti(Ne.FEATURESLOADSTART)),this.loader_.call(this,l,t,i,c=>{--this.loadingExtentsCount_,this.dispatchEvent(new ti(Ne.FEATURESLOADEND,void 0,c))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new ti(Ne.FEATURESLOADERROR))}),n.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){const t=this.loadedExtentsRtree_;let i;t.forEachInExtent(e,function(n){if((0,C.fS)(n.extent,e))return i=n,!0}),i&&t.remove(i)}removeFeature(e){if(!e)return;const t=(0,J.sq)(e);t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){const t=(0,J.sq)(e),i=this.featureChangeKeys_[t];if(!i)return;i.forEach(Je.bN),delete this.featureChangeKeys_[t];const n=e.getId();return n!==void 0&&delete this.idIndex_[n.toString()],delete this.uidIndex_[t],this.dispatchEvent(new ti(Ne.REMOVEFEATURE,e)),e}removeFromIdIndex_(e){let t=!1;for(const i in this.idIndex_)if(this.idIndex_[i]===e){delete this.idIndex_[i],t=!0;break}return t}setLoader(e){this.loader_=e}setUrl(e){(0,ue.h)(this.format_,7),this.url_=e,this.setLoader(Pr(e,this.format_))}}const _t=sl;var Wt=S(31008),Nt=S(33001);const Dr=0,qi=1,Ar=[0,0,0,0],wi=[],xs={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"};class ys extends pn.ZP{constructor(e,t,i){super(e),this.features=t,this.mapBrowserEvent=i}}class rl extends sr.Z{constructor(e){super(e),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=e.condition?e.condition:Wt.Xp,this.defaultDeleteCondition_=function(i){return(0,Wt.Ko)(i)&&(0,Wt.Kf)(i)},this.deleteCondition_=e.deleteCondition?e.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:Wt.Bx,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new ns,this.pixelTolerance_=e.pixelTolerance!==void 0?e.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new ze({source:new _t({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:al(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.hitDetection_=null;let t;if(e.features?t=e.features:e.source&&(this.source_=e.source,t=new is.Z(this.source_.getFeatures()),this.source_.addEventListener(Ne.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(Ne.REMOVEFEATURE,this.handleSourceRemove_.bind(this))),!t)throw new Error("The modify interaction requires features, a source or a layer");e.hitDetection&&(this.hitDetection_=e.hitDetection),this.features_=t,this.features_.forEach(this.addFeature_.bind(this)),this.features_.addEventListener(_n.Z.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(_n.Z.REMOVE,this.handleFeatureRemove_.bind(this)),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=e.snapToPointer===void 0?!this.hitDetection_:e.snapToPointer}addFeature_(e){const t=e.getGeometry();if(t){const n=this.SEGMENT_WRITERS_[t.getType()];n&&n(e,t)}const i=this.getMap();i&&i.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,i),e.addEventListener(ot.Z.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(e,t){if(!this.featuresBeingModified_){this.featuresBeingModified_=new is.Z;const i=this.featuresBeingModified_.getArray();for(let n=0,s=t.length;n<s;++n){const o=t[n];for(let a=0,l=o.length;a<l;++a){const h=o[a].feature;h&&!i.includes(h)&&this.featuresBeingModified_.push(h)}}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new ys(xs.MODIFYSTART,this.featuresBeingModified_,e))}}removeFeature_(e){this.removeFeatureSegmentData_(e),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),e.removeEventListener(ot.Z.CHANGE,this.boundHandleFeatureChange_)}removeFeatureSegmentData_(e){const t=this.rBush_,i=[];t.forEach(function(n){e===n.feature&&i.push(n)});for(let n=i.length-1;n>=0;--n){const s=i[n];for(let o=this.dragSegments_.length-1;o>=0;--o)this.dragSegments_[o][0]===s&&this.dragSegments_.splice(o,1);t.remove(s)}}setActive(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(e)}setMap(e){this.overlay_.setMap(e),super.setMap(e)}getOverlay(){return this.overlay_}handleSourceAdd_(e){e.feature&&this.features_.push(e.feature)}handleSourceRemove_(e){e.feature&&this.features_.remove(e.feature)}handleFeatureAdd_(e){this.addFeature_(e.element)}handleFeatureChange_(e){if(!this.changingFeature_){const t=e.target;this.removeFeature_(t),this.addFeature_(t)}}handleFeatureRemove_(e){this.removeFeature_(e.element)}writePointGeometry_(e,t){const i=t.getCoordinates(),n={feature:e,geometry:t,segment:[i,i]};this.rBush_.insert(t.getExtent(),n)}writeMultiPointGeometry_(e,t){const i=t.getCoordinates();for(let n=0,s=i.length;n<s;++n){const o=i[n],a={feature:e,geometry:t,depth:[n],index:n,segment:[o,o]};this.rBush_.insert(t.getExtent(),a)}}writeLineStringGeometry_(e,t){const i=t.getCoordinates();for(let n=0,s=i.length-1;n<s;++n){const o=i.slice(n,n+2),a={feature:e,geometry:t,index:n,segment:o};this.rBush_.insert((0,C.hI)(o),a)}}writeMultiLineStringGeometry_(e,t){const i=t.getCoordinates();for(let n=0,s=i.length;n<s;++n){const o=i[n];for(let a=0,l=o.length-1;a<l;++a){const h=o.slice(a,a+2),c={feature:e,geometry:t,depth:[n],index:a,segment:h};this.rBush_.insert((0,C.hI)(h),c)}}}writePolygonGeometry_(e,t){const i=t.getCoordinates();for(let n=0,s=i.length;n<s;++n){const o=i[n];for(let a=0,l=o.length-1;a<l;++a){const h=o.slice(a,a+2),c={feature:e,geometry:t,depth:[n],index:a,segment:h};this.rBush_.insert((0,C.hI)(h),c)}}}writeMultiPolygonGeometry_(e,t){const i=t.getCoordinates();for(let n=0,s=i.length;n<s;++n){const o=i[n];for(let a=0,l=o.length;a<l;++a){const h=o[a];for(let c=0,u=h.length-1;c<u;++c){const d=h.slice(c,c+2),g={feature:e,geometry:t,depth:[a,n],index:c,segment:d};this.rBush_.insert((0,C.hI)(d),g)}}}}writeCircleGeometry_(e,t){const i=t.getCenter(),n={feature:e,geometry:t,index:Dr,segment:[i,i]},s={feature:e,geometry:t,index:qi,segment:[i,i]},o=[n,s];n.featureSegments=o,s.featureSegments=o,this.rBush_.insert((0,C.HK)(i),n);let a=t;const l=(0,U.Cs)();if(l&&this.getMap()){const h=this.getMap().getView().getProjection();a=a.clone().transform(l,h),a=(0,Nt.Bb)(a).transform(h,l)}this.rBush_.insert(a.getExtent(),s)}writeGeometryCollectionGeometry_(e,t){const i=t.getGeometriesArray();for(let n=0;n<i.length;++n){const s=i[n],o=this.SEGMENT_WRITERS_[s.getType()];o(e,s)}}createOrUpdateVertexFeature_(e,t,i){let n=this.vertexFeature_;return n?n.getGeometry().setCoordinates(e):(n=new tt.Z(new Bt.Z(e)),this.vertexFeature_=n,this.overlay_.getSource().addFeature(n)),n.set("features",t),n.set("geometries",i),n}handleEvent(e){if(!e.originalEvent)return!0;this.lastPointerEvent_=e;let t;return!e.map.getView().getInteracting()&&e.type==gt.Z.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(e),this.vertexFeature_&&this.deleteCondition_(e)&&(e.type!=gt.Z.SINGLECLICK||!this.ignoreNextSingleClick_?t=this.removePoint():t=!0),e.type==gt.Z.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),super.handleEvent(e)&&!t}handleDragEvent(e){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(e,this.dragSegments_);const t=[e.coordinate[0]+this.delta_[0],e.coordinate[1]+this.delta_[1]],i=[],n=[];for(let s=0,o=this.dragSegments_.length;s<o;++s){const a=this.dragSegments_[s],l=a[0],h=l.feature;i.includes(h)||i.push(h);const c=l.geometry;n.includes(c)||n.push(c);const u=l.depth;let d;const g=l.segment,f=a[1];for(;t.length<c.getStride();)t.push(g[f][t.length]);switch(c.getType()){case"Point":d=t,g[0]=t,g[1]=t;break;case"MultiPoint":d=c.getCoordinates(),d[l.index]=t,g[0]=t,g[1]=t;break;case"LineString":d=c.getCoordinates(),d[l.index+f]=t,g[f]=t;break;case"MultiLineString":d=c.getCoordinates(),d[u[0]][l.index+f]=t,g[f]=t;break;case"Polygon":d=c.getCoordinates(),d[u[0]][l.index+f]=t,g[f]=t;break;case"MultiPolygon":d=c.getCoordinates(),d[u[1]][u[0]][l.index+f]=t,g[f]=t;break;case"Circle":if(g[0]=t,g[1]=t,l.index===Dr)this.changingFeature_=!0,c.setCenter(t),this.changingFeature_=!1;else{this.changingFeature_=!0;const m=e.map.getView().getProjection();let _=(0,Ge.TE)((0,U.Vs)(c.getCenter(),m),(0,U.Vs)(t,m));const v=(0,U.Cs)();if(v){const w=c.clone().transform(v,m);w.setRadius(_),_=w.transform(m,v).getRadius()}c.setRadius(_),this.changingFeature_=!1}break;default:}d&&this.setGeometryCoordinates_(c,d)}this.createOrUpdateVertexFeature_(t,i,n)}handleDownEvent(e){if(!this.condition_(e))return!1;const t=e.coordinate;this.handlePointerAtPixel_(e.pixel,e.map,t),this.dragSegments_.length=0,this.featuresBeingModified_=null;const i=this.vertexFeature_;if(i){const n=e.map.getView().getProjection(),s=[],o=i.getGeometry().getCoordinates(),a=(0,C.hI)([o]),l=this.rBush_.getInExtent(a),h={};l.sort(ol);for(let c=0,u=l.length;c<u;++c){const d=l[c],g=d.segment;let f=(0,J.sq)(d.geometry);const m=d.depth;if(m&&(f+="-"+m.join("-")),h[f]||(h[f]=new Array(2)),d.geometry.getType()==="Circle"&&d.index===qi){const _=kr(t,d,n);(0,Ge.fS)(_,o)&&!h[f][0]&&(this.dragSegments_.push([d,0]),h[f][0]=d);continue}if((0,Ge.fS)(g[0],o)&&!h[f][0]){this.dragSegments_.push([d,0]),h[f][0]=d;continue}if((0,Ge.fS)(g[1],o)&&!h[f][1]){if(h[f][0]&&h[f][0].index===0){let _=d.geometry.getCoordinates();switch(d.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":_=_[m[1]];case"Polygon":if(d.index!==_[m[0]].length-2)continue;break;default:}}this.dragSegments_.push([d,1]),h[f][1]=d;continue}(0,J.sq)(g)in this.vertexSegments_&&!h[f][0]&&!h[f][1]&&this.insertVertexCondition_(e)&&s.push(d)}s.length&&this.willModifyFeatures_(e,[s]);for(let c=s.length-1;c>=0;--c)this.insertVertex_(s[c],o)}return!!this.vertexFeature_}handleUpEvent(e){for(let t=this.dragSegments_.length-1;t>=0;--t){const i=this.dragSegments_[t][0],n=i.geometry;if(n.getType()==="Circle"){const s=n.getCenter(),o=i.featureSegments[0],a=i.featureSegments[1];o.segment[0]=s,o.segment[1]=s,a.segment[0]=s,a.segment[1]=s,this.rBush_.update((0,C.HK)(s),o);let l=n;const h=(0,U.Cs)();if(h){const c=e.map.getView().getProjection();l=l.clone().transform(h,c),l=(0,Nt.Bb)(l).transform(c,h)}this.rBush_.update(l.getExtent(),a)}else this.rBush_.update((0,C.hI)(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new ys(xs.MODIFYEND,this.featuresBeingModified_,e)),this.featuresBeingModified_=null),!1}handlePointerMove_(e){this.lastPixel_=e.pixel,this.handlePointerAtPixel_(e.pixel,e.map,e.coordinate)}handlePointerAtPixel_(e,t,i){const n=i||t.getCoordinateFromPixel(e),s=t.getView().getProjection(),o=function(h,c){return Or(n,h,s)-Or(n,c,s)};let a,l;if(this.hitDetection_){const h=typeof this.hitDetection_=="object"?c=>c===this.hitDetection_:void 0;t.forEachFeatureAtPixel(e,(c,u,d)=>{const g=d||c.getGeometry();if(g.getType()==="Point"&&c instanceof tt.Z&&this.features_.getArray().includes(c)){l=g;const f=l.getFlatCoordinates().slice(0,2);a=[{feature:c,geometry:l,segment:[f,f]}]}return!0},{layerFilter:h})}if(!a){const h=(0,U.dY)((0,C.HK)(n,Ar),s),c=t.getView().getResolution()*this.pixelTolerance_,u=(0,U.Fj)((0,C.f3)(h,c,Ar),s);a=this.rBush_.getInExtent(u)}if(a&&a.length>0){const h=a.sort(o)[0],c=h.segment;let u=kr(n,h,s);const d=t.getPixelFromCoordinate(u);let g=(0,Ge.TE)(e,d);if(l||g<=this.pixelTolerance_){const f={};if(f[(0,J.sq)(c)]=!0,this.snapToPointer_||(this.delta_[0]=u[0]-n[0],this.delta_[1]=u[1]-n[1]),h.geometry.getType()==="Circle"&&h.index===qi)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(u,[h.feature],[h.geometry]);else{const m=t.getPixelFromCoordinate(c[0]),_=t.getPixelFromCoordinate(c[1]),v=(0,Ge.bI)(d,m),w=(0,Ge.bI)(d,_);g=Math.sqrt(Math.min(v,w)),this.snappedToVertex_=g<=this.pixelTolerance_,this.snappedToVertex_&&(u=v>w?c[1]:c[0]),this.createOrUpdateVertexFeature_(u,[h.feature],[h.geometry]);const E={};E[(0,J.sq)(h.geometry)]=!0;for(let L=1,M=a.length;L<M;++L){const A=a[L].segment;if((0,Ge.fS)(c[0],A[0])&&(0,Ge.fS)(c[1],A[1])||(0,Ge.fS)(c[0],A[1])&&(0,Ge.fS)(c[1],A[0])){const O=(0,J.sq)(a[L].geometry);O in E||(E[O]=!0,f[(0,J.sq)(A)]=!0)}else break}}this.vertexSegments_=f;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}insertVertex_(e,t){const i=e.segment,n=e.feature,s=e.geometry,o=e.depth,a=e.index;let l;for(;t.length<s.getStride();)t.push(0);switch(s.getType()){case"MultiLineString":l=s.getCoordinates(),l[o[0]].splice(a+1,0,t);break;case"Polygon":l=s.getCoordinates(),l[o[0]].splice(a+1,0,t);break;case"MultiPolygon":l=s.getCoordinates(),l[o[1]][o[0]].splice(a+1,0,t);break;case"LineString":l=s.getCoordinates(),l.splice(a+1,0,t);break;default:return}this.setGeometryCoordinates_(s,l);const h=this.rBush_;h.remove(e),this.updateSegmentIndices_(s,a,o,1);const c={segment:[i[0],t],feature:n,geometry:s,depth:o,index:a};h.insert((0,C.hI)(c.segment),c),this.dragSegments_.push([c,1]);const u={segment:[t,i[1]],feature:n,geometry:s,depth:o,index:a+1};h.insert((0,C.hI)(u.segment),u),this.dragSegments_.push([u,0]),this.ignoreNextSingleClick_=!0}removePoint(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=gt.Z.POINTERDRAG){const e=this.lastPointerEvent_;this.willModifyFeatures_(e,this.dragSegments_);const t=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new ys(xs.MODIFYEND,this.featuresBeingModified_,e)),this.featuresBeingModified_=null,t}return!1}removeVertex_(){const e=this.dragSegments_,t={};let i=!1,n,s,o,a,l,h,c,u,d,g,f;for(l=e.length-1;l>=0;--l)o=e[l],g=o[0],f=(0,J.sq)(g.feature),g.depth&&(f+="-"+g.depth.join("-")),f in t||(t[f]={}),o[1]===0?(t[f].right=g,t[f].index=g.index):o[1]==1&&(t[f].left=g,t[f].index=g.index+1);for(f in t){switch(d=t[f].right,c=t[f].left,h=t[f].index,u=h-1,c!==void 0?g=c:g=d,u<0&&(u=0),a=g.geometry,s=a.getCoordinates(),n=s,i=!1,a.getType()){case"MultiLineString":s[g.depth[0]].length>2&&(s[g.depth[0]].splice(h,1),i=!0);break;case"LineString":s.length>2&&(s.splice(h,1),i=!0);break;case"MultiPolygon":n=n[g.depth[1]];case"Polygon":n=n[g.depth[0]],n.length>4&&(h==n.length-1&&(h=0),n.splice(h,1),i=!0,h===0&&(n.pop(),n.push(n[0]),u=n.length-1));break;default:}if(i){this.setGeometryCoordinates_(a,s);const m=[];if(c!==void 0&&(this.rBush_.remove(c),m.push(c.segment[0])),d!==void 0&&(this.rBush_.remove(d),m.push(d.segment[1])),c!==void 0&&d!==void 0){const _={depth:g.depth,feature:g.feature,geometry:g.geometry,index:u,segment:m};this.rBush_.insert((0,C.hI)(_.segment),_)}this.updateSegmentIndices_(a,h,g.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),e.length=0}}return i}setGeometryCoordinates_(e,t){this.changingFeature_=!0,e.setCoordinates(t),this.changingFeature_=!1}updateSegmentIndices_(e,t,i,n){this.rBush_.forEachInExtent(e.getExtent(),function(s){s.geometry===e&&(i===void 0||s.depth===void 0||(0,qe.fS)(s.depth,i))&&s.index>t&&(s.index+=n)})}}function ol(r,e){return r.index-e.index}function Or(r,e,t){const i=e.geometry;if(i.getType()==="Circle"){let s=i;if(e.index===qi){const o=(0,U.Cs)();o&&(s=s.clone().transform(o,t));const a=(0,Ge.bI)(s.getCenter(),(0,U.Vs)(r,t)),l=Math.sqrt(a)-s.getRadius();return l*l}}const n=(0,U.Vs)(r,t);return wi[0]=(0,U.Vs)(e.segment[0],t),wi[1]=(0,U.Vs)(e.segment[1],t),(0,Ge.Bs)(n,wi)}function kr(r,e,t){const i=e.geometry;if(i.getType()==="Circle"&&e.index===qi){let s=i;const o=(0,U.Cs)();return o&&(s=s.clone().transform(o,t)),(0,U.lO)(s.getClosestPoint((0,U.Vs)(r,t)),t)}const n=(0,U.Vs)(r,t);return wi[0]=(0,U.Vs)(e.segment[0],t),wi[1]=(0,U.Vs)(e.segment[1],t),(0,U.lO)((0,Ge.oL)(n,wi),t)}function al(){const r=lr();return function(e,t){return r.Point}}const ll=rl;var hl=S(28220);class En extends $i.ZP{constructor(e,t,i){super(),i!==void 0&&t===void 0?this.setFlatCoordinates(i,e):(t=t||0,this.setCenterAndRadius(e,t,i))}clone(){const e=new En(this.flatCoordinates.slice(),void 0,this.layout);return e.applyProperties(this),e}closestPointXY(e,t,i,n){const s=this.flatCoordinates,o=e-s[0],a=t-s[1],l=o*o+a*a;if(l<n){if(l===0)for(let h=0;h<this.stride;++h)i[h]=s[h];else{const h=this.getRadius()/Math.sqrt(l);i[0]=s[0]+h*o,i[1]=s[1]+h*a;for(let c=2;c<this.stride;++c)i[c]=s[c]}return i.length=this.stride,l}return n}containsXY(e,t){const i=this.flatCoordinates,n=e-i[0],s=t-i[1];return n*n+s*s<=this.getRadiusSquared_()}getCenter(){return this.flatCoordinates.slice(0,this.stride)}computeExtent(e){const t=this.flatCoordinates,i=t[this.stride]-t[0];return(0,C.T9)(t[0]-i,t[1]-i,t[0]+i,t[1]+i,e)}getRadius(){return Math.sqrt(this.getRadiusSquared_())}getRadiusSquared_(){const e=this.flatCoordinates[this.stride]-this.flatCoordinates[0],t=this.flatCoordinates[this.stride+1]-this.flatCoordinates[1];return e*e+t*t}getType(){return"Circle"}intersectsExtent(e){const t=this.getExtent();if((0,C.kK)(e,t)){const i=this.getCenter();return e[0]<=i[0]&&e[2]>=i[0]||e[1]<=i[1]&&e[3]>=i[1]?!0:(0,C.H6)(e,this.intersectsCoordinate.bind(this))}return!1}setCenter(e){const t=this.stride,i=this.flatCoordinates[t]-this.flatCoordinates[0],n=e.slice();n[t]=n[0]+i;for(let s=1;s<t;++s)n[t+s]=e[s];this.setFlatCoordinates(this.layout,n),this.changed()}setCenterAndRadius(e,t,i){this.setLayout(i,e,0),this.flatCoordinates||(this.flatCoordinates=[]);const n=this.flatCoordinates;let s=(0,hl.IG)(n,0,e,this.stride);n[s++]=n[0]+t;for(let o=1,a=this.stride;o<a;++o)n[s++]=n[o];n.length=s,this.changed()}getCoordinates(){return null}setCoordinates(e,t){}setRadius(e){this.flatCoordinates[this.stride]=this.flatCoordinates[0]+e,this.changed()}rotate(e,t){const i=this.getCenter(),n=this.getStride();this.setCenter((0,qt.U1)(i,0,i.length,n,e,t,i)),this.changed()}translate(e,t){const i=this.getCenter(),n=this.getStride();this.setCenter((0,qt.Iu)(i,0,i.length,n,e,t,i)),this.changed()}}En.prototype.transform;const Br=En;var cl=S(30292),ul=S(33265),dl=S(52520),wn=S(43631),fl=S(40035),Ci=S(24421);const Cn={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class Sn extends pn.ZP{constructor(e,t){super(e),this.feature=t}}function gl(r,e){const t=[];for(let i=0;i<e.length;++i){const s=e[i].getGeometry();Gr(r,s,t)}return t}function Tn(r,e){return(0,Ee.bI)(r[0],r[1],e[0],e[1])}function Si(r,e){const t=r.length;return e<0?r[e+t]:e>=t?r[e-t]:r[e]}function In(r,e,t){let i,n;e<t?(i=e,n=t):(i=t,n=e);const s=Math.ceil(i),o=Math.floor(n);if(s>o){const l=Ti(r,i),h=Ti(r,n);return Tn(l,h)}let a=0;if(i<s){const l=Ti(r,i),h=Si(r,s);a+=Tn(l,h)}if(o<n){const l=Si(r,o),h=Ti(r,n);a+=Tn(l,h)}for(let l=s;l<o-1;++l){const h=Si(r,l),c=Si(r,l+1);a+=Tn(h,c)}return a}function Gr(r,e,t){if(e instanceof et.Z){Rn(r,e.getCoordinates(),!1,t);return}if(e instanceof wn.Z){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n)Rn(r,i[n],!1,t);return}if(e instanceof Nt.ZP){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n)Rn(r,i[n],!0,t);return}if(e instanceof Ci.Z){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n){const o=i[n];for(let a=0,l=o.length;a<l;++a)Rn(r,o[a],!0,t)}return}if(e instanceof cl.Z){const i=e.getGeometries();for(let n=0;n<i.length;++n)Gr(r,i[n],t);return}}const vs={index:-1,endIndex:NaN};function ml(r,e,t,i){const n=r[0],s=r[1];let o=1/0,a=-1,l=NaN;for(let u=0;u<e.targets.length;++u){const d=e.targets[u],g=d.coordinates;let f=1/0,m;for(let _=0;_<g.length-1;++_){const v=g[_],w=g[_+1],E=zr(n,s,v,w);E.squaredDistance<f&&(f=E.squaredDistance,m=_+E.along)}f<o&&(o=f,d.ring&&e.targetIndex===u&&(d.endIndex>d.startIndex?m<d.startIndex&&(m+=g.length):d.endIndex<d.startIndex&&m>d.startIndex&&(m-=g.length)),l=m,a=u)}const h=e.targets[a];let c=h.ring;if(e.targetIndex===a&&c){const u=Ti(h.coordinates,l),d=t.getPixelFromCoordinate(u);(0,Ge.TE)(d,e.startPx)>i&&(c=!1)}if(c){const u=h.coordinates,d=u.length,g=h.startIndex,f=l;if(g<f){const m=In(u,g,f);In(u,g,f-d)<m&&(l-=d)}else{const m=In(u,g,f);In(u,g,f+d)<m&&(l+=d)}}return vs.index=a,vs.endIndex=l,vs}function Rn(r,e,t,i){const n=r[0],s=r[1];for(let o=0,a=e.length-1;o<a;++o){const l=e[o],h=e[o+1],c=zr(n,s,l,h);if(c.squaredDistance===0){const u=o+c.along;i.push({coordinates:e,ring:t,startIndex:u,endIndex:u});return}}}const Es={along:0,squaredDistance:0};function zr(r,e,t,i){const n=t[0],s=t[1],o=i[0],a=i[1],l=o-n,h=a-s;let c=0,u=n,d=s;return(l!==0||h!==0)&&(c=(0,Ee.uZ)(((r-n)*l+(e-s)*h)/(l*l+h*h),0,1),u+=l*c,d+=h*c),Es.along=c,Es.squaredDistance=(0,Ee.FH)((0,Ee.bI)(r,e,u,d),10),Es}function Ti(r,e){const t=r.length;let i=Math.floor(e);const n=e-i;i>=t?i-=t:i<0&&(i+=t);let s=i+1;s>=t&&(s-=t);const o=r[i],a=o[0],l=o[1],h=r[s],c=h[0]-a,u=h[1]-l;return[a+c*n,l+u*n]}class _l extends sr.Z{constructor(e){const t=e;t.stopDown||(t.stopDown=Ji.Dv),super(t),this.on,this.once,this.un,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=e.source?e.source:null,this.features_=e.features?e.features:null,this.snapTolerance_=e.snapTolerance?e.snapTolerance:12,this.type_=e.type,this.mode_=xl(this.type_),this.stopClick_=!!e.stopClick,this.minPoints_=e.minPoints?e.minPoints:this.mode_==="Polygon"?3:2,this.maxPoints_=this.mode_==="Circle"?2:e.maxPoints?e.maxPoints:1/0,this.finishCondition_=e.finishCondition?e.finishCondition:Ji.uX,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY";let i=e.geometryFunction;if(!i){const n=this.mode_;if(n==="Circle")i=function(s,o,a){const l=o||new Br([NaN,NaN]),h=(0,U.Vs)(s[0],a),c=(0,Ge.bI)(h,(0,U.Vs)(s[s.length-1],a));l.setCenterAndRadius(h,Math.sqrt(c),this.geometryLayout_);const u=(0,U.Cs)();return u&&l.transform(a,u),l};else{let s;n==="Point"?s=Bt.Z:n==="LineString"?s=et.Z:n==="Polygon"&&(s=Nt.ZP),i=function(o,a,l){return a?n==="Polygon"?o[0].length?a.setCoordinates([o[0].concat([o[0][0]])],this.geometryLayout_):a.setCoordinates([],this.geometryLayout_):a.setCoordinates(o,this.geometryLayout_):a=new s(o,this.geometryLayout_),a}}}this.geometryFunction_=i,this.dragVertexDelay_=e.dragVertexDelay!==void 0?e.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=e.clickTolerance?e.clickTolerance*e.clickTolerance:36,this.overlay_=new ze({source:new _t({useSpatialIndex:!1,wrapX:e.wrapX?e.wrapX:!1}),style:e.style?e.style:pl(),updateWhileInteracting:!0}),this.geometryName_=e.geometryName,this.condition_=e.condition?e.condition:Wt.rM,this.freehandCondition_,e.freehand?this.freehandCondition_=Wt.Bx:this.freehandCondition_=e.freehandCondition?e.freehandCondition:Wt.vY,this.traceCondition_,this.setTrace(e.trace||!1),this.traceState_={active:!1},this.traceSource_=e.traceSource||e.source||null,this.addChangeListener(ul.Z.ACTIVE,this.updateState_)}setTrace(e){let t;e?e===!0?t=Wt.Bx:t=e:t=Wt.Fi,this.traceCondition_=t}setMap(e){super.setMap(e),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(e){e.originalEvent.type===ot.Z.CONTEXTMENU&&e.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(e);let t=e.type===gt.Z.POINTERMOVE,i=!0;return!this.freehand_&&this.lastDragTime_&&e.type===gt.Z.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,t=!0):this.lastDragTime_=void 0,this.shouldHandle_&&this.downTimeout_!==void 0&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)),this.freehand_&&e.type===gt.Z.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(e.coordinate),i=!1):this.freehand_&&e.type===gt.Z.POINTERDOWN?i=!1:t&&this.getPointerCount()<2?(i=e.type===gt.Z.POINTERMOVE,i&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):(e.originalEvent.pointerType==="mouse"||e.type===gt.Z.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(e)):e.type===gt.Z.DBLCLICK&&(i=!1),super.handleEvent(e)&&i}handleDownEvent(e){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=e.pixel,this.finishCoordinate_||this.startDrawing_(e.coordinate),!0):this.condition_(e)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(()=>{this.handlePointerMove_(new dl.Z(gt.Z.POINTERMOVE,e.map,e.originalEvent,!1,e.frameState))},this.dragVertexDelay_),this.downPx_=e.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(e){if(!this.traceSource_||!this.traceCondition_(e))return;if(this.traceState_.active){this.deactivateTrace_();return}const t=this.getMap(),i=t.getCoordinateFromPixel([e.pixel[0]-this.snapTolerance_,e.pixel[1]+this.snapTolerance_]),n=t.getCoordinateFromPixel([e.pixel[0]+this.snapTolerance_,e.pixel[1]-this.snapTolerance_]),s=(0,C.hI)([i,n]),o=this.traceSource_.getFeaturesInExtent(s);if(o.length===0)return;const a=gl(e.coordinate,o);a.length&&(this.traceState_={active:!0,startPx:e.pixel.slice(),targets:a,targetIndex:-1})}addOrRemoveTracedCoordinates_(e,t){const i=e.startIndex<=e.endIndex,n=e.startIndex<=t;i===n?i&&t>e.endIndex||!i&&t<e.endIndex?this.addTracedCoordinates_(e,e.endIndex,t):(i&&t<e.endIndex||!i&&t>e.endIndex)&&this.removeTracedCoordinates_(t,e.endIndex):(this.removeTracedCoordinates_(e.startIndex,e.endIndex),this.addTracedCoordinates_(e,e.startIndex,t))}removeTracedCoordinates_(e,t){if(e===t)return;let i=0;if(e<t){const n=Math.ceil(e);let s=Math.floor(t);s===t&&(s-=1),i=s-n+1}else{const n=Math.floor(e);let s=Math.ceil(t);s===t&&(s+=1),i=n-s+1}i>0&&this.removeLastPoints_(i)}addTracedCoordinates_(e,t,i){if(t===i)return;const n=[];if(t<i){const s=Math.ceil(t);let o=Math.floor(i);o===i&&(o-=1);for(let a=s;a<=o;++a)n.push(Si(e.coordinates,a))}else{const s=Math.floor(t);let o=Math.ceil(i);o===i&&(o+=1);for(let a=s;a>=o;--a)n.push(Si(e.coordinates,a))}n.length&&this.appendCoordinates(n)}updateTrace_(e){const t=this.traceState_;if(!t.active||t.targetIndex===-1&&(0,Ge.TE)(t.startPx,e.pixel)<this.snapTolerance_)return;const i=ml(e.coordinate,t,this.getMap(),this.snapTolerance_);if(t.targetIndex!==i.index){if(t.targetIndex!==-1){const l=t.targets[t.targetIndex];this.removeTracedCoordinates_(l.startIndex,l.endIndex)}const a=t.targets[i.index];this.addTracedCoordinates_(a,a.startIndex,i.endIndex)}else{const a=t.targets[t.targetIndex];this.addOrRemoveTracedCoordinates_(a,i.endIndex)}t.targetIndex=i.index;const n=t.targets[t.targetIndex];n.endIndex=i.endIndex;const s=Ti(n.coordinates,n.endIndex),o=this.getMap().getPixelFromCoordinate(s);e.coordinate=s,e.pixel=[Math.round(o[0]),Math.round(o[1])]}handleUpEvent(e){let t=!0;if(this.getPointerCount()===0){this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(e);const i=this.traceState_.active;if(this.toggleTraceState_(e),this.shouldHandle_){const n=!this.finishCoordinate_;n&&this.startDrawing_(e.coordinate),!n&&this.freehand_?this.finishDrawing():!this.freehand_&&(!n||this.mode_==="Point")&&(this.atFinish_(e.pixel,i)?this.finishCondition_(e)&&this.finishDrawing():this.addToDrawing_(e.coordinate)),t=!1}else this.freehand_&&this.abortDrawing()}return!t&&this.stopClick_&&e.preventDefault(),t}handlePointerMove_(e){if(this.pointerType_=e.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){const t=this.downPx_,i=e.pixel,n=t[0]-i[0],s=t[1]-i[1],o=n*n+s*s;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return}if(!this.finishCoordinate_){this.createOrUpdateSketchPoint_(e.coordinate.slice());return}this.updateTrace_(e),this.modifyDrawing_(e.coordinate)}atFinish_(e,t){let i=!1;if(this.sketchFeature_){let n=!1,s=[this.finishCoordinate_];const o=this.mode_;if(o==="Point")i=!0;else if(o==="Circle")i=this.sketchCoords_.length===2;else if(o==="LineString")n=!t&&this.sketchCoords_.length>this.minPoints_;else if(o==="Polygon"){const a=this.sketchCoords_;n=a[0].length>this.minPoints_,s=[a[0][0],a[0][a[0].length-2]],t?s=[a[0][0]]:s=[a[0][0],a[0][a[0].length-2]]}if(n){const a=this.getMap();for(let l=0,h=s.length;l<h;l++){const c=s[l],u=a.getPixelFromCoordinate(c),d=e[0]-u[0],g=e[1]-u[1],f=this.freehand_?1:this.snapTolerance_;if(i=Math.sqrt(d*d+g*g)<=f,i){this.finishCoordinate_=c;break}}}}return i}createOrUpdateSketchPoint_(e){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(e):(this.sketchPoint_=new tt.Z(new Bt.Z(e)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(e){this.sketchLine_||(this.sketchLine_=new tt.Z);const t=e.getLinearRing(0);let i=this.sketchLine_.getGeometry();i?(i.setFlatCoordinates(t.getLayout(),t.getFlatCoordinates()),i.changed()):(i=new et.Z(t.getFlatCoordinates(),t.getLayout()),this.sketchLine_.setGeometry(i))}startDrawing_(e){const t=this.getMap().getView().getProjection(),i=(0,$i.tP)(this.geometryLayout_);for(;e.length<i;)e.push(0);this.finishCoordinate_=e,this.mode_==="Point"?this.sketchCoords_=e.slice():this.mode_==="Polygon"?(this.sketchCoords_=[[e.slice(),e.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[e.slice(),e.slice()],this.sketchLineCoords_&&(this.sketchLine_=new tt.Z(new et.Z(this.sketchLineCoords_)));const n=this.geometryFunction_(this.sketchCoords_,void 0,t);this.sketchFeature_=new tt.Z,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(n),this.updateSketchFeatures_(),this.dispatchEvent(new Sn(Cn.DRAWSTART,this.sketchFeature_))}modifyDrawing_(e){const t=this.getMap(),i=this.sketchFeature_.getGeometry(),n=t.getView().getProjection(),s=(0,$i.tP)(this.geometryLayout_);let o,a;for(;e.length<s;)e.push(0);this.mode_==="Point"?a=this.sketchCoords_:this.mode_==="Polygon"?(o=this.sketchCoords_[0],a=o[o.length-1],this.atFinish_(t.getPixelFromCoordinate(e))&&(e=this.finishCoordinate_.slice())):(o=this.sketchCoords_,a=o[o.length-1]),a[0]=e[0],a[1]=e[1],this.geometryFunction_(this.sketchCoords_,i,n),this.sketchPoint_&&this.sketchPoint_.getGeometry().setCoordinates(e),i.getType()==="Polygon"&&this.mode_!=="Polygon"?this.createOrUpdateCustomSketchLine_(i):this.sketchLineCoords_&&this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_),this.updateSketchFeatures_()}addToDrawing_(e){const t=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection();let n,s;const o=this.mode_;o==="LineString"||o==="Circle"?(this.finishCoordinate_=e.slice(),s=this.sketchCoords_,s.length>=this.maxPoints_&&(this.freehand_?s.pop():n=!0),s.push(e.slice()),this.geometryFunction_(s,t,i)):o==="Polygon"&&(s=this.sketchCoords_[0],s.length>=this.maxPoints_&&(this.freehand_?s.pop():n=!0),s.push(e.slice()),n&&(this.finishCoordinate_=s[0]),this.geometryFunction_(this.sketchCoords_,t,i)),this.createOrUpdateSketchPoint_(e.slice()),this.updateSketchFeatures_(),n&&this.finishDrawing()}removeLastPoints_(e){if(!this.sketchFeature_)return;const t=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection(),n=this.mode_;for(let s=0;s<e;++s){let o;if(n==="LineString"||n==="Circle"){if(o=this.sketchCoords_,o.splice(-2,1),o.length>=2){this.finishCoordinate_=o[o.length-2].slice();const a=this.finishCoordinate_.slice();o[o.length-1]=a,this.createOrUpdateSketchPoint_(a)}this.geometryFunction_(o,t,i),t.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(t)}else if(n==="Polygon"){o=this.sketchCoords_[0],o.splice(-2,1);const a=this.sketchLine_.getGeometry();if(o.length>=2){const l=o[o.length-2].slice();o[o.length-1]=l,this.createOrUpdateSketchPoint_(l)}a.setCoordinates(o),this.geometryFunction_(this.sketchCoords_,t,i)}if(o.length===1){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const e=this.abortDrawing_();if(!e)return;let t=this.sketchCoords_;const i=e.getGeometry(),n=this.getMap().getView().getProjection();this.mode_==="LineString"?(t.pop(),this.geometryFunction_(t,i,n)):this.mode_==="Polygon"&&(t[0].pop(),this.geometryFunction_(t,i,n),t=i.getCoordinates()),this.type_==="MultiPoint"?e.setGeometry(new fl.Z([t])):this.type_==="MultiLineString"?e.setGeometry(new wn.Z([t])):this.type_==="MultiPolygon"&&e.setGeometry(new Ci.Z([t])),this.dispatchEvent(new Sn(Cn.DRAWEND,e)),this.features_&&this.features_.push(e),this.source_&&this.source_.addFeature(e)}abortDrawing_(){this.finishCoordinate_=null;const e=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),e}abortDrawing(){const e=this.abortDrawing_();e&&this.dispatchEvent(new Sn(Cn.DRAWABORT,e))}appendCoordinates(e){const t=this.mode_,i=!this.sketchFeature_;i&&this.startDrawing_(e[0]);let n;if(t==="LineString"||t==="Circle")n=this.sketchCoords_;else if(t==="Polygon")n=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;i&&n.shift(),n.pop();for(let o=0;o<e.length;o++)this.addToDrawing_(e[o]);const s=e[e.length-1];this.addToDrawing_(s),this.modifyDrawing_(s)}extend(e){const i=e.getGeometry();this.sketchFeature_=e,this.sketchCoords_=i.getCoordinates();const n=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=n.slice(),this.sketchCoords_.push(n.slice()),this.sketchPoint_=new tt.Z(new Bt.Z(n)),this.updateSketchFeatures_(),this.dispatchEvent(new Sn(Cn.DRAWSTART,this.sketchFeature_))}updateSketchFeatures_(){const e=[];this.sketchFeature_&&e.push(this.sketchFeature_),this.sketchLine_&&e.push(this.sketchLine_),this.sketchPoint_&&e.push(this.sketchPoint_);const t=this.overlay_.getSource();t.clear(!0),t.addFeatures(e)}updateState_(){const e=this.getMap(),t=this.getActive();(!e||!t)&&this.abortDrawing(),this.overlay_.setMap(t?e:null)}}function pl(){const r=lr();return function(e,t){return r[e.getGeometry().getType()]}}function pu(r,e){return function(t,i,n){const s=fromUserCoordinate(t[0],n),o=fromUserCoordinate(t[t.length-1],n),a=Math.sqrt(squaredCoordinateDistance(s,o));i=i||fromCircle(new Circle(s),r);let l=e;if(!e&&e!==0){const c=o[0]-s[0],u=o[1]-s[1];l=Math.atan2(u,c)}makeRegular(i,s,a,l);const h=getUserProjection();return h&&i.transform(n,h),i}}function xu(){return function(r,e,t){const i=boundingExtent([r[0],r[r.length-1]].map(function(o){return fromUserCoordinate(o,t)})),n=[[getBottomLeft(i),getBottomRight(i),getTopRight(i),getTopLeft(i),getBottomLeft(i)]];e?e.setCoordinates(n):e=new Polygon(n);const s=getUserProjection();return s&&e.transform(t,s),e}}function xl(r){switch(r){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+r)}}const yl=_l;var Wr=S(76254);class Nr extends ze{constructor(){super({source:new _t}),this.opts={action:"length",unit:"m"},this.segmentStyle=new ge({text:new xi({font:"12px Calibri,sans-serif",fill:new Ie({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Ie({color:"rgba(0, 0, 0, 0.4)"}),padding:[2,2,2,2],textBaseline:"bottom",offsetY:-12}),image:new He({radius:6,points:3,angle:Math.PI,displacement:[0,8],fill:new Ie({color:"rgba(0, 0, 0, 0.4)"})})}),this.segmentStyles=[this.segmentStyle],this.shapeStyle=[new ge({fill:new Ie({color:"rgba(255, 255, 255, 0.2)"}),image:new Ct({radius:5,stroke:new Re({color:"rgba(0, 0, 0, 0.7)"}),fill:new Ie({color:"rgba(255, 255, 255, 0.2)"})})}),new ge({stroke:new Re({color:[0,0,0,1],width:2,lineDash:[4,8],lineDashOffset:6})}),new ge({stroke:new Re({color:[255,255,255,1],width:2,lineDash:[4,8]})})],this.labelStyle=new ge({text:new xi({font:"14px Calibri,sans-serif",fill:new Ie({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Ie({color:"rgba(0, 0, 0, 0.7)"}),padding:[3,3,3,3],textBaseline:"bottom",offsetY:-15}),image:new He({radius:8,points:3,angle:Math.PI,displacement:[0,10],fill:new Ie({color:"rgba(0, 0, 0, 0.7)"})})}),this.tipStyle=new ge({text:new xi({font:"12px Calibri,sans-serif",fill:new Ie({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Ie({color:"rgba(0, 0, 0, 0.4)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),this.modifyStyle=new ge({image:new Ct({radius:5,stroke:new Re({color:"rgba(0, 0, 0, 0.7)"}),fill:new Ie({color:"rgba(0, 0, 0, 0.4)"})}),text:new xi({text:"Drag to modify",font:"12px Calibri,sans-serif",fill:new Ie({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Ie({color:"rgba(0, 0, 0, 0.7)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),this.modify=new ll({source:this.getSource(),style:this.modifyStyle}),this.setStyle(e=>this.styleFunction(e,!1)),this.setVisible(!0)}setOptions(e){this.opts=e,this.getSource()?.refresh()}getMapMeasurement(e){let t=0,i=$e[0];return this.opts.action==="area"?(i=$e[1],t=(0,Wr.bg)(e)):t=(0,Wr.xA)(e),(0,ft.zc)(i.getUnit(this.opts.unit).format(t))}styleFunction(e,t,i,n){const s=[...this.shapeStyle],o=e.getGeometry();if(o){const a=o.getType();let l,h,c;if(!i||i===a)if(a==="Polygon"){const u=o;l=u.getInteriorPoint(),h=this.getMapMeasurement(o),c=new et.Z(u.getCoordinates()[0])}else a==="LineString"&&(c=o,l=new Bt.Z(c.getLastCoordinate()),h=this.getMapMeasurement(o));if(t&&c){let u=0;c.forEachSegment((d,g)=>{const f=new et.Z([d,g]),m=this.getMapMeasurement(f);this.segmentStyles.length-1<u&&this.segmentStyles.push(this.segmentStyle.clone());const _=new Bt.Z(f.getCoordinateAt(.5));this.segmentStyles[u].setGeometry(_),this.segmentStyles[u].getText().setText(m),s.push(this.segmentStyles[u]),u++})}h&&(this.labelStyle.setGeometry(l),this.labelStyle.getText().setText(h),s.push(this.labelStyle)),n&&a==="Point"&&!this.modify.getOverlay().getSource().getFeatures().length&&(this.tipPoint=o,this.tipStyle.getText().setText(n),s.push(this.tipStyle))}return s}addInteraction(e,t,i,n){const s=t,o=" Click to continue "+(s==="Polygon"?"polygon":"line")+` 
 (double-click to end) `,a=" Click to start ";let l=a;this.draw=new yl({source:this.getSource(),type:s,style:h=>this.styleFunction(h,i,s,l)}),this.draw.on("drawstart",()=>{n&&this.getSource().clear(),this.modify.setActive(!1),l=o}),this.draw.on("drawend",()=>{this.modifyStyle.setGeometry(this.tipPoint),this.modify.setActive(!0),e.once("pointermove",()=>{this.modifyStyle.setGeometry("")}),l=a}),this.modify.setActive(!0),e.addInteraction(this.draw)}}const vl=({map:r,menuActiveState:e})=>{const t=(0,p.useRef)(new Nr),i=El(di.vc.theme2),[n,s]=(0,p.useState)(!0),[o,a]=(0,p.useState)(!1),[l,h]=(0,p.useState)({action:$e[0].value,unit:$e[0].units[0].value}),c=(0,p.useMemo)(()=>{const f=$e.find(_=>_.value===l.action)??$e[0],m=f.getUnit(l.unit);return t.current.setOptions(l),{current:m,options:f.units}},[l]),u=!0,d=!1;function g(){if(a(!o),e(!o),o)r.removeInteraction(t.current.draw),t.current.setVisible(!1);else{n&&(s(!1),t.current.setZIndex(1),r.addLayer(t.current),r.addInteraction(t.current.modify)),t.current.setVisible(!0),r.removeInteraction(t.current.draw);const f=$e.find(m=>m.value===l.action)??$e[0];t.current.addInteraction(r,f.geometry,d,u)}}return p.createElement("div",{className:`${i.infoWrap} ${o?null:i.infoWrapClosed}`},o?p.createElement("div",null,p.createElement("div",{className:i.rowGroup},p.createElement(gn.S,{value:l.action,options:$e,size:"md",fullWidth:!1,onChange:f=>{r.removeInteraction(t.current.draw);const m=$e.find(v=>v.value===f)??$e[0],_=m.getUnit(l.unit);h({...l,action:m.value,unit:_.value}),t.current.addInteraction(r,m.geometry,d,u)}}),p.createElement(mn.zx,{className:i.button,icon:"times",variant:"secondary",size:"sm",onClick:g})),p.createElement(pi.Ph,{className:i.unitSelect,value:c.current,options:c.options,isSearchable:!1,onChange:f=>{const m=$e.find(v=>v.value===l.action)??$e[0],_=m.getUnit(f.value)??m.units[0];h({...l,unit:_.value})}})):p.createElement(ts.h,{className:i.icon,name:"ruler-combined",tooltip:"show measure tools",tooltipPlacement:"left",onClick:g}))},El=(0,nr.B)(r=>({button:ee.css`
    margin-left: auto;
  `,icon:ee.css`
    background-color: ${r.colors.secondary.main};
    display: inline-block;
    height: 19.25px;
    margin: 1px;
    width: 19.25px;
  `,infoWrap:ee.css`
    color: ${r.colors.text};
    background-color: ${r.colors.background.secondary};
    border-radius: 4px;
    padding: 2px;
  `,infoWrapClosed:ee.css`
    height: 25.25px;
    width: 25.25px;
  `,rowGroup:ee.css`
    display: flex;
    justify-content: flex-end;
  `,unitSelect:ee.css`
    min-width: 200px;
  `}));var yu=S(28732),vu=S(82080);function wl(r){return Ye.css`
    .ol-scale-line {
      background: ${r.colors.border.weak}; // rgba(0,60,136,0.3);
    }
    .ol-scale-line-inner {
      border: 1px solid ${r.colors.text.primary}; // #eee;
      border-top: 0px;
      color: ${r.colors.text.primary}; //  #eee;
    }
    .ol-control {
      background-color: ${r.colors.background.primary}; //rgba(255,255,255,0.4);
    }
    .ol-control:hover {
      background-color: ${r.colors.background.secondary}; // rgba(255,255,255,0.6);
    }
    .ol-control button {
      color: ${r.colors.secondary.text}; // white;
      background-color: ${r.colors.secondary.main}; // rgba(0,60,136,0.5);
    }
    .ol-control button:hover {
      color: ${r.colors.secondary.text};
      background-color: ${r.colors.secondary.shade}; // rgba(0,60,136,0.5);
    }
    .ol-control button:focus {
      color: ${r.colors.secondary.text};
      background-color: ${r.colors.secondary.main}; // rgba(0,60,136,0.5);
    }
    .ol-attribution ul {
      color: ${r.colors.text.primary}; //  #000;
      text-shadow: none;
    }
    .ol-attribution:not(.ol-collapsed) {
      background-color: ${r.colors.background.secondary}; // rgba(255,255,255,0.8);
    }
  `}var Ze=S(40538),Zt=S(43524);class Cl extends p.Component{constructor(e){super(e),this.state={subProps:e.initialSubProps}}componentDidMount(){this.sub=this.props.watch.subscribe({next:e=>{this.setState({subProps:e})},complete:()=>{},error:e=>{}})}componentWillUnmount(){this.sub&&this.sub.unsubscribe()}render(){const{subProps:e}=this.state;return p.createElement(this.props.child,{...e})}}var bn=S(81653),Zr=S(59980),Ur=S(72990),Sl=S(99601),Tl=S(10),Il=S(16964),Rl=S(97551);function bl(r){const{layerName:e,styleConfig:t,layer:i}=r,n=(0,_e.wW)(Ll),s=(0,bn.Z)(i?.__state?.mouseEvents??(0,Zr.of)(void 0)),o=t?.dims?.color?.field,a=(0,p.useMemo)(()=>{if(!o||!s)return;const f=s.getProperties();if(!f.frame)return;const _=f.rowIndex;return o.values[_]},[s,o]);if(!t)return p.createElement(p.Fragment,null);const{color:l,opacity:h}=t?.base??{},c=t?.config.symbol?.fixed;if(l&&c&&!o)return p.createElement("div",{className:n.infoWrap},p.createElement("div",{className:n.layerName},e),p.createElement("div",{className:(0,ee.cx)(n.layerBody,n.fixedColorContainer)},p.createElement(Il.V,{src:`public/${c}`,className:n.legendSymbol,title:"Symbol",style:{fill:l,opacity:h}})));if(!o)return p.createElement(p.Fragment,null);const u=(0,Ur.fD)(o);if(u.isContinuous&&u.getColors){const f=u.getColors(di.vc.theme2),m=(0,Sl.dz)(o),_=o.display?v=>(0,ft.zc)(o.display(v)):v=>`${v}`;return p.createElement("div",{className:n.infoWrap},p.createElement("div",{className:n.layerName},e),p.createElement("div",{className:(0,ee.cx)(n.layerBody,n.colorScaleWrapper)},p.createElement(Tl.q,{hoverValue:a,colorPalette:f,min:m.min,max:m.max,display:_,useStopsPercentage:!1})))}const d=o?.config?.thresholds;if(!d||d.steps.length<2)return p.createElement("div",null);const g=(0,Rl.Ur)(o.config,di.vc.theme2);return p.createElement("div",{className:n.infoWrap},p.createElement("div",{className:n.layerName},e),p.createElement("div",{className:(0,ee.cx)(n.layerBody,n.legend)},g.map((f,m)=>p.createElement("div",{key:`${m}/${f.label}`,className:n.legendItem},p.createElement("i",{style:{background:f.color}}),f.label))))}const Ll=r=>({infoWrap:ee.css`
    display: flex;
    flex-direction: column;
    background: ${r.colors.background.secondary};
    border-radius: 1px;
    padding: ${r.spacing(1)};
    border-bottom: 2px solid ${r.colors.border.strong};
    min-width: 150px;
  `,layerName:ee.css`
    font-size: ${r.typography.body.fontSize};
  `,layerBody:ee.css`
    padding-left: 10px;
  `,legend:ee.css`
    line-height: 18px;
    display: flex;
    flex-direction: column;
    font-size: ${r.typography.bodySmall.fontSize};
    padding: 5px 10px 0;

    i {
      width: 15px;
      height: 15px;
      float: left;
      margin-right: 8px;
      opacity: 0.7;
      border-radius: 50%;
    }
  `,legendItem:ee.css`
    white-space: nowrap;
  `,fixedColorContainer:ee.css`
    min-width: 80px;
    font-size: ${r.typography.bodySmall.fontSize};
    padding-top: 5px;
  `,legendSymbol:ee.css`
    height: 18px;
    width: 18px;
    margin: auto;
  `,colorScaleWrapper:ee.css`
    min-width: 200px;
    font-size: ${r.typography.bodySmall.fontSize};
    padding-top: 10px;
  `});var ws=S(46528),V=S(38286),St=S(11543),at=S(81764),pt=S(24799),Fl=S(77117),Ml=S(90208),Cs=S(52081),Ss=S(12503),Xr=S(74912),ii=S(54643),Ln=S(92484),Vr=S(63418),Fn=S(53908),Mn=S(25532),Pl=(r=>(r.circle="circle",r.square="square",r.triangle="triangle",r.star="star",r.cross="cross",r.x="x",r))(Pl||{});const Ii={circle:"img/icons/marker/circle.svg",square:"img/icons/marker/square.svg",triangle:"img/icons/marker/triangle.svg",star:"img/icons/marker/star.svg",cross:"img/icons/marker/cross.svg",x:"img/icons/marker/x-mark.svg"};function Ri(r){const e=r.opacity==null?.8:r.opacity;if(e===1)return new Ie({color:r.color});if(e>0){const t=(0,fe.Z)(r.color).setAlpha(e).toRgbString();return new Ie({color:t})}}function Dl(r){const e=r.opacity==null?.8:r.opacity;if(e===1)return new Re({color:r.color,width:r.lineWidth??1});if(e>0){const t=(0,fe.Z)(r.color).setAlpha(e).toRgbString();return new Re({color:t,width:r.lineWidth??1})}}const Pt=r=>{if(!r.text)return;const e=Xe.v.theme2.typography.fontFamily,t={...V.Er.textConfig,...r.textConfig};return new xi({text:r.text,fill:new Ie({color:r.color??V.Er.color.fixed}),font:`normal ${t.fontSize}px ${e}`,...t})},Al=r=>new ge({text:Pt(r)}),Yr=r=>{const e=new Re({color:r.color,width:r.lineWidth??1});return new ge({image:new Ct({stroke:e,fill:Ri(r),radius:r.size??V.Cg}),text:Pt(r),stroke:e})},Pn=r=>new ge({fill:Ri(r),stroke:new Re({color:r.color,width:r.lineWidth??1}),text:Pt(r)}),Ts=r=>new ge({fill:Ri(r),stroke:Dl(r),text:Pt(r)}),jr=r=>{const e=r.size??V.Cg,t=new Re({color:"#F00",width:1});return[new ge({image:new He({stroke:t,points:4,radius:e,angle:Math.PI/4})}),new ge({image:new He({stroke:t,points:4,radius:e,radius2:0,angle:0})})]},Ol=[{id:"circle",name:"Circle",aliasIds:[Ii.circle],make:Yr},{id:"square",name:"Square",aliasIds:[Ii.square],make:r=>{const e=r.size??V.Cg,t=r.rotation??0;return new ge({image:new He({stroke:new Re({color:r.color,width:r.lineWidth??1}),fill:Ri(r),points:4,radius:e,rotation:t*Math.PI/180+Math.PI/4}),text:Pt(r)})}},{id:"triangle",name:"Triangle",aliasIds:[Ii.triangle],make:r=>{const e=r.size??V.Cg,t=r.rotation??0;return new ge({image:new He({stroke:new Re({color:r.color,width:r.lineWidth??1}),fill:Ri(r),points:3,radius:e,rotation:t*Math.PI/180,angle:0}),text:Pt(r)})}},{id:"star",name:"Star",aliasIds:[Ii.star],make:r=>{const e=r.size??V.Cg,t=r.rotation??0;return new ge({image:new He({stroke:new Re({color:r.color,width:r.lineWidth??1}),fill:Ri(r),points:5,radius:e,radius2:e*.4,angle:0,rotation:t*Math.PI/180}),text:Pt(r)})}},{id:"cross",name:"Cross",aliasIds:[Ii.cross],make:r=>{const e=r.size??V.Cg,t=r.rotation??0;return new ge({image:new He({stroke:new Re({color:r.color,width:r.lineWidth??1}),points:4,radius:e,radius2:0,angle:0,rotation:t*Math.PI/180}),text:Pt(r)})}},{id:"x",name:"X",aliasIds:[Ii.x],make:r=>{const e=r.size??V.Cg,t=r.rotation??0;return new ge({image:new He({stroke:new Re({color:r.color,width:r.lineWidth??1}),points:4,radius:e,radius2:0,rotation:t*Math.PI/180+Math.PI/4}),text:Pt(r)})}}];async function kl(r,e){return fetch(r,{method:"GET"}).then(t=>t.text()).then(t=>{t=Vr.QX.sanitizeSVGContent(t);const s=new DOMParser().parseFromString(t,"image/svg+xml").getElementsByTagName("svg")[0];if(!s)return"";const o=e??100,a=s.getAttribute("width")??o,l=s.getAttribute("height")??o;s.setAttribute("fill","#fff"),s.setAttribute("width",`${a}px`),s.setAttribute("height",`${l}px`);const h=new XMLSerializer().serializeToString(s);return`data:image/svg+xml,${encodeURIComponent(h)}`}).catch(t=>(console.error(t),""))}const Is=new Fn.B(()=>Ol);function Bl(r){const e=Is.getIfExists(r);if(e?.aliasIds?.length)return e.aliasIds[0]}async function Gl(r,e){if(!r)return e?Al:Yr;let t=Is.getIfExists(r);if(t)return t.make;if(r.endsWith(".svg")){const i=await kl((0,Mn.getPublicOrAbsoluteUrl)(r));return t={id:r,name:r,aliasIds:[],make:i?n=>{const s=n.size??V.Cg,o=n.rotation??0;return[new ge({image:new xn({src:i,color:n.color,opacity:n.opacity??1,scale:(V.Cg+s)/100,rotation:o*Math.PI/180}),text:n?.text?Pt(n):void 0}),new ge({image:new He({fill:new Ie({color:"rgba(0,0,0,0)"}),points:4,radius:n.size,rotation:o*Math.PI/180+Math.PI/4})})]}:jr},Is.register(t),t.make}return jr}function Hr(r){const e=r?.text;return e?!!(e.mode===Ze.xy.Fixed&&e.fixed?.length||e.mode===Ze.xy.Field&&e.field?.length):!1}async function gi(r){r||(r=V.Er);const e=Hr(r),t={},i=await Gl(r.symbol?.fixed,e),n={config:r,hasText:e,fields:t,base:{color:Xe.v.theme2.visualization.getColorByName(r.color?.fixed??V.Er.color.fixed),opacity:r.opacity??V.Er.opacity,lineWidth:r.lineWidth??1,size:r.size?.fixed??V.Er.size.fixed,rotation:r.rotation?.fixed??V.Er.rotation.fixed},maker:i};return r.color?.field?.length&&(t.color=r.color.field),r.size?.field?.length&&(t.size=r.size.field),r.rotation?.field?.length&&(t.rotation=r.rotation.field),e&&(n.base.text=r.text?.fixed,n.base.textConfig=r.textConfig??V.Er.textConfig,r.text?.field?.length&&(t.text=r.text.field)),Object.keys(t).length||(n.fields=void 0),n}const bi=({value:r,context:e,onChange:t,item:i})=>{const n=i.settings,s=E=>{t({...r,size:E})},o=E=>{t({...r,symbol:E})},a=E=>{t({...r,color:E})},l=E=>{t({...r,opacity:E})},h=E=>{t({...r,rotation:E})},c=E=>{t({...r,text:E})},u=E=>{t({...r,textConfig:{...r.textConfig,fontSize:E}})},d=E=>{t({...r,textConfig:{...r.textConfig,offsetX:E}})},g=E=>{t({...r,textConfig:{...r.textConfig,offsetY:E}})},f=E=>{t({...r,textConfig:{...r.textConfig,textAlign:E}})},m=E=>{t({...r,textConfig:{...r.textConfig,textBaseline:E}})},v=(0,bn.Z)(n?.layerInfo??(0,Zr.of)())?.geometryType===V.bD.Point,w=Hr(r);return n?.simpleFixedValues?p.createElement(p.Fragment,null,v&&p.createElement(p.Fragment,null,p.createElement(St.Z,null,p.createElement(at._,{label:"Symbol"},p.createElement(ii.Lv,{value:r?.symbol??V.Er.symbol,context:e,onChange:o,item:{settings:{resourceType:"icon",folderName:Ln.QS.Marker,placeholderText:w?"Select a symbol":"Select a symbol or add a text label",placeholderValue:V.Er.symbol.fixed,showSourceRadio:!1}}}))),p.createElement(pt.g,{label:"Rotation angle"},p.createElement(ii.k9,{value:r?.rotation??V.Er.rotation,context:e,onChange:h,item:{settings:{min:V.Er.rotation.min,max:V.Er.rotation.max}}}))),p.createElement(St.Z,null,p.createElement(at._,{label:"Color",labelWidth:10},p.createElement(Fl.W,{width:4},p.createElement(Ml.zH,{color:r?.color?.fixed??V.Er.color.fixed,onChange:E=>{a({fixed:E})}})))),p.createElement(St.Z,null,p.createElement(at._,{label:"Opacity",labelWidth:10,grow:!0},p.createElement(Xr.p,{value:r?.opacity??V.Er.opacity,context:e,onChange:l,item:{settings:{min:0,max:1,step:.1}}})))):p.createElement(p.Fragment,null,p.createElement(pt.g,{label:"Size"},p.createElement(ii.cL,{value:r?.size??V.Er.size,context:e,onChange:s,item:{settings:{min:1,max:100}}})),p.createElement(pt.g,{label:"Symbol"},p.createElement(ii.Lv,{value:r?.symbol??V.Er.symbol,context:e,onChange:o,item:{settings:{resourceType:Ln.DD.Icon,folderName:Ln.QS.Marker,placeholderText:w?"Select a symbol":"Select a symbol or add a text label",placeholderValue:V.Er.symbol.fixed,showSourceRadio:!1}}})),p.createElement(pt.g,{label:"Color"},p.createElement(ii.Lm,{value:r?.color??V.Er.color,context:e,onChange:a,item:{}})),p.createElement(pt.g,{label:"Fill opacity"},p.createElement(Xr.p,{value:r?.opacity??V.Er.opacity,context:e,onChange:l,item:{settings:{min:0,max:1,step:.1}}})),n?.displayRotation&&p.createElement(pt.g,{label:"Rotation angle"},p.createElement(ii.k9,{value:r?.rotation??V.Er.rotation,context:e,onChange:h,item:{settings:{min:V.Er.rotation.min,max:V.Er.rotation.max}}})),p.createElement(pt.g,{label:"Text label"},p.createElement(ii.$2,{value:r?.text??Ln.qj,context:e,onChange:c,item:{}})),w&&p.createElement(p.Fragment,null,p.createElement(Cs.Lh,null,p.createElement(pt.g,{label:"Font size"},p.createElement(Ss.w,{value:r?.textConfig?.fontSize??V.Er.textConfig.fontSize,context:e,onChange:u,item:{}})),p.createElement(pt.g,{label:"X offset"},p.createElement(Ss.w,{value:r?.textConfig?.offsetX??V.Er.textConfig.offsetX,context:e,onChange:d,item:{}})),p.createElement(pt.g,{label:"Y offset"},p.createElement(Ss.w,{value:r?.textConfig?.offsetY??V.Er.textConfig.offsetY,context:e,onChange:g,item:{}}))),p.createElement(pt.g,{label:"Align"},p.createElement(gn.S,{value:r?.textConfig?.textAlign??V.Er.textConfig.textAlign,onChange:f,options:[{value:V.H.Left,label:(0,y.capitalize)(V.H.Left)},{value:V.H.Center,label:(0,y.capitalize)(V.H.Center)},{value:V.H.Right,label:(0,y.capitalize)(V.H.Right)}]})),p.createElement(pt.g,{label:"Baseline"},p.createElement(gn.S,{value:r?.textConfig?.textBaseline??V.Er.textConfig.textBaseline,onChange:m,options:[{value:V.EQ.Top,label:(0,y.capitalize)(V.EQ.Top)},{value:V.EQ.Middle,label:(0,y.capitalize)(V.EQ.Middle)},{value:V.EQ.Bottom,label:(0,y.capitalize)(V.EQ.Bottom)}]}))))};class Dn extends _t{constructor(e){super({}),this.location=e}update(e){this.clear(!0);const t=(0,Zt.g6)(e,this.location);if(!t.field){this.changed();return}for(let i=0;i<e.length;i++)this.addFeatureInternal(new tt.Z({frame:e,rowIndex:i,geometry:t.field.values[i]}));this.changed()}updateLineString(e){this.clear(!0);const t=(0,Zt.g6)(e,this.location);if(!t.field){this.changed();return}const i=t.field,n=new et.Z(i.values.map(s=>s.getCoordinates()));this.addFeatureInternal(new tt.Z({frame:e,rowIndex:0,geometry:n})),this.changed()}}var lt=S(44768);const Qi={style:V.Er,showLegend:!0},Rs="markers",bs={type:Rs,name:"",config:Qi,location:{mode:Ze.q1.Auto},tooltip:!0},zl={id:Rs,name:"Markers",description:"Use markers to render each data point",isBaseMap:!1,showLocation:!0,hideOpacity:!0,create:async(r,e,t,i)=>{const n={...Qi,...e?.config},s=await gi(n.style),o=await(0,Zt.cJ)(e.location),a=new Dn(o),l=new ze({source:a}),h=new ws.t(1);let c=null;return n.showLegend&&(c=p.createElement(Cl,{watch:h,initialSubProps:{},child:bl})),s.fields?l.setStyle(u=>{const d=u.get("rowIndex"),g=s.dims;if(!g||!(0,y.isNumber)(d))return s.maker(s.base);const f={...s.base};return g.color&&(f.color=g.color.get(d)),g.size&&(f.size=g.size.get(d)),g.text&&(f.text=g.text.get(d)),g.rotation&&(f.rotation=g.rotation.get(d)),s.maker(f)}):l.setStyle(s.maker(s.base)),{init:()=>l,legend:c,update:u=>{if(!u.series?.length){a.clear();return}for(const d of u.series){s.dims=(0,lt.vV)(d,s,i),c&&h.next({styleConfig:s,size:s.dims?.size,layerName:e.name,layer:l}),a.update(d);break}},registerOptionsUI:u=>{u.addCustomEditor({id:"config.style",path:"config.style",name:"Styles",editor:bi,settings:{displayRotation:!0},defaultValue:Qi.style}).addBooleanSwitch({path:"config.showLegend",name:"Show legend",description:"Show map legend",defaultValue:Qi.showLegend})}}},defaultOptions:Qi};var Li=S(59250);const An={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class Wl extends or.Z{constructor(e){e=e||{};const t=Object.assign({},e);delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getPreload(){return this.get(An.PRELOAD)}setPreload(e){this.set(An.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(An.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(An.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}}const Nl=Wl;var oe=S(15113),Zl=S(87082);class Ul extends cr.Z{constructor(e,t,i){super(),i=i||{},this.tileCoord=e,this.state=t,this.interimTile=null,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(ot.Z.CHANGE)}release(){this.state===oe.Z.ERROR&&this.setState(oe.Z.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let e=this.interimTile;do{if(e.getState()==oe.Z.LOADED)return this.transition_=0,e;e=e.interimTile}while(e);return this}refreshInterimChain(){if(!this.interimTile)return;let e=this.interimTile,t=this;do{if(e.getState()==oe.Z.LOADED){e.interimTile=null;break}else e.getState()==oe.Z.LOADING?t=e:e.getState()==oe.Z.IDLE?t.interimTile=e.interimTile:t=e;e=t.interimTile}while(e)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==oe.Z.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}load(){(0,J.O3)()}getAlpha(e,t){if(!this.transition_)return 1;let i=this.transitionStarts_[e];if(!i)i=t,this.transitionStarts_[e]=i;else if(i===-1)return 1;const n=t-i+1e3/60;return n>=this.transition_?1:(0,Zl.YQ)(n/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}}const Kr=Ul;class Xl extends Kr{constructor(e,t,i,n,s,o){super(e,t,o),this.crossOrigin_=n,this.src_=i,this.key=i,this.image_=new Image,n!==null&&(this.image_.crossOrigin=n),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(e){this.image_=e,this.state=oe.Z.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=oe.Z.ERROR,this.unlistenImage_(),this.image_=Vl(),this.changed()}handleImageLoad_(){const e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=oe.Z.LOADED:this.state=oe.Z.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==oe.Z.ERROR&&(this.state=oe.Z.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==oe.Z.IDLE&&(this.state=oe.Z.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=cs(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function Vl(){const r=(0,ke.E4)(1,1);return r.fillStyle="rgba(0,0,0,0)",r.fillRect(0,0,1,1),r.canvas}const $r=Xl,Yl=.5,jl=10,Jr=.25;class Hl{constructor(e,t,i,n,s,o){this.sourceProj_=e,this.targetProj_=t;let a={};const l=(0,U.Ck)(this.targetProj_,this.sourceProj_);this.transformInv_=function(w){const E=w[0]+"/"+w[1];return a[E]||(a[E]=l(w)),a[E]},this.maxSourceExtent_=n,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&(0,C.dz)(n)==(0,C.dz)(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?(0,C.dz)(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?(0,C.dz)(this.targetProj_.getExtent()):null;const h=(0,C.rL)(i),c=(0,C.Xv)(i),u=(0,C.w$)(i),d=(0,C.hC)(i),g=this.transformInv_(h),f=this.transformInv_(c),m=this.transformInv_(u),_=this.transformInv_(d),v=jl+(o?Math.max(0,Math.ceil(Math.log2((0,C.bg)(i)/(o*o*256*256)))):0);if(this.addQuad_(h,c,u,d,g,f,m,_,v),this.wrapsXInSource_){let w=1/0;this.triangles_.forEach(function(E,L,M){w=Math.min(w,E.source[0][0],E.source[1][0],E.source[2][0])}),this.triangles_.forEach(E=>{if(Math.max(E.source[0][0],E.source[1][0],E.source[2][0])-w>this.sourceWorldWidth_/2){const L=[[E.source[0][0],E.source[0][1]],[E.source[1][0],E.source[1][1]],[E.source[2][0],E.source[2][1]]];L[0][0]-w>this.sourceWorldWidth_/2&&(L[0][0]-=this.sourceWorldWidth_),L[1][0]-w>this.sourceWorldWidth_/2&&(L[1][0]-=this.sourceWorldWidth_),L[2][0]-w>this.sourceWorldWidth_/2&&(L[2][0]-=this.sourceWorldWidth_);const M=Math.min(L[0][0],L[1][0],L[2][0]);Math.max(L[0][0],L[1][0],L[2][0])-M<this.sourceWorldWidth_/2&&(E.source=L)}})}a={}}addTriangle_(e,t,i,n,s,o){this.triangles_.push({source:[n,s,o],target:[e,t,i]})}addQuad_(e,t,i,n,s,o,a,l,h){const c=(0,C.hI)([s,o,a,l]),u=this.sourceWorldWidth_?(0,C.dz)(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,g=this.sourceProj_.canWrapX()&&u>.5&&u<1;let f=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const _=(0,C.hI)([e,t,i,n]);f=(0,C.dz)(_)/this.targetWorldWidth_>Jr||f}!g&&this.sourceProj_.isGlobal()&&u&&(f=u>Jr||f)}if(!f&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!(0,C.kK)(c,this.maxSourceExtent_))return;let m=0;if(!f&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)f=!0;else if(m=(!isFinite(s[0])||!isFinite(s[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(h>0){if(!f){const _=[(e[0]+i[0])/2,(e[1]+i[1])/2],v=this.transformInv_(_);let w;g?w=((0,Ee.$W)(s[0],d)+(0,Ee.$W)(a[0],d))/2-(0,Ee.$W)(v[0],d):w=(s[0]+a[0])/2-v[0];const E=(s[1]+a[1])/2-v[1];f=w*w+E*E>this.errorThresholdSquared_}if(f){if(Math.abs(e[0]-i[0])<=Math.abs(e[1]-i[1])){const _=[(t[0]+i[0])/2,(t[1]+i[1])/2],v=this.transformInv_(_),w=[(n[0]+e[0])/2,(n[1]+e[1])/2],E=this.transformInv_(w);this.addQuad_(e,t,_,w,s,o,v,E,h-1),this.addQuad_(w,_,i,n,E,v,a,l,h-1)}else{const _=[(e[0]+t[0])/2,(e[1]+t[1])/2],v=this.transformInv_(_),w=[(i[0]+n[0])/2,(i[1]+n[1])/2],E=this.transformInv_(w);this.addQuad_(e,_,w,n,s,v,E,l,h-1),this.addQuad_(_,t,i,w,v,o,a,E,h-1)}return}}if(g){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}m&11||this.addTriangle_(e,i,n,s,a,l),m&14||this.addTriangle_(e,i,t,s,a,o),m&&(m&13||this.addTriangle_(t,n,e,o,l,s),m&7||this.addTriangle_(t,n,i,o,l,a))}calculateSourceExtent(){const e=(0,C.lJ)();return this.triangles_.forEach(function(t,i,n){const s=t.source;(0,C.Wj)(e,s[0]),(0,C.Wj)(e,s[1]),(0,C.Wj)(e,s[2])}),e}getTriangles(){return this.triangles_}}const Kl=Hl;let Ls;const Fi=[];function qr(r,e,t,i,n){r.beginPath(),r.moveTo(0,0),r.lineTo(e,t),r.lineTo(i,n),r.closePath(),r.save(),r.clip(),r.fillRect(0,0,Math.max(e,i)+1,Math.max(t,n)),r.restore()}function Fs(r,e){return Math.abs(r[e*4]-210)>2||Math.abs(r[e*4+3]-.75*255)>2}function $l(){if(Ls===void 0){const r=(0,ke.E4)(6,6,Fi);r.globalCompositeOperation="lighter",r.fillStyle="rgba(210, 0, 0, 0.75)",qr(r,4,5,4,0),qr(r,4,5,0,5);const e=r.getImageData(0,0,3,3).data;Ls=Fs(e,0)||Fs(e,4)||Fs(e,8),(0,ke.jy)(r),Fi.push(r.canvas)}return Ls}function Qr(r,e,t,i){const n=(0,U.vs)(t,e,r);let s=(0,U._Q)(e,i,t);const o=e.getMetersPerUnit();o!==void 0&&(s*=o);const a=r.getMetersPerUnit();a!==void 0&&(s/=a);const l=r.getExtent();if(!l||(0,C.b8)(l,n)){const h=(0,U._Q)(r,s,n)/s;isFinite(h)&&h>0&&(s/=h)}return s}function Jl(r,e,t,i){const n=(0,C.qg)(t);let s=Qr(r,e,n,i);return(!isFinite(s)||s<=0)&&(0,C.H6)(t,function(o){return s=Qr(r,e,o,i),isFinite(s)&&s>0}),s}function ql(r,e,t,i,n,s,o,a,l,h,c,u){const d=(0,ke.E4)(Math.round(t*r),Math.round(t*e),Fi);if(u||(d.imageSmoothingEnabled=!1),l.length===0)return d.canvas;d.scale(t,t);function g(L){return Math.round(L*t)/t}d.globalCompositeOperation="lighter";const f=(0,C.lJ)();l.forEach(function(L,M,A){(0,C.l7)(f,L.extent)});const m=(0,C.dz)(f),_=(0,C.Cr)(f),v=(0,ke.E4)(Math.round(t*m/i),Math.round(t*_/i),Fi);u||(v.imageSmoothingEnabled=!1);const w=t/i;l.forEach(function(L,M,A){const O=L.extent[0]-f[0],z=-(L.extent[3]-f[3]),$=(0,C.dz)(L.extent),K=(0,C.Cr)(L.extent);L.image.width>0&&L.image.height>0&&v.drawImage(L.image,h,h,L.image.width-2*h,L.image.height-2*h,O*w,z*w,$*w,K*w)});const E=(0,C.rL)(o);return a.getTriangles().forEach(function(L,M,A){const O=L.source,z=L.target;let $=O[0][0],K=O[0][1],he=O[1][0],ce=O[1][1],ie=O[2][0],be=O[2][1];const ae=g((z[0][0]-E[0])/s),j=g(-(z[0][1]-E[1])/s),N=g((z[1][0]-E[0])/s),H=g(-(z[1][1]-E[1])/s),ye=g((z[2][0]-E[0])/s),Ce=g(-(z[2][1]-E[1])/s),We=$,G=K;$=0,K=0,he-=We,ce-=G,ie-=We,be-=G;const ht=[[he,ce,0,0,N-ae],[ie,be,0,0,ye-ae],[0,0,he,ce,H-j],[0,0,ie,be,Ce-j]],we=(0,Ee.SV)(ht);if(we){if(d.save(),d.beginPath(),$l()||!u){d.moveTo(N,H);const Le=4,oi=ae-N,Ot=j-H;for(let Ue=0;Ue<Le;Ue++)d.lineTo(N+g((Ue+1)*oi/Le),H+g(Ue*Ot/(Le-1))),Ue!=Le-1&&d.lineTo(N+g((Ue+1)*oi/Le),H+g((Ue+1)*Ot/(Le-1)));d.lineTo(ye,Ce)}else d.moveTo(N,H),d.lineTo(ae,j),d.lineTo(ye,Ce);d.clip(),d.transform(we[0],we[2],we[1],we[3],ae,j),d.translate(f[0]-We,f[3]-G),d.scale(i/t,-i/t),d.drawImage(v.canvas,0,0),d.restore()}}),(0,ke.jy)(v),Fi.push(v.canvas),c&&(d.save(),d.globalCompositeOperation="source-over",d.strokeStyle="black",d.lineWidth=1,a.getTriangles().forEach(function(L,M,A){const O=L.target,z=(O[0][0]-E[0])/s,$=-(O[0][1]-E[1])/s,K=(O[1][0]-E[0])/s,he=-(O[1][1]-E[1])/s,ce=(O[2][0]-E[0])/s,ie=-(O[2][1]-E[1])/s;d.beginPath(),d.moveTo(K,he),d.lineTo(z,$),d.lineTo(ce,ie),d.closePath(),d.stroke()}),d.restore()),d.canvas}class Ql extends Kr{constructor(e,t,i,n,s,o,a,l,h,c,u,d){super(s,oe.Z.IDLE,{interpolate:!!d}),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=n,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const g=n.getTileCoordExtent(this.wrappedTileCoord_),f=this.targetTileGrid_.getExtent();let m=this.sourceTileGrid_.getExtent();const _=f?(0,C.Ed)(g,f):g;if((0,C.bg)(_)===0){this.state=oe.Z.EMPTY;return}const v=e.getExtent();v&&(m?m=(0,C.Ed)(m,v):m=v);const w=n.getResolution(this.wrappedTileCoord_[0]),E=Jl(e,i,_,w);if(!isFinite(E)||E<=0){this.state=oe.Z.EMPTY;return}const L=c!==void 0?c:Yl;if(this.triangulation_=new Kl(e,i,_,m,E*L,w),this.triangulation_.getTriangles().length===0){this.state=oe.Z.EMPTY;return}this.sourceZ_=t.getZForResolution(E);let M=this.triangulation_.calculateSourceExtent();if(m&&(e.canWrapX()?(M[1]=(0,Ee.uZ)(M[1],m[1],m[3]),M[3]=(0,Ee.uZ)(M[3],m[1],m[3])):M=(0,C.Ed)(M,m)),!(0,C.bg)(M))this.state=oe.Z.EMPTY;else{const A=t.getTileRangeForExtentAndZ(M,this.sourceZ_);for(let O=A.minX;O<=A.maxX;O++)for(let z=A.minY;z<=A.maxY;z++){const $=h(this.sourceZ_,O,z,a);$&&this.sourceTiles_.push($)}this.sourceTiles_.length===0&&(this.state=oe.Z.EMPTY)}}getImage(){return this.canvas_}reproject_(){const e=[];if(this.sourceTiles_.forEach(t=>{t&&t.getState()==oe.Z.LOADED&&e.push({extent:this.sourceTileGrid_.getTileCoordExtent(t.tileCoord),image:t.getImage()})}),this.sourceTiles_.length=0,e.length===0)this.state=oe.Z.ERROR;else{const t=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(t),n=typeof i=="number"?i:i[0],s=typeof i=="number"?i:i[1],o=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=ql(n,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=oe.Z.LOADED}this.changed()}load(){if(this.state==oe.Z.IDLE){this.state=oe.Z.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(t=>{const i=t.getState();if(i==oe.Z.IDLE||i==oe.Z.LOADING){e++;const n=(0,Je.oL)(t,ot.Z.CHANGE,function(s){const o=t.getState();(o==oe.Z.LOADED||o==oe.Z.ERROR||o==oe.Z.EMPTY)&&((0,Je.bN)(n),e--,e===0&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(n)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(t,i,n){t.getState()==oe.Z.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(Je.bN),this.sourcesListenerKeys_=null}release(){this.canvas_&&((0,ke.jy)(this.canvas_.getContext("2d")),Fi.push(this.canvas_),this.canvas_=null),super.release()}}const Ms=Ql;class eo{constructor(e,t,i,n){this.minX=e,this.maxX=t,this.minY=i,this.maxY=n}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}}function Mi(r,e,t,i,n){return n!==void 0?(n.minX=r,n.maxX=e,n.minY=t,n.maxY=i,n):new eo(r,e,t,i)}const to=eo;class eh extends Er{constructor(e){super(e),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=(0,C.lJ)(),this.tmpTileRange_=new to(0,0,0,0)}isDrawableTile(e){const t=this.getLayer(),i=e.getState(),n=t.getUseInterimTilesOnError();return i==oe.Z.LOADED||i==oe.Z.EMPTY||i==oe.Z.ERROR&&!n}getTile(e,t,i,n){const s=n.pixelRatio,o=n.viewState.projection,a=this.getLayer();let h=a.getSource().getTile(e,t,i,s,o);return h.getState()==oe.Z.ERROR&&a.getUseInterimTilesOnError()&&a.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(h)||(h=h.getInterimTile()),h}getData(e){const t=this.frameState;if(!t)return null;const i=this.getLayer(),n=(0,q.nn)(t.pixelToCoordinateTransform,e.slice()),s=i.getExtent();if(s&&!(0,C.b8)(s,n))return null;const o=t.pixelRatio,a=t.viewState.projection,l=t.viewState,h=i.getRenderSource(),c=h.getTileGridForProjection(l.projection),u=h.getTilePixelRatio(t.pixelRatio);for(let d=c.getZForResolution(l.resolution);d>=c.getMinZoom();--d){const g=c.getTileCoordForCoordAndZ(n,d),f=h.getTile(d,g[1],g[2],o,a);if(!(f instanceof $r||f instanceof Ms)||f instanceof Ms&&f.getState()===oe.Z.EMPTY)return null;if(f.getState()!==oe.Z.LOADED)continue;const m=c.getOrigin(d),_=(0,it.Pq)(c.getTileSize(d)),v=c.getResolution(d),w=Math.floor(u*((n[0]-m[0])/v-g[1]*_[0])),E=Math.floor(u*((m[1]-n[1])/v-g[2]*_[1])),L=Math.round(u*h.getGutterForProjection(l.projection));return this.getImageData(f.getImage(),w+L,E+L)}return null}loadedTileCallback(e,t,i){return this.isDrawableTile(i)?super.loadedTileCallback(e,t,i):!1}prepareFrame(e){return!!this.getLayer().getSource()}renderFrame(e,t){const i=e.layerStatesArray[e.layerIndex],n=e.viewState,s=n.projection,o=n.resolution,a=n.center,l=n.rotation,h=e.pixelRatio,c=this.getLayer(),u=c.getSource(),d=u.getRevision(),g=u.getTileGridForProjection(s),f=g.getZForResolution(o,u.zDirection),m=g.getResolution(f);let _=e.extent;const v=e.viewState.resolution,w=u.getTilePixelRatio(h),E=Math.round((0,C.dz)(_)/v*h),L=Math.round((0,C.Cr)(_)/v*h),M=i.extent&&(0,U.dY)(i.extent,s);M&&(_=(0,C.Ed)(_,(0,U.dY)(i.extent,s)));const A=m*E/2/w,O=m*L/2/w,z=[a[0]-A,a[1]-O,a[0]+A,a[1]+O],$=g.getTileRangeForExtentAndZ(_,f),K={};K[f]={};const he=this.createLoadedTileFinder(u,s,K),ce=this.tmpExtent,ie=this.tmpTileRange_;this.newTiles_=!1;const be=l?(0,C.dY)(n.center,v,l,e.size):void 0;for(let ht=$.minX;ht<=$.maxX;++ht)for(let we=$.minY;we<=$.maxY;++we){if(l&&!g.tileCoordIntersectsViewport([f,ht,we],be))continue;const Le=this.getTile(f,ht,we,e);if(this.isDrawableTile(Le)){const Ue=(0,J.sq)(this);if(Le.getState()==oe.Z.LOADED){K[f][Le.tileCoord.toString()]=Le;let Xt=Le.inTransition(Ue);Xt&&i.opacity!==1&&(Le.endTransition(Ue),Xt=!1),!this.newTiles_&&(Xt||!this.renderedTiles.includes(Le))&&(this.newTiles_=!0)}if(Le.getAlpha(Ue,e.time)===1)continue}const oi=g.getTileCoordChildTileRange(Le.tileCoord,ie,ce);let Ot=!1;oi&&(Ot=he(f+1,oi)),Ot||g.forEachTileCoordParentTileRange(Le.tileCoord,he,ie,ce)}const ae=m/o*h/w;(0,q.qC)(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/h,1/h,l,-E/2,-L/2);const j=(0,q.BB)(this.pixelTransform);this.useContainer(t,j,this.getBackground(e));const N=this.context,H=N.canvas;(0,q.nb)(this.inversePixelTransform,this.pixelTransform),(0,q.qC)(this.tempTransform,E/2,L/2,ae,ae,0,-E/2,-L/2),H.width!=E||H.height!=L?(H.width=E,H.height=L):this.containerReused||N.clearRect(0,0,E,L),M&&this.clipUnrotated(N,e,M),u.getInterpolate()||(N.imageSmoothingEnabled=!1),this.preRender(N,e),this.renderedTiles.length=0;let ye=Object.keys(K).map(Number);ye.sort(qe.j2);let Ce,We,G;i.opacity===1&&(!this.containerReused||u.getOpaque(e.viewState.projection))?ye=ye.reverse():(Ce=[],We=[]);for(let ht=ye.length-1;ht>=0;--ht){const we=ye[ht],Le=u.getTilePixelSize(we,h,s),Ot=g.getResolution(we)/m,Ue=Le[0]*Ot*ae,Xt=Le[1]*Ot*ae,Bi=g.getTileCoordForCoordAndZ((0,C.rL)(z),we),jn=g.getTileCoordExtent(Bi),Gi=(0,q.nn)(this.tempTransform,[w*(jn[0]-z[0])/m,w*(z[3]-jn[3])/m]),Hn=w*u.getGutterForProjection(s),ai=K[we];for(const ln in ai){const li=ai[ln],Kn=li.tileCoord,$n=Bi[1]-Kn[1],Jn=Math.round(Gi[0]-($n-1)*Ue),zi=Bi[2]-Kn[2],Qs=Math.round(Gi[1]-(zi-1)*Xt),nt=Math.round(Gi[0]-$n*Ue),vt=Math.round(Gi[1]-zi*Xt),Rt=Jn-nt,Vt=Qs-vt,Wi=f===we,_i=Wi&&li.getAlpha((0,J.sq)(this),e.time)!==1;let hi=!1;if(!_i)if(Ce){G=[nt,vt,nt+Rt,vt,nt+Rt,vt+Vt,nt,vt+Vt];for(let Ni=0,qn=Ce.length;Ni<qn;++Ni)if(f!==we&&we<We[Ni]){const Qe=Ce[Ni];(0,C.kK)([nt,vt,nt+Rt,vt+Vt],[Qe[0],Qe[3],Qe[4],Qe[7]])&&(hi||(N.save(),hi=!0),N.beginPath(),N.moveTo(G[0],G[1]),N.lineTo(G[2],G[3]),N.lineTo(G[4],G[5]),N.lineTo(G[6],G[7]),N.moveTo(Qe[6],Qe[7]),N.lineTo(Qe[4],Qe[5]),N.lineTo(Qe[2],Qe[3]),N.lineTo(Qe[0],Qe[1]),N.clip())}Ce.push(G),We.push(we)}else N.clearRect(nt,vt,Rt,Vt);this.drawTileImage(li,e,nt,vt,Rt,Vt,Hn,Wi),Ce&&!_i?(hi&&N.restore(),this.renderedTiles.unshift(li)):this.renderedTiles.push(li),this.updateUsedTiles(e.usedTiles,u,li)}}return this.renderedRevision=d,this.renderedResolution=m,this.extentChanged=!this.renderedExtent_||!(0,C.fS)(this.renderedExtent_,z),this.renderedExtent_=z,this.renderedPixelRatio=h,this.renderedProjection=s,this.manageTilePyramid(e,u,g,h,s,_,f,c.getPreload()),this.scheduleExpireCache(e,u),this.postRender(N,e),i.extent&&N.restore(),N.imageSmoothingEnabled=!0,j!==H.style.transform&&(H.style.transform=j),this.container}drawTileImage(e,t,i,n,s,o,a,l){const h=this.getTileImage(e);if(!h)return;const c=(0,J.sq)(this),u=t.layerStatesArray[t.layerIndex],d=u.opacity*(l?e.getAlpha(c,t.time):1),g=d!==this.context.globalAlpha;g&&(this.context.save(),this.context.globalAlpha=d),this.context.drawImage(h,a,a,h.width-2*a,h.height-2*a,i,n,s,o),g&&this.context.restore(),d!==u.opacity?t.animate=!0:l&&e.endTransition(c)}getImage(){const e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}scheduleExpireCache(e,t){if(t.canExpireCache()){const i=function(n,s,o){const a=(0,J.sq)(n);a in o.usedTiles&&n.expireCache(o.viewState.projection,o.usedTiles[a])}.bind(null,t);e.postRenderFunctions.push(i)}}updateUsedTiles(e,t,i){const n=(0,J.sq)(t);n in e||(e[n]={}),e[n][i.getKey()]=!0}manageTilePyramid(e,t,i,n,s,o,a,l,h){const c=(0,J.sq)(t);c in e.wantedTiles||(e.wantedTiles[c]={});const u=e.wantedTiles[c],d=e.tileQueue,g=i.getMinZoom(),f=e.viewState.rotation,m=f?(0,C.dY)(e.viewState.center,e.viewState.resolution,f,e.size):void 0;let _=0,v,w,E,L,M,A;for(A=g;A<=a;++A)for(w=i.getTileRangeForExtentAndZ(o,A,w),E=i.getResolution(A),L=w.minX;L<=w.maxX;++L)for(M=w.minY;M<=w.maxY;++M)f&&!i.tileCoordIntersectsViewport([A,L,M],m)||(a-A<=l?(++_,v=t.getTile(A,L,M,n,s),v.getState()==oe.Z.IDLE&&(u[v.getKey()]=!0,d.isKeyQueued(v.getKey())||d.enqueue([v,c,i.getTileCoordCenter(v.tileCoord),E])),h!==void 0&&h(v)):t.useTile(A,L,M,s));t.updateCacheSize(_,s)}}const th=eh;class ih extends Nl{constructor(e){super(e)}createRenderer(){return new th(this)}}const Ps=ih;class nh{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){const i=this.entries_[e];return(0,ue.h)(i!==void 0,15),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(e){const t=this.entries_[e];return(0,ue.h)(t!==void 0,15),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){const e=new Array(this.count_);let t=0,i;for(i=this.newest_;i;i=i.older)e[t++]=i.key_;return e}getValues(){const e=new Array(this.count_);let t=0,i;for(i=this.newest_;i;i=i.older)e[t++]=i.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){if(this.containsKey(e))return this.entries_[e].value_}pop(){const e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){(0,ue.h)(!(e in this.entries_),16);const i={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[e]=i,++this.count_}setSize(e){this.highWaterMark=e}}const sh=nh;function io(r,e,t,i){return i!==void 0?(i[0]=r,i[1]=e,i[2]=t,i):[r,e,t]}function en(r,e,t){return r+"/"+e+"/"+t}function no(r){return en(r[0],r[1],r[2])}function Eu(r){const[e,t,i]=r.substring(r.lastIndexOf("/")+1,r.length).split(",").map(Number);return en(e,t,i)}function rh(r){return r.split("/").map(Number)}function oh(r){return(r[1]<<r[0])+r[2]}function ah(r,e){const t=r[0],i=r[1],n=r[2];if(e.getMinZoom()>t||t>e.getMaxZoom())return!1;const s=e.getFullTileRange(t);return s?s.containsXY(i,n):!0}class lh extends sh{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(e){for(;this.canExpireCache()&&!(this.peekLast().getKey()in e);)this.pop().release()}pruneExceptNewestZ(){if(this.getCount()===0)return;const e=this.peekFirstKey(),i=rh(e)[0];this.forEach(n=>{n.tileCoord[0]!==i&&(this.remove(no(n.tileCoord)),n.release())})}}const so=lh,Ds={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var As=S(25691),hh=S(5104);const Pi=[0,0,0],ni=5;class ch{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,(0,ue.h)((0,qe.pT)(this.resolutions_,function(n,s){return s-n},!0),17);let t;if(!e.origins){for(let n=0,s=this.resolutions_.length-1;n<s;++n)if(!t)t=this.resolutions_[n]/this.resolutions_[n+1];else if(this.resolutions_[n]/this.resolutions_[n+1]!==t){t=void 0;break}}this.zoomFactor_=t,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,(0,ue.h)(this.origins_.length==this.resolutions_.length,20));const i=e.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=(0,C.rL)(i)),(0,ue.h)(!this.origin_&&this.origins_||this.origin_&&!this.origins_,18),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,(0,ue.h)(this.tileSizes_.length==this.resolutions_.length,19)),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:As.S,(0,ue.h)(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,22),this.extent_=i!==void 0?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.sizes!==void 0?this.fullTileRanges_=e.sizes.map(function(n,s){const o=new to(Math.min(0,n[0]),Math.max(n[0]-1,-1),Math.min(0,n[1]),Math.max(n[1]-1,-1));if(i){const a=this.getTileRangeForExtentAndZ(i,s);o.minX=Math.max(a.minX,o.minX),o.maxX=Math.min(a.maxX,o.maxX),o.minY=Math.max(a.minY,o.minY),o.maxY=Math.min(a.maxY,o.maxY)}return o},this):i&&this.calculateTileRanges_(i)}forEachTileCoord(e,t,i){const n=this.getTileRangeForExtentAndZ(e,t);for(let s=n.minX,o=n.maxX;s<=o;++s)for(let a=n.minY,l=n.maxY;a<=l;++a)i([t,s,a])}forEachTileCoordParentTileRange(e,t,i,n){let s,o,a,l=null,h=e[0]-1;for(this.zoomFactor_===2?(o=e[1],a=e[2]):l=this.getTileCoordExtent(e,n);h>=this.minZoom;){if(this.zoomFactor_===2?(o=Math.floor(o/2),a=Math.floor(a/2),s=Mi(o,o,a,a,i)):s=this.getTileRangeForExtentAndZ(l,h,i),t(h,s))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,i){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){const s=e[1]*2,o=e[2]*2;return Mi(s,s+1,o,o+1,t)}const n=this.getTileCoordExtent(e,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,i){if(t>this.maxZoom||t<this.minZoom)return null;const n=e[0],s=e[1],o=e[2];if(t===n)return Mi(s,o,s,o,i);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,t-n),h=Math.floor(s*l),c=Math.floor(o*l);if(t<n)return Mi(h,h,c,c,i);const u=Math.floor(l*(s+1))-1,d=Math.floor(l*(o+1))-1;return Mi(h,u,c,d,i)}const a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,i)}getTileRangeExtent(e,t,i){const n=this.getOrigin(e),s=this.getResolution(e),o=(0,it.Pq)(this.getTileSize(e),this.tmpSize_),a=n[0]+t.minX*o[0]*s,l=n[0]+(t.maxX+1)*o[0]*s,h=n[1]+t.minY*o[1]*s,c=n[1]+(t.maxY+1)*o[1]*s;return(0,C.T9)(a,h,l,c,i)}getTileRangeForExtentAndZ(e,t,i){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,Pi);const n=Pi[1],s=Pi[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,Pi);const o=Pi[1],a=Pi[2];return Mi(n,o,s,a,i)}getTileCoordCenter(e){const t=this.getOrigin(e[0]),i=this.getResolution(e[0]),n=(0,it.Pq)(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*n[0]*i,t[1]-(e[2]+.5)*n[1]*i]}getTileCoordExtent(e,t){const i=this.getOrigin(e[0]),n=this.getResolution(e[0]),s=(0,it.Pq)(this.getTileSize(e[0]),this.tmpSize_),o=i[0]+e[1]*s[0]*n,a=i[1]-(e[2]+1)*s[1]*n,l=o+s[0]*n,h=a+s[1]*n;return(0,C.T9)(o,a,l,h,t)}getTileCoordForCoordAndResolution(e,t,i){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,i)}getTileCoordForXYAndResolution_(e,t,i,n,s){const o=this.getZForResolution(i),a=i/this.getResolution(o),l=this.getOrigin(o),h=(0,it.Pq)(this.getTileSize(o),this.tmpSize_);let c=a*(e-l[0])/i/h[0],u=a*(l[1]-t)/i/h[1];return n?(c=(0,Ee.mD)(c,ni)-1,u=(0,Ee.mD)(u,ni)-1):(c=(0,Ee.GW)(c,ni),u=(0,Ee.GW)(u,ni)),io(o,c,u,s)}getTileCoordForXYAndZ_(e,t,i,n,s){const o=this.getOrigin(i),a=this.getResolution(i),l=(0,it.Pq)(this.getTileSize(i),this.tmpSize_);let h=(e-o[0])/a/l[0],c=(o[1]-t)/a/l[1];return n?(h=(0,Ee.mD)(h,ni)-1,c=(0,Ee.mD)(c,ni)-1):(h=(0,Ee.GW)(h,ni),c=(0,Ee.GW)(c,ni)),io(i,h,c,s)}getTileCoordForCoordAndZ(e,t,i){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,i)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){const i=(0,qe.h7)(this.resolutions_,e,t||0);return(0,Ee.uZ)(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return(0,hh.mV)(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){const t=this.resolutions_.length,i=new Array(t);for(let n=this.minZoom;n<t;++n)i[n]=this.getTileRangeForExtentAndZ(e,n);this.fullTileRanges_=i}}const ro=ch;function oo(r){let e=r.getDefaultTileGrid();return e||(e=gh(r),r.setDefaultTileGrid(e)),e}function uh(r,e,t){const i=e[0],n=r.getTileCoordCenter(e),s=Os(t);if(!(0,C.b8)(s,n)){const o=(0,C.dz)(s),a=Math.ceil((s[0]-n[0])/o);return n[0]+=o*a,r.getTileCoordForCoordAndZ(n,i)}return e}function dh(r,e,t,i){i=i!==void 0?i:"top-left";const n=ao(r,e,t);return new ro({extent:r,origin:(0,C.g0)(r,i),resolutions:n,tileSize:t})}function fh(r){const e=r||{},t=e.extent||(0,U.U2)("EPSG:3857").getExtent(),i={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:ao(t,e.maxZoom,e.tileSize,e.maxResolution)};return new ro(i)}function ao(r,e,t,i){e=e!==void 0?e:As.e,t=(0,it.Pq)(t!==void 0?t:As.S);const n=(0,C.Cr)(r),s=(0,C.dz)(r);i=i>0?i:Math.max(s/t[0],n/t[1]);const o=e+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=i/Math.pow(2,l);return a}function gh(r,e,t,i){const n=Os(r);return dh(n,e,t,i)}function Os(r){r=(0,U.U2)(r);let e=r.getExtent();if(!e){const t=180*U.Wm.degrees/r.getMetersPerUnit();e=(0,C.T9)(-t,-t,t,t)}return e}class mh extends Lr{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.opaque_=e.opaque!==void 0?e.opaque:!1,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;const t=[256,256];this.tileGrid&&(0,it.Pq)(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tileCache=new so(e.cacheSize||0),this.tmpSize=[0,0],this.key_=e.key||"",this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}canExpireCache(){return this.tileCache.canExpireCache()}expireCache(e,t){const i=this.getTileCacheForProjection(e);i&&i.expireCache(t)}forEachLoadedTile(e,t,i,n){const s=this.getTileCacheForProjection(e);if(!s)return!1;let o=!0,a,l,h;for(let c=i.minX;c<=i.maxX;++c)for(let u=i.minY;u<=i.maxY;++u)l=en(t,c,u),h=!1,s.containsKey(l)&&(a=s.get(l),h=a.getState()===oe.Z.LOADED,h&&(h=n(a)!==!1)),h||(o=!1);return o}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getOpaque(e){return this.opaque_}getResolutions(e){const t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,i,n,s){return(0,J.O3)()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:oo(e)}getTileCacheForProjection(e){const t=this.getProjection();return(0,ue.h)(t===null||(0,U.OP)(t,e),68),this.tileCache}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,i){const n=this.getTileGridForProjection(i),s=this.getTilePixelRatio(t),o=(0,it.Pq)(n.getTileSize(e),this.tmpSize);return s==1?o:(0,it.bA)(o,s,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){t=t!==void 0?t:this.getProjection();const i=this.getTileGridForProjection(t);return this.getWrapX()&&t.isGlobal()&&(e=uh(i,e,t)),ah(e,i)?e:null}clear(){this.tileCache.clear()}refresh(){this.clear(),super.refresh()}updateCacheSize(e,t){const i=this.getTileCacheForProjection(t);e>i.highWaterMark&&(i.highWaterMark=e)}useTile(e,t,i,n){}}class _h extends pn.ZP{constructor(e,t){super(e),this.tile=t}}const ph=mh;function xh(r,e){const t=/\{z\}/g,i=/\{x\}/g,n=/\{y\}/g,s=/\{-y\}/g;return function(o,a,l){if(o)return r.replace(t,o[0].toString()).replace(i,o[1].toString()).replace(n,o[2].toString()).replace(s,function(){const h=o[0],c=e.getFullTileRange(h);return(0,ue.h)(c,55),(c.getHeight()-o[2]-1).toString()})}}function yh(r,e){const t=r.length,i=new Array(t);for(let n=0;n<t;++n)i[n]=xh(r[n],e);return vh(i)}function vh(r){return r.length===1?r[0]:function(e,t,i){if(!e)return;const n=oh(e),s=(0,Ee.$W)(n,r.length);return r[s](e,t,i)}}function wu(r,e,t){}function Eh(r){const e=[];let t=/\{([a-z])-([a-z])\}/.exec(r);if(t){const i=t[1].charCodeAt(0),n=t[2].charCodeAt(0);let s;for(s=i;s<=n;++s)e.push(r.replace(t[0],String.fromCharCode(s)));return e}if(t=/\{(\d+)-(\d+)\}/.exec(r),t){const i=parseInt(t[2],10);for(let n=parseInt(t[1],10);n<=i;n++)e.push(r.replace(t[0],n.toString()));return e}return e.push(r),e}class ks extends ph{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===ks.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){const t=e.target,i=(0,J.sq)(t),n=t.getState();let s;n==oe.Z.LOADING?(this.tileLoadingKeys_[i]=!0,s=Ds.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],s=n==oe.Z.ERROR?Ds.TILELOADERROR:n==oe.Z.LOADED?Ds.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new _h(s,t))}setTileLoadFunction(e){this.tileCache.clear(),this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,this.tileCache.pruneExceptNewestZ(),typeof t<"u"?this.setKey(t):this.changed()}setUrl(e){const t=Eh(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;const t=e.join(`
`);this.generateTileUrlFunction_?this.setTileUrlFunction(yh(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,i){}useTile(e,t,i){const n=en(e,t,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}}const wh=ks;class Ch extends wh{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:Sh,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate!==void 0?e.interpolate:!0,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin!==void 0?e.crossOrigin:null,this.tileClass=e.tileClass!==void 0?e.tileClass:$r,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}canExpireCache(){if(this.tileCache.canExpireCache())return!0;for(const e in this.tileCacheForProjection)if(this.tileCacheForProjection[e].canExpireCache())return!0;return!1}expireCache(e,t){const i=this.getTileCacheForProjection(e);this.tileCache.expireCache(this.tileCache==i?t:{});for(const n in this.tileCacheForProjection){const s=this.tileCacheForProjection[n];s.expireCache(s==i?t:{})}}getGutterForProjection(e){return this.getProjection()&&e&&!(0,U.OP)(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getOpaque(e){return this.getProjection()&&e&&!(0,U.OP)(this.getProjection(),e)?!1:super.getOpaque(e)}getTileGridForProjection(e){const t=this.getProjection();if(this.tileGrid&&(!t||(0,U.OP)(t,e)))return this.tileGrid;const i=(0,J.sq)(e);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=oo(e)),this.tileGridForProjection[i]}getTileCacheForProjection(e){const t=this.getProjection();if(!t||(0,U.OP)(t,e))return this.tileCache;const i=(0,J.sq)(e);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new so(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]}createTile_(e,t,i,n,s,o){const a=[e,t,i],l=this.getTileCoordForTileUrlFunction(a,s),h=l?this.tileUrlFunction(l,n,s):void 0,c=new this.tileClass(a,h!==void 0?oe.Z.IDLE:oe.Z.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(ot.Z.CHANGE,this.handleTileChange.bind(this)),c}getTile(e,t,i,n,s){const o=this.getProjection();if(!o||!s||(0,U.OP)(o,s))return this.getTileInternal(e,t,i,n,o||s);const a=this.getTileCacheForProjection(s),l=[e,t,i];let h;const c=no(l);a.containsKey(c)&&(h=a.get(c));const u=this.getKey();if(h&&h.key==u)return h;const d=this.getTileGridForProjection(o),g=this.getTileGridForProjection(s),f=this.getTileCoordForTileUrlFunction(l,s),m=new Ms(o,d,s,g,l,f,this.getTilePixelRatio(n),this.getGutter(),(_,v,w,E)=>this.getTileInternal(_,v,w,E,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.getInterpolate());return m.key=u,h?(m.interimTile=h,m.refreshInterimChain(),a.replace(c,m)):a.set(c,m),m}getTileInternal(e,t,i,n,s){let o=null;const a=en(e,t,i),l=this.getKey();if(!this.tileCache.containsKey(a))o=this.createTile_(e,t,i,n,s,l),this.tileCache.set(a,o);else if(o=this.tileCache.get(a),o.key!=l){const h=o;o=this.createTile_(e,t,i,n,s,l),h.getState()==oe.Z.IDLE?o.interimTile=h.interimTile:o.interimTile=h,o.refreshInterimChain(),this.tileCache.replace(a,o)}return o}setRenderReprojectionEdges(e){if(this.renderReprojectionEdges_!=e){this.renderReprojectionEdges_=e;for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear();this.changed()}}setTileGridForProjection(e,t){const i=(0,U.U2)(e);if(i){const n=(0,J.sq)(i);n in this.tileGridForProjection||(this.tileGridForProjection[n]=t)}}clear(){super.clear();for(const e in this.tileCacheForProjection)this.tileCacheForProjection[e].clear()}}function Sh(r,e){r.getImage().src=e}const Th=Ch;class Ih extends Th{constructor(e){e=e||{};const t=e.projection!==void 0?e.projection:"EPSG:3857",i=e.tileGrid!==void 0?e.tileGrid:fh({extent:Os(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,opaque:e.opaque,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}}const Bs=Ih;var Rh=(r=>(r.Auto="auto",r.Light="light",r.Dark="dark",r))(Rh||{});const On={theme:"auto",showLabels:!0},lo={id:"carto",name:"CARTO basemap",description:"Add layer CARTO Raster basemaps",isBaseMap:!0,defaultOptions:On,create:async(r,e,t,i)=>({init:()=>{const n={...On,...e.config};let s=n.theme;return(!s||s==="auto")&&(s=i.isDark?"dark":"light"),n.showLabels?s+="_all":s+="_nolabels",new Ps({source:new Bs({attributions:'<a href="https://carto.com/attribution/">\xA9 CARTO</a>',url:`https://{1-4}.basemaps.cartocdn.com/${s}/{z}/{x}/{y}.png`})})},registerOptionsUI:n=>{n.addRadio({path:"config.theme",name:"Theme",settings:{options:[{value:"auto",label:"Auto",description:"Match grafana theme"},{value:"light",label:"Light"},{value:"dark",label:"Dark"}]},defaultValue:On.theme}).addBooleanSwitch({path:"config.showLabels",name:"Show labels",description:"",defaultValue:On.showLabels})}})},bh=[lo],ho="https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer",Di={url:ho+"/tile/{z}/{y}/{x}",attribution:`Tiles \xA9 <a href="${ho}">ArcGIS</a>`},co={id:"xyz",name:"XYZ Tile layer",description:"Add map from a generic tile layer",isBaseMap:!0,create:async(r,e,t,i)=>({init:()=>{const n={...e.config};return n.url||(n.url=Di.url,n.attribution=n.attribution??Di.attribution),new Ps({source:new Bs({url:n.url,attributions:n.attribution}),minZoom:n.minZoom,maxZoom:n.maxZoom})},registerOptionsUI:n=>{n.addTextInput({path:"config.url",name:"URL template",description:"Must include {x}, {y} or {-y}, and {z} placeholders",settings:{placeholder:Di.url}}).addTextInput({path:"config.attribution",name:"Attribution",settings:{placeholder:Di.attribution}})}})},Lh=[co],kn="custom",Gs="streets",uo=new Fn.B(()=>[{id:Gs,name:"World Street Map",slug:"World_Street_Map"},{id:"world-imagery",name:"World Imagery",slug:"World_Imagery"},{id:"world-physical",name:"World Physical",slug:"World_Physical_Map"},{id:"topo",name:"Topographic",slug:"World_Topo_Map"},{id:"usa-topo",name:"USA Topographic",slug:"USA_Topo_Maps"},{id:"ocean",name:"World Ocean",slug:"Ocean/World_Ocean_Base"},{id:kn,name:"Custom MapServer",description:"Use a custom MapServer with pre-cached values",slug:""}]),Fh=[{id:"esri-xyz",name:"ArcGIS MapServer",description:"Add layer from an ESRI ArcGIS MapServer",isBaseMap:!0,create:async(r,e,t,i)=>{const n={...e.config},s=uo.getIfExists(n.server??Gs);if(s.id!==kn){const a="https://services.arcgisonline.com/ArcGIS/rest/services/";n.url=`${a}${s.slug}/MapServer/tile/{z}/{y}/{x}`,n.attribution=`Tiles \xA9 <a href="${a}${s.slug}/MapServer">ArcGIS</a>`}const o={...e,config:n};return co.create(r,o,t,i).then(a=>(a.registerOptionsUI=l=>{l.addSelect({path:"config.server",name:"Server instance",settings:{options:uo.selectOptions().options}}).addTextInput({path:"config.url",name:"URL template",description:"Must include {x}, {y} or {-y}, and {z} placeholders",settings:{placeholder:Di.url},showIf:h=>h.config?.server===kn}).addTextInput({path:"config.attribution",name:"Attribution",settings:{placeholder:Di.attribution},showIf:h=>h.config?.server===kn})},a))},defaultOptions:{server:Gs}}],Mh='&#169; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class Ph extends Bs{constructor(e){e=e||{};let t;e.attributions!==void 0?t=e.attributions:t=[Mh];const i=e.crossOrigin!==void 0?e.crossOrigin:"anonymous",n=e.url!==void 0?e.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:t,attributionsCollapsible:!1,cacheSize:e.cacheSize,crossOrigin:i,interpolate:e.interpolate,maxZoom:e.maxZoom!==void 0?e.maxZoom:19,opaque:e.opaque!==void 0?e.opaque:!0,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:e.tileLoadFunction,transition:e.transition,url:n,wrapX:e.wrapX,zDirection:e.zDirection})}}const Dh=Ph,zs=[...[{id:"osm-standard",name:"Open Street Map",description:"Add map from a collaborative free geographic world database",isBaseMap:!0,create:async(r,e,t)=>({init:()=>new Ps({source:new Dh})})}],...bh,...Fh,...Lh];var fo=S(69396),Ah=S(22495);const go=(r,e)=>{const t=e.get(r.property);return(0,Ah.f)(t,r.operation,r.value)};var mo=S(92830),tn=S(45458);function _o(r){const e=new Set,t=new Set;r.some((n,s)=>{for(const o of Object.keys(n.getProperties())){if(o==="geometry")continue;t.add(o);const a=n.getGeometry();a&&e.add(a.getType())}return s>10});let i=V.bD.Any;if(e.size===1)switch(e.values().next().value){case"Point":case"MultiPoint":i=V.bD.Point;break;case"Line":case"MultiLine":i=V.bD.Line;break;case"Polygon":i=V.bD.Polygon}return{geometryType:i,propertes:Array.from(t.keys()).map(n=>({label:n,value:n}))}}function Oh(r,e){const t=new Set;for(const n of r){const s=n.get(e);s!=null&&t.add(`${s}`)}const i=Array.from(t);return i.sort(),i}function po(r,e){if(r&&!e){const i={label:`${r}`,value:r};return{options:[i],current:i}}e||(e=[]);let t=e.find(i=>i.value===r);return r&&!t&&(t={label:`${r} (not found)`,value:r},e.push(t)),{options:e,current:t}}const kh=({value:r,onChange:e,item:t,context:i})=>{const n=t.settings,{features:s,layerInfo:o}=n,a=(0,bn.Z)(o),l=(0,bn.Z)(s),h=(0,p.useMemo)(()=>{const M=r?.check?.property;return M&&l&&r.check?.operation===Ze.Bd.EQ?Oh(l,M).map(A=>{let O;return!isNaN(Number(A))?O={value:Number(A),label:A}:O={value:A,label:A},O}):[]},[l,r]),c=(0,_e.wW)(Bh),u=10,d=(0,p.useCallback)(M=>{e({...r,check:{...r.check,property:M?.value}})},[e,r]),g=(0,p.useCallback)(M=>{e({...r,check:{...r.check,operation:M.value??Ze.Bd.EQ}})},[e,r]),f=(0,p.useCallback)(M=>{e({...r,check:{...r.check,value:M?.value}})},[e,r]),m=(0,p.useCallback)(M=>{e({...r,check:{...r.check,value:M}})},[e,r]),_=(0,p.useCallback)(M=>{e({...r,style:M})},[e,r]),v=(0,p.useCallback)(()=>{e(void 0)},[e]),w=r.check??vo.check,E=po(w.property,a?.propertes),L=po(w.value,h);return p.createElement("div",{className:c.rule},p.createElement(St.Z,{className:c.row},p.createElement(at._,{label:"Rule",labelWidth:u,grow:!0},p.createElement(pi.Ph,{placeholder:"Feature property",value:E.current,options:E.options,onChange:d,"aria-label":"Feature property",isClearable:!0,allowCustomValue:!0})),p.createElement(at._,{className:c.inline},p.createElement(pi.Ph,{value:mo.J8.find(M=>M.value===w.operation),options:mo.J8,onChange:g,"aria-label":"Comparison operator",width:8})),p.createElement(at._,{className:c.inline,grow:!0},p.createElement("div",{className:c.flexRow},(w.operation===Ze.Bd.EQ||w.operation===Ze.Bd.NEQ)&&p.createElement(pi.Ph,{placeholder:"value",value:L.current,options:L.options,onChange:f,"aria-label":"Comparison value",isClearable:!0,allowCustomValue:!0}),w.operation!==Ze.Bd.EQ&&p.createElement(tn.Y,{key:`${w.property}/${w.operation}`,value:isNaN(Number(w.value))?0:Number(w.value),placeholder:"numeric value",onChange:m}))),p.createElement(mn.zx,{size:"md",icon:"trash-alt",onClick:()=>v(),variant:"secondary","aria-label":"Delete style rule",className:c.button})),p.createElement("div",null,p.createElement(bi,{value:r.style??V.Er,context:i,onChange:_,item:{settings:{simpleFixedValues:!0,layerInfo:o}}})))},Bh=r=>({rule:ee.css`
    margin-bottom: ${r.spacing(1)};
  `,row:ee.css`
    display: flex;
    margin-bottom: 4px;
  `,inline:ee.css`
    margin-bottom: 0;
    margin-left: 4px;
  `,button:ee.css`
    margin-left: 4px;
  `,flexRow:ee.css`
    display: flex;
    flex-direction: row;
    align-items: flex-start;
  `}),Gh=({value:r,onChange:e,context:t,item:i})=>{const n=(0,_e.l4)(),s=i.settings,o=(0,p.useCallback)(()=>{const{palette:h}=n.visualization,c={fixed:h[Math.floor(Math.random()*h.length)]},u=[...r,{...vo,style:{...V.Er,color:c}}];e(u)},[e,r,n.visualization]),a=(0,p.useCallback)(h=>c=>{const u=[...r];c?u[h]=c:u.splice(h,1),e(u)},[e,r]),l=r&&r.map((h,c)=>{const u={settings:s};return p.createElement(kh,{value:h,onChange:a(c),context:t,item:u,key:`${c}-${h.check?.property}`})});return p.createElement(p.Fragment,null,l,p.createElement(mn.zx,{size:"sm",icon:"plus",onClick:o,variant:"secondary","aria-label":"Add geomap style rule"},"Add style rule"))};var xo=S(31129),yo=S(9471);const Bn={src:"public/maps/countries.geojson",rules:[],style:V.Er},vo={style:V.Er,check:{property:"",operation:Ze.Bd.EQ,value:""}},zh={id:"geojson",name:"GeoJSON",description:"Load static data from a geojson file",isBaseMap:!1,state:Li.BV.beta,create:async(r,e,t,i)=>{const n={...Bn,...e.config},s=new _t({url:n.src,format:new fo.Z}),o=new ws.t,a=s.on("change",()=>{s.getState()=="ready"&&((0,gs.B)(a),o.next(s.getFeatures()))}),l=[];if(n.rules){for(const c of n.rules)if(c.style){const u=await gi(c.style);l.push({state:u,rule:c.check})}}{const c=await gi(n.style);l.push({state:c})}const h=new ze({source:s,style:c=>{const u=c.getGeometry()?.getType()==="Point";for(const d of l)if(!(d.rule&&!go(d.rule,c))){if(d.state.fields){const g={...d.state.base},{text:f}=d.state.fields;return f&&(g.text=`${c.get(f)}`),u?d.state.maker(g):Pn(g)}return u?(d.point||(d.point=d.state.maker(d.state.base)),d.point):(d.poly||(d.poly=Pn(d.state.base)),d.poly)}}});return{init:()=>h,registerOptionsUI:c=>{const u=o.pipe((0,xo.P)(),(0,yo.U)(d=>_o(d)));c.addSelect({path:"config.src",name:"GeoJSON URL",settings:{options:(0,lt.B1)()??[],allowCustomValue:!0},defaultValue:Bn.src}).addCustomEditor({id:"config.style",path:"config.style",name:"Default style",description:"The style to apply when no rules above match",editor:bi,settings:{simpleFixedValues:!0,layerInfo:u},defaultValue:Bn.style}).addCustomEditor({id:"config.rules",path:"config.rules",name:"Style rules",description:"Apply styles based on feature properties",editor:Gh,settings:{features:o,layerInfo:u},defaultValue:[]})}}},defaultOptions:Bn},Gn=34962,Ws=34963,Wh=35040,Nh=35044,zn=35048,Zh=5121,Uh=5123,Xh=5125,Eo=5126,wo=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function Ns(r,e){e=Object.assign({preserveDrawingBuffer:!0,antialias:!dr.ME},e);const t=wo.length;for(let i=0;i<t;++i)try{const n=r.getContext(wo[i],e);if(n)return n}catch{}return null}let Zs;function Iu(){if(!Zs){const r=document.createElement("canvas"),e=Ns(r);e&&(Zs=e.getSupportedExtensions())}return Zs}const Vh={STATIC_DRAW:Nh,STREAM_DRAW:Wh,DYNAMIC_DRAW:zn};class Yh{constructor(e,t){this.array=null,this.type=e,(0,ue.h)(e===Gn||e===Ws,62),this.usage=t!==void 0?t:Vh.STATIC_DRAW}ofSize(e){this.array=new(Us(this.type))(e)}fromArray(e){this.array=Us(this.type).from(e)}fromArrayBuffer(e){this.array=new(Us(this.type))(e)}getType(){return this.type}getArray(){return this.array}getUsage(){return this.usage}getSize(){return this.array?this.array.length:0}}function Us(r){switch(r){case Gn:return Float32Array;case Ws:return Uint32Array;default:return Float32Array}}const Xs=Yh;var jh=S(71368);const Wn={LOST:"webglcontextlost",RESTORED:"webglcontextrestored"};var Hh=S(86397);const Kh=`
  precision mediump float;
  
  attribute vec2 a_position;
  varying vec2 v_texCoord;
  varying vec2 v_screenCoord;
  
  uniform vec2 u_screenSize;
   
  void main() {
    v_texCoord = a_position * 0.5 + 0.5;
    v_screenCoord = v_texCoord * u_screenSize;
    gl_Position = vec4(a_position, 0.0, 1.0);
  }
`,$h=`
  precision mediump float;
   
  uniform sampler2D u_image;
  uniform float u_opacity;
   
  varying vec2 v_texCoord;
   
  void main() {
    gl_FragColor = texture2D(u_image, v_texCoord) * u_opacity;
  }
`;class Jh{constructor(e){this.gl_=e.webGlContext;const t=this.gl_;this.scaleRatio_=e.scaleRatio||1,this.renderTargetTexture_=t.createTexture(),this.renderTargetTextureSize_=null,this.frameBuffer_=t.createFramebuffer();const i=t.createShader(t.VERTEX_SHADER);t.shaderSource(i,e.vertexShader||Kh),t.compileShader(i);const n=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(n,e.fragmentShader||$h),t.compileShader(n),this.renderTargetProgram_=t.createProgram(),t.attachShader(this.renderTargetProgram_,i),t.attachShader(this.renderTargetProgram_,n),t.linkProgram(this.renderTargetProgram_),this.renderTargetVerticesBuffer_=t.createBuffer();const s=[-1,-1,1,-1,-1,1,1,-1,1,1,-1,1];t.bindBuffer(t.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),t.bufferData(t.ARRAY_BUFFER,new Float32Array(s),t.STATIC_DRAW),this.renderTargetAttribLocation_=t.getAttribLocation(this.renderTargetProgram_,"a_position"),this.renderTargetUniformLocation_=t.getUniformLocation(this.renderTargetProgram_,"u_screenSize"),this.renderTargetOpacityLocation_=t.getUniformLocation(this.renderTargetProgram_,"u_opacity"),this.renderTargetTextureLocation_=t.getUniformLocation(this.renderTargetProgram_,"u_image"),this.uniforms_=[],e.uniforms&&Object.keys(e.uniforms).forEach(o=>{this.uniforms_.push({value:e.uniforms[o],location:t.getUniformLocation(this.renderTargetProgram_,o)})})}getGL(){return this.gl_}init(e){const t=this.getGL(),i=[t.drawingBufferWidth*this.scaleRatio_,t.drawingBufferHeight*this.scaleRatio_];if(t.bindFramebuffer(t.FRAMEBUFFER,this.getFrameBuffer()),t.viewport(0,0,i[0],i[1]),!this.renderTargetTextureSize_||this.renderTargetTextureSize_[0]!==i[0]||this.renderTargetTextureSize_[1]!==i[1]){this.renderTargetTextureSize_=i;const n=0,s=t.RGBA,o=0,a=t.RGBA,l=t.UNSIGNED_BYTE,h=null;t.bindTexture(t.TEXTURE_2D,this.renderTargetTexture_),t.texImage2D(t.TEXTURE_2D,n,s,i[0],i[1],o,a,l,h),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),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.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.renderTargetTexture_,0)}}apply(e,t,i,n){const s=this.getGL(),o=e.size;if(s.bindFramebuffer(s.FRAMEBUFFER,t?t.getFrameBuffer():null),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,this.renderTargetTexture_),!t){const l=(0,J.sq)(s.canvas);if(!e.renderTargets[l]){const h=s.getContextAttributes();h&&h.preserveDrawingBuffer&&(s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT)),e.renderTargets[l]=!0}}s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA),s.viewport(0,0,s.drawingBufferWidth,s.drawingBufferHeight),s.bindBuffer(s.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),s.useProgram(this.renderTargetProgram_),s.enableVertexAttribArray(this.renderTargetAttribLocation_),s.vertexAttribPointer(this.renderTargetAttribLocation_,2,s.FLOAT,!1,0,0),s.uniform2f(this.renderTargetUniformLocation_,o[0],o[1]),s.uniform1i(this.renderTargetTextureLocation_,0);const a=e.layerStatesArray[e.layerIndex].opacity;s.uniform1f(this.renderTargetOpacityLocation_,a),this.applyUniforms(e),i&&i(s,e),s.drawArrays(s.TRIANGLES,0,6),n&&n(s,e)}getFrameBuffer(){return this.frameBuffer_}applyUniforms(e){const t=this.getGL();let i,n=1;this.uniforms_.forEach(function(s){if(i=typeof s.value=="function"?s.value(e):s.value,i instanceof HTMLCanvasElement||i instanceof ImageData)s.texture||(s.texture=t.createTexture()),t.activeTexture(t[`TEXTURE${n}`]),t.bindTexture(t.TEXTURE_2D,s.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),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),i instanceof ImageData?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,i.width,i.height,0,t.UNSIGNED_BYTE,new Uint8Array(i.data)):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,i),t.uniform1i(s.location,n++);else if(Array.isArray(i))switch(i.length){case 2:t.uniform2f(s.location,i[0],i[1]);return;case 3:t.uniform3f(s.location,i[0],i[1],i[2]);return;case 4:t.uniform4f(s.location,i[0],i[1],i[2],i[3]);return;default:return}else typeof i=="number"&&t.uniform1f(s.location,i)})}}const Co=Jh;function qh(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Vs(r,e){return r[0]=e[0],r[1]=e[1],r[4]=e[2],r[5]=e[3],r[12]=e[4],r[13]=e[5],r}const Ru={FRAGMENT_SHADER:35632,VERTEX_SHADER:35633},si={PROJECTION_MATRIX:"u_projectionMatrix",OFFSET_SCALE_MATRIX:"u_offsetScaleMatrix",OFFSET_ROTATION_MATRIX:"u_offsetRotateMatrix",TIME:"u_time",ZOOM:"u_zoom",RESOLUTION:"u_resolution",SIZE_PX:"u_sizePx",PIXEL_RATIO:"u_pixelRatio"},Tt={UNSIGNED_BYTE:Zh,UNSIGNED_SHORT:Uh,UNSIGNED_INT:Xh,FLOAT:Eo},Nn={};function So(r){return"shared/"+r}let To=0;function Qh(){const r="unique/"+To;return To+=1,r}function ec(r){let e=Nn[r];if(!e){const t=document.createElement("canvas");t.style.position="absolute",t.style.left="0",e={users:0,canvas:t},Nn[r]=e}return e.users+=1,e.canvas}function tc(r){const e=Nn[r];if(!e||(e.users-=1,e.users>0))return;const t=e.canvas,n=Ns(t).getExtension("WEBGL_lose_context");n&&n.loseContext(),delete Nn[r]}class ic extends Hh.Z{constructor(e){super(),e=e||{},this.boundHandleWebGLContextLost_=this.handleWebGLContextLost.bind(this),this.boundHandleWebGLContextRestored_=this.handleWebGLContextRestored.bind(this),this.canvasCacheKey_=e.canvasCacheKey?So(e.canvasCacheKey):Qh(),this.canvas_=ec(this.canvasCacheKey_),this.gl_=Ns(this.canvas_),this.bufferCache_={},this.extensionCache_={},this.currentProgram_=null,this.canvas_.addEventListener(Wn.LOST,this.boundHandleWebGLContextLost_),this.canvas_.addEventListener(Wn.RESTORED,this.boundHandleWebGLContextRestored_),this.offsetRotateMatrix_=(0,q.Ue)(),this.offsetScaleMatrix_=(0,q.Ue)(),this.tmpMat4_=qh(),this.uniformLocations_={},this.attribLocations_={},this.uniforms_=[],e.uniforms&&this.setUniforms(e.uniforms);const t=this.getGL();this.postProcessPasses_=e.postProcesses?e.postProcesses.map(function(i){return new Co({webGlContext:t,scaleRatio:i.scaleRatio,vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,uniforms:i.uniforms})}):[new Co({webGlContext:t})],this.shaderCompileErrors_=null,this.startTime_=Date.now()}setUniforms(e){this.uniforms_=[];for(const t in e)this.uniforms_.push({name:t,value:e[t]});this.uniformLocations_={}}canvasCacheKeyMatches(e){return this.canvasCacheKey_===So(e)}getExtension(e){if(e in this.extensionCache_)return this.extensionCache_[e];const t=this.gl_.getExtension(e);return this.extensionCache_[e]=t,t}bindBuffer(e){const t=this.getGL(),i=(0,J.sq)(e);let n=this.bufferCache_[i];if(!n){const s=t.createBuffer();n={buffer:e,webGlBuffer:s},this.bufferCache_[i]=n}t.bindBuffer(e.getType(),n.webGlBuffer)}flushBufferData(e){const t=this.getGL();this.bindBuffer(e),t.bufferData(e.getType(),e.getArray(),e.getUsage())}deleteBuffer(e){const t=this.getGL(),i=(0,J.sq)(e),n=this.bufferCache_[i];n&&!t.isContextLost()&&t.deleteBuffer(n.webGlBuffer),delete this.bufferCache_[i]}disposeInternal(){this.canvas_.removeEventListener(Wn.LOST,this.boundHandleWebGLContextLost_),this.canvas_.removeEventListener(Wn.RESTORED,this.boundHandleWebGLContextRestored_),tc(this.canvasCacheKey_),delete this.gl_,delete this.canvas_}prepareDraw(e,t){const i=this.getGL(),n=this.getCanvas(),s=e.size,o=e.pixelRatio;n.width=s[0]*o,n.height=s[1]*o,n.style.width=s[0]+"px",n.style.height=s[1]+"px";for(let a=this.postProcessPasses_.length-1;a>=0;a--)this.postProcessPasses_[a].init(e);i.bindTexture(i.TEXTURE_2D,null),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.enable(i.BLEND),i.blendFunc(i.ONE,t?i.ZERO:i.ONE_MINUS_SRC_ALPHA)}prepareDrawToRenderTarget(e,t,i){const n=this.getGL(),s=t.getSize();n.bindFramebuffer(n.FRAMEBUFFER,t.getFramebuffer()),n.viewport(0,0,s[0],s[1]),n.bindTexture(n.TEXTURE_2D,t.getTexture()),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.ONE,i?n.ZERO:n.ONE_MINUS_SRC_ALPHA)}drawElements(e,t){const i=this.getGL();this.getExtension("OES_element_index_uint");const n=i.UNSIGNED_INT,s=4,o=t-e,a=e*s;i.drawElements(i.TRIANGLES,o,n,a)}finalizeDraw(e,t,i){for(let n=0,s=this.postProcessPasses_.length;n<s;n++)n===s-1?this.postProcessPasses_[n].apply(e,null,t,i):this.postProcessPasses_[n].apply(e,this.postProcessPasses_[n+1])}getCanvas(){return this.canvas_}getGL(){return this.gl_}applyFrameState(e){const t=e.size,i=e.viewState.rotation,n=e.pixelRatio,s=(0,q.mc)(this.offsetScaleMatrix_);(0,q.bA)(s,2/t[0],2/t[1]);const o=(0,q.mc)(this.offsetRotateMatrix_);i!==0&&(0,q.U1)(o,-i),this.setUniformMatrixValue(si.OFFSET_SCALE_MATRIX,Vs(this.tmpMat4_,s)),this.setUniformMatrixValue(si.OFFSET_ROTATION_MATRIX,Vs(this.tmpMat4_,o)),this.setUniformFloatValue(si.TIME,(Date.now()-this.startTime_)*.001),this.setUniformFloatValue(si.ZOOM,e.viewState.zoom),this.setUniformFloatValue(si.RESOLUTION,e.viewState.resolution),this.setUniformFloatValue(si.PIXEL_RATIO,n),this.setUniformFloatVec2(si.SIZE_PX,[t[0],t[1]])}applyUniforms(e){const t=this.getGL();let i,n=0;this.uniforms_.forEach(s=>{if(i=typeof s.value=="function"?s.value(e):s.value,i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof ImageData)s.texture||(s.prevValue=void 0,s.texture=t.createTexture()),t.activeTexture(t[`TEXTURE${n}`]),t.bindTexture(t.TEXTURE_2D,s.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),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),(!(i instanceof HTMLImageElement)||i.complete)&&s.prevValue!==i&&(s.prevValue=i,t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,i)),t.uniform1i(this.getUniformLocation(s.name),n++);else if(Array.isArray(i)&&i.length===6)this.setUniformMatrixValue(s.name,Vs(this.tmpMat4_,i));else if(Array.isArray(i)&&i.length<=4)switch(i.length){case 2:t.uniform2f(this.getUniformLocation(s.name),i[0],i[1]);return;case 3:t.uniform3f(this.getUniformLocation(s.name),i[0],i[1],i[2]);return;case 4:t.uniform4f(this.getUniformLocation(s.name),i[0],i[1],i[2],i[3]);return;default:return}else typeof i=="number"&&t.uniform1f(this.getUniformLocation(s.name),i)})}useProgram(e,t){this.getGL().useProgram(e),this.currentProgram_=e,this.uniformLocations_={},this.attribLocations_={},this.applyFrameState(t),this.applyUniforms(t)}compileShader(e,t){const i=this.getGL(),n=i.createShader(t);return i.shaderSource(n,e),i.compileShader(n),n}getProgram(e,t){const i=this.getGL(),n=this.compileShader(e,i.FRAGMENT_SHADER),s=this.compileShader(t,i.VERTEX_SHADER),o=i.createProgram();if(i.attachShader(o,n),i.attachShader(o,s),i.linkProgram(o),!i.getShaderParameter(n,i.COMPILE_STATUS)){const a=`Fragment shader compilation failed: ${i.getShaderInfoLog(n)}`;throw new Error(a)}if(i.deleteShader(n),!i.getShaderParameter(s,i.COMPILE_STATUS)){const a=`Vertex shader compilation failed: ${i.getShaderInfoLog(s)}`;throw new Error(a)}if(i.deleteShader(s),!i.getProgramParameter(o,i.LINK_STATUS)){const a=`GL program linking failed: ${i.getShaderInfoLog(s)}`;throw new Error(a)}return o}getUniformLocation(e){return this.uniformLocations_[e]===void 0&&(this.uniformLocations_[e]=this.getGL().getUniformLocation(this.currentProgram_,e)),this.uniformLocations_[e]}getAttributeLocation(e){return this.attribLocations_[e]===void 0&&(this.attribLocations_[e]=this.getGL().getAttribLocation(this.currentProgram_,e)),this.attribLocations_[e]}makeProjectionTransform(e,t){const i=e.size,n=e.viewState.rotation,s=e.viewState.resolution,o=e.viewState.center;return(0,q.mc)(t),(0,q.qC)(t,0,0,2/(s*i[0]),2/(s*i[1]),-n,-o[0],-o[1]),t}setUniformFloatValue(e,t){this.getGL().uniform1f(this.getUniformLocation(e),t)}setUniformFloatVec2(e,t){this.getGL().uniform2fv(this.getUniformLocation(e),t)}setUniformFloatVec4(e,t){this.getGL().uniform4fv(this.getUniformLocation(e),t)}setUniformMatrixValue(e,t){this.getGL().uniformMatrix4fv(this.getUniformLocation(e),!1,t)}enableAttributeArray_(e,t,i,n,s){const o=this.getAttributeLocation(e);o<0||(this.getGL().enableVertexAttribArray(o),this.getGL().vertexAttribPointer(o,t,i,!1,n,s))}enableAttributes(e){const t=nc(e);let i=0;for(let n=0;n<e.length;n++){const s=e[n];this.enableAttributeArray_(s.name,s.size,s.type||Eo,t,i),i+=s.size*Io(s.type)}}handleWebGLContextLost(){(0,Ui.Z)(this.bufferCache_),this.currentProgram_=null}handleWebGLContextRestored(){}createTexture(e,t,i){const n=this.getGL();i=i||n.createTexture();const s=0,o=n.RGBA,a=0,l=n.RGBA,h=n.UNSIGNED_BYTE;return n.bindTexture(n.TEXTURE_2D,i),t?n.texImage2D(n.TEXTURE_2D,s,o,l,h,t):n.texImage2D(n.TEXTURE_2D,s,o,e[0],e[1],a,l,h,null),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),i}}function nc(r){let e=0;for(let t=0;t<r.length;t++){const i=r[t];e+=i.size*Io(i.type)}return e}function Io(r){switch(r){case Tt.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case Tt.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case Tt.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case Tt.FLOAT:default:return Float32Array.BYTES_PER_ELEMENT}}const sc=ic;class Ys extends yr{constructor(e,t){super(e),t=t||{},this.inversePixelTransform_=(0,q.Ue)(),this.pixelContext_=null,this.postProcesses_=t.postProcesses,this.uniforms_=t.uniforms,this.helper,e.addChangeListener(jh.Z.MAP,this.removeHelper.bind(this)),this.dispatchPreComposeEvent=this.dispatchPreComposeEvent.bind(this),this.dispatchPostComposeEvent=this.dispatchPostComposeEvent.bind(this)}dispatchPreComposeEvent(e,t){const i=this.getLayer();if(i.hasListener(Jt.Z.PRECOMPOSE)){const n=new vn.Z(Jt.Z.PRECOMPOSE,void 0,t,e);i.dispatchEvent(n)}}dispatchPostComposeEvent(e,t){const i=this.getLayer();if(i.hasListener(Jt.Z.POSTCOMPOSE)){const n=new vn.Z(Jt.Z.POSTCOMPOSE,void 0,t,e);i.dispatchEvent(n)}}reset(e){this.uniforms_=e.uniforms,this.helper&&this.helper.setUniforms(this.uniforms_)}removeHelper(){this.helper&&(this.helper.dispose(),delete this.helper)}prepareFrame(e){if(this.getLayer().getRenderSource()){let t=!0,i=-1,n;for(let o=0,a=e.layerStatesArray.length;o<a;o++){const l=e.layerStatesArray[o].layer,h=l.getRenderer();if(!(h instanceof Ys)){t=!0;continue}const c=l.getClassName();if((t||c!==n)&&(i+=1,t=!1),n=c,h===this)break}const s="map/"+e.mapId+"/group/"+i;(!this.helper||!this.helper.canvasCacheKeyMatches(s))&&(this.removeHelper(),this.helper=new sc({postProcesses:this.postProcesses_,uniforms:this.uniforms_,canvasCacheKey:s}),n&&(this.helper.getCanvas().className=n),this.afterHelperCreated())}return this.prepareFrameInternal(e)}afterHelperCreated(){}prepareFrameInternal(e){return!0}disposeInternal(){this.removeHelper(),super.disposeInternal()}dispatchRenderEvent_(e,t,i){const n=this.getLayer();if(n.hasListener(e)){(0,q.qC)(this.inversePixelTransform_,0,0,i.pixelRatio,-i.pixelRatio,0,0,-i.size[1]);const s=new vn.Z(e,this.inversePixelTransform_,i,t);n.dispatchEvent(s)}}preRender(e,t){this.dispatchRenderEvent_(Jt.Z.PRERENDER,e,t)}postRender(e,t){this.dispatchRenderEvent_(Jt.Z.POSTRENDER,e,t)}}const rc=Ys,Dt=new Uint8Array(4);class oc{constructor(e,t){this.helper_=e;const i=e.getGL();this.texture_=i.createTexture(),this.framebuffer_=i.createFramebuffer(),this.size_=t||[1,1],this.data_=new Uint8Array(0),this.dataCacheDirty_=!0,this.updateSize_()}setSize(e){(0,qe.fS)(e,this.size_)||(this.size_[0]=e[0],this.size_[1]=e[1],this.updateSize_())}getSize(){return this.size_}clearCachedData(){this.dataCacheDirty_=!0}readAll(){if(this.dataCacheDirty_){const e=this.size_,t=this.helper_.getGL();t.bindFramebuffer(t.FRAMEBUFFER,this.framebuffer_),t.readPixels(0,0,e[0],e[1],t.RGBA,t.UNSIGNED_BYTE,this.data_),this.dataCacheDirty_=!1}return this.data_}readPixel(e,t){if(e<0||t<0||e>this.size_[0]||t>=this.size_[1])return Dt[0]=0,Dt[1]=0,Dt[2]=0,Dt[3]=0,Dt;this.readAll();const i=Math.floor(e)+(this.size_[1]-Math.floor(t)-1)*this.size_[0];return Dt[0]=this.data_[i*4],Dt[1]=this.data_[i*4+1],Dt[2]=this.data_[i*4+2],Dt[3]=this.data_[i*4+3],Dt}getTexture(){return this.texture_}getFramebuffer(){return this.framebuffer_}updateSize_(){const e=this.size_,t=this.helper_.getGL();this.texture_=this.helper_.createTexture(e,null,this.texture_),t.bindFramebuffer(t.FRAMEBUFFER,this.framebuffer_),t.viewport(0,0,e[0],e[1]),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.texture_,0),this.data_=new Uint8Array(e[0]*e[1]*4)}}const ac=oc,js={GENERATE_POLYGON_BUFFERS:"GENERATE_POLYGON_BUFFERS",GENERATE_POINT_BUFFERS:"GENERATE_POINT_BUFFERS",GENERATE_LINE_STRING_BUFFERS:"GENERATE_LINE_STRING_BUFFERS"};var bu=S(37072);const lc=null,Hs={vertexPosition:0,indexPosition:0};function Zn(r,e,t,i,n){r[e+0]=t,r[e+1]=i,r[e+2]=n}function Lu(r,e,t,i,n,s){const l=3+n,h=r[e+0],c=r[e+1],u=lc;u.length=n;for(let m=0;m<u.length;m++)u[m]=r[e+2+m];let d=s?s.vertexPosition:0,g=s?s.indexPosition:0;const f=d/l;return Zn(t,d,h,c,0),u.length&&t.set(u,d+3),d+=l,Zn(t,d,h,c,1),u.length&&t.set(u,d+3),d+=l,Zn(t,d,h,c,2),u.length&&t.set(u,d+3),d+=l,Zn(t,d,h,c,3),u.length&&t.set(u,d+3),d+=l,i[g++]=f,i[g++]=f+1,i[g++]=f+3,i[g++]=f+1,i[g++]=f+2,i[g++]=f+3,Hs.vertexPosition=d,Hs.indexPosition=g,Hs}function Fu(r,e,t,i,n,s,o,a,l,h){const u=5+a.length,d=s.length/u,g=[r[e+0],r[e+1]],f=[r[t],r[t+1]],m=applyTransform(h,[...g]),_=applyTransform(h,[...f]);function v(O,z,$){return Math.round(z*1500)+Math.round($*1500)*1e4+O*1e4*1e4}function w(O,z,$){const K=Math.sqrt((z[0]-O[0])*(z[0]-O[0])+(z[1]-O[1])*(z[1]-O[1])),he=[(z[0]-O[0])/K,(z[1]-O[1])/K],ce=[-he[1],he[0]],ie=Math.sqrt(($[0]-O[0])*($[0]-O[0])+($[1]-O[1])*($[1]-O[1])),be=[($[0]-O[0])/ie,($[1]-O[1])/ie],ae=K===0||ie===0?0:Math.acos(clamp(be[0]*he[0]+be[1]*he[1],-1,1));return be[0]*ce[0]+be[1]*ce[1]>0?ae:Math.PI*2-ae}const E=i!==null,L=n!==null;let M=0,A=0;if(E){const O=[r[i],r[i+1]],z=applyTransform(h,[...O]);M=w(m,_,z)}if(L){const O=[r[n],r[n+1]],z=applyTransform(h,[...O]);A=w(_,m,z)}s.push(g[0],g[1],f[0],f[1],v(0,M,A)),s.push(...a),s.push(g[0],g[1],f[0],f[1],v(1,M,A)),s.push(...a),s.push(g[0],g[1],f[0],f[1],v(2,M,A)),s.push(...a),s.push(g[0],g[1],f[0],f[1],v(3,M,A)),s.push(...a),o.push(d,d+1,d+2,d+1,d+3,d+2)}function Mu(r,e,t,i,n){const o=2+n;let a=e;const l=r.slice(a,a+n);a+=n;const h=r[a++];let c=0;const u=new Array(h-1);for(let f=0;f<h;f++)c+=r[a++],f<h-1&&(u[f]=c);const d=r.slice(a,a+c*2),g=earcut(d,u,2);for(let f=0;f<g.length;f++)i.push(g[f]+t.length/o);for(let f=0;f<d.length;f+=2)t.push(d[f],d[f+1],...l);return a+c*2}function Pu(){const e=document.createElement("canvas").getContext("2d").createImageData(1,1);return e.data[0]=255,e.data[1]=255,e.data[2]=255,e.data[3]=255,e}function hc(r,e){e=e||[];const t=256,i=t-1;return e[0]=Math.floor(r/t/t/t)/i,e[1]=Math.floor(r/t/t)%t/i,e[2]=Math.floor(r/t)%t/i,e[3]=r%t/i,e}function cc(r){let e=0;const t=256,i=t-1;return e+=Math.round(r[0]*t*t*t*i),e+=Math.round(r[1]*t*t*i),e+=Math.round(r[2]*t*i),e+=Math.round(r[3]*i),e}var uc=S(18205).Buffer;function dc(){const r='const e="GENERATE_POLYGON_BUFFERS",t="GENERATE_POINT_BUFFERS",n="GENERATE_LINE_STRING_BUFFERS",r={1:"The view center is not defined",2:"The view resolution is not defined",3:"The view rotation is not defined",4:"`image` and `src` cannot be provided at the same time",5:"`imgSize` must be set when `image` is provided",7:"`format` must be set when `url` is set",8:"Unknown `serverType` configured",9:"`url` must be configured or set using `#setUrl()`",10:"The default `geometryFunction` can only handle `Point` geometries",11:"`options.featureTypes` must be an Array",12:"`options.geometryName` must also be provided when `options.bbox` is set",13:"Invalid corner",14:"Invalid color",15:"Tried to get a value for a key that does not exist in the cache",16:"Tried to set a value for a key that is used already",17:"`resolutions` must be sorted in descending order",18:"Either `origin` or `origins` must be configured, never both",19:"Number of `tileSizes` and `resolutions` must be equal",20:"Number of `origins` and `resolutions` must be equal",22:"Either `tileSize` or `tileSizes` must be configured, never both",24:"Invalid extent or geometry provided as `geometry`",25:"Cannot fit empty extent provided as `geometry`",26:"Features must have an id set",27:"Features must have an id set",28:\'`renderMode` must be `"hybrid"` or `"vector"`\',30:"The passed `feature` was already added to the source",31:"Tried to enqueue an `element` that was already added to the queue",32:"Transformation matrix cannot be inverted",33:"Invalid units",34:"Invalid geometry layout",36:"Unknown SRS type",37:"Unknown geometry type found",38:"`styleMapValue` has an unknown type",39:"Unknown geometry type",40:"Expected `feature` to have a geometry",41:"Expected an `ol/style/Style` or an array of `ol/style/Style.js`",42:"Question unknown, the answer is 42",43:"Expected `layers` to be an array or a `Collection`",47:"Expected `controls` to be an array or an `ol/Collection`",48:"Expected `interactions` to be an array or an `ol/Collection`",49:"Expected `overlays` to be an array or an `ol/Collection`",50:"`options.featureTypes` should be an Array",51:"Either `url` or `tileJSON` options must be provided",52:"Unknown `serverType` configured",53:"Unknown `tierSizeCalculation` configured",55:"The {-y} placeholder requires a tile grid with extent",56:"mapBrowserEvent must originate from a pointer event",57:"At least 2 conditions are required",59:"Invalid command found in the PBF",60:"Missing or invalid `size`",61:"Cannot determine IIIF Image API version from provided image information JSON",62:"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`",64:"Layer opacity must be a number",66:"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled. This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`",67:"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both",68:"A VectorTile source can only be rendered if it has a projection compatible with the view projection",69:"`width` or `height` cannot be provided together with `scale`"};class o extends Error{constructor(e){const t=r[e];super(t),this.code=e,this.name="AssertionError",this.message=t}}var i=o;function a(e,t){const n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function s(e,t){const n=(r=t)[0]*r[3]-r[1]*r[2];var r;!function(e,t){if(!e)throw new i(t)}(0!==n,32);const o=t[0],a=t[1],s=t[2],u=t[3],f=t[4],x=t[5];return e[0]=u/n,e[1]=-a/n,e[2]=-s/n,e[3]=o/n,e[4]=(s*x-u*f)/n,e[5]=-(o*x-a*f)/n,e}new Array(6);var u={};function f(e,t,n){n=n||2;var r,o,i,a,s,u,f,l=t&&t.length,c=l?t[0]*n:e.length,v=x(e,0,c,n,!0),d=[];if(!v||v.next===v.prev)return d;if(l&&(v=function(e,t,n,r){var o,i,a,s=[];for(o=0,i=t.length;o<i;o++)(a=x(e,t[o]*r,o<i-1?t[o+1]*r:e.length,r,!1))===a.next&&(a.steiner=!0),s.push(w(a));for(s.sort(p),o=0;o<s.length;o++)n=b(s[o],n);return n}(e,t,v,n)),e.length>80*n){r=i=e[0],o=a=e[1];for(var y=n;y<c;y+=n)(s=e[y])<r&&(r=s),(u=e[y+1])<o&&(o=u),s>i&&(i=s),u>a&&(a=u);f=0!==(f=Math.max(i-r,a-o))?32767/f:0}return h(v,d,n,r,o,f,0),d}function x(e,t,n,r,o){var i,a;if(o===B(e,t,n,r)>0)for(i=t;i<n;i+=r)a=k(i,e[i],e[i+1],a);else for(i=n-r;i>=t;i-=r)a=k(i,e[i],e[i+1],a);return a&&M(a,a.next)&&(z(a),a=a.next),a}function l(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!M(r,r.next)&&0!==Z(r.prev,r,r.next))r=r.next;else{if(z(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function h(e,t,n,r,o,i,a){if(e){!a&&i&&function(e,t,n,r){var o=e;do{0===o.z&&(o.z=m(o.x,o.y,t,n,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,function(e){var t,n,r,o,i,a,s,u,f=1;do{for(n=e,e=null,i=null,a=0;n;){for(a++,r=n,s=0,t=0;t<f&&(s++,r=r.nextZ);t++);for(u=f;s>0||u>0&&r;)0!==s&&(0===u||!r||n.z<=r.z)?(o=n,n=n.nextZ,s--):(o=r,r=r.nextZ,u--),i?i.nextZ=o:e=o,o.prevZ=i,i=o;n=r}i.nextZ=null,f*=2}while(a>1)}(o)}(e,r,o,i);for(var s,u,f=e;e.prev!==e.next;)if(s=e.prev,u=e.next,i?v(e,r,o,i):c(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(u.i/n|0),z(e),e=u.next,f=u.next;else if((e=u)===f){a?1===a?h(e=d(l(e),t,n),t,n,r,o,i,2):2===a&&y(e,t,n,r,o,i):h(l(e),t,n,r,o,i,1);break}}}function c(e){var t=e.prev,n=e,r=e.next;if(Z(t,n,r)>=0)return!1;for(var o=t.x,i=n.x,a=r.x,s=t.y,u=n.y,f=r.y,x=o<i?o<a?o:a:i<a?i:a,l=s<u?s<f?s:f:u<f?u:f,h=o>i?o>a?o:a:i>a?i:a,c=s>u?s>f?s:f:u>f?u:f,v=r.next;v!==t;){if(v.x>=x&&v.x<=h&&v.y>=l&&v.y<=c&&A(o,s,i,u,a,f,v.x,v.y)&&Z(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function v(e,t,n,r){var o=e.prev,i=e,a=e.next;if(Z(o,i,a)>=0)return!1;for(var s=o.x,u=i.x,f=a.x,x=o.y,l=i.y,h=a.y,c=s<u?s<f?s:f:u<f?u:f,v=x<l?x<h?x:h:l<h?l:h,d=s>u?s>f?s:f:u>f?u:f,y=x>l?x>h?x:h:l>h?l:h,p=m(c,v,t,n,r),b=m(d,y,t,n,r),g=e.prevZ,w=e.nextZ;g&&g.z>=p&&w&&w.z<=b;){if(g.x>=c&&g.x<=d&&g.y>=v&&g.y<=y&&g!==o&&g!==a&&A(s,x,u,l,f,h,g.x,g.y)&&Z(g.prev,g,g.next)>=0)return!1;if(g=g.prevZ,w.x>=c&&w.x<=d&&w.y>=v&&w.y<=y&&w!==o&&w!==a&&A(s,x,u,l,f,h,w.x,w.y)&&Z(w.prev,w,w.next)>=0)return!1;w=w.nextZ}for(;g&&g.z>=p;){if(g.x>=c&&g.x<=d&&g.y>=v&&g.y<=y&&g!==o&&g!==a&&A(s,x,u,l,f,h,g.x,g.y)&&Z(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;w&&w.z<=b;){if(w.x>=c&&w.x<=d&&w.y>=v&&w.y<=y&&w!==o&&w!==a&&A(s,x,u,l,f,h,w.x,w.y)&&Z(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function d(e,t,n){var r=e;do{var o=r.prev,i=r.next.next;!M(o,i)&&F(o,r,r.next,i)&&S(o,i)&&S(i,o)&&(t.push(o.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),z(r),z(r.next),r=e=i),r=r.next}while(r!==e);return l(r)}function y(e,t,n,r,o,i){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&E(a,s)){var u=U(a,s);return a=l(a,a.next),u=l(u,u.next),h(a,t,n,r,o,i,0),void h(u,t,n,r,o,i,0)}s=s.next}a=a.next}while(a!==e)}function p(e,t){return e.x-t.x}function b(e,t){var n=function(e,t){var n,r=t,o=e.x,i=e.y,a=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=o&&s>a&&(a=s,n=r.x<r.next.x?r:r.next,s===o))return n}r=r.next}while(r!==t);if(!n)return null;var u,f=n,x=n.x,l=n.y,h=1/0;r=n;do{o>=r.x&&r.x>=x&&o!==r.x&&A(i<l?o:a,i,x,l,i<l?a:o,i,r.x,r.y)&&(u=Math.abs(i-r.y)/(o-r.x),S(r,e)&&(u<h||u===h&&(r.x>n.x||r.x===n.x&&g(n,r)))&&(n=r,h=u)),r=r.next}while(r!==f);return n}(e,t);if(!n)return t;var r=U(n,e);return l(r,r.next),l(n,n.next)}function g(e,t){return Z(e.prev,e,t.prev)<0&&Z(t.next,e,e.next)<0}function m(e,t,n,r,o){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*o|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function w(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function A(e,t,n,r,o,i,a,s){return(o-a)*(t-s)>=(e-a)*(i-s)&&(e-a)*(r-s)>=(n-a)*(t-s)&&(n-a)*(i-s)>=(o-a)*(r-s)}function E(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&F(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(S(e,t)&&S(t,e)&&function(e,t){var n=e,r=!1,o=(e.x+t.x)/2,i=(e.y+t.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&o<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(Z(e.prev,e,t.prev)||Z(e,t.prev,t))||M(e,t)&&Z(e.prev,e,e.next)>0&&Z(t.prev,t,t.next)>0)}function Z(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function M(e,t){return e.x===t.x&&e.y===t.y}function F(e,t,n,r){var o=I(Z(e,t,n)),i=I(Z(e,t,r)),a=I(Z(n,r,e)),s=I(Z(n,r,t));return o!==i&&a!==s||(!(0!==o||!T(e,n,t))||(!(0!==i||!T(e,r,t))||(!(0!==a||!T(n,e,r))||!(0!==s||!T(n,t,r)))))}function T(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function I(e){return e>0?1:e<0?-1:0}function S(e,t){return Z(e.prev,e,e.next)<0?Z(e,t,e.next)>=0&&Z(e,e.prev,t)>=0:Z(e,t,e.prev)<0||Z(e,e.next,t)<0}function U(e,t){var n=new R(e.i,e.x,e.y),r=new R(t.i,t.x,t.y),o=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function k(e,t,n,r){var o=new R(e,t,n);return r?(o.next=r.next,o.prev=r,r.next.prev=o,r.next=o):(o.prev=o,o.next=o),o}function z(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function R(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function B(e,t,n,r){for(var o=0,i=t,a=n-r;i<n;i+=r)o+=(e[a]-e[i])*(e[i+1]+e[a+1]),a=i;return o}({get exports(){return u},set exports(e){u=e}}).exports=f,u.default=f,f.deviation=function(e,t,n,r){var o=t&&t.length,i=o?t[0]*n:e.length,a=Math.abs(B(e,0,i,n));if(o)for(var s=0,u=t.length;s<u;s++){var f=t[s]*n,x=s<u-1?t[s+1]*n:e.length;a-=Math.abs(B(e,f,x,n))}var l=0;for(s=0;s<r.length;s+=3){var h=r[s]*n,c=r[s+1]*n,v=r[s+2]*n;l+=Math.abs((e[h]-e[v])*(e[c+1]-e[h+1])-(e[h]-e[c])*(e[v+1]-e[h+1]))}return 0===a&&0===l?0:Math.abs((l-a)/a)},f.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},r=0,o=0;o<e.length;o++){for(var i=0;i<e[o].length;i++)for(var a=0;a<t;a++)n.vertices.push(e[o][i][a]);o>0&&(r+=e[o-1].length,n.holes.push(r))}return n};const N=[],P={vertexPosition:0,indexPosition:0};function C(e,t,n,r,o){e[t+0]=n,e[t+1]=r,e[t+2]=o}function _(e,t,n,r,o,i){const a=3+o,s=e[t+0],u=e[t+1],f=N;f.length=o;for(let n=0;n<f.length;n++)f[n]=e[t+2+n];let x=i?i.vertexPosition:0,l=i?i.indexPosition:0;const h=x/a;return C(n,x,s,u,0),f.length&&n.set(f,x+3),x+=a,C(n,x,s,u,1),f.length&&n.set(f,x+3),x+=a,C(n,x,s,u,2),f.length&&n.set(f,x+3),x+=a,C(n,x,s,u,3),f.length&&n.set(f,x+3),x+=a,r[l++]=h,r[l++]=h+1,r[l++]=h+3,r[l++]=h+1,r[l++]=h+2,r[l++]=h+3,P.vertexPosition=x,P.indexPosition=l,P}function q(e,t,n,r,o,i,s,u,f,x){const l=5+u.length,h=i.length/l,c=[e[t+0],e[t+1]],v=[e[n],e[n+1]],d=a(x,[...c]),y=a(x,[...v]);function p(e,t,n){const r=1e4;return Math.round(1500*t)+Math.round(1500*n)*r+e*r*r}function b(e,t,n){const r=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),o=[(t[0]-e[0])/r,(t[1]-e[1])/r],i=[-o[1],o[0]],a=Math.sqrt((n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1])),s=[(n[0]-e[0])/a,(n[1]-e[1])/a],u=0===r||0===a?0:Math.acos((f=s[0]*o[0]+s[1]*o[1],x=-1,l=1,Math.min(Math.max(f,x),l)));var f,x,l;return s[0]*i[0]+s[1]*i[1]>0?u:2*Math.PI-u}const g=null!==o;let m=0,w=0;if(null!==r){m=b(d,y,a(x,[...[e[r],e[r+1]]]))}if(g){w=b(y,d,a(x,[...[e[o],e[o+1]]]))}i.push(c[0],c[1],v[0],v[1],p(0,m,w)),i.push(...u),i.push(c[0],c[1],v[0],v[1],p(1,m,w)),i.push(...u),i.push(c[0],c[1],v[0],v[1],p(2,m,w)),i.push(...u),i.push(c[0],c[1],v[0],v[1],p(3,m,w)),i.push(...u),s.push(h,h+1,h+2,h+1,h+3,h+2)}function L(e,t,n,r,o){const i=2+o;let a=t;const s=e.slice(a,a+o);a+=o;const f=e[a++];let x=0;const l=new Array(f-1);for(let t=0;t<f;t++)x+=e[a++],t<f-1&&(l[t]=x);const h=e.slice(a,a+2*x),c=u(h,l,2);for(let e=0;e<c.length;e++)r.push(c[e]+n.length/i);for(let e=0;e<h.length;e+=2)n.push(h[e],h[e+1],...s);return a+2*x}const G=self;G.onmessage=r=>{const o=r.data;switch(o.type){case t:{const e=3,t=2,n=o.customAttributesCount,r=t+n,i=new Float32Array(o.renderInstructions),a=i.length/r,s=4*a*(n+e),u=new Uint32Array(6*a),f=new Float32Array(s);let x;for(let e=0;e<i.length;e+=r)x=_(i,e,f,u,n,x);const l=Object.assign({vertexBuffer:f.buffer,indexBuffer:u.buffer,renderInstructions:i.buffer},o);G.postMessage(l,[f.buffer,u.buffer,i.buffer]);break}case n:{const e=[],t=[],n=o.customAttributesCount,r=2,i=new Float32Array(o.renderInstructions);let a=0;const u=o.renderInstructionsTransform,f=[1,0,0,1,0,0];let x,l;for(s(f,u);a<i.length;){l=Array.from(i.slice(a,a+n)),a+=n,x=i[a++];for(let n=0;n<x-1;n++)q(i,a+n*r,a+(n+1)*r,n>0?a+(n-1)*r:null,n<x-2?a+(n+2)*r:null,e,t,l,0,f);a+=x*r}const h=Uint32Array.from(t),c=Float32Array.from(e),v=Object.assign({vertexBuffer:c.buffer,indexBuffer:h.buffer,renderInstructions:i.buffer},o);G.postMessage(v,[c.buffer,h.buffer,i.buffer]);break}case e:{const e=[],t=[],n=o.customAttributesCount,r=new Float32Array(o.renderInstructions);let i=0;for(;i<r.length;)i=L(r,i,e,t,n);const a=Uint32Array.from(t),s=Float32Array.from(e),u=Object.assign({vertexBuffer:s.buffer,indexBuffer:a.buffer,renderInstructions:r.buffer},o);G.postMessage(u,[s.buffer,a.buffer,r.buffer]);break}}};';return new Worker(typeof Blob>"u"?"data:application/javascript;base64,"+uc.from(r,"binary").toString("base64"):URL.createObjectURL(new Blob([r],{type:"application/javascript"})))}class fc extends rc{constructor(e,t){const i=t.uniforms||{},n=(0,q.Ue)();i[si.PROJECTION_MATRIX]=n,super(e,{uniforms:i,postProcesses:t.postProcesses}),this.ready=!1,this.sourceRevision_=-1,this.verticesBuffer_=new Xs(Gn,zn),this.hitVerticesBuffer_=new Xs(Gn,zn),this.indicesBuffer_=new Xs(Ws,zn),this.vertexShader_=t.vertexShader,this.fragmentShader_=t.fragmentShader,this.program_,this.hitDetectionEnabled_=!!(t.hitFragmentShader&&t.hitVertexShader),this.hitVertexShader_=t.hitVertexShader,this.hitFragmentShader_=t.hitFragmentShader,this.hitProgram_;const s=t.attributes?t.attributes.map(function(a){return{name:"a_"+a.name,size:1,type:Tt.FLOAT}}):[];this.attributes=[{name:"a_position",size:2,type:Tt.FLOAT},{name:"a_index",size:1,type:Tt.FLOAT}].concat(s),this.hitDetectionAttributes=[{name:"a_position",size:2,type:Tt.FLOAT},{name:"a_index",size:1,type:Tt.FLOAT},{name:"a_hitColor",size:4,type:Tt.FLOAT},{name:"a_featureUid",size:1,type:Tt.FLOAT}].concat(s),this.customAttributes=t.attributes?t.attributes:[],this.previousExtent_=(0,C.lJ)(),this.currentTransform_=n,this.renderTransform_=(0,q.Ue)(),this.invertRenderTransform_=(0,q.Ue)(),this.renderInstructions_=new Float32Array(0),this.hitRenderInstructions_=new Float32Array(0),this.hitRenderTarget_,this.generateBuffersRun_=0,this.worker_=dc(),this.worker_.addEventListener("message",a=>{const l=a.data;if(l.type===js.GENERATE_POINT_BUFFERS){const h=l.projectionTransform;l.hitDetection?(this.hitVerticesBuffer_.fromArrayBuffer(l.vertexBuffer),this.helper.flushBufferData(this.hitVerticesBuffer_)):(this.verticesBuffer_.fromArrayBuffer(l.vertexBuffer),this.helper.flushBufferData(this.verticesBuffer_)),this.indicesBuffer_.fromArrayBuffer(l.indexBuffer),this.helper.flushBufferData(this.indicesBuffer_),this.renderTransform_=h,(0,q.nb)(this.invertRenderTransform_,this.renderTransform_),l.hitDetection?this.hitRenderInstructions_=new Float32Array(a.data.renderInstructions):(this.renderInstructions_=new Float32Array(a.data.renderInstructions),l.generateBuffersRun===this.generateBuffersRun_&&(this.ready=!0)),this.getLayer().changed()}}),this.featureCache_={},this.featureCount_=0;const o=this.getLayer().getSource();this.sourceListenKeys_=[(0,Je.oL)(o,Ne.ADDFEATURE,this.handleSourceFeatureAdded_,this),(0,Je.oL)(o,Ne.CHANGEFEATURE,this.handleSourceFeatureChanged_,this),(0,Je.oL)(o,Ne.REMOVEFEATURE,this.handleSourceFeatureDelete_,this),(0,Je.oL)(o,Ne.CLEAR,this.handleSourceFeatureClear_,this)],o.forEachFeature(a=>{this.featureCache_[(0,J.sq)(a)]={feature:a,properties:a.getProperties(),geometry:a.getGeometry()},this.featureCount_++})}afterHelperCreated(){this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_),this.hitDetectionEnabled_&&(this.hitProgram_=this.helper.getProgram(this.hitFragmentShader_,this.hitVertexShader_),this.hitRenderTarget_=new ac(this.helper))}handleSourceFeatureAdded_(e){const t=e.feature;this.featureCache_[(0,J.sq)(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()},this.featureCount_++}handleSourceFeatureChanged_(e){const t=e.feature;this.featureCache_[(0,J.sq)(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()}}handleSourceFeatureDelete_(e){const t=e.feature;delete this.featureCache_[(0,J.sq)(t)],this.featureCount_--}handleSourceFeatureClear_(){this.featureCache_={},this.featureCount_=0}renderFrame(e){const t=this.helper.getGL();this.preRender(t,e);const i=e.viewState.projection,o=this.getLayer().getSource().getWrapX()&&i.canWrapX(),a=i.getExtent(),l=e.extent,h=o?(0,C.dz)(a):null,c=o?Math.ceil((l[2]-a[2])/h)+1:1,u=o?Math.floor((l[0]-a[0])/h):0;let d=u;const g=this.indicesBuffer_.getSize();do this.helper.makeProjectionTransform(e,this.currentTransform_),(0,q.Iu)(this.currentTransform_,d*h,0),(0,q.Jp)(this.currentTransform_,this.invertRenderTransform_),this.helper.applyUniforms(e),this.helper.drawElements(0,g);while(++d<c);this.helper.finalizeDraw(e,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent);const f=this.helper.getCanvas();return this.hitDetectionEnabled_&&(this.renderHitDetection(e,u,c,h),this.hitRenderTarget_.clearCachedData()),this.postRender(t,e),f}prepareFrameInternal(e){const t=this.getLayer(),i=t.getSource(),n=e.viewState,s=!e.viewHints[Ei.Z.ANIMATING]&&!e.viewHints[Ei.Z.INTERACTING],o=!(0,C.fS)(this.previousExtent_,e.extent),a=this.sourceRevision_<i.getRevision();if(a&&(this.sourceRevision_=i.getRevision()),s&&(o||a)){const l=n.projection,h=n.resolution,c=t instanceof fs?t.getRenderBuffer():0,u=(0,C.f3)(e.extent,c*h);i.loadFeatures(u,h,l),this.rebuildBuffers_(e),this.previousExtent_=e.extent.slice()}return this.helper.useProgram(this.program_,e),this.helper.prepareDraw(e),this.helper.bindBuffer(this.verticesBuffer_),this.helper.bindBuffer(this.indicesBuffer_),this.helper.enableAttributes(this.attributes),!0}rebuildBuffers_(e){const t=(0,q.Ue)();this.helper.makeProjectionTransform(e,t);const i=(2+this.customAttributes.length)*this.featureCount_;if((!this.renderInstructions_||this.renderInstructions_.length!==i)&&(this.renderInstructions_=new Float32Array(i)),this.hitDetectionEnabled_){const d=(7+this.customAttributes.length)*this.featureCount_;(!this.hitRenderInstructions_||this.hitRenderInstructions_.length!==d)&&(this.hitRenderInstructions_=new Float32Array(d))}let n,s;const o=[],a=[];let l=0,h=0,c;for(const d in this.featureCache_){if(n=this.featureCache_[d],s=n.geometry,!s||s.getType()!=="Point")continue;o[0]=s.getFlatCoordinates()[0],o[1]=s.getFlatCoordinates()[1],(0,q.nn)(t,o),c=hc(h+6,a),this.renderInstructions_[l++]=o[0],this.renderInstructions_[l++]=o[1],this.hitDetectionEnabled_&&(this.hitRenderInstructions_[h++]=o[0],this.hitRenderInstructions_[h++]=o[1],this.hitRenderInstructions_[h++]=c[0],this.hitRenderInstructions_[h++]=c[1],this.hitRenderInstructions_[h++]=c[2],this.hitRenderInstructions_[h++]=c[3],this.hitRenderInstructions_[h++]=Number(d));let g;for(let f=0;f<this.customAttributes.length;f++)g=this.customAttributes[f].callback(n.feature,n.properties),this.renderInstructions_[l++]=g,this.hitDetectionEnabled_&&(this.hitRenderInstructions_[h++]=g)}const u={id:0,type:js.GENERATE_POINT_BUFFERS,renderInstructions:this.renderInstructions_.buffer,customAttributesCount:this.customAttributes.length};if(u.projectionTransform=t,u.generateBuffersRun=++this.generateBuffersRun_,this.ready=!1,this.worker_.postMessage(u,[this.renderInstructions_.buffer]),this.renderInstructions_=null,this.hitDetectionEnabled_){const d={id:0,type:js.GENERATE_POINT_BUFFERS,renderInstructions:this.hitRenderInstructions_.buffer,customAttributesCount:5+this.customAttributes.length};d.projectionTransform=t,d.hitDetection=!0,this.worker_.postMessage(d,[this.hitRenderInstructions_.buffer]),this.hitRenderInstructions_=null}}forEachFeatureAtCoordinate(e,t,i,n,s){if((0,ue.h)(this.hitDetectionEnabled_,66),!this.hitRenderInstructions_)return;const o=(0,q.nn)(t.coordinateToPixelTransform,e.slice()),a=this.hitRenderTarget_.readPixel(o[0]/2,o[1]/2),l=[a[0]/255,a[1]/255,a[2]/255,a[3]/255],h=cc(l),c=this.hitRenderInstructions_[h],u=Math.floor(c).toString(),g=this.getLayer().getSource().getFeatureByUid(u);if(g)return n(g,this.getLayer(),null)}renderHitDetection(e,t,i,n){if(!this.hitVerticesBuffer_.getSize())return;let s=t;this.hitRenderTarget_.setSize([Math.floor(e.size[0]/2),Math.floor(e.size[1]/2)]),this.helper.useProgram(this.hitProgram_,e),this.helper.prepareDrawToRenderTarget(e,this.hitRenderTarget_,!0),this.helper.bindBuffer(this.hitVerticesBuffer_),this.helper.bindBuffer(this.indicesBuffer_),this.helper.enableAttributes(this.hitDetectionAttributes);do{this.helper.makeProjectionTransform(e,this.currentTransform_),(0,q.Iu)(this.currentTransform_,s*n,0),(0,q.Jp)(this.currentTransform_,this.invertRenderTransform_),this.helper.applyUniforms(e);const o=this.indicesBuffer_.getSize();this.helper.drawElements(0,o)}while(++s<i)}disposeInternal(){this.worker_.terminate(),this.layer_=null,this.sourceListenKeys_.forEach(function(e){(0,Je.bN)(e)}),this.sourceListenKeys_=null,super.disposeInternal()}}const gc=fc,It={BLUR:"blur",GRADIENT:"gradient",RADIUS:"radius"},mc=["#00f","#0ff","#0f0","#ff0","#f00"];class _c extends fs{constructor(e){e=e||{};const t=Object.assign({},e);delete t.gradient,delete t.radius,delete t.blur,delete t.weight,super(t),this.gradient_=null,this.addChangeListener(It.GRADIENT,this.handleGradientChanged_),this.setGradient(e.gradient?e.gradient:mc),this.setBlur(e.blur!==void 0?e.blur:15),this.setRadius(e.radius!==void 0?e.radius:8);const i=e.weight?e.weight:"weight";typeof i=="string"?this.weightFunction_=function(n){return n.get(i)}:this.weightFunction_=i,this.setRenderOrder(null)}getBlur(){return this.get(It.BLUR)}getGradient(){return this.get(It.GRADIENT)}getRadius(){return this.get(It.RADIUS)}handleGradientChanged_(){this.gradient_=pc(this.getGradient())}setBlur(e){this.set(It.BLUR,e)}setGradient(e){this.set(It.GRADIENT,e)}setRadius(e){this.set(It.RADIUS,e)}createRenderer(){return new gc(this,{className:this.getClassName(),attributes:[{name:"weight",callback:e=>{const t=this.weightFunction_(e);return t!==void 0?(0,Ee.uZ)(t,0,1):1}}],vertexShader:`
        precision mediump float;
        uniform mat4 u_projectionMatrix;
        uniform mat4 u_offsetScaleMatrix;
        uniform float u_size;
        attribute vec2 a_position;
        attribute float a_index;
        attribute float a_weight;

        varying vec2 v_texCoord;
        varying float v_weight;

        void main(void) {
          mat4 offsetMatrix = u_offsetScaleMatrix;
          float offsetX = a_index == 0.0 || a_index == 3.0 ? -u_size / 2.0 : u_size / 2.0;
          float offsetY = a_index == 0.0 || a_index == 1.0 ? -u_size / 2.0 : u_size / 2.0;
          vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);
          gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;
          float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;
          float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;
          v_texCoord = vec2(u, v);
          v_weight = a_weight;
        }`,fragmentShader:`
        precision mediump float;
        uniform float u_blurSlope;

        varying vec2 v_texCoord;
        varying float v_weight;

        void main(void) {
          vec2 texCoord = v_texCoord * 2.0 - vec2(1.0, 1.0);
          float sqRadius = texCoord.x * texCoord.x + texCoord.y * texCoord.y;
          float value = (1.0 - sqrt(sqRadius)) * u_blurSlope;
          float alpha = smoothstep(0.0, 1.0, value) * v_weight;
          gl_FragColor = vec4(alpha, alpha, alpha, alpha);
        }`,hitVertexShader:`
        precision mediump float;
        uniform mat4 u_projectionMatrix;
        uniform mat4 u_offsetScaleMatrix;
        uniform float u_size;
        attribute vec2 a_position;
        attribute float a_index;
        attribute float a_weight;
        attribute vec4 a_hitColor;

        varying vec2 v_texCoord;
        varying float v_weight;
        varying vec4 v_hitColor;

        void main(void) {
          mat4 offsetMatrix = u_offsetScaleMatrix;
          float offsetX = a_index == 0.0 || a_index == 3.0 ? -u_size / 2.0 : u_size / 2.0;
          float offsetY = a_index == 0.0 || a_index == 1.0 ? -u_size / 2.0 : u_size / 2.0;
          vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);
          gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;
          float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;
          float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;
          v_texCoord = vec2(u, v);
          v_hitColor = a_hitColor;
          v_weight = a_weight;
        }`,hitFragmentShader:`
        precision mediump float;
        uniform float u_blurSlope;

        varying vec2 v_texCoord;
        varying float v_weight;
        varying vec4 v_hitColor;

        void main(void) {
          vec2 texCoord = v_texCoord * 2.0 - vec2(1.0, 1.0);
          float sqRadius = texCoord.x * texCoord.x + texCoord.y * texCoord.y;
          float value = (1.0 - sqrt(sqRadius)) * u_blurSlope;
          float alpha = smoothstep(0.0, 1.0, value) * v_weight;
          if (alpha < 0.05) {
            discard;
          }

          gl_FragColor = v_hitColor;
        }`,uniforms:{u_size:()=>(this.get(It.RADIUS)+this.get(It.BLUR))*2,u_blurSlope:()=>this.get(It.RADIUS)/Math.max(1,this.get(It.BLUR))},postProcesses:[{fragmentShader:`
            precision mediump float;

            uniform sampler2D u_image;
            uniform sampler2D u_gradientTexture;
            uniform float u_opacity;

            varying vec2 v_texCoord;

            void main() {
              vec4 color = texture2D(u_image, v_texCoord);
              gl_FragColor.a = color.a * u_opacity;
              gl_FragColor.rgb = texture2D(u_gradientTexture, vec2(0.5, color.a)).rgb;
              gl_FragColor.rgb *= gl_FragColor.a;
            }`,uniforms:{u_gradientTexture:()=>this.gradient_,u_opacity:()=>this.getOpacity()}}]})}renderDeclutter(){}}function pc(r){const i=(0,ke.E4)(1,256),n=i.createLinearGradient(0,0,1,256),s=1/(r.length-1);for(let o=0,a=r.length;o<a;++o)n.addColorStop(o*s,r[o]);return i.fillStyle=n,i.fillRect(0,0,1,256),i.canvas}const xc=_c,Un={weight:{fixed:1,min:0,max:1},blur:15,radius:5},yc={id:"heatmap",name:"Heatmap",description:"Visualizes a heatmap of the data",isBaseMap:!1,showLocation:!0,create:async(r,e,t,i)=>{const n={...Un,...e.config},s=await(0,Zt.cJ)(e.location),o=new Dn(s),a="_weight",l=new xc({source:o,blur:n.blur,radius:n.radius,weight:h=>h.get(a)});return{init:()=>l,update:h=>{const c=h.series[0];if(!c)return;o.update(c);const u=(0,Mn.getScaledDimension)(c,n.weight);o.forEachFeature(f=>{const m=f.get("rowIndex");m!=null&&f.set(a,u.get(m))});let d=["#00f","#0ff","#0f0","#ff0","#f00"];const g=u.field??c.fields.find(f=>f.type===F.fS.number);if(g){const f=(0,Ur.fD)(g);f.isContinuous&&f.getColors&&(d=f.getColors(i))}l.setGradient(d)},registerOptionsUI:h=>{h.addCustomEditor({id:"config.weight",path:"config.weight",name:"Weight values",description:"Scale the distribution for each row",editor:ii.cL,settings:{min:0,max:1,hideRange:!0},defaultValue:{fixed:1,min:0,max:1}}).addSliderInput({path:"config.radius",description:"Configures the size of clusters",name:"Radius",defaultValue:Un.radius,settings:{min:1,max:50,step:1}}).addSliderInput({path:"config.blur",description:"Configures the amount of blur of clusters",name:"Blur",defaultValue:Un.blur,settings:{min:1,max:50,step:1}})}}},defaultOptions:Un},Ro={icon:"https://openlayers.org/en/latest/examples/data/icon.png"},vc={id:"last-point-tracker",name:"Icon at last point",description:"Show an icon at the last point",isBaseMap:!1,showLocation:!0,state:Li.BV.alpha,create:async(r,e,t,i)=>{const n=new tt.Z({}),s={...Ro,...e.config};n.setStyle(new ge({image:new xn({src:s.icon})}));const o=new _t({features:[n]}),a=new ze({source:o}),l=await(0,Zt.cJ)(e.location);return{init:()=>a,update:h=>{const c=h.series[0];if(c&&c.length){const u=(0,Zt.g6)(c,l);if(!u.field)return;n.setGeometry(u.field.values[c.length-1])}}}},defaultOptions:Ro};var Ec=S(98803),Xn=S(35225),wc=S(5680),xt=function(r,e){var t=r[0]-e[0],i=r[1]-e[1];return Math.sqrt(t*t+i*i)},ri=function(r,e){return r[0]==e[0]&&r[1]==e[1]},Du=function(r){return Cc(r.getGeometry())},Cc=function(r){switch(r.getType()){case"Point":return r.getCoordinates();case"MultiPolygon":r=r.getPolygon(0);case"Polygon":return r.getInteriorPoint().getCoordinates();default:return r.getClosestPoint(ol_extent_getCenter(r.getExtent()))}},Au=function(r,e){var t=[],i=r.length-1,n=i,s,o,a,l,h,c,u,d,g,f,m,_,v,w=ri(r[0],r[i]);w||(m=r[0],_=r[1],v=[m[0]+(_[1]-m[1])/xt(m,_)*e,m[1]-(_[0]-m[0])/xt(m,_)*e],t.push(v),r.push(r[i]),i++,n--);for(var E=0;E<n;E++)m=r[E],_=r[(E+1)%i],v=r[(E+2)%i],s=(_[1]-m[1])/(_[0]-m[0]),o=(v[1]-_[1])/(v[0]-_[0]),Math.abs(s-o)>1e-10&&(a=Math.sqrt((_[0]-m[0])*(_[0]-m[0])+(_[1]-m[1])*(_[1]-m[1])),l=Math.sqrt((v[0]-_[0])*(v[0]-_[0])+(v[1]-_[1])*(v[1]-_[1])),h=m[0]+e*(_[1]-m[1])/a,c=_[0]+e*(v[1]-_[1])/l,u=m[1]-e*(_[0]-m[0])/a,d=_[1]-e*(v[0]-_[0])/l,g=(o*c-s*h+u-d)/(o-s),f=(s*o*(c-h)+o*u-s*d)/(o-s),_[0]-m[0]==0&&(g=_[0]+e*(_[1]-m[1])/Math.abs(_[1]-m[1]),f=o*g-o*c+d),v[0]-_[0]==0&&(g=v[0]+e*(v[1]-_[1])/Math.abs(v[1]-_[1]),f=s*g-s*h+u),t.push([g,f]));return w?t.push(t[0]):(r.pop(),m=r[r.length-1],_=r[r.length-2],v=[m[0]-(_[1]-m[1])/xt(m,_)*e,m[1]+(_[0]-m[0])/xt(m,_)*e],t.push(v)),t},Ou=function(r,e){for(var t=0;t<e.length-1;t++){var i=e[t],n=e[t+1];if(ri(r,i)||ri(r,n))return{index:1,segment:[i,n]};var s=xt(i,n),o=[(n[0]-i[0])/s,(n[1]-i[1])/s],a=xt(i,r),l=[(r[0]-i[0])/a,(r[1]-i[1])/a];if(Math.abs(o[0]*l[1]-o[1]*l[0])<1e-10)return{index:1,segment:[i,n]}}return{index:-1}},ku=function(r,e,t){for(var i,n,s=[],o=0;o<r.length-1;o++)!r[o].length||!r[o+1].length||(r[o][1]<=e&&r[o+1][1]>e||r[o][1]>=e&&r[o+1][1]<e)&&(n=(e-r[o][1])/(r[o+1][1]-r[o][1]),i=n*(r[o+1][0]-r[o][0])+r[o][0],s.push({contour:t,index:o,pt:[i,e],abs:n}));s.sort(function(h,c){return h.pt[0]-c.pt[0]});for(var a=[],l=0;l<s.length-1;l+=2)a.push([s[l],s[l+1]]);return a},Bu=function(r,e){switch(r){case"LineString":return new ol_geom_LineString(e);case"LinearRing":return new ol_geom_LinearRing(e);case"MultiLineString":return new ol_geom_MultiLineString(e);case"MultiPoint":return new ol_geom_MultiPoint(e);case"MultiPolygon":return new ol_geom_MultiPolygon(e);case"Point":return new ol_geom_Point(e);case"Polygon":return new ol_geom_Polygon(e);default:return console.error("[createFromType] Unsupported type: "+r),null}},Gu=function(r,e){var t=r[1][0]-r[0][0],i=r[1][1]-r[0][1],n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=t*s-i*n;if(o!=0){var a=(t*r[0][1]-t*e[0][1]-i*r[0][0]+i*e[0][0])/o;return[e[0][0]+a*n,e[0][1]+a*s]}else return!1},bo;(function(){function r(t,i){var n;for(let s=t.length-1;s>0;s--)(t[s][0]>i&&t[s-1][0]<i||t[s][0]<i&&t[s-1][0]>i)&&(n=[i,(i-t[s][0])/(t[s-1][0]-t[s][0])*(t[s-1][1]-t[s][1])+t[s][1]],t.splice(s,0,n))}function e(t,i){var n;for(let s=t.length-1;s>0;s--)(t[s][1]>i&&t[s-1][1]<i||t[s][1]<i&&t[s-1][1]>i)&&(n=[(i-t[s][1])/(t[s-1][1]-t[s][1])*(t[s-1][0]-t[s][0])+t[s][0],i],t.splice(s,0,n))}bo=function(t,i){var n=i.getType()==="Polygon";if(!n&&i.getType()!=="MultiPolygon")return null;var s=i.getCoordinates();return n&&(s=[s]),s.forEach(function(o){o.forEach(function(a){r(a,t[0]),r(a,t[2]),e(a,t[1]),e(a,t[3])})}),s.forEach(function(o){o.forEach(function(a){a.forEach(function(l){l[0]<t[0]?l[0]=t[0]:l[0]>t[2]&&(l[0]=t[2]),l[1]<t[1]?l[1]=t[1]:l[1]>t[3]&&(l[1]=t[3])})})}),n?new Nt.ZP(s[0]):new Ci.Z(s)}})();var Vn=function(r,e,t,i){var n=[];i!==!1&&n.push(r);var s=xt(r,e);if(s){var o=Math.round(s/t);if(o>1)for(var a=(e[0]-r[0])/o,l=(e[1]-r[1])/o,h=1;h<o;h++)n.push([r[0]+a*h,r[1]+l*h])}return n.push(e),n};et.Z.prototype.sampleAt=function(r){for(var e=this.getCoordinates(),t=[],i=1;i<e.length;i++)t=t.concat(Vn(e[i-1],e[i],r,i===1));return new et.Z(t)},wn.Z.prototype.sampleAt=function(r){var e=this.getCoordinates(),t=[];return e.forEach(function(i){for(var n=[],s=1;s<i.length;s++)n=n.concat(Vn(i[s-1],i[s],r,s===1));t.push(n)}),new wn.Z(t)},Nt.ZP.prototype.sampleAt=function(r){var e=this.getCoordinates(),t=[];return e.forEach(function(i){for(var n=[],s=1;s<i.length;s++)n=n.concat(Vn(i[s-1],i[s],r,s===1));t.push(n)}),new Nt.ZP(t)},Ci.Z.prototype.sampleAt=function(r){var e=this.getCoordinates(),t=[];return e.forEach(function(i){var n=[];t.push(n),i.forEach(function(s){for(var o=[],a=1;a<s.length;a++)o=o.concat(Vn(s[a-1],s[a],r,a===1));n.push(o)})}),new Ci.Z(t)},Br.prototype.intersection=function(r,e){if(r.sampleAt){var t=(0,C.f3)(this.getCenter().concat(this.getCenter()),this.getRadius());r=bo(t,r),r=r.simplify(e);var i=this.getCenter(),n=this.getRadius(),s=r.sampleAt(e).getCoordinates();switch(r.getType()){case"Polygon":s=[s];case"MultiPolygon":{var o=!1,a=[];return s.forEach(function(l){var h=[];a.push(h),l.forEach(function(c){var u=[];h.push(u),c.forEach(function(d){var g=xt(i,d);g>n?(o=!0,u.push([i[0]+n/g*(d[0]-i[0]),i[1]+n/g*(d[1]-i[1])])):u.push(d)})})}),o?r.getType()==="Polygon"?new Nt.ZP(a[0]):new Ci.Z(a):r}}}else console.warn("[ol/geom/Circle~intersection] Unsupported geometry type: "+r.getType());return r},et.Z.prototype.splitAt=function(r,e){var t;if(!r)return[this];if(e||(e=1e-10),r.length&&r[0].length){var i=[this];for(t=0;t<r.length;t++){for(var n=[],s=0;s<i.length;s++){var o=i[s].splitAt(r[t],e);n=n.concat(o)}i=n}return i}if(ri(r,this.getFirstCoordinate())||ri(r,this.getLastCoordinate()))return[this];var a=this.getCoordinates(),l=[a[0]],h=[];for(t=0;t<a.length-1;t++)if(!ri(a[t],a[t+1])){if(ri(r,a[t+1]))l.push(a[t+1]),h.push(new et.Z(l)),l=[];else if(!ri(r,a[t])){var c,u,d=!1;a[t][0]==a[t+1][0]?(c=(a[t][1]-r[1])/(a[t][1]-a[t+1][1]),d=a[t][0]==r[0]&&0<c&&c<=1):a[t][1]==a[t+1][1]?(c=(a[t][0]-r[0])/(a[t][0]-a[t+1][0]),d=a[t][1]==r[1]&&0<c&&c<=1):(c=(a[t][0]-r[0])/(a[t][0]-a[t+1][0]),u=(a[t][1]-r[1])/(a[t][1]-a[t+1][1]),d=Math.abs(c-u)<=e&&0<c&&c<=1),d&&(l.push(r),h.push(new et.Z(l)),l=[r])}l.push(a[t+1])}return l.length>1&&h.push(new et.Z(l)),h.length?h:[this]};var Sc=class extends ge{constructor(e){e=e||{},super({stroke:e.stroke,text:e.text,zIndex:e.zIndex,geometry:e.geometry}),this.setRenderer(this._render.bind(this)),this._visible=e.visible!==!1,typeof e.width=="function"?this._widthFn=e.width:this.setWidth(e.width),this.setWidth2(e.width2),typeof e.color=="function"?this._colorFn=e.color:this.setColor(e.color),this.setColor2(e.color2),this.setLineCap(e.lineCap),this.setArrow(e.arrow),this.setArrowSize(e.arrowSize),this.setArrowColor(e.arrowColor),this._offset=[0,0],this.setOffset(e.offset0,0),this.setOffset(e.offset1,1),this._noOverlap=e.noOverlap}setWidth(e){this._width=e||0}setWidth2(e){this._width2=e}getOffset(e){return this._offset[e]}setOffset(e,t){switch(e=Math.max(0,parseFloat(e)),t){case 0:{this._offset[0]=e;break}case 1:{this._offset[1]=e;break}}}setLineCap(e){this._lineCap=e==="round"?"round":"butt"}getWidth(e,t){if(this._widthFn)return this._widthFn(e,t);var i=typeof this._width2=="number"?this._width2:this._width;return this._width+(i-this._width)*t}setColor(e){try{this._color=(0,mt._2)(e)}catch{this._color=[0,0,0,1]}}setColor2(e){try{this._color2=(0,mt._2)(e)}catch{this._color2=null}}setArrowColor(e){try{this._acolor=(0,mt.XC)(e)}catch{this._acolor=null}}getColor(e,t){if(this._colorFn)return(0,mt.XC)(this._colorFn(e,t));var i=this._color,n=this._color2||this._color;return"rgba("+ +Math.round(i[0]+(n[0]-i[0])*t)+","+Math.round(i[1]+(n[1]-i[1])*t)+","+Math.round(i[2]+(n[2]-i[2])*t)+","+(i[3]+(n[3]-i[3])*t)+")"}getArrow(){return this._arrow}setArrow(e){this._arrow=parseInt(e),(this._arrow<-1||this._arrow>2)&&(this._arrow=0)}getArrowSize(){return this._arrowSize||[16,16]}setArrowSize(e){Array.isArray(e)?this._arrowSize=e:typeof e=="number"&&(this._arrowSize=[e,e])}drawArrow(e,t,i,n,s){var o=this.getArrowSize()[0]*s,a=xt(t,i),l=(t[0]-i[0])/a,h=(t[1]-i[1])/a;n=Math.max(this.getArrowSize()[1]/2,n/2)*s,e.beginPath(),e.moveTo(t[0],t[1]),e.lineTo(t[0]-o*l+n*h,t[1]-o*h-n*l),e.lineTo(t[0]-o*l-n*h,t[1]-o*h+n*l),e.lineTo(t[0],t[1]),e.fill()}_render(e,t){if(t.geometry.getType()==="LineString"){var i,n,s,o=t.context;if(!this._visible){var a=t.pixelRatio/t.resolution,l=Math.cos(t.rotation),h=Math.sin(t.rotation);n=t.geometry.getCoordinates();var c=e[0][0]-n[0][0]*a*l-n[0][1]*a*h,u=e[0][1]-n[0][0]*a*h+n[0][1]*a*l;for(e=[],i=0;s=n[i];i++)e[i]=[c+s[0]*a*l+s[1]*a*h,u+s[0]*a*h-s[1]*a*l,s[2]]}var d=this.getArrowSize()[0]*t.pixelRatio;o.save(),this.getOffset(0)&&this._splitAsize(e,this.getOffset(0)*t.pixelRatio),this.getOffset(1)&&this._splitAsize(e,this.getOffset(1)*t.pixelRatio,!0),e.length>1&&(this.getArrow()===-1||this.getArrow()===2)&&(s=this._splitAsize(e,d),this._acolor?o.fillStyle=this._acolor:o.fillStyle=this.getColor(t.feature,0),this.drawArrow(o,s[0],s[1],this.getWidth(t.feature,0),t.pixelRatio)),e.length>1&&this.getArrow()>0&&(s=this._splitAsize(e,d,!0),this._acolor?o.fillStyle=this._acolor:o.fillStyle=this.getColor(t.feature,1),this.drawArrow(o,s[0],s[1],this.getWidth(t.feature,1),t.pixelRatio));var g=this._splitInto(e,255,2),f=0,m=g.length;if(o.lineJoin="round",o.lineCap=this._lineCap||"butt",g.length>1)for(f=0;f<g.length;f++){var _=f/m;for(n=g[f],o.lineWidth=this.getWidth(t.feature,_)*t.pixelRatio,o.strokeStyle=this.getColor(t.feature,_),o.beginPath(),o.moveTo(n[0][0],n[0][1]),i=1;s=n[i];i++)o.lineTo(s[0],s[1]);o.stroke()}o.restore()}}_splitAsize(e,t,i){var n,s,o,a,l=0;for(i?o=e.pop():o=e.shift(),n=o;e.length;){if(i?s=e.pop():s=e.shift(),a=xt(n,s),l+a>t){n=[n[0]+(s[0]-n[0])*(t-l)/a,n[1]+(s[1]-n[1])*(t-l)/a],a=xt(n,o),i?(e.push(s),e.push(n),e.push([n[0]+(o[0]-n[0])/a,n[1]+(o[1]-n[1])/a])):(e.unshift(s),e.unshift(n),e.unshift([n[0]+(o[0]-n[0])/a,n[1]+(o[1]-n[1])/a]));break}l+=a,n=s}return[o,n]}_splitInto(e,t,i){var n,s,o=this._noOverlap?1:.9,a=[],l,h=0;for(n=1;s=e[n];n++)h+=xt(e[n-1],s);var c=Math.max(i||2,h/(t||255)),u=e[0];h=0;var d=[u];for(n=1,s=e[1];n<e.length;){var g=s[0]-u[0],f=s[1]-u[1];if(l=Math.sqrt(g*g+f*f),h+l>c){var m=(c-h)/l;d.push([u[0]+g*m,u[1]+f*m]),a.push(d),u=[u[0]+g*m*o,u[1]+f*m*o],d=[u],h=0}else h+=l,u=s,d.push(u),n++,s=e[n]}return a.push(d),a}};const Tc=Sc,nn={style:{...V.Er,opacity:1,lineWidth:2},arrow:0},Lo="route",zu={type:Lo,name:"",config:nn,location:{mode:Ze.q1.Auto},tooltip:!1},Ic={id:Lo,name:"Route",description:"Render data points as a route",isBaseMap:!1,showLocation:!0,state:Li.BV.alpha,create:async(r,e,t,i)=>{const n={...nn,...e?.config},s=await gi(n.style),o=await(0,Zt.cJ)(e.location),a=new Dn(o),l=new ze({source:a}),h=n.arrow==1||n.arrow==-1;if(!s.fields&&!h){const _=Ts(s.base);s.config.size&&s.config.size.fixed&&_.getStroke().setWidth(s.config.size.fixed),l.setStyle(_)}else l.setStyle(_=>{const v=_.get("rowIndex"),w=s.dims;if(!w||!(0,y.isNumber)(v))return Ts(s.base);const E=[],L=_.getGeometry(),M=s.config.opacity??1;if(L instanceof $i.ZP){const O=L.getCoordinates();if(O){let z=0;const $=2;for(let K=0;K<O.length-1;K++){const he=O[z],ce=O[K+1],ie=(0,fe.Z)(i.visualization.getColorByName((w.color&&w.color.get(z))??s.base.color)).setAlpha(M).toString(),be=(0,fe.Z)(i.visualization.getColorByName((w.color&&w.color.get(K+1))??s.base.color)).setAlpha(M).toString(),ae=(w.size&&w.size.get(z))??s.base.size,j=(w.size&&w.size.get(K+1))??s.base.size,N=new Tc({visible:!0,lineCap:n.arrow==0?"round":"square",color:ie,color2:be,width:(w.size&&w.size.get(z))??s.base.size,width2:(w.size&&w.size.get(K+1))??s.base.size});if(n.arrow&&(N.setArrow(n.arrow),n.arrow>0?(N.setArrowColor(be),N.setArrowSize((j??0)*1.5)):(N.setArrowColor(ie),N.setArrowSize((ae??0)*1.5))),(0,lt.uH)(r,$,he,ce)){const H=new et.Z([he,ce]);N.setGeometry(H),E.push(N),z=K+1}}if(E.length===0){const K=new Bt.Z(O[0]),he=((w.size&&w.size.get(0))??s.base.size??10)/2,ce=(0,fe.Z)(i.visualization.getColorByName((w.color&&w.color.get(0))??s.base.color)).setAlpha(M).toString(),ie=new ge({image:new Ct({radius:he,fill:new Ie({color:ce})})});ie.setGeometry(K),E.push(ie)}}return E}const A={...s.base};return w.color&&(A.color=w.color.get(v)),Ts(A)});const c=new tt.Z({}),u=(s.base.lineWidth||6)+2,d=new ge({image:new Ct({radius:u,stroke:new Re({color:(0,wc.alpha)(s.base.color,.4),width:u+2}),fill:new Ie({color:s.base.color})})}),g=new ze({source:new _t({features:[c]}),style:d}),f=new Xn.Z({layers:[l,g]}),m=new Y.w0;return m.add(t.getStream(Q.es).pipe((0,Ec.p)(8)).subscribe({next:_=>{const w=a.getFeatures()[0]?.get("frame"),E=_.payload?.point?.time;if(w&&E){const L=w.fields.find(M=>M.name===F.Ls);if(L){const M=L.values,A=Rc(M,E);if(A!==null){const O=(0,Zt.g6)(w,o);O.field&&(c.setGeometry(O.field.values[A]),c.setStyle(d))}}}}})),m.add(t.subscribe(Q.xH,_=>{c.setStyle(new ge({}))})),{init:()=>f,dispose:()=>m.unsubscribe(),update:_=>{if(_.series?.length)for(const v of _.series){(s.fields||h)&&(s.dims=(0,lt.vV)(v,s,i)),a.updateLineString(v);break}},registerOptionsUI:_=>{_.addCustomEditor({id:"config.style",path:"config.style",name:"Style",editor:bi,settings:{simpleFixedValues:!1},defaultValue:nn.style}).addRadio({path:"config.arrow",name:"Arrow",settings:{options:[{label:"None",value:0},{label:"Forward",value:1},{label:"Reverse",value:-1}]},defaultValue:nn.arrow})}}},defaultOptions:nn};function Rc(r,e){if(r.length===0)return null;if(r.length===1)return 0;const t=r.length-1;if(e<r[0])return 0;if(e>r[t])return t;const i=Math.abs(Math.round(t*(e-r[0])/(r[t]-r[0])));if(e<r[i]){for(let n=i;n>0;n--)if(e>r[n])return n;return 0}else{for(let n=i;n<t;n++)if(e<r[n])return n;return t}}var At=class extends _t{constructor(e){e=e||{},e.strategy=Fr,super(e),this.setLoader(this._loader),this.set("time",e.time||new Date),this.set("step",e.step||1)}static _sunEclipticPosition(e){var t=Math.PI/180,i=e-2451545,n=280.46+.9856474*i;n%=360;var s=357.528+.9856003*i;s%=360;var o=n+1.915*Math.sin(s*t)+.02*Math.sin(2*s*t),a=1.00014-.01671*Math.cos(s*t)-.0014*Math.cos(2*s*t);return{lambda:o,R:a}}static _eclipticObliquity(e){var t=e-2451545,i=t/36525,n=23.43929111-i*(46.836769/3600-i*(1831e-7/3600+i*(.0020034/3600-i*(576e-9/3600-i*434e-10/3600))));return n}static _sunEquatorialPosition(e,t){var i=180/Math.PI,n=Math.PI/180,s=Math.atan(Math.cos(t*n)*Math.tan(e*n))*i,o=Math.asin(Math.sin(t*n)*Math.sin(e*n))*i,a=Math.floor(e/90)*90,l=Math.floor(s/90)*90;return s=s+(a-l),{alpha:s,delta:o}}static getNightLat(e,t){var i=180/Math.PI,n=Math.PI/180,s=t?new Date(t):new Date,o=s/864e5+24405875e-1,a=(18.697374558+24.06570982441908*(o-2451545))%24,l=At._sunEclipticPosition(o),h=At._eclipticObliquity(o),c=At._sunEquatorialPosition(l.lambda,h),u=a*15+e-c.alpha,d=Math.atan(-Math.cos(u*n)/Math.tan(c.delta*n))*i;return d}_loader(e,t,i){var n=this.getCoordinates(this.get("time")),s=new Nt.ZP([n]);s.transform("EPSG:4326",i),this.addFeature(new tt.Z(s))}setTime(e){this.set("time",e),this.refresh()}getSunPosition(e){var t=e?new Date(e):new Date,i=t/864e5+24405875e-1,n=(18.697374558+24.06570982441908*(i-2451545))%24,s=At._sunEclipticPosition(i),o=At._eclipticObliquity(i),a=At._sunEquatorialPosition(s.lambda,o);return[a.alpha-n*15,a.delta]}getCoordinates(e,t){for(var i=180/Math.PI,n=Math.PI/180,s=e?new Date(e):new Date,o=s/864e5+24405875e-1,a=(18.697374558+24.06570982441908*(o-2451545))%24,l=[],h=At._sunEclipticPosition(o),c=At._eclipticObliquity(o),u=At._sunEquatorialPosition(h.lambda,c),d=this.get("step")||1,g=-180;g<=180;g+=d){var f=g,m=a*15+f-u.alpha,_=Math.atan(-Math.cos(m*n)/Math.tan(u.delta*n))*i;l.push([f,_])}switch(t){case"line":break;case"day":u.delta*=-1;default:{_=u.delta<0?90:-90;for(var v=180;v>=-180;v-=d)l.push([v,_]);l.push(l[0]);break}}if(t==="daynight"){var w=[];l.forEach(function(E){w.push(E.slice())}),w[0][1]=-w[0][1],w[w.length-1][1]=-w[0][1],w[w.length-1][1]=-w[0][1],l=[l,w]}return l}};const Fo=At;var bc=(r=>(r.From="from",r.To="to",r))(bc||{});const mi={show:"to",sun:!1,nightColor:"#a7a6ba4D"},Mo="dayNight",Wu={type:Mo,name:"",config:mi,tooltip:!0},Lc={id:Mo,name:"Night / Day",description:"Show day and night regions",isBaseMap:!1,create:async(r,e,t,i)=>{const n={...mi,...e?.config},s=new Fo({}),o=Object.getPrototypeOf(s),a=new Fo({}),l=Object.getPrototypeOf(a),h=new ze({source:s,style:new ge({fill:new Ie({color:i.visualization.getColorByName(n.nightColor)})})}),c=new ze({source:new _t({features:[]}),style:new ge({stroke:new Re({color:"#607D8B",width:1.5,lineDash:[2,3]})})}),u=new tt.Z({geometry:new Bt.Z([])}),d=new ze({source:new _t({features:[u]}),style:new ge({image:new Ct({radius:13,fill:new Ie({color:"rgb(253,184,19)"})})})}),g=new tt.Z({geometry:new Bt.Z([])}),f=new ge({image:new Ct({radius:13,stroke:new Re({color:"rgb(253,184,19)",width:1.5})})}),m=new ge({image:new Ct({radius:15,stroke:new Re({color:"#607D8B",width:1.5,lineDash:[2,3]})})}),_=new ze({source:new _t({features:[g]}),style:[m,f]}),v=new Xn.Z({layers:n.sun?[h,d,_,c]:[h,c]}),w=new Y.w0;return{init:()=>v,dispose:()=>w.unsubscribe(),update:E=>{const L=new Date(E.timeRange.from.valueOf()),M=new Date(E.timeRange.to.valueOf());let A=new Date,O=[];n.show==="from"?A=L:A=M,s.setTime(A),n.sun&&(O=o.getSunPosition(A),u.getGeometry()?.setCoordinates((0,U.mi)(O)))},registerOptionsUI:E=>{e.config?.nightColor||(e.config={...mi,...e.config}),E.addRadio({path:"config.show",name:"Show",settings:{options:[{label:"From",value:"from"},{label:"To",value:"to"}]},defaultValue:mi.show}),E.addColorPicker({path:"config.nightColor",name:"Night region color",description:"Pick color of night region",defaultValue:mi.nightColor,settings:[{enableNamedColors:!1}]}),E.addBooleanSwitch({path:"config.sun",name:"Display sun",description:"Show the sun",defaultValue:mi.sun})}}},defaultOptions:mi},sn={src:"public/maps/countries.geojson",rules:[],style:V.Er,dataStyle:{}},Nu={style:V.Er,check:{property:"",operation:Ze.Bd.EQ,value:""}},Fc={id:"dynamic-geojson",name:"Dynamic GeoJSON",description:"Style a geojson file based on query results",isBaseMap:!1,state:Li.BV.alpha,create:async(r,e,t,i)=>{const n={...sn,...e.config},s=new _t({url:n.src,format:new fo.Z}),o=new ws.t,a=s.on("change",()=>{s.getState()=="ready"&&((0,gs.B)(a),o.next(s.getFeatures()))}),l=[];if(n.rules){for(const d of n.rules)if(d.style){const g=await gi(d.style);l.push({state:g,rule:d.check})}}{const d=await gi(n.style);l.push({state:d})}const h=await gi(n.style),c=new Map,u=new ze({source:s,style:d=>{const g=c.get(d.getId()),f=h.dims;if(g&&f)return new ge({fill:new Ie({color:f.color?.get(g)}),stroke:new Re({color:h.base.color,width:h.base.lineWidth??1})});const m=d.getGeometry()?.getType()==="Point";for(const _ of l)if(!(_.rule&&!go(_.rule,d))){if(_.state.fields){const v={..._.state.base},{text:w}=_.state.fields;return w&&(v.text=`${d.get(w)}`),m?_.state.maker(v):Pn(v)}return m?(_.point||(_.point=_.state.maker(_.state.base)),_.point):(_.poly||(_.poly=Pn(_.state.base)),_.poly)}}});return{init:()=>u,update:d=>{const g=d.series[0];if(g){const f=(0,Mn.findField)(g,n.idField);f&&(c.clear(),f.values.forEach((m,_)=>c.set(m,_))),h.dims=(0,lt.vV)(g,h,i,n.dataStyle)}u.changed()},registerOptionsUI:d=>{const g=o.pipe((0,xo.P)(),(0,yo.U)(f=>_o(f)));d.addSelect({path:"config.src",name:"GeoJSON URL",settings:{options:(0,lt.B1)()??[],allowCustomValue:!0},defaultValue:sn.src}).addFieldNamePicker({path:"config.idField",name:"ID Field"}).addCustomEditor({id:"config.dataStyle",path:"config.dataStyle",name:"Data style",editor:bi,settings:{displayRotation:!1},defaultValue:sn.dataStyle}).addCustomEditor({id:"config.style",path:"config.style",name:"Default style",description:"The style to apply when no rules above match",editor:bi,settings:{simpleFixedValues:!0,layerInfo:g},defaultValue:sn.style})}}},defaultOptions:sn};var Po=class extends He{constructor(e){e=e||{},e.displacement||(e.displacement=[e.offsetX||0,-e.offsetY||0]);var t=e.kind==="anchored"?8:0,i=Number(e.shadow)||0;e.stroke||(e.stroke=new Re({width:0,color:"#000"}));var n=e.stroke.getWidth();if(n<0&&(n=0),e.kind=="folio"&&(n+=6),e.stroke.setWidth(n),super({radius:e.radius+n+t/2+i/2,points:0,displacement:[e.displacement[0]||0,(e.displacement[1]||0)+t],fill:He.prototype.render?new Ie({color:[0,0,0,0]}):null}),this.sanchor_=t,this._shadow=i,!this.getHitDetectionImage){var s=super.getImage.call(this);if(!this.hitDetectionCanvas_){for(var o in this)if(this[o]&&this[o].getContext&&this[o]!==s){this.hitDetectionCanvas_=this[o];break}}this.hitDetectionCanvas_=document.createElement("canvas"),this.hitDetectionCanvas_.width=s.width,this.hitDetectionCanvas_.height=s.height;var a=this.hitDetectionCanvas_;this.getHitDetectionImage=function(){return a}}this._stroke=e.stroke,this._fill=e.fill,this._crop=e.crop,this._crossOrigin=e.crossOrigin,this._kind=e.kind||"default",this._radius=e.radius,this._src=e.src,this._offset=[e.offsetX?e.offsetX:0,e.offsetY?e.offsetY:0],this._onload=e.onload,this._onerror=e.onerror,typeof e.opacity=="number"&&this.setOpacity(e.opacity),typeof e.rotation=="number"&&this.setRotation(e.rotation),this.getImage()}setOffset(e){this._offset=[e[0]||0,e[1]||0],this.getImage()}clone(){var e=new Po({stroke:this._stroke,fill:this._fill,shadow:this._shadow,crop:this._crop,crossOrigin:this._crossOrigin,kind:this._kind,radius:this._radius,src:this._src,offsetX:this._offset[0],offsetY:this._offset[1],opacity:this.getOpacity(),rotation:this.getRotation()});return e.getImage(),e}drawBack_(e,t,i,n){var s=this._shadow,o=e.canvas;e.beginPath(),e.fillStyle=t,e.clearRect(0,0,o.width,o.height);var a=o.width/n,l=o.height/n;switch(this._kind){case"square":{e.rect(0,0,a-s,l-s);break}case"circle":{e.arc(this._radius+i,this._radius+i,this._radius+i,0,2*Math.PI,!1);break}case"folio":{var h=6;i-=h,e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=1;var c=a-s-2*h,u=Math.atan(6/c);e.save(),e.rotate(-u),e.translate(-6,2),e.beginPath(),e.rect(h,h,c,c),e.stroke(),e.fill(),e.restore(),e.save(),e.translate(6,-1),e.rotate(u),e.beginPath(),e.rect(h,h,c,c),e.stroke(),e.fill(),e.restore(),e.beginPath(),e.rect(h,h,c,c),e.stroke();break}case"anchored":{e.roundRect(this.sanchor_/2,0,a-this.sanchor_-s,l-this.sanchor_-s,i),e.moveTo(a/2-this.sanchor_-s/2,l-this.sanchor_-s),e.lineTo(a/2+this.sanchor_-s/2,l-this.sanchor_-s),e.lineTo(a/2-s/2,l-s);break}default:{e.roundRect(0,0,a-s,l-s,i);break}}e.closePath()}getImage(e){e=e||1;var t=He.prototype.getImage.call(this,e);if(this._gethit||this.img_)return t;var i,n=0;this._stroke&&(i=(0,mt.XC)(this._stroke.getColor()),n=this._stroke.getWidth()),this._gethit=!0;var s=this.getHitDetectionImage().getContext("2d");s.save(),s.setTransform(1,0,0,1,0,0),this.drawBack_(s,"#000",n,1),s.fill(),s.restore(),this._gethit=!1,s=t.getContext("2d"),s.save(),s.setTransform(e,0,0,e,0,0),this.drawBack_(s,i,n,e),this._shadow&&(s.shadowColor="rgba(0,0,0,0.5)",s.shadowBlur=e*this._shadow/2,s.shadowOffsetX=e*this._shadow/2,s.shadowOffsetY=e*this._shadow/2),s.fill(),s.restore();var o=this,a=this.img_=new Image;if(this._crossOrigin&&(a.crossOrigin=this._crossOrigin),a.src=this._src,a.width?o.drawImage_(t,a,e):(a.onload=function(){o.drawImage_(t,a,e),o._onload&&o._onload()},o._onerror&&(a.onerror=function(){o._onerror()})),!this.getDisplacement){var l=this.getAnchor();l[0]=(t.width/e-this._shadow)/2-this._offset[0],this.sanchor_?l[1]=t.height/e-this._shadow-this._offset[1]:l[1]=(t.height/e-this._shadow)/2-this._offset[1]}return t}getPhoto(){return this.img_}drawImage_(e,t,i){var n=e.getContext("2d"),s=0;this._stroke&&(s=this._stroke.getWidth());var o=2*this._radius;n.save(),He.prototype.render&&n.setTransform(i,0,0,i,0,0),this._kind=="circle"&&(n.beginPath(),n.arc(this._radius+s,this._radius+s,this._radius,0,2*Math.PI,!1),n.clip());var a,l,h,c,u,d,g,f,m;this._crop?(a=Math.min(t.width/o,t.height/o),f=m=a*o,d=(t.width-f)/2,g=(t.height-m)/2,l=h=0,c=u=o+1):(a=Math.min(o/t.width,o/t.height),d=g=0,f=t.width,m=t.height,c=a*f,u=a*m,l=(o-c)/2,h=(o-u)/2),l+=s+this.sanchor_/2,h+=s,n.drawImage(t,d,g,f,m,l,h,c,u),this._kind=="circle"&&s&&(n.beginPath(),n.strokeStyle=(0,mt.XC)(this._stroke.getColor()),n.lineWidth=s/4,n.arc(this._radius+s,this._radius+s,this._radius,0,2*Math.PI,!1),n.stroke()),n.restore()}};CanvasRenderingContext2D.prototype.roundRect=function(r,e,t,i,n){return n?(t<2*n&&(n=t/2),i<2*n&&(n=i/2),this.beginPath(),this.moveTo(r+n,e),this.arcTo(r+t,e,r+t,e+i,n),this.arcTo(r+t,e+i,r,e+i,n),this.arcTo(r,e+i,r,e,n),this.arcTo(r,e,r+t,e,n),this.closePath()):this.rect(r,e,t,i),this};const Ks=Po,Ut={kind:"square",border:2,shadow:!0,crop:!0,radius:20,color:"rgb(200, 200, 200)"},Do="photos",Zu={type:Do,name:"",config:Ut,location:{mode:Ze.q1.Auto},tooltip:!0},$s="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBjbGFzcz0iY3NzLWV5eDRkbyI+PHBhdGggZD0iTTExLjI5LDE1LjI5YTEuNTgsMS41OCwwLDAsMC0uMTIuMTUuNzYuNzYsMCwwLDAtLjA5LjE4LjY0LjY0LDAsMCwwLS4wNi4xOCwxLjM2LDEuMzYsMCwwLDAsMCwuMi44NC44NCwwLDAsMCwuMDguMzguOS45LDAsMCwwLC41NC41NC45NC45NCwwLDAsMCwuNzYsMCwuOS45LDAsMCwwLC41NC0uNTRBMSwxLDAsMCwwLDEzLDE2YTEsMSwwLDAsMC0uMjktLjcxQTEsMSwwLDAsMCwxMS4yOSwxNS4yOVpNMTIsMkExMCwxMCwwLDEsMCwyMiwxMiwxMCwxMCwwLDAsMCwxMiwyWm0wLDE4YTgsOCwwLDEsMSw4LThBOCw4LDAsMCwxLDEyLDIwWk0xMiw3QTMsMywwLDAsMCw5LjQsOC41YTEsMSwwLDEsMCwxLjczLDFBMSwxLDAsMCwxLDEyLDlhMSwxLDAsMCwxLDAsMiwxLDEsMCwwLDAtMSwxdjFhMSwxLDAsMCwwLDIsMHYtLjE4QTMsMywwLDAsMCwxMiw3WiI+PC9wYXRoPjwvc3ZnPgo=",Mc="data:image/svg+xml;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==";let rn=[];const Pc={id:Do,name:"Photos",description:"Render photos at each data point",isBaseMap:!1,showLocation:!0,hideOpacity:!0,state:Li.BV.alpha,create:async(r,e,t,i)=>{const n={...Ut,...e?.config},s=await(0,Zt.cJ)(e.location),o=new Dn(s),a=new ze({source:o});let l=[];return a.setStyle(h=>{let c=$s,u=1/0;l.length>0&&(u=h.get("rowIndex"),c=l[u]??$s);const d=new ge({image:new Ks({src:c,radius:n.radius,crop:n.crop,kind:n.kind,shadow:!1,stroke:new Re({width:0,color:"rgba(0,0,0,0)"}),onload:()=>{a.changed(),rn&&!rn.includes(u)&&rn.push(u)}})}),g=new ge({image:new Ks({src:Mc,radius:n.radius,crop:!1,kind:n.kind,shadow:n.shadow,stroke:new Re({width:n.border??0,color:i.visualization.getColorByName(n.color)}),onload:()=>{a.changed()}})}),f=new ge({image:new Ks({src:$s,radius:n.radius,crop:!1,kind:n.kind,shadow:!1,stroke:new Re({width:0,color:"rgba(0,0,0,0)"}),onload:()=>{a.changed()}})});return rn&&rn.includes(u)?[g,d]:[g,f,d]}),{init:()=>a,update:h=>{if(!h.series?.length){o.clear();return}for(const c of h.series){if(o.update(c),n.src){const u=(0,Mn.findField)(c,n.src);u&&(l=u?.values)}else for(let u=0;u<c.fields.length;u++){const d=c.fields[u];if(d.type===F.fS.string){l=d.values;break}}break}},registerOptionsUI:h=>{h.addFieldNamePicker({path:"config.src",name:"Image Source field",settings:{filter:c=>c.type===F.fS.string,noFieldsMessage:"No string fields found"}}).addRadio({path:"config.kind",name:"Kind",settings:{options:[{label:"Square",value:"square"},{label:"Circle",value:"circle"},{label:"Anchored",value:"anchored"},{label:"Folio",value:"folio"}]},defaultValue:Ut.kind}).addBooleanSwitch({path:"config.crop",name:"Crop",settings:{},defaultValue:Ut.crop}).addBooleanSwitch({path:"config.shadow",name:"Shadow",settings:{},defaultValue:Ut.shadow}).addSliderInput({path:"config.border",name:"Border",settings:{min:0,max:10},defaultValue:Ut.border}).addColorPicker({path:"config.color",name:"Border color",defaultValue:Ut.color,settings:[{enableNamedColors:!1}]}).addSliderInput({path:"config.radius",name:"Radius",settings:{min:1,max:100},defaultValue:Ut.radius})}}},defaultOptions:Ut},Ao=[zl,yc,vc,zh,Fc,Lc,Ic,Pc],Ai={type:"default",name:"",config:{}},Oo={id:Ai.type,name:"Default base layer",isBaseMap:!0,create:(r,e,t,i)=>{const n=di.vc?.geomapDefaultBaseLayerConfig?.type;if(n){const s=on.getIfExists(n);if(!s)throw new Error("Invalid basemap configuration on server");return s.create(r,di.vc.geomapDefaultBaseLayerConfig,t,i)}return lo.create(r,e,t,i)}},on=new Fn.B(()=>[Oo,...zs,...Ao]);function ko(r,e){const t={options:[],current:[]},i=[];for(const n of r){const s={label:n.name,value:n.id,description:n.description};if(n.state===Li.BV.alpha){if(!di.Oh)continue;s.label=`${n.name} (Alpha)`,s.icon="bolt",i.push(s)}else t.options.push(s);n.id===e&&t.current.push(s)}for(const n of i)t.options.push(n);return t}function Bo(r,e){return ko(r?[Oo,...zs]:[...Ao,...zs],e)}const Uu={layers:[]},Go={allLayers:!0,id:"zero",lat:0,lon:0,zoom:1};var Oi=(r=>(r.Details="details",r.None="none",r))(Oi||{}),Dc=(r=>(r.Coords="coords",r.Fit="fit",r.Zero="zero",r))(Dc||{}),Ac=S(91017),zo=S(50035);const Js=(r,e,t)=>{if(r.update){let i=t;if(e.filterData){const n=(0,zo.b9)(e.filterData);i={...i,series:i.series.filter(n)}}r.update(i)}};async function Oc(r,e,t){if(!r.map)return!1;const i=r.byName.get(e);if(!i)return!1;let n=-1;const s=r.map?.getLayers();for(let a=0;a<s?.getLength();a++)if(s.item(a)===i.layer){n=a;break}if(t.name!==e){if(!t.name)t.name=e;else if(r.byName.has(t.name))return!1;r.byName.delete(e),e=t.name,r.byName.set(e,i)}i.options.type,t.type;const o=r.layers.slice(0);try{const a=await Yn(r,r.map,t,i.isBasemap);o[n]?.handler.dispose?.(),o[n]=a,s.setAt(n,a.layer),Js(a.handler,t,r.props.data)}catch(a){return console.warn("ERROR",a),!1}return r.setState({legends:[]}),r.layers=o,r.doOptionsUpdate(n),!0}async function Yn(r,e,t,i){i&&(!t?.type||Xe.v.geomapDisableCustomBaseLayer)&&(t=Ai),t?.type||(t={type:Rs,name:(0,lt.FB)(r),config:{}});const n=on.getIfExists(t.type);if(!n)return Promise.reject("unknown layer: "+t.type);t.config?.attribution&&(t.config.attribution=Vr.QX.sanitizeTextPanelContent(t.config.attribution));const s=await n.create(e,t,r.props.eventBus,Xe.v.theme2),o=s.init();t.opacity!=null&&o.setOpacity(t.opacity),t.name||(t.name=(0,lt.FB)(r));const a=t.name,l={isBasemap:i,options:t,layer:o,handler:s,mouseEvents:new Ac.x,getName:()=>a,onChange:h=>{Oc(r,a,h)}};return r.byName.set(a,l),l.layer.__state=l,Js(s,t,r.props.data),l}const Wo=r=>r?.__state,kc=r=>({selectLayer:t=>{const i=r.layers.findIndex(n=>n.options.name===t);r.panelContext&&r.panelContext.onInstanceStateChange&&r.panelContext.onInstanceStateChange({map:r.map,layers:r.layers,selected:i,actions:r.actions})},canRename:t=>!r.byName.has(t),deleteLayer:t=>{const i=[];for(const n of r.layers)n.options.name===t?r.map?.removeLayer(n.layer):i.push(n);r.layers=i,r.doOptionsUpdate(0)},addlayer:t=>{const i=on.getIfExists(t);i&&Yn(r,r.map,{type:i.id,name:(0,lt.FB)(r),config:(0,y.cloneDeep)(i.defaultOptions),location:i.showLocation?{mode:Ze.q1.Auto}:void 0,tooltip:!0,...!i.hideOpacity&&{opacity:V.Er.opacity}},!1).then(n=>{r.layers=r.layers.slice(0),r.layers.push(n),r.map?.addLayer(n.layer),r.doOptionsUpdate(r.layers.length-1)})},reorder:(t,i)=>{const n=Array.from(r.layers),[s]=n.splice(t,1);n.splice(i,0,s),r.layers=n,r.doOptionsUpdate(i);const o=r.map?.getLayers();o.clear(),r.layers.forEach(a=>o.push(a.layer))}});function Bc(r=[],e=!1,t=!1,i){return r.filter(n=>n.layer instanceof ze||n.layer instanceof Xn.Z).flatMap(n=>{const s=n.layer;if(s instanceof Xn.Z)return Gc(s);if(s instanceof ze){if(e)return[s.getSource().getExtent()];if(t&&i===n.options.name){const o=s.getSource().getFeatures(),l=o[o.length-1]?.getGeometry();return l?[l.getExtent()]:[]}else if(!t&&i===n.options.name)return[s.getSource().getExtent()];return[]}else return[]}).reduce(C.l7,(0,C.lJ)())}function Gc(r){return r.getLayers().getArray().filter(e=>e instanceof ze).map(e=>e instanceof ze?e.getSource().getExtent()??[]:[])}const zc=r=>{r.map?.on("singleclick",r.pointerClickListener),r.map?.on("pointermove",(0,y.debounce)(r.pointerMoveListener,200)),r.map?.getViewport().addEventListener("mouseout",e=>{r.props.eventBus.publish(new Q.xH)})},Wc=(r,e)=>{No(r,e)&&(r.preventDefault(),r.stopPropagation(),e.mapDiv.style.cursor="auto",e.setState({ttipOpen:!0}))},No=(r,e)=>{if(e.state.measureMenuActive)return!0;if(!e.map||e.state.ttipOpen&&e.state?.ttip?.layers?.length)return!1;const t=r.originalEvent,i=e.map.getEventPixel(t),n=(0,U.bU)(e.map.getCoordinateFromPixel(i)),{hoverPayload:s}=e;s.pageX=t.pageX,s.pageY=t.pageY,s.point={lat:n[1],lon:n[0]},s.data=void 0,s.columnIndex=void 0,s.rowIndex=void 0,s.layers=void 0;const o=[],a=new Map;let l={};e.map.forEachFeatureAtPixel(i,(c,u,d)=>{const g=Wo(u);if(!s.data){const f=c.getProperties(),m=f.frame;m&&(s.data=l.data=m,s.rowIndex=l.rowIndex=f.rowIndex),g?.mouseEvents&&g.mouseEvents.next(c)}if(g){let f=a.get(g);f||(f={layer:g,features:[]},a.set(g,f),o.push(f)),f.features.push(c)}},{layerFilter:c=>Wo(c)?.options?.tooltip!==!1}),e.hoverPayload.layers=o.length?o:void 0,e.props.eventBus.publish(e.hoverEvent),(e.state.ttip===void 0||e.state.ttip?.layers!==s.layers||s.layers)&&e.setState({ttip:{...s}}),o.length||e.layers.forEach(c=>{c.mouseEvents.next(void 0)});const h=Boolean(o.length);return e.mapDiv.style.cursor=h?"pointer":"auto",h};var yt=(r=>(r.Zero="zero",r.Coordinates="coords",r.Fit="fit",r))(yt||{});const an=new Fn.B(()=>[{id:"fit",name:"Fit to data",zoom:15},{id:"zero",name:"(0\xB0, 0\xB0)",lat:0,lon:0},{id:"coords",name:"Coordinates"},{id:"north-america",name:"North America",lat:40,lon:-100,zoom:4},{id:"south-america",name:"South America",lat:-20,lon:-60,zoom:3},{id:"europe",name:"Europe",lat:46,lon:14,zoom:4},{id:"africa",name:"Africa",lat:0,lon:30,zoom:3},{id:"west-asia",name:"West Asia",lat:26,lon:53,zoom:4},{id:"s-asia",name:"South Asia",lat:19.5,lon:80,zoom:4},{id:"se-asia",name:"South-East Asia",lat:10,lon:106,zoom:4},{id:"e-asia",name:"East Asia",lat:33,lon:120,zoom:4},{id:"australia",name:"Australia",lat:-25,lon:135,zoom:4},{id:"oceania",name:"Oceania",lat:-10,lon:-140,zoom:3}]);let Zo;class Uo extends p.Component{constructor(e){super(e),this.panelContext=void 0,this.subs=new Y.w0,this.globalCSS=wl(Xe.v.theme2),this.hoverPayload={point:{},pageX:-1,pageY:-1},this.hoverEvent=new Q.es(this.hoverPayload),this.layers=[],this.byName=new Map,this.actions=kc(this),this.initMapRef=async t=>{if(!t)return;this.mapDiv=t,this.map&&this.map.dispose();const{options:i}=this.props,n=(0,lt.n_)(this,i,t);this.byName.clear();const s=[];try{s.push(await Yn(this,n,i.basemap??Ai,!0)),i.layers||(i.layers=[bs]);for(const o of i.layers)s.push(await Yn(this,n,o,!1))}catch(o){console.error("error loading layers",o)}for(const o of s)n.addLayer(o.layer);this.layers=s,this.map=n,this.initViewExtent(n.getView(),i.view),this.mouseWheelZoom=new X.Z,this.map?.addInteraction(this.mouseWheelZoom),(0,lt.sA)(this,i),zc(this),(0,lt.gE)(this,s,s.length-1),this.setState({legends:this.getLegends()})},this.clearTooltip=()=>{this.state.ttip&&!this.state.ttipOpen&&this.tooltipPopupClosed()},this.tooltipPopupClosed=()=>{this.setState({ttipOpen:!1,ttip:void 0})},this.pointerClickListener=t=>{Wc(t,this)},this.pointerMoveListener=t=>{No(t,this)},this.initMapView=(t,i)=>{let n=new Lt.ZP({center:[0,0],zoom:1,showFullExtent:!0});return t.shared&&(i?n=i:i=n),this.initViewExtent(n,t),[i,n]},this.state={ttipOpen:!1,legends:[]},this.subs.add(this.props.eventBus.subscribe(le.Yr,t=>{this.mapDiv&&this.props.id===t.payload&&this.initMapRef(this.mapDiv)}))}componentDidMount(){this.panelContext=this.context}componentWillUnmount(){this.subs.unsubscribe();for(const e of this.layers)e.handler.dispose?.();this.map?.dispose()}shouldComponentUpdate(e){return this.map&&((this.props.height!==e.height||this.props.width!==e.width)&&this.map.updateSize(),this.props.data!==e.data&&this.dataChanged(e.data),this.props.options!==e.options&&this.optionsChanged(e.options)),!0}componentDidUpdate(e){this.map&&(this.props.height!==e.height||this.props.width!==e.width)&&this.map.updateSize(),this.map&&this.props.data!==e.data&&this.dataChanged(this.props.data)}doOptionsUpdate(e){const{options:t,onOptionsChange:i}=this.props,n=this.layers;this.map?.getLayers().forEach(s=>{s instanceof Nr&&(this.map?.removeLayer(s),this.map?.addLayer(s))}),i({...t,basemap:n[0].options,layers:n.slice(1).map(s=>s.options)}),(0,lt.gE)(this,n,e),this.setState({legends:this.getLegends()})}optionsChanged(e){const t=this.props.options;if(e.view!==t.view){const[i,n]=this.initMapView(e.view,Zo);Zo=i,this.map&&n&&this.map.setView(n)}e.controls!==t.controls&&this.initControls(e.controls??{showZoom:!0,showAttribution:!0})}dataChanged(e){if(e===this.props.data)for(const i of this.layers)Js(i.handler,i.options,this.props.data);const t=an.getIfExists(this.props.options.view.id);if(t&&t.id===yt.Fit){const[,i]=this.initMapView(this.props.options.view);this.map&&i&&this.map.setView(i)}}initViewExtent(e,t){const i=an.getIfExists(t.id);if(i){let n;if(i.lat==null){if(i.id===yt.Coordinates)n=[t.lon??0,t.lat??0];else if(i.id===yt.Fit){const s=Bc(this.layers,t.allLayers,t.lastOnly,t.layer);if(!(0,C.xb)(s)){const o=t.padding??5,a=e.getResolutionForExtent(s,this.map?.getSize()),l=t.zoom??t.maxZoom;e.fit(s,{maxZoom:l}),e.setResolution(a*(o/100+1));const h=e.getZoom();h&&l&&h>l&&e.setZoom(l)}}}else n=[i.lon??0,i.lat??0];n&&e.setCenter((0,U.mi)(n))}t.maxZoom&&e.setMaxZoom(t.maxZoom),t.minZoom&&e.setMaxZoom(t.minZoom),t.zoom&&i?.id!==yt.Fit&&e.setZoom(t.zoom)}initControls(e){if(!this.map)return;this.map.getControls().clear(),e.showZoom&&this.map.addControl(new B.Z),e.showScale&&this.map.addControl(new k({units:e.scaleUnits,minWidth:100})),this.mouseWheelZoom.setActive(Boolean(e.mouseWheelZoom)),e.showAttribution&&this.map.addControl(new kt.Z({collapsed:!0,collapsible:!0}));let t=[];e.showMeasure&&(t=[p.createElement(vl,{key:"measure",map:this.map,menuActiveState:n=>{this.setState({ttipOpen:n,measureMenuActive:n})}})]);let i=[];e.showDebug&&(i=[p.createElement(ea,{key:"debug",map:this.map})]),this.setState({topRight1:t,topRight2:i})}getLegends(){const e=[];for(const t of this.layers)t.handler.legend&&e.push(p.createElement("div",{key:t.options.name},t.handler.legend));return e}render(){let{ttip:e,ttipOpen:t,topRight1:i,legends:n,topRight2:s}=this.state;const{options:o}=this.props,a=o.controls.showScale;return!t&&o.tooltip?.mode===Oi.None&&(e=void 0),p.createElement(p.Fragment,null,p.createElement(Ye.Global,{styles:this.globalCSS}),p.createElement("div",{className:Xo.wrap,onMouseLeave:this.clearTooltip},p.createElement("div",{className:Xo.map,ref:this.initMapRef}),p.createElement(me,{bottomLeft:n,topRight1:i,topRight2:s,blStyle:{bottom:a?"35px":"8px"}})),p.createElement(fn,{ttip:e,isOpen:t,onClose:this.tooltipPopupClosed}))}}Uo.contextType=de.bb;const Xo={wrap:ee.css`
    position: relative;
    width: 100%;
    height: 100%;
  `,map:ee.css`
    position: absolute;
    z-index: 0;
    width: 100%;
    height: 100%;
  `};var Nc=S(72243),qs=S(36826),Zc=S(39904),Uc=S(93022);const Xc="layer-drag-drop-list",Vo=({layers:r,getLayerInfo:e,onDragEnd:t,onSelect:i,onDelete:n,onDuplicate:s,showActions:o,selection:a,excludeBaseLayer:l,onNameChange:h,verifyLayerNameUniqueness:c})=>{const u=(0,_e.wW)(Vc),d=g=>g?`${u.row} ${u.sel}`:u.row;return p.createElement(qs.Z5,{onDragEnd:t},p.createElement(qs.bK,{droppableId:"droppable"},(g,f)=>p.createElement("div",{...g.droppableProps,ref:g.innerRef,"data-testid":Xc},(()=>{const m=[],_=l?1:0,v=l?2:1;for(let w=r.length-1;w>=_;w--){const E=r[w],L=E.getName(),M=Boolean(a?.includes(L));m.push(p.createElement(qs._l,{key:L,draggableId:L,index:m.length},(A,O)=>p.createElement("div",{className:d(M),ref:A.innerRef,...A.draggableProps,...A.dragHandleProps,onMouseDown:()=>i(E)},p.createElement(Uc.X,{name:L,onChange:z=>h(E,z),verifyLayerNameUniqueness:c??void 0}),p.createElement("div",{className:u.textWrapper},"\xA0 ",e(E)),o(E)&&p.createElement(p.Fragment,null,s?p.createElement(ts.h,{name:"copy",title:"Duplicate",ariaLabel:"Duplicate button",className:u.actionIcon,onClick:()=>s(E)}):null,p.createElement(ts.h,{name:"trash-alt",title:"remove",ariaLabel:"Remove button",className:(0,ee.cx)(u.actionIcon,u.dragIcon),onClick:()=>n(E)})),r.length>v&&p.createElement(Zc.J,{"aria-label":"Drag and drop icon",title:"Drag and drop to reorder",name:"draggabledots",size:"lg",className:u.dragIcon}))))}return m})(),g.placeholder)))};Vo.defaultProps={isGroup:()=>!1};const Vc=r=>({wrapper:ee.css`
    margin-bottom: ${r.spacing(2)};
  `,row:ee.css`
    padding: ${r.spacing(.5,1)};
    border-radius: ${r.shape.borderRadius(1)};
    background: ${r.colors.background.secondary};
    min-height: ${r.spacing(4)};
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3px;
    cursor: pointer;

    border: 1px solid ${r.components.input.borderColor};
    &:hover {
      border: 1px solid ${r.components.input.borderHover};
    }
  `,sel:ee.css`
    border: 1px solid ${r.colors.primary.border};
    &:hover {
      border: 1px solid ${r.colors.primary.border};
    }
  `,dragIcon:ee.css`
    cursor: drag;
  `,actionIcon:ee.css`
    color: ${r.colors.text.secondary};
    &:hover {
      color: ${r.colors.text};
    }
  `,typeWrapper:ee.css`
    color: ${r.colors.primary.text};
    margin-right: 5px;
  `,textWrapper:ee.css`
    display: flex;
    align-items: center;
    flex-grow: 1;
    overflow: hidden;
    margin-right: ${r.spacing(1)};
  `}),Yc=r=>{const{layers:e,selected:t,actions:i}=r.context.instanceState??{};if(!e||!i)return p.createElement("div",null,"No layers?");const n=c=>{if(!c.destination)return;const{layers:u,actions:d}=r.context.instanceState??{};if(!u||!d)return;const g=u.length-1,f=(c.source.index-g)*-1,m=(c.destination.index-g)*-1;d.reorder(f,m)},s=c=>{i.selectLayer(c.options.name)},o=c=>{i.deleteLayer(c.options.name)},a=c=>c.options.type,l=(c,u)=>{c.onChange({...c.options,name:u})},h=t?[e[t]?.getName()]:[];return p.createElement(p.Fragment,null,p.createElement(Cs.W2,null,p.createElement(Nc.f,{onChange:c=>i.addlayer(c.value),options:Bo(!1).options,label:"Add layer"})),p.createElement("br",null),p.createElement(Vo,{layers:e,showActions:()=>e.length>2,getLayerInfo:a,onDragEnd:n,onSelect:s,onDelete:o,selection:h,excludeBaseLayer:!0,onNameChange:l,verifyLayerNameUniqueness:i.canRename}))},jc=({labelWidth:r,value:e,onChange:t})=>{const i=s=>{t({...e,lat:s})},n=s=>{t({...e,lon:s})};return p.createElement(p.Fragment,null,p.createElement(St.Z,null,p.createElement(at._,{label:"Latitude",labelWidth:r,grow:!0},p.createElement(tn.Y,{value:e.lat,min:-90,max:90,step:.001,onChange:i}))),p.createElement(St.Z,null,p.createElement(at._,{label:"Longitude",labelWidth:r,grow:!0},p.createElement(tn.Y,{value:e.lon,min:-180,max:180,step:.001,onChange:n}))))};var Yo=(r=>(r.all="all",r.layer="layer",r.last="last",r))(Yo||{}),jo=(r=>(r.all="All layers",r.layer="Layer",r.last="Last value",r))(jo||{});const Hc=Object.values(Yo).map(r=>({label:jo[r],value:r})),Kc=({labelWidth:r,value:e,onChange:t,context:i})=>{const n=(0,p.useMemo)(()=>i.options?.layers?i.options.layers.map(u=>({label:u.name,value:u.name,description:void 0})):[],[i.options?.layers]),s=(0,p.useCallback)(u=>{t({...e,layer:u.value})},[e,t]),o=p.createElement(St.Z,null,p.createElement(at._,{label:"Layer",labelWidth:r,grow:!0},p.createElement(pi.Ph,{options:n,onChange:s,placeholder:n[0]?.label}))),a=u=>{t({...e,padding:u})},l=p.createElement(St.Z,null,p.createElement(at._,{label:"Padding",labelWidth:r,grow:!0,tooltip:"sets padding in relative percent beyond data extent"},p.createElement(tn.Y,{value:e?.padding??5,min:0,step:1,onChange:a}))),h=e.allLayers?"all":!e.allLayers&&e.lastOnly?"last":"layer",c=u=>{u!=="all"&&!e.layer?t({...e,allLayers:u===String("all"),lastOnly:u===String("last"),layer:n[0].value}):t({...e,allLayers:u===String("all"),lastOnly:u===String("last")})};return p.createElement(p.Fragment,null,p.createElement(St.Z,null,p.createElement(at._,{label:"Data",labelWidth:r,grow:!0},p.createElement(gn.S,{value:h,options:Hc,onChange:c}))),!e?.allLayers&&o,!e?.lastOnly&&l)},$c=({value:r,onChange:e,context:t})=>{const n=(0,p.useMemo)(()=>{const a=[];return r?.id?a.push(r.id):a.push(an.list()[0].id),an.selectOptions(a)},[r?.id]),s=(0,p.useCallback)(()=>{const a=t.instanceState?.map;if(a){const l=a.getView(),h=l.getCenter();if(h){const c=(0,U.bU)(h,l.getProjection());e({...r,id:yt.Coordinates,lon:+c[0].toFixed(6),lat:+c[1].toFixed(6),zoom:+l.getZoom().toFixed(2)})}}},[r,e,t.instanceState]),o=(0,p.useCallback)(a=>{const l=an.getIfExists(a.value);l&&e({...r,id:l.id,lat:l.lat??r?.lat,lon:l.lon??r?.lon,zoom:l.zoom??r?.zoom})},[r,e]);return p.createElement(p.Fragment,null,p.createElement(St.Z,null,p.createElement(at._,{label:"View",labelWidth:10,grow:!0},p.createElement(pi.Ph,{options:n.options,value:n.current,onChange:o}))),r.id===yt.Coordinates&&p.createElement(jc,{labelWidth:10,value:r,onChange:e}),r.id===yt.Fit&&p.createElement(Kc,{labelWidth:10,value:r,onChange:e,context:t}),p.createElement(St.Z,null,p.createElement(at._,{label:r?.id===yt.Fit?"Max Zoom":"Zoom",labelWidth:10,grow:!0},p.createElement(tn.Y,{value:r?.zoom??1,min:1,max:18,step:.01,onChange:a=>{e({...r,zoom:a})}}))),p.createElement(Cs.wc,null,p.createElement(mn.zx,{variant:"secondary",size:"sm",fullWidth:!0,onClick:s},p.createElement("span",null,"Use current map settings"))))};var Jc=S(13505),qc=S(71575),Qc=S(92465);function Ho(r){return{category:r.category,path:"--",defaultValue:r.basemaps?Ai:bs,values:e=>({getContext:t=>({...t,options:r.state.options,instanceState:r.state}),getValue:t=>(0,y.get)(r.state.options,t),onChange:(t,i)=>{const{state:n}=r,{options:s}=n;if(t==="type"&&i){const o=on.getIfExists(i);if(o){const a={...s,type:o.id,config:{...o.defaultOptions}};o.showLocation&&(a.location?.mode?delete a.location:a.location={mode:Ze.q1.Auto}),n.onChange(a);return}}n.onChange((0,Jc.hs)(s,t,i))}}),build:(e,t)=>{if(!r.state)return;const{handler:i,options:n}=r.state,s=on.getIfExists(n?.type),o=Bo(r.basemaps,n?.type?n.type:Ai.type);if(e.addSelect({path:"type",name:"Layer type",settings:{options:o.options}}),i.update&&e.addCustomEditor({id:"filterData",path:"filterData",name:"Data",editor:Qc.M,defaultValue:void 0}),!!s&&n.type!==Ai.type){if(s.showLocation){let a=t.data;if(n.filterData){const l=(0,zo.b9)(n.filterData);a=a.filter(l)}(0,qc.C)("Location","location.",e,n.location,a)}i.registerOptionsUI&&i.registerOptionsUI(e),(0,y.isEqual)(r.category,["Base layer"])||(s.hideOpacity||e.addSliderInput({path:"opacity",name:"Opacity",defaultValue:1,settings:{min:0,max:1,step:.1}}),e.addBooleanSwitch({path:"tooltip",name:"Display tooltip",description:"Show the tooltip for layer",defaultValue:!0}))}}}}var eu=S(33750),tu=S(13512),iu=S(69098);const nu=(r,e,t,i)=>{if(e==="grafana-worldmap-panel"&&t.angular){const{fieldConfig:n,options:s,xform:o}=su({...t.angular,fieldConfig:i});return o?.id?.length&&(r.transformations=r.transformations?[...r.transformations,o]:[o]),r.fieldConfig=n,s}return{}};function su(r){const e={defaults:{},overrides:[]},t=(0,y.cloneDeep)(bs),i={view:{id:yt.Zero},controls:{showZoom:!0,mouseWheelZoom:Boolean(r.mouseWheelZoom)},basemap:{type:"default",name:"Basemap"},layers:[t],tooltip:{mode:Oi.Details}};let n=ki(r.decimals);n&&(e.defaults.decimals=n);const s=t.config.style;n=ki(r.circleMaxSize),n&&(s.size.max=n),n=ki(r.circleMinSize),n&&(s.size.min=n);let o;const a=eu.TB.getIfExists(r.valueName);if(a&&r.locationData?.length)switch(o={id:tu.W.reduce,options:{reducers:[a.id]}},r.locationData){case"countries":case"countries_3letter":t.location={mode:Ze.q1.Lookup,gazetteer:"public/gazetteer/countries.json",lookup:void 0};break;case"states":t.location={mode:Ze.q1.Lookup,gazetteer:"public/gazetteer/usa-states.json",lookup:void 0};break}if(r.thresholds&&r.colors){const h=r.thresholds.split(",").map(u=>Number(u.trim())),c=[];for(const u of r.colors){const d=c.length-1;d>=0?c.push({value:h[d],color:u}):c.push({value:-1/0,color:u})}e.defaults.thresholds={mode:iu.H.Absolute,steps:c}}n=ki(r.initialZoom),n&&(i.view.zoom=n);const l={"(0\xB0, 0\xB0)":yt.Zero,"North America":"north-america",Europe:"europe","West Asia":"west-asia","SE Asia":"se-asia","Last GeoHash":yt.Coordinates};return i.view.id=l[r.mapCenter],i.view.lat=ki(r.mapCenterLatitude),i.view.lon=ki(r.mapCenterLongitude),{fieldConfig:e,options:i,xform:o}}function ki(r){const e=+r;return isNaN(e)?void 0:e}const ru=r=>{const e=r?.pluginVersion??"";if((e.startsWith("8.1")||e.startsWith("8.2"))&&r.options?.layers?.length===1){const i=r.options.layers[0];if(i?.type==="markers"&&i.config){const n=i.config,s={style:(0,y.cloneDeep)(V.Er),showLegend:Boolean(n.showLegend)};n.size&&(s.style.size=n.size),n.color&&(s.style.color=n.color),n.fillOpacity&&(s.style.opacity=n.fillOpacity);const o=Bl(n.shape);return o&&(s.style.symbol={fixed:o,mode:Ze.Q8.Fixed}),{...r.options,layers:[{...i,config:s}]}}}return r.options},ou=new te.c(Uo).setNoPadding().setPanelChangeHandler(nu).setMigrationHandler(ru).useFieldConfig({useCustomConfig:r=>{Ve.B(r)}}).setPanelOptions((r,e)=>{let t=["Map view"];r.addCustomEditor({category:t,id:"view",path:"view",name:"Initial view",description:"This location will show when the panel first loads.",editor:$c,defaultValue:Go}),r.addBooleanSwitch({category:t,path:"view.shared",description:"Use the same view across multiple panels.  Note: this may require a dashboard reload.",name:"Share view",defaultValue:Go.shared});const i=e.instanceState;if(i?.layers){const n=["Map layers"],s=["Basemap layer"];r.addCustomEditor({category:n,id:"layers",path:"",name:"",editor:Yc});const o=i.layers[i.selected];i.selected&&o&&r.addNestedOptions(Ho({state:o,category:n,basemaps:!1}));const a=i.layers[0];Xe.v.geomapDisableCustomBaseLayer?r.addCustomEditor({category:s,id:"layers",path:"",name:"",editor:()=>p.createElement("div",null,"The basemap layer is configured by the server admin.")}):a&&r.addNestedOptions(Ho({state:a,category:s,basemaps:!0}))}t=["Map controls"],r.addBooleanSwitch({category:t,path:"controls.showZoom",description:"Show zoom control buttons in the upper left corner",name:"Show zoom control",defaultValue:!0}).addBooleanSwitch({category:t,path:"controls.mouseWheelZoom",description:"Enable zoom control via mouse wheel",name:"Mouse wheel zoom",defaultValue:!0}).addBooleanSwitch({category:t,path:"controls.showAttribution",name:"Show attribution",description:"Show the map source attribution info in the lower right",defaultValue:!0}).addBooleanSwitch({category:t,path:"controls.showScale",name:"Show scale",description:"Indicate map scale",defaultValue:!1}).addBooleanSwitch({category:t,path:"controls.showMeasure",name:"Show measure tools",description:"Show tools for making measurements on the map",defaultValue:!1}).addBooleanSwitch({category:t,path:"controls.showDebug",name:"Show debug",description:"Show map info",defaultValue:!1}).addRadio({category:t,path:"tooltip.mode",name:"Tooltip",defaultValue:Oi.Details,settings:{options:[{label:"None",value:Oi.None,description:"Show contents on click, not hover"},{label:"Details",value:Oi.Details,description:"Show popup on hover"}]}})})},37072:bt=>{"use strict";bt.exports=ve,bt.exports.default=ve;function ve(x,T,y){y=y||2;var F=T&&T.length,b=F?T[0]*y:x.length,P=S(x,0,b,y,!0),D=[];if(!P||P.next===P.prev)return D;var W,re,ne,Fe,Se,pe,Be;if(F&&(P=Lt(x,T,P,y)),x.length>80*y){W=ne=x[0],re=Fe=x[1];for(var Te=y;Te<b;Te+=y)Se=x[Te],pe=x[Te+1],Se<W&&(W=Se),pe<re&&(re=pe),Se>ne&&(ne=Se),pe>Fe&&(Fe=pe);Be=Math.max(ne-W,Fe-re),Be=Be!==0?32767/Be:0}return te(P,D,y,W,re,Be,0),D}function S(x,T,y,F,b){var P,D;if(b===dt(x,T,y,F)>0)for(P=T;P<y;P+=F)D=Pe(P,x[P],x[P+1],D);else for(P=y-F;P>=T;P-=F)D=Pe(P,x[P],x[P+1],D);return D&&C(D,D.next)&&(je(D),D=D.next),D}function p(x,T){if(!x)return x;T||(T=x);var y=x,F;do if(F=!1,!y.steiner&&(C(y,y.next)||B(y.prev,y,y.next)===0)){if(je(y),y=T=y.prev,y===y.next)break;F=!0}else y=y.next;while(F||y!==T);return T}function te(x,T,y,F,b,P,D){if(x){!D&&P&&ue(x,F,b,P);for(var W=x,re,ne;x.prev!==x.next;){if(re=x.prev,ne=x.next,P?Ve(x,F,b,P):Xe(x)){T.push(re.i/y|0),T.push(x.i/y|0),T.push(ne.i/y|0),je(x),x=ne.next,W=ne.next;continue}if(x=ne,x===W){D?D===1?(x=ee(p(x),T,y),te(x,T,y,F,b,P,2)):D===2&&Ye(x,T,y,F,b,P):te(p(x),T,y,F,b,P,1);break}}}}function Xe(x){var T=x.prev,y=x,F=x.next;if(B(T,y,F)>=0)return!1;for(var b=T.x,P=y.x,D=F.x,W=T.y,re=y.y,ne=F.y,Fe=b<P?b<D?b:D:P<D?P:D,Se=W<re?W<ne?W:ne:re<ne?re:ne,pe=b>P?b>D?b:D:P>D?P:D,Be=W>re?W>ne?W:ne:re>ne?re:ne,Te=F.next;Te!==T;){if(Te.x>=Fe&&Te.x<=pe&&Te.y>=Se&&Te.y<=Be&&R(b,W,P,re,D,ne,Te.x,Te.y)&&B(Te.prev,Te,Te.next)>=0)return!1;Te=Te.next}return!0}function Ve(x,T,y,F){var b=x.prev,P=x,D=x.next;if(B(b,P,D)>=0)return!1;for(var W=b.x,re=P.x,ne=D.x,Fe=b.y,Se=P.y,pe=D.y,Be=W<re?W<ne?W:ne:re<ne?re:ne,Te=Fe<Se?Fe<pe?Fe:pe:Se<pe?Se:pe,ci=W>re?W>ne?W:ne:re>ne?re:ne,ui=Fe>Se?Fe>pe?Fe:pe:Se>pe?Se:pe,dn=rt(Be,Te,T,y,F),fn=rt(ci,ui,T,y,F),fe=x.prevZ,xe=x.nextZ;fe&&fe.z>=dn&&xe&&xe.z<=fn;){if(fe.x>=Be&&fe.x<=ci&&fe.y>=Te&&fe.y<=ui&&fe!==b&&fe!==D&&R(W,Fe,re,Se,ne,pe,fe.x,fe.y)&&B(fe.prev,fe,fe.next)>=0||(fe=fe.prevZ,xe.x>=Be&&xe.x<=ci&&xe.y>=Te&&xe.y<=ui&&xe!==b&&xe!==D&&R(W,Fe,re,Se,ne,pe,xe.x,xe.y)&&B(xe.prev,xe,xe.next)>=0))return!1;xe=xe.nextZ}for(;fe&&fe.z>=dn;){if(fe.x>=Be&&fe.x<=ci&&fe.y>=Te&&fe.y<=ui&&fe!==b&&fe!==D&&R(W,Fe,re,Se,ne,pe,fe.x,fe.y)&&B(fe.prev,fe,fe.next)>=0)return!1;fe=fe.prevZ}for(;xe&&xe.z<=fn;){if(xe.x>=Be&&xe.x<=ci&&xe.y>=Te&&xe.y<=ui&&xe!==b&&xe!==D&&R(W,Fe,re,Se,ne,pe,xe.x,xe.y)&&B(xe.prev,xe,xe.next)>=0)return!1;xe=xe.nextZ}return!0}function ee(x,T,y){var F=x;do{var b=F.prev,P=F.next.next;!C(b,P)&&X(b,F,F.next,P)&&le(b,P)&&le(P,b)&&(T.push(b.i/y|0),T.push(F.i/y|0),T.push(P.i/y|0),je(F),je(F.next),F=x=P),F=F.next}while(F!==x);return p(F)}function Ye(x,T,y,F,b,P){var D=x;do{for(var W=D.next.next;W!==D.prev;){if(D.i!==W.i&&k(D,W)){var re=me(D,W);D=p(D,D.next),re=p(re,re.next),te(D,T,y,F,b,P,0),te(re,T,y,F,b,P,0);return}W=W.next}D=D.next}while(D!==x)}function Lt(x,T,y,F){var b=[],P,D,W,re,ne;for(P=0,D=T.length;P<D;P++)W=T[P]*F,re=P<D-1?T[P+1]*F:x.length,ne=S(x,W,re,F,!1),ne===ne.next&&(ne.steiner=!0),b.push(I(ne));for(b.sort(kt),P=0;P<b.length;P++)y=Me(b[P],y);return y}function kt(x,T){return x.x-T.x}function Me(x,T){var y=Ae(x,T);if(!y)return T;var F=me(y,x);return p(F,F.next),p(y,y.next)}function Ae(x,T){var y=T,F=x.x,b=x.y,P=-1/0,D;do{if(b<=y.y&&b>=y.next.y&&y.next.y!==y.y){var W=y.x+(b-y.y)*(y.next.x-y.x)/(y.next.y-y.y);if(W<=F&&W>P&&(P=W,D=y.x<y.next.x?y:y.next,W===F))return D}y=y.next}while(y!==T);if(!D)return null;var re=D,ne=D.x,Fe=D.y,Se=1/0,pe;y=D;do F>=y.x&&y.x>=ne&&F!==y.x&&R(b<Fe?F:P,b,ne,Fe,b<Fe?P:F,b,y.x,y.y)&&(pe=Math.abs(b-y.y)/(F-y.x),le(y,x)&&(pe<Se||pe===Se&&(y.x>D.x||y.x===D.x&&U(D,y)))&&(D=y,Se=pe)),y=y.next;while(y!==re);return D}function U(x,T){return B(x.prev,x,T.prev)<0&&B(T.next,x,x.next)<0}function ue(x,T,y,F){var b=x;do b.z===0&&(b.z=rt(b.x,b.y,T,y,F)),b.prevZ=b.prev,b.nextZ=b.next,b=b.next;while(b!==x);b.prevZ.nextZ=null,b.prevZ=null,De(b)}function De(x){var T,y,F,b,P,D,W,re,ne=1;do{for(y=x,x=null,P=null,D=0;y;){for(D++,F=y,W=0,T=0;T<ne&&(W++,F=F.nextZ,!!F);T++);for(re=ne;W>0||re>0&&F;)W!==0&&(re===0||!F||y.z<=F.z)?(b=y,y=y.nextZ,W--):(b=F,F=F.nextZ,re--),P?P.nextZ=b:x=b,b.prevZ=P,P=b;y=F}P.nextZ=null,ne*=2}while(D>1);return x}function rt(x,T,y,F,b){return x=(x-y)*b|0,T=(T-F)*b|0,x=(x|x<<8)&16711935,x=(x|x<<4)&252645135,x=(x|x<<2)&858993459,x=(x|x<<1)&1431655765,T=(T|T<<8)&16711935,T=(T|T<<4)&252645135,T=(T|T<<2)&858993459,T=(T|T<<1)&1431655765,x|T<<1}function I(x){var T=x,y=x;do(T.x<y.x||T.x===y.x&&T.y<y.y)&&(y=T),T=T.next;while(T!==x);return y}function R(x,T,y,F,b,P,D,W){return(b-D)*(T-W)>=(x-D)*(P-W)&&(x-D)*(F-W)>=(y-D)*(T-W)&&(y-D)*(P-W)>=(b-D)*(F-W)}function k(x,T){return x.next.i!==T.i&&x.prev.i!==T.i&&!de(x,T)&&(le(x,T)&&le(T,x)&&_e(x,T)&&(B(x.prev,x,T.prev)||B(x,T.prev,T))||C(x,T)&&B(x.prev,x,x.next)>0&&B(T.prev,T,T.next)>0)}function B(x,T,y){return(T.y-x.y)*(y.x-T.x)-(T.x-x.x)*(y.y-T.y)}function C(x,T){return x.x===T.x&&x.y===T.y}function X(x,T,y,F){var b=Q(B(x,T,y)),P=Q(B(x,T,F)),D=Q(B(y,F,x)),W=Q(B(y,F,T));return!!(b!==P&&D!==W||b===0&&Y(x,y,T)||P===0&&Y(x,F,T)||D===0&&Y(y,x,F)||W===0&&Y(y,T,F))}function Y(x,T,y){return T.x<=Math.max(x.x,y.x)&&T.x>=Math.min(x.x,y.x)&&T.y<=Math.max(x.y,y.y)&&T.y>=Math.min(x.y,y.y)}function Q(x){return x>0?1:x<0?-1:0}function de(x,T){var y=x;do{if(y.i!==x.i&&y.next.i!==x.i&&y.i!==T.i&&y.next.i!==T.i&&X(y,y.next,x,T))return!0;y=y.next}while(y!==x);return!1}function le(x,T){return B(x.prev,x,x.next)<0?B(x,T,x.next)>=0&&B(x,x.prev,T)>=0:B(x,T,x.prev)<0||B(x,x.next,T)<0}function _e(x,T){var y=x,F=!1,b=(x.x+T.x)/2,P=(x.y+T.y)/2;do y.y>P!=y.next.y>P&&y.next.y!==y.y&&b<(y.next.x-y.x)*(P-y.y)/(y.next.y-y.y)+y.x&&(F=!F),y=y.next;while(y!==x);return F}function me(x,T){var y=new Ke(x.i,x.x,x.y),F=new Ke(T.i,T.x,T.y),b=x.next,P=T.prev;return x.next=T,T.prev=x,y.next=b,b.prev=y,F.next=y,y.prev=F,P.next=F,F.prev=P,F}function Pe(x,T,y,F){var b=new Ke(x,T,y);return F?(b.next=F.next,b.prev=F,F.next.prev=b,F.next=b):(b.prev=b,b.next=b),b}function je(x){x.next.prev=x.prev,x.prev.next=x.next,x.prevZ&&(x.prevZ.nextZ=x.nextZ),x.nextZ&&(x.nextZ.prevZ=x.prevZ)}function Ke(x,T,y){this.i=x,this.x=T,this.y=y,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}ve.deviation=function(x,T,y,F){var b=T&&T.length,P=b?T[0]*y:x.length,D=Math.abs(dt(x,0,P,y));if(b)for(var W=0,re=T.length;W<re;W++){var ne=T[W]*y,Fe=W<re-1?T[W+1]*y:x.length;D-=Math.abs(dt(x,ne,Fe,y))}var Se=0;for(W=0;W<F.length;W+=3){var pe=F[W]*y,Be=F[W+1]*y,Te=F[W+2]*y;Se+=Math.abs((x[pe]-x[Te])*(x[Be+1]-x[pe+1])-(x[pe]-x[Be])*(x[Te+1]-x[pe+1]))}return D===0&&Se===0?0:Math.abs((Se-D)/D)};function dt(x,T,y,F){for(var b=0,P=T,D=y-F;P<y;P+=F)b+=(x[D]-x[P])*(x[P+1]+x[D+1]),D=P;return b}ve.flatten=function(x){for(var T=x[0][0].length,y={vertices:[],holes:[],dimensions:T},F=0,b=0;b<x.length;b++){for(var P=0;P<x[b].length;P++)for(var D=0;D<T;D++)y.vertices.push(x[b][P][D]);b>0&&(F+=x[b-1].length,y.holes.push(F))}return y}},43788:function(bt){(function(ve,S){bt.exports=S()})(this,function(){"use strict";function ve(I,R,k,B,C){(function X(Y,Q,de,le,_e){for(;le>de;){if(le-de>600){var me=le-de+1,Pe=Q-de+1,je=Math.log(me),Ke=.5*Math.exp(2*je/3),dt=.5*Math.sqrt(je*Ke*(me-Ke)/me)*(Pe-me/2<0?-1:1),x=Math.max(de,Math.floor(Q-Pe*Ke/me+dt)),T=Math.min(le,Math.floor(Q+(me-Pe)*Ke/me+dt));X(Y,Q,x,T,_e)}var y=Y[Q],F=de,b=le;for(S(Y,de,Q),_e(Y[le],y)>0&&S(Y,de,le);F<b;){for(S(Y,F,b),F++,b--;_e(Y[F],y)<0;)F++;for(;_e(Y[b],y)>0;)b--}_e(Y[de],y)===0?S(Y,de,b):S(Y,++b,le),b<=Q&&(de=b+1),Q<=b&&(le=b-1)}})(I,R,k||0,B||I.length-1,C||p)}function S(I,R,k){var B=I[R];I[R]=I[k],I[k]=B}function p(I,R){return I<R?-1:I>R?1:0}var te=function(I){I===void 0&&(I=9),this._maxEntries=Math.max(4,I),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function Xe(I,R,k){if(!k)return R.indexOf(I);for(var B=0;B<R.length;B++)if(k(I,R[B]))return B;return-1}function Ve(I,R){ee(I,0,I.children.length,R,I)}function ee(I,R,k,B,C){C||(C=De(null)),C.minX=1/0,C.minY=1/0,C.maxX=-1/0,C.maxY=-1/0;for(var X=R;X<k;X++){var Y=I.children[X];Ye(C,I.leaf?B(Y):Y)}return C}function Ye(I,R){return I.minX=Math.min(I.minX,R.minX),I.minY=Math.min(I.minY,R.minY),I.maxX=Math.max(I.maxX,R.maxX),I.maxY=Math.max(I.maxY,R.maxY),I}function Lt(I,R){return I.minX-R.minX}function kt(I,R){return I.minY-R.minY}function Me(I){return(I.maxX-I.minX)*(I.maxY-I.minY)}function Ae(I){return I.maxX-I.minX+(I.maxY-I.minY)}function U(I,R){return I.minX<=R.minX&&I.minY<=R.minY&&R.maxX<=I.maxX&&R.maxY<=I.maxY}function ue(I,R){return R.minX<=I.maxX&&R.minY<=I.maxY&&R.maxX>=I.minX&&R.maxY>=I.minY}function De(I){return{children:I,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function rt(I,R,k,B,C){for(var X=[R,k];X.length;)if(!((k=X.pop())-(R=X.pop())<=B)){var Y=R+Math.ceil((k-R)/B/2)*B;ve(I,Y,R,k,C),X.push(R,Y,Y,k)}}return te.prototype.all=function(){return this._all(this.data,[])},te.prototype.search=function(I){var R=this.data,k=[];if(!ue(I,R))return k;for(var B=this.toBBox,C=[];R;){for(var X=0;X<R.children.length;X++){var Y=R.children[X],Q=R.leaf?B(Y):Y;ue(I,Q)&&(R.leaf?k.push(Y):U(I,Q)?this._all(Y,k):C.push(Y))}R=C.pop()}return k},te.prototype.collides=function(I){var R=this.data;if(!ue(I,R))return!1;for(var k=[];R;){for(var B=0;B<R.children.length;B++){var C=R.children[B],X=R.leaf?this.toBBox(C):C;if(ue(I,X)){if(R.leaf||U(I,X))return!0;k.push(C)}}R=k.pop()}return!1},te.prototype.load=function(I){if(!I||!I.length)return this;if(I.length<this._minEntries){for(var R=0;R<I.length;R++)this.insert(I[R]);return this}var k=this._build(I.slice(),0,I.length-1,0);if(this.data.children.length)if(this.data.height===k.height)this._splitRoot(this.data,k);else{if(this.data.height<k.height){var B=this.data;this.data=k,k=B}this._insert(k,this.data.height-k.height-1,!0)}else this.data=k;return this},te.prototype.insert=function(I){return I&&this._insert(I,this.data.height-1),this},te.prototype.clear=function(){return this.data=De([]),this},te.prototype.remove=function(I,R){if(!I)return this;for(var k,B,C,X=this.data,Y=this.toBBox(I),Q=[],de=[];X||Q.length;){if(X||(X=Q.pop(),B=Q[Q.length-1],k=de.pop(),C=!0),X.leaf){var le=Xe(I,X.children,R);if(le!==-1)return X.children.splice(le,1),Q.push(X),this._condense(Q),this}C||X.leaf||!U(X,Y)?B?(k++,X=B.children[k],C=!1):X=null:(Q.push(X),de.push(k),k=0,B=X,X=X.children[0])}return this},te.prototype.toBBox=function(I){return I},te.prototype.compareMinX=function(I,R){return I.minX-R.minX},te.prototype.compareMinY=function(I,R){return I.minY-R.minY},te.prototype.toJSON=function(){return this.data},te.prototype.fromJSON=function(I){return this.data=I,this},te.prototype._all=function(I,R){for(var k=[];I;)I.leaf?R.push.apply(R,I.children):k.push.apply(k,I.children),I=k.pop();return R},te.prototype._build=function(I,R,k,B){var C,X=k-R+1,Y=this._maxEntries;if(X<=Y)return Ve(C=De(I.slice(R,k+1)),this.toBBox),C;B||(B=Math.ceil(Math.log(X)/Math.log(Y)),Y=Math.ceil(X/Math.pow(Y,B-1))),(C=De([])).leaf=!1,C.height=B;var Q=Math.ceil(X/Y),de=Q*Math.ceil(Math.sqrt(Y));rt(I,R,k,de,this.compareMinX);for(var le=R;le<=k;le+=de){var _e=Math.min(le+de-1,k);rt(I,le,_e,Q,this.compareMinY);for(var me=le;me<=_e;me+=Q){var Pe=Math.min(me+Q-1,_e);C.children.push(this._build(I,me,Pe,B-1))}}return Ve(C,this.toBBox),C},te.prototype._chooseSubtree=function(I,R,k,B){for(;B.push(R),!R.leaf&&B.length-1!==k;){for(var C=1/0,X=1/0,Y=void 0,Q=0;Q<R.children.length;Q++){var de=R.children[Q],le=Me(de),_e=(me=I,Pe=de,(Math.max(Pe.maxX,me.maxX)-Math.min(Pe.minX,me.minX))*(Math.max(Pe.maxY,me.maxY)-Math.min(Pe.minY,me.minY))-le);_e<X?(X=_e,C=le<C?le:C,Y=de):_e===X&&le<C&&(C=le,Y=de)}R=Y||R.children[0]}var me,Pe;return R},te.prototype._insert=function(I,R,k){var B=k?I:this.toBBox(I),C=[],X=this._chooseSubtree(B,this.data,R,C);for(X.children.push(I),Ye(X,B);R>=0&&C[R].children.length>this._maxEntries;)this._split(C,R),R--;this._adjustParentBBoxes(B,C,R)},te.prototype._split=function(I,R){var k=I[R],B=k.children.length,C=this._minEntries;this._chooseSplitAxis(k,C,B);var X=this._chooseSplitIndex(k,C,B),Y=De(k.children.splice(X,k.children.length-X));Y.height=k.height,Y.leaf=k.leaf,Ve(k,this.toBBox),Ve(Y,this.toBBox),R?I[R-1].children.push(Y):this._splitRoot(k,Y)},te.prototype._splitRoot=function(I,R){this.data=De([I,R]),this.data.height=I.height+1,this.data.leaf=!1,Ve(this.data,this.toBBox)},te.prototype._chooseSplitIndex=function(I,R,k){for(var B,C,X,Y,Q,de,le,_e=1/0,me=1/0,Pe=R;Pe<=k-R;Pe++){var je=ee(I,0,Pe,this.toBBox),Ke=ee(I,Pe,k,this.toBBox),dt=(C=je,X=Ke,Y=void 0,Q=void 0,de=void 0,le=void 0,Y=Math.max(C.minX,X.minX),Q=Math.max(C.minY,X.minY),de=Math.min(C.maxX,X.maxX),le=Math.min(C.maxY,X.maxY),Math.max(0,de-Y)*Math.max(0,le-Q)),x=Me(je)+Me(Ke);dt<_e?(_e=dt,B=Pe,me=x<me?x:me):dt===_e&&x<me&&(me=x,B=Pe)}return B||k-R},te.prototype._chooseSplitAxis=function(I,R,k){var B=I.leaf?this.compareMinX:Lt,C=I.leaf?this.compareMinY:kt;this._allDistMargin(I,R,k,B)<this._allDistMargin(I,R,k,C)&&I.children.sort(B)},te.prototype._allDistMargin=function(I,R,k,B){I.children.sort(B);for(var C=this.toBBox,X=ee(I,0,R,C),Y=ee(I,k-R,k,C),Q=Ae(X)+Ae(Y),de=R;de<k-R;de++){var le=I.children[de];Ye(X,I.leaf?C(le):le),Q+=Ae(X)}for(var _e=k-R-1;_e>=R;_e--){var me=I.children[_e];Ye(Y,I.leaf?C(me):me),Q+=Ae(Y)}return Q},te.prototype._adjustParentBBoxes=function(I,R,k){for(var B=k;B>=0;B--)Ye(R[B],I)},te.prototype._condense=function(I){for(var R=I.length-1,k=void 0;R>=0;R--)I[R].children.length===0?R>0?(k=I[R-1].children).splice(k.indexOf(I[R]),1):this.clear():Ve(I[R],this.toBBox)},te})}}]);

//# sourceMappingURL=8594.16b4713c94fcc30deb01.js.map