(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7559],{20331:Ge=>{"use strict";Ge.exports=function(te){var y=[];return y.toString=function(){return this.map(function(G){var j="",Q=typeof G[5]<"u";return G[4]&&(j+="@supports (".concat(G[4],") {")),G[2]&&(j+="@media ".concat(G[2]," {")),Q&&(j+="@layer".concat(G[5].length>0?" ".concat(G[5]):""," {")),j+=te(G),Q&&(j+="}"),G[2]&&(j+="}"),G[4]&&(j+="}"),j}).join("")},y.i=function(G,j,Q,N,be){typeof G=="string"&&(G=[[null,G,void 0]]);var Le={};if(Q)for(var xe=0;xe<this.length;xe++){var ye=this[xe][0];ye!=null&&(Le[ye]=!0)}for(var Ce=0;Ce<G.length;Ce++){var P=[].concat(G[Ce]);Q&&Le[P[0]]||(typeof be<"u"&&(typeof P[5]>"u"||(P[1]="@layer".concat(P[5].length>0?" ".concat(P[5]):""," {").concat(P[1],"}")),P[5]=be),j&&(P[2]&&(P[1]="@media ".concat(P[2]," {").concat(P[1],"}")),P[2]=j),N&&(P[4]?(P[1]="@supports (".concat(P[4],") {").concat(P[1],"}"),P[4]=N):P[4]="".concat(N)),y.push(P))}},y}},99211:Ge=>{"use strict";Ge.exports=function(te,y){return y||(y={}),te&&(te=String(te.__esModule?te.default:te),/^['"].*['"]$/.test(te)&&(te=te.slice(1,-1)),y.hash&&(te+=y.hash),/["'() \t\n]|(%20)/.test(te)||y.needQuotes?'"'.concat(te.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):te)}},92098:Ge=>{"use strict";Ge.exports=function(te){var y=te[1],p=te[3];if(!p)return y;if(typeof btoa=="function"){var G=btoa(unescape(encodeURIComponent(JSON.stringify(p)))),j="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(G),Q="/*# ".concat(j," */");return[y].concat([Q]).join(`
`)}return[y].join(`
`)}},1180:(Ge,te,y)=>{"use strict";y.d(te,{q:()=>N});var p=y(60234),G=y(65237),j=y(93048);const Q=10,N=({colorPalette:ye,min:Ce,max:P,display:ie,hoverValue:Fe,useStopsPercentage:Ne})=>{const[I,R]=(0,G.useState)([]),[O,z]=(0,G.useState)({isShown:!1,value:0}),[S,Y]=(0,G.useState)(null),K=(0,j.l4)(),re=xe(K,I);(0,G.useEffect)(()=>{R(be({colorArray:ye,stops:Q,useStopsPercentage:Ne}))},[ye,Ne]);const me=Ee=>{const ve=Ee.nativeEvent.offsetX,We=Ee.currentTarget.offsetWidth,$e=Math.floor(ve*100/We+1),qe=Math.floor((P-Ce)*$e/100+Ce);z({isShown:!0,value:qe}),Y($e)},de=()=>{z({isShown:!1,value:0})};return(0,G.useEffect)(()=>{Y(Fe==null?null:Le((Fe-Ce)/(P-Ce)))},[Fe,Ce,P]),G.createElement("div",{className:re.scaleWrapper,onMouseMove:me,onMouseLeave:de},G.createElement("div",{className:re.scaleGradient},ie&&(O.isShown||Fe!==void 0)&&G.createElement("div",{className:re.followerContainer},G.createElement("div",{className:re.follower,style:{left:`${S}%`}}))),ie&&G.createElement("div",{className:re.followerContainer},G.createElement("div",{className:re.legendValues},G.createElement("span",null,ie(Ce)),G.createElement("span",null,ie(P))),S!=null&&(O.isShown||Fe!==void 0)&&G.createElement("span",{className:re.hoverValue,style:{left:`${S}%`}},ie(Fe??O.value))))},be=({colorArray:ye,stops:Ce,useStopsPercentage:P=!0})=>{const ie=ye.length;if(P&&ie<=20){const R=1/ie*100;let O=0;const z=[];for(const S of ye)O>0?z.push(`${S} ${O}%`):z.push(S),O+=R,z.push(`${S} ${O}%`);return z}const Fe=ye[ie-1],Ne=Math.ceil(ie/Ce),I=new Set;for(let R=0;R<ie;R+=Ne)I.add(ye[R]);return I.add(Fe),[...I]};function Le(ye){return ye>1?100:ye<0?0:ye*100}const xe=(ye,Ce)=>({scaleWrapper:p.css`
    width: 100%;
    font-size: 11px;
    opacity: 1;
  `,scaleGradient:p.css`
    background: linear-gradient(90deg, ${Ce.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: ${ye.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 ${ye.colors.text.primary};
    margin-top: 5px;
  `})},45206:(Ge,te,y)=>{"use strict";y.d(te,{f:()=>j});var p=y(65237),G=y(39982);const j=({onChange:Q,options:N,label:be})=>p.createElement(G.b,{icon:"plus",label:be,variant:"secondary",options:N,onChange:Q,isFullWidth:!0})},55868:(Ge,te,y)=>{"use strict";y.d(te,{M:()=>be});var p=y(65237),G=y(21286),j=y(46507),Q=y(94795);const N=(Le,xe,ye)=>{if(!ye)return;let Ce=Le.find(P=>!xe.some(ie=>P===ie));if(Ce)return Ce},be=({value:Le,context:xe,onChange:ye,item:Ce})=>{const P=(0,p.useMemo)(()=>xe.data.map(R=>({value:R.refId,label:`Query: ${R.refId} (size: ${R.length})`,description:R.fields.map(O=>(0,G.C)(O)).join(", ")})),[xe.data]),[ie,Fe]=(0,p.useState)({refIds:[],value:void 0}),Ne=(0,p.useMemo)(()=>P.find(R=>R.value===Le?.options)??N(P,ie.refIds,ie.value),[Le,P,ie]),I=(0,p.useCallback)(R=>{ye(R?.value?{id:j.E4.byRefId,options:R.value}:void 0)},[ye]);return(P!==ie.refIds||Ne?.value!==ie.value)&&Fe({refIds:P,value:Ne?.value}),p.createElement(Q.Ph,{options:P,onChange:I,isClearable:!0,placeholder:"Change filter",value:Ne})}},88880:(Ge,te,y)=>{"use strict";y.r(te),y.d(te,{plugin:()=>su});var p=y(65237),G=y(38792),j=y(49784),Q=y(39109),N=y(60234),be=y(41328),Le=y(68121),xe=y(65236),ye=y(5803),Ce=y(33221),P=y(32151),ie=y(18595);const Fe="units",Ne=[1,2,5],I=25.4/.28;class R extends ye.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+" "+Ce.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(Fe,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(Fe)}handleUnitsChanged_(){this.updateElement_()}setUnits(e){this.set(Fe,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,P._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=P.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,ie.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=Ne[(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,P._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 O=R;var z=y(57182),S=y(89849),Y=y(9366),K=y(19973),re=y(5777),me=y(3151),de=y(91063),Ee=y(93048);const ve=({topRight1:r,topRight2:e,bottomLeft:t,blStyle:i})=>{const n=(r&&r.length>0)??!1,s=(0,Ee.wW)(We(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))},We=r=>e=>({overlay:N.css`
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 500;
    pointer-events: none;
  `,TR1:N.css`
    right: 0.5em;
    pointer-events: auto;
    position: absolute;
    top: 0.5em;
  `,TR2:N.css`
    position: absolute;
    top: ${r?"80":"8"}px;
    right: 8px;
    pointer-events: auto;
  `,BL:N.css`
    position: absolute;
    bottom: 8px;
    left: 8px;
    pointer-events: auto;
  `});var $e=y(16056),qe=y(60436),gt=y(55913),x=y(74135),T=y(94156),C=y(89949),M=y(12554),b=y(21286),D=y(5565),A=y(60822),U=y(16983),he=y(82352),ae=y(32034);const ze=({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 he.i([n])}return p.createElement(ae.H,{data:e,rowIndex:t})},Pe=({layers:r,activeTabIndex:e})=>{const t=(0,Ee.wW)(Xe),[i,n]=(0,p.useState)(new Map),s=(o,a)=>{n(new Map(i.set(o,a)))};return p.createElement(D.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(A.U,{key:c,collapsible:!0,label:we(l,h),isOpen:i.get(c),onToggle:()=>{s(c,!i.get(c))},className:t.collapsibleRow},p.createElement(ze,{feature:l})):p.createElement(ze,{key:c,feature:l})})))))},we=(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===M.fS.string){const l=(0,b.C)(a,s);n||(n=l),i[l]=a.values.get(o)}}for(let o of t){const a=i[o];if(a)return a}if(n)return p.createElement("span",null,n,": ",(0,U.Q)(i[n]));for(let o of Object.keys(i)){const a=i[o];if((0,C.isString)(a))return p.createElement("span",null,o,": ",(0,U.Q)(a))}return`Match: ${e+1}`},Xe=r=>({collapsibleRow:N.css`
    margin-bottom: 0;
  `});var De=y(90823),ci=y(95558);const ui=({layers:r,setActiveTabIndex:e,activeTabIndex:t})=>p.createElement(De.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(Pe,{layers:r,activeTabIndex:i})):null},fn=({ttip:r,onClose:e,isOpen:t})=>{const i=(0,p.createRef)(),{overlayProps:n}=(0,qe.Ir)({onClose:e,isDismissable:!0,isOpen:t},i),{dialogProps:s}=(0,$e.R)({},i);return p.createElement(p.Fragment,null,r&&r.layers&&p.createElement(gt.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 pe=y(71685),Se=y(92917),ir=y(48954),di=y(18819);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,P.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":Se.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,ir.B)(r=>({infoWrap:N.css`
    color: ${r.colors.text.primary};
    background: ${(0,pe.Z)(r.components.panel.background).setAlpha(.7).toString()};
    border-radius: 2px;
    padding: 8px;
  `}));var gn=y(12007),mn=y(48389),xi=y(94795),es=y(67262),mt=y(9788);const Qe=[{value:"length",label:"Length",geometry:"LineString",units:[{label:"Metric (m/km)",value:"m",format:r=>(0,mt.Cf)("lengthm")(r)},{label:"Feet (ft)",value:"ft",format:r=>(0,mt.Cf)("lengthft")(r*3.28084)},{label:"Miles (mi)",value:"mi",format:r=>(0,mt.Cf)("lengthmi")(r/1609)},{label:"Nautical miles (nmi)",value:"nmi",format:r=>(0,mt.Cf)("nmi")(r/1852)}],getUnit:r=>{const e=Qe[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,mt.Cf)("areaM2")(r)},{label:"Square Kilometers (km\xB2)",value:"km2",format:r=>(0,mt.q2)("km\xB2")(r*1e-6)},{label:"Square Feet (ft\xB2)",value:"ft2",format:r=>(0,mt.Cf)("areaF2")(r*10.76391)},{label:"Square Miles (mi\xB2)",value:"mi2",format:r=>(0,mt.Cf)("areaMI2")(r*3861e-10)},{label:"Acres",value:"acre2",format:r=>(0,mt.q2)("acre")(r*247105e-9)},{label:"Hectare",value:"hectare2",format:r=>(0,mt.q2)("ha")(r*1e-4)}],getUnit:r=>{const e=Qe[1].units;return r?.endsWith("2")||(r+="2"),e.find(t=>t.value===r)??e[0]}}];var nt=y(35819),Bt=y(57073),ts=y(14169),pn=y(96867),_n=y(84534),lt=y(92630),st=y(1595),pt=y(8727),nr=y(7889),sr=y(45759),ne=y(7823),Ui=y(52343);class ia{constructor(e){this.rbush_=new sr(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,ne.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,ne.sq)(a)]=l}this.rbush_.load(i)}remove(e){const t=(0,ne.sq)(e),i=this.items_[t];return delete this.items_[t],this.rbush_.remove(i)!==null}update(e,t){const i=this.items_[(0,ne.sq)(t)],n=[i.minX,i.minY,i.maxX,i.maxY];(0,S.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,S.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 is=ia,He={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var rr=y(77973);const Ze={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};var rt=y(15341);class ns{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=(0,rt.Pq)(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){const e=this.getScale();return new ns({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,ne.O3)()}getImage(e){return(0,ne.O3)()}getHitDetectionImage(){return(0,ne.O3)()}getPixelRatio(e){return 1}getImageState(){return(0,ne.O3)()}getImageSize(){return(0,ne.O3)()}getOrigin(){return(0,ne.O3)()}getSize(){return(0,ne.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,rt.Pq)(e)}listenImageChange(e){(0,ne.O3)()}load(){(0,ne.O3)()}unlistenImageChange(e){(0,ne.O3)()}}const or=ns;var _t=y(51667);function Ft(r){return Array.isArray(r)?(0,_t.BB)(r):r}var Ue=y(72508),V=y(97736);class ss extends or{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 ss({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,Ue.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 Ze.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 k=n;n=s,s=k}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,F=Math.sqrt(v*v+E*E)/v;if(F<=i){const k=F*t/2-s-n;return 2*Math.max(_,k)}return _*2}createRenderOptions(){let e=V.rc,t=0,i=null,n=0,s,o=0;this.stroke_&&(s=this.stroke_.getColor(),s===null&&(s=V.Tx),s=Ft(s),o=this.stroke_.getWidth(),o===void 0&&(o=V.yC),i=this.stroke_.getLineDash(),n=this.stroke_.getLineDashOffset(),e=this.stroke_.getLineJoin(),e===void 0&&(e=V.rc),t=this.stroke_.getMiterLimit(),t===void 0&&(t=V.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=V.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,_t._2)(t)),t===null?i=1:Array.isArray(t)&&(i=t.length===4?t[3]:1),i===0){const n=(0,Ue.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=V.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 Je=ss;class rs extends Je{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 rs({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 It=rs;class os{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null}clone(){const e=this.getColor();return new os({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){this.color_=e}}const Ae=os;class as{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 as({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 Oe=as;class Ht{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=lr,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_=lr,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,ie.h)(typeof r.getZIndex=="function",41),t=[r]),e=function(){return t}}return e}let ls=null;function sa(r,e){if(!ls){const t=new Ae({color:"rgba(255,255,255,0.4)"}),i=new Oe({color:"#3399CC",width:1.25});ls=[new Ht({image:new It({fill:t,stroke:i,radius:5}),fill:t,stroke:i})]}return ls}function ar(){const r={},e=[255,255,255,1],t=[0,153,255,1],i=3;return r.Polygon=[new Ht({fill:new Ae({color:[255,255,255,.5]})})],r.MultiPolygon=r.Polygon,r.LineString=[new Ht({stroke:new Oe({color:e,width:i+2})}),new Ht({stroke:new Oe({color:t,width:i})})],r.MultiLineString=r.LineString,r.Circle=r.Polygon.concat(r.LineString),r.Point=[new Ht({image:new It({radius:i*2,fill:new Ae({color:t}),stroke:new Oe({color:e,width:i/2})}),zIndex:1/0})],r.MultiPoint=r.Point,r.GeometryCollection=r.Polygon.concat(r.LineString,r.Point),r}function lr(r){return r.getGeometry()}const _e=Ht;var hr=y(94362),cr=y(89360),ur=y(80628),et=y(18879);class lu 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_=hs(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 hs(r,e,t){const i=r;let n=!0,s=!1,o=!1;const a=[(0,et.Vx)(i,lt.Z.LOAD,function(){o=!0,s||e()})];return i.src&&ur.Tp?(s=!0,i.decode().then(function(){n&&e()}).catch(function(l){n&&(o?e():t())})):a.push((0,et.Vx)(i,lt.Z.ERROR,t)),function(){n=!1,a.forEach(et.bN)}}const hu=null;let Xi=null;class ra extends hr.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_===Ze.LOADED){Xi||(Xi=(0,Ue.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(lt.Z.CHANGE)}handleImageError_(){this.imageState_=Ze.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Ze.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,Ue.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_===Ze.IDLE){this.image_||this.initializeImage_(),this.imageState_=Ze.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=hs(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Ze.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,_t.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=cr.c.get(e,i,s);return o||(o=new ra(r,e,t,i,n,s),cr.c.set(e,i,s,o)),o}const cu=null;class cs extends or{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,ie.h)(!(a!==void 0&&o),4),(0,ie.h)(!o||o&&this.imgSize_,5),(a===void 0||a.length===0)&&o&&(a=o.src||(0,ne.sq)(o)),(0,ie.h)(a!==void 0&&a.length>0,6),(0,ie.h)(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),69);const l=e.src!==void 0?Ze.IDLE:Ze.LOADED;if(this.color_=e.color!==void 0?(0,_t._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 cs({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(lt.Z.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(lt.Z.CHANGE,e)}}const xn=cs,aa="#333";class us{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.scaleArray_=(0,rt.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 Ae({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 us({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,rt.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 yi=us;function dr(r){return new _e({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 Ae({color:t})}function Yi(r,e){const t=r[e+"stroke-width"],i=r[e+"stroke-color"];if(!(!t&&!i))return new Oe({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 yi({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 Je({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 It({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 fr={RENDER_ORDER:"renderOrder"};class ca extends rr.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(fr.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 sr(9)),this.getRenderer().renderDeclutter(e)}setRenderOrder(e){this.set(fr.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 _e)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 _e?n[s]=o:n[s]=dr(o)}t=n}else t=dr(e);this.style_=t,this.styleFunction_=e===null?void 0:na(this.style_),this.changed()}}const ds=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],gr=[ji.CLOSE_PATH],le=ji;var ua=y(63313);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 mr=da;var tt=y(43911),$t=y(65603);class fa extends mr{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,S.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,S.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([le.CUSTOM,a,u,e,i,$t.ug]),this.hitDetectionInstructions.push([le.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([le.CUSTOM,a,c,e,i,$t.o1]),this.hitDetectionInstructions.push([le.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([le.CUSTOM,a,h,e,i,$t.Ml]),this.hitDetectionInstructions.push([le.CUSTOM,a,h,e,n||i,$t.Ml]);break;case"MultiPoint":l=e.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([le.CUSTOM,a,h,e,i,$t.Ml]),this.hitDetectionInstructions.push([le.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([le.CUSTOM,a,h,e,i]),this.hitDetectionInstructions.push([le.CUSTOM,a,h,e,n||i]);break;default:}this.endGeometry(t)}beginGeometry(e,t){this.beginGeometryInstruction1_=[le.BEGIN_GEOMETRY,t,0,e],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[le.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==le.END_GEOMETRY?o=t:s==le.BEGIN_GEOMETRY&&(n[2]=t,(0,tt.FZ)(this.hitDetectionInstructions,o,t),o=-1)}setFillStrokeStyle(e,t){const i=this.state;if(e){const n=e.getColor();i.fillStyle=Ft(n||V.bL)}else i.fillStyle=void 0;if(t){const n=t.getColor();i.strokeStyle=Ft(n||V.Tx);const s=t.getLineCap();i.lineCap=s!==void 0?s:V.mb;const o=t.getLineDash();i.lineDash=o?o.slice():V.X9;const a=t.getLineDashOffset();i.lineDashOffset=a||V.He;const l=t.getLineJoin();i.lineJoin=l!==void 0?l:V.rc;const h=t.getWidth();i.lineWidth=h!==void 0?h:V.yC;const c=t.getMiterLimit();i.miterLimit=c!==void 0?c:V.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=[le.SET_FILL_STYLE,t];return typeof t!="string"&&i.push(!0),i}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[le.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,tt.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=[le.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=(0,S.d9)(this.maxExtent),this.maxLineWidth>0)){const e=this.resolution*(this.maxLineWidth+1)/2;(0,S.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([le.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([le.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([le.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([le.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 pa 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=[le.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([le.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,V.X9,V.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([le.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 _a=pa;var xa=y(58927);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=[le.MOVE_TO_LINE_TO,u,d];this.instructions.push(g),this.hitDetectionInstructions.push(g),a&&(this.instructions.push(gr),this.hitDetectionInstructions.push(gr)),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([le.SET_FILL_STYLE,V.bL]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([le.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=[le.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([le.SET_FILL_STYLE,V.bL]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([le.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([le.SET_FILL_STYLE,V.bL]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([le.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],F=e[u+1];f!==void 0&&(w=L-f,E=F-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=F}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,S.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!=V.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([le.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,g==V.oB?V.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([le.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||V.PH,justify:t.justify,textBaseline:t.textBaseline||V.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([le.DRAW_CHARS,e,t,h,n.overflow,a,n.maxAngle,l,c,s,d*l,u,o,1]),this.hitDetectionInstructions.push([le.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()||V.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()||V.mb,s.lineDash=f?f.slice():V.X9,s.lineDashOffset=m===void 0?V.He:m,s.lineJoin=a.getLineJoin()||V.rc,s.lineWidth=_===void 0?V.yC:_,s.miterLimit=v===void 0?V.V4:v,s.strokeStyle=Ft(a.getColor()||V.Tx)}i=this.textState_;const l=e.getFont()||V.Df;(0,V.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()||V.ru,i.backgroundFill=e.getBackgroundFill(),i.backgroundStroke=e.getBackgroundStroke(),i.padding=e.getPadding()||V.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,ne.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,ne.sq)(n.fillStyle):""}this.declutterImageWithText_=t}}const Ca={Circle:pr,Default:Hi,Image:ma,LineString:_a,Polygon:pr,Text:Ea};class wa{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=Ca[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[t]=s}return s}}const _r=wa;var fs=y(65085);class Sa extends fs.Z{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.declutterExecutorGroup=null}getFeatures(e){return(0,ne.O3)()}getData(e){return null}prepareFrame(e){return(0,ne.O3)()}renderFrame(e,t){return(0,ne.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()===Ze.LOADED&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Ze.LOADED&&t!=Ze.ERROR&&e.addEventListener(lt.Z.CHANGE,this.boundHandleImageChange_),t==Ze.IDLE&&(e.load(),t=e.getState()),t==Ze.LOADED}renderIfReadyAndVisible(){const e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}const xr=Sa;var vn=y(35143),Jt=y(44072),se=y(23667);const yr=[];let vi=null;function Ta(){vi=(0,Ue.E4)(1,1,void 0,{willReadFrequently:!0})}class Ia extends xr{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=(0,se.Ue)(),this.pixelTransform=(0,se.Ue)(),this.inversePixelTransform=(0,se.Ue)(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(e,t,i){vi||Ta(),vi.clearRect(0,0,1,1);let n;try{vi.drawImage(e,t,i,1,1,0,0,1,1),n=vi.getImageData(0,0,1,1).data}catch{return vi=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,tt.fS)((0,_t._2)(e.style.backgroundColor),(0,_t._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,Ue.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,S.rL)(i),s=(0,S.Xv)(i),o=(0,S.w$)(i),a=(0,S.hC)(i);(0,se.nn)(t.coordinateToPixelTransform,n),(0,se.nn)(t.coordinateToPixelTransform,s),(0,se.nn)(t.coordinateToPixelTransform,o),(0,se.nn)(t.coordinateToPixelTransform,a);const l=this.inversePixelTransform;(0,se.nn)(l,n),(0,se.nn)(l,s),(0,se.nn)(l,o),(0,se.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,se.qC)(this.tempTransform,l,h,c,u,-i,d,g)}disposeInternal(){delete this.frameState,super.disposeInternal()}}const vr=Ia;var Ie=y(29857),qt=y(63257);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,Ie.t7)(f,d,E),F=(0,Ie.t7)(m,g,E),k=e-i,B=v,Z=s+a*l(h,n,c);for(;e<t-i&&v+_<Z;)w();E=_===0?0:(Z-v)/_;const ee=(0,Ie.t7)(f,d,E),q=(0,Ie.t7)(m,g,E);let fe;if(u){const $=[L,F,ee,q];(0,qt.U1)($,0,4,2,u,$,$),fe=$[0]>$[2]}else fe=L>ee;const ge=Math.PI,oe=[],ke=k+i===e;e=k,_=0,v=B,d=r[e],g=r[e+1];let ue;if(ke){w(),ue=Math.atan2(g-m,d-f),fe&&(ue+=ue>0?-ge:ge);const $=(ee+L)/2,X=(q+F)/2;return oe[0]=[$,X,(Z-s)/2,ue,n],oe}n=n.replace(/\n/g," ");for(let $=0,X=n.length;$<X;){w();let J=Math.atan2(g-m,d-f);if(fe&&(J+=J>0?-ge:ge),ue!==void 0){let Re=J-ue;if(Re+=Re>ge?-2*ge:Re<-ge?2*ge:0,Math.abs(Re)>o)return null}ue=J;const Te=$;let Me=0;for(;$<X;++$){const Re=fe?X-$-1:$,Be=a*l(h,n[Re],c);if(e+i<t&&v+_<s+Me+Be/2)break;Me+=Be}if($===Te)continue;const je=fe?n.substring(X-Te,X-$):n.substring(Te,$);E=_===0?0:(s+Me/2-v)/_;const W=(0,Ie.t7)(f,d,E),ut=(0,Ie.t7)(m,g,E);oe.push([W,ut,Me/2,J,je]),s+=Me}return oe}var ba=y(52599);const Ei=(0,S.lJ)(),Qt=[],Gt=[],zt=[],ei=[];function Er(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 Ma(r,e,t){return t>0&&r.push(`
`,""),r.push(e,""),r}class Fa{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,se.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||V.PH),g=n&&o.lineWidth?o.lineWidth:0,f=u?e:e.split(`
`).reduce(Ma,[]),{width:m,height:_,widths:v,heights:w,lineWidths:E}=(0,V.Zw)(l,f),L=m+g,F=[],k=(L+2)*c[0],B=(_+g)*c[1],Z={width:k<0?Math.floor(k):Math.ceil(k),height:B<0?Math.floor(B):Math.ceil(B),contextInstructions:F};(c[0]!=1||c[1]!=1)&&F.push("scale",c),n&&(F.push("strokeStyle",o.strokeStyle),F.push("lineWidth",g),F.push("lineCap",o.lineCap),F.push("lineJoin",o.lineJoin),F.push("miterLimit",o.miterLimit),F.push("setLineDash",[o.lineDash]),F.push("lineDashOffset",o.lineDashOffset)),i&&F.push("fillStyle",a.fillStyle),F.push("textBaseline","middle"),F.push("textAlign","center");const ee=.5-d;let q=d*L+ee*g;const fe=[],ge=[];let oe=0,ke=0,ue=0,$=0,X;for(let J=0,Te=f.length;J<Te;J+=2){const Me=f[J];if(Me===`
`){ke+=oe,oe=0,q=d*L+ee*g,++$;continue}const je=f[J+1]||l.font;je!==X&&(n&&fe.push("font",je),i&&ge.push("font",je),X=je),oe=Math.max(oe,w[ue]);const W=[Me,q+ee*v[ue]+d*(v[ue]-E[$]),.5*(g+oe)+ke];q+=v[ue],n&&fe.push("strokeText",W),i&&ge.push("fillText",W),++ue}return Array.prototype.push.apply(F,fe),Array.prototype.push.apply(F,ge),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,F=f[3]+E*d[0]+f[1],k=f[0]+L*d[1]+f[2],B=v-f[3],Z=w-f[0];(m||u!==0)&&(Qt[0]=B,ei[0]=B,Qt[1]=Z,Gt[1]=Z,Gt[0]=B+F,zt[0]=Gt[0],zt[1]=Z+k,ei[1]=zt[1]);let ee;return u!==0?(ee=(0,se.qC)((0,se.Ue)(),i,n,1,1,u,-i,-n),(0,se.nn)(ee,Qt),(0,se.nn)(ee,Gt),(0,se.nn)(ee,zt),(0,se.nn)(ee,ei),(0,S.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]),Ei)):(0,S.T9)(Math.min(B,B+F),Math.min(Z,Z+k),Math.max(B,B+F),Math.max(Z,Z+k),Ei),g&&(v=Math.round(v),w=Math.round(w)),{drawImageX:v,drawImageY:w,drawImageW:E,drawImageH:L,originX:h,originY:c,declutterBox:{minX:Ei[0],minY:Ei[1],maxX:Ei[2],maxY:Ei[3],value:_},canvasTransform:ee,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,V._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,se.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||V.PH),c=Ki[s.textBaseline||V.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,tt.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,se.lk)(this.renderedTransform_,i));let c=0;const u=n.length;let d=0,g,f,m,_,v,w,E,L,F,k,B,Z,ee=0,q=0,fe=null,ge=null;const oe=this.coordinateCache_,ke=this.viewRotation_,ue=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,$={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:ke},X=this.instructions!=n||this.overlaps?0:200;let J,Te,Me,je;for(;c<u;){const W=n[c];switch(W[0]){case le.BEGIN_GEOMETRY:J=W[1],je=W[3],J.getGeometry()?a!==void 0&&!(0,S.kK)(a,je.getExtent())?c=W[2]+1:++c:c=W[2];break;case le.BEGIN_PATH:ee>X&&(this.fill_(e),ee=0),q>X&&(e.stroke(),q=0),!ee&&!q&&(e.beginPath(),_=NaN,v=NaN),++c;break;case le.CIRCLE:d=W[1];const Re=h[d],Be=h[d+1],oi=h[d+2],kt=h[d+3],Ke=oi-Re,Xt=kt-Be,Bi=Math.sqrt(Ke*Ke+Xt*Xt);e.moveTo(Re+Bi,Be),e.arc(Re,Be,Bi,0,2*Math.PI,!0),++c;break;case le.CLOSE_PATH:e.closePath(),++c;break;case le.CUSTOM:d=W[1],g=W[2];const Yn=W[3],Gi=W[4],jn=W.length==6?W[5]:void 0;$.geometry=Yn,$.feature=J,c in oe||(oe[c]=[]);const ai=oe[c];jn?jn(h,d,g,2,ai):(ai[0]=h[d],ai[1]=h[d+1],ai.length=2),Gi(ai,$),++c;break;case le.DRAW_IMAGE:d=W[1],g=W[2],L=W[3],f=W[4],m=W[5];let ln=W[6];const li=W[7],Hn=W[8],Kn=W[9],$n=W[10];let zi=W[11];const qs=W[12];let ot=W[13];const wt=W[14],Mt=W[15];if(!L&&W.length>=20){F=W[19],k=W[20],B=W[21],Z=W[22];const dt=this.drawLabelWithPointPlacement_(F,k,B,Z);L=dt.label,W[3]=L;const Zi=W[23];f=(dt.anchorX-Zi)*this.pixelRatio,W[4]=f;const St=W[24];m=(dt.anchorY-St)*this.pixelRatio,W[5]=m,ln=L.height,W[6]=ln,ot=L.width,W[13]=ot}let Vt;W.length>25&&(Vt=W[25]);let Wi,_i,hi;W.length>17?(Wi=W[16],_i=W[17],hi=W[18]):(Wi=V.oB,_i=!1,hi=!1),$n&&ue?zi+=ke:!$n&&!ue&&(zi-=ke);let Ni=0;for(;d<g;d+=2){if(Vt&&Vt[Ni++]<ot/this.pixelRatio)continue;const dt=this.calculateImageOrLabelDimensions_(L.width,L.height,h[d],h[d+1],ot,ln,f,m,Hn,Kn,zi,qs,s,Wi,_i||hi,J),Zi=[e,t,L,dt,li,_i?fe:null,hi?ge:null];if(l){if(wt==="none")continue;if(wt==="obstacle"){l.insert(dt.declutterBox);continue}else{let St,Yt;if(Mt){const ft=g-d;if(!Mt[ft]){Mt[ft]=Zi;continue}if(St=Mt[ft],delete Mt[ft],Yt=Er(St),l.collides(Yt))continue}if(l.collides(dt.declutterBox))continue;St&&(l.insert(Yt),this.replayImageOrLabel_.apply(this,St)),l.insert(dt.declutterBox)}}this.replayImageOrLabel_.apply(this,Zi)}++c;break;case le.DRAW_CHARS:const Jn=W[1],it=W[2],Qs=W[3],ru=W[4];Z=W[5];const ou=W[6],Ko=W[7],$o=W[8];B=W[9];const er=W[10];F=W[11],k=W[12];const Jo=[W[13],W[13]],tr=this.textStates[k],hn=tr.font,cn=[tr.scale[0]*Ko,tr.scale[1]*Ko];let un;hn in this.widths_?un=this.widths_[hn]:(un={},this.widths_[hn]=un);const qo=(0,ba.W)(h,Jn,it,2),Qo=Math.abs(cn[0])*(0,V.Kd)(hn,F,un);if(ru||Qo<=qo){const dt=this.textStates[k].textAlign,Zi=(qo-Qo)*Ki[dt],St=Ra(h,Jn,it,2,F,Zi,ou,Math.abs(cn[0]),V.Kd,hn,un,ue?0:this.viewRotation_);e:if(St){const Yt=[];let ft,qn,Qn,at,Tt;if(B)for(ft=0,qn=St.length;ft<qn;++ft){Tt=St[ft],Qn=Tt[4],at=this.createLabel(Qn,k,"",B),f=Tt[2]+(cn[0]<0?-er:er),m=Qs*at.height+(.5-Qs)*2*er*cn[1]/cn[0]-$o;const jt=this.calculateImageOrLabelDimensions_(at.width,at.height,Tt[0],Tt[1],at.width,at.height,f,m,0,0,Tt[3],Jo,!1,V.oB,!1,J);if(l&&l.collides(jt.declutterBox))break e;Yt.push([e,t,at,jt,1,null,null])}if(Z)for(ft=0,qn=St.length;ft<qn;++ft){Tt=St[ft],Qn=Tt[4],at=this.createLabel(Qn,k,Z,""),f=Tt[2],m=Qs*at.height-$o;const jt=this.calculateImageOrLabelDimensions_(at.width,at.height,Tt[0],Tt[1],at.width,at.height,f,m,0,0,Tt[3],Jo,!1,V.oB,!1,J);if(l&&l.collides(jt.declutterBox))break e;Yt.push([e,t,at,jt,1,null,null])}l&&l.load(Yt.map(Er));for(let jt=0,au=Yt.length;jt<au;++jt)this.replayImageOrLabel_.apply(this,Yt[jt])}}++c;break;case le.END_GEOMETRY:if(o!==void 0){J=W[1];const dt=o(J,je);if(dt)return dt}++c;break;case le.FILL:X?ee++:this.fill_(e),++c;break;case le.MOVE_TO_LINE_TO:for(d=W[1],g=W[2],Te=h[d],Me=h[d+1],w=Te+.5|0,E=Me+.5|0,(w!==_||E!==v)&&(e.moveTo(Te,Me),_=w,v=E),d+=2;d<g;d+=2)Te=h[d],Me=h[d+1],w=Te+.5|0,E=Me+.5|0,(d==g-2||w!==_||E!==v)&&(e.lineTo(Te,Me),_=w,v=E);++c;break;case le.SET_FILL_STYLE:fe=W,this.alignFill_=W[2],ee&&(this.fill_(e),ee=0,q&&(e.stroke(),q=0)),e.fillStyle=W[1],++c;break;case le.SET_STROKE_STYLE:ge=W,q&&(e.stroke(),q=0),this.setStrokeStyle_(e,W),++c;break;case le.STROKE:X?q++:e.stroke(),++c;break;default:++c;break}}ee&&this.fill_(e),q&&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=Fa,gs=["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,se.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,se.qC)(this.hitDetectionTransform_,n+.5,n+.5,1/t,-1/t,-i,-e[0],-e[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=(0,Ue.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,S.lJ)(),(0,S.Wj)(u,e),(0,S.f3)(u,t*(this.renderBuffer_+n),u));const d=Aa(n);let g;function f(F,k){const B=c.getImageData(0,0,a,a).data;for(let Z=0,ee=d.length;Z<ee;Z++)if(B[d[Z]]>0){if(!o||g!=="Image"&&g!=="Text"||o.includes(F)){const q=(d[Z]-3)/4,fe=n-q%a,ge=n-(q/a|0),oe=s(F,k,fe*fe+ge*ge);if(oe)return oe}c.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(tt.j2);let _,v,w,E,L;for(_=m.length-1;_>=0;--_){const F=m[_].toString();for(w=this.executorsByZIndex_[F],v=gs.length-1;v>=0;--v)if(g=gs[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(tt.j2),this.maxExtent_&&(e.save(),this.clip(e,i)),o=o||gs;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 ms={};function Aa(r){if(ms[r]!==void 0)return ms[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 ms[r]=n,n}const wr=Da;var Ci=y(94968),$i=y(85358);class Oa extends mr{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,Ie.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,se.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,se.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,S.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,S.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,S.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,S.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,S.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,S.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,tt.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:V.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||V.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||V.X9;this.strokeState_={lineCap:n!==void 0?n:V.mb,lineDash:this.pixelRatio_===1?c:c.map(u=>u*this.pixelRatio_),lineDashOffset:(o||V.He)*this.pixelRatio_,lineJoin:a!==void 0?a:V.rc,lineWidth:(l!==void 0?l:V.yC)*this.pixelRatio_,miterLimit:h!==void 0?h:V.V4,strokeStyle:Ft(i||V.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||V.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:V.mb,lineDash:m||V.X9,lineDashOffset:_||V.He,lineJoin:v!==void 0?v:V.rc,lineWidth:w!==void 0?w:V.yC,miterLimit:E!==void 0?E:V.V4,strokeStyle:Ft(g||V.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:V.Df,textAlign:u!==void 0?u:V.PH,textBaseline:d!==void 0?d:V.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,Pt=.5;function Ba(r,e,t,i,n,s,o){const a=r[0]*Pt,l=r[1]*Pt,h=(0,Ue.E4)(a,l);h.imageSmoothingEnabled=!1;const c=h.canvas,u=new ka(h,Pt,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 F=(_*g).toString(16).padStart(7,"#00000");for(let k=0,B=E.length;k<B;++k){const Z=E[k],ee=Z.getGeometryFunction()(v);if(!ee||!(0,S.kK)(n,ee.getExtent()))continue;const q=Z.clone(),fe=q.getFill();fe&&fe.setColor(F);const ge=q.getStroke();ge&&(ge.setColor(F),ge.setLineDash(null)),q.setText(void 0);const oe=Z.getImage();if(oe&&oe.getOpacity()!==0){const X=oe.getImageSize();if(!X)continue;const J=(0,Ue.E4)(X[0],X[1],void 0,{alpha:!1}),Te=J.canvas;J.fillStyle=F,J.fillRect(0,0,Te.width,Te.height),q.setImage(new xn({img:Te,imgSize:X,anchor:oe.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:oe.getOrigin(),opacity:1,size:oe.getSize(),scale:oe.getScale(),rotation:oe.getRotation(),rotateWithView:oe.getRotateWithView()}))}const ke=q.getZIndex()||0;let ue=f[ke];ue||(ue={},f[ke]=ue,ue.Polygon=[],ue.Circle=[],ue.LineString=[],ue.Point=[]);const $=ee.getType();if($==="GeometryCollection"){const X=ee.getGeometriesArrayRecursive();for(let J=0,Te=X.length;J<Te;++J){const Me=X[J];ue[Me.getType().replace("Multi","")].push(Me,q)}}else ue[$.replace("Multi","")].push(ee,q)}}const m=Object.keys(f).map(Number).sort(tt.j2);for(let _=0,v=m.length;_<v;++_){const w=f[m[_]];for(const E in w){const L=w[E];for(let F=0,k=L.length;F<k;F+=2){u.setStyle(L[F+1]);for(let B=0,Z=e.length;B<Z;++B)u.setTransform(e[B]),u.drawGeometry(L[F])}}}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])*Pt),s=Math.floor(Math.round(r[1])*Pt),o=((0,Ie.uZ)(n,0,t.width-1)+(0,Ie.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,Sr={Point:Ha,LineString:Va,Polygon:$a,MultiPoint:Ka,MultiLineString:Ya,MultiPolygon:ja,GeometryCollection:Xa,Circle:Za};function Wa(r,e){return parseInt((0,ne.sq)(r),10)-parseInt((0,ne.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 Tr(r,e,t,i,n,s,o){let a=!1;const l=t.getImage();if(l){const h=l.getImageState();h==Ze.LOADED||h==Ze.ERROR?l.unlistenImageChange(n):(h==Ze.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())Ir(r,a,t,e);else{const h=Sr[a.getType()];h(r,a,t,e,s)}}function Ir(r,e,t,i){if(e.getType()=="GeometryCollection"){const s=e.getGeometries();for(let o=0,a=s.length;o<a;++o)Ir(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=Sr[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()!=Ze.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()!=Ze.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 Ve=y(33836);class Ja extends vr{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,S.lJ)(),this.wrappedRenderedExtent_=(0,S.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[Ci.Z.ANIMATING]||g[Ci.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,S.dz)(c):null,L=w?Math.ceil((n[2]-c[2])/E)+1:1;let F=w?Math.floor((n[0]-c[0])/E):0;do{const k=this.getRenderTransform(o,a,h,d,_,v,F*E);e.execute(m,1,k,h,f,void 0,i)}while(++F<L)}setupCompositionContext_(){if(this.opacity_!==1){const e=(0,Ue.E4)(this.context.canvas.width,this.context.canvas.height,yr);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,Ue.jy)(this.compositionContext_),yr.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,se.n3)(this.pixelTransform,1/i,1/i),(0,se.nb)(this.inversePixelTransform,this.pixelTransform);const s=(0,se.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,P.dY)(n.extent,g);m=(0,S.kK)(_,e.extent),f=m&&!(0,S.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,se.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]*Pt,d=i[1]*Pt;c.push(this.getRenderTransform(n,s,o,Pt,u,d,0).slice());const g=h.getSource(),f=a.getExtent();if(g.getWrapX()&&a.canWrapX()&&!(0,S.r4)(f,l)){let m=l[0];const _=(0,S.dz)(f);let v=0,w;for(;m<f[0];)--v,w=_*v,c.push(this.getRenderTransform(n,s,o,Pt,u,d,w).slice()),m+=_;for(v=0,m=l[2];m>f[2];)++v,w=_*v,c.push(this.getRenderTransform(n,s,o,Pt,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,ne.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[Ci.Z.ANIMATING],s=e.viewHints[Ci.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,S.f3)(l,f*u),w=v.slice(),E=[v.slice()],L=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!(0,S.r4)(L,e.extent)){const $=(0,S.dz)(L),X=Math.max((0,S.dz)(v)/2,$);v[0]=L[0]-X,v[2]=L[2]+X,(0,Ve.Cf)(_,c);const J=(0,S.Cf)(E[0],c);J[0]<L[0]&&J[2]<L[2]?E.push([J[0]+$,J[1],J[2]+$,J[3]]):J[0]>L[0]&&J[2]>L[2]&&E.push([J[0]-$,J[1],J[2]-$,J[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==g&&this.renderedRenderOrder_==m&&(0,S.r4)(this.wrappedRenderedExtent_,v))return(0,tt.fS)(this.renderedExtent_,w)||(this.hitDetectionImageData_=null,this.renderedExtent_=w),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const F=new _r(ps(u,d),v,u,d);let k;this.getLayer().getDeclutter()&&(k=new _r(ps(u,d),v,u,d));const B=(0,P.Cs)();let Z;if(B){for(let $=0,X=E.length;$<X;++$){const J=E[$],Te=(0,P.Fj)(J,c);i.loadFeatures(Te,(0,P.on)(u,c),B)}Z=(0,P.WO)(B,c)}else for(let $=0,X=E.length;$<X;++$)i.loadFeatures(E[$],u,c);const ee=Na(u,d);let q=!0;const fe=$=>{let X;const J=$.getStyleFunction()||t.getStyleFunction();if(J&&(X=J($,u)),X){const Te=this.renderFeature($,ee,X,F,Z,k);q=q&&!Te}},ge=(0,P.Fj)(v,c),oe=i.getFeaturesInExtent(ge);m&&oe.sort(m);for(let $=0,X=oe.length;$<X;++$)fe(oe[$]);this.renderedFeatures_=oe,this.ready=q;const ke=F.finish(),ue=new wr(v,u,d,i.getOverlaps(),ke,t.getRenderBuffer());return k&&(this.declutterExecutorGroup=new wr(v,u,d,i.getOverlaps(),k.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_=ue,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=Tr(n,e,i[l],t,this.boundHandleStyleImageChange_,s,o)||a;else a=Tr(n,e,i,t,this.boundHandleStyleImageChange_,s,o);return a}}const qa=Ja;class Qa extends ds{constructor(e){super(e)}createRenderer(){return new qa(this)}}const Ye=Qa;var el=y(87046),tl=y(92263);class il extends tl.Z{constructor(e){super(),this.projection=(0,P.U2)(e.projection),this.attributions_=Rr(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_=Rr(e),this.changed()}setState(e){this.state_=e,this.changed()}}function Rr(r){return r?Array.isArray(r)?function(e){return r}:typeof r=="function"?r:function(e){return[r]}:null}const br=il;var Ji=y(81180);function Lr(r,e){return[[-1/0,-1/0,1/0,1/0]]}function du(r,e){return[r]}function fu(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 Fr(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 gu(r){Mr=r}class ti extends _n.ZP{constructor(e,t,i){super(e),this.feature=t,this.features=i}}class sl extends br{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,ie.h)(this.format_,7),this.loader_=Fr(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:Lr;const t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new is:null,this.loadedExtentsRtree_=new is,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 ts.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,ne.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(He.ADDFEATURE,e))}setupChangeEvents_(e,t){this.featureChangeKeys_[e]=[(0,et.oL)(t,lt.Z.CHANGE,this.handleFeatureChange_,this),(0,et.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,ie.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,ne.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,ne.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(He.ADDFEATURE))for(let s=0,o=i.length;s<o;s++)this.dispatchEvent(new ti(He.ADDFEATURE,i[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(He.ADDFEATURE,function(i){t||(t=!0,e.push(i.feature),t=!1)}),this.addEventListener(He.REMOVEFEATURE,function(i){t||(t=!0,e.remove(i.feature),t=!1)}),e.addEventListener(pn.Z.ADD,i=>{t||(t=!0,this.addFeature(i.element),t=!1)}),e.addEventListener(pn.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(et.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(He.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,tt.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,S.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,ne.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(He.CHANGEFEATURE,t))}hasFeature(e){const t=e.getId();return t!==void 0?t in this.idIndex_:(0,ne.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,S.r4)(c.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new ti(He.FEATURESLOADSTART)),this.loader_.call(this,l,t,i,c=>{--this.loadingExtentsCount_,this.dispatchEvent(new ti(He.FEATURESLOADEND,void 0,c))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new ti(He.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,S.fS)(n.extent,e))return i=n,!0}),i&&t.remove(i)}removeFeature(e){if(!e)return;const t=(0,ne.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,ne.sq)(e),i=this.featureChangeKeys_[t];if(!i)return;i.forEach(et.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(He.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,ie.h)(this.format_,7),this.url_=e,this.setLoader(Fr(e,this.format_))}}const xt=sl;var Wt=y(30312),Nt=y(77775);const Pr=0,qi=1,Dr=[0,0,0,0],wi=[],_s={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"};class xs extends _n.ZP{constructor(e,t,i){super(e),this.features=t,this.mapBrowserEvent=i}}class rl extends nr.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 is,this.pixelTolerance_=e.pixelTolerance!==void 0?e.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new Ye({source:new xt({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 ts.Z(this.source_.getFeatures()),this.source_.addEventListener(He.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(He.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(pn.Z.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(pn.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(lt.Z.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(e,t){if(!this.featuresBeingModified_){this.featuresBeingModified_=new ts.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 xs(_s.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(lt.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,S.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,S.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,S.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,S.hI)(d),g)}}}}writeCircleGeometry_(e,t){const i=t.getCenter(),n={feature:e,geometry:t,index:Pr,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,S.HK)(i),n);let a=t;const l=(0,P.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 st.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==pt.Z.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(e),this.vertexFeature_&&this.deleteCondition_(e)&&(e.type!=pt.Z.SINGLECLICK||!this.ignoreNextSingleClick_?t=this.removePoint():t=!0),e.type==pt.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===Pr)this.changingFeature_=!0,c.setCenter(t),this.changingFeature_=!1;else{this.changingFeature_=!0;const m=e.map.getView().getProjection();let _=(0,Ve.TE)((0,P.Vs)(c.getCenter(),m),(0,P.Vs)(t,m));const v=(0,P.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,S.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,ne.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 _=Or(t,d,n);(0,Ve.fS)(_,o)&&!h[f][0]&&(this.dragSegments_.push([d,0]),h[f][0]=d);continue}if((0,Ve.fS)(g[0],o)&&!h[f][0]){this.dragSegments_.push([d,0]),h[f][0]=d;continue}if((0,Ve.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,ne.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,S.HK)(s),o);let l=n;const h=(0,P.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,S.hI)(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new xs(_s.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 Ar(n,h,s)-Ar(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 st.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,P.dY)((0,S.HK)(n,Dr),s),c=t.getView().getResolution()*this.pixelTolerance_,u=(0,P.Fj)((0,S.f3)(h,c,Dr),s);a=this.rBush_.getInExtent(u)}if(a&&a.length>0){const h=a.sort(o)[0],c=h.segment;let u=Or(n,h,s);const d=t.getPixelFromCoordinate(u);let g=(0,Ve.TE)(e,d);if(l||g<=this.pixelTolerance_){const f={};if(f[(0,ne.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,Ve.bI)(d,m),w=(0,Ve.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,ne.sq)(h.geometry)]=!0;for(let L=1,F=a.length;L<F;++L){const k=a[L].segment;if((0,Ve.fS)(c[0],k[0])&&(0,Ve.fS)(c[1],k[1])||(0,Ve.fS)(c[0],k[1])&&(0,Ve.fS)(c[1],k[0])){const B=(0,ne.sq)(a[L].geometry);B in E||(E[B]=!0,f[(0,ne.sq)(k)]=!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,S.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,S.hI)(u.segment),u),this.dragSegments_.push([u,0]),this.ignoreNextSingleClick_=!0}removePoint(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=pt.Z.POINTERDRAG){const e=this.lastPointerEvent_;this.willModifyFeatures_(e,this.dragSegments_);const t=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new xs(_s.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,ne.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,S.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,tt.fS)(s.depth,i))&&s.index>t&&(s.index+=n)})}}function ol(r,e){return r.index-e.index}function Ar(r,e,t){const i=e.geometry;if(i.getType()==="Circle"){let s=i;if(e.index===qi){const o=(0,P.Cs)();o&&(s=s.clone().transform(o,t));const a=(0,Ve.bI)(s.getCenter(),(0,P.Vs)(r,t)),l=Math.sqrt(a)-s.getRadius();return l*l}}const n=(0,P.Vs)(r,t);return wi[0]=(0,P.Vs)(e.segment[0],t),wi[1]=(0,P.Vs)(e.segment[1],t),(0,Ve.Bs)(n,wi)}function Or(r,e,t){const i=e.geometry;if(i.getType()==="Circle"&&e.index===qi){let s=i;const o=(0,P.Cs)();return o&&(s=s.clone().transform(o,t)),(0,P.lO)(s.getClosestPoint((0,P.Vs)(r,t)),t)}const n=(0,P.Vs)(r,t);return wi[0]=(0,P.Vs)(e.segment[0],t),wi[1]=(0,P.Vs)(e.segment[1],t),(0,P.lO)((0,Ve.oL)(n,wi),t)}function al(){const r=ar();return function(e,t){return r.Point}}const ll=rl;var hl=y(59688);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,S.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,S.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,S.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 kr=En;var cl=y(51711),ul=y(53435),dl=y(61680),Cn=y(36760),fl=y(50044),Si=y(27822);const wn={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class Sn extends _n.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();Br(r,s,t)}return t}function Tn(r,e){return(0,Ie.bI)(r[0],r[1],e[0],e[1])}function Ti(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=Ii(r,i),h=Ii(r,n);return Tn(l,h)}let a=0;if(i<s){const l=Ii(r,i),h=Ti(r,s);a+=Tn(l,h)}if(o<n){const l=Ti(r,o),h=Ii(r,n);a+=Tn(l,h)}for(let l=s;l<o-1;++l){const h=Ti(r,l),c=Ti(r,l+1);a+=Tn(h,c)}return a}function Br(r,e,t){if(e instanceof nt.Z){Rn(r,e.getCoordinates(),!1,t);return}if(e instanceof Cn.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 Si.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)Br(r,i[n],t);return}}const ys={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=Gr(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=Ii(h.coordinates,l),d=t.getPixelFromCoordinate(u);(0,Ve.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 ys.index=a,ys.endIndex=l,ys}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=Gr(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 vs={along:0,squaredDistance:0};function Gr(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,Ie.uZ)(((r-n)*l+(e-s)*h)/(l*l+h*h),0,1),u+=l*c,d+=h*c),vs.along=c,vs.squaredDistance=(0,Ie.FH)((0,Ie.bI)(r,e,u,d),10),vs}function Ii(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 pl extends nr.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 kr([NaN,NaN]),h=(0,P.Vs)(s[0],a),c=(0,Ve.bI)(h,(0,P.Vs)(s[s.length-1],a));l.setCenterAndRadius(h,Math.sqrt(c),this.geometryLayout_);const u=(0,P.Cs)();return u&&l.transform(a,u),l};else{let s;n==="Point"?s=Bt.Z:n==="LineString"?s=nt.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 Ye({source:new xt({useSpatialIndex:!1,wrapX:e.wrapX?e.wrapX:!1}),style:e.style?e.style:_l(),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===lt.Z.CONTEXTMENU&&e.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(e);let t=e.type===pt.Z.POINTERMOVE,i=!0;return!this.freehand_&&this.lastDragTime_&&e.type===pt.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===pt.Z.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(e.coordinate),i=!1):this.freehand_&&e.type===pt.Z.POINTERDOWN?i=!1:t&&this.getPointerCount()<2?(i=e.type===pt.Z.POINTERMOVE,i&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):(e.originalEvent.pointerType==="mouse"||e.type===pt.Z.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(e)):e.type===pt.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(pt.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,S.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(Ti(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(Ti(e.coordinates,a))}n.length&&this.appendCoordinates(n)}updateTrace_(e){const t=this.traceState_;if(!t.active||t.targetIndex===-1&&(0,Ve.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=Ii(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 st.Z(new Bt.Z(e)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(e){this.sketchLine_||(this.sketchLine_=new st.Z);const t=e.getLinearRing(0);let i=this.sketchLine_.getGeometry();i?(i.setFlatCoordinates(t.getLayout(),t.getFlatCoordinates()),i.changed()):(i=new nt.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 st.Z(new nt.Z(this.sketchLineCoords_)));const n=this.geometryFunction_(this.sketchCoords_,void 0,t);this.sketchFeature_=new st.Z,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(n),this.updateSketchFeatures_(),this.dispatchEvent(new Sn(wn.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 Cn.Z([t])):this.type_==="MultiPolygon"&&e.setGeometry(new Si.Z([t])),this.dispatchEvent(new Sn(wn.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(wn.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 st.Z(new Bt.Z(n)),this.updateSketchFeatures_(),this.dispatchEvent(new Sn(wn.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 _l(){const r=ar();return function(e,t){return r[e.getGeometry().getType()]}}function mu(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 pu(){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=pl;var zr=y(71548);class Wr extends Ye{constructor(){super({source:new xt}),this.opts={action:"length",unit:"m"},this.segmentStyle=new _e({text:new yi({font:"12px Calibri,sans-serif",fill:new Ae({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Ae({color:"rgba(0, 0, 0, 0.4)"}),padding:[2,2,2,2],textBaseline:"bottom",offsetY:-12}),image:new Je({radius:6,points:3,angle:Math.PI,displacement:[0,8],fill:new Ae({color:"rgba(0, 0, 0, 0.4)"})})}),this.segmentStyles=[this.segmentStyle],this.shapeStyle=[new _e({fill:new Ae({color:"rgba(255, 255, 255, 0.2)"}),image:new It({radius:5,stroke:new Oe({color:"rgba(0, 0, 0, 0.7)"}),fill:new Ae({color:"rgba(255, 255, 255, 0.2)"})})}),new _e({stroke:new Oe({color:[0,0,0,1],width:2,lineDash:[4,8],lineDashOffset:6})}),new _e({stroke:new Oe({color:[255,255,255,1],width:2,lineDash:[4,8]})})],this.labelStyle=new _e({text:new yi({font:"14px Calibri,sans-serif",fill:new Ae({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Ae({color:"rgba(0, 0, 0, 0.7)"}),padding:[3,3,3,3],textBaseline:"bottom",offsetY:-15}),image:new Je({radius:8,points:3,angle:Math.PI,displacement:[0,10],fill:new Ae({color:"rgba(0, 0, 0, 0.7)"})})}),this.tipStyle=new _e({text:new yi({font:"12px Calibri,sans-serif",fill:new Ae({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Ae({color:"rgba(0, 0, 0, 0.4)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),this.modifyStyle=new _e({image:new It({radius:5,stroke:new Oe({color:"rgba(0, 0, 0, 0.7)"}),fill:new Ae({color:"rgba(0, 0, 0, 0.4)"})}),text:new yi({text:"Drag to modify",font:"12px Calibri,sans-serif",fill:new Ae({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Ae({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=Qe[0];return this.opts.action==="area"?(i=Qe[1],t=(0,zr.bg)(e)):t=(0,zr.xA)(e),(0,mt.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 nt.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 nt.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 Wr),i=El(di.vc.theme2),[n,s]=(0,p.useState)(!0),[o,a]=(0,p.useState)(!1),[l,h]=(0,p.useState)({action:Qe[0].value,unit:Qe[0].units[0].value}),c=(0,p.useMemo)(()=>{const f=Qe.find(_=>_.value===l.action)??Qe[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=Qe.find(m=>m.value===l.action)??Qe[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:Qe,size:"md",fullWidth:!1,onChange:f=>{r.removeInteraction(t.current.draw);const m=Qe.find(v=>v.value===f)??Qe[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(xi.Ph,{className:i.unitSelect,value:c.current,options:c.options,isSearchable:!1,onChange:f=>{const m=Qe.find(v=>v.value===l.action)??Qe[0],_=m.getUnit(f.value)??m.units[0];h({...l,unit:_.value})}})):p.createElement(es.h,{className:i.icon,name:"ruler-combined",tooltip:"show measure tools",tooltipPlacement:"left",onClick:g}))},El=(0,ir.B)(r=>({button:N.css`
    margin-left: auto;
  `,icon:N.css`
    background-color: ${r.colors.secondary.main};
    display: inline-block;
    height: 19.25px;
    margin: 1px;
    width: 19.25px;
  `,infoWrap:N.css`
    color: ${r.colors.text};
    background-color: ${r.colors.background.secondary};
    border-radius: 4px;
    padding: 2px;
  `,infoWrapClosed:N.css`
    height: 25.25px;
    width: 25.25px;
  `,rowGroup:N.css`
    display: flex;
    justify-content: flex-end;
  `,unitSelect:N.css`
    min-width: 200px;
  `}));var _u=y(81252),xu=y(2320);function Cl(r){return be.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 yt=y(91510),Zt=y(4182);class wl 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=y(21677),Nr=y(45383),Zr=y(15818),Sl=y(66385),Tl=y(1180),Il=y(55392),Rl=y(35239);function bl(r){const{layerName:e,styleConfig:t,layer:i}=r,n=(0,Ee.wW)(Ll),s=(0,bn.Z)(i?.__state?.mouseEvents??(0,Nr.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.get(_)},[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,N.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,Zr.fD)(o);if(u.isContinuous&&u.getColors){const f=u.getColors(di.vc.theme2),m=(0,Sl.dz)(o),_=o.display?v=>(0,mt.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,N.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,N.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:N.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:N.css`
    font-size: ${r.typography.body.fontSize};
  `,layerBody:N.css`
    padding-left: 10px;
  `,legend:N.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:N.css`
    white-space: nowrap;
  `,fixedColorContainer:N.css`
    min-width: 80px;
    font-size: ${r.typography.bodySmall.fontSize};
    padding-top: 5px;
  `,legendSymbol:N.css`
    height: 18px;
    width: 18px;
    margin: auto;
  `,colorScaleWrapper:N.css`
    min-width: 200px;
    font-size: ${r.typography.bodySmall.fontSize};
    padding-top: 10px;
  `});var Es=y(37497),H=y(29277),Rt=y(54805),ht=y(1163),vt=y(5263),Ml=y(58639),Fl=y(80461),Cs=y(6741),ws=y(93089),Ur=y(85968),ii=y(10459),Ss=y(55423),gi=y(44545),Xr=y(50274),Ln=y(98763),Pl=(r=>(r.circle="circle",r.square="square",r.triangle="triangle",r.star="star",r.cross="cross",r.x="x",r))(Pl||{});const Ri={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 bi(r){const e=r.opacity==null?.8:r.opacity;if(e===1)return new Ae({color:r.color});if(e>0){const t=(0,pe.Z)(r.color).setAlpha(e).toRgbString();return new Ae({color:t})}}function Dl(r){const e=r.opacity==null?.8:r.opacity;if(e===1)return new Oe({color:r.color,width:r.lineWidth??1});if(e>0){const t=(0,pe.Z)(r.color).setAlpha(e).toRgbString();return new Oe({color:t,width:r.lineWidth??1})}}const Dt=r=>{if(!r.text)return;const e=j.v.theme2.typography.fontFamily,t={...H.Er.textConfig,...r.textConfig};return new yi({text:r.text,fill:new Ae({color:r.color??H.Er.color.fixed}),font:`normal ${t.fontSize}px ${e}`,...t})},Al=r=>new _e({text:Dt(r)}),Vr=r=>{const e=new Oe({color:r.color,width:r.lineWidth??1});return new _e({image:new It({stroke:e,fill:bi(r),radius:r.size??H.Cg}),text:Dt(r),stroke:e})},Mn=r=>new _e({fill:bi(r),stroke:new Oe({color:r.color,width:r.lineWidth??1}),text:Dt(r)}),Ts=r=>new _e({fill:bi(r),stroke:Dl(r),text:Dt(r)}),Yr=r=>{const e=r.size??H.Cg,t=new Oe({color:"#F00",width:1});return[new _e({image:new Je({stroke:t,points:4,radius:e,angle:Math.PI/4})}),new _e({image:new Je({stroke:t,points:4,radius:e,radius2:0,angle:0})})]},Ol=[{id:"circle",name:"Circle",aliasIds:[Ri.circle],make:Vr},{id:"square",name:"Square",aliasIds:[Ri.square],make:r=>{const e=r.size??H.Cg,t=r.rotation??0;return new _e({image:new Je({stroke:new Oe({color:r.color,width:r.lineWidth??1}),fill:bi(r),points:4,radius:e,rotation:t*Math.PI/180+Math.PI/4}),text:Dt(r)})}},{id:"triangle",name:"Triangle",aliasIds:[Ri.triangle],make:r=>{const e=r.size??H.Cg,t=r.rotation??0;return new _e({image:new Je({stroke:new Oe({color:r.color,width:r.lineWidth??1}),fill:bi(r),points:3,radius:e,rotation:t*Math.PI/180,angle:0}),text:Dt(r)})}},{id:"star",name:"Star",aliasIds:[Ri.star],make:r=>{const e=r.size??H.Cg,t=r.rotation??0;return new _e({image:new Je({stroke:new Oe({color:r.color,width:r.lineWidth??1}),fill:bi(r),points:5,radius:e,radius2:e*.4,angle:0,rotation:t*Math.PI/180}),text:Dt(r)})}},{id:"cross",name:"Cross",aliasIds:[Ri.cross],make:r=>{const e=r.size??H.Cg,t=r.rotation??0;return new _e({image:new Je({stroke:new Oe({color:r.color,width:r.lineWidth??1}),points:4,radius:e,radius2:0,angle:0,rotation:t*Math.PI/180}),text:Dt(r)})}},{id:"x",name:"X",aliasIds:[Ri.x],make:r=>{const e=r.size??H.Cg,t=r.rotation??0;return new _e({image:new Je({stroke:new Oe({color:r.color,width:r.lineWidth??1}),points:4,radius:e,radius2:0,rotation:t*Math.PI/180+Math.PI/4}),text:Dt(r)})}}];async function kl(r,e){return fetch(r,{method:"GET"}).then(t=>t.text()).then(t=>{t=Xr.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 Ln.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:Vr;let t=Is.getIfExists(r);if(t)return t.make;if(r.endsWith(".svg")){const i=await kl((0,gi.getPublicOrAbsoluteUrl)(r));return t={id:r,name:r,aliasIds:[],make:i?n=>{const s=n.size??H.Cg,o=n.rotation??0;return[new _e({image:new xn({src:i,color:n.color,opacity:n.opacity??1,scale:(H.Cg+s)/100,rotation:o*Math.PI/180}),text:n?.text?Dt(n):void 0}),new _e({image:new Je({fill:new Ae({color:"rgba(0,0,0,0)"}),points:4,radius:n.size,rotation:o*Math.PI/180+Math.PI/4})})]}:Yr},Is.register(t),t.make}return Yr}function jr(r){const e=r?.text;return e?!!(e.mode===gi.TextDimensionMode.Fixed&&e.fixed?.length||e.mode===gi.TextDimensionMode.Field&&e.field?.length):!1}async function mi(r){r||(r=H.Er);const e=jr(r),t={},i=await Gl(r.symbol?.fixed,e),n={config:r,hasText:e,fields:t,base:{color:j.v.theme2.visualization.getColorByName(r.color?.fixed??H.Er.color.fixed),opacity:r.opacity??H.Er.opacity,lineWidth:r.lineWidth??1,size:r.size?.fixed??H.Er.size.fixed,rotation:r.rotation?.fixed??H.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??H.Er.textConfig,r.text?.field?.length&&(t.text=r.text.field)),Object.keys(t).length||(n.fields=void 0),n}const Li=({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,Nr.of)())?.geometryType===H.bD.Point,w=jr(r);return n?.simpleFixedValues?p.createElement(p.Fragment,null,v&&p.createElement(p.Fragment,null,p.createElement(Rt.Z,null,p.createElement(ht._,{label:"Symbol"},p.createElement(ii.Lv,{value:r?.symbol??H.Er.symbol,context:e,onChange:o,item:{settings:{resourceType:"icon",folderName:Ss.QS.Marker,placeholderText:w?"Select a symbol":"Select a symbol or add a text label",placeholderValue:H.Er.symbol.fixed,showSourceRadio:!1}}}))),p.createElement(vt.g,{label:"Rotation angle"},p.createElement(ii.k9,{value:r?.rotation??H.Er.rotation,context:e,onChange:h,item:{settings:{min:H.Er.rotation.min,max:H.Er.rotation.max}}}))),p.createElement(Rt.Z,null,p.createElement(ht._,{label:"Color",labelWidth:10},p.createElement(Ml.W,{width:4},p.createElement(Fl.zH,{color:r?.color?.fixed??H.Er.color.fixed,onChange:E=>{a({fixed:E})}})))),p.createElement(Rt.Z,null,p.createElement(ht._,{label:"Opacity",labelWidth:10,grow:!0},p.createElement(Ur.p,{value:r?.opacity??H.Er.opacity,context:e,onChange:l,item:{settings:{min:0,max:1,step:.1}}})))):p.createElement(p.Fragment,null,p.createElement(vt.g,{label:"Size"},p.createElement(ii.cL,{value:r?.size??H.Er.size,context:e,onChange:s,item:{settings:{min:1,max:100}}})),p.createElement(vt.g,{label:"Symbol"},p.createElement(ii.Lv,{value:r?.symbol??H.Er.symbol,context:e,onChange:o,item:{settings:{resourceType:"icon",folderName:Ss.QS.Marker,placeholderText:w?"Select a symbol":"Select a symbol or add a text label",placeholderValue:H.Er.symbol.fixed,showSourceRadio:!1}}})),p.createElement(vt.g,{label:"Color"},p.createElement(ii.Lm,{value:r?.color??H.Er.color,context:e,onChange:a,item:{}})),p.createElement(vt.g,{label:"Fill opacity"},p.createElement(Ur.p,{value:r?.opacity??H.Er.opacity,context:e,onChange:l,item:{settings:{min:0,max:1,step:.1}}})),n?.displayRotation&&p.createElement(vt.g,{label:"Rotation angle"},p.createElement(ii.k9,{value:r?.rotation??H.Er.rotation,context:e,onChange:h,item:{settings:{min:H.Er.rotation.min,max:H.Er.rotation.max}}})),p.createElement(vt.g,{label:"Text label"},p.createElement(ii.$2,{value:r?.text??Ss.qj,context:e,onChange:c,item:{}})),w&&p.createElement(p.Fragment,null,p.createElement(Cs.Lh,null,p.createElement(vt.g,{label:"Font size"},p.createElement(ws.w,{value:r?.textConfig?.fontSize??H.Er.textConfig.fontSize,context:e,onChange:u,item:{}})),p.createElement(vt.g,{label:"X offset"},p.createElement(ws.w,{value:r?.textConfig?.offsetX??H.Er.textConfig.offsetX,context:e,onChange:d,item:{}})),p.createElement(vt.g,{label:"Y offset"},p.createElement(ws.w,{value:r?.textConfig?.offsetY??H.Er.textConfig.offsetY,context:e,onChange:g,item:{}}))),p.createElement(vt.g,{label:"Align"},p.createElement(gn.S,{value:r?.textConfig?.textAlign??H.Er.textConfig.textAlign,onChange:f,options:[{value:H.H.Left,label:(0,C.capitalize)(H.H.Left)},{value:H.H.Center,label:(0,C.capitalize)(H.H.Center)},{value:H.H.Right,label:(0,C.capitalize)(H.H.Right)}]})),p.createElement(vt.g,{label:"Baseline"},p.createElement(gn.S,{value:r?.textConfig?.textBaseline??H.Er.textConfig.textBaseline,onChange:m,options:[{value:H.EQ.Top,label:(0,C.capitalize)(H.EQ.Top)},{value:H.EQ.Middle,label:(0,C.capitalize)(H.EQ.Middle)},{value:H.EQ.Bottom,label:(0,C.capitalize)(H.EQ.Bottom)}]}))))};class Fn extends xt{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 st.Z({frame:e,rowIndex:i,geometry:t.field.values.get(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 nt.Z(i.values.toArray().map(s=>s.getCoordinates()));this.addFeatureInternal(new st.Z({frame:e,rowIndex:0,geometry:n})),this.changed()}}var ct=y(52162);const Qi={style:H.Er,showLegend:!0},Rs="markers",Hr={type:Rs,name:"",config:Qi,location:{mode:yt.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 mi(n.style),o=await(0,Zt.cJ)(e.location),a=new Fn(o),l=new Ye({source:a}),h=new Es.t(1);let c=null;return n.showLegend&&(c=p.createElement(wl,{watch:h,initialSubProps:{},child:bl})),s.fields?l.setStyle(u=>{const d=u.get("rowIndex"),g=s.dims;if(!g||!(0,C.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,ct.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:Li,settings:{displayRotation:!0},defaultValue:Qi.style}).addBooleanSwitch({path:"config.showLegend",name:"Show legend",description:"Show map legend",defaultValue:Qi.showLegend})}}},defaultOptions:Qi};var Mi=y(80610);const Pn={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class Wl extends rr.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(Pn.PRELOAD)}setPreload(e){this.set(Pn.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(Pn.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(Pn.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}}const Nl=Wl;var ce=y(53153),Zl=y(48164);class Ul extends hr.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(lt.Z.CHANGE)}release(){this.state===ce.Z.ERROR&&this.setState(ce.Z.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let e=this.interimTile;do{if(e.getState()==ce.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()==ce.Z.LOADED){e.interimTile=null;break}else e.getState()==ce.Z.LOADING?t=e:e.getState()==ce.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!==ce.Z.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}load(){(0,ne.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=ce.Z.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=ce.Z.ERROR,this.unlistenImage_(),this.image_=Vl(),this.changed()}handleImageLoad_(){const e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=ce.Z.LOADED:this.state=ce.Z.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==ce.Z.ERROR&&(this.state=ce.Z.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==ce.Z.IDLE&&(this.state=ce.Z.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=hs(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function Vl(){const r=(0,Ue.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,P.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,S.dz)(n)==(0,S.dz)(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?(0,S.dz)(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?(0,S.dz)(this.targetProj_.getExtent()):null;const h=(0,S.rL)(i),c=(0,S.Xv)(i),u=(0,S.w$)(i),d=(0,S.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,S.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,F){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 F=Math.min(L[0][0],L[1][0],L[2][0]);Math.max(L[0][0],L[1][0],L[2][0])-F<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,S.hI)([s,o,a,l]),u=this.sourceWorldWidth_?(0,S.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,S.hI)([e,t,i,n]);f=(0,S.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,S.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,Ie.$W)(s[0],d)+(0,Ie.$W)(a[0],d))/2-(0,Ie.$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,S.lJ)();return this.triangles_.forEach(function(t,i,n){const s=t.source;(0,S.Wj)(e,s[0]),(0,S.Wj)(e,s[1]),(0,S.Wj)(e,s[2])}),e}getTriangles(){return this.triangles_}}const Kl=Hl;let bs;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 Ls(r,e){return Math.abs(r[e*4]-210)>2||Math.abs(r[e*4+3]-.75*255)>2}function $l(){if(bs===void 0){const r=(0,Ue.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;bs=Ls(e,0)||Ls(e,4)||Ls(e,8),(0,Ue.jy)(r),Fi.push(r.canvas)}return bs}function Qr(r,e,t,i){const n=(0,P.vs)(t,e,r);let s=(0,P._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,S.b8)(l,n)){const h=(0,P._Q)(r,s,n)/s;isFinite(h)&&h>0&&(s/=h)}return s}function Jl(r,e,t,i){const n=(0,S.qg)(t);let s=Qr(r,e,n,i);return(!isFinite(s)||s<=0)&&(0,S.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,Ue.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,S.lJ)();l.forEach(function(L,F,k){(0,S.l7)(f,L.extent)});const m=(0,S.dz)(f),_=(0,S.Cr)(f),v=(0,Ue.E4)(Math.round(t*m/i),Math.round(t*_/i),Fi);u||(v.imageSmoothingEnabled=!1);const w=t/i;l.forEach(function(L,F,k){const B=L.extent[0]-f[0],Z=-(L.extent[3]-f[3]),ee=(0,S.dz)(L.extent),q=(0,S.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,B*w,Z*w,ee*w,q*w)});const E=(0,S.rL)(o);return a.getTriangles().forEach(function(L,F,k){const B=L.source,Z=L.target;let ee=B[0][0],q=B[0][1],fe=B[1][0],ge=B[1][1],oe=B[2][0],ke=B[2][1];const ue=g((Z[0][0]-E[0])/s),$=g(-(Z[0][1]-E[1])/s),X=g((Z[1][0]-E[0])/s),J=g(-(Z[1][1]-E[1])/s),Te=g((Z[2][0]-E[0])/s),Me=g(-(Z[2][1]-E[1])/s),je=ee,W=q;ee=0,q=0,fe-=je,ge-=W,oe-=je,ke-=W;const ut=[[fe,ge,0,0,X-ue],[oe,ke,0,0,Te-ue],[0,0,fe,ge,J-$],[0,0,oe,ke,Me-$]],Re=(0,Ie.SV)(ut);if(Re){if(d.save(),d.beginPath(),$l()||!u){d.moveTo(X,J);const Be=4,oi=ue-X,kt=$-J;for(let Ke=0;Ke<Be;Ke++)d.lineTo(X+g((Ke+1)*oi/Be),J+g(Ke*kt/(Be-1))),Ke!=Be-1&&d.lineTo(X+g((Ke+1)*oi/Be),J+g((Ke+1)*kt/(Be-1)));d.lineTo(Te,Me)}else d.moveTo(X,J),d.lineTo(ue,$),d.lineTo(Te,Me);d.clip(),d.transform(Re[0],Re[2],Re[1],Re[3],ue,$),d.translate(f[0]-je,f[3]-W),d.scale(i/t,-i/t),d.drawImage(v.canvas,0,0),d.restore()}}),(0,Ue.jy)(v),Fi.push(v.canvas),c&&(d.save(),d.globalCompositeOperation="source-over",d.strokeStyle="black",d.lineWidth=1,a.getTriangles().forEach(function(L,F,k){const B=L.target,Z=(B[0][0]-E[0])/s,ee=-(B[0][1]-E[1])/s,q=(B[1][0]-E[0])/s,fe=-(B[1][1]-E[1])/s,ge=(B[2][0]-E[0])/s,oe=-(B[2][1]-E[1])/s;d.beginPath(),d.moveTo(q,fe),d.lineTo(Z,ee),d.lineTo(ge,oe),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,ce.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,S.Ed)(g,f):g;if((0,S.bg)(_)===0){this.state=ce.Z.EMPTY;return}const v=e.getExtent();v&&(m?m=(0,S.Ed)(m,v):m=v);const w=n.getResolution(this.wrappedTileCoord_[0]),E=Jl(e,i,_,w);if(!isFinite(E)||E<=0){this.state=ce.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=ce.Z.EMPTY;return}this.sourceZ_=t.getZForResolution(E);let F=this.triangulation_.calculateSourceExtent();if(m&&(e.canWrapX()?(F[1]=(0,Ie.uZ)(F[1],m[1],m[3]),F[3]=(0,Ie.uZ)(F[3],m[1],m[3])):F=(0,S.Ed)(F,m)),!(0,S.bg)(F))this.state=ce.Z.EMPTY;else{const k=t.getTileRangeForExtentAndZ(F,this.sourceZ_);for(let B=k.minX;B<=k.maxX;B++)for(let Z=k.minY;Z<=k.maxY;Z++){const ee=h(this.sourceZ_,B,Z,a);ee&&this.sourceTiles_.push(ee)}this.sourceTiles_.length===0&&(this.state=ce.Z.EMPTY)}}getImage(){return this.canvas_}reproject_(){const e=[];if(this.sourceTiles_.forEach(t=>{t&&t.getState()==ce.Z.LOADED&&e.push({extent:this.sourceTileGrid_.getTileCoordExtent(t.tileCoord),image:t.getImage()})}),this.sourceTiles_.length=0,e.length===0)this.state=ce.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=ce.Z.LOADED}this.changed()}load(){if(this.state==ce.Z.IDLE){this.state=ce.Z.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(t=>{const i=t.getState();if(i==ce.Z.IDLE||i==ce.Z.LOADING){e++;const n=(0,et.oL)(t,lt.Z.CHANGE,function(s){const o=t.getState();(o==ce.Z.LOADED||o==ce.Z.ERROR||o==ce.Z.EMPTY)&&((0,et.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()==ce.Z.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(et.bN),this.sourcesListenerKeys_=null}release(){this.canvas_&&((0,Ue.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 Pi(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 vr{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,S.lJ)(),this.tmpTileRange_=new to(0,0,0,0)}isDrawableTile(e){const t=this.getLayer(),i=e.getState(),n=t.getUseInterimTilesOnError();return i==ce.Z.LOADED||i==ce.Z.EMPTY||i==ce.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()==ce.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,se.nn)(t.pixelToCoordinateTransform,e.slice()),s=i.getExtent();if(s&&!(0,S.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()===ce.Z.EMPTY)return null;if(f.getState()!==ce.Z.LOADED)continue;const m=c.getOrigin(d),_=(0,rt.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,S.dz)(_)/v*h),L=Math.round((0,S.Cr)(_)/v*h),F=i.extent&&(0,P.dY)(i.extent,s);F&&(_=(0,S.Ed)(_,(0,P.dY)(i.extent,s)));const k=m*E/2/w,B=m*L/2/w,Z=[a[0]-k,a[1]-B,a[0]+k,a[1]+B],ee=g.getTileRangeForExtentAndZ(_,f),q={};q[f]={};const fe=this.createLoadedTileFinder(u,s,q),ge=this.tmpExtent,oe=this.tmpTileRange_;this.newTiles_=!1;const ke=l?(0,S.dY)(n.center,v,l,e.size):void 0;for(let ut=ee.minX;ut<=ee.maxX;++ut)for(let Re=ee.minY;Re<=ee.maxY;++Re){if(l&&!g.tileCoordIntersectsViewport([f,ut,Re],ke))continue;const Be=this.getTile(f,ut,Re,e);if(this.isDrawableTile(Be)){const Ke=(0,ne.sq)(this);if(Be.getState()==ce.Z.LOADED){q[f][Be.tileCoord.toString()]=Be;let Xt=Be.inTransition(Ke);Xt&&i.opacity!==1&&(Be.endTransition(Ke),Xt=!1),!this.newTiles_&&(Xt||!this.renderedTiles.includes(Be))&&(this.newTiles_=!0)}if(Be.getAlpha(Ke,e.time)===1)continue}const oi=g.getTileCoordChildTileRange(Be.tileCoord,oe,ge);let kt=!1;oi&&(kt=fe(f+1,oi)),kt||g.forEachTileCoordParentTileRange(Be.tileCoord,fe,oe,ge)}const ue=m/o*h/w;(0,se.qC)(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/h,1/h,l,-E/2,-L/2);const $=(0,se.BB)(this.pixelTransform);this.useContainer(t,$,this.getBackground(e));const X=this.context,J=X.canvas;(0,se.nb)(this.inversePixelTransform,this.pixelTransform),(0,se.qC)(this.tempTransform,E/2,L/2,ue,ue,0,-E/2,-L/2),J.width!=E||J.height!=L?(J.width=E,J.height=L):this.containerReused||X.clearRect(0,0,E,L),F&&this.clipUnrotated(X,e,F),u.getInterpolate()||(X.imageSmoothingEnabled=!1),this.preRender(X,e),this.renderedTiles.length=0;let Te=Object.keys(q).map(Number);Te.sort(tt.j2);let Me,je,W;i.opacity===1&&(!this.containerReused||u.getOpaque(e.viewState.projection))?Te=Te.reverse():(Me=[],je=[]);for(let ut=Te.length-1;ut>=0;--ut){const Re=Te[ut],Be=u.getTilePixelSize(Re,h,s),kt=g.getResolution(Re)/m,Ke=Be[0]*kt*ue,Xt=Be[1]*kt*ue,Bi=g.getTileCoordForCoordAndZ((0,S.rL)(Z),Re),Yn=g.getTileCoordExtent(Bi),Gi=(0,se.nn)(this.tempTransform,[w*(Yn[0]-Z[0])/m,w*(Z[3]-Yn[3])/m]),jn=w*u.getGutterForProjection(s),ai=q[Re];for(const ln in ai){const li=ai[ln],Hn=li.tileCoord,Kn=Bi[1]-Hn[1],$n=Math.round(Gi[0]-(Kn-1)*Ke),zi=Bi[2]-Hn[2],qs=Math.round(Gi[1]-(zi-1)*Xt),ot=Math.round(Gi[0]-Kn*Ke),wt=Math.round(Gi[1]-zi*Xt),Mt=$n-ot,Vt=qs-wt,Wi=f===Re,_i=Wi&&li.getAlpha((0,ne.sq)(this),e.time)!==1;let hi=!1;if(!_i)if(Me){W=[ot,wt,ot+Mt,wt,ot+Mt,wt+Vt,ot,wt+Vt];for(let Ni=0,Jn=Me.length;Ni<Jn;++Ni)if(f!==Re&&Re<je[Ni]){const it=Me[Ni];(0,S.kK)([ot,wt,ot+Mt,wt+Vt],[it[0],it[3],it[4],it[7]])&&(hi||(X.save(),hi=!0),X.beginPath(),X.moveTo(W[0],W[1]),X.lineTo(W[2],W[3]),X.lineTo(W[4],W[5]),X.lineTo(W[6],W[7]),X.moveTo(it[6],it[7]),X.lineTo(it[4],it[5]),X.lineTo(it[2],it[3]),X.lineTo(it[0],it[1]),X.clip())}Me.push(W),je.push(Re)}else X.clearRect(ot,wt,Mt,Vt);this.drawTileImage(li,e,ot,wt,Mt,Vt,jn,Wi),Me&&!_i?(hi&&X.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,S.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(X,e),i.extent&&X.restore(),X.imageSmoothingEnabled=!0,$!==J.style.transform&&(J.style.transform=$),this.container}drawTileImage(e,t,i,n,s,o,a,l){const h=this.getTileImage(e);if(!h)return;const c=(0,ne.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,ne.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,ne.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,ne.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,S.dY)(e.viewState.center,e.viewState.resolution,f,e.size):void 0;let _=0,v,w,E,L,F,k;for(k=g;k<=a;++k)for(w=i.getTileRangeForExtentAndZ(o,k,w),E=i.getResolution(k),L=w.minX;L<=w.maxX;++L)for(F=w.minY;F<=w.maxY;++F)f&&!i.tileCoordIntersectsViewport([k,L,F],m)||(a-k<=l?(++_,v=t.getTile(k,L,F,n,s),v.getState()==ce.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(k,L,F,s));t.updateCacheSize(_,s)}}const th=eh;class ih extends Nl{constructor(e){super(e)}createRenderer(){return new th(this)}}const Fs=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,ie.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,ie.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,ie.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 yu(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,Ps={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var Ds=y(25736),hh=y(10619);const Di=[0,0,0],ni=5;class ch{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,(0,ie.h)((0,tt.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,ie.h)(this.origins_.length==this.resolutions_.length,20));const i=e.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=(0,S.rL)(i)),(0,ie.h)(!this.origin_&&this.origins_||this.origin_&&!this.origins_,18),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,(0,ie.h)(this.tileSizes_.length==this.resolutions_.length,19)),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:Ds.S,(0,ie.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=Pi(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 Pi(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 Pi(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 Pi(h,h,c,c,i);const u=Math.floor(l*(s+1))-1,d=Math.floor(l*(o+1))-1;return Pi(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,rt.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,S.T9)(a,h,l,c,i)}getTileRangeForExtentAndZ(e,t,i){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,Di);const n=Di[1],s=Di[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,Di);const o=Di[1],a=Di[2];return Pi(n,o,s,a,i)}getTileCoordCenter(e){const t=this.getOrigin(e[0]),i=this.getResolution(e[0]),n=(0,rt.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,rt.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,S.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,rt.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,Ie.mD)(c,ni)-1,u=(0,Ie.mD)(u,ni)-1):(c=(0,Ie.GW)(c,ni),u=(0,Ie.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,rt.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,Ie.mD)(h,ni)-1,c=(0,Ie.mD)(c,ni)-1):(h=(0,Ie.GW)(h,ni),c=(0,Ie.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,tt.h7)(this.resolutions_,e,t||0);return(0,Ie.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=As(t);if(!(0,S.b8)(s,n)){const o=(0,S.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,S.g0)(r,i),resolutions:n,tileSize:t})}function fh(r){const e=r||{},t=e.extent||(0,P.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:Ds.e,t=(0,rt.Pq)(t!==void 0?t:Ds.S);const n=(0,S.Cr)(r),s=(0,S.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=As(r);return dh(n,e,t,i)}function As(r){r=(0,P.U2)(r);let e=r.getExtent();if(!e){const t=180*P.Wm.degrees/r.getMetersPerUnit();e=(0,S.T9)(-t,-t,t,t)}return e}class mh extends br{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,rt.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()===ce.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,ne.O3)()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:oo(e)}getTileCacheForProjection(e){const t=this.getProjection();return(0,ie.h)(t===null||(0,P.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,rt.Pq)(n.getTileSize(e),this.tmpSize);return s==1?o:(0,rt.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 ph extends _n.ZP{constructor(e,t){super(e),this.tile=t}}const _h=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,ie.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,Ie.$W)(n,r.length);return r[s](e,t,i)}}function vu(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 Os extends _h{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===Os.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,ne.sq)(t),n=t.getState();let s;n==ce.Z.LOADING?(this.tileLoadingKeys_[i]=!0,s=Ps.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],s=n==ce.Z.ERROR?Ps.TILELOADERROR:n==ce.Z.LOADED?Ps.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new ph(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 Ch=Os;class wh extends Ch{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,P.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,P.OP)(this.getProjection(),e)?!1:super.getOpaque(e)}getTileGridForProjection(e){const t=this.getProjection();if(this.tileGrid&&(!t||(0,P.OP)(t,e)))return this.tileGrid;const i=(0,ne.sq)(e);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=oo(e)),this.tileGridForProjection[i]}getTileCacheForProjection(e){const t=this.getProjection();if(!t||(0,P.OP)(t,e))return this.tileCache;const i=(0,ne.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?ce.Z.IDLE:ce.Z.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(lt.Z.CHANGE,this.handleTileChange.bind(this)),c}getTile(e,t,i,n,s){const o=this.getProjection();if(!o||!s||(0,P.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()==ce.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,P.U2)(e);if(i){const n=(0,ne.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=wh;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:As(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 ks=Ih;var Rh=(r=>(r.Auto="auto",r.Light="light",r.Dark="dark",r))(Rh||{});const Dn={theme:"auto",showLabels:!0},lo={id:"carto",name:"CARTO basemap",description:"Add layer CARTO Raster basemaps",isBaseMap:!0,defaultOptions:Dn,create:async(r,e,t,i)=>({init:()=>{const n={...Dn,...e.config};let s=n.theme;return(!s||s==="auto")&&(s=i.isDark?"dark":"light"),n.showLabels?s+="_all":s+="_nolabels",new Fs({source:new ks({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:Dn.theme}).addBooleanSwitch({path:"config.showLabels",name:"Show labels",description:"",defaultValue:Dn.showLabels})}})},bh=[lo],ho="https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer",Ai={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=Ai.url,n.attribution=n.attribution??Ai.attribution),new Fs({source:new ks({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:Ai.url}}).addTextInput({path:"config.attribution",name:"Attribution",settings:{placeholder:Ai.attribution}})}})},Lh=[co],An="custom",Bs="streets",uo=new Ln.B(()=>[{id:Bs,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:An,name:"Custom MapServer",description:"Use a custom MapServer with pre-cached values",slug:""}]),Mh=[{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??Bs);if(s.id!==An){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:Ai.url},showIf:h=>h.config?.server===An}).addTextInput({path:"config.attribution",name:"Attribution",settings:{placeholder:Ai.attribution},showIf:h=>h.config?.server===An})},a))},defaultOptions:{server:Bs}}],Fh='&#169; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class Ph extends ks{constructor(e){e=e||{};let t;e.attributions!==void 0?t=e.attributions:t=[Fh];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,Gs=[...[{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 Fs({source:new Dh})})}],...bh,...Mh,...Lh];var fo=y(39919),Ah=y(59007);const go=(r,e)=>{const t=e.get(r.property);return(0,Ah.f)(t,r.operation,r.value)};var mo=y(19046),tn=y(79655);function po(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=H.bD.Any;if(e.size===1)switch(e.values().next().value){case"Point":case"MultiPoint":i=H.bD.Point;break;case"Line":case"MultiLine":i=H.bD.Line;break;case"Polygon":i=H.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 _o(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 F=r?.check?.property;return F&&l&&r.check?.operation===yt.Bd.EQ?Oh(l,F).map(k=>{let B;return!isNaN(Number(k))?B={value:Number(k),label:k}:B={value:k,label:k},B}):[]},[l,r]),c=(0,Ee.wW)(Bh),u=10,d=(0,p.useCallback)(F=>{e({...r,check:{...r.check,property:F?.value}})},[e,r]),g=(0,p.useCallback)(F=>{e({...r,check:{...r.check,operation:F.value??yt.Bd.EQ}})},[e,r]),f=(0,p.useCallback)(F=>{e({...r,check:{...r.check,value:F?.value}})},[e,r]),m=(0,p.useCallback)(F=>{e({...r,check:{...r.check,value:F}})},[e,r]),_=(0,p.useCallback)(F=>{e({...r,style:F})},[e,r]),v=(0,p.useCallback)(()=>{e(void 0)},[e]),w=r.check??vo.check,E=_o(w.property,a?.propertes),L=_o(w.value,h);return p.createElement("div",{className:c.rule},p.createElement(Rt.Z,{className:c.row},p.createElement(ht._,{label:"Rule",labelWidth:u,grow:!0},p.createElement(xi.Ph,{placeholder:"Feature property",value:E.current,options:E.options,onChange:d,"aria-label":"Feature property",isClearable:!0,allowCustomValue:!0})),p.createElement(ht._,{className:c.inline},p.createElement(xi.Ph,{value:mo.J8.find(F=>F.value===w.operation),options:mo.J8,onChange:g,"aria-label":"Comparison operator",width:8})),p.createElement(ht._,{className:c.inline,grow:!0},p.createElement("div",{className:c.flexRow},(w.operation===yt.Bd.EQ||w.operation===yt.Bd.NEQ)&&p.createElement(xi.Ph,{placeholder:"value",value:L.current,options:L.options,onChange:f,"aria-label":"Comparison value",isClearable:!0,allowCustomValue:!0}),w.operation!==yt.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(Li,{value:r.style??H.Er,context:i,onChange:_,item:{settings:{simpleFixedValues:!0,layerInfo:o}}})))},Bh=r=>({rule:N.css`
    margin-bottom: ${r.spacing(1)};
  `,row:N.css`
    display: flex;
    margin-bottom: 4px;
  `,inline:N.css`
    margin-bottom: 0;
    margin-left: 4px;
  `,button:N.css`
    margin-left: 4px;
  `,flexRow:N.css`
    display: flex;
    flex-direction: row;
    align-items: flex-start;
  `}),Gh=({value:r,onChange:e,context:t,item:i})=>{const n=(0,Ee.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:{...H.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=y(775),yo=y(39343);const On={src:"public/maps/countries.geojson",rules:[],style:H.Er},vo={style:H.Er,check:{property:"",operation:yt.Bd.EQ,value:""}},zh={id:"geojson",name:"GeoJSON",description:"Load static data from a geojson file",isBaseMap:!1,state:Mi.BV.beta,create:async(r,e,t,i)=>{const n={...On,...e.config},s=new xt({url:n.src,format:new fo.Z}),o=new Es.t,a=s.on("change",()=>{s.getState()=="ready"&&((0,fs.B)(a),o.next(s.getFeatures()))}),l=[];if(n.rules){for(const c of n.rules)if(c.style){const u=await mi(c.style);l.push({state:u,rule:c.check})}}{const c=await mi(n.style);l.push({state:c})}const h=new Ye({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):Mn(g)}return u?(d.point||(d.point=d.state.maker(d.state.base)),d.point):(d.poly||(d.poly=Mn(d.state.base)),d.poly)}}});return{init:()=>h,registerOptionsUI:c=>{const u=o.pipe((0,xo.P)(),(0,yo.U)(d=>po(d)));c.addSelect({path:"config.src",name:"GeoJSON URL",settings:{options:(0,ct.B1)()??[],allowCustomValue:!0},defaultValue:On.src}).addCustomEditor({id:"config.style",path:"config.style",name:"Default style",description:"The style to apply when no rules above match",editor:Li,settings:{simpleFixedValues:!0,layerInfo:u},defaultValue:On.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:On},kn=34962,zs=34963,Wh=35040,Nh=35044,Bn=35048,Zh=5121,Uh=5123,Xh=5125,Eo=5126,Co=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function Ws(r,e){e=Object.assign({preserveDrawingBuffer:!0,antialias:!ur.ME},e);const t=Co.length;for(let i=0;i<t;++i)try{const n=r.getContext(Co[i],e);if(n)return n}catch{}return null}let Ns;function Su(){if(!Ns){const r=document.createElement("canvas"),e=Ws(r);e&&(Ns=e.getSupportedExtensions())}return Ns}const Vh={STATIC_DRAW:Nh,STREAM_DRAW:Wh,DYNAMIC_DRAW:Bn};class Yh{constructor(e,t){this.array=null,this.type=e,(0,ie.h)(e===kn||e===zs,62),this.usage=t!==void 0?t:Vh.STATIC_DRAW}ofSize(e){this.array=new(Zs(this.type))(e)}fromArray(e){this.array=Zs(this.type).from(e)}fromArrayBuffer(e){this.array=new(Zs(this.type))(e)}getType(){return this.type}getArray(){return this.array}getUsage(){return this.usage}getSize(){return this.array?this.array.length:0}}function Zs(r){switch(r){case kn:return Float32Array;case zs:return Uint32Array;default:return Float32Array}}const Us=Yh;var jh=y(92419);const Gn={LOST:"webglcontextlost",RESTORED:"webglcontextrestored"};var Hh=y(90569);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,ne.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 wo=Jh;function qh(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Xs(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 Tu={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"},bt={UNSIGNED_BYTE:Zh,UNSIGNED_SHORT:Uh,UNSIGNED_INT:Xh,FLOAT:Eo},zn={};function So(r){return"shared/"+r}let To=0;function Qh(){const r="unique/"+To;return To+=1,r}function ec(r){let e=zn[r];if(!e){const t=document.createElement("canvas");t.style.position="absolute",t.style.left="0",e={users:0,canvas:t},zn[r]=e}return e.users+=1,e.canvas}function tc(r){const e=zn[r];if(!e||(e.users-=1,e.users>0))return;const t=e.canvas,n=Ws(t).getExtension("WEBGL_lose_context");n&&n.loseContext(),delete zn[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_=Ws(this.canvas_),this.bufferCache_={},this.extensionCache_={},this.currentProgram_=null,this.canvas_.addEventListener(Gn.LOST,this.boundHandleWebGLContextLost_),this.canvas_.addEventListener(Gn.RESTORED,this.boundHandleWebGLContextRestored_),this.offsetRotateMatrix_=(0,se.Ue)(),this.offsetScaleMatrix_=(0,se.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 wo({webGlContext:t,scaleRatio:i.scaleRatio,vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,uniforms:i.uniforms})}):[new wo({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,ne.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,ne.sq)(e),n=this.bufferCache_[i];n&&!t.isContextLost()&&t.deleteBuffer(n.webGlBuffer),delete this.bufferCache_[i]}disposeInternal(){this.canvas_.removeEventListener(Gn.LOST,this.boundHandleWebGLContextLost_),this.canvas_.removeEventListener(Gn.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,se.mc)(this.offsetScaleMatrix_);(0,se.bA)(s,2/t[0],2/t[1]);const o=(0,se.mc)(this.offsetRotateMatrix_);i!==0&&(0,se.U1)(o,-i),this.setUniformMatrixValue(si.OFFSET_SCALE_MATRIX,Xs(this.tmpMat4_,s)),this.setUniformMatrixValue(si.OFFSET_ROTATION_MATRIX,Xs(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,Xs(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,se.mc)(t),(0,se.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 bt.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case bt.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case bt.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case bt.FLOAT:default:return Float32Array.BYTES_PER_ELEMENT}}const sc=ic;class Vs extends xr{constructor(e,t){super(e),t=t||{},this.inversePixelTransform_=(0,se.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 Vs)){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,se.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=Vs,At=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,tt.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 At[0]=0,At[1]=0,At[2]=0,At[3]=0,At;this.readAll();const i=Math.floor(e)+(this.size_[1]-Math.floor(t)-1)*this.size_[0];return At[0]=this.data_[i*4],At[1]=this.data_[i*4+1],At[2]=this.data_[i*4+2],At[3]=this.data_[i*4+3],At}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,Ys={GENERATE_POLYGON_BUFFERS:"GENERATE_POLYGON_BUFFERS",GENERATE_POINT_BUFFERS:"GENERATE_POINT_BUFFERS",GENERATE_LINE_STRING_BUFFERS:"GENERATE_LINE_STRING_BUFFERS"};var Iu=y(83071);const lc=null,js={vertexPosition:0,indexPosition:0};function Wn(r,e,t,i,n){r[e+0]=t,r[e+1]=i,r[e+2]=n}function Ru(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 Wn(t,d,h,c,0),u.length&&t.set(u,d+3),d+=l,Wn(t,d,h,c,1),u.length&&t.set(u,d+3),d+=l,Wn(t,d,h,c,2),u.length&&t.set(u,d+3),d+=l,Wn(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,js.vertexPosition=d,js.indexPosition=g,js}function bu(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(B,Z,ee){return Math.round(Z*1500)+Math.round(ee*1500)*1e4+B*1e4*1e4}function w(B,Z,ee){const q=Math.sqrt((Z[0]-B[0])*(Z[0]-B[0])+(Z[1]-B[1])*(Z[1]-B[1])),fe=[(Z[0]-B[0])/q,(Z[1]-B[1])/q],ge=[-fe[1],fe[0]],oe=Math.sqrt((ee[0]-B[0])*(ee[0]-B[0])+(ee[1]-B[1])*(ee[1]-B[1])),ke=[(ee[0]-B[0])/oe,(ee[1]-B[1])/oe],ue=q===0||oe===0?0:Math.acos(clamp(ke[0]*fe[0]+ke[1]*fe[1],-1,1));return ke[0]*ge[0]+ke[1]*ge[1]>0?ue:Math.PI*2-ue}const E=i!==null,L=n!==null;let F=0,k=0;if(E){const B=[r[i],r[i+1]],Z=applyTransform(h,[...B]);F=w(m,_,Z)}if(L){const B=[r[n],r[n+1]],Z=applyTransform(h,[...B]);k=w(_,m,Z)}s.push(g[0],g[1],f[0],f[1],v(0,F,k)),s.push(...a),s.push(g[0],g[1],f[0],f[1],v(1,F,k)),s.push(...a),s.push(g[0],g[1],f[0],f[1],v(2,F,k)),s.push(...a),s.push(g[0],g[1],f[0],f[1],v(3,F,k)),s.push(...a),o.push(d,d+1,d+2,d+1,d+3,d+2)}function Lu(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 Mu(){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=y(11794).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,se.Ue)();i[si.PROJECTION_MATRIX]=n,super(e,{uniforms:i,postProcesses:t.postProcesses}),this.ready=!1,this.sourceRevision_=-1,this.verticesBuffer_=new Us(kn,Bn),this.hitVerticesBuffer_=new Us(kn,Bn),this.indicesBuffer_=new Us(zs,Bn),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:bt.FLOAT}}):[];this.attributes=[{name:"a_position",size:2,type:bt.FLOAT},{name:"a_index",size:1,type:bt.FLOAT}].concat(s),this.hitDetectionAttributes=[{name:"a_position",size:2,type:bt.FLOAT},{name:"a_index",size:1,type:bt.FLOAT},{name:"a_hitColor",size:4,type:bt.FLOAT},{name:"a_featureUid",size:1,type:bt.FLOAT}].concat(s),this.customAttributes=t.attributes?t.attributes:[],this.previousExtent_=(0,S.lJ)(),this.currentTransform_=n,this.renderTransform_=(0,se.Ue)(),this.invertRenderTransform_=(0,se.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===Ys.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,se.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,et.oL)(o,He.ADDFEATURE,this.handleSourceFeatureAdded_,this),(0,et.oL)(o,He.CHANGEFEATURE,this.handleSourceFeatureChanged_,this),(0,et.oL)(o,He.REMOVEFEATURE,this.handleSourceFeatureDelete_,this),(0,et.oL)(o,He.CLEAR,this.handleSourceFeatureClear_,this)],o.forEachFeature(a=>{this.featureCache_[(0,ne.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,ne.sq)(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()},this.featureCount_++}handleSourceFeatureChanged_(e){const t=e.feature;this.featureCache_[(0,ne.sq)(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()}}handleSourceFeatureDelete_(e){const t=e.feature;delete this.featureCache_[(0,ne.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,S.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,se.Iu)(this.currentTransform_,d*h,0),(0,se.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[Ci.Z.ANIMATING]&&!e.viewHints[Ci.Z.INTERACTING],o=!(0,S.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 ds?t.getRenderBuffer():0,u=(0,S.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,se.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,se.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:Ys.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:Ys.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,ie.h)(this.hitDetectionEnabled_,66),!this.hitRenderInstructions_)return;const o=(0,se.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,se.Iu)(this.currentTransform_,s*n,0),(0,se.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,et.bN)(e)}),this.sourceListenKeys_=null,super.disposeInternal()}}const gc=fc,Lt={BLUR:"blur",GRADIENT:"gradient",RADIUS:"radius"},mc=["#00f","#0ff","#0f0","#ff0","#f00"];class pc extends ds{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(Lt.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(Lt.BLUR)}getGradient(){return this.get(Lt.GRADIENT)}getRadius(){return this.get(Lt.RADIUS)}handleGradientChanged_(){this.gradient_=_c(this.getGradient())}setBlur(e){this.set(Lt.BLUR,e)}setGradient(e){this.set(Lt.GRADIENT,e)}setRadius(e){this.set(Lt.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,Ie.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(Lt.RADIUS)+this.get(Lt.BLUR))*2,u_blurSlope:()=>this.get(Lt.RADIUS)/Math.max(1,this.get(Lt.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 _c(r){const i=(0,Ue.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=pc,Nn={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={...Nn,...e.config},s=await(0,Zt.cJ)(e.location),o=new Fn(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,gi.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===M.fS.number);if(g){const f=(0,Zr.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:Nn.radius,settings:{min:1,max:50,step:1}}).addSliderInput({path:"config.blur",description:"Configures the amount of blur of clusters",name:"Blur",defaultValue:Nn.blur,settings:{min:1,max:50,step:1}})}}},defaultOptions:Nn},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:Mi.BV.alpha,create:async(r,e,t,i)=>{const n=new st.Z({}),s={...Ro,...e.config};n.setStyle(new _e({image:new xn({src:s.icon})}));const o=new xt({features:[n]}),a=new Ye({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.get(c.length-1))}}}},defaultOptions:Ro};var Ec=y(44727),Zn=y(79384),Cc=y(29034),Et=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]},Fu=function(r){return wc(r.getGeometry())},wc=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()))}},Pu=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])/Et(m,_)*e,m[1]-(_[0]-m[0])/Et(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])/Et(m,_)*e,m[1]+(_[0]-m[0])/Et(m,_)*e],t.push(v)),t},Du=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=Et(i,n),o=[(n[0]-i[0])/s,(n[1]-i[1])/s],a=Et(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}},Au=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},Ou=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}},ku=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 Si.Z(s)}})();var Un=function(r,e,t,i){var n=[];i!==!1&&n.push(r);var s=Et(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};nt.Z.prototype.sampleAt=function(r){for(var e=this.getCoordinates(),t=[],i=1;i<e.length;i++)t=t.concat(Un(e[i-1],e[i],r,i===1));return new nt.Z(t)},Cn.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(Un(i[s-1],i[s],r,s===1));t.push(n)}),new Cn.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(Un(i[s-1],i[s],r,s===1));t.push(n)}),new Nt.ZP(t)},Si.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(Un(s[a-1],s[a],r,a===1));n.push(o)})}),new Si.Z(t)},kr.prototype.intersection=function(r,e){if(r.sampleAt){var t=(0,S.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=Et(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 Si.Z(a):r}}}else console.warn("[ol/geom/Circle~intersection] Unsupported geometry type: "+r.getType());return r},nt.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 nt.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 nt.Z(l)),l=[r])}l.push(a[t+1])}return l.length>1&&h.push(new nt.Z(l)),h.length?h:[this]};var Sc=class extends _e{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,_t._2)(e)}catch{this._color=[0,0,0,1]}}setColor2(e){try{this._color2=(0,_t._2)(e)}catch{this._color2=null}}setArrowColor(e){try{this._acolor=(0,_t.XC)(e)}catch{this._acolor=null}}getColor(e,t){if(this._colorFn)return(0,_t.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=Et(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=Et(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=Et(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+=Et(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:{...H.Er,opacity:1,lineWidth:2},arrow:0},Lo="route",Bu={type:Lo,name:"",config:nn,location:{mode:yt.q1.Auto},tooltip:!1},Ic={id:Lo,name:"Route",description:"Render data points as a route",isBaseMap:!1,showLocation:!0,state:Mi.BV.alpha,create:async(r,e,t,i)=>{const n={...nn,...e?.config},s=await mi(n.style),o=await(0,Zt.cJ)(e.location),a=new Fn(o),l=new Ye({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,C.isNumber)(v))return Ts(s.base);const E=[],L=_.getGeometry(),F=s.config.opacity??1;if(L instanceof $i.ZP){const B=L.getCoordinates();if(B){let Z=0;const ee=2;for(let q=0;q<B.length-1;q++){const fe=B[Z],ge=B[q+1],oe=(0,pe.Z)(i.visualization.getColorByName((w.color&&w.color.get(Z))??s.base.color)).setAlpha(F).toString(),ke=(0,pe.Z)(i.visualization.getColorByName((w.color&&w.color.get(q+1))??s.base.color)).setAlpha(F).toString(),ue=(w.size&&w.size.get(Z))??s.base.size,$=(w.size&&w.size.get(q+1))??s.base.size,X=new Tc({visible:!0,lineCap:n.arrow==0?"round":"square",color:oe,color2:ke,width:(w.size&&w.size.get(Z))??s.base.size,width2:(w.size&&w.size.get(q+1))??s.base.size});if(n.arrow&&(X.setArrow(n.arrow),n.arrow>0?(X.setArrowColor(ke),X.setArrowSize(($??0)*1.5)):(X.setArrowColor(oe),X.setArrowSize((ue??0)*1.5))),(0,ct.uH)(r,ee,fe,ge)){const J=new nt.Z([fe,ge]);X.setGeometry(J),E.push(X),Z=q+1}}if(E.length===0){const q=new Bt.Z(B[0]),fe=((w.size&&w.size.get(0))??s.base.size??10)/2,ge=(0,pe.Z)(i.visualization.getColorByName((w.color&&w.color.get(0))??s.base.color)).setAlpha(F).toString(),oe=new _e({image:new It({radius:fe,fill:new Ae({color:ge})})});oe.setGeometry(q),E.push(oe)}}return E}const k={...s.base};return w.color&&(k.color=w.color.get(v)),Ts(k)});const c=new st.Z({}),u=(s.base.lineWidth||6)+2,d=new _e({image:new It({radius:u,stroke:new Oe({color:(0,Cc.alpha)(s.base.color,.4),width:u+2}),fill:new Ae({color:s.base.color})})}),g=new Ye({source:new xt({features:[c]}),style:d}),f=new Zn.Z({layers:[l,g]}),m=new K.w0;return m.add(t.getStream(re.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(F=>F.name===M.Ls);if(L){const F=L.values.toArray(),k=Rc(F,E);if(k!==null){const B=(0,Zt.g6)(w,o);B.field&&(c.setGeometry(B.field.values.get(k)),c.setStyle(d))}}}}})),m.add(t.subscribe(re.xH,_=>{c.setStyle(new _e({}))})),{init:()=>f,dispose:()=>m.unsubscribe(),update:_=>{if(_.series?.length)for(const v of _.series){(s.fields||h)&&(s.dims=(0,ct.vV)(v,s,i)),a.updateLineString(v);break}},registerOptionsUI:_=>{_.addCustomEditor({id:"config.style",path:"config.style",name:"Style",editor:Li,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 Ot=class extends xt{constructor(e){e=e||{},e.strategy=Lr,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=Ot._sunEclipticPosition(o),h=Ot._eclipticObliquity(o),c=Ot._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 st.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=Ot._sunEclipticPosition(i),o=Ot._eclipticObliquity(i),a=Ot._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=Ot._sunEclipticPosition(o),c=Ot._eclipticObliquity(o),u=Ot._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 Mo=Ot;var bc=(r=>(r.From="from",r.To="to",r))(bc||{});const pi={show:"to",sun:!1,nightColor:"#a7a6ba4D"},Fo="dayNight",Gu={type:Fo,name:"",config:pi,tooltip:!0},Lc={id:Fo,name:"Night / Day",description:"Show day and night regions",isBaseMap:!1,create:async(r,e,t,i)=>{const n={...pi,...e?.config},s=new Mo({}),o=Object.getPrototypeOf(s),a=new Mo({}),l=Object.getPrototypeOf(a),h=new Ye({source:s,style:new _e({fill:new Ae({color:i.visualization.getColorByName(n.nightColor)})})}),c=new Ye({source:new xt({features:[]}),style:new _e({stroke:new Oe({color:"#607D8B",width:1.5,lineDash:[2,3]})})}),u=new st.Z({geometry:new Bt.Z([])}),d=new Ye({source:new xt({features:[u]}),style:new _e({image:new It({radius:13,fill:new Ae({color:"rgb(253,184,19)"})})})}),g=new st.Z({geometry:new Bt.Z([])}),f=new _e({image:new It({radius:13,stroke:new Oe({color:"rgb(253,184,19)",width:1.5})})}),m=new _e({image:new It({radius:15,stroke:new Oe({color:"#607D8B",width:1.5,lineDash:[2,3]})})}),_=new Ye({source:new xt({features:[g]}),style:[m,f]}),v=new Zn.Z({layers:n.sun?[h,d,_,c]:[h,c]}),w=new K.w0;return{init:()=>v,dispose:()=>w.unsubscribe(),update:E=>{const L=new Date(E.timeRange.from.valueOf()),F=new Date(E.timeRange.to.valueOf());let k=new Date,B=[];n.show==="from"?k=L:k=F,s.setTime(k),n.sun&&(B=o.getSunPosition(k),u.getGeometry()?.setCoordinates((0,P.mi)(B)))},registerOptionsUI:E=>{e.config?.nightColor||(e.config={...pi,...e.config}),E.addRadio({path:"config.show",name:"Show",settings:{options:[{label:"From",value:"from"},{label:"To",value:"to"}]},defaultValue:pi.show}),E.addColorPicker({path:"config.nightColor",name:"Night region color",description:"Pick color of night region",defaultValue:pi.nightColor,settings:[{enableNamedColors:!1}]}),E.addBooleanSwitch({path:"config.sun",name:"Display sun",description:"Show the sun",defaultValue:pi.sun})}}},defaultOptions:pi},sn={src:"public/maps/countries.geojson",rules:[],style:H.Er,dataStyle:{}},zu={style:H.Er,check:{property:"",operation:yt.Bd.EQ,value:""}},Mc={id:"dynamic-geojson",name:"Dynamic GeoJSON",description:"Style a geojson file based on query results",isBaseMap:!1,state:Mi.BV.alpha,create:async(r,e,t,i)=>{const n={...sn,...e.config},s=new xt({url:n.src,format:new fo.Z}),o=new Es.t,a=s.on("change",()=>{s.getState()=="ready"&&((0,fs.B)(a),o.next(s.getFeatures()))}),l=[];if(n.rules){for(const d of n.rules)if(d.style){const g=await mi(d.style);l.push({state:g,rule:d.check})}}{const d=await mi(n.style);l.push({state:d})}const h=await mi(n.style),c=new Map,u=new Ye({source:s,style:d=>{const g=c.get(d.getId()),f=h.dims;if(g&&f)return new _e({fill:new Ae({color:f.color?.get(g)}),stroke:new Oe({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):Mn(v)}return m?(_.point||(_.point=_.state.maker(_.state.base)),_.point):(_.poly||(_.poly=Mn(_.state.base)),_.poly)}}});return{init:()=>u,update:d=>{const g=d.series[0];if(g){const f=(0,gi.findField)(g,n.idField);f&&(c.clear(),f.values.toArray().forEach((m,_)=>c.set(m,_))),h.dims=(0,ct.vV)(g,h,i,n.dataStyle)}u.changed()},registerOptionsUI:d=>{const g=o.pipe((0,xo.P)(),(0,yo.U)(f=>po(f)));d.addSelect({path:"config.src",name:"GeoJSON URL",settings:{options:(0,ct.B1)()??[],allowCustomValue:!0},defaultValue:sn.src}).addFieldNamePicker({path:"config.idField",name:"ID Field"}).addCustomEditor({id:"config.dataStyle",path:"config.dataStyle",name:"Data style",editor:Li,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:Li,settings:{simpleFixedValues:!0,layerInfo:g},defaultValue:sn.style})}}},defaultOptions:sn};var Po=class extends Je{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 Oe({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:Je.prototype.render?new Ae({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=Je.prototype.getImage.call(this,e);if(this._gethit||this.img_)return t;var i,n=0;this._stroke&&(i=(0,_t.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(),Je.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,_t.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 Hs=Po,Ut={kind:"square",border:2,shadow:!0,crop:!0,radius:20,color:"rgb(200, 200, 200)"},Do="photos",Wu={type:Do,name:"",config:Ut,location:{mode:yt.q1.Auto},tooltip:!0},Ks="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBjbGFzcz0iY3NzLWV5eDRkbyI+PHBhdGggZD0iTTExLjI5LDE1LjI5YTEuNTgsMS41OCwwLDAsMC0uMTIuMTUuNzYuNzYsMCwwLDAtLjA5LjE4LjY0LjY0LDAsMCwwLS4wNi4xOCwxLjM2LDEuMzYsMCwwLDAsMCwuMi44NC44NCwwLDAsMCwuMDguMzguOS45LDAsMCwwLC41NC41NC45NC45NCwwLDAsMCwuNzYsMCwuOS45LDAsMCwwLC41NC0uNTRBMSwxLDAsMCwwLDEzLDE2YTEsMSwwLDAsMC0uMjktLjcxQTEsMSwwLDAsMCwxMS4yOSwxNS4yOVpNMTIsMkExMCwxMCwwLDEsMCwyMiwxMiwxMCwxMCwwLDAsMCwxMiwyWm0wLDE4YTgsOCwwLDEsMSw4LThBOCw4LDAsMCwxLDEyLDIwWk0xMiw3QTMsMywwLDAsMCw5LjQsOC41YTEsMSwwLDEsMCwxLjczLDFBMSwxLDAsMCwxLDEyLDlhMSwxLDAsMCwxLDAsMiwxLDEsMCwwLDAtMSwxdjFhMSwxLDAsMCwwLDIsMHYtLjE4QTMsMywwLDAsMCwxMiw3WiI+PC9wYXRoPjwvc3ZnPgo=",Fc="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:Mi.BV.alpha,create:async(r,e,t,i)=>{const n={...Ut,...e?.config},s=await(0,Zt.cJ)(e.location),o=new Fn(s),a=new Ye({source:o});let l=[];return a.setStyle(h=>{let c=Ks,u=1/0;l.length>0&&(u=h.get("rowIndex"),c=l[u]??Ks);const d=new _e({image:new Hs({src:c,radius:n.radius,crop:n.crop,kind:n.kind,shadow:!1,stroke:new Oe({width:0,color:"rgba(0,0,0,0)"}),onload:()=>{a.changed(),rn&&!rn.includes(u)&&rn.push(u)}})}),g=new _e({image:new Hs({src:Fc,radius:n.radius,crop:!1,kind:n.kind,shadow:n.shadow,stroke:new Oe({width:n.border??0,color:i.visualization.getColorByName(n.color)}),onload:()=>{a.changed()}})}),f=new _e({image:new Hs({src:Ks,radius:n.radius,crop:!1,kind:n.kind,shadow:!1,stroke:new Oe({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,gi.findField)(c,n.src);u&&(l=u?.values.toArray())}else for(let u=0;u<c.fields.length;u++){const d=c.fields[u];if(d.type===M.fS.string){l=d.values.toArray();break}}break}},registerOptionsUI:h=>{h.addFieldNamePicker({path:"config.src",name:"Image Source field",settings:{filter:c=>c.type===M.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,Mc,Lc,Ic,Pc],Oi={type:"default",name:"",config:{}},Oo={id:Oi.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 Ln.B(()=>[Oo,...Gs,...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===Mi.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,...Gs]:[...Ao,...Gs],e)}const Nu=Object.freeze([0,0]),Zu={layers:[]},Go={allLayers:!0,id:"zero",lat:0,lon:0,zoom:1};var ki=(r=>(r.Details="details",r.None="none",r))(ki||{}),Dc=(r=>(r.Coords="coords",r.Fit="fit",r.Zero="zero",r))(Dc||{}),Ac=y(69966),zo=y(982);const $s=(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 Xn(r,r.map,t,i.isBasemap);o[n]?.handler.dispose?.(),o[n]=a,s.setAt(n,a.layer),$s(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 Xn(r,e,t,i){i&&(!t?.type||j.v.geomapDisableCustomBaseLayer)&&(t=Oi),t?.type||(t={type:Rs,name:(0,ct.FB)(r),config:{}});const n=on.getIfExists(t.type);if(!n)return Promise.reject("unknown layer: "+t.type);t.config?.attribution&&(t.config.attribution=Xr.QX.sanitizeTextPanelContent(t.config.attribution));const s=await n.create(e,t,r.props.eventBus,j.v.theme2),o=s.init();t.opacity!=null&&o.setOpacity(t.opacity),t.name||(t.name=(0,ct.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,$s(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&&Xn(r,r.map,{type:i.id,name:(0,ct.FB)(r),config:(0,C.cloneDeep)(i.defaultOptions),location:i.showLocation?{mode:yt.q1.Auto}:void 0,tooltip:!0,...!i.hideOpacity&&{opacity:H.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 Ye||n.layer instanceof Zn.Z).flatMap(n=>{const s=n.layer;if(s instanceof Zn.Z)return Gc(s);if(s instanceof Ye){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(S.l7,(0,S.lJ)())}function Gc(r){return r.getLayers().getArray().filter(e=>e instanceof Ye).map(e=>e instanceof Ye?e.getSource().getExtent()??[]:[])}const zc=r=>{r.map?.on("singleclick",r.pointerClickListener),r.map?.on("pointermove",r.pointerMoveListener),r.map?.getViewport().addEventListener("mouseout",e=>{r.props.eventBus.publish(new re.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)return!1;const t=r.originalEvent,i=e.map.getEventPixel(t),n=(0,P.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.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 Ct=(r=>(r.Zero="zero",r.Coordinates="coords",r.Fit="fit",r))(Ct||{});const an=new Ln.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 K.w0,this.globalCSS=Cl(j.v.theme2),this.hoverPayload={point:{},pageX:-1,pageY:-1},this.hoverEvent=new re.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,ct.n_)(this,i,t);this.byName.clear();const s=[];try{s.push(await Xn(this,n,i.basemap??Oi,!0)),i.layers||(i.layers=[Hr]);for(const o of i.layers)s.push(await Xn(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 Y.Z,this.map?.addInteraction(this.mouseWheelZoom),(0,ct.sA)(this,i),zc(this),(0,ct.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 Le.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(de.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 Wr&&(this.map?.removeLayer(s),this.map?.addLayer(s))}),i({...t,basemap:n[0].options,layers:n.slice(1).map(s=>s.options)}),(0,ct.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)$s(i.handler,i.options,this.props.data);const t=an.getIfExists(this.props.options.view.id);if(t&&t.id===Ct.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===Ct.Coordinates)n=[t.lon??0,t.lat??0];else if(i.id===Ct.Fit){const s=Bc(this.layers,t.allLayers,t.lastOnly,t.layer);if(!(0,S.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,P.mi)(n))}t.maxZoom&&e.setMaxZoom(t.maxZoom),t.minZoom&&e.setMaxZoom(t.minZoom),t.zoom&&i?.id!==Ct.Fit&&e.setZoom(t.zoom)}initControls(e){if(!this.map)return;this.map.getControls().clear(),e.showZoom&&this.map.addControl(new z.Z),e.showScale&&this.map.addControl(new O({units:e.scaleUnits,minWidth:100})),this.mouseWheelZoom.setActive(Boolean(e.mouseWheelZoom)),e.showAttribution&&this.map.addControl(new xe.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===ki.None&&(e=void 0),p.createElement(p.Fragment,null,p.createElement(be.Global,{styles:this.globalCSS}),p.createElement("div",{className:Xo.wrap,onMouseLeave:this.clearTooltip},p.createElement("div",{className:Xo.map,ref:this.initMapRef}),p.createElement(ve,{bottomLeft:n,topRight1:i,topRight2:s,blStyle:{bottom:a?"35px":"8px"}})),p.createElement(fn,{ttip:e,isOpen:t,onClose:this.tooltipPopupClosed}))}}Uo.contextType=me.bb;const Xo={wrap:N.css`
    position: relative;
    width: 100%;
    height: 100%;
  `,map:N.css`
    position: absolute;
    z-index: 0;
    width: 100%;
    height: 100%;
  `};var Nc=y(45206),Js=y(42285),Zc=y(6335),Uc=y(45810);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,Ee.wW)(Vc),d=g=>g?`${u.row} ${u.sel}`:u.row;return p.createElement(Js.Z5,{onDragEnd:t},p.createElement(Js.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(),F=Boolean(a?.includes(L));m.push(p.createElement(Js._l,{key:L,draggableId:L,index:m.length},(k,B)=>p.createElement("div",{className:d(F),ref:k.innerRef,...k.draggableProps,...k.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(es.h,{name:"copy",title:"Duplicate",ariaLabel:"Duplicate button",className:u.actionIcon,onClick:()=>s(E)}):null,p.createElement(es.h,{name:"trash-alt",title:"remove",ariaLabel:"Remove button",className:(0,N.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:N.css`
    margin-bottom: ${r.spacing(2)};
  `,row:N.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:N.css`
    border: 1px solid ${r.colors.primary.border};
    &:hover {
      border: 1px solid ${r.colors.primary.border};
    }
  `,dragIcon:N.css`
    cursor: drag;
  `,actionIcon:N.css`
    color: ${r.colors.text.secondary};
    &:hover {
      color: ${r.colors.text};
    }
  `,typeWrapper:N.css`
    color: ${r.colors.primary.text};
    margin-right: 5px;
  `,textWrapper:N.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(Rt.Z,null,p.createElement(ht._,{label:"Latitude",labelWidth:r,grow:!0},p.createElement(tn.Y,{value:e.lat,min:-90,max:90,step:.001,onChange:i}))),p.createElement(Rt.Z,null,p.createElement(ht._,{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(Rt.Z,null,p.createElement(ht._,{label:"Layer",labelWidth:r,grow:!0},p.createElement(xi.Ph,{options:n,onChange:s,placeholder:n[0]?.label}))),a=u=>{t({...e,padding:u})},l=p.createElement(Rt.Z,null,p.createElement(ht._,{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(Rt.Z,null,p.createElement(ht._,{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,P.bU)(h,l.getProjection());e({...r,id:Ct.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(Rt.Z,null,p.createElement(ht._,{label:"View",labelWidth:10,grow:!0},p.createElement(xi.Ph,{options:n.options,value:n.current,onChange:o}))),r.id===Ct.Coordinates&&p.createElement(jc,{labelWidth:10,value:r,onChange:e}),r.id===Ct.Fit&&p.createElement(Kc,{labelWidth:10,value:r,onChange:e,context:t}),p.createElement(Rt.Z,null,p.createElement(ht._,{label:r?.id===Ct.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=y(84341),qc=y(94937),Qc=y(55868);function Ho(r){return{category:r.category,path:"--",defaultValue:r.basemaps?Oi:Hr,values:e=>({getContext:t=>({...t,options:r.state.options,instanceState:r.state}),getValue:t=>(0,C.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:yt.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:Oi.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!==Oi.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,C.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=y(98527);const tu=(r,e,t,i)=>{if(e==="grafana-worldmap-panel"&&t.angular){const{fieldConfig:n,options:s}=iu({...t.angular,fieldConfig:i});return r.fieldConfig=n,s}return{}};function iu(r){const e={defaults:{},overrides:[]},t={view:{id:Ct.Zero},controls:{showZoom:!0,mouseWheelZoom:Boolean(r.mouseWheelZoom)},basemap:{type:"default",name:"Basemap"},layers:[],tooltip:{mode:ki.Details}};let i=Vn(r.decimals);if(i&&(e.defaults.decimals=i),r.thresholds&&r.colors){const s=r.thresholds.split(",").map(a=>Number(a.trim())),o=[];for(const a of r.colors){const l=o.length-1;l>=0?o.push({value:s[l],color:a}):o.push({value:-1/0,color:a})}e.defaults.thresholds={mode:eu.H.Absolute,steps:o}}i=Vn(r.initialZoom),i&&(t.view.zoom=i);const n={"(0\xB0, 0\xB0)":Ct.Zero,"North America":"north-america",Europe:"europe","West Asia":"west-asia","SE Asia":"se-asia","Last GeoHash":Ct.Coordinates};return t.view.id=n[r.mapCenter],t.view.lat=Vn(r.mapCenterLatitude),t.view.lon=Vn(r.mapCenterLongitude),{fieldConfig:e,options:t}}function Vn(r){const e=+r;return isNaN(e)?void 0:e}const nu=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,C.cloneDeep)(H.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:gi.ResourceDimensionMode.Fixed}),{...r.options,layers:[{...i,config:s}]}}}return r.options},su=new G.c(Uo).setNoPadding().setPanelChangeHandler(tu).setMigrationHandler(nu).useFieldConfig({useCustomConfig:r=>{Q.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];j.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:ki.Details,settings:{options:[{label:"None",value:ki.None,description:"Show contents on click, not hover"},{label:"Details",value:ki.Details,description:"Show popup on hover"}]}})})},65345:Ge=>{"use strict";var te=[];function y(j){for(var Q=-1,N=0;N<te.length;N++)if(te[N].identifier===j){Q=N;break}return Q}function p(j,Q){for(var N={},be=[],Le=0;Le<j.length;Le++){var xe=j[Le],ye=Q.base?xe[0]+Q.base:xe[0],Ce=N[ye]||0,P="".concat(ye," ").concat(Ce);N[ye]=Ce+1;var ie=y(P),Fe={css:xe[1],media:xe[2],sourceMap:xe[3],supports:xe[4],layer:xe[5]};if(ie!==-1)te[ie].references++,te[ie].updater(Fe);else{var Ne=G(Fe,Q);Q.byIndex=Le,te.splice(Le,0,{identifier:P,updater:Ne,references:1})}be.push(P)}return be}function G(j,Q){var N=Q.domAPI(Q);N.update(j);var be=function(xe){if(xe){if(xe.css===j.css&&xe.media===j.media&&xe.sourceMap===j.sourceMap&&xe.supports===j.supports&&xe.layer===j.layer)return;N.update(j=xe)}else N.remove()};return be}Ge.exports=function(j,Q){Q=Q||{},j=j||[];var N=p(j,Q);return function(Le){Le=Le||[];for(var xe=0;xe<N.length;xe++){var ye=N[xe],Ce=y(ye);te[Ce].references--}for(var P=p(Le,Q),ie=0;ie<N.length;ie++){var Fe=N[ie],Ne=y(Fe);te[Ne].references===0&&(te[Ne].updater(),te.splice(Ne,1))}N=P}}},30320:Ge=>{"use strict";var te={};function y(G){if(typeof te[G]>"u"){var j=document.querySelector(G);if(window.HTMLIFrameElement&&j instanceof window.HTMLIFrameElement)try{j=j.contentDocument.head}catch{j=null}te[G]=j}return te[G]}function p(G,j){var Q=y(G);if(!Q)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");Q.appendChild(j)}Ge.exports=p},65729:Ge=>{"use strict";function te(y){var p=document.createElement("style");return y.setAttributes(p,y.attributes),y.insert(p,y.options),p}Ge.exports=te},56050:(Ge,te,y)=>{"use strict";function p(G){var j=y.nc;j&&G.setAttribute("nonce",j)}Ge.exports=p},24384:Ge=>{"use strict";function te(G,j,Q){var N="";Q.supports&&(N+="@supports (".concat(Q.supports,") {")),Q.media&&(N+="@media ".concat(Q.media," {"));var be=typeof Q.layer<"u";be&&(N+="@layer".concat(Q.layer.length>0?" ".concat(Q.layer):""," {")),N+=Q.css,be&&(N+="}"),Q.media&&(N+="}"),Q.supports&&(N+="}");var Le=Q.sourceMap;Le&&typeof btoa<"u"&&(N+=`
/*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(Le))))," */")),j.styleTagTransform(N,G,j.options)}function y(G){if(G.parentNode===null)return!1;G.parentNode.removeChild(G)}function p(G){var j=G.insertStyleElement(G);return{update:function(N){te(j,G,N)},remove:function(){y(j)}}}Ge.exports=p},89106:Ge=>{"use strict";function te(y,p){if(p.styleSheet)p.styleSheet.cssText=y;else{for(;p.firstChild;)p.removeChild(p.firstChild);p.appendChild(document.createTextNode(y))}}Ge.exports=te},83071:Ge=>{"use strict";Ge.exports=te,Ge.exports.default=te;function te(x,T,C){C=C||2;var M=T&&T.length,b=M?T[0]*C:x.length,D=y(x,0,b,C,!0),A=[];if(!D||D.next===D.prev)return A;var U,he,ae,ze,Pe,we,Xe;if(M&&(D=Le(x,T,D,C)),x.length>80*C){U=ae=x[0],he=ze=x[1];for(var De=C;De<b;De+=C)Pe=x[De],we=x[De+1],Pe<U&&(U=Pe),we<he&&(he=we),Pe>ae&&(ae=Pe),we>ze&&(ze=we);Xe=Math.max(ae-U,ze-he),Xe=Xe!==0?32767/Xe:0}return G(D,A,C,U,he,Xe,0),A}function y(x,T,C,M,b){var D,A;if(b===gt(x,T,C,M)>0)for(D=T;D<C;D+=M)A=We(D,x[D],x[D+1],A);else for(D=C-M;D>=T;D-=M)A=We(D,x[D],x[D+1],A);return A&&S(A,A.next)&&($e(A),A=A.next),A}function p(x,T){if(!x)return x;T||(T=x);var C=x,M;do if(M=!1,!C.steiner&&(S(C,C.next)||z(C.prev,C,C.next)===0)){if($e(C),C=T=C.prev,C===C.next)break;M=!0}else C=C.next;while(M||C!==T);return T}function G(x,T,C,M,b,D,A){if(x){!A&&D&&ie(x,M,b,D);for(var U=x,he,ae;x.prev!==x.next;){if(he=x.prev,ae=x.next,D?Q(x,M,b,D):j(x)){T.push(he.i/C|0),T.push(x.i/C|0),T.push(ae.i/C|0),$e(x),x=ae.next,U=ae.next;continue}if(x=ae,x===U){A?A===1?(x=N(p(x),T,C),G(x,T,C,M,b,D,2)):A===2&&be(x,T,C,M,b,D):G(p(x),T,C,M,b,D,1);break}}}}function j(x){var T=x.prev,C=x,M=x.next;if(z(T,C,M)>=0)return!1;for(var b=T.x,D=C.x,A=M.x,U=T.y,he=C.y,ae=M.y,ze=b<D?b<A?b:A:D<A?D:A,Pe=U<he?U<ae?U:ae:he<ae?he:ae,we=b>D?b>A?b:A:D>A?D:A,Xe=U>he?U>ae?U:ae:he>ae?he:ae,De=M.next;De!==T;){if(De.x>=ze&&De.x<=we&&De.y>=Pe&&De.y<=Xe&&R(b,U,D,he,A,ae,De.x,De.y)&&z(De.prev,De,De.next)>=0)return!1;De=De.next}return!0}function Q(x,T,C,M){var b=x.prev,D=x,A=x.next;if(z(b,D,A)>=0)return!1;for(var U=b.x,he=D.x,ae=A.x,ze=b.y,Pe=D.y,we=A.y,Xe=U<he?U<ae?U:ae:he<ae?he:ae,De=ze<Pe?ze<we?ze:we:Pe<we?Pe:we,ci=U>he?U>ae?U:ae:he>ae?he:ae,ui=ze>Pe?ze>we?ze:we:Pe>we?Pe:we,dn=Ne(Xe,De,T,C,M),fn=Ne(ci,ui,T,C,M),pe=x.prevZ,Se=x.nextZ;pe&&pe.z>=dn&&Se&&Se.z<=fn;){if(pe.x>=Xe&&pe.x<=ci&&pe.y>=De&&pe.y<=ui&&pe!==b&&pe!==A&&R(U,ze,he,Pe,ae,we,pe.x,pe.y)&&z(pe.prev,pe,pe.next)>=0||(pe=pe.prevZ,Se.x>=Xe&&Se.x<=ci&&Se.y>=De&&Se.y<=ui&&Se!==b&&Se!==A&&R(U,ze,he,Pe,ae,we,Se.x,Se.y)&&z(Se.prev,Se,Se.next)>=0))return!1;Se=Se.nextZ}for(;pe&&pe.z>=dn;){if(pe.x>=Xe&&pe.x<=ci&&pe.y>=De&&pe.y<=ui&&pe!==b&&pe!==A&&R(U,ze,he,Pe,ae,we,pe.x,pe.y)&&z(pe.prev,pe,pe.next)>=0)return!1;pe=pe.prevZ}for(;Se&&Se.z<=fn;){if(Se.x>=Xe&&Se.x<=ci&&Se.y>=De&&Se.y<=ui&&Se!==b&&Se!==A&&R(U,ze,he,Pe,ae,we,Se.x,Se.y)&&z(Se.prev,Se,Se.next)>=0)return!1;Se=Se.nextZ}return!0}function N(x,T,C){var M=x;do{var b=M.prev,D=M.next.next;!S(b,D)&&Y(b,M,M.next,D)&&de(b,D)&&de(D,b)&&(T.push(b.i/C|0),T.push(M.i/C|0),T.push(D.i/C|0),$e(M),$e(M.next),M=x=D),M=M.next}while(M!==x);return p(M)}function be(x,T,C,M,b,D){var A=x;do{for(var U=A.next.next;U!==A.prev;){if(A.i!==U.i&&O(A,U)){var he=ve(A,U);A=p(A,A.next),he=p(he,he.next),G(A,T,C,M,b,D,0),G(he,T,C,M,b,D,0);return}U=U.next}A=A.next}while(A!==x)}function Le(x,T,C,M){var b=[],D,A,U,he,ae;for(D=0,A=T.length;D<A;D++)U=T[D]*M,he=D<A-1?T[D+1]*M:x.length,ae=y(x,U,he,M,!1),ae===ae.next&&(ae.steiner=!0),b.push(I(ae));for(b.sort(xe),D=0;D<b.length;D++)C=ye(b[D],C);return C}function xe(x,T){return x.x-T.x}function ye(x,T){var C=Ce(x,T);if(!C)return T;var M=ve(C,x);return p(M,M.next),p(C,C.next)}function Ce(x,T){var C=T,M=x.x,b=x.y,D=-1/0,A;do{if(b<=C.y&&b>=C.next.y&&C.next.y!==C.y){var U=C.x+(b-C.y)*(C.next.x-C.x)/(C.next.y-C.y);if(U<=M&&U>D&&(D=U,A=C.x<C.next.x?C:C.next,U===M))return A}C=C.next}while(C!==T);if(!A)return null;var he=A,ae=A.x,ze=A.y,Pe=1/0,we;C=A;do M>=C.x&&C.x>=ae&&M!==C.x&&R(b<ze?M:D,b,ae,ze,b<ze?D:M,b,C.x,C.y)&&(we=Math.abs(b-C.y)/(M-C.x),de(C,x)&&(we<Pe||we===Pe&&(C.x>A.x||C.x===A.x&&P(A,C)))&&(A=C,Pe=we)),C=C.next;while(C!==he);return A}function P(x,T){return z(x.prev,x,T.prev)<0&&z(T.next,x,x.next)<0}function ie(x,T,C,M){var b=x;do b.z===0&&(b.z=Ne(b.x,b.y,T,C,M)),b.prevZ=b.prev,b.nextZ=b.next,b=b.next;while(b!==x);b.prevZ.nextZ=null,b.prevZ=null,Fe(b)}function Fe(x){var T,C,M,b,D,A,U,he,ae=1;do{for(C=x,x=null,D=null,A=0;C;){for(A++,M=C,U=0,T=0;T<ae&&(U++,M=M.nextZ,!!M);T++);for(he=ae;U>0||he>0&&M;)U!==0&&(he===0||!M||C.z<=M.z)?(b=C,C=C.nextZ,U--):(b=M,M=M.nextZ,he--),D?D.nextZ=b:x=b,b.prevZ=D,D=b;C=M}D.nextZ=null,ae*=2}while(A>1);return x}function Ne(x,T,C,M,b){return x=(x-C)*b|0,T=(T-M)*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,C=x;do(T.x<C.x||T.x===C.x&&T.y<C.y)&&(C=T),T=T.next;while(T!==x);return C}function R(x,T,C,M,b,D,A,U){return(b-A)*(T-U)>=(x-A)*(D-U)&&(x-A)*(M-U)>=(C-A)*(T-U)&&(C-A)*(D-U)>=(b-A)*(M-U)}function O(x,T){return x.next.i!==T.i&&x.prev.i!==T.i&&!me(x,T)&&(de(x,T)&&de(T,x)&&Ee(x,T)&&(z(x.prev,x,T.prev)||z(x,T.prev,T))||S(x,T)&&z(x.prev,x,x.next)>0&&z(T.prev,T,T.next)>0)}function z(x,T,C){return(T.y-x.y)*(C.x-T.x)-(T.x-x.x)*(C.y-T.y)}function S(x,T){return x.x===T.x&&x.y===T.y}function Y(x,T,C,M){var b=re(z(x,T,C)),D=re(z(x,T,M)),A=re(z(C,M,x)),U=re(z(C,M,T));return!!(b!==D&&A!==U||b===0&&K(x,C,T)||D===0&&K(x,M,T)||A===0&&K(C,x,M)||U===0&&K(C,T,M))}function K(x,T,C){return T.x<=Math.max(x.x,C.x)&&T.x>=Math.min(x.x,C.x)&&T.y<=Math.max(x.y,C.y)&&T.y>=Math.min(x.y,C.y)}function re(x){return x>0?1:x<0?-1:0}function me(x,T){var C=x;do{if(C.i!==x.i&&C.next.i!==x.i&&C.i!==T.i&&C.next.i!==T.i&&Y(C,C.next,x,T))return!0;C=C.next}while(C!==x);return!1}function de(x,T){return z(x.prev,x,x.next)<0?z(x,T,x.next)>=0&&z(x,x.prev,T)>=0:z(x,T,x.prev)<0||z(x,x.next,T)<0}function Ee(x,T){var C=x,M=!1,b=(x.x+T.x)/2,D=(x.y+T.y)/2;do C.y>D!=C.next.y>D&&C.next.y!==C.y&&b<(C.next.x-C.x)*(D-C.y)/(C.next.y-C.y)+C.x&&(M=!M),C=C.next;while(C!==x);return M}function ve(x,T){var C=new qe(x.i,x.x,x.y),M=new qe(T.i,T.x,T.y),b=x.next,D=T.prev;return x.next=T,T.prev=x,C.next=b,b.prev=C,M.next=C,C.prev=M,D.next=M,M.prev=D,M}function We(x,T,C,M){var b=new qe(x,T,C);return M?(b.next=M.next,b.prev=M,M.next.prev=b,M.next=b):(b.prev=b,b.next=b),b}function $e(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 qe(x,T,C){this.i=x,this.x=T,this.y=C,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}te.deviation=function(x,T,C,M){var b=T&&T.length,D=b?T[0]*C:x.length,A=Math.abs(gt(x,0,D,C));if(b)for(var U=0,he=T.length;U<he;U++){var ae=T[U]*C,ze=U<he-1?T[U+1]*C:x.length;A-=Math.abs(gt(x,ae,ze,C))}var Pe=0;for(U=0;U<M.length;U+=3){var we=M[U]*C,Xe=M[U+1]*C,De=M[U+2]*C;Pe+=Math.abs((x[we]-x[De])*(x[Xe+1]-x[we+1])-(x[we]-x[Xe])*(x[De+1]-x[we+1]))}return A===0&&Pe===0?0:Math.abs((Pe-A)/A)};function gt(x,T,C,M){for(var b=0,D=T,A=C-M;D<C;D+=M)b+=(x[A]-x[D])*(x[D+1]+x[A+1]),A=D;return b}te.flatten=function(x){for(var T=x[0][0].length,C={vertices:[],holes:[],dimensions:T},M=0,b=0;b<x.length;b++){for(var D=0;D<x[b].length;D++)for(var A=0;A<T;A++)C.vertices.push(x[b][D][A]);b>0&&(M+=x[b-1].length,C.holes.push(M))}return C}},45759:function(Ge){(function(te,y){Ge.exports=y()})(this,function(){"use strict";function te(I,R,O,z,S){(function Y(K,re,me,de,Ee){for(;de>me;){if(de-me>600){var ve=de-me+1,We=re-me+1,$e=Math.log(ve),qe=.5*Math.exp(2*$e/3),gt=.5*Math.sqrt($e*qe*(ve-qe)/ve)*(We-ve/2<0?-1:1),x=Math.max(me,Math.floor(re-We*qe/ve+gt)),T=Math.min(de,Math.floor(re+(ve-We)*qe/ve+gt));Y(K,re,x,T,Ee)}var C=K[re],M=me,b=de;for(y(K,me,re),Ee(K[de],C)>0&&y(K,me,de);M<b;){for(y(K,M,b),M++,b--;Ee(K[M],C)<0;)M++;for(;Ee(K[b],C)>0;)b--}Ee(K[me],C)===0?y(K,me,b):y(K,++b,de),b<=re&&(me=b+1),re<=b&&(de=b-1)}})(I,R,O||0,z||I.length-1,S||p)}function y(I,R,O){var z=I[R];I[R]=I[O],I[O]=z}function p(I,R){return I<R?-1:I>R?1:0}var G=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 j(I,R,O){if(!O)return R.indexOf(I);for(var z=0;z<R.length;z++)if(O(I,R[z]))return z;return-1}function Q(I,R){N(I,0,I.children.length,R,I)}function N(I,R,O,z,S){S||(S=Fe(null)),S.minX=1/0,S.minY=1/0,S.maxX=-1/0,S.maxY=-1/0;for(var Y=R;Y<O;Y++){var K=I.children[Y];be(S,I.leaf?z(K):K)}return S}function be(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 Le(I,R){return I.minX-R.minX}function xe(I,R){return I.minY-R.minY}function ye(I){return(I.maxX-I.minX)*(I.maxY-I.minY)}function Ce(I){return I.maxX-I.minX+(I.maxY-I.minY)}function P(I,R){return I.minX<=R.minX&&I.minY<=R.minY&&R.maxX<=I.maxX&&R.maxY<=I.maxY}function ie(I,R){return R.minX<=I.maxX&&R.minY<=I.maxY&&R.maxX>=I.minX&&R.maxY>=I.minY}function Fe(I){return{children:I,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Ne(I,R,O,z,S){for(var Y=[R,O];Y.length;)if(!((O=Y.pop())-(R=Y.pop())<=z)){var K=R+Math.ceil((O-R)/z/2)*z;te(I,K,R,O,S),Y.push(R,K,K,O)}}return G.prototype.all=function(){return this._all(this.data,[])},G.prototype.search=function(I){var R=this.data,O=[];if(!ie(I,R))return O;for(var z=this.toBBox,S=[];R;){for(var Y=0;Y<R.children.length;Y++){var K=R.children[Y],re=R.leaf?z(K):K;ie(I,re)&&(R.leaf?O.push(K):P(I,re)?this._all(K,O):S.push(K))}R=S.pop()}return O},G.prototype.collides=function(I){var R=this.data;if(!ie(I,R))return!1;for(var O=[];R;){for(var z=0;z<R.children.length;z++){var S=R.children[z],Y=R.leaf?this.toBBox(S):S;if(ie(I,Y)){if(R.leaf||P(I,Y))return!0;O.push(S)}}R=O.pop()}return!1},G.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 O=this._build(I.slice(),0,I.length-1,0);if(this.data.children.length)if(this.data.height===O.height)this._splitRoot(this.data,O);else{if(this.data.height<O.height){var z=this.data;this.data=O,O=z}this._insert(O,this.data.height-O.height-1,!0)}else this.data=O;return this},G.prototype.insert=function(I){return I&&this._insert(I,this.data.height-1),this},G.prototype.clear=function(){return this.data=Fe([]),this},G.prototype.remove=function(I,R){if(!I)return this;for(var O,z,S,Y=this.data,K=this.toBBox(I),re=[],me=[];Y||re.length;){if(Y||(Y=re.pop(),z=re[re.length-1],O=me.pop(),S=!0),Y.leaf){var de=j(I,Y.children,R);if(de!==-1)return Y.children.splice(de,1),re.push(Y),this._condense(re),this}S||Y.leaf||!P(Y,K)?z?(O++,Y=z.children[O],S=!1):Y=null:(re.push(Y),me.push(O),O=0,z=Y,Y=Y.children[0])}return this},G.prototype.toBBox=function(I){return I},G.prototype.compareMinX=function(I,R){return I.minX-R.minX},G.prototype.compareMinY=function(I,R){return I.minY-R.minY},G.prototype.toJSON=function(){return this.data},G.prototype.fromJSON=function(I){return this.data=I,this},G.prototype._all=function(I,R){for(var O=[];I;)I.leaf?R.push.apply(R,I.children):O.push.apply(O,I.children),I=O.pop();return R},G.prototype._build=function(I,R,O,z){var S,Y=O-R+1,K=this._maxEntries;if(Y<=K)return Q(S=Fe(I.slice(R,O+1)),this.toBBox),S;z||(z=Math.ceil(Math.log(Y)/Math.log(K)),K=Math.ceil(Y/Math.pow(K,z-1))),(S=Fe([])).leaf=!1,S.height=z;var re=Math.ceil(Y/K),me=re*Math.ceil(Math.sqrt(K));Ne(I,R,O,me,this.compareMinX);for(var de=R;de<=O;de+=me){var Ee=Math.min(de+me-1,O);Ne(I,de,Ee,re,this.compareMinY);for(var ve=de;ve<=Ee;ve+=re){var We=Math.min(ve+re-1,Ee);S.children.push(this._build(I,ve,We,z-1))}}return Q(S,this.toBBox),S},G.prototype._chooseSubtree=function(I,R,O,z){for(;z.push(R),!R.leaf&&z.length-1!==O;){for(var S=1/0,Y=1/0,K=void 0,re=0;re<R.children.length;re++){var me=R.children[re],de=ye(me),Ee=(ve=I,We=me,(Math.max(We.maxX,ve.maxX)-Math.min(We.minX,ve.minX))*(Math.max(We.maxY,ve.maxY)-Math.min(We.minY,ve.minY))-de);Ee<Y?(Y=Ee,S=de<S?de:S,K=me):Ee===Y&&de<S&&(S=de,K=me)}R=K||R.children[0]}var ve,We;return R},G.prototype._insert=function(I,R,O){var z=O?I:this.toBBox(I),S=[],Y=this._chooseSubtree(z,this.data,R,S);for(Y.children.push(I),be(Y,z);R>=0&&S[R].children.length>this._maxEntries;)this._split(S,R),R--;this._adjustParentBBoxes(z,S,R)},G.prototype._split=function(I,R){var O=I[R],z=O.children.length,S=this._minEntries;this._chooseSplitAxis(O,S,z);var Y=this._chooseSplitIndex(O,S,z),K=Fe(O.children.splice(Y,O.children.length-Y));K.height=O.height,K.leaf=O.leaf,Q(O,this.toBBox),Q(K,this.toBBox),R?I[R-1].children.push(K):this._splitRoot(O,K)},G.prototype._splitRoot=function(I,R){this.data=Fe([I,R]),this.data.height=I.height+1,this.data.leaf=!1,Q(this.data,this.toBBox)},G.prototype._chooseSplitIndex=function(I,R,O){for(var z,S,Y,K,re,me,de,Ee=1/0,ve=1/0,We=R;We<=O-R;We++){var $e=N(I,0,We,this.toBBox),qe=N(I,We,O,this.toBBox),gt=(S=$e,Y=qe,K=void 0,re=void 0,me=void 0,de=void 0,K=Math.max(S.minX,Y.minX),re=Math.max(S.minY,Y.minY),me=Math.min(S.maxX,Y.maxX),de=Math.min(S.maxY,Y.maxY),Math.max(0,me-K)*Math.max(0,de-re)),x=ye($e)+ye(qe);gt<Ee?(Ee=gt,z=We,ve=x<ve?x:ve):gt===Ee&&x<ve&&(ve=x,z=We)}return z||O-R},G.prototype._chooseSplitAxis=function(I,R,O){var z=I.leaf?this.compareMinX:Le,S=I.leaf?this.compareMinY:xe;this._allDistMargin(I,R,O,z)<this._allDistMargin(I,R,O,S)&&I.children.sort(z)},G.prototype._allDistMargin=function(I,R,O,z){I.children.sort(z);for(var S=this.toBBox,Y=N(I,0,R,S),K=N(I,O-R,O,S),re=Ce(Y)+Ce(K),me=R;me<O-R;me++){var de=I.children[me];be(Y,I.leaf?S(de):de),re+=Ce(Y)}for(var Ee=O-R-1;Ee>=R;Ee--){var ve=I.children[Ee];be(K,I.leaf?S(ve):ve),re+=Ce(K)}return re},G.prototype._adjustParentBBoxes=function(I,R,O){for(var z=O;z>=0;z--)be(R[z],I)},G.prototype._condense=function(I){for(var R=I.length-1,O=void 0;R>=0;R--)I[R].children.length===0?R>0?(O=I[R-1].children).splice(O.indexOf(I[R]),1):this.clear():Q(I[R],this.toBBox)},G})}}]);

//# sourceMappingURL=7559.dec2090f6bb6155a80a0.js.map