(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[5005],{23825:Ft=>{"use strict";Ft.exports=function(Ce,S){return S||(S={}),Ce&&(Ce=String(Ce.__esModule?Ce.default:Ce),/^['"].*['"]$/.test(Ce)&&(Ce=Ce.slice(1,-1)),S.hash&&(Ce+=S.hash),/["'() \t\n]|(%20)/.test(Ce)||S.needQuotes?'"'.concat(Ce.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):Ce)}},74156:(Ft,Ce,S)=>{"use strict";S.d(Ce,{q:()=>te});var _=S(41407),ie=S(39953),Ve=S(82803);const Ye=10,te=({colorPalette:Me,min:Oe,max:U,display:ue,hoverValue:De,useStopsPercentage:ot})=>{const[I,R]=(0,ie.useState)([]),[B,z]=(0,ie.useState)({isShown:!1,value:0}),[C,V]=(0,ie.useState)(null),j=(0,Ve.l4)(),ee=Gt(j,I);(0,ie.useEffect)(()=>{R(je({colorArray:Me,stops:Ye,useStopsPercentage:ot}))},[Me,ot]);const ge=xe=>{const pe=xe.nativeEvent.offsetX,Pe=xe.currentTarget.offsetWidth,He=Math.floor(pe*100/Pe+1),$e=Math.floor((U-Oe)*He/100+Oe);z({isShown:!0,value:$e}),V(He)},ce=()=>{z({isShown:!1,value:0})};return(0,ie.useEffect)(()=>{V(De==null?null:Mt((De-Oe)/(U-Oe)))},[De,Oe,U]),ie.createElement("div",{className:ee.scaleWrapper,onMouseMove:ge,onMouseLeave:ce},ie.createElement("div",{className:ee.scaleGradient},ue&&(B.isShown||De!==void 0)&&ie.createElement("div",{className:ee.followerContainer},ie.createElement("div",{className:ee.follower,style:{left:`${C}%`}}))),ue&&ie.createElement("div",{className:ee.followerContainer},ie.createElement("div",{className:ee.legendValues},ie.createElement("span",null,ue(Oe)),ie.createElement("span",null,ue(U))),C!=null&&(B.isShown||De!==void 0)&&ie.createElement("span",{className:ee.hoverValue,style:{left:`${C}%`}},ue(De??B.value))))},je=({colorArray:Me,stops:Oe,useStopsPercentage:U=!0})=>{const ue=Me.length;if(U&&ue<=20){const R=1/ue*100;let B=0;const z=[];for(const C of Me)B>0?z.push(`${C} ${B}%`):z.push(C),B+=R,z.push(`${C} ${B}%`);return z}const De=Me[ue-1],ot=Math.ceil(ue/Oe),I=new Set;for(let R=0;R<ue;R+=ot)I.add(Me[R]);return I.add(De),[...I]};function Mt(Me){return Me>1?100:Me<0?0:Me*100}const Gt=(Me,Oe)=>({scaleWrapper:(0,_.css)`
    width: 100%;
    font-size: 11px;
    opacity: 1;
  `,scaleGradient:(0,_.css)`
    background: linear-gradient(90deg, ${Oe.join()});
    height: 10px;
    pointer-events: none;
  `,legendValues:(0,_.css)`
    display: flex;
    justify-content: space-between;
    pointer-events: none;
  `,hoverValue:(0,_.css)`
    position: absolute;
    margin-top: -14px;
    padding: 3px 15px;
    background: ${Me.colors.background.primary};
    transform: translateX(-50%);
  `,followerContainer:(0,_.css)`
    position: relative;
    pointer-events: none;
    white-space: nowrap;
  `,follower:(0,_.css)`
    position: absolute;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    transform: translateX(-50%) translateY(-50%);
    border: 2px solid ${Me.colors.text.primary};
    margin-top: 5px;
  `})},8807:(Ft,Ce,S)=>{"use strict";S.d(Ce,{f:()=>Ve});var _=S(39953),ie=S(96428);const Ve=({onChange:Ye,options:te,label:je})=>_.createElement(ie.b,{icon:"plus",label:je,variant:"secondary",options:te,onChange:Ye,isFullWidth:!0})},410:(Ft,Ce,S)=>{"use strict";S.d(Ce,{M:()=>Ye});var _=S(39953),ie=S(86981),Ve=S(77834);const Ye=({value:te,context:je,onChange:Mt})=>{const Gt=(0,_.useCallback)(Me=>{Mt(Me?.length?{id:ie.E4.byRefId,options:Me}:void 0)},[Mt]);return _.createElement(Ve.O,{value:te?.options,onChange:Gt,data:je.data,placeholder:"Change filter"})}},79644:(Ft,Ce,S)=>{"use strict";S.r(Ce),S.d(Ce,{plugin:()=>fu});var _=S(39953),ie=S(40530),Ve=S(32688),Ye=S(86246),te=S(41407),je=S(93986),Mt=S(3132),Gt=S(79636),Me=S(41339),Oe=S(52913),U=S(65268),ue=S(29141);const De="units",ot=[1,2,5],I=25.4/.28;class R extends Me.Z{constructor(e){e=e||{};const t=document.createElement("div");t.style.pointerEvents="none",super({element:t,render:e.render,target:e.target}),this.on,this.once,this.un;const i=e.className!==void 0?e.className:e.bar?"ol-scale-bar":"ol-scale-line";this.innerElement_=document.createElement("div"),this.innerElement_.className=i+"-inner",this.element.className=i+" "+Oe.XV,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=e.minWidth!==void 0?e.minWidth:64,this.maxWidth_=e.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",this.addChangeListener(De,this.handleUnitsChanged_),this.setUnits(e.units||"metric"),this.scaleBar_=e.bar||!1,this.scaleBarSteps_=e.steps||4,this.scaleBarText_=e.text||!1,this.dpi_=e.dpi||void 0}getUnits(){return this.get(De)}handleUnitsChanged_(){this.updateElement_()}setUnits(e){this.set(De,e)}setDpi(e){this.dpi_=e}updateElement_(){const e=this.viewState_;if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const t=e.center,i=e.projection,n=this.getUnits(),s=n=="degrees"?"degrees":"m";let o=(0,U._Q)(i,e.resolution,t,s);const a=this.minWidth_*(this.dpi_||I)/I,l=this.maxWidth_!==void 0?this.maxWidth_*(this.dpi_||I)/I:void 0;let h=a*o,c="";if(n=="degrees"){const w=U.Wm.degrees;h*=w,h<w/60?(c="\u2033",o*=3600):h<w?(c="\u2032",o*=60):c="\xB0"}else n=="imperial"?h<.9144?(c="in",o/=.0254):h<1609.344?(c="ft",o/=.3048):(c="mi",o/=1609.344):n=="nautical"?(o/=1852,c="NM"):n=="metric"?h<.001?(c="\u03BCm",o*=1e6):h<1?(c="mm",o*=1e3):h<1e3?c="m":(c="km",o/=1e3):n=="us"?h<.9144?(c="in",o*=39.37):h<1609.344?(c="ft",o/=.30480061):(c="mi",o/=1609.3472):(0,ue.h)(!1,33);let d=3*Math.floor(Math.log(a*o)/Math.log(10)),u,g,f,m,p,v;for(;;){f=Math.floor(d/3);const w=Math.pow(10,f);if(u=ot[(d%3+3)%3]*w,g=Math.round(u/o),isNaN(g)){this.element.style.display="none",this.renderedVisible_=!1;return}if(l!==void 0&&g>=l){u=m,g=p,f=v;break}else if(g>=a)break;m=u,p=g,v=f,++d}const y=this.scaleBar_?this.createScaleBar(g,u,c):u.toFixed(f<0?-f:0)+" "+c;this.renderedHTML_!=y&&(this.innerElement_.innerHTML=y,this.renderedHTML_=y),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 d=c%2===0?"ol-scale-singlebar-odd":"ol-scale-singlebar-even";l.push(`<div><div class="ol-scale-singlebar ${d}" style="width: ${a}px;"></div>`+this.createMarker("relative")+(c%2===0||o===2?this.createStepText(c,e,!1,t,i):"")+"</div>")}return l.push(this.createStepText(o,e,!0,t,i)),(this.scaleBarText_?`<div class="ol-scale-text" style="width: ${e}px;">`+s+"</div>":"")+l.join("")}createMarker(e){return`<div class="ol-scale-step-marker" style="position: ${e}; top: ${e==="absolute"?3:-10}px;"></div>`}createStepText(e,t,i,n,s){const a=(e===0?0:Math.round(n/this.scaleBarSteps_*e*100)/100)+(e===0?"":" "+s),l=e===0?-3:t/this.scaleBarSteps_*-1,h=e===0?0:t/this.scaleBarSteps_*2;return`<div class="ol-scale-step-text" style="margin-left: ${l}px;text-align: ${e===0?"left":"center"};min-width: ${h}px;left: ${i?t+"px":"unset"};">`+a+"</div>"}getScaleForResolution(){const e=(0,U._Q)(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m"),t=this.dpi_||I,i=1e3/25.4;return e*i*t}render(e){const t=e.frameState;t?this.viewState_=t.viewState:this.viewState_=null,this.updateElement_()}}const B=R;var z=S(57231),C=S(88300),V=S(92970),j=S(31544),ee=S(36316),ge=S(31276),ce=S(73431),xe=S(82803);const pe=({topRight1:r,topRight2:e,bottomLeft:t,blStyle:i})=>{const n=(r&&r.length>0)??!1,s=(0,xe.wW)(Pe(n));return _.createElement("div",{className:s.overlay},!!r?.length&&_.createElement("div",{className:s.TR1},r),!!e?.length&&_.createElement("div",{className:s.TR2},e),!!t?.length&&_.createElement("div",{className:s.BL,style:i},t))},Pe=r=>e=>({overlay:(0,te.css)({position:"absolute",width:"100%",height:"100%",zIndex:500,pointerEvents:"none"}),TR1:(0,te.css)({right:"0.5em",pointerEvents:"auto",position:"absolute",top:"0.5em"}),TR2:(0,te.css)({position:"absolute",top:r?"80px":"8px",right:"8px",pointerEvents:"auto"}),BL:(0,te.css)({position:"absolute",bottom:"8px",left:"8px",pointerEvents:"auto"})});var He=S(41056),$e=S(17037),ft=S(70393),x=S(41013),T=S(80583),E=S(86832),P=S(89591),M=S(69330),D=S(90201),O=S(62818),W=S(97791),oe=S(33975),ne=S(80854);const Fe=({feature:r})=>{let e,t=0;if(!r)return null;if(e=r.get("frame"),e)t=r.get("rowIndex");else{const{geometry:i,...n}=r.getProperties();e=new oe.i([n])}return _.createElement(ne.H,{data:e,rowIndex:t})},Re=({layers:r,activeTabIndex:e})=>{const t=(0,xe.wW)(Ge),[i,n]=(0,_.useState)(new Map),s=(o,a)=>{n(new Map(i.set(o,a)))};return _.createElement(D.I,null,r.map((o,a)=>a===e&&_.createElement("div",{key:o.layer.getName()},_.createElement("div",null,o.features.map((l,h)=>{const c=l.getId()??h;return o.features.length>1?_.createElement(O.U,{key:c,collapsible:!0,label:ye(l,h),isOpen:i.get(c),onToggle:()=>{s(c,!i.get(c))},className:t.collapsibleRow},_.createElement(Fe,{feature:l})):_.createElement(Fe,{key:c,feature:l})})))))},ye=(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===P.fS.string){const l=(0,M.CZ)(a,s);n||(n=l),i[l]=a.values[o]}}for(let o of t){const a=i[o];if(a)return a}if(n)return _.createElement("span",null,n,": ",(0,W.Q)(i[n]));for(let o of Object.keys(i)){const a=i[o];if((0,E.isString)(a))return _.createElement("span",null,o,": ",(0,W.Q)(a))}return`Match: ${e+1}`},Ge=r=>({collapsibleRow:(0,te.css)`
    margin-bottom: 0;
  `});var be=S(22784),ui=S(77804);const di=({layers:r,setActiveTabIndex:e,activeTabIndex:t})=>_.createElement(be.J,null,r&&r.map((i,n)=>_.createElement(ui.O,{key:n,label:i.layer.getName(),active:n===t,counter:i.features.length>1?i.features.length:null,onChangeTab:()=>{e(n)}}))),pn=({layers:r,onClose:e,isOpen:t})=>{const[i,n]=(0,_.useState)(0);return r?_.createElement(_.Fragment,null,t&&_.createElement(T.P,{style:{zIndex:1},onClick:e}),_.createElement(di,{layers:r,setActiveTabIndex:n,activeTabIndex:i}),_.createElement(Re,{layers:r,activeTabIndex:i})):null},_n=({ttip:r,onClose:e,isOpen:t})=>{const i=(0,_.createRef)(),{overlayProps:n}=(0,$e.Ir)({onClose:e,isDismissable:!0,isOpen:t},i),{dialogProps:s}=(0,He.R)({},i);return _.createElement(_.Fragment,null,r&&r.layers&&_.createElement(ft.h_,null,_.createElement(x.S,{position:{x:r.pageX,y:r.pageY},offset:{x:10,y:10},allowPointerEvents:!0},_.createElement("section",{ref:i,...n,...s},_.createElement(pn,{layers:r.layers,isOpen:t,onClose:e})))))};var de=S(63374),ve=S(28888),fi=S(50820);class aa extends _.PureComponent{constructor(e){super(e),this.style=la(fi.config.theme2),this.updateViewState=()=>{const t=this.props.map.getView();this.setState({zoom:t.getZoom(),center:(0,U.vs)(t.getCenter(),t.getProjection(),"EPSG:4326")})},this.state={zoom:0,center:[0,0]}}componentDidMount(){this.props.map.on("moveend",this.updateViewState),this.updateViewState()}render(){const{zoom:e,center:t}=this.state;return _.createElement("div",{className:this.style.infoWrap,"aria-label":ve.wl.components.DebugOverlay.wrapper},_.createElement("table",null,_.createElement("tbody",null,_.createElement("tr",null,_.createElement("th",null,"Zoom:"),_.createElement("td",null,e?.toFixed(1))),_.createElement("tr",null,_.createElement("th",null,"Center:\xA0"),_.createElement("td",null,t[0].toFixed(5),", ",t[1].toFixed(5))))))}}const la=r=>({infoWrap:(0,te.css)({color:r.colors.text.primary,background:(0,de.Z)(r.components.panel.background).setAlpha(.7).toString(),borderRadius:r.shape.radius.default,padding:r.spacing(1)})});var Ci=S(20454),xn=S(4919),wi=S(9558),ss=S(68497),gt=S(83502);const qe=[{value:"length",label:"Length",geometry:"LineString",units:[{label:"Metric (m/km)",value:"m",format:r=>(0,gt.Cf)("lengthm")(r)},{label:"Feet (ft)",value:"ft",format:r=>(0,gt.Cf)("lengthft")(r*3.28084)},{label:"Miles (mi)",value:"mi",format:r=>(0,gt.Cf)("lengthmi")(r/1609)},{label:"Nautical miles (nmi)",value:"nmi",format:r=>(0,gt.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,gt.Cf)("areaM2")(r)},{label:"Square Kilometers (km\xB2)",value:"km2",format:r=>(0,gt.q2)("km\xB2")(r*1e-6)},{label:"Square Feet (ft\xB2)",value:"ft2",format:r=>(0,gt.Cf)("areaF2")(r*10.76391)},{label:"Square Miles (mi\xB2)",value:"mi2",format:r=>(0,gt.Cf)("areaMI2")(r*3861e-10)},{label:"Acres",value:"acre2",format:r=>(0,gt.q2)("acre")(r*247105e-9)},{label:"Hectare",value:"hectare2",format:r=>(0,gt.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 Pt=S(89165),We=S(39583),wt=S(36665),rs=S(10390),yn=S(34271),vn=S(98685),at=S(31971),Ke=S(65983),mt=S(68527),rr=S(44306),or=S(38085),$=S(43039),ji=S(75107);class ha{constructor(e){this.rbush_=new or(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,$.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,$.sq)(a)]=l}this.rbush_.load(i)}remove(e){const t=(0,$.sq)(e),i=this.items_[t];return delete this.items_[t],this.rbush_.remove(i)!==null}update(e,t){const i=this.items_[(0,$.sq)(t)],n=[i.minX,i.minY,i.maxX,i.maxY];(0,C.fS)(n,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){const t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(n){return n.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let i;for(let n=0,s=e.length;n<s;n++)if(i=t(e[n]),i)return i;return i}isEmpty(){return(0,ji.x)(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){const t=this.rbush_.toJSON();return(0,C.T9)(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(const t in e.items_)this.items_[t]=e.items_[t]}}const os=ha,Ue={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var ar=S(9486);const Ae={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};var lt=S(97273);class as{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=(0,lt.Pq)(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){const e=this.getScale();return new as({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,$.O3)()}getImage(e){return(0,$.O3)()}getHitDetectionImage(){return(0,$.O3)()}getPixelRatio(e){return 1}getImageState(){return(0,$.O3)()}getImageSize(){return(0,$.O3)()}getOrigin(){return(0,$.O3)()}getSize(){return(0,$.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,lt.Pq)(e)}listenImageChange(e){(0,$.O3)()}load(){(0,$.O3)()}unlistenImageChange(e){(0,$.O3)()}}const lr=as;var pt=S(63139);function Dt(r){return Array.isArray(r)?(0,pt.BB)(r):r}var ke=S(23248),X=S(95318);class ls extends lr{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 ls({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){const e=this.size_;if(!e)return null;const t=this.getDisplacement(),i=this.getScaleArray();return[e[0]/2-t[0]/i[0],e[1]/2+t[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_}getImage(e){let t=this.canvas_[e];if(!t){const i=this.renderOptions_,n=(0,ke.E4)(i.size*e,i.size*e);this.draw_(i,n,e),t=n.canvas,this.canvas_[e]=t}return t}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return Ae.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 L=n;n=s,s=L}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,d=Math.sqrt(l*l+c*c),u=d/l;if(e==="miter"&&u<=i)return u*t;const g=t/2/u,f=t/2*(c/d),p=Math.sqrt((n+g)*(n+g)+f*f)-n;if(this.radius2_===void 0||e==="bevel")return p*2;const v=n*Math.sin(a),y=Math.sqrt(n*n-v*v),w=s-y,F=Math.sqrt(v*v+w*w)/v;if(F<=i){const L=F*t/2-s-n;return 2*Math.max(p,L)}return p*2}createRenderOptions(){let e=X.rc,t=0,i=null,n=0,s,o=0;this.stroke_&&(s=this.stroke_.getColor(),s===null&&(s=X.Tx),s=Dt(s),o=this.stroke_.getWidth(),o===void 0&&(o=X.yC),i=this.stroke_.getLineDash(),n=this.stroke_.getLineDashOffset(),e=this.stroke_.getLineJoin(),e===void 0&&(e=X.rc),t=this.stroke_.getMiterLimit(),t===void 0&&(t=X.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=X.bL),t.fillStyle=Dt(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,pt._2)(t)),t===null?i=1:Array.isArray(t)&&(i=t.length===4?t[3]:1),i===0){const n=(0,ke.E4)(e.size,e.size);this.hitDetectionCanvas_=n.canvas,this.drawHitDetectionCanvas_(e,n)}}this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.getImage(1))}createPath_(e){let t=this.points_;const i=this.radius_;if(t===1/0)e.arc(0,0,i,0,2*Math.PI);else{const n=this.radius2_===void 0?i:this.radius2_;this.radius2_!==void 0&&(t*=2);const s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){const l=s+a*o,h=a%2===0?i:n;e.lineTo(h*Math.cos(l),h*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=X.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=ls;class hs 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 hs({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 St=hs;class cs{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null}clone(){const e=this.getColor();return new cs({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){this.color_=e}}const Se=cs;class us{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 us({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 Te=us;class Kt{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=cr,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 Kt({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_=cr,this.geometry_=e}setZIndex(e){this.zIndex_=e}}function ca(r){let e;if(typeof r=="function")e=r;else{let t;Array.isArray(r)?t=r:((0,ue.h)(typeof r.getZIndex=="function",41),t=[r]),e=function(){return t}}return e}let ds=null;function ua(r,e){if(!ds){const t=new Se({color:"rgba(255,255,255,0.4)"}),i=new Te({color:"#3399CC",width:1.25});ds=[new Kt({image:new St({fill:t,stroke:i,radius:5}),fill:t,stroke:i})]}return ds}function hr(){const r={},e=[255,255,255,1],t=[0,153,255,1],i=3;return r.Polygon=[new Kt({fill:new Se({color:[255,255,255,.5]})})],r.MultiPolygon=r.Polygon,r.LineString=[new Kt({stroke:new Te({color:e,width:i+2})}),new Kt({stroke:new Te({color:t,width:i})})],r.MultiLineString=r.LineString,r.Circle=r.Polygon.concat(r.LineString),r.Point=[new Kt({image:new St({radius:i*2,fill:new Se({color:t}),stroke:new Te({color:e,width:i/2})}),zIndex:1/0})],r.MultiPoint=r.Point,r.GeometryCollection=r.Polygon.concat(r.LineString,r.Point),r}function cr(r){return r.getGeometry()}const fe=Kt;var ur=S(61135),dr=S(58845),fr=S(4465),Qe=S(19640);class _u extends null{constructor(e,t,i,n,s,o,a){super(e,t,i,ImageState.IDLE),this.src_=n,this.image_=new Image,s!==null&&(this.image_.crossOrigin=s),this.context_=a,this.unlisten_=null,this.state=ImageState.IDLE,this.imageLoadFunction_=o}getImage(){if(this.state==ImageState.LOADED&&this.context_&&!(this.image_ instanceof HTMLCanvasElement)){const e=this.context_.canvas;e.width=this.image_.width,e.height=this.image_.height,this.context_.drawImage(this.image_,0,0),this.image_=this.context_.canvas}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_=fs(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 fs(r,e,t){const i=r;let n=!0,s=!1,o=!1;const a=[(0,Qe.Vx)(i,at.Z.LOAD,function(){o=!0,s||e()})];return i.src&&fr.Tp?(s=!0,i.decode().then(function(){n&&e()}).catch(function(l){n&&(o?e():t())})):a.push((0,Qe.Vx)(i,at.Z.ERROR,t)),function(){n=!1,a.forEach(Qe.bN)}}const xu=null;let Hi=null;class da extends ur.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_===Ae.LOADED){Hi||(Hi=(0,ke.E4)(1,1,void 0,{willReadFrequently:!0})),Hi.drawImage(this.image_,0,0);try{Hi.getImageData(0,0,1,1),this.tainted_=!1}catch{Hi=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(at.Z.CHANGE)}handleImageError_(){this.imageState_=Ae.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Ae.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const e=this.size_[0],t=this.size_[1],i=(0,ke.E4)(e,t);i.fillRect(0,0,e,t),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Ae.IDLE){this.image_||this.initializeImage_(),this.imageState_=Ae.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=fs(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Ae.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,pt.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 fa(r,e,t,i,n,s){let o=dr.c.get(e,i,s);return o||(o=new da(r,e,t,i,n,s),dr.c.set(e,i,s,o)),o}const yu=null;function gr(r,e,t,i){return t!==void 0&&i!==void 0?[t/r,i/e]:t!==void 0?t/r:i!==void 0?i/e:1}class gs extends lr{constructor(e){e=e||{};const t=e.opacity!==void 0?e.opacity:1,i=e.rotation!==void 0?e.rotation:0,n=e.scale!==void 0?e.scale:1,s=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:i,scale:n,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:s,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null;const o=e.img!==void 0?e.img:null;this.imgSize_=e.imgSize;let a=e.src;(0,ue.h)(!(a!==void 0&&o),4),(0,ue.h)(!o||o&&this.imgSize_,5),(a===void 0||a.length===0)&&o&&(a=o.src||(0,$.sq)(o)),(0,ue.h)(a!==void 0&&a.length>0,6),(0,ue.h)(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),69);const l=e.src!==void 0?Ae.IDLE:Ae.LOADED;if(this.color_=e.color!==void 0?(0,pt._2)(e.color):null,this.iconImage_=fa(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,e.width!==void 0||e.height!==void 0){let h,c;if(e.size)[h,c]=e.size;else{const d=this.getImage(1);if(d instanceof HTMLCanvasElement||d.src&&d.complete)h=d.width,c=d.height;else{this.initialOptions_=e;const u=()=>{if(this.unlistenImageChange(u),!this.initialOptions_)return;const g=this.iconImage_.getSize();this.setScale(gr(g[0],g[1],e.width,e.height))};this.listenImageChange(u);return}}h!==void 0&&this.setScale(gr(h,c,e.width,e.height))}}clone(){let e,t,i;return this.initialOptions_?(t=this.initialOptions_.width,i=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new gs({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:e,width:t,height:i,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}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(){const e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==Ae.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){const e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==Ae.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(at.Z.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(at.Z.CHANGE,e)}}const En=gs,ga="#333";class ms{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.scaleArray_=(0,lt.Pq)(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new Se({color:ga}),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 ms({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),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_}getRepeat(){return this.repeat_}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}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=(0,lt.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 gi=ms;function mr(r){return new fe({fill:Ki(r,""),stroke:Ji(r,""),text:ma(r),image:pa(r)})}function Ki(r,e){const t=r[e+"fill-color"];if(t)return new Se({color:t})}function Ji(r,e){const t=r[e+"stroke-width"],i=r[e+"stroke-color"];if(!(!t&&!i))return new Te({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 ma(r){const e=r["text-value"];return e?new gi({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"],repeat:r["text-repeat"],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:Ki(r,"text-"),backgroundFill:Ki(r,"text-background-"),stroke:Ji(r,"text-"),backgroundStroke:Ji(r,"text-background-")}):void 0}function pa(r){const e=r["icon-src"],t=r["icon-img"];if(e||t)return new En({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"],width:r["icon-width"],height:r["icon-height"],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:Ki(r,s),stroke:Ji(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 St({radius:n,fill:Ki(r,s),stroke:Ji(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 pr={RENDER_ORDER:"renderOrder"};class _a extends ar.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(pr.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 or(9)),this.getRenderer().renderDeclutter(e)}setRenderOrder(e){this.set(pr.RENDER_ORDER,e)}setStyle(e){let t;if(e===void 0)t=ua;else if(e===null)t=null;else if(typeof e=="function")t=e;else if(e instanceof fe)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 fe?n[s]=o:n[s]=mr(o)}t=n}else t=mr(e);this.style_=t,this.styleFunction_=e===null?void 0:ca(this.style_),this.changed()}}const ps=_a,$i={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},Cn=[$i.FILL],Jt=[$i.STROKE],mi=[$i.BEGIN_PATH],_r=[$i.CLOSE_PATH],se=$i;var xa=S(17543);class ya{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 xr=ya;var et=S(97794),$t=S(52203);class va extends xr{constructor(e,t,i,n){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){const t=this.pixelRatio;return t==1?e:e.map(function(i){return i*t})}appendFlatPointCoordinates(e,t){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,s=this.coordinates;let o=s.length;for(let a=0,l=e.length;a<l;a+=t)n[0]=e[a],n[1]=e[a+1],(0,C.b8)(i,n)&&(s[o++]=n[0],s[o++]=n[1]);return o}appendFlatLineCoordinates(e,t,i,n,s,o){const a=this.coordinates;let l=a.length;const h=this.getBufferedMaxExtent();o&&(t+=n);let c=e[t],d=e[t+1];const u=this.tmpCoordinate_;let g=!0,f,m,p;for(f=t+n;f<i;f+=n)u[0]=e[f],u[1]=e[f+1],p=(0,C.pX)(h,u),p!==m?(g&&(a[l++]=c,a[l++]=d,g=!1),a[l++]=u[0],a[l++]=u[1]):p===xa.Z.INTERSECTING?(a[l++]=u[0],a[l++]=u[1],g=!1):g=!0,c=u[0],d=u[1],m=p;return(s&&g||f===t+n)&&(a[l++]=c,a[l++]=d),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,d,u;switch(s){case"MultiPolygon":l=e.getOrientedFlatCoordinates(),d=[];const g=e.getEndss();u=0;for(let f=0,m=g.length;f<m;++f){const p=[];u=this.drawCustomCoordinates_(l,u,g[f],o,p),d.push(p)}this.instructions.push([se.CUSTOM,a,d,e,i,$t.ug]),this.hitDetectionInstructions.push([se.CUSTOM,a,d,e,n||i,$t.ug]);break;case"Polygon":case"MultiLineString":c=[],l=s=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),u=this.drawCustomCoordinates_(l,0,e.getEnds(),o,c),this.instructions.push([se.CUSTOM,a,c,e,i,$t.o1]),this.hitDetectionInstructions.push([se.CUSTOM,a,c,e,n||i,$t.o1]);break;case"LineString":case"Circle":l=e.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([se.CUSTOM,a,h,e,i,$t.Ml]),this.hitDetectionInstructions.push([se.CUSTOM,a,h,e,n||i,$t.Ml]);break;case"MultiPoint":l=e.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([se.CUSTOM,a,h,e,i,$t.Ml]),this.hitDetectionInstructions.push([se.CUSTOM,a,h,e,n||i,$t.Ml]));break;case"Point":l=e.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([se.CUSTOM,a,h,e,i]),this.hitDetectionInstructions.push([se.CUSTOM,a,h,e,n||i]);break;default:}this.endGeometry(t)}beginGeometry(e,t){this.beginGeometryInstruction1_=[se.BEGIN_GEOMETRY,t,0,e],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[se.BEGIN_GEOMETRY,t,0,e],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const e=this.hitDetectionInstructions;e.reverse();let t;const i=e.length;let n,s,o=-1;for(t=0;t<i;++t)n=e[t],s=n[0],s==se.END_GEOMETRY?o=t:s==se.BEGIN_GEOMETRY&&(n[2]=t,(0,et.FZ)(this.hitDetectionInstructions,o,t),o=-1)}setFillStrokeStyle(e,t){const i=this.state;if(e){const n=e.getColor();i.fillStyle=Dt(n||X.bL)}else i.fillStyle=void 0;if(t){const n=t.getColor();i.strokeStyle=Dt(n||X.Tx);const s=t.getLineCap();i.lineCap=s!==void 0?s:X.mb;const o=t.getLineDash();i.lineDash=o?o.slice():X.X9;const a=t.getLineDashOffset();i.lineDashOffset=a||X.He;const l=t.getLineJoin();i.lineJoin=l!==void 0?l:X.rc;const h=t.getWidth();i.lineWidth=h!==void 0?h:X.yC;const c=t.getMiterLimit();i.miterLimit=c!==void 0?c:X.V4,i.lineWidth>this.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(e){const t=e.fillStyle,i=[se.SET_FILL_STYLE,t];return typeof t!="string"&&i.push(!0),i}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[se.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,this.applyPixelRatio(e.lineDash),e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){const i=e.fillStyle;(typeof i!="string"||e.currentFillStyle!=i)&&(i!==void 0&&this.instructions.push(t.call(this,e)),e.currentFillStyle=i)}updateStrokeStyle(e,t){const i=e.strokeStyle,n=e.lineCap,s=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,h=e.miterLimit;(e.currentStrokeStyle!=i||e.currentLineCap!=n||s!=e.currentLineDash&&!(0,et.fS)(e.currentLineDash,s)||e.currentLineDashOffset!=o||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=h)&&(i!==void 0&&t.call(this,e),e.currentStrokeStyle=i,e.currentLineCap=n,e.currentLineDash=s,e.currentLineDashOffset=o,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=h)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const t=[se.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=(0,C.d9)(this.maxExtent),this.maxLineWidth>0)){const e=this.resolution*(this.maxLineWidth+1)/2;(0,C.f3)(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}const qi=va;class Ea extends qi{constructor(e,t,i,n){super(e,t,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t){if(!this.image_)return;this.beginGeometry(e,t);const i=e.getFlatCoordinates(),n=e.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([se.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([se.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t){if(!this.image_)return;this.beginGeometry(e,t);const i=e.getFlatCoordinates(),n=e.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([se.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([se.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){const i=e.getAnchor(),n=e.getSize(),s=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=e.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=n[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}const Ca=Ea;class wa extends qi{constructor(e,t,i,n){super(e,t,i,n)}drawFlatCoordinates_(e,t,i,n){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(e,t,i,n,!1,!1),a=[se.MOVE_TO_LINE_TO,s,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(e,t){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(n===void 0||s===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(e,t),this.hitDetectionInstructions.push([se.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,X.X9,X.He],mi);const o=e.getFlatCoordinates(),a=e.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(Jt),this.endGeometry(t)}drawMultiLineString(e,t){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(n===void 0||s===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(e,t),this.hitDetectionInstructions.push([se.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],mi);const o=e.getEnds(),a=e.getFlatCoordinates(),l=e.getStride();let h=0;for(let c=0,d=o.length;c<d;++c)h=this.drawFlatCoordinates_(a,h,o[c],l);this.hitDetectionInstructions.push(Jt),this.endGeometry(t)}finish(){const e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Jt),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Jt),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(mi)}}const Sa=wa;var Ta=S(9082);class Ia extends qi{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(mi),this.hitDetectionInstructions.push(mi);for(let h=0;h<l;++h){const c=i[h],d=this.coordinates.length,u=this.appendFlatLineCoordinates(e,t,c,n,!0,!a),g=[se.MOVE_TO_LINE_TO,d,u];this.instructions.push(g),this.hitDetectionInstructions.push(g),a&&(this.instructions.push(_r),this.hitDetectionInstructions.push(_r)),t=c}return o&&(this.instructions.push(Cn),this.hitDetectionInstructions.push(Cn)),a&&(this.instructions.push(Jt),this.hitDetectionInstructions.push(Jt)),t}drawCircle(e,t){const i=this.state,n=i.fillStyle,s=i.strokeStyle;if(n===void 0&&s===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([se.SET_FILL_STYLE,X.bL]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([se.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);const o=e.getFlatCoordinates(),a=e.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(o,0,o.length,a,!1,!1);const h=[se.CIRCLE,l];this.instructions.push(mi,h),this.hitDetectionInstructions.push(mi,h),i.fillStyle!==void 0&&(this.instructions.push(Cn),this.hitDetectionInstructions.push(Cn)),i.strokeStyle!==void 0&&(this.instructions.push(Jt),this.hitDetectionInstructions.push(Jt)),this.endGeometry(t)}drawPolygon(e,t){const i=this.state,n=i.fillStyle,s=i.strokeStyle;if(n===void 0&&s===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([se.SET_FILL_STYLE,X.bL]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([se.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);const o=e.getEnds(),a=e.getOrientedFlatCoordinates(),l=e.getStride();this.drawFlatCoordinatess_(a,0,o,l),this.endGeometry(t)}drawMultiPolygon(e,t){const i=this.state,n=i.fillStyle,s=i.strokeStyle;if(n===void 0&&s===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([se.SET_FILL_STYLE,X.bL]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([se.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);const o=e.getEndss(),a=e.getOrientedFlatCoordinates(),l=e.getStride();let h=0;for(let c=0,d=o.length;c<d;++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,Ta.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 yr=Ia;var _e=S(84898);function Ra(r,e,t,i,n){const s=[];let o=t,a=0,l=e.slice(t,2);for(;a<r&&o+n<i;){const[h,c]=l.slice(-2),d=e[o+n],u=e[o+n+1],g=Math.sqrt((d-h)*(d-h)+(u-c)*(u-c));if(a+=g,a>=r){const f=(r-a+g)/g,m=(0,_e.t7)(h,d,f),p=(0,_e.t7)(c,u,f);l.push(m,p),s.push(l),l=[m,p],a==r&&(o+=n),a=0}else if(a<r)l.push(e[o+n],e[o+n+1]),o+=n;else{const f=g-a,m=(0,_e.t7)(h,d,f/g),p=(0,_e.t7)(c,u,f/g);l.push(m,p),s.push(l),l=[m,p],a=0,o+=n}}return a>0&&s.push(l),s}function ba(r,e,t,i,n){let s=t,o=t,a=0,l=0,h=t,c,d,u,g,f,m,p,v,y,w;for(d=t;d<i;d+=n){const b=e[d],F=e[d+1];f!==void 0&&(y=b-f,w=F-m,g=Math.sqrt(y*y+w*w),p!==void 0&&(l+=u,c=Math.acos((p*y+v*w)/(u*g)),c>r&&(l>a&&(a=l,s=h,o=d),l=0,h=d-n)),u=g,p=y,v=w),f=b,m=F}return l+=g,l>a?[h,d]:[s,o]}const Qi={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class La extends qi{constructor(e,t,i,n){super(e,t,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterImageWithText_=void 0}finish(){const e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t){const i=this.textFillState_,n=this.textStrokeState_,s=this.textState_;if(this.text_===""||!s||!i&&!n)return;const o=this.coordinates;let a=o.length;const l=e.getType();let h=null,c=e.getStride();if(s.placement==="line"&&(l=="LineString"||l=="MultiLineString"||l=="Polygon"||l=="MultiPolygon")){if(!(0,C.kK)(this.getBufferedMaxExtent(),e.getExtent()))return;let d;if(h=e.getFlatCoordinates(),l=="LineString")d=[h.length];else if(l=="MultiLineString")d=e.getEnds();else if(l=="Polygon")d=e.getEnds().slice(0,1);else if(l=="MultiPolygon"){const m=e.getEndss();d=[];for(let p=0,v=m.length;p<v;++p)d.push(m[p][0])}this.beginGeometry(e,t);const u=s.repeat,g=u?void 0:s.textAlign;let f=0;for(let m=0,p=d.length;m<p;++m){let v;u?v=Ra(u*this.resolution,h,f,d[m],c):v=[h.slice(f,d[m])];for(let y=0,w=v.length;y<w;++y){const b=v[y];let F=0,L=b.length;if(g==null){const G=ba(s.maxAngle,b,0,b.length,2);F=G[0],L=G[1]}for(let G=F;G<L;G+=c)o.push(b[G],b[G+1]);const A=o.length;f=d[m],this.drawChars_(a,A),a=A}}this.endGeometry(t)}else{let d=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||d.push(h[2]/this.resolution),c=3;break;case"MultiPolygon":const p=e.getFlatInteriorPoints();h=[];for(let v=0,y=p.length;v<y;v+=3)s.overflow||d.push(p[v+2]/this.resolution),h.push(p[v],p[v+1]);if(h.length===0)return;c=2;break;default:}const u=this.appendFlatPointCoordinates(h,c);if(u===a)return;if(d&&(u-a)/2!==h.length/c){let p=a/2;d=d.filter((v,y)=>{const w=o[(p+y)*2]===h[y*c]&&o[(p+y)*2+1]===h[y*c+1];return w||--p,w})}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!=X.oB&&(s.scale[0]<0||s.scale[1]<0)){let p=s.padding[0],v=s.padding[1],y=s.padding[2],w=s.padding[3];s.scale[0]<0&&(v=-v,w=-w),s.scale[1]<0&&(p=-p,y=-y),g=[p,v,y,w]}const f=this.pixelRatio;this.instructions.push([se.DRAW_IMAGE,a,u,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,g==X.oB?X.oB:g.map(function(p){return p*f}),!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const m=1/f;this.hitDetectionInstructions.push([se.DRAW_IMAGE,a,u,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_,d]),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||X.PH,justify:t.justify,textBaseline:t.textBaseline||X.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=Qi[n.textBaseline],c=this.textOffsetY_*l,d=this.text_,u=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([se.DRAW_CHARS,e,t,h,n.overflow,a,n.maxAngle,l,c,s,u*l,d,o,1]),this.hitDetectionInstructions.push([se.DRAW_CHARS,e,t,h,n.overflow,a,n.maxAngle,1,c,s,u,d,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=Dt(o.getColor()||X.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(),p=a.getWidth(),v=a.getMiterLimit();s.lineCap=a.getLineCap()||X.mb,s.lineDash=f?f.slice():X.X9,s.lineDashOffset=m===void 0?X.He:m,s.lineJoin=a.getLineJoin()||X.rc,s.lineWidth=p===void 0?X.yC:p,s.miterLimit=v===void 0?X.V4:v,s.strokeStyle=Dt(a.getColor()||X.Tx)}i=this.textState_;const l=e.getFont()||X.Df;(0,X.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.repeat=e.getRepeat(),i.justify=e.getJustify(),i.textBaseline=e.getTextBaseline()||X.ru,i.backgroundFill=e.getBackgroundFill(),i.backgroundStroke=e.getBackgroundStroke(),i.padding=e.getPadding()||X.oB,i.scale=h===void 0?[1,1]:h;const c=e.getOffsetX(),d=e.getOffsetY(),u=e.getRotateWithView(),g=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=d===void 0?0:d,this.textRotateWithView_=u===void 0?!1:u,this.textRotation_=g===void 0?0:g,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:(0,$.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.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n?typeof n.fillStyle=="string"?n.fillStyle:"|"+(0,$.sq)(n.fillStyle):""}this.declutterImageWithText_=t}}const Fa={Circle:yr,Default:qi,Image:Ca,LineString:Sa,Polygon:yr,Text:La};class Ma{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=Fa[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[t]=s}return s}}const vr=Ma;var _s=S(32196);class Pa extends _s.Z{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.declutterExecutorGroup=null}getFeatures(e){return(0,$.O3)()}getData(e){return null}prepareFrame(e){return(0,$.O3)()}renderFrame(e,t){return(0,$.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()===Ae.LOADED&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Ae.LOADED&&t!=Ae.ERROR&&e.addEventListener(at.Z.CHANGE,this.boundHandleImageChange_),t==Ae.IDLE&&(e.load(),t=e.getState()),t==Ae.LOADED}renderIfReadyAndVisible(){const e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}const Er=Pa;var wn=S(23885),qt=S(74950),q=S(55034);const Cr=[];let Si=null;function Da(){Si=(0,ke.E4)(1,1,void 0,{willReadFrequently:!0})}class Aa extends Er{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=(0,q.Ue)(),this.pixelTransform=(0,q.Ue)(),this.inversePixelTransform=(0,q.Ue)(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(e,t,i){Si||Da(),Si.clearRect(0,0,1,1);let n;try{Si.drawImage(e,t,i,1,1,0,0,1,1),n=Si.getImageData(0,0,1,1).data}catch{return Si=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,et.fS)((0,pt._2)(e.style.backgroundColor),(0,pt._2)(i)))){const a=e.firstElementChild;a instanceof HTMLCanvasElement&&(o=a.getContext("2d"))}if(o&&o.canvas.style.transform===t?(this.container=e,this.context=o,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){s=document.createElement("div"),s.className=n;let a=s.style;a.position="absolute",a.width="100%",a.height="100%",o=(0,ke.E4)();const l=o.canvas;s.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=s,this.context=o}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(e,t,i){const n=(0,C.rL)(i),s=(0,C.Xv)(i),o=(0,C.w$)(i),a=(0,C.hC)(i);(0,q.nn)(t.coordinateToPixelTransform,n),(0,q.nn)(t.coordinateToPixelTransform,s),(0,q.nn)(t.coordinateToPixelTransform,o),(0,q.nn)(t.coordinateToPixelTransform,a);const l=this.inversePixelTransform;(0,q.nn)(l,n),(0,q.nn)(l,s),(0,q.nn)(l,o),(0,q.nn)(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(n[0]),Math.round(n[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}dispatchRenderEvent_(e,t,i){const n=this.getLayer();if(n.hasListener(e)){const s=new wn.Z(e,this.inversePixelTransform,i,t);n.dispatchEvent(s)}}preRender(e,t){this.frameState=t,this.dispatchRenderEvent_(qt.Z.PRERENDER,e,t)}postRender(e,t){this.dispatchRenderEvent_(qt.Z.POSTRENDER,e,t)}getRenderTransform(e,t,i,n,s,o,a){const l=s/2,h=o/2,c=n/t,d=-c,u=-e[0]+a,g=-e[1];return(0,q.qC)(this.tempTransform,l,h,c,d,-i,u,g)}disposeInternal(){delete this.frameState,super.disposeInternal()}}const wr=Aa;var pi=S(91420);function Oa(r,e,t,i,n,s,o,a,l,h,c,d){let u=r[e],g=r[e+1],f=0,m=0,p=0,v=0;function y(){f=u,m=g,e+=i,u=r[e],g=r[e+1],v+=p,p=Math.sqrt((u-f)*(u-f)+(g-m)*(g-m))}do y();while(e<t-i&&v+p<s);let w=p===0?0:(s-v)/p;const b=(0,_e.t7)(f,u,w),F=(0,_e.t7)(m,g,w),L=e-i,A=v,G=s+a*l(h,n,c);for(;e<t-i&&v+p<G;)y();w=p===0?0:(G-v)/p;const H=(0,_e.t7)(f,u,w),K=(0,_e.t7)(m,g,w);let le;if(d){const Y=[b,F,H,K];(0,pi.U1)(Y,0,4,2,d,Y,Y),le=Y[0]>Y[2]}else le=b>H;const he=Math.PI,Q=[],me=L+i===e;e=L,p=0,v=A,u=r[e],g=r[e+1];let re;if(me){y(),re=Math.atan2(g-m,u-f),le&&(re+=re>0?-he:he);const Y=(H+b)/2,Z=(K+F)/2;return Q[0]=[Y,Z,(G-s)/2,re,n],Q}n=n.replace(/\n/g," ");for(let Y=0,Z=n.length;Y<Z;){y();let J=Math.atan2(g-m,u-f);if(le&&(J+=J>0?-he:he),re!==void 0){let we=J-re;if(we+=we>he?-2*he:we<-he?2*he:0,Math.abs(we)>o)return null}re=J;const Ee=Y;let Ie=0;for(;Y<Z;++Y){const we=le?Z-Y-1:Y,Le=a*l(h,n[we],c);if(e+i<t&&v+p<s+Ie+Le/2)break;Ie+=Le}if(Y===Ee)continue;const Ze=le?n.substring(Z-Ee,Z-Y):n.substring(Ee,Y);w=p===0?0:(s+Ie/2-v)/p;const N=(0,_e.t7)(f,u,w),ct=(0,_e.t7)(m,g,w);Q.push([N,ct,Ie/2,J,Ze]),s+=Ie}return Q}var ka=S(93434);const Ti=(0,C.lJ)(),Qt=[],Nt=[],Zt=[],ei=[];function Sr(r){return r[3].declutterBox}const Ba=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 Tr(r,e){return(e==="start"||e==="end")&&!Ba.test(r)&&(e=e==="start"?"left":"right"),Qi[e]}function za(r,e,t){return t>0&&r.push(`
`,""),r.push(e,""),r}class Ga{constructor(e,t,i,n){this.overlaps=i,this.pixelRatio=t,this.resolution=e,this.alignFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=(0,q.Ue)(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={}}createLabel(e,t,i,n){const s=e+t+i+n;if(this.labels_[s])return this.labels_[s];const o=n?this.strokeStates[n]:null,a=i?this.fillStates[i]:null,l=this.textStates[t],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],d=Array.isArray(e),u=l.justify?Qi[l.justify]:Tr(Array.isArray(e)?e[0]:e,l.textAlign||X.PH),g=n&&o.lineWidth?o.lineWidth:0,f=d?e:e.split(`
`).reduce(za,[]),{width:m,height:p,widths:v,heights:y,lineWidths:w}=(0,X.Zw)(l,f),b=m+g,F=[],L=(b+2)*c[0],A=(p+g)*c[1],G={width:L<0?Math.floor(L):Math.ceil(L),height:A<0?Math.floor(A):Math.ceil(A),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 H=.5-u;let K=u*b+H*g;const le=[],he=[];let Q=0,me=0,re=0,Y=0,Z;for(let J=0,Ee=f.length;J<Ee;J+=2){const Ie=f[J];if(Ie===`
`){me+=Q,Q=0,K=u*b+H*g,++Y;continue}const Ze=f[J+1]||l.font;Ze!==Z&&(n&&le.push("font",Ze),i&&he.push("font",Ze),Z=Ze),Q=Math.max(Q,y[re]);const N=[Ie,K+H*v[re]+u*(v[re]-w[Y]),.5*(g+Q)+me];K+=v[re],n&&le.push("strokeText",N),i&&he.push("fillText",N),++re}return Array.prototype.push.apply(F,le),Array.prototype.push.apply(F,he),this.labels_[s]=G,G}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,d,u,g,f,m,p){a*=u[0],l*=u[1];let v=i-a,y=n-l;const w=s+h>e?e-h:s,b=o+c>t?t-c:o,F=f[3]+w*u[0]+f[1],L=f[0]+b*u[1]+f[2],A=v-f[3],G=y-f[0];(m||d!==0)&&(Qt[0]=A,ei[0]=A,Qt[1]=G,Nt[1]=G,Nt[0]=A+F,Zt[0]=Nt[0],Zt[1]=G+L,ei[1]=Zt[1]);let H;return d!==0?(H=(0,q.qC)((0,q.Ue)(),i,n,1,1,d,-i,-n),(0,q.nn)(H,Qt),(0,q.nn)(H,Nt),(0,q.nn)(H,Zt),(0,q.nn)(H,ei),(0,C.T9)(Math.min(Qt[0],Nt[0],Zt[0],ei[0]),Math.min(Qt[1],Nt[1],Zt[1],ei[1]),Math.max(Qt[0],Nt[0],Zt[0],ei[0]),Math.max(Qt[1],Nt[1],Zt[1],ei[1]),Ti)):(0,C.T9)(Math.min(A,A+F),Math.min(G,G+L),Math.max(A,A+F),Math.max(G,G+L),Ti),g&&(v=Math.round(v),y=Math.round(y)),{drawImageX:v,drawImageY:y,drawImageW:w,drawImageH:b,originX:h,originY:c,declutterBox:{minX:Ti[0],minY:Ti[1],maxX:Ti[2],maxY:Ti[3],value:p},canvasTransform:H,scale:u}}replayImageOrLabel_(e,t,i,n,s,o,a){const l=!!(o||a),h=n.declutterBox,c=e.canvas,d=a?a[2]*n.scale[0]/2:0;return h.minX-d<=c.width/t&&h.maxX+d>=0&&h.minY-d<=c.height/t&&h.maxY+d>=0&&(l&&this.replayTextBackground_(e,Qt,Nt,Zt,ei,o,a),(0,X._f)(e,n.canvasTransform,s,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(e){if(this.alignFill_){const t=(0,q.nn)(this.renderedTransform_,[0,0]),i=512*this.pixelRatio;e.save(),e.translate(t[0]%i,t[1]%i),e.rotate(this.viewRotation_)}e.fill(),this.alignFill_&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6])}drawLabelWithPointPlacement_(e,t,i,n){const s=this.textStates[t],o=this.createLabel(e,t,n,i),a=this.strokeStates[i],l=this.pixelRatio,h=Tr(Array.isArray(e)?e[0]:e,s.textAlign||X.PH),c=Qi[s.textBaseline||X.ru],d=a&&a.lineWidth?a.lineWidth:0,u=o.width/l-2*s.scale[0],g=h*u+2*(.5-h)*d,f=c*o.height/l+2*(.5-c)*d;return{label:o,anchorX:g,anchorY:f}}execute_(e,t,i,n,s,o,a,l){let h;this.pixelCoordinates_&&(0,et.fS)(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=(0,pi.vT)(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),(0,q.lk)(this.renderedTransform_,i));let c=0;const d=n.length;let u=0,g,f,m,p,v,y,w,b,F,L,A,G,H=0,K=0,le=null,he=null;const Q=this.coordinateCache_,me=this.viewRotation_,re=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,Y={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:me},Z=this.instructions!=n||this.overlaps?0:200;let J,Ee,Ie,Ze;for(;c<d;){const N=n[c];switch(N[0]){case se.BEGIN_GEOMETRY:J=N[1],Ze=N[3],J.getGeometry()?a!==void 0&&!(0,C.kK)(a,Ze.getExtent())?c=N[2]+1:++c:c=N[2];break;case se.BEGIN_PATH:H>Z&&(this.fill_(e),H=0),K>Z&&(e.stroke(),K=0),!H&&!K&&(e.beginPath(),p=NaN,v=NaN),++c;break;case se.CIRCLE:u=N[1];const we=h[u],Le=h[u+1],ai=h[u+2],zt=h[u+3],Xe=ai-we,Vt=zt-Le,Zi=Math.sqrt(Xe*Xe+Vt*Vt);e.moveTo(we+Zi,Le),e.arc(we,Le,Zi,0,2*Math.PI,!0),++c;break;case se.CLOSE_PATH:e.closePath(),++c;break;case se.CUSTOM:u=N[1],g=N[2];const Jn=N[3],Wi=N[4],$n=N.length==6?N[5]:void 0;Y.geometry=Jn,Y.feature=J,c in Q||(Q[c]=[]);const li=Q[c];$n?$n(h,u,g,2,li):(li[0]=h[u],li[1]=h[u+1],li.length=2),Wi(li,Y),++c;break;case se.DRAW_IMAGE:u=N[1],g=N[2],b=N[3],f=N[4],m=N[5];let dn=N[6];const hi=N[7],qn=N[8],Qn=N[9],es=N[10];let Ui=N[11];const tr=N[12];let st=N[13];const vt=N[14],Lt=N[15];if(!b&&N.length>=20){F=N[19],L=N[20],A=N[21],G=N[22];const ut=this.drawLabelWithPointPlacement_(F,L,A,G);b=ut.label,N[3]=b;const Yi=N[23];f=(ut.anchorX-Yi)*this.pixelRatio,N[4]=f;const Et=N[24];m=(ut.anchorY-Et)*this.pixelRatio,N[5]=m,dn=b.height,N[6]=dn,st=b.width,N[13]=st}let Yt;N.length>25&&(Yt=N[25]);let Xi,Ei,ci;N.length>17?(Xi=N[16],Ei=N[17],ci=N[18]):(Xi=X.oB,Ei=!1,ci=!1),es&&re?Ui+=me:!es&&!re&&(Ui-=me);let Vi=0;for(;u<g;u+=2){if(Yt&&Yt[Vi++]<st/this.pixelRatio)continue;const ut=this.calculateImageOrLabelDimensions_(b.width,b.height,h[u],h[u+1],st,dn,f,m,qn,Qn,Ui,tr,s,Xi,Ei||ci,J),Yi=[e,t,b,ut,hi,Ei?le:null,ci?he:null];if(l){if(vt==="none")continue;if(vt==="obstacle"){l.insert(ut.declutterBox);continue}else{let Et,jt;if(Lt){const dt=g-u;if(!Lt[dt]){Lt[dt]=Yi;continue}if(Et=Lt[dt],delete Lt[dt],jt=Sr(Et),l.collides(jt))continue}if(l.collides(ut.declutterBox))continue;Et&&(l.insert(jt),this.replayImageOrLabel_.apply(this,Et)),l.insert(ut.declutterBox)}}this.replayImageOrLabel_.apply(this,Yi)}++c;break;case se.DRAW_CHARS:const ts=N[1],it=N[2],ir=N[3],gu=N[4];G=N[5];const mu=N[6],ia=N[7],na=N[8];A=N[9];const nr=N[10];F=N[11],L=N[12];const sa=[N[13],N[13]],sr=this.textStates[L],fn=sr.font,gn=[sr.scale[0]*ia,sr.scale[1]*ia];let mn;fn in this.widths_?mn=this.widths_[fn]:(mn={},this.widths_[fn]=mn);const ra=(0,ka.W)(h,ts,it,2),oa=Math.abs(gn[0])*(0,X.Kd)(fn,F,mn);if(gu||oa<=ra){const ut=this.textStates[L].textAlign,Yi=(ra-oa)*Qi[ut],Et=Oa(h,ts,it,2,F,Yi,mu,Math.abs(gn[0]),X.Kd,fn,mn,re?0:this.viewRotation_);e:if(Et){const jt=[];let dt,is,ns,rt,Ct;if(A)for(dt=0,is=Et.length;dt<is;++dt){Ct=Et[dt],ns=Ct[4],rt=this.createLabel(ns,L,"",A),f=Ct[2]+(gn[0]<0?-nr:nr),m=ir*rt.height+(.5-ir)*2*nr*gn[1]/gn[0]-na;const Ht=this.calculateImageOrLabelDimensions_(rt.width,rt.height,Ct[0],Ct[1],rt.width,rt.height,f,m,0,0,Ct[3],sa,!1,X.oB,!1,J);if(l&&l.collides(Ht.declutterBox))break e;jt.push([e,t,rt,Ht,1,null,null])}if(G)for(dt=0,is=Et.length;dt<is;++dt){Ct=Et[dt],ns=Ct[4],rt=this.createLabel(ns,L,G,""),f=Ct[2],m=ir*rt.height-na;const Ht=this.calculateImageOrLabelDimensions_(rt.width,rt.height,Ct[0],Ct[1],rt.width,rt.height,f,m,0,0,Ct[3],sa,!1,X.oB,!1,J);if(l&&l.collides(Ht.declutterBox))break e;jt.push([e,t,rt,Ht,1,null,null])}l&&l.load(jt.map(Sr));for(let Ht=0,pu=jt.length;Ht<pu;++Ht)this.replayImageOrLabel_.apply(this,jt[Ht])}}++c;break;case se.END_GEOMETRY:if(o!==void 0){J=N[1];const ut=o(J,Ze);if(ut)return ut}++c;break;case se.FILL:Z?H++:this.fill_(e),++c;break;case se.MOVE_TO_LINE_TO:for(u=N[1],g=N[2],Ee=h[u],Ie=h[u+1],y=Ee+.5|0,w=Ie+.5|0,(y!==p||w!==v)&&(e.moveTo(Ee,Ie),p=y,v=w),u+=2;u<g;u+=2)Ee=h[u],Ie=h[u+1],y=Ee+.5|0,w=Ie+.5|0,(u==g-2||y!==p||w!==v)&&(e.lineTo(Ee,Ie),p=y,v=w);++c;break;case se.SET_FILL_STYLE:le=N,this.alignFill_=N[2],H&&(this.fill_(e),H=0,K&&(e.stroke(),K=0)),e.fillStyle=N[1],++c;break;case se.SET_STROKE_STYLE:he=N,K&&(e.stroke(),K=0),this.setStrokeStyle_(e,N),++c;break;case se.STROKE:Z?K++:e.stroke(),++c;break;default:++c;break}}H&&this.fill_(e),K&&e.stroke()}execute(e,t,i,n,s,o){this.viewRotation_=n,this.execute_(e,t,i,this.instructions,s,void 0,void 0,o)}executeHitDetection(e,t,i,n,s){return this.viewRotation_=i,this.execute_(e,1,t,this.hitDetectionInstructions,!0,n,s)}}const Na=Ga,xs=["Polygon","Circle","LineString","Image","Text","Default"];class Za{constructor(e,t,i,n,s,o){this.maxExtent_=e,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=(0,q.Ue)(),this.createExecutors_(s)}clip(e,t){const i=this.getClipCoords(t);e.beginPath(),e.moveTo(i[0],i[1]),e.lineTo(i[2],i[3]),e.lineTo(i[4],i[5]),e.lineTo(i[6],i[7]),e.clip()}createExecutors_(e){for(const t in e){let i=this.executorsByZIndex_[t];i===void 0&&(i={},this.executorsByZIndex_[t]=i);const n=e[t];for(const s in n){const o=n[s];i[s]=new Na(this.resolution_,this.pixelRatio_,this.overlaps_,o)}}}hasExecutors(e){for(const t in this.executorsByZIndex_){const i=this.executorsByZIndex_[t];for(let n=0,s=e.length;n<s;++n)if(e[n]in i)return!0}return!1}forEachFeatureAtCoordinate(e,t,i,n,s,o){n=Math.round(n);const a=n*2+1,l=(0,q.qC)(this.hitDetectionTransform_,n+.5,n+.5,1/t,-1/t,-i,-e[0],-e[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=(0,ke.E4)(a,a,void 0,{willReadFrequently:!0}));const c=this.hitDetectionContext_;c.canvas.width!==a||c.canvas.height!==a?(c.canvas.width=a,c.canvas.height=a):h||c.clearRect(0,0,a,a);let d;this.renderBuffer_!==void 0&&(d=(0,C.lJ)(),(0,C.Wj)(d,e),(0,C.f3)(d,t*(this.renderBuffer_+n),d));const u=Wa(n);let g;function f(F,L){const A=c.getImageData(0,0,a,a).data;for(let G=0,H=u.length;G<H;G++)if(A[u[G]]>0){if(!o||g!=="Image"&&g!=="Text"||o.includes(F)){const K=(u[G]-3)/4,le=n-K%a,he=n-(K/a|0),Q=s(F,L,le*le+he*he);if(Q)return Q}c.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(et.j2);let p,v,y,w,b;for(p=m.length-1;p>=0;--p){const F=m[p].toString();for(y=this.executorsByZIndex_[F],v=xs.length-1;v>=0;--v)if(g=xs[v],w=y[g],w!==void 0&&(b=w.executeHitDetection(c,l,i,f,d),b))return b}}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,pi.vT)(a,0,8,2,e,a),a}isEmpty(){return(0,ji.x)(this.executorsByZIndex_)}execute(e,t,i,n,s,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(et.j2),this.maxExtent_&&(e.save(),this.clip(e,i)),o=o||xs;let h,c,d,u,g,f;for(a&&l.reverse(),h=0,c=l.length;h<c;++h){const m=l[h].toString();for(g=this.executorsByZIndex_[m],d=0,u=o.length;d<u;++d){const p=o[d];f=g[p],f!==void 0&&f.execute(e,t,i,n,s,a)}}this.maxExtent_&&e.restore()}}const ys={};function Wa(r){if(ys[r]!==void 0)return ys[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 ys[r]=n,n}const Ir=Za;var Ii=S(69265),Ri=S(12682);class Ua extends xr{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,_e.FH)(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=(0,q.Ue)()}drawImages_(e,t,i,n){if(!this.image_)return;const s=(0,pi.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,d=s.length;c<d;c+=2){const u=s[c]-this.imageAnchorX_,g=s[c+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const f=u+this.imageAnchorX_,m=g+this.imageAnchorY_;(0,q.qC)(a,f,m,1,1,h,-f,-m),o.setTransform.apply(o,a),o.translate(f,m),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.setTransform(1,0,0,1,0,0)}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,u,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,pi.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,pi.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(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!(0,C.kK)(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=(0,Ri.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&&(this.setStyle(t),this.drawGeometry(i))}drawGeometryCollection(e){const t=e.getGeometriesArray();for(let i=0,n=t.length;i<n;++i)this.drawGeometry(t[i])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),i=e.getStride();this.image_&&this.drawImages_(t,0,t.length,i),this.text_!==""&&this.drawText_(t,0,t.length,i)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),i=e.getStride();this.image_&&this.drawImages_(t,0,t.length,i),this.text_!==""&&this.drawText_(t,0,t.length,i)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!(0,C.kK)(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const t=this.context_,i=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(i,0,i.length,e.getStride(),!1),t.stroke()}if(this.text_!==""){const t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getExtent();if((0,C.kK)(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const i=this.context_,n=e.getFlatCoordinates();let s=0;const o=e.getEnds(),a=e.getStride();i.beginPath();for(let l=0,h=o.length;l<h;++l)s=this.moveToLineTo_(n,s,o[l],a,!1);i.stroke()}if(this.text_!==""){const i=e.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!(0,C.kK)(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride()),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){const t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!(0,C.kK)(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=this.context_,i=e.getOrientedFlatCoordinates();let n=0;const s=e.getEndss(),o=e.getStride();t.beginPath();for(let a=0,l=s.length;a<l;++a){const h=s[a];n=this.drawRings_(i,n,h,o)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){const t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){const t=this.context_,i=this.contextFillState_;i?i.fillStyle!=e.fillStyle&&(i.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){const t=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=e.lineCap&&(i.lineCap=e.lineCap,t.lineCap=e.lineCap),(0,et.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:X.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:Dt(i||X.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||X.X9;this.strokeState_={lineCap:n!==void 0?n:X.mb,lineDash:this.pixelRatio_===1?c:c.map(d=>d*this.pixelRatio_),lineDashOffset:(o||X.He)*this.pixelRatio_,lineJoin:a!==void 0?a:X.rc,lineWidth:(l!==void 0?l:X.yC)*this.pixelRatio_,miterLimit:h!==void 0?h:X.V4,strokeStyle:Dt(i||X.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:Dt(g||X.bL)}}const i=e.getStroke();if(!i)this.textStrokeState_=null;else{const g=i.getColor(),f=i.getLineCap(),m=i.getLineDash(),p=i.getLineDashOffset(),v=i.getLineJoin(),y=i.getWidth(),w=i.getMiterLimit();this.textStrokeState_={lineCap:f!==void 0?f:X.mb,lineDash:m||X.X9,lineDashOffset:p||X.He,lineJoin:v!==void 0?v:X.rc,lineWidth:y!==void 0?y:X.yC,miterLimit:w!==void 0?w:X.V4,strokeStyle:Dt(g||X.Tx)}}const n=e.getFont(),s=e.getOffsetX(),o=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),h=e.getScaleArray(),c=e.getText(),d=e.getTextAlign(),u=e.getTextBaseline();this.textState_={font:n!==void 0?n:X.Df,textAlign:d!==void 0?d:X.PH,textBaseline:u!==void 0?u:X.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 Xa=Ua,At=.5;function Va(r,e,t,i,n,s,o){const a=r[0]*At,l=r[1]*At,h=(0,ke.E4)(a,l);h.imageSmoothingEnabled=!1;const c=h.canvas,d=new Xa(h,At,n,null,o),u=t.length,g=Math.floor((256*256*256-1)/u),f={};for(let p=1;p<=u;++p){const v=t[p-1],y=v.getStyleFunction()||i;if(!i)continue;let w=y(v,s);if(!w)continue;Array.isArray(w)||(w=[w]);const F=(p*g).toString(16).padStart(7,"#00000");for(let L=0,A=w.length;L<A;++L){const G=w[L],H=G.getGeometryFunction()(v);if(!H||!(0,C.kK)(n,H.getExtent()))continue;const K=G.clone(),le=K.getFill();le&&le.setColor(F);const he=K.getStroke();he&&(he.setColor(F),he.setLineDash(null)),K.setText(void 0);const Q=G.getImage();if(Q&&Q.getOpacity()!==0){const Z=Q.getImageSize();if(!Z)continue;const J=(0,ke.E4)(Z[0],Z[1],void 0,{alpha:!1}),Ee=J.canvas;J.fillStyle=F,J.fillRect(0,0,Ee.width,Ee.height),K.setImage(new En({img:Ee,imgSize:Z,anchor:Q.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:Q.getOrigin(),opacity:1,size:Q.getSize(),scale:Q.getScale(),rotation:Q.getRotation(),rotateWithView:Q.getRotateWithView()}))}const me=K.getZIndex()||0;let re=f[me];re||(re={},f[me]=re,re.Polygon=[],re.Circle=[],re.LineString=[],re.Point=[]);const Y=H.getType();if(Y==="GeometryCollection"){const Z=H.getGeometriesArrayRecursive();for(let J=0,Ee=Z.length;J<Ee;++J){const Ie=Z[J];re[Ie.getType().replace("Multi","")].push(Ie,K)}}else re[Y.replace("Multi","")].push(H,K)}}const m=Object.keys(f).map(Number).sort(et.j2);for(let p=0,v=m.length;p<v;++p){const y=f[m[p]];for(const w in y){const b=y[w];for(let F=0,L=b.length;F<L;F+=2){d.setStyle(b[F+1]);for(let A=0,G=e.length;A<G;++A)d.setTransform(e[A]),d.drawGeometry(b[F])}}}return h.getImageData(0,0,c.width,c.height)}function Ya(r,e,t){const i=[];if(t){const n=Math.floor(Math.round(r[0])*At),s=Math.floor(Math.round(r[1])*At),o=((0,_e.uZ)(n,0,t.width-1)+(0,_e.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),d=Math.floor((256*256*256-1)/e.length);c&&c%d===0&&i.push(e[c/d-1])}return i}const ja=.5,Rr={Point:il,LineString:Qa,Polygon:sl,MultiPoint:nl,MultiLineString:el,MultiPolygon:tl,GeometryCollection:qa,Circle:Ja};function Ha(r,e){return parseInt((0,$.sq)(r),10)-parseInt((0,$.sq)(e),10)}function Ka(r,e){const t=vs(r,e);return t*t}function vs(r,e){return ja*r/e}function Ja(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 br(r,e,t,i,n,s,o){let a=!1;const l=t.getImage();if(l){const h=l.getImageState();h==Ae.LOADED||h==Ae.ERROR?l.unlistenImageChange(n):(h==Ae.IDLE&&l.load(),l.listenImageChange(n),a=!0)}return $a(r,e,t,i,s,o),a}function $a(r,e,t,i,n,s){const o=t.getGeometryFunction()(e);if(!o)return;const a=o.simplifyTransformed(i,n);if(t.getRenderer())Lr(r,a,t,e);else{const h=Rr[a.getType()];h(r,a,t,e,s)}}function Lr(r,e,t,i){if(e.getType()=="GeometryCollection"){const s=e.getGeometries();for(let o=0,a=s.length;o<a;++o)Lr(r,s[o],t,i);return}r.getBuilder(t.getZIndex(),"Default").drawCustom(e,i,t.getRenderer(),t.getHitDetectionRenderer())}function qa(r,e,t,i,n){const s=e.getGeometriesArray();let o,a;for(o=0,a=s.length;o<a;++o){const l=Rr[s[o].getType()];l(r,s[o],t,i,n)}}function Qa(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 el(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 tl(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 il(r,e,t,i,n){const s=t.getImage(),o=t.getText();let a;if(s){if(s.getImageState()!=Ae.LOADED)return;let l=r;if(n){const c=s.getDeclutterMode();if(c!=="none")if(l=n,c==="obstacle"){const d=r.getBuilder(t.getZIndex(),"Image");d.setImageStyle(s,a),d.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 nl(r,e,t,i,n){const s=t.getImage(),o=t.getText();let a;if(s){if(s.getImageState()!=Ae.LOADED)return;let l=r;if(n){const c=s.getDeclutterMode();if(c!=="none")if(l=n,c==="obstacle"){const d=r.getBuilder(t.getZIndex(),"Image");d.setImageStyle(s,a),d.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 sl(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 Ne=S(46973);class rl extends wr{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=(0,C.lJ)(),this.wrappedRenderedExtent_=(0,C.lJ)(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedRenderOrder_=null,this.replayGroup_=null,this.replayGroupChanged=!0,this.declutterExecutorGroup=null,this.clipping=!0,this.compositionContext_=null,this.opacity_=1}renderWorlds(e,t,i){const n=t.extent,s=t.viewState,o=s.center,a=s.resolution,l=s.projection,h=s.rotation,c=l.getExtent(),d=this.getLayer().getSource(),u=t.pixelRatio,g=t.viewHints,f=!(g[Ii.Z.ANIMATING]||g[Ii.Z.INTERACTING]),m=this.compositionContext_,p=Math.round(t.size[0]*u),v=Math.round(t.size[1]*u),y=d.getWrapX()&&l.canWrapX(),w=y?(0,C.dz)(c):null,b=y?Math.ceil((n[2]-c[2])/w)+1:1;let F=y?Math.floor((n[0]-c[0])/w):0;do{const L=this.getRenderTransform(o,a,h,u,p,v,F*w);e.execute(m,1,L,h,f,void 0,i)}while(++F<b)}setupCompositionContext_(){if(this.opacity_!==1){const e=(0,ke.E4)(this.context.canvas.width,this.context.canvas.height,Cr);this.compositionContext_=e}else this.compositionContext_=this.context}releaseCompositionContext_(){if(this.opacity_!==1){const e=this.context.globalAlpha;this.context.globalAlpha=this.opacity_,this.context.drawImage(this.compositionContext_.canvas,0,0),this.context.globalAlpha=e,(0,ke.jy)(this.compositionContext_),Cr.push(this.compositionContext_.canvas),this.compositionContext_=null}}renderDeclutter(e){this.declutterExecutorGroup&&(this.setupCompositionContext_(),this.renderWorlds(this.declutterExecutorGroup,e,e.declutterTree),this.releaseCompositionContext_())}renderFrame(e,t){const i=e.pixelRatio,n=e.layerStatesArray[e.layerIndex];(0,q.n3)(this.pixelTransform,1/i,1/i),(0,q.nb)(this.inversePixelTransform,this.pixelTransform);const s=(0,q.BB)(this.pixelTransform);this.useContainer(t,s,this.getBackground(e));const o=this.context,a=o.canvas,l=this.replayGroup_,h=this.declutterExecutorGroup;if((!l||l.isEmpty())&&(!h||h.isEmpty()))return null;const c=Math.round(e.size[0]*i),d=Math.round(e.size[1]*i);a.width!=c||a.height!=d?(a.width=c,a.height=d,a.style.transform!==s&&(a.style.transform=s)):this.containerReused||o.clearRect(0,0,c,d),this.preRender(o,e);const u=e.viewState,g=u.projection;this.opacity_=n.opacity,this.setupCompositionContext_();let f=!1,m=!0;if(n.extent&&this.clipping){const p=(0,U.dY)(n.extent,g);m=(0,C.kK)(p,e.extent),f=m&&!(0,C.r4)(p,e.extent),f&&this.clipUnrotated(this.compositionContext_,e,p)}return m&&this.renderWorlds(l,e),f&&this.compositionContext_.restore(),this.releaseCompositionContext_(),this.postRender(o,e),this.renderedRotation_!==u.rotation&&(this.renderedRotation_=u.rotation,this.hitDetectionImageData_=null),this.container}getFeatures(e){return new Promise(t=>{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=[this.context.canvas.width,this.context.canvas.height];(0,q.nn)(this.pixelTransform,i);const n=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),c=[],d=i[0]*At,u=i[1]*At;c.push(this.getRenderTransform(n,s,o,At,d,u,0).slice());const g=h.getSource(),f=a.getExtent();if(g.getWrapX()&&a.canWrapX()&&!(0,C.r4)(f,l)){let m=l[0];const p=(0,C.dz)(f);let v=0,y;for(;m<f[0];)--v,y=p*v,c.push(this.getRenderTransform(n,s,o,At,d,u,y).slice()),m+=p;for(v=0,m=l[2];m>f[2];)++v,y=p*v,c.push(this.getRenderTransform(n,s,o,At,d,u,y).slice()),m-=p}this.hitDetectionImageData_=Va(i,c,this.renderedFeatures_,h.getStyleFunction(),l,s,o)}t(Ya(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 p=(0,$.sq)(g),v=h[p];if(v){if(v!==!0&&m<v.distanceSq){if(m===0)return h[p]=!0,s.splice(s.lastIndexOf(v),1),n(g,l,f);v.geometry=f,v.distanceSq=m}}else{if(m===0)return h[p]=!0,n(g,l,f);s.push(h[p]={feature:g,layer:l,geometry:f,distanceSq:m,callback:n})}};let d;const u=[this.replayGroup_];return this.declutterExecutorGroup&&u.push(this.declutterExecutorGroup),u.some(g=>d=g.forEachFeatureAtCoordinate(e,o,a,i,c,g===this.declutterExecutorGroup&&t.declutterTree?t.declutterTree.all().map(f=>f.value):null)),d}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[Ii.Z.ANIMATING],s=e.viewHints[Ii.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,d=h.resolution,u=e.pixelRatio,g=t.getRevision(),f=t.getRenderBuffer();let m=t.getRenderOrder();m===void 0&&(m=Ha);const p=h.center.slice(),v=(0,C.f3)(l,f*d),y=v.slice(),w=[v.slice()],b=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!(0,C.r4)(b,e.extent)){const Y=(0,C.dz)(b),Z=Math.max((0,C.dz)(v)/2,Y);v[0]=b[0]-Z,v[2]=b[2]+Z,(0,Ne.Cf)(p,c);const J=(0,C.Cf)(w[0],c);J[0]<b[0]&&J[2]<b[2]?w.push([J[0]+Y,J[1],J[2]+Y,J[3]]):J[0]>b[0]&&J[2]>b[2]&&w.push([J[0]-Y,J[1],J[2]-Y,J[3]])}if(this.ready&&this.renderedResolution_==d&&this.renderedRevision_==g&&this.renderedRenderOrder_==m&&(0,C.r4)(this.wrappedRenderedExtent_,v))return(0,et.fS)(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const F=new vr(vs(d,u),v,d,u);let L;this.getLayer().getDeclutter()&&(L=new vr(vs(d,u),v,d,u));const A=(0,U.Cs)();let G;if(A){for(let Y=0,Z=w.length;Y<Z;++Y){const J=w[Y],Ee=(0,U.Fj)(J,c);i.loadFeatures(Ee,(0,U.on)(d,c),A)}G=(0,U.WO)(A,c)}else for(let Y=0,Z=w.length;Y<Z;++Y)i.loadFeatures(w[Y],d,c);const H=Ka(d,u);let K=!0;const le=Y=>{let Z;const J=Y.getStyleFunction()||t.getStyleFunction();if(J&&(Z=J(Y,d)),Z){const Ee=this.renderFeature(Y,H,Z,F,G,L);K=K&&!Ee}},he=(0,U.Fj)(v,c),Q=i.getFeaturesInExtent(he);m&&Q.sort(m);for(let Y=0,Z=Q.length;Y<Z;++Y)le(Q[Y]);this.renderedFeatures_=Q,this.ready=K;const me=F.finish(),re=new Ir(v,d,u,i.getOverlaps(),me,t.getRenderBuffer());return L&&(this.declutterExecutorGroup=new Ir(v,d,u,i.getOverlaps(),L.finish(),t.getRenderBuffer())),this.renderedResolution_=d,this.renderedRevision_=g,this.renderedRenderOrder_=m,this.renderedExtent_=y,this.wrappedRenderedExtent_=v,this.renderedCenter_=p,this.renderedProjection_=c,this.replayGroup_=re,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=br(n,e,i[l],t,this.boundHandleStyleImageChange_,s,o)||a;else a=br(n,e,i,t,this.boundHandleStyleImageChange_,s,o);return a}}const ol=rl;class al extends ps{constructor(e){super(e)}createRenderer(){return new ol(this)}}const Be=al;var ll=S(35840),hl=S(19520);class cl extends hl.Z{constructor(e){super(),this.projection=(0,U.U2)(e.projection),this.attributions_=Fr(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_=Fr(e),this.changed()}setState(e){this.state_=e,this.changed()}}function Fr(r){return r?Array.isArray(r)?function(e){return r}:typeof r=="function"?r:function(e){return[r]}:null}const Mr=cl;var en=S(3556);function Pr(r,e){return[[-1/0,-1/0,1/0,1/0]]}function Eu(r,e){return[r]}function Cu(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 Dr=!1;function ul(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=Dr,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 Ar(r,e){return function(t,i,n,s,o){const a=this;ul(r,e,t,i,n,function(l,h){a.addFeatures(l),s!==void 0&&s(l)},o||en.Zn)}}function wu(r){Dr=r}class ti extends vn.ZP{constructor(e,t,i){super(e),this.feature=t,this.features=i}}class dl extends Mr{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_=en.Zn,this.format_=e.format,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&((0,ue.h)(this.format_,7),this.loader_=Ar(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:Pr;const t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new os:null,this.loadedExtentsRtree_=new os,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 rs.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,$.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(Ue.ADDFEATURE,e))}setupChangeEvents_(e,t){this.featureChangeKeys_[e]=[(0,Qe.oL)(t,at.Z.CHANGE,this.handleFeatureChange_,this),(0,Qe.oL)(t,ll.Z.PROPERTYCHANGE,this.handleFeatureChange_,this)]}addToIndex_(e,t){let i=!0;const n=t.getId();return n!==void 0&&(n.toString()in this.idIndex_?i=!1:this.idIndex_[n.toString()]=t),i&&((0,ue.h)(!(e in this.uidIndex_),30),this.uidIndex_[e]=t),i}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){const t=[],i=[],n=[];for(let s=0,o=e.length;s<o;s++){const a=e[s],l=(0,$.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,$.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(Ue.ADDFEATURE))for(let s=0,o=i.length;s<o;s++)this.dispatchEvent(new ti(Ue.ADDFEATURE,i[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(Ue.ADDFEATURE,function(i){t||(t=!0,e.push(i.feature),t=!1)}),this.addEventListener(Ue.REMOVEFEATURE,function(i){t||(t=!0,e.remove(i.feature),t=!1)}),e.addEventListener(yn.Z.ADD,i=>{t||(t=!0,this.addFeature(i.element),t=!1)}),e.addEventListener(yn.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(Qe.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(Ue.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,ji.x)(this.nullGeometryFeatures_)||(0,et.l7)(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){const t=[];return this.forEachFeatureAtCoordinateDirect(e,function(i){t.push(i)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);const n=(0,C.MV)(e,t);return[].concat(...n.map(s=>this.featuresRtree_.getInExtent(s)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}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||en.uX,this.featuresRtree_.forEachInExtent(l,function(h){if(t(h)){const c=h.getGeometry(),d=a;if(a=c.closestPointXY(i,n,o,a),a<d){s=h;const u=Math.sqrt(a);l[0]=i-u,l[1]=n-u,l[2]=i+u,l[3]=n+u}}}),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,$.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(Ue.CHANGEFEATURE,t))}hasFeature(e){const t=e.getId();return t!==void 0?t in this.idIndex_:(0,$.sq)(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&(0,ji.x)(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,i){const n=this.loadedExtentsRtree_,s=this.strategy_(e,t,i);for(let o=0,a=s.length;o<a;++o){const l=s[o];n.forEachInExtent(l,function(c){return(0,C.r4)(c.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new ti(Ue.FEATURESLOADSTART)),this.loader_.call(this,l,t,i,c=>{--this.loadingExtentsCount_,this.dispatchEvent(new ti(Ue.FEATURESLOADEND,void 0,c))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new ti(Ue.FEATURESLOADERROR))}),n.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){const t=this.loadedExtentsRtree_;let i;t.forEachInExtent(e,function(n){if((0,C.fS)(n.extent,e))return i=n,!0}),i&&t.remove(i)}removeFeature(e){if(!e)return;const t=(0,$.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,$.sq)(e),i=this.featureChangeKeys_[t];if(!i)return;i.forEach(Qe.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(Ue.REMOVEFEATURE,e)),e}removeFromIdIndex_(e){let t=!1;for(const i in this.idIndex_)if(this.idIndex_[i]===e){delete this.idIndex_[i],t=!0;break}return t}setLoader(e){this.loader_=e}setUrl(e){(0,ue.h)(this.format_,7),this.url_=e,this.setLoader(Ar(e,this.format_))}}const _t=dl;var Wt=S(6660);const Or=0,tn=1,kr=[0,0,0,0],bi=[],Es={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"};class Cs extends vn.ZP{constructor(e,t,i){super(e),this.features=t,this.mapBrowserEvent=i}}class fl extends rr.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 os,this.pixelTolerance_=e.pixelTolerance!==void 0?e.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new Be({source:new _t({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:ml(),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 rs.Z(this.source_.getFeatures()),this.source_.addEventListener(Ue.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(Ue.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(yn.Z.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(yn.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(at.Z.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(e,t){if(!this.featuresBeingModified_){this.featuresBeingModified_=new rs.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 Cs(Es.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(at.Z.CHANGE,this.boundHandleFeatureChange_)}removeFeatureSegmentData_(e){const t=this.rBush_,i=[];t.forEach(function(n){e===n.feature&&i.push(n)});for(let n=i.length-1;n>=0;--n){const s=i[n];for(let o=this.dragSegments_.length-1;o>=0;--o)this.dragSegments_[o][0]===s&&this.dragSegments_.splice(o,1);t.remove(s)}}setActive(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(e)}setMap(e){this.overlay_.setMap(e),super.setMap(e)}getOverlay(){return this.overlay_}handleSourceAdd_(e){e.feature&&this.features_.push(e.feature)}handleSourceRemove_(e){e.feature&&this.features_.remove(e.feature)}handleFeatureAdd_(e){this.addFeature_(e.element)}handleFeatureChange_(e){if(!this.changingFeature_){const t=e.target;this.removeFeature_(t),this.addFeature_(t)}}handleFeatureRemove_(e){this.removeFeature_(e.element)}writePointGeometry_(e,t){const i=t.getCoordinates(),n={feature:e,geometry:t,segment:[i,i]};this.rBush_.insert(t.getExtent(),n)}writeMultiPointGeometry_(e,t){const i=t.getCoordinates();for(let n=0,s=i.length;n<s;++n){const o=i[n],a={feature:e,geometry:t,depth:[n],index:n,segment:[o,o]};this.rBush_.insert(t.getExtent(),a)}}writeLineStringGeometry_(e,t){const i=t.getCoordinates();for(let n=0,s=i.length-1;n<s;++n){const o=i.slice(n,n+2),a={feature:e,geometry:t,index:n,segment:o};this.rBush_.insert((0,C.hI)(o),a)}}writeMultiLineStringGeometry_(e,t){const i=t.getCoordinates();for(let n=0,s=i.length;n<s;++n){const o=i[n];for(let a=0,l=o.length-1;a<l;++a){const h=o.slice(a,a+2),c={feature:e,geometry:t,depth:[n],index:a,segment:h};this.rBush_.insert((0,C.hI)(h),c)}}}writePolygonGeometry_(e,t){const i=t.getCoordinates();for(let n=0,s=i.length;n<s;++n){const o=i[n];for(let a=0,l=o.length-1;a<l;++a){const h=o.slice(a,a+2),c={feature:e,geometry:t,depth:[n],index:a,segment:h};this.rBush_.insert((0,C.hI)(h),c)}}}writeMultiPolygonGeometry_(e,t){const i=t.getCoordinates();for(let n=0,s=i.length;n<s;++n){const o=i[n];for(let a=0,l=o.length;a<l;++a){const h=o[a];for(let c=0,d=h.length-1;c<d;++c){const u=h.slice(c,c+2),g={feature:e,geometry:t,depth:[a,n],index:c,segment:u};this.rBush_.insert((0,C.hI)(u),g)}}}}writeCircleGeometry_(e,t){const i=t.getCenter(),n={feature:e,geometry:t,index:Or,segment:[i,i]},s={feature:e,geometry:t,index:tn,segment:[i,i]},o=[n,s];n.featureSegments=o,s.featureSegments=o,this.rBush_.insert((0,C.HK)(i),n);let a=t;const l=(0,U.Cs)();if(l&&this.getMap()){const h=this.getMap().getView().getProjection();a=a.clone().transform(l,h),a=(0,Pt.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 Ke.Z(new wt.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==mt.Z.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(e),this.vertexFeature_&&this.deleteCondition_(e)&&(e.type!=mt.Z.SINGLECLICK||!this.ignoreNextSingleClick_?t=this.removePoint():t=!0),e.type==mt.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 d=l.depth;let u;const g=l.segment,f=a[1];for(;t.length<c.getStride();)t.push(g[f][t.length]);switch(c.getType()){case"Point":u=t,g[0]=t,g[1]=t;break;case"MultiPoint":u=c.getCoordinates(),u[l.index]=t,g[0]=t,g[1]=t;break;case"LineString":u=c.getCoordinates(),u[l.index+f]=t,g[f]=t;break;case"MultiLineString":u=c.getCoordinates(),u[d[0]][l.index+f]=t,g[f]=t;break;case"Polygon":u=c.getCoordinates(),u[d[0]][l.index+f]=t,g[f]=t;break;case"MultiPolygon":u=c.getCoordinates(),u[d[1]][d[0]][l.index+f]=t,g[f]=t;break;case"Circle":if(g[0]=t,g[1]=t,l.index===Or)this.changingFeature_=!0,c.setCenter(t),this.changingFeature_=!1;else{this.changingFeature_=!0;const m=e.map.getView().getProjection();let p=(0,Ne.TE)((0,U.Vs)(c.getCenter(),m),(0,U.Vs)(t,m));const v=(0,U.Cs)();if(v){const y=c.clone().transform(v,m);y.setRadius(p),p=y.transform(m,v).getRadius()}c.setRadius(p),this.changingFeature_=!1}break;default:}u&&this.setGeometryCoordinates_(c,u)}this.createOrUpdateVertexFeature_(t,i,n)}handleDownEvent(e){if(!this.condition_(e))return!1;const t=e.coordinate;this.handlePointerAtPixel_(e.pixel,e.map,t),this.dragSegments_.length=0,this.featuresBeingModified_=null;const i=this.vertexFeature_;if(i){const n=e.map.getView().getProjection(),s=[],o=i.getGeometry().getCoordinates(),a=(0,C.hI)([o]),l=this.rBush_.getInExtent(a),h={};l.sort(gl);for(let c=0,d=l.length;c<d;++c){const u=l[c],g=u.segment;let f=(0,$.sq)(u.geometry);const m=u.depth;if(m&&(f+="-"+m.join("-")),h[f]||(h[f]=new Array(2)),u.geometry.getType()==="Circle"&&u.index===tn){const p=zr(t,u,n);(0,Ne.fS)(p,o)&&!h[f][0]&&(this.dragSegments_.push([u,0]),h[f][0]=u);continue}if((0,Ne.fS)(g[0],o)&&!h[f][0]){this.dragSegments_.push([u,0]),h[f][0]=u;continue}if((0,Ne.fS)(g[1],o)&&!h[f][1]){if(h[f][0]&&h[f][0].index===0){let p=u.geometry.getCoordinates();switch(u.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":p=p[m[1]];case"Polygon":if(u.index!==p[m[0]].length-2)continue;break;default:}}this.dragSegments_.push([u,1]),h[f][1]=u;continue}(0,$.sq)(g)in this.vertexSegments_&&!h[f][0]&&!h[f][1]&&this.insertVertexCondition_(e)&&s.push(u)}s.length&&this.willModifyFeatures_(e,[s]);for(let c=s.length-1;c>=0;--c)this.insertVertex_(s[c],o)}return!!this.vertexFeature_}handleUpEvent(e){for(let t=this.dragSegments_.length-1;t>=0;--t){const i=this.dragSegments_[t][0],n=i.geometry;if(n.getType()==="Circle"){const s=n.getCenter(),o=i.featureSegments[0],a=i.featureSegments[1];o.segment[0]=s,o.segment[1]=s,a.segment[0]=s,a.segment[1]=s,this.rBush_.update((0,C.HK)(s),o);let l=n;const h=(0,U.Cs)();if(h){const c=e.map.getView().getProjection();l=l.clone().transform(h,c),l=(0,Pt.Bb)(l).transform(c,h)}this.rBush_.update(l.getExtent(),a)}else this.rBush_.update((0,C.hI)(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new Cs(Es.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 Br(n,h,s)-Br(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,d,u)=>{u&&(u=new wt.Z((0,U.lO)(u.getCoordinates(),s)));const g=u||c.getGeometry();if(g.getType()==="Point"&&c instanceof Ke.Z&&this.features_.getArray().includes(c)){l=g;const f=c.getGeometry().getFlatCoordinates().slice(0,2);a=[{feature:c,geometry:l,segment:[f,f]}]}return!0},{layerFilter:h})}if(!a){const h=(0,U.dY)((0,C.HK)(n,kr),s),c=t.getView().getResolution()*this.pixelTolerance_,d=(0,U.Fj)((0,C.f3)(h,c,kr),s);a=this.rBush_.getInExtent(d)}if(a&&a.length>0){const h=a.sort(o)[0],c=h.segment;let d=zr(n,h,s);const u=t.getPixelFromCoordinate(d);let g=(0,Ne.TE)(e,u);if(l||g<=this.pixelTolerance_){const f={};if(f[(0,$.sq)(c)]=!0,this.snapToPointer_||(this.delta_[0]=d[0]-n[0],this.delta_[1]=d[1]-n[1]),h.geometry.getType()==="Circle"&&h.index===tn)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(d,[h.feature],[h.geometry]);else{const m=t.getPixelFromCoordinate(c[0]),p=t.getPixelFromCoordinate(c[1]),v=(0,Ne.bI)(u,m),y=(0,Ne.bI)(u,p);g=Math.sqrt(Math.min(v,y)),this.snappedToVertex_=g<=this.pixelTolerance_,this.snappedToVertex_&&(d=v>y?c[1]:c[0]),this.createOrUpdateVertexFeature_(d,[h.feature],[h.geometry]);const w={};w[(0,$.sq)(h.geometry)]=!0;for(let b=1,F=a.length;b<F;++b){const L=a[b].segment;if((0,Ne.fS)(c[0],L[0])&&(0,Ne.fS)(c[1],L[1])||(0,Ne.fS)(c[0],L[1])&&(0,Ne.fS)(c[1],L[0])){const A=(0,$.sq)(a[b].geometry);A in w||(w[A]=!0,f[(0,$.sq)(L)]=!0)}else break}}this.vertexSegments_=f;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}insertVertex_(e,t){const i=e.segment,n=e.feature,s=e.geometry,o=e.depth,a=e.index;let l;for(;t.length<s.getStride();)t.push(0);switch(s.getType()){case"MultiLineString":l=s.getCoordinates(),l[o[0]].splice(a+1,0,t);break;case"Polygon":l=s.getCoordinates(),l[o[0]].splice(a+1,0,t);break;case"MultiPolygon":l=s.getCoordinates(),l[o[1]][o[0]].splice(a+1,0,t);break;case"LineString":l=s.getCoordinates(),l.splice(a+1,0,t);break;default:return}this.setGeometryCoordinates_(s,l);const h=this.rBush_;h.remove(e),this.updateSegmentIndices_(s,a,o,1);const c={segment:[i[0],t],feature:n,geometry:s,depth:o,index:a};h.insert((0,C.hI)(c.segment),c),this.dragSegments_.push([c,1]);const d={segment:[t,i[1]],feature:n,geometry:s,depth:o,index:a+1};h.insert((0,C.hI)(d.segment),d),this.dragSegments_.push([d,0]),this.ignoreNextSingleClick_=!0}removePoint(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=mt.Z.POINTERDRAG){const e=this.lastPointerEvent_;this.willModifyFeatures_(e,this.dragSegments_);const t=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new Cs(Es.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,d,u,g,f;for(l=e.length-1;l>=0;--l)o=e[l],g=o[0],f=(0,$.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(u=t[f].right,c=t[f].left,h=t[f].index,d=h-1,c!==void 0?g=c:g=u,d<0&&(d=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]),d=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])),u!==void 0&&(this.rBush_.remove(u),m.push(u.segment[1])),c!==void 0&&u!==void 0){const p={depth:g.depth,feature:g.feature,geometry:g.geometry,index:d,segment:m};this.rBush_.insert((0,C.hI)(p.segment),p)}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,et.fS)(s.depth,i))&&s.index>t&&(s.index+=n)})}}function gl(r,e){return r.index-e.index}function Br(r,e,t){const i=e.geometry;if(i.getType()==="Circle"){let s=i;if(e.index===tn){const o=(0,U.Cs)();o&&(s=s.clone().transform(o,t));const a=(0,Ne.bI)(s.getCenter(),(0,U.Vs)(r,t)),l=Math.sqrt(a)-s.getRadius();return l*l}}const n=(0,U.Vs)(r,t);return bi[0]=(0,U.Vs)(e.segment[0],t),bi[1]=(0,U.Vs)(e.segment[1],t),(0,Ne.Bs)(n,bi)}function zr(r,e,t){const i=e.geometry;if(i.getType()==="Circle"&&e.index===tn){let s=i;const o=(0,U.Cs)();return o&&(s=s.clone().transform(o,t)),(0,U.lO)(s.getClosestPoint((0,U.Vs)(r,t)),t)}const n=(0,U.Vs)(r,t);return bi[0]=(0,U.Vs)(e.segment[0],t),bi[1]=(0,U.Vs)(e.segment[1],t),(0,U.lO)((0,Ne.oL)(n,bi),t)}function ml(){const r=hr();return function(e,t){return r.Point}}const pl=fl;var _l=S(75207);class Sn extends Ri.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 Sn(this.flatCoordinates.slice(),void 0,this.layout);return e.applyProperties(this),e}closestPointXY(e,t,i,n){const s=this.flatCoordinates,o=e-s[0],a=t-s[1],l=o*o+a*a;if(l<n){if(l===0)for(let h=0;h<this.stride;++h)i[h]=s[h];else{const h=this.getRadius()/Math.sqrt(l);i[0]=s[0]+h*o,i[1]=s[1]+h*a;for(let c=2;c<this.stride;++c)i[c]=s[c]}return i.length=this.stride,l}return n}containsXY(e,t){const i=this.flatCoordinates,n=e-i[0],s=t-i[1];return n*n+s*s<=this.getRadiusSquared_()}getCenter(){return this.flatCoordinates.slice(0,this.stride)}computeExtent(e){const t=this.flatCoordinates,i=t[this.stride]-t[0];return(0,C.T9)(t[0]-i,t[1]-i,t[0]+i,t[1]+i,e)}getRadius(){return Math.sqrt(this.getRadiusSquared_())}getRadiusSquared_(){const e=this.flatCoordinates[this.stride]-this.flatCoordinates[0],t=this.flatCoordinates[this.stride+1]-this.flatCoordinates[1];return e*e+t*t}getType(){return"Circle"}intersectsExtent(e){const t=this.getExtent();if((0,C.kK)(e,t)){const i=this.getCenter();return e[0]<=i[0]&&e[2]>=i[0]||e[1]<=i[1]&&e[3]>=i[1]?!0:(0,C.H6)(e,this.intersectsCoordinate.bind(this))}return!1}setCenter(e){const t=this.stride,i=this.flatCoordinates[t]-this.flatCoordinates[0],n=e.slice();n[t]=n[0]+i;for(let s=1;s<t;++s)n[t+s]=e[s];this.setFlatCoordinates(this.layout,n),this.changed()}setCenterAndRadius(e,t,i){this.setLayout(i,e,0),this.flatCoordinates||(this.flatCoordinates=[]);const n=this.flatCoordinates;let s=(0,_l.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,pi.U1)(i,0,i.length,n,e,t,i)),this.changed()}}Sn.prototype.transform;const Gr=Sn;var xl=S(20955),yl=S(34497),vl=S(80233),Tn=S(90832),El=S(98237),Li=S(69876);const In={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class Rn extends vn.ZP{constructor(e,t){super(e),this.feature=t}}function Cl(r,e){const t=[];for(let i=0;i<e.length;++i){const s=e[i].getGeometry();Nr(r,s,t)}return t}function bn(r,e){return(0,_e.bI)(r[0],r[1],e[0],e[1])}function Fi(r,e){const t=r.length;return e<0?r[e+t]:e>=t?r[e-t]:r[e]}function Ln(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=Mi(r,i),h=Mi(r,n);return bn(l,h)}let a=0;if(i<s){const l=Mi(r,i),h=Fi(r,s);a+=bn(l,h)}if(o<n){const l=Fi(r,o),h=Mi(r,n);a+=bn(l,h)}for(let l=s;l<o-1;++l){const h=Fi(r,l),c=Fi(r,l+1);a+=bn(h,c)}return a}function Nr(r,e,t){if(e instanceof We.Z){Fn(r,e.getCoordinates(),!1,t);return}if(e instanceof Tn.Z){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n)Fn(r,i[n],!1,t);return}if(e instanceof Pt.ZP){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n)Fn(r,i[n],!0,t);return}if(e instanceof Li.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)Fn(r,o[a],!0,t)}return}if(e instanceof xl.Z){const i=e.getGeometries();for(let n=0;n<i.length;++n)Nr(r,i[n],t);return}}const ws={index:-1,endIndex:NaN};function wl(r,e,t,i){const n=r[0],s=r[1];let o=1/0,a=-1,l=NaN;for(let d=0;d<e.targets.length;++d){const u=e.targets[d],g=u.coordinates;let f=1/0,m;for(let p=0;p<g.length-1;++p){const v=g[p],y=g[p+1],w=Zr(n,s,v,y);w.squaredDistance<f&&(f=w.squaredDistance,m=p+w.along)}f<o&&(o=f,u.ring&&e.targetIndex===d&&(u.endIndex>u.startIndex?m<u.startIndex&&(m+=g.length):u.endIndex<u.startIndex&&m>u.startIndex&&(m-=g.length)),l=m,a=d)}const h=e.targets[a];let c=h.ring;if(e.targetIndex===a&&c){const d=Mi(h.coordinates,l),u=t.getPixelFromCoordinate(d);(0,Ne.TE)(u,e.startPx)>i&&(c=!1)}if(c){const d=h.coordinates,u=d.length,g=h.startIndex,f=l;if(g<f){const m=Ln(d,g,f);Ln(d,g,f-u)<m&&(l-=u)}else{const m=Ln(d,g,f);Ln(d,g,f+u)<m&&(l+=u)}}return ws.index=a,ws.endIndex=l,ws}function Fn(r,e,t,i){const n=r[0],s=r[1];for(let o=0,a=e.length-1;o<a;++o){const l=e[o],h=e[o+1],c=Zr(n,s,l,h);if(c.squaredDistance===0){const d=o+c.along;i.push({coordinates:e,ring:t,startIndex:d,endIndex:d});return}}}const Ss={along:0,squaredDistance:0};function Zr(r,e,t,i){const n=t[0],s=t[1],o=i[0],a=i[1],l=o-n,h=a-s;let c=0,d=n,u=s;return(l!==0||h!==0)&&(c=(0,_e.uZ)(((r-n)*l+(e-s)*h)/(l*l+h*h),0,1),d+=l*c,u+=h*c),Ss.along=c,Ss.squaredDistance=(0,_e.FH)((0,_e.bI)(r,e,d,u),10),Ss}function Mi(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,d=h[1]-l;return[a+c*n,l+d*n]}class Sl extends rr.Z{constructor(e){const t=e;t.stopDown||(t.stopDown=en.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_=Il(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:en.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 Gr([NaN,NaN]),h=(0,U.Vs)(s[0],a),c=(0,Ne.bI)(h,(0,U.Vs)(s[s.length-1],a));l.setCenterAndRadius(h,Math.sqrt(c),this.geometryLayout_);const d=(0,U.Cs)();return d&&l.transform(a,d),l};else{let s;n==="Point"?s=wt.Z:n==="LineString"?s=We.Z:n==="Polygon"&&(s=Pt.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 Be({source:new _t({useSpatialIndex:!1,wrapX:e.wrapX?e.wrapX:!1}),style:e.style?e.style:Tl(),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(yl.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===at.Z.CONTEXTMENU&&e.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(e);let t=e.type===mt.Z.POINTERMOVE,i=!0;return!this.freehand_&&this.lastDragTime_&&e.type===mt.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===mt.Z.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(e.coordinate),i=!1):this.freehand_&&e.type===mt.Z.POINTERDOWN?i=!1:t&&this.getPointerCount()<2?(i=e.type===mt.Z.POINTERMOVE,i&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):(e.originalEvent.pointerType==="mouse"||e.type===mt.Z.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(e)):e.type===mt.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 vl.Z(mt.Z.POINTERMOVE,e.map,e.originalEvent,!1,e.frameState))},this.dragVertexDelay_),this.downPx_=e.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(e){if(!this.traceSource_||!this.traceCondition_(e))return;if(this.traceState_.active){this.deactivateTrace_();return}const t=this.getMap(),i=t.getCoordinateFromPixel([e.pixel[0]-this.snapTolerance_,e.pixel[1]+this.snapTolerance_]),n=t.getCoordinateFromPixel([e.pixel[0]+this.snapTolerance_,e.pixel[1]-this.snapTolerance_]),s=(0,C.hI)([i,n]),o=this.traceSource_.getFeaturesInExtent(s);if(o.length===0)return;const a=Cl(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(Fi(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(Fi(e.coordinates,a))}n.length&&this.appendCoordinates(n)}updateTrace_(e){const t=this.traceState_;if(!t.active||t.targetIndex===-1&&(0,Ne.TE)(t.startPx,e.pixel)<this.snapTolerance_)return;const i=wl(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=Mi(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],d=a.getPixelFromCoordinate(c),u=e[0]-d[0],g=e[1]-d[1],f=this.freehand_?1:this.snapTolerance_;if(i=Math.sqrt(u*u+g*g)<=f,i){this.finishCoordinate_=c;break}}}}return i}createOrUpdateSketchPoint_(e){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(e):(this.sketchPoint_=new Ke.Z(new wt.Z(e)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(e){this.sketchLine_||(this.sketchLine_=new Ke.Z);const t=e.getLinearRing(0);let i=this.sketchLine_.getGeometry();i?(i.setFlatCoordinates(t.getLayout(),t.getFlatCoordinates()),i.changed()):(i=new We.Z(t.getFlatCoordinates(),t.getLayout()),this.sketchLine_.setGeometry(i))}startDrawing_(e){const t=this.getMap().getView().getProjection(),i=(0,Ri.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 Ke.Z(new We.Z(this.sketchLineCoords_)));const n=this.geometryFunction_(this.sketchCoords_,void 0,t);this.sketchFeature_=new Ke.Z,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(n),this.updateSketchFeatures_(),this.dispatchEvent(new Rn(In.DRAWSTART,this.sketchFeature_))}modifyDrawing_(e){const t=this.getMap(),i=this.sketchFeature_.getGeometry(),n=t.getView().getProjection(),s=(0,Ri.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 El.Z([t])):this.type_==="MultiLineString"?e.setGeometry(new Tn.Z([t])):this.type_==="MultiPolygon"&&e.setGeometry(new Li.Z([t])),this.dispatchEvent(new Rn(In.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 Rn(In.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 Ke.Z(new wt.Z(n)),this.updateSketchFeatures_(),this.dispatchEvent(new Rn(In.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 Tl(){const r=hr();return function(e,t){return r[e.getGeometry().getType()]}}function Su(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],d=o[1]-s[1];l=Math.atan2(d,c)}makeRegular(i,s,a,l);const h=getUserProjection();return h&&i.transform(n,h),i}}function Tu(){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 Il(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 Rl=Sl;var Wr=S(88508);class Ur extends Be{constructor(){super({source:new _t}),this.opts={action:"length",unit:"m"},this.segmentStyle=new fe({text:new gi({font:"12px Calibri,sans-serif",fill:new Se({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Se({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 Se({color:"rgba(0, 0, 0, 0.4)"})})}),this.segmentStyles=[this.segmentStyle],this.shapeStyle=[new fe({fill:new Se({color:"rgba(255, 255, 255, 0.2)"}),image:new St({radius:5,stroke:new Te({color:"rgba(0, 0, 0, 0.7)"}),fill:new Se({color:"rgba(255, 255, 255, 0.2)"})})}),new fe({stroke:new Te({color:[0,0,0,1],width:2,lineDash:[4,8],lineDashOffset:6})}),new fe({stroke:new Te({color:[255,255,255,1],width:2,lineDash:[4,8]})})],this.labelStyle=new fe({text:new gi({font:"14px Calibri,sans-serif",fill:new Se({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Se({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 Se({color:"rgba(0, 0, 0, 0.7)"})})}),this.tipStyle=new fe({text:new gi({font:"12px Calibri,sans-serif",fill:new Se({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Se({color:"rgba(0, 0, 0, 0.4)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),this.modifyStyle=new fe({image:new St({radius:5,stroke:new Te({color:"rgba(0, 0, 0, 0.7)"}),fill:new Se({color:"rgba(0, 0, 0, 0.4)"})}),text:new gi({text:"Drag to modify",font:"12px Calibri,sans-serif",fill:new Se({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Se({color:"rgba(0, 0, 0, 0.7)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),this.modify=new pl({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,Wr.bg)(e)):t=(0,Wr.xA)(e),(0,gt.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)&&(a==="Polygon"&&o instanceof Pt.ZP?(l=o.getInteriorPoint(),h=this.getMapMeasurement(o),c=new We.Z(o.getCoordinates()[0])):a==="LineString"&&o instanceof We.Z&&(l=new wt.Z(o.getLastCoordinate()),h=this.getMapMeasurement(o))),t&&c){let d=0;c.forEachSegment((u,g)=>{const f=new We.Z([u,g]),m=this.getMapMeasurement(f);this.segmentStyles.length-1<d&&this.segmentStyles.push(this.segmentStyle.clone());const p=new wt.Z(f.getCoordinateAt(.5));this.segmentStyles[d].setGeometry(p),this.segmentStyles[d].getText().setText(m),s.push(this.segmentStyles[d]),d++})}h&&(this.labelStyle.setGeometry(l),this.labelStyle.getText().setText(h),s.push(this.labelStyle)),n&&a==="Point"&&o instanceof wt.Z&&!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 Rl({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 bl=({map:r,menuActiveState:e})=>{const t=(0,_.useRef)(new Ur),i=Ll(fi.config.theme2),[n,s]=(0,_.useState)(!0),[o,a]=(0,_.useState)(!1),[l,h]=(0,_.useState)({action:qe[0].value,unit:qe[0].units[0].value}),c=(0,_.useMemo)(()=>{const f=qe.find(p=>p.value===l.action)??qe[0],m=f.getUnit(l.unit);return t.current.setOptions(l),{current:m,options:f.units}},[l]),d=!0,u=!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,u,d)}}return _.createElement("div",{className:`${i.infoWrap} ${o?null:i.infoWrapClosed}`},o?_.createElement("div",null,_.createElement("div",{className:i.rowGroup},_.createElement(Ci.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],p=m.getUnit(l.unit);h({...l,action:m.value,unit:p.value}),t.current.addInteraction(r,m.geometry,u,d)}}),_.createElement(xn.zx,{className:i.button,icon:"times",variant:"secondary",size:"sm",onClick:g})),_.createElement(wi.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],p=m.getUnit(f.value)??m.units[0];h({...l,unit:p.value})}})):_.createElement(ss.h,{className:i.icon,name:"ruler-combined",tooltip:"show measure tools",tooltipPlacement:"left",onClick:g}))},Ll=r=>({button:(0,te.css)({marginLeft:"auto"}),icon:(0,te.css)({backgroundColor:r.colors.secondary.main,display:"inline-block",height:"19.25px",margin:"1px",width:"19.25px"}),infoWrap:(0,te.css)({color:`${r.colors.text}`,backgroundColor:r.colors.background.secondary,borderRadius:"4px",padding:"2px"}),infoWrapClosed:(0,te.css)({height:"25.25px",width:"25.25px"}),rowGroup:(0,te.css)({display:"flex",justifyContent:"flex-end"}),unitSelect:(0,te.css)({minWidth:"200px"})});var Iu=S(824),Ru=S(35480);function Fl(r){return(0,je.css)({".ol-scale-line":{background:r.colors.border.weak},".ol-scale-line-inner":{border:`1px solid ${r.colors.text.primary}`,borderTop:0,color:r.colors.text.primary},".ol-control":{backgroundColor:r.colors.background.primary},".ol-control:hover":{backgroundColor:r.colors.background.secondary},".ol-control button":{color:r.colors.secondary.text,backgroundColor:r.colors.secondary.main},".ol-control button:hover":{color:r.colors.secondary.text,backgroundColor:r.colors.secondary.shade},".ol-control button:focus":{color:r.colors.secondary.text,backgroundColor:r.colors.secondary.main},".ol-attribution ul":{color:r.colors.text.primary,textShadow:"none"},".ol-attribution:not(.ol-collapsed)":{backgroundColor:r.colors.background.secondary}})}var Mn=S(56989),ze=S(34547),Tt=S(46303);class nn extends _t{constructor(e){super({}),this.location=e}update(e){this.clear(!0);const t=(0,Tt.g6)(e,this.location);if(!t.field){this.changed();return}for(let i=0;i<e.length;i++)this.addFeatureInternal(new Ke.Z({frame:e,rowIndex:i,geometry:t.field.values[i]}));this.changed()}updateLineString(e){this.clear(!0);const t=(0,Tt.g6)(e,this.location);if(!t.field){this.changed();return}const i=t.field,n=new We.Z(i.values.map(s=>s.getCoordinates()));this.addFeatureInternal(new Ke.Z({frame:e,rowIndex:0,geometry:n})),this.changed()}}var Pn=S(67534),Xr=S(63302),Vr=S(73254),Ml=S(10124),Pl=S(74156),Dl=S(65132),Al=S(80047);function Yr(r){const{layerName:e,styleConfig:t,layer:i}=r,n=(0,xe.wW)(Ol),s=(0,Pn.Z)(i?.__state?.mouseEvents??(0,Xr.of)(void 0)),o=t?.dims?.color?.field,a=(0,_.useMemo)(()=>{if(!o||!s)return;const f=s.getProperties();if(!f.frame)return;const p=f.rowIndex;return o.values[p]},[s,o]);if(!t)return _.createElement(_.Fragment,null);const{color:l,opacity:h}=t?.base??{},c=t?.config.symbol?.fixed;if(l&&c&&!o)return _.createElement("div",{className:n.infoWrap},_.createElement("div",{className:n.layerName},e),_.createElement("div",{className:(0,te.cx)(n.layerBody,n.fixedColorContainer)},_.createElement(Dl.V,{src:`public/${c}`,className:n.legendSymbol,title:"Symbol",style:{fill:l,opacity:h}})));if(!o)return _.createElement(_.Fragment,null);const d=(0,Vr.fD)(o);if(d.isContinuous&&d.getColors){const f=d.getColors(fi.config.theme2),m=(0,Ml.dz)(o),p=o.display?v=>(0,gt.zc)(o.display(v)):v=>`${v}`;return _.createElement("div",{className:n.infoWrap},_.createElement("div",{className:n.layerName},e),_.createElement("div",{className:(0,te.cx)(n.layerBody,n.colorScaleWrapper)},_.createElement(Pl.q,{hoverValue:a,colorPalette:f,min:m.min??0,max:m.max??100,display:p,useStopsPercentage:!1})))}const u=o?.config?.thresholds;if(!u||u.steps.length<2)return _.createElement("div",null);const g=(0,Al.Ur)(o.config,fi.config.theme2);return _.createElement("div",{className:n.infoWrap},_.createElement("div",{className:n.layerName},e),_.createElement("div",{className:(0,te.cx)(n.layerBody,n.legend)},g.map((f,m)=>_.createElement("div",{key:`${m}/${f.label}`,className:n.legendItem},_.createElement("i",{style:{background:f.color}}),f.label))))}const Ol=r=>({infoWrap:(0,te.css)({display:"flex",flexDirection:"column",background:r.colors.background.secondary,borderRadius:"1px",padding:r.spacing(1),borderBottom:`2px solid ${r.colors.border.strong}`,minWidth:"150px"}),layerName:(0,te.css)({fontSize:r.typography.body.fontSize}),layerBody:(0,te.css)({paddingLeft:"10px"}),legend:(0,te.css)({lineHeight:"18px",display:"flex",flexDirection:"column",fontSize:r.typography.bodySmall.fontSize,padding:"5px 10px 0",i:{width:"15px",height:"15px",float:"left",marginRight:"8px",opacity:.7,borderRadius:r.shape.radius.circle}}),legendItem:(0,te.css)({whiteSpace:"nowrap"}),fixedColorContainer:(0,te.css)({minWidth:"80px",fontSize:r.typography.bodySmall.fontSize,paddingTop:"5px"}),legendSymbol:(0,te.css)({height:"18px",width:"18px",margin:"auto"}),colorScaleWrapper:(0,te.css)({minWidth:"200px",fontSize:r.typography.bodySmall.fontSize,paddingTop:"10px"})});class jr extends _.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 _.createElement(this.props.child,{...e})}}var It=S(74661),ht=S(69171),nt=S(96227),kl=S(99491),Bl=S(69360),Ts=S(12223),Is=S(46108),Hr=S(52234),ii=S(473),Dn=S(11925),k=S(98950),Kr=S(28425),An=S(77663),On=S(85256),zl=(r=>(r.circle="circle",r.square="square",r.triangle="triangle",r.star="star",r.cross="cross",r.x="x",r))(zl||{});const Pi={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 Di(r){const e=r.opacity==null?.8:r.opacity;if(e===1)return new Se({color:r.color});if(e>0){const t=(0,de.Z)(r.color).setAlpha(e).toRgbString();return new Se({color:t})}}function Gl(r){const e=r.opacity==null?.8:r.opacity;if(e===1)return new Te({color:r.color,width:r.lineWidth??1});if(e>0){const t=(0,de.Z)(r.color).setAlpha(e).toRgbString();return new Te({color:t,width:r.lineWidth??1})}}const Ot=r=>{if(!r.text)return;const e=Ve.config.theme2.typography.fontFamily,t={...k.Er.textConfig,...r.textConfig};return new gi({text:r.text,fill:new Se({color:r.color??k.Er.color.fixed}),font:`normal ${t.fontSize}px ${e}`,...t})},Nl=r=>new fe({text:Ot(r)}),Jr=r=>{const e=new Te({color:r.color,width:r.lineWidth??1}),t=r.size??k.Cg;return new fe({image:new St({stroke:e,fill:Di(r),radius:t,displacement:_i(r.symbolAlign??k.Er.symbolAlign,t)}),text:Ot(r),stroke:e})},kn=r=>new fe({fill:Di(r),stroke:new Te({color:r.color,width:r.lineWidth??1}),text:Ot(r)}),Rs=r=>new fe({fill:Di(r),stroke:Gl(r),text:Ot(r)}),$r=r=>{const e=r.size??k.Cg,t=new Te({color:"#F00",width:1});return[new fe({image:new Je({stroke:t,points:4,radius:e,angle:Math.PI/4})}),new fe({image:new Je({stroke:t,points:4,radius:e,radius2:0,angle:0})})]},Zl=[{id:"circle",name:"Circle",aliasIds:[Pi.circle],make:Jr},{id:"square",name:"Square",aliasIds:[Pi.square],make:r=>{const e=r.size??k.Cg,t=r.rotation??0;return new fe({image:new Je({stroke:new Te({color:r.color,width:r.lineWidth??1}),fill:Di(r),points:4,radius:e,angle:Math.PI/4,rotation:t*Math.PI/180,displacement:_i(r.symbolAlign??k.Er.symbolAlign,e)}),text:Ot(r)})}},{id:"triangle",name:"Triangle",aliasIds:[Pi.triangle],make:r=>{const e=r.size??k.Cg,t=r.rotation??0;return new fe({image:new Je({stroke:new Te({color:r.color,width:r.lineWidth??1}),fill:Di(r),points:3,radius:e,rotation:t*Math.PI/180,angle:0,displacement:_i(r.symbolAlign??k.Er.symbolAlign,e)}),text:Ot(r)})}},{id:"star",name:"Star",aliasIds:[Pi.star],make:r=>{const e=r.size??k.Cg,t=r.rotation??0;return new fe({image:new Je({stroke:new Te({color:r.color,width:r.lineWidth??1}),fill:Di(r),points:5,radius:e,radius2:e*.4,angle:0,rotation:t*Math.PI/180,displacement:_i(r.symbolAlign??k.Er.symbolAlign,e)}),text:Ot(r)})}},{id:"cross",name:"Cross",aliasIds:[Pi.cross],make:r=>{const e=r.size??k.Cg,t=r.rotation??0;return new fe({image:new Je({stroke:new Te({color:r.color,width:r.lineWidth??1}),points:4,radius:e,radius2:0,angle:0,rotation:t*Math.PI/180,displacement:_i(r.symbolAlign??k.Er.symbolAlign,e)}),text:Ot(r)})}},{id:"x",name:"X",aliasIds:[Pi.x],make:r=>{const e=r.size??k.Cg,t=r.rotation??0;return new fe({image:new Je({stroke:new Te({color:r.color,width:r.lineWidth??1}),points:4,radius:e,radius2:0,angle:Math.PI/4,rotation:t*Math.PI/180,displacement:_i(r.symbolAlign??k.Er.symbolAlign,e)}),text:Ot(r)})}}];async function Wl(r,e){return fetch(r,{method:"GET"}).then(t=>t.text()).then(t=>{t=Kr.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 bs=new An.B(()=>Zl);function Ul(r){const e=bs.getIfExists(r);if(e?.aliasIds?.length)return e.aliasIds[0]}async function Xl(r,e){if(!r)return e?Nl:Jr;let t=bs.getIfExists(r);if(t)return t.make;if(r.endsWith(".svg")){const i=await Wl((0,On.getPublicOrAbsoluteUrl)(r));return t={id:r,name:r,aliasIds:[],make:i?n=>{const s=n.size??k.Cg,o=n.rotation??0;return[new fe({image:new En({src:i,color:n.color,opacity:n.opacity??1,scale:(k.Cg+s)/100,rotation:o*Math.PI/180,displacement:_i(n.symbolAlign??k.Er.symbolAlign,s/2)}),text:n?.text?Ot(n):void 0}),new fe({image:new Je({fill:new Se({color:"rgba(0,0,0,0)"}),points:4,radius:n.size,rotation:o*Math.PI/180+Math.PI/4})})]}:$r},bs.register(t),t.make}return $r}function qr(r){const e=r?.text;return e?!!(e.mode===ze.xy.Fixed&&e.fixed?.length||e.mode===ze.xy.Field&&e.field?.length):!1}async function Ut(r){r||(r=k.Er);const e=qr(r),t={},i=await Xl(r.symbol?.fixed,e),n={config:r,hasText:e,fields:t,base:{color:Ve.config.theme2.visualization.getColorByName(r.color?.fixed??k.Er.color.fixed),opacity:r.opacity??k.Er.opacity,lineWidth:r.lineWidth??1,size:r.size?.fixed??k.Er.size.fixed,rotation:r.rotation?.fixed??k.Er.rotation.fixed,symbolAlign:r.symbolAlign??k.Er.symbolAlign},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??k.Er.textConfig,r.text?.field?.length&&(t.text=r.text.field)),Object.keys(t).length||(n.fields=void 0),n}function _i(r,e){const t=[0,0];return r?.horizontal===k.Kq.Left?t[0]=-e:r?.horizontal===k.Kq.Right&&(t[0]=e),r?.vertical===k.g$.Top?t[1]=e:r?.vertical===k.g$.Bottom&&(t[1]=-e),t}const ni=r=>{const{value:e,onChange:t,item:i}=r,n=(0,_.useMemo)(()=>i.settings?.frameMatcher?{...r.context,data:r.context.data.filter(i.settings.frameMatcher)}:r.context,[r.context,i.settings]),s=i.settings,o=L=>{t({...e,size:L})},a=L=>{t({...e,symbol:L})},l=L=>{t({...e,color:L})},h=L=>{t({...e,opacity:L})},c=L=>{t({...e,rotation:L})},d=L=>{t({...e,text:L})},u=L=>{t({...e,textConfig:{...e.textConfig,fontSize:L}})},g=L=>{t({...e,textConfig:{...e.textConfig,offsetX:L}})},f=L=>{t({...e,textConfig:{...e.textConfig,offsetY:L}})},m=L=>{t({...e,textConfig:{...e.textConfig,textAlign:L}})},p=L=>{t({...e,textConfig:{...e.textConfig,textBaseline:L}})},v=L=>{t({...e,symbolAlign:{...e.symbolAlign,horizontal:L}})},y=L=>{t({...e,symbolAlign:{...e.symbolAlign,vertical:L}})},b=(0,Pn.Z)(s?.layerInfo??(0,Xr.of)())?.geometryType===k.bD.Point,F=qr(e);return s?.simpleFixedValues?_.createElement(_.Fragment,null,b&&_.createElement(_.Fragment,null,_.createElement(It.Z,null,_.createElement(ht._,{label:"Symbol"},_.createElement(ii.Lv,{value:e?.symbol??k.Er.symbol,context:n,onChange:a,item:{settings:{resourceType:"icon",folderName:Dn.QS.Marker,placeholderText:F?"Select a symbol":"Select a symbol or add a text label",placeholderValue:k.Er.symbol.fixed,showSourceRadio:!1}}}))),_.createElement(nt.g,{label:"Rotation angle"},_.createElement(ii.k9,{value:e?.rotation??k.Er.rotation,context:n,onChange:c,item:{settings:{min:k.Er.rotation.min,max:k.Er.rotation.max}}}))),_.createElement(It.Z,null,_.createElement(ht._,{label:"Color",labelWidth:10},_.createElement(kl.W,{width:4},_.createElement(Bl.zH,{color:e?.color?.fixed??k.Er.color.fixed,onChange:L=>{l({fixed:L})}})))),_.createElement(It.Z,null,_.createElement(ht._,{label:"Opacity",labelWidth:10,grow:!0},_.createElement(Hr.p,{value:e?.opacity??k.Er.opacity,context:n,onChange:h,item:{settings:{min:0,max:1,step:.1}}})))):_.createElement(_.Fragment,null,_.createElement(nt.g,{label:"Size"},_.createElement(ii.cL,{value:e?.size??k.Er.size,context:n,onChange:o,item:{settings:{min:1,max:100}}})),!s?.hideSymbol&&_.createElement(_.Fragment,null,_.createElement(nt.g,{label:"Symbol"},_.createElement(ii.Lv,{value:e?.symbol??k.Er.symbol,context:n,onChange:a,item:{settings:{resourceType:Dn.DD.Icon,folderName:Dn.QS.Marker,placeholderText:F?"Select a symbol":"Select a symbol or add a text label",placeholderValue:k.Er.symbol.fixed,showSourceRadio:!1}}})),_.createElement(nt.g,{label:"Symbol Vertical Align"},_.createElement(Ci.S,{value:e?.symbolAlign?.vertical??k.Er.symbolAlign.vertical,onChange:y,options:[{value:k.g$.Top,label:(0,E.capitalize)(k.g$.Top)},{value:k.g$.Center,label:(0,E.capitalize)(k.g$.Center)},{value:k.g$.Bottom,label:(0,E.capitalize)(k.g$.Bottom)}]})),_.createElement(nt.g,{label:"Symbol Horizontal Align"},_.createElement(Ci.S,{value:e?.symbolAlign?.horizontal??k.Er.symbolAlign.horizontal,onChange:v,options:[{value:k.Kq.Left,label:(0,E.capitalize)(k.Kq.Left)},{value:k.Kq.Center,label:(0,E.capitalize)(k.Kq.Center)},{value:k.Kq.Right,label:(0,E.capitalize)(k.Kq.Right)}]}))),_.createElement(nt.g,{label:"Color"},_.createElement(ii.Lm,{value:e?.color??k.Er.color,context:n,onChange:l,item:{}})),_.createElement(nt.g,{label:"Fill opacity"},_.createElement(Hr.p,{value:e?.opacity??k.Er.opacity,context:n,onChange:h,item:{settings:{min:0,max:1,step:.1}}})),s?.displayRotation&&_.createElement(nt.g,{label:"Rotation angle"},_.createElement(ii.k9,{value:e?.rotation??k.Er.rotation,context:n,onChange:c,item:{settings:{min:k.Er.rotation.min,max:k.Er.rotation.max}}})),_.createElement(nt.g,{label:"Text label"},_.createElement(ii.$2,{value:e?.text??Dn.qj,context:n,onChange:d,item:{}})),F&&_.createElement(_.Fragment,null,_.createElement(Ts.Lh,null,_.createElement(nt.g,{label:"Font size"},_.createElement(Is.w,{value:e?.textConfig?.fontSize??k.Er.textConfig.fontSize,context:n,onChange:u,item:{}})),_.createElement(nt.g,{label:"X offset"},_.createElement(Is.w,{value:e?.textConfig?.offsetX??k.Er.textConfig.offsetX,context:n,onChange:g,item:{}})),_.createElement(nt.g,{label:"Y offset"},_.createElement(Is.w,{value:e?.textConfig?.offsetY??k.Er.textConfig.offsetY,context:n,onChange:f,item:{}}))),_.createElement(nt.g,{label:"Align"},_.createElement(Ci.S,{value:e?.textConfig?.textAlign??k.Er.textConfig.textAlign,onChange:m,options:[{value:k.H.Left,label:(0,E.capitalize)(k.H.Left)},{value:k.H.Center,label:(0,E.capitalize)(k.H.Center)},{value:k.H.Right,label:(0,E.capitalize)(k.H.Right)}]})),_.createElement(nt.g,{label:"Baseline"},_.createElement(Ci.S,{value:e?.textConfig?.textBaseline??k.Er.textConfig.textBaseline,onChange:p,options:[{value:k.EQ.Top,label:(0,E.capitalize)(k.EQ.Top)},{value:k.EQ.Middle,label:(0,E.capitalize)(k.EQ.Middle)},{value:k.EQ.Bottom,label:(0,E.capitalize)(k.EQ.Bottom)}]}))))};var tt=S(68303);const sn={style:k.Er,showLegend:!0},Ls="markers",Fs={type:Ls,name:"",config:sn,location:{mode:ze.q1.Auto},tooltip:!0},Vl={id:Ls,name:"Markers",description:"Use markers to render each data point",isBaseMap:!1,showLocation:!0,hideOpacity:!0,create:async(r,e,t,i)=>{const n={...sn,...e?.config},s=await Ut(n.style),o=await(0,Tt.cJ)(e.location),a=new nn(o),l=new Be({source:a}),h=new Mn.t(1);let c=null;return n.showLegend&&(c=_.createElement(jr,{watch:h,initialSubProps:{},child:Yr})),s.fields?l.setStyle(d=>{const u=d.get("rowIndex"),g=s.dims;if(!g||!(0,E.isNumber)(u))return s.maker(s.base);const f={...s.base};return g.color&&(f.color=g.color.get(u)),g.size&&(f.size=g.size.get(u)),g.text&&(f.text=g.text.get(u)),g.rotation&&(f.rotation=g.rotation.get(u)),s.maker(f)}):l.setStyle(s.maker(s.base)),{init:()=>l,legend:c,update:d=>{if(!d.series?.length){a.clear();return}for(const u of d.series){s.dims=(0,tt.vV)(u,s,i),c&&h.next({styleConfig:s,size:s.dims?.size,layerName:e.name,layer:l}),a.update(u);break}},registerOptionsUI:d=>{d.addCustomEditor({id:"config.style",path:"config.style",name:"Styles",editor:ni,settings:{displayRotation:!0},defaultValue:sn.style}).addBooleanSwitch({path:"config.showLegend",name:"Show legend",description:"Show map legend",defaultValue:sn.showLegend})}}},defaultOptions:sn};var xi=S(30670);const Bn={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class Yl extends ar.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(Bn.PRELOAD)}setPreload(e){this.set(Bn.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(Bn.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(Bn.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}}const jl=Yl;var ae=S(85696),Hl=S(23816);class Kl extends ur.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(at.Z.CHANGE)}release(){this.state===ae.Z.ERROR&&this.setState(ae.Z.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let e=this.interimTile;do{if(e.getState()==ae.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()==ae.Z.LOADED){e.interimTile=null;break}else e.getState()==ae.Z.LOADING?t=e:e.getState()==ae.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!==ae.Z.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}load(){(0,$.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,Hl.YQ)(n/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}}const Qr=Kl;class Jl extends Qr{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=ae.Z.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=ae.Z.ERROR,this.unlistenImage_(),this.image_=$l(),this.changed()}handleImageLoad_(){const e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=ae.Z.LOADED:this.state=ae.Z.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==ae.Z.ERROR&&(this.state=ae.Z.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==ae.Z.IDLE&&(this.state=ae.Z.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=fs(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function $l(){const r=(0,ke.E4)(1,1);return r.fillStyle="rgba(0,0,0,0)",r.fillRect(0,0,1,1),r.canvas}const eo=Jl,ql=.5,Ql=10,to=.25;class eh{constructor(e,t,i,n,s,o){this.sourceProj_=e,this.targetProj_=t;let a={};const l=(0,U.Ck)(this.targetProj_,this.sourceProj_);this.transformInv_=function(y){const w=y[0]+"/"+y[1];return a[w]||(a[w]=l(y)),a[w]},this.maxSourceExtent_=n,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&(0,C.dz)(n)>=(0,C.dz)(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?(0,C.dz)(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?(0,C.dz)(this.targetProj_.getExtent()):null;const h=(0,C.rL)(i),c=(0,C.Xv)(i),d=(0,C.w$)(i),u=(0,C.hC)(i),g=this.transformInv_(h),f=this.transformInv_(c),m=this.transformInv_(d),p=this.transformInv_(u),v=Ql+(o?Math.max(0,Math.ceil(Math.log2((0,C.bg)(i)/(o*o*256*256)))):0);if(this.addQuad_(h,c,d,u,g,f,m,p,v),this.wrapsXInSource_){let y=1/0;this.triangles_.forEach(function(w,b,F){y=Math.min(y,w.source[0][0],w.source[1][0],w.source[2][0])}),this.triangles_.forEach(w=>{if(Math.max(w.source[0][0],w.source[1][0],w.source[2][0])-y>this.sourceWorldWidth_/2){const b=[[w.source[0][0],w.source[0][1]],[w.source[1][0],w.source[1][1]],[w.source[2][0],w.source[2][1]]];b[0][0]-y>this.sourceWorldWidth_/2&&(b[0][0]-=this.sourceWorldWidth_),b[1][0]-y>this.sourceWorldWidth_/2&&(b[1][0]-=this.sourceWorldWidth_),b[2][0]-y>this.sourceWorldWidth_/2&&(b[2][0]-=this.sourceWorldWidth_);const F=Math.min(b[0][0],b[1][0],b[2][0]);Math.max(b[0][0],b[1][0],b[2][0])-F<this.sourceWorldWidth_/2&&(w.source=b)}})}a={}}addTriangle_(e,t,i,n,s,o){this.triangles_.push({source:[n,s,o],target:[e,t,i]})}addQuad_(e,t,i,n,s,o,a,l,h){const c=(0,C.hI)([s,o,a,l]),d=this.sourceWorldWidth_?(0,C.dz)(c)/this.sourceWorldWidth_:null,u=this.sourceWorldWidth_,g=this.sourceProj_.canWrapX()&&d>.5&&d<1;let f=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const p=(0,C.hI)([e,t,i,n]);f=(0,C.dz)(p)/this.targetWorldWidth_>to||f}!g&&this.sourceProj_.isGlobal()&&d&&(f=d>to||f)}if(!f&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!(0,C.kK)(c,this.maxSourceExtent_))return;let m=0;if(!f&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)f=!0;else if(m=(!isFinite(s[0])||!isFinite(s[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(h>0){if(!f){const p=[(e[0]+i[0])/2,(e[1]+i[1])/2],v=this.transformInv_(p);let y;g?y=((0,_e.$W)(s[0],u)+(0,_e.$W)(a[0],u))/2-(0,_e.$W)(v[0],u):y=(s[0]+a[0])/2-v[0];const w=(s[1]+a[1])/2-v[1];f=y*y+w*w>this.errorThresholdSquared_}if(f){if(Math.abs(e[0]-i[0])<=Math.abs(e[1]-i[1])){const p=[(t[0]+i[0])/2,(t[1]+i[1])/2],v=this.transformInv_(p),y=[(n[0]+e[0])/2,(n[1]+e[1])/2],w=this.transformInv_(y);this.addQuad_(e,t,p,y,s,o,v,w,h-1),this.addQuad_(y,p,i,n,w,v,a,l,h-1)}else{const p=[(e[0]+t[0])/2,(e[1]+t[1])/2],v=this.transformInv_(p),y=[(i[0]+n[0])/2,(i[1]+n[1])/2],w=this.transformInv_(y);this.addQuad_(e,p,y,n,s,v,w,l,h-1),this.addQuad_(p,t,i,y,v,o,a,w,h-1)}return}}if(g){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}m&11||this.addTriangle_(e,i,n,s,a,l),m&14||this.addTriangle_(e,i,t,s,a,o),m&&(m&13||this.addTriangle_(t,n,e,o,l,s),m&7||this.addTriangle_(t,n,i,o,l,a))}calculateSourceExtent(){const e=(0,C.lJ)();return this.triangles_.forEach(function(t,i,n){const s=t.source;(0,C.Wj)(e,s[0]),(0,C.Wj)(e,s[1]),(0,C.Wj)(e,s[2])}),e}getTriangles(){return this.triangles_}}const th=eh;let Ms;const Ai=[];function io(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 Ps(r,e){return Math.abs(r[e*4]-210)>2||Math.abs(r[e*4+3]-.75*255)>2}function ih(){if(Ms===void 0){const r=(0,ke.E4)(6,6,Ai);r.globalCompositeOperation="lighter",r.fillStyle="rgba(210, 0, 0, 0.75)",io(r,4,5,4,0),io(r,4,5,0,5);const e=r.getImageData(0,0,3,3).data;Ms=Ps(e,0)||Ps(e,4)||Ps(e,8),(0,ke.jy)(r),Ai.push(r.canvas)}return Ms}function no(r,e,t,i){const n=(0,U.vs)(t,e,r);let s=(0,U._Q)(e,i,t);const o=e.getMetersPerUnit();o!==void 0&&(s*=o);const a=r.getMetersPerUnit();a!==void 0&&(s/=a);const l=r.getExtent();if(!l||(0,C.b8)(l,n)){const h=(0,U._Q)(r,s,n)/s;isFinite(h)&&h>0&&(s/=h)}return s}function nh(r,e,t,i){const n=(0,C.qg)(t);let s=no(r,e,n,i);return(!isFinite(s)||s<=0)&&(0,C.H6)(t,function(o){return s=no(r,e,o,i),isFinite(s)&&s>0}),s}function sh(r,e,t,i,n,s,o,a,l,h,c,d){const u=(0,ke.E4)(Math.round(t*r),Math.round(t*e),Ai);if(d||(u.imageSmoothingEnabled=!1),l.length===0)return u.canvas;u.scale(t,t);function g(b){return Math.round(b*t)/t}u.globalCompositeOperation="lighter";const f=(0,C.lJ)();l.forEach(function(b,F,L){(0,C.l7)(f,b.extent)});const m=(0,C.dz)(f),p=(0,C.Cr)(f),v=(0,ke.E4)(Math.round(t*m/i),Math.round(t*p/i),Ai);d||(v.imageSmoothingEnabled=!1);const y=t/i;l.forEach(function(b,F,L){const A=b.extent[0]-f[0],G=-(b.extent[3]-f[3]),H=(0,C.dz)(b.extent),K=(0,C.Cr)(b.extent);b.image.width>0&&b.image.height>0&&v.drawImage(b.image,h,h,b.image.width-2*h,b.image.height-2*h,A*y,G*y,H*y,K*y)});const w=(0,C.rL)(o);return a.getTriangles().forEach(function(b,F,L){const A=b.source,G=b.target;let H=A[0][0],K=A[0][1],le=A[1][0],he=A[1][1],Q=A[2][0],me=A[2][1];const re=g((G[0][0]-w[0])/s),Y=g(-(G[0][1]-w[1])/s),Z=g((G[1][0]-w[0])/s),J=g(-(G[1][1]-w[1])/s),Ee=g((G[2][0]-w[0])/s),Ie=g(-(G[2][1]-w[1])/s),Ze=H,N=K;H=0,K=0,le-=Ze,he-=N,Q-=Ze,me-=N;const ct=[[le,he,0,0,Z-re],[Q,me,0,0,Ee-re],[0,0,le,he,J-Y],[0,0,Q,me,Ie-Y]],we=(0,_e.SV)(ct);if(we){if(u.save(),u.beginPath(),ih()||!d){u.moveTo(Z,J);const Le=4,ai=re-Z,zt=Y-J;for(let Xe=0;Xe<Le;Xe++)u.lineTo(Z+g((Xe+1)*ai/Le),J+g(Xe*zt/(Le-1))),Xe!=Le-1&&u.lineTo(Z+g((Xe+1)*ai/Le),J+g((Xe+1)*zt/(Le-1)));u.lineTo(Ee,Ie)}else u.moveTo(Z,J),u.lineTo(re,Y),u.lineTo(Ee,Ie);u.clip(),u.transform(we[0],we[2],we[1],we[3],re,Y),u.translate(f[0]-Ze,f[3]-N),u.scale(i/t,-i/t),u.drawImage(v.canvas,0,0),u.restore()}}),(0,ke.jy)(v),Ai.push(v.canvas),c&&(u.save(),u.globalCompositeOperation="source-over",u.strokeStyle="black",u.lineWidth=1,a.getTriangles().forEach(function(b,F,L){const A=b.target,G=(A[0][0]-w[0])/s,H=-(A[0][1]-w[1])/s,K=(A[1][0]-w[0])/s,le=-(A[1][1]-w[1])/s,he=(A[2][0]-w[0])/s,Q=-(A[2][1]-w[1])/s;u.beginPath(),u.moveTo(K,le),u.lineTo(G,H),u.lineTo(he,Q),u.closePath(),u.stroke()}),u.restore()),u.canvas}class rh extends Qr{constructor(e,t,i,n,s,o,a,l,h,c,d,u){super(s,ae.Z.IDLE,{interpolate:!!u}),this.renderEdges_=d!==void 0?d:!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 p=f?(0,C.Ed)(g,f):g;if((0,C.bg)(p)===0){this.state=ae.Z.EMPTY;return}const v=e.getExtent();v&&(m?m=(0,C.Ed)(m,v):m=v);const y=n.getResolution(this.wrappedTileCoord_[0]),w=nh(e,i,p,y);if(!isFinite(w)||w<=0){this.state=ae.Z.EMPTY;return}const b=c!==void 0?c:ql;if(this.triangulation_=new th(e,i,p,m,w*b,y),this.triangulation_.getTriangles().length===0){this.state=ae.Z.EMPTY;return}this.sourceZ_=t.getZForResolution(w);let F=this.triangulation_.calculateSourceExtent();if(m&&(e.canWrapX()?(F[1]=(0,_e.uZ)(F[1],m[1],m[3]),F[3]=(0,_e.uZ)(F[3],m[1],m[3])):F=(0,C.Ed)(F,m)),!(0,C.bg)(F))this.state=ae.Z.EMPTY;else{const L=t.getTileRangeForExtentAndZ(F,this.sourceZ_);for(let A=L.minX;A<=L.maxX;A++)for(let G=L.minY;G<=L.maxY;G++){const H=h(this.sourceZ_,A,G,a);H&&this.sourceTiles_.push(H)}this.sourceTiles_.length===0&&(this.state=ae.Z.EMPTY)}}getImage(){return this.canvas_}reproject_(){const e=[];if(this.sourceTiles_.forEach(t=>{t&&t.getState()==ae.Z.LOADED&&e.push({extent:this.sourceTileGrid_.getTileCoordExtent(t.tileCoord),image:t.getImage()})}),this.sourceTiles_.length=0,e.length===0)this.state=ae.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_=sh(n,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=ae.Z.LOADED}this.changed()}load(){if(this.state==ae.Z.IDLE){this.state=ae.Z.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(t=>{const i=t.getState();if(i==ae.Z.IDLE||i==ae.Z.LOADING){e++;const n=(0,Qe.oL)(t,at.Z.CHANGE,function(s){const o=t.getState();(o==ae.Z.LOADED||o==ae.Z.ERROR||o==ae.Z.EMPTY)&&((0,Qe.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()==ae.Z.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(Qe.bN),this.sourcesListenerKeys_=null}release(){this.canvas_&&((0,ke.jy)(this.canvas_.getContext("2d")),Ai.push(this.canvas_),this.canvas_=null),super.release()}}const Ds=rh;class so{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 Oi(r,e,t,i,n){return n!==void 0?(n.minX=r,n.maxX=e,n.minY=t,n.maxY=i,n):new so(r,e,t,i)}const ro=so;class oh extends wr{constructor(e){super(e),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=(0,C.lJ)(),this.tmpTileRange_=new ro(0,0,0,0)}isDrawableTile(e){const t=this.getLayer(),i=e.getState(),n=t.getUseInterimTilesOnError();return i==ae.Z.LOADED||i==ae.Z.EMPTY||i==ae.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()==ae.Z.ERROR&&a.getUseInterimTilesOnError()&&a.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(h)||(h=h.getInterimTile()),h}getData(e){const t=this.frameState;if(!t)return null;const i=this.getLayer(),n=(0,q.nn)(t.pixelToCoordinateTransform,e.slice()),s=i.getExtent();if(s&&!(0,C.b8)(s,n))return null;const o=t.pixelRatio,a=t.viewState.projection,l=t.viewState,h=i.getRenderSource(),c=h.getTileGridForProjection(l.projection),d=h.getTilePixelRatio(t.pixelRatio);for(let u=c.getZForResolution(l.resolution);u>=c.getMinZoom();--u){const g=c.getTileCoordForCoordAndZ(n,u),f=h.getTile(u,g[1],g[2],o,a);if(!(f instanceof eo||f instanceof Ds)||f instanceof Ds&&f.getState()===ae.Z.EMPTY)return null;if(f.getState()!==ae.Z.LOADED)continue;const m=c.getOrigin(u),p=(0,lt.Pq)(c.getTileSize(u)),v=c.getResolution(u),y=Math.floor(d*((n[0]-m[0])/v-g[1]*p[0])),w=Math.floor(d*((m[1]-n[1])/v-g[2]*p[1])),b=Math.round(d*h.getGutterForProjection(l.projection));return this.getImageData(f.getImage(),y+b,w+b)}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(),d=c.getSource(),u=d.getRevision(),g=d.getTileGridForProjection(s),f=g.getZForResolution(o,d.zDirection),m=g.getResolution(f);let p=e.extent;const v=e.viewState.resolution,y=d.getTilePixelRatio(h),w=Math.round((0,C.dz)(p)/v*h),b=Math.round((0,C.Cr)(p)/v*h),F=i.extent&&(0,U.dY)(i.extent,s);F&&(p=(0,C.Ed)(p,(0,U.dY)(i.extent,s)));const L=m*w/2/y,A=m*b/2/y,G=[a[0]-L,a[1]-A,a[0]+L,a[1]+A],H=g.getTileRangeForExtentAndZ(p,f),K={};K[f]={};const le=this.createLoadedTileFinder(d,s,K),he=this.tmpExtent,Q=this.tmpTileRange_;this.newTiles_=!1;const me=l?(0,C.dY)(n.center,v,l,e.size):void 0;for(let ct=H.minX;ct<=H.maxX;++ct)for(let we=H.minY;we<=H.maxY;++we){if(l&&!g.tileCoordIntersectsViewport([f,ct,we],me))continue;const Le=this.getTile(f,ct,we,e);if(this.isDrawableTile(Le)){const Xe=(0,$.sq)(this);if(Le.getState()==ae.Z.LOADED){K[f][Le.tileCoord.toString()]=Le;let Vt=Le.inTransition(Xe);Vt&&i.opacity!==1&&(Le.endTransition(Xe),Vt=!1),!this.newTiles_&&(Vt||!this.renderedTiles.includes(Le))&&(this.newTiles_=!0)}if(Le.getAlpha(Xe,e.time)===1)continue}const ai=g.getTileCoordChildTileRange(Le.tileCoord,Q,he);let zt=!1;ai&&(zt=le(f+1,ai)),zt||g.forEachTileCoordParentTileRange(Le.tileCoord,le,Q,he)}const re=m/o*h/y;(0,q.qC)(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/h,1/h,l,-w/2,-b/2);const Y=(0,q.BB)(this.pixelTransform);this.useContainer(t,Y,this.getBackground(e));const Z=this.context,J=Z.canvas;(0,q.nb)(this.inversePixelTransform,this.pixelTransform),(0,q.qC)(this.tempTransform,w/2,b/2,re,re,0,-w/2,-b/2),J.width!=w||J.height!=b?(J.width=w,J.height=b):this.containerReused||Z.clearRect(0,0,w,b),F&&this.clipUnrotated(Z,e,F),d.getInterpolate()||(Z.imageSmoothingEnabled=!1),this.preRender(Z,e),this.renderedTiles.length=0;let Ee=Object.keys(K).map(Number);Ee.sort(et.j2);let Ie,Ze,N;i.opacity===1&&(!this.containerReused||d.getOpaque(e.viewState.projection))?Ee=Ee.reverse():(Ie=[],Ze=[]);for(let ct=Ee.length-1;ct>=0;--ct){const we=Ee[ct],Le=d.getTilePixelSize(we,h,s),zt=g.getResolution(we)/m,Xe=Le[0]*zt*re,Vt=Le[1]*zt*re,Zi=g.getTileCoordForCoordAndZ((0,C.rL)(G),we),Jn=g.getTileCoordExtent(Zi),Wi=(0,q.nn)(this.tempTransform,[y*(Jn[0]-G[0])/m,y*(G[3]-Jn[3])/m]),$n=y*d.getGutterForProjection(s),li=K[we];for(const dn in li){const hi=li[dn],qn=hi.tileCoord,Qn=Zi[1]-qn[1],es=Math.round(Wi[0]-(Qn-1)*Xe),Ui=Zi[2]-qn[2],tr=Math.round(Wi[1]-(Ui-1)*Vt),st=Math.round(Wi[0]-Qn*Xe),vt=Math.round(Wi[1]-Ui*Vt),Lt=es-st,Yt=tr-vt,Xi=f===we,Ei=Xi&&hi.getAlpha((0,$.sq)(this),e.time)!==1;let ci=!1;if(!Ei)if(Ie){N=[st,vt,st+Lt,vt,st+Lt,vt+Yt,st,vt+Yt];for(let Vi=0,ts=Ie.length;Vi<ts;++Vi)if(f!==we&&we<Ze[Vi]){const it=Ie[Vi];(0,C.kK)([st,vt,st+Lt,vt+Yt],[it[0],it[3],it[4],it[7]])&&(ci||(Z.save(),ci=!0),Z.beginPath(),Z.moveTo(N[0],N[1]),Z.lineTo(N[2],N[3]),Z.lineTo(N[4],N[5]),Z.lineTo(N[6],N[7]),Z.moveTo(it[6],it[7]),Z.lineTo(it[4],it[5]),Z.lineTo(it[2],it[3]),Z.lineTo(it[0],it[1]),Z.clip())}Ie.push(N),Ze.push(we)}else Z.clearRect(st,vt,Lt,Yt);this.drawTileImage(hi,e,st,vt,Lt,Yt,$n,Xi),Ie&&!Ei?(ci&&Z.restore(),this.renderedTiles.unshift(hi)):this.renderedTiles.push(hi),this.updateUsedTiles(e.usedTiles,d,hi)}}return this.renderedRevision=u,this.renderedResolution=m,this.extentChanged=!this.renderedExtent_||!(0,C.fS)(this.renderedExtent_,G),this.renderedExtent_=G,this.renderedPixelRatio=h,this.renderedProjection=s,this.manageTilePyramid(e,d,g,h,s,p,f,c.getPreload()),this.scheduleExpireCache(e,d),this.postRender(Z,e),i.extent&&Z.restore(),Z.imageSmoothingEnabled=!0,Y!==J.style.transform&&(J.style.transform=Y),this.container}drawTileImage(e,t,i,n,s,o,a,l){const h=this.getTileImage(e);if(!h)return;const c=(0,$.sq)(this),d=t.layerStatesArray[t.layerIndex],u=d.opacity*(l?e.getAlpha(c,t.time):1),g=u!==this.context.globalAlpha;g&&(this.context.save(),this.context.globalAlpha=u),this.context.drawImage(h,a,a,h.width-2*a,h.height-2*a,i,n,s,o),g&&this.context.restore(),u!==d.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,$.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,$.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,$.sq)(t);c in e.wantedTiles||(e.wantedTiles[c]={});const d=e.wantedTiles[c],u=e.tileQueue,g=i.getMinZoom(),f=e.viewState.rotation,m=f?(0,C.dY)(e.viewState.center,e.viewState.resolution,f,e.size):void 0;let p=0,v,y,w,b,F,L;for(L=g;L<=a;++L)for(y=i.getTileRangeForExtentAndZ(o,L,y),w=i.getResolution(L),b=y.minX;b<=y.maxX;++b)for(F=y.minY;F<=y.maxY;++F)f&&!i.tileCoordIntersectsViewport([L,b,F],m)||(a-L<=l?(++p,v=t.getTile(L,b,F,n,s),v.getState()==ae.Z.IDLE&&(d[v.getKey()]=!0,u.isKeyQueued(v.getKey())||u.enqueue([v,c,i.getTileCoordCenter(v.tileCoord),w])),h!==void 0&&h(v)):t.useTile(L,b,F,s));t.updateCacheSize(p,s)}}const ah=oh;class lh extends jl{constructor(e){super(e)}createRenderer(){return new ah(this)}}const As=lh;class hh{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){const i=this.entries_[e];return(0,ue.h)(i!==void 0,15),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(e){const t=this.entries_[e];return(0,ue.h)(t!==void 0,15),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){const e=new Array(this.count_);let t=0,i;for(i=this.newest_;i;i=i.older)e[t++]=i.key_;return e}getValues(){const e=new Array(this.count_);let t=0,i;for(i=this.newest_;i;i=i.older)e[t++]=i.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){if(this.containsKey(e))return this.entries_[e].value_}pop(){const e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){(0,ue.h)(!(e in this.entries_),16);const i={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[e]=i,++this.count_}setSize(e){this.highWaterMark=e}}const ch=hh;function oo(r,e,t,i){return i!==void 0?(i[0]=r,i[1]=e,i[2]=t,i):[r,e,t]}function rn(r,e,t){return r+"/"+e+"/"+t}function ao(r){return rn(r[0],r[1],r[2])}function bu(r){const[e,t,i]=r.substring(r.lastIndexOf("/")+1,r.length).split(",").map(Number);return rn(e,t,i)}function uh(r){return r.split("/").map(Number)}function dh(r){return(r[1]<<r[0])+r[2]}function fh(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 gh extends ch{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=uh(e)[0];this.forEach(n=>{n.tileCoord[0]!==i&&(this.remove(ao(n.tileCoord)),n.release())})}}const lo=gh,Os={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var ks=S(4840),mh=S(82688);const ki=[0,0,0],si=5;class ph{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,(0,ue.h)((0,et.pT)(this.resolutions_,function(n,s){return s-n},!0),17);let t;if(!e.origins){for(let n=0,s=this.resolutions_.length-1;n<s;++n)if(!t)t=this.resolutions_[n]/this.resolutions_[n+1];else if(this.resolutions_[n]/this.resolutions_[n+1]!==t){t=void 0;break}}this.zoomFactor_=t,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,(0,ue.h)(this.origins_.length==this.resolutions_.length,20));const i=e.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=(0,C.rL)(i)),(0,ue.h)(!this.origin_&&this.origins_||this.origin_&&!this.origins_,18),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,(0,ue.h)(this.tileSizes_.length==this.resolutions_.length,19)),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:ks.S,(0,ue.h)(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,22),this.extent_=i!==void 0?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.sizes!==void 0?this.fullTileRanges_=e.sizes.map(function(n,s){const o=new ro(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=Oi(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 Oi(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 Oi(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 Oi(h,h,c,c,i);const d=Math.floor(l*(s+1))-1,u=Math.floor(l*(o+1))-1;return Oi(h,d,c,u,i)}const a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,i)}getTileRangeForExtentAndZ(e,t,i){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,ki);const n=ki[1],s=ki[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,ki);const o=ki[1],a=ki[2];return Oi(n,o,s,a,i)}getTileCoordCenter(e){const t=this.getOrigin(e[0]),i=this.getResolution(e[0]),n=(0,lt.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,lt.Pq)(this.getTileSize(e[0]),this.tmpSize_),o=i[0]+e[1]*s[0]*n,a=i[1]-(e[2]+1)*s[1]*n,l=o+s[0]*n,h=a+s[1]*n;return(0,C.T9)(o,a,l,h,t)}getTileCoordForCoordAndResolution(e,t,i){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,i)}getTileCoordForXYAndResolution_(e,t,i,n,s){const o=this.getZForResolution(i),a=i/this.getResolution(o),l=this.getOrigin(o),h=(0,lt.Pq)(this.getTileSize(o),this.tmpSize_);let c=a*(e-l[0])/i/h[0],d=a*(l[1]-t)/i/h[1];return n?(c=(0,_e.mD)(c,si)-1,d=(0,_e.mD)(d,si)-1):(c=(0,_e.GW)(c,si),d=(0,_e.GW)(d,si)),oo(o,c,d,s)}getTileCoordForXYAndZ_(e,t,i,n,s){const o=this.getOrigin(i),a=this.getResolution(i),l=(0,lt.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,_e.mD)(h,si)-1,c=(0,_e.mD)(c,si)-1):(h=(0,_e.GW)(h,si),c=(0,_e.GW)(c,si)),oo(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,et.h7)(this.resolutions_,e,t||0);return(0,_e.uZ)(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return(0,mh.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 ho=ph;function co(r){let e=r.getDefaultTileGrid();return e||(e=vh(r),r.setDefaultTileGrid(e)),e}function _h(r,e,t){const i=e[0],n=r.getTileCoordCenter(e),s=Bs(t);if(!(0,C.b8)(s,n)){const o=(0,C.dz)(s),a=Math.ceil((s[0]-n[0])/o);return n[0]+=o*a,r.getTileCoordForCoordAndZ(n,i)}return e}function xh(r,e,t,i){i=i!==void 0?i:"top-left";const n=uo(r,e,t);return new ho({extent:r,origin:(0,C.g0)(r,i),resolutions:n,tileSize:t})}function yh(r){const e=r||{},t=e.extent||(0,U.U2)("EPSG:3857").getExtent(),i={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:uo(t,e.maxZoom,e.tileSize,e.maxResolution)};return new ho(i)}function uo(r,e,t,i){e=e!==void 0?e:ks.e,t=(0,lt.Pq)(t!==void 0?t:ks.S);const n=(0,C.Cr)(r),s=(0,C.dz)(r);i=i>0?i:Math.max(s/t[0],n/t[1]);const o=e+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=i/Math.pow(2,l);return a}function vh(r,e,t,i){const n=Bs(r);return xh(n,e,t,i)}function Bs(r){r=(0,U.U2)(r);let e=r.getExtent();if(!e){const t=180*U.Wm.degrees/r.getMetersPerUnit();e=(0,C.T9)(-t,-t,t,t)}return e}class Eh extends Mr{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,lt.Pq)(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tileCache=new lo(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 d=i.minY;d<=i.maxY;++d)l=rn(t,c,d),h=!1,s.containsKey(l)&&(a=s.get(l),h=a.getState()===ae.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,$.O3)()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:co(e)}getTileCacheForProjection(e){const t=this.getProjection();return(0,ue.h)(t===null||(0,U.OP)(t,e),68),this.tileCache}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,i){const n=this.getTileGridForProjection(i),s=this.getTilePixelRatio(t),o=(0,lt.Pq)(n.getTileSize(e),this.tmpSize);return s==1?o:(0,lt.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=_h(i,e,t)),fh(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 Ch extends vn.ZP{constructor(e,t){super(e),this.tile=t}}const wh=Eh;function Sh(r,e){const t=/\{z\}/g,i=/\{x\}/g,n=/\{y\}/g,s=/\{-y\}/g;return function(o,a,l){if(o)return r.replace(t,o[0].toString()).replace(i,o[1].toString()).replace(n,o[2].toString()).replace(s,function(){const h=o[0],c=e.getFullTileRange(h);return(0,ue.h)(c,55),(c.getHeight()-o[2]-1).toString()})}}function Th(r,e){const t=r.length,i=new Array(t);for(let n=0;n<t;++n)i[n]=Sh(r[n],e);return Ih(i)}function Ih(r){return r.length===1?r[0]:function(e,t,i){if(!e)return;const n=dh(e),s=(0,_e.$W)(n,r.length);return r[s](e,t,i)}}function Lu(r,e,t){}function Rh(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 zs extends wh{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===zs.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,$.sq)(t),n=t.getState();let s;n==ae.Z.LOADING?(this.tileLoadingKeys_[i]=!0,s=Os.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],s=n==ae.Z.ERROR?Os.TILELOADERROR:n==ae.Z.LOADED?Os.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new Ch(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=Rh(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;const t=e.join(`
`);this.generateTileUrlFunction_?this.setTileUrlFunction(Th(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,i){}useTile(e,t,i){const n=rn(e,t,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}}const bh=zs;class Lh extends bh{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:Fh,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:eo,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}canExpireCache(){if(this.tileCache.canExpireCache())return!0;for(const e in this.tileCacheForProjection)if(this.tileCacheForProjection[e].canExpireCache())return!0;return!1}expireCache(e,t){const i=this.getTileCacheForProjection(e);this.tileCache.expireCache(this.tileCache==i?t:{});for(const n in this.tileCacheForProjection){const s=this.tileCacheForProjection[n];s.expireCache(s==i?t:{})}}getGutterForProjection(e){return this.getProjection()&&e&&!(0,U.OP)(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getOpaque(e){return this.getProjection()&&e&&!(0,U.OP)(this.getProjection(),e)?!1:super.getOpaque(e)}getTileGridForProjection(e){const t=this.getProjection();if(this.tileGrid&&(!t||(0,U.OP)(t,e)))return this.tileGrid;const i=(0,$.sq)(e);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=co(e)),this.tileGridForProjection[i]}getTileCacheForProjection(e){const t=this.getProjection();if(!t||(0,U.OP)(t,e))return this.tileCache;const i=(0,$.sq)(e);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new lo(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?ae.Z.IDLE:ae.Z.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(at.Z.CHANGE,this.handleTileChange.bind(this)),c}getTile(e,t,i,n,s){const o=this.getProjection();if(!o||!s||(0,U.OP)(o,s))return this.getTileInternal(e,t,i,n,o||s);const a=this.getTileCacheForProjection(s),l=[e,t,i];let h;const c=ao(l);a.containsKey(c)&&(h=a.get(c));const d=this.getKey();if(h&&h.key==d)return h;const u=this.getTileGridForProjection(o),g=this.getTileGridForProjection(s),f=this.getTileCoordForTileUrlFunction(l,s),m=new Ds(o,u,s,g,l,f,this.getTilePixelRatio(n),this.getGutter(),(p,v,y,w)=>this.getTileInternal(p,v,y,w,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.getInterpolate());return m.key=d,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=rn(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()==ae.Z.IDLE?o.interimTile=h.interimTile:o.interimTile=h,o.refreshInterimChain(),this.tileCache.replace(a,o)}return o}setRenderReprojectionEdges(e){if(this.renderReprojectionEdges_!=e){this.renderReprojectionEdges_=e;for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear();this.changed()}}setTileGridForProjection(e,t){const i=(0,U.U2)(e);if(i){const n=(0,$.sq)(i);n in this.tileGridForProjection||(this.tileGridForProjection[n]=t)}}clear(){super.clear();for(const e in this.tileCacheForProjection)this.tileCacheForProjection[e].clear()}}function Fh(r,e){r.getImage().src=e}const Mh=Lh;class Ph extends Mh{constructor(e){e=e||{};const t=e.projection!==void 0?e.projection:"EPSG:3857",i=e.tileGrid!==void 0?e.tileGrid:yh({extent:Bs(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 Gs=Ph;var Dh=(r=>(r.Auto="auto",r.Light="light",r.Dark="dark",r))(Dh||{});const zn={theme:"auto",showLabels:!0},fo={id:"carto",name:"CARTO basemap",description:"Add layer CARTO Raster basemaps",isBaseMap:!0,defaultOptions:zn,create:async(r,e,t,i)=>({init:()=>{const n={...zn,...e.config};let s=n.theme;return(!s||s==="auto")&&(s=i.isDark?"dark":"light"),n.showLabels?s+="_all":s+="_nolabels",new As({source:new Gs({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:zn.theme}).addBooleanSwitch({path:"config.showLabels",name:"Show labels",description:"",defaultValue:zn.showLabels})}})},Ah=[fo],go="https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer",Bi={url:go+"/tile/{z}/{y}/{x}",attribution:`Tiles \xA9 <a href="${go}">ArcGIS</a>`},mo={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=Bi.url,n.attribution=n.attribution??Bi.attribution),new As({source:new Gs({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:Bi.url}}).addTextInput({path:"config.attribution",name:"Attribution",settings:{placeholder:Bi.attribution}})}})},Oh=[mo],Gn="custom",Ns="streets",po=new An.B(()=>[{id:Ns,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:Gn,name:"Custom MapServer",description:"Use a custom MapServer with pre-cached values",slug:""}]),kh=[{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=po.getIfExists(n.server??Ns);if(s.id!==Gn){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 mo.create(r,o,t,i).then(a=>(a.registerOptionsUI=l=>{l.addSelect({path:"config.server",name:"Server instance",settings:{options:po.selectOptions().options}}).addTextInput({path:"config.url",name:"URL template",description:"Must include {x}, {y} or {-y}, and {z} placeholders",settings:{placeholder:Bi.url},showIf:h=>h.config?.server===Gn}).addTextInput({path:"config.attribution",name:"Attribution",settings:{placeholder:Bi.attribution},showIf:h=>h.config?.server===Gn})},a))},defaultOptions:{server:Ns}}],Bh='&#169; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class zh extends Gs{constructor(e){e=e||{};let t;e.attributions!==void 0?t=e.attributions:t=[Bh];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 Gh=zh,Zs=[...[{id:"osm-standard",name:"Open Street Map",description:"Add map from a collaborative free geographic world database",isBaseMap:!0,create:async(r,e,t)=>({init:()=>new As({source:new Gh})})}],...Ah,...kh,...Oh];var Nn=S(6316),kt=class extends _t{constructor(e){e=e||{},e.strategy=Pr,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=kt._sunEclipticPosition(o),h=kt._eclipticObliquity(o),c=kt._sunEquatorialPosition(l.lambda,h),d=a*15+e-c.alpha,u=Math.atan(-Math.cos(d*n)/Math.tan(c.delta*n))*i;return u}_loader(e,t,i){var n=this.getCoordinates(this.get("time")),s=new Pt.ZP([n]);s.transform("EPSG:4326",i),this.addFeature(new Ke.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=kt._sunEclipticPosition(i),o=kt._eclipticObliquity(i),a=kt._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=kt._sunEclipticPosition(o),c=kt._eclipticObliquity(o),d=kt._sunEquatorialPosition(h.lambda,c),u=this.get("step")||1,g=-180;g<=180;g+=u){var f=g,m=a*15+f-d.alpha,p=Math.atan(-Math.cos(m*n)/Math.tan(d.delta*n))*i;l.push([f,p])}switch(t){case"line":break;case"day":d.delta*=-1;default:{p=d.delta<0?90:-90;for(var v=180;v>=-180;v-=u)l.push([v,p]);l.push(l[0]);break}}if(t==="daynight"){var y=[];l.forEach(function(w){y.push(w.slice())}),y[0][1]=-y[0][1],y[y.length-1][1]=-y[0][1],y[y.length-1][1]=-y[0][1],l=[l,y]}return l}};const _o=kt;var Nh=(r=>(r.From="from",r.To="to",r))(Nh||{});const yi={show:"to",sun:!1,nightColor:"#a7a6ba4D"},xo="dayNight",Du={type:xo,name:"",config:yi,tooltip:!0},Zh={id:xo,name:"Night / Day",description:"Show day and night regions",isBaseMap:!1,create:async(r,e,t,i)=>{const n={...yi,...e?.config},s=new _o({}),o=Object.getPrototypeOf(s),a=new _o({}),l=Object.getPrototypeOf(a),h=new Be({source:s,style:new fe({fill:new Se({color:i.visualization.getColorByName(n.nightColor)})})}),c=new Be({source:new _t({features:[]}),style:new fe({stroke:new Te({color:"#607D8B",width:1.5,lineDash:[2,3]})})}),d=new Ke.Z({geometry:new wt.Z([])}),u=new Be({source:new _t({features:[d]}),style:new fe({image:new St({radius:13,fill:new Se({color:"rgb(253,184,19)"})})})}),g=new Ke.Z({geometry:new wt.Z([])}),f=new fe({image:new St({radius:13,stroke:new Te({color:"rgb(253,184,19)",width:1.5})})}),m=new fe({image:new St({radius:15,stroke:new Te({color:"#607D8B",width:1.5,lineDash:[2,3]})})}),p=new Be({source:new _t({features:[g]}),style:[m,f]}),v=new Nn.Z({layers:n.sun?[h,u,p,c]:[h,c]}),y=new j.w0;return{init:()=>v,dispose:()=>y.unsubscribe(),update:w=>{const b=new Date(w.timeRange.from.valueOf()),F=new Date(w.timeRange.to.valueOf());let L=new Date,A=[];n.show==="from"?L=b:L=F,s.setTime(L),n.sun&&(A=o.getSunPosition(L),d.getGeometry()?.setCoordinates((0,U.mi)(A)))},registerOptionsUI:w=>{e.config?.nightColor||(e.config={...yi,...e.config}),w.addRadio({path:"config.show",name:"Show",settings:{options:[{label:"From",value:"from"},{label:"To",value:"to"}]},defaultValue:yi.show}),w.addColorPicker({path:"config.nightColor",name:"Night region color",description:"Pick color of night region",defaultValue:yi.nightColor,settings:[{enableNamedColors:!1}]}),w.addBooleanSwitch({path:"config.sun",name:"Display sun",description:"Show the sun",defaultValue:yi.sun})}}},defaultOptions:yi};var yo=S(37813),vo=S(5632),Eo=S(71476),Wh=S(34352);const Co=(r,e)=>{const t=e.get(r.property);return(0,Wh.f)(t,r.operation,r.value)};function wo(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=k.bD.Any;if(e.size===1)switch(e.values().next().value){case"Point":case"MultiPoint":i=k.bD.Point;break;case"Line":case"MultiLine":i=k.bD.Line;break;case"Polygon":i=k.bD.Polygon}return{geometryType:i,propertes:Array.from(t.keys()).map(n=>({label:n,value:n}))}}function Uh(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}const on={src:"public/maps/countries.geojson",rules:[],style:k.Er,dataStyle:{}},Au={style:k.Er,check:{property:"",operation:ze.Bd.EQ,value:""}},Xh={id:"dynamic-geojson",name:"Dynamic GeoJSON",description:"Style a geojson file based on query results",isBaseMap:!1,state:xi.BV.alpha,create:async(r,e,t,i)=>{const n={...on,...e.config},s=new _t({url:n.src,format:new yo.Z}),o=new Mn.t,a=s.on("change",()=>{s.getState()==="ready"&&((0,_s.B)(a),o.next(s.getFeatures()))}),l=[];if(n.rules){for(const u of n.rules)if(u.style){const g=await Ut(u.style);l.push({state:g,rule:u.check})}}{const u=await Ut(n.style);l.push({state:u})}const h=await Ut(n.style),c=new Map,d=new Be({source:s,style:u=>{const g=c.get(u.getId()),f=h.dims;if(g&&f)return new fe({fill:new Se({color:f.color?.get(g)}),stroke:new Te({color:h.base.color,width:h.base.lineWidth??1})});const m=u.getGeometry()?.getType()==="Point";for(const p of l)if(!(p.rule&&!Co(p.rule,u))){if(p.state.fields){const v={...p.state.base},{text:y}=p.state.fields;return y&&(v.text=`${u.get(y)}`),m?p.state.maker(v):kn(v)}return m?(p.point||(p.point=p.state.maker(p.state.base)),p.point):(p.poly||(p.poly=kn(p.state.base)),p.poly)}}});return{init:()=>d,update:u=>{const g=u.series[0];if(g){const f=(0,On.findField)(g,n.idField);f&&(c.clear(),f.values.forEach((m,p)=>c.set(m,p))),h.dims=(0,tt.vV)(g,h,i,n.dataStyle)}d.changed()},registerOptionsUI:u=>{const g=o.pipe((0,vo.P)(),(0,Eo.U)(f=>wo(f)));u.addSelect({path:"config.src",name:"GeoJSON URL",settings:{options:(0,tt.B1)()??[],allowCustomValue:!0},defaultValue:on.src}).addFieldNamePicker({path:"config.idField",name:"ID Field"}).addCustomEditor({id:"config.dataStyle",path:"config.dataStyle",name:"Data style",editor:ni,settings:{displayRotation:!1},defaultValue:on.dataStyle}).addCustomEditor({id:"config.style",path:"config.style",name:"Default style",description:"The style to apply when no rules above match",editor:ni,settings:{simpleFixedValues:!0,layerInfo:g},defaultValue:on.style})}}},defaultOptions:on};var So=S(20),an=S(30359);function To(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 Vh=({value:r,onChange:e,item:t,context:i})=>{const n=t.settings,{features:s,layerInfo:o}=n,a=(0,Pn.Z)(o),l=(0,Pn.Z)(s),h=(0,_.useMemo)(()=>{const F=r?.check?.property;return F&&l&&r.check?.operation===ze.Bd.EQ?Uh(l,F).map(L=>{let A;return!isNaN(Number(L))?A={value:Number(L),label:L}:A={value:L,label:L},A}):[]},[l,r]),c=(0,xe.wW)(Yh),d=10,u=(0,_.useCallback)(F=>{e({...r,check:{...r.check,property:F?.value}})},[e,r]),g=(0,_.useCallback)(F=>{e({...r,check:{...r.check,operation:F.value??ze.Bd.EQ}})},[e,r]),f=(0,_.useCallback)(F=>{e({...r,check:{...r.check,value:F?.value}})},[e,r]),m=(0,_.useCallback)(F=>{e({...r,check:{...r.check,value:F}})},[e,r]),p=(0,_.useCallback)(F=>{e({...r,style:F})},[e,r]),v=(0,_.useCallback)(()=>{e(void 0)},[e]),y=r.check??Io.check,w=To(y.property,a?.propertes),b=To(y.value,h);return _.createElement("div",{className:c.rule},_.createElement(It.Z,{className:c.row},_.createElement(ht._,{label:"Rule",labelWidth:d,grow:!0},_.createElement(wi.Ph,{placeholder:"Feature property",value:w.current,options:w.options,onChange:u,"aria-label":"Feature property",isClearable:!0,allowCustomValue:!0})),_.createElement(ht._,{className:c.inline},_.createElement(wi.Ph,{value:So.J8.find(F=>F.value===y.operation),options:So.J8,onChange:g,"aria-label":"Comparison operator",width:8})),_.createElement(ht._,{className:c.inline,grow:!0},_.createElement("div",{className:c.flexRow},(y.operation===ze.Bd.EQ||y.operation===ze.Bd.NEQ)&&_.createElement(wi.Ph,{placeholder:"value",value:b.current,options:b.options,onChange:f,"aria-label":"Comparison value",isClearable:!0,allowCustomValue:!0}),y.operation!==ze.Bd.EQ&&_.createElement(an.Y,{key:`${y.property}/${y.operation}`,value:isNaN(Number(y.value))?0:Number(y.value),placeholder:"numeric value",onChange:m}))),_.createElement(xn.zx,{size:"md",icon:"trash-alt",onClick:()=>v(),variant:"secondary","aria-label":"Delete style rule",className:c.button})),_.createElement("div",null,_.createElement(ni,{value:r.style??k.Er,context:i,onChange:p,item:{settings:{simpleFixedValues:!0,layerInfo:o}}})))},Yh=r=>({rule:(0,te.css)({marginBottom:r.spacing(1)}),row:(0,te.css)({display:"flex",marginBottom:"4px"}),inline:(0,te.css)({marginBottom:0,marginLeft:"4px"}),button:(0,te.css)({marginLeft:"4px"}),flexRow:(0,te.css)({display:"flex",flexDirection:"row",alignItems:"flex-start"})}),jh=({value:r,onChange:e,context:t,item:i})=>{const n=(0,xe.l4)(),s=i.settings,o=(0,_.useCallback)(()=>{const{palette:h}=n.visualization,c={fixed:h[Math.floor(Math.random()*h.length)]},d=[...r,{...Io,style:{...k.Er,color:c}}];e(d)},[e,r,n.visualization]),a=(0,_.useCallback)(h=>c=>{const d=[...r];c?d[h]=c:d.splice(h,1),e(d)},[e,r]),l=r&&r.map((h,c)=>{const d={settings:s};return _.createElement(Vh,{value:h,onChange:a(c),context:t,item:d,key:`${c}-${h.check?.property}`})});return _.createElement(_.Fragment,null,l,_.createElement(xn.zx,{size:"sm",icon:"plus",onClick:o,variant:"secondary","aria-label":"Add geomap style rule"},"Add style rule"))},Zn={src:"public/maps/countries.geojson",rules:[],style:k.Er},Io={style:k.Er,check:{property:"",operation:ze.Bd.EQ,value:""}},Hh={id:"geojson",name:"GeoJSON",description:"Load static data from a geojson file",isBaseMap:!1,create:async(r,e,t,i)=>{const n={...Zn,...e.config},s=new _t({url:n.src,format:new yo.Z}),o=new Mn.t,a=s.on("change",()=>{s.getState()==="ready"&&((0,_s.B)(a),o.next(s.getFeatures()))}),l=[];if(n.rules){for(const c of n.rules)if(c.style){const d=await Ut(c.style);l.push({state:d,rule:c.check})}}{const c=await Ut(n.style);l.push({state:c})}const h=new Be({source:s,style:c=>{const d=c.getGeometry()?.getType()==="Point";for(const u of l)if(!(u.rule&&!Co(u.rule,c))){if(u.state.fields){const g={...u.state.base},{text:f}=u.state.fields;return f&&(g.text=`${c.get(f)}`),d?u.state.maker(g):kn(g)}return d?(u.point||(u.point=u.state.maker(u.state.base)),u.point):(u.poly||(u.poly=kn(u.state.base)),u.poly)}}});return{init:()=>h,registerOptionsUI:c=>{const d=o.pipe((0,vo.P)(),(0,Eo.U)(u=>wo(u)));c.addSelect({path:"config.src",name:"GeoJSON URL",settings:{options:(0,tt.B1)()??[],allowCustomValue:!0},defaultValue:Zn.src}).addCustomEditor({id:"config.style",path:"config.style",name:"Default style",description:"The style to apply when no rules above match",editor:ni,settings:{simpleFixedValues:!0,layerInfo:d},defaultValue:Zn.style}).addCustomEditor({id:"config.rules",path:"config.rules",name:"Style rules",description:"Apply styles based on feature properties",editor:jh,settings:{features:o,layerInfo:d},defaultValue:[]})}}},defaultOptions:Zn},Wn=34962,Ws=34963,Kh=35040,Jh=35044,Un=35048,$h=5121,qh=5123,Qh=5125,Ro=5126,bo=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function Us(r,e){e=Object.assign({preserveDrawingBuffer:!0,antialias:!fr.ME},e);const t=bo.length;for(let i=0;i<t;++i)try{const n=r.getContext(bo[i],e);if(n)return n}catch{}return null}let Xs;function Ou(){if(!Xs){const r=document.createElement("canvas"),e=Us(r);e&&(Xs=e.getSupportedExtensions())}return Xs}const ec={STATIC_DRAW:Jh,STREAM_DRAW:Kh,DYNAMIC_DRAW:Un};class tc{constructor(e,t){this.array=null,this.type=e,(0,ue.h)(e===Wn||e===Ws,62),this.usage=t!==void 0?t:ec.STATIC_DRAW}ofSize(e){return this.array=new(Vs(this.type))(e),this}fromArray(e){return this.array=Vs(this.type).from(e),this}fromArrayBuffer(e){return this.array=new(Vs(this.type))(e),this}getType(){return this.type}getArray(){return this.array}getUsage(){return this.usage}getSize(){return this.array?this.array.length:0}}function Vs(r){switch(r){case Wn:return Float32Array;case Ws:return Uint32Array;default:return Float32Array}}const Ys=tc;var ic=S(20812);const Xn={LOST:"webglcontextlost",RESTORED:"webglcontextrestored"};var nc=S(36175);const sc=`
  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);
  }
`,rc=`
  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 oc{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||sc),t.compileShader(i);const n=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(n,e.fragmentShader||rc),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,$.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 Lo=oc;function ac(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function js(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 ku={FRAGMENT_SHADER:35632,VERTEX_SHADER:35633},ri={PROJECTION_MATRIX:"u_projectionMatrix",OFFSET_SCALE_MATRIX:"u_offsetScaleMatrix",OFFSET_ROTATION_MATRIX:"u_offsetRotateMatrix",TIME:"u_time",ZOOM:"u_zoom",RESOLUTION:"u_resolution",VIEWPORT_SIZE_PX:"u_viewportSizePx",PIXEL_RATIO:"u_pixelRatio"},Rt={UNSIGNED_BYTE:$h,UNSIGNED_SHORT:qh,UNSIGNED_INT:Qh,FLOAT:Ro},Vn={};function Fo(r){return"shared/"+r}let Mo=0;function lc(){const r="unique/"+Mo;return Mo+=1,r}function hc(r){let e=Vn[r];if(!e){const t=document.createElement("canvas");t.style.position="absolute",t.style.left="0",e={users:0,canvas:t},Vn[r]=e}return e.users+=1,e.canvas}function cc(r){const e=Vn[r];if(!e||(e.users-=1,e.users>0))return;const t=e.canvas,n=Us(t).getExtension("WEBGL_lose_context");n&&n.loseContext(),delete Vn[r]}class uc extends nc.Z{constructor(e){super(),e=e||{},this.boundHandleWebGLContextLost_=this.handleWebGLContextLost.bind(this),this.boundHandleWebGLContextRestored_=this.handleWebGLContextRestored.bind(this),this.canvasCacheKey_=e.canvasCacheKey?Fo(e.canvasCacheKey):lc(),this.canvas_=hc(this.canvasCacheKey_),this.gl_=Us(this.canvas_),this.bufferCache_={},this.extensionCache_={},this.currentProgram_=null,this.canvas_.addEventListener(Xn.LOST,this.boundHandleWebGLContextLost_),this.canvas_.addEventListener(Xn.RESTORED,this.boundHandleWebGLContextRestored_),this.offsetRotateMatrix_=(0,q.Ue)(),this.offsetScaleMatrix_=(0,q.Ue)(),this.tmpMat4_=ac(),this.uniformLocationsByProgram_={},this.attribLocationsByProgram_={},this.uniforms_=[],e.uniforms&&this.setUniforms(e.uniforms),this.postProcessPasses_=e.postProcesses?e.postProcesses.map(t=>new Lo({webGlContext:this.gl_,scaleRatio:t.scaleRatio,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms})):[new Lo({webGlContext:this.gl_})],this.shaderCompileErrors_=null,this.startTime_=Date.now()}setUniforms(e){this.uniforms_=[];for(const t in e)this.uniforms_.push({name:t,value:e[t]})}canvasCacheKeyMatches(e){return this.canvasCacheKey_===Fo(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.gl_,i=(0,$.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.gl_;this.bindBuffer(e),t.bufferData(e.getType(),e.getArray(),e.getUsage())}deleteBuffer(e){const t=this.gl_,i=(0,$.sq)(e),n=this.bufferCache_[i];n&&!t.isContextLost()&&t.deleteBuffer(n.webGlBuffer),delete this.bufferCache_[i]}disposeInternal(){this.canvas_.removeEventListener(Xn.LOST,this.boundHandleWebGLContextLost_),this.canvas_.removeEventListener(Xn.RESTORED,this.boundHandleWebGLContextRestored_),cc(this.canvasCacheKey_),delete this.gl_,delete this.canvas_}prepareDraw(e,t){const i=this.gl_,n=this.getCanvas(),s=e.size,o=e.pixelRatio;(n.width!==s[0]*o||n.height!==s[1]*o)&&(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)}bindTexture(e,t,i){const n=this.gl_;n.activeTexture(n.TEXTURE0+t),n.bindTexture(n.TEXTURE_2D,e),n.uniform1i(this.getUniformLocation(i),t)}prepareDrawToRenderTarget(e,t,i){const n=this.gl_,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.gl_;this.getExtension("OES_element_index_uint");const n=i.UNSIGNED_INT,s=4,o=t-e,a=e*s;i.drawElements(i.TRIANGLES,o,n,a)}finalizeDraw(e,t,i){for(let n=0,s=this.postProcessPasses_.length;n<s;n++)n===s-1?this.postProcessPasses_[n].apply(e,null,t,i):this.postProcessPasses_[n].apply(e,this.postProcessPasses_[n+1])}getCanvas(){return this.canvas_}getGL(){return this.gl_}applyFrameState(e){const t=e.size,i=e.viewState.rotation,n=e.pixelRatio,s=(0,q.mc)(this.offsetScaleMatrix_);(0,q.bA)(s,2/t[0],2/t[1]);const o=(0,q.mc)(this.offsetRotateMatrix_);i!==0&&(0,q.U1)(o,-i),this.setUniformMatrixValue(ri.OFFSET_SCALE_MATRIX,js(this.tmpMat4_,s)),this.setUniformMatrixValue(ri.OFFSET_ROTATION_MATRIX,js(this.tmpMat4_,o)),this.setUniformFloatValue(ri.TIME,(Date.now()-this.startTime_)*.001),this.setUniformFloatValue(ri.ZOOM,e.viewState.zoom),this.setUniformFloatValue(ri.RESOLUTION,e.viewState.resolution),this.setUniformFloatValue(ri.PIXEL_RATIO,n),this.setUniformFloatVec2(ri.VIEWPORT_SIZE_PX,[t[0],t[1]])}applyUniforms(e){const t=this.gl_;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,js(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.gl_.useProgram(e),this.currentProgram_=e,this.applyFrameState(t),this.applyUniforms(t)}compileShader(e,t){const i=this.gl_,n=i.createShader(t);return i.shaderSource(n,e),i.compileShader(n),n}getProgram(e,t){const i=this.gl_,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.getProgramInfoLog(o)}`;throw new Error(a)}return o}getUniformLocation(e){const t=(0,$.sq)(this.currentProgram_);return this.uniformLocationsByProgram_[t]===void 0&&(this.uniformLocationsByProgram_[t]={}),this.uniformLocationsByProgram_[t][e]===void 0&&(this.uniformLocationsByProgram_[t][e]=this.gl_.getUniformLocation(this.currentProgram_,e)),this.uniformLocationsByProgram_[t][e]}getAttributeLocation(e){const t=(0,$.sq)(this.currentProgram_);return this.attribLocationsByProgram_[t]===void 0&&(this.attribLocationsByProgram_[t]={}),this.attribLocationsByProgram_[t][e]===void 0&&(this.attribLocationsByProgram_[t][e]=this.gl_.getAttribLocation(this.currentProgram_,e)),this.attribLocationsByProgram_[t][e]}makeProjectionTransform(e,t){const i=e.size,n=e.viewState.rotation,s=e.viewState.resolution,o=e.viewState.center;return(0,q.qC)(t,0,0,2/(s*i[0]),2/(s*i[1]),-n,-o[0],-o[1]),t}setUniformFloatValue(e,t){this.gl_.uniform1f(this.getUniformLocation(e),t)}setUniformFloatVec2(e,t){this.gl_.uniform2fv(this.getUniformLocation(e),t)}setUniformFloatVec4(e,t){this.gl_.uniform4fv(this.getUniformLocation(e),t)}setUniformMatrixValue(e,t){this.gl_.uniformMatrix4fv(this.getUniformLocation(e),!1,t)}enableAttributeArray_(e,t,i,n,s){const o=this.getAttributeLocation(e);o<0||(this.gl_.enableVertexAttribArray(o),this.gl_.vertexAttribPointer(o,t,i,!1,n,s))}enableAttributes(e){const t=dc(e);let i=0;for(let n=0;n<e.length;n++){const s=e[n];this.enableAttributeArray_(s.name,s.size,s.type||Ro,t,i),i+=s.size*Po(s.type)}}handleWebGLContextLost(){(0,ji.Z)(this.bufferCache_),this.currentProgram_=null}handleWebGLContextRestored(){}createTexture(e,t,i){const n=this.gl_;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 dc(r){let e=0;for(let t=0;t<r.length;t++){const i=r[t];e+=i.size*Po(i.type)}return e}function Po(r){switch(r){case Rt.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case Rt.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case Rt.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case Rt.FLOAT:default:return Float32Array.BYTES_PER_ELEMENT}}const fc=uc;class Hs extends Er{constructor(e,t){super(e),t=t||{},this.inversePixelTransform_=(0,q.Ue)(),this.pixelContext_=null,this.postProcesses_=t.postProcesses,this.uniforms_=t.uniforms,this.helper,e.addChangeListener(ic.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(qt.Z.PRECOMPOSE)){const n=new wn.Z(qt.Z.PRECOMPOSE,void 0,t,e);i.dispatchEvent(n)}}dispatchPostComposeEvent(e,t){const i=this.getLayer();if(i.hasListener(qt.Z.POSTCOMPOSE)){const n=new wn.Z(qt.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 Hs)){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 fc({postProcesses:this.postProcesses_,uniforms:this.uniforms_,canvasCacheKey:s}),n&&(this.helper.getCanvas().className=n),this.afterHelperCreated())}return this.prepareFrameInternal(e)}afterHelperCreated(){}prepareFrameInternal(e){return!0}disposeInternal(){this.removeHelper(),super.disposeInternal()}dispatchRenderEvent_(e,t,i){const n=this.getLayer();if(n.hasListener(e)){(0,q.qC)(this.inversePixelTransform_,0,0,i.pixelRatio,-i.pixelRatio,0,0,-i.size[1]);const s=new wn.Z(e,this.inversePixelTransform_,i,t);n.dispatchEvent(s)}}preRender(e,t){this.dispatchRenderEvent_(qt.Z.PRERENDER,e,t)}postRender(e,t){this.dispatchRenderEvent_(qt.Z.POSTRENDER,e,t)}}const gc=Hs,Bt=new Uint8Array(4);class mc{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,et.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 Bt[0]=0,Bt[1]=0,Bt[2]=0,Bt[3]=0,Bt;this.readAll();const i=Math.floor(e)+(this.size_[1]-Math.floor(t)-1)*this.size_[0];return Bt[0]=this.data_[i*4],Bt[1]=this.data_[i*4+1],Bt[2]=this.data_[i*4+2],Bt[3]=this.data_[i*4+3],Bt}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 pc=mc,Ks={GENERATE_POLYGON_BUFFERS:"GENERATE_POLYGON_BUFFERS",GENERATE_POINT_BUFFERS:"GENERATE_POINT_BUFFERS",GENERATE_LINE_STRING_BUFFERS:"GENERATE_LINE_STRING_BUFFERS"};var Bu=S(56949);const _c=null,Js={vertexPosition:0,indexPosition:0};function Yn(r,e,t,i,n){r[e+0]=t,r[e+1]=i,r[e+2]=n}function zu(r,e,t,i,n,s){const l=3+n,h=r[e+0],c=r[e+1],d=_c;d.length=n;for(let m=0;m<d.length;m++)d[m]=r[e+2+m];let u=s?s.vertexPosition:0,g=s?s.indexPosition:0;const f=u/l;return Yn(t,u,h,c,0),d.length&&t.set(d,u+3),u+=l,Yn(t,u,h,c,1),d.length&&t.set(d,u+3),u+=l,Yn(t,u,h,c,2),d.length&&t.set(d,u+3),u+=l,Yn(t,u,h,c,3),d.length&&t.set(d,u+3),u+=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=u,Js.indexPosition=g,Js}function Gu(r,e,t,i,n,s,o,a,l,h){const d=5+a.length,u=s.length/d,g=[r[e+0],r[e+1]],f=[r[t],r[t+1]],m=applyTransform(h,[...g]),p=applyTransform(h,[...f]);function v(A,G,H){return Math.round(G*1500)+Math.round(H*1500)*1e4+A*1e4*1e4}function y(A,G,H){const K=Math.sqrt((G[0]-A[0])*(G[0]-A[0])+(G[1]-A[1])*(G[1]-A[1])),le=[(G[0]-A[0])/K,(G[1]-A[1])/K],he=[-le[1],le[0]],Q=Math.sqrt((H[0]-A[0])*(H[0]-A[0])+(H[1]-A[1])*(H[1]-A[1])),me=[(H[0]-A[0])/Q,(H[1]-A[1])/Q],re=K===0||Q===0?0:Math.acos(clamp(me[0]*le[0]+me[1]*le[1],-1,1));return me[0]*he[0]+me[1]*he[1]>0?re:Math.PI*2-re}const w=i!==null,b=n!==null;let F=0,L=0;if(w){const A=[r[i],r[i+1]],G=applyTransform(h,[...A]);F=y(m,p,G)}if(b){const A=[r[n],r[n+1]],G=applyTransform(h,[...A]);L=y(p,m,G)}s.push(g[0],g[1],f[0],f[1],v(0,F,L)),s.push(...a),s.push(g[0],g[1],f[0],f[1],v(1,F,L)),s.push(...a),s.push(g[0],g[1],f[0],f[1],v(2,F,L)),s.push(...a),s.push(g[0],g[1],f[0],f[1],v(3,F,L)),s.push(...a),o.push(u,u+1,u+2,u+1,u+3,u+2)}function Nu(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 d=new Array(h-1);for(let f=0;f<h;f++)c+=r[a++],f<h-1&&(d[f]=c);const u=r.slice(a,a+c*2),g=earcut(u,d,2);for(let f=0;f<g.length;f++)i.push(g[f]+t.length/o);for(let f=0;f<u.length;f+=2)t.push(u[f],u[f+1],...l);return a+c*2}function Zu(){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 xc(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 yc(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 vc=S(37599).Buffer;function Ec(){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}function u(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}new Array(6);var f={exports:{}};function x(e,t,n){n=n||2;var r,o,i,a,s,u,f,x=t&&t.length,h=x?t[0]*n:e.length,v=l(e,0,h,n,!0),d=[];if(!v||v.next===v.prev)return d;if(x&&(v=function(e,t,n,r){var o,i,a,s=[];for(o=0,i=t.length;o<i;o++)(a=l(e,t[o]*r,o<i-1?t[o+1]*r:e.length,r,!1))===a.next&&(a.steiner=!0),s.push(A(a));for(s.sort(b),o=0;o<s.length;o++)n=g(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<h;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 c(v,d,n,r,o,f,0),d}function l(e,t,n,r,o){var i,a;if(o===P(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&&F(a,a.next)&&(R(a),a=a.next),a}function h(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!F(r,r.next)&&0!==Z(r.prev,r,r.next))r=r.next;else{if(R(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function c(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=w(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?d(e,r,o,i):v(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(u.i/n|0),R(e),e=u.next,f=u.next;else if((e=u)===f){a?1===a?c(e=y(h(e),t,n),t,n,r,o,i,2):2===a&&p(e,t,n,r,o,i):c(h(e),t,n,r,o,i,1);break}}}function v(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&&E(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 d(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=w(c,v,t,n,r),b=w(d,y,t,n,r),g=e.prevZ,m=e.nextZ;g&&g.z>=p&&m&&m.z<=b;){if(g.x>=c&&g.x<=d&&g.y>=v&&g.y<=y&&g!==o&&g!==a&&E(s,x,u,l,f,h,g.x,g.y)&&Z(g.prev,g,g.next)>=0)return!1;if(g=g.prevZ,m.x>=c&&m.x<=d&&m.y>=v&&m.y<=y&&m!==o&&m!==a&&E(s,x,u,l,f,h,m.x,m.y)&&Z(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;g&&g.z>=p;){if(g.x>=c&&g.x<=d&&g.y>=v&&g.y<=y&&g!==o&&g!==a&&E(s,x,u,l,f,h,g.x,g.y)&&Z(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;m&&m.z<=b;){if(m.x>=c&&m.x<=d&&m.y>=v&&m.y<=y&&m!==o&&m!==a&&E(s,x,u,l,f,h,m.x,m.y)&&Z(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function y(e,t,n){var r=e;do{var o=r.prev,i=r.next.next;!F(o,i)&&T(o,r,r.next,i)&&z(o,i)&&z(i,o)&&(t.push(o.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),R(r),R(r.next),r=e=i),r=r.next}while(r!==e);return h(r)}function p(e,t,n,r,o,i){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&M(a,s)){var u=U(a,s);return a=h(a,a.next),u=h(u,u.next),c(a,t,n,r,o,i,0),void c(u,t,n,r,o,i,0)}s=s.next}a=a.next}while(a!==e)}function b(e,t){return e.x-t.x}function g(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&&E(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),z(r,e)&&(u<h||u===h&&(r.x>n.x||r.x===n.x&&m(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 h(r,r.next),h(n,n.next)}function m(e,t){return Z(e.prev,e,t.prev)<0&&Z(t.next,e,e.next)<0}function w(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 A(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 E(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 M(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&&T(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(z(e,t)&&z(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))||F(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 F(e,t){return e.x===t.x&&e.y===t.y}function T(e,t,n,r){var o=S(Z(e,t,n)),i=S(Z(e,t,r)),a=S(Z(n,r,e)),s=S(Z(n,r,t));return o!==i&&a!==s||(!(0!==o||!I(e,n,t))||(!(0!==i||!I(e,r,t))||(!(0!==a||!I(n,e,r))||!(0!==s||!I(n,t,r)))))}function I(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 S(e){return e>0?1:e<0?-1:0}function z(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 B(e.i,e.x,e.y),r=new B(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 B(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 R(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 B(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 P(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}f.exports=x,f.exports.default=x,x.deviation=function(e,t,n,r){var o=t&&t.length,i=o?t[0]*n:e.length,a=Math.abs(P(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(P(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)},x.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};var N=u(f.exports);const _=[],O={vertexPosition:0,indexPosition:0};function q(e,t,n,r,o){e[t+0]=n,e[t+1]=r,e[t+2]=o}function L(e,t,n,r,o,i){const a=3+o,s=e[t+0],u=e[t+1],f=_;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 q(n,x,s,u,0),f.length&&n.set(f,x+3),x+=a,q(n,x,s,u,1),f.length&&n.set(f,x+3),x+=a,q(n,x,s,u,2),f.length&&n.set(f,x+3),x+=a,q(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,O.vertexPosition=x,O.indexPosition=l,O}function C(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 G(e,t,n,r,o){const i=2+o;let a=t;const s=e.slice(a,a+o);a+=o;const u=e[a++];let f=0;const x=new Array(u-1);for(let t=0;t<u;t++)f+=e[a++],t<u-1&&(x[t]=f);const l=e.slice(a,a+2*f),h=N(l,x,2);for(let e=0;e<h.length;e++)r.push(h[e]+n.length/i);for(let e=0;e<l.length;e+=2)n.push(l[e],l[e+1],...s);return a+2*f}const j=self;j.onmessage=r=>{const o=r.data;switch(o.type){case t:{const e=3,t=2,n=o.customAttributesSize,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=L(i,e,f,u,n,x);const l=Object.assign({vertexBuffer:f.buffer,indexBuffer:u.buffer,renderInstructions:i.buffer},o);j.postMessage(l,[f.buffer,u.buffer,i.buffer]);break}case n:{const e=[],t=[],n=o.customAttributesSize,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++)C(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);j.postMessage(v,[c.buffer,h.buffer,i.buffer]);break}case e:{const e=[],t=[],n=o.customAttributesSize,r=new Float32Array(o.renderInstructions);let i=0;for(;i<r.length;)i=G(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);j.postMessage(u,[s.buffer,a.buffer,r.buffer]);break}}};';return new Worker(typeof Blob>"u"?"data:application/javascript;base64,"+vc.from(r,"binary").toString("base64"):URL.createObjectURL(new Blob([r],{type:"application/javascript"})))}class Cc extends gc{constructor(e,t){const i=t.uniforms||{},n=(0,q.Ue)();i[ri.PROJECTION_MATRIX]=n,super(e,{uniforms:i,postProcesses:t.postProcesses}),this.sourceRevision_=-1,this.verticesBuffer_=new Ys(Wn,Un),this.hitVerticesBuffer_=new Ys(Wn,Un),this.indicesBuffer_=new Ys(Ws,Un),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:Rt.FLOAT}}):[];this.attributes=[{name:"a_position",size:2,type:Rt.FLOAT},{name:"a_index",size:1,type:Rt.FLOAT}].concat(s),this.hitDetectionAttributes=[{name:"a_position",size:2,type:Rt.FLOAT},{name:"a_index",size:1,type:Rt.FLOAT},{name:"a_hitColor",size:4,type:Rt.FLOAT},{name:"a_featureUid",size:1,type:Rt.FLOAT}].concat(s),this.customAttributes=t.attributes?t.attributes:[],this.previousExtent_=(0,C.lJ)(),this.currentTransform_=n,this.renderTransform_=(0,q.Ue)(),this.invertRenderTransform_=(0,q.Ue)(),this.renderInstructions_=new Float32Array(0),this.hitRenderInstructions_=new Float32Array(0),this.hitRenderTarget_,this.lastSentId=0,this.worker_=Ec(),this.worker_.addEventListener("message",a=>{const l=a.data;if(l.type===Ks.GENERATE_POINT_BUFFERS){const h=l.projectionTransform;l.hitDetection?(this.hitVerticesBuffer_.fromArrayBuffer(l.vertexBuffer),this.helper.flushBufferData(this.hitVerticesBuffer_)):(this.verticesBuffer_.fromArrayBuffer(l.vertexBuffer),this.helper.flushBufferData(this.verticesBuffer_)),this.indicesBuffer_.fromArrayBuffer(l.indexBuffer),this.helper.flushBufferData(this.indicesBuffer_),this.renderTransform_=h,(0,q.nb)(this.invertRenderTransform_,this.renderTransform_),l.hitDetection?this.hitRenderInstructions_=new Float32Array(a.data.renderInstructions):(this.renderInstructions_=new Float32Array(a.data.renderInstructions),l.id===this.lastSentId&&(this.ready=!0)),this.getLayer().changed()}}),this.featureCache_={},this.featureCount_=0;const o=this.getLayer().getSource();this.sourceListenKeys_=[(0,Qe.oL)(o,Ue.ADDFEATURE,this.handleSourceFeatureAdded_,this),(0,Qe.oL)(o,Ue.CHANGEFEATURE,this.handleSourceFeatureChanged_,this),(0,Qe.oL)(o,Ue.REMOVEFEATURE,this.handleSourceFeatureDelete_,this),(0,Qe.oL)(o,Ue.CLEAR,this.handleSourceFeatureClear_,this)],o.forEachFeature(a=>{this.featureCache_[(0,$.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 pc(this.helper))}handleSourceFeatureAdded_(e){const t=e.feature;this.featureCache_[(0,$.sq)(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()},this.featureCount_++}handleSourceFeatureChanged_(e){const t=e.feature;this.featureCache_[(0,$.sq)(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()}}handleSourceFeatureDelete_(e){const t=e.feature;delete this.featureCache_[(0,$.sq)(t)],this.featureCount_--}handleSourceFeatureClear_(){this.featureCache_={},this.featureCount_=0}renderFrame(e){const t=this.helper.getGL();this.preRender(t,e);const i=e.viewState.projection,o=this.getLayer().getSource().getWrapX()&&i.canWrapX(),a=i.getExtent(),l=e.extent,h=o?(0,C.dz)(a):null,c=o?Math.ceil((l[2]-a[2])/h)+1:1,d=o?Math.floor((l[0]-a[0])/h):0;let u=d;const g=this.indicesBuffer_.getSize();do this.helper.makeProjectionTransform(e,this.currentTransform_),(0,q.Iu)(this.currentTransform_,u*h,0),(0,q.Jp)(this.currentTransform_,this.invertRenderTransform_),this.helper.applyUniforms(e),this.helper.drawElements(0,g);while(++u<c);this.helper.finalizeDraw(e,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent);const f=this.helper.getCanvas();return this.hitDetectionEnabled_&&(this.renderHitDetection(e,d,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[Ii.Z.ANIMATING]&&!e.viewHints[Ii.Z.INTERACTING],o=!(0,C.fS)(this.previousExtent_,e.extent),a=this.sourceRevision_<i.getRevision();if(a&&(this.sourceRevision_=i.getRevision()),s&&(o||a)){const l=n.projection,h=n.resolution,c=t instanceof ps?t.getRenderBuffer():0,d=(0,C.f3)(e.extent,c*h);i.loadFeatures(d,h,l),this.rebuildBuffers_(e),this.previousExtent_=e.extent.slice()}return this.helper.useProgram(this.program_,e),this.helper.prepareDraw(e),this.helper.bindBuffer(this.verticesBuffer_),this.helper.bindBuffer(this.indicesBuffer_),this.helper.enableAttributes(this.attributes),!0}rebuildBuffers_(e){const t=(0,q.Ue)();this.helper.makeProjectionTransform(e,t);const i=(2+this.customAttributes.length)*this.featureCount_;if((!this.renderInstructions_||this.renderInstructions_.length!==i)&&(this.renderInstructions_=new Float32Array(i)),this.hitDetectionEnabled_){const u=(7+this.customAttributes.length)*this.featureCount_;(!this.hitRenderInstructions_||this.hitRenderInstructions_.length!==u)&&(this.hitRenderInstructions_=new Float32Array(u))}let n,s;const o=[],a=[];let l=0,h=0,c;for(const u in this.featureCache_){if(n=this.featureCache_[u],s=n.geometry,!s||s.getType()!=="Point")continue;o[0]=s.getFlatCoordinates()[0],o[1]=s.getFlatCoordinates()[1],(0,q.nn)(t,o),c=xc(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(u));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 d={id:++this.lastSentId,type:Ks.GENERATE_POINT_BUFFERS,renderInstructions:this.renderInstructions_.buffer,customAttributesSize:this.customAttributes.length};if(d.projectionTransform=t,this.ready=!1,this.worker_.postMessage(d,[this.renderInstructions_.buffer]),this.renderInstructions_=null,this.hitDetectionEnabled_){const u={id:0,type:Ks.GENERATE_POINT_BUFFERS,renderInstructions:this.hitRenderInstructions_.buffer,customAttributesSize:5+this.customAttributes.length};u.projectionTransform=t,u.hitDetection=!0,this.worker_.postMessage(u,[this.hitRenderInstructions_.buffer]),this.hitRenderInstructions_=null}}forEachFeatureAtCoordinate(e,t,i,n,s){if((0,ue.h)(this.hitDetectionEnabled_,66),!this.hitRenderInstructions_)return;const o=(0,q.nn)(t.coordinateToPixelTransform,e.slice()),a=this.hitRenderTarget_.readPixel(o[0]/2,o[1]/2),l=[a[0]/255,a[1]/255,a[2]/255,a[3]/255],h=yc(l),c=this.hitRenderInstructions_[h],d=Math.floor(c).toString(),g=this.getLayer().getSource().getFeatureByUid(d);if(g)return n(g,this.getLayer(),null)}renderHitDetection(e,t,i,n){if(!this.hitVerticesBuffer_.getSize())return;let s=t;this.hitRenderTarget_.setSize([Math.floor(e.size[0]/2),Math.floor(e.size[1]/2)]),this.helper.useProgram(this.hitProgram_,e),this.helper.prepareDrawToRenderTarget(e,this.hitRenderTarget_,!0),this.helper.bindBuffer(this.hitVerticesBuffer_),this.helper.bindBuffer(this.indicesBuffer_),this.helper.enableAttributes(this.hitDetectionAttributes);do{this.helper.makeProjectionTransform(e,this.currentTransform_),(0,q.Iu)(this.currentTransform_,s*n,0),(0,q.Jp)(this.currentTransform_,this.invertRenderTransform_),this.helper.applyUniforms(e);const o=this.indicesBuffer_.getSize();this.helper.drawElements(0,o)}while(++s<i)}disposeInternal(){this.worker_.terminate(),this.layer_=null,this.sourceListenKeys_.forEach(function(e){(0,Qe.bN)(e)}),this.sourceListenKeys_=null,super.disposeInternal()}}const wc=Cc,bt={BLUR:"blur",GRADIENT:"gradient",RADIUS:"radius"},Sc=["#00f","#0ff","#0f0","#ff0","#f00"];class Tc extends ps{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(bt.GRADIENT,this.handleGradientChanged_),this.setGradient(e.gradient?e.gradient:Sc),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(bt.BLUR)}getGradient(){return this.get(bt.GRADIENT)}getRadius(){return this.get(bt.RADIUS)}handleGradientChanged_(){this.gradient_=Ic(this.getGradient())}setBlur(e){this.set(bt.BLUR,e)}setGradient(e){this.set(bt.GRADIENT,e)}setRadius(e){this.set(bt.RADIUS,e)}createRenderer(){return new wc(this,{className:this.getClassName(),attributes:[{name:"weight",callback:e=>{const t=this.weightFunction_(e);return t!==void 0?(0,_e.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(bt.RADIUS)+this.get(bt.BLUR))*2,u_blurSlope:()=>this.get(bt.RADIUS)/Math.max(1,this.get(bt.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 Ic(r){const i=(0,ke.E4)(1,256),n=i.createLinearGradient(0,0,1,256),s=1/(r.length-1);for(let o=0,a=r.length;o<a;++o)n.addColorStop(o*s,r[o]);return i.fillStyle=n,i.fillRect(0,0,1,256),i.canvas}const Rc=Tc,jn={weight:{fixed:1,min:0,max:1},blur:15,radius:5},bc={id:"heatmap",name:"Heatmap",description:"Visualizes a heatmap of the data",isBaseMap:!1,showLocation:!0,create:async(r,e,t,i)=>{const n={...jn,...e.config},s=await(0,Tt.cJ)(e.location),o=new nn(s),a="_weight",l=new Rc({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 d=(0,On.getScaledDimension)(c,n.weight);o.forEachFeature(f=>{const m=f.get("rowIndex");m!=null&&f.set(a,d.get(m))});let u=["#00f","#0ff","#0f0","#ff0","#f00"];const g=d.field??c.fields.find(f=>f.type===P.fS.number);if(g){const f=(0,Vr.fD)(g);f.isContinuous&&f.getColors&&(u=f.getColors(i))}l.setGradient(u)},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:jn.radius,settings:{min:1,max:50,step:1}}).addSliderInput({path:"config.blur",description:"Configures the amount of blur of clusters",name:"Blur",defaultValue:jn.blur,settings:{min:1,max:50,step:1}})}}},defaultOptions:jn},Do={icon:"https://openlayers.org/en/latest/examples/data/icon.png"},Lc={id:"last-point-tracker",name:"Icon at last point",description:"Show an icon at the last point",isBaseMap:!1,showLocation:!0,state:xi.BV.alpha,create:async(r,e,t,i)=>{const n=new Ke.Z({}),s={...Do,...e.config};n.setStyle(new fe({image:new En({src:s.icon})}));const o=new _t({features:[n]}),a=new Be({source:o}),l=await(0,Tt.cJ)(e.location);return{init:()=>a,update:h=>{const c=h.series[0];if(c&&c.length){const d=(0,Tt.g6)(c,l);if(!d.field)return;n.setGeometry(d.field.values[c.length-1])}}}},defaultOptions:Do};var xt=function(r,e){var t=r[0]-e[0],i=r[1]-e[1];return Math.sqrt(t*t+i*i)},oi=function(r,e){return r[0]==e[0]&&r[1]==e[1]},Wu=function(r){return Fc(r.getGeometry())},Fc=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()))}},Uu=function(r,e){var t=[],i=r.length-1,n=i,s,o,a,l,h,c,d,u,g,f,m,p,v,y=oi(r[0],r[i]);y||(m=r[0],p=r[1],v=[m[0]+(p[1]-m[1])/xt(m,p)*e,m[1]-(p[0]-m[0])/xt(m,p)*e],t.push(v),r.push(r[i]),i++,n--);for(var w=0;w<n;w++)m=r[w],p=r[(w+1)%i],v=r[(w+2)%i],s=(p[1]-m[1])/(p[0]-m[0]),o=(v[1]-p[1])/(v[0]-p[0]),Math.abs(s-o)>1e-10&&(a=Math.sqrt((p[0]-m[0])*(p[0]-m[0])+(p[1]-m[1])*(p[1]-m[1])),l=Math.sqrt((v[0]-p[0])*(v[0]-p[0])+(v[1]-p[1])*(v[1]-p[1])),h=m[0]+e*(p[1]-m[1])/a,c=p[0]+e*(v[1]-p[1])/l,d=m[1]-e*(p[0]-m[0])/a,u=p[1]-e*(v[0]-p[0])/l,g=(o*c-s*h+d-u)/(o-s),f=(s*o*(c-h)+o*d-s*u)/(o-s),p[0]-m[0]==0&&(g=p[0]+e*(p[1]-m[1])/Math.abs(p[1]-m[1]),f=o*g-o*c+u),v[0]-p[0]==0&&(g=v[0]+e*(v[1]-p[1])/Math.abs(v[1]-p[1]),f=s*g-s*h+d),t.push([g,f]));return y?t.push(t[0]):(r.pop(),m=r[r.length-1],p=r[r.length-2],v=[m[0]-(p[1]-m[1])/xt(m,p)*e,m[1]+(p[0]-m[0])/xt(m,p)*e],t.push(v)),t},Xu=function(r,e){for(var t=0;t<e.length-1;t++){var i=e[t],n=e[t+1];if(oi(r,i)||oi(r,n))return{index:1,segment:[i,n]};var s=xt(i,n),o=[(n[0]-i[0])/s,(n[1]-i[1])/s],a=xt(i,r),l=[(r[0]-i[0])/a,(r[1]-i[1])/a];if(Math.abs(o[0]*l[1]-o[1]*l[0])<1e-10)return{index:1,segment:[i,n]}}return{index:-1}},Vu=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},Yu=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}},ju=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},Ao;(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))}Ao=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 Pt.ZP(s[0]):new Li.Z(s)}})();var Hn=function(r,e,t,i){var n=[];i!==!1&&n.push(r);var s=xt(r,e);if(s){var o=Math.round(s/t);if(o>1)for(var a=(e[0]-r[0])/o,l=(e[1]-r[1])/o,h=1;h<o;h++)n.push([r[0]+a*h,r[1]+l*h])}return n.push(e),n};We.Z.prototype.sampleAt=function(r){for(var e=this.getCoordinates(),t=[],i=1;i<e.length;i++)t=t.concat(Hn(e[i-1],e[i],r,i===1));return new We.Z(t)},Tn.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(Hn(i[s-1],i[s],r,s===1));t.push(n)}),new Tn.Z(t)},Pt.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(Hn(i[s-1],i[s],r,s===1));t.push(n)}),new Pt.ZP(t)},Li.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(Hn(s[a-1],s[a],r,a===1));n.push(o)})}),new Li.Z(t)},Gr.prototype.intersection=function(r,e){if(r.sampleAt){var t=(0,C.f3)(this.getCenter().concat(this.getCenter()),this.getRadius());r=Ao(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 d=[];h.push(d),c.forEach(function(u){var g=xt(i,u);g>n?(o=!0,d.push([i[0]+n/g*(u[0]-i[0]),i[1]+n/g*(u[1]-i[1])])):d.push(u)})})}),o?r.getType()==="Polygon"?new Pt.ZP(a[0]):new Li.Z(a):r}}}else console.warn("[ol/geom/Circle~intersection] Unsupported geometry type: "+r.getType());return r},We.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(oi(r,this.getFirstCoordinate())||oi(r,this.getLastCoordinate()))return[this];var a=this.getCoordinates(),l=[a[0]],h=[];for(t=0;t<a.length-1;t++)if(!oi(a[t],a[t+1])){if(oi(r,a[t+1]))l.push(a[t+1]),h.push(new We.Z(l)),l=[];else if(!oi(r,a[t])){var c,d,u=!1;a[t][0]==a[t+1][0]?(c=(a[t][1]-r[1])/(a[t][1]-a[t+1][1]),u=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]),u=a[t][1]==r[1]&&0<c&&c<=1):(c=(a[t][0]-r[0])/(a[t][0]-a[t+1][0]),d=(a[t][1]-r[1])/(a[t][1]-a[t+1][1]),u=Math.abs(c-d)<=e&&0<c&&c<=1),u&&(l.push(r),h.push(new We.Z(l)),l=[r])}l.push(a[t+1])}return l.length>1&&h.push(new We.Z(l)),h.length?h:[this]};var Mc=class extends fe{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,pt._2)(e)}catch{this._color=[0,0,0,1]}}setColor2(e){try{this._color2=(0,pt._2)(e)}catch{this._color2=null}}setArrowColor(e){try{this._acolor=(0,pt.XC)(e)}catch{this._acolor=null}}getColor(e,t){if(this._colorFn)return(0,pt.XC)(this._colorFn(e,t));var i=this._color,n=this._color2||this._color;return"rgba("+ +Math.round(i[0]+(n[0]-i[0])*t)+","+Math.round(i[1]+(n[1]-i[1])*t)+","+Math.round(i[2]+(n[2]-i[2])*t)+","+(i[3]+(n[3]-i[3])*t)+")"}getArrow(){return this._arrow}setArrow(e){this._arrow=parseInt(e),(this._arrow<-1||this._arrow>2)&&(this._arrow=0)}getArrowSize(){return this._arrowSize||[16,16]}setArrowSize(e){Array.isArray(e)?this._arrowSize=e:typeof e=="number"&&(this._arrowSize=[e,e])}drawArrow(e,t,i,n,s){var o=this.getArrowSize()[0]*s,a=xt(t,i),l=(t[0]-i[0])/a,h=(t[1]-i[1])/a;n=Math.max(this.getArrowSize()[1]/2,n/2)*s,e.beginPath(),e.moveTo(t[0],t[1]),e.lineTo(t[0]-o*l+n*h,t[1]-o*h-n*l),e.lineTo(t[0]-o*l-n*h,t[1]-o*h+n*l),e.lineTo(t[0],t[1]),e.fill()}_render(e,t){if(t.geometry.getType()==="LineString"){var i,n,s,o=t.context;if(!this._visible){var a=t.pixelRatio/t.resolution,l=Math.cos(t.rotation),h=Math.sin(t.rotation);n=t.geometry.getCoordinates();var c=e[0][0]-n[0][0]*a*l-n[0][1]*a*h,d=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,d+s[0]*a*h-s[1]*a*l,s[2]]}var u=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,u),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,u,!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 p=f/m;for(n=g[f],o.lineWidth=this.getWidth(t.feature,p)*t.pixelRatio,o.strokeStyle=this.getColor(t.feature,p),o.beginPath(),o.moveTo(n[0][0],n[0][1]),i=1;s=n[i];i++)o.lineTo(s[0],s[1]);o.stroke()}o.restore()}}_splitAsize(e,t,i){var n,s,o,a,l=0;for(i?o=e.pop():o=e.shift(),n=o;e.length;){if(i?s=e.pop():s=e.shift(),a=xt(n,s),l+a>t){n=[n[0]+(s[0]-n[0])*(t-l)/a,n[1]+(s[1]-n[1])*(t-l)/a],a=xt(n,o),i?(e.push(s),e.push(n),e.push([n[0]+(o[0]-n[0])/a,n[1]+(o[1]-n[1])/a])):(e.unshift(s),e.unshift(n),e.unshift([n[0]+(o[0]-n[0])/a,n[1]+(o[1]-n[1])/a]));break}l+=a,n=s}return[o,n]}_splitInto(e,t,i){var n,s,o=this._noOverlap?1:.9,a=[],l,h=0;for(n=1;s=e[n];n++)h+=xt(e[n-1],s);var c=Math.max(i||2,h/(t||255)),d=e[0];h=0;var u=[d];for(n=1,s=e[1];n<e.length;){var g=s[0]-d[0],f=s[1]-d[1];if(l=Math.sqrt(g*g+f*f),h+l>c){var m=(c-h)/l;u.push([d[0]+g*m,d[1]+f*m]),a.push(u),d=[d[0]+g*m*o,d[1]+f*m*o],u=[d],h=0}else h+=l,d=s,u.push(d),n++,s=e[n]}return a.push(u),a}};const Oo=Mc;var ko=S(30697);const vi={style:k.Er,showLegend:!1,edgeStyle:k.Er,arrow:0},Bo="network",Hu={type:Bo,name:"",config:vi,location:{mode:ze.q1.Auto}},Pc={id:Bo,name:"Network",description:"Render a node graph as a map layer",isBaseMap:!1,showLocation:!0,hideOpacity:!0,state:xi.BV.beta,create:async(r,e,t,i)=>{const n={...vi,...e?.config},s=await Ut(n.style),o=await Ut(n.edgeStyle),a=await(0,Tt.cJ)(e.location),l=new nn(a),h=new Be({source:l}),c=n.arrow===1||n.arrow===-1||n.arrow===2,d=new Mn.t(1);let u=null;return n.showLegend&&(u=_.createElement(jr,{watch:d,initialSubProps:{},child:Yr})),h.setStyle(g=>{const f=g.getGeometry(),m=g.get("rowIndex"),p=s.dims;if(!s.fields&&!o.fields&&!c&&f?.getType()!=="LineString")return s.maker(s.base);if(f?.getType()==="LineString"&&f instanceof Ri.ZP){const y=o.dims,w=o.config.textConfig,b=Number(g.getId()),F=f.getCoordinates(),L=o.config.opacity??1;if(F&&y){const A=F[0],G=F[1],H=(0,de.Z)(i.visualization.getColorByName((y.color&&y.color.get(b))??o.base.color)).setAlpha(L).toString(),K=(0,de.Z)(i.visualization.getColorByName((y.color&&y.color.get(b))??o.base.color)).setAlpha(L).toString(),le=(y.size&&y.size.get(b))??o.base.size,he=(y.size&&y.size.get(b))??o.base.size,Q=[],me=new Oo({visible:!0,lineCap:n.arrow===0?"round":"square",color:H,color2:K,width:(y.size&&y.size.get(b))??o.base.size,width2:(y.size&&y.size.get(b))??o.base.size});n.arrow&&(me.setArrow(n.arrow),n.arrow>0?(me.setArrowColor(K),me.setArrowSize((he??0)*2)):(me.setArrowColor(H),me.setArrowSize((le??0)*2)));const re=new We.Z([A,G]);me.setGeometry(re);const Y=i.typography.fontFamily;if(y.text||o.config.text?.mode===ze.xy.Fixed){const Z=new fe({zIndex:10,text:new gi({text:y.text?.get(b)??o.config.text?.fixed,font:`normal ${w?.fontSize}px ${Y}`,fill:new Se({color:H??k.Er.color.fixed}),stroke:new Te({color:(0,de.Z)(i.visualization.getColorByName("text")).setAlpha(L).toString(),width:Math.max(w?.fontSize/10,1)}),...w})});Z.setGeometry(re),Q.push(Z)}return Q.push(me),Q}}if(!p||!(0,E.isNumber)(m))return s.maker(s.base);const v={...s.base};return p.color&&(v.color=p.color.get(m)),p.size&&(v.size=p.size.get(m)),p.text&&(v.text=p.text.get(m)),p.rotation&&(v.rotation=p.rotation.get(m)),s.maker(v)}),{init:()=>h,legend:u,update:g=>{if(!g.series?.length){l.clear();return}u&&d.next({styleConfig:s,size:s.dims?.size,layerName:e.name,layer:h});const f=(0,ko.E_)(g.series);for(const m of g.series)m===f.edges[0]?o.dims=(0,tt.vV)(m,o,i):s.dims=(0,tt.vV)(m,s,i),Dc(l,f)},registerOptionsUI:(g,f)=>{const m=(0,ko.E_)(f.data),p=m.nodes[0],v=m.edges[0];g.addCustomEditor({id:"config.style",category:["Node Styles"],path:"config.style",name:"Node Styles",editor:ni,settings:{displayRotation:!0,frameMatcher:y=>y===p},defaultValue:vi.style}).addCustomEditor({id:"config.edgeStyle",category:["Edge Styles"],path:"config.edgeStyle",name:"Edge Styles",editor:ni,settings:{hideSymbol:!0,frameMatcher:y=>y===v},defaultValue:vi.style}).addRadio({path:"config.arrow",name:"Arrow",settings:{options:[{label:"None",value:0},{label:"Forward",value:1},{label:"Reverse",value:-1},{label:"Both",value:2}]},defaultValue:vi.arrow}).addBooleanSwitch({path:"config.showLegend",name:"Show legend",description:"Show map legend",defaultValue:vi.showLegend})}}},defaultOptions:vi};function Dc(r,e){r.clear(!0);const t=e.nodes[0],i=e.edges[0];if(!t||!i)return;const n=(0,Tt.g6)(t,r.location);if(!n.field){r.changed();return}const s=n.field,o=t.fields.findIndex(u=>u.name==="id"),a=t.fields[o].values,l=i.fields.findIndex(u=>u.name==="source"),h=i.fields.findIndex(u=>u.name==="target"),c=i.fields[l].values,d=i.fields[h].values;for(let u=0;u<c.length;u++){const g=c[u],f=d[u],m=a.findIndex(w=>w===g),p=a.findIndex(w=>w===f);if(!s.values[m]||!s.values[p])continue;const v=new We.Z([s.values[m].getCoordinates(),s.values[p].getCoordinates()]),y=new Ke.Z({geometry:v});y.setId(u),r.addFeatureInternal(y)}for(let u=0;u<t.length;u++)r.addFeatureInternal(new Ke.Z({frameNodes:t,rowIndex:u,geometry:n.field.values[u]}));r.changed()}var zo=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 Te({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 Se({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 zo({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,d=Math.atan(6/c);e.save(),e.rotate(-d),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(d),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||window.devicePixelRatio;var t=Je.prototype.getImage.call(this,e);if((this._gethit||this.img_)&&this._currentRatio===e)return t;this._currentRatio=e;var i,n=0;this._stroke&&(i=(0,pt.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,d,u,g,f,m;this._crop?(a=Math.min(t.width/o,t.height/o),f=m=a*o,u=(t.width-f)/2,g=(t.height-m)/2,l=h=0,c=d=o+1):(a=Math.min(o/t.width,o/t.height),u=g=0,f=t.width,m=t.height,c=a*f,d=a*m,l=(o-c)/2,h=(o-d)/2),l+=s+this.sanchor_/2,h+=s,n.drawImage(t,u,g,f,m,l,h,c,d),this._kind=="circle"&&s&&(n.beginPath(),n.strokeStyle=(0,pt.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 $s=zo,Xt={kind:"square",border:2,shadow:!0,crop:!0,radius:20,color:"rgb(200, 200, 200)"},Go="photos",Ku={type:Go,name:"",config:Xt,location:{mode:ze.q1.Auto},tooltip:!0},qs="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBjbGFzcz0iY3NzLWV5eDRkbyI+PHBhdGggZD0iTTExLjI5LDE1LjI5YTEuNTgsMS41OCwwLDAsMC0uMTIuMTUuNzYuNzYsMCwwLDAtLjA5LjE4LjY0LjY0LDAsMCwwLS4wNi4xOCwxLjM2LDEuMzYsMCwwLDAsMCwuMi44NC44NCwwLDAsMCwuMDguMzguOS45LDAsMCwwLC41NC41NC45NC45NCwwLDAsMCwuNzYsMCwuOS45LDAsMCwwLC41NC0uNTRBMSwxLDAsMCwwLDEzLDE2YTEsMSwwLDAsMC0uMjktLjcxQTEsMSwwLDAsMCwxMS4yOSwxNS4yOVpNMTIsMkExMCwxMCwwLDEsMCwyMiwxMiwxMCwxMCwwLDAsMCwxMiwyWm0wLDE4YTgsOCwwLDEsMSw4LThBOCw4LDAsMCwxLDEyLDIwWk0xMiw3QTMsMywwLDAsMCw5LjQsOC41YTEsMSwwLDEsMCwxLjczLDFBMSwxLDAsMCwxLDEyLDlhMSwxLDAsMCwxLDAsMiwxLDEsMCwwLDAtMSwxdjFhMSwxLDAsMCwwLDIsMHYtLjE4QTMsMywwLDAsMCwxMiw3WiI+PC9wYXRoPjwvc3ZnPgo=",Ac="data:image/svg+xml;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==";let ln=[];const Oc={id:Go,name:"Photos",description:"Render photos at each data point",isBaseMap:!1,showLocation:!0,hideOpacity:!0,state:xi.BV.beta,create:async(r,e,t,i)=>{const n={...Xt,...e?.config},s=await(0,Tt.cJ)(e.location),o=new nn(s),a=new Be({source:o});let l=[];return a.setStyle(h=>{let c=qs,d=1/0;l.length>0&&(d=h.get("rowIndex"),c=l[d]??qs);const u=new fe({image:new $s({src:c,radius:n.radius,crop:n.crop,kind:n.kind,shadow:!1,stroke:new Te({width:0,color:"rgba(0,0,0,0)"}),onload:()=>{a.changed(),ln&&!ln.includes(d)&&ln.push(d)}})}),g=new fe({image:new $s({src:Ac,radius:n.radius,crop:!1,kind:n.kind,shadow:n.shadow,stroke:new Te({width:n.border??0,color:i.visualization.getColorByName(n.color)}),onload:()=>{a.changed()}})}),f=new fe({image:new $s({src:qs,radius:n.radius,crop:!1,kind:n.kind,shadow:!1,stroke:new Te({width:0,color:"rgba(0,0,0,0)"}),onload:()=>{a.changed()}})});return ln&&ln.includes(d)?[g,u]:[g,f,u]}),{init:()=>a,update:h=>{if(!h.series?.length){o.clear();return}for(const c of h.series){if(o.update(c),n.src){const d=(0,On.findField)(c,n.src);d&&(l=d?.values)}else for(let d=0;d<c.fields.length;d++){const u=c.fields[d];if(u.type===P.fS.string){l=u.values;break}}break}},registerOptionsUI:h=>{h.addFieldNamePicker({path:"config.src",name:"Image Source field",settings:{filter:c=>c.type===P.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:Xt.kind}).addBooleanSwitch({path:"config.crop",name:"Crop",settings:{},defaultValue:Xt.crop}).addBooleanSwitch({path:"config.shadow",name:"Shadow",settings:{},defaultValue:Xt.shadow}).addSliderInput({path:"config.border",name:"Border",settings:{min:0,max:10},defaultValue:Xt.border}).addColorPicker({path:"config.color",name:"Border color",defaultValue:Xt.color,settings:[{enableNamedColors:!1}]}).addSliderInput({path:"config.radius",name:"Radius",settings:{min:1,max:100},defaultValue:Xt.radius})}}},defaultOptions:Xt};var kc=S(63646),Bc=S(91249);const hn={style:{...k.Er,opacity:1,lineWidth:2},arrow:0},No="route",Ju={type:No,name:"",config:hn,location:{mode:ze.q1.Auto},tooltip:!1},zc={id:No,name:"Route",description:"Render data points as a route",isBaseMap:!1,showLocation:!0,state:xi.BV.beta,create:async(r,e,t,i)=>{const n={...hn,...e?.config},s=await Ut(n.style),o=await(0,Tt.cJ)(e.location),a=new nn(o),l=new Be({source:a}),h=n.arrow===1||n.arrow===-1;if(!s.fields&&!h){const p=Rs(s.base);s.config.size&&s.config.size.fixed&&p.getStroke().setWidth(s.config.size.fixed),l.setStyle(p)}else l.setStyle(p=>{const v=p.get("rowIndex"),y=s.dims;if(!y||!(0,E.isNumber)(v))return Rs(s.base);const w=[],b=p.getGeometry(),F=s.config.opacity??1;if(b instanceof Ri.ZP){const A=b.getCoordinates();if(A){let G=0;const H=2;for(let K=0;K<A.length-1;K++){const le=A[G],he=A[K+1],Q=(0,de.Z)(i.visualization.getColorByName((y.color&&y.color.get(G))??s.base.color)).setAlpha(F).toString(),me=(0,de.Z)(i.visualization.getColorByName((y.color&&y.color.get(K+1))??s.base.color)).setAlpha(F).toString(),re=(y.size&&y.size.get(G))??s.base.size,Y=(y.size&&y.size.get(K+1))??s.base.size,Z=new Oo({visible:!0,lineCap:n.arrow===0?"round":"square",color:Q,color2:me,width:(y.size&&y.size.get(G))??s.base.size,width2:(y.size&&y.size.get(K+1))??s.base.size});if(n.arrow&&(Z.setArrow(n.arrow),n.arrow>0?(Z.setArrowColor(me),Z.setArrowSize((Y??0)*1.5)):(Z.setArrowColor(Q),Z.setArrowSize((re??0)*1.5))),(0,tt.uH)(r,H,le,he)){const J=new We.Z([le,he]);Z.setGeometry(J),w.push(Z),G=K+1}}if(w.length===0){const K=new wt.Z(A[0]),le=((y.size&&y.size.get(0))??s.base.size??10)/2,he=(0,de.Z)(i.visualization.getColorByName((y.color&&y.color.get(0))??s.base.color)).setAlpha(F).toString(),Q=new fe({image:new St({radius:le,fill:new Se({color:he})})});Q.setGeometry(K),w.push(Q)}}return w}const L={...s.base};return y.color&&(L.color=y.color.get(v)),Rs(L)});const c=new Ke.Z({}),d=(s.base.lineWidth||6)+2,u=new fe({image:new St({radius:d,stroke:new Te({color:(0,Bc.alpha)(s.base.color,.4),width:d+2}),fill:new Se({color:s.base.color})})}),g=new Be({source:new _t({features:[c]}),style:u}),f=new Nn.Z({layers:[l,g]}),m=new j.w0;return m.add(t.getStream(ee.es).pipe((0,kc.p)(8)).subscribe({next:p=>{const y=a.getFeatures()[0]?.get("frame"),w=p.payload?.point?.time;if(y&&w){const b=y.fields.find(F=>F.name===P.Ls);if(b){const F=b.values,L=Gc(F,w);if(L!==null){const A=(0,Tt.g6)(y,o);A.field&&(c.setGeometry(A.field.values[L]),c.setStyle(u))}}}}})),m.add(t.subscribe(ee.xH,p=>{c.setStyle(new fe({}))})),{init:()=>f,dispose:()=>m.unsubscribe(),update:p=>{if(p.series?.length)for(const v of p.series){(s.fields||h)&&(s.dims=(0,tt.vV)(v,s,i)),a.updateLineString(v);break}},registerOptionsUI:p=>{p.addCustomEditor({id:"config.style",path:"config.style",name:"Style",editor:ni,settings:{simpleFixedValues:!1},defaultValue:hn.style}).addRadio({path:"config.arrow",name:"Arrow",settings:{options:[{label:"None",value:0},{label:"Forward",value:1},{label:"Reverse",value:-1}]},defaultValue:hn.arrow})}}},defaultOptions:hn};function Gc(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<t?n+1:t;return 0}else{for(let n=i;n<t;n++)if(e<r[n])return n>0?n-1:0;return t}}const Zo=[Vl,bc,Lc,Hh,Xh,Zh,zc,Oc,Pc],zi={type:"default",name:"",config:{}},Wo={id:zi.type,name:"Default base layer",isBaseMap:!0,create:(r,e,t,i)=>{const n=fi.config?.geomapDefaultBaseLayerConfig?.type;if(n){const s=cn.getIfExists(n);if(!s)throw new Error("Invalid basemap configuration on server");return s.create(r,fi.config.geomapDefaultBaseLayerConfig,t,i)}return fo.create(r,e,t,i)}},cn=new An.B(()=>[Wo,...Zs,...Zo]);function Uo(r,e){const t={options:[],current:[]},i=[];for(const n of r){const s={label:n.name,value:n.id,description:n.description};switch(n.state){case xi.BV.alpha:if(!fi.Oh)break;s.label=`${n.name} (Alpha)`,s.icon="bolt",i.push(s);break;case xi.BV.beta:s.label=`${n.name} (Beta)`;default:t.options.push(s)}n.id===e&&t.current.push(s)}for(const n of i)t.options.push(n);return t}function Xo(r,e){return Uo(r?[Wo,...Zs]:[...Zo,...Zs],e)}const $u={layers:[]},Vo={allLayers:!0,id:"zero",lat:0,lon:0,zoom:1};var Gi=(r=>(r.Details="details",r.None="none",r))(Gi||{}),Nc=(r=>(r.Coords="coords",r.Fit="fit",r.Zero="zero",r))(Nc||{}),Zc=S(23997),Yo=S(36085);const Qs=(r,e,t)=>{if(r.update){let i=t;if(e.filterData){const n=(0,Yo.b9)(e.filterData);i={...i,series:i.series.filter(n)}}r.update(i)}};async function Wc(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 Kn(r,r.map,t,i.isBasemap);o[n]?.handler.dispose?.(),o[n]=a,s.setAt(n,a.layer),Qs(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 Kn(r,e,t,i){i&&(!t?.type||Ve.config.geomapDisableCustomBaseLayer)&&(t=zi),t?.type||(t={type:Ls,name:(0,tt.FB)(r),config:{}});const n=cn.getIfExists(t.type);if(!n)return Promise.reject("unknown layer: "+t.type);t.config?.attribution&&(t.config.attribution=Kr.QX.sanitizeTextPanelContent(t.config.attribution));const s=await n.create(e,t,r.props.eventBus,Ve.config.theme2),o=s.init();t.opacity!=null&&o.setOpacity(t.opacity),t.name||(t.name=(0,tt.FB)(r));const a=t.name,l={isBasemap:i,options:t,layer:o,handler:s,mouseEvents:new Zc.x,getName:()=>a,onChange:h=>{Wc(r,a,h)}};return r.byName.set(a,l),l.layer.__state=l,Qs(s,t,r.props.data),l}const jo=r=>r?.__state,Uc=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=cn.getIfExists(t);i&&Kn(r,r.map,{type:i.id,name:(0,tt.FB)(r),config:(0,E.cloneDeep)(i.defaultOptions),location:i.showLocation?{mode:ze.q1.Auto}:void 0,tooltip:!0,...!i.hideOpacity&&{opacity:k.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 Xc(r=[],e=!1,t=!1,i){return r.filter(n=>n.layer instanceof Be||n.layer instanceof Nn.Z).flatMap(n=>{const s=n.layer;if(s instanceof Nn.Z)return Vc(s);if(s instanceof Be){if(e)return[s.getSource().getExtent()];if(t&&i===n.options.name){const o=s.getSource().getFeatures(),l=o[o.length-1]?.getGeometry();return l?[l.getExtent()]:[]}else if(!t&&i===n.options.name)return[s.getSource().getExtent()];return[]}else return[]}).reduce(C.l7,(0,C.lJ)())}function Vc(r){return r.getLayers().getArray().filter(e=>e instanceof Be).map(e=>e instanceof Be?e.getSource().getExtent()??[]:[])}const Yc=r=>{r.map?.on("singleclick",r.pointerClickListener),r.map?.on("pointermove",(0,E.debounce)(r.pointerMoveListener,200)),r.map?.getViewport().addEventListener("mouseout",e=>{r.props.eventBus.publish(new ee.xH)})},jc=(r,e)=>{Ho(r,e)&&(r.preventDefault(),r.stopPropagation(),e.mapDiv.style.cursor="auto",e.setState({ttipOpen:!0}))},Ho=(r,e)=>{if(e.state.measureMenuActive)return!0;if(!e.map||e.state.ttipOpen&&e.state?.ttip?.layers?.length)return!1;const t=r.originalEvent,i=e.map.getEventPixel(t),n=(0,U.bU)(e.map.getCoordinateFromPixel(i)),{hoverPayload:s}=e;s.pageX=t.pageX,s.pageY=t.pageY,s.point={lat:n[1],lon:n[0]},s.data=void 0,s.columnIndex=void 0,s.rowIndex=void 0,s.layers=void 0;const o=[],a=new Map;let l={};e.map.forEachFeatureAtPixel(i,(c,d,u)=>{const g=jo(d);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=>jo(c)?.options?.tooltip!==!1}),e.hoverPayload.layers=o.length?o:void 0,e.props.eventBus.publish(e.hoverEvent),(e.state.ttip===void 0||e.state.ttip?.layers!==s.layers||s.layers)&&e.setState({ttip:{...s}}),o.length||e.layers.forEach(c=>{c.mouseEvents.next(void 0)});const h=!!o.length;return e.mapDiv.style.cursor=h?"pointer":"auto",h};var yt=(r=>(r.Zero="zero",r.Coordinates="coords",r.Fit="fit",r))(yt||{});const un=new An.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 Ko;class Jo extends _.Component{constructor(e){super(e),this.panelContext=void 0,this.subs=new j.w0,this.globalCSS=Fl(Ve.config.theme2),this.hoverPayload={point:{},pageX:-1,pageY:-1},this.hoverEvent=new ee.es(this.hoverPayload),this.layers=[],this.byName=new Map,this.actions=Uc(this),this.initMapRef=async t=>{if(!t)return;this.mapDiv=t,this.map&&this.map.dispose();const{options:i}=this.props,n=(0,tt.n_)(this,i,t);this.byName.clear();const s=[];try{s.push(await Kn(this,n,i.basemap??zi,!0)),i.layers||(i.layers=[Fs]);for(const o of i.layers)s.push(await Kn(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 V.Z,this.map?.addInteraction(this.mouseWheelZoom),(0,tt.sA)(this,i),Yc(this),(0,tt.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=>{jc(t,this)},this.pointerMoveListener=t=>{Ho(t,this)},this.initMapView=(t,i)=>{let n=new Mt.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(ce.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 Ur&&(this.map?.removeLayer(s),this.map?.addLayer(s))}),i({...t,basemap:n[0].options,layers:n.slice(1).map(s=>s.options)}),(0,tt.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,Ko);Ko=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)Qs(i.handler,i.options,this.props.data);const t=un.getIfExists(this.props.options.view.id);if(t&&t.id===yt.Fit){const[,i]=this.initMapView(this.props.options.view);this.map&&i&&this.map.setView(i)}}initViewExtent(e,t){const i=un.getIfExists(t.id);if(i){let n;if(i.lat==null){if(i.id===yt.Coordinates)n=[t.lon??0,t.lat??0];else if(i.id===yt.Fit){const s=Xc(this.layers,t.allLayers,t.lastOnly,t.layer);if(!(0,C.xb)(s)){const o=t.padding??5,a=e.getResolutionForExtent(s,this.map?.getSize()),l=t.zoom??t.maxZoom;e.fit(s,{maxZoom:l}),e.setResolution(a*(o/100+1));const h=e.getZoom();h&&l&&h>l&&e.setZoom(l)}}}else n=[i.lon??0,i.lat??0];n&&e.setCenter((0,U.mi)(n))}t.maxZoom&&e.setMaxZoom(t.maxZoom),t.minZoom&&e.setMaxZoom(t.minZoom),t.zoom&&i?.id!==yt.Fit&&e.setZoom(t.zoom)}initControls(e){if(!this.map)return;this.map.getControls().clear(),e.showZoom&&this.map.addControl(new z.Z),e.showScale&&this.map.addControl(new B({units:e.scaleUnits,minWidth:100})),this.mouseWheelZoom.setActive(!!e.mouseWheelZoom),e.showAttribution&&this.map.addControl(new Gt.Z({collapsed:!0,collapsible:!0}));let t=[];e.showMeasure&&(t=[_.createElement(bl,{key:"measure",map:this.map,menuActiveState:n=>{this.setState({ttipOpen:n,measureMenuActive:n})}})]);let i=[];e.showDebug&&(i=[_.createElement(aa,{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(_.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===Gi.None&&(e=void 0),_.createElement(_.Fragment,null,_.createElement(je.Global,{styles:this.globalCSS}),_.createElement("div",{className:$o.wrap,onMouseLeave:this.clearTooltip},_.createElement("div",{className:$o.map,ref:this.initMapRef}),_.createElement(pe,{bottomLeft:n,topRight1:i,topRight2:s,blStyle:{bottom:a?"35px":"8px"}})),_.createElement(_n,{ttip:e,isOpen:t,onClose:this.tooltipPopupClosed}))}}Jo.contextType=ge.bb;const $o={wrap:(0,te.css)({position:"relative",width:"100%",height:"100%"}),map:(0,te.css)({position:"absolute",zIndex:0,width:"100%",height:"100%"})};var Hc=S(8807),er=S(24058),Kc=S(12190),Jc=S(93114);const $c="layer-drag-drop-list",qo=({layers:r,getLayerInfo:e,onDragEnd:t,onSelect:i,onDelete:n,onDuplicate:s,showActions:o,selection:a,excludeBaseLayer:l,onNameChange:h,verifyLayerNameUniqueness:c})=>{const d=(0,xe.wW)(qc),u=g=>g?`${d.row} ${d.sel}`:d.row;return _.createElement(er.Z5,{onDragEnd:t},_.createElement(er.bK,{droppableId:"droppable"},(g,f)=>_.createElement("div",{...g.droppableProps,ref:g.innerRef,"data-testid":$c},(()=>{const m=[],p=l?1:0,v=l?2:1;for(let y=r.length-1;y>=p;y--){const w=r[y],b=w.getName(),F=!!a?.includes(b);m.push(_.createElement(er._l,{key:b,draggableId:b,index:m.length},(L,A)=>_.createElement("div",{className:u(F),ref:L.innerRef,...L.draggableProps,...L.dragHandleProps,onMouseDown:()=>i(w),role:"button",tabIndex:0},_.createElement(Jc.X,{name:b,onChange:G=>h(w,G),verifyLayerNameUniqueness:c??void 0}),_.createElement("div",{className:d.textWrapper},"\xA0 ",e(w)),o(w)&&_.createElement(_.Fragment,null,s?_.createElement(ss.h,{name:"copy",tooltip:"Duplicate",className:d.actionIcon,onClick:()=>s(w)}):null,_.createElement(ss.h,{name:"trash-alt",tooltip:"Remove",className:(0,te.cx)(d.actionIcon,d.dragIcon),onClick:()=>n(w)})),r.length>v&&_.createElement(Kc.J,{"aria-label":"Drag and drop icon",title:"Drag and drop to reorder",name:"draggabledots",size:"lg",className:d.dragIcon}))))}return m})(),g.placeholder)))};qo.defaultProps={isGroup:()=>!1};const qc=r=>({wrapper:(0,te.css)`
    margin-bottom: ${r.spacing(2)};
  `,row:(0,te.css)`
    padding: ${r.spacing(.5,1)};
    border-radius: ${r.shape.radius.default};
    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:(0,te.css)`
    border: 1px solid ${r.colors.primary.border};
    &:hover {
      border: 1px solid ${r.colors.primary.border};
    }
  `,dragIcon:(0,te.css)`
    cursor: drag;
  `,actionIcon:(0,te.css)`
    color: ${r.colors.text.secondary};
    &:hover {
      color: ${r.colors.text};
    }
  `,typeWrapper:(0,te.css)`
    color: ${r.colors.primary.text};
    margin-right: 5px;
  `,textWrapper:(0,te.css)`
    display: flex;
    align-items: center;
    flex-grow: 1;
    overflow: hidden;
    margin-right: ${r.spacing(1)};
  `}),Qc=r=>{const{layers:e,selected:t,actions:i}=r.context.instanceState??{};if(!e||!i)return _.createElement("div",null,"No layers?");const n=c=>{if(!c.destination)return;const{layers:d,actions:u}=r.context.instanceState??{};if(!d||!u)return;const g=d.length-1,f=(c.source.index-g)*-1,m=(c.destination.index-g)*-1;u.reorder(f,m)},s=c=>{i.selectLayer(c.options.name)},o=c=>{i.deleteLayer(c.options.name)},a=c=>c.options.type,l=(c,d)=>{c.onChange({...c.options,name:d})},h=t?[e[t]?.getName()]:[];return _.createElement(_.Fragment,null,_.createElement(Ts.W2,null,_.createElement(Hc.f,{onChange:c=>i.addlayer(c.value),options:Xo(!1).options,label:"Add layer"})),_.createElement("br",null),_.createElement(qo,{layers:e,showActions:()=>e.length>2,getLayerInfo:a,onDragEnd:n,onSelect:s,onDelete:o,selection:h,excludeBaseLayer:!0,onNameChange:l,verifyLayerNameUniqueness:i.canRename}))},eu=({labelWidth:r,value:e,onChange:t})=>{const i=s=>{t({...e,lat:s})},n=s=>{t({...e,lon:s})};return _.createElement(_.Fragment,null,_.createElement(It.Z,null,_.createElement(ht._,{label:"Latitude",labelWidth:r,grow:!0},_.createElement(an.Y,{value:e.lat,min:-90,max:90,step:.001,onChange:i}))),_.createElement(It.Z,null,_.createElement(ht._,{label:"Longitude",labelWidth:r,grow:!0},_.createElement(an.Y,{value:e.lon,min:-180,max:180,step:.001,onChange:n}))))};var Qo=(r=>(r.all="all",r.layer="layer",r.last="last",r))(Qo||{}),ea=(r=>(r.all="All layers",r.layer="Layer",r.last="Last value",r))(ea||{});const tu=Object.values(Qo).map(r=>({label:ea[r],value:r})),iu=({labelWidth:r,value:e,onChange:t,context:i})=>{const n=(0,_.useMemo)(()=>i.options?.layers?i.options.layers.map(d=>({label:d.name,value:d.name,description:void 0})):[],[i.options?.layers]),s=(0,_.useCallback)(d=>{t({...e,layer:d.value})},[e,t]),o=_.createElement(It.Z,null,_.createElement(ht._,{label:"Layer",labelWidth:r,grow:!0},_.createElement(wi.Ph,{options:n,onChange:s,placeholder:n[0]?.label}))),a=d=>{t({...e,padding:d})},l=_.createElement(It.Z,null,_.createElement(ht._,{label:"Padding",labelWidth:r,grow:!0,tooltip:"sets padding in relative percent beyond data extent"},_.createElement(an.Y,{value:e?.padding??5,min:0,step:1,onChange:a}))),h=e.allLayers?"all":!e.allLayers&&e.lastOnly?"last":"layer",c=d=>{d!=="all"&&!e.layer?t({...e,allLayers:d==="all",lastOnly:d==="last",layer:n[0].value}):t({...e,allLayers:d==="all",lastOnly:d==="last"})};return _.createElement(_.Fragment,null,_.createElement(It.Z,null,_.createElement(ht._,{label:"Data",labelWidth:r,grow:!0},_.createElement(Ci.S,{value:h,options:tu,onChange:c}))),!e?.allLayers&&o,!e?.lastOnly&&l)},nu=({value:r,onChange:e,context:t})=>{const n=(0,_.useMemo)(()=>{const a=[];return r?.id?a.push(r.id):a.push(un.list()[0].id),un.selectOptions(a)},[r?.id]),s=(0,_.useCallback)(()=>{const a=t.instanceState?.map;if(a){const l=a.getView(),h=l.getCenter();if(h){const c=(0,U.bU)(h,l.getProjection());e({...r,id:yt.Coordinates,lon:+c[0].toFixed(6),lat:+c[1].toFixed(6),zoom:+l.getZoom().toFixed(2)})}}},[r,e,t.instanceState]),o=(0,_.useCallback)(a=>{const l=un.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 _.createElement(_.Fragment,null,_.createElement(It.Z,null,_.createElement(ht._,{label:"View",labelWidth:10,grow:!0},_.createElement(wi.Ph,{options:n.options,value:n.current,onChange:o}))),r.id===yt.Coordinates&&_.createElement(eu,{labelWidth:10,value:r,onChange:e}),r.id===yt.Fit&&_.createElement(iu,{labelWidth:10,value:r,onChange:e,context:t}),_.createElement(It.Z,null,_.createElement(ht._,{label:r?.id===yt.Fit?"Max Zoom":"Zoom",labelWidth:10,grow:!0},_.createElement(an.Y,{value:r?.zoom??1,min:1,max:18,step:.01,onChange:a=>{e({...r,zoom:a})}}))),_.createElement(Ts.wc,null,_.createElement(xn.zx,{variant:"secondary",size:"sm",fullWidth:!0,onClick:s},_.createElement("span",null,"Use current map settings"))))};var su=S(82247),ru=S(54519),ou=S(410);function ta(r){return{category:r.category,path:"--",defaultValue:r.basemaps?zi:Fs,values:e=>({getContext:t=>({...t,options:r.state.options,instanceState:r.state}),getValue:t=>(0,E.get)(r.state.options,t),onChange:(t,i)=>{const{state:n}=r,{options:s}=n;if(t==="type"&&i){const o=cn.getIfExists(i);if(o){const a={...s,type:o.id,config:{...o.defaultOptions}};o.showLocation&&(a.location?.mode?delete a.location:a.location={mode:ze.q1.Auto}),n.onChange(a);return}}n.onChange((0,su.hs)(s,t,i))}}),build:(e,t)=>{if(!r.state)return;const{handler:i,options:n}=r.state,s=cn.getIfExists(n?.type),o=Xo(r.basemaps,n?.type?n.type:zi.type);if(e.addSelect({path:"type",name:"Layer type",settings:{options:o.options}}),i.update&&e.addCustomEditor({id:"filterData",path:"filterData",name:"Data",editor:ou.M,defaultValue:void 0}),!!s&&n.type!==zi.type){if(s.showLocation){let a=t.data;if(n.filterData){const l=(0,Yo.b9)(n.filterData);a=a.filter(l)}(0,ru.C)("Location","location.",e,n.location,a)}i.registerOptionsUI&&i.registerOptionsUI(e,t),(0,E.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 au=S(3181),lu=S(7959),hu=S(60695);const cu=(r,e,t,i)=>{if(e==="grafana-worldmap-panel"&&t.angular){const{fieldConfig:n,options:s,xform:o}=uu({...t.angular,fieldConfig:i});return o?.id?.length&&(r.transformations=r.transformations?[...r.transformations,o]:[o]),r.fieldConfig=n,s}return{}};function uu(r){const e={defaults:{},overrides:[]},t=(0,E.cloneDeep)(Fs),i={view:{id:yt.Zero},controls:{showZoom:!0,mouseWheelZoom:!!r.mouseWheelZoom},basemap:{type:"default",name:"Basemap"},layers:[t],tooltip:{mode:Gi.Details}};let n=Ni(r.decimals);n&&(e.defaults.decimals=n);const s=t.config.style;n=Ni(r.circleMaxSize),n&&(s.size.max=n),n=Ni(r.circleMinSize),n&&(s.size.min=n);let o;const a=au.TB.getIfExists(r.valueName);if(a&&r.locationData?.length)switch(o={id:lu.W.reduce,options:{reducers:[a.id]}},r.locationData){case"countries":case"countries_3letter":t.location={mode:ze.q1.Lookup,gazetteer:"public/gazetteer/countries.json",lookup:void 0};break;case"states":t.location={mode:ze.q1.Lookup,gazetteer:"public/gazetteer/usa-states.json",lookup:void 0};break}if(r.thresholds&&r.colors){const h=r.thresholds.split(",").map(d=>Number(d.trim())),c=[];for(const d of r.colors){const u=c.length-1;u>=0?c.push({value:h[u],color:d}):c.push({value:-1/0,color:d})}e.defaults.thresholds={mode:hu.H.Absolute,steps:c}}n=Ni(r.initialZoom),n&&(i.view.zoom=n);const l={"(0\xB0, 0\xB0)":yt.Zero,"North America":"north-america",Europe:"europe","West Asia":"west-asia","SE Asia":"se-asia","Last GeoHash":yt.Coordinates};return i.view.id=l[r.mapCenter],i.view.lat=Ni(r.mapCenterLatitude),i.view.lon=Ni(r.mapCenterLongitude),{fieldConfig:e,options:i,xform:o}}function Ni(r){const e=Number(r);return isNaN(e)?void 0:e}const du=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,E.cloneDeep)(k.Er),showLegend:!!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=Ul(n.shape);return o&&(s.style.symbol={fixed:o,mode:ze.Q8.Fixed}),{...r.options,layers:[{...i,config:s}]}}}return r.options},fu=new ie.c(Jo).setNoPadding().setPanelChangeHandler(cu).setMigrationHandler(du).useFieldConfig({useCustomConfig:r=>{Ye.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:nu,defaultValue:Vo}),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:Vo.shared});const i=e.instanceState;if(i?.layers){const n=["Map layers"],s=["Basemap layer"];r.addCustomEditor({category:n,id:"layers",path:"",name:"",editor:Qc});const o=i.layers[i.selected];i.selected&&o&&r.addNestedOptions(ta({state:o,category:n,basemaps:!1}));const a=i.layers[0];Ve.config.geomapDisableCustomBaseLayer?r.addCustomEditor({category:s,id:"layers",path:"",name:"",editor:()=>_.createElement("div",null,"The basemap layer is configured by the server admin.")}):a&&r.addNestedOptions(ta({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:Gi.Details,settings:{options:[{label:"None",value:Gi.None,description:"Show contents on click, not hover"},{label:"Details",value:Gi.Details,description:"Show popup on hover"}]}})})},56949:Ft=>{"use strict";Ft.exports=Ce,Ft.exports.default=Ce;function Ce(x,T,E){E=E||2;var P=T&&T.length,M=P?T[0]*E:x.length,D=S(x,0,M,E,!0),O=[];if(!D||D.next===D.prev)return O;var W,oe,ne,Fe,Re,ye,Ge;if(P&&(D=Mt(x,T,D,E)),x.length>80*E){W=ne=x[0],oe=Fe=x[1];for(var be=E;be<M;be+=E)Re=x[be],ye=x[be+1],Re<W&&(W=Re),ye<oe&&(oe=ye),Re>ne&&(ne=Re),ye>Fe&&(Fe=ye);Ge=Math.max(ne-W,Fe-oe),Ge=Ge!==0?32767/Ge:0}return ie(D,O,E,W,oe,Ge,0),O}function S(x,T,E,P,M){var D,O;if(M===ft(x,T,E,P)>0)for(D=T;D<E;D+=P)O=Pe(D,x[D],x[D+1],O);else for(D=E-P;D>=T;D-=P)O=Pe(D,x[D],x[D+1],O);return O&&C(O,O.next)&&(He(O),O=O.next),O}function _(x,T){if(!x)return x;T||(T=x);var E=x,P;do if(P=!1,!E.steiner&&(C(E,E.next)||z(E.prev,E,E.next)===0)){if(He(E),E=T=E.prev,E===E.next)break;P=!0}else E=E.next;while(P||E!==T);return T}function ie(x,T,E,P,M,D,O){if(x){!O&&D&&ue(x,P,M,D);for(var W=x,oe,ne;x.prev!==x.next;){if(oe=x.prev,ne=x.next,D?Ye(x,P,M,D):Ve(x)){T.push(oe.i/E|0),T.push(x.i/E|0),T.push(ne.i/E|0),He(x),x=ne.next,W=ne.next;continue}if(x=ne,x===W){O?O===1?(x=te(_(x),T,E),ie(x,T,E,P,M,D,2)):O===2&&je(x,T,E,P,M,D):ie(_(x),T,E,P,M,D,1);break}}}}function Ve(x){var T=x.prev,E=x,P=x.next;if(z(T,E,P)>=0)return!1;for(var M=T.x,D=E.x,O=P.x,W=T.y,oe=E.y,ne=P.y,Fe=M<D?M<O?M:O:D<O?D:O,Re=W<oe?W<ne?W:ne:oe<ne?oe:ne,ye=M>D?M>O?M:O:D>O?D:O,Ge=W>oe?W>ne?W:ne:oe>ne?oe:ne,be=P.next;be!==T;){if(be.x>=Fe&&be.x<=ye&&be.y>=Re&&be.y<=Ge&&R(M,W,D,oe,O,ne,be.x,be.y)&&z(be.prev,be,be.next)>=0)return!1;be=be.next}return!0}function Ye(x,T,E,P){var M=x.prev,D=x,O=x.next;if(z(M,D,O)>=0)return!1;for(var W=M.x,oe=D.x,ne=O.x,Fe=M.y,Re=D.y,ye=O.y,Ge=W<oe?W<ne?W:ne:oe<ne?oe:ne,be=Fe<Re?Fe<ye?Fe:ye:Re<ye?Re:ye,ui=W>oe?W>ne?W:ne:oe>ne?oe:ne,di=Fe>Re?Fe>ye?Fe:ye:Re>ye?Re:ye,pn=ot(Ge,be,T,E,P),_n=ot(ui,di,T,E,P),de=x.prevZ,ve=x.nextZ;de&&de.z>=pn&&ve&&ve.z<=_n;){if(de.x>=Ge&&de.x<=ui&&de.y>=be&&de.y<=di&&de!==M&&de!==O&&R(W,Fe,oe,Re,ne,ye,de.x,de.y)&&z(de.prev,de,de.next)>=0||(de=de.prevZ,ve.x>=Ge&&ve.x<=ui&&ve.y>=be&&ve.y<=di&&ve!==M&&ve!==O&&R(W,Fe,oe,Re,ne,ye,ve.x,ve.y)&&z(ve.prev,ve,ve.next)>=0))return!1;ve=ve.nextZ}for(;de&&de.z>=pn;){if(de.x>=Ge&&de.x<=ui&&de.y>=be&&de.y<=di&&de!==M&&de!==O&&R(W,Fe,oe,Re,ne,ye,de.x,de.y)&&z(de.prev,de,de.next)>=0)return!1;de=de.prevZ}for(;ve&&ve.z<=_n;){if(ve.x>=Ge&&ve.x<=ui&&ve.y>=be&&ve.y<=di&&ve!==M&&ve!==O&&R(W,Fe,oe,Re,ne,ye,ve.x,ve.y)&&z(ve.prev,ve,ve.next)>=0)return!1;ve=ve.nextZ}return!0}function te(x,T,E){var P=x;do{var M=P.prev,D=P.next.next;!C(M,D)&&V(M,P,P.next,D)&&ce(M,D)&&ce(D,M)&&(T.push(M.i/E|0),T.push(P.i/E|0),T.push(D.i/E|0),He(P),He(P.next),P=x=D),P=P.next}while(P!==x);return _(P)}function je(x,T,E,P,M,D){var O=x;do{for(var W=O.next.next;W!==O.prev;){if(O.i!==W.i&&B(O,W)){var oe=pe(O,W);O=_(O,O.next),oe=_(oe,oe.next),ie(O,T,E,P,M,D,0),ie(oe,T,E,P,M,D,0);return}W=W.next}O=O.next}while(O!==x)}function Mt(x,T,E,P){var M=[],D,O,W,oe,ne;for(D=0,O=T.length;D<O;D++)W=T[D]*P,oe=D<O-1?T[D+1]*P:x.length,ne=S(x,W,oe,P,!1),ne===ne.next&&(ne.steiner=!0),M.push(I(ne));for(M.sort(Gt),D=0;D<M.length;D++)E=Me(M[D],E);return E}function Gt(x,T){return x.x-T.x}function Me(x,T){var E=Oe(x,T);if(!E)return T;var P=pe(E,x);return _(P,P.next),_(E,E.next)}function Oe(x,T){var E=T,P=x.x,M=x.y,D=-1/0,O;do{if(M<=E.y&&M>=E.next.y&&E.next.y!==E.y){var W=E.x+(M-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if(W<=P&&W>D&&(D=W,O=E.x<E.next.x?E:E.next,W===P))return O}E=E.next}while(E!==T);if(!O)return null;var oe=O,ne=O.x,Fe=O.y,Re=1/0,ye;E=O;do P>=E.x&&E.x>=ne&&P!==E.x&&R(M<Fe?P:D,M,ne,Fe,M<Fe?D:P,M,E.x,E.y)&&(ye=Math.abs(M-E.y)/(P-E.x),ce(E,x)&&(ye<Re||ye===Re&&(E.x>O.x||E.x===O.x&&U(O,E)))&&(O=E,Re=ye)),E=E.next;while(E!==oe);return O}function U(x,T){return z(x.prev,x,T.prev)<0&&z(T.next,x,x.next)<0}function ue(x,T,E,P){var M=x;do M.z===0&&(M.z=ot(M.x,M.y,T,E,P)),M.prevZ=M.prev,M.nextZ=M.next,M=M.next;while(M!==x);M.prevZ.nextZ=null,M.prevZ=null,De(M)}function De(x){var T,E,P,M,D,O,W,oe,ne=1;do{for(E=x,x=null,D=null,O=0;E;){for(O++,P=E,W=0,T=0;T<ne&&(W++,P=P.nextZ,!!P);T++);for(oe=ne;W>0||oe>0&&P;)W!==0&&(oe===0||!P||E.z<=P.z)?(M=E,E=E.nextZ,W--):(M=P,P=P.nextZ,oe--),D?D.nextZ=M:x=M,M.prevZ=D,D=M;E=P}D.nextZ=null,ne*=2}while(O>1);return x}function ot(x,T,E,P,M){return x=(x-E)*M|0,T=(T-P)*M|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,E=x;do(T.x<E.x||T.x===E.x&&T.y<E.y)&&(E=T),T=T.next;while(T!==x);return E}function R(x,T,E,P,M,D,O,W){return(M-O)*(T-W)>=(x-O)*(D-W)&&(x-O)*(P-W)>=(E-O)*(T-W)&&(E-O)*(D-W)>=(M-O)*(P-W)}function B(x,T){return x.next.i!==T.i&&x.prev.i!==T.i&&!ge(x,T)&&(ce(x,T)&&ce(T,x)&&xe(x,T)&&(z(x.prev,x,T.prev)||z(x,T.prev,T))||C(x,T)&&z(x.prev,x,x.next)>0&&z(T.prev,T,T.next)>0)}function z(x,T,E){return(T.y-x.y)*(E.x-T.x)-(T.x-x.x)*(E.y-T.y)}function C(x,T){return x.x===T.x&&x.y===T.y}function V(x,T,E,P){var M=ee(z(x,T,E)),D=ee(z(x,T,P)),O=ee(z(E,P,x)),W=ee(z(E,P,T));return!!(M!==D&&O!==W||M===0&&j(x,E,T)||D===0&&j(x,P,T)||O===0&&j(E,x,P)||W===0&&j(E,T,P))}function j(x,T,E){return T.x<=Math.max(x.x,E.x)&&T.x>=Math.min(x.x,E.x)&&T.y<=Math.max(x.y,E.y)&&T.y>=Math.min(x.y,E.y)}function ee(x){return x>0?1:x<0?-1:0}function ge(x,T){var E=x;do{if(E.i!==x.i&&E.next.i!==x.i&&E.i!==T.i&&E.next.i!==T.i&&V(E,E.next,x,T))return!0;E=E.next}while(E!==x);return!1}function ce(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 xe(x,T){var E=x,P=!1,M=(x.x+T.x)/2,D=(x.y+T.y)/2;do E.y>D!=E.next.y>D&&E.next.y!==E.y&&M<(E.next.x-E.x)*(D-E.y)/(E.next.y-E.y)+E.x&&(P=!P),E=E.next;while(E!==x);return P}function pe(x,T){var E=new $e(x.i,x.x,x.y),P=new $e(T.i,T.x,T.y),M=x.next,D=T.prev;return x.next=T,T.prev=x,E.next=M,M.prev=E,P.next=E,E.prev=P,D.next=P,P.prev=D,P}function Pe(x,T,E,P){var M=new $e(x,T,E);return P?(M.next=P.next,M.prev=P,P.next.prev=M,P.next=M):(M.prev=M,M.next=M),M}function He(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 $e(x,T,E){this.i=x,this.x=T,this.y=E,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Ce.deviation=function(x,T,E,P){var M=T&&T.length,D=M?T[0]*E:x.length,O=Math.abs(ft(x,0,D,E));if(M)for(var W=0,oe=T.length;W<oe;W++){var ne=T[W]*E,Fe=W<oe-1?T[W+1]*E:x.length;O-=Math.abs(ft(x,ne,Fe,E))}var Re=0;for(W=0;W<P.length;W+=3){var ye=P[W]*E,Ge=P[W+1]*E,be=P[W+2]*E;Re+=Math.abs((x[ye]-x[be])*(x[Ge+1]-x[ye+1])-(x[ye]-x[Ge])*(x[be+1]-x[ye+1]))}return O===0&&Re===0?0:Math.abs((Re-O)/O)};function ft(x,T,E,P){for(var M=0,D=T,O=E-P;D<E;D+=P)M+=(x[O]-x[D])*(x[D+1]+x[O+1]),O=D;return M}Ce.flatten=function(x){for(var T=x[0][0].length,E={vertices:[],holes:[],dimensions:T},P=0,M=0;M<x.length;M++){for(var D=0;D<x[M].length;D++)for(var O=0;O<T;O++)E.vertices.push(x[M][D][O]);M>0&&(P+=x[M-1].length,E.holes.push(P))}return E}},38085:function(Ft){(function(Ce,S){Ft.exports=S()})(this,function(){"use strict";function Ce(I,R,B,z,C){(function V(j,ee,ge,ce,xe){for(;ce>ge;){if(ce-ge>600){var pe=ce-ge+1,Pe=ee-ge+1,He=Math.log(pe),$e=.5*Math.exp(2*He/3),ft=.5*Math.sqrt(He*$e*(pe-$e)/pe)*(Pe-pe/2<0?-1:1),x=Math.max(ge,Math.floor(ee-Pe*$e/pe+ft)),T=Math.min(ce,Math.floor(ee+(pe-Pe)*$e/pe+ft));V(j,ee,x,T,xe)}var E=j[ee],P=ge,M=ce;for(S(j,ge,ee),xe(j[ce],E)>0&&S(j,ge,ce);P<M;){for(S(j,P,M),P++,M--;xe(j[P],E)<0;)P++;for(;xe(j[M],E)>0;)M--}xe(j[ge],E)===0?S(j,ge,M):S(j,++M,ce),M<=ee&&(ge=M+1),ee<=M&&(ce=M-1)}})(I,R,B||0,z||I.length-1,C||_)}function S(I,R,B){var z=I[R];I[R]=I[B],I[B]=z}function _(I,R){return I<R?-1:I>R?1:0}var ie=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 Ve(I,R,B){if(!B)return R.indexOf(I);for(var z=0;z<R.length;z++)if(B(I,R[z]))return z;return-1}function Ye(I,R){te(I,0,I.children.length,R,I)}function te(I,R,B,z,C){C||(C=De(null)),C.minX=1/0,C.minY=1/0,C.maxX=-1/0,C.maxY=-1/0;for(var V=R;V<B;V++){var j=I.children[V];je(C,I.leaf?z(j):j)}return C}function je(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 Mt(I,R){return I.minX-R.minX}function Gt(I,R){return I.minY-R.minY}function Me(I){return(I.maxX-I.minX)*(I.maxY-I.minY)}function Oe(I){return I.maxX-I.minX+(I.maxY-I.minY)}function U(I,R){return I.minX<=R.minX&&I.minY<=R.minY&&R.maxX<=I.maxX&&R.maxY<=I.maxY}function ue(I,R){return R.minX<=I.maxX&&R.minY<=I.maxY&&R.maxX>=I.minX&&R.maxY>=I.minY}function De(I){return{children:I,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ot(I,R,B,z,C){for(var V=[R,B];V.length;)if(!((B=V.pop())-(R=V.pop())<=z)){var j=R+Math.ceil((B-R)/z/2)*z;Ce(I,j,R,B,C),V.push(R,j,j,B)}}return ie.prototype.all=function(){return this._all(this.data,[])},ie.prototype.search=function(I){var R=this.data,B=[];if(!ue(I,R))return B;for(var z=this.toBBox,C=[];R;){for(var V=0;V<R.children.length;V++){var j=R.children[V],ee=R.leaf?z(j):j;ue(I,ee)&&(R.leaf?B.push(j):U(I,ee)?this._all(j,B):C.push(j))}R=C.pop()}return B},ie.prototype.collides=function(I){var R=this.data;if(!ue(I,R))return!1;for(var B=[];R;){for(var z=0;z<R.children.length;z++){var C=R.children[z],V=R.leaf?this.toBBox(C):C;if(ue(I,V)){if(R.leaf||U(I,V))return!0;B.push(C)}}R=B.pop()}return!1},ie.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 B=this._build(I.slice(),0,I.length-1,0);if(this.data.children.length)if(this.data.height===B.height)this._splitRoot(this.data,B);else{if(this.data.height<B.height){var z=this.data;this.data=B,B=z}this._insert(B,this.data.height-B.height-1,!0)}else this.data=B;return this},ie.prototype.insert=function(I){return I&&this._insert(I,this.data.height-1),this},ie.prototype.clear=function(){return this.data=De([]),this},ie.prototype.remove=function(I,R){if(!I)return this;for(var B,z,C,V=this.data,j=this.toBBox(I),ee=[],ge=[];V||ee.length;){if(V||(V=ee.pop(),z=ee[ee.length-1],B=ge.pop(),C=!0),V.leaf){var ce=Ve(I,V.children,R);if(ce!==-1)return V.children.splice(ce,1),ee.push(V),this._condense(ee),this}C||V.leaf||!U(V,j)?z?(B++,V=z.children[B],C=!1):V=null:(ee.push(V),ge.push(B),B=0,z=V,V=V.children[0])}return this},ie.prototype.toBBox=function(I){return I},ie.prototype.compareMinX=function(I,R){return I.minX-R.minX},ie.prototype.compareMinY=function(I,R){return I.minY-R.minY},ie.prototype.toJSON=function(){return this.data},ie.prototype.fromJSON=function(I){return this.data=I,this},ie.prototype._all=function(I,R){for(var B=[];I;)I.leaf?R.push.apply(R,I.children):B.push.apply(B,I.children),I=B.pop();return R},ie.prototype._build=function(I,R,B,z){var C,V=B-R+1,j=this._maxEntries;if(V<=j)return Ye(C=De(I.slice(R,B+1)),this.toBBox),C;z||(z=Math.ceil(Math.log(V)/Math.log(j)),j=Math.ceil(V/Math.pow(j,z-1))),(C=De([])).leaf=!1,C.height=z;var ee=Math.ceil(V/j),ge=ee*Math.ceil(Math.sqrt(j));ot(I,R,B,ge,this.compareMinX);for(var ce=R;ce<=B;ce+=ge){var xe=Math.min(ce+ge-1,B);ot(I,ce,xe,ee,this.compareMinY);for(var pe=ce;pe<=xe;pe+=ee){var Pe=Math.min(pe+ee-1,xe);C.children.push(this._build(I,pe,Pe,z-1))}}return Ye(C,this.toBBox),C},ie.prototype._chooseSubtree=function(I,R,B,z){for(;z.push(R),!R.leaf&&z.length-1!==B;){for(var C=1/0,V=1/0,j=void 0,ee=0;ee<R.children.length;ee++){var ge=R.children[ee],ce=Me(ge),xe=(pe=I,Pe=ge,(Math.max(Pe.maxX,pe.maxX)-Math.min(Pe.minX,pe.minX))*(Math.max(Pe.maxY,pe.maxY)-Math.min(Pe.minY,pe.minY))-ce);xe<V?(V=xe,C=ce<C?ce:C,j=ge):xe===V&&ce<C&&(C=ce,j=ge)}R=j||R.children[0]}var pe,Pe;return R},ie.prototype._insert=function(I,R,B){var z=B?I:this.toBBox(I),C=[],V=this._chooseSubtree(z,this.data,R,C);for(V.children.push(I),je(V,z);R>=0&&C[R].children.length>this._maxEntries;)this._split(C,R),R--;this._adjustParentBBoxes(z,C,R)},ie.prototype._split=function(I,R){var B=I[R],z=B.children.length,C=this._minEntries;this._chooseSplitAxis(B,C,z);var V=this._chooseSplitIndex(B,C,z),j=De(B.children.splice(V,B.children.length-V));j.height=B.height,j.leaf=B.leaf,Ye(B,this.toBBox),Ye(j,this.toBBox),R?I[R-1].children.push(j):this._splitRoot(B,j)},ie.prototype._splitRoot=function(I,R){this.data=De([I,R]),this.data.height=I.height+1,this.data.leaf=!1,Ye(this.data,this.toBBox)},ie.prototype._chooseSplitIndex=function(I,R,B){for(var z,C,V,j,ee,ge,ce,xe=1/0,pe=1/0,Pe=R;Pe<=B-R;Pe++){var He=te(I,0,Pe,this.toBBox),$e=te(I,Pe,B,this.toBBox),ft=(C=He,V=$e,j=void 0,ee=void 0,ge=void 0,ce=void 0,j=Math.max(C.minX,V.minX),ee=Math.max(C.minY,V.minY),ge=Math.min(C.maxX,V.maxX),ce=Math.min(C.maxY,V.maxY),Math.max(0,ge-j)*Math.max(0,ce-ee)),x=Me(He)+Me($e);ft<xe?(xe=ft,z=Pe,pe=x<pe?x:pe):ft===xe&&x<pe&&(pe=x,z=Pe)}return z||B-R},ie.prototype._chooseSplitAxis=function(I,R,B){var z=I.leaf?this.compareMinX:Mt,C=I.leaf?this.compareMinY:Gt;this._allDistMargin(I,R,B,z)<this._allDistMargin(I,R,B,C)&&I.children.sort(z)},ie.prototype._allDistMargin=function(I,R,B,z){I.children.sort(z);for(var C=this.toBBox,V=te(I,0,R,C),j=te(I,B-R,B,C),ee=Oe(V)+Oe(j),ge=R;ge<B-R;ge++){var ce=I.children[ge];je(V,I.leaf?C(ce):ce),ee+=Oe(V)}for(var xe=B-R-1;xe>=R;xe--){var pe=I.children[xe];je(j,I.leaf?C(pe):pe),ee+=Oe(j)}return ee},ie.prototype._adjustParentBBoxes=function(I,R,B){for(var z=B;z>=0;z--)je(R[z],I)},ie.prototype._condense=function(I){for(var R=I.length-1,B=void 0;R>=0;R--)I[R].children.length===0?R>0?(B=I[R-1].children).splice(B.indexOf(I[R]),1):this.clear():Ye(I[R],this.toBBox)},ie})}}]);

//# sourceMappingURL=5005.644327d3fbfe48144ec6.js.map