View File Name : 9320.c403e78b78aa6df1d0bd.js
")}return l.push(this.createStepText(o,e,!0,t,i)),(this.scaleBarText_?`
`+s+"
":"")+l.join("")}createMarker(e){return`
`}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`
`+a+"
"}getScaleForResolution(){const e=(0,X.hO)(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 z=A;var G=C(69186),T=C(70915),j=C(88751),K=C(64423),ee=C(69129),ge=C(79041),ce=C(28444),ye=C(40845);const _e=({topRight1:r,topRight2:e,bottomLeft:t,blStyle:i})=>{const n=(r&&r.length>0)??!1,s=(0,ye.of)(Fe(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))},Fe=r=>e=>({overlay:(0,ie.css)({position:"absolute",width:"100%",height:"100%",zIndex:500,pointerEvents:"none"}),TR1:(0,ie.css)({right:"0.5em",pointerEvents:"auto",position:"absolute",top:"0.5em"}),TR2:(0,ie.css)({position:"absolute",top:r?"80px":"8px",right:"8px",pointerEvents:"auto"}),BL:(0,ie.css)({position:"absolute",bottom:"8px",left:"8px",pointerEvents:"auto"})});var je=C(80279),He=C(82148),gt=C(17464),x=C(69503),S=C(25469),E=C(2543),F=C(11261),M=C(28240),O=C(40980),k=C(82762),W=C(61994),oe=C(33948),ne=C(1819);const Me=({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.f([n])}return _.createElement(ne.e,{data:e,rowIndex:t})},Ae=({layers:r,activeTabIndex:e})=>{const t=(0,ye.of)(We),[i,n]=(0,_.useState)(new Map),s=(o,a)=>{n(new Map(i.set(o,a)))};return _.createElement(O.J,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(k.S,{key:c,collapsible:!0,label:ve(l,h),isOpen:i.get(c),onToggle:()=>{s(c,!i.get(c))},className:t.collapsibleRow},_.createElement(Me,{feature:l})):_.createElement(Me,{key:c,feature:l})})))))},ve=(r,e)=>{const t=["Name","name","Title","ID","id"];let i=r.getProperties(),n="";const s=r.get("frame");if(s){const o=r.get("rowIndex");for(const a of s.fields)if(a.type===F.PU.string){const l=(0,M.Ct)(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.A)(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.A)(a))}return`Match: ${e+1}`},We=r=>({collapsibleRow:(0,ie.css)`
margin-bottom: 0;
`});var be=C(63021),ui=C(40675);const di=({layers:r,setActiveTabIndex:e,activeTabIndex:t})=>_.createElement(be.U,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)}}))),_n=({layers:r,onClose:e,isOpen:t})=>{const[i,n]=(0,_.useState)(0);return r?_.createElement(_.Fragment,null,t&&_.createElement(S.J,{style:{zIndex:1},onClick:e}),_.createElement(di,{layers:r,setActiveTabIndex:n,activeTabIndex:i}),_.createElement(Ae,{layers:r,activeTabIndex:i})):null},xn=({ttip:r,onClose:e,isOpen:t})=>{const i=(0,_.createRef)(),{overlayProps:n}=(0,He.e)({onClose:e,isDismissable:!0,isOpen:t},i),{dialogProps:s}=(0,je.s)({},i);return _.createElement(_.Fragment,null,r&&r.layers&&_.createElement(gt.ZL,null,_.createElement(x.o,{position:{x:r.pageX,y:r.pageY},offset:{x:10,y:10},allowPointerEvents:!0},_.createElement("section",{ref:i,...n,...s},_.createElement(_n,{layers:r.layers,isOpen:t,onClose:e})))))};var de=C(84140),Ee=C(13544),fi=C(2913);class ha extends _.PureComponent{constructor(e){super(e),this.style=ca(fi.$W.theme2),this.updateViewState=()=>{const t=this.props.map.getView();this.setState({zoom:t.getZoom(),center:(0,X.pd)(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":Ee.Tp.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 ca=r=>({infoWrap:(0,ie.css)({color:r.colors.text.primary,background:(0,de.A)(r.components.panel.background).setAlpha(.7).toString(),borderRadius:r.shape.radius.default,padding:r.spacing(1)})});var wi=C(94354),yn=C(55852),Ti=C(88323),ss=C(29158),mt=C(83195);const Ke=[{value:"length",label:"Length",geometry:"LineString",units:[{label:"Metric (m/km)",value:"m",format:r=>(0,mt.j_)("lengthm")(r)},{label:"Feet (ft)",value:"ft",format:r=>(0,mt.j_)("lengthft")(r*3.28084)},{label:"Miles (mi)",value:"mi",format:r=>(0,mt.j_)("lengthmi")(r/1609)},{label:"Nautical miles (nmi)",value:"nmi",format:r=>(0,mt.j_)("nmi")(r/1852)}],getUnit:r=>{const e=Ke[0].units;return r?.endsWith("2")&&(r=r.substring(0,r.length-1)),e.find(t=>t.value===r)??e[0]}},{value:"area",label:"Area",geometry:"Polygon",units:[{label:"Square Meters (m\xB2)",value:"m2",format:r=>(0,mt.j_)("areaM2")(r)},{label:"Square Kilometers (km\xB2)",value:"km2",format:r=>(0,mt.G8)("km\xB2")(r*1e-6)},{label:"Square Feet (ft\xB2)",value:"ft2",format:r=>(0,mt.j_)("areaF2")(r*10.76391)},{label:"Square Miles (mi\xB2)",value:"mi2",format:r=>(0,mt.j_)("areaMI2")(r*3861e-10)},{label:"Acres",value:"acre2",format:r=>(0,mt.G8)("acre")(r*247105e-9)},{label:"Hectare",value:"hectare2",format:r=>(0,mt.G8)("ha")(r*1e-4)}],getUnit:r=>{const e=Ke[1].units;return r?.endsWith("2")||(r+="2"),e.find(t=>t.value===r)??e[0]}}];var Lt=C(71064),ze=C(11217),Tt=C(44294),rs=C(50071),vn=C(32135),En=C(1685),st=C(6837),Ue=C(86717),pt=C(73445),lr=C(21409),hr=C(35341),$=C(4087),Zi=C(43530);class ua{constructor(e){this.rbush_=new hr(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,$.v6)(t)]=i}load(e,t){const i=new Array(t.length);for(let n=0,s=t.length;n
0,6),(0,ue.v)(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),69);const l=e.src!==void 0?Se.IDLE:Se.LOADED;if(this.color_=e.color!==void 0?(0,_t._j)(e.color):null,this.iconImage_=_a(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 f=this.iconImage_.getSize();this.setScale(pr(f[0],f[1],e.width,e.height))};this.listenImageChange(u);return}}h!==void 0&&this.setScale(pr(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 ms({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()==Se.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()==Se.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(st.A.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(st.A.CHANGE,e)}}const wn=ms,xa="#333";class ps{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.scaleArray_=(0,ht.xq)(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 Ie({color:xa}),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 ps({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,ht.xq)(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=ps;function _r(r){return new fe({fill:Ki(r,""),stroke:Ji(r,""),text:ya(r),image:va(r)})}function Ki(r,e){const t=r[e+"fill-color"];if(t)return new Ie({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 ya(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 va(r){const e=r["icon-src"],t=r["icon-img"];if(e||t)return new wn({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 Ze({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 Ct({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 xr={RENDER_ORDER:"renderOrder"};class Ea extends cr.A{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(xr.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 hr(9)),this.getRenderer().renderDeclutter(e)}setRenderOrder(e){this.set(xr.RENDER_ORDER,e)}setStyle(e){let t;if(e===void 0)t=fa;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;sa&&(this.instructions.push([re.CUSTOM,a,h,e,i,Kt.n2]),this.hitDetectionInstructions.push([re.CUSTOM,a,h,e,n||i,Kt.n2]));break;case"Point":l=e.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([re.CUSTOM,a,h,e,i]),this.hitDetectionInstructions.push([re.CUSTOM,a,h,e,n||i]);break;default:}this.endGeometry(t)}beginGeometry(e,t){this.beginGeometryInstruction1_=[re.BEGIN_GEOMETRY,t,0,e],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[re.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;tthis.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=[re.SET_FILL_STYLE,t];return typeof t!="string"&&i.push(!0),i}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[re.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,$e.aI)(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=[re.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=(0,T.o8)(this.maxExtent),this.maxLineWidth>0)){const e=this.resolution*(this.maxLineWidth+1)/2;(0,T.r)(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}const qi=Ca;class Sa 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([re.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([re.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([re.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([re.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 Ia=Sa;class Ra 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=[re.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([re.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,V.Oq,V.vk],mi);const o=e.getFlatCoordinates(),a=e.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(Ht),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([re.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=r){const g=(r-a+f)/f,m=(0,xe.Cc)(h,d,g),p=(0,xe.Cc)(c,u,g);l.push(m,p),s.push(l),l=[m,p],a==r&&(o+=n),a=0}else if(a0&&s.push(l),s}function Fa(r,e,t,i,n){let s=t,o=t,a=0,l=0,h=t,c,d,u,f,g,m,p,v,y,w;for(d=t;dr&&(l>a&&(a=l,s=h,o=d),l=0,h=d-n)),u=f,p=y,v=w),g=R,m=L}return l+=f,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 Da 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,T.HY)(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{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 f=s.padding;if(f!=V.Tq&&(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),f=[p,v,y,w]}const g=this.pixelRatio;this.instructions.push([re.DRAW_IMAGE,a,u,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,f==V.Tq?V.Tq:f.map(function(p){return p*g}),!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const m=1/g;this.hitDetectionInstructions.push([re.DRAW_IMAGE,a,u,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[m,m],NaN,void 0,this.declutterImageWithText_,f,!!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||V.MY,justify:t.justify,textBaseline:t.textBaseline||V.M8,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([re.DRAW_CHARS,e,t,h,n.overflow,a,n.maxAngle,l,c,s,u*l,d,o,1]),this.hitDetectionInstructions.push([re.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=Mt(o.getColor()||V.qY)):(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 g=a.getLineDash(),m=a.getLineDashOffset(),p=a.getWidth(),v=a.getMiterLimit();s.lineCap=a.getLineCap()||V._m,s.lineDash=g?g.slice():V.Oq,s.lineDashOffset=m===void 0?V.vk:m,s.lineJoin=a.getLineJoin()||V._K,s.lineWidth=p===void 0?V.aq:p,s.miterLimit=v===void 0?V.eL:v,s.strokeStyle=Mt(a.getColor()||V.NT)}i=this.textState_;const l=e.getFont()||V.ZV;(0,V.fZ)(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()||V.M8,i.backgroundFill=e.getBackgroundFill(),i.backgroundStroke=e.getBackgroundStroke(),i.padding=e.getPadding()||V.Tq,i.scale=h===void 0?[1,1]:h;const c=e.getOffsetX(),d=e.getOffsetY(),u=e.getRotateWithView(),f=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_=f===void 0?0:f,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:(0,$.v6)(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,$.v6)(n.fillStyle):""}this.declutterImageWithText_=t}}const Pa={Circle:Er,Default:qi,Image:Ia,LineString:Aa,Polygon:Er,Text:Da};class Oa{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=Pa[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[t]=s}return s}}const wr=Oa;var xs=C(11854);class ka extends xs.A{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.declutterExecutorGroup=null}getFeatures(e){return(0,$.b0)()}getData(e){return null}prepareFrame(e){return(0,$.b0)()}renderFrame(e,t){return(0,$.b0)()}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()===Se.LOADED&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Se.LOADED&&t!=Se.ERROR&&e.addEventListener(st.A.CHANGE,this.boundHandleImageChange_),t==Se.IDLE&&(e.load(),t=e.getState()),t==Se.LOADED}renderIfReadyAndVisible(){const e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}const Tr=ka;var Cn=C(9960),Jt=C(83984),te=C(9703);const Cr=[];let Ci=null;function Ba(){Ci=(0,Ge.Y)(1,1,void 0,{willReadFrequently:!0})}class za extends Tr{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=(0,te.vt)(),this.pixelTransform=(0,te.vt)(),this.inversePixelTransform=(0,te.vt)(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(e,t,i){Ci||Ba(),Ci.clearRect(0,0,1,1);let n;try{Ci.drawImage(e,t,i,1,1,0,0,1,1),n=Ci.getImageData(0,0,1,1).data}catch{return Ci=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,$e.aI)((0,_t._j)(e.style.backgroundColor),(0,_t._j)(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,Ge.Y)();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,T.Py)(i),s=(0,T.WU)(i),o=(0,T.k_)(i),a=(0,T.R)(i);(0,te.Bb)(t.coordinateToPixelTransform,n),(0,te.Bb)(t.coordinateToPixelTransform,s),(0,te.Bb)(t.coordinateToPixelTransform,o),(0,te.Bb)(t.coordinateToPixelTransform,a);const l=this.inversePixelTransform;(0,te.Bb)(l,n),(0,te.Bb)(l,s),(0,te.Bb)(l,o),(0,te.Bb)(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 Cn.A(e,this.inversePixelTransform,i,t);n.dispatchEvent(s)}}preRender(e,t){this.frameState=t,this.dispatchRenderEvent_(Jt.A.PRERENDER,e,t)}postRender(e,t){this.dispatchRenderEvent_(Jt.A.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,f=-e[1];return(0,te.Zz)(this.tempTransform,l,h,c,d,-i,u,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}const Sr=za;var pi=C(87622);function Ga(r,e,t,i,n,s,o,a,l,h,c,d){let u=r[e],f=r[e+1],g=0,m=0,p=0,v=0;function y(){g=u,m=f,e+=i,u=r[e],f=r[e+1],v+=p,p=Math.sqrt((u-g)*(u-g)+(f-m)*(f-m))}do y();while(eY[2]}else he=R>Z;const le=Math.PI,Q=[],me=D+i===e;e=D,p=0,v=b,u=r[e],f=r[e+1];let J;if(me){y(),J=Math.atan2(f-m,u-g),he&&(J+=J>0?-le:le);const Y=(Z+R)/2,U=(q+L)/2;return Q[0]=[Y,U,(N-s)/2,J,n],Q}n=n.replace(/\n/g," ");for(let Y=0,U=n.length;Y0?-le:le),J!==void 0){let Ce=H-J;if(Ce+=Ce>le?-2*le:Ce<-le?2*le:0,Math.abs(Ce)>o)return null}J=H;const pe=Y;let we=0;for(;Y0&&r.push(`
`,""),r.push(e,""),r}class Ya{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,te.vt)(),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]:Rr(Array.isArray(e)?e[0]:e,l.textAlign||V.MY),f=n&&o.lineWidth?o.lineWidth:0,g=d?e:e.split(`
`).reduce(Ua,[]),{width:m,height:p,widths:v,heights:y,lineWidths:w}=(0,V.jT)(l,g),R=m+f,L=[],D=(R+2)*c[0],b=(p+f)*c[1],N={width:D<0?Math.floor(D):Math.ceil(D),height:b<0?Math.floor(b):Math.ceil(b),contextInstructions:L};(c[0]!=1||c[1]!=1)&&L.push("scale",c),n&&(L.push("strokeStyle",o.strokeStyle),L.push("lineWidth",f),L.push("lineCap",o.lineCap),L.push("lineJoin",o.lineJoin),L.push("miterLimit",o.miterLimit),L.push("setLineDash",[o.lineDash]),L.push("lineDashOffset",o.lineDashOffset)),i&&L.push("fillStyle",a.fillStyle),L.push("textBaseline","middle"),L.push("textAlign","center");const Z=.5-u;let q=u*R+Z*f;const he=[],le=[];let Q=0,me=0,J=0,Y=0,U;for(let H=0,pe=g.length;He?e-h:s,R=o+c>t?t-c:o,L=g[3]+w*u[0]+g[1],D=g[0]+R*u[1]+g[2],b=v-g[3],N=y-g[0];(m||d!==0)&&($t[0]=b,qt[0]=b,$t[1]=N,zt[1]=N,zt[0]=b+L,Gt[0]=zt[0],Gt[1]=N+D,qt[1]=Gt[1]);let Z;return d!==0?(Z=(0,te.Zz)((0,te.vt)(),i,n,1,1,d,-i,-n),(0,te.Bb)(Z,$t),(0,te.Bb)(Z,zt),(0,te.Bb)(Z,Gt),(0,te.Bb)(Z,qt),(0,T.N)(Math.min($t[0],zt[0],Gt[0],qt[0]),Math.min($t[1],zt[1],Gt[1],qt[1]),Math.max($t[0],zt[0],Gt[0],qt[0]),Math.max($t[1],zt[1],Gt[1],qt[1]),Si)):(0,T.N)(Math.min(b,b+L),Math.min(N,N+D),Math.max(b,b+L),Math.max(N,N+D),Si),f&&(v=Math.round(v),y=Math.round(y)),{drawImageX:v,drawImageY:y,drawImageW:w,drawImageH:R,originX:h,originY:c,declutterBox:{minX:Si[0],minY:Si[1],maxX:Si[2],maxY:Si[3],value:p},canvasTransform:Z,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,$t,zt,Gt,qt,o,a),(0,V.Jw)(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,te.Bb)(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=Rr(Array.isArray(e)?e[0]:e,s.textAlign||V.MY),c=Qi[s.textBaseline||V.M8],d=a&&a.lineWidth?a.lineWidth:0,u=o.width/l-2*s.scale[0],f=h*u+2*(.5-h)*d,g=c*o.height/l+2*(.5-c)*d;return{label:o,anchorX:f,anchorY:g}}execute_(e,t,i,n,s,o,a,l){let h;this.pixelCoordinates_&&(0,$e.aI)(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=(0,pi.Rc)(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),(0,te.k3)(this.renderedTransform_,i));let c=0;const d=n.length;let u=0,f,g,m,p,v,y,w,R,L,D,b,N,Z=0,q=0,he=null,le=null;const Q=this.coordinateCache_,me=this.viewRotation_,J=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,Y={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:me},U=this.instructions!=n||this.overlaps?0:200;let H,pe,we,ke;for(;cU&&(this.fill_(e),Z=0),q>U&&(e.stroke(),q=0),!Z&&!q&&(e.beginPath(),p=NaN,v=NaN),++c;break;case re.CIRCLE:u=B[1];const Ce=h[u],Le=h[u+1],ri=h[u+2],kt=h[u+3],Ve=ri-Ce,Yt=kt-Le,Wi=Math.sqrt(Ve*Ve+Yt*Yt);e.moveTo(Ce+Wi,Le),e.arc(Ce,Le,Wi,0,2*Math.PI,!0),++c;break;case re.CLOSE_PATH:e.closePath(),++c;break;case re.CUSTOM:u=B[1],f=B[2];const Jn=B[3],Ui=B[4],$n=B.length==6?B[5]:void 0;Y.geometry=Jn,Y.feature=H,c in Q||(Q[c]=[]);const oi=Q[c];$n?$n(h,u,f,2,oi):(oi[0]=h[u],oi[1]=h[u+1],oi.length=2),Ui(oi,Y),++c;break;case re.DRAW_IMAGE:u=B[1],f=B[2],R=B[3],g=B[4],m=B[5];let fn=B[6];const ai=B[7],qn=B[8],Qn=B[9],es=B[10];let Yi=B[11];const sr=B[12];let ot=B[13];const vt=B[14],bt=B[15];if(!R&&B.length>=20){L=B[19],D=B[20],b=B[21],N=B[22];const dt=this.drawLabelWithPointPlacement_(L,D,b,N);R=dt.label,B[3]=R;const ji=B[23];g=(dt.anchorX-ji)*this.pixelRatio,B[4]=g;const Et=B[24];m=(dt.anchorY-Et)*this.pixelRatio,B[5]=m,fn=R.height,B[6]=fn,ot=R.width,B[13]=ot}let Xt;B.length>25&&(Xt=B[25]);let Xi,Ei,li;B.length>17?(Xi=B[16],Ei=B[17],li=B[18]):(Xi=V.Tq,Ei=!1,li=!1),es&&J?Yi+=me:!es&&!J&&(Yi-=me);let Vi=0;for(;u0){if(!o||f!=="Image"&&f!=="Text"||o.includes(L)){const q=(u[N]-3)/4,he=n-q%a,le=n-(q/a|0),Q=s(L,D,he*he+le*le);if(Q)return Q}c.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort($e.V_);let p,v,y,w,R;for(p=m.length-1;p>=0;--p){const L=m[p].toString();for(y=this.executorsByZIndex_[L],v=ys.length-1;v>=0;--v)if(f=ys[v],w=y[f],w!==void 0&&(R=w.executeHitDetection(c,l,i,g,d),R))return R}}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.Rc)(a,0,8,2,e,a),a}isEmpty(){return(0,Zi.p)(this.executorsByZIndex_)}execute(e,t,i,n,s,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort($e.V_),this.maxExtent_&&(e.save(),this.clip(e,i)),o=o||ys;let h,c,d,u,f,g;for(a&&l.reverse(),h=0,c=l.length;ht)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;sd*this.pixelRatio_),lineDashOffset:(o||V.vk)*this.pixelRatio_,lineJoin:a!==void 0?a:V._K,lineWidth:(l!==void 0?l:V.aq)*this.pixelRatio_,miterLimit:h!==void 0?h:V.eL,strokeStyle:Mt(i||V.NT)}}}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 f=t.getColor();this.textFillState_={fillStyle:Mt(f||V.qY)}}const i=e.getStroke();if(!i)this.textStrokeState_=null;else{const f=i.getColor(),g=i.getLineCap(),m=i.getLineDash(),p=i.getLineDashOffset(),v=i.getLineJoin(),y=i.getWidth(),w=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:V._m,lineDash:m||V.Oq,lineDashOffset:p||V.vk,lineJoin:v!==void 0?v:V._K,lineWidth:y!==void 0?y:V.aq,miterLimit:w!==void 0?w:V.eL,strokeStyle:Mt(f||V.NT)}}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:V.ZV,textAlign:d!==void 0?d:V.MY,textBaseline:u!==void 0?u:V.M8},this.text_=c!==void 0?Array.isArray(c)?c.reduce((f,g,m)=>f+=m%2?" ":g,""):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 Ha=Za,Ft=.5;function Ka(r,e,t,i,n,s,o){const a=r[0]*Ft,l=r[1]*Ft,h=(0,Ge.Y)(a,l);h.imageSmoothingEnabled=!1;const c=h.canvas,d=new Ha(h,Ft,n,null,o),u=t.length,f=Math.floor((256*256*256-1)/u),g={};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 L=(p*f).toString(16).padStart(7,"#00000");for(let D=0,b=w.length;D{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=[this.context.canvas.width,this.context.canvas.height];(0,te.Bb)(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]*Ft,u=i[1]*Ft;c.push(this.getRenderTransform(n,s,o,Ft,d,u,0).slice());const f=h.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!(0,T.ms)(g,l)){let m=l[0];const p=(0,T.RG)(g);let v=0,y;for(;mg[2];)++v,y=p*v,c.push(this.getRenderTransform(n,s,o,Ft,d,u,y).slice()),m-=p}this.hitDetectionImageData_=Ka(i,c,this.renderedFeatures_,h.getStyleFunction(),l,s,o)}t(Ja(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(f,g,m){const p=(0,$.v6)(f),v=h[p];if(v){if(v!==!0&&md=f.forEachFeatureAtCoordinate(e,o,a,i,c,f===this.declutterExecutorGroup&&t.declutterTree?t.declutterTree.all().map(g=>g.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.A.ANIMATING],s=e.viewHints[Ii.A.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,f=t.getRevision(),g=t.getRenderBuffer();let m=t.getRenderOrder();m===void 0&&(m=qa);const p=h.center.slice(),v=(0,T.r)(l,g*d),y=v.slice(),w=[v.slice()],R=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!(0,T.ms)(R,e.extent)){const Y=(0,T.RG)(R),U=Math.max((0,T.RG)(v)/2,Y);v[0]=R[0]-U,v[2]=R[2]+U,(0,Ye.Li)(p,c);const H=(0,T.Li)(w[0],c);H[0]R[0]&&H[2]>R[2]&&w.push([H[0]-Y,H[1],H[2]-Y,H[3]])}if(this.ready&&this.renderedResolution_==d&&this.renderedRevision_==f&&this.renderedRenderOrder_==m&&(0,T.ms)(this.wrappedRenderedExtent_,v))return(0,$e.aI)(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const L=new wr(Es(d,u),v,d,u);let D;this.getLayer().getDeclutter()&&(D=new wr(Es(d,u),v,d,u));const b=(0,X.Tf)();let N;if(b){for(let Y=0,U=w.length;Y{let U;const H=Y.getStyleFunction()||t.getStyleFunction();if(H&&(U=H(Y,d)),U){const pe=this.renderFeature(Y,Z,U,L,N,D);q=q&&!pe}},le=(0,X.JR)(v,c),Q=i.getFeaturesInExtent(le);m&&Q.sort(m);for(let Y=0,U=Q.length;Y=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 kr(r,e){return function(t,i,n,s,o){const a=this;ml(r,e,t,i,n,function(l,h){a.addFeatures(l),s!==void 0&&s(l)},o||en.tV)}}function Ru(r){Or=r}class Qt extends En.Ay{constructor(e,t,i){super(e),this.feature=t,this.features=i}}class pl extends Dr{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.tV,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.v)(this.format_,7),this.loader_=kr(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.A(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,$.v6)(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 Qt(Xe.ADDFEATURE,e))}setupChangeEvents_(e,t){this.featureChangeKeys_[e]=[(0,Je.KT)(t,st.A.CHANGE,this.handleFeatureChange_,this),(0,Je.KT)(t,dl.A.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.v)(!(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{t||(t=!0,this.addFeature(i.element),t=!1)}),e.addEventListener(vn.A.REMOVE,i=>{t||(t=!0,this.removeFeature(i.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(const i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(Je.JH);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 Qt(Xe.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,Zi.p)(this.nullGeometryFeatures_)||(0,$e.X$)(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,T.QJ)(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.rT,this.featuresRtree_.forEachInExtent(l,function(h){if(t(h)){const c=h.getGeometry(),d=a;if(a=c.closestPointXY(i,n,o,a),a{--this.loadingExtentsCount_,this.dispatchEvent(new Qt(Xe.FEATURESLOADEND,void 0,c))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Qt(Xe.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,T.aI)(n.extent,e))return i=n,!0}),i&&t.remove(i)}removeFeature(e){if(!e)return;const t=(0,$.v6)(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,$.v6)(e),i=this.featureChangeKeys_[t];if(!i)return;i.forEach(Je.JH),delete this.featureChangeKeys_[t];const n=e.getId();return n!==void 0&&delete this.idIndex_[n.toString()],delete this.uidIndex_[t],this.dispatchEvent(new Qt(Xe.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.v)(this.format_,7),this.url_=e,this.setLoader(kr(e,this.format_))}}const ct=pl;var Nt=C(58704);const Br=0,tn=1,zr=[0,0,0,0],Ai=[],ws={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"};class Ts extends En.Ay{constructor(e,t,i){super(e),this.features=t,this.mapBrowserEvent=i}}class _l extends lr.A{constructor(e){super(e),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=e.condition?e.condition:Nt.fs,this.defaultDeleteCondition_=function(i){return(0,Nt.Js)(i)&&(0,Nt.t5)(i)},this.deleteCondition_=e.deleteCondition?e.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:Nt.Gk,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 Oe({source:new ct({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:yl(),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.A(this.source_.getFeatures()),this.source_.addEventListener(Xe.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(Xe.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(vn.A.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(vn.A.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(st.A.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(e,t){if(!this.featuresBeingModified_){this.featuresBeingModified_=new rs.A;const i=this.featuresBeingModified_.getArray();for(let n=0,s=t.length;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=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,T.dP)(s),o);let l=n;const h=(0,X.Tf)();if(h){const c=e.map.getView().getProjection();l=l.clone().transform(h,c),l=(0,Lt.nD)(l).transform(c,h)}this.rBush_.update(l.getExtent(),a)}else this.rBush_.update((0,T.Tr)(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new Ts(ws.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 Gr(n,h,s)-Gr(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 Tt.A((0,X.te)(u.getCoordinates(),s)));const f=u||c.getGeometry();if(f.getType()==="Point"&&c instanceof Ue.A&&this.features_.getArray().includes(c)){l=f;const g=c.getGeometry().getFlatCoordinates().slice(0,2);a=[{feature:c,geometry:l,segment:[g,g]}]}return!0},{layerFilter:h})}if(!a){const h=(0,X.SD)((0,T.dP)(n,zr),s),c=t.getView().getResolution()*this.pixelTolerance_,d=(0,X.JR)((0,T.r)(h,c,zr),s);a=this.rBush_.getInExtent(d)}if(a&&a.length>0){const h=a.sort(o)[0],c=h.segment;let d=Nr(n,h,s);const u=t.getPixelFromCoordinate(d);let f=(0,Ye.Io)(e,u);if(l||f<=this.pixelTolerance_){const g={};if(g[(0,$.v6)(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,Ye.hG)(u,m),y=(0,Ye.hG)(u,p);f=Math.sqrt(Math.min(v,y)),this.snappedToVertex_=f<=this.pixelTolerance_,this.snappedToVertex_&&(d=v>y?c[1]:c[0]),this.createOrUpdateVertexFeature_(d,[h.feature],[h.geometry]);const w={};w[(0,$.v6)(h.geometry)]=!0;for(let R=1,L=a.length;R=0;--l)o=e[l],f=o[0],g=(0,$.v6)(f.feature),f.depth&&(g+="-"+f.depth.join("-")),g in t||(t[g]={}),o[1]===0?(t[g].right=f,t[g].index=f.index):o[1]==1&&(t[g].left=f,t[g].index=f.index+1);for(g in t){switch(u=t[g].right,c=t[g].left,h=t[g].index,d=h-1,c!==void 0?f=c:f=u,d<0&&(d=0),a=f.geometry,s=a.getCoordinates(),n=s,i=!1,a.getType()){case"MultiLineString":s[f.depth[0]].length>2&&(s[f.depth[0]].splice(h,1),i=!0);break;case"LineString":s.length>2&&(s.splice(h,1),i=!0);break;case"MultiPolygon":n=n[f.depth[1]];case"Polygon":n=n[f.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:f.depth,feature:f.feature,geometry:f.geometry,index:d,segment:m};this.rBush_.insert((0,T.Tr)(p.segment),p)}this.updateSegmentIndices_(a,h,f.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,$e.aI)(s.depth,i))&&s.index>t&&(s.index+=n)})}}function xl(r,e){return r.index-e.index}function Gr(r,e,t){const i=e.geometry;if(i.getType()==="Circle"){let s=i;if(e.index===tn){const o=(0,X.Tf)();o&&(s=s.clone().transform(o,t));const a=(0,Ye.hG)(s.getCenter(),(0,X.Ad)(r,t)),l=Math.sqrt(a)-s.getRadius();return l*l}}const n=(0,X.Ad)(r,t);return Ai[0]=(0,X.Ad)(e.segment[0],t),Ai[1]=(0,X.Ad)(e.segment[1],t),(0,Ye.$x)(n,Ai)}function Nr(r,e,t){const i=e.geometry;if(i.getType()==="Circle"&&e.index===tn){let s=i;const o=(0,X.Tf)();return o&&(s=s.clone().transform(o,t)),(0,X.te)(s.getClosestPoint((0,X.Ad)(r,t)),t)}const n=(0,X.Ad)(r,t);return Ai[0]=(0,X.Ad)(e.segment[0],t),Ai[1]=(0,X.Ad)(e.segment[1],t),(0,X.te)((0,Ye.sG)(n,Ai),t)}function yl(){const r=dr();return function(e,t){return r.Point}}const vl=_l;var El=C(92497);class Sn extends Ri.Ay{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=i[0]||e[1]<=i[1]&&e[3]>=i[1]?!0:(0,T.sB)(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?r[e-t]:r[e]}function Ln(r,e,t){let i,n;eo){const l=Mi(r,i),h=Mi(r,n);return bn(l,h)}let a=0;if(iu.startIndex?mu.startIndex&&(m-=f.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,Ye.Io)(u,e.startPx)>i&&(c=!1)}if(c){const d=h.coordinates,u=d.length,f=h.startIndex,g=l;if(f=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 Al extends lr.A{constructor(e){const t=e;t.stopDown||(t.stopDown=en.W8),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_=Ll(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.rT,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 Wr([NaN,NaN]),h=(0,X.Ad)(s[0],a),c=(0,Ye.hG)(h,(0,X.Ad)(s[s.length-1],a));l.setCenterAndRadius(h,Math.sqrt(c),this.geometryLayout_);const d=(0,X.Tf)();return d&&l.transform(a,d),l};else{let s;n==="Point"?s=Tt.A:n==="LineString"?s=ze.A:n==="Polygon"&&(s=Lt.Ay),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 Oe({source:new ct({useSpatialIndex:!1,wrapX:e.wrapX?e.wrapX:!1}),style:e.style?e.style:bl(),updateWhileInteracting:!0}),this.geometryName_=e.geometryName,this.condition_=e.condition?e.condition:Nt.TS,this.freehandCondition_,e.freehand?this.freehandCondition_=Nt.Gk:this.freehandCondition_=e.freehandCondition?e.freehandCondition:Nt.Kg,this.traceCondition_,this.setTrace(e.trace||!1),this.traceState_={active:!1},this.traceSource_=e.traceSource||e.source||null,this.addChangeListener(Tl.A.ACTIVE,this.updateState_)}setTrace(e){let t;e?e===!0?t=Nt.Gk:t=e:t=Nt.Zm,this.traceCondition_=t}setMap(e){super.setMap(e),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(e){e.originalEvent.type===st.A.CONTEXTMENU&&e.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(e);let t=e.type===pt.A.POINTERMOVE,i=!0;return!this.freehand_&&this.lastDragTime_&&e.type===pt.A.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,t=!0):this.lastDragTime_=void 0,this.shouldHandle_&&this.downTimeout_!==void 0&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)),this.freehand_&&e.type===pt.A.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(e.coordinate),i=!1):this.freehand_&&e.type===pt.A.POINTERDOWN?i=!1:t&&this.getPointerCount()<2?(i=e.type===pt.A.POINTERMOVE,i&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):(e.originalEvent.pointerType==="mouse"||e.type===pt.A.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(e)):e.type===pt.A.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 Cl.A(pt.A.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,T.Tr)([i,n]),o=this.traceSource_.getFeaturesInExtent(s);if(o.length===0)return;const a=Il(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&&te.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(e0&&this.removeLastPoints_(i)}addTracedCoordinates_(e,t,i){if(t===i)return;const n=[];if(t=o;--a)n.push(Li(e.coordinates,a))}n.length&&this.appendCoordinates(n)}updateTrace_(e){const t=this.traceState_;if(!t.active||t.targetIndex===-1&&(0,Ye.Io)(t.startPx,e.pixel)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=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=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 Sl.A([t])):this.type_==="MultiLineString"?e.setGeometry(new In.A([t])):this.type_==="MultiPolygon"&&e.setGeometry(new bi.A([t])),this.dispatchEvent(new An(Rn.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 An(Rn.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;othis.styleFunction(e,!1)),this.setVisible(!0)}setOptions(e){this.opts=e,this.getSource()?.refresh()}getMapMeasurement(e){let t=0,i=Ke[0];return this.opts.action==="area"?(i=Ke[1],t=(0,Xr.UG)(e)):t=(0,Xr.R3)(e),(0,mt.cN)(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 Lt.Ay?(l=o.getInteriorPoint(),h=this.getMapMeasurement(o),c=new ze.A(o.getCoordinates()[0])):a==="LineString"&&o instanceof ze.A&&(l=new Tt.A(o.getLastCoordinate()),h=this.getMapMeasurement(o))),t&&c){let d=0;c.forEachSegment((u,f)=>{const g=new ze.A([u,f]),m=this.getMapMeasurement(g);this.segmentStyles.length-1this.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 Fl=({map:r,menuActiveState:e})=>{const t=(0,_.useRef)(new Vr),i=Dl(fi.$W.theme2),[n,s]=(0,_.useState)(!0),[o,a]=(0,_.useState)(!1),[l,h]=(0,_.useState)({action:Ke[0].value,unit:Ke[0].units[0].value}),c=(0,_.useMemo)(()=>{const g=Ke.find(p=>p.value===l.action)??Ke[0],m=g.getUnit(l.unit);return t.current.setOptions(l),{current:m,options:g.units}},[l]),d=!0,u=!1;function f(){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 g=Ke.find(m=>m.value===l.action)??Ke[0];t.current.addInteraction(r,g.geometry,u,d)}}return _.createElement("div",{className:`${i.infoWrap} ${o?null:i.infoWrapClosed}`},o?_.createElement("div",null,_.createElement("div",{className:i.rowGroup},_.createElement(wi.z,{value:l.action,options:Ke,size:"md",fullWidth:!1,onChange:g=>{r.removeInteraction(t.current.draw);const m=Ke.find(v=>v.value===g)??Ke[0],p=m.getUnit(l.unit);h({...l,action:m.value,unit:p.value}),t.current.addInteraction(r,m.geometry,u,d)}}),_.createElement(yn.$n,{className:i.button,icon:"times",variant:"secondary",size:"sm",onClick:f})),_.createElement(Ti.l6,{className:i.unitSelect,value:c.current,options:c.options,isSearchable:!1,onChange:g=>{const m=Ke.find(v=>v.value===l.action)??Ke[0],p=m.getUnit(g.value)??m.units[0];h({...l,unit:p.value})}})):_.createElement(ss.K,{className:i.icon,name:"ruler-combined",tooltip:"show measure tools",tooltipPlacement:"left",onClick:f}))},Dl=r=>({button:(0,ie.css)({marginLeft:"auto"}),icon:(0,ie.css)({backgroundColor:r.colors.secondary.main,display:"inline-block",height:"19.25px",margin:"1px",width:"19.25px"}),infoWrap:(0,ie.css)({color:`${r.colors.text}`,backgroundColor:r.colors.background.secondary,borderRadius:"4px",padding:"2px"}),infoWrapClosed:(0,ie.css)({height:"25.25px",width:"25.25px"}),rowGroup:(0,ie.css)({display:"flex",justifyContent:"flex-end"}),unitSelect:(0,ie.css)({minWidth:"200px"})});var Lu=C(25045),Mu=C(97544);function Pl(r){return(0,nt.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 Fn=C(39741),Ne=C(52622),St=C(31484);class nn extends ct{constructor(e){super({}),this.location=e}update(e){this.clear(!0);const t=(0,St.FM)(e,this.location);if(!t.field){this.changed();return}for(let i=0;is.getCoordinates()));this.addFeatureInternal(new Ue.A({frame:e,rowIndex:0,geometry:n})),this.changed()}}var Dn=C(24120),jr=C(62467),Zr=C(8066),Ol=C(58563),kl=C(96589),Bl=C(47694),zl=C(28895);function Hr(r){const{layerName:e,styleConfig:t,layer:i}=r,n=(0,ye.of)(Gl),s=(0,Dn.A)(i?.__state?.mouseEvents??(0,jr.of)(void 0)),o=t?.dims?.color?.field,a=(0,_.useMemo)(()=>{if(!o||!s)return;const g=s.getProperties();if(!g.frame)return;const p=g.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,ie.cx)(n.layerBody,n.fixedColorContainer)},_.createElement(Bl.y,{src:`public/${c}`,className:n.legendSymbol,title:"Symbol",style:{fill:l,opacity:h}})));if(!o)return _.createElement(_.Fragment,null);const d=(0,Zr.Qi)(o);if(d.isContinuous&&d.getColors){const g=d.getColors(fi.$W.theme2),m=(0,Ol.AP)(o),p=o.display?v=>(0,mt.cN)(o.display(v)):v=>`${v}`;return _.createElement("div",{className:n.infoWrap},_.createElement("div",{className:n.layerName},e),_.createElement("div",{className:(0,ie.cx)(n.layerBody,n.colorScaleWrapper)},_.createElement(kl.w,{hoverValue:a,colorPalette:g,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 f=(0,zl.EI)(o.config,fi.$W.theme2);return _.createElement("div",{className:n.infoWrap},_.createElement("div",{className:n.layerName},e),_.createElement("div",{className:(0,ie.cx)(n.layerBody,n.legend)},f.map((g,m)=>_.createElement("div",{key:`${m}/${g.label}`,className:n.legendItem},_.createElement("i",{style:{background:g.color}}),g.label))))}const Gl=r=>({infoWrap:(0,ie.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,ie.css)({fontSize:r.typography.body.fontSize}),layerBody:(0,ie.css)({paddingLeft:"10px"}),legend:(0,ie.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,ie.css)({whiteSpace:"nowrap"}),fixedColorContainer:(0,ie.css)({minWidth:"80px",fontSize:r.typography.bodySmall.fontSize,paddingTop:"5px"}),legendSymbol:(0,ie.css)({height:"18px",width:"18px",margin:"auto"}),colorScaleWrapper:(0,ie.css)({minWidth:"200px",fontSize:r.typography.bodySmall.fontSize,paddingTop:"10px"})});class Kr 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=C(39268),ut=C(14186),rt=C(88575),Nl=C(76892),Wl=C(83598),Is=C(66864),Rs=C(72626),Jr=C(57602),ei=C(78437),Pn=C(80744),P=C(33744),$r=C(40672),On=C(83077),kn=C(63577),Ul=(r=>(r.circle="circle",r.square="square",r.triangle="triangle",r.star="star",r.cross="cross",r.x="x",r))(Ul||{});const Fi={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 Ie({color:r.color});if(e>0){const t=(0,de.A)(r.color).setAlpha(e).toRgbString();return new Ie({color:t})}}function Yl(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.A)(r.color).setAlpha(e).toRgbString();return new Te({color:t,width:r.lineWidth??1})}}const Dt=r=>{if(!r.text)return;const e=tt.$.theme2.typography.fontFamily,t={...P.T5.textConfig,...r.textConfig};return new gi({text:r.text,fill:new Ie({color:r.color??P.T5.color.fixed}),font:`normal ${t.fontSize}px ${e}`,...t})},Xl=r=>new fe({text:Dt(r)}),qr=r=>{const e=new Te({color:r.color,width:r.lineWidth??1}),t=r.size??P._7;return new fe({image:new Ct({stroke:e,fill:Di(r),radius:t,displacement:_i(r.symbolAlign??P.T5.symbolAlign,t)}),text:Dt(r),stroke:e})},sn=r=>new fe({fill:Di(r),stroke:new Te({color:r.color,width:r.lineWidth??1}),text:Dt(r)}),As=r=>new fe({fill:Di(r),stroke:Yl(r),text:Dt(r)}),Qr=r=>{const e=r.size??P._7,t=new Te({color:"#F00",width:1});return[new fe({image:new Ze({stroke:t,points:4,radius:e,angle:Math.PI/4})}),new fe({image:new Ze({stroke:t,points:4,radius:e,radius2:0,angle:0})})]},Vl=[{id:"circle",name:"Circle",aliasIds:[Fi.circle],make:qr},{id:"square",name:"Square",aliasIds:[Fi.square],make:r=>{const e=r.size??P._7,t=r.rotation??0;return new fe({image:new Ze({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??P.T5.symbolAlign,e)}),text:Dt(r)})}},{id:"triangle",name:"Triangle",aliasIds:[Fi.triangle],make:r=>{const e=r.size??P._7,t=r.rotation??0;return new fe({image:new Ze({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??P.T5.symbolAlign,e)}),text:Dt(r)})}},{id:"star",name:"Star",aliasIds:[Fi.star],make:r=>{const e=r.size??P._7,t=r.rotation??0;return new fe({image:new Ze({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??P.T5.symbolAlign,e)}),text:Dt(r)})}},{id:"cross",name:"Cross",aliasIds:[Fi.cross],make:r=>{const e=r.size??P._7,t=r.rotation??0;return new fe({image:new Ze({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??P.T5.symbolAlign,e)}),text:Dt(r)})}},{id:"x",name:"X",aliasIds:[Fi.x],make:r=>{const e=r.size??P._7,t=r.rotation??0;return new fe({image:new Ze({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??P.T5.symbolAlign,e)}),text:Dt(r)})}}];async function jl(r,e){return fetch(r,{method:"GET"}).then(t=>t.text()).then(t=>{t=$r.sQ.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 On.O(()=>Vl);function Zl(r){const e=bs.getIfExists(r);if(e?.aliasIds?.length)return e.aliasIds[0]}async function Hl(r,e){if(!r)return e?Xl:qr;let t=bs.getIfExists(r);if(t)return t.make;if(r.endsWith(".svg")){const i=await jl((0,kn.getPublicOrAbsoluteUrl)(r));return t={id:r,name:r,aliasIds:[],make:i?n=>{const s=n.size??P._7,o=n.rotation??0;return[new fe({image:new wn({src:i,color:n.color,opacity:n.opacity??1,scale:(P._7+s)/100,rotation:o*Math.PI/180,displacement:_i(n.symbolAlign??P.T5.symbolAlign,s/2)}),text:n?.text?Dt(n):void 0}),new fe({image:new Ze({fill:new Ie({color:"rgba(0,0,0,0)"}),points:4,radius:n.size,rotation:o*Math.PI/180+Math.PI/4})})]}:Qr},bs.register(t),t.make}return Qr}function eo(r){const e=r?.text;return e?!!(e.mode===Ne.RU.Fixed&&e.fixed?.length||e.mode===Ne.RU.Field&&e.field?.length):!1}async function Wt(r){r||(r=P.T5);const e=eo(r),t={},i=await Hl(r.symbol?.fixed,e),n={config:r,hasText:e,fields:t,base:{color:tt.$.theme2.visualization.getColorByName(r.color?.fixed??P.T5.color.fixed),opacity:r.opacity??P.T5.opacity,lineWidth:r.lineWidth??1,size:r.size?.fixed??P.T5.size.fixed,rotation:r.rotation?.fixed??P.T5.rotation.fixed,symbolAlign:r.symbolAlign??P.T5.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??P.T5.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===P.wq.Left?t[0]=-e:r?.horizontal===P.wq.Right&&(t[0]=e),r?.vertical===P.G4.Top?t[1]=e:r?.vertical===P.G4.Bottom&&(t[1]=-e),t}const ti=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=b=>{t({...e,size:b})},a=b=>{t({...e,symbol:b})},l=b=>{t({...e,color:b})},h=b=>{t({...e,opacity:b})},c=b=>{t({...e,rotation:b})},d=b=>{t({...e,text:b})},u=b=>{t({...e,textConfig:{...e.textConfig,fontSize:b}})},f=b=>{t({...e,textConfig:{...e.textConfig,offsetX:b}})},g=b=>{t({...e,textConfig:{...e.textConfig,offsetY:b}})},m=b=>{t({...e,textConfig:{...e.textConfig,textAlign:b}})},p=b=>{t({...e,textConfig:{...e.textConfig,textBaseline:b}})},v=b=>{t({...e,symbolAlign:{...e?.symbolAlign,horizontal:b}})},y=b=>{t({...e,symbolAlign:{...e?.symbolAlign,vertical:b}})},R=(0,Dn.A)(s?.layerInfo??(0,jr.of)())?.geometryType===P.W_.Point,L=eo(e),D=2e3;return s?.simpleFixedValues?_.createElement(_.Fragment,null,R&&_.createElement(_.Fragment,null,_.createElement(It.C,null,_.createElement(ut.I,{label:"Symbol"},_.createElement(ei.mj,{value:e?.symbol??P.T5.symbol,context:n,onChange:a,item:{settings:{resourceType:"icon",folderName:Pn.Iu.Marker,placeholderText:L?"Select a symbol":"Select a symbol or add a text label",placeholderValue:P.T5.symbol.fixed,showSourceRadio:!1,maxFiles:D}}}))),_.createElement(rt.D,{label:"Rotation angle"},_.createElement(ei.AW,{value:e?.rotation??P.T5.rotation,context:n,onChange:c,item:{settings:{min:P.T5.rotation.min,max:P.T5.rotation.max}}}))),_.createElement(It.C,null,_.createElement(ut.I,{label:"Color",labelWidth:10},_.createElement(Nl.c,{width:4},_.createElement(Wl.sk,{color:e?.color?.fixed??P.T5.color.fixed,onChange:b=>{l({fixed:b})}})))),_.createElement(It.C,null,_.createElement(ut.I,{label:"Opacity",labelWidth:10,grow:!0},_.createElement(Jr.G,{value:e?.opacity??P.T5.opacity,context:n,onChange:h,item:{settings:{min:0,max:1,step:.1}}})))):_.createElement(_.Fragment,null,_.createElement(rt.D,{label:"Size"},_.createElement(ei.gm,{value:e?.size??P.T5.size,context:n,onChange:o,item:{settings:{min:1,max:100}}})),!s?.hideSymbol&&_.createElement(_.Fragment,null,_.createElement(rt.D,{label:"Symbol"},_.createElement(ei.mj,{value:e?.symbol??P.T5.symbol,context:n,onChange:a,item:{settings:{resourceType:Pn.zu.Icon,folderName:Pn.Iu.Marker,placeholderText:L?"Select a symbol":"Select a symbol or add a text label",placeholderValue:P.T5.symbol.fixed,showSourceRadio:!1,maxFiles:D}}})),_.createElement(rt.D,{label:"Symbol Vertical Align"},_.createElement(wi.z,{value:e?.symbolAlign?.vertical??P.T5.symbolAlign.vertical,onChange:y,options:[{value:P.G4.Top,label:(0,E.capitalize)(P.G4.Top)},{value:P.G4.Center,label:(0,E.capitalize)(P.G4.Center)},{value:P.G4.Bottom,label:(0,E.capitalize)(P.G4.Bottom)}]})),_.createElement(rt.D,{label:"Symbol Horizontal Align"},_.createElement(wi.z,{value:e?.symbolAlign?.horizontal??P.T5.symbolAlign.horizontal,onChange:v,options:[{value:P.wq.Left,label:(0,E.capitalize)(P.wq.Left)},{value:P.wq.Center,label:(0,E.capitalize)(P.wq.Center)},{value:P.wq.Right,label:(0,E.capitalize)(P.wq.Right)}]}))),_.createElement(rt.D,{label:"Color"},_.createElement(ei.NO,{value:e?.color??P.T5.color,context:n,onChange:l,item:{}})),_.createElement(rt.D,{label:"Fill opacity"},_.createElement(Jr.G,{value:e?.opacity??P.T5.opacity,context:n,onChange:h,item:{settings:{min:0,max:1,step:.1}}})),s?.displayRotation&&_.createElement(rt.D,{label:"Rotation angle"},_.createElement(ei.AW,{value:e?.rotation??P.T5.rotation,context:n,onChange:c,item:{settings:{min:P.T5.rotation.min,max:P.T5.rotation.max}}})),_.createElement(rt.D,{label:"Text label"},_.createElement(ei.hj,{value:e?.text??Pn.nG,context:n,onChange:d,item:{}})),L&&_.createElement(_.Fragment,null,_.createElement(Is.Gy,null,_.createElement(rt.D,{label:"Font size"},_.createElement(Rs.w,{value:e?.textConfig?.fontSize??P.T5.textConfig.fontSize,context:n,onChange:u,item:{}})),_.createElement(rt.D,{label:"X offset"},_.createElement(Rs.w,{value:e?.textConfig?.offsetX??P.T5.textConfig.offsetX,context:n,onChange:f,item:{}})),_.createElement(rt.D,{label:"Y offset"},_.createElement(Rs.w,{value:e?.textConfig?.offsetY??P.T5.textConfig.offsetY,context:n,onChange:g,item:{}}))),_.createElement(rt.D,{label:"Align"},_.createElement(wi.z,{value:e?.textConfig?.textAlign??P.T5.textConfig.textAlign,onChange:m,options:[{value:P.DY.Left,label:(0,E.capitalize)(P.DY.Left)},{value:P.DY.Center,label:(0,E.capitalize)(P.DY.Center)},{value:P.DY.Right,label:(0,E.capitalize)(P.DY.Right)}]})),_.createElement(rt.D,{label:"Baseline"},_.createElement(wi.z,{value:e?.textConfig?.textBaseline??P.T5.textConfig.textBaseline,onChange:p,options:[{value:P.fX.Top,label:(0,E.capitalize)(P.fX.Top)},{value:P.fX.Middle,label:(0,E.capitalize)(P.fX.Middle)},{value:P.fX.Bottom,label:(0,E.capitalize)(P.fX.Bottom)}]}))))};var qe=C(5636);const rn={style:P.T5,showLegend:!0},Ls="markers",Ms={type:Ls,name:"",config:rn,location:{mode:Ne.aG.Auto},tooltip:!0},Kl={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={...rn,...e?.config},s=await Wt(n.style),o=await(0,St.nE)(e.location),a=new nn(o),l=new Oe({source:a}),h=new Fn.m(1);let c=null;return n.showLegend&&(c=_.createElement(Kr,{watch:h,initialSubProps:{},child:Hr})),s.fields?l.setStyle(d=>{const u=d.get("rowIndex"),f=s.dims;if(!f||!(0,E.isNumber)(u))return s.maker(s.base);const g={...s.base};return f.color&&(g.color=f.color.get(u)),f.size&&(g.size=f.size.get(u)),f.text&&(g.text=f.text.get(u)),f.rotation&&(g.rotation=f.rotation.get(u)),s.maker(g)}):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,qe.ue)(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:ti,settings:{displayRotation:!0},defaultValue:rn.style}).addBooleanSwitch({path:"config.showLegend",name:"Show legend",description:"Show map legend",defaultValue:rn.showLegend})}}},defaultOptions:rn};var xi=C(43429);const Bn={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class Jl extends cr.A{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 $l=Jl;var ae=C(11078),ql=C(93474);class Ql extends fs.A{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(st.A.CHANGE)}release(){this.state===ae.A.ERROR&&this.setState(ae.A.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let e=this.interimTile;do{if(e.getState()==ae.A.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.A.LOADED){e.interimTile=null;break}else e.getState()==ae.A.LOADING?t=e:e.getState()==ae.A.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.A.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}load(){(0,$.b0)()}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,ql.a6)(n/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}}const to=Ql;class eh extends to{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.A.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=ae.A.ERROR,this.unlistenImage_(),this.image_=th(),this.changed()}handleImageLoad_(){const e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=ae.A.LOADED:this.state=ae.A.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==ae.A.ERROR&&(this.state=ae.A.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==ae.A.IDLE&&(this.state=ae.A.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=gs(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function th(){const r=(0,Ge.Y)(1,1);return r.fillStyle="rgba(0,0,0,0)",r.fillRect(0,0,1,1),r.canvas}const io=eh,ih=.5,nh=10,no=.25;class sh{constructor(e,t,i,n,s,o){this.sourceProj_=e,this.targetProj_=t;let a={};const l=(0,X.RG)(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,T.RG)(n)>=(0,T.RG)(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?(0,T.RG)(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?(0,T.RG)(this.targetProj_.getExtent()):null;const h=(0,T.Py)(i),c=(0,T.WU)(i),d=(0,T.k_)(i),u=(0,T.R)(i),f=this.transformInv_(h),g=this.transformInv_(c),m=this.transformInv_(d),p=this.transformInv_(u),v=nh+(o?Math.max(0,Math.ceil(Math.log2((0,T.UG)(i)/(o*o*256*256)))):0);if(this.addQuad_(h,c,d,u,f,g,m,p,v),this.wrapsXInSource_){let y=1/0;this.triangles_.forEach(function(w,R,L){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 R=[[w.source[0][0],w.source[0][1]],[w.source[1][0],w.source[1][1]],[w.source[2][0],w.source[2][1]]];R[0][0]-y>this.sourceWorldWidth_/2&&(R[0][0]-=this.sourceWorldWidth_),R[1][0]-y>this.sourceWorldWidth_/2&&(R[1][0]-=this.sourceWorldWidth_),R[2][0]-y>this.sourceWorldWidth_/2&&(R[2][0]-=this.sourceWorldWidth_);const L=Math.min(R[0][0],R[1][0],R[2][0]);Math.max(R[0][0],R[1][0],R[2][0])-L.5&&d<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const p=(0,T.Tr)([e,t,i,n]);g=(0,T.RG)(p)/this.targetWorldWidth_>no||g}!f&&this.sourceProj_.isGlobal()&&d&&(g=d>no||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!(0,T.HY)(c,this.maxSourceExtent_))return;let m=0;if(!g&&(!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)g=!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(!g){const p=[(e[0]+i[0])/2,(e[1]+i[1])/2],v=this.transformInv_(p);let y;f?y=((0,xe.xP)(s[0],u)+(0,xe.xP)(a[0],u))/2-(0,xe.xP)(v[0],u):y=(s[0]+a[0])/2-v[0];const w=(s[1]+a[1])/2-v[1];g=y*y+w*w>this.errorThresholdSquared_}if(g){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(f){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,T.S5)();return this.triangles_.forEach(function(t,i,n){const s=t.source;(0,T.$C)(e,s[0]),(0,T.$C)(e,s[1]),(0,T.$C)(e,s[2])}),e}getTriangles(){return this.triangles_}}const rh=sh;let Fs;const Pi=[];function so(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 Ds(r,e){return Math.abs(r[e*4]-210)>2||Math.abs(r[e*4+3]-.75*255)>2}function oh(){if(Fs===void 0){const r=(0,Ge.Y)(6,6,Pi);r.globalCompositeOperation="lighter",r.fillStyle="rgba(210, 0, 0, 0.75)",so(r,4,5,4,0),so(r,4,5,0,5);const e=r.getImageData(0,0,3,3).data;Fs=Ds(e,0)||Ds(e,4)||Ds(e,8),(0,Ge.Yg)(r),Pi.push(r.canvas)}return Fs}function ro(r,e,t,i){const n=(0,X.pd)(t,e,r);let s=(0,X.hO)(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,T.Ym)(l,n)){const h=(0,X.hO)(r,s,n)/s;isFinite(h)&&h>0&&(s/=h)}return s}function ah(r,e,t,i){const n=(0,T.q1)(t);let s=ro(r,e,n,i);return(!isFinite(s)||s<=0)&&(0,T.sB)(t,function(o){return s=ro(r,e,o,i),isFinite(s)&&s>0}),s}function lh(r,e,t,i,n,s,o,a,l,h,c,d){const u=(0,Ge.Y)(Math.round(t*r),Math.round(t*e),Pi);if(d||(u.imageSmoothingEnabled=!1),l.length===0)return u.canvas;u.scale(t,t);function f(R){return Math.round(R*t)/t}u.globalCompositeOperation="lighter";const g=(0,T.S5)();l.forEach(function(R,L,D){(0,T.X$)(g,R.extent)});const m=(0,T.RG)(g),p=(0,T.Oq)(g),v=(0,Ge.Y)(Math.round(t*m/i),Math.round(t*p/i),Pi);d||(v.imageSmoothingEnabled=!1);const y=t/i;l.forEach(function(R,L,D){const b=R.extent[0]-g[0],N=-(R.extent[3]-g[3]),Z=(0,T.RG)(R.extent),q=(0,T.Oq)(R.extent);R.image.width>0&&R.image.height>0&&v.drawImage(R.image,h,h,R.image.width-2*h,R.image.height-2*h,b*y,N*y,Z*y,q*y)});const w=(0,T.Py)(o);return a.getTriangles().forEach(function(R,L,D){const b=R.source,N=R.target;let Z=b[0][0],q=b[0][1],he=b[1][0],le=b[1][1],Q=b[2][0],me=b[2][1];const J=f((N[0][0]-w[0])/s),Y=f(-(N[0][1]-w[1])/s),U=f((N[1][0]-w[0])/s),H=f(-(N[1][1]-w[1])/s),pe=f((N[2][0]-w[0])/s),we=f(-(N[2][1]-w[1])/s),ke=Z,B=q;Z=0,q=0,he-=ke,le-=B,Q-=ke,me-=B;const Qe=[[he,le,0,0,U-J],[Q,me,0,0,pe-J],[0,0,he,le,H-Y],[0,0,Q,me,we-Y]],Ce=(0,xe.KU)(Qe);if(Ce){if(u.save(),u.beginPath(),oh()||!d){u.moveTo(U,H);const Le=4,ri=J-U,kt=Y-H;for(let Ve=0;Ve{t&&t.getState()==ae.A.LOADED&&e.push({extent:this.sourceTileGrid_.getTileCoordExtent(t.tileCoord),image:t.getImage()})}),this.sourceTiles_.length=0,e.length===0)this.state=ae.A.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_=lh(n,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=ae.A.LOADED}this.changed()}load(){if(this.state==ae.A.IDLE){this.state=ae.A.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(t=>{const i=t.getState();if(i==ae.A.IDLE||i==ae.A.LOADING){e++;const n=(0,Je.KT)(t,st.A.CHANGE,function(s){const o=t.getState();(o==ae.A.LOADED||o==ae.A.ERROR||o==ae.A.EMPTY)&&((0,Je.JH)(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.A.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(Je.JH),this.sourcesListenerKeys_=null}release(){this.canvas_&&((0,Ge.Yg)(this.canvas_.getContext("2d")),Pi.push(this.canvas_),this.canvas_=null),super.release()}}const Ps=hh;class oo{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.minXthis.maxX&&(this.maxX=e.maxX),e.minYthis.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 oo(r,e,t,i)}const ao=oo;class ch extends Sr{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,T.S5)(),this.tmpTileRange_=new ao(0,0,0,0)}isDrawableTile(e){const t=this.getLayer(),i=e.getState(),n=t.getUseInterimTilesOnError();return i==ae.A.LOADED||i==ae.A.EMPTY||i==ae.A.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.A.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,te.Bb)(t.pixelToCoordinateTransform,e.slice()),s=i.getExtent();if(s&&!(0,T.Ym)(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 f=c.getTileCoordForCoordAndZ(n,u),g=h.getTile(u,f[1],f[2],o,a);if(!(g instanceof io||g instanceof Ps)||g instanceof Ps&&g.getState()===ae.A.EMPTY)return null;if(g.getState()!==ae.A.LOADED)continue;const m=c.getOrigin(u),p=(0,ht.xq)(c.getTileSize(u)),v=c.getResolution(u),y=Math.floor(d*((n[0]-m[0])/v-f[1]*p[0])),w=Math.floor(d*((m[1]-n[1])/v-f[2]*p[1])),R=Math.round(d*h.getGutterForProjection(l.projection));return this.getImageData(g.getImage(),y+R,w+R)}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(),f=d.getTileGridForProjection(s),g=f.getZForResolution(o,d.zDirection),m=f.getResolution(g);let p=e.extent;const v=e.viewState.resolution,y=d.getTilePixelRatio(h),w=Math.round((0,T.RG)(p)/v*h),R=Math.round((0,T.Oq)(p)/v*h),L=i.extent&&(0,X.SD)(i.extent,s);L&&(p=(0,T._N)(p,(0,X.SD)(i.extent,s)));const D=m*w/2/y,b=m*R/2/y,N=[a[0]-D,a[1]-b,a[0]+D,a[1]+b],Z=f.getTileRangeForExtentAndZ(p,g),q={};q[g]={};const he=this.createLoadedTileFinder(d,s,q),le=this.tmpExtent,Q=this.tmpTileRange_;this.newTiles_=!1;const me=l?(0,T.Yw)(n.center,v,l,e.size):void 0;for(let Qe=Z.minX;Qe<=Z.maxX;++Qe)for(let Ce=Z.minY;Ce<=Z.maxY;++Ce){if(l&&!f.tileCoordIntersectsViewport([g,Qe,Ce],me))continue;const Le=this.getTile(g,Qe,Ce,e);if(this.isDrawableTile(Le)){const Ve=(0,$.v6)(this);if(Le.getState()==ae.A.LOADED){q[g][Le.tileCoord.toString()]=Le;let Yt=Le.inTransition(Ve);Yt&&i.opacity!==1&&(Le.endTransition(Ve),Yt=!1),!this.newTiles_&&(Yt||!this.renderedTiles.includes(Le))&&(this.newTiles_=!0)}if(Le.getAlpha(Ve,e.time)===1)continue}const ri=f.getTileCoordChildTileRange(Le.tileCoord,Q,le);let kt=!1;ri&&(kt=he(g+1,ri)),kt||f.forEachTileCoordParentTileRange(Le.tileCoord,he,Q,le)}const J=m/o*h/y;(0,te.Zz)(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/h,1/h,l,-w/2,-R/2);const Y=(0,te.dI)(this.pixelTransform);this.useContainer(t,Y,this.getBackground(e));const U=this.context,H=U.canvas;(0,te.T9)(this.inversePixelTransform,this.pixelTransform),(0,te.Zz)(this.tempTransform,w/2,R/2,J,J,0,-w/2,-R/2),H.width!=w||H.height!=R?(H.width=w,H.height=R):this.containerReused||U.clearRect(0,0,w,R),L&&this.clipUnrotated(U,e,L),d.getInterpolate()||(U.imageSmoothingEnabled=!1),this.preRender(U,e),this.renderedTiles.length=0;let pe=Object.keys(q).map(Number);pe.sort($e.V_);let we,ke,B;i.opacity===1&&(!this.containerReused||d.getOpaque(e.viewState.projection))?pe=pe.reverse():(we=[],ke=[]);for(let Qe=pe.length-1;Qe>=0;--Qe){const Ce=pe[Qe],Le=d.getTilePixelSize(Ce,h,s),kt=f.getResolution(Ce)/m,Ve=Le[0]*kt*J,Yt=Le[1]*kt*J,Wi=f.getTileCoordForCoordAndZ((0,T.Py)(N),Ce),Jn=f.getTileCoordExtent(Wi),Ui=(0,te.Bb)(this.tempTransform,[y*(Jn[0]-N[0])/m,y*(N[3]-Jn[3])/m]),$n=y*d.getGutterForProjection(s),oi=q[Ce];for(const fn in oi){const ai=oi[fn],qn=ai.tileCoord,Qn=Wi[1]-qn[1],es=Math.round(Ui[0]-(Qn-1)*Ve),Yi=Wi[2]-qn[2],sr=Math.round(Ui[1]-(Yi-1)*Yt),ot=Math.round(Ui[0]-Qn*Ve),vt=Math.round(Ui[1]-Yi*Yt),bt=es-ot,Xt=sr-vt,Xi=g===Ce,Ei=Xi&&ai.getAlpha((0,$.v6)(this),e.time)!==1;let li=!1;if(!Ei)if(we){B=[ot,vt,ot+bt,vt,ot+bt,vt+Xt,ot,vt+Xt];for(let Vi=0,ts=we.length;Vi0&&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.v)(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.v)(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.v)(!(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 gh=fh;function lo(r,e,t,i){return i!==void 0?(i[0]=r,i[1]=e,i[2]=t,i):[r,e,t]}function on(r,e,t){return r+"/"+e+"/"+t}function ho(r){return on(r[0],r[1],r[2])}function Fu(r){const[e,t,i]=r.substring(r.lastIndexOf("/")+1,r.length).split(",").map(Number);return on(e,t,i)}function mh(r){return r.split("/").map(Number)}function ph(r){return(r[1]<t||t>e.getMaxZoom())return!1;const s=e.getFullTileRange(t);return s?s.containsXY(i,n):!0}class xh extends gh{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=mh(e)[0];this.forEach(n=>{n.tileCoord[0]!==i&&(this.remove(ho(n.tileCoord)),n.release())})}}const co=xh,ks={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var Bs=C(57115),yh=C(4350);const ki=[0,0,0],ii=5;class vh{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,(0,ue.v)((0,$e.WC)(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=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||t0?i:Math.max(s/t[0],n/t[1]);const o=e+1,a=new Array(o);for(let l=0;li.highWaterMark&&(i.highWaterMark=e)}useTile(e,t,i,n){}}class Ih extends En.Ay{constructor(e,t){super(e),this.tile=t}}const Rh=Sh;function Ah(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.v)(c,55),(c.getHeight()-o[2]-1).toString()})}}function bh(r,e){const t=r.length,i=new Array(t);for(let n=0;nthis.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=on(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.A.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,X.Jt)(e);if(i){const n=(0,$.v6)(i);n in this.tileGridForProjection||(this.tileGridForProjection[n]=t)}}clear(){super.clear();for(const e in this.tileCacheForProjection)this.tileCacheForProjection[e].clear()}}function Ph(r,e){r.getImage().src=e}const Oh=Dh;class kh extends Oh{constructor(e){e=e||{};const t=e.projection!==void 0?e.projection:"EPSG:3857",i=e.tileGrid!==void 0?e.tileGrid:Th({extent:zs(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 Ns=kh;var Bh=(r=>(r.Auto="auto",r.Light="light",r.Dark="dark",r))(Bh||{});const zn={theme:"auto",showLabels:!0},mo={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 Os({source:new Ns({attributions:'\xA9 CARTO',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})}})},zh=[mo],po="https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer",Bi={url:po+"/tile/{z}/{y}/{x}",attribution:`Tiles \xA9 ArcGIS`},_o={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 Os({source:new Ns({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}})}})},Gh=[_o],Gn="custom",Ws="streets",xo=new On.O(()=>[{id:Ws,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:""}]),Nh=[{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=xo.getIfExists(n.server??Ws);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 ArcGIS`}const o={...e,config:n};return _o.create(r,o,t,i).then(a=>(a.registerOptionsUI=l=>{l.addSelect({path:"config.server",name:"Server instance",settings:{options:xo.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:Ws}}],Wh='© OpenStreetMap contributors.';class Uh extends Ns{constructor(e){e=e||{};let t;e.attributions!==void 0?t=e.attributions:t=[Wh];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 Yh=Uh,Us=[...[{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 Os({source:new Yh})})}],...zh,...Nh,...Gh];var Nn=C(35598),Pt=class extends ct{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=Pt._sunEclipticPosition(o),h=Pt._eclipticObliquity(o),c=Pt._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 Lt.Ay([n]);s.transform("EPSG:4326",i),this.addFeature(new Ue.A(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=Pt._sunEclipticPosition(i),o=Pt._eclipticObliquity(i),a=Pt._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=Pt._sunEclipticPosition(o),c=Pt._eclipticObliquity(o),d=Pt._sunEquatorialPosition(h.lambda,c),u=this.get("step")||1,f=-180;f<=180;f+=u){var g=f,m=a*15+g-d.alpha,p=Math.atan(-Math.cos(m*n)/Math.tan(d.delta*n))*i;l.push([g,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 yo=Pt;var Xh=(r=>(r.From="from",r.To="to",r))(Xh||{});const yi={show:"to",sun:!1,nightColor:"#a7a6ba4D"},vo="dayNight",Bu={type:vo,name:"",config:yi,tooltip:!0},Vh={id:vo,name:"Night / Day",description:"Show day and night regions",isBaseMap:!1,create:async(r,e,t,i)=>{const n={...yi,...e?.config},s=new yo({}),o=Object.getPrototypeOf(s),a=new yo({}),l=Object.getPrototypeOf(a),h=new Oe({source:s,style:new fe({fill:new Ie({color:i.visualization.getColorByName(n.nightColor)})})}),c=new Oe({source:new ct({features:[]}),style:new fe({stroke:new Te({color:"#607D8B",width:1.5,lineDash:[2,3]})})}),d=new Ue.A({geometry:new Tt.A([])}),u=new Oe({source:new ct({features:[d]}),style:new fe({image:new Ct({radius:13,fill:new Ie({color:"rgb(253,184,19)"})})})}),f=new Ue.A({geometry:new Tt.A([])}),g=new fe({image:new Ct({radius:13,stroke:new Te({color:"rgb(253,184,19)",width:1.5})})}),m=new fe({image:new Ct({radius:15,stroke:new Te({color:"#607D8B",width:1.5,lineDash:[2,3]})})}),p=new Oe({source:new ct({features:[f]}),style:[m,g]}),v=new Nn.A({layers:n.sun?[h,u,p,c]:[h,c]}),y=new K.yU;return{init:()=>v,dispose:()=>y.unsubscribe(),update:w=>{const R=new Date(w.timeRange.from.valueOf()),L=new Date(w.timeRange.to.valueOf());let D=new Date,b=[];n.show==="from"?D=R:D=L,s.setTime(D),n.sun&&(b=o.getSunPosition(D),d.getGeometry()?.setCoordinates((0,X.Rb)(b)))},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 Eo=C(11365),wo=C(57532),To=C(81160),jh=C(98358);const Co=(r,e)=>{const t=e.get(r.property);return(0,jh.c)(t,r.operation,r.value)};function So(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=P.W_.Any;if(e.size===1)switch(e.values().next().value){case"Point":case"MultiPoint":i=P.W_.Point;break;case"Line":case"MultiLine":i=P.W_.Line;break;case"Polygon":i=P.W_.Polygon}return{geometryType:i,propertes:Array.from(t.keys()).map(n=>({label:n,value:n}))}}function Zh(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 an={src:"public/maps/countries.geojson",rules:[],style:P.T5,dataStyle:{}},zu={style:P.T5,check:{property:"",operation:Ne.zT.EQ,value:""}},Hh={id:"dynamic-geojson",name:"Dynamic GeoJSON",description:"Style a geojson file based on query results",isBaseMap:!1,state:xi.pn.alpha,create:async(r,e,t,i)=>{const n={...an,...e.config},s=new ct({url:n.src,format:new Eo.A}),o=new Fn.m,a=s.on("change",()=>{s.getState()==="ready"&&((0,xs.e)(a),o.next(s.getFeatures()))}),l=[];if(n.rules){for(const u of n.rules)if(u.style){const f=await Wt(u.style);l.push({state:f,rule:u.check})}}{const u=await Wt(n.style);l.push({state:u})}const h=await Wt(n.style),c=new Map,d=new Oe({source:s,style:u=>{const f=c.get(u.getId()),g=h.dims;if(f&&g)return new fe({fill:new Ie({color:g.color?.get(f)}),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):sn(v)}return m?(p.point||(p.point=p.state.maker(p.state.base)),p.point):(p.poly||(p.poly=sn(p.state.base)),p.poly)}}});return{init:()=>d,update:u=>{const f=u.series[0];if(f){const g=(0,kn.findField)(f,n.idField);g&&(c.clear(),g.values.forEach((m,p)=>c.set(m,p))),h.dims=(0,qe.ue)(f,h,i,n.dataStyle)}d.changed()},registerOptionsUI:u=>{const f=o.pipe((0,wo.$)(),(0,To.T)(g=>So(g)));u.addSelect({path:"config.src",name:"GeoJSON URL",settings:{options:(0,qe.G_)()??[],allowCustomValue:!0},defaultValue:an.src}).addFieldNamePicker({path:"config.idField",name:"ID Field"}).addCustomEditor({id:"config.dataStyle",path:"config.dataStyle",name:"Data style",editor:ti,settings:{displayRotation:!1},defaultValue:an.dataStyle}).addCustomEditor({id:"config.style",path:"config.style",name:"Default style",description:"The style to apply when no rules above match",editor:ti,settings:{simpleFixedValues:!0,layerInfo:f},defaultValue:an.style})}}},defaultOptions:an};var Io=C(19346),ln=C(60188);function Ro(r,e){if(r&&!e){const i={label:`${r}`,value:r};return{options:[i],current:i}}e||(e=[]);let t=e.find(i=>i.value===r);return r&&!t&&(t={label:`${r} (not found)`,value:r},e.push(t)),{options:e,current:t}}const Kh=({value:r,onChange:e,item:t,context:i})=>{const n=t.settings,{features:s,layerInfo:o}=n,a=(0,Dn.A)(o),l=(0,Dn.A)(s),h=(0,_.useMemo)(()=>{const L=r?.check?.property;return L&&l&&r.check?.operation===Ne.zT.EQ?Zh(l,L).map(D=>{let b;return!isNaN(Number(D))?b={value:Number(D),label:D}:b={value:D,label:D},b}):[]},[l,r]),c=(0,ye.of)(Jh),d=10,u=(0,_.useCallback)(L=>{e({...r,check:{...r.check,property:L?.value}})},[e,r]),f=(0,_.useCallback)(L=>{e({...r,check:{...r.check,operation:L.value??Ne.zT.EQ}})},[e,r]),g=(0,_.useCallback)(L=>{e({...r,check:{...r.check,value:L?.value}})},[e,r]),m=(0,_.useCallback)(L=>{e({...r,check:{...r.check,value:L}})},[e,r]),p=(0,_.useCallback)(L=>{e({...r,style:L})},[e,r]),v=(0,_.useCallback)(()=>{e(void 0)},[e]),y=r.check??Ao.check,w=Ro(y.property,a?.propertes),R=Ro(y.value,h);return _.createElement("div",{className:c.rule},_.createElement(It.C,{className:c.row},_.createElement(ut.I,{label:"Rule",labelWidth:d,grow:!0},_.createElement(Ti.l6,{placeholder:"Feature property",value:w.current,options:w.options,onChange:u,"aria-label":"Feature property",isClearable:!0,allowCustomValue:!0})),_.createElement(ut.I,{className:c.inline},_.createElement(Ti.l6,{value:Io.N.find(L=>L.value===y.operation),options:Io.N,onChange:f,"aria-label":"Comparison operator",width:8})),_.createElement(ut.I,{className:c.inline,grow:!0},_.createElement("div",{className:c.flexRow},(y.operation===Ne.zT.EQ||y.operation===Ne.zT.NEQ)&&_.createElement(Ti.l6,{placeholder:"value",value:R.current,options:R.options,onChange:g,"aria-label":"Comparison value",isClearable:!0,allowCustomValue:!0}),y.operation!==Ne.zT.EQ&&_.createElement(ln.Q,{key:`${y.property}/${y.operation}`,value:isNaN(Number(y.value))?0:Number(y.value),placeholder:"numeric value",onChange:m}))),_.createElement(yn.$n,{size:"md",icon:"trash-alt",onClick:()=>v(),variant:"secondary","aria-label":"Delete style rule",className:c.button})),_.createElement("div",null,_.createElement(ti,{value:r.style??P.T5,context:i,onChange:p,item:{settings:{simpleFixedValues:!0,layerInfo:o}}})))},Jh=r=>({rule:(0,ie.css)({marginBottom:r.spacing(1)}),row:(0,ie.css)({display:"flex",marginBottom:"4px"}),inline:(0,ie.css)({marginBottom:0,marginLeft:"4px"}),button:(0,ie.css)({marginLeft:"4px"}),flexRow:(0,ie.css)({display:"flex",flexDirection:"row",alignItems:"flex-start"})}),$h=({value:r,onChange:e,context:t,item:i})=>{const n=(0,ye.$j)(),s=i.settings,o=(0,_.useCallback)(()=>{const{palette:h}=n.visualization,c={fixed:h[Math.floor(Math.random()*h.length)]},d=[...r,{...Ao,style:{...P.T5,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(Kh,{value:h,onChange:a(c),context:t,item:d,key:`${c}-${h.check?.property}`})});return _.createElement(_.Fragment,null,l,_.createElement(yn.$n,{size:"sm",icon:"plus",onClick:o,variant:"secondary","aria-label":"Add geomap style rule"},"Add style rule"))},Wn={src:"public/maps/countries.geojson",rules:[],style:P.T5},Ao={style:P.T5,check:{property:"",operation:Ne.zT.EQ,value:""}},qh={id:"geojson",name:"GeoJSON",description:"Load static data from a geojson file",isBaseMap:!1,create:async(r,e,t,i)=>{const n={...Wn,...e.config},s=new ct({url:n.src,format:new Eo.A}),o=new Fn.m,a=s.on("change",()=>{s.getState()==="ready"&&((0,xs.e)(a),o.next(s.getFeatures()))}),l=[];if(n.rules){for(const f of n.rules)if(f.style){const g=await Wt(f.style);l.push({state:g,rule:f.check})}}{const f=await Wt(n.style);l.push({state:f})}const h=Object.values(P.Sq),c=Object.values(P.yQ),d=Object.values(P.yu),u=new Oe({source:s,style:f=>{const g=f.getGeometry()?.getType(),m=g==="Point"||g==="MultiPoint",p=g==="Polygon"||g==="MultiPolygon",v=g==="LineString"||g==="MultiLineString";for(const y of l){if(y.rule&&!Co(y.rule,f))continue;if(y.state.fields){const R={...y.state.base},{text:L}=y.state.fields;return L&&(R.text=`${f.get(L)}`),m?y.state.maker(R):sn(R)}const w=f.getProperties();if(p&&Object.keys(w).some(R=>h.includes(R))){const R={color:w[P.Sq.color]??y.state.base.color,opacity:w[P.Sq.opacity]??y.state.base.opacity,lineWidth:w[P.Sq.lineWidth]??y.state.base.lineWidth};return sn(R)}else if(v&&Object.keys(w).some(R=>d.includes(R))){const R={color:w[P.yu.color]??y.state.base.color,lineWidth:w[P.yu.lineWidth]??y.state.base.lineWidth};return y.state.maker(R)}else if(m&&Object.keys(w).some(R=>c.includes(R))){const R={color:w[P.yQ.color]??y.state.base.color,size:w[P.yQ.size]??y.state.base.size};return y.state.maker(R)}return m?(y.point||(y.point=y.state.maker(y.state.base)),y.point):(y.poly||(y.poly=sn(y.state.base)),y.poly)}}});return{init:()=>u,registerOptionsUI:f=>{const g=o.pipe((0,wo.$)(),(0,To.T)(m=>So(m)));f.addSelect({path:"config.src",name:"GeoJSON URL",settings:{options:(0,qe.G_)()??[],allowCustomValue:!0},defaultValue:Wn.src}).addCustomEditor({id:"config.style",path:"config.style",name:"Default style",description:"The style to apply when no rules above match",editor:ti,settings:{simpleFixedValues:!0,layerInfo:g},defaultValue:Wn.style}).addCustomEditor({id:"config.rules",path:"config.rules",name:"Style rules",description:"Apply styles based on feature properties",editor:$h,settings:{features:o,layerInfo:g},defaultValue:[]})}}},defaultOptions:Wn},Un=34962,Ys=34963,Qh=35040,ec=35044,Yn=35048,tc=5121,ic=5123,nc=5125,bo=5126,Lo=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function Xs(r,e){e=Object.assign({preserveDrawingBuffer:!0,antialias:!mr.oF},e);const t=Lo.length;for(let i=0;i{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,$.v6)(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 Mo=cc;function uc(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Hs(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 Nu={FRAGMENT_SHADER:35632,VERTEX_SHADER:35633},ni={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:tc,UNSIGNED_SHORT:ic,UNSIGNED_INT:nc,FLOAT:bo},Vn={};function Fo(r){return"shared/"+r}let Do=0;function dc(){const r="unique/"+Do;return Do+=1,r}function fc(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 gc(r){const e=Vn[r];if(!e||(e.users-=1,e.users>0))return;const t=e.canvas,n=Xs(t).getExtension("WEBGL_lose_context");n&&n.loseContext(),delete Vn[r]}class mc extends ac.A{constructor(e){super(),e=e||{},this.boundHandleWebGLContextLost_=this.handleWebGLContextLost.bind(this),this.boundHandleWebGLContextRestored_=this.handleWebGLContextRestored.bind(this),this.canvasCacheKey_=e.canvasCacheKey?Fo(e.canvasCacheKey):dc(),this.canvas_=fc(this.canvasCacheKey_),this.gl_=Xs(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,te.vt)(),this.offsetScaleMatrix_=(0,te.vt)(),this.tmpMat4_=uc(),this.uniformLocationsByProgram_={},this.attribLocationsByProgram_={},this.uniforms_=[],e.uniforms&&this.setUniforms(e.uniforms),this.postProcessPasses_=e.postProcesses?e.postProcesses.map(t=>new Mo({webGlContext:this.gl_,scaleRatio:t.scaleRatio,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms})):[new Mo({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,$.v6)(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,$.v6)(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_),gc(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{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,Hs(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,$.v6)(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,$.v6)(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,te.Zz)(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=pc(e);let i=0;for(let n=0;nthis.size_[0]||t>=this.size_[1])return Ot[0]=0,Ot[1]=0,Ot[2]=0,Ot[3]=0,Ot;this.readAll();const i=Math.floor(e)+(this.size_[1]-Math.floor(t)-1)*this.size_[0];return Ot[0]=this.data_[i*4],Ot[1]=this.data_[i*4+1],Ot[2]=this.data_[i*4+2],Ot[3]=this.data_[i*4+3],Ot}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 vc=yc,Js={GENERATE_POLYGON_BUFFERS:"GENERATE_POLYGON_BUFFERS",GENERATE_POINT_BUFFERS:"GENERATE_POINT_BUFFERS",GENERATE_LINE_STRING_BUFFERS:"GENERATE_LINE_STRING_BUFFERS"};var Wu=C(66570);const Ec=null,$s={vertexPosition:0,indexPosition:0};function jn(r,e,t,i,n){r[e+0]=t,r[e+1]=i,r[e+2]=n}function Uu(r,e,t,i,n,s){const l=3+n,h=r[e+0],c=r[e+1],d=Ec;d.length=n;for(let m=0;m0?J:Math.PI*2-J}const w=i!==null,R=n!==null;let L=0,D=0;if(w){const b=[r[i],r[i+1]],N=applyTransform(h,[...b]);L=y(m,p,N)}if(R){const b=[r[n],r[n+1]],N=applyTransform(h,[...b]);D=y(p,m,N)}s.push(f[0],f[1],g[0],g[1],v(0,L,D)),s.push(...a),s.push(f[0],f[1],g[0],g[1],v(1,L,D)),s.push(...a),s.push(f[0],f[1],g[0],g[1],v(2,L,D)),s.push(...a),s.push(f[0],f[1],g[0],g[1],v(3,L,D)),s.push(...a),o.push(u,u+1,u+2,u+1,u+3,u+2)}function Xu(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 g=0;g80*n){r=i=e[0],o=a=e[1];for(var y=n;yi&&(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=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;t0||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=oi?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=su?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.x&&r.x>=x&&o!==r.x&&E(in.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=(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;i0&&(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;n0?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{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;e0?a+(n-1)*r:null,n"u"?"data:application/javascript;base64,"+Cc.from(r,"binary").toString("base64"):URL.createObjectURL(new Blob([r],{type:"application/javascript"})))}class Ic extends xc{constructor(e,t){const i=t.uniforms||{},n=(0,te.vt)();i[ni.PROJECTION_MATRIX]=n,super(e,{uniforms:i,postProcesses:t.postProcesses}),this.sourceRevision_=-1,this.verticesBuffer_=new Zs(Un,Yn),this.hitVerticesBuffer_=new Zs(Un,Yn),this.indicesBuffer_=new Zs(Ys,Yn),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,T.S5)(),this.currentTransform_=n,this.renderTransform_=(0,te.vt)(),this.invertRenderTransform_=(0,te.vt)(),this.renderInstructions_=new Float32Array(0),this.hitRenderInstructions_=new Float32Array(0),this.hitRenderTarget_,this.lastSentId=0,this.worker_=Sc(),this.worker_.addEventListener("message",a=>{const l=a.data;if(l.type===Js.GENERATE_POINT_BUFFERS){const h=l.projectionTransform;l.hitDetection?(this.hitVerticesBuffer_.fromArrayBuffer(l.vertexBuffer),this.helper.flushBufferData(this.hitVerticesBuffer_)):(this.verticesBuffer_.fromArrayBuffer(l.vertexBuffer),this.helper.flushBufferData(this.verticesBuffer_)),this.indicesBuffer_.fromArrayBuffer(l.indexBuffer),this.helper.flushBufferData(this.indicesBuffer_),this.renderTransform_=h,(0,te.T9)(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,Je.KT)(o,Xe.ADDFEATURE,this.handleSourceFeatureAdded_,this),(0,Je.KT)(o,Xe.CHANGEFEATURE,this.handleSourceFeatureChanged_,this),(0,Je.KT)(o,Xe.REMOVEFEATURE,this.handleSourceFeatureDelete_,this),(0,Je.KT)(o,Xe.CLEAR,this.handleSourceFeatureClear_,this)],o.forEachFeature(a=>{this.featureCache_[(0,$.v6)(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 vc(this.helper))}handleSourceFeatureAdded_(e){const t=e.feature;this.featureCache_[(0,$.v6)(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()},this.featureCount_++}handleSourceFeatureChanged_(e){const t=e.feature;this.featureCache_[(0,$.v6)(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()}}handleSourceFeatureDelete_(e){const t=e.feature;delete this.featureCache_[(0,$.v6)(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,T.RG)(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 f=this.indicesBuffer_.getSize();do this.helper.makeProjectionTransform(e,this.currentTransform_),(0,te.Tl)(this.currentTransform_,u*h,0),(0,te.lw)(this.currentTransform_,this.invertRenderTransform_),this.helper.applyUniforms(e),this.helper.drawElements(0,f);while(++u{const t=this.weightFunction_(e);return t!==void 0?(0,xe.qE)(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(At.RADIUS)+this.get(At.BLUR))*2,u_blurSlope:()=>this.get(At.RADIUS)/Math.max(1,this.get(At.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 Lc(r){const i=(0,Ge.Y)(1,256),n=i.createLinearGradient(0,0,1,256),s=1/(r.length-1);for(let o=0,a=r.length;o{const n={...Zn,...e.config},s=await(0,St.nE)(e.location),o=new nn(s),a="_weight",l=new Mc({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,kn.getScaledDimension)(c,n.weight);o.forEachFeature(g=>{const m=g.get("rowIndex");m!=null&&g.set(a,d.get(m))});let u=["#00f","#0ff","#0f0","#ff0","#f00"];const f=d.field??c.fields.find(g=>g.type===F.PU.number);if(f){const g=(0,Zr.Qi)(f);g.isContinuous&&g.getColors&&(u=g.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:ei.gm,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:Zn.radius,settings:{min:1,max:50,step:1}}).addSliderInput({path:"config.blur",description:"Configures the amount of blur of clusters",name:"Blur",defaultValue:Zn.blur,settings:{min:1,max:50,step:1}})}}},defaultOptions:Zn},Oo={icon:"https://openlayers.org/en/latest/examples/data/icon.png"},Dc={id:"last-point-tracker",name:"Icon at last point",description:"Show an icon at the last point",isBaseMap:!1,showLocation:!0,state:xi.pn.alpha,create:async(r,e,t,i)=>{const n=new Ue.A({}),s={...Oo,...e.config};n.setStyle(new fe({image:new wn({src:s.icon})}));const o=new ct({features:[n]}),a=new Oe({source:o}),l=await(0,St.nE)(e.location);return{init:()=>a,update:h=>{const c=h.series[0];if(c&&c.length){const d=(0,St.FM)(c,l);if(!d.field)return;n.setGeometry(d.field.values[c.length-1])}}}},defaultOptions:Oo};var xt=function(r,e){var t=r[0]-e[0],i=r[1]-e[1];return Math.sqrt(t*t+i*i)},si=function(r,e){return r[0]==e[0]&&r[1]==e[1]},ju=function(r){return Pc(r.getGeometry())},Pc=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()))}},Zu=function(r,e){var t=[],i=r.length-1,n=i,s,o,a,l,h,c,d,u,f,g,m,p,v,y=si(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;w1e-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,f=(o*c-s*h+d-u)/(o-s),g=(s*o*(c-h)+o*d-s*u)/(o-s),p[0]-m[0]==0&&(f=p[0]+e*(p[1]-m[1])/Math.abs(p[1]-m[1]),g=o*f-o*c+u),v[0]-p[0]==0&&(f=v[0]+e*(v[1]-p[1])/Math.abs(v[1]-p[1]),g=s*f-s*h+d),t.push([f,g]));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},Hu=function(r,e){for(var t=0;te||r[o][1]>=e&&r[o+1][1]0;s--)(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)&&(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))}ko=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[2]&&(l[0]=t[2]),l[1]t[3]&&(l[1]=t[3])})})}),n?new Lt.Ay(s[0]):new bi.A(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;hn?(o=!0,d.push([i[0]+n/f*(u[0]-i[0]),i[1]+n/f*(u[1]-i[1])])):d.push(u)})})}),o?r.getType()==="Polygon"?new Lt.Ay(a[0]):new bi.A(a):r}}}else console.warn("[ol/geom/Circle~intersection] Unsupported geometry type: "+r.getType());return r},ze.A.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;t1&&h.push(new ze.A(l)),h.length?h:[this]};var Oc=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,_t._j)(e)}catch{this._color=[0,0,0,1]}}setColor2(e){try{this._color2=(0,_t._j)(e)}catch{this._color2=null}}setArrowColor(e){try{this._acolor=(0,_t.oJ)(e)}catch{this._acolor=null}}getColor(e,t){if(this._colorFn)return(0,_t.oJ)(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 f=this._splitInto(e,255,2),g=0,m=f.length;if(o.lineJoin="round",o.lineCap=this._lineCap||"butt",f.length>1)for(g=0;gt){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];nc){var m=(c-h)/l;u.push([d[0]+f*m,d[1]+g*m]),a.push(u),d=[d[0]+f*m*o,d[1]+g*m*o],u=[d],h=0}else h+=l,d=s,u.push(d),n++,s=e[n]}return a.push(u),a}};const Bo=Oc;var zo=C(48543);const vi={style:P.T5,showLegend:!1,edgeStyle:P.T5,arrow:0},Go="network",qu={type:Go,name:"",config:vi,location:{mode:Ne.aG.Auto}},kc={id:Go,name:"Network",description:"Render a node graph as a map layer",isBaseMap:!1,showLocation:!0,hideOpacity:!0,state:xi.pn.beta,create:async(r,e,t,i)=>{const n={...vi,...e?.config},s=await Wt(n.style),o=await Wt(n.edgeStyle),a=await(0,St.nE)(e.location),l=new nn(a),h=new Oe({source:l}),c=n.arrow===1||n.arrow===-1||n.arrow===2,d=new Fn.m(1);let u=null;return n.showLegend&&(u=_.createElement(Kr,{watch:d,initialSubProps:{},child:Hr})),h.setStyle(f=>{const g=f.getGeometry(),m=f.get("rowIndex"),p=s.dims;if(!s.fields&&!o.fields&&!c&&g?.getType()!=="LineString")return s.maker(s.base);if(g?.getType()==="LineString"&&g instanceof Ri.Ay){const y=o.dims,w=o.config.textConfig,R=Number(f.getId()),L=g.getCoordinates(),D=o.config.opacity??1;if(L&&y){const b=L[0],N=L[1],Z=(0,de.A)(i.visualization.getColorByName((y.color&&y.color.get(R))??o.base.color)).setAlpha(D).toString(),q=(0,de.A)(i.visualization.getColorByName((y.color&&y.color.get(R))??o.base.color)).setAlpha(D).toString(),he=(y.size&&y.size.get(R))??o.base.size,le=(y.size&&y.size.get(R))??o.base.size,Q=[],me=new Bo({visible:!0,lineCap:n.arrow===0?"round":"square",color:Z,color2:q,width:(y.size&&y.size.get(R))??o.base.size,width2:(y.size&&y.size.get(R))??o.base.size});n.arrow&&(me.setArrow(n.arrow),n.arrow>0?(me.setArrowColor(q),me.setArrowSize((le??0)*2)):(me.setArrowColor(Z),me.setArrowSize((he??0)*2)));const J=new ze.A([b,N]);me.setGeometry(J);const Y=i.typography.fontFamily;if(y.text||o.config.text?.mode===Ne.RU.Fixed){const U=new fe({zIndex:10,text:new gi({text:y.text?.get(R)??o.config.text?.fixed,font:`normal ${w?.fontSize}px ${Y}`,fill:new Ie({color:Z??P.T5.color.fixed}),stroke:new Te({color:(0,de.A)(i.visualization.getColorByName("text")).setAlpha(D).toString(),width:Math.max(w?.fontSize/10,1)}),...w})});U.setGeometry(J),Q.push(U)}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:f=>{if(!f.series?.length){l.clear();return}u&&d.next({styleConfig:s,size:s.dims?.size,layerName:e.name,layer:h});const g=(0,zo.CP)(f.series);for(const m of f.series)m===g.edges[0]?o.dims=(0,qe.ue)(m,o,i):s.dims=(0,qe.ue)(m,s,i),Bc(l,g)},registerOptionsUI:(f,g)=>{const m=(0,zo.CP)(g.data),p=m.nodes[0],v=m.edges[0];f.addCustomEditor({id:"config.style",category:["Node Styles"],path:"config.style",name:"Node Styles",editor:ti,settings:{displayRotation:!0,frameMatcher:y=>y===p},defaultValue:vi.style}).addCustomEditor({id:"config.edgeStyle",category:["Edge Styles"],path:"config.edgeStyle",name:"Edge Styles",editor:ti,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 Bc(r,e){r.clear(!0);const t=e.nodes[0],i=e.edges[0];if(!t||!i)return;const n=(0,St.FM)(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;uw===f),p=a.findIndex(w=>w===g);if(!s.values[m]||!s.values[p])continue;const v=new ze.A([s.values[m].getCoordinates(),s.values[p].getCoordinates()]),y=new Ue.A({geometry:v});y.setId(u),r.addFeatureInternal(y)}for(let u=0;u{const n={...Ut,...e?.config},s=await(0,St.nE)(e.location),o=new nn(s),a=new Oe({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 qs({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(),hn&&!hn.includes(d)&&hn.push(d)}})}),f=new fe({image:new qs({src:zc,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()}})}),g=new fe({image:new qs({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 hn&&hn.includes(d)?[f,u]:[f,g,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,kn.findField)(c,n.src);d&&(l=d?.values)}else for(let d=0;d{h.addFieldNamePicker({path:"config.src",name:"Image Source field",settings:{filter:c=>c.type===F.PU.string,noFieldsMessage:"No string fields found"}}).addRadio({path:"config.kind",name:"Kind",settings:{options:[{label:"Square",value:"square"},{label:"Circle",value:"circle"},{label:"Anchored",value:"anchored"},{label:"Folio",value:"folio"}]},defaultValue:Ut.kind}).addBooleanSwitch({path:"config.crop",name:"Crop",settings:{},defaultValue:Ut.crop}).addBooleanSwitch({path:"config.shadow",name:"Shadow",settings:{},defaultValue:Ut.shadow}).addSliderInput({path:"config.border",name:"Border",settings:{min:0,max:10},defaultValue:Ut.border}).addColorPicker({path:"config.color",name:"Border color",defaultValue:Ut.color,settings:[{enableNamedColors:!1}]}).addSliderInput({path:"config.radius",name:"Radius",settings:{min:1,max:100},defaultValue:Ut.radius})}}},defaultOptions:Ut};var Nc=C(99165),Uo=C(23596);const cn={style:{...P.T5,opacity:1,lineWidth:2},arrow:0},Yo="route",ed={type:Yo,name:"",config:cn,location:{mode:Ne.aG.Auto},tooltip:!1};var Wc=(r=>(r[r.x1=0]="x1",r[r.y1=1]="y1",r[r.x2=2]="x2",r[r.y2=3]="y2",r))(Wc||{});const er="#607D8B",Uc={id:Yo,name:"Route",description:"Render data points as a route",isBaseMap:!1,showLocation:!0,state:xi.pn.beta,create:async(r,e,t,i)=>{const n={...cn,...e?.config},s=await Wt(n.style),o=await(0,St.nE)(e.location),a=new nn(o),l=new Oe({source:a}),h=n.arrow===1||n.arrow===-1;if(!s.fields&&!h){const L=As(s.base);s.config.size&&s.config.size.fixed&&L.getStroke().setWidth(s.config.size.fixed),l.setStyle(L)}else l.setStyle(L=>{const D=L.get("rowIndex"),b=s.dims;if(!b||!(0,E.isNumber)(D))return As(s.base);const N=[],Z=L.getGeometry(),q=s.config.opacity??1;if(Z instanceof Ri.Ay){const le=Z.getCoordinates();if(le){let Q=0;const me=2;for(let J=0;J0?(B.setArrowColor(pe),B.setArrowSize((ke??0)*1.5)):(B.setArrowColor(H),B.setArrowSize((we??0)*1.5))),(0,qe.o3)(r,me,Y,U)){const Qe=new ze.A([Y,U]);B.setGeometry(Qe),N.push(B),Q=J+1}}if(N.length===0){const J=new Tt.A(le[0]),Y=((b.size&&b.size.get(0))??s.base.size??10)/2,U=(0,de.A)(i.visualization.getColorByName((b.color&&b.color.get(0))??s.base.color)).setAlpha(q).toString(),H=new fe({image:new Ct({radius:Y,fill:new Ie({color:U})})});H.setGeometry(J),N.push(H)}}return N}const he={...s.base};return b.color&&(he.color=b.color.get(D)),As(he)});const c=new Ue.A({}),d=new Ue.A({}),u=new Ue.A({}),f=[d,u],g=(s.base.lineWidth||6)+3,m=new fe({image:new Ct({radius:g,stroke:new Te({color:(0,Uo.alpha)(er,1),width:1}),fill:new Ie({color:(0,Uo.alpha)(er,.4)})})}),p=new fe({stroke:new Te({color:er,width:1,lineDash:[3,3],lineCap:"square"})}),v=new Oe({source:new ct({features:[c]}),style:m}),y=new Oe({source:new ct({features:f}),style:p}),w=new Nn.A({layers:[l,v,y]}),R=new K.yU;return R.add(t.getStream(ee.b_).pipe((0,Nc.c)(8)).subscribe({next:L=>{const D=r.getView().calculateExtent(r.getSize()),N=a.getFeatures()[0]?.get("frame"),Z=L.payload?.point?.time;if(N&&Z){const q=N.fields.find(he=>he.type===F.PU.time);if(q){const he=q.values,le=Yc(he,Z);if(le!==null){const Q=(0,St.FM)(N,o);if(Q.field){const me=Q.field.values[le],J=me.getCoordinates();c.setGeometry(me),c.setStyle(m),d.setGeometry(new ze.A([[D[0],J[1]],[D[2],J[1]]])),u.setGeometry(new ze.A([[J[0],D[1]],[J[0],D[3]]])),f.forEach(Y=>Y.setStyle(p))}}}}}})),R.add(t.subscribe(ee.ql,L=>{c.setStyle(new fe({})),f.forEach(D=>D.setStyle(new fe({})))})),{init:()=>w,dispose:()=>R.unsubscribe(),update:L=>{if(L.series?.length)for(const D of L.series){(s.fields||h)&&(s.dims=(0,qe.ue)(D,s,i)),a.updateLineString(D);break}},registerOptionsUI:L=>{L.addCustomEditor({id:"config.style",path:"config.style",name:"Style",editor:ti,settings:{simpleFixedValues:!1},defaultValue:cn.style}).addRadio({path:"config.arrow",name:"Arrow",settings:{options:[{label:"None",value:0},{label:"Forward",value:1},{label:"Reverse",value:-1}]},defaultValue:cn.arrow})}}},defaultOptions:cn};function Yc(r,e){if(r.length===0)return null;if(r.length===1)return 0;const t=r.length-1;if(er[t])return t;const i=Math.abs(Math.round(t*(e-r[0])/(r[t]-r[0])));if(e0;n--)if(e>r[n])return n0?n-1:0;return t}}const Xo=[Kl,Fc,Dc,qh,Hh,Vh,Uc,Gc,kc],zi={type:"default",name:"",config:{}},Vo={id:zi.type,name:"Default base layer",isBaseMap:!0,create:(r,e,t,i)=>{const n=fi.$W?.geomapDefaultBaseLayerConfig?.type;if(n){const s=un.getIfExists(n);if(!s)throw new Error("Invalid basemap configuration on server");return s.create(r,fi.$W.geomapDefaultBaseLayerConfig,t,i)}return mo.create(r,e,t,i)}},un=new On.O(()=>[Vo,...Us,...Xo]);function jo(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.pn.alpha:if(!fi.yn)break;s.label=`${n.name} (Alpha)`,s.icon="bolt",i.push(s);break;case xi.pn.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 Zo(r,e){return jo(r?[Vo,...Us]:[...Xo,...Us],e)}const td={layers:[]},Ho={allLayers:!0,id:"zero",lat:0,lon:0,zoom:1};var Gi=(r=>(r.Details="details",r.None="none",r))(Gi||{}),Xc=(r=>(r.Coords="coords",r.Fit="fit",r.Zero="zero",r))(Xc||{}),Vc=C(13752),Ko=C(85200);const tr=(r,e,t)=>{if(r.update){let i=t;if(e.filterData){const n=(0,Ko.Dq)(e.filterData);i={...i,series:i.series.filter(n)}}r.update(i)}};async function jc(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;aa,onChange:h=>{jc(r,a,h)}};return r.byName.set(a,l),l.layer.__state=l,tr(s,t,r.props.data),l}const Jo=r=>r?.__state,Zc=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=un.getIfExists(t);i&&Kn(r,r.map,{type:i.id,name:(0,qe.q)(r),config:(0,E.cloneDeep)(i.defaultOptions),location:i.showLocation?{mode:Ne.aG.Auto}:void 0,tooltip:!0,...!i.hideOpacity&&{opacity:P.T5.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 Hc(r=[],e=!1,t=!1,i){return r.filter(n=>n.layer instanceof Oe||n.layer instanceof Nn.A).flatMap(n=>{const s=n.layer;if(s instanceof Nn.A)return Kc(s);if(s instanceof Oe){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(T.X$,(0,T.S5)())}function Kc(r){return r.getLayers().getArray().filter(e=>e instanceof Oe).map(e=>e instanceof Oe?e.getSource().getExtent()??[]:[])}const Jc=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.ql)})},$c=(r,e)=>{$o(r,e)&&(r.preventDefault(),r.stopPropagation(),e.mapDiv.style.cursor="auto",e.setState({ttipOpen:!0}))},$o=(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,X.WP)(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 f=Jo(d);if(!s.data){const g=c.getProperties(),m=g.frame;m&&(s.data=l.data=m,s.rowIndex=l.rowIndex=g.rowIndex),f?.mouseEvents&&f.mouseEvents.next(c)}if(f){let g=a.get(f);g||(g={layer:f,features:[]},a.set(f,g),o.push(g)),g.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 dn=new On.O(()=>[{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 ir;class qo extends _.Component{constructor(e){super(e),this.panelContext=void 0,this.subs=new K.yU,this.globalCSS=Pl(tt.$.theme2),this.hoverPayload={point:{},pageX:-1,pageY:-1},this.hoverEvent=new ee.b_(this.hoverPayload),this.layers=[],this.byName=new Map,this.actions=Zc(this),this.initMapRef=async t=>{if(!t)return;this.mapDiv=t,this.map&&this.map.dispose();const{options:i}=this.props,n=(0,qe.rd)(this,i,t);this.byName.clear();const s=[];try{s.push(await Kn(this,n,i.basemap??zi,!0)),i.layers||(i.layers=[Ms]);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 j.A,this.map?.addInteraction(this.mouseWheelZoom),(0,qe.cA)(this,i),Jc(this),(0,qe.Bz)(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=>{$c(t,this)},this.pointerMoveListener=t=>{$o(t,this)},this.initMapView=t=>{let i=new hi.Ay({center:[0,0],zoom:1,showFullExtent:!0});return t.shared&&(ir?i=ir:ir=i),this.initViewExtent(i,t),i},this.state={ttipOpen:!1,legends:[]},this.subs.add(this.props.eventBus.subscribe(ce.i0,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 Vr&&(this.map?.removeLayer(s),this.map?.addLayer(s))}),i({...t,basemap:n[0].options,layers:n.slice(1).map(s=>s.options)}),(0,qe.Bz)(this,n,e),this.setState({legends:this.getLegends()})}optionsChanged(e){const t=this.props.options;if(e.view!==t.view){const i=this.initMapView(e.view);this.map&&i&&this.map.setView(i)}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)tr(i.handler,i.options,this.props.data);const t=dn.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=dn.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=Hc(this.layers,t.allLayers,t.lastOnly,t.layer);if(!(0,T.Im)(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,X.Rb)(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 G.A),e.showScale&&this.map.addControl(new z({units:e.scaleUnits,minWidth:100})),this.mouseWheelZoom.setActive(!!e.mouseWheelZoom),e.showAttribution&&this.map.addControl(new ci.A({collapsed:!0,collapsible:!0}));let t=[];e.showMeasure&&(t=[_.createElement(Fl,{key:"measure",map:this.map,menuActiveState:n=>{this.setState({ttipOpen:n,measureMenuActive:n})}})]);let i=[];e.showDebug&&(i=[_.createElement(ha,{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(nt.Global,{styles:this.globalCSS}),_.createElement("div",{className:Qo.wrap,onMouseLeave:this.clearTooltip},_.createElement("div",{className:Qo.map,ref:this.initMapRef}),_.createElement(_e,{bottomLeft:n,topRight1:i,topRight2:s,blStyle:{bottom:a?"35px":"8px"}})),_.createElement(xn,{ttip:e,isOpen:t,onClose:this.tooltipPopupClosed}))}}qo.contextType=ge.e4;const Qo={wrap:(0,ie.css)({position:"relative",width:"100%",height:"100%"}),map:(0,ie.css)({position:"absolute",zIndex:0,width:"100%",height:"100%"})};var qc=C(58313),nr=C(75494),Qc=C(14578),eu=C(54391);const tu="layer-drag-drop-list",ea=({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,ye.of)(iu),u=f=>f?`${d.row} ${d.sel}`:d.row;return _.createElement(nr.JY,{onDragEnd:t},_.createElement(nr.gL,{droppableId:"droppable"},(f,g)=>_.createElement("div",{...f.droppableProps,ref:f.innerRef,"data-testid":tu},(()=>{const m=[],p=l?1:0,v=l?2:1;for(let y=r.length-1;y>=p;y--){const w=r[y],R=w.getName(),L=!!a?.includes(R);m.push(_.createElement(nr.sx,{key:R,draggableId:R,index:m.length},(D,b)=>_.createElement("div",{className:u(L),ref:D.innerRef,...D.draggableProps,...D.dragHandleProps,onMouseDown:()=>i(w),role:"button",tabIndex:0},_.createElement(eu.R,{name:R,onChange:N=>h(w,N),verifyLayerNameUniqueness:c??void 0}),_.createElement("div",{className:d.textWrapper},"\xA0 ",e(w)),o(w)&&_.createElement(_.Fragment,null,s?_.createElement(ss.K,{name:"copy",tooltip:"Duplicate",className:d.actionIcon,onClick:()=>s(w)}):null,_.createElement(ss.K,{name:"trash-alt",tooltip:"Remove",className:(0,ie.cx)(d.actionIcon,d.dragIcon),onClick:()=>n(w)})),r.length>v&&_.createElement(Qc.I,{"aria-label":"Drag and drop icon",title:"Drag and drop to reorder",name:"draggabledots",size:"lg",className:d.dragIcon}))))}return m})(),f.placeholder)))};ea.defaultProps={isGroup:()=>!1};const iu=r=>({wrapper:(0,ie.css)({marginBottom:r.spacing(2)}),row:(0,ie.css)({padding:r.spacing(.5,1),borderRadius:r.shape.radius.default,background:r.colors.background.secondary,minHeight:r.spacing(4),display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"3px",cursor:"pointer",border:`1px solid ${r.components.input.borderColor}`,"&:hover":{border:`1px solid ${r.components.input.borderHover}`}}),sel:(0,ie.css)({border:`1px solid ${r.colors.primary.border}`,"&:hover":{border:`1px solid ${r.colors.primary.border}`}}),dragIcon:(0,ie.css)({cursor:"drag"}),actionIcon:(0,ie.css)({color:r.colors.text.secondary,"&:hover":{color:r.colors.text.primary}}),typeWrapper:(0,ie.css)({color:r.colors.primary.text,marginRight:"5px"}),textWrapper:(0,ie.css)({display:"flex",alignItems:"center",flexGrow:1,overflow:"hidden",marginRight:r.spacing(1)})}),nu=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 f=d.length-1,g=(c.source.index-f)*-1,m=(c.destination.index-f)*-1;u.reorder(g,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(Is.mc,null,_.createElement(qc.r,{onChange:c=>i.addlayer(c.value),options:Zo(!1).options,label:"Add layer"})),_.createElement("br",null),_.createElement(ea,{layers:e,showActions:()=>e.length>2,getLayerInfo:a,onDragEnd:n,onSelect:s,onDelete:o,selection:h,excludeBaseLayer:!0,onNameChange:l,verifyLayerNameUniqueness:i.canRename}))},su=({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.C,null,_.createElement(ut.I,{label:"Latitude",labelWidth:r,grow:!0},_.createElement(ln.Q,{value:e.lat,min:-90,max:90,step:.001,onChange:i}))),_.createElement(It.C,null,_.createElement(ut.I,{label:"Longitude",labelWidth:r,grow:!0},_.createElement(ln.Q,{value:e.lon,min:-180,max:180,step:.001,onChange:n}))))};var ta=(r=>(r.all="all",r.layer="layer",r.last="last",r))(ta||{}),ia=(r=>(r.all="All layers",r.layer="Layer",r.last="Last value",r))(ia||{});const ru=Object.values(ta).map(r=>({label:ia[r],value:r})),ou=({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.C,null,_.createElement(ut.I,{label:"Layer",labelWidth:r,grow:!0},_.createElement(Ti.l6,{options:n,onChange:s,placeholder:n[0]?.label}))),a=d=>{t({...e,padding:d})},l=_.createElement(It.C,null,_.createElement(ut.I,{label:"Padding",labelWidth:r,grow:!0,tooltip:"sets padding in relative percent beyond data extent"},_.createElement(ln.Q,{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.C,null,_.createElement(ut.I,{label:"Data",labelWidth:r,grow:!0},_.createElement(wi.z,{value:h,options:ru,onChange:c}))),!e?.allLayers&&o,!e?.lastOnly&&l)},au=({value:r,onChange:e,context:t})=>{const n=(0,_.useMemo)(()=>{const a=[];return r?.id?a.push(r.id):a.push(dn.list()[0].id),dn.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,X.WP)(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=dn.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.C,null,_.createElement(ut.I,{label:"View",labelWidth:10,grow:!0},_.createElement(Ti.l6,{options:n.options,value:n.current,onChange:o}))),r.id===yt.Coordinates&&_.createElement(su,{labelWidth:10,value:r,onChange:e}),r.id===yt.Fit&&_.createElement(ou,{labelWidth:10,value:r,onChange:e,context:t}),_.createElement(It.C,null,_.createElement(ut.I,{label:r?.id===yt.Fit?"Max Zoom":"Zoom",labelWidth:10,grow:!0},_.createElement(ln.Q,{value:r?.zoom??1,min:1,max:18,step:.01,onChange:a=>{e({...r,zoom:a})}}))),_.createElement(Is.gW,null,_.createElement(yn.$n,{variant:"secondary",size:"sm",fullWidth:!0,onClick:s},_.createElement("span",null,"Use current map settings"))))};var lu=C(54612),hu=C(61983),cu=C(19743);function na(r){return{category:r.category,path:"--",defaultValue:r.basemaps?zi:Ms,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=un.getIfExists(i);if(o){const a={...s,type:o.id,config:{...o.defaultOptions}};o.showLocation&&(a.location?.mode?delete a.location:a.location={mode:Ne.aG.Auto}),n.onChange(a);return}}n.onChange((0,lu.Sf)(s,t,i))}}),build:(e,t)=>{if(!r.state)return;const{handler:i,options:n}=r.state,s=un.getIfExists(n?.type),o=Zo(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:cu.x,defaultValue:void 0}),!!s&&n.type!==zi.type){if(s.showLocation){let a=t.data;if(n.filterData){const l=(0,Ko.Dq)(n.filterData);a=a.filter(l)}(0,hu.G)("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 uu=C(75059),du=C(18282),fu=C(50082);const gu=(r,e,t,i)=>{if(e==="grafana-worldmap-panel"&&t.angular){const{fieldConfig:n,options:s,xform:o}=mu({...t.angular,fieldConfig:i});return o?.id?.length&&(r.transformations=r.transformations?[...r.transformations,o]:[o]),r.fieldConfig=n,s}return{}};function mu(r){const e={defaults:{},overrides:[]},t=(0,E.cloneDeep)(Ms),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=uu.AS.getIfExists(r.valueName);if(a&&r.locationData?.length)switch(o={id:du.F.reduce,options:{reducers:[a.id]}},r.locationData){case"countries":case"countries_3letter":t.location={mode:Ne.aG.Lookup,gazetteer:"public/gazetteer/countries.json",lookup:void 0};break;case"states":t.location={mode:Ne.aG.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:fu.O.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 pu=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)(P.T5),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=Zl(n.shape);return o&&(s.style.symbol={fixed:o,mode:Ne.q_.Fixed}),{...r.options,layers:[{...i,config:s}]}}}return r.options},_u=new se.m(qo).setNoPadding().setPanelChangeHandler(gu).setMigrationHandler(pu).useFieldConfig({useCustomConfig:r=>{it.e(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:au,defaultValue:Ho}),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:Ho.shared});const i=e.instanceState;if(i?.layers){const n=["Map layers"],s=["Basemap layer"];r.addCustomEditor({category:n,id:"layers",path:"",name:"",editor:nu});const o=i.layers[i.selected];i.selected&&o&&r.addNestedOptions(na({state:o,category:n,basemaps:!1}));const a=i.layers[0];tt.$.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(na({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"}]}})})},35341:function(Bt){(function(Re,C){Bt.exports=C()})(this,function(){"use strict";function Re(I,A,z,G,T){(function j(K,ee,ge,ce,ye){for(;ce>ge;){if(ce-ge>600){var _e=ce-ge+1,Fe=ee-ge+1,je=Math.log(_e),He=.5*Math.exp(2*je/3),gt=.5*Math.sqrt(je*He*(_e-He)/_e)*(Fe-_e/2<0?-1:1),x=Math.max(ge,Math.floor(ee-Fe*He/_e+gt)),S=Math.min(ce,Math.floor(ee+(_e-Fe)*He/_e+gt));j(K,ee,x,S,ye)}var E=K[ee],F=ge,M=ce;for(C(K,ge,ee),ye(K[ce],E)>0&&C(K,ge,ce);F0;)M--}ye(K[ge],E)===0?C(K,ge,M):C(K,++M,ce),M<=ee&&(ge=M+1),ee<=M&&(ce=M-1)}})(I,A,z||0,G||I.length-1,T||_)}function C(I,A,z){var G=I[A];I[A]=I[z],I[z]=G}function _(I,A){return IA?1:0}var se=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 tt(I,A,z){if(!z)return A.indexOf(I);for(var G=0;G=I.minX&&A.maxY>=I.minY}function Pe(I){return{children:I,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function lt(I,A,z,G,T){for(var j=[A,z];j.length;)if(!((z=j.pop())-(A=j.pop())<=G)){var K=A+Math.ceil((z-A)/G/2)*G;Re(I,K,A,z,T),j.push(A,K,K,z)}}return se.prototype.all=function(){return this._all(this.data,[])},se.prototype.search=function(I){var A=this.data,z=[];if(!ue(I,A))return z;for(var G=this.toBBox,T=[];A;){for(var j=0;j=0&&T[A].children.length>this._maxEntries;)this._split(T,A),A--;this._adjustParentBBoxes(G,T,A)},se.prototype._split=function(I,A){var z=I[A],G=z.children.length,T=this._minEntries;this._chooseSplitAxis(z,T,G);var j=this._chooseSplitIndex(z,T,G),K=Pe(z.children.splice(j,z.children.length-j));K.height=z.height,K.leaf=z.leaf,it(z,this.toBBox),it(K,this.toBBox),A?I[A-1].children.push(K):this._splitRoot(z,K)},se.prototype._splitRoot=function(I,A){this.data=Pe([I,A]),this.data.height=I.height+1,this.data.leaf=!1,it(this.data,this.toBBox)},se.prototype._chooseSplitIndex=function(I,A,z){for(var G,T,j,K,ee,ge,ce,ye=1/0,_e=1/0,Fe=A;Fe<=z-A;Fe++){var je=ie(I,0,Fe,this.toBBox),He=ie(I,Fe,z,this.toBBox),gt=(T=je,j=He,K=void 0,ee=void 0,ge=void 0,ce=void 0,K=Math.max(T.minX,j.minX),ee=Math.max(T.minY,j.minY),ge=Math.min(T.maxX,j.maxX),ce=Math.min(T.maxY,j.maxY),Math.max(0,ge-K)*Math.max(0,ce-ee)),x=De(je)+De(He);gt=A;ye--){var _e=I.children[ye];nt(K,I.leaf?T(_e):_e),ee+=Be(K)}return ee},se.prototype._adjustParentBBoxes=function(I,A,z){for(var G=z;G>=0;G--)nt(A[G],I)},se.prototype._condense=function(I){for(var A=I.length-1,z=void 0;A>=0;A--)I[A].children.length===0?A>0?(z=I[A-1].children).splice(z.indexOf(I[A]),1):this.clear():it(I[A],this.toBBox)},se})}}]);
//# sourceMappingURL=9320.c403e78b78aa6df1d0bd.js.map