import{B as Ie,M as Ue,C as le,u as z,i as Xe,V as K,a as Ze,T as be,I as ze,H as je,g as Fe,b as J,G as Ye,c as Y,S as P,F as I,d as O,R as ie,e as V,f as M,t as se,h as Ke,P as R,L as A,j as ae,k as re,l as Je,m as We,n as T,o as ne,p as Ee,q as Q,r as ye,s as me,v as ee,w as de,x as te,y as ge,z as Ne,A as Se,D as $e,E as Qe,J as et,K as j,N as ke,O as tt,Q as it,U as rt}from"./openlayers-D2I-bVN2.js";var st=class extends Ie{constructor(e){e=e||{},super();var t=this.input=e.input;t||(t=this.input=document.createElement("input"),e.type&&t.setAttribute("type",e.type),e.min!==void 0&&t.setAttribute("min",e.min),e.max!==void 0&&t.setAttribute("max",e.max),e.step!==void 0&&t.setAttribute("step",e.step),e.parent&&e.parent.appendChild(t)),e.disabled&&(t.disabled=!0),e.checked!==void 0&&(t.checked=!!e.checked),e.val!==void 0&&(t.value=e.val),e.hidden&&t.classList.add("ol-input-hidden"),t.addEventListener("focus",function(){this.element&&this.element.classList.add("ol-focus")}.bind(this));var i;t.addEventListener("focusout",function(){this.element&&(i&&clearTimeout(i),i=setTimeout(function(){this.element.classList.remove("ol-focus")}.bind(this),0))}.bind(this))}_listenDrag(e,t){var i=function(r){this.moving=!0,this.element.classList.add("ol-moving");var s=function(a){a.type==="pointerup"&&(document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",s),document.removeEventListener("pointercancel",s),setTimeout(function(){this.moving=!1,this.element.classList.remove("ol-moving")}.bind(this))),a.target===e&&t(a),a.stopPropagation(),a.preventDefault()}.bind(this);document.addEventListener("pointermove",s,!1),document.addEventListener("pointerup",s,!1),document.addEventListener("pointercancel",s,!1),r.stopPropagation(),r.preventDefault()}.bind(this);e.addEventListener("mousedown",i,!1),e.addEventListener("touchstart",i,!1)}setValue(e){e!==void 0&&(this.input.value=e),this.input.dispatchEvent(new Event("change"))}getValue(){return this.input.value}getInputElement(){return this.input}},pe=class extends st{constructor(e){e=e||{},super(e);var t=this.element=document.createElement("label");e.html instanceof Element?t.appendChild(e.html):e.html!==void 0&&(t.innerHTML=e.html),t.className=("ol-ext-check ol-ext-checkbox "+(e.className||"")).trim(),this.input.parentNode&&this.input.parentNode.insertBefore(t,this.input),t.appendChild(this.input),t.appendChild(document.createElement("span")),e.after&&t.appendChild(document.createTextNode(e.after)),this.input.addEventListener("change",function(){this.dispatchEvent({type:"check",checked:this.input.checked,value:this.input.value})}.bind(this))}isChecked(){return this.input.checked}},at=class extends pe{constructor(e){e=e||{},super(e),this.element.className=("ol-ext-toggle-switch "+(e.className||"")).trim()}},nt=class extends pe{constructor(e){e=e||{},super(e),this.element.className=("ol-ext-check ol-ext-radio "+(e.className||"")).trim()}},h={};h.create=function(o,e){e=e||{};var t;if(o==="TEXT")t=document.createTextNode(e.html||""),e.parent&&e.parent.appendChild(t);else{t=document.createElement(o.toLowerCase()),/button/i.test(o)&&t.setAttribute("type","button");for(var i in e)switch(i){case"className":{e.className&&e.className.trim&&t.setAttribute("class",e.className.trim());break}case"text":{t.innerText=e.text;break}case"html":{e.html instanceof Element?t.appendChild(e.html):e.html!==void 0&&(t.innerHTML=e.html);break}case"parent":{e.parent&&e.parent.appendChild(t);break}case"options":{if(/select/i.test(o))for(var r in e.options)h.create("OPTION",{html:r,value:e.options[r],parent:t});break}case"style":{h.setStyle(t,e.style);break}case"change":case"click":{h.addListener(t,i,e[i]);break}case"on":{for(var s in e.on)h.addListener(t,s,e.on[s]);break}case"checked":{t.checked=!!e.checked;break}default:{t.setAttribute(i,e[i]);break}}}return t};h.createSwitch=function(o){var e=h.create("INPUT",{type:"checkbox",on:o.on,click:o.click,change:o.change,parent:o.parent}),t=Object.assign({input:e},o||{});return new at(t),e};h.createCheck=function(o){var e=h.create("INPUT",{name:o.name,type:o.type==="radio"?"radio":"checkbox",on:o.on,parent:o.parent}),t=Object.assign({input:e},o||{});return o.type==="radio"?new nt(t):new pe(t),e};h.setHTML=function(o,e){e instanceof Element?o.appendChild(e):e!==void 0&&(o.innerHTML=e)};h.appendText=function(o,e){o.appendChild(document.createTextNode(e||""))};h.addListener=function(o,e,t,i){typeof e=="string"&&(e=e.split(" ")),e.forEach(function(r){o.addEventListener(r,t,i)})};h.removeListener=function(o,e,t){typeof e=="string"&&(e=e.split(" ")),e.forEach(function(i){o.removeEventListener(i,t)})};h.show=function(o){o.style.display=""};h.hide=function(o){o.style.display="none"};h.hidden=function(o){return h.getStyle(o,"display")==="none"};h.toggle=function(o){o.style.display=o.style.display==="none"?"":"none"};h.setStyle=function(o,e){for(var t in e)switch(t){case"top":case"left":case"bottom":case"right":case"minWidth":case"maxWidth":case"width":case"height":{typeof e[t]=="number"?o.style[t]=e[t]+"px":o.style[t]=e[t];break}default:o.style[t]=e[t]}};h.getStyle=function(o,e){var t,i=(o.ownerDocument||document).defaultView;if(i&&i.getComputedStyle)e=e.replace(/([A-Z])/g,"-$1").toLowerCase(),t=i.getComputedStyle(o,null).getPropertyValue(e);else if(o.currentStyle&&(e=e.replace(/-(\w)/g,function(r,s){return s.toUpperCase()}),t=o.currentStyle[e],/^\d+(em|pt|%|ex)?$/i.test(t)))return(function(r){var s=o.style.left,a=o.runtimeStyle.left;return o.runtimeStyle.left=o.currentStyle.left,o.style.left=r||0,r=o.style.pixelLeft+"px",o.style.left=s,o.runtimeStyle.left=a,r})(t);return/px$/.test(t)?parseInt(t):t};h.outerHeight=function(o){return o.offsetHeight+h.getStyle(o,"marginBottom")};h.outerWidth=function(o){return o.offsetWidth+h.getStyle(o,"marginLeft")};h.offsetRect=function(o){var e=o.getBoundingClientRect();return{top:e.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),left:e.left+(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0),height:e.height||e.bottom-e.top,width:e.width||e.right-e.left}};h.getFixedOffset=function(o){var e={left:0,top:0},t=function(i){if(!i)return e;if(h.getStyle(i,"position")==="absolute"&&h.getStyle(i,"transform")!=="none"){var r=i.getBoundingClientRect();return e.left+=r.left,e.top+=r.top,e}return t(i.offsetParent)};return t(o.offsetParent)};h.positionRect=function(o,e){var t=0,i=0,r=function(s){if(s)return t+=s.offsetLeft,i+=s.offsetTop,r(s.offsetParent);var a={top:o.offsetTop+i,left:o.offsetLeft+t};return e&&(a.top-=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,a.left-=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0),a.bottom=a.top+o.offsetHeight,a.right=a.top+o.offsetWidth,a};return r(o.offsetParent)};h.scrollDiv=function(o,e){e=e||{};var t=!1,i=0,r,s=0,a=typeof e.onmove=="function"?e.onmove:function(){},n=e.vertical?"screenY":"screenX",l=e.vertical?"scrollTop":"scrollLeft",u=!1,g,c,f=0,d=function(){E&&(f++,setTimeout(v))},v=function(){if(E){if(f--,f)return;var m=o.clientHeight,k=o.scrollHeight;g=m/k,E.style.height=g*100+"%",E.style.top=o.scrollTop/k*100+"%",L.style.height=m+"px",m>k-.5?L.classList.add("ol-100pc"):L.classList.remove("ol-100pc")}},_=function(m){m.target.classList.contains("ol-noscroll")||(u=!1,t=m[n],s=new Date,o.classList.add("ol-move"),m.preventDefault(),window.addEventListener("pointermove",y),h.addListener(window,["pointerup","pointercancel"],D))},y=function(m){if(t!==!1){var k=(c?-1/g:1)*(t-m[n]);u=u||Math.round(k),o[l]+=k,r=new Date,r-s&&(i=(i+k/(r-s))/2),t=m[n],s=r,k&&a(!0)}else u=!0},w=function(m){var k=m>0?Math.min(100,m/2):Math.max(-100,m/2);m-=k,o[l]+=k,-1100||c?i=0:s>0&&(i=((i||0)+(t-m[n])/s)/2),w(e.animate===!1?0:i*200),t=!1,i=0,s=0,o.classList.contains("ol-move")?o.classList.remove("ol-hasClick"):(o.classList.add("ol-hasClick"),setTimeout(function(){o.classList.remove("ol-hasClick")},500)),c=!1,window.removeEventListener("pointermove",y),h.removeListener(window,["pointerup","pointercancel"],D)},p=function(m){var k=Math.max(-1,Math.min(1,m.wheelDelta||-m.detail));return o.classList.add("ol-move"),o[l]-=k*30,o.classList.remove("ol-move"),!1};return e.mousewheel&&h.addListener(o,["mousewheel","DOMMouseScroll","onmousewheel"],p),{refresh:d}};h.dispatchEvent=function(o,e){var t;try{t=new CustomEvent(o)}catch{t=document.createEvent("CustomEvent"),t.initCustomEvent(o,!0,!0,{})}e.dispatchEvent(t)};h.setCursor=function(o,e){o instanceof Ue&&(o=o.getTargetElement()),!("ontouchstart"in window)&&o instanceof Element&&(o.style.cursor=e)};var ot=class extends le{constructor(e){e=e||{};var t=h.create("DIV",{className:e.switcherClass||"ol-layerswitcher"});super({element:t,target:e.target});var i=this;this.dcount=0,this.show_progress=e.show_progress,this.oninfo=typeof e.oninfo=="function"?e.oninfo:null,this.onextent=typeof e.onextent=="function"?e.onextent:null,this.hasextent=e.extent||e.onextent,this.hastrash=e.trash,this.reordering=e.reordering!==!1,this._layers=[],this._layerGroup=e.layerGroup&&e.layerGroup.getLayers?e.layerGroup:null,this.onchangeCheck=typeof e.onchangeCheck=="function"?e.onchangeCheck:null,typeof e.displayInLayerSwitcher=="function"&&(this.displayInLayerSwitcher=e.displayInLayerSwitcher),e.target||(t.classList.add("ol-unselectable"),t.classList.add("ol-control"),t.classList.add(e.collapsed!==!1?"ol-collapsed":"ol-forceopen"),e.counter&&t.classList.add("ol-counter"),this.counter=h.create("SPAN",{class:"ol-counter",text:0,parent:t}),this.button=h.create("BUTTON",{type:"button",parent:t}),this.button.addEventListener("touchstart",function(r){t.classList.toggle("ol-forceopen"),t.classList.add("ol-collapsed"),i.dispatchEvent({type:"toggle",collapsed:t.classList.contains("ol-collapsed")}),r.preventDefault(),i.overflow()}),this.button.addEventListener("click",function(){t.classList.toggle("ol-forceopen"),t.classList.add("ol-collapsed"),i.dispatchEvent({type:"toggle",collapsed:!t.classList.contains("ol-forceopen")}),i.overflow()}),e.mouseover&&(t.addEventListener("mouseleave",function(){t.classList.add("ol-collapsed"),i.dispatchEvent({type:"toggle",collapsed:!0})}),t.addEventListener("mouseover",function(){t.classList.remove("ol-collapsed"),i.dispatchEvent({type:"toggle",collapsed:!1})})),e.minibar&&(e.noScroll=!0),e.noScroll||(this.topv=h.create("DIV",{className:"ol-switchertopdiv",parent:t,click:function(){i.overflow("+50%")}}),this.botv=h.create("DIV",{className:"ol-switcherbottomdiv",parent:t,click:function(){i.overflow("-50%")}})),this._noScroll=e.noScroll),this.panel_=h.create("UL",{className:"panel"}),this.panelContainer_=h.create("DIV",{className:"panel-container",html:this.panel_,parent:t}),!e.target&&!e.noScroll&&h.addListener(this.panel_,"mousewheel DOMMouseScroll onmousewheel",function(r){i.overflow(Math.max(-1,Math.min(1,r.wheelDelta||-r.detail)))&&(r.stopPropagation(),r.preventDefault())}),this.header_=h.create("LI",{className:"ol-header",parent:this.panel_}),this.set("drawDelay",e.drawDelay||0),this.set("selection",e.selection),e.minibar&&setTimeout(function(){var r=h.scrollDiv(this.panelContainer_,{mousewheel:!0,vertical:!0,minibar:!0});this.on(["drawlist","toggle"],function(){r.refresh()})}.bind(this))}displayInLayerSwitcher(e){return e.get("displayInLayerSwitcher")!==!1}setMap(e){if(super.setMap(e),this.drawPanel(),this._listener)for(var t in this._listener)z(this._listener[t]);this._listener=null,e&&(this._listener={moveend:e.on("moveend",this.viewChange.bind(this)),size:e.on("change:size",this.overflow.bind(this))},this._layerGroup?this._listener.change=this._layerGroup.getLayers().on("change:length",this.drawPanel.bind(this)):this._listener.change=e.getLayerGroup().getLayers().on("change:length",this.drawPanel.bind(this)))}show(){this.element.classList.add("ol-forceopen"),this.overflow(),this.dispatchEvent({type:"toggle",collapsed:!1})}hide(){this.element.classList.remove("ol-forceopen"),this.overflow(),this.dispatchEvent({type:"toggle",collapsed:!0})}toggle(){this.element.classList.toggle("ol-forceopen"),this.overflow(),this.dispatchEvent({type:"toggle",collapsed:!this.isOpen()})}isOpen(){return this.element.classList.contains("ol-forceopen")}setHeader(e){h.setHTML(this.header_,e)}overflow(e){if(this.button&&!this._noScroll){if(h.hidden(this.panel_)){h.setStyle(this.element,{height:"auto"});return}var t=h.outerHeight(this.element),i=h.outerHeight(this.panel_),r=this.button.offsetTop+h.outerHeight(this.button),s=this.panel_.offsetTop-r;if(i>t-r){h.setStyle(this.element,{height:"100%"});var a=this.panel_.querySelectorAll("li.ol-visible .li-content")[0],n=a?2*h.getStyle(a,"height"):0;switch(e){case 1:s+=n;break;case-1:s-=n;break;case"+50%":s+=Math.round(t/2);break;case"-50%":s-=Math.round(t/2);break}return s+i<=t-3*r/2?(s=t-3*r/2-i,h.hide(this.botv)):h.show(this.botv),s>=0?(s=0,h.hide(this.topv)):h.show(this.topv),h.setStyle(this.panel_,{top:s+"px"}),!0}else return h.setStyle(this.element,{height:"auto"}),h.setStyle(this.panel_,{top:0}),h.hide(this.botv),h.hide(this.topv),!1}else return!1}_setLayerForLI(e,t){var i=[];t.getLayers&&i.push(t.getLayers().on("change:length",this.drawPanel.bind(this))),e&&(i.push(t.on("change:opacity",(function(){this.setLayerOpacity(t,e)}).bind(this))),i.push(t.on("change:visible",(function(){this.setLayerVisibility(t,e)}).bind(this)))),i.push(t.on("propertychange",(function(r){(r.key==="displayInLayerSwitcher"||r.key==="openInLayerSwitcher"||r.key==="title"||r.key==="name")&&this.drawPanel(r)}).bind(this))),this._layers.push({li:e,layer:t,listeners:i})}setLayerOpacity(e,t){var i=t.querySelector(".layerswitcher-opacity-cursor");i&&(i.style.left=e.getOpacity()*100+"%"),this.dispatchEvent({type:"layer:opacity",layer:e})}setLayerVisibility(e,t){var i=t.querySelector(".ol-visibility");i&&(i.checked=e.getVisible()),e.getVisible()?t.classList.add("ol-visible"):t.classList.remove("ol-visible"),this.dispatchEvent({type:"layer:visible",layer:e})}_clearLayerForLI(){this._layers.forEach(function(e){e.listeners.forEach(function(t){z(t)})}),this._layers=[]}_getLayerForLI(e){for(var t=0,i;i=this._layers[t];t++)if(i.li===e)return i.layer;return null}viewChange(){this.panel_.querySelectorAll("li").forEach(function(e){var t=this._getLayerForLI(e);t&&(this.testLayerVisibility(t)?e.classList.remove("ol-layer-hidden"):e.classList.add("ol-layer-hidden"))}.bind(this))}getPanel(){return this.panelContainer_}drawPanel(){if(this.getMap()){var e=this;this.dcount++,setTimeout(function(){e.drawPanel_()},this.get("drawDelay")||0)}}drawPanel_(){if(!(--this.dcount||this.dragging_)){var e=this.panelContainer_.scrollTop;this._clearLayerForLI(),this.panel_.querySelectorAll("li").forEach(function(t){t.classList.contains("ol-header")||t.remove()}.bind(this)),this._layerGroup?this.drawList(this.panel_,this._layerGroup.getLayers()):this.getMap()&&this.drawList(this.panel_,this.getMap().getLayers()),this.panelContainer_.scrollTop=e,this.counter&&(this.counter.innerHTML=this.panel_.parentNode.querySelectorAll("ul.panel > li:not(.ol-header)").length)}}switchLayerVisibility(e,t){e.get("baseLayer")?(e.getVisible()||e.setVisible(!0),t.forEach(function(i){e!==i&&i.get("baseLayer")&&i.getVisible()&&i.setVisible(!1)})):e.setVisible(!e.getVisible())}testLayerVisibility(e){if(!this.getMap())return!0;var t=this.getMap().getView().getResolution(),i=this.getMap().getView().getZoom();if(e.getMaxResolution()<=t||e.getMinResolution()>=t)return!1;if(e.getMinZoom&&(e.getMinZoom()>=i||e.getMaxZoom()E?y.insertAt(E,v):y.insertAt(E+1,v);break}}_&&t.selectLayer(v),t.dispatchEvent({type:"reorder-end",layer:v,group:c})}i.parentNode.querySelectorAll("li").forEach(function(C){C.classList.remove("dropover"),C.classList.remove("dropover-after"),C.classList.remove("dropover-before")}),i.classList.remove("drag"),i.parentNode.classList.remove("drag"),t.element.classList.remove("drag"),u&&u.remove(),h.removeListener(document,"mousemove touchmove",d),h.removeListener(document,"mouseup touchend touchcancel",f)}function d(v){if(a=v.pageY||v.touches&&v.touches.length&&v.touches[0].pageY||v.changedTouches&&v.changedTouches.length&&v.changedTouches[0].pageY,r&&Math.abs(n-a)>2&&(r=!1,i.classList.add("drag"),g=t._getLayerForLI(i),l=!1,c=t._getLayerForLI(i.parentNode.parentNode),u=h.create("LI",{className:"ol-dragover",html:i.innerHTML,style:{position:"absolute","z-index":1e4,left:i.offsetLeft,opacity:.5,width:h.outerWidth(i),height:h.getStyle(i,"height")},parent:s}),t.element.classList.add("drag"),t.dispatchEvent({type:"reorder-start",layer:g,group:c})),!r){v.preventDefault(),v.stopPropagation(),h.setStyle(u,{top:a-h.offsetRect(s).top+s.scrollTop+5});var _;if(!v.touches)_=v.target,v.target.shadowRoot&&(_=v.composedPath()[0]);else for(_=document.elementFromPoint(v.touches[0].clientX,v.touches[0].clientY);_.shadowRoot;)_=_.shadowRoot.elementFromPoint(v.touches[0].clientX,v.touches[0].clientY);for(_.classList.contains("ol-switcherbottomdiv")?t.overflow(-1):_.classList.contains("ol-switchertopdiv")&&t.overflow(1);_&&_.tagName!=="LI";)_=_.parentNode;(!_||!_.classList.contains("dropover"))&&i.parentNode.querySelectorAll("li").forEach(function(y){y.classList.remove("dropover"),y.classList.remove("dropover-after"),y.classList.remove("dropover-before")}),_&&_.parentNode.classList.contains("drag")&&_!==i?(l=t._getLayerForLI(_),l&&!l.get("allwaysOnTop")==!g.get("allwaysOnTop")?(_.classList.add("dropover"),_.classList.add(i.offsetTop<_.offsetTop?"dropover-after":"dropover-before")):l=!1,h.show(u)):(l=!1,_===i?h.hide(u):h.show(u)),l?u.classList.remove("forbidden"):u.classList.add("forbidden")}}h.addListener(document,"mousemove touchmove",d),h.addListener(document,"mouseup touchend touchcancel",f)}dragOpacity_(e){e.stopPropagation(),e.preventDefault();var t=this,i=e.target,r=this._getLayerForLI(i.parentNode.parentNode.parentNode);if(!r)return;var s=e.pageX||e.touches&&e.touches.length&&e.touches[0].pageX||e.changedTouches&&e.changedTouches.length&&e.changedTouches[0].pageX,a=h.getStyle(i,"left")-s;t.dragging_=!0;function n(){h.removeListener(document,"mouseup touchend touchcancel",n),h.removeListener(document,"mousemove touchmove",l),t.dragging_=!1}function l(u){var g=u.pageX||u.touches&&u.touches.length&&u.touches[0].pageX||u.changedTouches&&u.changedTouches.length&&u.changedTouches[0].pageX,c=(a+g)/h.getStyle(i.parentNode,"width"),f=Math.max(0,Math.min(1,c));h.setStyle(i,{left:f*100+"%"}),i.parentNode.nextElementSibling.innerHTML=Math.round(f*100),r.setOpacity(f)}h.addListener(document,"mouseup touchend touchcancel",n),h.addListener(document,"mousemove touchmove",l)}drawList(e,t){var i=this,r=t.getArray(),s=function(c){c.stopPropagation(),c.preventDefault();var f=i._getLayerForLI(this.parentNode.parentNode);i.switchLayerVisibility(f,t),i.get("selection")&&f.getVisible()&&i.selectLayer(f),i.onchangeCheck&&i.onchangeCheck(f)};function a(c){c.stopPropagation(),c.preventDefault();var f=i._getLayerForLI(this.parentNode.parentNode);i.oninfo(f),i.dispatchEvent({type:"info",layer:f})}function n(c){c.stopPropagation(),c.preventDefault();var f=i._getLayerForLI(this.parentNode.parentNode);i.onextent?i.onextent(f):i.getMap().getView().fit(f.getExtent(),i.getMap().getSize()),i.dispatchEvent({type:"extent",layer:f})}function l(c){c.stopPropagation(),c.preventDefault();var f=this.parentNode.parentNode.parentNode.parentNode,d,v=i._getLayerForLI(f);v?(d=i._getLayerForLI(this.parentNode.parentNode),v.getLayers().remove(d),v.getLayers().getLength()==0&&!v.get("noSwitcherDelete")&&l.call(f.querySelectorAll(".layerTrash")[0],c)):(f=this.parentNode.parentNode,i.getMap().removeLayer(i._getLayerForLI(f)))}function u(c){if(!this.displayInLayerSwitcher(c)){this._setLayerForLI(null,c);return}var f=h.create("LI",{className:(c.getVisible()?"ol-visible ":" ")+(c.get("baseLayer")?"baselayer":""),parent:e});this._setLayerForLI(f,c),this._selectedLayer===c&&f.classList.add("ol-layer-select");var d=h.create("DIV",{className:"ol-layerswitcher-buttons",parent:f}),v=h.create("DIV",{className:"li-content",parent:f}),_=h.create("INPUT",{type:c.get("baseLayer")?"radio":"checkbox",className:"ol-visibility",checked:c.getVisible(),click:function(p){s.bind(this)(p),setTimeout(function(){p.target.checked=c.getVisible()})},on:{keydown:function(p){switch(p.key){case"ArrowLeft":case"ArrowRight":{p.preventDefault(),p.stopPropagation();var m=p.key==="ArrowLeft"?-.1:.1,k=Math.min(1,Math.max(0,c.getOpacity()+m));c.setOpacity(k);break}case"Enter":{i.get("selection")&&(p.preventDefault(),p.stopPropagation(),i.selectLayer(c));break}case"-":case"+":c.getLayers&&(this._focus=c,c.set("openInLayerSwitcher",!c.get("openInLayerSwitcher")));case"ArrowUp":case"ArrowDown":{if(p.ctrlKey&&this.reordering){p.preventDefault(),p.stopPropagation();var S=t.getArray().indexOf(c);S>-1&&(p.key==="ArrowDown"?S>0&&(t.remove(c),t.insertAt(S-1,c),i._focus=c,i.dispatchEvent({type:"reorder-end",layer:c})):S0&&(!c.get("allwaysOnTop")||r[g-1].get("allwaysOnTop")))&&h.create("DIV",{className:"layerup ol-noscroll",title:this.tip.up,on:{"mousedown touchstart":function(p){i.dragOrdering_(p)}},parent:d}),c.getLayers){var w=0;c.getLayers().forEach(function(p){i.displayInLayerSwitcher(p)&&w++}),w&&h.create("DIV",{className:c.get("openInLayerSwitcher")?"collapse-layers":"expend-layers",title:this.tip.plus,click:function(){var p=i._getLayerForLI(this.parentNode.parentNode);p.set("openInLayerSwitcher",!p.get("openInLayerSwitcher"))},parent:d})}if(this.oninfo&&h.create("DIV",{className:"layerInfo",title:this.tip.info,click:a,parent:d}),this.hastrash&&!c.get("noSwitcherDelete")&&h.create("DIV",{className:"layerTrash",title:this.tip.trash,click:l,parent:d}),this.hasextent&&r[g].getExtent()){var L=r[g].getExtent();L.length==4&&L[0]=0;g--)u.call(this,r[g]);this.viewChange(),e===this.panel_&&(this.overflow(""),this._focus=null)}getLayerClass(e){return e?e.getLayers?"ol-layer-group":e instanceof K?"ol-layer-vector":e instanceof Ze?"ol-layer-vectortile":e instanceof be?"ol-layer-tile":e instanceof ze?"ol-layer-image":e instanceof je?"ol-layer-heatmap":e.getFeatures?"ol-layer-vectorimage":"unknown":"none"}selectLayer(e,t){if(!e){if(!this.getMap())return;e=this.getMap().getLayers().item(this.getMap().getLayers().getLength()-1)}this._selectedLayer=e,this.element.querySelector("input.ol-visibility:focus")&&(this._focus=e),this.drawPanel(),t||this.dispatchEvent({type:"select",layer:e})}getSelection(){return this._selectedLayer}setprogress_(e){if(!e.layerswitcher_progress){var t=0,i=0,r=function(){i===t?(i=t=0,h.setStyle(e.layerswitcher_progress,{width:0})):h.setStyle(e.layerswitcher_progress,{width:(t/i*100).toFixed(1)+"%"})};e.getSource().on("tileloadstart",function(){i++,r()}),e.getSource().on("tileloadend",function(){t++,r()}),e.getSource().on("tileloaderror",function(){t++,r()})}}};ot.prototype.tip={up:"up/down",down:"down",info:"informations...",extent:"zoom to extent",trash:"remove layer",plus:"expand/shrink"};var oe=class extends le{constructor(e){e=e||{};var t=document.createElement("div");t.className=(e.className||"")+" ol-button ol-unselectable ol-control",super({element:t,target:e.target});var i=this,r=this.button_=document.createElement(/ol-text-button/.test(e.className)?"div":"button");e.id?r.setAttribute("id",e.id):r.setAttribute("id","ol-button-"+Fe(this)),this.button_.className=e.classButton||"",r.type="button",e.title&&(r.title=e.title),e.name&&(r.name=e.name),e.html instanceof Element?r.appendChild(e.html):r.innerHTML=e.html||"";var s=function(n){n&&n.preventDefault&&(n.preventDefault(),n.stopPropagation()),e.handleClick&&e.handleClick.call(i,n)};r.addEventListener("click",s),t.appendChild(r),!e.title&&r.firstElementChild&&(r.title=r.firstElementChild.title),e.title&&this.set("title",e.title),e.title&&this.set("title",e.title),e.name&&this.set("name",e.name);for(var a in e.attributes||{})this.button_.setAttribute(a,e.attributes[a])}setVisible(e){e?h.show(this.element):h.hide(this.element)}getDisable(){var e=this.element.querySelector("button");return e&&e.disabled}setDisable(e){this.getDisable()!=e&&(this.element.querySelector("button").disabled=e)}setTitle(e){this.button_.setAttribute("title",e)}setHtml(e){h.setHTML(this.button_,e)}getButtonElement(){return this.button_}},G=class extends oe{constructor(e){e=e||{},e.toggleFn&&(e.onToggle=e.toggleFn),e.handleClick=function(){t.toggle(),e.onToggle&&e.onToggle.call(t,t.getActive())},e.className=(e.className||"")+" ol-toggle",super(e);var t=this;this.interaction_=e.interaction,this.interaction_&&(this.interaction_.setActive(e.active),this.interaction_.on("change:active",function(){t.setActive(t.interaction_.getActive())})),this.set("title",e.title),this.set("autoActivate",e.autoActivate),e.bar&&this.setSubBar(e.bar),this.setActive(e.active),this.setDisable(e.disable)}setMap(e){!e&&this.getMap()&&(this.interaction_&&this.getMap().removeInteraction(this.interaction_),this.subbar_&&this.getMap().removeControl(this.subbar_)),super.setMap(e),e&&(this.interaction_&&e.addInteraction(this.interaction_),this.subbar_&&e.addControl(this.subbar_))}getSubBar(){return this.subbar_}setSubBar(e){var t=this.getMap();t&&this.subbar_&&t.removeControl(this.subbar_),this.subbar_=e,e&&(this.subbar_.setTarget(this.element),this.subbar_.element.classList.add("ol-option-bar"),t&&t.addControl(this.subbar_),e.element.id&&(this.getButtonElement().setAttribute("aria-controls",e.element.id),e.element.setAttribute("aria-labelledby",this.getButtonElement().id),this.on("change:active",function(i){this.getButtonElement().setAttribute("aria-expanded",!!i.active)}.bind(this))))}getDisable(){var e=this.element.querySelector("button");return e&&e.disabled}setDisable(e){this.getDisable()!=e&&(this.element.querySelector("button").disabled=e,e&&this.getActive()&&this.setActive(!1),this.dispatchEvent({type:"change:disable",key:"disable",oldValue:!e,disable:e}))}getActive(){return this.element.classList.contains("ol-active")}toggle(){this.getActive()?this.setActive(!1):this.setActive(!0)}setActive(e){this.interaction_&&this.interaction_.setActive(e),this.subbar_&&this.subbar_.setActive(e),this.getActive()!==e&&(e?this.element.classList.add("ol-active"):this.element.classList.remove("ol-active"),this.button_.setAttribute("aria-pressed",e),this.dispatchEvent({type:"change:active",key:"active",oldValue:!e,active:e}))}setInteraction(e){this.interaction_=e}getInteraction(){return this.interaction_}},lt=class extends J{constructor(e){e=e||{},super({handleEvent:function(){return!this.get("followTrack")||this.get("followTrack")=="auto"}}),this.geolocation=new Ye({projection:"EPSG:4326",trackingOptions:{maximumAge:1e4,enableHighAccuracy:!0,timeout:6e5}}),this.geolocation.on("change",this.draw_.bind(this)),this.path_=[],this.lastPosition_=!1;var t=[255,255,255,1],i=[0,153,255,1],r=3,s=new Y({radius:r*2,fill:new I({color:i}),stroke:new P({color:t,width:r/2})}),a=[new O({stroke:new P({color:t,width:r+2})}),new O({stroke:new P({color:i,width:r}),fill:new I({color:[255,255,255,.5]})})],n=new ie({radius:r*3.5,points:3,rotation:0,fill:new I({color:i}),stroke:new P({color:t,width:r/2})}),l=n.getImage(),u=l.getContext("2d"),g=document.createElement("canvas");g.width=g.height=l.width,g.getContext("2d").drawImage(l,0,0),u.clearRect(0,0,l.width,l.height),u.drawImage(g,0,0,l.width,l.height,r,0,l.width-2*r,l.height);var c=function(f){return f.get("heading")===void 0?a[1].setImage(s):(a[1].setImage(n),n.setRotation(f.get("heading")||0)),a};this.locStyle={error:new O({fill:new I({color:[255,0,0,.2]})}),warn:new O({fill:new I({color:[255,192,0,.2]})}),ok:new O({fill:new I({color:[0,255,0,.2]})})},this.overlayLayer_=new K({source:new V,name:"GeolocationDraw overlay",style:e.style||c}),this.sketch_=[new M,new M,new M],this.overlayLayer_.getSource().addFeatures(this.sketch_),this.features_=e.features,this.source_=e.source,this.condition_=e.condition||function(f){return f.getAccuracy()t&&(s.push(i[l]),n=a)}return s[s.length-1]!==i[i.length-1]&&s.push(i[i.length-1]),this.get("type")==="Polygon"?e=new R([s],"XYZM"):e=new A(s,"XYZM"),e}setMap(e){this.getMap()&&this.getMap().removeLayer(this.overlayLayer_),super.setMap(e),this.overlayLayer_.setMap(e),e&&this.geolocation.setProjection(e.getView().getProjection())}setActive(e){if(e!==this.getActive()){if(super.setActive(e),this.getMap()){this.geolocation.setTracking(e);try{this.getMap().renderSync()}catch{}}if(this.overlayLayer_)if(this.overlayLayer_.setVisible(e),this.pause(!e),e)this.reset(),this.dispatchEvent({type:"drawstart",feature:this.sketch_[1]});else{var t=this.sketch_[1].clone();t.getGeometry()&&(this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)),this.dispatchEvent({type:"drawend",feature:t})}}}simulate(e,t){if(this._track&&clearTimeout(this._track.timeout),!e){this._track=!1;return}t=t||{};var i=t.delay||1e3;function r(){if(this._track.pos>=this._track.track.length){this._track=!1;return}var s=this._track.track[this._track.pos];s[2]=s[3]||0,s[3]=new Date().getTime(),this._track.pos++,t.repeat!==!1&&(this._track.pos=this._track.pos%this._track.track.length),this.getActive()&&this.draw_(!0,s,t.accuracy),this._track.timeout=setTimeout(r.bind(this),i)}this._track={track:e,pos:0,timeout:setTimeout(r.bind(this),0)}}simulating(){return!!this._track}reset(){this.sketch_[1].setGeometry(),this.path_=[],this.lastPosition_=!1}start(){this.setActive(!0)}stop(){this.setActive(!1)}pause(e){this.pause_=e!==!1}isPaused(){return this.pause_}setFollowTrack(e){this.set("followTrack",e);var t=this.getMap();if(this.getActive()&&t){var i;if(e!=="position"&&(this.get("minZoom")?i=Math.max(this.get("minZoom"),t.getView().getZoom()):i=this.get("zoom")),e!==!1&&!this.lastPosition_){var r=this.path_[this.path_.length-1];r&&t.getView().animate({center:r,zoom:i})}else e==="auto"&&this.lastPosition_&&t.getView().animate({center:this.lastPosition_,zoom:i})}this.lastPosition_=!1,this.dispatchEvent({type:"follow",following:e!==!1})}draw_(e,t,i){var r=this.getMap();if(r){var s,a,n,l,u;if(this._track){if(e!==!0)return;if(a=t,s=i||10,this.path_&&this.path_.length){var g=this.path_[this.path_.length-1];u=Math.atan2(t[0]-g[0],t[1]-g[1])}var c=new ae(a,r.getView().getResolution()*s);n=re(c)}else l=this.geolocation,s=l.getAccuracy(),a=this.getPosition(l),n=l.getAccuracyGeometry(),u=l.getHeading();switch(this.get("followTrack")){case!0:{this.get("followTrack")==!0&&(this.get("minZoom")?this.get("minZoom")>r.getView().getZoom()&&r.getView().setZoom(this.get("minZoom")):r.getView().setZoom(this.get("zoom")||16),We(r.getView().calculateExtent(r.getSize()),n.getExtent())||r.getView().fit(n.getExtent())),r.getView().setCenter(a);break}case"position":{r.getView().setCenter(a);break}case"auto":{if(this.lastPosition_){var f=r.getView().getCenter();f[0]!=this.lastPosition_[0]||f[1]!=this.lastPosition_[1]?this.setFollowTrack(!1):(r.getView().setCenter(a),this.lastPosition_=a)}else r.getView().setCenter(a),this.get("minZoom")?this.get("minZoom")>r.getView().getZoom()&&r.getView().setZoom(this.get("minZoom")):this.get("zoom")&&r.getView().setZoom(this.get("zoom")),this.lastPosition_=a;break}case"visible":{Je(r.getView().calculateExtent(r.getSize()),a)||r.getView().setCenter(a);break}}var d=this.sketch_[0];d.setGeometry(n),s1?(v=new A(this.path_,"XYZM"),this.get("tolerance")&&(v=this.simplify3D(v,this.get("tolerance"))),d.setGeometry(v)):d.setGeometry();break;case"Polygon":this.path_.length>2?(v=new R([this.path_],"XYZM"),this.get("tolerance")&&(v=this.simplify3D(v,this.get("tolerance"))),d.setGeometry(v)):d.setGeometry();break}this.dispatchEvent({type:"drawing",feature:this.sketch_[1],geolocation:l})}this.sketch_[2].setGeometry(new T(a)),this.sketch_[2].set("heading",u),this.dispatchEvent({type:"tracking",feature:this.sketch_[1],geolocation:l})}}getPosition(e){var t=e.getPosition();return t.push(Math.round((e.getAltitude()||0)*100)/100),t.push(Math.round(new Date().getTime()/1e3)),t}},Lt=class extends G{constructor(e){e=e||{},e.followTrack=e.followTrack||"auto",e.zoom=e.zoom||16;var t=new lt(e);super({className:e.className=((e.className||"")+" ol-geobt").trim(),interaction:t,title:e.title||"Geolocation",onToggle:function(){t.pause(!0),t.setFollowTrack(e.followTrack||"auto")}}),this.setActive(!1),t.on("tracking",function(r){this.dispatchEvent({type:"position",coordinate:r.geolocation.getPosition()})}.bind(this));var i;t.on("change:active",function(){this.dispatchEvent({type:"position"}),i&&(clearTimeout(i),i=null),t.getActive()&&(i=setTimeout(function(){t.setActive(!1),i=null}.bind(this),e.delay||3e3))}.bind(this))}},Oe=class extends le{constructor(e){e=e||{};var t=(e.className||"")+" ol-search"+(e.target?"":" ol-unselectable ol-control"),i=h.create("DIV",{className:t});super({element:i,target:e.target});var r=this;if(e.typing==null&&(e.typing=300),this._classname=e.className||"search",e.collapsed!==!1&&i.classList.add("ol-collapsed"),e.target||(this.button=document.createElement("button"),this.button.setAttribute("type","button"),this.button.setAttribute("title",e.title||e.label||"Search"),this.button.addEventListener("click",function(){if(i.classList.toggle("ol-collapsed"),!i.classList.contains("ol-collapsed")){i.querySelector("input.search").focus();for(var f=i.querySelectorAll("li"),d=0;d=0)if(n=v,n){a&&clearTimeout(a);var y=r.get("minLength");a=setTimeout(function(){if(n.length>=y){var w=r.autocomplete(n,function(L){r.drawList_(L)});w&&r.drawList_(w)}else r.drawList_()},e.typing)}else r.drawList_();else d=i.querySelector("ul.autocomplete li"),d&&d.classList.remove("select")};if(l.addEventListener("keyup",u),l.addEventListener("search",u),l.addEventListener("cut",u),l.addEventListener("paste",u),l.addEventListener("input",u),e.noCollapse||(l.addEventListener("blur",function(){setTimeout(function(){l!==document.activeElement&&(i.classList.add("ol-collapsed"),this.set("reverse",!1),i.classList.remove("ol-revers"))}.bind(this),200)}.bind(this)),l.addEventListener("focus",function(){this.get("reverse")||(i.classList.remove("ol-collapsed"),i.classList.remove("ol-revers"))}.bind(this)),l.addEventListener("keydown",function(){this.set("reverse",!1),i.classList.remove("ol-collapsed"),i.classList.remove("ol-revers")}.bind(this))),i.appendChild(l),e.reverse){var g=h.create("BUTTON",{type:"button",class:"ol-revers",title:e.reverseTitle||"click on the map",on:{focus:function(){this.get("reverse")?this.set("reverse",!1):(this.set("reverse",!this.get("reverse")),l.focus(),i.classList.add("ol-revers"))}.bind(this)}});i.appendChild(g)}var c=document.createElement("ul");c.classList.add("autocomplete"),i.appendChild(c),typeof e.getTitle=="function"&&(this.getTitle=e.getTitle),typeof e.autocomplete=="function"&&(this.autocomplete=e.autocomplete),this.set("copy",e.copy),this.set("minLength",e.minLength||1),this.set("maxItems",e.maxItems||10),this.set("maxHistory",e.maxHistory||e.maxItems||10),e.onselect&&this.on("select",e.onselect),e.centerOnSelect&&this.on("select",function(f){var d=this.getMap();d&&d.getView().setCenter(f.coordinate)}.bind(this)),e.zoomOnSelect&&this.on("select",function(f){var d=this.getMap();d&&(d.getView().setCenter(f.coordinate),d.getView().getZoom()=0;s--)(!r[s]||JSON.stringify(r[s])===a)&&r.splice(s,1)}catch{for(s=r.length-1;s>=0;s--)r[s]===e&&r.splice(s,1)}r.unshift(e);for(var n=Math.max(0,this.get("maxHistory")||10)||0;r.length>n;)r.pop();this.saveHistory(),this.select(e,t,null,i),t&&(this.setInput(this._getTitleTxt(e)),this.drawList_(),setTimeout(function(){this.collapse(!1)}.bind(this),300))}}saveHistory(){try{this.get("maxHistory")>=0?localStorage["ol@search-"+this._classname]=JSON.stringify(this.get("history")):localStorage.removeItem("ol@search-"+this._classname)}catch{console.warn("Failed to access localStorage...")}}restoreHistory(){if(this._history[this._classname])this.set("history",this._history[this._classname]);else try{this._history[this._classname]=JSON.parse(localStorage["ol@search-"+this._classname]),this.set("history",this._history[this._classname])}catch{this.set("history",[])}}clearHistory(){this.set("history",[]),this.saveHistory(),this.drawList_()}getHistory(){return this.get("history")}autocomplete(e,t){return t([]),!1}drawList_(e){var t=this,i=this.element.querySelector("ul.autocomplete");if(i.innerHTML="",this._list=[],e)i.setAttribute("class","autocomplete");else{var r=this.element.querySelector("input.search"),s=r.value;if(!s)e=this.get("history");else return;i.setAttribute("class","autocomplete history")}for(var a,n=Math.min(t.get("maxItems"),e.length),l=0;l=200&&this.status<400){var u;try{switch(r.get("dataType")){case"JSON":{u=JSON.parse(this.response);break}default:u=this.response}}catch(g){r.dispatchEvent({type:"error",status:0,statusText:"parsererror",error:g,options:i,jqXHR:this});return}r.dispatchEvent({type:"success",response:u,status:this.status,statusText:this.statusText,options:i,jqXHR:this})}else r.dispatchEvent({type:"error",status:this.status,statusText:this.statusText,options:i,jqXHR:this})},l.ontimeout=function(){r._request=null,r.dispatchEvent({type:"loadend"}),r.dispatchEvent({type:"error",status:this.status,statusText:"Timeout",options:i,jqXHR:this})},l.onerror=function(){r._request=null,r.dispatchEvent({type:"loadend"}),r.dispatchEvent({type:"error",status:this.status,statusText:this.statusText,options:i,jqXHR:this})},l.send()}},ct=class extends Oe{constructor(e){e=e||{},e.className=e.className||"JSON",delete e.autocomplete,e.minLength=e.minLength||3,e.typing=e.typing||800,super(e);var t=e.url||"";if(window.location.protocol==="https:"){var i=document.createElement("a");i.href=t,i.protocol=window.location.protocol,t=i.href}this.set("url",t),this._ajax=new Ve({dataType:"JSON",auth:e.authentication}),this._ajax.on("success",function(r){r.status>=200&&r.status<400?typeof this._callback=="function"&&this._callback(r.response):(typeof this._callback=="function"&&this._callback(!1,"error"),console.log("AJAX ERROR",arguments))}.bind(this)),this._ajax.on("error",function(){typeof this._callback=="function"&&this._callback(!1,"error"),console.log("AJAX ERROR",arguments)}.bind(this)),this._ajax.on("loadstart",function(){this.element.classList.add("searching")}.bind(this)),this._ajax.on("loadend",function(){this.element.classList.remove("searching")}.bind(this)),typeof e.handleResponse=="function"&&(this.handleResponse=e.handleResponse)}ajax(e,t,i,r){r=r||{},this._callback=i,this._ajax.set("dataType",r.dataType||"JSON"),this._ajax.send(e,t,r)}autocomplete(e,t){var i=this.requestData(e),r=encodeURI(this.get("url"));this.ajax(r,i,function(s){typeof t=="function"&&t(this.handleResponse(s))})}requestData(e){return{q:e}}handleResponse(e){return e}},Ct=class extends ct{constructor(e){e=e||{},e.className=e.className||"nominatim",e.typing=e.typing||-1,e.url=e.url||"https://nominatim.openstreetmap.org/search",e.copy='© OpenStreetMap contributors',super(e),this.set("polygon",e.polygon),this.set("viewbox",e.viewbox),this.set("bounded",e.bounded)}getTitle(e){var t=[];e.class&&t.push(e.class),e.type&&t.push(e.type);var i=e.display_name+(t.length?""+t.join(" - ")+"":"");return e.icon&&(i=""+i),i}requestData(e){var t={format:"json",addressdetails:1,q:e,polygon_geojson:this.get("polygon")?1:0,bounded:this.get("bounded")?1:0,limit:this.get("maxItems")};return this.get("viewbox")&&(t.viewbox=this.get("viewbox")),t}select(e){var t=[Number(e.lon),Number(e.lat)];try{t=se(t,"EPSG:4326",this.getMap().getView().getProjection())}catch{}this.dispatchEvent({type:"select",search:e,coordinate:t})}reverseGeocode(e,t){var i=se(e,this.getMap().getView().getProjection(),"EPSG:4326");this.ajax(this.get("url").replace("search","reverse"),{lon:i[0],lat:i[1],format:"json"},function(r){t?t.call(this,[r]):r&&!r.error&&this._handleSelect(r,!0)}.bind(this))}handleResponse(e){return e.results||e}},W=class extends le{constructor(e){e=e||{};var t=document.createElement("div");if(t.classList.add("ol-unselectable","ol-control","ol-bar"),e.className){var i=e.className.split(" ").filter(function(a){return a.length>0});t.classList.add.apply(t.classList,i)}if(e.group&&t.classList.add("ol-group"),super({element:t,target:e.target}),e.id?this.element.setAttribute("id",e.id):this.element.setAttribute("id","ol-bar-"+Fe(this)),this.set("toggleOne",e.toggleOne),this.set("autoDeactivate",e.autoDeactivate),this.controls_=[],e.controls instanceof Array)for(var r=0;r-1&&(this.controls_.splice(t,1),this.getMap()&&this.getMap().removeControl(e),e._activateBar&&e.un("change:active",e._activateBar),delete e._activateBar)}deactivateControls(e){for(var t=0;t1e-10&&(n=Math.sqrt((y[0]-_[0])*(y[0]-_[0])+(y[1]-_[1])*(y[1]-_[1])),l=Math.sqrt((w[0]-y[0])*(w[0]-y[0])+(w[1]-y[1])*(w[1]-y[1])),u=_[0]+e*(y[1]-_[1])/n,g=y[0]+e*(w[1]-y[1])/l,c=_[1]-e*(y[0]-_[0])/n,f=y[1]-e*(w[0]-y[0])/l,d=(a*g-s*u+c-f)/(a-s),v=(s*a*(g-u)+a*c-s*f)/(a-s),y[0]-_[0]==0&&(d=y[0]+e*(y[1]-_[1])/Math.abs(y[1]-_[1]),v=a*d-a*g+f),w[0]-y[0]==0&&(d=w[0]+e*(w[1]-y[1])/Math.abs(w[1]-y[1]),v=s*d-s*u+c),t.push([d,v]));return L?t.push(t[0]):(o.pop(),_=o[o.length-1],y=o[o.length-2],w=[_[0]-(y[1]-_[1])/x(_,y)*e,_[1]+(y[0]-_[0])/x(_,y)*e],t.push(w)),t},xe=function(o,e){for(var t=0;t0;s--)(t[s][0]>i&&t[s-1][0]i)&&(r=[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,r))}function e(t,i){var r;for(let s=t.length-1;s>0;s--)(t[s][1]>i&&t[s-1][1]i)&&(r=[(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,r))}Re=function(t,i){var r=i.getType()==="Polygon";if(!r&&i.getType()!=="MultiPolygon")return null;var s=i.getCoordinates();return r&&(s=[s]),s.forEach(function(a){a.forEach(function(n){o(n,t[0]),o(n,t[2]),e(n,t[1]),e(n,t[3])})}),s.forEach(function(a){a.forEach(function(n){n.forEach(function(l){l[0]t[2]&&(l[0]=t[2]),l[1]t[3]&&(l[1]=t[3])})})}),r?new R(s[0]):new Q(s)}})();var ce=function(o,e,t,i){var r=[];i!==!1&&r.push(o);var s=x(o,e);if(s){var a=Math.round(s/t);if(a>1)for(var n=(e[0]-o[0])/a,l=(e[1]-o[1])/a,u=1;ur?(a=!0,c.push([i[0]+r/d*(f[0]-i[0]),i[1]+r/d*(f[1]-i[1])])):c.push(f)})})}),a?o.getType()==="Polygon"?new R(n[0]):new Q(n):o}}}else console.warn("[ol/geom/Circle~intersection] Unsupported geometry type: "+o.getType());return o};var Ge;(function(){var o=[255,255,255,1],e=[0,153,255,1],t=3,i=[new O({stroke:new P({color:o,width:t+2})}),new O({image:new Y({radius:t*2,fill:new I({color:e}),stroke:new P({color:o,width:t/2})}),stroke:new P({color:e,width:t}),fill:new I({color:[255,255,255,.5]})})];Ge=function(r){if(r===!0)return i;r=r||{};var s=new I({color:r.fillColor||"rgba(255,255,255,0.4)"}),a=new P({color:r.color||"#3399CC",width:1.25}),n=new O({image:new Y({fill:s,stroke:a,radius:5}),fill:s,stroke:a});return[n]}})();const qe=Ge;var Te=class extends me{constructor(e){e=e||{},super({handleDownEvent:function(i){return t.handleDownEvent_(i)},handleDragEvent:function(i){return t.handleDragEvent_(i)},handleMoveEvent:function(i){return t.handleMoveEvent_(i)},handleUpEvent:function(i){return t.handleUpEvent_(i)}});var t=this;this._filter=e.filter,this.features_=e.features,this.layers_=e.layers?e.layers instanceof Array?e.layers:[e.layers]:null,this.set("duplicate",e.duplicate),this.source_=e.source,this._style=typeof e.style=="function"?e.style:function(){return e.style?e.style:qe(!0)},this.previousCursor_=!1}getFeatureAtPixel_(e){var t=this;return this.getMap().forEachFeatureAtPixel(e.pixel,function(i,r){var s;if(t._filter&&!t._filter(i,r))return!1;if(t.layers_){for(var a=0;a1)return!1;var l=s.getGeometry().getClosestPoint(e.coordinate),u=l[0]-e.coordinate[0],g=l[1]-e.coordinate[1],c=Math.sqrt(u*u+g*g)/e.frameState.viewState.resolution;return c<5?{feature:s,hit:l,coordinates:s.getGeometry().getCoordinates(),geom:s.getGeometry().clone(),geomType:n}:!1}else return!1},{hitTolerance:5})}handleDownEvent_(e){return this.current_=this.getFeatureAtPixel_(e),this.current_?(this.currentStyle_=this.current_.feature.getStyle(),this.source_&&(this.get("duplicate")||e.originalEvent.ctrlKey)?(this.current_.feature=this.current_.feature.clone(),this.current_.feature.setStyle(this._style(this.current_.feature)),this.source_.addFeature(this.current_.feature)):(this.current_.feature.setStyle(this._style(this.current_.feature)),this._modifystart=!0),this.dispatchEvent({type:"offsetstart",feature:this.current_.feature,offset:0}),!0):!1}handleDragEvent_(e){this._modifystart&&(this.dispatchEvent({type:"modifystart",features:[this.current_.feature]}),this._modifystart=!1);var t=this.current_.geom.getClosestPoint(e.coordinate),i=x(t,e.coordinate),r,s,a,n;switch(this.current_.geomType){case"Polygon":{if(r=xe(t,this.current_.coordinates[0]).segment,r){s=[r[1][0]-r[0][0],r[1][1]-r[0][1]],a=[e.coordinate[0]-t[0],e.coordinate[1]-t[1]],s[0]*a[1]-s[1]*a[0]>0&&(i=-i),n=[];for(var l=0;l0&&(i=-i),n=Me(this.current_.coordinates,i),this.current_.feature.setGeometry(new A(n)));break}}this.dispatchEvent({type:"offsetting",feature:this.current_.feature,offset:i,segment:[t,e.coordinate],coordinate:e.coordinate})}handleUpEvent_(e){this._modifystart||this.dispatchEvent({type:"offsetend",feature:this.current_.feature,coordinate:e.coordinate}),this.current_.feature.setStyle(this.currentStyle_),this.current_=!1}handleMoveEvent_(e){var t=this.getFeatureAtPixel_(e);t?(this.previousCursor_===!1&&(this.previousCursor_=e.map.getTargetElement().style.cursor),h.setCursor(e.map,"pointer")):(h.setCursor(e.map,this.previousCursor_),this.previousCursor_=!1)}};A.prototype.splitAt=function(o,e){var t;if(!o)return[this];if(e||(e=1e-10),o.length&&o[0].length){var i=[this];for(t=0;t1&&u.push(new A(l)),u.length?u:[this]};var Pe=class extends J{constructor(e){e||(e={}),super({handleEvent:function(u){switch(u.type){case"singleclick":return this.handleDownEvent(u);case"pointermove":return this.handleMoveEvent(u);default:return!0}}}),this.snapDistance_=e.snapDistance||25,this.tolerance_=e.tolerance||1e-10,this.cursor_=e.cursor,this.setSources(e.sources),e.features&&(this.sources_||(this.sources_=[]),this.sources_.push(new V({features:e.features}))),this.filterSplit_=e.filter||function(){return!0};var t=[255,255,255,1],i=[0,153,255,1],r=3,s=new I({color:"rgba(255,255,255,0.4)"}),a=new P({color:"#3399CC",width:1.25}),n=[new O({image:new Y({fill:s,stroke:a,radius:5}),fill:s,stroke:a})],l=[new O({stroke:new P({color:t,width:r+2})}),new O({image:new Y({radius:2*r,fill:new I({color:i}),stroke:new P({color:t,width:r/2})}),stroke:new P({color:i,width:r})})];e.sketchStyle&&(n=e.sketchStyle instanceof Array?e.sketchStyle:[e.sketchStyle]),e.featureStyle&&(l=e.featureStyle instanceof Array?e.featureStyle:[e.featureStyle]),this.overlayLayer_=new K({source:new V({useSpatialIndex:!1}),name:"Split overlay",displayInLayerSwitcher:!1,style:function(u){return u._sketch_?n:l}})}setMap(e){this.getMap()&&this.getMap().removeLayer(this.overlayLayer_),super.setMap(e),this.overlayLayer_.setMap(e)}getSources(){if(!this.sources_&&this.getMap()){var e=[],t=function(i){i.forEach(function(r){r.getVisible()&&(r.getSource&&r.getSource()instanceof V?e.unshift(r.getSource()):r.getLayers&&t(r.getLayers()))})};return t(this.getMap().getLayers()),e}return this.sources_||[]}setSources(e){this.sources_=e?e instanceof Array?e||!1:[e]:!1}getClosestFeature(e){var t,i,r,s,a=this.snapDistance_+1;if(this.getSources().forEach(function(u){var g=u.getClosestFeatureToCoordinate(e.coordinate);if(g&&g.getGeometry().splitAt){var c=g.getGeometry().getClosestPoint(e.coordinate),f=new A([e.coordinate,c]),d=f.getLength()/e.frameState.viewState.resolution;dthis.snapDistance_)return!1;var n=this.getNearestCoord(r,i.getGeometry().getCoordinates()),l=this.getMap().getPixelFromCoordinate(n);return x(e.pixel,l)1){var a=[];for(s=0;s=0&&(this.ispt_&&this.get("translate")||this.get("translateFeature"))&&(t.handle="translate"),t.handle){this.mode_=t.handle,this.opt_=t.option,this.constraint_=t.constraint;var r=this.getMap().getView().getRotation();this.coordinate_=i.get("handle")?i.getGeometry().getCoordinates():e.coordinate,this.pixel_=this.getMap().getCoordinateFromPixel(this.coordinate_),this.geoms_=[],this.rotatedGeoms_=[];var s=Se(),a=Se();this.hasChanged_=!1;for(var n=0,l;l=this.selection_.item(n);n++)if(this.geoms_.push(l.getGeometry().clone()),s=de(s,l.getGeometry().getExtent()),this.get("enableRotatedTransform")&&r!==0){var u=this.getGeometryRotateToZero_(l,!0);this.rotatedGeoms_.push(u),a=de(a,u.getExtent())}if(this.extent_=te(s).getCoordinates()[0],this.get("enableRotatedTransform")&&r!==0&&(this.rotatedExtent_=te(a).getCoordinates()[0]),this.mode_==="rotate"){this.center_=this.getCenter()||ge(s);var g=e.map.getTargetElement();h.setCursor(g,this.Cursors.rotate0),this.previousCursor_=g.style.cursor}else this.center_=ge(s);return this.angle_=Math.atan2(this.center_[1]-e.coordinate[1],this.center_[0]-e.coordinate[0]),this.dispatchEvent({type:this.mode_+"start",feature:this.selection_.item(0),features:this.selection_,pixel:e.pixel,coordinate:e.coordinate}),!0}else if(this.get("selection")){if(i){this.addFn_(e)||this.selection_.clear();var c=this.selection_.getArray().indexOf(i);c<0?this.selection_.push(i):this.selection_.removeAt(c)}else this.selection_.clear();return this.ispt_=this.selection_.getLength()===1?this.selection_.item(0).getGeometry().getType()=="Point":!1,this.iscircle_=this.selection_.getLength()===1?this.selection_.item(0).getGeometry().getType()=="Circle":!1,this.drawSketch_(),this.watchFeatures_(),this.dispatchEvent({type:"select",feature:i,features:this.selection_,pixel:e.pixel,coordinate:e.coordinate}),!1}}}getCenter(){return this.get("center")}setCenter(e){return this.set("center",e)}handleDragEvent_(e){if(this._handleEvent(e,this.features_)){var t=this.getMap().getView().getRotation(),i,r,s,a,n=[this.coordinate_[0],this.coordinate_[1]],l=[e.coordinate[0],e.coordinate[1]];switch(this.isUpdating_=!0,this.hasChanged_=!0,this.mode_){case"rotate":{var u=Math.atan2(this.center_[1]-l[1],this.center_[0]-l[0]);if(!this.ispt)for(i=0,s;s=this.selection_.item(i);i++)a=this.geoms_[i].clone(),a.rotate(u-this.angle_,this.center_),a.getType()=="Circle"&&a.setCenterAndRadius(a.getCenter(),a.getRadius()),s.setGeometry(a);this.drawSketch_(!0),this.dispatchEvent({type:"rotating",feature:this.selection_.item(0),features:this.selection_,angle:u-this.angle_,pixel:e.pixel,coordinate:e.coordinate});break}case"translate":{var g=l[0]-n[0],c=l[1]-n[1];for(i=0,s;s=this.selection_.item(i);i++)s.getGeometry().translate(g,c);this.handles_.forEach(function(S){S.getGeometry().translate(g,c)}),this.coordinate_=e.coordinate,this.dispatchEvent({type:"translating",feature:this.selection_.item(0),features:this.selection_,delta:[g,c],pixel:e.pixel,coordinate:e.coordinate});break}case"scale":{var f=this.center_;if(this.get("modifyCenter")(e)){var d=this.extent_;this.get("enableRotatedTransform")&&t!==0&&(d=this.rotatedExtent_),f=d[(Number(this.opt_)+2)%4]}var v=this.geoms_.length==1&&this._isRectangle(this.geoms_[0]),_=this.constraint_,y=this.opt_,w=this.coordinate_,L=e.coordinate;if(this.get("enableRotatedTransform")&&t!==0){var E=new T(this.coordinate_);E.rotate(t*-1,f),w=E.getCoordinates();var C=new T(e.coordinate);C.rotate(t*-1,f),L=C.getCoordinates()}var D=(L[0]-f[0])/(w[0]-f[0]),p=(L[1]-f[1])/(w[1]-f[1]),m=[L[0]-w[0],L[1]-w[1]];if(this.get("enableRotatedTransform")&&t!==0){var k=new T(f);k.rotate(t*-1,this.getMap().getView().getCenter()),f=k.getCoordinates()}for(this.get("noFlip")&&(D<0&&(D=-D),p<0&&(p=-p)),this.constraint_?this.constraint_=="h"?D=1:p=1:this.get("keepAspectRatio")(e)&&(D=p=Math.min(D,p)),i=0,s;s=this.selection_.item(i);i++)a=t===0||!this.get("enableRotatedTransform")?this.geoms_[i].clone():this.rotatedGeoms_[i].clone(),a.applyTransform(function(S,b,he){if(he<2)return b;if(v){var ue=[[6],[0,8],[2],[4]],q=[S[0],S[1]],H=[S[2],S[3]],Z=[S[4],S[5]],B=[S[6],S[7]],fe=[S[8],S[9]];if(_){var He=y%2===0?this._countVector(q,H):this._countVector(B,q),we=this._projectVectorOnVector(m,He),Be=y+1this.snapDistance_)return this.currentFeature&&this.dispatchEvent({type:"select",selected:[],deselected:[this.currentFeature]}),this.currentFeature=null,!1;var u=this.getNearestCoord(i,t.getGeometry());if(u){u=u.coord;var g=this.getMap().getPixelFromCoordinate(u);return x(e.pixel,g)2){for(r=g[1].getCoordinates(),s=2;a=g[s];s++){var c=a.getCoordinates();c.shift(),r=r.concat(c)}g=[g[0],new A(r)]}if(g.length===2){var f=g[0].getCoordinates(),d=g[1].getCoordinates(),v=f.length+d.length-1;f.pop(),d.shift(),i={geom:e,type:e.getType(),coord1:f,coord2:d,node:e.getCoordinates().length===v,closed:!1}}else if(g.length===1){a=g[0].getCoordinates();var _=F(a[0],t),y=F(a[a.length-1],t);_?(a.shift(),y&&a.pop(),i={geom:e,type:e.getType(),coord1:[],coord2:a,node:!0,closed:y}):y&&(a.pop(),i={geom:e,type:e.getType(),coord1:a,coord2:[],node:!0,closed:!1})}}break}case"MultiLineString":{var w=e.getLineStrings();for(s=0;n=w[s];s++)if(i=this.getArcs(n,t),i){i.geom=e,i.type=e.getType(),i.lstring=s;break}break}case"Polygon":{var L=e.getLinearRings();for(s=0;n=L[s];s++)if(i=this.getArcs(n,t),i){i.geom=e,i.type=e.getType(),i.index=s;break}break}case"MultiPolygon":{var E=e.getPolygons();for(s=0;n=E[s];s++)if(i=this.getArcs(n,t),i){i.geom=e,i.type=e.getType(),i.poly=s;break}break}case"GeometryCollection":{for(l=e.getGeometries(),s=0;n=l[s];s++)if(i=this.getArcs(n,t),i){i.geom=e,i.g=s,i.typeg=i.type,i.type=e.getType();break}break}default:{console.error("ol/interaction/ModifyFeature "+e.getType()+" not supported!");break}}return i}handleDownEvent(e){if(!this.getActive())return!1;var t=this.getClosestFeature(e);if(t&&(this._condition(e)||this._deleteCondition(e))){var i=[];return this.arcs=[],this.sources_.forEach(function(r){var s=ye(Ne([t.coord]),this.tolerance_);i=i.concat(i,r.getFeaturesInExtent(s))}.bind(this)),this._modifiedFeatures=[],i.forEach(function(r){var s=this.getArcs(r.getGeometry(),t.coord);s&&(this._insertVertexCondition(e)||s.node)&&(s.feature=r,this._modifiedFeatures.push(r),this.arcs.push(s))}.bind(this)),this._modifiedFeatures.length?this._deleteCondition(e)?!this._removePoint(t,e):(this.dispatchEvent({type:"modifystart",coordinate:t.coord,originalEvent:e.originalEvent,features:this._modifiedFeatures}),this.handleDragEvent({coordinate:t.coord,originalEvent:e.originalEvent}),!0):!0}else return!1}getModifiedFeatures(){return this._modifiedFeatures||[]}removePoint(){this._removePoint({},{})}_getModification(e){var t=e.coord1.concat(e.coord2);switch(e.type){case"LineString":{if(e.closed&&t.push(t[0]),t.length>1&&e.geom.getCoordinates().length!=t.length)return e.coords=t,!0;break}case"MultiLineString":{if(e.closed&&t.push(t[0]),t.length>1){var i=e.geom.getCoordinates();if(i[e.lstring].length!=t.length)return i[e.lstring]=t,e.coords=i,!0}break}case"Polygon":{if(e.closed&&t.push(t[0]),t.length>3&&(i=e.geom.getCoordinates(),i[e.index].length!=t.length))return i[e.index]=t,e.coords=i,!0;break}case"MultiPolygon":{if(e.closed&&t.push(t[0]),t.length>3&&(i=e.geom.getCoordinates(),i[e.poly][e.index].length!=t.length))return i[e.poly][e.index]=t,e.coords=i,!0;break}case"GeometryCollection":{e.type=e.typeg;var r=e.geom,s=r.getGeometries();e.geom=s[e.g];var a=this._getModification(e);return r.setGeometries(s),e.geom=r,e.type="GeometryCollection",a}}return!1}_removePoint(e,t){if(!this.arcs)return!1;this.overlayLayer_.getSource().clear();var i=!1;return this.arcs.forEach(function(r){i=i||this._getModification(r)}.bind(this)),i&&(this.dispatchEvent({type:"modifystart",coordinate:e.coord,originalEvent:t.originalEvent,features:this._modifiedFeatures}),this.arcs.forEach(function(r){if(r.geom.getType()==="GeometryCollection"){if(r.coords){var s=r.geom.getGeometries();s[r.g].setCoordinates(r.coords),r.geom.setGeometries(s)}}else r.coords&&r.geom.setCoordinates(r.coords)}.bind(this)),this.dispatchEvent({type:"modifyend",coordinate:e.coord,originalEvent:t.originalEvent,features:this._modifiedFeatures})),this.arcs=[],i}handleUpEvent(e){return this.getActive()?(!this.arcs||!this.arcs.length||(this.overlayLayer_.getSource().clear(),this.dispatchEvent({type:"modifyend",coordinate:e.coordinate,originalEvent:e.originalEvent,features:this._modifiedFeatures}),this.arcs=[]),!0):!1}setArcCoordinates(e,t){var i;switch(e.type){case"Point":{e.geom.setCoordinates(t[0]);break}case"MultiPoint":{i=e.geom.getCoordinates(),i[e.index]=t[0],e.geom.setCoordinates(i);break}case"LineString":{e.geom.setCoordinates(t);break}case"MultiLineString":{i=e.geom.getCoordinates(),i[e.lstring]=t,e.geom.setCoordinates(i);break}case"Polygon":{i=e.geom.getCoordinates(),i[e.index]=t,e.geom.setCoordinates(i);break}case"MultiPolygon":{i=e.geom.getCoordinates(),i[e.poly][e.index]=t,e.geom.setCoordinates(i);break}case"GeometryCollection":{e.type=e.typeg;var r=e.geom,s=r.getGeometries();e.geom=s[e.g],this.setArcCoordinates(e,t),r.setGeometries(s),e.geom=r,e.type="GeometryCollection";break}}}handleDragEvent(e){if(!this.getActive())return!1;if(!this.arcs)return!0;this.overlayLayer_.getSource().clear();var t=new M(new T(e.coordinate));return this.overlayLayer_.getSource().addFeature(t),this.arcs.length&&(this.arcs.forEach(function(i){var r=i.coord1.concat([e.coordinate],i.coord2);i.closed&&r.push(e.coordinate),this.setArcCoordinates(i,r)}.bind(this)),this.dispatchEvent({type:"modifying",coordinate:e.coordinate,originalEvent:e.originalEvent,features:this._modifiedFeatures})),!0}handleMoveEvent(e){if(!this.getActive())return!0;this.overlayLayer_.getSource().clear();var t=this.getClosestFeature(e);if(t){var i=new M(new T(t.coord));this.overlayLayer_.getSource().addFeature(i)}var r=e.map.getTargetElement();return this.cursor_&&(t?r.style.cursor!=this.cursor_&&(this.previousCursor_=r.style.cursor,h.setCursor(r,this.cursor_)):this.previousCursor_!==void 0&&(h.setCursor(r,this.previousCursor_),this.previousCursor_=void 0)),!0}getCurrentFeature(){return this.currentFeature}},_e=class extends J{constructor(e){e=e||{},super({handleEvent:function(r){return t.handleEvent_(r)}});var t=this;this.squaredClickTolerance_=e.clickTolerance?e.clickTolerance*e.clickTolerance:36,this.maxCircleCoordinates_=e.maxCircleCoordinates||100,this.features_=e.features,this.source_=e.source,this.conditionFn_=e.condition,this.squareFn_=e.squareCondition,this.centeredFn_=e.centerCondition,this.canRotate_=e.canRotate!==!1,this.geometryName_=e.geometryName||"geometry",this.setSides(e.sides);var i=qe(!0);this.sketch_=new ee,this.overlayLayer_=new K({source:new V({features:this.sketch_,useSpatialIndex:!1}),name:"DrawRegular overlay",displayInLayerSwitcher:!1,style:e.style||i})}setMap(e){this.getMap()&&this.getMap().removeLayer(this.overlayLayer_),super.setMap(e),this.overlayLayer_.setMap(e)}setActive(e){this.reset(),super.setActive(e)}reset(){this.overlayLayer_&&this.overlayLayer_.getSource().clear(),this.started_=!1}setSides(e){e=parseInt(e),this.sides_=e>2?e:0}canRotate(e){return(e===!0||e===!1)&&(this.canRotate_=e),this.canRotate_}getSides(){return this.sides_}getGeom_(){if(this.overlayLayer_.getSource().clear(),!this.center_)return!1;var e;if(this.coord_){var t=this.center_,i=this.coord_,r,s,a,n,l;if(!this.sides_&&this.square_&&!this.centered_)return t=[(i[0]+t[0])/2,(i[1]+t[1])/2],r=[i[0]-t[0],i[1]-t[1]],a=Math.sqrt(r[0]*r[0]+r[1]*r[1]),n=new ae(t,a,"XY"),l=this.getMap().getPixelFromCoordinate(t),s=Math.max(100,Math.abs(l[0]-this.coordPx_[0]),Math.abs(l[1]-this.coordPx_[1])),s=Math.min(this.maxCircleCoordinates_,Math.round(s/3)),re(n,s,0);var u=this.canRotate_&&this.centered_&&this.square_;if(r=[i[0]-t[0],i[1]-t[1]],this.square_&&!u){var g=Math.max(Math.abs(r[0]),Math.abs(r[1]));i=[t[0]+(r[0]>0?g:-g),t[1]+(r[1]>0?g:-g)]}if(a=Math.sqrt(r[0]*r[0]+r[1]*r[1]),a>0){n=new ae(t,a,"XY");var c;if(u?c=Math.atan2(r[1],r[0]):c=this.startAngle[this.sides_]||this.startAngle.default,this.sides_?e=re(n,this.sides_,c):(l=this.getMap().getPixelFromCoordinate(this.center_),s=Math.max(100,Math.abs(l[0]-this.coordPx_[0]),Math.abs(l[1]-this.coordPx_[1])),s=Math.min(this.maxCircleCoordinates_,Math.round(s/(this.centered_?3:5))),e=re(n,s,0)),u)return e;var f=e.getExtent();this.centered_?t=[2*this.center_[0]-this.coord_[0],2*this.center_[1]-this.coord_[1]]:t=this.center_;var d=(t[0]-i[0])/(f[0]-f[2]),v=(t[1]-i[1])/(f[1]-f[3]);if(this.square_){var _=Math.min(Math.abs(d),Math.abs(v));d=Math.sign(d)*_,v=Math.sign(v)*_}var y=[t[0]-f[0]*d,t[1]-f[1]*v];return e.applyTransform(function(w,L,E){for(var C=0;C.9*r,this._longTouch&&this.handleMoveEvent_(e)}.bind(this),r),this.lastEvent=e.type;break}case"pointerup":{this.started_&&this.coord_&&(t=this.downPx_[0]-e.pixel[0],i=this.downPx_[1]-e.pixel[1],t*t+i*i<=this.squaredClickTolerance_&&(this.lastEvent=="pointerdown"||this.lastEvent=="pointermove"||this.lastEvent=="keydown"?this.end_(e):(t=this.upPx_[0]-e.pixel[0],i=this.upPx_[1]-e.pixel[1],t*t+i*i<=this.squaredClickTolerance_?this.end_(e):(this.handleMoveEvent_(e),this.drawPoint_(e.coordinate,!0))))),this.upPx_=e.pixel;break}case"pointerdrag":{if(this.started_){var s=this.getMap().getPixelFromCoordinate(this.center_);t=s[0]-e.pixel[0],i=s[1]-e.pixel[1],t*t+i*i<=this.squaredClickTolerance_&&this.reset()}return!this._longTouch}case"pointermove":{this.started_?(t=this.downPx_[0]-e.pixel[0],i=this.downPx_[1]-e.pixel[1],t*t+i*i>this.squaredClickTolerance_&&(this.handleMoveEvent_(e),this.lastEvent=e.type)):this.drawPoint_(e.coordinate);break}default:{if(this.started_&&(e.type==="click"||e.type==="singleclick"||e.type==="dblclick"))return!1;this.lastEvent=e.type;break}}return!0}finishDrawing(){this.started_&&this.coord_&&this.end_({pixel:this.upPx_,coordinate:this.coord_})}handleMoveEvent_(e){if(this.started_){this.coord_=e.coordinate,this.coordPx_=e.pixel;var t=this.drawSketch_(e);this.dispatchEvent({type:"drawing",feature:t,pixel:e.pixel,startCoordinate:this.center_,coordinate:e.coordinate,square:this.square_,centered:this.centered_})}else this.drawPoint_(e.coordinate)}start_(e){if(this.started_)this.coord_=e.coordinate;else{this.started_=!0,this.center_=e.coordinate,this.coord_=null;var t=this.feature_=new M({});t.setGeometryName(this.geometryName_||"geometry"),t.setGeometry(new R([[e.coordinate,e.coordinate,e.coordinate]])),this.drawSketch_(e),this.dispatchEvent({type:"drawstart",feature:t,pixel:e.pixel,coordinate:e.coordinate})}}end_(e){if(this.coord_=e.coordinate,this.started_=!1,this.coord_&&(this.center_[0]!==this.coord_[0]||this.center_[1]!==this.coord_[1])){var t=this.feature_;t.setGeometry(this.getGeom_()),this.source_?this.source_.addFeature(t):this.features_&&this.features_.push(t),this.dispatchEvent({type:"drawend",feature:t,pixel:e.pixel,coordinate:e.coordinate,square:this.square_,centered:this.centered_})}else this.dispatchEvent({type:"drawcancel",feature:null,pixel:e.pixel,coordinate:e.coordinate,square:this.square_,centered:this.centered_});this.center_=this.coord_=null,this.drawSketch_()}};_e.prototype.startAngle={default:Math.PI/2,3:-Math.PI/2,4:Math.PI/4};var De=class extends j{constructor(e){e=e||{};var t=function(s,a){var n=s[0].pop();return(!this.getPolygon()||this.getPolygon().intersectsCoordinate(n))&&(this.lastOKCoord=[n[0],n[1]]),s[0].push([this.lastOKCoord[0],this.lastOKCoord[1]]),a?a.setCoordinates([s[0].concat([s[0][0]])]):a=new R(s),a},i=e.geometryFunction;if(i?e.geometryFunction=function(s,a,n){return a=t.bind(this)(s,a),i.bind(this)(s,a,n)}:e.geometryFunction=t,e.type="Polygon",super(e),this._select=new ne({style:e.style}),this._select.setActive(!1),e.layers&&(typeof e.layers=="function"?this.layers_=e.layers:e.layers.indexOf&&(this.layers_=function(s){return e.layers.indexOf(s)>=0})),typeof e.featureFilter=="function")this._features=e.featureFilter;else if(e.featureFilter){var r=e.featureFilter;this._features=function(s){return r.indexOf?!!r[r.indexOf(s)]:!!r.item(r.getArray().indexOf(s))}}else this._features=function(){return!0};this.on("drawstart",this._startDrawing.bind(this)),this.on("drawend",this._finishDrawing.bind(this))}setMap(e){this.getMap()&&this.getMap().removeInteraction(this._select),e&&e.addInteraction(this._select),super.setMap.call(this,e)}setActive(e){this._select&&this._select.getFeatures().clear(),super.setActive.call(this,e)}removeLastPoint(){this._feature&&this._feature.getGeometry().getCoordinates()[0].length>2&&super.removeLastPoint.call(this)}getPolygon(){return this._polygon}_startDrawing(e){var t=this.getMap();this._feature=e.feature;var i=e.feature.getGeometry().getCoordinates()[0][0];this._current=null,t.forEachFeatureAtPixel(t.getPixelFromCoordinate(i),function(r,s){if(!this._current&&this._features(r,s)){var a=r.getGeometry();if(a.getType()==="Polygon"&&a.intersectsCoordinate(i))this._polygonIndex=!1,this._polygon=a,this._current=r;else if(a.getType()==="MultiPolygon"&&a.intersectsCoordinate(i)){for(var n=0,l;l=a.getPolygon(n);n++)if(l.intersectsCoordinate(i)){this._polygonIndex=n,this._polygon=l,this._current=r;break}}}}.bind(this),{layerFilter:this.layers_}),this._select.getFeatures().clear(),this._current?this._select.getFeatures().push(this._current):(this.setActive(!1),this.setActive(!0))}_finishDrawing(e){e.hole=e.feature,e.feature=this._select.getFeatures().item(0),this.dispatchEvent({type:"modifystart",features:[this._current]});var t=e.hole.getGeometry().getCoordinates()[0];if(t.length>3)if(this._polygonIndex!==!1){for(var i=e.feature.getGeometry(),r=new Q([]),s=0,a;a=i.getPolygon(s);s++)s===this._polygonIndex&&a.appendLinearRing(new ke(t)),r.appendPolygon(a);e.feature.setGeometry(r)}else this.getPolygon().appendLinearRing(new ke(t));this.dispatchEvent({type:"modifyend",features:[this._current]}),this._feature=null,this._select.getFeatures().clear()}_geometryFn(e,t){var i=e[0].pop();return(!this.getPolygon()||this.getPolygon().intersectsCoordinate(i))&&(this.lastOKCoord=[i[0],i[1]]),e[0].push([this.lastOKCoord[0],this.lastOKCoord[1]]),t?t.setCoordinates([e[0].concat([e[0][0]])]):t=new R(e),t}},Vt=class extends W{constructor(e){e=e||{},e.interactions=e.interactions||{},super({className:(e.className?e.className+" ":"")+"ol-editbar",toggleOne:!0,target:e.target}),this._source=e.source,this._interactions={},this._setSelectInteraction(e),e.edition!==!1&&this._setEditInteraction(e),this._setModifyInteraction(e)}setMap(e){this.getMap()&&(this._interactions.Delete&&this.getMap().removeInteraction(this._interactions.Delete),this._interactions.ModifySelect&&this.getMap().removeInteraction(this._interactions.ModifySelect)),super.setMap(e),this.getMap()&&(this._interactions.Delete&&this.getMap().addInteraction(this._interactions.Delete),this._interactions.ModifySelect&&this.getMap().addInteraction(this._interactions.ModifySelect))}getInteraction(e){return this._interactions[e]}_getTitle(e){if(e)return e.get?e.get("title"):typeof e=="string"?e:e.title}_setSelectInteraction(e){var t=this,i=new W,r;if(e.interactions.Delete!==!1){e.interactions.Delete instanceof Ce?this._interactions.Delete=e.interactions.Delete:this._interactions.Delete=new Ce;var s=this._interactions.Delete;s.setActive(!1),this.getMap()&&this.getMap().addInteraction(s),i.addControl(new oe({className:"ol-delete",title:this._getTitle(e.interactions.Delete)||"Delete",name:"Delete",handleClick:function(n){s.delete(r.getInteraction().getFeatures());var l={type:"select",selected:[],deselected:r.getInteraction().getFeatures().getArray().slice(),mapBrowserEvent:n.mapBrowserEvent};r.getInteraction().getFeatures().clear(),r.getInteraction().dispatchEvent(l)}}))}if(e.interactions.Info!==!1&&i.addControl(new oe({className:"ol-info",name:"Info",title:this._getTitle(e.interactions.Info)||"Show informations",handleClick:function(){t.dispatchEvent({type:"info",features:r.getInteraction().getFeatures()})}})),e.interactions.Select!==!1){e.interactions.Select instanceof ne?this._interactions.Select=e.interactions.Select:this._interactions.Select=new ne({condition:tt});var a=this._interactions.Select;r=new G({className:"ol-selection",name:"Select",title:this._getTitle(e.interactions.Select)||"Select",interaction:a,bar:i.getControls().length?i:void 0,autoActivate:!0,active:!0}),this.addControl(r),a.on("change:active",function(){a.getActive()||a.getFeatures().clear()}.bind(this))}}_setEditInteraction(e){if(e.interactions.DrawPoint!==!1){e.interactions.DrawPoint instanceof j?this._interactions.DrawPoint=e.interactions.DrawPoint:this._interactions.DrawPoint=new j({type:"Point",source:this._source});var t=new G({className:"ol-drawpoint",name:"DrawPoint",title:this._getTitle(e.interactions.DrawPoint)||"Point",interaction:this._interactions.DrawPoint});this.addControl(t)}if(e.interactions.DrawLine!==!1){e.interactions.DrawLine instanceof j?this._interactions.DrawLine=e.interactions.DrawLine:this._interactions.DrawLine=new j({type:"LineString",source:this._source,geometryFunction:function(c,f){return f?f.setCoordinates(c):f=new A(c),this.nbpts=f.getCoordinates().length,f}});var i;e.drawOptions!==!1?i=new G({className:"ol-drawline",title:this._getTitle(e.interactions.DrawLine)||"LineString",name:"DrawLine",interaction:this._interactions.DrawLine,bar:new W({controls:[new $({html:this._getTitle(e.interactions.UndoDraw)||"undo",title:this._getTitle(e.interactions.UndoDraw)||"delete last point",handleClick:function(){i.getInteraction().nbpts>1&&i.getInteraction().removeLastPoint()}}),new $({html:this._getTitle(e.interactions.FinishDraw)||"finish",title:this._getTitle(e.interactions.FinishDraw)||"finish",handleClick:function(){i.getInteraction().nbpts>2&&i.getInteraction().finishDrawing()}})]})}):i=new G({className:"ol-drawline",title:this._getTitle(e.interactions.DrawLine)||"LineString",name:"DrawLine",interaction:this._interactions.DrawLine}),this.addControl(i)}if(e.interactions.DrawPolygon!==!1&&(e.interactions.DrawPolygon instanceof j?this._interactions.DrawPolygon=e.interactions.DrawPolygon:this._interactions.DrawPolygon=new j({type:"Polygon",source:this._source,geometryFunction:function(c,f){return this.nbpts=c[0].length,f?f.setCoordinates([c[0].concat([c[0][0]])]):f=new R(c),f}}),this._setDrawPolygon("ol-drawpolygon",this._interactions.DrawPolygon,this._getTitle(e.interactions.DrawPolygon)||"Polygon","DrawPolygon",e)),e.interactions.DrawHole!==!1&&(e.interactions.DrawHole instanceof De?this._interactions.DrawHole=e.interactions.DrawHole:this._interactions.DrawHole=new De,this._setDrawPolygon("ol-drawhole",this._interactions.DrawHole,this._getTitle(e.interactions.DrawHole)||"Hole","DrawHole",e)),e.interactions.DrawRegular!==!1){var r={pts:"pts",circle:"circle"};e.interactions.DrawRegular instanceof _e?(this._interactions.DrawRegular=e.interactions.DrawRegular,r.pts=this._interactions.DrawRegular.get("ptsLabel")||r.pts,r.circle=this._interactions.DrawRegular.get("circleLabel")||r.circle):(this._interactions.DrawRegular=new _e({source:this._source,sides:4}),e.interactions.DrawRegular&&(r.pts=e.interactions.DrawRegular.ptsLabel||r.pts,r.circle=e.interactions.DrawRegular.circleLabel||r.circle));var s=this._interactions.DrawRegular,a=document.createElement("div"),n=h.create("DIV",{parent:a});h.addListener(n,["click","touchstart"],function(){var c=s.getSides()-1;c<2&&(c=2),s.setSides(c),l.textContent=c>2?c+" "+r.pts:r.circle}.bind(this));var l=h.create("TEXT",{html:"4 "+r.pts,parent:a}),u=h.create("DIV",{parent:a});h.addListener(u,["click","touchstart"],function(){var c=s.getSides()+1;c<3&&(c=3),s.setSides(c),l.textContent=c+" "+r.pts}.bind(this));var g=new G({className:"ol-drawregular",title:this._getTitle(e.interactions.DrawRegular)||"Regular",name:"DrawRegular",interaction:this._interactions.DrawRegular,bar:new W({controls:[new $({html:a})]})});this.addControl(g)}}_setDrawPolygon(e,t,i,r,s){var a;return s.drawOptions!==!1?a=new G({className:e,name:r,title:i,interaction:t,bar:new W({controls:[new $({html:this._getTitle(s.interactions.UndoDraw)||"undo",title:this._getTitle(s.interactions.UndoDraw)||"undo last point",handleClick:function(){a.getInteraction().nbpts>1&&a.getInteraction().removeLastPoint()}}),new $({html:this._getTitle(s.interactions.FinishDraw)||"finish",title:this._getTitle(s.interactions.FinishDraw)||"finish",handleClick:function(){a.getInteraction().nbpts>3&&a.getInteraction().finishDrawing()}})]})}):a=new G({className:e,name:r,title:i,interaction:t}),this.addControl(a),a}_setModifyInteraction(e){if(e.interactions.ModifySelect!==!1&&e.interactions.Select!==!1&&(e.interactions.ModifySelect instanceof Ae?this._interactions.ModifySelect=e.interactions.ModifySelect:this._interactions.ModifySelect=new Ae({features:this.getInteraction("Select").getFeatures()}),this.getMap()&&this.getMap().addInteraction(this._interactions.ModifySelect),this._interactions.ModifySelect.setActive(this._interactions.Select.getActive()),this._interactions.Select.on("change:active",function(){this._interactions.ModifySelect.setActive(this._interactions.Select.getActive())}.bind(this))),e.interactions.Transform!==!1){e.interactions.Transform instanceof ve?this._interactions.Transform=e.interactions.Transform:(this._interactions.Transform=new ve({select:this._interactions.Select,addCondition:it}),this._interactions.Select&&this._interactions.Transform.on("change:active",function(){this._interactions.Select.getActive()||this._interactions.Select.getFeatures().clear()}.bind(this)));var t=new G({html:"",className:"ol-transform",title:this._getTitle(e.interactions.Transform)||"Transform",name:"Transform",interaction:this._interactions.Transform});this.addControl(t)}if(e.interactions.Split!==!1){e.interactions.Split instanceof Pe?this._interactions.Split=e.interactions.Split:this._interactions.Split=new Pe({sources:this._source});var i=new G({className:"ol-split",title:this._getTitle(e.interactions.Split)||"Split",name:"Split",interaction:this._interactions.Split});this.addControl(i)}if(e.interactions.Offset!==!1){e.interactions.Offset instanceof Te?this._interactions.Offset=e.interactions.Offset:this._interactions.Offset=new Te({source:this._source});var r=new G({html:"",className:"ol-offset",title:this._getTitle(e.interactions.Offset)||"Offset",name:"Offset",interaction:this._interactions.Offset});this.addControl(r)}}},ht=class extends me{constructor(e){e=e||{};var t=e.offset||[0,0],i=e.centerOnClick||!1;super({handleDownEvent:function(r){var s=r.frameState.viewState.resolution,a=[r.coordinate[0]+t[0]*s,r.coordinate[1]-t[1]*s];if(/^(BUTTON|A)$/.test(r.originalEvent.target.tagName))return this._dragging=!1,!0;if(this._dragging){i&&this._dragging.setPosition(a,!0);var n=this._dragging.getPosition();return this._dragging.offsetClick=[a[0]-n[0],a[1]-n[1]],this.dispatchEvent({type:"dragstart",overlay:this._dragging,originalEvent:r.originalEvent,frameState:r.frameState,coordinate:n}),!0}return!1},handleDragEvent:function(r){var s=r.frameState.viewState.resolution,a=[r.coordinate[0]+t[0]*s,r.coordinate[1]-t[1]*s];this._dragging&&(a=[a[0]-this._dragging.offsetClick[0],a[1]-this._dragging.offsetClick[1]],this._dragging.setPosition(a,!0),this.dispatchEvent({type:"dragging",overlay:this._dragging,originalEvent:r.originalEvent,frameState:r.frameState,coordinate:a}))},handleUpEvent:function(r){var s=r.frameState.viewState.resolution,a=[r.coordinate[0]+t[0]*s,r.coordinate[1]-t[1]*s];return this._dragging?(a=[a[0]-this._dragging.offsetClick[0],a[1]-this._dragging.offsetClick[1]],this.dispatchEvent({type:"dragend",overlay:this._dragging,originalEvent:r.originalEvent,frameState:r.frameState,coordinate:a}),this._dragging=!1,!0):!1}}),this._overlays=[],e.overlays instanceof Array||(e.overlays=[e.overlays]),e.overlays.forEach(this.addOverlay.bind(this))}addOverlay(e){for(var t=0,i;i=this._overlays[t];t++)if(i===e)return;var r=e.getElement();if(r.parentElement&&r.parentElement.classList.contains("ol-overlaycontainer-stopevent")){console.warn("[DragOverlay.addOverlay] overlay must be created with stopEvent set to false!");return}var s=function(){this.getMap()===e.getMap()&&(this._dragging=e)}.bind(this);this._overlays.push({overlay:e,listener:s}),r.parentNode.addEventListener("pointerdown",s)}removeOverlay(e){for(var t=0,i;i=this._overlays[t];t++)if(i.overlay===e){var r=this._overlays.splice(t,1)[0];e.getElement().parentNode.removeEventListener("pointerdown",r.listener);break}}},ut=class extends rt{constructor(e){super(e)}setPosition(e,t){this.getMap()&&e&&(this._pixel=this.getMap().getPixelFromCoordinate(e)),super.setPosition(e),t&&super.updatePixelPosition()}updatePixelPosition(){if(this.getMap()&&this._pixel&&this.getPosition()){var e=this.getMap().getPixelFromCoordinate(this.getPosition());(Math.round(e[0]*1e3)!==Math.round(this._pixel[0]*1e3)||Math.round(e[0]*1e3)!==Math.round(this._pixel[0]*1e3))&&this.setPosition(this.getMap().getCoordinateFromPixel(this._pixel))}}},Ht=class extends ht{constructor(e){e=e||{};var t=new ut({className:("ol-touch-cursor "+(e.className||"")).trim(),positioning:"top-left",element:h.create("DIV",{}),stopEvent:!1});if(super({centerOnClick:!1,overlays:t}),this.overlay=t,this.setAnchor(e.anchor||"left"),this._listeners={},this.ctouch=new J({handleEvent:function(n){if(!/drag/.test(n.type)&&this.getMap())n.coordinate=this.overlay.getPosition(),n.pixel=this.getMap().getPixelFromCoordinate(n.coordinate),this._lastEvent=n;else{var l=n.frameState.viewState.resolution,u=Math.cos(n.frameState.viewState.rotation),g=Math.sin(n.frameState.viewState.rotation),c=this.getOverlayElement().clientWidth/2,f=getComputedStyle(this.getOverlayElement()),d=[-c-parseInt(f.marginLeft),-c-parseInt(f.marginTop)];this._anchor==="center"&&(d[0]=0),n.coordinate=[n.coordinate[0]+u*d[0]*l+g*d[1]*l,n.coordinate[1]+g*d[0]*l-u*d[1]*l],n.pixel=this.getMap().getPixelFromCoordinate(n.coordinate)}return!0}.bind(this)}),this.ctouch.set("onTop",!0),this.setPosition(e.coordinate,!0),this.set("maxButtons",e.maxButtons||5),e.buttons){e.buttons.length>this.get("maxButtons")&&this.set("maxButtons",e.buttons.length);var i=this.overlay.element,r=e.buttons.length>4?0:1;e.buttons.forEach((function(n,l){l<5&&h.create("DIV",{className:((n.className||"")+" ol-button ol-button-"+(l+r)).trim(),html:h.create("DIV",{html:n.html}),click:n.click,on:n.on,parent:i})}))}var s=!1,a=!1;this.on("dragstart",function(n){return this._pixel=this.getMap().getPixelFromCoordinate(this.overlay.getPosition()),a=n,!n.overlay}),this.on("dragend",function(n){return this._pixel=this.getMap().getPixelFromCoordinate(this.overlay.getPosition()),n.overlay?(s?(this.dispatchEvent({type:"dragend",dragging:s,originalEvent:n.originalEvent,frameState:n.frameState,pixel:this._pixel,coordinate:this.overlay.getPosition()}),s=!1):n.originalEvent.target===this.overlay.element&&this.dispatchEvent({type:"click",dragging:s,originalEvent:n.originalEvent,frameState:n.frameState,pixel:this._pixel,coordinate:this.overlay.getPosition()}),!1):!0}.bind(this)),this.on("dragging",function(n){return this._pixel=this.getMap().getPixelFromCoordinate(this.overlay.getPosition()),n.overlay?(s=!0,a&&(this.dispatchEvent({type:"dragstart",dragging:s,originalEvent:a.originalEvent,frameState:n.frameState,pixel:this._pixel,coordinate:a.coordinate}),a=!1),this.dispatchEvent({type:"dragging",dragging:s,originalEvent:n.originalEvent,frameState:n.frameState,pixel:this._pixel,coordinate:this.overlay.getPosition()}),!1):!0}.bind(this))}setMap(e){this.getMap()&&(this.getMap().removeInteraction(this.ctouch),this.getActive()&&this.getMap().removeOverlay(this.overlay));for(let t in this._listeners)z(this._listeners[t]);this._listeners={},super.setMap(e),e&&(this.getActive()&&(e.addOverlay(this.overlay),setTimeout(function(){this.setPosition(this.getPosition()||e.getView().getCenter())}.bind(this))),e.addInteraction(this.ctouch),this._listeners.addInteraction=e.getInteractions().on("add",function(t){t.element.get("onTop")||(e.removeInteraction(this.ctouch),e.addInteraction(this.ctouch))}.bind(this)))}setAnchor(e){var t=["left","right","center"];t.indexOf(e)>=0&&(t.forEach(function(i){this.getOverlayElement().classList.remove("ol-touch-cursor-"+i)}.bind(this)),this.getOverlayElement().classList.add("ol-touch-cursor-"+e),this._anchor=e)}setActive(e,t){e!==this.getActive()?(this.ctouch&&this.ctouch.setActive(e),e?(this.getMap()&&this.getMap().addOverlay(this.overlay),t?this.setPosition(t):this.getMap()&&this.setPosition(this.getMap().getView().getCenter()),this._activate=setTimeout(function(){this.overlay.element.classList.add("active")}.bind(this),100)):(this.setPosition(),this.overlay.element.classList.remove("active"),this._activate&&clearTimeout(this._activate),this.getMap()&&this.getMap().removeOverlay(this.overlay)),super.setActive(e)):t?this.setPosition(t):this.getMap()&&this.setPosition(this.getMap().getView().getCenter())}setPosition(e){this.overlay.setPosition(e,!0),this.getMap()&&e&&(this._pixel=this.getMap().getPixelFromCoordinate(e))}offsetPosition(e){var t=this.overlay.getPosition();t&&this.overlay.setPosition([t[0]+e[0],t[1]+e[1]])}getPosition(){return this.overlay.getPosition()}getPixel(){if(this.getMap())return this.getMap().getPixelFromCoordinate(this.getPosition())}getOverlay(){return this.overlay}getOverlayElement(){return this.overlay.element}getButtonElement(e){return typeof e=="number"?this.getOverlayElement().getElementsByClassName("ol-button")[e]:this.getOverlayElement().getElementsByClassName(e)[0]}removeButton(e){if(e===void 0)for(var t=this.getOverlayElement().getElementsByClassName("ol-button"),i=t.length-1;i>=0;i--)this.getOverlayElement().removeChild(t[i]);else{var r=this.getButtonElement(e);r&&this.getOverlayElement().removeChild(r)}}addButton(e){var t=this.getOverlayElement().getElementsByClassName("ol-button"),i=this.get("maxButtons")||5;if(t.length>=i){console.error("[ol/interaction/TouchCursor~addButton] too many button on the cursor (max="+i+")...");return}var r=h.create("DIV",{className:((e.className||"")+" ol-button").trim(),html:h.create("DIV",{html:e.html}),click:e.click,on:e.on});!e.before||t.length===0?this.getOverlayElement().appendChild(r):this.getOverlayElement().insertBefore(r,t[0]);var s=t.length>=i?0:1;for(let a=0;athis.get("maxLength");)this.shift();if(this.get("maxSize"))for(;this.length()>1&&this.size()>this.get("maxSize");)this.shift()}getStack(e){return e==="redo"?this._redo:this._undo}push(e,t,i){return this._defs[e]?(this._undoStack.push({type:e,name:i,custom:!0,prop:t}),!0):(console.warn('[UndoRedoInteraction]: "'+e+'" is not defined.'),!1)}shift(){this._doShift=!0;var e=this._undoStack.removeAt(0);if(this._doShift=!1,e.type==="blockstart")for(e=this._undoStack.item(0);this._undoStack.getLength()&&e.level>0;)this._undoStack.removeAt(0),e=this._undoStack.item(0)}setActive(e){super.setActive(e),this._record=e}setMap(e){this._mapListener&&this._mapListener.forEach(function(t){z(t)}),this._mapListener=[],super.setMap(e),e&&(this._mapListener.push(e.on("undoblockstart",this.blockStart.bind(this))),this._mapListener.push(e.on("undoblockend",this.blockEnd.bind(this)))),this._watchSources(),this._watchInteractions()}_watchSources(){var e=this.getMap();this._sourceListener&&this._sourceListener.forEach(function(s){z(s)}),this._sourceListener=[];var t=this;function i(s,a){return a||(a=[]),s.forEach(function(n){n.getSource&&n.getSource()instanceof V?(!t._layers||t._layers.indexOf(n)>=0)&&a.push(n):n.getLayers&&i(n.getLayers(),a)}),a}if(e){var r=i(e.getLayers());r.forEach((function(s){var a=s.getSource();this._sourceListener.push(a.on(["addfeature","removefeature"],this._onAddRemove.bind(this))),this._sourceListener.push(a.on("clearstart",function(){this.blockStart("clear")}.bind(this))),this._sourceListener.push(a.on("clearend",this.blockEnd.bind(this)))}).bind(this)),this._sourceListener.push(e.getLayers().on(["add","remove"],this._watchSources.bind(this)))}}_watchInteractions(){var e=this.getMap();this._interactionListener&&this._interactionListener.forEach(function(t){z(t)}),this._interactionListener=[],e&&(e.getInteractions().forEach((function(t){this._interactionListener.push(t.on(["setattributestart","modifystart","modifyend","rotatestart","rotateend","translatestart","translateend","scalestart","scaleend","deletestart","deleteend","beforesplit","aftersplit"],this._onInteraction.bind(this)))}).bind(this)),this._interactionListener.push(e.getInteractions().on(["add","remove"],this._watchInteractions.bind(this))))}_onAddRemove(e){this._record&&(this._redoStack.clear(),this._redo.length=0,this._undoStack.push({type:e.type,source:e.target,feature:e.feature}))}_onInteraction(e){var t=this._onInteraction[e.type];t&&t.call(this,e)}blockStart(e){this._redoStack.clear(),this._redo.length=0,this._undoStack.push({type:"blockstart",name:e}),this._level++}blockEnd(){this._undoStack.push({type:"blockend"}),this._level--}_handleDo(e,t){if(this.getActive()){if(this._record=!1,e.custom)this._defs[e.type]?t?this._defs[e.type].undo(e.prop):this._defs[e.type].redo(e.prop):console.warn('[UndoRedoInteraction]: "'+e.type+'" is not defined.');else switch(e.type){case"addfeature":{t?e.source.removeFeature(e.feature):e.source.addFeature(e.feature);break}case"removefeature":{t?e.source.addFeature(e.feature):e.source.removeFeature(e.feature);break}case"changegeometry":{var i=e.feature.getGeometry();e.feature.setGeometry(e.oldGeom),e.oldGeom=i;break}case"changeattribute":{var r=e.newProperties,s=e.oldProperties;for(var a in s)s===void 0?e.feature.unset(a):e.feature.set(a,s[a]);e.oldProperties=r,e.newProperties=s;break}case"blockstart":{this._block+=t?-1:1;break}case"blockend":{this._block+=t?1:-1;break}default:console.warn('[UndoRedoInteraction]: "'+e.type+'" is not defined.')}this._block<0&&(this._block=0),this._block&&(t?this.undo():this.redo()),this._record=!0,this.dispatchEvent({type:t?"undo":"redo",action:e})}}undo(){var e=this._undoStack.item(this._undoStack.getLength()-1);e&&(this._redoStack.push(e),this._undoStack.pop(),this._handleDo(e,!0))}abort(){var e=this._undoStack.item(this._undoStack.getLength()-1);if(e){this._abort=!0;for(var t=this._undoStack.pop();t.level!==0;)t=this._undoStack.pop();this._abort=!1}}redo(){var e=this._redoStack.item(this._redoStack.getLength()-1);e&&(this._undoStack.push(e),this._redoStack.pop(),this._handleDo(e,!1))}clear(){this._doClear=!0,this._undo.length=this._redo.length=0,this._undoStack.clear(),this._redoStack.clear(),this._doClear=!1,this.dispatchEvent({type:"stack:clear"})}hasUndo(){return this._undoStack.getLength()}hasRedo(){return this._redoStack.getLength()}};N.prototype._onInteraction.setattributestart=function(o){this.blockStart(o.target.get("name")||"setattribute");var e=Object.assign({},o.properties);o.features.forEach(function(t){var i={};for(var r in e)i[r]=t.get(r);this._undoStack.push({type:"changeattribute",feature:t,newProperties:e,oldProperties:i})}.bind(this)),this.blockEnd()};N.prototype._onInteraction.rotatestart=N.prototype._onInteraction.translatestart=N.prototype._onInteraction.scalestart=N.prototype._onInteraction.modifystart=function(o){this._modify={coordinate:o.coordinate,blockStart:o.type.replace(/start$/,""),modify:[]},o.features.forEach(function(e){this._modify.modify.push({type:"changegeometry",feature:e,oldGeom:e.getGeometry().clone()})}.bind(this))};N.prototype._onInteraction.translateend=N.prototype._onInteraction.rotateend=N.prototype._onInteraction.scaleend=N.prototype._onInteraction.modifyend=function(o){this._modify&&(o.type==="modifyend"&&(o.transformed=!o.coordinate||!F(this._modify.coordinate,o.coordinate),o.transformed||this._modify.modify.forEach(function(e){e.feature.getGeometry().getFlatCoordinates().length!==e.oldGeom.getFlatCoordinates().length&&(o.transformed=!0),console.log(e.feature.getGeometry().getFlatCoordinates().length,e.oldGeom.getFlatCoordinates().length)})),o.type==="translateend"&&o.coordinate&&(o.transformed=!F(this._modify.coordinate,o.coordinate)),o.transformed&&(this.blockStart(this._modify.blockStart),this._modify.modify.forEach(function(e){this._undoStack.push(e)}.bind(this)),this.blockEnd()),this._modify=null)};N.prototype._onInteraction.beforesplit=function(){var o=this._undoStack.getLength();o>2&&this._undoStack.item(o-1).type==="blockend"&&this._undoStack.item(o-2).type==="changegeometry"?this._undoStack.pop():this.blockStart("split")};N.prototype._onInteraction.deletestart=function(){this.blockStart("delete")};N.prototype._onInteraction.aftersplit=N.prototype._onInteraction.deleteend=N.prototype.blockEnd;export{Lt as a,Ct as b,Ae as c,N as d,Vt as e,W as f,oe as g,Ht as h,G as i,ot as o}; //# sourceMappingURL=ol-ext-DytxBANR.js.map